/* * 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 <filesys.h> /* * Class: com_perforce_client_api_FileSys * Method: nDeleteInstance * Signature: (L)V */ JNIEXPORT void JNICALL Java_com_perforce_client_api_FileSys_nDeleteInstance (JNIEnv *, jclass, jlong 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: (L)Ljava/lang/String; */ JNIEXPORT jstring JNICALL Java_com_perforce_client_api_FileSys_nName (JNIEnv * env, jclass, jlong jRef) { FileSys * ref = (FileSys *)jRef; return env->NewStringUTF(ref->Name()); }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#4 | 4107 | Paul Krause | fix JNI sigs for ErrorId | ||
#3 | 4102 | Paul Krause | ditch JNIStringUtil | ||
#2 | 4100 | Paul Krause | fix type problems | ||
#1 | 4092 | Paul Krause | Copy JNI wrapper to C++ API from //guest/michael_bishop/P4APIForJava/c-cpp | ||
//guest/michael_bishop/P4APIForJava/c-cpp/filesys_jni.cpp | |||||
#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. |