From b02b05332f45fc6ac4f99556cda9fb7ee894e673 Mon Sep 17 00:00:00 2001 From: Mark H Weaver Date: Tue, 27 Oct 2009 22:59:22 +0100 Subject: [PATCH] fix nil handling in the vm * libguile/vm-i-scheme.c (not, not-not): Treat nil as false. (null?, not-null?): Treat nil as null. * libguile/vm-i-system.c (br-if, br-if-not): Treat nil as false. (br-if-null, br-if-not-null): Treat nil as null. --- libguile/vm-i-scheme.c | 8 ++++---- libguile/vm-i-system.c | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/libguile/vm-i-scheme.c b/libguile/vm-i-scheme.c index b4aadf931..ff963d64c 100644 --- a/libguile/vm-i-scheme.c +++ b/libguile/vm-i-scheme.c @@ -32,13 +32,13 @@ VM_DEFINE_FUNCTION (100, not, "not", 1) { ARGS1 (x); - RETURN (SCM_BOOL (SCM_FALSEP (x))); + RETURN (SCM_BOOL (scm_is_false_or_nil (x))); } VM_DEFINE_FUNCTION (101, not_not, "not-not", 1) { ARGS1 (x); - RETURN (SCM_BOOL (!SCM_FALSEP (x))); + RETURN (SCM_BOOL (!scm_is_false_or_nil (x))); } VM_DEFINE_FUNCTION (102, eq, "eq?", 2) @@ -56,13 +56,13 @@ VM_DEFINE_FUNCTION (103, not_eq, "not-eq?", 2) VM_DEFINE_FUNCTION (104, nullp, "null?", 1) { ARGS1 (x); - RETURN (SCM_BOOL (SCM_NULLP (x))); + RETURN (SCM_BOOL (scm_is_null_or_nil (x))); } VM_DEFINE_FUNCTION (105, not_nullp, "not-null?", 1) { ARGS1 (x); - RETURN (SCM_BOOL (!SCM_NULLP (x))); + RETURN (SCM_BOOL (!scm_is_null_or_nil (x))); } VM_DEFINE_FUNCTION (106, eqv, "eqv?", 2) diff --git a/libguile/vm-i-system.c b/libguile/vm-i-system.c index 160c231c8..f58ffce58 100644 --- a/libguile/vm-i-system.c +++ b/libguile/vm-i-system.c @@ -475,12 +475,12 @@ VM_DEFINE_INSTRUCTION (34, br, "br", 3, 0, 0) VM_DEFINE_INSTRUCTION (35, br_if, "br-if", 3, 0, 0) { - BR (!SCM_FALSEP (*sp)); + BR (scm_is_true_and_not_nil (*sp)); } VM_DEFINE_INSTRUCTION (36, br_if_not, "br-if-not", 3, 0, 0) { - BR (SCM_FALSEP (*sp)); + BR (scm_is_false_or_nil (*sp)); } VM_DEFINE_INSTRUCTION (37, br_if_eq, "br-if-eq", 3, 0, 0) @@ -497,12 +497,12 @@ VM_DEFINE_INSTRUCTION (38, br_if_not_eq, "br-if-not-eq", 3, 0, 0) VM_DEFINE_INSTRUCTION (39, br_if_null, "br-if-null", 3, 0, 0) { - BR (SCM_NULLP (*sp)); + BR (scm_is_null_or_nil (*sp)); } VM_DEFINE_INSTRUCTION (40, br_if_not_null, "br-if-not-null", 3, 0, 0) { - BR (!SCM_NULLP (*sp)); + BR (!scm_is_null_or_nil (*sp)); }