1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
| /*
* File: helloworld_class.c
* Author: abu
*
* Created on 23 février 2009, 09:51
*/
#include <stdio.h>
#include <stdlib.h>
#include <m_pd.h>
/*
*
*/
static t_class *helloworld_class;
typedef struct _helloworld // Espace de données de la classe
{
t_object x_obj; // Variable de type t_object
}t_helloworld;
// Méthodes (manipulateur de la classe t_class
void helloworld_bang(t_helloworld *x) // Méthode de type t_helloworld
{
post("Helllo World !!");
}
// Constructeur
void *helloworld_new(void)
{
t_helloworld *x = (t_helloworld *)pd_new(helloworld_class);
return (void *)x;
}
void helloworld_setup(void) // Generation de la nouvelle classe
{
helloworld_class = class_new(gensym("helloworld"),
(t_newmethod)helloworld_new,
0, sizeof(t_helloworld),
CLASS_DEFAULT, 0);
class_addbang(helloworld_class, helloworld_bang);
} |