| | 1 | /* |
| | 2 | * Test of t3core. Compile with '-nodef', since we don't want to pick up |
| | 3 | * the normal library startup code. |
| | 4 | */ |
| | 5 | |
| | 6 | #include <t3.h> |
| | 7 | #include <tadsgen.h> |
| | 8 | #include <systype.h> |
| | 9 | #include <core.h> |
| | 10 | |
| | 11 | /* |
| | 12 | * this is the low-level main entrypoint - the VM calls this directly at |
| | 13 | * program start-up |
| | 14 | */ |
| | 15 | _main(args) |
| | 16 | { |
| | 17 | /* set our default display function */ |
| | 18 | t3SetSay(say); |
| | 19 | |
| | 20 | /* invoke our normal 'main' */ |
| | 21 | main(args); |
| | 22 | } |
| | 23 | |
| | 24 | main(args) |
| | 25 | { |
| | 26 | "Hello, world!\n"; |
| | 27 | |
| | 28 | "\nThis is a little test of the t3core program. We'll just\n |
| | 29 | read text from the keyboard and echo it to the display.\n |
| | 30 | When you're done, enter a blank line to quit...\n\n"; |
| | 31 | for (;;) |
| | 32 | { |
| | 33 | local str; |
| | 34 | |
| | 35 | "Enter some text> "; |
| | 36 | str = readText(); |
| | 37 | if (str == '') |
| | 38 | break; |
| | 39 | |
| | 40 | "You entered \"<<str>>\"!\n\n"; |
| | 41 | } |
| | 42 | |
| | 43 | "Thanks for joining us!\n"; |
| | 44 | } |
| | 45 | |
| | 46 | say(txt) |
| | 47 | { |
| | 48 | /* ignore nil values */ |
| | 49 | if (txt == nil) |
| | 50 | return; |
| | 51 | |
| | 52 | /* write text to the t3core sample output routine (from core.h) */ |
| | 53 | displayText(txt); |
| | 54 | } |