home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 3 / AACD03.BIN / AACD / Programming / sofa / archive / SmallEiffel.lha / SmallEiffel / lib_se / exceptions_handler.e < prev    next >
Text File  |  1999-06-05  |  3KB  |  98 lines

  1. --          This file is part of SmallEiffel The GNU Eiffel Compiler.
  2. --          Copyright (C) 1994-98 LORIA - UHP - CRIN - INRIA - FRANCE
  3. --            Dominique COLNET and Suzanne COLLIN - colnet@loria.fr
  4. --                       http://SmallEiffel.loria.fr
  5. -- SmallEiffel is  free  software;  you can  redistribute it and/or modify it
  6. -- under the terms of the GNU General Public License as published by the Free
  7. -- Software  Foundation;  either  version  2, or (at your option)  any  later
  8. -- version. SmallEiffel is distributed in the hope that it will be useful,but
  9. -- WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  10. -- or  FITNESS FOR A PARTICULAR PURPOSE.   See the GNU General Public License
  11. -- for  more  details.  You  should  have  received a copy of the GNU General
  12. -- Public  License  along  with  SmallEiffel;  see the file COPYING.  If not,
  13. -- write to the  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  14. -- Boston, MA 02111-1307, USA.
  15. --
  16. class EXCEPTIONS_HANDLER
  17.    --
  18.    -- Unique global object in charge of EXCEPTION handling.
  19.    --
  20. inherit GLOBALS;
  21.  
  22. creation make
  23.  
  24. feature
  25.  
  26.    used: BOOLEAN;
  27.          -- Indicate wheter the live code uses EXCEPTIONS or not.
  28.  
  29. feature {NONE}
  30.  
  31.    make is
  32.       do
  33.       end;
  34.  
  35. feature {E_INSPECT}
  36.  
  37.    incorrect_inspect_value(p: POSITION) is
  38.       require
  39.          run_control.no_check
  40.       do
  41.          if used then
  42.             cpp.put_string(
  43.                "internal_exception_handler(Incorrect_inspect_value);%N");
  44.          else
  45.             cpp.put_string("error1(%"Invalid inspect (nothing selected).%",");
  46.             cpp.put_position(p)
  47.             cpp.put_string(fz_14);
  48.          end;
  49.       end;
  50.  
  51. feature {NONE}
  52.  
  53.    fz_exceptions: STRING is "exceptions";
  54.  
  55. feature {RUN_FEATURE}
  56.  
  57.    set_used is
  58.       do
  59.          used := true;
  60.       end;
  61.  
  62. feature {C_PRETTY_PRINTER}
  63.  
  64.    get_started is
  65.       local
  66.          no_check: BOOLEAN;
  67.       do
  68.          no_check := run_control.no_check;
  69.          if used then
  70.             cpp.sys_runtime_h(fz_exceptions);
  71.             cpp.sys_runtime_c(fz_exceptions);
  72.          end;
  73.       end;
  74.  
  75. feature {C_PRETTY_PRINTER}
  76.  
  77.    initialize_runtime is
  78.       do
  79.          if used then
  80.             cpp.put_string("setup_signal_handler();%N");
  81.          end;
  82.       end;
  83.  
  84.    se_evobt is
  85.       require
  86.          run_control.boost
  87.       do
  88.          if used then
  89.             cpp.put_string("(/*se_evobt*/%
  90.                            %internal_exception_handler(Void_call_target))");
  91.          else
  92.             cpp.put_string("(/*se_evobt*/%
  93.                            %se_print_run_time_stack(),exit(1))");
  94.          end;
  95.       end;
  96.  
  97. end -- EXCEPTIONS_HANDLER
  98.