home *** CD-ROM | disk | FTP | other *** search
- --
- -- Copyright (C) 1996 Ada Resource Association (ARA), Columbus, Ohio.
- -- Author: Gilles Demailly
- --
- --
- -- Permission to use, copy, modify, and distribute this software and its
- -- documentation for any purpose and without fee is hereby granted,
- -- provided that the above copyright and authorship notice appear in all
- -- copies and that both that copyright notice and this permission notice
- -- appear in supporting documentation.
- --
- -- The ARA makes no representations about the suitability of this software
- -- for any purpose. It is provided "as is" without express
- -- or implied warranty.
- --
-
- with Ada.Text_Io;
-
- package body Field is
-
- use Byte_Utilities;
-
- procedure Decode (From_File : Byte_Utilities.File_Type;
- Some_Info : access Field_Info;
- Context : in CP.Acc_CP_Infos) is
- begin
- -- Decode is common to the two subclasses, they do not overwrite it
-
- -- Reads the access flags Unsigned_16, the name index, the
- -- signature index and the number of attributes
- Read (From_File, Some_Info.Access_Flags);
- Read (From_File, Some_Info.Name_Index);
- Read (From_File, Some_Info.Signature_Index);
- Read (From_File, Some_Info.Attributes_Count);
-
- -- if there is some attributes, Reads them
- if Some_Info.Attributes_Count > 0 then
- Some_Info.Attributes := new Attribute.Attributes
- (1 .. Some_Info.Attributes_Count);
- for J in 1 .. Some_Info.Attributes_Count loop
- -- calls the Attribute reading method
- Some_Info.Attributes (J) := Attribute.Read_Attribute (From_File, Context);
- end loop;
- else
- Some_Info.Attributes := null;
- end if;
- end Decode;
-
- procedure Display
- (Field : access Field_Info;
- Context : in CP.Acc_CP_Infos) is
- begin
- -- Displays the Field Informations
- Ada.Text_Io.Put_Line (" Field : ");
- Ada.Text_Io.Put_Line
- (" access flags : " & Unsigned_16'image (Field.Access_Flags));
- Ada.Text_Io.Put_Line
- (" name : " & Unsigned_16'image (Field.Name_Index));
- Ada.Text_Io.Put_Line
- (" signature : " & Unsigned_16'image (Field.Signature_Index));
- Ada.Text_Io.Put_Line
- (" attributes : " & Unsigned_16'image (Field.Attributes_Count));
- end Display;
-
- end Field;
-