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 @@ -66,13 +66,13 @@ baselinePharo: spec
for: #(#'pharo10.x')
do: [
spec
package: 'Grease-Core' with: [ spec includes: #('Grease-Pharo10-Core') ];
package: 'Grease-Core' with: [ spec includes: #('Grease-Pharo100-Core') ];
package: 'Grease-Tests-Pharo-Core' with: [ spec requires: #('Grease-Tests-Core') ];
package: 'Grease-Tests-Core'
with: [ spec
requires: #('Grease-Pharo10-Core');
requires: #('Grease-Pharo100-Core');
includes: #('Grease-Tests-Pharo-Core') ];
package: 'Grease-Pharo10-Core' with: [ spec requires: #('Grease-Core') ];
package: 'Grease-Pharo100-Core' with: [ spec requires: #('Grease-Core') ];
package: 'Grease-Pharo90-Slime' with: [ spec requires: #('Grease-Core') ];
package: 'Grease-Tests-Slime' with: [ spec requires: #('Grease-Pharo90-Slime') ].

Expand Down
5 changes: 5 additions & 0 deletions repository/Grease-Pharo100-Core.package/.filetree
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"separateMethodMetaAndSource" : false,
"noMethodMetaData" : true,
"useCypressPropertiesFile" : true
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*Grease-Pharo100-Core
fullName
"In VW, will include the namespace"

^ self name
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"name" : "Behavior"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
*Grease-Pharo100-Core
valueWithPossibleArguments: anArray
| args |
(anArray size == self numArgs)
ifTrue: [ ^ self valueWithArguments: anArray ].
args := Array new: self numArgs.
args replaceFrom: 1
to: (anArray size min: args size)
with: anArray
startingAt: 1.
^ self valueWithArguments: args
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"name" : "BlockClosure"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*Grease-Pharo100-Core
greaseString
"ByteArrays should not automatically be converted to Strings. You should use a GRCodec for this."
^ self printString
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"name" : "ByteArray"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*Grease-Pharo100-Core
greaseInteger
"Answer an unicode code point of the receiver."
^ self charCode
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"name" : "Character"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*Grease-Pharo100-Core
any
^ self anyOne
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"name" : "Collection"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*Grease-Pharo100-Core
asHTMLColor
^'#', self asHexString
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"name" : "Color"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*Grease-Pharo100-Core
milliseconds: anInteger
^ self milliSeconds: anInteger
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*Grease-Pharo100-Core
asMilliseconds
^ self asMilliSeconds
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*Grease-Pharo100-Core
milliseconds
^ nanos quo: NanosInMillisecond
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"name" : "Duration"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*Grease-Pharo100-Core
greaseNext: anInteger putAll: aCollection startingAt: startIndex
stream greaseNext: anInteger putAll: aCollection startingAt: startIndex
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"name" : "GRDelegatingStream"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
defaults
defaultValue
^ nil
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
accessing
use: anObject during: aBlock
^ self
value: anObject
during: aBlock
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
default
^ self class defaultValue
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"commentStamp" : "",
"super" : "DynamicVariable",
"category" : "Grease-Pharo100-Core",
"classinstvars" : [ ],
"pools" : [ ],
"classvars" : [ ],
"instvars" : [ ],
"name" : "GRDynamicVariable",
"type" : "normal"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
*Grease-Pharo100-Core
greasePharo70Core
^ self new
name: 'Grease-Pharo90-Core';
addDependency: 'Grease-Core';
url: #greaseUrl;
yourself
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"name" : "GRPackage"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
A WAConverterCodecStream is a WACodec stream around a TextConverter. It is always in text mode.

Instance Variables
converter: <TextConverter>

converter
- the TextConverter used to do the encoding conversion
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
instance creation
on: aStream converter: aConverter
^ self basicNew initializeOn: aStream converter: aConverter
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
streaming
greaseNext: anInteger putAll: aCollection startingAt: startIndex
self nextPutAll: (aCollection copyFrom: startIndex to: startIndex + anInteger - 1)
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
initialization
initializeOn: aStream converter: aConverter
self initializeOn: aStream.
converter := aConverter
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
streaming
next: anInteger
| writeStream |
writeStream := WriteStream on: (String new: anInteger).
anInteger timesRepeat: [
writeStream nextPut: (self next
ifNil: [ ^ writeStream contents ]) ].
^ writeStream contents
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
streaming
next
| character |
character := converter nextFromStream: stream.
^ character isNil
ifFalse: [ character asCharacter ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
streaming
nextPut: aCharacter
converter nextPut: aCharacter asCharacter toStream: stream
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
streaming
nextPutAll: aString
aString asString do: [ :each | self nextPut: each ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"commentStamp" : "pmm 6/25/2012 20:22",
"super" : "GRCodecStream",
"category" : "Grease-Pharo100-Core",
"classinstvars" : [ ],
"pools" : [ ],
"classvars" : [ ],
"instvars" : [
"converter"
],
"name" : "GRPharoConverterCodecStream",
"type" : "normal"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
A WAUtf8CodecStream is a WACodecStream optimized for UTF-8 performance in the case where most of the characters are ASCII.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
streaming
crlf
stream nextPut: Character cr.
stream nextPut: Character lf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
private
encodeDefault: aString
"Convert the given string from UTF-8 using the fast path if converting to Latin-1"
1 to: aString size by: 1 do: [ :index |
converter nextPut: (aString at: index) toStream: stream ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
private
encodeFast: aByteString
"Convert the given string from UTF-8 using the fast path if converting to Latin-1"
| lastIndex nextIndex |
lastIndex := 1.
nextIndex := ByteString findFirstInString: aByteString inSet: Latin1ToUtf8Map startingAt: lastIndex.
nextIndex = 0 ifTrue: [ ^ stream nextPutAll: aByteString ].
[ nextIndex > lastIndex ifTrue: [
stream greaseNext: nextIndex - lastIndex putAll: aByteString startingAt: lastIndex ].
stream nextPutAll: (Latin1ToUtf8Encodings at: (aByteString byteAt: nextIndex) + 1).
lastIndex := nextIndex + 1.
nextIndex := ByteString findFirstInString: aByteString inSet: Latin1ToUtf8Map startingAt: lastIndex.
nextIndex = 0 ] whileFalse.
stream greaseNext: aByteString size - lastIndex + 1 putAll: aByteString startingAt: lastIndex
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
streaming
greaseNext: anInteger putAll: aCollection startingAt: startIndex
aCollection isByteString
ifTrue: [ self greaseNext: anInteger putAllFast: aCollection startingAt: startIndex ]
ifFalse: [ super greaseNext: anInteger putAll: aCollection startingAt: startIndex ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
private
greaseNext: anInteger putAllFast: aByteString startingAt: startIndex
| lastIndex nextIndex |
lastIndex := startIndex.
nextIndex := ByteString findFirstInString: aByteString inSet: Latin1ToUtf8Map startingAt: lastIndex.
nextIndex = 0 ifTrue: [ ^ stream greaseNext: anInteger putAll: aByteString startingAt: startIndex ].
[
nextIndex >= (startIndex + anInteger) ifTrue: [
^ stream greaseNext: startIndex + anInteger - lastIndex putAll: aByteString startingAt: lastIndex ].
nextIndex > lastIndex ifTrue: [
stream greaseNext: nextIndex - lastIndex putAll: aByteString startingAt: lastIndex ].
stream nextPutAll: (Latin1ToUtf8Encodings at: (aByteString byteAt: nextIndex) + 1).
lastIndex := nextIndex + 1.
nextIndex := ByteString findFirstInString: aByteString inSet: Latin1ToUtf8Map startingAt: lastIndex.
(nextIndex = 0 or: [ nextIndex >= (startIndex + anInteger) ]) ] whileFalse.
lastIndex >= (startIndex + anInteger) ifFalse: [
stream greaseNext: startIndex + anInteger - lastIndex putAll: aByteString startingAt: lastIndex ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
private
invalidUtf8
^ GRInvalidUtf8Error signal: 'Invalid UTF-8 input'
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
streaming
next: anInteger
"Convert the given string from UTF-8 using the fast path if converting to Latin-1"
| output byte1 byte2 byte3 byte4 unicode count alreadyWide |
output := ByteString new: anInteger.
count := 0.
alreadyWide := false.
[ count < anInteger and: [ stream atEnd not ] ] whileTrue: [
byte1 := stream next.
unicode := byte1.
(byte1 bitAnd: 16rE0) = 192 ifTrue: [ "two bytes"
byte2 := stream next.
(byte2 bitAnd: 16rC0) = 16r80 ifFalse: [ self invalidUtf8 ].
unicode := ((byte1 bitAnd: 31) bitShift: 6) + (byte2 bitAnd: 63) ].
(byte1 bitAnd: 16rF0) = 224 ifTrue: [ "three bytes"
byte2 := stream next.
(byte2 bitAnd: 16rC0) = 16r80 ifFalse: [ self invalidUtf8 ].
byte3 := stream next.
(byte3 bitAnd: 16rC0) = 16r80 ifFalse: [ self invalidUtf8 ].
unicode := ((byte1 bitAnd: 15) bitShift: 12) + ((byte2 bitAnd: 63) bitShift: 6)
+ (byte3 bitAnd: 63).
alreadyWide ifFalse: [
output := WideString withAll: output.
alreadyWide := true ] ].
(byte1 bitAnd: 16rF8) = 240 ifTrue: [ "four bytes"
byte2 := stream next.
(byte2 bitAnd: 16rC0) = 16r80 ifFalse: [ self invalidUtf8 ].
byte3 := stream next.
(byte3 bitAnd: 16rC0) = 16r80 ifFalse: [ self invalidUtf8 ].
byte4 := stream next.
(byte4 bitAnd: 16rC0) = 16r80 ifFalse: [ self invalidUtf8 ].
unicode := ((byte1 bitAnd: 16r7) bitShift: 18) +
((byte2 bitAnd: 63) bitShift: 12) +
((byte3 bitAnd: 63) bitShift: 6) +
(byte4 bitAnd: 63).
alreadyWide ifFalse: [
output := WideString withAll: output.
alreadyWide := true ] ].
unicode ifNil: [ self invalidUtf8 ].
unicode = 16rFEFF "ignore BOM" ifFalse: [
count := count + 1.
output at: count put: (Character codePoint: unicode) ].
unicode := nil ].
^ count < anInteger
ifTrue: [ output first: count ]
ifFalse: [ output ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
streaming
next
^ (self next: 1) first
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
streaming
nextPut: aCharacter
| codePoint shouldEncode |
codePoint := aCharacter codePoint.
codePoint > 255
ifTrue: [ ^ self nextPutAll: (String with: aCharacter) ].
shouldEncode := Latin1ToUtf8Map at: codePoint + 1.
shouldEncode = 1
ifTrue: [ stream nextPutAll: (Latin1ToUtf8Encodings at: codePoint + 1) ]
ifFalse: [ stream nextPut: aCharacter ]

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
streaming
nextPutAll: aString
aString isByteString
ifTrue: [ self encodeFast: aString ]
ifFalse: [ self encodeDefault: aString ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"commentStamp" : "pmm 2/20/2009 12:27",
"super" : "GRPharoConverterCodecStream",
"category" : "Grease-Pharo100-Core",
"classinstvars" : [ ],
"pools" : [ ],
"classvars" : [
"Latin1ToUtf8Encodings",
"Latin1ToUtf8Map"
],
"instvars" : [ ],
"name" : "GRPharoDeprecatedUtf8CodecStream",
"type" : "normal"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
A GRPharoLatin1Codec is a WACodec optimized for ISO-8859-1 (direct byte to character mapping).
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
private
basicForEncoding: aString
(self supportsEncoding: aString)
ifFalse: [ self unsupportedEncoding: aString ].
^ self basicNew initializeWithName: aString
Loading
X Tutup