help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-smalltalk] [bug] putting character in a stream


From: Stephen Woolerton
Subject: [Help-smalltalk] [bug] putting character in a stream
Date: Thu, 05 Mar 2009 02:30:51 -0700

Issue status update for http://smalltalk.gnu.org/node/282 Post a follow up: http://smalltalk.gnu.org/project/comments/add/282

Project:      GNU Smalltalk
Version:      <none>
Component:    Base classes
Category:     bug reports
Priority:     normal
Assigned to:  Unassigned
Reported by:  swoolerton
Updated by:   swoolerton
Status:       active

Platform is Centos 5.2 64 bit version. GST 3.1.

This works...
              valueStream := ReadStream on: '7F'.
              stream := ReadWriteStream on: (String new).
              [valueStream atEnd] whileFalse: [
                      byte := (valueStream next digitValue * 16).
                      byte := byte + valueStream next digitValue.
                      byte printNl.
                      byte asCharacter ].

This works...
              valueStream := ReadStream on: '80'.   "change the
number"
              stream := ReadWriteStream on: (String new).
              [valueStream atEnd] whileFalse: [
                      byte := (valueStream next digitValue * 16).
                      byte := byte + valueStream next digitValue.
                      byte printNl.
                      byte asCharacter ].

This works...
              valueStream := ReadStream on: '7F'.
              stream := ReadWriteStream on: (String new).
              [valueStream atEnd] whileFalse: [
                      byte := (valueStream next digitValue * 16).
                      byte := byte + valueStream next digitValue.
                      byte printNl.
                      stream nextPut: (byte asCharacter). ].   "save
to a stream"

This crashes...
              valueStream := ReadStream on: '80'.    "change the
number"
              stream := ReadWriteStream on: (String new).
              [valueStream atEnd] whileFalse: [
                      byte := (valueStream next digitValue * 16).
                      byte := byte + valueStream next digitValue.
                      byte printNl.
                      stream nextPut: (byte asCharacter). ].

The crash looks like this...

$ gst -i ./berintdebug.st...

128 Object: '' error: Invalid argument : argument must be between $<0> and
$ΓΏ
SystemExceptions.ArgumentOutOfRange(Exception)>>signal
(AnsiExcept.st:216)
SystemExceptions.ArgumentOutOfRange(Exception)>>signal:
(AnsiExcept.st:226)
SystemExceptions.ArgumentOutOfRange class>>signalOn:mustBeBetween:and: (AnsiExcept.st:780)
String(Object)>>checkIndexableBounds:put: (Object.st:805)
String>>at:put: (String.st:293)
ReadWriteStream(WriteStream)>>nextPut: (WriteStream.st:93)
UndefinedObject>>executeStatements (berintdebug.st:12)

By the way, I expect there is a better way of converting from hex to
decimal and putting into a stream...

Also the code below crashes the terminal window.
Transcript show: myObject class.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]