C/C++ Support Guide

Previous Next

C/C++ Support Guide
C/C++ Support Guide
This guide describes Modernization Workbench (MW) support for the C and C++ programming languages (Microsoft Visual C and C++ 6). It includes a summary of supported tools, support notes and known limitations, and reference tables that describe the C/C++ object (Level 1) and construct (Level 2) models created by the MW parser.
The following topics are discussed:
Supported Tools
Support Notes
Modeling Support in MW
Previous Next

© Copyright 2010 Micro Focus (IP) Limited. All Rights Reserved.


Supported Tools

C/C++ Support Guide : Supported Tools
Supported Tools
Table 1‑1 describes the Repository-level tools and HyperView panes which are supported for C/C++. For details about a specific MW tool, see the workbench documentation set.
Table 1‑1
Supported MW Functionality
Area of MW Supported
Support Notes
Inventory
C/C++ source objects are registered into workspaces with default extensions:
C File = .c
CPP File = .cpp
Header File = .h, .hpp, .inl
Verification
Full support
Inventory Report
Full support
Verification Report
Full support
Reference Reports
Unreferred Report
Unresolved Report
Cross-Reference Report
External Reference Report
Executive Report
Inventory Details and Repository Statistics only.
Complexity Metrics
Full support
Effort Estimation
Full support
Diagrammer
Full support
Quick Diagrammer
Full support
Decision Resolution
Boundary decisions can be resolved to targets.
Hyperview Source Pane
Full support
Hyperview Context Pane
Full support
Hyperview Clipper Pane
Full support
Hyperview Advanced Search
Perform searches on individual C/C++ files rather than project-wide searches.
Hyperview Model Pane
Includes descriptions of the C/C++ HyperCode constructs and their attributes.
Hyperview Bird's Eye Pane
Full support
Business Rule Manager
Includes the ability to create business rules manually or from Clipper lists. Autodetection of rules is not supported with this release.


Support Notes

C/C++ Support Guide : Support Notes
Support Notes
This section contains general support information and known limitations for C/C++ in this release.
Note:
Be sure to check the workbench release notes for late-breaking issues not available at press time.


Required Workbench Options for C/C++

C/C++ Support Guide : Support Notes : Required Workbench Options for C/C++
Required Workbench Options for C/C++
The following sections describe workbench options required for successfully registering and verifying C/C++ source files. For detailed instructions on setting these and other options required for all languages, see Preparing Projects in the workbench documentation set.


Boundary Decisions

C/C++ Support Guide : Support Notes : Required Workbench Options for C/C++ : Boundary Decisions
Boundary Decisions
You must specify boundary decisions in the Workspace Options dialog. See Preparing Projects in the workbench documentation set for details.


Workspace Registration Options

C/C++ Support Guide : Support Notes : Required Workbench Options for C/C++ : Workspace Registration Options
Workspace Registration Options
Follow these instructions to set required workspace registration options for C/C++ support.
In the Tools menu, choose Workspace Options. The Workspace Options window opens. Click the Registration tab, then the Source Files tab:
•
Place a check mark next to the Strip trailing numeration check box if you want the system to strip trailing numeration characters (columns 73 through 80) from source lines. Trailing numeration characters are removed only from the source files maintained by the workbench.
•
Place a check mark next to Expand tabulation symbols if you want the system to replace tabulation symbols with a corresponding number of spaces. Tabulation symbols are replaced only in the source files maintained by the workbench.
Note:
You must select this option if you want to view HyperView information for C or C++ programs.


Workspace Verification Options

C/C++ Support Guide : Support Notes : Required Workbench Options for C/C++ : Workspace Verification Options
Workspace Verification Options
Follow these instructions to set required workspace verification options for C/C++ support.
In the Tools menu, choose Workspace Options. The Workspace Options window opens. Click the Verification tab, then the Settings tab.
In the Source Type pane, choose C File or CPP File:
•
Place a check mark next to Show Macro Generation if you want statements derived from macro processing to be displayed in HyperView.
•
In the List of Include Directories pane, list the folders for include files used by the application (either original folders or folders in MW, if the include files were registered).
Right-click in the pane and choose Add Folder in the pop-up menu to add a folder. Delete a folder by right-clicking it and choosing Delete in the pop-up menu.
Tip:
You can also specify these folders in the verification options for a project, in which case MW looks only at the folders for the project. See Project Verification Options.
•
In the C/C++ Parser Parameters field, enter the parameters used to compile the application. For an MFC application, the parameters would be -D_DEBUG -D_UNICODE -D_WINDLL -D_DLL, for example.
Tip:
You can also specify these parameters in the verification options for a project, in which case only the project parameters are used for verification. See Project Verification Options.
•
Place a check mark next to Ignore Duplicate Entry Points if you want the parser to allow duplicate entry points defined by the Cobol statement ENTRY ‘PROG-ID’ USING A, or its equivalent in other languages. The parser creates an entry point object for the first program in which the entry point was encountered and issues a warning for the second program.
Note:
You cannot use this option to verify multiple programs with the same program ID.


Project Verification Options

C/C++ Support Guide : Support Notes : Required Workbench Options for C/C++ : Project Verification Options
Project Verification Options
Follow these instructions to set required project verification options for C/C++ support.
In the Tools menu, choose Project Options. The Project Options window opens. Click the Verification tab.
In the Source Type pane, choose C File or CPP File:
•
In the List of Include Directories pane, list the folders for include files used by the application (either original folders or folders in MW, if the include files were registered). Choose Add in the pop-up menu to add a folder to the list. Specify the full path of the folder.
Edit a folder by selecting it and choosing Edit in the right-click menu. Delete a folder by selecting it and choosing Delete in the right-click menu.
Note:
If you do not set this option, workspace verification options determine the include folders the parser looks for.
•
In the C/C++ Parser Parameters field, enter the parameters used to compile the application. For an MFC application, the parameters would be -D_DEBUG -D_UNICODE -D_WINDLL -D_DLL, for example. If you do not set this option, workspace verification options control the parameters the parser uses.
•
Place a check mark next to Use Precompiled Header File if you want the parser to use a precompiled header file when it verifies the project. In the adjacent field, enter the full path of the header file. Do not specify the file extension.
Note:
Using a precompiled header file may improve verification performance significantly.
The content of the header file must appear in both a .c or .cpp file and a .h file. The precompiled header file need not have been used to compile the application.


Modeling Support in MW

C/C++ Support Guide : Modeling Support in MW
Modeling Support in MW
MW is a model-based technology that generates information about legacy applications at two levels:
•
Level 1 (or object-level) information describes the relationships between the objects that comprise an application: program source files, header files, and so forth.
•
Level 2 (or construct-level) information describes the relationships between the abstract syntactical constructs that comprise an object: sections, paragraphs, statements, conditions, variables, and so forth.
At both levels, the models are conceived as Entity Relationship Diagrams (ERDs). Each object or construct the parser generates is modeled as an entity in one of the diagrams. The models are represented in tree form to the end user.


Level 1 Modeling Support for C/C++

C/C++ Support Guide : Modeling Support in MW : Level 1 Modeling Support for C/C++
Level 1 Modeling Support for C/C++
The Level 1 model for an application defines the relationships between the objects that comprise the application. These can be physical objects, like program source files or header files, or logical objects that identify abstract program elements (classes, functions, and the like).


Level 1 Metamodel

C/C++ Support Guide : Modeling Support in MW : Level 1 Modeling Support for C/C++ : Level 1 Metamodel
Level 1 Metamodel
Every entity the parser generates is an instance of an entity type. The Level 1 metamodel defines these types, or meta-entities, and their relationships. Figure 1‑1 shows the Level 1 metamodel.
Note:
The Level 1 metamodel is also referred to, in OMG terms, as the Knowledge Discovery Metamodel (KDM).
Figure 1‑1
Level 1 Metamodel
Click image to expand


Level 1 Model Table

C/C++ Support Guide : Modeling Support in MW : Level 1 Modeling Support for C/C++ : Level 1 Model Table
Level 1 Model Table
Table 1‑2 shows the objects in the Level 1 metamodel and their relationships.
Table 1‑2
Level 1 Model Table
Object
Relationships
C File
Includes Header
Defines Function
C ++ File
Includes Header
Defines Function
Defines Class
Defines Member Function
Header File
Includes Header
Defines Function
Defines Class
Defines Member Function
Class
Inherits
Depends On Class
Depends On Function
Depends On Decision
Calls Function
Calls Member Function
Calls Decision
Has Member Function
Function
Calls Function
Calls System Function
Calls Member Function
Member Function
N/A
System Function
N/A


Level 1 Relationship Projections

C/C++ Support Guide : Modeling Support in MW : Level 1 Modeling Support for C/C++ : Level 1 Relationship Projections
Level 1 Relationship Projections
The following tables describe relationships generated by C/C++ statements in the Level 1 model. Relationships are listed by object type.
Note:
There are no relationship projections for the Member Function and System Function object types.
C File Relationship Projections
Table 1‑3
C File Relationship Projections
Statement
Format
Relationship
Entities
INCLUDE
#include “<header_name>”
C File
Includes Header
H File
H File:
Name=<header_name>
DEFINE FUNCTION
<function_name>([list of parameters]);
C File
Defines function
Function
Function:
Name=<function_name>
C++ File Relationship Projections
Table 1‑4
C++ File Relationship Projections
Statement
Format
Relationship
Entities
INCLUDE
#include “<header_name>”
CPP File
Includes Header
H File
H File:
Name=<header_file>
DEFINE FUNCTION
<function_name>([list of parameters]);
CPP File
Defines Function
Function
Function:
Name=<function_
name>
DEFINE MEMBER FUNCTION
<member_function_name>([list of parameters]);
CPP File
Defines Function
Function
Member Function:
Name=
<member_function_name>
DEFINE CLASS
class <class_name> {};
CPP File
Defines Class
Class
Class:
Name=<class_
name>
MEMBER
FUNCTION
[<result_type>] <member_function_name>
([list of parameters]);
CPP File
Defines Member Function
Member Function
Member Function:
Name=
<member_function_name>
Header File Relationship Projections
Table 1‑5
Header File Relationship Projections
Statement
Format
Relationship
Entities
INCLUDE
#include “<header_name>”
H File
Includes Header
H File
H File:
Name=<header_
name>
DEFINE FUNCTION
<function_name>([list of parameters]);
H File
Defines Function
Function
Function:
Name=<function_name>
DEFINE CLASS
class <class_name> {};
H File
Defines Class
Class
Class:
Name=<class_
name>
MEMBER
FUNCTION
[<result_type>] <member_function_name>
([list of parameters]);
H File
Defines Member Function
Member Function
Member Function:
Name=<member_function_name>
Function Relationship Projections
Table 1‑6
Function Relationship Projections
Statement
Format
Relationship
Entities
CALL
<function_name>([list of parameters]);
Function
Calls Function
Function
Function:
Name=<function_name>
CALL
<member_function_name>([list of parameters]);
Function
Calls Member Function
Function
Member Function:
Name=<member_function_name
CALL
<expression>;
Function
Calls Decision
Decision
Decision:
Name=<internal name>
*any other statement*
<class_name> <variable>;
Function
Depends On Class
Class
Class:
Name=<class_name>
Class Relationship Projections
Table 1‑7
Class Relationship Projections
Statement
Format
Relationship
Entities
INHERITS
class <class_name1>: [public] <class_name2> {};
Class
Inherits
Class
Class1.Name=<class_name1>
Class2.Name=<class_name2>
*Any mention of a CLASS that is not a call of its member function*
class <class_name1>
{
<class_name2> variable;
}
Class
Depends On Class
Class
Class1.Name=<class_name1>
Class2.Name=<class_name2>
*Any mention of a function that is not a call*
class <class_name>
{
Variable = <function_name>;
}
Class
Depends On Function
Function
Class.Name=<class_name>
Function.Name=<function_name>
*Any expression in a position of a class or a function that is not a call*
class <class_name>
{
<expression>
}
Class
Depends On Decision
Decision
Class.Name=<class_name>
Decision.Name=<internal_name>
CALL
class <class_name>
{
<function_name>([list of parameters]);
}
Class
Calls Function
Function
Class.Name=<class_name>
Function.Name=<function_name>
CALL
class <class_name>
{
<member_function_name>([list of parameters]);
}
Class
Calls Member Function
Member Function
Class.Name=<class_name>
Function.Name=<function_name>
CALL
class <class_name>
{
<expression>
}
Class
Calls Decision
Decision
Class.Name=<class_name>
Decision.Name=<internal_name>
DEFINITION
class <class_name>
{
[result_type] <member_function_name>([list of parameters]){}
}
Class
Has Member Function
Member Function
Class.Name=<class_name>
MemberFunction.Name=<member_function_
name>


Complexity Metrics

C/C++ Support Guide : Modeling Support in MW : Level 1 Modeling Support for C/C++ : Complexity Metrics
Complexity Metrics
Table 1‑8 describes the industry standard and workbench-generated complexity metrics supported by the legacy estimation tools. Not all metrics will be available for your configuration.
Table 1‑9 describes C/C++-specific details for the supported complexity metrics.
Table 1‑8
Complexity Metrics
Metric
Object Types
Description
Absolute Complexity
C/C++ Function, C++ Member Function, Java Method, PB Method, Program, VB Function, VB Method
Binary Decisions divided by the number of statements.
Abstract Classes
Java Package, Java File
Number of abstract classes and interfaces.
Abstract Methods
Java Package, Java File
Number of abstract methods.
Abstractness
Java Package
Ratio of Number of Abstract Classes (and interfaces) in the analyzed package to the total number of classes in the analyzed package.
Afferent Coupling
Java Package
Number of other packages that depend on classes in the package. An indicator of the package’s responsibility.
Areas
DMS DDL File, IDMS Schema File, IDMS Subschema
Number of areas.
Asynchronous Calls
Program
Number of asynchronous calls, such as Cobol INITIATE statements.
Average Absolute Complexity
Java Class, Java Interface, Java Package, Java File
Average Absolute Complexity of methods.
Average Binary Decisions
Java Class, Java Interface, Java Package, Java File
Average Binary Decisions of methods.
Average Catch Clauses
Java Class, Java Interface, Java Package, Java File
Average Catch Clauses in methods.
Average Computational Statements
Java Class, Java Interface, Java Package, Java File
Average Computational Statements of methods.
Average Conditional Complexity
Java Class, Java Interface, Java Package, Java File
Average Conditional Complexity of methods.
Average Cyclomatic Complexity
Java Class, Java Interface, Java Package, Java File, PB Object
Average Cyclomatic Complexity of methods.
Average Depth of Inheritance Hierarchy
Java Package, Java File
Average Depth of Inheritance Hierarchy of classes and interfaces.
Average Essential Complexity
Java Class, Java Interface, Java Package, Java File
Average Essential Complexity of methods.
Average Extended Cyclomatic Complexity
Java Class, Java Interface, Java Package, Java File
Average Extended Cyclomatic Complexity of methods.
Average IF Statements
Java Class, Java Interface, Java Package, Java File
Average IF Statements in methods.
Average Lack of Cohesion Per Type
Java Package, Java File
Average Lack of Cohesion of classes and interfaces.
Average Loop Statements
Java Class, Java Interface, Java Package, Java File
Average Loop Statements in methods.
Average Maximum Switch Cases
Java Class, Java Interface, Java Package, Java File
Average Maximum Switch Cases in methods.
Average Nested Block Depth
Java Class, Java Interface, Java Package, Java File, PB Object
Average Nested Block Depth of methods.
Average Parameters
Java Class, Java Interface, Java Package, Java File, PB Object
Average Parameters in methods.
Average Specialization Index Per Type
Java Package, Java File
Average Specialization Index of classes and interfaces.
Average Subtypes
Java Package
Average Subtypes in methods.
Average Switch Cases
Java Class, Java Interface, Java Package, Java File
Average Switch Cases in methods.
Average Switch Statements
Java Class, Java Interface, Java Package, Java File
Average Switch Statements in methods.
Average Unique Method Calls
Java Class, Java Interface, Java Package, Java File
Average Unique Method Calls in methods.
Binary Decisions
Java Method, PB Method, Program, VB Function, VB Method,
C/C++ Function, C++ Member Function
Number of branching conditions in the flow graph with two possible outcomes. Includes statements with implicit condition evaluation (loops, AT END, and so on).
Blank Lines
All source files
Number of blank lines of source (sequence number area content is ignored).
Catch Clauses
Java Method, PB Method
Number of catch clauses.
Classes
VB Library
Number of classes.
Columns
DDL File
Number of columns.
Comment Lines
PL/I File, PL/I Include File
Number of lines of source containing comments only and no code.
Comments Ratio
C/C++ Function, C++ Member Function, C++ Class, Java Method, Java Class, Java Interface, Java Package, Java File, PB Method, PB Object
Number of Comments divided by Lines of Code.
Computational Statements
C/C++ Function, C++ Member Function, Java Method, PB Method, Program, VB Function, VB Method
Number of statements performing arithmetic calculations.
Conditional Complexity
C/C++ Function, C++ Member Function, Java Method, PB Method, Program, VB Function, VB Method
Binary Decisions plus Unique Operands in Conditions.
Conditional Statements
Program
Number of branching statements with nested statements executed under certain conditions, not including conditional GOTOs.
Constructors
C++ Class, Java Method, Java Class, Java Interface, Java Package, Java File, PB Method, PB Object
Number of constructors.
Control Cards Usages
JCL File, JCL Procedure
Number of DD statements referencing control cards identified in Legacy.xml to generate program to control card relationships.
Cyclomatic Complexity
C/C++ Function, C++ Member Function, Java Method, PB Method, Program, VB Function, VB Method
v(G) = e - n + 2, where v(G) is the cyclomatic complexity of the flow graph (G) for the program in question, e is the number of edges in G, and n is the number of nodes. Quantity of decision logic. The number of linearly independent paths (minimum number of paths to be tested). v(G) = DE + 1, where DE is the number of binary decisions made in the program.
Data Elements
Copybook File, Program
Number of declared data items (elementary structures and their fields). For PL/I, the implicit variable DFHEIBLK for CICS statements is counted as a data element.
Data Members
C++ Class
Number of data members.
Data Sets
DMSII Database
Number of data sets.
Dead Data Elements
Program
Number of dead data elements in programs and used include files. Dead data elements are unused structures at any data level, all of whose parents and children are unused. For PL/I, number of declared data items in dead internal procedures.
Dead Data Elements from Includes
Program
Number of dead data elements in include files. Dead data elements are unused structures at any data level, all of whose parents and children are unused. For PL/I, N/A.
Dead Lines
Program
Number of dead lines in programs and used include files. Dead lines are source lines containing Dead Data Elements or Dead Statements. For Cobol, also source lines containing “dead constructs.” For more information on dead constructs, see the Parser Reference Manual.
Dead Lines from Includes
Program
Number of dead lines in include files. Dead lines are source lines containing Dead Data Elements from Includes or Dead Statements from Includes. For Cobol, also source lines containing “dead constructs.” For more information on dead constructs, see the Parser Reference Manual.
Dead Statements
Program
Number of dead statements in programs and used include files. A dead statement is a procedural statement that can never be reached during program execution. For PL/I, dead DECLARE statements are not calculated as dead statements.
Dead Statements from Includes
Program
Number of dead statements in include files. A dead statement is a procedural statement that can never be reached during program execution.
Depth of Inheritance Hierarchy
C++ Class, Java Class, Java Interface, PB Object
Maximum nesting of the inheritance hierarchy.
Destructors
C++ Class, VB Class
Number of destructors.
Difficulty
C/C++ Function, C++ Member Function, Java Method, PB Method, Program, VB Function, VB Method
D = (n1 / 2) * (N2 / n2), where n1 is Unique Operators, N2 is Operands, and n2 is Unique Operands.
Disjoint Data Sets
DMSII Database
Number of disjoint data sets.
Efferent Coupling
Java Package
Number of other packages that the classes in the package depend on. An indicator of the package’s independence.
Entry Points
Program
Number of program entry points.
Error Estimate
C/C++ Function, C++ Member Function, C++ Class, Java Method, Java Class, Java Interface, Java Package, Java File, Program, PB Method, PB Object, VB Class, VB Function, VB Method
B = E**(2/3) / 3000, where E is Programming Effort.
Essential Complexity
C/C++ Function, C++ Member Function, Java Method, PB Method, Program
Quantity of unstructured logic (a loop with an exiting GOTO statement, for example). v(G) for reduced graph without D-structured primes.
Exception Handling Statements
C/C++ Function, C++ Member Function, VB Function, VB Method
Number of exception handling statements.
EXEC Cataloged Procedure Steps
JCL File, JCL Procedure
Number of EXEC statements invoking cataloged procedures.
EXEC In-stream Procedure Steps
JCL File, JCL Procedure
Number of EXEC statements invoking instream procedures.
Executable Statements
C/C++ Function, C++ Member Function, C++ Class, Java Method, Java Class, Java Interface, Java Package, Java File, Program, PB Method, PB Object, VB Class, VB Function, VB Method
All Cobol Procedure Division statements, plus CONTINUE and NEXT STATEMENT. All PL/I statements, except BEGIN, DECLARE, DO (block), END, ENTRY, PACKAGE, and PROCEDURE. All Natural statements, except DEFINE DATA and IGNORE. For object-oriented languages, all assignments, function calls (alone on a line), calls, returns, IF, DO, FOR, CHOOSE, EXIT, CONTINUE, and GOTO statements.
Extended Cyclomatic Complexity
C/C++ Function, C++ Member Function, Java Method, PB Method, Program, VB Function, VB Method
Cyclomatic Complexity plus Logical Operators in Conditions. Number of all paths in the program.
Fields
AS/400 Database File, Java Class, Java Interface, Java Package, Java File, PB Object, VB Class
Number of fields.
Fields of Adabas File Number
Natural DDM File
Number of fields of Adabas file number.
Foreign Keys
DDL File
Number of foreign keys.
Function Calls
C/C++ Function, C++ Member Function, VB Function, VB Method
Number of function calls.
Function Points
C/C++ Function, C++ Member Function, C++ Class, Java Method, Java Class, Java Interface, Java Package, Java File, Program, PB Method, VB Class, VB Function, VB Method
Lines of Code divided by K, where K depends on the language: Cobol=77, Natural=52, PL/I=67, PowerBuilder=24. For RPG, Lines of Code/K + 0.5, where K=61. Estimate of the number of end-user business functions implemented by the program.
Functions
VB Library
Number of functions.
Global Data Items
DMSII Database
Number of global data items.
GoTo Statements
C/C++ Function, C++ Member Function, Program, VB Function, VB Method
Number of GOTO statements, including conditional GOTOs.
Hidden Fields
Map
Number of hidden fields.
IF Statements
C/C++ Function, C++ Member Function, Java Method, PB Method, VB Function, VB Method
Number of IF statements.
Import Statements
Java Package, Java File
Number of import statements.
Include Copybook Statements
APS File, APS Include File
Number of include copybook statements.
Include Data Structure
APS Application
Number of included data structures.
Include DDI
APS Application
Number of included DDIs.
Include DDL/PSB
APS Application
Number of included data definitions.
Include Global Data Area Statements
Natural File, Natural Subroutine File
Number of included global data area statements.
Include Local Data Area Statements
Natural File, Natural Subroutine File
Number of included local data area statements.
Include Macro Statements
APS File, APS Include File
Number of included macro statements.
Include Macro/Copybook
APS Application
Number of included macros/copybooks.
Include Parameter Data Area Statements
Natural File, Natural Subroutine File
Number of included parameter data area statements.
Include Program
APS Application
Number of included programs.
Include Report
APS Application
Number of included reports.
Include Resource Statement
Copybook File, Cobol File (ACUCOBOL only)
Number of included resource statements.
Include Screen
APS Application
Number of included screens.
Include Statements
All source files, except DDL File, Java Interface, Java File, PB Object
Number of language-specific include statements.
Inherited Methods
C++ Class, VB Class
Number of inherited methods.
Inner Call Statements
Program
Number of statements that invoke Inner Procedures.
Inner Procedures
Program
Number of structured pieces of code that cannot be invoked from external programs (Cobol paragraphs, inner PL/I procedures, Natural inline subroutines).
Input Fields
Map
Number of input fields.
Input/Output Fields
Map
Number of input/output fields.
Instability
Java Package
Ratio of Efferent Coupling (Ce) to total coupling (Ce + Ca), such that I = Ce / (Ce + Ca). An indicator of the package’s resilience to change.
Intelligent Content
C/C++ Function, C++ Member Function, C++ Class, Java Method, Java Class, Java Interface, Java Package, Java File, Program, PB Method, PB Object, VB Class, VB Function, VB Method
I = L * V, where L is Program Level and V is Program Volume. Complexity of a given algorithm independent of the language used to express the algorithm.
Interfaces
Java Class, Java Interface, Java Package, Java File
Number of interfaces.
IO Statements
Program
Number of statements performing input/output operations.
Key Fields
AS/400 Database File
Number of key fields.
Labels
C/C++ Function, C++ Member Function, VB Function, VB Method
Number of labels.
Lack of Cohesion
Java Class, Java Interface
LOCM = (m - sum(mA)/a1+a2) / (m-1), where mA is the number of methods that access class attributes.
Lines of Code
C/C++ Function, C++ Member Function, C++ Class, Java Method, Java Class, Java Interface, Java Package, Java File, Program, PB Method, PB Object, VB Class, VB Function, VB Method
Number of lines of code, including copybooks (if applicable), but not including comments and blank lines.
Lines with Both Comments and Code
PL/I File, PL/I Include File
Number of lines of source containing both comments and code.
Lines with Comments
All source files, except PL/I, PL/I Include, and Java Files
Number of lines of source containing comments, including inline comments placed on lines with statements.
Local Data Items
C/C++ Function, C++ Member Function, VB Function, VB Method
Number of local data items.
Logical Operators in Conditions
C/C++ Function, C++ Member Function, C++ Class, Java Method, Java Class, Java Interface, Java Package, Java File, Program, PB Method, VB Class, VB Function, VB Method
Number of binary logical operators used in conditions.
Logical Records
IDMS Subschema File
Number of logical records.
Loop Statements
C/C++ Function, C++ Member Function, Java Method, PB Method, Program, VB Function, VB Method
Number of repetitively executing statements.
Macro Assignments
PL/I File, PL/I Include File
Number of assignments to global macro variables outside any macro procedure.
Macro Declarations
PL/I File, PL/I Include File
Number of global macro variables. Macro variables within macro procedures are not counted.
Macro Lines
PL/I File, PL/I Include File
Number of lines for include statements, macro invocations, declarations, macro procedures, and %-statements. Blank lines and comments lines are ignored.
Macro Procedures
PL/I File, PL/I Include File
Number of macro procedures declared in the file.
Macro Statements
PL/I File, PL/I Include File
Number of macro statements.
Maintainability Index
C/C++ Function, C++ Member Function, C++ Class, Java Method, Java Class, Java Interface, Java Package, Java File, Program, PB Method, PB Object, VB Class, VB Function, VB Method
MI = 171 - 5.2 * ln (PgmVolume) - 0.23 * ExtCycComp - 16.2 * ln (LOC) + 50 * sin (sqrt (2.46 * CommentLines/SourceLines)), where PgmVolume is Program Volume, ExtCycComp is Extended Cyclomatic Complexity, LOC is Lines of Code, CommentLines is Comment Lines, and SourceLines is Source Lines.
Maps
Natural Map
Number of maps.
Maximum Depth of Logic Nesting
C/C++ Function, C++ Member Function
Maximum nesting of logic.
Maximum Switch Cases
C/C++ Function, C++ Member Function, Java Method, PB Method
Maximum Switch Cases.
Member Function Calls
C/C++ Function, C++ Member Function
Number of member function calls.
Member Functions
C++ Class
Number of member functions.
Method Calls
VB Function, VB Method
Number of method calls.
Methods
Java Class, Java Interface, Java Package, Java File, PB Object, VB Class
Number of methods.
Nested Block Depth
Java Method, PB Method
Maximum nesting of IF, CHOOSE, TRY, DO, SWITCH, or FOR constructs. 1 is added to the depth in the IF and ELSE parts of IF statements, the bodies of loops, and the code in each case of a Choose statement.
Nesting Level
Program, VB Function, VB Method
Maximum nesting of conditional statements within conditional statements (0 if no conditional statements, 1 if no nesting).
Non-returning Calls
Program
Number of non-returning calls, such as Cobol XCTL statements.
Normalized Distance
Java Package
Perpendicular distance of the package from the idealized line A + I = 1. An indicator of the package’s balance between abstractness and stability.
Number of Comments
C/C++ Function, C++ Member Function, C++ Class, Java Method, Java Class, Java Interface, Java Package, Java File, PB Method, PB Object
For C/C++, number of items containing text preceded by // or enclosed between /* and */.
For Java, number of lines of source containing comments, including inline comments placed on lines with statements.
For PowerBuilder, number of lines of source containing comments only and no code.
Number of Controls
PB DataWindow
Number of controls.
Number of Entries
CSD File, FCT File, PCT File, Valtab File
Number of entries.
Number of Executes
ECL File
Number of executes.
Number of Lines
PB DataWindow, PB Query, PB Pipeline
Number of lines.
Number of PCBs
PSB File
Number of PCBs.
Number of Processor Calls
ECL File
Number of processor calls.
Omit Fields
AS/400 Database File
Number of Omit fields.
Operands
C/C++ Function, C++ Member Function, C++ Class, Java Method, Java Class, Java Interface, Java Package, Java File, Program, PB Method, PB Object, VB Class, VB Function, VB Method
Number of operand occurrences (N2). Operands are variables and literals used in operators. Compare Unique Operands.
Operators
C/C++ Function, C++ Member Function, C++ Class, Java Method, Java Class, Java Interface, Java Package, Java File, Program, PB Method, PB Object, VB Class, VB Function, VB Method
Number of operator occurrences (N1). Operators are executable statements and unary and binary operations. Compare Unique Operators.
Output Fields
Map
Number of output fields.
Overridden Methods
Java Class, Java Interface, Java Package, Java File
Number of overridden methods.
Parameters
C/C++ Function, C++ Member Function, Java Method, PB Method, Program, VB Function, VB Method
Number of Cobol Procedure Division USING...RETURNING parameters. Number of PL/I PROCEDURE parameters. Number of Natural PARAMETER and PARAMETER USING parameters. Otherwise, number of parameters in method calls.
Path Groups
IDMS Subschema File
Number of path groups.
Pointers
C/C++ Function, C++ Member Function, C++ Class, Program, VB Function, VB Method
Number of data elements declared as pointers.
Primary Keys
DDL File
Number of primary keys.
Program Length
C/C++ Function, C++ Member Function, C++ Class, Java Method, Java Class, Java Interface, Java Package, Java File, Program, PB Method, PB Object, VB Class, VB Function, VB Method
N = N1 + N2, where N1 is Operators and N2 is Operands.
Program Level
C/C++ Function, C++ Member Function, C++ Class, Java Method, Java Class, Java Interface, Java Package, Java File, Program, PB Method, PB Object, VB Class, VB Function, VB Method
L = 1 / D, where D is Difficulty.
Program Volume
C/C++ Function, C++ Member Function, C++ Class, Java Method, Java Class, Java Interface, Java Package, Java File, Program, PB Method, PB Object, VB Class, VB Function, VB Method
V = N * log2(n), where N is Program Length and n is Vocabulary. Minimum number of bits required to code the program.
Programming Effort
C/C++ Function, C++ Member Function, C++ Class, Java Method, Java Class, Java Interface, Java Package, Java File, Program, PB Method, PB Object, VB Class, VB Function, VB Method
E = V / L, where V is Program Volume and L is Program Level. Estimated mental effort required to develop the program.
Programming Time
C/C++ Function, C++ Member Function, C++ Class, Java Method, Java Class, Java Interface, Java Package, Java File, Program, PB Method, PB Object, VB Class, VB Function, VB Method
T = E / 18, where E is the Programming Effort and 18 is Stroud’s Number. Estimated amount of time required to implement the algorithm, in seconds.
Public Data Members
C++ Class
Number of public data members.
Public Fields
VB Class
Number of public fields.
Public Member Functions
C++ Class
Number of public member functions.
Public Methods
VB Class
Number of public methods.
Records
ADL File, AS/400 Database File, DMS DDL File, IDMS Schema File, IDMS Subschema File
Number of records.
Remapped Data Sets
DMSII Database
Number of remapped data sets.
Response for Class
C++ Class, Java Class, Java Interface, Java Package, Java File, Program, PB Method, PB Object
Response for class.
Returning Calls
Program
Number of returning calls, such as Cobol CALL or LINK statements.
Screens
AS/400 Device Description, BMS File, DPS File, ICL Form, MFS File
Number of screens.
Segments
DBD File
Number of segments.
SELECT (SWITCH) Statements
VB Method
Number of SWITCH statements.
Select Fields
AS/400 Database File
Number of select fields.
Sets
ADL File, DMS DDL File, DMSII Database, IDMS Schema File, IDMS Subschema File
Number of sets.
Sliceable Dead Lines
PL/I Program
Number of Dead Lines that can be sliced using the Application Architect Dead Code Elimination method. Dead procedures containing either preprocessor statements or statements subject to macro preprocessor replacement are not counted as sliceable dead lines, since it is not always possible to determine whether they can be safely removed. Lines from include files are not counted.
Source Lines
All source files
Number of lines of source.
Specialization Index
Java Class, Java Interface
Number of subclasses divided by number of superclasses.
Static Data Items
C/C++ Function, C++ Member Function, VB Function, VB Method
Number of static data items.
Static Data Members
C++ Class
Number of static data members.
Static Fields
Java Class, Java Interface, Java Package, Java File, PB Object, VB Class
Number of static fields.
Static Functions
C++ Class
Number of static functions.
Static Member Functions
C++ Class
Number of static member functions.
Static Methods
Java Class, Java Interface, Java Package, Java File, VB Class
Number of static methods.
Steps
JCL File, JCL Procedure, Job
Number of steps.
Subsets
DMSII Database
Number of subsets.
Subtypes
Java Class, Java Interface, Java File, PB Object
Number of subtypes.
Switch Cases
C/C++ Function, C++ Member Function, Java Method, PB Method
Number of SWITCH cases.
Switch/Choose Statements
Java Method, PB Method
Number of SWITCH in Java, CHOOSE statements. in PowerBuilders.
SWITCH/SELECT Statements
C/C++ Function, C++ Member Function, VB Function
Number of SWITCH statements.
Tables
DDL File
Number of tables.
Total EXEC Cataloged Procedure Steps
JCL File
Number of EXEC statements invoking cataloged procedures in the job and invoked procedures. If a procedure is invoked multiple times, it is counted each time.
Total Include Copybook Statements
APS File, APS Include
Total number of include copybook statements.
Total Include Statements
Assembler File, BMS File, Cobol File, Copybook File, DMS II DASDL File, ECL File, JCL File, MFS File, Natural File, Natural Subroutine File, PL/I File, PSB File, RPG File, VB Project File, WFL File
Total Include Statements. For PL/I, all the include statements in the file and the used include files.
Unique Function Calls
C/C++ Function, C++ Member Function
Number of unique function calls.
Unique Member Function Calls
C/C++ Function, C++ Member Function
Number of unique member function calls.
Unique Method Calls
Java Method, PB Method, PB Object
Number of distinct method calls.
Unique Operands
C/C++ Function, C++ Member Function, C++ Class, Java Method, Java Class, Java Interface, Java Package, Java File, Program, PB Method, PB Object, VB Class, VB Function, VB Method
Number of distinct operands (n2). Operands are variables and literals used in operators. Uniqueness of literals is determined by their notation. Compare Operands.
Unique Operands in Conditions
C/C++ Function, C++ Member Function, C++ Class, Java Method, Java Class, Java Interface, Java Package, Java File, Program, PB Method, PB Object, VB Class, VB Function, VB Method
Number of distinct operands used in conditions.
Unique Operators
C/C++ Function, C++ Member Function, C++ Class, Java Method, Java Class, Java Interface, Java Package, Java File, Program, PB Method, PB Object, VB Class, VB Function, VB Method
Number of distinct operators (n1). Operators are statements and unary and binary operations. Compare Operators.
Unique System Macro Instructions
Assembler File
Number of unique system macro instructions.
Vocabulary
C/C++ Function, C++ Member Function, C++ Class, Java Method, Java Class, Java Interface, Java Package, Java File, Program, PB Method, PB Object, VB Class, VB Function, VB Method
n = n1 + n2, where n1 is the number of Unique Operators and n2 is the number of Unique Operands.
Weighted Methods
Java Class, Java Interface, Java Package, Java File, PB Object
Number of weighted methods.
Detailed Complexity Metrics for C/C++
Table 1‑9
Detailed Complexity Metrics for C/C++ Function and Member Function
Metric
Statements
Executable Statements
if-then-else
Loop, test at top
Goto
Return
Block (a list of statements)
Loop, test at bottom
For loop
Switch/
Dynamic initialization/
"asm" statement
Try block (C++ only)
Operators
Pointer de-reference (*)
Unary negation "-"
Unary "+"
Logical complement (!)
Type cast
Bitwise complement (~)
Post/Pre increment (++)
Arithmetic operators: +,-,/,*,%
Logical operators: =,!=,>,<,>=,<=,min,max
Assignment
Assign operators +=,-=,*=,/=,%=
Bitwise operators: <<,>>,&, | ,^
Bitwise assign operators: <<=,>>=,&=,|=,^=
C subscripting operation [ ]
Member of a struct or union (.)
Logical operators &&, | |
Conditional expression ("?" operator)
Call
va_start macro reference
va_arg macro reference
va_end macro reference
va_copy macro reference
user-defined operators
Operands
All variables and constants in executable statements
Binary Decisions
for
if
switch (# of case except default)
while
Logical Operators in Conditions
&&, | |,^ in Conditional statements
Maximum depth of Logic Nesting
Maximum nesting of Conditional statements
Local Data Items
Local declarations
GoTo Statements
go to
Computational Statements
Pointer de-reference (*)
Unary negation "-"
Unary "+"
Post/Pre increment (++)
Arithmetic operators: +,-,/,*,%
Logical operators: =,!=,>,<,>=,<=,min,max
Assign operators +=,-=,*=,/=,%=
Loop Statements
for
while
IF Statements
if-then-else
SWITCH/SELECT Statements
switch
Exception Handling Statements
try ... catch
Static Data Items
Static declarations


Level 2 Modeling Support for C/C++

C/C++ Support Guide : Modeling Support in MW : Level 2 Modeling Support for C/C++
Level 2 Modeling Support for C/C++
The Level 2 model for an object defines its syntax. It shows in abstract form how the syntactical constructs that comprise the object (constants, expressions, variables, declarations, and so forth) are related.


Level 2 Metamodel

C/C++ Support Guide : Modeling Support in MW : Level 2 Modeling Support for C/C++ : Level 2 Metamodel
Level 2 Metamodel
Each construct the parser generates is an instance of an entity type. The Level 2 metamodel defines these types, or meta-entities, and their relationships. Figure 1‑2 shows the Level 2 metamodel.
Note:
The Level 2 metamodel is also referred to, in OMG terms, as the Abstract Syntax Tree Metamodel (ASTM).
Figure 1‑2
Level 2 Metamodel
Click image to expand


Level 2 Model Table

C/C++ Support Guide : Modeling Support in MW : Level 2 Modeling Support for C/C++ : Level 2 Model Table
Level 2 Model Table
Table 1‑10 describes the relationships for constructs in the Level 2 metamodel. A construct that “inherits from” other constructs can be thought of in “child/parent” terms. The child construct inherits all attribute values and relationships of the parent.
Table 1‑10
Leve 2 Model Table
Construct
Relationships
Assignment
Source: source
Destination: destination
Inherits from Statement
Block
Declarations: declarations
Inherits from Container
Inherits from Statement
Call
Procedure: function that is called
Actual Parameters: parameters of the call
Inherits from Dataport
Inherits from Expression
Inherits from Statement
Case Branch
Case Values: case values
Inherits from Case or Default Branch
Inherits from Statement
Inherits from Container
Case or Default Branch
Switch: Switch statement
Inherits from Statement
Inherits from Container
Cast
N/A
Class Declaration
Inherits from Type Definition
Conditional Statement
Expression: controlling expression
Inherits from Statement
Constant
Case Branch: case branch
Inherits from Expression
Inherits from Statement
Container
First: first condition
Inherits from Statement
Data Member Declaration
Inherits from Declaration
Dataport
Transfers: data
Declaration
Type: type of a declaration.
Instances: usages of the declared identifier
Block: block
Default Branch
Inherits from Case or Default Branch
Inherits from Statement
Inherits from Container
Expression
Assign: assignment
Call: call
Slice: slice
Select: select
FOR Statement: FOR Statement
Controlled Statement: controlled statement
DataPort: dataport
Controls: controlling variables
Inherits from Statement
Field
Type: type of the fields
Select: select
Inherits from Expression
Inherits from Statement
Inherits from Constant
Inherits from Variable
FOR Statement
Initial expression: initial expression.
Check expression: check expression.
Increment expression: increment expression.
Inherits from Statement
Function Member Declaration
Inherits from Declaration
Function Variable
Inherits from Variable
Inherits from Constant
Inherits from Expression
Inherits from Statement
IF Statement
Then Branch: Then branch
Else Branch: Else branch
Inherits from Conditional Statement
Inherits from Statement
GoTo
GO TO Destination Label: name of the label
Inherits from Statement
Label
GO TO Statements: Go To statements that transfer control to the label
Inherits from Statement
Return Statement
Inherits from Statement
Select
Structure: structure
Fields: field
Inherits from Expression
Inherits from Statement
Sequence
N/A
Slice
Array: array that is sliced
Indexes: indexes of a slice
Inherits from Expression
Inherits from Statement
Source
Inherits from Block
Inherits from Statement
Inherits from Container
Statement
Next: next condition
Previous: previous condition
Master Statement: master statement
IF Statement From Then: IF Statement From Then branch
IF Statement From Else: IF statement from Else branch
Switch Statement
Case: Case/Default branches
Inherits from Statement
Inherits from Conditional Statement
Type Definition
Declarations: declaration of the type
Is Used: is used as...
Type Reference
Defined: defined as...
Fields: fields declared
Inherits from Type Definition
Variable
Declaration: declaration of the identifier
Condition: controlled condition
Inherits from Constant
Inherits from Expression
Inherits from Statement
WHILE Statement
Inherits from Statement
Inherits from Container


Construct Attributes

C/C++ Support Guide : Modeling Support in MW : Level 2 Modeling Support for C/C++ : Construct Attributes
Construct Attributes
Table 1‑11 describes the attributes of constructs in the C/C++ level 2 model.
Table 1‑11
Table of Attributes for C/C++
Attribute
Construct(s)
Attribute Description
Access
Data Member Declaration
Enum: possible values include:
Public
Protected
Private
Unknown
Kind
All constructs except:
Sequence
Type Definition
Class Declaration
Type Reference
Declaration
Data Member Declaration
Function Member Declaration
Dataport
Cast
String: kind of the construct
Label
GoTo
Label
String: name of the label
Name
Type Definition
Class Declaration
Type Reference
Declaration
Data Member Declaration
Function Member Declaration
Variable
Function Variable
Field
Source
String: name of the construct
Type
All constructs except:
Sequence
Type Definition
Class Declaration
Dataport
Cast
String: type of the construct
TypeKind
Type Definition
Class Declaration
Type Reference
Enum: kind of the type
Possible values include:
Simple
Pointer
Enum
Ref
Struct
Union
Class
Function
Array
Nothing
Undefined
Value
Type Definition
Class Declaration
Type Reference
Constant
Variable
Function Variable
Field
String: value of the construct


Asset Transformation Workbench Analyzer for Eclipse

Corporate Headquarters
International Business Machines Corporation
New Orchard Road
Armonk, New York 10504
Tel +1 (914) 499-1900

www.ibm.com

© 2006 International Business Machines Corporation
All rights reserved.
This document applies to IBM Asset Transformation Workbench (product number 5724-R03) and to all subsequent releases and modifications. For the latest information about this product, please refer to the Release Notes.
No part of this document may be reproduced or transmitted in any form or by any means, electronic or mechanical, for any purpose, without the express written permission of IBM. Information in this document is subject to change without notice and is not guaranteed to be error-free.
Licensed Materials - Property of IBM.
Product Reference: IBM Asset Transformation Workbench v2.1
Document Reference: REL7.3DOC13.A

RescueWare is a registered trademark of Relativity Technologies, Inc. All other brands mentioned in this document are trademarks or registered trademarks of their respective holders.

www.relativity.com


Relativity Modernization Workbench Copyright Page

Corporate Headquarters
Relativity Technologies
2300 Rexwoods Drive
Suite 100
Raleigh, NC 27607
Tel +1 (919) 786-2800
Fax +1 (919) 786-2850

www.relativity.com

© 2005-07 Relativity Technologies
All rights reserved.
Printed in the United States of America.

RescueWare is a registered trademark of Relativity Technologies, Inc. All other brands mentioned in this document are trademarks or registered trademarks of their respective holders.

The software supplied with this document is the property of Relativity Technologies and is furnished under a license agreement. No part of this document may be reproduced or transmitted in any form or by any means, electronic or mechanical, for any purpose, without the express written permission of Relativity Technologies, Inc. Information in this document is subject to change without notice and is not guaranteed to be error-free.

For the latest information about this product, please refer to the Release Notes.


C_CPP.1.11.1.html

C/C++ Support Guide : Modeling Support in MW : Level 1 Modeling Support for C/C++ : Level 1 Metamodel


C_CPP.1.16.1.html

C/C++ Support Guide : Modeling Support in MW : Level 2 Modeling Support for C/C++ : Level 2 Metamodel


Relativity Modernization Workbench Copyright Page

Corporate Headquarters
Relativity Technologies
2300 Rexwoods Drive
Suite 100
Raleigh, NC 27607
Tel +1 (919) 786-2800
Fax +1 (919) 786-2850

www.relativity.com

© 2005-06 Relativity Technologies
All rights reserved.
Printed in the United States of America.

RescueWare is a registered trademark of Relativity Technologies, Inc. All other brands mentioned in this document are trademarks or registered trademarks of their respective holders.

The software supplied with this document is the property of Relativity Technologies and is furnished under a license agreement. No part of this document may be reproduced or transmitted in any form or by any means, electronic or mechanical, for any purpose, without the express written permission of Relativity Technologies, Inc. Information in this document is subject to change without notice and is not guaranteed to be error-free.

For the latest information about this product, please refer to the Release Notes.


C_CPP-1004259.html

The Level 1 model for an application defines the relationships between the objects that comprise the application. These can be physical objects, like program source files or header files, or logical objects that identify abstract program elements (classes, functions, and the like).


C_CPP-1004302.html

The Level 2 model for an object defines its syntax. It shows in abstract form how the syntactical constructs that comprise the object (constants, expressions, variables, declarations, and so forth) are related.