void input_scrub_include_sb (sb *from, char *position, int is_expansion) { if (macro_nest > max_macro_nest) as_fatal (_("macros nested too deeply")); ++macro_nest; #ifdef md_macro_start if (is_expansion) { md_macro_start (); } #endif next_saved_file = input_scrub_push (position); sb_new (&from_sb); from_sb_is_expansion = is_expansion; if (from->len >= 1 && from->ptr[0] != '\n') { /* Add the sentinel required by read.c. */ sb_add_char (&from_sb, '\n'); } sb_scrub_and_add_sb (&from_sb, from); sb_index = 1; /* These variables are reset by input_scrub_push. Restore them since we are, after all, still at the same point in the file. */ logical_input_line = next_saved_file->logical_input_line; logical_input_file = next_saved_file->logical_input_file; }
void input_scrub_include_sb (sb *from, char *position, int is_expansion) { int newline; if (macro_nest > max_macro_nest) as_fatal (_("macros nested too deeply")); ++macro_nest; #ifdef md_macro_start if (is_expansion) { md_macro_start (); } #endif next_saved_file = input_scrub_push (position); /* Allocate sufficient space: from->len + optional newline. */ newline = from->len >= 1 && from->ptr[0] != '\n'; sb_build (&from_sb, from->len + newline); from_sb_is_expansion = is_expansion; if (newline) { /* Add the sentinel required by read.c. */ sb_add_char (&from_sb, '\n'); } sb_scrub_and_add_sb (&from_sb, from); /* Make sure the parser looks at defined contents when it scans for e.g. end-of-line at the end of a macro. */ sb_terminate (&from_sb); sb_index = 1; /* These variables are reset by input_scrub_push. Restore them since we are, after all, still at the same point in the file. */ logical_input_line = next_saved_file->logical_input_line; logical_input_file = next_saved_file->logical_input_file; }
char * input_scrub_include_file (char *filename, char *position) { next_saved_file = input_scrub_push (position); return input_scrub_new_file (filename); }