qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From astitc...@apache.org
Subject [2/3] qpid-proton git commit: PROTON-1753: Improve protocol.h generator to include some useful default field values
Date Thu, 01 Feb 2018 22:58:51 GMT
PROTON-1753: Improve protocol.h generator to include some useful default field values


Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/21d50246
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/21d50246
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/21d50246

Branch: refs/heads/master
Commit: 21d5024675a6c9acf621ed797c4bc303c263c22d
Parents: d2097dc
Author: Andrew Stitcher <astitcher@apache.org>
Authored: Thu Jan 25 01:58:30 2018 -0500
Committer: Andrew Stitcher <astitcher@apache.org>
Committed: Thu Feb 1 17:39:35 2018 -0500

----------------------------------------------------------------------
 proton-c/src/protocol.h.py | 11 +++++++++++
 1 file changed, 11 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/21d50246/proton-c/src/protocol.h.py
----------------------------------------------------------------------
diff --git a/proton-c/src/protocol.h.py b/proton-c/src/protocol.h.py
index 0f58906..321cf64 100644
--- a/proton-c/src/protocol.h.py
+++ b/proton-c/src/protocol.h.py
@@ -34,6 +34,17 @@ for type in TYPES:
   for f in type.query["field"]:
     print("#define %s_%s (%s)" % (field_kw(type), field_kw(f), fidx))
     fidx += 1
+    d = f["@default"]
+    if d:
+        ft = ftype(f)
+        # Don't bother to emit a boolean default that is False
+        if ft=="boolean" and d=="false": continue
+        # Don't output non numerics unless symbol
+        # We should really fully resolve to actual restricted value
+        # this is really true for symbols too which accidentally work
+        if ft=="symbol": d = '"' + d + '"'
+        elif d[0] not in '0123456789': continue
+        print("#define %s_%s_DEFAULT (%s) /* %s */" % (field_kw(type), field_kw(f), d, ft))
 
 idx = 0
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message