summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--Doc/Zsh/mod_parameter.yo8
-rw-r--r--Src/Modules/parameter.c40
-rw-r--r--Src/Modules/parameter.mdd2
-rw-r--r--Src/pattern.c3
-rw-r--r--Test/V01zmodload.ztst2
5 files changed, 53 insertions, 2 deletions
diff --git a/Doc/Zsh/mod_parameter.yo b/Doc/Zsh/mod_parameter.yo
index 5948d74f2..32d4796f7 100644
--- a/Doc/Zsh/mod_parameter.yo
+++ b/Doc/Zsh/mod_parameter.yo
@@ -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
diff --git a/Src/Modules/parameter.c b/Src/Modules/parameter.c
index a029c9cb4..22148f991 100644
--- a/Src/Modules/parameter.c
+++ b/Src/Modules/parameter.c
@@ -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,
diff --git a/Src/Modules/parameter.mdd b/Src/Modules/parameter.mdd
index eb48d5f2a..a91a5dc09 100644
--- a/Src/Modules/parameter.mdd
+++ b/Src/Modules/parameter.mdd
@@ -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"
diff --git a/Src/pattern.c b/Src/pattern.c
index 4f0166bfa..609a9e372 100644
--- a/Src/pattern.c
+++ b/Src/pattern.c
@@ -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, "?(", "*(", "+(", "!(", "@("
 };
diff --git a/Test/V01zmodload.ztst b/Test/V01zmodload.ztst
index ea908e952..3580bacea 100644
--- a/Test/V01zmodload.ztst
+++ b/Test/V01zmodload.ztst
@@ -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