home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 3 / AACD03.BIN / AACD / Programming / sofa / archive / SmallEiffel.lha / SmallEiffel / lib_se / address_of_pool.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 ADDRESS_OF_POOL
  17.    --
  18.    -- Unique global object in charge of $ operator calls.
  19.    --
  20.  
  21. inherit GLOBALS;
  22.  
  23. feature {NONE}
  24.  
  25.    registered: FIXED_ARRAY[RUN_FEATURE] is
  26.       once
  27.          !!Result.with_capacity(64);
  28.       end;
  29.  
  30.    caller_memory: FIXED_ARRAY[ADDRESS_OF] is
  31.       once
  32.          !!Result.with_capacity(64);
  33.       end;
  34.  
  35. feature {ADDRESS_OF}
  36.  
  37.    register_for(address_of: ADDRESS_OF) is
  38.       require
  39.          address_of /= Void
  40.       local
  41.          rf: RUN_FEATURE;
  42.       do
  43.          rf := address_of.run_feature;
  44.          if not registered.fast_has(rf) then
  45.             registered.add_last(rf);
  46.             caller_memory.add_last(address_of);
  47.          end;
  48.       ensure
  49.          registered.fast_has(address_of.run_feature)
  50.       end;
  51.  
  52. feature {SMALL_EIFFEL}
  53.  
  54.    falling_down is
  55.       local
  56.          i: INTEGER;
  57.       do
  58.          from
  59.             i := registered.upper;
  60.          until
  61.             i < 0
  62.          loop
  63.             switch_collection.update_with(registered.item(i));
  64.             i := i - 1;
  65.          end;
  66.       end;
  67.  
  68.    c_define is
  69.       local
  70.          i: INTEGER;
  71.       do
  72.          i := registered.upper;
  73.          if i >= 0 then
  74.             from
  75.             until
  76.                i < 0
  77.             loop
  78.                registered.item(i).address_of_c_define(caller_memory.item(i));
  79.                i := i - 1;
  80.             end;
  81.          end;
  82.       end;
  83.  
  84. end -- ADDRESS_OF_POOL
  85.