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