home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 3 / AACD03.BIN / AACD / Programming / sofa / archive / SmallEiffel.lha / SmallEiffel / lib_se / address_of.e < prev    next >
Text File  |  1999-06-05  |  5KB  |  225 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 ADDRESS_OF
  17.    --
  18.    -- For the special address form notation : $ feature_name
  19.    --
  20.  
  21. inherit EXPRESSION;
  22.  
  23. creation make
  24.  
  25. feature
  26.  
  27.    feature_name: FEATURE_NAME;
  28.  
  29. feature {NONE}
  30.  
  31.    current_type: TYPE;
  32.  
  33. feature {ADDRESS_OF_POOL}
  34.  
  35.    run_feature: RUN_FEATURE;
  36.          -- Corresponding one when runnable.
  37.  
  38. feature
  39.  
  40.    is_writable: BOOLEAN is false;
  41.  
  42.    is_current: BOOLEAN is false;
  43.  
  44.    is_static: BOOLEAN is false;
  45.  
  46.    is_pre_computable: BOOLEAN is false;
  47.  
  48.    is_result: BOOLEAN is false;
  49.  
  50.    is_void: BOOLEAN is false;
  51.  
  52.    is_manifest_string: BOOLEAN is false;
  53.  
  54.    isa_dca_inline_argument: INTEGER is 0;
  55.  
  56.    use_current: BOOLEAN is true;
  57.  
  58.    can_be_dropped: BOOLEAN is false;
  59.  
  60.    c_simple: BOOLEAN is true;
  61.  
  62. feature {NONE}
  63.  
  64.    make(fn: like feature_name) is
  65.       require
  66.          fn /= Void
  67.       do
  68.          feature_name := fn;
  69.       ensure
  70.          feature_name = fn;
  71.       end;
  72.  
  73. feature
  74.  
  75.    static_result_base_class: BASE_CLASS is
  76.       do
  77.          Result := small_eiffel.get_class(as_pointer);
  78.       end;
  79.  
  80.    static_value: INTEGER is
  81.       do
  82.       end;
  83.  
  84.    dca_inline_argument(formal_arg_type: TYPE) is
  85.       do
  86.       end;
  87.  
  88.    result_type: TYPE_POINTER is
  89.       do
  90.          Result := type_pointer;
  91.       end;
  92.  
  93.    assertion_check(tag: CHARACTER) is
  94.       do
  95.       end;
  96.  
  97.    afd_check is
  98.       do
  99.       end;
  100.  
  101.    compile_target_to_jvm, compile_to_jvm is
  102.       do
  103.          eh.add_position(start_position);
  104.          fatal_error(fz_jvm_error);
  105.       end;
  106.  
  107.    jvm_branch_if_false: INTEGER is
  108.       do
  109.       end;
  110.  
  111.    jvm_branch_if_true: INTEGER is
  112.       do
  113.       end;
  114.  
  115.    compile_to_jvm_into(dest: TYPE): INTEGER is
  116.       do
  117.       end;
  118.  
  119.    collect_c_tmp is
  120.       do
  121.       end;
  122.  
  123.    compile_to_c is
  124.       do
  125.          cpp.put_string("/*$*/((void*)");
  126.          run_feature.address_of_c_mapping;
  127.          cpp.put_character(')');
  128.       end;
  129.  
  130.    frozen mapping_c_target(target_type: TYPE) is
  131.       do
  132.          compile_to_c;
  133.       end;
  134.  
  135.    frozen mapping_c_arg(formal_arg_type: TYPE) is
  136.       do
  137.          compile_to_c;
  138.       end;
  139.  
  140.    c_declare_for_old is
  141.       do
  142.       end;
  143.  
  144.    compile_to_c_old is
  145.       do
  146.       end;
  147.  
  148.    compile_to_jvm_old is
  149.       do
  150.       end;
  151.  
  152.    to_runnable(ct: TYPE): like Current is
  153.       local
  154.          rc: RUN_CLASS;
  155.          bc: BASE_CLASS;
  156.       do
  157.          if current_type = Void then
  158.             current_type := ct;
  159.             rc := ct.run_class;
  160.             bc := ct.base_class;
  161.             if bc.has(feature_name) then
  162.                run_feature := rc.get_rf_with(feature_name);
  163.                address_of_pool.register_for(Current);
  164.             else
  165.                eh.add_position(feature_name.start_position);
  166.                eh.append(fz_vuar4);
  167.                eh.print_as_fatal_error;
  168.             end;
  169.             Result := Current;
  170.          else
  171.             !!Result.make(feature_name);
  172.             Result := Result.to_runnable(ct);
  173.          end;
  174.       end;
  175.  
  176.    precedence: INTEGER is
  177.       do
  178.          Result := atomic_precedence;
  179.       end;
  180.  
  181.    start_position: POSITION is
  182.       do
  183.          Result := feature_name.start_position;
  184.       end;
  185.  
  186.    pretty_print is
  187.       do
  188.          fmt.put_character('%D');
  189.          feature_name.pretty_print;
  190.       end;
  191.  
  192.    print_as_target is
  193.       do
  194.          error(start_position,"ADDRESS_OF/does_not_understand");
  195.       end;
  196.  
  197.    bracketed_pretty_print is
  198.       do
  199.          fmt.put_character('(');
  200.          pretty_print;
  201.          fmt.put_character(')');
  202.       end;
  203.  
  204.    short is
  205.       do
  206.          short_print.a_character('%D');
  207.          feature_name.short;
  208.       end;
  209.  
  210.    short_target is
  211.       do
  212.          bracketed_short;
  213.          short_print.a_dot;
  214.       end;
  215.  
  216.    jvm_assign is
  217.       do
  218.       end;
  219.  
  220. invariant
  221.  
  222.    feature_name /= Void
  223.  
  224. end --  ADDRESS_OF
  225.