54 assert (Templates != NULL);
55 assert (Class != NULL);
63 assert (Templates->
Class[ClassId] == NULL);
64 Templates->
Class[ClassId] = Class;
179 Templates->
Class[i] = NULL;
201 if (templates != NULL) {
203 for (i = 0; i < (templates->
Templates)->NumClasses; i++)
225 int NumProtos = MaxProtoId + 1;
229 "TEMP_CONFIG_STRUCT");
233 Config->MaxProtoId = MaxProtoId;
237 Config->FontinfoId = FontinfoId;
278 fprintf (
File,
"\n\nSUMMARY OF ADAPTED TEMPLATES:\n\n");
279 fprintf (
File,
"Num classes = %d; Num permanent classes = %d\n\n",
281 fprintf (
File,
" Id NC NPC NP NPP\n");
282 fprintf (
File,
"------------------------\n");
284 for (i = 0; i < (Templates->
Templates)->NumClasses; i++) {
286 AClass = Templates->
Class[i];
288 fprintf (
File,
"%5d %s %3d %3d %3d %3d\n",
295 fprintf (
File,
"\n");
314 int32_t NumTempProtos;
327 fread ((
char *) Class->PermProtos, sizeof (
uinT32),
329 fread ((
char *) Class->PermConfigs, sizeof (
uinT32),
333 fread (&NumTempProtos,
sizeof(NumTempProtos), 1, File);
335 for (i = 0; i < NumTempProtos; i++) {
338 "TEMP_PROTO_STRUCT");
340 Class->TempProtos =
push_last (Class->TempProtos, TempProto);
344 fread (&NumConfigs,
sizeof(NumConfigs), 1, File);
345 for (i = 0; i < NumConfigs; i++)
346 if (
test_bit (Class->PermConfigs, i))
381 for (i = 0; i < (Templates->Templates)->NumClasses; i++) {
404 "PERM_CONFIG_STRUCT");
406 fread ((
char *) &NumAmbigs,
sizeof(
uinT8), 1, File);
409 Config->Ambigs[NumAmbigs] = -1;
410 fread(&(
Config->FontinfoId),
sizeof(
int), 1, File);
434 "TEMP_CONFIG_STRUCT");
439 Config->ProtoVectorSize, File);
468 fwrite ((
char *) Class->PermProtos, sizeof (
uinT32),
470 fwrite ((
char *) Class->PermConfigs, sizeof (
uinT32),
474 NumTempProtos =
count (Class->TempProtos);
475 fwrite ((
char *) &NumTempProtos,
sizeof (
int), 1, File);
476 TempProtos = Class->TempProtos;
483 fwrite ((
char *) &NumConfigs,
sizeof (
int), 1, File);
484 for (i = 0; i < NumConfigs; i++)
485 if (
test_bit (Class->PermConfigs, i))
515 for (i = 0; i < (Templates->Templates)->NumClasses; i++) {
517 Templates->Templates->Class[i]->NumConfigs);
539 while (
Config->Ambigs[NumAmbigs] > 0) ++NumAmbigs;
541 fwrite((
char *) &NumAmbigs,
sizeof(
uinT8), 1, File);
543 fwrite(&(
Config->FontinfoId),
sizeof(
int), 1, File);
562 assert (
Config->ContextsSeen == NULL);
566 Config->ProtoVectorSize, File);
void free_adapted_templates(ADAPT_TEMPLATES templates)
void AddIntClass(INT_TEMPLATES Templates, CLASS_ID ClassId, INT_CLASS Class)
INT_TEMPLATES ReadIntTemplates(FILE *File)
TEMP_CONFIG NewTempConfig(int MaxProtoId, int FontinfoId)
#define TempConfigFor(Class, ConfigId)
void free_struct(void *deadstruct, inT32, const char *)
int GetFontinfoId(ADAPT_CLASS Class, uinT8 ConfigId)
void AddAdaptedClass(ADAPT_TEMPLATES Templates, ADAPT_CLASS Class, CLASS_ID ClassId)
#define UnusedClassIdIn(T, c)
void free_adapted_class(ADAPT_CLASS adapt_class)
ADAPT_CLASS NewAdaptedClass()
void PrintAdaptedTemplates(FILE *File, ADAPT_TEMPLATES Templates)
void FreeTempConfig(TEMP_CONFIG Config)
void memfree(void *element)
#define IsEmptyAdaptedClass(Class)
BIT_VECTOR NewBitVector(int NumBits)
PERM_CONFIG_STRUCT * PERM_CONFIG
#define WordsInVectorOfSize(NumBits)
ADAPT_CLASS ReadAdaptedClass(FILE *File)
TEMP_PROTO_STRUCT * TEMP_PROTO
TEMP_PROTO NewTempProto()
ADAPT_TEMPLATES ReadAdaptedTemplates(FILE *File)
#define PermConfigFor(Class, ConfigId)
LIST push_last(LIST list, void *item)
void WriteAdaptedClass(FILE *File, ADAPT_CLASS Class, int NumConfigs)
void FreeBitVector(BIT_VECTOR BitVector)
INT_CLASS NewIntClass(int MaxNumProtos, int MaxNumConfigs)
void free_int_templates(INT_TEMPLATES templates)
void FreePermConfig(PERM_CONFIG Config)
void destroy_nodes(LIST list, void_dest destructor)
void WritePermConfig(FILE *File, PERM_CONFIG Config)
INT_TEMPLATES NewIntTemplates()
PERM_CONFIG ReadPermConfig(FILE *File)
void WriteIntTemplates(FILE *File, INT_TEMPLATES Templates, const UNICHARSET &target_unicharset)
void FreeTempProto(void *arg)
TEMP_CONFIG ReadTempConfig(FILE *File)
#define test_bit(array, bit)
void * alloc_struct(inT32 count, const char *)
void WriteTempConfig(FILE *File, TEMP_CONFIG Config)
TEMP_CONFIG_STRUCT * TEMP_CONFIG
#define zero_all_bits(array, length)
const char * id_to_unichar(UNICHAR_ID id) const
ADAPT_CLASS_STRUCT * ADAPT_CLASS
ADAPT_TEMPLATES_STRUCT * ADAPT_TEMPLATES
ADAPT_TEMPLATES NewAdaptedTemplates(bool InitFromUnicharset)
INT_CLASS Class[MAX_NUM_CLASSES]
#define ConfigIsPermanent(Class, ConfigId)
void WriteAdaptedTemplates(FILE *File, ADAPT_TEMPLATES Templates)
ADAPT_CLASS Class[MAX_NUM_CLASSES]