#include "oldlist.h"
#include "intproto.h"
#include <stdio.h>
Go to the source code of this file.
◆ ConfigIsPermanent
#define ConfigIsPermanent |
( |
|
Class, |
|
|
|
ConfigId |
|
) |
| (test_bit ((Class)->PermConfigs, ConfigId)) |
◆ IncreaseConfidence
#define IncreaseConfidence |
( |
|
TempConfig | ) |
((TempConfig)->NumTimesSeen++) |
◆ IsEmptyAdaptedClass
#define IsEmptyAdaptedClass |
( |
|
Class | ) |
|
Value:((Class)->NumPermConfigs == 0 && \
Definition at line 90 of file adaptive.h.
◆ MakeConfigPermanent
#define MakeConfigPermanent |
( |
|
Class, |
|
|
|
ConfigId |
|
) |
| (SET_BIT ((Class)->PermConfigs, ConfigId)) |
◆ MakeProtoPermanent
#define MakeProtoPermanent |
( |
|
Class, |
|
|
|
ProtoId |
|
) |
| (SET_BIT ((Class)->PermProtos, ProtoId)) |
◆ NumNonEmptyClassesIn
#define NumNonEmptyClassesIn |
( |
|
Template | ) |
((Template)->NumNonEmptyClasses) |
◆ PermConfigFor
#define PermConfigFor |
( |
|
Class, |
|
|
|
ConfigId |
|
) |
| ((Class)->Config[ConfigId].Perm) |
◆ TempConfigFor
#define TempConfigFor |
( |
|
Class, |
|
|
|
ConfigId |
|
) |
| ((Class)->Config[ConfigId].Temp) |
◆ ADAPT_CLASS
◆ ADAPT_TEMPLATES
◆ PERM_CONFIG
◆ TEMP_CONFIG
◆ TEMP_PROTO
◆ AddAdaptedClass()
This routine adds a new adapted class to an existing set of adapted templates.
- Parameters
-
Templates | set of templates to add new class to |
Class | new class to add to templates |
ClassId | class id to associate with new class |
- Note
- Globals: none
-
Exceptions: none
-
History: Thu Mar 14 13:06:09 1991, DSJ, Created.
Definition at line 49 of file adaptive.cpp.
54 assert (Templates != NULL);
55 assert (Class != NULL);
63 assert (Templates->
Class[ClassId] == NULL);
64 Templates->
Class[ClassId] = Class;
void AddIntClass(INT_TEMPLATES Templates, CLASS_ID ClassId, INT_CLASS Class)
#define UnusedClassIdIn(T, c)
INT_CLASS NewIntClass(int MaxNumProtos, int MaxNumConfigs)
ADAPT_CLASS Class[MAX_NUM_CLASSES]
◆ free_adapted_class()
Definition at line 136 of file adaptive.cpp.
#define TempConfigFor(Class, ConfigId)
void FreeTempConfig(TEMP_CONFIG Config)
#define PermConfigFor(Class, ConfigId)
void FreeBitVector(BIT_VECTOR BitVector)
void FreePermConfig(PERM_CONFIG Config)
void destroy_nodes(LIST list, void_dest destructor)
void FreeTempProto(void *arg)
#define ConfigIsPermanent(Class, ConfigId)
◆ free_adapted_templates()
Definition at line 199 of file adaptive.cpp.
201 if (templates != NULL) {
203 for (i = 0; i < (templates->
Templates)->NumClasses; i++)
void free_adapted_class(ADAPT_CLASS adapt_class)
void free_int_templates(INT_TEMPLATES templates)
ADAPT_CLASS Class[MAX_NUM_CLASSES]
◆ FreeTempConfig()
This routine frees all memory consumed by a temporary configuration.
- Parameters
-
- Note
- Globals: none
-
Exceptions: none
-
History: Thu Mar 14 13:34:23 1991, DSJ, Created.
Definition at line 80 of file adaptive.cpp.
void free_struct(void *deadstruct, inT32, const char *)
void memfree(void *element)
void FreeBitVector(BIT_VECTOR BitVector)
void destroy_nodes(LIST list, void_dest destructor)
◆ FreeTempProto()
void FreeTempProto |
( |
void * |
arg | ) |
|
Definition at line 90 of file adaptive.cpp.
void free_struct(void *deadstruct, inT32, const char *)
◆ NewAdaptedClass()
This operation allocates and initializes a new adapted class data structure and returns a ptr to it.
- Returns
- Ptr to new class data structure.
- Note
- Globals: none
-
Exceptions: none
-
History: Thu Mar 14 12:58:13 1991, DSJ, Created.
Definition at line 113 of file adaptive.cpp.
#define TempConfigFor(Class, ConfigId)
BIT_VECTOR NewBitVector(int NumBits)
#define WordsInVectorOfSize(NumBits)
#define zero_all_bits(array, length)
ADAPT_CLASS_STRUCT * ADAPT_CLASS
◆ NewTempConfig()
TEMP_CONFIG NewTempConfig |
( |
int |
MaxProtoId, |
|
|
int |
FontinfoId |
|
) |
| |
This routine allocates and returns a new temporary config.
- Parameters
-
MaxProtoId | max id of any proto in new config |
FontinfoId | font information from pre-trained templates |
- Returns
- Ptr to new temp config.
- Note
- Globals: none
-
Exceptions: none
-
History: Thu Mar 14 13:28:21 1991, DSJ, Created.
Definition at line 223 of file adaptive.cpp.
225 int NumProtos = MaxProtoId + 1;
229 "TEMP_CONFIG_STRUCT");
233 Config->MaxProtoId = MaxProtoId;
237 Config->FontinfoId = FontinfoId;
BIT_VECTOR NewBitVector(int NumBits)
#define WordsInVectorOfSize(NumBits)
void * alloc_struct(inT32 count, const char *)
TEMP_CONFIG_STRUCT * TEMP_CONFIG
#define zero_all_bits(array, length)
◆ NewTempProto()
This routine allocates and returns a new temporary proto.
- Returns
- Ptr to new temporary proto.
- Note
- Globals: none
-
Exceptions: none
-
History: Thu Mar 14 13:31:31 1991, DSJ, Created.
Definition at line 254 of file adaptive.cpp.
void * alloc_struct(inT32 count, const char *)
◆ ReadAdaptedClass()
Read an adapted class description from File and return a ptr to the adapted class.
- Parameters
-
File | open file to read adapted class from |
- Returns
- Ptr to new adapted class.
- Note
- Globals: none
-
Exceptions: none
-
History: Tue Mar 19 14:11:01 1991, DSJ, Created.
Definition at line 313 of file adaptive.cpp.
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))
BIT_VECTOR NewBitVector(int NumBits)
#define WordsInVectorOfSize(NumBits)
TEMP_PROTO_STRUCT * TEMP_PROTO
LIST push_last(LIST list, void *item)
PERM_CONFIG ReadPermConfig(FILE *File)
TEMP_CONFIG ReadTempConfig(FILE *File)
#define test_bit(array, bit)
void * alloc_struct(inT32 count, const char *)
ADAPT_CLASS_STRUCT * ADAPT_CLASS
◆ ReadPermConfig()
Read a permanent configuration description from File and return a ptr to it.
- Parameters
-
File | open file to read permanent config from |
- Returns
- Ptr to new permanent configuration description.
- Note
- Globals: none
-
Exceptions: none
-
History: Tue Mar 19 14:25:26 1991, DSJ, Created.
Definition at line 402 of file adaptive.cpp.
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);
PERM_CONFIG_STRUCT * PERM_CONFIG
void * alloc_struct(inT32 count, const char *)
◆ ReadTempConfig()
Read a temporary configuration description from File and return a ptr to it.
- Parameters
-
File | open file to read temporary config from |
- Returns
- Ptr to new temporary configuration description.
- Note
- Globals: none
-
Exceptions: none
-
History: Tue Mar 19 14:29:59 1991, DSJ, Created.
Definition at line 429 of file adaptive.cpp.
434 "TEMP_CONFIG_STRUCT");
439 Config->ProtoVectorSize, File);
BIT_VECTOR NewBitVector(int NumBits)
void * alloc_struct(inT32 count, const char *)
TEMP_CONFIG_STRUCT * TEMP_CONFIG
◆ WriteAdaptedClass()
void WriteAdaptedClass |
( |
FILE * |
File, |
|
|
ADAPT_CLASS |
Class, |
|
|
int |
NumConfigs |
|
) |
| |
This routine writes a binary representation of Class to File.
- Parameters
-
File | open file to write Class to |
Class | adapted class to write to File |
NumConfigs | number of configs in Class |
- Note
- Globals: none
-
Exceptions: none
-
History: Tue Mar 19 13:33:51 1991, DSJ, Created.
Definition at line 459 of file adaptive.cpp.
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))
#define WordsInVectorOfSize(NumBits)
void WritePermConfig(FILE *File, PERM_CONFIG Config)
#define test_bit(array, bit)
void WriteTempConfig(FILE *File, TEMP_CONFIG Config)
◆ WritePermConfig()
void WritePermConfig |
( |
FILE * |
File, |
|
|
PERM_CONFIG |
Config |
|
) |
| |
This routine writes a binary representation of a permanent configuration to File.
- Parameters
-
File | open file to write Config to |
Config | permanent config to write to File |
- Note
- Globals: none
-
Exceptions: none
-
History: Tue Mar 19 13:55:44 1991, DSJ, Created.
Definition at line 535 of file adaptive.cpp.
539 while (
Config->Ambigs[NumAmbigs] > 0) ++NumAmbigs;
541 fwrite((
char *) &NumAmbigs,
sizeof(
uinT8), 1, File);
543 fwrite(&(
Config->FontinfoId),
sizeof(
int), 1, File);
◆ WriteTempConfig()
void WriteTempConfig |
( |
FILE * |
File, |
|
|
TEMP_CONFIG |
Config |
|
) |
| |
This routine writes a binary representation of a temporary configuration to File.
- Parameters
-
File | open file to write Config to |
Config | temporary config to write to File |
- Note
- Globals: none
-
Exceptions: none
-
History: Tue Mar 19 14:00:28 1991, DSJ, Created.
Definition at line 559 of file adaptive.cpp.
562 assert (
Config->ContextsSeen == NULL);
566 Config->ProtoVectorSize, File);