]> git.eshelyaron.com Git - emacs.git/commitdiff
* composite.h (COMPOSITION_DECODE_REFS): New macro,
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 4 Apr 2011 19:46:32 +0000 (12:46 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 4 Apr 2011 19:46:32 +0000 (12:46 -0700)
breaking out part of COMPOSITION_DECODE_RULE.
(COMPOSITION_DECODE_RULE): Use it.
* composite.c (get_composition_id): Remove unused local vars,
by using the new macro.

src/ChangeLog
src/composite.c
src/composite.h

index 5c5d72c89cb81e56161cbd7f9c34754d0c2315f7..4b029374f830206728d05e668b46d503383a702d 100644 (file)
@@ -1,5 +1,11 @@
 2011-04-04  Paul Eggert  <eggert@cs.ucla.edu>
 
+       * composite.h (COMPOSITION_DECODE_REFS): New macro,
+       breaking out part of COMPOSITION_DECODE_RULE.
+       (COMPOSITION_DECODE_RULE): Use it.
+       * composite.c (get_composition_id): Remove unused local vars,
+       by using the new macro.
+
        * textprop.c (set_text_properties_1): Change while to do-while,
        since the condition is always true at first.
 
index bc5644a4612477bff62fe14e16827afebb889280..af642ad9a72d89fa8932b17d354d7e42436e809e 100644 (file)
@@ -354,7 +354,7 @@ get_composition_id (EMACS_INT charpos, EMACS_INT bytepos, EMACS_INT nchars,
 
       for (i = 1; i < glyph_len; i += 2)
        {
-         int rule, gref, nref, xoff, yoff;
+         int rule, gref, nref;
          int this_width;
          float this_left;
 
@@ -376,7 +376,7 @@ get_composition_id (EMACS_INT charpos, EMACS_INT bytepos, EMACS_INT nchars,
                |       |
                6---7---8 -- descent
          */
-         COMPOSITION_DECODE_RULE (rule, gref, nref, xoff, yoff);
+         COMPOSITION_DECODE_REFS (rule, gref, nref);
          this_left = (leftmost
                       + (gref % 3) * (rightmost - leftmost) / 2.0
                       - (nref % 3) * this_width / 2.0);
index b8943fbfdc32cceb0e96d8f9e56a1ed4a5d20d8b..fa8e1164e4a52537a1a8d305ff13bc75d749f0ed 100644 (file)
@@ -126,21 +126,28 @@ extern Lisp_Object composition_temp;
        ->contents[(n) * 2 - 1])
 
 /* Decode encoded composition rule RULE_CODE into GREF (global
-   reference point code), NREF (new reference point code), XOFF
-   (horizontal offset) YOFF (vertical offset).  Don't check RULE_CODE,
+   reference point code), NREF (new ref. point code).  Don't check RULE_CODE;
    always set GREF and NREF to valid values.  By side effect,
    RULE_CODE is modified.  */
 
-#define COMPOSITION_DECODE_RULE(rule_code, gref, nref, xoff, yoff)     \
+#define COMPOSITION_DECODE_REFS(rule_code, gref, nref)                 \
   do {                                                                 \
-    xoff = (rule_code) >> 16;                                          \
-    yoff = ((rule_code) >> 8) & 0xFF;                                  \
     rule_code &= 0xFF;                                                 \
     gref = (rule_code) / 12;                                           \
     if (gref > 12) gref = 11;                                          \
     nref = (rule_code) % 12;                                           \
   } while (0)
 
+/* Like COMPOSITION_DECODE_REFS (RULE_CODE, GREF, NREF), but also
+   decode RULE_CODE into XOFF and YOFF (vertical offset).  */
+
+#define COMPOSITION_DECODE_RULE(rule_code, gref, nref, xoff, yoff)     \
+  do {                                                                 \
+    xoff = (rule_code) >> 16;                                          \
+    yoff = ((rule_code) >> 8) & 0xFF;                                  \
+    COMPOSITION_DECODE_REFS (rule_code, gref, nref);                   \
+  } while (0)
+
 /* Return encoded composition rule for the pair of global reference
    point GREF and new reference point NREF.  If arguments are invalid,
    return -1. */
@@ -281,7 +288,7 @@ enum lglyph_indices
     else                                                               \
       ASET ((g), LGLYPH_IX_CODE, make_number (val));                   \
   } while (0)
-      
+
 #define LGLYPH_SET_WIDTH(g, val) ASET ((g), LGLYPH_IX_WIDTH, make_number (val))
 #define LGLYPH_SET_LBEARING(g, val) ASET ((g), LGLYPH_IX_LBEARING, make_number (val))
 #define LGLYPH_SET_RBEARING(g, val) ASET ((g), LGLYPH_IX_RBEARING, make_number (val))
@@ -321,4 +328,3 @@ extern EMACS_INT composition_adjust_point (EMACS_INT, EMACS_INT);
 EXFUN (Fcomposition_get_gstring, 4);
 
 #endif /* not EMACS_COMPOSITE_H */
-