home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 3 / AACD03.BIN / AACD / Programming / sofa / archive / SmallEiffel.lha / SmallEiffel / lib_se / e_precursor_function.e < prev    next >
Text File  |  1999-06-05  |  5KB  |  213 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_PRECURSOR_FUNCTION
  17.    --
  18.    -- Handling of the pseudo variable "Current".
  19.    --
  20.  
  21. inherit
  22.    E_PRECURSOR redefine run_feature end;
  23.    EXPRESSION;
  24.  
  25. creation make
  26.  
  27. feature {E_PRECURSOR}
  28.  
  29.    run_feature: RUN_FEATURE_11;
  30.  
  31. feature
  32.  
  33.    is_pre_computable: BOOLEAN is false;
  34.  
  35.    is_static: BOOLEAN is false;
  36.  
  37.    is_writable: BOOLEAN is false;
  38.  
  39.    c_simple: BOOLEAN is false;
  40.  
  41.    can_be_dropped: BOOLEAN is false
  42.  
  43.    isa_dca_inline_argument: INTEGER is 0;
  44.  
  45. feature
  46.  
  47.    static_result_base_class: BASE_CLASS is
  48.       local
  49.          e_feature: E_FEATURE;
  50.          rt: TYPE;
  51.          bcn: CLASS_NAME;
  52.       do
  53.          if run_feature /= Void then
  54.             e_feature := run_feature.base_feature;
  55.             rt := e_feature.result_type;
  56.             bcn := rt.static_base_class_name;
  57.             if bcn /= void then
  58.                Result := bcn.base_class;
  59.             end;
  60.          end;
  61.       end;
  62.  
  63.    result_type: TYPE is
  64.       do
  65.          Result := run_feature.result_type;
  66.       end;
  67.  
  68.  
  69.    collect_c_tmp is
  70.       do
  71.          if run_feature /= Void then
  72.             run_feature.collect_c_tmp;
  73.          end;
  74.          if arguments /= Void then
  75.             arguments.collect_c_tmp;
  76.          end;
  77.       end;
  78.  
  79.  
  80.    to_runnable(ct: TYPE): like Current is
  81.       local
  82.          wrf: RUN_FEATURE;
  83.          super: EFFECTIVE_ROUTINE;
  84.          pn: PRECURSOR_NAME;
  85.       do
  86.          if current_type = Void then
  87.             current_type := ct;
  88.             Result := Current;
  89.             wrf := small_eiffel.top_rf;
  90.             if wrf.result_type = Void then
  91.                eh.add_position(start_position);
  92.                fatal_error("Inside a procedure, a Precursor call must %
  93.                            %be a procedure call (not a function call).");
  94.             end;
  95.             super := super_feature(wrf);
  96.             pn := precursor_name(wrf.name,super);
  97.             !!run_feature.make(ct,pn,super);
  98.             prepare_arguments(ct);
  99.          else
  100.             !!Result.make(start_position,parent,arguments);
  101.             Result := Result.to_runnable(ct);
  102.          end;
  103.       end;
  104.  
  105. feature
  106.  
  107.    static_value: INTEGER is
  108.       do
  109.       end;
  110.  
  111.    dca_inline_argument(formal_arg_type: TYPE) is
  112.       do
  113.       end;
  114.  
  115.    assertion_check(tag: CHARACTER) is
  116.       do
  117.       end;
  118.  
  119.    precedence: INTEGER is
  120.       do
  121.          Result := dot_precedence;
  122.       end;
  123.  
  124. feature
  125.  
  126.    mapping_c_target(formal_type: TYPE) is
  127.       do
  128.          compile_to_c;
  129.       end;
  130.  
  131.    mapping_c_arg(formal_arg_type: TYPE) is
  132.       do
  133.          compile_to_c;
  134.       end;
  135.  
  136.    c_declare_for_old is
  137.       do
  138.          if arguments /= Void then
  139.             arguments.c_declare_for_old;
  140.          end;
  141.       end;
  142.  
  143.    compile_to_c_old is
  144.       do
  145.          if arguments /= Void then
  146.             arguments.compile_to_c_old;
  147.          end;
  148.       end;
  149.  
  150. feature
  151.  
  152.    compile_target_to_jvm is
  153.       do
  154.          standard_compile_target_to_jvm;
  155.       end;
  156.  
  157.    compile_to_jvm_old is
  158.       do
  159.          if arguments /= Void then
  160.             arguments.compile_to_jvm_old;
  161.          end;
  162.       end;
  163.  
  164.    compile_to_jvm_into(dest: TYPE): INTEGER is
  165.       do
  166.          Result := standard_compile_to_jvm_into(dest);
  167.       end;
  168.  
  169. feature
  170.  
  171.    jvm_branch_if_false: INTEGER is
  172.       do
  173.          compile_to_jvm;
  174.          Result := code_attribute.opcode_ifeq;
  175.       end;
  176.  
  177.    jvm_branch_if_true: INTEGER is
  178.       do
  179.          compile_to_jvm;
  180.          Result := code_attribute.opcode_ifne;
  181.       end;
  182.  
  183.    jvm_assign is
  184.       do
  185.       end;
  186.  
  187.    bracketed_pretty_print is
  188.       do
  189.          pretty_print;
  190.       end;
  191.  
  192.    print_as_target is
  193.       do
  194.          pretty_print;
  195.          fmt.put_character('.');
  196.       end;
  197.  
  198.    short is
  199.       do
  200.       end;
  201.  
  202.    short_target is
  203.       do
  204.       end;
  205.  
  206. feature {NONE}
  207.  
  208.    put_semi_colon is
  209.       do
  210.       end;
  211.  
  212. end -- E_PRECURSOR_FUNCTION
  213.