update.
[chise/xemacs-chise.git.1] / src / specifier.h
index bb6472d..918d06d 100644 (file)
@@ -152,9 +152,9 @@ struct specifier_methods
      name specifier_instance) to avoid creating "external"
      specification loops.
 
      name specifier_instance) to avoid creating "external"
      specification loops.
 
-     This method must presume that both INSTANTIATOR and MATCSPEC are
+     This method must presume that both INSTANTIATOR and MATCHSPEC are
      already validated by the corresponding validate_* methods, and
      already validated by the corresponding validate_* methods, and
-     may abort if they are invalid.
+     may ABORT if they are invalid.
 
      Return value is an instance, which is returned immediately to the
      caller, or Qunbound to continue instantiation lookup chain.
 
      Return value is an instance, which is returned immediately to the
      caller, or Qunbound to continue instantiation lookup chain.
@@ -235,7 +235,7 @@ struct Lisp_Specifier
   Lisp_Object fallback;
 
   /* type-specific extra data attached to a specifier */
   Lisp_Object fallback;
 
   /* type-specific extra data attached to a specifier */
-  char data[1];
+  max_align_t data[1];
 };
 typedef struct Lisp_Specifier Lisp_Specifier;
 
 };
 typedef struct Lisp_Specifier Lisp_Specifier;
 
@@ -261,15 +261,15 @@ DECLARE_LRECORD (specifier, Lisp_Specifier);
 
 /***** Defining new specifier types *****/
 
 
 /***** Defining new specifier types *****/
 
-#define specifier_data_offset (offsetof (Lisp_Specifier, data))
+#define specifier_data_offset offsetof (Lisp_Specifier, data)
 extern const struct lrecord_description specifier_empty_extra_description[];
 
 #ifdef ERROR_CHECK_TYPECHECK
 #define DECLARE_SPECIFIER_TYPE(type)                                   \
 extern struct specifier_methods * type##_specifier_methods;            \
 extern const struct lrecord_description specifier_empty_extra_description[];
 
 #ifdef ERROR_CHECK_TYPECHECK
 #define DECLARE_SPECIFIER_TYPE(type)                                   \
 extern struct specifier_methods * type##_specifier_methods;            \
-INLINE struct type##_specifier *                                       \
+INLINE_HEADER struct type##_specifier *                                        \
 error_check_##type##_specifier_data (Lisp_Specifier *sp);              \
 error_check_##type##_specifier_data (Lisp_Specifier *sp);              \
-INLINE struct type##_specifier *                                       \
+INLINE_HEADER struct type##_specifier *                                        \
 error_check_##type##_specifier_data (Lisp_Specifier *sp)               \
 {                                                                      \
   if (SPECIFIERP (sp->magic_parent))                                   \
 error_check_##type##_specifier_data (Lisp_Specifier *sp)               \
 {                                                                      \
   if (SPECIFIERP (sp->magic_parent))                                   \
@@ -282,9 +282,9 @@ error_check_##type##_specifier_data (Lisp_Specifier *sp)            \
   assert (SPECIFIER_TYPE_P (sp, type));                                        \
   return (struct type##_specifier *) sp->data;                         \
 }                                                                      \
   assert (SPECIFIER_TYPE_P (sp, type));                                        \
   return (struct type##_specifier *) sp->data;                         \
 }                                                                      \
-INLINE Lisp_Specifier *                                                        \
+INLINE_HEADER Lisp_Specifier *                                         \
 error_check_##type##_specifier_type (Lisp_Object obj);                 \
 error_check_##type##_specifier_type (Lisp_Object obj);                 \
-INLINE Lisp_Specifier *                                                        \
+INLINE_HEADER Lisp_Specifier *                                         \
 error_check_##type##_specifier_type (Lisp_Object obj)                  \
 {                                                                      \
   Lisp_Specifier *sp = XSPECIFIER (obj);                               \
 error_check_##type##_specifier_type (Lisp_Object obj)                  \
 {                                                                      \
   Lisp_Specifier *sp = XSPECIFIER (obj);                               \
@@ -293,24 +293,25 @@ error_check_##type##_specifier_type (Lisp_Object obj)                     \
 }                                                                      \
 DECLARE_NOTHING
 #else
 }                                                                      \
 DECLARE_NOTHING
 #else
-#define DECLARE_SPECIFIER_TYPE(type)                           \
+#define DECLARE_SPECIFIER_TYPE(type)                                   \
 extern struct specifier_methods * type##_specifier_methods
 #endif /* ERROR_CHECK_TYPECHECK */
 
 extern struct specifier_methods * type##_specifier_methods
 #endif /* ERROR_CHECK_TYPECHECK */
 
-#define DEFINE_SPECIFIER_TYPE(type)                    \
+#define DEFINE_SPECIFIER_TYPE(type)                                    \
 struct specifier_methods * type##_specifier_methods
 
 struct specifier_methods * type##_specifier_methods
 
-#define INITIALIZE_SPECIFIER_TYPE(type, obj_name, pred_sym) do {       \
-  type##_specifier_methods = xnew_and_zero (struct specifier_methods); \
-  type##_specifier_methods->name = obj_name;                           \
-  type##_specifier_methods->extra_description =                                \
-    specifier_empty_extra_description;                                 \
+#define INITIALIZE_SPECIFIER_TYPE(type, obj_name, pred_sym) do {               \
+  type##_specifier_methods = xnew_and_zero (struct specifier_methods);         \
+  type##_specifier_methods->name = obj_name;                                   \
+  type##_specifier_methods->extra_description =                                        \
+    specifier_empty_extra_description;                                         \
   defsymbol_nodump (&type##_specifier_methods->predicate_symbol, pred_sym);    \
   defsymbol_nodump (&type##_specifier_methods->predicate_symbol, pred_sym);    \
-  add_entry_to_specifier_type_list (Q##type, type##_specifier_methods);        \
-  dumpstruct (&type##_specifier_methods, &specifier_methods_description); \
+  add_entry_to_specifier_type_list (Q##type, type##_specifier_methods);                \
+  dump_add_root_struct_ptr (&type##_specifier_methods,                         \
+                           &specifier_methods_description);                    \
 } while (0)
 
 } while (0)
 
-#define REINITIALIZE_SPECIFIER_TYPE(type) do { \
+#define REINITIALIZE_SPECIFIER_TYPE(type) do {                         \
   staticpro_nodump (&type##_specifier_methods->predicate_symbol);      \
 } while (0)
 
   staticpro_nodump (&type##_specifier_methods->predicate_symbol);      \
 } while (0)
 
@@ -366,7 +367,7 @@ do {                                                                        \
 # define XSETSPECIFIER_TYPE(x, p, type) XSETSPECIFIER (x, p)
 #endif /* ERROR_CHECK_TYPE_CHECK */
 
 # define XSETSPECIFIER_TYPE(x, p, type) XSETSPECIFIER (x, p)
 #endif /* ERROR_CHECK_TYPE_CHECK */
 
-#define SPECIFIER_TYPEP(x, type)                               \
+#define SPECIFIER_TYPEP(x, type)                       \
   (SPECIFIERP (x) && SPECIFIER_TYPE_P (XSPECIFIER (x), type))
 #define CHECK_SPECIFIER_TYPE(x, type) do {             \
   CHECK_SPECIFIER (x);                                 \
   (SPECIFIERP (x) && SPECIFIER_TYPE_P (XSPECIFIER (x), type))
 #define CHECK_SPECIFIER_TYPE(x, type) do {             \
   CHECK_SPECIFIER (x);                                 \
@@ -411,8 +412,51 @@ struct specifier_caching
   int offset_into_struct_frame;
   void (*value_changed_in_frame) (Lisp_Object specifier, struct frame *f,
                                  Lisp_Object oldval);
   int offset_into_struct_frame;
   void (*value_changed_in_frame) (Lisp_Object specifier, struct frame *f,
                                  Lisp_Object oldval);
+  int always_recompute;
 };
 
 };
 
+/* #### get image instances out of domains! */
+
+/* #### I think the following should ABORT() rather than return nil
+   when an invalid domain is given; much more likely we'll catch design
+   errors early. --ben */
+
+/* This turns out to be used heavily so we make it a macro to make it
+   inline.  Also, the majority of the time the object will turn out to
+   be a window so we move it from being checked last to being checked
+   first. */
+#define DOMAIN_DEVICE(obj)                                     \
+   (WINDOWP (obj) ? WINDOW_DEVICE (XWINDOW (obj))              \
+  : (FRAMEP  (obj) ? FRAME_DEVICE (XFRAME (obj))               \
+  : (DEVICEP (obj) ? obj                                       \
+  : (IMAGE_INSTANCEP (obj) ? image_instance_device (obj)       \
+  : Qnil))))
+
+#define DOMAIN_FRAME(obj)                              \
+   (WINDOWP (obj) ? WINDOW_FRAME (XWINDOW (obj))       \
+  : (FRAMEP  (obj) ? obj                               \
+  : (IMAGE_INSTANCEP (obj) ? image_instance_frame (obj)        \
+  : Qnil)))
+
+#define DOMAIN_WINDOW(obj)                                     \
+   (WINDOWP (obj) ? obj                                                \
+  : (IMAGE_INSTANCEP (obj) ? image_instance_window (obj)       \
+  : Qnil))
+
+#define DOMAIN_LIVE_P(obj)                                     \
+   (WINDOWP (obj) ? WINDOW_LIVE_P (XWINDOW (obj))              \
+  : (FRAMEP  (obj) ? FRAME_LIVE_P (XFRAME (obj))               \
+  : (DEVICEP (obj) ? DEVICE_LIVE_P (XDEVICE (obj))             \
+  : (IMAGE_INSTANCEP (obj) ? image_instance_live_p (obj)       \
+  : 0))))
+
+#define DOMAIN_XDEVICE(obj)                    \
+  (XDEVICE (DOMAIN_DEVICE (obj)))
+#define DOMAIN_XFRAME(obj)                     \
+  (XFRAME (DOMAIN_FRAME (obj)))
+#define DOMAIN_XWINDOW(obj)                    \
+  (XWINDOW (DOMAIN_WINDOW (obj)))
+
 EXFUN (Fcopy_specifier, 6);
 EXFUN (Fmake_specifier, 1);
 EXFUN (Fset_specifier_dirty_flag, 1);
 EXFUN (Fcopy_specifier, 6);
 EXFUN (Fmake_specifier, 1);
 EXFUN (Fset_specifier_dirty_flag, 1);
@@ -426,6 +470,7 @@ Lisp_Object decode_locale_list (Lisp_Object locale);
 extern enum spec_add_meth
 decode_how_to_add_specification (Lisp_Object how_to_add);
 Lisp_Object decode_specifier_tag_set (Lisp_Object tag_set);
 extern enum spec_add_meth
 decode_how_to_add_specification (Lisp_Object how_to_add);
 Lisp_Object decode_specifier_tag_set (Lisp_Object tag_set);
+Lisp_Object decode_domain (Lisp_Object domain);
 
 void add_entry_to_specifier_type_list (Lisp_Object symbol,
                                       struct specifier_methods *meths);
 
 void add_entry_to_specifier_type_list (Lisp_Object symbol,
                                       struct specifier_methods *meths);
@@ -437,7 +482,8 @@ void set_specifier_caching (Lisp_Object specifier,
                            int struct_frame_offset,
                            void (*value_changed_in_frame)
                            (Lisp_Object specifier, struct frame *f,
                            int struct_frame_offset,
                            void (*value_changed_in_frame)
                            (Lisp_Object specifier, struct frame *f,
-                            Lisp_Object oldval));
+                            Lisp_Object oldval),
+                           int always_recompute);
 void set_specifier_fallback (Lisp_Object specifier,
                             Lisp_Object fallback);
 void recompute_all_cached_specifiers_in_window (struct window *w);
 void set_specifier_fallback (Lisp_Object specifier,
                             Lisp_Object fallback);
 void recompute_all_cached_specifiers_in_window (struct window *w);