aboutsummaryrefslogtreecommitdiffstats
path: root/src/composite.c
diff options
context:
space:
mode:
authorDmitry Antipov2014-06-17 07:14:00 +0400
committerDmitry Antipov2014-06-17 07:14:00 +0400
commit9dc774d4792633e32b3a2e583d6591faa721e637 (patch)
tree374dc5f254d18ec80eba68cefd8ecdaa43d89597 /src/composite.c
parent64e104891f14070bccd1bae0b6da8f2d7091a3f1 (diff)
downloademacs-9dc774d4792633e32b3a2e583d6591faa721e637.tar.gz
emacs-9dc774d4792633e32b3a2e583d6591faa721e637.zip
* fileio.c (Fread_file_name): Do not pass redundant args and ...
* callint.c (read_file_name): ... convert to static here. * lisp.h (Fread_file_name): Do not EXFUN it. * composite.c (CHAR_COMPOSABLE_P): Replace unsafe macro with ... (char_composable_p): ... static function. All users changed.
Diffstat (limited to 'src/composite.c')
-rw-r--r--src/composite.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/src/composite.c b/src/composite.c
index fa882141908..5e14ad037a6 100644
--- a/src/composite.c
+++ b/src/composite.c
@@ -921,17 +921,18 @@ autocmp_chars (Lisp_Object rule, ptrdiff_t charpos, ptrdiff_t bytepos,
921 return unbind_to (count, lgstring); 921 return unbind_to (count, lgstring);
922} 922}
923 923
924static Lisp_Object _work_val;
925
926/* 1 iff the character C is composable. Characters of general 924/* 1 iff the character C is composable. Characters of general
927 category Z? or C? are not composable except for ZWNJ and ZWJ. */ 925 category Z? or C? are not composable except for ZWNJ and ZWJ. */
928 926
929#define CHAR_COMPOSABLE_P(C) \ 927static bool
930 ((C) > ' ' \ 928char_composable_p (int c)
931 && ((C) == 0x200C || (C) == 0x200D \ 929{
932 || (_work_val = CHAR_TABLE_REF (Vunicode_category_table, (C)), \ 930 Lisp_Object val;
933 (INTEGERP (_work_val) \ 931 return (c > ' '
934 && (XINT (_work_val) <= UNICODE_CATEGORY_So))))) 932 && (c == 0x200C || c == 0x200D
933 || (val = CHAR_TABLE_REF (Vunicode_category_table, c),
934 (INTEGERP (val) && (XINT (val) <= UNICODE_CATEGORY_So)))));
935}
935 936
936/* Update cmp_it->stop_pos to the next position after CHARPOS (and 937/* Update cmp_it->stop_pos to the next position after CHARPOS (and
937 BYTEPOS) where character composition may happen. If BYTEPOS is 938 BYTEPOS) where character composition may happen. If BYTEPOS is
@@ -1067,7 +1068,7 @@ composition_compute_stop_pos (struct composition_it *cmp_it, ptrdiff_t charpos,
1067 p = SDATA (string) + bytepos; 1068 p = SDATA (string) + bytepos;
1068 c = STRING_CHAR_AND_LENGTH (p, len); 1069 c = STRING_CHAR_AND_LENGTH (p, len);
1069 limit = bytepos + len; 1070 limit = bytepos + len;
1070 while (CHAR_COMPOSABLE_P (c)) 1071 while (char_composable_p (c))
1071 { 1072 {
1072 val = CHAR_TABLE_REF (Vcomposition_function_table, c); 1073 val = CHAR_TABLE_REF (Vcomposition_function_table, c);
1073 if (! NILP (val)) 1074 if (! NILP (val))
@@ -1144,7 +1145,7 @@ composition_compute_stop_pos (struct composition_it *cmp_it, ptrdiff_t charpos,
1144 /* Skip all uncomposable characters. */ 1145 /* Skip all uncomposable characters. */
1145 if (NILP (string)) 1146 if (NILP (string))
1146 { 1147 {
1147 while (charpos - 1 > endpos && ! CHAR_COMPOSABLE_P (c)) 1148 while (charpos - 1 > endpos && ! char_composable_p (c))
1148 { 1149 {
1149 DEC_BOTH (charpos, bytepos); 1150 DEC_BOTH (charpos, bytepos);
1150 c = FETCH_MULTIBYTE_CHAR (bytepos); 1151 c = FETCH_MULTIBYTE_CHAR (bytepos);
@@ -1152,7 +1153,7 @@ composition_compute_stop_pos (struct composition_it *cmp_it, ptrdiff_t charpos,
1152 } 1153 }
1153 else 1154 else
1154 { 1155 {
1155 while (charpos - 1 > endpos && ! CHAR_COMPOSABLE_P (c)) 1156 while (charpos - 1 > endpos && ! char_composable_p (c))
1156 { 1157 {
1157 p--; 1158 p--;
1158 while (! CHAR_HEAD_P (*p)) 1159 while (! CHAR_HEAD_P (*p))
@@ -1486,7 +1487,7 @@ find_automatic_composition (ptrdiff_t pos, ptrdiff_t limit,
1486 |-B-|-C-|--D--| 1487 |-B-|-C-|--D--|
1487 1488
1488 Here, it is known that characters after positions 1 and 9 can 1489 Here, it is known that characters after positions 1 and 9 can
1489 never be composed (i.e. ! CHAR_COMPOSABLE_P (CH)), and 1490 never be composed (i.e. ! char_composable_p (CH)), and
1490 composition A is an invalid one because it's partially covered by 1491 composition A is an invalid one because it's partially covered by
1491 the valid composition C. And to know whether a composition is 1492 the valid composition C. And to know whether a composition is
1492 valid or not, the only way is to start searching forward from a 1493 valid or not, the only way is to start searching forward from a
@@ -1510,7 +1511,7 @@ find_automatic_composition (ptrdiff_t pos, ptrdiff_t limit,
1510 while (1) 1511 while (1)
1511 { 1512 {
1512 c = STRING_CHAR (cur.p); 1513 c = STRING_CHAR (cur.p);
1513 if (! CHAR_COMPOSABLE_P (c)) 1514 if (! char_composable_p (c))
1514 { 1515 {
1515 if (limit <= pos) /* case (1) */ 1516 if (limit <= pos) /* case (1) */
1516 { 1517 {
@@ -1519,7 +1520,7 @@ find_automatic_composition (ptrdiff_t pos, ptrdiff_t limit,
1519 return 0; 1520 return 0;
1520 BACKWARD_CHAR (cur, stop); 1521 BACKWARD_CHAR (cur, stop);
1521 c = STRING_CHAR (cur.p); 1522 c = STRING_CHAR (cur.p);
1522 } while (! CHAR_COMPOSABLE_P (c)); 1523 } while (! char_composable_p (c));
1523 fore_check_limit = cur.pos + 1; 1524 fore_check_limit = cur.pos + 1;
1524 } 1525 }
1525 else /* case (2) */ 1526 else /* case (2) */
@@ -1535,7 +1536,7 @@ find_automatic_composition (ptrdiff_t pos, ptrdiff_t limit,
1535 prev = cur; 1536 prev = cur;
1536 BACKWARD_CHAR (cur, stop); 1537 BACKWARD_CHAR (cur, stop);
1537 c = STRING_CHAR (cur.p); 1538 c = STRING_CHAR (cur.p);
1538 if (! CHAR_COMPOSABLE_P (c)) 1539 if (! char_composable_p (c))
1539 { 1540 {
1540 cur = prev; 1541 cur = prev;
1541 break; 1542 break;