1 /* @(#)rpc_util.h 1.2 87/11/24 3.9 RPCSRC */
3 * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
4 * unrestricted use provided that this legend is included on all tape
5 * media and as a part of the software program in whole or part. Users
6 * may copy or modify Sun RPC without charge, but are not authorized
7 * to license or distribute it to anyone else except as part of a product or
8 * program developed by the user.
10 * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
11 * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
12 * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
14 * Sun RPC is provided with no support and without any obligation on the
15 * part of Sun Microsystems, Inc. to assist in its use, correction,
16 * modification or enhancement.
18 * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
19 * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
20 * OR ANY PART THEREOF.
22 * In no event will Sun Microsystems, Inc. be liable for any lost revenue
23 * or profits or other special, indirect and consequential damages, even if
24 * Sun has been advised of the possibility of such damages.
26 * Sun Microsystems, Inc.
28 * Mountain View, California 94043
32 * rpc_util.h, Useful definitions for the RPC protocol compiler
33 * Copyright (C) 1987, Sun Microsystems, Inc.
36 #include "rxgen_consts.h"
37 #define alloc(size) malloc((unsigned)(size))
38 #define ALLOC(object) (object *) malloc(sizeof(object))
40 #define s_print (void) sprintf
41 #define f_print if (scan_print) (void) fprintf
47 typedef struct list list;
49 #define MAXLINESIZE 1024
57 extern char *OutFileFlag;
58 extern char OutFile[];
59 extern char Sflag, Cflag, hflag, cflag, kflag, uflag;
60 extern char ansic_flag;
68 extern char curline[];
71 extern char *infilename;
72 extern char *outfiles[];
78 extern void reinitialize(void);
79 extern int streq(char *a, char *b);
80 extern char *findval(list * lst, char *val,
81 int (*cmp) (definition * def, char *type));
82 extern void storeval(list ** lstp, char *val);
83 extern char *fixtype(char *type);
84 extern char *stringfix(char *type);
85 extern void ptype(char *prefix, char *type, int follow);
86 extern int isvectordef(char *type, relation rel);
87 extern void pvname(char *pname, char *vnum);
88 extern void error(char *msg);
89 extern void crash(void);
90 extern void record_open(char *file);
91 extern void expected1(tok_kind exp1);
92 extern void expected2(tok_kind exp1, tok_kind exp2);
93 extern void expected3(tok_kind exp1, tok_kind exp2, tok_kind exp3);
94 extern void expected4(tok_kind exp1, tok_kind exp2, tok_kind exp3,
96 extern void tabify(FILE * f, int tab);
98 #define STOREVAL(list,item) \
99 storeval(list,(char *)item)
101 #define FINDVAL(list,item,finder) \
102 findval(list, (char *) item, finder)
105 extern void write_stubs(void);
108 extern void emit(definition * def);
109 extern void print_param(declaration * dec);
112 extern void print_datadef(definition * def);
113 extern void pdefine(char *name, char *num);
114 extern void pprocdef(proc_list * proc, version_list * vp);
117 extern list *proc_defined[MAX_PACKAGES], *special_defined, *typedef_defined,
119 extern char *SplitStart;
120 extern char *SplitEnd;
121 extern char *MasterPrefix;
122 extern char *ServerPrefix;
123 extern char *PackagePrefix[];
124 extern char *PackageStatIndex[];
125 extern int no_of_stat_funcs;
126 extern int no_of_stat_funcs_header[];
127 extern int no_of_opcodes[], master_no_of_opcodes;
128 extern int lowest_opcode[], master_lowest_opcode;
129 extern int highest_opcode[], master_highest_opcode;
130 extern int master_opcodenumber;
131 extern int opcodesnotallowed[];
132 extern int combinepackages;
133 extern int PackageIndex;
134 extern int PerProcCounter;
135 extern int Multi_Init;
136 extern char function_list[MAX_PACKAGES]
137 [MAX_FUNCTIONS_PER_PACKAGE]
138 [MAX_FUNCTION_NAME_LEN];
139 extern int function_list_index;
141 extern definition *get_definition(void);
143 extern void er_Proc_CodeGeneration(void);
144 extern void h_opcode_stats(void);
145 extern void generate_multi_macros(definition * defp);
146 extern int IsRxgenToken(token * tokp);
147 extern int IsRxgenDefinition(definition * def);
152 extern proc1_list *Proc_list, **Proc_listp;
156 extern int nullproc(proc_list * proc);
157 extern void write_programs(char *storage);
158 extern void write_rest(void);
159 extern void write_most(void);
160 extern void write_register(char *transp);
164 extern token lasttok;
165 extern int scan_print;
167 extern void scan(tok_kind expect, token * tokp);
168 extern void scan2(tok_kind expect1, tok_kind expect2, token * tokp);
169 extern void scan3(tok_kind expect1, tok_kind expect2, tok_kind expect3,
171 extern void scan4(tok_kind expect1, tok_kind expect2, tok_kind expect3,
172 tok_kind expect4, token * tokp);
173 extern void scan_num(token * tokp);
174 extern void peek(token * tokp);
175 extern int peekscan(tok_kind expect, token * tokp);
176 extern void get_token(token * tokp);
177 extern void unget_token(token * tokp);
178 extern void findkind(char **mark, token * tokp);
179 extern void printdirective(char *line);