summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS2
-rw-r--r--libguile/ChangeLog20
-rw-r--r--libguile/gc.c6
-rw-r--r--libguile/init.c5
-rw-r--r--libguile/root.h25
-rw-r--r--libguile/symbols.c24
6 files changed, 56 insertions, 26 deletions
diff --git a/NEWS b/NEWS
index d8e2f79e7..f364f62f7 100644
--- a/NEWS
+++ b/NEWS
@@ -211,6 +211,8 @@ current values of file descriptors 0, 1, and 2 in the parent process.
There is no such concept as a weak binding any more.
+** Removed constants: most-positive-fixnum, most-negative-fixnum, bignum-radix
+
* Changes to the gh_ interface
* Changes to the scm_ interface
diff --git a/libguile/ChangeLog b/libguile/ChangeLog
index 4e2575552..dfd554b8c 100644
--- a/libguile/ChangeLog
+++ b/libguile/ChangeLog
@@ -1,5 +1,25 @@
2000-12-12 Dirk Herrmann <D.Herrmann@tu-bs.de>
+ The variable scm_symbols is made static within symbols.c and
+ renamed to symbols. The initialization of the symbols hash table
+ is done in function scm_symbols_prehistory.
+
+ * gc.c (scm_init_storage): Don't initialize scm_symbols. Don't
+ define most-positive-fixnum, most-negative-fixnum and
+ bignum-radix.
+
+ * init.c (scm_init_guile_1): Call scm_symbols_prehistory.
+
+ * root.h (scm_symbols): Not in scm_sys_protects any more.
+
+ * symbols.c (symbols): Renamed from scm_symbols and made static.
+
+ (scm_mem2symbol): scm_symbols is renamed to symbols.
+
+ * symbols.[ch] (scm_symbols_prehistory): Added.
+
+2000-12-12 Dirk Herrmann <D.Herrmann@tu-bs.de>
+
* gc.c (scm_init_storage), root.h (scm_weak_symhash, scm_symbols):
Removed the former scm_weak_symhash hash table. Added scm_symbols
hash table.
diff --git a/libguile/gc.c b/libguile/gc.c
index eaf8ec709..23eff9ae7 100644
--- a/libguile/gc.c
+++ b/libguile/gc.c
@@ -2521,17 +2521,11 @@ scm_init_storage ()
#define DEFAULT_SYMHASH_SIZE 277
scm_symhash = scm_make_vector (SCM_MAKINUM (DEFAULT_SYMHASH_SIZE), SCM_EOL);
- scm_symbols = scm_make_weak_key_hash_table (SCM_MAKINUM (DEFAULT_SYMHASH_SIZE));
scm_symhash_vars = scm_make_vector (SCM_MAKINUM (DEFAULT_SYMHASH_SIZE), SCM_EOL);
scm_stand_in_procs = SCM_EOL;
scm_permobjs = SCM_EOL;
scm_protects = scm_make_vector (SCM_MAKINUM (31), SCM_EOL);
- scm_sysintern ("most-positive-fixnum", SCM_MAKINUM (SCM_MOST_POSITIVE_FIXNUM));
- scm_sysintern ("most-negative-fixnum", SCM_MAKINUM (SCM_MOST_NEGATIVE_FIXNUM));
-#ifdef SCM_BIGDIG
- scm_sysintern ("bignum-radix", SCM_MAKINUM (SCM_BIGRAD));
-#endif
return 0;
}
diff --git a/libguile/init.c b/libguile/init.c
index b703dcf17..d20cdc236 100644
--- a/libguile/init.c
+++ b/libguile/init.c
@@ -469,8 +469,9 @@ scm_init_guile_1 (SCM_STACKITEM *base)
scm_debug_malloc_prehistory ();
#endif
scm_init_storage ();
- scm_struct_prehistory (); /* Must come after scm_init_storage */
- scm_weaks_prehistory (); /* Must come after scm_init_storage */
+ scm_struct_prehistory (); /* requires storage */
+ scm_symbols_prehistory (); /* requires storage */
+ scm_weaks_prehistory (); /* requires storage */
scm_init_subr_table ();
scm_environments_prehistory (); /* create the root environment */
scm_init_continuations ();
diff --git a/libguile/root.h b/libguile/root.h
index 950d12f54..82e12312c 100644
--- a/libguile/root.h
+++ b/libguile/root.h
@@ -61,21 +61,20 @@
#define scm_undefineds scm_sys_protects[2]
#define scm_nullvect scm_sys_protects[3]
#define scm_nullstr scm_sys_protects[4]
-#define scm_symbols scm_sys_protects[5]
-#define scm_symhash scm_sys_protects[6]
-#define scm_symhash_vars scm_sys_protects[7]
-#define scm_keyword_obarray scm_sys_protects[8]
-#define scm_stand_in_procs scm_sys_protects[9]
-#define scm_object_whash scm_sys_protects[10]
-#define scm_permobjs scm_sys_protects[11]
-#define scm_asyncs scm_sys_protects[12]
-#define scm_protects scm_sys_protects[13]
-#define scm_properties_whash scm_sys_protects[14]
+#define scm_symhash scm_sys_protects[5]
+#define scm_symhash_vars scm_sys_protects[6]
+#define scm_keyword_obarray scm_sys_protects[7]
+#define scm_stand_in_procs scm_sys_protects[8]
+#define scm_object_whash scm_sys_protects[9]
+#define scm_permobjs scm_sys_protects[10]
+#define scm_asyncs scm_sys_protects[11]
+#define scm_protects scm_sys_protects[12]
+#define scm_properties_whash scm_sys_protects[13]
#ifdef DEBUG_EXTENSIONS
-#define scm_source_whash scm_sys_protects[15]
-#define SCM_NUM_PROTECTS 16
-#else
+#define scm_source_whash scm_sys_protects[14]
#define SCM_NUM_PROTECTS 15
+#else
+#define SCM_NUM_PROTECTS 14
#endif
extern SCM scm_sys_protects[];
diff --git a/libguile/symbols.c b/libguile/symbols.c
index 824dcadf0..779369748 100644
--- a/libguile/symbols.c
+++ b/libguile/symbols.c
@@ -67,6 +67,10 @@
+static SCM symbols;
+
+
+
static char *
duplicate_string (const char * src, unsigned long length)
{
@@ -86,14 +90,14 @@ SCM
scm_mem2symbol (const char *name, scm_sizet len)
{
scm_sizet raw_hash = scm_string_hash ((const unsigned char *) name, len);
- scm_sizet hash = raw_hash % SCM_VECTOR_LENGTH (scm_symbols);
+ scm_sizet hash = raw_hash % SCM_VECTOR_LENGTH (symbols);
{
- /* Try to find the symbol in the scm_symbols table */
+ /* Try to find the symbol in the symbols table */
SCM l;
- for (l = SCM_VELTS (scm_symbols) [hash]; !SCM_NULLP (l); l = SCM_CDR (l))
+ for (l = SCM_VELTS (symbols) [hash]; !SCM_NULLP (l); l = SCM_CDR (l))
{
SCM sym = SCM_CAAR (l);
if (SCM_SYMBOL_HASH (sym) == raw_hash && SCM_SYMBOL_LENGTH (sym) == len)
@@ -128,8 +132,8 @@ scm_mem2symbol (const char *name, scm_sizet len)
SCM_SET_SYMBOL_LENGTH (symbol, (long) len);
cell = scm_cons (symbol, SCM_UNDEFINED);
- slot = SCM_VELTS (scm_symbols) [hash];
- SCM_VELTS (scm_symbols) [hash] = scm_cons (cell, slot);
+ slot = SCM_VELTS (symbols) [hash];
+ SCM_VELTS (symbols) [hash] = scm_cons (cell, slot);
return symbol;
}
@@ -393,6 +397,7 @@ scm_symbol_value0 (const char *name)
return SCM_CDR (vcell);
}
+
SCM_DEFINE (scm_symbol_p, "symbol?", 1, 0, 0,
(SCM obj),
"Returns @t{#t} if @var{obj} is a symbol, otherwise returns @t{#f}. (r5rs)")
@@ -853,6 +858,15 @@ SCM_DEFINE (scm_gentemp, "gentemp", 0, 2, 0,
}
#undef FUNC_NAME
+
+void
+scm_symbols_prehistory ()
+{
+ symbols = scm_make_weak_key_hash_table (SCM_MAKINUM (277));
+ scm_permanent_object (symbols);
+}
+
+
void
scm_init_symbols ()
{