Skip to content

Commit

Permalink
Removed obfuscatory 'access' macros: see issue#76
Browse files Browse the repository at this point in the history
git-svn-id: https://tesseract-ocr.googlecode.com/svn/trunk@219 d0cd1f9f-072b-0410-8dd7-cf729c803f20
  • Loading branch information
theraysmith committed Mar 10, 2009
1 parent 5c964ea commit ff3d550
Show file tree
Hide file tree
Showing 32 changed files with 643 additions and 966 deletions.
45 changes: 22 additions & 23 deletions classify/adaptive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ void FreeTempConfig(TEMP_CONFIG Config) {

destroy_nodes (Config->ContextsSeen, memfree);
FreeBitVector (Config->Protos);
c_free_struct (Config, sizeof (TEMP_CONFIG_STRUCT), "TEMP_CONFIG_STRUCT");
free_struct (Config, sizeof (TEMP_CONFIG_STRUCT), "TEMP_CONFIG_STRUCT");

} /* FreeTempConfig */

Expand All @@ -94,7 +94,7 @@ void FreeTempConfig(TEMP_CONFIG Config) {
void FreeTempProto(void *arg) {
PROTO proto = (PROTO) arg;

c_free_struct (proto, sizeof (TEMP_PROTO_STRUCT), "TEMP_PROTO_STRUCT");
free_struct (proto, sizeof (TEMP_PROTO_STRUCT), "TEMP_PROTO_STRUCT");
}


Expand Down Expand Up @@ -174,12 +174,12 @@ ADAPT_TEMPLATES NewAdaptedTemplates() {
} /* NewAdaptedTemplates */


/*-------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------*/
void free_adapted_templates(ADAPT_TEMPLATES templates) {

if (templates != NULL) {
int i;
for (i = 0; i < NumClassesIn (templates->Templates); i++)
for (i = 0; i < (templates->Templates)->NumClasses; i++)
free_adapted_class (templates->Class[i]);
free_int_templates (templates->Templates);
Efree(templates);
Expand All @@ -203,7 +203,7 @@ TEMP_CONFIG NewTempConfig(int MaxProtoId) {
int NumProtos = MaxProtoId + 1;

Config =
(TEMP_CONFIG) c_alloc_struct (sizeof (TEMP_CONFIG_STRUCT),
(TEMP_CONFIG) alloc_struct (sizeof (TEMP_CONFIG_STRUCT),
"TEMP_CONFIG_STRUCT");
Config->Protos = NewBitVector (NumProtos);

Expand All @@ -229,7 +229,7 @@ TEMP_PROTO NewTempProto() {
** History: Thu Mar 14 13:31:31 1991, DSJ, Created.
*/
return ((TEMP_PROTO)
c_alloc_struct (sizeof (TEMP_PROTO_STRUCT), "TEMP_PROTO_STRUCT"));
alloc_struct (sizeof (TEMP_PROTO_STRUCT), "TEMP_PROTO_STRUCT"));
} /* NewTempProto */


Expand All @@ -253,19 +253,19 @@ void PrintAdaptedTemplates(FILE *File, ADAPT_TEMPLATES Templates) {
#ifndef SECURE_NAMES
fprintf (File, "\n\nSUMMARY OF ADAPTED TEMPLATES:\n\n");
fprintf (File, "Num classes = %d; Num permanent classes = %d\n\n",
NumClassesIn (Templates->Templates), Templates->NumPermClasses);
(Templates->Templates)->NumClasses, Templates->NumPermClasses);
fprintf (File, "Index Id NC NPC NP NPP\n");
fprintf (File, "------------------------\n");

for (i = 0; i < NumClassesIn (Templates->Templates); i++) {
IClass = ClassForIndex (Templates->Templates, i);
for (i = 0; i < (Templates->Templates)->NumClasses; i++) {
IClass = Templates->Templates->Class[i];
AClass = Templates->Class[i];

fprintf (File, "%5d %s %3d %3d %3d %3d\n",
i, unicharset.id_to_unichar(ClassIdForIndex (Templates->Templates, i)),
NumIntConfigsIn (IClass), AClass->NumPermConfigs,
NumIntProtosIn (IClass),
NumIntProtosIn (IClass) - count (AClass->TempProtos));
i, unicharset.id_to_unichar(Templates->Templates->ClassIdFor[i]),
IClass->NumConfigs, AClass->NumPermConfigs,
IClass->NumProtos,
IClass->NumProtos - count (AClass->TempProtos));
}
#endif
fprintf (File, "\n");
Expand Down Expand Up @@ -308,7 +308,7 @@ ADAPT_CLASS ReadAdaptedClass(FILE *File) {
Class->TempProtos = NIL;
for (i = 0; i < NumTempProtos; i++) {
TempProto =
(TEMP_PROTO) c_alloc_struct (sizeof (TEMP_PROTO_STRUCT),
(TEMP_PROTO) alloc_struct (sizeof (TEMP_PROTO_STRUCT),
"TEMP_PROTO_STRUCT");
fread ((char *) TempProto, sizeof (TEMP_PROTO_STRUCT), 1, File);
Class->TempProtos = push_last (Class->TempProtos, TempProto);
Expand All @@ -319,8 +319,8 @@ ADAPT_CLASS ReadAdaptedClass(FILE *File) {
for (i = 0; i < NumConfigs; i++)
if (test_bit (Class->PermConfigs, i))
Class->Config[i].Perm = ReadPermConfig (File);
else
Class->Config[i].Temp = ReadTempConfig (File);
else
Class->Config[i].Temp = ReadTempConfig (File);

return (Class);

Expand Down Expand Up @@ -350,7 +350,7 @@ ADAPT_TEMPLATES ReadAdaptedTemplates(FILE *File) {
Templates->Templates = ReadIntTemplates (File, FALSE);

/* then read in the adaptive info for each class */
for (i = 0; i < NumClassesIn (Templates->Templates); i++) {
for (i = 0; i < (Templates->Templates)->NumClasses; i++) {
Templates->Class[i] = ReadAdaptedClass (File);
}
return (Templates);
Expand Down Expand Up @@ -398,7 +398,7 @@ TEMP_CONFIG ReadTempConfig(FILE *File) {
TEMP_CONFIG Config;

Config =
(TEMP_CONFIG) c_alloc_struct (sizeof (TEMP_CONFIG_STRUCT),
(TEMP_CONFIG) alloc_struct (sizeof (TEMP_CONFIG_STRUCT),
"TEMP_CONFIG_STRUCT");
fread ((char *) Config, sizeof (TEMP_CONFIG_STRUCT), 1, File);

Expand Down Expand Up @@ -452,8 +452,8 @@ void WriteAdaptedClass(FILE *File, ADAPT_CLASS Class, int NumConfigs) {
for (i = 0; i < NumConfigs; i++)
if (test_bit (Class->PermConfigs, i))
WritePermConfig (File, Class->Config[i].Perm);
else
WriteTempConfig (File, Class->Config[i].Temp);
else
WriteTempConfig (File, Class->Config[i].Temp);

} /* WriteAdaptedClass */

Expand All @@ -479,10 +479,9 @@ void WriteAdaptedTemplates(FILE *File, ADAPT_TEMPLATES Templates) {
WriteIntTemplates (File, Templates->Templates, unicharset);

/* then write out the adaptive info for each class */
for (i = 0; i < NumClassesIn (Templates->Templates); i++) {
for (i = 0; i < (Templates->Templates)->NumClasses; i++) {
WriteAdaptedClass (File, Templates->Class[i],
NumIntConfigsIn (ClassForIndex
(Templates->Templates, i)));
Templates->Templates->Class[i]->NumConfigs);
}
} /* WriteAdaptedTemplates */

Expand Down
Loading

0 comments on commit ff3d550

Please sign in to comment.