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;
61 extern char brief_flag;
69 extern char curline[];
72 extern char *infilename;
73 extern char *outfiles[];
79 extern void reinitialize(void);
80 extern int streq(char *a, char *b);
81 extern char *findval(list * lst, char *val,
82 int (*cmp) (definition * def, char *type));
83 extern void storeval(list ** lstp, char *val);
84 extern char *fixtype(char *type);
85 extern char *stringfix(char *type);
86 extern void ptype(char *prefix, char *type, int follow);
87 extern int isvectordef(char *type, relation rel);
88 extern void pvname(char *pname, char *vnum);
89 extern void error(char *msg);
90 extern void crash(void);
91 extern void record_open(char *file);
92 extern void expected1(tok_kind exp1);
93 extern void expected2(tok_kind exp1, tok_kind exp2);
94 extern void expected3(tok_kind exp1, tok_kind exp2, tok_kind exp3);
95 extern void expected4(tok_kind exp1, tok_kind exp2, tok_kind exp3,
97 extern void tabify(FILE * f, int tab);
99 #define STOREVAL(list,item) \
100 storeval(list,(char *)item)
102 #define FINDVAL(list,item,finder) \
103 findval(list, (char *) item, finder)
106 extern void emit(definition * def);
107 extern void print_param(declaration * dec);
110 extern void print_datadef(definition * def);
111 extern void pdefine(char *name, char *num);
114 extern list *proc_defined[MAX_PACKAGES], *special_defined, *typedef_defined,
116 extern char *SplitStart;
117 extern char *SplitEnd;
118 extern char *MasterPrefix;
119 extern char *ServerPrefix;
120 extern char *PackagePrefix[];
121 extern char *PackageStatIndex[];
122 extern int no_of_stat_funcs;
123 extern int no_of_stat_funcs_header[];
124 extern int no_of_opcodes[], master_no_of_opcodes;
125 extern int lowest_opcode[], master_lowest_opcode;
126 extern int highest_opcode[], master_highest_opcode;
127 extern int master_opcodenumber;
128 extern int opcodesnotallowed[];
129 extern int combinepackages;
130 extern int PackageIndex;
131 extern int PerProcCounter;
132 extern int Multi_Init;
133 extern char function_list[MAX_PACKAGES]
134 [MAX_FUNCTIONS_PER_PACKAGE]
135 [MAX_FUNCTION_NAME_LEN];
136 extern int function_list_index;
138 extern definition *get_definition(void);
140 extern void er_Proc_CodeGeneration(void);
141 extern void h_Proc_CodeGeneration(void);
142 extern void h_opcode_stats(void);
143 extern void generate_multi_macros(definition * defp);
144 extern int IsRxgenToken(token * tokp);
145 extern int IsRxgenDefinition(definition * def);
150 extern proc1_list *Proc_list, **Proc_listp;
155 extern token lasttok;
156 extern int scan_print;
158 extern void scan(tok_kind expect, token * tokp);
159 extern void scan2(tok_kind expect1, tok_kind expect2, token * tokp);
160 extern void scan3(tok_kind expect1, tok_kind expect2, tok_kind expect3,
162 extern void scan4(tok_kind expect1, tok_kind expect2, tok_kind expect3,
163 tok_kind expect4, token * tokp);
164 extern void scan_num(token * tokp);
165 extern void peek(token * tokp);
166 extern int peekscan(tok_kind expect, token * tokp);
167 extern void get_token(token * tokp);
168 extern void unget_token(token * tokp);
169 extern void findkind(char **mark, token * tokp);
170 extern void printdirective(char *line);