Skip to content

Commit

Permalink
Fixed name collisions mostly with stl
Browse files Browse the repository at this point in the history
git-svn-id: https://tesseract-ocr.googlecode.com/svn/trunk@41 d0cd1f9f-072b-0410-8dd7-cf729c803f20
  • Loading branch information
theraysmith committed May 16, 2007
1 parent 081fdd5 commit fb2e23f
Show file tree
Hide file tree
Showing 10 changed files with 133 additions and 136 deletions.
40 changes: 20 additions & 20 deletions classify/adaptive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ int AddAdaptedClass(ADAPT_TEMPLATES Templates,


/*---------------------------------------------------------------------------*/
void FreeTempConfig(TEMP_CONFIG Config) {
void FreeTempConfig(TEMP_CONFIG Config) {
/*
** Parameters:
** Config config to be freed
Expand All @@ -90,15 +90,15 @@ void FreeTempConfig(TEMP_CONFIG Config) {


/*---------------------------------------------------------------------------*/
void FreeTempProto(void *arg) {
void FreeTempProto(void *arg) {
PROTO proto = (PROTO) arg;

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


/*---------------------------------------------------------------------------*/
ADAPT_CLASS NewAdaptedClass() {
ADAPT_CLASS NewAdaptedClass() {
/*
** Parameters: none
** Globals: none
Expand Down Expand Up @@ -129,7 +129,7 @@ ADAPT_CLASS NewAdaptedClass() {


/*-------------------------------------------------------------------------*/
void free_adapted_class(ADAPT_CLASS adapt_class) {
void free_adapted_class(ADAPT_CLASS adapt_class) {
int i;

for (i = 0; i < MAX_NUM_CONFIGS; i++) {
Expand All @@ -143,12 +143,12 @@ void free_adapted_class(ADAPT_CLASS adapt_class) {
FreeBitVector (adapt_class->PermProtos);
FreeBitVector (adapt_class->PermConfigs);
destroy_nodes (adapt_class->TempProtos, FreeTempProto);
Efree(adapt_class);
Efree(adapt_class);
}


/*---------------------------------------------------------------------------*/
ADAPT_TEMPLATES NewAdaptedTemplates() {
ADAPT_TEMPLATES NewAdaptedTemplates() {
/*
** Parameters: none
** Globals: none
Expand All @@ -174,20 +174,20 @@ ADAPT_TEMPLATES NewAdaptedTemplates() {


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

if (templates != NULL) {
int i;
for (i = 0; i < NumClassesIn (templates->Templates); i++)
free_adapted_class (templates->Class[i]);
free_int_templates (templates->Templates);
Efree(templates);
Efree(templates);
}
}


/*---------------------------------------------------------------------------*/
TEMP_CONFIG NewTempConfig(int MaxProtoId) {
TEMP_CONFIG NewTempConfig(int MaxProtoId) {
/*
** Parameters:
** MaxProtoId max id of any proto in new config
Expand Down Expand Up @@ -218,7 +218,7 @@ TEMP_CONFIG NewTempConfig(int MaxProtoId) {


/*---------------------------------------------------------------------------*/
TEMP_PROTO NewTempProto() {
TEMP_PROTO NewTempProto() {
/*
** Parameters: none
** Globals: none
Expand All @@ -233,7 +233,7 @@ TEMP_PROTO NewTempProto() {


/*---------------------------------------------------------------------------*/
void PrintAdaptedTemplates(FILE *File, ADAPT_TEMPLATES Templates) {
void PrintAdaptedTemplates(FILE *File, ADAPT_TEMPLATES Templates) {
/*
** Parameters:
** File open text file to print Templates to
Expand Down Expand Up @@ -273,7 +273,7 @@ void PrintAdaptedTemplates(FILE *File, ADAPT_TEMPLATES Templates) {


/*---------------------------------------------------------------------------*/
ADAPT_CLASS ReadAdaptedClass(FILE *File) {
ADAPT_CLASS ReadAdaptedClass(FILE *File) {
/*
** Parameters:
** File open file to read adapted class from
Expand Down Expand Up @@ -327,7 +327,7 @@ ADAPT_CLASS ReadAdaptedClass(FILE *File) {


/*---------------------------------------------------------------------------*/
ADAPT_TEMPLATES ReadAdaptedTemplates(FILE *File) {
ADAPT_TEMPLATES ReadAdaptedTemplates(FILE *File) {
/*
** Parameters:
** File open text file to read adapted templates from
Expand Down Expand Up @@ -358,7 +358,7 @@ ADAPT_TEMPLATES ReadAdaptedTemplates(FILE *File) {


/*---------------------------------------------------------------------------*/
PERM_CONFIG ReadPermConfig(FILE *File) {
PERM_CONFIG ReadPermConfig(FILE *File) {
/*
** Parameters:
** File open file to read permanent config from
Expand All @@ -383,7 +383,7 @@ PERM_CONFIG ReadPermConfig(FILE *File) {


/*---------------------------------------------------------------------------*/
TEMP_CONFIG ReadTempConfig(FILE *File) {
TEMP_CONFIG ReadTempConfig(FILE *File) {
/*
** Parameters:
** File open file to read temporary config from
Expand Down Expand Up @@ -411,7 +411,7 @@ TEMP_CONFIG ReadTempConfig(FILE *File) {


/*---------------------------------------------------------------------------*/
void WriteAdaptedClass(FILE *File, ADAPT_CLASS Class, int NumConfigs) {
void WriteAdaptedClass(FILE *File, ADAPT_CLASS Class, int NumConfigs) {
/*
** Parameters:
** File open file to write Class to
Expand Down Expand Up @@ -442,7 +442,7 @@ void WriteAdaptedClass(FILE *File, ADAPT_CLASS Class, int NumConfigs) {
fwrite ((char *) &NumTempProtos, sizeof (int), 1, File);
TempProtos = Class->TempProtos;
iterate (TempProtos) {
void* proto = first(TempProtos);
void* proto = first_node(TempProtos);
fwrite ((char *) proto, sizeof (TEMP_PROTO_STRUCT), 1, File);
}

Expand All @@ -458,7 +458,7 @@ void WriteAdaptedClass(FILE *File, ADAPT_CLASS Class, int NumConfigs) {


/*---------------------------------------------------------------------------*/
void WriteAdaptedTemplates(FILE *File, ADAPT_TEMPLATES Templates) {
void WriteAdaptedTemplates(FILE *File, ADAPT_TEMPLATES Templates) {
/*
** Parameters:
** File open text file to write Templates to
Expand Down Expand Up @@ -487,7 +487,7 @@ void WriteAdaptedTemplates(FILE *File, ADAPT_TEMPLATES Templates) {


/*---------------------------------------------------------------------------*/
void WritePermConfig(FILE *File, PERM_CONFIG Config) {
void WritePermConfig(FILE *File, PERM_CONFIG Config) {
/*
** Parameters:
** File open file to write Config to
Expand All @@ -511,7 +511,7 @@ void WritePermConfig(FILE *File, PERM_CONFIG Config) {


/*---------------------------------------------------------------------------*/
void WriteTempConfig(FILE *File, TEMP_CONFIG Config) {
void WriteTempConfig(FILE *File, TEMP_CONFIG Config) {
/*
** Parameters:
** File open file to write Config to
Expand Down
12 changes: 5 additions & 7 deletions classify/cluster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ void FreeClusterer(CLUSTERER *Clusterer) {
if (Clusterer->Root != NULL)
FreeCluster (Clusterer->Root);
iterate (Clusterer->ProtoList) {
((PROTOTYPE *) (first (Clusterer->ProtoList)))->Cluster = NULL;
((PROTOTYPE *) (first_node (Clusterer->ProtoList)))->Cluster = NULL;
}
memfree(Clusterer);
}
Expand Down Expand Up @@ -629,7 +629,7 @@ CLUSTER *NextSample(LIST *SearchState) {

if (*SearchState == NIL)
return (NULL);
Cluster = (CLUSTER *) first (*SearchState);
Cluster = (CLUSTER *) first_node (*SearchState);
*SearchState = pop (*SearchState);
while (TRUE) {
if (Cluster->Left == NULL)
Expand Down Expand Up @@ -971,7 +971,7 @@ void ComputePrototypes(CLUSTERER *Clusterer, CLUSTERCONFIG *Config) {
// remove the next cluster to be analyzed from the stack
// try to make a prototype from the cluster
// if successful, put it on the proto list, else split the cluster
Cluster = (CLUSTER *) first (ClusterStack);
Cluster = (CLUSTER *) first_node (ClusterStack);
ClusterStack = pop (ClusterStack);
Prototype = MakePrototype (Clusterer, Config, Cluster);
if (Prototype != NULL) {
Expand Down Expand Up @@ -1709,7 +1709,7 @@ BUCKETS *GetBuckets(DISTRIBUTION Distribution,

// search for an old bucket structure with the same number of buckets
NumberOfBuckets = OptimumNumberOfBuckets (SampleCount);
Buckets = (BUCKETS *) first (search (OldBuckets[(int) Distribution],
Buckets = (BUCKETS *) first_node (search (OldBuckets[(int) Distribution],
&NumberOfBuckets, NumBucketsMatch));

// if a matching bucket structure is found, delete it from the list
Expand Down Expand Up @@ -1922,7 +1922,7 @@ ComputeChiSquared (UINT16 DegreesOfFreedom, FLOAT64 Alpha)
for the specified number of degrees of freedom. Search the list for
the desired chi-squared. */
SearchKey.Alpha = Alpha;
OldChiSquared = (CHISTRUCT *) first (search (ChiWith[DegreesOfFreedom],
OldChiSquared = (CHISTRUCT *) first_node (search (ChiWith[DegreesOfFreedom],
&SearchKey, AlphaMatch));

if (OldChiSquared == NULL) {
Expand Down Expand Up @@ -2782,5 +2782,3 @@ double InvertMatrix(const float* input, int size, float* inv) {
}
return error_sum;
}


30 changes: 15 additions & 15 deletions classify/clusttool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Return: Sample size
Exceptions: ILLEGALSAMPLESIZE illegal format or range
History: 6/6/89, DSJ, Created.
******************************************************************************/
UINT16 ReadSampleSize(FILE *File) {
UINT16 ReadSampleSize(FILE *File) {
int SampleSize;

if ((fscanf (File, "%d", &SampleSize) != 1) ||
Expand All @@ -65,11 +65,11 @@ Exceptions: ILLEGALCIRCULARSPEC
ILLEGALMINMAXSPEC
History: 6/6/89, DSJ, Created.
******************************************************************************/
PARAM_DESC *ReadParamDesc(FILE *File, UINT16 N) {
PARAM_DESC *ReadParamDesc(FILE *File, UINT16 N) {
int i;
PARAM_DESC *ParamDesc;
char Token[TOKENSIZE];

ParamDesc = (PARAM_DESC *) Emalloc (N * sizeof (PARAM_DESC));
for (i = 0; i < N; i++) {
if (fscanf (File, "%s", Token) != 1)
Expand All @@ -80,7 +80,7 @@ PARAM_DESC *ReadParamDesc(FILE *File, UINT16 N) {
else
ParamDesc[i].Circular = FALSE;

if (fscanf (File, "%s", Token) != 1)
if (fscanf (File, "%s", Token) != 1)
DoError (ILLEGALESSENTIALSPEC,
"Illegal essential/non-essential spec");
if (Token[0] == 'e')
Expand Down Expand Up @@ -112,7 +112,7 @@ Exceptions: ILLEGALSIGNIFICANCESPEC
ILLEGALDISTRIBUTION
History: 6/6/89, DSJ, Created.
******************************************************************************/
PROTOTYPE *ReadPrototype(FILE *File, UINT16 N) {
PROTOTYPE *ReadPrototype(FILE *File, UINT16 N) {
char Token[TOKENSIZE];
int Status;
PROTOTYPE *Proto;
Expand Down Expand Up @@ -144,7 +144,7 @@ PROTOTYPE *ReadPrototype(FILE *File, UINT16 N) {
Proto->Magnitude.Spherical =
1.0 / sqrt ((double) (2.0 * PI * Proto->Variance.Spherical));
Proto->TotalMagnitude =
pow (Proto->Magnitude.Spherical, (double) N);
pow (Proto->Magnitude.Spherical, (float) N);
Proto->LogMagnitude = log ((double) Proto->TotalMagnitude);
Proto->Weight.Spherical = 1.0 / Proto->Variance.Spherical;
Proto->Distrib = NULL;
Expand Down Expand Up @@ -239,7 +239,7 @@ Return: Prototype style read from text file
Exceptions: ILLEGALSTYLESPEC illegal prototype style specification
History: 6/8/89, DSJ, Created.
*******************************************************************************/
PROTOSTYLE ReadProtoStyle(FILE *File) {
PROTOSTYLE ReadProtoStyle(FILE *File) {
char Token[TOKENSIZE];
PROTOSTYLE Style;

Expand Down Expand Up @@ -343,7 +343,7 @@ Return: None
Exceptions: None
History: 6/12/89, DSJ, Created.
*******************************************************************************/
void WritePrototype(FILE *File, UINT16 N, PROTOTYPE *Proto) {
void WritePrototype(FILE *File, UINT16 N, PROTOTYPE *Proto) {
int i;

if (Proto->Significant)
Expand Down Expand Up @@ -413,7 +413,7 @@ Return: None
Exceptions: None
History: 6/8/89, DSJ, Created.
****************************************************************************/
void WriteProtoStyle(FILE *File, PROTOSTYLE ProtoStyle) {
void WriteProtoStyle(FILE *File, PROTOSTYLE ProtoStyle) {
switch (ProtoStyle) {
case spherical:
fprintf (File, "spherical");
Expand All @@ -438,7 +438,7 @@ void WriteProtoList(
LIST ProtoList,
BOOL8 WriteSigProtos,
BOOL8 WriteInsigProtos)

/*
** Parameters:
** File open text file to write prototypes to
Expand All @@ -464,15 +464,15 @@ void WriteProtoList(

{
PROTOTYPE *Proto;

/* write file header */
fprintf(File,"%0d\n",N);
WriteParamDesc(File,N,ParamDesc);

/* write prototypes */
iterate(ProtoList)
{
Proto = (PROTOTYPE *) first ( ProtoList );
Proto = (PROTOTYPE *) first_node ( ProtoList );
if (( Proto->Significant && WriteSigProtos ) ||
( ! Proto->Significant && WriteInsigProtos ) )
WritePrototype( File, N, Proto );
Expand All @@ -489,8 +489,8 @@ Return: Uniform random number
Exceptions: None
History: 6/6/89, DSJ, Created.
*******************************************************************************/
FLOAT32 UniformRandomNumber(FLOAT32 MMin, FLOAT32 MMax) {
double fake_drand48();
FLOAT32 UniformRandomNumber(FLOAT32 MMin, FLOAT32 MMax) {
double fake_drand48();
FLOAT32 RandomNumber;

RandomNumber = fake_drand48 ();
Expand All @@ -502,6 +502,6 @@ FLOAT32 UniformRandomNumber(FLOAT32 MMin, FLOAT32 MMax) {
Cheap replacement for drand48 which is not available on the PC.
**********************************************************************/

double fake_drand48() {
double fake_drand48() {
return rand () / (RAND_MAX + 1.0);
}
6 changes: 3 additions & 3 deletions classify/mfdefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ typedef FLOAT32 *MICROFEATURE;
#define SecondBulgeOf(M) ( (M)[SECONDBULGE] )

/* macros for accessing micro-feature lists */
#define NextFeatureOf(L) ( (MICROFEATURE) first( L ) )
#define NextFeatureOf(L) ( (MICROFEATURE) first_node ( L ) )

/**----------------------------------------------------------------------------
Public Function Prototypes
----------------------------------------------------------------------------**/
MICROFEATURE NewMicroFeature();
MICROFEATURE NewMicroFeature();

void FreeMicroFeatures(MICROFEATURES MicroFeatures);
void FreeMicroFeatures(MICROFEATURES MicroFeatures);
#endif
Loading

0 comments on commit fb2e23f

Please sign in to comment.