Skip to content

Commit

Permalink
Use standard bool instead of BOOL8.
Browse files Browse the repository at this point in the history
  • Loading branch information
zamazan4ik committed May 20, 2018
1 parent 6e568b0 commit a040bc2
Show file tree
Hide file tree
Showing 50 changed files with 981 additions and 1,004 deletions.
2 changes: 1 addition & 1 deletion src/ccmain/adaptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ BOOL8 Tesseract::word_adaptable( //should we adapt?
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");
return FALSE;
}
Expand Down
22 changes: 11 additions & 11 deletions src/ccmain/control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,7 @@ void Tesseract::rejection_passes(PAGE_RES* page_res,
(stats_.doc_good_char_quality /
static_cast<float>(stats_.good_char_count)) : 0.0);
}
BOOL8 good_quality_doc =
bool good_quality_doc =
((page_res->rej_count / static_cast<float>(page_res->char_count)) <=
quality_rej_pc) &&
(stats_.doc_blob_quality / static_cast<float>(page_res->char_count) >=
Expand Down Expand Up @@ -1792,20 +1792,20 @@ ACCEPTABLE_WERD_TYPE Tesseract::acceptable_word_string(
return word_type;
}

BOOL8 Tesseract::check_debug_pt(WERD_RES *word, int location) {
BOOL8 show_map_detail = FALSE;
bool Tesseract::check_debug_pt(WERD_RES* word, int location) {
bool show_map_detail = false;
int16_t i;

if (!test_pt)
return FALSE;
return false;

tessedit_rejection_debug.set_value (FALSE);
debug_x_ht_level.set_value(0);

if (word->word->bounding_box ().contains (FCOORD (test_pt_x, test_pt_y))) {
if (word->word->bounding_box().contains(FCOORD (test_pt_x, test_pt_y))) {
if (location < 0)
return TRUE; // For breakpoint use
tessedit_rejection_debug.set_value (TRUE);
return true; // For breakpoint use
tessedit_rejection_debug.set_value(TRUE);
debug_x_ht_level.set_value(2);
tprintf ("\n\nTESTWD::");
switch (location) {
Expand All @@ -1827,7 +1827,7 @@ BOOL8 Tesseract::check_debug_pt(WERD_RES *word, int location) {
break;
case 50:
tprintf ("classify_word_pass2 - END");
show_map_detail = TRUE;
show_map_detail = true;
break;
case 60:
tprintf ("fixspace");
Expand All @@ -1849,7 +1849,7 @@ BOOL8 Tesseract::check_debug_pt(WERD_RES *word, int location) {
break;
case 120:
tprintf ("Write results pass");
show_map_detail = TRUE;
show_map_detail = true;
break;
}
if (word->best_choice != nullptr) {
Expand All @@ -1868,9 +1868,9 @@ BOOL8 Tesseract::check_debug_pt(WERD_RES *word, int location) {
}
tprintf ("Tess Accepted: %s\n", word->tess_accepted ? "TRUE" : "FALSE");
tprintf ("Done flag: %s\n\n", word->done ? "TRUE" : "FALSE");
return TRUE;
return true;
} else {
return FALSE;
return false;
}
}

Expand Down
60 changes: 30 additions & 30 deletions src/ccmain/fixspace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ void Tesseract::fix_fuzzy_spaces(ETEXT_DESC *monitor,
WERD_RES *word_res;
WERD_RES_LIST fuzzy_space_words;
int16_t new_length;
BOOL8 prevent_null_wd_fixsp; // DON'T process blobless wds
bool prevent_null_wd_fixsp; // DON'T process blobless wds
int32_t word_index; // current word

block_res_it.set_to_list(&page_res->block_res_list);
Expand Down Expand Up @@ -108,13 +108,13 @@ void Tesseract::fix_fuzzy_spaces(ETEXT_DESC *monitor,
if (check_debug_pt(word_res, 60))
debug_fix_space_level.set_value(10);
if (word_res->word->cblob_list()->empty())
prevent_null_wd_fixsp = TRUE;
prevent_null_wd_fixsp = true;
word_res = word_res_it_to.forward();
}
if (check_debug_pt(word_res, 60))
debug_fix_space_level.set_value(10);
if (word_res->word->cblob_list()->empty())
prevent_null_wd_fixsp = TRUE;
prevent_null_wd_fixsp = true;
if (prevent_null_wd_fixsp) {
word_res_it_from = word_res_it_to;
} else {
Expand Down Expand Up @@ -148,7 +148,7 @@ void Tesseract::fix_fuzzy_space_list(WERD_RES_LIST &best_perm,
int16_t best_score;
WERD_RES_LIST current_perm;
int16_t current_score;
BOOL8 improved = FALSE;
bool improved = false;

best_score = eval_word_spacing(best_perm); // default score
dump_words(best_perm, best_score, 1, improved);
Expand All @@ -164,7 +164,7 @@ void Tesseract::fix_fuzzy_space_list(WERD_RES_LIST &best_perm,
best_perm.clear();
best_perm.deep_copy(&current_perm, &WERD_RES::deep_copy);
best_score = current_score;
improved = TRUE;
improved = true;
}
if (current_score < PERFECT_WERDS)
transform_to_next_perm(current_perm);
Expand Down Expand Up @@ -246,15 +246,15 @@ int16_t Tesseract::eval_word_spacing(WERD_RES_LIST &word_res_list) {
int16_t offset;
WERD_RES *word; // current word
int16_t prev_word_score = 0;
BOOL8 prev_word_done = FALSE;
BOOL8 prev_char_1 = FALSE; // prev ch a "1/I/l"?
BOOL8 prev_char_digit = FALSE; // prev ch 2..9 or 0
BOOL8 current_char_1 = FALSE;
BOOL8 current_word_ok_so_far;
bool prev_word_done = false;
bool prev_char_1 = false; // prev ch a "1/I/l"?
bool prev_char_digit = false; // prev ch 2..9 or 0
bool current_char_1 = false;
bool current_word_ok_so_far;
STRING punct_chars = "!\"`',.:;";
BOOL8 prev_char_punct = FALSE;
BOOL8 current_char_punct = FALSE;
BOOL8 word_done = FALSE;
bool prev_char_punct = false;
bool current_char_punct = false;
bool word_done = false;

do {
word = word_res_it.data();
Expand All @@ -265,17 +265,17 @@ int16_t Tesseract::eval_word_spacing(WERD_RES_LIST &word_res_list) {
if (prev_word_done)
done_word_count++;
prev_word_score = 0;
prev_char_1 = FALSE;
prev_char_digit = FALSE;
prev_word_done = FALSE;
prev_char_1 = false;
prev_char_digit = false;
prev_word_done = false;
} else {
/*
Can we add the prev word score and potentially count this word?
Yes IF it didn't end in a 1 when the first char of this word is a digit
AND it didn't end in a digit when the first char of this word is a 1
*/
word_len = word->reject_map.length();
current_word_ok_so_far = FALSE;
current_word_ok_so_far = false;
if (!((prev_char_1 && digit_or_numeric_punct(word, 0)) ||
(prev_char_digit && (
(word_done &&
Expand All @@ -290,16 +290,16 @@ int16_t Tesseract::eval_word_spacing(WERD_RES_LIST &word_res_list) {
}

if (current_word_ok_so_far) {
prev_word_done = TRUE;
prev_word_done = true;
prev_word_score = word_len;
} else {
prev_word_done = FALSE;
prev_word_done = false;
prev_word_score = 0;
}

/* Add 1 to total score for every joined 1 regardless of context and
rejtn */
for (i = 0, prev_char_1 = FALSE; i < word_len; i++) {
for (i = 0, prev_char_1 = false; i < word_len; i++) {
current_char_1 = word->best_choice->unichar_string()[i] == '1';
if (prev_char_1 || (current_char_1 && (i > 0)))
total_score++;
Expand All @@ -309,7 +309,7 @@ int16_t Tesseract::eval_word_spacing(WERD_RES_LIST &word_res_list) {
/* Add 1 to total score for every joined punctuation regardless of context
and rejtn */
if (tessedit_prefer_joined_punct) {
for (i = 0, offset = 0, prev_char_punct = FALSE; i < word_len;
for (i = 0, offset = 0, prev_char_punct = false; i < word_len;
offset += word->best_choice->unichar_lengths()[i++]) {
current_char_punct =
punct_chars.contains(word->best_choice->unichar_string()[offset]);
Expand Down Expand Up @@ -340,7 +340,7 @@ int16_t Tesseract::eval_word_spacing(WERD_RES_LIST &word_res_list) {
return total_score;
}

BOOL8 Tesseract::digit_or_numeric_punct(WERD_RES *word, int char_position) {
bool Tesseract::digit_or_numeric_punct(WERD_RES *word, int char_position) {
int i;
int offset;

Expand Down Expand Up @@ -447,7 +447,7 @@ void transform_to_next_perm(WERD_RES_LIST &words) {

namespace tesseract {
void Tesseract::dump_words(WERD_RES_LIST &perm, int16_t score,
int16_t mode, BOOL8 improved) {
int16_t mode, bool improved) {
WERD_RES_IT word_res_it(&perm);

if (debug_fix_space_level > 0) {
Expand Down Expand Up @@ -500,9 +500,9 @@ void Tesseract::dump_words(WERD_RES_LIST &perm, int16_t score,
}
}

BOOL8 Tesseract::fixspace_thinks_word_done(WERD_RES *word) {
bool Tesseract::fixspace_thinks_word_done(WERD_RES *word) {
if (word->done)
return TRUE;
return true;

/*
Use all the standard pass 2 conditions for mode 5 in set_done() in
Expand All @@ -518,9 +518,9 @@ BOOL8 Tesseract::fixspace_thinks_word_done(WERD_RES *word) {
(word->best_choice->permuter() == FREQ_DAWG_PERM) ||
(word->best_choice->permuter() == USER_DAWG_PERM) ||
(word->best_choice->permuter() == NUMBER_PERM))) {
return TRUE;
return true;
} else {
return FALSE;
return false;
}
}

Expand Down Expand Up @@ -574,7 +574,7 @@ void Tesseract::fix_noisy_space_list(WERD_RES_LIST &best_perm, ROW *row,
WERD_RES_IT current_perm_it(&current_perm);
WERD_RES *old_word_res;
int16_t current_score;
BOOL8 improved = FALSE;
bool improved = false;

best_score = fp_eval_word_spacing(best_perm); // default score

Expand All @@ -597,7 +597,7 @@ void Tesseract::fix_noisy_space_list(WERD_RES_LIST &best_perm, ROW *row,
best_perm.clear();
best_perm.deep_copy(&current_perm, &WERD_RES::deep_copy);
best_score = current_score;
improved = TRUE;
improved = true;
}
if (current_score < PERFECT_WERDS) {
break_noisiest_blob_word(current_perm);
Expand Down Expand Up @@ -794,7 +794,7 @@ float Tesseract::blob_noise_score(TBLOB *blob) {

void fixspace_dbg(WERD_RES *word) {
TBOX box = word->word->bounding_box();
BOOL8 show_map_detail = FALSE;
bool show_map_detail = false;
int16_t i;

box.print();
Expand Down
10 changes: 5 additions & 5 deletions src/ccmain/output.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ void Tesseract::output_pass( //Tess output pass //send to api
PAGE_RES_IT &page_res_it,
const TBOX *target_word_box) {
BLOCK_RES *block_of_last_word;
BOOL8 force_eol; //During output
bool force_eol; //During output
BLOCK *nextblock; //block of next word
WERD *nextword; //next word

Expand Down Expand Up @@ -123,13 +123,13 @@ void Tesseract::output_pass( //Tess output pass //send to api
* inset list - a list of bounding boxes of reject insets - indexed by the
* reject strings in the epchoice text.
*************************************************************************/
void Tesseract::write_results(PAGE_RES_IT &page_res_it,
void Tesseract::write_results(PAGE_RES_IT& page_res_it,
char newline_type, // type of newline
BOOL8 force_eol) { // override tilde crunch?
bool force_eol) { // override tilde crunch?
WERD_RES *word = page_res_it.word();
const UNICHARSET &uchset = *word->uch_set;
int i;
BOOL8 need_reject = FALSE;
bool need_reject = false;
UNICHAR_ID space = uchset.unichar_to_id(" ");

if ((word->unlv_crunch_mode != CR_NONE ||
Expand All @@ -147,7 +147,7 @@ void Tesseract::write_results(PAGE_RES_IT &page_res_it,
!word->word->flag (W_FUZZY_SP)) {
stats_.last_char_was_tilde = false;
}
need_reject = TRUE;
need_reject = true;
}
if ((need_reject && !stats_.last_char_was_tilde) ||
(force_eol && stats_.write_results_empty_block)) {
Expand Down
22 changes: 11 additions & 11 deletions src/ccmain/pgedit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -390,12 +390,12 @@ void pgeditor_show_point( // display coords
*/

namespace tesseract {
BOOL8 Tesseract::process_cmd_win_event( // UI command semantics
int32_t cmd_event, // which menu item?
char *new_value // any prompt data
) {
bool Tesseract::process_cmd_win_event( // UI command semantics
int32_t cmd_event, // which menu item?
char* new_value // any prompt data
) {
char msg[160];
BOOL8 exit = FALSE;
bool exit = false;

color_mode = CM_RAINBOW;

Expand Down Expand Up @@ -535,7 +535,7 @@ BOOL8 Tesseract::process_cmd_win_event( // UI command semantics
do_re_display(&tesseract::Tesseract::word_display);
break;
case QUIT_CMD_EVENT:
exit = TRUE;
exit = true;
ScrollView::Exit();
break;

Expand Down Expand Up @@ -759,7 +759,7 @@ BOOL8 Tesseract::word_display(PAGE_RES_IT* pr_it) {
WERD* word = word_res->word;
TBOX word_bb; // word bounding box
int word_height; // ht of word BB
BOOL8 displayed_something = FALSE;
bool displayed_something = false;
float shift; // from bot left
C_BLOB_IT c_it; // cblob iterator

Expand Down Expand Up @@ -833,13 +833,13 @@ BOOL8 Tesseract::word_display(PAGE_RES_IT* pr_it) {
c_it.set_to_list(word->cblob_list());
for (c_it.mark_cycle_pt(); !c_it.cycled_list(); c_it.forward())
c_it.data()->bounding_box().plot(image_win);
displayed_something = TRUE;
displayed_something = true;
}

// display edge steps
if (word->display_flag(DF_EDGE_STEP)) { // edgesteps available
word->plot(image_win); // rainbow colors
displayed_something = TRUE;
displayed_something = true;
}

// display poly approx
Expand All @@ -848,7 +848,7 @@ BOOL8 Tesseract::word_display(PAGE_RES_IT* pr_it) {
TWERD* tword = TWERD::PolygonalCopy(poly_allow_detailed_fx, word);
tword->plot(image_win);
delete tword;
displayed_something = TRUE;
displayed_something = true;
}

// Display correct text and blamer information.
Expand Down Expand Up @@ -898,7 +898,7 @@ BOOL8 Tesseract::word_display(PAGE_RES_IT* pr_it) {
blame.string());
}

displayed_something = TRUE;
displayed_something = true;
}

if (!displayed_something) // display BBox anyway
Expand Down
Loading

0 comments on commit a040bc2

Please sign in to comment.