expanding includes
Date | 2006-03-23 22:28 |
From | Atte André Jensen |
Subject | expanding includes |
Hi I have an score and an orchestra with lots of includes, several levels deep. Is there a way to expand the score/orchestra and get two self-contained files? -- peace, love & harmony Atte http://www.atte.dk |
Date | 2006-03-24 04:59 |
From | Anthony Kozar |
Subject | Re: expanding includes |
Well, since the syntax for including files is the same in Csound as it is in C (at least if you use ""), then I would think that you could use the C Preprocessor to do the job. I am not sure what the options to gcc would be for just preprocesing a file, but you could probably find out with a "man gcc". Note, though, that if you also have macros in your files (or the new #ifdef) that these will likely cause the C preprocessor to report errors or to perform text substitutions that you do not want it to. Anthony Kozar anthonykozar AT sbcglobal DOT net Atte André Jensen wrote on 3/23/06 5:28 PM: > I have an score and an orchestra with lots of includes, several levels > deep. Is there a way to expand the score/orchestra and get two > self-contained files? |
Date | 2006-03-24 09:20 |
From | Atte André Jensen |
Subject | Re: expanding includes |
Anthony Kozar wrote: > Note, though, that if you also have macros in your files (or the new #ifdef) > that these will likely cause the C preprocessor to report errors or to > perform text substitutions that you do not want it to. I have loads of macros, so... Any other ideas? -- peace, love & harmony Atte http://www.atte.dk |
Date | 2006-03-24 18:21 |
From | Anthony Kozar |
Subject | Re: expanding includes |
Attachments | CsInclExp.cpp |
Attached is a simple C++ program that reads in a CSD, Orc, or Sco file and recursively expands its includes. Currently, your files must all be in the same directory or your #includes should use appropriate relative and/or full pathnames. Output is sent to standard out, so use it like this: programname [inputfile] > outputfile It seems to work reasonably well for me, but it is probably not perfect. (For one thing, it does not emulate Csound's (faulty) include behavior where linefeeds are not added to the end of an included file if not present). If anyone makes improvements to this program, I would appreciate receiving a copy of your code. (One good feature to add would be the ability to set include directories from the commandline). Anthony Kozar anthonykozar AT sbcglobal DOT net Atte André Jensen wrote on 3/24/06 4:20 AM: > Anthony Kozar wrote: > >> Note, though, that if you also have macros in your files (or the new #ifdef) >> that these will likely cause the C preprocessor to report errors or to >> perform text substitutions that you do not want it to. > > I have loads of macros, so... > > Any other ideas? |