asn1tostruct: Avoid erroneous double-underscores
We shouldn't generate names like
RANAP_RAB_SetupList_EnhancedRelocCompleteReq__t when creating the
_encode() and _decode() functiosn, as the '-IEs' at the end must be
stripped before converting all '-' to '_'.
diff --git a/asn1/utils/asn1tostruct.py b/asn1/utils/asn1tostruct.py
index 92fc074..61d0f68 100755
--- a/asn1/utils/asn1tostruct.py
+++ b/asn1/utils/asn1tostruct.py
@@ -270,7 +270,7 @@
if key in ieofielist.values():
continue
structName = re.sub('ies', '', key)
- asn1cStruct = re.sub('-', '_', re.sub('IEs', '', key))
+ asn1cStruct = re.sub('-', '_', re.sub('IEs', '', re.sub('-IEs', '', key)))
ielistname = re.sub('UE', 'ue', asn1cStruct)
ielistnamefirstlower = ielistname[:1].lower() + ielistname[1:]
asn1cStructfirstlower = asn1cStruct[:1].lower() + asn1cStruct[1:]
@@ -392,7 +392,7 @@
continue
structName = re.sub('ies', '', key)
- asn1cStruct = re.sub('-', '_', re.sub('IEs', '', key))
+ asn1cStruct = re.sub('-', '_', re.sub('IEs', '', re.sub('-IEs', '', key)))
firstwordlower = re.sub('Item', 'List', re.sub('enb', 'eNB', lowerFirstCamelWord(asn1cStruct)))
asn1cStruct = prefix + re.sub('Item', 'List', asn1cStruct)
asn1cStructfirstlower = asn1cStruct[:1].lower() + asn1cStruct[1:]