Date: prev next · Thread: first prev next last
2010 Archives by date, by thread · List index


This is in response to Easy Task 6, removal of various include guards throughout the source code.

I have created and included a small python script to identify and remove these include guards. Here is the basics on how to use it:

python fixguard.py somefile.cxx

Or recursively:

# Go to the clone/writer directory.
find . -name '*.cxx' -exec grep python $HOME/fixguard.py {} \;
git diff
# verify that the diffs are sane and check them in.

  Michael

import sys
import re

exp = '#ifndef.*_HXX.*\n(#include.*\n)#endif.*'

filename = sys.argv[1] # warning no error checking

data = open(filename).read()

o = open("/tmp/fixed","w")
o.write( re.sub(exp,"\\1",data) )
o.close()
os.rename("/tmp/fixed", filename)

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.