To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcx.nqcOpen lugnet.robotics.rcx.nqc in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / NQC / 887
886  |  888
Subject: 
Re: Event dispatch
Newsgroups: 
lugnet.robotics.rcx.nqc
Date: 
Mon, 18 Dec 2000 07:09:23 GMT
Viewed: 
2149 times
  
In lugnet.robotics.rcx.nqc, Dave Baum writes:
ActiveEvents(n) can be used to determine the event that triggered a
catch where n is the task number (main is always 0).

Meanwhile I found this out too.

TLG added a
special variation - ActiveEvents(10) - that returns the event triggered
for the currently running task (only valid for recent versions of the
RCX2 firmware - 0328 should be fine).  I've already added a more
convenient call in the API, which should appear in the next NQC release:

  #define CurrentEvents() ActiveEvents(10)

That lets you do something like this

monitor(EVENT_MASK(1) | EVENT_MASK(2))
{

}
catch
{
if (CurrentEvents() & EVENT_MASK(1))
{
}
else
{
}
}



I think I never would have found this feature.

At some point (now that ActiveEvents(10) is possible) I'll probably add
multiple catch clauses into the compiler...

monitor(EVENT_MASK(1) | EVENT_MASK(2))
{
}
catch (EVENT_MASK(1))
{
// when event 1 is triggered
}
catch
{
// any other events
}



I like the new features in 2.3a1! (I'll try them tonight).


TZS



Message is in Reply To:
  Re: Event dispatch
 
(...) I think the choice of whether to have a single task waiting on multiple events or multiple tasks each servicing a single event depends on the following questions: 1) Is there a single activity that should be happening that gets interrupted by (...) (24 years ago, 17-Dec-00, to lugnet.robotics.rcx.nqc)

3 Messages in This Thread:

Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR