From 664811a86931b625185d14028672de3fc4f4a686 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Sat, 30 Mar 2019 13:42:46 +0100 Subject: [PATCH] Replace BOOL8, TRUE, FALSE by bool, true, false Signed-off-by: Stefan Weil --- src/ccmain/adaptions.cpp | 3 +-- src/ccmain/control.cpp | 16 +++++++--------- src/ccmain/docqual.cpp | 4 ++-- src/ccmain/fixspace.cpp | 11 +++++------ src/ccmain/output.cpp | 9 ++++----- src/ccmain/pagesegmain.cpp | 3 +-- src/ccmain/tesseractclass.h | 4 +--- src/textord/pitsync1.cpp | 21 ++++++++++----------- src/textord/pitsync1.h | 23 +++++++++++------------ src/textord/textord.h | 2 +- src/textord/topitch.cpp | 31 +++++++++++++++---------------- src/textord/topitch.h | 14 +++++++------- src/textord/tospace.cpp | 20 ++++++++++---------- src/textord/tovars.cpp | 16 ++++++++-------- src/textord/tovars.h | 16 ++++++++-------- src/textord/underlin.cpp | 2 +- src/textord/underlin.h | 2 +- src/textord/wordseg.cpp | 17 ++++++++--------- src/textord/wordseg.h | 6 +++--- src/training/commandlineflags.cpp | 4 ++-- 20 files changed, 106 insertions(+), 118 deletions(-) diff --git a/src/ccmain/adaptions.cpp b/src/ccmain/adaptions.cpp index 8cf6344d8f..0699f062e7 100644 --- a/src/ccmain/adaptions.cpp +++ b/src/ccmain/adaptions.cpp @@ -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"); @@ -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 diff --git a/src/ccmain/control.cpp b/src/ccmain/control.cpp index 832f7bcba5..67ebbc87a9 100644 --- a/src/ccmain/control.cpp +++ b/src/ccmain/control.cpp @@ -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"); @@ -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) { @@ -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) { @@ -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) { @@ -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; @@ -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) { diff --git a/src/ccmain/docqual.cpp b/src/ccmain/docqual.cpp index a3a8c4bb6c..38743d9fb9 100644 --- a/src/ccmain/docqual.cpp +++ b/src/ccmain/docqual.cpp @@ -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) { @@ -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, diff --git a/src/ccmain/fixspace.cpp b/src/ccmain/fixspace.cpp index 98cfce72f3..9241a5cef9 100644 --- a/src/ccmain/fixspace.cpp +++ b/src/ccmain/fixspace.cpp @@ -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 @@ -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 && @@ -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 && @@ -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 @@ -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()); diff --git a/src/ccmain/output.cpp b/src/ccmain/output.cpp index 38d8afcb9f..69cf01d627 100644 --- a/src/ccmain/output.cpp +++ b/src/ccmain/output.cpp @@ -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"); @@ -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; @@ -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 @@ -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) diff --git a/src/ccmain/pagesegmain.cpp b/src/ccmain/pagesegmain.cpp index 5de855c545..37720bff85 100644 --- a/src/ccmain/pagesegmain.cpp +++ b/src/ccmain/pagesegmain.cpp @@ -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"); @@ -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 { diff --git a/src/ccmain/tesseractclass.h b/src/ccmain/tesseractclass.h index 30117a5652..a05aa8ccd5 100644 --- a/src/ccmain/tesseractclass.h +++ b/src/ccmain/tesseractclass.h @@ -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"); @@ -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 @@ -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); diff --git a/src/textord/pitsync1.cpp b/src/textord/pitsync1.cpp index 870f1d7563..3bcc32aa60 100644 --- a/src/textord/pitsync1.cpp +++ b/src/textord/pitsync1.cpp @@ -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"); @@ -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; } @@ -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 @@ -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 ()) { @@ -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) @@ -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 @@ -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 diff --git a/src/textord/pitsync1.h b/src/textord/pitsync1.h index a2b381db0d..4c5f72f741 100644 --- a/src/textord/pitsync1.h +++ b/src/textord/pitsync1.h @@ -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 @@ -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 diff --git a/src/textord/textord.h b/src/textord/textord.h index d798609db8..0048013415 100644 --- a/src/textord/textord.h +++ b/src/textord/textord.h @@ -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"); }; diff --git a/src/textord/topitch.cpp b/src/textord/topitch.cpp index 6cd0bcf071..1f115214c1 100644 --- a/src/textord/topitch.cpp +++ b/src/textord/topitch.cpp @@ -2,7 +2,6 @@ * File: topitch.cpp (Formerly to_pitch.c) * Description: Code to determine fixed pitchness and the pitch if fixed. * Author: Ray Smith - * Created: Tue Aug 24 16:57:29 BST 1993 * * (C) Copyright 1993, Hewlett-Packard Ltd. ** Licensed under the Apache License, Version 2.0 (the "License"); @@ -37,20 +36,20 @@ #define EXTERN -EXTERN BOOL_VAR (textord_all_prop, FALSE, "All doc is proportial text"); -EXTERN BOOL_VAR (textord_debug_pitch_test, FALSE, +EXTERN BOOL_VAR (textord_all_prop, false, "All doc is proportial text"); +EXTERN BOOL_VAR (textord_debug_pitch_test, false, "Debug on fixed pitch test"); -EXTERN BOOL_VAR (textord_disable_pitch_test, FALSE, +EXTERN BOOL_VAR (textord_disable_pitch_test, false, "Turn off dp fixed pitch algorithm"); -EXTERN BOOL_VAR (textord_fast_pitch_test, FALSE, +EXTERN BOOL_VAR (textord_fast_pitch_test, false, "Do even faster pitch algorithm"); -EXTERN BOOL_VAR (textord_debug_pitch_metric, FALSE, +EXTERN BOOL_VAR (textord_debug_pitch_metric, false, "Write full metric stuff"); -EXTERN BOOL_VAR (textord_show_row_cuts, FALSE, "Draw row-level cuts"); -EXTERN BOOL_VAR (textord_show_page_cuts, FALSE, "Draw page-level cuts"); -EXTERN BOOL_VAR (textord_pitch_cheat, FALSE, +EXTERN BOOL_VAR (textord_show_row_cuts, false, "Draw row-level cuts"); +EXTERN BOOL_VAR (textord_show_page_cuts, false, "Draw page-level cuts"); +EXTERN BOOL_VAR (textord_pitch_cheat, false, "Use correct answer for fixed/prop"); -EXTERN BOOL_VAR (textord_blockndoc_fixed, FALSE, +EXTERN BOOL_VAR (textord_blockndoc_fixed, false, "Attempt whole doc/block fixed pitch"); EXTERN double_VAR (textord_projection_scale, 0.200, "Ding rate for mid-cuts"); EXTERN double_VAR (textord_balance_factor, 1.0, @@ -298,7 +297,7 @@ void fix_row_pitch(TO_ROW *bad_row, // row to fix bad_row->projection_left, bad_row->projection_right, (bad_row->fixed_pitch + bad_row->max_nonspace * 3) / 4, bad_row->fixed_pitch, - sp_sd, mid_cuts, &bad_row->char_cells, FALSE); + sp_sd, mid_cuts, &bad_row->char_cells, false); } } else if (bad_row->pitch_decision == PITCH_CORR_PROP @@ -342,7 +341,7 @@ void compute_block_pitch(TO_BLOCK* block, // input list find_repeated_chars(block, textord_show_initial_words && testing_on); #ifndef GRAPHICS_DISABLED if (textord_show_initial_words && testing_on) - //overlap_picture_ops(TRUE); + //overlap_picture_ops(true); ScrollView::Update(); #endif compute_rows_pitch(block, @@ -505,7 +504,7 @@ bool try_doc_fixed( //determine pitch pitch_sd = tune_row_pitch (row, &projection, projection_left, projection_right, pitch * 0.75, final_pitch, sp_sd, mid_cuts, - &row->char_cells, FALSE); + &row->char_cells, false); if (textord_debug_pitch_metric) tprintf @@ -874,7 +873,7 @@ bool find_row_pitch( //find lines min_space = (initial_pitch + non_space) / 2; if (!count_pitch_stats (row, &gap_stats, &pitch_stats, - initial_pitch, min_space, TRUE, FALSE, dm_gap)) { + initial_pitch, min_space, true, false, dm_gap)) { dm_gap_iqr = 0.0001; dm_pitch_iqr = maxwidth * 2.0f; dm_pitch = initial_pitch; @@ -887,7 +886,7 @@ bool find_row_pitch( //find lines gap_stats.clear (); pitch_stats.clear (); if (!count_pitch_stats (row, &gap_stats, &pitch_stats, - initial_pitch, min_space, TRUE, FALSE, 0)) { + initial_pitch, min_space, true, false, 0)) { gap_iqr = 0.0001; pitch_iqr = maxwidth * 3.0f; } @@ -901,7 +900,7 @@ bool find_row_pitch( //find lines initial_pitch = pitch_stats.ile (0.5); if (min_space > initial_pitch && count_pitch_stats (row, &gap_stats, &pitch_stats, - initial_pitch, initial_pitch, TRUE, FALSE, 0)) { + initial_pitch, initial_pitch, true, false, 0)) { min_space = initial_pitch; gap_iqr = gap_stats.ile (0.75) - gap_stats.ile (0.25); pitch_iqr = pitch_stats.ile (0.75) - pitch_stats.ile (0.25); diff --git a/src/textord/topitch.h b/src/textord/topitch.h index 0c5c397067..2b16744ad8 100644 --- a/src/textord/topitch.h +++ b/src/textord/topitch.h @@ -24,17 +24,17 @@ namespace tesseract { class Tesseract; } -extern BOOL_VAR_H (textord_debug_pitch_test, FALSE, +extern BOOL_VAR_H (textord_debug_pitch_test, false, "Debug on fixed pitch test"); -extern BOOL_VAR_H (textord_debug_pitch_metric, FALSE, +extern BOOL_VAR_H (textord_debug_pitch_metric, false, "Write full metric stuff"); -extern BOOL_VAR_H (textord_show_row_cuts, FALSE, "Draw row-level cuts"); -extern BOOL_VAR_H (textord_show_page_cuts, FALSE, "Draw page-level cuts"); -extern BOOL_VAR_H (textord_pitch_cheat, FALSE, +extern BOOL_VAR_H (textord_show_row_cuts, false, "Draw row-level cuts"); +extern BOOL_VAR_H (textord_show_page_cuts, false, "Draw page-level cuts"); +extern BOOL_VAR_H (textord_pitch_cheat, false, "Use correct answer for fixed/prop"); -extern BOOL_VAR_H (textord_blockndoc_fixed, TRUE, +extern BOOL_VAR_H (textord_blockndoc_fixed, true, "Attempt whole doc/block fixed pitch"); -extern BOOL_VAR_H (textord_fast_pitch_test, FALSE, +extern BOOL_VAR_H (textord_fast_pitch_test, false, "Do even faster pitch algorithm"); extern double_VAR_H (textord_projection_scale, 0.125, "Ding rate for mid-cuts"); diff --git a/src/textord/tospace.cpp b/src/textord/tospace.cpp index 009f20c88d..74ee09b81e 100644 --- a/src/textord/tospace.cpp +++ b/src/textord/tospace.cpp @@ -1094,8 +1094,8 @@ ROW *Textord::make_prop_words( if (tosp_debug_level > 5) tprintf (" Rgap:%d (%d blanks)\n", current_gap, blanks); - fuzzy_sp = FALSE; - fuzzy_non = FALSE; + fuzzy_sp = false; + fuzzy_non = false; if (rep_char_it.empty ()) { next_rep_char_word_right = INT32_MAX; @@ -1202,7 +1202,7 @@ ROW *Textord::make_blob_words( box_it.set_to_list(row->blob_list()); // new words WERD_IT word_it(&words); - bol = TRUE; + bol = true; if (!box_it.empty()) { do { @@ -1228,11 +1228,11 @@ ROW *Textord::make_blob_words( word_count++; word_it.add_after_then_move(word); if (bol) { - word->set_flag(W_BOL, TRUE); - bol = FALSE; + word->set_flag(W_BOL, true); + bol = false; } if (box_it.at_first()) { // at end of line - word->set_flag(W_EOL, TRUE); + word->set_flag(W_EOL, true); } } } @@ -1332,7 +1332,7 @@ bool Textord::make_a_word_break( /* Set defaults for the word break in case we find one. Currently there are no fuzzy spaces. Depending on the reliability of the different heuristics we may need to set PARTICULAR spaces to fuzzy or not. The values will ONLY - be used if the function returns TRUE - ie the word is to be broken. + be used if the function returns true - ie the word is to be broken. */ int num_blanks = current_gap; if (row->space_size > 1.0f) @@ -1683,9 +1683,9 @@ void Textord::mark_gap( if (textord_show_initial_words) { to_win->Pen(col); /* if (rule < 20) - //interior_style(to_win, INT_SOLID, FALSE); + //interior_style(to_win, INT_SOLID, false); else - //interior_style(to_win, INT_HOLLOW, TRUE);*/ + //interior_style(to_win, INT_HOLLOW, true);*/ //x radius to_win->Ellipse (current_gap / 2.0f, blob.height () / 2.0f, //y radius @@ -1735,7 +1735,7 @@ bool Textord::ignore_big_gap(TO_ROW* row, int16_t right) { int16_t gap = right - left + 1; - if (tosp_ignore_big_gaps > 999) return FALSE; // Don't ignore + if (tosp_ignore_big_gaps > 999) return false; // Don't ignore if (tosp_ignore_big_gaps > 0) return (gap > tosp_ignore_big_gaps * row->xheight); if (gap > tosp_ignore_very_big_gaps * row->xheight) diff --git a/src/textord/tovars.cpp b/src/textord/tovars.cpp index 6b1b833248..8652e8b61a 100644 --- a/src/textord/tovars.cpp +++ b/src/textord/tovars.cpp @@ -22,15 +22,15 @@ #define EXTERN -EXTERN BOOL_VAR (textord_show_initial_words, FALSE, "Display separate words"); -EXTERN BOOL_VAR (textord_show_new_words, FALSE, "Display separate words"); -EXTERN BOOL_VAR (textord_show_fixed_words, FALSE, +EXTERN BOOL_VAR (textord_show_initial_words, false, "Display separate words"); +EXTERN BOOL_VAR (textord_show_new_words, false, "Display separate words"); +EXTERN BOOL_VAR (textord_show_fixed_words, false, "Display forced fixed pitch words"); -EXTERN BOOL_VAR (textord_blocksall_fixed, FALSE, "Moan about prop blocks"); -EXTERN BOOL_VAR (textord_blocksall_prop, FALSE, +EXTERN BOOL_VAR (textord_blocksall_fixed, false, "Moan about prop blocks"); +EXTERN BOOL_VAR (textord_blocksall_prop, false, "Moan about fixed pitch blocks"); -EXTERN BOOL_VAR (textord_blocksall_testing, FALSE, "Dump stats when moaning"); -EXTERN BOOL_VAR (textord_test_mode, FALSE, "Do current test"); +EXTERN BOOL_VAR (textord_blocksall_testing, false, "Dump stats when moaning"); +EXTERN BOOL_VAR (textord_test_mode, false, "Do current test"); EXTERN INT_VAR (textord_dotmatrix_gap, 3, "Max pixel gap for broken pixed pitch"); EXTERN INT_VAR (textord_debug_block, 0, "Block to do debug on"); @@ -65,7 +65,7 @@ EXTERN INT_VAR (textord_words_veto_power, 5, "Rows required to outvote a veto"); EXTERN double_VAR (textord_pitch_rowsimilarity, 0.08, "Fraction of xheight for sameness"); -EXTERN BOOL_VAR (textord_pitch_scalebigwords, FALSE, +EXTERN BOOL_VAR (textord_pitch_scalebigwords, false, "Scale scores on big words"); EXTERN double_VAR(words_initial_lower, 0.5, "Max initial cluster size"); EXTERN double_VAR (words_initial_upper, 0.15, "Min initial cluster spacing"); diff --git a/src/textord/tovars.h b/src/textord/tovars.h index 46315bb96b..6ec08d221c 100644 --- a/src/textord/tovars.h +++ b/src/textord/tovars.h @@ -22,17 +22,17 @@ #include "params.h" -extern BOOL_VAR_H (textord_show_initial_words, FALSE, +extern BOOL_VAR_H (textord_show_initial_words, false, "Display separate words"); -extern BOOL_VAR_H (textord_show_new_words, FALSE, "Display separate words"); -extern BOOL_VAR_H (textord_show_fixed_words, FALSE, +extern BOOL_VAR_H (textord_show_new_words, false, "Display separate words"); +extern BOOL_VAR_H (textord_show_fixed_words, false, "Display forced fixed pitch words"); -extern BOOL_VAR_H (textord_blocksall_fixed, FALSE, "Moan about prop blocks"); -extern BOOL_VAR_H (textord_blocksall_prop, FALSE, +extern BOOL_VAR_H (textord_blocksall_fixed, false, "Moan about prop blocks"); +extern BOOL_VAR_H (textord_blocksall_prop, false, "Moan about fixed pitch blocks"); -extern BOOL_VAR_H (textord_blocksall_testing, FALSE, +extern BOOL_VAR_H (textord_blocksall_testing, false, "Dump stats when moaning"); -extern BOOL_VAR_H (textord_test_mode, FALSE, "Do current test"); +extern BOOL_VAR_H (textord_test_mode, false, "Do current test"); extern INT_VAR_H (textord_dotmatrix_gap, 3, "Max pixel gap for broken pixed pitch"); extern INT_VAR_H (textord_debug_block, 0, "Block to do debug on"); @@ -67,7 +67,7 @@ extern INT_VAR_H (textord_words_veto_power, 5, "Rows required to outvote a veto"); extern double_VAR_H (textord_pitch_rowsimilarity, 0.08, "Fraction of xheight for sameness"); -extern BOOL_VAR_H (textord_pitch_scalebigwords, FALSE, +extern BOOL_VAR_H (textord_pitch_scalebigwords, false, "Scale scores on big words"); extern double_VAR_H(words_initial_lower, 0.5, "Max initial cluster size"); extern double_VAR_H (words_initial_upper, 0.15, diff --git a/src/textord/underlin.cpp b/src/textord/underlin.cpp index af26203216..3f82b739b9 100644 --- a/src/textord/underlin.cpp +++ b/src/textord/underlin.cpp @@ -22,7 +22,7 @@ #define EXTERN EXTERN double_VAR (textord_underline_offset, 0.1, "Fraction of x to ignore"); -EXTERN BOOL_VAR (textord_restore_underlines, TRUE, +EXTERN BOOL_VAR (textord_restore_underlines, true, "Chop underlines & put back"); /********************************************************************** diff --git a/src/textord/underlin.h b/src/textord/underlin.h index eb0051acbb..92bd1a0fa7 100644 --- a/src/textord/underlin.h +++ b/src/textord/underlin.h @@ -23,7 +23,7 @@ extern double_VAR_H (textord_underline_offset, 0.1, "Fraction of x to ignore"); -extern BOOL_VAR_H (textord_restore_underlines, FALSE, +extern BOOL_VAR_H (textord_restore_underlines, false, "Chop underlines & put back"); void restore_underlined_blobs( //get chop points TO_BLOCK *block //block to do diff --git a/src/textord/wordseg.cpp b/src/textord/wordseg.cpp index b245baab4b..7ca43acb94 100644 --- a/src/textord/wordseg.cpp +++ b/src/textord/wordseg.cpp @@ -2,7 +2,6 @@ * File: wordseg.cpp (Formerly wspace.c) * Description: Code to segment the blobs into words. * Author: Ray Smith - * Created: Fri Oct 16 11:32:28 BST 1992 * * (C) Copyright 1992, Hewlett-Packard Ltd. ** Licensed under the Apache License, Version 2.0 (the "License"); @@ -36,10 +35,10 @@ #define EXTERN -EXTERN BOOL_VAR(textord_fp_chopping, TRUE, "Do fixed pitch chopping"); -EXTERN BOOL_VAR(textord_force_make_prop_words, FALSE, +EXTERN BOOL_VAR(textord_fp_chopping, true, "Do fixed pitch chopping"); +EXTERN BOOL_VAR(textord_force_make_prop_words, false, "Force proportional word segmentation on all rows"); -EXTERN BOOL_VAR(textord_chopper_test, FALSE, +EXTERN BOOL_VAR(textord_chopper_test, false, "Chopper is being tested."); #define FIXED_WIDTH_MULTIPLE 5 @@ -84,8 +83,8 @@ void make_single_word(bool one_blob, TO_ROW_LIST *rows, ROW_LIST* real_rows) { static_cast(row->space_size)); WERD_IT word_it(real_row->word_list()); WERD* word = new WERD(&cblobs, 0, nullptr); - word->set_flag(W_BOL, TRUE); - word->set_flag(W_EOL, TRUE); + word->set_flag(W_BOL, true); + word->set_flag(W_EOL, true); word->set_flag(W_DONT_CHOP, one_blob); word_it.add_after_then_move(word); row_it.add_after_then_move(real_row); @@ -109,7 +108,7 @@ void make_words(tesseract::Textord *textord, compute_fixed_pitch_cjk(page_tr, port_blocks); } else { compute_fixed_pitch(page_tr, port_blocks, gradient, FCOORD(0.0f, -1.0f), - !(BOOL8) textord_test_landscape); + !bool(textord_test_landscape)); } textord->to_spacing(page_tr, port_blocks); block_it.set_to_list(port_blocks); @@ -217,7 +216,7 @@ int32_t row_words( //compute space size if (prev_valid && blob_box.left () - prev_x < maxwidth) { gap_stats.add (blob_box.left () - prev_x, 1); } - prev_valid = TRUE; + prev_valid = true; prev_x = blob_box.right (); } } @@ -526,7 +525,7 @@ void make_real_words( row->pitch_decision == PITCH_CORR_FIXED) { real_row = fixed_pitch_words (row, rotation); } else { - ASSERT_HOST(FALSE); + ASSERT_HOST(false); } } if (real_row != nullptr) { diff --git a/src/textord/wordseg.h b/src/textord/wordseg.h index 4877f90c87..46613cfbe6 100644 --- a/src/textord/wordseg.h +++ b/src/textord/wordseg.h @@ -27,10 +27,10 @@ namespace tesseract { class Tesseract; } -extern BOOL_VAR_H (textord_fp_chopping, TRUE, "Do fixed pitch chopping"); -extern BOOL_VAR_H(textord_force_make_prop_words, FALSE, +extern BOOL_VAR_H (textord_fp_chopping, true, "Do fixed pitch chopping"); +extern BOOL_VAR_H(textord_force_make_prop_words, false, "Force proportional word segmentation on all rows"); -extern BOOL_VAR_H (textord_chopper_test, FALSE, +extern BOOL_VAR_H (textord_chopper_test, false, "Chopper is being tested."); void make_single_word(bool one_blob, TO_ROW_LIST *rows, ROW_LIST* real_rows); diff --git a/src/training/commandlineflags.cpp b/src/training/commandlineflags.cpp index 72d20480ab..b44a75b8a3 100644 --- a/src/training/commandlineflags.cpp +++ b/src/training/commandlineflags.cpp @@ -45,7 +45,7 @@ static bool BoolFlagExists(const char* flag_name, bool* value) { BoolParam *p = ParamUtils::FindParam( full_flag_name.string(), GlobalParams()->bool_params, empty); if (p == nullptr) return false; - *value = (BOOL8)(*p); + *value = bool(*p); return true; } @@ -138,7 +138,7 @@ static void PrintCommandLineFlags() { printf(" --%s %s (type:bool default:%s)\n", GlobalParams()->bool_params[i]->name_str() + kFlagNamePrefixLen, GlobalParams()->bool_params[i]->info_str(), - (BOOL8(*(GlobalParams()->bool_params[i])) ? "true" : "false")); + bool(*(GlobalParams()->bool_params[i])) ? "true" : "false"); } } for (int i = 0; i < GlobalParams()->string_params.size(); ++i) {