From 42c30833c2f65f8d44f3a9f7564f41deac939659 Mon Sep 17 00:00:00 2001 From: BT Templeton Date: Sat, 17 Aug 2013 00:01:50 -0400 Subject: [PATCH] [SQUASH] symbol * src/lisp.h (SYMBOL_INTERNED_IN_INITIAL_OBARRAY_P): Move... * src/data.c (SYMBOL_INTERNED_IN_INITIAL_OBARRAY_P): ...here, and update for Guile. * src/lisp.h (SYMBOL_INTERNED_P): Use `scm_symbol_interned_p'. --- src/alloc.c | 1 - src/data.c | 9 +++++++++ src/lisp.h | 23 +---------------------- src/lread.c | 6 ------ 4 files changed, 10 insertions(+), 29 deletions(-) diff --git a/src/alloc.c b/src/alloc.c index 65e063bc52..3fe4601010 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -1177,7 +1177,6 @@ initialize_symbol (Lisp_Object val, Lisp_Object name) p->redirect = SYMBOL_PLAINVAL; SET_SYMBOL_VAL (p, Qunbound); scm_module_define (function_module, val, Qnil); - p->interned = SYMBOL_UNINTERNED; p->constant = 0; p->declared_special = false; } diff --git a/src/data.c b/src/data.c index 9f0b9a3e6e..225ac10cac 100644 --- a/src/data.c +++ b/src/data.c @@ -347,6 +347,15 @@ DEFUN ("symbolp", Fsymbolp, Ssymbolp, 1, 1, 0, return Qnil; } +static bool +SYMBOL_INTERNED_IN_INITIAL_OBARRAY_P (Lisp_Object sym) +{ + /* Should be initial_obarray */ + Lisp_Object tem = Ffind_symbol (SYMBOL_NAME (sym), Vobarray); + return (! NILP (scm_c_value_ref (tem, 1)) + && (EQ (sym, scm_c_value_ref (tem, 0)))); +} + /* Define this in C to avoid unnecessarily consing up the symbol name. */ DEFUN ("keywordp", Fkeywordp, Skeywordp, 1, 1, 0, diff --git a/src/lisp.h b/src/lisp.h index 62e72eca28..86d20cea0a 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -1284,15 +1284,6 @@ CHAR_TABLE_EXTRA_SLOTS (struct Lisp_Char_Table *ct) Symbols ***********************************************************************/ -/* Interned state of a symbol. */ - -enum symbol_interned -{ - SYMBOL_UNINTERNED = 0, - SYMBOL_INTERNED = 1, - SYMBOL_INTERNED_IN_INITIAL_OBARRAY = 2 -}; - enum symbol_redirect { SYMBOL_PLAINVAL = 4, @@ -1317,10 +1308,6 @@ struct Lisp_Symbol can be changed, but only by `defconst'. */ unsigned constant : 2; - /* Interned state of the symbol. This is an enumerator from - enum symbol_interned. */ - unsigned interned : 2; - /* True means that this variable has been explicitly declared special (with `defvar' etc), and shouldn't be lexically bound. */ bool_bf declared_special : 1; @@ -1394,15 +1381,7 @@ SYMBOL_NAME (Lisp_Object sym) INLINE bool SYMBOL_INTERNED_P (Lisp_Object sym) { - return XSYMBOL (sym)->interned != SYMBOL_UNINTERNED; -} - -/* Value is true if SYM is interned in initial_obarray. */ - -INLINE bool -SYMBOL_INTERNED_IN_INITIAL_OBARRAY_P (Lisp_Object sym) -{ - return XSYMBOL (sym)->interned == SYMBOL_INTERNED_IN_INITIAL_OBARRAY; + return scm_is_true (scm_symbol_interned_p (sym)); } INLINE Lisp_Object diff --git a/src/lread.c b/src/lread.c index 71ba6790a1..54542fef97 100644 --- a/src/lread.c +++ b/src/lread.c @@ -3838,11 +3838,6 @@ it defaults to the value of `obarray'. */) obhash (obarray)); initialize_symbol (sym, string); - if (EQ (obarray, initial_obarray)) - XSYMBOL (sym)->interned = SYMBOL_INTERNED_IN_INITIAL_OBARRAY; - else - XSYMBOL (sym)->interned = SYMBOL_INTERNED; - if ((SREF (string, 0) == ':') && EQ (obarray, initial_obarray)) { @@ -3931,7 +3926,6 @@ usage: (unintern NAME OBARRAY) */) } - //XSYMBOL (tem)->interned = SYMBOL_UNINTERNED; return (scm_is_true (scm_unintern (name, obhash (obarray))) ? Qt : Qnil); } -- 2.20.1