+ unify DLL export defines to namespace names

git-svn-id: https://free-cad.svn.sourceforge.net/svnroot/free-cad/trunk@5000 e8eeb9e2-ec13-0410-a4a9-efa5cf37419d
This commit is contained in:
wmayer
2011-10-10 13:44:52 +00:00
commit 120ca87015
4155 changed files with 2965978 additions and 0 deletions

39
src/Tools/PythonToCPP.py Normal file
View File

@@ -0,0 +1,39 @@
#!/usr/bin/python
import os,sys,string
#os.chdir("E:\\Develop\\FreeCADWin\\scripts")
file = open(sys.argv[1])
if(len(sys.argv) > 3):
sys.stderr.write("Wrong Parameter\n Usage:\n PythonToCPP Infile.py [Outfile]\n")
if(len(sys.argv) > 2):
out = open(sys.argv[2],"w");
else:
out = sys.stdout
lines = file.readlines()
# We want to use this script for files in another directory, so we extract the actual file name
fn = os.path.basename(sys.argv[1])
out.write("const char " + fn[:-3] + "[] =")
for line in lines:
# remove new line
line2 = string.rstrip(line)
# replace special chars
line2 = string.replace(line2,'\\','\\\\')
line2 = string.replace(line2,'\"','\\\"')
line2 = string.replace(line2,"\'","\\\'")
# output
#out.write(line)
out.write( '\"' + line2 + '\\n\"\n')
out.write(";\n\n\n");