]>
Commit | Line | Data |
---|---|---|
a7ab6ec8 | 1 | /* @(#)rpc_parse.h 1.3 90/08/29 |
f2ac4868 | 2 | * |
a7ab6ec8 UD |
3 | * Copyright (c) 2010, Oracle America, Inc. |
4 | * Redistribution and use in source and binary forms, with or without | |
5 | * modification, are permitted provided that the following conditions are | |
6 | * met: | |
0d204b0a | 7 | * |
a7ab6ec8 UD |
8 | * * Redistributions of source code must retain the above copyright |
9 | * notice, this list of conditions and the following disclaimer. | |
10 | * * Redistributions in binary form must reproduce the above | |
11 | * copyright notice, this list of conditions and the following | |
12 | * disclaimer in the documentation and/or other materials | |
13 | * provided with the distribution. | |
14 | * * Neither the name of the "Oracle America, Inc." nor the names of its | |
15 | * contributors may be used to endorse or promote products derived | |
16 | * from this software without specific prior written permission. | |
0d204b0a | 17 | * |
a7ab6ec8 UD |
18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | |
21 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | |
22 | * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |
23 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE | |
25 | * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | |
27 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | |
28 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
29 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
0d204b0a | 30 | * |
1f205a47 | 31 | * rpc_parse.h, Definitions for the RPCL parser |
28f540f4 RM |
32 | */ |
33 | ||
34 | enum defkind { | |
35 | DEF_CONST, | |
36 | DEF_STRUCT, | |
37 | DEF_UNION, | |
38 | DEF_ENUM, | |
39 | DEF_TYPEDEF, | |
40 | DEF_PROGRAM | |
41 | }; | |
42 | typedef enum defkind defkind; | |
43 | ||
0d204b0a | 44 | typedef const char *const_def; |
28f540f4 RM |
45 | |
46 | enum relation { | |
47 | REL_VECTOR, /* fixed length array */ | |
48 | REL_ARRAY, /* variable length array */ | |
49 | REL_POINTER, /* pointer */ | |
1f205a47 | 50 | REL_ALIAS /* simple */ |
28f540f4 RM |
51 | }; |
52 | typedef enum relation relation; | |
53 | ||
54 | struct typedef_def { | |
0d204b0a UD |
55 | const char *old_prefix; |
56 | const char *old_type; | |
28f540f4 | 57 | relation rel; |
0d204b0a | 58 | const char *array_max; |
28f540f4 RM |
59 | }; |
60 | typedef struct typedef_def typedef_def; | |
61 | ||
28f540f4 | 62 | struct enumval_list { |
0d204b0a UD |
63 | const char *name; |
64 | const char *assignment; | |
28f540f4 RM |
65 | struct enumval_list *next; |
66 | }; | |
67 | typedef struct enumval_list enumval_list; | |
68 | ||
69 | struct enum_def { | |
70 | enumval_list *vals; | |
71 | }; | |
72 | typedef struct enum_def enum_def; | |
73 | ||
28f540f4 | 74 | struct declaration { |
0d204b0a UD |
75 | const char *prefix; |
76 | const char *type; | |
77 | const char *name; | |
28f540f4 | 78 | relation rel; |
0d204b0a | 79 | const char *array_max; |
28f540f4 RM |
80 | }; |
81 | typedef struct declaration declaration; | |
82 | ||
28f540f4 RM |
83 | struct decl_list { |
84 | declaration decl; | |
85 | struct decl_list *next; | |
86 | }; | |
87 | typedef struct decl_list decl_list; | |
88 | ||
89 | struct struct_def { | |
90 | decl_list *decls; | |
91 | }; | |
92 | typedef struct struct_def struct_def; | |
93 | ||
28f540f4 | 94 | struct case_list { |
0d204b0a UD |
95 | const char *case_name; |
96 | int contflag; | |
28f540f4 RM |
97 | declaration case_decl; |
98 | struct case_list *next; | |
99 | }; | |
100 | typedef struct case_list case_list; | |
101 | ||
102 | struct union_def { | |
103 | declaration enum_decl; | |
104 | case_list *cases; | |
105 | declaration *default_decl; | |
106 | }; | |
107 | typedef struct union_def union_def; | |
108 | ||
0d204b0a UD |
109 | struct arg_list { |
110 | const char *argname; /* name of struct for arg*/ | |
111 | decl_list *decls; | |
112 | }; | |
1f205a47 | 113 | |
0d204b0a | 114 | typedef struct arg_list arg_list; |
28f540f4 RM |
115 | |
116 | struct proc_list { | |
0d204b0a UD |
117 | const char *proc_name; |
118 | const char *proc_num; | |
119 | arg_list args; | |
120 | int arg_num; | |
121 | const char *res_type; | |
122 | const char *res_prefix; | |
28f540f4 RM |
123 | struct proc_list *next; |
124 | }; | |
125 | typedef struct proc_list proc_list; | |
126 | ||
28f540f4 | 127 | struct version_list { |
0d204b0a UD |
128 | const char *vers_name; |
129 | const char *vers_num; | |
28f540f4 RM |
130 | proc_list *procs; |
131 | struct version_list *next; | |
132 | }; | |
133 | typedef struct version_list version_list; | |
134 | ||
135 | struct program_def { | |
0d204b0a | 136 | const char *prog_num; |
28f540f4 RM |
137 | version_list *versions; |
138 | }; | |
139 | typedef struct program_def program_def; | |
140 | ||
141 | struct definition { | |
0d204b0a | 142 | const char *def_name; |
28f540f4 RM |
143 | defkind def_kind; |
144 | union { | |
145 | const_def co; | |
146 | struct_def st; | |
147 | union_def un; | |
148 | enum_def en; | |
149 | typedef_def ty; | |
150 | program_def pr; | |
151 | } def; | |
152 | }; | |
153 | typedef struct definition definition; | |
154 | ||
0d204b0a UD |
155 | definition *get_definition(void); |
156 | ||
157 | ||
158 | struct bas_type | |
159 | { | |
160 | const char *name; | |
161 | int length; | |
162 | struct bas_type *next; | |
163 | }; | |
164 | ||
165 | typedef struct bas_type bas_type; |