hzzc1987 / jnaerator

Automatically exported from code.google.com/p/jnaerator
0 stars 0 forks source link

Support for a user defined function mapper #59

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
JNA supports FunctionMappers to define custom mappings for function naming
(see
https://jna.dev.java.net/nonav/javadoc/com/sun/jna/FunctionMapper.html).
One could translate from C convention to CamelCase, e.g. foo_bar() is
translated to fooBar(). I do not see any way to use a custom function
mapper with JNAerator at the moment.
How about adding a possibility to define a custom function mapper?

Original issue reported on code.google.com by jens.k.mueller@gmail.com on 9 Apr 2010 at 7:45

GoogleCodeExporter commented 8 years ago
Hi Jens,

Thanks for your proposal :-)

FYI JNAerator already uses its own function mapper (to be able to look for 
different C++ name manglings).

I'm not too keen on giving too much power of configuration for autogenerated 
wrappers in general... Here I 
guess in the general case you'd need some sort of JNAerator plugin that would 
transform the name to 
CamelCase during the JNAeration process. While making this process completely 
pluggable is not (yet) in my 
plans, I believe it might be really worth adding "camelification" as a 
hard-coded switch (like "-beautifyNames", 
"-toCamelCase" or "-javaNamingConventions").

Do you see other significant use cases of symbol renaming that would make that 
proposal insufficient ?

Cheers

Original comment by olivier.chafik@gmail.com on 16 Apr 2010 at 12:58

GoogleCodeExporter commented 8 years ago
No. I only see a use case for transforming to camel case. A command line switch 
for
doing so would be fine.

Original comment by jens.k.mueller@gmail.com on 17 Apr 2010 at 4:56

GoogleCodeExporter commented 8 years ago
Hello Jens,

I've just added the -beautifyNames option to JNAerator :
http://code.google.com/p/nativelibs4java/source/detail?r=1110
http://code.google.com/p/nativelibs4java/source/detail?r=1111

To use it, you can build from sources 
(http://code.google.com/p/nativelibs4java/wiki/Build) or wait for the next 
binary snapshot of JNAerator.

Thanks again,
Cheers
--
Olivier

Original comment by olivier.chafik@gmail.com on 28 Jul 2010 at 3:14