|
Boost-Build : |
From: Reece Dunn (msclrhd_at_[hidden])
Date: 2005-10-31 12:50:55
Rene Rivera wrote:
>Reece Dunn wrote:
> > Rene Rivera wrote:
> >
> >>The "@()" is ultimately a "here document" functionality. With that in
> >>mind I'd rather have it be as flexible as possible. My suggestion is to
> >>use the standard variable expansion syntax to manage control of where
> >>and how the document is put together. Like so:
> >>
> >>1) For a temporary file:
> >>
> >> @($(TMPFILE):S=.txt:E="This is some content.")
> >>
> >>And like your changes the @() would evaluate to the name of the
> >>temporary file.
> >
> > I suggest that we also have the ability to control the lifetime of the
> > file. Note that your syntax will complicate parsing and processing:
> >
> > @($(<[1]:W):F=.rsp:E=""$(>)" "-I$(INCLUDES)" -D$(DEFINES)")
>
>What's ":W" and ":F"?
The Jam.html doesn't mention :W, but it converts paths to Windows-native
format. As for :F, this was a proposed extension to the :X syntax to denote
that this was a file as I didn't realise that you were using existing (B)Jam
behaviour.
So now, if I understand what you are proposing, we expand everything inside
@() and will be left with the name of the file as a variable whose content
you will look up and write to a file. You most likely want something like:
@($(<[1]:W).rsp:E=""$(>)" "-I$(INCLUDES)" -D$(DEFINES)")
because you may have a myapp.obj and myobj.exe target.
Now, we have @(FILE:E="EXPR") as the syntax. The response file code can get
the FILE section and expand it to produce the name of the file (with STDOUT
and STDERR having predefined behaviours). It can then pass the EXPR string
to var_string_file to expand the string content to the file we have
retrieved from FILE.
We would need at least 4 predefined strings:
$(STDOUT) = STDOUT
$(STDERR) = STDERR
$(TMPDIR) = path_tmpdir()
$(TMPFILE) = path_tmpdir() + "/" + tmpnam()
That way, you could have:
@("c:/myfile.txt":E="Hello") - write to a non-temporary file
@($(TMPFILE):E="World") - write to a temporary file
@($(STDOUT):E="Hi console") - write to the output stream (console)
@($(STDERR):E="oops!") - write to the error output stream
NOTE: Jam.html says that the :E=value syntax assigns value to the variable
if it's not been set. According to this:
@($(STDOUT):E="Hi") @($(STDOUT):E=" There")
would only output "Hi" according to this and we would have the same problem
w.r.t. response files! The behaviour of :E= inside @() would be to always
override (if a file) or append (if STDOUT/ERR).
>Or we can leave that type of formatting to the variable value itself as
>current jam variable values do (with my syntax):
>
> @($(TMPFILE):S=.rsp:E=
>"$(>)"
>"-I$(INCLUDES)"
>-D$(DEFINES)
>)
Ok. I understand now :). I will start work on implementing this logic.
- Reece
Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk