fixed a comparison between a normal object and a special pointer
This commit is contained in:
parent
38ca4baf8f
commit
c123f1c39a
@ -7,6 +7,26 @@ procedure Apply is
|
|||||||
Func: aliased Object_Pointer;
|
Func: aliased Object_Pointer;
|
||||||
Args: aliased Object_Pointer;
|
Args: aliased Object_Pointer;
|
||||||
|
|
||||||
|
-- -------------------------------------------------------------
|
||||||
|
-- Boolean procedures
|
||||||
|
-- -------------------------------------------------------------
|
||||||
|
procedure Apply_Not_Procedure is
|
||||||
|
begin
|
||||||
|
null;
|
||||||
|
end Apply_Not_Procedure;
|
||||||
|
|
||||||
|
procedure Apply_Q_Boolean_Procedure is
|
||||||
|
begin
|
||||||
|
null;
|
||||||
|
end Apply_Q_Boolean_Procedure;
|
||||||
|
|
||||||
|
-- -------------------------------------------------------------
|
||||||
|
-- Equivalence predicates
|
||||||
|
-- -------------------------------------------------------------
|
||||||
|
procedure Apply_Q_Eqv_Procedure is
|
||||||
|
begin
|
||||||
|
null;
|
||||||
|
end Apply_Q_Eqv_Procedure;
|
||||||
|
|
||||||
-- -------------------------------------------------------------
|
-- -------------------------------------------------------------
|
||||||
-- List manipulation procedures
|
-- List manipulation procedures
|
||||||
@ -106,7 +126,6 @@ Ada.Text_IO.Put_Line ("EXPECTED CONS-CELL FOR Setcdr");
|
|||||||
Return_Frame (Interp, A);
|
Return_Frame (Interp, A);
|
||||||
end Apply_Setcdr_Procedure;
|
end Apply_Setcdr_Procedure;
|
||||||
|
|
||||||
|
|
||||||
-- -------------------------------------------------------------
|
-- -------------------------------------------------------------
|
||||||
-- Arithmetic procedures
|
-- Arithmetic procedures
|
||||||
-- -------------------------------------------------------------
|
-- -------------------------------------------------------------
|
||||||
@ -351,16 +370,6 @@ Ada.Text_IO.Put_line ("WRONG NUMBER OF ARGUMETNS FOR COMPARISON");
|
|||||||
null;
|
null;
|
||||||
end Apply_Q_Eq_Procedure;
|
end Apply_Q_Eq_Procedure;
|
||||||
|
|
||||||
procedure Apply_Q_Eqv_Procedure is
|
|
||||||
begin
|
|
||||||
null;
|
|
||||||
end Apply_Q_Eqv_Procedure;
|
|
||||||
|
|
||||||
|
|
||||||
procedure Apply_Not_Procedure is
|
|
||||||
begin
|
|
||||||
null;
|
|
||||||
end Apply_Not_Procedure;
|
|
||||||
|
|
||||||
-- -------------------------------------------------------------
|
-- -------------------------------------------------------------
|
||||||
-- Closure
|
-- Closure
|
||||||
@ -567,24 +576,11 @@ begin
|
|||||||
Apply_Cdr_Procedure;
|
Apply_Cdr_Procedure;
|
||||||
when Cons_Procedure =>
|
when Cons_Procedure =>
|
||||||
Apply_Cons_Procedure;
|
Apply_Cons_Procedure;
|
||||||
when Setcar_Procedure =>
|
when Not_Procedure =>
|
||||||
Apply_Setcar_Procedure;
|
Apply_Not_Procedure;
|
||||||
when Setcdr_Procedure =>
|
|
||||||
Apply_Setcdr_Procedure;
|
|
||||||
|
|
||||||
when N_Add_Procedure =>
|
when N_Add_Procedure =>
|
||||||
Apply_Add_Procedure;
|
Apply_Add_Procedure;
|
||||||
when N_Subtract_Procedure =>
|
|
||||||
Apply_Subtract_Procedure;
|
|
||||||
when N_Multiply_Procedure =>
|
|
||||||
Apply_Multiply_Procedure;
|
|
||||||
when N_Quotient_Procedure =>
|
|
||||||
Apply_Quotient_Procedure;
|
|
||||||
when N_Remainder_Procedure =>
|
|
||||||
--Apply_Remainder_Procedure;
|
|
||||||
ada.text_io.put_line ("NOT IMPLEMENTED");
|
|
||||||
raise Evaluation_Error;
|
|
||||||
|
|
||||||
when N_EQ_Procedure =>
|
when N_EQ_Procedure =>
|
||||||
Apply_N_EQ_Procedure;
|
Apply_N_EQ_Procedure;
|
||||||
when N_GT_Procedure =>
|
when N_GT_Procedure =>
|
||||||
@ -595,8 +591,19 @@ begin
|
|||||||
Apply_N_GE_Procedure;
|
Apply_N_GE_Procedure;
|
||||||
when N_LE_Procedure =>
|
when N_LE_Procedure =>
|
||||||
Apply_N_LE_Procedure;
|
Apply_N_LE_Procedure;
|
||||||
|
when N_Multiply_Procedure =>
|
||||||
|
Apply_Multiply_Procedure;
|
||||||
|
when N_Quotient_Procedure =>
|
||||||
|
Apply_Quotient_Procedure;
|
||||||
|
when N_Remainder_Procedure =>
|
||||||
|
--Apply_Remainder_Procedure;
|
||||||
|
ada.text_io.put_line ("NOT IMPLEMENTED");
|
||||||
|
raise Evaluation_Error;
|
||||||
|
when N_Subtract_Procedure =>
|
||||||
|
Apply_Subtract_Procedure;
|
||||||
|
|
||||||
|
when Q_Boolean_Procedure =>
|
||||||
|
Apply_Q_Boolean_Procedure;
|
||||||
when Q_Eq_Procedure =>
|
when Q_Eq_Procedure =>
|
||||||
Apply_Q_Eq_Procedure;
|
Apply_Q_Eq_Procedure;
|
||||||
when Q_Eqv_Procedure =>
|
when Q_Eqv_Procedure =>
|
||||||
@ -613,8 +620,10 @@ begin
|
|||||||
Apply_Q_Symbol_Procedure;
|
Apply_Q_Symbol_Procedure;
|
||||||
|
|
||||||
|
|
||||||
when Not_Procedure =>
|
when Setcar_Procedure =>
|
||||||
Apply_Not_Procedure;
|
Apply_Setcar_Procedure;
|
||||||
|
when Setcdr_Procedure =>
|
||||||
|
Apply_Setcdr_Procedure;
|
||||||
|
|
||||||
end case;
|
end case;
|
||||||
|
|
||||||
|
@ -26,20 +26,20 @@ package body H2.Scheme is
|
|||||||
Car_Procedure,
|
Car_Procedure,
|
||||||
Cdr_Procedure,
|
Cdr_Procedure,
|
||||||
Cons_Procedure,
|
Cons_Procedure,
|
||||||
|
|
||||||
Not_Procedure,
|
Not_Procedure,
|
||||||
|
|
||||||
|
N_Add_Procedure,
|
||||||
N_EQ_Procedure,
|
N_EQ_Procedure,
|
||||||
N_GT_Procedure,
|
N_GT_Procedure,
|
||||||
N_LT_Procedure,
|
N_LT_Procedure,
|
||||||
N_GE_Procedure,
|
N_GE_Procedure,
|
||||||
N_LE_Procedure,
|
N_LE_Procedure,
|
||||||
N_Add_Procedure,
|
|
||||||
N_Multiply_Procedure,
|
N_Multiply_Procedure,
|
||||||
N_Quotient_Procedure,
|
N_Quotient_Procedure,
|
||||||
N_Remainder_Procedure,
|
N_Remainder_Procedure,
|
||||||
N_Subtract_Procedure,
|
N_Subtract_Procedure,
|
||||||
|
|
||||||
|
Q_Boolean_Procedure,
|
||||||
Q_Eq_Procedure,
|
Q_Eq_Procedure,
|
||||||
Q_Eqv_Procedure,
|
Q_Eqv_Procedure,
|
||||||
Q_Null_Procedure,
|
Q_Null_Procedure,
|
||||||
@ -84,20 +84,20 @@ package body H2.Scheme is
|
|||||||
Label_Car: constant Object_Character_Array := (Ch.LC_C, Ch.LC_A, Ch.LC_R); -- "car"
|
Label_Car: constant Object_Character_Array := (Ch.LC_C, Ch.LC_A, Ch.LC_R); -- "car"
|
||||||
Label_Cdr: constant Object_Character_Array := (Ch.LC_C, Ch.LC_D, Ch.LC_R); -- "cdr"
|
Label_Cdr: constant Object_Character_Array := (Ch.LC_C, Ch.LC_D, Ch.LC_R); -- "cdr"
|
||||||
Label_Cons: constant Object_Character_Array := (Ch.LC_C, Ch.LC_O, Ch.LC_N, Ch.LC_S); -- "cons"
|
Label_Cons: constant Object_Character_Array := (Ch.LC_C, Ch.LC_O, Ch.LC_N, Ch.LC_S); -- "cons"
|
||||||
|
Label_Not: constant Object_Character_Array := (Ch.LC_N, Ch.LC_O, Ch.LC_T); -- "not"
|
||||||
|
|
||||||
|
Label_N_Add: constant Object_Character_Array := (1 => Ch.Plus_Sign); -- "+"
|
||||||
|
|
||||||
Label_N_EQ: constant Object_Character_Array := (1 => Ch.Equal_Sign); -- "="
|
Label_N_EQ: constant Object_Character_Array := (1 => Ch.Equal_Sign); -- "="
|
||||||
Label_N_GE: constant Object_Character_Array := (Ch.Greater_Than_Sign, Ch.Equal_Sign); -- ">="
|
Label_N_GE: constant Object_Character_Array := (Ch.Greater_Than_Sign, Ch.Equal_Sign); -- ">="
|
||||||
Label_N_GT: constant Object_Character_Array := (1 => Ch.Greater_Than_Sign); -- ">"
|
Label_N_GT: constant Object_Character_Array := (1 => Ch.Greater_Than_Sign); -- ">"
|
||||||
Label_N_LE: constant Object_Character_Array := (Ch.Less_Than_Sign, Ch.Equal_Sign); -- "<="
|
Label_N_LE: constant Object_Character_Array := (Ch.Less_Than_Sign, Ch.Equal_Sign); -- "<="
|
||||||
Label_N_LT: constant Object_Character_Array := (1 => Ch.Less_Than_Sign); -- "<"
|
Label_N_LT: constant Object_Character_Array := (1 => Ch.Less_Than_Sign); -- "<"
|
||||||
Label_N_Minus: constant Object_Character_Array := (1 => Ch.Minus_Sign); -- "-"
|
|
||||||
Label_N_Multiply: constant Object_Character_Array := (1 => Ch.Asterisk); -- "*"
|
Label_N_Multiply: constant Object_Character_Array := (1 => Ch.Asterisk); -- "*"
|
||||||
Label_N_Plus: constant Object_Character_Array := (1 => Ch.Plus_Sign); -- "+"
|
|
||||||
Label_N_Quotient: constant Object_Character_Array := (Ch.LC_Q, Ch.LC_U, Ch.LC_O, Ch.LC_T, Ch.LC_I, Ch.LC_E, Ch.LC_N, Ch.LC_T); -- "quotient"
|
Label_N_Quotient: constant Object_Character_Array := (Ch.LC_Q, Ch.LC_U, Ch.LC_O, Ch.LC_T, Ch.LC_I, Ch.LC_E, Ch.LC_N, Ch.LC_T); -- "quotient"
|
||||||
Label_N_Remainder: constant Object_Character_Array := (Ch.LC_R, Ch.LC_E, Ch.LC_M, Ch.LC_A, Ch.LC_I, Ch.LC_N, Ch.LC_D, Ch.LC_E, Ch.LC_R); -- "remainder"
|
Label_N_Remainder: constant Object_Character_Array := (Ch.LC_R, Ch.LC_E, Ch.LC_M, Ch.LC_A, Ch.LC_I, Ch.LC_N, Ch.LC_D, Ch.LC_E, Ch.LC_R); -- "remainder"
|
||||||
|
Label_N_Subtract: constant Object_Character_Array := (1 => Ch.Minus_Sign); -- "-"
|
||||||
|
|
||||||
|
Label_Q_Boolean: constant Object_Character_Array := (Ch.LC_B, Ch.LC_O, Ch.LC_O, Ch.LC_L, Ch.LC_E, Ch.LC_A, Ch.LC_N, Ch.Question); -- "boolean?"
|
||||||
Label_Q_Eq: constant Object_Character_Array := (Ch.LC_E, Ch.LC_Q, Ch.Question); -- "eq?"
|
Label_Q_Eq: constant Object_Character_Array := (Ch.LC_E, Ch.LC_Q, Ch.Question); -- "eq?"
|
||||||
Label_Q_Eqv: constant Object_Character_Array := (Ch.LC_E, Ch.LC_Q, Ch.LC_V, Ch.Question); -- "eqv?"
|
Label_Q_Eqv: constant Object_Character_Array := (Ch.LC_E, Ch.LC_Q, Ch.LC_V, Ch.Question); -- "eqv?"
|
||||||
Label_Q_Null: constant Object_Character_Array := (Ch.LC_N, Ch.LC_U, Ch.LC_L, Ch.LC_L, Ch.Question); -- "null?"
|
Label_Q_Null: constant Object_Character_Array := (Ch.LC_N, Ch.LC_U, Ch.LC_L, Ch.LC_L, Ch.Question); -- "null?"
|
||||||
@ -109,8 +109,6 @@ package body H2.Scheme is
|
|||||||
Label_Setcar: constant Object_Character_Array := (Ch.LC_S, Ch.LC_E, Ch.LC_T, Ch.Minus_Sign, Ch.LC_C, Ch.LC_A, Ch.LC_R, Ch.Exclamation); -- "set-car!"
|
Label_Setcar: constant Object_Character_Array := (Ch.LC_S, Ch.LC_E, Ch.LC_T, Ch.Minus_Sign, Ch.LC_C, Ch.LC_A, Ch.LC_R, Ch.Exclamation); -- "set-car!"
|
||||||
Label_Setcdr: constant Object_Character_Array := (Ch.LC_S, Ch.LC_E, Ch.LC_T, Ch.Minus_Sign, Ch.LC_C, Ch.LC_D, Ch.LC_R, Ch.Exclamation); -- "set-cdr!"
|
Label_Setcdr: constant Object_Character_Array := (Ch.LC_S, Ch.LC_E, Ch.LC_T, Ch.Minus_Sign, Ch.LC_C, Ch.LC_D, Ch.LC_R, Ch.Exclamation); -- "set-cdr!"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Label_Newline: constant Object_Character_Array := (Ch.LC_N, Ch.LC_E, Ch.LC_W, Ch.LC_L, Ch.LC_I, Ch.LC_N, Ch.LC_E); -- "newline"
|
Label_Newline: constant Object_Character_Array := (Ch.LC_N, Ch.LC_E, Ch.LC_W, Ch.LC_L, Ch.LC_I, Ch.LC_N, Ch.LC_E); -- "newline"
|
||||||
Label_Space: constant Object_Character_Array := (Ch.LC_S, Ch.LC_P, Ch.LC_A, Ch.LC_C, Ch.LC_E); -- "space"
|
Label_Space: constant Object_Character_Array := (Ch.LC_S, Ch.LC_P, Ch.LC_A, Ch.LC_C, Ch.LC_E); -- "space"
|
||||||
|
|
||||||
@ -479,6 +477,9 @@ package body H2.Scheme is
|
|||||||
function Equal_Values (X: in Object_Pointer; Y: in Object_Pointer) return Standard.Boolean is
|
function Equal_Values (X: in Object_Pointer; Y: in Object_Pointer) return Standard.Boolean is
|
||||||
Ptr_Type: Object_Pointer_Type;
|
Ptr_Type: Object_Pointer_Type;
|
||||||
begin
|
begin
|
||||||
|
if X = Y then
|
||||||
|
return Standard.True;
|
||||||
|
end if;
|
||||||
|
|
||||||
Ptr_Type := Get_Pointer_Type(X);
|
Ptr_Type := Get_Pointer_Type(X);
|
||||||
case Ptr_Type is
|
case Ptr_Type is
|
||||||
@ -486,14 +487,21 @@ package body H2.Scheme is
|
|||||||
Object_Pointer_Type_Character |
|
Object_Pointer_Type_Character |
|
||||||
Object_Pointer_Type_Byte =>
|
Object_Pointer_Type_Byte =>
|
||||||
|
|
||||||
if Get_Pointer_Type(Y) = Ptr_Type then
|
-- This part of the code won't be reached if two special
|
||||||
return X = Y;
|
-- pointers are the same. So False can be returned safely
|
||||||
else
|
-- without further check. See the lines commented out.
|
||||||
|
|
||||||
|
--if Get_Pointer_Type(Y) = Ptr_Type then
|
||||||
|
-- return X = Y;
|
||||||
|
--else
|
||||||
return Standard.False;
|
return Standard.False;
|
||||||
end if;
|
--end if;
|
||||||
|
|
||||||
when others =>
|
when others =>
|
||||||
-- TODO: BIGNUM, OTHER NUMERIC DATA.
|
-- TODO: BIGNUM, OTHER NUMERIC DATA.
|
||||||
|
if Get_Pointer_Type(Y) /= Ptr_Type then
|
||||||
|
return Standard.False;
|
||||||
|
end if;
|
||||||
|
|
||||||
case X.Kind is
|
case X.Kind is
|
||||||
when Character_Object =>
|
when Character_Object =>
|
||||||
@ -1916,20 +1924,21 @@ end if;
|
|||||||
Dummy := Make_Procedure (Interp.Self, Car_Procedure, Label_Car); -- "car"
|
Dummy := Make_Procedure (Interp.Self, Car_Procedure, Label_Car); -- "car"
|
||||||
Dummy := Make_Procedure (Interp.Self, Cdr_Procedure, Label_Cdr); -- "cdr"
|
Dummy := Make_Procedure (Interp.Self, Cdr_Procedure, Label_Cdr); -- "cdr"
|
||||||
Dummy := Make_Procedure (Interp.Self, Cons_Procedure, Label_Cons); -- "cons"
|
Dummy := Make_Procedure (Interp.Self, Cons_Procedure, Label_Cons); -- "cons"
|
||||||
|
Dummy := Make_Procedure (Interp.Self, Not_Procedure, Label_Not); -- "not"
|
||||||
|
|
||||||
|
|
||||||
|
Dummy := Make_Procedure (Interp.Self, N_Add_Procedure, Label_N_Add); -- "+"
|
||||||
Dummy := Make_Procedure (Interp.Self, N_EQ_Procedure, Label_N_EQ); -- "="
|
Dummy := Make_Procedure (Interp.Self, N_EQ_Procedure, Label_N_EQ); -- "="
|
||||||
Dummy := Make_Procedure (Interp.Self, N_GE_Procedure, Label_N_GE); -- ">="
|
Dummy := Make_Procedure (Interp.Self, N_GE_Procedure, Label_N_GE); -- ">="
|
||||||
Dummy := Make_Procedure (Interp.Self, N_GT_Procedure, Label_N_GT); -- ">"
|
Dummy := Make_Procedure (Interp.Self, N_GT_Procedure, Label_N_GT); -- ">"
|
||||||
Dummy := Make_Procedure (Interp.Self, N_LE_Procedure, Label_N_LE); -- "<="
|
Dummy := Make_Procedure (Interp.Self, N_LE_Procedure, Label_N_LE); -- "<="
|
||||||
Dummy := Make_Procedure (Interp.Self, N_LT_Procedure, Label_N_LT); -- "<"
|
Dummy := Make_Procedure (Interp.Self, N_LT_Procedure, Label_N_LT); -- "<"
|
||||||
Dummy := Make_Procedure (Interp.Self, N_Add_Procedure, Label_N_Plus); -- "+"
|
|
||||||
Dummy := Make_Procedure (Interp.Self, N_Multiply_Procedure, Label_N_Multiply); -- "*"
|
Dummy := Make_Procedure (Interp.Self, N_Multiply_Procedure, Label_N_Multiply); -- "*"
|
||||||
Dummy := Make_Procedure (Interp.Self, N_Quotient_Procedure, Label_N_Quotient); -- "quotient"
|
Dummy := Make_Procedure (Interp.Self, N_Quotient_Procedure, Label_N_Quotient); -- "quotient"
|
||||||
Dummy := Make_Procedure (Interp.Self, N_Remainder_Procedure, Label_N_Remainder); -- "remainder"
|
Dummy := Make_Procedure (Interp.Self, N_Remainder_Procedure, Label_N_Remainder); -- "remainder"
|
||||||
Dummy := Make_Procedure (Interp.Self, N_Subtract_Procedure, Label_N_Minus); -- "-"
|
Dummy := Make_Procedure (Interp.Self, N_Subtract_Procedure, Label_N_Subtract); -- "-"
|
||||||
|
|
||||||
|
|
||||||
|
Dummy := Make_Procedure (Interp.Self, Q_Boolean_Procedure, Label_Q_Boolean); -- "boolean?"
|
||||||
Dummy := Make_Procedure (Interp.Self, Q_Eq_Procedure, Label_Q_Eq); -- "eq?"
|
Dummy := Make_Procedure (Interp.Self, Q_Eq_Procedure, Label_Q_Eq); -- "eq?"
|
||||||
Dummy := Make_Procedure (Interp.Self, Q_Eqv_Procedure, Label_Q_Eqv); -- "eqv?"
|
Dummy := Make_Procedure (Interp.Self, Q_Eqv_Procedure, Label_Q_Eqv); -- "eqv?"
|
||||||
Dummy := Make_Procedure (Interp.Self, Q_Null_Procedure, Label_Q_Null); -- "null?"
|
Dummy := Make_Procedure (Interp.Self, Q_Null_Procedure, Label_Q_Null); -- "null?"
|
||||||
|
Loading…
Reference in New Issue
Block a user