Class.st
changeset 137 a8e039dcb872
parent 104 6fd21424d58e
child 139 19ccaf2031c8
--- a/Class.st	Mon Aug 22 14:37:10 1994 +0200
+++ b/Class.st	Mon Aug 22 16:43:03 1994 +0200
@@ -21,7 +21,7 @@
 COPYRIGHT (c) 1989 by Claus Gittinger
               All Rights Reserved
 
-$Header: /cvs/stx/stx/libbasic/Class.st,v 1.16 1994-08-11 21:34:59 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Class.st,v 1.17 1994-08-22 14:43:03 claus Exp $
 '!
 
 !Class class methodsFor:'documentation'!
@@ -42,7 +42,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libbasic/Class.st,v 1.16 1994-08-11 21:34:59 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Class.st,v 1.17 1994-08-22 14:43:03 claus Exp $
 "
 !
 
@@ -653,7 +653,7 @@
     aStream := self changesStream.
     aStream notNil ifTrue:[
         aClass fileOutClassInstVarDefinitionOn:aStream.
-        aStream nextPut:$!!.
+        aStream nextPut:(aStream class chunkSeparator).
         aStream cr.
         aStream close
     ]
@@ -667,7 +667,7 @@
     aStream := self changesStream.
     aStream notNil ifTrue:[
         aClass fileOutCommentOn:aStream.
-        aStream nextPut:$!!.
+        aStream nextPut:(aStream class chunkSeparator).
         aStream cr.
         aStream close
     ]
@@ -681,7 +681,7 @@
     aStream := self changesStream.
     aStream notNil ifTrue:[
         aStream nextPutAll:('Smalltalk renameClass:' , oldName , ' to:''' , newName , '''').
-        aStream nextPut:$!!.
+        aStream nextPut:(aStream class chunkSeparator).
         aStream cr.
         aStream close
     ]
@@ -695,7 +695,7 @@
     aStream := self changesStream.
     aStream notNil ifTrue:[
         aStream nextPutAll:('Smalltalk removeClass:' , oldName).
-        aStream nextPut:$!!.
+        aStream nextPut:(aStream class chunkSeparator).
         aStream cr.
         aStream close
     ]
@@ -933,11 +933,12 @@
     ^ (self methodsFor:aCategory) privateProtocol
 !
 
-binaryMethods
-    "return a ClassCategoryReader to read in binary methods for me.
-     The implementation of binary methods is not finished yet - it may even vanish."
+ignoredMethodsFor:aCategory
+    "this is a speciality of ST/X - it allows quick commenting of methods
+     from a source-file by replacing the 'methodsFor:' by 'ignoredMethodsFor'.
+     Returns a ClassCategoryReader to read in and skip methods."
 
-    ^ BinaryClassCategoryReader class:self category:'binary'
+    ^ (self methodsFor:aCategory) ignoreMethods
 !
 
 methods
@@ -1073,7 +1074,7 @@
 fileOutCategory:aCategory on:aStream
     "file out all methods belonging to aCategory, aString onto aStream"
 
-    |nMethods count|
+    |nMethods count sep|
 
     methodArray notNil ifTrue:[
         nMethods := 0.
@@ -1082,14 +1083,15 @@
                 nMethods := nMethods + 1
             ]
         ].
+	sep := aStream class chunkSeparator.
         (nMethods ~~ 0) ifTrue:[
-            aStream nextPut:$!!.
+            aStream nextPut:sep.
             self printClassNameOn:aStream.
             aStream nextPutAll:' methodsFor:'''.
             aCategory notNil ifTrue:[
                 aStream nextPutAll:aCategory
             ].
-            aStream nextPut:$'. aStream nextPut:$!!. aStream cr.
+            aStream nextPut:$'. aStream nextPut:sep. aStream cr.
             aStream cr.
             count := 1.
             methodArray do:[:aMethod |
@@ -1103,7 +1105,7 @@
                 ]
             ].
             aStream space.
-            aStream nextPut:$!!.
+            aStream nextPut:sep.
             aStream cr
         ]
     ]
@@ -1112,10 +1114,11 @@
 fileOutMethod:aMethod on:aStream
     "file out the method, aMethod onto aStream"
 
-    |cat|
+    |cat sep|
 
     methodArray notNil ifTrue:[
-        aStream nextPut:$!!.
+	sep := aStream class chunkSeparator.
+        aStream nextPut:sep.
         self printClassNameOn:aStream.
         aStream nextPutAll:' methodsFor:'''.
         cat := aMethod category.
@@ -1123,12 +1126,12 @@
             aStream nextPutAll:cat
         ].
         aStream nextPut:$'.
-        aStream nextPut:$!!.
+        aStream nextPut:sep.
         aStream cr.
         aStream cr.
         aStream nextChunkPut:(aMethod source).
         aStream space.
-        aStream nextPut:$!!.
+        aStream nextPut:sep.
         aStream cr
     ]
 !
@@ -1136,13 +1139,12 @@
 fileOutOn:aStream
     "file out my definition and all methods onto aStream"
 
-    |collectionOfCategories copyrightText|
+    |collectionOfCategories copyrightText sep|
 
     "
      if there is a copyright method, add a copyright
      at the beginning
     "
-
     (self class selectorArray includes:#copyright) ifTrue:[
         "
          get the copyright methods source,
@@ -1156,16 +1158,17 @@
             self error:'no source for class ' , name , ' available. Cannot fileOut'.
             ^ self
         ].
-        copyrightText := copyrightText asText.
-        copyrightText := copyrightText asStringFrom:2 to:(copyrightText size).
-        aStream nextPutAll:copyrightText.
+        copyrightText := copyrightText asCollectionOfLines.
+        copyrightText := copyrightText copyFrom:2 to:(copyrightText size).
+        copyrightText do:[:line | aStream nextPutAll:line. aStream cr.].
     ].
 
+    sep := aStream class chunkSeparator.
     "
      first, a timestamp
     "
     aStream nextPutAll:(Smalltalk timeStamp).
-    aStream nextPut:$!. 
+    aStream nextPut:sep. 
     aStream cr.
     aStream cr.
 
@@ -1173,7 +1176,7 @@
      then the definition
     "
     self fileOutDefinitionOn:aStream.
-    aStream nextPut:$!. 
+    aStream nextPut:sep. 
     aStream cr.
     aStream cr.
     "
@@ -1181,7 +1184,7 @@
     "
     self class instanceVariableString isBlank ifFalse:[
         self fileOutClassInstVarDefinitionOn:aStream.
-        aStream nextPut:$!. 
+        aStream nextPut:sep. 
         aStream cr.
         aStream cr
     ].
@@ -1193,7 +1196,7 @@
         aStream nextPutAll:name.
         aStream nextPutAll:' comment:'.
         aStream nextPutAll:(comment storeString).
-        aStream nextPut:$!.
+        aStream nextPut:sep.
         aStream cr.
         aStream cr
     ].
@@ -1223,7 +1226,7 @@
     "
     (self class implements:#initialize) ifTrue:[
         aStream nextPutAll:(name , ' initialize').
-        aStream nextPut:$!. 
+        aStream nextPut:sep.
         aStream cr
     ]
 !
@@ -1311,7 +1314,7 @@
 
 !Class methodsFor:'obsolete binary fileOut'!
 
-binaryFileOutMethodsOn:aStream
+XXbinaryFileOutMethodsOn:aStream
     "binary file out all methods onto aStream"
 
     |temporaryMethod index|
@@ -1345,7 +1348,7 @@
     ]
 !
 
-binaryFileOutOn:aStream
+XXbinaryFileOutOn:aStream
     "file out all methods onto aStream"
 
     aStream nextPut:$'.
@@ -1375,7 +1378,7 @@
     ]
 !
 
-binaryFileOut
+XXbinaryFileOut
     "create a file 'class.sb' consisting of all methods in myself.
      If the current project is not nil, create the file in the projects
      directory."