Browse Source

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>
Stefan Weil 1 year ago
parent
commit
674d6a90d8
5 changed files with 5 additions and 89 deletions
  1. 0
    2
      CMakeLists.txt
  2. 0
    1
      cmake/Configure.cmake
  3. 0
    10
      configure.ac
  4. 4
    45
      src/ccutil/scanutils.cpp
  5. 1
    31
      src/ccutil/scanutils.h

+ 0
- 2
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}")

+ 0
- 1
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}
 ")

+ 0
- 10
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
 

+ 4
- 45
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 <cctype>
+#include <climits>      // for CHAR_BIT
 #include <cmath>
 #include <cstdarg>
 #include <cstddef>
-#include <cstring>
-#include <climits>
+#include <cstdint>
 #include <cstdio>
-#include <limits>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
+#include <cstring>
+#include <limits>       // 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

+ 1
- 31
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 <cstdint>
-#include <cstddef>
-#include <cstdio>
-#include <sys/stat.h>
+#include <cstdio>       // 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_