+Remove visibility from protected members of tesseract::TessBaseAPI class by applying TESS_LOCAL macro;

+Make PageIterator & ResultIterator classes visible by applying TESS_API macro;
+Fix api/Makefile.am & training/Makefile.am to allow Parallel Build Trees;
patch from Tom Powers (https://groups.google.com/group/tesseract-dev/msg/9d00579540e44055)

git-svn-id: https://tesseract-ocr.googlecode.com/svn/trunk@701 d0cd1f9f-072b-0410-8dd7-cf729c803f20
This commit is contained in:
zdenop@gmail.com 2012-03-07 22:04:46 +00:00
parent 1455bf5610
commit 2f1c112640
5 changed files with 150 additions and 146 deletions

View File

@ -19,18 +19,18 @@ else
lib_LTLIBRARIES += libtesseract_api.la
libtesseract_api_la_LDFLAGS = -version-info $(GENERIC_LIBRARY_VERSION)
libtesseract_api_la_LIBADD = \
$(top_srcdir)/ccmain/libtesseract_main.la \
$(top_srcdir)/cube/libtesseract_cube.la \
$(top_srcdir)/neural_networks/runtime/libtesseract_neural.la \
$(top_srcdir)/textord/libtesseract_textord.la \
$(top_srcdir)/wordrec/libtesseract_wordrec.la \
$(top_srcdir)/classify/libtesseract_classify.la \
$(top_srcdir)/dict/libtesseract_dict.la \
$(top_srcdir)/ccstruct/libtesseract_ccstruct.la \
$(top_srcdir)/image/libtesseract_image.la \
$(top_srcdir)/cutil/libtesseract_cutil.la \
$(top_srcdir)/viewer/libtesseract_viewer.la \
$(top_srcdir)/ccutil/libtesseract_ccutil.la
../ccmain/libtesseract_main.la \
../cube/libtesseract_cube.la \
../neural_networks/runtime/libtesseract_neural.la \
../textord/libtesseract_textord.la \
../wordrec/libtesseract_wordrec.la \
../classify/libtesseract_classify.la \
../dict/libtesseract_dict.la \
../ccstruct/libtesseract_ccstruct.la \
../image/libtesseract_image.la \
../cutil/libtesseract_cutil.la \
../viewer/libtesseract_viewer.la \
../ccutil/libtesseract_ccutil.la
endif
libtesseract_api_la_CPPFLAGS = $(AM_CPPFLAGS)
if VISIBILITY
@ -46,18 +46,18 @@ libtesseract_la_SOURCES =
nodist_EXTRA_libtesseract_la_SOURCES = dummy.cxx
libtesseract_la_LIBADD = \
libtesseract_api.la \
$(top_srcdir)/ccmain/libtesseract_main.la \
$(top_srcdir)/cube/libtesseract_cube.la \
$(top_srcdir)/neural_networks/runtime/libtesseract_neural.la \
$(top_srcdir)/textord/libtesseract_textord.la \
$(top_srcdir)/wordrec/libtesseract_wordrec.la \
$(top_srcdir)/classify/libtesseract_classify.la \
$(top_srcdir)/dict/libtesseract_dict.la \
$(top_srcdir)/ccstruct/libtesseract_ccstruct.la \
$(top_srcdir)/image/libtesseract_image.la \
$(top_srcdir)/cutil/libtesseract_cutil.la \
$(top_srcdir)/viewer/libtesseract_viewer.la \
$(top_srcdir)/ccutil/libtesseract_ccutil.la
../ccmain/libtesseract_main.la \
../cube/libtesseract_cube.la \
../neural_networks/runtime/libtesseract_neural.la \
../textord/libtesseract_textord.la \
../wordrec/libtesseract_wordrec.la \
../classify/libtesseract_classify.la \
../dict/libtesseract_dict.la \
../ccstruct/libtesseract_ccstruct.la \
../image/libtesseract_image.la \
../cutil/libtesseract_cutil.la \
../viewer/libtesseract_viewer.la \
../ccutil/libtesseract_ccutil.la
libtesseract_la_LDFLAGS += -version-info $(GENERIC_LIBRARY_VERSION)

View File

@ -24,11 +24,14 @@
// To avoid collision with other typenames include the ABSOLUTE MINIMUM
// complexity of includes here. Use forward declarations wherever possible
// and hide includes of complex types in baseapi.cpp.
#include "platform.h"
#include "apitypes.h"
#include "thresholder.h"
#include "unichar.h"
#include "tesscallback.h"
#include "publictypes.h"
#include "pageiterator.h"
#include "resultiterator.h"
template <typename T> class GenericVector;
class PAGE_RES;
@ -69,9 +72,7 @@ class CubeRecoContext;
class Dawg;
class Dict;
class EquationDetect;
class PageIterator;
class LTRResultIterator;
class ResultIterator;
class MutableIterator;
class Tesseract;
class Trie;
@ -643,27 +644,27 @@ class TESS_API TessBaseAPI {
protected:
/** Common code for setting the image. Returns true if Init has been called. */
bool InternalSetImage();
TESS_LOCAL bool InternalSetImage();
/**
* Run the thresholder to make the thresholded image. If pix is not NULL,
* the source is thresholded to pix instead of the internal IMAGE.
*/
virtual void Threshold(Pix** pix);
TESS_LOCAL virtual void Threshold(Pix** pix);
/**
* Find lines from the image making the BLOCK_LIST.
* @return 0 on success.
*/
int FindLines();
TESS_LOCAL int FindLines();
/** Delete the pageres and block list ready for a new page. */
void ClearResults();
TESS_LOCAL void ClearResults();
// Return an LTR Result Iterator -- used only for training, as we really want
// to ignore all BiDi smarts at that point.
// delete once you're done with it.
LTRResultIterator* GetLTRIterator();
TESS_LOCAL LTRResultIterator* GetLTRIterator();
/**
* Return the length of the output text string, as UTF8, assuming
@ -671,7 +672,7 @@ class TESS_API TessBaseAPI {
* and assuming a single character reject marker for each rejected character.
* Also return the number of recognized blobs in blob_count.
*/
int TextLength(int* blob_count);
TESS_LOCAL int TextLength(int* blob_count);
/** @defgroup ocropusAddOns ocropus add-ons */
/* @{ */
@ -680,26 +681,26 @@ class TESS_API TessBaseAPI {
* Adapt to recognize the current image as the given character.
* The image must be preloaded and be just an image of a single character.
*/
void AdaptToCharacter(const char *unichar_repr,
int length,
float baseline,
float xheight,
float descender,
float ascender);
TESS_LOCAL void AdaptToCharacter(const char *unichar_repr,
int length,
float baseline,
float xheight,
float descender,
float ascender);
/** Recognize text doing one pass only, using settings for a given pass. */
PAGE_RES* RecognitionPass1(BLOCK_LIST* block_list);
PAGE_RES* RecognitionPass2(BLOCK_LIST* block_list, PAGE_RES* pass1_result);
TESS_LOCAL PAGE_RES* RecognitionPass1(BLOCK_LIST* block_list);
TESS_LOCAL PAGE_RES* RecognitionPass2(BLOCK_LIST* block_list, PAGE_RES* pass1_result);
//// paragraphs.cpp ////////////////////////////////////////////////////
/** After text is recognized, break each paragraph into blocks. */
void DetectParagraphs(int debug_level);
TESS_LOCAL void DetectParagraphs(int debug_level);
/**
* Extract the OCR results, costs (penalty points for uncertainty),
* and the bounding boxes of the characters.
*/
static int TesseractExtractResult(char** text,
TESS_LOCAL static int TesseractExtractResult(char** text,
int** lengths,
float** costs,
int** x0,
@ -708,7 +709,7 @@ class TESS_API TessBaseAPI {
int** y1,
PAGE_RES* page_res);
const PAGE_RES* GetPageRes() const {
TESS_LOCAL const PAGE_RES* GetPageRes() const {
return page_res_;
};
@ -740,6 +741,7 @@ class TESS_API TessBaseAPI {
int image_width_;
int image_height_;
/* @} */
};
} // namespace tesseract.

View File

@ -22,6 +22,7 @@
#define TESSERACT_CCMAIN_PAGEITERATOR_H__
#include "publictypes.h"
#include "platform.h"
class C_BLOB_IT;
class PBLOB_IT;
@ -45,7 +46,7 @@ class Tesseract;
// See also ResultIterator, derived from PageIterator, which adds in the
// ability to access OCR output with text-specific methods.
class PageIterator {
class TESS_API PageIterator {
public:
// page_res and tesseract come directly from the BaseAPI.
// The rectangle parameters are copied indirectly from the Thresholder,
@ -244,7 +245,7 @@ class PageIterator {
protected:
// Sets up the internal data for iterating the blobs of a new word, then
// moves the iterator to the given offset.
void BeginWord(int offset);
TESS_LOCAL void BeginWord(int offset);
// Pointer to the page_res owned by the API.
PAGE_RES* page_res_;

View File

@ -22,6 +22,7 @@
#ifndef TESSERACT_CCMAIN_RESULT_ITERATOR_H__
#define TESSERACT_CCMAIN_RESULT_ITERATOR_H__
#include "platform.h"
#include "ltrresultiterator.h"
#include "genericvector.h"
@ -33,7 +34,7 @@ namespace tesseract {
class Tesseract;
class ResultIterator : public LTRResultIterator {
class TESS_API ResultIterator : public LTRResultIterator {
public:
static ResultIterator *StartOfParagraph(const LTRResultIterator &resit);
@ -115,7 +116,7 @@ class ResultIterator : public LTRResultIterator {
// NB: This is private because it does something that is non-obvious:
// it resets to the beginning of the paragraph instead of staying wherever
// resit might have pointed.
explicit ResultIterator(const LTRResultIterator &resit);
TESS_LOCAL explicit ResultIterator(const LTRResultIterator &resit);
private:
// Calculates the current paragraph's dominant writing direction.

View File

@ -10,7 +10,7 @@ AM_CPPFLAGS = \
# TODO: training programs can not be linked to shared library created
# with -fvisibility
if VISIBILITY
# AM_LDFLAGS = -all-static
AM_LDFLAGS = -all-static
endif
noinst_HEADERS = \
@ -33,22 +33,22 @@ ambiguous_words_LDADD = \
libtesseract_tessopt.la
if USING_MULTIPLELIBS
ambiguous_words_LDADD += \
$(top_srcdir)/api/libtesseract_api.la \
$(top_srcdir)/textord/libtesseract_textord.la \
$(top_srcdir)/classify/libtesseract_classify.la \
$(top_srcdir)/dict/libtesseract_dict.la \
$(top_srcdir)/ccstruct/libtesseract_ccstruct.la \
$(top_srcdir)/image/libtesseract_image.la \
$(top_srcdir)/cutil/libtesseract_cutil.la \
$(top_srcdir)/viewer/libtesseract_viewer.la \
$(top_srcdir)/ccmain/libtesseract_main.la \
$(top_srcdir)/cube/libtesseract_cube.la \
$(top_srcdir)/neural_networks/runtime/libtesseract_neural.la \
$(top_srcdir)/wordrec/libtesseract_wordrec.la \
$(top_srcdir)/ccutil/libtesseract_ccutil.la
../api/libtesseract_api.la \
../textord/libtesseract_textord.la \
../classify/libtesseract_classify.la \
../dict/libtesseract_dict.la \
../ccstruct/libtesseract_ccstruct.la \
../image/libtesseract_image.la \
../cutil/libtesseract_cutil.la \
../viewer/libtesseract_viewer.la \
../ccmain/libtesseract_main.la \
../cube/libtesseract_cube.la \
../neural_networks/runtime/libtesseract_neural.la \
../wordrec/libtesseract_wordrec.la \
../ccutil/libtesseract_ccutil.la
else
ambiguous_words_LDADD += \
$(top_srcdir)/api/libtesseract.la
../api/libtesseract.la
endif
classifier_tester_SOURCES = classifier_tester.cpp
@ -58,32 +58,32 @@ classifier_tester_LDADD = \
libtesseract_tessopt.la
if USING_MULTIPLELIBS
classifier_tester_LDADD += \
$(top_srcdir)/api/libtesseract_api.la \
$(top_srcdir)/textord/libtesseract_textord.la \
$(top_srcdir)/classify/libtesseract_classify.la \
$(top_srcdir)/dict/libtesseract_dict.la \
$(top_srcdir)/ccstruct/libtesseract_ccstruct.la \
$(top_srcdir)/image/libtesseract_image.la \
$(top_srcdir)/cutil/libtesseract_cutil.la \
$(top_srcdir)/viewer/libtesseract_viewer.la \
$(top_srcdir)/ccmain/libtesseract_main.la \
$(top_srcdir)/cube/libtesseract_cube.la \
$(top_srcdir)/neural_networks/runtime/libtesseract_neural.la \
$(top_srcdir)/wordrec/libtesseract_wordrec.la \
$(top_srcdir)/ccutil/libtesseract_ccutil.la
../api/libtesseract_api.la \
../textord/libtesseract_textord.la \
../classify/libtesseract_classify.la \
../dict/libtesseract_dict.la \
../ccstruct/libtesseract_ccstruct.la \
../image/libtesseract_image.la \
../cutil/libtesseract_cutil.la \
../viewer/libtesseract_viewer.la \
../ccmain/libtesseract_main.la \
../cube/libtesseract_cube.la \
../neural_networks/runtime/libtesseract_neural.la \
../wordrec/libtesseract_wordrec.la \
../ccutil/libtesseract_ccutil.la
else
classifier_tester_LDADD += \
$(top_srcdir)/api/libtesseract.la
../api/libtesseract.la
endif
combine_tessdata_SOURCES = combine_tessdata.cpp
#combine_tessdata_LDFLAGS = -static
if USING_MULTIPLELIBS
combine_tessdata_LDADD = \
$(top_srcdir)/ccutil/libtesseract_ccutil.la
../ccutil/libtesseract_ccutil.la
else
combine_tessdata_LDADD = \
$(top_srcdir)/api/libtesseract.la
../api/libtesseract.la
endif
cntraining_SOURCES = cntraining.cpp
@ -93,21 +93,21 @@ cntraining_LDADD = \
libtesseract_tessopt.la
if USING_MULTIPLELIBS
cntraining_LDADD += \
$(top_srcdir)/textord/libtesseract_textord.la \
$(top_srcdir)/classify/libtesseract_classify.la \
$(top_srcdir)/dict/libtesseract_dict.la \
$(top_srcdir)/ccstruct/libtesseract_ccstruct.la \
$(top_srcdir)/image/libtesseract_image.la \
$(top_srcdir)/cutil/libtesseract_cutil.la \
$(top_srcdir)/viewer/libtesseract_viewer.la \
$(top_srcdir)/ccmain/libtesseract_main.la \
$(top_srcdir)/cube/libtesseract_cube.la \
$(top_srcdir)/neural_networks/runtime/libtesseract_neural.la \
$(top_srcdir)/wordrec/libtesseract_wordrec.la \
$(top_srcdir)/ccutil/libtesseract_ccutil.la
../textord/libtesseract_textord.la \
../classify/libtesseract_classify.la \
../dict/libtesseract_dict.la \
../ccstruct/libtesseract_ccstruct.la \
../image/libtesseract_image.la \
../cutil/libtesseract_cutil.la \
../viewer/libtesseract_viewer.la \
../ccmain/libtesseract_main.la \
../cube/libtesseract_cube.la \
../neural_networks/runtime/libtesseract_neural.la \
../wordrec/libtesseract_wordrec.la \
../ccutil/libtesseract_ccutil.la
else
cntraining_LDADD += \
$(top_srcdir)/api/libtesseract.la
../api/libtesseract.la
endif
dawg2wordlist_SOURCES = dawg2wordlist.cpp
@ -116,21 +116,21 @@ dawg2wordlist_LDADD = \
libtesseract_tessopt.la
if USING_MULTIPLELIBS
dawg2wordlist_LDADD += \
$(top_srcdir)/classify/libtesseract_classify.la \
$(top_srcdir)/dict/libtesseract_dict.la \
$(top_srcdir)/ccstruct/libtesseract_ccstruct.la \
$(top_srcdir)/image/libtesseract_image.la \
$(top_srcdir)/cutil/libtesseract_cutil.la \
$(top_srcdir)/viewer/libtesseract_viewer.la \
$(top_srcdir)/ccmain/libtesseract_main.la \
$(top_srcdir)/cube/libtesseract_cube.la \
$(top_srcdir)/neural_networks/runtime/libtesseract_neural.la \
$(top_srcdir)/wordrec/libtesseract_wordrec.la \
$(top_srcdir)/textord/libtesseract_textord.la \
$(top_srcdir)/ccutil/libtesseract_ccutil.la
../classify/libtesseract_classify.la \
../dict/libtesseract_dict.la \
../ccstruct/libtesseract_ccstruct.la \
../image/libtesseract_image.la \
../cutil/libtesseract_cutil.la \
../viewer/libtesseract_viewer.la \
../ccmain/libtesseract_main.la \
../cube/libtesseract_cube.la \
../neural_networks/runtime/libtesseract_neural.la \
../wordrec/libtesseract_wordrec.la \
../textord/libtesseract_textord.la \
../ccutil/libtesseract_ccutil.la
else
dawg2wordlist_LDADD += \
$(top_srcdir)/api/libtesseract.la
../api/libtesseract.la
endif
mftraining_SOURCES = mftraining.cpp mergenf.cpp
@ -140,21 +140,21 @@ mftraining_LDADD = \
libtesseract_tessopt.la
if USING_MULTIPLELIBS
mftraining_LDADD += \
$(top_srcdir)/textord/libtesseract_textord.la \
$(top_srcdir)/classify/libtesseract_classify.la \
$(top_srcdir)/dict/libtesseract_dict.la \
$(top_srcdir)/ccstruct/libtesseract_ccstruct.la \
$(top_srcdir)/image/libtesseract_image.la \
$(top_srcdir)/cutil/libtesseract_cutil.la \
$(top_srcdir)/viewer/libtesseract_viewer.la \
$(top_srcdir)/ccmain/libtesseract_main.la \
$(top_srcdir)/cube/libtesseract_cube.la \
$(top_srcdir)/neural_networks/runtime/libtesseract_neural.la \
$(top_srcdir)/wordrec/libtesseract_wordrec.la \
$(top_srcdir)/ccutil/libtesseract_ccutil.la
../textord/libtesseract_textord.la \
../classify/libtesseract_classify.la \
../dict/libtesseract_dict.la \
../ccstruct/libtesseract_ccstruct.la \
../image/libtesseract_image.la \
../cutil/libtesseract_cutil.la \
../viewer/libtesseract_viewer.la \
../ccmain/libtesseract_main.la \
../cube/libtesseract_cube.la \
../neural_networks/runtime/libtesseract_neural.la \
../wordrec/libtesseract_wordrec.la \
../ccutil/libtesseract_ccutil.la
else
mftraining_LDADD += \
$(top_srcdir)/api/libtesseract.la
../api/libtesseract.la
endif
shapeclustering_SOURCES = shapeclustering.cpp
@ -164,21 +164,21 @@ shapeclustering_LDADD = \
libtesseract_tessopt.la
if USING_MULTIPLELIBS
shapeclustering_LDADD += \
$(top_srcdir)/textord/libtesseract_textord.la \
$(top_srcdir)/classify/libtesseract_classify.la \
$(top_srcdir)/dict/libtesseract_dict.la \
$(top_srcdir)/ccstruct/libtesseract_ccstruct.la \
$(top_srcdir)/image/libtesseract_image.la \
$(top_srcdir)/cutil/libtesseract_cutil.la \
$(top_srcdir)/viewer/libtesseract_viewer.la \
$(top_srcdir)/ccmain/libtesseract_main.la \
$(top_srcdir)/cube/libtesseract_cube.la \
$(top_srcdir)/neural_networks/runtime/libtesseract_neural.la \
$(top_srcdir)/wordrec/libtesseract_wordrec.la \
$(top_srcdir)/ccutil/libtesseract_ccutil.la
../textord/libtesseract_textord.la \
../classify/libtesseract_classify.la \
../dict/libtesseract_dict.la \
../ccstruct/libtesseract_ccstruct.la \
../image/libtesseract_image.la \
../cutil/libtesseract_cutil.la \
../viewer/libtesseract_viewer.la \
../ccmain/libtesseract_main.la \
../cube/libtesseract_cube.la \
../neural_networks/runtime/libtesseract_neural.la \
../wordrec/libtesseract_wordrec.la \
../ccutil/libtesseract_ccutil.la
else
shapeclustering_LDADD += \
$(top_srcdir)/api/libtesseract.la
../api/libtesseract.la
endif
unicharset_extractor_SOURCES = unicharset_extractor.cpp
@ -187,11 +187,11 @@ unicharset_extractor_LDADD = \
libtesseract_tessopt.la
if USING_MULTIPLELIBS
unicharset_extractor_LDADD += \
$(top_srcdir)/ccutil/libtesseract_ccutil.la \
$(top_srcdir)/ccstruct/libtesseract_ccstruct.la
../ccutil/libtesseract_ccutil.la \
../ccstruct/libtesseract_ccstruct.la
else
unicharset_extractor_LDADD += \
$(top_srcdir)/api/libtesseract.la
../api/libtesseract.la
endif
wordlist2dawg_SOURCES = wordlist2dawg.cpp
@ -200,19 +200,19 @@ wordlist2dawg_LDADD = \
libtesseract_tessopt.la
if USING_MULTIPLELIBS
wordlist2dawg_LDADD += \
$(top_srcdir)/classify/libtesseract_classify.la \
$(top_srcdir)/dict/libtesseract_dict.la \
$(top_srcdir)/ccstruct/libtesseract_ccstruct.la \
$(top_srcdir)/image/libtesseract_image.la \
$(top_srcdir)/cutil/libtesseract_cutil.la \
$(top_srcdir)/viewer/libtesseract_viewer.la \
$(top_srcdir)/ccmain/libtesseract_main.la \
$(top_srcdir)/cube/libtesseract_cube.la \
$(top_srcdir)/neural_networks/runtime/libtesseract_neural.la \
$(top_srcdir)/wordrec/libtesseract_wordrec.la \
$(top_srcdir)/textord/libtesseract_textord.la \
$(top_srcdir)/ccutil/libtesseract_ccutil.la
../classify/libtesseract_classify.la \
../dict/libtesseract_dict.la \
../ccstruct/libtesseract_ccstruct.la \
../image/libtesseract_image.la \
../cutil/libtesseract_cutil.la \
../viewer/libtesseract_viewer.la \
../ccmain/libtesseract_main.la \
../cube/libtesseract_cube.la \
../neural_networks/runtime/libtesseract_neural.la \
../wordrec/libtesseract_wordrec.la \
../textord/libtesseract_textord.la \
../ccutil/libtesseract_ccutil.la
else
wordlist2dawg_LDADD += \
$(top_srcdir)/api/libtesseract.la
../api/libtesseract.la
endif