tech-userlevel archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: Improvement for bmake: boolean values
> The right way to do this (or at least, the way consistent with the
> material already in make) is to add support for $1..$n and an argument
> list syntax for variable expansions.
> That is, something like ${VAR:> arg1, arg2, arg3} binds $1=arg1,
> $2=arg2, $3=arg3 and then expands VAR.
> Then you'd get something like this:
> ISTRUE=($1 ==i "yes") || ($1 == "1") || \
> (($1 !=i "no") && ($1 != "0") && ${.ERROR:> "Invalid truth value"})
> .if ${ISTRUE:> ${FOO}}
To me this sounds like a very good proposal.
How about prividing arithmetic operations and recursion?
This is to be Turing complete :-)
# concatenate string $1 $2 times
TIMES=($1==0:?:$1$(TIMES:>$1,${2:op_decr}))
many_good=${TIMES:>good,25}
# factorial
FACTORIAL=($1==0:?1:${FACTORIAL:>${1:op_decr}:op_mult$1})
fact5=${FACTORIAL:>5}
${2:xxxx} expands operand.
:op_decr, :op_incr, :op_mult - variable substitutions.
--
Best regards, Aleksey Cheusov.
Home |
Main Index |
Thread Index |
Old Index