Re: How to port SWIG Python interface file to JavaScript

Robert Heller <[email protected]> Mon, 20 Nov 2023 16:42:17 -0500 (EST)
Newsgroups gmane.comp.programming.swig
Organization Deepwoods Software
Message-ID <[email protected]>
--===============7786835854608482958==
Content-Type: text/plain;
              charset="us-ascii"


It should be noted that SWIG implements #if/#endif preprocessing, so it should 
be possible to "wrap" Python-specific pieces with #if/#endif and use other 
#if/#endif blocks for the Node.js specific pieces that replace the 
Python-specific pieces.  This would allow using the *same* .i files for both, 
just with different options to the swig command.

At Mon, 20 Nov 2023 18:34:51 +0000 William S Fulton <[email protected]> wrote:

> 
> The director feature is not implemented in Javascript, so you'd need to
> submit
> a patch to SWIG to add this feature if you really need it. I'd say that this
> is non-trivial to implement though.
> 
> There is no equivalent to %pythoncode in Javascript, so SWIG would also need
> modifying to add some sort of equivalents. Not very hard to do.
> 
> The typemap code your project has with Python API calls, PyInt_Check etc,
> will need
> converting into the Node.js API equivalents.
> 
> William
> 
> On Thu, 16 Nov 2023 at 08:31, Wang, Lin <[email protected]> wrote:
> 
> > Hello SWIG community,
> >
> >
> > There is a Python package that uses SWIG to call the underlying C++
> > functionalities. And I want to develop a Node.js package that also uses
> > SWIG and call the same C++ library, what if I want to reuse the existing
> > SWIG Python interface/input file?
> >
> >
> > Specifically, how can I deal with the Python specific features like the
> > following,
> >
> >    -
> >
> >    ●%feature("director")
> >    -
> >
> >    ●%pythoncode
> >    -
> >
> >    ●PyInt_Check, PyLong_Check etc. in %typemap block
> >
> >
> > Thanks,
> >
> > Lin
> > _______________________________________________
> > Swig-user mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/swig-user
> >
> 
> _______________________________________________
> Swig-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/swig-user
> 
> 

-- 
Robert Heller             -- Cell: 413-658-7953 GV: 978-633-5364
Deepwoods Software        -- Custom Software Services
http://www.deepsoft.com/  -- Linux Administration Services
[email protected]       -- Webhosting Services
                 


--===============7786835854608482958==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline


--===============7786835854608482958==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Swig-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/swig-user

--===============7786835854608482958==--