Function definitions can be split into two groups: MethodDefinitions and ConstructorDefinitions. The two are split up into groups according to the "form" of the function. See the section called Translating ConstructorDefinition(s) for more details on how this is achieved.
The translation operation (method translate() in MethodDefinition) build the mapping between names extracted from the .defs file (and originally GNOME/GTK names) and appropriate names for Java language bindings. That is, having a GtkWindow.setTitle() generated instead of GtkWindow.set_title(), which does not really look Java-ish. This translation is basically a lookup in the known modules (gtk, gnome, ...) and a rewrite of the method name to be coherent with the Java naming style as found in the Sun Java Specification. Note that this translation can be controlled through the "naming" static flag in the Parser class, as the official naming scheme for Java-GNOME is not yet adopted.
It should be noted that variable arguments - that is C functions the uses variable arguments were implemented in a "special" way which limits the amount the amount of variable arguments that any function can use. Please see Appendix B for more details.
Constructor definitions differs from methods due to the fact that we need to return the handle/pointer to the object so that it can be stored in nativepeer.
Any function that has the form <gtk_object>_new or <gtk_object>_new_<something> is seen as a constructor. Any function that does not follow this naming scheme will not be seen as a constructor. Therefore any constructor MUST have this form. To achieve this we sometimes have to create dummy functions/wrappers in C so that the parser recognise the correct functions. See wrapper.c and wrapper.h in src/other for more information and examples.
The javacode for a constructor is in general of the following form:
public <ConstructorName>(<Paramaters>) { nativepeer = nativenew(<Paramaters>); } private native long nativenew(<Paramaters>); |
It should be noted that variable arguments - that is C functions the uses variable arguments were implemented in a "special" way which limits the amount the amount of variable arguments that any function can use. Please see Appendix B for more details.