662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
|
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
|
-
+
-
+
|
* pointer within the string (>= start). When (src == start), it
* returns start. When (src > start), it returns a pointer (< src)
* and (>= src - TCL_UTF_MAX). Subject to these constraints, the
* routine returns a pointer to the earliest byte in the string that
* starts a character when characters are read starting at start and
* that character might include the byte src[-1]. The routine will
* examine only those bytes in the range that might be returned.
* It will not examine the byte *src, and because of that cannot
* It will not examine the byte *src, and because of that cannot
* determine for certain in all circumstances whether the character
* that begins with the returned pointer will or will not include
* the byte src[-1]. In the scenario, where src points to the end of
* a buffer being filled, the returned pointer point to either the
* final complete character in the string or to the earliest byte
* that might start an incomplete character waiting for more bytes to
* complete.
*
* Because this routine always returns a value < src until the point
* it is forced to return start, it is useful as a backward iterator
* through a string that will always make progress and always be
* prevented from running past the beginning of the string.
*
* In a string where all characters are complete and properly formed,
* and the value of src points to the first byte of a character,
* and the value of src points to the first byte of a character,
* repeated Tcl_UtfPrev calls will step to the starting bytes of
* characters, one character at a time. Within those limitations,
* Tcl_UtfPrev and Tcl_UtfNext are inverses. If either condition cannot
* be met, Tcl_UtfPrev and Tcl_UtfNext may not function as inverses and
* the caller will have to take greater care.
*
* Results:
|