Levente Uzonyi uploaded a new version of Network to project The Trunk:
http://source.squeak.org/trunk/Network-ul.187.mcz
==================== Summary ====================
Name: Network-ul.187
Author: ul
Time: 27 February 2017, 2:23:35.659844 am
UUID: 6bb5fee1-2a6c-45d5-98b2-5dae6e7f122c
Ancestors: Network-eem.186
- omit ifAbsent from #index* sends when the default value, 0 would used
=============== Diff against Network-eem.186 ===============
Item was changed:
----- Method: MailAddressTokenizer>>nextComment (in category 'tokenizing') -----
nextComment
| start nestLevel paren |
start := pos.
pos := pos + 1.
nestLevel := 1.
[ nestLevel > 0 ] whileTrue: [
+ pos := text indexOfAnyOf: self class parenthesesSet startingAt: pos.
- pos := text indexOfAnyOf: self class parenthesesSet startingAt: pos ifAbsent: [ 0 ].
pos = 0 ifTrue: [
self error: 'unterminated comment. ie, more (''s than )''s' ].
paren := self nextChar.
paren = $( ifTrue: [ nestLevel := nestLevel + 1 ] ifFalse: [ nestLevel := nestLevel - 1 ]].
^ MailAddressToken type: #Comment
text: (text copyFrom: start to: pos - 1)!
Item was changed:
----- Method: MailAddressTokenizer>>nextDomainLiteral (in category 'tokenizing') -----
nextDomainLiteral
| start end |
start := pos.
+ end := text indexOf: $] startingAt: start.
- end := text indexOf: $] startingAt: start ifAbsent: [ 0 ].
end = 0 ifTrue: [
"not specified"
self error: 'saw [ without a matching ]' ].
pos := end+1.
^MailAddressToken
type: #DomainLiteral
text: (text copyFrom: start to: end)!
Item was changed:
----- Method: SocketStream>>upTo:limit: (in category 'stream in') -----
upTo: aCharacterOrByte limit: nBytes
"Return data up to, but not including given character or byte. If the character is not in the stream, or not found within nBytes answer the available contents of the stream"
| target index result searchedSoFar |
"Deal with ascii vs. binary"
self isBinary
ifTrue:[target := aCharacterOrByte asInteger]
ifFalse:[target := aCharacterOrByte asCharacter].
"Look in the current inBuffer first"
+ index := inBuffer indexOf: target startingAt: lastRead + 1.
- index := inBuffer indexOf: target startingAt: lastRead + 1 ifAbsent:[0].
(index > 0 and: [(index + 1) <= inNextToWrite]) ifTrue: ["found it"
result := self nextInBuffer: index - lastRead - 1.
self skip: 1.
^ result
].
[searchedSoFar := self inBufferSize.
"Receive more data"
self receiveData.
"We only get recentlyRead = 0 in the case of a non-signaling socket close."
recentlyRead > 0] whileTrue:[
"Data begins at lastRead + 1, we add searchedSoFar as offset."
+ index := inBuffer indexOf: target startingAt: (lastRead + searchedSoFar + 1).
- index := inBuffer indexOf: target
- startingAt: (lastRead + searchedSoFar + 1)
- ifAbsent:[0].
(index > 0 and: [(index + 1) <= inNextToWrite]) ifTrue: ["found it"
result := self nextInBuffer: index - lastRead - 1.
self skip: 1.
^ result
].
"Check if we've exceeded the max. amount"
(nBytes notNil and:[inNextToWrite - lastRead > nBytes])
ifTrue:[^self nextAllInBuffer].
].
"not found and (non-signaling) connection was closed"
^self nextAllInBuffer!
Levente Uzonyi uploaded a new version of MorphicExtras to project The Trunk:
http://source.squeak.org/trunk/MorphicExtras-ul.202.mcz
==================== Summary ====================
Name: MorphicExtras-ul.202
Author: ul
Time: 27 February 2017, 2:20:59.716292 am
UUID: 5f9ce28c-9742-4cf9-9907-b516125debb8
Ancestors: MorphicExtras-cmm.201
- omit ifAbsent from #index* sends when the default value, 0 would used
=============== Diff against MorphicExtras-cmm.201 ===============
Item was changed:
----- Method: BookMorph>>pageNumberOf: (in category 'accessing') -----
pageNumberOf: aMorph
"Modified so that if the page IS in memory, other pages don't have to be brought in. (This method may wrongly say a page is not here if pages has a tombstone (MorphObjectOut) and that tombstone would resolve to an object already in this image. This is an unlikely case, and callers just have to tolerate it.)"
+ ^ pages identityIndexOf: aMorph
- ^ pages identityIndexOf: aMorph ifAbsent: [0]
!
Item was changed:
----- Method: CommandHistory>>historyIndexOfLastCommand (in category 'command history') -----
historyIndexOfLastCommand
"Answer which position of the CommandHistory list is occupied by the LastCommand"
+ ^ history indexOf: lastCommand!
- ^ history indexOf: lastCommand ifAbsent: [0]!
Levente Uzonyi uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-ul.1059.mcz
==================== Summary ====================
Name: Kernel-ul.1059
Author: ul
Time: 11 February 2017, 3:00:22.370854 am
UUID: b88b767b-b0d8-43ff-ba86-a19b11affe6d
Ancestors: Kernel-ul.1058
- check the type of the argument of #& and #| of booleans
=============== Diff against Kernel-ul.1058 ===============
Item was changed:
----- Method: False>>& (in category 'logical operations') -----
& aBoolean
+ "Evaluating conjunction -- answer false since receiver is false, but let the VM quickly check the type of the argument first."
- "Evaluating conjunction -- answer false since receiver is false."
+ aBoolean ifFalse: [ ^false ].
+ ^false!
- ^self!
Item was changed:
----- Method: False>>| (in category 'logical operations') -----
| aBoolean
+ "Evaluating disjunction (OR) -- could answer aBoolean since receiver is false, but let the VM quickly check the type of the argument instead."
- "Evaluating disjunction (OR) -- answer with the argument, aBoolean."
+ aBoolean ifTrue: [ ^true ].
+ ^false!
- ^aBoolean!
Item was changed:
----- Method: True>>& (in category 'logical operations') -----
& aBoolean
+ "Evaluating conjunction -- could answer aBoolean since receiver is true, but let the VM quickly check the type of the argument instead."
- "Evaluating conjunction -- answer aBoolean since receiver is true."
+ aBoolean ifFalse: [ ^false ].
+ ^true!
- ^aBoolean!
Item was changed:
----- Method: True>>| (in category 'logical operations') -----
| aBoolean
+ "Evaluating disjunction (OR) -- answer true since the receiver is true, but let the VM quickly check the type of the argument first."
- "Evaluating disjunction (OR) -- answer true since the receiver is true."
+ aBoolean ifTrue: [ ^true ].
+ ^true!
- ^self!
Levente Uzonyi uploaded a new version of Graphics to project The Trunk:
http://source.squeak.org/trunk/Graphics-ul.369.mcz
==================== Summary ====================
Name: Graphics-ul.369
Author: ul
Time: 27 February 2017, 2:11:11.506532 am
UUID: 87cd9b87-4712-42c0-8aac-0c1095700248
Ancestors: Graphics-bf.368
- omit ifAbsent from #index* sends when the default value, 0 would used
=============== Diff against Graphics-bf.368 ===============
Item was changed:
----- Method: ColorForm>>indexOfColor: (in category 'color manipulation') -----
indexOfColor: aColor
"Return the index of aColor in my color array"
self ensureColorArrayExists.
+ ^ colors indexOf: aColor!
- ^ colors indexOf: aColor ifAbsent: [0]!
Levente Uzonyi uploaded a new version of EToys to project The Trunk:
http://source.squeak.org/trunk/EToys-ul.279.mcz
==================== Summary ====================
Name: EToys-ul.279
Author: ul
Time: 27 February 2017, 2:06:51.332279 am
UUID: 848b5ae7-df41-4c28-b99a-c19ff6ca7cb5
Ancestors: EToys-dtl.278
- omit ifAbsent from #index* sends when the default value 0 would used
=============== Diff against EToys-dtl.278 ===============
Item was changed:
----- Method: BookMorph>>pageNumberReport (in category '*Etoys-Squeakland-page controls') -----
pageNumberReport
"Answer a string representing the page number."
+ ^ (pages indexOf: currentPage) printString, '/', pages size printString!
- ^ (pages indexOf: currentPage ifAbsent: [0]) printString, '/', pages size printString!
Item was changed:
----- Method: CategoryViewer>>nextCategory (in category 'categories') -----
nextCategory
"Change the receiver to point at the category following the one currently seen"
| aList anIndex newIndex already aChoice |
aList := (scriptedPlayer categoriesForViewer: self) collect:
[:aCatSymbol | self currentVocabulary categoryWordingAt: aCatSymbol].
already := self outerViewer ifNil: [#()] ifNotNil: [self outerViewer categoriesCurrentlyShowing].
+ anIndex := aList indexOf: self currentCategory.
- anIndex := aList indexOf: self currentCategory ifAbsent: [0].
newIndex := anIndex = aList size
ifTrue: [1]
ifFalse: [anIndex + 1].
[already includes: (aChoice := aList at: newIndex)] whileTrue:
[newIndex := (newIndex \\ aList size) + 1].
self chooseCategoryWhoseTranslatedWordingIs: aChoice!
Item was changed:
----- Method: Debugger>>preDebugNotifierContentsFrom: (in category '*Etoys-Squeakland-initialize') -----
preDebugNotifierContentsFrom: messageString
| first second msg |
^ Preferences eToyFriendly
ifFalse:
[messageString]
ifTrue:
[
msg := messageString.
msg ifNil: [msg := ''].
first := second := 0.
+ first := msg indexOf: $\.
+ first > 0 ifTrue: [second := msg indexOf: $\ startingAt: first + 1].
- first := msg indexOf: $\ ifAbsent: [0].
- first > 0 ifTrue: [second := msg indexOf: $\ startingAt: first + 1 ifAbsent: [0]].
(first > 0 and: [second > 0]) ifTrue: [
'An error has occurred in\{3} of {2}.\Fix your script(s), hit ''Abandon'' and try again.' translated withCRs format: {msg copyFrom: 1 to: first - 1. msg copyFrom: first + 1 to: second - 1. msg copyFrom: second + 1 to: msg size}
] ifFalse: [
'An error has occurred; you should probably just hit ''abandon''. Sorry!!' translated
]
] !
Item was changed:
----- Method: KedamaSetColorComponentTile>>line1: (in category 'initialization') -----
line1: line1
| chopped label label2 tail headIndex |
(line1 select: [:e | e = $:]) size >= 2 ifTrue: [^ self].
self removeAllMorphs.
+ headIndex := line1 indexOf: $: ifAbsent: [line1 indexOf: Character space].
- headIndex := line1 indexOf: $: ifAbsent: [line1 indexOf: Character space ifAbsent: [0]].
chopped := line1 copyFrom: 1 to: headIndex - 1.
tail := line1 copyFrom: chopped size + 2 to: line1 size.
label := StringMorph contents: (chopped) translated font: ScriptingSystem fontForTiles.
label2 := StringMorph contents: tail translated font: ScriptingSystem fontForTiles.
self addMorphBack: label.
self addMorphBack: patchTile.
self addMorphBack: label2.
!
Item was changed:
----- Method: KedamaSetPixelValueTile>>line1: (in category 'tile protocol') -----
line1: line1
| chopped label label2 tail headIndex |
(line1 select: [:e | e = $:]) size >= 2 ifTrue: [^ self].
self removeAllMorphs.
+ headIndex := line1 indexOf: $: ifAbsent: [line1 indexOf: Character space].
- headIndex := line1 indexOf: $: ifAbsent: [line1 indexOf: Character space ifAbsent: [0]].
chopped := line1 copyFrom: 1 to: headIndex - 1.
tail := line1 copyFrom: chopped size + 2 to: line1 size.
label := StringMorph contents: (chopped) font: ScriptingSystem fontForTiles.
label2 := StringMorph contents: tail font: ScriptingSystem fontForTiles.
self addMorphBack: label.
self addMorphBack: patchTile.
self addMorphBack: label2.
!
Item was changed:
----- Method: Morph>>reassessBackgroundShape (in category '*Etoys-card in a stack') -----
reassessBackgroundShape
"A change has been made which may affect the instance structure of the Card uniclass that holds the instance state, which can also be thought of as the 'card data'."
"Caution: still to be done: the mechanism so that when a new instance variable is added, it gets initialized in all subinstances of the receiver's player, which are the cards of this shape. One needs to take into account here the instance variable names coming in; those that are unchanged should keep their values, but those that have newly arrived should obtain their default values from the morphs on whose behalf they are being maintained in the model"
| requestedName |
self isStackBackground ifFalse: [^Beeper beep]. "bulletproof against deconstruction"
Cursor wait showWhile:
[ | variableDocks takenNames sepDataMorphs sorted existing |variableDocks := OrderedCollection new. "This will be stored in the uniclass's
class-side inst var #variableDocks"
takenNames := OrderedCollection new.
sepDataMorphs := OrderedCollection new. "fields, holders of per-card data"
self submorphs do:
[:aMorph |
aMorph renderedMorph holdsSeparateDataForEachInstance
ifTrue: [sepDataMorphs add: aMorph renderedMorph]
ifFalse:
["look for buried fields, inside a frame"
aMorph renderedMorph isShared
ifTrue:
[aMorph allMorphs do:
[:mm |
mm renderedMorph holdsSeparateDataForEachInstance
ifTrue: [sepDataMorphs add: mm renderedMorph]]]]].
sorted := SortedCollection new
sortBlock: [:a :b | (a valueOfProperty: #cardInstance) notNil]. "puts existing ones first"
sorted addAll: sepDataMorphs.
sorted do:
[:aMorph | | docks |
docks := aMorph variableDocks.
"Each morph can request multiple variables.
This complicates matters somewhat but creates a generality for Fabrk-like uses.
Each spec is an instance of VariableDock, and it provides a point of departure
for the negotiation between the PasteUp and its constitutent morphs"
docks do:
[:aVariableDock | | uniqueName |
uniqueName := self player
uniqueInstanceVariableNameLike: (requestedName := aVariableDock
variableName)
excluding: takenNames.
uniqueName ~= requestedName
ifTrue:
[aVariableDock variableName: uniqueName.
aMorph noteNegotiatedName: uniqueName for: requestedName].
takenNames add: uniqueName].
variableDocks addAll: docks].
existing := self player class instVarNames.
variableDocks := (variableDocks asSortedCollection:
[:dock1 :dock2 | | name2 name1 |
name1 := dock1 variableName.
name2 := dock2 variableName.
+ (existing indexOf: name1)
- (existing indexOf: name1 ifAbsent: [0])
< (existing indexOf: name2 ifAbsent: [variableDocks size])])
asOrderedCollection.
self player class setNewInstVarNames: (variableDocks
collect: [:info | info variableName asString]).
"NB: sets up accessors, and removes obsolete ones"
self player class newVariableDocks: variableDocks]!
Item was changed:
----- Method: QuickGuideMorph>>jPegOutDir: (in category 'write web pages') -----
jPegOutDir: fileDir
"Write the current page of the current Guide as an image file on the directory"
"Does it need to be showing?"
| fName gn num qgh bk |
qgh := self submorphOfClass: QuickGuideHolderMorph.
bk := qgh submorphOfClass: BookMorph.
+ num := (bk pages indexOf: bk currentPage) printString.
- num := (bk pages indexOf: bk currentPage ifAbsent: [0]) printString.
gn := qgh guideName.
fName := fileDir pathName, fileDir pathNameDelimiter asString, gn, '-', num, '.jpg'.
currentPage imageForm writeJPEGfileNamed: fName.
"need to go deeper??"
^ ''!
Item was changed:
----- Method: StackMorph>>cardNumberOf: (in category 'accessing') -----
cardNumberOf: aPlayer
"Answer the card-number of the given player, in the which-card-of-the-stack sense."
+ ^ self cards identityIndexOf: aPlayer!
- ^ self cards identityIndexOf: aPlayer ifAbsent: [0]!