Make test033 work with Java by using nullPtr from prelude instead of c function
commita0e97d0b5491ffc69cb2c55346e7d9a2b526cfaf
authorJan Bessai <Jan.Bessai@tu-dortmund.de>
dateWed 6 Nov 2013, 05:26 (13 years ago)
parent5f47063
test/test033/expected+1−1
test/test033/run+2−3
@@ -1,5 +1,4 @@
11#!/bin/bash
2−gcc -c test033.c
3−idris -o test033 test033.idr
2+idris $@ -o test033 test033.idr
43./test033
5−rm -f *.ibc *.o test033
4+rm -f *.ibc test033
test/test033/test033.cdeleted−10
@@ -1,10 +0,0 @@
1−#include "test033.h"
2−#include <stddef.h>
3−
4−int testNull(void* p) {
5− if(p == NULL) {
6− return 0;
7− }
8− return 1;
9−}
10−
test/test033/test033.hdeleted−6
@@ -1,6 +0,0 @@
1−#ifndef __TEST033_H__
2−#define __TEST033_H__
3−
4−int testNull(void*);
5−
6−#endif
test/test033/test033.idr+1−7
@@ -1,10 +1,4 @@
11module Main
22
3−%include C "test033.h"
4−%link C "test033.o"
5−
6−testNull : Ptr -> IO Int
7−testNull p = mkForeign (FFun "testNull" [FPtr] FInt) p
8−
93main : IO ()
10−main = testNull null >>= (putStrLn . show)
4+main = nullPtr null >>= (putStrLn . show)