Skip to content

Commit

Permalink
Clean up cutil.h
Browse files Browse the repository at this point in the history
* Remove unrelated include statements from cutil.h.
* Remove macros FALSE, TRUE.
* Move macro CHARS_PER_LINE from cutil.h to dict.h.
* Remove unneeded macro _ARGS.
* Remove unused typedef statements.
* Remove macro new_line (only used once).
* Remove unused macro print_string.
* Update include statements for other source files.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
  • Loading branch information
stweil committed Jul 3, 2018
1 parent a0ed0b4 commit 6a553f9
Show file tree
Hide file tree
Showing 13 changed files with 14 additions and 75 deletions.
1 change: 0 additions & 1 deletion src/ccstruct/blobs.cpp
Expand Up @@ -34,7 +34,6 @@
#include "blobs.h"
#include "ccstruct.h"
#include "clst.h"
#include "cutil.h"
#include "emalloc.h"
#include "helpers.h"
#include "linlsq.h"
Expand Down
3 changes: 2 additions & 1 deletion src/classify/cluster.cpp
Expand Up @@ -14,9 +14,10 @@
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
******************************************************************************/
*****************************************************************************/

#include "cluster.h"
#include "cutil.h" // for void_proc
#include "emalloc.h"
#include "genericheap.h"
#include "helpers.h"
Expand Down
1 change: 1 addition & 0 deletions src/classify/kdtree.cpp
Expand Up @@ -19,6 +19,7 @@
Include Files and Type Defines
-----------------------------------------------------------------------------*/
#include "kdtree.h"
#include "cutil.h" // for void_proc
#include "emalloc.h"

#include <algorithm>
Expand Down
4 changes: 2 additions & 2 deletions src/classify/kdtree.h
Expand Up @@ -13,15 +13,15 @@
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
******************************************************************************/
*****************************************************************************/
#ifndef KDTREE_H
#define KDTREE_H

/*-----------------------------------------------------------------------------
Include Files and Type Defines
-----------------------------------------------------------------------------*/
#include "cutil.h" // for void_proc
#include "host.h"
#include "cutil.h"
#include "ocrfeatures.h"

/**
Expand Down
2 changes: 1 addition & 1 deletion src/classify/protos.cpp
Expand Up @@ -274,6 +274,6 @@ void PrintProtos(CLASS_TYPE Class) {
PrintProto (ProtoIn (Class, Pid));
cprintf ("\t");
PrintProtoLine (ProtoIn (Class, Pid));
new_line();
tprintf("\n");
}
}
1 change: 0 additions & 1 deletion src/classify/protos.h
Expand Up @@ -30,7 +30,6 @@
I n c l u d e s
----------------------------------------------------------------------*/
#include "bitvec.h"
#include "cutil.h"
#include "params.h"
#include "unichar.h"
#include "unicity_table.h"
Expand Down
60 changes: 3 additions & 57 deletions src/cutil/cutil.h
Expand Up @@ -27,63 +27,9 @@
#ifndef CUTILH
#define CUTILH

/*----------------------------------------------------------------------
I n c l u d e s
----------------------------------------------------------------------*/
#include <cstdio>
#include <cstring>
#include <cstdlib>
typedef void (*void_proc)(...);

#include "host.h"
#include "tprintf.h"
typedef int (*int_compare)(void*, void*);
typedef void (*void_dest)(void*);

/*----------------------------------------------------------------------
T y p e s
----------------------------------------------------------------------*/
#ifndef TRUE
#define TRUE 1
#endif

#ifndef FALSE
#define FALSE 0
#endif

#define CHARS_PER_LINE 500

#if defined(__STDC__) || defined(__cplusplus)
# define _ARGS(s) s
#else
# define _ARGS(s) ()
#endif

typedef void (*void_proc) (...);
typedef void *(*void_star_proc) _ARGS ((...));

typedef int (*int_void) (void);
typedef void (*void_void) (void);
typedef int (*int_compare) (void *, void *);
typedef void (*void_dest) (void *);

/*----------------------------------------------------------------------
M a c r o s
----------------------------------------------------------------------*/
/**********************************************************************
* new_line
*
* Print a new line character on stdout.
**********************************************************************/

#define new_line() \
tprintf("\n")

/**********************************************************************
* print_string
*
* Print a string on stdout.
**********************************************************************/

#define print_string(str) \
printf ("%s\n", str)

#include "cutil_class.h"
#endif
11 changes: 3 additions & 8 deletions src/cutil/oldlist.cpp
Expand Up @@ -21,14 +21,7 @@
** See the License for the specific language governing permissions and
** limitations under the License.
#
################################################################################
* Revision 1.13 90/03/06 15:37:54 15:37:54 marks (Mark Seaman)
* Look for correct file of <malloc.h> or <stdlib.h>
*
* Revision 1.12 90/02/26 17:37:36 17:37:36 marks (Mark Seaman)
* Added pop_off and join_on
*
###############################################################################
This file contains a set of general purpose list manipulation routines.
These routines can be used in a wide variety of ways to provide several
Expand Down Expand Up @@ -84,6 +77,8 @@
******************************************************************************/
#include "oldlist.h"
#include <cstdio>
#include <cstring> // for strcmp
#include "errcode.h" // for ASSERT_HOST
#include "structures.h"

/*----------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion src/cutil/oldlist.h
Expand Up @@ -117,7 +117,7 @@
#ifndef LIST_H
#define LIST_H

#include "cutil.h"
#include "cutil.h" // for int_compare, void_dest, ...
#include "tesscallback.h"

/*----------------------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions src/dict/dict.h
Expand Up @@ -32,6 +32,7 @@
class MATRIX;
class WERD_RES;

#define CHARS_PER_LINE 500
#define MAX_WERD_LENGTH (int64_t) 128
#define NO_RATING -1

Expand Down
1 change: 0 additions & 1 deletion src/dict/permdawg.cpp
Expand Up @@ -26,7 +26,6 @@
I n c l u d e s
----------------------------------------------------------------------*/

#include "cutil.h"
#include "dawg.h"
#include "globals.h"
#include "stopper.h"
Expand Down
1 change: 0 additions & 1 deletion src/dict/trie.h
Expand Up @@ -26,7 +26,6 @@
#define TRIE_H

#include "dawg.h"
#include "cutil.h"
#include "genericvector.h"

class UNICHARSET;
Expand Down
1 change: 0 additions & 1 deletion src/wordrec/chopper.h
Expand Up @@ -26,7 +26,6 @@
#ifndef CHOPPER_H
#define CHOPPER_H

#include "cutil.h"
#include "matrix.h"
#include "seam.h"
#include "stopper.h"
Expand Down

0 comments on commit 6a553f9

Please sign in to comment.