2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these libraries and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
23 /* $XConsortium: exksh.h /main/3 1995/11/01 15:54:01 rswiston $ */
26 /* Copyright (c) 1991, 1992 UNIX System Laboratories, Inc. */
27 /* All Rights Reserved */
29 /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF */
30 /* UNIX System Laboratories, Inc. */
31 /* The copyright notice above does not evidence any */
32 /* actual or intended publication of such source code. */
34 #ifndef _Dtksh_exksh_h
35 #define _Dtksh_exksh_h
37 #include <sys/types.h>
48 #define PRMIXED_SYMBOLIC 16
51 #define UPP(CH) (islower(CH) ? toupper(CH) : (CH))
52 #define C_PAIR(STR, CH1, CH2) (((STR)[0] == (CH1)) && ((STR)[1] == (CH2)))
53 #define XK_USAGE(X) return(xk_usage(X), SH_FAIL);
55 /* In the future, this will require following pointers, unless we
56 ** can always trace back types to typedefs. For example, unsigned long is
57 ** a typedef, but it is simple because it is really just a long.
59 #define IS_SIMPLE(TBL) ((TBL)->flags & F_SIMPLE)
61 #ifndef N_DEFAULT /* From name.h */
62 /* Stolen out of include/name.h, the problems of including things
63 ** out of the ksh code is major. Hence, the copy rather than the
68 long (*f_vp)(); /* value function */
69 long (*f_ap)(); /* assignment function */
72 #endif /* N_DEFAULT: From name.h */
74 #define ALLDATA INT_MAX
76 #define BIGBUFSIZ (10 * BUFSIZ)
86 struct strbuf *lastrcv;
96 extern struct fd *Fds;
97 extern struct vfd *Vfds;
106 struct libdesc *libs;
111 #define PARPEEK(b, s) (((b)[0][0] == s[0]) ? 1 : 0 )
112 #define PAREXPECT(b, s) (((b)[0][0] == s[0]) ? 0 : -1 )
113 #define OFFSET(T, M) ((int)(&((T)NULL)->M))
115 typedef char *string_t;
118 * Structures for driving generic print/parse/copy/free routines
121 typedef struct memtbl {
122 char *name; /* name of the member */
123 char *tname; /* name of the typedef */
124 char kind; /* kind of member, see #defines below */
125 char flags; /* flags for member, see #defines below */
126 short tbl; /* -1 or index into ASL_allmems[] array */
127 short ptr; /* number of "*" in front of member */
128 short subscr; /* 0 if no subscript, else max number of elems */
129 short delim; /* 0 if no length delim, +1 if next field, -1 if prev */
130 short id; /* Id of the ASL in which this def is made */
131 short offset; /* offset into the C structure */
132 short size; /* size of this member, for easy malloc'ing */
133 long choice; /* def of tag indicating field chosen for unions */
155 * Definitions for the kind field of the above structure
158 #define K_CHAR (0) /* char or unchar */
159 #define K_SHORT (1) /* short or ushort */
160 #define K_INT (2) /* int or uint */
161 #define K_LONG (3) /* long, unsigned long, PRIM, etc. */
162 #define K_STRING (4) /* char * or char [] */
163 #define K_OBJID (5) /* objid_t *, note the star is included */
164 #define K_ANY (6) /* any_t */
165 #define K_STRUCT (7) /* struct { } */
166 #define K_UNION (8) /* union { } */
167 #define K_TYPEDEF (9) /* typedef */
168 #define K_DSHORT (10) /* short delimiter */
169 #define K_DINT (11) /* int delimiter */
170 #define K_DLONG (12) /* long delimiter */
173 * Definitions for the flags field of the above structure, bitmask
176 #define F_SIMPLE (1) /* simple, flat type */
177 #define F_FIELD (2) /* memtbl is a field of a structure, not the
179 #define F_TBL_IS_PTR (4) /* tbl field is pointer, not number; */
180 #define F_TYPE_IS_PTR (8) /* type is built-in, but is already a pointer, like K_STRING */
188 /* The following macro, RIF, stands for Return If Fail. Practically
189 * every line of encode/decode functions need to do this, so it aids
192 #define RIF(X) do { if ((X) == FAIL) return(FAIL); } while(0)
194 #endif /* not OSI_LIB_CODE */
196 #if !defined(OSI_LIB_CODE) || defined(NEED_SYMLIST)
201 struct symarray *syms;
205 #define DYNMEM_ID (1)
208 #define ALTPUTS(STR) puts(STR)
214 #ifdef SPRINTF_RET_LEN
215 #define lsprintf sprintf
218 #define MAX_CALL_ARGS 15
220 #define TREAT_SIMPLE(TBL) ((TBL)->ptr || IS_SIMPLE(TBL))
222 #ifdef EXKSH_INCLUDED
223 #define XK_PRINT(ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7) (_Delim = 0, xk_print(ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7))
224 #define XK_PARSE(ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7) (_Delim = 0, xk_parse(ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7))
225 #define XK_FREE(ARG1, ARG2, ARG3, ARG4, ARG5) (_Delim = 0, xk_free(ARG1, ARG2, ARG3, ARG4, ARG5))
232 #endif /* not SYMS_ONLY */
239 #endif /* _Dtksh_exksh_h */
240 /* DON'T ADD ANYTHING AFTER THIS #endif */