static DataOffset getUnicodeGroupOffset (TextTableData *ttd, wchar_t character, int allocate) { unsigned int groupNumber = UNICODE_GROUP_NUMBER(character); DataOffset groupOffset = getTextTableHeader(ttd)->unicodeGroups[groupNumber]; if (!groupOffset && allocate) { if (!allocateDataItem(ttd->area, &groupOffset, sizeof(UnicodeGroupEntry), __alignof__(UnicodeGroupEntry))) return 0; getTextTableHeader(ttd)->unicodeGroups[groupNumber] = groupOffset; } return groupOffset; }
static void setTextTableDots (TextTableData *ttd, wchar_t character, unsigned char dots) { TextTableHeader *header = getTextTableHeader(ttd); if (!BITMASK_TEST(header->dotsCharacterDefined, dots)) { header->dotsToCharacter[dots] = character; BITMASK_SET(header->dotsCharacterDefined, dots); } }
static void resetTextTableDots (TextTableData *ttd, unsigned char dots, wchar_t character) { TextTableHeader *header = getTextTableHeader(ttd); if (BITMASK_TEST(header->dotsCharacterDefined, dots)) { if (header->dotsToCharacter[dots] == character) { header->dotsToCharacter[dots] = 0; BITMASK_CLEAR(header->dotsCharacterDefined, dots); } } }
TextTable * makeTextTable (TextTableData *ttd) { TextTable *table = malloc(sizeof(*table)); if (table) { table->header.fields = getTextTableHeader(ttd); table->size = getDataSize(ttd->area); resetDataArea(ttd->area); } return table; }
TextTable * makeTextTable (TextTableData *ttd) { TextTable *table = malloc(sizeof(*table)); if (table) { memset(table, 0, sizeof(*table)); table->header.fields = getTextTableHeader(ttd); table->size = getDataSize(ttd->area); table->options.tryBaseCharacter = 1; resetDataArea(ttd->area); } return table; }
static int finishTextTableData (TextTableData *ttd) { qsort(ttd->alias.array, ttd->alias.count, sizeof(*ttd->alias.array), sortTextTableAliasArray); { DataOffset offset; if (!saveDataItem(ttd->area, &offset, ttd->alias.array, ARRAY_SIZE(ttd->alias.array, ttd->alias.count), __alignof__(*ttd->alias.array))) { return 0; } { TextTableHeader *header = getTextTableHeader(ttd); header->aliasArray = offset; header->aliasCount = ttd->alias.count; } } return 1; }