Debian Codegraph @

terps/tads/tads3/test/data/intcls2.t

raw
1 /*
2 * intrinsic classes
3 */
4
5 #include "tads.h"
6 #include "t3.h"
7 #include "bignum.h"
8 #include "dict.h"
9
10 dictionary gDict;
11
12 main(args)
13 {
14 local x, y;
15
16 x = BigNumber;
17 y = x.getPi(10);
18 "y = <<y>>\n";
19
20 "y is a BigNumber: <<sayTF(y.ofKind(BigNumber))>>\n";
21 "y is a Dictionary: <<sayTF(y.ofKind(Dictionary))>>\n";
22 "y is an IntrinsicClass: <<sayTF(y.ofKind(IntrinsicClass))>>\n";
23 "gDict is a Dictionary: <<sayTF(gDict.ofKind(Dictionary))>>\n";
24 "BigNumber is an IntrinsicClass:
25 <<sayTF(BigNumber.ofKind(IntrinsicClass))>>\n";
26 "IntrinsicClass is an IntrinsicClass:
27 <<sayTF(IntrinsicClass.ofKind(IntrinsicClass))>>\n";
28 "y is an Object: <<sayTF(y.ofKind(Object))>>\n";
29 "BigNumber is an Object: <<sayTF(BigNumber.ofKind(Object))>>\n";
30
31 "\b";
32
33 "first superclass of y = BigNumber:
34 <<sayTF(y.getSuperclassList()[1] == BigNumber)>>\n";
35 "first superclass of y = Dictionary:
36 <<sayTF(y.getSuperclassList()[1] == Dictionary)>>\n";
37
38 "number of superclasses of BigNumber:
39 <<BigNumber.getSuperclassList().length()>>\n";
40 "first superclass of BigNumber = IntrinsicClass:
41 <<sayTF(BigNumber.getSuperclassList()[1] == IntrinsicClass)>>\n";
42
43 "\b";
44
45 y = 'abc';
46 "y = '<<y>>' (constant)\n";
47 "y is a String: <<sayTF(y.ofKind(String))>>\n";
48 "y is a List: <<sayTF(y.ofKind(List))>>\n";
49 "y is a Object: <<sayTF(y.ofKind(Object))>>\n";
50 "first superclass of y = String:
51 <<sayTF(y.getSuperclassList()[1] == String)>>\n";
52 "first superclass of y = List:
53 <<sayTF(y.getSuperclassList()[1] == List)>>\n";
54
55 "\b";
56 y += 'def';
57 "y = '<<y>>' (object)\n";
58 "y is a String: <<sayTF(y.ofKind(String))>>\n";
59 "y is a List: <<sayTF(y.ofKind(List))>>\n";
60 "y is a Object: <<sayTF(y.ofKind(Object))>>\n";
61 "first superclass of y = String:
62 <<sayTF(y.getSuperclassList()[1] == String)>>\n";
63 "first superclass of y = List:
64 <<sayTF(y.getSuperclassList()[1] == List)>>\n";
65
66 "\b";
67 y = [1, 2, 3];
68 "y = [1,2,3] (constant)\n";
69 "y is a String: <<sayTF(y.ofKind(String))>>\n";
70 "y is a List: <<sayTF(y.ofKind(List))>>\n";
71 "y is a Object: <<sayTF(y.ofKind(Object))>>\n";
72 "first superclass of y = String:
73 <<sayTF(y.getSuperclassList()[1] == String)>>\n";
74 "first superclass of y = List:
75 <<sayTF(y.getSuperclassList()[1] == List)>>\n";
76
77 "\b";
78 y += [4,5];
79 "y = [1,2,3,4,5] (object)\n";
80 "y is a String: <<sayTF(y.ofKind(String))>>\n";
81 "y is a List: <<sayTF(y.ofKind(List))>>\n";
82 "y is a Object: <<sayTF(y.ofKind(Object))>>\n";
83 "first superclass of y = String:
84 <<sayTF(y.getSuperclassList()[1] == String)>>\n";
85 "first superclass of y = List:
86 <<sayTF(y.getSuperclassList()[1] == List)>>\n";
87 }
88
89 sayTF(val)
90 {
91 if (val)
92 "yes";
93 else
94 "no";
95 }
96
97 preinit()
98 {
99 }
100