--- a/transforms/Xtreams__EncodeReadStream.st Tue Mar 19 23:54:16 2013 -0400
+++ b/transforms/Xtreams__EncodeReadStream.st Wed Mar 20 00:06:14 2013 -0400
@@ -38,73 +38,74 @@
!
get
- | character |
- buffer hasDataToRead ifTrue: [^super get].
- character := encoder decodeFrom: source.
- transparent ifFalse:
- [character == LF
- ifTrue: [crPreceeding
- ifTrue:
- [character := encoder decodeFrom: source.
- crPreceeding := character = CR]
- ifFalse:
- [crPreceeding := false.
- character := CR]]
- ifFalse: [crPreceeding := character = CR]].
- ^character
+ | character |
+ buffer hasDataToRead ifTrue: [^super get].
+ character := encoder decodeFrom: source.
+ transparent ifTrue: [ ^character ].
+ character == LF
+ ifTrue: [crPreceeding
+ ifTrue:
+ [character := encoder decodeFrom: source.
+ crPreceeding := character = CR]
+ ifFalse:
+ [crPreceeding := false.
+ character := Character cr]]
+ ifFalse: [crPreceeding := character = CR].
+ ^character == CR ifTrue: [ LF ] ifFalse: [ character ]
!
read: anInteger into: aSequenceableCollection at: startIndex
- | remaining position character bufferAvailable |
- remaining := anInteger.
- position := startIndex.
- [remaining > 0] whileTrue: [
- | mark |
- "Top up our buffer if we have room and we need data"
- [bufferWriting write: (buffer writeSize min: remaining) from: source] on: Incomplete do: [:incomplete |
- (incomplete count == 0 and: [buffer hasDataToRead not]) ifTrue: [
- (Incomplete on: aSequenceableCollection count: anInteger - remaining at: startIndex) raise]].
+ | remaining position character bufferAvailable |
+ remaining := anInteger.
+ position := startIndex.
+ [remaining > 0] whileTrue: [
+ | mark |
+ "Top up our buffer if we have room and we need data"
+ [bufferWriting write: (buffer writeSize min: remaining) from: source] on: Incomplete do: [:incomplete |
+ (incomplete count == 0 and: [buffer hasDataToRead not]) ifTrue: [
+ (Incomplete on: aSequenceableCollection count: anInteger - remaining at: startIndex) raise]].
- "We now conduct an inner loop that iterates over the buffer data while:
- a) we need to read more data
- b) there is data available in the buffer
- c) a character can successfully be decoded
- "
+ "We now conduct an inner loop that iterates over the buffer data while:
+ a) we need to read more data
+ b) there is data available in the buffer
+ c) a character can successfully be decoded
+ "
- "If our buffer size is too low before we begin our decode loop, we need to take an undo copy in case we cannot decode a character."
- buffer readSize < 10 ifTrue:
- [mark := buffer readPosition.
- encoder backupState ].
+ "If our buffer size is too low before we begin our decode loop, we need to take an undo copy in case we cannot decode a character."
+ buffer readSize < 10 ifTrue:
+ [mark := buffer readPosition.
+ encoder backupState ].
- [["The following may raise an incomplete, which means we don't have enough data in the buffer to decode the full character.
- This is handled by the Incomplete exception capture before."
- character := encoder decodeFrom: bufferReading.
+ [["The following may raise an incomplete, which means we don't have enough data in the buffer to decode the full character.
+ This is handled by the Incomplete exception capture before."
+ character := encoder decodeFrom: bufferReading.
- "If we are not transparent, convert stray LFs in to CRs and CRLFs in to CRs"
- transparent ifFalse: [
- character == LF
- ifTrue: [character := crPreceeding ifTrue: [nil] ifFalse: [CR]. crPreceeding := false]
- ifFalse: [crPreceeding := character = CR]].
+ "If we are not transparent, convert stray LFs in to CRs and CRLFs in to CRs"
+ transparent ifFalse: [
+ character == LF
+ ifTrue: [character := crPreceeding ifTrue: [nil] ifFalse: [CR]. crPreceeding := false]
+ ifFalse: [crPreceeding := character = CR]].
- "If we didn't filter out an LF at the tail of a CRLF, commit the character to the output."
- character == nil ifFalse:
- [aSequenceableCollection at: position put: character.
- remaining := remaining - 1.
- position := position + 1].
+ "If we didn't filter out an LF at the tail of a CRLF, commit the character to the output."
+ character == nil ifFalse: [
+ (transparent or: [ character ~~ CR ]) ifFalse: [ character := LF ].
+ aSequenceableCollection at: position put: character.
+ remaining := remaining - 1.
+ position := position + 1].
- "Find out how much data we have left in the buffer. If it's too low we need to keep track of the undo record in case we cannot decode a character."
- (bufferAvailable := buffer readSize) < 10 ifTrue:
- [mark := buffer readPosition.
- encoder backupState ].
+ "Find out how much data we have left in the buffer. If it's too low we need to keep track of the undo record in case we cannot decode a character."
+ (bufferAvailable := buffer readSize) < 10 ifTrue:
+ [mark := buffer readPosition.
+ encoder backupState ].
- remaining > 0 and: [bufferAvailable > 0]] whileTrue]
- on: Incomplete do: [:incomplete |
- "We failed to decode a character, we've hit the end of the buffer and need to refill it. We rewind the buffer and leave the decoding loop
- to return to the main loop where more data will be fetched in to our buffer."
- buffer readPosition: mark.
- encoder restoreState]].
- ^anInteger
+ remaining > 0 and: [bufferAvailable > 0]] whileTrue]
+ on: Incomplete do: [:incomplete |
+ "We failed to decode a character, we've hit the end of the buffer and need to refill it. We rewind the buffer and leave the decoding loop
+ to return to the main loop where more data will be fetched in to our buffer."
+ buffer readPosition: mark.
+ encoder restoreState]].
+ ^anInteger
! !
!EncodeReadStream methodsFor:'initialize-release'!
--- a/transforms/Xtreams__EncodeWriteStream.st Tue Mar 19 23:54:16 2013 -0400
+++ b/transforms/Xtreams__EncodeWriteStream.st Wed Mar 20 00:06:14 2013 -0400
@@ -84,20 +84,20 @@
setLineEndCRLF
- | stream |
- decodedLineEnd := Character cr.
- stream := ByteArray new writing.
- encoder encode: Character cr on: stream; encode: Character lf on: stream.
- encodedLineEnd := stream contents
+ | stream |
+ decodedLineEnd := Character lf.
+ stream := ByteArray new writing.
+ encoder encode: Character cr on: stream; encode: Character lf on: stream.
+ encodedLineEnd := stream contents
!
setLineEndLF
- | stream |
- decodedLineEnd := Character cr.
- stream := ByteArray new writing.
- encoder encode: Character lf on: stream.
- encodedLineEnd := stream contents
+ | stream |
+ decodedLineEnd := Character lf.
+ stream := ByteArray new writing.
+ encoder encode: Character lf on: stream.
+ encodedLineEnd := stream contents
!
setLineEndTransparent
--- a/transforms/tests/Make.proto Tue Mar 19 23:54:16 2013 -0400
+++ b/transforms/tests/Make.proto Wed Mar 20 00:06:14 2013 -0400
@@ -100,24 +100,25 @@
postMake:: cleanjunk
prereq: $(REQUIRED_SUPPORT_DIRS)
+ cd ../../../../libdb/libodbc && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
cd ../../../../libbasic && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
cd ../../../../libbasic2 && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
cd ../../support && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
cd ../../../../libdb && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
cd ../../../../libview && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
cd ../../core && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
- cd ../../../../libdb/libodbc && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
cd ../../../../libdb/libsqlite && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
cd ../../../../libui && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
cd ../../substreams && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
- cd ../ && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
cd ../../../../libbasic3 && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
cd ../../../../libview2 && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
cd ../../../sunit && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
cd ../../../../libwidg && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
cd ../../core/tests && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+ cd ../../terminals && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
cd ../../../../libwidg2 && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
cd ../../terminals/tests && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+ cd ../ && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
cd ../../../../libcompat && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
--- a/transforms/tests/bc.mak Tue Mar 19 23:54:16 2013 -0400
+++ b/transforms/tests/bc.mak Wed Mar 20 00:06:14 2013 -0400
@@ -50,24 +50,25 @@
# build all prerequisite packages for this package
prereq:
+ pushd ..\..\..\..\libdb\libodbc & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
pushd ..\..\..\..\libbasic & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
pushd ..\..\..\..\libbasic2 & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
pushd ..\..\support & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
pushd ..\..\..\..\libdb & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
pushd ..\..\..\..\libview & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
pushd ..\..\core & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
- pushd ..\..\..\..\libdb\libodbc & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
pushd ..\..\..\..\libdb\libsqlite & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
pushd ..\..\..\..\libui & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
pushd ..\..\substreams & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
- pushd .. & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
pushd ..\..\..\..\libbasic3 & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
pushd ..\..\..\..\libview2 & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
pushd ..\..\..\sunit & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
pushd ..\..\..\..\libwidg & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
pushd ..\..\core\tests & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+ pushd ..\..\terminals & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
pushd ..\..\..\..\libwidg2 & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
pushd ..\..\terminals\tests & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+ pushd .. & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
pushd ..\..\..\..\libcompat & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
--- a/transforms/tests/extensions.st Tue Mar 19 23:54:16 2013 -0400
+++ b/transforms/tests/extensions.st Wed Mar 20 00:06:14 2013 -0400
@@ -90,6 +90,16 @@
!Xtreams::ReadingWritingTest methodsFor:'tests - transforming'!
+testCharacters
+ (self output encoding: #ascii)
+ setLineEndTransparent;
+ backspace; bell; cr; delete; ff; lf; q; qq; space; tab; vtab; escape;
+ close.
+ self assert: (self input read: 12) = #[8 7 13 127 12 10 39 34 32 9 11 27]
+! !
+
+!Xtreams::ReadingWritingTest methodsFor:'tests - transforming'!
+
testDoing
| outing inning |
outing := ByteArray new writing.
@@ -344,16 +354,16 @@
testWriteEncodingCRLF
- | result isCRLF |
- (self output encoding: #ascii)
- write: 'hello\world\\\' withCRs;
- close.
- isCRLF := IOAccessor defaultClass = PCIOAccessor.
- result := self input read: (isCRLF ifTrue: [18] ifFalse: [14]).
+ | result isCRLF |
+ (self output encoding: #ascii)
+ write: 'hello\world\\\' withCRs;
+ close.
+ isCRLF := OperatingSystem isMSWINDOWSlike.
+ result := self input read: (isCRLF ifTrue: [18] ifFalse: [14]).
- self assert: result = (isCRLF
- ifTrue: [#[104 101 108 108 111 13 10 119 111 114 108 100 13 10 13 10 13 10 ] ]
- ifFalse: [#[104 101 108 108 111 10 119 111 114 108 100 10 10 10 ] ])
+ self assert: result = (isCRLF
+ ifTrue: [#[104 101 108 108 111 13 10 119 111 114 108 100 13 10 13 10 13 10 ] ]
+ ifFalse: [#[104 101 108 108 111 10 119 111 114 108 100 10 10 10 ] ])
! !
!Xtreams::ReadingWritingTest methodsFor:'tests - encoding'!
--- a/transforms/tests/stx_goodies_xtreams_transforms_tests.st Tue Mar 19 23:54:16 2013 -0400
+++ b/transforms/tests/stx_goodies_xtreams_transforms_tests.st Wed Mar 20 00:06:14 2013 -0400
@@ -61,48 +61,49 @@
Entries are 2-element array literals, consisting of class-name and selector."
^ #(
- #'Xtreams::CollectionReadingWritingTest' testReadRejecting
- #'Xtreams::CollectionReadingWritingTest' testReadSelecting
- #'Xtreams::CollectionReadingWritingTest' testWriteRejecting
- #'Xtreams::CollectionReadingWritingTest' testWriteSelecting
- #'Xtreams::CollectionReadingWritingTest' testWriteTransformHexToByte
- #'Xtreams::FiniteReadingWritingTests' testInterpretingDoubles
- #'Xtreams::FiniteReadingWritingTests' testWriteTransformingOverLimitingPastEnd
- #'Xtreams::FiniteReadingWritingTests' testWriteTransformingPastEnd
- #'Xtreams::ReadingWritingTest' testDoing
- #'Xtreams::ReadingWritingTest' testInterpretingPoints
- #'Xtreams::ReadingWritingTest' testMarshaling
- #'Xtreams::ReadingWritingTest' testReadCollecting
- #'Xtreams::ReadingWritingTest' testReadCollectingContentsSpeciesChanged
- #'Xtreams::ReadingWritingTest' testReadDecodingBase64
- #'Xtreams::ReadingWritingTest' testReadDecodingCRLF
- #'Xtreams::ReadingWritingTest' testReadDecodingTransparent
- #'Xtreams::ReadingWritingTest' testReadDecodingUTF16
- #'Xtreams::ReadingWritingTest' testReadDecodingUTF8
- #'Xtreams::ReadingWritingTest' testReadDuplicating
- #'Xtreams::ReadingWritingTest' testReadInjecting
- #'Xtreams::ReadingWritingTest' testReadRejecting
- #'Xtreams::ReadingWritingTest' testReadSelecting
- #'Xtreams::ReadingWritingTest' testReadTransforming1into2
- #'Xtreams::ReadingWritingTest' testReadTransforming2into1
- #'Xtreams::ReadingWritingTest' testReadTransformingPastEnd
- #'Xtreams::ReadingWritingTest' testReadUnsignedShortEndianness
- #'Xtreams::ReadingWritingTest' testWriteCollecting
- #'Xtreams::ReadingWritingTest' testWriteCollectingIncompatibleContentSpecies
- #'Xtreams::ReadingWritingTest' testWriteCollectingMultipleBufferSize
- #'Xtreams::ReadingWritingTest' testWriteDuplicating
- #'Xtreams::ReadingWritingTest' testWriteEncodingBase64
- #'Xtreams::ReadingWritingTest' testWriteEncodingCRLF
- #'Xtreams::ReadingWritingTest' testWriteEncodingTransparent
- #'Xtreams::ReadingWritingTest' testWriteEncodingUTF16
- #'Xtreams::ReadingWritingTest' testWriteEncodingUTF8
- #'Xtreams::ReadingWritingTest' testWriteInjecting
- #'Xtreams::ReadingWritingTest' testWriteRejecting
- #'Xtreams::ReadingWritingTest' testWriteSelecting
- #'Xtreams::ReadingWritingTest' testWriteTransformHexToByte
- #'Xtreams::ReadingWritingTest' testWriteTransforming1into2
- #'Xtreams::ReadingWritingTest' testWriteTransforming2into1
- #'Xtreams::ReadingWritingTest' testWriteUnsignedShortEndianness
+ #'Xtreams::CollectionReadingWritingTest' testReadRejecting
+ #'Xtreams::CollectionReadingWritingTest' testReadSelecting
+ #'Xtreams::CollectionReadingWritingTest' testWriteRejecting
+ #'Xtreams::CollectionReadingWritingTest' testWriteSelecting
+ #'Xtreams::CollectionReadingWritingTest' testWriteTransformHexToByte
+ #'Xtreams::FiniteReadingWritingTests' testInterpretingDoubles
+ #'Xtreams::FiniteReadingWritingTests' testWriteTransformingOverLimitingPastEnd
+ #'Xtreams::FiniteReadingWritingTests' testWriteTransformingPastEnd
+ #'Xtreams::ReadingWritingTest' testCharacters
+ #'Xtreams::ReadingWritingTest' testDoing
+ #'Xtreams::ReadingWritingTest' testInterpretingPoints
+ #'Xtreams::ReadingWritingTest' testMarshaling
+ #'Xtreams::ReadingWritingTest' testReadCollecting
+ #'Xtreams::ReadingWritingTest' testReadCollectingContentsSpeciesChanged
+ #'Xtreams::ReadingWritingTest' testReadDecodingBase64
+ #'Xtreams::ReadingWritingTest' testReadDecodingCRLF
+ #'Xtreams::ReadingWritingTest' testReadDecodingTransparent
+ #'Xtreams::ReadingWritingTest' testReadDecodingUTF16
+ #'Xtreams::ReadingWritingTest' testReadDecodingUTF8
+ #'Xtreams::ReadingWritingTest' testReadDuplicating
+ #'Xtreams::ReadingWritingTest' testReadInjecting
+ #'Xtreams::ReadingWritingTest' testReadRejecting
+ #'Xtreams::ReadingWritingTest' testReadSelecting
+ #'Xtreams::ReadingWritingTest' testReadTransforming1into2
+ #'Xtreams::ReadingWritingTest' testReadTransforming2into1
+ #'Xtreams::ReadingWritingTest' testReadTransformingPastEnd
+ #'Xtreams::ReadingWritingTest' testReadUnsignedShortEndianness
+ #'Xtreams::ReadingWritingTest' testWriteCollecting
+ #'Xtreams::ReadingWritingTest' testWriteCollectingIncompatibleContentSpecies
+ #'Xtreams::ReadingWritingTest' testWriteCollectingMultipleBufferSize
+ #'Xtreams::ReadingWritingTest' testWriteDuplicating
+ #'Xtreams::ReadingWritingTest' testWriteEncodingBase64
+ #'Xtreams::ReadingWritingTest' testWriteEncodingCRLF
+ #'Xtreams::ReadingWritingTest' testWriteEncodingTransparent
+ #'Xtreams::ReadingWritingTest' testWriteEncodingUTF16
+ #'Xtreams::ReadingWritingTest' testWriteEncodingUTF8
+ #'Xtreams::ReadingWritingTest' testWriteInjecting
+ #'Xtreams::ReadingWritingTest' testWriteRejecting
+ #'Xtreams::ReadingWritingTest' testWriteSelecting
+ #'Xtreams::ReadingWritingTest' testWriteTransformHexToByte
+ #'Xtreams::ReadingWritingTest' testWriteTransforming1into2
+ #'Xtreams::ReadingWritingTest' testWriteTransforming2into1
+ #'Xtreams::ReadingWritingTest' testWriteUnsignedShortEndianness
)
! !
--- a/transforms/tests/tests.rc Tue Mar 19 23:54:16 2013 -0400
+++ b/transforms/tests/tests.rc Wed Mar 20 00:06:14 2013 -0400
@@ -3,7 +3,7 @@
// automagically generated from the projectDefinition: stx_goodies_xtreams_transforms_tests.
//
VS_VERSION_INFO VERSIONINFO
- FILEVERSION 6,2,32767,32767
+ FILEVERSION 6,2,0,1
PRODUCTVERSION 6,2,3,0
#if (__BORLANDC__)
FILEFLAGSMASK VS_FF_DEBUG | VS_FF_PRERELEASE
@@ -20,12 +20,12 @@
BEGIN
VALUE "CompanyName", "eXept Software AG\0"
VALUE "FileDescription", "Smalltalk/X Class library (LIB)\0"
- VALUE "FileVersion", "6.2.32767.32767\0"
+ VALUE "FileVersion", "6.2.0.1\0"
VALUE "InternalName", "stx:goodies/xtreams/transforms/tests\0"
VALUE "LegalCopyright", "Copyright Claus Gittinger 1988-2013\nCopyright eXept Software AG 1998-2013\0"
VALUE "ProductName", "Smalltalk/X\0"
VALUE "ProductVersion", "6.2.3.0\0"
- VALUE "ProductDate", "Fri, 15 Mar 2013 22:35:28 GMT\0"
+ VALUE "ProductDate", "Wed, 20 Mar 2013 03:58:03 GMT\0"
END
END
--- a/transforms/transforms.rc Tue Mar 19 23:54:16 2013 -0400
+++ b/transforms/transforms.rc Wed Mar 20 00:06:14 2013 -0400
@@ -25,7 +25,7 @@
VALUE "LegalCopyright", "Copyright Claus Gittinger 1988-2011\nCopyright eXept Software AG 1998-2011\0"
VALUE "ProductName", "Smalltalk/X\0"
VALUE "ProductVersion", "6.2.3.0\0"
- VALUE "ProductDate", "Fri, 15 Mar 2013 23:16:33 GMT\0"
+ VALUE "ProductDate", "Wed, 20 Mar 2013 03:58:32 GMT\0"
END
END