From f900c8fc6ef9b7ff54f0d57d092ac6b9d175460b Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Tue, 19 Feb 2013 22:04:30 +0100 Subject: [PATCH] pharo: Provide a drop-in replacement for the ProcessVariable --- Makefile | 6 ++++-- compat_for_pharo.st | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 compat_for_pharo.st diff --git a/Makefile b/Makefile index 04cd299..16be876 100644 --- a/Makefile +++ b/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 diff --git a/compat_for_pharo.st b/compat_for_pharo.st new file mode 100644 index 0000000..9fd652a --- /dev/null +++ b/compat_for_pharo.st @@ -0,0 +1,35 @@ +Object subclass: GSTProcessVariableHolder [ + | val | + + + value: aValue [ + + val := val. + ] + + value [ + + ^ val + ] +] + +ProcessLocalVariable subclass: GSTProcessVariable [ + | dict | + + + GSTProcessVariable class >> key: aKey [ + + ^ self soleInstance key: aKey. + ] + + dict [ + + ^ dict ifNil: [dict := Dictionary new]. + ] + + key: aKey [ + + ^ self dict at: aKey ifAbsent: + [self dict at: aKey put: GSTProcessVariableHolder new]. + ] +]