diff options
author | Tomas Kukosa <tomas.kukosa@siemens.com> | 2010-10-07 14:24:04 +0000 |
---|---|---|
committer | Tomas Kukosa <tomas.kukosa@siemens.com> | 2010-10-07 14:24:04 +0000 |
commit | 5fbdb1c37869c4ffaf4db10353b97b09aaaf3efa (patch) | |
tree | 1d9665d92e129f1c7080c3712a53e77524d947d4 /tools/asn2wrs.py | |
parent | 9f65e2a9c732bfb0388b1bff678e6481e8a52abf (diff) |
Generate proper extension flags for empty constructed types SEQUENCE { ... } and CHOICE { ... }
svn path=/trunk/; revision=34400
Diffstat (limited to 'tools/asn2wrs.py')
-rwxr-xr-x | tools/asn2wrs.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/tools/asn2wrs.py b/tools/asn2wrs.py index feaf9f8e11..b256650c5d 100755 --- a/tools/asn2wrs.py +++ b/tools/asn2wrs.py @@ -3929,6 +3929,9 @@ class SeqType (SqType): ext = 'ASN1_EXTENSION_ROOT' else: ext = 'ASN1_NO_EXTENSIONS' + empty_ext_flag = '0' + if (len(self.elt_list)==0) and hasattr(self, 'ext_list') and (len(self.ext_list)==0) and (not hasattr(self, 'elt_list2') or (len(self.elt_list2)==0)): + empty_ext_flag = ext for e in (self.elt_list): f = fname + '/' + e.val.name table += self.out_item(f, e.val, e.optional, ext, ectx) @@ -3943,7 +3946,7 @@ class SeqType (SqType): if (ectx.Ber()): table += " { NULL, 0, 0, 0, NULL }\n};\n" else: - table += " { NULL, 0, 0, NULL }\n};\n" + table += " { NULL, %s, 0, NULL }\n};\n" % (empty_ext_flag) return table #--- SeqOfType ----------------------------------------------------------- @@ -4423,6 +4426,9 @@ class ChoiceType (Type): ext = 'ASN1_EXTENSION_ROOT' else: ext = 'ASN1_NO_EXTENSIONS' + empty_ext_flag = '0' + if (len(self.elt_list)==0) and hasattr(self, 'ext_list') and (len(self.ext_list)==0): + empty_ext_flag = ext for e in (self.elt_list): if (tagval): val = e.GetTag(ectx)[1] else: val = str(cnt) @@ -4437,7 +4443,7 @@ class ChoiceType (Type): if (ectx.Ber()): table += " { 0, NULL, 0, 0, 0, NULL }\n};\n" else: - table += " { 0, NULL, 0, NULL }\n};\n" + table += " { 0, NULL, %s, NULL }\n};\n" % (empty_ext_flag) return table def eth_type_default_body(self, ectx, tname): |