/* constants for UCMapping.moveFlag */ enum {
UCM_MOVE_TO_EXT=1,
UCM_REMOVE_MAPPING=2
};
/* * Per-mapping data structure * * u if uLen==1: Unicode code point * else index to uLen code points * b if bLen<=4: up to 4 bytes * else index to bLen bytes * uLen number of code points * bLen number of words containing left-justified bytes * bIsMultipleChars indicates that the bytes contain more than one sequence * according to the state table * f flag for roundtrip (0), fallback (1), sub mapping (2), reverse fallback (3) * or "good one-way" mapping (4). * Same values as in the source file after |
*/ typedefstruct UCMapping {
UChar32 u; union {
uint32_t idx;
uint8_t bytes[4];
} b;
int8_t uLen, bLen, f, moveFlag;
} UCMapping;
/* constants for UCMTable.flagsType */ enum {
UCM_FLAGS_INITIAL, /* no mappings parsed yet */
UCM_FLAGS_EXPLICIT, /* .ucm file has mappings with | fallback indicators */
UCM_FLAGS_IMPLICIT, /* .ucm file has mappings without | fallback indicators, later wins */
UCM_FLAGS_MIXED /* both implicit and explicit */
};
/* @return -1 illegal bytes 0 suitable for base table 1 needs to go into extension table */
U_CAPI int32_t U_EXPORT2
ucm_mappingType(UCMStates *baseStates,
UCMapping *m,
UChar32 codePoints[UCNV_EXT_MAX_UCHARS],
uint8_t bytes[UCNV_EXT_MAX_BYTES]);
/* add a mapping to the base or extension table as appropriate */
U_CAPI UBool U_EXPORT2
ucm_addMappingAuto(UCMFile *ucm, UBool forBase, UCMStates *baseStates,
UCMapping *m,
UChar32 codePoints[UCNV_EXT_MAX_UCHARS],
uint8_t bytes[UCNV_EXT_MAX_BYTES]);
/* * Remove mappings with their move flag set from the base table * and move some of them (with UCM_MOVE_TO_EXT) to the extension table.
*/
U_CAPI void U_EXPORT2
ucm_moveMappings(UCMTable *base, UCMTable *ext);
/** * Read a table from a .ucm file, from after the CHARMAP line to * including the END CHARMAP line.
*/
U_CAPI void U_EXPORT2
ucm_readTable(UCMFile *ucm, FileStream* convFile,
UBool forBase, UCMStates *baseStates,
UErrorCode *pErrorCode);
/** * Check the validity of mappings against a base table's states; * necessary for extension-only tables that were read before their base tables.
*/
U_CAPI UBool U_EXPORT2
ucm_checkValidity(UCMTable *ext, UCMStates *baseStates);
/** * Check a base table against an extension table. * Set the moveTarget!=NULL if it is possible to move mappings from the base. * This is the case where base and extension tables are parsed from a single file * (moveTarget==ext) * or when delta file mappings are subtracted from a base table. * * When a base table cannot be modified because a delta file is parsed in makeconv, * then set moveTarget=NULL. * * if(intersectBase) then mappings that exist in the base table but not in * the extension table are moved to moveTarget instead of showing an error. * * Special mode: * If intersectBase==2 for a DBCS extension table, then SBCS mappings are * not moved out of the base unless their Unicode input requires it. * This helps ucmkbase generate base tables for DBCS-only extension .cnv files. * * For both tables in the same file, the extension table is automatically * built. * For separate files, the extension file can use a complete mapping table (.ucm file), * so that common mappings need not be stripped out manually. * * * Sort both tables, and then for each mapping direction: * * If intersectBase is true and the base table contains a mapping * that does not exist in the extension table, then this mapping is moved * to moveTarget. * * - otherwise - * * If the base table contains a mapping for which the input sequence is * the same as the extension input, then * - if the output is the same: remove the extension mapping * - else: error * * If the base table contains a mapping for which the input sequence is * a prefix of the extension input, then * - if moveTarget!=NULL: move the base mapping to the moveTarget table * - else: error * * @return false in case of an irreparable error
*/
U_CAPI UBool U_EXPORT2
ucm_checkBaseExt(UCMStates *baseStates, UCMTable *base, UCMTable *ext,
UCMTable *moveTarget, UBool intersectBase);
/* very makeconv-specific functions ----------------------------------------- */
/* finalize and optimize states after the toUnicode mappings are processed */
U_CAPI void U_EXPORT2
ucm_optimizeStates(UCMStates *states,
uint16_t **pUnicodeCodeUnits,
_MBCSToUFallback *toUFallbacks, int32_t countToUFallbacks,
UBool verbose);
/* moved here because it is used inside ucmstate.c */
U_CAPI int32_t U_EXPORT2
ucm_findFallback(_MBCSToUFallback *toUFallbacks, int32_t countToUFallbacks,
uint32_t offset);
/* very rptp2ucm-specific functions ----------------------------------------- */
/* * Input: Separate tables with mappings from/to Unicode, * subchar and subchar1 (0 if none). * All mappings must have flag 0. * * Output: fromUTable will contain the union of mappings with the correct * precision flags, and be sorted.
*/
U_CAPI void U_EXPORT2
ucm_mergeTables(UCMTable *fromUTable, UCMTable *toUTable, const uint8_t *subchar, int32_t subcharLength,
uint8_t subchar1);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.