changeset 48:75349da4c344

clojure hello world works
author Robert McIntyre <rlm@mit.edu>
date Wed, 07 Mar 2012 00:36:53 -0600
parents efa68261dba1
children 139178c4d843
files .hgignore clojure/com/aurellem/gb_driver.clj java/src/com/aurellem/gb/Gb.java src/clojure/clojure.c
diffstat 4 files changed, 31 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
     1.1 --- a/.hgignore	Wed Mar 07 00:13:50 2012 -0600
     1.2 +++ b/.hgignore	Wed Mar 07 00:36:53 2012 -0600
     1.3 @@ -14,4 +14,4 @@
     1.4  build-aux/*
     1.5  java/dist/*
     1.6  java/headers/*
     1.7 -java/ant-targets-build.xml
     1.8 +java/.ant-targets-build.xml
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/clojure/com/aurellem/gb_driver.clj	Wed Mar 07 00:36:53 2012 -0600
     2.3 @@ -0,0 +1,3 @@
     2.4 +(ns com.aurellem.gb-driver)
     2.5 +
     2.6 +
     3.1 --- a/java/src/com/aurellem/gb/Gb.java	Wed Mar 07 00:13:50 2012 -0600
     3.2 +++ b/java/src/com/aurellem/gb/Gb.java	Wed Mar 07 00:36:53 2012 -0600
     3.3 @@ -12,12 +12,17 @@
     3.4      /** 
     3.5       * Hello World! This is just to test the native interface.
     3.6       */
     3.7 -    public native void sayHello();
     3.8 +    public static native void sayHello();
     3.9      
    3.10      /** 
    3.11       * Run the emulator on a given rom
    3.12       * @param rom - the name of the rom.
    3.13       */
    3.14 -    public native void startEmulator(String rom);
    3.15 +    public static native void startEmulator(String rom);
    3.16 +
    3.17 +    
    3.18 +    public static void loadVBA(){
    3.19 +	System.loadLibrary("vba");
    3.20 +    }
    3.21  
    3.22  }
     4.1 --- a/src/clojure/clojure.c	Wed Mar 07 00:13:50 2012 -0600
     4.2 +++ b/src/clojure/clojure.c	Wed Mar 07 00:36:53 2012 -0600
     4.3 @@ -1,7 +1,26 @@
     4.4  #include "com_aurellem_gb_Gb.h"
     4.5  
     4.6 +#define UNUSED(x)  (void)(x)
     4.7  
     4.8  
     4.9 +/*
    4.10 + * Class:     com_aurellem_gb_Gb
    4.11 + * Method:    sayHello
    4.12 + * Signature: ()V
    4.13 + */
    4.14 +JNIEXPORT void JNICALL Java_com_aurellem_gb_Gb_sayHello
    4.15 +(JNIEnv *env, jclass clazz){
    4.16 +  UNUSED(env);UNUSED(clazz);
    4.17 +  printf("Hello from GB\n");  
    4.18 +}
    4.19  
    4.20 +/*
    4.21 + * Class:     com_aurellem_gb_Gb
    4.22 + * Method:    startEmulator
    4.23 + * Signature: (Ljava/lang/String;)V
    4.24 + */
    4.25 +JNIEXPORT void JNICALL Java_com_aurellem_gb_Gb_startEmulator
    4.26 +(JNIEnv *env, jclass clazz, jstring str){
    4.27 +  UNUSED(env);UNUSED(clazz);UNUSED(str);
    4.28 +}
    4.29  
    4.30 -