diff --git a/ccstruct/rwpoly.cpp b/ccstruct/rwpoly.cpp index 91fb7403..9b16997f 100644 --- a/ccstruct/rwpoly.cpp +++ b/ccstruct/rwpoly.cpp @@ -32,7 +32,7 @@ EXTERN PAGE_BLOCK_IT page_block_it; EXTERN BOOL_VAR (blocks_read_asc, TRUE, "Read blocks in ascii format"); EXTERN BOOL_VAR (blocks_write_asc, TRUE, "Write blocks in ascii format"); -DLLSYM void write_poly_blocks(FILE *blfile, PAGE_BLOCK_LIST *blocks) { +DLLSYM void write_poly_blocks(FILE *blfile, PAGE_BLOCK_LIST *blocks) { if (blocks_write_asc) blocks->serialise_asc (blfile); @@ -72,11 +72,11 @@ DLLSYM PAGE_BLOCK_LIST *read_poly_blocks( //read file pb_list = PAGE_BLOCK_LIST::de_serialise (infp); page_block_list = pb_list; //set global for now } - fclose(infp); + fclose(infp); } else { //can't open file - CANTOPENFILE.error ("read_poly_blocks", LOG, name); + CANTOPENFILE.error ("read_poly_blocks", TESSLOG, name); pb_list = new PAGE_BLOCK_LIST; page_block_list = pb_list; //set global for now } diff --git a/ccutil/memblk.cpp b/ccutil/memblk.cpp index 12dfba0e..003564c8 100644 --- a/ccutil/memblk.cpp +++ b/ccutil/memblk.cpp @@ -746,7 +746,7 @@ MEMBLOCK *MEM_ALLOCATOR::new_block( //get new big block if (blockcount >= MAXBLOCKS) { //can't have another - NOMOREBLOCKS.error ("mem_new_block", LOG, NULL); + NOMOREBLOCKS.error ("mem_new_block", TESSLOG, NULL); return NULL; } if (mem_checkfreq != 0) { @@ -765,7 +765,7 @@ MEMBLOCK *MEM_ALLOCATOR::new_block( //get new big block newblock->blockstart = (MEMUNION *) malloc (memsize * sizeof (MEMUNION)); if (newblock->blockstart == NULL) { - NOMOREMEM.error ("mem_new_block", LOG, NULL); + NOMOREMEM.error ("mem_new_block", TESSLOG, NULL); #ifdef __UNIX__ raise(SIGTTOU); //hangup for js diff --git a/ccutil/getopt.cpp b/ccutil/tessopt.cpp similarity index 95% rename from ccutil/getopt.cpp rename to ccutil/tessopt.cpp index ef28825f..6046710a 100644 --- a/ccutil/getopt.cpp +++ b/ccutil/tessopt.cpp @@ -20,20 +20,19 @@ #include "mfcpch.h" //precompiled headers #include #include -#include "getopt.h" +#include "tessopt.h" #include "notdll.h" //must be last include int optind; char *optarg; /********************************************************************** - * getopt + * tessopt * * parse command line args. **********************************************************************/ -int -getopt ( //parse args +int tessopt ( //parse args INT32 argc, //arg count char *argv[], //args const char *arglist //string of arg chars diff --git a/ccutil/getopt.h b/ccutil/tessopt.h similarity index 91% rename from ccutil/getopt.h rename to ccutil/tessopt.h index 43e8ba21..9cdd9567 100644 --- a/ccutil/getopt.h +++ b/ccutil/tessopt.h @@ -20,12 +20,10 @@ #include "host.h" #include "notdll.h" //must be last include -extern "C" { - extern int optind; - extern char *optarg; -} +extern int optind; +extern char *optarg; -int getopt ( //parse args +int tessopt ( //parse args INT32 argc, //arg count char *argv[], //args const char *arglist //string of arg chars diff --git a/classify/mfoutline.h b/classify/mfoutline.h index d70667ca..eb61d6a6 100644 --- a/classify/mfoutline.h +++ b/classify/mfoutline.h @@ -106,7 +106,7 @@ extern int NormMethod; /* macros for manipulating micro-feature outlines */ #define DegenerateOutline(O) (((O) == NIL) || ((O) == rest(O))) -#define PointAt(O) ((MFEDGEPT *) first (O)) +#define PointAt(O) ((MFEDGEPT *) first_node (O)) #define NextPointAfter(E) (rest (E)) #define MakeOutlineCircular(O) (set_rest (last (O), (O))) @@ -126,19 +126,19 @@ extern int NormMethod; /**---------------------------------------------------------------------------- Public Function Prototypes ----------------------------------------------------------------------------**/ -void ComputeBlobCenter(TBLOB *Blob, TPOINT *BlobCenter); +void ComputeBlobCenter(TBLOB *Blob, TPOINT *BlobCenter); -LIST ConvertBlob(TBLOB *Blob); +LIST ConvertBlob(TBLOB *Blob); -MFOUTLINE ConvertOutline(TESSLINE *Outline); +MFOUTLINE ConvertOutline(TESSLINE *Outline); LIST ConvertOutlines(TESSLINE *Outline, LIST ConvertedOutlines, OUTLINETYPE OutlineType); -void ComputeOutlineStats(LIST Outlines, OUTLINE_STATS *OutlineStats); +void ComputeOutlineStats(LIST Outlines, OUTLINE_STATS *OutlineStats); -void FilterEdgeNoise(MFOUTLINE Outline, FLOAT32 NoiseSegmentLength); +void FilterEdgeNoise(MFOUTLINE Outline, FLOAT32 NoiseSegmentLength); void FindDirectionChanges(MFOUTLINE Outline, FLOAT32 MinSlope, @@ -146,15 +146,15 @@ void FindDirectionChanges(MFOUTLINE Outline, void FreeMFOutline(void *agr); //MFOUTLINE Outline); -void FreeOutlines(LIST Outlines); +void FreeOutlines(LIST Outlines); -void InitMFOutlineVars(); +void InitMFOutlineVars(); -void MarkDirectionChanges(MFOUTLINE Outline); +void MarkDirectionChanges(MFOUTLINE Outline); -MFEDGEPT *NewEdgePoint(); +MFEDGEPT *NewEdgePoint(); -MFOUTLINE NextExtremity(MFOUTLINE EdgePoint); +MFOUTLINE NextExtremity(MFOUTLINE EdgePoint); void NormalizeOutline(MFOUTLINE Outline, LINE_STATS *LineStats, @@ -165,14 +165,14 @@ void NormalizeOutlines(LIST Outlines, FLOAT32 *XScale, FLOAT32 *YScale); -void SettupBlobConversion(TBLOB *Blob); +void SettupBlobConversion(TBLOB *Blob); -void SmearExtremities(MFOUTLINE Outline, FLOAT32 XScale, FLOAT32 YScale); +void SmearExtremities(MFOUTLINE Outline, FLOAT32 XScale, FLOAT32 YScale); /*---------------------------------------------------------------------------- Private Function Prototypes -----------------------------------------------------------------------------*/ -void ChangeDirection(MFOUTLINE Start, MFOUTLINE End, DIRECTION Direction); +void ChangeDirection(MFOUTLINE Start, MFOUTLINE End, DIRECTION Direction); void CharNormalizeOutline(MFOUTLINE Outline, FLOAT32 XCenter, @@ -185,11 +185,11 @@ void ComputeDirection(MFEDGEPT *Start, FLOAT32 MinSlope, FLOAT32 MaxSlope); -void FinishOutlineStats(register OUTLINE_STATS *OutlineStats); +void FinishOutlineStats(register OUTLINE_STATS *OutlineStats); -void InitOutlineStats(OUTLINE_STATS *OutlineStats); +void InitOutlineStats(OUTLINE_STATS *OutlineStats); -MFOUTLINE NextDirectionChange(MFOUTLINE EdgePoint); +MFOUTLINE NextDirectionChange(MFOUTLINE EdgePoint); void UpdateOutlineStats(register OUTLINE_STATS *OutlineStats, register FLOAT32 x1, diff --git a/cutil/const.h b/cutil/const.h index 7ec6fcd6..397f170f 100644 --- a/cutil/const.h +++ b/cutil/const.h @@ -88,7 +88,7 @@ #define SCAN 0 /*scanner process id */ #define EDGE 1 /*edge process id */ #define FX 2 /*fx process id */ -#define TO 3 /*pageseg process id */ +#define TESSTO 3 /*pageseg process id */ #define OCR 4 /*ocr process id */ #define MAXPROC (OCR+1) /*no of processes */ diff --git a/cutil/cutil.h b/cutil/cutil.h index 7b183cbb..c7bb9c2a 100644 --- a/cutil/cutil.h +++ b/cutil/cutil.h @@ -22,7 +22,6 @@ ** limitations under the License. * ******************************************************************************** -$Log: cutil.h,v $ Revision 1.1 2007/02/02 23:39:07 theraysmith Fixed portability issues @@ -142,9 +141,9 @@ extern char_proc allocate; /*---------------------------------------------------------------------- F u n c t i o n s ----------------------------------------------------------------------*/ -long long_rand(long limit); +long long_rand(long limit); -FILE *open_file(const char *filename, const char *mode); +FILE *open_file(const char *filename, const char *mode); /* util.c long long_rand diff --git a/cutil/oldlist.cpp b/cutil/oldlist.cpp index 3e5adc7d..6884bb5a 100644 --- a/cutil/oldlist.cpp +++ b/cutil/oldlist.cpp @@ -42,17 +42,17 @@ push to add to the Stack l = push (l, (LIST) "jim"); pop to remove items from the Stack l = pop (l); - first to access the head name = (char *) first (l); + first_node to access the head name = (char *) first_node (l); To implement a QUEUE use: push_last to add to the Queue l = push_last (l, (LIST) "jim"); pop remove items from the Queue l = pop (l); - first to access the head name = (char *) first (l); + first_node to access the head name = (char *) first_node (l); To implement LISP like functions use: - first CAR x = (int) first (l); + first_node CAR x = (int) first_node (l); rest CDR l = rest (l); push CONS l = push (l, (LIST) this); last LAST x = last (l); @@ -76,7 +76,7 @@ adelete l = adelete (l, x); The following rules of closure exist for the functions provided. - a = first (push (a, b)) + a = first_node (push (a, b)) b = rest (push (a, b)) a = push (pop (a), a)) For all a <> NIL a = reverse (reverse (a)) @@ -94,7 +94,7 @@ /*---------------------------------------------------------------------- M a c r o s ----------------------------------------------------------------------*/ -#define add_on(l,x) l = push (l,first (x)) +#define add_on(l,x) l = push (l,first_node (x)) #define next_one(l) l = rest (l) /*---------------------------------------------------------------------- @@ -130,7 +130,7 @@ LIST delete_d(LIST list, void *key, int_compare is_equal) { is_equal = is_same; while (list != NIL) { - if (!(*is_equal) (first (list), key)) { + if (!(*is_equal) (first_node (list), key)) { if (last_one == NIL) { last_one = list; list = rest (list); @@ -179,7 +179,7 @@ void destroy_nodes(LIST list, void_dest destructor) { destructor = memfree; while (list != NIL) { - (*destructor) (first (list)); + (*destructor) (first_node (list)); list = pop (list); } } @@ -198,8 +198,8 @@ void insert(LIST list, void *node) { element = push (NIL, node); set_rest (element, rest (list)); set_rest(list, element); - node = first (list); - list->node = first (rest (list)); + node = first_node (list); + list->node = first_node (rest (list)); list->next->node = (LIST) node; } } @@ -363,7 +363,7 @@ LIST s_adjoin(LIST var_list, void *variable, int_compare compare) { l = var_list; iterate(l) { - result = (*compare) (variable, first (l)); + result = (*compare) (variable, first_node (l)); if (result == 0) return (var_list); else if (result < 0) { @@ -387,7 +387,7 @@ LIST search(LIST list, void *key, int_compare is_equal) { if (is_equal == NULL) is_equal = is_same; - iterate (list) if ((*is_equal) (first (list), key)) + iterate (list) if ((*is_equal) (first_node (list), key)) return (list); return (NIL); } diff --git a/cutil/variables.cpp b/cutil/variables.cpp index 2a40b811..f576f37c 100644 --- a/cutil/variables.cpp +++ b/cutil/variables.cpp @@ -220,14 +220,14 @@ void read_variables(const char *filename) { var_strings = read_list (name); iterate(var_strings) { /* Get the name string */ - this_string = (char *) first (var_strings); + this_string = (char *) first_node (var_strings); if (this_string[0] != '#') { for (x = 0; x < strlen (this_string) && this_string[x] != ' ' && this_string[x] != '\t'; x++); this_string[x] = '\0'; /* Find variable record */ - this_var = (VARIABLE *) first (search (variable_list, this_string, + this_var = (VARIABLE *) first_node (search (variable_list, this_string, same_var_name)); if (this_var == 0) { cprintf ("error: Could not find variable '%s'\n", this_string); diff --git a/display/varabled.cpp b/display/varabled.cpp index aea8973e..6a3f1ca8 100644 --- a/display/varabled.cpp +++ b/display/varabled.cpp @@ -107,7 +107,7 @@ MENU_ROOT *build_main_var_menu( //build menus full_name = (it.data ()->ptr)->cmp_str (); // 1st word delim by _ get_first_words (full_name, 1, first_word); - extract_sublist(all_leaves_list, first_word, &sub_window_list); + extract_sublist(all_leaves_list, first_word, &sub_window_list); //addto main misc menu if (sub_window_list.singleton ()) { @@ -133,7 +133,7 @@ MENU_ROOT *build_main_var_menu( //build menus it.set_to_list (&sub_window_list); full_name = it.data ()->ptr->cmp_str (); get_first_words (full_name, 2, first_two_words); - extract_sublist(&sub_window_list, first_two_words, &sub_menu_list); + extract_sublist(&sub_window_list, first_two_words, &sub_menu_list); it.set_to_list (&sub_menu_list); //addto subwin misc @@ -145,7 +145,7 @@ MENU_ROOT *build_main_var_menu( //build menus else { //build sub menu current_sub_win_menu = - new VAR_NON_RADIO_MENU(first_two_words); + new VAR_NON_RADIO_MENU(first_two_words); sub_window_root->add_child (current_sub_win_menu); header_len = strlen (first_two_words); while (!sub_menu_list.empty ()) { @@ -192,8 +192,8 @@ void extract_sublist( //remove initial items char *leading_str, //string to match MENU_L_LIST *extracted_list //extracted list ) { - MENU_L_IT start_it(source_list); - MENU_L_IT end_it(source_list); + MENU_L_IT start_it(source_list); + MENU_L_IT end_it(source_list); int match_len = strlen (leading_str); while (!end_it.at_last () && @@ -226,7 +226,7 @@ void get_first_words( //copy first N words next_word += reqd_len; n--; } - strncpy(t, s, reqd_len); + strncpy(t, s, reqd_len); t[reqd_len] = '\0'; //ensure null terminal } @@ -274,7 +274,7 @@ void start_variables_editor() { //create top level win all_leaves_list = build_list_of_all_leaves (); it.set_to_list (all_leaves_list); if (it.empty ()) { - NO_VARIABLES_TO_EDIT.error ("start_variables_editor", LOG, NULL); + NO_VARIABLES_TO_EDIT.error ("start_variables_editor", TESSLOG, NULL); } it.sort (&menu_item_sorter);