Remove sunrpc compatibility
[openafs.git] / src / rxgen / rpc_util.h
1 /* @(#)rpc_util.h       1.2 87/11/24 3.9 RPCSRC */
2 /*
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.
9  *
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.
13  *
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.
17  *
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.
21  *
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.
25  *
26  * Sun Microsystems, Inc.
27  * 2550 Garcia Avenue
28  * Mountain View, California  94043
29  */
30
31 /*
32  * rpc_util.h, Useful definitions for the RPC protocol compiler
33  * Copyright (C) 1987, Sun Microsystems, Inc.
34  */
35
36 #include "rxgen_consts.h"
37 #define alloc(size)             malloc((unsigned)(size))
38 #define ALLOC(object)   (object *) malloc(sizeof(object))
39
40 #define s_print (void) sprintf
41 #define f_print if (scan_print) (void) fprintf
42
43 struct list {
44     char *val;
45     struct list *next;
46 };
47 typedef struct list list;
48
49 #define MAXLINESIZE 1024
50
51
52 /* PROTOTYPES */
53
54 /* rpc_main.c */
55 extern char *prefix;
56 extern int nincludes;
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;
62 extern char zflag;
63 extern char xflag;
64 extern char yflag;
65 extern int debug;
66
67
68 /* rpc_util.c */
69 extern char curline[];
70 extern char *where;
71 extern int linenum;
72 extern char *infilename;
73 extern char *outfiles[];
74 extern int nfiles;
75 extern FILE *fout;
76 extern FILE *fin;
77 extern list *defined;
78
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,
96                       tok_kind exp4);
97 extern void tabify(FILE * f, int tab);
98
99 #define STOREVAL(list,item)     \
100         storeval(list,(char *)item)
101
102 #define FINDVAL(list,item,finder) \
103         findval(list, (char *) item, finder)
104
105 /* rpc_cout.c */
106 extern void emit(definition * def);
107 extern void print_param(declaration * dec);
108
109 /* rpc_hout.c */
110 extern void print_datadef(definition * def);
111 extern void pdefine(char *name, char *num);
112
113 /* rpc_parse.c */
114 extern list *proc_defined[MAX_PACKAGES], *special_defined, *typedef_defined,
115     *uniondef_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;
137
138 extern definition *get_definition(void);
139
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);
146
147
148
149
150 extern proc1_list *Proc_list, **Proc_listp;
151
152
153 /* rpc_scan.c */
154 extern int pushed;
155 extern token lasttok;
156 extern int scan_print;
157
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,
161                   token * tokp);
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);