diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 7 | ||||
| -rw-r--r-- | src/bidi.c | 42 |
2 files changed, 28 insertions, 21 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 61d2f124935..27cc282145b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2010-04-19 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * bidi.c (bidi_get_type, bidi_get_category) | ||
| 4 | (bidi_at_paragraph_end, bidi_resolve_weak, bidi_resolve_neutral) | ||
| 5 | (bidi_type_of_next_char, bidi_level_of_next_char): Declare | ||
| 6 | static. Use `INLINE' rather than `inline'. | ||
| 7 | |||
| 1 | 2010-04-19 Juanma Barranquero <lekktu@gmail.com> | 8 | 2010-04-19 Juanma Barranquero <lekktu@gmail.com> |
| 2 | 9 | ||
| 3 | * dired.c (Ffile_attributes): Fix typo in docstring. | 10 | * dired.c (Ffile_attributes): Fix typo in docstring. |
diff --git a/src/bidi.c b/src/bidi.c index 6b51b54da2e..058daba3e5a 100644 --- a/src/bidi.c +++ b/src/bidi.c | |||
| @@ -418,7 +418,7 @@ bidi_initialize () | |||
| 418 | 418 | ||
| 419 | /* Return the bidi type of a character CH, subject to the current | 419 | /* Return the bidi type of a character CH, subject to the current |
| 420 | directional OVERRIDE. */ | 420 | directional OVERRIDE. */ |
| 421 | bidi_type_t | 421 | static INLINE bidi_type_t |
| 422 | bidi_get_type (int ch, bidi_dir_t override) | 422 | bidi_get_type (int ch, bidi_dir_t override) |
| 423 | { | 423 | { |
| 424 | bidi_type_t default_type; | 424 | bidi_type_t default_type; |
| @@ -469,7 +469,7 @@ bidi_check_type (bidi_type_t type) | |||
| 469 | } | 469 | } |
| 470 | 470 | ||
| 471 | /* Given a bidi TYPE of a character, return its category. */ | 471 | /* Given a bidi TYPE of a character, return its category. */ |
| 472 | bidi_category_t | 472 | static INLINE bidi_category_t |
| 473 | bidi_get_category (bidi_type_t type) | 473 | bidi_get_category (bidi_type_t type) |
| 474 | { | 474 | { |
| 475 | switch (type) | 475 | switch (type) |
| @@ -526,7 +526,7 @@ bidi_mirror_char (int c) | |||
| 526 | 526 | ||
| 527 | /* Copy the bidi iterator from FROM to TO. To save cycles, this only | 527 | /* Copy the bidi iterator from FROM to TO. To save cycles, this only |
| 528 | copies the part of the level stack that is actually in use. */ | 528 | copies the part of the level stack that is actually in use. */ |
| 529 | static inline void | 529 | static INLINE void |
| 530 | bidi_copy_it (struct bidi_it *to, struct bidi_it *from) | 530 | bidi_copy_it (struct bidi_it *to, struct bidi_it *from) |
| 531 | { | 531 | { |
| 532 | int i; | 532 | int i; |
| @@ -546,14 +546,14 @@ static struct bidi_it bidi_cache[1000]; /* FIXME: make this dynamically allocate | |||
| 546 | static int bidi_cache_idx; | 546 | static int bidi_cache_idx; |
| 547 | static int bidi_cache_last_idx; | 547 | static int bidi_cache_last_idx; |
| 548 | 548 | ||
| 549 | static inline void | 549 | static INLINE void |
| 550 | bidi_cache_reset (void) | 550 | bidi_cache_reset (void) |
| 551 | { | 551 | { |
| 552 | bidi_cache_idx = 0; | 552 | bidi_cache_idx = 0; |
| 553 | bidi_cache_last_idx = -1; | 553 | bidi_cache_last_idx = -1; |
| 554 | } | 554 | } |
| 555 | 555 | ||
| 556 | static inline void | 556 | static INLINE void |
| 557 | bidi_cache_fetch_state (int idx, struct bidi_it *bidi_it) | 557 | bidi_cache_fetch_state (int idx, struct bidi_it *bidi_it) |
| 558 | { | 558 | { |
| 559 | int current_scan_dir = bidi_it->scan_dir; | 559 | int current_scan_dir = bidi_it->scan_dir; |
| @@ -570,7 +570,7 @@ bidi_cache_fetch_state (int idx, struct bidi_it *bidi_it) | |||
| 570 | level less or equal to LEVEL. if LEVEL is -1, disregard the | 570 | level less or equal to LEVEL. if LEVEL is -1, disregard the |
| 571 | resolved levels in cached states. DIR, if non-zero, means search | 571 | resolved levels in cached states. DIR, if non-zero, means search |
| 572 | in that direction from the last cache hit. */ | 572 | in that direction from the last cache hit. */ |
| 573 | static inline int | 573 | static INLINE int |
| 574 | bidi_cache_search (int charpos, int level, int dir) | 574 | bidi_cache_search (int charpos, int level, int dir) |
| 575 | { | 575 | { |
| 576 | int i, i_start; | 576 | int i, i_start; |
| @@ -661,7 +661,7 @@ bidi_cache_find_level_change (int level, int dir, int before) | |||
| 661 | return -1; | 661 | return -1; |
| 662 | } | 662 | } |
| 663 | 663 | ||
| 664 | static inline void | 664 | static INLINE void |
| 665 | bidi_cache_iterator_state (struct bidi_it *bidi_it, int resolved) | 665 | bidi_cache_iterator_state (struct bidi_it *bidi_it, int resolved) |
| 666 | { | 666 | { |
| 667 | int idx; | 667 | int idx; |
| @@ -716,7 +716,7 @@ bidi_cache_iterator_state (struct bidi_it *bidi_it, int resolved) | |||
| 716 | bidi_cache_idx = idx + 1; | 716 | bidi_cache_idx = idx + 1; |
| 717 | } | 717 | } |
| 718 | 718 | ||
| 719 | static inline bidi_type_t | 719 | static INLINE bidi_type_t |
| 720 | bidi_cache_find (int charpos, int level, struct bidi_it *bidi_it) | 720 | bidi_cache_find (int charpos, int level, struct bidi_it *bidi_it) |
| 721 | { | 721 | { |
| 722 | int i = bidi_cache_search (charpos, level, bidi_it->scan_dir); | 722 | int i = bidi_cache_search (charpos, level, bidi_it->scan_dir); |
| @@ -736,7 +736,7 @@ bidi_cache_find (int charpos, int level, struct bidi_it *bidi_it) | |||
| 736 | return UNKNOWN_BT; | 736 | return UNKNOWN_BT; |
| 737 | } | 737 | } |
| 738 | 738 | ||
| 739 | static inline int | 739 | static INLINE int |
| 740 | bidi_peek_at_next_level (struct bidi_it *bidi_it) | 740 | bidi_peek_at_next_level (struct bidi_it *bidi_it) |
| 741 | { | 741 | { |
| 742 | if (bidi_cache_idx == 0 || bidi_cache_last_idx == -1) | 742 | if (bidi_cache_idx == 0 || bidi_cache_last_idx == -1) |
| @@ -749,7 +749,7 @@ bidi_peek_at_next_level (struct bidi_it *bidi_it) | |||
| 749 | following the buffer position, -1 if position is at the beginning | 749 | following the buffer position, -1 if position is at the beginning |
| 750 | of a new paragraph, or -2 if position is neither at beginning nor | 750 | of a new paragraph, or -2 if position is neither at beginning nor |
| 751 | at end of a paragraph. */ | 751 | at end of a paragraph. */ |
| 752 | EMACS_INT | 752 | static EMACS_INT |
| 753 | bidi_at_paragraph_end (EMACS_INT charpos, EMACS_INT bytepos) | 753 | bidi_at_paragraph_end (EMACS_INT charpos, EMACS_INT bytepos) |
| 754 | { | 754 | { |
| 755 | Lisp_Object sep_re = Fbuffer_local_value (Qparagraph_separate, | 755 | Lisp_Object sep_re = Fbuffer_local_value (Qparagraph_separate, |
| @@ -779,7 +779,7 @@ bidi_at_paragraph_end (EMACS_INT charpos, EMACS_INT bytepos) | |||
| 779 | embedding levels on either side of the run boundary. Also, update | 779 | embedding levels on either side of the run boundary. Also, update |
| 780 | the saved info about previously seen characters, since that info is | 780 | the saved info about previously seen characters, since that info is |
| 781 | generally valid for a single level run. */ | 781 | generally valid for a single level run. */ |
| 782 | static inline void | 782 | static INLINE void |
| 783 | bidi_set_sor_type (struct bidi_it *bidi_it, int level_before, int level_after) | 783 | bidi_set_sor_type (struct bidi_it *bidi_it, int level_before, int level_after) |
| 784 | { | 784 | { |
| 785 | int higher_level = level_before > level_after ? level_before : level_after; | 785 | int higher_level = level_before > level_after ? level_before : level_after; |
| @@ -960,7 +960,7 @@ bidi_paragraph_init (bidi_dir_t dir, struct bidi_it *bidi_it) | |||
| 960 | 960 | ||
| 961 | /* Do whatever UAX#9 clause X8 says should be done at paragraph's | 961 | /* Do whatever UAX#9 clause X8 says should be done at paragraph's |
| 962 | end. */ | 962 | end. */ |
| 963 | static inline void | 963 | static INLINE void |
| 964 | bidi_set_paragraph_end (struct bidi_it *bidi_it) | 964 | bidi_set_paragraph_end (struct bidi_it *bidi_it) |
| 965 | { | 965 | { |
| 966 | bidi_it->invalid_levels = 0; | 966 | bidi_it->invalid_levels = 0; |
| @@ -1002,7 +1002,7 @@ bidi_init_it (EMACS_INT charpos, EMACS_INT bytepos, struct bidi_it *bidi_it) | |||
| 1002 | 1002 | ||
| 1003 | /* Push the current embedding level and override status; reset the | 1003 | /* Push the current embedding level and override status; reset the |
| 1004 | current level to LEVEL and the current override status to OVERRIDE. */ | 1004 | current level to LEVEL and the current override status to OVERRIDE. */ |
| 1005 | static inline void | 1005 | static INLINE void |
| 1006 | bidi_push_embedding_level (struct bidi_it *bidi_it, | 1006 | bidi_push_embedding_level (struct bidi_it *bidi_it, |
| 1007 | int level, bidi_dir_t override) | 1007 | int level, bidi_dir_t override) |
| 1008 | { | 1008 | { |
| @@ -1015,7 +1015,7 @@ bidi_push_embedding_level (struct bidi_it *bidi_it, | |||
| 1015 | 1015 | ||
| 1016 | /* Pop the embedding level and directional override status from the | 1016 | /* Pop the embedding level and directional override status from the |
| 1017 | stack, and return the new level. */ | 1017 | stack, and return the new level. */ |
| 1018 | static inline int | 1018 | static INLINE int |
| 1019 | bidi_pop_embedding_level (struct bidi_it *bidi_it) | 1019 | bidi_pop_embedding_level (struct bidi_it *bidi_it) |
| 1020 | { | 1020 | { |
| 1021 | /* UAX#9 says to ignore invalid PDFs. */ | 1021 | /* UAX#9 says to ignore invalid PDFs. */ |
| @@ -1025,7 +1025,7 @@ bidi_pop_embedding_level (struct bidi_it *bidi_it) | |||
| 1025 | } | 1025 | } |
| 1026 | 1026 | ||
| 1027 | /* Record in SAVED_INFO the information about the current character. */ | 1027 | /* Record in SAVED_INFO the information about the current character. */ |
| 1028 | static inline void | 1028 | static INLINE void |
| 1029 | bidi_remember_char (struct bidi_saved_info *saved_info, | 1029 | bidi_remember_char (struct bidi_saved_info *saved_info, |
| 1030 | struct bidi_it *bidi_it) | 1030 | struct bidi_it *bidi_it) |
| 1031 | { | 1031 | { |
| @@ -1041,7 +1041,7 @@ bidi_remember_char (struct bidi_saved_info *saved_info, | |||
| 1041 | 1041 | ||
| 1042 | /* Resolve the type of a neutral character according to the type of | 1042 | /* Resolve the type of a neutral character according to the type of |
| 1043 | surrounding strong text and the current embedding level. */ | 1043 | surrounding strong text and the current embedding level. */ |
| 1044 | static inline bidi_type_t | 1044 | static INLINE bidi_type_t |
| 1045 | bidi_resolve_neutral_1 (bidi_type_t prev_type, bidi_type_t next_type, int lev) | 1045 | bidi_resolve_neutral_1 (bidi_type_t prev_type, bidi_type_t next_type, int lev) |
| 1046 | { | 1046 | { |
| 1047 | /* N1: European and Arabic numbers are treated as though they were R. */ | 1047 | /* N1: European and Arabic numbers are treated as though they were R. */ |
| @@ -1058,7 +1058,7 @@ bidi_resolve_neutral_1 (bidi_type_t prev_type, bidi_type_t next_type, int lev) | |||
| 1058 | return STRONG_R; | 1058 | return STRONG_R; |
| 1059 | } | 1059 | } |
| 1060 | 1060 | ||
| 1061 | static inline int | 1061 | static INLINE int |
| 1062 | bidi_explicit_dir_char (int c) | 1062 | bidi_explicit_dir_char (int c) |
| 1063 | { | 1063 | { |
| 1064 | /* FIXME: this should be replaced with a lookup table with suitable | 1064 | /* FIXME: this should be replaced with a lookup table with suitable |
| @@ -1308,7 +1308,7 @@ bidi_resolve_explicit (struct bidi_it *bidi_it) | |||
| 1308 | 1308 | ||
| 1309 | /* Advance in the buffer, resolve weak types and return the type of | 1309 | /* Advance in the buffer, resolve weak types and return the type of |
| 1310 | the next character after weak type resolution. */ | 1310 | the next character after weak type resolution. */ |
| 1311 | bidi_type_t | 1311 | static bidi_type_t |
| 1312 | bidi_resolve_weak (struct bidi_it *bidi_it) | 1312 | bidi_resolve_weak (struct bidi_it *bidi_it) |
| 1313 | { | 1313 | { |
| 1314 | bidi_type_t type; | 1314 | bidi_type_t type; |
| @@ -1499,7 +1499,7 @@ bidi_resolve_weak (struct bidi_it *bidi_it) | |||
| 1499 | return type; | 1499 | return type; |
| 1500 | } | 1500 | } |
| 1501 | 1501 | ||
| 1502 | bidi_type_t | 1502 | static bidi_type_t |
| 1503 | bidi_resolve_neutral (struct bidi_it *bidi_it) | 1503 | bidi_resolve_neutral (struct bidi_it *bidi_it) |
| 1504 | { | 1504 | { |
| 1505 | int prev_level = bidi_it->level_stack[bidi_it->stack_idx].level; | 1505 | int prev_level = bidi_it->level_stack[bidi_it->stack_idx].level; |
| @@ -1623,7 +1623,7 @@ bidi_resolve_neutral (struct bidi_it *bidi_it) | |||
| 1623 | /* Given an iterator state in BIDI_IT, advance one character position | 1623 | /* Given an iterator state in BIDI_IT, advance one character position |
| 1624 | in the buffer to the next character (in the logical order), resolve | 1624 | in the buffer to the next character (in the logical order), resolve |
| 1625 | the bidi type of that next character, and return that type. */ | 1625 | the bidi type of that next character, and return that type. */ |
| 1626 | bidi_type_t | 1626 | static bidi_type_t |
| 1627 | bidi_type_of_next_char (struct bidi_it *bidi_it) | 1627 | bidi_type_of_next_char (struct bidi_it *bidi_it) |
| 1628 | { | 1628 | { |
| 1629 | bidi_type_t type; | 1629 | bidi_type_t type; |
| @@ -1649,7 +1649,7 @@ bidi_type_of_next_char (struct bidi_it *bidi_it) | |||
| 1649 | the buffer to the next character (in the logical order), resolve | 1649 | the buffer to the next character (in the logical order), resolve |
| 1650 | the embedding and implicit levels of that next character, and | 1650 | the embedding and implicit levels of that next character, and |
| 1651 | return the resulting level. */ | 1651 | return the resulting level. */ |
| 1652 | int | 1652 | static int |
| 1653 | bidi_level_of_next_char (struct bidi_it *bidi_it) | 1653 | bidi_level_of_next_char (struct bidi_it *bidi_it) |
| 1654 | { | 1654 | { |
| 1655 | bidi_type_t type; | 1655 | bidi_type_t type; |