Delete src/tools/tools/tcl_bmake. We don't have tcl in the source so the
[dragonfly.git] / usr.bin / rpcgen / rpc_util.h
blobd56e5c040acfdda9c6a94221b387fb186bc26177
1 /*
2 * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
3 * unrestricted use provided that this legend is included on all tape
4 * media and as a part of the software program in whole or part. Users
5 * may copy or modify Sun RPC without charge, but are not authorized
6 * to license or distribute it to anyone else except as part of a product or
7 * program developed by the user.
8 *
9 * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
10 * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
11 * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
13 * Sun RPC is provided with no support and without any obligation on the
14 * part of Sun Microsystems, Inc. to assist in its use, correction,
15 * modification or enhancement.
17 * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
18 * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
19 * OR ANY PART THEREOF.
21 * In no event will Sun Microsystems, Inc. be liable for any lost revenue
22 * or profits or other special, indirect and consequential damages, even if
23 * Sun has been advised of the possibility of such damages.
25 * Sun Microsystems, Inc.
26 * 2550 Garcia Avenue
27 * Mountain View, California 94043
29 #pragma ident "@(#)rpc_util.h 1.16 94/05/15 SMI"
31 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
32 /* All Rights Reserved */
34 /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */
35 /* The copyright notice above does not evidence any */
36 /* actual or intended publication of such source code. */
39 /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
40 * PROPRIETARY NOTICE (Combined)
42 * This source code is unpublished proprietary information
43 * constituting, or derived under license from AT&T's UNIX(r) System V.
44 * In addition, portions of such source code were derived from Berkeley
45 * 4.3 BSD under license from the Regents of the University of
46 * California.
50 * Copyright Notice
52 * Notice of copyright on this source code product does not indicate
53 * publication.
55 * (c) 1986,1987,1988.1989 Sun Microsystems, Inc
56 * (c) 1983,1984,1985,1986,1987,1988,1989 AT&T.
57 * All rights reserved.
58 */
60 /* @(#)rpc_util.h 1.5 90/08/29 (C) 1987 SMI */
61 /* $DragonFly: src/usr.bin/rpcgen/rpc_util.h,v 1.2 2004/06/19 16:40:36 joerg Exp $ */
64 * rpc_util.h, Useful definitions for the RPC protocol compiler
66 #include <sys/types.h>
67 #include <stdlib.h>
69 #include "rpc_scan.h"
71 #define alloc(size) malloc((unsigned)(size))
72 #define ALLOC(object) (object *) malloc(sizeof(object))
74 #define s_print (void) sprintf
75 #define f_print (void) fprintf
77 struct list {
78 definition *val;
79 struct list *next;
81 typedef struct list list;
83 struct xdrfunc {
84 char *name;
85 int pointerp;
86 struct xdrfunc *next;
88 typedef struct xdrfunc xdrfunc;
90 struct commandline {
91 int cflag; /* xdr C routines */
92 int hflag; /* header file */
93 int lflag; /* client side stubs */
94 int mflag; /* server side stubs */
95 int nflag; /* netid flag */
96 int sflag; /* server stubs for the given transport */
97 int tflag; /* dispatch Table file */
98 int Ssflag; /* produce server sample code */
99 int Scflag; /* produce client sample code */
100 int makefileflag; /* Generate a template Makefile */
101 char *infile; /* input module name */
102 char *outfile; /* output module name */
105 #define PUT 1
106 #define GET 2
109 * Global variables
111 #define MAXLINESIZE 1024
112 extern char curline[MAXLINESIZE];
113 extern char *where;
114 extern int linenum;
116 extern char *infilename;
117 extern FILE *fout;
118 extern FILE *fin;
120 extern list *defined;
123 extern bas_type *typ_list_h;
124 extern bas_type *typ_list_t;
125 extern xdrfunc *xdrfunc_head, *xdrfunc_tail;
128 * All the option flags
130 extern int inetdflag;
131 extern int pmflag;
132 extern int tblflag;
133 extern int logflag;
134 extern int newstyle;
135 extern int Cflag; /* ANSI-C/C++ flag */
136 extern int CCflag; /* C++ flag */
137 extern int tirpcflag; /* flag for generating tirpc code */
138 extern int rpcgen_inline; /* if this is 0, then do not generate inline code */
139 extern int mtflag;
142 * Other flags related with inetd jumpstart.
144 extern int indefinitewait;
145 extern int exitnow;
146 extern int timerflag;
148 extern int nonfatalerrors;
150 extern pid_t childpid;
153 * rpc_util routines
155 void reinitialize(void);
156 void crash(void );
157 void add_type(int len, char *type);
159 void storeval(list **, definition *);
161 #define STOREVAL(list,item) \
162 storeval(list,item)
164 definition *findval(list *, char *, int (*)(definition *, char *));
166 #define FINDVAL(list,item,finder) \
167 findval(list, item, finder)
169 char *fixtype(char *);
170 char *stringfix(char *);
171 char *locase(char *);
172 void pvname_svc(char *, char *);
173 void pvname(char *, char *);
174 void ptype(char *, char *, int);
175 int isvectordef(char *, relation);
176 int streq(char *, char *);
177 void error(char *);
178 void expected1(tok_kind);
179 void expected2(tok_kind, tok_kind);
180 void expected3(tok_kind, tok_kind, tok_kind);
181 void tabify(FILE *, int);
182 void record_open(char *);
183 bas_type *find_type(char *);
185 * rpc_cout routines
187 void cprint(void);
188 void emit(definition *);
191 * rpc_hout routines
193 void print_datadef(definition *);
194 void print_funcdef(definition *);
195 void print_xdr_func_def(char *, int, int);
198 * rpc_svcout routines
200 void write_most(char *, int, int);
201 void write_rest(void);
202 void write_programs(char *);
203 void write_svc_aux(int);
204 void write_inetd_register(char *);
205 void write_netid_register(char *);
206 void write_nettype_register(char *);
208 * rpc_clntout routines
210 void write_stubs(void);
213 * rpc_tblout routines
215 void write_tables(void);