mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2024-12-11 15:09:03 +08:00
More fixes BOOL8 -> bool
This commit is contained in:
parent
6f580bad77
commit
6ff0b56597
@ -37,9 +37,9 @@
|
||||
#endif
|
||||
|
||||
namespace tesseract {
|
||||
BOOL8 Tesseract::word_adaptable( //should we adapt?
|
||||
WERD_RES *word,
|
||||
uint16_t mode) {
|
||||
bool Tesseract::word_adaptable( //should we adapt?
|
||||
WERD_RES* word,
|
||||
uint16_t mode) {
|
||||
if (tessedit_adaption_debug) {
|
||||
tprintf("Running word_adaptable() for %s rating %.4f certainty %.4f\n",
|
||||
word->best_choice == nullptr ? "" :
|
||||
@ -65,7 +65,7 @@ BOOL8 Tesseract::word_adaptable( //should we adapt?
|
||||
*/
|
||||
if (mode == 0) {
|
||||
if (tessedit_adaption_debug) tprintf("adaption disabled\n");
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (flags.bit (ADAPTABLE_WERD)) {
|
||||
@ -83,7 +83,7 @@ BOOL8 Tesseract::word_adaptable( //should we adapt?
|
||||
}
|
||||
|
||||
if (!status) { // If not set then
|
||||
return FALSE; // ignore other checks
|
||||
return false; // ignore other checks
|
||||
}
|
||||
|
||||
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 () != NUMBER_PERM)) {
|
||||
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 (tessedit_adaption_debug) tprintf("word has ell conflict\n");
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (flags.bit (CHECK_SPACES) &&
|
||||
(strchr(word->best_choice->unichar_string().string(), ' ') != nullptr)) {
|
||||
if (tessedit_adaption_debug) tprintf("word contains spaces\n");
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (flags.bit (CHECK_AMBIG_WERD) &&
|
||||
word->best_choice->dangerous_ambig_found()) {
|
||||
if (tessedit_adaption_debug) tprintf("word is ambiguous\n");
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (tessedit_adaption_debug) {
|
||||
|
@ -80,7 +80,7 @@ void Tesseract::recog_pseudo_word(PAGE_RES* page_res,
|
||||
*
|
||||
* @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 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_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.
|
||||
|
@ -304,7 +304,7 @@ void Tesseract::doc_and_block_rejection( //reject big chunks
|
||||
prev_word_rejected &&
|
||||
page_res_it.prev_row() == page_res_it.row() &&
|
||||
word->word->space() == 1)
|
||||
word->reject_spaces = TRUE;
|
||||
word->reject_spaces = true;
|
||||
word->reject_map.rej_word_block_rej();
|
||||
}
|
||||
prev_word_rejected = rej_word;
|
||||
@ -375,7 +375,7 @@ void Tesseract::doc_and_block_rejection( //reject big chunks
|
||||
prev_word_rejected &&
|
||||
page_res_it.prev_row() == page_res_it.row() &&
|
||||
word->word->space () == 1)
|
||||
word->reject_spaces = TRUE;
|
||||
word->reject_spaces = true;
|
||||
word->reject_map.rej_word_row_rej();
|
||||
}
|
||||
prev_word_rejected = rej_word;
|
||||
@ -411,7 +411,7 @@ void reject_whole_page(PAGE_RES_IT &page_res_it) {
|
||||
page_res_it.forward ();
|
||||
}
|
||||
//whole page is rejected
|
||||
page_res_it.page_res->rejected = TRUE;
|
||||
page_res_it.page_res->rejected = true;
|
||||
}
|
||||
|
||||
namespace tesseract {
|
||||
@ -501,8 +501,8 @@ void Tesseract::tilde_crunch(PAGE_RES_IT &page_res_it) {
|
||||
}
|
||||
|
||||
|
||||
BOOL8 Tesseract::terrible_word_crunch(WERD_RES *word,
|
||||
GARBAGE_LEVEL garbage_level) {
|
||||
bool Tesseract::terrible_word_crunch(WERD_RES* word,
|
||||
GARBAGE_LEVEL garbage_level) {
|
||||
float rating_per_ch;
|
||||
int adjusted_len;
|
||||
int crunch_mode = 0;
|
||||
@ -533,15 +533,15 @@ BOOL8 Tesseract::terrible_word_crunch(WERD_RES *word,
|
||||
tprintf ("Terrible_word_crunch (%d) on \"%s\"\n",
|
||||
crunch_mode, word->best_choice->unichar_string().string());
|
||||
}
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
BOOL8 Tesseract::potential_word_crunch(WERD_RES *word,
|
||||
GARBAGE_LEVEL garbage_level,
|
||||
BOOL8 ok_dict_word) {
|
||||
bool Tesseract::potential_word_crunch(WERD_RES* word,
|
||||
GARBAGE_LEVEL garbage_level,
|
||||
bool ok_dict_word) {
|
||||
float rating_per_ch;
|
||||
int adjusted_len;
|
||||
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
|
||||
int16_t outline_count = 0;
|
||||
int16_t small_outline_count = 0;
|
||||
|
@ -184,8 +184,8 @@ void initialise_search(WERD_RES_LIST &src_list, WERD_RES_LIST &new_list) {
|
||||
src_wd = src_it.data();
|
||||
if (!src_wd->combination) {
|
||||
new_wd = WERD_RES::deep_copy(src_wd);
|
||||
new_wd->combination = FALSE;
|
||||
new_wd->part_of_combo = FALSE;
|
||||
new_wd->combination = false;
|
||||
new_wd->part_of_combo = false;
|
||||
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->combination = TRUE;
|
||||
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);
|
||||
}
|
||||
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 {
|
||||
// Copy current wd to combo
|
||||
combo->copy_on(word);
|
||||
word->part_of_combo = TRUE;
|
||||
word->part_of_combo = true;
|
||||
}
|
||||
combo->done = FALSE;
|
||||
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();
|
||||
// Even deep_copy doesn't copy the underlying WERD unless its combination
|
||||
// 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));
|
||||
old_word_res->combination = FALSE; // Undo kludge
|
||||
old_word_res->combination = false; // Undo kludge
|
||||
|
||||
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);
|
||||
new_word_res->combination = TRUE;
|
||||
new_word_res->combination = true;
|
||||
worst_word_it.add_before_then_move(new_word_res);
|
||||
|
||||
word_res->ClearResults();
|
||||
|
@ -412,9 +412,9 @@ int16_t Tesseract::count_alphanums(const WERD_CHOICE &word) {
|
||||
}
|
||||
|
||||
|
||||
BOOL8 Tesseract::acceptable_number_string(const char *s,
|
||||
const char *lengths) {
|
||||
BOOL8 prev_digit = FALSE;
|
||||
bool Tesseract::acceptable_number_string(const char* s,
|
||||
const char* lengths) {
|
||||
bool prev_digit = false;
|
||||
|
||||
if (*lengths == 1 && *s == '(')
|
||||
s++;
|
||||
@ -425,21 +425,21 @@ BOOL8 Tesseract::acceptable_number_string(const char *s,
|
||||
|
||||
for (; *s != '\0'; s += *(lengths++)) {
|
||||
if (unicharset.get_isdigit(s, *lengths))
|
||||
prev_digit = TRUE;
|
||||
prev_digit = true;
|
||||
else if (prev_digit &&
|
||||
(*lengths == 1 && ((*s == '.') || (*s == ',') || (*s == '-'))))
|
||||
prev_digit = FALSE;
|
||||
prev_digit = false;
|
||||
else if (prev_digit && *lengths == 1 &&
|
||||
(*(s + *lengths) == '\0') && ((*s == '%') || (*s == ')')))
|
||||
return TRUE;
|
||||
return true;
|
||||
else if (prev_digit &&
|
||||
*lengths == 1 && (*s == '%') &&
|
||||
(*(lengths + 1) == 1 && *(s + *lengths) == ')') &&
|
||||
(*(s + *lengths + *(lengths + 1)) == '\0'))
|
||||
return TRUE;
|
||||
return true;
|
||||
else
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
} // namespace tesseract
|
||||
|
@ -302,7 +302,7 @@ SVMenuNode *Tesseract::build_menu_new() {
|
||||
* Redisplay page
|
||||
*/
|
||||
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;
|
||||
|
||||
image_win->Clear();
|
||||
@ -710,7 +710,7 @@ void show_point(PAGE_RES* page_res, float x, float y) {
|
||||
#endif // GRAPHICS_DISABLED
|
||||
namespace tesseract {
|
||||
#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,
|
||||
ScrollView::BLACK);
|
||||
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
|
||||
*/
|
||||
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();
|
||||
if (word_res->chopped_word == nullptr) {
|
||||
// Setup word normalization parameters.
|
||||
@ -744,7 +744,7 @@ BOOL8 Tesseract::word_bln_display(PAGE_RES_IT* pr_it) {
|
||||
color = WERD::NextColor(color);
|
||||
}
|
||||
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
|
||||
*/
|
||||
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* word = word_res->word;
|
||||
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));
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
#endif // GRAPHICS_DISABLED
|
||||
|
||||
@ -915,10 +915,10 @@ BOOL8 Tesseract::word_display(PAGE_RES_IT* pr_it) {
|
||||
*
|
||||
* 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) {
|
||||
tprintf("\nBlock data...\n");
|
||||
pr_it->block()->block->print(nullptr, FALSE);
|
||||
pr_it->block()->block->print(nullptr, false);
|
||||
}
|
||||
tprintf("\nRow data...\n");
|
||||
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",
|
||||
word_res->blamer_bundle->debug().string());
|
||||
}
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifndef GRAPHICS_DISABLED
|
||||
@ -939,7 +939,7 @@ BOOL8 Tesseract::word_dumper(PAGE_RES_IT* pr_it) {
|
||||
*
|
||||
* 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;
|
||||
word->set_display_flag(DF_BOX, word_display_mode.bit(DF_BOX));
|
||||
word->set_display_flag(DF_TEXT, word_display_mode.bit(DF_TEXT));
|
||||
|
@ -501,17 +501,17 @@ int16_t Tesseract::alpha_count(const char *word,
|
||||
}
|
||||
|
||||
|
||||
BOOL8 Tesseract::word_contains_non_1_digit(const char *word,
|
||||
const char *word_lengths) {
|
||||
bool Tesseract::word_contains_non_1_digit(const char* word,
|
||||
const char* word_lengths) {
|
||||
int16_t i;
|
||||
int16_t offset;
|
||||
|
||||
for (i = 0, offset = 0; word[offset] != '\0'; offset += word_lengths[i++]) {
|
||||
if (unicharset.get_isdigit (word + offset, word_lengths[i]) &&
|
||||
(word_lengths[i] != 1 || word[offset] != '1'))
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
|
@ -453,7 +453,7 @@ class Tesseract : public Wordrec {
|
||||
bool TestNewNormalization(int original_misfits, float baseline_shift,
|
||||
float new_x_ht, WERD_RES *word, BLOCK* block,
|
||||
ROW *row);
|
||||
BOOL8 recog_interactive(PAGE_RES_IT* pr_it);
|
||||
bool recog_interactive(PAGE_RES_IT* pr_it);
|
||||
|
||||
// Set fonts of this word.
|
||||
void set_word_fonts(WERD_RES *word);
|
||||
@ -497,8 +497,8 @@ class Tesseract : public Wordrec {
|
||||
);
|
||||
void set_unlv_suspects(WERD_RES *word);
|
||||
UNICHAR_ID get_rep_char(WERD_RES *word); // what char is repeated?
|
||||
BOOL8 acceptable_number_string(const char *s,
|
||||
const char *lengths);
|
||||
bool acceptable_number_string(const char* s,
|
||||
const char* lengths);
|
||||
int16_t count_alphanums(const WERD_CHOICE &word);
|
||||
int16_t count_alphas(const WERD_CHOICE &word);
|
||||
//// tessedit.h ////////////////////////////////////////////////////////
|
||||
@ -577,13 +577,13 @@ class Tesseract : public Wordrec {
|
||||
);
|
||||
void debug_word(PAGE_RES* page_res, const TBOX &selection_box);
|
||||
void do_re_display(
|
||||
BOOL8 (tesseract::Tesseract::*word_painter)(PAGE_RES_IT* pr_it));
|
||||
BOOL8 word_display(PAGE_RES_IT* pr_it);
|
||||
BOOL8 word_bln_display(PAGE_RES_IT* pr_it);
|
||||
BOOL8 word_blank_and_set_display(PAGE_RES_IT* pr_its);
|
||||
BOOL8 word_set_display(PAGE_RES_IT* pr_it);
|
||||
bool (tesseract::Tesseract::* word_painter)(PAGE_RES_IT* pr_it));
|
||||
bool word_display(PAGE_RES_IT* pr_it);
|
||||
bool word_bln_display(PAGE_RES_IT* pr_it);
|
||||
bool word_blank_and_set_display(PAGE_RES_IT* pr_its);
|
||||
bool word_set_display(PAGE_RES_IT* pr_it);
|
||||
// #ifndef GRAPHICS_DISABLED
|
||||
BOOL8 word_dumper(PAGE_RES_IT* pr_it);
|
||||
bool word_dumper(PAGE_RES_IT* pr_it);
|
||||
// #endif // GRAPHICS_DISABLED
|
||||
void blob_feature_display(PAGE_RES* page_res, const TBOX& selection_box);
|
||||
//// reject.h //////////////////////////////////////////////////////////
|
||||
@ -596,8 +596,8 @@ class Tesseract : public Wordrec {
|
||||
const char *word_lengths);
|
||||
int16_t alpha_count(const char *word,
|
||||
const char *word_lengths);
|
||||
BOOL8 word_contains_non_1_digit(const char *word,
|
||||
const char *word_lengths);
|
||||
bool word_contains_non_1_digit(const char* word,
|
||||
const char* word_lengths);
|
||||
void dont_allow_1Il(WERD_RES *word);
|
||||
int16_t count_alphanums( //how many alphanums
|
||||
WERD_RES *word);
|
||||
@ -618,9 +618,9 @@ class Tesseract : public Wordrec {
|
||||
void reject_edge_blobs(WERD_RES *word);
|
||||
void reject_mostly_rejects(WERD_RES *word);
|
||||
//// adaptions.h ///////////////////////////////////////////////////////
|
||||
BOOL8 word_adaptable( //should we adapt?
|
||||
WERD_RES *word,
|
||||
uint16_t mode);
|
||||
bool word_adaptable( //should we adapt?
|
||||
WERD_RES* word,
|
||||
uint16_t mode);
|
||||
|
||||
//// tfacepp.cpp ///////////////////////////////////////////////////////
|
||||
void recog_word_recursive(WERD_RES* word);
|
||||
@ -653,9 +653,9 @@ class Tesseract : public Wordrec {
|
||||
void break_noisiest_blob_word(WERD_RES_LIST &words);
|
||||
//// docqual.cpp ////////////////////////////////////////////////////////
|
||||
GARBAGE_LEVEL garbage_word(WERD_RES *word, BOOL8 ok_dict_word);
|
||||
BOOL8 potential_word_crunch(WERD_RES *word,
|
||||
GARBAGE_LEVEL garbage_level,
|
||||
BOOL8 ok_dict_word);
|
||||
bool potential_word_crunch(WERD_RES* word,
|
||||
GARBAGE_LEVEL garbage_level,
|
||||
bool ok_dict_word);
|
||||
void tilde_crunch(PAGE_RES_IT &page_res_it);
|
||||
void unrej_good_quality_words( //unreject potential
|
||||
PAGE_RES_IT &page_res_it);
|
||||
@ -672,17 +672,17 @@ class Tesseract : public Wordrec {
|
||||
void unrej_good_chs(WERD_RES *word, ROW *row);
|
||||
int16_t count_outline_errs(char c, int16_t outline_count);
|
||||
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);
|
||||
int16_t failure_count(WERD_RES *word);
|
||||
BOOL8 noise_outlines(TWERD *word);
|
||||
bool noise_outlines(TWERD* word);
|
||||
//// pagewalk.cpp ///////////////////////////////////////////////////////
|
||||
void
|
||||
process_selected_words (
|
||||
PAGE_RES* page_res, // blocks to check
|
||||
//function to call
|
||||
TBOX & selection_box,
|
||||
BOOL8 (tesseract::Tesseract::*word_processor)(PAGE_RES_IT* pr_it));
|
||||
process_selected_words(
|
||||
PAGE_RES* page_res, // blocks to check
|
||||
//function to call
|
||||
TBOX& selection_box,
|
||||
bool (tesseract::Tesseract::* word_processor)(PAGE_RES_IT* pr_it));
|
||||
//// tessbox.cpp ///////////////////////////////////////////////////////
|
||||
void tess_add_doc_word( //test acceptability
|
||||
WERD_CHOICE *word_choice //after context
|
||||
|
@ -820,8 +820,8 @@ void TO_ROW::compute_vertical_projection() { //project whole row
|
||||
* Zero out all scalar members.
|
||||
**********************************************************************/
|
||||
void TO_ROW::clear() {
|
||||
all_caps = 0;
|
||||
used_dm_model = 0;
|
||||
all_caps = false;
|
||||
used_dm_model = false;
|
||||
projection_left = 0;
|
||||
projection_right = 0;
|
||||
pitch_decision = PITCH_DUNNO;
|
||||
|
@ -639,9 +639,9 @@ class TO_ROW: public ELIST2_LINK
|
||||
}
|
||||
|
||||
// true when dead
|
||||
BOOL8 merged;
|
||||
BOOL8 all_caps; // had no ascenders
|
||||
BOOL8 used_dm_model; // in guessing pitch
|
||||
bool merged;
|
||||
bool all_caps; // had no ascenders
|
||||
bool used_dm_model; // in guessing pitch
|
||||
int16_t projection_left; // start of projection
|
||||
int16_t projection_right; // start of projection
|
||||
PITCH_TYPE pitch_decision; // how strong is decision
|
||||
|
@ -93,13 +93,13 @@ class DLLSYM C_OUTLINE:public ELIST_LINK {
|
||||
delete [] offsets;
|
||||
}
|
||||
|
||||
BOOL8 flag( //test flag
|
||||
bool flag( //test flag
|
||||
C_OUTLINE_FLAGS mask) const { //flag to test
|
||||
return flags.bit(mask);
|
||||
}
|
||||
void set_flag( //set flag value
|
||||
C_OUTLINE_FLAGS mask, //flag to test
|
||||
BOOL8 value) { //value to set
|
||||
C_OUTLINE_FLAGS mask, //flag to test
|
||||
bool value) { //value to set
|
||||
flags.set_bit(mask, value);
|
||||
}
|
||||
|
||||
|
@ -195,9 +195,9 @@ void BLOCK::compress( // squash it up
|
||||
*/
|
||||
|
||||
void BLOCK::print( //print list of sides
|
||||
FILE *, //< file to print on
|
||||
BOOL8 dump //< print full detail
|
||||
) {
|
||||
FILE*, //< file to print on
|
||||
bool dump //< print full detail
|
||||
) {
|
||||
ICOORDELT_IT it = &pdblk.leftside; //iterator
|
||||
|
||||
pdblk.box.print ();
|
||||
|
@ -187,7 +187,7 @@ class BLOCK:public ELIST_LINK
|
||||
void compress(const ICOORD vec);
|
||||
|
||||
/// dump whole table
|
||||
void print(FILE *fp, BOOL8 dump);
|
||||
void print(FILE* fp, bool dump);
|
||||
|
||||
BLOCK& operator=(const BLOCK & source);
|
||||
PDBLK pdblk; //< Page Description Block
|
||||
|
@ -89,9 +89,9 @@ BLOCK_RES::BLOCK_RES(bool merge_similar_words, BLOCK *the_block) {
|
||||
rej_count = 0;
|
||||
font_class = -1; //not assigned
|
||||
x_height = -1.0;
|
||||
font_assigned = FALSE;
|
||||
bold = FALSE;
|
||||
italic = FALSE;
|
||||
font_assigned = false;
|
||||
bold = false;
|
||||
italic = false;
|
||||
row_count = 0;
|
||||
|
||||
block = the_block;
|
||||
@ -1084,10 +1084,10 @@ WERD_RES::~WERD_RES () {
|
||||
}
|
||||
|
||||
void WERD_RES::InitNonPointers() {
|
||||
tess_failed = FALSE;
|
||||
tess_accepted = FALSE;
|
||||
tess_would_adapt = FALSE;
|
||||
done = FALSE;
|
||||
tess_failed = false;
|
||||
tess_accepted = false;
|
||||
tess_would_adapt = false;
|
||||
done = false;
|
||||
unlv_crunch_mode = CR_NONE;
|
||||
small_caps = false;
|
||||
odd_size = false;
|
||||
@ -1104,11 +1104,11 @@ void WERD_RES::InitNonPointers() {
|
||||
caps_height = 0.0;
|
||||
baseline_shift = 0.0f;
|
||||
space_certainty = 0.0f;
|
||||
guessed_x_ht = TRUE;
|
||||
guessed_caps_ht = TRUE;
|
||||
combination = FALSE;
|
||||
part_of_combo = FALSE;
|
||||
reject_spaces = FALSE;
|
||||
guessed_x_ht = true;
|
||||
guessed_caps_ht = true;
|
||||
combination = false;
|
||||
part_of_combo = false;
|
||||
reject_spaces = false;
|
||||
}
|
||||
|
||||
void WERD_RES::InitPointers() {
|
||||
|
@ -60,7 +60,7 @@ class PAGE_RES { // page result
|
||||
int32_t char_count;
|
||||
int32_t rej_count;
|
||||
BLOCK_RES_LIST block_res_list;
|
||||
BOOL8 rejected;
|
||||
bool rejected;
|
||||
// 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.
|
||||
WERD_CHOICE **prev_word_best_choice;
|
||||
@ -75,7 +75,7 @@ class PAGE_RES { // page result
|
||||
inline void Init() {
|
||||
char_count = 0;
|
||||
rej_count = 0;
|
||||
rejected = FALSE;
|
||||
rejected = false;
|
||||
prev_word_best_choice = nullptr;
|
||||
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 row_count;
|
||||
float x_height;
|
||||
BOOL8 font_assigned; // block already
|
||||
bool font_assigned; // block already
|
||||
// processed
|
||||
BOOL8 bold; // all bold
|
||||
BOOL8 italic; // all italic
|
||||
bool bold; // all bold
|
||||
bool italic; // all italic
|
||||
|
||||
ROW_RES_LIST row_res_list;
|
||||
|
||||
@ -269,7 +269,7 @@ class WERD_RES : public ELIST_LINK {
|
||||
// TODO(rays) Add more documentation here.
|
||||
WERD_CHOICE *ep_choice; // ep text TODO(rays) delete this.
|
||||
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
|
||||
returned:
|
||||
@ -277,9 +277,9 @@ class WERD_RES : public ELIST_LINK {
|
||||
- The best_choice string contained ALL blanks;
|
||||
- The best_choice string was zero length
|
||||
*/
|
||||
BOOL8 tess_accepted; // Tess thinks its ok?
|
||||
BOOL8 tess_would_adapt; // Tess would adapt?
|
||||
BOOL8 done; // ready for output?
|
||||
bool tess_accepted; // Tess thinks its ok?
|
||||
bool tess_would_adapt; // Tess would adapt?
|
||||
bool done; // ready for output?
|
||||
bool small_caps; // word appears to be small caps
|
||||
bool odd_size; // word is bigger than line or leader dots.
|
||||
int8_t italic;
|
||||
@ -289,8 +289,8 @@ class WERD_RES : public ELIST_LINK {
|
||||
const FontInfo* fontinfo2;
|
||||
int8_t fontinfo_id_count; // number of votes
|
||||
int8_t fontinfo_id2_count; // number of votes
|
||||
BOOL8 guessed_x_ht;
|
||||
BOOL8 guessed_caps_ht;
|
||||
bool guessed_x_ht;
|
||||
bool guessed_caps_ht;
|
||||
CRUNCH_MODE unlv_crunch_mode;
|
||||
float x_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
|
||||
which they combine.
|
||||
*/
|
||||
BOOL8 combination; //of two fuzzy gap wds
|
||||
BOOL8 part_of_combo; //part of a combo
|
||||
BOOL8 reject_spaces; //Reject spacing?
|
||||
bool combination; //of two fuzzy gap wds
|
||||
bool part_of_combo; //part of a combo
|
||||
bool reject_spaces; //Reject spacing?
|
||||
|
||||
WERD_RES() {
|
||||
InitNonPointers();
|
||||
|
@ -290,25 +290,21 @@ int16_t REJMAP::accept_count() { //How many accepted?
|
||||
}
|
||||
|
||||
|
||||
BOOL8 REJMAP::recoverable_rejects() { //Any non perm rejs?
|
||||
int i;
|
||||
|
||||
for (i = 0; i < len; i++) {
|
||||
bool REJMAP::recoverable_rejects() { //Any non perm rejs?
|
||||
for (int i = 0; i < len; i++) {
|
||||
if (ptr[i].recoverable ())
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
BOOL8 REJMAP::quality_recoverable_rejects() { //Any potential rejs?
|
||||
int i;
|
||||
|
||||
for (i = 0; i < len; i++) {
|
||||
bool REJMAP::quality_recoverable_rejects() { //Any potential rejs?
|
||||
for (int i = 0; i < len; i++) {
|
||||
if (ptr[i].accept_if_good_quality ())
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
@ -154,14 +154,14 @@ class REJ
|
||||
|
||||
bool rejected(); //Is char rejected?
|
||||
|
||||
BOOL8 accepted() { //Is char accepted?
|
||||
bool accepted() { //Is char accepted?
|
||||
return !rejected ();
|
||||
}
|
||||
|
||||
//potential rej?
|
||||
bool accept_if_good_quality();
|
||||
|
||||
BOOL8 recoverable() {
|
||||
bool recoverable() {
|
||||
return (rejected () && !perm_rejected ());
|
||||
}
|
||||
|
||||
@ -240,9 +240,9 @@ class REJMAP
|
||||
|
||||
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?
|
||||
|
||||
void rej_word_small_xht(); //Reject whole word
|
||||
|
@ -320,7 +320,7 @@ int32_t STATS::cluster(float lower, // thresholds
|
||||
float multiple, // distance threshold
|
||||
int32_t max_clusters, // max no to make
|
||||
STATS *clusters) { // array of clusters
|
||||
BOOL8 new_cluster; // added one
|
||||
bool new_cluster; // added one
|
||||
float *centres; // cluster centres
|
||||
int32_t entry; // bucket index
|
||||
int32_t cluster; // cluster index
|
||||
@ -369,7 +369,7 @@ int32_t STATS::cluster(float lower, // thresholds
|
||||
clusters[0].set_range(rangemin_, rangemax_);
|
||||
}
|
||||
do {
|
||||
new_cluster = FALSE;
|
||||
new_cluster = false;
|
||||
new_mode = 0;
|
||||
for (entry = 0; entry < rangemax_ - rangemin_; entry++) {
|
||||
count = buckets_[entry] - clusters[0].buckets_[entry];
|
||||
@ -401,7 +401,7 @@ int32_t STATS::cluster(float lower, // thresholds
|
||||
// need new and room
|
||||
if (new_mode > 0 && cluster_count < max_clusters) {
|
||||
cluster_count++;
|
||||
new_cluster = TRUE;
|
||||
new_cluster = true;
|
||||
if (!clusters[cluster_count].set_range(rangemin_, rangemax_)) {
|
||||
delete [] centres;
|
||||
return 0;
|
||||
|
@ -125,11 +125,11 @@ class WERD : public ELIST2_LINK {
|
||||
const char *text() const { return correct.string(); }
|
||||
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); }
|
||||
|
||||
BOOL8 display_flag(uint8_t flag) const { return disp_flags.bit(flag); }
|
||||
void set_display_flag(uint8_t flag, BOOL8 value) {
|
||||
bool display_flag(uint8_t flag) const { return disp_flags.bit(flag); }
|
||||
void set_display_flag(uint8_t flag, bool value) {
|
||||
disp_flags.set_bit(flag, value);
|
||||
}
|
||||
|
||||
|
@ -466,9 +466,9 @@ CLIST_LINK *CLIST_ITERATOR::extract_sublist( //from
|
||||
nullptr);
|
||||
#endif
|
||||
|
||||
ex_current_was_last = other_it->ex_current_was_last = FALSE;
|
||||
ex_current_was_cycle_pt = FALSE;
|
||||
other_it->ex_current_was_cycle_pt = FALSE;
|
||||
ex_current_was_last = other_it->ex_current_was_last = false;
|
||||
ex_current_was_cycle_pt = false;
|
||||
other_it->ex_current_was_cycle_pt = false;
|
||||
|
||||
temp_it.mark_cycle_pt ();
|
||||
do { //walk sublist
|
||||
@ -477,14 +477,14 @@ CLIST_LINK *CLIST_ITERATOR::extract_sublist( //from
|
||||
|
||||
if (temp_it.at_last ()) {
|
||||
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)
|
||||
ex_current_was_cycle_pt = TRUE;
|
||||
ex_current_was_cycle_pt = true;
|
||||
|
||||
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 ();
|
||||
}
|
||||
|
@ -150,13 +150,13 @@ class DLLSYM CLIST_ITERATOR
|
||||
CLIST_LINK *prev; //prev element
|
||||
CLIST_LINK *current; //current element
|
||||
CLIST_LINK *next; //next element
|
||||
BOOL8 ex_current_was_last; //current extracted
|
||||
bool ex_current_was_last; //current extracted
|
||||
//was end of list
|
||||
BOOL8 ex_current_was_cycle_pt; //current extracted
|
||||
bool ex_current_was_cycle_pt; //current extracted
|
||||
//was cycle point
|
||||
CLIST_LINK *cycle_pt; //point we are cycling
|
||||
//the list to.
|
||||
BOOL8 started_cycling; //Have we moved off
|
||||
bool started_cycling; //Have we moved off
|
||||
//the start?
|
||||
|
||||
CLIST_LINK *extract_sublist( //from this current...
|
||||
@ -214,7 +214,7 @@ class DLLSYM CLIST_ITERATOR
|
||||
|
||||
void mark_cycle_pt(); //remember current
|
||||
|
||||
BOOL8 empty() { //is list empty?
|
||||
bool empty() { //is list empty?
|
||||
#ifndef NDEBUG
|
||||
if (!list)
|
||||
NO_LIST.error ("CLIST_ITERATOR::empty", ABORT, nullptr);
|
||||
@ -222,15 +222,15 @@ class DLLSYM CLIST_ITERATOR
|
||||
return list->empty ();
|
||||
}
|
||||
|
||||
BOOL8 current_extracted() { //current extracted?
|
||||
bool current_extracted() { //current extracted?
|
||||
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 *new_data); // don't move
|
||||
@ -266,9 +266,9 @@ inline void CLIST_ITERATOR::set_to_list( //change list
|
||||
current = list->First ();
|
||||
next = current != nullptr ? current->next : nullptr;
|
||||
cycle_pt = nullptr; //await explicit set
|
||||
started_cycling = FALSE;
|
||||
ex_current_was_last = FALSE;
|
||||
ex_current_was_cycle_pt = FALSE;
|
||||
started_cycling = false;
|
||||
ex_current_was_last = 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;
|
||||
list->last = new_element;
|
||||
prev = next = new_element;
|
||||
ex_current_was_last = FALSE;
|
||||
ex_current_was_last = false;
|
||||
current = nullptr;
|
||||
}
|
||||
else {
|
||||
@ -371,7 +371,7 @@ inline void CLIST_ITERATOR::add_after_stay_put( // element to add
|
||||
prev->next = new_element;
|
||||
if (ex_current_was_last) {
|
||||
list->last = new_element;
|
||||
ex_current_was_last = FALSE;
|
||||
ex_current_was_last = false;
|
||||
}
|
||||
}
|
||||
next = new_element;
|
||||
@ -448,7 +448,7 @@ inline void CLIST_ITERATOR::add_before_stay_put( // element to add
|
||||
new_element->next = new_element;
|
||||
list->last = new_element;
|
||||
prev = next = new_element;
|
||||
ex_current_was_last = TRUE;
|
||||
ex_current_was_last = true;
|
||||
current = nullptr;
|
||||
}
|
||||
else {
|
||||
@ -489,7 +489,7 @@ inline void CLIST_ITERATOR::add_list_after(CLIST *list_to_add) {
|
||||
list->last = list_to_add->last;
|
||||
prev = list->last;
|
||||
next = list->First ();
|
||||
ex_current_was_last = TRUE;
|
||||
ex_current_was_last = true;
|
||||
current = nullptr;
|
||||
}
|
||||
else {
|
||||
@ -504,7 +504,7 @@ inline void CLIST_ITERATOR::add_list_after(CLIST *list_to_add) {
|
||||
prev->next = list_to_add->First ();
|
||||
if (ex_current_was_last) {
|
||||
list->last = list_to_add->last;
|
||||
ex_current_was_last = FALSE;
|
||||
ex_current_was_last = false;
|
||||
}
|
||||
list_to_add->last->next = next;
|
||||
next = prev->next;
|
||||
@ -537,7 +537,7 @@ inline void CLIST_ITERATOR::add_list_before(CLIST *list_to_add) {
|
||||
prev = list->last;
|
||||
current = list->First ();
|
||||
next = current->next;
|
||||
ex_current_was_last = FALSE;
|
||||
ex_current_was_last = false;
|
||||
}
|
||||
else {
|
||||
prev->next = list_to_add->First ();
|
||||
@ -587,13 +587,13 @@ inline void *CLIST_ITERATOR::extract() {
|
||||
|
||||
if (current == list->last) {
|
||||
list->last = prev;
|
||||
ex_current_was_last = TRUE;
|
||||
ex_current_was_last = true;
|
||||
} 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.
|
||||
ex_current_was_cycle_pt = (current == cycle_pt) ? TRUE : FALSE;
|
||||
ex_current_was_cycle_pt = (current == cycle_pt);
|
||||
extracted_data = current->data;
|
||||
delete(current); //destroy CONS cell
|
||||
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
|
||||
if (!list)
|
||||
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
|
||||
if (!list)
|
||||
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
|
||||
if (!list)
|
||||
NO_LIST.error ("CLIST_ITERATOR::cycled_list", ABORT, nullptr);
|
||||
|
@ -439,9 +439,9 @@ ELIST2_LINK *ELIST2_ITERATOR::extract_sublist( //fr
|
||||
nullptr);
|
||||
#endif
|
||||
|
||||
ex_current_was_last = other_it->ex_current_was_last = FALSE;
|
||||
ex_current_was_cycle_pt = FALSE;
|
||||
other_it->ex_current_was_cycle_pt = FALSE;
|
||||
ex_current_was_last = other_it->ex_current_was_last = false;
|
||||
ex_current_was_cycle_pt = false;
|
||||
other_it->ex_current_was_cycle_pt = false;
|
||||
|
||||
temp_it.mark_cycle_pt ();
|
||||
do { //walk sublist
|
||||
@ -450,14 +450,14 @@ ELIST2_LINK *ELIST2_ITERATOR::extract_sublist( //fr
|
||||
|
||||
if (temp_it.at_last ()) {
|
||||
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)
|
||||
ex_current_was_cycle_pt = TRUE;
|
||||
ex_current_was_cycle_pt = true;
|
||||
|
||||
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 ();
|
||||
}
|
||||
|
@ -156,13 +156,13 @@ class DLLSYM ELIST2_ITERATOR
|
||||
ELIST2_LINK *prev; //prev element
|
||||
ELIST2_LINK *current; //current element
|
||||
ELIST2_LINK *next; //next element
|
||||
BOOL8 ex_current_was_last; //current extracted
|
||||
bool ex_current_was_last; //current extracted
|
||||
//was end of list
|
||||
BOOL8 ex_current_was_cycle_pt; //current extracted
|
||||
bool ex_current_was_cycle_pt; //current extracted
|
||||
//was cycle point
|
||||
ELIST2_LINK *cycle_pt; //point we are cycling
|
||||
//the list to.
|
||||
BOOL8 started_cycling; //Have we moved off
|
||||
bool started_cycling; //Have we moved off
|
||||
//the start?
|
||||
|
||||
ELIST2_LINK *extract_sublist( //from this current...
|
||||
@ -219,7 +219,7 @@ class DLLSYM ELIST2_ITERATOR
|
||||
|
||||
void mark_cycle_pt(); //remember current
|
||||
|
||||
BOOL8 empty() { //is list empty?
|
||||
bool empty() { //is list empty?
|
||||
#ifndef NDEBUG
|
||||
if (!list)
|
||||
NO_LIST.error ("ELIST2_ITERATOR::empty", ABORT, nullptr);
|
||||
@ -227,15 +227,15 @@ class DLLSYM ELIST2_ITERATOR
|
||||
return list->empty ();
|
||||
}
|
||||
|
||||
BOOL8 current_extracted() { //current extracted?
|
||||
bool current_extracted() { //current extracted?
|
||||
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 &
|
||||
ELIST2_LINK *new_link); // don't move
|
||||
@ -274,9 +274,9 @@ inline void ELIST2_ITERATOR::set_to_list( //change list
|
||||
current = list->First ();
|
||||
next = current ? current->next : nullptr;
|
||||
cycle_pt = nullptr; //await explicit set
|
||||
started_cycling = FALSE;
|
||||
ex_current_was_last = FALSE;
|
||||
ex_current_was_cycle_pt = FALSE;
|
||||
started_cycling = false;
|
||||
ex_current_was_last = 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;
|
||||
list->last = new_element;
|
||||
prev = next = new_element;
|
||||
ex_current_was_last = FALSE;
|
||||
ex_current_was_last = false;
|
||||
current = nullptr;
|
||||
}
|
||||
else {
|
||||
@ -381,7 +381,7 @@ inline void ELIST2_ITERATOR::add_after_stay_put( // element to add
|
||||
prev->next = new_element;
|
||||
if (ex_current_was_last) {
|
||||
list->last = new_element;
|
||||
ex_current_was_last = FALSE;
|
||||
ex_current_was_last = false;
|
||||
}
|
||||
}
|
||||
next = new_element;
|
||||
@ -458,7 +458,7 @@ inline void ELIST2_ITERATOR::add_before_stay_put( // element to add
|
||||
new_element->prev = new_element;
|
||||
list->last = new_element;
|
||||
prev = next = new_element;
|
||||
ex_current_was_last = TRUE;
|
||||
ex_current_was_last = true;
|
||||
current = nullptr;
|
||||
}
|
||||
else {
|
||||
@ -503,7 +503,7 @@ inline void ELIST2_ITERATOR::add_list_after(ELIST2 *list_to_add) {
|
||||
list->last = list_to_add->last;
|
||||
prev = list->last;
|
||||
next = list->First ();
|
||||
ex_current_was_last = TRUE;
|
||||
ex_current_was_last = true;
|
||||
current = nullptr;
|
||||
}
|
||||
else {
|
||||
@ -521,7 +521,7 @@ inline void ELIST2_ITERATOR::add_list_after(ELIST2 *list_to_add) {
|
||||
prev->next->prev = prev;
|
||||
if (ex_current_was_last) {
|
||||
list->last = list_to_add->last;
|
||||
ex_current_was_last = FALSE;
|
||||
ex_current_was_last = false;
|
||||
}
|
||||
list_to_add->last->next = next;
|
||||
next->prev = list_to_add->last;
|
||||
@ -555,7 +555,7 @@ inline void ELIST2_ITERATOR::add_list_before(ELIST2 *list_to_add) {
|
||||
prev = list->last;
|
||||
current = list->First ();
|
||||
next = current->next;
|
||||
ex_current_was_last = FALSE;
|
||||
ex_current_was_last = false;
|
||||
}
|
||||
else {
|
||||
prev->next = list_to_add->First ();
|
||||
@ -610,13 +610,13 @@ inline ELIST2_LINK *ELIST2_ITERATOR::extract() {
|
||||
|
||||
if (current == list->last) {
|
||||
list->last = prev;
|
||||
ex_current_was_last = TRUE;
|
||||
ex_current_was_last = true;
|
||||
} 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.
|
||||
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->next = 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
|
||||
if (!list)
|
||||
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
|
||||
if (!list)
|
||||
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
|
||||
if (!list)
|
||||
NO_LIST.error ("ELIST2_ITERATOR::cycled_list", ABORT, nullptr);
|
||||
|
@ -54,7 +54,7 @@ GAPMAP::GAPMAP( //Constructor
|
||||
min_left = INT16_MAX;
|
||||
max_right = -INT16_MAX;
|
||||
total_rows = 0;
|
||||
any_tabs = FALSE;
|
||||
any_tabs = false;
|
||||
|
||||
// row iterator
|
||||
TO_ROW_IT row_it(block->get_rows());
|
||||
@ -143,7 +143,7 @@ GAPMAP::GAPMAP( //Constructor
|
||||
map[i] = 0; //prevent isolated quantum
|
||||
}
|
||||
else
|
||||
any_tabs = TRUE;
|
||||
any_tabs = true;
|
||||
}
|
||||
}
|
||||
if (gapmap_debug && any_tabs)
|
||||
|
@ -34,7 +34,7 @@ class GAPMAP
|
||||
int16_t bucket_size; // half an x ht
|
||||
int16_t *map; //empty counts
|
||||
int16_t map_max; //map[0..max_map] defind
|
||||
BOOL8 any_tabs;
|
||||
bool any_tabs;
|
||||
};
|
||||
|
||||
/*-----------------------------*/
|
||||
|
@ -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();
|
||||
block_it.forward())
|
||||
make_initial_textrows(page_tr, block_it.data(), FCOORD(1.0f, 0.0f),
|
||||
!(BOOL8) textord_test_landscape);
|
||||
!textord_test_landscape);
|
||||
// compute globally
|
||||
compute_page_skew(port_blocks, port_m, port_err);
|
||||
block_it.set_to_list(port_blocks);
|
||||
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),
|
||||
block_it.data()->block->pdblk.bounding_box().left(),
|
||||
!(BOOL8)textord_test_landscape);
|
||||
!textord_test_landscape);
|
||||
}
|
||||
return port_m; // global skew
|
||||
}
|
||||
@ -1144,7 +1144,7 @@ void adjust_row_limits( //tidy limits
|
||||
tesseract::CCStruct::kAscenderFraction);
|
||||
ymin = -size * tesseract::CCStruct::kDescenderFraction;
|
||||
row->set_limits (row->intercept () + ymin, row->intercept () + ymax);
|
||||
row->merged = FALSE;
|
||||
row->merged = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -280,7 +280,7 @@ int Textord::correlate_with_stats(TO_ROW **rows, // rows of block.
|
||||
mindescheight = -lineheight * MIN_DESC_FRACTION;
|
||||
for (rowindex = 0; rowindex < rowcount; rowindex++) {
|
||||
row = rows[rowindex]; /*do each row */
|
||||
row->all_caps = FALSE;
|
||||
row->all_caps = false;
|
||||
if (row->ascrise / row->xheight < MIN_ASC_FRACTION) {
|
||||
/*no ascenders */
|
||||
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;
|
||||
/*set to average */
|
||||
row->xheight = lineheight;
|
||||
row->all_caps = TRUE;
|
||||
row->all_caps = true;
|
||||
}
|
||||
else {
|
||||
row->ascrise = (fullheight - lineheight) * row->xheight
|
||||
/ fullheight;
|
||||
/*scale it */
|
||||
row->xheight -= row->ascrise;
|
||||
row->all_caps = TRUE;
|
||||
row->all_caps = true;
|
||||
}
|
||||
if (row->ascrise < minascheight)
|
||||
row->ascrise =
|
||||
|
@ -63,7 +63,7 @@ void FPCUTPT::setup( //constructor
|
||||
sq_sum = offset * offset;
|
||||
cost = sq_sum;
|
||||
faked = FALSE;
|
||||
terminal = FALSE;
|
||||
terminal = false;
|
||||
fake_count = 0;
|
||||
xpos = x;
|
||||
region_index = 0;
|
||||
@ -96,18 +96,18 @@ void FPCUTPT::setup( //constructor
|
||||
**********************************************************************/
|
||||
|
||||
void FPCUTPT::assign( //constructor
|
||||
FPCUTPT *cutpts, //predecessors
|
||||
int16_t array_origin, //start coord
|
||||
int16_t x, //position
|
||||
BOOL8 faking, //faking this one
|
||||
BOOL8 mid_cut, //cheap cut.
|
||||
int16_t offset, //dist to gap
|
||||
STATS *projection, //vertical occupation
|
||||
float projection_scale, //scaling
|
||||
int16_t zero_count, //official zero
|
||||
int16_t pitch, //proposed pitch
|
||||
int16_t pitch_error //allowed tolerance
|
||||
) {
|
||||
FPCUTPT* cutpts, //predecessors
|
||||
int16_t array_origin, //start coord
|
||||
int16_t x, //position
|
||||
bool faking, //faking this one
|
||||
bool mid_cut, //cheap cut.
|
||||
int16_t offset, //dist to gap
|
||||
STATS* projection, //vertical occupation
|
||||
float projection_scale, //scaling
|
||||
int16_t zero_count, //official zero
|
||||
int16_t pitch, //proposed pitch
|
||||
int16_t pitch_error //allowed tolerance
|
||||
) {
|
||||
int index; //test index
|
||||
int balance_index; //for balance factor
|
||||
int16_t balance_count; //ding factor
|
||||
@ -140,7 +140,7 @@ void FPCUTPT::assign( //constructor
|
||||
cost = MAX_FLOAT32;
|
||||
pred = nullptr;
|
||||
faked = faking;
|
||||
terminal = FALSE;
|
||||
terminal = false;
|
||||
region_index = 0;
|
||||
fake_count = INT16_MAX;
|
||||
for (index = x - pitch - pitch_error; index <= x - pitch + pitch_error;
|
||||
@ -247,7 +247,7 @@ void FPCUTPT::assign_cheap( //constructor
|
||||
cost = MAX_FLOAT32;
|
||||
pred = nullptr;
|
||||
faked = faking;
|
||||
terminal = FALSE;
|
||||
terminal = false;
|
||||
region_index = 0;
|
||||
fake_count = INT16_MAX;
|
||||
index = x - pitch;
|
||||
@ -309,8 +309,8 @@ double check_pitch_sync2( //find segmentation
|
||||
int16_t start, //start of good range
|
||||
int16_t end //end of good range
|
||||
) {
|
||||
BOOL8 faking; //illegal cut pt
|
||||
BOOL8 mid_cut; //cheap cut pt.
|
||||
bool faking; //illegal cut pt
|
||||
bool mid_cut; //cheap cut pt.
|
||||
int16_t x; //current coord
|
||||
int16_t blob_index; //blob number
|
||||
int16_t left_edge; //of word
|
||||
@ -383,8 +383,8 @@ double check_pitch_sync2( //find segmentation
|
||||
next_box = box_next (&this_it);
|
||||
blob_index++;
|
||||
}
|
||||
faking = FALSE;
|
||||
mid_cut = FALSE;
|
||||
faking = false;
|
||||
mid_cut = false;
|
||||
if (x <= this_box.left ())
|
||||
offset = 0;
|
||||
else if (x <= this_box.left () + pitch_error)
|
||||
@ -400,11 +400,11 @@ double check_pitch_sync2( //find segmentation
|
||||
offset = this_box.right () - x;
|
||||
else if (x - this_box.left () > pitch * pitsync_joined_edge
|
||||
&& this_box.right () - x > pitch * pitsync_joined_edge) {
|
||||
mid_cut = TRUE;
|
||||
mid_cut = true;
|
||||
offset = 0;
|
||||
}
|
||||
else {
|
||||
faking = TRUE;
|
||||
faking = true;
|
||||
offset = projection->pile_count (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) {
|
||||
offset = x < right_edge ? right_edge - x : 0;
|
||||
cutpts[x - array_origin].assign (cutpts, array_origin, x,
|
||||
FALSE, FALSE, offset, projection,
|
||||
false, false, offset, projection,
|
||||
projection_scale, zero_count, pitch,
|
||||
pitch_error);
|
||||
cutpts[x - array_origin].terminal = TRUE;
|
||||
cutpts[x - array_origin].terminal = true;
|
||||
if (cutpts[x - array_origin].index () +
|
||||
cutpts[x - array_origin].fake_count <= best_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 end //end of good range
|
||||
) {
|
||||
BOOL8 faking; //illegal cut pt
|
||||
BOOL8 mid_cut; //cheap cut pt.
|
||||
bool faking; //illegal cut pt
|
||||
bool mid_cut; //cheap cut pt.
|
||||
int16_t left_edge; //of word
|
||||
int16_t right_edge; //of word
|
||||
int16_t x; //current coord
|
||||
@ -570,8 +570,8 @@ double check_pitch_sync3( //find segmentation
|
||||
minindex++;
|
||||
if (minindex > pitch_error * 2)
|
||||
minindex = 0;
|
||||
faking = FALSE;
|
||||
mid_cut = FALSE;
|
||||
faking = false;
|
||||
mid_cut = false;
|
||||
offset = 0;
|
||||
if (projection->pile_count (x) <= zero_count) {
|
||||
prev_zero = x;
|
||||
@ -599,14 +599,14 @@ double check_pitch_sync3( //find segmentation
|
||||
}
|
||||
if (offset > pitch_error) {
|
||||
offset = projection->pile_count (x);
|
||||
faking = TRUE;
|
||||
faking = true;
|
||||
}
|
||||
else {
|
||||
projection_offset =
|
||||
(int16_t) (projection->pile_count (x) / projection_scale);
|
||||
if (projection_offset > offset)
|
||||
offset = projection_offset;
|
||||
mid_cut = TRUE;
|
||||
mid_cut = true;
|
||||
}
|
||||
}
|
||||
if ((start == 0 && end == 0)
|
||||
@ -635,10 +635,10 @@ double check_pitch_sync3( //find segmentation
|
||||
while (x < right_edge + pitch) {
|
||||
offset = x < right_edge ? right_edge - x : 0;
|
||||
cutpts[x - array_origin].assign (cutpts, array_origin, x,
|
||||
FALSE, FALSE, offset, projection,
|
||||
false, false, offset, projection,
|
||||
projection_scale, zero_count, pitch,
|
||||
pitch_error);
|
||||
cutpts[x - array_origin].terminal = TRUE;
|
||||
cutpts[x - array_origin].terminal = true;
|
||||
if (cutpts[x - array_origin].index () +
|
||||
cutpts[x - array_origin].fake_count <= best_count + best_fake) {
|
||||
if (cutpts[x - array_origin].fake_count < best_fake
|
||||
|
@ -40,18 +40,18 @@ class FPCUTPT
|
||||
int16_t x, //position
|
||||
int16_t offset); //dist to gap
|
||||
|
||||
void assign ( //evaluate cut
|
||||
FPCUTPT cutpts[], //predecessors
|
||||
int16_t array_origin, //start coord
|
||||
int16_t x, //position
|
||||
BOOL8 faking, //faking this one
|
||||
BOOL8 mid_cut, //doing free cut
|
||||
int16_t offset, //extra cost dist
|
||||
STATS * projection, //occupation
|
||||
float projection_scale, //scaling
|
||||
int16_t zero_count, //official zero
|
||||
int16_t pitch, //proposed pitch
|
||||
int16_t pitch_error); //allowed tolerance
|
||||
void assign( //evaluate cut
|
||||
FPCUTPT cutpts[], //predecessors
|
||||
int16_t array_origin, //start coord
|
||||
int16_t x, //position
|
||||
bool faking, //faking this one
|
||||
bool mid_cut, //doing free cut
|
||||
int16_t offset, //extra cost dist
|
||||
STATS* projection, //occupation
|
||||
float projection_scale, //scaling
|
||||
int16_t zero_count, //official zero
|
||||
int16_t pitch, //proposed pitch
|
||||
int16_t pitch_error); //allowed tolerance
|
||||
|
||||
void assign_cheap ( //evaluate cut
|
||||
FPCUTPT cutpts[], //predecessors
|
||||
@ -88,8 +88,8 @@ class FPCUTPT
|
||||
return region_index;
|
||||
}
|
||||
|
||||
BOOL8 faked; //faked split point
|
||||
BOOL8 terminal; //successful end
|
||||
bool faked; //faked split point
|
||||
bool terminal; //successful end
|
||||
int16_t fake_count; //total fakes to here
|
||||
|
||||
private:
|
||||
|
Loading…
Reference in New Issue
Block a user