1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-15 16:20:17 +02:00

Remove uses of discouraged constructs.

* libguile/vm-i-scheme.c, libguile/vm-i-system.c, libguile/vm.c: Replace
  uses of discouraged constructs by their current counterparts.
This commit is contained in:
Ludovic Courtès 2009-11-25 23:46:17 +01:00
parent 1040b20531
commit 9bd48cb17b
3 changed files with 20 additions and 20 deletions

View file

@ -32,37 +32,37 @@
VM_DEFINE_FUNCTION (100, not, "not", 1) VM_DEFINE_FUNCTION (100, not, "not", 1)
{ {
ARGS1 (x); ARGS1 (x);
RETURN (SCM_BOOL (scm_is_false_or_nil (x))); RETURN (scm_from_bool (scm_is_false_or_nil (x)));
} }
VM_DEFINE_FUNCTION (101, not_not, "not-not", 1) VM_DEFINE_FUNCTION (101, not_not, "not-not", 1)
{ {
ARGS1 (x); ARGS1 (x);
RETURN (SCM_BOOL (!scm_is_false_or_nil (x))); RETURN (scm_from_bool (!scm_is_false_or_nil (x)));
} }
VM_DEFINE_FUNCTION (102, eq, "eq?", 2) VM_DEFINE_FUNCTION (102, eq, "eq?", 2)
{ {
ARGS2 (x, y); ARGS2 (x, y);
RETURN (SCM_BOOL (SCM_EQ_P (x, y))); RETURN (scm_from_bool (SCM_EQ_P (x, y)));
} }
VM_DEFINE_FUNCTION (103, not_eq, "not-eq?", 2) VM_DEFINE_FUNCTION (103, not_eq, "not-eq?", 2)
{ {
ARGS2 (x, y); ARGS2 (x, y);
RETURN (SCM_BOOL (!SCM_EQ_P (x, y))); RETURN (scm_from_bool (!SCM_EQ_P (x, y)));
} }
VM_DEFINE_FUNCTION (104, nullp, "null?", 1) VM_DEFINE_FUNCTION (104, nullp, "null?", 1)
{ {
ARGS1 (x); ARGS1 (x);
RETURN (SCM_BOOL (scm_is_null_or_nil (x))); RETURN (scm_from_bool (scm_is_null_or_nil (x)));
} }
VM_DEFINE_FUNCTION (105, not_nullp, "not-null?", 1) VM_DEFINE_FUNCTION (105, not_nullp, "not-null?", 1)
{ {
ARGS1 (x); ARGS1 (x);
RETURN (SCM_BOOL (!scm_is_null_or_nil (x))); RETURN (scm_from_bool (!scm_is_null_or_nil (x)));
} }
VM_DEFINE_FUNCTION (106, eqv, "eqv?", 2) VM_DEFINE_FUNCTION (106, eqv, "eqv?", 2)
@ -90,13 +90,13 @@ VM_DEFINE_FUNCTION (107, equal, "equal?", 2)
VM_DEFINE_FUNCTION (108, pairp, "pair?", 1) VM_DEFINE_FUNCTION (108, pairp, "pair?", 1)
{ {
ARGS1 (x); ARGS1 (x);
RETURN (SCM_BOOL (SCM_CONSP (x))); RETURN (scm_from_bool (SCM_CONSP (x)));
} }
VM_DEFINE_FUNCTION (109, listp, "list?", 1) VM_DEFINE_FUNCTION (109, listp, "list?", 1)
{ {
ARGS1 (x); ARGS1 (x);
RETURN (SCM_BOOL (scm_ilength (x) >= 0)); RETURN (scm_from_bool (scm_ilength (x) >= 0));
} }
@ -161,7 +161,7 @@ VM_DEFINE_INSTRUCTION (114, set_cdr, "set-cdr!", 0, 2, 0)
{ \ { \
ARGS2 (x, y); \ ARGS2 (x, y); \
if (SCM_I_INUMP (x) && SCM_I_INUMP (y)) \ if (SCM_I_INUMP (x) && SCM_I_INUMP (y)) \
RETURN (SCM_BOOL (SCM_I_INUM (x) crel SCM_I_INUM (y))); \ RETURN (scm_from_bool (SCM_I_INUM (x) crel SCM_I_INUM (y))); \
SYNC_REGISTER (); \ SYNC_REGISTER (); \
RETURN (srel (x, y)); \ RETURN (srel (x, y)); \
} }

View file

@ -486,13 +486,13 @@ VM_DEFINE_INSTRUCTION (36, br_if_not, "br-if-not", 3, 0, 0)
VM_DEFINE_INSTRUCTION (37, br_if_eq, "br-if-eq", 3, 0, 0) VM_DEFINE_INSTRUCTION (37, br_if_eq, "br-if-eq", 3, 0, 0)
{ {
sp--; /* underflow? */ sp--; /* underflow? */
BR (SCM_EQ_P (sp[0], sp[1])); BR (scm_is_eq (sp[0], sp[1]));
} }
VM_DEFINE_INSTRUCTION (38, br_if_not_eq, "br-if-not-eq", 3, 0, 0) VM_DEFINE_INSTRUCTION (38, br_if_not_eq, "br-if-not-eq", 3, 0, 0)
{ {
sp--; /* underflow? */ sp--; /* underflow? */
BR (!SCM_EQ_P (sp[0], sp[1])); BR (!scm_is_eq (sp[0], sp[1]));
} }
VM_DEFINE_INSTRUCTION (39, br_if_null, "br-if-null", 3, 0, 0) VM_DEFINE_INSTRUCTION (39, br_if_null, "br-if-null", 3, 0, 0)
@ -877,7 +877,7 @@ VM_DEFINE_INSTRUCTION (54, goto_args, "goto/args", 1, -1, 1)
POP (values); POP (values);
values = scm_struct_ref (values, SCM_INUM0); values = scm_struct_ref (values, SCM_INUM0);
nvalues = scm_ilength (values); nvalues = scm_ilength (values);
PUSH_LIST (values, SCM_NULLP); PUSH_LIST (values, scm_is_null);
goto vm_return_values; goto vm_return_values;
} }
else else
@ -970,7 +970,7 @@ VM_DEFINE_INSTRUCTION (57, mv_call, "mv-call", 4, -1, 1)
POP (values); POP (values);
values = scm_struct_ref (values, SCM_INUM0); values = scm_struct_ref (values, SCM_INUM0);
len = scm_length (values); len = scm_length (values);
PUSH_LIST (values, SCM_NULLP); PUSH_LIST (values, scm_is_null);
PUSH (len); PUSH (len);
ip = mvra; ip = mvra;
} }
@ -1043,7 +1043,7 @@ VM_DEFINE_INSTRUCTION (60, call_cc, "call/cc", 0, 1, 1)
/* multiple values returned to continuation */ /* multiple values returned to continuation */
SCM values; SCM values;
values = scm_struct_ref (cont, SCM_INUM0); values = scm_struct_ref (cont, SCM_INUM0);
if (SCM_NULLP (values)) if (scm_is_null (values))
goto vm_error_no_values; goto vm_error_no_values;
/* non-tail context does not accept multiple values? */ /* non-tail context does not accept multiple values? */
PUSH (SCM_CAR (values)); PUSH (SCM_CAR (values));
@ -1078,7 +1078,7 @@ VM_DEFINE_INSTRUCTION (61, goto_cc, "goto/cc", 0, 1, 1)
SCM values; SCM values;
values = scm_struct_ref (cont, SCM_INUM0); values = scm_struct_ref (cont, SCM_INUM0);
nvalues = scm_ilength (values); nvalues = scm_ilength (values);
PUSH_LIST (values, SCM_NULLP); PUSH_LIST (values, scm_is_null);
goto vm_return_values; goto vm_return_values;
} }
else else
@ -1188,7 +1188,7 @@ VM_DEFINE_INSTRUCTION (64, return_values_star, "return/values*", 1, -1, -1)
nvalues--; nvalues--;
POP (l); POP (l);
while (SCM_CONSP (l)) while (scm_is_pair (l))
{ {
PUSH (SCM_CAR (l)); PUSH (SCM_CAR (l));
l = SCM_CDR (l); l = SCM_CDR (l);

View file

@ -154,9 +154,9 @@ static void enfalsen_frame (void *p)
static void static void
vm_dispatch_hook (struct scm_vm *vp, SCM hook, SCM hook_args) vm_dispatch_hook (struct scm_vm *vp, SCM hook, SCM hook_args)
{ {
if (!SCM_FALSEP (vp->trace_frame)) if (!scm_is_false (vp->trace_frame))
return; return;
scm_dynwind_begin (0); scm_dynwind_begin (0);
/* FIXME, stack holder should be the vm */ /* FIXME, stack holder should be the vm */
vp->trace_frame = scm_c_make_vm_frame (SCM_BOOL_F, vp->fp, vp->sp, vp->ip, 0); vp->trace_frame = scm_c_make_vm_frame (SCM_BOOL_F, vp->fp, vp->sp, vp->ip, 0);
@ -229,7 +229,7 @@ vm_make_boot_program (long nargs)
static SCM static SCM
resolve_variable (SCM what, SCM program_module) resolve_variable (SCM what, SCM program_module)
{ {
if (SCM_LIKELY (SCM_SYMBOLP (what))) if (SCM_LIKELY (scm_is_symbol (what)))
{ {
if (SCM_LIKELY (scm_module_system_booted_p if (SCM_LIKELY (scm_module_system_booted_p
&& scm_is_true (program_module))) && scm_is_true (program_module)))
@ -434,7 +434,7 @@ SCM_DEFINE (scm_vm_p, "vm?", 1, 0, 0,
"") "")
#define FUNC_NAME s_scm_vm_p #define FUNC_NAME s_scm_vm_p
{ {
return SCM_BOOL (SCM_VM_P (obj)); return scm_from_bool (SCM_VM_P (obj));
} }
#undef FUNC_NAME #undef FUNC_NAME