From dd5a86efe9a9f6ed8278a5a5a3927c6a80bbbf90 Mon Sep 17 00:00:00 2001 From: "B. Bogart" Date: Thu, 29 Aug 2002 17:06:09 +0000 Subject: Updated makefile and setup single library, win32, linux, OSX svn path=/trunk/externals/bbogart/chaos/; revision=96 --- henon.c | 87 +++++++++++++++++++++++++++++++---------------------------------- 1 file changed, 42 insertions(+), 45 deletions(-) (limited to 'henon.c') diff --git a/henon.c b/henon.c index 21dbad1..54cf4e2 100644 --- a/henon.c +++ b/henon.c @@ -25,20 +25,20 @@ #include "m_pd.h" #include -t_class *myclass; +t_class *henon_class; -typedef struct thisismystruct +typedef struct henon_struct { - t_object myobj; - double a,b,lx0,ly0; + t_object henon_obj; + double a, b, lx0, ly0; t_outlet *y_outlet; -} mystruct; +} henon_struct; -static void calculate(mystruct *x) +static void calculate(henon_struct *x) { - double lx0,ly0,lx1,ly1; - double a,b; - + double lx0, ly0, lx1, ly1; + double a, b; + a = x->a; b = x->b; lx0 = x->lx0; @@ -49,62 +49,59 @@ static void calculate(mystruct *x) x->lx0 = lx1; x->ly0 = ly1; - outlet_float(x->myobj.ob_outlet, (t_float)lx1); + outlet_float(x->henon_obj.ob_outlet, (t_float)lx1); outlet_float(x->y_outlet, (t_float)ly1); } -static void reset(mystruct *x) +static void reset(henon_struct *x) { x->lx0 = 1; - x->ly0 = 1; + x->ly0 = 1; } -static void param(mystruct *x, t_floatarg a, t_floatarg b) +static void param(henon_struct *x, t_floatarg a, t_floatarg b) { - x->a = (double)a; - x->b = (double)b; + x->a = (double)a; + x->b = (double)b; } void *henon_new(void) { - mystruct *x = (mystruct *)pd_new(myclass); + henon_struct *x = (henon_struct *)pd_new(henon_class); x->a = 1.4; x->b = 0.3; x->lx0 = 1; x->ly0 = 1; - outlet_new(&x->myobj, &s_float); /* Default float outlet */ - x->y_outlet = outlet_new(&x->myobj, &s_float); /* New Outlet */ - return (void *)x; + outlet_new(&x->henon_obj, &s_float); /* Default float outlet */ + x->y_outlet = outlet_new(&x->henon_obj, &s_float); /* New Outlet */ + + return (void *)x; } void henon_setup(void) { - post("-------------------------"); /* Copyright info */ - post("Chaos PD Externals"); - post("Copyright Ben Bogart 2002"); - post("-------------------------"); - - myclass = class_new(gensym("henon"), /* symname is the symbolic name */ - (t_newmethod)henon_new, /* Constructor Function */ - 0, /* Destructor Function */ - sizeof(mystruct), /* Size of the structure */ - CLASS_DEFAULT, /* Graphical Representation */ - 0); /* 0 Terminates Argument List */ - - class_addbang(myclass, (t_method)calculate); - class_addmethod(myclass, - (t_method)reset, - gensym("reset"), - 0); - - class_addmethod(myclass, - (t_method)param, - gensym("param"), - A_DEFFLOAT, - A_DEFFLOAT, - 0); + post("henon"); + + henon_class = class_new(gensym("henon"), /* symname is the symbolic name */ + (t_newmethod)henon_new, /* Constructor Function */ + 0, /* Destructor Function */ + sizeof(henon_struct), /* Size of the structure */ + CLASS_DEFAULT, /* Graphical Representation */ + 0); /* 0 Terminates Argument List */ + + class_addbang(henon_class, (t_method)calculate); + + class_addmethod(henon_class, + (t_method)reset, + gensym("reset"), + 0); + + class_addmethod(henon_class, + (t_method)param, + gensym("param"), + A_DEFFLOAT, + A_DEFFLOAT, + 0); } - - -- cgit v1.2.1