/* * Copyright 2000 Perforce Software. All rights reserved. * * This file is part of Perforce - the FAST SCM System. * * Author: Michael Bishop * * Tabs: 4 spaces * * This is just JNI glue to make the java calls go through to the * native FileSys object. * * The philosophy behind the Java glue is that, all of the native * objects are created natively. The pointer to that object is * passed to java where it stores it as an int. The value of that * int is actually a pointer in memory to the native object. * In this way, java can pass that int back to C code where it can * be casted to a C object pointer. When the java object is garbage * collected, it calls native code to delete the native pointer. * * All methods that are exposed with a java call are simply passed * through to native code where the native call is made. * */ #include "filesys_jni.h" #include "stdhdrs.h" #include "error.h" #include "strbuf.h" #include "JNIStringUtil.h" #include <filesys.h> /* * Class: com_perforce_client_api_FileSys * Method: nDeleteInstance * Signature: (I)V */ JNIEXPORT void JNICALL Java_com_perforce_client_api_FileSys_nDeleteInstance (JNIEnv *, jclass, jint jRef) { // // The java object contains an int as a c pointer // get rid of it. // delete (FileSys *)jRef; } /* * Class: com_perforce_client_api_FileSys * Method: nName * Signature: (I)Ljava/lang/String; */ JNIEXPORT jstring JNICALL Java_com_perforce_client_api_FileSys_nName (JNIEnv * env, jclass, jint jRef) { FileSys * ref = (FileSys *)jRef; return cstring_to_jstring( env, ref->Name() ); }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 430 | Michael Bishop |
Initial checkin. Seems to work. Not very much testing. Not very much documentation. Some more commenting needs to take place. But, it's there to experiment with. |