#pragma prototyped
#ifndef _NV_PRIVATE
#define _NV_PRIVATE \
Namfun_t *nvfun; \
union Value nvalue; \
char *nvenv;
#include <ast.h>
#include <cdt.h>
#include "shtable.h"
union Value
{
const char *cp;
int *ip;
char c;
int i;
unsigned int u;
int32_t *lp;
Sflong_t *llp;
int16_t s;
double *dp;
Sfdouble_t *ldp;
struct Namarray *array;
struct Namval *np;
union Value *up;
struct Ufunction *rp;
struct Namfun *funp;
struct Namref *nrp;
int (*bfp)(int,char*[],void*);
};
#include "nval.h"
#define ARRAY_MAX (1L<<ARRAY_BITS)
#define ARRAY_MASK (ARRAY_MAX-1)
#define ARRAY_INCR 32
#define ARRAY_FILL (8L<<ARRAY_BITS)
#define ARRAY_NOCLONE (16L<<ARRAY_BITS)
#define ARRAY_NOCHILD (32L<<ARRAY_BITS)
#define ARRAY_SETSUB (64L<<ARRAY_BITS)
#define ARRAY_ASSIGN 0
#define ARRAY_LOOKUP 1
#define ARRAY_DELETE 2
struct Namref
{
Namval_t *np;
Namval_t *table;
Dt_t *root;
char *sub;
};
struct Ufunction
{
int *ptree;
int lineno;
off_t hoffset;
Namval_t *nspace;
char *fname;
};
#ifndef ARG_RAW
struct argnod;
#endif
#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_PARAM NV_NODISC
#define NV_TYPE 0x1000000
#define NV_FUNCTION (NV_RJUST|NV_FUNCT)
#define NV_FPOSIX NV_LJUST
#define NV_FTMP NV_ZFILL
#define NV_NOPRINT (NV_LTOU|NV_UTOL)
#define NV_NOALIAS (NV_NOPRINT|NV_IMPORT)
#define NV_NOEXPAND NV_RJUST
#define NV_BLTIN (NV_NOPRINT|NV_EXPORT)
#define BLT_ENV (NV_RDONLY)
#define BLT_SPC (NV_LJUST)
#define BLT_EXIT (NV_RJUST)
#define BLT_DCL (NV_TAGGED)
#define BLT_NOSFIO (NV_IMPORT)
#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 nv_funtree(n) ((n)->nvalue.rp->ptree)
#define funptr(n) ((n)->nvalue.bfp)
#define NV_SUBQUOTE (NV_ADD<<1)
#define nv_setattr(n,f) ((n)->nvflag = (f))
#define nv_context(n) ((void*)(n)->nvfun)
#define nv_refnode(n) ((n)->nvalue.nrp->np)
#define nv_reftree(n) ((n)->nvalue.nrp->root)
#define nv_reftable(n) ((n)->nvalue.nrp->table)
#define nv_refsub(n) ((n)->nvalue.nrp->sub)
#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 array_elem(ap) ((ap)->nelem&ARRAY_MASK)
#define array_assoc(ap) ((ap)->fun)
extern int array_maxindex(Namval_t*);
extern char *nv_endsubscript(Namval_t*, char*, int);
extern Namfun_t *nv_cover(Namval_t*);
extern int nv_setnotify(Namval_t*,char **);
extern int nv_unsetnotify(Namval_t*,char **);
extern void nv_setlist(struct argnod*, int);
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*);
extern char *nv_dirnext(void*);
extern void nv_dirclose(void*);
extern char *nv_getvtree(Namval_t*, Namfun_t*);
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_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 int nv_isvtree(Namval_t*);
extern const Namdisc_t RESTRICTED_disc;
extern char nv_local;
extern Dtdisc_t _Nvdisc;
extern const char e_subscript[];
extern const char e_nullset[];
extern const char e_notset[];
extern const char e_noparent[];
extern const char e_readonly[];
extern const char e_badfield[];
extern const char e_restricted[];
extern const char e_ident[];
extern const char e_varname[];
extern const char e_noalias[];
extern const char e_noarray[];
extern const char e_aliname[];
extern const char e_badexport[];
extern const char e_badref[];
extern const char e_noref[];
extern const char e_selfref[];
extern const char e_envmarker[];
extern const char e_badlocale[];
extern const char e_loop[];
extern const char e_redef[];
#endif