Commit Graph

4 Commits

Author SHA1 Message Date
Field G. Van Zee
216a4cb9cb Minor update to flatten-headers.[py|sh] help text.
Details:
- Fixed a typo and removed some outdated language from the help text of
  flatten-headers.py and flatten-headers.sh.
2018-05-18 18:47:03 -05:00
Field G. Van Zee
0084531d3e Updated flatten-headers.py for python3.
Details:
- Modifed flatten-headers.py to work with python 3.x. This mostly
  amounted to removing print statements (which I replaced with calls
  to my_print(), a wrapper to sys.stdout.write()). Thanks to Stefan
  Husmann for pointing out the script's incompatibility with python 3.
- Other minor changes/cleanups.
2017-12-17 18:58:25 -06:00
Field G. Van Zee
90b11b79c3 Modest performance boost to flatten-headers.py.
Details:
- Updated flatten-headers.py to pre-compile the main regular expression
  used to isolate #include directives and the header filenames they
  reference. The compiled regex object is then used over and over on
  each header file in the tree of referenced headers. This appears to
  have provided a 1.7-2x performance increase in the best case.
- Other minor tweaks, such as renaming the main recursive function from
  replace_pass() to flatten_header().
2017-12-17 17:34:32 -06:00
Field G. Van Zee
99dee87f30 Reimplemented flatten-headers.sh in python.
Details:
- Added flatten-headers.py, a python implementation of the bash script
  flatten-headers.sh. The new script appears to be 25-100x faster,
  depending on the operating system, filesystem, etc. The python script
  abides by the same command line interface as its predecessor and
  targets python 2.7 or later. (Thanks to Devin Matthews for suggesting
  that I look into a python replacement for higher performance.)
- Activated use of flatten-headers.py in common.mk via the FLATTEN_H
  variable.
- Made minor tweaks to flatten-headers.sh such as spelling corrections
  in comments.
2017-12-17 16:47:27 -06:00