8728
|
1 |
"
|
|
2 |
COPYRIGHT (c) 2004 by eXept Software AG
|
|
3 |
All Rights Reserved
|
|
4 |
|
|
5 |
This software is furnished under a license and may be used
|
|
6 |
only in accordance with the terms of that license and with the
|
|
7 |
inclusion of the above copyright notice. This software may not
|
|
8 |
be provided or otherwise made available to, or used by, any
|
|
9 |
other person. No title to or ownership of the software is
|
|
10 |
hereby transferred.
|
|
11 |
"
|
|
12 |
|
8538
|
13 |
"{ Package: 'stx:libbasic' }"
|
|
14 |
|
|
15 |
Object subclass:#SharedPool
|
|
16 |
instanceVariableNames:''
|
|
17 |
classVariableNames:''
|
|
18 |
poolDictionaries:''
|
|
19 |
category:'Kernel-Classes'
|
|
20 |
!
|
|
21 |
|
|
22 |
!SharedPool class methodsFor:'documentation'!
|
|
23 |
|
8728
|
24 |
copyright
|
|
25 |
"
|
|
26 |
COPYRIGHT (c) 2004 by eXept Software AG
|
|
27 |
All Rights Reserved
|
|
28 |
|
|
29 |
This software is furnished under a license and may be used
|
|
30 |
only in accordance with the terms of that license and with the
|
|
31 |
inclusion of the above copyright notice. This software may not
|
|
32 |
be provided or otherwise made available to, or used by, any
|
|
33 |
other person. No title to or ownership of the software is
|
|
34 |
hereby transferred.
|
|
35 |
"
|
|
36 |
!
|
|
37 |
|
8538
|
38 |
documentation
|
|
39 |
"
|
|
40 |
A shared pool represents a set of bindings which are accessible to all classes
|
|
41 |
which import the pool in its 'pool dictionaries'.
|
|
42 |
SharedPool is NOT a dictionary but rather a name space.
|
|
43 |
Bindings are represented by 'class variables' - as long as we have no better way to represent
|
|
44 |
them at least.
|
|
45 |
"
|
|
46 |
! !
|
|
47 |
|
9091
|
48 |
!SharedPool class methodsFor:'Compatibility-V''Age'!
|
|
49 |
|
|
50 |
declareConstant:constantName value:value
|
|
51 |
self == SharedPool ifTrue:[ self error ].
|
|
52 |
|
|
53 |
(self classVarNames includes:constantName) ifFalse:[
|
|
54 |
self addClassVarName:constantName
|
|
55 |
].
|
|
56 |
|
|
57 |
self classVarAt:constantName put:value.
|
|
58 |
! !
|
|
59 |
|
8538
|
60 |
!SharedPool class methodsFor:'name lookup'!
|
|
61 |
|
|
62 |
bindingOf: varName
|
|
63 |
"Answer the binding of some variable resolved in the scope of the receiver"
|
|
64 |
|
|
65 |
| aSymbol binding |
|
|
66 |
|
|
67 |
self halt:'unfinished implementation'.
|
|
68 |
aSymbol := varName asSymbol.
|
|
69 |
|
|
70 |
"First look in classVar dictionary."
|
|
71 |
binding := self classPool bindingOf: aSymbol.
|
|
72 |
binding ifNotNil:[^binding].
|
|
73 |
|
|
74 |
"Next look in shared pools."
|
|
75 |
self sharedPools do:[:pool |
|
|
76 |
binding := pool bindingOf: aSymbol.
|
|
77 |
binding ifNotNil:[^binding].
|
|
78 |
].
|
|
79 |
|
|
80 |
"subclassing and environment are not preserved"
|
|
81 |
^nil
|
|
82 |
!
|
|
83 |
|
|
84 |
bindingsDo: aBlock
|
|
85 |
self halt:'unfinished implementation'.
|
|
86 |
^ self classPool bindingsDo: aBlock
|
|
87 |
!
|
|
88 |
|
|
89 |
classBindingOf: varName
|
|
90 |
"For initialization messages grant the regular scope"
|
|
91 |
|
|
92 |
self halt:'unfinished implementation'.
|
|
93 |
^super bindingOf: varName
|
8551
|
94 |
!
|
|
95 |
|
|
96 |
includesKey:aSymbol
|
|
97 |
^ self keys includes:aSymbol
|
|
98 |
|
|
99 |
"
|
|
100 |
OpenGLConstants includesKey:#GL3Bytes
|
|
101 |
"
|
|
102 |
!
|
|
103 |
|
|
104 |
keys
|
|
105 |
^ self classVarNames
|
|
106 |
|
|
107 |
"
|
|
108 |
OpenGLConstants keys
|
|
109 |
"
|
|
110 |
! !
|
|
111 |
|
|
112 |
!SharedPool class methodsFor:'printing & storing'!
|
|
113 |
|
|
114 |
displayString
|
|
115 |
"return a printed represenation - here, a reminder is appended,
|
|
116 |
that this is not a regular class"
|
|
117 |
|
|
118 |
self == SharedPool ifTrue:[
|
|
119 |
^ super displayString
|
|
120 |
].
|
|
121 |
^ self name , ' (* SharedPool *)'
|
8538
|
122 |
! !
|
|
123 |
|
|
124 |
!SharedPool class methodsFor:'queries'!
|
|
125 |
|
|
126 |
isSharedPool
|
|
127 |
^ self ~~ SharedPool
|
|
128 |
! !
|
|
129 |
|
|
130 |
!SharedPool class methodsFor:'documentation'!
|
|
131 |
|
|
132 |
version
|
9091
|
133 |
^ '$Header: /cvs/stx/stx/libbasic/SharedPool.st,v 1.4 2006-02-03 16:32:35 cg Exp $'
|
8538
|
134 |
! !
|