Skip to content

Commit

Permalink
Add implementation of #greaseAsByteArray for Squeak 6
Browse files Browse the repository at this point in the history
  • Loading branch information
theseion committed Oct 29, 2023
1 parent c7c9826 commit b13fba9
Show file tree
Hide file tree
Showing 40 changed files with 199 additions and 130 deletions.
5 changes: 3 additions & 2 deletions repository/Grease-Squeak6-Core.package/.filetree
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"noMethodMetaData" : true,
"separateMethodMetaAndSource" : false,
"useCypressPropertiesFile" : true }
"noMethodMetaData" : true,
"useCypressPropertiesFile" : true
}
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
{
"name" : "Behavior" }
"name" : "Behavior"
}
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
{
"name" : "BlockClosure" }
"name" : "BlockClosure"
}
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
{
"name" : "ByteArray" }
"name" : "ByteArray"
}
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
{
"name" : "Character" }
"name" : "Character"
}
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
{
"name" : "Collection" }
"name" : "Collection"
}
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
{
"name" : "Duration" }
"name" : "Duration"
}
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
{
"name" : "GRDelegatingStream" }
"name" : "GRDelegatingStream"
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
{
"category" : "Grease-Squeak6-Core",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "",
"instvars" : [
],
"name" : "GRDynamicVariable",
"pools" : [
],
"super" : "DynamicVariable",
"type" : "normal" }
"category" : "Grease-Squeak6-Core",
"classinstvars" : [ ],
"pools" : [ ],
"classvars" : [ ],
"instvars" : [ ],
"name" : "GRDynamicVariable",
"type" : "normal"
}
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
{
"name" : "GRPackage" }
"name" : "GRPackage"
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
{
"category" : "Grease-Squeak6-Core",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "pmm 9/14/2013 15:53",
"super" : "GRCodecStream",
"category" : "Grease-Squeak6-Core",
"classinstvars" : [ ],
"pools" : [ ],
"classvars" : [ ],
"instvars" : [
"converter" ],
"converter"
],
"name" : "GRPharoConverterCodecStream",
"pools" : [
],
"super" : "GRCodecStream",
"type" : "normal" }
"type" : "normal"
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
{
"category" : "Grease-Squeak6-Core",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "",
"super" : "GRCodec",
"category" : "Grease-Squeak6-Core",
"classinstvars" : [ ],
"pools" : [ ],
"classvars" : [ ],
"instvars" : [
"name",
"urlCodec" ],
"urlCodec"
],
"name" : "GRPharoGenericCodec",
"pools" : [
],
"super" : "GRCodec",
"type" : "normal" }
"type" : "normal"
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
{
"category" : "Grease-Squeak6-Core",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "<historical>",
"super" : "GRNullCodec",
"category" : "Grease-Squeak6-Core",
"classinstvars" : [ ],
"pools" : [ ],
"classvars" : [ ],
"instvars" : [
"name" ],
"name"
],
"name" : "GRPharoLatin1Codec",
"pools" : [
],
"super" : "GRNullCodec",
"type" : "normal" }
"type" : "normal"
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
{
"category" : "Grease-Squeak6-Core",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "<historical>",
"instvars" : [
],
"name" : "GRPharoLatin1CodecStream",
"pools" : [
],
"super" : "GRNullCodecStream",
"type" : "normal" }
"category" : "Grease-Squeak6-Core",
"classinstvars" : [ ],
"pools" : [ ],
"classvars" : [ ],
"instvars" : [ ],
"name" : "GRPharoLatin1CodecStream",
"type" : "normal"
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
{
"commentStamp" : "pmm 2/1/2014 13:28",
"super" : "GRPlatform",
"category" : "Grease-Squeak6-Core",
"classinstvars" : [
],
"classinstvars" : [ ],
"pools" : [ ],
"classvars" : [
"UrlTable",
"XmlTable" ],
"commentStamp" : "pmm 2/1/2014 13:28",
"instvars" : [
],
"XmlTable"
],
"instvars" : [ ],
"name" : "GRPharoPlatform",
"pools" : [
],
"super" : "GRPlatform",
"type" : "normal" }
"type" : "normal"
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
{
"category" : "Grease-Squeak6-Core",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "pmm 2/20/2009 12:51",
"instvars" : [
],
"name" : "GRPharoUtf8Codec",
"pools" : [
],
"super" : "GRCodec",
"type" : "normal" }
"category" : "Grease-Squeak6-Core",
"classinstvars" : [ ],
"pools" : [ ],
"classvars" : [ ],
"instvars" : [ ],
"name" : "GRPharoUtf8Codec",
"type" : "normal"
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
{
"commentStamp" : "pmm 2/20/2009 12:27",
"super" : "GRPharoConverterCodecStream",
"category" : "Grease-Squeak6-Core",
"classinstvars" : [
],
"classinstvars" : [ ],
"pools" : [ ],
"classvars" : [
"Latin1ToUtf8Encodings",
"Latin1ToUtf8Map" ],
"commentStamp" : "pmm 2/20/2009 12:27",
"instvars" : [
],
"Latin1ToUtf8Map"
],
"instvars" : [ ],
"name" : "GRPharoUtf8CodecStream",
"pools" : [
],
"super" : "GRPharoConverterCodecStream",
"type" : "normal" }
"type" : "normal"
}
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
{
"name" : "GRSmallDictionary" }
"name" : "GRSmallDictionary"
}
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
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
{
"category" : "Grease-Squeak6-Core",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "",
"instvars" : [
],
"name" : "GRSqueakPlatform",
"pools" : [
],
"super" : "GRPharoPlatform",
"type" : "normal" }
"category" : "Grease-Squeak6-Core",
"classinstvars" : [ ],
"pools" : [ ],
"classvars" : [ ],
"instvars" : [ ],
"name" : "GRSqueakPlatform",
"type" : "normal"
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
{
"category" : "Grease-Squeak6-Core",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "pmm 8/25/2011 18:30",
"instvars" : [
],
"name" : "GRWorkingWriteStream",
"pools" : [
],
"super" : "WriteStream",
"type" : "normal" }
"category" : "Grease-Squeak6-Core",
"classinstvars" : [ ],
"pools" : [ ],
"classvars" : [ ],
"instvars" : [ ],
"name" : "GRWorkingWriteStream",
"type" : "normal"
}
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
{
"name" : "Interval" }
"name" : "Interval"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
*Grease-Squeak6-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]
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
*Grease-Squeak6-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
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"name" : "LargeInteger"
}
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
{
"name" : "MessageSend" }
"name" : "MessageSend"
}
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
{
"name" : "Number" }
"name" : "Number"
}
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
{
"name" : "Object" }
"name" : "Object"
}
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
{
"name" : "PositionableStream" }
"name" : "PositionableStream"
}
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
{
"name" : "Random" }
"name" : "Random"
}
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
{
"name" : "ScaledDecimal" }
"name" : "ScaledDecimal"
}
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
{
"name" : "SequenceableCollection" }
"name" : "SequenceableCollection"
}
Loading

0 comments on commit b13fba9

Please sign in to comment.