home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 3 / AACD03.BIN / AACD / Programming / sofa / archive / SmallEiffel.lha / SmallEiffel / lib_se / run_feature_11.e < prev    next >
Text File  |  1999-06-05  |  5KB  |  202 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 RUN_FEATURE_11
  17.    --
  18.    -- For some precursor function called feature.
  19.    --
  20. inherit
  21.    RUN_FEATURE
  22.       redefine
  23.          base_feature, fall_down
  24.       end;
  25.  
  26. creation {E_PRECURSOR_FUNCTION} make
  27.  
  28. feature
  29.  
  30.    base_feature: EFFECTIVE_ROUTINE;
  31.  
  32.    arguments: FORMAL_ARG_LIST;
  33.  
  34.    result_type: TYPE;
  35.  
  36.    require_assertion: RUN_REQUIRE;
  37.  
  38.    local_vars: LOCAL_VAR_LIST;
  39.  
  40.    routine_body: COMPOUND;
  41.  
  42.    rescue_compound: COMPOUND;
  43.  
  44.    ensure_assertion: E_ENSURE;
  45.  
  46. feature
  47.  
  48.    is_static: BOOLEAN is false;
  49.  
  50.    is_pre_computable: BOOLEAN is false;
  51.  
  52.    can_be_dropped: BOOLEAN is false;
  53.  
  54.    is_once_function: BOOLEAN is false;
  55.  
  56. feature
  57.  
  58.    fall_down is
  59.       do
  60.       end;
  61.  
  62.    static_value_mem: INTEGER is
  63.       do
  64.       end;
  65.  
  66.    afd_check is
  67.       do
  68.          routine_afd_check;
  69.       end;
  70.  
  71.    mapping_c is
  72.       local
  73.          tmp_expanded_idx: INTEGER;
  74.       do
  75.          tmp_expanded_idx := cpp.se_tmp_open(Current);
  76.          default_mapping_function;
  77.          if tmp_expanded_idx >= 0 then
  78.             cpp.se_tmp_close(tmp_expanded_idx);
  79.          end;
  80.       end;
  81.  
  82.    c_define is
  83.       do
  84.          if use_current then
  85.             cpp.incr_function_count;
  86.          else
  87.             cpp.incr_real_function_count;
  88.          end;
  89.          define_prototype;
  90.          c_define_opening;
  91.          if routine_body /= Void then
  92.             routine_body.compile_to_c;
  93.          end;
  94.          c_define_closing;
  95.          cpp.put_string(fz_15);
  96.          c_frame_descriptor;
  97.       end;
  98.  
  99. feature {RUN_CLASS}
  100.  
  101.    jvm_field_or_method is
  102.       do
  103.          jvm.add_method(Current);
  104.       end;
  105.  
  106. feature
  107.  
  108.    mapping_jvm is
  109.       do
  110.          routine_mapping_jvm;
  111.       end;
  112.  
  113. feature {JVM}
  114.  
  115.    jvm_define is
  116.       do
  117.          method_info_start;
  118.          jvm_define_opening;
  119.          if routine_body /= Void then
  120.             routine_body.compile_to_jvm;
  121.          end;
  122.          jvm_define_closing;
  123.          result_type.jvm_push_local(jvm_result_offset);
  124.          result_type.run_type.jvm_return_code;
  125.          method_info.finish;
  126.       end;
  127.  
  128. feature {NONE}
  129.  
  130.    jvm_result_store is
  131.       do
  132.          result_type.jvm_write_local(jvm_result_offset);
  133.       end;
  134.  
  135.    update_tmp_jvm_descriptor is
  136.       do
  137.          routine_update_tmp_jvm_descriptor;
  138.       end;
  139.  
  140. feature {E_PRECURSOR}
  141.  
  142.    collect_c_tmp is
  143.       do
  144.          if result_type.is_user_expanded then
  145.             if result_type.is_dummy_expanded then
  146.             else
  147.                cpp.se_tmp_add(Current);
  148.             end;
  149.          end;
  150.       end;
  151.  
  152. feature {ADDRESS_OF_POOL}
  153.  
  154.    address_of_c_define(caller: ADDRESS_OF) is
  155.       do
  156.       end;
  157.  
  158. feature {ADDRESS_OF}
  159.  
  160.    address_of_c_mapping is
  161.       do
  162.       end;
  163.  
  164. feature {NONE}
  165.  
  166.    compute_use_current is
  167.       do
  168.          std_compute_use_current;
  169.       end;
  170.  
  171.    initialize is
  172.       do
  173.          arguments := base_feature.arguments;
  174.          if arguments /= Void then
  175.             if not arguments.is_runnable(current_type) then
  176.                !!arguments.with(arguments,current_type);
  177.             end;
  178.          end;
  179.          result_type := base_feature.result_type.to_runnable(current_type);
  180.          local_vars := base_feature.local_vars;
  181.          if local_vars /= Void then
  182.             local_vars := local_vars.to_runnable(current_type);
  183.          end;
  184.          routine_body := base_feature.routine_body;
  185.          if routine_body /= Void then
  186.             routine_body := routine_body.to_runnable(current_type);
  187.          end;
  188.          if run_control.require_check then
  189.             require_assertion := run_require;
  190.          end;
  191.          if run_control.ensure_check then
  192.             ensure_assertion := run_ensure;
  193.          end;
  194.          rescue_compound := base_feature.rescue_compound;
  195.          if rescue_compound /= Void then
  196.             exceptions_handler.set_used;
  197.             rescue_compound := rescue_compound.to_runnable(current_type);
  198.          end;
  199.       end;
  200.  
  201. end -- RUN_FEATURE_11
  202.