xref: /freebsd/usr.bin/rpcgen/rpc_parse.h (revision ec994981447e8a974426660b5071bc405280af73)
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 /* #pragma ident   "@(#)rpc_parse.h 1.10     94/05/15 SMI" */
32 
33 /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
34 /*	  All Rights Reserved  	*/
35 
36 /*	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T	*/
37 /*	The copyright notice above does not evidence any   	*/
38 /*	actual or intended publication of such source code.	*/
39 
40 
41 /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
42 *	PROPRIETARY NOTICE (Combined)
43 *
44 * This source code is unpublished proprietary information
45 * constituting, or derived under license from AT&T's UNIX(r) System V.
46 * In addition, portions of such source code were derived from Berkeley
47 * 4.3 BSD under license from the Regents of the University of
48 * California.
49 *
50 *
51 *
52 *	Copyright Notice
53 *
54 * Notice of copyright on this source code product does not indicate
55 *  publication.
56 *
57 *	(c) 1986,1987,1988.1989  Sun Microsystems, Inc
58 *	(c) 1983,1984,1985,1986,1987,1988,1989  AT&T.
59 *          All rights reserved.
60 */
61 
62 /*      @(#)rpc_parse.h  1.3  90/08/29  (C) 1987 SMI   */
63 
64 /*
65  * rpc_parse.h, Definitions for the RPCL parser
66  */
67 
68 enum defkind {
69 	DEF_CONST,
70 	DEF_STRUCT,
71 	DEF_UNION,
72 	DEF_ENUM,
73 	DEF_TYPEDEF,
74 	DEF_PROGRAM
75 };
76 typedef enum defkind defkind;
77 
78 typedef const char *const_def;
79 
80 enum relation {
81 	REL_VECTOR,	/* fixed length array */
82 	REL_ARRAY,	/* variable length array */
83 	REL_POINTER,	/* pointer */
84 	REL_ALIAS,	/* simple */
85 };
86 typedef enum relation relation;
87 
88 struct typedef_def {
89 	const char *old_prefix;
90 	const char *old_type;
91 	relation rel;
92 	const char *array_max;
93 };
94 typedef struct typedef_def typedef_def;
95 
96 struct enumval_list {
97 	const char *name;
98 	const char *assignment;
99 	struct enumval_list *next;
100 };
101 typedef struct enumval_list enumval_list;
102 
103 struct enum_def {
104 	enumval_list *vals;
105 };
106 typedef struct enum_def enum_def;
107 
108 struct declaration {
109 	const char *prefix;
110 	const char *type;
111 	const char *name;
112 	relation rel;
113 	const char *array_max;
114 };
115 typedef struct declaration declaration;
116 
117 struct decl_list {
118 	declaration decl;
119 	struct decl_list *next;
120 };
121 typedef struct decl_list decl_list;
122 
123 struct struct_def {
124 	decl_list *decls;
125 };
126 typedef struct struct_def struct_def;
127 
128 struct case_list {
129 	const char *case_name;
130 	int contflag;
131 	declaration case_decl;
132 	struct case_list *next;
133 };
134 typedef struct case_list case_list;
135 
136 struct union_def {
137 	declaration enum_decl;
138 	case_list *cases;
139 	declaration *default_decl;
140 };
141 typedef struct union_def union_def;
142 
143 struct arg_list {
144 	char *argname; /* name of struct for arg*/
145 	decl_list *decls;
146 };
147 
148 typedef struct arg_list arg_list;
149 
150 struct proc_list {
151 	const char *proc_name;
152 	const char *proc_num;
153 	arg_list args;
154 	int arg_num;
155 	const char *res_type;
156 	const char *res_prefix;
157 	struct proc_list *next;
158 };
159 typedef struct proc_list proc_list;
160 
161 struct version_list {
162 	const char *vers_name;
163 	const char *vers_num;
164 	proc_list *procs;
165 	struct version_list *next;
166 };
167 typedef struct version_list version_list;
168 
169 struct program_def {
170 	const char *prog_num;
171 	version_list *versions;
172 };
173 typedef struct program_def program_def;
174 
175 struct definition {
176 	const char *def_name;
177 	defkind def_kind;
178 	union {
179 		const_def co;
180 		struct_def st;
181 		union_def un;
182 		enum_def en;
183 		typedef_def ty;
184 		program_def pr;
185 	} def;
186 };
187 typedef struct definition definition;
188 
189 definition *get_definition(void);
190 
191 
192 struct bas_type
193 {
194   const char *name;
195   int length;
196   struct bas_type *next;
197 };
198 
199 typedef struct bas_type bas_type;
200