pull-prototypes-to-head-20020821
[openafs.git] / src / rxgen / rpc_parse.h
1 /* @(#)rpc_parse.h 1.3 87/03/09 (C) 1987 SMI */
2 /*
3  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
4  * unrestricted use provided that this legend is included on all tape
5  * media and as a part of the software program in whole or part.  Users
6  * may copy or modify Sun RPC without charge, but are not authorized
7  * to license or distribute it to anyone else except as part of a product or
8  * program developed by the user.
9  * 
10  * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
11  * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
12  * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
13  * 
14  * Sun RPC is provided with no support and without any obligation on the
15  * part of Sun Microsystems, Inc. to assist in its use, correction,
16  * modification or enhancement.
17  * 
18  * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
19  * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
20  * OR ANY PART THEREOF.
21  * 
22  * In no event will Sun Microsystems, Inc. be liable for any lost revenue
23  * or profits or other special, indirect and consequential damages, even if
24  * Sun has been advised of the possibility of such damages.
25  * 
26  * Sun Microsystems, Inc.
27  * 2550 Garcia Avenue
28  * Mountain View, California  94043
29  */
30
31 /*
32  * rpc_parse.h, Definitions for the RPCL parser 
33  * Copyright (C) 1987, Sun Microsystems, Inc. 
34  */
35
36 enum defkind {
37         DEF_INPARAM,
38         DEF_OUTPARAM,
39         DEF_INOUTPARAM,
40         DEF_PACKAGE,
41         DEF_PREFIX,
42         DEF_PARAM,
43         DEF_SPECIAL,
44         DEF_STARTINGOPCODE,
45         DEF_CUSTOMIZED,
46         DEF_SPLITPREFIX,
47         DEF_PROC,
48         DEF_NULL,
49         DEF_CONST,
50         DEF_STRUCT,
51         DEF_UNION,
52         DEF_ENUM,
53         DEF_TYPEDEF,
54         DEF_PROGRAM
55 };
56 typedef enum defkind defkind;
57
58 typedef char *const_def;
59
60 enum relation {
61         REL_VECTOR,     /* fixed length array */
62         REL_ARRAY,      /* variable length array */
63         REL_POINTER,    /* pointer */
64         REL_ALIAS       /* simple */
65 };
66 typedef enum relation relation;
67
68 struct typedef_def {
69         char *old_prefix;
70         char *old_type;
71         relation rel;
72         char *array_max;
73 };
74 typedef struct typedef_def typedef_def;
75
76
77 struct enumval_list {
78         char *name;
79         char *assignment;
80         struct enumval_list *next;
81 };
82 typedef struct enumval_list enumval_list;
83
84 struct enum_def {
85         enumval_list *vals;
86 };
87 typedef struct enum_def enum_def;
88
89
90 struct declaration {
91         char *prefix;
92         char *type;
93         char *name;
94         relation rel;
95         char *array_max;
96 };
97 typedef struct declaration declaration;
98
99
100 struct decl_list {
101         declaration decl;
102         struct decl_list *next;
103 };
104 typedef struct decl_list decl_list;
105
106 struct struct_def {
107         decl_list *decls;
108 };
109 typedef struct struct_def struct_def;
110
111
112 struct case_list {
113         char *case_name;
114         declaration case_decl;
115         struct case_list *next;
116 };
117 typedef struct case_list case_list;
118
119 struct union_def {
120         declaration enum_decl;
121         case_list *cases;
122         declaration *default_decl;
123 };
124 typedef struct union_def union_def;
125
126
127
128 struct proc_list {
129         char *proc_name;
130         char *proc_num;
131         char *arg_type;
132         char *arg_prefix;
133         char *res_type;
134         char *res_prefix;
135         struct proc_list *next;
136 };
137 typedef struct proc_list proc_list;
138
139
140 struct version_list {
141         char *vers_name;
142         char *vers_num;
143         proc_list *procs;
144         struct version_list *next;
145 };
146 typedef struct version_list version_list;
147
148 struct program_def {
149         char *prog_num;
150         version_list *versions;
151 };
152 typedef struct program_def program_def;
153
154 struct param_list {
155     defkind param_kind;
156     char *param_name;   
157     char *param_type;
158     char *string_name;
159 #define INDIRECT_PARAM  1
160 #define PROCESSED_PARAM 2
161 #define ARRAYNAME_PARAM 4
162 #define ARRAYSIZE_PARAM 8
163 #define FREETHIS_PARAM  16
164 #define OUT_STRING      32
165     char param_flag;
166 };
167 typedef struct param_list param_list;
168
169 struct proc1_list {
170     defkind component_kind;
171     char *code, *scode;
172     param_list pl;
173     struct proc1_list *next;
174 };
175 typedef struct proc1_list proc1_list;
176     
177 struct procedure_def {
178     char *proc_name;
179     char *proc_prefix;
180     char *proc_opcodename;
181     int proc_opcodenum;
182     char *proc_serverstub;  
183 #undef  IN
184 #define IN  0
185 #undef  OUT
186 #define OUT 1
187 #undef  INOUT
188 #define INOUT   2
189     short paramtypes[3];
190     char split_flag;
191     relation rel;
192     proc1_list *plists;
193  };
194 typedef struct procedure_def procedure_def;
195
196 struct special_def {
197     char *string_name;
198     char *string_value;
199 };
200 typedef struct special_def special_def;
201
202 struct spec_list {
203     special_def sdef;
204     struct spec_list *next;
205 };
206 typedef struct spec_list spec_list;
207
208 struct spec_def {
209     spec_list *specs;
210 };
211 typedef struct spec_def spec_def;
212
213 struct definition {
214         char *def_name;
215         defkind def_kind;
216         union {
217                 const_def co;
218                 struct_def st;
219                 union_def un;
220                 enum_def en;
221                 typedef_def ty;
222                 program_def pr;
223                 spec_def sd;
224         } def;
225         procedure_def pc;
226         int can_fail;
227 };
228 typedef struct definition definition;