24 lines
549 B
Text
24 lines
549 B
Text
include 'std/std.fa'
|
|
include 'std/mem/gmem.fa'
|
|
|
|
macro SIZE 2 128 mul end
|
|
|
|
fun main [ str str int ] eo
|
|
%SIZE #malloc -- Allocate SIZE ammount of bytes
|
|
as string -- Store buffer as a pointer
|
|
|
|
"What do I repeat? " %STDOUT %fputs
|
|
|
|
%SIZE @string deref %STDIN
|
|
%SYS_read sys 4 -- read(STDIN, *string, SIZE) => <bytes_read>
|
|
|
|
1 swap sub @string deref
|
|
%puts -- puts(string) => null
|
|
|
|
%SIZE @string deref #mfree
|
|
pop -- free(string) => null
|
|
|
|
0 %exit
|
|
end
|
|
|
|
#main
|