Boost logo

Boost-Build :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2005-11-15 03:54:06


On Thursday 03 November 2005 19:41, Rene Rivera wrote:
> Update of /cvsroot/boost/boost/tools/build/jam_src
> In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7726
>
> Modified Files:
> build.jam variable.c variable.h
> Log Message:
> Implement @(file) syntax in actions.
>
..
> Index: variable.c
> ===================================================================
> RCS file: /cvsroot/boost/boost/tools/build/jam_src/variable.c,v
> retrieving revision 1.12
> retrieving revision 1.13
> + /* expand the temporary file name var inline */
> + #if 0
> + string_copy(&file_name_v,"$(");
> + string_append_range(&file_name_v,in+2,split);
> + string_push_back(&file_name_v,')');
> + #else
> + string_new(&file_name_v);
> + string_append_range(&file_name_v,in+2,split);
> + #endif

Is this #if 0 still necessary?

> + file_name_l = var_string(file_name_v.value,out,oute-out+1,lol);
> + string_free(&file_name_v);
> + if ( file_name_l < 0 ) return file_name_l;
> +
> + /* expand the file value into the file reference */
> + if ( !globs.noexec )
> + var_string_to_file( split+3, ine-split-4, out, lol );
> +
> + /* continue on with the expansion */
> + if ( strcmp( "STDOUT", out ) == 0 || strcmp( "STDERR", out ) == 0 )
> + out[0] = '\0';

I don't quite understand the logic here. Could somebody clarify, and improve the comment?

> + while( *in && in < ine )
> + {
> + int dollar = 0;
> + const char * output_0 = in;
> + const char * output_1 = in;
> +
> + /* Copy white space */
.....
> + /* Copy non-white space, watching for variables */
> +
......
> + /* If a variable encountered, expand it and and embed the */
> + /* space-separated members of the list in the output. */
> +
> + if( dollar )
> + {
> + LIST *l;
> +
> + l = var_expand( L0, (char*)output_0, (char*)output_1, lol, 0 );

Why can't the whole "while" loop be replaced with a single call to "var_expand"?
IIRC, that function does not require a single var as input, it will skip past
white-space and non-whitespace just fine.

> Index: variable.h
> ===================================================================
> RCS file: /cvsroot/boost/boost/tools/build/jam_src/variable.h,v
> retrieving revision 1.5
> retrieving revision 1.6
> diff -u -d -r1.5 -r1.6
> --- variable.h 30 May 2005 03:42:38 -0000 1.5
> +++ variable.h 3 Nov 2005 16:41:05 -0000 1.6
> @@ -18,6 +18,13 @@
> void var_done();
> void var_hash_swap( struct hash** );
>
> +/** Expands the "in" expression directly into the "out" file.
> + The file can be one of: a path, STDOUT, or STDERR to send
> + the output to a file overwriting previous content, to
> + the console, or to the error output respectively.

I think this comment does not explicitly specify that STDOUT and STDERR are exact strings.
Another possible interpretation is that they are some macros defined somewhere to some special
"char*" value (say, (char*)1 and (char*)2).

> +*/
> +void var_string_to_file( const char * in, int insize, const char * out, LOL * lol );
> +

- Volodya


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