Class Block Object context argCount argLoc bytePointer Methods Block forkWith: args (self newProcessWith: args) resume ] Methods Block fork self newProcess resume ] Methods Block value: x value: y ^ (self checkArgumentCount: 2) ifTrue: [ context at: argLoc put: x. context at: argLoc + 1 put: y. context returnToBlock: bytePointer ] ] Methods Block whileTrue self whileTrue: [] ] Methods Block checkArgumentCount: count ^ (argCount = count) ifTrue: [ true ] ifFalse: [ smalltalk error: 'wrong number of arguments passed to block'. false ] ] Methods Block value: x ^ (self checkArgumentCount: 1) ifTrue: [ context at: argLoc put: x. context returnToBlock: bytePointer ] ] Methods Block value: x value: y value: z ^ (self checkArgumentCount: 3) ifTrue: [ context at: argLoc put: x. context at: argLoc + 1 put: y. context at: argLoc + 2 put: z. context returnToBlock: bytePointer ] ] Methods Block whileFalse: aBlock [ self value not ] whileTrue: aBlock ] Methods Block blockContext: ctx context <- ctx ] Methods Block newProcess " create a new process to execute block " ^ Process new; context: context ; startAt: bytePointer. ] Methods Block whileTrue: aBlock ( self value ) ifTrue: [ aBlock value. self whileTrue: aBlock ] ] Methods Block newProcessWith: args (self checkArgumentCount: args size) ifTrue: [ (1 to: args size) do: [:i | context at: (argLoc + i - 1) put: (args at: i)]]. ^ self newProcess ] Methods Block value ^ (self checkArgumentCount: 0) ifTrue: [ context returnToBlock: bytePointer ] ]