Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | # This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | # License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 3 | # file, You can obtain one at http://mozilla.org/MPL/2.0/. |
michael@0 | 4 | |
michael@0 | 5 | # Write out a C++ enum definition whose members are the names of |
michael@0 | 6 | # histograms. The histograms are defined in a file provided as a |
michael@0 | 7 | # command-line argument. |
michael@0 | 8 | |
michael@0 | 9 | import sys |
michael@0 | 10 | import histogram_tools |
michael@0 | 11 | |
michael@0 | 12 | banner = """/* This file is auto-generated, see gen-histogram-enum.py. */ |
michael@0 | 13 | """ |
michael@0 | 14 | |
michael@0 | 15 | def main(argv): |
michael@0 | 16 | filename = argv[0] |
michael@0 | 17 | |
michael@0 | 18 | print banner |
michael@0 | 19 | print "enum ID {" |
michael@0 | 20 | for histogram in histogram_tools.from_file(filename): |
michael@0 | 21 | cpp_guard = histogram.cpp_guard() |
michael@0 | 22 | if cpp_guard: |
michael@0 | 23 | print "#if defined(%s)" % cpp_guard |
michael@0 | 24 | print " %s," % histogram.name() |
michael@0 | 25 | if cpp_guard: |
michael@0 | 26 | print "#endif" |
michael@0 | 27 | print " HistogramCount" |
michael@0 | 28 | print "};" |
michael@0 | 29 | |
michael@0 | 30 | main(sys.argv[1:]) |