!+ ! 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 ! ! Modified for FRED by P.B. Wischow 26 Mar 1987 ! ! PROCEDURE decus$release_buffers LOCAL the_buffer, file_name, i, success_flag, buffer_count; eve_buffer ("CHOICES"); ! Make sure we can't eve_one_window; ! delete current_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 success messages SET (success, on); endif; if (fred$write_buffer (the_buffer)) then ! Write it out 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 write-locked. **"); 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.