--- a/PositionableStream.st Thu Feb 02 13:23:05 1995 +0100
+++ b/PositionableStream.st Thu Feb 02 13:25:49 1995 +0100
@@ -21,7 +21,7 @@
COPYRIGHT (c) 1989 by Claus Gittinger
All Rights Reserved
-$Header: /cvs/stx/stx/libbasic/PositionableStream.st,v 1.17 1994-10-28 01:28:03 claus Exp $
+$Header: /cvs/stx/stx/libbasic/PositionableStream.st,v 1.18 1995-02-02 12:25:33 claus Exp $
'!
!PositionableStream class methodsFor:'documentation'!
@@ -42,7 +42,7 @@
version
"
-$Header: /cvs/stx/stx/libbasic/PositionableStream.st,v 1.17 1994-10-28 01:28:03 claus Exp $
+$Header: /cvs/stx/stx/libbasic/PositionableStream.st,v 1.18 1995-02-02 12:25:33 claus Exp $
"
!
@@ -223,7 +223,13 @@
nextChunk
"return the next chunk, i.e. all characters up to the next
- non-doubled exclamation mark; undouble doubled exclamation marks"
+ 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 }"
@@ -287,32 +293,40 @@
nextChunkPut:aString
"put aString as a chunk onto the receiver;
- double all exclamation marks and append an exclamation mark"
+ double all exclamation marks except within primitives and append a
+ single delimiting exclamation mark at the end."
|sep gotPercent inPrimitive character
index "{ Class:SmallInteger }"
endIndex "{ Class:SmallInteger }"
- next "{ Class:SmallInteger }" |
+ stop "{ Class:SmallInteger }"
+ next "{ Class:SmallInteger }"
+ i "{ Class:SmallInteger }" |
sep := self class chunkSeparator.
inPrimitive := false.
gotPercent := false.
index := 1.
endIndex := aString size.
+ stop := endIndex + 1.
[index <= endIndex] whileTrue:[
- next := aString indexOf:$% startingAt:index ifAbsent:[endIndex + 1].
- next := next min:
- (aString indexOf:${ startingAt:index ifAbsent:[endIndex + 1]).
+ "
+ find position of next interresting character;
+ output stuff up to that one in one piece
+ "
+ next := aString indexOf:$% startingAt:index ifAbsent:stop.
next := next min:
- (aString indexOf:$} startingAt:index ifAbsent:[endIndex + 1]).
+ (aString indexOf:${ startingAt:index ifAbsent:stop).
+ next := next min:
+ (aString indexOf:$} startingAt:index ifAbsent:stop).
next := next min:
- (aString indexOf:sep startingAt:index ifAbsent:[endIndex + 1]).
+ (aString indexOf:sep startingAt:index ifAbsent:stop).
- ((index == 1) and:[next == (endIndex + 1)]) ifTrue:[
+ ((index == 1) and:[next == stop]) ifTrue:[
self nextPutAll:aString
] ifFalse:[
- self nextPutAll:(aString copyFrom:index to:(next - 1))
+ self nextPutAll:aString startingAt:index to:(next - 1)
].
index := next.