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

  1. {*********************************************************************
  2. (C) Copyright 1983-92; MetaWare Incorporated;  Santa Cruz, CA 95060.
  3. *********************************************************************}
  4. pragma on(Optimize_for_space);
  5. Export(Here);
  6. pragma include('system.pf');
  7. pragma C_include('Implement.pf');
  8. with Implement:[Int];
  9. package Here;
  10.    pragma Routine_aliasing_convention(Implement.CLIB_aliasing);
  11.    procedure Exit(RC:Int);    External;
  12.    procedure _Exit(RC:Int); External;
  13.    procedure Abort(); external;
  14.    end;
  15.  
  16. package Elsewhere;
  17.    pragma Routine_aliasing_convention(Implement.RTE_aliasing);
  18.    procedure Restore_interrupts;External;
  19.    end;
  20.  
  21.  
  22. program Implement_exits;
  23. pragma Alias(Implement_exits,Implement.RTE || 'exits');
  24.  
  25. -- C library functions:
  26.  
  27. procedure Exit(RC:Int);
  28.    begin
  29.    -- Pascal halt goes through normal termination, including
  30.    -- calling functions registered with on_exit, if the HC run-time library
  31.    -- was linked ahead of the Pascal run-time library (if included).
  32.    Halt(RC);    -- Pascal halt.
  33.    end;
  34. procedure _Exit(RC:Int);
  35.    begin
  36. #ifndef CDOS   
  37.    Elsewhere.RESTORE_interrupts;
  38. #endif   
  39.    System.DOS_exit(RC);
  40.    end;
  41. procedure Abort;
  42.    begin
  43.    _exit(-1); --where -1 is the implementation defined status "unsuccessful
  44.           --termination".  This almost meets Ansi standard.  Ansi wants
  45.           --the kill function to be called, and abort should do nothing
  46.           --if signal SIGABRT is being ignored- but we have no signals.
  47.    end;
  48.  
  49. { (C) Copyright 1983-1985;  unpublished property and trade secret of }
  50. { MetaWare Incorporated; Santa Cruz, CA 95060; detailed notice above.}
  51.