Anonymous | Login | 04-12-2021 16:23 UTC |
Main | My View | View Issues | Change Log | Docs |
Viewing Issue Simple Details [ Jump to Notes ] | [ View Advanced ] [ Issue History ] [ Print ] | ||||||||
ID | Category | Severity | Reproducibility | Date Submitted | Last Update | ||||
0003993 | [Squeak] Kernel | major | always | 07-03-06 09:29 | 07-14-06 16:29 | ||||
Reporter | kwl | View Status | public | ||||||
Assigned To | |||||||||
Priority | normal | Resolution | fixed | ||||||
Status | closed | Product Version | 3.9 | ||||||
Summary | 0003993: Number does not read '1.0e-10 .txt' from file | ||||||||
Description |
The following statement works: Number readFrom: '1.0e-10 .txt' readStream But when reading the same string from a file Number readFrom: (FileStream readOnlyFileNamed: 'Number1.0e-10 .txt') it fails with the attached DNU. Note that in order to reproduce, the string '1.0e-10 .txt' must be put into the file named 'Number1.0e-10 .txt'. |
||||||||
Additional Information |
MessageNotUnderstood: UndefinedObject>>digitValue 3 July 2006 9:21:59 am VM: Win32 - a SmalltalkImage Image: Squeak3.9alpha [latest update: 0007035] SecurityManager state: Restricted: false FileAccess: true SocketAccess: true Working Dir ...\Squeak3.9 Trusted Dir ...\Squeak3.9\kWitzel Untrusted Dir ...\kWitzel UndefinedObject(Object)>>doesNotUnderstand: #digitValue Receiver: nil Arguments and temporary variables: aMessage: digitValue Receiver's instance variables: nil Number class>>readExponent:base:from: Receiver: Number Arguments and temporary variables: baseValue: 1.0 base: 10 aStream: MultiByteFileStream: '...\Number1.0e-10 .txt' (by kwl) sign: 1 exp: nil value: nil Receiver's instance variables: superclass: Magnitude methodDict: a MethodDictionary(size 113) format: 2 instanceVariables: nil organization: ('arithmetic' * + - / // \\ abs arg negated quo: reciprocal rem:)...etc... subclasses: {Fraction . Float . Integer . ScaledDecimal} name: #Number classPool: a Dictionary() sharedPools: nil environment: nil category: #'Kernel-Numbers' traitComposition: nil localSelectors: nil Number class>>readRemainderOf:from:base:withSign: Receiver: Number Arguments and temporary variables: integerPart: 1 aStream: MultiByteFileStream: '...\Number1.0e-10 .txt' (by kwl) base: 10 sign: 1 value: 1.0 fraction: 0.0 fractionDigits: 1 fracpos: 2 fractionPart: 0 scaledDecimal: nil Receiver's instance variables: superclass: Magnitude methodDict: a MethodDictionary(size 113) format: 2 instanceVariables: nil organization: ('arithmetic' * + - / // \\ abs arg negated quo: reciprocal rem:)...etc... subclasses: {Fraction . Float . Integer . ScaledDecimal} name: #Number classPool: a Dictionary() sharedPools: nil environment: nil category: #'Kernel-Numbers' traitComposition: nil localSelectors: nil Number class>>readFrom: Receiver: Number Arguments and temporary variables: stringOrStream: MultiByteFileStream: '...\Number1.0e-10 .txt' (by kwl) value: 1 base: 10 aStream: MultiByteFileStream: '...\Number1.0e-10 .txt' (by kwl) sign: 1 Receiver's instance variables: superclass: Magnitude methodDict: a MethodDictionary(size 113) format: 2 instanceVariables: nil organization: ('arithmetic' * + - / // \\ abs arg negated quo: reciprocal rem:)...etc... subclasses: {Fraction . Float . Integer . ScaledDecimal} name: #Number classPool: a Dictionary() sharedPools: nil environment: nil category: #'Kernel-Numbers' traitComposition: nil localSelectors: nil --- The full stack --- UndefinedObject(Object)>>doesNotUnderstand: #digitValue Number class>>readExponent:base:from: Number class>>readRemainderOf:from:base:withSign: Number class>>readFrom: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - UndefinedObject>>DoIt Compiler>>evaluate:in:to:notifying:ifFail:logged: [] in TextMorphEditor(ParagraphEditor)>>evaluateSelection {[rcvr class evaluatorClass new evaluate: self selectionAsStream in: ctxt...]} BlockContext>>on:do: TextMorphEditor(ParagraphEditor)>>evaluateSelection TextMorphEditor(ParagraphEditor)>>printIt [] in TextMorphEditor(ParagraphEditor)>>printIt: {[self printIt]} TextMorphEditor(Controller)>>terminateAndInitializeAround: TextMorphEditor(ParagraphEditor)>>printIt: TextMorphEditor(ParagraphEditor)>>dispatchOnCharacter:with: TextMorphEditor>>dispatchOnCharacter:with: TextMorphEditor(ParagraphEditor)>>readKeyboard TextMorphEditor>>readKeyboard [] in TextMorphForEditView(TextMorph)>>keyStroke: {[editor readKeyboard]} TextMorphForEditView(TextMorph)>>handleInteraction:fromEvent: TextMorphForEditView>>handleInteraction:fromEvent: TextMorphForEditView(TextMorph)>>keyStroke: TextMorphForEditView>>keyStroke: TextMorphForEditView(TextMorph)>>handleKeystroke: KeyboardEvent>>sentTo: TextMorphForEditView(Morph)>>handleEvent: TextMorphForEditView(Morph)>>handleFocusEvent: [] in HandMorph>>sendFocusEvent:to:clear: {[ActiveHand := self. ActiveEvent := anEvent. result := focusHolder han...]} [] in PasteUpMorph>>becomeActiveDuring: {[aBlock value]} BlockContext>>on:do: ...etc... |
||||||||
Attached Files |
![]() ![]() ![]() |
||||||||
|
![]() |
|
(0005480 - 983 - 1504 - 1882 - 1882 - 1882 - 1882) nicolas cellier 07-03-06 17:52 edited on: 07-03-06 17:59 |
Problem is located into Number class>>canParseExponentFor: baseValue base: base from: aStream "Answer true if parsing the expoenent for a number will succeed. Read from a copy of aStream to test the parsing." ^ ('edq' includes: aStream peek) and: [(self readExponent: baseValue base: base from: aStream copy) notNil] This construct use aStream copy in order to parse the exponent, without advancing the original stream pointer (position inst var). Unfortunately, this construct does not work with the MultiByteFileStream, because of an indirection, both original and copy stream will advance. I suggest you have a look at http://bugs.impara.de/view.php?id=3512 [^] where a NumberParser is defined that will cure this problem and some others... If you also load fixes from http://bugs.impara.de/view.php?id=3564 [^] and http://bugs.impara.de/view.php?id=3568 [^] , you will be able to read floating point numbers as accurately as a sscanf or a atof does. |
(0005483 - 196 - 208 - 208 - 208 - 208 - 208) lewis 07-03-06 19:42 |
Mea culpa, this was caused by 6482NumberReadFromFixes-2-dtl. I uploaded NumberReadFromFixesPatch-dtl as a quick fix. But oops, Klaus has already uploaded a fix, I think they are the same thing. |
(0005484 - 87 - 99 - 99 - 99 - 99 - 99) kwl 07-03-06 20:12 |
Dave, your fixes look better than mine. Dear harvester(s), ignore my uploaded fixes. |
(0005496 - 857 - 899 - 899 - 899 - 899 - 899) lewis 07-04-06 15:33 |
I uploaded NumberReadFromFixes-3-dtl, which replaces NumberReadFromFixes-2-dtl with a simpler implementation that is faster and somewhat less unreadable. It removes three unnecessary methods from class Number, and reorganizes the Number class>>readRemainderOf:from:base:withSign: method. It includes the correction for stream positioning so that parsing works correctly from a file stream. Note that Nicolas Cellier has provided SqNumberParser that is faster than this, and that corrects several remaining issues with number parsing. I would recommend treating NumberReadFromFixes-3-dtl as a bug fix and cleanup only, but SqNumberParser is a superior approach, so we should use start using it. Some additional work will be needed to remove the current Number class parsing, but Nicolas' changes can be added now with no harm to the existing system. |
(0005899 - 4 - 4 - 4 - 4 - 4 - 4) MarcusDenker 07-14-06 16:29 |
7045 |
Mantis 1.0.8[^]
Copyright © 2000 - 2007 Mantis Group
68 total queries executed. 41 unique queries executed. |