Mercurial > vba-clojure
annotate src/clojure/clojure.cpp @ 49:139178c4d843
clojure can now drive vba
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Wed, 07 Mar 2012 01:17:53 -0600 |
parents | |
children | 9d0ec2614443 |
rev | line source |
---|---|
rlm@49 | 1 #include "com_aurellem_gb_Gb.h" |
rlm@49 | 2 #include "../sdl/Drive.h" |
rlm@49 | 3 |
rlm@49 | 4 #include <string.h> |
rlm@49 | 5 |
rlm@49 | 6 #define UNUSED(x) (void)(x) |
rlm@49 | 7 |
rlm@49 | 8 |
rlm@49 | 9 /* |
rlm@49 | 10 * Class: com_aurellem_gb_Gb |
rlm@49 | 11 * Method: sayHello |
rlm@49 | 12 * Signature: ()V |
rlm@49 | 13 */ |
rlm@49 | 14 JNIEXPORT void JNICALL Java_com_aurellem_gb_Gb_sayHello |
rlm@49 | 15 (JNIEnv *env, jclass clazz){ |
rlm@49 | 16 UNUSED(env);UNUSED(clazz); |
rlm@49 | 17 printf("Hello from GB\n"); |
rlm@49 | 18 } |
rlm@49 | 19 |
rlm@49 | 20 /* |
rlm@49 | 21 * Class: com_aurellem_gb_Gb |
rlm@49 | 22 * Method: startEmulator |
rlm@49 | 23 * Signature: (Ljava/lang/String;)V |
rlm@49 | 24 */ |
rlm@49 | 25 JNIEXPORT void JNICALL Java_com_aurellem_gb_Gb_startEmulator |
rlm@49 | 26 (JNIEnv *env, jclass clazz, jstring str){ |
rlm@49 | 27 UNUSED(env);UNUSED(clazz);UNUSED(str); |
rlm@49 | 28 |
rlm@49 | 29 const char *_romName = env->GetStringUTFChars(str, 0); |
rlm@49 | 30 size_t len = strlen(_romName); |
rlm@49 | 31 |
rlm@49 | 32 char romName[len + 1]; |
rlm@49 | 33 |
rlm@49 | 34 strcpy(romName, _romName); |
rlm@49 | 35 |
rlm@49 | 36 char* arguments[] = {"vba-rlm", romName}; |
rlm@49 | 37 runVBA(2, arguments); |
rlm@49 | 38 } |
rlm@49 | 39 |