Skip to content

Commit

Permalink
Merge pull request #2499 from stweil/embedded
Browse files Browse the repository at this point in the history
Remove code for embedded build
  • Loading branch information
zdenop authored Jun 17, 2019
2 parents 60aee9f + 674d6a9 commit a3593d9
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 89 deletions.
2 changes: 0 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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}")
Expand Down
1 change: 0 additions & 1 deletion cmake/Configure.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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}
")
Expand Down
10 changes: 0 additions & 10 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
49 changes: 4 additions & 45 deletions src/ccutil/scanutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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
32 changes: 1 addition & 31 deletions src/ccutil/scanutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand All @@ -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_

0 comments on commit a3593d9

Please sign in to comment.