On 2014-10-21 22:58+0100 Andrew Ross wrote: > My other option was to provide a static version of plfill for use as a > callback function (without the set_stream call) and a non-static version > with the call to set_stream for use elsewhere. This would make the two > different usages clear.
Let's agree we don't want to do violence to both the plshade and plshades API. That only leaves some variant of Phil's option 1 such as use C callbacks (i.e., plfill, pltr0, pltr1, pltr2) for all C++ callbacks or the option you expressed above which would imply leaving plstream::tr[0-2] defined and used as C++ callbacks just like they are now and implementing the static form of the C++ callback that wraps the C plfill identically to the way tr[0-2] are handled (no set_stream call). Assuming Phil is willing to go along with the above suggestion, then the other question I have about the above option is whether or not it is necessary for the static and non-static forms of fill to have distinct names. (I thought so when I proposed something very similar to the above, but I am not so sure now since you didn't mention it). If no separate name is needed (i.e., C++ recognizes that pls->fill in our examples refers to the non-static form with set_stream that is needed for direct calls and plstream::fill refers to the static form without set_stream required for callbacks), then we are very close to a correct solution now. Here are the results of some relevant searches in our example source code: software@raven> grep 'plstream::fill' examples/c++/* examples/c++/x15.cc: plstream::fill, true, NULL, NULL ); examples/c++/x15.cc: plstream::fill, true, NULL, NULL ); examples/c++/x16.cc: plstream::fill, true, NULL, NULL ); examples/c++/x16.cc: plstream::fill, true, plstream::tr1, (void *) &cgrid1 ); examples/c++/x16.cc: plstream::fill, false, plstream::tr2, (void *) &cgrid2 ); examples/c++/x16.cc: plstream::fill, false, plstream::tr2, (void *) &cgrid2 ); examples/c++/x16.cc: plstream::fill, false, plstream::tr2, (void *) &cgrid2 ); examples/c++/x16.cc: plstream::fill, false, plstream::tr2, (void *) &cgrid2 ); examples/c++/x22.cc: clev, nc, 0, 1, 1.0, plstream::fill, 0, NULL, NULL ); software@raven> grep 'pls->fill' examples/c++/* |grep -v fill3 examples/c++/x12.cc: pls->fill( 4, x, y ); examples/c++/x13.cc: pls->fill( j, x, y ); examples/c++/x21.cc: clev, nl, 1.0, 0, 1.0, pls->fill, true, NULL, NULL ); examples/c++/x24.cc: pls->fill( 4, px, py ); examples/c++/x25.cc: pls->fill( npts, x0, y0 ); examples/c++/x27.cc: pls->fill( 1 + steps * windings, xcoord, ycoord ); examples/c++/x30.cc: pls->fill( 4, px, py ); examples/c++/x30.cc: pls->fill( 4, px, py ); So it appears from these searchs that plstream::fill always refers to the callback, and once pls->fill is replaced by plstream::fill in example 21, all references to pls->fill will refer to direct use. So with that example 21 change and implementation of the static and non-static versions, we would have a complete solution which I could commit in ~15 minutes or so. However, if a separate name is needed for the callback version, then a bit more editing would be required of the examples. So if Phil is willing to go along with C++ callbacks and assuming one of you answers my question about whether separate names for the two cases would be required, I would be happy to implement the actual minimal commit just to finish off this topic (if one of you doesn't beat me to it). Alan __________________________ Alan W. Irwin 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); the Time Ephemerides project (timeephem.sf.net); PLplot scientific plotting software package (plplot.sf.net); the libLASi project (unifont.org/lasi); the Loads of Linux Links project (loll.sf.net); and the Linux Brochure Project (lbproject.sf.net). __________________________ Linux-powered Science __________________________ ------------------------------------------------------------------------------ Comprehensive Server Monitoring with Site24x7. Monitor 10 servers for $9/Month. Get alerted through email, SMS, voice calls or mobile push notifications. Take corrective actions from your mobile device. http://p.sf.net/sfu/Zoho _______________________________________________ Plplot-devel mailing list Plplot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/plplot-devel