Fixed name collisions mostly with stl

git-svn-id: https://tesseract-ocr.googlecode.com/svn/trunk@41 d0cd1f9f-072b-0410-8dd7-cf729c803f20
This commit is contained in:
theraysmith 2007-05-16 01:30:20 +00:00
parent 081fdd5414
commit fb2e23f6de
10 changed files with 133 additions and 136 deletions

View File

@ -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);
}

View File

@ -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);
}
@ -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)
@ -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) {
@ -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
@ -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) {
@ -2782,5 +2782,3 @@ double InvertMatrix(const float* input, int size, float* inv) {
}
return error_sum;
}

View File

@ -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;
@ -472,7 +472,7 @@ void WriteProtoList(
/* write prototypes */
iterate(ProtoList)
{
Proto = (PROTOTYPE *) first ( ProtoList );
Proto = (PROTOTYPE *) first_node ( ProtoList );
if (( Proto->Significant && WriteSigProtos ) ||
( ! Proto->Significant && WriteInsigProtos ) )
WritePrototype( File, N, Proto );

View File

@ -56,7 +56,7 @@ 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

View File

@ -334,7 +334,7 @@ void ComputeOutlineStats(LIST Outlines, OUTLINE_STATS *OutlineStats) {
InitOutlineStats(OutlineStats);
iterate(Outlines) {
Outline = (MFOUTLINE) first (Outlines);
Outline = (MFOUTLINE) first_node (Outlines);
Last = PointAt (Outline);
Outline = NextPointAfter (Outline);
@ -484,7 +484,7 @@ void FreeMFOutline(void *arg) { //MFOUTLINE Outline
Start = rest (Outline);
set_rest(Outline, NIL);
while (Start != NULL) {
c_free_struct (first (Start), sizeof (MFEDGEPT), "MFEDGEPT");
c_free_struct (first_node (Start), sizeof (MFEDGEPT), "MFEDGEPT");
Start = pop (Start);
}
@ -714,7 +714,7 @@ void NormalizeOutlines(LIST Outlines,
*YScale = CharNormRange * BaselineScale / *YScale;
iterate(Outlines) {
Outline = (MFOUTLINE) first (Outlines);
Outline = (MFOUTLINE) first_node (Outlines);
CharNormalizeOutline (Outline,
OutlineStats.x, OutlineStats.y,
*XScale, *YScale);
@ -723,7 +723,7 @@ void NormalizeOutlines(LIST Outlines,
case baseline:
iterate(Outlines) {
Outline = (MFOUTLINE) first (Outlines);
Outline = (MFOUTLINE) first_node (Outlines);
NormalizeOutline (Outline, LineStats, 0.0);
}
*XScale = *YScale = ComputeScaleFactor (LineStats);

View File

@ -165,7 +165,7 @@ CHAR_FEATURES BlobMicroFeatures(TBLOB *Blob, LINE_STATS *LineStats) {
RemainingOutlines = Outlines;
iterate(RemainingOutlines) {
Outline = (MFOUTLINE) first (RemainingOutlines);
Outline = (MFOUTLINE) first_node (RemainingOutlines);
CharNormalizeOutline (Outline,
results.Xmean, results.Ymean,
XScale, YScale);
@ -173,7 +173,7 @@ CHAR_FEATURES BlobMicroFeatures(TBLOB *Blob, LINE_STATS *LineStats) {
RemainingOutlines = Outlines;
iterate(RemainingOutlines) {
Outline = (MFOUTLINE) first (RemainingOutlines);
Outline = (MFOUTLINE) first_node (RemainingOutlines);
FindDirectionChanges(Outline, MinSlope, MaxSlope);
FilterEdgeNoise(Outline, NoiseSegmentLength);
MarkDirectionChanges(Outline);

View File

@ -32,7 +32,7 @@
#include <math.h>
/* define default filenames for training data */
#define NORM_PROTO_FILE "tessdata/normproto"
#define NORM_PROTO_FILE "normproto"
typedef struct
{
@ -70,7 +70,6 @@ make_float_var (NormAdjMidpoint, 32.0, MakeNormAdjMidpoint,
15, 16, SetNormAdjMidpoint, "Norm adjust midpoint ...")
make_float_var (NormAdjCurl, 2.0, MakeNormAdjCurl,
15, 17, SetNormAdjCurl, "Norm adjust curl ...")
//extern char *demodir;
/**----------------------------------------------------------------------------
Public Code
----------------------------------------------------------------------------**/
@ -119,7 +118,7 @@ FLOAT32 ComputeNormMatch(CLASS_ID ClassId, FEATURE Feature, BOOL8 DebugMatch) {
ProtoId = 0;
iterate(Protos) {
Proto = (PROTOTYPE *) first (Protos);
Proto = (PROTOTYPE *) first_node (Protos);
Delta = ParamOf (Feature, CharNormY) - Proto->Mean[CharNormY];
Match = Delta * Delta * Proto->Weight.Elliptical[CharNormY];
Delta = ParamOf (Feature, CharNormRx) - Proto->Mean[CharNormRx];
@ -157,11 +156,11 @@ void GetNormProtos() {
** History: Wed Dec 19 16:24:25 1990, DSJ, Created.
*/
FILE *File;
char name[1024];
STRING name;
strcpy(name, demodir);
strcat(name, NormProtoFile);
File = Efopen (name, "r");
name = language_data_path_prefix;
name += NormProtoFile;
File = Efopen (name.string(), "r");
NormProtos = ReadNormProtos (File);
fclose(File);

View File

@ -88,7 +88,7 @@ FEATURE_SET ExtractOutlineFeatures(TBLOB *Blob, LINE_STATS *LineStats) {
NormalizeOutlines(Outlines, LineStats, &XScale, &YScale);
RemainingOutlines = Outlines;
iterate(RemainingOutlines) {
Outline = (MFOUTLINE) first (RemainingOutlines);
Outline = (MFOUTLINE) first_node (RemainingOutlines);
/*---------Debug--------------------------------------------------*
OFile = fopen ("f:/ims/debug/ofOutline.logCPP", "r");
if (OFile == NULL)

View File

@ -101,7 +101,7 @@ FEATURE_SET ExtractPicoFeatures(TBLOB *Blob, LINE_STATS *LineStats) {
NormalizeOutlines(Outlines, LineStats, &XScale, &YScale);
RemainingOutlines = Outlines;
iterate(RemainingOutlines) {
Outline = (MFOUTLINE) first (RemainingOutlines);
Outline = (MFOUTLINE) first_node (RemainingOutlines);
/*---------Debug--------------------------------------------------*
OFile = fopen ("f:/ims/debug/pfOutline.logCPP", "r");
if (OFile == NULL)

View File

@ -136,7 +136,7 @@ void MainSignalHandler(int Signal) {
Items = SignalMenus[Signal];
iterate(Items) {
MenuItem = (SIG_MENU_ITEM *) first (Items);
MenuItem = (SIG_MENU_ITEM *) first_node (Items);
cprintf ("%d. %s\n", MenuItem->ItemNum, MenuItem->ItemLabel);
}
cprintf ("\nEnter Selection: ");
@ -155,7 +155,7 @@ void MainSignalHandler(int Signal) {
Items = SignalMenus[Signal];
iterate(Items) {
MenuItem = (SIG_MENU_ITEM *) first (Items);
MenuItem = (SIG_MENU_ITEM *) first_node (Items);
if (Command == MenuItem->ItemNum) {
if ((*MenuItem->ItemFunc) ( /*Params */ ) == SIG_RESUME)
signal(Signal, MainSignalHandler);