home *** CD-ROM | disk | FTP | other *** search
/ Hacker / Hacker.iso / HACKER / DECOMP / DECAF / field.adb < prev    next >
Encoding:
Text File  |  1996-09-19  |  2.3 KB  |  66 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. with Ada.Text_Io;
  18.  
  19. package body Field is
  20.  
  21.    use Byte_Utilities;
  22.  
  23.    procedure Decode (From_File : Byte_Utilities.File_Type;
  24.                      Some_Info : access Field_Info;
  25.                      Context   : in CP.Acc_CP_Infos) is
  26.    begin
  27.       -- Decode is common to the two subclasses, they do not overwrite it
  28.  
  29.       -- Reads the access flags Unsigned_16, the name index, the
  30.       -- signature index and the number of attributes
  31.       Read (From_File, Some_Info.Access_Flags);
  32.       Read (From_File, Some_Info.Name_Index);
  33.       Read (From_File, Some_Info.Signature_Index);
  34.       Read (From_File, Some_Info.Attributes_Count);
  35.  
  36.       -- if there is some attributes, Reads them
  37.       if Some_Info.Attributes_Count > 0 then
  38.          Some_Info.Attributes := new Attribute.Attributes
  39.                                         (1 .. Some_Info.Attributes_Count);
  40.          for J in 1 .. Some_Info.Attributes_Count loop
  41.             -- calls the Attribute reading method
  42.             Some_Info.Attributes (J) := Attribute.Read_Attribute (From_File, Context);
  43.          end loop;
  44.       else
  45.          Some_Info.Attributes := null;
  46.       end if;
  47.    end Decode;
  48.  
  49.    procedure Display
  50.                 (Field   : access Field_Info;
  51.                  Context : in CP.Acc_CP_Infos) is
  52.    begin
  53.       -- Displays the Field Informations
  54.       Ada.Text_Io.Put_Line (" Field : ");
  55.       Ada.Text_Io.Put_Line
  56.          ("   access flags : " & Unsigned_16'image (Field.Access_Flags));
  57.       Ada.Text_Io.Put_Line
  58.          ("   name         : " & Unsigned_16'image (Field.Name_Index));
  59.       Ada.Text_Io.Put_Line
  60.          ("   signature    : " & Unsigned_16'image (Field.Signature_Index));
  61.       Ada.Text_Io.Put_Line
  62.          ("   attributes   : " & Unsigned_16'image (Field.Attributes_Count));
  63.    end Display;
  64.  
  65. end Field;
  66.