Boost logo

Boost :

From: Nicola Musatti (Nicola.Musatti_at_[hidden])
Date: 2006-05-23 03:08:07


David Abrahams wrote:
[...]
>>>"Robert Ramey" <ramey_at_[hidden]> writes:
>>>
>>>>Its easy to download spirit 1.6. There's no "instalation" necessary
>>>>other than just specifying the directory to which it has been loaded
>>>>in one's path.
>>>
>>>Where and how is that "specified?"
>
> Okay, I found it, thanks. However, you should know that the link on
> that page that points to how to download Spirit 1.6 is broken.

Actually it's not that simple. Out-of-the-box Spirit 1.6.3 only works if
it's used as in place replacement for 1.8 . The use of double quotes
instead of angle brackets causes the compiler to include 1.8 files from
1.6 headers. To overcome this problem you can either export from Boost's
CVS SPIRIT_1_6 branch or tweak the attached Python script to fix the
1.6.3 distribution.

Cheers,
Nicola Musatti

import os, re

baseDir = "D:\\src\\boost\\boost\\spirit"
inclRe = re.compile(R"^(\s*#\s*include\s*)\"(boost.*)\"(\s*)$")

extensions = ( ".cpp", ".hpp", ".ipp" )
for path, dirs, files in os.walk(baseDir) :
    for fn in files :
        e = os.path.splitext(fn)[1]
        if e in extensions :
            p = os.path.join(path,fn)
            src = file(p)
            for l in src :
                if inclRe.match(l) :
                    src.close()
                    src = file(p)
                    temp = p+".NEW"
                    dest = file(temp,"w+")
                    for ln in src :
                        m = inclRe.match(ln)
                        if m :
                            dest.write(m.group(1)+"<"+m.group(2)+">"+
                                       m.group(3))
                        else :
                            dest.write(ln)
                    src.close()
                    dest.close()
                    backup = p+".BAK"
                    if os.access(backup,os.F_OK) :
                        os.remove(backup)
                    os.rename(p,backup)
                    os.rename(temp,p)
                    break
                            
    if 'CVS' in dirs :
        dirs.remove('CVS')


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk