home *** CD-ROM | disk | FTP | other *** search
/ Hacker / Hacker.iso / HACKER / DECOMP / DECAF / cpunicod.adb < prev    next >
Encoding:
Text File  |  1996-09-19  |  1.6 KB  |  48 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 CP.Unicode is
  20.  
  21.    use Byte_Utilities;
  22.  
  23.    procedure Decode (From_File : Byte_Utilities.File_Type;
  24.                      Some_Info : access Unicode) is 
  25.    begin
  26.       -- Reads the length of the string of its bytes
  27.       -- in this version, decoding the string is not implemented
  28.       Some_Info.Tag := C_Class_Tag;
  29.       Read (From_File, Some_Info.Length);
  30.       Some_Info.bytes := new Bytes (1..Unsigned_32(Some_Info.Length) * 2);
  31.       for I in 1..Unsigned_32(Some_Info.Length) * 2 loop
  32.          Read (From_File, Some_Info.bytes (I));
  33.       end loop;
  34.    end Decode;
  35.  
  36.  
  37.    procedure Display (Some_Info :  access Unicode;
  38.                       Context   : in Acc_CP_Infos) is
  39.    begin
  40.       -- since decoding is not yet implemented, displays only
  41.       -- information about the lenght of the string
  42.       Ada.Text_Io.Put_Line ("-> Unicode info");
  43.       Ada.Text_Io.Put_Line
  44.          ("   Length : " & Unsigned_16'Image (Some_Info.Length));
  45.    end Display;
  46.    
  47. end CP.Unicode;
  48.