home *** CD-ROM | disk | FTP | other *** search
/ Amiga ACS 1998 #4 / amigaacscoverdisc1998-041998.iso / utilities / shareware / dev / ppcsmalleiffel / lib_se / function.e < prev    next >
Encoding:
Text File  |  1998-01-16  |  3.0 KB  |  109 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 FUNCTION
  17.    
  18. inherit EFFECTIVE_ROUTINE;
  19.    
  20. creation make
  21.    
  22. feature 
  23.    
  24.    make(n: like names;  
  25.     fa: like arguments; t: like result_type; 
  26.     om: like obsolete_mark;
  27.     hc: like header_comment;
  28.     ra: like require_assertion; lv: like local_vars;
  29.     rb: like routine_body) is
  30.       require
  31.      t /= void
  32.       do
  33.      make_effective_routine(n,fa,om,hc,ra,lv,rb);
  34.      result_type := t;
  35.       end;
  36.    
  37.    to_run_feature(t: TYPE; fn: FEATURE_NAME): RUN_FEATURE_4 is
  38.       do
  39.      check_obsolete;
  40.      !!Result.make(t,fn,Current);
  41.       end;
  42.    
  43. feature {C_PRETTY_PRINTER}
  44.  
  45.    stupid_switch(up_rf: RUN_FEATURE; r: ARRAY[RUN_CLASS]): BOOLEAN is
  46.       local
  47.      rf4: RUN_FEATURE_4;
  48.      fn: FEATURE_NAME;
  49.       do
  50.      rf4 ?= r.first.dynamic(up_rf);
  51.      if rf4.is_empty_or_null_body then
  52.         Result := true;
  53.      else
  54.         fn := rf4.is_attribute_reader;
  55.         if fn /= Void then
  56.            Result := cpp.stupid_switch(up_rf.run_class.get_feature(fn));
  57.         else
  58.            fn := rf4.is_direct_call_on_attribute;
  59.            if fn /= Void then
  60.           Result := cpp.stupid_switch(up_rf.run_class.get_feature(fn));
  61.            else 
  62.           Result := stupid_switch_item(up_rf,r);
  63.            end;
  64.         end;
  65.      end;
  66.       end;
  67.  
  68. feature {NONE}
  69.  
  70.    stupid_switch_item(up_rf: RUN_FEATURE; r: ARRAY[RUN_CLASS]): BOOLEAN is
  71.       local
  72.      f: E_FEATURE;
  73.      bcn: STRING;
  74.      i: INTEGER;
  75.      rf: RUN_FEATURE;
  76.       do
  77.      f := up_rf.base_feature;
  78.      if us_item = f.first_name.to_string then
  79.         bcn := f.base_class.base_class_name.to_string;
  80.         if us_array = bcn or else us_fixed_array = bcn then
  81.            from
  82.           i := r.upper;
  83.           Result := true;
  84.            until
  85.           not Result or else i = 0
  86.            loop
  87.           rf := r.item(i).dynamic(up_rf);
  88.           if rf.result_type.is_expanded then
  89.              Result := false;
  90.           end;
  91.           i := i - 1;
  92.            end;
  93.         end;
  94.      end;
  95.       end;
  96.    
  97.    try_to_undefine_aux(fn: FEATURE_NAME;
  98.                bc: BASE_CLASS): DEFERRED_ROUTINE is
  99.       do
  100.      !DEFERRED_FUNCTION!Result.from_effective(fn,arguments,
  101.                           result_type,
  102.                           require_assertion,
  103.                           ensure_assertion,
  104.                           bc);
  105.       end;
  106.    
  107. end -- FUNCTION
  108.  
  109.