home *** CD-ROM | disk | FTP | other *** search
/ Hacker / Hacker.iso / HACKER / DECOMP / DECAF / cp.ads < prev    next >
Encoding:
Text File  |  1996-09-19  |  3.7 KB  |  112 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 package provides the abstract class CP_Info :
  18. -- this class is the common superclass of all Java Constant_Pool
  19. -- informations classes.
  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. with Basic_Definitions;
  26. use Basic_Definitions;
  27.  
  28. with Byte_Utilities;
  29.  
  30. package CP is
  31.  
  32.    -- Decoding purpose is used for Constant Pool information
  33.    -- to String conversion
  34.    ---------------------------------------------------------
  35.    type Decoding_Purpose is
  36.       (Class_Name, Variable_Signature, Method_Signature);
  37.  
  38.    -- Abstract type and access type for Constant Pool Infos
  39.    --------------------------------------------------------
  40.    type CP_Info is abstract tagged private;
  41.       
  42.    type Acc_CP_Info is access all CP_Info'Class;
  43.    
  44.    -- array type and access type to Constant Pool Infos
  45.    ----------------------------------------------------
  46.    type CP_Infos is array (Unsigned_16 range <>) of Acc_CP_Info;
  47.    
  48.    type Acc_CP_Infos is access CP_Infos;
  49.  
  50.  
  51.    -- Raised if an unknown kind of Constant Pool is read
  52.    -----------------------------------------------------
  53.    E_Unknown_Tag : exception;
  54.    
  55.    -- Decode a Constant Pool information
  56.    -- this procedure must be overwritten by subclasses
  57.    ---------------------------------------------------
  58.    procedure Decode (From_File : Byte_Utilities.File_Type;
  59.                      Some_Info : access CP_Info) is abstract;
  60.  
  61.    -- Read a Constant Pool information
  62.    -----------------------------------
  63.    function Read_Constant
  64.                (From_File : Byte_Utilities.File_Type)      
  65.             return Acc_CP_Info;
  66.  
  67.    -- Display a Constant Pool information
  68.    -- this procedure must be overwritten by subclasses
  69.    ---------------------------------------------------
  70.    procedure Display (Some_Info : access CP_Info;
  71.                       Context   : in Acc_CP_Infos) is abstract;
  72.  
  73.    -- Returns True is the information is a class
  74.    ---------------------------------------------
  75.    function Is_Class
  76.                (Some_Info : access CP_Info) return Boolean;
  77.                
  78.    -- Returns True is the information uses two indexes
  79.    -- in the Constant Pool table (which is -why?- the
  80.    -- case for Long_Integer and Long_Floats)
  81.    ---------------------------------------------------
  82.    function Use_Two_Indexes_In_Table
  83.                (Some_Info : access CP_Info) return Boolean;
  84.  
  85.  
  86.    --
  87.    -- Differents Constant Pool information to string conversion functions
  88.    --
  89.    
  90.    function As_String
  91.                (Some_Info : access CP_Info) return Wide_String;
  92.    
  93.    function Print_String
  94.                (Some_Info : access CP_Info;
  95.                 Context   : Acc_CP_Infos) return String;
  96.  
  97.    function Java_Decoded_String
  98.                (Some_Info : access CP_Info;
  99.                 Context   : Acc_CP_Infos;
  100.                 Purpose   : Decoding_Purpose) return String;
  101.  
  102. private 
  103.  
  104.    -- Abstract type and access type for Constant Pool Infos
  105.    --------------------------------------------------------
  106.    type CP_Info is abstract tagged
  107.       record
  108.          Tag : Unsigned_8; 
  109.       end record;
  110.  
  111. end CP;
  112.