home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 3 / AACD03.BIN / AACD / Programming / sofa / archive / SmallEiffel.lha / SmallEiffel / lib_se / call_1_c.e < prev    next >
Text File  |  1999-06-05  |  5KB  |  214 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 CALL_1_C
  17.    --
  18.    -- Other kinds of call with only one argument.
  19.    --
  20.  
  21. inherit CALL_1;
  22.  
  23. creation make, with
  24.  
  25. feature
  26.  
  27.    run_feature: RUN_FEATURE;
  28.  
  29. feature {NONE}
  30.  
  31.    make(t: like target; fn: like feature_name; a: like arguments) is
  32.       require
  33.          t /= Void;
  34.          fn /= Void;
  35.          a.count = 1
  36.       do
  37.          target := t;
  38.          feature_name := fn;
  39.          arguments := a;
  40.       ensure
  41.          target = t;
  42.          feature_name = fn;
  43.          arguments = a
  44.       end;
  45.  
  46.    with(t: like target; fn: like feature_name; a: like arguments;
  47.         rf: RUN_FEATURE; ct: TYPE) is
  48.       require
  49.          t /= Void;
  50.          fn /= Void;
  51.          a.count = 1;
  52.          rf /= Void
  53.       do
  54.          target := t;
  55.          feature_name := fn;
  56.          arguments := a;
  57.          run_feature := rf;
  58.          run_feature_match(ct);
  59.       ensure
  60.          target = t;
  61.          feature_name = fn;
  62.          arguments = a;
  63.          run_feature = rf
  64.       end;
  65.  
  66. feature
  67.  
  68.    result_type: TYPE is
  69.       local
  70.          tla: TYPE_LIKE_ARGUMENT;
  71.       do
  72.          Result := run_feature.result_type;
  73.          if Result.is_like_current then
  74.             Result := run_feature.current_type;
  75.          else
  76.             tla ?= Result;
  77.             if tla /= Void then
  78.                Result := arg1.result_type.run_type;
  79.             end;
  80.          end;
  81.       end;
  82.  
  83.    to_runnable(ct: TYPE): like Current is
  84.       local
  85.          t: like target;
  86.          a: like arguments;
  87.          rf: RUN_FEATURE;
  88.       do
  89.          t := runnable_expression(target,ct);
  90.          a := runnable_args(arguments,ct);
  91.          rf := run_feature_for(t,ct);
  92.          if run_feature = Void then
  93.             target := t;
  94.             arguments := a;
  95.             run_feature := rf;
  96.             run_feature_match(ct);
  97.             Result := Current;
  98.          elseif t = target and then a = arguments then
  99.             check
  100.                run_feature = rf
  101.             end;
  102.             Result := Current;
  103.          else
  104.             !!Result.with(t,feature_name,a,rf,ct);
  105.          end;
  106.       end;
  107.  
  108.    assertion_check(tag: CHARACTER) is
  109.       do
  110.          if tag = 'R' then
  111.             run_feature.vape_check_from(start_position);
  112.          end;
  113.          target.assertion_check(tag);
  114.          arg1.assertion_check(tag);
  115.       end;
  116.  
  117.    is_static: BOOLEAN is
  118.       local
  119.          running: ARRAY[RUN_CLASS];
  120.          rf: like run_feature;
  121.       do
  122.          running := run_feature.run_class.running;
  123.          if running /= Void and then running.count = 1 then
  124.             rf := running.first.dynamic(run_feature);
  125.             if rf.is_static then
  126.                Result := true;
  127.             end;
  128.          end;
  129.       end;
  130.  
  131.    static_value: INTEGER is
  132.       local
  133.          running: ARRAY[RUN_CLASS];
  134.          rf: like run_feature;
  135.       do
  136.          running := run_feature.run_class.running;
  137.          if running /= Void and then running.count = 1 then
  138.             rf := running.first.dynamic(run_feature);
  139.             if rf.is_static then
  140.                Result := rf.static_value_mem;
  141.             end;
  142.          end;
  143.       end;
  144.  
  145.    precedence: INTEGER is
  146.       do
  147.          Result := dot_precedence;
  148.       end;
  149.  
  150.    compile_to_c is
  151.       do
  152.          call_proc_call_c2c;
  153.       end;
  154.  
  155.    short is
  156.       do
  157.          target.short_target;
  158.          run_feature.name.short;
  159.          arg1.bracketed_short;
  160.       end;
  161.  
  162.    short_target is
  163.       do
  164.          short;
  165.          short_print.a_dot;
  166.       end;
  167.  
  168.    bracketed_pretty_print, pretty_print is
  169.       do
  170.          target.print_as_target;
  171.          fmt.put_string(feature_name.to_string);
  172.          fmt.put_character('(');
  173.          arg1.pretty_print;
  174.          fmt.put_character(')');
  175.       end;
  176.  
  177.    isa_dca_inline_argument: INTEGER is
  178.       do
  179.       end;
  180.  
  181.    dca_inline_argument(formal_arg_type: TYPE) is
  182.       do
  183.       end;
  184.  
  185.    compile_to_jvm is
  186.       do
  187.          call_proc_call_c2jvm;
  188.       end;
  189.  
  190.    jvm_branch_if_false: INTEGER is
  191.       do
  192.          Result := jvm_standard_branch_if_false;
  193.       end;
  194.  
  195.    jvm_branch_if_true: INTEGER is
  196.       do
  197.          Result := jvm_standard_branch_if_true;
  198.       end;
  199.  
  200. feature {RUN_FEATURE_3,RUN_FEATURE_4}
  201.  
  202.    finalize is
  203.       local
  204.          rc: RUN_CLASS;
  205.          rf: RUN_FEATURE;
  206.       do
  207.          rf := run_feature;
  208.          rc := rf.current_type.run_class;
  209.          run_feature := rc.running.first.dynamic(rf);
  210.       end;
  211.  
  212. end -- CALL_1_C
  213.  
  214.