diff 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
line wrap: on
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/clojure/clojure.cpp	Wed Mar 07 01:17:53 2012 -0600
     1.3 @@ -0,0 +1,39 @@
     1.4 +#include "com_aurellem_gb_Gb.h"
     1.5 +#include "../sdl/Drive.h"
     1.6 +
     1.7 +#include <string.h>
     1.8 +
     1.9 +#define UNUSED(x)  (void)(x)
    1.10 +
    1.11 +
    1.12 +/*
    1.13 + * Class:     com_aurellem_gb_Gb
    1.14 + * Method:    sayHello
    1.15 + * Signature: ()V
    1.16 + */
    1.17 +JNIEXPORT void JNICALL Java_com_aurellem_gb_Gb_sayHello
    1.18 +(JNIEnv *env, jclass clazz){
    1.19 +  UNUSED(env);UNUSED(clazz);
    1.20 +  printf("Hello from GB\n");  
    1.21 +}
    1.22 +
    1.23 +/*
    1.24 + * Class:     com_aurellem_gb_Gb
    1.25 + * Method:    startEmulator
    1.26 + * Signature: (Ljava/lang/String;)V
    1.27 + */
    1.28 +JNIEXPORT void JNICALL Java_com_aurellem_gb_Gb_startEmulator
    1.29 +(JNIEnv *env, jclass clazz, jstring str){
    1.30 +  UNUSED(env);UNUSED(clazz);UNUSED(str);
    1.31 +
    1.32 +  const char *_romName = env->GetStringUTFChars(str, 0);
    1.33 +  size_t len = strlen(_romName);
    1.34 +  
    1.35 +  char romName[len + 1];
    1.36 +
    1.37 +  strcpy(romName, _romName);
    1.38 + 
    1.39 +  char* arguments[] = {"vba-rlm", romName};
    1.40 +  runVBA(2, arguments);
    1.41 +}
    1.42 +