59 lines
925 B
Plaintext
59 lines
925 B
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(toPrint);
|
|
"""
|
|
}
|
|
return;
|
|
}
|
|
|
|
fun print(toPrint: string) : void {
|
|
var charArr = toPrint.toCharArray()
|
|
defer delete(charArr)
|
|
print(charArr);
|
|
}
|
|
|
|
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;
|
|
}
|
|
|