[SQUASH] symbol
[bpt/emacs.git] / src / data.c
index 84efa20..225ac10 100644 (file)
@@ -244,21 +244,16 @@ The symbol returned names the object's basic type;
 for example, (type-of 1) returns `integer'.  */)
   (Lisp_Object object)
 {
-  switch (XTYPE (object))
+  if (INTEGERP (object))
+    return Qinteger;
+  else if (SYMBOLP (object))
+    return Qsymbol;
+  else if (STRINGP (object))
+    return Qstring;
+  else if (CONSP (object))
+    return Qcons;
+  else if (MISCP (object))
     {
-    case_Lisp_Int:
-      return Qinteger;
-
-    case Lisp_Symbol:
-      return Qsymbol;
-
-    case Lisp_String:
-      return Qstring;
-
-    case Lisp_Cons:
-      return Qcons;
-
-    case Lisp_Misc:
       switch (XMISCTYPE (object))
        {
        case Lisp_Misc_Marker:
@@ -269,8 +264,9 @@ for example, (type-of 1) returns `integer'.  */)
          return Qfloat;
        }
       emacs_abort ();
-
-    case Lisp_Vectorlike:
+    }
+  else if (VECTORLIKEP (object))
+    {
       if (WINDOW_CONFIGURATIONP (object))
        return Qwindow_configuration;
       if (PROCESSP (object))
@@ -298,13 +294,11 @@ for example, (type-of 1) returns `integer'.  */)
       if (FONT_OBJECT_P (object))
        return Qfont_object;
       return Qvector;
-
-    case Lisp_Float:
-      return Qfloat;
-
-    default:
-      emacs_abort ();
     }
+  else if (FLOATP (object))
+    return Qfloat;
+  else
+    return Qt;
 }
 
 DEFUN ("consp", Fconsp, Sconsp, 1, 1, 0,
@@ -353,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,
@@ -652,7 +655,7 @@ DEFUN ("fboundp", Ffboundp, Sfboundp, 1, 1, 0,
   (register Lisp_Object symbol)
 {
   CHECK_SYMBOL (symbol);
-  return NILP (XSYMBOL (symbol)->function) ? Qnil : Qt;
+  return NILP (SYMBOL_FUNCTION (symbol)) ? Qnil : Qt;
 }
 
 DEFUN ("makunbound", Fmakunbound, Smakunbound, 1, 1, 0,
@@ -684,7 +687,7 @@ DEFUN ("symbol-function", Fsymbol_function, Ssymbol_function, 1, 1, 0,
   (register Lisp_Object symbol)
 {
   CHECK_SYMBOL (symbol);
-  return XSYMBOL (symbol)->function;
+  return SYMBOL_FUNCTION (symbol);
 }
 
 DEFUN ("symbol-plist", Fsymbol_plist, Ssymbol_plist, 1, 1, 0,
@@ -692,7 +695,7 @@ DEFUN ("symbol-plist", Fsymbol_plist, Ssymbol_plist, 1, 1, 0,
   (register Lisp_Object symbol)
 {
   CHECK_SYMBOL (symbol);
-  return XSYMBOL (symbol)->plist;
+  return symbol_plist (symbol);
 }
 
 DEFUN ("symbol-name", Fsymbol_name, Ssymbol_name, 1, 1, 0,
@@ -713,7 +716,7 @@ DEFUN ("fset", Ffset, Sfset, 2, 2, 0,
   register Lisp_Object function;
   CHECK_SYMBOL (symbol);
 
-  function = XSYMBOL (symbol)->function;
+  function = SYMBOL_FUNCTION (symbol);
 
   if (!NILP (Vautoload_queue) && !NILP (function))
     Vautoload_queue = Fcons (Fcons (symbol, function), Vautoload_queue);
@@ -756,7 +759,7 @@ The return value is undefined.  */)
       { /* Only add autoload entries after dumping, because the ones before are
           not useful and else we get loads of them from the loaddefs.el.  */
 
-       if (AUTOLOADP (XSYMBOL (symbol)->function))
+       if (AUTOLOADP (SYMBOL_FUNCTION (symbol)))
          /* Remember that the function was already an autoload.  */
          LOADHIST_ATTACH (Fcons (Qt, symbol));
        LOADHIST_ATTACH (Fcons (autoload ? Qautoload : Qdefun, symbol));
@@ -2080,12 +2083,12 @@ indirect_function (register Lisp_Object object)
     {
       if (!SYMBOLP (hare) || NILP (hare))
        break;
-      hare = XSYMBOL (hare)->function;
+      hare = SYMBOL_FUNCTION (hare);
       if (!SYMBOLP (hare) || NILP (hare))
        break;
-      hare = XSYMBOL (hare)->function;
+      hare = SYMBOL_FUNCTION (hare);
 
-      tortoise = XSYMBOL (tortoise)->function;
+      tortoise = SYMBOL_FUNCTION (tortoise);
 
       if (EQ (hare, tortoise))
        xsignal1 (Qcyclic_function_indirection, object);
@@ -2109,7 +2112,7 @@ function chain of symbols.  */)
   /* Optimize for no indirection.  */
   result = object;
   if (SYMBOLP (result) && !NILP (result)
-      && (result = XSYMBOL (result)->function, SYMBOLP (result)))
+      && (result = SYMBOL_FUNCTION (result), SYMBOLP (result)))
     result = indirect_function (result);
   if (!NILP (result))
     return result;
@@ -3552,7 +3555,7 @@ syms_of_data (void)
   DEFSYM (Qinteractive_form, "interactive-form");
   DEFSYM (Qdefalias_fset_function, "defalias-fset-function");
 
-  set_symbol_function (Qwholenump, XSYMBOL (Qnatnump)->function);
+  set_symbol_function (Qwholenump, SYMBOL_FUNCTION (Qnatnump));
 
   DEFVAR_LISP ("most-positive-fixnum", Vmost_positive_fixnum,
               doc: /* The largest value that is representable in a Lisp integer.  */);