self ignoreFileInUpTo: #fileInFromHere ! file workspace -------------- fileIn("s8/start/notes.txt"); fileIn("s8/start/Kernel.st");quit() emmit("s8/start/tools.st"); emmit("s8/start/Kernel.st");quit() emmit("s8/start/Compiler.st");quit() ["s8/start/Kernel.st","s8/start/Compiler.st","s8/start/Tools.st","s8/start/Builders.st","s8/start/Transcript.st","s8/start/Snapshot.st","s8/start/Natives.st"].emmit();quit() print("// fileIn('s8/start/Kernel.st')");fileIn("s8/start/Kernel.st") print("// fileIn('s8/start/Compiler.st')");fileIn("s8/start/Compiler.st") ["s8/start/Kernel.st","s8/start/Compiler.st","s8/start/Tools.st","s8/start/Builders.st","s8/start/Transcript.st","s8/start/Snapshot.st","s8/start/Natives.st"].emmit().size(); quit() " [(# #read: 's8/start/Natives.st') stream fileIn] ms".doIt(); --------------------------------------------------------------------------------- ! Object methodsFor: #hacking ! hack: aSelector doing: aBlock " Hack the receiver installing aBlock as implementor for message selector. Note: aBlock must match the numberOfArguments of aSelector. Example: (PoolDictionary new at: #hello put: #world; hack: #objectNotFoundAt: doing: [:key| key * 2 ]; yourself) at: 45 " | msg | msg := aSelector asSelector. aBlock isNil ifTrue: [ ^self basicDelete: msg ]. self nativeLanguage = #js ifTrue: [ aSelector argumentCount = aBlock argumentCount ifFalse: [ ^self error: 'Invalid number of arguments' ]. ^self basicAt: msg put: aBlock ]. self nativeLanguage = #lua ifTrue: [ | count blk | count := aSelector argumentCount. count = 0 ifTrue: [ blk := [:rcv| aBlock evaluate ] ] ifFalse: [ count = 1 ifTrue: [ blk := [:rcv :x| aBlock evaluateWith: x ]] ifFalse: [ count = 2 ifTrue: [ blk := [:rcv :x :y| aBlock value: x value: y]] ifFalse: [ count = 3 ifTrue: [ blk := [:rcv :x :y :z| aBlock value: x value: y value: z]] ifFalse: [ count = 4 ifTrue: [ blk := [:rcv :x :y :z :i| aBlock value: x value: y value: z value: i]] ifFalse: [ self error: 'Invalid number of arguments' ]]]]]. ^self basicAt: msg put: blk ]. ^self notImplementedYet: #hack:doing:! ! --------------------------------------------------------------------------------- #fileInFromHere ! " Print the list of implemented selectors with multiple comments. We use this method to ensure messages has unique comments. " | pool s | pool := PoolDictionary new. Smalltalk allMethodsDo: [:mth| | array comment | (#( toString ) includes: mth selector) ifFalse: [ array := pool at: mth selector ifAbsentPut: [#()]. comment := mth comment stream nextLine. (array includes: comment) ifFalse: [ array add: comment ]. ] ]. pool keys do: [:msg| (pool at: msg) size > 1 ifFalse: [ pool removeKey: msg ]]. s := ''. pool keys sorted do: [:msg| s := s ,' ' ,msg. (pool at: msg) do: [:each| s := s,' ' ,each ] ]. s outputToFile: 's8/start/multiple message comments.txt' !