summaryrefslogtreecommitdiffstats
path: root/doc/manual/example3
diff options
context:
space:
mode:
Diffstat (limited to 'doc/manual/example3')
-rw-r--r--doc/manual/example3/function.cfg16
-rw-r--r--doc/manual/example3/function.h5
-rw-r--r--doc/manual/example3/gen.sh17
3 files changed, 38 insertions, 0 deletions
diff --git a/doc/manual/example3/function.cfg b/doc/manual/example3/function.cfg
new file mode 100644
index 0000000..8ac334f
--- /dev/null
+++ b/doc/manual/example3/function.cfg
@@ -0,0 +1,16 @@
+Package testfunction
+Style AllStatic
+JavaClass TestFunction
+JavaOutputDir gensrc/java
+NativeOutputDir gensrc/native
+
+# strlen takes a string as argument
+ArgumentIsString strlen 0
+
+# strstr takes strings as arguments
+ArgumentIsString strstr 0 1
+# it also returns a string
+ReturnsString strstr
+
+CustomCCode /* Include string.h header */
+CustomCCode #include <string.h>
diff --git a/doc/manual/example3/function.h b/doc/manual/example3/function.h
new file mode 100644
index 0000000..31ee673
--- /dev/null
+++ b/doc/manual/example3/function.h
@@ -0,0 +1,5 @@
+/* Give GlueGen a typedef for size_t */
+typedef int size_t;
+
+size_t strlen(const char* str);
+char* strstr(const char* str1, const char* str2);
diff --git a/doc/manual/example3/gen.sh b/doc/manual/example3/gen.sh
new file mode 100644
index 0000000..6fb971e
--- /dev/null
+++ b/doc/manual/example3/gen.sh
@@ -0,0 +1,17 @@
+#!/bin/ksh
+
+JAVA=java
+GLUEGEN_JAR=../../../build/gluegen.jar
+ANTLR_JAR=../../../../../ANTLR/antlr-2.7.4/antlr.jar
+
+NAME=`uname`
+
+if [ $NAME="Windows*" ] ; then
+ SEP=\;
+elif [ $NAME="CYGWIN*" ] ; then
+ SEP=\;
+else
+ SEP=:
+fi
+
+java -cp $GLUEGEN_JAR$SEP$ANTLR_JAR com.sun.gluegen.GlueGen -I. -Ecom.sun.gluegen.JavaEmitter -Cfunction.cfg function.h