Skip to content

Commit

Permalink
textord: Replace TRUE, FALSE by true, false and use bool instead of B…
Browse files Browse the repository at this point in the history
…OOL8

Signed-off-by: Stefan Weil <[email protected]>
  • Loading branch information
stweil committed Mar 31, 2019
1 parent bb52887 commit 30ee3af
Show file tree
Hide file tree
Showing 15 changed files with 124 additions and 129 deletions.
2 changes: 1 addition & 1 deletion src/textord/blkocc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ static void horizontal_coutline_projection(C_OUTLINE *outline,
* test_underline
*
* Check to see if the blob is an underline.
* Return TRUE if it is.
* Return true if it is.
*/

bool test_underline( //look for underlines
Expand Down
30 changes: 15 additions & 15 deletions src/textord/blkocc.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,17 @@ ELISTIZEH (REGION_OCC)
Adapted from the following procedure so that it can be used in the bands
class in an include file...
BOOL8 range_in_band[
bool range_in_band[
range within band?
int16_t band_max,
int16_t band_min,
int16_t range_max,
int16_t range_min]
int16_t band_max,
int16_t band_min,
int16_t range_max,
int16_t range_min]
{
if ((range_min >= band_min) && (range_max < band_max))
return TRUE;
return true;
else
return FALSE;
return false;
}
***********************************************************************/
#define RANGE_OVERLAPS_BAND(band_max, band_min, range_max, range_min) \
Expand All @@ -85,17 +85,17 @@ int16_t range_min]
Adapted from the following procedure so that it can be used in the bands
class in an include file...
BOOL8 range_overlaps_band[
bool range_overlaps_band[
range crosses band?
int16_t band_max,
int16_t band_min,
int16_t range_max,
int16_t range_min]
int16_t band_max,
int16_t band_min,
int16_t range_max,
int16_t range_min]
{
if ((range_max >= band_min) && (range_min < band_max))
return TRUE;
return true;
else
return FALSE;
return false;
}
***********************************************************************/
/**********************************************************************
Expand Down Expand Up @@ -228,7 +228,7 @@ class BAND

#define END_OF_WERD_CODE 255

extern BOOL_VAR_H (blockocc_show_result, FALSE, "Show intermediate results");
extern BOOL_VAR_H (blockocc_show_result, false, "Show intermediate results");
extern INT_VAR_H (blockocc_desc_height, 0,
"Descender height after normalisation");
extern INT_VAR_H (blockocc_asc_height, 255,
Expand Down
4 changes: 2 additions & 2 deletions src/textord/cjkpitch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include <algorithm>
#include <vector> // for std::vector

BOOL_VAR(textord_space_size_is_variable, FALSE,
BOOL_VAR(textord_space_size_is_variable, false,
"If true, word delimiter spaces are assumed to have "
"variable width, even though characters have fixed pitch.");

Expand Down Expand Up @@ -977,7 +977,7 @@ FPAnalyzer::FPAnalyzer(ICOORD page_tr, TO_BLOCK_LIST *port_blocks)
TO_BLOCK *block = block_it.data();
if (!block->get_rows()->empty()) {
ASSERT_HOST(block->xheight > 0);
find_repeated_chars(block, FALSE);
find_repeated_chars(block, false);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/textord/drawtord.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

#define EXTERN

EXTERN BOOL_VAR (textord_show_fixed_cuts, FALSE,
EXTERN BOOL_VAR (textord_show_fixed_cuts, false,
"Draw fixed pitch cell boundaries");

EXTERN ScrollView* to_win = nullptr;
Expand Down
2 changes: 1 addition & 1 deletion src/textord/drawtord.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

#define NO_SMD "none"

extern BOOL_VAR_H (textord_show_fixed_cuts, FALSE,
extern BOOL_VAR_H (textord_show_fixed_cuts, false,
"Draw fixed pitch cell boundaries");
extern STRING_VAR_H (to_debugfile, DEBUG_WIN_NAME, "Name of debugfile");
extern STRING_VAR_H (to_smdfile, NO_SMD, "Name of SMD file");
Expand Down
8 changes: 4 additions & 4 deletions src/textord/edgblob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,21 @@
// - number of children exceeds edges_max_children_per_outline
// - number of nested layers exceeds edges_max_children_layers
// - joint complexity exceeds edges_children_count_limit(as in child_count())
EXTERN BOOL_VAR(edges_use_new_outline_complexity, FALSE,
EXTERN BOOL_VAR(edges_use_new_outline_complexity, false,
"Use the new outline complexity module");
EXTERN INT_VAR(edges_max_children_per_outline, 10,
"Max number of children inside a character outline");
EXTERN INT_VAR(edges_max_children_layers, 5,
"Max layers of nested children inside a character outline");
EXTERN BOOL_VAR(edges_debug, FALSE,
EXTERN BOOL_VAR(edges_debug, false,
"turn on debugging for this module");


EXTERN INT_VAR(edges_children_per_grandchild, 10,
"Importance ratio for chucking outlines");
EXTERN INT_VAR(edges_children_count_limit, 45,
"Max holes allowed in blob");
EXTERN BOOL_VAR(edges_children_fix, FALSE,
EXTERN BOOL_VAR(edges_children_fix, false,
"Remove boxy parents of char-like children");
EXTERN INT_VAR(edges_min_nonhole, 12,
"Min pixels for potential char in box");
Expand Down Expand Up @@ -434,7 +434,7 @@ void empty_buckets( // find blobs
*
* Find all neighbouring outlines that are children of this outline
* and either move them to the output list or declare this outline
* illegal and return FALSE.
* illegal and return false.
*/

bool capture_children( // find children
Expand Down
13 changes: 6 additions & 7 deletions src/textord/fpchop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* File: fpchop.cpp (Formerly fp_chop.c)
* Description: Code to chop fixed pitch text into character cells.
* Author: Ray Smith
* Created: Thu Sep 16 11:14:15 BST 1993
*
* (C) Copyright 1993, Hewlett-Packard Ltd.
** Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -150,10 +149,10 @@ ROW *fixed_pitch_words( //find lines
blanks = 1;
word = new WERD (&cblobs, blanks, nullptr);
cblob_it.set_to_list (&cblobs);
word->set_flag (W_DONT_CHOP, TRUE);
word->set_flag (W_DONT_CHOP, true);
word_it.add_after_then_move (word);
if (bol) {
word->set_flag (W_BOL, TRUE);
word->set_flag (W_BOL, true);
bol = false;
}
blanks = new_blanks;
Expand All @@ -170,18 +169,18 @@ ROW *fixed_pitch_words( //find lines
}
if (!cblob_it.empty()) {
word = new WERD(&cblobs, blanks, nullptr);
word->set_flag (W_DONT_CHOP, TRUE);
word->set_flag (W_DONT_CHOP, true);
word_it.add_after_then_move (word);
if (bol)
word->set_flag (W_BOL, TRUE);
word->set_flag (W_BOL, true);
}
ASSERT_HOST (word != nullptr);
while (!rep_it.empty ()) {
add_repeated_word (&rep_it, rep_left, prev_chop_coord,
blanks, row->fixed_pitch, &word_it);
}
//at end of line
word_it.data ()->set_flag (W_EOL, TRUE);
word_it.data ()->set_flag (W_EOL, true);
if (prev_chop_coord > prev_x)
prev_x = prev_chop_coord;
xstarts[1] = prev_x + 1;
Expand Down Expand Up @@ -391,7 +390,7 @@ void fixed_split_coutline( //chop the outline
*
* Chop the given coutline (if necessary) placing the fragments which
* fall either side of the chop line into the appropriate list.
* If the coutline lies too heavily to one side to chop, FALSE is returned.
* If the coutline lies too heavily to one side to chop, false is returned.
**********************************************************************/

bool fixed_chop_coutline( //chop the outline
Expand Down
6 changes: 3 additions & 3 deletions src/textord/gap_map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
#include "statistc.h"
#include "gap_map.h"

BOOL_VAR(gapmap_debug, FALSE, "Say which blocks have tables");
BOOL_VAR(gapmap_use_ends, FALSE, "Use large space at start and end of rows");
BOOL_VAR(gapmap_no_isolated_quanta, FALSE,
BOOL_VAR(gapmap_debug, false, "Say which blocks have tables");
BOOL_VAR(gapmap_use_ends, false, "Use large space at start and end of rows");
BOOL_VAR(gapmap_no_isolated_quanta, false,
"Ensure gaps not less than 2quanta wide");
double_VAR(gapmap_big_gaps, 1.75, "xht multiplier");

Expand Down
6 changes: 3 additions & 3 deletions src/textord/gap_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ class GAPMAP

/*-----------------------------*/

extern BOOL_VAR_H (gapmap_debug, FALSE, "Say which blocks have tables");
extern BOOL_VAR_H (gapmap_use_ends, FALSE,
extern BOOL_VAR_H (gapmap_debug, false, "Say which blocks have tables");
extern BOOL_VAR_H (gapmap_use_ends, false,
"Use large space at start and end of rows");
extern BOOL_VAR_H (gapmap_no_isolated_quanta, FALSE,
extern BOOL_VAR_H (gapmap_no_isolated_quanta, false,
"Ensure gaps not less than 2quanta wide");
extern double_VAR_H (gapmap_big_gaps, 1.75, "xht multiplier");

Expand Down
55 changes: 27 additions & 28 deletions src/textord/makerow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* File: makerow.cpp (Formerly makerows.c)
* Description: Code to arrange blobs into rows of text.
* Author: Ray Smith
* Created: Mon Sep 21 14:34:48 BST 1992
*
* (C) Copyright 1992, Hewlett-Packard Ltd.
** Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -40,22 +39,22 @@

#include <algorithm>

BOOL_VAR(textord_heavy_nr, FALSE, "Vigorously remove noise");
BOOL_VAR(textord_show_initial_rows, FALSE, "Display row accumulation");
BOOL_VAR(textord_show_parallel_rows, FALSE, "Display page correlated rows");
BOOL_VAR(textord_show_expanded_rows, FALSE, "Display rows after expanding");
BOOL_VAR(textord_show_final_rows, FALSE, "Display rows after final fitting");
BOOL_VAR(textord_show_final_blobs, FALSE, "Display blob bounds after pre-ass");
BOOL_VAR(textord_test_landscape, FALSE, "Tests refer to land/port");
BOOL_VAR(textord_parallel_baselines, TRUE, "Force parallel baselines");
BOOL_VAR(textord_straight_baselines, FALSE, "Force straight baselines");
BOOL_VAR(textord_old_baselines, TRUE, "Use old baseline algorithm");
BOOL_VAR(textord_old_xheight, FALSE, "Use old xheight algorithm");
BOOL_VAR(textord_fix_xheight_bug, TRUE, "Use spline baseline");
BOOL_VAR(textord_fix_makerow_bug, TRUE, "Prevent multiple baselines");
BOOL_VAR(textord_debug_xheights, FALSE, "Test xheight algorithms");
BOOL_VAR(textord_biased_skewcalc, TRUE, "Bias skew estimates with line length");
BOOL_VAR(textord_interpolating_skew, TRUE, "Interpolate across gaps");
BOOL_VAR(textord_heavy_nr, false, "Vigorously remove noise");
BOOL_VAR(textord_show_initial_rows, false, "Display row accumulation");
BOOL_VAR(textord_show_parallel_rows, false, "Display page correlated rows");
BOOL_VAR(textord_show_expanded_rows, false, "Display rows after expanding");
BOOL_VAR(textord_show_final_rows, false, "Display rows after final fitting");
BOOL_VAR(textord_show_final_blobs, false, "Display blob bounds after pre-ass");
BOOL_VAR(textord_test_landscape, false, "Tests refer to land/port");
BOOL_VAR(textord_parallel_baselines, true, "Force parallel baselines");
BOOL_VAR(textord_straight_baselines, false, "Force straight baselines");
BOOL_VAR(textord_old_baselines, true, "Use old baseline algorithm");
BOOL_VAR(textord_old_xheight, false, "Use old xheight algorithm");
BOOL_VAR(textord_fix_xheight_bug, true, "Use spline baseline");
BOOL_VAR(textord_fix_makerow_bug, true, "Prevent multiple baselines");
BOOL_VAR(textord_debug_xheights, false, "Test xheight algorithms");
BOOL_VAR(textord_biased_skewcalc, true, "Bias skew estimates with line length");
BOOL_VAR(textord_interpolating_skew, true, "Interpolate across gaps");
INT_VAR(textord_skewsmooth_offset, 4, "For smooth factor");
INT_VAR(textord_skewsmooth_offset2, 1, "For smooth factor");
INT_VAR(textord_test_x, -INT32_MAX, "coord of test pt");
Expand Down Expand Up @@ -98,8 +97,8 @@ double_VAR(textord_descx_ratio_min, 0.25, "Min desc/xheight");
double_VAR(textord_descx_ratio_max, 0.6, "Max desc/xheight");
double_VAR(textord_xheight_error_margin, 0.1, "Accepted variation");
INT_VAR(textord_lms_line_trials, 12, "Number of linew fits to do");
BOOL_VAR(textord_new_initial_xheight, TRUE, "Use test xheight mechanism");
BOOL_VAR(textord_debug_blob, FALSE, "Print test blob information");
BOOL_VAR(textord_new_initial_xheight, true, "Use test xheight mechanism");
BOOL_VAR(textord_debug_blob, false, "Print test blob information");

#define MAX_HEIGHT_MODES 12

Expand Down Expand Up @@ -241,7 +240,7 @@ void make_initial_textrows( //find lines
}
#endif
//guess skew
assign_blobs_to_rows (block, nullptr, 0, TRUE, TRUE, textord_show_initial_rows && testing_on);
assign_blobs_to_rows (block, nullptr, 0, true, true, textord_show_initial_rows && testing_on);
row_it.move_to_first ();
for (row_it.mark_cycle_pt (); !row_it.cycled_list (); row_it.forward ())
fit_lms_line (row_it.data ());
Expand Down Expand Up @@ -550,17 +549,17 @@ void cleanup_rows_making( //find lines
for (row_it.mark_cycle_pt (); !row_it.cycled_list (); row_it.forward ())
blob_it.add_list_after (row_it.data ()->blob_list ());
//give blobs back
assign_blobs_to_rows (block, &gradient, 1, FALSE, FALSE, FALSE);
assign_blobs_to_rows (block, &gradient, 1, false, false, false);
//now new rows must be genuine
blob_it.set_to_list (&block->blobs);
blob_it.add_list_after (&block->large_blobs);
assign_blobs_to_rows (block, &gradient, 2, TRUE, TRUE, FALSE);
assign_blobs_to_rows (block, &gradient, 2, true, true, false);
//safe to use big ones now
blob_it.set_to_list (&block->blobs);
//throw all blobs in
blob_it.add_list_after (&block->noise_blobs);
blob_it.add_list_after (&block->small_blobs);
assign_blobs_to_rows (block, &gradient, 3, FALSE, FALSE, FALSE);
assign_blobs_to_rows (block, &gradient, 3, false, false, false);
}

/**
Expand Down Expand Up @@ -649,7 +648,7 @@ void delete_non_dropout_rows( //find lines
* @name find_best_dropout_row
*
* Delete this row if it has a neighbour with better dropout characteristics.
* TRUE is returned if the row should be deleted.
* true is returned if the row should be deleted.
*/
bool find_best_dropout_row( //find neighbours
TO_ROW* row, //row to test
Expand Down Expand Up @@ -1480,7 +1479,7 @@ int compute_xheight_from_modes(
}
if (blob_count == 0) return 0;
int modes[MAX_HEIGHT_MODES]; // biggest piles
bool in_best_pile = FALSE;
bool in_best_pile = false;
int prev_size = -INT32_MAX;
int best_count = 0;
int mode_count = compute_height_modes(heights, min_height, max_height,
Expand All @@ -1496,7 +1495,7 @@ int compute_xheight_from_modes(

for (x = 0; x < mode_count - 1; x++) {
if (modes[x] != prev_size + 1)
in_best_pile = FALSE; // had empty height
in_best_pile = false; // had empty height
int modes_x_count = heights->pile_count(modes[x]) -
floating_heights->pile_count(modes[x]);
if ((modes_x_count >= blob_count * textord_xheight_mode_fraction) &&
Expand Down Expand Up @@ -2084,7 +2083,7 @@ void make_baseline_spline(TO_ROW *row, //row to fit
*
* Divide the baseline up into segments which require a different
* quadratic fitted to them.
* Return TRUE if enough blobs were far enough away to need a quadratic.
* Return true if enough blobs were far enough away to need a quadratic.
*/
bool
segment_baseline( //split baseline
Expand Down Expand Up @@ -2183,7 +2182,7 @@ segment_baseline( //split baseline
*
* Divide the baseline up into segments which require a different
* quadratic fitted to them.
* @return TRUE if enough blobs were far enough away to need a quadratic.
* @return true if enough blobs were far enough away to need a quadratic.
*/
double *
linear_spline_baseline ( //split baseline
Expand Down
Loading

0 comments on commit 30ee3af

Please sign in to comment.