Home | History | Annotate | Line # | Download | only in rpcgen
rpc_util.h revision 1.9
      1  1.9  christos /*	$NetBSD: rpc_util.h,v 1.9 2015/05/09 21:44:47 christos Exp $	*/
      2  1.1     glass /*
      3  1.1     glass  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
      4  1.1     glass  * unrestricted use provided that this legend is included on all tape
      5  1.1     glass  * media and as a part of the software program in whole or part.  Users
      6  1.1     glass  * may copy or modify Sun RPC without charge, but are not authorized
      7  1.1     glass  * to license or distribute it to anyone else except as part of a product or
      8  1.3        pk  * program developed by the user or with the express written consent of
      9  1.3        pk  * Sun Microsystems, Inc.
     10  1.3        pk  *
     11  1.1     glass  * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
     12  1.1     glass  * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
     13  1.1     glass  * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
     14  1.3        pk  *
     15  1.1     glass  * Sun RPC is provided with no support and without any obligation on the
     16  1.1     glass  * part of Sun Microsystems, Inc. to assist in its use, correction,
     17  1.1     glass  * modification or enhancement.
     18  1.3        pk  *
     19  1.1     glass  * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
     20  1.1     glass  * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
     21  1.1     glass  * OR ANY PART THEREOF.
     22  1.3        pk  *
     23  1.1     glass  * In no event will Sun Microsystems, Inc. be liable for any lost revenue
     24  1.1     glass  * or profits or other special, indirect and consequential damages, even if
     25  1.1     glass  * Sun has been advised of the possibility of such damages.
     26  1.3        pk  *
     27  1.1     glass  * Sun Microsystems, Inc.
     28  1.1     glass  * 2550 Garcia Avenue
     29  1.1     glass  * Mountain View, California  94043
     30  1.1     glass  */
     31  1.1     glass 
     32  1.3        pk /*      @(#)rpc_util.h  1.5  90/08/29  (C) 1987 SMI   */
     33  1.3        pk 
     34  1.1     glass /*
     35  1.1     glass  * rpc_util.h, Useful definitions for the RPC protocol compiler
     36  1.1     glass  */
     37  1.1     glass 
     38  1.3        pk #define alloc(size)		(void *)malloc((unsigned)(size))
     39  1.1     glass #define ALLOC(object)   (object *) malloc(sizeof(object))
     40  1.1     glass 
     41  1.1     glass #define s_print	(void) sprintf
     42  1.1     glass #define f_print (void) fprintf
     43  1.1     glass 
     44  1.1     glass struct list {
     45  1.3        pk 	definition *val;
     46  1.1     glass 	struct list *next;
     47  1.1     glass };
     48  1.1     glass typedef struct list list;
     49  1.1     glass 
     50  1.3        pk #define PUT 1
     51  1.3        pk #define GET 2
     52  1.3        pk 
     53  1.1     glass /*
     54  1.1     glass  * Global variables
     55  1.1     glass  */
     56  1.1     glass #define MAXLINESIZE 1024
     57  1.1     glass extern char curline[MAXLINESIZE];
     58  1.1     glass extern char *where;
     59  1.1     glass extern int linenum;
     60  1.9  christos extern int docleanup;
     61  1.1     glass 
     62  1.6  dholland extern const char *infilename;
     63  1.1     glass extern FILE *fout;
     64  1.1     glass extern FILE *fin;
     65  1.1     glass 
     66  1.1     glass extern list *defined;
     67  1.1     glass 
     68  1.3        pk 
     69  1.3        pk extern bas_type *typ_list_h;
     70  1.3        pk extern bas_type *typ_list_t;
     71  1.3        pk 
     72  1.3        pk /*
     73  1.3        pk  * All the option flags
     74  1.3        pk  */
     75  1.3        pk extern int inetdflag;
     76  1.3        pk extern int pmflag;
     77  1.3        pk extern int tblflag;
     78  1.8  christos extern int BSDflag;
     79  1.3        pk extern int logflag;
     80  1.3        pk extern int newstyle;
     81  1.5   mycroft extern int Mflag;     /* multithread flag */
     82  1.3        pk extern int tirpcflag; /* flag for generating tirpc code */
     83  1.4  christos extern int doinline; /* if this is 0, then do not generate inline code */
     84  1.3        pk extern int callerflag;
     85  1.3        pk 
     86  1.3        pk /*
     87  1.3        pk  * Other flags related with inetd jumpstart.
     88  1.3        pk  */
     89  1.3        pk extern int indefinitewait;
     90  1.3        pk extern int exitnow;
     91  1.3        pk extern int timerflag;
     92  1.3        pk 
     93  1.3        pk extern int nonfatalerrors;
     94  1.3        pk 
     95  1.1     glass /*
     96  1.1     glass  * rpc_util routines
     97  1.1     glass  */
     98  1.1     glass 
     99  1.1     glass #define STOREVAL(list,item)	\
    100  1.3        pk 	storeval(list,item)
    101  1.1     glass 
    102  1.1     glass #define FINDVAL(list,item,finder) \
    103  1.3        pk 	findval(list, item, finder)
    104  1.1     glass 
    105  1.8  christos void reinitialize(void);
    106  1.8  christos int streq(const char *, const char *);
    107  1.8  christos definition *findval(list *, const char *,
    108  1.8  christos 			 int (*)(definition *, const char *));
    109  1.8  christos void storeval(list **, definition *);
    110  1.8  christos const char *fixtype(const char *);
    111  1.8  christos const char *stringfix(const char *);
    112  1.8  christos void ptype(const char *, const char *, int);
    113  1.8  christos int isvectordef(const char *, relation);
    114  1.8  christos char *locase(const char *);
    115  1.8  christos void pvname_svc(const char *, const char *);
    116  1.8  christos void pvname(const char *, const char *);
    117  1.9  christos void error(const char *);
    118  1.9  christos void crash(void);
    119  1.8  christos void record_open(const char *);
    120  1.7     joerg void expected1(tok_kind) __dead;
    121  1.7     joerg void expected2(tok_kind, tok_kind) __dead;
    122  1.7     joerg void expected3(tok_kind, tok_kind, tok_kind) __dead;
    123  1.8  christos void tabify(FILE *, int);
    124  1.8  christos char *make_argname(const char *, const char *);
    125  1.8  christos void add_type(int, const char *);
    126  1.8  christos bas_type *find_type(const char *);
    127  1.1     glass /*
    128  1.1     glass  * rpc_cout routines
    129  1.1     glass  */
    130  1.8  christos void emit(definition *);
    131  1.8  christos void emit_inline(declaration *, int);
    132  1.8  christos void emit_single_in_line(declaration *, int, relation);
    133  1.8  christos char *upcase(const char *);
    134  1.1     glass 
    135  1.1     glass /*
    136  1.1     glass  * rpc_hout routines
    137  1.1     glass  */
    138  1.4  christos 
    139  1.8  christos void print_datadef(definition *);
    140  1.8  christos void print_progdef(definition *);
    141  1.8  christos void print_funcdef(definition *, int *);
    142  1.8  christos void print_funcend(int);
    143  1.8  christos void pxdrfuncdecl(const char *, int);
    144  1.8  christos void pprocdef(proc_list *, version_list *, const char *, int);
    145  1.8  christos void pdeclaration(const char *, declaration *, int, const char *);
    146  1.1     glass 
    147  1.1     glass /*
    148  1.1     glass  * rpc_svcout routines
    149  1.1     glass  */
    150  1.8  christos void write_most(char *, int, int);
    151  1.8  christos void write_netid_register(const char *);
    152  1.8  christos void write_nettype_register(const char *);
    153  1.8  christos void write_rest(void);
    154  1.8  christos void write_programs(const char *);
    155  1.8  christos int nullproc(proc_list *);
    156  1.8  christos void write_svc_aux(int);
    157  1.8  christos void write_msg_out(void);
    158  1.8  christos void write_inetd_register(const char *);
    159  1.4  christos 
    160  1.3        pk /*
    161  1.3        pk  * rpc_clntout routines
    162  1.3        pk  */
    163  1.8  christos void write_stubs(void);
    164  1.8  christos void printarglist(proc_list *, const char *, const char *, const char *);
    165  1.3        pk 
    166  1.3        pk 
    167  1.3        pk /*
    168  1.3        pk  * rpc_tblout routines
    169  1.3        pk  */
    170  1.8  christos void write_tables(void);
    171  1.1     glass 
    172  1.1     glass /*
    173  1.3        pk  * rpc_sample routines
    174  1.1     glass  */
    175  1.8  christos void write_sample_svc(definition *);
    176  1.8  christos int write_sample_clnt(definition *);
    177  1.8  christos void add_sample_msg(void);
    178  1.8  christos void write_sample_clnt_main(void);
    179