xref: /freebsd/usr.bin/rpcgen/rpc_parse.h (revision bdcbfde3)
14e115012SGarrett Wollman /*
240ad8885SAlfred Perlstein  */
340ad8885SAlfred Perlstein /*
44e115012SGarrett Wollman  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
54e115012SGarrett Wollman  * unrestricted use provided that this legend is included on all tape
64e115012SGarrett Wollman  * media and as a part of the software program in whole or part.  Users
74e115012SGarrett Wollman  * may copy or modify Sun RPC without charge, but are not authorized
84e115012SGarrett Wollman  * to license or distribute it to anyone else except as part of a product or
94e115012SGarrett Wollman  * program developed by the user.
104e115012SGarrett Wollman  *
114e115012SGarrett Wollman  * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
124e115012SGarrett Wollman  * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
134e115012SGarrett Wollman  * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
144e115012SGarrett Wollman  *
154e115012SGarrett Wollman  * Sun RPC is provided with no support and without any obligation on the
164e115012SGarrett Wollman  * part of Sun Microsystems, Inc. to assist in its use, correction,
174e115012SGarrett Wollman  * modification or enhancement.
184e115012SGarrett Wollman  *
194e115012SGarrett Wollman  * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
204e115012SGarrett Wollman  * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
214e115012SGarrett Wollman  * OR ANY PART THEREOF.
224e115012SGarrett Wollman  *
234e115012SGarrett Wollman  * In no event will Sun Microsystems, Inc. be liable for any lost revenue
244e115012SGarrett Wollman  * or profits or other special, indirect and consequential damages, even if
254e115012SGarrett Wollman  * Sun has been advised of the possibility of such damages.
264e115012SGarrett Wollman  *
274e115012SGarrett Wollman  * Sun Microsystems, Inc.
284e115012SGarrett Wollman  * 2550 Garcia Avenue
294e115012SGarrett Wollman  * Mountain View, California  94043
304e115012SGarrett Wollman  */
31ff49530fSBill Paul /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
32ff49530fSBill Paul /*	  All Rights Reserved  	*/
33ff49530fSBill Paul 
34ff49530fSBill Paul /*	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T	*/
35ff49530fSBill Paul /*	The copyright notice above does not evidence any   	*/
36ff49530fSBill Paul /*	actual or intended publication of such source code.	*/
37ff49530fSBill Paul 
38ff49530fSBill Paul 
39ff49530fSBill Paul /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
40ff49530fSBill Paul *	PROPRIETARY NOTICE (Combined)
41ff49530fSBill Paul *
42ff49530fSBill Paul * This source code is unpublished proprietary information
43ff49530fSBill Paul * constituting, or derived under license from AT&T's UNIX(r) System V.
44ff49530fSBill Paul * In addition, portions of such source code were derived from Berkeley
45ff49530fSBill Paul * 4.3 BSD under license from the Regents of the University of
46ff49530fSBill Paul * California.
47ff49530fSBill Paul *
48ff49530fSBill Paul *
49ff49530fSBill Paul *
50ff49530fSBill Paul *	Copyright Notice
51ff49530fSBill Paul *
52ff49530fSBill Paul * Notice of copyright on this source code product does not indicate
53ff49530fSBill Paul *  publication.
54ff49530fSBill Paul *
55ff49530fSBill Paul *	(c) 1986,1987,1988.1989  Sun Microsystems, Inc
56ff49530fSBill Paul *	(c) 1983,1984,1985,1986,1987,1988,1989  AT&T.
57ff49530fSBill Paul *          All rights reserved.
58ff49530fSBill Paul */
59ff49530fSBill Paul 
604e115012SGarrett Wollman /*
614e115012SGarrett Wollman  * rpc_parse.h, Definitions for the RPCL parser
624e115012SGarrett Wollman  */
634e115012SGarrett Wollman 
644e115012SGarrett Wollman enum defkind {
654e115012SGarrett Wollman 	DEF_CONST,
664e115012SGarrett Wollman 	DEF_STRUCT,
674e115012SGarrett Wollman 	DEF_UNION,
684e115012SGarrett Wollman 	DEF_ENUM,
694e115012SGarrett Wollman 	DEF_TYPEDEF,
704e115012SGarrett Wollman 	DEF_PROGRAM
714e115012SGarrett Wollman };
724e115012SGarrett Wollman typedef enum defkind defkind;
734e115012SGarrett Wollman 
74e390e3afSDavid Malone typedef const char *const_def;
754e115012SGarrett Wollman 
764e115012SGarrett Wollman enum relation {
774e115012SGarrett Wollman 	REL_VECTOR,	/* fixed length array */
784e115012SGarrett Wollman 	REL_ARRAY,	/* variable length array */
794e115012SGarrett Wollman 	REL_POINTER,	/* pointer */
804e115012SGarrett Wollman 	REL_ALIAS,	/* simple */
814e115012SGarrett Wollman };
824e115012SGarrett Wollman typedef enum relation relation;
834e115012SGarrett Wollman 
844e115012SGarrett Wollman struct typedef_def {
85e390e3afSDavid Malone 	const char *old_prefix;
86e390e3afSDavid Malone 	const char *old_type;
874e115012SGarrett Wollman 	relation rel;
88e390e3afSDavid Malone 	const char *array_max;
894e115012SGarrett Wollman };
904e115012SGarrett Wollman typedef struct typedef_def typedef_def;
914e115012SGarrett Wollman 
924e115012SGarrett Wollman struct enumval_list {
93e390e3afSDavid Malone 	const char *name;
94e390e3afSDavid Malone 	const char *assignment;
954e115012SGarrett Wollman 	struct enumval_list *next;
964e115012SGarrett Wollman };
974e115012SGarrett Wollman typedef struct enumval_list enumval_list;
984e115012SGarrett Wollman 
994e115012SGarrett Wollman struct enum_def {
1004e115012SGarrett Wollman 	enumval_list *vals;
1014e115012SGarrett Wollman };
1024e115012SGarrett Wollman typedef struct enum_def enum_def;
1034e115012SGarrett Wollman 
1044e115012SGarrett Wollman struct declaration {
105e390e3afSDavid Malone 	const char *prefix;
106e390e3afSDavid Malone 	const char *type;
107e390e3afSDavid Malone 	const char *name;
1084e115012SGarrett Wollman 	relation rel;
109e390e3afSDavid Malone 	const char *array_max;
1104e115012SGarrett Wollman };
1114e115012SGarrett Wollman typedef struct declaration declaration;
1124e115012SGarrett Wollman 
1134e115012SGarrett Wollman struct decl_list {
1144e115012SGarrett Wollman 	declaration decl;
1154e115012SGarrett Wollman 	struct decl_list *next;
1164e115012SGarrett Wollman };
1174e115012SGarrett Wollman typedef struct decl_list decl_list;
1184e115012SGarrett Wollman 
1194e115012SGarrett Wollman struct struct_def {
1204e115012SGarrett Wollman 	decl_list *decls;
1214e115012SGarrett Wollman };
1224e115012SGarrett Wollman typedef struct struct_def struct_def;
1234e115012SGarrett Wollman 
1244e115012SGarrett Wollman struct case_list {
125e390e3afSDavid Malone 	const char *case_name;
126ff49530fSBill Paul 	int contflag;
1274e115012SGarrett Wollman 	declaration case_decl;
1284e115012SGarrett Wollman 	struct case_list *next;
1294e115012SGarrett Wollman };
1304e115012SGarrett Wollman typedef struct case_list case_list;
1314e115012SGarrett Wollman 
1324e115012SGarrett Wollman struct union_def {
1334e115012SGarrett Wollman 	declaration enum_decl;
1344e115012SGarrett Wollman 	case_list *cases;
1354e115012SGarrett Wollman 	declaration *default_decl;
1364e115012SGarrett Wollman };
1374e115012SGarrett Wollman typedef struct union_def union_def;
1384e115012SGarrett Wollman 
139ff49530fSBill Paul struct arg_list {
140ff49530fSBill Paul 	char *argname; /* name of struct for arg*/
141ff49530fSBill Paul 	decl_list *decls;
142ff49530fSBill Paul };
1434e115012SGarrett Wollman 
144ff49530fSBill Paul typedef struct arg_list arg_list;
1454e115012SGarrett Wollman 
1464e115012SGarrett Wollman struct proc_list {
147e390e3afSDavid Malone 	const char *proc_name;
148e390e3afSDavid Malone 	const char *proc_num;
149ff49530fSBill Paul 	arg_list args;
150ff49530fSBill Paul 	int arg_num;
151e390e3afSDavid Malone 	const char *res_type;
152e390e3afSDavid Malone 	const char *res_prefix;
1534e115012SGarrett Wollman 	struct proc_list *next;
1544e115012SGarrett Wollman };
1554e115012SGarrett Wollman typedef struct proc_list proc_list;
1564e115012SGarrett Wollman 
1574e115012SGarrett Wollman struct version_list {
158e390e3afSDavid Malone 	const char *vers_name;
159e390e3afSDavid Malone 	const char *vers_num;
1604e115012SGarrett Wollman 	proc_list *procs;
1614e115012SGarrett Wollman 	struct version_list *next;
1624e115012SGarrett Wollman };
1634e115012SGarrett Wollman typedef struct version_list version_list;
1644e115012SGarrett Wollman 
1654e115012SGarrett Wollman struct program_def {
166e390e3afSDavid Malone 	const char *prog_num;
1674e115012SGarrett Wollman 	version_list *versions;
1684e115012SGarrett Wollman };
1694e115012SGarrett Wollman typedef struct program_def program_def;
1704e115012SGarrett Wollman 
1714e115012SGarrett Wollman struct definition {
172e390e3afSDavid Malone 	const char *def_name;
1734e115012SGarrett Wollman 	defkind def_kind;
1744e115012SGarrett Wollman 	union {
1754e115012SGarrett Wollman 		const_def co;
1764e115012SGarrett Wollman 		struct_def st;
1774e115012SGarrett Wollman 		union_def un;
1784e115012SGarrett Wollman 		enum_def en;
1794e115012SGarrett Wollman 		typedef_def ty;
1804e115012SGarrett Wollman 		program_def pr;
1814e115012SGarrett Wollman 	} def;
1824e115012SGarrett Wollman };
1834e115012SGarrett Wollman typedef struct definition definition;
1844e115012SGarrett Wollman 
185d0cc804bSStefan Farfeleder definition *get_definition(void);
186ff49530fSBill Paul 
187ff49530fSBill Paul 
188ff49530fSBill Paul struct bas_type
189ff49530fSBill Paul {
190e390e3afSDavid Malone   const char *name;
191ff49530fSBill Paul   int length;
192ff49530fSBill Paul   struct bas_type *next;
193ff49530fSBill Paul };
194ff49530fSBill Paul 
195ff49530fSBill Paul typedef struct bas_type bas_type;
196