Csound Csound-dev Csound-tekno Search About

[Csnd] UDO/parsing issue

Date2018-04-15 15:56
FromDave Seidel
Subject[Csnd] UDO/parsing issue
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 Csound@listserv.heanet.ie 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

Date2018-04-15 16:04
FromSteven Yi
SubjectRe: [Csnd] UDO/parsing issue
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  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:
>
> 
> 
> -odac -d
> 
> 
>
> sr = 44100
> ksmps = 32
> nchnls = 2
> 0dbfs = 1
>
> opcode test_opcode,i,0
>   i1 xin
>   print i1
> endop
>
> instr 1
>   test_opcode 1
> endin
>
> 
> 
> 
> 
>
>
> 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 Csound@listserv.heanet.ie
> 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
Csound@listserv.heanet.ie
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

Date2018-04-15 16:10
FromDave Seidel
SubjectRe: [Csnd] UDO/parsing issue
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 <stevenyi@gmail.com> 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 <dave.seidel@gmail.com> 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 Csound@listserv.heanet.ie
> 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
Csound@listserv.heanet.ie
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 Csound@listserv.heanet.ie 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

Date2018-04-15 16:26
FromSteven Yi
SubjectRe: [Csnd] UDO/parsing issue
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  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  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 
>> 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:
>> >
>> > 
>> > 
>> > -odac -d
>> > 
>> > 
>> >
>> > sr = 44100
>> > ksmps = 32
>> > nchnls = 2
>> > 0dbfs = 1
>> >
>> > opcode test_opcode,i,0
>> >   i1 xin
>> >   print i1
>> > endop
>> >
>> > instr 1
>> >   test_opcode 1
>> > endin
>> >
>> > 
>> > 
>> > 
>> > 
>> >
>> >
>> > 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 Csound@listserv.heanet.ie
>> > 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
>> Csound@listserv.heanet.ie
>> 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 Csound@listserv.heanet.ie
> 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
Csound@listserv.heanet.ie
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

Date2018-04-15 16:48
FromDave Seidel
SubjectRe: [Csnd] UDO/parsing issue
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 <stevenyi@gmail.com> 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 <dave.seidel@gmail.com> 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 <stevenyi@gmail.com> 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 <dave.seidel@gmail.com>
>> 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 Csound@listserv.heanet.ie
>> > 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
>> Csound@listserv.heanet.ie
>> 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 Csound@listserv.heanet.ie
> 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
Csound@listserv.heanet.ie
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 Csound@listserv.heanet.ie 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