diff options
author | Peter Stephenson <pws@users.sourceforge.net> | 2005-04-12 15:11:07 +0000 |
---|---|---|
committer | Peter Stephenson <pws@users.sourceforge.net> | 2005-04-12 15:11:07 +0000 |
commit | b3f8e32e5cf5771eb5efb1e11c38dab377b14432 (patch) | |
tree | a0029fa908983c35956961f92cc51bda73487d93 /Src/zsh.h | |
parent | bd718425bb41f08fb9d06968b339455abb37e2dd (diff) | |
download | zsh-b3f8e32e5cf5771eb5efb1e11c38dab377b14432.tar.gz zsh-b3f8e32e5cf5771eb5efb1e11c38dab377b14432.tar.xz zsh-b3f8e32e5cf5771eb5efb1e11c38dab377b14432.zip |
21133: New {myfd} syntax for allocating file descriptors
Diffstat (limited to 'Src/zsh.h')
-rw-r--r-- | Src/zsh.h | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/Src/zsh.h b/Src/zsh.h index b0ca94e09..6e1916690 100644 --- a/Src/zsh.h +++ b/Src/zsh.h @@ -246,6 +246,8 @@ enum { REDIR_INPIPE, /* < <(...) */ REDIR_OUTPIPE /* > >(...) */ }; +#define REDIR_TYPE_MASK (0x1f) +#define REDIR_VARID_MASK (0x20) #define IS_WRITE_FILE(X) ((X)>=REDIR_WRITE && (X)<=REDIR_READWRITE) #define IS_APPEND_REDIR(X) (IS_WRITE_FILE(X) && ((X) & 2)) @@ -267,9 +269,14 @@ enum { */ #define FDT_INTERNAL 1 /* + * Entry visible to other processes, for example created using + * the {varid}> file syntax. + */ +#define FDT_EXTERNAL 2 +/* * Entry used by output from the XTRACE option. */ -#define FDT_XTRACE 2 +#define FDT_XTRACE 3 #ifdef PATH_DEV_FD /* * Entry used by a process substition. @@ -277,7 +284,7 @@ enum { * decremented on exit; we don't close entries greater than * FDT_PROC_SUBST except when closing everything. */ -#define FDT_PROC_SUBST 3 +#define FDT_PROC_SUBST 4 #endif /* Flags for input stack */ @@ -453,6 +460,7 @@ struct redir { int type; int fd1, fd2; char *name; + char *varid; }; /* The number of fds space is allocated for * @@ -629,8 +637,11 @@ struct eccstr { #define WC_PIPE_LINENO(C) (wc_data(C) >> 1) #define WCB_PIPE(T,L) wc_bld(WC_PIPE, ((T) | ((L) << 1))) -#define WC_REDIR_TYPE(C) wc_data(C) +#define WC_REDIR_TYPE(C) (wc_data(C) & REDIR_TYPE_MASK) +#define WC_REDIR_VARID(C) (wc_data(C) & REDIR_VARID_MASK) #define WCB_REDIR(T) wc_bld(WC_REDIR, (T)) +/* Size of redir is 4 words if REDIR_VARID_MASK is set, else 3 */ +#define WC_REDIR_WORDS(C) (WC_REDIR_VARID(C) ? 4 : 3) #define WC_ASSIGN_TYPE(C) (wc_data(C) & ((wordcode) 1)) #define WC_ASSIGN_TYPE2(C) ((wc_data(C) & ((wordcode) 2)) >> 1) |