]> git.decadent.org.uk Git - nfs-utils.git/blob - tools/rpcgen/rpc_parse.h
Replace the Sun RPC license with the BSD license,
[nfs-utils.git] / tools / rpcgen / rpc_parse.h
1 /*
2  * Copyright (c) 2009, Sun Microsystems, Inc.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  * - Redistributions of source code must retain the above copyright notice,
8  *   this list of conditions and the following disclaimer.
9  * - Redistributions in binary form must reproduce the above copyright notice,
10  *   this list of conditions and the following disclaimer in the documentation
11  *   and/or other materials provided with the distribution.
12  * - Neither the name of Sun Microsystems, Inc. nor the names of its
13  *   contributors may be used to endorse or promote products derived
14  *   from this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26  * POSSIBILITY OF SUCH DAMAGE.
27  */
28
29 /*      @(#)rpc_parse.h  1.3  90/08/29  (C) 1987 SMI   */
30
31 /*
32  * rpc_parse.h, Definitions for the RPCL parser 
33  */
34
35 enum defkind {
36         DEF_CONST,
37         DEF_STRUCT,
38         DEF_UNION,
39         DEF_ENUM,
40         DEF_TYPEDEF,
41         DEF_PROGRAM
42 };
43 typedef enum defkind defkind;
44
45 typedef char *const_def;
46
47 enum relation {
48         REL_VECTOR,     /* fixed length array */
49         REL_ARRAY,      /* variable length array */
50         REL_POINTER,    /* pointer */
51         REL_ALIAS,      /* simple */
52 };
53 typedef enum relation relation;
54
55 struct typedef_def {
56         char *old_prefix;
57         char *old_type;
58         relation rel;
59         char *array_max;
60 };
61 typedef struct typedef_def typedef_def;
62
63 struct enumval_list {
64         char *name;
65         char *assignment;
66         struct enumval_list *next;
67 };
68 typedef struct enumval_list enumval_list;
69
70 struct enum_def {
71         enumval_list *vals;
72 };
73 typedef struct enum_def enum_def;
74
75 struct declaration {
76         char *prefix;
77         char *type;
78         char *name;
79         relation rel;
80         char *array_max;
81 };
82 typedef struct declaration declaration;
83
84 struct decl_list {
85         declaration decl;
86         struct decl_list *next;
87 };
88 typedef struct decl_list decl_list;
89
90 struct struct_def {
91         decl_list *decls;
92 };
93 typedef struct struct_def struct_def;
94
95 struct case_list {
96         char *case_name;
97         int contflag;
98         declaration case_decl;
99         struct case_list *next;
100 };
101 typedef struct case_list case_list;
102
103 struct union_def {
104         declaration enum_decl;
105         case_list *cases;
106         declaration *default_decl;
107 };
108 typedef struct union_def union_def;
109
110 struct arg_list {
111         char *argname; /* name of struct for arg*/
112         decl_list *decls;
113 };
114         
115 typedef struct arg_list arg_list;
116
117 struct proc_list {
118         char *proc_name;
119         char *proc_num;
120         arg_list args;
121         int arg_num;
122         char *res_type;
123         char *res_prefix;
124         struct proc_list *next;
125 };
126 typedef struct proc_list proc_list;
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 definition *get_definition();
157
158
159 struct bas_type
160 {
161   char *name;
162   int length;
163   struct bas_type *next;
164 };
165
166 typedef struct bas_type bas_type;