#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 89 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 50 of file adaptive.cpp.
55 assert (Templates != NULL);
56 assert (Class != NULL);
64 assert (Templates->
Class[ClassId] == NULL);
65 Templates->
Class[ClassId] = Class;
#define UnusedClassIdIn(T, c)
void AddIntClass(INT_TEMPLATES Templates, CLASS_ID ClassId, INT_CLASS Class)
ADAPT_CLASS Class[MAX_NUM_CLASSES]
INT_CLASS NewIntClass(int MaxNumProtos, int MaxNumConfigs)
◆ free_adapted_class()
Definition at line 134 of file adaptive.cpp.
void FreeBitVector(BIT_VECTOR BitVector)
void FreeTempConfig(TEMP_CONFIG Config)
#define PermConfigFor(Class, ConfigId)
#define TempConfigFor(Class, ConfigId)
void destroy_nodes(LIST list, void_dest destructor)
void FreeTempProto(void *arg)
void FreePermConfig(PERM_CONFIG Config)
#define ConfigIsPermanent(Class, ConfigId)
◆ free_adapted_templates()
Definition at line 197 of file adaptive.cpp.
199 if (templates != NULL) {
201 for (i = 0; i < (templates->
Templates)->NumClasses; i++)
void free_adapted_class(ADAPT_CLASS adapt_class)
ADAPT_CLASS Class[MAX_NUM_CLASSES]
void free_int_templates(INT_TEMPLATES templates)
◆ 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 81 of file adaptive.cpp.
82 assert (Config != NULL);
void FreeBitVector(BIT_VECTOR BitVector)
◆ FreeTempProto()
void FreeTempProto |
( |
void * |
arg | ) |
|
◆ 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 111 of file adaptive.cpp.
#define WordsInVectorOfSize(NumBits)
ADAPT_CLASS_STRUCT * ADAPT_CLASS
BIT_VECTOR NewBitVector(int NumBits)
#define zero_all_bits(array, length)
#define TempConfigFor(Class, ConfigId)
◆ NewTempConfig()
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 221 of file adaptive.cpp.
222 int NumProtos = MaxProtoId + 1;
#define WordsInVectorOfSize(NumBits)
BIT_VECTOR NewBitVector(int NumBits)
#define zero_all_bits(array, length)
TEMP_CONFIG_STRUCT * TEMP_CONFIG
◆ 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 248 of file adaptive.cpp.
◆ 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 306 of file adaptive.cpp.
325 fp->
FRead(&NumTempProtos,
sizeof(
int), 1);
327 for (i = 0; i < NumTempProtos; i++) {
334 fp->
FRead(&NumConfigs,
sizeof(
int), 1);
335 for (i = 0; i < NumConfigs; i++)
PERM_CONFIG ReadPermConfig(TFile *fp)
ADAPTED_CONFIG Config[MAX_NUM_CONFIGS]
#define WordsInVectorOfSize(NumBits)
LIST push_last(LIST list, void *item)
ADAPT_CLASS_STRUCT * ADAPT_CLASS
TEMP_PROTO_STRUCT * TEMP_PROTO
BIT_VECTOR NewBitVector(int NumBits)
TEMP_CONFIG ReadTempConfig(TFile *fp)
#define test_bit(array, bit)
int FRead(void *buffer, int size, int count)
◆ 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 392 of file adaptive.cpp.
398 Config->
Ambigs[NumAmbigs] = -1;
PERM_CONFIG_STRUCT * PERM_CONFIG
int FRead(void *buffer, int size, int count)
◆ 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 418 of file adaptive.cpp.
BIT_VECTOR NewBitVector(int NumBits)
TEMP_CONFIG_STRUCT * TEMP_CONFIG
int FRead(void *buffer, int size, int count)
◆ 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 443 of file adaptive.cpp.
452 fwrite ((
char *) Class->PermProtos, sizeof (
uinT32),
454 fwrite ((
char *) Class->PermConfigs, sizeof (
uinT32),
458 NumTempProtos =
count (Class->TempProtos);
459 fwrite ((
char *) &NumTempProtos,
sizeof (
int), 1, File);
460 TempProtos = Class->TempProtos;
467 fwrite ((
char *) &NumConfigs,
sizeof (
int), 1, File);
468 for (i = 0; i < NumConfigs; i++)
469 if (
test_bit (Class->PermConfigs, i))
#define WordsInVectorOfSize(NumBits)
void WritePermConfig(FILE *File, PERM_CONFIG Config)
void WriteTempConfig(FILE *File, TEMP_CONFIG Config)
#define test_bit(array, bit)
◆ 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 519 of file adaptive.cpp.
522 assert (Config != NULL);
523 while (Config->
Ambigs[NumAmbigs] > 0) ++NumAmbigs;
525 fwrite((
char *) &NumAmbigs,
sizeof(
uinT8), 1, File);
527 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 543 of file adaptive.cpp.
544 assert (Config != NULL);
547 fwrite ((
char *) Config->Protos, sizeof (
uinT32),
548 Config->ProtoVectorSize, File);