Csound Csound-dev Csound-tekno Search About

[Csnd] UDO order

Date2019-10-28 19:45
FromJohann Philippe <000002c2c0737523-dmarc-request@LISTSERV.HEANET.IE>
Subject[Csnd] UDO order
Hello everybody, 

Working on last fix on the tracker I showed at ICSC, I'm having a bit of
trouble with UDO's. Actually, the problem comes from order of UDO's in csd
file. Several tests I ran today could confirm that a UDO cannot call a UDO
that isn't declared previously in the csd file. 

For example - this won't work here : 
opcode one,i,i
   iinput xin
     output = two(iinput, iinput+1)
   xout ioutput
endop

opcode two,i,ii
  ione, itwo xin
  ioutput = ione + itwo
  xout ioutput
endop

But if the opcode "two" is declared first, it will work. 
I expected that the parser would make a first pass to collect every
opcode/variables names at global scope before to process/compile the body of
UDO's ? 
Is it the expected behavior ? 

I'm running on Linux mint 19 - Csound 6.13. 

Thanks.

Bests.
Johann 





--
Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html

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

Date2019-10-28 19:49
FromVictor Lazzarini
SubjectRe: [Csnd] UDO order
The parser expects it to be defined when called, so if you are using a UDO within a UDO, then
that UDO needs to have been previously defined in the code.
========================
Prof. Victor Lazzarini
Maynooth University
Ireland

> On 28 Oct 2019, at 19:45, Johann Philippe <000002c2c0737523-dmarc-request@LISTSERV.HEANET.IE> wrote:
> 
> Hello everybody, 
> 
> Working on last fix on the tracker I showed at ICSC, I'm having a bit of
> trouble with UDO's. Actually, the problem comes from order of UDO's in csd
> file. Several tests I ran today could confirm that a UDO cannot call a UDO
> that isn't declared previously in the csd file. 
> 
> For example - this won't work here : 
> opcode one,i,i
>   iinput xin
>     output = two(iinput, iinput+1)
>   xout ioutput
> endop
> 
> opcode two,i,ii
>  ione, itwo xin
>  ioutput = ione + itwo
>  xout ioutput
> endop
> 
> But if the opcode "two" is declared first, it will work. 
> I expected that the parser would make a first pass to collect every
> opcode/variables names at global scope before to process/compile the body of
> UDO's ? 
> Is it the expected behavior ? 
> 
> I'm running on Linux mint 19 - Csound 6.13. 
> 
> Thanks.
> 
> Bests.
> Johann 
> 
> 
> 
> 
> 
> --
> Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html
> 
> 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

Date2019-10-29 10:32
FromBernard Geyer
SubjectRe: [Csnd] UDO order
I don't know how difficult it would be to implement forward declarations.




--
Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html

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

Date2019-10-29 11:30
FromJohann Philippe <000002c2c0737523-dmarc-request@LISTSERV.HEANET.IE>
SubjectRe: [Csnd] UDO order

Pete - I found that about Tutka http://linuxmao.org/Tutka

Josh - It's a sequencer-tracker designed to work close to Csound I'm working on. It will be available on Linux, and probably Windows (OSX would take more time to implement). Some news about it soon !

Rory - a big Hello ! Nice talk in Cagli indeed.

Back to the point : 
Thank you Victor. I guess there are some reasons why this is like this. In my case it's not a major trouble - my program automatically formats an orchestra based on instruments dependencies (recursively) - so I can deal with it by doing a better sorting algorithm. 

But this point can also be thought in a more general way. A forward declaration could allow two udo's to call each other recursively a certain number of times, exacly as normal recursion in udo's.
Bernard suggestion seems great to me. I don't know if it could be implemented as an opcode, something like this :
opcode_decl my_opcode,a,ii
And with an equivalent in new syntax (not sure about syntax here) :
opcode_decl my_opcode (one:i, two:i) => (outsig:a)







Le mardi 29 octobre 2019 à 11:21:04 UTC+1, Bernard Geyer <micamusic2@gmail.com> a écrit :


I don't know how difficult it would be to implement forward declarations.

Date2019-10-29 13:23
FromJohann Philippe <000002c2c0737523-dmarc-request@LISTSERV.HEANET.IE>
SubjectRe: [Csnd] UDO order

It seems to be possible already with declaring a udo with empty body.

Le mardi 29 octobre 2019 à 12:30:56 UTC+1, Johann Philippe <000002c2c0737523-dmarc-request@listserv.heanet.ie> a écrit :



Pete - I found that about Tutka http://linuxmao.org/Tutka

Josh - It's a sequencer-tracker designed to work close to Csound I'm working on. It will be available on Linux, and probably Windows (OSX would take more time to implement). Some news about it soon !

Rory - a big Hello ! Nice talk in Cagli indeed.

Back to the point : 
Thank you Victor. I guess there are some reasons why this is like this. In my case it's not a major trouble - my program automatically formats an orchestra based on instruments dependencies (recursively) - so I can deal with it by doing a better sorting algorithm. 

But this point can also be thought in a more general way. A forward declaration could allow two udo's to call each other recursively a certain number of times, exacly as normal recursion in udo's.
Bernard suggestion seems great to me. I don't know if it could be implemented as an opcode, something like this :
opcode_decl my_opcode,a,ii
And with an equivalent in new syntax (not sure about syntax here) :
opcode_decl my_opcode (one:i, two:i) => (outsig:a)







Le mardi 29 octobre 2019 à 11:21:04 UTC+1, Bernard Geyer <micamusic2@gmail.com> a écrit :


I don't know how difficult it would be to implement forward declarations.
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

Date2019-10-29 19:40
FromPete Goodeve
SubjectRe: [Csnd] UDO order
AttachmentsNone