Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/rpcgen - remove support for pre-ansi output
details: https://anonhg.NetBSD.org/src/rev/d2a3a1b840e7
branches: trunk
changeset: 325243:d2a3a1b840e7
user: christos <christos%NetBSD.org@localhost>
date: Sun Dec 15 00:40:17 2013 +0000
description:
- remove support for pre-ansi output
- add -B (BSD) support for c++ output macros
- group functions to make output better looking
diffstat:
usr.bin/rpcgen/rpc_clntout.c | 104 ++++-------------
usr.bin/rpcgen/rpc_cout.c | 61 ++++------
usr.bin/rpcgen/rpc_hout.c | 212 +++++++++++++++++++++----------------
usr.bin/rpcgen/rpc_main.c | 86 +++++++-------
usr.bin/rpcgen/rpc_parse.c | 28 ++--
usr.bin/rpcgen/rpc_sample.c | 21 +--
usr.bin/rpcgen/rpc_scan.c | 22 +-
usr.bin/rpcgen/rpc_svcout.c | 243 +++++++++++++-----------------------------
usr.bin/rpcgen/rpc_tblout.c | 8 +-
usr.bin/rpcgen/rpc_util.c | 18 +-
usr.bin/rpcgen/rpc_util.h | 90 ++++++++-------
usr.bin/rpcgen/rpcgen.1 | 14 +-
12 files changed, 391 insertions(+), 516 deletions(-)
diffs (truncated from 1499 to 300 lines):
diff -r f2c0d34d239b -r d2a3a1b840e7 usr.bin/rpcgen/rpc_clntout.c
--- a/usr.bin/rpcgen/rpc_clntout.c Sun Dec 15 00:28:45 2013 +0000
+++ b/usr.bin/rpcgen/rpc_clntout.c Sun Dec 15 00:40:17 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rpc_clntout.c,v 1.14 2013/08/11 08:03:10 dholland Exp $ */
+/* $NetBSD: rpc_clntout.c,v 1.15 2013/12/15 00:40:17 christos Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
* unrestricted use provided that this legend is included on all tape
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)rpc_clntout.c 1.11 89/02/22 (C) 1987 SMI";
#else
-__RCSID("$NetBSD: rpc_clntout.c,v 1.14 2013/08/11 08:03:10 dholland Exp $");
+__RCSID("$NetBSD: rpc_clntout.c,v 1.15 2013/12/15 00:40:17 christos Exp $");
#endif
#endif
@@ -53,10 +53,10 @@
#include "rpc_parse.h"
#include "rpc_util.h"
-static void write_program __P((definition *));
-static const char *ampr __P((const char *));
-static const char *aster __P((const char *));
-static void printbody __P((proc_list *));
+static void write_program(definition *);
+static const char *ampr(const char *);
+static const char *aster(const char *);
+static void printbody(proc_list *);
#define DEFAULT_TIMEOUT 25 /* in seconds */
static char RESULT[] = "clnt_res";
@@ -119,84 +119,36 @@
if (!newstyle) { /* old style: always pass argument by
* reference */
- if (Cflag) { /* C++ style heading */
- f_print(fout, "(");
- ptype(proc->args.decls->decl.prefix, proc->args.decls->decl.type, 1);
- f_print(fout, "*argp, ");
- if (Mflag) {
- if (streq(proc->res_type, "void"))
- f_print(fout, "char ");
- else
- ptype(proc->res_prefix, proc->res_type, 0);
- f_print(fout, "%s%s, ", aster(proc->res_type),
- result);
- }
- f_print(fout, "%s%s)\n", addargtype, addargname);
- } else {
- f_print(fout, "(argp, ");
- if (Mflag)
- f_print(fout, "%s, ", result);
- f_print(fout, "%s)\n", addargname);
- f_print(fout, "\t");
- ptype(proc->args.decls->decl.prefix, proc->args.decls->decl.type, 1);
- f_print(fout, "*argp;\n");
- if (Mflag) {
- f_print(fout, "\t");
- if (streq(proc->res_type, "void"))
- f_print(fout, "char ");
- else
- ptype(proc->res_prefix, proc->res_type, 0);
- f_print(fout, "%s%s;\n", aster(proc->res_type),
- result);
- }
+ f_print(fout, "(");
+ ptype(proc->args.decls->decl.prefix, proc->args.decls->decl.type, 1);
+ f_print(fout, "*argp, ");
+ if (Mflag) {
+ if (streq(proc->res_type, "void"))
+ f_print(fout, "char ");
+ else
+ ptype(proc->res_prefix, proc->res_type, 0);
+ f_print(fout, "%s%s, ", aster(proc->res_type),
+ result);
}
+ f_print(fout, "%s%s)\n", addargtype, addargname);
} else {
f_print(fout, "(");
if (!streq(proc->args.decls->decl.type, "void")) {
/* new style, 1 or multiple arguments */
- if (!Cflag) {
- for (l = proc->args.decls; l != NULL;
- l = l->next)
- f_print(fout, "%s, ", l->decl.name);
- } else {/* C++ style header */
- for (l = proc->args.decls; l != NULL;
- l = l->next)
- pdeclaration(proc->args.argname,
- &l->decl, 0, ", ");
- }
+ for (l = proc->args.decls; l != NULL; l = l->next)
+ pdeclaration(proc->args.argname,
+ &l->decl, 0, ", ");
}
- if (!Cflag) {
- if (Mflag) {
- f_print(fout, "\t");
- if (streq(proc->res_type, "void"))
- f_print(fout, "char ");
- else
- ptype(proc->res_prefix, proc->res_type, 0);
- f_print(fout, "%s%s;\n", aster(proc->res_type),
- result);
- }
- f_print(fout, "%s)\n", addargname);
- if (!streq(proc->args.decls->decl.type, "void")) {
- for (l = proc->args.decls; l != NULL;
- l = l->next)
- pdeclaration(proc->args.argname,
- &l->decl, 1, ";\n");
- }
- } else {
- if (Mflag) {
- if (streq(proc->res_type, "void"))
- f_print(fout, "char ");
- else
- ptype(proc->res_prefix, proc->res_type, 0);
- f_print(fout, "%s%s, ", aster(proc->res_type),
- result);
- }
- f_print(fout, "%s%s)\n", addargtype, addargname);
+ if (Mflag) {
+ if (streq(proc->res_type, "void"))
+ f_print(fout, "char ");
+ else
+ ptype(proc->res_prefix, proc->res_type, 0);
+ f_print(fout, "%s%s, ", aster(proc->res_type),
+ result);
}
+ f_print(fout, "%s%s)\n", addargtype, addargname);
}
-
- if (!Cflag)
- f_print(fout, "\t%s%s;\n", addargtype, addargname);
}
diff -r f2c0d34d239b -r d2a3a1b840e7 usr.bin/rpcgen/rpc_cout.c
--- a/usr.bin/rpcgen/rpc_cout.c Sun Dec 15 00:28:45 2013 +0000
+++ b/usr.bin/rpcgen/rpc_cout.c Sun Dec 15 00:40:17 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rpc_cout.c,v 1.32 2013/08/12 20:36:30 christos Exp $ */
+/* $NetBSD: rpc_cout.c,v 1.33 2013/12/15 00:40:17 christos Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
* unrestricted use provided that this legend is included on all tape
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)rpc_cout.c 1.13 89/02/22 (C) 1987 SMI";
#else
-__RCSID("$NetBSD: rpc_cout.c,v 1.32 2013/08/12 20:36:30 christos Exp $");
+__RCSID("$NetBSD: rpc_cout.c,v 1.33 2013/12/15 00:40:17 christos Exp $");
#endif
#endif
@@ -54,24 +54,24 @@
#include "rpc_parse.h"
#include "rpc_util.h"
-static int findtype __P((definition *, const char *));
-static int undefined __P((const char *));
-static void print_generic_header __P((const 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, const char *));
-static void print_ifarg __P((const char *));
-static void print_ifsizeof __P((const char *, const char *));
-static void print_ifclose __P((int));
-static void print_ifstat __P((int, const char *, const char *, relation,
- const char *, const char *, const char *));
-static void emit_enum __P((definition *));
-static void emit_program __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 *));
+static int findtype(definition *, const char *);
+static int undefined(const char *);
+static void print_generic_header(const char *, int);
+static void print_header(definition *);
+static void print_prog_header(proc_list *);
+static void print_trailer(void);
+static void print_ifopen(int, const char *);
+static void print_ifarg(const char *);
+static void print_ifsizeof(const char *, const char *);
+static void print_ifclose(int);
+static void print_ifstat(int, const char *, const char *, relation,
+ const char *, const char *, const char *);
+static void emit_enum(definition *);
+static void emit_program(definition *);
+static void emit_union(definition *);
+static void emit_struct(definition *);
+static void emit_typedef(definition *);
+static void print_stat(int, declaration *);
/*
* Emit the C-routine for the given definition
@@ -146,21 +146,12 @@
{
f_print(fout, "\n");
f_print(fout, "bool_t\n");
- if (Cflag) {
- f_print(fout, "xdr_%s(", procname);
- f_print(fout, "XDR *xdrs, ");
- f_print(fout, "%s ", procname);
- if (pointerp)
- f_print(fout, "*");
- f_print(fout, "objp)\n{\n");
- } else {
- f_print(fout, "xdr_%s(xdrs, objp)\n", procname);
- f_print(fout, "\tXDR *xdrs;\n");
- f_print(fout, "\t%s ", procname);
- if (pointerp)
- f_print(fout, "*");
- f_print(fout, "objp;\n{\n");
- }
+ f_print(fout, "xdr_%s(", procname);
+ f_print(fout, "XDR *xdrs, ");
+ f_print(fout, "%s ", procname);
+ if (pointerp)
+ f_print(fout, "*");
+ f_print(fout, "objp)\n{\n");
}
static void
diff -r f2c0d34d239b -r d2a3a1b840e7 usr.bin/rpcgen/rpc_hout.c
--- a/usr.bin/rpcgen/rpc_hout.c Sun Dec 15 00:28:45 2013 +0000
+++ b/usr.bin/rpcgen/rpc_hout.c Sun Dec 15 00:40:17 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rpc_hout.c,v 1.21 2013/08/11 08:03:10 dholland Exp $ */
+/* $NetBSD: rpc_hout.c,v 1.22 2013/12/15 00:40:17 christos Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
* unrestricted use provided that this legend is included on all tape
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)rpc_hout.c 1.12 89/02/22 (C) 1987 SMI";
#else
-__RCSID("$NetBSD: rpc_hout.c,v 1.21 2013/08/11 08:03:10 dholland Exp $");
+__RCSID("$NetBSD: rpc_hout.c,v 1.22 2013/12/15 00:40:17 christos Exp $");
#endif
#endif
@@ -52,17 +52,19 @@
#include "rpc_parse.h"
#include "rpc_util.h"
-static void pconstdef __P((definition *));
-static void pargdef __P((definition *));
-static void pstructdef __P((definition *));
-static void puniondef __P((definition *));
-static void pdefine __P((const char *, const char *));
-static void puldefine __P((const char *, const char *));
-static int define_printed __P((proc_list *, version_list *));
-static void pprogramdef __P((definition *));
-static void penumdef __P((definition *));
-static void ptypedef __P((definition *));
-static int undefined2 __P((const char *, const char *));
+static void pconstdef(definition *);
+static void pargdef(definition *);
+static void pstructdef(definition *);
+static void puniondef(definition *);
+static void pdefine(const char *, const char *);
+static void puldefine(const char *, const char *);
+static int define_printed(proc_list *, version_list *);
+static void pprogramdef(definition *);
+static void penumdef(definition *);
+static void ptypedef(definition *);
+static int undefined2(const char *, const char *);
+static void cplusplusstart(void);
+static void cplusplusend(void);
/*
* Print the C-version of an xdr definition
@@ -97,17 +99,10 @@
pconstdef(def);
break;
}
- if (def->def_kind != DEF_PROGRAM && def->def_kind != DEF_CONST) {
- pxdrfuncdecl(def->def_name,
- def->def_kind != DEF_TYPEDEF ||
- !isvectordef(def->def.ty.old_type, def->def.ty.rel));
-
- }
}
-
void
-print_funcdef(definition *def)
+print_progdef(definition *def)
{
switch (def->def_kind) {
case DEF_PROGRAM:
@@ -124,20 +119,41 @@
}
Home |
Main Index |
Thread Index |
Old Index