diff options
| author | Carl Hetherington <cth@carlh.net> | 2015-09-14 22:49:36 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2015-09-14 22:49:36 +0100 |
| commit | 1858190cff2f960f3d1f0a5cc02c69da86088f5b (patch) | |
| tree | 487a3b83f9105e22ce13972890197477540b72ea /hacks | |
| parent | 7f4d248b3092b30c5fe2f71d8c746cf51fcc23dd (diff) | |
Lots of #include <iostream>s for Arch.
Diffstat (limited to 'hacks')
| -rw-r--r-- | hacks/check_cout | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/hacks/check_cout b/hacks/check_cout new file mode 100644 index 000000000..67053ca51 --- /dev/null +++ b/hacks/check_cout @@ -0,0 +1,32 @@ +#!/usr/bin/python + +import os +import shutil + +for root, dirs, files in os.walk('src'): + for name in files: + if name.endswith('.cc'): + include = False + using = False + with open(os.path.join(root, name)) as f: + for l in f.readlines(): + l = l.strip() + if l == 'using std::cout;': + using = True + if l == '#include <iostream>': + include = True + if (not include) and using: + g = open('tmp', 'w') + with open(os.path.join(root, name)) as f: + last_was_include = False + done = False + for l in f.readlines(): + if last_was_include and l == '\n' and not done: + print>>g,'#include <iostream>' + last_was_include = False + done = True + elif l.startswith('#include'): + last_was_include = True + print>>g,l, + g.close() + shutil.move('tmp', os.path.join(root, name)) |
