1 /* @(#)rpc_util.h 1.5 90/08/29 (C) 1987 SMI */
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above
11 * copyright notice, this list of conditions and the following
12 * disclaimer in the documentation and/or other materials
13 * provided with the distribution.
14 * * Neither the name of Sun Microsystems, Inc. nor the names of its
15 * contributors may be used to endorse or promote products derived
16 * from this software without specific prior written permission.
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
21 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
22 * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
23 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
25 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
27 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 * rpc_util.h, Useful definitions for the RPC protocol compiler
36 #define alloc(size) malloc((unsigned)(size))
37 #define ALLOC(object) (object *) malloc(sizeof(object))
39 #define s_print (void) sprintf
40 #define f_print (void) fprintf
46 typedef struct list list
;
53 typedef struct xdrfunc xdrfunc
;
61 #define MAXLINESIZE 1024
62 extern char curline
[MAXLINESIZE
];
63 extern const char *where
;
66 extern const char *infilename
;
72 extern bas_type
*typ_list_h
;
73 extern bas_type
*typ_list_t
;
74 extern xdrfunc
*xdrfunc_head
, *xdrfunc_tail
;
77 * All the option flags
84 extern int Cflag
; /* C++ flag */
85 extern int CCflag
; /* C++ flag */
86 extern int tirpcflag
; /* flag for generating tirpc code */
87 extern int inlineflag
; /* if this is 0, then do not generate inline code */
91 * Other flags related with inetd jumpstart.
93 extern int indefinitewait
;
97 extern int nonfatalerrors
;
102 void storeval(list
**lstp
, definition
*val
);
103 #define STOREVAL(list,item) storeval(list,item)
105 definition
*findval(list
*lst
, const char *val
,
106 int (*cmp
)(const definition
*, const char *));
107 #define FINDVAL(list,item,finder) findval(list, item, finder)
109 const char *fixtype(const char *type
);
110 const char *stringfix(const char *type
);
111 char *locase(const char *str
);
112 void pvname_svc(const char *pname
, const char *vnum
);
113 void pvname(const char *pname
, const char *vnum
);
114 void ptype(const char *prefix
, const char *type
, int follow
);
115 int isvectordef(const char *type
, relation rel
);
116 int streq(const char *a
, const char *b
);
117 void error(const char *msg
);
118 void tabify(FILE *f
, int tab
);
119 void record_open(const char *file
);
120 bas_type
*find_type(const char *type
);
126 void emit(definition
*def
);
131 void print_datadef(definition
*def
);
132 void print_funcdef(definition
*def
);
135 * rpc_svcout routines
137 void write_most(const char *infile
, int netflag
, int nomain
);
138 void write_register(void);
139 void write_rest(void);
140 void write_programs(const char *storage
);
141 void write_svc_aux(int nomain
);
142 void write_inetd_register(const char *transp
);
143 void write_netid_register(const char *);
144 void write_nettype_register(const char *);
146 * rpc_clntout routines
148 void write_stubs(void);
151 * rpc_tblout routines
153 void write_tables(void);