xref: /titanic_44/usr/src/cmd/rpcgen/rpc_parse.h (revision 8eea8e29cc4374d1ee24c25a07f45af132db3499)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
27 /* All Rights Reserved */
28 /*
29  * University Copyright- Copyright (c) 1982, 1986, 1988
30  * The Regents of the University of California
31  * All Rights Reserved
32  *
33  * University Acknowledgment- Portions of this document are derived from
34  * software developed by the University of California, Berkeley, and its
35  * contributors.
36  */
37 
38 #ifndef _RPC_PARSE_H
39 #define	_RPC_PARSE_H
40 
41 #pragma ident	"%Z%%M%	%I%	%E% SMI"
42 
43 #ifdef __cplusplus
44 extern "C" {
45 #endif
46 
47 /*
48  * rpc_parse.h, Definitions for the RPCL parser
49  */
50 
51 enum defkind {
52 	DEF_CONST,
53 	DEF_STRUCT,
54 	DEF_UNION,
55 	DEF_ENUM,
56 	DEF_TYPEDEF,
57 	DEF_PROGRAM,
58 	DEF_RESULT
59 };
60 typedef enum defkind defkind;
61 
62 typedef char *const_def;
63 
64 enum relation {
65 	REL_VECTOR,	/* fixed length array */
66 	REL_ARRAY,	/* variable length array */
67 	REL_POINTER,	/* pointer */
68 	REL_ALIAS,	/* simple */
69 };
70 typedef enum relation relation;
71 
72 struct typedef_def {
73 	char *old_prefix;
74 	char *old_type;
75 	relation rel;
76 	char *array_max;
77 };
78 typedef struct typedef_def typedef_def;
79 
80 struct enumval_list {
81 	char *name;
82 	char *assignment;
83 	struct enumval_list *next;
84 };
85 typedef struct enumval_list enumval_list;
86 
87 struct enum_def {
88 	enumval_list *vals;
89 };
90 typedef struct enum_def enum_def;
91 
92 struct declaration {
93 	char *prefix;
94 	char *type;
95 	char *name;
96 	relation rel;
97 	char *array_max;
98 };
99 typedef struct declaration declaration;
100 
101 struct decl_list {
102 	declaration decl;
103 	struct decl_list *next;
104 };
105 typedef struct decl_list decl_list;
106 
107 struct struct_def {
108 	decl_list *decls;
109 	decl_list *tail;
110 	char self_pointer;
111 };
112 typedef struct struct_def struct_def;
113 
114 struct case_list {
115 	char *case_name;
116 	int contflag;
117 	declaration case_decl;
118 	struct case_list *next;
119 };
120 typedef struct case_list case_list;
121 
122 struct union_def {
123 	declaration enum_decl;
124 	case_list *cases;
125 	declaration *default_decl;
126 };
127 typedef struct union_def union_def;
128 
129 struct arg_list {
130 	char *argname; /* name of struct for arg */
131 	decl_list *decls;
132 };
133 
134 typedef struct arg_list arg_list;
135 
136 struct proc_list {
137 	char *proc_name;
138 	char *proc_num;
139 	arg_list args;
140 	int arg_num;
141 	char *res_type;
142 	char *res_prefix;
143 	struct proc_list *next;
144 };
145 typedef struct proc_list proc_list;
146 
147 struct version_list {
148 	char *vers_name;
149 	char *vers_num;
150 	proc_list *procs;
151 	struct version_list *next;
152 };
153 typedef struct version_list version_list;
154 
155 struct program_def {
156 	char *prog_num;
157 	version_list *versions;
158 };
159 typedef struct program_def program_def;
160 
161 struct definition {
162 	char *def_name;
163 	defkind def_kind;
164 	union {
165 		const_def co;
166 		struct_def st;
167 		union_def un;
168 		enum_def en;
169 		typedef_def ty;
170 		program_def pr;
171 	} def;
172 };
173 typedef struct definition definition;
174 
175 definition *get_definition();
176 
177 
178 struct bas_type
179 {
180 	char *name;
181 	int length;
182 	struct bas_type *next;
183 };
184 
185 typedef struct bas_type bas_type;
186 
187 #ifdef __cplusplus
188 }
189 #endif
190 
191 #endif	/* !_RPC_PARSE_H */
192