hi
we are having a hard time with the following problem: we want to create an object that has a variable number of iolets, based on the $args available. e.g. [myobj $1] should create an object with a single inlet [myobj $3] should create an object with 3 inlets.
the number of iolets depends on the literal value of the dollargs, not on the expanded values!
you can think of this like an [expr] object, but using "$2" directly instead of "$f2".
now the problem is that i haven't found a way how to access the raw object arguments in the constructor (new-routine) of the object.
it is simple to do so _after_ the constructor (by accessing the binbuf), but then it is too late. the raw args are not available yet within the constructor (it is filled right afterwards in the canvas_objtext() routine) the reason is obvious, as there is no memory allocated to store the binbuf before a call to pd_new()
unfortunately the insight of why this is like it is does not really help me.
does anybody (miller?) knows a way (or trick) how to access the raw arguments within the constructor (or _very_ shortly afterwards: that is, before the next object is created)
else i would like to file a feature request to fill the information i need within the pd_new()
any thoughts?
fgamrsd IOhannes
Am 29.09.2008 um 17:56 schrieb IOhannes m zmoelnig:
we want to create an object that has a variable number of iolets, based on the $args available. e.g. [myobj $1] should create an object with a single inlet [myobj $3] should create an object with 3 inlets.
the number of iolets depends on the literal value of the dollargs, not on the expanded values!
While i haven't really thought about how, i'm puzzling about why you want to do that. I can't really think of an application for that. curious, gr~~~
If you are already putting the "literal" argument in the creation args, then why not just make another creation argument that shadows the dollar argument?
Mike
On Mon, Sep 29, 2008 at 10:56 AM, IOhannes m zmoelnig zmoelnig@iem.atwrote:
hi
we are having a hard time with the following problem: we want to create an object that has a variable number of iolets, based on the $args available. e.g. [myobj $1] should create an object with a single inlet [myobj $3] should create an object with 3 inlets.
the number of iolets depends on the literal value of the dollargs, not on the expanded values!
you can think of this like an [expr] object, but using "$2" directly instead of "$f2".
now the problem is that i haven't found a way how to access the raw object arguments in the constructor (new-routine) of the object.
it is simple to do so _after_ the constructor (by accessing the binbuf), but then it is too late. the raw args are not available yet within the constructor (it is filled right afterwards in the canvas_objtext() routine) the reason is obvious, as there is no memory allocated to store the binbuf before a call to pd_new()
unfortunately the insight of why this is like it is does not really help me.
does anybody (miller?) knows a way (or trick) how to access the raw arguments within the constructor (or _very_ shortly afterwards: that is, before the next object is created)
else i would like to file a feature request to fill the information i need within the pd_new()
any thoughts?
fgamrsd IOhannes
Pd-dev mailing list Pd-dev@iem.at http://lists.puredata.info/listinfo/pd-dev
Mike McGonagle wrote:
If you are already putting the "literal" argument in the creation args, then why not just make another creation argument that shadows the dollar argument?
i am not sure whether i fully understand what you mean. do you mean i should use something like "$*1" (or "#1" or something else that does not get munged by Pd's parser) instead of or in additional to my args?
fgmasdr IOhannes
No, basically, it sounds like you are doing this...
[myobj $1]
in one instance... and
[myobj $2]
in another instance...
You already know what the number of the parameter you are looking for, so why not do this...
[myobj 1 $1]
[myobj 2 $2]
May not be the most elegant, but...
Mike
On Tue, Sep 30, 2008 at 2:00 AM, IOhannes m zmoelnig zmoelnig@iem.atwrote:
Mike McGonagle wrote:
If you are already putting the "literal" argument in the creation args, then why not just make another creation argument that shadows the dollar argument?
i am not sure whether i fully understand what you mean. do you mean i should use something like "$*1" (or "#1" or something else that does not get munged by Pd's parser) instead of or in additional to my args?
fgmasdr IOhannes