Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

 

gmniUtility Statements Summary

gmniUtility statements are made accessible to command scripts via a gmNI event. See the discussion under gmNI Command for information on implementing gmniUtility statements. This page describes those available in gmBasic. Using a gmniUtility statement is exactly like using any one of the other utility statements with one additional step, the Runtime Dll that implements the statement has to be loaded using LoadRuntime statement.

AuditReferences gmniUtility Statement Summary

AuditReferences is a utility statement implemented by the ReferencesAuditruntime Dll. The compiler after it processes a subprogram, a property method, or an ASP page, scans the intermediate code produced and produces a sorted symbol reference list. For each symbol reference in the intermediate code the following six fields are saved:

 

FieldDescription of content
MAKES_REFThe root offset of the subprogram, method, or page containing the reference to a symbol.
BEING_REFDThe root offset of the symbol being referenced. This is the field upon which the reference list is sorted.
REC_NUMBERThe text record number in the text buffer of the source statement that produced the reference. These text buffers are retained in the storage files produced by translation scripts. If the text buffer was edited via Fix statements then it is the edited version that is saved.
CODE_OFFSETThe relative offset in the intermediate code of the actual symbol reference.
HOST_FILEThe root offset of the information file containing the MAKES_REF code unit. This is the parent class, form, module, or page file.
TERMINALIf the reference to the symbol was terminal then True (1), else False (0). In a source code context an identifier like namespace.class.symbol has a terminal reference to symbol and nonterminal references to namespace and class. All three are retained.

This list is then used by the analyser to aid in its type inference decisions and in particular to trace argument values through subprogram calls. The AuditReferencesreport is a listing of the terminal references in this list.

 

The attributes of the AuditReferencesstatement are as follows:

 

AttributeDescription
StorageThis attribute specifies the full pathname of the storage file whose symbol references are to be audited.

The following command script produced this references report from the first VB6 project in the FMSTOCKSsample code.

 

   <gmBasic>
      <LoadRuntime dllName="ReferencesAudit.dll" />
      <Output filename="c:\gmBasic\AuditReferences.html" syntax="Html" />
      <AuditReferences Storage="fmstock1.vbi" />
   </gmBasic>
Note the use of Html syntax for the output file. This causes gmBasicto use Html annotations to write the table.

 

The columns in the report are as follows:

 

ColumnDescription of content
TypeIf the MAKES_REF component is a control, then the type is GUI else the type is REF.
Member NameThis is the identifier of the BEING_REFD symbol. Normally, this is simply the identifier associated with the symbol when it was initially stored in the symbol table. The special case has to do with properties that can have the Let, Get, and Set methods associated with then. When one of these methods is identified, it must be combined with the identifier of its parent property.
Member ClassThis is the class name of the BEING_REFD symbol. For symbols within library description files this is the name of the class or enumeration that contains the component. If the symbol is a variable, subprogram, constant, property, or enumeration, then this is the name associated with the code file that contains it. For higher level symbols within projects, this is the name of the project. For higher symbols in libraries, it is the library name.
Member LibraryThis is the library name of the BEING_REFD symbol. For symbols within library description files this is the name of the library. For symbols within VB6 projects this is the name of the project. For any other symbols this is simply the identifier of the highest symbol in the tree above it but below the root.
Member TypeThis is the object type name of the BEING_REFD symbol. This is either an entry ObjectType enumeration in the language file, or a library reference type name, or a Basic built in class name, or the fully qualified identifier of the control if it is an external control class.
Loc LineIf available, this is the line number in the source file of the reference.
Loc TextIf available, this is the actual source statement that made the reference.
Loc MemberThis is the identifier of the MAKES_REF symbol. Normally, this is simply the identifier associated with the symbol when it was initially stored in the symbol table. The special case has to do with properties that can have the Let, Get, and Set methods associated with then. When one of these methods is identified, it must be combined with the identifier of its parent property.
Loc PathThis is the pathname of the HOST_FILE component. For components within library description files the pathname is the hintpath of the library containing the component. For components within VB6 projects, this is the identifier of the file that contains the component. If no pathname can be found then it is simply blank.
Loc NameThis is the class name of the MAKES_REF symbol. For symbols within library description files this is the name of the class or enumeration that contains the component. If the symbol is a variable, subprogram, constant, property, or enumeration, then this is the name associated with the code file that contains it. For higher level symbols within projects, this is the name of the project. For higher symbols in libraries, it is the library name.
Loc TypeThis is the file extension of the HOST_FILE component. For components within library description files it is the extension on the hintpath of the library containing the component. For components within VB6 projects, this is the extension the file that contains the component. If no extension can be found then it is simply blank.


AuditDefinitions gmniUtility Statement Summary

AuditDefinitions is a utility statement implemented by the ReferencesAudit runtime Dll. It uses the same sorted symbol reference list as is used by the AuditReferences statement, but in a very different way. Its purpose is to detect how often user code symbols are used and in particular which user symbols are never used. The AuditDefinitionsreport is driven by a full traversal of the symbol table, though only source code symbols are included in the report. For each symbol, the symbol reference list is used to count its terminal references. This count along with the information about the symbol are then reported.

 

The attributes of the AuditDefinitionsstatement are as follows:

 

AttributeDescription
StorageThis attribute specifies the full pathname of the storage file whose symbol definitions are to be audited.

The following command script produced this definitions report from the first VB6 project in the FMSTOCKSsample code.

 

   <gmBasic>
      <LoadRuntime dllName="ReferencesAudit.dll" />
      <Output filename="c:\gmBasic\AuditDefinitions.html" syntax="Html" />
      <AuditDefinitions Storage="fmstock1.vbi" />
   </gmBasic>
Note the use of Html syntax for the output file. This causes gmBasicto use Html annotations to write the table.

 

The columns in the report are as follows:

 

ColumnDescription of content
TypeThis is DEF:n where n is the nesting level of the symbol in the symbol table.
Member NameThis is the identifier of the symbol. Normally, this is simply the identifier associated with the symbol when it was initially stored in the symbol table. The special case has to do with properties that can have the Let, Get, and Set methods associated with then. When one of these methods is identified, it must be combined with the identifier of its parent property.
Member ClassThis is the class name of the symbol. For symbols within library description files this is the name of the class or enumeration that contains the component. If the symbol is a variable, subprogram, constant, property, or enumeration, then this is the name associated with the code file that contains it. For higher level symbols within projects, this is the name of the project. For higher symbols in libraries, it is the library name.
Member LibraryThis is the library name of the symbol. For symbols within library description files this is the name of the library. For symbols within VB6 projects this is the name of the project. For any other symbols this is simply the identifier of the highest symbol in the tree above it but below the root.
Member TypeThis is the object type name of the symbol. This is either an entry ObjectType enumeration in the language file, or a library reference type name, or a Basic built in class name, or the fully qualified identifier of the control if it is an external control class.
Num ReferThis is the number of terminal references to the symbol. It may be zero.
Loc TextThis is a declaration of the symbol. For variables, subprograms, property methods, and constants it is the Context flags associated with the symbol, followed by the symbol type, and the local identifier. For subprograms this is followed by a list of the argument types and calling status. For non quantity symbols it is simply the identifier.
Loc PathThis is the pathname of the symbol. For components within library description files the pathname is the hintpath of the library containing the component. For components within VB6 projects, this is the identifier of the file that contains the component. If no pathname can be found then it is simply blank.
Loc NameThis is the library name of the symbol. For symbols within library description files this is the name of the library. For symbols within VB6 projects this is the name of the project. For any other symbols this is simply the identifier of the highest symbol in the tree above it but below the root.
Loc TypeThis is the file extension of the symbol. For components within library description files it is the extension on the hintpath of the library containing the component. For components within VB6 projects, this is the extension the file that contains the component. If no extension can be found then it is simply blank.


AuditExternals gmniUtility Statement Summary

AuditExternals is a utility statement implemented by the ReferencesAudit runtime Dll. It produces the same report format as the AuditReferences report, but only shows components in external libraries. Most importantly, the sorted references list is produced from the analysed code and not the simple compiled code and the range of application is greatly expanded. In addition to subprograms, property methods, and pages, the code in constants, enumeration entry values, and controls. is also searched. The report also includes the specific COM events that have event handlers in a given compilation unit. Finally, the references themselves are expanded to include things like sysRS!PropertyName = "Node Count" as a field reference; default item methods in collection classes when the code simply shows an COL.Item reference; and references to components in the MigrationSupportlibrary that were hiding under operations codes.

 

The attributes of the AuditExternalsstatement are as follows:

 

AttributeDescription
StorageThis attribute specifies the full pathname of the storage file whose external symbol references are to be audited.

The following command script produced this externals report from the first VB6 project in the FMSTOCKSsample code.

 

   <gmBasic>
      <LoadRuntime dllName="ReferencesAudit.dll" />
      <Output filename="c:\gmBasic\AuditExternals.html" syntax="Html" />
      <AuditExternals Storage="fmstock1.vbi" />
   </gmBasic>
Note the use of Html syntax for the output file. This causes gmBasicto use Html annotations to write the table.

 

See the description of AuditReferences for a description of the content of the columns.
Table of Contents

  • No labels