Pharo-dev
By thread
pharo-dev@lists.pharo.org
By month
Messages by month
- ----- 2026 -----
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- 1 participants
- 144619 messages
[Pharo-project] Pharo sprint starting now
by alexandre@bergel.eu
Here are some rules. Feel free to complete them:
1 - Download the image 12220 Core image from
https://gforge.inria.fr/frs/download.php/27719/PharoCore-1.2-12220.zip
2 - Go to
http://code.google.com/p/pharo/issues/list
http://code.google.com/p/pharo/issues/list?can=2&q=milestone=1.2&sort=miles…
and pick an issue you want to work on. Since we are working on releasing
Pharo 1.2, please pick an issue marked as 1.2
3 - feel free to fix the issue, comment on it, pair-program, ...
4 - let us know which issue you picked, and how you're going.
18 people are in the room!
Use the twitter #pharosprint tag please
Cheers,
Alexandre
Nov. 11, 2010
Re: [Pharo-project] Issue 3231 in pharo: Semaphore changes
by pharo@googlecode.com
Comment #1 on issue 3231 by gazzaguru2: Semaphore changes
http://code.google.com/p/pharo/issues/detail?id=3231
We can check perhaps (on old Squeak 3.9) with our rather process/semaphore
intensive exchange software...
Nov. 11, 2010
Re: [Pharo-project] Issue 3235 in pharo: better bag sum
by pharo@googlecode.com
Updates:
Status: Fixed
Comment #1 on issue 3235 by stephane.ducasse: better bag sum
http://code.google.com/p/pharo/issues/detail?id=3235
(No comment was entered for this change.)
Nov. 11, 2010
Re: [Pharo-project] Issue 3244 in pharo: Correct the confusion radiansToDegrees/degreesToRadians
by pharo@googlecode.com
Comment #1 on issue 3244 by stephane.ducasse: Correct the confusion
radiansToDegrees/degreesToRadians
http://code.google.com/p/pharo/issues/detail?id=3244
Nicolas Cellier uploaded a new version of KernelTests to project The Trunk:
http://source.squeak.org/trunk/KernelTests-nice.167.mcz
==================== Summary ====================
Name: KernelTests-nice.167
Author: nice
Time: 31 October 2010, 9:55:18.943 pm
UUID: 669b4442-43de-4da0-83d3-649e77bca967
Ancestors: KernelTests-nice.166
Assert that #degreeCos and #degreeSin are exact for any multiple of 90.
This is a nice property to have that radianCos and radianSin cannot afford
due to approximate floating point representation of pi.
=============== Diff against KernelTests-nice.166 ===============
Item was added:
+ ----- Method: FloatTest>>testDegreeCos (in category 'test - mathematical
functions') -----
+ testDegreeCos
+ self shouldnt: [ 45.0 degreeCos] raise: Error.
+ "Following tests use approximate equality, because cosine are
generally evaluated using inexact Floating point arithmetic"
+ self assert: (45.0 degreeCos squared - 0.5) abs <= Float epsilon.
+ self assert: (60.0 degreeCos - 0.5) abs <= Float epsilon.
+ self assert: (120.0 degreeCos + 0.5) abs <= Float epsilon.
+ -360.0 to: 360.0 do: [:i |
+ self assert: (i degreeCos closeTo: i degreesToRadians cos)].
+
+ "Following tests use strict equality which is a requested property
of degreeCos"
+ -10.0 to: 10.0 do: [:k |
+ self assert: (k*360 + 90) degreeCos = 0.
+ self assert: (k*360 - 90) degreeCos = 0.
+ self assert: (k*360 + 180) degreeCos + 1 = 0.
+ self assert: (k*360) degreeCos - 1 = 0.].!
Item was added:
+ ----- Method: FloatTest>>testDegreeCosForExceptionalValues (in
category 'test - mathematical functions') -----
+ testDegreeCosForExceptionalValues
+ self assert: Float nan degreeCos isNaN.
+ self assert: Float infinity degreeCos isNaN.
+ self assert: Float infinity negated degreeCos isNaN.!
Item was added:
+ ----- Method: FloatTest>>testDegreeSin (in category 'test - mathematical
functions') -----
+ testDegreeSin
+ self shouldnt: [ 45.0 degreeSin] raise: Error.
+ "Following tests use approximate equality, because sine are
generally evaluated using inexact Floating point arithmetic"
+ self assert: (45.0 degreeSin squared - 0.5) abs <= Float epsilon.
+ self assert: (30.0 degreeSin - 0.5) abs <= Float epsilon.
+ self assert: (-30.0 degreeSin + 0.5) abs <= Float epsilon.
+ -360.0 to: 360.0 do: [:i |
+ self assert: (i degreeSin closeTo: i degreesToRadians sin)].
+
+ "Following tests use strict equality which is a requested property
of degreeSin"
+ -10.0 to: 10.0 do: [:k |
+ self assert: (k*360 + 90) degreeSin - 1 = 0.
+ self assert: (k*360 - 90) degreeSin + 1= 0.
+ self assert: (k*360 + 180) degreeSin = 0.
+ self assert: (k*360) degreeSin = 0.].!
Item was added:
+ ----- Method: FloatTest>>testDegreeSinForExceptionalValues (in
category 'test - mathematical functions') -----
+ testDegreeSinForExceptionalValues
+ self assert: Float nan degreeSin isNaN.
+ self assert: Float infinity degreeSin isNaN.
+ self assert: Float infinity negated degreeSin isNaN.!
Item was changed:
+ ----- Method: FractionTest>>testDegreeCos (in category 'tests -
mathematical functions') -----
- ----- Method: FractionTest>>testDegreeCos (in category 'tests - sinuses')
-----
testDegreeCos
"self run: #testDegreeCos"
self shouldnt: [ (4/3) degreeCos] raise: Error.
+ -361/3 to: 359/3 do: [:i |
+ self assert: (i degreeCos closeTo: i degreesToRadians
cos)].!
- self assert: (1/3) degreeCos printString = '0.999983076857744'!
Item was changed:
+ ----- Method: FractionTest>>testDegreeSin (in category 'tests -
mathematical functions') -----
- ----- Method: FractionTest>>testDegreeSin (in category 'tests - sinuses')
-----
testDegreeSin
"self run: #testDegreeSin"
self shouldnt: [ (4/3) degreeSin] raise: Error.
+ -361/3 to: 359/3 do: [:i |
+ self assert: (i degreeSin closeTo: i degreesToRadians
sin)].!
- self assert: (1/3) degreeSin printString = '0.005817731354993834'.!
Item was changed:
+ ----- Method: IntegerTest>>testDegreeCos (in category 'tests -
mathematical functions') -----
- ----- Method: IntegerTest>>testDegreeCos (in category 'tests - basic')
-----
testDegreeCos
"self run: #testDegreeCos"
self shouldnt: [ 45 degreeCos] raise: Error.
+ "Following tests use approximate equality, because cosine are
generally evaluated using inexact Floating point arithmetic"
+ self assert: (45 degreeCos squared - (1/2)) abs <= Float epsilon.
+ self assert: (60 degreeCos - (1/2)) abs <= Float epsilon.
+ self assert: (120 degreeCos + (1/2)) abs <= Float epsilon.
+ -360 to: 360 do: [:i |
+ self assert: (i degreeCos closeTo: i degreesToRadians cos)].
+
+ "Following tests use strict equality which is a requested property
of degreeCos"
+ -10 to: 10 do: [:k |
+ self assert: (k*360 + 90) degreeCos = 0.
+ self assert: (k*360 - 90) degreeCos = 0.
+ self assert: (k*360 + 180) degreeCos + 1 = 0.
+ self assert: (k*360) degreeCos - 1 = 0.].!
- self assert: 45 degreeCos printString = (2 sqrt / 2) asFloat
printString !
Item was added:
+ ----- Method: IntegerTest>>testDegreeSin (in category 'tests -
mathematical functions') -----
+ testDegreeSin
+ "self run: #testDegreeSin"
+
+ self shouldnt: [ 45 degreeSin] raise: Error.
+
+ "Following tests use approximate equality, because sine are
generally evaluated using inexact Floating point arithmetic"
+ self assert: (45 degreeSin squared - (1/2)) abs <= Float epsilon.
+ self assert: (30 degreeSin - (1/2)) abs <= Float epsilon.
+ self assert: (-30 degreeSin + (1/2)) abs <= Float epsilon.
+ -360 to: 360 do: [:i |
+ self assert: (i degreeSin closeTo: i degreesToRadians sin)].
+
+ "Following tests use strict equality which is a requested property
of degreeSin"
+ -10 to: 10 do: [:k |
+ self assert: (k*360 + 90) degreeSin - 1 = 0.
+ self assert: (k*360 - 90) degreeSin + 1= 0.
+ self assert: (k*360 + 180) degreeSin = 0.
+ self assert: (k*360) degreeSin = 0].!
Nov. 11, 2010
[Pharo-project] Issue 3244 in pharo: Correct the confusion radiansToDegrees/degreesToRadians
by pharo@googlecode.com
Status: Fixed
Owner: stephane.ducasse
Labels: Milestone-1.2 Type-Squeak
New issue 3244 by stephane.ducasse: Correct the confusion
radiansToDegrees/degreesToRadians
http://code.google.com/p/pharo/issues/detail?id=3244
I integrated the first enh so we should fix it with this change now.
Nicolas Cellier uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-nice.511.mcz
==================== Summary ====================
Name: Kernel-nice.511
Author: nice
Time: 1 November 2010, 11:59:51.145 am
UUID: 4f6eaafc-6665-4092-ac07-d87ecb2b5d30
Ancestors: Kernel-nice.510
Correct the confusion radiansToDegrees/degreesToRadians
Thanks Bert
=============== Diff against Kernel-nice.510 ===============
Item was changed:
----- Method: Float>>degreeCos (in category 'mathematical functions') -----
degreeCos
"Take care of exceptional values"
self isFinite ifTrue: [^super degreeCos].
+ ^self degreesToRadians cos!
- ^self radiansToDegrees cos!
Item was changed:
----- Method: Float>>degreeSin (in category 'mathematical functions') -----
degreeSin
"Take care of exceptional values"
self isFinite ifTrue: [^super degreeSin].
+ ^self degreesToRadians sin!
- ^self radiansToDegrees sin!
Nov. 11, 2010
[Pharo-project] Issue 3243 in pharo: enhanced AttributedTextStream so it can be used as a TextStream in some cases.
by pharo@googlecode.com
Status: FixedWaitingToBePharoed
Owner: stephane.ducasse
Labels: Type-Squeak
New issue 3243 by stephane.ducasse: enhanced AttributedTextStream so it can
be used as a TextStream in some cases.
http://code.google.com/p/pharo/issues/detail?id=3243
Levente Uzonyi uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-ul.402.mcz
==================== Summary ====================
Name: Collections-ul.402
Author: ul
Time: 2 November 2010, 10:03:54.289 pm
UUID: c07fdead-7f3a-544f-82dd-4bfe4ef28365
Ancestors: Collections-ul.401
- enhanced AttributedTextStream so it can be used as a TextStream in some
cases.
- recategorized a few methods, fixed some comments
=============== Diff against Collections-ul.401 ===============
Item was changed:
+ ----- Method: AttributedTextStream>>contents (in category 'accessing')
-----
- ----- Method: AttributedTextStream>>contents (in category 'retrieving the
text') -----
contents
| ans |
currentRun > 0 ifTrue:[
attributeValues nextPut: currentAttributes.
attributeRuns nextPut: currentRun.
currentRun := 0].
ans := Text string: characters contents runs:
(RunArray runs: attributeRuns contents values:
attributeValues contents).
^ans!
Item was added:
+ ----- Method: AttributedTextStream>>cr (in category 'character writing')
-----
+ cr
+ "Append a carriage return character to the receiver."
+
+ self nextPut: Character cr!
Item was added:
+ ----- Method: AttributedTextStream>>crlf (in category 'character
writing') -----
+ crlf
+ "Append a carriage return and a line feed to the receiver."
+
+ self nextPut: Character cr; nextPut: Character lf!
Item was changed:
+ ----- Method: AttributedTextStream>>currentAttributes (in
category 'accessing') -----
- ----- Method: AttributedTextStream>>currentAttributes (in
category 'access') -----
currentAttributes
"return the current attributes"
^currentAttributes!
Item was changed:
+ ----- Method: AttributedTextStream>>currentAttributes: (in
category 'accessing') -----
- ----- Method: AttributedTextStream>>currentAttributes: (in
category 'access') -----
currentAttributes: newAttributes
"set the current attributes"
(currentRun > 0 and:[currentAttributes ~= newAttributes]) ifTrue:[
attributeRuns nextPut: currentRun.
attributeValues nextPut: currentAttributes.
currentRun := 0.
].
currentAttributes := newAttributes.
!
Item was changed:
+ ----- Method: AttributedTextStream>>initialize (in
category 'initialize-release') -----
- ----- Method: AttributedTextStream>>initialize (in
category 'private-initialization') -----
initialize
+
+ characters := String new writeStream.
+ currentAttributes := #().
- characters := WriteStream on: String new.
- currentAttributes := OrderedCollection new.
currentRun := 0.
+ attributeValues := (Array new: 50) writeStream.
+ attributeRuns := (Array new: 50) writeStream!
- attributeValues := WriteStream on: (Array new: 50).
- attributeRuns := WriteStream on: (Array new: 50). !
Item was added:
+ ----- Method: AttributedTextStream>>lf (in category 'character writing')
-----
+ lf
+ "Append a line feed character to the receiver."
+
+ self nextPut: Character lf!
Item was changed:
+ ----- Method: AttributedTextStream>>nextPut: (in category 'accessing')
-----
- ----- Method: AttributedTextStream>>nextPut: (in category 'stream
protocol') -----
nextPut: aChar
currentRun := currentRun + 1.
^characters nextPut: aChar!
Item was changed:
+ ----- Method: AttributedTextStream>>nextPutAll: (in category 'accessing')
-----
- ----- Method: AttributedTextStream>>nextPutAll: (in category 'stream
protocol') -----
nextPutAll: aString
"add an entire string with the same attributes"
currentRun := currentRun + aString size.
^characters nextPutAll: aString.!
Item was changed:
+ ----- Method: AttributedTextStream>>size (in category 'accessing') -----
- ----- Method: AttributedTextStream>>size (in category 'access') -----
size
"number of characters in the stream so far"
^characters size!
Item was added:
+ ----- Method: AttributedTextStream>>withAttribute:do: (in
category 'accessing') -----
+ withAttribute: attribute do: aBlock
+
+ ^self withAttributes: { attribute } do: aBlock!
Item was added:
+ ----- Method: AttributedTextStream>>withAttributes:do: (in
category 'accessing') -----
+ withAttributes: attributes do: aBlock
+
+ | previousAttributes |
+ previousAttributes := currentAttributes.
+ [
+ self currentAttributes: attributes.
+ aBlock value ]
+ ensure: [ self currentAttributes:
previousAttributes ]!
Item was changed:
+ ----- Method: Stream>>printOn: (in category 'printing') -----
- ----- Method: Stream>>printOn: (in category 'accessing') -----
printOn: stream
super printOn: stream.
stream space.
self contents printOn: stream.
!
Item was changed:
----- Method: WriteStream>>cr (in category 'character writing') -----
cr
+ "Append a carriage return character to the receiver."
- "Append a return character to the receiver."
self nextPut: Character cr!
Item was changed:
----- Method: WriteStream>>crlf (in category 'character writing') -----
crlf
+ "Append a carriage return and a line feed to the receiver."
- "Append a line feed character to the receiver."
self nextPut: Character cr; nextPut: Character lf!
Nov. 11, 2010
[Pharo-project] Issue 3242 in pharo: BDFFontReader fixes
by pharo@googlecode.com
Status: FixedWaitingToBePharoed
Owner: stephane.ducasse
Labels: Type-Squeak
New issue 3242 by stephane.ducasse: BDFFontReader fixes
http://code.google.com/p/pharo/issues/detail?id=3242
We should pay attention because some parts are different in pharo but the
rest looks trivial.
Levente Uzonyi uploaded a new version of Graphics to project The Trunk:
http://source.squeak.org/trunk/Graphics-ul.153.mcz
==================== Summary ====================
Name: Graphics-ul.153
Author: ul
Time: 3 November 2010, 6:50:09.075 am
UUID: 030e6dfc-71b7-5144-9edd-76f529655456
Ancestors: Graphics-ul.152
- removed the last direct users of CrLfFileStream
- replaced the download url of the bdf fonts, because the original doesn't
work anymore
- removed BDFFontReader class >> #new, because it ignores #initialize which
breaks the font conversion process. This stuff is still broken btw.
=============== Diff against Graphics-ul.152 ===============
Item was changed:
----- Method: BDFFontReader class>>downloadFonts (in category 'resource
download') -----
downloadFonts "BDFFontReader downloadFonts"
"Download a standard set of BDF sources from x.org.
The combined size of these source files is around 1.2M; after
conversion
to .sf2 format they may be deleted."
| heads tails filenames baseUrl basePath |
heads :=
#( 'charR' 'courR' 'helvR' 'lubR' 'luRS' 'lutRS' 'ncenR' 'timR' ).
tails := #( '08' '10' '12' '14' '18' '24').
filenames := OrderedCollection new.
heads do: [:head |
filenames addAll: (tails collect: [:tail | head ,
tail , '.bdf'])
].
+
baseUrl := 'http://cvsweb.xfree86.org/cvsweb/*checkout*/xc/fonts/bdf/75dpi/'
asUrl.
-
- baseUrl := 'http://ftp.x.org/pub/R6.4/xc/fonts/bdf/75dpi/' asUrl.
basePath := baseUrl path.
+ filenames do: [:filename |
+ | document newPath newUrl |
- filenames do: [:filename | | document f newPath newUrl |
newUrl := baseUrl clone.
newPath := OrderedCollection newFrom: basePath.
newPath addLast: filename.
newUrl path: newPath.
Utilities informUser: 'Fetching ' , filename during:
[document := newUrl retrieveContents].
+ MultiByteFileStream newFileNamed: filename do: [ :f |
+ f
+ wantsLineEndConversion: true;
+ nextPutAll: document content ]
- f := CrLfFileStream newFileNamed: filename.
- f nextPutAll: document content.
- f close.
].
!
Item was removed:
- ----- Method: BDFFontReader class>>new (in category 'file creation') -----
- new
-
- ^ self basicNew.
- !
Item was changed:
----- Method: BDFFontReader>>openFileNamed: (in category 'initialize')
-----
openFileNamed: fileName
+ file := MultiByteFileStream readOnlyFileNamed: fileName.
+ file wantsLineEndConversion: true!
- file := CrLfFileStream readOnlyFileNamed: fileName.!
Nov. 11, 2010
[Pharo-project] Issue 3241 in pharo: Eliot's stdio changes
by pharo@googlecode.com
Status: FixedWaitingToBePharoed
Owner: stephane.ducasse
Labels: Type-Squeak
New issue 3241 by stephane.ducasse: Eliot's stdio changes
http://code.google.com/p/pharo/issues/detail?id=3241
Levente Uzonyi uploaded a new version of Files to project The Trunk:
http://source.squeak.org/trunk/Files-ul.90.mcz
==================== Summary ====================
Name: Files-ul.90
Author: ul
Time: 27 September 2010, 3:56:36.551 am
UUID: aff6ed6c-5823-6342-b175-65f0f4e8f403
Ancestors: Files-ul.89
- Integrated Eliot's stdio changes with a minor fix/optimization
=============== Diff against Files-ul.89 ===============
Item was added:
+ ----- Method: CrLfFileStream class>>newForStdio (in category 'instance
creation') -----
+ newForStdio
+ "Circumvent CrLfFileStream new's retuning an instance of
MultiBteFileStream"
+ ^super new!
Item was added:
+ ----- Method: CrLfFileStream>>openOnHandle:name:forWrite: (in
category 'open/close') -----
+ openOnHandle: aFileID name: streamName forWrite: writeMode
+ "Initialize the file with the given handle. If writeMode is true
then
+ allow writing, otherwise put the file in read-only mode."
+ super openOnHandle: aFileID name: streamName forWrite: writeMode.
+ lineEndConvention := LineEndDefault!
Item was changed:
----- Method: DirectoryEntry>>fullName (in category 'access') -----
fullName
+ "The fully-qualified name.
+ Since this method falls into the equality test, make it safe when
directory is nil."
+ ^ directory
+ ifNotNil: [ directory fullNameFor: self name ]
+ ifNil: [ self name ]!
- "The fully-qualified name."
- ^ directory fullNameFor: self name!
Item was added:
+ ----- Method: FileDirectory>>directoryEntryForName: (in
category 'private') -----
+ directoryEntryForName: aFileName
+
+ "Return a single DirectoryEntry for the given (non-path) entry name,
+ or nil if the entry could not be found.
+ Raises InvalidDirectoryError if this directory's path does not
identify a directory."
+
+ | entryArray sysPath sysName |
+
+ sysPath := pathName asVmPathName.
+ sysName := aFileName asVmPathName.
+
+ "New linear-time primitive."
+ entryArray := self primLookupEntryIn: sysPath name: sysName.
+ entryArray == #primFailed ifFalse:[
+ ^ entryArray ifNotNil: [(DirectoryEntry fromArray:
entryArray directory: self) convertFromSystemName]
+ ].
+
+ "If the new primitive fails, use the old slow method.
+ (This fallback can be changed to signal InvalidDirectoryError once
+ VM's with FilePlugin #primitiveDirectoryEntry have been
distributed everywhere;
+ the new primitive was introduced 6/13/2007."
+
+ ^self isCaseSensitive ifTrue: [
+ self entries detect: [:entry | entry name = aFileName ]
ifNone: [ nil ]
+ ] ifFalse: [
+ self entries detect: [:entry | entry name sameAs: aFileName
] ifNone: [ nil ]
+ ]
+ !
Item was changed:
FileStream subclass: #StandardFileStream
instanceVariableNames: 'name fileID buffer1'
+ classVariableNames: 'Registry StdioHandles'
- classVariableNames: 'Registry'
poolDictionaries: ''
category: 'Files-Kernel'!
+ StandardFileStream class
+ instanceVariableNames: 'stdioFiles'!
!StandardFileStream commentStamp: 'ul 12/6/2009 05:13' prior: 0!
Provides a simple, platform-independent, interface to a file system. The
instance variable rwmode, inherited from class PositionableStream, here is
used to hold a Boolean -- true means opened for read-write, false means
opened for read-only. 2/12/96 sw
I implement a simple read buffering scheme with the variables defined in
PositionableStream (which are unused in me otherwise) in the following way:
collection <ByteString> or <ByteArray> This is the buffer.
position <Integer> The relative position in the buffer.
Greater or equal to zero.
readLimit <Integer> The number of bytes buffered.
Greater or equal to zero.
Read buffering is enabled with #enableReadBuffering, disabled with
#disableReadBuffering and it is enabled by default. The buffer is filled
when a read attempt of an unbuffered absolute position is requested, or
when a negative repositioning is made (with #position: with an argument <
than the current absolute position) to an absolute position which is not
buffered. In the first case, the buffer is positioned to the given absolute
position. In the latter case the repositioning is made to the requested
absolute position minus fourth of the buffer size. This means that further
small negative repositionings won't result in buffer flushing. This is
really useful when filing in code.
The read buffer is flushed (#flushReadBuffer) whenever a write attempt is
made.
The buffer state is valid if and only if collection is not nil and
position < readLimit.!
+ StandardFileStream class
+ instanceVariableNames: 'stdioFiles'!
Item was changed:
----- Method: StandardFileStream class>>fileExistsUserHandling: (in
category 'error handling') -----
fileExistsUserHandling: fullFileName
| dir localName choice newName newFullFileName |
dir := FileDirectory forFileName: fullFileName.
localName := FileDirectory localNameFor: fullFileName.
+ choice := (UIManager default
+ chooseFrom: #('overwrite that file' 'append
(risky!!!!)' 'choose another name' 'cancel')
+ title: localName, ' already exists.').
- choice := UIManager default chooseFrom:{
- 'overwrite that file'.
- 'choose another name'.
- 'cancel'
- } title: localName, '
- already exists.'.
choice = 1 ifTrue: [
dir deleteFileNamed: localName
ifAbsent: [self error: 'Could not delete the old
version of that file'].
^ self new open: fullFileName forWrite: true].
choice = 2 ifTrue: [
+ ^ (self new open: fullFileName forWrite: true) setToEnd].
+
+ choice = 3 ifTrue: [
newName := UIManager default request: 'Enter a new file
name' initialAnswer: fullFileName.
newFullFileName := self fullName: newName.
^ self newFileNamed: newFullFileName].
self error: 'Please close this to abort file opening'!
Item was added:
+ ----- Method: StandardFileStream class>>flushAndVoidStdioFiles (in
category 'class initialization') -----
+ flushAndVoidStdioFiles
+ stdioFiles ifNotNil:
+ [stdioFiles do:
+ [:f| f isReadOnly ifFalse: [[f flush] on: Error do:
[:ex|"care less"]]].
+ stdioFiles := nil]!
Item was added:
+ ----- Method: StandardFileStream class>>initialize (in category 'class
initialization') -----
+ initialize
+ "StandardFileStream initialize"
+ StdioHandles := Array new: 3.
+ Smalltalk
+ addToStartUpList: self after: SecurityManager; "the intent
being before: AutoStart"
+ addToShutDownList: self after: SecurityManager!
Item was added:
+ ----- Method: StandardFileStream class>>newForStdio (in
category 'private-file creation') -----
+ newForStdio
+ "Circumvent CrLfFileStream new's returning an instance of
MultiBteFileStream"
+ ^self new!
Item was added:
+ ----- Method: StandardFileStream class>>shutDown: (in category 'class
initialization') -----
+ shutDown: quitting
+ quitting ifTrue:
+ [self withAllSubclassesDo:
+ [:fileStreamClass| fileStreamClass
flushAndVoidStdioFiles]]!
Item was added:
+ ----- Method: StandardFileStream class>>standardIOStreamNamed:forWrite:
(in category 'private-file creation') -----
+ standardIOStreamNamed: moniker forWrite: forWrite
+
+ | index |
+ index := #(stdin stdout stderr) identityIndexOf: moniker.
+ ^((stdioFiles ifNil: [ stdioFiles := Array new: 3 ]) at: index)
+ ifNil: [
+ stdioFiles
+ at: index
+ put: (
+ (StdioHandles at: index)
+ ifNil: [ ^self error:
moniker, ' is unavailable' ]
+ ifNotNil: [ :handle|
+ self newForStdio
+
openOnHandle: handle
+ name:
moniker
+ forWrite:
forWrite ]) ]!
Item was added:
+ ----- Method: StandardFileStream class>>startUp: (in category 'class
initialization') -----
+ startUp: resuming
+ (resuming and: [self == StandardFileStream]) ifTrue:
+ [self withAllSubclassesDo:
+ [:fileStreamClass| fileStreamClass voidStdioFiles].
+ [StdioHandles := self stdioHandles]
+ on: Error
+ do: [:ex|
+ StdioHandles isArray ifFalse:
+ [StdioHandles := Array new: 3]]]!
Item was added:
+ ----- Method: StandardFileStream class>>stderr (in category 'file
creation') -----
+ stderr
+ ^self standardIOStreamNamed: #stderr forWrite: true!
Item was added:
+ ----- Method: StandardFileStream class>>stdin (in category 'file
creation') -----
+ stdin
+ ^self standardIOStreamNamed: #stdin forWrite: false!
Item was added:
+ ----- Method: StandardFileStream class>>stdioHandles (in
category 'private-file creation') -----
+ stdioHandles
+ <primitive: 'primitiveFileStdioHandles' module: 'FilePlugin' error:
ec>
+ self primitiveFailed!
Item was added:
+ ----- Method: StandardFileStream class>>stdout (in category 'file
creation') -----
+ stdout
+ ^self standardIOStreamNamed: #stdout forWrite: true!
Item was added:
+ ----- Method: StandardFileStream class>>voidStdioFiles (in
category 'class initialization') -----
+ voidStdioFiles
+ stdioFiles := nil!
Item was added:
+ ----- Method: StandardFileStream>>openOnHandle:name:forWrite: (in
category 'open/close') -----
+ openOnHandle: aFileID name: streamName forWrite: writeMode
+ "Initialize the file with the given handle. If writeMode is true
then
+ allow writing, otherwise put the file in read-only mode.
+ N.B. Do _not_ register the stream. We do not want it to be
+ closed implicitly (e.g. on GC). There may be multiple instances
+ accessing the same stream. The stream is not a file."
+ fileID := aFileID.
+ name := streamName.
+ rwmode := writeMode.
+ buffer1 := String new: 1.
+ self enableReadBuffering!
Nov. 11, 2010
[Pharo-project] Issue 3240 in pharo: be more explicit about attribute changes to gain another 5-10x speedup
by pharo@googlecode.com
Status: Fixed
Owner: stephane.ducasse
Labels: Milestone-1.2 Difficulty-Easy
New issue 3240 by stephane.ducasse: be more explicit about attribute
changes to gain another 5-10x speedup
http://code.google.com/p/pharo/issues/detail?id=3240
Levente Uzonyi uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-ul.390.mcz
==================== Summary ====================
Name: System-ul.390
Author: ul
Time: 4 November 2010, 10:44:58.211 pm
UUID: 57baf4d2-ec35-614b-875e-bfbca4d9cbf2
Ancestors: System-ul.389
- be more explicit about attribute changes to gain another 5-10x speedup
=============== Diff against System-ul.389 ===============
Item was changed:
----- Method: ClassDiffBuilder>>print:withAttributes:on: (in
category 'private') -----
print: aString withAttributes: attributes on: stream
stream
+ currentAttributes: attributes;
+ nextPutAll: aString!
- withAttributes: attributes
- do: [ stream nextPutAll: aString ]!
Item was changed:
----- Method: TextDiffBuilder>>print:withAttributes:on: (in
category 'private') -----
print: aString withAttributes: attributes on: stream
stream
+ currentAttributes: attributes;
+ nextPutAll: aString.
+ (aString notEmpty and: [
+ aString last = Character cr or: [
+ aString endsWith: String crlf ] ])
+ ifFalse: [ stream cr ]!
- withAttributes: attributes
- do: [
- stream nextPutAll: aString.
- (aString notEmpty and: [
- aString last = Character cr or: [
- aString endsWith: String crlf ] ])
- ifFalse: [ stream cr ] ]!
Nov. 11, 2010
Re: [Pharo-project] Array of two empty sets asSet
by Martin McClure
On 11/11/2010 06:44 AM, Janko Mivšek wrote:
> Hi guys,
>
> What is rationale that
>
> (Array with: Set new with: Set new ) asSet
>
> returns only one set instead of two (as VW returns)? Those two new sets
> are not identical, therefore asSet should return them both?
They're not identical, but they are equal. It seems reasonable to
consider two empty Sets equal to each other.
Once you add a Set to another Set you can't add or remove anything from
the inner Set anyway (because that would change the inner Set's hash,
violating the invariant) so the two empty Sets might as well be the same
Set, since they're effectively immutable once added to another Set.
Unless you're *sure* that nothing will ever get added or removed from
the inner Sets, you should use an IdentitySet for the outer set.
Regards,
-Martin
Nov. 11, 2010