Clean up for demo

This commit is contained in:
Nathan Braswell
2016-04-13 16:25:16 -04:00
parent 38ec4abc01
commit e732a6e41d
6 changed files with 61 additions and 18 deletions

59
stdlib/simple_print.krak Normal file
View File

@@ -0,0 +1,59 @@
fun println() {
print("\n")
}
fun println(to_print: *char) {
print(to_print)
print("\n")
}
fun println(to_print: char) {
print(to_print)
print("\n")
}
fun println(to_print: int) {
print(to_print)
print("\n")
}
fun println(to_print: float) {
print(to_print)
print("\n")
}
fun println(to_print: double) {
print(to_print)
print("\n")
}
fun println(to_print: bool) {
print(to_print)
print("\n")
}
fun print(to_print: *char) {
__if_comp__ __C__ simple_passthrough(to_print::) """
printf("%s", to_print);
"""
}
fun print(to_print: char) {
__if_comp__ __C__ simple_passthrough(to_print::) """
printf("%c", to_print);
"""
}
fun print(to_print: int) {
__if_comp__ __C__ simple_passthrough(to_print::) """
printf("%d", to_print);
"""
}
fun print(to_print: float) {
__if_comp__ __C__ simple_passthrough(to_print::) """
printf("%f", to_print);
"""
}
fun print(to_print: double) {
__if_comp__ __C__ simple_passthrough(to_print::) """
printf("%f", to_print);
"""
}
fun print(to_print: bool) {
if (to_print) print("true")
else print("false")
}