From d839e8c41a6a6e63c939a585fa30864288e97b4d Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Sat, 11 Jan 2014 03:38:02 +0000 Subject: [PATCH] touched up code a bit --- lib/h2-scheme.adb | 22 +++++++++++----------- lib/h2-scheme.ads | 12 ++++++++---- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/lib/h2-scheme.adb b/lib/h2-scheme.adb index ed3bb99..fb72e00 100644 --- a/lib/h2-scheme.adb +++ b/lib/h2-scheme.adb @@ -276,9 +276,9 @@ package body H2.Scheme is end Pointer_To_Byte; -- TODO: move away these utilities routines - --function To_Thin_String_Pointer (Source: in Object_Pointer) return Thin_String_Pointer is + --function To_Thin_Object_String_Pointer (Source: in Object_Pointer) return Thin_Object_String_Pointer is -- type Character_Pointer is access all Object_Character; - -- Ptr: Thin_String_Pointer; + -- Ptr: Thin_Object_String_Pointer; -- X: Character_Pointer; -- for X'Address use Ptr'Address; @@ -288,22 +288,22 @@ package body H2.Scheme is -- So i've commented out this function and turn to a different method below. -- X := Source.Character_Slot(Source.Character_Slot'First)'Access; -- return Ptr; - --end To_Thin_String_Pointer; + --end To_Thin_Object_String_Pointer; - --function To_Thin_String_Pointer (Source: in Object_Pointer) return Thin_String_Pointer is - -- function To_Thin_Pointer is new Ada.Unchecked_Conversion (System.Address, Thin_String_Pointer); + --function To_Thin_Object_String_Pointer (Source: in Object_Pointer) return Thin_Object_String_Pointer is + -- function To_Thin_Pointer is new Ada.Unchecked_Conversion (System.Address, Thin_Object_String_Pointer); --begin -- return To_Thin_Pointer(Source.Character_Slot'Address); - --end To_Thin_String_Pointer; + --end To_Thin_Object_String_Pointer; - function To_Thin_String_Pointer (Source: in Object_Pointer) return Thin_String_Pointer is - X: aliased Thin_String; + function To_Thin_Object_String_Pointer (Source: in Object_Pointer) return Thin_Object_String_Pointer is + X: aliased Thin_Object_String; for X'Address use Source.Character_Slot'Address; begin return X'Unchecked_Access; - end To_Thin_String_Pointer; + end To_Thin_Object_String_Pointer; - procedure Put_String (TS: in Thin_String_Pointer); + procedure Put_String (TS: in Thin_Object_String_Pointer); pragma Import (C, Put_String, "puts"); -- TODO: delete this procedure @@ -1098,7 +1098,7 @@ Ada.Text_IO.Put_Line ("Make_String..."); Result.Flags := Result.Flags or Syntax_Object; Result.Scode := Opcode; --Ada.Text_IO.Put ("Creating Syntax Symbol "); ---Put_String (To_Thin_String_Pointer (Result)); +--Put_String (To_Thin_Object_String_Pointer (Result)); return Result; end Make_Syntax; diff --git a/lib/h2-scheme.ads b/lib/h2-scheme.ads index 7130d9d..7e210a9 100644 --- a/lib/h2-scheme.ads +++ b/lib/h2-scheme.ads @@ -130,7 +130,14 @@ package H2.Scheme is type Object_String is array (Object_String_Range range <>) of Object_Character; type Object_String_Pointer is access all Object_String; + for Object_String_Pointer'Size use Object_Pointer_Bits; type Constant_Object_String_Pointer is access constant Object_String; + for Constant_Object_String_Pointer'Size use Object_Pointer_Bits; + +-- TODO: are these Thin_XXXX necessary? + subtype Thin_Object_String is Object_String (Object_String_Range'Range); + type Thin_Object_String_Pointer is access all Thin_Object_String; + for Thin_Object_String_Pointer'Size use Object_Pointer_Bits; type Object_Byte_Array is array (Object_Size range <>) of Object_Byte; subtype Object_Character_Array is Object_String; @@ -419,12 +426,9 @@ package H2.Scheme is -- ----------------------------------------------------------------------------- - subtype Thin_String is Object_String (Object_String_Range'Range); - type Thin_String_Pointer is access all Thin_String; - for Thin_String_Pointer'Size use Object_Pointer_Bits; type Buffer_Record is record - Ptr: Thin_String_Pointer := null; + Ptr: Thin_Object_String_Pointer := null; Len: Object_String_Size := 0; Last: Object_String_Size := 0; end record;