da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin/* : : generated by proto : : */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin/***********************************************************************
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin* *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin* This software is part of the ast package *
3e14f97f673e8a630f076077de35afdd43dc1587Roger A. Faulkner* Copyright (c) 1982-2010 AT&T Intellectual Property *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin* and is licensed under the *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin* Common Public License, Version 1.0 *
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin* by AT&T Intellectual Property *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin* *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin* A copy of the License is available at *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin* http://www.opensource.org/licenses/cpl1.0.txt *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin* (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9) *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin* *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin* Information and Software Systems Research *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin* AT&T Research *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin* Florham Park NJ *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin* *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin* David Korn <dgk@research.att.com> *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin* *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin***********************************************************************/
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#ifndef NV_DEFAULT
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#if !defined(__PROTO__)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#include <prototyped.h>
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#endif
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#if !defined(__LINKAGE__)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define __LINKAGE__ /* 2004-08-11 transition */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#endif
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin/*
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * David Korn
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * AT&T Labs
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Interface definitions of structures for name-value pairs
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * These structures are used for named variables, functions and aliases
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#include <ast.h>
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#include <cdt.h>
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin#include <option.h>
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin/* for compatibility with old hash library */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define Hashtab_t Dt_t
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define HASH_BUCKET 1
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define HASH_NOSCOPE 2
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define HASH_SCOPE 4
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define hashscope(x) dtvnext(x)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chintypedef struct Namval Namval_t;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chintypedef struct Namfun Namfun_t;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chintypedef struct Namdisc Namdisc_t;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chintypedef struct Nambfun Nambfun_t;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chintypedef struct Namarray Namarr_t;
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chintypedef struct Namdecl Namdecl_t;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin/*
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * This defines the template for nodes that have their own assignment
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * and or lookup functions
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinstruct Namdisc
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin{
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin size_t dsize;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin void (*putval) __PROTO__((Namval_t*, const char*, int, Namfun_t*));
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin char *(*getval) __PROTO__((Namval_t*, Namfun_t*));
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin Sfdouble_t (*getnum) __PROTO__((Namval_t*, Namfun_t*));
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin char *(*setdisc) __PROTO__((Namval_t*, const char*, Namval_t*, Namfun_t*));
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin Namval_t *(*createf) __PROTO__((Namval_t*, const char*, int, Namfun_t*));
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin Namfun_t *(*clonef) __PROTO__((Namval_t*, Namval_t*, int, Namfun_t*));
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin char *(*namef) __PROTO__((Namval_t*, Namfun_t*));
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin Namval_t *(*nextf) __PROTO__((Namval_t*, Dt_t*, Namfun_t*));
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin Namval_t *(*typef) __PROTO__((Namval_t*, Namfun_t*));
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin int (*readf) __PROTO__((Namval_t*, Sfio_t*, int, Namfun_t*));
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin int (*writef) __PROTO__((Namval_t*, Sfio_t*, int, Namfun_t*));
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin};
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinstruct Namfun
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin{
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin const Namdisc_t *disc;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin char nofree;
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin unsigned char subshell;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin unsigned short dsize;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin Namfun_t *next;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin char *last;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin Namval_t *type;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin};
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinstruct Nambfun
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin{
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin Namfun_t fun;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin int num;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin const char **bnames;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin Namval_t *bltins[1];
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin};
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin/* This is an array template header */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinstruct Namarray
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin{
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin Namfun_t hdr;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin long nelem; /* number of elements */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin __V_ *(*fun) __PROTO__((Namval_t*,const char*,int)); /* associative arrays */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin Namval_t *parent; /* for multi-dimensional */
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin Dt_t *table; /* for subscripts */
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin __V_ *scope; /* non-zerp when scoped */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin};
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin/* The context pointer for declaration command */
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chinstruct Namdecl
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin{
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin Namval_t *tp; /* point to type */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin const char *optstring;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin __V_ *optinfof;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin};
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin/* attributes of name-value node attribute flags */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define NV_DEFAULT 0
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin/* This defines the attributes for an attributed name-value pair node */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinstruct Namval
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin{
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin Dtlink_t nvlink; /* space for cdt links */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin char *nvname; /* pointer to name of the node */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin unsigned short nvflag; /* attributes */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin unsigned short nvsize; /* size or base */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#ifdef _NV_PRIVATE
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin _NV_PRIVATE
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#else
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin Namfun_t *nvfun;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin char *nvalue;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin char *nvprivate;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#endif /* _NV_PRIVATE */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin};
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define NV_CLASS ".sh.type"
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin#define NV_DATA "_" /* special class or instance variable */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define NV_MINSZ (sizeof(struct Namval)-sizeof(Dtlink_t)-sizeof(char*))
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define nv_namptr(p,n) ((Namval_t*)((char*)(p)+(n)*NV_MINSZ-sizeof(Dtlink_t)))
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin/* The following attributes are for internal use */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define NV_NOFREE 0x200 /* don't free the space when releasing value */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define NV_ARRAY 0x400 /* node is an array */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define NV_REF 0x4000 /* reference bit */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define NV_TABLE 0x800 /* node is a dictionary table */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define NV_IMPORT 0x1000 /* value imported from environment */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define NV_MINIMAL NV_IMPORT /* node does not contain all fields */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define NV_INTEGER 0x2 /* integer attribute */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin/* The following attributes are valid only when NV_INTEGER is off */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define NV_LTOU 0x4 /* convert to uppercase */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define NV_UTOL 0x8 /* convert to lowercase */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define NV_ZFILL 0x10 /* right justify and fill with leading zeros */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define NV_RJUST 0x20 /* right justify and blank fill */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define NV_LJUST 0x40 /* left justify and blank fill */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define NV_BINARY 0x100 /* fixed size data buffer */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define NV_RAW NV_LJUST /* used only with NV_BINARY */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define NV_HOST (NV_RJUST|NV_LJUST) /* map to host filename */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin/* The following attributes do not effect the value */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define NV_RDONLY 0x1 /* readonly bit */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define NV_EXPORT 0x2000 /* export bit */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define NV_TAGGED 0x8000 /* user define tag bit */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin/* The following are used with NV_INTEGER */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define NV_SHORT (NV_RJUST) /* when integers are not long */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define NV_LONG (NV_UTOL) /* for long long and long double */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define NV_UNSIGN (NV_LTOU) /* for unsigned quantities */
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin#define NV_DOUBLE (NV_INTEGER|NV_ZFILL) /* for floating point */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define NV_EXPNOTE (NV_LJUST) /* for scientific notation */
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin#define NV_HEXFLOAT (NV_LTOU) /* for C99 base16 float notation */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin/* options for nv_open */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define NV_APPEND 0x10000 /* append value */
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin#define NV_MOVE 0x8000000 /* for use with nv_clone */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define NV_ADD 8
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin /* add node if not found */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define NV_ASSIGN NV_NOFREE /* assignment is possible */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define NV_NOASSIGN 0 /* backward compatibility */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define NV_NOARRAY 0x200000 /* array name not possible */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define NV_IARRAY 0x400000 /* for indexed array */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define NV_NOREF NV_REF /* don't follow reference */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define NV_IDENT 0x80 /* name must be identifier */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define NV_VARNAME 0x20000 /* name must be ?(.)id*(.id) */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define NV_NOADD 0x40000 /* do not add node */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define NV_NOSCOPE 0x80000 /* look only in current scope */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define NV_NOFAIL 0x100000 /* return 0 on failure, no msg */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define NV_NODISC NV_IDENT /* ignore disciplines */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define NV_FUNCT NV_IDENT /* option for nv_create */
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin#define NV_BLTINOPT NV_ZFILL /* mark builtins in libcmd */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define NV_PUBLIC (~(NV_NOSCOPE|NV_ASSIGN|NV_IDENT|NV_VARNAME|NV_NOADD))
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin/* numeric types */
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin#define NV_INT16P (NV_LJUST|NV_SHORT|NV_INTEGER)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define NV_INT16 (NV_SHORT|NV_INTEGER)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define NV_UINT16 (NV_UNSIGN|NV_SHORT|NV_INTEGER)
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin#define NV_UINT16P (NV_LJUSTNV_UNSIGN|NV_SHORT|NV_INTEGER)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define NV_INT32 (NV_INTEGER)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define NV_UNT32 (NV_UNSIGN|NV_INTEGER)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define NV_INT64 (NV_LONG|NV_INTEGER)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define NV_UINT64 (NV_UNSIGN|NV_LONG|NV_INTEGER)
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin#define NV_FLOAT (NV_SHORT|NV_DOUBLE)
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin#define NV_LDOUBLE (NV_LONG|NV_DOUBLE)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin/* name-value pair macros */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define nv_isattr(np,f) ((np)->nvflag & (f))
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define nv_onattr(n,f) ((n)->nvflag |= (f))
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define nv_offattr(n,f) ((n)->nvflag &= ~(f))
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define nv_isarray(np) (nv_isattr((np),NV_ARRAY))
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin/* The following are operations for associative arrays */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define NV_AINIT 1 /* initialize */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define NV_AFREE 2 /* free array */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define NV_ANEXT 3 /* advance to next subscript */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define NV_ANAME 4 /* return subscript name */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define NV_ADELETE 5 /* delete current subscript */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define NV_AADD 6 /* add subscript if not found */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define NV_ACURRENT 7 /* return current subscript Namval_t* */
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin#define NV_ASETSUB 8 /* set current subscript */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin/* The following are for nv_disc */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define NV_FIRST 1
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define NV_LAST 2
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define NV_POP 3
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define NV_CLONE 4
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin/* The following are operations for nv_putsub() */
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin#define ARRAY_BITS 22
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define ARRAY_ADD (1L<<ARRAY_BITS) /* add subscript if not found */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define ARRAY_SCAN (2L<<ARRAY_BITS) /* For ${array[@]} */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define ARRAY_UNDEF (4L<<ARRAY_BITS) /* For ${array} */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin/* These are disciplines provided by the library for use with nv_discfun */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define NV_DCADD 0 /* used to add named disciplines */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define NV_DCRESTRICT 1 /* variable that are restricted in rsh */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#if defined(__EXPORT__) && defined(_DLL)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# ifdef _BLD_shell
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#undef __MANGLE__
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define __MANGLE__ __LINKAGE__ __EXPORT__
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# else
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#undef __MANGLE__
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define __MANGLE__ __LINKAGE__ __IMPORT__
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# endif /* _BLD_shell */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#endif /* _DLL */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin/* prototype for array interface*/
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chinextern __MANGLE__ Namarr_t *nv_arrayptr __PROTO__((Namval_t*));
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinextern __MANGLE__ Namarr_t *nv_setarray __PROTO__((Namval_t*,__V_*(*)(Namval_t*,const char*,int)));
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chinextern __MANGLE__ int nv_arraynsub __PROTO__((Namarr_t*));
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinextern __MANGLE__ __V_ *nv_associative __PROTO__((Namval_t*,const char*,int));
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinextern __MANGLE__ int nv_aindex __PROTO__((Namval_t*));
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinextern __MANGLE__ int nv_nextsub __PROTO__((Namval_t*));
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinextern __MANGLE__ char *nv_getsub __PROTO__((Namval_t*));
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinextern __MANGLE__ Namval_t *nv_putsub __PROTO__((Namval_t*, char*, long));
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinextern __MANGLE__ Namval_t *nv_opensub __PROTO__((Namval_t*));
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin/* name-value pair function prototypes */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinextern __MANGLE__ int nv_adddisc __PROTO__((Namval_t*, const char**, Namval_t**));
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinextern __MANGLE__ int nv_clone __PROTO__((Namval_t*, Namval_t*, int));
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinextern __MANGLE__ void nv_close __PROTO__((Namval_t*));
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinextern __MANGLE__ __V_ *nv_context __PROTO__((Namval_t*));
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinextern __MANGLE__ Namval_t *nv_create __PROTO__((const char*, Dt_t*, int,Namfun_t*));
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chinextern __MANGLE__ void nv_delete __PROTO__((Namval_t*, Dt_t*, int));
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinextern __MANGLE__ Dt_t *nv_dict __PROTO__((Namval_t*));
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinextern __MANGLE__ Sfdouble_t nv_getn __PROTO__((Namval_t*, Namfun_t*));
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinextern __MANGLE__ Sfdouble_t nv_getnum __PROTO__((Namval_t*));
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinextern __MANGLE__ char *nv_getv __PROTO__((Namval_t*, Namfun_t*));
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinextern __MANGLE__ char *nv_getval __PROTO__((Namval_t*));
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinextern __MANGLE__ Namfun_t *nv_hasdisc __PROTO__((Namval_t*, const Namdisc_t*));
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinextern __MANGLE__ int nv_isnull __PROTO__((Namval_t*));
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chinextern __MANGLE__ Namfun_t *nv_isvtree __PROTO__((Namval_t*));
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinextern __MANGLE__ Namval_t *nv_lastdict __PROTO__((void));
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chinextern __MANGLE__ Namval_t *nv_mkinttype __PROTO__((char*, size_t, int, const char*, Namdisc_t*));
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinextern __MANGLE__ void nv_newattr __PROTO__((Namval_t*,unsigned,int));
34f9b3eef6fdadbda0a846aa4d68691ac40eace5Roland Mainzextern __MANGLE__ void nv_newtype __PROTO__((Namval_t*));
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinextern __MANGLE__ Namval_t *nv_open __PROTO__((const char*,Dt_t*,int));
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinextern __MANGLE__ void nv_putval __PROTO__((Namval_t*,const char*,int));
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinextern __MANGLE__ void nv_putv __PROTO__((Namval_t*,const char*,int,Namfun_t*));
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chinextern __MANGLE__ int nv_rename __PROTO__((Namval_t*,int));
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinextern __MANGLE__ int nv_scan __PROTO__((Dt_t*,void(*)(Namval_t*,__V_*),__V_*,int,int));
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinextern __MANGLE__ char *nv_setdisc __PROTO__((Namval_t*,const char*,Namval_t*,Namfun_t*));
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinextern __MANGLE__ void nv_setref __PROTO__((Namval_t*, Dt_t*,int));
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinextern __MANGLE__ int nv_settype __PROTO__((Namval_t*, Namval_t*, int));
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinextern __MANGLE__ void nv_setvec __PROTO__((Namval_t*,int,int,char*[]));
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinextern __MANGLE__ void nv_setvtree __PROTO__((Namval_t*));
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinextern __MANGLE__ int nv_setsize __PROTO__((Namval_t*,int));
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinextern __MANGLE__ Namfun_t *nv_disc __PROTO__((Namval_t*,Namfun_t*,int));
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chinextern __MANGLE__ void nv_unset __PROTO__((Namval_t*)); /*obsolete */
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chinextern __MANGLE__ void _nv_unset __PROTO__((Namval_t*,int));
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinextern __MANGLE__ Namval_t *nv_search __PROTO__((const char *, Dt_t*, int));
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinextern __MANGLE__ char *nv_name __PROTO__((Namval_t*));
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinextern __MANGLE__ Namval_t *nv_type __PROTO__((Namval_t*));
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chinextern __MANGLE__ void nv_addtype __PROTO__((Namval_t*,const char*, Optdisc_t*, size_t));
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinextern __MANGLE__ const Namdisc_t *nv_discfun __PROTO__((int));
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#ifdef _DLL
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#undef __MANGLE__
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define __MANGLE__ __LINKAGE__
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#endif /* _DLL */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin#define nv_unset(np) _nv_unset(np,0)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define nv_size(np) nv_setsize((np),-1)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define nv_stack(np,nf) nv_disc(np,nf,0)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#if 0
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin/*
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * The names of many functions were changed in early '95
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Here is a mapping to the old names
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# define nv_istype(np) nv_isattr(np)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# define nv_newtype(np) nv_newattr(np)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# define nv_namset(np,a,b) nv_open(np,a,b)
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin# define nv_free(np) nv_unset(np,0)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# define nv_settype(np,a,b,c) nv_setdisc(np,a,b,c)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# define nv_search(np,a,b) nv_open(np,a,((b)?0:NV_NOADD))
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin# define settype setdisc
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#endif
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#endif /* NV_DEFAULT */