You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pylucene-dev@lucene.apache.org by Bill Janssen <ja...@parc.com> on 2010/09/30 04:27:26 UTC

wrapping itext with JCC?

I thought I'd try writing my own version of pdftk with Python.  (pdftk
is a C++ wrapper around a Java library that uses gcj to provide the C++
bindings.)  First I have to wrap iText with JCC.  I'm using JCC 2.6 from
PyLucene 2.9.1.

% python -m jcc --shared --jar iText.jar --package java.lang --package java.util --package java.io --python itext --version 5.0.4 --files 2 --build
[...]
build/_itext/com/itextpdf/text/pdf/PdfName.h:207: error: expected unqualified-id before numeric constant
build/_itext/com/itextpdf/text/pdf/PdfName.h:207: error: abstract declarator ‘com::itextpdf::text::pdf::PdfName*’ used as declaration
build/_itext/com/itextpdf/text/pdf/PdfName.h:207: error: expected ‘;’ before numeric constant
build/_itext/com/itextpdf/text/pdf/PdfName.h:207: error: expected unqualified-id before numeric constant
build/_itext/com/itextpdf/text/pdf/PdfName.h:207: error: abstract declarator ‘com::itextpdf::text::pdf::PdfName*’ used as declaration
build/_itext/com/itextpdf/text/pdf/PdfName.h:207: error: expected ‘;’ before numeric constant
lipo: can't open input file: /var/folders/h0/h0Bg3-SkGAmoqGhgtZCaok++0T2/-Tmp-//ccyFkD7H.out (No such file or directory)
error: command 'gcc' failed with exit status 1
%

Seems like the offending line is

                    static PdfName *DOMAIN;

which comes from this in the Java source:

  public class PdfName extends PdfObject implements Comparable<PdfName> {

       ...

      public static final PdfName DOMAIN = new PdfName("Domain");

  }

Assuming DOMAIN is the problem, what's the right way to rename it out of the way?

I tried adding "--rename com.itextpdf.text.pdf.PdfName.DOMAIN=DOMAIN_",
with no change.

Bill

Re: wrapping itext with JCC?

Posted by Andi Vajda <va...@apache.org>.
On Sep 29, 2010, at 19:27, Bill Janssen <ja...@parc.com> wrote:

> I thought I'd try writing my own version of pdftk with Python.  (pdftk
> is a C++ wrapper around a Java library that uses gcj to provide the C 
> ++
> bindings.)  First I have to wrap iText with JCC.  I'm using JCC 2.6  
> from
> PyLucene 2.9.1.
>
> % python -m jcc --shared --jar iText.jar --package java.lang -- 
> package java.util --package java.io --python itext --version 5.0.4 -- 
> files 2 --build
> [...]
> build/_itext/com/itextpdf/text/pdf/PdfName.h:207: error: expected  
> unqualified-id before numeric constant

You hit a word that's defined as a number in some system header file.

> build/_itext/com/itextpdf/text/pdf/PdfName.h:207: error: abstract  
> declarator ‘com::itextpdf::text::pdf::PdfName*’ used as declarati 
> on
> build/_itext/com/itextpdf/text/pdf/PdfName.h:207: error: expected ‘; 
> ’ before numeric constant
> build/_itext/com/itextpdf/text/pdf/PdfName.h:207: error: expected  
> unqualified-id before numeric constant
> build/_itext/com/itextpdf/text/pdf/PdfName.h:207: error: abstract  
> declarator ‘com::itextpdf::text::pdf::PdfName*’ used as declarati 
> on
> build/_itext/com/itextpdf/text/pdf/PdfName.h:207: error: expected ‘; 
> ’ before numeric constant
> lipo: can't open input file: /var/folders/h0/h0Bg3-SkGAmoqGhgtZCaok+ 
> +0T2/-Tmp-//ccyFkD7H.out (No such file or directory)
> error: command 'gcc' failed with exit status 1
> %
>
> Seems like the offending line is
>
>                    static PdfName *DOMAIN;

Yes, quite plausible. I think this one has come up before.
To work it around, add --reserved DOMAIN to the command line or add it  
to the reserved word list in cpp.py.

Andi..

>
> which comes from this in the Java source:
>
>  public class PdfName extends PdfObject implements  
> Comparable<PdfName> {
>
>       ...
>
>      public static final PdfName DOMAIN = new PdfName("Domain");
>
>  }
>
> Assuming DOMAIN is the problem, what's the right way to rename it  
> out of the way?
>
> I tried adding "--rename  
> com.itextpdf.text.pdf.PdfName.DOMAIN=DOMAIN_",
> with no change.
>
> Bill

Re: wrapping itext with JCC?

Posted by Bill Janssen <ja...@parc.com>.
Bill Janssen <ja...@parc.com> wrote:

> Assuming DOMAIN is the problem, what's the right way to rename it out of the way?
> 
> I tried adding "--rename com.itextpdf.text.pdf.PdfName.DOMAIN=DOMAIN_",
> with no change.

I checked the archives and found the "--reserved" switch.  Thanks!

Bill

Re: wrapping itext with JCC?

Posted by Bill Janssen <ja...@parc.com>.
Darren Govoni <da...@ontrenet.com> wrote:

> Will this wrapper be available? I think its a great idea and useful.

It's already available.  Install PyLucene, then run the command I just
documented on iText.jar, and you have it.

Bill

> 
> On Wed, 2010-09-29 at 21:58 -0700, Andi Vajda wrote:
> 
> > On Sep 29, 2010, at 19:41, Bill Janssen <ja...@parc.com> wrote:
> > 
> > > So, just to close out this thread and record this:
> > >
> > > I'm wrapping iText 5.0.4 with JCC 2.6, using Python 2.5.  Here's the  
> > > command line:
> > >
> > > python -m jcc --shared --jar iText.jar --reserved DOMAIN --python  
> > > itext --version 5.0.4 --files 2 --build --install
> > >
> > > Works fine.
> > 
> > Excellent !
> > 
> > Andi..
> > 
> > >
> > > Bill
> 
> 

Re: wrapping itext with JCC?

Posted by Darren Govoni <da...@ontrenet.com>.
Will this wrapper be available? I think its a great idea and useful.

On Wed, 2010-09-29 at 21:58 -0700, Andi Vajda wrote:

> On Sep 29, 2010, at 19:41, Bill Janssen <ja...@parc.com> wrote:
> 
> > So, just to close out this thread and record this:
> >
> > I'm wrapping iText 5.0.4 with JCC 2.6, using Python 2.5.  Here's the  
> > command line:
> >
> > python -m jcc --shared --jar iText.jar --reserved DOMAIN --python  
> > itext --version 5.0.4 --files 2 --build --install
> >
> > Works fine.
> 
> Excellent !
> 
> Andi..
> 
> >
> > Bill



Re: wrapping itext with JCC?

Posted by Andi Vajda <va...@apache.org>.
On Sep 29, 2010, at 19:41, Bill Janssen <ja...@parc.com> wrote:

> So, just to close out this thread and record this:
>
> I'm wrapping iText 5.0.4 with JCC 2.6, using Python 2.5.  Here's the  
> command line:
>
> python -m jcc --shared --jar iText.jar --reserved DOMAIN --python  
> itext --version 5.0.4 --files 2 --build --install
>
> Works fine.

Excellent !

Andi..

>
> Bill

Re: wrapping itext with JCC?

Posted by Bill Janssen <ja...@parc.com>.
So, just to close out this thread and record this:

I'm wrapping iText 5.0.4 with JCC 2.6, using Python 2.5.  Here's the command line:

python -m jcc --shared --jar iText.jar --reserved DOMAIN --python itext --version 5.0.4 --files 2 --build --install

Works fine.

Bill