diff src/faces.h @ 5118:e0db3c197671 ben-lisp-object

merge up to latest default branch, doesn't compile yet
author Ben Wing <ben@xemacs.org>
date Sat, 26 Dec 2009 21:18:49 -0600
parents 3ef0aaf3dc34
children d1247f3cc363
line wrap: on
line diff
--- a/src/faces.h	Sat Dec 26 00:20:27 2009 -0600
+++ b/src/faces.h	Sat Dec 26 21:18:49 2009 -0600
@@ -25,6 +25,7 @@
 #define INCLUDED_faces_h_
 
 #include "charset.h" /* for NUM_LEADING_BYTES */
+#include "specifier.h"
 
 /* a Lisp_Face is the C object corresponding to a face.  There is one
    of these per face.  It basically contains all of the specifiers for
@@ -117,6 +118,9 @@
 typedef struct face_cachel face_cachel;
 struct face_cachel
 {
+#ifdef NEW_GC
+  struct lrecord_header header;
+#endif /* NEW_GC */
   /* There are two kinds of cachels; those created from a single face
      and those created by merging more than one face.  In the former
      case, the FACE element specifies the face used.  In the latter
@@ -161,7 +165,9 @@
      of them.  This avoids messing with Dynarrs.
 
      #### We should look into this and probably clean it up
-     to use Dynarrs.  This may be a big space hog as is. */
+     to use Dynarrs.  This may be a big space hog as is.
+     sjt sez: doesn't look like it, my total face cache is 170KB.
+     Could be reduced to maybe 50KB. */
   Lisp_Object font[NUM_LEADING_BYTES];
 
   Lisp_Object display_table;
@@ -176,8 +182,8 @@
 
   /* Used when merging to tell if the above field represents an actual
      value of this face or a fallback value. */
-  /* #### Of course we should use a bit array or something. */
-  unsigned char font_specified[NUM_LEADING_BYTES];
+  DECLARE_INLINE_LISP_BIT_VECTOR(NUM_LEADING_BYTES) font_specified;
+
   unsigned int foreground_specified :1;
   unsigned int background_specified :1;
   unsigned int display_table_specified :1;
@@ -218,11 +224,29 @@
      storing a "blank font" if the instantiation fails. */
   unsigned int dirty :1;
   unsigned int updated :1;
-  /* #### Of course we should use a bit array or something. */
-  unsigned char font_updated[NUM_LEADING_BYTES];
+
+  DECLARE_INLINE_LISP_BIT_VECTOR(NUM_LEADING_BYTES) font_updated; 
+
+  /* Whether the font for the charset in question was determined in the
+     "final stage"; that is, the last stage Lisp code could specify it,
+     after the initial stage and before the fallback. */ 
+  DECLARE_INLINE_LISP_BIT_VECTOR(NUM_LEADING_BYTES) font_final_stage; 
 };
 
-DECLARE_LRECORD (face, Lisp_Face);
+#ifdef NEW_GC
+typedef struct face_cachel Lisp_Face_Cachel;
+
+DECLARE_LISP_OBJECT (face_cachel, Lisp_Face_Cachel);
+
+#define XFACE_CACHEL(x) \
+  XRECORD (x, face_cachel, Lisp_Face_Cachel)
+#define wrap_face_cachel(p) wrap_record (p, face_cachel)
+#define FACE_CACHEL_P(x) RECORDP (x, face_cachel)
+#define CHECK_FACE_CACHEL(x) CHECK_RECORD (x, face_cachel)
+#define CONCHECK_FACE_CACHEL(x) CONCHECK_RECORD (x, face_cachel)
+#endif /* NEW_GC */
+
+DECLARE_LISP_OBJECT (face, Lisp_Face);
 #define XFACE(x) XRECORD (x, face, Lisp_Face)
 #define wrap_face(p) wrap_record (p, face)
 #define FACEP(x) RECORDP (x, face)
@@ -247,6 +271,10 @@
 void reset_face_cachels (struct window *w);
 face_index get_builtin_face_cache_index (struct window *w,
 					 Lisp_Object face);
+/* WARNING: this interface may change. */
+face_index merge_face_list_to_cache_index (struct window *w,
+					   Lisp_Object *face_list, int count);
+
 #ifdef MEMORY_USAGE_STATS
 int compute_face_cachel_usage (face_cachel_dynarr *face_cachels,
 			       struct overhead_stats *ovstats);
@@ -281,6 +309,13 @@
 #define FACE_CACHEL_FONT(cachel, charset) \
   (cachel->font[XCHARSET_LEADING_BYTE (charset) - MIN_LEADING_BYTE])
 
+#define FACE_CACHEL_FONT_UPDATED(x)			\
+  ((struct Lisp_Bit_Vector *)(&((x)->font_updated)))
+#define FACE_CACHEL_FONT_SPECIFIED(x)			\
+  ((struct Lisp_Bit_Vector *)(&((x)->font_specified)))
+#define FACE_CACHEL_FONT_FINAL_STAGE(x)			\
+  ((struct Lisp_Bit_Vector *)(&((x)->font_final_stage)))
+
 #define WINDOW_FACE_CACHEL(window, index) \
   Dynarr_atp ((window)->face_cachels, index)
 
@@ -330,13 +365,15 @@
   FACE_PROPERTY_INSTANCE_1 (face, property, domain, ERROR_ME_DEBUG_WARN, \
 			    no_fallback, depth)
 
-Lisp_Object face_property_matching_instance (Lisp_Object face,
-					     Lisp_Object property,
-					     Lisp_Object charset,
-					     Lisp_Object domain,
-					     Error_Behavior errb,
-					     int no_fallback,
-					     Lisp_Object depth);
+Lisp_Object face_property_matching_instance
+			(Lisp_Object face,
+			 Lisp_Object property,
+			 Lisp_Object charset,
+			 Lisp_Object domain,
+			 Error_Behavior errb,
+			 int no_fallback,
+			 Lisp_Object depth,
+			 enum font_specifier_matchspec_stages stages);
 
 #define FACE_PROPERTY_SPEC_LIST(face, property, locale)			\
   Fspecifier_spec_list (FACE_PROPERTY_SPECIFIER (face, property),	\
@@ -349,9 +386,14 @@
   FACE_PROPERTY_INSTANCE (face, Qforeground, domain, 0, Qzero)
 #define FACE_BACKGROUND(face, domain)					\
   FACE_PROPERTY_INSTANCE (face, Qbackground, domain, 0, Qzero)
+
+/* Calling this function on the default face with the ASCII character set
+   may delete any X11 frames; see the code at the end of
+   x_find_charset_font. */
 #define FACE_FONT(face, domain, charset)				\
   face_property_matching_instance (face, Qfont, charset, domain,	\
-				   ERROR_ME_DEBUG_WARN, 0, Qzero)
+				   ERROR_ME_DEBUG_WARN, 0, Qzero,	\
+				   initial)
 #define FACE_DISPLAY_TABLE(face, domain)				\
   FACE_PROPERTY_INSTANCE (face, Qdisplay_table, domain, 0, Qzero)
 #define FACE_BACKGROUND_PIXMAP(face, domain)				\