Libmacro  0.2
Libmacro is an extensible macro and hotkey library.
types.h
Go to the documentation of this file.
1 /* Libmacro - A multi-platform, extendable macro and hotkey C library
2  Copyright (C) 2013 Jonathan Pelletier, New Paradigm Software
3 
4  This library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Lesser General Public
6  License as published by the Free Software Foundation; either
7  version 2.1 of the License, or (at your option) any later version.
8 
9  This library is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  Lesser General Public License for more details.
13 
14  You should have received a copy of the GNU Lesser General Public
15  License along with this library; if not, write to the Free Software
16  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18 
23 #ifndef MCR_BASE_TYPES_H_
24 #define MCR_BASE_TYPES_H_
25 
26 #include "mcr/util/util.h"
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 struct mcr_context;
33 
34 struct mcr_IDispatcher;
35 struct mcr_IRegistry;
36 struct mcr_ISignal;
37 struct mcr_Signal;
38 struct mcr_ITrigger;
39 struct mcr_Trigger;
41 
51  *dispatchReceiver,
52  struct mcr_Signal *dispatchSignal, unsigned int mods);
64  void *receiver;
67 };
68 
74  union {
75  void *reference;
76  struct mcr_Signal *signal_pt;
77  char *string;
78  char character;
79  int integer;
80  unsigned int u_integer;
81  size_t index;
82  };
83  union {
88  };
92 };
93 
99  union {
100  void *ptr;
101  void **references;
102  struct mcr_Signal *signal_pt;
103  struct mcr_Trigger *trigger_pt;
104  char *string;
105  char character;
106  int integer;
107  unsigned int u_integer;
108  size_t index;
109  } first;
110  union {
111  void *ptr;
112  struct mcr_Signal *signal_pt;
113  struct mcr_Trigger *trigger_pt;
114  char *string;
115  char character;
116  int integer;
117  unsigned int u_integer;
118  size_t index;
119  size_t count;
120  size_t used;
121  size_t length;
122  } second;
123 };
124 
126 typedef struct mcr_Array_tag {
127  void *ptr;
128  size_t count;
129 } mcr_Array_t;
130 
132 typedef struct mcr_Map_tag {
133  struct mcr_MapElement *ptr;
134  size_t count;
135 } mcr_Map_t;
136 
138 struct mcr_BiMap {
139  struct mcr_Map_tag first;
140  struct mcr_Map_tag second;
141 };
142 
145  MCR_X = 0,
146  MCR_Y,
147  MCR_Z,
150  MCR_Y1 = MCR_X,
151  MCR_Y2 = MCR_Y,
152  MCR_Y3 = MCR_Z,
155  MCR_DIMENSION_MAX = MCR_Z,
156  MCR_DIMENSION_COUNT = MCR_DIMENSION_MAX + 1
157 };
158 
162  MCR_SET = 0,
169 };
170 
176 typedef long long mcr_SpacePosition[MCR_DIMENSION_COUNT];
178 typedef mcr_SpacePosition mcr_Dimensions;
179 
180 static MCR_INLINE void mcr_SpacePosition_zero(mcr_SpacePosition pos)
181 {
182  for (int i = MCR_DIMENSION_COUNT; i--;) {
183  pos[i] = 0;
184  }
185 }
186 
187 static MCR_INLINE void mcr_Dimensions_zero(mcr_Dimensions pos)
188 {
189  mcr_SpacePosition_zero(pos);
190 }
191 
192 #ifdef __cplusplus
193 }
194 #endif
195 
196 #endif
mcr_future
Definition: types.h:154
size_t receiver_count
Definition: types.h:91
bool(* mcr_dispatch_receive_fnc)(struct mcr_DispatchReceiver *dispatchReceiver, struct mcr_Signal *dispatchSignal, unsigned int mods)
Definition: types.h:50
mcr_SpacePosition mcr_Dimensions
Definition: types.h:178
Definition: types.h:162
mcr_dispatch_receive_fnc receive
Definition: types.h:66
struct mcr_ReceiverMapElement * recursive_receivers
Definition: types.h:87
mcr_Dimension
Definition: types.h:144
long long mcr_SpacePosition[MCR_DIMENSION_COUNT]
Definition: types.h:176
Utilities for Libmacro.
struct mcr_Map_tag mcr_Map_t
void * receiver
Definition: types.h:64
struct mcr_DispatchReceiver * receivers
Definition: types.h:85
struct mcr_Array_tag mcr_Array_t
mcr_future
Definition: types.h:149
mcr_ApplyType
Definition: types.h:160