diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-05-19 06:52:23 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-05-19 06:52:23 (GMT) |
commit | 5bc888a2708e5cff38dabdbe95bbb965d59bb648 (patch) | |
tree | b10ebaa2834b3e647eccc1441265d5c0395b692c /generic/tkInt.h | |
parent | d71a648c788bdbe6f17db19dcb90cafb174abc83 (diff) | |
parent | 5204a77ccd7306b8ed7c3c264c88171f68180efd (diff) | |
download | tk-5bc888a2708e5cff38dabdbe95bbb965d59bb648.zip tk-5bc888a2708e5cff38dabdbe95bbb965d59bb648.tar.gz tk-5bc888a2708e5cff38dabdbe95bbb965d59bb648.tar.bz2 |
Add TkUtfCharComplete(), and use it in TkNumUtfChars()
Diffstat (limited to 'generic/tkInt.h')
-rw-r--r-- | generic/tkInt.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/generic/tkInt.h b/generic/tkInt.h index d426d55..a6304f8 100644 --- a/generic/tkInt.h +++ b/generic/tkInt.h @@ -1293,12 +1293,15 @@ MODULE_SCOPE void TkUnixSetXftClipRegion(TkRegion clipRegion); # define TkUtfPrev Tcl_UtfPrev # define TkUtfAtIndex Tcl_UtfAtIndex # define TkNumUtfChars Tcl_NumUtfChars +# define TkUtfCharComplete Tcl_UtfCharComplete #else MODULE_SCOPE int TkUtfToUniChar(const char *, int *); MODULE_SCOPE int TkUniCharToUtf(int, char *); MODULE_SCOPE const char *TkUtfPrev(const char *, const char *); MODULE_SCOPE const char *TkUtfAtIndex(const char *src, int index); MODULE_SCOPE int TkNumUtfChars(const char *src, int length); +# define TkUtfCharComplete(src, length) (((unsigned)(UCHAR(*(src)) - 0xF0) < 5) \ + ? ((length) >= 4) : (UCHAR(*(src)) == 0xED) ? ((length) >= 6) : Tcl_UtfCharComplete((src), (length))) #endif /* |