aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggert2011-04-04 12:46:32 -0700
committerPaul Eggert2011-04-04 12:46:32 -0700
commitb13a45c6f92b2489ddd16ba2af9f19ebf46d3a2a (patch)
treeef4d445ec413a6638c438b5952a617dc57ba322f
parent1e792e4d80f58bdb5b460518729eb0585b10f8d3 (diff)
downloademacs-b13a45c6f92b2489ddd16ba2af9f19ebf46d3a2a.tar.gz
emacs-b13a45c6f92b2489ddd16ba2af9f19ebf46d3a2a.zip
* 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.
-rw-r--r--src/ChangeLog6
-rw-r--r--src/composite.c4
-rw-r--r--src/composite.h20
3 files changed, 21 insertions, 9 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 5c5d72c89cb..4b029374f83 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,11 @@
12011-04-04 Paul Eggert <eggert@cs.ucla.edu> 12011-04-04 Paul Eggert <eggert@cs.ucla.edu>
2 2
3 * composite.h (COMPOSITION_DECODE_REFS): New macro,
4 breaking out part of COMPOSITION_DECODE_RULE.
5 (COMPOSITION_DECODE_RULE): Use it.
6 * composite.c (get_composition_id): Remove unused local vars,
7 by using the new macro.
8
3 * textprop.c (set_text_properties_1): Change while to do-while, 9 * textprop.c (set_text_properties_1): Change while to do-while,
4 since the condition is always true at first. 10 since the condition is always true at first.
5 11
diff --git a/src/composite.c b/src/composite.c
index bc5644a4612..af642ad9a72 100644
--- a/src/composite.c
+++ b/src/composite.c
@@ -354,7 +354,7 @@ get_composition_id (EMACS_INT charpos, EMACS_INT bytepos, EMACS_INT nchars,
354 354
355 for (i = 1; i < glyph_len; i += 2) 355 for (i = 1; i < glyph_len; i += 2)
356 { 356 {
357 int rule, gref, nref, xoff, yoff; 357 int rule, gref, nref;
358 int this_width; 358 int this_width;
359 float this_left; 359 float this_left;
360 360
@@ -376,7 +376,7 @@ get_composition_id (EMACS_INT charpos, EMACS_INT bytepos, EMACS_INT nchars,
376 | | 376 | |
377 6---7---8 -- descent 377 6---7---8 -- descent
378 */ 378 */
379 COMPOSITION_DECODE_RULE (rule, gref, nref, xoff, yoff); 379 COMPOSITION_DECODE_REFS (rule, gref, nref);
380 this_left = (leftmost 380 this_left = (leftmost
381 + (gref % 3) * (rightmost - leftmost) / 2.0 381 + (gref % 3) * (rightmost - leftmost) / 2.0
382 - (nref % 3) * this_width / 2.0); 382 - (nref % 3) * this_width / 2.0);
diff --git a/src/composite.h b/src/composite.h
index b8943fbfdc3..fa8e1164e4a 100644
--- a/src/composite.h
+++ b/src/composite.h
@@ -126,21 +126,28 @@ extern Lisp_Object composition_temp;
126 ->contents[(n) * 2 - 1]) 126 ->contents[(n) * 2 - 1])
127 127
128/* Decode encoded composition rule RULE_CODE into GREF (global 128/* Decode encoded composition rule RULE_CODE into GREF (global
129 reference point code), NREF (new reference point code), XOFF 129 reference point code), NREF (new ref. point code). Don't check RULE_CODE;
130 (horizontal offset) YOFF (vertical offset). Don't check RULE_CODE,
131 always set GREF and NREF to valid values. By side effect, 130 always set GREF and NREF to valid values. By side effect,
132 RULE_CODE is modified. */ 131 RULE_CODE is modified. */
133 132
134#define COMPOSITION_DECODE_RULE(rule_code, gref, nref, xoff, yoff) \ 133#define COMPOSITION_DECODE_REFS(rule_code, gref, nref) \
135 do { \ 134 do { \
136 xoff = (rule_code) >> 16; \
137 yoff = ((rule_code) >> 8) & 0xFF; \
138 rule_code &= 0xFF; \ 135 rule_code &= 0xFF; \
139 gref = (rule_code) / 12; \ 136 gref = (rule_code) / 12; \
140 if (gref > 12) gref = 11; \ 137 if (gref > 12) gref = 11; \
141 nref = (rule_code) % 12; \ 138 nref = (rule_code) % 12; \
142 } while (0) 139 } while (0)
143 140
141/* Like COMPOSITION_DECODE_REFS (RULE_CODE, GREF, NREF), but also
142 decode RULE_CODE into XOFF and YOFF (vertical offset). */
143
144#define COMPOSITION_DECODE_RULE(rule_code, gref, nref, xoff, yoff) \
145 do { \
146 xoff = (rule_code) >> 16; \
147 yoff = ((rule_code) >> 8) & 0xFF; \
148 COMPOSITION_DECODE_REFS (rule_code, gref, nref); \
149 } while (0)
150
144/* Return encoded composition rule for the pair of global reference 151/* Return encoded composition rule for the pair of global reference
145 point GREF and new reference point NREF. If arguments are invalid, 152 point GREF and new reference point NREF. If arguments are invalid,
146 return -1. */ 153 return -1. */
@@ -281,7 +288,7 @@ enum lglyph_indices
281 else \ 288 else \
282 ASET ((g), LGLYPH_IX_CODE, make_number (val)); \ 289 ASET ((g), LGLYPH_IX_CODE, make_number (val)); \
283 } while (0) 290 } while (0)
284 291
285#define LGLYPH_SET_WIDTH(g, val) ASET ((g), LGLYPH_IX_WIDTH, make_number (val)) 292#define LGLYPH_SET_WIDTH(g, val) ASET ((g), LGLYPH_IX_WIDTH, make_number (val))
286#define LGLYPH_SET_LBEARING(g, val) ASET ((g), LGLYPH_IX_LBEARING, make_number (val)) 293#define LGLYPH_SET_LBEARING(g, val) ASET ((g), LGLYPH_IX_LBEARING, make_number (val))
287#define LGLYPH_SET_RBEARING(g, val) ASET ((g), LGLYPH_IX_RBEARING, make_number (val)) 294#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);
321EXFUN (Fcomposition_get_gstring, 4); 328EXFUN (Fcomposition_get_gstring, 4);
322 329
323#endif /* not EMACS_COMPOSITE_H */ 330#endif /* not EMACS_COMPOSITE_H */
324