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