Boost logo

Boost-Build :

Subject: Re: [Boost-build] trim newlines
From: Ray Lambert (codemonkey_at_[hidden])
Date: 2010-07-26 23:55:58


On 07/26/2010 10:15 PM, Steven Watanabe wrote:
> AMDG
>
> Ray Lambert wrote:
>> On 07/26/2010 09:13 PM, Steven Watanabe wrote:
>>> Use \n.
>>
>> hmm... my original post had the "\" in there; not sure why it's
>> missing in your quote.
>>
>> <snip>
>> I looked at regexp.c and I can't see where it handles \n -- I'm not
>> sure it actually does. Unless I missed something, I think it treats
>> '\n' as just 'n'.
>
> This is a relatively recent feature. What does bjam --version say?
>
Wow. Okay. A bit of confusion here I guess...

I was running bjam 3.1.17.

I made a patched version of it earlier today (using the source from
boost-build-2.0-m12.tar.bz2) and assumed that it was 3.1.17, BUT it
turns out that it was really 3.1.16!

To make matters worse, it turns out that the latest version of bjam is
actually 3.1.18!

So...

I downloaded 3.1.18 and I found that the regex above DOES work! Cool.

So, in case anyone's interested, here's my final version of the "rtrim"
rule that I posted earlier (posted at end). It works but requires bjam
3.1.18.

Thanks for your help Steven.

~ray

rtrim.jam:
----------------------------------------------------------------------------------------------------
rule rtrim ( string )
{
   local match = [ MATCH "^(.*)[\n]$" : $(string) ] ;
   if $(match)
   {
     return $(match[1]) ;
   }
   else
   {
     return $(string) ;
   }
}

IMPORT $(__name__) : rtrim : : rtrim ;
----------------------------------------------------------------------------------------------------


Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk