From 09960dc5b966fb1a1c20a0af654165e5981a999b Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Wed, 12 May 2010 10:06:59 +0000 Subject: 27951: Add $ZSH_EVAL_CONTEXT and $zsh_eval_contxt --- Doc/Zsh/expn.yo | 20 +++++++----- Doc/Zsh/params.yo | 94 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 107 insertions(+), 7 deletions(-) (limited to 'Doc') diff --git a/Doc/Zsh/expn.yo b/Doc/Zsh/expn.yo index f04d6ea17..98c8ab2df 100644 --- a/Doc/Zsh/expn.yo +++ b/Doc/Zsh/expn.yo @@ -2149,12 +2149,17 @@ xitem(tt(e)var(string)) item(tt(PLUS())var(cmd))( The var(string) will be executed as shell code. The filename will be included in the list if and only if the code returns a zero status (usually -the status of the last command). The first character after the `tt(e)' +the status of the last command). + +In the first form, the first character after the `tt(e)' will be used as a separator and anything up to the next matching separator will be taken as the var(string); `tt([)', `tt({)', and `tt(<)' match `tt(])', `tt(})', and `tt(>)', respectively, while any other character matches itself. Note that expansions must be quoted in the var(string) to prevent them from being expanded before globbing is done. +var(string) is then executed as shell code. The string tt(globqual) +is appended to the array tt(zsh_eval_context) the duration of +execution. vindex(REPLY, use of) vindex(reply, use of) @@ -2288,12 +2293,13 @@ specifiers may occur to resolve ties. tt(oe) and tt(o+) are special cases; they are each followed by shell code, delimited as for the tt(e) glob qualifier and the tt(+) glob qualifier respectively (see above). The code is executed for each matched file with -the parameter tt(REPLY) set to the name of the file on entry. The code -should modify the parameter tt(REPLY) in some fashion. On return, the value -of the parameter is used instead of the file name as the string on which to -sort. Unlike other sort operators, tt(oe) and tt(o+) may be repeated, but -note that the maximum number of sort operators of any kind that may appear -in any glob expression is 12. +the parameter tt(REPLY) set to the name of the file on entry and +tt(globsort) appended to tt(zsh_eval_context). The code +should modify the parameter tt(REPLY) in some fashion. On return, the +value of the parameter is used instead of the file name as the string on +which to sort. Unlike other sort operators, tt(oe) and tt(o+) may be +repeated, but note that the maximum number of sort operators of any kind +that may appear in any glob expression is 12. ) item(tt(O)var(c))( like `tt(o)', but sorts in descending order; i.e. `tt(*(^oc))' is the diff --git a/Doc/Zsh/params.yo b/Doc/Zsh/params.yo index 99a6e6958..55d5cda6a 100644 --- a/Doc/Zsh/params.yo +++ b/Doc/Zsh/params.yo @@ -722,6 +722,100 @@ vindex(VENDOR) item(tt(VENDOR))( The vendor, as determined at compile time. ) +vindex(zsh_eval_context) +vindex(ZSH_EVAL_CONTEXT) +item(tt(zsh_eval_context) (tt(ZSH_EVAL_CONTEXT) ))( +An array (colon-separated list) indicating the context of shell +code that is being run. Each time a piece of shell code that +is stored within the shell is executed a string is temporarily appended to +the array to indicate the type of operation that is being performed. +Read in order the array gives an indication of the stack of +operations being performed with the most immediate context last. + +The context is one of the following: +startitem() +item(tt(cmdarg))( +Code specified by the tt(-c) option to the command line that invoked +the shell. +) +item(tt(cmdsubst))( +Command substitution using the tt(`)var(...)tt(`) or +tt($+LPAR())var(...)tt(RPAR()) construct. +) +item(tt(equalsubst))( +File substitution using the tt(=+LPAR())var(...)tt(RPAR()) construct. +) +item(tt(eval))( +Code executed by the tt(eval) builtin. +) +item(tt(evalautofunc))( +Code executed with the tt(KSH_AUTOLOAD) mechanism in order to define +an autoloaded function. +) +item(tt(fc))( +Code from the shell history executed by the tt(-e) option to the tt(fc) +builtin. +) +item(tt(file))( +Lines of code being read directly from a file, for example by +the tt(source) builtin. +) +item(tt(filecode))( +Lines of code being read from a tt(.zwc) file instead of directly +from the source file. +) +item(tt(globqual))( +Code executed by the tt(e) or tt(+) glob qualifier. +) +item(tt(globsort))( +Code executed to order files by the tt(o) glob qualifier. +) +item(tt(insubst))( +File substitution using the tt(LPAR())var(...)tt(RPAR()) construct. +) +item(tt(sched))( +Code executed by the tt(sched) builtin. +) +item(tt(shfunc))( +A shell function. +) +item(tt(stty))( +Code passed to tt(stty) by the tt(STTY) environment variable. +Normally this is passed directly to the system's tt(stty) command, +so this value is unlikely to be seen in practice. +) +item(tt(style))( +Code executed as part of a style retrieved by the tt(zstyle) builtin +from the tt(zsh/zutil) module. +) +item(tt(toplevel))( +The highest execution level of a script or interactive shell. +) +item(tt(trap))( +Code executed as a trap defined by the tt(trap) builtin. Traps +defined as functions have the context tt(shfunc). As traps are +asynchronous they may have a different hierarchy from other +code. +) +item(tt(zpty))( +Code executed by the tt(zpty) builtin from the tt(zsh/zpty) module. +) +item(tt(zregesparse-guard))( +Code executed as a guard by the tt(zregexparse) command from the +tt(zsh/zutil) module. +) +item(tt(zregexparse-action))( +Code executed as an action by the tt(zregexparse) command from the +tt(zsh/zutil) module. +) +enditem() +) vindex(ZSH_NAME) item(tt(ZSH_NAME))( Expands to the basename of the command used to invoke this instance -- cgit 1.4.1