Skip to content

Instantly share code, notes, and snippets.

@noseglasses
Last active March 21, 2018 09:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save noseglasses/abd0367a1aaf04a8f004ddbd49b5b435 to your computer and use it in GitHub Desktop.
Save noseglasses/abd0367a1aaf04a8f004ddbd49b5b435 to your computer and use it in GitHub Desktop.
Auto generated Papageno C/C++-Code
// Generated by Papageno compiler version 770e6aaaf37718d64e49c825841c78094188c222
#pragma once
//##############################################################################
// Code parsed
//##############################################################################
/*
**** .../hardware/keyboardio/avr/libraries/Kaleidoscope-Papageno/glockenspiel/predefines.gls
2
3 input type: KEYCODE
4 input type: COMPLEX_KEYCODE
5 input type: KEYPOS
6
7 action type: KEYCODE
8 action type: COMPLEX_KEYCODE
9 action type: KEYPOS
10 action type: USER_FUNCTION
11
**** .../hardware/keyboardio/avr/libraries/Model01-Firmware/Model01-Firmware.ino
488
489 default: event_timeout = $200$
490
491 action: Key_Enter <KEYCODE>
492
493 input: TestKey1 <KEYPOS> = $3, 7$
494 input: TestKey2 <KEYPOS> = $3, 8$
495
496 {TestKey1, TestKey2} : Key_Enter
497
*/
//##############################################################################
// Tree
//##############################################################################
// Token_1() [0]
// Cluster_2(TestKey1, TestKey2, ) [0] : Key_Enter
#ifdef __cplusplus
extern "C" {
#endif
#include "detail/ppg_context_detail.h"
#include "detail/ppg_token_detail.h"
#include "detail/ppg_note_detail.h"
#include "detail/ppg_chord_detail.h"
#include "detail/ppg_cluster_detail.h"
#include "detail/ppg_time_detail.h"
#include "detail/ppg_sequence_detail.h"
#include "ppg_input.h"
#include "ppg_action_flags.h"
#ifdef __cplusplus
} // end extern "C"
#endif
#include "Kaleidoscope/Papageno.h"
#ifdef PAPAGENO_PREAMBLE_HEADER
#include PAPAGENO_PREAMBLE_HEADER
#endif
#ifdef __cplusplus
extern "C" {
#endif
// C++ does not support designated initializers
//
#ifdef __cplusplus
# define __GLS_DI__(NAME)
#else
# define __GLS_DI__(NAME) .NAME =
#endif
#ifndef GLS_NUM_BITS_LEFT
#define GLS_NUM_BITS_LEFT(N_BITS) \
(N_BITS%(8*sizeof(PPG_Bitfield_Storage_Type)))
#endif
#ifndef GLS_NUM_BYTES
#define GLS_NUM_BYTES(N_BITS) \
(N_BITS/(8*sizeof(PPG_Bitfield_Storage_Type)))
#endif
#ifndef GLS_INITIAL_ABORT_TRIGGER_INPUT
#define GLS_INITIAL_ABORT_TRIGGER_INPUT (PPG_Input_Id)((uintptr_t)-1)
#endif
#ifndef GLS_INITIAL_EVENT_PROCESSOR
#define GLS_INITIAL_EVENT_PROCESSOR NULL
#endif
#ifndef GLS_INITIAL_EVENT_TIMEOUT
#define GLS_INITIAL_EVENT_TIMEOUT 200
#endif
#ifndef GLS_INITIAL_LAYER
#define GLS_INITIAL_LAYER 0
#endif
#ifndef GLS_INITIAL_LOGGING
#define GLS_INITIAL_LOGGING false
#endif
#ifndef GLS_INITIAL_LOGGING_ENABLED
#define GLS_INITIAL_LOGGING_ENABLED true
#endif
#ifndef GLS_INITIAL_PAPAGENO_ENABLED
#define GLS_INITIAL_PAPAGENO_ENABLED true
#endif
#ifndef GLS_INITIAL_SIGNAL_CALLBACK_FUNC
#define GLS_INITIAL_SIGNAL_CALLBACK_FUNC NULL
#endif
#ifndef GLS_INITIAL_SIGNAL_CALLBACK_USER_DATA
#define GLS_INITIAL_SIGNAL_CALLBACK_USER_DATA NULL
#endif
#ifndef GLS_INITIAL_TIME_COMPARISON_FUNCTION
#define GLS_INITIAL_TIME_COMPARISON_FUNCTION ppg_default_time_comparison
#endif
#ifndef GLS_INITIAL_TIME_DIFFERENCE_FUNCTION
#define GLS_INITIAL_TIME_DIFFERENCE_FUNCTION ppg_default_time_difference
#endif
#ifndef GLS_INITIAL_TIME_FUNCTION
#define GLS_INITIAL_TIME_FUNCTION ppg_default_time
#endif
#ifndef GLS_INITIAL_TIMEOUT_ENABLED
#define GLS_INITIAL_TIMEOUT_ENABLED true
#endif
//##############################################################################
// Actions
//##############################################################################
// Add a flag to enable local initialization for
// all input classes.
//
#ifdef GLS_ENABLE_ACTIONS_LOCAL_INITIALIZATION_ALL
// A flag to toggle specific initialization for type class 'COMPLEX_KEYCODE'.
//
# ifndef GLS_ENABLE_ACTIONS_LOCAL_INITIALIZATION___COMPLEX_KEYCODE
# define GLS_ENABLE_ACTIONS_LOCAL_INITIALIZATION___COMPLEX_KEYCODE
# endif
// A flag to toggle specific initialization for type class 'KEYCODE'.
//
# ifndef GLS_ENABLE_ACTIONS_LOCAL_INITIALIZATION___KEYCODE
# define GLS_ENABLE_ACTIONS_LOCAL_INITIALIZATION___KEYCODE
# endif
// A flag to toggle specific initialization for type class 'KEYPOS'.
//
# ifndef GLS_ENABLE_ACTIONS_LOCAL_INITIALIZATION___KEYPOS
# define GLS_ENABLE_ACTIONS_LOCAL_INITIALIZATION___KEYPOS
# endif
// A flag to toggle specific initialization for type class 'USER_FUNCTION'.
//
# ifndef GLS_ENABLE_ACTIONS_LOCAL_INITIALIZATION___USER_FUNCTION
# define GLS_ENABLE_ACTIONS_LOCAL_INITIALIZATION___USER_FUNCTION
# endif
#endif
// Enable the same type of initialization for all type classes
//
#ifndef GLS_ACTION_INITIALIZE
# define GLS_ACTION_INITIALIZE(ID, ...) __VA_ARGS__
#endif
// Distinguish between global and local
// initialization by type class.
//
// If no class wise initialization is desired
// we fall back to the common initialization method
//
// Tag class 'COMPLEX_KEYCODE'.
#ifndef GLS_ACTION_INITIALIZE___COMPLEX_KEYCODE
# define GLS_ACTION_INITIALIZE___COMPLEX_KEYCODE(ID, ...) \
GLS_ACTION_INITIALIZE(ID, ##__VA_ARGS__)
#endif
#ifdef GLS_ENABLE_ACTIONS_LOCAL_INITIALIZATION___COMPLEX_KEYCODE
# ifndef GLS_ACTION_INITIALIZE_LOCAL___COMPLEX_KEYCODE
# define GLS_ACTION_INITIALIZE_LOCAL___COMPLEX_KEYCODE(ID, PATH, ...) \
PATH = GLS_ACTION_INITIALIZE___COMPLEX_KEYCODE(ID, ##__VA_ARGS__);
# endif
# ifndef GLS_ACTION_INITIALIZE_GLOBAL___COMPLEX_KEYCODE
# define GLS_ACTION_INITIALIZE_GLOBAL___COMPLEX_KEYCODE(ID, ...) 0
# endif
#else
# ifndef GLS_ACTION_INITIALIZE_LOCAL___COMPLEX_KEYCODE
# define GLS_ACTION_INITIALIZE_LOCAL___COMPLEX_KEYCODE(ID, PATH, ...)
# endif
# ifndef GLS_ACTION_INITIALIZE_GLOBAL___COMPLEX_KEYCODE
# define GLS_ACTION_INITIALIZE_GLOBAL___COMPLEX_KEYCODE(ID, ...) \
GLS_ACTION_INITIALIZE___COMPLEX_KEYCODE(ID, ##__VA_ARGS__)
# endif
#endif
// Define a common entry for each type class to be used for
// local initialization.
//
#define GLS_ACTIONS_INITIALIZE_LOCAL_ALL___COMPLEX_KEYCODE \
// Tag class 'KEYCODE'.
#ifndef GLS_ACTION_INITIALIZE___KEYCODE
# define GLS_ACTION_INITIALIZE___KEYCODE(ID, ...) \
GLS_ACTION_INITIALIZE(ID, ##__VA_ARGS__)
#endif
#ifdef GLS_ENABLE_ACTIONS_LOCAL_INITIALIZATION___KEYCODE
# ifndef GLS_ACTION_INITIALIZE_LOCAL___KEYCODE
# define GLS_ACTION_INITIALIZE_LOCAL___KEYCODE(ID, PATH, ...) \
PATH = GLS_ACTION_INITIALIZE___KEYCODE(ID, ##__VA_ARGS__);
# endif
# ifndef GLS_ACTION_INITIALIZE_GLOBAL___KEYCODE
# define GLS_ACTION_INITIALIZE_GLOBAL___KEYCODE(ID, ...) 0
# endif
#else
# ifndef GLS_ACTION_INITIALIZE_LOCAL___KEYCODE
# define GLS_ACTION_INITIALIZE_LOCAL___KEYCODE(ID, PATH, ...)
# endif
# ifndef GLS_ACTION_INITIALIZE_GLOBAL___KEYCODE
# define GLS_ACTION_INITIALIZE_GLOBAL___KEYCODE(ID, ...) \
GLS_ACTION_INITIALIZE___KEYCODE(ID, ##__VA_ARGS__)
# endif
#endif
// Define a common entry for each type class to be used for
// local initialization.
//
#define GLS_ACTIONS_INITIALIZE_LOCAL_ALL___KEYCODE \
GLS_ACTION_INITIALIZE_LOCAL___KEYCODE(Key_Enter, Cluster_2.aggregate.super.action) \
// Tag class 'KEYPOS'.
#ifndef GLS_ACTION_INITIALIZE___KEYPOS
# define GLS_ACTION_INITIALIZE___KEYPOS(ID, ...) \
GLS_ACTION_INITIALIZE(ID, ##__VA_ARGS__)
#endif
#ifdef GLS_ENABLE_ACTIONS_LOCAL_INITIALIZATION___KEYPOS
# ifndef GLS_ACTION_INITIALIZE_LOCAL___KEYPOS
# define GLS_ACTION_INITIALIZE_LOCAL___KEYPOS(ID, PATH, ...) \
PATH = GLS_ACTION_INITIALIZE___KEYPOS(ID, ##__VA_ARGS__);
# endif
# ifndef GLS_ACTION_INITIALIZE_GLOBAL___KEYPOS
# define GLS_ACTION_INITIALIZE_GLOBAL___KEYPOS(ID, ...) 0
# endif
#else
# ifndef GLS_ACTION_INITIALIZE_LOCAL___KEYPOS
# define GLS_ACTION_INITIALIZE_LOCAL___KEYPOS(ID, PATH, ...)
# endif
# ifndef GLS_ACTION_INITIALIZE_GLOBAL___KEYPOS
# define GLS_ACTION_INITIALIZE_GLOBAL___KEYPOS(ID, ...) \
GLS_ACTION_INITIALIZE___KEYPOS(ID, ##__VA_ARGS__)
# endif
#endif
// Define a common entry for each type class to be used for
// local initialization.
//
#define GLS_ACTIONS_INITIALIZE_LOCAL_ALL___KEYPOS \
// Tag class 'USER_FUNCTION'.
#ifndef GLS_ACTION_INITIALIZE___USER_FUNCTION
# define GLS_ACTION_INITIALIZE___USER_FUNCTION(ID, ...) \
GLS_ACTION_INITIALIZE(ID, ##__VA_ARGS__)
#endif
#ifdef GLS_ENABLE_ACTIONS_LOCAL_INITIALIZATION___USER_FUNCTION
# ifndef GLS_ACTION_INITIALIZE_LOCAL___USER_FUNCTION
# define GLS_ACTION_INITIALIZE_LOCAL___USER_FUNCTION(ID, PATH, ...) \
PATH = GLS_ACTION_INITIALIZE___USER_FUNCTION(ID, ##__VA_ARGS__);
# endif
# ifndef GLS_ACTION_INITIALIZE_GLOBAL___USER_FUNCTION
# define GLS_ACTION_INITIALIZE_GLOBAL___USER_FUNCTION(ID, ...) 0
# endif
#else
# ifndef GLS_ACTION_INITIALIZE_LOCAL___USER_FUNCTION
# define GLS_ACTION_INITIALIZE_LOCAL___USER_FUNCTION(ID, PATH, ...)
# endif
# ifndef GLS_ACTION_INITIALIZE_GLOBAL___USER_FUNCTION
# define GLS_ACTION_INITIALIZE_GLOBAL___USER_FUNCTION(ID, ...) \
GLS_ACTION_INITIALIZE___USER_FUNCTION(ID, ##__VA_ARGS__)
# endif
#endif
// Define a common entry for each type class to be used for
// local initialization.
//
#define GLS_ACTIONS_INITIALIZE_LOCAL_ALL___USER_FUNCTION \
// Define a common entry point for local initialization
//
#define GLS_ACTIONS_INITIALIZE_LOCAL_ALL \
GLS_ACTIONS_INITIALIZE_LOCAL_ALL___COMPLEX_KEYCODE \
GLS_ACTIONS_INITIALIZE_LOCAL_ALL___KEYCODE \
GLS_ACTIONS_INITIALIZE_LOCAL_ALL___KEYPOS \
GLS_ACTIONS_INITIALIZE_LOCAL_ALL___USER_FUNCTION \
// This macro can be used to add configuration of actions at global scope.
// The default is no configuration at global scope.
//
#ifndef GLS_ACTION_CONFIGURE_GLOBAL
# define GLS_ACTION_CONFIGURE_GLOBAL(...)
#endif
// This macro can be used to add configuration of actions at global scope.
// The default is no configuration at local scope.
//
#ifndef GLS_ACTION_CONFIGURE_LOCAL
# define GLS_ACTION_CONFIGURE_LOCAL(...)
#endif
// Implement the following macro to enable specific initialization
// at global scope for type class 'COMPLEX_KEYCODE'.
//
#ifndef GLS_ACTION_CONFIGURE_GLOBAL___COMPLEX_KEYCODE
# define GLS_ACTION_CONFIGURE_GLOBAL___COMPLEX_KEYCODE(...) \
GLS_ACTION_CONFIGURE_GLOBAL(__VA_ARGS__)
#endif
// Implement the following macro to enable specific initialization
// at local scope for type class COMPLEX_KEYCODE.
//
#ifndef GLS_ACTION_CONFIGURE_LOCAL___COMPLEX_KEYCODE
# define GLS_ACTION_CONFIGURE_LOCAL___COMPLEX_KEYCODE(...) \
GLS_ACTION_CONFIGURE_LOCAL(__VA_ARGS__)
#endif
// Use this macro to perform specific initializations of actions with
// type class 'COMPLEX_KEYCODE'.
//
#define GLS_ACTIONS___COMPLEX_KEYCODE(OP) \
// Implement the following macro to enable specific initialization
// at global scope for type class 'KEYCODE'.
//
#ifndef GLS_ACTION_CONFIGURE_GLOBAL___KEYCODE
# define GLS_ACTION_CONFIGURE_GLOBAL___KEYCODE(...) \
GLS_ACTION_CONFIGURE_GLOBAL(__VA_ARGS__)
#endif
// Implement the following macro to enable specific initialization
// at local scope for type class KEYCODE.
//
#ifndef GLS_ACTION_CONFIGURE_LOCAL___KEYCODE
# define GLS_ACTION_CONFIGURE_LOCAL___KEYCODE(...) \
GLS_ACTION_CONFIGURE_LOCAL(__VA_ARGS__)
#endif
// Use this macro to perform specific initializations of actions with
// type class 'KEYCODE'.
//
#define GLS_ACTIONS___KEYCODE(OP) \
OP(Key_Enter)\
// Implement the following macro to enable specific initialization
// at global scope for type class 'KEYPOS'.
//
#ifndef GLS_ACTION_CONFIGURE_GLOBAL___KEYPOS
# define GLS_ACTION_CONFIGURE_GLOBAL___KEYPOS(...) \
GLS_ACTION_CONFIGURE_GLOBAL(__VA_ARGS__)
#endif
// Implement the following macro to enable specific initialization
// at local scope for type class KEYPOS.
//
#ifndef GLS_ACTION_CONFIGURE_LOCAL___KEYPOS
# define GLS_ACTION_CONFIGURE_LOCAL___KEYPOS(...) \
GLS_ACTION_CONFIGURE_LOCAL(__VA_ARGS__)
#endif
// Use this macro to perform specific initializations of actions with
// type class 'KEYPOS'.
//
#define GLS_ACTIONS___KEYPOS(OP) \
// Implement the following macro to enable specific initialization
// at global scope for type class 'USER_FUNCTION'.
//
#ifndef GLS_ACTION_CONFIGURE_GLOBAL___USER_FUNCTION
# define GLS_ACTION_CONFIGURE_GLOBAL___USER_FUNCTION(...) \
GLS_ACTION_CONFIGURE_GLOBAL(__VA_ARGS__)
#endif
// Implement the following macro to enable specific initialization
// at local scope for type class USER_FUNCTION.
//
#ifndef GLS_ACTION_CONFIGURE_LOCAL___USER_FUNCTION
# define GLS_ACTION_CONFIGURE_LOCAL___USER_FUNCTION(...) \
GLS_ACTION_CONFIGURE_LOCAL(__VA_ARGS__)
#endif
// Use this macro to perform specific initializations of actions with
// type class 'USER_FUNCTION'.
//
#define GLS_ACTIONS___USER_FUNCTION(OP) \
#define GLS_ACTIONS_ALL(OP) \
GLS_ACTIONS___COMPLEX_KEYCODE(OP) \
GLS_ACTIONS___KEYCODE(OP) \
GLS_ACTIONS___KEYPOS(OP) \
GLS_ACTIONS___USER_FUNCTION(OP) \
#define GLS_ACTIONS_CONFIGURE_LOCAL_ALL \
GLS_ACTIONS___COMPLEX_KEYCODE(GLS_ACTION_CONFIGURE_LOCAL___COMPLEX_KEYCODE) \
GLS_ACTIONS___KEYCODE(GLS_ACTION_CONFIGURE_LOCAL___KEYCODE) \
GLS_ACTIONS___KEYPOS(GLS_ACTION_CONFIGURE_LOCAL___KEYPOS) \
GLS_ACTIONS___USER_FUNCTION(GLS_ACTION_CONFIGURE_LOCAL___USER_FUNCTION) \
//##############################################################################
// Inputs
//##############################################################################
// Add a flag to enable local initialization for
// all input classes.
//
#ifdef GLS_ENABLE_INPUTS_LOCAL_INITIALIZATION_ALL
// A flag to toggle specific initialization for type class 'COMPLEX_KEYCODE'.
//
# ifndef GLS_ENABLE_INPUTS_LOCAL_INITIALIZATION___COMPLEX_KEYCODE
# define GLS_ENABLE_INPUTS_LOCAL_INITIALIZATION___COMPLEX_KEYCODE
# endif
// A flag to toggle specific initialization for type class 'KEYCODE'.
//
# ifndef GLS_ENABLE_INPUTS_LOCAL_INITIALIZATION___KEYCODE
# define GLS_ENABLE_INPUTS_LOCAL_INITIALIZATION___KEYCODE
# endif
// A flag to toggle specific initialization for type class 'KEYPOS'.
//
# ifndef GLS_ENABLE_INPUTS_LOCAL_INITIALIZATION___KEYPOS
# define GLS_ENABLE_INPUTS_LOCAL_INITIALIZATION___KEYPOS
# endif
#endif
// Enable the same type of initialization for all type classes
//
#ifndef GLS_INPUT_INITIALIZE
# define GLS_INPUT_INITIALIZE(ID, ...) __VA_ARGS__
#endif
// Distinguish between global and local
// initialization by type class.
//
// If no class wise initialization is desired
// we fall back to the common initialization method
//
// Tag class 'COMPLEX_KEYCODE'.
#ifndef GLS_INPUT_INITIALIZE___COMPLEX_KEYCODE
# define GLS_INPUT_INITIALIZE___COMPLEX_KEYCODE(ID, ...) \
GLS_INPUT_INITIALIZE(ID, ##__VA_ARGS__)
#endif
#ifdef GLS_ENABLE_INPUTS_LOCAL_INITIALIZATION___COMPLEX_KEYCODE
# ifndef GLS_INPUT_INITIALIZE_LOCAL___COMPLEX_KEYCODE
# define GLS_INPUT_INITIALIZE_LOCAL___COMPLEX_KEYCODE(ID, PATH, ...) \
PATH = GLS_INPUT_INITIALIZE___COMPLEX_KEYCODE(ID, ##__VA_ARGS__);
# endif
# ifndef GLS_INPUT_INITIALIZE_GLOBAL___COMPLEX_KEYCODE
# define GLS_INPUT_INITIALIZE_GLOBAL___COMPLEX_KEYCODE(ID, ...) 0
# endif
#else
# ifndef GLS_INPUT_INITIALIZE_LOCAL___COMPLEX_KEYCODE
# define GLS_INPUT_INITIALIZE_LOCAL___COMPLEX_KEYCODE(ID, PATH, ...)
# endif
# ifndef GLS_INPUT_INITIALIZE_GLOBAL___COMPLEX_KEYCODE
# define GLS_INPUT_INITIALIZE_GLOBAL___COMPLEX_KEYCODE(ID, ...) \
GLS_INPUT_INITIALIZE___COMPLEX_KEYCODE(ID, ##__VA_ARGS__)
# endif
#endif
// Define a common entry for each type class to be used for
// local initialization.
//
#define GLS_INPUTS_INITIALIZE_LOCAL_ALL___COMPLEX_KEYCODE \
// Tag class 'KEYCODE'.
#ifndef GLS_INPUT_INITIALIZE___KEYCODE
# define GLS_INPUT_INITIALIZE___KEYCODE(ID, ...) \
GLS_INPUT_INITIALIZE(ID, ##__VA_ARGS__)
#endif
#ifdef GLS_ENABLE_INPUTS_LOCAL_INITIALIZATION___KEYCODE
# ifndef GLS_INPUT_INITIALIZE_LOCAL___KEYCODE
# define GLS_INPUT_INITIALIZE_LOCAL___KEYCODE(ID, PATH, ...) \
PATH = GLS_INPUT_INITIALIZE___KEYCODE(ID, ##__VA_ARGS__);
# endif
# ifndef GLS_INPUT_INITIALIZE_GLOBAL___KEYCODE
# define GLS_INPUT_INITIALIZE_GLOBAL___KEYCODE(ID, ...) 0
# endif
#else
# ifndef GLS_INPUT_INITIALIZE_LOCAL___KEYCODE
# define GLS_INPUT_INITIALIZE_LOCAL___KEYCODE(ID, PATH, ...)
# endif
# ifndef GLS_INPUT_INITIALIZE_GLOBAL___KEYCODE
# define GLS_INPUT_INITIALIZE_GLOBAL___KEYCODE(ID, ...) \
GLS_INPUT_INITIALIZE___KEYCODE(ID, ##__VA_ARGS__)
# endif
#endif
// Define a common entry for each type class to be used for
// local initialization.
//
#define GLS_INPUTS_INITIALIZE_LOCAL_ALL___KEYCODE \
// Tag class 'KEYPOS'.
#ifndef GLS_INPUT_INITIALIZE___KEYPOS
# define GLS_INPUT_INITIALIZE___KEYPOS(ID, ...) \
GLS_INPUT_INITIALIZE(ID, ##__VA_ARGS__)
#endif
#ifdef GLS_ENABLE_INPUTS_LOCAL_INITIALIZATION___KEYPOS
# ifndef GLS_INPUT_INITIALIZE_LOCAL___KEYPOS
# define GLS_INPUT_INITIALIZE_LOCAL___KEYPOS(ID, PATH, ...) \
PATH = GLS_INPUT_INITIALIZE___KEYPOS(ID, ##__VA_ARGS__);
# endif
# ifndef GLS_INPUT_INITIALIZE_GLOBAL___KEYPOS
# define GLS_INPUT_INITIALIZE_GLOBAL___KEYPOS(ID, ...) 0
# endif
#else
# ifndef GLS_INPUT_INITIALIZE_LOCAL___KEYPOS
# define GLS_INPUT_INITIALIZE_LOCAL___KEYPOS(ID, PATH, ...)
# endif
# ifndef GLS_INPUT_INITIALIZE_GLOBAL___KEYPOS
# define GLS_INPUT_INITIALIZE_GLOBAL___KEYPOS(ID, ...) \
GLS_INPUT_INITIALIZE___KEYPOS(ID, ##__VA_ARGS__)
# endif
#endif
// Define a common entry for each type class to be used for
// local initialization.
//
#define GLS_INPUTS_INITIALIZE_LOCAL_ALL___KEYPOS \
GLS_INPUT_INITIALIZE_LOCAL___KEYPOS(TestKey1, Cluster_2.aggregate.inputs[0], 3,7) \
GLS_INPUT_INITIALIZE_LOCAL___KEYPOS(TestKey2, Cluster_2.aggregate.inputs[1], 3,8) \
// Define a common entry point for local initialization
//
#define GLS_INPUTS_INITIALIZE_LOCAL_ALL \
GLS_INPUTS_INITIALIZE_LOCAL_ALL___COMPLEX_KEYCODE \
GLS_INPUTS_INITIALIZE_LOCAL_ALL___KEYCODE \
GLS_INPUTS_INITIALIZE_LOCAL_ALL___KEYPOS \
// This macro can be used to add configuration of inputs at global scope.
// The default is no configuration at global scope.
//
#ifndef GLS_INPUT_CONFIGURE_GLOBAL
# define GLS_INPUT_CONFIGURE_GLOBAL(...)
#endif
// This macro can be used to add configuration of inputs at global scope.
// The default is no configuration at local scope.
//
#ifndef GLS_INPUT_CONFIGURE_LOCAL
# define GLS_INPUT_CONFIGURE_LOCAL(...)
#endif
// Implement the following macro to enable specific initialization
// at global scope for type class 'COMPLEX_KEYCODE'.
//
#ifndef GLS_INPUT_CONFIGURE_GLOBAL___COMPLEX_KEYCODE
# define GLS_INPUT_CONFIGURE_GLOBAL___COMPLEX_KEYCODE(...) \
GLS_INPUT_CONFIGURE_GLOBAL(__VA_ARGS__)
#endif
// Implement the following macro to enable specific initialization
// at local scope for type class COMPLEX_KEYCODE.
//
#ifndef GLS_INPUT_CONFIGURE_LOCAL___COMPLEX_KEYCODE
# define GLS_INPUT_CONFIGURE_LOCAL___COMPLEX_KEYCODE(...) \
GLS_INPUT_CONFIGURE_LOCAL(__VA_ARGS__)
#endif
// Use this macro to perform specific initializations of inputs with
// type class 'COMPLEX_KEYCODE'.
//
#define GLS_INPUTS___COMPLEX_KEYCODE(OP) \
// Implement the following macro to enable specific initialization
// at global scope for type class 'KEYCODE'.
//
#ifndef GLS_INPUT_CONFIGURE_GLOBAL___KEYCODE
# define GLS_INPUT_CONFIGURE_GLOBAL___KEYCODE(...) \
GLS_INPUT_CONFIGURE_GLOBAL(__VA_ARGS__)
#endif
// Implement the following macro to enable specific initialization
// at local scope for type class KEYCODE.
//
#ifndef GLS_INPUT_CONFIGURE_LOCAL___KEYCODE
# define GLS_INPUT_CONFIGURE_LOCAL___KEYCODE(...) \
GLS_INPUT_CONFIGURE_LOCAL(__VA_ARGS__)
#endif
// Use this macro to perform specific initializations of inputs with
// type class 'KEYCODE'.
//
#define GLS_INPUTS___KEYCODE(OP) \
// Implement the following macro to enable specific initialization
// at global scope for type class 'KEYPOS'.
//
#ifndef GLS_INPUT_CONFIGURE_GLOBAL___KEYPOS
# define GLS_INPUT_CONFIGURE_GLOBAL___KEYPOS(...) \
GLS_INPUT_CONFIGURE_GLOBAL(__VA_ARGS__)
#endif
// Implement the following macro to enable specific initialization
// at local scope for type class KEYPOS.
//
#ifndef GLS_INPUT_CONFIGURE_LOCAL___KEYPOS
# define GLS_INPUT_CONFIGURE_LOCAL___KEYPOS(...) \
GLS_INPUT_CONFIGURE_LOCAL(__VA_ARGS__)
#endif
// Use this macro to perform specific initializations of inputs with
// type class 'KEYPOS'.
//
#define GLS_INPUTS___KEYPOS(OP) \
OP(TestKey1, 3,7)\
OP(TestKey2, 3,8)\
#define GLS_INPUTS_ALL(OP) \
GLS_INPUTS___COMPLEX_KEYCODE(OP) \
GLS_INPUTS___KEYCODE(OP) \
GLS_INPUTS___KEYPOS(OP) \
#define GLS_INPUTS_CONFIGURE_LOCAL_ALL \
GLS_INPUTS___COMPLEX_KEYCODE(GLS_INPUT_CONFIGURE_LOCAL___COMPLEX_KEYCODE) \
GLS_INPUTS___KEYCODE(GLS_INPUT_CONFIGURE_LOCAL___KEYCODE) \
GLS_INPUTS___KEYPOS(GLS_INPUT_CONFIGURE_LOCAL___KEYPOS) \
//##############################################################################
// Initialization
//##############################################################################
#ifdef __cplusplus
} // end extern "C"
#endif
#ifdef GLS_GLOBAL_INITIALIZATION_INCLUDE
#include GLS_GLOBAL_INITIALIZATION_INCLUDE
#endif
#ifndef GLS_GLOBAL_INITIALIZATION
#define GLS_GLOBAL_INITIALIZATION
#endif
GLS_GLOBAL_INITIALIZATION
#ifdef __cplusplus
extern "C" {
#endif
//##############################################################################
// Inputs global configuration
//##############################################################################
// Tag class 'KEYPOS'
//
GLS_INPUTS___KEYPOS(GLS_INPUT_CONFIGURE_GLOBAL___KEYPOS)
//##############################################################################
// Actions global configuration
//##############################################################################
// Tag class 'KEYCODE'
//
GLS_ACTIONS___KEYCODE(GLS_ACTION_CONFIGURE_GLOBAL___KEYCODE)
//##############################################################################
// Token tree forward declarations
//##############################################################################
extern PPG_Token__ Token_1;
extern PPG_Cluster Cluster_2;
//##############################################################################
// Token tree
//##############################################################################
// (496:1-21)
//
PPG_Bitfield_Storage_Type Cluster_2_member_active_lasting[(GLS_NUM_BITS_LEFT(2) != 0) ? (GLS_NUM_BYTES(2) + 1) : GLS_NUM_BYTES(2)]
= { 0 };
PPG_Bitfield_Storage_Type Cluster_2_member_active[(GLS_NUM_BITS_LEFT(2) != 0) ? (GLS_NUM_BYTES(2) + 1) : GLS_NUM_BYTES(2)]
= { 0 };
PPG_Input_Id Cluster_2_inputs[2] = {
GLS_INPUT_INITIALIZE_GLOBAL___KEYPOS(TestKey1, 3,7), // TestKey1: (493:1-34)
GLS_INPUT_INITIALIZE_GLOBAL___KEYPOS(TestKey2, 3,8) // TestKey2: (494:1-34)
};
PPG_Cluster Cluster_2 = {
__GLS_DI__(aggregate) {
__GLS_DI__(super) {
__GLS_DI__(vtable) &ppg_cluster_vtable,
__GLS_DI__(parent) (PPG_Token__*)&Token_1,
__GLS_DI__(children) NULL,
__GLS_DI__(n_allocated_children) 0,
__GLS_DI__(n_children) 0,
__GLS_DI__(action) GLS_ACTION_INITIALIZE_GLOBAL___KEYCODE(Key_Enter), // Key_Enter: (491:1-28)
__GLS_DI__(misc) {
__GLS_DI__(state) PPG_Token_Initialized,
__GLS_DI__(flags) 0,
__GLS_DI__(action_state) 0,
__GLS_DI__(action_flags) PPG_Action_Default
},
__GLS_DI__(layer) 0
},
__GLS_DI__(n_members) 2,
__GLS_DI__(inputs) Cluster_2_inputs,
__GLS_DI__(member_active) {
__GLS_DI__(bitarray) Cluster_2_member_active,
__GLS_DI__(n_bits) 2
},
__GLS_DI__(n_inputs_active) 0
},
__GLS_DI__(member_active_lasting) {
__GLS_DI__(bitarray) Cluster_2_member_active_lasting,
__GLS_DI__(n_bits) 2
},
__GLS_DI__(n_lasting) 0
};
//
//
PPG_Token__ *Token_1_children[1] = {
(PPG_Token__*)&Cluster_2
};
PPG_Token__ Token_1 = {
__GLS_DI__(vtable) &ppg_token_vtable,
__GLS_DI__(parent) NULL,
__GLS_DI__(children) Token_1_children,
__GLS_DI__(n_allocated_children) sizeof(Token_1_children)/sizeof(PPG_Token__*),
__GLS_DI__(n_children) sizeof(Token_1_children)/sizeof(PPG_Token__*),
__GLS_DI__(action) {
__GLS_DI__(callback) (PPG_Action_Callback) {
__GLS_DI__(func) NULL,
__GLS_DI__(user_data) NULL
}
},
__GLS_DI__(misc) {
__GLS_DI__(state) PPG_Token_Initialized,
__GLS_DI__(flags) 0,
__GLS_DI__(action_state) 0,
__GLS_DI__(action_flags) PPG_Action_Default
},
__GLS_DI__(layer) 0
};
//##############################################################################
// Context
//##############################################################################
PPG_Event_Queue_Entry event_buffer[4] = {
{{0, 0, 0}, 0, {0, 0}},
{{0, 0, 0}, 0, {0, 0}},
{{0, 0, 0}, 0, {0, 0}},
{{0, 0, 0}, 0, {0, 0}}
};
PPG_Furcation furcations[2] = {
{0, 0, 0, 0},
{0, 0, 0, 0}
};
PPG_Token__ *tokens[2] = {
NULL,
NULL
};
PPG_Context context = {
__GLS_DI__(event_buffer) {
__GLS_DI__(events) event_buffer,
__GLS_DI__(start) 0,
__GLS_DI__(end) 0,
__GLS_DI__(cur) 0,
__GLS_DI__(size) 0,
__GLS_DI__(max_size) 4
},
__GLS_DI__(furcation_stack) {
__GLS_DI__(furcations) furcations,
__GLS_DI__(n_furcations) 0,
__GLS_DI__(cur_furcation) 0,
__GLS_DI__(max_furcations) 2
},
__GLS_DI__(active_tokens) {
__GLS_DI__(tokens) tokens,
__GLS_DI__(n_tokens) 0,
__GLS_DI__(max_tokens) 2
},
__GLS_DI__(pattern_root) &Token_1,
__GLS_DI__(current_token) NULL,
__GLS_DI__(properties) {
__GLS_DI__(timeout_enabled) GLS_INITIAL_TIMEOUT_ENABLED,
__GLS_DI__(papageno_enabled) GLS_INITIAL_PAPAGENO_ENABLED,
# if PPG_HAVE_LOGGING
__GLS_DI__(logging_enabled) GLS_INITIAL_LOGGING_ENABLED,
# endif
__GLS_DI__(destruction_enabled) false
},
__GLS_DI__(tree_depth) 2,
__GLS_DI__(layer) GLS_INITIAL_LAYER,
__GLS_DI__(abort_trigger_input) GLS_INITIAL_ABORT_TRIGGER_INPUT,
__GLS_DI__(time_last_event) 0,
__GLS_DI__(event_timeout) GLS_INITIAL_EVENT_TIMEOUT,
__GLS_DI__(event_processor) GLS_INITIAL_EVENT_PROCESSOR,
__GLS_DI__(time_manager) {
__GLS_DI__(time) &GLS_INITIAL_TIME_FUNCTION,
__GLS_DI__(time_difference) &GLS_INITIAL_TIME_DIFFERENCE_FUNCTION,
__GLS_DI__(compare_times) &GLS_INITIAL_TIME_COMPARISON_FUNCTION
},
__GLS_DI__(signal_callback) {
__GLS_DI__(func) GLS_INITIAL_SIGNAL_CALLBACK_FUNC,
__GLS_DI__(user_data) GLS_INITIAL_SIGNAL_CALLBACK_USER_DATA
}
# if PPG_HAVE_STATISTICS
,
__GLS_DI__(statistics) {
__GLS_DI__(n_nodes_visited) 0,
__GLS_DI__(n_token_checks) 0,
__GLS_DI__(n_furcations) 0,
__GLS_DI__(n_reversions) 0
}
# endif
};
//##############################################################################
// Initialization
//##############################################################################
#define GLS_LOCAL_INITIALIZATION \
/* Configuration of all actions. \
*/ \
GLS_ACTIONS_CONFIGURE_LOCAL_ALL \
\
/* Configuration of all inputs. \
*/ \
GLS_INPUTS_CONFIGURE_LOCAL_ALL \
\
/* Local initialization of actions.\
*/ \
GLS_ACTIONS_INITIALIZE_LOCAL_ALL \
\
/* Local initialization of inputs. \
*/ \
GLS_INPUTS_INITIALIZE_LOCAL_ALL
void papageno_initialize_context()
{
# ifndef GLS_NO_AUTOMATIC_LOCAL_INITIALIZATION
GLS_LOCAL_INITIALIZATION
# endif
ppg_context = &context;
}
#ifdef __cplusplus
} // end extern "C"
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment