home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 3 / AACD03.BIN / AACD / Programming / sofa / archive / SmallEiffel.lha / SmallEiffel / lib_se / run_feature_2.e < prev    next >
Text File  |  1999-06-05  |  5KB  |  204 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_2
  17.  
  18. inherit RUN_FEATURE redefine base_feature end;
  19.  
  20. creation make
  21.  
  22. feature
  23.  
  24.    base_feature: WRITABLE_ATTRIBUTE;
  25.  
  26.    result_type: TYPE;
  27.  
  28. feature
  29.  
  30.    can_be_dropped: BOOLEAN is true;
  31.  
  32.    is_pre_computable: BOOLEAN is false;
  33.  
  34.    is_static: BOOLEAN is false;
  35.  
  36.    is_once_function: BOOLEAN is false;
  37.  
  38. feature
  39.  
  40.    arguments: FORMAL_ARG_LIST is
  41.       do
  42.       end;
  43.  
  44.    require_assertion: RUN_REQUIRE is
  45.       do
  46.       end;
  47.  
  48.    local_vars: LOCAL_VAR_LIST is
  49.       do
  50.       end;
  51.  
  52.    routine_body: COMPOUND is
  53.       do
  54.       end;
  55.  
  56.    rescue_compound: COMPOUND is
  57.       do
  58.       end;
  59.  
  60.    ensure_assertion: E_ENSURE is
  61.       do
  62.       end;
  63.  
  64.    static_value_mem: INTEGER is
  65.       do
  66.       end;
  67.  
  68.    afd_check is
  69.       local
  70.          rc: RUN_CLASS;
  71.       do
  72.          rc := result_type.run_type.run_class;
  73.       end;
  74.  
  75.    mapping_c is
  76.       local
  77.          ct: TYPE;
  78.       do
  79.          ct := current_type;
  80.          if ct.is_basic_eiffel_expanded then
  81.             check
  82.                as_item = name.to_string
  83.             end;
  84.             cpp.put_target_as_value;
  85.          elseif ct.is_reference then
  86.             if ct.base_class.is_expanded then
  87.                cpp.put_character('(');
  88.                cpp.put_target_as_target;
  89.                cpp.put_string(")->_item._");
  90.                cpp.put_string(name.to_string);
  91.                run_class.force_c_recompilation_comment(Current);
  92.             else
  93.                cpp.put_character('(');
  94.                cpp.put_target_as_target;
  95.                cpp.put_string(")->_");
  96.                cpp.put_string(name.to_string);
  97.                run_class.force_c_recompilation_comment(Current);
  98.             end;
  99.          else
  100.             cpp.put_character('(');
  101.             cpp.put_target_as_value;
  102.             cpp.put_string(")._");
  103.             cpp.put_string(name.to_string);
  104.             run_class.force_c_recompilation_comment(Current);
  105.          end;
  106.       end;
  107.  
  108.    c_define is
  109.       do
  110.          nothing_comment;
  111.       end;
  112.  
  113. feature {ADDRESS_OF_POOL}
  114.  
  115.    address_of_c_define(caller: ADDRESS_OF) is
  116.       do
  117.       end;
  118.  
  119. feature {ADDRESS_OF}
  120.  
  121.    address_of_c_mapping is
  122.       do
  123.          cpp.put_string("&(");
  124.          cpp.print_current;
  125.          cpp.put_string("->_");
  126.          cpp.put_string(name.to_string);
  127.          cpp.put_character(')');
  128.       end;
  129.  
  130. feature {CALL_PROC_CALL}
  131.  
  132.    collect_c_tmp is
  133.       do
  134.       end;
  135.  
  136. feature {NONE}
  137.  
  138.    initialize is
  139.       do
  140.          result_type := base_feature.result_type;
  141.          result_type := result_type.to_runnable(current_type);
  142.       end;
  143.  
  144.    compute_use_current is
  145.       do
  146.          use_current_state := ucs_true;
  147.       end;
  148.  
  149. feature {RUN_CLASS}
  150.  
  151.    jvm_field_or_method is
  152.       do
  153.          jvm.add_field(Current);
  154.       end;
  155.  
  156. feature
  157.  
  158.    mapping_jvm is
  159.       local
  160.          idx: INTEGER;
  161.          stack_level: INTEGER;
  162.       do
  163.          jvm.push_target_as_target;
  164.          if current_type.is_basic_eiffel_expanded then
  165.             check
  166.                as_item = name.to_string
  167.             end;
  168.          else
  169.             stack_level := result_type.jvm_stack_space - 1;
  170.             idx := constant_pool.idx_fieldref(Current);
  171.             code_attribute.opcode_getfield(idx,stack_level);
  172.          end;
  173.       end;
  174.  
  175. feature {JVM}
  176.  
  177.    jvm_define is
  178.       local
  179.          name_idx, descriptor: INTEGER;
  180.          cp: like constant_pool;
  181.       do
  182.          cp := constant_pool;
  183.          name_idx := cp.idx_utf8(name.to_string);
  184.          descriptor := cp.idx_utf8(jvm_descriptor);
  185.          field_info.add(1,name_idx,descriptor);
  186.       end;
  187.  
  188. feature {NONE}
  189.  
  190.    update_tmp_jvm_descriptor is
  191.       local
  192.          rt: TYPE;
  193.       do
  194.          rt := result_type.run_type;
  195.          if rt.is_reference then
  196.             tmp_jvm_descriptor.append(jvm_root_descriptor);
  197.          else
  198.             rt.jvm_descriptor_in(tmp_jvm_descriptor);
  199.          end;
  200.       end;
  201.  
  202. end -- RUN_FEATURE_2
  203.  
  204.