-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #161 from theseion/add-integer-greaseasbytearray
Add #greaseAsByteArray and implementation for Squeak
- Loading branch information
Showing
138 changed files
with
722 additions
and
276 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
repository/Grease-Core.package/Collection.extension/instance/greaseAsByteArray.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
*Grease-Core | ||
greaseAsByteArray | ||
^ self asByteArray |
3 changes: 3 additions & 0 deletions
3
repository/Grease-Core.package/Collection.extension/properties.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"name" : "Collection" | ||
} |
3 changes: 3 additions & 0 deletions
3
repository/Grease-Core.package/GRPlatform.class/instance/integerAsByteArray..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
encoding | ||
integerAsByteArray: anInteger | ||
^ anInteger asByteArray |
3 changes: 3 additions & 0 deletions
3
repository/Grease-Core.package/Integer.extension/instance/greaseAsByteArray.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
*Grease-Core | ||
greaseAsByteArray | ||
^ GRPlatform current integerAsByteArray: self |
3 changes: 3 additions & 0 deletions
3
repository/Grease-Core.package/Integer.extension/instance/greaseByteAt..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
*Grease-Core | ||
greaseByteAt: index | ||
^ self subclassResponsibility |
3 changes: 3 additions & 0 deletions
3
repository/Grease-Core.package/Integer.extension/instance/greaseBytesCount.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
*Grease-Core | ||
greaseBytesCount | ||
^ self subclassResponsibility |
4 changes: 4 additions & 0 deletions
4
repository/Grease-GemStone-Core.package/LargeInteger.extension/instance/greaseByteAt..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
*grease-gemstone-core | ||
greaseByteAt: index | ||
|
||
^ self digitAt: index |
4 changes: 4 additions & 0 deletions
4
repository/Grease-GemStone-Core.package/LargeInteger.extension/instance/greaseBytesCount.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
*grease-gemstone-core | ||
greaseBytesCount | ||
|
||
^ self digitLength |
2 changes: 2 additions & 0 deletions
2
repository/Grease-GemStone-Core.package/LargeInteger.extension/properties.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
{ | ||
"name" : "LargeInteger" } |
4 changes: 4 additions & 0 deletions
4
repository/Grease-GemStone-Core.package/SmallInteger.extension/instance/greaseByteAt..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
*grease-gemstone-core | ||
greaseByteAt: index | ||
|
||
^ self digitAt: index |
4 changes: 4 additions & 0 deletions
4
repository/Grease-GemStone-Core.package/SmallInteger.extension/instance/greaseBytesCount.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
*grease-gemstone-core | ||
greaseBytesCount | ||
|
||
^ self digitLength |
2 changes: 2 additions & 0 deletions
2
repository/Grease-GemStone-Core.package/SmallInteger.extension/properties.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
{ | ||
"name" : "SmallInteger" } |
3 changes: 3 additions & 0 deletions
3
repository/Grease-Pharo100-Core.package/LargeInteger.extension/instance/greaseByteAt..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
*Grease-Pharo100-Core | ||
greaseByteAt: index | ||
^ self byteAt: index |
3 changes: 3 additions & 0 deletions
3
repository/Grease-Pharo100-Core.package/LargeInteger.extension/instance/greaseBytesCount.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
*Grease-Pharo100-Core | ||
greaseBytesCount | ||
^ self bytesCount |
3 changes: 3 additions & 0 deletions
3
repository/Grease-Pharo100-Core.package/LargeInteger.extension/properties.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"name" : "LargeInteger" | ||
} |
3 changes: 3 additions & 0 deletions
3
repository/Grease-Pharo100-Core.package/SmallInteger.extension/instance/greaseByteAt..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
*Grease-Pharo100-Core | ||
greaseByteAt: index | ||
^ self byteAt: index |
3 changes: 3 additions & 0 deletions
3
repository/Grease-Pharo100-Core.package/SmallInteger.extension/instance/greaseBytesCount.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
*Grease-Pharo100-Core | ||
greaseBytesCount | ||
^ self bytesCount |
3 changes: 3 additions & 0 deletions
3
repository/Grease-Pharo100-Core.package/SmallInteger.extension/properties.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"name" : "SmallInteger" | ||
} |
2 changes: 1 addition & 1 deletion
2
repository/Grease-Pharo60-Core.package/GRPharoPlatform.class/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
A WASqueakPlatform is the Squeak implementation of SeasidePlatformSupport, the Seaside class that provides functionality that can not be implemented in a platform independent way. | ||
A GRPharoPlatform is the Pharo implementation of GRPlatform, the Grease class that provides functionality that can not be implemented in a platform independent way. |
7 changes: 7 additions & 0 deletions
7
repository/Grease-Pharo60-Core.package/GRPharoPlatform.class/instance/integerAsByteArray..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
encoding | ||
integerAsByteArray: anInteger | ||
| stream | | ||
stream := ByteArray new writeStream. | ||
anInteger greaseBytesCount to: 1 by: -1 do: [:digitIndex | | ||
stream nextPut: (anInteger greaseByteAt: digitIndex)]. | ||
^ stream contents |
2 changes: 1 addition & 1 deletion
2
repository/Grease-Pharo60-Core.package/GRPharoPlatform.class/properties.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
repository/Grease-Pharo60-Core.package/LargeInteger.extension/instance/greaseByteAt..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
*Grease-Pharo60-Core | ||
greaseByteAt: index | ||
"Primitive. Answer the value of an indexable field in the receiver. LargePositiveInteger uses bytes of base two number, and each is a 'digit' base 256. Fail if the argument (the index) is not an Integer or is out of bounds. Essential. See Object documentation whatIsAPrimitive." | ||
|
||
<primitive: 60> | ||
self greaseBytesCount < index | ||
ifTrue: [^0] | ||
ifFalse: [^super at: index] |
8 changes: 8 additions & 0 deletions
8
repository/Grease-Pharo60-Core.package/LargeInteger.extension/instance/greaseBytesCount.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
*Grease-Pharo60-Core | ||
greaseBytesCount | ||
"Primitive. Answer the number of indexable fields in the receiver. This | ||
value is the same as the largest legal subscript. Essential. See Object | ||
documentation whatIsAPrimitive." | ||
|
||
<primitive: 62> | ||
self primitiveFailed |
3 changes: 3 additions & 0 deletions
3
repository/Grease-Pharo60-Core.package/LargeInteger.extension/properties.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"name" : "LargeInteger" | ||
} |
14 changes: 14 additions & 0 deletions
14
repository/Grease-Pharo60-Core.package/SmallInteger.extension/instance/greaseByteAt..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
*Grease-Pharo60-Core | ||
greaseByteAt: n | ||
"Answer the value of an apparent byte-indexable field in the receiver, | ||
analogous to the large integers, which are organized as bytes." | ||
|
||
n = 1 | ||
ifTrue: [ | ||
"Negate carefully in case the receiver is SmallInteger minVal" | ||
^ self < 0 | ||
ifTrue: [ -256 - self bitAnd: 255 ] | ||
ifFalse: [ self bitAnd: 255 ] ]. | ||
^ self < 0 | ||
ifTrue: [ (-256 - self bitShift: -8) + 1 byteAt: n - 1 ] | ||
ifFalse: [ (self bitShift: 8 - (n bitShift: 3)) bitAnd: 255 ] |
25 changes: 25 additions & 0 deletions
25
repository/Grease-Pharo60-Core.package/SmallInteger.extension/instance/greaseBytesCount.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
*Grease-Pharo60-Core | ||
greaseBytesCount | ||
"Answer the number of indexable fields in the receiver. This value is the | ||
same as the largest legal subscript. Included so that a SmallInteger can | ||
behave like a LargePositiveInteger or LargeNegativeInteger." | ||
|
||
"32768 == (1 bitShift: 15)" | ||
"32768 bytesCount >>> 2" | ||
|
||
"65536 == (1 bitShift: 16)" | ||
"65536 bytesCount >>> 3" | ||
|
||
| value length | | ||
length := 1. | ||
value := self. | ||
value >= 0 | ||
ifTrue: | ||
[[value > 255] whileTrue: | ||
[value := value bitShift: -8. | ||
length := length + 1]] | ||
ifFalse: | ||
[[value < -255] whileTrue: | ||
[value := value bitShift: -8. | ||
length := length + 1]]. | ||
^length |
3 changes: 3 additions & 0 deletions
3
repository/Grease-Pharo60-Core.package/SmallInteger.extension/properties.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"name" : "SmallInteger" | ||
} |
8 changes: 8 additions & 0 deletions
8
repository/Grease-Pharo70-Core.package/LargeInteger.extension/instance/greaseByteAt..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
*Grease-Pharo70-Core | ||
greaseByteAt: index | ||
"Primitive. Answer the value of an indexable field in the receiver. LargePositiveInteger uses bytes of base two number, and each is a 'digit' base 256. Fail if the argument (the index) is not an Integer or is out of bounds. Essential. See Object documentation whatIsAPrimitive." | ||
|
||
<primitive: 60> | ||
self greaseBytesCount < index | ||
ifTrue: [^0] | ||
ifFalse: [^super at: index] |
8 changes: 8 additions & 0 deletions
8
repository/Grease-Pharo70-Core.package/LargeInteger.extension/instance/greaseBytesCount.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
*Grease-Pharo70-Core | ||
greaseBytesCount | ||
"Primitive. Answer the number of indexable fields in the receiver. This | ||
value is the same as the largest legal subscript. Essential. See Object | ||
documentation whatIsAPrimitive." | ||
|
||
<primitive: 62> | ||
self primitiveFailed |
3 changes: 3 additions & 0 deletions
3
repository/Grease-Pharo70-Core.package/LargeInteger.extension/properties.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"name" : "LargeInteger" | ||
} |
14 changes: 14 additions & 0 deletions
14
repository/Grease-Pharo70-Core.package/SmallInteger.extension/instance/greaseByteAt..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
*Grease-Pharo70-Core | ||
greaseByteAt: n | ||
"Answer the value of an apparent byte-indexable field in the receiver, | ||
analogous to the large integers, which are organized as bytes." | ||
|
||
n = 1 | ||
ifTrue: [ | ||
"Negate carefully in case the receiver is SmallInteger minVal" | ||
^ self < 0 | ||
ifTrue: [ -256 - self bitAnd: 255 ] | ||
ifFalse: [ self bitAnd: 255 ] ]. | ||
^ self < 0 | ||
ifTrue: [ (-256 - self bitShift: -8) + 1 byteAt: n - 1 ] | ||
ifFalse: [ (self bitShift: 8 - (n bitShift: 3)) bitAnd: 255 ] |
25 changes: 25 additions & 0 deletions
25
repository/Grease-Pharo70-Core.package/SmallInteger.extension/instance/greaseBytesCount.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
*Grease-Pharo70-Core | ||
greaseBytesCount | ||
"Answer the number of indexable fields in the receiver. This value is the | ||
same as the largest legal subscript. Included so that a SmallInteger can | ||
behave like a LargePositiveInteger or LargeNegativeInteger." | ||
|
||
"32768 == (1 bitShift: 15)" | ||
"32768 bytesCount >>> 2" | ||
|
||
"65536 == (1 bitShift: 16)" | ||
"65536 bytesCount >>> 3" | ||
|
||
| value length | | ||
length := 1. | ||
value := self. | ||
value >= 0 | ||
ifTrue: | ||
[[value > 255] whileTrue: | ||
[value := value bitShift: -8. | ||
length := length + 1]] | ||
ifFalse: | ||
[[value < -255] whileTrue: | ||
[value := value bitShift: -8. | ||
length := length + 1]]. | ||
^length |
3 changes: 3 additions & 0 deletions
3
repository/Grease-Pharo70-Core.package/SmallInteger.extension/properties.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"name" : "SmallInteger" | ||
} |
3 changes: 3 additions & 0 deletions
3
repository/Grease-Pharo90-Core.package/LargeInteger.extension/instance/greaseByteAt..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
*Grease-Pharo90-Core | ||
greaseByteAt: index | ||
^ self byteAt: index |
3 changes: 3 additions & 0 deletions
3
repository/Grease-Pharo90-Core.package/LargeInteger.extension/instance/greaseBytesCount.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
*Grease-Pharo90-Core | ||
greaseBytesCount | ||
^ self bytesCount |
3 changes: 3 additions & 0 deletions
3
repository/Grease-Pharo90-Core.package/LargeInteger.extension/properties.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"name" : "LargeInteger" | ||
} |
3 changes: 3 additions & 0 deletions
3
repository/Grease-Pharo90-Core.package/SmallInteger.extension/instance/greaseByteAt..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
*Grease-Pharo90-Core | ||
greaseByteAt: index | ||
^ self byteAt: index |
3 changes: 3 additions & 0 deletions
3
repository/Grease-Pharo90-Core.package/SmallInteger.extension/instance/greaseBytesCount.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
*Grease-Pharo90-Core | ||
greaseBytesCount | ||
^ self bytesCount |
3 changes: 3 additions & 0 deletions
3
repository/Grease-Pharo90-Core.package/SmallInteger.extension/properties.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"name" : "SmallInteger" | ||
} |
7 changes: 7 additions & 0 deletions
7
repository/Grease-Squeak-Core.package/GRSqueakPlatform.class/instance/integerAsByteArray..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
encoding | ||
integerAsByteArray: anInteger | ||
| stream | | ||
stream := ByteArray new writeStream. | ||
anInteger greaseBytesCount to: 1 by: -1 do: [:digitIndex | | ||
stream nextPut: (anInteger greaseByteAt: digitIndex)]. | ||
^ stream contents |
8 changes: 8 additions & 0 deletions
8
repository/Grease-Squeak-Core.package/LargeInteger.extension/instance/greaseByteAt..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
*Grease-Squeak-Core | ||
greaseByteAt: index | ||
"Primitive. Answer the value of an indexable field in the receiver. LargePositiveInteger uses bytes of base two number, and each is a 'digit' base 256. Fail if the argument (the index) is not an Integer or is out of bounds. Essential. See Object documentation whatIsAPrimitive." | ||
|
||
<primitive: 60> | ||
self greaseBytesCount < index | ||
ifTrue: [^0] | ||
ifFalse: [^super at: index] |
8 changes: 8 additions & 0 deletions
8
repository/Grease-Squeak-Core.package/LargeInteger.extension/instance/greaseBytesCount.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
*Grease-Squeak-Core | ||
greaseBytesCount | ||
"Primitive. Answer the number of indexable fields in the receiver. This | ||
value is the same as the largest legal subscript. Essential. See Object | ||
documentation whatIsAPrimitive." | ||
|
||
<primitive: 62> | ||
self primitiveFailed |
3 changes: 3 additions & 0 deletions
3
repository/Grease-Squeak-Core.package/LargeInteger.extension/properties.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"name" : "LargeInteger" | ||
} |
1 change: 1 addition & 0 deletions
1
repository/Grease-Squeak-Core.package/ManifestGreaseSqueakCore.class/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Please describe the package using the class comment of the included manifest class. The manifest class also includes other additional metadata for the package. These meta data are used by other tools such as the SmalllintManifestChecker and the critics Browser |
3 changes: 3 additions & 0 deletions
3
...akCore.class/class/ruleLiteralArrayContainsSuspiciousTrueFalseOrNilRuleV1FalsePositive.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
code-critics | ||
ruleLiteralArrayContainsSuspiciousTrueFalseOrNilRuleV1FalsePositive | ||
^ #(#(#(#RGMetaclassDefinition #(#'ManifestGreaseSqueakCore class' #ManifestGreaseSqueakCore)) #'2023-10-29T14:22:04.342701+01:00') ) |
3 changes: 3 additions & 0 deletions
3
...ackage/ManifestGreaseSqueakCore.class/class/ruleSendsDifferentSuperRuleV1FalsePositive.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
code-critics | ||
ruleSendsDifferentSuperRuleV1FalsePositive | ||
^ #(#(#(#RGMethodDefinition #(#LargeInteger #greaseByteAt: #false)) #'2023-10-29T14:21:20.47823+01:00') ) |
3 changes: 3 additions & 0 deletions
3
...ak-Core.package/ManifestGreaseSqueakCore.class/class/ruleSuperSendsRuleV1FalsePositive.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
code-critics | ||
ruleSuperSendsRuleV1FalsePositive | ||
^ #(#(#(#RGMethodDefinition #(#LargeInteger #greaseByteAt: #false)) #'2023-10-29T14:20:58.840268+01:00') ) |
11 changes: 11 additions & 0 deletions
11
repository/Grease-Squeak-Core.package/ManifestGreaseSqueakCore.class/properties.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"commentStamp" : "<historical>", | ||
"super" : "PackageManifest", | ||
"category" : "Grease-Squeak-Core-Manifest", | ||
"classinstvars" : [ ], | ||
"pools" : [ ], | ||
"classvars" : [ ], | ||
"instvars" : [ ], | ||
"name" : "ManifestGreaseSqueakCore", | ||
"type" : "normal" | ||
} |
14 changes: 14 additions & 0 deletions
14
repository/Grease-Squeak-Core.package/SmallInteger.extension/instance/greaseByteAt..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
*Grease-Squeak-Core | ||
greaseByteAt: n | ||
"Answer the value of an apparent byte-indexable field in the receiver, | ||
analogous to the large integers, which are organized as bytes." | ||
|
||
n = 1 | ||
ifTrue: [ | ||
"Negate carefully in case the receiver is SmallInteger minVal" | ||
^ self < 0 | ||
ifTrue: [ -256 - self bitAnd: 255 ] | ||
ifFalse: [ self bitAnd: 255 ] ]. | ||
^ self < 0 | ||
ifTrue: [ (-256 - self bitShift: -8) + 1 byteAt: n - 1 ] | ||
ifFalse: [ (self bitShift: 8 - (n bitShift: 3)) bitAnd: 255 ] |
25 changes: 25 additions & 0 deletions
25
repository/Grease-Squeak-Core.package/SmallInteger.extension/instance/greaseBytesCount.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
*Grease-Squeak-Core | ||
greaseBytesCount | ||
"Answer the number of indexable fields in the receiver. This value is the | ||
same as the largest legal subscript. Included so that a SmallInteger can | ||
behave like a LargePositiveInteger or LargeNegativeInteger." | ||
|
||
"32768 == (1 bitShift: 15)" | ||
"32768 bytesCount >>> 2" | ||
|
||
"65536 == (1 bitShift: 16)" | ||
"65536 bytesCount >>> 3" | ||
|
||
| value length | | ||
length := 1. | ||
value := self. | ||
value >= 0 | ||
ifTrue: | ||
[[value > 255] whileTrue: | ||
[value := value bitShift: -8. | ||
length := length + 1]] | ||
ifFalse: | ||
[[value < -255] whileTrue: | ||
[value := value bitShift: -8. | ||
length := length + 1]]. | ||
^length |
1 change: 1 addition & 0 deletions
1
repository/Grease-Squeak-Core.package/monticello.meta/categories.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
SystemOrganization addCategory: #'Grease-Squeak-Core'! | ||
SystemOrganization addCategory: #'Grease-Squeak-Core-Manifest'! |
Oops, something went wrong.