1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 03:40:34 +02:00

* variable.h (scm_tc16_variable): Removed.

(SCM_VARIABLEP): Test for new tc7 code.
(scm_i_variable_print): New.
* variable.c (scm_tc16_variable): Removed.
(variable_print): Renamed to scm_i_variable_print and made
non-static.
(variable_equal_p): Removed.
(make_variable): Construct a tc7 object instead of a smob.
(scm_init_variable): Do not register smob.
This commit is contained in:
Marius Vollmer 2001-07-25 15:28:07 +00:00
parent e5aca4b5c4
commit dbf5dfb3c1
2 changed files with 22 additions and 19 deletions

View file

@ -52,24 +52,17 @@
#include "libguile/validate.h"
#include "libguile/variable.h"
scm_t_bits scm_tc16_variable;
static int
variable_print (SCM exp, SCM port, scm_print_state *pstate)
void
scm_i_variable_print (SCM exp, SCM port, scm_print_state *pstate)
{
scm_puts ("#<variable ", port);
scm_intprint (SCM_UNPACK (exp), 16, port);
scm_puts (" binding: ", port);
scm_iprin1 (SCM_VARIABLE_REF (exp), port, pstate);
scm_putc('>', port);
return 1;
}
static SCM
variable_equalp (SCM var1, SCM var2)
{
return scm_equal_p (SCM_VARIABLE_REF (var1), SCM_VARIABLE_REF (var2));
}
#if SCM_ENABLE_VCELLS
@ -80,9 +73,24 @@ static SCM
make_variable (SCM init)
{
#if !SCM_ENABLE_VCELLS
SCM_RETURN_NEWSMOB (scm_tc16_variable, SCM_UNPACK (init));
{
SCM z;
SCM_NEWCELL (z);
SCM_SET_CELL_WORD_1 (z, SCM_UNPACK (init));
SCM_SET_CELL_TYPE (z, scm_tc7_variable);
scm_remember_upto_here_1 (init);
return z;
}
#else
SCM_RETURN_NEWSMOB (scm_tc16_variable, scm_cons (sym_huh, init));
{
SCM z;
SCM cell = scm_cons (sym_huh, init);
SCM_NEWCELL (z);
SCM_SET_CELL_WORD_1 (z, SCM_UNPACK (cell));
SCM_SET_CELL_TYPE (z, scm_tc7_variable);
scm_remember_upto_here_1 (cell);
return z;
}
#endif
}
@ -192,11 +200,6 @@ SCM_DEFINE (scm_builtin_variable, "builtin-variable", 1, 0, 0,
void
scm_init_variable ()
{
scm_tc16_variable = scm_make_smob_type ("variable", 0);
scm_set_smob_mark (scm_tc16_variable, scm_markcdr);
scm_set_smob_print (scm_tc16_variable, variable_print);
scm_set_smob_equalp (scm_tc16_variable, variable_equalp);
#ifndef SCM_MAGIC_SNARFER
#include "libguile/variable.x"
#endif