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