CicmWrapper  Beta 0.4
A wrapper for Pure Data
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Modules Pages
edefine.h
1 /*
2  * CicmWrapper - Pure Data Enhanced
3 
4  * Copyright (C) 2013 Pierre Guillot, CICM - Université Paris 8
5  * All rights reserved.
6  * Website : https://github.com/CICM/CicmWrapper
7  * Contacts : cicm.mshparisnord@gmail.com
8  * For information on usage and redistribution, and for a DISCLAIMER OF ALL
9  * WARRANTIES, see the file, "LICENSE.txt," in this distribution.
10  */
11 
19 #ifndef DEF_ESTRUCT
20 #define DEF_ESTRUCT
21 
22 #ifdef _WINDOWS
23 #include <io.h>
24 #define _FUNCTION_DEPRECTAED_
25 #else
26 #include <unistd.h>
27 #define _FUNCTION_DEPRECTAED_ __attribute__((deprecated))
28 #endif
29 
30 #ifdef PD_EXTENDED
31 
32 #ifndef __m_pd_h_
33 #include "pd-extended/m_pd.h"
34 #include "pd-extended/m_imp.h"
35 #include "pd-extended/g_canvas.h"
36 #endif
37 
38 #else
39 
40 #ifndef __m_pd_h_
41 #include "pd-vanilla/m_pd.h"
42 #include "pd-vanilla/m_imp.h"
43 #include "pd-vanilla/g_canvas.h"
44 #endif
45 
46 #endif
47 #include <stdlib.h>
48 #include <math.h>
49 #include <ctype.h>
50 #include <string.h>
51 #include <stdarg.h>
52 #include <fcntl.h>
53 
60 #define atom_setfloat(a, f) SETFLOAT(a, f)
62 #define atom_setlong(a, l) SETFLOAT(a, (float)l)
63 #define atom_setsym(a, s) SETSYMBOL(a, s)
64 #define atom_getlong(a) (long)atom_getfloat(a)
65 #define atom_gettype(a) (a)[0].a_type
66 
69 typedef long t_pd_err;
71 typedef void (*t_typ_method)(void* x, ...);
73 typedef void* (*t_ret_method)(void* x, ...);
75 typedef t_pd_err (*t_err_method)(void* x, ...);
76 
78 extern t_symbol* s_null;
80 extern t_symbol* s_obj;
82 extern t_symbol* s_atom;
86 extern t_symbol* s_eboxbd;
88 extern t_symbol* s_eboxio;
90 extern t_symbol* s_size;
92 extern t_symbol* s_int;
94 extern t_symbol* s_long;
96 extern t_symbol* s_double;
97 
99 typedef struct _namelist /* element in a linked list of stored strings */
100 {
101  struct _namelist *nl_next; /* next in list */
102  char *nl_string; /* the string */
103 } t_namelist;
104 
105 EXTERN t_namelist *sys_staticpath;
106 EXTERN t_namelist *sys_externlist;
107 EXTERN t_namelist *sys_searchpath;
108 EXTERN t_namelist *sys_helppath;
109 EXTERN t_namelist *namelist_append_files(t_namelist *listwas, const char *s);
111 
120 #define EPD_PI (3.141592653589793238462643383279502884f)
122 #define EPD_2PI (6.283185307179586476925286766559005f)
124 #define EPD_PI2 (1.57079632679489661923132169163975144f)
126 #define EPD_PI4 (0.785398163397448309615660845819875721f)
128 
134 typedef enum elayer_flags
135 {
140 } elayer_flags;
141 
147 typedef enum etextanchor_flags
148 {
149  ETEXT_UP = 0,
160 
166 typedef enum etextwrap_flags
167 {
171 
177 typedef enum etextjustify_flags
178 {
183 
189 typedef enum
190 {
199 
205 typedef enum
206 {
209 } epath_types;
210 
216 typedef struct t_pt
217 {
218  float x;
219  float y;
220 } t_pt;
221 
227 typedef struct t_rect
228 {
229  float x;
230  float y;
231  float width;
232  float height;
233 } t_rect;
234 
240 typedef struct t_matrix
241 {
242  float xx;
243  float yx;
244  float xy;
245  float yy;
246  float x0;
247  float y0;
248 } t_matrix;
249 
255 typedef struct t_rgb
256 {
257  float red;
258  float green;
259  float blue;
260 } t_rgb;
261 
267 typedef struct t_rgba
268 {
269  float red;
270  float green;
271  float blue;
272  float alpha;
273 } t_rgba;
274 
280 typedef struct t_hsl
281 {
282  float hue;
283  float saturation;
284  float lightness;
285 } t_hsl;
286 
292 typedef struct t_hsla
293 {
294  float hue;
295  float saturation;
296  float lightness;
297  float alpha;
298 } t_hsla;
299 
301 extern const t_rgba rgba_black;
303 extern const t_rgba rgba_greydark;
305 extern const t_rgba rgba_grey;
307 extern const t_rgba rgba_greylight;
309 extern const t_rgba rgba_white;
311 extern const t_rgba rgba_blue;
313 extern const t_rgba rgba_green;
315 extern const t_rgba rgba_red;
316 
322 typedef struct t_efont
323 {
324  float c_size;
325  long c_sizereal;
329 } t_efont;
330 
336 typedef struct t_etext
337 {
344 } t_etext;
345 
351 typedef struct t_egobj
352 {
354  int e_filled;
356  float e_width;
359  long e_npoints;
360  float e_roundness;
366 } t_egobj;
367 
373 typedef struct t_elayer
374 {
378  int e_state;
387 } t_elayer;
388 
403 typedef struct t_epopup
404 {
407 }t_epopup;
408 
417 #define CLASS_OBJ gensym("obj")
419 #define CLASS_BOX gensym("box")
421 
427 typedef struct t_ewidget
428 {
429  t_getrectfn w_getrectfn;
430  t_displacefn w_displacefn;
431  t_selectfn w_selectfn;
432  t_activatefn w_activatefn;
433  t_deletefn w_deletefn;
434  t_visfn w_visfn;
435  t_clickfn w_clickfn;
457 } t_ewidget;
458 
464 typedef struct t_eattr
465 {
472  long order;
473  char save;
474  char paint;
475  char invisible;
476  long flags;
477  long offset;
478  long sizemax;
479  long size;
483  long clipped;
484  float minimum;
485  float maximum;
486  float step;
489  long itemssize;
490 } t_eattr;
491 
492 
498 typedef struct t_eclass
499 {
500  t_class c_class;
501  char c_box;
502  char c_dsp;
505  long c_nattr;
506 }t_eclass;
507 
521 typedef struct t_eproxy
522 {
525  t_inlet* p_inlet;
526  int p_index;
527 } t_eproxy;
528 
535 typedef struct t_eobj
536 {
539  t_canvas* o_canvas;
541  int o_nproxy;
543 }t_eobj;
544 
559 typedef struct t_edsp
560 {
561  float d_float;
562  long d_size;
563  t_int* d_vectors;
564  long d_flags;
565  void* d_user_param;
566  t_float** d_sigs_out;
567  t_float* d_sigs_real;
569  long d_misc;
570 }t_edsp;
571 
577 typedef enum
578 {
579  E_INPLACE = 0,
581 } edsp_flags;
582 
589 typedef struct t_edspobj
590 {
593 }t_edspobj;
594 
608 typedef enum emod_flags
609 {
610  EMOD_NONE = 0,
612  EMOD_MAJ = 2,
613  EMOD_CTRL = 4,
614  EMOD_CMD = 8,
615  EMOD_ALT = 16,
617 } emod_flags;
618 
624 typedef enum ekey_flags
625 {
626  EKEY_DEL = 0,
627  EKEY_TAB = 1,
629  EKEY_ESC = 3
631 } ekey_flags;
632 
634 typedef enum eselitem_flags
635 {
636  EITEM_NONE = 0,
637  EITEM_OBJ = 1,
638  EITEM_INLET = 2,
639  EITEM_OUTLET = 3,
640  EITEM_BOTTOM = 4,
641  EITEM_CORNER = 5,
642  EITEM_RIGHT = 6
643 } eselitem_flags;
645 
651 typedef enum
652 {
653  EBOX_GROWNO = (1<<4),
654  EBOX_GROWLINK = (1<<5),
655  EBOX_GROWINDI = (1<<6),
657 } ebox_flags;
658 
664 typedef enum
665 {
672  ECURSOR_X = 6,
679 } ebox_cursors;
680 
686 typedef struct t_edrawparams
687 {
688  float d_cornersize;
693 } t_edrawparams;
694 
701 typedef struct t_ebox
702 {
704 
714  long b_flags;
725  char b_visible;
733 }t_ebox;
734 
745 typedef struct t_edspbox
746 {
758  long b_flags;
769  char b_visible;
779 }t_edspbox;
780 
781 
782 
783 #endif
Definition: edefine.h:655
float y
Definition: edefine.h:230
t_symbol * b_objpreset_id
Definition: edefine.h:707
t_efont e_font
Definition: edefine.h:361
t_symbol * s_double
The pre-defined double t_symbol*.
Definition: ecommon.c:23
t_symbol ** itemslist
Definition: edefine.h:488
float lightness
Definition: edefine.h:284
t_selectfn w_selectfn
Definition: edefine.h:431
Definition: edefine.h:612
t_class c_class
Definition: edefine.h:500
Definition: edefine.h:149
t_symbol * b_window_id
Definition: edefine.h:755
Definition: edefine.h:169
t_err_method w_notify
Definition: edefine.h:454
Definition: edefine.h:611
t_rgba d_boxfillcolor
Definition: edefine.h:691
t_symbol * e_name
Definition: edefine.h:376
t_symbol * b_receive_id
Definition: edefine.h:705
t_float * d_sigs_real
Definition: edefine.h:567
float hue
Definition: edefine.h:294
t_typ_method w_mousemove
Definition: edefine.h:440
float hue
Definition: edefine.h:282
t_float ** d_sigs_out
Definition: edefine.h:566
Definition: edefine.h:580
const t_rgba rgba_greydark
The pre-defined grey dark t_rgba.
Definition: egraphics.c:18
Definition: edefine.h:196
int b_selected_outlet
Definition: edefine.h:721
Definition: edefine.h:677
float blue
Definition: edefine.h:259
Definition: edefine.h:675
float green
Definition: edefine.h:270
t_rect b_rect_last
Definition: edefine.h:716
long flags
Definition: edefine.h:476
float blue
Definition: edefine.h:271
Definition: edefine.h:614
t_typ_method w_mousedrag
Definition: edefine.h:442
long e_number_objects
Definition: edefine.h:386
Definition: edefine.h:627
t_symbol * b_all_id
Definition: edefine.h:756
float width
Definition: edefine.h:231
t_activatefn w_activatefn
Definition: edefine.h:432
t_symbol * c_slant
Definition: edefine.h:327
t_typ_method w_assist
Definition: edefine.h:436
t_symbol * c_justify
Definition: edefine.h:343
t_object obj
Definition: edefine.h:466
t_typ_method w_paint
Definition: edefine.h:437
Definition: edefine.h:673
char c_box
Definition: edefine.h:501
char c_dsp
Definition: edefine.h:502
Definition: edefine.h:138
float y
Definition: edefine.h:219
long e_npoints
Definition: edefine.h:359
long d_flags
Definition: edefine.h:564
float e_roundness
Definition: edefine.h:360
t_matrix e_matrix
Definition: edefine.h:383
Definition: edefine.h:667
t_ewidget c_widget
Definition: edefine.h:503
t_symbol * e_color
Definition: edefine.h:355
char b_ready_to_draw
Definition: edefine.h:770
t_typ_method w_dsp
Definition: edefine.h:452
Definition: edefine.h:671
float y0
Definition: edefine.h:247
t_err_method setter
Definition: edefine.h:482
char b_mouse_down
Definition: edefine.h:767
etextanchor_flags
The flags that defines the text anchor.
Definition: edefine.h:147
t_pd p_pd
Definition: edefine.h:523
float saturation
Definition: edefine.h:283
Definition: edefine.h:613
long b_number_of_layers
Definition: edefine.h:776
t_symbol * e_anchor
Definition: edefine.h:362
Definition: edefine.h:150
t_symbol * s_size
The pre-defined size t_symbol*.
Definition: ecommon.c:20
t_edsp d_dsp
Definition: edefine.h:592
t_rgba c_color
Definition: edefine.h:339
t_edsp d_dsp
Definition: edefine.h:778
t_typ_method w_mousedown
Definition: edefine.h:441
float e_width
Definition: edefine.h:356
ebox_cursors
The cursors that can be used.
Definition: edefine.h:664
Definition: edefine.h:579
The class.
Definition: edefine.h:498
t_egobj e_new_objects
Definition: edefine.h:384
The attribute.
Definition: edefine.h:464
t_symbol * b_canvas_id
Definition: edefine.h:709
char paint
Definition: edefine.h:474
t_symbol * e_text
Definition: edefine.h:364
The default method of a class.
Definition: edefine.h:427
t_symbol * c_send
Definition: edefine.h:406
long c_nattr
Definition: edefine.h:505
char b_isinsubcanvas
Definition: edefine.h:772
Definition: edefine.h:669
t_typ_method w_oksize
Definition: edefine.h:453
Definition: edefine.h:666
t_pd_err(* t_err_method)(void *x,...)
The error method.
Definition: edefine.h:75
t_symbol * e_id
Definition: edefine.h:377
const t_rgba rgba_grey
The pre-defined grey t_rgba.
Definition: egraphics.c:19
char invisible
Definition: edefine.h:475
const t_rgba rgba_blue
The pre-defined blue t_rgba.
Definition: egraphics.c:22
t_typ_method w_keyfilter
Definition: edefine.h:447
long b_flags
Definition: edefine.h:758
float step
Definition: edefine.h:486
Definition: edefine.h:610
t_rect c_rect
Definition: edefine.h:341
Definition: edefine.h:154
t_typ_method w_popup
Definition: edefine.h:451
char b_visible
Definition: edefine.h:769
Definition: edefine.h:195
t_getrectfn w_getrectfn
Definition: edefine.h:429
float alpha
Definition: edefine.h:272
const t_rgba rgba_green
The pre-defined green t_rgba.
Definition: egraphics.c:23
Definition: edefine.h:152
t_symbol * b_send_id
Definition: edefine.h:706
ebox_flags
The flags that discribe the behavior of a t_ebox.
Definition: edefine.h:651
int e_line_width
Definition: edefine.h:382
char b_isinsubcanvas
Definition: edefine.h:728
float c_size
Definition: edefine.h:324
t_symbol * o_id
Definition: edefine.h:538
t_canvas * o_canvas
Definition: edefine.h:539
The t_symbol struture.
Definition: enative.h:46
edsp_flags
The flags that discribe the behavior of a t_edspobj.
Definition: edefine.h:577
The t_object struture.
Definition: enative.h:143
char save
Definition: edefine.h:473
float x0
Definition: edefine.h:246
float red
Definition: edefine.h:257
Definition: edefine.h:197
t_typ_method w_write
Definition: edefine.h:455
Definition: edefine.h:180
char b_have_window
Definition: edefine.h:771
Definition: edefine.h:674
egraphics_types e_type
Definition: edefine.h:353
epath_types
The types of path.
Definition: edefine.h:205
etextwrap_flags
The flags that defines if the text should be wrapped.
Definition: edefine.h:166
t_efont b_font
Definition: edefine.h:717
float x
Definition: edefine.h:229
The popup structure.
Definition: edefine.h:403
Definition: edefine.h:615
int p_index
Definition: edefine.h:526
Definition: edefine.h:193
t_symbol * b_receive_id
Definition: edefine.h:749
t_symbol * b_all_id
Definition: edefine.h:712
t_object * p_owner
Definition: edefine.h:524
t_symbol * s_null
The pre-defined ("null") t_symbol*.
Definition: ecommon.c:14
The default object.
Definition: edefine.h:535
The Proxy object.
Definition: edefine.h:521
long d_size
Definition: edefine.h:562
Definition: edefine.h:208
float alpha
Definition: edefine.h:297
long itemssize
Definition: edefine.h:489
t_symbol * defvals
Definition: edefine.h:487
Definition: edefine.h:168
t_visfn w_visfn
Definition: edefine.h:434
const t_rgba rgba_red
The pre-defined red t_rgba.
Definition: egraphics.c:24
t_symbol * style
Definition: edefine.h:471
t_efont b_font
Definition: edefine.h:761
t_eobj b_obj
Definition: edefine.h:747
float d_cornersize
Definition: edefine.h:688
Definition: edefine.h:207
char b_mouse_down
Definition: edefine.h:723
Definition: edefine.h:194
int e_state
Definition: edefine.h:378
int b_selected_item
Definition: edefine.h:719
float yy
Definition: edefine.h:245
The DSP structure.
Definition: edefine.h:559
The DSP object.
Definition: edefine.h:589
t_typ_method w_mousewheel
Definition: edefine.h:444
t_symbol * c_name
Definition: edefine.h:405
t_int * d_vectors
Definition: edefine.h:563
Definition: edefine.h:181
t_symbol * c_weight
Definition: edefine.h:328
long size
Definition: edefine.h:479
int o_current_proxy
Definition: edefine.h:542
ekey_flags
The system keys.
Definition: edefine.h:624
float yx
Definition: edefine.h:243
Definition: edefine.h:672
void(* t_typ_method)(void *x,...)
The standart method.
Definition: edefine.h:71
long t_pd_err
The error type.
Definition: edefine.h:69
Definition: edefine.h:156
t_eobj d_obj
Definition: edefine.h:591
Definition: edefine.h:626
t_pt * e_points
Definition: edefine.h:358
float d_float
Definition: edefine.h:561
t_symbol * s_eboxio
The pre-defined eboxio t_symbol*.
Definition: ecommon.c:19
t_symbol * e_justify
Definition: edefine.h:363
Definition: edefine.h:656
t_symbol * s_atom
The pre-defined atom t_symbol*.
Definition: ecommon.c:15
t_deletefn w_deletefn
Definition: edefine.h:433
float x
Definition: edefine.h:218
t_displacefn w_displacefn
Definition: edefine.h:430
t_symbol * c_anchor
Definition: edefine.h:342
t_typ_method w_key
Definition: edefine.h:446
Definition: edefine.h:139
t_class * t_pd
pure datum: nothing but a class pointer
Definition: enative.h:125
float xy
Definition: edefine.h:244
long b_number_of_layers
Definition: edefine.h:732
t_typ_method w_dblclick
Definition: edefine.h:445
t_typ_method w_read
Definition: edefine.h:456
long b_flags
Definition: edefine.h:714
t_object * e_owner
Definition: edefine.h:375
t_typ_method w_mouseup
Definition: edefine.h:443
t_eobj b_obj
The object.
Definition: edefine.h:703
t_symbol * c_text
Definition: edefine.h:338
float saturation
Definition: edefine.h:295
Definition: edefine.h:191
Definition: edefine.h:136
egraphics_types
The types of graphical object.
Definition: edefine.h:189
t_rect b_rect
Definition: edefine.h:759
int b_selected_inlet
Definition: edefine.h:720
Definition: edefine.h:157
Definition: edefine.h:653
const t_rgba rgba_white
The pre-defined white t_rgba.
Definition: egraphics.c:21
Definition: edefine.h:151
t_symbol * e_color
Definition: edefine.h:381
t_symbol * s_long
The pre-defined long t_symbol*.
Definition: ecommon.c:22
t_object o_obj
Definition: edefine.h:537
t_elayer * b_layers
Definition: edefine.h:775
emod_flags
The mouse modifiers.
Definition: edefine.h:608
long c_sizereal
Definition: edefine.h:325
int b_selected_box
Definition: edefine.h:718
Definition: edefine.h:628
t_symbol * category
Definition: edefine.h:469
t_typ_method w_save
Definition: edefine.h:449
float height
Definition: edefine.h:232
t_efont c_font
Definition: edefine.h:340
t_rgba d_bordercolor
Definition: edefine.h:690
t_eproxy ** o_proxy
Definition: edefine.h:540
t_rect b_rect
Definition: edefine.h:715
float lightness
Definition: edefine.h:296
int o_nproxy
Definition: edefine.h:541
t_symbol * s_int
The pre-defined int t_symbol*.
Definition: ecommon.c:21
t_symbol * b_canvas_id
Definition: edefine.h:753
int b_selected_box
Definition: edefine.h:762
int e_filled
Definition: edefine.h:354
t_symbol * c_family
Definition: edefine.h:326
Definition: edefine.h:153
float green
Definition: edefine.h:258
t_symbol * s_eboxbd
The pre-defined eboxbd t_symbol*.
Definition: ecommon.c:18
t_elayer * b_layers
Definition: edefine.h:731
t_edrawparams b_boxparameters
Definition: edefine.h:729
t_symbol * name
Definition: edefine.h:467
float d_borderthickness
Definition: edefine.h:689
t_symbol * b_drawing_id
Definition: edefine.h:754
long clipped
Definition: edefine.h:483
The font structure.
Definition: edefine.h:322
The drawing object.
Definition: edefine.h:351
The drawing layer.
Definition: edefine.h:373
Definition: edefine.h:192
A rectangle structure.
Definition: edefine.h:227
A rgb color structure.
Definition: edefine.h:255
A rgba color structure.
Definition: edefine.h:267
The text structure.
Definition: edefine.h:336
A hsl color structure.
Definition: edefine.h:280
A hsla color structure.
Definition: edefine.h:292
t_typ_method w_mouseleave
Definition: edefine.h:439
A matrix structure.
Definition: edefine.h:240
A point structure.
Definition: edefine.h:216
t_typ_method w_dosave
Definition: edefine.h:450
const t_rgba rgba_greylight
The pre-defined grey light t_rgba.
Definition: egraphics.c:20
t_typ_method w_mouseenter
Definition: edefine.h:438
t_symbol * b_drawing_id
Definition: edefine.h:710
char b_have_window
Definition: edefine.h:727
int b_selected_outlet
Definition: edefine.h:765
const t_rgba rgba_black
The pre-defined black t_rgba.
Definition: egraphics.c:17
Definition: edefine.h:179
t_symbol * b_send_id
Definition: edefine.h:750
Definition: edefine.h:676
long offset
Definition: edefine.h:477
t_symbol * label
Definition: edefine.h:470
Definition: edefine.h:678
Definition: edefine.h:668
long order
Definition: edefine.h:472
t_inlet * p_inlet
Definition: edefine.h:525
float minimum
Definition: edefine.h:484
t_symbol * s_obj
The pre-defined obj t_symbol*.
Definition: ecommon.c:16
t_symbol * s_attr_modified
The pre-defined attr_modified t_symbol*.
Definition: ecommon.c:17
t_rect b_rect_last
Definition: edefine.h:760
Definition: edefine.h:137
t_typ_method w_getdrawparameters
Definition: edefine.h:448
float xx
Definition: edefine.h:242
The drawing parameters.
Definition: edefine.h:686
The GUI DSP object.
Definition: edefine.h:745
The GUI object.
Definition: edefine.h:701
t_err_method getter
Definition: edefine.h:481
char b_visible
Definition: edefine.h:725
t_symbol * b_objpreset_id
Definition: edefine.h:751
t_clickfn w_clickfn
Definition: edefine.h:435
long sizemax
Definition: edefine.h:478
t_egobj * e_objects
Definition: edefine.h:385
int b_selected_item
Definition: edefine.h:763
Definition: edefine.h:155
t_rect e_rect
Definition: edefine.h:379
t_eattr ** c_attr
Definition: edefine.h:504
t_symbol * b_window_id
Definition: edefine.h:711
Definition: edefine.h:616
t_symbol * type
Definition: edefine.h:468
char b_ready_to_draw
Definition: edefine.h:726
t_edrawparams b_boxparameters
Definition: edefine.h:773
Definition: edefine.h:654
t_typ_method d_perform_method
Definition: edefine.h:568
float maximum
Definition: edefine.h:485
elayer_flags
The flags that defines the status of a layer.
Definition: edefine.h:134
etextjustify_flags
The flags that define the text justification.
Definition: edefine.h:177
Definition: edefine.h:629
int b_selected_inlet
Definition: edefine.h:764
void * d_user_param
Definition: edefine.h:565
Definition: edefine.h:670
long d_misc
Definition: edefine.h:569
float red
Definition: edefine.h:269