Joshua Gargus uploaded a new version of Tools to project The Trunk:
http://source.squeak.org/trunk/Tools-jcg.247.mcz
==================== Summary ====================
Name: Tools-jcg.247
Author: jcg
Time: 23 June 2010, 12:13:50.59 pm
UUID: a06587b9-7aaf-412f-a9a1-c49d97fb8110
Ancestors: Tools-cmm.246
Workspaces can now look up variable-bindings in a user-specified list of SharedPools. See the class-side methods #addLookupPool:, #removeLookupPool:, and #clearLookupPools.
=============== Diff against Tools-cmm.246 ===============
Item was added:
+ ----- Method: Workspace class>>removeLookupPool: (in category 'lookup pools') -----
+ removeLookupPool: sharedPool
+ "Workspaces should no longer look up bindings in the specified SharedPool."
+ LookupPools ifNil: [^self].
+ LookupPools remove: sharedPool ifAbsent: [].!
Item was added:
+ ----- Method: Workspace>>lookupInPools: (in category 'binding') -----
+ lookupInPools: aString
+ "Iterate through all of the lookup pools to find a match for the specified name."
+ LookupPools ifNil: [^nil].
+ LookupPools do: [:pool | (pool bindingOf: aString) ifNotNil: [:assoc | ^assoc value]].
+ ^nil
+ !
Item was added:
+ ----- Method: Workspace class>>clearLookupPools (in category 'lookup pools') -----
+ clearLookupPools
+ LookupPools := nil.
+ !
Item was changed:
----- Method: Workspace>>bindingOf: (in category 'binding') -----
bindingOf: aString
-
mustDeclareVariables ifTrue: [^ nil].
"I want to have workspace that force the user to declare
variables. Still subclasses may want to do something else"
+ bindings ifNil: [self initializeBindings].
+ (bindings includesKey: aString) ifFalse: [
+ | val |
+ val := self lookupInPools: aString.
+ val
+ ifNotNil: [
+ "Caveat: since we're not inserting the pool's Association into
+ the dictionary, assigning a new value to the variable will only
+ affect the one Workspace (i.e. you can't assign to a variable in a
+ SharedPool)."
+ bindings at: aString put: val]
+ ifNil: [aString first isUppercase
+ ifTrue: [^nil]
+ ifFalse: [bindings at: aString put: nil]]
+ ].
- bindings isNil
- ifTrue: [self initializeBindings].
- (bindings includesKey: aString)
- ifFalse: [bindings at: aString put: nil].
^ bindings associationAt: aString!
Item was added:
+ ----- Method: Workspace class>>addLookupPool: (in category 'lookup pools') -----
+ addLookupPool: sharedPool
+ "Add a SharedPool that bindings should be looked up in."
+ LookupPools ifNil: [LookupPools := IdentitySet new].
+ LookupPools add: sharedPool!
Item was changed:
StringHolder subclass: #Workspace
instanceVariableNames: 'bindings acceptDroppedMorphs acceptAction mustDeclareVariables shouldStyle'
+ classVariableNames: 'LookupPools ShouldStyle'
- classVariableNames: 'ShouldStyle'
poolDictionaries: ''
category: 'Tools-Base'!
!Workspace commentStamp: 'ls 10/14/2003 12:13' prior: 0!
A Workspace is a text area plus a lot of support for executable code. It is a great place to execute top-level commands to compute something useful, and it is a great place to develop bits of a program before those bits get put into class methods.
To open a new workspace, execute:
Workspace open
A workspace can have its own variables, called "workspace variables", to hold intermediate results. For example, if you type into a workspace "x := 5" and do-it, then later you could type in "y := x * 2" and y would become 10.
Additionally, in Morphic, a workspace can gain access to morphs that are on the screen. If acceptDroppedMorphss is turned on, then whenever a morph is dropped on the workspace, a variable will be created which references that morph. This functionality is toggled with the window-wide menu of a workspace.
The instance variables of this class are:
bindings - holds the workspace variables for this workspace
acceptDroppedMorphss - whether dropped morphs should create new variables!
Joshua Gargus uploaded a new version of Tools to project The Trunk:
http://source.squeak.org/trunk/Tools-jcg.247.mcz
==================== Summary ====================
Name: Tools-jcg.247
Author: jcg
Time: 23 June 2010, 12:13:50.59 pm
UUID: a06587b9-7aaf-412f-a9a1-c49d97fb8110
Ancestors: Tools-cmm.246
Workspaces can now look up variable-bindings in a user-specified list of SharedPools. See the class-side methods #addLookupPool:, #removeLookupPool:, and #clearLookupPools.
=============== Diff against Tools-cmm.246 ===============
Item was added:
+ ----- Method: Workspace class>>removeLookupPool: (in category 'lookup pools') -----
+ removeLookupPool: sharedPool
+ "Workspaces should no longer look up bindings in the specified SharedPool."
+ LookupPools ifNil: [^self].
+ LookupPools remove: sharedPool ifAbsent: [].!
Item was added:
+ ----- Method: Workspace>>lookupInPools: (in category 'binding') -----
+ lookupInPools: aString
+ "Iterate through all of the lookup pools to find a match for the specified name."
+ LookupPools ifNil: [^nil].
+ LookupPools do: [:pool | (pool bindingOf: aString) ifNotNil: [:assoc | ^assoc value]].
+ ^nil
+ !
Item was added:
+ ----- Method: Workspace class>>clearLookupPools (in category 'lookup pools') -----
+ clearLookupPools
+ LookupPools := nil.
+ !
Item was changed:
----- Method: Workspace>>bindingOf: (in category 'binding') -----
bindingOf: aString
-
mustDeclareVariables ifTrue: [^ nil].
"I want to have workspace that force the user to declare
variables. Still subclasses may want to do something else"
+ bindings ifNil: [self initializeBindings].
+ (bindings includesKey: aString) ifFalse: [
+ | val |
+ val := self lookupInPools: aString.
+ val
+ ifNotNil: [
+ "Caveat: since we're not inserting the pool's Association into
+ the dictionary, assigning a new value to the variable will only
+ affect the one Workspace (i.e. you can't assign to a variable in a
+ SharedPool)."
+ bindings at: aString put: val]
+ ifNil: [aString first isUppercase
+ ifTrue: [^nil]
+ ifFalse: [bindings at: aString put: nil]]
+ ].
- bindings isNil
- ifTrue: [self initializeBindings].
- (bindings includesKey: aString)
- ifFalse: [bindings at: aString put: nil].
^ bindings associationAt: aString!
Item was added:
+ ----- Method: Workspace class>>addLookupPool: (in category 'lookup pools') -----
+ addLookupPool: sharedPool
+ "Add a SharedPool that bindings should be looked up in."
+ LookupPools ifNil: [LookupPools := IdentitySet new].
+ LookupPools add: sharedPool!
Item was changed:
StringHolder subclass: #Workspace
instanceVariableNames: 'bindings acceptDroppedMorphs acceptAction mustDeclareVariables shouldStyle'
+ classVariableNames: 'LookupPools ShouldStyle'
- classVariableNames: 'ShouldStyle'
poolDictionaries: ''
category: 'Tools-Base'!
!Workspace commentStamp: 'ls 10/14/2003 12:13' prior: 0!
A Workspace is a text area plus a lot of support for executable code. It is a great place to execute top-level commands to compute something useful, and it is a great place to develop bits of a program before those bits get put into class methods.
To open a new workspace, execute:
Workspace open
A workspace can have its own variables, called "workspace variables", to hold intermediate results. For example, if you type into a workspace "x := 5" and do-it, then later you could type in "y := x * 2" and y would become 10.
Additionally, in Morphic, a workspace can gain access to morphs that are on the screen. If acceptDroppedMorphss is turned on, then whenever a morph is dropped on the workspace, a variable will be created which references that morph. This functionality is toggled with the window-wide menu of a workspace.
The instance variables of this class are:
bindings - holds the workspace variables for this workspace
acceptDroppedMorphss - whether dropped morphs should create new variables!
Joshua Gargus uploaded a new version of Tools to project The Trunk:
http://source.squeak.org/trunk/Tools-jcg.247.mcz
==================== Summary ====================
Name: Tools-jcg.247
Author: jcg
Time: 23 June 2010, 12:13:50.59 pm
UUID: a06587b9-7aaf-412f-a9a1-c49d97fb8110
Ancestors: Tools-cmm.246
Workspaces can now look up variable-bindings in a user-specified list of SharedPools. See the class-side methods #addLookupPool:, #removeLookupPool:, and #clearLookupPools.
=============== Diff against Tools-cmm.246 ===============
Item was added:
+ ----- Method: Workspace class>>removeLookupPool: (in category 'lookup pools') -----
+ removeLookupPool: sharedPool
+ "Workspaces should no longer look up bindings in the specified SharedPool."
+ LookupPools ifNil: [^self].
+ LookupPools remove: sharedPool ifAbsent: [].!
Item was added:
+ ----- Method: Workspace>>lookupInPools: (in category 'binding') -----
+ lookupInPools: aString
+ "Iterate through all of the lookup pools to find a match for the specified name."
+ LookupPools ifNil: [^nil].
+ LookupPools do: [:pool | (pool bindingOf: aString) ifNotNil: [:assoc | ^assoc value]].
+ ^nil
+ !
Item was added:
+ ----- Method: Workspace class>>clearLookupPools (in category 'lookup pools') -----
+ clearLookupPools
+ LookupPools := nil.
+ !
Item was changed:
----- Method: Workspace>>bindingOf: (in category 'binding') -----
bindingOf: aString
-
mustDeclareVariables ifTrue: [^ nil].
"I want to have workspace that force the user to declare
variables. Still subclasses may want to do something else"
+ bindings ifNil: [self initializeBindings].
+ (bindings includesKey: aString) ifFalse: [
+ | val |
+ val := self lookupInPools: aString.
+ val
+ ifNotNil: [
+ "Caveat: since we're not inserting the pool's Association into
+ the dictionary, assigning a new value to the variable will only
+ affect the one Workspace (i.e. you can't assign to a variable in a
+ SharedPool)."
+ bindings at: aString put: val]
+ ifNil: [aString first isUppercase
+ ifTrue: [^nil]
+ ifFalse: [bindings at: aString put: nil]]
+ ].
- bindings isNil
- ifTrue: [self initializeBindings].
- (bindings includesKey: aString)
- ifFalse: [bindings at: aString put: nil].
^ bindings associationAt: aString!
Item was added:
+ ----- Method: Workspace class>>addLookupPool: (in category 'lookup pools') -----
+ addLookupPool: sharedPool
+ "Add a SharedPool that bindings should be looked up in."
+ LookupPools ifNil: [LookupPools := IdentitySet new].
+ LookupPools add: sharedPool!
Item was changed:
StringHolder subclass: #Workspace
instanceVariableNames: 'bindings acceptDroppedMorphs acceptAction mustDeclareVariables shouldStyle'
+ classVariableNames: 'LookupPools ShouldStyle'
- classVariableNames: 'ShouldStyle'
poolDictionaries: ''
category: 'Tools-Base'!
!Workspace commentStamp: 'ls 10/14/2003 12:13' prior: 0!
A Workspace is a text area plus a lot of support for executable code. It is a great place to execute top-level commands to compute something useful, and it is a great place to develop bits of a program before those bits get put into class methods.
To open a new workspace, execute:
Workspace open
A workspace can have its own variables, called "workspace variables", to hold intermediate results. For example, if you type into a workspace "x := 5" and do-it, then later you could type in "y := x * 2" and y would become 10.
Additionally, in Morphic, a workspace can gain access to morphs that are on the screen. If acceptDroppedMorphss is turned on, then whenever a morph is dropped on the workspace, a variable will be created which references that morph. This functionality is toggled with the window-wide menu of a workspace.
The instance variables of this class are:
bindings - holds the workspace variables for this workspace
acceptDroppedMorphss - whether dropped morphs should create new variables!
Joshua Gargus uploaded a new version of Compiler to project The Trunk:
http://source.squeak.org/trunk/Compiler-jcg.147.mcz
==================== Summary ====================
Name: Compiler-jcg.147
Author: jcg
Time: 23 June 2010, 12:04:54.856 pm
UUID: 714d775f-78af-45dc-affc-b33d59d68da5
Ancestors: Compiler-nice.146
Change Parser>>correctVariable:interval: to allow it to look up the proposed variable in the requestor even if it starts with an uppercase letter.
=============== Diff against Compiler-nice.146 ===============
Item was changed:
----- Method: Parser>>correctVariable:interval: (in category 'error correction') -----
correctVariable: proposedVariable interval: spot
"Correct the proposedVariable to a known variable, or declare it as a new
variable if such action is requested. We support declaring lowercase
variables as temps or inst-vars, and uppercase variables as Globals or
ClassVars, depending on whether the context is nil (class=UndefinedObject).
Spot is the interval within the test stream of the variable.
rr 3/4/2004 10:26 : adds the option to define a new class. "
"Check if this is an i-var, that has been corrected already (ugly)"
"Display the pop-up menu"
+ | binding userSelection action |
- | tempIvar binding userSelection action |
(encoder classEncoding instVarNames includes: proposedVariable) ifTrue:
[^InstanceVariableNode new
name: proposedVariable
index: (encoder classEncoding allInstVarNames indexOf: proposedVariable)].
"If we can't ask the user for correction, make it undeclared"
self interactive ifFalse: [^encoder undeclared: proposedVariable].
"First check to see if the requestor knows anything about the variable"
+ (binding := requestor bindingOf: proposedVariable)
+ ifNotNil: [^encoder global: binding name: proposedVariable].
- tempIvar := proposedVariable first isLowercase.
- (tempIvar and: [(binding := requestor bindingOf: proposedVariable) notNil])
- ifTrue: [^encoder global: binding name: proposedVariable].
userSelection := requestor selectionInterval.
requestor selectFrom: spot first to: spot last.
requestor select.
"Build the menu with alternatives"
action := UndeclaredVariable
signalFor: self
name: proposedVariable
inRange: spot.
action ifNil: [^self fail].
"Execute the selected action"
requestor deselect.
requestor selectInvisiblyFrom: userSelection first to: userSelection last.
^action value!