resin 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/amber/css/amber-normalize.css +73 -73
- data/amber/css/amber-normalize.less +1 -1
- data/amber/css/amber.css +106 -106
- data/amber/css/helios.css +242 -0
- data/amber/images/hsplitter.png +0 -0
- data/amber/images/vsplitter.png +0 -0
- data/amber/js/Benchfib.deploy.js +116 -38
- data/amber/js/Benchfib.js +120 -42
- data/amber/js/Canvas.deploy.js +674 -403
- data/amber/js/Canvas.js +682 -411
- data/amber/js/Compiler-AST.deploy.js +1150 -0
- data/amber/js/Compiler-AST.js +1591 -0
- data/amber/js/Compiler-Core.deploy.js +1562 -0
- data/amber/js/Compiler-Core.js +1972 -0
- data/amber/js/Compiler-Exceptions.deploy.js +114 -0
- data/amber/js/Compiler-Exceptions.js +161 -0
- data/amber/js/Compiler-IR.deploy.js +2326 -0
- data/amber/js/Compiler-IR.js +3146 -0
- data/amber/js/Compiler-Inlining.deploy.js +1147 -0
- data/amber/js/Compiler-Inlining.js +1514 -0
- data/amber/js/Compiler-Semantic.deploy.js +1207 -0
- data/amber/js/Compiler-Semantic.js +1628 -0
- data/amber/js/Compiler-Tests.deploy.js +646 -60
- data/amber/js/Compiler-Tests.js +843 -82
- data/amber/js/Compiler.deploy.js +1097 -159
- data/amber/js/Compiler.js +1414 -161
- data/amber/js/Examples.deploy.js +31 -15
- data/amber/js/Examples.js +33 -17
- data/amber/js/Helios-Announcements.deploy.js +127 -0
- data/amber/js/Helios-Announcements.js +157 -0
- data/amber/js/Helios-Browser.deploy.js +1473 -0
- data/amber/js/Helios-Browser.js +1953 -0
- data/amber/js/Helios-Commands.deploy.js +403 -0
- data/amber/js/Helios-Commands.js +563 -0
- data/amber/js/Helios-Core.deploy.js +1070 -0
- data/amber/js/Helios-Core.js +1445 -0
- data/amber/js/Helios-Environments.deploy.js +132 -0
- data/amber/js/Helios-Environments.js +179 -0
- data/amber/js/Helios-Inspector.deploy.js +855 -0
- data/amber/js/Helios-Inspector.js +1155 -0
- data/amber/js/Helios-KeyBindings.deploy.js +753 -0
- data/amber/js/Helios-KeyBindings.js +1023 -0
- data/amber/js/Helios-Layout.deploy.js +383 -0
- data/amber/js/Helios-Layout.js +523 -0
- data/amber/js/Helios-Workspace.deploy.js +799 -0
- data/amber/js/Helios-Workspace.js +1074 -0
- data/amber/js/IDE.deploy.js +2541 -1490
- data/amber/js/IDE.js +2721 -1660
- data/amber/js/Importer-Exporter.deploy.js +671 -0
- data/amber/js/Importer-Exporter.js +816 -0
- data/amber/js/Kernel-Announcements.deploy.js +137 -20
- data/amber/js/Kernel-Announcements.js +176 -22
- data/amber/js/Kernel-Classes.deploy.js +555 -168
- data/amber/js/Kernel-Classes.js +662 -205
- data/amber/js/Kernel-Collections.deploy.js +1403 -618
- data/amber/js/Kernel-Collections.js +1545 -690
- data/amber/js/Kernel-Exceptions.deploy.js +109 -45
- data/amber/js/Kernel-Exceptions.js +123 -49
- data/amber/js/Kernel-Methods.deploy.js +196 -81
- data/amber/js/Kernel-Methods.js +214 -89
- data/amber/js/Kernel-Objects.deploy.js +1542 -1117
- data/amber/js/Kernel-Objects.js +1593 -1148
- data/amber/js/Kernel-Tests.deploy.js +1725 -772
- data/amber/js/Kernel-Tests.js +2301 -1123
- data/amber/js/Kernel-Transcript.deploy.js +23 -25
- data/amber/js/Kernel-Transcript.js +24 -26
- data/amber/js/SUnit.deploy.js +204 -131
- data/amber/js/SUnit.js +222 -139
- data/amber/js/Spaces.deploy.js +240 -0
- data/amber/js/Spaces.js +326 -0
- data/amber/js/amber.js +26 -7
- data/amber/js/boot.js +65 -47
- data/amber/js/init.js +1 -1
- data/amber/js/lib/CodeMirror/amber.css +21 -21
- data/amber/js/lib/CodeMirror/codemirror.css +119 -13
- data/amber/js/lib/CodeMirror/codemirror.js +2219 -1220
- data/amber/js/lib/CodeMirror/smalltalk.js +134 -129
- data/amber/js/lib/bootstrap/css/bootstrap.css +5837 -0
- data/amber/js/lib/bootstrap/css/bootstrap.min.css +841 -0
- data/amber/js/lib/bootstrap/img/glyphicons-halflings-white.png +0 -0
- data/amber/js/lib/bootstrap/img/glyphicons-halflings.png +0 -0
- data/amber/js/lib/bootstrap/js/bootstrap.js +2038 -0
- data/amber/js/lib/bootstrap/js/bootstrap.min.js +7 -0
- data/amber/js/lib/jQuery/jquery-1.8.2.min.js +2 -0
- data/amber/js/lib/jQuery/jquery-ui-1.8.24.custom.min.js +125 -0
- data/amber/st/Compiler-AST.st +505 -0
- data/amber/st/Compiler-Core.st +835 -0
- data/amber/st/Compiler-Exceptions.st +87 -0
- data/amber/st/Compiler-IR.st +1097 -0
- data/amber/st/Compiler-Inlining.st +650 -0
- data/amber/st/Compiler-Semantic.st +558 -0
- data/amber/st/Compiler-Tests.st +285 -381
- data/amber/st/Compiler.st +725 -2
- data/amber/st/Helios-Announcements.st +104 -0
- data/amber/st/Helios-Browser.st +708 -0
- data/amber/st/Helios-Commands.st +223 -0
- data/amber/st/Helios-Core.st +532 -0
- data/amber/st/Helios-Environments.st +98 -0
- data/amber/st/Helios-Inspector.st +367 -0
- data/amber/st/Helios-KeyBindings.st +337 -0
- data/amber/st/Helios-Layout.st +199 -0
- data/amber/st/Helios-Workspace.st +367 -0
- data/amber/st/IDE.st +75 -53
- data/amber/st/Importer-Exporter.st +386 -0
- data/amber/st/Kernel-Announcements.st +92 -0
- data/amber/st/Kernel-Classes.st +137 -15
- data/amber/st/Kernel-Collections.st +137 -47
- data/amber/st/Kernel-Exceptions.st +14 -0
- data/amber/st/Kernel-Methods.st +9 -1
- data/amber/st/Kernel-Objects.st +29 -5
- data/amber/st/Kernel-Tests.st +545 -199
- data/amber/st/SUnit.st +10 -0
- data/amber/st/Spaces.st +142 -0
- data/lib/resin/app.rb +1 -1
- metadata +86 -31
- data/amber/js/lib/jQuery/jquery-1.4.4.min.js +0 -167
- data/amber/js/lib/jQuery/jquery-1.6.4.min.js +0 -4
|
@@ -0,0 +1,386 @@
|
|
|
1
|
+
Smalltalk current createPackage: 'Importer-Exporter' properties: #{}!
|
|
2
|
+
Object subclass: #ChunkParser
|
|
3
|
+
instanceVariableNames: 'stream'
|
|
4
|
+
package: 'Importer-Exporter'!
|
|
5
|
+
|
|
6
|
+
!ChunkParser methodsFor: 'accessing'!
|
|
7
|
+
|
|
8
|
+
stream: aStream
|
|
9
|
+
stream := aStream
|
|
10
|
+
! !
|
|
11
|
+
|
|
12
|
+
!ChunkParser methodsFor: 'reading'!
|
|
13
|
+
|
|
14
|
+
nextChunk
|
|
15
|
+
"The chunk format (Smalltalk Interchange Format or Fileout format)
|
|
16
|
+
is a trivial format but can be a bit tricky to understand:
|
|
17
|
+
- Uses the exclamation mark as delimiter of chunks.
|
|
18
|
+
- Inside a chunk a normal exclamation mark must be doubled.
|
|
19
|
+
- A non empty chunk must be a valid Smalltalk expression.
|
|
20
|
+
- A chunk on top level with a preceding empty chunk is an instruction chunk:
|
|
21
|
+
- The object created by the expression then takes over reading chunks.
|
|
22
|
+
|
|
23
|
+
This metod returns next chunk as a String (trimmed), empty String (all whitespace) or nil."
|
|
24
|
+
|
|
25
|
+
| char result chunk |
|
|
26
|
+
result := '' writeStream.
|
|
27
|
+
[char := stream next.
|
|
28
|
+
char notNil] whileTrue: [
|
|
29
|
+
char = '!!' ifTrue: [
|
|
30
|
+
stream peek = '!!'
|
|
31
|
+
ifTrue: [stream next "skipping the escape double"]
|
|
32
|
+
ifFalse: [^result contents trimBoth "chunk end marker found"]].
|
|
33
|
+
result nextPut: char].
|
|
34
|
+
^nil "a chunk needs to end with !!"
|
|
35
|
+
! !
|
|
36
|
+
|
|
37
|
+
!ChunkParser class methodsFor: 'not yet classified'!
|
|
38
|
+
|
|
39
|
+
on: aStream
|
|
40
|
+
^self new stream: aStream
|
|
41
|
+
! !
|
|
42
|
+
|
|
43
|
+
Object subclass: #Exporter
|
|
44
|
+
instanceVariableNames: ''
|
|
45
|
+
package: 'Importer-Exporter'!
|
|
46
|
+
|
|
47
|
+
!Exporter methodsFor: 'fileOut'!
|
|
48
|
+
|
|
49
|
+
exportAll
|
|
50
|
+
"Export all packages in the system."
|
|
51
|
+
|
|
52
|
+
^String streamContents: [:stream |
|
|
53
|
+
Smalltalk current packages do: [:pkg |
|
|
54
|
+
stream nextPutAll: (self exportPackage: pkg name)]]
|
|
55
|
+
!
|
|
56
|
+
|
|
57
|
+
exportClass: aClass
|
|
58
|
+
"Export a single class. Subclasses override these methods."
|
|
59
|
+
|
|
60
|
+
^String streamContents: [:stream |
|
|
61
|
+
self exportDefinitionOf: aClass on: stream.
|
|
62
|
+
self exportMethodsOf: aClass on: stream.
|
|
63
|
+
self exportMetaDefinitionOf: aClass on: stream.
|
|
64
|
+
self exportMethodsOf: aClass class on: stream]
|
|
65
|
+
!
|
|
66
|
+
|
|
67
|
+
exportPackage: packageName
|
|
68
|
+
"Export a given package by name."
|
|
69
|
+
|
|
70
|
+
| package |
|
|
71
|
+
^String streamContents: [:stream |
|
|
72
|
+
package := Smalltalk current packageAt: packageName.
|
|
73
|
+
self exportPackageDefinitionOf: package on: stream.
|
|
74
|
+
|
|
75
|
+
"Export classes in dependency order.
|
|
76
|
+
Update (issue #171): Remove duplicates for export"
|
|
77
|
+
package sortedClasses asSet do: [:each |
|
|
78
|
+
stream nextPutAll: (self exportClass: each)].
|
|
79
|
+
self exportPackageExtensionsOf: package on: stream]
|
|
80
|
+
! !
|
|
81
|
+
|
|
82
|
+
!Exporter methodsFor: 'private'!
|
|
83
|
+
|
|
84
|
+
classNameFor: aClass
|
|
85
|
+
^aClass isMetaclass
|
|
86
|
+
ifTrue: [aClass instanceClass name, '.klass']
|
|
87
|
+
ifFalse: [
|
|
88
|
+
aClass isNil
|
|
89
|
+
ifTrue: ['nil']
|
|
90
|
+
ifFalse: [aClass name]]
|
|
91
|
+
!
|
|
92
|
+
|
|
93
|
+
exportDefinitionOf: aClass on: aStream
|
|
94
|
+
aStream
|
|
95
|
+
nextPutAll: 'smalltalk.addClass(';
|
|
96
|
+
nextPutAll: '''', (self classNameFor: aClass), ''', ';
|
|
97
|
+
nextPutAll: 'smalltalk.', (self classNameFor: aClass superclass);
|
|
98
|
+
nextPutAll: ', ['.
|
|
99
|
+
aClass instanceVariableNames
|
|
100
|
+
do: [:each | aStream nextPutAll: '''', each, '''']
|
|
101
|
+
separatedBy: [aStream nextPutAll: ', '].
|
|
102
|
+
aStream
|
|
103
|
+
nextPutAll: '], ''';
|
|
104
|
+
nextPutAll: aClass category, '''';
|
|
105
|
+
nextPutAll: ');'.
|
|
106
|
+
aClass comment notEmpty ifTrue: [
|
|
107
|
+
aStream
|
|
108
|
+
lf;
|
|
109
|
+
nextPutAll: 'smalltalk.';
|
|
110
|
+
nextPutAll: (self classNameFor: aClass);
|
|
111
|
+
nextPutAll: '.comment=';
|
|
112
|
+
nextPutAll: aClass comment asJavascript].
|
|
113
|
+
aStream lf
|
|
114
|
+
!
|
|
115
|
+
|
|
116
|
+
exportMetaDefinitionOf: aClass on: aStream
|
|
117
|
+
aClass class instanceVariableNames isEmpty ifFalse: [
|
|
118
|
+
aStream
|
|
119
|
+
nextPutAll: 'smalltalk.', (self classNameFor: aClass class);
|
|
120
|
+
nextPutAll: '.iVarNames = ['.
|
|
121
|
+
aClass class instanceVariableNames
|
|
122
|
+
do: [:each | aStream nextPutAll: '''', each, '''']
|
|
123
|
+
separatedBy: [aStream nextPutAll: ','].
|
|
124
|
+
aStream nextPutAll: '];', String lf]
|
|
125
|
+
!
|
|
126
|
+
|
|
127
|
+
exportMethod: aMethod of: aClass on: aStream
|
|
128
|
+
aStream
|
|
129
|
+
nextPutAll: 'smalltalk.addMethod(';lf;
|
|
130
|
+
nextPutAll: aMethod selector asSelector asJavascript, ',';lf;
|
|
131
|
+
nextPutAll: 'smalltalk.method({';lf;
|
|
132
|
+
nextPutAll: 'selector: ', aMethod selector asJavascript, ',';lf;
|
|
133
|
+
nextPutAll: 'category: ''', aMethod category, ''',';lf;
|
|
134
|
+
nextPutAll: 'fn: ', aMethod fn compiledSource, ',';lf;
|
|
135
|
+
nextPutAll: 'args: ', aMethod arguments asJavascript, ','; lf;
|
|
136
|
+
nextPutAll: 'source: ', aMethod source asJavascript, ',';lf;
|
|
137
|
+
nextPutAll: 'messageSends: ', aMethod messageSends asJavascript, ',';lf;
|
|
138
|
+
nextPutAll: 'referencedClasses: ', aMethod referencedClasses asJavascript.
|
|
139
|
+
aStream
|
|
140
|
+
lf;
|
|
141
|
+
nextPutAll: '}),';lf;
|
|
142
|
+
nextPutAll: 'smalltalk.', (self classNameFor: aClass);
|
|
143
|
+
nextPutAll: ');';lf;lf
|
|
144
|
+
!
|
|
145
|
+
|
|
146
|
+
exportMethodsOf: aClass on: aStream
|
|
147
|
+
"Issue #143: sort methods alphabetically"
|
|
148
|
+
|
|
149
|
+
((aClass methodDictionary values) sorted: [:a :b | a selector <= b selector]) do: [:each |
|
|
150
|
+
(each category match: '^\*') ifFalse: [
|
|
151
|
+
self exportMethod: each of: aClass on: aStream]].
|
|
152
|
+
aStream lf
|
|
153
|
+
!
|
|
154
|
+
|
|
155
|
+
exportPackageDefinitionOf: package on: aStream
|
|
156
|
+
aStream
|
|
157
|
+
nextPutAll: 'smalltalk.addPackage(';
|
|
158
|
+
nextPutAll: '''', package name, ''', ', package propertiesAsJSON , ');'.
|
|
159
|
+
aStream lf
|
|
160
|
+
!
|
|
161
|
+
|
|
162
|
+
exportPackageExtensionsOf: package on: aStream
|
|
163
|
+
"Issue #143: sort classes and methods alphabetically"
|
|
164
|
+
|
|
165
|
+
| name |
|
|
166
|
+
name := package name.
|
|
167
|
+
(Package sortedClasses: Smalltalk current classes) do: [:each |
|
|
168
|
+
{each. each class} do: [:aClass |
|
|
169
|
+
((aClass methodDictionary values) sorted: [:a :b | a selector <= b selector]) do: [:method |
|
|
170
|
+
(method category match: '^\*', name) ifTrue: [
|
|
171
|
+
self exportMethod: method of: aClass on: aStream ]]]]
|
|
172
|
+
! !
|
|
173
|
+
|
|
174
|
+
Exporter subclass: #ChunkExporter
|
|
175
|
+
instanceVariableNames: ''
|
|
176
|
+
package: 'Importer-Exporter'!
|
|
177
|
+
|
|
178
|
+
!ChunkExporter methodsFor: 'not yet classified'!
|
|
179
|
+
|
|
180
|
+
chunkEscape: aString
|
|
181
|
+
"Replace all occurrences of !! with !!!! and trim at both ends."
|
|
182
|
+
|
|
183
|
+
^(aString replace: '!!' with: '!!!!') trimBoth
|
|
184
|
+
!
|
|
185
|
+
|
|
186
|
+
classNameFor: aClass
|
|
187
|
+
^aClass isMetaclass
|
|
188
|
+
ifTrue: [aClass instanceClass name, ' class']
|
|
189
|
+
ifFalse: [
|
|
190
|
+
aClass isNil
|
|
191
|
+
ifTrue: ['nil']
|
|
192
|
+
ifFalse: [aClass name]]
|
|
193
|
+
!
|
|
194
|
+
|
|
195
|
+
exportDefinitionOf: aClass on: aStream
|
|
196
|
+
"Chunk format."
|
|
197
|
+
|
|
198
|
+
aStream
|
|
199
|
+
nextPutAll: (self classNameFor: aClass superclass);
|
|
200
|
+
nextPutAll: ' subclass: #', (self classNameFor: aClass); lf;
|
|
201
|
+
nextPutAll: ' instanceVariableNames: '''.
|
|
202
|
+
aClass instanceVariableNames
|
|
203
|
+
do: [:each | aStream nextPutAll: each]
|
|
204
|
+
separatedBy: [aStream nextPutAll: ' '].
|
|
205
|
+
aStream
|
|
206
|
+
nextPutAll: ''''; lf;
|
|
207
|
+
nextPutAll: ' package: ''', aClass category, '''!!'; lf.
|
|
208
|
+
aClass comment notEmpty ifTrue: [
|
|
209
|
+
aStream
|
|
210
|
+
nextPutAll: '!!', (self classNameFor: aClass), ' commentStamp!!';lf;
|
|
211
|
+
nextPutAll: (self chunkEscape: aClass comment), '!!';lf].
|
|
212
|
+
aStream lf
|
|
213
|
+
!
|
|
214
|
+
|
|
215
|
+
exportMetaDefinitionOf: aClass on: aStream
|
|
216
|
+
|
|
217
|
+
aClass class instanceVariableNames isEmpty ifFalse: [
|
|
218
|
+
aStream
|
|
219
|
+
nextPutAll: (self classNameFor: aClass class);
|
|
220
|
+
nextPutAll: ' instanceVariableNames: '''.
|
|
221
|
+
aClass class instanceVariableNames
|
|
222
|
+
do: [:each | aStream nextPutAll: each]
|
|
223
|
+
separatedBy: [aStream nextPutAll: ' '].
|
|
224
|
+
aStream
|
|
225
|
+
nextPutAll: '''!!'; lf; lf]
|
|
226
|
+
!
|
|
227
|
+
|
|
228
|
+
exportMethod: aMethod of: aClass on: aStream
|
|
229
|
+
aStream
|
|
230
|
+
lf; lf; nextPutAll: (self chunkEscape: aMethod source); lf;
|
|
231
|
+
nextPutAll: '!!'
|
|
232
|
+
!
|
|
233
|
+
|
|
234
|
+
exportMethods: methods category: category of: aClass on: aStream
|
|
235
|
+
"Issue #143: sort methods alphabetically"
|
|
236
|
+
|
|
237
|
+
aStream
|
|
238
|
+
nextPutAll: '!!', (self classNameFor: aClass);
|
|
239
|
+
nextPutAll: ' methodsFor: ''', category, '''!!'.
|
|
240
|
+
(methods sorted: [:a :b | a selector <= b selector]) do: [:each |
|
|
241
|
+
self exportMethod: each of: aClass on: aStream].
|
|
242
|
+
aStream nextPutAll: ' !!'; lf; lf
|
|
243
|
+
!
|
|
244
|
+
|
|
245
|
+
exportMethodsOf: aClass on: aStream
|
|
246
|
+
"Issue #143: sort protocol alphabetically"
|
|
247
|
+
|
|
248
|
+
| map |
|
|
249
|
+
map := Dictionary new.
|
|
250
|
+
aClass protocolsDo: [:category :methods |
|
|
251
|
+
(category match: '^\*') ifFalse: [ map at: category put: methods ]].
|
|
252
|
+
(map keys sorted: [:a :b | a <= b ]) do: [:category | | methods |
|
|
253
|
+
methods := map at: category.
|
|
254
|
+
self
|
|
255
|
+
exportMethods: methods
|
|
256
|
+
category: category
|
|
257
|
+
of: aClass
|
|
258
|
+
on: aStream ]
|
|
259
|
+
!
|
|
260
|
+
|
|
261
|
+
exportPackageDefinitionOf: package on: aStream
|
|
262
|
+
"Chunk format."
|
|
263
|
+
|
|
264
|
+
aStream
|
|
265
|
+
nextPutAll: 'Smalltalk current createPackage: ''', package name,
|
|
266
|
+
''' properties: ', package properties storeString, '!!'; lf.
|
|
267
|
+
!
|
|
268
|
+
|
|
269
|
+
exportPackageExtensionsOf: package on: aStream
|
|
270
|
+
"We need to override this one too since we need to group
|
|
271
|
+
all methods in a given protocol under a leading methodsFor: chunk
|
|
272
|
+
for that class."
|
|
273
|
+
|
|
274
|
+
"Issue #143: sort protocol alphabetically"
|
|
275
|
+
|
|
276
|
+
| name map |
|
|
277
|
+
name := package name.
|
|
278
|
+
(Package sortedClasses: Smalltalk current classes) do: [:each |
|
|
279
|
+
{each. each class} do: [:aClass |
|
|
280
|
+
map := Dictionary new.
|
|
281
|
+
aClass protocolsDo: [:category :methods |
|
|
282
|
+
(category match: '^\*', name) ifTrue: [ map at: category put: methods ]].
|
|
283
|
+
(map keys sorted: [:a :b | a <= b ]) do: [:category | | methods |
|
|
284
|
+
methods := map at: category.
|
|
285
|
+
self exportMethods: methods category: category of: aClass on: aStream ]]]
|
|
286
|
+
! !
|
|
287
|
+
|
|
288
|
+
Exporter subclass: #StrippedExporter
|
|
289
|
+
instanceVariableNames: ''
|
|
290
|
+
package: 'Importer-Exporter'!
|
|
291
|
+
|
|
292
|
+
!StrippedExporter methodsFor: 'private'!
|
|
293
|
+
|
|
294
|
+
exportDefinitionOf: aClass on: aStream
|
|
295
|
+
aStream
|
|
296
|
+
nextPutAll: 'smalltalk.addClass(';
|
|
297
|
+
nextPutAll: '''', (self classNameFor: aClass), ''', ';
|
|
298
|
+
nextPutAll: 'smalltalk.', (self classNameFor: aClass superclass);
|
|
299
|
+
nextPutAll: ', ['.
|
|
300
|
+
aClass instanceVariableNames
|
|
301
|
+
do: [:each | aStream nextPutAll: '''', each, '''']
|
|
302
|
+
separatedBy: [aStream nextPutAll: ', '].
|
|
303
|
+
aStream
|
|
304
|
+
nextPutAll: '], ''';
|
|
305
|
+
nextPutAll: aClass category, '''';
|
|
306
|
+
nextPutAll: ');'.
|
|
307
|
+
aStream lf
|
|
308
|
+
!
|
|
309
|
+
|
|
310
|
+
exportMethod: aMethod of: aClass on: aStream
|
|
311
|
+
aStream
|
|
312
|
+
nextPutAll: 'smalltalk.addMethod(';lf;
|
|
313
|
+
nextPutAll: aMethod selector asSelector asJavascript, ',';lf;
|
|
314
|
+
nextPutAll: 'smalltalk.method({';lf;
|
|
315
|
+
nextPutAll: 'selector: ', aMethod selector asJavascript, ',';lf;
|
|
316
|
+
nextPutAll: 'fn: ', aMethod fn compiledSource;lf;
|
|
317
|
+
nextPutAll: '}),';lf;
|
|
318
|
+
nextPutAll: 'smalltalk.', (self classNameFor: aClass);
|
|
319
|
+
nextPutAll: ');';lf;lf
|
|
320
|
+
! !
|
|
321
|
+
|
|
322
|
+
Object subclass: #Importer
|
|
323
|
+
instanceVariableNames: ''
|
|
324
|
+
package: 'Importer-Exporter'!
|
|
325
|
+
|
|
326
|
+
!Importer methodsFor: 'fileIn'!
|
|
327
|
+
|
|
328
|
+
import: aStream
|
|
329
|
+
| chunk result parser lastEmpty |
|
|
330
|
+
parser := ChunkParser on: aStream.
|
|
331
|
+
lastEmpty := false.
|
|
332
|
+
[chunk := parser nextChunk.
|
|
333
|
+
chunk isNil] whileFalse: [
|
|
334
|
+
chunk isEmpty
|
|
335
|
+
ifTrue: [lastEmpty := true]
|
|
336
|
+
ifFalse: [
|
|
337
|
+
result := Compiler new evaluateExpression: chunk.
|
|
338
|
+
lastEmpty
|
|
339
|
+
ifTrue: [
|
|
340
|
+
lastEmpty := false.
|
|
341
|
+
result scanFrom: parser]]]
|
|
342
|
+
! !
|
|
343
|
+
|
|
344
|
+
Object subclass: #PackageLoader
|
|
345
|
+
instanceVariableNames: ''
|
|
346
|
+
package: 'Importer-Exporter'!
|
|
347
|
+
|
|
348
|
+
!PackageLoader methodsFor: 'not yet classified'!
|
|
349
|
+
|
|
350
|
+
initializePackageNamed: packageName prefix: aString
|
|
351
|
+
|
|
352
|
+
(Package named: packageName) classes do: [ :each |
|
|
353
|
+
<smalltalk.init(each)>.
|
|
354
|
+
each initialize. ].
|
|
355
|
+
|
|
356
|
+
(Package named: packageName)
|
|
357
|
+
commitPathJs: '/', aString, '/js';
|
|
358
|
+
commitPathSt: '/', aString, '/st'
|
|
359
|
+
!
|
|
360
|
+
|
|
361
|
+
loadPackage: packageName prefix: aString
|
|
362
|
+
| url |
|
|
363
|
+
url := '/', aString, '/js/', packageName, '.js'.
|
|
364
|
+
jQuery
|
|
365
|
+
ajax: url
|
|
366
|
+
options: #{
|
|
367
|
+
'type' -> 'GET'.
|
|
368
|
+
'dataType' -> 'script'.
|
|
369
|
+
'complete' -> [ :jqXHR :textStatus |
|
|
370
|
+
jqXHR readyState = 4
|
|
371
|
+
ifTrue: [ self initializePackageNamed: packageName prefix: aString ] ].
|
|
372
|
+
'error' -> [ window alert: 'Could not load package at: ', url ]
|
|
373
|
+
}
|
|
374
|
+
!
|
|
375
|
+
|
|
376
|
+
loadPackages: aCollection prefix: aString
|
|
377
|
+
aCollection do: [ :each |
|
|
378
|
+
self loadPackage: each prefix: aString ]
|
|
379
|
+
! !
|
|
380
|
+
|
|
381
|
+
!PackageLoader class methodsFor: 'not yet classified'!
|
|
382
|
+
|
|
383
|
+
loadPackages: aCollection prefix: aString
|
|
384
|
+
^ self new loadPackages: aCollection prefix: aString
|
|
385
|
+
! !
|
|
386
|
+
|
|
@@ -59,3 +59,95 @@ on: aClass do: aBlock
|
|
|
59
59
|
yourself)
|
|
60
60
|
! !
|
|
61
61
|
|
|
62
|
+
Announcer subclass: #SystemAnnouncer
|
|
63
|
+
instanceVariableNames: ''
|
|
64
|
+
package: 'Kernel-Announcements'!
|
|
65
|
+
!SystemAnnouncer commentStamp!
|
|
66
|
+
My unique instance #current is the global announcer handling all Amber system-related announces!
|
|
67
|
+
|
|
68
|
+
SystemAnnouncer class instanceVariableNames: 'current'!
|
|
69
|
+
|
|
70
|
+
!SystemAnnouncer class methodsFor: 'accessing'!
|
|
71
|
+
|
|
72
|
+
current
|
|
73
|
+
^ current ifNil: [ current := super new ]
|
|
74
|
+
! !
|
|
75
|
+
|
|
76
|
+
!SystemAnnouncer class methodsFor: 'instance creation'!
|
|
77
|
+
|
|
78
|
+
new
|
|
79
|
+
self shouldNotImplement
|
|
80
|
+
! !
|
|
81
|
+
|
|
82
|
+
Object subclass: #SystemAnnouncement
|
|
83
|
+
instanceVariableNames: 'theClass'
|
|
84
|
+
package: 'Kernel-Announcements'!
|
|
85
|
+
!SystemAnnouncement commentStamp!
|
|
86
|
+
I am the superclass of all system announcements!
|
|
87
|
+
|
|
88
|
+
!SystemAnnouncement methodsFor: 'accessing'!
|
|
89
|
+
|
|
90
|
+
theClass
|
|
91
|
+
^ theClass
|
|
92
|
+
!
|
|
93
|
+
|
|
94
|
+
theClass: aClass
|
|
95
|
+
theClass := aClass
|
|
96
|
+
! !
|
|
97
|
+
|
|
98
|
+
SystemAnnouncement subclass: #ClassAdded
|
|
99
|
+
instanceVariableNames: ''
|
|
100
|
+
package: 'Kernel-Announcements'!
|
|
101
|
+
!ClassAdded commentStamp!
|
|
102
|
+
I am emitted when a class is added to the system.
|
|
103
|
+
See ClassBuilder >> #addSubclassOf:... methods!
|
|
104
|
+
|
|
105
|
+
SystemAnnouncement subclass: #ClassCommentChanged
|
|
106
|
+
instanceVariableNames: ''
|
|
107
|
+
package: 'Kernel-Announcements'!
|
|
108
|
+
!ClassCommentChanged commentStamp!
|
|
109
|
+
I am emitted when the comment of a class changes. (Behavior >> #comment)!
|
|
110
|
+
|
|
111
|
+
SystemAnnouncement subclass: #ClassDefinitionChanged
|
|
112
|
+
instanceVariableNames: ''
|
|
113
|
+
package: 'Kernel-Announcements'!
|
|
114
|
+
!ClassDefinitionChanged commentStamp!
|
|
115
|
+
I am emitted when the defintion of a class changes.
|
|
116
|
+
See ClassBuilder >> #class:instanceVariableNames:!
|
|
117
|
+
|
|
118
|
+
SystemAnnouncement subclass: #ClassRemoved
|
|
119
|
+
instanceVariableNames: ''
|
|
120
|
+
package: 'Kernel-Announcements'!
|
|
121
|
+
!ClassRemoved commentStamp!
|
|
122
|
+
I am emitted when a class is removed.
|
|
123
|
+
See Smalltalk >> #removeClass:!
|
|
124
|
+
|
|
125
|
+
SystemAnnouncement subclass: #ClassRenamed
|
|
126
|
+
instanceVariableNames: ''
|
|
127
|
+
package: 'Kernel-Announcements'!
|
|
128
|
+
!ClassRenamed commentStamp!
|
|
129
|
+
I am emitted when a class is renamed.
|
|
130
|
+
See ClassBuilder >> #renameClass:to:!
|
|
131
|
+
|
|
132
|
+
SystemAnnouncement subclass: #MethodAnnouncement
|
|
133
|
+
instanceVariableNames: 'method'
|
|
134
|
+
package: 'Kernel-Announcements'!
|
|
135
|
+
|
|
136
|
+
!MethodAnnouncement methodsFor: 'accessing'!
|
|
137
|
+
|
|
138
|
+
method
|
|
139
|
+
^ method
|
|
140
|
+
!
|
|
141
|
+
|
|
142
|
+
method: aCompiledMethod
|
|
143
|
+
method := aCompiledMethod
|
|
144
|
+
! !
|
|
145
|
+
|
|
146
|
+
MethodAnnouncement subclass: #MethodAdded
|
|
147
|
+
instanceVariableNames: ''
|
|
148
|
+
package: 'Kernel-Announcements'!
|
|
149
|
+
|
|
150
|
+
MethodAnnouncement subclass: #MethodRemoved
|
|
151
|
+
instanceVariableNames: ''
|
|
152
|
+
package: 'Kernel-Announcements'!
|
|
153
|
+
|