More fixes BOOL8 -> bool

This commit is contained in:
Alexander Zaitsev 2018-05-21 00:40:58 +03:00
parent 6f580bad77
commit 6ff0b56597
29 changed files with 244 additions and 248 deletions

View File

@ -37,8 +37,8 @@
#endif #endif
namespace tesseract { namespace tesseract {
BOOL8 Tesseract::word_adaptable( //should we adapt? bool Tesseract::word_adaptable( //should we adapt?
WERD_RES *word, WERD_RES* word,
uint16_t mode) { uint16_t mode) {
if (tessedit_adaption_debug) { if (tessedit_adaption_debug) {
tprintf("Running word_adaptable() for %s rating %.4f certainty %.4f\n", tprintf("Running word_adaptable() for %s rating %.4f certainty %.4f\n",
@ -65,7 +65,7 @@ BOOL8 Tesseract::word_adaptable( //should we adapt?
*/ */
if (mode == 0) { if (mode == 0) {
if (tessedit_adaption_debug) tprintf("adaption disabled\n"); if (tessedit_adaption_debug) tprintf("adaption disabled\n");
return FALSE; return false;
} }
if (flags.bit (ADAPTABLE_WERD)) { if (flags.bit (ADAPTABLE_WERD)) {
@ -83,7 +83,7 @@ BOOL8 Tesseract::word_adaptable( //should we adapt?
} }
if (!status) { // If not set then if (!status) { // If not set then
return FALSE; // ignore other checks return false; // ignore other checks
} }
if (flags.bit (CHECK_DAWGS) && if (flags.bit (CHECK_DAWGS) &&
@ -92,24 +92,24 @@ BOOL8 Tesseract::word_adaptable( //should we adapt?
(word->best_choice->permuter () != USER_DAWG_PERM) && (word->best_choice->permuter () != USER_DAWG_PERM) &&
(word->best_choice->permuter () != NUMBER_PERM)) { (word->best_choice->permuter () != NUMBER_PERM)) {
if (tessedit_adaption_debug) tprintf("word not in dawgs\n"); if (tessedit_adaption_debug) tprintf("word not in dawgs\n");
return FALSE; return false;
} }
if (flags.bit (CHECK_ONE_ELL_CONFLICT) && one_ell_conflict (word, false)) { if (flags.bit (CHECK_ONE_ELL_CONFLICT) && one_ell_conflict (word, false)) {
if (tessedit_adaption_debug) tprintf("word has ell conflict\n"); if (tessedit_adaption_debug) tprintf("word has ell conflict\n");
return FALSE; return false;
} }
if (flags.bit (CHECK_SPACES) && if (flags.bit (CHECK_SPACES) &&
(strchr(word->best_choice->unichar_string().string(), ' ') != nullptr)) { (strchr(word->best_choice->unichar_string().string(), ' ') != nullptr)) {
if (tessedit_adaption_debug) tprintf("word contains spaces\n"); if (tessedit_adaption_debug) tprintf("word contains spaces\n");
return FALSE; return false;
} }
if (flags.bit (CHECK_AMBIG_WERD) && if (flags.bit (CHECK_AMBIG_WERD) &&
word->best_choice->dangerous_ambig_found()) { word->best_choice->dangerous_ambig_found()) {
if (tessedit_adaption_debug) tprintf("word is ambiguous\n"); if (tessedit_adaption_debug) tprintf("word is ambiguous\n");
return FALSE; return false;
} }
if (tessedit_adaption_debug) { if (tessedit_adaption_debug) {

View File

@ -80,7 +80,7 @@ void Tesseract::recog_pseudo_word(PAGE_RES* page_res,
* *
* @param pr_it the page results iterator * @param pr_it the page results iterator
*/ */
BOOL8 Tesseract::recog_interactive(PAGE_RES_IT* pr_it) { bool Tesseract::recog_interactive(PAGE_RES_IT* pr_it) {
int16_t char_qual; int16_t char_qual;
int16_t good_char_qual; int16_t good_char_qual;
@ -101,7 +101,7 @@ BOOL8 Tesseract::recog_interactive(PAGE_RES_IT* pr_it) {
word_blob_quality(word_res, pr_it->row()->row), word_blob_quality(word_res, pr_it->row()->row),
word_outline_errs(word_res), char_qual, good_char_qual); word_outline_errs(word_res), char_qual, good_char_qual);
} }
return TRUE; return true;
} }
// Helper function to check for a target word and handle it appropriately. // Helper function to check for a target word and handle it appropriately.

View File

@ -304,7 +304,7 @@ void Tesseract::doc_and_block_rejection( //reject big chunks
prev_word_rejected && prev_word_rejected &&
page_res_it.prev_row() == page_res_it.row() && page_res_it.prev_row() == page_res_it.row() &&
word->word->space() == 1) word->word->space() == 1)
word->reject_spaces = TRUE; word->reject_spaces = true;
word->reject_map.rej_word_block_rej(); word->reject_map.rej_word_block_rej();
} }
prev_word_rejected = rej_word; prev_word_rejected = rej_word;
@ -375,7 +375,7 @@ void Tesseract::doc_and_block_rejection( //reject big chunks
prev_word_rejected && prev_word_rejected &&
page_res_it.prev_row() == page_res_it.row() && page_res_it.prev_row() == page_res_it.row() &&
word->word->space () == 1) word->word->space () == 1)
word->reject_spaces = TRUE; word->reject_spaces = true;
word->reject_map.rej_word_row_rej(); word->reject_map.rej_word_row_rej();
} }
prev_word_rejected = rej_word; prev_word_rejected = rej_word;
@ -411,7 +411,7 @@ void reject_whole_page(PAGE_RES_IT &page_res_it) {
page_res_it.forward (); page_res_it.forward ();
} }
//whole page is rejected //whole page is rejected
page_res_it.page_res->rejected = TRUE; page_res_it.page_res->rejected = true;
} }
namespace tesseract { namespace tesseract {
@ -501,7 +501,7 @@ void Tesseract::tilde_crunch(PAGE_RES_IT &page_res_it) {
} }
BOOL8 Tesseract::terrible_word_crunch(WERD_RES *word, bool Tesseract::terrible_word_crunch(WERD_RES* word,
GARBAGE_LEVEL garbage_level) { GARBAGE_LEVEL garbage_level) {
float rating_per_ch; float rating_per_ch;
int adjusted_len; int adjusted_len;
@ -533,15 +533,15 @@ BOOL8 Tesseract::terrible_word_crunch(WERD_RES *word,
tprintf ("Terrible_word_crunch (%d) on \"%s\"\n", tprintf ("Terrible_word_crunch (%d) on \"%s\"\n",
crunch_mode, word->best_choice->unichar_string().string()); crunch_mode, word->best_choice->unichar_string().string());
} }
return TRUE; return true;
} }
else else
return FALSE; return false;
} }
BOOL8 Tesseract::potential_word_crunch(WERD_RES *word, bool Tesseract::potential_word_crunch(WERD_RES* word,
GARBAGE_LEVEL garbage_level, GARBAGE_LEVEL garbage_level,
BOOL8 ok_dict_word) { bool ok_dict_word) {
float rating_per_ch; float rating_per_ch;
int adjusted_len; int adjusted_len;
const char *str = word->best_choice->unichar_string().string(); const char *str = word->best_choice->unichar_string().string();
@ -975,7 +975,7 @@ int16_t Tesseract::failure_count(WERD_RES *word) {
} }
BOOL8 Tesseract::noise_outlines(TWERD *word) { bool Tesseract::noise_outlines(TWERD* word) {
TBOX box; // BB of outline TBOX box; // BB of outline
int16_t outline_count = 0; int16_t outline_count = 0;
int16_t small_outline_count = 0; int16_t small_outline_count = 0;

View File

@ -184,8 +184,8 @@ void initialise_search(WERD_RES_LIST &src_list, WERD_RES_LIST &new_list) {
src_wd = src_it.data(); src_wd = src_it.data();
if (!src_wd->combination) { if (!src_wd->combination) {
new_wd = WERD_RES::deep_copy(src_wd); new_wd = WERD_RES::deep_copy(src_wd);
new_wd->combination = FALSE; new_wd->combination = false;
new_wd->part_of_combo = FALSE; new_wd->part_of_combo = false;
new_it.add_after_then_move(new_wd); new_it.add_after_then_move(new_wd);
} }
} }
@ -417,7 +417,7 @@ void transform_to_next_perm(WERD_RES_LIST &words) {
combo = new WERD_RES(copy_word); combo = new WERD_RES(copy_word);
combo->combination = TRUE; combo->combination = TRUE;
combo->x_height = prev_word->x_height; combo->x_height = prev_word->x_height;
prev_word->part_of_combo = TRUE; prev_word->part_of_combo = true;
prev_word_it.add_before_then_move(combo); prev_word_it.add_before_then_move(combo);
} }
combo->word->set_flag(W_EOL, word->word->flag(W_EOL)); combo->word->set_flag(W_EOL, word->word->flag(W_EOL));
@ -429,7 +429,7 @@ void transform_to_next_perm(WERD_RES_LIST &words) {
} else { } else {
// Copy current wd to combo // Copy current wd to combo
combo->copy_on(word); combo->copy_on(word);
word->part_of_combo = TRUE; word->part_of_combo = true;
} }
combo->done = FALSE; combo->done = FALSE;
combo->ClearResults(); combo->ClearResults();
@ -583,9 +583,9 @@ void Tesseract::fix_noisy_space_list(WERD_RES_LIST &best_perm, ROW *row,
old_word_res = best_perm_it.data(); old_word_res = best_perm_it.data();
// Even deep_copy doesn't copy the underlying WERD unless its combination // Even deep_copy doesn't copy the underlying WERD unless its combination
// flag is true!. // flag is true!.
old_word_res->combination = TRUE; // Kludge to force deep copy old_word_res->combination = true; // Kludge to force deep copy
current_perm_it.add_to_end(WERD_RES::deep_copy(old_word_res)); current_perm_it.add_to_end(WERD_RES::deep_copy(old_word_res));
old_word_res->combination = FALSE; // Undo kludge old_word_res->combination = false; // Undo kludge
break_noisiest_blob_word(current_perm); break_noisiest_blob_word(current_perm);
@ -671,7 +671,7 @@ void Tesseract::break_noisiest_blob_word(WERD_RES_LIST &words) {
} }
WERD_RES* new_word_res = new WERD_RES(new_word); WERD_RES* new_word_res = new WERD_RES(new_word);
new_word_res->combination = TRUE; new_word_res->combination = true;
worst_word_it.add_before_then_move(new_word_res); worst_word_it.add_before_then_move(new_word_res);
word_res->ClearResults(); word_res->ClearResults();

View File

@ -412,9 +412,9 @@ int16_t Tesseract::count_alphanums(const WERD_CHOICE &word) {
} }
BOOL8 Tesseract::acceptable_number_string(const char *s, bool Tesseract::acceptable_number_string(const char* s,
const char *lengths) { const char* lengths) {
BOOL8 prev_digit = FALSE; bool prev_digit = false;
if (*lengths == 1 && *s == '(') if (*lengths == 1 && *s == '(')
s++; s++;
@ -425,21 +425,21 @@ BOOL8 Tesseract::acceptable_number_string(const char *s,
for (; *s != '\0'; s += *(lengths++)) { for (; *s != '\0'; s += *(lengths++)) {
if (unicharset.get_isdigit(s, *lengths)) if (unicharset.get_isdigit(s, *lengths))
prev_digit = TRUE; prev_digit = true;
else if (prev_digit && else if (prev_digit &&
(*lengths == 1 && ((*s == '.') || (*s == ',') || (*s == '-')))) (*lengths == 1 && ((*s == '.') || (*s == ',') || (*s == '-'))))
prev_digit = FALSE; prev_digit = false;
else if (prev_digit && *lengths == 1 && else if (prev_digit && *lengths == 1 &&
(*(s + *lengths) == '\0') && ((*s == '%') || (*s == ')'))) (*(s + *lengths) == '\0') && ((*s == '%') || (*s == ')')))
return TRUE; return true;
else if (prev_digit && else if (prev_digit &&
*lengths == 1 && (*s == '%') && *lengths == 1 && (*s == '%') &&
(*(lengths + 1) == 1 && *(s + *lengths) == ')') && (*(lengths + 1) == 1 && *(s + *lengths) == ')') &&
(*(s + *lengths + *(lengths + 1)) == '\0')) (*(s + *lengths + *(lengths + 1)) == '\0'))
return TRUE; return true;
else else
return FALSE; return false;
} }
return TRUE; return true;
} }
} // namespace tesseract } // namespace tesseract

View File

@ -302,7 +302,7 @@ SVMenuNode *Tesseract::build_menu_new() {
* Redisplay page * Redisplay page
*/ */
void Tesseract::do_re_display( void Tesseract::do_re_display(
BOOL8 (tesseract::Tesseract::*word_painter)(PAGE_RES_IT* pr_it)) { bool (tesseract::Tesseract::* word_painter)(PAGE_RES_IT* pr_it)) {
int block_count = 1; int block_count = 1;
image_win->Clear(); image_win->Clear();
@ -710,7 +710,7 @@ void show_point(PAGE_RES* page_res, float x, float y) {
#endif // GRAPHICS_DISABLED #endif // GRAPHICS_DISABLED
namespace tesseract { namespace tesseract {
#ifndef GRAPHICS_DISABLED #ifndef GRAPHICS_DISABLED
BOOL8 Tesseract:: word_blank_and_set_display(PAGE_RES_IT* pr_it) { bool Tesseract::word_blank_and_set_display(PAGE_RES_IT* pr_it) {
pr_it->word()->word->bounding_box().plot(image_win, ScrollView::BLACK, pr_it->word()->word->bounding_box().plot(image_win, ScrollView::BLACK,
ScrollView::BLACK); ScrollView::BLACK);
return word_set_display(pr_it); return word_set_display(pr_it);
@ -722,7 +722,7 @@ BOOL8 Tesseract:: word_blank_and_set_display(PAGE_RES_IT* pr_it) {
* *
* Normalize word and display in word window * Normalize word and display in word window
*/ */
BOOL8 Tesseract::word_bln_display(PAGE_RES_IT* pr_it) { bool Tesseract::word_bln_display(PAGE_RES_IT* pr_it) {
WERD_RES* word_res = pr_it->word(); WERD_RES* word_res = pr_it->word();
if (word_res->chopped_word == nullptr) { if (word_res->chopped_word == nullptr) {
// Setup word normalization parameters. // Setup word normalization parameters.
@ -744,7 +744,7 @@ BOOL8 Tesseract::word_bln_display(PAGE_RES_IT* pr_it) {
color = WERD::NextColor(color); color = WERD::NextColor(color);
} }
bln_word_window_handle()->Update(); bln_word_window_handle()->Update();
return TRUE; return true;
} }
@ -754,7 +754,7 @@ BOOL8 Tesseract::word_bln_display(PAGE_RES_IT* pr_it) {
* *
* Display a word according to its display modes * Display a word according to its display modes
*/ */
BOOL8 Tesseract::word_display(PAGE_RES_IT* pr_it) { bool Tesseract::word_display(PAGE_RES_IT* pr_it) {
WERD_RES* word_res = pr_it->word(); WERD_RES* word_res = pr_it->word();
WERD* word = word_res->word; WERD* word = word_res->word;
TBOX word_bb; // word bounding box TBOX word_bb; // word bounding box
@ -906,7 +906,7 @@ BOOL8 Tesseract::word_display(PAGE_RES_IT* pr_it) {
(ScrollView::Color)((int32_t) editor_image_word_bb_color), (ScrollView::Color)((int32_t) editor_image_word_bb_color),
(ScrollView::Color)((int32_t) (ScrollView::Color)((int32_t)
editor_image_word_bb_color)); editor_image_word_bb_color));
return TRUE; return true;
} }
#endif // GRAPHICS_DISABLED #endif // GRAPHICS_DISABLED
@ -915,10 +915,10 @@ BOOL8 Tesseract::word_display(PAGE_RES_IT* pr_it) {
* *
* Dump members to the debug window * Dump members to the debug window
*/ */
BOOL8 Tesseract::word_dumper(PAGE_RES_IT* pr_it) { bool Tesseract::word_dumper(PAGE_RES_IT* pr_it) {
if (pr_it->block()->block != nullptr) { if (pr_it->block()->block != nullptr) {
tprintf("\nBlock data...\n"); tprintf("\nBlock data...\n");
pr_it->block()->block->print(nullptr, FALSE); pr_it->block()->block->print(nullptr, false);
} }
tprintf("\nRow data...\n"); tprintf("\nRow data...\n");
pr_it->row()->row->print(nullptr); pr_it->row()->row->print(nullptr);
@ -930,7 +930,7 @@ BOOL8 Tesseract::word_dumper(PAGE_RES_IT* pr_it) {
tprintf("Current blamer debug: %s\n", tprintf("Current blamer debug: %s\n",
word_res->blamer_bundle->debug().string()); word_res->blamer_bundle->debug().string());
} }
return TRUE; return true;
} }
#ifndef GRAPHICS_DISABLED #ifndef GRAPHICS_DISABLED
@ -939,7 +939,7 @@ BOOL8 Tesseract::word_dumper(PAGE_RES_IT* pr_it) {
* *
* Display word according to current display mode settings * Display word according to current display mode settings
*/ */
BOOL8 Tesseract::word_set_display(PAGE_RES_IT* pr_it) { bool Tesseract::word_set_display(PAGE_RES_IT* pr_it) {
WERD* word = pr_it->word()->word; WERD* word = pr_it->word()->word;
word->set_display_flag(DF_BOX, word_display_mode.bit(DF_BOX)); word->set_display_flag(DF_BOX, word_display_mode.bit(DF_BOX));
word->set_display_flag(DF_TEXT, word_display_mode.bit(DF_TEXT)); word->set_display_flag(DF_TEXT, word_display_mode.bit(DF_TEXT));

View File

@ -501,17 +501,17 @@ int16_t Tesseract::alpha_count(const char *word,
} }
BOOL8 Tesseract::word_contains_non_1_digit(const char *word, bool Tesseract::word_contains_non_1_digit(const char* word,
const char *word_lengths) { const char* word_lengths) {
int16_t i; int16_t i;
int16_t offset; int16_t offset;
for (i = 0, offset = 0; word[offset] != '\0'; offset += word_lengths[i++]) { for (i = 0, offset = 0; word[offset] != '\0'; offset += word_lengths[i++]) {
if (unicharset.get_isdigit (word + offset, word_lengths[i]) && if (unicharset.get_isdigit (word + offset, word_lengths[i]) &&
(word_lengths[i] != 1 || word[offset] != '1')) (word_lengths[i] != 1 || word[offset] != '1'))
return TRUE; return true;
} }
return FALSE; return false;
} }
/************************************************************************* /*************************************************************************

View File

@ -453,7 +453,7 @@ class Tesseract : public Wordrec {
bool TestNewNormalization(int original_misfits, float baseline_shift, bool TestNewNormalization(int original_misfits, float baseline_shift,
float new_x_ht, WERD_RES *word, BLOCK* block, float new_x_ht, WERD_RES *word, BLOCK* block,
ROW *row); ROW *row);
BOOL8 recog_interactive(PAGE_RES_IT* pr_it); bool recog_interactive(PAGE_RES_IT* pr_it);
// Set fonts of this word. // Set fonts of this word.
void set_word_fonts(WERD_RES *word); void set_word_fonts(WERD_RES *word);
@ -497,8 +497,8 @@ class Tesseract : public Wordrec {
); );
void set_unlv_suspects(WERD_RES *word); void set_unlv_suspects(WERD_RES *word);
UNICHAR_ID get_rep_char(WERD_RES *word); // what char is repeated? UNICHAR_ID get_rep_char(WERD_RES *word); // what char is repeated?
BOOL8 acceptable_number_string(const char *s, bool acceptable_number_string(const char* s,
const char *lengths); const char* lengths);
int16_t count_alphanums(const WERD_CHOICE &word); int16_t count_alphanums(const WERD_CHOICE &word);
int16_t count_alphas(const WERD_CHOICE &word); int16_t count_alphas(const WERD_CHOICE &word);
//// tessedit.h //////////////////////////////////////////////////////// //// tessedit.h ////////////////////////////////////////////////////////
@ -577,13 +577,13 @@ class Tesseract : public Wordrec {
); );
void debug_word(PAGE_RES* page_res, const TBOX &selection_box); void debug_word(PAGE_RES* page_res, const TBOX &selection_box);
void do_re_display( void do_re_display(
BOOL8 (tesseract::Tesseract::*word_painter)(PAGE_RES_IT* pr_it)); bool (tesseract::Tesseract::* word_painter)(PAGE_RES_IT* pr_it));
BOOL8 word_display(PAGE_RES_IT* pr_it); bool word_display(PAGE_RES_IT* pr_it);
BOOL8 word_bln_display(PAGE_RES_IT* pr_it); bool word_bln_display(PAGE_RES_IT* pr_it);
BOOL8 word_blank_and_set_display(PAGE_RES_IT* pr_its); bool word_blank_and_set_display(PAGE_RES_IT* pr_its);
BOOL8 word_set_display(PAGE_RES_IT* pr_it); bool word_set_display(PAGE_RES_IT* pr_it);
// #ifndef GRAPHICS_DISABLED // #ifndef GRAPHICS_DISABLED
BOOL8 word_dumper(PAGE_RES_IT* pr_it); bool word_dumper(PAGE_RES_IT* pr_it);
// #endif // GRAPHICS_DISABLED // #endif // GRAPHICS_DISABLED
void blob_feature_display(PAGE_RES* page_res, const TBOX& selection_box); void blob_feature_display(PAGE_RES* page_res, const TBOX& selection_box);
//// reject.h ////////////////////////////////////////////////////////// //// reject.h //////////////////////////////////////////////////////////
@ -596,8 +596,8 @@ class Tesseract : public Wordrec {
const char *word_lengths); const char *word_lengths);
int16_t alpha_count(const char *word, int16_t alpha_count(const char *word,
const char *word_lengths); const char *word_lengths);
BOOL8 word_contains_non_1_digit(const char *word, bool word_contains_non_1_digit(const char* word,
const char *word_lengths); const char* word_lengths);
void dont_allow_1Il(WERD_RES *word); void dont_allow_1Il(WERD_RES *word);
int16_t count_alphanums( //how many alphanums int16_t count_alphanums( //how many alphanums
WERD_RES *word); WERD_RES *word);
@ -618,8 +618,8 @@ class Tesseract : public Wordrec {
void reject_edge_blobs(WERD_RES *word); void reject_edge_blobs(WERD_RES *word);
void reject_mostly_rejects(WERD_RES *word); void reject_mostly_rejects(WERD_RES *word);
//// adaptions.h /////////////////////////////////////////////////////// //// adaptions.h ///////////////////////////////////////////////////////
BOOL8 word_adaptable( //should we adapt? bool word_adaptable( //should we adapt?
WERD_RES *word, WERD_RES* word,
uint16_t mode); uint16_t mode);
//// tfacepp.cpp /////////////////////////////////////////////////////// //// tfacepp.cpp ///////////////////////////////////////////////////////
@ -653,9 +653,9 @@ class Tesseract : public Wordrec {
void break_noisiest_blob_word(WERD_RES_LIST &words); void break_noisiest_blob_word(WERD_RES_LIST &words);
//// docqual.cpp //////////////////////////////////////////////////////// //// docqual.cpp ////////////////////////////////////////////////////////
GARBAGE_LEVEL garbage_word(WERD_RES *word, BOOL8 ok_dict_word); GARBAGE_LEVEL garbage_word(WERD_RES *word, BOOL8 ok_dict_word);
BOOL8 potential_word_crunch(WERD_RES *word, bool potential_word_crunch(WERD_RES* word,
GARBAGE_LEVEL garbage_level, GARBAGE_LEVEL garbage_level,
BOOL8 ok_dict_word); bool ok_dict_word);
void tilde_crunch(PAGE_RES_IT &page_res_it); void tilde_crunch(PAGE_RES_IT &page_res_it);
void unrej_good_quality_words( //unreject potential void unrej_good_quality_words( //unreject potential
PAGE_RES_IT &page_res_it); PAGE_RES_IT &page_res_it);
@ -672,17 +672,17 @@ class Tesseract : public Wordrec {
void unrej_good_chs(WERD_RES *word, ROW *row); void unrej_good_chs(WERD_RES *word, ROW *row);
int16_t count_outline_errs(char c, int16_t outline_count); int16_t count_outline_errs(char c, int16_t outline_count);
int16_t word_outline_errs(WERD_RES *word); int16_t word_outline_errs(WERD_RES *word);
BOOL8 terrible_word_crunch(WERD_RES *word, GARBAGE_LEVEL garbage_level); bool terrible_word_crunch(WERD_RES* word, GARBAGE_LEVEL garbage_level);
CRUNCH_MODE word_deletable(WERD_RES *word, int16_t &delete_mode); CRUNCH_MODE word_deletable(WERD_RES *word, int16_t &delete_mode);
int16_t failure_count(WERD_RES *word); int16_t failure_count(WERD_RES *word);
BOOL8 noise_outlines(TWERD *word); bool noise_outlines(TWERD* word);
//// pagewalk.cpp /////////////////////////////////////////////////////// //// pagewalk.cpp ///////////////////////////////////////////////////////
void void
process_selected_words ( process_selected_words(
PAGE_RES* page_res, // blocks to check PAGE_RES* page_res, // blocks to check
//function to call //function to call
TBOX & selection_box, TBOX& selection_box,
BOOL8 (tesseract::Tesseract::*word_processor)(PAGE_RES_IT* pr_it)); bool (tesseract::Tesseract::* word_processor)(PAGE_RES_IT* pr_it));
//// tessbox.cpp /////////////////////////////////////////////////////// //// tessbox.cpp ///////////////////////////////////////////////////////
void tess_add_doc_word( //test acceptability void tess_add_doc_word( //test acceptability
WERD_CHOICE *word_choice //after context WERD_CHOICE *word_choice //after context

View File

@ -820,8 +820,8 @@ void TO_ROW::compute_vertical_projection() { //project whole row
* Zero out all scalar members. * Zero out all scalar members.
**********************************************************************/ **********************************************************************/
void TO_ROW::clear() { void TO_ROW::clear() {
all_caps = 0; all_caps = false;
used_dm_model = 0; used_dm_model = false;
projection_left = 0; projection_left = 0;
projection_right = 0; projection_right = 0;
pitch_decision = PITCH_DUNNO; pitch_decision = PITCH_DUNNO;

View File

@ -639,9 +639,9 @@ class TO_ROW: public ELIST2_LINK
} }
// true when dead // true when dead
BOOL8 merged; bool merged;
BOOL8 all_caps; // had no ascenders bool all_caps; // had no ascenders
BOOL8 used_dm_model; // in guessing pitch bool used_dm_model; // in guessing pitch
int16_t projection_left; // start of projection int16_t projection_left; // start of projection
int16_t projection_right; // start of projection int16_t projection_right; // start of projection
PITCH_TYPE pitch_decision; // how strong is decision PITCH_TYPE pitch_decision; // how strong is decision

View File

@ -93,13 +93,13 @@ class DLLSYM C_OUTLINE:public ELIST_LINK {
delete [] offsets; delete [] offsets;
} }
BOOL8 flag( //test flag bool flag( //test flag
C_OUTLINE_FLAGS mask) const { //flag to test C_OUTLINE_FLAGS mask) const { //flag to test
return flags.bit(mask); return flags.bit(mask);
} }
void set_flag( //set flag value void set_flag( //set flag value
C_OUTLINE_FLAGS mask, //flag to test C_OUTLINE_FLAGS mask, //flag to test
BOOL8 value) { //value to set bool value) { //value to set
flags.set_bit(mask, value); flags.set_bit(mask, value);
} }

View File

@ -195,9 +195,9 @@ void BLOCK::compress( // squash it up
*/ */
void BLOCK::print( //print list of sides void BLOCK::print( //print list of sides
FILE *, //< file to print on FILE*, //< file to print on
BOOL8 dump //< print full detail bool dump //< print full detail
) { ) {
ICOORDELT_IT it = &pdblk.leftside; //iterator ICOORDELT_IT it = &pdblk.leftside; //iterator
pdblk.box.print (); pdblk.box.print ();

View File

@ -187,7 +187,7 @@ class BLOCK:public ELIST_LINK
void compress(const ICOORD vec); void compress(const ICOORD vec);
/// dump whole table /// dump whole table
void print(FILE *fp, BOOL8 dump); void print(FILE* fp, bool dump);
BLOCK& operator=(const BLOCK & source); BLOCK& operator=(const BLOCK & source);
PDBLK pdblk; //< Page Description Block PDBLK pdblk; //< Page Description Block

View File

@ -89,9 +89,9 @@ BLOCK_RES::BLOCK_RES(bool merge_similar_words, BLOCK *the_block) {
rej_count = 0; rej_count = 0;
font_class = -1; //not assigned font_class = -1; //not assigned
x_height = -1.0; x_height = -1.0;
font_assigned = FALSE; font_assigned = false;
bold = FALSE; bold = false;
italic = FALSE; italic = false;
row_count = 0; row_count = 0;
block = the_block; block = the_block;
@ -1084,10 +1084,10 @@ WERD_RES::~WERD_RES () {
} }
void WERD_RES::InitNonPointers() { void WERD_RES::InitNonPointers() {
tess_failed = FALSE; tess_failed = false;
tess_accepted = FALSE; tess_accepted = false;
tess_would_adapt = FALSE; tess_would_adapt = false;
done = FALSE; done = false;
unlv_crunch_mode = CR_NONE; unlv_crunch_mode = CR_NONE;
small_caps = false; small_caps = false;
odd_size = false; odd_size = false;
@ -1104,11 +1104,11 @@ void WERD_RES::InitNonPointers() {
caps_height = 0.0; caps_height = 0.0;
baseline_shift = 0.0f; baseline_shift = 0.0f;
space_certainty = 0.0f; space_certainty = 0.0f;
guessed_x_ht = TRUE; guessed_x_ht = true;
guessed_caps_ht = TRUE; guessed_caps_ht = true;
combination = FALSE; combination = false;
part_of_combo = FALSE; part_of_combo = false;
reject_spaces = FALSE; reject_spaces = false;
} }
void WERD_RES::InitPointers() { void WERD_RES::InitPointers() {

View File

@ -60,7 +60,7 @@ class PAGE_RES { // page result
int32_t char_count; int32_t char_count;
int32_t rej_count; int32_t rej_count;
BLOCK_RES_LIST block_res_list; BLOCK_RES_LIST block_res_list;
BOOL8 rejected; bool rejected;
// Updated every time PAGE_RES_IT iterating on this PAGE_RES moves to // Updated every time PAGE_RES_IT iterating on this PAGE_RES moves to
// the next word. This pointer is not owned by PAGE_RES class. // the next word. This pointer is not owned by PAGE_RES class.
WERD_CHOICE **prev_word_best_choice; WERD_CHOICE **prev_word_best_choice;
@ -75,7 +75,7 @@ class PAGE_RES { // page result
inline void Init() { inline void Init() {
char_count = 0; char_count = 0;
rej_count = 0; rej_count = 0;
rejected = FALSE; rejected = false;
prev_word_best_choice = nullptr; prev_word_best_choice = nullptr;
blame_reasons.init_to_size(IRR_NUM_REASONS, 0); blame_reasons.init_to_size(IRR_NUM_REASONS, 0);
} }
@ -102,10 +102,10 @@ class BLOCK_RES:public ELIST_LINK {
int16_t font_class; // int16_t font_class; //
int16_t row_count; int16_t row_count;
float x_height; float x_height;
BOOL8 font_assigned; // block already bool font_assigned; // block already
// processed // processed
BOOL8 bold; // all bold bool bold; // all bold
BOOL8 italic; // all italic bool italic; // all italic
ROW_RES_LIST row_res_list; ROW_RES_LIST row_res_list;
@ -269,7 +269,7 @@ class WERD_RES : public ELIST_LINK {
// TODO(rays) Add more documentation here. // TODO(rays) Add more documentation here.
WERD_CHOICE *ep_choice; // ep text TODO(rays) delete this. WERD_CHOICE *ep_choice; // ep text TODO(rays) delete this.
REJMAP reject_map; // best_choice rejects REJMAP reject_map; // best_choice rejects
BOOL8 tess_failed; bool tess_failed;
/* /*
If tess_failed is TRUE, one of the following tests failed when Tess If tess_failed is TRUE, one of the following tests failed when Tess
returned: returned:
@ -277,9 +277,9 @@ class WERD_RES : public ELIST_LINK {
- The best_choice string contained ALL blanks; - The best_choice string contained ALL blanks;
- The best_choice string was zero length - The best_choice string was zero length
*/ */
BOOL8 tess_accepted; // Tess thinks its ok? bool tess_accepted; // Tess thinks its ok?
BOOL8 tess_would_adapt; // Tess would adapt? bool tess_would_adapt; // Tess would adapt?
BOOL8 done; // ready for output? bool done; // ready for output?
bool small_caps; // word appears to be small caps bool small_caps; // word appears to be small caps
bool odd_size; // word is bigger than line or leader dots. bool odd_size; // word is bigger than line or leader dots.
int8_t italic; int8_t italic;
@ -289,8 +289,8 @@ class WERD_RES : public ELIST_LINK {
const FontInfo* fontinfo2; const FontInfo* fontinfo2;
int8_t fontinfo_id_count; // number of votes int8_t fontinfo_id_count; // number of votes
int8_t fontinfo_id2_count; // number of votes int8_t fontinfo_id2_count; // number of votes
BOOL8 guessed_x_ht; bool guessed_x_ht;
BOOL8 guessed_caps_ht; bool guessed_caps_ht;
CRUNCH_MODE unlv_crunch_mode; CRUNCH_MODE unlv_crunch_mode;
float x_height; // post match estimate float x_height; // post match estimate
float caps_height; // post match estimate float caps_height; // post match estimate
@ -315,9 +315,9 @@ class WERD_RES : public ELIST_LINK {
Combination words are FOLLOWED by the sequence of part_of_combo words Combination words are FOLLOWED by the sequence of part_of_combo words
which they combine. which they combine.
*/ */
BOOL8 combination; //of two fuzzy gap wds bool combination; //of two fuzzy gap wds
BOOL8 part_of_combo; //part of a combo bool part_of_combo; //part of a combo
BOOL8 reject_spaces; //Reject spacing? bool reject_spaces; //Reject spacing?
WERD_RES() { WERD_RES() {
InitNonPointers(); InitNonPointers();

View File

@ -290,25 +290,21 @@ int16_t REJMAP::accept_count() { //How many accepted?
} }
BOOL8 REJMAP::recoverable_rejects() { //Any non perm rejs? bool REJMAP::recoverable_rejects() { //Any non perm rejs?
int i; for (int i = 0; i < len; i++) {
for (i = 0; i < len; i++) {
if (ptr[i].recoverable ()) if (ptr[i].recoverable ())
return TRUE; return true;
} }
return FALSE; return false;
} }
BOOL8 REJMAP::quality_recoverable_rejects() { //Any potential rejs? bool REJMAP::quality_recoverable_rejects() { //Any potential rejs?
int i; for (int i = 0; i < len; i++) {
for (i = 0; i < len; i++) {
if (ptr[i].accept_if_good_quality ()) if (ptr[i].accept_if_good_quality ())
return TRUE; return true;
} }
return FALSE; return false;
} }

View File

@ -154,14 +154,14 @@ class REJ
bool rejected(); //Is char rejected? bool rejected(); //Is char rejected?
BOOL8 accepted() { //Is char accepted? bool accepted() { //Is char accepted?
return !rejected (); return !rejected ();
} }
//potential rej? //potential rej?
bool accept_if_good_quality(); bool accept_if_good_quality();
BOOL8 recoverable() { bool recoverable() {
return (rejected () && !perm_rejected ()); return (rejected () && !perm_rejected ());
} }
@ -240,9 +240,9 @@ class REJMAP
void full_print(FILE *fp); void full_print(FILE *fp);
BOOL8 recoverable_rejects(); //Any non perm rejs? bool recoverable_rejects(); //Any non perm rejs?
BOOL8 quality_recoverable_rejects(); bool quality_recoverable_rejects();
//Any potential rejs? //Any potential rejs?
void rej_word_small_xht(); //Reject whole word void rej_word_small_xht(); //Reject whole word

View File

@ -320,7 +320,7 @@ int32_t STATS::cluster(float lower, // thresholds
float multiple, // distance threshold float multiple, // distance threshold
int32_t max_clusters, // max no to make int32_t max_clusters, // max no to make
STATS *clusters) { // array of clusters STATS *clusters) { // array of clusters
BOOL8 new_cluster; // added one bool new_cluster; // added one
float *centres; // cluster centres float *centres; // cluster centres
int32_t entry; // bucket index int32_t entry; // bucket index
int32_t cluster; // cluster index int32_t cluster; // cluster index
@ -369,7 +369,7 @@ int32_t STATS::cluster(float lower, // thresholds
clusters[0].set_range(rangemin_, rangemax_); clusters[0].set_range(rangemin_, rangemax_);
} }
do { do {
new_cluster = FALSE; new_cluster = false;
new_mode = 0; new_mode = 0;
for (entry = 0; entry < rangemax_ - rangemin_; entry++) { for (entry = 0; entry < rangemax_ - rangemin_; entry++) {
count = buckets_[entry] - clusters[0].buckets_[entry]; count = buckets_[entry] - clusters[0].buckets_[entry];
@ -401,7 +401,7 @@ int32_t STATS::cluster(float lower, // thresholds
// need new and room // need new and room
if (new_mode > 0 && cluster_count < max_clusters) { if (new_mode > 0 && cluster_count < max_clusters) {
cluster_count++; cluster_count++;
new_cluster = TRUE; new_cluster = true;
if (!clusters[cluster_count].set_range(rangemin_, rangemax_)) { if (!clusters[cluster_count].set_range(rangemin_, rangemax_)) {
delete [] centres; delete [] centres;
return 0; return 0;

View File

@ -125,11 +125,11 @@ class WERD : public ELIST2_LINK {
const char *text() const { return correct.string(); } const char *text() const { return correct.string(); }
void set_text(const char *new_text) { correct = new_text; } void set_text(const char *new_text) { correct = new_text; }
BOOL8 flag(WERD_FLAGS mask) const { return flags.bit(mask); } bool flag(WERD_FLAGS mask) const { return flags.bit(mask); }
void set_flag(WERD_FLAGS mask, bool value) { flags.set_bit(mask, value); } void set_flag(WERD_FLAGS mask, bool value) { flags.set_bit(mask, value); }
BOOL8 display_flag(uint8_t flag) const { return disp_flags.bit(flag); } bool display_flag(uint8_t flag) const { return disp_flags.bit(flag); }
void set_display_flag(uint8_t flag, BOOL8 value) { void set_display_flag(uint8_t flag, bool value) {
disp_flags.set_bit(flag, value); disp_flags.set_bit(flag, value);
} }

View File

@ -466,9 +466,9 @@ CLIST_LINK *CLIST_ITERATOR::extract_sublist( //from
nullptr); nullptr);
#endif #endif
ex_current_was_last = other_it->ex_current_was_last = FALSE; ex_current_was_last = other_it->ex_current_was_last = false;
ex_current_was_cycle_pt = FALSE; ex_current_was_cycle_pt = false;
other_it->ex_current_was_cycle_pt = FALSE; other_it->ex_current_was_cycle_pt = false;
temp_it.mark_cycle_pt (); temp_it.mark_cycle_pt ();
do { //walk sublist do { //walk sublist
@ -477,14 +477,14 @@ CLIST_LINK *CLIST_ITERATOR::extract_sublist( //from
if (temp_it.at_last ()) { if (temp_it.at_last ()) {
list->last = prev; list->last = prev;
ex_current_was_last = other_it->ex_current_was_last = TRUE; ex_current_was_last = other_it->ex_current_was_last = true;
} }
if (temp_it.current == cycle_pt) if (temp_it.current == cycle_pt)
ex_current_was_cycle_pt = TRUE; ex_current_was_cycle_pt = true;
if (temp_it.current == other_it->cycle_pt) if (temp_it.current == other_it->cycle_pt)
other_it->ex_current_was_cycle_pt = TRUE; other_it->ex_current_was_cycle_pt = true;
temp_it.forward (); temp_it.forward ();
} }

View File

@ -150,13 +150,13 @@ class DLLSYM CLIST_ITERATOR
CLIST_LINK *prev; //prev element CLIST_LINK *prev; //prev element
CLIST_LINK *current; //current element CLIST_LINK *current; //current element
CLIST_LINK *next; //next element CLIST_LINK *next; //next element
BOOL8 ex_current_was_last; //current extracted bool ex_current_was_last; //current extracted
//was end of list //was end of list
BOOL8 ex_current_was_cycle_pt; //current extracted bool ex_current_was_cycle_pt; //current extracted
//was cycle point //was cycle point
CLIST_LINK *cycle_pt; //point we are cycling CLIST_LINK *cycle_pt; //point we are cycling
//the list to. //the list to.
BOOL8 started_cycling; //Have we moved off bool started_cycling; //Have we moved off
//the start? //the start?
CLIST_LINK *extract_sublist( //from this current... CLIST_LINK *extract_sublist( //from this current...
@ -214,7 +214,7 @@ class DLLSYM CLIST_ITERATOR
void mark_cycle_pt(); //remember current void mark_cycle_pt(); //remember current
BOOL8 empty() { //is list empty? bool empty() { //is list empty?
#ifndef NDEBUG #ifndef NDEBUG
if (!list) if (!list)
NO_LIST.error ("CLIST_ITERATOR::empty", ABORT, nullptr); NO_LIST.error ("CLIST_ITERATOR::empty", ABORT, nullptr);
@ -222,15 +222,15 @@ class DLLSYM CLIST_ITERATOR
return list->empty (); return list->empty ();
} }
BOOL8 current_extracted() { //current extracted? bool current_extracted() { //current extracted?
return !current; return !current;
} }
BOOL8 at_first(); //Current is first? bool at_first(); //Current is first?
BOOL8 at_last(); //Current is last? bool at_last(); //Current is last?
BOOL8 cycled_list(); //Completed a cycle? bool cycled_list(); //Completed a cycle?
void add_to_end( // add at end & void add_to_end( // add at end &
void *new_data); // don't move void *new_data); // don't move
@ -266,9 +266,9 @@ inline void CLIST_ITERATOR::set_to_list( //change list
current = list->First (); current = list->First ();
next = current != nullptr ? current->next : nullptr; next = current != nullptr ? current->next : nullptr;
cycle_pt = nullptr; //await explicit set cycle_pt = nullptr; //await explicit set
started_cycling = FALSE; started_cycling = false;
ex_current_was_last = FALSE; ex_current_was_last = false;
ex_current_was_cycle_pt = FALSE; ex_current_was_cycle_pt = false;
} }
/*********************************************************************** /***********************************************************************
@ -354,7 +354,7 @@ inline void CLIST_ITERATOR::add_after_stay_put( // element to add
new_element->next = new_element; new_element->next = new_element;
list->last = new_element; list->last = new_element;
prev = next = new_element; prev = next = new_element;
ex_current_was_last = FALSE; ex_current_was_last = false;
current = nullptr; current = nullptr;
} }
else { else {
@ -371,7 +371,7 @@ inline void CLIST_ITERATOR::add_after_stay_put( // element to add
prev->next = new_element; prev->next = new_element;
if (ex_current_was_last) { if (ex_current_was_last) {
list->last = new_element; list->last = new_element;
ex_current_was_last = FALSE; ex_current_was_last = false;
} }
} }
next = new_element; next = new_element;
@ -448,7 +448,7 @@ inline void CLIST_ITERATOR::add_before_stay_put( // element to add
new_element->next = new_element; new_element->next = new_element;
list->last = new_element; list->last = new_element;
prev = next = new_element; prev = next = new_element;
ex_current_was_last = TRUE; ex_current_was_last = true;
current = nullptr; current = nullptr;
} }
else { else {
@ -489,7 +489,7 @@ inline void CLIST_ITERATOR::add_list_after(CLIST *list_to_add) {
list->last = list_to_add->last; list->last = list_to_add->last;
prev = list->last; prev = list->last;
next = list->First (); next = list->First ();
ex_current_was_last = TRUE; ex_current_was_last = true;
current = nullptr; current = nullptr;
} }
else { else {
@ -504,7 +504,7 @@ inline void CLIST_ITERATOR::add_list_after(CLIST *list_to_add) {
prev->next = list_to_add->First (); prev->next = list_to_add->First ();
if (ex_current_was_last) { if (ex_current_was_last) {
list->last = list_to_add->last; list->last = list_to_add->last;
ex_current_was_last = FALSE; ex_current_was_last = false;
} }
list_to_add->last->next = next; list_to_add->last->next = next;
next = prev->next; next = prev->next;
@ -537,7 +537,7 @@ inline void CLIST_ITERATOR::add_list_before(CLIST *list_to_add) {
prev = list->last; prev = list->last;
current = list->First (); current = list->First ();
next = current->next; next = current->next;
ex_current_was_last = FALSE; ex_current_was_last = false;
} }
else { else {
prev->next = list_to_add->First (); prev->next = list_to_add->First ();
@ -587,13 +587,13 @@ inline void *CLIST_ITERATOR::extract() {
if (current == list->last) { if (current == list->last) {
list->last = prev; list->last = prev;
ex_current_was_last = TRUE; ex_current_was_last = true;
} else { } else {
ex_current_was_last = FALSE; ex_current_was_last = false;
} }
} }
// Always set ex_current_was_cycle_pt so an add/forward will work in a loop. // Always set ex_current_was_cycle_pt so an add/forward will work in a loop.
ex_current_was_cycle_pt = (current == cycle_pt) ? TRUE : FALSE; ex_current_was_cycle_pt = (current == cycle_pt);
extracted_data = current->data; extracted_data = current->data;
delete(current); //destroy CONS cell delete(current); //destroy CONS cell
current = nullptr; current = nullptr;
@ -650,7 +650,7 @@ inline void CLIST_ITERATOR::mark_cycle_pt() {
* *
**********************************************************************/ **********************************************************************/
inline BOOL8 CLIST_ITERATOR::at_first() { inline bool CLIST_ITERATOR::at_first() {
#ifndef NDEBUG #ifndef NDEBUG
if (!list) if (!list)
NO_LIST.error ("CLIST_ITERATOR::at_first", ABORT, nullptr); NO_LIST.error ("CLIST_ITERATOR::at_first", ABORT, nullptr);
@ -669,7 +669,7 @@ inline BOOL8 CLIST_ITERATOR::at_first() {
* *
**********************************************************************/ **********************************************************************/
inline BOOL8 CLIST_ITERATOR::at_last() { inline bool CLIST_ITERATOR::at_last() {
#ifndef NDEBUG #ifndef NDEBUG
if (!list) if (!list)
NO_LIST.error ("CLIST_ITERATOR::at_last", ABORT, nullptr); NO_LIST.error ("CLIST_ITERATOR::at_last", ABORT, nullptr);
@ -688,7 +688,7 @@ inline BOOL8 CLIST_ITERATOR::at_last() {
* *
**********************************************************************/ **********************************************************************/
inline BOOL8 CLIST_ITERATOR::cycled_list() { inline bool CLIST_ITERATOR::cycled_list() {
#ifndef NDEBUG #ifndef NDEBUG
if (!list) if (!list)
NO_LIST.error ("CLIST_ITERATOR::cycled_list", ABORT, nullptr); NO_LIST.error ("CLIST_ITERATOR::cycled_list", ABORT, nullptr);

View File

@ -439,9 +439,9 @@ ELIST2_LINK *ELIST2_ITERATOR::extract_sublist( //fr
nullptr); nullptr);
#endif #endif
ex_current_was_last = other_it->ex_current_was_last = FALSE; ex_current_was_last = other_it->ex_current_was_last = false;
ex_current_was_cycle_pt = FALSE; ex_current_was_cycle_pt = false;
other_it->ex_current_was_cycle_pt = FALSE; other_it->ex_current_was_cycle_pt = false;
temp_it.mark_cycle_pt (); temp_it.mark_cycle_pt ();
do { //walk sublist do { //walk sublist
@ -450,14 +450,14 @@ ELIST2_LINK *ELIST2_ITERATOR::extract_sublist( //fr
if (temp_it.at_last ()) { if (temp_it.at_last ()) {
list->last = prev; list->last = prev;
ex_current_was_last = other_it->ex_current_was_last = TRUE; ex_current_was_last = other_it->ex_current_was_last = true;
} }
if (temp_it.current == cycle_pt) if (temp_it.current == cycle_pt)
ex_current_was_cycle_pt = TRUE; ex_current_was_cycle_pt = true;
if (temp_it.current == other_it->cycle_pt) if (temp_it.current == other_it->cycle_pt)
other_it->ex_current_was_cycle_pt = TRUE; other_it->ex_current_was_cycle_pt = true;
temp_it.forward (); temp_it.forward ();
} }

View File

@ -156,13 +156,13 @@ class DLLSYM ELIST2_ITERATOR
ELIST2_LINK *prev; //prev element ELIST2_LINK *prev; //prev element
ELIST2_LINK *current; //current element ELIST2_LINK *current; //current element
ELIST2_LINK *next; //next element ELIST2_LINK *next; //next element
BOOL8 ex_current_was_last; //current extracted bool ex_current_was_last; //current extracted
//was end of list //was end of list
BOOL8 ex_current_was_cycle_pt; //current extracted bool ex_current_was_cycle_pt; //current extracted
//was cycle point //was cycle point
ELIST2_LINK *cycle_pt; //point we are cycling ELIST2_LINK *cycle_pt; //point we are cycling
//the list to. //the list to.
BOOL8 started_cycling; //Have we moved off bool started_cycling; //Have we moved off
//the start? //the start?
ELIST2_LINK *extract_sublist( //from this current... ELIST2_LINK *extract_sublist( //from this current...
@ -219,7 +219,7 @@ class DLLSYM ELIST2_ITERATOR
void mark_cycle_pt(); //remember current void mark_cycle_pt(); //remember current
BOOL8 empty() { //is list empty? bool empty() { //is list empty?
#ifndef NDEBUG #ifndef NDEBUG
if (!list) if (!list)
NO_LIST.error ("ELIST2_ITERATOR::empty", ABORT, nullptr); NO_LIST.error ("ELIST2_ITERATOR::empty", ABORT, nullptr);
@ -227,15 +227,15 @@ class DLLSYM ELIST2_ITERATOR
return list->empty (); return list->empty ();
} }
BOOL8 current_extracted() { //current extracted? bool current_extracted() { //current extracted?
return !current; return !current;
} }
BOOL8 at_first(); //Current is first? bool at_first(); //Current is first?
BOOL8 at_last(); //Current is last? bool at_last(); //Current is last?
BOOL8 cycled_list(); //Completed a cycle? bool cycled_list(); //Completed a cycle?
void add_to_end( // add at end & void add_to_end( // add at end &
ELIST2_LINK *new_link); // don't move ELIST2_LINK *new_link); // don't move
@ -274,9 +274,9 @@ inline void ELIST2_ITERATOR::set_to_list( //change list
current = list->First (); current = list->First ();
next = current ? current->next : nullptr; next = current ? current->next : nullptr;
cycle_pt = nullptr; //await explicit set cycle_pt = nullptr; //await explicit set
started_cycling = FALSE; started_cycling = false;
ex_current_was_last = FALSE; ex_current_was_last = false;
ex_current_was_cycle_pt = FALSE; ex_current_was_cycle_pt = false;
} }
/*********************************************************************** /***********************************************************************
@ -361,7 +361,7 @@ inline void ELIST2_ITERATOR::add_after_stay_put( // element to add
new_element->prev = new_element; new_element->prev = new_element;
list->last = new_element; list->last = new_element;
prev = next = new_element; prev = next = new_element;
ex_current_was_last = FALSE; ex_current_was_last = false;
current = nullptr; current = nullptr;
} }
else { else {
@ -381,7 +381,7 @@ inline void ELIST2_ITERATOR::add_after_stay_put( // element to add
prev->next = new_element; prev->next = new_element;
if (ex_current_was_last) { if (ex_current_was_last) {
list->last = new_element; list->last = new_element;
ex_current_was_last = FALSE; ex_current_was_last = false;
} }
} }
next = new_element; next = new_element;
@ -458,7 +458,7 @@ inline void ELIST2_ITERATOR::add_before_stay_put( // element to add
new_element->prev = new_element; new_element->prev = new_element;
list->last = new_element; list->last = new_element;
prev = next = new_element; prev = next = new_element;
ex_current_was_last = TRUE; ex_current_was_last = true;
current = nullptr; current = nullptr;
} }
else { else {
@ -503,7 +503,7 @@ inline void ELIST2_ITERATOR::add_list_after(ELIST2 *list_to_add) {
list->last = list_to_add->last; list->last = list_to_add->last;
prev = list->last; prev = list->last;
next = list->First (); next = list->First ();
ex_current_was_last = TRUE; ex_current_was_last = true;
current = nullptr; current = nullptr;
} }
else { else {
@ -521,7 +521,7 @@ inline void ELIST2_ITERATOR::add_list_after(ELIST2 *list_to_add) {
prev->next->prev = prev; prev->next->prev = prev;
if (ex_current_was_last) { if (ex_current_was_last) {
list->last = list_to_add->last; list->last = list_to_add->last;
ex_current_was_last = FALSE; ex_current_was_last = false;
} }
list_to_add->last->next = next; list_to_add->last->next = next;
next->prev = list_to_add->last; next->prev = list_to_add->last;
@ -555,7 +555,7 @@ inline void ELIST2_ITERATOR::add_list_before(ELIST2 *list_to_add) {
prev = list->last; prev = list->last;
current = list->First (); current = list->First ();
next = current->next; next = current->next;
ex_current_was_last = FALSE; ex_current_was_last = false;
} }
else { else {
prev->next = list_to_add->First (); prev->next = list_to_add->First ();
@ -610,13 +610,13 @@ inline ELIST2_LINK *ELIST2_ITERATOR::extract() {
if (current == list->last) { if (current == list->last) {
list->last = prev; list->last = prev;
ex_current_was_last = TRUE; ex_current_was_last = true;
} else { } else {
ex_current_was_last = FALSE; ex_current_was_last = false;
} }
} }
// Always set ex_current_was_cycle_pt so an add/forward will work in a loop. // Always set ex_current_was_cycle_pt so an add/forward will work in a loop.
ex_current_was_cycle_pt = (current == cycle_pt) ? TRUE : FALSE; ex_current_was_cycle_pt = (current == cycle_pt) ? true : false;
extracted_link = current; extracted_link = current;
extracted_link->next = nullptr; //for safety extracted_link->next = nullptr; //for safety
extracted_link->prev = nullptr; //for safety extracted_link->prev = nullptr; //for safety
@ -693,7 +693,7 @@ inline void ELIST2_ITERATOR::mark_cycle_pt() {
* *
**********************************************************************/ **********************************************************************/
inline BOOL8 ELIST2_ITERATOR::at_first() { inline bool ELIST2_ITERATOR::at_first() {
#ifndef NDEBUG #ifndef NDEBUG
if (!list) if (!list)
NO_LIST.error ("ELIST2_ITERATOR::at_first", ABORT, nullptr); NO_LIST.error ("ELIST2_ITERATOR::at_first", ABORT, nullptr);
@ -712,7 +712,7 @@ inline BOOL8 ELIST2_ITERATOR::at_first() {
* *
**********************************************************************/ **********************************************************************/
inline BOOL8 ELIST2_ITERATOR::at_last() { inline bool ELIST2_ITERATOR::at_last() {
#ifndef NDEBUG #ifndef NDEBUG
if (!list) if (!list)
NO_LIST.error ("ELIST2_ITERATOR::at_last", ABORT, nullptr); NO_LIST.error ("ELIST2_ITERATOR::at_last", ABORT, nullptr);
@ -731,7 +731,7 @@ inline BOOL8 ELIST2_ITERATOR::at_last() {
* *
**********************************************************************/ **********************************************************************/
inline BOOL8 ELIST2_ITERATOR::cycled_list() { inline bool ELIST2_ITERATOR::cycled_list() {
#ifndef NDEBUG #ifndef NDEBUG
if (!list) if (!list)
NO_LIST.error ("ELIST2_ITERATOR::cycled_list", ABORT, nullptr); NO_LIST.error ("ELIST2_ITERATOR::cycled_list", ABORT, nullptr);

View File

@ -54,7 +54,7 @@ GAPMAP::GAPMAP( //Constructor
min_left = INT16_MAX; min_left = INT16_MAX;
max_right = -INT16_MAX; max_right = -INT16_MAX;
total_rows = 0; total_rows = 0;
any_tabs = FALSE; any_tabs = false;
// row iterator // row iterator
TO_ROW_IT row_it(block->get_rows()); TO_ROW_IT row_it(block->get_rows());
@ -143,7 +143,7 @@ GAPMAP::GAPMAP( //Constructor
map[i] = 0; //prevent isolated quantum map[i] = 0; //prevent isolated quantum
} }
else else
any_tabs = TRUE; any_tabs = true;
} }
} }
if (gapmap_debug && any_tabs) if (gapmap_debug && any_tabs)

View File

@ -34,7 +34,7 @@ class GAPMAP
int16_t bucket_size; // half an x ht int16_t bucket_size; // half an x ht
int16_t *map; //empty counts int16_t *map; //empty counts
int16_t map_max; //map[0..max_map] defind int16_t map_max; //map[0..max_map] defind
BOOL8 any_tabs; bool any_tabs;
}; };
/*-----------------------------*/ /*-----------------------------*/

View File

@ -209,14 +209,14 @@ float make_rows(ICOORD page_tr, TO_BLOCK_LIST *port_blocks) {
for (block_it.mark_cycle_pt(); !block_it.cycled_list(); for (block_it.mark_cycle_pt(); !block_it.cycled_list();
block_it.forward()) block_it.forward())
make_initial_textrows(page_tr, block_it.data(), FCOORD(1.0f, 0.0f), make_initial_textrows(page_tr, block_it.data(), FCOORD(1.0f, 0.0f),
!(BOOL8) textord_test_landscape); !textord_test_landscape);
// compute globally // compute globally
compute_page_skew(port_blocks, port_m, port_err); compute_page_skew(port_blocks, port_m, port_err);
block_it.set_to_list(port_blocks); block_it.set_to_list(port_blocks);
for (block_it.mark_cycle_pt(); !block_it.cycled_list(); block_it.forward()) { for (block_it.mark_cycle_pt(); !block_it.cycled_list(); block_it.forward()) {
cleanup_rows_making(page_tr, block_it.data(), port_m, FCOORD(1.0f, 0.0f), cleanup_rows_making(page_tr, block_it.data(), port_m, FCOORD(1.0f, 0.0f),
block_it.data()->block->pdblk.bounding_box().left(), block_it.data()->block->pdblk.bounding_box().left(),
!(BOOL8)textord_test_landscape); !textord_test_landscape);
} }
return port_m; // global skew return port_m; // global skew
} }
@ -1144,7 +1144,7 @@ void adjust_row_limits( //tidy limits
tesseract::CCStruct::kAscenderFraction); tesseract::CCStruct::kAscenderFraction);
ymin = -size * tesseract::CCStruct::kDescenderFraction; ymin = -size * tesseract::CCStruct::kDescenderFraction;
row->set_limits (row->intercept () + ymin, row->intercept () + ymax); row->set_limits (row->intercept () + ymin, row->intercept () + ymax);
row->merged = FALSE; row->merged = false;
} }
} }

View File

@ -280,7 +280,7 @@ int Textord::correlate_with_stats(TO_ROW **rows, // rows of block.
mindescheight = -lineheight * MIN_DESC_FRACTION; mindescheight = -lineheight * MIN_DESC_FRACTION;
for (rowindex = 0; rowindex < rowcount; rowindex++) { for (rowindex = 0; rowindex < rowcount; rowindex++) {
row = rows[rowindex]; /*do each row */ row = rows[rowindex]; /*do each row */
row->all_caps = FALSE; row->all_caps = false;
if (row->ascrise / row->xheight < MIN_ASC_FRACTION) { if (row->ascrise / row->xheight < MIN_ASC_FRACTION) {
/*no ascenders */ /*no ascenders */
if (row->xheight >= lineheight * (1 - MAXHEIGHTVARIANCE) if (row->xheight >= lineheight * (1 - MAXHEIGHTVARIANCE)
@ -295,14 +295,14 @@ int Textord::correlate_with_stats(TO_ROW **rows, // rows of block.
row->ascrise = row->xheight - lineheight; row->ascrise = row->xheight - lineheight;
/*set to average */ /*set to average */
row->xheight = lineheight; row->xheight = lineheight;
row->all_caps = TRUE; row->all_caps = true;
} }
else { else {
row->ascrise = (fullheight - lineheight) * row->xheight row->ascrise = (fullheight - lineheight) * row->xheight
/ fullheight; / fullheight;
/*scale it */ /*scale it */
row->xheight -= row->ascrise; row->xheight -= row->ascrise;
row->all_caps = TRUE; row->all_caps = true;
} }
if (row->ascrise < minascheight) if (row->ascrise < minascheight)
row->ascrise = row->ascrise =

View File

@ -63,7 +63,7 @@ void FPCUTPT::setup( //constructor
sq_sum = offset * offset; sq_sum = offset * offset;
cost = sq_sum; cost = sq_sum;
faked = FALSE; faked = FALSE;
terminal = FALSE; terminal = false;
fake_count = 0; fake_count = 0;
xpos = x; xpos = x;
region_index = 0; region_index = 0;
@ -96,18 +96,18 @@ void FPCUTPT::setup( //constructor
**********************************************************************/ **********************************************************************/
void FPCUTPT::assign( //constructor void FPCUTPT::assign( //constructor
FPCUTPT *cutpts, //predecessors FPCUTPT* cutpts, //predecessors
int16_t array_origin, //start coord int16_t array_origin, //start coord
int16_t x, //position int16_t x, //position
BOOL8 faking, //faking this one bool faking, //faking this one
BOOL8 mid_cut, //cheap cut. bool mid_cut, //cheap cut.
int16_t offset, //dist to gap int16_t offset, //dist to gap
STATS *projection, //vertical occupation STATS* projection, //vertical occupation
float projection_scale, //scaling float projection_scale, //scaling
int16_t zero_count, //official zero int16_t zero_count, //official zero
int16_t pitch, //proposed pitch int16_t pitch, //proposed pitch
int16_t pitch_error //allowed tolerance int16_t pitch_error //allowed tolerance
) { ) {
int index; //test index int index; //test index
int balance_index; //for balance factor int balance_index; //for balance factor
int16_t balance_count; //ding factor int16_t balance_count; //ding factor
@ -140,7 +140,7 @@ void FPCUTPT::assign( //constructor
cost = MAX_FLOAT32; cost = MAX_FLOAT32;
pred = nullptr; pred = nullptr;
faked = faking; faked = faking;
terminal = FALSE; terminal = false;
region_index = 0; region_index = 0;
fake_count = INT16_MAX; fake_count = INT16_MAX;
for (index = x - pitch - pitch_error; index <= x - pitch + pitch_error; for (index = x - pitch - pitch_error; index <= x - pitch + pitch_error;
@ -247,7 +247,7 @@ void FPCUTPT::assign_cheap( //constructor
cost = MAX_FLOAT32; cost = MAX_FLOAT32;
pred = nullptr; pred = nullptr;
faked = faking; faked = faking;
terminal = FALSE; terminal = false;
region_index = 0; region_index = 0;
fake_count = INT16_MAX; fake_count = INT16_MAX;
index = x - pitch; index = x - pitch;
@ -309,8 +309,8 @@ double check_pitch_sync2( //find segmentation
int16_t start, //start of good range int16_t start, //start of good range
int16_t end //end of good range int16_t end //end of good range
) { ) {
BOOL8 faking; //illegal cut pt bool faking; //illegal cut pt
BOOL8 mid_cut; //cheap cut pt. bool mid_cut; //cheap cut pt.
int16_t x; //current coord int16_t x; //current coord
int16_t blob_index; //blob number int16_t blob_index; //blob number
int16_t left_edge; //of word int16_t left_edge; //of word
@ -383,8 +383,8 @@ double check_pitch_sync2( //find segmentation
next_box = box_next (&this_it); next_box = box_next (&this_it);
blob_index++; blob_index++;
} }
faking = FALSE; faking = false;
mid_cut = FALSE; mid_cut = false;
if (x <= this_box.left ()) if (x <= this_box.left ())
offset = 0; offset = 0;
else if (x <= this_box.left () + pitch_error) else if (x <= this_box.left () + pitch_error)
@ -400,11 +400,11 @@ double check_pitch_sync2( //find segmentation
offset = this_box.right () - x; offset = this_box.right () - x;
else if (x - this_box.left () > pitch * pitsync_joined_edge else if (x - this_box.left () > pitch * pitsync_joined_edge
&& this_box.right () - x > pitch * pitsync_joined_edge) { && this_box.right () - x > pitch * pitsync_joined_edge) {
mid_cut = TRUE; mid_cut = true;
offset = 0; offset = 0;
} }
else { else {
faking = TRUE; faking = true;
offset = projection->pile_count (x); offset = projection->pile_count (x);
} }
cutpts[x - array_origin].assign (cutpts, array_origin, x, cutpts[x - array_origin].assign (cutpts, array_origin, x,
@ -420,10 +420,10 @@ double check_pitch_sync2( //find segmentation
while (x < right_edge + pitch) { while (x < right_edge + pitch) {
offset = x < right_edge ? right_edge - x : 0; offset = x < right_edge ? right_edge - x : 0;
cutpts[x - array_origin].assign (cutpts, array_origin, x, cutpts[x - array_origin].assign (cutpts, array_origin, x,
FALSE, FALSE, offset, projection, false, false, offset, projection,
projection_scale, zero_count, pitch, projection_scale, zero_count, pitch,
pitch_error); pitch_error);
cutpts[x - array_origin].terminal = TRUE; cutpts[x - array_origin].terminal = true;
if (cutpts[x - array_origin].index () + if (cutpts[x - array_origin].index () +
cutpts[x - array_origin].fake_count <= best_count + best_fake) { cutpts[x - array_origin].fake_count <= best_count + best_fake) {
if (cutpts[x - array_origin].fake_count < best_fake if (cutpts[x - array_origin].fake_count < best_fake
@ -505,8 +505,8 @@ double check_pitch_sync3( //find segmentation
int16_t start, //start of good range int16_t start, //start of good range
int16_t end //end of good range int16_t end //end of good range
) { ) {
BOOL8 faking; //illegal cut pt bool faking; //illegal cut pt
BOOL8 mid_cut; //cheap cut pt. bool mid_cut; //cheap cut pt.
int16_t left_edge; //of word int16_t left_edge; //of word
int16_t right_edge; //of word int16_t right_edge; //of word
int16_t x; //current coord int16_t x; //current coord
@ -570,8 +570,8 @@ double check_pitch_sync3( //find segmentation
minindex++; minindex++;
if (minindex > pitch_error * 2) if (minindex > pitch_error * 2)
minindex = 0; minindex = 0;
faking = FALSE; faking = false;
mid_cut = FALSE; mid_cut = false;
offset = 0; offset = 0;
if (projection->pile_count (x) <= zero_count) { if (projection->pile_count (x) <= zero_count) {
prev_zero = x; prev_zero = x;
@ -599,14 +599,14 @@ double check_pitch_sync3( //find segmentation
} }
if (offset > pitch_error) { if (offset > pitch_error) {
offset = projection->pile_count (x); offset = projection->pile_count (x);
faking = TRUE; faking = true;
} }
else { else {
projection_offset = projection_offset =
(int16_t) (projection->pile_count (x) / projection_scale); (int16_t) (projection->pile_count (x) / projection_scale);
if (projection_offset > offset) if (projection_offset > offset)
offset = projection_offset; offset = projection_offset;
mid_cut = TRUE; mid_cut = true;
} }
} }
if ((start == 0 && end == 0) if ((start == 0 && end == 0)
@ -635,10 +635,10 @@ double check_pitch_sync3( //find segmentation
while (x < right_edge + pitch) { while (x < right_edge + pitch) {
offset = x < right_edge ? right_edge - x : 0; offset = x < right_edge ? right_edge - x : 0;
cutpts[x - array_origin].assign (cutpts, array_origin, x, cutpts[x - array_origin].assign (cutpts, array_origin, x,
FALSE, FALSE, offset, projection, false, false, offset, projection,
projection_scale, zero_count, pitch, projection_scale, zero_count, pitch,
pitch_error); pitch_error);
cutpts[x - array_origin].terminal = TRUE; cutpts[x - array_origin].terminal = true;
if (cutpts[x - array_origin].index () + if (cutpts[x - array_origin].index () +
cutpts[x - array_origin].fake_count <= best_count + best_fake) { cutpts[x - array_origin].fake_count <= best_count + best_fake) {
if (cutpts[x - array_origin].fake_count < best_fake if (cutpts[x - array_origin].fake_count < best_fake

View File

@ -40,14 +40,14 @@ class FPCUTPT
int16_t x, //position int16_t x, //position
int16_t offset); //dist to gap int16_t offset); //dist to gap
void assign ( //evaluate cut void assign( //evaluate cut
FPCUTPT cutpts[], //predecessors FPCUTPT cutpts[], //predecessors
int16_t array_origin, //start coord int16_t array_origin, //start coord
int16_t x, //position int16_t x, //position
BOOL8 faking, //faking this one bool faking, //faking this one
BOOL8 mid_cut, //doing free cut bool mid_cut, //doing free cut
int16_t offset, //extra cost dist int16_t offset, //extra cost dist
STATS * projection, //occupation STATS* projection, //occupation
float projection_scale, //scaling float projection_scale, //scaling
int16_t zero_count, //official zero int16_t zero_count, //official zero
int16_t pitch, //proposed pitch int16_t pitch, //proposed pitch
@ -88,8 +88,8 @@ class FPCUTPT
return region_index; return region_index;
} }
BOOL8 faked; //faked split point bool faked; //faked split point
BOOL8 terminal; //successful end bool terminal; //successful end
int16_t fake_count; //total fakes to here int16_t fake_count; //total fakes to here
private: private: