zpmod  b19981f
High-performance Zsh module for script optimization and filesystem helpers
options.c File Reference

Stable-to-runtime option mapping across zsh versions. More...

#include "zpmod.mdh"
#include "zpmod.pro"
#include "zpmod_compat.h"
#include <stddef.h>
Include dependency graph for options.c:

Go to the source code of this file.

Data Structures

struct  zp_option_name
 

Functions

void zp_setup_options_table (void)
 Populate runtime option indices for the stable enum table. More...
 
int zp_conv_opt (int zp_opt_num)
 Convert a stable option enum to a runtime option index (sign-preserving). More...
 

Variables

static int zp_opt_for_zsh_version [64] = {0}
 
static struct zp_option_name zp_options []
 

Detailed Description

Stable-to-runtime option mapping across zsh versions.

Provides zp_setup_options_table() to resolve version-stable enum values to runtime option indices using zsh’s optlookup(), and zp_conv_opt() to convert an enum for use with isset()/dosetopt().

Definition in file options.c.

Function Documentation

◆ zp_conv_opt()

int zp_conv_opt ( int  zp_opt_num)

Convert a stable option enum to a runtime option index (sign-preserving).

Definition at line 52 of file options.c.

References ZP_OPT_COUNT__, and zp_opt_for_zsh_version.

Referenced by bin_custom_dot(), and custom_source().

Here is the caller graph for this function:

◆ zp_setup_options_table()

void zp_setup_options_table ( void  )

Populate runtime option indices for the stable enum table.

Definition at line 37 of file options.c.

References zp_option_name::enum_val, zp_option_name::name, optlookup(), zp_opt_for_zsh_version, and zp_options.

Referenced by setup_().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ zp_opt_for_zsh_version

int zp_opt_for_zsh_version[64] = {0}
static

Definition at line 15 of file options.c.

Referenced by zp_conv_opt(), and zp_setup_options_table().

◆ zp_options

struct zp_option_name zp_options[]
static
Initial value:
= {
{"function_argzero", FUNCTIONARGZERO__},
{"path_dirs", PATHDIRS__},
{"posix_builtins", POSIXBUILTINS__},
{"shin_stdin", SHINSTDIN__},
{"source_trace", SOURCETRACE__},
{NULL, 0}}
@ SOURCETRACE__
Definition: zpmod_compat.h:20
@ POSIXBUILTINS__
Definition: zpmod_compat.h:18
@ PATHDIRS__
Definition: zpmod_compat.h:17
@ FUNCTIONARGZERO__
Definition: zpmod_compat.h:16
@ SHINSTDIN__
Definition: zpmod_compat.h:19

Definition at line 15 of file options.c.

Referenced by zp_setup_options_table().