hi,
I am trying to parse shader programs to automatically generate user interfaces (for uniform variables). I have to differentiate between messages like
[uniform float value1( [uniform vec2 value2( [something totally different( | [route uniform] | [route float vec2] | [symbol\
The problem appears as soon as float value1 tries to pass "route float", which gives me "error: Bad arguments for message 'float' to object 'messresponder'".
Is there already a quick solution for that, or do I have to do my own work around?
thanks,
marius.
Hallo, marius schebella hat gesagt: // marius schebella wrote:
I am trying to parse shader programs to automatically generate user interfaces (for uniform variables). I have to differentiate between messages like
[uniform float value1( [uniform vec2 value2( [something totally different( | [route uniform] | [route float vec2] | [symbol\
The problem appears as soon as float value1 tries to pass "route float",
which gives me "error: Bad arguments for message 'float' to object
'messresponder'".
Is "value1" a number or something else, like a symbol? if it's a symbol, then you are trying to use a float-message with a symbol argument like "float abc" which is, uhm, not supported, at least not in [route] or [print] or so.
As a workaround, replace the "float" with something else using [select float] i.e.:
[uniform float value1( | [unpack s s s] | | | | [select float] | | / | | [symbol f( | | / | [pack s s s ] |
Frank
Frank Barknecht wrote:
Is "value1" a number or something else, like a symbol? if it's a symbol, then
it's a literal, which translates to "symbol" in Pd-lingo.
you are trying to use a float-message with a symbol argument like "float abc" which is, uhm, not supported, at least not in [route] or [print] or so.
it's not supported by Pd, at all. not even [t a] likes it.
As a workaround, replace the "float" with something else using [select float] i.e.:
[uniform float value1( |
[list] |
[unpack s s s]
anyhow, i'd say it's a bug in Pd's parser.
related to [symbol 3( evaluating to an empty symbol (i thought it evaluated to the equally unexpected literal "float", but this seems to be not the case (anymore(?)))
and very much related to the issues of "string" in mrpeach's "str" hack.
argh.be IOhannes
Hallo, IOhannes m zmoelnig hat gesagt: // IOhannes m zmoelnig wrote:
Frank Barknecht wrote:
Is "value1" a number or something else, like a symbol? if it's a symbol, then
it's a literal, which translates to "symbol" in Pd-lingo.
I assumed Marius was using "value1" as a placeholder.
you are trying to use a float-message with a symbol argument like "float abc" which is, uhm, not supported, at least not in [route] or [print] or so.
it's not supported by Pd, at all. not even [t a] likes it.
As a workaround, replace the "float" with something else using [select float] i.e.:
[uniform float value1( |
[list] |
[unpack s s s]
Yeah, better play it save, but here (0.42) the plain meta-message also worked.
Frank
Frank Barknecht wrote:
Hallo, marius schebella hat gesagt: // marius schebella wrote:
I am trying to parse shader programs to automatically generate user interfaces (for uniform variables). I have to differentiate between messages like
[uniform float value1( [uniform vec2 value2( [something totally different( | [route uniform] | [route float vec2] | [symbol\
The problem appears as soon as float value1 tries to pass "route float",
which gives me "error: Bad arguments for message 'float' to object
'messresponder'".Is "value1" a number or something else, like a symbol? if it's a symbol, then you are trying to use a float-message with a symbol argument like "float abc" which is, uhm, not supported, at least not in [route] or [print] or so.
As a workaround, replace the "float" with something else using [select float] i.e.:
[uniform float value1( | [unpack s s s] | | | | [select float] | | / | | [symbol f( | | / | [pack s s s ] |
Ciao
Hi Frank, thanks for the quick reply. value1 is a string/symbol. not a number. like "variablename". the problem with your solution is that "something totally different" can be really anything. even a line like "float variablename;" I see this will be one big mess at the end. I am also trying to restrict the parsing to the variable declarations at the top of the shader file - anything before the first function (although that's going to be a hard one, too, because the first function isn't necessarily void main(). At least it is easy to rule out comments (//). And, Pd does semicolon magic, too, so no need for string parsing with the variablename. otoh parsing froze Pd anyway :( [textfile] did not like the line with "{" ---snip-- void main() { ---snip-- dunno, maybe Pd is not made for text parsing?? (Probably I should just ask IOhannes for a third outlet of glsl_program...) marius.
Frank Barknecht wrote:
Hallo, marius schebella hat gesagt: // marius schebella wrote:
dunno, maybe Pd is not made for text parsing??
IMO it isn't. Can't you do the parsing somewhere else, like in a pdlua object? Much more comfortable for text.
Ciao
good idea, will check it out. can't remember that I saw a text parsing pdlua example, though?? marius.
yep, not very confortable. but i was very surprised when i noticed that performing search and replace on very big text file was almost instantaneous when made with pd, but would take many minute with gedit.
Cyrille
Frank Barknecht a écrit :
Hallo, marius schebella hat gesagt: // marius schebella wrote:
dunno, maybe Pd is not made for text parsing??
IMO it isn't. Can't you do the parsing somewhere else, like in a pdlua object? Much more comfortable for text.
Ciao
netpd does quite a bit of text parsing, so it is possible. I don't
think that the dataflow nature is bad for parsing text, I think the we
don't have any good libraries for it. zexy has quite a bit of stuff,
but we need an escape mechanism, for example.
.hc
On Apr 6, 2009, at 2:28 PM, cyrille henry wrote:
yep, not very confortable. but i was very surprised when i noticed that performing search and
replace on very big text file was almost instantaneous when made
with pd, but would take many minute with gedit.Cyrille
Frank Barknecht a écrit :
Hallo, marius schebella hat gesagt: // marius schebella wrote:
dunno, maybe Pd is not made for text parsing??
IMO it isn't. Can't you do the parsing somewhere else, like in a
pdlua object? Much more comfortable for text. Ciao
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
http://at.or.at/hans/