BIND 10 trac1924, updated. 57c90f7a929c38440118c0e10e4dd19827fd371c [1924] Comments and cleanups in the generator scripts
BIND 10 source code commits
bind10-changes at lists.isc.org
Fri Feb 8 11:28:07 UTC 2013
The branch, trac1924 has been updated
via 57c90f7a929c38440118c0e10e4dd19827fd371c (commit)
from 89c595272222aa858ddbb6559dc3ec5aff63f2a5 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 57c90f7a929c38440118c0e10e4dd19827fd371c
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Fri Feb 8 12:27:46 2013 +0100
[1924] Comments and cleanups in the generator scripts
-----------------------------------------------------------------------
Summary of changes:
src/lib/python/isc/util/pythonize_constants.py | 19 ++++++++++++++-----
src/lib/util/const2hdr.py | 19 ++++++++++++++-----
2 files changed, 28 insertions(+), 10 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/python/isc/util/pythonize_constants.py b/src/lib/python/isc/util/pythonize_constants.py
index 757169b..676f57c 100644
--- a/src/lib/python/isc/util/pythonize_constants.py
+++ b/src/lib/python/isc/util/pythonize_constants.py
@@ -13,15 +13,24 @@
# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+'''
+This script takes a C++ file with constants and converts it to a python
+module. However, the syntax it parses is very limited (it doesn't understand
+C++ at all, it just looks for lines containing the equal sign and strips
+what it thinks might be type).
+
+The purpose is to keep the same values of constants in C++ and python. This
+saves the work of keeping the constants in sync manually and is less error
+prone.
+'''
+
import sys
import re
-def die(message):
- sys.stderr.write(message + "\n")
- sys.exit(1)
-
if len(sys.argv) != 3:
- die("Usage: python3 ./pythonize_constants.py input.cpp output.py")
+ sys.stderr.write("Usage: python3 ./pythonize_constants.py input.cpp output.py\n")
+ sys.exit(1)
+ die(
[filename_in, filename_out] = sys.argv[1:3]
diff --git a/src/lib/util/const2hdr.py b/src/lib/util/const2hdr.py
index f8383e2..b8c56ea 100644
--- a/src/lib/util/const2hdr.py
+++ b/src/lib/util/const2hdr.py
@@ -13,15 +13,24 @@
# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+'''
+The script takes a C++ file with constant definitions and creates a
+header file for the constants. It, however, does not understand C++
+syntax, it only does some heuristics to guess what looks like
+a constant and strips the values.
+
+The purpose is just to save some work with keeping both the source and
+header. The source syntax must be limited already, because it's used to
+generate the python module (by the
+lib/python/isc/util/pythonize_constants.py script).
+'''
+
import sys
import re
-def die(message):
- sys.stderr.write(message + "\n")
- sys.exit(1)
-
if len(sys.argv) != 3:
- die("Usage: python3 ./const2hdr.py input.cpp output.h")
+ sys.stderr.write("Usage: python3 ./const2hdr.py input.cc output.h\n")
+ sys.exit(1)
[filename_in, filename_out] = sys.argv[1:3]
More information about the bind10-changes
mailing list