update.
[chise/xemacs-chise.git.1] / src / symeval.h
index 41e2324..141430b 100644 (file)
@@ -1,5 +1,6 @@
 /* Definitions of symbol-value forwarding for XEmacs Lisp interpreter.
    Copyright (C) 1985, 1986, 1987, 1992, 1993 Free Software Foundation, Inc.
+   Copyright (C) 2000 Ben Wing.
 
 This file is part of XEmacs.
 
@@ -30,7 +31,7 @@ enum symbol_value_type
 {
   /* The following tags use the 'symbol_value_forward' structure
      and are strictly for variables DEFVARed on the C level. */
-  SYMVAL_FIXNUM_FORWARD,       /* Forward C "int" */
+  SYMVAL_FIXNUM_FORWARD,       /* Forward C "Fixnum", really "EMACS_INT" */
   SYMVAL_CONST_FIXNUM_FORWARD, /* Same, but can't be set */
   SYMVAL_BOOLEAN_FORWARD,      /* Forward C boolean ("int") */
   SYMVAL_CONST_BOOLEAN_FORWARD,        /* Same, but can't be set */
@@ -69,19 +70,21 @@ enum symbol_value_type
 #endif
 };
 
+/* Underlying C type used to implement DEFVAR_INT */
+typedef EMACS_INT Fixnum;
+
 struct symbol_value_magic
 {
   struct lcrecord_header lcheader;
   void *value;
   enum symbol_value_type type;
 };
-#define SYMBOL_VALUE_MAGIC_P(x)                                \
-  (LRECORDP (x)                                                \
-   && (XRECORD_LHEADER_IMPLEMENTATION (x)->printer     \
-       == print_symbol_value_magic))
+#define SYMBOL_VALUE_MAGIC_P(x)                                                \
+(LRECORDP (x) &&                                                       \
+ XRECORD_LHEADER (x)->type <= lrecord_type_max_symbol_value_magic)
 #define XSYMBOL_VALUE_MAGIC_TYPE(v) \
        (((struct symbol_value_magic *) XPNTR (v))->type)
-#define XSETSYMBOL_VALUE_MAGIC(s, p) XSETOBJ (s, Lisp_Type_Record, p)
+#define XSETSYMBOL_VALUE_MAGIC(s, p) XSETOBJ (s, p)
 void print_symbol_value_magic (Lisp_Object, Lisp_Object, int);
 
 /********** The various different symbol-value-magic types ***********/
@@ -282,13 +285,38 @@ void defsubr (Lisp_Subr *);
 void defsubr_macro (Lisp_Subr *);
 #define DEFSUBR_MACRO(Fname) defsubr_macro (&S##Fname)
 
+void defsymbol_massage_name (Lisp_Object *location, const char *name);
+void defsymbol_massage_name_nodump (Lisp_Object *location, const char *name);
+void defsymbol_massage_multiword_predicate (Lisp_Object *location,
+                                           const char *name);
+void defsymbol_massage_multiword_predicate_nodump (Lisp_Object *location,
+                                                  const char *name);
 void defsymbol (Lisp_Object *location, const char *name);
 void defsymbol_nodump (Lisp_Object *location, const char *name);
 
+#define DEFSYMBOL(name) defsymbol_massage_name (&name, #name)
+#define DEFSYMBOL_NO_DUMP(name) defsymbol_massage_name_nodump (&name, #name)
+#define DEFSYMBOL_MULTIWORD_PREDICATE(name) \
+  defsymbol_massage_multiword_predicate (&name, #name)
+#define DEFSYMBOL_MULTIWORD_PREDICATE_NO_DUMP(name) \
+  defsymbol_massage_multiword_predicate_nodump (&name, #name)
+
 void defkeyword (Lisp_Object *location, const char *name);
+void defkeyword_massage_name (Lisp_Object *location, const char *name);
+#define DEFKEYWORD(name) defkeyword_massage_name (&name, #name)
 
 void deferror (Lisp_Object *symbol, const char *name,
               const char *message, Lisp_Object inherits_from);
+void deferror_massage_name (Lisp_Object *symbol, const char *name,
+                           const char *message, Lisp_Object inherits_from);
+void deferror_massage_name_and_message (Lisp_Object *symbol, const char *name,
+                                       Lisp_Object inherits_from);
+#define DEFERROR(name, message, inherits_from) \
+  deferror_massage_name (&name, #name, message, inherits_from)
+/* In this case, the error message is the same as the name, modulo some
+   prettifying */
+#define DEFERROR_STANDARD(name, inherits_from) \
+  deferror_massage_name_and_message (&name, #name, inherits_from)
 
 /* Macros we use to define forwarded Lisp variables.
    These are used in the syms_of_FILENAME functions.  */
@@ -296,15 +324,15 @@ void deferror (Lisp_Object *symbol, const char *name,
 void defvar_magic (const char *symbol_name, const struct symbol_value_forward *magic);
 
 #define DEFVAR_SYMVAL_FWD(lname, c_location, forward_type, magicfun) do {      \
-  static CONST_IF_NOT_DEBUG struct symbol_value_forward I_hate_C =             \
+  static const struct symbol_value_forward I_hate_C =                          \
   { /* struct symbol_value_forward */                                          \
     { /* struct symbol_value_magic */                                          \
       { /* struct lcrecord_header */                                           \
        { /* struct lrecord_header */                                           \
-         1, /* type - index into lrecord_implementations_table */              \
-         0, /* mark bit */                                                     \
-         0, /* c_readonly bit */                                               \
-         0  /* lisp_readonly bit */                                            \
+         lrecord_type_symbol_value_forward, /* lrecord_type_index */           \
+         1, /* mark bit */                                                     \
+         1, /* c_readonly bit */                                               \
+         1  /* lisp_readonly bit */                                            \
        },                                                                      \
        0, /* next */                                                           \
        0, /* uid  */                                                           \
@@ -320,13 +348,21 @@ void defvar_magic (const char *symbol_name, const struct symbol_value_forward *m
 
 #define DEFVAR_SYMVAL_FWD_INT(lname, c_location, forward_type, magicfun) do{   \
   DEFVAR_SYMVAL_FWD (lname, c_location, forward_type, magicfun);               \
-  dumpopaque (c_location, sizeof(int));                                                \
+  dump_add_opaque_int (c_location);                                            \
+} while (0)
+
+#define DEFVAR_SYMVAL_FWD_FIXNUM(lname, c_location, forward_type, magicfun) do{        \
+  DEFVAR_SYMVAL_FWD (lname, c_location, forward_type, magicfun);               \
+  dump_add_opaque_fixnum (c_location);                                         \
 } while (0)
 
-#define DEFVAR_SYMVAL_FWD_OBJECT(lname, c_location, forward_type, magicfun) do{ \
+#define DEFVAR_SYMVAL_FWD_OBJECT(lname, c_location, forward_type, magicfun) do{        \
   DEFVAR_SYMVAL_FWD (lname, c_location, forward_type, magicfun);               \
-  staticpro (c_location);                                                      \
-  if (EQ (*c_location, Qnull_pointer)) *c_location = Qnil;                     \
+  {                                                                            \
+    Lisp_Object *DSF_location = c_location; /* Type check */                   \
+    staticpro (DSF_location);                                                  \
+    if (EQ (*DSF_location, Qnull_pointer)) *DSF_location = Qnil;               \
+  }                                                                            \
 } while (0)
 
 #define DEFVAR_LISP(lname, c_location) \
@@ -336,9 +372,9 @@ void defvar_magic (const char *symbol_name, const struct symbol_value_forward *m
 #define DEFVAR_SPECIFIER(lname, c_location) \
        DEFVAR_SYMVAL_FWD_OBJECT (lname, c_location, SYMVAL_CONST_SPECIFIER_FORWARD, 0)
 #define DEFVAR_INT(lname, c_location) \
-       DEFVAR_SYMVAL_FWD_INT (lname, c_location, SYMVAL_FIXNUM_FORWARD, 0)
+       DEFVAR_SYMVAL_FWD_FIXNUM (lname, c_location, SYMVAL_FIXNUM_FORWARD, 0)
 #define DEFVAR_CONST_INT(lname, c_location) \
-       DEFVAR_SYMVAL_FWD_INT (lname, c_location, SYMVAL_CONST_FIXNUM_FORWARD, 0)
+       DEFVAR_SYMVAL_FWD_FIXNUM (lname, c_location, SYMVAL_CONST_FIXNUM_FORWARD, 0)
 #define DEFVAR_BOOL(lname, c_location) \
        DEFVAR_SYMVAL_FWD_INT (lname, c_location, SYMVAL_BOOLEAN_FORWARD, 0)
 #define DEFVAR_CONST_BOOL(lname, c_location) \
@@ -346,8 +382,10 @@ void defvar_magic (const char *symbol_name, const struct symbol_value_forward *m
 #define DEFVAR_LISP_MAGIC(lname, c_location, magicfun) \
        DEFVAR_SYMVAL_FWD_OBJECT (lname, c_location, SYMVAL_OBJECT_FORWARD, magicfun)
 #define DEFVAR_INT_MAGIC(lname, c_location, magicfun) \
-       DEFVAR_SYMVAL_FWD_INT (lname, c_location, SYMVAL_FIXNUM_FORWARD, magicfun)
+       DEFVAR_SYMVAL_FWD_FIXNUM (lname, c_location, SYMVAL_FIXNUM_FORWARD, magicfun)
 #define DEFVAR_BOOL_MAGIC(lname, c_location, magicfun) \
        DEFVAR_SYMVAL_FWD_INT (lname, c_location, SYMVAL_BOOLEAN_FORWARD, magicfun)
 
+void flush_all_buffer_local_cache (void);
+
 #endif /* INCLUDED_symeval_h_ */