X-Git-Url: http://git.hcoop.net/bpt/emacs.git/blobdiff_plain/e4dd8d122ea7e841d09a8b9312187f0190a84047..738800001d32d8931b0c9548c5da2247bfed3d9a:/src/data.c diff --git a/src/data.c b/src/data.c index 6d329f59b3..426bae133a 100644 --- a/src/data.c +++ b/src/data.c @@ -38,6 +38,7 @@ along with GNU Emacs. If not, see . */ #include "keymap.h" Lisp_Object Qnil, Qt, Qquote, Qlambda, Qunbound; +Lisp_Object Qnil_, Qt_; static Lisp_Object Qsubr; Lisp_Object Qerror_conditions, Qerror_message, Qtop_level; Lisp_Object Qerror, Quser_error, Qquit, Qargs_out_of_range; @@ -244,21 +245,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 +265,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 +295,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 +348,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 +656,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 +688,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 +696,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 +717,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 +760,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 +2084,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 +2113,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; @@ -3383,6 +3387,8 @@ syms_of_data (void) { Lisp_Object error_tail, arith_tail; +#include "data.x" + DEFSYM (Qquote, "quote"); DEFSYM (Qlambda, "lambda"); DEFSYM (Qsubr, "subr"); @@ -3550,110 +3556,7 @@ syms_of_data (void) DEFSYM (Qinteractive_form, "interactive-form"); DEFSYM (Qdefalias_fset_function, "defalias-fset-function"); - defsubr (&Sindirect_variable); - defsubr (&Sinteractive_form); - defsubr (&Seq); - defsubr (&Snull); - defsubr (&Stype_of); - defsubr (&Slistp); - defsubr (&Snlistp); - defsubr (&Sconsp); - defsubr (&Satom); - defsubr (&Sintegerp); - defsubr (&Sinteger_or_marker_p); - defsubr (&Snumberp); - defsubr (&Snumber_or_marker_p); - defsubr (&Sfloatp); - defsubr (&Snatnump); - defsubr (&Ssymbolp); - defsubr (&Skeywordp); - defsubr (&Sstringp); - defsubr (&Smultibyte_string_p); - defsubr (&Svectorp); - defsubr (&Schar_table_p); - defsubr (&Svector_or_char_table_p); - defsubr (&Sbool_vector_p); - defsubr (&Sarrayp); - defsubr (&Ssequencep); - defsubr (&Sbufferp); - defsubr (&Smarkerp); - defsubr (&Ssubrp); - defsubr (&Sbyte_code_function_p); - defsubr (&Schar_or_string_p); - defsubr (&Scar); - defsubr (&Scdr); - defsubr (&Scar_safe); - defsubr (&Scdr_safe); - defsubr (&Ssetcar); - defsubr (&Ssetcdr); - defsubr (&Ssymbol_function); - defsubr (&Sindirect_function); - defsubr (&Ssymbol_plist); - defsubr (&Ssymbol_name); - defsubr (&Smakunbound); - defsubr (&Sfmakunbound); - defsubr (&Sboundp); - defsubr (&Sfboundp); - defsubr (&Sfset); - defsubr (&Sdefalias); - defsubr (&Ssetplist); - defsubr (&Ssymbol_value); - defsubr (&Sset); - defsubr (&Sdefault_boundp); - defsubr (&Sdefault_value); - defsubr (&Sset_default); - defsubr (&Ssetq_default); - defsubr (&Smake_variable_buffer_local); - defsubr (&Smake_local_variable); - defsubr (&Skill_local_variable); - defsubr (&Smake_variable_frame_local); - defsubr (&Slocal_variable_p); - defsubr (&Slocal_variable_if_set_p); - defsubr (&Svariable_binding_locus); -#if 0 /* XXX Remove this. --lorentey */ - defsubr (&Sterminal_local_value); - defsubr (&Sset_terminal_local_value); -#endif - defsubr (&Saref); - defsubr (&Saset); - defsubr (&Snumber_to_string); - defsubr (&Sstring_to_number); - defsubr (&Seqlsign); - defsubr (&Slss); - defsubr (&Sgtr); - defsubr (&Sleq); - defsubr (&Sgeq); - defsubr (&Sneq); - defsubr (&Splus); - defsubr (&Sminus); - defsubr (&Stimes); - defsubr (&Squo); - defsubr (&Srem); - defsubr (&Smod); - defsubr (&Smax); - defsubr (&Smin); - defsubr (&Slogand); - defsubr (&Slogior); - defsubr (&Slogxor); - defsubr (&Slsh); - defsubr (&Sash); - defsubr (&Sadd1); - defsubr (&Ssub1); - defsubr (&Slognot); - defsubr (&Sbyteorder); - defsubr (&Ssubr_arity); - defsubr (&Ssubr_name); - - defsubr (&Sbool_vector_exclusive_or); - defsubr (&Sbool_vector_union); - defsubr (&Sbool_vector_intersection); - defsubr (&Sbool_vector_set_difference); - defsubr (&Sbool_vector_not); - defsubr (&Sbool_vector_subsetp); - defsubr (&Sbool_vector_count_consecutive); - defsubr (&Sbool_vector_count_population); - - 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. */);