Thanks to Han's help page (http://puredata.info/docs/developer/mingw) I was able to compile a test external on windows with mingw.
I then started making a new external called getdollarzero based on getdir (from ggee) and parentdollarzero (from iemlib2). I compiled it and it works but I had to:
My question is the following: why is there a hack in the first place? If I do not use it will my code crash PD in some way (I compiled against PD 0.4and worked fine during testing)?
As a reference, here is my code with the hack commented out :
--------- getdollarzero --------
#include "m_pd.h" #include "g_canvas.h" //needed to include g_canvas.h once the hack was commented out
/* HACK struct _glist { t_object gl_obj; // header in case we're a glist t_gobj *gl_list; // the actual data struct _gstub *gl_stub; // safe pointer handler int gl_valid; // incremented when pointers might be stale struct _glist *gl_owner; // parent glist, supercanvas, or 0 if none };
END HACK */
typedef struct getdollarzero { t_object x_ob; t_canvas * x_canvas; t_outlet* x_outlet; int x_level; } t_getdollarzero;
static void getdollarzero_bang(t_getdollarzero *x) { int i = x->x_level; t_canvas* last = x->x_canvas;
while (i>0) {
i--;
if (last->gl_owner) last = last->gl_owner;
}
// code example taken from iemlib2's parentdollarzero:
// x->s_parent_unique = canvas_realizedollar((t_canvas
*)this_canvas->gl_owner, gensym("$0")); // original get dir function: //outlet_symbol(x->x_outlet,canvas_getdir(last));
outlet_symbol(x->x_outlet,canvas_realizedollar(last, gensym("$0")));
}
t_class *getdollarzero_class;
static void *getdollarzero_new(t_floatarg level) { t_getdollarzero *x = (t_getdollarzero *)pd_new(getdollarzero_class); x->x_canvas = canvas_getcurrent(); x->x_outlet = outlet_new(&x->x_ob, &s_); x->x_level = level; return (void *)x; }
void getdollarzero_setup(void) { getdollarzero_class = class_new(gensym("getdollarzero"), (t_newmethod)getdollarzero_new, 0, sizeof(t_getdollarzero), 0, A_DEFFLOAT,0); class_addbang(getdollarzero_class, getdollarzero_bang); }
--------- getdollarzero end --------
Hey,
I think Günter didn't want to depend on non-public headers like
g_canvas.h, so included the glist struct from that header.
Personally, I think makes more sense to include the g_canvas.h header.
[parentdollarzero] like a useful object, I am not usre what
[getdollarzero] does beyond [float $0] or [$0]. Anyway, hopefully
they make into Pd-extended.
.hc
On Aug 27, 2007, at 4:43 PM, Thomas O Fredericks wrote:
Thanks to Han's help page (http://puredata.info/docs/developer/ mingw) I was able to compile a test external on windows with mingw.
I then started making a new external called getdollarzero based on
getdir (from ggee) and parentdollarzero (from iemlib2). I compiled
it and it works but I had to:
- remove Guenter's hack from getdir's source code
- and therefore include g_canvas.h
My question is the following: why is there a hack in the first
place? If I do not use it will my code crash PD in some way (I
compiled against PD 0.4 and worked fine during testing)?As a reference, here is my code with the hack commented out :
--------- getdollarzero --------
#include "m_pd.h" #include "g_canvas.h" //needed to include g_canvas.h once the hack
was commented out/* HACK struct _glist { t_object gl_obj; // header in case we're a glist t_gobj *gl_list; // the actual data struct _gstub *gl_stub; // safe pointer handler int gl_valid; // incremented when pointers might
be stale struct _glist *gl_owner; // parent glist, supercanvas, or 0
if none };END HACK */
typedef struct getdollarzero { t_object x_ob; t_canvas * x_canvas; t_outlet* x_outlet; int x_level; } t_getdollarzero;
static void getdollarzero_bang(t_getdollarzero *x) { int i = x->x_level; t_canvas* last = x->x_canvas;
while (i>0) { i--; if (last->gl_owner) last = last->gl_owner; } // code example taken from iemlib2's parentdollarzero: // x->s_parent_unique = canvas_realizedollar((t_canvas *)
this_canvas->gl_owner, gensym("$0")); // original get dir function: //outlet_symbol(x->x_outlet,canvas_getdir(last));
outlet_symbol(x->x_outlet,canvas_realizedollar(last, gensym
("$0"))); }
t_class *getdollarzero_class;
static void *getdollarzero_new(t_floatarg level) { t_getdollarzero *x = (t_getdollarzero *)pd_new (getdollarzero_class); x->x_canvas = canvas_getcurrent(); x->x_outlet = outlet_new(&x->x_ob, &s_); x->x_level = level; return (void *)x; }
void getdollarzero_setup(void) { getdollarzero_class = class_new(gensym("getdollarzero"),
(t_newmethod)getdollarzero_new, 0, sizeof(t_getdollarzero), 0, A_DEFFLOAT,0); class_addbang(getdollarzero_class, getdollarzero_bang); }--------- getdollarzero end --------
-- thomas ouellet fredericks, tof@danslchamp.org, montreal, canada _______________________________________________ PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/ listinfo/pd-list
Computer science is no more related to the computer than astronomy is
related to the telescope. -Edsger Dykstra
getdollarzero can get the dollar zero of any parent. For example, lets say a patch called "top" contains the abstraction 1. The abstraction 1 contains the abstraction 2. The abstraction 2 contains the abstraction 3. Well, with getdollarzero, abstraction 1 through 3 can know the dollar zero of the patch "top". The patch "top" becomes the "root" patch. All the abstractions 1 through 3 have in common this "root" patch.
This is what I needed it for:
"$0" arguments (of Memento for example). The state of all elements that have the same "root" patch are saved together. 2) I am also creating a timing architecture for PD and I wanted all elements in the same "root" to be synchronized together.
Tom
On 8/29/07, Hans-Christoph Steiner hans@eds.org wrote:
Hey,
I think Günter didn't want to depend on non-public headers like g_canvas.h, so included the glist struct from that header. Personally, I think makes more sense to include the g_canvas.h header.
[parentdollarzero] like a useful object, I am not usre what [getdollarzero] does beyond [float $0] or [$0]. Anyway, hopefully they make into Pd-extended.
.hc
On Aug 27, 2007, at 4:43 PM, Thomas O Fredericks wrote:
Thanks to Han's help page (http://puredata.info/docs/developer/mingw) I was able to compile a test external on windows with mingw.
I then started making a new external called getdollarzero based on getdir (from ggee) and parentdollarzero (from iemlib2). I compiled it and it works but I had to:
- remove Guenter's hack from getdir's source code
- and therefore include g_canvas.h
My question is the following: why is there a hack in the first place? If I do not use it will my code crash PD in some way (I compiled against PD 0.4and worked fine during testing)?
As a reference, here is my code with the hack commented out :
--------- getdollarzero --------
#include "m_pd.h" #include "g_canvas.h" //needed to include g_canvas.h once the hack was commented out
/* HACK struct _glist { t_object gl_obj; // header in case we're a glist t_gobj *gl_list; // the actual data struct _gstub *gl_stub; // safe pointer handler int gl_valid; // incremented when pointers might be stale struct _glist *gl_owner; // parent glist, supercanvas, or 0 if none };
END HACK */
typedef struct getdollarzero { t_object x_ob; t_canvas * x_canvas; t_outlet* x_outlet; int x_level; } t_getdollarzero;
static void getdollarzero_bang(t_getdollarzero *x) { int i = x->x_level; t_canvas* last = x->x_canvas;
while (i>0) { i--; if (last->gl_owner) last = last->gl_owner; } // code example taken from iemlib2's parentdollarzero: // x->s_parent_unique = canvas_realizedollar((t_canvas
*)this_canvas->gl_owner, gensym("$0")); // original get dir function: //outlet_symbol(x->x_outlet,canvas_getdir(last));
outlet_symbol(x->x_outlet,canvas_realizedollar(last, gensym("$0")));
}
t_class *getdollarzero_class;
static void *getdollarzero_new(t_floatarg level) { t_getdollarzero *x = (t_getdollarzero *)pd_new(getdollarzero_class); x->x_canvas = canvas_getcurrent(); x->x_outlet = outlet_new(&x->x_ob, &s_); x->x_level = level; return (void *)x; }
void getdollarzero_setup(void) { getdollarzero_class = class_new(gensym("getdollarzero"), (t_newmethod)getdollarzero_new, 0, sizeof(t_getdollarzero), 0, A_DEFFLOAT,0); class_addbang(getdollarzero_class, getdollarzero_bang); }
--------- getdollarzero end --------
-- thomas ouellet fredericks, tof@danslchamp.org, montreal, canada _______________________________________________ PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Computer science is no more related to the computer than astronomy is related to the telescope. -Edsger Dykstra
Oh yeah, attached is the source code and compiled versions for linux and window. I do not have cvs access. Could someone please include it in the cvs and adapt the makefile accordingly? Also could someone compile it for OS X intel and PPC and send me the binary?
Tom
On 8/29/07, Thomas O Fredericks tof@danslchamp.org wrote:
getdollarzero can get the dollar zero of any parent. For example, lets say a patch called "top" contains the abstraction 1. The abstraction 1 contains the abstraction 2. The abstraction 2 contains the abstraction 3. Well, with getdollarzero, abstraction 1 through 3 can know the dollar zero of the patch "top". The patch "top" becomes the "root" patch. All the abstractions 1 through 3 have in common this "root" patch.
This is what I needed it for:
- I am currently developing a state saving system that does not require
the "$0" arguments (of Memento for example). The state of all elements that have the same "root" patch are saved together. 2) I am also creating a timing architecture for PD and I wanted all elements in the same "root" to be synchronized together.
Tom
On 8/29/07, Hans-Christoph Steiner hans@eds.org wrote:
Hey,
I think Günter didn't want to depend on non-public headers like g_canvas.h, so included the glist struct from that header. Personally, I think makes more sense to include the g_canvas.h header.
[parentdollarzero] like a useful object, I am not usre what [getdollarzero] does beyond [float $0] or [$0]. Anyway, hopefully they make into Pd-extended.
.hc
On Aug 27, 2007, at 4:43 PM, Thomas O Fredericks wrote:
Thanks to Han's help page ( http://puredata.info/docs/developer/mingw) I was able to compile a test external on windows with mingw.
I then started making a new external called getdollarzero based on getdir (from ggee) and parentdollarzero (from iemlib2). I compiled it and it works but I had to:
- remove Guenter's hack from getdir's source code
- and therefore include g_canvas.h
My question is the following: why is there a hack in the first place? If I do not use it will my code crash PD in some way (I compiled against PD 0.4 and worked fine during testing)?
As a reference, here is my code with the hack commented out :
--------- getdollarzero --------
#include "m_pd.h" #include "g_canvas.h" //needed to include g_canvas.h once the hack was commented out
/* HACK struct _glist { t_object gl_obj; // header in case we're a glist t_gobj *gl_list; // the actual data struct _gstub *gl_stub; // safe pointer handler int gl_valid; // incremented when pointers might be stale struct _glist *gl_owner; // parent glist, supercanvas, or 0 if none };
END HACK */
typedef struct getdollarzero { t_object x_ob; t_canvas * x_canvas; t_outlet* x_outlet; int x_level; } t_getdollarzero;
static void getdollarzero_bang(t_getdollarzero *x) { int i = x->x_level; t_canvas* last = x->x_canvas;
while (i>0) { i--; if (last->gl_owner) last = last->gl_owner; } // code example taken from iemlib2's parentdollarzero: // x->s_parent_unique = canvas_realizedollar((t_canvas
*)this_canvas->gl_owner, gensym("$0")); // original get dir function: //outlet_symbol(x->x_outlet,canvas_getdir(last));
outlet_symbol(x->x_outlet,canvas_realizedollar(last, gensym("$0")));
}
t_class *getdollarzero_class;
static void *getdollarzero_new(t_floatarg level) { t_getdollarzero *x = (t_getdollarzero *)pd_new(getdollarzero_class);
x->x_canvas = canvas_getcurrent(); x->x_outlet = outlet_new(&x->x_ob, &s_); x->x_level = level; return (void *)x;
}
void getdollarzero_setup(void) { getdollarzero_class = class_new(gensym("getdollarzero"), (t_newmethod)getdollarzero_new, 0, sizeof(t_getdollarzero), 0, A_DEFFLOAT,0); class_addbang(getdollarzero_class, getdollarzero_bang); }
--------- getdollarzero end --------
-- thomas ouellet fredericks, tof@danslchamp.org, montreal, canada _______________________________________________ PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Computer science is no more related to the computer than astronomy is related to the telescope. -Edsger Dykstra
-- thomas ouellet fredericks, tof@danslchamp.org, montreal, canada
If you would like to be added as a developer on the pure-data CVS,
just send an email to pd-dev introducing yourself and a brief
explanation of what you are working on and why you want to be added
as a developer. I think no one will object.
.hc
On Aug 29, 2007, at 6:17 PM, Thomas O Fredericks wrote:
Oh yeah, attached is the source code and compiled versions for
linux and window. I do not have cvs access. Could someone please
include it in the cvs and adapt the makefile accordingly? Also
could someone compile it for OS X intel and PPC and send me the
binary?Tom
On 8/29/07, Thomas O Fredericks tof@danslchamp.org wrote: getdollarzero can get the dollar zero of any parent. For example, lets say a patch called "top" contains the abstraction 1. The abstraction 1 contains the abstraction 2. The abstraction 2 contains the abstraction 3. Well, with getdollarzero, abstraction 1 through 3 can know the
dollar zero of the patch "top". The patch "top" becomes the "root" patch. All the abstractions 1 through 3 have in common this "root" patch.This is what I needed it for:
- I am currently developing a state saving system that does not
require the "$0" arguments (of Memento for example). The state of
all elements that have the same "root" patch are saved together. 2) I am also creating a timing architecture for PD and I wanted all
elements in the same "root" to be synchronized together.Tom
On 8/29/07, Hans-Christoph Steiner hans@eds.org wrote:
Hey,
I think Günter didn't want to depend on non-public headers like
g_canvas.h, so included the glist struct from that header.
Personally, I think makes more sense to include the g_canvas.h header.[parentdollarzero] like a useful object, I am not usre what
[getdollarzero] does beyond [float $0] or [$0]. Anyway, hopefully
they make into Pd-extended..hc
On Aug 27, 2007, at 4:43 PM, Thomas O Fredericks wrote:
Thanks to Han's help page ( http://puredata.info/docs/developer/ mingw) I was able to compile a test external on windows with mingw.
I then started making a new external called getdollarzero based on
getdir (from ggee) and parentdollarzero (from iemlib2). I compiled
it and it works but I had to:
- remove Guenter's hack from getdir's source code
- and therefore include g_canvas.h
My question is the following: why is there a hack in the first
place? If I do not use it will my code crash PD in some way (I
compiled against PD 0.4 and worked fine during testing)?As a reference, here is my code with the hack commented out :
--------- getdollarzero --------
#include "m_pd.h" #include "g_canvas.h" //needed to include g_canvas.h once the hack
was commented out/* HACK struct _glist { t_object gl_obj; // header in case we're a glist t_gobj *gl_list; // the actual data struct _gstub *gl_stub; // safe pointer handler int gl_valid; // incremented when pointers might
be stale struct _glist *gl_owner; // parent glist, supercanvas, or 0
if none };END HACK */
typedef struct getdollarzero { t_object x_ob; t_canvas * x_canvas; t_outlet* x_outlet; int x_level; } t_getdollarzero;
static void getdollarzero_bang(t_getdollarzero *x) { int i = x->x_level; t_canvas* last = x->x_canvas;
while (i>0) { i--; if (last->gl_owner) last = last->gl_owner; } // code example taken from iemlib2's parentdollarzero: // x->s_parent_unique = canvas_realizedollar((t_canvas *)
this_canvas->gl_owner, gensym("$0")); // original get dir function: //outlet_symbol(x->x_outlet,canvas_getdir(last));
outlet_symbol(x->x_outlet,canvas_realizedollar(last, gensym
("$0"))); }
t_class *getdollarzero_class;
static void *getdollarzero_new(t_floatarg level) { t_getdollarzero *x = (t_getdollarzero *)pd_new (getdollarzero_class); x->x_canvas = canvas_getcurrent(); x->x_outlet = outlet_new(&x->x_ob, &s_); x->x_level = level; return (void *)x; }
void getdollarzero_setup(void) { getdollarzero_class = class_new(gensym("getdollarzero"),
(t_newmethod)getdollarzero_new, 0, sizeof(t_getdollarzero), 0, A_DEFFLOAT,0); class_addbang(getdollarzero_class, getdollarzero_bang); }--------- getdollarzero end --------
-- thomas ouellet fredericks, tof@danslchamp.org, montreal, canada _______________________________________________ PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/ listinfo/pd-list
Computer science is no more related to the computer than astronomy
is related to the telescope. -Edsger Dykstra-- thomas ouellet fredericks, tof@danslchamp.org , montreal, canada
-- thomas ouellet fredericks, tof@danslchamp.org, montreal, canada <getdollarzero.zip>
"It is convenient to imagine a power beyond us because that means we
don't have to examine our own lives.", from "The Idols of
Environmentalism", by Curtis White
On Wed, 29 Aug 2007, Hans-Christoph Steiner wrote:
I think Günter didn't want to depend on non-public headers like g_canvas.h, so included the glist struct from that header. Personally, I think makes more sense to include the g_canvas.h header.
Neither is more correct than the other. Miller made no promises about anything else than m_pd.h, and then, some of m_pd.h's declarations are quite questionable (some of the declared functions aren't defined anywhere, for example).
_ _ __ ___ _____ ________ _____________ _____________________ ... | Mathieu Bouchard - tél:+1.514.383.3801, Montréal QC Canada
Maybe he would consider accepting a patch that moves some important internals from g_canvas.h to m_pd.h if they are useful for developing externals. (i.e., declaring a "guarantee" for them.) My feeling from convention was that he doesn't intend to make many drastic modifications to the internals at this point, so possibly it is time to make some useful things more available to external developers.
??
Steve
On 8/29/07, Mathieu Bouchard matju@artengine.ca wrote:
On Wed, 29 Aug 2007, Hans-Christoph Steiner wrote:
I think Günter didn't want to depend on non-public headers like g_canvas.h, so included the glist struct from that header. Personally, I think makes more sense to include the g_canvas.h header.
Neither is more correct than the other. Miller made no promises about anything else than m_pd.h, and then, some of m_pd.h's declarations are quite questionable (some of the declared functions aren't defined anywhere, for example).
_ _ __ ___ _____ ________ _____________ _____________________ ... | Mathieu Bouchard - tél:+1.514.383.3801, Montréal QC Canada _______________________________________________ PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
On Wed, 29 Aug 2007, Stephen Sinclair wrote:
My feeling from convention was that he doesn't intend to make many drastic modifications to the internals at this point, so possibly it is time to make some useful things more available to external developers.
Pd is already painted in the corner that you want to paint it in, because people are using unpublished interfaces all over the place. With that kind of circuit-bending mentality and RTFSC habits, there's no way out. Many features will be left unimplemented forever, and all those externals relying on internals, they will rely on that (un)implementation.
That's what you want?
note: RTFSC stands for "Read The Fantastic Source Code".
_ _ __ ___ _____ ________ _____________ _____________________ ... | Mathieu Bouchard - tél:+1.514.383.3801, Montréal QC Canada
Quoting Thomas O Fredericks tof@danslchamp.org:
Thanks to Han's help page (http://puredata.info/docs/developer/mingw) I was able to compile a test external on windows with mingw.
I then started making a new external called getdollarzero based on getdir (from ggee) and parentdollarzero (from iemlib2). I compiled it and it works but I had to:
- remove Guenter's hack from getdir's source code
- and therefore include g_canvas.h
My question is the following: why is there a hack in the first place?
Hi,
The hack is there so that I did not have to include g_canvas.h. There is no harm including it properly, it might be even better ...
Günter
If I do not use it will my code crash PD in some way (I compiled against PD 0.4and worked fine during testing)?
As a reference, here is my code with the hack commented out :
--------- getdollarzero --------
#include "m_pd.h" #include "g_canvas.h" //needed to include g_canvas.h once the hack was commented out
/* HACK struct _glist { t_object gl_obj; // header in case we're a glist t_gobj *gl_list; // the actual data struct _gstub *gl_stub; // safe pointer handler int gl_valid; // incremented when pointers might be stale struct _glist *gl_owner; // parent glist, supercanvas, or 0 if none };
END HACK */
typedef struct getdollarzero { t_object x_ob; t_canvas * x_canvas; t_outlet* x_outlet; int x_level; } t_getdollarzero;
static void getdollarzero_bang(t_getdollarzero *x) { int i = x->x_level; t_canvas* last = x->x_canvas;
while (i>0) { i--; if (last->gl_owner) last = last->gl_owner; } // code example taken from iemlib2's parentdollarzero: // x->s_parent_unique = canvas_realizedollar((t_canvas
*)this_canvas->gl_owner, gensym("$0")); // original get dir function: //outlet_symbol(x->x_outlet,canvas_getdir(last));
outlet_symbol(x->x_outlet,canvas_realizedollar(last, gensym("$0")));
}
t_class *getdollarzero_class;
static void *getdollarzero_new(t_floatarg level) { t_getdollarzero *x = (t_getdollarzero *)pd_new(getdollarzero_class); x->x_canvas = canvas_getcurrent(); x->x_outlet = outlet_new(&x->x_ob, &s_); x->x_level = level; return (void *)x; }
void getdollarzero_setup(void) { getdollarzero_class = class_new(gensym("getdollarzero"), (t_newmethod)getdollarzero_new, 0, sizeof(t_getdollarzero), 0, A_DEFFLOAT,0); class_addbang(getdollarzero_class, getdollarzero_bang); }
--------- getdollarzero end --------
-- thomas ouellet fredericks, tof@danslchamp.org, montreal, canada
This message was sent using IMP, the Internet Messaging Program.