Init globals before lowering CTCE, allows CTCE to use imported functions, etc.

This commit is contained in:
Nathan Braswell
2016-07-06 00:16:39 -07:00
parent cd21e7a1cc
commit f71b5f3576
9 changed files with 86 additions and 14 deletions

View File

@@ -14,9 +14,11 @@ fun get_line(prompt: string::string, line_size: int): string::string {
print(prompt)
return get_line(line_size)
}
fun get_line(line_size: int): string::string {
fun get_line(line_size: int): string::string
return get_line(line_size, stdin)
fun get_line(line_size: int, file: *void): string::string {
var buff = new<char>(line_size)
fgets(buff, line_size, stdin)
fgets(buff, line_size, file)
var to_ret = string::string(buff)
delete(buff)
return to_ret.slice(0,-2) // remove '\n'