home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 3 / AACD03.BIN / AACD / Programming / sofa / archive / SmallEiffel.lha / SmallEiffel / lib_se / argument_name.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 ARGUMENT_NAME
  17.    --
  18.    -- Handling of arguments.
  19.    --
  20.  
  21. inherit LOCAL_ARGUMENT;
  22.  
  23. feature
  24.  
  25.    is_current: BOOLEAN is false;
  26.  
  27.    is_writable: BOOLEAN is false;
  28.  
  29. feature
  30.  
  31.    frozen assertion_check(tag: CHARACTER) is
  32.       do
  33.       end;
  34.  
  35.    isa_dca_inline_argument: INTEGER is
  36.       do
  37.          Result := rank;
  38.       end;
  39.  
  40.    dca_inline_argument(formal_arg_type: TYPE) is
  41.       do
  42.          cpp.put_ith_argument(rank);
  43.       end;
  44.  
  45.    frozen pretty_print is
  46.       do
  47.          fmt.put_string(to_string);
  48.       end;
  49.  
  50.    frozen mapping_c_target(target_type: TYPE) is
  51.       local
  52.          flag: BOOLEAN;
  53.          rt: TYPE;
  54.       do
  55.          flag := cpp.call_invariant_start(target_type);
  56.          rt := result_type.run_type;
  57.          if rt.is_reference then
  58.             if target_type.is_reference then
  59.                -- Reference into Reference :
  60.                cpp.put_string(fz_b7);
  61.                cpp.put_integer(target_type.id);
  62.                cpp.put_string(fz_b8);
  63.                cpp.print_argument(rank);
  64.                cpp.put_character(')');
  65.             else
  66.                -- Reference into Expanded :
  67.                cpp.print_argument(rank);
  68.             end;
  69.          else
  70.             if target_type.is_reference then
  71.                -- Expanded into Reference :
  72.                cpp.print_argument(rank);
  73.             else
  74.                -- Expanded into Expanded :
  75.                cpp.print_argument(rank);
  76.             end;
  77.          end;
  78.          if flag then
  79.             cpp.call_invariant_end;
  80.          end;
  81.       end;
  82.  
  83.    frozen mapping_c_arg(formal_arg_type: TYPE) is
  84.       local
  85.          rt: like result_type;
  86.       do
  87.          rt := result_type.run_type;
  88.          if rt.is_reference then
  89.             if formal_arg_type.is_reference then
  90.                -- Reference into Reference :
  91.                cpp.print_argument(rank);
  92.             else
  93.                -- Reference into Expanded :
  94.                rt.to_expanded;
  95.                cpp.put_character('(');
  96.                cpp.print_argument(rank);
  97.                cpp.put_character(')');
  98.             end;
  99.          else
  100.             if formal_arg_type.is_reference then
  101.                -- Expanded into Reference :
  102.                rt.to_reference;
  103.                cpp.put_character('(');
  104.                if rt.is_user_expanded then
  105.                   if not rt.is_dummy_expanded then
  106.                      cpp.put_character('*');
  107.                   end;
  108.                end;
  109.                cpp.print_argument(rank);
  110.                cpp.put_character(')');
  111.             else
  112.                -- Expanded into Expanded :
  113.                cpp.print_argument(rank);
  114.             end;
  115.          end;
  116.       end;
  117.  
  118.    compile_to_c is
  119.       do
  120.          if result_type.is_user_expanded then
  121.             if result_type.is_dummy_expanded then
  122.             else
  123.                cpp.put_character('*');
  124.             end;
  125.          end;
  126.          cpp.print_argument(rank);
  127.       end;
  128.  
  129.    compile_to_jvm is
  130.       local
  131.          jvm_offset: INTEGER;
  132.       do
  133.          jvm_offset := jvm.argument_offset_of(Current);
  134.          result_type.run_type.jvm_push_local(jvm_offset);
  135.       end;
  136.  
  137.    jvm_branch_if_false: INTEGER is
  138.       do
  139.          compile_to_jvm;
  140.          Result := code_attribute.opcode_ifeq;
  141.       end;
  142.  
  143.    jvm_branch_if_true: INTEGER is
  144.       do
  145.          compile_to_jvm;
  146.          Result := code_attribute.opcode_ifne;
  147.       end;
  148.  
  149.    compile_to_jvm_into(dest: TYPE): INTEGER is
  150.       do
  151.          Result := standard_compile_to_jvm_into(dest);
  152.       end;
  153.  
  154.    jvm_assign is
  155.       do
  156.       end;
  157.  
  158. end -- ARGUMENT_NAME
  159.  
  160.  
  161.