4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
42 struct symbol
*file_name
;
43 struct node
*n_next
; /* handy for lists */
46 struct symbol
*nu_sym
;
50 struct node
*nu_node
[4]; /* descendents */
51 void *nu_arg
[4]; /* utility */
53 #define n_ptr n_u.nu_ptr
54 #define n_sym n_u.nu_sym
55 #define n_str n_u.nu_str
56 #define n_int n_u.nu_int
57 #define n_arg n_u.nu_arg
58 #define n_node n_u.nu_node
60 #define n_c_advice n_node[0]
61 #define n_c_typename n_node[1]
62 #define n_c_members n_node[2]
64 #define n_m_advice n_node[0]
65 #define n_m_type n_node[1]
66 #define n_m_decl n_node[2]
67 #define n_m_name n_node[3]
69 #define n_a_arg n_node[0]
70 #define n_a_arg1 n_node[1]
71 #define n_a_arg2 n_node[2]
73 #define n_d_descend n_node[0]
74 #define n_d_dim n_node[1]
77 typedef struct keyword
{
83 typedef struct symbol
{
87 struct node
*typedefn
;
91 typedef struct integer
{
99 /* This makes certain things much easier */
102 typedef struct advice
{
103 struct node
*a_nodes
[N_ADVICE
];
105 /* alias for basic types */
106 #define a_transmit_as a_nodes[0]
108 /* arg used for size, union or generic purpose */
109 #define a_arg_is a_nodes[1]
111 /* operation parameter in/out stuff */
112 #define a_operation a_nodes[2]
113 #define a_in a_nodes[3]
114 #define a_out a_nodes[4]
117 #define a_string a_nodes[5]
118 #define a_size_is a_nodes[6]
119 #define a_length_is a_nodes[7]
122 #define a_case a_nodes[8]
123 #define a_default a_nodes[9]
124 #define a_switch_is a_nodes[10]
126 /* interface stuff */
127 #define a_interface a_nodes[11]
128 #define a_uuid a_nodes[12]
129 #define a_no_reorder a_nodes[13]
130 #define a_extern a_nodes[14]
131 #define a_reference a_nodes[15]
132 #define a_align a_nodes[16]
135 typedef struct typeinfo
{
136 struct typeinfo
*next
;
138 unsigned int alignment
: 3; /* mask */
139 unsigned int is_conformant
: 1;
140 unsigned int is_varying
: 1;
141 unsigned int is_string
: 1;
142 unsigned int max_given
: 1;
143 unsigned int min_given
: 1;
144 unsigned int complete
: 1;
145 unsigned int has_pointers
: 1;
146 unsigned int is_referenced
: 1;
147 unsigned int is_extern
: 1;
149 unsigned short type_op
; /* STAR LB */
150 /* STRUCT BASIC_TYPE */
151 struct node
*type_dim
; /* for LB */
152 struct typeinfo
*type_down
; /* for STAR LB */
153 struct node
*definition
;
154 struct node
*type_name
; /* symbol */
156 unsigned int size_fixed_part
;
157 unsigned int size_variable_part
;
159 /* size_is(n_members) */
160 struct member
*member
; /* array */
164 typedef struct member
{
166 struct typeinfo
*type
;
168 struct node
*definition
;
170 unsigned int pdu_offset
;
173 extern ndr_typeinfo_t
*typeinfo_list
;
174 extern struct node
*construct_list
;
177 extern void analyze(void);
178 extern void show_typeinfo_list(void);
179 extern void type_extern_suffix(ndr_typeinfo_t
*, char *, size_t);
180 extern void type_null_decl(ndr_typeinfo_t
*, char *, size_t);
181 extern void type_name_decl(ndr_typeinfo_t
*, char *, size_t, char *);
182 extern void show_advice(ndr_advice_t
*, int);
183 extern void member_fixup(ndr_node_t
*);
184 extern void construct_fixup(ndr_node_t
*);
187 extern void generate(void);
190 extern ndr_symbol_t
*symbol_list
;
191 extern int line_number
;
192 extern int n_compile_error
;
193 extern struct node
*yylval
;
194 extern void set_lex_input(FILE *, char *);
195 extern int yylex(void);
196 extern void * ndr_alloc(size_t nelem
, size_t elsize
);
197 extern void compile_error(const char *, ...);
198 extern void fatal_error(const char *, ...);
199 extern struct node
*n_cons(int, ...);
200 extern void n_splice(struct node
*, struct node
*);
203 extern void tdata_dump(void);
204 extern void print_node(ndr_node_t
*);
205 extern void print_field_attr(ndr_node_t
*);
208 extern int yyparse(void);
211 extern int yyerror(char *);
217 #endif /* _NDRGEN_H */