mirror of
https://github.com/zsh-users/zsh
synced 2024-09-15 22:20:22 +00:00
31805: Add $patchars and $dis_patchars to zsh/parameter module
This commit is contained in:
parent
d0fe73c5fb
commit
fa03332635
|
@ -57,6 +57,14 @@ vindex(dis_reswords)
|
|||
item(tt(dis_reswords))(
|
||||
Like tt(reswords) but for disabled reserved words.
|
||||
)
|
||||
vindex(patchars)
|
||||
item(tt(patchars))(
|
||||
This array contains the enabled pattern characters.
|
||||
)
|
||||
vindex(dis_patchars)
|
||||
item(tt(dis_patchars))(
|
||||
Like tt(patchars) but for disabled pattern characters.
|
||||
)
|
||||
vindex(aliases)
|
||||
item(tt(aliases))(
|
||||
This maps the names of the regular aliases currently enabled to their
|
||||
|
|
|
@ -759,6 +759,38 @@ disreswordsgetfn(UNUSED(Param pm))
|
|||
return getreswords(DISABLED);
|
||||
}
|
||||
|
||||
/* Functions for the patchars special parameter. */
|
||||
|
||||
/**/
|
||||
static char **
|
||||
getpatchars(int dis)
|
||||
{
|
||||
int i;
|
||||
char **ret, **p;
|
||||
|
||||
p = ret = (char **) zhalloc(ZPC_COUNT * sizeof(char *));
|
||||
|
||||
for (i = 0; i < ZPC_COUNT; i++)
|
||||
if (zpc_strings[i] && !dis == !zpc_disables[i])
|
||||
*p++ = dupstring(zpc_strings[i]);
|
||||
|
||||
*p = NULL;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static char **
|
||||
patcharsgetfn(UNUSED(Param pm))
|
||||
{
|
||||
return getpatchars(0);
|
||||
}
|
||||
|
||||
static char **
|
||||
dispatcharsgetfn(UNUSED(Param pm))
|
||||
{
|
||||
return getpatchars(1);
|
||||
}
|
||||
|
||||
/* Functions for the options special parameter. */
|
||||
|
||||
/**/
|
||||
|
@ -2018,6 +2050,10 @@ static const struct gsu_array reswords_gsu =
|
|||
{ reswordsgetfn, arrsetfn, stdunsetfn };
|
||||
static const struct gsu_array disreswords_gsu =
|
||||
{ disreswordsgetfn, arrsetfn, stdunsetfn };
|
||||
static const struct gsu_array patchars_gsu =
|
||||
{ patcharsgetfn, arrsetfn, stdunsetfn };
|
||||
static const struct gsu_array dispatchars_gsu =
|
||||
{ dispatcharsgetfn, arrsetfn, stdunsetfn };
|
||||
static const struct gsu_array dirs_gsu =
|
||||
{ dirsgetfn, dirssetfn, stdunsetfn };
|
||||
static const struct gsu_array historywords_gsu =
|
||||
|
@ -2038,6 +2074,8 @@ static struct paramdef partab[] = {
|
|||
&pmdisfunctions_gsu, getpmdisfunction, scanpmdisfunctions),
|
||||
SPECIALPMDEF("dis_galiases", 0,
|
||||
&pmdisgaliases_gsu, getpmdisgalias, scanpmdisgaliases),
|
||||
SPECIALPMDEF("dis_patchars", PM_ARRAY|PM_READONLY,
|
||||
&dispatchars_gsu, NULL, NULL),
|
||||
SPECIALPMDEF("dis_reswords", PM_ARRAY|PM_READONLY,
|
||||
&disreswords_gsu, NULL, NULL),
|
||||
SPECIALPMDEF("dis_saliases", 0,
|
||||
|
@ -2072,6 +2110,8 @@ static struct paramdef partab[] = {
|
|||
&pmoptions_gsu, getpmoption, scanpmoptions),
|
||||
SPECIALPMDEF("parameters", PM_READONLY,
|
||||
NULL, getpmparameter, scanpmparameters),
|
||||
SPECIALPMDEF("patchars", PM_ARRAY|PM_READONLY,
|
||||
&patchars_gsu, NULL, NULL),
|
||||
SPECIALPMDEF("reswords", PM_ARRAY|PM_READONLY,
|
||||
&reswords_gsu, NULL, NULL),
|
||||
SPECIALPMDEF("saliases", 0,
|
||||
|
|
|
@ -2,6 +2,6 @@ name=zsh/parameter
|
|||
link=either
|
||||
load=yes
|
||||
|
||||
autofeatures="p:parameters p:commands p:functions p:dis_functions p:funcfiletrace p:funcsourcetrace p:funcstack p:functrace p:builtins p:dis_builtins p:reswords p:dis_reswords p:options p:modules p:dirstack p:history p:historywords p:jobtexts p:jobdirs p:jobstates p:nameddirs p:userdirs p:aliases p:dis_aliases p:galiases p:dis_galiases p:saliases p:dis_saliases"
|
||||
autofeatures="p:parameters p:commands p:functions p:dis_functions p:funcfiletrace p:funcsourcetrace p:funcstack p:functrace p:builtins p:dis_builtins p:reswords p:dis_reswords p:patchars p:dis_patchars p:options p:modules p:dirstack p:history p:historywords p:jobtexts p:jobdirs p:jobstates p:nameddirs p:userdirs p:aliases p:dis_aliases p:galiases p:dis_galiases p:saliases p:dis_saliases"
|
||||
|
||||
objects="parameter.o"
|
||||
|
|
|
@ -236,7 +236,8 @@ static const char zpc_chars[ZPC_COUNT] = {
|
|||
* Corresponding strings used in enable/disable -p.
|
||||
* NULL means no way of turning this on or off.
|
||||
*/
|
||||
static const char *zpc_strings[ZPC_COUNT] = {
|
||||
/**/
|
||||
const char *zpc_strings[ZPC_COUNT] = {
|
||||
NULL, NULL, "|", NULL, "~", "(", "?", "*", "[", "<",
|
||||
"^", "#", NULL, "?(", "*(", "+(", "!(", "@("
|
||||
};
|
||||
|
|
|
@ -183,6 +183,7 @@
|
|||
>p:dis_builtins
|
||||
>p:dis_functions
|
||||
>p:dis_galiases
|
||||
>p:dis_patchars
|
||||
>p:dis_reswords
|
||||
>p:dis_saliases
|
||||
>p:funcfiletrace
|
||||
|
@ -200,6 +201,7 @@
|
|||
>p:nameddirs
|
||||
>p:options
|
||||
>p:parameters
|
||||
>p:patchars
|
||||
>p:reswords
|
||||
>p:saliases
|
||||
>p:userdirs
|
||||
|
|
Loading…
Reference in a new issue