use #nil and #t
[bpt/emacs.git] / src / lisp.h
index 3d5e7be..0143506 100644 (file)
@@ -297,13 +297,14 @@ DEFINE_GDB_SYMBOL_END (USE_LSB_TAG)
 #define lisp_h_INTEGERP(x) (SCM_I_INUMP (x))
 #define lisp_h_MARKERP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Marker)
 #define lisp_h_MISCP(x) (SMOB_TYPEP (x, lisp_misc_tag))
-#define lisp_h_NILP(x) EQ (x, Qnil)
+#define lisp_h_NILP(x) (scm_is_lisp_false (x))
 #define lisp_h_SET_SYMBOL_VAL(sym, v) \
    (eassert ((sym)->redirect == SYMBOL_PLAINVAL), (sym)->val.value = (v))
 #define lisp_h_SYMBOL_CONSTANT_P(sym) (XSYMBOL (sym)->constant)
 #define lisp_h_SYMBOL_VAL(sym) \
    (eassert ((sym)->redirect == SYMBOL_PLAINVAL), (sym)->val.value)
-#define lisp_h_SYMBOLP(x) (x && scm_is_symbol (x))
+#define lisp_h_SYMBOLP(x) \
+  (x && (scm_is_symbol (x) || EQ (x, Qnil) || EQ (x, Qt)))
 #define lisp_h_VECTORLIKEP(x) (SMOB_TYPEP (x, lisp_vectorlike_tag))
 #define lisp_h_XCAR(c) (scm_car (c))
 #define lisp_h_XCDR(c) (scm_cdr (c))
@@ -649,11 +650,14 @@ INLINE Lisp_Object build_string (const char *);
 extern Lisp_Object symbol_module;
 extern Lisp_Object function_module;
 extern Lisp_Object plist_module;
+extern Lisp_Object Qt, Qnil, Qt_, Qnil_;
 
 INLINE struct Lisp_Symbol *
 XSYMBOL (Lisp_Object a)
 {
   Lisp_Object tem;
+  if (EQ (a, Qt)) a = Qt_;
+  if (EQ (a, Qnil)) a = Qnil_;
   eassert (SYMBOLP (a));
   tem = scm_variable_ref (scm_module_lookup (symbol_module, a));
   return scm_to_pointer (tem);
@@ -1373,6 +1377,8 @@ SET_SYMBOL_FWD (struct Lisp_Symbol *sym, union Lisp_Fwd *v)
 INLINE Lisp_Object
 SYMBOL_NAME (Lisp_Object sym)
 {
+  if (EQ (sym, Qnil)) sym = Qnil_;
+  if (EQ (sym, Qt)) sym = Qt_;
   return build_string (scm_to_locale_string (scm_symbol_to_string (sym)));
 }
 
@@ -1381,12 +1387,16 @@ SYMBOL_NAME (Lisp_Object sym)
 INLINE bool
 SYMBOL_INTERNED_P (Lisp_Object sym)
 {
+  if (EQ (sym, Qnil)) sym = Qnil_;
+  if (EQ (sym, Qt)) sym = Qt_;
   return scm_is_true (scm_symbol_interned_p (sym));
 }
 
 INLINE Lisp_Object
 SYMBOL_FUNCTION (Lisp_Object sym)
 {
+  if (EQ (sym, Qnil)) sym = Qnil_;
+  if (EQ (sym, Qt)) sym = Qt_;
   return scm_variable_ref (scm_module_lookup (function_module, sym));
 }
 
@@ -2734,18 +2744,24 @@ set_hash_value_slot (struct Lisp_Hash_Table *h, ptrdiff_t idx, Lisp_Object val)
 INLINE void
 set_symbol_function (Lisp_Object sym, Lisp_Object function)
 {
+  if (EQ (sym, Qnil)) sym = Qnil_;
+  if (EQ (sym, Qt)) sym = Qt_;
   scm_variable_set_x (scm_module_lookup (function_module, sym), function);
 }
 
 INLINE Lisp_Object
 symbol_plist (Lisp_Object sym)
 {
+  if (EQ (sym, Qnil)) sym = Qnil_;
+  if (EQ (sym, Qt)) sym = Qt_;
   return scm_variable_ref (scm_module_lookup (plist_module, sym));
 }
 
 INLINE void
 set_symbol_plist (Lisp_Object sym, Lisp_Object plist)
 {
+  if (EQ (sym, Qnil)) sym = Qnil_;
+  if (EQ (sym, Qt)) sym = Qt_;
   scm_variable_set_x (scm_module_lookup (plist_module, sym), plist);
 }
 
@@ -2819,6 +2835,7 @@ set_sub_char_table_contents (Lisp_Object table, ptrdiff_t idx, Lisp_Object val)
 }
 
 /* Defined in data.c.  */
+extern Lisp_Object Qnil_, Qt_;
 extern Lisp_Object Qquote, Qunbound;
 extern Lisp_Object Qerror_conditions, Qerror_message, Qtop_level;
 extern Lisp_Object Qerror, Qquit, Qargs_out_of_range;