76 lines
1.2 KiB
Plaintext
76 lines
1.2 KiB
Plaintext
import string:*;
|
|
import mem:*
|
|
|
|
__if_comp__ __C__ simple_passthrough """
|
|
#include <stdio.h>
|
|
"""
|
|
|
|
fun println() : void {
|
|
print("\n");
|
|
}
|
|
|
|
fun println<T>(toPrint: T) : void {
|
|
print(toPrint)
|
|
print("\n")
|
|
}
|
|
|
|
fun print(toPrint: char*) : void {
|
|
__if_comp__ __C__ {
|
|
simple_passthrough(toPrint = toPrint::) """
|
|
printf("%s", toPrint);
|
|
"""
|
|
}
|
|
return;
|
|
}
|
|
|
|
fun print(toPrint: char) : void {
|
|
__if_comp__ __C__ {
|
|
simple_passthrough(toPrint = toPrint::) """
|
|
printf("%c", toPrint);
|
|
"""
|
|
}
|
|
return;
|
|
}
|
|
|
|
fun print(toPrint: string) : void {
|
|
var charArr = toPrint.toCharArray()
|
|
defer delete(charArr)
|
|
print(charArr);
|
|
}
|
|
|
|
fun print(toPrint: bool): void {
|
|
if (toPrint)
|
|
print("true")
|
|
else
|
|
print("false")
|
|
return;
|
|
}
|
|
|
|
fun print(toPrint: int): void {
|
|
__if_comp__ __C__ {
|
|
simple_passthrough(toPrint = toPrint::) """
|
|
printf("%d", toPrint);
|
|
"""
|
|
}
|
|
return;
|
|
}
|
|
|
|
fun print(toPrint: float): void {
|
|
__if_comp__ __C__ {
|
|
simple_passthrough(toPrint = toPrint::) """
|
|
printf("%f", toPrint);
|
|
"""
|
|
}
|
|
return;
|
|
}
|
|
|
|
fun print(toPrint: double) : void{
|
|
__if_comp__ __C__ {
|
|
simple_passthrough(toPrint = toPrint::) """
|
|
printf("%f", toPrint);
|
|
"""
|
|
}
|
|
return;
|
|
}
|
|
|