On 10/08/2011 21:32, Marco Leise wrote:
For starters, how about this?:
static string someExternalText = __ctfeReadFile("external.txt");
static byte[] chipInitialState = __ctfeReadFile("initial_state.bin");
Every external file used in compiling a source file would be added to
the list of files to check for their modification date in relation to
the resulting object file. This ensures that the object is recreated
when either of the sources change. The list can be in a separate file
per each D source using this feature.
This offers:
- no execution of arbitrary commands
- usual compile-if-newer logic doesn't reinvent the wheel
- compile-time conversion of C headers
- add snippets in domain specific languages by their own respective
source files
- include microcode blobs and other binary data in your modules if desired
Personally I think this idea rocks, but YMMV :p .
You can already do that!
enum _ = import("someFile");
Then when compiling, use the -J switch (required) to specify the include
directory.
--
Robert
http://octarineparrot.com/