diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-04-14 14:30:35 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-04-14 14:30:35 (GMT) |
commit | 6a0b66fc79d01eac04951c8d0bd0a4412c3b9c91 (patch) | |
tree | 740553533208a7d59ce076bc595179164dfb10ee /doc/Utf.3 | |
parent | 527a481e1a5488fe6c9f00e9b9531b78c52ca8cc (diff) | |
parent | 1faed93cada29bd263dfed0b7b5df50e86defd39 (diff) | |
download | tcl-6a0b66fc79d01eac04951c8d0bd0a4412c3b9c91.zip tcl-6a0b66fc79d01eac04951c8d0bd0a4412c3b9c91.tar.gz tcl-6a0b66fc79d01eac04951c8d0bd0a4412c3b9c91.tar.bz2 |
Merge 8.7
Diffstat (limited to 'doc/Utf.3')
-rw-r--r-- | doc/Utf.3 | 28 |
1 files changed, 21 insertions, 7 deletions
@@ -257,13 +257,27 @@ string. The caller must not ask for the next character after the last character in the string if the string is not terminated by a null character. .PP -Given \fIsrc\fR, a pointer to some location in a UTF-8 string (or to a -null byte immediately following such a string), \fBTcl_UtfPrev\fR -returns a pointer to the closest preceding byte that starts a UTF-8 -character. -This function will not back up to a position before \fIstart\fR, -the start of the UTF-8 string. If \fIsrc\fR was already at \fIstart\fR, the -return value will be \fIstart\fR. +\fBTcl_UtfPrev\fR is used to step backward through but not beyond the +UTF-8 string that begins at \fIstart\fR. If the UTF-8 string is made +up entirely of complete and well-formed characters, and \fIsrc\fR points +to the lead byte of one of those characters (or to the location one byte +past the end of the string), then repeated calls of \fBTcl_UtfPrev\fR will +return pointers to the lead bytes of each character in the string, one +character at a time, terminating when it returns \fIstart\fR. +.PP +When the conditions of completeness and well-formedness may not be satisfied, +a more precise description of the function of \fBTcl_UtfPrev\fR is necessary. +It always returns a pointer greater than or equal to \fIstart\fR; that is, +always a pointer to a location in the string. It always returns a pointer to +a byte that begins a character when scanning for characters beginning +from \fIstart\fR. When \fIsrc\fR is greater than \fIstart\fR, it +always returns a pointer less than \fIsrc\fR and greater than or +equal to (\fIsrc\fR - \fBTCL_UTF_MAX\fR). The character that begins +at the returned pointer is the first one that either includes the +byte \fIsrc[-1]\fR, or might include it if the right trail bytes are +present at \fIsrc\fR and greater. \fBTcl_UtfPrev\fR never reads the +byte \fIsrc[0]\fR nor the byte \fIstart[-1]\fR nor the byte +\fIsrc[-\fBTCL_UTF_MAX\fI-1]\fR. .PP \fBTcl_UniCharAtIndex\fR corresponds to a C string array dereference or the Pascal Ord() function. It returns the Tcl_UniChar represented at the |