where is the main
authorClaus Gittinger <cg@exept.de>
Fri, 02 Nov 2001 10:41:24 +0100
changeset 6136 e509e0a0141a
parent 6135 ba749c6a3d2b
child 6137 5b754994e887
where is the main
Class.st
--- a/Class.st	Thu Nov 01 17:44:22 2001 +0100
+++ b/Class.st	Fri Nov 02 10:41:24 2001 +0100
@@ -269,6 +269,16 @@
     "Modified: 20.6.1997 / 17:18:26 / cg"
 !
 
+isStartableWithMain
+    "return true, if this is an application class,
+     which can be started via #main"
+
+    ^ self theMetaclass implements:#main
+
+    "Created: / 2.11.2001 / 09:37:01 / cg"
+    "Modified: / 2.11.2001 / 09:48:05 / cg"
+!
+
 isVisualStartable
     "return true, if this is an application class,
      which can be started via #open"
@@ -1616,6 +1626,56 @@
     "
 
     "Modified: 19.3.1997 / 18:47:10 / cg"
+!
+
+storeBookkeepingInfoOn: aBinaryStorageWriter
+    "New class variables are stored as separate definitions."
+    aBinaryStorageWriter storeSymbolCollection: Array new.
+    Smalltalk isSmalltalkX ifTrue:[
+        aBinaryStorageWriter storeString: self nameSpace name
+    ] ifFalse:[
+        aBinaryStorageWriter storeString: self asNameSpace importString
+    ].
+
+    "Created: / 30.10.2001 / 19:15:32 / cg"
+    "Modified: / 31.10.2001 / 08:51:11 / cg"
+!
+
+storeGeneralStructureOn: aCodeWriter
+    "Store information to allow defining a Class on load.  Defer to the
+     class to include enough information to permit shape change of
+     both the class and its instances  where the class's superclass
+     may have changed."
+
+    | checkBookkeepingPosition |
+
+    aCodeWriter storeIndexOf: self environment.
+    aCodeWriter storeIndexOf: self superclass.
+    aCodeWriter storeSymbol: self name.
+    aCodeWriter storeLong: self class format.
+    aCodeWriter storeLong: self class instVarNames size.
+    aCodeWriter storeStringCollection: self class allInstVarNames.
+    aCodeWriter storeLong: self format.
+    aCodeWriter storeLong: self instVarNames size.
+    aCodeWriter storeStringCollection: self allInstVarNames.
+
+    "Now write whatever additional bookkeeping info is required by the class.
+     Since classes may override storeBookkeepingInfoOn:, and since we support
+     absent class loading it is possible that an attempt might be made to load a
+     subclass of an absent class which has a special implementation of
+     storeBookkeepingInfoOn:.  To check for this also record the size of the
+     bookkeeping info so that on load one can check that the bookkeeping info
+     has been read."
+
+    checkBookkeepingPosition := aCodeWriter stream position.
+    aCodeWriter storeLong: 0.
+    self storeBookkeepingInfoOn: aCodeWriter.
+    aCodeWriter stream
+            withPosition: checkBookkeepingPosition
+            do: [:endOfBookkeepingPosition|
+                    aCodeWriter storeLong: endOfBookkeepingPosition - checkBookkeepingPosition]
+
+    "Created: / 30.10.2001 / 19:14:49 / cg"
 ! !
 
 !Class methodsFor:'changes management'!
@@ -4645,5 +4705,5 @@
 !Class class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Class.st,v 1.401 2001-10-18 13:01:38 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Class.st,v 1.402 2001-11-02 09:41:24 cg Exp $'
 ! !