Added convenience functions for common string pointer operation workalikes:
utf8set
Sets a codepoint at the current string position, and return a pointer to the next str position. Intended as an equivalent to *s = c
utf8inc
Increments the string by 1 codepoint, and returns a pointer to the new position. Intended as an equivalent to s++
utf8dec
Decrements the string by 1 codepoint, and returns a pointer to the new position. Intended as an equivalent to s--
utf8pos
Returns the byte position of the Nth codepoint in the string. Intended as a convenience function to find the Nth character position: s[N]
Wrapped function definitions in a UTF8_IMPLEMENTATION macro, to control when object code is generated. This change requires the caller to define UTF8_IMPLEMENTATION prior to including the utf8.h header exactly once in a project.
If the compiler is C99 compliant, the above functions will be marked inline. This behavior can be overridden by defining UTF8_NO_INLINE. If not inlined, these functions will be exportable symbols.
Added convenience functions for common string pointer operation workalikes:
*s = c
s++
s--
N
th character position:s[N]
Wrapped function definitions in a
UTF8_IMPLEMENTATION
macro, to control when object code is generated. This change requires the caller to defineUTF8_IMPLEMENTATION
prior to including theutf8.h
header exactly once in a project.If the compiler is
C99
compliant, the above functions will be marked inline. This behavior can be overridden by definingUTF8_NO_INLINE
. If not inlined, these functions will be exportable symbols.Suggestions for changes/improvements are welcome.