Hi Tty!


On Thu, Jan 30, 2014 at 10:50 AM, gettimothy <gettimothy@zoho.com> wrote:
 
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)

congratulations, and *thank you*!

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

see below.
 
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.

That's just a fact of life.  The simulator is dog slow :-).

 
       Tightly coupled.
        I don't like the modification to EventSensor.

Agreed.  TO proceed, the next step would be to try and eliominate this modification.  Isn't there a way of making the change self-contaned by trying to confine the set-up of the plumbing to openAsMorph?

 
        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.

Right.

 

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

Which is fab.  Again, thanks!
 

       How do I make this responsive and useful?

Three things?  1. figure out how to do it without modifying base packages, confining changes to VMMaker.  2. ask David Lewis for write permission to the VMMaker repository.  3. commit your changed version of VMMaker, from which I can merge :-)

 
Thank you for your time

Au contraire ;-)

 p.s. this is fun.

+1
 
cheers.

tty.
--
best,
Eliot