home *** CD-ROM | disk | FTP | other *** search
/ Amiga ACS 1998 #4 / amigaacscoverdisc1998-041998.iso / utilities / shareware / dev / ppcsmalleiffel / lib_se / call_0.e < prev    next >
Encoding:
Text File  |  1998-01-16  |  2.9 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. deferred class CALL_0
  17.    --
  18.    -- For calls without argument (only Current).
  19.    --
  20.  
  21. inherit 
  22.    CALL 
  23.       redefine to_integer, compile_to_c
  24.       end;
  25.      
  26. feature 
  27.    
  28.    make(t: like target; fn: like feature_name) is
  29.       require
  30.      t /= void;
  31.      fn /= void;
  32.       do
  33.      target := t;
  34.      feature_name := fn;
  35.       ensure
  36.      target = t;
  37.      feature_name = fn
  38.       end;
  39.    
  40.    to_integer: INTEGER is
  41.       local
  42.      rf1: RUN_FEATURE_1;
  43.       do
  44.      rf1 ?= run_feature;
  45.      if rf1 = Void then
  46.         error(start_position,fz_iinaiv);
  47.      else
  48.         Result := rf1.value.to_integer;
  49.      end;
  50.       end;
  51.    
  52.    can_be_dropped: BOOLEAN is 
  53.       do     
  54.      if target.can_be_dropped then
  55.         Result := run_feature.can_be_dropped;
  56.      end;
  57.       end;
  58.    
  59.    arg_count: INTEGER is
  60.       do
  61.      Result := 0;
  62.       end;
  63.    
  64.    to_runnable(ct: TYPE): like Current is
  65.       do
  66.      if current_type = Void then
  67.         to_runnable_0(ct);
  68.         if nb_errors = 0 and then run_feature.arg_count > 0 then
  69.            eh.add_position(feature_name.start_position);
  70.            error(run_feature.start_position,"Feature found has arguments.");
  71.         end;
  72.         if nb_errors = 0 then
  73.            Result := Current;
  74.         end;
  75.      else
  76.         Result := twin;
  77.         Result.set_current_type(Void);
  78.         Result := Result.to_runnable(ct);
  79.      end;
  80.       end;
  81.    
  82.    compile_to_c is
  83.      -- *** DESCENDRE CE MACHIN DANS CALL_0_C ????? ****
  84.      -- VIRER LES REDEFINE.
  85.       local
  86.      n: STRING;
  87.       do
  88.      n := feature_name.to_string;
  89.      if us_is_expanded_type = n then
  90.         if target.result_type.run_type.is_expanded then
  91.            cpp.put_character('1');
  92.         else
  93.            cpp.put_character('0');
  94.         end;
  95.      elseif us_is_basic_expanded_type = n then
  96.         if target.result_type.is_basic_eiffel_expanded then
  97.            cpp.put_character('1');
  98.         else
  99.            cpp.put_character('0');
  100.         end;
  101.      else
  102.         call_proc_call_c2c;
  103.      end;
  104.       end;
  105.  
  106.    arguments: EFFECTIVE_ARG_LIST is do end;
  107.    
  108. invariant
  109.    
  110.    arguments = Void
  111.    
  112. end -- CALL_0
  113.  
  114.