X Tutup
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ instance creation
forEncoding: aString
"Answer a new codec instance for the given encoding name. Raise an WAUnsupportedEncodingError if the encoding name is not supported by this image."

self allSubclassesDo: [ :each |
self allSubclassesDo: [ :each |
(each supportsEncoding: aString)
ifTrue: [ ^ each basicForEncoding: aString ] ].
^ self unsupportedEncoding: aString
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
conversion
decoderFor: aReadStream
"Wrap aReadStream with an decoder for the codec of the receiver. Answer a read stream that delegates to and shares the state of aReadStream."
"Wrap aReadStream with an decoder for the codec of the receiver. Answer a read stream that delegates to and shares the state of aReadStream."

self subclassResponsibility
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
conversion
encoderFor: aWriteStream
"Wrap aWriteStream with an encoder for the codec of the receiver. Answer a write stream that delegates to and shares the state of aWriteStream."

self subclassResponsibility
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
instance creation
receiver: anObject selector: aSymbol
^ self basicNew
receiver: anObject selector: aSymbol
^ self basicNew
initializeWithReceiver: anObject
message: (GRUnboundMessage selector: aSymbol);
yourself
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
instance creation
receiver: anObject selector: aSymbol arguments: anArray
^ self basicNew
receiver: anObject selector: aSymbol arguments: anArray
^ self basicNew
initializeWithReceiver: anObject
message: (GRBoundMessage selector: aSymbol arguments: anArray);
yourself
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
accessing
argumentCount
"Answer the number of arguments that must be provided to the receiver when sending it."

^ message argumentCount
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
delegation
argumentCount
"Answer the number of arguments that must be provided when sending this message."

self subclassResponsibility
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ delegation
valueFor: receiver withArguments: anArray
"Send the message to receiver with the arguments in anArray. Answer the result.
Signal an error if the number of arguments does not match the selector."

^ self basicPerformFor: receiver withArguments: (self mergeArguments: anArray)
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ valueFor: receiver withPossibleArguments: anArray

| allArguments |
allArguments := self mergeArguments: anArray.

^ allArguments size < selector numArgs
ifTrue: [ self invalidArgumentCount ]
ifFalse: [ self basicPerformFor: receiver withArguments: (allArguments first: selector numArgs) ]
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
instance creation
block: aBlock next: aPrinter
^ self new
^ self new
block: aBlock;
next: aPrinter;
yourself
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
evaluating
use: anObject during: aBlock
"Set the dynamic value of the receiver to anObject during the evaluation of aBlock."

^ aBlock on: self do: [ :notification | notification resume: anObject ]
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
evaluating
value
"Answer the dynamic value of the receiver."

^ self signal
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
conversion
decoderFor: aReadStream
decoderFor: aReadStream
"wrap to avoid String vs ByteArray issues"
^ GRNullCodecStream on: aReadStream
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
conversion
encoderFor: aWriteStream
encoderFor: aWriteStream
"wrap to avoid String vs ByteArray issues"
^ GRNullCodecStream on: aWriteStream
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
accessing
url
"The selfish method. Let's do it with ourselves."

^ self
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
accessing
accuracy: aFloat
"Round towards the nearest number that is a multiple of aFloat."

accuracy := aFloat
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ digitsOf: aNumber base: aBaseInteger
stream := WriteStream on: (String new: 10).
[ integer > 0 ] whileTrue: [
next := integer quo: aBaseInteger.
stream nextPut: (characters
stream nextPut: (characters
at: 1 + integer - (next * aBaseInteger)).
integer := next ].
^ stream contents reverse
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
accessing
infinite: aString
"The string that should be displayed if the number is positive or negative infinity."

infinite := aString
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ lengthOf: aNumber base: aBaseInteger
integer := aNumber truncated abs.
length := 1.
current := aBaseInteger.
[ current <= integer ] whileTrue: [
[ current <= integer ] whileTrue: [
length := length + 1.
current := current * aBaseInteger ].
^ length
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
accessing
nan: aString
"The string that should be displayed if the number is not a number."

nan := aString
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
accessing
precision: anInteger
"The number of digits to be printed in the fraction part."

precision := anInteger
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ printing
print: aNumber on: aStream
aNumber isNaN
ifTrue: [ ^ self printNaN: aNumber on: aStream ].
aNumber isInfinite
aNumber isInfinite
ifTrue: [ ^ self printInfinite: aNumber on: aStream ].
precision = 0
ifTrue: [ self printInteger: aNumber on: aStream ]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ printDigitsOf: aNumber withLength: aLengthInteger on: aStream
| divisor current |
divisor := base raisedTo: aLengthInteger - index.
current := rest // divisor.
separator isNil ifFalse: [
separator isNil ifFalse: [
(index ~= 1 and: [ (aLengthInteger - index) \\ 3 = 2 ])
ifTrue: [ aStream nextPut: separator ] ].
aStream nextPut: (characters at: current + 1).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ printing
printInteger: aNumber on: aStream
| length |
length := self lengthOf: aNumber base: base.

(digits notNil and: [ padding notNil ])
ifTrue: [ self padLeft: padding to: (digits - length) on: aStream ].

self printDigitsOf: aNumber withLength: length on: aStream
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
utilities
separate: aString left: aCharacter on: aStream
"Separate from the left side every 3 characters with aCharacter."

| size |
size := aString size.
1 to: size do: [ :index |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
utilities
separate: aString right: aCharacter
"Separate from the right side every 3 characters with aCharacter."

| size stream |
size := aString size.
stream := WriteStream on: (String new: 2 * size).
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
actions
uppercase
"Use uppercase characters for numbers of base 10 and higher."

self characters: NumbersToCharactersUppercase
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ accessing
at: aKey add: aValue
"Add an association between aKey and aValue. Do not replace existing
values with the same key."

^ self privateAt: aKey put: aValue
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ adding
at: aKey add: aValue
"Add an association between aKey and aValue. Do not replace existing
values with the same key."

^ self privateAt: aKey put: aValue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ private
ordinalize: anInteger
^ (anInteger \\ 100 between: 11 and: 13)
ifTrue: [ 'th' ]
ifFalse: [
ifFalse: [
#('st' 'nd' 'rd')
at: anInteger \\ 10
at: anInteger \\ 10
ifAbsent: [ 'th' ] ]
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ grPackages
| packages package |
packages := Dictionary new.
self class selectors do: [ :each |
(each numArgs = 0 and: [ each ~= #grPackages ]) ifTrue: [
(each numArgs = 0 and: [ each ~= #grPackages ]) ifTrue: [
package := self perform: each.
packages at: package name put: package ] ].
packages do: [ :each | each resolveWith: packages ].
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
dependencies
resolveWith: aDictionary
dependencies := dependencies
dependencies := dependencies
collect: [ :each |
aDictionary at: each ifAbsent: [
"if Foo-Pharo-Bar fails try Foo-Pharo20-Bar and Foo-Pharo30-Bar"
(each indexOfSubCollection: '-Pharo-' startingAt: 1) ~= 0 ifTrue: [
(each indexOfSubCollection: '-Pharo-' startingAt: 1) ~= 0 ifTrue: [
"try -Pharo40-"
aDictionary at: (each copyReplaceAll: '-Pharo-' with: '-Pharo40-') ifAbsent: [
"try -Pharo50-"
Expand All @@ -16,7 +16,7 @@ resolveWith: aDictionary
"try -Pharo90-"
aDictionary at: (each copyReplaceAll: '-Pharo-' with: '-Pharo90-') ifAbsent: [
"try -Pharo100-"
aDictionary at: (each copyReplaceAll: '-Pharo-' with: '-Pharo100-') ifAbsent: [
aDictionary at: (each copyReplaceAll: '-Pharo-' with: '-Pharo100-') ifAbsent: [
"try -Squeak-"
aDictionary at: (each copyReplaceAll: '-Pharo-' with: '-Squeak-') ifAbsent: [
"try -Squeak5-"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
file library
asMethodReturningString: aByteArrayOrString named: aSymbol
"Generates the source of a method named aSymbol that returns aByteArrayOrString as a String.

This implementation answers a String formatted like so

aSymbol
^ aByteArrayOrString

Subclasses need to override this method if the dialect needs changes to support Unicode string literals"
^ String streamContents: [ :stream |
^ String streamContents: [ :stream |
stream
nextPutAll: aSymbol;
nextPut: Character cr.
stream
tab;
nextPutAll: '^ '''.
aByteArrayOrString greaseString do: [ :each |
aByteArrayOrString greaseString do: [ :each |
each = $' ifTrue: [ stream nextPut: $' ].
stream nextPut: each ].
stream nextPut: $' ]
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ bindingOf: aClass
The binding is the literal that get compiled into the method.
We need the binding to be updated when the class is changed.
The binding has to respond to #value.

This is mostly an issue on GemStone/S because when we hold on
to a class directly we will end up holding on to an old class version.

Dialects with namespaces will need to override this.

On VisualWorks this should like this
^ aClass fullyQualifiedReference"
^ Smalltalk associationAt: aClass name
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
file library
convertToSmalltalkNewlines: aString
"Convert any line endings (CR, CRLF, LF) to the default platform newline."
aString isNil

aString isNil
ifTrue: [ ^ nil ].
^ String streamContents: [ :writeStream |
| readStream |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
files
fileStreamOn: aString do: aBlock binary: aBoolean
self
self
greaseDeprecatedApi: 'GRPlatform>>#fileStreamOn:do:binary:'
details: 'Use readFileStreamOn:do:binary:'.
^ self readFileStreamOn: aString do: aBlock binary: aBoolean
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
processes
isProcessTerminated: aProcess
"Return a boolean indicating whether aProcess has been terminated."

self subclassResponsibility
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
version info
label
"Answer a descriptive label string for the platform implementation"

self subclassResponsibility
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
files
localNameOf: aFilename
"Answer the local name of a file identified by an absolute file path.
Eg.
If the platform is Windwos and aFilename is 'C:\Windows\win32.dll' then it would answer 'win32.dll'.
If the platform is Unix and aFilename is '/usr/bin/vim' then it would answer 'vim'."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ newRandom
"Answers the random number generator to be used to create session and continuation keys. Make sure it is seeded. They only methods that will be sent to it are:
#nextInt: - should answer a random integer in the interval [1, anInteger]
#randomFrom: - should answer a random element from the given collection

Make sure that both methods are safe under heavy concurrent load.

Used by Gemstone/S traditional Randoms which cannot be persisted.
Used by Squeak to use a secure random when avaiable."
self subclassResponsibility
Loading
X Tutup