Papageno
An Advanced Pattern Matching Library
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
ppg_token.h
Go to the documentation of this file.
1 /* Copyright 2017 noseglasses <shinynoseglasses@gmail.com>
2  *
3  * This program is free software: you can redistribute it and/or modify
4  * it under the terms of the GNU Lesser General Public License as published by
5  * the Free Software Foundation, either version 3 of the License, or
6  * (at your option) any later version.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  */
16 
17 #ifndef PPG_TOKEN_H
18 #define PPG_TOKEN_H
19 
22 #include "ppg_action.h"
23 #include "ppg_action_flags.h"
24 #include "ppg_settings.h"
25 
28 enum {
30  // In pedantic mode, a token only matches when all
31  // inputs have been disabled after having been
32  // enabled in a way that is required by the token
33  // to match in standard mode
34 };
35 
38 typedef void * PPG_Token;
39 
47  PPG_Token token,
48  PPG_Action action);
49 
56 
69  PPG_Token token,
70  PPG_Action_Flags_Type action_flags);
71 
77 PPG_Action_Flags_Type ppg_token_get_action_flags(PPG_Token token);
78 
95  PPG_Token token,
96  PPG_Count flags);
97 
103 PPG_Count ppg_token_get_flags(PPG_Token token);
104 
107 void ppg_token_list_all_active(void);
108 
114 #define PPG_TOKENS(...) \
115  sizeof((PPG_Token[]) { __VA_ARGS__ })/sizeof(PPG_Token), \
116  (PPG_Token[]) { __VA_ARGS__ }
117 
118 #endif
Action information.
Definition: ppg_action.h:55
PPG_Token ppg_token_set_action_flags(PPG_Token token, PPG_Action_Flags_Type action_flags)
Assigns action flags to a token.
void ppg_token_list_all_active(void)
Lists all active tokens for debugging purposes.
PPG_Token ppg_token_set_flags(PPG_Token token, PPG_Count flags)
Assigns flags to a token.
PPG_Token ppg_token_set_action(PPG_Token token, PPG_Action action)
Assigns an action to a token.
PPG_Action ppg_token_get_action(PPG_Token token)
Returns the action that is associated with a token.
PPG_Action_Flags_Type ppg_token_get_action_flags(PPG_Token token)
Returns the action flags associated with a token.
void * PPG_Token
The token type.
Definition: ppg_token.h:38
PPG_Count ppg_token_get_flags(PPG_Token token)
Returns the flags associated with a token.
Enables pedantic mode for tokens.
Definition: ppg_token.h:29