home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 3 / AACD03.BIN / AACD / Programming / sofa / archive / SmallEiffel.lha / SmallEiffel / lib_se / e_check.e < prev    next >
Text File  |  1999-06-05  |  4KB  |  126 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 E_CHECK
  17.    --
  18.    -- Instruction "check ... end;".
  19.    --
  20.  
  21. inherit INSTRUCTION;
  22.  
  23. creation make
  24.  
  25. feature {NONE}
  26.  
  27.    check_invariant: CHECK_INVARIANT;
  28.  
  29.    current_type: TYPE;
  30.  
  31.    make(sp: like start_position; hc: COMMENT; l: ARRAY[ASSERTION]) is
  32.       require
  33.          sp /= Void
  34.       do
  35.          if hc /= Void or else l /= Void then
  36.             !!check_invariant.make(sp,hc,l);
  37.          end;
  38.       end;
  39.  
  40. feature
  41.  
  42.    end_mark_comment: BOOLEAN is true;
  43.  
  44.    start_position: POSITION is
  45.          -- Of keyword "check".
  46.       do
  47.          if check_invariant /= Void then
  48.             Result := check_invariant.start_position;
  49.          end;
  50.       end;
  51.  
  52.    to_runnable(ct: TYPE): like Current is
  53.       do
  54.          if run_control.all_check then
  55.             if current_type = Void then
  56.                current_type := ct;
  57.                if check_invariant /= Void then
  58.                   check_invariant := check_invariant.to_runnable(ct);
  59.                end;
  60.                Result := Current;
  61.             else
  62.                !!Result.make(start_position,Void,check_invariant.list);
  63.                Result := Result.to_runnable(ct);
  64.             end;
  65.          else
  66.             current_type := ct;
  67.             Result := Current;
  68.          end;
  69.       end;
  70.  
  71.    afd_check is
  72.       do
  73.          if run_control.all_check and then check_invariant /= Void then
  74.             check_invariant.afd_check;
  75.          end;
  76.       end;
  77.  
  78.    collect_c_tmp is
  79.       do
  80.       end;
  81.  
  82.    compile_to_c is
  83.       do
  84.          if run_control.all_check and then check_invariant /= Void then
  85.             check_invariant.compile_to_c;
  86.          end;
  87.       end;
  88.  
  89.    compile_to_jvm is
  90.       do
  91.          if run_control.all_check and then check_invariant /= Void then
  92.             check_invariant.compile_to_jvm(true);
  93.             code_attribute.opcode_pop;
  94.          end;
  95.       end;
  96.  
  97.    is_pre_computable: BOOLEAN is
  98.       do
  99.          if run_control.all_check and then check_invariant /= Void then
  100.             Result := check_invariant.is_pre_computable;
  101.          else
  102.             Result := true;
  103.          end;
  104.       end;
  105.  
  106.    use_current: BOOLEAN is
  107.       do
  108.          if run_control.all_check and then check_invariant /= Void then
  109.             Result := check_invariant.use_current;
  110.          end;
  111.       end;
  112.  
  113.    pretty_print is
  114.       do
  115.          if check_invariant /= Void then
  116.             check_invariant.pretty_print;
  117.             fmt.put_string("end;");
  118.             if fmt.print_end_check then
  119.                fmt.put_end("check");
  120.             end;
  121.          end;
  122.       end;
  123.  
  124. end -- E_CHECK
  125.  
  126.