Replace Unicode character categories with blocks

Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
Simon Rozman
2025-11-14 12:05:35 +01:00
parent 1ba71443f5
commit e8f39da602
23 changed files with 179 additions and 641 deletions

View File

@@ -745,8 +745,6 @@ int _tmain(int argc, _TCHAR *argv[])
}
}
set<ZRCola::chrcatid_t> categories_used;
{
// Get characters.
com_obj<ADORecordset> rs;
@@ -809,9 +807,6 @@ int _tmain(int argc, _TCHAR *argv[])
// Add description (and keywords) to index.
idxChrDsc.add_keywords(chr->second.terms, chr->first, 0);
idxChrDscSub.add_keywords(chr->second.terms, chr->first, 3);
// Mark category used.
categories_used.insert(chr->second.cat);
}
// Write characters to file.
@@ -859,52 +854,6 @@ int _tmain(int argc, _TCHAR *argv[])
}
}
{
// Get character categories.
com_obj<ADORecordset> rs;
if (src.SelectCharacterCategories(rs)) {
size_t count = src.GetRecordsetCount(rs);
if (count < 0xffffffff) { // 4G check (-1 is reserved for error condition)
ZRCola::DBSource::chrcat cc;
ZRCola::chrcat_db db;
// Preallocate memory.
db.idxChrId.reserve(count);
db.idxRank .reserve(count);
db.data .reserve(count*4);
// Parse character categories and build index and data.
for (; !ZRCola::DBSource::IsEOF(rs); rs->MoveNext()) {
// Read character category from the database.
if (src.GetCharacterCategory(rs, cc)) {
if (build_pot)
pot.insert(cc.name);
if (categories_used.find(cc.cat) == categories_used.end()) {
// Skip empty character categories.
continue;
}
// Add character category to index and data.
db << cc;
} else
has_errors = true;
}
// Write character categories to file.
db.idxChrId.sort();
db.idxRank .sort();
dst << ZRCola::chrcat_rec(db);
} else {
_ftprintf(stderr, wxT("%s: error ZCC0019: Error getting character category count from database or too many character categories.\n"), (LPCTSTR)filenameIn.c_str());
has_errors = true;
}
} else {
_ftprintf(stderr, wxT("%s: error ZCC0018: Error getting character categories from database. Please make sure the file is ZRCola.zrc compatible.\n"), (LPCTSTR)filenameIn.c_str());
has_errors = true;
}
}
{
// Get characters tags.
com_obj<ADORecordset> rs;