home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d5xx / d512 / m2pascal.lha / M2Pascal / src / errors.def next >
Text File  |  1991-07-20  |  2KB  |  73 lines

  1. DEFINITION MODULE errors;
  2.  
  3.  (* 
  4.        By: Greg Mumm
  5.      
  6.       "FatalError" will close all files, cleanup memory and HALT the program.
  7.  
  8.       WARNING: Memory allocations are freed with a call to "freeheap". Make
  9.                sure any memory allocations are set up with this in mind!
  10.  *)
  11.  
  12. FROM FileSystem IMPORT File;
  13.  
  14. FROM Scan       IMPORT NameString, STRING;
  15.  
  16. TYPE 
  17.  
  18.      ErrorType =
  19.                ( none,
  20.                  FileError,
  21.                  FileNotOpened,
  22.                  Scan_DataPastEndOfLine,
  23.                  OutOfMemory,
  24.                  FileClose,
  25.                  MultipleModule,
  26.                  UserHalt,
  27.                  CliHelp,              (* Prints simple help information  *)
  28.                  WorkBench,
  29.                  NoProgramName,
  30.                  NoSupportDEFINITION,
  31.                  NoSupportIMPLEMENTATION,
  32.                  NoSupportFiles,
  33.                  NoSupportGeneric,
  34.                  WriteStatement,
  35.                  UndeterminedProcedure
  36.  
  37.                );
  38.  
  39.  
  40.  (* Fatal error--clean up memory and close all files 
  41.  *)
  42.  
  43. PROCEDURE FatalError   ( message   : ErrorType ); 
  44.  
  45.  
  46.   (* Non fatal error-just print the error 
  47.   *)
  48. PROCEDURE ErrorMessage ( message   : ErrorType ); 
  49.  
  50.  
  51.  
  52.    (* Error concerning a file. The fact that we know it has something to
  53.       do with a file allows us to to print line numbers etc..     
  54.    *)
  55. PROCEDURE ErrorFileMessage ( message    : ErrorType ;
  56.                              name       : NameString    ;
  57.                              LineNumber : CARDINAL );
  58.  
  59.  
  60.    (* Internal error in a module somewhere. This type error should not
  61.       happen on a properly running program. All memory is de-allocated,
  62.       Everything including files are cleaned up and closed
  63.    *)
  64.  
  65. PROCEDURE internal ( AlertString : STRING );
  66.  
  67.  
  68.    (* Clean Up memory, close all files 
  69.     *)
  70. PROCEDURE CleanUp ();
  71.  
  72. END errors.
  73.