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