*** empty log message ***
authorStefan Vogel <sv@exept.de>
Mon, 25 Sep 2006 21:18:01 +0200
changeset 10010 69b2dbff964b
parent 10009 72c87816423e
child 10011 4df81726da18
*** empty log message ***
ProjectDefinition.st
--- a/ProjectDefinition.st	Mon Sep 25 21:17:00 2006 +0200
+++ b/ProjectDefinition.st	Mon Sep 25 21:18:01 2006 +0200
@@ -590,19 +590,26 @@
 !ProjectDefinition class methodsFor:'code generation'!
 
 classNamesAndAttributes_code_ignoreOldDefinition:ignoreOldDefinition
+    "generate method code returning all classes of the project.
+     Platform attributes are kept from the old definition.
+     If ignoreOldDefinition is true, the autoload attribute is set/reset if
+     the class is installed as autoloaded in the image. If false, it is taken
+     from an existing definition in #classNamesAndAttributes"
+
     ^ String streamContents:[:s |
+        |oldSpec|
+        oldSpec := self classNamesAndAttributes.
+
         s nextPutLine:'classNamesAndAttributes'.
+        s tab; nextPutLine:'"<className> or (<className> attributes...) in load order"'; cr.
         s nextPutLine:'    ^ #('.
-        s tab; nextPutLine:'"/ <className> or (<className> attributes...)'.
         self searchForClasses do:[:eachClass |
-            |oldSpec attributes oldSpecEntry|
-
-            oldSpec := self classNamesAndAttributes.
+            |attributes oldSpecEntry|
 
             (eachClass isLoaded not or:[eachClass isPrivate not]) ifTrue:[
                 oldSpecEntry := oldSpec detect:[:entry | entry first = eachClass name] ifNone:nil.
                 ignoreOldDefinition ifTrue:[
-                    "/ take autoload attribute from current state
+                    "take autoload attribute from classes state in the image"
                     oldSpecEntry notNil ifTrue:[
                         attributes := oldSpecEntry copyFrom:2.
                         attributes := attributes copyWithout:#autoload.
@@ -610,26 +617,24 @@
                         attributes := #()
                     ].
                     eachClass isLoaded ifFalse:[
-                        attributes isEmpty ifTrue:[
-                            attributes := attributes , #( autoload ).
-                        ]
+                         attributes := attributes copyWith:#autoload.
                     ].
                 ] ifFalse:[
-                    "/ keep any existing attribute
+                    "keep any existing attribute"
                     oldSpecEntry notNil ifTrue:[
                         attributes := oldSpecEntry copyFrom:2.
                     ] ifFalse:[
-                        attributes := eachClass isLoaded ifTrue:[ #() ] ifFalse:[ #( autoload ) ].
+                        attributes := eachClass isLoaded ifTrue:[ #() ] ifFalse:[ #(autoload) ].
                     ].
                 ].
 
-                s tab.
+                s tab; tab.
                 attributes isEmptyOrNil ifTrue:[
-                    s nextPutAll:eachClass name asString storeString.
+                    eachClass name printOn:s.
                 ] ifFalse:[
-                    s nextPutAll:'('; nextPutAll:eachClass name asString storeString.
-                    attributes do:[:eachAttribute | s nextPutAll:' '. s nextPutAll:eachAttribute storeString.].
-                    s nextPutAll:')'.
+                    s nextPut:$(. eachClass name printOn:s.
+                    attributes do:[:eachAttribute | s space. eachAttribute printOn:s.].
+                    s nextPut:$).
                 ].
                 s cr.
              ]
@@ -638,7 +643,7 @@
     ].
 
 "
-    stx_libbasic3 classNamesAndAttributes_code
+    stx_libbasic3 classNamesAndAttributes_code_ignoreOldDefinition:true
 "
 
     "Modified: / 08-08-2006 / 19:24:34 / fm"
@@ -1653,13 +1658,13 @@
 
             classNames := self compiled_classNames_common.
             classesLoaded := classNames 
-                        collect:[:nm | |cls| cls := Smalltalk classNamed:nm]
+                        collect:[:nm | Smalltalk classNamed:nm]
                         thenSelect:[:cls |  cls notNil and:[cls isLoaded] ].
             classNamesUnloaded := classNames 
                         select:[:nm | |cls| cls := Smalltalk classNamed:nm. cls isNil or:[cls isLoaded not]].
 
             classesSorted := Class classesSortedByLoadOrder:classesLoaded.
-            classNamesSorted := classesSorted collect:[:cls |cls name].
+            classNamesSorted := classesSorted collect:[:cls | cls name].
 
 
             s nextPutAll:'"/
@@ -2260,13 +2265,8 @@
                     s nextPutLine:newClassLine
                 ].
             classNames := self compiled_classNames_common.
-            classesLoaded := classNames 
-                        collect:[:nm | 
-                            |cls|
-
-                            cls := Smalltalk classNamed:nm
-                        ]
-                        thenSelect:[:cls | cls notNil and:[ cls isLoaded ] ].
+            classesLoaded := classNames collect:[:eachClassName | Smalltalk classNamed:eachClassName]
+                                        thenSelect:[:eachClass | eachClass notNil and:[eachClass isLoaded]].
             classNamesUnloaded := classNames 
                         select:[:nm | 
                             |cls|
@@ -2274,8 +2274,7 @@
                             cls := Smalltalk classNamed:nm.
                             cls isNil or:[ cls isLoaded not ]
                         ].
-            classNamesSorted := (Class classesSortedByLoadOrder:classesLoaded) 
-                        collect:[:cls | cls name ].
+            classNamesSorted := (Class classesSortedByLoadOrder:classesLoaded) collect:[:cls | cls name].
             classNamesSorted do:putLineForClassName.
             classNamesUnloaded do:putLineForClassName.
             self namesAndAttributesIn:(self additionalClassNamesAndAttributes)
@@ -2284,14 +2283,14 @@
                         putLineForClassName value:nm.
                     ].
                 ].
-            #( #('UNIX' unix)
-             #('WIN32' win32)
-             #('VMS' vms)
-             #('BEOS' beos) ) 
-                    pairsDo:[:ifdef :id | 
+            #( ('UNIX' unix)
+               ('WIN32' win32)
+               ('VMS' vms)
+               ('BEOS' beos) ) 
+                    pairsDo:[:ifdef :platformName | 
                         |archClassNames archClassesLoaded|
 
-                        archClassNames := self compiled_classNamesForPlatform:id.
+                        archClassNames := self compiled_classNamesForPlatform:platformName.
                         archClassNames notEmpty ifTrue:[
                             s nextPutLine:'#ifdef ' , ifdef.
                             archClassNames do:[:clsName | 
@@ -2305,7 +2304,9 @@
     "
      bosch_dapasx_datenbasis  generateClassLines_libInit_dot_cc
      bosch_dapasx_kernel  generateClassLines_libInit_dot_cc
-     stx_libbasic3 generateClassLines_libInit_dot_cc"
+     stx_libbasic3 generateClassLines_libInit_dot_cc
+    "
+
     "Modified: / 16-08-2006 / 18:52:10 / User"
     "Created: / 19-09-2006 / 22:47:50 / cg"
     "Modified: / 20-09-2006 / 11:47:25 / cg"
@@ -2409,12 +2410,9 @@
                 ].
             classNames := self compiled_classNames_common.
             classesLoaded := classNames 
-                        collect:[:className | 
-                            |cls|
-
-                            cls := Smalltalk classNamed:className
-                        ]
-                        thenSelect:[:cls | cls notNil and:[ cls isLoaded ] ].
+                        collect:[:className | Smalltalk classNamed:className]
+                        thenSelect:[:cls | cls notNil and:[cls isLoaded]].
+
             classesSorted := Class classesSortedByLoadOrder:classesLoaded.
             classesSorted do:putDependencyForClass.
             self namesAndAttributesIn:(self additionalClassNamesAndAttributes)
@@ -2429,22 +2427,20 @@
                 ].
             archClassNames := self compiled_classNamesForPlatform:whichArchitecture.
             archClassesLoaded := archClassNames 
-                        collect:[:className | 
-                            |cls|
-
-                            cls := Smalltalk classNamed:className
-                        ]
+                        collect:[:className | Smalltalk classNamed:className]
                         thenSelect:[:cls | cls notNil and:[ cls isLoaded ] ].
+
             archClassesLoaded notEmpty ifTrue:[
-                (Class classesSortedByLoadOrder:archClassesLoaded) 
-                    do:putDependencyForClass.
+                (Class classesSortedByLoadOrder:archClassesLoaded) do:putDependencyForClass.
             ].
             self hasExtensionMethods ifTrue:putDependencyForExtensions.
         ]
 
     "
      stx_libbasic3 generateDependencies:#unix
-     stx_libbasic3 generateDependencies:#win32"
+     stx_libbasic3 generateDependencies:#win32
+    "
+
     "Modified: / 16-08-2006 / 18:52:10 / User"
     "Created: / 14-09-2006 / 12:38:57 / cg"
     "Modified: / 14-09-2006 / 17:04:21 / cg"
@@ -2748,13 +2744,13 @@
 !
 
 searchForClasses
-    "answer all classes that belong to this project.
+    "answer all non-private classes that belong to this project.
      They are sorted in load order"
 
     ^ Class classesSortedByLoadOrder:(self searchForClassesWithProject: self package) 
 
     "
-     self searchForClasses
+     stx_libbasic3 searchForClasses
     "
 
     "Modified: / 07-08-2006 / 21:56:25 / fm"
@@ -3202,7 +3198,7 @@
 !ProjectDefinition class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/ProjectDefinition.st,v 1.81 2006-09-22 16:47:25 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/ProjectDefinition.st,v 1.82 2006-09-25 19:18:01 stefan Exp $'
 ! !
 
 ProjectDefinition initialize!