home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 3 / AACD03.BIN / AACD / Programming / sofa / archive / SmallEiffel.lha / SmallEiffel / lib_se / exception_table.e < prev    next >
Text File  |  1999-06-05  |  3KB  |  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://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 EXCEPTION_TABLE
  17.    --
  18.    -- Unique Global Object in charge of the exception table of
  19.    -- a method_info as describe in the JVM specification.
  20.    -- Obviously, the same object is recycled.
  21.    --
  22. inherit GLOBALS;
  23.  
  24. creation {CODE_ATTRIBUTE} make
  25.  
  26. feature {NONE}
  27.  
  28.    from_pc: FIXED_ARRAY[INTEGER] is
  29.       once
  30.          !!Result.with_capacity(4);
  31.       end;
  32.  
  33.    to_pc: FIXED_ARRAY[INTEGER] is
  34.       once
  35.          !!Result.with_capacity(4);
  36.       end;
  37.  
  38.    handler_pc: FIXED_ARRAY[INTEGER] is
  39.       once
  40.          !!Result.with_capacity(4);
  41.       end;
  42.  
  43.    type_idx: FIXED_ARRAY[INTEGER] is
  44.       once
  45.          !!Result.with_capacity(4);
  46.       end;
  47.  
  48. feature {NONE}
  49.  
  50.    make is
  51.       do
  52.       end;
  53.  
  54. feature {NONE}
  55.  
  56.    count: INTEGER is
  57.       do
  58.          Result := from_pc.count;
  59.       end;
  60.  
  61. feature {CODE_ATTRIBUTE}
  62.  
  63.    clear is
  64.       do
  65.          from_pc.clear;
  66.          to_pc.clear;
  67.          handler_pc.clear;
  68.          type_idx.clear;
  69.       end;
  70.  
  71.    add(f,t,h,type: INTEGER) is
  72.       do
  73.          from_pc.add_last(f);
  74.          to_pc.add_last(t);
  75.          handler_pc.add_last(h);
  76.          type_idx.add_last(type);
  77.       end;
  78.  
  79.    store_in(storage: STRING) is
  80.       local
  81.          c, i: INTEGER;
  82.       do
  83.          c := count;
  84.          append_u2(storage,c);
  85.          from
  86.             i := 0;
  87.          until
  88.             i >= c
  89.          loop
  90.             append_u2(storage,from_pc.item(i));
  91.             append_u2(storage,to_pc.item(i));
  92.             append_u2(storage,handler_pc.item(i));
  93.             append_u2(storage,type_idx.item(i));
  94.             i := i + 1;
  95.          end;
  96.       end;
  97.  
  98. end -- EXCEPTION_TABLE
  99.  
  100.