summaryrefslogtreecommitdiff
path: root/Src/zsh.h
diff options
context:
space:
mode:
authorAxel Beckert <abe@deuxchevaux.org>2022-04-11 00:17:48 +0200
committerAxel Beckert <abe@deuxchevaux.org>2022-04-11 00:17:48 +0200
commitb09f4483416c54c1782824633dfabaf2ec0265b6 (patch)
tree304bc82642862525ae680c7fbaa249663b10ad57 /Src/zsh.h
parent12eb3e5356f2fc3351eed58ef1cef1b8fb83b504 (diff)
parent6e55c920503071e917619b8cb1a188cd35d772db (diff)
downloadzsh-b09f4483416c54c1782824633dfabaf2ec0265b6.tar.gz
zsh-b09f4483416c54c1782824633dfabaf2ec0265b6.zip
New upstream version 5.8.1.2-test
Diffstat (limited to 'Src/zsh.h')
-rw-r--r--Src/zsh.h95
1 files changed, 69 insertions, 26 deletions
diff --git a/Src/zsh.h b/Src/zsh.h
index 834142895..40f9ea537 100644
--- a/Src/zsh.h
+++ b/Src/zsh.h
@@ -832,22 +832,59 @@ struct estate {
char *strs; /* strings from prog */
};
+/*
+ * A binary tree of strings.
+ *
+ * Refer to the "Word code." comment at the top of Src/parse.c for details.
+ */
typedef struct eccstr *Eccstr;
-
struct eccstr {
+ /* Child pointers. */
Eccstr left, right;
+
+ /* String; pointer into to estate::strs. */
char *str;
- wordcode offs, aoffs;
+
+ /* Wordcode of a long string, as described in the Src/parse.c comment. */
+ wordcode offs;
+
+ /* Raw memory offset of str in estate::strs. */
+ wordcode aoffs;
+
+ /*
+ * ### The number of starts and ends of function definitions up to this point.
+ *
+ * String reuse may only happen between strings that have the same "nfunc" value.
+ */
int nfunc;
+
+ /* Hash of str. */
int hashval;
};
-#define EC_NODUP 0
-#define EC_DUP 1
-#define EC_DUPTOK 2
+/*
+ * Values for the "dup" parameter to ecgetstr().
+ */
+enum ec_dup_t {
+ /*
+ * Make no promises about how the return value is allocated, except that
+ * the caller does not need to explicitly free it. It might be heap allocated,
+ * a static string, or anything in between.
+ */
+ EC_NODUP = 0,
-#define WC_CODEBITS 5
+ /* Allocate the return value from the heap. */
+ EC_DUP = 1,
+
+ /*
+ * If the string contains tokens (as indicated by the least significant bit
+ * of the wordcode), behave as EC_DUP; otherwise, as EC_NODUP.
+ */
+ EC_DUPTOK = 2
+};
+/* See comment at the top of Src/parse.c for details. */
+#define WC_CODEBITS 5
#define wc_code(C) ((C) & ((wordcode) ((1 << WC_CODEBITS) - 1)))
#define wc_data(C) ((C) >> WC_CODEBITS)
#define wc_bdata(D) ((D) << WC_CODEBITS)
@@ -876,7 +913,11 @@ struct eccstr {
#define WC_AUTOFN 20
#define WC_TRY 21
-/* increment as necessary */
+/*
+ * Increment as necessary.
+ *
+ * If this exceeds 31, increment WC_CODEBITS.
+ */
#define WC_COUNT 22
#define WCB_END() wc_bld(WC_END, 0)
@@ -1156,7 +1197,10 @@ typedef void (*ScanTabFunc) _((HashTable, ScanFunc, int));
typedef void (*PrintTableStats) _((HashTable));
-/* hash table for standard open hashing */
+/* Hash table for standard open hashing. Instances of struct hashtable can be *
+ * created only by newhashtable(). In fact, this function creates an instance *
+ * of struct hashtableimpl, which is made of struct hashtable (public part) *
+ * and additional data members that are only accessible from hashtable.c. */
struct hashtable {
/* HASHTABLE DATA */
@@ -1180,10 +1224,6 @@ struct hashtable {
FreeNodeFunc freenode; /* pointer to function to free a node */
ScanFunc printnode; /* pointer to function to print a node */
ScanTabFunc scantab; /* pointer to function to scan table */
-
-#ifdef HASHTABLE_INTERNAL_MEMBERS
- HASHTABLE_INTERNAL_MEMBERS /* internal use in hashtable.c */
-#endif
};
/* generic hash table node */
@@ -1408,7 +1448,7 @@ struct builtin {
int minargs; /* minimum number of arguments */
int maxargs; /* maximum number of arguments, or -1 for no limit */
int funcid; /* xbins (see above) for overloaded handlerfuncs */
- char *optstr; /* string of legal options */
+ char *optstr; /* string of legal options (see execbuiltin()) */
char *defopts; /* options set by default for overloaded handlerfuncs */
};
@@ -1889,8 +1929,10 @@ struct tieddata {
made read-only by the user */
#define PM_READONLY_SPECIAL (PM_SPECIAL|PM_READONLY|PM_RO_BY_DESIGN)
#define PM_DONTIMPORT (1<<22) /* do not import this variable */
+#define PM_DECLARED (1<<22) /* explicitly named with typeset */
#define PM_RESTRICTED (1<<23) /* cannot be changed in restricted mode */
#define PM_UNSET (1<<24) /* has null value */
+#define PM_DEFAULTED (PM_DECLARED|PM_UNSET)
#define PM_REMOVABLE (1<<25) /* special can be removed from paramtab */
#define PM_AUTOLOAD (1<<26) /* autoloaded from module */
#define PM_NORESTORE (1<<27) /* do not restore value of local special */
@@ -1951,6 +1993,7 @@ struct tieddata {
#define SUB_START 0x1000 /* force match at start with SUB_END
* and no SUB_SUBSTR */
#define SUB_LIST 0x2000 /* no substitution, return list of matches */
+#define SUB_EGLOB 0x4000 /* use extended globbing in patterns */
/*
* Structure recording multiple matches inside a test string.
@@ -2346,6 +2389,7 @@ enum {
BSDECHO,
CASEGLOB,
CASEMATCH,
+ CASEPATHS,
CBASES,
CDABLEVARS,
CDSILENT,
@@ -2354,6 +2398,7 @@ enum {
CHECKJOBS,
CHECKRUNNINGJOBS,
CLOBBER,
+ CLOBBEREMPTY,
APPENDCREATE,
COMBININGCHARS,
COMPLETEALIASES,
@@ -2484,6 +2529,7 @@ enum {
SHNULLCMD,
SHOPTIONLETTERS,
SHORTLOOPS,
+ SHORTREPEAT,
SHWORDSPLIT,
SINGLECOMMAND,
SINGLELINEZLE,
@@ -2492,6 +2538,7 @@ enum {
TRANSIENTRPROMPT,
TRAPSASYNC,
TYPESETSILENT,
+ TYPESETTOUNSET,
UNSET,
VERBOSE,
VIMODE,
@@ -2683,11 +2730,6 @@ struct ttyinfo {
/* Bits to shift the background colour */
#define TXT_ATTR_BG_COL_SHIFT (40)
-/* Flag to use termcap AF sequence to set colour, if available */
-#define TXT_ATTR_FG_TERMCAP 0x1000
-/* Flag to use termcap AB sequence to set colour, if available */
-#define TXT_ATTR_BG_TERMCAP 0x2000
-
/* Flag to indicate that foreground is a 24-bit colour */
#define TXT_ATTR_FG_24BIT 0x4000
/* Flag to indicate that background is a 24-bit colour */
@@ -2696,16 +2738,15 @@ struct ttyinfo {
/* Things to turn on, including values for the colour elements */
#define TXT_ATTR_ON_VALUES_MASK \
(TXT_ATTR_ON_MASK|TXT_ATTR_FG_COL_MASK|TXT_ATTR_BG_COL_MASK|\
- TXT_ATTR_FG_TERMCAP|TXT_ATTR_BG_TERMCAP|\
TXT_ATTR_FG_24BIT|TXT_ATTR_BG_24BIT)
/* Mask out everything to do with setting a foreground colour */
#define TXT_ATTR_FG_ON_MASK \
- (TXTFGCOLOUR|TXT_ATTR_FG_COL_MASK|TXT_ATTR_FG_TERMCAP|TXT_ATTR_FG_24BIT)
+ (TXTFGCOLOUR|TXT_ATTR_FG_COL_MASK|TXT_ATTR_FG_24BIT)
/* Mask out everything to do with setting a background colour */
#define TXT_ATTR_BG_ON_MASK \
- (TXTBGCOLOUR|TXT_ATTR_BG_COL_MASK|TXT_ATTR_BG_TERMCAP|TXT_ATTR_BG_24BIT)
+ (TXTBGCOLOUR|TXT_ATTR_BG_COL_MASK|TXT_ATTR_BG_24BIT)
/* Mask out everything to do with activating colours */
#define TXT_ATTR_COLOUR_ON_MASK \
@@ -2971,17 +3012,18 @@ enum {
SORTIT_ANYOLDHOW = 0, /* Defaults */
SORTIT_IGNORING_CASE = 1,
SORTIT_NUMERICALLY = 2,
- SORTIT_BACKWARDS = 4,
+ SORTIT_NUMERICALLY_SIGNED = 4,
+ SORTIT_BACKWARDS = 8,
/*
* Ignore backslashes that quote another character---which may
* be another backslash; the second backslash is active.
*/
- SORTIT_IGNORING_BACKSLASHES = 8,
+ SORTIT_IGNORING_BACKSLASHES = 16,
/*
* Ignored by strmetasort(); used by paramsubst() to indicate
* there is some sorting to do.
*/
- SORTIT_SOMEHOW = 16,
+ SORTIT_SOMEHOW = 32,
};
/*
@@ -3235,14 +3277,15 @@ enum zexit_t {
#define AFTERTRAPHOOK (zshhooks + 2)
#define GETCOLORATTR (zshhooks + 3)
-#ifdef MULTIBYTE_SUPPORT
-/* Final argument to mb_niceformat() */
+/* Final argument to [ms]b_niceformat() */
enum {
NICEFLAG_HEAP = 1, /* Heap allocation where needed */
NICEFLAG_QUOTE = 2, /* Result will appear in $'...' */
NICEFLAG_NODUP = 4, /* Leave allocated */
};
+#ifdef MULTIBYTE_SUPPORT
+
/* Metafied input */
#define nicezputs(str, outs) (void)mb_niceformat((str), (outs), NULL, 0)
#define MB_METACHARINIT() mb_charinit()