finish implementing methods used in nativebindings test program
This commit is contained in:
@@ -209,13 +209,43 @@ JNIEXPORT jobject JNICALL Java_org_neoflock_NeoNucleus_NativeBindings_nn_1addSup
|
|||||||
(JNIEnv * env, jclass, jobject computer, jobject arch) {
|
(JNIEnv * env, jclass, jobject computer, jobject arch) {
|
||||||
nn_Computer* nnPC = (nn_Computer*) Carbon::PointerBacked::GetPointer(env, computer);
|
nn_Computer* nnPC = (nn_Computer*) Carbon::PointerBacked::GetPointer(env, computer);
|
||||||
nn_Architecture* nnArch = (nn_Architecture*) Carbon::PointerBacked::GetPointer(env, arch);
|
nn_Architecture* nnArch = (nn_Architecture*) Carbon::PointerBacked::GetPointer(env, arch);
|
||||||
NULLPTR_CHECKNR(nnPC, nn_Computer);
|
NULLPTR_CHECK(nnPC, nn_Computer);
|
||||||
NULLPTR_CHECKNR(nnArch, nn_Architecture);
|
NULLPTR_CHECK(nnArch, nn_Architecture);
|
||||||
|
|
||||||
nn_addSupportedArchitecture(nnPC, nnArch);
|
nn_addSupportedArchitecture(nnPC, nnArch);
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jobject JNICALL Java_org_neoflock_NeoNucleus_NativeBindings_nn_1setTmpAddress
|
JNIEXPORT jobject JNICALL Java_org_neoflock_NeoNucleus_NativeBindings_nn_1setTmpAddress
|
||||||
(JNIEnv *, jclass, jobject computer, jstring address) {
|
(JNIEnv * env, jclass, jobject computer, jstring address) {
|
||||||
// TODO
|
// TODO
|
||||||
|
nn_Computer* nnPC = (nn_Computer*) Carbon::PointerBacked::GetPointer(env, computer);
|
||||||
|
NULLPTR_CHECK(nnPC, nn_Computer);
|
||||||
|
if (address == NULL) {
|
||||||
|
return Carbon::Map::To_nn_Exit(env, nn_setTmpAddress(nnPC, NULL));
|
||||||
|
}
|
||||||
|
const char * str = env->GetStringUTFChars(address, NULL);
|
||||||
|
nn_Exit exitCode = nn_setTmpAddress(nnPC, str);
|
||||||
|
env->ReleaseStringUTFChars(address, str);
|
||||||
|
return Carbon::Map::To_nn_Exit(env, exitCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
JNIEXPORT jobject JNICALL Java_org_neoflock_NeoNucleus_NativeBindings_nn_1tick
|
||||||
|
(JNIEnv * env, jclass, jobject computer) {
|
||||||
|
nn_Computer* nnPC = (nn_Computer*) Carbon::PointerBacked::GetPointer(env, computer);
|
||||||
|
NULLPTR_CHECK(nnPC, nn_Computer);
|
||||||
|
return Carbon::Map::To_nn_Exit(env, nn_tick(nnPC));
|
||||||
|
}
|
||||||
|
|
||||||
|
JNIEXPORT jobject JNICALL Java_org_neoflock_NeoNucleus_NativeBindings_nn_1tickSynchronized
|
||||||
|
(JNIEnv * env, jclass, jobject computer) {
|
||||||
|
nn_Computer* nnPC = (nn_Computer*) Carbon::PointerBacked::GetPointer(env, computer);
|
||||||
|
NULLPTR_CHECK(nnPC, nn_Computer);
|
||||||
|
return Carbon::Map::To_nn_Exit(env, nn_tickSynchronized(nnPC));
|
||||||
|
}
|
||||||
|
|
||||||
|
JNIEXPORT jobject JNICALL Java_org_neoflock_NeoNucleus_NativeBindings_nn_1getComputerState
|
||||||
|
(JNIEnv * env, jclass, jobject computer) {
|
||||||
|
nn_Computer* nnPC = (nn_Computer*) Carbon::PointerBacked::GetPointer(env, computer);
|
||||||
|
NULLPTR_CHECK(nnPC, nn_Computer);
|
||||||
|
return Carbon::Map::To_nn_ComputerState(env, nn_getComputerState(nnPC));
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user