touched up code a bit

This commit is contained in:
hyung-hwan 2014-01-11 03:38:02 +00:00
parent 24829df3a6
commit d839e8c41a
2 changed files with 19 additions and 15 deletions

View File

@ -276,9 +276,9 @@ package body H2.Scheme is
end Pointer_To_Byte; end Pointer_To_Byte;
-- TODO: move away these utilities routines -- 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; -- type Character_Pointer is access all Object_Character;
-- Ptr: Thin_String_Pointer; -- Ptr: Thin_Object_String_Pointer;
-- X: Character_Pointer; -- X: Character_Pointer;
-- for X'Address use Ptr'Address; -- 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. -- So i've commented out this function and turn to a different method below.
-- X := Source.Character_Slot(Source.Character_Slot'First)'Access; -- X := Source.Character_Slot(Source.Character_Slot'First)'Access;
-- return Ptr; -- 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_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_String_Pointer); -- function To_Thin_Pointer is new Ada.Unchecked_Conversion (System.Address, Thin_Object_String_Pointer);
--begin --begin
-- return To_Thin_Pointer(Source.Character_Slot'Address); -- 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 function To_Thin_Object_String_Pointer (Source: in Object_Pointer) return Thin_Object_String_Pointer is
X: aliased Thin_String; X: aliased Thin_Object_String;
for X'Address use Source.Character_Slot'Address; for X'Address use Source.Character_Slot'Address;
begin begin
return X'Unchecked_Access; 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"); pragma Import (C, Put_String, "puts");
-- TODO: delete this procedure -- TODO: delete this procedure
@ -1098,7 +1098,7 @@ Ada.Text_IO.Put_Line ("Make_String...");
Result.Flags := Result.Flags or Syntax_Object; Result.Flags := Result.Flags or Syntax_Object;
Result.Scode := Opcode; Result.Scode := Opcode;
--Ada.Text_IO.Put ("Creating Syntax Symbol "); --Ada.Text_IO.Put ("Creating Syntax Symbol ");
--Put_String (To_Thin_String_Pointer (Result)); --Put_String (To_Thin_Object_String_Pointer (Result));
return Result; return Result;
end Make_Syntax; end Make_Syntax;

View File

@ -130,7 +130,14 @@ package H2.Scheme is
type Object_String is array (Object_String_Range range <>) of Object_Character; type Object_String is array (Object_String_Range range <>) of Object_Character;
type Object_String_Pointer is access all Object_String; 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; 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; type Object_Byte_Array is array (Object_Size range <>) of Object_Byte;
subtype Object_Character_Array is Object_String; 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 type Buffer_Record is record
Ptr: Thin_String_Pointer := null; Ptr: Thin_Object_String_Pointer := null;
Len: Object_String_Size := 0; Len: Object_String_Size := 0;
Last: Object_String_Size := 0; Last: Object_String_Size := 0;
end record; end record;