diff options
Diffstat (limited to 'usr/src/lib/libshell/common/include/name.h')
-rw-r--r-- | usr/src/lib/libshell/common/include/name.h | 61 |
1 files changed, 42 insertions, 19 deletions
diff --git a/usr/src/lib/libshell/common/include/name.h b/usr/src/lib/libshell/common/include/name.h index 04ed23e7d0..60821ee706 100644 --- a/usr/src/lib/libshell/common/include/name.h +++ b/usr/src/lib/libshell/common/include/name.h @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2007 AT&T Knowledge Ventures * +* Copyright (c) 1982-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * @@ -43,6 +43,7 @@ union Value int32_t *lp; Sflong_t *llp; /* for long long arithmetic */ int16_t s; + int16_t *sp; double *dp; /* for floating point arithmetic */ Sfdouble_t *ldp; /* for long floating point arithmetic */ struct Namarray *array; /* for array node */ @@ -67,6 +68,8 @@ union Value #define ARRAY_NOCLONE (16L<<ARRAY_BITS) /* do not clone array disc */ #define ARRAY_NOCHILD (32L<<ARRAY_BITS) /* skip compound arrays */ #define ARRAY_SETSUB (64L<<ARRAY_BITS) /* set subscript */ +#define ARRAY_NOSCOPE (128L<<ARRAY_BITS) /* top level scope only */ +#define ARRAY_TREE (256L<<ARRAY_BITS) /* arrays of compound vars */ #define NV_ASETSUB 8 /* set subscript */ /* These flags are used as options to array_get() */ @@ -86,11 +89,15 @@ struct Namref /* This describes a user shell function node */ struct Ufunction { - int *ptree; /* address of parse tree */ - int lineno; /* line number of function start */ - off_t hoffset; /* offset into source or history file */ - Namval_t *nspace; /* pointer to name space */ - char *fname; /* file name where function defined */ + int *ptree; /* address of parse tree */ + int lineno; /* line number of function start */ + off_t hoffset; /* offset into source or history file */ + Namval_t *nspace; /* pointer to name space */ + char *fname; /* file name where function defined */ + char *help; /* help string */ + Dt_t *sdict; /* dictionary for statics */ + Dt_t *fdict; /* dictionary node belongs to */ + Namval_t *np; /* function node pointer */ }; #ifndef ARG_RAW @@ -101,11 +108,13 @@ struct Ufunction /* The following attributes are for internal use */ #define NV_NOCHANGE (NV_EXPORT|NV_IMPORT|NV_RDONLY|NV_TAGGED|NV_NOFREE) -#define NV_ATTRIBUTES (~(NV_NOSCOPE|NV_ARRAY|NV_NOARRAY|NV_IDENT|NV_ASSIGN|NV_REF|NV_VARNAME)) +#define NV_ATTRIBUTES (~(NV_NOSCOPE|NV_ARRAY|NV_NOARRAY|NV_IDENT|NV_ASSIGN|NV_REF|NV_VARNAME|NV_STATIC)) #define NV_PARAM NV_NODISC /* expansion use positional params */ /* This following are for use with nodes which are not name-values */ #define NV_TYPE 0x1000000 +#define NV_STATIC 0x2000000 +#define NV_COMVAR 0x4000000 #define NV_FUNCTION (NV_RJUST|NV_FUNCT) /* value is shell function */ #define NV_FPOSIX NV_LJUST /* posix function semantics */ #define NV_FTMP NV_ZFILL /* function source in tmpfile */ @@ -119,10 +128,12 @@ struct Ufunction #define BLT_SPC (NV_LJUST) /* special built-ins */ #define BLT_EXIT (NV_RJUST) /* exit value can be > 255 */ #define BLT_DCL (NV_TAGGED) /* declaration command */ -#define nv_isref(n) (nv_isattr((n),NV_REF)==NV_REF) -#define nv_istable(n) (nv_isattr((n),NV_TABLE|NV_LJUST|NV_RJUST)==NV_TABLE) -#define is_abuiltin(n) (nv_isattr(n,NV_BLTIN)==NV_BLTIN) -#define is_afunction(n) (nv_isattr(n,NV_FUNCTION)==NV_FUNCTION) +#define BLT_NOSFIO (NV_IMPORT) /* doesn't use sfio */ +#define NV_OPTGET (NV_BINARY) /* function calls getopts */ +#define nv_isref(n) (nv_isattr((n),NV_REF|NV_TAGGED|NV_FUNCT)==NV_REF) +#define nv_istable(n) (nv_isattr((n),NV_TABLE|NV_LJUST|NV_RJUST|NV_INTEGER)==NV_TABLE) +#define is_abuiltin(n) (nv_isattr(n,NV_BLTIN|NV_INTEGER)==NV_BLTIN) +#define is_afunction(n) (nv_isattr(n,NV_FUNCTION|NV_REF)==NV_FUNCTION) #define nv_funtree(n) ((n)->nvalue.rp->ptree) #define funptr(n) ((n)->nvalue.bfp) @@ -138,16 +149,13 @@ struct Ufunction #define nv_reftree(n) ((n)->nvalue.nrp->root) #define nv_reftable(n) ((n)->nvalue.nrp->table) #define nv_refsub(n) ((n)->nvalue.nrp->sub) -#if SHOPT_OO -# define nv_class(np) (nv_isattr(np,NV_REF|NV_IMPORT)?0:(Namval_t*)((np)->nvenv)) -#endif /* SHOPT_OO */ /* ... etc */ #define nv_setsize(n,s) ((n)->nvsize = (s)) #undef nv_size #define nv_size(np) ((np)->nvsize) -#define nv_isnull(np) (!(np)->nvalue.cp && !(np)->nvfun && !nv_isattr(np,NV_SHORT)) +#define nv_isnull(np) (!(np)->nvalue.cp && !((np)->nvfun && (np)->nvfun->disc) && nv_isattr(np,NV_SHORT|NV_INTEGER)!=(NV_SHORT|NV_INTEGER)) /* ... for arrays */ @@ -158,16 +166,21 @@ extern int array_maxindex(Namval_t*); extern char *nv_endsubscript(Namval_t*, char*, int); extern Namfun_t *nv_cover(Namval_t*); extern Namarr_t *nv_arrayptr(Namval_t*); +extern int nv_arraysettype(Namval_t*, Namval_t*,const char*,int); +extern int nv_aimax(Namval_t*); +extern int nv_atypeindex(Namval_t*, const char*); extern int nv_setnotify(Namval_t*,char **); extern int nv_unsetnotify(Namval_t*,char **); extern void nv_setlist(struct argnod*, int); +extern struct argnod* nv_onlist(struct argnod*, const char*); extern void nv_optimize(Namval_t*); extern void nv_outname(Sfio_t*,char*, int); -extern void nv_scope(struct argnod*); extern void nv_unref(Namval_t*); extern void _nv_unset(Namval_t*,int); extern int nv_clone(Namval_t*, Namval_t*, int); -extern void *nv_diropen(const char*); +void clone_all_disc(Namval_t*, Namval_t*, int); +extern Namfun_t *nv_clone_disc(Namfun_t*, int); +extern void *nv_diropen(Namval_t*, const char*); extern char *nv_dirnext(void*); extern void nv_dirclose(void*); extern char *nv_getvtree(Namval_t*, Namfun_t*); @@ -175,20 +188,26 @@ extern void nv_attribute(Namval_t*, Sfio_t*, char*, int); extern Namval_t *nv_bfsearch(const char*, Dt_t*, Namval_t**, char**); extern Namval_t *nv_mkclone(Namval_t*); extern Namval_t *nv_mktype(Namval_t**, int); -extern void nv_addnode(Namval_t*, int); +extern Namval_t *nv_addnode(Namval_t*, int); extern Namval_t *nv_parent(Namval_t*); extern char *nv_getbuf(size_t); extern Namval_t *nv_mount(Namval_t*, const char *name, Dt_t*); extern Namval_t *nv_arraychild(Namval_t*, Namval_t*, int); extern int nv_compare(Dt_t*, Void_t*, Void_t*, Dtdisc_t*); +extern void nv_outnode(Namval_t*,Sfio_t*, int, int); +extern int nv_subsaved(Namval_t*); +extern void nv_typename(Namval_t*, Sfio_t*); extern const Namdisc_t RESTRICTED_disc; +extern const Namdisc_t ENUM_disc; extern char nv_local; extern Dtdisc_t _Nvdisc; +extern const char *nv_discnames[]; extern const char e_subscript[]; extern const char e_nullset[]; extern const char e_notset[]; extern const char e_noparent[]; +extern const char e_notelem[]; extern const char e_readonly[]; extern const char e_badfield[]; extern const char e_restricted[]; @@ -196,6 +215,7 @@ extern const char e_ident[]; extern const char e_varname[]; extern const char e_noalias[]; extern const char e_noarray[]; +extern const char e_notenum[]; extern const char e_aliname[]; extern const char e_badexport[]; extern const char e_badref[]; @@ -205,4 +225,7 @@ extern const char e_envmarker[]; extern const char e_badlocale[]; extern const char e_loop[]; extern const char e_redef[]; +extern const char e_required[]; +extern const char e_badappend[]; +extern const char e_unknowntype[]; #endif /* _NV_PRIVATE */ |