xref: /freebsd/usr.bin/rpcgen/rpc_parse.h (revision 380a989b3223d455375b4fae70fd0b9bdd43bafb)
1 /*
2  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
3  * unrestricted use provided that this legend is included on all tape
4  * media and as a part of the software program in whole or part.  Users
5  * may copy or modify Sun RPC without charge, but are not authorized
6  * to license or distribute it to anyone else except as part of a product or
7  * program developed by the user.
8  *
9  * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
10  * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
11  * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
12  *
13  * Sun RPC is provided with no support and without any obligation on the
14  * part of Sun Microsystems, Inc. to assist in its use, correction,
15  * modification or enhancement.
16  *
17  * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
18  * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
19  * OR ANY PART THEREOF.
20  *
21  * In no event will Sun Microsystems, Inc. be liable for any lost revenue
22  * or profits or other special, indirect and consequential damages, even if
23  * Sun has been advised of the possibility of such damages.
24  *
25  * Sun Microsystems, Inc.
26  * 2550 Garcia Avenue
27  * Mountain View, California  94043
28  */
29 #pragma ident   "@(#)rpc_parse.h 1.10     94/05/15 SMI"
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 /*      @(#)rpc_parse.h  1.3  90/08/29  (C) 1987 SMI   */
61 
62 /*
63  * rpc_parse.h, Definitions for the RPCL parser
64  */
65 
66 enum defkind {
67 	DEF_CONST,
68 	DEF_STRUCT,
69 	DEF_UNION,
70 	DEF_ENUM,
71 	DEF_TYPEDEF,
72 	DEF_PROGRAM
73 };
74 typedef enum defkind defkind;
75 
76 typedef char *const_def;
77 
78 enum relation {
79 	REL_VECTOR,	/* fixed length array */
80 	REL_ARRAY,	/* variable length array */
81 	REL_POINTER,	/* pointer */
82 	REL_ALIAS,	/* simple */
83 };
84 typedef enum relation relation;
85 
86 struct typedef_def {
87 	char *old_prefix;
88 	char *old_type;
89 	relation rel;
90 	char *array_max;
91 };
92 typedef struct typedef_def typedef_def;
93 
94 struct enumval_list {
95 	char *name;
96 	char *assignment;
97 	struct enumval_list *next;
98 };
99 typedef struct enumval_list enumval_list;
100 
101 struct enum_def {
102 	enumval_list *vals;
103 };
104 typedef struct enum_def enum_def;
105 
106 struct declaration {
107 	char *prefix;
108 	char *type;
109 	char *name;
110 	relation rel;
111 	char *array_max;
112 };
113 typedef struct declaration declaration;
114 
115 struct decl_list {
116 	declaration decl;
117 	struct decl_list *next;
118 };
119 typedef struct decl_list decl_list;
120 
121 struct struct_def {
122 	decl_list *decls;
123 };
124 typedef struct struct_def struct_def;
125 
126 struct case_list {
127 	char *case_name;
128 	int contflag;
129 	declaration case_decl;
130 	struct case_list *next;
131 };
132 typedef struct case_list case_list;
133 
134 struct union_def {
135 	declaration enum_decl;
136 	case_list *cases;
137 	declaration *default_decl;
138 };
139 typedef struct union_def union_def;
140 
141 struct arg_list {
142 	char *argname; /* name of struct for arg*/
143 	decl_list *decls;
144 };
145 
146 typedef struct arg_list arg_list;
147 
148 struct proc_list {
149 	char *proc_name;
150 	char *proc_num;
151 	arg_list args;
152 	int arg_num;
153 	char *res_type;
154 	char *res_prefix;
155 	struct proc_list *next;
156 };
157 typedef struct proc_list proc_list;
158 
159 struct version_list {
160 	char *vers_name;
161 	char *vers_num;
162 	proc_list *procs;
163 	struct version_list *next;
164 };
165 typedef struct version_list version_list;
166 
167 struct program_def {
168 	char *prog_num;
169 	version_list *versions;
170 };
171 typedef struct program_def program_def;
172 
173 struct definition {
174 	char *def_name;
175 	defkind def_kind;
176 	union {
177 		const_def co;
178 		struct_def st;
179 		union_def un;
180 		enum_def en;
181 		typedef_def ty;
182 		program_def pr;
183 	} def;
184 };
185 typedef struct definition definition;
186 
187 definition *get_definition();
188 
189 
190 struct bas_type
191 {
192   char *name;
193   int length;
194   struct bas_type *next;
195 };
196 
197 typedef struct bas_type bas_type;
198