From e096b4fe49f4376c50612a67f6879e6332249323 Mon Sep 17 00:00:00 2001 From: Eiichiro Ito Date: Tue, 1 Dec 2020 09:23:28 +0900 Subject: [PATCH] update FromScratch package. --- .../addNumberExpressArg.selector.target..st | 8 +++++++ .../instance/isNumberString.st | 3 +++ .../Array.extension/properties.json | 3 +++ .../instance/coerceArgs..st | 3 +-- .../instance/isNumberString.st | 3 +++ .../instance/specialCommands.st | 3 +++ .../instance/doForever.st | 15 ++++++++++++ .../SpScratchApp.class/class/deploySystem.st | 24 +++++++++++++++++++ 8 files changed, 60 insertions(+), 2 deletions(-) create mode 100644 filetree/FromScratch.package/ArgMorphBuilder.class/instance/addNumberExpressArg.selector.target..st create mode 100644 filetree/FromScratch.package/Array.extension/instance/isNumberString.st create mode 100644 filetree/FromScratch.package/Array.extension/properties.json create mode 100644 filetree/FromScratch.package/Number.extension/instance/isNumberString.st create mode 100644 filetree/FromScratch.package/ScratchScript.class/instance/specialCommands.st create mode 100644 filetree/FromScratch.package/ScratchStackProcess.class/instance/doForever.st create mode 100644 filetree/FromScratch.package/SpScratchApp.class/class/deploySystem.st diff --git a/filetree/FromScratch.package/ArgMorphBuilder.class/instance/addNumberExpressArg.selector.target..st b/filetree/FromScratch.package/ArgMorphBuilder.class/instance/addNumberExpressArg.selector.target..st new file mode 100644 index 0000000..acb1ef2 --- /dev/null +++ b/filetree/FromScratch.package/ArgMorphBuilder.class/instance/addNumberExpressArg.selector.target..st @@ -0,0 +1,8 @@ +accessing +addNumberExpressArg: aCharacter selector: aSymbol target: anObject + self + add: aCharacter + builder: [ ExpressionArgMorphWithMenu new + numExpression: (anObject perform: aSymbol) first second asString; + getOptionsSelector: aSymbol; + getOptionsTarget: anObject ] \ No newline at end of file diff --git a/filetree/FromScratch.package/Array.extension/instance/isNumberString.st b/filetree/FromScratch.package/Array.extension/instance/isNumberString.st new file mode 100644 index 0000000..5c05c72 --- /dev/null +++ b/filetree/FromScratch.package/Array.extension/instance/isNumberString.st @@ -0,0 +1,3 @@ +*FromScratch +isNumberString + ^ false \ No newline at end of file diff --git a/filetree/FromScratch.package/Array.extension/properties.json b/filetree/FromScratch.package/Array.extension/properties.json new file mode 100644 index 0000000..e992470 --- /dev/null +++ b/filetree/FromScratch.package/Array.extension/properties.json @@ -0,0 +1,3 @@ +{ + "name" : "Array" +} \ No newline at end of file diff --git a/filetree/FromScratch.package/CommandBlockMorph.class/instance/coerceArgs..st b/filetree/FromScratch.package/CommandBlockMorph.class/instance/coerceArgs..st index 7d79096..2e62e25 100644 --- a/filetree/FromScratch.package/CommandBlockMorph.class/instance/coerceArgs..st +++ b/filetree/FromScratch.package/CommandBlockMorph.class/instance/coerceArgs..st @@ -4,8 +4,7 @@ coerceArgs: argList | args specialCommands | args := argList asArray. - specialCommands := #(#setVar:to:). - (specialCommands includes: selector) + (self script specialCommands includes: selector) ifFalse: [ "ensure args are numbers where numbers are expected" args := argList asArray with: self numberArgFlags diff --git a/filetree/FromScratch.package/Number.extension/instance/isNumberString.st b/filetree/FromScratch.package/Number.extension/instance/isNumberString.st new file mode 100644 index 0000000..5c05c72 --- /dev/null +++ b/filetree/FromScratch.package/Number.extension/instance/isNumberString.st @@ -0,0 +1,3 @@ +*FromScratch +isNumberString + ^ false \ No newline at end of file diff --git a/filetree/FromScratch.package/ScratchScript.class/instance/specialCommands.st b/filetree/FromScratch.package/ScratchScript.class/instance/specialCommands.st new file mode 100644 index 0000000..3cec39d --- /dev/null +++ b/filetree/FromScratch.package/ScratchScript.class/instance/specialCommands.st @@ -0,0 +1,3 @@ +block specs +specialCommands + ^ #(#setVar:to:) \ No newline at end of file diff --git a/filetree/FromScratch.package/ScratchStackProcess.class/instance/doForever.st b/filetree/FromScratch.package/ScratchStackProcess.class/instance/doForever.st new file mode 100644 index 0000000..d735be2 --- /dev/null +++ b/filetree/FromScratch.package/ScratchStackProcess.class/instance/doForever.st @@ -0,0 +1,15 @@ +special ops +doForever + "Executes one iteration of a forever loop." + + "Right now, the forever special form is at the top of the stack. We're going to add two more things on top of this: (1) a frame for evaluating the blocks in the forever block, and (2) a frame that just results in yielding control. That way we'll evaluate the contents of the block, give up control, and do it all again." + + | blocks | + "Remember blocks to evaluate before we clobber the stack." + blocks := stackFrame expression firstBlockList. + + "When we're all done with these blocks, we want to yield." + self pushStackFrame: (ScratchStackFrame new shouldYield: true). + + "First, we want to evaluate the blocks inside the loop." + self pushStackFrame: (ScratchStackFrame new expression: blocks) \ No newline at end of file diff --git a/filetree/FromScratch.package/SpScratchApp.class/class/deploySystem.st b/filetree/FromScratch.package/SpScratchApp.class/class/deploySystem.st new file mode 100644 index 0000000..666d82f --- /dev/null +++ b/filetree/FromScratch.package/SpScratchApp.class/class/deploySystem.st @@ -0,0 +1,24 @@ +accessing +deploySystem + "self deploySystem" + (self confirm: 'Deploying System?') + ifFalse: [ ^ self ]. + World closeAllWindowsDiscardingChanges. + FreeTypeFontProvider current updateFromSystem. + MCRepositoryGroup + allSubInstancesDo: [ :gr | gr repositories do: [ :r | gr removeRepository: r ] ]. + IceRepository registry removeAll. + IceCredentialStore current + in: + [ :store | store allCredentials do: [ :each | each removeFrom: store ] ]. + Smalltalk cleanUp: true except: {} confirming: false. + Deprecation + raiseWarning: false; + showWarning: false. + NoChangesLog install. + NoPharoFilesOpener install. + Stdio useNullStreams. + MCCacheRepository uniqueInstance disable. + EpMonitor reset. + 5 timesRepeat: [ Smalltalk garbageCollect ]. + Smalltalk snapshot: true andQuit: true \ No newline at end of file