mirror of
https://github.com/Z3Prover/z3
synced 2025-04-04 16:44:07 +00:00
tabs
This commit is contained in:
parent
05b29df2cb
commit
25af97fb8b
|
@ -19,15 +19,15 @@ def has_cr(file):
|
|||
lines = 0
|
||||
line = ins.readline()
|
||||
while line and lines < 20:
|
||||
m = cr.search(line)
|
||||
if m:
|
||||
ins.close()
|
||||
return True
|
||||
m = aut.search(line)
|
||||
if m:
|
||||
ins.close()
|
||||
return True
|
||||
line = ins.readline()
|
||||
m = cr.search(line)
|
||||
if m:
|
||||
ins.close()
|
||||
return True
|
||||
m = aut.search(line)
|
||||
if m:
|
||||
ins.close()
|
||||
return True
|
||||
line = ins.readline()
|
||||
ins.close()
|
||||
return False
|
||||
|
||||
|
@ -38,20 +38,20 @@ def add_cr(file):
|
|||
ous.write(cr_notice)
|
||||
line = ins.readline()
|
||||
while line:
|
||||
ous.write(line)
|
||||
line = ins.readline()
|
||||
ous.write(line)
|
||||
line = ins.readline()
|
||||
ins.close()
|
||||
ous.close()
|
||||
os.system("move %s %s" % (tmp, file))
|
||||
|
||||
|
||||
def add_missing_cr(dir):
|
||||
for root, dirs, files in os.walk(dir):
|
||||
for f in files:
|
||||
if f.endswith('.cpp') or f.endswith('.h') or f.endswith('.c') or f.endswith('.cs'):
|
||||
path = "%s\\%s" % (root, f)
|
||||
if not has_cr(path):
|
||||
print("Missing CR for %s" % path)
|
||||
add_cr(path)
|
||||
for f in files:
|
||||
if f.endswith('.cpp') or f.endswith('.h') or f.endswith('.c') or f.endswith('.cs'):
|
||||
path = "%s\\%s" % (root, f)
|
||||
if not has_cr(path):
|
||||
print("Missing CR for %s" % path)
|
||||
add_cr(path)
|
||||
|
||||
add_missing_cr('src')
|
||||
add_missing_cr('examples')
|
||||
|
|
|
@ -17,55 +17,55 @@ def fix_hdr(file):
|
|||
line = ins.readline()
|
||||
found = False
|
||||
while line:
|
||||
m = doubleu.search(line)
|
||||
if m:
|
||||
ous.write("#")
|
||||
ous.write(m.group(1))
|
||||
ous.write(" ")
|
||||
ous.write(m.group(2))
|
||||
ous.write("_H_\n")
|
||||
line = ins.readline()
|
||||
found = True
|
||||
continue
|
||||
m = ifndef.search(line)
|
||||
if m:
|
||||
print(m.group(1))
|
||||
ous.write("#ifndef ")
|
||||
ous.write(m.group(1))
|
||||
ous.write("_H_\n")
|
||||
line = ins.readline()
|
||||
found = True
|
||||
continue
|
||||
m = defn.search(line)
|
||||
if m:
|
||||
ous.write("#define ")
|
||||
ous.write(m.group(1))
|
||||
ous.write("_H_\n")
|
||||
line = ins.readline()
|
||||
found = True
|
||||
continue
|
||||
m = endif.search(line)
|
||||
if m:
|
||||
ous.write("#endif /* ")
|
||||
ous.write(m.group(1))
|
||||
ous.write("_H_ */\n")
|
||||
line = ins.readline()
|
||||
found = True
|
||||
continue
|
||||
ous.write(line)
|
||||
line = ins.readline()
|
||||
m = doubleu.search(line)
|
||||
if m:
|
||||
ous.write("#")
|
||||
ous.write(m.group(1))
|
||||
ous.write(" ")
|
||||
ous.write(m.group(2))
|
||||
ous.write("_H_\n")
|
||||
line = ins.readline()
|
||||
found = True
|
||||
continue
|
||||
m = ifndef.search(line)
|
||||
if m:
|
||||
print(m.group(1))
|
||||
ous.write("#ifndef ")
|
||||
ous.write(m.group(1))
|
||||
ous.write("_H_\n")
|
||||
line = ins.readline()
|
||||
found = True
|
||||
continue
|
||||
m = defn.search(line)
|
||||
if m:
|
||||
ous.write("#define ")
|
||||
ous.write(m.group(1))
|
||||
ous.write("_H_\n")
|
||||
line = ins.readline()
|
||||
found = True
|
||||
continue
|
||||
m = endif.search(line)
|
||||
if m:
|
||||
ous.write("#endif /* ")
|
||||
ous.write(m.group(1))
|
||||
ous.write("_H_ */\n")
|
||||
line = ins.readline()
|
||||
found = True
|
||||
continue
|
||||
ous.write(line)
|
||||
line = ins.readline()
|
||||
ins.close()
|
||||
ous.close()
|
||||
if found:
|
||||
os.system("move %s %s" % (tmp, file))
|
||||
os.system("move %s %s" % (tmp, file))
|
||||
else:
|
||||
os.system("del %s" % tmp)
|
||||
|
||||
os.system("del %s" % tmp)
|
||||
|
||||
def fixup(dir):
|
||||
for root, dirs, files in os.walk(dir):
|
||||
for f in files:
|
||||
if f.endswith('.h'):
|
||||
path = "%s\\%s" % (root, f)
|
||||
fix_hdr(path)
|
||||
for f in files:
|
||||
if f.endswith('.h'):
|
||||
path = "%s\\%s" % (root, f)
|
||||
fix_hdr(path)
|
||||
|
||||
fixup('src')
|
||||
|
|
Loading…
Reference in a new issue