Difference between revisions of "Manual:DIL Manual/interrupt()"
Jump to navigation
Jump to search
(XML import) |
(XML import) |
||
| Line 1: | Line 1: | ||
| − | |||
| − | |||
<span id="bpinterr"></span> | <span id="bpinterr"></span> | ||
integer interrupt( flags : integer, dilexp, label ) | integer interrupt( flags : integer, dilexp, label ) | ||
| Line 38: | Line 36: | ||
code | code | ||
| − | + | dilend</nowiki> | |
| − | + | ||
| − | + | ---~---~---~---~---~---~---~---~--- | |
| − | + | <span id="bpinterr"></span> | |
| − | + | integer interrupt( flags : integer, dilexp, label ) | |
| + | |||
| + | Set up interrupt matching message classes matching "flags", | ||
| + | for example "SFB_COM" or "SFB_COM | SFB_MSG". | ||
| + | |||
| + | When the program is activated on either of the specified conditions | ||
| + | the 'dilexp' is evaluated. If true, then execution continues at 'label', | ||
| + | otherwise the next interrupt is checked (if any). | ||
| + | |||
| + | Interrupts are saved (restored), when 'recall' is set. | ||
| + | Returns an integer which is used for clear() to clear an interrupt. | ||
| + | |||
| + | '''Example:''' | ||
| − | + | The following program shows, that the owner (self) of the program keeps | |
| + | snoring while sleeping. The on_activation ensures that the program | ||
| + | is only activated when the owner is sleeping. However, since the interrupt | ||
| + | precede the on_activation, these may still be intercepted before the | ||
| + | on_activation. The on_activation is just another type of interrupt that | ||
| + | reacts on all flags (without actually setting them so that the program | ||
| + | is activated). | ||
| − | + | When the program receives the message "relief" the snoring stops briefly. | |
| + | As used, "relief" may only be set once. | ||
| − | + | When the program receives the message "cured", the snoring stops completely | |
| + | (i.e. the program quits itself). | ||
| + | |||
| + | <nowiki> | ||
| − | + | dilbegin | |
| − | |||
| − | |||
| − | |||
| − | : | + | var |
| − | + | i : integer; | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | + | code | |
| − | + | dilend</nowiki> | |
| − | |||
| − | |||
| − | |||
---~---~---~---~---~---~---~---~--- | ---~---~---~---~---~---~---~---~--- | ||
Latest revision as of 22:30, 4 December 2025
integer interrupt( flags : integer, dilexp, label )
Set up interrupt matching message classes matching "flags", for example "SFB_COM" or "SFB_COM | SFB_MSG".
When the program is activated on either of the specified conditions the 'dilexp' is evaluated. If true, then execution continues at 'label', otherwise the next interrupt is checked (if any).
Interrupts are saved (restored), when 'recall' is set. Returns an integer which is used for clear() to clear an interrupt.
Example:
The following program shows, that the owner (self) of the program keeps snoring while sleeping. The on_activation ensures that the program is only activated when the owner is sleeping. However, since the interrupt precede the on_activation, these may still be intercepted before the on_activation. The on_activation is just another type of interrupt that reacts on all flags (without actually setting them so that the program is activated).
When the program receives the message "relief" the snoring stops briefly. As used, "relief" may only be set once.
When the program receives the message "cured", the snoring stops completely (i.e. the program quits itself).
dilbegin
var
i : integer;
code
dilend
---~---~---~---~---~---~---~---~---
integer interrupt( flags : integer, dilexp, label )
Set up interrupt matching message classes matching "flags", for example "SFB_COM" or "SFB_COM | SFB_MSG".
When the program is activated on either of the specified conditions the 'dilexp' is evaluated. If true, then execution continues at 'label', otherwise the next interrupt is checked (if any).
Interrupts are saved (restored), when 'recall' is set. Returns an integer which is used for clear() to clear an interrupt.
Example:
The following program shows, that the owner (self) of the program keeps snoring while sleeping. The on_activation ensures that the program is only activated when the owner is sleeping. However, since the interrupt precede the on_activation, these may still be intercepted before the on_activation. The on_activation is just another type of interrupt that reacts on all flags (without actually setting them so that the program is activated).
When the program receives the message "relief" the snoring stops briefly. As used, "relief" may only be set once.
When the program receives the message "cured", the snoring stops completely (i.e. the program quits itself).
dilbegin
var
i : integer;
code
dilend
---~---~---~---~---~---~---~---~---