% \insert 'NewPortObjectDebug.oz' % did this for testing \insert 'NewPortObject.oz' declare % We represent a Gauge as a Port Object fun {NewGauge} {NewPortObject % used NewPortObjectDebug during testing %% The state is an , initially 0 0 fun {$ Val Msg} case Msg of up then Val+1 [] down then Val-1 [] getValue(?Var) then Var = Val Val end end } end % ArraySet: }> proc {GaugeUp Gauge} {Send Gauge up} end % ArraySet: }> proc {GaugeDown Gauge} {Send Gauge down} end % ArrayGet: }: > fun {GaugeValue Gauge} {Send Gauge getValue($)} end