home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 3 / AACD03.BIN / AACD / Programming / sofa / archive / SmallEiffel.lha / SmallEiffel / lib_se / writable_attribute.e < prev    next >
Text File  |  1999-06-05  |  3KB  |  107 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 WRITABLE_ATTRIBUTE
  17.    --
  18.    -- For instance variables (ordinary attribute).
  19.    --
  20.  
  21. inherit ATTRIBUTE;
  22.  
  23. creation make
  24.  
  25. feature {NONE}
  26.  
  27.    make(n: like names; t: like result_type) is
  28.       require
  29.          n /= Void;
  30.          t /= Void
  31.       do
  32.          make_e_feature(n);
  33.          result_type := t;
  34.       ensure
  35.          names = n;
  36.          result_type = t
  37.       end;
  38.  
  39. feature
  40.  
  41.    to_run_feature(t: TYPE; fn: FEATURE_NAME): RUN_FEATURE_2 is
  42.       do
  43.          !!Result.make(t,fn,Current);
  44.       end;
  45.  
  46. feature {C_PRETTY_PRINTER}
  47.  
  48.    stupid_switch(up_rf: RUN_FEATURE; r: ARRAY[RUN_CLASS]): BOOLEAN is
  49.       local
  50.          rf2a, rf2b: RUN_FEATURE_2;
  51.          offseta, offsetb: INTEGER;
  52.          rta, rtb: TYPE;
  53.          i: INTEGER;
  54.          rc: RUN_CLASS;
  55.       do
  56.          from
  57.             Result := true;
  58.             i := r.upper;
  59.          until
  60.             not Result or else i = 0
  61.          loop
  62.             rc := r.item(i);
  63.             rf2b ?= rc.dynamic(up_rf);
  64.             if rf2b /= Void then
  65.                offsetb := rc.offset_of(rf2b);
  66.             end;
  67.             if rf2a = Void then
  68.                rf2a := rf2b;
  69.                offseta := offsetb;
  70.             end;
  71.             if rf2b = Void then
  72.                Result := false;
  73.             elseif rf2a.name.to_string = rf2b.name.to_string then
  74.                Result := offseta = offsetb;
  75.                if Result then
  76.                   rta := rf2a.result_type;
  77.                   rtb := rf2b.result_type;
  78.                   if rta.is_reference then
  79.                      Result := rtb.is_reference;
  80.                   elseif rta.run_time_mark = rtb.run_time_mark then
  81.                   elseif rta.is_native_array then
  82.                      if rta.generic_list.first.is_reference then
  83.                         Result := rtb.generic_list.first.is_reference;
  84.                      end;
  85.                   else
  86.                      Result := false;
  87.                   end;
  88.                end
  89.             else
  90.                Result := false;
  91.             end;
  92.             i := i - 1;
  93.          end;
  94.          if Result then
  95.             cpp.put_comment("SSWA1");
  96.          end;
  97.       end;
  98.  
  99. feature {NONE}
  100.  
  101.    pretty_tail is
  102.       do
  103.       end;
  104.  
  105. end -- WRITABLE_ATTRIBUTE
  106.  
  107.