about summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
Diffstat (limited to 'Src')
-rw-r--r--Src/Modules/parameter.c40
-rw-r--r--Src/Modules/parameter.mdd2
-rw-r--r--Src/pattern.c3
3 files changed, 43 insertions, 2 deletions
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, "?(", "*(", "+(", "!(", "@("
 };