From: S J. S. <swa...@gm...> - 2005-06-11 22:29:55
|
Hey All, I highly reccomend sticking with swig. It is the most flexible wrapping software out there. I do think we need to discuss the best pardigm for doing this, the mol.h header file is to complex for swig to digest. S Joshua Swamidass |
From: Geoff H. <ge...@ge...> - 2005-06-13 13:58:19
|
> wrapping software out there. I do think we need to discuss the best > pardigm for doing this, the mol.h header file is to complex for swig > to digest. I'll bite. Using the development openbabel-new-framework line, I can certainly get SWIG to output a wrapper that looks fine to me. I haven't had much time to figure out why the modules won't load into Perl or Python, but SWIG certainly seems to be doing the right thing. If you think mol.h is too complex, I'm certainly open to hearing proposals to improve it. Anything in particular? Thanks, -Geoff |
From: S J. S. <swa...@gm...> - 2005-06-13 17:43:34
|
Let me point out I'm only familiar wiht python, not perl at all. So everything i say here has that slant. One sticky issue in particular is the '>>' and '<<' methods of molecules. Swig/python don't really know what to do with these and drops them. Molecule input/output in openbable relies heavily on this feaure. I know there are some lesser known ways of molecule input/output which can use stringio and file pointers to input molecules which could resolve this. In my opinion, we need to come up with a structure that will allow open bable to read a molecule from any file-emulating-object of the scripting target language, not just real files (very important for python). One solution could be to make a wrapper iterator to include in the swig file which provides the described functionallity to python. The other major problem i was stuck on was compiling the wrapper swig produced. I never got to the bottom of which i couldn't. I can go back and look again. In my (limited) experience, this is a sign swig misunderstood some more complex uses of c++ syntax. It has been a while since I tried to wrap openbabel. Since then their has been a new version of swig developed (with a lot of great enhancements). So some of what I recall might have been resolved. Let me know how you want to go about this from here: Josh On 6/13/05, Geoff Hutchison <ge...@ge...> wrote: > > wrapping software out there. I do think we need to discuss the best > > pardigm for doing this, the mol.h header file is to complex for swig > > to digest. >=20 > I'll bite. Using the development openbabel-new-framework line, I can > certainly get SWIG to output a wrapper that looks fine to me. I > haven't had much time to figure out why the modules won't load into > Perl or Python, but SWIG certainly seems to be doing the right thing. >=20 > If you think mol.h is too complex, I'm certainly open to hearing > proposals to improve it. Anything in particular? >=20 > Thanks, > -Geoff >=20 >=20 > ------------------------------------------------------- > This SF.Net email is sponsored by: NEC IT Guy Games. How far can you sho= tput > a projector? How fast can you ride your desk chair down the office luge t= rack? > If you want to score the big prize, get to know the little guy. > Play to win an NEC 61" plasma display: http://www.necitguy.com/?r=3D20 > _______________________________________________ > OpenBabel-scripting mailing list > Ope...@li... > https://lists.sourceforge.net/lists/listinfo/openbabel-scripting > |
From: Geoff H. <ge...@ge...> - 2005-06-13 20:21:07
|
On Jun 13, 2005, at 1:43 PM, S Joshua Swamidass wrote: > Let me point out I'm only familiar wiht python, not perl at all. So > everything i say here has that slant. That's fine. I think right now, there's more interest in Python wrappers than Perl. > One sticky issue in particular is the '>>' and '<<' methods of > ... Molecule input/output in openbable relies heavily on this > feaure. Not anymore. These are removed completely in the 2.0 development code. There are probably ways to bring them back, but honestly, it's nice to separate the conversion code completely from an OBMol. Even in earlier versions, the << and >> operators were not extensively used by internal code. > will allow open bable to read a molecule from any > file-emulating-object of the scripting target language, not just real > files (very important for python). It's already there. If you pass me a C++ iostream, then I'll hand it off to the new OBConversion framework and it'll go to work. I would assume that should handle most cases for Python, though I'll admit I haven't extensively looked at the new SWIG wrappers. > The other major problem i was stuck on was compiling the wrapper swig > produced. I never got to the bottom of which i couldn't. I can go back > and look again. In my (limited) experience, this is a sign swig > misunderstood some more complex uses of c++ syntax. No, it was a problem with the declarations for C replacement functions missing on some platforms. SWIG saw them in the OpenBabel namespace and had problems. First I updated the development version to use std:: so that SWIG would correctly ignore them. Now, they're out of mol.h entirely. Please take a look at the latest CVS snapshot on the openbabel-new- framework branch or the CVS development snapshot. There's even a SWIG openbabel.i file there. :-) At the very least, I can vouch that the wrapper compiles correctly. Cheers, -Geoff |
From: Geoff H. <ge...@ge...> - 2005-06-14 16:28:48
|
On Jun 13, 2005, at 5:49 PM, S Joshua Swamidass wrote: > Okay, let me look through the new stuff. As i mentioned, the last time > i looked at it a bit back. I'll start seeing what works, doesn't work > and get back to you soon. Well, I have good news on that front. I tried a few things last night and just committed some changes. The Python wrapper will compile, link and import into Python. (This is in the openbabel-new-framework CVS branch -- I'd be glad to send a snapshot if someone doesn't want to access the CVS version.) At this point, I hope people can run with it? I don't know enough about Python or what functionality people want to write a decent test script. Hopefully there's now enough that people can get some work done. % ob-newf: cd src/ % src: swig -c++ -modern -python -o openbabel_python.cpp openbabel.i [various warnings] % src: g++ -c openbabel_python.cpp -DHAVE_CONFIG_H -I/sw/include/ python2.4 -I/sw/lib/python2.4/config -I. % src: g++ -bundle -undefined supress -flat_namespace .libs/*.o math/.libs/*.o openbabel_python.o -o _openbabel.so [That last line is for linking on Mac OS X -- change as needed for your platform.] % ob-newf: python Python 2.4.1 (#1, May 11 2005, 10:46:27) [GCC 4.0.0 20041026 (Apple Computer, Inc. build 4061)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import openbabel >>> Cheers, -Geoff |