home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 3 / AACD03.BIN / AACD / Programming / sofa / archive / SmallEiffel.lha / SmallEiffel / lib_se / export_list.e < prev    next >
Text File  |  1999-06-05  |  3KB  |  102 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 EXPORT_LIST
  17.  
  18. inherit GLOBALS;
  19.  
  20. creation make
  21.  
  22. feature {ANY}
  23.  
  24.    start_position: POSITION;
  25.          -- Of keyword "export".
  26.  
  27. feature {NONE}
  28.  
  29.    items: array[EXPORT_ITEM]
  30.  
  31. feature {NONE}
  32.  
  33.    make(sp: like start_position; i: like items) is
  34.       require
  35.          sp /= Void;
  36.          i.lower = 1;
  37.          not i.empty;
  38.       do
  39.          start_position := sp;
  40.          items := i;
  41.          -- *** ADD some validity checking...
  42.       ensure
  43.          start_position = sp;
  44.          items = i;
  45.       end;
  46.  
  47. feature
  48.  
  49.    clients_for(fn: FEATURE_NAME): CLIENT_LIST is
  50.       local
  51.          i: INTEGER;
  52.          ei: EXPORT_ITEM;
  53.       do
  54.          from
  55.             i := items.upper;
  56.          until
  57.             i = 0
  58.          loop
  59.             ei := items.item(i);
  60.             if ei.affect(fn) then
  61.                if Result = Void then
  62.                   Result := ei.clients;
  63.                else
  64.                   Result := Result.merge_with(ei.clients);
  65.                end;
  66.             end;
  67.             i := i - 1;
  68.          end;
  69.       end;
  70.  
  71.    pretty_print is
  72.       local
  73.          i: INTEGER;
  74.       do
  75.          fmt.set_indent_level(2);
  76.          fmt.indent;
  77.          fmt.keyword("export");
  78.          from
  79.             i := 1;
  80.          until
  81.             i > items.upper
  82.          loop
  83.             fmt.set_indent_level(3);
  84.             items.item(i).pretty_print;
  85.             i := i + 1;
  86.             if i <= items.upper then
  87.                fmt.put_character(';');
  88.                fmt.set_indent_level(3);
  89.                fmt.indent;
  90.             end;
  91.          end;
  92.       end;
  93.  
  94. invariant
  95.  
  96.    items.lower = 1;
  97.  
  98.    not items.empty;
  99.  
  100. end -- EXPORT_LIST
  101.  
  102.