Csound Csound-dev Csound-tekno Search About

[Csnd] Orchestra Macros and Multiline Strings

Date2021-01-02 18:35
FromJoseph Hughes
Subject[Csnd] Orchestra Macros and Multiline Strings
Does anyone here know the rules about using orchestra macros within multi line strings ({{...}} )? I'm not getting the output I would expect. Here's an example:

#define EXAMPLE(ARG_1) #
prints {{ Here I expect to see the value of ARG_1 but instead I get the following: }}
prints {{$ARG_1}}
prints {{%n%n}}

prints {{ A dollar sign in a string block returns the name of the parent macro: }}
prints {{$}}
prints {{%n%n}}
#

$EXAMPLE(test)


The output for the above is:
 Here I expect to see the value of ARG_1 but instead I get the following:  $`EXAMPLE``ARG_1

 A dollar sign in a string block returns the name of the parent macro: $`EXAMPLE``
 
Are there rules around multiline strings and macros that I'm unaware of?
Thanks for your time, everyone.

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

Date2021-01-02 23:21
FromPete Goodeve
SubjectRe: [Csnd] Orchestra Macros and Multiline Strings
AttachmentsNone  

Date2021-01-03 16:58
FromJoseph Hughes
SubjectRe: [Csnd] Orchestra Macros and Multiline Strings
Thanks for trying it out, Pete. I found the same thing. Regular double-quote strings interpret macros the way I would expect. It's only the double-bracket strings that have this problem.

On Sat, Jan 2, 2021 at 6:21 PM Pete Goodeve <pete.goodeve@computer.org> wrote:
Experimenting, I see that:

#define EXAMPLE(ARG_1) #
prints {{ Here I expect to see the value of ARG_1 but instead I get the
following: }}
prints "$ARG_1"
prints {{%n%n}}

works as you'd hope. (All I did was change the one line to normal quotes.)
However 'prints "$"' throws an error!

Sounds a bit like a bug to me...

        -- Pete --


On Sat, Jan 02, 2021 at 01:35:24PM -0500, Joseph Hughes wrote:
> Does anyone here know the rules about using orchestra macros within multi
> line strings ({{...}} )? I'm not getting the output I would expect. Here's
> an example:
>
> #define EXAMPLE(ARG_1) #
> prints {{ Here I expect to see the value of ARG_1 but instead I get the
> following: }}
> prints {{$ARG_1}}
> prints {{%n%n}}
>
> prints {{ A dollar sign in a string block returns the name of the parent
> macro: }}
> prints {{$}}
> prints {{%n%n}}
> #
>
> $EXAMPLE(test)
>
>
> The output for the above is:
>
> >  Here I expect to see the value of ARG_1 but instead I get the following:
> >  $`EXAMPLE``ARG_1
> >
> >  A dollar sign in a string block returns the name of the parent macro:
> > $`EXAMPLE``
> >
>
> Are there rules around multiline strings and macros that I'm unaware of?
> Thanks for your time, everyone.
>
> 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

Date2021-01-03 17:02
FromDave Seidel
SubjectRe: [Csnd] Orchestra Macros and Multiline Strings
Sounds like a good candidate for a new ticket at https://github.com/csound/csound/issues

On Sun, Jan 3, 2021 at 11:58 AM Joseph Hughes <joehughesmail@gmail.com> wrote:
Thanks for trying it out, Pete. I found the same thing. Regular double-quote strings interpret macros the way I would expect. It's only the double-bracket strings that have this problem.

On Sat, Jan 2, 2021 at 6:21 PM Pete Goodeve <pete.goodeve@computer.org> wrote:
Experimenting, I see that:

#define EXAMPLE(ARG_1) #
prints {{ Here I expect to see the value of ARG_1 but instead I get the
following: }}
prints "$ARG_1"
prints {{%n%n}}

works as you'd hope. (All I did was change the one line to normal quotes.)
However 'prints "$"' throws an error!

Sounds a bit like a bug to me...

        -- Pete --


On Sat, Jan 02, 2021 at 01:35:24PM -0500, Joseph Hughes wrote:
> Does anyone here know the rules about using orchestra macros within multi
> line strings ({{...}} )? I'm not getting the output I would expect. Here's
> an example:
>
> #define EXAMPLE(ARG_1) #
> prints {{ Here I expect to see the value of ARG_1 but instead I get the
> following: }}
> prints {{$ARG_1}}
> prints {{%n%n}}
>
> prints {{ A dollar sign in a string block returns the name of the parent
> macro: }}
> prints {{$}}
> prints {{%n%n}}
> #
>
> $EXAMPLE(test)
>
>
> The output for the above is:
>
> >  Here I expect to see the value of ARG_1 but instead I get the following:
> >  $`EXAMPLE``ARG_1
> >
> >  A dollar sign in a string block returns the name of the parent macro:
> > $`EXAMPLE``
> >
>
> Are there rules around multiline strings and macros that I'm unaware of?
> Thanks for your time, everyone.
>
> 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
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

Date2021-01-03 17:26
Fromjohn
SubjectRe: [Csnd] Orchestra Macros and Multiline Strings
There is no attempt to expand macros inside {{}} strings.  This was in 
the original design, and is not a bug.  This would be an incompatible 
change so we need to be sure that is what we want.  On a technical issue 
this is not straightforward and could take smre time to get right.

==Jon ff


> On Sat, Jan 2, 2021 at 6:21 PM Pete Goodeve 
> wrote:
>       Experimenting, I see that:
>
>       #define EXAMPLE(ARG_1) #
>       prints {{ Here I expect to see the value of ARG_1 but
>       instead I get the
>       following: }}
>       prints "$ARG_1"
>       prints {{%n%n}}
>
>       works as you'd hope. (All I did was change the one line to
>       normal quotes.)
>       However 'prints "$"' throws an error!
>
>       Sounds a bit like a bug to me...
>
>               -- Pete --
> 
>
>       On Sat, Jan 02, 2021 at 01:35:24PM -0500, Joseph Hughes
>       wrote:
>       > Does anyone here know the rules about using orchestra
>       macros within multi
>       > line strings ({{...}} )? I'm not getting the output I
>       would expect. Here's
>       > an example:
>       >
>       > #define EXAMPLE(ARG_1) #
>       > prints {{ Here I expect to see the value of ARG_1 but
>       instead I get the
>       > following: }}
>       > prints {{$ARG_1}}
>       > prints {{%n%n}}
>       >
>       > prints {{ A dollar sign in a string block returns the name
>       of the parent
>       > macro: }}
>       > prints {{$}}
>       > prints {{%n%n}}
>       > #
>       >
>       > $EXAMPLE(test)
>       >
>       >
>       > The output for the above is:
>       >
>       > >  Here I expect to see the value of ARG_1 but instead I
>       get the following:
>       > >  $`EXAMPLE``ARG_1
>       > >
>       > >  A dollar sign in a string block returns the name of the
>       parent macro:
>       > > $`EXAMPLE``
>       > >
>       >
>       > Are there rules around multiline strings and macros that
>       I'm unaware of?
>       > Thanks for your time, everyone.
>       >
>       > 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
> 
> 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

Date2021-01-03 18:43
FromPete Goodeve
SubjectRe: [Csnd] Orchestra Macros and Multiline Strings
AttachmentsNone  

Date2021-01-04 19:54
FromJoseph Hughes
SubjectRe: [Csnd] Orchestra Macros and Multiline Strings
I see how the documentation as written implies that there should be no macro expansion within bracket strings. I guess if there's a bug here at all it's that the '$' does get replaced with an unexpected result in bracket strings defined within macros.

On Sun, Jan 3, 2021 at 1:43 PM Pete Goodeve <pete.goodeve@computer.org> wrote:
If it's a 'feature', it would be nice to have it documented! (:-))
All I see is:
  "Strings within Csound can be expressed using traditional double quotes (" "), and also
   using {{ }}. The second method is useful to allow ';' and '$' characters within the string
   without having to used ASCII codes."
which is not very specific...(and has a typo!)

        --Pete --

On Sun, Jan 03, 2021 at 05:26:24PM +0000, john wrote:
> There is no attempt to expand macros inside {{}} strings.  This was in
> the original design, and is not a bug.  This would be an incompatible
> change so we need to be sure that is what we want.  On a technical issue
> this is not straightforward and could take smre time to get right.
>
> ==Jon ff
>
>
> >On Sat, Jan 2, 2021 at 6:21 PM Pete Goodeve <pete.goodeve@computer.org>
> >wrote:
> >      Experimenting, I see that:
> >
> >      #define EXAMPLE(ARG_1) #
> >      prints {{ Here I expect to see the value of ARG_1 but
> >      instead I get the
> >      following: }}
> >      prints "$ARG_1"
> >      prints {{%n%n}}
> >
> >      works as you'd hope. (All I did was change the one line to
> >      normal quotes.)
> >      However 'prints "$"' throws an error!
> >
> >      Sounds a bit like a bug to me...
> >
> >              -- Pete --
> >
> >
> >      On Sat, Jan 02, 2021 at 01:35:24PM -0500, Joseph Hughes
> >      wrote:
> >      > Does anyone here know the rules about using orchestra
> >      macros within multi
> >      > line strings ({{...}} )? I'm not getting the output I
> >      would expect. Here's
> >      > an example:
> >      >
> >      > #define EXAMPLE(ARG_1) #
> >      > prints {{ Here I expect to see the value of ARG_1 but
> >      instead I get the
> >      > following: }}
> >      > prints {{$ARG_1}}
> >      > prints {{%n%n}}
> >      >
> >      > prints {{ A dollar sign in a string block returns the name
> >      of the parent
> >      > macro: }}
> >      > prints {{$}}
> >      > prints {{%n%n}}
> >      > #
> >      >
> >      > $EXAMPLE(test)
> >      >
> >      >
> >      > The output for the above is:
> >      >
> >      > >  Here I expect to see the value of ARG_1 but instead I
> >      get the following:
> >      > >  $`EXAMPLE``ARG_1
> >      > >
> >      > >  A dollar sign in a string block returns the name of the
> >      parent macro:
> >      > > $`EXAMPLE``
> >      > >
> >      >
> >      > Are there rules around multiline strings and macros that
> >      I'm unaware of?
> >      > Thanks for your time, everyone.
> >      >
> >      > 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
> >
> >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
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