1 /* $XConsortium: exksh.h /main/3 1995/11/01 15:54:01 rswiston $ */
4 /* Copyright (c) 1991, 1992 UNIX System Laboratories, Inc. */
5 /* All Rights Reserved */
7 /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF */
8 /* UNIX System Laboratories, Inc. */
9 /* The copyright notice above does not evidence any */
10 /* actual or intended publication of such source code. */
12 #ifndef _Dtksh_exksh_h
13 #define _Dtksh_exksh_h
15 #include <sys/types.h>
26 #define PRMIXED_SYMBOLIC 16
29 #define UPP(CH) (islower(CH) ? toupper(CH) : (CH))
30 #define C_PAIR(STR, CH1, CH2) (((STR)[0] == (CH1)) && ((STR)[1] == (CH2)))
31 #define XK_USAGE(X) return(xk_usage(X), SH_FAIL);
33 /* In the future, this will require following pointers, unless we
34 ** can always trace back types to typedefs. For example, unsigned long is
35 ** a typedef, but it is simple because it is really just a long.
37 #define IS_SIMPLE(TBL) ((TBL)->flags & F_SIMPLE)
39 #ifndef N_DEFAULT /* From name.h */
40 /* Stolen out of include/name.h, the problems of including things
41 ** out of the ksh code is major. Hence, the copy rather than the
46 long (*f_vp)(); /* value function */
47 long (*f_ap)(); /* assignment function */
50 #endif /* N_DEFAULT: From name.h */
52 #define ALLDATA INT_MAX
54 #define BIGBUFSIZ (10 * BUFSIZ)
64 struct strbuf *lastrcv;
74 extern struct fd *Fds;
75 extern struct vfd *Vfds;
89 #define PARPEEK(b, s) (((b)[0][0] == s[0]) ? 1 : 0 )
90 #define PAREXPECT(b, s) (((b)[0][0] == s[0]) ? 0 : -1 )
91 #define OFFSET(T, M) ((int)(&((T)NULL)->M))
93 typedef char *string_t;
96 * Structures for driving generic print/parse/copy/free routines
99 typedef struct memtbl {
100 char *name; /* name of the member */
101 char *tname; /* name of the typedef */
102 char kind; /* kind of member, see #defines below */
103 char flags; /* flags for member, see #defines below */
104 short tbl; /* -1 or index into ASL_allmems[] array */
105 short ptr; /* number of "*" in front of member */
106 short subscr; /* 0 if no subscript, else max number of elems */
107 short delim; /* 0 if no length delim, +1 if next field, -1 if prev */
108 short id; /* Id of the ASL in which this def is made */
109 short offset; /* offset into the C structure */
110 short size; /* size of this member, for easy malloc'ing */
111 long choice; /* def of tag indicating field chosen for unions */
133 * Definitions for the kind field of the above structure
136 #define K_CHAR (0) /* char or unchar */
137 #define K_SHORT (1) /* short or ushort */
138 #define K_INT (2) /* int or uint */
139 #define K_LONG (3) /* long, unsigned long, PRIM, etc. */
140 #define K_STRING (4) /* char * or char [] */
141 #define K_OBJID (5) /* objid_t *, note the star is included */
142 #define K_ANY (6) /* any_t */
143 #define K_STRUCT (7) /* struct { } */
144 #define K_UNION (8) /* union { } */
145 #define K_TYPEDEF (9) /* typedef */
146 #define K_DSHORT (10) /* short delimiter */
147 #define K_DINT (11) /* int delimiter */
148 #define K_DLONG (12) /* long delimiter */
151 * Definitions for the flags field of the above structure, bitmask
154 #define F_SIMPLE (1) /* simple, flat type */
155 #define F_FIELD (2) /* memtbl is a field of a structure, not the
157 #define F_TBL_IS_PTR (4) /* tbl field is pointer, not number; */
158 #define F_TYPE_IS_PTR (8) /* type is built-in, but is already a pointer, like K_STRING */
166 /* The following macro, RIF, stands for Return If Fail. Practically
167 * every line of encode/decode functions need to do this, so it aids
170 #define RIF(X) do { if ((X) == FAIL) return(FAIL); } while(0)
172 #endif /* not OSI_LIB_CODE */
174 #if !defined(OSI_LIB_CODE) || defined(NEED_SYMLIST)
179 struct symarray *syms;
183 #define DYNMEM_ID (1)
186 #define ALTPUTS(STR) puts(STR)
192 #ifdef SPRINTF_RET_LEN
193 #define lsprintf sprintf
196 #define MAX_CALL_ARGS 15
198 #define TREAT_SIMPLE(TBL) ((TBL)->ptr || IS_SIMPLE(TBL))
200 #ifdef EXKSH_INCLUDED
201 #define XK_PRINT(ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7) (_Delim = 0, xk_print(ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7))
202 #define XK_PARSE(ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7) (_Delim = 0, xk_parse(ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7))
203 #define XK_FREE(ARG1, ARG2, ARG3, ARG4, ARG5) (_Delim = 0, xk_free(ARG1, ARG2, ARG3, ARG4, ARG5))
210 #endif /* not SYMS_ONLY */
217 #endif /* _Dtksh_exksh_h */
218 /* DON'T ADD ANYTHING AFTER THIS #endif */