PositionableStream.st
changeset 5393 7e2230bd4bad
parent 5308 8e8b5d2b3b8e
child 5441 e88302747bbd
--- a/PositionableStream.st	Mon May 22 12:54:36 2000 +0200
+++ b/PositionableStream.st	Mon May 22 13:10:37 2000 +0200
@@ -10,10 +10,12 @@
  hereby transferred.
 "
 
+"{ Package: 'stx:libbasic' }"
+
 PeekableStream subclass:#PositionableStream
 	instanceVariableNames:'collection position readLimit writeLimit'
 	classVariableNames:'ZeroPosition InvalidPositionErrorSignal ErrorDuringFileInSignal
-		ChunkSeparator CurrentFileInDirectoryQuerySignal'
+		CurrentFileInDirectoryQuerySignal ChunkSeparator'
 	poolDictionaries:''
 	category:'Streams'
 !
@@ -79,8 +81,6 @@
         CurrentFileInDirectoryQuerySignal notifierString:'query for current directory when filing in'.
         CurrentFileInDirectoryQuerySignal handlerBlock:[:ex | ex proceedWith:Filename currentDirectory].
 
-        ChunkSeparator := $!!.
-
         ZeroPosition := 1.
     ]
 
@@ -130,12 +130,6 @@
 
 !PositionableStream class methodsFor:'constants'!
 
-chunkSeparator
-    "return the chunk-separation character"
-
-    ^ ChunkSeparator
-!
-
 zeroPosition
     "return the number, which marks the initial position.
      Compatibility Notice:
@@ -223,76 +217,6 @@
 
 !PositionableStream methodsFor:'chunk input/output'!
 
-nextChunk
-    "return the next chunk, i.e. all characters up to the next
-     exclamation mark. Within the chunk, exclamation marks have to be doubled,
-     they are undoubled here.
-     Except for primitive code, in which doubling is not needed (allowed).
-     This exception was added to make it easier to edit primitive code with 
-     external editors. However, this means, that other Smalltalks cannot always 
-     read chunks containing primitive code 
-     - but that doesnt really matter, since C-primitives are an ST/X feature anyway."
-
-    |theString sep newString done thisChar nextChar inPrimitive
-     index    "{ Class:SmallInteger }"
-     currSize "{ Class:SmallInteger }" |
-
-    sep := ChunkSeparator.
-    theString := String new:500.
-    currSize := 500.
-    thisChar := self skipSeparators.
-    thisChar := self next.
-    index := 0.
-    done := false.
-    inPrimitive := false.
-
-    [done] whileFalse:[
-	((index + 2) <= currSize) ifFalse:[
-	    newString := String new:(currSize * 2).
-	    newString replaceFrom:1 to:currSize with:theString.
-	    currSize := currSize * 2.
-	    theString := newString
-	].
-	thisChar isNil ifTrue:[
-	    done := true
-	] ifFalse:[
-	    (thisChar == $% ) ifTrue:[
-		nextChar := self peek.
-		(nextChar == ${ ) ifTrue:[
-		    inPrimitive := true.
-		    index := index + 1.
-		    theString at:index put:thisChar.
-		    thisChar := self next
-		] ifFalse:[
-		    (nextChar == $} ) ifTrue:[
-			inPrimitive := false.
-			index := index + 1.
-			theString at:index put:thisChar.
-			thisChar := self next
-		    ]
-		]
-	    ] ifFalse:[
-		inPrimitive ifFalse:[
-		    (thisChar == sep) ifTrue:[
-			(self peek == sep) ifFalse:[
-			    done := true
-			] ifTrue:[
-			    self next
-			]
-		    ]
-		]
-	    ]
-	].
-	done ifFalse:[
-	    index := index + 1.
-	    theString at:index put:thisChar.
-	    thisChar := self next
-	]
-    ].
-    (index == 0) ifTrue:[^ ''].
-    ^ theString copyTo:index
-!
-
 nextChunkPut:aString
     "put aString as a chunk onto the receiver;
      double all exclamation marks except within primitives and append a 
@@ -304,7 +228,7 @@
      and code containing ST/X primitives cannot be loaded into other smalltalks anyway."
 
     self nextPutAllAsChunk:aString.
-    self nextPut:ChunkSeparator
+    self nextPut:(self class chunkSeparator)
 
     "Modified: 9.12.1995 / 15:56:54 / cg"
 !
@@ -327,7 +251,7 @@
     endIndex := aString size.
     endIndex == 0 ifTrue:[^ self].
 
-    sep := ChunkSeparator.
+    sep := self class chunkSeparator.
     stopChars := '{}' copyWith:sep.
 
     inPrimitive := false.
@@ -385,7 +309,7 @@
 nextPutChunkSeparator
     "append a chunk separator character"
 
-    self nextPut:ChunkSeparator
+    self nextPut:(self class chunkSeparator)
 
     "Created: 13.9.1995 / 17:39:26 / claus"
 ! !
@@ -495,7 +419,7 @@
 
     self skipSeparators.
     self atEnd ifFalse:[
-        sawExcla := self peekFor:ChunkSeparator.
+        sawExcla := self peekFor:(self class chunkSeparator).
         aString := self nextChunk.
         "/
         "/ handle empty chunks;
@@ -1109,6 +1033,6 @@
 !PositionableStream class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/PositionableStream.st,v 1.91 2000-03-21 12:52:01 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/PositionableStream.st,v 1.92 2000-05-22 11:10:37 cg Exp $'
 ! !
 PositionableStream initialize!