From f1923bdfa6300a0d32e3329eb2488447f76b8970 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Fri, 12 Jun 2015 09:30:39 +0100 Subject: Add non-metafied character length handling. Use this in regex module and add test using $'\ua0'. Rename mb_metacharinit() to mb_charinit() as it does not involve metafied characters. --- Src/zsh.h | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'Src/zsh.h') diff --git a/Src/zsh.h b/Src/zsh.h index c88c2e739..fb04929d9 100644 --- a/Src/zsh.h +++ b/Src/zsh.h @@ -2921,8 +2921,9 @@ enum { #define AFTERTRAPHOOK (zshhooks + 2) #ifdef MULTIBYTE_SUPPORT +/* Metafied input */ #define nicezputs(str, outs) (void)mb_niceformat((str), (outs), NULL, 0) -#define MB_METACHARINIT() mb_metacharinit() +#define MB_METACHARINIT() mb_charinit() typedef wint_t convchar_t; #define MB_METACHARLENCONV(str, cp) mb_metacharlenconv((str), (cp)) #define MB_METACHARLEN(str) mb_metacharlenconv(str, NULL) @@ -2932,6 +2933,11 @@ typedef wint_t convchar_t; #define MB_METASTRLEN2END(str, widthp, eptr) \ mb_metastrlenend(str, widthp, eptr) +/* Unmetafined input */ +#define MB_CHARINIT() mb_charinit() +#define MB_CHARLENCONV(str, len, cp) mb_charlenconv((str), (len), (cp)) +#define MB_CHARLEN(str, len) mb_charlenconv((str), (len), NULL) + /* * We replace broken implementations with one that uses Unicode * characters directly as wide characters. In principle this is only @@ -3015,6 +3021,10 @@ typedef int convchar_t; #define MB_METASTRLEN2(str, widthp) ztrlen(str) #define MB_METASTRLEN2END(str, widthp, eptr) ztrlenend(str, eptr) +#define MB_CHARINIT() +#define MB_CHARLENCONV(str, len, cp) charlenconv((str), (len), (cp)) +#define MB_CHARLEN(str, len) ((len) ? 1 : 0) + #define WCWIDTH_WINT(c) (1) /* Leave character or string as is. */ -- cgit 1.4.1