From: Alan W. I. <ir...@be...> - 2005-12-08 19:14:36
|
On 2005-12-08 15:18-0000 Andrew Ross wrote: > On Tue, Dec 06, 2005 at 09:16:56AM -0800, Alan Irwin wrote: >> >> Yes. I was assuming swig could not do this automatically so that a >> hand-generated python script would have to be used to do the overloading. >> That's exactly what is done already in plplot.py to generate the >> user-friendly form of our interface. Thus, a hand-generated extension to >> plplot.py to handle the integer versus bool type argument for each function >> where that variation occurs should be straightforward. >> >> I hope you can figured out how to do something similar in PLStream.java. If >> you can show me how to do one overloading there, I can finish the rest. > > I've gone for the simple approach. PLStream now has overloaded > methods for both int and boolean arguments where C uses the PLBOOL type. > > Examples updated accordingly. Hi Andrew: Thanks very much for your efforts on both the Java examples and bindings. I do have plans to change bindings/swig-support/plplotcapi.i and bindings/java/plplotjavac.i to deal with translating PLBOOL directly to Java boolean so I think the net effect will be that, for example, both the swig-generated interfaces plplotjavac.plcpstrm and plplotjavacJNI.plcpstrm will have a boolean argument. I notice the syntax you use to translate a boolean to integer is flags?1:0 where flags is a boolean. What java syntax do you recommend to translate an integer to boolean in PLStream.java? I will need that for the deprecated bindings (and also I will have to replace your "flags?1:0" form by "flags" in the recommended bindings) once the bindings/swig-support/plplotcapi.i and bindings/java/plplotjavac.i are in place. However, that editing change should be trivial now that you have identified how to do the overloading and done the editing work to implement it in PLStream.java for the current bindings/swig-support/plplotcapi.i and bindings/java/plplotjavac.i. Alan __________________________ Alan W. Irwin email: ir...@be... phone: 250-727-2902 Astronomical research affiliation with Department of Physics and Astronomy, University of Victoria (astrowww.phys.uvic.ca). Programming affiliations with the FreeEOS equation-of-state implementation for stellar interiors (freeeos.sf.net); PLplot scientific plotting software package (plplot.org); the Yorick front-end to PLplot (yplot.sf.net); the Loads of Linux Links project (loll.sf.net); and the Linux Brochure Project (lbproject.sf.net). __________________________ Linux-powered Science __________________________ |