| iMatix home page
| Libero home page | Libero documentation
| << | < | > | >>
Libero Libero
Version 2.32

The State Machine Algorithm

This is the dialog manager logic as pseudo-code. If you need to write a schema for a new language, this section should be your main specifications.

The dialog manager consists of a basic loop, plus extra pieces that are generated only if necessary. For example, handling of the Defaults state, error checking, and handling of the dialog stack. For clarity, I've put in the Defaults handling, but nothing else other than the basic loop. The following code is loosely based on C:

    _LR_state = 0                       //  First state is always zero
    initialise_the_program ()
    while (the_next_event != terminate_event) {
        _LR_event  = the_next_event
        _LR_savest = _LR_state
        _LR_index  = _LR_action [_LR_state][_LR_event]

        if (_LR_index == 0) {           //  Try Defaults state
            _LR_state = _LR_defaults_state
            _LR_index = _LR_action [_LR_state][_LR_event]
        }
        the_exception_event = _LR_NULL_EVENT
        exception_raised    = FALSE

        Get first module in list
        for ever {
            if (we finished the module list OR exception_raised)
                break
            Execute next module in list
        }
        if (exception_raised) {
            if (the_exception_event != _LR_NULL_EVENT)
                _LR_event = the_exception_event
            the_next_event = _LR_event
        } else
            _LR_state = _LR_nextst [_LR_state][_LR_event]

        if (_LR_state == _LR_defaults_state)
            _LR_state = _LR_savest
        if (the_next_event == _LR_NULL_EVENT)
            get_external_event ()
    }
    return (feedback)

| << | < | > | >>
| Libero Technical Reference | Read-Only Variables | Schema Commands | Syntax Of Expressions | Syntax Of Logical Conditions | Control Variables | Standard :do Conditions | Extra Variables In A :do Loop | General Rules for Code Generation | Generating Module Stubs | Generating COBOL Code | The State Machine Algorithm | Compiled-In Limitations | Quick Reference - Libero Schema Language
iMatix
Copyright © 1996-97 iMatix