cfad47cfa3/t3compiler/tads3/include/tads.h

4b825dc642cb6eb9a060e54bf8d69288fbee4904cfad47cfa334b206c65f22086bcc5d63e6f70944
1
#charset "us-ascii"
2
3
/* 
4
 *   Copyright (c) 1999, 2006 Michael J. Roberts
5
 *.  This file is part of TADS 3.
6
 *   
7
 *   This file includes all of the standard TADS system headers, so programs
8
 *   can include this header alone rather than having to include all of the
9
 *   separate headers individually.  
10
 */
11
12
#ifndef TADS_H
13
#define TADS_H
14
15
/*
16
 *   To allow the standard library and header files to be used with
17
 *   alternative I/O intrinsics, we explicitly use macros for the I/O
18
 *   dependencies in the library - specifically, the I/O intrinsic header
19
 *   file name, and the name of the default stream output function.
20
 *   
21
 *   We define defaults for these if they aren't otherwise defined.  To
22
 *   compile library files with an alternative set of I/O intrinsics, define
23
 *   these symbols in the compiler (for example, by using the -D command-line
24
 *   option with t3make).  
25
 */
26
#ifndef TADS_IO_HEADER
27
#define TADS_IO_HEADER "tadsio.h"
28
#endif
29
#ifndef _tads_io_say
30
#define _tads_io_say(str) tadsSay(str)
31
#endif
32
33
34
/* include the T3 VM intrinsic function set */
35
#include "t3.h"
36
37
/* include the TADS general data manipulation function set */
38
#include "tadsgen.h"
39
40
/* include the TADS input/output function set */
41
#include TADS_IO_HEADER
42
43
/* include the system type definitions */
44
#include "systype.h"
45
46
47
/* ------------------------------------------------------------------------ */
48
/*
49
 *   Break out of a callback iteration, such as a forEachInstance() loop.
50
 *   This can be used within the callback code to break out of the loop.  
51
 */
52
#define breakLoop throw BreakLoopSignal
53
54
55
/* ------------------------------------------------------------------------ */
56
/*
57
 *   Define a property value using an expression that's evaluated once per
58
 *   instance of the class where the property is defined.  This is used like
59
 *   so:
60
 *   
61
 *   class MyClass: MySuperClass
62
 *.    prop1 = perInstance(new SubObject())
63
 *.  ;
64
 *   
65
 *   Now, for each instance of MyClass, prop1 will be set to a separate
66
 *   instance of SubObject.
67
 *   
68
 *   Note that the per-instance property value is set "on demand" in each
69
 *   instance.  This means that a particular instance's copy of the property
70
 *   will be set when the property is first evaluated.  Note in particular
71
 *   that the value won't necessary be computed at compile time or during
72
 *   pre-initialization, because the value for a particular instance won't be
73
 *   calculated until the property is first used for a that instance.  
74
 */
75
#define perInstance(expr) (self.(targetprop) = (expr))
76
77
 
78
#endif /* TADS_H */
79