xref: /netbsd-src/usr.bin/rpcgen/rpc_util.h (revision 811e6386f8c5e4a3521c7003da29ec8673e344fa)
1 /* @(#)rpc_util.h	2.1 88/08/01 4.0 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 /* @(#)rpc_util.h 1.6 87/06/24 (C) 1987 SMI */
31 
32 /*
33  * rpc_util.h, Useful definitions for the RPC protocol compiler
34  * Copyright (C) 1987, Sun Microsystems, Inc.
35  */
36 extern char *malloc();
37 
38 #define alloc(size)		malloc((unsigned)(size))
39 #define ALLOC(object)   (object *) malloc(sizeof(object))
40 
41 #define s_print	(void) sprintf
42 #define f_print (void) fprintf
43 
44 struct list {
45 	char *val;
46 	struct list *next;
47 };
48 typedef struct list list;
49 
50 /*
51  * Global variables
52  */
53 #define MAXLINESIZE 1024
54 extern char curline[MAXLINESIZE];
55 extern char *where;
56 extern int linenum;
57 
58 extern char *infilename;
59 extern FILE *fout;
60 extern FILE *fin;
61 
62 extern list *defined;
63 
64 /*
65  * rpc_util routines
66  */
67 void storeval();
68 
69 #define STOREVAL(list,item)	\
70 	storeval(list,(char *)item)
71 
72 char *findval();
73 
74 #define FINDVAL(list,item,finder) \
75 	findval(list, (char *) item, finder)
76 
77 char *fixtype();
78 char *stringfix();
79 void pvname();
80 void ptype();
81 int isvectordef();
82 int streq();
83 void error();
84 void expected1();
85 void expected2();
86 void expected3();
87 void tabify();
88 void record_open();
89 
90 /*
91  * rpc_cout routines
92  */
93 void cprint();
94 void emit();
95 
96 /*
97  * rpc_hout routines
98  */
99 void print_datadef();
100 
101 /*
102  * rpc_svcout routines
103  */
104 void write_most();
105 void write_register();
106 void write_rest();
107 
108 /*
109  * rpc_clntout routines
110  */
111 void write_stubs();
112