home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 3 / AACD03.BIN / AACD / Programming / sofa / archive / SmallEiffel.lha / SmallEiffel / lib_se / proc_call_0.e < prev    next >
Text File  |  1999-06-05  |  4KB  |  135 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 PROC_CALL_0
  17.    --
  18.    -- For procedure calls without argument (only Current).
  19.    --
  20.  
  21. inherit PROC_CALL;
  22.  
  23. creation make, with
  24.  
  25. feature
  26.  
  27.    arg_count: INTEGER is 0;
  28.  
  29. feature {NONE}
  30.  
  31.    make(t: like target; fn: like feature_name) is
  32.       require
  33.          t /= Void;
  34.          fn /= Void;
  35.       do
  36.          target := t;
  37.          feature_name := fn;
  38.       ensure
  39.          target = t;
  40.          feature_name = fn
  41.       end;
  42.  
  43.    with(t: like target; fn: like feature_name; rf: RUN_FEATURE) is
  44.       require
  45.          t /= Void;
  46.          fn /= Void;
  47.          rf /= Void
  48.       do
  49.          target := t;
  50.          feature_name := fn;
  51.          run_feature := rf;
  52.          run_feature_match;
  53.       ensure
  54.          target = t;
  55.          feature_name = fn;
  56.          run_feature = rf
  57.       end;
  58.  
  59. feature
  60.  
  61.    arguments: EFFECTIVE_ARG_LIST is
  62.       do
  63.       end;
  64.  
  65.    to_runnable(ct: TYPE): like Current is
  66.       local
  67.          t: like target;
  68.          rf: RUN_FEATURE;
  69.       do
  70.          t := runnable_expression(target,ct);
  71.          rf := run_feature_for(t,ct);
  72.          if run_feature = Void then
  73.             target := t;
  74.             run_feature := rf;
  75.             run_feature_match;
  76.             Result := Current;
  77.          elseif t = target then
  78.             check
  79.                run_feature = rf
  80.             end;
  81.             Result := Current;
  82.          else
  83.             !!Result.make(t,feature_name);
  84.             Result := Result.to_runnable(ct);
  85.          end;
  86.       end;
  87.  
  88.    compile_to_jvm is
  89.       do
  90.          call_proc_call_c2jvm;
  91.       end;
  92.  
  93.    pretty_print is
  94.       do
  95.          target.print_as_target;
  96.          fmt.put_string(feature_name.to_string);
  97.          if fmt.semi_colon_flag then
  98.             fmt.put_character(';');
  99.          end;
  100.       end;
  101.  
  102. feature -- {CREATION_CALL}
  103.  
  104.    make_runnable(w: like target; a: like arguments;
  105.                  rf: RUN_FEATURE): like Current is
  106.       do
  107.          if run_feature = Void then
  108.             target := w;
  109.             run_feature := rf;
  110.             Result := Current;
  111.          else
  112.             !!Result.make(w,feature_name);
  113.             Result.set_run_feature(rf);
  114.          end;
  115.       end;
  116.  
  117. feature {NONE}
  118.  
  119.    run_feature_match is
  120.       do
  121.          run_feature_has_no_result;
  122.          if run_feature.arguments /= Void then
  123.             eh.add_position(feature_name.start_position);
  124.             eh.add_position(run_feature.start_position);
  125.             fatal_error("Feature found has arguments.");
  126.          end;
  127.       end;
  128.  
  129. invariant
  130.  
  131.    arguments = Void;
  132.  
  133. end -- PROC_CALL_0
  134.  
  135.