home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c221 / 5.ddi / MWHC.005 / R3 < prev    next >
Encoding:
Text File  |  1992-12-09  |  2.8 KB  |  74 lines

  1. { (C) Copyright  1986-1992 MetaWare Incorporated;  Santa Cruz, CA 95060. }
  2.  
  3. {
  4.   Interface to intercept I/O and heap overflow errors.
  5. }
  6.  
  7. pragma C_include('Implement.pf');
  8. package Status type Error_type;
  9.    pragma Routine_aliasing_convention(Implement.RTE_aliasing);
  10. {
  11.       Error codes
  12. }
  13. type Error_type = Standard.Cardinal;
  14.  
  15. const
  16.    No_error_occurred        = Error_type(0);
  17.    Error_invalid_function    = Error_type(1);
  18.    Error_file_not_found     = Error_type(2);
  19.    Error_path_not_found     = Error_type(3);
  20.    Error_too_many_open_files    = Error_type(4);
  21.    Error_access_denied        = Error_type(5);
  22.    Error_invalid_handle     = Error_type(6);
  23.    Error_arena_trashed        = Error_type(7);
  24.    Error_not_enough_memory    = Error_type(8);
  25.    Error_invalid_block        = Error_type(9);
  26.    Error_bad_environment    = Error_type(10);
  27.    Error_bad_format        = Error_type(11);
  28.    Error_invalid_access     = Error_type(12);
  29.    Error_invalid_data        = Error_type(13);
  30.    Error_reserved        = Error_type(14);
  31.    Error_invalid_drive        = Error_type(15);
  32.    Error_current_directory    = Error_type(16);
  33.    Error_not_same_device    = Error_type(17);
  34.    Error_no_more_files        = Error_type(18);
  35.    Error_invalid_radix        = Error_type(19);
  36.    Error_numeric_read_failed    = Error_type(20);
  37.    Error_write_failed        = Error_type(21);
  38.    Error_eof_encountered    = Error_type(22);
  39.    -- These two are for the C library, use by its floating point routines.
  40.    -- They may also be returned when High C and Professional Pascal
  41.    -- programs are mixed.
  42.    Error_out_of_domain        = Error_type(23);
  43.    Error_out_of_range        = Error_type(24);
  44.  
  45. var Return_IO_status,            -- If true return IO status in Errno.
  46.     Return_heap_status: Boolean;    -- If true return Heap_status.
  47. #if defined(CDOS) and (defined(iAPX386) or defined(NECV60)) 
  48.         -- For FlexOS 386/V60, errno is a global name.
  49.     pragma data(Import);
  50.     pragma data_aliasing_convention(Implement.GLOBAL_ALIASING_CONVENTION);
  51. var Errno: Error_type;            {Err Status of last I/O or}
  52.     pragma data;
  53. #else   
  54.     Errno: Error_type;            -- Err Status of operation.
  55. #endif
  56.     -- When mixing Pascal with C, C's "errno" variable is equated to the
  57.     -- above location.    Thus C library calls may set the Pascal errno variable.
  58.  
  59. type Errstring = Standard.String(36);
  60.  
  61. function Errtext(E: Error_type): Errstring; external;
  62.     -- Returns the text of an error}
  63. type Achar = Loopholes.Address(Char);
  64. function AErrtext(E: Error_Type): Achar; external;
  65.     -- Returns a pointer to the first character of the message, which
  66.     -- is terminated with a NUL.  This is for the C library's use.
  67.  
  68. procedure Perror(const S: String); external;
  69.    {Writes out error message corresponding to Errno to error output.}
  70.    {If S <> '' then the message will be preceded by S || ': ' }
  71.  
  72. end{package};
  73. pragma Alias(Status,Implement.RTE || 'status');
  74.