Compiler Configuration File

In addition to command line options, a configuration file can be used to specify compiler options. These options can be applied not only globally but also to specific modules and productions.

The basic structure of a configuration file is described in the C/C++ User's Guide. Configuration items that are applicable to Go code generation are described in the following sections.

Global Level

These attributes can be applied at the global level by including them within the <asn1config> section:

Name Values Description
<includedir></includedir> <Include directory> This configuration item is used to specify a directory that will be searched for IMPORT files. It is equivalent to the -I command-line option.

Module Level

These attributes can be applied at the module level by including them within a <module> section:

Name Values Description

<name> </name>

module name This attribute identifies the module to which this section applies. Either this or the <oid> element/attribute is required.
<oid> module OID (object identifier) This attribute provides for an alternate form of module identification for the case when module name is not unique. For example, a given ASN.1 module may have multiple versions. A unique version of the module can be identified using the OID value.
<include types="names" values="names"/> ASN.1 type or values names are specified as an attribute list

This item allows a list of ASN.1 types and/or values to be included in the generated code. By default, the compiler generates code for all types and values within a specification. This allows the user to reduce the size of the generated code by selecting only a subset of the types/values in a specification for compilation.

Note that if a type or value is included that has dependent types or values (for example, the element types in a SEQUENCE, SET, or CHOICE), all of the dependent types will be automatically included as well.

<exclude types="names" values="names"/> ASN.1 type or values names are specified as an attribute list This item allows a list of ASN.1 types and/or values to be excluded from the generated code. By default, the compiler generates code for all types and values within a specification. This is generally not as useful as the include directive because most types in a specification are referenced by other types. If an attempt is made to exclude a type or value referenced by another item, the directive will be ignored.

<sourceFile>
</sourceFile>

source file name Indicates the given module is contained within the given ASN.1 source file. This is used on IMPORTs to instruct the compiler where to look for imported definitions.
<valuePrefix> </valuePrefix> prefix text This is used to specify a prefix that will be applied to all generated value constants within a module. This can be used to prevent name clashes if multiple modules are involved that use a common name for two or more different value declarations.

Production Level

These attributes can be applied at the production level by including them within a <production> section:

Name Values Description

<name>
</name>

production name This attribute identifies the production (type) to which this section applies. The name may also be specified as an attribute. In either case, it is required.
<typePrefix> </typePrefix> prefix text This is used to specify a prefix that will be applied to generated Go type names for this production. This can be used to prevent name clashes if multiple modules are involved in a compilation and they contain common names.

Element Level

These attributes can be applied at the element level by including them within an <element> section:

Name Values Description

<name> 
</name>

element name This element identifies the element within a SEQUENCE, SET, or CHOICE construct to which this section applies. It may also be specified as an attribute. In either case, it is required.
<notUsed/> n/a This flag variable specifies that this element will not be used at all in the generated code. It can only be applied to optional elements within a SEQUENCE or SET, or to elements within a CHOICE. Its purpose is for production of more compact code by allowing users to configure out items that are of no interest to them.