[Csnd] Syntax for #include

classic Classic list List threaded Threaded
15 messages Options
Reply | Threaded
Open this post in threaded view
|

[Csnd] Syntax for #include

jpff
At present the file name in #include can be delimited by any character
like
#include /foo/
but I think most people use
#include "foo"

I have a complete fix to macros inside the string if the delimiter is
always a double quote, in effect making the #include use the same string
syntax as elsewhere in orc/sco/csd

BUT this would be an incompatible change.  Does anyone use a non " in
this context?  Any thoughts on this change

And the new version has simpler code
==John ffitch

Csound mailing list
[hidden email]
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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] Syntax for #include

Dave Seidel
I'm in favor of simplifying it.

On Fri, Jun 8, 2018 at 4:11 PM John <[hidden email]> wrote:
At present the file name in #include can be delimited by any character
like
#include /foo/
but I think most people use
#include "foo"

I have a complete fix to macros inside the string if the delimiter is
always a double quote, in effect making the #include use the same string
syntax as elsewhere in orc/sco/csd

BUT this would be an incompatible change.  Does anyone use a non " in
this context?  Any thoughts on this change

And the new version has simpler code
==John ffitch

Csound mailing list
[hidden email]
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 [hidden email] 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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] Syntax for #include

Michael Gogins-2
In reply to this post by jpff
Occasional backwardsly incompatible changes may be necessary and they can be tolerable if there is an error or warning message with enough context that an ordinary human being can interpret it. 

Best, 
Mike

On Fri, Jun 8, 2018, 16:11 John <[hidden email]> wrote:
At present the file name in #include can be delimited by any character
like
#include /foo/
but I think most people use
#include "foo"

I have a complete fix to macros inside the string if the delimiter is
always a double quote, in effect making the #include use the same string
syntax as elsewhere in orc/sco/csd

BUT this would be an incompatible change.  Does anyone use a non " in
this context?  Any thoughts on this change

And the new version has simpler code
==John ffitch

Csound mailing list
[hidden email]
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 [hidden email] 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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] Syntax for #include

thorin kerr
In reply to this post by jpff
Seems OK, but, does this also mean filenames in the include string can't use the $ character?

T




On Sat, 9 Jun. 2018, 6:11 am John, <[hidden email]> wrote:
At present the file name in #include can be delimited by any character
like
#include /foo/
but I think most people use
#include "foo"

I have a complete fix to macros inside the string if the delimiter is
always a double quote, in effect making the #include use the same string
syntax as elsewhere in orc/sco/csd

BUT this would be an incompatible change.  Does anyone use a non " in
this context?  Any thoughts on this change

And the new version has simpler code
==John ffitch

Csound mailing list
[hidden email]
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 [hidden email] 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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] Syntax for #include

Dave Seidel
Good point. Hopefully all legal filenames will be allowed (including spaces). Should be fine as long as they're delimited by quotes. 

On Fri, Jun 8, 2018, 7:46 PM thorin kerr <[hidden email]> wrote:
Seems OK, but, does this also mean filenames in the include string can't use the $ character?

T




On Sat, 9 Jun. 2018, 6:11 am John, <[hidden email]> wrote:
At present the file name in #include can be delimited by any character
like
#include /foo/
but I think most people use
#include "foo"

I have a complete fix to macros inside the string if the delimiter is
always a double quote, in effect making the #include use the same string
syntax as elsewhere in orc/sco/csd

BUT this would be an incompatible change.  Does anyone use a non " in
this context?  Any thoughts on this change

And the new version has simpler code
==John ffitch

Csound mailing list
[hidden email]
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 [hidden email] 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 [hidden email] 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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] Syntax for #include

jpff
In reply to this post by jpff
In the light of comments I have left #include exactly like it was but
introduced a new preprocessor option #read

#read is like #include except:
(a) it must use delimiter double quote like a string, and
(b) the string is subject to macro expansion

This maintains backward compatability and gives a way for macros to be
used generally in reading file names.

==John ffitch

Csound mailing list
[hidden email]
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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] Syntax for #include

Dave Seidel
Thanks, John, this makes sense. Though perhaps you might consider using a more standard name for the directive, such as "import"? 

On Sun, Jun 10, 2018, 11:32 AM John <[hidden email]> wrote:
In the light of comments I have left #include exactly like it was but
introduced a new preprocessor option #read

#read is like #include except:
(a) it must use delimiter double quote like a string, and
(b) the string is subject to macro expansion

This maintains backward compatability and gives a way for macros to be
used generally in reading file names.

==John ffitch

Csound mailing list
[hidden email]
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 [hidden email] 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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] Syntax for #include

jpff
I did suggest import but that clashed with csound7 llans

Sent from Blue
On 10 Jun 2018, at 17:07, Dave Seidel <[hidden email]> wrote:
Thanks, John, this makes sense. Though perhaps you might consider using a more standard name for the directive, such as "import"? 

On Sun, Jun 10, 2018, 11:32 AM John < [hidden email]> wrote:
In the light of comments I have left #include exactly like it was but
introduced a new preprocessor option #read

#read is like #include except:
(a) it must use delimiter double quote like a string, and
(b) the string is subject to macro expansion

This maintains backward compatability and gives a way for macros to be
used generally in reading file names.

==John ffitch

Csound mailing list
[hidden email]
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 [hidden email] 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 [hidden email] 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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] Syntax for #include

Michael Gogins-2
I suggest "#include2" or "#includestr" so the relation with and difference from "#include" is more clear.

Regards, 
Mike

On Sun, Jun 10, 2018, 12:18 John ff <[hidden email]> wrote:
I did suggest import but that clashed with csound7 llans

Sent from Blue
On 10 Jun 2018, at 17:07, Dave Seidel <[hidden email]> wrote:
Thanks, John, this makes sense. Though perhaps you might consider using a more standard name for the directive, such as "import"? 

On Sun, Jun 10, 2018, 11:32 AM John < [hidden email]> wrote:
In the light of comments I have left #include exactly like it was but
introduced a new preprocessor option #read

#read is like #include except:
(a) it must use delimiter double quote like a string, and
(b) the string is subject to macro expansion

This maintains backward compatability and gives a way for macros to be
used generally in reading file names.

==John ffitch

Csound mailing list
[hidden email]
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 [hidden email] 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 [hidden email] 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 [hidden email] 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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] Syntax for #include

Dave Seidel
I like #includestr

On Sun, Jun 10, 2018, 1:15 PM Michael Gogins <[hidden email]> wrote:
I suggest "#include2" or "#includestr" so the relation with and difference from "#include" is more clear.

Regards, 
Mike

On Sun, Jun 10, 2018, 12:18 John ff <[hidden email]> wrote:
I did suggest import but that clashed with csound7 llans

Sent from Blue
On 10 Jun 2018, at 17:07, Dave Seidel <[hidden email]> wrote:
Thanks, John, this makes sense. Though perhaps you might consider using a more standard name for the directive, such as "import"? 

On Sun, Jun 10, 2018, 11:32 AM John < [hidden email]> wrote:
In the light of comments I have left #include exactly like it was but
introduced a new preprocessor option #read

#read is like #include except:
(a) it must use delimiter double quote like a string, and
(b) the string is subject to macro expansion

This maintains backward compatability and gives a way for macros to be
used generally in reading file names.

==John ffitch

Csound mailing list
[hidden email]
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 [hidden email] 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 [hidden email] 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 [hidden email] 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 [hidden email] 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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] Syntax for #include

Steven Yi
Again, I'll ask: why aren't you all using the INCDIR enviroment
variable to define where to #include files from?

Or another question: what does this feature give us for benefits
versus the maintenance and pedagogical costs?

If there's a problem with INCDIR and the current method for file
inclusion, then I'd rather first see if that can be addressed with the
current facilities, which I do not think has been considered in this
thread. What I see here is a new solution to a problem that already
had a solution.

I think it's a real burden to add more code/features when there's
already a valid solution that covers the use cases brought up on this
list so far.  I'd also mention that most import/include systems I know
do not offer such features and everyone gets on just fine by setting a
list of source paths and/or using #ifdefs to conditionally include
from specific locations. (That said, if someone has an example where
file inclusion is done as proposed in other languages/systems, it'd be
useful to understand here.)


On Sun, Jun 10, 2018 at 10:29 AM Dave Seidel <[hidden email]> wrote:

>
> I like #includestr
>
> On Sun, Jun 10, 2018, 1:15 PM Michael Gogins <[hidden email]> wrote:
>>
>> I suggest "#include2" or "#includestr" so the relation with and difference from "#include" is more clear.
>>
>> Regards,
>> Mike
>>
>> On Sun, Jun 10, 2018, 12:18 John ff <[hidden email]> wrote:
>>>
>>> I did suggest import but that clashed with csound7 llans
>>>
>>> Sent from Blue
>>> On 10 Jun 2018, at 17:07, Dave Seidel <[hidden email]> wrote:
>>>>
>>>> Thanks, John, this makes sense. Though perhaps you might consider using a more standard name for the directive, such as "import"?
>>>>
>>>> On Sun, Jun 10, 2018, 11:32 AM John < [hidden email]> wrote:
>>>>>
>>>>> In the light of comments I have left #include exactly like it was but
>>>>> introduced a new preprocessor option #read
>>>>>
>>>>> #read is like #include except:
>>>>> (a) it must use delimiter double quote like a string, and
>>>>> (b) the string is subject to macro expansion
>>>>>
>>>>> This maintains backward compatability and gives a way for macros to be
>>>>> used generally in reading file names.
>>>>>
>>>>> ==John ffitch
>>>>>
>>>>> Csound mailing list
>>>>> [hidden email]
>>>>> 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 [hidden email] 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 [hidden email] 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 [hidden email] 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 [hidden email] 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
[hidden email]
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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] Syntax for #include

Dave Seidel
INCDIR is not a good solution for my use-case, at least. I would like to have a number of "modules" (table definitions and other orchestra code) that use consistent naming, and would like to be able to specify on the command-line which one to load. Specifically, I have a set of tuning tables for a MIDI keyboard/controller-driven piece, and when I load it up, I want to be able to specify the tuning. I don't want to have to put a bunch of small files each into a separate subdirectory -- in fact, I would like to have them all in the *same* subdirectory. For this scenario, I would like to be able to use something like "--omacro:SCALE=xxx" to specify what gets loaded for a particular run, and then within the CSD, "#include $xxx.inc". I don't necessarily expect to get exactly what I want, but INCDIR would be rather clumsy in this case, IMO.

On Sun, Jun 10, 2018 at 3:11 PM Steven Yi <[hidden email]> wrote:
Again, I'll ask: why aren't you all using the INCDIR enviroment
variable to define where to #include files from?

Or another question: what does this feature give us for benefits
versus the maintenance and pedagogical costs?

If there's a problem with INCDIR and the current method for file
inclusion, then I'd rather first see if that can be addressed with the
current facilities, which I do not think has been considered in this
thread. What I see here is a new solution to a problem that already
had a solution.

I think it's a real burden to add more code/features when there's
already a valid solution that covers the use cases brought up on this
list so far.  I'd also mention that most import/include systems I know
do not offer such features and everyone gets on just fine by setting a
list of source paths and/or using #ifdefs to conditionally include
from specific locations. (That said, if someone has an example where
file inclusion is done as proposed in other languages/systems, it'd be
useful to understand here.)


On Sun, Jun 10, 2018 at 10:29 AM Dave Seidel <[hidden email]> wrote:
>
> I like #includestr
>
> On Sun, Jun 10, 2018, 1:15 PM Michael Gogins <[hidden email]> wrote:
>>
>> I suggest "#include2" or "#includestr" so the relation with and difference from "#include" is more clear.
>>
>> Regards,
>> Mike
>>
>> On Sun, Jun 10, 2018, 12:18 John ff <[hidden email]> wrote:
>>>
>>> I did suggest import but that clashed with csound7 llans
>>>
>>> Sent from Blue
>>> On 10 Jun 2018, at 17:07, Dave Seidel <[hidden email]> wrote:
>>>>
>>>> Thanks, John, this makes sense. Though perhaps you might consider using a more standard name for the directive, such as "import"?
>>>>
>>>> On Sun, Jun 10, 2018, 11:32 AM John < [hidden email]> wrote:
>>>>>
>>>>> In the light of comments I have left #include exactly like it was but
>>>>> introduced a new preprocessor option #read
>>>>>
>>>>> #read is like #include except:
>>>>> (a) it must use delimiter double quote like a string, and
>>>>> (b) the string is subject to macro expansion
>>>>>
>>>>> This maintains backward compatability and gives a way for macros to be
>>>>> used generally in reading file names.
>>>>>
>>>>> ==John ffitch
>>>>>
>>>>> Csound mailing list
>>>>> [hidden email]
>>>>> 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 [hidden email] 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 [hidden email] 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 [hidden email] 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 [hidden email] 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
[hidden email]
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 [hidden email] 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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] Syntax for #include

Steven Yi
So right now you could organize your code into something like this
directory structure:

project_dir
+ scale0
  + scale.inc
+ scale1
  + scale.inc

use this include:

#include "scale.inc"

and set it on commandline using

--env:INCDIR+=scale0

for example.

But you're saying you'd rather have:

project_dir
+ project.csd
+ scale0.inc
+ scale1.inc

use this include:

#include "$SCALE.inc"

and use a commandline of:

--omacro:SCALE=scale0


I can see how the latter has some elegance to it but I'd say the first
is clear enough. It's fine that we have differences of opinion on if
this is clumsy or not though. The former does work today which is one
thing it has going for it.  Another option is to have multiple CSD
files, one for each configuration.  You could have something like:

project_dir
+ scale0.csd
+ scale1.csd
+ lib
  + main.orc
  + scale0.orc
  + scale1.orc

where scale0.csd is a very small CSD that has:

#include "lib/scale0.orc"
#include "lib/main.orc"

and scale1.csd has:

#include "lib/scale1.orc"
#include "lib/main.orc"

Another possibility is the scale specific code could be in the CSD and
just the main.orc is included, something like:

project_dir
+ scale0.csd
+ scale1.csd
+ main.orc

These options require no special commandline flags necessary and
everything for the exact configuration you want is set, you just
choose which CSD to run.

There's also using #ifdefs with something like:

#ifdef SCALE0
#include "scale0.inc"
#endif

etc. which is not the nicest I think.

Anyways, there are some options in today's Csound for choosing what
code to use as part of a project.  I'd mention that Python has
importlib for dynamic module import, but something like this not
possible with CPP (C Preprocessor) as far as I know, and I think we
could get on just fine without it.

On Sun, Jun 10, 2018 at 5:13 PM Dave Seidel <[hidden email]> wrote:

>
> INCDIR is not a good solution for my use-case, at least. I would like to have a number of "modules" (table definitions and other orchestra code) that use consistent naming, and would like to be able to specify on the command-line which one to load. Specifically, I have a set of tuning tables for a MIDI keyboard/controller-driven piece, and when I load it up, I want to be able to specify the tuning. I don't want to have to put a bunch of small files each into a separate subdirectory -- in fact, I would like to have them all in the *same* subdirectory. For this scenario, I would like to be able to use something like "--omacro:SCALE=xxx" to specify what gets loaded for a particular run, and then within the CSD, "#include $xxx.inc". I don't necessarily expect to get exactly what I want, but INCDIR would be rather clumsy in this case, IMO.
>
> On Sun, Jun 10, 2018 at 3:11 PM Steven Yi <[hidden email]> wrote:
>>
>> Again, I'll ask: why aren't you all using the INCDIR enviroment
>> variable to define where to #include files from?
>>
>> Or another question: what does this feature give us for benefits
>> versus the maintenance and pedagogical costs?
>>
>> If there's a problem with INCDIR and the current method for file
>> inclusion, then I'd rather first see if that can be addressed with the
>> current facilities, which I do not think has been considered in this
>> thread. What I see here is a new solution to a problem that already
>> had a solution.
>>
>> I think it's a real burden to add more code/features when there's
>> already a valid solution that covers the use cases brought up on this
>> list so far.  I'd also mention that most import/include systems I know
>> do not offer such features and everyone gets on just fine by setting a
>> list of source paths and/or using #ifdefs to conditionally include
>> from specific locations. (That said, if someone has an example where
>> file inclusion is done as proposed in other languages/systems, it'd be
>> useful to understand here.)
>>
>>
>> On Sun, Jun 10, 2018 at 10:29 AM Dave Seidel <[hidden email]> wrote:
>> >
>> > I like #includestr
>> >
>> > On Sun, Jun 10, 2018, 1:15 PM Michael Gogins <[hidden email]> wrote:
>> >>
>> >> I suggest "#include2" or "#includestr" so the relation with and difference from "#include" is more clear.
>> >>
>> >> Regards,
>> >> Mike
>> >>
>> >> On Sun, Jun 10, 2018, 12:18 John ff <[hidden email]> wrote:
>> >>>
>> >>> I did suggest import but that clashed with csound7 llans
>> >>>
>> >>> Sent from Blue
>> >>> On 10 Jun 2018, at 17:07, Dave Seidel <[hidden email]> wrote:
>> >>>>
>> >>>> Thanks, John, this makes sense. Though perhaps you might consider using a more standard name for the directive, such as "import"?
>> >>>>
>> >>>> On Sun, Jun 10, 2018, 11:32 AM John < [hidden email]> wrote:
>> >>>>>
>> >>>>> In the light of comments I have left #include exactly like it was but
>> >>>>> introduced a new preprocessor option #read
>> >>>>>
>> >>>>> #read is like #include except:
>> >>>>> (a) it must use delimiter double quote like a string, and
>> >>>>> (b) the string is subject to macro expansion
>> >>>>>
>> >>>>> This maintains backward compatability and gives a way for macros to be
>> >>>>> used generally in reading file names.
>> >>>>>
>> >>>>> ==John ffitch
>> >>>>>
>> >>>>> Csound mailing list
>> >>>>> [hidden email]
>> >>>>> 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 [hidden email] 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 [hidden email] 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 [hidden email] 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 [hidden email] 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
>> [hidden email]
>> 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 [hidden email] 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
[hidden email]
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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] Syntax for #include

thorin kerr
In reply to this post by Dave Seidel
I'd have thought if macros were expanded prior to processing #include statements, then a lot of this would be solved. Just put the delimiters in your definition and call.

E.g. Daves use case: 
--omacro:Scale=Myscale' 
#include '$

Expanded =  #include 'Myscale'

Similarly, if you go back to the original poster's issue:

#include 
#define PATHH #'/path/to/somewere#
#include $PATHH/file1.txt'
#include $PATHH/file2.txt'
#include $PATHH/file3.txt'

 -- Thorin




On Mon, 11 Jun. 2018, 10:13 am Dave Seidel, <[hidden email]> wrote:
INCDIR is not a good solution for my use-case, at least. I would like to have a number of "modules" (table definitions and other orchestra code) that use consistent naming, and would like to be able to specify on the command-line which one to load. Specifically, I have a set of tuning tables for a MIDI keyboard/controller-driven piece, and when I load it up, I want to be able to specify the tuning. I don't want to have to put a bunch of small files each into a separate subdirectory -- in fact, I would like to have them all in the *same* subdirectory. For this scenario, I would like to be able to use something like "--omacro:SCALE=xxx" to specify what gets loaded for a particular run, and then within the CSD, "#include $xxx.inc". I don't necessarily expect to get exactly what I want, but INCDIR would be rather clumsy in this case, IMO.

On Sun, Jun 10, 2018 at 3:11 PM Steven Yi <[hidden email]> wrote:
Again, I'll ask: why aren't you all using the INCDIR enviroment
variable to define where to #include files from?

Or another question: what does this feature give us for benefits
versus the maintenance and pedagogical costs?

If there's a problem with INCDIR and the current method for file
inclusion, then I'd rather first see if that can be addressed with the
current facilities, which I do not think has been considered in this
thread. What I see here is a new solution to a problem that already
had a solution.

I think it's a real burden to add more code/features when there's
already a valid solution that covers the use cases brought up on this
list so far.  I'd also mention that most import/include systems I know
do not offer such features and everyone gets on just fine by setting a
list of source paths and/or using #ifdefs to conditionally include
from specific locations. (That said, if someone has an example where
file inclusion is done as proposed in other languages/systems, it'd be
useful to understand here.)


On Sun, Jun 10, 2018 at 10:29 AM Dave Seidel <[hidden email]> wrote:
>
> I like #includestr
>
> On Sun, Jun 10, 2018, 1:15 PM Michael Gogins <[hidden email]> wrote:
>>
>> I suggest "#include2" or "#includestr" so the relation with and difference from "#include" is more clear.
>>
>> Regards,
>> Mike
>>
>> On Sun, Jun 10, 2018, 12:18 John ff <[hidden email]> wrote:
>>>
>>> I did suggest import but that clashed with csound7 llans
>>>
>>> Sent from Blue
>>> On 10 Jun 2018, at 17:07, Dave Seidel <[hidden email]> wrote:
>>>>
>>>> Thanks, John, this makes sense. Though perhaps you might consider using a more standard name for the directive, such as "import"?
>>>>
>>>> On Sun, Jun 10, 2018, 11:32 AM John < [hidden email]> wrote:
>>>>>
>>>>> In the light of comments I have left #include exactly like it was but
>>>>> introduced a new preprocessor option #read
>>>>>
>>>>> #read is like #include except:
>>>>> (a) it must use delimiter double quote like a string, and
>>>>> (b) the string is subject to macro expansion
>>>>>
>>>>> This maintains backward compatability and gives a way for macros to be
>>>>> used generally in reading file names.
>>>>>
>>>>> ==John ffitch
>>>>>
>>>>> Csound mailing list
>>>>> [hidden email]
>>>>> 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 [hidden email] 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 [hidden email] 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 [hidden email] 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 [hidden email] 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
[hidden email]
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 [hidden email] 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 [hidden email] 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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] Syntax for #include

jpff
That would require a redesign of the macro system equivalent to what  did with #read (or #includestr?) and has the same compatibility issue.

⁣Sent from TypeApp ​

On Jun 11, 2018, 02:26, at 02:26, thorin kerr <[hidden email]> wrote:

>I'd have thought if macros were expanded prior to processing #include
>statements, then a lot of this would be solved. Just put the delimiters
>in
>your definition and call.
>
>E.g. Daves use case:
>--omacro:Scale=Myscale'
>#include '$
>
>Expanded =  #include 'Myscale'
>
>Similarly, if you go back to the original poster's issue:
>
>#include
>#define PATHH #'/path/to/somewere#
>#include $PATHH/file1.txt'
>#include $PATHH/file2.txt'
>#include $PATHH/file3.txt'
>
> -- Thorin
>
>
>
>
>On Mon, 11 Jun. 2018, 10:13 am Dave Seidel, <[hidden email]>
>wrote:
>
>> INCDIR is not a good solution for my use-case, at least. I would like
>to
>> have a number of "modules" (table definitions and other orchestra
>code)
>> that use consistent naming, and would like to be able to specify on
>the
>> command-line which one to load. Specifically, I have a set of tuning
>tables
>> for a MIDI keyboard/controller-driven piece, and when I load it up, I
>want
>> to be able to specify the tuning. I don't want to have to put a bunch
>of
>> small files each into a separate subdirectory -- in fact, I would
>like to
>> have them all in the *same* subdirectory. For this scenario, I would
>like
>> to be able to use something like "--omacro:SCALE=xxx" to specify what
>gets
>> loaded for a particular run, and then within the CSD, "#include
>$xxx.inc".
>> I don't necessarily expect to get exactly what I want, but INCDIR
>would be
>> rather clumsy in this case, IMO.
>>
>> On Sun, Jun 10, 2018 at 3:11 PM Steven Yi <[hidden email]> wrote:
>>
>>> Again, I'll ask: why aren't you all using the INCDIR enviroment
>>> variable to define where to #include files from?
>>>
>>> Or another question: what does this feature give us for benefits
>>> versus the maintenance and pedagogical costs?
>>>
>>> If there's a problem with INCDIR and the current method for file
>>> inclusion, then I'd rather first see if that can be addressed with
>the
>>> current facilities, which I do not think has been considered in this
>>> thread. What I see here is a new solution to a problem that already
>>> had a solution.
>>>
>>> I think it's a real burden to add more code/features when there's
>>> already a valid solution that covers the use cases brought up on
>this
>>> list so far.  I'd also mention that most import/include systems I
>know
>>> do not offer such features and everyone gets on just fine by setting
>a
>>> list of source paths and/or using #ifdefs to conditionally include
>>> from specific locations. (That said, if someone has an example where
>>> file inclusion is done as proposed in other languages/systems, it'd
>be
>>> useful to understand here.)
>>>
>>>
>>> On Sun, Jun 10, 2018 at 10:29 AM Dave Seidel <[hidden email]>
>>> wrote:
>>> >
>>> > I like #includestr
>>> >
>>> > On Sun, Jun 10, 2018, 1:15 PM Michael Gogins
><[hidden email]>
>>> wrote:
>>> >>
>>> >> I suggest "#include2" or "#includestr" so the relation with and
>>> difference from "#include" is more clear.
>>> >>
>>> >> Regards,
>>> >> Mike
>>> >>
>>> >> On Sun, Jun 10, 2018, 12:18 John ff <[hidden email]> wrote:
>>> >>>
>>> >>> I did suggest import but that clashed with csound7 llans
>>> >>>
>>> >>> Sent from Blue
>>> >>> On 10 Jun 2018, at 17:07, Dave Seidel <[hidden email]>
>wrote:
>>> >>>>
>>> >>>> Thanks, John, this makes sense. Though perhaps you might
>consider
>>> using a more standard name for the directive, such as "import"?
>>> >>>>
>>> >>>> On Sun, Jun 10, 2018, 11:32 AM John < [hidden email]>
>wrote:
>>> >>>>>
>>> >>>>> In the light of comments I have left #include exactly like it
>was
>>> but
>>> >>>>> introduced a new preprocessor option #read
>>> >>>>>
>>> >>>>> #read is like #include except:
>>> >>>>> (a) it must use delimiter double quote like a string, and
>>> >>>>> (b) the string is subject to macro expansion
>>> >>>>>
>>> >>>>> This maintains backward compatability and gives a way for
>macros to
>>> be
>>> >>>>> used generally in reading file names.
>>> >>>>>
>>> >>>>> ==John ffitch
>>> >>>>>
>>> >>>>> Csound mailing list
>>> >>>>> [hidden email]
>>> >>>>> 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 [hidden email]
>>> 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 [hidden email]
>>> 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 [hidden email]
>>> 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 [hidden email]
>>> 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
>>> [hidden email]
>>> 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 [hidden email]
>> 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
>[hidden email]
>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
[hidden email]
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