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