From 1c445cc7e5d66881ef28860c9d43695feedf37d7 Mon Sep 17 00:00:00 2001 From: Chaskiel Grundman Date: Fri, 20 Sep 2013 10:42:20 -0400 Subject: [PATCH] Remove sunrpc compatibility Remove sunrpc compatibility from rxgen. It's not tested, and rpcgen is available from other sources. This will allow changes to be made to rxgen without worrying about their impact on rpcgen compatibility. Removals consist of the -l, -m, and -s switches, the source files rpc_clntout.c and rpc_svcout.c, and the scan tokens 'program' and 'version'. The -R switch ('R compatibility') is also removed, as it's a noop. Change-Id: I960fac14faf072d221b8cb166e9388ab4accfa26 Reviewed-on: http://gerrit.openafs.org/10258 Reviewed-by: Benjamin Kaduk Tested-by: BuildBot --- doc/man-pages/pod1/rxgen.pod | 44 ++---- src/rxgen/Makefile.in | 6 +- src/rxgen/NTMakefile | 4 +- src/rxgen/rpc_clntout.c | 125 ---------------- src/rxgen/rpc_cout.c | 4 +- src/rxgen/rpc_hout.c | 86 +---------- src/rxgen/rpc_main.c | 122 +--------------- src/rxgen/rpc_parse.c | 66 +-------- src/rxgen/rpc_parse.h | 30 ---- src/rxgen/rpc_scan.c | 2 - src/rxgen/rpc_scan.h | 2 - src/rxgen/rpc_svcout.c | 273 ----------------------------------- src/rxgen/rpc_util.c | 2 - src/rxgen/rpc_util.h | 11 -- 14 files changed, 29 insertions(+), 748 deletions(-) delete mode 100644 src/rxgen/rpc_clntout.c delete mode 100644 src/rxgen/rpc_svcout.c diff --git a/doc/man-pages/pod1/rxgen.pod b/doc/man-pages/pod1/rxgen.pod index 8548feb95..dc05a7161 100644 --- a/doc/man-pages/pod1/rxgen.pod +++ b/doc/man-pages/pod1/rxgen.pod @@ -7,15 +7,9 @@ rxgen - Stub generator for the Rx remote procedure call package =for html
-B [B<-h> | B<-c> | B<-C> | B<-S> | B<-r>] [B<-dkpR>] +B [B<-h> | B<-c> | B<-C> | B<-S> | B<-r>] [B<-dkp>] [B<-I> I] [B<-P> I] [B<-o> I] [I] -B B<-s> I [B<-o> I] [I] - -B B<-l> [B<-o> I] [I] - -B B<-m> [B<-o> I] [I] - =for html
@@ -25,11 +19,9 @@ B is a tool that generates C code to implement the Rx RPC protocol; it takes as input a description of an application interface similar to C and produces a number of server and/or client stub routines to be linked with RPC-based programs. These stubs allow programs to invoke remote -procedures through local procedure calls. B is an extension of -Sun's B (version 3.9) and retains full B functionality (at -least as of that version). Please refer to rpcgen(1) for more details on -the Sun's RPC specific flags, and to the RPC programming guide regarding -the RPC language along with useful examples. +procedures through local procedure calls. B is based on Sun's +B (version 3.9) but does not maintain compatibility with rpcgen +RPC descriptions. =head1 OPTIONS @@ -77,11 +69,6 @@ The following options can be used on any combination of B calls: =over 4 -=item B<-R> - -Generate code for the older \R protocol, as opposed to Rx, which is the -default. - =item B<-k> Must be specified when the generated code is intended to be used by the @@ -124,9 +111,6 @@ name). =back -The B<-s>, B<-l>, and B<-m> options are present only for B -support. See rpcgen(1) for information on their use. - =head1 B SYNTAX SUMMARY Specification file: @@ -854,14 +838,12 @@ Contents of the interface configuration file (F): OUT long *nentries, OUT vldb_list *linkedentries) = VLLINKEDLIST; -We'll concentrate only on the Rx generated code since the R generated code -(B<-R> option) will soon be obsolete. For a detailed description on the -Rx-related calls inside the generated stubs (i.e., rx_NewCall(), -rx_EndCall()), along with details on what happens inside certain calls -(like xdrrx_create()) please refer to the Rx documentation. Typing C will result in the creation of four files: F, -F, F and F. A closer look at -these files follows. +For a detailed description on the Rx-related calls inside the generated +stubs (i.e., rx_NewCall(), rx_EndCall()), along with details on what happens +inside certain calls (like xdrrx_create()) please refer to the Rx +documentation. Typing C will result in the creation of +four files: F, F, F and +F. A closer look at these files follows. =head3 Header file (F) @@ -1432,11 +1414,7 @@ would have been a case statement for each procedure). =head1 NOTES -B is implemented from Sun's B utility. All of the standard -B's functionality is fully maintained. Note that some active -B options that don't apply to B's purpose aren't referenced -here (i.e., B<-s>, B<-l>, B<-m> options) and the interested reader should -refer to rpcgen(1) for details. +B is implemented from Sun's B utility. When the C<%#include > feature is used make sure that you don't have any B language features (i.e. %#defines) since you'll diff --git a/src/rxgen/Makefile.in b/src/rxgen/Makefile.in index 47fde8179..8653974c3 100644 --- a/src/rxgen/Makefile.in +++ b/src/rxgen/Makefile.in @@ -9,11 +9,9 @@ include @TOP_OBJDIR@/src/config/Makefile.config include @TOP_OBJDIR@/src/config/Makefile.lwp -SRCS= rpc_main.c rpc_hout.c rpc_cout.c rpc_parse.c rpc_scan.c rpc_util.c \ - rpc_svcout.c rpc_clntout.c +SRCS= rpc_main.c rpc_hout.c rpc_cout.c rpc_parse.c rpc_scan.c rpc_util.c HDRS= rpc_util.h rpc_parse.h rpc_scan.h -OBJS= rpc_main.o rpc_hout.o rpc_cout.o rpc_parse.o rpc_scan.o rpc_util.o \ - rpc_svcout.o rpc_clntout.o +OBJS= rpc_main.o rpc_hout.o rpc_cout.o rpc_parse.o rpc_scan.o rpc_util.o all: rxgen ${TOP_INCDIR}/afs/rxgen_consts.h diff --git a/src/rxgen/NTMakefile b/src/rxgen/NTMakefile index 046077d21..95aeec6a5 100644 --- a/src/rxgen/NTMakefile +++ b/src/rxgen/NTMakefile @@ -28,9 +28,7 @@ EXEOBJS =\ $(OUT)\rpc_cout.obj \ $(OUT)\rpc_parse.obj \ $(OUT)\rpc_scan.obj \ - $(OUT)\rpc_util.obj \ - $(OUT)\rpc_svcout.obj \ - $(OUT)\rpc_clntout.obj + $(OUT)\rpc_util.obj $(EXEOBJS): $$(@B).c $(C2OBJ) $** diff --git a/src/rxgen/rpc_clntout.c b/src/rxgen/rpc_clntout.c deleted file mode 100644 index c063b2945..000000000 --- a/src/rxgen/rpc_clntout.c +++ /dev/null @@ -1,125 +0,0 @@ -/* @(#)rpc_clntout.c 1.2 87/11/24 3.9 RPCSRC */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ - -/* - * rpc_clntout.c, Client-stub outputter for the RPC protocol compiler - * Copyright (C) 1987, Sun Microsytsems, Inc. - */ -#include -#include - -#include - -#include "rpc_scan.h" -#include "rpc_parse.h" -#include "rpc_util.h" - -#define DEFAULT_TIMEOUT 25 /* in seconds */ - -/* static prototypes */ -static void write_program(definition * def); -static char *ampr(char *type); -static void printbody(proc_list * proc); - -void -write_stubs(void) -{ - list *l; - definition *def; - - f_print(fout, "\nstatic struct timeval TIMEOUT = { %d, 0 };\n", - DEFAULT_TIMEOUT); - for (l = defined; l != NULL; l = l->next) { - def = (definition *) l->val; - if (def->def_kind == DEF_PROGRAM) { - write_program(def); - } - } -} - - -static void -write_program(definition * def) -{ - version_list *vp; - proc_list *proc; - - for (vp = def->def.pr.versions; vp != NULL; vp = vp->next) { - for (proc = vp->procs; proc != NULL; proc = proc->next) { - f_print(fout, "\n"); - ptype(proc->res_prefix, proc->res_type, 1); - f_print(fout, "*\n"); - pvname(proc->proc_name, vp->vers_num); - f_print(fout, "(argp, clnt)\n"); - f_print(fout, "\t"); - ptype(proc->arg_prefix, proc->arg_type, 1); - f_print(fout, "*argp;\n"); - f_print(fout, "\tCLIENT *clnt;\n"); - f_print(fout, "{\n"); - printbody(proc); - f_print(fout, "}\n\n"); - } - } -} - -static char * -ampr(char *type) -{ - if (isvectordef(type, REL_ALIAS)) { - return (""); - } else { - return ("&"); - } -} - -static void -printbody(proc_list * proc) -{ - f_print(fout, "\tstatic "); - if (streq(proc->res_type, "void")) { - f_print(fout, "char "); - } else { - ptype(proc->res_prefix, proc->res_type, 0); - } - f_print(fout, "res;\n"); - f_print(fout, "\n"); - f_print(fout, "\tmemset(%sres, 0, sizeof(res));\n", ampr(proc->res_type)); - f_print(fout, - "\tif (clnt_call(clnt, %s, xdr_%s, argp, xdr_%s, %sres, TIMEOUT) != RPC_SUCCESS) {\n", - proc->proc_name, stringfix(proc->arg_type), - stringfix(proc->res_type), ampr(proc->res_type)); - f_print(fout, "\t\treturn (NULL);\n"); - f_print(fout, "\t}\n"); - if (streq(proc->res_type, "void")) { - f_print(fout, "\treturn ((void *)%sres);\n", ampr(proc->res_type)); - } else { - f_print(fout, "\treturn (%sres);\n", ampr(proc->res_type)); - } -} diff --git a/src/rxgen/rpc_cout.c b/src/rxgen/rpc_cout.c index 4868a0f15..d3d7df69f 100644 --- a/src/rxgen/rpc_cout.c +++ b/src/rxgen/rpc_cout.c @@ -72,7 +72,7 @@ static void print_rxifsizeof(char *prefix, char *type); void emit(definition * def) { - if (def->def_kind == DEF_PROGRAM || def->def_kind == DEF_CONST) { + if (def->def_kind == DEF_CONST) { return; } print_header(def); @@ -98,7 +98,7 @@ emit(definition * def) static int findtype(definition * def, char *type) { - if (def->def_kind == DEF_PROGRAM || def->def_kind == DEF_CONST) { + if (def->def_kind == DEF_CONST) { return (0); } else { return (streq(def->def_name, type)); diff --git a/src/rxgen/rpc_hout.c b/src/rxgen/rpc_hout.c index e4e15ac05..913507981 100644 --- a/src/rxgen/rpc_hout.c +++ b/src/rxgen/rpc_hout.c @@ -47,9 +47,6 @@ static void pconstdef(definition * def); static void pstructdef(definition * def); static void puniondef(definition * def); -static void puldefine(char *name, char *num); -static int define_printed(proc_list * stop, version_list * start); -static void pprogramdef(definition * def); static void psproc1(definition * defp, int callTconnF, char *type, char *prefix, int iomask); static void psprocdef(definition * defp); @@ -83,9 +80,6 @@ print_datadef(definition * def) case DEF_TYPEDEF: ptypedef(def); break; - case DEF_PROGRAM: - pprogramdef(def); - break; case DEF_PROC: psprocdef(def); break; @@ -95,8 +89,7 @@ print_datadef(definition * def) default: break; } - if (def->def_kind != DEF_PROGRAM && def->def_kind != DEF_CONST - && (!IsRxgenDefinition(def))) { + if (def->def_kind != DEF_CONST && (!IsRxgenDefinition(def))) { f_print(fout, "bool_t xdr_%s(XDR *xdrs, %s *objp);\n", def->def_name, def->def_name); } @@ -166,50 +159,6 @@ pdefine(char *name, char *num) f_print(fout, "#define %s %s\n", name, num); } -static void -puldefine(char *name, char *num) -{ - f_print(fout, "#define %s ((afs_uint32)%s)\n", name, num); -} - -static int -define_printed(proc_list * stop, version_list * start) -{ - version_list *vers; - proc_list *proc; - - for (vers = start; vers != NULL; vers = vers->next) { - for (proc = vers->procs; proc != NULL; proc = proc->next) { - if (proc == stop) { - return (0); - } else if (streq(proc->proc_name, stop->proc_name)) { - return (1); - } - } - } - abort(); - return 0;/* NOTREACHED */ -} - - -static void -pprogramdef(definition * def) -{ - version_list *vers; - proc_list *proc; - - puldefine(def->def_name, def->def.pr.prog_num); - for (vers = def->def.pr.versions; vers != NULL; vers = vers->next) { - puldefine(vers->vers_name, vers->vers_num); - for (proc = vers->procs; proc != NULL; proc = proc->next) { - if (!define_printed(proc, def->def.pr.versions)) { - puldefine(proc->proc_name, proc->proc_num); - } - pprocdef(proc, vers); - } - } -} - static void psproc1(definition * defp, int callTconnF, char *type, char *prefix, int iomask) @@ -283,29 +232,6 @@ psprocdef(definition * defp) psproc1(defp, 3, "afs_int32", ServerPrefix, 0xFFFFFFFF); } - -void -pprocdef(proc_list * proc, version_list * vp) -{ - f_print(fout, "extern "); - if (proc->res_prefix) { - if (streq(proc->res_prefix, "enum")) { - f_print(fout, "enum "); - } else { - f_print(fout, "struct "); - } - } - if (streq(proc->res_type, "bool")) { - f_print(fout, "bool_t *"); - } else if (streq(proc->res_type, "string")) { - f_print(fout, "char **"); - } else { - f_print(fout, "%s *", fixtype(proc->res_type)); - } - pvname(proc->proc_name, vp->vers_num); - f_print(fout, "();\n"); -} - static void penumdef(definition * def) { @@ -472,12 +398,10 @@ undefined2(char *type, char *stop) for (l = defined; l != NULL; l = l->next) { def = (definition *) l->val; - if (def->def_kind != DEF_PROGRAM) { - if (streq(def->def_name, stop)) { - return (1); - } else if (streq(def->def_name, type)) { - return (0); - } + if (streq(def->def_name, stop)) { + return (1); + } else if (streq(def->def_name, type)) { + return (0); } } return (1); diff --git a/src/rxgen/rpc_main.c b/src/rxgen/rpc_main.c index 9a517fc38..168794afd 100644 --- a/src/rxgen/rpc_main.c +++ b/src/rxgen/rpc_main.c @@ -52,9 +52,6 @@ struct commandline { int brief_flag; int cflag; int hflag; - int lflag; - int sflag; - int mflag; int Cflag; int Sflag; int rflag; @@ -121,10 +118,6 @@ static void c_output(char *infile, char *define, int extend, char *outfile, int append); static void h_output(char *infile, char *define, int extend, char *outfile, int append); -static void s_output(int argc, char *argv[], char *infile, char *define, - int extend, char *outfile, int nomain); -static void l_output(char *infile, char *define, int extend, char *outfile); -static void do_registers(int argc, char *argv[]); static int parseargs(int argc, char *argv[], struct commandline *cmd); static void C_output(char *infile, char *define, int extend, char *outfile, int append); @@ -159,9 +152,9 @@ main(int argc, char *argv[]) if (!parseargs(argc, argv, &cmd)) { f_print(stderr, "usage: %s infile\n", cmdname); f_print(stderr, - " %s [-c | -h | -l | -m | -C | -S | -r | -b | -k | -R | -p | -d | -z | -u] [-Pprefix] [-Idir] [-o outfile] [infile]\n", + " %s [-c | -h | -C | -S | -r | -b | -k | -p | -d | -z | -u] [-Pprefix] [-Idir] [-o outfile] [infile]\n", cmdname); - f_print(stderr, " %s [-s udp|tcp]* [-o outfile] [infile]\n", + f_print(stderr, " %s [-o outfile] [infile]\n", cmdname); exit(1); } @@ -173,11 +166,6 @@ main(int argc, char *argv[]) c_output(cmd.infile, "-DRPC_XDR", !EXTEND, cmd.outfile, 0); } else if (cmd.hflag) { h_output(cmd.infile, "-DRPC_HDR", !EXTEND, cmd.outfile, 0); - } else if (cmd.lflag) { - l_output(cmd.infile, "-DRPC_CLNT", !EXTEND, cmd.outfile); - } else if (cmd.sflag || cmd.mflag) { - s_output(argc, argv, cmd.infile, "-DRPC_SVC", !EXTEND, cmd.outfile, - cmd.mflag); } else if (cmd.Cflag) { OutFileFlag = NULL; C_output(cmd.infile, "-DRPC_CLIENT", !EXTEND, cmd.outfile, 1); @@ -541,90 +529,6 @@ h_output(char *infile, char *define, int extend, char *outfile, int append) } } -/* - * Compile into an RPC service - */ -static void -s_output(int argc, char *argv[], char *infile, char *define, int extend, - char *outfile, int nomain) -{ - char *include; - definition *def; - int foundprogram; - char *outfilename; - - open_input(infile, define); - outfilename = extend ? extendfile(infile, outfile) : outfile; - open_output(infile, outfilename); - f_print(fout, "#include \n"); - f_print(fout, "#include \n"); - if (infile && (include = extendfile(infile, ".h"))) { - f_print(fout, "#include \"%s\"\n", include); - free(include); - } - foundprogram = 0; - while ((def = get_definition())) { - foundprogram |= (def->def_kind == DEF_PROGRAM); - } - if (extend && !foundprogram) { - (void)unlink(outfilename); - return; - } - if (nomain) { - write_programs(NULL); - } else { - write_most(); - do_registers(argc, argv); - write_rest(); - write_programs("static"); - } -} - -static void -l_output(char *infile, char *define, int extend, char *outfile) -{ - char *include; - definition *def; - int foundprogram; - char *outfilename; - - open_input(infile, define); - outfilename = extend ? extendfile(infile, outfile) : outfile; - open_output(infile, outfilename); - f_print(fout, "#include \n"); - f_print(fout, "#include \n"); - if (infile && (include = extendfile(infile, ".h"))) { - f_print(fout, "#include \"%s\"\n", include); - free(include); - } - foundprogram = 0; - while ((def = get_definition())) { - foundprogram |= (def->def_kind == DEF_PROGRAM); - } - if (extend && !foundprogram) { - (void)unlink(outfilename); - return; - } - write_stubs(); -} - -/* - * Perform registrations for service output - */ -static void -do_registers(int argc, char *argv[]) -{ - int i; - - for (i = 1; i < argc; i++) { - if (streq(argv[i], "-s")) { - write_register(argv[i + 1]); - i++; - } - } -} - - static void C_output(char *infile, char *define, int extend, char *outfile, int append) { @@ -827,13 +731,10 @@ parseargs(int argc, char *argv[], struct commandline *cmd) case 'A': case 'c': case 'h': - case 'l': - case 'm': case 'C': case 'S': case 'b': case 'r': - case 'R': case 'k': case 'p': case 'd': @@ -847,7 +748,6 @@ parseargs(int argc, char *argv[], struct commandline *cmd) flag[(int)c] = 1; break; case 'o': - case 's': if (argv[i][j - 1] != '-' || argv[i][j + 1] != 0) { return (0); } @@ -855,16 +755,10 @@ parseargs(int argc, char *argv[], struct commandline *cmd) if (++i == argc) { return (0); } - if (c == 's') { - if (!streq(argv[i], "udp") && !streq(argv[i], "tcp")) { - return (0); - } - } else if (c == 'o') { - if (cmd->outfile) { - return (0); - } - cmd->outfile = argv[i]; + if (cmd->outfile) { + return (0); } + cmd->outfile = argv[i]; goto nextarg; case 'P': if (argv[i][j - 1] != '-') @@ -892,9 +786,6 @@ parseargs(int argc, char *argv[], struct commandline *cmd) cmd->brief_flag = brief_flag = flag['b']; cmd->cflag = cflag = flag['c']; cmd->hflag = hflag = flag['h']; - cmd->sflag = flag['s']; - cmd->lflag = flag['l']; - cmd->mflag = flag['m']; cmd->xflag = xflag = flag['x']; cmd->yflag = yflag = flag['y']; cmd->Cflag = Cflag = flag['C']; @@ -908,8 +799,7 @@ parseargs(int argc, char *argv[], struct commandline *cmd) if (cmd->pflag) combinepackages = 1; nflags = - cmd->cflag + cmd->hflag + cmd->sflag + cmd->lflag + cmd->mflag + - cmd->Cflag + cmd->Sflag + cmd->rflag; + cmd->cflag + cmd->hflag + cmd->Cflag + cmd->Sflag + cmd->rflag; if (nflags == 0) { if (cmd->outfile != NULL || cmd->infile == NULL) { return (0); diff --git a/src/rxgen/rpc_parse.c b/src/rxgen/rpc_parse.c index 3deb417cf..2a47facd3 100644 --- a/src/rxgen/rpc_parse.c +++ b/src/rxgen/rpc_parse.c @@ -82,7 +82,6 @@ int function_list_index; /* static prototypes */ static void isdefined(definition * defp); static void def_struct(definition * defp); -static void def_program(definition * defp); static void def_enum(definition * defp); static void def_const(definition * defp); static void def_union(definition * defp); @@ -177,9 +176,6 @@ get_definition(void) case TOK_ENUM: def_enum(defp); break; - case TOK_PROGRAM: - def_program(defp); - break; case TOK_CONST: def_const(defp); break; @@ -281,64 +277,6 @@ def_struct(definition * defp) STOREVAL(&complex_defined, defp); } -static void -def_program(definition * defp) -{ - token tok; - version_list *vlist; - version_list **vtailp; - proc_list *plist; - proc_list **ptailp; - - defp->def_kind = DEF_PROGRAM; - scan(TOK_IDENT, &tok); - defp->def_name = tok.str; - scan(TOK_LBRACE, &tok); - vtailp = &defp->def.pr.versions; - scan(TOK_VERSION, &tok); - do { - scan(TOK_IDENT, &tok); - vlist = ALLOC(version_list); - vlist->vers_name = tok.str; - scan(TOK_LBRACE, &tok); - ptailp = &vlist->procs; - do { - plist = ALLOC(proc_list); - get_type(&plist->res_prefix, &plist->res_type, DEF_PROGRAM); - if (streq(plist->res_type, "opaque")) { - error("illegal result type"); - } - scan(TOK_IDENT, &tok); - plist->proc_name = tok.str; - scan(TOK_LPAREN, &tok); - get_type(&plist->arg_prefix, &plist->arg_type, DEF_PROGRAM); - if (streq(plist->arg_type, "opaque")) { - error("illegal argument type"); - } - scan(TOK_RPAREN, &tok); - scan(TOK_EQUAL, &tok); - scan_num(&tok); - scan(TOK_SEMICOLON, &tok); - plist->proc_num = tok.str; - *ptailp = plist; - ptailp = &plist->next; - peek(&tok); - } while (tok.kind != TOK_RBRACE); - *vtailp = vlist; - vtailp = &vlist->next; - scan(TOK_RBRACE, &tok); - scan(TOK_EQUAL, &tok); - scan_num(&tok); - vlist->vers_num = tok.str; - scan(TOK_SEMICOLON, &tok); - scan2(TOK_VERSION, TOK_RBRACE, &tok); - } while (tok.kind == TOK_VERSION); - scan(TOK_EQUAL, &tok); - scan_num(&tok); - defp->def.pr.prog_num = tok.str; - *vtailp = NULL; -} - static void def_enum(definition * defp) { @@ -522,8 +460,8 @@ get_type(char **prefixp, char **typep, defkind dkind) (void)peekscan(TOK_INT, &tok); break; case TOK_VOID: - if (dkind != DEF_UNION && dkind != DEF_PROGRAM) { - error("voids allowed only inside union and program definitions"); + if (dkind != DEF_UNION) { + error("voids allowed only inside union definitions"); } *typep = tok.str; break; diff --git a/src/rxgen/rpc_parse.h b/src/rxgen/rpc_parse.h index e003ef404..a976273df 100644 --- a/src/rxgen/rpc_parse.h +++ b/src/rxgen/rpc_parse.h @@ -51,7 +51,6 @@ enum defkind { DEF_UNION, DEF_ENUM, DEF_TYPEDEF, - DEF_PROGRAM }; typedef enum defkind defkind; @@ -123,34 +122,6 @@ struct union_def { }; typedef struct union_def union_def; - - -struct proc_list { - char *proc_name; - char *proc_num; - char *arg_type; - char *arg_prefix; - char *res_type; - char *res_prefix; - struct proc_list *next; -}; -typedef struct proc_list proc_list; - - -struct version_list { - char *vers_name; - char *vers_num; - proc_list *procs; - struct version_list *next; -}; -typedef struct version_list version_list; - -struct program_def { - char *prog_num; - version_list *versions; -}; -typedef struct program_def program_def; - struct param_list { defkind param_kind; char *param_name; @@ -220,7 +191,6 @@ struct definition { union_def un; enum_def en; typedef_def ty; - program_def pr; spec_def sd; } def; procedure_def pc; diff --git a/src/rxgen/rpc_scan.c b/src/rxgen/rpc_scan.c index dc3abc051..aeb0940bc 100644 --- a/src/rxgen/rpc_scan.c +++ b/src/rxgen/rpc_scan.c @@ -403,8 +403,6 @@ static token symbols[] = { {TOK_FLOAT, "float"}, {TOK_DOUBLE, "double"}, {TOK_STRING, "string"}, - {TOK_PROGRAM, "program"}, - {TOK_VERSION, "version"}, {TOK_PACKAGE, "package"}, {TOK_PREFIX, "prefix"}, {TOK_STATINDEX, "statindex"}, diff --git a/src/rxgen/rpc_scan.h b/src/rxgen/rpc_scan.h index fbcc352f2..dee527d55 100644 --- a/src/rxgen/rpc_scan.h +++ b/src/rxgen/rpc_scan.h @@ -71,8 +71,6 @@ enum tok_kind { TOK_STRING, TOK_BOOL, TOK_VOID, - TOK_PROGRAM, - TOK_VERSION, TOK_PACKAGE, TOK_PREFIX, TOK_STATINDEX, diff --git a/src/rxgen/rpc_svcout.c b/src/rxgen/rpc_svcout.c deleted file mode 100644 index 953e06ed6..000000000 --- a/src/rxgen/rpc_svcout.c +++ /dev/null @@ -1,273 +0,0 @@ -/* @(#)rpc_svcout.c 1.2 87/11/24 3.9 RPCSRC */ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ - -/* - * rpc_svcout.c, Server-skeleton outputter for the RPC protocol compiler - * Copyright (C) 1987, Sun Microsytsems, Inc. - */ -#include -#include - -#include - -#include "rpc_scan.h" -#include "rpc_parse.h" -#include "rpc_util.h" - -static char RQSTP[] = "rqstp"; -static char TRANSP[] = "transp"; -static char ARG[] = "argument"; -static char RESULT[] = "result"; -static char ROUTINE[] = "local"; - -/* static prototypes */ -static void write_program(definition * def, char *storage); -static void printerr(char *err, char *transp); -static void printif(char *proc, char *transp, char *prefix, char *arg); - - -/* - * write most of the service, that is, everything but the registrations. - */ -void -write_most(void) -{ - list *l; - definition *def; - version_list *vp; - - for (l = defined; l != NULL; l = l->next) { - def = (definition *) l->val; - if (def->def_kind == DEF_PROGRAM) { - for (vp = def->def.pr.versions; vp != NULL; vp = vp->next) { - f_print(fout, "\nstatic void "); - pvname(def->def_name, vp->vers_num); - f_print(fout, "();"); - } - } - } - f_print(fout, "\n\n"); - f_print(fout, "main()\n"); - f_print(fout, "{\n"); - f_print(fout, "\tSVCXPRT *%s;\n", TRANSP); - f_print(fout, "\n"); - for (l = defined; l != NULL; l = l->next) { - def = (definition *) l->val; - if (def->def_kind != DEF_PROGRAM) { - continue; - } - for (vp = def->def.pr.versions; vp != NULL; vp = vp->next) { - f_print(fout, "\tpmap_unset(%s, %s);\n", def->def_name, - vp->vers_name); - } - } -} - - -/* - * write a registration for the given transport - */ -void -write_register(char *transp) -{ - list *l; - definition *def; - version_list *vp; - - f_print(fout, "\n"); - f_print(fout, "\t%s = svc%s_create(RPC_ANYSOCK", TRANSP, transp); - if (streq(transp, "tcp")) { - f_print(fout, ", 0, 0"); - } - f_print(fout, ");\n"); - f_print(fout, "\tif (%s == NULL) {\n", TRANSP); - f_print(fout, "\t\tfprintf(stderr, \"cannot create %s service.\\n\");\n", - transp); - f_print(fout, "\t\texit(1);\n"); - f_print(fout, "\t}\n"); - - for (l = defined; l != NULL; l = l->next) { - def = (definition *) l->val; - if (def->def_kind != DEF_PROGRAM) { - continue; - } - for (vp = def->def.pr.versions; vp != NULL; vp = vp->next) { - f_print(fout, "\tif (!svc_register(%s, %s, %s, ", TRANSP, - def->def_name, vp->vers_name); - pvname(def->def_name, vp->vers_num); - f_print(fout, ", IPPROTO_%s)) {\n", - streq(transp, "udp") ? "UDP" : "TCP"); - f_print(fout, - "\t\tfprintf(stderr, \"unable to register (%s, %s, %s).\\n\");\n", - def->def_name, vp->vers_name, transp); - f_print(fout, "\t\texit(1);\n"); - f_print(fout, "\t}\n"); - } - } -} - - -/* - * write the rest of the service - */ -void -write_rest(void) -{ - f_print(fout, "\tsvc_run();\n"); - f_print(fout, "\tfprintf(stderr, \"svc_run returned\\n\");\n"); - f_print(fout, "\texit(1);\n"); - f_print(fout, "}\n"); -} - -void -write_programs(char *storage) -{ - list *l; - definition *def; - - for (l = defined; l != NULL; l = l->next) { - def = (definition *) l->val; - if (def->def_kind == DEF_PROGRAM) { - write_program(def, storage); - } - } -} - - -static void -write_program(definition * def, char *storage) -{ - version_list *vp; - proc_list *proc; - int filled; - - for (vp = def->def.pr.versions; vp != NULL; vp = vp->next) { - f_print(fout, "\n"); - if (storage != NULL) { - f_print(fout, "%s ", storage); - } - f_print(fout, "void\n"); - pvname(def->def_name, vp->vers_num); - f_print(fout, "(%s, %s)\n", RQSTP, TRANSP); - f_print(fout, " struct svc_req *%s;\n", RQSTP); - f_print(fout, " SVCXPRT *%s;\n", TRANSP); - f_print(fout, "{\n"); - - filled = 0; - f_print(fout, "\tunion {\n"); - for (proc = vp->procs; proc != NULL; proc = proc->next) { - if (streq(proc->arg_type, "void")) { - continue; - } - filled = 1; - f_print(fout, "\t\t"); - ptype(proc->arg_prefix, proc->arg_type, 0); - pvname(proc->proc_name, vp->vers_num); - f_print(fout, "_arg;\n"); - } - if (!filled) { - f_print(fout, "\t\tint fill;\n"); - } - f_print(fout, "\t} %s;\n", ARG); - f_print(fout, "\tchar *%s;\n", RESULT); - f_print(fout, "\tbool_t (*xdr_%s)(), (*xdr_%s)();\n", ARG, RESULT); - f_print(fout, "\tchar *(*%s)();\n", ROUTINE); - f_print(fout, "\n"); - f_print(fout, "\tswitch (%s->rq_proc) {\n", RQSTP); - - if (!nullproc(vp->procs)) { - f_print(fout, "\tcase NULLPROC:\n"); - f_print(fout, "\t\tsvc_sendreply(%s, xdr_void, NULL);\n", TRANSP); - f_print(fout, "\t\treturn;\n\n"); - } - for (proc = vp->procs; proc != NULL; proc = proc->next) { - f_print(fout, "\tcase %s:\n", proc->proc_name); - f_print(fout, "\t\txdr_%s = xdr_%s;\n", ARG, - stringfix(proc->arg_type)); - f_print(fout, "\t\txdr_%s = xdr_%s;\n", RESULT, - stringfix(proc->res_type)); - f_print(fout, "\t\t%s = (char *(*)()) ", ROUTINE); - pvname(proc->proc_name, vp->vers_num); - f_print(fout, ";\n"); - f_print(fout, "\t\tbreak;\n\n"); - } - f_print(fout, "\tdefault:\n"); - printerr("noproc", TRANSP); - f_print(fout, "\t\treturn;\n"); - f_print(fout, "\t}\n"); - - f_print(fout, "\tmemset(&%s, 0, sizeof(%s));\n", ARG, ARG); - printif("getargs", TRANSP, "&", ARG); - printerr("decode", TRANSP); - f_print(fout, "\t\treturn;\n"); - f_print(fout, "\t}\n"); - - f_print(fout, "\t%s = (*%s)(&%s, %s);\n", RESULT, ROUTINE, ARG, - RQSTP); - f_print(fout, - "\tif (%s != NULL && !svc_sendreply(%s, xdr_%s, %s)) {\n", - RESULT, TRANSP, RESULT, RESULT); - printerr("systemerr", TRANSP); - f_print(fout, "\t}\n"); - - printif("freeargs", TRANSP, "&", ARG); - f_print(fout, - "\t\tfprintf(stderr, \"unable to free arguments\\n\");\n"); - f_print(fout, "\t\texit(1);\n"); - f_print(fout, "\t}\n"); - - f_print(fout, "}\n\n"); - } -} - -static void -printerr(char *err, char *transp) -{ - f_print(fout, "\t\tsvcerr_%s(%s);\n", err, transp); -} - -static void -printif(char *proc, char *transp, char *prefix, char *arg) -{ - f_print(fout, "\tif (!svc_%s(%s, xdr_%s, %s%s)) {\n", proc, transp, arg, - prefix, arg); -} - - -int -nullproc(proc_list * proc) -{ - for (; proc != NULL; proc = proc->next) { - if (streq(proc->proc_num, "0")) { - return (1); - } - } - return (0); -} diff --git a/src/rxgen/rpc_util.c b/src/rxgen/rpc_util.c index d79813dfb..203fda2db 100644 --- a/src/rxgen/rpc_util.c +++ b/src/rxgen/rpc_util.c @@ -373,8 +373,6 @@ static token tokstrings[] = { {TOK_OPAQUE, "opaque"}, {TOK_BOOL, "bool"}, {TOK_VOID, "void"}, - {TOK_PROGRAM, "program"}, - {TOK_VERSION, "version"}, {TOK_PACKAGE, "package"}, {TOK_PREFIX, "prefix"}, {TOK_STATINDEX, "statindex"}, diff --git a/src/rxgen/rpc_util.h b/src/rxgen/rpc_util.h index 2e316eaf9..4382d3f54 100644 --- a/src/rxgen/rpc_util.h +++ b/src/rxgen/rpc_util.h @@ -102,9 +102,6 @@ extern void tabify(FILE * f, int tab); #define FINDVAL(list,item,finder) \ findval(list, (char *) item, finder) -/* rpc_clntout.c */ -extern void write_stubs(void); - /* rpc_cout.c */ extern void emit(definition * def); extern void print_param(declaration * dec); @@ -112,7 +109,6 @@ extern void print_param(declaration * dec); /* rpc_hout.c */ extern void print_datadef(definition * def); extern void pdefine(char *name, char *num); -extern void pprocdef(proc_list * proc, version_list * vp); /* rpc_parse.c */ extern list *proc_defined[MAX_PACKAGES], *special_defined, *typedef_defined, @@ -154,13 +150,6 @@ extern int IsRxgenDefinition(definition * def); extern proc1_list *Proc_list, **Proc_listp; -/* rpc_svcout.c */ -extern int nullproc(proc_list * proc); -extern void write_programs(char *storage); -extern void write_rest(void); -extern void write_most(void); -extern void write_register(char *transp); - /* rpc_scan.c */ extern int pushed; extern token lasttok; -- 2.39.5