gemstone/tests/driver/clang/main.gsc

28 lines
370 B
Plaintext
Raw Normal View History

import "std"
2024-08-05 19:21:25 +00:00
fun u32:cstrlen(in cstr: str) {
u32: idx = 0 as u32
while !(str[idx] == 0) {
2024-08-02 16:23:23 +00:00
idx = idx + 1 as u32
}
2024-08-05 19:21:25 +00:00
ret idx
}
fun printcstr(in cstr: msg) {
2024-08-05 19:21:25 +00:00
u32: len = cstrlen(msg)
2024-08-05 19:21:25 +00:00
handle: stdout = getStdoutHandle()
2024-08-05 19:21:25 +00:00
writeBytes(stdout, msg, len)
}
2024-08-05 19:21:25 +00:00
fun int:main() {
cstr: msg = "Hello, world!\n"
printcstr(msg)
2024-08-05 19:21:25 +00:00
ret 0
}