Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

protos: Remove several unused macros, functions and global variables #2118

Merged
merged 2 commits into from
Dec 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 1 addition & 91 deletions src/classify/protos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,7 @@
******************************************************************************
*
* File: protos.cpp (Formerly protos.c)
* Description:
* Author: Mark Seaman, OCR Technology
* Created: Fri Oct 16 14:37:00 1987
* Modified: Mon Mar 4 14:51:24 1991 (Dan Johnson) danj@hpgrlj
* Language: C
* Package: N/A
* Status: Reusable Software Component
* Author: Mark Seaman, OCR Technology
*
* (c) Copyright 1987, Hewlett-Packard Company.
** Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -39,13 +33,6 @@
#define PROTO_INCREMENT 32
#define CONFIG_INCREMENT 16

/*----------------------------------------------------------------------
V a r i a b l e s
----------------------------------------------------------------------*/
CLASS_STRUCT TrainingData[NUMBER_OF_CLASSES];

STRING_VAR(classify_training_file, "MicroFeatures", "Training file");

/*----------------------------------------------------------------------
F u n c t i o n s
----------------------------------------------------------------------*/
Expand Down Expand Up @@ -128,65 +115,6 @@ int AddProtoToClass(CLASS_TYPE Class) {
}


/**
* @name ClassConfigLength
*
* Return the length of all the protos in this class.
*
* @param Class The class to add to
* @param Config FIXME
*/
float ClassConfigLength(CLASS_TYPE Class, BIT_VECTOR Config) {
int16_t Pid;
float TotalLength = 0;

for (Pid = 0; Pid < Class->NumProtos; Pid++) {
if (test_bit (Config, Pid)) {

TotalLength += (ProtoIn (Class, Pid))->Length;
}
}
return (TotalLength);
}


/**
* @name ClassProtoLength
*
* Return the length of all the protos in this class.
*
* @param Class The class to use
*/
float ClassProtoLength(CLASS_TYPE Class) {
int16_t Pid;
float TotalLength = 0;

for (Pid = 0; Pid < Class->NumProtos; Pid++) {
TotalLength += (ProtoIn (Class, Pid))->Length;
}
return (TotalLength);
}


/**
* @name CopyProto
*
* Copy the first proto into the second.
*
* @param Src Source
* @param Dest Destination
*/
void CopyProto(PROTO Src, PROTO Dest) {
Dest->X = Src->X;
Dest->Y = Src->Y;
Dest->Length = Src->Length;
Dest->Angle = Src->Angle;
Dest->A = Src->A;
Dest->B = Src->B;
Dest->C = Src->C;
}


/**********************************************************************
* FillABC
*
Expand Down Expand Up @@ -259,21 +187,3 @@ CLASS_TYPE NewClass(int NumProtos, int NumConfigs) {
return (Class);

}


/**********************************************************************
* PrintProtos
*
* Print the list of prototypes in this class type.
**********************************************************************/
void PrintProtos(CLASS_TYPE Class) {
int16_t Pid;

for (Pid = 0; Pid < Class->NumProtos; Pid++) {
cprintf ("Proto %d:\t", Pid);
PrintProto (ProtoIn (Class, Pid));
cprintf ("\t");
PrintProtoLine (ProtoIn (Class, Pid));
tprintf("\n");
}
}
66 changes: 0 additions & 66 deletions src/classify/protos.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,7 @@
******************************************************************************
*
* File: protos.h
* Description:
* Author: Mark Seaman, SW Productivity
* Created: Fri Oct 16 14:37:00 1987
* Modified: Fri Jul 12 10:06:55 1991 (Dan Johnson) danj@hpgrlj
* Language: C
* Package: N/A
* Status: Reusable Software Component
*
* (c) Copyright 1987, Hewlett-Packard Company.
** Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -69,20 +63,6 @@ struct CLASS_STRUCT {
using CLASS_TYPE = CLASS_STRUCT*;
using CLASSES = CLASS_STRUCT*;

/*----------------------------------------------------------------------
C o n s t a n t s
----------------------------------------------------------------------*/
#define NUMBER_OF_CLASSES MAX_NUM_CLASSES
#define Y_OFFSET -40.0
#define FEATURE_SCALE 100.0

/*----------------------------------------------------------------------
V a r i a b l e s
----------------------------------------------------------------------*/
extern CLASS_STRUCT TrainingData[];

extern STRING_VAR_H(classify_training_file, "MicroFeatures", "Training file");

/*----------------------------------------------------------------------
M a c r o s
----------------------------------------------------------------------*/
Expand All @@ -94,23 +74,6 @@ extern STRING_VAR_H(classify_training_file, "MicroFeatures", "Training file");

#define AddProtoToConfig(Pid, Config) (SET_BIT(Config, Pid))

/**
* RemoveProtoFromConfig
*
* Clear a single proto bit in the specified configuration.
*/

#define RemoveProtoFromConfig(Pid, Config) (reset_bit(Config, Pid))

/**
* ClassOfChar
*
* Return the class of a particular ASCII character value.
*/

#define ClassOfChar(Char) \
((TrainingData[Char].NumProtos) ? (&TrainingData[Char]) : NO_CLASS)

/**
* ProtoIn
*
Expand All @@ -120,40 +83,13 @@ extern STRING_VAR_H(classify_training_file, "MicroFeatures", "Training file");

#define ProtoIn(Class, Pid) (&(Class)->Prototypes[Pid])

/**
* PrintProto
*
* Print out the contents of a prototype. The 'Proto' argument is of
* type 'PROTO'.
*/

#define PrintProto(Proto) \
(tprintf("X=%4.2f, Y=%4.2f, Length=%4.2f, Angle=%4.2f", Proto->X, Proto->Y, \
Proto->Length, Proto->Angle))

/**
* PrintProtoLine
*
* Print out the contents of a prototype. The 'Proto' argument is of
* type 'PROTO'.
*/

#define PrintProtoLine(Proto) \
(cprintf("A=%4.2f, B=%4.2f, C=%4.2f", Proto->A, Proto->B, Proto->C))

/*----------------------------------------------------------------------
F u n c t i o n s
----------------------------------------------------------------------*/
int AddConfigToClass(CLASS_TYPE Class);

int AddProtoToClass(CLASS_TYPE Class);

float ClassConfigLength(CLASS_TYPE Class, BIT_VECTOR Config);

float ClassProtoLength(CLASS_TYPE Class);

void CopyProto(PROTO Src, PROTO Dest);

void FillABC(PROTO Proto);

void FreeClass(CLASS_TYPE Class);
Expand All @@ -164,6 +100,4 @@ void InitPrototypes();

CLASS_TYPE NewClass(int NumProtos, int NumConfigs);

void PrintProtos(CLASS_TYPE Class);

#endif