From aae4422d2f58dd90cf2554cbeae49347a15878e3 Mon Sep 17 00:00:00 2001 From: Gabriel Omar Cotelli Date: Thu, 21 Nov 2024 09:46:44 -0300 Subject: [PATCH] Add LanguagePlatform messages for GS64 --- .../GemStone64Platform.class.st | 61 +++++++++++++------ 1 file changed, 41 insertions(+), 20 deletions(-) diff --git a/source/Buoy-Metaprogramming-GS64-Extensions/GemStone64Platform.class.st b/source/Buoy-Metaprogramming-GS64-Extensions/GemStone64Platform.class.st index d81f656..d6de32f 100644 --- a/source/Buoy-Metaprogramming-GS64-Extensions/GemStone64Platform.class.st +++ b/source/Buoy-Metaprogramming-GS64-Extensions/GemStone64Platform.class.st @@ -1,35 +1,35 @@ Class { - #name : 'GemStone64Platform', - #superclass : 'LanguagePlatform', - #category : 'Buoy-Metaprogramming-GS64-Extensions', - #package : 'Buoy-Metaprogramming-GS64-Extensions' + #name : 'GemStone64Platform', + #superclass : 'LanguagePlatform', + #category : 'Buoy-Metaprogramming-GS64-Extensions', + #package : 'Buoy-Metaprogramming-GS64-Extensions' } { #category : 'class initialization' } GemStone64Platform class >> initialize [ - LanguagePlatform setCurrentTo: self new + LanguagePlatform setCurrentTo: self new ] { #category : 'reflection' } GemStone64Platform >> atInstanceVariableNamed: name on: object put: value [ - | index | - index := (object class allInstVarNames collect: #asSymbol) - indexOf: name asSymbol - ifAbsent: [ self error: ('<1s> not found in <2p>' expandMacrosWith: name asString with: object) ]. - object instVarAt: index put: value + | index | + index := (object class allInstVarNames collect: #asSymbol) + indexOf: name asSymbol + ifAbsent: [ self error: ('<1s> not found in <2p>' expandMacrosWith: name asString with: object) ]. + object instVarAt: index put: value ] { #category : 'process scheduling' } GemStone64Platform >> fork: block named: processName at: priority [ - | process | - process := self newProcessNamed: processName evaluating: block at: priority. - process resume. - Processor yield. - ^process + | process | + process := self newProcessNamed: processName evaluating: block at: priority. + process resume. + Processor yield. + ^process ] { #category : 'process scheduling' } @@ -45,15 +45,28 @@ GemStone64Platform >> newProcessNamed: processName evaluating: block at: priorit { #category : 'reflection' } GemStone64Platform >> globalNamed: aSymbol ifAbsent: absentBlock [ - ^ (GsCurrentSession currentSession symbolList objectNamed: aSymbol) - ifNil: absentBlock + ^ (GsCurrentSession currentSession objectNamed: aSymbol) + ifNil: absentBlock +] + +{ #category : 'reflection' } +GemStone64Platform >> globalNamed: symbol ifAbsentPut: block [ + + ^ (GsCurrentSession currentSession objectNamed: aSymbol) + ifNil: [ + | object | + object := block value. + (GsCurrentSession currentSession objectNamed: #Globals) + at: aSymbol put: object. + object + ] ] { #category : 'reflection' } GemStone64Platform >> includesGlobalNamed: aSymbol [ - ^ (GsCurrentSession currentSession symbolList objectNamed: aSymbol) - notNil + ^ (GsCurrentSession currentSession objectNamed: aSymbol) + notNil ] { #category : 'message digest' } @@ -65,5 +78,13 @@ GemStone64Platform >> messageDigest: string [ { #category : 'accessing' } GemStone64Platform >> os [ - ^ GemStone64UnixPlatform current + ^ GemStone64UnixPlatform current +] + +{ #category : 'reflection' } +GemStone64Platform >> removeGlobalNamed: aSymbol ifAbsent: absentBlock [ + + | globals | + globals := GsCurrentSession currentSession objectNamed: #Globals. + ^ globals removeKey: aSymbol ifAbsent: absentBlock ]