home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 3 / AACD03.BIN / AACD / Programming / sofa / archive / SmallEiffel.lha / SmallEiffel / lib_se / index_list.e < prev    next >
Text File  |  1999-06-05  |  2KB  |  85 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 INDEX_LIST
  17.    --
  18.    -- For the indexing clause in the heading part of a class.
  19.    --
  20.  
  21. inherit GLOBALS;
  22.  
  23. creation {BASE_CLASS} make
  24.  
  25. feature {NONE}
  26.  
  27.    list: ARRAY[INDEX_CLAUSE];
  28.  
  29.    make(l: like list) is
  30.       require
  31.          l /= Void
  32.       do
  33.          list := l;
  34.       ensure
  35.          list = l
  36.       end;
  37.  
  38. feature
  39.  
  40.    pretty_print is
  41.       require
  42.          fmt.indent_level = 0;
  43.       local
  44.          i: INTEGER;
  45.       do
  46.          fmt.put_string("indexing");
  47.          fmt.level_incr;
  48.          fmt.indent;
  49.          from
  50.             i := 1;
  51.          until
  52.             i > list.upper
  53.          loop
  54.             list.item(i).pretty_print;
  55.             i := i + 1;
  56.             if i <= list.upper then
  57.                fmt.put_string(fz_00);
  58.                fmt.indent;
  59.             end;
  60.          end;
  61.          fmt.put_string(";%N%N");
  62.          fmt.level_decr;
  63.          fmt.indent;
  64.       ensure
  65.          fmt.indent_level = old fmt.indent_level;
  66.       end;
  67.  
  68. feature {BASE_CLASS}
  69.  
  70.    add_last(ic: INDEX_CLAUSE) is
  71.       require
  72.          ic /= Void
  73.       do
  74.          list.add_last(ic);
  75.       end;
  76.  
  77. invariant
  78.  
  79.    list.lower = 1;
  80.  
  81.    not list.empty;
  82.  
  83. end -- INDEX_LIST
  84.  
  85.