emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r109712: Setter macros for fontsets.


From: Dmitry Antipov
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r109712: Setter macros for fontsets.
Date: Tue, 21 Aug 2012 08:46:05 +0400
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 109712
committer: Dmitry Antipov <address@hidden>
branch nick: trunk
timestamp: Tue 2012-08-21 08:46:05 +0400
message:
  Setter macros for fontsets.
  * fontset.c (SET_FONTSET_ID, SET_FONTSET_NAME, SET_FONTSET_ASCII)
  (SET_FONTSET_BASE, SET_FONTSET_FRAME, SET_FONTSET_NOFONT_FACE)
  (SET_FONTSET_DEFAULT, SET_FONTSET_FALLBACK): New macros.
  Adjust users.
modified:
  src/ChangeLog
  src/fontset.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2012-08-20 23:57:35 +0000
+++ b/src/ChangeLog     2012-08-21 04:46:05 +0000
@@ -1,3 +1,11 @@
+2012-08-21  Dmitry Antipov  <address@hidden>
+
+       Setter macros for fontsets.
+       * fontset.c (SET_FONTSET_ID, SET_FONTSET_NAME, SET_FONTSET_ASCII)
+       (SET_FONTSET_BASE, SET_FONTSET_FRAME, SET_FONTSET_NOFONT_FACE)
+       (SET_FONTSET_DEFAULT, SET_FONTSET_FALLBACK): New macros.
+       Adjust users.
+
 2012-08-20  Glenn Morris  <address@hidden>
 
        * Makefile.in (emacs$(EXEEXT), bootstrap-emacs$(EXEEXT)):

=== modified file 'src/fontset.c'
--- a/src/fontset.c     2012-08-17 17:08:30 +0000
+++ b/src/fontset.c     2012-08-21 04:46:05 +0000
@@ -214,26 +214,46 @@
 #define FONTSET_FROM_ID(id) AREF (Vfontset_table, id)
 
 /* Macros to access special values of FONTSET.  */
-#define FONTSET_ID(fontset)            XCHAR_TABLE (fontset)->extras[0]
+
+#define FONTSET_ID(fontset) XCHAR_TABLE (fontset)->extras[0]
+#define SET_FONTSET_ID(fontset, id)            \
+  set_char_table_extras ((fontset), 0, (id))
 
 /* Macros to access special values of (base) FONTSET.  */
-#define FONTSET_NAME(fontset)          XCHAR_TABLE (fontset)->extras[1]
-#define FONTSET_ASCII(fontset)         XCHAR_TABLE (fontset)->extras[4]
-/* #define FONTSET_SPEC(fontset)       XCHAR_TABLE (fontset)->extras[5] */
+
+#define FONTSET_NAME(fontset) XCHAR_TABLE (fontset)->extras[1]
+#define SET_FONTSET_NAME(fontset, name)                \
+  set_char_table_extras ((fontset), 1, (name))
+
+#define FONTSET_ASCII(fontset) XCHAR_TABLE (fontset)->extras[4]
+#define SET_FONTSET_ASCII(fontset, ascii)      \
+  set_char_table_extras ((fontset), 4, (ascii))
 
 /* Macros to access special values of (realized) FONTSET.  */
-#define FONTSET_BASE(fontset)          XCHAR_TABLE (fontset)->extras[2]
-#define FONTSET_FRAME(fontset)         XCHAR_TABLE (fontset)->extras[3]
-/* #define FONTSET_OBJLIST(fontset)    XCHAR_TABLE (fontset)->extras[4] */
-#define FONTSET_NOFONT_FACE(fontset)   XCHAR_TABLE (fontset)->extras[5]
-/* #define FONTSET_REPERTORY(fontset)  XCHAR_TABLE (fontset)->extras[6] */
-#define FONTSET_DEFAULT(fontset)       XCHAR_TABLE (fontset)->extras[7]
+
+#define FONTSET_BASE(fontset) XCHAR_TABLE (fontset)->extras[2]
+#define SET_FONTSET_BASE(fontset, base)                \
+  set_char_table_extras ((fontset), 2, (base))
+
+#define FONTSET_FRAME(fontset) XCHAR_TABLE (fontset)->extras[3]
+#define SET_FONTSET_FRAME(fontset, frame)      \
+  set_char_table_extras ((fontset), 3, (frame))
+
+#define FONTSET_NOFONT_FACE(fontset) XCHAR_TABLE (fontset)->extras[5]
+#define SET_FONTSET_NOFONT_FACE(fontset, face) \
+  set_char_table_extras ((fontset), 5, (face))
+
+#define FONTSET_DEFAULT(fontset) XCHAR_TABLE (fontset)->extras[7]
+#define SET_FONTSET_DEFAULT(fontset, def)      \
+  set_char_table_extras ((fontset), 7, (def))
 
 /* For both base and realized fontset.  */
-#define FONTSET_FALLBACK(fontset)      XCHAR_TABLE (fontset)->extras[8]
-
-#define BASE_FONTSET_P(fontset)                (NILP (FONTSET_BASE (fontset)))
-
+
+#define FONTSET_FALLBACK(fontset) XCHAR_TABLE (fontset)->extras[8]
+#define SET_FONTSET_FALLBACK(fontset, fallback)                \
+  set_char_table_extras ((fontset), 8, (fallback))
+
+#define BASE_FONTSET_P(fontset) (NILP (FONTSET_BASE (fontset)))
 
 /* Macros for FONT-DEF and RFONT-DEF of fontset.  */
 #define FONT_DEF_NEW(font_def, font_spec, encoding, repertory) \
@@ -265,7 +285,7 @@
 #define RFONT_DEF_NEW(rfont_def, font_def)             \
   do {                                                 \
     (rfont_def) = Fmake_vector (make_number (4), Qnil);        \
-    ASET ((rfont_def), 1, (font_def));         \
+    ASET ((rfont_def), 1, (font_def));                 \
     RFONT_DEF_SET_SCORE ((rfont_def), 0);              \
   } while (0)
 
@@ -307,12 +327,13 @@
    replace with ELT, if ADD is `prepend', prepend ELT, otherwise,
    append ELT.  */
 
-#define FONTSET_ADD(fontset, range, elt, add)                               \
-  (NILP (add)                                                               \
-   ? (NILP (range)                                                          \
-      ? (FONTSET_FALLBACK (fontset) = Fmake_vector (make_number (1), (elt))) \
-      : Fset_char_table_range ((fontset), (range),                          \
-                              Fmake_vector (make_number (1), (elt))))       \
+#define FONTSET_ADD(fontset, range, elt, add)                          \
+  (NILP (add)                                                          \
+   ? (NILP (range)                                                     \
+      ? (SET_FONTSET_FALLBACK                                          \
+        (fontset, Fmake_vector (make_number (1), (elt))))              \
+      : Fset_char_table_range ((fontset), (range),                     \
+                              Fmake_vector (make_number (1), (elt))))  \
    : fontset_add ((fontset), (range), (elt), (add)))
 
 static Lisp_Object
@@ -341,8 +362,8 @@
   else
     {
       args[idx] = FONTSET_FALLBACK (fontset);
-      FONTSET_FALLBACK (fontset)
-       = NILP (args[idx]) ? args[1 - idx] : Fvconcat (2, args);
+      SET_FONTSET_FALLBACK
+       (fontset, NILP (args[idx]) ? args[1 - idx] : Fvconcat (2, args));
     }
   return Qnil;
 }
@@ -485,7 +506,7 @@
   if (c >= 0)
     char_table_set_range (fontset, from, to, font_group);
   else
-    FONTSET_FALLBACK (fontset) = font_group;
+    SET_FONTSET_FALLBACK (fontset, font_group);
   return font_group;
 }
 
@@ -720,8 +741,9 @@
   if (! EQ (base_fontset, Vdefault_fontset))
     {
       if (NILP (FONTSET_DEFAULT (fontset)))
-       FONTSET_DEFAULT (fontset)
-         = make_fontset (FONTSET_FRAME (fontset), Qnil, Vdefault_fontset);
+       SET_FONTSET_DEFAULT
+         (fontset,
+          make_fontset (FONTSET_FRAME (fontset), Qnil, Vdefault_fontset));
       FONT_DEFERRED_LOG ("default fontset: font for", make_number (c), Qnil);
       default_rfont_def
        = fontset_find_font (FONTSET_DEFAULT (fontset), c, face, id, 0);
@@ -781,16 +803,14 @@
 
   fontset = Fmake_char_table (Qfontset, Qnil);
 
-  FONTSET_ID (fontset) = make_number (id);
+  SET_FONTSET_ID (fontset, make_number (id));
   if (NILP (base))
-    {
-      FONTSET_NAME (fontset) = name;
-    }
+    SET_FONTSET_NAME (fontset, name);
   else
     {
-      FONTSET_NAME (fontset) = Qnil;
-      FONTSET_FRAME (fontset) = frame;
-      FONTSET_BASE (fontset) = base;
+      SET_FONTSET_NAME (fontset, Qnil);
+      SET_FONTSET_FRAME (fontset, frame);
+      SET_FONTSET_BASE (fontset, base);
     }
 
   ASET (Vfontset_table, id, fontset);
@@ -958,7 +978,7 @@
       else
        {
          face_id = face_for_font (f, Qnil, face);
-         FONTSET_NOFONT_FACE (fontset) = make_number (face_id);
+         SET_FONTSET_NOFONT_FACE (fontset, make_number (face_id));
        }
     }
   eassert (face_id >= 0);
@@ -1580,7 +1600,7 @@
       Lisp_Object tail, fr, alist;
       int fontset_id = XINT (FONTSET_ID (fontset));
 
-      FONTSET_ASCII (fontset) = fontname;
+      SET_FONTSET_ASCII (fontset, fontname);
       name = FONTSET_NAME (fontset);
       FOR_EACH_FRAME (tail, fr)
        {
@@ -1658,7 +1678,7 @@
       len = font_unparse_xlfd (font_spec, 0, xlfd, 256);
       if (len < 0)
        error ("Invalid fontset name (perhaps too long): %s", SDATA (name));
-      FONTSET_ASCII (fontset) = make_unibyte_string (xlfd, len);
+      SET_FONTSET_ASCII (fontset, make_unibyte_string (xlfd, len));
     }
   else
     {
@@ -1744,7 +1764,7 @@
     Fset_fontset_font (name, Qnil, font_spec, Qnil, Qnil);
   }
 
-  FONTSET_ASCII (fontset) = font_name;
+  SET_FONTSET_ASCII (fontset, font_name);
 
   return XINT (FONTSET_ID (fontset));
 }
@@ -2161,9 +2181,10 @@
 
   Vdefault_fontset = Fmake_char_table (Qfontset, Qnil);
   staticpro (&Vdefault_fontset);
-  FONTSET_ID (Vdefault_fontset) = make_number (0);
-  FONTSET_NAME (Vdefault_fontset)
-    = build_pure_c_string ("-*-*-*-*-*-*-*-*-*-*-*-*-fontset-default");
+  SET_FONTSET_ID (Vdefault_fontset, make_number (0));
+  SET_FONTSET_NAME 
+    (Vdefault_fontset,
+     build_pure_c_string ("-*-*-*-*-*-*-*-*-*-*-*-*-fontset-default"));
   ASET (Vfontset_table, 0, Vdefault_fontset);
   next_fontset_id = 1;
 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]