1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-20 03:30:27 +02:00

Remove remaining uses of discouraged constructs.

* libguile/frames.c, libguile/instructions.c, libguile/objcodes.c,
  libguile/programs.c, libguile/throw.c, libguile/vm-i-scheme.c,
  libguile/vm.c:  Replace uses of discouraged constructs by their
  current counterparts.
This commit is contained in:
Ludovic Courtès 2009-11-28 15:11:31 +01:00
parent 49bb5bd307
commit 5c8cefe591
7 changed files with 22 additions and 20 deletions

View file

@ -66,7 +66,7 @@ SCM_DEFINE (scm_vm_frame_p, "vm-frame?", 1, 0, 0,
"")
#define FUNC_NAME s_scm_vm_frame_p
{
return SCM_BOOL (SCM_VM_FRAME_P (obj));
return scm_from_bool (SCM_VM_FRAME_P (obj));
}
#undef FUNC_NAME

View file

@ -83,17 +83,19 @@ scm_lookup_instruction_by_name (SCM name)
struct scm_instruction *table = fetch_instruction_table ();
SCM op;
if (SCM_UNLIKELY (SCM_FALSEP (instructions_by_name)))
{
int i;
instructions_by_name = scm_permanent_object
(scm_make_hash_table (SCM_I_MAKINUM (SCM_VM_NUM_INSTRUCTIONS)));
if (SCM_UNLIKELY (scm_is_false (instructions_by_name)))
{
unsigned int i;
instructions_by_name =
scm_make_hash_table (SCM_I_MAKINUM (SCM_VM_NUM_INSTRUCTIONS));
for (i = 0; i < SCM_VM_NUM_INSTRUCTIONS; i++)
if (scm_is_true (table[i].symname))
scm_hashq_set_x (instructions_by_name, table[i].symname,
SCM_I_MAKINUM (i));
}
op = scm_hashq_ref (instructions_by_name, name, SCM_UNDEFINED);
if (SCM_I_INUMP (op))
return &table[SCM_I_INUM (op)];
@ -124,7 +126,7 @@ SCM_DEFINE (scm_instruction_p, "instruction?", 1, 0, 0,
"")
#define FUNC_NAME s_scm_instruction_p
{
return SCM_BOOL (scm_lookup_instruction_by_name (obj));
return scm_from_bool (scm_lookup_instruction_by_name (obj) != NULL);
}
#undef FUNC_NAME

View file

@ -145,7 +145,7 @@ SCM_DEFINE (scm_objcode_p, "objcode?", 1, 0, 0,
"")
#define FUNC_NAME s_scm_objcode_p
{
return SCM_BOOL (SCM_OBJCODE_P (obj));
return scm_from_bool (SCM_OBJCODE_P (obj));
}
#undef FUNC_NAME

View file

@ -58,12 +58,12 @@ scm_i_program_print (SCM program, SCM port, scm_print_state *pstate)
{
static int print_error = 0;
if (SCM_FALSEP (write_program) && scm_module_system_booted_p)
if (scm_is_false (write_program) && scm_module_system_booted_p)
write_program = scm_module_local_variable
(scm_c_resolve_module ("system vm program"),
scm_from_locale_symbol ("write-program"));
if (SCM_FALSEP (write_program) || print_error)
if (scm_is_false (write_program) || print_error)
{
scm_puts ("#<program ", port);
scm_uintprint (SCM_CELL_WORD_1 (program), 16, port);
@ -87,7 +87,7 @@ SCM_DEFINE (scm_program_p, "program?", 1, 0, 0,
"")
#define FUNC_NAME s_scm_program_p
{
return SCM_BOOL (SCM_PROGRAM_P (obj));
return scm_from_bool (SCM_PROGRAM_P (obj));
}
#undef FUNC_NAME

View file

@ -1,4 +1,4 @@
/* Copyright (C) 1995,1996,1997,1998,2000,2001, 2003, 2004, 2006, 2008 Free Software Foundation, Inc.
/* Copyright (C) 1995,1996,1997,1998,2000,2001, 2003, 2004, 2006, 2008, 2009 Free Software Foundation, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
@ -177,7 +177,7 @@ scm_c_catch (SCM tag,
struct pre_unwind_data pre_unwind;
vm = scm_the_vm ();
if (SCM_NFALSEP (vm))
if (scm_is_true (vm))
{
sp = SCM_VM_DATA (vm)->sp;
fp = SCM_VM_DATA (vm)->fp;

View file

@ -44,13 +44,13 @@ VM_DEFINE_FUNCTION (101, not_not, "not-not", 1)
VM_DEFINE_FUNCTION (102, eq, "eq?", 2)
{
ARGS2 (x, y);
RETURN (scm_from_bool (SCM_EQ_P (x, y)));
RETURN (scm_from_bool (scm_is_eq (x, y)));
}
VM_DEFINE_FUNCTION (103, not_eq, "not-eq?", 2)
{
ARGS2 (x, y);
RETURN (scm_from_bool (!SCM_EQ_P (x, y)));
RETURN (scm_from_bool (!scm_is_eq (x, y)));
}
VM_DEFINE_FUNCTION (104, nullp, "null?", 1)
@ -68,7 +68,7 @@ VM_DEFINE_FUNCTION (105, not_nullp, "not-null?", 1)
VM_DEFINE_FUNCTION (106, eqv, "eqv?", 2)
{
ARGS2 (x, y);
if (SCM_EQ_P (x, y))
if (scm_is_eq (x, y))
RETURN (SCM_BOOL_T);
if (SCM_IMP (x) || SCM_IMP (y))
RETURN (SCM_BOOL_F);
@ -79,7 +79,7 @@ VM_DEFINE_FUNCTION (106, eqv, "eqv?", 2)
VM_DEFINE_FUNCTION (107, equal, "equal?", 2)
{
ARGS2 (x, y);
if (SCM_EQ_P (x, y))
if (scm_is_eq (x, y))
RETURN (SCM_BOOL_T);
if (SCM_IMP (x) || SCM_IMP (y))
RETURN (SCM_BOOL_F);
@ -90,7 +90,7 @@ VM_DEFINE_FUNCTION (107, equal, "equal?", 2)
VM_DEFINE_FUNCTION (108, pairp, "pair?", 1)
{
ARGS1 (x);
RETURN (scm_from_bool (SCM_CONSP (x)));
RETURN (scm_from_bool (scm_is_pair (x)));
}
VM_DEFINE_FUNCTION (109, listp, "list?", 1)

View file

@ -254,7 +254,7 @@ resolve_variable (SCM what, SCM program_module)
mod = scm_resolve_module (SCM_CAR (what));
if (scm_is_true (SCM_CADDR (what)))
mod = scm_module_public_interface (mod);
if (SCM_FALSEP (mod))
if (scm_is_false (mod))
scm_misc_error (NULL, "no such module: ~S",
scm_list_1 (SCM_CAR (what)));
/* might longjmp */