home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 3 / AACD03.BIN / AACD / Programming / sofa / archive / SmallEiffel.lha / SmallEiffel / lib_se / e_debug.e < prev    next >
Text File  |  1999-06-05  |  4KB  |  154 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_DEBUG
  17.    --
  18.    -- The instruction "debug ... end".
  19.    --
  20.  
  21. inherit INSTRUCTION;
  22.  
  23. creation make
  24.  
  25. feature
  26.  
  27.    start_position: POSITION;
  28.  
  29.    list: ARRAY[MANIFEST_STRING];
  30.  
  31.    compound: COMPOUND;
  32.  
  33. feature {NONE}
  34.  
  35.    current_type: TYPE;
  36.  
  37. feature
  38.  
  39.    make(sp: like start_position; l: like list; c: like compound) is
  40.       require
  41.          sp /= Void
  42.       do
  43.          start_position := sp;
  44.          list := l;
  45.          compound := c;
  46.       ensure
  47.          start_position = sp;
  48.          list = l;
  49.          compound = c;
  50.       end;
  51.  
  52. feature
  53.  
  54.    is_pre_computable: BOOLEAN is false;
  55.  
  56.    end_mark_comment: BOOLEAN is true;
  57.  
  58. feature
  59.  
  60.    to_runnable(ct: TYPE): like Current is
  61.       do
  62.          if current_type = Void then
  63.             current_type := ct;
  64.             if run_control.debug_check then
  65.                if compound /= Void then
  66.                   compound := compound.to_runnable(ct);
  67.                end;
  68.             end;
  69.             Result := Current;
  70.          else
  71.             !!Result.make(start_position,list,compound);
  72.             Result := Result.to_runnable(ct);
  73.          end;
  74.       end;
  75.  
  76.    afd_check is
  77.       do
  78.          if run_control.debug_check then
  79.             if compound /= Void then
  80.                compound.afd_check;
  81.             end;
  82.          end;
  83.       end;
  84.  
  85.    collect_c_tmp is
  86.       do
  87.       end;
  88.  
  89.    compile_to_c is
  90.       do
  91.          if run_control.debug_check then
  92.             if compound /= Void then
  93.                compound.compile_to_c;
  94.             end;
  95.          end;
  96.       end;
  97.  
  98.    compile_to_jvm is
  99.       do
  100.          if run_control.debug_check then
  101.             if compound /= Void then
  102.                compound.compile_to_jvm;
  103.             end;
  104.          end;
  105.       end;
  106.  
  107.    use_current: BOOLEAN is
  108.       do
  109.          if run_control.debug_check then
  110.             if compound /= Void then
  111.                Result := compound.use_current;
  112.             end;
  113.          end;
  114.       end;
  115.  
  116.    pretty_print is
  117.       local
  118.          i: INTEGER;
  119.       do
  120.          fmt.keyword("debug");
  121.          fmt.level_incr;
  122.          if list /= Void then
  123.             fmt.put_character('(');
  124.             from
  125.                i := list.lower;
  126.             until
  127.                i > list.upper
  128.             loop
  129.                list.item(i).pretty_print;
  130.                i := i + 1;
  131.                if i <= list.upper then
  132.                   fmt.put_character(',')
  133.                end;
  134.             end;
  135.             fmt.put_character(')');
  136.          end;
  137.          fmt.level_decr;
  138.          if compound /= Void then
  139.             compound.pretty_print;
  140.          end;
  141.          fmt.indent;
  142.          fmt.keyword("end;");
  143.          if fmt.print_end_debug then
  144.             fmt.put_end("debug");
  145.          end;
  146.       end;
  147.  
  148. invariant
  149.  
  150.    start_position /= Void
  151.  
  152. end -- E_DEBUG
  153.  
  154.