SharedPool.st
author Claus Gittinger <cg@exept.de>
Tue, 09 Jul 2019 20:55:17 +0200
changeset 24417 03b083548da2
parent 21763 8e1c7289a30a
child 24605 3ce84a9abdc9
permissions -rw-r--r--
#REFACTORING by exept class: Smalltalk class changed: #recursiveInstallAutoloadedClassesFrom:rememberIn:maxLevels:noAutoload:packageTop:showSplashInLevels: Transcript showCR:(... bindWith:...) -> Transcript showCR:... with:...
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
8728
d70396dc4e96 copyright
Claus Gittinger <cg@exept.de>
parents: 8551
diff changeset
     1
"
d70396dc4e96 copyright
Claus Gittinger <cg@exept.de>
parents: 8551
diff changeset
     2
 COPYRIGHT (c) 2004 by eXept Software AG
d70396dc4e96 copyright
Claus Gittinger <cg@exept.de>
parents: 8551
diff changeset
     3
              All Rights Reserved
d70396dc4e96 copyright
Claus Gittinger <cg@exept.de>
parents: 8551
diff changeset
     4
d70396dc4e96 copyright
Claus Gittinger <cg@exept.de>
parents: 8551
diff changeset
     5
 This software is furnished under a license and may be used
d70396dc4e96 copyright
Claus Gittinger <cg@exept.de>
parents: 8551
diff changeset
     6
 only in accordance with the terms of that license and with the
d70396dc4e96 copyright
Claus Gittinger <cg@exept.de>
parents: 8551
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
d70396dc4e96 copyright
Claus Gittinger <cg@exept.de>
parents: 8551
diff changeset
     8
 be provided or otherwise made available to, or used by, any
d70396dc4e96 copyright
Claus Gittinger <cg@exept.de>
parents: 8551
diff changeset
     9
 other person.  No title to or ownership of the software is
d70396dc4e96 copyright
Claus Gittinger <cg@exept.de>
parents: 8551
diff changeset
    10
 hereby transferred.
d70396dc4e96 copyright
Claus Gittinger <cg@exept.de>
parents: 8551
diff changeset
    11
"
8538
68e006f46d87 initial checkin
ca
parents:
diff changeset
    12
"{ Package: 'stx:libbasic' }"
68e006f46d87 initial checkin
ca
parents:
diff changeset
    13
17386
fb11f2545133 class: SharedPool
Claus Gittinger <cg@exept.de>
parents: 15633
diff changeset
    14
"{ NameSpace: Smalltalk }"
fb11f2545133 class: SharedPool
Claus Gittinger <cg@exept.de>
parents: 15633
diff changeset
    15
8538
68e006f46d87 initial checkin
ca
parents:
diff changeset
    16
Object subclass:#SharedPool
68e006f46d87 initial checkin
ca
parents:
diff changeset
    17
	instanceVariableNames:''
68e006f46d87 initial checkin
ca
parents:
diff changeset
    18
	classVariableNames:''
68e006f46d87 initial checkin
ca
parents:
diff changeset
    19
	poolDictionaries:''
68e006f46d87 initial checkin
ca
parents:
diff changeset
    20
	category:'Kernel-Classes'
68e006f46d87 initial checkin
ca
parents:
diff changeset
    21
!
68e006f46d87 initial checkin
ca
parents:
diff changeset
    22
68e006f46d87 initial checkin
ca
parents:
diff changeset
    23
!SharedPool class methodsFor:'documentation'!
68e006f46d87 initial checkin
ca
parents:
diff changeset
    24
8728
d70396dc4e96 copyright
Claus Gittinger <cg@exept.de>
parents: 8551
diff changeset
    25
copyright
d70396dc4e96 copyright
Claus Gittinger <cg@exept.de>
parents: 8551
diff changeset
    26
"
d70396dc4e96 copyright
Claus Gittinger <cg@exept.de>
parents: 8551
diff changeset
    27
 COPYRIGHT (c) 2004 by eXept Software AG
d70396dc4e96 copyright
Claus Gittinger <cg@exept.de>
parents: 8551
diff changeset
    28
              All Rights Reserved
d70396dc4e96 copyright
Claus Gittinger <cg@exept.de>
parents: 8551
diff changeset
    29
d70396dc4e96 copyright
Claus Gittinger <cg@exept.de>
parents: 8551
diff changeset
    30
 This software is furnished under a license and may be used
d70396dc4e96 copyright
Claus Gittinger <cg@exept.de>
parents: 8551
diff changeset
    31
 only in accordance with the terms of that license and with the
d70396dc4e96 copyright
Claus Gittinger <cg@exept.de>
parents: 8551
diff changeset
    32
 inclusion of the above copyright notice.   This software may not
d70396dc4e96 copyright
Claus Gittinger <cg@exept.de>
parents: 8551
diff changeset
    33
 be provided or otherwise made available to, or used by, any
d70396dc4e96 copyright
Claus Gittinger <cg@exept.de>
parents: 8551
diff changeset
    34
 other person.  No title to or ownership of the software is
d70396dc4e96 copyright
Claus Gittinger <cg@exept.de>
parents: 8551
diff changeset
    35
 hereby transferred.
d70396dc4e96 copyright
Claus Gittinger <cg@exept.de>
parents: 8551
diff changeset
    36
"
d70396dc4e96 copyright
Claus Gittinger <cg@exept.de>
parents: 8551
diff changeset
    37
!
d70396dc4e96 copyright
Claus Gittinger <cg@exept.de>
parents: 8551
diff changeset
    38
8538
68e006f46d87 initial checkin
ca
parents:
diff changeset
    39
documentation
68e006f46d87 initial checkin
ca
parents:
diff changeset
    40
"
68e006f46d87 initial checkin
ca
parents:
diff changeset
    41
    A shared pool represents a set of bindings which are accessible to all classes
68e006f46d87 initial checkin
ca
parents:
diff changeset
    42
    which import the pool in its 'pool dictionaries'.
68e006f46d87 initial checkin
ca
parents:
diff changeset
    43
    SharedPool is NOT a dictionary but rather a name space.
68e006f46d87 initial checkin
ca
parents:
diff changeset
    44
    Bindings are represented by 'class variables' - as long as we have no better way to represent
12220
c26b8b402a71 changed: #documentation
Claus Gittinger <cg@exept.de>
parents: 12169
diff changeset
    45
    them at least. This is done to make stc happy (or at least, to not be forced to adapt it
c26b8b402a71 changed: #documentation
Claus Gittinger <cg@exept.de>
parents: 12169
diff changeset
    46
    to any new semantics).
8538
68e006f46d87 initial checkin
ca
parents:
diff changeset
    47
"
68e006f46d87 initial checkin
ca
parents:
diff changeset
    48
! !
68e006f46d87 initial checkin
ca
parents:
diff changeset
    49
13682
b8ba89085dc0 category of:
Claus Gittinger <cg@exept.de>
parents: 13681
diff changeset
    50
!SharedPool class methodsFor:'Compatibility-Squeak'!
b8ba89085dc0 category of:
Claus Gittinger <cg@exept.de>
parents: 13681
diff changeset
    51
b8ba89085dc0 category of:
Claus Gittinger <cg@exept.de>
parents: 13681
diff changeset
    52
bindingOf: varName
b8ba89085dc0 category of:
Claus Gittinger <cg@exept.de>
parents: 13681
diff changeset
    53
    "Answer the binding of some variable resolved in the scope of the receiver"
b8ba89085dc0 category of:
Claus Gittinger <cg@exept.de>
parents: 13681
diff changeset
    54
b8ba89085dc0 category of:
Claus Gittinger <cg@exept.de>
parents: 13681
diff changeset
    55
    | aSymbol binding |
b8ba89085dc0 category of:
Claus Gittinger <cg@exept.de>
parents: 13681
diff changeset
    56
b8ba89085dc0 category of:
Claus Gittinger <cg@exept.de>
parents: 13681
diff changeset
    57
    "/ self shouldImplement.       "not yet finished"
b8ba89085dc0 category of:
Claus Gittinger <cg@exept.de>
parents: 13681
diff changeset
    58
    aSymbol := varName asSymbol.
b8ba89085dc0 category of:
Claus Gittinger <cg@exept.de>
parents: 13681
diff changeset
    59
b8ba89085dc0 category of:
Claus Gittinger <cg@exept.de>
parents: 13681
diff changeset
    60
    "First look in classVar dictionary."
b8ba89085dc0 category of:
Claus Gittinger <cg@exept.de>
parents: 13681
diff changeset
    61
    binding := self classPool bindingOf: aSymbol.
b8ba89085dc0 category of:
Claus Gittinger <cg@exept.de>
parents: 13681
diff changeset
    62
    binding notNil ifTrue:[^binding].
b8ba89085dc0 category of:
Claus Gittinger <cg@exept.de>
parents: 13681
diff changeset
    63
b8ba89085dc0 category of:
Claus Gittinger <cg@exept.de>
parents: 13681
diff changeset
    64
    "Next look in shared pools."
b8ba89085dc0 category of:
Claus Gittinger <cg@exept.de>
parents: 13681
diff changeset
    65
    self sharedPools do:[:pool |
b8ba89085dc0 category of:
Claus Gittinger <cg@exept.de>
parents: 13681
diff changeset
    66
        binding := pool bindingOf: aSymbol.
b8ba89085dc0 category of:
Claus Gittinger <cg@exept.de>
parents: 13681
diff changeset
    67
        binding notNil ifTrue:[^binding].
b8ba89085dc0 category of:
Claus Gittinger <cg@exept.de>
parents: 13681
diff changeset
    68
    ].
b8ba89085dc0 category of:
Claus Gittinger <cg@exept.de>
parents: 13681
diff changeset
    69
b8ba89085dc0 category of:
Claus Gittinger <cg@exept.de>
parents: 13681
diff changeset
    70
    "subclassing and environment are not preserved"
b8ba89085dc0 category of:
Claus Gittinger <cg@exept.de>
parents: 13681
diff changeset
    71
    ^nil
b8ba89085dc0 category of:
Claus Gittinger <cg@exept.de>
parents: 13681
diff changeset
    72
b8ba89085dc0 category of:
Claus Gittinger <cg@exept.de>
parents: 13681
diff changeset
    73
    "Modified: / 12-09-2011 / 09:40:36 / cg"
b8ba89085dc0 category of:
Claus Gittinger <cg@exept.de>
parents: 13681
diff changeset
    74
!
b8ba89085dc0 category of:
Claus Gittinger <cg@exept.de>
parents: 13681
diff changeset
    75
b8ba89085dc0 category of:
Claus Gittinger <cg@exept.de>
parents: 13681
diff changeset
    76
bindingsDo: aBlock
b8ba89085dc0 category of:
Claus Gittinger <cg@exept.de>
parents: 13681
diff changeset
    77
    self classVarNames do:[:eachKey |
b8ba89085dc0 category of:
Claus Gittinger <cg@exept.de>
parents: 13681
diff changeset
    78
        aBlock value:(eachKey -> (self classVarAt:eachKey))
b8ba89085dc0 category of:
Claus Gittinger <cg@exept.de>
parents: 13681
diff changeset
    79
    ].
b8ba89085dc0 category of:
Claus Gittinger <cg@exept.de>
parents: 13681
diff changeset
    80
b8ba89085dc0 category of:
Claus Gittinger <cg@exept.de>
parents: 13681
diff changeset
    81
    "Modified: / 12-09-2011 / 09:42:00 / cg"
b8ba89085dc0 category of:
Claus Gittinger <cg@exept.de>
parents: 13681
diff changeset
    82
! !
b8ba89085dc0 category of:
Claus Gittinger <cg@exept.de>
parents: 13681
diff changeset
    83
9091
35b746ada800 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8728
diff changeset
    84
!SharedPool class methodsFor:'Compatibility-V''Age'!
35b746ada800 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8728
diff changeset
    85
35b746ada800 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8728
diff changeset
    86
declareConstant:constantName value:value
35b746ada800 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8728
diff changeset
    87
    self == SharedPool ifTrue:[ self error ].
35b746ada800 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8728
diff changeset
    88
35b746ada800 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8728
diff changeset
    89
    (self classVarNames includes:constantName) ifFalse:[
35b746ada800 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8728
diff changeset
    90
        self addClassVarName:constantName
35b746ada800 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8728
diff changeset
    91
    ].
35b746ada800 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8728
diff changeset
    92
35b746ada800 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8728
diff changeset
    93
    self classVarAt:constantName put:value.
13997
7aad3af21b76 added: #declareVariable:
Claus Gittinger <cg@exept.de>
parents: 13682
diff changeset
    94
!
7aad3af21b76 added: #declareVariable:
Claus Gittinger <cg@exept.de>
parents: 13682
diff changeset
    95
7aad3af21b76 added: #declareVariable:
Claus Gittinger <cg@exept.de>
parents: 13682
diff changeset
    96
declareVariable:varName
7aad3af21b76 added: #declareVariable:
Claus Gittinger <cg@exept.de>
parents: 13682
diff changeset
    97
    self == SharedPool ifTrue:[ self error ].
7aad3af21b76 added: #declareVariable:
Claus Gittinger <cg@exept.de>
parents: 13682
diff changeset
    98
7aad3af21b76 added: #declareVariable:
Claus Gittinger <cg@exept.de>
parents: 13682
diff changeset
    99
    (self classVarNames includes:varName) ifFalse:[
7aad3af21b76 added: #declareVariable:
Claus Gittinger <cg@exept.de>
parents: 13682
diff changeset
   100
        self addClassVarName:varName
7aad3af21b76 added: #declareVariable:
Claus Gittinger <cg@exept.de>
parents: 13682
diff changeset
   101
    ].
7aad3af21b76 added: #declareVariable:
Claus Gittinger <cg@exept.de>
parents: 13682
diff changeset
   102
7aad3af21b76 added: #declareVariable:
Claus Gittinger <cg@exept.de>
parents: 13682
diff changeset
   103
    "Created: / 07-02-2012 / 15:57:35 / cg"
9091
35b746ada800 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8728
diff changeset
   104
! !
35b746ada800 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8728
diff changeset
   105
15633
d08f9fa63cc2 class: SharedPool
Stefan Vogel <sv@exept.de>
parents: 14284
diff changeset
   106
13181
Claus Gittinger <cg@exept.de>
parents: 13097
diff changeset
   107
!SharedPool class methodsFor:'code generation'!
Claus Gittinger <cg@exept.de>
parents: 13097
diff changeset
   108
Claus Gittinger <cg@exept.de>
parents: 13097
diff changeset
   109
initializeFrom:aDictionary
13207
5f62183ab0e9 comment/format in: #initializeFrom:
Claus Gittinger <cg@exept.de>
parents: 13181
diff changeset
   110
    "given a dictionary, generate my classvars and the init code"
13181
Claus Gittinger <cg@exept.de>
parents: 13097
diff changeset
   111
13211
c64d16143d54 changed: #initializeFrom:
Claus Gittinger <cg@exept.de>
parents: 13210
diff changeset
   112
    |sortedNames code|
13181
Claus Gittinger <cg@exept.de>
parents: 13097
diff changeset
   113
13211
c64d16143d54 changed: #initializeFrom:
Claus Gittinger <cg@exept.de>
parents: 13210
diff changeset
   114
    sortedNames := aDictionary keys asSortedCollection.
c64d16143d54 changed: #initializeFrom:
Claus Gittinger <cg@exept.de>
parents: 13210
diff changeset
   115
    self addClassVarNames:sortedNames.
13181
Claus Gittinger <cg@exept.de>
parents: 13097
diff changeset
   116
Claus Gittinger <cg@exept.de>
parents: 13097
diff changeset
   117
    code := String streamContents:[:s |
Claus Gittinger <cg@exept.de>
parents: 13097
diff changeset
   118
        s nextPutLine:'initialize'.
13211
c64d16143d54 changed: #initializeFrom:
Claus Gittinger <cg@exept.de>
parents: 13210
diff changeset
   119
        sortedNames do:[:k |
13181
Claus Gittinger <cg@exept.de>
parents: 13097
diff changeset
   120
            |v|
Claus Gittinger <cg@exept.de>
parents: 13097
diff changeset
   121
Claus Gittinger <cg@exept.de>
parents: 13097
diff changeset
   122
            v := aDictionary at:k.
Claus Gittinger <cg@exept.de>
parents: 13097
diff changeset
   123
            s nextPutLine:('    %1 := %2.' bindWith:k with:v storeString).
Claus Gittinger <cg@exept.de>
parents: 13097
diff changeset
   124
        ].
Claus Gittinger <cg@exept.de>
parents: 13097
diff changeset
   125
    ].
Claus Gittinger <cg@exept.de>
parents: 13097
diff changeset
   126
    self class compile:code classified:'initialization'
Claus Gittinger <cg@exept.de>
parents: 13097
diff changeset
   127
Claus Gittinger <cg@exept.de>
parents: 13097
diff changeset
   128
    "
Claus Gittinger <cg@exept.de>
parents: 13097
diff changeset
   129
     OLEStatusCodeConstants initializeFrom:aDictionary
Claus Gittinger <cg@exept.de>
parents: 13097
diff changeset
   130
    "
Claus Gittinger <cg@exept.de>
parents: 13097
diff changeset
   131
Claus Gittinger <cg@exept.de>
parents: 13097
diff changeset
   132
    "Created: / 21-12-2010 / 17:58:25 / cg"
13211
c64d16143d54 changed: #initializeFrom:
Claus Gittinger <cg@exept.de>
parents: 13210
diff changeset
   133
    "Modified: / 15-01-2011 / 14:20:58 / cg"
13181
Claus Gittinger <cg@exept.de>
parents: 13097
diff changeset
   134
! !
Claus Gittinger <cg@exept.de>
parents: 13097
diff changeset
   135
14049
7f32280587a8 dictionary protocol
Claus Gittinger <cg@exept.de>
parents: 13997
diff changeset
   136
!SharedPool class methodsFor:'dictionary protocol'!
7f32280587a8 dictionary protocol
Claus Gittinger <cg@exept.de>
parents: 13997
diff changeset
   137
15633
d08f9fa63cc2 class: SharedPool
Stefan Vogel <sv@exept.de>
parents: 14284
diff changeset
   138
associationsDo:aBlock
d08f9fa63cc2 class: SharedPool
Stefan Vogel <sv@exept.de>
parents: 14284
diff changeset
   139
    "enumerate all keys (= pool var names) with their value"
d08f9fa63cc2 class: SharedPool
Stefan Vogel <sv@exept.de>
parents: 14284
diff changeset
   140
d08f9fa63cc2 class: SharedPool
Stefan Vogel <sv@exept.de>
parents: 14284
diff changeset
   141
    ^ self keys do:[:key | aBlock value:(Association key:key value:(self at:key))]
d08f9fa63cc2 class: SharedPool
Stefan Vogel <sv@exept.de>
parents: 14284
diff changeset
   142
!
d08f9fa63cc2 class: SharedPool
Stefan Vogel <sv@exept.de>
parents: 14284
diff changeset
   143
14049
7f32280587a8 dictionary protocol
Claus Gittinger <cg@exept.de>
parents: 13997
diff changeset
   144
do:aBlock
7f32280587a8 dictionary protocol
Claus Gittinger <cg@exept.de>
parents: 13997
diff changeset
   145
    "enumerate all values"
7f32280587a8 dictionary protocol
Claus Gittinger <cg@exept.de>
parents: 13997
diff changeset
   146
7f32280587a8 dictionary protocol
Claus Gittinger <cg@exept.de>
parents: 13997
diff changeset
   147
    ^ self keys do:[:key | aBlock value:(self at:key)]
7f32280587a8 dictionary protocol
Claus Gittinger <cg@exept.de>
parents: 13997
diff changeset
   148
7f32280587a8 dictionary protocol
Claus Gittinger <cg@exept.de>
parents: 13997
diff changeset
   149
    "Created: / 06-03-2012 / 17:07:54 / cg"
7f32280587a8 dictionary protocol
Claus Gittinger <cg@exept.de>
parents: 13997
diff changeset
   150
!
7f32280587a8 dictionary protocol
Claus Gittinger <cg@exept.de>
parents: 13997
diff changeset
   151
7f32280587a8 dictionary protocol
Claus Gittinger <cg@exept.de>
parents: 13997
diff changeset
   152
includesKey:aSymbol
7f32280587a8 dictionary protocol
Claus Gittinger <cg@exept.de>
parents: 13997
diff changeset
   153
    ^ self keys includes:aSymbol
7f32280587a8 dictionary protocol
Claus Gittinger <cg@exept.de>
parents: 13997
diff changeset
   154
7f32280587a8 dictionary protocol
Claus Gittinger <cg@exept.de>
parents: 13997
diff changeset
   155
    "
7f32280587a8 dictionary protocol
Claus Gittinger <cg@exept.de>
parents: 13997
diff changeset
   156
     OpenGLConstants includesKey:#GL3Bytes
7f32280587a8 dictionary protocol
Claus Gittinger <cg@exept.de>
parents: 13997
diff changeset
   157
    "
7f32280587a8 dictionary protocol
Claus Gittinger <cg@exept.de>
parents: 13997
diff changeset
   158
!
7f32280587a8 dictionary protocol
Claus Gittinger <cg@exept.de>
parents: 13997
diff changeset
   159
7f32280587a8 dictionary protocol
Claus Gittinger <cg@exept.de>
parents: 13997
diff changeset
   160
keyAtValue:value ifAbsent:exceptionValue
21364
802924ef3f04 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19204
diff changeset
   161
    "return the key (= pool var name) of a value.
802924ef3f04 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19204
diff changeset
   162
     This is a slow access, since the receiver is searched sequentially.
802924ef3f04 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19204
diff changeset
   163
     NOTICE:
802924ef3f04 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19204
diff changeset
   164
        The value is searched using identity compare;
802924ef3f04 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19204
diff changeset
   165
        use #keyAtEqualValue:ifAbsent: to compare for equality."
802924ef3f04 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19204
diff changeset
   166
        
14049
7f32280587a8 dictionary protocol
Claus Gittinger <cg@exept.de>
parents: 13997
diff changeset
   167
    self keysDo:[:k |
7f32280587a8 dictionary protocol
Claus Gittinger <cg@exept.de>
parents: 13997
diff changeset
   168
        (self at:k) == value ifTrue:[ ^ k ].
7f32280587a8 dictionary protocol
Claus Gittinger <cg@exept.de>
parents: 13997
diff changeset
   169
    ].
7f32280587a8 dictionary protocol
Claus Gittinger <cg@exept.de>
parents: 13997
diff changeset
   170
    ^ exceptionValue value
7f32280587a8 dictionary protocol
Claus Gittinger <cg@exept.de>
parents: 13997
diff changeset
   171
7f32280587a8 dictionary protocol
Claus Gittinger <cg@exept.de>
parents: 13997
diff changeset
   172
    "Created: / 08-09-2011 / 05:51:10 / cg"
21364
802924ef3f04 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19204
diff changeset
   173
    "Modified (comment): / 07-02-2017 / 11:06:57 / cg"
14049
7f32280587a8 dictionary protocol
Claus Gittinger <cg@exept.de>
parents: 13997
diff changeset
   174
!
7f32280587a8 dictionary protocol
Claus Gittinger <cg@exept.de>
parents: 13997
diff changeset
   175
7f32280587a8 dictionary protocol
Claus Gittinger <cg@exept.de>
parents: 13997
diff changeset
   176
keys
7f32280587a8 dictionary protocol
Claus Gittinger <cg@exept.de>
parents: 13997
diff changeset
   177
    "retrieve all keys (= pool var names)"
7f32280587a8 dictionary protocol
Claus Gittinger <cg@exept.de>
parents: 13997
diff changeset
   178
7f32280587a8 dictionary protocol
Claus Gittinger <cg@exept.de>
parents: 13997
diff changeset
   179
    ^ self classVarNames
7f32280587a8 dictionary protocol
Claus Gittinger <cg@exept.de>
parents: 13997
diff changeset
   180
7f32280587a8 dictionary protocol
Claus Gittinger <cg@exept.de>
parents: 13997
diff changeset
   181
    "
7f32280587a8 dictionary protocol
Claus Gittinger <cg@exept.de>
parents: 13997
diff changeset
   182
     OpenGLConstants keys
7f32280587a8 dictionary protocol
Claus Gittinger <cg@exept.de>
parents: 13997
diff changeset
   183
    "
7f32280587a8 dictionary protocol
Claus Gittinger <cg@exept.de>
parents: 13997
diff changeset
   184
7f32280587a8 dictionary protocol
Claus Gittinger <cg@exept.de>
parents: 13997
diff changeset
   185
    "Modified (comment): / 06-03-2012 / 17:09:11 / cg"
7f32280587a8 dictionary protocol
Claus Gittinger <cg@exept.de>
parents: 13997
diff changeset
   186
!
7f32280587a8 dictionary protocol
Claus Gittinger <cg@exept.de>
parents: 13997
diff changeset
   187
7f32280587a8 dictionary protocol
Claus Gittinger <cg@exept.de>
parents: 13997
diff changeset
   188
keysAndValuesDo:aBlock
7f32280587a8 dictionary protocol
Claus Gittinger <cg@exept.de>
parents: 13997
diff changeset
   189
    "enumerate all keys (= pool var names) with their value"
7f32280587a8 dictionary protocol
Claus Gittinger <cg@exept.de>
parents: 13997
diff changeset
   190
17386
fb11f2545133 class: SharedPool
Claus Gittinger <cg@exept.de>
parents: 15633
diff changeset
   191
    self keys do:[:key | aBlock value:key value:(self at:key)]
14049
7f32280587a8 dictionary protocol
Claus Gittinger <cg@exept.de>
parents: 13997
diff changeset
   192
7f32280587a8 dictionary protocol
Claus Gittinger <cg@exept.de>
parents: 13997
diff changeset
   193
    "Created: / 06-03-2012 / 17:07:41 / cg"
7f32280587a8 dictionary protocol
Claus Gittinger <cg@exept.de>
parents: 13997
diff changeset
   194
!
7f32280587a8 dictionary protocol
Claus Gittinger <cg@exept.de>
parents: 13997
diff changeset
   195
7f32280587a8 dictionary protocol
Claus Gittinger <cg@exept.de>
parents: 13997
diff changeset
   196
keysDo:aBlock
7f32280587a8 dictionary protocol
Claus Gittinger <cg@exept.de>
parents: 13997
diff changeset
   197
    "enumerate all keys (= pool var names)"
7f32280587a8 dictionary protocol
Claus Gittinger <cg@exept.de>
parents: 13997
diff changeset
   198
17386
fb11f2545133 class: SharedPool
Claus Gittinger <cg@exept.de>
parents: 15633
diff changeset
   199
    self keys do:aBlock
14049
7f32280587a8 dictionary protocol
Claus Gittinger <cg@exept.de>
parents: 13997
diff changeset
   200
7f32280587a8 dictionary protocol
Claus Gittinger <cg@exept.de>
parents: 13997
diff changeset
   201
    "Modified (comment): / 06-03-2012 / 17:08:54 / cg"
7f32280587a8 dictionary protocol
Claus Gittinger <cg@exept.de>
parents: 13997
diff changeset
   202
! !
7f32280587a8 dictionary protocol
Claus Gittinger <cg@exept.de>
parents: 13997
diff changeset
   203
13097
d07ec91b3105 added: #iconInBrowserSymbol
Claus Gittinger <cg@exept.de>
parents: 13005
diff changeset
   204
8538
68e006f46d87 initial checkin
ca
parents:
diff changeset
   205
!SharedPool class methodsFor:'name lookup'!
68e006f46d87 initial checkin
ca
parents:
diff changeset
   206
12169
8fcbd9a9237e added: #at:
Claus Gittinger <cg@exept.de>
parents: 11305
diff changeset
   207
at:name
8fcbd9a9237e added: #at:
Claus Gittinger <cg@exept.de>
parents: 11305
diff changeset
   208
    "retrieve a pool variable by name"
8fcbd9a9237e added: #at:
Claus Gittinger <cg@exept.de>
parents: 11305
diff changeset
   209
8fcbd9a9237e added: #at:
Claus Gittinger <cg@exept.de>
parents: 11305
diff changeset
   210
    ^ self at:name ifAbsent:[self errorKeyNotFound:name]
8fcbd9a9237e added: #at:
Claus Gittinger <cg@exept.de>
parents: 11305
diff changeset
   211
!
8fcbd9a9237e added: #at:
Claus Gittinger <cg@exept.de>
parents: 11305
diff changeset
   212
10853
72acafda369f dictionary compatible protocol added
Claus Gittinger <cg@exept.de>
parents: 9091
diff changeset
   213
at:name ifAbsent:aBlock
12169
8fcbd9a9237e added: #at:
Claus Gittinger <cg@exept.de>
parents: 11305
diff changeset
   214
    "retrieve a pool variable by name"
8fcbd9a9237e added: #at:
Claus Gittinger <cg@exept.de>
parents: 11305
diff changeset
   215
10853
72acafda369f dictionary compatible protocol added
Claus Gittinger <cg@exept.de>
parents: 9091
diff changeset
   216
    (self includesKey:name) ifFalse:[^ aBlock value].
72acafda369f dictionary compatible protocol added
Claus Gittinger <cg@exept.de>
parents: 9091
diff changeset
   217
    ^ self classVarAt:name
72acafda369f dictionary compatible protocol added
Claus Gittinger <cg@exept.de>
parents: 9091
diff changeset
   218
!
72acafda369f dictionary compatible protocol added
Claus Gittinger <cg@exept.de>
parents: 9091
diff changeset
   219
13661
Claus Gittinger <cg@exept.de>
parents: 13211
diff changeset
   220
at:name put:aValue
Claus Gittinger <cg@exept.de>
parents: 13211
diff changeset
   221
    "set a pool variable by name"
Claus Gittinger <cg@exept.de>
parents: 13211
diff changeset
   222
Claus Gittinger <cg@exept.de>
parents: 13211
diff changeset
   223
    ^ self classVarAt:name put:aValue
Claus Gittinger <cg@exept.de>
parents: 13211
diff changeset
   224
Claus Gittinger <cg@exept.de>
parents: 13211
diff changeset
   225
    "Created: / 08-09-2011 / 05:48:16 / cg"
Claus Gittinger <cg@exept.de>
parents: 13211
diff changeset
   226
!
Claus Gittinger <cg@exept.de>
parents: 13211
diff changeset
   227
8538
68e006f46d87 initial checkin
ca
parents:
diff changeset
   228
classBindingOf: varName
68e006f46d87 initial checkin
ca
parents:
diff changeset
   229
    "For initialization messages grant the regular scope"
68e006f46d87 initial checkin
ca
parents:
diff changeset
   230
11305
83f14d00b6a7 Change #halt: to #shouldImplement or #assert:
Stefan Vogel <sv@exept.de>
parents: 10853
diff changeset
   231
    self shouldImplement.       "not yet finished"
83f14d00b6a7 Change #halt: to #shouldImplement or #assert:
Stefan Vogel <sv@exept.de>
parents: 10853
diff changeset
   232
    ^ super bindingOf: varName
8551
de314b9f8fa3 sharedPools
ca
parents: 8538
diff changeset
   233
! !
de314b9f8fa3 sharedPools
ca
parents: 8538
diff changeset
   234
de314b9f8fa3 sharedPools
ca
parents: 8538
diff changeset
   235
!SharedPool class methodsFor:'printing & storing'!
de314b9f8fa3 sharedPools
ca
parents: 8538
diff changeset
   236
14284
da05376dea2d Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 14049
diff changeset
   237
displayOn:aGCOrStream
da05376dea2d Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 14049
diff changeset
   238
    "Compatibility
21763
8e1c7289a30a #OTHER by mawalch
mawalch
parents: 21364
diff changeset
   239
     append a printed description on some stream (Dolphin, Squeak)
14284
da05376dea2d Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 14049
diff changeset
   240
     OR:
da05376dea2d Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 14049
diff changeset
   241
     display the receiver in a graphicsContext at 0@0 (ST80).
da05376dea2d Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 14049
diff changeset
   242
     This method allows for any object to be displayed in some view
da05376dea2d Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 14049
diff changeset
   243
     (although the fallBack is to display its printString ...)"
da05376dea2d Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 14049
diff changeset
   244
da05376dea2d Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 14049
diff changeset
   245
    "/ what a kludge - Dolphin and Squeak mean: printOn: a stream;
da05376dea2d Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 14049
diff changeset
   246
    "/ ST/X (and some old ST80's) mean: draw-yourself on a GC.
da05376dea2d Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 14049
diff changeset
   247
    aGCOrStream isStream ifFalse:[
da05376dea2d Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 14049
diff changeset
   248
        ^ super displayOn:aGCOrStream.
da05376dea2d Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 14049
diff changeset
   249
    ].
da05376dea2d Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 14049
diff changeset
   250
21763
8e1c7289a30a #OTHER by mawalch
mawalch
parents: 21364
diff changeset
   251
    "return a printed representation - here, a reminder is appended,
8551
de314b9f8fa3 sharedPools
ca
parents: 8538
diff changeset
   252
     that this is not a regular class"
de314b9f8fa3 sharedPools
ca
parents: 8538
diff changeset
   253
14284
da05376dea2d Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 14049
diff changeset
   254
    self == NameSpace ifTrue:[
da05376dea2d Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 14049
diff changeset
   255
        super displayOn:aGCOrStream.
da05376dea2d Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 14049
diff changeset
   256
    ] ifFalse:[
21763
8e1c7289a30a #OTHER by mawalch
mawalch
parents: 21364
diff changeset
   257
        aGCOrStream
14284
da05376dea2d Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 14049
diff changeset
   258
            nextPutAll:self name;
da05376dea2d Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 14049
diff changeset
   259
            nextPutAll:' (* SharedPool *)'.
8551
de314b9f8fa3 sharedPools
ca
parents: 8538
diff changeset
   260
    ].
21763
8e1c7289a30a #OTHER by mawalch
mawalch
parents: 21364
diff changeset
   261
8e1c7289a30a #OTHER by mawalch
mawalch
parents: 21364
diff changeset
   262
    "Modified (comment): / 17-05-2017 / 16:48:54 / mawalch"
8538
68e006f46d87 initial checkin
ca
parents:
diff changeset
   263
! !
68e006f46d87 initial checkin
ca
parents:
diff changeset
   264
68e006f46d87 initial checkin
ca
parents:
diff changeset
   265
!SharedPool class methodsFor:'queries'!
68e006f46d87 initial checkin
ca
parents:
diff changeset
   266
68e006f46d87 initial checkin
ca
parents:
diff changeset
   267
isSharedPool
68e006f46d87 initial checkin
ca
parents:
diff changeset
   268
    ^ self ~~ SharedPool
68e006f46d87 initial checkin
ca
parents:
diff changeset
   269
! !
68e006f46d87 initial checkin
ca
parents:
diff changeset
   270
68e006f46d87 initial checkin
ca
parents:
diff changeset
   271
!SharedPool class methodsFor:'documentation'!
68e006f46d87 initial checkin
ca
parents:
diff changeset
   272
68e006f46d87 initial checkin
ca
parents:
diff changeset
   273
version
19204
bdb9f988ab4d comment/format in: #iconInBrowserSymbol
Claus Gittinger <cg@exept.de>
parents: 17386
diff changeset
   274
    ^ '$Header$'
12169
8fcbd9a9237e added: #at:
Claus Gittinger <cg@exept.de>
parents: 11305
diff changeset
   275
!
8fcbd9a9237e added: #at:
Claus Gittinger <cg@exept.de>
parents: 11305
diff changeset
   276
8fcbd9a9237e added: #at:
Claus Gittinger <cg@exept.de>
parents: 11305
diff changeset
   277
version_CVS
19204
bdb9f988ab4d comment/format in: #iconInBrowserSymbol
Claus Gittinger <cg@exept.de>
parents: 17386
diff changeset
   278
    ^ '$Header$'
8538
68e006f46d87 initial checkin
ca
parents:
diff changeset
   279
! !
15633
d08f9fa63cc2 class: SharedPool
Stefan Vogel <sv@exept.de>
parents: 14284
diff changeset
   280