Papageno
An Advanced Pattern Matching Library
|
#include "ppg_input.h"
#include "ppg_time.h"
#include "ppg_event.h"
#include "ppg_layer.h"
#include "ppg_signal_callback.h"
#include <stdbool.h>
#include <inttypes.h>
Go to the source code of this file.
Functions | |
PPG_Input_Id | ppg_global_set_abort_trigger (PPG_Input_Id input) |
Defines an input that aborts current pattern processing. More... | |
PPG_Input_Id | ppg_global_get_abort_trigger (void) |
Retreives the current abort input. More... | |
void | ppg_global_abort_pattern_matching (void) |
Aborts processing of the current pattern. | |
PPG_Time | ppg_global_set_timeout (PPG_Time timeout) |
Set the current timeout for pattern processing. More... | |
PPG_Time | ppg_global_get_timeout (void) |
Returns the current timeout value. More... | |
PPG_Event_Processor_Fun | ppg_global_set_default_event_processor (PPG_Event_Processor_Fun event_processor) |
Defines the default input processor callback. More... | |
bool | ppg_global_set_enabled (bool state) |
Use this function to temporarily disable/enable pattern processing. More... | |
void | ppg_global_init (void) |
Initialize Papageno. | |
void | ppg_global_compile (void) |
Compiles the Papageno pattern tree. | |
void | ppg_global_finalize (void) |
Finalizes Papageno, i.e. clears all patterns and frees all allocated memory. More... | |
void | ppg_global_reset (void) |
Resets papageno to initial state. More... | |
bool | ppg_timeout_check (void) |
The timeout check function. More... | |
bool | ppg_global_set_timeout_enabled (bool state) |
Toggles global timeout. More... | |
bool | ppg_global_get_timeout_enabled (void) |
Determines if global timeout is enabled. More... | |
PPG_Layer | ppg_global_set_layer (PPG_Layer layer) |
Set the current layer. More... | |
PPG_Layer | ppg_global_get_layer (void) |
Retreives the currently active layer. More... | |
PPG_Signal_Callback | ppg_global_set_signal_callback (PPG_Signal_Callback callback) |
Set a callback that is used to signal specific events. More... | |
PPG_Signal_Callback | ppg_global_get_signal_callback (void) |
Get the current signal callback. More... | |
void ppg_global_finalize | ( | void | ) |
Finalizes Papageno, i.e. clears all patterns and frees all allocated memory.
Please not that this operation only operates on the current context. It you have created several contexts, set and finalize them in a loop.
PPG_Input_Id ppg_global_get_abort_trigger | ( | void | ) |
Retreives the current abort input.
See ppg_global_set_abort_trigger for further information.
PPG_Layer ppg_global_get_layer | ( | void | ) |
Retreives the currently active layer.
PPG_Signal_Callback ppg_global_get_signal_callback | ( | void | ) |
Get the current signal callback.
PPG_Time ppg_global_get_timeout | ( | void | ) |
Returns the current timeout value.
bool ppg_global_get_timeout_enabled | ( | void | ) |
Determines if global timeout is enabled.
void ppg_global_reset | ( | void | ) |
Resets papageno to initial state.
This creates and initializes a new context. Other contexts are not affected. The currently active context is finalized before the reset operation takes place.
PPG_Input_Id ppg_global_set_abort_trigger | ( | PPG_Input_Id | input | ) |
Defines an input that aborts current pattern processing.
If pattern processing is aborted the actions of tokens that already matched are triggered.
input | The abort input |
PPG_Event_Processor_Fun ppg_global_set_default_event_processor | ( | PPG_Event_Processor_Fun | event_processor | ) |
Defines the default input processor callback.
Some functions, e.g. ppg_event_buffer_iterate can be supplied with a custom input processor. If non is specified the default one is used if defined.
event_processor | The default input processor callback |
bool ppg_global_set_enabled | ( | bool | state | ) |
Use this function to temporarily disable/enable pattern processing.
Processing is enabled by default.
state | The new state. Enables if true, disables if false. |
PPG_Layer ppg_global_set_layer | ( | PPG_Layer | layer | ) |
Set the current layer.
PPG_Signal_Callback ppg_global_set_signal_callback | ( | PPG_Signal_Callback | callback | ) |
Set a callback that is used to signal specific events.
callback | The signal callback |
PPG_Time ppg_global_set_timeout | ( | PPG_Time | timeout | ) |
Set the current timeout for pattern processing.
If no input events are encountered within the timeout interval after the last input event, pattern processing is aborted and actions are processed recursively starting with the last token that matched.
timeout | The timeout time value |
bool ppg_global_set_timeout_enabled | ( | bool | state | ) |
Toggles global timeout.
state | The current timeout state |
bool ppg_timeout_check | ( | void | ) |
The timeout check function.
This timeout check function should be called frequently in a loop, e.g. when polling input presses