xref: /openbsd/usr.bin/rpcgen/rpc_parse.h (revision 78b63d65)
1 /*	$OpenBSD: rpc_parse.h,v 1.5 2001/12/05 09:50:31 deraadt Exp $	*/
2 /*	$NetBSD: rpc_parse.h,v 1.3 1995/06/11 21:50:00 pk Exp $	*/
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 or with the express written consent of
10  * Sun Microsystems, Inc.
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 
33 /*      @(#)rpc_parse.h  1.3  90/08/29  (C) 1987 SMI   */
34 
35 /*
36  * rpc_parse.h, Definitions for the RPCL parser
37  */
38 
39 enum defkind {
40 	DEF_CONST,
41 	DEF_STRUCT,
42 	DEF_UNION,
43 	DEF_ENUM,
44 	DEF_TYPEDEF,
45 	DEF_PROGRAM
46 };
47 typedef enum defkind defkind;
48 
49 typedef char *const_def;
50 
51 enum relation {
52 	REL_VECTOR,	/* fixed length array */
53 	REL_ARRAY,	/* variable length array */
54 	REL_POINTER,	/* pointer */
55 	REL_ALIAS,	/* simple */
56 };
57 typedef enum relation relation;
58 
59 struct typedef_def {
60 	char *old_prefix;
61 	char *old_type;
62 	relation rel;
63 	char *array_max;
64 };
65 typedef struct typedef_def typedef_def;
66 
67 struct enumval_list {
68 	char *name;
69 	char *assignment;
70 	struct enumval_list *next;
71 };
72 typedef struct enumval_list enumval_list;
73 
74 struct enum_def {
75 	enumval_list *vals;
76 };
77 typedef struct enum_def enum_def;
78 
79 struct declaration {
80 	char *prefix;
81 	char *type;
82 	char *name;
83 	relation rel;
84 	char *array_max;
85 };
86 typedef struct declaration declaration;
87 
88 struct decl_list {
89 	declaration decl;
90 	struct decl_list *next;
91 };
92 typedef struct decl_list decl_list;
93 
94 struct struct_def {
95 	decl_list *decls;
96 };
97 typedef struct struct_def struct_def;
98 
99 struct case_list {
100 	char *case_name;
101 	int contflag;
102 	declaration case_decl;
103 	struct case_list *next;
104 };
105 typedef struct case_list case_list;
106 
107 struct union_def {
108 	declaration enum_decl;
109 	case_list *cases;
110 	declaration *default_decl;
111 };
112 typedef struct union_def union_def;
113 
114 struct arg_list {
115 	char *argname; /* name of struct for arg*/
116 	decl_list *decls;
117 };
118 
119 typedef struct arg_list arg_list;
120 
121 struct proc_list {
122 	char *proc_name;
123 	char *proc_num;
124 	arg_list args;
125 	int arg_num;
126 	char *res_type;
127 	char *res_prefix;
128 	struct proc_list *next;
129 };
130 typedef struct proc_list proc_list;
131 
132 struct version_list {
133 	char *vers_name;
134 	char *vers_num;
135 	proc_list *procs;
136 	struct version_list *next;
137 };
138 typedef struct version_list version_list;
139 
140 struct program_def {
141 	char *prog_num;
142 	version_list *versions;
143 };
144 typedef struct program_def program_def;
145 
146 struct definition {
147 	char *def_name;
148 	defkind def_kind;
149 	union {
150 		const_def co;
151 		struct_def st;
152 		union_def un;
153 		enum_def en;
154 		typedef_def ty;
155 		program_def pr;
156 	} def;
157 };
158 typedef struct definition definition;
159 
160 definition *get_definition();
161 
162 
163 struct bas_type
164 {
165   char *name;
166   int length;
167   struct bas_type *next;
168 };
169 
170 typedef struct bas_type bas_type;
171