!+ ! RELEASE_BUFFERS.TPU - Routine to release all buffers !- ! ! Flush all modified buffers to their associated output files and delete ! the buffers. System buffers, and mofied buffers that are either "no_write" ! or have no associated files, are not written out. ! ! ! Buffer Type Action ! ! SYSTEM Ignored (Retained) ! UNMODIFIED Erased and Deleted ! MODIFIED but NO-WRITE Retained ! MODIFIED w/ ASSOCIATED FILE Written out - Erased and Deleted ! MODIFIED w/ NO ASSOCIATED FILE Retained ! procedure eveplus_write_file(the_buffer, file_name) on_error return(0); endon_error; write_file (the_buffer, file_name); return(1); endprocedure procedure eve_release_buffers local the_buffer, file_name, i, success_flag, buffer_count; eve_buffer("CHOICES"); ! Make sure we can't eve_one_window; ! delete surrent_buffer i := 1; loop message(""); exitif (i > 18); i := i + 1; endloop; the_buffer := get_info (buffer, "last"); ! Do it in reverse buffer_count := 0; loop if (get_info(the_buffer, "system") = 0) then ! Only nonsystem buffers if (get_info (the_buffer, "modified")) then if (not get_info (the_buffer, "no_write")) then file_name := get_info (the_buffer, "output_file"); if (file_name = 0) then ! Original if no output ! file name file_name := get_info (the_buffer, "file_name"); endif; if (file_name <> "") then ! Modified files with i := index (file_name, ";"); ! an associated file: if (i <> 0) then ! Strip version number. file_name := substr (file_name, 1, i-1); endif; success_flag := get_info (system, "success"); if (success_flag = 0) then ! Force sucess messages set (success, on); endif; ! Write it out if (eveplus_write_file(the_buffer, file_name)) then erase(the_buffer); delete(the_buffer); ! and get rid of it the_buffer := 0; buffer_count := buffer_count + 1; else ! Stop on errors eve_buffer(get_info(the_buffer, "name")); return; endif; if (success_flag = 0) then ! Restore Success msgs set (success, off); endif; endif; else message(" ** Buffer " + get_info(the_buffer, "name") + " is no-write. **"); endif; else ! Unmodified non-system message("Buffer " + ! buffers are just get_info(the_buffer, "name") + ! disposed of. " deleted"); erase(the_buffer); delete(the_buffer); the_buffer := 0; buffer_count := buffer_count + 1; endif; endif; if (the_buffer = 0) then ! If we deleted it, the_buffer := get_info(buffer, "last"); ! restart at the end else the_buffer := get_info(buffer, "previous"); ! Else get the next endif; exitif (the_buffer = 0); ! That's all, folks! endloop; message(fao("Freed !SL buffer!%S", buffer_count)); eve_buffer("MESSAGES"); ! Make sure we're endprocedure ! somewhere.