fldefs.h 22.4 KB
Newer Older
thomas's avatar
thomas committed
1
2
3
4
5
6
7
8
9
10
/* 

flext - C++ layer for Max/MSP and pd (pure data) externals

Copyright (c) 2001,2002 Thomas Grill (xovo@gmx.net)
For information on usage and redistribution, and for a DISCLAIMER OF ALL
WARRANTIES, see the file, "license.txt," in this distribution.  

*/

thomas's avatar
thomas committed
11
/*! \file fldefs.h
thomas's avatar
thomas committed
12
    \brief This file contains all #defines for actual usage
thomas's avatar
thomas committed
13
14
    
*/
thomas's avatar
thomas committed
15

thomas's avatar
thomas committed
16
17
#ifndef __FLEXT_DEFS_H
#define __FLEXT_DEFS_H
thomas's avatar
thomas committed
18

thomas's avatar
thomas committed
19
20
21
22
23
#ifdef FLEXT_GUI
#define FLEXT_CAST dynamic_cast
#else
#define FLEXT_CAST static_cast
#endif
thomas's avatar
thomas committed
24

thomas's avatar
thomas committed
25
26
27
/*!	\defgroup FLEXT_HEADER Flext class header
	One (and only one!) of these definitions is compulsary for the class declaration. 
	It has to be placed somewhere in the class definition (not necessarily in a public section).
thomas's avatar
thomas committed
28

thomas's avatar
thomas committed
29
	@{ 
thomas's avatar
thomas committed
30
31
*/

thomas's avatar
thomas committed
32
33
34
35
36
37
38
39
40
41
42
/*! \brief Plain flext class header
	\param NEW_CLASS name of the current C++ class
	\param PARENT_CLASS name of the base C++ class (e.g. flext_base or flext_dsp)
*/
#define FLEXT_HEADER(NEW_CLASS,PARENT_CLASS) \
\
FLEXT_REALHDR(NEW_CLASS, PARENT_CLASS)    	    	

/*! \brief Flext class header with setup function
	\param NEW_CLASS name of the current C++ class
	\param PARENT_CLASS name of the base C++ class (e.g. flext_base or flext_dsp)
thomas's avatar
thomas committed
43
	\param SETUPFUN setup function, of type "void (*setupfn)(t_class *)"
thomas's avatar
thomas committed
44
45

	The setup function is called after class creation. It corresponds to the
thomas's avatar
thomas committed
46
	original "object_setup" function, apart from the
thomas's avatar
thomas committed
47
48
	fact that all necessary class initializations have already been taken care by flext. 
	The setup function can e.g. be used for a message to the console upon first creation of an object.
thomas's avatar
thomas committed
49
	The object's t_class* data can be accessed by the static function thisClass()
thomas's avatar
thomas committed
50
51
52
53
*/
#define FLEXT_HEADER_S(NEW_CLASS, PARENT_CLASS, SETUPFUN)\
\
FLEXT_REALHDR_S(NEW_CLASS, PARENT_CLASS, SETUPFUN)    	    	
thomas's avatar
thomas committed
54

thomas's avatar
thomas committed
55

thomas's avatar
thomas committed
56
//! @} 
thomas's avatar
thomas committed
57
58
59
60
61



// ====================================================================================

thomas's avatar
thomas committed
62
63
64
/*!	\defgroup FLEXT_NEW Flext class instantiation
	Makes an actual instance of a class.
*/
thomas's avatar
thomas committed
65

thomas's avatar
thomas committed
66
67
/*!	\defgroup FLEXT_NEW_DSP Flext dsp class instantiation
	Makes an actual instance of a dsp (aka "tilde") class (with signal processing).
thomas's avatar
thomas committed
68
69
*/

thomas's avatar
thomas committed
70
71
72
/*!	\defgroup FLEXT_LIB Flext library class instantiation
	Makes an actual instance of a class	which is part of an object library (and not stand-alone).
*/
thomas's avatar
thomas committed
73

thomas's avatar
thomas committed
74
75
76
/*!	\defgroup FLEXT_LIB_DSP Flext dsp library class instantiation
	Makes an actual instance of a dsp (aka "tilde") class with signal processing
	which is part of an object library (and not stand-alone).
thomas's avatar
thomas committed
77
78
*/

thomas's avatar
thomas committed
79

thomas's avatar
thomas committed
80
81
82
// NO ARGUMENTS
// ----------------------------------------

thomas's avatar
thomas committed
83
84
85
86
87
/*! Implementation of a flext class with no arguments
	\ingroup FLEXT_NEW
	\param NAME the object's actual name(s) as a string (like "*", "trigger", "noise~", etc.)
	\param NEW_CLASS the object's C++ class name 
*/
thomas's avatar
thomas committed
88
#define FLEXT_NEW(NAME,NEW_CLASS)		\
thomas's avatar
thomas committed
89
REAL_NEW(NAME,NEW_CLASS,0,0)  \
thomas's avatar
thomas committed
90
REAL_EXT(NEW_CLASS,0)
thomas's avatar
thomas committed
91

thomas's avatar
thomas committed
92
93
94
/*! Implementation of a flext dsp class with no arguments
	\ingroup FLEXT_NEW_DSP
*/
thomas's avatar
thomas committed
95
#define FLEXT_NEW_DSP(NAME,NEW_CLASS)	\
thomas's avatar
thomas committed
96
REAL_NEW(NAME,NEW_CLASS,1,0) \
thomas's avatar
thomas committed
97
REAL_EXT(NEW_CLASS,1)
thomas's avatar
thomas committed
98

thomas's avatar
thomas committed
99
100
101
102
/*! Implementation of a flext GUI class with no arguments
	\ingroup FLEXT_NEW_GUI
*/
#define FLEXT_NEW_GUI(NAME,NEW_CLASS)	\
thomas's avatar
thomas committed
103
REAL_NEW(NAME,NEW_CLASS,2,0) \
thomas's avatar
thomas committed
104
105
REAL_EXT(NEW_CLASS, 2)

thomas's avatar
thomas committed
106
107
108
/*! Implementation of a flext class (part of a library) with no arguments
	\ingroup FLEXT_LIB
*/
thomas's avatar
thomas committed
109
#define FLEXT_LIB(NAME,NEW_CLASS) \
thomas's avatar
thomas committed
110
\
thomas's avatar
thomas committed
111
REAL_NEW(NAME,NEW_CLASS,0,1) 
thomas's avatar
thomas committed
112

thomas's avatar
thomas committed
113
114
115
/*! Implementation of a flext dsp class (part of a library) with no arguments
	\ingroup FLEXT_LIB_DSP
*/
thomas's avatar
thomas committed
116
#define FLEXT_LIB_DSP(NAME,NEW_CLASS)	\
thomas's avatar
thomas committed
117
\
thomas's avatar
thomas committed
118
REAL_NEW(NAME,NEW_CLASS,1,1) 
thomas's avatar
thomas committed
119
120


thomas's avatar
thomas committed
121
122
123
// VARIABLE ARGUMENT LIST
// ----------------------------------------

thomas's avatar
thomas committed
124
125
126
/*! Implementation of a flext class with a variable argument list
	\ingroup FLEXT_NEW
*/
thomas's avatar
thomas committed
127
#define FLEXT_NEW_V(NAME,NEW_CLASS)			\
thomas's avatar
thomas committed
128
REAL_NEW_V(NAME,NEW_CLASS,0,0) \
thomas's avatar
thomas committed
129
REAL_EXT(NEW_CLASS,0)
thomas's avatar
thomas committed
130

thomas's avatar
thomas committed
131
132
133
/*! Implementation of a flext tilde class with a variable argument list
	\ingroup FLEXT_NEW_DSP
*/
thomas's avatar
thomas committed
134
#define FLEXT_NEW_DSP_V(NAME,NEW_CLASS)	\
thomas's avatar
thomas committed
135
REAL_NEW_V(NAME,NEW_CLASS,1,0) \
thomas's avatar
thomas committed
136
REAL_EXT(NEW_CLASS, 1)
thomas's avatar
thomas committed
137

thomas's avatar
thomas committed
138
139
140
141
/*! Implementation of a flext GUI class with a variable argument list
	\ingroup FLEXT_NEW_GUI
*/
#define FLEXT_NEW_GUI_V(NAME,NEW_CLASS)	\
thomas's avatar
thomas committed
142
REAL_NEW_V(NAME,NEW_CLASS,2,0) \
thomas's avatar
thomas committed
143
144
REAL_EXT(NEW_CLASS, 2)

thomas's avatar
thomas committed
145
146
147
/*! Implementation of a flext class (part of a library) with a variable argument list
	\ingroup FLEXT_LIB
*/
thomas's avatar
thomas committed
148
#define FLEXT_LIB_V(NAME,NEW_CLASS)			\
thomas's avatar
thomas committed
149
\
thomas's avatar
thomas committed
150
REAL_NEW_V(NAME,NEW_CLASS, 0,1) 
thomas's avatar
thomas committed
151

thomas's avatar
thomas committed
152
153
154
/*! Implementation of a flext tilde class (part of a library) with a variable argument list
	\ingroup FLEXT_LIB_DSP
*/
thomas's avatar
thomas committed
155
#define FLEXT_LIB_DSP_V(NAME,NEW_CLASS)	\
thomas's avatar
thomas committed
156
\
thomas's avatar
thomas committed
157
REAL_NEW_V(NAME,NEW_CLASS, 1,1) 
thomas's avatar
thomas committed
158
159


thomas's avatar
thomas committed
160
161
162
// ONE ARGUMENT
// ----------------------------------------

thomas's avatar
thomas committed
163
164
165
/*! Implementation of a flext class with one argument
	\ingroup FLEXT_NEW
*/
thomas's avatar
thomas committed
166
#define FLEXT_NEW_1(NAME,NEW_CLASS, TYPE)		\
thomas's avatar
thomas committed
167
REAL_NEW_1(NAME,NEW_CLASS, 0, 0,TYPE) \
thomas's avatar
thomas committed
168
REAL_EXT(NEW_CLASS, 0)
thomas's avatar
thomas committed
169

thomas's avatar
thomas committed
170
171
172
/*! Implementation of a flext tilde class with one argument
	\ingroup FLEXT_NEW_DSP
*/
thomas's avatar
thomas committed
173
#define FLEXT_NEW_DSP_1(NAME,NEW_CLASS, TYPE)	\
thomas's avatar
thomas committed
174
REAL_NEW_1(NAME,NEW_CLASS, 1, 0,TYPE) \
thomas's avatar
thomas committed
175
REAL_EXT(NEW_CLASS, 1)
thomas's avatar
thomas committed
176

thomas's avatar
thomas committed
177
178
179
180
181
/*! Implementation of a flext class (part of a library) with one argument
	\ingroup FLEXT_LIB
*/
#define FLEXT_LIB_1(NAME,NEW_CLASS, TYPE) \
\
thomas's avatar
thomas committed
182
REAL_NEW_1(NAME,NEW_CLASS, 0,1,TYPE)
thomas's avatar
thomas committed
183

thomas's avatar
thomas committed
184
185
186
/*! Implementation of a flext tilde class (part of a library) with one argument
	\ingroup FLEXT_LIB_DSP
*/
thomas's avatar
thomas committed
187
#define FLEXT_LIB_DSP_1(NAME,NEW_CLASS, TYPE)	\
thomas's avatar
thomas committed
188
\
thomas's avatar
thomas committed
189
REAL_NEW_1(NAME,NEW_CLASS, 1,1, TYPE)
thomas's avatar
thomas committed
190
191
192
193


// TWO ARGUMENTS
// ----------------------------------------
thomas's avatar
thomas committed
194

thomas's avatar
thomas committed
195
/*! Implementation of a flext class with 2 arguments
thomas's avatar
thomas committed
196
197
	\ingroup FLEXT_NEW
*/
thomas's avatar
thomas committed
198
#define FLEXT_NEW_2(NAME,NEW_CLASS, TYPE1, TYPE2)			\
thomas's avatar
thomas committed
199
REAL_NEW_2(NAME,NEW_CLASS, 0,0, TYPE1, TYPE2) \
thomas's avatar
thomas committed
200
REAL_EXT(NEW_CLASS, 0)
thomas's avatar
thomas committed
201

thomas's avatar
thomas committed
202
/*! Implementation of a flext tilde class with 2 arguments
thomas's avatar
thomas committed
203
204
	\ingroup FLEXT_NEW_DSP
*/
thomas's avatar
thomas committed
205
#define FLEXT_NEW_DSP_2(NAME,NEW_CLASS, TYPE1, TYPE2)	\
thomas's avatar
thomas committed
206
REAL_NEW_2(NAME,NEW_CLASS, 1,0, TYPE1, TYPE2) \
thomas's avatar
thomas committed
207
REAL_EXT(NEW_CLASS, 1)
thomas's avatar
thomas committed
208

thomas's avatar
thomas committed
209
/*! Implementation of a flext class (part of a library) with 2 arguments
thomas's avatar
thomas committed
210
211
	\ingroup FLEXT_LIB
*/
thomas's avatar
thomas committed
212
#define FLEXT_LIB_2(NAME,NEW_CLASS, TYPE1, TYPE2)		\
thomas's avatar
thomas committed
213
\
thomas's avatar
thomas committed
214
REAL_NEW_2(NAME,NEW_CLASS, 0,1, TYPE1, TYPE2)
thomas's avatar
thomas committed
215

thomas's avatar
thomas committed
216
/*! Implementation of a flext tilde class (part of a library) with 2 arguments
thomas's avatar
thomas committed
217
218
	\ingroup FLEXT_LIB_DSP
*/
thomas's avatar
thomas committed
219
#define FLEXT_LIB_DSP_2(NAME,NEW_CLASS, TYPE1, TYPE2)	\
thomas's avatar
thomas committed
220
\
thomas's avatar
thomas committed
221
REAL_NEW_2(NAME,NEW_CLASS, 1,1, TYPE1, TYPE2)
thomas's avatar
thomas committed
222
223


thomas's avatar
thomas committed
224
225
// THREE ARGUMENTS
// ----------------------------------------
thomas's avatar
thomas committed
226

thomas's avatar
thomas committed
227
/*! Implementation of a flext class with 3 arguments
thomas's avatar
thomas committed
228
229
	\ingroup FLEXT_NEW
*/
thomas's avatar
thomas committed
230
#define FLEXT_NEW_3(NAME,NEW_CLASS, TYPE1, TYPE2, TYPE3) \
thomas's avatar
thomas committed
231
REAL_NEW_3(NAME,NEW_CLASS, 0,0, TYPE1, TYPE2, TYPE3)  \
thomas's avatar
thomas committed
232
REAL_EXT(NEW_CLASS, 0)
thomas's avatar
thomas committed
233

thomas's avatar
thomas committed
234
/*! Implementation of a flext tilde class with 3 arguments
thomas's avatar
thomas committed
235
236
	\ingroup FLEXT_NEW_DSP
*/
thomas's avatar
thomas committed
237
#define FLEXT_NEW_DSP_3(NAME,NEW_CLASS, TYPE1, TYPE2, TYPE3)	\
thomas's avatar
thomas committed
238
REAL_NEW_3(NAME,NEW_CLASS, 1,0, TYPE1, TYPE2, TYPE3) \
thomas's avatar
thomas committed
239
REAL_EXT(NEW_CLASS, 1)
thomas's avatar
thomas committed
240

thomas's avatar
thomas committed
241
/*! Implementation of a flext class (part of a library) with 3 arguments
thomas's avatar
thomas committed
242
243
	\ingroup FLEXT_LIB
*/
thomas's avatar
thomas committed
244
#define FLEXT_LIB_3(NAME,NEW_CLASS, TYPE1, TYPE2, TYPE3)		\
thomas's avatar
thomas committed
245
\
thomas's avatar
thomas committed
246
REAL_NEW_3(NAME,NEW_CLASS, 0,1,TYPE1, TYPE2, TYPE3)
thomas's avatar
thomas committed
247

thomas's avatar
thomas committed
248
/*! Implementation of a flext tilde class (part of a library) with 3 arguments
thomas's avatar
thomas committed
249
250
	\ingroup FLEXT_LIB_DSP
*/
thomas's avatar
thomas committed
251
#define FLEXT_LIB_DSP_3(NAME,NEW_CLASS, TYPE1, TYPE2, TYPE3)	\
thomas's avatar
thomas committed
252
\
thomas's avatar
thomas committed
253
REAL_NEW_3(NAME,NEW_CLASS, 1,1, TYPE1, TYPE2, TYPE3)
thomas's avatar
thomas committed
254
255


thomas's avatar
thomas committed
256
// deprecated stuff
thomas's avatar
thomas committed
257
258
259

#define FLEXT_NEW_G FLEXT_NEW_V

thomas's avatar
thomas committed
260
#define FLEXT_NEW_TILDE FLEXT_NEW_DSP
thomas's avatar
thomas committed
261
#define FLEXT_NEW_TILDE_G FLEXT_NEW_DSP_V
thomas's avatar
thomas committed
262
263
264
265
266
#define FLEXT_NEW_TILDE_1 FLEXT_NEW_DSP_1
#define FLEXT_NEW_TILDE_2 FLEXT_NEW_DSP_2
#define FLEXT_NEW_TILDE_3 FLEXT_NEW_DSP_3

#define FLEXT_LIB_G FLEXT_LIB_V
thomas's avatar
thomas committed
267
268

#define FLEXT_LIB_TILDE FLEXT_LIB_DSP
thomas's avatar
thomas committed
269
#define FLEXT_LIB_TILDE_G FLEXT_LIB_DSP_V
thomas's avatar
thomas committed
270
271
272
#define FLEXT_LIB_TILDE_1 FLEXT_LIB_DSP_1
#define FLEXT_LIB_TILDE_2 FLEXT_LIB_DSP_2
#define FLEXT_LIB_TILDE_3 FLEXT_LIB_DSP_3
thomas's avatar
thomas committed
273

thomas's avatar
thomas committed
274
275
276
277
278
279



// ====================================================================================


thomas's avatar
thomas committed
280
/*!	\defgroup FLEXT_CALLBACK Flext callbacks
thomas's avatar
thomas committed
281

thomas's avatar
thomas committed
282
283
	@{ 
*/
thomas's avatar
thomas committed
284

thomas's avatar
thomas committed
285
//! Set up a method callback with no arguments
thomas's avatar
thomas committed
286
#define FLEXT_CALLBACK(M_FUN) \
thomas's avatar
thomas committed
287
static bool cb_ ## M_FUN(flext_base *c) \
thomas's avatar
thomas committed
288
{ FLEXT_CAST<thisType *>(c)->M_FUN(); return true; }
thomas's avatar
thomas committed
289

thomas's avatar
thomas committed
290
//! Set up a method callback for an anything argument
thomas's avatar
thomas committed
291
#define FLEXT_CALLBACK_A(M_FUN) \
thomas's avatar
thomas committed
292
static bool cb_ ## M_FUN(flext_base *c,const t_symbol *s,int argc,t_atom *argv) \
thomas's avatar
thomas committed
293
{ FLEXT_CAST<thisType *>(c)->M_FUN(s,argc,argv); return true; }
thomas's avatar
thomas committed
294

thomas's avatar
thomas committed
295
//! Set up a method callback for a variable argument list
thomas's avatar
thomas committed
296
#define FLEXT_CALLBACK_V(M_FUN) \
thomas's avatar
thomas committed
297
static bool cb_ ## M_FUN(flext_base *c,int argc,t_atom *argv) \
thomas's avatar
thomas committed
298
{ FLEXT_CAST<thisType *>(c)->M_FUN(argc,argv); return true; }
thomas's avatar
thomas committed
299

thomas's avatar
thomas committed
300
301
//! Set up a method callback for a data package (void *) argument
#define FLEXT_CALLBACK_X(M_FUN) \
thomas's avatar
thomas committed
302
static bool cb_ ## M_FUN(flext_base *c,void *data) \
thomas's avatar
thomas committed
303
{ FLEXT_CAST<thisType *>(c)->M_FUN(data); return true; }
thomas's avatar
thomas committed
304

thomas's avatar
thomas committed
305
//! Set up a method callback for a boolean argument
thomas's avatar
thomas committed
306
#define FLEXT_CALLBACK_B(M_FUN) \
thomas's avatar
thomas committed
307
static bool cb_ ## M_FUN(flext_base *c,int &arg1) \
thomas's avatar
thomas committed
308
{ FLEXT_CAST<thisType *>(c)->M_FUN(arg1 != 0); return true; }
thomas's avatar
thomas committed
309

thomas's avatar
thomas committed
310
//! Set up a method callback for 1 argument
thomas's avatar
thomas committed
311
#define FLEXT_CALLBACK_1(M_FUN,TP1) \
thomas's avatar
thomas committed
312
static bool cb_ ## M_FUN(flext_base *c,TP1 &arg1) \
thomas's avatar
thomas committed
313
{ FLEXT_CAST<thisType *>(c)->M_FUN(arg1); return true; }
thomas's avatar
thomas committed
314

thomas's avatar
thomas committed
315
//! Set up a method callback for 2 arguments
thomas's avatar
thomas committed
316
#define FLEXT_CALLBACK_2(M_FUN,TP1,TP2) \
thomas's avatar
thomas committed
317
static bool cb_ ## M_FUN(flext_base *c,TP1 &arg1,TP2 &arg2) \
thomas's avatar
thomas committed
318
{ FLEXT_CAST<thisType *>(c)->M_FUN(arg1,arg2); return true; }
thomas's avatar
thomas committed
319

thomas's avatar
thomas committed
320
//! Set up a method callback for 3 arguments
thomas's avatar
thomas committed
321
#define FLEXT_CALLBACK_3(M_FUN,TP1,TP2,TP3) \
thomas's avatar
thomas committed
322
static bool cb_ ## M_FUN(flext_base *c,TP1 &arg1,TP2 &arg2,TP3 &arg3) \
thomas's avatar
thomas committed
323
{ FLEXT_CAST<thisType *>(c)->M_FUN(arg1,arg2,arg3); return true; }
thomas's avatar
thomas committed
324

thomas's avatar
thomas committed
325
//! Set up a method callback for 4 arguments
thomas's avatar
thomas committed
326
#define FLEXT_CALLBACK_4(M_FUN,TP1,TP2,TP3,TP4) \
thomas's avatar
thomas committed
327
static bool cb_ ## M_FUN(flext_base *c,TP1 &arg1,TP2 &arg2,TP3 &arg3,TP4 &arg4) \
thomas's avatar
thomas committed
328
{ FLEXT_CAST<thisType *>(c)->M_FUN(arg1,arg2,arg3,arg4); return true; }
thomas's avatar
thomas committed
329

thomas's avatar
thomas committed
330
//! Set up a method callback for 5 arguments
thomas's avatar
thomas committed
331
#define FLEXT_CALLBACK_5(M_FUN,TP1,TP2,TP3,TP4,TP5) \
thomas's avatar
thomas committed
332
static bool cb_ ## M_FUN(flext_base *c,TP1 &arg1,TP2 &arg2,TP3 &arg3,TP4 &arg4,TP5 &arg5) \
thomas's avatar
thomas committed
333
{ FLEXT_CAST<thisType *>(c)->M_FUN(arg1,arg2,arg3,arg4,arg5); return true; }
thomas's avatar
thomas committed
334

thomas's avatar
thomas committed
335

thomas's avatar
thomas committed
336
//	Shortcuts
thomas's avatar
thomas committed
337

thomas's avatar
thomas committed
338
//! Set up a method callback for 1 float argument
thomas's avatar
thomas committed
339
340
341
342
#define FLEXT_CALLBACK_F(M_FUN) \
\
FLEXT_CALLBACK_1(M_FUN,float)

thomas's avatar
thomas committed
343
//! Set up a method callback for 2 float arguments
thomas's avatar
thomas committed
344
345
346
347
#define FLEXT_CALLBACK_FF(M_FUN) \
\
FLEXT_CALLBACK_2(M_FUN,float,float)

thomas's avatar
thomas committed
348
//! Set up a method callback for 3 float arguments
thomas's avatar
thomas committed
349
350
351
#define FLEXT_CALLBACK_FFF(M_FUN) \
\
FLEXT_CALLBACK_3(M_FUN,float,float,float)
thomas's avatar
thomas committed
352

thomas's avatar
thomas committed
353
//! Set up a method callback for 1 integer argument
thomas's avatar
thomas committed
354
355
356
357
#define FLEXT_CALLBACK_I(M_FUN) \
\
FLEXT_CALLBACK_1(M_FUN,int)

thomas's avatar
thomas committed
358
//! Set up a method callback for 2 integer arguments
thomas's avatar
thomas committed
359
360
361
362
#define FLEXT_CALLBACK_II(M_FUN) \
\
FLEXT_CALLBACK_2(M_FUN,int,int)

thomas's avatar
thomas committed
363
//! Set up a method callback for 3 integer arguments
thomas's avatar
thomas committed
364
365
366
#define FLEXT_CALLBACK_III(M_FUN) \
\
FLEXT_CALLBACK_3(M_FUN,int,int,int)
thomas's avatar
thomas committed
367

thomas's avatar
thomas committed
368
//! Set up a method callback for 1 symbol argument
thomas's avatar
thomas committed
369
370
371
#define FLEXT_CALLBACK_S(M_FUN) \
\
FLEXT_CALLBACK_1(M_FUN,t_symptr)
thomas's avatar
thomas committed
372

thomas's avatar
thomas committed
373
374
375
376

// deprecated
#define FLEXT_CALLBACK_G FLEXT_CALLBACK_V

thomas's avatar
thomas committed
377
//! @} 
thomas's avatar
thomas committed
378
379
380



thomas's avatar
thomas committed
381
382
383
384
/*!	\defgroup FLEXT_THREAD Flext threads

	@{ 
*/
thomas's avatar
thomas committed
385
386
387

#ifdef FLEXT_THREADS

thomas's avatar
thomas committed
388
//! Set up a threaded method callback with no arguments
thomas's avatar
thomas committed
389
#define FLEXT_THREAD(M_FUN) \
thomas's avatar
thomas committed
390
static bool cb_ ## M_FUN(flext_base *c) {  \
thomas's avatar
thomas committed
391
	thr_params *p = new thr_params(c); \
thomas's avatar
thomas committed
392
	return StartThread(thr_ ## M_FUN,p,#M_FUN); \
thomas's avatar
thomas committed
393
394
} \
static void *thr_ ## M_FUN(thr_params *p) {  \
thomas's avatar
thomas committed
395
	thisType *th = FLEXT_CAST<thisType *>(p->cl); \
thomas's avatar
thomas committed
396
	bool ok = th->PushThread(); \
thomas's avatar
thomas committed
397
	delete p; \
thomas's avatar
thomas committed
398
399
400
401
	if(ok) { \
		th->M_FUN(); \
		th->PopThread(); \
	} \
thomas's avatar
thomas committed
402
403
404
	return NULL; \
} 

thomas's avatar
thomas committed
405
//! Set up a threaded method callback for an anything argument
thomas's avatar
thomas committed
406
#define FLEXT_THREAD_A(M_FUN) \
thomas's avatar
thomas committed
407
static bool cb_ ## M_FUN(flext_base *c,const t_symbol *s,int argc,t_atom *argv) {  \
thomas's avatar
thomas committed
408
	thr_params *p = new thr_params(c); p->set_any(s,argc,argv); \
thomas's avatar
thomas committed
409
	return StartThread(thr_ ## M_FUN,p,#M_FUN); \
thomas's avatar
thomas committed
410
411
} \
static void *thr_ ## M_FUN(thr_params *p) {  \
thomas's avatar
thomas committed
412
	thisType *th = FLEXT_CAST<thisType *>(p->cl); \
thomas's avatar
thomas committed
413
	bool ok = th->PushThread(); \
thomas's avatar
thomas committed
414
	AtomAnything *args = p->var[0]._any.args; \
thomas's avatar
thomas committed
415
	delete p; \
thomas's avatar
thomas committed
416
	if(ok) { \
thomas's avatar
thomas committed
417
		th->M_FUN(args->Header(),args->Count(),args->Atoms()); \
thomas's avatar
thomas committed
418
419
		th->PopThread(); \
	} \
thomas's avatar
thomas committed
420
	delete args; \
thomas's avatar
thomas committed
421
422
423
	return NULL; \
} 

thomas's avatar
thomas committed
424
//! Set up a threaded method callback for a variable argument list
thomas's avatar
thomas committed
425
#define FLEXT_THREAD_V(M_FUN) \
thomas's avatar
thomas committed
426
static bool cb_ ## M_FUN(flext_base *c,int argc,t_atom *argv) {  \
thomas's avatar
thomas committed
427
	thr_params *p = new thr_params(c); p->set_list(argc,argv); \
thomas's avatar
thomas committed
428
	return StartThread(thr_ ## M_FUN,p,#M_FUN); \
thomas's avatar
thomas committed
429
430
} \
static void *thr_ ## M_FUN(thr_params *p) {  \
thomas's avatar
thomas committed
431
	thisType *th = FLEXT_CAST<thisType *>(p->cl); \
thomas's avatar
thomas committed
432
	bool ok = th->PushThread(); \
thomas's avatar
thomas committed
433
	AtomList *args = p->var[0]._list.args; \
thomas's avatar
thomas committed
434
	delete p; \
thomas's avatar
thomas committed
435
	if(ok) { \
thomas's avatar
thomas committed
436
437
438
439
440
441
442
443
		th->M_FUN(args->Count(),args->Atoms()); \
		th->PopThread(); \
	} \
	delete args; \
	return NULL; \
} 

/*! \brief Set up a threaded method callback for an arbitrary data struct
thomas's avatar
thomas committed
444
	\note Data is pure... no destructor is called upon delete
thomas's avatar
thomas committed
445
446
*/
#define FLEXT_THREAD_X(M_FUN) \
thomas's avatar
thomas committed
447
static bool cb_ ## M_FUN(flext_base *c,void *data) {  \
thomas's avatar
thomas committed
448
	thr_params *p = new thr_params(c); p->var[0]._ext.data = data; \
thomas's avatar
thomas committed
449
	return StartThread(thr_ ## M_FUN,p,#M_FUN); \
thomas's avatar
thomas committed
450
451
} \
static void *thr_ ## M_FUN(thr_params *p) {  \
thomas's avatar
thomas committed
452
	thisType *th = FLEXT_CAST<thisType *>(p->cl); \
thomas's avatar
thomas committed
453
454
455
456
457
	bool ok = th->PushThread(); \
	void *data = p->var[0]._ext.data; \
	delete p; \
	if(ok) { \
		th->M_FUN(data); \
thomas's avatar
thomas committed
458
459
		th->PopThread(); \
	} \
thomas's avatar
thomas committed
460
	delete data; \
thomas's avatar
thomas committed
461
462
463
	return NULL; \
} 

thomas's avatar
thomas committed
464
//! Set up a threaded method callback for a boolean argument
thomas's avatar
thomas committed
465
#define FLEXT_THREAD_B(M_FUN) \
thomas's avatar
thomas committed
466
static bool cb_ ## M_FUN(flext_base *c,int &arg1) {  \
thomas's avatar
thomas committed
467
	thr_params *p = new thr_params(c); p->var[0]._bool = arg1 != 0; \
thomas's avatar
thomas committed
468
	return StartThread(thr_ ## M_FUN,p,#M_FUN); \
thomas's avatar
thomas committed
469
470
} \
static void *thr_ ## M_FUN(thr_params *p) {  \
thomas's avatar
thomas committed
471
	thisType *th = FLEXT_CAST<thisType *>(p->cl); \
thomas's avatar
thomas committed
472
	bool ok = th->PushThread(); \
thomas's avatar
thomas committed
473
	bool b = p->var[0]._bool; \
thomas's avatar
thomas committed
474
	delete p; \
thomas's avatar
thomas committed
475
476
477
478
	if(ok) { \
		th->M_FUN(b); \
		th->PopThread(); \
	} \
thomas's avatar
thomas committed
479
480
481
	return NULL; \
} 

thomas's avatar
thomas committed
482
//! Set up a threaded method callback for 1 argument
thomas's avatar
thomas committed
483
#define FLEXT_THREAD_1(M_FUN,TP1) \
thomas's avatar
thomas committed
484
static bool cb_ ## M_FUN(flext_base *c,TP1 &arg1) {  \
thomas's avatar
thomas committed
485
	thr_params *p = new thr_params(c,1); \
thomas's avatar
thomas committed
486
	p->var[0]._ ## TP1 = arg1; \
thomas's avatar
thomas committed
487
	return StartThread(thr_ ## M_FUN,p,#M_FUN); \
thomas's avatar
thomas committed
488
489
} \
static void *thr_ ## M_FUN(thr_params *p) {  \
thomas's avatar
thomas committed
490
	thisType *th = FLEXT_CAST<thisType *>(p->cl); \
thomas's avatar
thomas committed
491
	bool ok = th->PushThread(); \
thomas's avatar
thomas committed
492
493
	const TP1 v1 = p->var[0]._ ## TP1; \
	delete p; \
thomas's avatar
thomas committed
494
495
496
497
	if(ok) { \
		th->M_FUN(v1); \
		th->PopThread(); \
	} \
thomas's avatar
thomas committed
498
499
500
	return NULL; \
} 

thomas's avatar
thomas committed
501
//! Set up a threaded method callback for 2 arguments
thomas's avatar
thomas committed
502
#define FLEXT_THREAD_2(M_FUN,TP1,TP2) \
thomas's avatar
thomas committed
503
static bool cb_ ## M_FUN(flext_base *c,TP1 &arg1,TP2 &arg2) {  \
thomas's avatar
thomas committed
504
	thr_params *p = new thr_params(c,2); \
thomas's avatar
thomas committed
505
506
	p->var[0]._ ## TP1 = arg1; \
	p->var[1]._ ## TP2 = arg2; \
thomas's avatar
thomas committed
507
	return StartThread(thr_ ## M_FUN,p,#M_FUN); \
thomas's avatar
thomas committed
508
509
} \
static void *thr_ ## M_FUN(thr_params *p) {  \
thomas's avatar
thomas committed
510
	thisType *th = FLEXT_CAST<thisType *>(p->cl); \
thomas's avatar
thomas committed
511
	bool ok = th->PushThread(); \
thomas's avatar
thomas committed
512
513
514
	const TP1 v1 = p->var[0]._ ## TP1; \
	const TP1 v2 = p->var[1]._ ## TP2; \
	delete p; \
thomas's avatar
thomas committed
515
516
517
518
	if(ok) { \
		th->M_FUN(v1,v2); \
		th->PopThread(); \
	} \
thomas's avatar
thomas committed
519
520
521
	return NULL; \
} 

thomas's avatar
thomas committed
522
//! Set up a threaded method callback for 3 arguments
thomas's avatar
thomas committed
523
#define FLEXT_THREAD_3(M_FUN,TP1,TP2,TP3) \
thomas's avatar
thomas committed
524
static bool cb_ ## M_FUN(flext_base *c,TP1 &arg1,TP2 &arg2,TP3 &arg3) {  \
thomas's avatar
thomas committed
525
	thr_params *p = new thr_params(c,3); \
thomas's avatar
thomas committed
526
527
528
	p->var[0]._ ## TP1 = arg1; \
	p->var[1]._ ## TP2 = arg2; \
	p->var[2]._ ## TP3 = arg3; \
thomas's avatar
thomas committed
529
	return StartThread(thr_ ## M_FUN,p,#M_FUN); \
thomas's avatar
thomas committed
530
531
} \
static void *thr_ ## M_FUN(thr_params *p) {  \
thomas's avatar
thomas committed
532
	thisType *th = FLEXT_CAST<thisType *>(p->cl); \
thomas's avatar
thomas committed
533
	bool ok = th->PushThread(); \
thomas's avatar
thomas committed
534
535
536
537
	const TP1 v1 = p->var[0]._ ## TP1; \
	const TP2 v2 = p->var[1]._ ## TP2; \
	const TP3 v3 = p->var[2]._ ## TP3; \
	delete p; \
thomas's avatar
thomas committed
538
539
540
541
	if(ok) { \
		th->M_FUN(v1,v2,v3); \
		th->PopThread(); \
	} \
thomas's avatar
thomas committed
542
543
544
	return NULL; \
} 

thomas's avatar
thomas committed
545
//! Set up a threaded method callback for 4 arguments
thomas's avatar
thomas committed
546
#define FLEXT_THREAD_4(M_FUN,TP1,TP2,TP3,TP4) \
thomas's avatar
thomas committed
547
static bool cb_ ## M_FUN(flext_base *c,TP1 &arg1,TP2 &arg2,TP3 &arg3,TP4 &arg4) {  \
thomas's avatar
thomas committed
548
	thr_params *p = new thr_params(c,4); \
thomas's avatar
thomas committed
549
550
551
552
	p->var[0]._ ## TP1 = arg1; \
	p->var[1]._ ## TP2 = arg2; \
	p->var[2]._ ## TP3 = arg3; \
	p->var[3]._ ## TP4 = arg4; \
thomas's avatar
thomas committed
553
	return StartThread(thr_ ## M_FUN,p,#M_FUN); \
thomas's avatar
thomas committed
554
555
} \
static void *thr_ ## M_FUN(thr_params *p) {  \
thomas's avatar
thomas committed
556
	thisType *th = FLEXT_CAST<thisType *>(p->cl); \
thomas's avatar
thomas committed
557
	bool ok = th->PushThread(); \
thomas's avatar
thomas committed
558
559
560
561
562
	const TP1 v1 = p->var[0]._ ## TP1; \
	const TP2 v2 = p->var[1]._ ## TP2; \
	const TP3 v3 = p->var[2]._ ## TP3; \
	const TP4 v4 = p->var[3]._ ## TP4; \
	delete p; \
thomas's avatar
thomas committed
563
564
565
566
	if(ok) { \
		th->M_FUN(v1,v2,v3,v4); \
		th->PopThread(); \
	} \
thomas's avatar
thomas committed
567
568
569
	return NULL; \
} 

thomas's avatar
thomas committed
570
//! Set up a threaded method callback for 5 arguments
thomas's avatar
thomas committed
571
#define FLEXT_THREAD_5(M_FUN,TP1,TP2,TP3,TP4,TP5) \
thomas's avatar
thomas committed
572
static bool cb_ ## M_FUN(flext_base *c,TP1 &arg1,TP2 &arg2,TP3 &arg3,TP4 &arg4,TP5 &arg5) {  \
thomas's avatar
thomas committed
573
	thr_params *p = new thr_params(c,5); \
thomas's avatar
thomas committed
574
575
576
577
578
	p->var[0]._ ## TP1 = arg1; \
	p->var[1]._ ## TP2 = arg2; \
	p->var[2]._ ## TP3 = arg3; \
	p->var[3]._ ## TP4 = arg4; \
	p->var[4]._ ## TP5 = arg5; \
thomas's avatar
thomas committed
579
	return StartThread(thr_ ## M_FUN,p,#M_FUN); \
thomas's avatar
thomas committed
580
581
} \
static void *thr_ ## M_FUN(thr_params *p) {  \
thomas's avatar
thomas committed
582
	thisType *th = FLEXT_CAST<thisType *>(p->cl); \
thomas's avatar
thomas committed
583
	bool ok = th->PushThread(); \
thomas's avatar
thomas committed
584
585
586
587
588
589
	const TP1 v1 = p->var[0]._ ## TP1; \
	const TP2 v2 = p->var[1]._ ## TP2; \
	const TP3 v3 = p->var[2]._ ## TP3; \
	const TP4 v4 = p->var[3]._ ## TP4; \
	const TP5 v5 = p->var[4]._ ## TP5; \
	delete p; \
thomas's avatar
thomas committed
590
591
592
593
	if(ok) { \
		th->M_FUN(v1,v2,v3,v4,v5); \
		th->PopThread(); \
	} \
thomas's avatar
thomas committed
594
595
596
597
	return NULL; \
} 


thomas's avatar
thomas committed
598
599
//!	Shortcuts

thomas's avatar
thomas committed
600
//! Set up a threaded method callback for 1 float argument
thomas's avatar
thomas committed
601
602
603
#define FLEXT_THREAD_F(M_FUN) \
\
FLEXT_THREAD_1(M_FUN,float)
thomas's avatar
thomas committed
604

thomas's avatar
thomas committed
605
//! Set up a threaded method callback for 2 float arguments
thomas's avatar
thomas committed
606
607
608
609
#define FLEXT_THREAD_FF(M_FUN) \
\
FLEXT_THREAD_2(M_FUN,float,float)

thomas's avatar
thomas committed
610
//! Set up a threaded method callback for 3 float arguments
thomas's avatar
thomas committed
611
612
613
#define FLEXT_THREAD_FFF(M_FUN) \
\
FLEXT_THREAD_3(M_FUN,float,float,float)
thomas's avatar
thomas committed
614

thomas's avatar
thomas committed
615
//! Set up a threaded method callback for 1 integer argument
thomas's avatar
thomas committed
616
617
618
619
#define FLEXT_THREAD_I(M_FUN) \
\
FLEXT_THREAD_1(M_FUN,int)

thomas's avatar
thomas committed
620
//! Set up a threaded method callback for 2 integer arguments
thomas's avatar
thomas committed
621
622
623
624
#define FLEXT_THREAD_II(M_FUN) \
\
FLEXT_THREAD_2(M_FUN,int,int)

thomas's avatar
thomas committed
625
//! Set up a threaded method callback for 3 integer arguments
thomas's avatar
thomas committed
626
627
628
#define FLEXT_THREAD_III(M_FUN) \
\
FLEXT_THREAD_3(M_FUN,int,int,int)
thomas's avatar
thomas committed
629

thomas's avatar
thomas committed
630
//! Set up a threaded method callback for 1 symbol argument
thomas's avatar
thomas committed
631
632
633
#define FLEXT_THREAD_S(M_FUN) \
\
FLEXT_THREAD_1(M_FUN,t_symptr)
thomas's avatar
thomas committed
634

thomas's avatar
thomas committed
635
636
637
// deprecated
#define FLEXT_THREAD_G FLEXT_THREAD_V

thomas's avatar
thomas committed
638
#endif // FLEXT_THREAD
thomas's avatar
thomas committed
639

thomas's avatar
thomas committed
640
//! @} 
thomas's avatar
thomas committed
641
642
643



thomas's avatar
thomas committed
644
645
646
647
// ====================================================================================



thomas's avatar
thomas committed
648
/*!	\defgroup FLEXT_ADDMETHOD Add flext methods
thomas's avatar
thomas committed
649
650
	These should be the used in the class' constructor

thomas's avatar
thomas committed
651
652
	@{ 
*/
thomas's avatar
thomas committed
653

thomas's avatar
thomas committed
654
//! Enable list element distribution over inlets (if no better handler found)
thomas's avatar
thomas committed
655
#define FLEXT_ADDDIST() \
thomas's avatar
thomas committed
656
\
thomas's avatar
thomas committed
657
658
SetDist(true)	

thomas's avatar
thomas committed
659
//! Add a method handler for bang 
thomas's avatar
thomas committed
660
#define FLEXT_ADDBANG(IX,M_FUN) \
thomas's avatar
thomas committed
661
\
thomas's avatar
thomas committed
662
663
AddMethod(IX,"bang",cb_ ## M_FUN)	

thomas's avatar
thomas committed
664
//! Add a handler for a method with no arguments
thomas's avatar
thomas committed
665
666
667
#define FLEXT_ADDMETHOD(IX,M_FUN) \
AddMethod(IX,cb_ ## M_FUN)	

thomas's avatar
thomas committed
668
//! Add a handler for a method with a (variable argument) list
thomas's avatar
thomas committed
669
670
671
672
#define FLEXT_ADDMETHOD_V(IX,M_FUN) \
\
AddMethod(IX,cb_ ## M_FUN)	

thomas's avatar
thomas committed
673
//! Add a handler for a method with an anything argument
thomas's avatar
thomas committed
674
675
676
677
#define FLEXT_ADDMETHOD_A(IX,M_FUN) \
\
AddMethod(IX,cb_ ## M_FUN)	

thomas's avatar
thomas committed
678
//! Add a a handler for a method with implicit arguments
thomas's avatar
thomas committed
679
#define FLEXT_ADDMETHOD_(IX,M_TAG,M_FUN) \
thomas's avatar
thomas committed
680
\
thomas's avatar
thomas committed
681
682
AddMethod(IX,M_TAG,cb_ ## M_FUN)	

thomas's avatar
thomas committed
683
//! Add a handler for a method with 1 enum type argument
thomas's avatar
thomas committed
684
#define FLEXT_ADDMETHOD_E(IX,M_TAG,M_FUN) \
thomas's avatar
thomas committed
685
\
thomas's avatar
thomas committed
686
687
AddMethod(IX,M_TAG,(methfun)(cb_ ## M_FUN),a_int,a_null)

thomas's avatar
thomas committed
688
//! Add a handler for a method with 1 argument
thomas's avatar
thomas committed
689
#define FLEXT_ADDMETHOD_1(IX,M_TAG,M_FUN,TP1) \
thomas's avatar
thomas committed
690
\
thomas's avatar
thomas committed
691
692
AddMethod(IX,M_TAG,(methfun)(cb_ ## M_FUN),FLEXTARG(TP1),a_null)	

thomas's avatar
thomas committed
693
//! Add a handler for a method with 2 arguments
thomas's avatar
thomas committed
694
#define FLEXT_ADDMETHOD_2(IX,M_TAG,M_FUN,TP1,TP2) \
thomas's avatar
thomas committed
695
\
thomas's avatar
thomas committed
696
AddMethod(IX,M_TAG,(methfun)(cb_ ## M_FUN),FLEXTARG(TP1),FLEXTARG(TP2),a_null)
thomas's avatar
thomas committed
697

thomas's avatar
thomas committed
698
//! Add a handler for a method with 3 arguments
thomas's avatar
thomas committed
699
#define FLEXT_ADDMETHOD_3(IX,M_TAG,M_FUN,TP1,TP2,TP3) \
thomas's avatar
thomas committed
700
\
thomas's avatar
thomas committed
701
AddMethod(IX,M_TAG,(methfun)(cb_ ## M_FUN),FLEXTARG(TP1),FLEXTARG(TP2),FLEXTARG(TP3),a_null)
thomas's avatar
thomas committed
702

thomas's avatar
thomas committed
703
//! Add a handler for a method with 4 arguments
thomas's avatar
thomas committed
704
#define FLEXT_ADDMETHOD_4(IX,M_TAG,M_FUN,TP1,TP2,TP3,TP4) \
thomas's avatar
thomas committed
705
\
thomas's avatar
thomas committed
706
AddMethod(IX,M_TAG,(methfun)(cb_ ## M_FUN),FLEXTARG(TP1),FLEXTARG(TP2),FLEXTARG(TP3),FLEXTARG(TP4),a_null)
thomas's avatar
thomas committed
707

thomas's avatar
thomas committed
708
//! Add a handler for a method with 5 arguments
thomas's avatar
thomas committed
709
#define FLEXT_ADDMETHOD_5(IX,M_TAG,M_FUN,TP1,TP2,TP3,TP4,TP5) \
thomas's avatar
thomas committed
710
\
thomas's avatar
thomas committed
711
AddMethod(IX,M_TAG,(methfun)(cb_ ## M_FUN),FLEXTARG(TP1),FLEXTARG(TP2),FLEXTARG(TP3),FLEXTARG(TP4),FLEXTARG(TP5),a_null)
thomas's avatar
thomas committed
712

thomas's avatar
thomas committed
713
714

//	Shortcuts
thomas's avatar
thomas committed
715

thomas's avatar
thomas committed
716
//! Add a handler for a method with a boolean argument
thomas's avatar
thomas committed
717
718
719
720
#define FLEXT_ADDMETHOD_B(IX,M_TAG,M_FUN) \
\
FLEXT_ADDMETHOD_1(IX,M_TAG,M_FUN,bool)

thomas's avatar
thomas committed
721
//! Add a handler for a method with 1 float argument
thomas's avatar
thomas committed
722
723
724
725
#define FLEXT_ADDMETHOD_F(IX,M_TAG,M_FUN) \
\
FLEXT_ADDMETHOD_1(IX,M_TAG,M_FUN,float)

thomas's avatar
thomas committed
726
//! Add a handler for a method with 2 float arguments
thomas's avatar
thomas committed
727
728
729
730
#define FLEXT_ADDMETHOD_FF(IX,M_TAG,M_FUN) \
\
FLEXT_ADDMETHOD_2(IX,M_TAG,M_FUN,float,float)

thomas's avatar
thomas committed
731
//! Add a handler for a method with 3 float arguments
thomas's avatar
thomas committed
732
733
734
735
#define FLEXT_ADDMETHOD_FFF(IX,M_TAG,M_FUN) \
\
FLEXT_ADDMETHOD_3(IX,M_TAG,M_FUN,float,float,float)

thomas's avatar
thomas committed
736
//! Add a handler for a method with 1 integer argument
thomas's avatar
thomas committed
737
738
739
740
#define FLEXT_ADDMETHOD_I(IX,M_TAG,M_FUN) \
\
FLEXT_ADDMETHOD_1(IX,M_TAG,M_FUN,int)

thomas's avatar
thomas committed
741
//! Add a handler for a method with 2 integer arguments
thomas's avatar
thomas committed
742
743
744
745
#define FLEXT_ADDMETHOD_II(IX,M_TAG,M_FUN) \
\
FLEXT_ADDMETHOD_2(IX,M_TAG,M_FUN,int,int)

thomas's avatar
thomas committed
746
//! Add a handler for a method with 3 integer arguments
thomas's avatar
thomas committed
747
748
749
#define FLEXT_ADDMETHOD_III(IX,M_TAG,M_FUN) \
\
FLEXT_ADDMETHOD_3(IX,M_TAG,M_FUN,int,int,int)
thomas's avatar
thomas committed
750

thomas's avatar
thomas committed
751
//! @} 
thomas's avatar
thomas committed
752
753


thomas's avatar
thomas committed
754

thomas's avatar
thomas committed
755
/*!	\defgroup FLEXT_CALLMETHOD Call flext methods manually
thomas's avatar
thomas committed
756
757
	These can only be used in class member functions!

thomas's avatar
thomas committed
758
759
	@{ 
*/
thomas's avatar
thomas committed
760

thomas's avatar
thomas committed
761
//! Call a (already defined) method with no arguments
thomas's avatar
thomas committed
762
763
764
#define FLEXT_CALLMETHOD(M_FUN) \
\
cb_ ## M_FUN(this)
thomas's avatar
thomas committed
765

thomas's avatar
thomas committed
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
//! Call a (already defined) method with variable list arguments
#define FLEXT_CALLMETHOD_V(M_FUN,ARGC,ARGV) \
\
cb_ ## M_FUN(this,ARGC,ARGV)

//! Call a (already defined) method with anything arguments
#define FLEXT_CALLMETHOD_A(M_FUN,HDR,ARGC,ARGV) \
\
cb_ ## M_FUN(this,HDR,ARGC,ARGV)

//! Call a (already defined) method with a data package (void *)
#define FLEXT_CALLMETHOD_X(M_FUN,DATA) \
\
cb_ ## M_FUN(this,DATA)

thomas's avatar
thomas committed
781
//! Call a (already defined) method with 1 enum type argument
thomas's avatar
thomas committed
782
783
784
#define FLEXT_CALLMETHOD_E(M_FUN,ARG) \
\
cb_ ## M_FUN(this,ARG)
thomas's avatar
thomas committed
785

thomas's avatar
thomas committed
786
//! Call a (already defined) method with 1 argument
thomas's avatar
thomas committed
787
788
789
#define FLEXT_CALLMETHOD_1(M_FUN,ARG) \
\
cb_ ## M_FUN(this,ARG)
thomas's avatar
thomas committed
790

thomas's avatar
thomas committed
791
//! Call a (already defined) method with 2 arguments
thomas's avatar
thomas committed
792
793
794
#define FLEXT_CALLMETHOD_2(M_FUN,ARG1,ARG2) \
\
cb_ ## M_FUN(this,ARG1,ARG2)
thomas's avatar
thomas committed
795

thomas's avatar
thomas committed
796
//! Call a (already defined) method with 3 arguments
thomas's avatar
thomas committed
797
798
799
#define FLEXT_CALLMETHOD_3(M_FUN,ARG1,ARG2,ARG3) \
\
cb_ ## M_FUN(this,ARG1,ARG2,ARG3)
thomas's avatar
thomas committed
800

thomas's avatar
thomas committed
801
//! Call a (already defined) method with 4 arguments
thomas's avatar
thomas committed
802
803
804
#define FLEXT_CALLMETHOD_4(M_FUN,ARG1,ARG2,ARG3,ARG4) \
\
cb_ ## M_FUN(this,ARG1,ARG2,ARG3,ARG4)
thomas's avatar
thomas committed
805

thomas's avatar
thomas committed
806
//! Call a (already defined) method with 5 arguments
thomas's avatar
thomas committed
807
808
809
#define FLEXT_CALLMETHOD_5(M_FUN,ARG1,ARG2,ARG3,ARG4,ARG5) \
\
cb_ ## M_FUN(this,ARG1,ARG2,ARG3,ARG4,ARG5)
thomas's avatar
thomas committed
810

thomas's avatar
thomas committed
811
//! @} 
thomas's avatar
thomas committed
812
813


thomas's avatar
thomas committed
814
#endif // __FLEXT_DEFS_H