Hey hey,
is there a way to use a macro inside a double quoted string, something like:
Sname = "$PREFIXsuffix"
or #include "$MYDIR/subfolder/file.inc"
Admittedly, the first case can be achieved with string functions and a global string, but the latter can't.
It has been a while and I'm rather out of practice... but I used
macros a lot when I was working with csound/cabbage more regularly.
According to the score macro manual page, Score Macros :
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 to be immediately followed by a leter or digit, a period, which
will be ignored, can be used to terminate the name.
So in your case that might look like: #include "$MYDIR./subfolder/file.inc"
Hi Kevin,
Jun 14 2024, Kevin Welsh has written:
...
So in your case that might look like: #include "$MYDIR./subfolder/file.inc"
...
Thanks Kevin. I was aware of the basic syntax and even the dot operator,
which I SHOULD have mentioned. It appears that macro substitution simply
does not work in strings: #define MYDIR #csound/udos/# #include "$MYDIR.opcode.udo"
Will output the error message:
Cannot open #include'd file $MYDIR.opcode.udo
I think I'm stuck with external means to adapt such things.