home *** CD-ROM | disk | FTP | other *** search
/ Hacker / Hacker.iso / HACKER / DECOMP / DECAF / attrcode.ads < prev    next >
Encoding:
Text File  |  1996-09-19  |  2.9 KB  |  92 lines

  1. --
  2. -- Copyright (C) 1996 Ada Resource Association (ARA), Columbus, Ohio.
  3. -- Author: Gilles Demailly
  4. --
  5. --
  6. -- Permission to use, copy, modify, and distribute this software and its
  7. -- documentation for any purpose and without fee is hereby granted,
  8. -- provided that the above copyright and authorship notice appear in all
  9. -- copies and that both that copyright notice and this permission notice
  10. -- appear in supporting documentation.
  11. -- 
  12. -- The ARA makes no representations about the suitability of this software
  13. -- for any purpose.  It is provided "as is" without express
  14. -- or implied warranty.
  15. -- 
  16.  
  17. -- This child package provides the class Code_Attribute :
  18. -- Code attributes contain the bytecode and exception informations
  19. -- of Java methods.
  20. --
  21. -- For more information about Java Class file format check :
  22. --    The Java Virtual Machine Specification
  23. --    (Release 1.0 Beta - Draft - August 21, 1995)
  24.  
  25.  
  26. with Basic_Definitions;
  27. use Basic_Definitions;
  28.  
  29. with Byte_Utilities;
  30.  
  31. with CP;
  32.  
  33. package Attribute.Code is
  34.  
  35.    -- This class attribute name in Java files
  36.    ------------------------------------------
  37.    C_Class_Name : constant Wide_String := "Code";
  38.  
  39.    -- Exception handler informations
  40.    ---------------------------------
  41.    type Exception_Info is private;
  42.  
  43.    type Exception_Infos is array (Unsigned_16 range <>) of Exception_Info;
  44.  
  45.    type Acc_Exception_Infos is access Exception_Infos;
  46.    
  47.    -- Java method bytecode and exception informations
  48.    --------------------------------------------------
  49.    type Code_Attribute is new Attribute with private;
  50.       
  51.    type Acc_Code_Attribute is access all Code_Attribute'Class;
  52.    
  53.  
  54.    -- Decode informations of the attribute from a file
  55.    ---------------------------------------------------
  56.    procedure Decode (This      : access Code_Attribute;
  57.                      From_File : in Byte_Utilities.File_Type;
  58.                      Context   : in CP.Acc_CP_Infos);
  59.  
  60.    -- Display the attribute
  61.    ------------------------
  62.    procedure Display (This    : access Code_Attribute;
  63.                       Context : in CP.Acc_CP_Infos);
  64.  
  65. private
  66.  
  67.    -- Exception handler informations
  68.    ---------------------------------
  69.    type Exception_Info is
  70.       record
  71.          Start_Pc   : Unsigned_16;
  72.          End_Pc     : Unsigned_16;
  73.          Handler_Pc : Unsigned_16;
  74.          Catch_Type : Unsigned_16;
  75.       end record;
  76.  
  77.    -- Java method bytecode and exception informations
  78.    --------------------------------------------------
  79.    type Code_Attribute is new Attribute with
  80.       record
  81.          Max_Stack        : Unsigned_16;
  82.          Max_Locals       : Unsigned_16;
  83.          Code_Length      : Unsigned_32;
  84.          Code             : Byte_Utilities.Acc_Bytes;
  85.          Exceptions_Count : Unsigned_16;
  86.          Exception_Table  : Acc_Exception_Infos;
  87.          Attributes_Count : Unsigned_16;
  88.          Attributes       : Acc_Attributes;
  89.       end record;
  90.       
  91. end Attribute.Code;
  92.