static void edwin_auto_save (void) { static SCHEME_OBJECT position; static struct interpreter_state_s new_state; position = ((VECTOR_P (fixed_objects)) ? (VECTOR_REF (fixed_objects, FIXOBJ_EDWIN_AUTO_SAVE)) : EMPTY_LIST); while (PAIR_P (position)) { SCHEME_OBJECT entry = (PAIR_CAR (position)); position = (PAIR_CDR (position)); if ((PAIR_P (entry)) && (GROUP_P (PAIR_CAR (entry))) && (STRING_P (PAIR_CDR (entry))) && ((GROUP_MODIFIED_P (PAIR_CAR (entry))) == SHARP_T)) { SCHEME_OBJECT group = (PAIR_CAR (entry)); char * namestring = (STRING_POINTER (PAIR_CDR (entry))); unsigned long length; unsigned char * start = (GROUP_TEXT (group, (&length))); unsigned char * end = (start + length); unsigned char * gap_start = (start + (GROUP_GAP_START (group))); unsigned char * gap_end = (start + (GROUP_GAP_END (group))); if ((start < gap_start) || (gap_end < end)) { bind_interpreter_state (&new_state); if ((setjmp (interpreter_catch_env)) == 0) { Tchannel channel; outf_error ("Auto-saving file \"%s\"\n", namestring); outf_flush_error (); channel = (OS_open_output_file (namestring)); if (start < gap_start) OS_channel_write (channel, start, (gap_start - start)); if (gap_end < end) OS_channel_write (channel, gap_end, (end - gap_end)); OS_channel_close (channel); } unbind_interpreter_state (&new_state); } } } }
static void copy_space(Array *from, Array *to) { Object scanned = from->head; while(scanned!=from->current) { switch(TYPE(scanned)) { case T_PAIR: COPY_TO(PAIR_CAR(scanned)); COPY_TO(PAIR_CDR(scanned)); break; default: break; } ++scanned; } }
static void delete_temp_files (void) { static SCHEME_OBJECT position; static struct interpreter_state_s new_state; position = ((VECTOR_P (fixed_objects)) ? (VECTOR_REF (fixed_objects, FIXOBJ_FILES_TO_DELETE)) : EMPTY_LIST); while (PAIR_P (position)) { SCHEME_OBJECT entry = (PAIR_CAR (position)); position = (PAIR_CDR (position)); if (STRING_P (entry)) { bind_interpreter_state (&new_state); if ((setjmp (interpreter_catch_env)) == 0) OS_file_remove (STRING_POINTER (entry)); unbind_interpreter_state (&new_state); } } }