equal
deleted
inserted
replaced
10 ! |
10 ! |
11 |
11 |
12 |
12 |
13 !SmalltalkXGenerator class methodsFor:'instance creation'! |
13 !SmalltalkXGenerator class methodsFor:'instance creation'! |
14 |
14 |
15 generate:aStringOrFilename class:aClass namespace:aNameSpace |
|
16 |temp| |
|
17 |
|
18 temp := Generator onFile:aStringOrFilename. |
|
19 temp |
|
20 startGeneration:aClass |
|
21 nameSpace:aNameSpace |
|
22 toFile:aStringOrFilename , '.st'. |
|
23 ^ temp. |
|
24 |
|
25 "Created: / 08-02-2008 / 08:55:08 / janfrog" |
|
26 ! |
|
27 |
|
28 new |
15 new |
29 ^ self basicNew initialize. |
16 ^ self basicNew initialize. |
30 |
|
31 "Created: / 08-02-2008 / 08:55:08 / janfrog" |
|
32 ! |
|
33 |
|
34 on: aStream |
|
35 |
|
36 |gen| |
|
37 |
|
38 gen := self new. |
|
39 gen inputStream: aStream; |
|
40 parseDef; |
|
41 analyse. |
|
42 ^gen |
|
43 |
|
44 "Modified: / 24-11-2007 / 12:20:27 / haja" |
|
45 "Created: / 08-02-2008 / 08:55:08 / janfrog" |
|
46 ! |
|
47 |
|
48 onFile: aStringOrFilename |
|
49 |
|
50 ^self on: aStringOrFilename asFilename readStream |
|
51 |
17 |
52 "Created: / 08-02-2008 / 08:55:08 / janfrog" |
18 "Created: / 08-02-2008 / 08:55:08 / janfrog" |
53 ! ! |
19 ! ! |
54 |
20 |
55 !SmalltalkXGenerator methodsFor:'processing'! |
21 !SmalltalkXGenerator methodsFor:'processing'! |
191 cEnumNode isForeign ifTrue:[^self]. |
157 cEnumNode isForeign ifTrue:[^self]. |
192 |
158 |
193 (changeset add: ClassDefinitionChange new) |
159 (changeset add: ClassDefinitionChange new) |
194 superClassName: |
160 superClassName: |
195 SharedPool fullName; |
161 SharedPool fullName; |
|
162 nameSpaceName: |
|
163 cEnumNode smalltalkNamespace; |
196 className: |
164 className: |
197 cEnumNode smalltalkClassNameWithNamespace; |
165 cEnumNode smalltalkClassName; |
198 classVariableNames: |
166 classVariableNames: |
199 (String streamContents: |
167 (String streamContents: |
200 [:s| |
168 [:s| |
201 cEnumNode values do: |
169 cEnumNode values do: |
202 [:cEnumValueNode| |
170 [:cEnumValueNode| |
240 [:s| |
208 [:s| |
241 s nextPutAll: cEnumValueNode smalltalkName; cr; cr. |
209 s nextPutAll: cEnumValueNode smalltalkName; cr; cr. |
242 s tab; nextPut:$^; nextPutAll: cEnumValueNode smalltalkName])] |
210 s tab; nextPut:$^; nextPutAll: cEnumValueNode smalltalkName])] |
243 |
211 |
244 "Created: / 03-07-2008 / 20:10:34 / Jan Vrany <vranyj1@fel.cvut.cz>" |
212 "Created: / 03-07-2008 / 20:10:34 / Jan Vrany <vranyj1@fel.cvut.cz>" |
245 "Modified: / 04-07-2008 / 11:58:27 / Jan Vrany <vranyj1@fel.cvut.cz>" |
213 "Modified: / 22-01-2009 / 19:21:45 / Jan Vrany <vranyj1@fel.cvut.cz>" |
246 ! |
214 ! |
247 |
215 |
248 visitCFunctionNode:functionNode |
216 visitCFunctionNode:functionNode |
249 (changeset add:MethodDefinitionChange new) |
217 (changeset add:MethodDefinitionChange new) |
250 className:(functionNode smalltalkClassNameWithNamespace , ' class') |
218 className:(functionNode smalltalkClassNameWithNamespace , ' class') |
292 smalltalkClass |
260 smalltalkClass |
293 ifNil: |
261 ifNil: |
294 [(changeset add: ClassDefinitionChange new) |
262 [(changeset add: ClassDefinitionChange new) |
295 superClassName: |
263 superClassName: |
296 ExternalStructure fullName; |
264 ExternalStructure fullName; |
|
265 nameSpaceName: |
|
266 cStructNode smalltalkNamespace; |
297 className: |
267 className: |
298 cStructNode smalltalkClassNameWithNamespace; |
268 cStructNode smalltalkClassName; |
299 category: |
269 category: |
300 cStructNode smalltalkCategory; |
270 cStructNode smalltalkCategory; |
301 package: |
271 package: |
302 cStructNode smalltalkPackage] |
272 cStructNode smalltalkPackage] |
303 ifNotNil: |
273 ifNotNil: |
321 |
291 |
322 cStructNode fields do: |
292 cStructNode fields do: |
323 [:fieldNode|self visit: fieldNode] |
293 [:fieldNode|self visit: fieldNode] |
324 |
294 |
325 "Created: / 10-07-2008 / 08:46:12 / Jan Vrany <vranyj1@fel.cvut.cz>" |
295 "Created: / 10-07-2008 / 08:46:12 / Jan Vrany <vranyj1@fel.cvut.cz>" |
326 "Modified: / 09-09-2008 / 20:12:35 / Jan Vrany <vranyj1@fel.cvut.cz>" |
296 "Modified: / 22-01-2009 / 19:20:47 / Jan Vrany <vranyj1@fel.cvut.cz>" |
327 ! |
297 ! |
328 |
298 |
329 visitCTypedefNode: typedefNode |
299 visitCTypedefNode: typedefNode |
330 |
300 |
331 "Created: / 03-07-2008 / 22:00:49 / Jan Vrany <vranyj1@fel.cvut.cz>" |
301 "Created: / 03-07-2008 / 22:00:49 / Jan Vrany <vranyj1@fel.cvut.cz>" |