Huge monolithic ones like the .dme cause difficulties in collaborative projects and don't allow for any modularity, and sticking smaller ones in every folder clutters the source.
And of course, having to edit the index every time a file is moved/renamed isn't fun.
And then there's all sorts of tactics that may be needed to manage a large and complex project in a clear and maintainable way.
So it'd be nice to have some more options for #include, especially path operators, wildcards, and composition of defines and paths.
Current example:
// File structure
////////////////////////////////
//
// project
// examples
// style_red
// example1.dm
// example2.dm
// example3.dm
// style_blue
// example1.dm
// example2.dm
// example3.dm
// style_green
// example1.dm
// example2.dm
// example3.dm
// example4.dm
// example5.dm
// example6.dm
// example7.dm
// example8.dm
// example9.dm
// project.dme
//
// project.dme
////////////////////////////////
#define STYLE_RED
//#define STYLE_BLUE
//#define STYLE_GREEN
#if defined(STYLE_RED)
#include "examples/style_red/example1.dm"
#include "examples/style_red/example2.dm"
#include "examples/style_red/example3.dm"
#elif defined(STYLE_BLUE)
#include "examples/style_blue/example1.dm"
#include "examples/style_blue/example2.dm"
#include "examples/style_blue/example3.dm"
#else
#include "examples/style_green/example1.dm"
#include "examples/style_green/example2.dm"
#include "examples/style_green/example3.dm"
#endif
#include "examples/example4.dm"
#include "examples/example5.dm"
#include "examples/example6.dm"
#include "example7.dm"
#include "example8.dm"
#include "example9.dm"
Proposed example:
// This is shown with strings and conc'n a la C99
// Since afaik that's closest to the compiler's internals
// So it'd be the most feasible way to do this
//
// / is the downwards path operator
// . is the upwards path operator
// * is a wildcard
// "" indicates a literal
// ## is concatenation
//
// File structure
////////////////////////////////
//
// project
// examples
// make.dm
// style_red
// example1.dm
// example2.dm
// example3.dm
// style_blue
// example1.dm
// example2.dm
// example3.dm
// style_green
// example1.dm
// example2.dm
// example3.dm
// example4.dm
// example5.dm
// example6.dm
// style.dm
// example7.dm
// example8.dm
// example9.dm
// project.dme
//
// style.dm
////////////////////////////////
#define STYLE "red"
// project.dme
////////////////////////////////
#include "examples"/"make.dm"
#include "example"##*##".dm"
// examples/make.dm
////////////////////////////////
#include ./"style.dm"
#include "style_"##STYLE/ *##".dm" //Space to avoid comment open?
#include *##".dm"
How feasible would it be to expand the pre-processor's #include command like this?
Even if the above example is completely impossible at the moment, what about smaller expansions, such as #include'ing a directory (ie telling the compiler to process everything in a certain folder)?
http://www.byond.com/forum/?post=1411008
That also requests wildcards in #includes, though I'd personally prefer plain make.dm files instead of .dme's designed to be auto-generated.