(*=================================================================================*)
DEFINITION MODULE osconstants; (* Franz Kronseder 05.02.85 *)
                               (* last modification 06.02.85 *)
(* MODULA constant definitions from the UNIT intrfc/osintf for the MacIntosh *)

EXPORT QUALIFIED
NoErr,MemFullErr,NilHandleErr,MemWZErr,MemPurErr,DirFulErr,DskFulErr,NSVErr,
 IOErr,BdNamErr,FNOpnErr,EOFErr,PosErr,MFulErr,TMFOErr,FNFErr,WPrErr,FLckdErr,
VLckdErr,FBsyErr,DupFNErr,OpWrErr ,ParamErr,RFNumErr,GFPErr,VolOffLinErr,
 PermErr,VolOnLinErr,NSDrvErr,NoMacDskErr,ExtFSErr,FSDSErr,BadMDBErr,WrPermErr,
 firstDskErr,lastDskErr,MaxSize,fHasBundle,fInvisible;

CONST
  NoErr        =    0;     (* All is well *)
  MemFullErr   = -108;     (* Not enough room in heap zone *)
  NilHandleErr = -109;     (* Master Pointer was NIL in HandleZone or other    *)
  MemWZErr     = -111;     (* WhichZone failed (applied to free block)         *)
  MemPurErr    = -112;     (* trying to purge a locked or non-purgeable block  *)

  (*file system error codes*)
  DirFulErr   =    -33;     (* Directory full*)
  DskFulErr   =    -34;     (* disk full*)
  NSVErr      =    -35;     (* no such volume*)
  IOErr       =    -36;     (* I/O error (bummers)*)
  BdNamErr    =    -37;     (* there may be no bad names in the final system!*)
  FNOpnErr    =    -38;     (* File not open*)
  EOFErr      =    -39;     (* End of file*)
  PosErr      =    -40;     (* tried to position to before start of file (r/w)*)
  MFulErr     =    -41;     (* memory full(open) or file won't fit (load)*)
  TMFOErr     =    -42;     (* too many files open*)
  FNFErr      =    -43;     (* File not found*)

  WPrErr      =    -44;     (* diskette is write protected*)
  FLckdErr    =    -45;     (* file is locked*)
  VLckdErr    =    -46;     (* volume is locked*)
  FBsyErr     =    -47;     (* File is busy (delete)*)
  DupFNErr    =    -48;     (* duplicate filename (rename)*)
  OpWrErr     =    -49;     (* file already open with with write permission*)
  ParamErr    =    -50;    (* error in user parameter list*)
  RFNumErr    =    -51;     (* refnum error*)
  GFPErr      =    -52;     (* get file position error*)
  VolOffLinErr =   -53;     (* volume not on line error (was Ejected)*)
  PermErr     =    -54;     (* permissions error (on file open)*)
  VolOnLinErr =    -55;     (* drive volume already on-line at MountVol*)
  NSDrvErr    =    -56;     (* no such drive (tried to mount a bad drive num)*)
  NoMacDskErr =    -57;     (* not a mac diskette (sig bytes are wrong)*)
  ExtFSErr    =    -58;     (* volume in question belongs to an external fs*)
  FSDSErr     =    -59;     (* file system deep s--t error:*)
                              (*  during rename the old entry was deleted *)
                              (*  but could not be restored . . .*)
  BadMDBErr   =    -60;     (* bad master directory block*)
  WrPermErr   =    -61;     (* write permissions error*)
  firstDskErr =    -84;     (*first of the range of low-level disk errors*)
  lastDskErr  =    -64;     (*last of the range of low-level disk errors*)

  MaxSize    = 800000H;  (* Max data block size is 512K bytes  *)

  (*finder constants*)
  fHasBundle = 32;
  fInvisible = 64;
  
  (* Modula-2 Halt Indices :
    -11 : uninitialized interrupt vector
    -10 : interrupt format error
     -9 : Line 1111 emulator interrupt
     -8 : Line 1010 emulator interrupt
     -7 : Privilege Violation Trap
     -6 : Arithmetic overflow (TRAPV Trap)
     -5 : Index out of range (CHK Trap)
     -4 : Zero Divide (ZerDivTrap)
     -3 : Illegal Instruction Trap
     -2 : Address Error Trap (Odd Address)
     -1 : Bus Error Trap (Timeout)
      0 : HALT called
      1 : No RETURN from function
      2 : CASE Index out of range
      3 : Stack overflow
      4 : Index or value out of range
      5 : Arithmetic overflow (REAL)
      6 : Improper workspace to NEWPROCESS
      7 : Coroutine terminates
      8 : Call to unimplemented SYSTEMX routine
      
    *)
    
    (* 
    Bomb IDs that may occur because of errors in Modula-2 programs:
    ID= 2 : Address Error (odd address, bad Pointer value)
    ID= 3 : illegal instruction trap
    ID= 4 : zero divide trap
    ID= 5 : check trap error (array bound error etc)
    ID= 6 : overflow trap
    ID= 7 : privilege violation trap
    ID= 9 : Line 1010 trap
    ID=10 : Line 1111 trap
    ID=11 : miscellaneous traps
    
    note: these errors occur most probably because of overwritten programs
    *)
    

END osconstants.
(*=================================================================================*)

