xref: /freebsd/usr.bin/rpcgen/rpc_parse.h (revision 7799f52a32f592a7efe259bc3411ba52d13db797)
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  *	from: @(#)rpc_parse.h 1.3 87/03/09 (C) 1987 SMI
30  *	$Id: rpc_parse.h,v 1.1 1994/08/07 18:01:33 wollman Exp $
31  */
32 
33 /*
34  * rpc_parse.h, Definitions for the RPCL parser
35  * Copyright (C) 1987, Sun Microsystems, Inc.
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 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 	char *old_prefix;
60 	char *old_type;
61 	relation rel;
62 	char *array_max;
63 };
64 typedef struct typedef_def typedef_def;
65 
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 
80 struct declaration {
81 	char *prefix;
82 	char *type;
83 	char *name;
84 	relation rel;
85 	char *array_max;
86 };
87 typedef struct declaration declaration;
88 
89 
90 struct decl_list {
91 	declaration decl;
92 	struct decl_list *next;
93 };
94 typedef struct decl_list decl_list;
95 
96 struct struct_def {
97 	decl_list *decls;
98 };
99 typedef struct struct_def struct_def;
100 
101 
102 struct case_list {
103 	char *case_name;
104 	declaration case_decl;
105 	struct case_list *next;
106 };
107 typedef struct case_list case_list;
108 
109 struct union_def {
110 	declaration enum_decl;
111 	case_list *cases;
112 	declaration *default_decl;
113 };
114 typedef struct union_def union_def;
115 
116 
117 
118 struct proc_list {
119 	char *proc_name;
120 	char *proc_num;
121 	char *arg_type;
122 	char *arg_prefix;
123 	char *res_type;
124 	char *res_prefix;
125 	struct proc_list *next;
126 };
127 typedef struct proc_list proc_list;
128 
129 
130 struct version_list {
131 	char *vers_name;
132 	char *vers_num;
133 	proc_list *procs;
134 	struct version_list *next;
135 };
136 typedef struct version_list version_list;
137 
138 struct program_def {
139 	char *prog_num;
140 	version_list *versions;
141 };
142 typedef struct program_def program_def;
143 
144 struct definition {
145 	char *def_name;
146 	defkind def_kind;
147 	union {
148 		const_def co;
149 		struct_def st;
150 		union_def un;
151 		enum_def en;
152 		typedef_def ty;
153 		program_def pr;
154 	} def;
155 };
156 typedef struct definition definition;
157 
158 /* @(#)rpc_parse.h	2.1 88/08/01 4.0 RPCSRC */
159 definition *get_definition();
160