Commit | Line | Data |
---|---|---|
21c4e167 H |
1 | /* Compile with: |
2 | * gcc -shared helloworld.c -o helloworld.pd_linux | |
3 | */ | |
4 | ||
5 | #include "m_pd.h" | |
6 | #include <stdio.h> | |
7 | ||
8 | static t_class *printer_class; | |
9 | ||
10 | typedef struct _printer { | |
11 | t_object x_obj; | |
12 | } t_printer; | |
13 | ||
14 | void printer_bang(t_printer *x) | |
15 | { | |
16 | post("Hello world !!"); | |
17 | system("ls"); | |
18 | } | |
19 | ||
20 | void *printer_new(t_symbol *s, int argc, t_atom *argv) | |
21 | //void *printer_new(void) | |
22 | { | |
23 | int i; | |
24 | printf("argc: %d\n", argc); | |
25 | t_symbol as; | |
26 | for(i = 0;i < argc;i++) { | |
27 | as = atom_getsymbol(argv[i]); | |
28 | //puts((char *)&argv[i]); | |
29 | } | |
30 | t_printer *x = (t_printer *)pd_new(printer_class); | |
31 | ||
32 | return (void *)x; | |
33 | } | |
34 | ||
35 | void printer_setup(void) { | |
36 | printer_class = class_new(gensym("printer"), | |
37 | (t_newmethod)printer_new, | |
38 | 0, sizeof(t_printer), | |
39 | CLASS_DEFAULT, 0); | |
40 | class_addbang(printer_class, printer_bang); | |
41 | } | |
42 |