Hi Eliot, Bob and Henry.

Changeset and pic attached. (If the changeset has problems, let me know, I copied from my live CS to a clean copy to share that omits my fiddling around changes. I might have missed something)

I would appreciate your advice on how to proceed from here.

The approach is modeled after what I saw in HostWindowProxy.
I have other things on my checklist to try, but this seemed the easiest approach, so I ran with it.
My first goal was to just get the darned events into the simulator, see something on the simulated transcript  and a menu to show up.

Modifications were as follows (changeset attached, btw)


EventSensor
       class side
           set class side accessor for instance var forwardVMSimulationEvents
        instance side
           add instance var forwardVMSimultioEvents
           modify processEvent:evt to forward raw events if flag is set.

StackInterpreterSimulator
      class side
         I added infrastructure to make it a Singleton
         Created a class side accesor to invoke the instance side method
       instance side.
          Added an eventQueue (SharedQueue) instance variable
          queueForwardedEvent lazy initialization takes event from EventSensor and dumps it on the eventQueue
          ioGetNextEvent  checks eventQueue and copies data from the forward event to the CArrayAccessor
                          There is commented out code I used to verify that
                          1. the argument evtBuf is a bunch of zeroes coming in
                              2. evtBuf matched the forwarded event after copy


Workspace code to launch the simulation:

            | vm |
            Transcript clear.

            EventSensor forwardVMSimulationEvents: true.
            vm := StackInterpreterSimulator newWithOptions: #(#STACKVM).
            vm openOn: '/home/wm/usr/src/smalltalk/buildCogDevelopmentImageCog.app/Contents/Resources/targets/Squeak4.5.image'.
            vm
                openAsMorph;
                run

            "EventSensor forwardVMSimulationEvents: false."

Observations:

       The events get there and the WorldMenu pops up. woot. (lower case "woot", no exclamation point. not to be confused with WOOT!!!!)
       The tildes "~" in the simulation Transcript (in the attached pic) are generated at StackInterpreterSimulator>> ioGetNextEvent
       Event processing is dog slow. Be prepared to wait 5 minutes for the menu to pop up.
       Tightly coupled.
        I don't like the modification to EventSensor.
        I don't like having to implement a Singleton--but it was saner than Smalltalk at: #StackInterpreterSimulatorLSB allInstances do:[...]
        I am unfamiliar with Smalltalk Semaphores, had I known how to do the Smalltalk equivalent of event listener I would have gone that route.
        Consumer/Producer Semaphore examples from various books I have read are all within the same process, so I cut my losses and went with the current approach.

       EventSensor>>processEvent:evt  does have the events in raw form, no need to translate before forwarding to the StackInterpreter.

       In principle, we know we CAN get the dang events into the StackIntepreter.

       How do I make this responsive and useful?


Thank you for your time

 p.s. this is fun.


cheers.

tty.