Skip to content

Commit

Permalink
Misc improvements
Browse files Browse the repository at this point in the history
git-svn-id: https://tesseract-ocr.googlecode.com/svn/trunk@55 d0cd1f9f-072b-0410-8dd7-cf729c803f20
  • Loading branch information
theraysmith committed May 16, 2007
1 parent 974bfda commit c7e9ec8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
20 changes: 10 additions & 10 deletions dict/choices.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,17 @@ CHOICES append_choice(CHOICES ratings,
* Copy a list of choices. This means that there will be two copies
* in memory.
**********************************************************************/
CHOICES copy_choices(CHOICES choices) {
CHOICES copy_choices(CHOICES choices) {
CHOICES l;
CHOICES result = NIL;

iterate_list(l, choices) {
iterate_list(l, choices) {
result = push (result,
(LIST) new_choice (class_string (first (l)),
class_probability (first (l)),
class_certainty (first (l)),
class_config (first (l)),
class_permuter (first (l))));
(LIST) new_choice (class_string (first_node (l)),
class_probability (first_node (l)),
class_certainty (first_node (l)),
class_config (first_node (l)),
class_permuter (first_node (l))));
}
return (reverse_d (result));
}
Expand All @@ -96,7 +96,7 @@ void free_choice(void *arg) { //LIST choice)
if (this_choice) {
if (this_choice->string)
strfree (this_choice->string);
oldchoice(this_choice);
oldchoice(this_choice);
}
}

Expand Down Expand Up @@ -139,12 +139,12 @@ void print_choices( /* List of (A_CHOICE*) */
if (rating == NIL)
cprintf (" No rating ");

iterate(rating) {
iterate(rating) {

if (first_one && show_bold) {
cprintf ("|");
len = sprintf (str, " %s ", best_string (rating));
print_bold(str);
print_bold(str);
while (len++ < 8)
cprintf (" ");
}
Expand Down
10 changes: 5 additions & 5 deletions dict/choices.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,23 +79,23 @@ typedef struct choicestruct
* Return the string corresponding to the best choice.
**********************************************************************/
#define best_string(choices) \
(first (choices) ? ((A_CHOICE*) (first (choices)))->string : NULL)
(first_node (choices) ? ((A_CHOICE*) (first_node (choices)))->string : NULL)

/**********************************************************************
* best_probability
*
* Return the probability of the best choice.
**********************************************************************/
#define best_probability(choices) \
(((A_CHOICE*) (first (choices)))->rating)
(((A_CHOICE*) (first_node (choices)))->rating)

/**********************************************************************
* best_certainty
*
* Return the certainty of the best choice.
**********************************************************************/
#define best_certainty(choices) \
(((A_CHOICE*) (first (choices)))->certainty)
(((A_CHOICE*) (first_node (choices)))->certainty)

/**********************************************************************
* class_probability
Expand Down Expand Up @@ -177,7 +177,7 @@ CHOICES append_choice(CHOICES ratings,
float certainty,
INT8 config);

CHOICES copy_choices(CHOICES choices);
CHOICES copy_choices(CHOICES choices);

void free_choice(void *arg); //LIST choice);

Expand All @@ -187,5 +187,5 @@ A_CHOICE *new_choice(const char *string,
INT8 config,
char permuter);

void print_choices(const char *label, CHOICES rating);
void print_choices(const char *label, CHOICES rating);
#endif

0 comments on commit c7e9ec8

Please sign in to comment.