gemstone/tests/driver/gcc/main.gsc

29 lines
443 B
Plaintext
Raw Normal View History

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