48 lines
709 B
C
48 lines
709 B
C
/**
|
|
* Constants
|
|
*/
|
|
str term_namespace = "/dev/term/0";
|
|
str nl = "\n";
|
|
int x = 0;
|
|
int y = 1;
|
|
|
|
plex Terminal {
|
|
nat handle;
|
|
}
|
|
|
|
/**
|
|
* Main function
|
|
*/
|
|
function main() {
|
|
int tmp0 = x;
|
|
int tmp1 = y;
|
|
int tmp2 = add(tmp0, tmp1);
|
|
str tmp3 = tmp2 as str;
|
|
pln(tmp3);
|
|
}
|
|
|
|
/**
|
|
* Add two numbers together
|
|
*/
|
|
function add(int a, int b) int {
|
|
int tmp0 = a + b;
|
|
return tmp0;
|
|
}
|
|
|
|
/**
|
|
* Print with a newline
|
|
*/
|
|
function pln(str message) {
|
|
str term_ns = term_namespace;
|
|
int mode = 0;
|
|
|
|
Terminal term = open(term_ns, mode);
|
|
|
|
int msg_len = message.length;
|
|
write(term, message, msg_len);
|
|
|
|
str nl_local = nl;
|
|
int nl_len = nl.length;
|
|
write(term, nl_local, nl_len);
|
|
}
|