build and build_library working correctly

This commit is contained in:
Diptanshu8 2017-07-06 17:39:17 +00:00
parent 976f01cee1
commit 2ced408994
7 changed files with 331 additions and 16 deletions

View File

@ -8,4 +8,5 @@ for i in sys.argv[1:]:
cc.api_add_param(s,str(i))
compile_ret = cc.compile_params(s,len(sys.argv[1:]));
start_ret = cc.api_start(s);
#os.system('clear')

View File

@ -1,6 +1,7 @@
#!/bin/bash
BLD_FLAGS="-std=gnu99 -Wno-write-strings -DGPAC_CONFIG_LINUX -D_FILE_OFFSET_BITS=64 -DVERSION_FILE_PRESENT -DENABLE_OCR"
BLD_INCLUDE="-I /usr/include/python2.7/ -I../src -I /usr/include/leptonica/ -I /usr/include/tesseract/ -I../src/lib_ccx/ -I../src/gpacmp4/ -I../src/libpng/ -I../src/zlib/ -I../src/zvbi -I../src/lib_hash -I../src/protobuf-c -I../src/utf8proc"
WRAPPER_FLAGS="-Wl,-wrap,write"
SRC_LIBPNG="$(find ../src/libpng/ -name '*.c')"
SRC_ZLIB="$(find ../src/zlib/ -name '*.c')"
SRC_ZVBI="$(find ../src/zvbi/ -name '*.c')"
@ -13,7 +14,8 @@ BLD_SOURCES="../src/ccextractor.c ccextractor_wrap.c $SRC_CCX $SRC_GPAC $SRC_ZLI
./pre-build.sh
out=$((LC_ALL=C gcc -fPIC -c $BLD_INCLUDE $BLD_SOURCES) 2>&1)
#out=$((LC_ALL=C gcc $BLD_FLAGS $BLD_INCLUDE $WRAPPER_FLAGS -o ccextractor $BLD_SOURCES $BLD_LINKER)2>&1)
out=$((LC_ALL=C gcc -fPIC -c -Wl,-wrap,write $BLD_INCLUDE $BLD_SOURCES) 2>&1)
res=$?
if [[ $out == *"gcc: command not found"* ]]
then

View File

@ -1,7 +1,8 @@
#!/bin/bash
BLD_LINKER="-lm -zmuldefs -l tesseract -l lept -l python2.7"
WRAPPER_FLAGS="-Wl,-wrap,write"
out=$((swig -python ccextractor.i && ./build_api && gcc -shared $(find -name '*.o') -o _ccextractor.so ) 2>&1)
out=$((swig -python ccextractor.i && ./build_api && gcc -shared $WRAPPER_FLAGS $(find -name '*.o') -o _ccextractor.so ) 2>&1)
res=$?
if [[ $out == *"gcc: command not found"* ]]
then

View File

@ -145,6 +145,33 @@ debug_608_to_ASC = _ccextractor.debug_608_to_ASC
def add_cc_sub_text(sub, str, start_time, end_time, info, mode, arg7):
return _ccextractor.add_cc_sub_text(sub, str, start_time, end_time, info, mode, arg7)
add_cc_sub_text = _ccextractor.add_cc_sub_text
class cc_to_python_subs(_object):
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, cc_to_python_subs, name, value)
__swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, cc_to_python_subs, name)
__repr__ = _swig_repr
__swig_setmethods__["subs"] = _ccextractor.cc_to_python_subs_subs_set
__swig_getmethods__["subs"] = _ccextractor.cc_to_python_subs_subs_get
if _newclass:
subs = _swig_property(_ccextractor.cc_to_python_subs_subs_get, _ccextractor.cc_to_python_subs_subs_set)
__swig_setmethods__["number_of_lines"] = _ccextractor.cc_to_python_subs_number_of_lines_set
__swig_getmethods__["number_of_lines"] = _ccextractor.cc_to_python_subs_number_of_lines_get
if _newclass:
number_of_lines = _swig_property(_ccextractor.cc_to_python_subs_number_of_lines_get, _ccextractor.cc_to_python_subs_number_of_lines_set)
def __init__(self):
this = _ccextractor.new_cc_to_python_subs()
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
__swig_destroy__ = _ccextractor.delete_cc_to_python_subs
__del__ = lambda self: None
cc_to_python_subs_swigregister = _ccextractor.cc_to_python_subs_swigregister
cc_to_python_subs_swigregister(cc_to_python_subs)
cvar = _ccextractor.cvar
def api_init_options():
return _ccextractor.api_init_options()
@ -189,7 +216,14 @@ print_end_msg = _ccextractor.print_end_msg
def main(argc, argv):
return _ccextractor.main(argc, argv)
main = _ccextractor.main
def __real_write(file_handle, buffer, nbyte):
return _ccextractor.__real_write(file_handle, buffer, nbyte)
__real_write = _ccextractor.__real_write
def __wrap_write(file_handle, buffer, nbyte):
return _ccextractor.__wrap_write(file_handle, buffer, nbyte)
__wrap_write = _ccextractor.__wrap_write
# This file is compatible with both classic and new-style classes.
cvar = _ccextractor.cvar

View File

@ -2981,15 +2981,16 @@ SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) {
#define SWIGTYPE_p_LLONG swig_types[0]
#define SWIGTYPE_p_cc_subtitle swig_types[1]
#define SWIGTYPE_p_ccx_s_options swig_types[2]
#define SWIGTYPE_p_char swig_types[3]
#define SWIGTYPE_p_int swig_types[4]
#define SWIGTYPE_p_lib_ccx_ctx swig_types[5]
#define SWIGTYPE_p_p_char swig_types[6]
#define SWIGTYPE_p_unsigned_char swig_types[7]
#define SWIGTYPE_p_unsigned_int swig_types[8]
static swig_type_info *swig_types[10];
static swig_module_info swig_module = {swig_types, 9, 0, 0, 0, 0};
#define SWIGTYPE_p_cc_to_python_subs swig_types[2]
#define SWIGTYPE_p_ccx_s_options swig_types[3]
#define SWIGTYPE_p_char swig_types[4]
#define SWIGTYPE_p_int swig_types[5]
#define SWIGTYPE_p_lib_ccx_ctx swig_types[6]
#define SWIGTYPE_p_p_char swig_types[7]
#define SWIGTYPE_p_unsigned_char swig_types[8]
#define SWIGTYPE_p_unsigned_int swig_types[9]
static swig_type_info *swig_types[11];
static swig_module_info swig_module = {swig_types, 10, 0, 0, 0, 0};
#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
@ -3695,6 +3696,151 @@ SWIGINTERN PyObject *Swig_var_cc608_parity_table_get(void) {
}
SWIGINTERN PyObject *_wrap_cc_to_python_subs_subs_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
struct cc_to_python_subs *arg1 = (struct cc_to_python_subs *) 0 ;
char **arg2 = (char **) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
void *argp2 = 0 ;
int res2 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
if (!PyArg_ParseTuple(args,(char *)"OO:cc_to_python_subs_subs_set",&obj0,&obj1)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_cc_to_python_subs, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "cc_to_python_subs_subs_set" "', argument " "1"" of type '" "struct cc_to_python_subs *""'");
}
arg1 = (struct cc_to_python_subs *)(argp1);
res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_p_char, 0 | 0 );
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "cc_to_python_subs_subs_set" "', argument " "2"" of type '" "char **""'");
}
arg2 = (char **)(argp2);
if (arg1) (arg1)->subs = arg2;
resultobj = SWIG_Py_Void();
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_cc_to_python_subs_subs_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
struct cc_to_python_subs *arg1 = (struct cc_to_python_subs *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
PyObject * obj0 = 0 ;
char **result = 0 ;
if (!PyArg_ParseTuple(args,(char *)"O:cc_to_python_subs_subs_get",&obj0)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_cc_to_python_subs, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "cc_to_python_subs_subs_get" "', argument " "1"" of type '" "struct cc_to_python_subs *""'");
}
arg1 = (struct cc_to_python_subs *)(argp1);
result = (char **) ((arg1)->subs);
resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_p_char, 0 | 0 );
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_cc_to_python_subs_number_of_lines_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
struct cc_to_python_subs *arg1 = (struct cc_to_python_subs *) 0 ;
int arg2 ;
void *argp1 = 0 ;
int res1 = 0 ;
int val2 ;
int ecode2 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
if (!PyArg_ParseTuple(args,(char *)"OO:cc_to_python_subs_number_of_lines_set",&obj0,&obj1)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_cc_to_python_subs, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "cc_to_python_subs_number_of_lines_set" "', argument " "1"" of type '" "struct cc_to_python_subs *""'");
}
arg1 = (struct cc_to_python_subs *)(argp1);
ecode2 = SWIG_AsVal_int(obj1, &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "cc_to_python_subs_number_of_lines_set" "', argument " "2"" of type '" "int""'");
}
arg2 = (int)(val2);
if (arg1) (arg1)->number_of_lines = arg2;
resultobj = SWIG_Py_Void();
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_cc_to_python_subs_number_of_lines_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
struct cc_to_python_subs *arg1 = (struct cc_to_python_subs *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
PyObject * obj0 = 0 ;
int result;
if (!PyArg_ParseTuple(args,(char *)"O:cc_to_python_subs_number_of_lines_get",&obj0)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_cc_to_python_subs, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "cc_to_python_subs_number_of_lines_get" "', argument " "1"" of type '" "struct cc_to_python_subs *""'");
}
arg1 = (struct cc_to_python_subs *)(argp1);
result = (int) ((arg1)->number_of_lines);
resultobj = SWIG_From_int((int)(result));
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_new_cc_to_python_subs(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
struct cc_to_python_subs *result = 0 ;
if (!PyArg_ParseTuple(args,(char *)":new_cc_to_python_subs")) SWIG_fail;
result = (struct cc_to_python_subs *)calloc(1, sizeof(struct cc_to_python_subs));
resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_cc_to_python_subs, SWIG_POINTER_NEW | 0 );
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_delete_cc_to_python_subs(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
struct cc_to_python_subs *arg1 = (struct cc_to_python_subs *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
PyObject * obj0 = 0 ;
if (!PyArg_ParseTuple(args,(char *)"O:delete_cc_to_python_subs",&obj0)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_cc_to_python_subs, SWIG_POINTER_DISOWN | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_cc_to_python_subs" "', argument " "1"" of type '" "struct cc_to_python_subs *""'");
}
arg1 = (struct cc_to_python_subs *)(argp1);
free((char *) arg1);
resultobj = SWIG_Py_Void();
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *cc_to_python_subs_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *obj;
if (!PyArg_ParseTuple(args,(char *)"O:swigregister", &obj)) return NULL;
SWIG_TypeNewClientData(SWIGTYPE_p_cc_to_python_subs, SWIG_NewClientData(obj));
return SWIG_Py_Void();
}
SWIGINTERN int Swig_var_ccx_options_set(PyObject *_val) {
{
void *argp = 0;
@ -3745,6 +3891,33 @@ SWIGINTERN PyObject *Swig_var_signal_ctx_get(void) {
}
SWIGINTERN int Swig_var_python_subs_set(PyObject *_val) {
{
void *argp = 0;
int res = SWIG_ConvertPtr(_val, &argp, SWIGTYPE_p_cc_to_python_subs, 0 );
if (!SWIG_IsOK(res)) {
SWIG_exception_fail(SWIG_ArgError(res), "in variable '""python_subs""' of type '""struct cc_to_python_subs""'");
}
if (!argp) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in variable '""python_subs""' of type '""struct cc_to_python_subs""'");
} else {
python_subs = *((struct cc_to_python_subs *)(argp));
}
}
return 0;
fail:
return 1;
}
SWIGINTERN PyObject *Swig_var_python_subs_get(void) {
PyObject *pyobj = 0;
pyobj = SWIG_NewPointerObj(SWIG_as_voidptr(&python_subs), SWIGTYPE_p_cc_to_python_subs, 0 );
return pyobj;
}
SWIGINTERN PyObject *_wrap_api_init_options(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
struct ccx_s_options *result = 0 ;
@ -4015,6 +4188,92 @@ fail:
}
SWIGINTERN PyObject *_wrap___real_write(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
int arg1 ;
char *arg2 = (char *) 0 ;
int arg3 ;
int val1 ;
int ecode1 = 0 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
int val3 ;
int ecode3 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
PyObject * obj2 = 0 ;
int result;
if (!PyArg_ParseTuple(args,(char *)"OOO:__real_write",&obj0,&obj1,&obj2)) SWIG_fail;
ecode1 = SWIG_AsVal_int(obj0, &val1);
if (!SWIG_IsOK(ecode1)) {
SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "__real_write" "', argument " "1"" of type '" "int""'");
}
arg1 = (int)(val1);
res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "__real_write" "', argument " "2"" of type '" "char *""'");
}
arg2 = (char *)(buf2);
ecode3 = SWIG_AsVal_int(obj2, &val3);
if (!SWIG_IsOK(ecode3)) {
SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "__real_write" "', argument " "3"" of type '" "int""'");
}
arg3 = (int)(val3);
result = (int)__real_write(arg1,arg2,arg3);
resultobj = SWIG_From_int((int)(result));
if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
return resultobj;
fail:
if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
return NULL;
}
SWIGINTERN PyObject *_wrap___wrap_write(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
int arg1 ;
char *arg2 = (char *) 0 ;
int arg3 ;
int val1 ;
int ecode1 = 0 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
int val3 ;
int ecode3 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
PyObject * obj2 = 0 ;
int result;
if (!PyArg_ParseTuple(args,(char *)"OOO:__wrap_write",&obj0,&obj1,&obj2)) SWIG_fail;
ecode1 = SWIG_AsVal_int(obj0, &val1);
if (!SWIG_IsOK(ecode1)) {
SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "__wrap_write" "', argument " "1"" of type '" "int""'");
}
arg1 = (int)(val1);
res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "__wrap_write" "', argument " "2"" of type '" "char *""'");
}
arg2 = (char *)(buf2);
ecode3 = SWIG_AsVal_int(obj2, &val3);
if (!SWIG_IsOK(ecode3)) {
SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "__wrap_write" "', argument " "3"" of type '" "int""'");
}
arg3 = (int)(val3);
result = (int)__wrap_write(arg1,arg2,arg3);
resultobj = SWIG_From_int((int)(result));
if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
return resultobj;
fail:
if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
return NULL;
}
static PyMethodDef SwigMethods[] = {
{ (char *)"SWIG_PyInstanceMethod_New", (PyCFunction)SWIG_PyInstanceMethod_New, METH_O, NULL},
{ (char *)"fdprintf", _wrap_fdprintf, METH_VARARGS, NULL},
@ -4023,6 +4282,13 @@ static PyMethodDef SwigMethods[] = {
{ (char *)"dbg_print", _wrap_dbg_print, METH_VARARGS, NULL},
{ (char *)"debug_608_to_ASC", _wrap_debug_608_to_ASC, METH_VARARGS, NULL},
{ (char *)"add_cc_sub_text", _wrap_add_cc_sub_text, METH_VARARGS, NULL},
{ (char *)"cc_to_python_subs_subs_set", _wrap_cc_to_python_subs_subs_set, METH_VARARGS, NULL},
{ (char *)"cc_to_python_subs_subs_get", _wrap_cc_to_python_subs_subs_get, METH_VARARGS, NULL},
{ (char *)"cc_to_python_subs_number_of_lines_set", _wrap_cc_to_python_subs_number_of_lines_set, METH_VARARGS, NULL},
{ (char *)"cc_to_python_subs_number_of_lines_get", _wrap_cc_to_python_subs_number_of_lines_get, METH_VARARGS, NULL},
{ (char *)"new_cc_to_python_subs", _wrap_new_cc_to_python_subs, METH_VARARGS, NULL},
{ (char *)"delete_cc_to_python_subs", _wrap_delete_cc_to_python_subs, METH_VARARGS, NULL},
{ (char *)"cc_to_python_subs_swigregister", cc_to_python_subs_swigregister, METH_VARARGS, NULL},
{ (char *)"api_init_options", _wrap_api_init_options, METH_VARARGS, NULL},
{ (char *)"check_configuration_file", _wrap_check_configuration_file, METH_VARARGS, NULL},
{ (char *)"compile_params", _wrap_compile_params, METH_VARARGS, NULL},
@ -4034,6 +4300,8 @@ static PyMethodDef SwigMethods[] = {
{ (char *)"sigint_handler", _wrap_sigint_handler, METH_VARARGS, NULL},
{ (char *)"print_end_msg", _wrap_print_end_msg, METH_VARARGS, NULL},
{ (char *)"main", _wrap_main, METH_VARARGS, NULL},
{ (char *)"__real_write", _wrap___real_write, METH_VARARGS, NULL},
{ (char *)"__wrap_write", _wrap___wrap_write, METH_VARARGS, NULL},
{ NULL, NULL, 0, NULL }
};
@ -4042,6 +4310,7 @@ static PyMethodDef SwigMethods[] = {
static swig_type_info _swigt__p_LLONG = {"_p_LLONG", "LLONG *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_cc_subtitle = {"_p_cc_subtitle", "struct cc_subtitle *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_cc_to_python_subs = {"_p_cc_to_python_subs", "struct cc_to_python_subs *|cc_to_python_subs *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_ccx_s_options = {"_p_ccx_s_options", "struct ccx_s_options *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_int = {"_p_int", "int *", 0, 0, (void*)0, 0};
@ -4053,6 +4322,7 @@ static swig_type_info _swigt__p_unsigned_int = {"_p_unsigned_int", "unsigned int
static swig_type_info *swig_type_initial[] = {
&_swigt__p_LLONG,
&_swigt__p_cc_subtitle,
&_swigt__p_cc_to_python_subs,
&_swigt__p_ccx_s_options,
&_swigt__p_char,
&_swigt__p_int,
@ -4064,6 +4334,7 @@ static swig_type_info *swig_type_initial[] = {
static swig_cast_info _swigc__p_LLONG[] = { {&_swigt__p_LLONG, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_cc_subtitle[] = { {&_swigt__p_cc_subtitle, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_cc_to_python_subs[] = { {&_swigt__p_cc_to_python_subs, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_ccx_s_options[] = { {&_swigt__p_ccx_s_options, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_int[] = { {&_swigt__p_int, 0, 0, 0},{0, 0, 0, 0}};
@ -4075,6 +4346,7 @@ static swig_cast_info _swigc__p_unsigned_int[] = { {&_swigt__p_unsigned_int, 0,
static swig_cast_info *swig_cast_initial[] = {
_swigc__p_LLONG,
_swigc__p_cc_subtitle,
_swigc__p_cc_to_python_subs,
_swigc__p_ccx_s_options,
_swigc__p_char,
_swigc__p_int,
@ -4802,6 +5074,7 @@ SWIG_init(void) {
SWIG_addvarlink(SWIG_globals(),(char *)"cc608_parity_table",Swig_var_cc608_parity_table_get, Swig_var_cc608_parity_table_set);
SWIG_addvarlink(SWIG_globals(),(char *)"ccx_options",Swig_var_ccx_options_get, Swig_var_ccx_options_set);
SWIG_addvarlink(SWIG_globals(),(char *)"signal_ctx",Swig_var_signal_ctx_get, Swig_var_signal_ctx_set);
SWIG_addvarlink(SWIG_globals(),(char *)"python_subs",Swig_var_python_subs_get, Swig_var_python_subs_set);
#if PY_VERSION_HEX >= 0x03000000
return m;
#else

View File

@ -1,6 +1,7 @@
#!/bin/bash
BLD_FLAGS="-std=gnu99 -Wno-write-strings -DGPAC_CONFIG_LINUX -D_FILE_OFFSET_BITS=64 -DVERSION_FILE_PRESENT -DENABLE_OCR"
BLD_INCLUDE="-I../src -I /usr/include/leptonica/ -I /usr/include/tesseract/ -I../src/lib_ccx/ -I../src/gpacmp4/ -I../src/libpng/ -I../src/zlib/ -I../src/zvbi -I../src/lib_hash -I../src/protobuf-c -I../src/utf8proc"
WRAPPER_FLAGS="-Wl,-wrap,write"
SRC_LIBPNG="$(find ../src/libpng/ -name '*.c')"
SRC_ZLIB="$(find ../src/zlib/ -name '*.c')"
SRC_ZVBI="$(find ../src/zvbi/ -name '*.c')"
@ -14,7 +15,7 @@ BLD_LINKER="-lm -zmuldefs -l tesseract -l lept"
./pre-build.sh
out=$((LC_ALL=C gcc $BLD_FLAGS $BLD_INCLUDE -o ccextractor $BLD_SOURCES $BLD_LINKER) 2>&1)
out=$((LC_ALL=C gcc $BLD_FLAGS $BLD_INCLUDE $WRAPPER_FLAGS -o ccextractor $BLD_SOURCES $BLD_LINKER)2>&1)
res=$?
if [[ $out == *"gcc: command not found"* ]]
then

View File

@ -475,7 +475,6 @@ int api_param_count(struct ccx_s_options* api_options){
return api_options->python_param_count;
}
int __real_write(int file_handle, char* buffer, int nbyte);
int __wrap_write(int file_handle, char* buffer, int nbyte)
{
@ -489,8 +488,11 @@ int __wrap_write(int file_handle, char* buffer, int nbyte)
python_subs.subs[python_subs.number_of_lines-1] = malloc(nbyte*sizeof(char)+1);
strcpy(python_subs.subs[python_subs.number_of_lines-1],buffer);
//printf("%d\t%s\t%s\n",python_subs.number_of_lines,python_subs.subs[python_subs.number_of_lines-1],buffer);
return __real_write(file_handle,buffer,nbyte);
}
int main(int argc, char* argv[]){
int i;
struct ccx_s_options* api_options = api_init_options();
@ -500,8 +502,9 @@ int main(int argc, char* argv[]){
int compile_ret = compile_params(api_options,argc);
int start_ret = api_start(*api_options);
printf("Printing python subs \n \n");
for(i=0;i<python_subs.number_of_lines;i++)
printf("%s\n",python_subs.subs[i]);
//for(i=0;i<python_subs.number_of_lines;i++)
// printf("%s\n",python_subs.subs[i]);
return start_ret;
}