38 lines
565 B
Fortran
38 lines
565 B
Fortran
/**
|
|
* Constants
|
|
*/
|
|
const str nl = "\n";
|
|
|
|
plex Terminal {
|
|
nat handle;
|
|
|
|
init() {
|
|
handle = open("/dev/term/0", 0);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Main function
|
|
*/
|
|
function main() {
|
|
Terminal term();
|
|
real a = 5.0;
|
|
do (int i = 5000, 0, -1) {
|
|
a = a + 5.0;
|
|
}
|
|
nat b = a as nat;
|
|
pln(term, "Enter a string:");
|
|
str user_string = read(term, 32);
|
|
pln(term, a.str);
|
|
pln(term, b.str);
|
|
pln(term, user_string);
|
|
}
|
|
|
|
/**
|
|
* Print with a newline
|
|
*/
|
|
function pln(Terminal term, str message) {
|
|
write(term, message, message.length);
|
|
write(term, nl, nl.length);
|
|
}
|