1
0
Fork 0
Browse Source

pharo: Provide a drop-in replacement for the ProcessVariable

master
Holger Hans Peter Freyther 10 years ago
parent
commit
f900c8fc6e
  1. 6
      Makefile
  2. 35
      compat_for_pharo.st

6
Makefile

@ -5,11 +5,13 @@ GST_CONVERT = gst-convert
CONVERT_RULES = -r'Osmo.LogManager->LogManager' \
-r'(Transcript nl)->(Transcript cr)' \
-r'(thisContext parentContext)->(thisContext sender)' \
-r'(``@object backtraceOn: ``@args1)->(``@object printOn: ``@args1)'
-r'(``@object backtraceOn: ``@args1)->(``@object printOn: ``@args1)' \
-r'ProcessVariable->GSTProcessVariable'
all:
$(GST_PACKAGE) --test package.xml
convert:
$(GST_CONVERT) $(CONVERT_RULES) -F squeak -f gst LogManager.st fileout.st
$(GST_CONVERT) $(CONVERT_RULES) -F squeak -f gst \
-o fileout.st compat_for_pharo.st LogManager.st

35
compat_for_pharo.st

@ -0,0 +1,35 @@
Object subclass: GSTProcessVariableHolder [
| val |
<category: 'OsmoLogging-Pharo'>
value: aValue [
<category: 'set'>
val := val.
]
value [
<category: 'get'>
^ val
]
]
ProcessLocalVariable subclass: GSTProcessVariable [
| dict |
<category: 'OsmoLogging-Pharo'>
GSTProcessVariable class >> key: aKey [
<category: 'creation'>
^ self soleInstance key: aKey.
]
dict [
<category: 'creation'>
^ dict ifNil: [dict := Dictionary new].
]
key: aKey [
<category: 'key'>
^ self dict at: aKey ifAbsent:
[self dict at: aKey put: GSTProcessVariableHolder new].
]
]