ucdata(3)

NAME
ucdata - package for providing Unicode/ISO10646 character information

SYNOPSIS
#include <ucdata.h>

void ucdata_load(char * paths, int masks)

void ucdata_unload(int masks)

void ucdata_reload(char * paths, int masks)

int ucdecomp(unsigned long code, unsigned long *num, unsigned long **decomp)

int uccanondecomp(const unsigned long *in, int inlen, unsigned long **out, int *outlen)

int ucdecomp_hangul(unsigned long code, unsigned long *num, unsigned long decomp[])

int uccomp(unsigned long ch1, unsigned long ch2, unsigned long *comp)

int uccomp_hangul(unsigned long *str, int len)

int uccanoncomp(unsiged long *str, int len)
struct ucnumber {
  int numerator;
  int denominator;
};

int ucnumber_lookup(unsigned long code, struct ucnumber *num)

int ucdigit_lookup(unsigned long code, int *digit)

struct ucnumber ucgetnumber(unsigned long code)

int ucgetdigit(unsigned long code)

unsigned long uctoupper(unsigned long code)

unsigned long uctolower(unsigned long code)

unsigned long uctotitle(unsigned long code)

int ucisalpha(unsigned long code)

int ucisalnum(unsigned long code)

int ucisdigit(unsigned long code)

int uciscntrl(unsigned long code)

int ucisspace(unsigned long code)

int ucisblank(unsigned long code)

int ucispunct(unsigned long code)

int ucisgraph(unsigned long code)

int ucisprint(unsigned long code)

int ucisxdigit(unsigned long code)

int ucisupper(unsigned long code)

int ucislower(unsigned long code)

int ucistitle(unsigned long code)

int ucisisocntrl(unsigned long code)

int ucisfmtcntrl(unsigned long code)

int ucissymbol(unsigned long code)

int ucisnumber(unsigned long code)

int ucisnonspacing(unsigned long code)

int ucisopenpunct(unsigned long code)

int ucisclosepunct(unsigned long code)

int ucisinitialpunct(unsigned long code)

int ucisfinalpunct(unsigned long code)

int uciscomposite(unsigned long code)

int ucisquote(unsigned long code)

int ucissymmetric(unsigned long code)

int ucismirroring(unsigned long code)

int ucisnonbreaking(unsigned long code)

int ucisrtl(unsigned long code)

int ucisltr(unsigned long code)

int ucisstrong(unsigned long code)

int ucisweak(unsigned long code)

int ucisneutral(unsigned long code)

int ucisseparator(unsigned long code)

int ucislsep(unsigned long code)

int ucispsep(unsigned long code)

int ucismark(unsigned long code)

int ucisnsmark(unsigned long code)

int ucisspmark(unsigned long code)

int ucismodif(unsigned long code)

int ucismodifsymbol(unsigned long code)

int ucisletnum(unsigned long code)

int ucisconnect(unsigned long code)

int ucisdash(unsigned long code)

int ucismath(unsigned long code)

int uciscurrency(unsigned long code)

int ucisenclosing(unsigned long code)

int ucisprivate(unsigned long code)

int ucissurrogate(unsigned long code)

int ucisidentstart(unsigned long code)

int ucisidentpart(unsigned long code)

int ucisdefined(unsigned long code)

int ucisundefined(unsigned long code)

int ucishan(unsigned long code)

int ucishangul(unsigned long code)

DESCRIPTION

Macros
    UCDATA_CASE
    UCDATA_CTYPE
    UCDATA_DECOMP
    UCDATA_CMBCL
    UCDATA_NUM
    UCDATA_ALL

ucdata_load()
    This function initializes the UCData library by locating the data files in one of the colon-separated directories in the `paths' parameter. The data files to be loaded are specified in the `masks' parameter as a bitwise combination of the macros listed above.

    This should be called before using any of the other functions.

ucdata_unload()
    This function unloads the data tables specified in the `masks' parameter.

    This function should be called when the application is done using the UCData package.

ucdata_reload()
    This function reloads the data files from one of the colon-separated directories in the `paths' parameter. The data files to be reloaded are specified in the `masks' parameter as a bitwise combination of the macros listed above.

ucdecomp()
    This function determines if a character has a decomposition and returns the decomposition information if it exists.

    If a zero is returned, there is no decomposition. If a non-zero is returned, then the `num' and `decomp' variables are filled in with the appropriate values.

    Example call:

        unsigned long i, num, *decomp;
        if (ucdecomp(0x1d5, &num, &decomp) != 0) {
           for (i = 0; i < num; i++)
             printf("0x%08lX,", decomp[i]);
           putchar(');
        }

uccanondecomp()
    This function will decompose a string, insuring the characters are in
    canonical order for comparison.

    If a decomposed string is returned, the caller is responsible for deallocating
    the string.

    If a -1 is returned, memory allocation failed.  If a zero is returned, no
    decomposition was done.  Any other value means a decomposition string was
    created and the values returned in the `out' and `outlen' parameters.

ucdecomp_hangul()
    This function determines if a Hangul syllable has a
    decomposition and returns the decomposition information.

    An array of at least size 3 should be passed to the function
    for the decomposition of the syllable.

    If a zero is returned, the character is not a Hangul
    syllable. If a non-zero is returned, the `num' field
    will be 2 or 3 and the syllable will be decomposed into
    the `decomp' array arithmetically.

    Example call:

        unsigned long i, num, decomp[3];
        if (ucdecomp_hangul(0xb1ba, &num, &decomp) != 0) {
           for (i = 0; i < num; i++)
             printf("0x%08lX,", decomp[i]);
           putchar(');
        }

uccomp()
    This function determines if a pair of characters have a composition, and
    returns that composition if one exists.

    A zero is returned is no composition exists for the character pair.  Any other
    value indicates the `comp' field holds the character code representing the
    composition of the two character codes.

uccomp_hangul()
    This composes the Hangul Jamo in-place in the string.

    The returned value is the new length of the string.

uccanoncomp()
    This function does a full composition in-place in the string, including the
    Hangul composition.

    The returned value is the new length of the string.

ucnumber_lookup()
    This function determines if the code is a number and
    fills in the `num' field with the numerator and
    denominator.  If the code happens to be a single digit,
    the numerator and denominator fields will be the same.

    If the function returns 0, the code is not a number.
    Any other return value means the code is a number.

ucdigit_lookup()
    This function determines if the code is a digit and
    fills in the `digit' field with the digit value.

    If the function returns 0, the code is not a number.
    Any other return value means the code is a number.

ucgetnumber()
    This is a compatibility function with John Cowan's
    "uctype" package.  It uses ucnumber_lookup().

ucgetdigit()
    This is a compatibility function with John Cowan's
    "uctype" package.  It uses ucdigit_lookup().

uctoupper()
    This function returns the code unchanged if it is
    already upper case or has no upper case equivalent.
    Otherwise the upper case equivalent is returned.

uctolower()
    This function returns the code unchanged if it is
    already lower case or has no lower case equivalent.
    Otherwise the lower case equivalent is returned.

uctotitle()
    This function returns the code unchanged if it is
    already title case or has no title case equivalent.
    Otherwise the title case equivalent is returned.

ucisalpha()
    Test if code is an alpha character.

ucisalnum()
    Test if code is an alpha or digit character.

ucisdigit()
    Test if code is a digit character.

uciscntrl()
    Test if code is a control character.

ucisspace()
    Test if code is a space character.

ucisblank()
    Test if code is a blank character.

ucispunct()
    Test if code is a punctuation character.

ucisgraph()
    Test if code is a graphical (visible) character.

ucisprint()
    Test if code is a printable character.

ucisxdigit()
    Test if code is a hexadecimal digit character.

ucisupper()
    Test if code is an upper case character.

ucislower()
    Test if code is a lower case character.

ucistitle()
    Test if code is a title case character.

ucisisocntrl()
    Is the character a C0 control character (< 32)?

ucisfmtcntrl()
    Is the character a format control character?

ucissymbol()
    Is the character a symbol?

ucisnumber()
    Is the character a number or digit?

ucisnonspacing()
    Is the character non-spacing?

ucisopenpunct()
    Is the character an open/left punctuation (i.e. '[')

ucisclosepunct()
    Is the character an close/right punctuation (i.e. ']')

ucisinitialpunct()
    Is the character an initial punctuation (i.e. U+2018 LEFT
    SINGLE QUOTATION MARK)

ucisfinalpunct()
    Is the character a final punctuation (i.e. U+2019 RIGHT
    SINGLE QUOTATION MARK)

uciscomposite()
    Can the character be decomposed into a set of other
    characters?

ucisquote()
    Is the character one of the many quotation marks?

ucissymmetric()
    Is the character one that has an opposite form
    (i.e. <>)

ucismirroring()
    Is the character mirroring (superset of symmetric)?

ucisnonbreaking()
    Is the character non-breaking (i.e. non-breaking
    space)?

ucisrtl()
    Does the character have strong right-to-left
    directionality (i.e. Arabic letters)?

ucisltr()
    Does the character have strong left-to-right
    directionality (i.e. Latin letters)?

ucisstrong()
    Does the character have strong directionality?

ucisweak()
    Does the character have weak directionality
    (i.e. numbers)?

ucisneutral()
    Does the character have neutral directionality
    (i.e. whitespace)?

ucisseparator()
    Is the character a block or segment separator?

ucislsep()
    Is the character a line separator?

ucispsep()
    Is the character a paragraph separator?

ucismark()
    Is the character a mark of some kind?

ucisnsmark()
    Is the character a non-spacing mark?

ucisspmark()
    Is the character a spacing mark?

ucismodif()
    Is the character a modifier letter?

ucismodifsymbol()
    Is the character a modifier symbol?

ucisletnum()
    Is the character a number represented by a letter?

ucisconnect()
    Is the character connecting punctuation?

ucisdash()
    Is the character dash punctuation?

ucismath()
    Is the character a math character?

uciscurrency()
    Is the character a currency character?

ucisenclosing()
    Is the character enclosing (i.e. enclosing box)?

ucisprivate()
    Is the character from the Private Use Area?

ucissurrogate()
    Is the character one of the surrogate codes?

ucisidentstart()
    Is the character a legal initial character of an identifier?

ucisidentpart()
    Is the character a legal identifier character?

ucisdefined()
    Is the character defined (appeared in one of the data
    files)?

ucisundefined()
    Is the character not defined (non-Unicode)?

ucishan()
    Is the character a Han ideograph?

ucishangul()
    Is the character a pre-composed Hangul syllable?

SEE ALSO
ctype(3)

ACKNOWLEDGMENTS
These are people who have helped with patches or alerted me about problems.

John Cowan <cowan@locke.ccil.org>
Bob Verbrugge <bob_verbrugge@nl.compuware.com>
Christophe Pierret <cpierret@businessobjects.com>
Kent Johnson <kent@pondview.mv.com>
Valeriy E. Ushakov <uwe@ptc.spbu.ru>
Stig Venaas <Stig.Venaas@uninett.no>

AUTHOR
Mark Leisher
Computing Research Lab
New Mexico State University
Email: mleisher@crl.nmsu.edu