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 */
*** 114,220 **** bool_t oneway = streq(proc->res_type, "oneway"); decl_list *l; 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); if (mtflag) { /* Generate result field */ f_print(fout, "*argp, "); if (!oneway) { ! ptype(proc->res_prefix, ! proc->res_type, 1); f_print(fout, "*%s, ", result); } ! f_print(fout, "%s%s)\n", ! addargtype, addargname); } else ! f_print(fout, "*argp, %s%s)\n", ! addargtype, addargname); ! } else { ! if (!mtflag) ! f_print(fout, "(argp, %s)\n", addargname); ! else { ! f_print(fout, "(argp, "); ! if (!oneway) { ! 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 (mtflag && !oneway) { ! f_print(fout, "\t"); ! ptype(proc->res_prefix, proc->res_type, 1); ! f_print(fout, "*%s;\n", result); ! } ! } } else if (streq(proc->args.decls->decl.type, "void")) { /* newstyle, 0 argument */ if (mtflag) { f_print(fout, "("); - if (Cflag) { if (!oneway) { ! ptype(proc->res_prefix, ! proc->res_type, 1); f_print(fout, "*%s, ", result); } ! f_print(fout, "%s%s)\n", ! addargtype, addargname); ! } else ! f_print(fout, "(%s)\n", addargname); } else - if (Cflag) f_print(fout, "(%s%s)\n", addargtype, addargname); - else - f_print(fout, "(%s)\n", addargname); } else { /* new style, 1 or multiple arguments */ - if (!Cflag) { f_print(fout, "("); - for (l = proc->args.decls; l != NULL; l = l->next) - f_print(fout, "%s, ", l->decl.name); - if (mtflag && !oneway) - f_print(fout, "%s, ", result); - - f_print(fout, "%s)\n", addargname); for (l = proc->args.decls; l != NULL; l = l->next) { ! pdeclaration(proc->args.argname, ! &l->decl, 1, ";\n"); } if (mtflag && !oneway) { - f_print(fout, "\t"); ptype(proc->res_prefix, proc->res_type, 1); - f_print(fout, "*%s;\n", result); - } - - } else { /* C++ style header */ - f_print(fout, "("); - for (l = proc->args.decls; l != NULL; l = l->next) { - pdeclaration(proc->args.argname, &l->decl, 0, - ", "); - } - if (mtflag && !oneway) { - ptype(proc->res_prefix, proc->res_type, 1); f_print(fout, "*%s, ", result); } f_print(fout, "%s%s)\n", addargtype, addargname); } - } - - if (!Cflag) - f_print(fout, "\t%s%s;\n", addargtype, addargname); } static char * --- 116,164 ---- bool_t oneway = streq(proc->res_type, "oneway"); decl_list *l; if (!newstyle) { /* old style: always pass argument by reference */ f_print(fout, "("); ptype(proc->args.decls->decl.prefix, proc->args.decls->decl.type, 1); if (mtflag) { /* Generate result field */ f_print(fout, "*argp, "); if (!oneway) { ! ptype(proc->res_prefix, proc->res_type, 1); f_print(fout, "*%s, ", result); } ! f_print(fout, "%s%s)\n", addargtype, addargname); } else ! f_print(fout, "*argp, %s%s)\n", addargtype, addargname); } else if (streq(proc->args.decls->decl.type, "void")) { /* newstyle, 0 argument */ if (mtflag) { f_print(fout, "("); if (!oneway) { ! ptype(proc->res_prefix, proc->res_type, 1); f_print(fout, "*%s, ", result); } ! f_print(fout, "%s%s)\n", addargtype, addargname); } else f_print(fout, "(%s%s)\n", addargtype, addargname); } else { /* new style, 1 or multiple arguments */ f_print(fout, "("); for (l = proc->args.decls; l != NULL; l = l->next) { ! pdeclaration(proc->args.argname, &l->decl, 0, ", "); } if (mtflag && !oneway) { ptype(proc->res_prefix, proc->res_type, 1); f_print(fout, "*%s, ", result); } f_print(fout, "%s%s)\n", addargtype, addargname); } } static char *