xref: /dragonfly/usr.bin/rpcgen/rpc_parse.h (revision 7d3e9a5b)
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, MERCHANTABILITY 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  * @(#)rpc_parse.h 1.10     94/05/15 SMI; 1.3  90/08/29  (C) 1987 SMI
30  * $FreeBSD: src/usr.bin/rpcgen/rpc_parse.h,v 1.7 2005/11/13 21:17:24 dwmalone Exp $
31  */
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 /*
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 const 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 	const char *old_prefix;
88 	const char *old_type;
89 	relation rel;
90 	const char *array_max;
91 };
92 typedef struct typedef_def typedef_def;
93 
94 struct enumval_list {
95 	const char *name;
96 	const 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 	const char *prefix;
108 	const char *type;
109 	const char *name;
110 	relation rel;
111 	const 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 	const 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 	const char *proc_name;
150 	const char *proc_num;
151 	arg_list args;
152 	int arg_num;
153 	const char *res_type;
154 	const char *res_prefix;
155 	struct proc_list *next;
156 };
157 typedef struct proc_list proc_list;
158 
159 struct version_list {
160 	const char *vers_name;
161 	const 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 	const char *prog_num;
169 	version_list *versions;
170 };
171 typedef struct program_def program_def;
172 
173 struct definition {
174 	const 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(void);
188 
189 struct bas_type
190 {
191   const char *name;
192   int length;
193   struct bas_type *next;
194 };
195 
196 typedef struct bas_type bas_type;
197