Print this page
rpcgen should only produce ANSI code


   3  *
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*


  23  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.
  25  */
  26 /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
  27 /* All Rights Reserved */
  28 /*
  29  * University Copyright- Copyright (c) 1982, 1986, 1988
  30  * The Regents of the University of California
  31  * All Rights Reserved
  32  *
  33  * University Acknowledgment- Portions of this document are derived from
  34  * software developed by the University of California, Berkeley, and its
  35  * contributors.
  36  */
  37 
  38 /*
  39  * rpc_cout.c, XDR routine outputter for the RPC protocol compiler
  40  */
  41 #include <stdio.h>
  42 #include <stdlib.h>


 109         if (def->def_kind == DEF_PROGRAM || def->def_kind == DEF_CONST)
 110                 return (0);
 111         return (streq(def->def_name, type));
 112 }
 113 
 114 static int
 115 undefined(char *type)
 116 {
 117         definition *def;
 118 
 119         def = (definition *)FINDVAL(defined, type, findtype);
 120         return (def == NULL);
 121 }
 122 
 123 
 124 static void
 125 print_generic_header(char *procname, int pointerp)
 126 {
 127         f_print(fout, "\n");
 128         f_print(fout, "bool_t\n");
 129         if (Cflag) {
 130                 f_print(fout, "xdr_%s(", procname);
 131                 f_print(fout, "XDR *xdrs, ");
 132                 f_print(fout, "%s ", procname);
 133                 if (pointerp)
 134                         f_print(fout, "*");
 135                 f_print(fout, "objp)\n{\n\n");
 136         } else {
 137                 f_print(fout, "xdr_%s(xdrs, objp)\n", procname);
 138                 f_print(fout, "\tXDR *xdrs;\n");
 139                 f_print(fout, "\t%s ", procname);
 140                 if (pointerp)
 141                         f_print(fout, "*");
 142                 f_print(fout, "objp;\n{\n\n");
 143         }
 144 }
 145 
 146 static void
 147 print_header(definition *def)
 148 {
 149         print_generic_header(def->def_name,
 150             def->def_kind != DEF_TYPEDEF ||
 151             !isvectordef(def->def.ty.old_type, def->def.ty.rel));
 152         /* Now add Inline support */
 153 
 154         if (inlinelen == 0)
 155                 return;
 156         /* May cause lint to complain. but  ... */
 157         f_print(fout, "\trpc_inline_t *buf;\n\n");
 158 }
 159 
 160 static void
 161 print_prog_header(proc_list *plist)
 162 {
 163         print_generic_header(plist->args.argname, 1);




   3  *
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright 2014 Garrett D'Amore <garrett@damore.org>
  24  *
  25  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  26  * Use is subject to license terms.
  27  */
  28 /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
  29 /* All Rights Reserved */
  30 /*
  31  * University Copyright- Copyright (c) 1982, 1986, 1988
  32  * The Regents of the University of California
  33  * All Rights Reserved
  34  *
  35  * University Acknowledgment- Portions of this document are derived from
  36  * software developed by the University of California, Berkeley, and its
  37  * contributors.
  38  */
  39 
  40 /*
  41  * rpc_cout.c, XDR routine outputter for the RPC protocol compiler
  42  */
  43 #include <stdio.h>
  44 #include <stdlib.h>


 111         if (def->def_kind == DEF_PROGRAM || def->def_kind == DEF_CONST)
 112                 return (0);
 113         return (streq(def->def_name, type));
 114 }
 115 
 116 static int
 117 undefined(char *type)
 118 {
 119         definition *def;
 120 
 121         def = (definition *)FINDVAL(defined, type, findtype);
 122         return (def == NULL);
 123 }
 124 
 125 
 126 static void
 127 print_generic_header(char *procname, int pointerp)
 128 {
 129         f_print(fout, "\n");
 130         f_print(fout, "bool_t\n");

 131         f_print(fout, "xdr_%s(", procname);
 132         f_print(fout, "XDR *xdrs, ");
 133         f_print(fout, "%s ", procname);
 134         if (pointerp)
 135                 f_print(fout, "*");
 136         f_print(fout, "objp)\n{\n\n");








 137 }
 138 
 139 static void
 140 print_header(definition *def)
 141 {
 142         print_generic_header(def->def_name,
 143             def->def_kind != DEF_TYPEDEF ||
 144             !isvectordef(def->def.ty.old_type, def->def.ty.rel));
 145         /* Now add Inline support */
 146 
 147         if (inlinelen == 0)
 148                 return;
 149         /* May cause lint to complain. but  ... */
 150         f_print(fout, "\trpc_inline_t *buf;\n\n");
 151 }
 152 
 153 static void
 154 print_prog_header(proc_list *plist)
 155 {
 156         print_generic_header(plist->args.argname, 1);