]> git.cameronkatri.com Git - apple_cmds.git/blob - bootstrap_cmds/migcom.tproj/header.c
text_cmds: All done
[apple_cmds.git] / bootstrap_cmds / migcom.tproj / header.c
1 /*
2 * Copyright (c) 1999-2018 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 "write.h"
50 #include "utils.h"
51 #include "global.h"
52 #include "strdefs.h"
53 #include "error.h"
54 #include <stdlib.h>
55
56 void
57 WriteIncludes(FILE *file, boolean_t isuser, boolean_t isdef)
58 {
59 if (isdef) {
60 fprintf(file, "#include <mach/port.h>\n");
61 fprintf(file, "#include <mach/machine/kern_return.h>\n");
62 if (!isuser)
63 fprintf(file, "#include <mach/mig_errors.h>\n");
64 }
65 else {
66 fprintf(file, "#include <string.h>\n");
67 fprintf(file, "#include <mach/ndr.h>\n");
68 fprintf(file, "#include <mach/boolean.h>\n");
69 fprintf(file, "#include <mach/kern_return.h>\n");
70 fprintf(file, "#include <mach/notify.h>\n");
71 fprintf(file, "#include <mach/mach_types.h>\n");
72 fprintf(file, "#include <mach/message.h>\n");
73 fprintf(file, "#include <mach/mig_errors.h>\n");
74 fprintf(file, "#include <mach/port.h>\n");
75
76 if (IsVoucherCodeAllowed && !IsKernelUser && !IsKernelServer) {
77 fprintf(file, "\t\n/* BEGIN VOUCHER CODE */\n\n");
78 fprintf(file, "#ifndef KERNEL\n");
79 fprintf(file, "#if defined(__has_include)\n");
80 fprintf(file, "#if __has_include(<mach/mig_voucher_support.h>)\n");
81 fprintf(file, "#ifndef USING_VOUCHERS\n");
82 fprintf(file, "#define USING_VOUCHERS\n");
83 fprintf(file, "#endif\n");
84
85
86 fprintf(file, "#ifndef __VOUCHER_FORWARD_TYPE_DECLS__\n");
87 fprintf(file, "#define __VOUCHER_FORWARD_TYPE_DECLS__\n");
88
89 fprintf(file, "#ifdef __cplusplus\n");
90 fprintf(file, "extern \"C\" {\n");
91 fprintf(file, "#endif\n");
92
93 fprintf(file, "\textern boolean_t voucher_mach_msg_set(mach_msg_header_t *msg) __attribute__((weak_import));\n");
94
95 fprintf(file, "#ifdef __cplusplus\n");
96 fprintf(file, "}\n");
97 fprintf(file, "#endif\n");
98
99 fprintf(file, "#endif // __VOUCHER_FORWARD_TYPE_DECLS__\n");
100 fprintf(file, "#endif // __has_include(<mach/mach_voucher_types.h>)\n");
101 fprintf(file, "#endif // __has_include\n");
102 fprintf(file, "#endif // !KERNEL\n");
103
104 fprintf(file, "\t\n/* END VOUCHER CODE */\n\n");
105 }
106
107 fprintf(file, "\t\n/* BEGIN MIG_STRNCPY_ZEROFILL CODE */\n\n");
108 fprintf(file, "#if defined(__has_include)\n");
109 fprintf(file, "#if __has_include(<mach/mig_strncpy_zerofill_support.h>)\n");
110 fprintf(file, "#ifndef USING_MIG_STRNCPY_ZEROFILL\n");
111 fprintf(file, "#define USING_MIG_STRNCPY_ZEROFILL\n");
112 fprintf(file, "#endif\n");
113
114 fprintf(file, "#ifndef __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__\n");
115 fprintf(file, "#define __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__\n");
116
117 fprintf(file, "#ifdef __cplusplus\n");
118 fprintf(file, "extern \"C\" {\n");
119 fprintf(file, "#endif\n");
120
121 fprintf(file, "\textern int mig_strncpy_zerofill(char *dest, const char *src, int len) __attribute__((weak_import));\n");
122
123 fprintf(file, "#ifdef __cplusplus\n");
124 fprintf(file, "}\n");
125 fprintf(file, "#endif\n");
126
127 fprintf(file, "#endif /* __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__ */\n");
128 fprintf(file, "#endif /* __has_include(<mach/mig_strncpy_zerofill_support.h>) */\n");
129 fprintf(file, "#endif /* __has_include */\n");
130 fprintf(file, "\t\n/* END MIG_STRNCPY_ZEROFILL CODE */\n\n");
131
132 if (ShortCircuit)
133 fprintf(file, "#include <mach/rpc.h>\n");
134 if (isuser && IsKernelUser) {
135 fprintf(file, "#if\t(__MigKernelSpecificCode) || (_MIG_KERNEL_SPECIFIC_CODE_)\n");
136 fprintf(file, "#include <kern/ipc_mig.h>\n");
137 fprintf(file, "#endif /* __MigKernelSpecificCode */\n");
138 }
139 }
140 fprintf(file, "\n");
141 }
142
143 static void
144 WriteETAPDefines(FILE *file)
145 {
146 statement_t *stat;
147 int fnum;
148 char *fname;
149 int first = TRUE;
150
151 fprintf(file, "\n#ifndef subsystem_to_name_map_%s\n", SubsystemName);
152 fprintf(file, "#define subsystem_to_name_map_%s \\\n", SubsystemName);
153 for (stat = stats; stat != stNULL; stat = stat->stNext)
154 if (stat->stKind == skRoutine) {
155 fnum = SubsystemBase + stat->stRoutine->rtNumber;
156 fname = stat->stRoutine->rtName;
157 if (! first)
158 fprintf(file, ",\\\n");
159 fprintf(file, " { \"%s\", %d }", fname, fnum);
160 first = FALSE;
161 }
162 fprintf(file, "\n#endif\n");
163 }
164
165 static void
166 WriteProlog(FILE *file, char *protect, boolean_t more, boolean_t isuser)
167 {
168 if (protect != strNULL) {
169 fprintf(file, "#ifndef\t_%s\n", protect);
170 fprintf(file, "#define\t_%s\n", protect);
171 fprintf(file, "\n");
172 }
173
174 fprintf(file, "/* Module %s */\n", SubsystemName);
175 fprintf(file, "\n");
176
177 if (more) {
178 WriteIncludes(file, isuser, UseSplitHeaders);
179 }
180 fprintf(file, "#ifdef AUTOTEST\n");
181 fprintf(file, "#ifndef FUNCTION_PTR_T\n");
182 fprintf(file, "#define FUNCTION_PTR_T\n");
183 fprintf(file, "typedef void (*function_ptr_t)");
184 fprintf(file, "(mach_port_t, char *, mach_msg_type_number_t);\n");
185 fprintf(file, "typedef struct {\n");
186 fprintf(file, " char *name;\n");
187 fprintf(file, " function_ptr_t function;\n");
188 fprintf(file, "} function_table_entry;\n");
189 fprintf(file, "typedef function_table_entry *function_table_t;\n");
190 fprintf(file, "#endif /* FUNCTION_PTR_T */\n");
191 fprintf(file, "#endif /* AUTOTEST */\n");
192 fprintf(file, "\n#ifndef\t%s_MSG_COUNT\n", SubsystemName);
193 fprintf(file, "#define\t%s_MSG_COUNT\t%d\n", SubsystemName, rtNumber);
194 fprintf(file, "#endif\t/* %s_MSG_COUNT */\n\n", SubsystemName);
195 }
196
197 static void
198 WriteEpilog(FILE *file, char *protect, boolean_t isuser)
199 {
200 char *defname = isuser ? "__AfterMigUserHeader" : "__AfterMigServerHeader";
201
202 WriteETAPDefines(file);
203 fprintf(file, "\n#ifdef %s\n%s\n#endif /* %s */\n", defname, defname, defname);
204 if (protect != strNULL) {
205 fprintf(file, "\n");
206 fprintf(file, "#endif\t /* _%s */\n", protect);
207 }
208 }
209
210 static void
211 WriteUserRoutine(FILE *file, routine_t *rt)
212 {
213 fprintf(file, "\n");
214 fprintf(file, "/* %s %s */\n", rtRoutineKindToStr(rt->rtKind), rt->rtName);
215 WriteMigExternal(file);
216 fprintf(file, "%s %s\n", ReturnTypeStr(rt), rt->rtUserName);
217 if (BeLint) {
218 fprintf(file, "#if\t%s\n", LintLib);
219 fprintf(file, " (");
220 WriteList(file, rt->rtArgs, WriteNameDecl, akbUserArg, ", " , "");
221 fprintf(file, ")\n");
222 WriteList(file, rt->rtArgs, WriteUserVarDecl, akbUserArg, ";\n", ";\n");
223 fprintf(file, "{ ");
224 fprintf(file, "return ");
225 fprintf(file, "%s(", rt->rtUserName);
226 WriteList(file, rt->rtArgs, WriteNameDecl, akbUserArg, ", ", "");
227 fprintf(file, "); }\n");
228 fprintf(file, "#else\n");
229 }
230 if (BeAnsiC) {
231 fprintf(file, "(\n");
232 WriteList(file, rt->rtArgs, WriteUserVarDecl, akbUserArg, ",\n", "\n");
233 fprintf(file, ");\n");
234 }
235 else {
236 fprintf(file, "#if\t%s\n", NewCDecl);
237 fprintf(file, "(\n");
238 WriteList(file, rt->rtArgs, WriteUserVarDecl, akbUserArg, ",\n", "\n");
239 fprintf(file, ");\n");
240 fprintf(file, "#else\n");
241
242 fprintf(file, " ();\n");
243 fprintf(file, "#endif\t/* %s */\n", NewCDecl);
244 }
245 if (BeLint) {
246 fprintf(file, "#endif\t/* %s */\n", LintLib);
247 }
248 }
249
250 void
251 WriteUserRequestUnion(FILE *file, statement_t *stats)
252 {
253 statement_t *stat;
254
255 fprintf(file, "/* union of all requests */\n\n");
256 fprintf(file, "#ifndef __RequestUnion__%s%s_subsystem__defined\n", UserPrefix, SubsystemName);
257 fprintf(file, "#define __RequestUnion__%s%s_subsystem__defined\n", UserPrefix, SubsystemName);
258 fprintf(file, "union __RequestUnion__%s%s_subsystem {\n", UserPrefix, SubsystemName);
259 for (stat = stats; stat != stNULL; stat = stat->stNext) {
260 if (stat->stKind == skRoutine) {
261 routine_t *rt;
262
263 rt = stat->stRoutine;
264 fprintf(file, "\t__Request__%s_t Request_%s;\n", rt->rtName, rt->rtUserName);
265 }
266 }
267 fprintf(file, "};\n");
268 fprintf(file, "#endif /* !__RequestUnion__%s%s_subsystem__defined */\n", UserPrefix, SubsystemName);
269 }
270
271 void
272 WriteUserReplyUnion(FILE *file, statement_t *stats)
273 {
274 statement_t *stat;
275
276 fprintf(file, "/* union of all replies */\n\n");
277 fprintf(file, "#ifndef __ReplyUnion__%s%s_subsystem__defined\n", UserPrefix, SubsystemName);
278 fprintf(file, "#define __ReplyUnion__%s%s_subsystem__defined\n", UserPrefix, SubsystemName);
279 fprintf(file, "union __ReplyUnion__%s%s_subsystem {\n", UserPrefix, SubsystemName);
280 for (stat = stats; stat != stNULL; stat = stat->stNext) {
281 if (stat->stKind == skRoutine) {
282 routine_t *rt;
283
284 rt = stat->stRoutine;
285 fprintf(file, "\t__Reply__%s_t Reply_%s;\n", rt->rtName, rt->rtUserName);
286 }
287 }
288 fprintf(file, "};\n");
289 fprintf(file, "#endif /* !__RequestUnion__%s%s_subsystem__defined */\n", UserPrefix, SubsystemName);
290 }
291
292 void
293 WriteUserHeader(FILE *file, statement_t *stats)
294 {
295 statement_t *stat;
296 char *protect = strconcat(SubsystemName, "_user_");
297
298 WriteProlog(file, protect, TRUE, TRUE);
299 for (stat = stats; stat != stNULL; stat = stat->stNext)
300 switch (stat->stKind) {
301
302 case skImport:
303 case skUImport:
304 case skDImport:
305 WriteImport(file, stat->stFileName);
306 break;
307
308 case skRoutine:
309 case skSImport:
310 case skIImport:
311 break;
312
313 default:
314 fatal("WriteHeader(): bad statement_kind_t (%d)", (int) stat->stKind);
315 }
316 fprintf(file, "\n");
317 fprintf(file, "#ifdef __BeforeMigUserHeader\n");
318 fprintf(file, "__BeforeMigUserHeader\n");
319 fprintf(file, "#endif /* __BeforeMigUserHeader */\n");
320 fprintf(file, "\n");
321 fprintf(file, "#include <sys/cdefs.h>\n");
322 fprintf(file, "__BEGIN_DECLS\n");
323 fprintf(file, "\n");
324 for (stat = stats; stat != stNULL; stat = stat->stNext) {
325 if (stat->stKind == skRoutine)
326 WriteUserRoutine(file, stat->stRoutine);
327 }
328 fprintf(file, "\n");
329 fprintf(file, "__END_DECLS\n");
330
331 fprintf(file, "\n");
332 fprintf(file, "/********************** Caution **************************/\n");
333 fprintf(file, "/* The following data types should be used to calculate */\n");
334 fprintf(file, "/* maximum message sizes only. The actual message may be */\n");
335 fprintf(file, "/* smaller, and the position of the arguments within the */\n");
336 fprintf(file, "/* message layout may vary from what is presented here. */\n");
337 fprintf(file, "/* For example, if any of the arguments are variable- */\n");
338 fprintf(file, "/* sized, and less than the maximum is sent, the data */\n");
339 fprintf(file, "/* will be packed tight in the actual message to reduce */\n");
340 fprintf(file, "/* the presence of holes. */\n");
341 fprintf(file, "/********************** Caution **************************/\n");
342 fprintf(file, "\n");
343
344 WriteRequestTypes(file, stats);
345 WriteUserRequestUnion(file, stats);
346
347 WriteReplyTypes(file, stats);
348 WriteUserReplyUnion(file, stats);
349
350 WriteEpilog(file, protect, TRUE);
351 }
352
353 static void
354 WriteDefinesRoutine(FILE *file, routine_t *rt)
355 {
356 char *up = (char *)malloc(strlen(rt->rtName)+1);
357
358 up = toupperstr(strcpy(up, rt->rtName));
359 fprintf(file, "#define\tMACH_ID_%s\t\t%d\t/* %s() */\n", up, rt->rtNumber + SubsystemBase, rt->rtName);
360 if (rt->rtKind == rkRoutine)
361 fprintf(file, "#define\tMACH_ID_%s_REPLY\t\t%d\t/* %s() */\n", up, rt->rtNumber + SubsystemBase + 100, rt->rtName);
362 fprintf(file, "\n");
363 }
364
365 void
366 WriteServerRoutine(FILE *file, routine_t *rt)
367 {
368 fprintf(file, "\n");
369 fprintf(file, "/* %s %s */\n", rtRoutineKindToStr(rt->rtKind), rt->rtName);
370 WriteMigExternal(file);
371
372 // MIG_SERVER_ROUTINE can be defined by system headers to resolve to an attribute that
373 // tells the compiler that this is a MIG server routine. Useful for static analysis.
374 fprintf(file, "MIG_SERVER_ROUTINE\n%s %s\n", ReturnTypeStr(rt), rt->rtServerName);
375
376 if (BeLint) {
377 fprintf(file, "#if\t%s\n", LintLib);
378 fprintf(file, " (");
379 WriteList(file, rt->rtArgs, WriteNameDecl, akbServerArg, ", " , "");
380 fprintf(file, ")\n");
381 WriteList(file, rt->rtArgs, WriteServerVarDecl, akbServerArg, ";\n", ";\n");
382 fprintf(file, "{ ");
383 fprintf(file, "return ");
384 fprintf(file, "%s(", rt->rtServerName);
385 WriteList(file, rt->rtArgs, WriteNameDecl, akbServerArg, ", ", "");
386 fprintf(file, "); }\n");
387 fprintf(file, "#else /* %s */\n",LintLib);
388 }
389 if (BeAnsiC) {
390 fprintf(file, "(\n");
391 WriteList(file, rt->rtArgs, WriteServerVarDecl, akbServerArg, ",\n", "\n");
392 fprintf(file, ");\n");
393 }
394 else {
395 fprintf(file, "#if\t%s\n", NewCDecl);
396 fprintf(file, "(\n");
397 WriteList(file, rt->rtArgs, WriteServerVarDecl, akbServerArg, ",\n", "\n");
398 fprintf(file, ");\n");
399 fprintf(file, "#else\n");
400
401 fprintf(file, " ();\n");
402 fprintf(file, "#endif\t/* %s */\n", NewCDecl);
403 }
404 if (BeLint) {
405 fprintf(file, "#endif\t/* %s */\n", LintLib);
406 }
407 }
408
409 static void
410 WriteDispatcher(FILE *file)
411 {
412 statement_t *stat;
413 int descr_count = 0;
414
415 for (stat = stats; stat != stNULL; stat = stat->stNext)
416 if (stat->stKind == skRoutine) {
417 routine_t *rt = stat->stRoutine;
418 descr_count += rtCountArgDescriptors(rt->rtArgs, (int *) 0);
419 }
420 fprintf(file, "\n");
421
422 WriteMigExternal(file);
423 fprintf(file, "boolean_t %s(\n", ServerDemux);
424 fprintf(file, "\t\tmach_msg_header_t *InHeadP,\n");
425 fprintf(file, "\t\tmach_msg_header_t *OutHeadP);\n\n");
426
427 WriteMigExternal(file);
428 fprintf(file, "mig_routine_t %s_routine(\n", ServerDemux);
429 fprintf(file, "\t\tmach_msg_header_t *InHeadP);\n\n");
430
431 fprintf(file, "\n/* Description of this subsystem, for use in direct RPC */\n");
432 fprintf(file, "extern const struct %s {\n", ServerSubsys);
433 if (UseRPCTrap) {
434 fprintf(file, "\tstruct subsystem *\tsubsystem;\t/* Reserved for system use */\n");
435 }
436 else {
437 fprintf(file, "\tmig_server_routine_t\tserver;\t/* Server routine */\n");
438 }
439 fprintf(file, "\tmach_msg_id_t\tstart;\t/* Min routine number */\n");
440 fprintf(file, "\tmach_msg_id_t\tend;\t/* Max routine number + 1 */\n");
441 fprintf(file, "\tunsigned int\tmaxsize;\t/* Max msg size */\n");
442 if (UseRPCTrap) {
443 fprintf(file, "\tvm_address_t\tbase_addr;\t/* Base address */\n");
444 fprintf(file, "\tstruct rpc_routine_descriptor\t/*Array of routine descriptors */\n");
445 }
446 else {
447 fprintf(file, "\tvm_address_t\treserved;\t/* Reserved */\n");
448 fprintf(file, "\tstruct routine_descriptor\t/*Array of routine descriptors */\n");
449 }
450 fprintf(file, "\t\troutine[%d];\n", rtNumber);
451 if (UseRPCTrap) {
452 fprintf(file, "\tstruct rpc_routine_arg_descriptor\t/*Array of arg descriptors */\n");
453 fprintf(file, "\t\targ_descriptor[%d];\n", descr_count);
454 }
455 fprintf(file, "} %s;\n", ServerSubsys);
456 fprintf(file, "\n");
457 }
458
459 void
460 WriteBogusServerRoutineAnnotationDefine(FILE *file) {
461 // MIG_SERVER_ROUTINE can be defined by system headers to resolve to
462 // an attribute that tells the compiler that this is a MIG server routine.
463 // Useful for static analysis.
464 fprintf(file, "#ifndef MIG_SERVER_ROUTINE\n");
465 fprintf(file, "#define MIG_SERVER_ROUTINE\n");
466 fprintf(file, "#endif\n");
467 fprintf(file, "\n");
468 }
469
470 void
471 WriteServerHeader(FILE *file, statement_t *stats)
472 {
473 statement_t *stat;
474 char *protect = strconcat(SubsystemName, "_server_");
475
476 WriteProlog(file, protect, TRUE, FALSE);
477 for (stat = stats; stat != stNULL; stat = stat->stNext)
478 switch (stat->stKind) {
479
480 case skImport:
481 case skSImport:
482 case skDImport:
483 WriteImport(file, stat->stFileName);
484 break;
485
486 case skRoutine:
487 case skUImport:
488 case skIImport:
489 break;
490
491 default:
492 fatal("WriteServerHeader(): bad statement_kind_t (%d)", (int) stat->stKind);
493 }
494 fprintf(file, "\n#ifdef __BeforeMigServerHeader\n");
495 fprintf(file, "__BeforeMigServerHeader\n");
496 fprintf(file, "#endif /* __BeforeMigServerHeader */\n\n");
497
498 WriteBogusServerRoutineAnnotationDefine(file);
499
500 for (stat = stats; stat != stNULL; stat = stat->stNext) {
501 if (stat->stKind == skRoutine)
502 WriteServerRoutine(file, stat->stRoutine);
503 }
504 WriteDispatcher(file);
505
506 WriteRequestTypes(file, stats);
507 WriteServerRequestUnion(file, stats);
508
509 WriteReplyTypes(file, stats);
510 WriteServerReplyUnion(file, stats);
511
512 WriteEpilog(file, protect, FALSE);
513 }
514
515 static void
516 WriteInternalRedefine(FILE *file, routine_t *rt)
517 {
518 fprintf(file, "#define %s %s_external\n", rt->rtUserName, rt->rtUserName);
519 }
520
521 void
522 WriteInternalHeader(FILE *file, statement_t *stats)
523 {
524 statement_t *stat;
525
526 for (stat = stats; stat != stNULL; stat = stat->stNext)
527 switch (stat->stKind) {
528
529 case skRoutine:
530 WriteInternalRedefine(file, stat->stRoutine);
531 break;
532
533 case skImport:
534 case skUImport:
535 case skSImport:
536 case skDImport:
537 case skIImport:
538 break;
539
540 default:
541 fatal("WriteInternalHeader(): bad statement_kind_t (%d)", (int) stat->stKind);
542 }
543 }
544
545 void
546 WriteDefinesHeader(FILE *file, statement_t *stats)
547 {
548 statement_t *stat;
549 char *protect = strconcat(SubsystemName, "_defines");
550
551 WriteProlog(file, protect, FALSE, FALSE);
552 fprintf(file, "\n/*\tDefines related to the Subsystem %s\t*/\n\n", SubsystemName);
553 for (stat = stats; stat != stNULL; stat = stat->stNext)
554 switch (stat->stKind) {
555
556 case skRoutine:
557 WriteDefinesRoutine(file, stat->stRoutine);
558 break;
559
560 case skImport:
561 case skSImport:
562 case skUImport:
563 break;
564
565 default:
566 fatal("WriteDefinesHeader(): bad statement_kind_t (%d)", (int) stat->stKind);
567 }
568 WriteEpilog(file, protect, FALSE);
569 }