Skip to content

Commit

Permalink
Replace BOOL8, TRUE, FALSE by bool, true, false
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Weil <[email protected]>
  • Loading branch information
stweil committed Mar 31, 2019
1 parent 51a2c2e commit 664811a
Show file tree
Hide file tree
Showing 20 changed files with 106 additions and 118 deletions.
3 changes: 1 addition & 2 deletions src/ccmain/adaptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
* Description: Functions used to adapt to blobs already confidently
* identified
* Author: Chris Newton
* Created: Thu Oct 7 10:17:28 BST 1993
*
* (C) Copyright 1992, Hewlett-Packard Ltd.
** Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -41,7 +40,7 @@ bool Tesseract::word_adaptable( //should we adapt?
word->best_choice->rating(), word->best_choice->certainty());
}

BOOL8 status = FALSE;
bool status = false;
BITS16 flags(mode);

enum MODES
Expand Down
16 changes: 7 additions & 9 deletions src/ccmain/control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
* File: control.cpp (Formerly control.c)
* Description: Module-independent matcher controller.
* Author: Ray Smith
* Created: Thu Apr 23 11:09:58 BST 1992
* ReHacked: Tue Sep 22 08:42:49 BST 1992 Phil Cheatle
*
* (C) Copyright 1992, Hewlett-Packard Ltd.
** Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -227,7 +225,7 @@ bool Tesseract::RecogAllWordsPassN(int pass_n, ETEXT_DESC* monitor,
WordData* word = &(*words)[w];
if (w > 0) word->prev_word = &(*words)[w - 1];
if (monitor != nullptr) {
monitor->ocr_alive = TRUE;
monitor->ocr_alive = true;
if (pass_n == 1) {
monitor->progress = 70 * w / words->size();
if (monitor->progress_callback2 != nullptr) {
Expand Down Expand Up @@ -312,8 +310,8 @@ bool Tesseract::recog_all_words(PAGE_RES* page_res,
PAGE_RES_IT page_res_it(page_res);

if (tessedit_minimal_rej_pass1) {
tessedit_test_adaption.set_value (TRUE);
tessedit_minimal_rejection.set_value (TRUE);
tessedit_test_adaption.set_value (true);
tessedit_minimal_rejection.set_value (true);
}

if (dopasses==0 || dopasses==1) {
Expand Down Expand Up @@ -627,7 +625,7 @@ void Tesseract::rejection_passes(PAGE_RES* page_res,
WERD_RES* word = page_res_it.word();
word_index++;
if (monitor != nullptr) {
monitor->ocr_alive = TRUE;
monitor->ocr_alive = true;
monitor->progress = 95 + 5 * word_index / stats_.word_count;
}
if (word->rebuild_word == nullptr) {
Expand Down Expand Up @@ -1741,7 +1739,7 @@ void Tesseract::fix_rep_char(PAGE_RES_IT* page_res_it) {
word_res->uch_set->debug_str(maxch_id).string(), max_count);
return;
}
word_res->done = TRUE;
word_res->done = true;

// Measure the mean space.
int gap_count = 0;
Expand Down Expand Up @@ -1871,13 +1869,13 @@ bool Tesseract::check_debug_pt(WERD_RES* word, int location) {
if (!test_pt)
return false;

tessedit_rejection_debug.set_value (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 (location < 0)
return true; // For breakpoint use
tessedit_rejection_debug.set_value(TRUE);
tessedit_rejection_debug.set_value(true);
debug_x_ht_level.set_value(2);
tprintf ("\n\nTESTWD::");
switch (location) {
Expand Down
4 changes: 2 additions & 2 deletions src/ccmain/docqual.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ void Tesseract::tilde_crunch(PAGE_RES_IT &page_res_it) {
PAGE_RES_IT copy_it;
bool prev_potential_marked = false;
bool found_terrible_word = false;
BOOL8 ok_dict_word;
bool ok_dict_word;

page_res_it.restart_page();
while (page_res_it.word() != nullptr) {
Expand Down Expand Up @@ -676,7 +676,7 @@ void Tesseract::convert_bad_unlv_chs(WERD_RES *word_res) {
}
}

GARBAGE_LEVEL Tesseract::garbage_word(WERD_RES *word, BOOL8 ok_dict_word) {
GARBAGE_LEVEL Tesseract::garbage_word(WERD_RES *word, bool ok_dict_word) {
enum STATES
{
JUNK,
Expand Down
11 changes: 5 additions & 6 deletions src/ccmain/fixspace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include "blobs.h" // for TWERD, TBLOB, TESSLINE
#include "boxword.h" // for BoxWord
#include "errcode.h" // for ASSERT_HOST
#include "host.h" // for FALSE, TRUE
#include "normalis.h" // for kBlnXHeight, kBlnBaselineOffset
#include "ocrclass.h" // for ETEXT_DESC
#include "pageres.h" // for WERD_RES_IT, WERD_RES, WERD_RES_LIST
Expand Down Expand Up @@ -106,7 +105,7 @@ void Tesseract::fix_fuzzy_spaces(ETEXT_DESC *monitor,
word_res = word_res_it_from.forward();
word_index++;
if (monitor != nullptr) {
monitor->ocr_alive = TRUE;
monitor->ocr_alive = true;
monitor->progress = 90 + 5 * word_index / word_count;
if (monitor->deadline_exceeded() ||
(monitor->cancel != nullptr &&
Expand All @@ -124,7 +123,7 @@ void Tesseract::fix_fuzzy_spaces(ETEXT_DESC *monitor,
word_res_it_to.forward();
word_index++;
if (monitor != nullptr) {
monitor->ocr_alive = TRUE;
monitor->ocr_alive = true;
monitor->progress = 90 + 5 * word_index / word_count;
if (monitor->deadline_exceeded() ||
(monitor->cancel != nullptr &&
Expand Down Expand Up @@ -460,7 +459,7 @@ void transform_to_next_perm(WERD_RES_LIST &words) {
combo->copy_on(word);
word->part_of_combo = true;
}
combo->done = FALSE;
combo->done = false;
combo->ClearResults();
} else {
prev_word_it = word_it; // catch up
Expand Down Expand Up @@ -686,8 +685,8 @@ void Tesseract::break_noisiest_blob_word(WERD_RES_LIST &words) {
delete blob_it.extract(); // throw out noise blob

new_word = new WERD(&new_blob_list, word_res->word);
new_word->set_flag(W_EOL, FALSE);
word_res->word->set_flag(W_BOL, FALSE);
new_word->set_flag(W_EOL, false);
word_res->word->set_flag(W_BOL, false);
word_res->word->set_blanks(1); // After break

new_rej_cblob_it.set_to_list(new_word->rej_cblob_list());
Expand Down
9 changes: 4 additions & 5 deletions src/ccmain/output.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/******************************************************************
* File: output.cpp (Formerly output.c)
* Description: Output pass
* Author: Phil Cheatle
* Created: Thu Aug 4 10:56:08 BST 1994
* Author: Phil Cheatle
*
* (C) Copyright 1994, Hewlett-Packard Ltd.
** Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -130,7 +129,7 @@ void Tesseract::write_results(PAGE_RES_IT& page_res_it,
if ((need_reject && !stats_.last_char_was_tilde) ||
(force_eol && stats_.write_results_empty_block)) {
/* Write a reject char - mark as rejected unless zero_rejection mode */
stats_.last_char_was_tilde = TRUE;
stats_.last_char_was_tilde = true;
stats_.tilde_crunch_written = true;
stats_.last_char_was_newline = false;
stats_.write_results_empty_block = false;
Expand Down Expand Up @@ -213,7 +212,7 @@ void Tesseract::write_results(PAGE_RES_IT& page_res_it,
* determine_newline_type
*
* Find whether we have a wrapping or hard newline.
* Return FALSE if not at end of line.
* Return false if not at end of line.
**********************************************************************/

char determine_newline_type( //test line ends
Expand All @@ -229,7 +228,7 @@ char determine_newline_type( //test line ends
TBOX block_box; //block bounding

if (!word->flag (W_EOL))
return FALSE; //not end of line
return false; //not end of line
if (next_word == nullptr || next_block == nullptr || block != next_block)
return CTRL_NEWLINE;
if (next_word->space () > 0)
Expand Down
3 changes: 1 addition & 2 deletions src/ccmain/pagesegmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* File: pagesegmain.cpp
* Description: Top-level page segmenter for Tesseract.
* Author: Ray Smith
* Created: Thu Sep 25 17:12:01 PDT 2008
*
* (C) Copyright 2008, Google Inc.
** Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -118,7 +117,7 @@ int Tesseract::SegmentPage(const STRING* input_file, BLOCK_LIST* blocks,
// No UNLV file present. Work according to the PageSegMode.
// First make a single block covering the whole image.
BLOCK_IT block_it(blocks);
auto* block = new BLOCK("", TRUE, 0, 0, 0, 0, width, height);
auto* block = new BLOCK("", true, 0, 0, 0, 0, width, height);
block->set_right_to_left(right_to_left());
block_it.add_to_end(block);
} else {
Expand Down
4 changes: 1 addition & 3 deletions src/ccmain/tesseractclass.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
// threads in parallel, and keeps the different language
// instances separate.
// Author: Ray Smith
// Created: Fri Mar 07 08:17:01 PST 2008
//
// (C) Copyright 2008, Google Inc.
// Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -34,7 +33,6 @@
#include "devanagari_processing.h" // for ShiroRekhaSplitter
#include "docqual.h" // for GARBAGE_LEVEL
#include "genericvector.h" // for GenericVector, PointerVector
#include "host.h" // for BOOL8
#include "pageres.h" // for WERD_RES (ptr only), PAGE_RES (pt...
#include "params.h" // for BOOL_VAR_H, BoolParam, DoubleParam
#include "points.h" // for FCOORD
Expand Down Expand Up @@ -661,7 +659,7 @@ class Tesseract : public Wordrec {
float blob_noise_score(TBLOB *blob);
void break_noisiest_blob_word(WERD_RES_LIST &words);
//// docqual.cpp ////////////////////////////////////////////////////////
GARBAGE_LEVEL garbage_word(WERD_RES *word, BOOL8 ok_dict_word);
GARBAGE_LEVEL garbage_word(WERD_RES* word, bool ok_dict_word);
bool potential_word_crunch(WERD_RES* word,
GARBAGE_LEVEL garbage_level,
bool ok_dict_word);
Expand Down
21 changes: 10 additions & 11 deletions src/textord/pitsync1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* File: pitsync1.cpp (Formerly pitsync.c)
* Description: Code to find the optimum fixed pitch segmentation of some blobs.
* Author: Ray Smith
* Created: Thu Nov 19 11:48:05 GMT 1992
*
* (C) Copyright 1992, Hewlett-Packard Ltd.
** Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -64,8 +63,8 @@ int16_t x //position
mean_sum = 0;
sq_sum = 0;
cost = 0;
faked = FALSE;
terminal = FALSE;
faked = false;
terminal = false;
fake_count = 0;
mid_cuts = 0;
}
Expand All @@ -79,7 +78,7 @@ int16_t x //position

FPSEGPT::FPSEGPT ( //constructor
int16_t x, //position
BOOL8 faking, //faking this one
bool faking, //faking this one
int16_t offset, //dist to gap
int16_t region_index, //segment number
int16_t pitch, //proposed pitch
Expand All @@ -103,7 +102,7 @@ FPSEGPT_LIST * prev_list //previous segment
cost = FLT_MAX;
pred = nullptr;
faked = faking;
terminal = FALSE;
terminal = false;
best_fake = INT16_MAX;
mid_cuts = 0;
for (pred_it.mark_cycle_pt (); !pred_it.cycled_list (); pred_it.forward ()) {
Expand Down Expand Up @@ -182,7 +181,7 @@ double check_pitch_sync( //find segmentation
// tprintf("Computing sync on word of %d blobs with pitch %d\n",
// blob_count, pitch);
// if (blob_count==8 && pitch==27)
// projection->print(stdout,TRUE);
// projection->print(stdout,true);
if (pitch < 3)
pitch = 3; //nothing ludicrous
if ((pitch - 3) / 2 < pitch_error)
Expand Down Expand Up @@ -262,18 +261,18 @@ double check_pitch_sync( //find segmentation
else
offset = 0;
// offset=pitsync_offset_freecut_fraction*projection->pile_count(x);
segpt = new FPSEGPT (x, FALSE, offset, region_index,
segpt = new FPSEGPT (x, false, offset, region_index,
pitch, pitch_error, lattice_it.data ());
}
else {
offset = projection->pile_count (x);
segpt = new FPSEGPT (x, TRUE, offset, region_index,
segpt = new FPSEGPT (x, true, offset, region_index,
pitch, pitch_error, lattice_it.data ());
}
if (segpt->previous () != nullptr) {
segpt_it.add_after_then_move (segpt);
if (x >= right_edge - pitch_error) {
segpt->terminal = TRUE;//no more wanted
segpt->terminal = true;//no more wanted
if (segpt->cost_function () < best_cost) {
best_cost = segpt->cost_function ();
//find least
Expand Down Expand Up @@ -402,14 +401,14 @@ void make_illegal_segment( //find segmentation
offset = x - blob_box.left ();
if (blob_box.right () - x < offset)
offset = blob_box.right () - x;
segpt = new FPSEGPT (x, FALSE, offset,
segpt = new FPSEGPT (x, false, offset,
region_index, pitch, pitch_error, prev_list);
if (segpt->previous () != nullptr) {
ASSERT_HOST (offset >= 0);
fprintf (stderr, "made fake at %d\n", x);
//make one up
segpt_it.add_after_then_move (segpt);
segpt->faked = TRUE;
segpt->faked = true;
segpt->fake_count++;
}
else
Expand Down
23 changes: 11 additions & 12 deletions src/textord/pitsync1.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ class FPSEGPT:public ELIST_LINK
FPSEGPT( //constructor
int16_t x); //position
FPSEGPT( //constructor
int16_t x, //position
BOOL8 faking, //faking this one
int16_t offset, //extra cost dist
int16_t region_index, //segment number
int16_t pitch, //proposed pitch
int16_t pitch_error, //allowed tolerance
int16_t x, //position
bool faking, //faking this one
int16_t offset, //extra cost dist
int16_t region_index, //segment number
int16_t pitch, //proposed pitch
int16_t pitch_error, //allowed tolerance
FPSEGPT_LIST *prev_list); //previous segment
FPSEGPT(FPCUTPT *cutpt); //build from new type

Expand All @@ -64,14 +64,13 @@ class FPSEGPT:public ELIST_LINK
return mid_cuts;
}

//faked split point
BOOL8 faked;
BOOL8 terminal; //successful end
int16_t fake_count; //total fakes to here
bool faked; //faked split point
bool terminal; //successful end
int16_t fake_count; //total fakes to here

private:
int16_t mid_cuts; //no of cheap cuts
int32_t xpos; //location
int16_t mid_cuts; //no of cheap cuts
int32_t xpos; //location
FPSEGPT *pred; //optimal previous
double mean_sum; //mean so far
double sq_sum; //summed distsances
Expand Down
2 changes: 1 addition & 1 deletion src/textord/textord.h
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ class Textord {
"Height fraction to discard outlines as speckle noise");
INT_VAR_H(textord_noise_sncount, 1, "super norm blobs to save row");
double_VAR_H(textord_noise_rowratio, 6.0, "Dot to norm ratio for deletion");
BOOL_VAR_H(textord_noise_debug, FALSE, "Debug row garbage detector");
BOOL_VAR_H(textord_noise_debug, false, "Debug row garbage detector");
double_VAR_H(textord_blshift_maxshift, 0.00, "Max baseline shift");
double_VAR_H(textord_blshift_xfraction, 9.99, "Min size of baseline shift");
};
Expand Down
Loading

0 comments on commit 664811a

Please sign in to comment.