xref: /trueos/usr.bin/migcom/global.c (revision 876e42e41e5f779216890d1b1c1dab9ea1816484)
1 /*
2  * Copyright 1991-1998 by Open Software Foundation, Inc.
3  *              All Rights Reserved
4  *
5  * Permission to use, copy, modify, and distribute this software and
6  * its documentation for any purpose and without fee is hereby granted,
7  * provided that the above copyright notice appears in all copies and
8  * that both the copyright notice and this permission notice appear in
9  * supporting documentation.
10  *
11  * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
12  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
13  * FOR A PARTICULAR PURPOSE.
14  *
15  * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR
16  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
17  * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT,
18  * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
19  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20  */
21 /*
22  * cmk1.1
23  */
24 /*
25  * Mach Operating System
26  * Copyright (c) 1991,1990 Carnegie Mellon University
27  * All Rights Reserved.
28  *
29  * Permission to use, copy, modify and distribute this software and its
30  * documentation is hereby granted, provided that both the copyright
31  * notice and this permission notice appear in all copies of the
32  * software, derivative works or modified versions, and any portions
33  * thereof, and that both notices appear in supporting documentation.
34  *
35  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS
36  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
37  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
38  *
39  * Carnegie Mellon requests users of this software to return to
40  *
41  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
42  *  School of Computer Science
43  *  Carnegie Mellon University
44  *  Pittsburgh PA 15213-3890
45  *
46  * any improvements or extensions that they make and grant Carnegie the
47  * rights to redistribute these changes.
48  */
49 /*
50  * 91/08/28  11:16:53  jsb
51  * 	Replaced ServerProcName with ServerDemux.
52  * 	[91/08/13            rpd]
53  *
54  * 	Removed Camelot and TrapRoutine support.
55  * 	Changed MsgKind to MsgSeqno.
56  * 	[91/08/12            rpd]
57  *
58  * 91/06/26  14:39:24  rpd
59  * 	Removed InitRoutineName.
60  * 	[91/06/26            rpd]
61  *
62  * 91/06/25  10:30:59  rpd
63  * 	Added ServerHeaderFileName.
64  * 	[91/05/22            rpd]
65  *
66  * 91/02/05  17:54:23  mrt
67  * 	Changed to new Mach copyright
68  * 	[91/02/01  17:54:07  mrt]
69  *
70  * 90/06/19  23:00:47  rpd
71  * 	Added UserFilePrefix.
72  * 	[90/06/03            rpd]
73  *
74  * 90/06/02  15:04:38  rpd
75  * 	Created for new IPC.
76  * 	[90/03/26  21:10:43  rpd]
77  *
78  * 07-Apr-89  Richard Draves (rpd) at Carnegie-Mellon University
79  *	Extensive revamping.  Added polymorphic arguments.
80  *	Allow multiple variable-sized inline arguments in messages.
81  *
82  *  8-Feb-89  David Golub (dbg) at Carnegie-Mellon University
83  *	Use default values for output file names only if they have not
84  *	yet been set.
85  *
86  * 17-Sep-87  Bennet Yee (bsy) at Carnegie-Mellon University
87  *	Added GenSymTab
88  *
89  * 25-Aug-87  Mary Thompson (mrt) at Carnegie-Mellon University
90  *	Changed CamelotPrefix to op_
91  *
92  * 12-Aug-87  Mary Thompson (mrt) at Carnegie-Mellon University
93  *	Initialized CamelotPrefix
94  *
95  * 10-Aug-87  Mary Thompson (mrt) at Carnegie-Mellon University
96  *	Changed UseRPC to TRUE
97  *
98  *  3-Aug-87  Mary Thompson (mrt) at Carnegie-Mellon University
99  *	Removed reference to UseThreads.
100  *
101  * 16-Jul-87  Robert Sansom (rds) at Carnegie Mellon University
102  *	Added MsgType.
103  *
104  * 28-May-87  Richard Draves (rpd) at Carnegie-Mellon University
105  *	Created.
106  */
107 #include <sys/types.h>
108 #include <sys/param.h>
109 
110 #include <stdio.h>
111 #include <stdlib.h>
112 #include <mach/message.h>
113 #include "strdefs.h"
114 #include "global.h"
115 #include "error.h"
116 #include "mig_machine.h"
117 
118 
119 
120 boolean_t BeQuiet = FALSE;
121 boolean_t BeVerbose = FALSE;
122 boolean_t UseMsgRPC = TRUE;
123 boolean_t GenSymTab = FALSE;
124 boolean_t UseEventLogger = FALSE;
125 boolean_t BeAnsiC = TRUE;
126 boolean_t CheckNDR = FALSE;
127 boolean_t PackMsg = PACK_MESSAGES;
128 boolean_t UseSplitHeaders = FALSE;
129 boolean_t ShortCircuit = FALSE;
130 boolean_t UseRPCTrap = FALSE;
131 boolean_t TestRPCTrap= FALSE;
132 boolean_t IsVoucherCodeAllowed = TRUE;
133 
134 boolean_t IsKernelUser = FALSE;
135 boolean_t IsKernelServer = FALSE;
136 
137 string_t RCSId = strNULL;
138 
139 string_t SubsystemName = strNULL;
140 u_int SubsystemBase = 0;
141 
142 string_t MsgOption = strNULL;
143 string_t WaitTime = strNULL;
144 string_t SendTime = strNULL;
145 string_t ErrorProc = "MsgError";
146 string_t ServerPrefix = "";
147 string_t UserPrefix = "";
148 string_t ServerDemux = strNULL;
149 string_t ServerImpl = strNULL;
150 string_t ServerSubsys = strNULL;
151 int MaxMessSizeOnStack = -1;    /* by default, always on stack */
152 int UserTypeLimit = -1;         /* by default, assume unlimited size. */
153 
154 string_t yyinname;
155 
156 char NewCDecl[] = "(defined(__STDC__) || defined(c_plusplus))";
157 char LintLib[] = "defined(LINTLIBRARY)";
158 
159 void
init_global(void)160 init_global(void)
161 {
162     yyinname = strmake("<no name yet>");
163 }
164 
165 string_t UserFilePrefix = strNULL;
166 string_t UserHeaderFileName = strNULL;
167 string_t ServerHeaderFileName = strNULL;
168 string_t InternalHeaderFileName = strNULL;
169 string_t DefinesHeaderFileName = strNULL;
170 string_t UserFileName = strNULL;
171 string_t ServerFileName = strNULL;
172 string_t GenerationDate = strNULL;
173 
174 void
more_global(void)175 more_global(void)
176 {
177   if (SubsystemName == strNULL)
178     fatal("no SubSystem declaration");
179 
180   if (UserHeaderFileName == strNULL)
181     UserHeaderFileName = strconcat(SubsystemName, ".h");
182   else if (streql(UserHeaderFileName, "/dev/null"))
183     UserHeaderFileName = strNULL;
184 
185   if (UserFileName == strNULL)
186     UserFileName = strconcat(SubsystemName, "User.c");
187   else if (streql(UserFileName, "/dev/null"))
188     UserFileName = strNULL;
189 
190   if (ServerFileName == strNULL)
191     ServerFileName = strconcat(SubsystemName, "Server.c");
192   else if (streql(ServerFileName, "/dev/null"))
193     ServerFileName = strNULL;
194 
195   if (ServerDemux == strNULL)
196     ServerDemux = strconcat(SubsystemName, "_server");
197 
198   if (ServerImpl == strNULL)
199     ServerImpl = strconcat(SubsystemName, "_impl");
200 
201   if (ServerSubsys == strNULL) {
202     if (ServerPrefix != strNULL)
203       ServerSubsys = strconcat(ServerPrefix, SubsystemName);
204     else
205       ServerSubsys = SubsystemName;
206     ServerSubsys = strconcat(ServerSubsys, "_subsystem");
207   }
208 }
209