static struct input_save * input_scrub_push (char *saved_position) { register struct input_save *saved; saved = (struct input_save *) xmalloc (sizeof *saved); saved->saved_position = saved_position; saved->buffer_start = buffer_start; saved->partial_where = partial_where; saved->partial_size = partial_size; saved->buffer_length = buffer_length; saved->physical_input_file = physical_input_file; saved->logical_input_file = logical_input_file; saved->physical_input_line = physical_input_line; saved->logical_input_line = logical_input_line; saved->sb_index = sb_index; saved->from_sb = from_sb; saved->from_sb_is_expansion = from_sb_is_expansion; memcpy (saved->save_source, save_source, sizeof (save_source)); saved->next_saved_file = next_saved_file; saved->input_file_save = input_file_push (); input_file_begin (); /* Reinitialize! */ logical_input_line = -1; logical_input_file = (char *) NULL; buffer_length = input_file_buffer_size (); sb_index = -1; buffer_start = (char *) xmalloc ((BEFORE_SIZE + buffer_length + buffer_length + AFTER_SIZE)); memcpy (buffer_start, BEFORE_STRING, (int) BEFORE_SIZE); return saved; }
/* Push the state of our input, returning a pointer to saved info that can be restored with input_file_pop (). */ char *input_file_push () { register struct saved_file *saved; saved = (struct saved_file *)xmalloc (sizeof *saved); saved->f_in = f_in; saved->file_name = file_name; saved->preprocess = preprocess; if (preprocess) saved->app_save = app_push (); input_file_begin (); /* Initialize for new file */ return (char *)saved; }
char * input_file_push (void) { struct saved_file *saved; saved = XNEW (struct saved_file); saved->f_in = f_in; saved->file_name = file_name; saved->preprocess = preprocess; if (preprocess) saved->app_save = app_push (); /* Initialize for new file. */ input_file_begin (); return (char *) saved; }
void input_scrub_begin (void) { know (strlen (BEFORE_STRING) == BEFORE_SIZE); know (strlen (AFTER_STRING) == AFTER_SIZE || (AFTER_STRING[0] == '\0' && AFTER_SIZE == 1)); input_file_begin (); buffer_length = input_file_buffer_size (); buffer_start = xmalloc ((BEFORE_SIZE + buffer_length + buffer_length + AFTER_SIZE)); memcpy (buffer_start, BEFORE_STRING, (int) BEFORE_SIZE); /* Line number things. */ logical_input_line = -1; logical_input_file = (char *) NULL; physical_input_file = NULL; /* No file read yet. */ next_saved_file = NULL; /* At EOF, don't pop to any other file */ do_scrub_begin (flag_m68k_mri); }