[Csnd] UDO/parsing issue

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[Csnd] UDO/parsing issue

Dave Seidel
Hi all,

I use UDOs a lot, but I've just run into a case where the opcode name causes a parsing error when it is used in an instrument. Simplified it down to this:

<CsoundSynthesizer>
<CsOptions>
-odac -d
</CsOptions>
<CsInstruments>

sr = 44100
ksmps = 32
nchnls = 2
0dbfs = 1

opcode test_opcode,i,0
  i1 xin
  print i1
endop

instr 1
  test_opcode 1
endin

</CsInstruments>
<CsScore>
</CsScore>
</CsoundSynthesizer>

which when compiled prints

error: syntax error, unexpected T_OPCODE  (token "test_opcode") from file opcode-test.csd (1)
 line 18:
>>>  test_opcode <<<
Parsing failed due to invalid input!

If I'm doing something wrong (always possible), it's eluding me here.

- Dave

Csound mailing list [hidden email] https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] UDO/parsing issue

Steven Yi
Hi Dave,

I think it might be a simple typo and that you have your input and
output arguments backwards:

opcode_test_opcode, 0, i


steven

On Sun, Apr 15, 2018 at 10:56 AM, Dave Seidel <[hidden email]> wrote:

> Hi all,
>
> I use UDOs a lot, but I've just run into a case where the opcode name causes
> a parsing error when it is used in an instrument. Simplified it down to
> this:
>
> <CsoundSynthesizer>
> <CsOptions>
> -odac -d
> </CsOptions>
> <CsInstruments>
>
> sr = 44100
> ksmps = 32
> nchnls = 2
> 0dbfs = 1
>
> opcode test_opcode,i,0
>   i1 xin
>   print i1
> endop
>
> instr 1
>   test_opcode 1
> endin
>
> </CsInstruments>
> <CsScore>
> </CsScore>
> </CsoundSynthesizer>
>
>
> which when compiled prints
>
> error: syntax error, unexpected T_OPCODE  (token "test_opcode") from file
> opcode-test.csd (1)
>  line 18:
>>>>  test_opcode <<<
> Parsing failed due to invalid input!
>
> If I'm doing something wrong (always possible), it's eluding me here.
>
> - Dave
>
> Csound mailing list [hidden email]
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to
> https://github.com/csound/csound/issues Discussions of bugs and features can
> be posted here

Csound mailing list
[hidden email]
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] UDO/parsing issue

Dave Seidel
Ahhhh! Thanks Steve, I just could not see it. I confess that I have always found this ordering confusing for some reason, but I consider it a problem in my brain, not in the software. (Though it would be nice if eventually the parser could provide a warning that was closer to the actual issue; i.e., pointing to the opcode definition instead of the invocation.) :-)

- Dave

On Sun, Apr 15, 2018 at 11:04 AM, Steven Yi <[hidden email]> wrote:
Hi Dave,

I think it might be a simple typo and that you have your input and
output arguments backwards:

opcode_test_opcode, 0, i


steven

On Sun, Apr 15, 2018 at 10:56 AM, Dave Seidel <[hidden email]> wrote:
> Hi all,
>
> I use UDOs a lot, but I've just run into a case where the opcode name causes
> a parsing error when it is used in an instrument. Simplified it down to
> this:
>
> <CsoundSynthesizer>
> <CsOptions>
> -odac -d
> </CsOptions>
> <CsInstruments>
>
> sr = 44100
> ksmps = 32
> nchnls = 2
> 0dbfs = 1
>
> opcode test_opcode,i,0
>   i1 xin
>   print i1
> endop
>
> instr 1
>   test_opcode 1
> endin
>
> </CsInstruments>
> <CsScore>
> </CsScore>
> </CsoundSynthesizer>
>
>
> which when compiled prints
>
> error: syntax error, unexpected T_OPCODE  (token "test_opcode") from file
> opcode-test.csd (1)
>  line 18:
>>>>  test_opcode <<<
> Parsing failed due to invalid input!
>
> If I'm doing something wrong (always possible), it's eluding me here.
>
> - Dave
>
> Csound mailing list [hidden email]
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to
> https://github.com/csound/csound/issues Discussions of bugs and features can
> be posted here

Csound mailing list
[hidden email]
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here



--
Csound mailing list [hidden email] https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] UDO/parsing issue

Steven Yi
Agreed, the error message is not very helpful.  If you would file an
issue we can look at finding ways to give better error message there.

Also, the new-opcode syntax in CS7 might have made that a bit clearer:

opcode test_opcode(i1):void
  print i1
endop

since you don't have to fuss with matching the inarg types with the
xin statement.




On Sun, Apr 15, 2018 at 11:10 AM, Dave Seidel <[hidden email]> wrote:

> Ahhhh! Thanks Steve, I just could not see it. I confess that I have always
> found this ordering confusing for some reason, but I consider it a problem
> in my brain, not in the software. (Though it would be nice if eventually the
> parser could provide a warning that was closer to the actual issue; i.e.,
> pointing to the opcode definition instead of the invocation.) :-)
>
> - Dave
>
> On Sun, Apr 15, 2018 at 11:04 AM, Steven Yi <[hidden email]> wrote:
>>
>> Hi Dave,
>>
>> I think it might be a simple typo and that you have your input and
>> output arguments backwards:
>>
>> opcode_test_opcode, 0, i
>>
>>
>> steven
>>
>> On Sun, Apr 15, 2018 at 10:56 AM, Dave Seidel <[hidden email]>
>> wrote:
>> > Hi all,
>> >
>> > I use UDOs a lot, but I've just run into a case where the opcode name
>> > causes
>> > a parsing error when it is used in an instrument. Simplified it down to
>> > this:
>> >
>> > <CsoundSynthesizer>
>> > <CsOptions>
>> > -odac -d
>> > </CsOptions>
>> > <CsInstruments>
>> >
>> > sr = 44100
>> > ksmps = 32
>> > nchnls = 2
>> > 0dbfs = 1
>> >
>> > opcode test_opcode,i,0
>> >   i1 xin
>> >   print i1
>> > endop
>> >
>> > instr 1
>> >   test_opcode 1
>> > endin
>> >
>> > </CsInstruments>
>> > <CsScore>
>> > </CsScore>
>> > </CsoundSynthesizer>
>> >
>> >
>> > which when compiled prints
>> >
>> > error: syntax error, unexpected T_OPCODE  (token "test_opcode") from
>> > file
>> > opcode-test.csd (1)
>> >  line 18:
>> >>>>  test_opcode <<<
>> > Parsing failed due to invalid input!
>> >
>> > If I'm doing something wrong (always possible), it's eluding me here.
>> >
>> > - Dave
>> >
>> > Csound mailing list [hidden email]
>> > https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to
>> > https://github.com/csound/csound/issues Discussions of bugs and features
>> > can
>> > be posted here
>>
>> Csound mailing list
>> [hidden email]
>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>> Send bugs reports to
>>         https://github.com/csound/csound/issues
>> Discussions of bugs and features can be posted here
>
>
>
>
> --
> http://mysterybear.net
> https://soundcloud.com/mysterybear
> https://mysterybear.bandcamp.com
>
> http://recordings.irritablehedgehog.com/album/dave-seidel-60-hz
> Csound mailing list [hidden email]
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to
> https://github.com/csound/csound/issues Discussions of bugs and features can
> be posted here

Csound mailing list
[hidden email]
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] UDO/parsing issue

Dave Seidel
Yes, I'll file a ticket. And I like the new opcode syntax much better, makes the intent and usage clearer. Thanks again.

On Sun, Apr 15, 2018 at 11:26 AM, Steven Yi <[hidden email]> wrote:
Agreed, the error message is not very helpful.  If you would file an
issue we can look at finding ways to give better error message there.

Also, the new-opcode syntax in CS7 might have made that a bit clearer:

opcode test_opcode(i1):void
  print i1
endop

since you don't have to fuss with matching the inarg types with the
xin statement.




On Sun, Apr 15, 2018 at 11:10 AM, Dave Seidel <[hidden email]> wrote:
> Ahhhh! Thanks Steve, I just could not see it. I confess that I have always
> found this ordering confusing for some reason, but I consider it a problem
> in my brain, not in the software. (Though it would be nice if eventually the
> parser could provide a warning that was closer to the actual issue; i.e.,
> pointing to the opcode definition instead of the invocation.) :-)
>
> - Dave
>
> On Sun, Apr 15, 2018 at 11:04 AM, Steven Yi <[hidden email]> wrote:
>>
>> Hi Dave,
>>
>> I think it might be a simple typo and that you have your input and
>> output arguments backwards:
>>
>> opcode_test_opcode, 0, i
>>
>>
>> steven
>>
>> On Sun, Apr 15, 2018 at 10:56 AM, Dave Seidel <[hidden email]>
>> wrote:
>> > Hi all,
>> >
>> > I use UDOs a lot, but I've just run into a case where the opcode name
>> > causes
>> > a parsing error when it is used in an instrument. Simplified it down to
>> > this:
>> >
>> > <CsoundSynthesizer>
>> > <CsOptions>
>> > -odac -d
>> > </CsOptions>
>> > <CsInstruments>
>> >
>> > sr = 44100
>> > ksmps = 32
>> > nchnls = 2
>> > 0dbfs = 1
>> >
>> > opcode test_opcode,i,0
>> >   i1 xin
>> >   print i1
>> > endop
>> >
>> > instr 1
>> >   test_opcode 1
>> > endin
>> >
>> > </CsInstruments>
>> > <CsScore>
>> > </CsScore>
>> > </CsoundSynthesizer>
>> >
>> >
>> > which when compiled prints
>> >
>> > error: syntax error, unexpected T_OPCODE  (token "test_opcode") from
>> > file
>> > opcode-test.csd (1)
>> >  line 18:
>> >>>>  test_opcode <<<
>> > Parsing failed due to invalid input!
>> >
>> > If I'm doing something wrong (always possible), it's eluding me here.
>> >
>> > - Dave
>> >
>> > Csound mailing list [hidden email]
>> > https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to
>> > https://github.com/csound/csound/issues Discussions of bugs and features
>> > can
>> > be posted here
>>
>> Csound mailing list
>> [hidden email]
>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>> Send bugs reports to
>>         https://github.com/csound/csound/issues
>> Discussions of bugs and features can be posted here
>
>
>
>
> --
> http://mysterybear.net
> https://soundcloud.com/mysterybear
> https://mysterybear.bandcamp.com
>
> http://recordings.irritablehedgehog.com/album/dave-seidel-60-hz
> Csound mailing list [hidden email]
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to
> https://github.com/csound/csound/issues Discussions of bugs and features can
> be posted here

Csound mailing list
[hidden email]
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here



--
Csound mailing list [hidden email] https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here