提交 bfd79a97 编写于 作者: T theraysmith

Fixed name collisions mostly with stl

git-svn-id: https://tesseract-ocr.googlecode.com/svn/trunk@37 d0cd1f9f-072b-0410-8dd7-cf729c803f20
上级 af905c0b
......@@ -152,7 +152,7 @@ COLOUR check_path_legal( //certify outline
return MAGENTA;
}
else {
ED_ILLEGAL_SUM.error ("check_path_legal", LOG, "chainsum=%d",
ED_ILLEGAL_SUM.error ("check_path_legal", TESSLOG, "chainsum=%d",
chainsum);
return GREEN;
}
......
......@@ -28,7 +28,7 @@
#include "efio.h"
#include "emalloc.h"
#include "featdefs.h"
#include "getopt.h"
#include "tessopt.h"
#include "ocrfeatures.h"
#include "general.h"
#include "clusttool.h"
......@@ -229,7 +229,7 @@ int main (
iterate(pCharList)
{
//Cluster
CharSample = (LABELEDLIST) first (pCharList);
CharSample = (LABELEDLIST) first_node (pCharList);
printf ("\nClustering %s ...", CharSample->Label);
Clusterer = SetUpForClustering(CharSample);
ProtoList = ClusterSamples(Clusterer, &Config);
......@@ -262,7 +262,7 @@ void ParseArguments(
** ShowSignificantProtos flag controlling proto display
** ShowInsignificantProtos flag controlling proto display
** Config current clustering parameters
** optarg, optind defined by getopt sys call
** optarg, optind defined by tessopt sys call
** Argc, Argv global copies of argc and argv
** Operation:
** This routine parses the command line arguments that were
......@@ -292,7 +292,7 @@ void ParseArguments(
Error = FALSE;
Argc = argc;
Argv = argv;
while (( Option = getopt( argc, argv, "R:N:D:C:I:M:B:S:d:n:p" )) != EOF )
while (( Option = tessopt( argc, argv, "R:N:D:C:I:M:B:S:d:n:p" )) != EOF )
{
switch ( Option )
{
......@@ -375,7 +375,7 @@ char *GetNextFilename ()
/*
** Parameters: none
** Globals:
** optind defined by getopt sys call
** optind defined by tessopt sys call
** Argc, Argv global copies of argc and argv
** Operation:
** This routine returns the next command line argument. If
......@@ -469,7 +469,7 @@ LABELEDLIST FindList (
iterate (List)
{
LabeledList = (LABELEDLIST) first (List);
LabeledList = (LABELEDLIST) first_node (List);
if (strcmp (LabeledList->Label, Label) == 0)
return (LabeledList);
}
......@@ -534,7 +534,7 @@ void WriteTrainingSamples (
iterate (CharList) // iterate thru all of the fonts
{
CharSample = (LABELEDLIST) first (CharList);
CharSample = (LABELEDLIST) first_node (CharList);
// construct the full pathname for the current samples file
strcpy (Filename, "");
......@@ -572,7 +572,7 @@ void WriteTrainingSamples (
{
//if (NumSamples >= MaxNumSamples) break;
FeatureSet = (FEATURE_SET) first (FeatureList);
FeatureSet = (FEATURE_SET) first_node (FeatureList);
WriteFeatureSet (File, FeatureSet);
NumSamples++;
}
......@@ -621,7 +621,7 @@ void WriteNormProtos (
WriteParamDesc(File,Clusterer->SampleSize,Clusterer->ParamDesc);
iterate(LabeledProtoList)
{
LabeledProto = (LABELEDLIST) first (LabeledProtoList);
LabeledProto = (LABELEDLIST) first_node (LabeledProtoList);
N = NumberOfProtos(LabeledProto->List,
ShowSignificantProtos, ShowInsignificantProtos);
Label = NameToChar(LabeledProto->Label);
......@@ -658,11 +658,11 @@ void FreeTrainingSamples (
printf ("\nFreeTrainingSamples...");
iterate (CharList) /* iterate thru all of the fonts */
{
CharSample = (LABELEDLIST) first (CharList);
CharSample = (LABELEDLIST) first_node (CharList);
FeatureList = CharSample->List;
iterate (FeatureList) /* iterate thru all of the classes */
{
FeatureSet = (FEATURE_SET) first (FeatureList);
FeatureSet = (FEATURE_SET) first_node (FeatureList);
FreeFeatureSet (FeatureSet);
}
FreeLabeledList (CharSample);
......@@ -680,7 +680,7 @@ void FreeNormProtoList (
iterate (CharList) /* iterate thru all of the fonts */
{
CharSample = (LABELEDLIST) first (CharList);
CharSample = (LABELEDLIST) first_node (CharList);
FreeLabeledList (CharSample);
}
destroy (CharList);
......@@ -754,7 +754,7 @@ CLUSTERER *SetUpForClustering(
CharID = 0;
iterate(FeatureList)
{
FeatureSet = (FEATURE_SET) first (FeatureList);
FeatureSet = (FEATURE_SET) first_node (FeatureList);
for (i=0; i < FeatureSet->MaxNumFeatures; i++)
{
if (Sample == NULL)
......@@ -785,7 +785,7 @@ void AddToNormProtosList(
LabeledProtoList = NewLabeledList(CharName);
iterate(ProtoList)
{
Proto = (PROTOTYPE *) first (ProtoList);
Proto = (PROTOTYPE *) first_node (ProtoList);
LabeledProtoList->List = push(LabeledProtoList->List, Proto);
}
*NormProtoList = push(*NormProtoList, LabeledProtoList);
......@@ -804,7 +804,7 @@ void WriteProtos(
// write prototypes
iterate(ProtoList)
{
Proto = (PROTOTYPE *) first ( ProtoList );
Proto = (PROTOTYPE *) first_node ( ProtoList );
if (( Proto->Significant && WriteSigProtos ) ||
( ! Proto->Significant && WriteInsigProtos ) )
WritePrototype( File, N, Proto );
......@@ -822,11 +822,10 @@ int NumberOfProtos(
iterate(ProtoList)
{
Proto = (PROTOTYPE *) first ( ProtoList );
Proto = (PROTOTYPE *) first_node ( ProtoList );
if (( Proto->Significant && CountSigProtos ) ||
( ! Proto->Significant && CountInsigProtos ) )
N++;
}
return(N);
}
......@@ -37,8 +37,8 @@ RSC=rc.exe
# PROP BASE Target_Dir ""
# PROP Use_MFC 2
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "..\..\release\"
# PROP Intermediate_Dir "..\..\release\train2"
# PROP Output_Dir "../bin.rel"
# PROP Intermediate_Dir "cntrain.Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
......@@ -50,7 +50,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 /nologo /subsystem:console /profile /debug /machine:I386
# ADD LINK32 /nologo /subsystem:console /profile /debug /machine:I386 /out:"../cnTraining.exe"
!ELSEIF "$(CFG)" == "cnTraining - Win32 Debug"
......@@ -61,8 +61,8 @@ LINK32=link.exe
# PROP BASE Target_Dir ""
# PROP Use_MFC 2
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "..\..\debug"
# PROP Intermediate_Dir "..\..\debug\train2"
# PROP Output_Dir "../bin.dbg"
# PROP Intermediate_Dir "cntrain.Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
......@@ -145,10 +145,6 @@ SOURCE=..\cutil\freelist.cpp
# End Source File
# Begin Source File
SOURCE=..\ccutil\getopt.cpp
# End Source File
# Begin Source File
SOURCE=..\ccutil\globaloc.cpp
# End Source File
# Begin Source File
......@@ -209,6 +205,10 @@ SOURCE=..\cutil\structures.cpp
# End Source File
# Begin Source File
SOURCE=..\ccutil\tessopt.cpp
# End Source File
# Begin Source File
SOURCE=..\ccutil\tprintf.cpp
# End Source File
# Begin Source File
......
......@@ -30,7 +30,7 @@
#include "efio.h"
#include "emalloc.h"
#include "featdefs.h"
#include "getopt.h"
#include "tessopt.h"
#include "ocrfeatures.h"
#include "general.h"
#include "clusttool.h"
......@@ -274,7 +274,7 @@ int main (
iterate(pCharList)
{
//Cluster
CharSample = (LABELEDLIST) first (pCharList);
CharSample = (LABELEDLIST) first_node (pCharList);
printf ("\nClustering %s ...", CharSample->Label);
Clusterer = SetUpForClustering(CharSample);
ProtoList = ClusterSamples(Clusterer, &Config);
......@@ -295,7 +295,7 @@ int main (
pProtoList = ProtoList;
iterate (pProtoList)
{
Prototype = (PROTOTYPE *) first (pProtoList);
Prototype = (PROTOTYPE *) first_node (pProtoList);
// see if proto can be approximated by existing proto
Pid = FindClosestExistingProto (MergeClass->Class, MergeClass->NumMerged, Prototype);
......@@ -367,7 +367,7 @@ char **argv)
** ShowSignificantProtos flag controlling proto display
** ShowInsignificantProtos flag controlling proto display
** Config current clustering parameters
** optarg, optind defined by getopt sys call
** optarg, optind defined by tessopt sys call
** Argc, Argv global copies of argc and argv
** Operation:
** This routine parses the command line arguments that were
......@@ -397,7 +397,7 @@ char **argv)
Error = FALSE;
Argc = argc;
Argv = argv;
while (( Option = getopt( argc, argv, "R:N:D:C:I:M:B:S:d:n:p" )) != EOF )
while (( Option = tessopt( argc, argv, "R:N:D:C:I:M:B:S:d:n:p" )) != EOF )
{
switch ( Option )
{
......@@ -478,7 +478,7 @@ char *GetNextFilename ()
/*
** Parameters: none
** Globals:
** optind defined by getopt sys call
** optind defined by tessopt sys call
** Argc, Argv global copies of argc and argv
** Operation:
** This routine returns the next command line argument. If
......@@ -574,7 +574,7 @@ LABELEDLIST FindList (
iterate (List)
{
LabeledList = (LABELEDLIST) first (List);
LabeledList = (LABELEDLIST) first_node (List);
if (strcmp (LabeledList->Label, Label) == 0)
return (LabeledList);
}
......@@ -591,7 +591,7 @@ MERGE_CLASS FindClass (
iterate (List)
{
MergeClass = (MERGE_CLASS) first (List);
MergeClass = (MERGE_CLASS) first_node (List);
if (strcmp (MergeClass->Label, Label) == 0)
return (MergeClass);
}
......@@ -670,7 +670,7 @@ void WriteTrainingSamples (
iterate (CharList) // iterate thru all of the fonts
{
CharSample = (LABELEDLIST) first (CharList);
CharSample = (LABELEDLIST) first_node (CharList);
// construct the full pathname for the current samples file
strcpy (Filename, "");
......@@ -708,7 +708,7 @@ void WriteTrainingSamples (
{
if (NumSamples >= MaxNumSamples) break;
FeatureSet = (FEATURE_SET) first (FeatureList);
FeatureSet = (FEATURE_SET) first_node (FeatureList);
WriteFeatureSet (File, FeatureSet);
NumSamples++;
}
......@@ -774,7 +774,7 @@ void WriteMergedTrainingSamples(
iterate (ClassList)
{
MergeClass = (MERGE_CLASS) first (ClassList);
MergeClass = (MERGE_CLASS) first_node (ClassList);
strcpy (Filename, "");
if (Directory != NULL)
{
......@@ -827,7 +827,7 @@ void WriteMicrofeat(
printf ("\nWriting Merged %s ...", Filename);
iterate(ClassList)
{
MergeClass = (MERGE_CLASS) first (ClassList);
MergeClass = (MERGE_CLASS) first_node (ClassList);
WriteProtos(File, MergeClass);
WriteConfigs(File, MergeClass->Class);
}
......@@ -903,11 +903,11 @@ void FreeTrainingSamples (
printf ("\nFreeTrainingSamples...");
iterate (CharList) /* iterate thru all of the fonts */
{
CharSample = (LABELEDLIST) first (CharList);
CharSample = (LABELEDLIST) first_node (CharList);
FeatureList = CharSample->List;
iterate (FeatureList) /* iterate thru all of the classes */
{
FeatureSet = (FEATURE_SET) first (FeatureList);
FeatureSet = (FEATURE_SET) first_node (FeatureList);
FreeFeatureSet (FeatureSet);
}
FreeLabeledList (CharSample);
......@@ -937,7 +937,7 @@ void FreeLabeledClassList (
iterate (ClassList) /* iterate thru all of the fonts */
{
MergeClass = (MERGE_CLASS) first (ClassList);
MergeClass = (MERGE_CLASS) first_node (ClassList);
free (MergeClass->Label);
FreeClass(MergeClass->Class);
free (MergeClass);
......@@ -1015,7 +1015,7 @@ CLUSTERER *SetUpForClustering(
{
if (CharID >= MaxNumSamples) break;
FeatureSet = (FEATURE_SET) first (FeatureList);
FeatureSet = (FEATURE_SET) first_node (FeatureList);
for (i=0; i < FeatureSet->MaxNumFeatures; i++)
{
if (Sample == NULL)
......@@ -1051,7 +1051,7 @@ LIST RemoveInsignificantProtos(
pProtoList = ProtoList;
iterate(pProtoList)
{
Proto = (PROTOTYPE *) first (pProtoList);
Proto = (PROTOTYPE *) first_node (pProtoList);
if ((Proto->Significant && KeepSigProtos) ||
(!Proto->Significant && KeepInsigProtos))
{
......@@ -1109,7 +1109,7 @@ void CleanUpUnusedData(
iterate(ProtoList)
{
Prototype = (PROTOTYPE *) first (ProtoList);
Prototype = (PROTOTYPE *) first_node (ProtoList);
if(Prototype->Variance.Elliptical != NULL)
{
memfree(Prototype->Variance.Elliptical);
......@@ -1165,7 +1165,7 @@ void SetUpForFloat2Int(
iterate(LabeledClassList)
{
MergeClass = (MERGE_CLASS) first (LabeledClassList);
MergeClass = (MERGE_CLASS) first_node (LabeledClassList);
Class = &TrainingData[NameToChar(MergeClass->Label)];
NumProtos = NumProtosIn(MergeClass->Class);
NumConfigs = NumConfigsIn(MergeClass->Class);
......
......@@ -37,8 +37,8 @@ RSC=rc.exe
# PROP BASE Target_Dir ""
# PROP Use_MFC 2
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "..\..\release"
# PROP Intermediate_Dir "..\..\release\train"
# PROP Output_Dir "../bin.rel"
# PROP Intermediate_Dir "mftrain.Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
......@@ -50,7 +50,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 /nologo /subsystem:console /profile /debug /machine:I386
# ADD LINK32 /nologo /subsystem:console /profile /debug /machine:I386 /out:"../mfTraining.exe"
!ELSEIF "$(CFG)" == "mfTraining - Win32 Debug"
......@@ -61,8 +61,8 @@ LINK32=link.exe
# PROP BASE Target_Dir ""
# PROP Use_MFC 2
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "..\..\Debug"
# PROP Intermediate_Dir "..\..\Debug\train"
# PROP Output_Dir "../bin.dbg"
# PROP Intermediate_Dir "mftrain.Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
......@@ -144,10 +144,6 @@ SOURCE=..\cutil\freelist.cpp
# End Source File
# Begin Source File
SOURCE=..\ccutil\getopt.cpp
# End Source File
# Begin Source File
SOURCE=..\ccutil\globaloc.cpp
# End Source File
# Begin Source File
......@@ -251,6 +247,10 @@ SOURCE=..\cutil\structures.cpp
# End Source File
# Begin Source File
SOURCE=..\ccutil\tessopt.cpp
# End Source File
# Begin Source File
SOURCE=..\ccutil\tprintf.cpp
# End Source File
# Begin Source File
......
......@@ -63,8 +63,8 @@ void event_handler( //signal handler
// scp->sc_syscall_action=SIG_RESTART; //restart sys calls
event_pending = TRUE;
if (!event_critical_section) {
lock_events();
unlock_events();
lock_events();
unlock_events();
}
}
......@@ -91,7 +91,7 @@ BOOL8 check_event( /*test for event */
// && sbfds[fd].used!=1)
if (fd < 0 || fd > maxsbfd || fd > 0) {
// BADSBFD.error("check_event",LOG,NULL); /*report error*/
// BADSBFD.error("check_event",TESSLOG,NULL); /*report error*/
return FALSE;
}
time = wait ? AWAIT_TIME : CHECK_TIME;
......@@ -100,7 +100,7 @@ BOOL8 check_event( /*test for event */
&& (events_playback.string ()[0] != '\0' || eventsin != NULL)) {
if (eventsin == NULL && events_playback.string ()[0] != '\0') {
if ((eventsin = fopen (events_playback.string (), "r")) == NULL)
CANTOPENFILE.error ("check_event", LOG,
CANTOPENFILE.error ("check_event", TESSLOG,
events_playback.string ());
//remove name
events_playback.set_value (NULL);
......@@ -116,7 +116,7 @@ BOOL8 check_event( /*test for event */
else
fprintf (stderr, "Error on event input: copied %d values\n",
scanresult);
fclose(eventsin);
fclose(eventsin);
eventsin = NULL;
}
else {
......@@ -197,9 +197,9 @@ void event_reader( /*read events */
else
kick_daemon(COUNT_READS); /*got acknowledge */
}
CloseHandle(fd);
CloseHandle(fd);
*fdptr = NULL;
_endthread();
_endthread();
#endif
}
#endif
......@@ -235,7 +235,7 @@ void add_event( /*add an event */
//save name
outname = events_logfile.string ();
if ((eventsout = fopen (outname.string (), "w")) == NULL)
CANTOPENFILE.error ("add_event", LOG, outname.string ());
CANTOPENFILE.error ("add_event", TESSLOG, outname.string ());
}
if (eventsout != NULL)
fprintf (eventsout, "%d %d(%f,%f) on %d\n",
......@@ -289,7 +289,7 @@ void add_event( /*add an event */
}
break;
}
lock_events();
lock_events();
newevent = new GRAPHICS_EVENT;
if (newevent != NULL) {
*newevent = *event; /*copy event */
......@@ -304,7 +304,7 @@ void add_event( /*add an event */
newevent->next = NULL;
}
event_waiting = TRUE; //added to queue
unlock_events();
unlock_events();
}
......
......@@ -717,9 +717,17 @@ MATRIX word_associator(TBLOB *blobs,
/* Save chunk weights */
for (x = 0; x < num_chunks; x++) {
this_choice =
(A_CHOICE *) first (matrix_get (chunks_record.ratings, x, x));
blob_weights[x] = -(INT16) (10 * class_probability (this_choice) /
class_certainty (this_choice));
(A_CHOICE *) first_node (matrix_get (chunks_record.ratings, x, x));
//This is done by Jetsoft. Divide by zero is possible.
if (class_certainty (this_choice)==0)
blob_weights[x]=0;
else
blob_weights[x] = -(INT16) (10 * class_probability (this_choice) /
class_certainty (this_choice));
//
}
chunks_record.weights = blob_weights;
......
......@@ -39,7 +39,7 @@
* Allocate a piece of memory to hold a matrix of choice list pointers.
* initialize all the elements of the matrix to NULL.
**********************************************************************/
MATRIX create_matrix(int dimension) {
MATRIX create_matrix(int dimension) {
MATRIX m;
int x;
int y;
......@@ -48,7 +48,7 @@ MATRIX create_matrix(int dimension) {
m[0] = (LIST) dimension;
for (x = 0; x < dimension; x++)
for (y = 0; y < dimension; y++)
matrix_put(m, x, y, NOT_CLASSIFIED);
matrix_put(m, x, y, NOT_CLASSIFIED);
return (m);
}
......@@ -58,7 +58,7 @@ MATRIX create_matrix(int dimension) {
*
* Deallocate the memory taken up by a matrix of match ratings.
*********************************************************************/
void free_matrix(MATRIX matrix) {
void free_matrix(MATRIX matrix) {
int x;
int y;
int dimension = matrix_dimension (matrix);
......@@ -68,10 +68,10 @@ void free_matrix(MATRIX matrix) {
for (y = 0; y < dimension; y++) {
matrix_cell = matrix_get (matrix, x, y);
if (matrix_cell != NOT_CLASSIFIED)
free_choices(matrix_cell);
free_choices(matrix_cell);
}
}
memfree(matrix);
memfree(matrix);
}
......@@ -80,7 +80,7 @@ void free_matrix(MATRIX matrix) {
*
* Print the best guesses out of the match rating matrix.
**********************************************************************/
void print_matrix(MATRIX rating_matrix) {
void print_matrix(MATRIX rating_matrix) {
int x;
int dimension;
int spread;
......@@ -98,20 +98,20 @@ void print_matrix(MATRIX rating_matrix) {
if (rating != NOT_CLASSIFIED) {
cprintf ("\t[%d,%d] : ", x, x + spread);
if (first (rating))
if (first_node (rating))
cprintf ("%-10s%4.0f\t|\t",
class_string (first (rating)),
class_probability (first (rating)));
if (second (rating))
class_string (first_node (rating)),
class_probability (first_node (rating)));
if (second_node (rating))
cprintf ("%-10s%4.0f\t|\t",
class_string (second (rating)),
class_probability (second (rating)));
class_string (second_node (rating)),
class_probability (second_node (rating)));
if (third (rating))
cprintf ("%-10s%4.0f\n",
class_string (third (rating)),
class_probability (third (rating)));
else
new_line();
new_line();
}
}
}
......
......@@ -57,7 +57,7 @@ void display_edgepts(LIST outlines) {
window = edge_window;
/* Reclaim old memory */
iterate(outlines) {
render_edgepts (window, (EDGEPT *) first (outlines), White);
render_edgepts (window, (EDGEPT *) first_node (outlines), White);
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册