From 674d6a90d8345d11c4ec5a44ca45c543d64cfd33 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Mon, 17 Jun 2019 09:37:54 +0200 Subject: [PATCH] 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 --- CMakeLists.txt | 2 -- cmake/Configure.cmake | 1 - configure.ac | 10 -------- src/ccutil/scanutils.cpp | 49 ++++------------------------------------ src/ccutil/scanutils.h | 32 +------------------------- 5 files changed, 5 insertions(+), 89 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ed78d5c3..4d450b6d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -71,7 +71,6 @@ message( "Configuring tesseract version ${PACKAGE_VERSION}...") option(CPPAN_BUILD "Build with cppan" ON) option(OPENMP_BUILD "Build with openmp support" OFF) # see issue #1662 option(GRAPHICS_DISABLED "Disable disable graphics (ScrollView)" OFF) -option(EMBEDDED "Enable embedded build " OFF) option(DISABLED_LEGACY_ENGINE "Disable the legacy OCR engine" OFF) option(BUILD_TRAINING_TOOLS "Build training tools" ON) option(BUILD_TESTS "Build tests" OFF) @@ -267,7 +266,6 @@ message( STATUS ) message( STATUS "Build with cppan [CPPAN_BUILD]: ${CPPAN_BUILD}") message( STATUS "Build with openmp support [OPENMP_BUILD]: ${OPENMP_BUILD}") message( STATUS "Disable disable graphics (ScrollView) [GRAPHICS_DISABLED]: ${GRAPHICS_DISABLED}") -message( STATUS "Enable embedded build [EMBEDDED]: ${EMBEDDED}") message( STATUS "Disable the legacy OCR engine [DISABLED_LEGACY_ENGINE]: ${DISABLED_LEGACY_ENGINE}") message( STATUS "Build training tools [BUILD_TRAINING_TOOLS]: ${BUILD_TRAINING_TOOLS}") message( STATUS "Build tests [BUILD_TESTS]: ${BUILD_TESTS}") diff --git a/cmake/Configure.cmake b/cmake/Configure.cmake index 0152e89a..c2ceab1f 100644 --- a/cmake/Configure.cmake +++ b/cmake/Configure.cmake @@ -118,7 +118,6 @@ file(APPEND ${AUTOCONFIG_SRC} " /* Version number */ #cmakedefine PACKAGE_VERSION \"${PACKAGE_VERSION}\" #cmakedefine GRAPHICS_DISABLED ${GRAPHICS_DISABLED} -#cmakedefine EMBEDDED ${EMBEDDED} #cmakedefine DISABLED_LEGACY_ENGINE ${DISABLED_LEGACY_ENGINE} #cmakedefine HAVE_LIBARCHIVE ${HAVE_LIBARCHIVE} ") diff --git a/configure.ac b/configure.ac index 7e0ad866..e84abd43 100644 --- a/configure.ac +++ b/configure.ac @@ -165,16 +165,6 @@ AC_ARG_ENABLE([legacy], AC_MSG_RESULT([$enable_legacy]) AM_CONDITIONAL([DISABLED_LEGACY_ENGINE], test "$enable_legacy" = "no") -# check whether to build embedded version -AC_MSG_CHECKING([--enable-embedded argument]) -AC_ARG_ENABLE([embedded], - AS_HELP_STRING([--enable-embedded], [enable embedded build [default=no]])) -AC_MSG_RESULT([$enable_embedded]) -AM_CONDITIONAL([EMBEDDED], [test "$enable_embedded" = "yes"]) -if test "$enable_embedded" = "yes"; then - AM_CPPFLAGS="-DEMBEDDED $AM_CPPFLAGS" -fi - # check whether to build OpenMP support AC_OPENMP diff --git a/src/ccutil/scanutils.cpp b/src/ccutil/scanutils.cpp index d1cd1e5d..da0c6918 100644 --- a/src/ccutil/scanutils.cpp +++ b/src/ccutil/scanutils.cpp @@ -2,13 +2,6 @@ // All Rights Reserved. // Author: renn // -// The fscanf, vfscanf and creat functions are implemented so that their -// functionality is mostly like their stdio counterparts. However, currently -// these functions do not use any buffering, making them rather slow. -// File streams are thus processed one character at a time. -// Although the implementations of the scanf functions do lack a few minor -// features, they should be sufficient for their use in tesseract. -// // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -24,16 +17,14 @@ #endif #include +#include // for CHAR_BIT #include #include #include -#include -#include +#include #include -#include -#include -#include -#include +#include +#include // for std::numeric_limits #include "scanutils.h" @@ -198,31 +189,6 @@ int tfscanf(FILE* stream, const char *format, ...) { return rv; } -#ifdef EMBEDDED - -int fscanf(FILE* stream, const char *format, ...) { - va_list ap; - int rv; - - va_start(ap, format); - rv = tvfscanf(stream, format, ap); - va_end(ap); - - return rv; -} - -int vfscanf(FILE* stream, const char *format, ...) { - va_list ap; - int rv; - - va_start(ap, format); - rv = tvfscanf(stream, format, ap); - va_end(ap); - - return rv; -} -#endif - static int tvfscanf(FILE* stream, const char *format, va_list ap) { const char *p = format; char ch; @@ -535,10 +501,3 @@ static int tvfscanf(FILE* stream, const char *format, va_list ap) { return converted; } - -#ifdef EMBEDDED -int creat(const char *pathname, mode_t mode) { - return open(pathname, O_CREAT | O_TRUNC | O_WRONLY, mode); -} - -#endif // EMBEDDED diff --git a/src/ccutil/scanutils.h b/src/ccutil/scanutils.h index a3f6307b..93381c5d 100644 --- a/src/ccutil/scanutils.h +++ b/src/ccutil/scanutils.h @@ -2,10 +2,6 @@ // All Rights Reserved. // Author: renn // -// Contains file io functions (mainly for file parsing), that might not be -// available, on embedded devices, or that have an incomplete implementation -// there. -// // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -19,10 +15,7 @@ #ifndef TESSERACT_CCUTIL_SCANUTILS_H_ #define TESSERACT_CCUTIL_SCANUTILS_H_ -#include -#include -#include -#include +#include // for FILE /** * fscanf variant to ensure correct reading regardless of locale. @@ -36,27 +29,4 @@ */ int tfscanf(FILE* stream, const char *format, ...); -#ifdef EMBEDDED - -// Attempts to parse the given file stream s as an integer of the base -// 'base'. Returns the first successfully parsed integer as a uintmax_t, or -// 0, if none was found. -uintmax_t streamtoumax(FILE* s, int base); - -// Parse a file stream according to the given format. See the fscanf manpage -// for more information, as this function attempts to mimic its behavior. -// Note that scientific floating-point notation is not supported. -int fscanf(FILE* stream, const char *format, ...); - -// Parse a file stream according to the given format. See the fscanf manpage -// for more information, as this function attempts to mimic its behavior. -// Note that scientific floating-point notation is not supported. -int vfscanf(FILE* stream, const char *format, va_list ap); - -// Create a file at the specified path. See the creat manpage for more -// information, as this function attempts to mimic its behavior. -int creat(const char *pathname, mode_t mode); - -#endif // EMBEDDED - #endif // TESSERACT_CCUTIL_SCANUTILS_H_