home *** CD-ROM | disk | FTP | other *** search
/ Amiga ACS 1998 #4 / amigaacscoverdisc1998-041998.iso / utilities / shareware / dev / ppcsmalleiffel / lib_se / local_var_list.e < prev    next >
Encoding:
Text File  |  1998-01-16  |  3.2 KB  |  153 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://www.loria.fr/SmallEiffel
  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 LOCAL_VAR_LIST
  17.    --
  18.    -- To store local variables declaration list.
  19.    --   
  20.  
  21. inherit DECLARATION_LIST;
  22.    
  23. creation {EIFFEL_PARSER} make
  24.    
  25. creation {DECLARATION_LIST} runnable_from_current
  26.    
  27. feature 
  28.  
  29.    name(i: INTEGER): LOCAL_NAME1 is
  30.       do
  31.      Result := flat_list.item(i);
  32.       end;
  33.    
  34.    pretty_print is
  35.       local
  36.      i: INTEGER;
  37.       do
  38.      fmt.set_indent_level(2);
  39.      fmt.indent;
  40.      fmt.keyword("local");
  41.      if fmt.zen_mode and list.count = 1 then
  42.         list.first.pretty_print;
  43.         fmt.put_character(';');
  44.      else
  45.         from  
  46.            i := 1;
  47.         until
  48.            i > list.upper
  49.         loop
  50.            fmt.set_indent_level(3);
  51.            fmt.indent;
  52.            list.item(i).pretty_print;
  53.            fmt.put_character(';');
  54.            i := i + 1;
  55.         end;
  56.      end;
  57.      fmt.set_indent_level(2);
  58.      fmt.indent;
  59.       end;
  60.  
  61.    produce_c: BOOLEAN is
  62.       local
  63.      i: INTEGER;
  64.       do
  65.      from
  66.         i := count; 
  67.      until
  68.         Result or else i = 0
  69.      loop
  70.         Result := name(i).produce_c;
  71.         i := i - 1;
  72.      end;
  73.       end;
  74.  
  75. feature {RUN_FEATURE}
  76.    
  77.    jvm_initialize is
  78.      -- Produce code in order to initialize variables.
  79.       local
  80.      jvm_offset, i: INTEGER;
  81.       do
  82.      from
  83.         i := count; 
  84.      until
  85.         i = 0
  86.      loop
  87.         jvm_offset := jvm.local_offset_of(name(i));
  88.         type(i).jvm_initialize_local(jvm_offset);
  89.         i := i - 1;
  90.      end;
  91.       end;
  92.  
  93.    compile_to_c is
  94.       local
  95.      i: INTEGER;
  96.       do
  97.      from  
  98.         i := count;
  99.      until
  100.         i = 0
  101.      loop
  102.         -- ***** produce_c ???
  103.         name(i).c_declare;
  104.         i := i - 1;
  105.      end;
  106.       end;
  107.    
  108.    initialize_expanded is
  109.       local
  110.      i: INTEGER;
  111.      t: TYPE;
  112.      rf3: RUN_FEATURE_3;
  113.       do
  114.      from  
  115.         i := count;
  116.      until
  117.         i = 0
  118.      loop
  119.         t := type(i).run_type;
  120.         if t.is_expanded then
  121.            if not t.is_basic_eiffel_expanded then
  122.           rf3 := t.expanded_initializer;
  123.           if rf3 /= Void then
  124.              cpp.expanded_writable(rf3,name(i));
  125.           end;
  126.            end;
  127.         end;
  128.         i := i - 1;
  129.      end;
  130.       end;
  131.    
  132. feature {RUN_FEATURE_3}
  133.  
  134.    inline_one_pc is
  135.       local
  136.      i: INTEGER;
  137.       do
  138.      from  
  139.         i := count;
  140.      until
  141.         i = 0
  142.      loop
  143.         cpp.inline_level_incr;
  144.         name(i).c_declare;
  145.         cpp.inline_level_decr;
  146.         i := i - 1;
  147.      end;
  148.       end;
  149.  
  150. end -- LOCAL_VAR_LIST
  151.  
  152.  
  153.