71
TIDE and Tibbo BASIC User Manual
©2000-2008 Tibbo Technology Inc.
However, note that in the example above we also have procedure C (which is
called by procedure B). This procedure can be shared by everyone -- because it is
later on the chain than the procedure which contains the doevents statement.
Doevents for Events of The Same Type
For some events, only one instance of the event may be present in the queue at
any given time. The next event of the same kind may only be generated after the
current one has completed processing. For other events, multiple instances in the
queue are allowed.
Let us say that for event_1, multiple instances are allowed, and that this event's
handler contains a doevents statement. When this statement executes, it may
happen that another instance of event_1 will be found on the queue, waiting to be
processed. If this happens, this new instance will just be skipped -- execution will
move on to the next event on the queue. Otherwise, we would once again get
recursion (execution of an event handler while a previous instance of this event
handler is already executing), which is not allowed under Tibbo Basic.
Using Preprocessor
Tibbo Basic compiler includes a preprocessor that understands several directives.
#define and #undef
The #define directive assigns a replacement token for an identifier. Before
compilation, each occurrence of this identifier will be replaced with the token, for
example:
#define ABC x(5)
'now ABC will imply 'x(5)'
ABC=20
'now it is the same as writing x(5)=20
The #undef directive "destroys" the definition made earlier with #define :
#define ABC x(5)
'define
...
#undef ABC
'destroy
...
ABC=20
'you will get a compilation error on this line (compiler will try
to process this as "=20")