#include "oldlist.h"
#include "intproto.h"
#include <stdio.h>
Go to the source code of this file.
#define ConfigIsPermanent |
( |
|
Class, |
|
|
|
ConfigId |
|
) |
| (test_bit ((Class)->PermConfigs, ConfigId)) |
#define IncreaseConfidence |
( |
|
TempConfig | ) |
((TempConfig)->NumTimesSeen++) |
#define IsEmptyAdaptedClass |
( |
|
Class | ) |
|
Value:((Class)->NumPermConfigs == 0 && \
Definition at line 90 of file adaptive.h.
#define MakeConfigPermanent |
( |
|
Class, |
|
|
|
ConfigId |
|
) |
| (SET_BIT ((Class)->PermConfigs, ConfigId)) |
#define MakeProtoPermanent |
( |
|
Class, |
|
|
|
ProtoId |
|
) |
| (SET_BIT ((Class)->PermProtos, ProtoId)) |
#define NumNonEmptyClassesIn |
( |
|
Template | ) |
((Template)->NumNonEmptyClasses) |
#define PermConfigFor |
( |
|
Class, |
|
|
|
ConfigId |
|
) |
| ((Class)->Config[ConfigId].Perm) |
#define TempConfigFor |
( |
|
Class, |
|
|
|
ConfigId |
|
) |
| ((Class)->Config[ConfigId].Temp) |
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;
INT_CLASS NewIntClass(int MaxNumProtos, int MaxNumConfigs)
ADAPT_CLASS Class[MAX_NUM_CLASSES]
void AddIntClass(INT_TEMPLATES Templates, CLASS_ID ClassId, INT_CLASS Class)
#define UnusedClassIdIn(T, c)
Definition at line 136 of file adaptive.cpp.
void FreeBitVector(BIT_VECTOR BitVector)
#define PermConfigFor(Class, ConfigId)
#define ConfigIsPermanent(Class, ConfigId)
#define TempConfigFor(Class, ConfigId)
void FreePermConfig(PERM_CONFIG Config)
void destroy_nodes(LIST list, void_dest destructor)
void FreeTempProto(void *arg)
void FreeTempConfig(TEMP_CONFIG Config)
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)
ADAPT_CLASS Class[MAX_NUM_CLASSES]
void free_int_templates(INT_TEMPLATES templates)
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.
81 assert (Config !=
NULL);
void memfree(void *element)
void FreeBitVector(BIT_VECTOR BitVector)
void destroy_nodes(LIST list, void_dest destructor)
void free_struct(void *deadstruct, inT32, const char *)
void FreeTempProto |
( |
void * |
arg | ) |
|
Definition at line 90 of file adaptive.cpp.
void free_struct(void *deadstruct, inT32, const char *)
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 zero_all_bits(array, length)
#define WordsInVectorOfSize(NumBits)
BIT_VECTOR NewBitVector(int NumBits)
ADAPT_CLASS_STRUCT * ADAPT_CLASS
#define TempConfigFor(Class, ConfigId)
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");
#define zero_all_bits(array, length)
#define WordsInVectorOfSize(NumBits)
BIT_VECTOR NewBitVector(int NumBits)
void * alloc_struct(inT32 count, const char *)
TEMP_CONFIG_STRUCT * TEMP_CONFIG
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 *)
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.
333 fread ((
char *) &NumTempProtos,
sizeof (
int), 1, File);
335 for (i = 0; i < NumTempProtos; i++) {
338 "TEMP_PROTO_STRUCT");
344 fread ((
char *) &NumConfigs,
sizeof (
int), 1, File);
345 for (i = 0; i < NumConfigs; i++)
#define WordsInVectorOfSize(NumBits)
TEMP_CONFIG ReadTempConfig(FILE *File)
BIT_VECTOR NewBitVector(int NumBits)
#define test_bit(array, bit)
ADAPTED_CONFIG Config[MAX_NUM_CONFIGS]
ADAPT_CLASS_STRUCT * ADAPT_CLASS
PERM_CONFIG ReadPermConfig(FILE *File)
TEMP_PROTO_STRUCT * TEMP_PROTO
LIST push_last(LIST list, void *item)
void * alloc_struct(inT32 count, const char *)
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 *)
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");
BIT_VECTOR NewBitVector(int NumBits)
void * alloc_struct(inT32 count, const char *)
TEMP_CONFIG_STRUCT * TEMP_CONFIG
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.
475 fwrite ((
char *) &NumTempProtos,
sizeof (
int), 1, File);
483 fwrite ((
char *) &NumConfigs,
sizeof (
int), 1, File);
484 for (i = 0; i < NumConfigs; i++)
#define WordsInVectorOfSize(NumBits)
#define test_bit(array, bit)
void WritePermConfig(FILE *File, PERM_CONFIG Config)
ADAPTED_CONFIG Config[MAX_NUM_CONFIGS]
void WriteTempConfig(FILE *File, TEMP_CONFIG Config)
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.
538 assert (Config !=
NULL);
539 while (Config->
Ambigs[NumAmbigs] > 0) ++NumAmbigs;
541 fwrite((
char *) &NumAmbigs,
sizeof(
uinT8), 1, File);
543 fwrite(&(Config->
FontinfoId),
sizeof(
int), 1, File);
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.
560 assert (Config !=
NULL);