Warning: Undefined variable $n in /usr/local/www/websvn.planix.org/include/diff_util.php on line 243

Warning: Undefined variable $n in /usr/local/www/websvn.planix.org/include/diff_util.php on line 247

Warning: Undefined variable $m in /usr/local/www/websvn.planix.org/include/diff_util.php on line 251
WebSVN – tendra.SVN – Diff – /trunk/src/utilities/sid/c-output.c – Rev 2 and 7

Subversion Repositories tendra.SVN

Rev

Rev 2 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2 Rev 7
Line -... Line 1...
-
 
1
/*
-
 
2
 * Copyright (c) 2002-2005 The TenDRA Project <http://www.tendra.org/>.
-
 
3
 * All rights reserved.
-
 
4
 *
-
 
5
 * Redistribution and use in source and binary forms, with or without
-
 
6
 * modification, are permitted provided that the following conditions are met:
-
 
7
 *
-
 
8
 * 1. Redistributions of source code must retain the above copyright notice,
-
 
9
 *    this list of conditions and the following disclaimer.
-
 
10
 * 2. Redistributions in binary form must reproduce the above copyright notice,
-
 
11
 *    this list of conditions and the following disclaimer in the documentation
-
 
12
 *    and/or other materials provided with the distribution.
-
 
13
 * 3. Neither the name of The TenDRA Project nor the names of its contributors
-
 
14
 *    may be used to endorse or promote products derived from this software
-
 
15
 *    without specific, prior written permission.
-
 
16
 *
-
 
17
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
-
 
18
 * IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-
 
19
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-
 
20
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
-
 
21
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-
 
22
 * EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-
 
23
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-
 
24
 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-
 
25
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-
 
26
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-
 
27
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
 
28
 *
-
 
29
 * $Id$
-
 
30
 */
1
/*
31
/*
2
    		 Crown Copyright (c) 1997
32
    		 Crown Copyright (c) 1997
3
    
33
 
4
    This TenDRA(r) Computer Program is subject to Copyright
34
    This TenDRA(r) Computer Program is subject to Copyright
5
    owned by the United Kingdom Secretary of State for Defence
35
    owned by the United Kingdom Secretary of State for Defence
6
    acting through the Defence Evaluation and Research Agency
36
    acting through the Defence Evaluation and Research Agency
7
    (DERA).  It is made available to Recipients with a
37
    (DERA).  It is made available to Recipients with a
8
    royalty-free licence for its use, reproduction, transfer
38
    royalty-free licence for its use, reproduction, transfer
9
    to other parties and amendment for any purpose not excluding
39
    to other parties and amendment for any purpose not excluding
10
    product development provided that any such use et cetera
40
    product development provided that any such use et cetera
11
    shall be deemed to be acceptance of the following conditions:-
41
    shall be deemed to be acceptance of the following conditions:-
12
    
42
 
13
        (1) Its Recipients shall ensure that this Notice is
43
        (1) Its Recipients shall ensure that this Notice is
14
        reproduced upon any copies or amended versions of it;
44
        reproduced upon any copies or amended versions of it;
15
    
45
 
16
        (2) Any amended version of it shall be clearly marked to
46
        (2) Any amended version of it shall be clearly marked to
17
        show both the nature of and the organisation responsible
47
        show both the nature of and the organisation responsible
18
        for the relevant amendment or amendments;
48
        for the relevant amendment or amendments;
19
    
49
 
20
        (3) Its onward transfer from a recipient to another
50
        (3) Its onward transfer from a recipient to another
21
        party shall be deemed to be that party's acceptance of
51
        party shall be deemed to be that party's acceptance of
22
        these conditions;
52
        these conditions;
23
    
53
 
24
        (4) DERA gives no warranty or assurance as to its
54
        (4) DERA gives no warranty or assurance as to its
25
        quality or suitability for any purpose and DERA accepts
55
        quality or suitability for any purpose and DERA accepts
26
        no liability whatsoever in relation to any use to which
56
        no liability whatsoever in relation to any use to which
27
        it may be put.
57
        it may be put.
28
*/
58
*/
Line 101... Line 131...
101
static unsigned out_current_label;
131
static unsigned out_current_label;
102
 
132
 
103
/*--------------------------------------------------------------------------*/
133
/*--------------------------------------------------------------------------*/
104
 
134
 
105
static void
135
static void
106
c_output_indent PROTO_N ((info, indent))
136
c_output_indent(COutputInfoP info, unsigned indent)
107
		PROTO_T (COutputInfoP info X
-
 
108
			 unsigned     indent)
-
 
109
{
137
{
110
    output_indent (c_out_info_info (info), indent);
138
    output_indent(c_out_info_info(info), indent);
111
}
139
}
112
#ifdef FS_FAST
140
#ifdef FS_FAST
113
#define c_output_indent(info, indent) \
141
#define c_output_indent(info, indent)\
114
	output_indent (c_out_info_info (info), indent)
142
	output_indent(c_out_info_info(info), indent)
115
#endif /* defined (FS_FAST) */
143
#endif /* defined (FS_FAST) */
116
 
144
 
117
static void
145
static void
118
c_output_identification PROTO_N ((info))
146
c_output_identification(COutputInfoP info)
119
			PROTO_T (COutputInfoP info)
-
 
120
{
147
{
121
    OStreamP ostream = c_out_info_ostream (info);
148
    OStreamP ostream = c_out_info_ostream(info);
122
 
149
 
123
    write_cstring (ostream, "/*");
150
    write_cstring (ostream, "/*");
124
    write_newline (ostream);
151
    write_newline (ostream);
125
    write_cstring (ostream, " * Automatically generated from the files:");
152
    write_cstring (ostream, " * Automatically generated from the files:");
126
    write_newline (ostream);
153
    write_newline (ostream);
127
    write_cstring (ostream, " *\t");
154
    write_cstring (ostream, " *\t");
128
    write_cstring (ostream, c_out_info_source_name (info));
155
    write_cstring (ostream, c_out_info_source_name(info));
129
    write_newline (ostream);
156
    write_newline (ostream);
130
    write_cstring (ostream, " * and");
157
    write_cstring (ostream, " * and");
131
    write_newline (ostream);
158
    write_newline (ostream);
132
    write_cstring (ostream, " *\t");
159
    write_cstring (ostream, " *\t");
133
    write_cstring (ostream, c_out_info_c_source_name (info));
160
    write_cstring (ostream, c_out_info_c_source_name(info));
134
    write_newline (ostream);
161
    write_newline (ostream);
135
    write_cstring (ostream, " * by:");
162
    write_cstring (ostream, " * by:");
136
    write_newline (ostream);
163
    write_newline (ostream);
137
    write_cstring (ostream, " *\t");
164
    write_cstring (ostream, " *\t");
138
    write_cstring (ostream, c_out_info_program_name (info));
165
    write_cstring (ostream, c_out_info_program_name(info));
139
    write_newline (ostream);
166
    write_newline (ostream);
140
    write_cstring (ostream, " */");
167
    write_cstring (ostream, " */");
141
    write_newline (ostream);
168
    write_newline(ostream);
142
    write_newline (ostream);
169
    write_newline(ostream);
143
}
170
}
144
 
171
 
145
static void
172
static void
146
c_output_declaration_1 PROTO_N ((info, rule))
173
c_output_declaration_1(COutputInfoP info, RuleP rule)
147
		       PROTO_T (COutputInfoP info X
-
 
148
				RuleP        rule)
-
 
149
{
174
{
150
    OStreamP ostream = c_out_info_ostream (info);
175
    OStreamP ostream = c_out_info_ostream(info);
151
    EntryP   entry   = rule_entry (rule);
176
    EntryP   entry   = rule_entry(rule);
152
  
177
 
153
    if (rule_is_required (rule)) {
178
    if (rule_is_required(rule)) {
154
	write_cstring (ostream, "extern void ");
179
	write_cstring(ostream, "extern void ");
155
    } else if (rule_needs_function (rule)) {
180
    } else if (rule_needs_function(rule)) {
156
	if (c_out_info_get_split (info) != 0) {
181
	if (c_out_info_get_split(info) != 0) {
157
	    write_cstring (ostream, "extern void ");
182
	    write_cstring(ostream, "extern void ");
158
	} else {
183
	} else {
159
	    write_cstring (ostream, "static void ");
184
	    write_cstring(ostream, "static void ");
160
	}
185
	}
161
    } else {
186
    } else {
162
	return;
187
	return;
163
    }
188
    }
164
    c_output_mapped_key (info, entry);
189
    c_output_mapped_key(info, entry);
165
    write_char (ostream, ' ');
-
 
166
    c_output_type_decl (info, rule_param (rule), rule_result (rule));
190
    c_output_type_decl(info, rule_param(rule), rule_result(rule));
167
    write_char (ostream, ';');
191
    write_char(ostream, ';');
168
    write_newline (ostream);
192
    write_newline(ostream);
169
}
193
}
170
 
194
 
171
static void
195
static void
172
c_output_declaration PROTO_N ((entry, gclosure))
196
c_output_declaration(EntryP entry, GenericP gclosure)
173
		     PROTO_T (EntryP   entry X
-
 
174
			      GenericP gclosure)
-
 
175
{
197
{
176
    if (entry_is_rule (entry)) {
198
    if (entry_is_rule(entry)) {
177
	RuleP        rule = entry_get_rule (entry);
199
	RuleP        rule = entry_get_rule(entry);
178
	COutputInfoP info = (COutputInfoP) gclosure;
200
	COutputInfoP info = (COutputInfoP)gclosure;
179
 
201
 
180
	c_output_declaration_1 (info, rule);
202
	c_output_declaration_1(info, rule);
181
    }
203
    }
182
}
204
}
183
 
205
 
184
static void
206
static void
185
c_output_ext_declaration_1 PROTO_N ((info, rule))
207
c_output_ext_declaration_1(COutputInfoP info, RuleP rule)
186
			   PROTO_T (COutputInfoP info X
-
 
187
				    RuleP        rule)
-
 
188
{
208
{
189
    OStreamP ostream = c_out_info_ostream (info);
209
    OStreamP ostream = c_out_info_ostream(info);
190
    EntryP   entry   = rule_entry (rule);
210
    EntryP   entry   = rule_entry(rule);
191
  
211
 
192
    if (rule_is_required (rule)) {
212
    if (rule_is_required(rule)) {
193
	write_cstring (ostream, "extern void ");
213
	write_cstring(ostream, "extern void ");
194
    } else {
214
    } else {
195
	return;
215
	return;
196
    }
216
    }
197
    c_output_mapped_key (info, entry);
217
    c_output_mapped_key(info, entry);
198
    write_char (ostream, ' ');
-
 
199
    c_output_type_decl (info, rule_param (rule), rule_result (rule));
218
    c_output_type_decl(info, rule_param(rule), rule_result(rule));
200
    write_char (ostream, ';');
219
    write_char(ostream, ';');
201
    write_newline (ostream);
-
 
202
}
-
 
203
 
-
 
204
static void
-
 
205
c_output_ext_declaration PROTO_N ((entry, gclosure))
-
 
206
			 PROTO_T (EntryP   entry X
-
 
207
				  GenericP gclosure)
-
 
208
{
-
 
209
    if (entry_is_rule (entry)) {
-
 
210
	RuleP        rule = entry_get_rule (entry);
-
 
211
	COutputInfoP info = (COutputInfoP) gclosure;
-
 
212
 
-
 
213
	c_output_ext_declaration_1 (info, rule);
-
 
214
    }
-
 
215
}
-
 
216
 
-
 
217
static void
-
 
218
c_output_terminal_1 PROTO_N ((info, entry))
-
 
219
		    PROTO_T (COutputInfoP info X
-
 
220
			     EntryP       entry)
-
 
221
{
-
 
222
    OStreamP ostream = c_out_info_ostream (info);
-
 
223
    BasicP   basic   = entry_get_basic (entry);
-
 
224
 
-
 
225
    write_cstring (ostream, "#define ");
-
 
226
    c_output_mapped_key (info, entry);
-
 
227
    write_cstring (ostream, " (");
-
 
228
    write_unsigned (ostream, basic_terminal (basic));
-
 
229
    write_char (ostream, ')');
-
 
230
    write_newline (ostream);
220
    write_newline(ostream);
231
}
-
 
232
 
-
 
233
static void
-
 
234
c_output_terminal PROTO_N ((entry, gclosure))
-
 
235
		  PROTO_T (EntryP   entry X
-
 
236
			   GenericP gclosure)
-
 
237
{
-
 
238
    if (entry_is_basic (entry)) {
-
 
239
	COutputInfoP info = (COutputInfoP) gclosure;
-
 
240
 
-
 
241
	c_output_terminal_1 (info, entry);
-
 
242
    }
-
 
243
}
-
 
244
 
-
 
245
static void
-
 
246
c_output_static_vars_1 PROTO_N ((entry, gclosure))
-
 
247
		       PROTO_T (EntryP   entry X
-
 
248
				GenericP gclosure)
-
 
249
{
-
 
250
    if (entry_is_rule (entry)) {
-
 
251
	COutputInfoP info = (COutputInfoP) gclosure;
-
 
252
	RuleP        rule = entry_get_rule (entry);
-
 
253
 
-
 
254
	c_output_non_locals (info, rule_non_locals (rule));
-
 
255
    }
-
 
256
}
-
 
257
 
-
 
258
static void
-
 
259
c_output_static_vars_2 PROTO_N ((entry, gclosure))
-
 
260
		       PROTO_T (EntryP   entry X
-
 
261
				GenericP gclosure)
-
 
262
{
-
 
263
    if (entry_is_rule (entry)) {
-
 
264
	COutputInfoP info = (COutputInfoP) gclosure;
-
 
265
	RuleP        rule = entry_get_rule (entry);
-
 
266
 
-
 
267
	c_output_declare_non_locals (info, rule_non_locals (rule));
-
 
268
    }
-
 
269
}
221
}
270
 
222
 
271
static void
223
static void
272
c_output_static_vars PROTO_N ((info, grammar, def))
224
c_output_ext_declaration(EntryP entry, GenericP gclosure)
273
		     PROTO_T (COutputInfoP info X
-
 
274
			      GrammarP     grammar X
-
 
275
			      BoolT        def)
-
 
276
{
225
{
-
 
226
    if (entry_is_rule(entry)) {
-
 
227
	RuleP        rule = entry_get_rule(entry);
-
 
228
	COutputInfoP info = (COutputInfoP)gclosure;
-
 
229
 
-
 
230
	c_output_ext_declaration_1(info, rule);
-
 
231
    }
-
 
232
}
-
 
233
 
-
 
234
static void
-
 
235
c_output_terminal_1(COutputInfoP info, EntryP entry)
-
 
236
{
-
 
237
    OStreamP ostream = c_out_info_ostream(info);
-
 
238
    BasicP   basic   = entry_get_basic(entry);
-
 
239
 
-
 
240
    write_cstring(ostream, "#define ");
-
 
241
    c_output_mapped_key(info, entry);
-
 
242
    write_cstring(ostream, " (");
-
 
243
    write_unsigned(ostream, basic_terminal(basic));
-
 
244
    write_char(ostream, ')');
-
 
245
    write_newline(ostream);
-
 
246
}
-
 
247
 
-
 
248
static void
-
 
249
c_output_terminal(EntryP entry, GenericP gclosure)
-
 
250
{
-
 
251
    if (entry_is_basic(entry)) {
-
 
252
	COutputInfoP info = (COutputInfoP)gclosure;
-
 
253
 
-
 
254
	c_output_terminal_1(info, entry);
-
 
255
    }
-
 
256
}
-
 
257
 
-
 
258
static void
-
 
259
c_output_static_vars_1(EntryP entry, GenericP gclosure)
-
 
260
{
-
 
261
    if (entry_is_rule(entry)) {
-
 
262
	COutputInfoP info = (COutputInfoP)gclosure;
-
 
263
	RuleP        rule = entry_get_rule(entry);
-
 
264
 
-
 
265
	c_output_non_locals(info, rule_non_locals(rule));
-
 
266
    }
-
 
267
}
-
 
268
 
-
 
269
static void
-
 
270
c_output_static_vars_2(EntryP entry, GenericP gclosure)
-
 
271
{
-
 
272
    if (entry_is_rule(entry)) {
-
 
273
	COutputInfoP info = (COutputInfoP)gclosure;
-
 
274
	RuleP        rule = entry_get_rule(entry);
-
 
275
 
-
 
276
	c_output_declare_non_locals(info, rule_non_locals(rule));
-
 
277
    }
-
 
278
}
-
 
279
 
-
 
280
static void
-
 
281
c_output_static_vars(COutputInfoP info, GrammarP grammar, BoolT def)
-
 
282
{
277
    OStreamP ostream        = c_out_info_ostream (info);
283
    OStreamP ostream        = c_out_info_ostream(info);
278
    TableP   table          = grammar_table (grammar);
284
    TableP   table          = grammar_table(grammar);
279
    EntryP   predicate_type = grammar_get_predicate_type (grammar);
285
    EntryP   predicate_type = grammar_get_predicate_type(grammar);
280
 
286
 
281
    if (def) {
287
    if (def) {
282
	write_cstring (ostream, "/* BEGINNING OF STATIC VARIABLES */");
288
	write_cstring (ostream, "/* BEGINNING OF STATIC VARIABLES */");
283
	write_newline (ostream);
289
	write_newline(ostream);
284
	write_newline (ostream);
290
	write_newline(ostream);
285
    }
291
    }
286
    if (predicate_type) {
292
    if (predicate_type) {
287
	if (def) {
293
	if (def) {
288
	    if (c_out_info_get_split (info) == 0) {
294
	    if (c_out_info_get_split(info) == 0) {
289
		write_cstring (ostream, "static ");
295
		write_cstring(ostream, "static ");
290
	    }
296
	    }
291
	} else {
297
	} else {
292
	    write_cstring (ostream, "extern ");
298
	    write_cstring(ostream, "extern ");
293
	}
299
	}
294
	c_output_mapped_key (info, predicate_type);
300
	c_output_mapped_key(info, predicate_type);
295
	write_char (ostream, ' ');
301
	write_char(ostream, ' ');
296
	c_output_key (info, entry_key (grammar_get_predicate_id (grammar)),
302
	c_output_key(info, entry_key(grammar_get_predicate_id(grammar)),
297
		      c_out_info_in_prefix (info));
303
		     c_out_info_in_prefix(info));
298
	write_char (ostream, ';');
304
	write_char(ostream, ';');
299
	write_newline (ostream);
305
	write_newline(ostream);
300
    }
306
    }
301
    if (def) {
307
    if (def) {
302
	table_iter (table, c_output_static_vars_1, (GenericP) info);
308
	table_iter(table, c_output_static_vars_1, (GenericP)info);
303
	write_newline (ostream);
309
	write_newline(ostream);
304
    } else {
310
    } else {
305
	table_iter (table, c_output_static_vars_2, (GenericP) info);
311
	table_iter(table, c_output_static_vars_2, (GenericP)info);
306
    }
312
    }
307
}
313
}
308
 
314
 
309
static void
315
static void
310
c_out_reset_labels PROTO_Z ()
316
c_out_reset_labels(void)
311
{
317
{
312
    out_current_label = 0;
318
    out_current_label = 0;
426
    unsigned count    = 0;
409
    unsigned count    = 0;
427
 
410
 
428
    do {
411
    do {
429
	if (count ++ == 0) {
412
	if (count++ == 0) {
430
	    c_output_indent (info, indent + C_INDENT_STEP - C_INDENT_FOR_CASE);
413
	    c_output_indent(info, indent + C_INDENT_STEP - C_INDENT_FOR_CASE);
431
	} else {
414
	} else {
432
	    write_char (ostream, ' ');
415
	    write_char(ostream, ' ');
433
	}
416
	}
434
	write_cstring (ostream, "case ");
417
	write_cstring(ostream, "case ");
435
	write_unsigned (ostream, terminal);
418
	write_unsigned(ostream, terminal);
436
	write_char (ostream, ':');
419
	write_char(ostream, ':');
437
	if (count == 5) {
420
	if (count == 5) {
438
	    write_newline (ostream);
421
	    write_newline(ostream);
439
	    count = 0;
422
	    count = 0;
440
	}
423
	}
441
    } while (bitvec_next_bit (bitvec, &terminal));
424
    } while (bitvec_next_bit(bitvec, &terminal));
442
    if (count != 0) {
425
    if (count != 0) {
443
	write_newline (ostream);
426
	write_newline(ostream);
444
    }
427
    }
445
}
428
}
446
 
429
 
447
static void
430
static void
448
c_output_break PROTO_N ((info, indent))
431
c_output_break(COutputInfoP info, unsigned indent)
449
	       PROTO_T (COutputInfoP info X
-
 
450
			unsigned     indent)
-
 
451
{
432
{
452
    OStreamP ostream = c_out_info_ostream (info);
433
    OStreamP ostream = c_out_info_ostream(info);
453
 
434
 
454
    c_output_indent (info, indent);
435
    c_output_indent(info, indent);
455
    write_cstring (ostream, "break;");
436
    write_cstring(ostream, "break;");
456
    write_newline (ostream);
437
    write_newline(ostream);
457
}
438
}
458
 
439
 
459
static void
440
static void
460
c_output_return PROTO_N ((info, indent))
441
c_output_return(COutputInfoP info, unsigned indent)
461
		PROTO_T (COutputInfoP info X
-
 
462
			 unsigned     indent)
-
 
463
{
442
{
464
    OStreamP ostream = c_out_info_ostream (info);
443
    OStreamP ostream = c_out_info_ostream(info);
465
 
444
 
466
    c_output_indent (info, indent);
445
    c_output_indent(info, indent);
467
    write_cstring (ostream, "return;");
446
    write_cstring(ostream, "return;");
468
    write_newline (ostream);
447
    write_newline(ostream);
469
}
448
}
470
 
449
 
471
static void
450
static void
472
c_output_error_if PROTO_N ((info, error_terminal, indent))
451
c_output_error_if(COutputInfoP info, unsigned error_terminal, unsigned indent)
473
		  PROTO_T (COutputInfoP info X
-
 
474
			   unsigned     error_terminal X
-
 
475
			   unsigned     indent)
-
 
476
{
-
 
477
    OStreamP ostream = c_out_info_ostream (info);
-
 
478
 
-
 
479
    c_output_indent (info, indent);
-
 
480
    write_cstring (ostream, "if ((CURRENT_TERMINAL) == ");
-
 
481
    write_unsigned (ostream, error_terminal);
-
 
482
    write_cstring (ostream, ") {");
-
 
483
    write_newline (ostream);
-
 
484
}
-
 
485
 
-
 
486
static void
-
 
487
c_output_else PROTO_N ((info, indent))
-
 
488
	      PROTO_T (COutputInfoP info X
-
 
489
		       unsigned     indent)
-
 
490
{
-
 
491
    OStreamP ostream = c_out_info_ostream (info);
-
 
492
 
-
 
493
    c_output_indent (info, indent);
-
 
494
    write_cstring (ostream, "} else {");
-
 
495
    write_newline (ostream);
-
 
496
}
-
 
497
 
-
 
498
static void
-
 
499
c_output_restore PROTO_N ((info, handler_rule, outer_level, indent))
-
 
500
		 PROTO_T (COutputInfoP info X
-
 
501
			  RuleP        handler_rule X
-
 
502
			  BoolT        outer_level X
-
 
503
			  unsigned     indent)
-
 
504
{
-
 
505
    OStreamP ostream = c_out_info_ostream (info);
-
 
506
 
-
 
507
    if (outer_level) {
-
 
508
	c_output_return (info, indent);
-
 
509
    } else {
-
 
510
	c_output_indent (info, indent);
-
 
511
	write_cstring (ostream, "RESTORE_LEXER;");
-
 
512
	write_newline (ostream);
-
 
513
	c_output_jump (info, rule_get_handler_label (handler_rule), indent);
-
 
514
    }
-
 
515
}
-
 
516
 
-
 
517
static void
-
 
518
c_output_check PROTO_N ((info, handler_rule, outer_level, error_terminal,
-
 
519
			 indent))
-
 
520
	       PROTO_T (COutputInfoP info X
-
 
521
			RuleP        handler_rule X
-
 
522
			BoolT        outer_level X
-
 
523
			unsigned     error_terminal X
-
 
524
			unsigned     indent)
-
 
525
{
-
 
526
    c_output_error_if (info, error_terminal, indent);
-
 
527
    c_output_restore (info, handler_rule, outer_level, indent + C_INDENT_STEP);
-
 
528
    c_output_close (info, indent);
-
 
529
}
-
 
530
 
-
 
531
static void
-
 
532
c_output_advance PROTO_N ((info, indent))
-
 
533
		 PROTO_T (COutputInfoP info X
-
 
534
			  unsigned     indent)
-
 
535
{
452
{
536
    OStreamP ostream = c_out_info_ostream (info);
453
    OStreamP ostream = c_out_info_ostream(info);
537
 
454
 
538
    c_output_indent (info, indent);
455
    c_output_indent(info, indent);
-
 
456
    write_cstring(ostream, "if ((CURRENT_TERMINAL) == ");
-
 
457
    write_unsigned(ostream, error_terminal);
539
    write_cstring (ostream, "ADVANCE_LEXER;");
458
    write_cstring(ostream, ") {");
540
    write_newline (ostream);
459
    write_newline(ostream);
541
}
460
}
542
 
461
 
543
static void
462
static void
544
c_output_unreachable PROTO_N ((info, indent))
463
c_output_else(COutputInfoP info, unsigned indent)
-
 
464
{
-
 
465
    OStreamP ostream = c_out_info_ostream(info);
-
 
466
 
545
		     PROTO_T (COutputInfoP info X
467
    c_output_indent(info, indent);
-
 
468
    write_cstring(ostream, "} else {");
-
 
469
    write_newline(ostream);
-
 
470
}
-
 
471
 
-
 
472
static void
-
 
473
c_output_restore(COutputInfoP info, RuleP handler_rule, BoolT outer_level,
546
			      unsigned     indent)
474
		 unsigned indent)
547
{
475
{
548
    OStreamP ostream = c_out_info_ostream (info);
476
    OStreamP ostream = c_out_info_ostream(info);
549
 
477
 
550
    c_output_indent (info, indent);
-
 
551
    if (c_out_info_get_unreachable (info)) {
478
    if (outer_level) {
552
	write_cstring (ostream, "UNREACHED;");
479
	c_output_return(info, indent);
553
    } else {
480
    } else {
-
 
481
	c_output_indent(info, indent);
554
	write_cstring (ostream, "/*UNREACHED*/");
482
	write_cstring(ostream, "RESTORE_LEXER;");
-
 
483
	write_newline(ostream);
-
 
484
	c_output_jump(info, rule_get_handler_label(handler_rule), indent);
555
    }
485
    }
556
    write_newline (ostream);
-
 
557
}
486
}
558
 
487
 
559
static void
488
static void
560
c_output_basic_extract PROTO_N ((info, code, item, key, state, indent))
489
c_output_check(COutputInfoP info, RuleP handler_rule, BoolT outer_level,
561
		       PROTO_T (COutputInfoP info X
490
	       unsigned error_terminal, unsigned indent)
-
 
491
{
-
 
492
    c_output_error_if (info, error_terminal, indent);
-
 
493
    c_output_restore(info, handler_rule, outer_level, indent + C_INDENT_STEP);
562
				CCodeP       code X
494
    c_output_close(info, indent);
-
 
495
}
-
 
496
 
-
 
497
static void
-
 
498
c_output_advance(COutputInfoP info, unsigned indent)
-
 
499
{
563
				ItemP        item X
500
    OStreamP ostream = c_out_info_ostream(info);
-
 
501
 
564
				KeyP         key X
502
    c_output_indent(info, indent);
565
				SaveRStackP  state X
503
    write_cstring(ostream, "ADVANCE_LEXER;");
566
				unsigned     indent)
504
    write_newline(ostream);
-
 
505
}
-
 
506
 
-
 
507
static void
-
 
508
c_output_unreachable(COutputInfoP info, unsigned indent)
567
{
509
{
568
    OStreamP ostream = c_out_info_ostream (info);
510
    OStreamP ostream = c_out_info_ostream(info);
-
 
511
 
-
 
512
    c_output_indent(info, indent);
-
 
513
    if (c_out_info_get_unreachable(info)) {
-
 
514
	write_cstring(ostream, "UNREACHED;");
-
 
515
    } else {
-
 
516
	write_cstring (ostream, "/*UNREACHED*/");
-
 
517
    }
-
 
518
    write_newline(ostream);
-
 
519
}
-
 
520
 
-
 
521
static void
-
 
522
c_output_basic_extract(COutputInfoP info, CCodeP code, ItemP item, KeyP key,
-
 
523
		       SaveRStackP state, unsigned indent)
-
 
524
{
-
 
525
    OStreamP ostream = c_out_info_ostream(info);
569
 
526
 
570
    c_output_key_message (info, "/* BEGINNING OF EXTRACT: ", key, " */",
527
    c_output_key_message (info, "/* BEGINNING OF EXTRACT: ", key, " */",
571
			  indent);
528
			  indent);
572
    c_output_open (info, indent);
529
    c_output_open(info, indent);
573
    c_output_location (info, c_code_file (code), c_code_line (code));
530
    c_output_location(info, c_code_file(code), c_code_line(code));
574
    c_output_c_code_basic (info, code, item_result (item), state);
531
    c_output_c_code_basic(info, code, item_result(item), state);
575
    c_output_location (info, ostream_name (ostream),
532
    c_output_location(info, ostream_name(ostream), ostream_line(ostream) + 1);
576
		       ostream_line (ostream) + 1);
-
 
577
    c_output_close (info, indent);
533
    c_output_close(info, indent);
578
    c_output_key_message (info, "/* END OF EXTRACT: ", key, " */", indent);
534
    c_output_key_message (info, "/* END OF EXTRACT: ", key, " */", indent);
579
}
535
}
580
 
536
 
581
static void
537
static void
582
c_output_basic_in_alt PROTO_N ((info, item, handler_rule, need_switch,
538
c_output_basic_in_alt(COutputInfoP info, ItemP item, RuleP handler_rule,
583
				need_check, outer_level, error_terminal, state,
-
 
584
				indent))
-
 
585
		      PROTO_T (COutputInfoP info X
-
 
586
			       ItemP        item X
-
 
587
			       RuleP        handler_rule X
-
 
588
			       BoolT        need_switch X
-
 
589
			       BoolT        need_check X
-
 
590
			       BoolT        outer_level X
539
		      BoolT need_switch, BoolT need_check, BoolT outer_level,
591
			       unsigned     error_terminal X
540
		      unsigned error_terminal, SaveRStackP state,
592
			       SaveRStackP  state X
-
 
593
			       unsigned     indent)
541
		      unsigned indent)
594
{
542
{
595
    EntryP     entry       = item_entry (item);
543
    EntryP     entry       = item_entry(item);
596
    KeyP       key         = entry_key (entry);
544
    KeyP       key         = entry_key(entry);
597
    BasicP     basic       = entry_get_basic (entry);
545
    BasicP     basic       = entry_get_basic(entry);
598
    unsigned   terminal    = basic_terminal (basic);
546
    unsigned   terminal    = basic_terminal(basic);
599
    CCodeP     code        = basic_get_result_code (basic);
547
    CCodeP     code        = basic_get_result_code(basic);
600
    unsigned   code_indent = (need_switch ? indent + C_INDENT_STEP : indent);
548
    unsigned   code_indent = (need_switch ? indent + C_INDENT_STEP : indent);
601
 
549
 
602
    if (need_switch) {
550
    if (need_switch) {
603
	c_output_switch (info, indent);
551
	c_output_switch (info, indent);
604
	c_output_case (info, terminal, indent);
552
	c_output_case(info, terminal, indent);
605
	if (code) {
553
	if (code) {
606
	    c_output_basic_extract (info, code, item, key, state, code_indent);
554
	    c_output_basic_extract(info, code, item, key, state, code_indent);
-
 
555
	}
-
 
556
	c_output_break(info, code_indent);
-
 
557
	if (need_check) {
-
 
558
	    c_output_case(info, error_terminal, indent);
-
 
559
	    c_output_restore(info, handler_rule, outer_level, code_indent);
607
	}
560
	}
608
	c_output_break (info, code_indent);
-
 
609
	if (need_check) {
-
 
610
	    c_output_case (info, error_terminal, indent);
-
 
611
	    c_output_restore (info, handler_rule, outer_level, code_indent);
-
 
612
	}
-
 
613
	c_output_default (info, indent);
561
	c_output_default(info, indent);
614
	c_output_jump (info, rule_get_handler_label (handler_rule),
562
	c_output_jump(info, rule_get_handler_label(handler_rule), code_indent);
615
		       code_indent);
-
 
616
	c_output_close (info, indent);
563
	c_output_close(info, indent);
617
    } else {
564
    } else {
618
	ASSERT (!need_check);
565
	ASSERT(!need_check);
619
	if (code) {
566
	if (code) {
620
	    c_output_basic_extract (info, code, item, key, state, code_indent);
567
	    c_output_basic_extract(info, code, item, key, state, code_indent);
621
	}
568
	}
622
    }
569
    }
623
    c_output_advance (info, indent);
570
    c_output_advance(info, indent);
624
}
571
}
625
 
572
 
626
static void
573
static void
627
c_output_tail_call PROTO_N ((info, item, handler_rule, need_check, outer_level,
574
c_output_tail_call(COutputInfoP info, ItemP item, RuleP handler_rule,
628
			     error_terminal, rstack, non_local_stack, state,
-
 
629
			     indent))
-
 
630
		   PROTO_T (COutputInfoP info X
-
 
631
			    ItemP        item X
-
 
632
			    RuleP        handler_rule X
-
 
633
			    BoolT        need_check X
-
 
634
			    BoolT        outer_level X
575
		   BoolT need_check, BoolT outer_level,
635
			    unsigned     error_terminal X
576
		   unsigned error_terminal, RStackP rstack,
636
			    RStackP      rstack X
-
 
637
			    RStackP      non_local_stack X
577
		   RStackP non_local_stack, SaveRStackP state,
638
			    SaveRStackP  state X
-
 
639
			    unsigned     indent)
578
		   unsigned indent)
640
{
579
{
641
    unsigned code_indent = (need_check ? indent + C_INDENT_STEP : indent);
580
    unsigned code_indent = (need_check ? indent + C_INDENT_STEP : indent);
642
    EntryP   entry       = item_entry (item);
581
    EntryP   entry       = item_entry(item);
643
    RuleP    rule        = entry_get_rule (entry);
582
    RuleP    rule        = entry_get_rule(entry);
644
    KeyP     key         = entry_key (entry);
583
    KeyP     key         = entry_key(entry);
645
 
584
 
646
    if (need_check) {
585
    if (need_check) {
647
	c_output_error_if (info, error_terminal, indent);
586
	c_output_error_if (info, error_terminal, indent);
648
	c_output_restore (info, handler_rule, outer_level, code_indent);
587
	c_output_restore(info, handler_rule, outer_level, code_indent);
649
	c_output_else (info, indent);
588
	c_output_else(info, indent);
650
    }
589
    }
651
    c_output_restore_non_locals (info, rule, indent, rstack, non_local_stack);
590
    c_output_restore_non_locals(info, rule, indent, rstack, non_local_stack);
652
    c_output_tail_decls (info, item_param (item), state, rule_param (rule),
591
    c_output_tail_decls(info, item_param(item), state, rule_param(rule),
653
			 rule_rstack_state (rule), code_indent);
592
			rule_rstack_state(rule), code_indent);
654
    c_output_key_jump (info, key, rule_get_start_label (rule), code_indent);
593
    c_output_key_jump(info, key, rule_get_start_label(rule), code_indent);
655
    if (need_check) {
594
    if (need_check) {
656
	c_output_close (info, indent);
595
	c_output_close(info, indent);
657
    }
596
    }
658
}
597
}
659
 
598
 
660
static BoolT				c_output_rule
-
 
661
	PROTO_S ((COutputInfoP, RuleP, RuleP, EntryListP, BoolT, EntryP,
599
static BoolT c_output_rule(COutputInfoP, RuleP, RuleP, EntryListP, BoolT,
662
		  unsigned, unsigned, RStackP, RStackP, TableP));
600
			   EntryP, unsigned, unsigned, RStackP, RStackP,
-
 
601
			   TableP);
663
 
602
 
664
static BoolT
603
static BoolT
665
c_output_rule_in_alt PROTO_N ((info, item, handler_rule, call_list, need_check,
604
c_output_rule_in_alt(COutputInfoP info, ItemP item, RuleP handler_rule,
666
			       outer_level, predicate_id, error_terminal,
605
		     EntryListP call_list, BoolT need_check, BoolT outer_level,
667
			       indent, rstack, non_local_stack, table,
-
 
668
			       reachable_ref))
-
 
669
		     PROTO_T (COutputInfoP info X
-
 
670
			      ItemP        item X
-
 
671
			      RuleP        handler_rule X
-
 
672
			      EntryListP   call_list X
-
 
673
			      BoolT        need_check X
-
 
674
			      BoolT        outer_level X
-
 
675
			      EntryP       predicate_id X
-
 
676
			      unsigned     error_terminal X
606
		     EntryP predicate_id, unsigned error_terminal,
677
			      unsigned     indent X
-
 
678
			      RStackP      rstack X
-
 
679
			      RStackP      non_local_stack X
607
		     unsigned indent, RStackP rstack, RStackP non_local_stack,
680
			      TableP       table X
-
 
681
			      BoolT       *reachable_ref)
608
		     TableP table, BoolT *reachable_ref)
682
{
609
{
683
    OStreamP    ostream   = c_out_info_ostream (info);
610
    OStreamP    ostream   = c_out_info_ostream(info);
684
    EntryP      entry     = item_entry (item);
611
    EntryP      entry     = item_entry(item);
685
    RuleP       rule      = entry_get_rule (entry);
612
    RuleP       rule      = entry_get_rule(entry);
686
    KeyP        key       = entry_key (entry);
613
    KeyP        key       = entry_key(entry);
687
    BoolT       tail_call = (item_is_tail_call (item) &&
614
    BoolT       tail_call = (item_is_tail_call(item) &&
688
			     rule_is_being_output (rule));
615
			     rule_is_being_output(rule));
689
    SaveRStackT state;
616
    SaveRStackT state;
690
 
617
 
691
    rstack_save_state (rstack, &state);
618
    rstack_save_state(rstack, &state);
692
    if ((item_is_inlinable (item)) &&
619
    if ((item_is_inlinable(item)) &&
693
	(tail_call || (!(rule_is_being_output (rule) ||
620
	(tail_call || (!(rule_is_being_output(rule) ||
694
			 (rule_get_call_count (rule) > 1))))) {
621
			 (rule_get_call_count(rule) > 1))))) {
695
	c_output_key_message (info, "/* BEGINNING OF INLINE: ", key, " */",
622
	c_output_key_message (info, "/* BEGINNING OF INLINE: ", key, " */",
696
			      indent);
623
			      indent);
697
	if (tail_call) {
624
	if (tail_call) {
698
	    c_output_tail_call (info, item, handler_rule, need_check,
625
	    c_output_tail_call(info, item, handler_rule, need_check,
699
				outer_level, error_terminal, rstack,
626
			       outer_level, error_terminal, rstack,
700
				non_local_stack, &state, indent);
627
			       non_local_stack, &state, indent);
701
	    *reachable_ref = FALSE;
628
	    *reachable_ref = FALSE;
702
	} else {
629
	} else {
703
	    unsigned code_indent = (indent + C_INDENT_STEP);
630
	    unsigned code_indent = (indent + C_INDENT_STEP);
704
	    BoolT    copies;
631
	    BoolT    copies;
705
 
632
 
706
	    c_output_open (info, indent);
633
	    c_output_open(info, indent);
707
	    rstack_push_frame (rstack);
634
	    rstack_push_frame(rstack);
708
	    copies = c_output_required_copies (info, rule_param (rule),
635
	    copies = c_output_required_copies(info, rule_param(rule),
709
					       item_param (item), rstack,
636
					      item_param(item), rstack,
710
					       &state, code_indent, table);
637
					      &state, code_indent, table);
711
	    if (copies) {
638
	    if (copies) {
712
		c_output_open (info, code_indent);
639
		c_output_open(info, code_indent);
713
		code_indent += C_INDENT_STEP;
640
		code_indent += C_INDENT_STEP;
714
	    }
641
	    }
715
	    rstack_save_state (rstack, &state);
642
	    rstack_save_state(rstack, &state);
716
	    rstack_push_frame (rstack);
643
	    rstack_push_frame(rstack);
717
	    rstack_compute_formal_inlining (rstack, rule_param (rule),
644
	    rstack_compute_formal_inlining(rstack, rule_param(rule),
718
					    item_param (item));
645
					   item_param(item));
719
	    rstack_compute_formal_inlining (rstack, rule_result (rule),
646
	    rstack_compute_formal_inlining(rstack, rule_result(rule),
720
					    item_result (item));
647
					   item_result(item));
721
	    rstack_save_state (rstack, rule_rstack_state (rule));
648
	    rstack_save_state(rstack, rule_rstack_state(rule));
722
	    if (!c_output_rule (info, rule, handler_rule,
649
	    if (!c_output_rule(info, rule, handler_rule,
723
				item_is_tail_call (item) ? call_list :
650
			       item_is_tail_call(item)? call_list :
724
				rule_call_list (rule), need_check,
651
			       rule_call_list(rule), need_check,
725
				predicate_id, error_terminal, code_indent,
652
			       predicate_id, error_terminal, code_indent,
726
				rstack, non_local_stack, table)) {
653
			       rstack, non_local_stack, table)) {
727
		*reachable_ref = FALSE;
654
		*reachable_ref = FALSE;
728
	    }
655
	    }
729
	    rstack_pop_frame (rstack);
656
	    rstack_pop_frame(rstack);
730
	    if (copies) {
657
	    if (copies) {
731
		c_output_close (info, indent + C_INDENT_STEP);
658
		c_output_close(info, indent + C_INDENT_STEP);
732
	    }
659
	    }
733
	    rstack_pop_frame (rstack);
660
	    rstack_pop_frame(rstack);
734
	    c_output_close (info, indent);
661
	    c_output_close(info, indent);
735
	}
662
	}
736
	c_output_key_message (info, "/* END OF INLINE: ", key, " */", indent);
663
	c_output_key_message (info, "/* END OF INLINE: ", key, " */", indent);
737
	return (FALSE);
664
	return(FALSE);
738
    }
665
    }
739
    if (need_check && outer_level) {
666
    if (need_check && outer_level) {
740
	c_output_check (info, handler_rule, TRUE, error_terminal, indent);
667
	c_output_check(info, handler_rule, TRUE, error_terminal, indent);
741
    }
668
    }
742
    c_output_indent (info, indent);
669
    c_output_indent(info, indent);
743
    c_output_mapped_key (info, entry);
670
    c_output_mapped_key(info, entry);
744
    write_cstring (ostream, " (");
671
    write_cstring(ostream, " (");
745
    c_output_rule_params (info, item_param (item), item_result (item), &state);
672
    c_output_rule_params(info, item_param(item), item_result(item), &state);
746
    write_cstring (ostream, ");");
673
    write_cstring(ostream, ");");
747
    write_newline (ostream);
674
    write_newline(ostream);
748
    return (TRUE);
675
    return(TRUE);
749
}
676
}
750
 
677
 
751
static void
678
static void
752
c_output_action_in_alt PROTO_N ((info, item, handler_rule, need_check,
679
c_output_action_in_alt(COutputInfoP info, ItemP item, RuleP handler_rule,
753
				 outer_level, error_terminal, rstack, indent,
-
 
754
				 table))
-
 
755
		       PROTO_T (COutputInfoP info X
-
 
756
				ItemP        item X
-
 
757
				RuleP        handler_rule X
-
 
758
				BoolT        need_check X
-
 
759
				BoolT        outer_level X
680
		       BoolT need_check, BoolT outer_level,
760
				unsigned     error_terminal X
681
		       unsigned error_terminal, RStackP rstack,
761
				RStackP      rstack X
-
 
762
				unsigned     indent X
682
		       unsigned indent, TableP table)
763
				TableP       table)
-
 
764
{
683
{
765
    OStreamP    ostream = c_out_info_ostream (info);
684
    OStreamP    ostream = c_out_info_ostream(info);
766
    EntryP      entry   = item_entry (item);
685
    EntryP      entry   = item_entry(item);
767
    ActionP     action  = entry_get_action (entry);
686
    ActionP     action  = entry_get_action(entry);
768
    KeyP        key     = entry_key (entry);
687
    KeyP        key     = entry_key(entry);
769
    CCodeP      code    = action_get_code (action);
688
    CCodeP      code    = action_get_code(action);
770
    SaveRStackT state;
689
    SaveRStackT state;
771
    BoolT       copies;
690
    BoolT       copies;
772
 
691
 
773
    if (need_check) {
692
    if (need_check) {
774
	c_output_check (info, handler_rule, outer_level, error_terminal,
693
	c_output_check(info, handler_rule, outer_level, error_terminal,
775
			indent);
694
		       indent);
776
    }
695
    }
777
    c_output_key_message (info, "/* BEGINNING OF ACTION: ", key, " */",
696
    c_output_key_message (info, "/* BEGINNING OF ACTION: ", key, " */",
778
			  indent);
697
			  indent);
779
    c_output_open (info, indent);
698
    c_output_open(info, indent);
780
    rstack_save_state (rstack, &state);
699
    rstack_save_state(rstack, &state);
781
    rstack_push_frame (rstack);
700
    rstack_push_frame(rstack);
782
    copies = c_output_required_copies (info, c_code_param (code),
701
    copies = c_output_required_copies(info, c_code_param(code),
783
				       item_param (item), rstack, &state,
702
				      item_param(item), rstack, &state,
784
				       indent + C_INDENT_STEP, table);
703
				      indent + C_INDENT_STEP, table);
785
    if (copies) {
704
    if (copies) {
786
	c_output_open (info, indent + C_INDENT_STEP);
705
	c_output_open(info, indent + C_INDENT_STEP);
787
    }
706
    }
788
    rstack_save_state (rstack, &state);
707
    rstack_save_state(rstack, &state);
789
    c_output_location (info, c_code_file (code), c_code_line (code));
708
    c_output_location(info, c_code_file(code), c_code_line(code));
790
    c_output_c_code_action (info, code, item_param (item),
709
    c_output_c_code_action(info, code, item_param(item),
791
			    item_result (item), &state, handler_rule);
710
			   item_result(item), &state, handler_rule);
792
    c_output_location (info, ostream_name (ostream),
711
    c_output_location(info, ostream_name(ostream), ostream_line(ostream) + 1);
793
		       ostream_line (ostream) + 1);
-
 
794
    rstack_pop_frame (rstack);
712
    rstack_pop_frame(rstack);
795
    if (copies) {
713
    if (copies) {
796
	c_output_close (info, indent + C_INDENT_STEP);
714
	c_output_close(info, indent + C_INDENT_STEP);
797
    }
715
    }
798
    c_output_close (info, indent);
716
    c_output_close(info, indent);
799
    c_output_key_message (info, "/* END OF ACTION: ", key, " */", indent);
717
    c_output_key_message (info, "/* END OF ACTION: ", key, " */", indent);
800
}
718
}
801
 
719
 
802
static void
720
static void
803
c_output_predicate_in_alt PROTO_N ((info, rule, item, initial, handler_rule,
721
c_output_predicate_in_alt(COutputInfoP info, RuleP rule, ItemP item,
804
				    needed_switch, need_check, outer_level,
-
 
805
				    predicate_id, error_terminal, rstack,
-
 
806
				    indent, table))
-
 
807
			  PROTO_T (COutputInfoP info X
-
 
808
				   RuleP        rule X
-
 
809
				   ItemP        item X
-
 
810
				   ItemP        initial X
-
 
811
				   RuleP        handler_rule X
722
			  ItemP initial, RuleP handler_rule,
812
				   BoolT        needed_switch X
-
 
813
				   BoolT        need_check X
723
			  BoolT needed_switch, BoolT need_check,
814
				   BoolT        outer_level X
-
 
815
				   EntryP       predicate_id X
724
			  BoolT outer_level, EntryP predicate_id,
816
				   unsigned     error_terminal X
725
			  unsigned error_terminal, RStackP rstack,
817
				   RStackP      rstack X
-
 
818
				   unsigned     indent X
726
			  unsigned indent, TableP table)
819
				   TableP       table)
-
 
820
{
727
{
821
    OStreamP ostream = c_out_info_ostream (info);
728
    OStreamP ostream = c_out_info_ostream(info);
822
 
729
 
823
    c_output_action_in_alt (info, item, handler_rule, need_check, outer_level,
730
    c_output_action_in_alt(info, item, handler_rule, need_check, outer_level,
824
			    error_terminal, rstack, indent, table);
731
			   error_terminal, rstack, indent, table);
825
    c_output_indent (info, indent);
732
    c_output_indent(info, indent);
826
    write_cstring (ostream, "if (!");
733
    write_cstring(ostream, "if (!");
827
    c_output_key (info, entry_key (predicate_id), c_out_info_in_prefix (info));
734
    c_output_key(info, entry_key(predicate_id), c_out_info_in_prefix(info));
828
    write_cstring (ostream, ")");
735
    write_cstring(ostream, ")");
829
    write_newline (ostream);
736
    write_newline(ostream);
830
    if ((item == initial) && (!needed_switch)) {
737
    if ((item == initial) && (!needed_switch)) {
831
	unsigned label = c_out_next_label ();
738
	unsigned label = c_out_next_label();
832
 
739
 
833
	c_output_jump (info, label, indent + C_INDENT_STEP);
740
	c_output_jump(info, label, indent + C_INDENT_STEP);
834
	rule_set_next_label (rule, label);
741
	rule_set_next_label(rule, label);
835
    } else {
742
    } else {
836
	c_output_jump (info, rule_get_handler_label (handler_rule),
743
	c_output_jump(info, rule_get_handler_label(handler_rule),
837
		       indent + C_INDENT_STEP);
744
		      indent + C_INDENT_STEP);
838
    }
745
    }
839
}
746
}
840
 
747
 
841
static BoolT
748
static BoolT
842
c_output_alt PROTO_N ((info, alt, rule, handler_rule, call_list, need_switch,
749
c_output_alt(COutputInfoP info, AltP alt, RuleP rule, RuleP handler_rule,
843
		       need_check, outer_level, predicate_id, error_terminal,
750
	     EntryListP call_list, BoolT need_switch, BoolT need_check,
844
		       indent, rstack, non_local_stack, table))
-
 
845
	     PROTO_T (COutputInfoP info X
-
 
846
		      AltP         alt X
-
 
847
		      RuleP        rule X
-
 
848
		      RuleP        handler_rule X
-
 
849
		      EntryListP   call_list X
-
 
850
		      BoolT        need_switch X
-
 
851
		      BoolT        need_check X
-
 
852
		      BoolT        outer_level X
-
 
853
		      EntryP       predicate_id X
-
 
854
		      unsigned     error_terminal X
751
	     BoolT outer_level, EntryP predicate_id, unsigned error_terminal,
855
		      unsigned     indent X
-
 
856
		      RStackP      rstack X
-
 
857
		      RStackP      non_local_stack X
752
	     unsigned indent, RStackP rstack, RStackP non_local_stack,
858
		      TableP       table)
753
	     TableP table)
859
{
754
{
860
    ItemP       initial       = alt_item_head (alt);
755
    ItemP       initial       = alt_item_head(alt);
861
    BoolT       needed_switch = need_switch;
756
    BoolT       needed_switch = need_switch;
862
    unsigned    code_indent   = (indent + C_INDENT_STEP);
757
    unsigned    code_indent   = (indent + C_INDENT_STEP);
863
    BoolT       reachable     = TRUE;
758
    BoolT       reachable     = TRUE;
864
    ItemP       item;
759
    ItemP       item;
865
    SaveRStackT state;
760
    SaveRStackT state;
866
 
761
 
867
    rstack_push_frame (rstack);
762
    rstack_push_frame(rstack);
868
    rstack_compute_local_renaming (rstack, alt_names (alt), rule_result (rule),
763
    rstack_compute_local_renaming(rstack, alt_names(alt), rule_result(rule),
869
				   table);
764
				  table);
870
    rstack_save_state (rstack, &state);
765
    rstack_save_state(rstack, &state);
871
    c_output_open (info, indent);
766
    c_output_open(info, indent);
872
    c_output_alt_names (info, alt_names (alt), rule_result (rule), &state,
767
    c_output_alt_names(info, alt_names(alt), rule_result(rule), &state,
873
			code_indent);
768
		       code_indent);
874
    for (item = initial; item; item = item_next (item)) {
769
    for (item = initial; item; item = item_next(item)) {
875
	switch (item_type (item)) EXHAUSTIVE {
770
	switch (item_type(item))EXHAUSTIVE {
876
	  case ET_BASIC:
771
	  case ET_BASIC:
877
	    c_output_basic_in_alt (info, item, handler_rule, need_switch,
772
	    c_output_basic_in_alt(info, item, handler_rule, need_switch,
878
				   need_check, outer_level, error_terminal,
773
				  need_check, outer_level, error_terminal,
879
				   &state, code_indent);
774
				  &state, code_indent);
880
	    need_switch = TRUE;
775
	    need_switch = TRUE;
881
	    need_check  = FALSE;
776
	    need_check  = FALSE;
882
	    break;
777
	    break;
883
	  case ET_RULE:
778
	  case ET_RULE:
884
	    need_check  = c_output_rule_in_alt (info, item, handler_rule,
779
	    need_check  = c_output_rule_in_alt(info, item, handler_rule,
885
						call_list, need_check,
780
					       call_list, need_check,
886
						outer_level, predicate_id,
781
					       outer_level, predicate_id,
887
						error_terminal, code_indent,
782
					       error_terminal, code_indent,
888
						rstack, non_local_stack, table,
783
					       rstack, non_local_stack, table,
889
						&reachable);
784
					       &reachable);
890
	    need_switch = TRUE;
785
	    need_switch = TRUE;
891
	    break;
786
	    break;
892
	  case ET_PREDICATE:
787
	  case ET_PREDICATE:
893
	    c_output_predicate_in_alt (info, rule, item, initial, handler_rule,
788
	    c_output_predicate_in_alt(info, rule, item, initial, handler_rule,
894
				       needed_switch, need_check, outer_level,
789
				      needed_switch, need_check, outer_level,
895
				       predicate_id, error_terminal, rstack,
790
				      predicate_id, error_terminal, rstack,
896
				       code_indent, table);
791
				      code_indent, table);
897
	    need_switch = TRUE;
792
	    need_switch = TRUE;
898
	    need_check  = FALSE;
793
	    need_check  = FALSE;
899
	    break;
794
	    break;
900
	  case ET_ACTION:
795
	  case ET_ACTION:
901
	    c_output_action_in_alt (info, item, handler_rule, need_check,
796
	    c_output_action_in_alt(info, item, handler_rule, need_check,
902
				    outer_level, error_terminal, rstack,
797
				   outer_level, error_terminal, rstack,
903
				    code_indent, table);
798
				   code_indent, table);
904
	    need_check = FALSE;
799
	    need_check = FALSE;
905
	    break;
800
	    break;
906
	  case ET_RENAME:
801
	  case ET_RENAME:
907
	    if (need_check) {
802
	    if (need_check) {
908
		c_output_check (info, handler_rule, outer_level,
803
		c_output_check(info, handler_rule, outer_level,
909
				error_terminal, code_indent);
804
			       error_terminal, code_indent);
910
	    }
805
	    }
911
	    c_output_rename (info, item_param (item), item_result (item),
806
	    c_output_rename(info, item_param(item), item_result(item),
912
			     &state, code_indent);
807
			    &state, code_indent);
913
	    need_check = FALSE;
808
	    need_check = FALSE;
914
	    break;
809
	    break;
915
	  case ET_NON_LOCAL:
810
	  case ET_NON_LOCAL:
916
	  case ET_NAME:
811
	  case ET_NAME:
917
	  case ET_TYPE:
812
	  case ET_TYPE:
Line 919... Line 814...
919
	}
814
	}
920
	outer_level = FALSE;
815
	outer_level = FALSE;
921
    }
816
    }
922
    if (reachable) {
817
    if (reachable) {
923
	if (need_check) {
818
	if (need_check) {
924
	    c_output_check (info, handler_rule, outer_level, error_terminal,
819
	    c_output_check(info, handler_rule, outer_level, error_terminal,
925
			    code_indent);
820
			   code_indent);
926
	}
821
	}
927
	if (item_is_predicate (initial) && (!needed_switch)) {
822
	if (item_is_predicate(initial) && (!needed_switch)) {
928
	    c_output_jump (info, rule_get_end_label (rule), code_indent);
823
	    c_output_jump(info, rule_get_end_label(rule), code_indent);
929
	    reachable = FALSE;
824
	    reachable = FALSE;
930
	}
825
	}
931
    }
826
    }
932
    c_output_close (info, indent);
827
    c_output_close(info, indent);
933
    if (!reachable) {
828
    if (!reachable) {
934
	c_output_unreachable (info, indent);
829
	c_output_unreachable(info, indent);
935
    }
830
    }
936
    rstack_pop_frame (rstack);
831
    rstack_pop_frame(rstack);
937
    return (reachable);
832
    return(reachable);
938
}
833
}
939
 
834
 
940
static BoolT
835
static BoolT
941
c_output_rule PROTO_N ((info, rule, handler_rule, call_list, need_check,
836
c_output_rule(COutputInfoP info, RuleP rule, RuleP handler_rule,
942
			predicate_id, error_terminal, indent, rstack,
-
 
943
			non_local_stack, table))
-
 
944
	      PROTO_T (COutputInfoP info X
-
 
945
		       RuleP        rule X
-
 
946
		       RuleP        handler_rule X
-
 
947
		       EntryListP   call_list X
-
 
948
		       BoolT        need_check X
-
 
949
		       EntryP       predicate_id X
837
	      EntryListP call_list, BoolT need_check, EntryP predicate_id,
950
		       unsigned     error_terminal X
838
	      unsigned error_terminal, unsigned indent, RStackP rstack,
951
		       unsigned     indent X
-
 
952
		       RStackP      rstack X
-
 
953
		       RStackP      non_local_stack X
839
	      RStackP non_local_stack, TableP table)
954
		       TableP       table)
-
 
955
{
840
{
956
    EntryP        entry            = rule_entry (rule);
841
    EntryP        entry            = rule_entry(rule);
957
    KeyP          key              = entry_key (entry);
842
    KeyP          key              = entry_key(entry);
958
    EntryListP    predicate_firsts = rule_predicate_first (rule);
843
    EntryListP    predicate_firsts = rule_predicate_first(rule);
959
    BoolT         predicates       = (!entry_list_is_empty (predicate_firsts));
844
    BoolT         predicates       = (!entry_list_is_empty(predicate_firsts));
960
    RuleP         old_handler_rule = handler_rule;
845
    RuleP         old_handler_rule = handler_rule;
961
    BoolT         outer_level      = (old_handler_rule == rule);
846
    BoolT         outer_level      = (old_handler_rule == rule);
962
    BoolT         reachable        = TRUE;
847
    BoolT         reachable        = TRUE;
963
    unsigned      code_indent      = indent;
848
    unsigned      code_indent      = indent;
964
    NonLocalListP non_locals       = rule_non_locals (rule);
849
    NonLocalListP non_locals       = rule_non_locals(rule);
965
    BoolT         has_non_locals   = (!non_local_list_is_empty (non_locals));
850
    BoolT         has_non_locals   = (!non_local_list_is_empty(non_locals));
966
    AltP          handler          = rule_get_handler (rule);
851
    AltP          handler          = rule_get_handler(rule);
967
    BoolT         full_first_set   = bitvec_is_full (rule_first_set (rule));
852
    BoolT         full_first_set   = bitvec_is_full(rule_first_set(rule));
968
    BoolT         one_alt          = rule_has_one_alt (rule);
853
    BoolT         one_alt          = rule_has_one_alt(rule);
969
 
854
 
970
    ASSERT (!rule_is_being_output (rule));
855
    ASSERT(!rule_is_being_output(rule));
971
    rule_being_output (rule);
856
    rule_being_output(rule);
972
    rule_set_end_label (rule, c_out_next_label ());
857
    rule_set_end_label(rule, c_out_next_label());
973
    if (need_check && (predicates || has_non_locals || one_alt)) {
858
    if (need_check && (predicates || has_non_locals || one_alt)) {
974
	c_output_check (info, handler_rule, outer_level, error_terminal,
859
	c_output_check(info, handler_rule, outer_level, error_terminal,
975
			indent);
860
		       indent);
976
	need_check = FALSE;
861
	need_check = FALSE;
977
    }
862
    }
978
    if (outer_level) {
863
    if (outer_level) {
979
	rule_set_handler_label (rule, c_out_next_label ());
864
	rule_set_handler_label(rule, c_out_next_label());
980
    } else if ((handler != NIL (AltP)) || has_non_locals) {
865
    } else if ((handler != NIL(AltP)) || has_non_locals) {
981
	handler_rule = rule;
866
	handler_rule = rule;
982
	rule_set_handler_label (rule, c_out_next_label ());
867
	rule_set_handler_label(rule, c_out_next_label());
983
    }
868
    }
984
    if (entry_list_contains (call_list, entry)) {
869
    if (entry_list_contains(call_list, entry)) {
985
	unsigned label = c_out_next_label ();
870
	unsigned label = c_out_next_label();
986
 
871
 
987
	c_output_key_label (info, key, label, indent);
872
	c_output_key_label(info, key, label, indent);
988
	rule_set_start_label (rule, label);
873
	rule_set_start_label(rule, label);
989
    }
874
    }
990
    if (has_non_locals) {
875
    if (has_non_locals) {
991
	c_output_open (info, indent);
876
	c_output_open(info, indent);
992
	code_indent += C_INDENT_STEP;
877
	code_indent += C_INDENT_STEP;
993
	rstack_push_frame (rstack);
878
	rstack_push_frame(rstack);
994
	rstack_push_frame (non_local_stack);
879
	rstack_push_frame(non_local_stack);
995
	c_output_save_non_locals (info, rule, code_indent, rstack,
880
	c_output_save_non_locals(info, rule, code_indent, rstack,
996
				  non_local_stack, handler_rule, table);
881
				 non_local_stack, handler_rule, table);
997
    }
882
    }
998
    if (one_alt) {
883
    if (one_alt) {
999
	if (!rule_has_empty_alt (rule)) {
884
	if (!rule_has_empty_alt(rule)) {
1000
	    AltP alt = rule_alt_head (rule);
885
	    AltP alt = rule_alt_head(rule);
1001
 
886
 
1002
	    reachable = c_output_alt (info, alt, rule, handler_rule, call_list,
887
	    reachable = c_output_alt(info, alt, rule, handler_rule, call_list,
1003
				      TRUE, need_check, outer_level,
888
				     TRUE, need_check, outer_level,
1004
				      predicate_id, error_terminal,
889
				     predicate_id, error_terminal,
1005
				      code_indent, rstack, non_local_stack,
890
				     code_indent, rstack, non_local_stack,
1006
				      table);
891
				     table);
1007
	} else {
892
	} else {
1008
	    if (need_check) {
893
	    if (need_check) {
1009
		c_output_check (info, handler_rule, outer_level,
894
		c_output_check(info, handler_rule, outer_level, error_terminal,
1010
				error_terminal, code_indent);
895
			       code_indent);
1011
	    }
896
	    }
1012
	    reachable  = TRUE;
897
	    reachable  = TRUE;
1013
	}
898
	}
1014
    } else {
899
    } else {
1015
	BoolT non_predicate_alts = TRUE;
900
	BoolT non_predicate_alts = TRUE;
1016
	AltP  see_through_alt    = rule_see_through_alt (rule);
901
	AltP  see_through_alt    = rule_see_through_alt(rule);
1017
	AltP  alt;
902
	AltP  alt;
1018
 
903
 
1019
	if (predicates) {
904
	if (predicates) {
1020
	    non_predicate_alts = FALSE;
905
	    non_predicate_alts = FALSE;
1021
	    for (alt = rule_alt_head (rule); alt; alt = alt_next (alt)) {
906
	    for (alt = rule_alt_head(rule); alt; alt = alt_next(alt)) {
1022
		ItemP item = alt_item_head (alt);
907
		ItemP item = alt_item_head(alt);
1023
 
908
 
1024
		if (item_is_predicate (item)) {
909
		if (item_is_predicate(item)) {
1025
		    (void) c_output_alt (info, alt, rule, handler_rule,
910
		   (void)c_output_alt(info, alt, rule, handler_rule,
1026
					 call_list, FALSE, FALSE, FALSE,
911
				      call_list, FALSE, FALSE, FALSE,
1027
					 predicate_id, error_terminal,
912
				      predicate_id, error_terminal,
1028
					 code_indent, rstack, non_local_stack,
913
				      code_indent, rstack, non_local_stack,
1029
					 table);
914
				      table);
1030
		    c_output_label (info, rule_get_next_label (rule),
915
		    c_output_label(info, rule_get_next_label(rule),
1031
				    code_indent);
916
				   code_indent);
1032
		} else {
917
		} else {
1033
		    non_predicate_alts = TRUE;
918
		    non_predicate_alts = TRUE;
1034
		}
919
		}
1035
	    }
920
	    }
1036
	}
921
	}
1037
	if (non_predicate_alts) {
922
	if (non_predicate_alts) {
1038
	    reachable = FALSE;
923
	    reachable = FALSE;
1039
	    c_output_switch (info, code_indent);
924
	    c_output_switch (info, code_indent);
1040
	    for (alt = rule_alt_head (rule); alt; alt = alt_next (alt)) {
925
	    for (alt = rule_alt_head(rule); alt; alt = alt_next(alt)) {
1041
		ItemP item = alt_item_head (alt);
926
		ItemP item = alt_item_head(alt);
1042
 
927
 
1043
		if (!item_is_predicate (item)) {
928
		if (!item_is_predicate(item)) {
1044
		    if (alt == see_through_alt) {
929
		    if (alt == see_through_alt) {
1045
			ASSERT (!full_first_set);
930
			ASSERT(!full_first_set);
1046
			c_output_default (info, code_indent);
931
			c_output_default(info, code_indent);
1047
		    } else {
932
		    } else {
1048
			c_output_bitvec_cases (info, alt_first_set (alt),
933
			c_output_bitvec_cases(info, alt_first_set(alt),
1049
					       code_indent);
934
					      code_indent);
1050
		    }
935
		    }
1051
		    if (c_output_alt (info, alt, rule, handler_rule, call_list,
936
		    if (c_output_alt(info, alt, rule, handler_rule, call_list,
1052
				      FALSE, FALSE, FALSE, predicate_id,
937
				     FALSE, FALSE, FALSE, predicate_id,
1053
				      error_terminal,
938
				     error_terminal,
1054
				      code_indent + C_INDENT_STEP,
939
				     code_indent + C_INDENT_STEP, rstack,
1055
				      rstack, non_local_stack, table)) {
940
				     non_local_stack, table)) {
1056
			c_output_break (info, code_indent + C_INDENT_STEP);
941
			c_output_break(info, code_indent + C_INDENT_STEP);
1057
			reachable = TRUE;
942
			reachable = TRUE;
1058
		    }
943
		    }
1059
		}
944
		}
1060
	    }
945
	    }
1061
	    if (need_check) {
946
	    if (need_check) {
1062
		c_output_case (info, error_terminal, code_indent);
947
		c_output_case(info, error_terminal, code_indent);
1063
		c_output_restore (info, handler_rule, outer_level,
948
		c_output_restore(info, handler_rule, outer_level,
-
 
949
				 code_indent + C_INDENT_STEP);
-
 
950
	    }
-
 
951
	    if ((see_through_alt == NIL(AltP)) && (!full_first_set)) {
-
 
952
		c_output_default(info, code_indent);
-
 
953
		if (!rule_has_empty_alt(rule)) {
-
 
954
		    c_output_jump(info, rule_get_handler_label(handler_rule),
1064
				  code_indent + C_INDENT_STEP);
955
				  code_indent + C_INDENT_STEP);
1065
	    }
-
 
1066
	    if ((see_through_alt == NIL (AltP)) && (!full_first_set)) {
-
 
1067
		c_output_default (info, code_indent);
-
 
1068
		if (!rule_has_empty_alt (rule)) {
-
 
1069
		    c_output_jump (info, rule_get_handler_label (handler_rule),
-
 
1070
				   code_indent + C_INDENT_STEP);
-
 
1071
		} else {
956
		} else {
1072
		    c_output_break (info, code_indent + C_INDENT_STEP);
957
		    c_output_break(info, code_indent + C_INDENT_STEP);
1073
		    reachable = TRUE;
958
		    reachable = TRUE;
1074
		}
959
		}
1075
	    }
960
	    }
1076
	    c_output_close (info, code_indent);
961
	    c_output_close(info, code_indent);
1077
	} else {
962
	} else {
1078
	    ASSERT (!need_check);
963
	    ASSERT(!need_check);
1079
	    if (!rule_has_empty_alt (rule)) {
964
	    if (!rule_has_empty_alt(rule)) {
1080
		c_output_jump (info, rule_get_handler_label (handler_rule),
965
		c_output_jump(info, rule_get_handler_label(handler_rule),
1081
			       code_indent);
966
			      code_indent);
1082
	    }
967
	    }
1083
	}
968
	}
1084
    }
969
    }
1085
    if (((handler != NIL (AltP)) || has_non_locals || outer_level) &&
970
    if (((handler != NIL(AltP)) || has_non_locals || outer_level) &&
1086
	rule_used_handler_label (rule)) {
971
	rule_used_handler_label(rule)) {
1087
	if (reachable) {
972
	if (reachable) {
1088
	    if (outer_level && types_equal_zero_tuple (rule_result (rule)) &&
973
	    if (outer_level && types_equal_zero_tuple(rule_result(rule)) &&
1089
		(!has_non_locals)) {
974
		(!has_non_locals)) {
1090
		c_output_return (info, code_indent);
975
		c_output_return(info, code_indent);
1091
	    } else {
976
	    } else {
1092
		c_output_jump (info, rule_get_end_label (rule), code_indent);
977
		c_output_jump(info, rule_get_end_label(rule), code_indent);
1093
	    }
978
	    }
1094
	} else {
979
	} else {
1095
	    c_output_unreachable (info, code_indent);
980
	    c_output_unreachable(info, code_indent);
1096
	}
981
	}
1097
	reachable = FALSE;
982
	reachable = FALSE;
1098
	if (handler) {
983
	if (handler) {
1099
	    RuleP cleanup_handler_rule = old_handler_rule;
984
	    RuleP cleanup_handler_rule = old_handler_rule;
1100
 
985
 
1101
	    c_output_label (info, rule_get_handler_label (rule), code_indent);
986
	    c_output_label(info, rule_get_handler_label(rule), code_indent);
1102
	    reachable = TRUE;
987
	    reachable = TRUE;
1103
	    if (outer_level || has_non_locals) {
988
	    if (outer_level || has_non_locals) {
1104
		rule_set_handler_label (rule, c_out_next_label ());
989
		rule_set_handler_label(rule, c_out_next_label());
1105
		cleanup_handler_rule = rule;
990
		cleanup_handler_rule = rule;
1106
	    }
991
	    }
1107
	    if (!c_output_alt (info, handler, rule, cleanup_handler_rule,
992
	    if (!c_output_alt(info, handler, rule, cleanup_handler_rule,
1108
			       call_list, TRUE, FALSE, FALSE, predicate_id,
993
			      call_list, TRUE, FALSE, FALSE, predicate_id,
1109
			       error_terminal, code_indent, rstack,
994
			      error_terminal, code_indent, rstack,
1110
			       non_local_stack, table)) {
995
			      non_local_stack, table)) {
1111
		reachable = FALSE;
996
		reachable = FALSE;
1112
	    }
997
	    }
1113
	}
998
	}
1114
	if ((outer_level || has_non_locals) &&
999
	if ((outer_level || has_non_locals) &&
1115
	    rule_used_handler_label (rule)) {
1000
	    rule_used_handler_label(rule)) {
1116
	    if (reachable) {
1001
	    if (reachable) {
1117
		c_output_jump (info, rule_get_end_label (rule), code_indent);
1002
		c_output_jump(info, rule_get_end_label(rule), code_indent);
1118
	    } else if (handler) {
1003
	    } else if (handler) {
1119
		c_output_unreachable (info, code_indent);
1004
		c_output_unreachable(info, code_indent);
1120
	    }
1005
	    }
1121
	    c_output_label (info, rule_get_handler_label (rule), code_indent);
1006
	    c_output_label(info, rule_get_handler_label(rule), code_indent);
1122
	    if (has_non_locals) {
1007
	    if (has_non_locals) {
1123
		c_output_restore_non_locals (info, rule, code_indent, rstack,
1008
		c_output_restore_non_locals(info, rule, code_indent, rstack,
1124
					     non_local_stack);
1009
					    non_local_stack);
1125
	    }
1010
	    }
1126
	    if (outer_level) {
1011
	    if (outer_level) {
1127
		OStreamP ostream = c_out_info_ostream (info);
1012
		OStreamP ostream = c_out_info_ostream(info);
1128
 
1013
 
1129
		c_output_indent (info, code_indent);
1014
		c_output_indent(info, code_indent);
1130
		write_cstring (ostream, "SAVE_LEXER (");
1015
		write_cstring(ostream, "SAVE_LEXER (");
1131
		write_unsigned (ostream, error_terminal);
1016
		write_unsigned(ostream, error_terminal);
1132
		write_cstring (ostream, ");");
1017
		write_cstring(ostream, ");");
1133
		write_newline (ostream);
1018
		write_newline(ostream);
1134
		c_output_return (info, code_indent);
1019
		c_output_return(info, code_indent);
1135
	    } else {
1020
	    } else {
1136
		c_output_jump (info, rule_get_handler_label (old_handler_rule),
1021
		c_output_jump(info, rule_get_handler_label(old_handler_rule),
1137
			       code_indent);
1022
			      code_indent);
1138
	    }
1023
	    }
1139
	    reachable = FALSE;
1024
	    reachable = FALSE;
1140
	}
1025
	}
1141
    }
1026
    }
1142
    if (rule_used_end_label (rule)) {
1027
    if (rule_used_end_label(rule)) {
1143
	c_output_label (info, rule_get_end_label (rule), code_indent);
1028
	c_output_label(info, rule_get_end_label(rule), code_indent);
1144
	reachable = TRUE;
1029
	reachable = TRUE;
1145
    }
1030
    }
1146
    if (reachable) {
1031
    if (reachable) {
1147
	if (has_non_locals) {
1032
	if (has_non_locals) {
1148
	    c_output_restore_non_locals (info, rule, code_indent, rstack,
1033
	    c_output_restore_non_locals(info, rule, code_indent, rstack,
1149
					 non_local_stack);
1034
					non_local_stack);
1150
	}
1035
	}
1151
	if (outer_level) {
1036
	if (outer_level) {
1152
	    c_output_result_assign (info, rule_result (rule), code_indent);
1037
	    c_output_result_assign(info, rule_result(rule), code_indent);
1153
	}
1038
	}
1154
    }
1039
    }
1155
    if (has_non_locals) {
1040
    if (has_non_locals) {
1156
	c_output_close (info, indent);
1041
	c_output_close(info, indent);
1157
	rstack_pop_frame (non_local_stack);
1042
	rstack_pop_frame(non_local_stack);
1158
	rstack_pop_frame (rstack);
1043
	rstack_pop_frame(rstack);
1159
    }
1044
    }
1160
    rule_not_being_output (rule);
1045
    rule_not_being_output(rule);
1161
    return (reachable);
1046
    return(reachable);
1162
}
1047
}
1163
 
1048
 
1164
static void
1049
static void
1165
c_output_definition_1 PROTO_N ((info, rule, predicate_id, predicate_type,
1050
c_output_definition_1(COutputInfoP info, RuleP rule, EntryP predicate_id,
1166
				error_terminal, table))
-
 
1167
		      PROTO_T (COutputInfoP info X
-
 
1168
			       RuleP        rule X
-
 
1169
			       EntryP       predicate_id X
-
 
1170
			       EntryP       predicate_type X
-
 
1171
			       unsigned     error_terminal X
1051
		      EntryP predicate_type, unsigned error_terminal,
1172
			       TableP       table)
1052
		      TableP table)
1173
{
1053
{
1174
    OStreamP ostream = c_out_info_ostream (info);
1054
    OStreamP ostream = c_out_info_ostream(info);
1175
    EntryP   entry   = rule_entry (rule);
1055
    EntryP   entry   = rule_entry(rule);
1176
    unsigned split   = c_out_info_get_split (info);
1056
    unsigned split   = c_out_info_get_split(info);
1177
    RStackT  rstack;
1057
    RStackT  rstack;
1178
    RStackT  non_local_stack;
1058
    RStackT  non_local_stack;
1179
 
1059
 
1180
    if (rule_is_required (rule)) {
1060
    if (rule_is_required(rule)) {
1181
	write_cstring (ostream, "void");
1061
	write_cstring(ostream, "void");
1182
    } else if (rule_needs_function (rule)) {
1062
    } else if (rule_needs_function(rule)) {
1183
	if (split != 0) {
1063
	if (split != 0) {
1184
	    write_cstring (ostream, "void");
1064
	    write_cstring(ostream, "void");
1185
	} else {
1065
	} else {
1186
	    write_cstring (ostream, "static void");
1066
	    write_cstring(ostream, "static void");
1187
	}
1067
	}
1188
    } else {
1068
    } else {
1189
	return;
1069
	return;
1190
    }
1070
    }
1191
    write_newline (ostream);
1071
    write_newline(ostream);
1192
    c_output_mapped_key (info, entry);
1072
    c_output_mapped_key(info, entry);
1193
    write_char (ostream, ' ');
-
 
1194
    c_output_type_defn (info, rule_param (rule), rule_result (rule));
1073
    c_output_type_defn(info, rule_param(rule), rule_result(rule));
1195
    c_out_reset_labels ();
1074
    c_out_reset_labels();
1196
    rstack_init (&rstack);
1075
    rstack_init(&rstack);
1197
    rstack_push_frame (&rstack);
1076
    rstack_push_frame(&rstack);
1198
    rstack_add_translation (&rstack, predicate_id, predicate_id,
1077
    rstack_add_translation(&rstack, predicate_id, predicate_id, predicate_type,
1199
			    predicate_type, FALSE);
1078
			   FALSE);
1200
    rstack_compute_formal_renaming (&rstack, rule_param (rule));
1079
    rstack_compute_formal_renaming(&rstack, rule_param(rule));
1201
    rstack_compute_formal_renaming (&rstack, rule_result (rule));
1080
    rstack_compute_formal_renaming(&rstack, rule_result(rule));
1202
    rstack_save_state (&rstack, rule_rstack_state (rule));
1081
    rstack_save_state(&rstack, rule_rstack_state(rule));
1203
    rstack_init (&non_local_stack);
1082
    rstack_init(&non_local_stack);
1204
    (void) c_output_rule (info, rule, rule, rule_call_list (rule), TRUE,
1083
   (void)c_output_rule(info, rule, rule, rule_call_list(rule), TRUE,
1205
			  predicate_id, error_terminal, C_INDENT_STEP,
1084
		       predicate_id, error_terminal, C_INDENT_STEP, &rstack,
1206
			  &rstack, &non_local_stack, table);
1085
		       &non_local_stack, table);
1207
    write_char (ostream, '}');
1086
    write_char(ostream, '}');
1208
    write_newline (ostream);
1087
    write_newline(ostream);
1209
    write_newline (ostream);
1088
    write_newline(ostream);
1210
    rstack_destroy (&rstack);
1089
    rstack_destroy(&rstack);
1211
    rstack_destroy (&non_local_stack);
1090
    rstack_destroy(&non_local_stack);
1212
    if (split != 0) {
1091
    if (split != 0) {
1213
	if (ostream_line (ostream) >= split) {
1092
	if (ostream_line(ostream) >= split) {
1214
	    CStringP     name    = ostream_gen_name (ostream);
1093
	    CStringP     name    = ostream_gen_name(ostream);
1215
	    CCodeP       header  = c_out_info_get_header1 (info);
1094
	    CCodeP       header  = c_out_info_get_header1(info);
1216
	    write_cstring (ostream, "/* END OF FILE */");
1095
	    write_cstring (ostream, "/* END OF FILE */");
1217
	    write_newline (ostream);
1096
	    write_newline(ostream);
1218
	    ostream_close (ostream);
1097
	    ostream_close(ostream);
1219
	    if (!ostream_open (ostream, name)) {
1098
	    if (!ostream_open(ostream, name)) {
1220
		E_cannot_open_output_file (name);
1099
		E_cannot_open_output_file(name);
1221
		UNREACHED;
1100
		UNREACHED;
1222
	    }
1101
	    }
1223
	    c_output_identification (info);
1102
	    c_output_identification(info);
1224
	    write_cstring (ostream, "/* BEGINNING OF HEADER */");
1103
	    write_cstring (ostream, "/* BEGINNING OF HEADER */");
1225
	    write_newline (ostream);
1104
	    write_newline(ostream);
1226
	    write_newline (ostream);
1105
	    write_newline(ostream);
1227
	    write_cstring (ostream, "#define __SID_SPLIT");
1106
	    write_cstring(ostream, "#define __SID_SPLIT");
1228
	    write_newline (ostream);
1107
	    write_newline(ostream);
1229
	    c_output_location (info, c_code_file (header),
1108
	    c_output_location(info, c_code_file(header),
1230
			       c_code_line (header));
1109
			      c_code_line(header));
1231
	    c_output_c_code (info, header);
1110
	    c_output_c_code(info, header);
1232
	    c_output_location (info, ostream_name (ostream),
1111
	    c_output_location(info, ostream_name(ostream),
1233
			       ostream_line (ostream) + 1);
1112
			      ostream_line(ostream) + 1);
1234
	    write_newline (ostream);
1113
	    write_newline(ostream);
1235
	}
1114
	}
1236
    }
1115
    }
1237
}
1116
}
1238
 
1117
 
1239
static void
1118
static void
1240
c_output_definition PROTO_N ((entry, gclosure))
1119
c_output_definition(EntryP entry, GenericP gclosure)
1241
		    PROTO_T (EntryP   entry X
-
 
1242
			     GenericP gclosure)
-
 
1243
{
1120
{
1244
    if (entry_is_rule (entry)) {
1121
    if (entry_is_rule(entry)) {
1245
	RuleP        rule           = entry_get_rule (entry);
1122
	RuleP        rule           = entry_get_rule(entry);
1246
	COutClosureP closure        = (COutClosureP) gclosure;
1123
	COutClosureP closure        = (COutClosureP)gclosure;
1247
	COutputInfoP info           = closure->info;
1124
	COutputInfoP info           = closure->info;
1248
	TableP       table          = closure->table;
1125
	TableP       table          = closure->table;
1249
	EntryP       predicate_id   = closure->predicate_id;
1126
	EntryP       predicate_id   = closure->predicate_id;
1250
	EntryP       predicate_type = closure->predicate_type;
1127
	EntryP       predicate_type = closure->predicate_type;
1251
	unsigned     error_terminal = closure->error_terminal;
1128
	unsigned     error_terminal = closure->error_terminal;
1252
 
1129
 
1253
	c_output_definition_1 (info, rule, predicate_id, predicate_type,
1130
	c_output_definition_1(info, rule, predicate_id, predicate_type,
1254
			       error_terminal, table);
1131
			      error_terminal, table);
1255
    }
1132
    }
1256
}
1133
}
1257
 
1134
 
1258
/*--------------------------------------------------------------------------*/
1135
/*--------------------------------------------------------------------------*/
1259
 
1136
 
1260
void
1137
void
1261
c_output_parser PROTO_N ((info, grammar))
1138
c_output_parser(COutputInfoP info, GrammarP grammar)
1262
		PROTO_T (COutputInfoP info X
-
 
1263
			 GrammarP     grammar)
-
 
1264
{
1139
{
1265
    TableP       table   = grammar_table (grammar);
1140
    TableP       table   = grammar_table(grammar);
1266
    OStreamP     ostream = c_out_info_ostream (info);
1141
    OStreamP     ostream = c_out_info_ostream(info);
1267
    CCodeP       header  = c_out_info_get_header1 (info);
1142
    CCodeP       header  = c_out_info_get_header1(info);
1268
    CCodeP       trailer = c_out_info_get_trailer1 (info);
1143
    CCodeP       trailer = c_out_info_get_trailer1(info);
1269
    COutClosureT closure;
1144
    COutClosureT closure;
1270
 
1145
 
1271
    closure.info           = info;
1146
    closure.info           = info;
1272
    closure.table          = table;
1147
    closure.table          = table;
1273
    closure.predicate_id   = grammar_get_predicate_id (grammar);
1148
    closure.predicate_id   = grammar_get_predicate_id(grammar);
1274
    closure.predicate_type = grammar_get_predicate_type (grammar);
1149
    closure.predicate_type = grammar_get_predicate_type(grammar);
1275
    closure.error_terminal = grammar_max_terminal (grammar);
1150
    closure.error_terminal = grammar_max_terminal(grammar);
1276
    c_output_identification (info);
1151
    c_output_identification(info);
1277
    write_cstring (ostream, "/* BEGINNING OF HEADER */");
1152
    write_cstring (ostream, "/* BEGINNING OF HEADER */");
1278
    write_newline (ostream);
1153
    write_newline(ostream);
1279
    write_newline (ostream);
1154
    write_newline(ostream);
1280
    if (c_out_info_get_split (info) != 0) {
1155
    if (c_out_info_get_split(info) != 0) {
1281
	write_cstring (ostream, "#define __SID_SPLIT");
1156
	write_cstring(ostream, "#define __SID_SPLIT");
1282
	write_newline (ostream);
1157
	write_newline(ostream);
1283
    }
1158
    }
1284
    c_output_location (info, c_code_file (header), c_code_line (header));
1159
    c_output_location(info, c_code_file(header), c_code_line(header));
1285
    c_output_c_code (info, header);
1160
    c_output_c_code(info, header);
1286
    c_output_location (info, ostream_name (ostream),
1161
    c_output_location(info, ostream_name(ostream), ostream_line(ostream) + 1);
1287
		       ostream_line (ostream) + 1);
-
 
1288
    write_newline (ostream);
1162
    write_newline(ostream);
1289
    if (c_out_info_get_split (info) == 0) {
1163
    if (c_out_info_get_split(info) == 0) {
1290
	write_cstring (ostream, "/* BEGINNING OF FUNCTION DECLARATIONS */");
1164
	write_cstring (ostream, "/* BEGINNING OF FUNCTION DECLARATIONS */");
1291
	write_newline (ostream);
1165
	write_newline(ostream);
1292
	write_newline (ostream);
1166
	write_newline(ostream);
1293
	table_iter (table, c_output_declaration, (GenericP) info);
1167
	table_iter(table, c_output_declaration, (GenericP)info);
1294
	write_newline (ostream);
1168
	write_newline(ostream);
1295
    }
1169
    }
1296
    c_output_static_vars (info, grammar, TRUE);
1170
    c_output_static_vars(info, grammar, TRUE);
1297
    write_cstring (ostream, "/* BEGINNING OF FUNCTION DEFINITIONS */");
1171
    write_cstring (ostream, "/* BEGINNING OF FUNCTION DEFINITIONS */");
1298
    write_newline (ostream);
1172
    write_newline(ostream);
1299
    write_newline (ostream);
1173
    write_newline(ostream);
1300
    table_iter (table, c_output_definition, (GenericP) &closure);
1174
    table_iter(table, c_output_definition, (GenericP) &closure);
1301
    write_cstring (ostream, "/* BEGINNING OF TRAILER */");
1175
    write_cstring (ostream, "/* BEGINNING OF TRAILER */");
1302
    write_newline (ostream);
1176
    write_newline(ostream);
1303
    write_newline (ostream);
1177
    write_newline(ostream);
1304
    c_output_location (info, c_code_file (trailer), c_code_line (trailer));
1178
    c_output_location(info, c_code_file(trailer), c_code_line(trailer));
1305
    c_output_c_code (info, trailer);
1179
    c_output_c_code(info, trailer);
1306
    c_output_location (info, ostream_name (ostream),
1180
    c_output_location(info, ostream_name(ostream), ostream_line(ostream) + 1);
1307
		       ostream_line (ostream) + 1);
-
 
1308
    write_newline (ostream);
1181
    write_newline(ostream);
1309
    write_cstring (ostream, "/* END OF FILE */");
1182
    write_cstring (ostream, "/* END OF FILE */");
1310
    write_newline (ostream);
1183
    write_newline(ostream);
1311
}
1184
}
1312
 
1185
 
1313
void
1186
void
1314
c_output_header PROTO_N ((info, grammar))
1187
c_output_header(COutputInfoP info, GrammarP grammar)
1315
		PROTO_T (COutputInfoP info X
-
 
1316
			 GrammarP     grammar)
-
 
1317
{
1188
{
1318
    TableP   table   = grammar_table (grammar);
1189
    TableP   table   = grammar_table(grammar);
1319
    OStreamP ostream = c_out_info_ostream (info);
1190
    OStreamP ostream = c_out_info_ostream(info);
1320
    CCodeP   header  = c_out_info_get_header2 (info);
1191
    CCodeP   header  = c_out_info_get_header2(info);
1321
    CCodeP   trailer = c_out_info_get_trailer2 (info);
1192
    CCodeP   trailer = c_out_info_get_trailer2(info);
1322
 
1193
 
1323
    c_output_identification (info);
1194
    c_output_identification(info);
1324
    write_cstring (ostream, "/* BEGINNING OF HEADER */");
1195
    write_cstring (ostream, "/* BEGINNING OF HEADER */");
1325
    write_newline (ostream);
1196
    write_newline(ostream);
1326
    write_newline (ostream);
1197
    write_newline(ostream);
1327
    c_output_location (info, c_code_file (header), c_code_line (header));
1198
    c_output_location(info, c_code_file(header), c_code_line(header));
1328
    c_output_c_code (info, header);
1199
    c_output_c_code(info, header);
1329
    c_output_location (info, ostream_name (ostream),
1200
    c_output_location(info, ostream_name(ostream), ostream_line(ostream) + 1);
1330
		       ostream_line (ostream) + 1);
-
 
1331
    write_newline (ostream);
1201
    write_newline(ostream);
1332
    write_cstring (ostream, "/* BEGINNING OF FUNCTION DECLARATIONS */");
1202
    write_cstring (ostream, "/* BEGINNING OF FUNCTION DECLARATIONS */");
1333
    write_newline (ostream);
1203
    write_newline(ostream);
1334
    write_newline (ostream);
1204
    write_newline(ostream);
1335
    if (c_out_info_get_split (info) != 0) {
1205
    if (c_out_info_get_split(info) != 0) {
1336
	write_cstring (ostream, "#ifndef __SID_SPLIT");
1206
	write_cstring(ostream, "#ifndef __SID_SPLIT");
1337
	write_newline (ostream);
1207
	write_newline(ostream);
1338
	table_iter (table, c_output_ext_declaration, (GenericP) info);
1208
	table_iter(table, c_output_ext_declaration, (GenericP)info);
1339
	write_cstring (ostream, "#else /* __SID_SPLIT */");
1209
	write_cstring (ostream, "#else /* __SID_SPLIT */");
1340
	write_newline (ostream);
1210
	write_newline(ostream);
1341
	table_iter (table, c_output_declaration, (GenericP) info);
1211
	table_iter(table, c_output_declaration, (GenericP)info);
1342
	c_output_static_vars (info, grammar, FALSE);
1212
	c_output_static_vars(info, grammar, FALSE);
1343
	write_cstring (ostream, "#endif /* __SID_SPLIT */");
1213
	write_cstring (ostream, "#endif /* __SID_SPLIT */");
1344
	write_newline (ostream);
1214
	write_newline(ostream);
1345
    } else {
1215
    } else {
1346
	table_iter (table, c_output_ext_declaration, (GenericP) info);
1216
	table_iter(table, c_output_ext_declaration, (GenericP)info);
1347
    }
1217
    }
1348
    write_newline (ostream);
1218
    write_newline(ostream);
1349
    write_cstring (ostream, "/* BEGINNING OF TERMINAL DEFINITIONS */");
1219
    write_cstring (ostream, "/* BEGINNING OF TERMINAL DEFINITIONS */");
1350
    write_newline (ostream);
1220
    write_newline(ostream);
1351
    write_newline (ostream);
1221
    write_newline(ostream);
1352
    table_iter (table, c_output_terminal, (GenericP) info);
1222
    table_iter(table, c_output_terminal, (GenericP)info);
1353
    write_newline (ostream);
1223
    write_newline(ostream);
1354
    write_cstring (ostream, "/* BEGINNING OF TRAILER */");
1224
    write_cstring (ostream, "/* BEGINNING OF TRAILER */");
1355
    write_newline (ostream);
1225
    write_newline(ostream);
1356
    write_newline (ostream);
1226
    write_newline(ostream);
1357
    c_output_location (info, c_code_file (trailer), c_code_line (trailer));
1227
    c_output_location(info, c_code_file(trailer), c_code_line(trailer));
1358
    c_output_c_code (info, trailer);
1228
    c_output_c_code(info, trailer);
1359
    c_output_location (info, ostream_name (ostream),
1229
    c_output_location(info, ostream_name(ostream), ostream_line(ostream) + 1);
1360
		       ostream_line (ostream) + 1);
-
 
1361
    write_newline (ostream);
1230
    write_newline(ostream);
1362
    write_cstring (ostream, "/* END OF FILE */");
1231
    write_cstring (ostream, "/* END OF FILE */");
1363
    write_newline (ostream);
1232
    write_newline(ostream);
1364
}
1233
}
1365
 
1234
 
1366
void
1235
void
1367
c_output_location PROTO_N ((info, file, line))
1236
c_output_location(COutputInfoP info, CStringP file, unsigned line)
1368
		  PROTO_T (COutputInfoP info X
-
 
1369
			   CStringP     file X
-
 
1370
			   unsigned     line)
-
 
1371
{
1237
{
1372
    if (c_out_info_get_lines (info)) {
1238
    if (c_out_info_get_lines(info)) {
1373
	OStreamP ostream = c_out_info_ostream (info);
1239
	OStreamP ostream = c_out_info_ostream(info);
1374
 
1240
 
1375
	write_cstring (ostream, "#line ");
1241
	write_cstring(ostream, "#line ");
1376
	write_unsigned (ostream, line);
1242
	write_unsigned(ostream, line);
1377
	write_cstring (ostream, " \"");
1243
	write_cstring(ostream, " \"");
1378
	write_cstring (ostream, file);
1244
	write_cstring(ostream, file);
1379
	write_char (ostream, '"');
1245
	write_char(ostream, '"');
1380
	write_newline (ostream);
1246
	write_newline(ostream);
1381
    }
1247
    }
1382
}
1248
}
1383
 
1249
 
1384
void
1250
void
1385
c_output_key_message PROTO_N ((info, prefix, key, suffix, indent))
1251
c_output_key_message(COutputInfoP info, CStringP prefix, KeyP key,
1386
		     PROTO_T (COutputInfoP info X
-
 
1387
			      CStringP     prefix X
-
 
1388
			      KeyP         key X
-
 
1389
			      CStringP     suffix X
-
 
1390
			      unsigned     indent)
1252
		     CStringP suffix, unsigned indent)
1391
{
1253
{
1392
    if (c_out_info_get_lines (info)) {
1254
    if (c_out_info_get_lines(info)) {
1393
	OStreamP ostream = c_out_info_ostream (info);
1255
	OStreamP ostream = c_out_info_ostream(info);
1394
 
1256
 
1395
	c_output_indent (info, indent);
1257
	c_output_indent(info, indent);
1396
	write_cstring (ostream, prefix);
1258
	write_cstring(ostream, prefix);
1397
	write_key (ostream, key);
1259
	write_key(ostream, key);
1398
	write_cstring (ostream, suffix);
1260
	write_cstring(ostream, suffix);
1399
	write_newline (ostream);
1261
	write_newline(ostream);
1400
    }
1262
    }
1401
}
1263
}
1402
 
1264
 
1403
unsigned
1265
unsigned
1404
c_out_next_label PROTO_Z ()
1266
c_out_next_label(void)
1405
{
1267
{
1406
    return (out_current_label ++);
1268
    return(out_current_label++);
1407
}
-
 
1408
 
-
 
1409
void
-
 
1410
c_output_open PROTO_N ((info, indent))
-
 
1411
	      PROTO_T (COutputInfoP info X
-
 
1412
		       unsigned     indent)
-
 
1413
{
-
 
1414
    OStreamP ostream = c_out_info_ostream (info);
-
 
1415
 
-
 
1416
    c_output_indent (info, indent);
-
 
1417
    write_char (ostream, '{');
-
 
1418
    write_newline (ostream);
-
 
1419
}
1269
}
1420
 
1270
 
1421
void
1271
void
1422
c_output_close PROTO_N ((info, indent))
1272
c_output_open(COutputInfoP info, unsigned indent)
1423
	       PROTO_T (COutputInfoP info X
-
 
1424
			unsigned     indent)
-
 
1425
{
1273
{
1426
    OStreamP ostream = c_out_info_ostream (info);
1274
    OStreamP ostream = c_out_info_ostream(info);
1427
 
1275
 
1428
    c_output_indent (info, indent);
1276
    c_output_indent(info, indent);
-
 
1277
    write_char(ostream, '{');
-
 
1278
    write_newline(ostream);
-
 
1279
}
-
 
1280
 
-
 
1281
void
-
 
1282
c_output_close(COutputInfoP info, unsigned indent)
-
 
1283
{
-
 
1284
    OStreamP ostream = c_out_info_ostream(info);
-
 
1285
 
-
 
1286
    c_output_indent(info, indent);
1429
    write_char (ostream, '}');
1287
    write_char(ostream, '}');
1430
    write_newline (ostream);
1288
    write_newline(ostream);
1431
}
1289
}
1432

1290

1433
/*
1291
/*
1434
 * Local variables(smf):
1292
 * Local variables(smf):
1435
 * eval: (include::add-path-entry "../os-interface" "../library")
1293
 * eval: (include::add-path-entry "../os-interface" "../library")