1/*
2 * Copyright (c) 1999, 2008 Apple Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23/*
24 * Mach Operating System
25 * Copyright (c) 1991,1990 Carnegie Mellon University
26 * All Rights Reserved.
27 *
28 * Permission to use, copy, modify and distribute this software and its
29 * documentation is hereby granted, provided that both the copyright
30 * notice and this permission notice appear in all copies of the
31 * software, derivative works or modified versions, and any portions
32 * thereof, and that both notices appear in supporting documentation.
33 *
34 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS
35 * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
36 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
37 *
38 * Carnegie Mellon requests users of this software to return to
39 *
40 *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
41 *  School of Computer Science
42 *  Carnegie Mellon University
43 *  Pittsburgh PA 15213-3890
44 *
45 * any improvements or extensions that they make and grant Carnegie the
46 * rights to redistribute these changes.
47 */
48
49#include "strdefs.h"
50#include "global.h"
51#include "error.h"
52#include "mig_machine.h"
53
54boolean_t BeQuiet = FALSE;
55boolean_t BeVerbose = FALSE;
56boolean_t UseMsgRPC = TRUE;
57boolean_t GenSymTab = FALSE;
58boolean_t UseEventLogger = FALSE;
59boolean_t BeLint = FALSE;
60boolean_t BeAnsiC = TRUE;
61boolean_t CheckNDR = FALSE;
62boolean_t PackMsg = PACK_MESSAGES;
63boolean_t UseSplitHeaders = FALSE;
64boolean_t ShortCircuit = FALSE;
65boolean_t UseRPCTrap = FALSE;
66boolean_t TestRPCTrap= FALSE;
67boolean_t IsVoucherCodeAllowed = TRUE;
68
69boolean_t IsKernelUser = FALSE;
70boolean_t IsKernelServer = FALSE;
71
72string_t RCSId = strNULL;
73
74string_t SubsystemName = strNULL;
75u_int SubsystemBase = 0;
76
77string_t MsgOption = strNULL;
78string_t WaitTime = strNULL;
79string_t SendTime = strNULL;
80string_t ErrorProc = "MsgError";
81string_t ServerPrefix = "";
82string_t UserPrefix = "";
83string_t ServerDemux = strNULL;
84string_t ServerImpl = strNULL;
85string_t ServerSubsys = strNULL;
86int MaxMessSizeOnStack = -1;    /* by default, always on stack */
87int UserTypeLimit = -1;         /* by default, assume unlimited size. */
88
89string_t yyinname;
90
91char NewCDecl[] = "(defined(__STDC__) || defined(c_plusplus))";
92char LintLib[] = "defined(LINTLIBRARY)";
93
94void
95init_global()
96{
97    yyinname = strmake("<no name yet>");
98}
99
100string_t UserFilePrefix = strNULL;
101string_t UserHeaderFileName = strNULL;
102string_t ServerHeaderFileName = strNULL;
103string_t InternalHeaderFileName = strNULL;
104string_t DefinesHeaderFileName = strNULL;
105string_t UserFileName = strNULL;
106string_t ServerFileName = strNULL;
107string_t GenerationDate = strNULL;
108
109void
110more_global()
111{
112  if (SubsystemName == strNULL)
113    fatal("no SubSystem declaration");
114
115  if (UserHeaderFileName == strNULL)
116    UserHeaderFileName = strconcat(SubsystemName, ".h");
117  else if (streql(UserHeaderFileName, "/dev/null"))
118    UserHeaderFileName = strNULL;
119
120  if (UserFileName == strNULL)
121    UserFileName = strconcat(SubsystemName, "User.c");
122  else if (streql(UserFileName, "/dev/null"))
123    UserFileName = strNULL;
124
125  if (ServerFileName == strNULL)
126    ServerFileName = strconcat(SubsystemName, "Server.c");
127  else if (streql(ServerFileName, "/dev/null"))
128    ServerFileName = strNULL;
129
130  if (ServerDemux == strNULL)
131    ServerDemux = strconcat(SubsystemName, "_server");
132
133  if (ServerImpl == strNULL)
134    ServerImpl = strconcat(SubsystemName, "_impl");
135
136  if (ServerSubsys == strNULL) {
137    if (ServerPrefix != strNULL)
138      ServerSubsys = strconcat(ServerPrefix, SubsystemName);
139    else
140      ServerSubsys = SubsystemName;
141    ServerSubsys = strconcat(ServerSubsys, "_subsystem");
142  }
143}
144