Print this page
rpcgen should only produce ANSI code

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/rpcgen/rpc_clntout.c
          +++ new/usr/src/cmd/rpcgen/rpc_clntout.c
↓ open down ↓ 12 lines elided ↑ open up ↑
  13   13   * When distributing Covered Code, include this CDDL HEADER in each
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  
  22   22  /*
       23 + * Copyright 2014 Garrett D'Amore <garrett@damore.org>
       24 + *
  23   25   * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  24   26   * Use is subject to license terms.
  25   27   */
  26   28  /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
  27   29  /* All Rights Reserved */
  28   30  /*
  29   31   * University Copyright- Copyright (c) 1982, 1986, 1988
  30   32   * The Regents of the University of California
  31   33   * All Rights Reserved
  32   34   *
↓ open down ↓ 76 lines elided ↑ open up ↑
 109  111  /* sample addargname = "clnt"; sample addargtype = "CLIENT * " */
 110  112  
 111  113  void
 112  114  printarglist(proc_list *proc, char *result, char *addargname, char *addargtype)
 113  115  {
 114  116          bool_t oneway = streq(proc->res_type, "oneway");
 115  117          decl_list *l;
 116  118  
 117  119          if (!newstyle) {
 118  120                  /* old style: always pass argument by reference */
 119      -                if (Cflag) {    /* C++ style heading */
 120      -                        f_print(fout, "(");
 121      -                        ptype(proc->args.decls->decl.prefix,
 122      -                            proc->args.decls->decl.type, 1);
      121 +                f_print(fout, "(");
      122 +                ptype(proc->args.decls->decl.prefix,
      123 +                    proc->args.decls->decl.type, 1);
 123  124  
 124      -                        if (mtflag) {   /* Generate result field */
 125      -                                f_print(fout, "*argp, ");
 126      -                                if (!oneway) {
 127      -                                        ptype(proc->res_prefix,
 128      -                                            proc->res_type, 1);
 129      -                                        f_print(fout, "*%s, ", result);
 130      -                                }
 131      -                                f_print(fout, "%s%s)\n",
 132      -                                    addargtype, addargname);
 133      -                        } else
 134      -                                f_print(fout, "*argp, %s%s)\n",
 135      -                                    addargtype, addargname);
 136      -                } else {
 137      -                        if (!mtflag)
 138      -                                f_print(fout, "(argp, %s)\n", addargname);
 139      -                        else {
 140      -                                f_print(fout, "(argp, ");
 141      -                                if (!oneway) {
 142      -                                        f_print(fout, "%s, ",
 143      -                                            result);
 144      -                                }
 145      -                                f_print(fout, "%s)\n",
 146      -                                    addargname);
 147      -                        }
 148      -                        f_print(fout, "\t");
 149      -                        ptype(proc->args.decls->decl.prefix,
 150      -                            proc->args.decls->decl.type, 1);
 151      -                        f_print(fout, "*argp;\n");
 152      -                        if (mtflag && !oneway) {
 153      -                                f_print(fout, "\t");
      125 +                if (mtflag) {   /* Generate result field */
      126 +                        f_print(fout, "*argp, ");
      127 +                        if (!oneway) {
 154  128                                  ptype(proc->res_prefix, proc->res_type, 1);
 155      -                                f_print(fout, "*%s;\n", result);
      129 +                                f_print(fout, "*%s, ", result);
 156  130                          }
 157      -                }
      131 +                        f_print(fout, "%s%s)\n", addargtype, addargname);
      132 +                } else
      133 +                        f_print(fout, "*argp, %s%s)\n", addargtype, addargname);
 158  134          } else if (streq(proc->args.decls->decl.type, "void")) {
 159  135                  /* newstyle, 0 argument */
 160  136                  if (mtflag) {
 161  137                          f_print(fout, "(");
 162  138  
 163      -                        if (Cflag) {
 164      -                                if (!oneway) {
 165      -                                        ptype(proc->res_prefix,
 166      -                                            proc->res_type, 1);
 167      -                                        f_print(fout, "*%s, ", result);
 168      -                                }
 169      -                                f_print(fout, "%s%s)\n",
 170      -                                    addargtype, addargname);
 171      -                        } else
 172      -                                f_print(fout, "(%s)\n", addargname);
      139 +                        if (!oneway) {
      140 +                                ptype(proc->res_prefix, proc->res_type, 1);
      141 +                                f_print(fout, "*%s, ", result);
      142 +                        }
      143 +                        f_print(fout, "%s%s)\n", addargtype, addargname);
 173  144  
 174  145                  } else
 175      -                if (Cflag)
 176  146                          f_print(fout, "(%s%s)\n", addargtype, addargname);
 177      -                else
 178      -                        f_print(fout, "(%s)\n", addargname);
 179  147          } else {
 180  148                  /* new style, 1 or multiple arguments */
 181      -                if (!Cflag) {
 182      -                        f_print(fout, "(");
 183      -                        for (l = proc->args.decls;  l != NULL; l = l->next)
 184      -                                f_print(fout, "%s, ", l->decl.name);
 185      -                        if (mtflag && !oneway)
 186      -                                f_print(fout, "%s, ", result);
      149 +                f_print(fout, "(");
      150 +                for (l = proc->args.decls; l != NULL; l = l->next) {
      151 +                        pdeclaration(proc->args.argname, &l->decl, 0, ", ");
      152 +                }
      153 +                if (mtflag && !oneway) {
      154 +                        ptype(proc->res_prefix, proc->res_type, 1);
      155 +                        f_print(fout, "*%s, ", result);
 187  156  
 188      -                        f_print(fout, "%s)\n", addargname);
 189      -                        for (l = proc->args.decls; l != NULL; l = l->next) {
 190      -                                pdeclaration(proc->args.argname,
 191      -                                    &l->decl, 1, ";\n");
 192      -                        }
 193      -                        if (mtflag && !oneway) {
 194      -                                f_print(fout, "\t");
 195      -                                ptype(proc->res_prefix, proc->res_type, 1);
 196      -                                f_print(fout, "*%s;\n", result);
 197      -                        }
 198      -
 199      -                } else {        /* C++ style header */
 200      -                        f_print(fout, "(");
 201      -                        for (l = proc->args.decls; l != NULL; l = l->next) {
 202      -                                pdeclaration(proc->args.argname, &l->decl, 0,
 203      -                                    ", ");
 204      -                        }
 205      -                        if (mtflag && !oneway) {
 206      -                                ptype(proc->res_prefix, proc->res_type, 1);
 207      -                                f_print(fout, "*%s, ", result);
 208      -
 209      -                        }
 210      -                        f_print(fout, "%s%s)\n", addargtype, addargname);
 211  157                  }
      158 +                f_print(fout, "%s%s)\n", addargtype, addargname);
 212  159          }
 213      -
 214      -        if (!Cflag)
 215      -                f_print(fout, "\t%s%s;\n", addargtype, addargname);
 216  160  }
 217  161  
 218  162  
 219  163  
 220  164  static char *
 221  165  ampr(char *type)
 222  166  {
 223  167          if (isvectordef(type, REL_ALIAS)) {
 224  168                  return ("");
 225  169          } else {
↓ open down ↓ 217 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX