cfad47cfa3/t3compiler/tads3/test/data/enum.t

4b825dc642cb6eb9a060e54bf8d69288fbee4904cfad47cfa334b206c65f22086bcc5d63e6f70944
1
/*
2
 *   enumerator
3
 */
4
5
#include "tads.h"
6
#include "t3.h"
7
8
enum apple, orange, grape, banana, pear, plum, cherry;
9
10
enum token tokWordDict, tokWordUnk, tokPunctuation, tokInvalid;
11
12
preinit()
13
{
14
}
15
16
/* ------------------------------------------------------------------------ */
17
/*
18
 *   some boilerplate setup stuff 
19
 */
20
21
class RuntimeError: object
22
    construct(errno, ...) { errno_ = errno; }
23
    display = "Runtime error: <<exceptionMessage>>"
24
    errno_ = 0
25
    exceptionMessage = ''
26
;
27
28
_say_embed(str) { tadsSay(str); }
29
30
_main(args)
31
{
32
    try
33
    {
34
        t3SetSay(&_say_embed);
35
        if (!global.preinited_)
36
        {
37
            preinit();
38
            global.preinited_ = true;
39
        }
40
        if (!t3GetVMPreinitMode())
41
            main();
42
    }
43
    catch (RuntimeError rte)
44
    {
45
        "\n<<rte.display>>\n";
46
    }
47
}
48
49
global: object
50
    preinited_ = nil
51
;