www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Preprocessing with Build

reply AJG <AJG_member pathlink.com> writes:
Hi,

Is this possible yet? Here's what I would like to do:





What happens is:
1) "/usr/bin/bar -f foo" is run.
2) The result is #include'd, literally, into main() right there.

I took a look at the pragmas already available but I couldn't figure out if what
I want to do is doable. Bear in mind, I don't want to LINK anything. I want to
#include something after being processed by some arbitrary binary.

What's the word on the street?

Thanks a ton.
--AJG.
Oct 01 2005
next sibling parent JT <jtd514 ameritech.net> writes:
Hmmm Im not positive, but I dont believe its possible - yet, because it 
would require creating an intermediate source file and sending that to 
the compiler. I say 'yet' because I believe he was discussing doing 
something like that eventually...


AJG wrote:
 Hi,
 
 Is this possible yet? Here's what I would like to do:
 



 
 What happens is:
 1) "/usr/bin/bar -f foo" is run.
 2) The result is #include'd, literally, into main() right there.
 
 I took a look at the pragmas already available but I couldn't figure out if
what
 I want to do is doable. Bear in mind, I don't want to LINK anything. I want to
 #include something after being processed by some arbitrary binary.
 
 What's the word on the street?
 
 Thanks a ton.
 --AJG.
 
 
Oct 01 2005
prev sibling parent reply Derek Parnell <derek psych.ward> writes:
On Sat, 1 Oct 2005 07:16:29 +0000 (UTC), AJG wrote:

 Hi,
 
 Is this possible yet? Here's what I would like to do:
 



 
 What happens is:
 1) "/usr/bin/bar -f foo" is run.
 2) The result is #include'd, literally, into main() right there.
 
It's not complete in Build yet. The technique I've selected is to support a new type of source file, that is one that ends with ".dm". These files would be processed with build to expand macros etc... In the case you mention it would be more like this ... [FILE: main.dm] void main() { #insert `/usr/bin/bar -f foo` } and this would generate the file "main.d" which would then be given to the compiler. I'm still finishing off the macro processor which is a general purpose one with lot's of neat (IMHO) features. -- Derek Parnell Melbourne, Australia 2/10/2005 12:38:05 AM
Oct 01 2005
next sibling parent AJG <AJG_member pathlink.com> writes:
In article <198g9ee8neycf$.inm2kj3k8j26.dlg 40tude.net>, Derek Parnell says...
On Sat, 1 Oct 2005 07:16:29 +0000 (UTC), AJG wrote:

 Hi,
 
 Is this possible yet? Here's what I would like to do:
 



 
 What happens is:
 1) "/usr/bin/bar -f foo" is run.
 2) The result is #include'd, literally, into main() right there.
 
It's not complete in Build yet. The technique I've selected is to support a new type of source file, that is one that ends with ".dm". These files would be processed with build to expand macros etc... In the case you mention it would be more like this ... [FILE: main.dm] void main() { #insert `/usr/bin/bar -f foo` } and this would generate the file "main.d" which would then be given to the compiler.
Awesome!
I'm still finishing off the macro processor which is a general purpose one
with lot's of neat (IMHO) features.
Indeed! So, what kind of release date are we lookin' at? <g> Cheers, --AJG.
Oct 01 2005
prev sibling parent Bruno Medeiros <daiphoenixNO SPAMlycos.com> writes:
Derek Parnell wrote:
 On Sat, 1 Oct 2005 07:16:29 +0000 (UTC), AJG wrote:
 
 
Hi,

Is this possible yet? Here's what I would like to do:





What happens is:
1) "/usr/bin/bar -f foo" is run.
2) The result is #include'd, literally, into main() right there.
It's not complete in Build yet. The technique I've selected is to support a new type of source file, that is one that ends with ".dm". These files would be processed with build to expand macros etc... In the case you mention it would be more like this ... [FILE: main.dm] void main() { #insert `/usr/bin/bar -f foo` } and this would generate the file "main.d" which would then be given to the compiler. I'm still finishing off the macro processor which is a general purpose one with lot's of neat (IMHO) features.
Hum... not sure if I like the sound of this. Preprocessor features usually (they sure did for C/C++) add lots of complexity to syntax-based editing features, such as refactoring (renaming, moving,etc.) or even the basic auto code-completion. But I guess this does depend on what exactly are the intended preprocessor features. -- Bruno Medeiros - CS/E student "Certain aspects of D are a pathway to many abilities some consider to be... unnatural."
Oct 02 2005