--- a/CodeGeneratorTool.st Thu Oct 22 17:44:56 2009 +0200
+++ b/CodeGeneratorTool.st Thu Oct 22 19:04:48 2009 +0200
@@ -113,6 +113,12 @@
^ self new createRedefinedInstanceCreationMethodsIn:aClass
!
+createStartupCodeFor:aClass forStartOf:anApplicationClass
+ "create standAloneStartup code"
+
+ ^ self new createStartupCodeFor:aClass forStartOf:anApplicationClass
+!
+
createTestCaseSampleCodeFor:aClass
"create an (almost) empty testCase class"
@@ -1390,6 +1396,33 @@
"Created: / 11.10.2001 / 22:18:55 / cg"
!
+createStartupCodeFor:aClass forStartOf:anApplicationClass
+ "create startup code (main)"
+
+ |nonMetaClass metaClass className txt|
+
+ self startCollectChanges.
+
+ nonMetaClass := aClass theNonMetaclass.
+ metaClass := aClass theMetaclass.
+ className := nonMetaClass name.
+
+ (metaClass includesSelector:#main:) ifFalse:[
+ txt :=
+'main:argv
+ self verboseInfo:''starting %1''.
+
+ %1 open.
+'.
+
+ self
+ compile:(txt bindWith:anApplicationClass name)
+ forClass:metaClass
+ inCategory:'startup'.
+ ].
+ self executeCollectedChangesNamed:('Add Startup Code to ' , className).
+!
+
createTestCaseSampleCodeFor:aClass
"create an (almost) empty testCase class"
@@ -2898,9 +2931,9 @@
!CodeGeneratorTool class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libtool/CodeGeneratorTool.st,v 1.69 2009-10-22 13:25:07 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libtool/CodeGeneratorTool.st,v 1.70 2009-10-22 17:04:48 cg Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libtool/CodeGeneratorTool.st,v 1.69 2009-10-22 13:25:07 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libtool/CodeGeneratorTool.st,v 1.70 2009-10-22 17:04:48 cg Exp $'
! !