diff options
author | Bram Moolenaar <Bram@vim.org> | 2005-08-10 21:07:57 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2005-08-10 21:07:57 +0000 |
commit | 0fa313a71870ccc2ba63da25a7abea850f5b3d02 (patch) | |
tree | fc949b566e1d78f6eea570aab55c52b7d6a6b052 /src/macros.h | |
parent | c388fbf9d99a8950c8c9a01466cfb8baa104ee8c (diff) | |
download | vim-git-0fa313a71870ccc2ba63da25a7abea850f5b3d02.tar.gz |
updated for version 7.0127v7.0127
Diffstat (limited to 'src/macros.h')
-rw-r--r-- | src/macros.h | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/macros.h b/src/macros.h index 69c32ca80..d18813ce2 100644 --- a/src/macros.h +++ b/src/macros.h @@ -254,15 +254,23 @@ * PTR2CHAR(): get character from pointer. */ #ifdef FEAT_MBYTE -# define mb_ptr_adv(p) p += has_mbyte ? (*mb_ptr2len_check)(p) : 1 +/* Advance multi-byte pointer, skip over composing chars. */ +# define mb_ptr_adv(p) p += has_mbyte ? (*mb_ptr2len)(p) : 1 +/* Advance multi-byte pointer, do not skip over composing chars. */ +# define mb_cptr_adv(p) p += enc_utf8 ? utf_ptr2len(p) : has_mbyte ? (*mb_ptr2len)(p) : 1 +/* Backup multi-byte pointer. */ # define mb_ptr_back(s, p) p -= has_mbyte ? ((*mb_head_off)(s, p - 1) + 1) : 1 +/* get length of multi-byte char, not including composing chars */ +# define mb_cptr2len(p) (enc_utf8 ? utf_ptr2len(p) : (*mb_ptr2len)(p)) + # define MB_COPY_CHAR(f, t) if (has_mbyte) mb_copy_char(&f, &t); else *t++ = *f++ # define MB_CHARLEN(p) (has_mbyte ? mb_charlen(p) : STRLEN(p)) -# define PTR2CHAR(p) (has_mbyte ? mb_ptr2char(p) : *(p)) +# define PTR2CHAR(p) (has_mbyte ? mb_ptr2char(p) : (int)*(p)) #else # define mb_ptr_adv(p) ++p +# define mb_cptr_adv(p) ++p # define mb_ptr_back(s, p) --p # define MB_COPY_CHAR(f, t) *t++ = *f++ # define MB_CHARLEN(p) STRLEN(p) -# define PTR2CHAR(p) (*(p)) +# define PTR2CHAR(p) ((int)*(p)) #endif |