From 2570fc6449706fd93641ab23762194dbcd50db09 Mon Sep 17 00:00:00 2001 From: Adam Chlipala Date: Thu, 30 Apr 2009 17:15:14 -0400 Subject: C FFI compiler options --- tests/Makefile | 4 ++++ tests/cffi.ur | 3 +++ tests/cffi.urp | 6 ++++++ tests/cffi.urs | 1 + tests/test.c | 15 +++++++++++++++ tests/test.h | 7 +++++++ tests/test.urs | 5 +++++ 7 files changed, 41 insertions(+) create mode 100644 tests/Makefile create mode 100644 tests/cffi.ur create mode 100644 tests/cffi.urp create mode 100644 tests/cffi.urs create mode 100644 tests/test.c create mode 100644 tests/test.h create mode 100644 tests/test.urs (limited to 'tests') diff --git a/tests/Makefile b/tests/Makefile new file mode 100644 index 00000000..5313d12d --- /dev/null +++ b/tests/Makefile @@ -0,0 +1,4 @@ +all: test.o + +test.o: test.c + gcc -c test.c -o test.o diff --git a/tests/cffi.ur b/tests/cffi.ur new file mode 100644 index 00000000..2e20199b --- /dev/null +++ b/tests/cffi.ur @@ -0,0 +1,3 @@ +fun main () = return + {[Test.out (Test.frob (Test.create "Hello ") "world!")]} + diff --git a/tests/cffi.urp b/tests/cffi.urp new file mode 100644 index 00000000..cb27c744 --- /dev/null +++ b/tests/cffi.urp @@ -0,0 +1,6 @@ +debug +ffi test +include test.h +link test.o + +cffi diff --git a/tests/cffi.urs b/tests/cffi.urs new file mode 100644 index 00000000..6ac44e0b --- /dev/null +++ b/tests/cffi.urs @@ -0,0 +1 @@ +val main : unit -> transaction page diff --git a/tests/test.c b/tests/test.c new file mode 100644 index 00000000..c40eb966 --- /dev/null +++ b/tests/test.c @@ -0,0 +1,15 @@ +#include "../include/urweb.h" + +typedef uw_Basis_string uw_Test_t; + +uw_Test_t uw_Test_create(uw_context ctx, uw_Basis_string s) { + return s; +} + +uw_Basis_string uw_Test_out(uw_context ctx, uw_Test_t s) { + return s; +} + +uw_Test_t uw_Test_frob(uw_context ctx, uw_Test_t s1, uw_Basis_string s2) { + return uw_Basis_strcat(ctx, s1, s2); +} diff --git a/tests/test.h b/tests/test.h new file mode 100644 index 00000000..4cd257f8 --- /dev/null +++ b/tests/test.h @@ -0,0 +1,7 @@ +#include "../include/urweb.h" + +typedef uw_Basis_string uw_Test_t; + +uw_Test_t uw_Test_create(uw_context, uw_Basis_string); +uw_Basis_string uw_Test_out(uw_context, uw_Test_t); +uw_Test_t uw_Test_frob(uw_context, uw_Test_t, uw_Basis_string); diff --git a/tests/test.urs b/tests/test.urs new file mode 100644 index 00000000..e354572c --- /dev/null +++ b/tests/test.urs @@ -0,0 +1,5 @@ +type t + +val create : string -> t +val out : t -> string +val frob : t -> string -> t -- cgit v1.2.3