| | 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 | <<y.getSuperclassList().length()>>\n"; |
| | 40 | "first superclass of BigNumber = IntrinsicClass: |
| | 41 | <<sayTF(y.getSuperclassList()[1] == IntrinsicClass)>>\n"; |
| | 42 | } |
| | 43 | |
| | 44 | sayTF(val) |
| | 45 | { |
| | 46 | if (val) |
| | 47 | "yes"; |
| | 48 | else |
| | 49 | "no"; |
| | 50 | } |
| | 51 | |
| | 52 | preinit() |
| | 53 | { |
| | 54 | } |
| | 55 | |