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