Skip to content

Commit 674d6a9

Browse files
committed
Remove code for embedded build
That code is unrelated to Tesseract and can be easily implemented by external projects which require it. Signed-off-by: Stefan Weil <sw@weilnetz.de>
1 parent ceabab8 commit 674d6a9

File tree

5 files changed

+5
-89
lines changed

5 files changed

+5
-89
lines changed

CMakeLists.txt

-2
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ message( "Configuring tesseract version ${PACKAGE_VERSION}...")
7171
option(CPPAN_BUILD "Build with cppan" ON)
7272
option(OPENMP_BUILD "Build with openmp support" OFF) # see issue #1662
7373
option(GRAPHICS_DISABLED "Disable disable graphics (ScrollView)" OFF)
74-
option(EMBEDDED "Enable embedded build " OFF)
7574
option(DISABLED_LEGACY_ENGINE "Disable the legacy OCR engine" OFF)
7675
option(BUILD_TRAINING_TOOLS "Build training tools" ON)
7776
option(BUILD_TESTS "Build tests" OFF)
@@ -267,7 +266,6 @@ message( STATUS )
267266
message( STATUS "Build with cppan [CPPAN_BUILD]: ${CPPAN_BUILD}")
268267
message( STATUS "Build with openmp support [OPENMP_BUILD]: ${OPENMP_BUILD}")
269268
message( STATUS "Disable disable graphics (ScrollView) [GRAPHICS_DISABLED]: ${GRAPHICS_DISABLED}")
270-
message( STATUS "Enable embedded build [EMBEDDED]: ${EMBEDDED}")
271269
message( STATUS "Disable the legacy OCR engine [DISABLED_LEGACY_ENGINE]: ${DISABLED_LEGACY_ENGINE}")
272270
message( STATUS "Build training tools [BUILD_TRAINING_TOOLS]: ${BUILD_TRAINING_TOOLS}")
273271
message( STATUS "Build tests [BUILD_TESTS]: ${BUILD_TESTS}")

cmake/Configure.cmake

-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ file(APPEND ${AUTOCONFIG_SRC} "
118118
/* Version number */
119119
#cmakedefine PACKAGE_VERSION \"${PACKAGE_VERSION}\"
120120
#cmakedefine GRAPHICS_DISABLED ${GRAPHICS_DISABLED}
121-
#cmakedefine EMBEDDED ${EMBEDDED}
122121
#cmakedefine DISABLED_LEGACY_ENGINE ${DISABLED_LEGACY_ENGINE}
123122
#cmakedefine HAVE_LIBARCHIVE ${HAVE_LIBARCHIVE}
124123
")

configure.ac

-10
Original file line numberDiff line numberDiff line change
@@ -165,16 +165,6 @@ AC_ARG_ENABLE([legacy],
165165
AC_MSG_RESULT([$enable_legacy])
166166
AM_CONDITIONAL([DISABLED_LEGACY_ENGINE], test "$enable_legacy" = "no")
167167

168-
# check whether to build embedded version
169-
AC_MSG_CHECKING([--enable-embedded argument])
170-
AC_ARG_ENABLE([embedded],
171-
AS_HELP_STRING([--enable-embedded], [enable embedded build [default=no]]))
172-
AC_MSG_RESULT([$enable_embedded])
173-
AM_CONDITIONAL([EMBEDDED], [test "$enable_embedded" = "yes"])
174-
if test "$enable_embedded" = "yes"; then
175-
AM_CPPFLAGS="-DEMBEDDED $AM_CPPFLAGS"
176-
fi
177-
178168
# check whether to build OpenMP support
179169
AC_OPENMP
180170

src/ccutil/scanutils.cpp

+4-45
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,6 @@
22
// All Rights Reserved.
33
// Author: renn
44
//
5-
// The fscanf, vfscanf and creat functions are implemented so that their
6-
// functionality is mostly like their stdio counterparts. However, currently
7-
// these functions do not use any buffering, making them rather slow.
8-
// File streams are thus processed one character at a time.
9-
// Although the implementations of the scanf functions do lack a few minor
10-
// features, they should be sufficient for their use in tesseract.
11-
//
125
// Licensed under the Apache License, Version 2.0 (the "License");
136
// you may not use this file except in compliance with the License.
147
// You may obtain a copy of the License at
@@ -24,16 +17,14 @@
2417
#endif
2518

2619
#include <cctype>
20+
#include <climits> // for CHAR_BIT
2721
#include <cmath>
2822
#include <cstdarg>
2923
#include <cstddef>
30-
#include <cstring>
31-
#include <climits>
24+
#include <cstdint>
3225
#include <cstdio>
33-
#include <limits>
34-
#include <sys/types.h>
35-
#include <sys/stat.h>
36-
#include <fcntl.h>
26+
#include <cstring>
27+
#include <limits> // for std::numeric_limits
3728

3829
#include "scanutils.h"
3930

@@ -198,31 +189,6 @@ int tfscanf(FILE* stream, const char *format, ...) {
198189
return rv;
199190
}
200191

201-
#ifdef EMBEDDED
202-
203-
int fscanf(FILE* stream, const char *format, ...) {
204-
va_list ap;
205-
int rv;
206-
207-
va_start(ap, format);
208-
rv = tvfscanf(stream, format, ap);
209-
va_end(ap);
210-
211-
return rv;
212-
}
213-
214-
int vfscanf(FILE* stream, const char *format, ...) {
215-
va_list ap;
216-
int rv;
217-
218-
va_start(ap, format);
219-
rv = tvfscanf(stream, format, ap);
220-
va_end(ap);
221-
222-
return rv;
223-
}
224-
#endif
225-
226192
static int tvfscanf(FILE* stream, const char *format, va_list ap) {
227193
const char *p = format;
228194
char ch;
@@ -535,10 +501,3 @@ static int tvfscanf(FILE* stream, const char *format, va_list ap) {
535501

536502
return converted;
537503
}
538-
539-
#ifdef EMBEDDED
540-
int creat(const char *pathname, mode_t mode) {
541-
return open(pathname, O_CREAT | O_TRUNC | O_WRONLY, mode);
542-
}
543-
544-
#endif // EMBEDDED

src/ccutil/scanutils.h

+1-31
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22
// All Rights Reserved.
33
// Author: renn
44
//
5-
// Contains file io functions (mainly for file parsing), that might not be
6-
// available, on embedded devices, or that have an incomplete implementation
7-
// there.
8-
//
95
// Licensed under the Apache License, Version 2.0 (the "License");
106
// you may not use this file except in compliance with the License.
117
// You may obtain a copy of the License at
@@ -19,10 +15,7 @@
1915
#ifndef TESSERACT_CCUTIL_SCANUTILS_H_
2016
#define TESSERACT_CCUTIL_SCANUTILS_H_
2117

22-
#include <cstdint>
23-
#include <cstddef>
24-
#include <cstdio>
25-
#include <sys/stat.h>
18+
#include <cstdio> // for FILE
2619

2720
/**
2821
* fscanf variant to ensure correct reading regardless of locale.
@@ -36,27 +29,4 @@
3629
*/
3730
int tfscanf(FILE* stream, const char *format, ...);
3831

39-
#ifdef EMBEDDED
40-
41-
// Attempts to parse the given file stream s as an integer of the base
42-
// 'base'. Returns the first successfully parsed integer as a uintmax_t, or
43-
// 0, if none was found.
44-
uintmax_t streamtoumax(FILE* s, int base);
45-
46-
// Parse a file stream according to the given format. See the fscanf manpage
47-
// for more information, as this function attempts to mimic its behavior.
48-
// Note that scientific floating-point notation is not supported.
49-
int fscanf(FILE* stream, const char *format, ...);
50-
51-
// Parse a file stream according to the given format. See the fscanf manpage
52-
// for more information, as this function attempts to mimic its behavior.
53-
// Note that scientific floating-point notation is not supported.
54-
int vfscanf(FILE* stream, const char *format, va_list ap);
55-
56-
// Create a file at the specified path. See the creat manpage for more
57-
// information, as this function attempts to mimic its behavior.
58-
int creat(const char *pathname, mode_t mode);
59-
60-
#endif // EMBEDDED
61-
6232
#endif // TESSERACT_CCUTIL_SCANUTILS_H_

0 commit comments

Comments
 (0)