xref: /netbsd-src/usr.bin/rpcgen/rpc_parse.h (revision 811e6386f8c5e4a3521c7003da29ec8673e344fa)
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 /* @(#)rpc_parse.h 1.3 87/03/09 (C) 1987 SMI */
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_CONST,
38 	DEF_STRUCT,
39 	DEF_UNION,
40 	DEF_ENUM,
41 	DEF_TYPEDEF,
42 	DEF_PROGRAM
43 };
44 typedef enum defkind defkind;
45 
46 typedef char *const_def;
47 
48 enum relation {
49 	REL_VECTOR,	/* fixed length array */
50 	REL_ARRAY,	/* variable length array */
51 	REL_POINTER,	/* pointer */
52 	REL_ALIAS,	/* simple */
53 };
54 typedef enum relation relation;
55 
56 struct typedef_def {
57 	char *old_prefix;
58 	char *old_type;
59 	relation rel;
60 	char *array_max;
61 };
62 typedef struct typedef_def typedef_def;
63 
64 
65 struct enumval_list {
66 	char *name;
67 	char *assignment;
68 	struct enumval_list *next;
69 };
70 typedef struct enumval_list enumval_list;
71 
72 struct enum_def {
73 	enumval_list *vals;
74 };
75 typedef struct enum_def enum_def;
76 
77 
78 struct declaration {
79 	char *prefix;
80 	char *type;
81 	char *name;
82 	relation rel;
83 	char *array_max;
84 };
85 typedef struct declaration declaration;
86 
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 
100 struct case_list {
101 	char *case_name;
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 
115 
116 struct proc_list {
117 	char *proc_name;
118 	char *proc_num;
119 	char *arg_type;
120 	char *arg_prefix;
121 	char *res_type;
122 	char *res_prefix;
123 	struct proc_list *next;
124 };
125 typedef struct proc_list proc_list;
126 
127 
128 struct version_list {
129 	char *vers_name;
130 	char *vers_num;
131 	proc_list *procs;
132 	struct version_list *next;
133 };
134 typedef struct version_list version_list;
135 
136 struct program_def {
137 	char *prog_num;
138 	version_list *versions;
139 };
140 typedef struct program_def program_def;
141 
142 struct definition {
143 	char *def_name;
144 	defkind def_kind;
145 	union {
146 		const_def co;
147 		struct_def st;
148 		union_def un;
149 		enum_def en;
150 		typedef_def ty;
151 		program_def pr;
152 	} def;
153 };
154 typedef struct definition definition;
155 
156 /* @(#)rpc_parse.h	2.1 88/08/01 4.0 RPCSRC */
157 definition *get_definition();
158