rpc_hout.c (9199c09a159c4e3e98c212d4eec1edc5252d9e33) rpc_hout.c (4e115012be61e89caf65497654493e52630b15e4)
1/* @(#)rpc_hout.c 2.1 88/08/01 4.0 RPCSRC */
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.
2/*
3 * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
4 * unrestricted use provided that this legend is included on all tape
5 * media and as a part of the software program in whole or part. Users
6 * may copy or modify Sun RPC without charge, but are not authorized
7 * to license or distribute it to anyone else except as part of a product or
8 * program developed by the user.
8 *
9 *
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.
10 * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
11 * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
12 * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
12 *
13 *
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.
14 * Sun RPC is provided with no support and without any obligation on the
15 * part of Sun Microsystems, Inc. to assist in its use, correction,
16 * modification or enhancement.
16 *
17 *
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.
18 * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
19 * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
20 * OR ANY PART THEREOF.
20 *
21 *
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.
22 * In no event will Sun Microsystems, Inc. be liable for any lost revenue
23 * or profits or other special, indirect and consequential damages, even if
24 * Sun has been advised of the possibility of such damages.
24 *
25 *
25 * Sun Microsystems, Inc.
26 * 2550 Garcia Avenue
27 * Mountain View, California 94043
28 */
26 * Sun Microsystems, Inc.
27 * 2550 Garcia Avenue
28 * Mountain View, California 94043
29 */
29
30#if 0
31#ifndef lint
30#ifndef lint
32#ident "@(#)rpc_hout.c 1.16 94/04/25 SMI"
33static char sccsid[] = "@(#)rpc_hout.c 1.12 89/02/22 (C) 1987 SMI";
31/*static char sccsid[] = "from: @(#)rpc_hout.c 1.6 87/07/28 (C) 1987 SMI";*/
32static char rcsid[] = "$Id: rpc_hout.c,v 1.1 1993/09/13 23:20:14 jtc Exp $";
34#endif
33#endif
35#endif
36
34
37#include <sys/cdefs.h>
38__FBSDID("$FreeBSD$");
35static int pconstdef(), pstructdef(), puniondef(), pdefine(), pprogramdef(),
36 penumdef(), ptypedef(), pdeclaration(), undefined2();
39
40/*
37
38/*
41 * rpc_hout.c, Header file outputter for the RPC protocol compiler
42 * Copyright (C) 1987, Sun Microsystems, Inc.
39 * rpc_hout.c, Header file outputter for the RPC protocol compiler
40 * Copyright (C) 1987, Sun Microsystems, Inc.
43 */
44#include <stdio.h>
45#include <ctype.h>
41 */
42#include <stdio.h>
43#include <ctype.h>
46#include "rpc_parse.h"
47#include "rpc_scan.h"
48#include "rpc_util.h"
44#include "rpc_util.h"
45#include "rpc_parse.h"
49
46
50void storexdrfuncdecl(const char *, int );
51static void pconstdef( definition * );
52static void pstructdef( definition * );
53static void puniondef( definition * );
54static void pprogramdef( definition *, int );
55static void penumdef( definition * );
56static void ptypedef( definition * );
57static void pdefine(const char *, const char *);
58static int undefined2(const char *, const char *);
59static void parglist(proc_list *, const char *);
60static void pprocdef(proc_list *, version_list *, const char *, int);
61
62/*
47
48/*
63 * Print the C-version of an xdr definition
49 * Print the C-version of an xdr definition
64 */
65void
50 */
51void
66print_datadef(definition *def, int headeronly)
52print_datadef(def)
53 definition *def;
67{
54{
68
69 if (def->def_kind == DEF_PROGRAM) /* handle data only */
70 return;
71
72 if (def->def_kind != DEF_CONST) {
73 f_print(fout, "\n");
74 }
75 switch (def->def_kind) {
76 case DEF_STRUCT:
77 pstructdef(def);
78 break;
79 case DEF_UNION:
80 puniondef(def);
81 break;
82 case DEF_ENUM:
83 penumdef(def);
84 break;
85 case DEF_TYPEDEF:
86 ptypedef(def);
87 break;
88 case DEF_PROGRAM:
55 if (def->def_kind != DEF_CONST) {
56 f_print(fout, "\n");
57 }
58 switch (def->def_kind) {
59 case DEF_STRUCT:
60 pstructdef(def);
61 break;
62 case DEF_UNION:
63 puniondef(def);
64 break;
65 case DEF_ENUM:
66 penumdef(def);
67 break;
68 case DEF_TYPEDEF:
69 ptypedef(def);
70 break;
71 case DEF_PROGRAM:
89 pprogramdef(def, headeronly);
72 pprogramdef(def);
90 break;
91 case DEF_CONST:
92 pconstdef(def);
93 break;
94 }
95 if (def->def_kind != DEF_PROGRAM && def->def_kind != DEF_CONST) {
73 break;
74 case DEF_CONST:
75 pconstdef(def);
76 break;
77 }
78 if (def->def_kind != DEF_PROGRAM && def->def_kind != DEF_CONST) {
96 storexdrfuncdecl(def->def_name,
97 def->def_kind != DEF_TYPEDEF ||
98 !isvectordef(def->def.ty.old_type,
99 def->def.ty.rel));
79 f_print(fout, "bool_t xdr_%s();\n", def->def_name);
100 }
80 }
101}
102
103
104void
105print_funcdef(definition *def, int headeronly)
106{
107 switch (def->def_kind) {
108 case DEF_PROGRAM:
81 if (def->def_kind != DEF_CONST) {
109 f_print(fout, "\n");
82 f_print(fout, "\n");
110 pprogramdef(def, headeronly);
111 break;
112 default:
113 break;
114 }
115}
116
83 }
84}
85
117/* store away enough information to allow the XDR functions to be spat
118 out at the end of the file */
119
120void
121storexdrfuncdecl(const char *name, int pointerp)
86static
87pconstdef(def)
88 definition *def;
122{
89{
123 xdrfunc * xdrptr;
124
125 xdrptr = XALLOC(struct xdrfunc);
126
127 xdrptr->name = name;
128 xdrptr->pointerp = pointerp;
129 xdrptr->next = NULL;
130
131 if (xdrfunc_tail == NULL){
132 xdrfunc_head = xdrptr;
133 xdrfunc_tail = xdrptr;
134 } else {
135 xdrfunc_tail->next = xdrptr;
136 xdrfunc_tail = xdrptr;
137 }
138
139
140}
141
142void
143print_xdr_func_def(const char *name, int pointerp)
144{
145 f_print(fout, "extern bool_t xdr_%s(XDR *, %s%s);\n", name,
146 name, pointerp ? "*" : "");
147}
148
149
150static void
151pconstdef(definition *def)
152{
153 pdefine(def->def_name, def->def.co);
154}
155
90 pdefine(def->def_name, def->def.co);
91}
92
156/* print out the definitions for the arguments of functions in the
157 header file
158*/
159static void
160pargdef(definition *def)
93static
94pstructdef(def)
95 definition *def;
161{
162 decl_list *l;
96{
97 decl_list *l;
163 version_list *vers;
164 char *name;
165 proc_list *plist;
98 char *name = def->def_name;
166
99
167
168 for (vers = def->def.pr.versions; vers != NULL; vers = vers->next) {
169 for (plist = vers->procs; plist != NULL;
170 plist = plist->next) {
171
172 if (!newstyle || plist->arg_num < 2) {
173 continue; /* old style or single args */
174 }
175 name = plist->args.argname;
176 f_print(fout, "struct %s {\n", name);
177 for (l = plist->args.decls;
178 l != NULL; l = l->next) {
179 pdeclaration(name, &l->decl, 1,
180 ";\n");
181 }
182 f_print(fout, "};\n");
183 f_print(fout, "typedef struct %s %s;\n",
184 name, name);
185 storexdrfuncdecl(name, 1);
186 f_print(fout, "\n");
187 }
188 }
189}
190
191
192static void
193pstructdef(definition *def)
194{
195 decl_list *l;
196 const char *name = def->def_name;
197
198 f_print(fout, "struct %s {\n", name);
199 for (l = def->def.st.decls; l != NULL; l = l->next) {
100 f_print(fout, "struct %s {\n", name);
101 for (l = def->def.st.decls; l != NULL; l = l->next) {
200 pdeclaration(name, &l->decl, 1, ";\n");
102 pdeclaration(name, &l->decl, 1);
201 }
202 f_print(fout, "};\n");
203 f_print(fout, "typedef struct %s %s;\n", name, name);
204}
205
103 }
104 f_print(fout, "};\n");
105 f_print(fout, "typedef struct %s %s;\n", name, name);
106}
107
206static void
207puniondef(definition *def)
108static
109puniondef(def)
110 definition *def;
208{
209 case_list *l;
111{
112 case_list *l;
210 const char *name = def->def_name;
113 char *name = def->def_name;
211 declaration *decl;
212
213 f_print(fout, "struct %s {\n", name);
214 decl = &def->def.un.enum_decl;
215 if (streq(decl->type, "bool")) {
216 f_print(fout, "\tbool_t %s;\n", decl->name);
217 } else {
218 f_print(fout, "\t%s %s;\n", decl->type, decl->name);
219 }
220 f_print(fout, "\tunion {\n");
221 for (l = def->def.un.cases; l != NULL; l = l->next) {
114 declaration *decl;
115
116 f_print(fout, "struct %s {\n", name);
117 decl = &def->def.un.enum_decl;
118 if (streq(decl->type, "bool")) {
119 f_print(fout, "\tbool_t %s;\n", decl->name);
120 } else {
121 f_print(fout, "\t%s %s;\n", decl->type, decl->name);
122 }
123 f_print(fout, "\tunion {\n");
124 for (l = def->def.un.cases; l != NULL; l = l->next) {
222 if (l->contflag == 0)
223 pdeclaration(name, &l->case_decl, 2, ";\n");
125 pdeclaration(name, &l->case_decl, 2);
224 }
225 decl = def->def.un.default_decl;
226 if (decl && !streq(decl->type, "void")) {
126 }
127 decl = def->def.un.default_decl;
128 if (decl && !streq(decl->type, "void")) {
227 pdeclaration(name, decl, 2, ";\n");
129 pdeclaration(name, decl, 2);
228 }
229 f_print(fout, "\t} %s_u;\n", name);
230 f_print(fout, "};\n");
231 f_print(fout, "typedef struct %s %s;\n", name, name);
232}
233
130 }
131 f_print(fout, "\t} %s_u;\n", name);
132 f_print(fout, "};\n");
133 f_print(fout, "typedef struct %s %s;\n", name, name);
134}
135
234static void
235pdefine(const char *name, const char *num)
136
137
138static
139pdefine(name, num)
140 char *name;
141 char *num;
236{
142{
237 f_print(fout, "#define\t%s %s\n", name, num);
143 f_print(fout, "#define %s %s\n", name, num);
238}
239
144}
145
240static void
241puldefine(const char *name, const char *num)
146static
147puldefine(name, num)
148 char *name;
149 char *num;
242{
150{
243 f_print(fout, "#define\t%s ((unsigned long)(%s))\n", name, num);
151 f_print(fout, "#define %s ((u_long)%s)\n", name, num);
244}
245
152}
153
246static int
247define_printed(proc_list *stop, version_list *start)
154static
155define_printed(stop, start)
156 proc_list *stop;
157 version_list *start;
248{
249 version_list *vers;
250 proc_list *proc;
251
252 for (vers = start; vers != NULL; vers = vers->next) {
253 for (proc = vers->procs; proc != NULL; proc = proc->next) {
254 if (proc == stop) {
255 return (0);
256 } else if (streq(proc->proc_name, stop->proc_name)) {
257 return (1);
258 }
259 }
260 }
261 abort();
262 /* NOTREACHED */
263}
264
158{
159 version_list *vers;
160 proc_list *proc;
161
162 for (vers = start; vers != NULL; vers = vers->next) {
163 for (proc = vers->procs; proc != NULL; proc = proc->next) {
164 if (proc == stop) {
165 return (0);
166 } else if (streq(proc->proc_name, stop->proc_name)) {
167 return (1);
168 }
169 }
170 }
171 abort();
172 /* NOTREACHED */
173}
174
265static void
266pfreeprocdef(const char * name, const char *vers)
267{
268 f_print(fout, "extern int ");
269 pvname(name, vers);
270 f_print(fout, "_freeresult(SVCXPRT *, xdrproc_t, caddr_t);\n");
271}
272
175
273static void
274pdispatch(const char * name, const char *vers)
176static
177pprogramdef(def)
178 definition *def;
275{
179{
276
277 f_print(fout, "void ");
278 pvname(name, vers);
279 f_print(fout, "(struct svc_req *rqstp, SVCXPRT *transp);\n");
280}
281
282static void
283pprogramdef(definition *def, int headeronly)
284{
285 version_list *vers;
286 proc_list *proc;
180 version_list *vers;
181 proc_list *proc;
287 const char *ext;
288
182
289 pargdef(def);
290
291 puldefine(def->def_name, def->def.pr.prog_num);
292 for (vers = def->def.pr.versions; vers != NULL; vers = vers->next) {
183 puldefine(def->def_name, def->def.pr.prog_num);
184 for (vers = def->def.pr.versions; vers != NULL; vers = vers->next) {
293 if (tblflag) {
294 f_print(fout,
295 "extern struct rpcgen_table %s_%s_table[];\n",
296 locase(def->def_name), vers->vers_num);
297 f_print(fout,
298 "extern %s_%s_nproc;\n",
299 locase(def->def_name), vers->vers_num);
300 }
301 puldefine(vers->vers_name, vers->vers_num);
185 puldefine(vers->vers_name, vers->vers_num);
302
303 f_print(fout, "\n");
304 ext = "extern ";
305 if (headeronly) {
306 f_print(fout, "%s", ext);
307 pdispatch(def->def_name, vers->vers_num);
308 }
309 for (proc = vers->procs; proc != NULL; proc = proc->next) {
310 if (!define_printed(proc, def->def.pr.versions)) {
311 puldefine(proc->proc_name, proc->proc_num);
312 }
186 for (proc = vers->procs; proc != NULL; proc = proc->next) {
187 if (!define_printed(proc, def->def.pr.versions)) {
188 puldefine(proc->proc_name, proc->proc_num);
189 }
313 f_print(fout, "%s", ext);
314 pprocdef(proc, vers, "CLIENT *", 0);
315 f_print(fout, "%s", ext);
316 pprocdef(proc, vers, "struct svc_req *", 1);
190 pprocdef(proc, vers);
317 }
191 }
318 pfreeprocdef(def->def_name, vers->vers_num);
319 }
320}
321
192 }
193}
194
322static void
323pprocdef(proc_list *proc, version_list *vp, const char *addargtype, int server_p)
324{
325 if (mtflag) {/* Print MT style stubs */
326 if (server_p)
327 f_print(fout, "bool_t ");
328 else
329 f_print(fout, "enum clnt_stat ");
330 } else {
331 ptype(proc->res_prefix, proc->res_type, 1);
332 f_print(fout, "* ");
333 }
334 if (server_p)
335 pvname_svc(proc->proc_name, vp->vers_num);
336 else
337 pvname(proc->proc_name, vp->vers_num);
338
195
339 parglist(proc, addargtype);
340}
341
342
343
344/* print out argument list of procedure */
345static void
346parglist(proc_list *proc, const char *addargtype)
196pprocdef(proc, vp)
197 proc_list *proc;
198 version_list *vp;
347{
199{
348 decl_list *dl;
349
350 f_print(fout, "(");
351 if (proc->arg_num < 2 && newstyle &&
352 streq(proc->args.decls->decl.type, "void")) {
353 /* 0 argument in new style: do nothing*/
354 }
355 else {
356 for (dl = proc->args.decls; dl != NULL; dl = dl->next) {
357 ptype(dl->decl.prefix, dl->decl.type, 1);
358 if (!newstyle)
359 f_print(fout, "*");
360 /* old style passes by reference */
361 f_print(fout, ", ");
200 f_print(fout, "extern ");
201 if (proc->res_prefix) {
202 if (streq(proc->res_prefix, "enum")) {
203 f_print(fout, "enum ");
204 } else {
205 f_print(fout, "struct ");
362 }
363 }
206 }
207 }
364
365 if (mtflag) {
366 ptype(proc->res_prefix, proc->res_type, 1);
367 f_print(fout, "*, ");
208 if (streq(proc->res_type, "bool")) {
209 f_print(fout, "bool_t *");
210 } else if (streq(proc->res_type, "string")) {
211 f_print(fout, "char **");
212 } else {
213 f_print(fout, "%s *", fixtype(proc->res_type));
368 }
214 }
369
370 f_print(fout, "%s);\n", addargtype);
371
215 pvname(proc->proc_name, vp->vers_num);
216 f_print(fout, "();\n");
372}
373
217}
218
374static void
375penumdef(definition *def)
219static
220penumdef(def)
221 definition *def;
376{
222{
377 const char *name = def->def_name;
223 char *name = def->def_name;
378 enumval_list *l;
224 enumval_list *l;
379 const char *last = NULL;
225 char *last = NULL;
380 int count = 0;
381
382 f_print(fout, "enum %s {\n", name);
383 for (l = def->def.en.vals; l != NULL; l = l->next) {
384 f_print(fout, "\t%s", l->name);
385 if (l->assignment) {
386 f_print(fout, " = %s", l->assignment);
387 last = l->assignment;
388 count = 1;
389 } else {
390 if (last == NULL) {
391 f_print(fout, " = %d", count++);
392 } else {
393 f_print(fout, " = %s + %d", last, count++);
394 }
395 }
226 int count = 0;
227
228 f_print(fout, "enum %s {\n", name);
229 for (l = def->def.en.vals; l != NULL; l = l->next) {
230 f_print(fout, "\t%s", l->name);
231 if (l->assignment) {
232 f_print(fout, " = %s", l->assignment);
233 last = l->assignment;
234 count = 1;
235 } else {
236 if (last == NULL) {
237 f_print(fout, " = %d", count++);
238 } else {
239 f_print(fout, " = %s + %d", last, count++);
240 }
241 }
396 if (l->next)
397 f_print(fout, ",\n");
398 else
399 f_print(fout, "\n");
242 f_print(fout, ",\n");
400 }
401 f_print(fout, "};\n");
402 f_print(fout, "typedef enum %s %s;\n", name, name);
403}
404
243 }
244 f_print(fout, "};\n");
245 f_print(fout, "typedef enum %s %s;\n", name, name);
246}
247
405static void
406ptypedef(definition *def)
248static
249ptypedef(def)
250 definition *def;
407{
251{
408 const char *name = def->def_name;
409 const char *old = def->def.ty.old_type;
252 char *name = def->def_name;
253 char *old = def->def.ty.old_type;
410 char prefix[8]; /* enough to contain "struct ", including NUL */
411 relation rel = def->def.ty.rel;
412
413
414 if (!streq(name, old)) {
415 if (streq(old, "string")) {
416 old = "char";
417 rel = REL_POINTER;

--- 18 unchanged lines hidden (view full) ---

436 case REL_POINTER:
437 f_print(fout, "%s%s *%s", prefix, old, name);
438 break;
439 case REL_VECTOR:
440 f_print(fout, "%s%s %s[%s]", prefix, old, name,
441 def->def.ty.array_max);
442 break;
443 case REL_ALIAS:
254 char prefix[8]; /* enough to contain "struct ", including NUL */
255 relation rel = def->def.ty.rel;
256
257
258 if (!streq(name, old)) {
259 if (streq(old, "string")) {
260 old = "char";
261 rel = REL_POINTER;

--- 18 unchanged lines hidden (view full) ---

280 case REL_POINTER:
281 f_print(fout, "%s%s *%s", prefix, old, name);
282 break;
283 case REL_VECTOR:
284 f_print(fout, "%s%s %s[%s]", prefix, old, name,
285 def->def.ty.array_max);
286 break;
287 case REL_ALIAS:
444 f_print(fout, "%s%s %s", prefix, old, name);
288 f_print(fout, "%s%s %s", prefix, old, name);
445 break;
446 }
447 f_print(fout, ";\n");
448 }
449}
450
289 break;
290 }
291 f_print(fout, ";\n");
292 }
293}
294
451void
452pdeclaration(const char *name, declaration *dec, int tab, const char *separator)
295
296static
297pdeclaration(name, dec, tab)
298 char *name;
299 declaration *dec;
300 int tab;
453{
454 char buf[8]; /* enough to hold "struct ", include NUL */
301{
302 char buf[8]; /* enough to hold "struct ", include NUL */
455 const char *prefix;
456 const char *type;
303 char *prefix;
304 char *type;
457
458 if (streq(dec->type, "void")) {
459 return;
460 }
461 tabify(fout, tab);
462 if (streq(dec->type, name) && !dec->prefix) {
463 f_print(fout, "struct ");
464 }

--- 23 unchanged lines hidden (view full) ---

488 case REL_POINTER:
489 f_print(fout, "%s%s *%s", prefix, type, dec->name);
490 break;
491 case REL_ARRAY:
492 f_print(fout, "struct {\n");
493 tabify(fout, tab);
494 f_print(fout, "\tu_int %s_len;\n", dec->name);
495 tabify(fout, tab);
305
306 if (streq(dec->type, "void")) {
307 return;
308 }
309 tabify(fout, tab);
310 if (streq(dec->type, name) && !dec->prefix) {
311 f_print(fout, "struct ");
312 }

--- 23 unchanged lines hidden (view full) ---

336 case REL_POINTER:
337 f_print(fout, "%s%s *%s", prefix, type, dec->name);
338 break;
339 case REL_ARRAY:
340 f_print(fout, "struct {\n");
341 tabify(fout, tab);
342 f_print(fout, "\tu_int %s_len;\n", dec->name);
343 tabify(fout, tab);
496 f_print(fout,
497 "\t%s%s *%s_val;\n", prefix, type, dec->name);
344 f_print(fout, "\t%s%s *%s_val;\n", prefix, type, dec->name);
498 tabify(fout, tab);
499 f_print(fout, "} %s", dec->name);
500 break;
501 }
502 }
345 tabify(fout, tab);
346 f_print(fout, "} %s", dec->name);
347 break;
348 }
349 }
503 f_print(fout, separator);
350 f_print(fout, ";\n");
504}
505
351}
352
506static int
507undefined2(const char *type, const char *stop)
353
354
355static
356undefined2(type, stop)
357 char *type;
358 char *stop;
508{
509 list *l;
510 definition *def;
511
512 for (l = defined; l != NULL; l = l->next) {
513 def = (definition *) l->val;
514 if (def->def_kind != DEF_PROGRAM) {
515 if (streq(def->def_name, stop)) {
516 return (1);
517 } else if (streq(def->def_name, type)) {
518 return (0);
519 }
520 }
521 }
522 return (1);
523}
359{
360 list *l;
361 definition *def;
362
363 for (l = defined; l != NULL; l = l->next) {
364 def = (definition *) l->val;
365 if (def->def_kind != DEF_PROGRAM) {
366 if (streq(def->def_name, stop)) {
367 return (1);
368 } else if (streq(def->def_name, type)) {
369 return (0);
370 }
371 }
372 }
373 return (1);
374}