-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
book: add compatibility patches for squeak60
- Loading branch information
Showing
24 changed files
with
185 additions
and
3 deletions.
There are no files selected for viewing
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
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
12 changes: 12 additions & 0 deletions
12
...talkSources/BaselineOfSBE.package/BaselineOfSBE.class/instance/customProjectAttributes.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,12 @@ | ||
accessing | ||
customProjectAttributes | ||
|
||
| attributes | | ||
attributes := super customProjectAttributes. | ||
(Smalltalk classNamed: #SystemVersion) ifNotNil: [:versionClass | | ||
versionClass current isRelease ifTrue: | ||
[attributes := attributes , | ||
(MetacelloPlatform current defaultPlatformAttributes | ||
select: [:ea | ea matchesRegex: 'squeak\d.*'] | ||
thenCollect: [:ea | ea , '.release'])]]. | ||
^ attributes |
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
4 changes: 4 additions & 0 deletions
4
SmalltalkSources/SBE-BookCompatibility-Squeak60.package/.filetree
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 @@ | ||
{ | ||
"noMethodMetaData" : true, | ||
"separateMethodMetaAndSource" : false, | ||
"useCypressPropertiesFile" : true } |
6 changes: 6 additions & 0 deletions
6
SmalltalkSources/SBE-BookCompatibility-Squeak60.package/.squot-contents
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,6 @@ | ||
SquotTrackedObjectMetadata { | ||
#objectClassName : #PackageInfo, | ||
#id : UUID [ '16fa07be5b1e4df7a4ea725e677c5eda' ], | ||
#objectsReplacedByNames : true, | ||
#serializer : #SquotCypressCodeSerializer | ||
} |
38 changes: 38 additions & 0 deletions
38
.../SBE-BookCompatibility-Squeak60.package/SBEHtmlReadWriter.extension/instance/getImage..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,38 @@ | ||
*SBE-BookCompatibility-Squeak60-private | ||
getImage: uri | ||
|
||
(uri beginsWith: 'cid:' caseSensitive: false) ifTrue: [ | ||
"Content-ID, used in nested MIMEDocuments, e.g., for emails with inline images" | ||
(Smalltalk classNamed: #MIMEContentRequest) ifNotNil: [:class | | ||
| cid | | ||
cid := uri allButFirst: 4. | ||
(class signal: cid) ifNotNil: [:document | | ||
^ [document image] ifError: [nil]]]. | ||
^ nil]. | ||
|
||
(uri beginsWith: 'code://' caseSensitive: false) ifTrue: [ | ||
| expression | | ||
"Same support for Smalltalk expressions as in TextURL >> #actOnClickFor:." | ||
self shallEvaluateResources ifFalse: [^ nil]. | ||
expression := uri allButFirst: 7. | ||
^ ([Compiler evaluate: expression] ifError: [nil]) | ||
ifNotNil: [:object | object isForm ifTrue: [object] ifFalse: [nil]]]. | ||
|
||
(uri beginsWith: 'data:' caseSensitive: false) ifTrue: [ | data mediaType separator | | ||
separator := uri indexOf: $, ifAbsent: [^ nil]. | ||
mediaType := uri copyFrom: 6 to: separator - 1. | ||
data := uri allButFirst: separator. | ||
data := (mediaType endsWith: ';base64' caseSensitive: false) | ||
ifTrue: [ | ||
mediaType := mediaType allButLast: 7. | ||
[Base64MimeConverter mimeDecodeToBytes: data readStream] ifError: [nil]] | ||
ifFalse: [data asByteArray readStream]. | ||
^ [ImageReadWriter formFromStream: data] ifError: [nil]]. | ||
|
||
self shallDownloadResources ifFalse: [^ nil]. | ||
^ (Smalltalk classNamed: #WebClient) ifNotNil: [:client | | ||
"Maybe we can have this via an AppRegistry at some point. Maybe extend WebBrowser." | ||
([client httpGet: uri] ifError: [nil]) ifNotNil: [:response | | ||
response code = 200 ifFalse: [nil] ifTrue: [ | ||
[Form fromBinaryStream: response content asByteArray readStream] | ||
ifError: [nil]]]] |
7 changes: 7 additions & 0 deletions
7
...E-BookCompatibility-Squeak60.package/SBEHtmlReadWriter.extension/instance/hasTag.name..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 @@ | ||
*SBE-BookCompatibility-Squeak60-private | ||
hasTag: aTag name: tagNameLt | ||
|
||
| after | | ||
(aTag beginsWith: tagNameLt caseSensitive: false) ifFalse: [^ false]. | ||
after := aTag at: tagNameLt size + 1 ifAbsent: [^ true]. | ||
^ after = $> or: [after isSeparator] |
9 changes: 9 additions & 0 deletions
9
...BE-BookCompatibility-Squeak60.package/SBEHtmlReadWriter.extension/instance/htmlEscape..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,9 @@ | ||
*SBE-BookCompatibility-Squeak60-private | ||
htmlEscape: aString | ||
|
||
| escapeSequence | | ||
escapeSequence := aString copyFrom: 2 to: aString size - 1. | ||
escapeSequence first = $# ifTrue: [^ self htmlEscapeNumber: escapeSequence allButFirst]. | ||
(String htmlEntities at: (aString copyFrom: 2 to: aString size - 1) ifAbsent: []) | ||
ifNotNil: [:char | ^ char]. | ||
^ nil |
9 changes: 9 additions & 0 deletions
9
...kCompatibility-Squeak60.package/SBEHtmlReadWriter.extension/instance/htmlEscapeNumber..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,9 @@ | ||
*SBE-BookCompatibility-Squeak60-private | ||
htmlEscapeNumber: aString | ||
|
||
| number | | ||
number := aString first = $x | ||
ifTrue: ['16r', aString allButFirst] | ||
ifFalse: [aString]. | ||
^ number asNumber asCharacter | ||
|
11 changes: 11 additions & 0 deletions
11
...E-BookCompatibility-Squeak60.package/SBEHtmlReadWriter.extension/instance/htmlEscapes..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,11 @@ | ||
*SBE-BookCompatibility-Squeak60-private | ||
htmlEscapes: aString | ||
|
||
| lastIndex nextIndex | | ||
nextIndex := aString indexOf: $& startingAt: (lastIndex := 1) ifAbsent: [^ aString]. | ||
^ String new: aString size * 11 // 10 "+10%" streamContents: [:tmpStream | | ||
[tmpStream next: nextIndex - lastIndex putAll: aString startingAt: lastIndex. | ||
nextIndex := aString indexOf: $; startingAt: (lastIndex := nextIndex) ifAbsent: [^ aString]. | ||
tmpStream nextPut: (self htmlEscape: (aString copyFrom: lastIndex to: nextIndex))] | ||
doWhileTrue: [(nextIndex := aString indexOf: $& startingAt: (lastIndex := nextIndex + 1)) > 0]. | ||
tmpStream next: aString size - lastIndex + 1 putAll: aString startingAt: lastIndex] |
20 changes: 20 additions & 0 deletions
20
...tibility-Squeak60.package/SBEHtmlReadWriter.extension/instance/searchTag.forAttribute..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,20 @@ | ||
*SBE-BookCompatibility-Squeak60-private | ||
searchTag: aTag forAttribute: attributeName | ||
|
||
| startIndex stopIndex | | ||
startIndex := aTag findString: attributeName startingAt: 1 caseSensitive: false. | ||
startIndex = 0 ifTrue: [^ nil]. | ||
|
||
startIndex := startIndex + attributeName size - 1. | ||
[(aTag at: (startIndex := startIndex + 1)) isSeparator] whileTrue. | ||
(aTag at: startIndex) = $= ifFalse: [^ nil]. | ||
|
||
[(aTag at: (startIndex := startIndex + 1)) isSeparator] whileTrue. | ||
(aTag at: startIndex) = $" | ||
ifTrue: [ | ||
startIndex := startIndex + 1. | ||
stopIndex := aTag indexOf: $" startingAt: startIndex + 1] | ||
ifFalse: [ | ||
stopIndex := aTag indexOfAnyOf: ' >' startingAt: startIndex + 1]. | ||
stopIndex = 0 ifTrue: [^ nil]. | ||
^ self htmlEscapes: (aTag copyFrom: startIndex to: stopIndex - 1) |
10 changes: 10 additions & 0 deletions
10
.../SBE-BookCompatibility-Squeak60.package/SBEHtmlReadWriter.extension/methodProperties.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,10 @@ | ||
{ | ||
"class" : { | ||
}, | ||
"instance" : { | ||
"getImage:" : "ct 5/20/2023 18:10", | ||
"hasTag:name:" : "ct 5/20/2023 14:20", | ||
"htmlEscape:" : "ct 5/20/2023 17:34", | ||
"htmlEscapeNumber:" : "ct 5/20/2023 17:35", | ||
"htmlEscapes:" : "mt 5/22/2023 11:01", | ||
"searchTag:forAttribute:" : "ct 5/19/2023 23:36" } } |
2 changes: 2 additions & 0 deletions
2
...ources/SBE-BookCompatibility-Squeak60.package/SBEHtmlReadWriter.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" : "SBEHtmlReadWriter" } |
12 changes: 12 additions & 0 deletions
12
...kCompatibility-Squeak60.package/String.extension/instance/sbeBeginsWith.caseSensitive..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,12 @@ | ||
*SBE-BookCompatibility-Squeak60 | ||
sbeBeginsWith: sequence caseSensitive: caseSensitive | ||
"Answer if the receiver starts with the argument collection." | ||
|
||
| index sequenceSize | | ||
caseSensitive ifTrue: [^ self beginsWith: sequence]. | ||
sequenceSize := sequence size. | ||
self size < sequenceSize ifTrue: [ ^false ]. | ||
index := 0. | ||
[ (index := index + 1) <= sequenceSize ] whileTrue: [ | ||
((sequence at: index) sameAs: (self at: index)) ifFalse: [ ^false ] ]. | ||
^true |
13 changes: 13 additions & 0 deletions
13
...ookCompatibility-Squeak60.package/String.extension/instance/sbeEndsWith.caseSensitive..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,13 @@ | ||
*SBE-BookCompatibility-Squeak60 | ||
sbeEndsWith: sequence caseSensitive: caseSensitive | ||
"Answer if the receiver ends with the argument collection." | ||
|
||
| index sequenceSize offset | | ||
caseSensitive ifTrue: [^ self endsWith: sequence]. | ||
sequence isString ifFalse: [ ^super endsWith: sequence ]. | ||
sequenceSize := sequence size. | ||
(offset := self size - sequenceSize) < 0 ifTrue: [ ^false ]. | ||
index := 0. | ||
[ (index := index + 1) <= sequenceSize ] whileTrue: [ | ||
((sequence at: index) sameAs: (self at: index + offset)) ifFalse: [ ^false ] ]. | ||
^true |
6 changes: 6 additions & 0 deletions
6
...talkSources/SBE-BookCompatibility-Squeak60.package/String.extension/methodProperties.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,6 @@ | ||
{ | ||
"class" : { | ||
}, | ||
"instance" : { | ||
"sbeBeginsWith:caseSensitive:" : "ct 11/21/2023 21:11", | ||
"sbeEndsWith:caseSensitive:" : "ct 11/21/2023 21:11" } } |
2 changes: 2 additions & 0 deletions
2
SmalltalkSources/SBE-BookCompatibility-Squeak60.package/String.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" : "String" } |
4 changes: 4 additions & 0 deletions
4
...talkSources/SBE-BookCompatibility-Squeak60.package/Text.extension/instance/findString..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 @@ | ||
*SBE-BookCompatibility-Squeak60-accessing-pseudo-override | ||
findString: subString | ||
|
||
^ self asString findString: subString |
5 changes: 5 additions & 0 deletions
5
SmalltalkSources/SBE-BookCompatibility-Squeak60.package/Text.extension/methodProperties.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,5 @@ | ||
{ | ||
"class" : { | ||
}, | ||
"instance" : { | ||
"findString:" : "ct 11/21/2023 21:11" } } |
2 changes: 2 additions & 0 deletions
2
SmalltalkSources/SBE-BookCompatibility-Squeak60.package/Text.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" : "Text" } |
1 change: 1 addition & 0 deletions
1
SmalltalkSources/SBE-BookCompatibility-Squeak60.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 |
---|---|---|
@@ -0,0 +1 @@ | ||
SystemOrganization addCategory: #'SBE-BookCompatibility-Squeak60'! |
Empty file.
2 changes: 2 additions & 0 deletions
2
SmalltalkSources/SBE-BookCompatibility-Squeak60.package/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 @@ | ||
{ | ||
} |