=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/rpcgen/rpc_cout.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- src/usr.bin/rpcgen/rpc_cout.c 1997/10/11 21:10:41 1.4 +++ src/usr.bin/rpcgen/rpc_cout.c 2001/07/17 02:23:59 1.5 @@ -1,4 +1,4 @@ -/* $OpenBSD: rpc_cout.c,v 1.4 1997/10/11 21:10:41 deraadt Exp $ */ +/* $OpenBSD: rpc_cout.c,v 1.5 2001/07/17 02:23:59 pvalchev Exp $ */ /* $NetBSD: rpc_cout.c,v 1.6 1996/10/01 04:13:53 cgd Exp $ */ /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for @@ -41,27 +41,28 @@ #include #include #include +#include +#include #include "rpc_parse.h" #include "rpc_util.h" -static findtype __P((definition *, char *)); -static undefined __P((char *)); -static print_generic_header __P((char *, int)); -static print_header __P((definition *)); -static print_prog_header __P((proc_list *)); -static print_trailer __P((void)); -static print_ifopen __P((int, char *)); -static print_ifarg __P((char *)); -static print_ifsizeof __P((char *, char *)); -static print_ifclose __P((int)); -static print_ifstat __P((int, char *, char *, relation, char *, char *, char *)); -static emit_num __P((definition *)); -static emit_program __P((definition *)); -static emit_enum __P((definition *)); -static emit_union __P((definition *)); -static emit_struct __P((definition *)); -static emit_typedef __P((definition *)); -static print_stat __P((int, declaration *)); +static int findtype __P((definition *, char *)); +static int undefined __P((char *)); +static void print_generic_header __P((char *, int)); +static void print_header __P((definition *)); +static void print_prog_header __P((proc_list *)); +static void print_trailer __P((void)); +static void print_ifopen __P((int, char *)); +static void print_ifarg __P((char *)); +static void print_ifsizeof __P((char *, char *)); +static void print_ifclose __P((int)); +static void print_ifstat __P((int, char *, char *, relation, char *, char *, char *)); +static void emit_program __P((definition *)); +static void emit_enum __P((definition *)); +static void emit_union __P((definition *)); +static void emit_struct __P((definition *)); +static void emit_typedef __P((definition *)); +static void print_stat __P((int, declaration *)); /* @@ -101,11 +102,16 @@ case DEF_TYPEDEF: emit_typedef(def); break; + case DEF_CONST: + case DEF_PROGRAM: + errx(1, "Internal error %s, %d: Case %d not handled\n", + __FILE__, __LINE__, def->def_kind); + break; } print_trailer(); } -static +static int findtype(def, type) definition *def; char *type; @@ -118,7 +124,7 @@ } } -static +static int undefined(type) char *type; { @@ -130,7 +136,7 @@ return (def == NULL); } -static +static void print_generic_header(procname, pointerp) char *procname; int pointerp; @@ -154,16 +160,11 @@ } } -static +static void print_header(def) definition *def; { - decl_list *dl; - bas_type *ptr; - int i; - - print_generic_header(def->def_name, def->def_kind != DEF_TYPEDEF || !isvectordef(def->def.ty.old_type, def->def.ty.rel)); @@ -178,14 +179,14 @@ } -static +static void print_prog_header(plist) proc_list *plist; { print_generic_header(plist->args.argname, 1); } -static +static void print_trailer() { f_print(fout, "\treturn (TRUE);\n"); @@ -193,7 +194,7 @@ } -static +static void print_ifopen(indent, name) int indent; char *name; @@ -202,14 +203,14 @@ f_print(fout, " if (!xdr_%s(xdrs", name); } -static +static void print_ifarg(arg) char *arg; { f_print(fout, ", %s", arg); } -static +static void print_ifsizeof(prefix, type) char *prefix; char *type; @@ -225,7 +226,7 @@ } } -static +static void print_ifclose(indent) int indent; { @@ -236,7 +237,7 @@ f_print(fout, " }\n"); } -static +static void print_ifstat(indent, prefix, type, rel, amax, objname, name) int indent; char *prefix; @@ -314,7 +315,7 @@ } /* ARGSUSED */ -static +static void emit_enum(def) definition *def; { @@ -323,7 +324,7 @@ print_ifclose(1); } -static +static void emit_program(def) definition *def; { @@ -345,7 +346,7 @@ } -static +static void emit_union(def) definition *def; { @@ -407,7 +408,7 @@ f_print(fout, "\t}\n"); } -static +static void emit_struct(def) definition *def; { @@ -514,7 +515,7 @@ } } else { - if (i > 0) + if (i > 0) { if (sizestr == NULL && size < doinline) { /* don't expand into inline * code if size < doinline */ @@ -559,6 +560,7 @@ f_print(fout, "\t }\n"); } + } size = 0; i = 0; sizestr = NULL; @@ -566,7 +568,7 @@ } } - if (i > 0) + if (i > 0) { if (sizestr == NULL && size < doinline) { /* don't expand into inline code if size < * doinline */ @@ -610,6 +612,7 @@ } flag = GET; + } } f_print(fout, "\t return(TRUE);\n\t}\n\n"); @@ -619,7 +622,7 @@ print_stat(1, &dl->decl); } -static +static void emit_typedef(def) definition *def; { @@ -632,7 +635,7 @@ print_ifstat(1, prefix, type, rel, amax, "objp", def->def_name); } -static +static void print_stat(indent, dec) declaration *dec; int indent; @@ -655,6 +658,7 @@ char *upcase __P((char *)); +void emit_inline(decl, flag) declaration *decl; int flag; @@ -672,10 +676,15 @@ decl->name, decl->array_max); emit_single_in_line(decl, flag, REL_VECTOR); f_print(fout, "\t\t }\n\t\t };\n"); + case REL_ARRAY: + case REL_POINTER: + errx(1, "Internal error %s, %d: Case %d not handled\n", + __FILE__, __LINE__, decl->rel); } } +void emit_single_in_line(decl, flag, rel) declaration *decl; int flag;