List Info

Thread: Passing empty argument to rule




Passing empty argument to rule
country flaguser name
United States
2007-06-07 13:52:59
Hi,

I've got a rule like this :

rule dart-run ( target sources * : status : user : system :
command :  
output + )
{
	ECHO "output = $(output)" ;
}

and I want to know how to setup the frame arguments so the
output  
(7th argument) evaluates to empty, and the output echo is  
suppressed.  Here's the code (in make1.c) where I setup to
evaluate  
the rule.

LIST* initial_args = list_copy( L0, dart_rule->next );
FRAME frame[1];
frame_init( frame );

lol_add( frame->args, list_new( initial_args,
target->name ) );
append_int_string(frame->args, status);
append_double_string(frame->args, time->user);
append_double_string(frame->args, time->system);
lol_add(frame->args, list_new(L0,
newstr(executed_command)));

if (!command_output)
	lol_add(frame->args, list_new(L0, ""));
else
	lol_add(frame->args, list_new(L0,
newstr(command_output)));

if( lol_get( frame->args, 2 ) )
     evaluate_rule( dart_rule->string, frame );

As you can see, when the 7th argument is null, I create an
"" string,  
which doesn't evaluate to the empty string in the dart-run
rule.  Any  
ideas on how to setup the frame argument so that when
command_output  
is null, the rule is correctly called?

Thanks.

-- Noel


_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build

Re: Passing empty argument to rule
country flaguser name
United States
2007-06-07 13:59:40
K. Noel Belcourt wrote:
> Hi,
> 
> I've got a rule like this :
> 
> rule dart-run ( target sources * : status : user :
system : command :  
> output + )
> {
> 	ECHO "output = $(output)" ;
> }
> 
> and I want to know how to setup the frame arguments so
the output  
> (7th argument) evaluates to empty, and the output echo
is  
> suppressed.  Here's the code (in make1.c) where I setup
to evaluate  
> the rule.
> 
> LIST* initial_args = list_copy( L0, dart_rule->next
);
> FRAME frame[1];
> frame_init( frame );
> 
> lol_add( frame->args, list_new( initial_args,
target->name ) );
> append_int_string(frame->args, status);
> append_double_string(frame->args, time->user);
> append_double_string(frame->args, time->system);
> lol_add(frame->args, list_new(L0,
newstr(executed_command)));
> 
> if (!command_output)
> 	lol_add(frame->args, list_new(L0, ""));
> else
> 	lol_add(frame->args, list_new(L0,
newstr(command_output)));
> 
> if( lol_get( frame->args, 2 ) )
>      evaluate_rule( dart_rule->string, frame );
> 
> As you can see, when the 7th argument is null, I create
an "" string,  
> which doesn't evaluate to the empty string in the
dart-run rule.  Any  
> ideas on how to setup the frame argument so that when
command_output  
> is null, the rule is correctly called?

AFAIK, it should be adding an empty list as the argument. As
opposed to 
adding a list with the one output element. So instead of:

     lol_add(frame->args, list_new(L0, ""));

It would be:

     lol_add(frame->args, L0);


-- 
-- Grafik - Don't Assume Anything
-- Redshift Software, Inc. - http://redshift-software
.com
-- rrivera/acm.org - grafik/redshift-software.com
-- 102708583/icq - grafikrobot/aim - grafikrobot/yahoo
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build

Re: Passing empty argument to rule
country flaguser name
United States
2007-06-07 14:35:09
Hi Rene,

On Jun 7, 2007, at 12:59 PM, Rene Rivera wrote:

> K. Noel Belcourt wrote:
>>
>> rule dart-run ( target sources * : status : user :
system : command :
>> output + )

This should have been 'output ?'

> AFAIK, it should be adding an empty list as the
argument. As  
> opposed to
> adding a list with the one output element. So instead
of:
>
>      lol_add(frame->args, list_new(L0,
""));
>
> It would be:
>
>      lol_add(frame->args, L0);

With the change above, your suggestion works just fine.

Thanks!

-- Noel


_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build

[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )