1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128 | 1
1
1
1
1
1
343
1
2
1
1
1
1
1
1
1
1
1
1
4
1
1
1
6
6
6
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
26
1
| SCScript.install(function(sc) {
"use strict";
require("./Object");
var $ = sc.lang.$;
var $nil = $.nil;
sc.lang.klass.refine("Class", function(builder) {
builder.addMethod("toString", function() {
return String(this.__className);
});
builder.addMethod("class", function() {
if (this.__isMetaClass) {
return $("Class");
}
return $("Meta_" + this.__className);
});
builder.addMethod("name", function() {
return $.String(this.__className);
});
// TODO: implements superclass
// TODO: implements asClass
// TODO: implements initClass
// TODO: implements $initClassTree
// TODO: implements $allClasses
// TODO: implements findMethod
// TODO: implements findRespondingMethodFor
// TODO: implements findOverriddenMethod
// TODO: implements superclassesDo
// TODO: implements while
// TODO: implements dumpByteCodes
// TODO: implements dumpClassSubtree
// TODO: implements dumpInterface
// TODO: implements asString
// TODO: implements printOn
// TODO: implements storeOn
// TODO: implements archiveAsCompileString
// TODO: implements hasHelpFile
// TODO: implements helpFilePath
// TODO: implements help
// TODO: implements openHelpFile
// TODO: implements shallowCopy
// TODO: implements openCodeFile
// TODO: implements classVars
// TODO: implements inspectorClass
// TODO: implements findReferences
// TODO: implements $findAllReferences
// TODO: implements allSubclasses
// TODO: implements superclasses
builder.addMethod("[]", function($anArray) {
var $newCollection;
var array, i, imax;
$newCollection = this.new($anArray.size());
array = $anArray._;
for (i = 0, imax = array.length; i < imax; ++i) {
$newCollection.$("add", [ array[i] ]);
}
return $newCollection;
});
});
sc.lang.klass.define("Process", function(builder) {
builder.addMethod("__init__", function() {
this.__super__("__init__");
this._$interpreter = $nil;
this._$mainThread = $nil;
});
builder.addMethod("interpreter", function() {
return this._$interpreter;
});
builder.addMethod("mainThread", function() {
return this._$mainThread;
});
});
sc.lang.klass.define("Main : Process");
sc.lang.klass.define("Interpreter", function(builder) {
builder.addProperty("<>", "a");
builder.addProperty("<>", "b");
builder.addProperty("<>", "c");
builder.addProperty("<>", "d");
builder.addProperty("<>", "e");
builder.addProperty("<>", "f");
builder.addProperty("<>", "g");
builder.addProperty("<>", "h");
builder.addProperty("<>", "i");
builder.addProperty("<>", "j");
builder.addProperty("<>", "k");
builder.addProperty("<>", "l");
builder.addProperty("<>", "m");
builder.addProperty("<>", "n");
builder.addProperty("<>", "o");
builder.addProperty("<>", "p");
builder.addProperty("<>", "q");
builder.addProperty("<>", "r");
builder.addProperty("<>", "s");
builder.addProperty("<>", "t");
builder.addProperty("<>", "u");
builder.addProperty("<>", "v");
builder.addProperty("<>", "w");
builder.addProperty("<>", "x");
builder.addProperty("<>", "y");
builder.addProperty("<>", "z");
builder.addMethod("__init__", function() {
this.__super__("__init__");
});
builder.addMethod("clearAll", function() {
for (var i = 97; i <= 122; i++) {
this["_$" + String.fromCharCode(i)] = null;
}
return this;
});
});
});
|