Jump to content

UniQueryCharTypeTable

From EDM2
Revision as of 19:29, 26 July 2017 by Martini (talk | contribs) (Created page with "UniQueryCharTypeTable is used to query the type of the character. ==Syntax== ULONG UniQueryCharTypeTable (ULONG *count, UNICTYPE **unictype) ==Parameters== ; count (UL...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

UniQueryCharTypeTable is used to query the type of the character.

Syntax

ULONG UniQueryCharTypeTable (ULONG     *count, UNICTYPE  **unictype)

Parameters

count (ULONG *)
count is set to the length of the table being accessed.
unictype (UNICTYPE **)
unictype is set to point to a table of UNICTYPE structures.

Returns

A ULONG equal to zero is always returned.

Remarks

UniQueryCharTypeTable is passed a pointer to a count and a pointer to a table of UNICTYPE structures. count is set to the number of entries in the UNICTYPE structure table. unictype is set to the first structure in the table.


Example

This example shows how to query a character type table.

#include <unidef.h>
#include <stdlib.h>

/*
 * StringBidi: Determine bidi types for each character in a string.
 * Return string of bidi bits, and return value with OR of all bits.
 */
USHORT StringBidi(UniChar *instr, USHORT *charsets) {

    ULONG    count;
    UNICTYPE *typetab;
    USHORT   index, *pcs, out;
    int      rc, i, len;

    /* Get addressability to the character type table */
    UniQueryCharTypeTable (&count, &typetab);

    /* Create an output string */
    len = UniStrlen(instr);
    UniQueryStringType(instr, len, charsets, CT_INDEX);

    /* Replace each index with bidi flags */
    pcs = charsets;
    out = 0;
    for (i=0; i<len; i++) {
        index = *pcs;
        *pcs = 0;
        if (typetab[index].bidi == C2_RIGHTTOLEFT)
            *pcs |= 1;
        if (typetab[index].charset == CHS_ARABIC)
            *pcs |= 2;
        if (typetab[index].charset == CHS_HEBREW)
            *pcs |= 4;
        out |= *pcs++;
    }

    return out;
}

Format

#include <unidef.h>

ULONG UniQueryCharTypeTable (
    ULONG     *count,       /* O  - Number of entries in table   */
    UNICTYPE  **unictype    /* O  - Table of character type data */
)

Related Functions