home *** CD-ROM | disk | FTP | other *** search
/ Hacker / Hacker.iso / HACKER / DECOMP / DECAF / clasfile.ads < prev    next >
Encoding:
Text File  |  1996-09-19  |  3.8 KB  |  110 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. --
  18. -- Package Class_File provides the top level type Class_File used
  19. -- to represent a complete Java Class File. File reading and
  20. -- class display services are implemented with this version
  21. --
  22. -- For more information about Java Class file format check :
  23. --    The Java Virtual Machine Specification
  24. --    (Release 1.0 Beta - Draft - August 21, 1995)
  25.  
  26. with Basic_Definitions;
  27. use Basic_Definitions;
  28.  
  29. with Byte_Utilities;
  30.  
  31. with CP;
  32.  
  33. with Attribute;
  34.  
  35. with Field;
  36.  
  37. package Class_File is
  38.  
  39.    -- this exception may be raised if the file read is not Java compliant
  40.    ----------------------------------------------------------------------
  41.    Bad_File : exception;
  42.  
  43.    -- this array type and its access type is used to store
  44.    -- arrays of 16 bit integers 
  45.    -------------------------------------------------------
  46.    type Unsigned_16_Array is array (Unsigned_16 range <>) of Unsigned_16;
  47.    
  48.    type Acc_Unsigned_16_Array is access Unsigned_16_Array;
  49.  
  50.    -- type Class_File
  51.    ------------------
  52.    type Class_File is private;
  53.  
  54.  
  55.    -- Read a Class from a Java class file
  56.    --------------------------------------
  57.    function Read_Class (From_File : Byte_Utilities.File_Type)      
  58.             return Class_File;
  59.  
  60.    -- Internal tool debugging information, should disappear soon
  61.    -------------------------------------------------------------
  62.    procedure Display_Class (Infos : in Class_File);
  63.    
  64.    -- Display the spec (and the body) of the Class with Java syntax
  65.    ----------------------------------------------------------------
  66.    procedure Display_Java_Spec (Infos    : in Class_File;
  67.                                 For_Body : in Boolean := False);
  68.  
  69.    -- Display the spec of the Class with Ada syntax
  70.    ------------------------------------------------
  71.    procedure Display_Ada_Spec (Infos : in Class_File);
  72.  
  73.    -- Display the body of the Class with Ada syntax
  74.    ------------------------------------------------
  75.    procedure Display_Ada_Body (Infos : in Class_File);
  76.  
  77.    -- Display the spec of the Class with Smalltalk syntax
  78.    ------------------------------------------------------
  79.    procedure Display_Stk_Spec (Infos : in Class_File);
  80.  
  81.    -- Display the body of the class with Smalltalk syntax
  82.    ------------------------------------------------------
  83.    procedure Display_Stk_Body (Infos : in Class_File);
  84.  
  85. private
  86.  
  87.    -- current type Class_File reflects the contents of a Java Class file
  88.    ---------------------------------------------------------------------
  89.    type Class_File is
  90.       record
  91.          Magic               : Unsigned_32;
  92.          Minor_Version       : Unsigned_16;
  93.          Major_Version       : Unsigned_16;
  94.          Constant_Pool_Count : Unsigned_16;
  95.          Constant_Pool       : CP.Acc_CP_Infos;
  96.          Access_Flags        : Unsigned_16;
  97.          This_Class          : Unsigned_16;
  98.          Super_Class         : Unsigned_16;
  99.          Interfaces_Count    : Unsigned_16;
  100.          Interfaces          : Acc_Unsigned_16_Array;
  101.          Fields_Count        : Unsigned_16;
  102.          Fields              : Field.Acc_Field_Infos;
  103.          Methods_Count       : Unsigned_16;
  104.          Methods             : Field.Acc_Field_Infos;
  105.          Attribute_Count     : Unsigned_16;
  106.          Attributes          : Attribute.Acc_Attributes;
  107.       end record;
  108.  
  109. end Class_File;
  110.