Previous: , Up: Normalization forms (composition and decomposition) <uninorm.h>   [Contents][Index]


13.5 Normalization of streams of Unicode characters

A “stream of Unicode characters” is essentially a function that accepts an ucs4_t argument repeatedly, optionally combined with a function that “flushes” the stream.

Type: struct uninorm_filter

This is the data type of a stream of Unicode characters that normalizes its input according to a given normalization form and passes the normalized character sequence to the encapsulated stream of Unicode characters.

Function: struct uninorm_filter * uninorm_filter_create (uninorm_t nf, int (*stream_func) (void *stream_data, ucs4_t uc), void *stream_data)

Creates and returns a normalization filter for Unicode characters.

The pair (stream_func, stream_data) is the encapsulated stream. stream_func (stream_data, uc) receives the Unicode character uc and returns 0 if successful, or -1 with errno set upon failure.

Returns the new filter, or NULL with errno set upon failure.

Function: int uninorm_filter_write (struct uninorm_filter *filter, ucs4_t uc)

Stuffs a Unicode character into a normalizing filter. Returns 0 if successful, or -1 with errno set upon failure.

Function: int uninorm_filter_flush (struct uninorm_filter *filter)

Brings data buffered in the filter to its destination, the encapsulated stream.

Returns 0 if successful, or -1 with errno set upon failure.

Note! If after calling this function, additional characters are written into the filter, the resulting character sequence in the encapsulated stream will not necessarily be normalized.

Function: int uninorm_filter_free (struct uninorm_filter *filter)

Brings data buffered in the filter to its destination, the encapsulated stream, then closes and frees the filter.

Returns 0 if successful, or -1 with errno set upon failure.


Previous: Normalizing comparisons, Up: Normalization forms (composition and decomposition) <uninorm.h>   [Contents][Index]