| 1 |
/* |
| 2 |
* Object Tests |
| 3 |
*/ |
| 4 |
|
| 5 |
#include "tads.h" |
| 6 |
|
| 7 |
/* define the T3 system interface */ |
| 8 |
intrinsic 't3vm/010000' |
| 9 |
{ |
| 10 |
t3RunGC(); |
| 11 |
t3SetSay(funcptr); |
| 12 |
t3GetVMVsn(); |
| 13 |
t3GetVMID(); |
| 14 |
t3GetVMBanner(); |
| 15 |
t3GetVMPreinitMode(); |
| 16 |
} |
| 17 |
|
| 18 |
test: object |
| 19 |
p1 = 'This is test.p1\n' |
| 20 |
p2 = 'This is test.p2\n' |
| 21 |
; |
| 22 |
|
| 23 |
test2: test |
| 24 |
p1 = 'This is test2.p1\n' |
| 25 |
|
| 26 |
p3(a, b) |
| 27 |
{ |
| 28 |
"Here we are in test2.p3!\n"; |
| 29 |
"test2.p3 arguments: a = << a >>, b = << b >>\n"; |
| 30 |
} |
| 31 |
|
| 32 |
p4 = ('this is test2.p4: self.p5 = ' + p5) |
| 33 |
p5 = 'This is test2.p5!\n' |
| 34 |
p6 = "This is a double-quoted string in test2.p6!!!\n" |
| 35 |
p7 = "This is test2.p7, a dstring with embedding - |
| 36 |
self.p3(9,10) = << p3(9,10) >>!!!\n" |
| 37 |
; |
| 38 |
|
| 39 |
function _say_embed(str) |
| 40 |
{ |
| 41 |
tadsSay(str); |
| 42 |
} |
| 43 |
|
| 44 |
function _main(args) |
| 45 |
{ |
| 46 |
t3SetSay(&_say_embed); |
| 47 |
|
| 48 |
"Property test - calling test.p1\n"; |
| 49 |
tadsSay(test.p1); |
| 50 |
|
| 51 |
"calling test.p2\n"; |
| 52 |
tadsSay(test.p2); |
| 53 |
|
| 54 |
"calling test2.p1\n"; |
| 55 |
tadsSay(test2.p1); |
| 56 |
|
| 57 |
test.p3 = 1; |
| 58 |
|
| 59 |
"calling test2.p2\n"; |
| 60 |
tadsSay(test2.p2); |
| 61 |
|
| 62 |
"calling test2.p3(1,'x')\n"; |
| 63 |
test2.p3(1, 'x'); |
| 64 |
|
| 65 |
"calling test2.p4\n"; |
| 66 |
tadsSay(test2.p4); |
| 67 |
|
| 68 |
"calling test2.p5\n"; |
| 69 |
tadsSay(test2.p5); |
| 70 |
|
| 71 |
"calling test2.p6\n"; |
| 72 |
test2.p6; |
| 73 |
|
| 74 |
"calling test2.p7\n"; |
| 75 |
test2.p7; |
| 76 |
|
| 77 |
"Done!\n"; |
| 78 |
} |
| 79 |
|