xref: /freebsd/usr.bin/rpcgen/rpc_parse.h (revision 8d20be1e22095c27faf8fe8b2f0d089739cc742e)
1 /*
2  * $FreeBSD$
3  */
4 /*
5  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
6  * unrestricted use provided that this legend is included on all tape
7  * media and as a part of the software program in whole or part.  Users
8  * may copy or modify Sun RPC without charge, but are not authorized
9  * to license or distribute it to anyone else except as part of a product or
10  * program developed by the user.
11  *
12  * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
13  * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
14  * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
15  *
16  * Sun RPC is provided with no support and without any obligation on the
17  * part of Sun Microsystems, Inc. to assist in its use, correction,
18  * modification or enhancement.
19  *
20  * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
21  * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
22  * OR ANY PART THEREOF.
23  *
24  * In no event will Sun Microsystems, Inc. be liable for any lost revenue
25  * or profits or other special, indirect and consequential damages, even if
26  * Sun has been advised of the possibility of such damages.
27  *
28  * Sun Microsystems, Inc.
29  * 2550 Garcia Avenue
30  * Mountain View, California  94043
31  */
32 /* #pragma ident   "@(#)rpc_parse.h 1.10     94/05/15 SMI" */
33 
34 /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
35 /*	  All Rights Reserved  	*/
36 
37 /*	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T	*/
38 /*	The copyright notice above does not evidence any   	*/
39 /*	actual or intended publication of such source code.	*/
40 
41 
42 /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
43 *	PROPRIETARY NOTICE (Combined)
44 *
45 * This source code is unpublished proprietary information
46 * constituting, or derived under license from AT&T's UNIX(r) System V.
47 * In addition, portions of such source code were derived from Berkeley
48 * 4.3 BSD under license from the Regents of the University of
49 * California.
50 *
51 *
52 *
53 *	Copyright Notice
54 *
55 * Notice of copyright on this source code product does not indicate
56 *  publication.
57 *
58 *	(c) 1986,1987,1988.1989  Sun Microsystems, Inc
59 *	(c) 1983,1984,1985,1986,1987,1988,1989  AT&T.
60 *          All rights reserved.
61 */
62 
63 /*      @(#)rpc_parse.h  1.3  90/08/29  (C) 1987 SMI   */
64 
65 /*
66  * rpc_parse.h, Definitions for the RPCL parser
67  */
68 
69 enum defkind {
70 	DEF_CONST,
71 	DEF_STRUCT,
72 	DEF_UNION,
73 	DEF_ENUM,
74 	DEF_TYPEDEF,
75 	DEF_PROGRAM
76 };
77 typedef enum defkind defkind;
78 
79 typedef const char *const_def;
80 
81 enum relation {
82 	REL_VECTOR,	/* fixed length array */
83 	REL_ARRAY,	/* variable length array */
84 	REL_POINTER,	/* pointer */
85 	REL_ALIAS,	/* simple */
86 };
87 typedef enum relation relation;
88 
89 struct typedef_def {
90 	const char *old_prefix;
91 	const char *old_type;
92 	relation rel;
93 	const char *array_max;
94 };
95 typedef struct typedef_def typedef_def;
96 
97 struct enumval_list {
98 	const char *name;
99 	const char *assignment;
100 	struct enumval_list *next;
101 };
102 typedef struct enumval_list enumval_list;
103 
104 struct enum_def {
105 	enumval_list *vals;
106 };
107 typedef struct enum_def enum_def;
108 
109 struct declaration {
110 	const char *prefix;
111 	const char *type;
112 	const char *name;
113 	relation rel;
114 	const char *array_max;
115 };
116 typedef struct declaration declaration;
117 
118 struct decl_list {
119 	declaration decl;
120 	struct decl_list *next;
121 };
122 typedef struct decl_list decl_list;
123 
124 struct struct_def {
125 	decl_list *decls;
126 };
127 typedef struct struct_def struct_def;
128 
129 struct case_list {
130 	const char *case_name;
131 	int contflag;
132 	declaration case_decl;
133 	struct case_list *next;
134 };
135 typedef struct case_list case_list;
136 
137 struct union_def {
138 	declaration enum_decl;
139 	case_list *cases;
140 	declaration *default_decl;
141 };
142 typedef struct union_def union_def;
143 
144 struct arg_list {
145 	char *argname; /* name of struct for arg*/
146 	decl_list *decls;
147 };
148 
149 typedef struct arg_list arg_list;
150 
151 struct proc_list {
152 	const char *proc_name;
153 	const char *proc_num;
154 	arg_list args;
155 	int arg_num;
156 	const char *res_type;
157 	const char *res_prefix;
158 	struct proc_list *next;
159 };
160 typedef struct proc_list proc_list;
161 
162 struct version_list {
163 	const char *vers_name;
164 	const char *vers_num;
165 	proc_list *procs;
166 	struct version_list *next;
167 };
168 typedef struct version_list version_list;
169 
170 struct program_def {
171 	const char *prog_num;
172 	version_list *versions;
173 };
174 typedef struct program_def program_def;
175 
176 struct definition {
177 	const char *def_name;
178 	defkind def_kind;
179 	union {
180 		const_def co;
181 		struct_def st;
182 		union_def un;
183 		enum_def en;
184 		typedef_def ty;
185 		program_def pr;
186 	} def;
187 };
188 typedef struct definition definition;
189 
190 definition *get_definition(void);
191 
192 
193 struct bas_type
194 {
195   const char *name;
196   int length;
197   struct bas_type *next;
198 };
199 
200 typedef struct bas_type bas_type;
201