What is the effective tagging environment in case

2019-03-03 22:56发布

问题:

As an example let's assume the following setup:

A module definition A that has a tagging environment of explicit tags defines a type foo. And Module B with implicit tagging environment imports foo and assigns it to bar.

When reading a stream using module B it is not clear to me which tagging environment is effective. Does Module B define the tagging environment (implicit) of bar (being imported foo) or is the tagging environment of the module where it was declared (foo in Module A therefor explicit) effective?

I hope I explained the issue good enough

回答1:

First, an import is not a textual thing like #include in C. It simply makes types in other modules accessible without qualifying them using their module name.

X.680 13.1 Note 4 speaks specifically to your question:

The value of "TagDefault" for the module definition affects only those types defined explicitly in the module. It does not affect the interpretation of imported types.

Note, however, that if in module B (where foo was imported), you write:

Bar ::= [APPLICATION 5] Foo

This would be equivalent to:

Bar ::= [APPLICATION 5] IMPLICIT Foo

because in module B, where the TaggedType is being defined, the tagging environment is implicit.

What the note means is that, if in Module A, you had:

Foo ::= SEQUENCE { x [0] INTEGER }

then the tag on x is an EXPLICIT tag because the tagging environment in module A was explicit and that Foo will always be treated this way, even when being imported into module B with its implicit tagging environment.



标签: asn.1