1 /* -*- Mode: C; indent-tabs-mode: t; tab-width: 4 -*-
2 // ---------------------------------------------------------------------------
4 // Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
5 // ---------------------------------------------------------------------------
6 // SquirrelJME is under the Mozilla Public License Version 2.0.
7 // See license.mkd for licensing and copyright information.
8 // -------------------------------------------------------------------------*/
12 #include "frontend/emulator/jniHelper.h"
14 #include "sjme/alloc.h"
15 #include "sjme/debug.h"
17 static sjme_errorCode
sjme_jni_virtualSuite_list()
19 sjme_todo("Implement this?");
23 static sjme_errorCode
sjme_jni_virtualSuite_loadLibrary()
25 sjme_todo("Implement this?");
29 jlong
SJME_JNI_METHOD(SJME_CLASS_VIRTUAL_SUITE
, _1_1init
)
30 (JNIEnv
* env
, jclass classy
, jlong poolPtr
, jobject
this)
32 sjme_alloc_pool
* pool
;
33 sjme_rom_suiteFunctions
* result
;
36 if (poolPtr
== 0 || this == NULL
)
38 sjme_jni_throwVMException(env
, SJME_ERROR_NULL_ARGUMENTS
);
42 /* Get the pool pointer. */
43 pool
= SJME_JLONG_TO_POINTER(sjme_alloc_pool
*, poolPtr
);
45 /* Allocate the suite data. */
47 error
= SJME_ERROR_UNKNOWN
;
48 if (SJME_IS_ERROR(error
= sjme_alloc(pool
, sizeof(*result
),
49 (void**)&result
)) || result
== NULL
)
51 sjme_jni_throwVMException(env
, error
);
55 /* Set function handlers. */
56 result
->list
= sjme_jni_virtualSuite_list
;
57 result
->loadLibrary
= sjme_jni_virtualSuite_loadLibrary
;
59 /* Setup wrapper to reference. */
60 result
->frontEnd
.data
= env
;
61 result
->frontEnd
.wrapper
= SJME_FRONT_END_WRAP(
62 (*env
)->NewGlobalRef(env
, this));
64 /* Use the given result. */
65 return SJME_POINTER_TO_JLONG(result
);