home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 3 / AACD03.BIN / AACD / Programming / sofa / archive / SmallEiffel.lha / SmallEiffel / lib_se / creation_call_2.e < prev    next >
Text File  |  1999-06-05  |  3KB  |  101 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 CREATION_CALL_2
  17.    --
  18.    -- For creation call like :
  19.    --                           !BAR!foo
  20.    --
  21.  
  22. inherit
  23.    CREATION_CALL_1_2;
  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) is
  31.       require
  32.          sp /= Void;
  33.          t /= Void;
  34.          w /= Void;
  35.       do
  36.          start_position := sp;
  37.          type := t;
  38.          writable := w;
  39.       end;
  40.  
  41.    compile_to_c is
  42.       do
  43.          if type.is_reference then
  44.             c2c_opening(type);
  45.             c2c_closing(type);
  46.          else
  47.             c2c_clear_expanded(type.id);
  48.          end;
  49.       end;
  50.  
  51.    compile_to_jvm is
  52.       local
  53.          t: TYPE;
  54.       do
  55.          t := type.run_type;
  56.          compile_to_jvm0(t);
  57.          t.jvm_check_class_invariant;
  58.          writable.jvm_assign;
  59.       end;
  60.  
  61.    use_current: BOOLEAN is
  62.       do
  63.          Result := writable.use_current;
  64.       end;
  65.  
  66.    to_runnable(ct: TYPE): like Current is
  67.       do
  68.          if current_type = Void then
  69.             check_writable(ct);
  70.             check_explicit_type;
  71.             check_created_type(type);
  72.             check_creation_clause(type);
  73.             Result := Current;
  74.          else
  75.             !!Result.make(start_position,type,writable);
  76.             Result := Result.to_runnable(ct);
  77.          end;
  78.       end;
  79.  
  80.    pretty_print is
  81.       do
  82.          fmt.put_character('!');
  83.          type.pretty_print;
  84.          fmt.put_character('!');
  85.          writable.pretty_print;
  86.          if fmt.semi_colon_flag then
  87.             fmt.put_character(';');
  88.          end;
  89.       end;
  90.  
  91. invariant
  92.  
  93.    type /= Void;
  94.  
  95.    call = Void;
  96.  
  97.    run_feature = Void;
  98.  
  99. end -- CREATION_CALL_2
  100.  
  101.