Kyma Forum
  Kyma Support
  A little Smalltalk debugging help needed

Post New Topic  Post A Reply
profile | register | preferences | faq | search

next newest topic | next oldest topic
Author Topic:   A little Smalltalk debugging help needed
KevinCole
Member
posted 06 December 2004 15:24         Edit/Delete Message   Reply w/Quote
Hi. I have a Smalltalk tool where I've tried to set up a "Pause" state two different ways. With the Debug global variable set true, I see that I enter each state as I would expect, but then immediately leave. (I tried first with only a trigger to exit the state, then tried again by adding a polling do-nothing loop, without success.) Here are the two states below (hoping that this forum doesn't reformat them):

____________________________________________________________________________

Global Variable:
StopWatch (integer, initially 0, no step when updated)
____________________________________________________________________________

State: Pause1
Local Variable: ticker (integer, initially 0,
tried both with step and no step on update)

onEntry ==>
"Start Stopwatch"
StopWatch := Time millisecondClockValue.
ticker := 0.
[ticker < (StopWatch + 9000)] whileTrue: [
ticker := Time millisecondClockValue.
].

(StopWatch + 9000) < Time millisecondClockValue ==>
"Continue to Interval1"
#Interval1.
____________________________________________________________________________

State: Pause2
Local Variable: ticker (integer, initially 0,
tried both with step and no step on update)

onEntry ==>
"Start Stopwatch"
StopWatch := Time millisecondClockValue.
ticker := Time millisecondClockValue.

ticker < (StopWatch + 9000) ==>
ticker := Time millisecondClockValue.

(StopWatch + 9000) < Time millisecondClockValue ==>
"Continue to Interval2"
#Interval2.
____________________________________________________________________________

IP: Logged

SSC
Administrator
posted 07 December 2004 10:38         Edit/Delete Message   Reply w/Quote
Could you please upload (or email) a copy of the tool to us? This would help us debug it.

From what you have posted, it appears that second version ought to work.

IP: Logged

KevinCole
Member
posted 07 December 2004 13:46         Edit/Delete Message   Reply w/Quote

Pause.pci

 
quote:
Originally posted by SSC:
Could you please upload (or email) a copy of the tool to us? This would help us debug it.

From what you have posted, it appears that second version ought to work.


OK, the attached file is a stripped-down example of the problem. It should flip between two "Interval" states with 9 second (9000 ms) "Pause" states between them. I've used both methods described in the first post above. (NOTE: It runs ad infinitum, flipping back and forth til you close it.)

[This message has been edited by KevinCole (edited 07 December 2004).]

IP: Logged

SSC
Administrator
posted 08 December 2004 14:04         Edit/Delete Message   Reply w/Quote

Pause.zip

 
The logic for both types of pause states was correct. The problem was that the onEntry triggered response was not first in the list. If you plan to use onEntry or onExit triggered response, they should be the first ones in the list.

I have correct this and simplified your tool slightly. This version has been zipped and attached to this response.

IP: Logged

All times are CT (US)

next newest topic | next oldest topic

Administrative Options: Close Topic | Archive/Move | Delete Topic
Post New Topic  Post A Reply

Contact Us | Symbolic Sound Home

This forum is provided solely for the support and edification of the customers of Symbolic Sound Corporation.


Ultimate Bulletin Board 5.45c