Esempio n. 1
0
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;
}
Esempio n. 2
0
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);
  }
}
Esempio n. 3
0
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);
    }
  }
}
Esempio n. 4
0
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;
}
Esempio n. 5
0
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;
}
Esempio n. 6
0
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;
}