Print this page
rpcgen should only produce ANSI code

*** 18,27 **** --- 18,29 ---- * * CDDL HEADER END */ /* + * Copyright 2014 Garrett D'Amore <garrett@damore.org> + * * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ /* All Rights Reserved */
*** 42,52 **** #include <stdlib.h> #include <ctype.h> #include "rpc_parse.h" #include "rpc_util.h" ! extern void pprocdef(proc_list *, version_list *, char *, int, int); extern void pdeclaration(char *, declaration *, int, char *); static void storexdrfuncdecl(char *, int); static void pconstdef(definition *); static void pstructdef(definition *); --- 44,54 ---- #include <stdlib.h> #include <ctype.h> #include "rpc_parse.h" #include "rpc_util.h" ! extern void pprocdef(proc_list *, version_list *, char *, int); extern void pdeclaration(char *, declaration *, int, char *); static void storexdrfuncdecl(char *, int); static void pconstdef(definition *); static void pstructdef(definition *);
*** 137,151 **** } void ! print_xdr_func_def(char *name, int pointerp, int i) { - if (i == 2) - f_print(fout, "extern bool_t xdr_%s();\n", name); - else f_print(fout, "extern bool_t xdr_%s(XDR *, %s%s);\n", name, name, pointerp ? "*" : ""); } --- 139,150 ---- } void ! print_xdr_func_def(char *name, int pointerp) { f_print(fout, "extern bool_t xdr_%s(XDR *, %s%s);\n", name, name, pointerp ? "*" : ""); }
*** 260,286 **** abort(); /* NOTREACHED */ } static void ! pfreeprocdef(char *name, char *vers, int mode) { f_print(fout, "extern int "); pvname(name, vers); - if (mode == 1) f_print(fout, "_freeresult(SVCXPRT *, xdrproc_t, caddr_t);\n"); - else - f_print(fout, "_freeresult();\n"); } static void pprogramdef(definition *def) { version_list *vers; proc_list *proc; - int i; - char *ext; pargdef(def); puldefine(def->def_name, def->def.pr.prog_num, PROGRAM); for (vers = def->def.pr.versions; vers != NULL; vers = vers->next) { --- 259,280 ---- abort(); /* NOTREACHED */ } static void ! pfreeprocdef(char *name, char *vers) { f_print(fout, "extern int "); pvname(name, vers); f_print(fout, "_freeresult(SVCXPRT *, xdrproc_t, caddr_t);\n"); } static void pprogramdef(definition *def) { version_list *vers; proc_list *proc; pargdef(def); puldefine(def->def_name, def->def.pr.prog_num, PROGRAM); for (vers = def->def.pr.versions; vers != NULL; vers = vers->next) {
*** 292,356 **** "extern int %s_%s_nproc;\n", locase(def->def_name), vers->vers_num); } puldefine(vers->vers_name, vers->vers_num, VERSION); - /* - * Print out 2 definitions, one for ANSI-C, another for - * old K & R C - */ - - if (!Cflag) { - ext = "extern "; for (proc = vers->procs; proc != NULL; proc = proc->next) { - if (!define_printed(proc, def->def.pr.versions)) - puldefine(proc->proc_name, - proc->proc_num, PROCEDURE); - f_print(fout, "%s", ext); - pprocdef(proc, vers, NULL, 0, 2); - - if (mtflag) { - f_print(fout, "%s", ext); - pprocdef(proc, vers, NULL, 1, 2); - } - } - pfreeprocdef(def->def_name, vers->vers_num, 2); - } else { - for (i = 1; i < 3; i++) { - if (i == 1) { - f_print(fout, "\n#if defined(__STDC__)" - " || defined(__cplusplus)\n"); - ext = "extern "; - } else { - f_print(fout, "\n#else /* K&R C */\n"); - ext = "extern "; - } - - for (proc = vers->procs; proc != NULL; - proc = proc->next) { if (!define_printed(proc, def->def.pr.versions)) { puldefine(proc->proc_name, proc->proc_num, PROCEDURE); } ! f_print(fout, "%s", ext); ! pprocdef(proc, vers, "CLIENT *", 0, i); ! f_print(fout, "%s", ext); ! pprocdef(proc, vers, ! "struct svc_req *", 1, i); } ! pfreeprocdef(def->def_name, vers->vers_num, i); } - f_print(fout, "#endif /* K&R C */\n"); - } - } } void ! pprocdef(proc_list *proc, version_list *vp, char *addargtype, int server_p, ! int mode) { if (mtflag) { /* Print MT style stubs */ if (server_p) f_print(fout, "bool_t "); --- 286,313 ---- "extern int %s_%s_nproc;\n", locase(def->def_name), vers->vers_num); } puldefine(vers->vers_name, vers->vers_num, VERSION); for (proc = vers->procs; proc != NULL; proc = proc->next) { if (!define_printed(proc, def->def.pr.versions)) { puldefine(proc->proc_name, proc->proc_num, PROCEDURE); } ! f_print(fout, "extern "); ! pprocdef(proc, vers, "CLIENT *", 0); ! f_print(fout, "extern "); ! pprocdef(proc, vers, "struct svc_req *", 1); } ! pfreeprocdef(def->def_name, vers->vers_num); } } void ! pprocdef(proc_list *proc, version_list *vp, char *addargtype, int server_p) { if (mtflag) { /* Print MT style stubs */ if (server_p) f_print(fout, "bool_t ");
*** 363,379 **** if (server_p) pvname_svc(proc->proc_name, vp->vers_num); else pvname(proc->proc_name, vp->vers_num); - /* - * mode 1 = ANSI-C, mode 2 = K&R C - */ - if (mode == 1) parglist(proc, addargtype); - else - f_print(fout, "();\n"); } /* print out argument list of procedure */ static void parglist(proc_list *proc, char *addargtype) --- 320,330 ----