mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
samples: add Terra samples
source: https://github.com/zdevito/terra/tree/master/tests
This commit is contained in:
24
samples/Terra/gvarfault.t
Normal file
24
samples/Terra/gvarfault.t
Normal file
@@ -0,0 +1,24 @@
|
||||
if require("ffi").os == "Windows" then
|
||||
print("Disabled on windows (uses unistd.h)")
|
||||
return
|
||||
end
|
||||
local C = terralib.includecstring(
|
||||
[[
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
]]
|
||||
)
|
||||
|
||||
local gstr = global(&int8, "some text")
|
||||
|
||||
terra fun1()
|
||||
C.printf("gstr: %s \n", gstr)
|
||||
return 0
|
||||
end
|
||||
|
||||
fun1:printpretty()
|
||||
|
||||
fun1()
|
||||
Reference in New Issue
Block a user