tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: make: new modifyer :Y



In article <87ipmxp35p.fsf%asrock.chizhovka.net@localhost>,
Aleksey Cheusov  <cheusov%tut.by@localhost> wrote:
>-=-=-=-=-=-
>
>About year and a half ago I proposed to add to make(1) a function
>that checks a value for "YES" or "NO" case-insensitively and returns 1
>or 0 in order to avoid using ugly constructions like
>!empty(varname:M[Yy][Ee][Ss]) in Makefiles and replace them with
>something shorter and more maintainable.
>
>http://mail-index.netbsd.org/tech-userlevel/2009/03/25/msg001953.html
>
>After some discussion it was decided that adding new expression is not
>feasible and David Holland proposed to add :istrue modifier. Later he
>rejected his own idea in favour of general function support in bmake.
>
>Since then neither function support nor typed values appeared in bmake,
>so, I'd like to raise that question again.  I still want to avoid
>constructions like !empty(varname:M[Yy][Ee][Ss]) or
>${varname:U:tl} == "yes".
>
>Taking into account how often we check variables for YES/1/NO/0 values
>I've implemented variable modifier :Y in C. In short, with a help of
>this modifier we can rewrite the code
>
>
>  .if !empty(MKXXX:M[Yy][Ee][Ss])
>  .endif
>
>or
>
>  .if empty(MKXXX:M[Nn][Oo])
>  .endif
>
>with a more elegant
>
>  .if ${MKXXX:Y}
>  .endif
>
>Find the patch in the attachment. Objections?

Aside from KNF issues looks fine to me.

christos



Home | Main Index | Thread Index | Old Index