CodeGeneratorTool.st
branchjv
changeset 16695 a8eda516effa
parent 16445 6bc184e74f9c
child 16738 1a1b5477fdd5
equal deleted inserted replaced
16689:70b43a6c4755 16695:a8eda516effa
  1158     self subclassResponsibility
  1158     self subclassResponsibility
  1159 
  1159 
  1160     "Created: / 10-02-2011 / 16:32:36 / cg"
  1160     "Created: / 10-02-2011 / 16:32:36 / cg"
  1161 !
  1161 !
  1162 
  1162 
  1163 createStandaloneStartupCodeFor:aClass
  1163 createStandaloneStartupCodeFor:arg
  1164     "create an empty console application framework"
  1164     "raise an error: must be redefined in concrete subclass(es)"
  1165 
  1165 
  1166     |metaClass nonMetaclass className txt|
  1166     ^ self subclassResponsibility
  1167 
       
  1168     targetClass := aClass.
       
  1169 
       
  1170     self startCollectChanges.
       
  1171 
       
  1172     metaClass := aClass theMetaclass.
       
  1173     nonMetaclass := aClass theNonMetaclass.
       
  1174     className := nonMetaclass name.
       
  1175 
       
  1176     (metaClass includesSelector:#applicationRegistryPath) ifFalse:[
       
  1177         txt := self codeFor_standAloneApplicationRegistryPathFor:nonMetaclass.
       
  1178         self
       
  1179             compile:(txt bindWith:className)
       
  1180             forClass:metaClass 
       
  1181             inCategory:'constants & defaults'.
       
  1182     ].
       
  1183     (metaClass includesSelector:#applicationUUID) ifFalse:[
       
  1184         txt := self codeFor_standAloneApplicationUUID.
       
  1185         self
       
  1186             compile:(txt bindWith:className)
       
  1187             forClass:metaClass 
       
  1188             inCategory:'constants & defaults'.
       
  1189     ].
       
  1190     (metaClass includesSelector:#usage) ifFalse:[
       
  1191         txt := self codeFor_standAloneUsage.
       
  1192         self
       
  1193             compile:(txt bindWith:className)
       
  1194             forClass:metaClass 
       
  1195             inCategory:'startup'.
       
  1196     ].
       
  1197     (metaClass includesSelector:#'main:') ifFalse:[
       
  1198         txt := self codeFor_standAloneMain.
       
  1199         self
       
  1200             compile:(txt bindWith:className)
       
  1201             forClass:metaClass 
       
  1202             inCategory:'startup'.
       
  1203 
       
  1204         (metaClass includesSelector:#'realMain:') ifFalse:[
       
  1205             txt := self codeFor_standAloneRealMainMethodFor:nonMetaclass.
       
  1206             self
       
  1207                 compile:(txt bindWith:className)
       
  1208                 forClass:metaClass 
       
  1209                 inCategory:'startup'.
       
  1210         ].
       
  1211 
       
  1212     ].
       
  1213 
       
  1214     self executeCollectedChangesNamed:('Add StandaloneStartup Code for ' , className).
       
  1215 
       
  1216     "Created: / 19-08-2011 / 02:01:31 / cg"
       
  1217 !
  1167 !
  1218 
  1168 
  1219 createStandardPrintOnMethodIn:aClass
  1169 createStandardPrintOnMethodIn:aClass
  1220     "create a #printOn: method (I'm tired of typing)"
  1170     "create a #printOn: method (I'm tired of typing)"
  1221 
  1171 
  1656     self subclassResponsibility
  1606     self subclassResponsibility
  1657 
  1607 
  1658     "Created: / 19-08-2011 / 02:12:51 / cg"
  1608     "Created: / 19-08-2011 / 02:12:51 / cg"
  1659 !
  1609 !
  1660 
  1610 
  1661 codeFor_standAloneMain
  1611 codeFor_standAloneMainFor:arg
  1662     self subclassResponsibility
  1612     "raise an error: must be redefined in concrete subclass(es)"
  1663 
  1613 
  1664     "Created: / 19-08-2011 / 02:12:44 / cg"
  1614     ^ self subclassResponsibility
  1665 !
       
  1666 
       
  1667 codeFor_standAloneRealMainMethodFor:aClass
       
  1668     self subclassResponsibility
       
  1669 
       
  1670     "Created: / 21-01-2012 / 12:28:45 / cg"
       
  1671 !
  1615 !
  1672 
  1616 
  1673 codeFor_standAloneUsage
  1617 codeFor_standAloneUsage
  1674     self subclassResponsibility
  1618     self subclassResponsibility
  1675 
  1619