208 |
} |
} |
209 |
|
|
210 |
GENERATE_OUTPUT_TABLE(output_int_table, int) |
GENERATE_OUTPUT_TABLE(output_int_table, int) |
211 |
|
GENERATE_OUTPUT_TABLE(output_unsigned_int_table, unsigned int) |
212 |
GENERATE_OUTPUT_TABLE(output_short_table, short) |
GENERATE_OUTPUT_TABLE(output_short_table, short) |
213 |
GENERATE_OUTPUT_TABLE(output_token_number_table, token_number_t) |
GENERATE_OUTPUT_TABLE(output_token_number_table, token_number_t) |
214 |
GENERATE_OUTPUT_TABLE(output_item_number_table, item_number_t) |
GENERATE_OUTPUT_TABLE(output_item_number_table, item_number_t) |
285 |
prepare_rules (void) |
prepare_rules (void) |
286 |
{ |
{ |
287 |
long int max; |
long int max; |
|
item_number_t *rhsp; |
|
288 |
int r; |
int r; |
289 |
int i = 0; |
unsigned int i = 0; |
290 |
item_number_t *rhs = XMALLOC (item_number_t, nritems); |
item_number_t *rhs = XMALLOC (item_number_t, nritems); |
291 |
short *prhs = XMALLOC (short, nrules + 1); |
unsigned int *prhs = XMALLOC (unsigned int, nrules + 1); |
292 |
|
unsigned int *rline = XMALLOC (unsigned int, nrules + 1); |
293 |
token_number_t *r1 = XMALLOC (token_number_t, nrules + 1); |
token_number_t *r1 = XMALLOC (token_number_t, nrules + 1); |
294 |
short *r2 = XMALLOC (short, nrules + 1); |
unsigned int *r2 = XMALLOC (unsigned int, nrules + 1); |
|
short *rline = XMALLOC (short, nrules + 1); |
|
295 |
|
|
296 |
for (r = 1; r < nrules + 1; ++r) |
for (r = 1; r < nrules + 1; ++r) |
297 |
{ |
{ |
298 |
|
item_number_t *rhsp; |
299 |
/* Index of rule R in RHS. */ |
/* Index of rule R in RHS. */ |
300 |
prhs[r] = i; |
prhs[r] = i; |
301 |
/* RHS of the rule R. */ |
/* RHS of the rule R. */ |
312 |
} |
} |
313 |
assert (i == nritems); |
assert (i == nritems); |
314 |
|
|
315 |
max = output_int_table (&format_obstack, rhs, ritem[0], 1, nritems); |
max = output_item_number_table (&format_obstack, rhs, ritem[0], 1, nritems); |
316 |
muscle_insert ("rhs", obstack_finish (&format_obstack)); |
muscle_insert ("rhs", obstack_finish (&format_obstack)); |
317 |
MUSCLE_INSERT_LONG_INT ("rhs_number_max", max); |
MUSCLE_INSERT_LONG_INT ("rhs_max", max); |
318 |
|
|
319 |
output_short_table (&format_obstack, prhs, 0, 1, nrules + 1); |
max = output_unsigned_int_table (&format_obstack, prhs, 0, 1, nrules + 1); |
320 |
muscle_insert ("prhs", obstack_finish (&format_obstack)); |
muscle_insert ("prhs", obstack_finish (&format_obstack)); |
321 |
|
MUSCLE_INSERT_LONG_INT ("prhs_max", max); |
322 |
|
|
323 |
output_short_table (&format_obstack, rline, 0, 1, nrules + 1); |
max = output_unsigned_int_table (&format_obstack, rline, 0, 1, nrules + 1); |
324 |
muscle_insert ("rline", obstack_finish (&format_obstack)); |
muscle_insert ("rline", obstack_finish (&format_obstack)); |
325 |
|
MUSCLE_INSERT_LONG_INT ("rline_max", max); |
326 |
|
|
327 |
output_token_number_table (&format_obstack, r1, 0, 1, nrules + 1); |
output_token_number_table (&format_obstack, r1, 0, 1, nrules + 1); |
328 |
muscle_insert ("r1", obstack_finish (&format_obstack)); |
muscle_insert ("r1", obstack_finish (&format_obstack)); |
329 |
|
|
330 |
output_short_table (&format_obstack, r2, 0, 1, nrules + 1); |
max = output_unsigned_int_table (&format_obstack, r2, 0, 1, nrules + 1); |
331 |
muscle_insert ("r2", obstack_finish (&format_obstack)); |
muscle_insert ("r2", obstack_finish (&format_obstack)); |
332 |
|
MUSCLE_INSERT_LONG_INT ("r2_max", max); |
333 |
|
|
334 |
free (rhs); |
free (rhs); |
335 |
free (prhs); |
free (prhs); |
336 |
|
free (rline); |
337 |
|
free (r1); |
338 |
free (r2); |
free (r2); |
339 |
} |
} |
340 |
|
|