Chapter 5. Interface

The ACGUI interface is comprised of five parts: Editor, Project window, ASN.1 Tree window, Error Log window, and Project Settings.

Editor

The central part of the ACGUI window is the schema Editor. From here, schema files can be viewed and edited.

To begin editing an ASN.1 schema, create or open a schema file. A new schema file can be opened by clicking New in the toolbar or by navigating to File > New Schema File. An existing schema file can be accessed via the Open button in the toolbar or navigating to File > Open File. The file is added to the current project and shown in the Editor.

The Editor window is also used to display a schema browser for navigating within a validated schema. To display the browser after validating a schema, click on an item in the ASN.1 Tree window. The browser displays a hyperlinked version of the schema, centered on the definition of the selected item. Click the names of other defined types in the browser to show their definitions.

By default, schema documents are displayed as tabs in the Editor. The Text and Browser tabs at the bottom of the window are for schema editing and hyperlinked schema browsing, respectively. Schema files currently open for edit are displayed as tabs at the top of the Text tab.

Project Window

The Project window allows the user to interact with project assets, and contains the following components: Schema/ASN.1 files, Include Directories, Configuration files and Generated Items.

The Project window contains the following sections:

Schema/ASN.1 files

This section lists the files that contain the current project's ASN.1 schema definitions.

Include Directories

This section lists the directories containing auxiliary ASN.1 schema files. The current project's schema may import definitions from modules defined in an included directory.

Configuration file

This section lists the ASN1C compiler configuration file currently in use.

Generated Items

This section lists the files generated by the compiler, separated by target language.

Click on a schema or configuration file in the Project window to open that file in the Editor. Right-click on any schema file, include directory, or configuration file to easily add another or remove that particular asset from the project.

Right-clicking on the Schema/ASN.1 files heading also displays options for 'Find in Files' and 'Replace in Files.'

Selecting 'Find in Files' displays the Find in Files window, which provides users with the ability to enter any text to be located in either all schemas in the project, or only the schemas currently open in the editor. Once the Find parameters have been defined, click Find All to be presented with a list of files that contain the search text.

Click an entry within the results list to display the text in the editor.

Selecting 'Replace in Files' displays the Replace in Files window, which provides users with the ability to enter any text to be located and replaced in either all schemas in the project, or only the schemas currently open in the editor. Once the Find and Replace parameters have been defined, click Replace All to be presented with a list of files that include the word to be changed.

Click an entry within the results list to display the text in the editor, and if desired, deselect any check box next to an entry in the results list to prevent the replacement from happening on that result. Click Replace to perform the word replacement.

ASN.1 Tree Window

Once a schema has been validated or compiled in ACGUI, the ASN.1 Tree window provides an interactive view of the ASN.1 types defined in it.

At the top level of the tree, the modules of the schema are shown. Each of these modules can be expanded to reveal branches for the types, values, information objects, etc. defined within. Click on any node of the tree to show the relevant ASN.1 definition in a built-in browser in the Editor window.

Error Log Window

The Error Log window displays messages related to schema validation and compilation. Whenever a schema is successfully validated or compiled, the Error Log reports a success. If an error occurs, an error message is displayed.

In many cases, an error is associated with a particular portion of the schema being compiled. Click on an error to open the schema editor at the location in which the error occurred. If more than one error is reported, clicking Next Error and Previous Error in the toolbar moves the Editor window to the part of the schema where the next or previous error occurred.

When the reported errors are no longer needed, click Clear in the Error Log window to remove them from display.

Project Settings

The Project Settings window is where details regarding the project, such as encoding rules, target language, and code features to generate are modified. The window contains the following tabs: Output, Function Generation, Constraints and Debugging, Code Modifications, language-specific code modifications, and Build Options.

Output tab

The Output tab contains options for selecting a target language, encoding rules, and output directory.

The Output tab contains the following sections:

Application Language Type

This section provides users with the ability to define the target language for the project. A target language must be selected in order to compile a schema.

Depending on the target language selected, additional options are displayed within the Output tab.

For C or C++ target languages, the C/C++ Output Options section controls how generated code is distributed across source files.

For C#, the C# Code Organization section controls how generated code is distributed across source files and how files are organized into directories.

For Java, the Java Code Organization section controls how generated code should be organized into directories based on the ASN.1 module for which they were generated. Alternatively, generated files are placed directly into the output directory.

ASN.1 Standard

This section provides users with the ability to apply current or previously-defined ASN.1 standards to the generated code.

Additional Translations

This section provides users with the ability to define the options for generating transformed versions of the input schema, such as HTML or pretty-printed.

Encoding Rules

This section provides users with the ability to define one or more encoding rule sets to be selected for the generated code.

Input Options

This section provides users with the ability to define how strict the compiler is when parsing ASN.1 schema.

Function Generation tab

The Function Generation tab provides settings for the functionality to include in generated code.

The Function Generation tab contains the following sections:

Generated Function Types

This section provides users with the ability to define granular control of which functions to generate. The printing functions allow for various printing schemes to be generated, such as print-to-string and print-to-standard-output, and how the printed data should be formatted.

Specify PDU Types

This section provides users with the ability to define which productions to select as PDUs.

Sample Program Generation

This section provides users with the ability to define the generation of simple encoding and decoding programs, which demonstrate using the generated code. Additionally, the sample writer program can optionally encode randomly-generated test data.

Language-specific Functions

Depending on the target language selected, additional options may be displayed within this section of the Function Generation tab.

For C and C++, additional functions for memory management and macros for dealing with named bits in BIT STRINGs can be generated. Initialization functions are generated by default, but may be turned off.

For Java, get and set methods can be generated for members of generated classes. It is also possible to generate methods that can fetch certain types of metadata (for example, if an element is optional). A similar option exists for C#.

Constraints and Debugging tab

The Constraints and Debugging tab holds settings related to constraint handling, event handling, and logging in generated code.

The Constraints and Debugging tab contains the following sections:

Constraints

This section provides users with the ability to add or remove various types of restriction checks from the generated code.

Debugging and Event Handling

This section provides users with the ability to add debug tracing and event hooks. In addition to enabling event callbacks, generation of type structures can also be disabled, in which case generated decode functionality simply calls user-created event handlers and does not perform its own decoding operation.

Code Modifications tab

The Code Modifications tab contains a number of options for generating simplified code.

The Code Modifications tab contains the following sections:

Space Optimizations

This section provides users with the ability to remove unwanted or unneeded functionality and shorten the names of generated types.

Other Options

This section provides users with the ability to define several miscellaneous settings, including the option to generate code for types that have been imported into the current schema.

Language-specific tab

Additional code modification options that are language-specific are shown in a separate tab next to the Code Modifications tab. The label and contents of this tab changes based on the language selected within the Output tab.

For C/C++, the tab is displayed as follows, and includes several settings for adjusting how ASN.1 types are mapped to native C/C++ types:

For C#, the tab is displayed as follows, and includes settings to allow for manipulating the namespace into which code is generated:

Note

The Java tab contains similar options.

Build Options tab

When a target language other than None is selected, an additional Build Options tab is displayed to provide language environment-specific settings for generating makefiles and build scripts.

For C or C++, the tab is as follows:

A makefile can be generated in either Windows or GNU format. For Windows, a Visual Studio project can also be generated. Under the Build Libraries section, which generates the build script to build a library rather than an executable, the desired variety of library can be selected.

The C/C++ Compile Optimization section allows for defining whether Space or Time optimization qualifiers should be added to the C compilation command-line in the makefile.

For C#, the tab is as follows:

For C#, a makefile or Visual Studio project can be created, optionally including a *.mk file listing the files generated. An option to specify a strongly named key file is also available.

For Java, the tab is as follows:

Like C#, Java can also provide a *.mk generated file list, as well as an Ant build script and a batch or shell script.

For Python, the tab is as follows:

For Python, ASN1C can create a batch file (Windows) or shell script (non-Windows) that generates the Python code as set up by the GUI settings.

For Go, the tab is as follows:

The Go code generator can create a makefile to generate and build Go code. The generator can also create a JSON file with random test data. Additionally, an option for the generator not to create a main.go file (for instance, if there already is one that has been modified) is available.