From: Joe C. <fre...@gm...> - 2014-05-29 14:09:14
|
I want to ignore the following function: LEPT_DLL extern void setPixMemoryManager ( void * ( ( *allocator ) ( size_t ) ), void ( ( *deallocator ) ( void * ) ) ); The following didn't work. %ignore setPixMemoryManager; Pls help Joe |
From: Bob H. <bh...@co...> - 2014-05-29 14:37:10
|
On 5/29/2014 8:09 AM, Joe Chan wrote: > I want to ignore the following function: > LEPT_DLL extern void setPixMemoryManager ( void * ( ( *allocator ) ( size_t > ) ), void ( ( *deallocator ) ( void * ) ) ); > > The following didn't work. > %ignore setPixMemoryManager; You can wrap it away in the source, e.g.: #ifndef SWIG LEPT_DLL extern void setPixMemoryManager ( void * ( ( *allocator )... #endif However, you might just check to see if your %ignore directly appears /after/you include the header where the prototype is defined in your SWIG interface file. Also, if setPixMemoryManager() is wrapped in a namespace, you'll need to include the namespace in your %ignore command. E.g.: namespace Bob { ... LEPT_DLL extern void setPixMemoryManager ( void * ( ( *allocator )... } then %ignore Bob::setPixMemoryManager; |
From: Bob H. <bh...@co...> - 2014-05-29 15:09:01
|
Unless a newer version does (I use v2.0.4), no, I don't believe SWIG provides pattern-matching %ignore commands. Each %ignore specifies a discrete element to be suppressed. On 5/29/2014 8:50 AM, Joe Chan wrote: > Thank you for your reply. > > Actually, the function is within an include file that has hundreds of > functions. I want to ignore some of them with something like: > %include "xxxx.h" > %ignore aFunctionInsideXXX > > Is it possible? > > > Joe > > > On Thu, May 29, 2014 at 10:37 PM, Bob Hood <bh...@co... > <mailto:bh...@co...>>wrote: > > On 5/29/2014 8:09 AM, Joe Chan wrote: >> I want to ignore the following function: >> LEPT_DLL extern void setPixMemoryManager ( void * ( ( *allocator ) ( >> size_t ) ), void ( ( *deallocator ) ( void * ) ) ); >> >> The following didn't work. >> %ignore setPixMemoryManager; > > You can wrap it away in the source, e.g.: > > #ifndef SWIG > LEPT_DLL extern void setPixMemoryManager ( void * ( ( *allocator )... > #endif > > However, you might just check to see if your %ignore directly appears > /after/you include the header where the prototype is defined in your > SWIG interface file. > > Also, if setPixMemoryManager() is wrapped in a namespace, you'll need to > include the namespace in your %ignore command. E.g.: > > namespace Bob { > ... > LEPT_DLL extern void setPixMemoryManager ( void * ( ( *allocator )... > } > > then > > %ignore Bob::setPixMemoryManager; > > > ------------------------------------------------------------------------------ > Time is money. Stop wasting it! Get your web API in 5 minutes. > www.restlet.com/download <http://www.restlet.com/download> > http://p.sf.net/sfu/restlet > _______________________________________________ > Swig-user mailing list > Swi...@li... <mailto:Swi...@li...> > https://lists.sourceforge.net/lists/listinfo/swig-user > > |
From: Vadim Z. <vz...@ze...> - 2014-05-29 15:17:52
|
On Thu, 29 May 2014 09:08:57 -0600 Bob Hood <bh...@co...> wrote: BH> Unless a newer version does (I use v2.0.4), no, I don't believe SWIG provides BH> pattern-matching %ignore commands. Actually, yes, newer versions (since 2.0.10 I believe? Anyhow, just use 3.0.1) do support using %(regex:...) in %rename, and hence %ignore, which is just a special case of it. See http://www.swig.org/Doc3.0/SWIG.html#SWIG_advanced_renaming HTH, VZ |
From: Joe C. <fre...@gm...> - 2014-05-30 11:29:42
|
On second thoughts, %ignore/%rename should not work because the errors happened when swig is compiled and therefore too early for %ignore to ignore that function. swig -python -c++ -I/usr/include/tesseract -I/usr/include/leptonica -I/usr/include/opencv2 -o tesseract_wrap.cpp tesseract.i allheaders_mini.h:44: Error: Syntax error in input(1). On Thu, May 29, 2014 at 11:17 PM, Vadim Zeitlin <vz...@ze...> wrote: > On Thu, 29 May 2014 09:08:57 -0600 Bob Hood <bh...@co...> wrote: > > BH> Unless a newer version does (I use v2.0.4), no, I don't believe SWIG > provides > BH> pattern-matching %ignore commands. > > Actually, yes, newer versions (since 2.0.10 I believe? Anyhow, just use > 3.0.1) do support using %(regex:...) in %rename, and hence %ignore, which > is just a special case of it. See > > http://www.swig.org/Doc3.0/SWIG.html#SWIG_advanced_renaming > > HTH, > VZ > > > ------------------------------------------------------------------------------ > Time is money. Stop wasting it! Get your web API in 5 minutes. > www.restlet.com/download > http://p.sf.net/sfu/restlet > _______________________________________________ > Swig-user mailing list > Swi...@li... > https://lists.sourceforge.net/lists/listinfo/swig-user > > |
From: Joe C. <fre...@gm...> - 2014-05-29 18:42:12
|
%ignore "" shall mean ignore everything but it does not work on 2.0.11 Joe On Thu, May 29, 2014 at 11:17 PM, Vadim Zeitlin <vz...@ze...> wrote: > On Thu, 29 May 2014 09:08:57 -0600 Bob Hood <bh...@co...> wrote: > > BH> Unless a newer version does (I use v2.0.4), no, I don't believe SWIG > provides > BH> pattern-matching %ignore commands. > > Actually, yes, newer versions (since 2.0.10 I believe? Anyhow, just use > 3.0.1) do support using %(regex:...) in %rename, and hence %ignore, which > is just a special case of it. See > > http://www.swig.org/Doc3.0/SWIG.html#SWIG_advanced_renaming > > HTH, > VZ > > > ------------------------------------------------------------------------------ > Time is money. Stop wasting it! Get your web API in 5 minutes. > www.restlet.com/download > http://p.sf.net/sfu/restlet > _______________________________________________ > Swig-user mailing list > Swi...@li... > https://lists.sourceforge.net/lists/listinfo/swig-user > > |
From: Joe C. <fre...@gm...> - 2014-05-30 03:30:10
|
Although the syntax of the following function declaration is not wrong in C11, it triggered an syntax error in input(1): LEPT_DLL extern void setPixMemoryManager ( void * ( ( *allocator ) ( size_t ) ), void ( ( *deallocator ) ( void * ) ) ); I need a mean to tell swig to ignore it(or comment it out to be exact) after I have included the .h file as a whole %include "xxxx.h" %ignore aFunctionInsideXXX Below are something that won't work : %rename ("$ignore") setPixMemoryManager; %ignore setPixMemoryManager; On Fri, May 30, 2014 at 2:42 AM, Joe Chan <fre...@gm...> wrote: > %ignore "" shall mean ignore everything > but it does not work on 2.0.11 > > > > Joe > > > On Thu, May 29, 2014 at 11:17 PM, Vadim Zeitlin <vz...@ze...> > wrote: > >> On Thu, 29 May 2014 09:08:57 -0600 Bob Hood <bh...@co...> wrote: >> >> BH> Unless a newer version does (I use v2.0.4), no, I don't believe SWIG >> provides >> BH> pattern-matching %ignore commands. >> >> Actually, yes, newer versions (since 2.0.10 I believe? Anyhow, just use >> 3.0.1) do support using %(regex:...) in %rename, and hence %ignore, which >> is just a special case of it. See >> >> http://www.swig.org/Doc3.0/SWIG.html#SWIG_advanced_renaming >> >> HTH, >> VZ >> >> >> ------------------------------------------------------------------------------ >> Time is money. Stop wasting it! Get your web API in 5 minutes. >> www.restlet.com/download >> http://p.sf.net/sfu/restlet >> _______________________________________________ >> Swig-user mailing list >> Swi...@li... >> https://lists.sourceforge.net/lists/listinfo/swig-user >> >> > |
From: William S F. <ws...@fu...> - 2014-06-02 18:03:12
|
On 30/05/14 04:30, Joe Chan wrote: > Although the syntax of the following function declaration is not wrong > in C11, it triggered an syntax error in input(1): > > LEPT_DLL extern void setPixMemoryManager ( void * ( ( *allocator ) ( > size_t ) ), void ( ( *deallocator ) ( void * ) ) ); > This is not valid C11. You need to get rid of the LEPT_DLL which is probably defined to one of the commonly used non-standard dllexport macros/attributes. use a macro to remove it for SWIG: #define LEPT_DLL before SWIG parses any use of it. If you are still getting a syntax error in SWIG-3.0.1 report back. William > I need a mean to tell swig to ignore it(or comment it out to be exact) > after I have included the .h file as a whole > %include "xxxx.h" > %ignore aFunctionInsideXXX > > Below are something that won't work : > %rename ("$ignore") setPixMemoryManager; > %ignore setPixMemoryManager; > > > > On Fri, May 30, 2014 at 2:42 AM, Joe Chan <fre...@gm... > <mailto:fre...@gm...>> wrote: > > %ignore "" shall mean ignore everything > but it does not work on 2.0.11 > > > > Joe > > > On Thu, May 29, 2014 at 11:17 PM, Vadim Zeitlin > <vz...@ze... <mailto:vz...@ze...>> wrote: > > On Thu, 29 May 2014 09:08:57 -0600 Bob Hood <bh...@co... > <mailto:bh...@co...>> wrote: > > BH> Unless a newer version does (I use v2.0.4), no, I don't > believe SWIG provides > BH> pattern-matching %ignore commands. > > Actually, yes, newer versions (since 2.0.10 I believe? Anyhow, > just use > 3.0.1) do support using %(regex:...) in %rename, and hence > %ignore, which > is just a special case of it. See > > http://www.swig.org/Doc3.0/SWIG.html#SWIG_advanced_renaming > > HTH, > VZ > > ------------------------------------------------------------------------------ > Time is money. Stop wasting it! Get your web API in 5 minutes. > www.restlet.com/download <http://www.restlet.com/download> > http://p.sf.net/sfu/restlet > _______________________________________________ > Swig-user mailing list > Swi...@li... > <mailto:Swi...@li...> > https://lists.sourceforge.net/lists/listinfo/swig-user > > > > > > ------------------------------------------------------------------------------ > Time is money. Stop wasting it! Get your web API in 5 minutes. > www.restlet.com/download > http://p.sf.net/sfu/restlet > > > > _______________________________________________ > Swig-user mailing list > Swi...@li... > https://lists.sourceforge.net/lists/listinfo/swig-user > |
From: Joe C. <fre...@gm...> - 2014-06-02 23:34:30
|
Thank you for your reply. 1. I am using swig 3.0 now eli@nowhere:~/Desktop/svn/python-tesseract/src$ swig -version SWIG Version 3.0.0 Compiled with g++ [x86_64-unknown-linux-gnu] Configured options: +pcre 2. I have defined LEPT_DLL as #define LEPT_DLL 3. I still don't know how to properly ignore setPixMemoryManager I got the following error: swig -python -c++ -I/usr/include/tesseract -I/usr/include/leptonica -I/usr/include/opencv2 -o tesseract_wrap.cpp tesseract.i /usr/include/leptonica/allheaders.h:1266: Error: Syntax error in input(1). error: command 'swig' failed with exit status 1 FYI in line 1266 of allheaders.h, it defines LEPT_DLL extern void setPixMemoryManager ( void * ( ( *allocator ) ( size_t ) ), void ( ( *deallocator ) ( void * ) ) ); 4. I need a viable mean to instruct swig to ignore line 1266 but in vain. None of the below worked. %ignore LEPT_DLL extern void setPixMemoryManager ( void * ( ( *allocator ) ( size_t ) ), void ( ( *deallocator ) ( void * ) ) ); %ignore setPixMemoryManager; %rename ("$ignore") setPixMemoryManager; On Tue, Jun 3, 2014 at 2:02 AM, William S Fulton <ws...@fu...> wrote: > > On 30/05/14 04:30, Joe Chan wrote: > >> Although the syntax of the following function declaration is not wrong >> in C11, it triggered an syntax error in input(1): >> >> LEPT_DLL extern void setPixMemoryManager ( void * ( ( *allocator ) ( >> size_t ) ), void ( ( *deallocator ) ( void * ) ) ); >> >> This is not valid C11. You need to get rid of the LEPT_DLL which is > probably defined to one of the commonly used non-standard dllexport > macros/attributes. use a macro to remove it for SWIG: > > #define LEPT_DLL > > before SWIG parses any use of it. If you are still getting a syntax error > in SWIG-3.0.1 report back. > > William > > I need a mean to tell swig to ignore it(or comment it out to be exact) >> after I have included the .h file as a whole >> %include "xxxx.h" >> %ignore aFunctionInsideXXX >> >> Below are something that won't work : >> %rename ("$ignore") setPixMemoryManager; >> %ignore setPixMemoryManager; >> >> >> >> On Fri, May 30, 2014 at 2:42 AM, Joe Chan <fre...@gm... >> <mailto:fre...@gm...>> wrote: >> >> %ignore "" shall mean ignore everything >> but it does not work on 2.0.11 >> >> >> >> Joe >> >> >> On Thu, May 29, 2014 at 11:17 PM, Vadim Zeitlin >> <vz...@ze... <mailto:vz...@ze...>> wrote: >> >> On Thu, 29 May 2014 09:08:57 -0600 Bob Hood <bh...@co... >> <mailto:bh...@co...>> wrote: >> >> BH> Unless a newer version does (I use v2.0.4), no, I don't >> believe SWIG provides >> BH> pattern-matching %ignore commands. >> >> Actually, yes, newer versions (since 2.0.10 I believe? Anyhow, >> just use >> 3.0.1) do support using %(regex:...) in %rename, and hence >> %ignore, which >> is just a special case of it. See >> >> http://www.swig.org/Doc3.0/SWIG.html#SWIG_advanced_renaming >> >> HTH, >> VZ >> >> ------------------------------------------------------------ >> ------------------ >> Time is money. Stop wasting it! Get your web API in 5 minutes. >> www.restlet.com/download <http://www.restlet.com/download> >> >> http://p.sf.net/sfu/restlet >> _______________________________________________ >> Swig-user mailing list >> Swi...@li... >> <mailto:Swi...@li...> >> https://lists.sourceforge.net/lists/listinfo/swig-user >> >> >> >> >> >> >> ------------------------------------------------------------ >> ------------------ >> Time is money. Stop wasting it! Get your web API in 5 minutes. >> www.restlet.com/download >> http://p.sf.net/sfu/restlet >> >> >> >> _______________________________________________ >> Swig-user mailing list >> Swi...@li... >> https://lists.sourceforge.net/lists/listinfo/swig-user >> >> > |
From: William S F. <ws...@fu...> - 2014-06-05 19:16:51
|
On 03/06/14 00:34, Joe Chan wrote: > Thank you for your reply. > > 1. I am using swig 3.0 now > > eli@nowhere:~/Desktop/svn/python-tesseract/src$ swig -version > SWIG Version 3.0.0 > Compiled with g++ [x86_64-unknown-linux-gnu] > Configured options: +pcre > > 2. I have defined LEPT_DLL as > #define LEPT_DLL > > 3. I still don't know how to properly ignore setPixMemoryManager > I got the following error: > swig -python -c++ -I/usr/include/tesseract -I/usr/include/leptonica > -I/usr/include/opencv2 -o tesseract_wrap.cpp tesseract.i > /usr/include/leptonica/allheaders.h:1266: Error: Syntax error in input(1). > error: command 'swig' failed with exit status 1 > > FYI in line 1266 of allheaders.h, it defines > LEPT_DLL extern void setPixMemoryManager ( void * ( ( *allocator ) ( > size_t ) ), void ( ( *deallocator ) ( void * ) ) ); > > > 4. I need a viable mean to instruct swig to ignore line 1266 but in > vain. None of the below worked. > > %ignore LEPT_DLL extern void setPixMemoryManager ( void * ( ( > *allocator ) ( size_t ) ), void ( ( *deallocator ) ( void * ) ) ); > %ignore setPixMemoryManager; > %rename ("$ignore") setPixMemoryManager; > There is a problem with SWIG parsing the pointer to function with the extra brackets. If you change extern void setPixMemoryManager ( void * ( ( *allocator ) ( size_t ) ), void ( ( *deallocator ) ( void * ) ) ); to extern void setPixMemoryManager ( void * ( *allocator ) ( size_t ), void ( *deallocator ) ( void * ) ); then SWIG is able to parse it. Unfortunately you can't use %ignore to work around this. Please raise a bug report on github for this issue. William |
From: Olly B. <ol...@su...> - 2014-06-05 23:32:16
|
On 2014-06-05, William S Fulton <ws...@fu...> wrote: > There is a problem with SWIG parsing the pointer to function with the > extra brackets. If you change > > extern void setPixMemoryManager ( void * ( ( *allocator ) ( size_t ) ), > void ( ( *deallocator ) ( void * ) ) ); > > to > > extern void setPixMemoryManager ( void * ( *allocator ) ( size_t ), void > ( *deallocator ) ( void * ) ); > > then SWIG is able to parse it. Unfortunately you can't use %ignore to > work around this. Please raise a bug report on github for this issue. We also fail to parse this simpler (but at least conceptually related) case: struct Foo { int (foo)(int i); }; which results in: misparse.i:3: Warning 504: Function Foo::int(foo) must have a return type. Ignored. I file a bug for this last year: https://github.com/swig/swig/issues/45 Cheers, Olly |