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 Attribute.Constant_Value;
- with Attribute.Source_File;
- with Attribute.Code;
- with Attribute.Local_Variable_Table;
- with Attribute.Exceptions;
- with Attribute.Line_Number_Table;
-
- package body Attribute is
-
- use Byte_Utilities;
- use CP;
-
- function Read_Attribute
- (From_File : Byte_Utilities.File_Type;
- Context : CP.Acc_CP_Infos)
- return Acc_Attribute is
- Name : Unsigned_16;
- Answer : Acc_Attribute;
- begin
- -- Read the Name of the Attribute class
- Read (From_File, Name);
-
- -- Instanciate the Attribute correct subclass
- if As_String (Context (Name)) = Source_File.C_Class_Name then
- Answer := new Source_File.Source_File_Attribute;
- elsif As_String (Context (Name)) = Constant_Value.C_Class_Name then
- Answer := new Constant_Value.Constant_Value_Attribute;
- elsif As_String (Context (Name)) = Code.C_Class_Name then
- Answer := new Code.Code_Attribute;
- elsif As_String (Context (Name)) = Exceptions.C_Class_Name then
- Answer := new Exceptions.Exceptions_Attribute;
- elsif As_String (Context (Name)) = Line_Number_Table.C_Class_Name then
- Answer := new Line_Number_Table.Line_Number_Table_Attribute;
- elsif As_String (Context (Name)) = Local_Variable_Table.C_Class_Name then
- Answer := new Local_Variable_Table.Local_Variable_Table_Attribute;
- else
- raise E_Unknown_Attribute;
- end if;
-
- -- Read the Attribute Length
- Read (From_File, Answer.Length);
-
- -- Decode the other informations of the attribute
- -- (implemented by subclasses)
- Decode (Answer, From_File, Context);
-
- return Answer;
- end Read_Attribute;
-
- end Attribute;
-