Fw: New make modifiers: :C///W, :tW, and :[]

From: M. Warner Losh (imp_at_bsdimp.com)
Date: 08/02/03

  • Next message: Garance A Drosihn: "Re: Fw: New make modifiers: :C///W, :tW, and :[]"
    Date: Sat, 02 Aug 2003 13:15:29 -0600 (MDT)
    To: arch@freebsd.org
    
    
    

    Comments? If so, please forward them to the
    bsd-api-discuss@metzdowd.com list. Thanks.

    Warner

    
    

    attached mail follows:


    Date: Thu, 31 Jul 2003 19:58:56 +0200
    To: bsd-api-discuss@metzdowd.com
    
    

    I propose adding a new :[] modifier to make(1) in NetBSD,
    and possibly also adding some other modifiers.

    ":[]" will allow you to extract a single word from a space-separated list,
    like this:

            CC= /usr/bin/gcc -Wall
            .if exists(${CC:[1]})
            ...

    See http://mail-index.netbsd.org/tech-userlevel/2003/07/31/0000.html
    for a post to NetBSD's tech-userlevel list where I discusssed the
    problem and several proposed solutions. See other nearby messages
    linked from http://mail-index.netbsd.org/tech-userlevel/2003/07/
    for responses.

    Briefly, the proposals are

            :tW Set a flag that causes subsequent modifiers to treat the
                    value as a single entity instead of as a space-separated
                    list.

                    Why ":tW"? We already have :tu and :tl to convert to
                    upper or lower case, so starting with "t" is natural.
                    "tW" is supposed to suggest "convert to one big word".

            :tw Undo the effect of :tW. "tw" is supposed to suggest
                    "convert to small words".

            :C///W A "one big word" variant of the existing :C/// regular
                    expression substitution modifier. Unlike the usual
                    :C/// (which works separately on each space-separated
                    word), this would work on the entire string all at once,
                    so it would be able to match teh spaces between words.

            :S///W A "one big word" variant of the existing :S/// simple
                    string substitution operator.

            :[N] Select the Nth word, where N is a positive integer.
                    :[1] selects the first word.
            :[-N] Select the Nth word from the end. :[-1] selects the
                    last word.
            :[0] Select the entire string, but treat it as one big word.
                    (Equivalent to :tw.)
            :[*] Select the entire string, treating it as a sequence of
                    space-separated words. (Undoes the effects of :[0];
                    equivalent to :tw.)

    There seems to be support for adding :[] to NetBSD's make(1). :tW/:tw
    and :C///W are not really necessary if you have :[0] and :[*], but they
    might nevertheless be useful enough to add.

    Would other BSDs be likely to pick up these features, or at least
    not use the same modifier characters with incompatible meanings?

    --apb (Alan Barrett)

    ---------------------------------------------------------------------
    The BSD APIs Discussion Mailing List
    To unsubscribe:
    send "unsubscribe bsd-api-discuss" to majordomo@metzdowd.com

    
    

    _______________________________________________
    freebsd-arch@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-arch
    To unsubscribe, send any mail to "freebsd-arch-unsubscribe@freebsd.org"


  • Next message: Garance A Drosihn: "Re: Fw: New make modifiers: :C///W, :tW, and :[]"

    Relevant Pages

    • Re: [opensuse] OT perl regex question
      ... part about Variable Interpolation and the "o" Modifier ... To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx ... For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx ...
      (SuSE)
    • [opensuse] OT perl regex question
      ... Can anyone epxlain to me what the 'o' modifier achieves in this ... To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx ... For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx ...
      (SuSE)
    • RE: regex subroutine
      ... I think using the /e modifier at the end will work. ... Subject: regex subroutine ... To unsubscribe, e-mail: beginners-unsubscribe@xxxxxxxx ... For additional commands, e-mail: beginners-help@xxxxxxxx ...
      (perl.beginners)