home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 3 / AACD03.BIN / AACD / Programming / sofa / archive / SmallEiffel.lha / SmallEiffel / lib_se / call_infix1.e < prev    next >
Text File  |  1999-06-05  |  5KB  |  161 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. deferred class CALL_INFIX1
  17.  
  18. inherit CALL_INFIX;
  19.  
  20. feature
  21.  
  22.    run_feature: RUN_FEATURE;
  23.  
  24. feature {NONE}
  25.  
  26.    frozen with(t: like target; fn: like feature_name; a: like arguments;
  27.         rf: RUN_FEATURE; ct: TYPE) is
  28.       require
  29.          t /= Void;
  30.          fn /= Void;
  31.          a.count = 1;
  32.          rf /= Void;
  33.          ct /= Void
  34.       do
  35.          target := t;
  36.          feature_name := fn;
  37.          arguments := a;
  38.          run_feature := rf;
  39.          run_feature_match(ct);
  40.       ensure
  41.          target = t;
  42.          feature_name = fn;
  43.          arguments = a;
  44.          run_feature = rf
  45.       end;
  46.  
  47. feature
  48.  
  49.    frozen result_type: TYPE is
  50.       local
  51.          tla: TYPE_LIKE_ARGUMENT;
  52.       do
  53.          Result := run_feature.result_type;
  54.          if Result.is_like_current then
  55.             Result := run_feature.current_type;
  56.          else
  57.             tla ?= Result;
  58.             if tla /= Void then
  59.                Result := arg1.result_type.run_type;
  60.             end;
  61.          end;
  62.       end;
  63.  
  64. feature {RUN_FEATURE_3,RUN_FEATURE_4}
  65.  
  66.    finalize is
  67.       local
  68.          rc: RUN_CLASS;
  69.          rf: RUN_FEATURE;
  70.       do
  71.          rf := run_feature;
  72.          rc := rf.current_type.run_class;
  73.          run_feature := rc.running.first.dynamic(rf);
  74.       end;
  75.  
  76. feature
  77.  
  78.    frozen to_runnable(ct: TYPE): like Current is
  79.       local
  80.          t: like target;
  81.          a: like arguments;
  82.          tt, at: TYPE;
  83.          tbee: TYPE_BASIC_EIFFEL_EXPANDED;
  84.          rf: RUN_FEATURE;
  85.       do
  86.          t := runnable_expression(target,ct);
  87.          a := runnable_args(arguments,ct);
  88.          tt := t.result_type;
  89.          at := arg1.result_type;
  90.          if at.is_real then
  91.             if tt.is_integer then
  92.                tbee ?= at.run_type;
  93.                !IMPLICIT_CAST!t.make(t,tbee);
  94.             end;
  95.          elseif at.is_double then
  96.             if tt.is_integer or else tt.is_real then
  97.                tbee ?= at.run_type;
  98.                !IMPLICIT_CAST!t.make(t,tbee);
  99.             end;
  100.          end;
  101.          rf := run_feature_for(t,ct);
  102.          if run_feature = Void then
  103.             target := t;
  104.             arguments := a;
  105.             run_feature := rf;
  106.             run_feature_match(ct);
  107.             Result := Current;
  108.          elseif t = target and then a = arguments then
  109.             check
  110.                run_feature = rf
  111.             end;
  112.             Result := Current;
  113.          else
  114.             !!Result.with(t,feature_name,a,rf,ct);
  115.          end;
  116.       end;
  117.  
  118. feature
  119.  
  120.    frozen assertion_check(tag: CHARACTER) is
  121.       do
  122.          if tag = 'R' then
  123.             run_feature.vape_check_from(start_position);
  124.          end;
  125.          target.assertion_check(tag);
  126.          arg1.assertion_check(tag);
  127.       end;
  128.  
  129.    frozen static_value: INTEGER is
  130.       do
  131.          Result := static_value_mem;
  132.       end;
  133.  
  134. feature {NONE}
  135.  
  136.    static_value_mem: INTEGER;
  137.  
  138.    frozen call_is_static: BOOLEAN is
  139.       local
  140.          rc: RUN_CLASS;
  141.          running: ARRAY[RUN_CLASS];
  142.          rf: like run_feature;
  143.       do
  144.          if run_feature /= Void then
  145.             rc := run_feature.run_class;
  146.             if rc /= Void then
  147.                running := rc.running;
  148.                if running /= Void and then running.count = 1 then
  149.                   rf := running.first.dynamic(run_feature);
  150.                   if rf.is_static then
  151.                      static_value_mem := rf.static_value_mem;
  152.                      Result := true;
  153.                   end;
  154.                end;
  155.             end;
  156.          end;
  157.       end;
  158.  
  159. end -- CALL_INFIX1
  160.  
  161.