213 |
FILE *fp; |
FILE *fp; |
214 |
char *filename; |
char *filename; |
215 |
|
|
216 |
|
m4 *context; |
217 |
|
|
218 |
int exit_status; |
int exit_status; |
219 |
|
|
220 |
program_name = argv[0]; |
program_name = argv[0]; |
230 |
m4__module_init (); |
m4__module_init (); |
231 |
m4_debug_init (); |
m4_debug_init (); |
232 |
m4_include_init (); |
m4_include_init (); |
233 |
m4__symtab_init (); |
|
234 |
|
context = m4_create (); |
235 |
|
|
236 |
#ifdef USE_STACKOVF |
#ifdef USE_STACKOVF |
237 |
setup_stackovf_trap (argv, envp, stackovf_handler); |
setup_stackovf_trap (argv, envp, stackovf_handler); |
390 |
|
|
391 |
if (frozen_file_to_read) |
if (frozen_file_to_read) |
392 |
{ |
{ |
393 |
reload_frozen_state (frozen_file_to_read); |
reload_frozen_state (context, frozen_file_to_read); |
394 |
} |
} |
395 |
else |
else |
396 |
{ |
{ |
397 |
m4_syntax_init (); |
m4_syntax_init (); |
398 |
m4_module_load ("m4", 0); |
m4_module_load (context, "m4", 0); |
399 |
m4_module_load (no_gnu_extensions ? "traditional" : "gnu", 0); |
m4_module_load (context, no_gnu_extensions ? "traditional" : "gnu", 0); |
400 |
} |
} |
401 |
|
|
402 |
/* Import environment variables as macros. The definition are |
/* Import environment variables as macros. The definition are |
442 |
else |
else |
443 |
*macro_value++ = '\0'; |
*macro_value++ = '\0'; |
444 |
TOKEN_TEXT (&token) = macro_value; |
TOKEN_TEXT (&token) = macro_value; |
445 |
m4_macro_define (defines->macro, &token); |
m4_macro_define (context, defines->macro, &token); |
446 |
break; |
break; |
447 |
|
|
448 |
case 'U': |
case 'U': |
449 |
m4_symbol_delete (defines->macro); |
m4_symbol_delete (M4SYMTAB, defines->macro); |
450 |
break; |
break; |
451 |
|
|
452 |
case 't': |
case 't': |
453 |
symbol = m4_symbol_define (defines->macro); |
symbol = m4_symbol_define (M4SYMTAB, defines->macro); |
454 |
SYMBOL_TRACED (symbol) = TRUE; |
SYMBOL_TRACED (symbol) = TRUE; |
455 |
break; |
break; |
456 |
|
|
457 |
case 'm': |
case 'm': |
458 |
m4_module_load (defines->macro, 0); |
m4_module_load (context, defines->macro, 0); |
459 |
break; |
break; |
460 |
|
|
461 |
default: |
default: |
485 |
if (optind == argc) |
if (optind == argc) |
486 |
{ |
{ |
487 |
m4_push_file (stdin, "stdin"); |
m4_push_file (stdin, "stdin"); |
488 |
m4_expand_input (); |
m4_expand_input (context); |
489 |
} |
} |
490 |
else |
else |
491 |
for (; optind < argc; optind++) |
for (; optind < argc; optind++) |
507 |
xfree (filename); |
xfree (filename); |
508 |
} |
} |
509 |
} |
} |
510 |
m4_expand_input (); |
m4_expand_input (context); |
511 |
} |
} |
512 |
#undef NEXTARG |
#undef NEXTARG |
513 |
|
|
514 |
/* Now handle wrapup text. */ |
/* Now handle wrapup text. */ |
515 |
|
|
516 |
while (m4_pop_wrapup ()) |
while (m4_pop_wrapup ()) |
517 |
m4_expand_input (); |
m4_expand_input (context); |
518 |
|
|
519 |
if (frozen_file_to_write) |
if (frozen_file_to_write) |
520 |
produce_frozen_state (frozen_file_to_write); |
produce_frozen_state (context, frozen_file_to_write); |
521 |
else |
else |
522 |
{ |
{ |
523 |
m4_make_diversion (0); |
m4_make_diversion (0); |
529 |
anything left when we're done: it was caused by a memory leak. |
anything left when we're done: it was caused by a memory leak. |
530 |
Strictly, we don't need to do this, but it makes leak detection |
Strictly, we don't need to do this, but it makes leak detection |
531 |
a whole lot easier! */ |
a whole lot easier! */ |
532 |
m4__module_exit (); |
|
533 |
m4__symtab_exit (); |
m4__module_exit (context); |
534 |
m4_syntax_exit (); |
m4_syntax_exit (); |
535 |
m4_output_exit (); |
m4_output_exit (); |
536 |
m4_input_exit (); |
m4_input_exit (); |
537 |
m4_debug_exit (); |
m4_debug_exit (); |
538 |
|
|
539 |
|
m4_delete (context); |
540 |
|
|
541 |
|
m4_hash_exit (); |
542 |
|
|
543 |
#ifdef USE_STACKOVF |
#ifdef USE_STACKOVF |
544 |
stackovf_exit (); |
stackovf_exit (); |
545 |
#endif |
#endif |