I want to run binary codes (C++) under linux using run-pipeline
In linux shell, the task is
cmd1 -a arg1 -b arg2 | cmd2 -c arg3
I know in general, in factor, I need to construct
{ str1 str2 } run-pipeline
where str1 = “cmd1 -a arg1 -b arg2”
str2 = “cmd2 -c arg3”
Ultimately, I may also insert some factor quot in betweeen
str1 and str2 to do some processing before handing the
result to cmd2.
Here is what I envision:
TUPLE: cmd1 a b ;
: <cmd1> ( — cmd1 )
cmd1 new
“default a” >>a
“default b” >>b ;
: get-cmd1 ( cmd1 — str1 )
[ a>> ] [ b>> ] bi
“cmd1 -a %s -b %s” sprintf ;
so now, I can write
<cmd1>
my_b >>b
get-cmd1
————— similarly for cmd2.
But I bump into a mental block when trying to
put things together for run-pipeline
If there were just one cmd1 (without cmd2),
I thought I could do
${ <cmd1> my_b >>b get-cmd1 } run-pipeline
Adding cmd2, I could write
${ <cmd1> my_b >>b get-cmd1 <cmd2> my_c >>c get-cmd2 } run-pipeline
But this looks ugly.
Is there a simpler way ?
Thanks
HP Wei
------------------------------------------------------------------------------
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk