Function
uni_prev
Decode the previous scalar value.
Parameters 🔗
| text | in | Character sequence to decode. |
| text_len | in | Number of code units in |
| text_attr | in | Attributes of |
| index | inout | Code unit offset in |
| cp | out | Decoded scalar value. |
Return Value 🔗
| UNI_OK | If the character was successfully decoded. |
| UNI_DONE | If the end of |
| UNI_BAD_ENCODING | If |
| UNI_BAD_OPERATION | If |
Discussion 🔗
Decodes the preceding Unicode scalar value from text at code unit index and writes the result to cp. The index parameter is updated by the implementation to refer to the code unit beginning the preceding scalar.
The number of code units in text is specified by text_len and its encoding is specified by text_attr. If text_len is negative then text is assumed to be null terminated.
This function returns UNI_DONE when iteration has reached the end of text otherwise it returns UNI_OK indicating there are more characters. If the implementation detects text is malformed, then it returns UNI_BAD_ENCODING.
The index parameter must refer to a code point boundary otherwise the behavior is undefined.