Csound Csound-dev Csound-tekno Search About

Re: [Csnd] errors in macro with underscore

Date2018-10-25 12:46
FromAndreas Bergsland
SubjectRe: [Csnd] errors in macro with underscore
Thanks a lot, John. I didn't know that. Maybe that info could be added to the manual?
All the best, 
Andreas


On 25/10/2018, 12:51, "A discussion list for users of Csound on behalf of John ff"  wrote:

    We have seen this before.  If _ is a valid characteristics a name then $V_ is an undefined macro.  You need to use $V._ to get concatenation.
    
    
    
    ⁣Sent from TypeApp ​
    
    On Oct 25, 2018, 07:49, at 07:49, Andreas Bergsland  wrote:
    >Hi
    >I had problems when revisiting a csd that used to run on 5.10. It
    >turned out the errors were due to underscores in some of the macros, so
    >that this code
    >
    >#define TEST(V)
    >#
    >prints    "$V_"
    >#
    >
    >instr       1
    >$TEST(1)
    >endin
    >
    >would print
    >$error
    >
    >
    >When the underscore was replaced by other signs, it behaved as
    >expected, e.g.
    >#define TEST(V)
    >#
    >prints    "$V-"
    >#
    >
    >instr       1
    >$TEST(1)
    >endin
    >
    >would print
    >1-
    >
    >as expected
    >
    >Best,
    >Andreas
    >
    >--
    >Andreas Bergsland
    >
    >Associate professor - førsteamanuensis
    >Study Programme Leader - studieprogramleder
    >Music Technology Programme - Musikkteknologiseksjonen
    >Department of Music - Institutt for musikk
    >Olavskvartalet
    >NTNU (Norwegian University of Science and Technology)
    >7491 Trondheim, NORWAY
    >
    >Visiting address/besøksadresse: Fjordgt.1 (3.etg.)
    >e-mail: andreas.bergsland@ntnu.no
    >Office phone (Skype for business):7359 0096
    >Mobil: 4566 3316
    >http://folk.ntnu.no/andbe
    >https://www.vibra.no/
    >https://www.ntnu.edu/artec
    >
    >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-10-25 15:57
Fromjpff
SubjectRe: [Csnd] errors in macro with underscore
It is in the manual.  Read the second paragraph below


On Thu, 25 Oct 2018, Andreas Bergsland wrote:

> Thanks a lot, John. I didn't know that. Maybe that info could be added to the manual?
> All the best,
> Andreas
>


$NAME

$NAME — Calls a defined macro.
Description

Macros are textual replacements which are made in the orchestra as it is 
being read. The macro system in Csound is a very simple one, and uses the 
characters # and $ to define and call macros. This can save typing, and 
can lead to a coherent structure and consistent style. This is similar to, 
but independent of, the macro system in the score language.

$NAME -- calls a defined macro. To use a macro, the name is used following 
a $ character. The name is terminated by the first character which is 
neither a letter nor a number. If it is necessary for the name not to 
terminate with a space, a period, which will be ignored, can be used to 
terminate the name. The string, $NAME., is replaced by the replacement 
text from the definition. The replacement text can also include macro 
calls.

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-10-25 16:25
FromAndreas Bergsland
SubjectRe: [Csnd] errors in macro with underscore
Many thanks for the help. I didn't think of checking the $NAME entry.
Best, 
Andreas

On 25/10/2018, 16:58, "A discussion list for users of Csound on behalf of jpff"  wrote:

    It is in the manual.  Read the second paragraph below
    
    
    On Thu, 25 Oct 2018, Andreas Bergsland wrote:
    
    > Thanks a lot, John. I didn't know that. Maybe that info could be added to the manual?
    > All the best,
    > Andreas
    >
    
    
    $NAME
    
    $NAME — Calls a defined macro.
    Description
    
    Macros are textual replacements which are made in the orchestra as it is 
    being read. The macro system in Csound is a very simple one, and uses the 
    characters # and $ to define and call macros. This can save typing, and 
    can lead to a coherent structure and consistent style. This is similar to, 
    but independent of, the macro system in the score language.
    
    $NAME -- calls a defined macro. To use a macro, the name is used following 
    a $ character. The name is terminated by the first character which is 
    neither a letter nor a number. If it is necessary for the name not to 
    terminate with a space, a period, which will be ignored, can be used to 
    terminate the name. The string, $NAME., is replaced by the replacement 
    text from the definition. The replacement text can also include macro 
    calls.
    
    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