--- a/CodeGeneratorTool.st Wed Oct 25 01:06:33 2006 +0200
+++ b/CodeGeneratorTool.st Wed Oct 25 09:33:28 2006 +0200
@@ -9,7 +9,6 @@
other person. No title to or ownership of the software is
hereby transferred.
"
-
"{ Package: 'stx:libtool' }"
Object subclass:#CodeGeneratorTool
@@ -976,6 +975,53 @@
self executeCollectedChangesNamed:('Add Parametrized Instance Creation to ' , className).
!
+createPoolInitializationCodeFor:aClass
+ |nonMetaClass metaClass className poolVars code initCode runValue maxValue|
+
+ self startCollectChanges.
+
+ nonMetaClass := aClass theNonMetaclass.
+ metaClass := aClass theMetaclass.
+ className := nonMetaClass name.
+
+ poolVars := nonMetaClass classVarNames.
+
+ initCode := WriteStream on: String new.
+ initCode nextPutLine:'initialize'.
+
+ poolVars do:[:eachVariableName |
+ |oldValue thisValue|
+
+ oldValue := nonMetaClass classVarAt:eachVariableName.
+ oldValue notNil ifTrue:[
+ thisValue := oldValue.
+ ] ifFalse:[
+ thisValue := nil.
+ ].
+ initCode
+ nextPutAll:' ';
+ nextPutAll:eachVariableName;
+ nextPutAll:' := ';
+ nextPutAll:thisValue storeString;
+ nextPutLine:'.'.
+ ].
+ initCode cr.
+ initCode nextPutLine:' "'.
+ initCode nextPutLine:' ',className, ' initialize'.
+ initCode nextPutLine:' "'.
+
+ self
+ compile:(initCode contents)
+ forClass:metaClass
+ inCategory:'class initialization'.
+
+ self executeCollectedChangesNamed:('Generate Pool Initialization Code for ' , className).
+
+ aClass initialize.
+
+ "Created: / 25-10-2006 / 09:28:40 / cg"
+!
+
createStandardPrintOnMethodIn:aClass
"create a #printOn: method (I'm tired of typing)"
@@ -1916,5 +1962,5 @@
!CodeGeneratorTool class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libtool/CodeGeneratorTool.st,v 1.49 2006-09-05 16:21:58 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libtool/CodeGeneratorTool.st,v 1.50 2006-10-25 07:33:28 cg Exp $'
! !