Skip to content

gmplAuthorStatement

Author is a nonterminal, command statement that occurs only in command scripts. It takes as input the intermediate code produced by the analysis phase of the translation process. Using that code and the information contained in the symbol table it produces a fully functional code in the target language.

The attributes of the Author statement are as follows:

Attribute

Description

Name

This attribute specifies the overall name to be used as the web project name for an ASP site translation. If omitted, the name WebProject is used. This attribute is ignored in VB6 translations.

Project

This attribute specifies the name of a previously compiled and analysed VBP project or ASP page. It restricts the author to that component only. If omitted, all active components are authored.

Finish

This attribute is used to suppress the final authoring of the bundle file using Finish=‘off’. Doing this allows you to apply custom edits using gmAPI code to the in memory target code buffers, after they are authored in memory but before they are authored to the bundle file on disk.  gmAPI code that does this will look like this sample from the gmAPI extension that implements WPF migration that authors XAML:

public static int XeqStatement(string record)
...
switch (scriptTag)
...
case "author":
string AuthorFinishOff = record.Replace("<Author", "<Author Finish='off' ");
returnCode = Execute.gmPL(AuthorFinishOff);
if (returnCode != 0) return returnCode;
Phase_AuthorPostEdit();
Runtime.FinishTranslation(); // Author Bundle file
return returnCode;

The substatements of the Author statement are as follows:

SubstatementDescription
FixAdding a Fix command to the Author statement makes it possible to apply search and replace type edits to the translated source code before it is written. This facility has several benefits: first a quick, inexpensive way to solve one-off problems; and second, a temporary workaround to document and handle issues until a permanent solution can be incorporated into the standard tool configuration or the core translation engine.

The script errors associated with the Author statement are as follows:

ErrorDescription
1007Encountered illegal AUTHOR directive %1d
1008The Project [%1d] does not exist in the storage area.
1009The Component [%1d] is not a project.
1010The Storage area does not contain any projects.

The actual records written by the author are stored in the virtual binary information file in editable text buffers. These buffers can then be modified via Fix substatements. It is the final records in these buffers that are actually written.

In addition to the target code the author also produces the project files needed to create .NET assemblies, resource files containing control property values, stubs for any external components referenced, and a reference file describing the public symbols exposed by the code. When-ever possible the code produced by the author can be deployed to its deployment location and directly built using the .NET compilers.