Revision 24eaf3bf279b06d92a5488a7a4f9959ae7d86960 authored by Laurent Rineau on 08 September 2017, 15:30:09 UTC, committed by Laurent Rineau on 08 September 2017, 15:30:09 UTC
Parameterization:  Remove VC++ compiler option; Remove a macro concerning Eigen
2 parent s a8cd93d + ded5764
Raw File
replace_CGAL_NAMESPACE.py
#!/usr/bin/python

import os
import fileinput
from sys import argv
from sys import exit
from sys import stderr

if len(argv)!=2:
  stderr.write("Usage: python "+argv[0]+" directory_name.\n")
  stderr.write("Action:\nReplace CGAL_BEGIN_NAMESPACE and CGAL_END_NAMESPACE by \'namespace CGAL {\'\n")
  stderr.write("and \'} //namespace CGAL\' respectively in all .h and .cpp files in the directory \n")
  stderr.write("given as parameter.\n")

for dirname, dirnames, filenames in os.walk(argv[1]):
    for filename in filenames:
        l=len(filename)
        if ( l>2 and filename[(l-2):l]==".h") or ( l> 4 and filename[(l-4):l]==".cpp"):
          fname=os.path.join(dirname, filename)
          for lines in fileinput.FileInput(fname, inplace=1):
            lines = lines.replace("CGAL_BEGIN_NAMESPACE","namespace CGAL {")
            lines = lines.replace("CGAL_END_NAMESPACE","} // end namespace CGAL")
            print lines,
back to top