Menu

#40 Class is set to UNIVERSAL compilation error

v1.5
open
BNCompiler (20)
5
2010-08-19
2010-08-19
alima
No

If Class is set to Universal, e.g. [UNIVERSAL 16]

CdrRecord ::= [PRIVATE 1] SEQUENCE
{
f1 [PRIVATE 70] Type1 OPTIONAL,
f2 [UNIVERSAL 16] Type2 OPTIONAL
}

After compilation of such structure we get
@ASN1Element ( name = "f2", isOptional = true , hasTag = true, tag = 16,
tagClass = TagClass.ContextSpecific, hasDefaultValue = false )
But we should get
@ASN1Element ( name = "f2", isOptional = true , hasTag = true, tag = 16,
tagClass = TagClass.Universal , hasDefaultValue = false )

This problem can be easily fixed in
modules/java/includes/tagClass.xsl
by adding a row
<xsl:when test="tag/clazz = 'UNIVERSAL'"> TagClass.Universal </xsl:when>

<xsl:template name="tagClass">
tagClass = <xsl:choose>
<xsl:when test="tag/clazz = 'APPLICATION'"> TagClass.Application </xsl:when>
<xsl:when test="tag/clazz = 'PRIVATE'"> TagClass.Private </xsl:when>
<xsl:when test="tag/clazz = 'UNIVERSAL'"> TagClass.Universal </xsl:when>
<xsl:otherwise>TagClass.ContextSpecific</xsl:otherwise>
</xsl:choose>
</xsl:template>

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.