home *** CD-ROM | disk | FTP | other *** search
/ Amiga ACS 1998 #4 / amigaacscoverdisc1998-041998.iso / utilities / shareware / dev / ppcsmalleiffel / lib_se / creation_call_4.e < prev    next >
Encoding:
Text File  |  1998-01-16  |  2.7 KB  |  114 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 CREATION_CALL_4
  17.    -- 
  18.    -- For creation call like : 
  19.    --                           !BAR!foo.bar(...)
  20.    --
  21.  
  22. inherit 
  23.    CREATION_CALL_3_4;
  24.    CREATION_CALL_2_4;
  25.  
  26. creation make
  27.    
  28. feature 
  29.    
  30.    make(sp: like start_position; t: like type; w: like writable; c: like call) is
  31.       require
  32.      sp /= Void;
  33.      t /= Void;
  34.      w /= Void;
  35.      c /= Void;
  36.       do
  37.      start_position := sp;
  38.      type := t; 
  39.      writable := w;
  40.      call := c;
  41.       ensure      
  42.      start_position = sp;
  43.      type = t; 
  44.      writable = w;
  45.      call = c;
  46.       end;
  47.    
  48.    to_runnable(rc: like run_compound): like Current is
  49.       do
  50.      if run_compound = Void then
  51.         check_writable(rc);
  52.         check_explicit_type;
  53.         check_created_type(type);
  54.         check_creation_clause(type);
  55.         Result := Current;
  56.      else
  57.         !!Result.make(start_position,type,writable,call);
  58.         Result := Result.to_runnable(rc);
  59.      end;
  60.       end;
  61.    
  62.    compile_to_c is
  63.       do
  64.      if type.is_reference then
  65.         c2c_opening(type);
  66.         cpp.push_new(run_feature,run_args);
  67.         run_feature.mapping_c;
  68.         cpp.pop;
  69.         c2c_closing(type);
  70.      else
  71.         c2c_clear_expanded(type.id);
  72.         c2c_expanded_initializer(type);
  73.      end;
  74.       end;
  75.    
  76.    compile_to_jvm is
  77.       local
  78.      w: EXPRESSION;
  79.      t: TYPE;
  80.       do
  81.      w := writable;
  82.      t := type.run_type;
  83.      compile_to_jvm0(t);
  84.      jvm.inside_new(run_feature,call);
  85.      t.jvm_check_class_invariant;
  86.      w.jvm_assign;
  87.       end;
  88.    
  89.    use_current: BOOLEAN is
  90.       do
  91.      if run_args /= Void then
  92.         Result := run_args.use_current;
  93.      end;
  94.      Result := Result or else writable.use_current;
  95.       end;
  96.    
  97.    pretty_print is
  98.       do
  99.      fmt.put_character('!');
  100.      type.pretty_print;
  101.      fmt.put_character('!');
  102.      call.pretty_print;
  103.       end;
  104.  
  105. invariant
  106.    
  107.    type /= Void;
  108.    
  109.    call /= Void;
  110.    
  111. end -- CREATION_CALL_4
  112.  
  113.  
  114.