GameTools autogen java
The autogen tool converts the file 'lol/src/JavaInterface.jxx' into lol/src/JavaInterface.cxx and lol/src/GameInterface.java in order to automate the generation of Java bindings into the C game code. It's a bit of a hack - but it makes maintaining Java interfaces much easier than messing around with javah and/or swig.
/u/games/tools/src/autogen_java JavaInterface.jxx
...the tool is currently only ever run from within the lol/src/Makefile.am.
The JavaInterface.jxx file uses a special syntax for function headers and accepts javadoc-formatted comments.
Javadoc comments must start with /** (by itself on a line) and end with */ (by itself on a line).
Function headers must be preceded by JAVAFUNC and must be all on one line (although they may have code on that same line). The type of the return result must be either void, int, char, uchar, bool, float or string. uchar gets turned into byte in Java, bool becomes boolean in Java, string causes code to be generated to convert from a Java String into a C const char *.
eg:
/** * Does the specified object/flag/camers exist in this game level? * * @param name the name you are looking for * @return 'true' if it exists, 'false' if it doesn't. */ JAVAFUNC bool objectExists ( string name ) { return findObject ( name ) != NULL ; }
...becomes (in C ):
/*******************JAVA INTERFACE JUNK ************************/ bool objectExists ( string name ) ; extern "C" JNIEXPORT jboolean JNICALL Java_ javaLoL_GameInterface_objectExists ( JNIEnv *env, jobject _jobj, jstring name ){ string C0 = env -> GetStringUTFChars ( name, false ) ; jboolean ret = (jbo olean) objectExists ( C0 ) ; env -> ReleaseStringUTFChars ( name, C0 ) ; retu rn ret ;} /***************************************************************/
bool objectExists ( string name ) { return findObject ( name ) != NULL ; }
...and in Java:
/** * Does the specified object/flag/camers exist in this game level? * * @param name the name you are looking for * @return 'true' if it exists, 'false' if it doesn't. */ public native boolean objectExists ( String name ) ;
...running javadoc on the result produces the Java API function documentation: GameInterface API and Alphabetical Index
Wikiid Pages relating to gameTools (edit) |
gameTools - Main page |
gameTools - Support Tools :
|
gameTools - File Formats : |
gameTools - Source Code :
|
Wikiid Pages relating to Lemur of Lima (edit) |
Lemur of Lima - Main page |
Lemur of Lima - Controls |
Lemur of Lima - Levels : |
Lemur of Lima - Java Plugins : |
Lemur of Lima - Source Code Documentation : |