diff --git a/api/api_testing.py b/api/api_testing.py index 1e4b00a2..b98628d3 100644 --- a/api/api_testing.py +++ b/api/api_testing.py @@ -8,5 +8,9 @@ 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); +print cc.cvar.python_subs.number_of_lines +print type(cc.cvar.python_subs.subs) +#for item in xrange(cc.cc_to_python_get_subs_number_of_lines()): +# print cc.cc_to_python_get_sub[item] #os.system('clear') diff --git a/api/ccextractor.py b/api/ccextractor.py index 56ac29a8..1025733a 100644 --- a/api/ccextractor.py +++ b/api/ccextractor.py @@ -217,6 +217,14 @@ def main(argc, argv): return _ccextractor.main(argc, argv) main = _ccextractor.main +def cc_to_python_get_subs_number_of_lines(): + return _ccextractor.cc_to_python_get_subs_number_of_lines() +cc_to_python_get_subs_number_of_lines = _ccextractor.cc_to_python_get_subs_number_of_lines + +def cc_to_python_get_sub(i): + return _ccextractor.cc_to_python_get_sub(i) +cc_to_python_get_sub = _ccextractor.cc_to_python_get_sub + def __real_write(file_handle, buffer, nbyte): return _ccextractor.__real_write(file_handle, buffer, nbyte) __real_write = _ccextractor.__real_write diff --git a/api/ccextractor_wrap.c b/api/ccextractor_wrap.c index 539ae45f..c085823b 100644 --- a/api/ccextractor_wrap.c +++ b/api/ccextractor_wrap.c @@ -4188,6 +4188,41 @@ fail: } +SWIGINTERN PyObject *_wrap_cc_to_python_get_subs_number_of_lines(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + int result; + + if (!PyArg_ParseTuple(args,(char *)":cc_to_python_get_subs_number_of_lines")) SWIG_fail; + result = (int)cc_to_python_get_subs_number_of_lines(); + resultobj = SWIG_From_int((int)(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_cc_to_python_get_sub(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + int arg1 ; + int val1 ; + int ecode1 = 0 ; + PyObject * obj0 = 0 ; + char *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:cc_to_python_get_sub",&obj0)) SWIG_fail; + ecode1 = SWIG_AsVal_int(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "cc_to_python_get_sub" "', argument " "1"" of type '" "int""'"); + } + arg1 = (int)(val1); + result = (char *)cc_to_python_get_sub(arg1); + resultobj = SWIG_FromCharPtr((const char *)result); + return resultobj; +fail: + return NULL; +} + + SWIGINTERN PyObject *_wrap___real_write(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; @@ -4300,6 +4335,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 *)"cc_to_python_get_subs_number_of_lines", _wrap_cc_to_python_get_subs_number_of_lines, METH_VARARGS, NULL}, + { (char *)"cc_to_python_get_sub", _wrap_cc_to_python_get_sub, 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 } diff --git a/src/ccextractor.c b/src/ccextractor.c index 0338c32e..083f7e85 100644 --- a/src/ccextractor.c +++ b/src/ccextractor.c @@ -475,6 +475,14 @@ int api_param_count(struct ccx_s_options* api_options){ return api_options->python_param_count; } +int cc_to_python_get_subs_number_of_lines(){ + return python_subs.number_of_lines; +} + +char* cc_to_python_get_sub(int i){ + return python_subs.subs[i]; +} + int __real_write(int file_handle, char* buffer, int nbyte); int __wrap_write(int file_handle, char* buffer, int nbyte) { diff --git a/src/ccextractor.h b/src/ccextractor.h index 84b31074..e0dbd2fc 100644 --- a/src/ccextractor.h +++ b/src/ccextractor.h @@ -44,6 +44,8 @@ void sigterm_handler(int sig); void sigint_handler(int sig); void print_end_msg(); int main(int argc, char *argv[]); +int cc_to_python_get_subs_number_of_lines(); +char* cc_to_python_get_sub(int i); int __real_write(int file_handle, char* buffer, int nbyte); int __wrap_write(int file_handle, char* buffer, int nbyte); #endif //CCEXTRACTOR_H