From: Marcelo M. <mm...@ac...> - 2006-01-12 21:15:48
|
Charlie Savage wrote: > Hi Marcelo, > > Yes, it does. Thanks. You were right, what I needed to do was: > > %rename("%(utitle)s",match="cdecl",notmatch$decl="",match$parentNode$nodeType="class") > ""; > > I did notice one bug though, an extra underscore is being added when > it shouldn't. For example: > > ENDIAN_BIG => endian__big > > Two more questions. First, the ruby module already automatically > renames classes. First, I wonder if that code should be ripped out > and replaced with a new default %rename directive. Second, I wonder > if the complicated rename I have above should be made default for > Ruby, since it would be difficult for the average user to figure it out! > > If we decided to do this, and I think we should, were should it go? > Also, we have to make sure that users can override these global > renames when needed, for special cases. Can this be done? I forgot, probably you still need to leave some checking code in ruby.cxx, just in the case the user override a name with a bad name.... maybe we can add a %namewarn for that case. Marcelo > > Charlie > > Marcelo Matus wrote: > >> Does it work now as expected? >> >> Marcelo >> >> >> Charlie Savage wrote: >> >>> Hi Marcelo, >>> >>> Looks much better. Thanks! >>> >>> A couple of remaining issues I see. Look at this class: >>> >>> class ByteOrderValues { >>> >>> public: >>> void readHEX(); >>> static int ENDIAN_BIG; >>> } >>> >>> 1. readHEX is now going to read_h_e_x. Should convert to read_hex. >>> >>> 2. ENDIAN_BIG is going to e_n_d_i_a_n_b_i_g. In Ruby this should >>> actually be ENDIAN_BIG since its a constant. But more to the >>> point, why does this get translated by the match="cdecl" since its a >>> constant and not a method? Can SWIG distinguish between class >>> constants and methods? If so, could it be matched differently than >>> with cdecl? If this can't be done, then I guess I just put in a >>> new %rename to override the incorrect one? >>> >>> Thanks, >>> >>> Charlie >>> >>> >>> Marcelo Matus wrote: >>> >>>> yes, sorry, there was a bug, >>>> >>>> now it works as expected. >>>> >>>> Marcelo >>>> >>>> >>>> Charlie Savage wrote: >>>> >>>>> Almost there, but I think its reversed. >>>>> >>>>> For example, starting with this: >>>>> >>>>> _wrap_GeometryFactory_createPointFromInternalCoord(int argc, VALUE >>>>> *argv, VALUE self) { >>>>> >>>>> If I do this: >>>>> >>>>> %rename("%(utitle)s",match="cdecl",match$parentNode$nodeType="class") >>>>> ""; >>>>> >>>>> I get this: >>>>> >>>>> _wrap_geometry_factory_createPointFromInternalCoord(int argc, >>>>> VALUE *argv, VALUE self) { >>>>> >>>>> Thus the class is being changed, not the method. What I'm after >>>>> is this: >>>>> >>>>> _wrap_GeometryFactory_create_point_from_internal_coord(int argc, >>>>> VALUE *argv, VALUE self) { >>>>> >>>>> Thanks again for implementing this - it will be very useful. >>>>> >>>>> Charlie >>>>> >>>>> >>>>> Marcelo Matus wrote: >>>>> >>>>>> Yes, you need to update the CVS, I just added it. >>>>>> >>>>>> Marcelo >>>>>> >>>>>> >>>>>> Charlie Savage wrote: >>>>>> >>>>>>> I think there has to be quotes around class (otherwise I get a >>>>>>> syntax error) so like this: >>>>>>> >>>>>>> %rename("%(utitle)s", match=cdecl, >>>>>>> match$parentNode$nodeType="class") ""; >>>>>>> >>>>>>> So upper, lower, title work for me. But not utitle. Am I >>>>>>> missing some code - I updated about an hour ago. >>>>>>> >>>>>>> Charlie >>>>>>> >>>>>>> Marcelo Matus wrote: >>>>>>> >>>>>>>> Use the new 'utitle' encoder, ie: >>>>>>>> >>>>>>>> %rename("%(utitle)s", match=cdecl, >>>>>>>> match$parentNode$nodeType=class) ""; >>>>>>>> >>>>>>>> that will rename all the 'cdecl's (ie, functions) nodes that >>>>>>>> have a "class" as the parent node, >>>>>>>> ie, member methods. >>>>>>>> >>>>>>>> Marcelo >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> Charlie Savage wrote: >>>>>>>> >>>>>>>>> Can the new %rename functionality change names to lower case >>>>>>>>> with underscores? >>>>>>>>> >>>>>>>>> Thus: >>>>>>>>> >>>>>>>>> CamelCase -> camel_case >>>>>>>>> >>>>>>>>> That would be very useful for Ruby since all method names are >>>>>>>>> supposed to be in the lower case, underscore format. >>>>>>>>> >>>>>>>>> Right now wrapping a C/C++ library requires generating a >>>>>>>>> multiple-hundreds of line rename file which has to be >>>>>>>>> maintained by hand. Kind of a pain.... >>>>>>>>> >>>>>>>>> Charlie >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> ------------------------------------------------------- >>>>>>>>> This SF.net email is sponsored by: Splunk Inc. Do you grep >>>>>>>>> through log files >>>>>>>>> for problems? Stop! Download the new AJAX search engine that >>>>>>>>> makes >>>>>>>>> searching your log files as easy as surfing the web. >>>>>>>>> DOWNLOAD SPLUNK! >>>>>>>>> http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click >>>>>>>>> _______________________________________________ >>>>>>>>> Swig-devel mailing list >>>>>>>>> Swi...@li... >>>>>>>>> https://lists.sourceforge.net/lists/listinfo/swig-devel >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>> >>>>>> >>>>>> >>>> >>>> >>>> >> >> >> |