SCA works with many languages. See the subtopics in this section for information about getting started with a specific language.
1 – Using Ada
This section contains some basic examples that show what SCA can do to help you with your programs. The examples have very little explanation. For a more detailed explanation of the underlying concepts, see the Basic_Query_Concepts help topic. The remainder of this section is written in terms that are specific to Ada programs. If you want to follow along and try the examples, you will need to have an SCA library available. If you do not know how to create an SCA library, read the Building_An_SCA_Library help topic. The examples use generic variable names (such as 'i'). You will have to substitute variable names that exist in your code when trying the examples. The first example is the easiest query: It lets you find all the items in your SCA library named 'i', and shows you all the places where they appear (all occurrences of 'i'). FIND i You can search for any name in this manner, including using wildcard characters (for example, FIND i*). Suppose you are looking for an occurrence, and you know that it occurs in a particular file. The following query finds all occurrences of items that are named 'i' but will then limit them to those which happen to occur in the file named PROG.ADA. FIND i AND FILE_SPEC="PROG.ADA" Another typical question one might ask is, "Find all the places where this item is assigned to (or read from, called, declared, and so forth)." The next example finds all occurrences of items that are named 'i', but then limits them to only those occurrences where 'i' is assigned a value: FIND i AND OCCURRENCE=WRITE (SCA understands many occurrence classes other then WRITE. See the help subtopics under Getting_Started for tables containing all the SCA attributes and their corresponding meanings in Ada.) Often, you only want to know where (in what file or package) a particular function is, so that you can go to it and edit it. You can use the first query (where 'i' will be the name of the function) and then look through the output. The output will include all occurrences of the function, one of which would be its declaration, which you can then select. Or, you can ask SCA to limit the search for you by typing the following query: FIND i AND OCCURRENCE=PRIMARY In SCA terms, a primary declaration is the most significant declaration of an item. For an Ada function, this means the body of the function, or package, or generic, and so forth. This is in contrast to the specification, which is considered an associated declaration. Another problem you might have is that there are many different items in your system having a given name. Some may be variables; others may be functions, constants, tasks, and so forth. Suppose you want to find only the functions named i. Again, the query FIND i will give you what you want, but it will also give you much more. It is preferable to issue the following query: FIND i AND SYMBOL_CLASS=FUNCTION The previous four examples have selected information based on two attributes. The last example selected information based on a name attribute (in this case, i) and a symbol class attribute (in this case, FUNCTION). Note how the attributes are combined using the boolean operator AND. In general, you can select items out of your library based on any combination of attributes, using AND as well as the other logical operators OR, XOR, and NOT. The next example shows another primary feature of SCA - the ability to display relationships between items. This example shows the most common use of this feature. It finds the complete call tree (that is, all functions called directly and indirectly) of the function named i. FIND CALLED_BY (i, DEPTH=ALL) If you want to limit the depth of the call tree, replace the keyword ALL by any positive integer. The final part of this section describes how to go directly to the source code once you have issued a query. After issuing the query FIND i, for example, you can have an LSE query buffer containing something that looks like the following: I variable ADA_MODULE\60 object declaration ADA_MODULE\75 write reference ADA_MODULE\79 read reference ADA_MODULE\122 read reference ADA_MODULE\144 write reference ADA_MODULE\146 read, write reference ADA_MODULE\149 write reference ADA_MODULE\149 read reference ADA_MODULE\150 reference ADA_MODULE\166 read reference The first two lines of this display will be highlighted. The first line represents the item you looked for (i), and the rest of the lines represent the different places in the code where this item occurred (that is, the occurrences of i). By using the up and down arrows on your keyboard, or by clicking on an occurrence with your mouse, you can choose the occurrence you want to see. Then, all you have to do is type CTRL/G (the keyboard equivalent of the GOTO SOURCE command) and LSE will bring the source file into a buffer and position you at the occurrence you chose. To obtain help on the following topics, request help as indicated. o For help on query language, see the Basic_Query_Concepts help topic. o For help on libraries, see the Building_An_SCA_Library help topic.
2 – Ada Attributes Table
The following table lists the SCA symbol classes and their corresponding meanings in Ada. SCA Symbol Classes and Equivalent Ada Language Terminology SCA Term Ada Term Explanation Argument Formal A subprogram formal parameter parameter Component, Component Record components and discriminants Field Constant, Constant Literal Exception Exception File File A file used during compilation Function, All Procedure, subprograms, Program, entries, Routine, and ACCEPT Subroutine statements Generic Generic Generic subprograms or generic packages Keyword Keyword PDF keyword tag Label Labels and loop identifiers Macro N/A Module, Packages Package Placeholder Placeholder LSE placeholder Psect N/A Tag Tag PDF tag Task Task Task objects Type Type Unbound Unbound Pragmas and attributes Variable Object The following table lists the SCA occurrence classes and their corresponding meanings in Ada. SCA Occurrence Classes and Equivalent Ada Language Terminology SCA Term Ada Term Explanation Primary Body For example, package body Associated Specification For example, package specification Declaration Declaration Any declaration, either primary or associated Reference Reference Any nondeclaration Read, Fetch Read Write, Store Write Address, N/A Pointer Call Call Command_line Command line A file referred to on the command line; for example, ADA foo.ada Include N/A Precompiled N/A Separate Separate Any Ada package or sub-program unit defined as SEPARATE With With Any WITH of an Ada package or sub-program unit Explicit Explicit An entity that is explicitly declared. For example, declarations resulting from generic instantiations. Implicit Implicit Any symbol declared by the compiler, for example a loop name Visible Visible A symbol whose name is visible in the source Hidden Hidden A symbol whose name is not visible in the source; for example, anonymous types Compilation_ Compilation Subprogram declaration or body, unit unit package declaration or body, and so forth Limited Limited Any Ada limited private type Private Private Any Ada private type The following table lists the SCA domain classes and their corresponding meanings in ADA. SCA Domain Classes and Equivalent Ada Language Terminology SCA Term Ada Term Explanation Inheritable Objects declared in a package specification Global N/A Predefined N/A Multi_module Inheritable, Global and Predefined Module_ Module Objects known to only one module specific specific
3 – Using BASIC
This section contains some typical examples that illustrate what SCA can do to help you with your programs. The examples have very little explanation. If you want a more detailed explanation of the underlying concepts, see the Basic_Query_Concepts help topic. The remainder of this section is written in terms that are specific to BASIC programs. If you want to follow along and try the examples, you will need to have an SCA library available. If you do not know how to create an SCA library, read the Building_An_SCA_Library help topic. The examples use generic variable names (such as i). You will have to substitute variable names that actually exist in your code when trying the examples. The first example is the easiest query of all: It lets you find all the items in your SCA library named i, and shows you all the places where they appear (all occurrences of i). FIND i You can search for any name in this manner, including using wildcard characters (for example, FIND i*). Now let's say you are looking for an occurrence, and you know that it occurs in a particular file. The following query finds all occurrences of items that are named i but will then limit them to those which happen to occur in the file named 'PROG.BAS'. FIND i AND FILE_SPEC="PROG.BAS" Another typical question one might ask is "Find all the places where this item is assigned to (or read from, called, declared, and so forth)." The next example finds all occurrences of items that are named i, but then limits them to only those occurrences where i is assigned a value. FIND i AND OCCURRENCE=WRITE (SCA understands many occurrence classes other then WRITE. See the help subtopics under Getting_Started for tables containing all the SCA attributes and their corresponding meanings in BASIC.) Often, you only want to know where (in what file or module) a particular function is, so that you can go to it and edit it. You could use the first query (where i would be the name of the function) and then look through the output. The output would include all occurrences of the function, one of which would be its definition, which you could then select. Or, you could ask SCA to limit the search for you by typing the following query: FIND i AND OCCURRENCE=PRIMARY In SCA terms, a primary declaration is the most significant declaration of an item. For a BASIC function, this means the actual location of the function body. This is as opposed to an associated declaration, examples of which are EXTERNAL declarations, and DECLARE FUNCTION declarations. Another problem you might have is that there are many different items in your system having a given name. Some may be variables; others may be functions, constants, labels, and so forth. Suppose you want to find only the functions named i. Again, the query FIND i would give you what you wanted, but it would also give you much more. It is preferable to issue the following query: FIND i AND SYMBOL_CLASS=FUNCTION The last four examples have all selected information based on two attributes. The last example selected information based on a name attribute (in this case, i) and a symbol class attribute (in this case, FUNCTION). Note how the attributes are combined using the boolean operator AND. In general, you can select items out of your library based on any combination of attributes, using AND as well as the other logical operators OR, XOR and NOT. The next example shows another primary feature of SCA - the ability to display relationships between items. The example given here shows the most common use of this feature. It finds the complete call tree (that is, all functions called directly and indirectly), of the function named i. FIND CALLED_BY (I, DEPTH=ALL) If you want to limit the depth of the call tree, you can replace the keyword ALL by any positive integer. The final part of this section describes how to go directly to the source code once you have issued a query. After issuing the query FIND i, for example, you could have an LSE query buffer containing something that looks like the following: I variable BASIC_MODULE\60 variable declaration BASIC_MODULE\75 write reference BASIC_MODULE\79 read reference BASIC_MODULE\95 address reference BASIC_MODULE\122 read reference BASIC_MODULE\144 write reference BASIC_MODULE\146 read reference BASIC_MODULE\149 write reference BASIC_MODULE\149 read reference BASIC_MODULE\150 address reference BASIC_MODULE\166 read reference The first two lines of this display will be highlighted. The first line represents the item you looked for (I), and the rest of the lines represent the different places in the code where this item occurred (that is, the occurrences of I). By using the up and down arrows on your keyboard, or by clicking on an occurrence with your mouse, you can choose the occurrence you want to see. Then type CTRL/G (the keyboard equivalent of the GOTO SOURCE command), and LSE will bring the source file into a buffer and position you at the occurrence you chose. To obtain help on the following topics, request help as indicated. o For help on query language, see the Basic_Query_Concepts help topic. o For help on libraries, see the Building_An_SCA_Library help topic.
4 – BASIC Attributes Table
The following table lists the SCA symbol classes and their corresponding meanings in BASIC. SCA Symbol Classes and Equivalent BASIC Language Terminology SCA Term BASIC Term Explanation Argument Parameter Subprogram formal parameter Component, Record Field component Constant, Constant Literal Exception N/A File File A file used during a compilation Function, Program or For example, PROGRAM, SUB, FUNCTION, Procedure, subprogram DEF, PICTURE Program, Routine, Subroutine Generic N/A Keyword Keyword A PDF keyword Label Label A line number or statement label Macro N/A Module, N/A Package Placeholder Placeholder LSE placeholder Psect Psect MAP or COMMON block Tag Tag PDF tag Task N/A Type Type For example, word, double, decimal, and so forth Unbound N/A Variable Variable The following table lists the SCA occurrence classes and their corresponding meanings in BASIC. SCA Occurrence Classes and Equivalent BASIC Language Terminology SCA Term BASIC Term Explanation Primary Declaration For variables, where they are declared with, for example, DECLARE or MAP statements. For subprograms, where they are defined, that is, where the body of the subprogram is. Associated Declaration EXTERNAL declarations or DECLARE FUNCTION statements Declaration Declaration Either a PRIMARY or ASSOCIATED declaration Read, Fetch Read Write, Store Write Address, Address Actual parameter to LOC function Pointer reference Call Call Command_line Command line A file specified on the command line; For example, BASIC foo.bas Include Include A file specified in a %INCLUDE directive Precompiled N/A Reference Reference Any nondeclaration Explicit Explicit Any symbol declared by the user Implicit Implicit Any symbol declared by the compiler when it sees the first reference Visible Visible A symbol whose name is visible in the source Hidden Hidden A symbol not visible in the source; for example, function return values, implicit declarations Compilation_ For example, a PROGRAM, SUB, or unit FUNCTION The following table lists the SCA domain classes and their corresponding meanings in BASIC. SCA Domain Classes and Equivalent BASIC Language Terminology SCA Term BASIC Term Explanation Inheritable N/A Global Available across modules; for example, through EXTERNAL declarations Predefined Predefined Defined by the language; for example, DECIMAL, PI, CHR$, and so forth Multi_module Predefined, global, and inheritable Module_ Visible only within one module; for specific example, variables
5 – Using BLISS
This section contains some basic examples that show what SCA can do to help you with your programs. The examples have very little explanation. For a more detailed explanation of the underlying concepts, see the Basic_Query_Concepts help topic. The remainder of this section is written in terms that are specific to BLISS programs. If you want to follow along and try the examples, you will need to have an SCA library available. If you do not know how to create an SCA library, read the Building_An_SCA_Library help topic. The examples use generic variable names (such as i). You will have to substitute variable names that actually exist in your code when trying the examples. The first example is the easiest query. It lets you find all the items in your SCA library named i, and shows you all the places where they appear (all occurrences of i): FIND i You can search for any name in this manner, including using wildcard characters (for example, FIND i*). Now suppose you are looking for an occurrence, and you know that it occurs in a particular file. The following query finds all occurrences of items that are named i, but will then limit them to those that happen to occur in the file named PROG.B32. FIND i AND FILE_SPEC="PROG.B32" Another typical question you might ask is, "Find all the places where this item is assigned to (or read from, called, declared and so forth)." The next example finds all occurrences of items that are named i, but then limits them to only those occurrences where i is assigned a value: FIND i AND OCCURRENCE=WRITE (SCA understands many occurrence classes other then WRITE. See the help subtopics under Getting_Started for tables containing all the SCA attributes and their corresponding meanings in BLISS.) Often, you only want to know where (in what file or module) a particular routine is, so that you can go to it and edit it. You can use the first query (where i will be the name of the routine) and then look through the output. The output will include all occurrences of the routine, one of which will be its declaration, which you can then select. Or, you can ask SCA to limit the search for you by typing the following query: FIND i AND OCCURRENCE=PRIMARY In SCA terms, a primary declaration is the most significant declaration of an item. For a BLISS routine, this means the place where the routine is actually implemented. This is in contrast to FORWARD or EXTERNAL declarations, which are associated declarations. Another problem you might have is that there are many different items in your system having a given name. Some may be variables; others may be routines, literals, macros, and so forth. Suppose you want to find only the routines named i. Again, the query FIND i will give you what you wanted, but it will also give you much more. It is preferable to issue the following query: FIND i AND SYMBOL_CLASS=ROUTINE The last four examples have all selected information based on two attributes. The last example selected information based on a name attribute (in this case, i) and a symbol_class attribute (in this case, ROUTINE). Note how the attributes are combined using the boolean operator AND. In general, you can select items out of your library based on any combination of attributes, using AND as well as the other logical operators OR, XOR, and NOT. The next example shows another primary feature of SCA - the ability to display relationships between items. This example shows the most common use of this feature. It finds the complete call tree (that is, all routines called directly and indirectly) of the routine named i. FIND CALLED_BY (i, DEPTH=ALL) If you want to limit the depth of the call tree, replace the keyword ALL by any positive integer. The final part of this section describes how to go directly to the source code once you have issued a query. After issuing the query FIND i, for example, you can have an LSE query buffer containing something that looks like the following: I variable BLISS_MODULE\60 LOCAL declaration BLISS_MODULE\75 write reference BLISS_MODULE\79 read reference BLISS_MODULE\122 read reference BLISS_MODULE\144 write reference BLISS_MODULE\146 read reference BLISS_MODULE\149 write reference BLISS_MODULE\149 read reference BLISS_MODULE\150 read reference BLISS_MODULE\166 read reference The first two lines of this display will be highlighted. The first line represents the item you looked for (i), and the rest of the lines represent the different places in the code where this item occurred (that is, the occurrences of i). By using the up and down arrows on your keyboard, or by clicking on an occurrence with your mouse, you can choose the occurrence you want to see. Then, type CTRL/G (the keyboard equivalent of the GOTO SOURCE command) and LSE will bring the source file into a buffer and position you at the occurrence you chose. To obtain help on the following topics, request help as indicated. o For help on query language, see the Basic_Query_Concepts help topic. o For help on libraries, see the Building_An_SCA_Library help topic.
6 – BLISS Attributes Table
The following table lists the SCA symbol classes and their corresponding meanings in BLISS. SCA Symbol Classes and Equivalent BLISS Language Terminology SCA Term BLISS Term Explanation Argument Parameter Routine formal parameter Component, Field Subpart of a BLOCK or BLOCKVECTOR Field structure Constant, Literal A literal Literal Exception N/A File file A file used during compilation Function, routine A routine Procedure, Program, Routine, Subroutine Generic N/A Keyword Keyword PDF keyword tag Label Label A label identifier Macro Macro A macro Module, Module A compilation unit Package Placeholder Placeholder An LSE placeholder Psect Psect A psect Tag Tag A PDF tag Task N/A Type Type For example, fieldset Unbound Unbound A name the compiler does not know the purpose of. This is common when macros are used. Variable Variable A program variable The following table lists the SCA occurrence classes and their corresponding meanings in BLISS. SCA Occurrence Classes and Equivalent BLISS Language Terminology SCA Term BLISS Term Explanation Primary Declaration The declaration containing the actual implementation Associated Declaration A FORWARD or EXTERNAL declaration Declaration Declaration Either a PRIMARY or ASSOCIATED declaration Read, Fetch Fetch Write, Store Store Address, Address Pointer Call call Command_line Input file A file specified on the command specification line; for example, BLISS foo.b32 Include Require A file specified in a REQUIRE or %REQUIRE statement Precompiled Library A file specified in a LIBRARY statement Reference Reference Any nondeclaration Explicit Explicit Any symbol declared by the user Implicit Implicit Any symbol declared by the compiler; for example, a loop variable Visible Visible A symbol whose name is visible in the source Hidden Hidden A symbol whose name is not visible in the source; for example, contained inside a macro Compilation_ Module A module unit declaration The following table lists the SCA domain classes and their corresponding meanings in BLISS. SCA Domain Classes and Equivalent BLISS Language Terminology SCA Term BLISS Term Explanation Inheritable Inheritable A symbol declared in a library file, and used elsewhere Global GLOBAL Predefined Defined by For example, CH$FILL, BLOCKVECTOR, the language and so forth Multi_module GLOBAL, Predefined, or Inheritable Module_ LOCAL or OWN specific
7 – Using C
This section contains some basic examples that illustrate what SCA can do to help you with your programs. The examples have very little explanation. If you want a more detailed explanation of the underlying concepts, see the Basic_Query_Concepts help topic. The remainder of this section is written in terms that are specific to C programs. If you want to follow along and try the examples, you will need to have an SCA library available. If you do not know how to create an SCA library, read the Building_An_SCA_Library help topic. The examples use generic variable names (such as i). You will have to substitute variable names that actually exist in your code when trying the examples. The first example is the easiest query: It lets you find all the items in your SCA library named i, and shows you all the places where they appear (all occurrences of i). FIND i You can search for any name in this manner, including using wildcard characters (for example, FIND i*). Now let's say you are looking for an occurrence, and you know that it occurs in a particular file. The following query finds all occurrences of items that are named i but will then limit them to those which happen to occur in the file named 'PROG.C'. FIND i AND FILE_SPEC="PROG.C" Another typical question one might ask is "Find all the places where this item is assigned to (or read from, called, declared,and so forth)." The next example finds all occurrences of items that are named i, but then limits them to only those occurrences where i is assigned a value. FIND i AND OCCURRENCE=WRITE (SCA understands many occurrence classes other then WRITE. See the help subtopics under Getting_Started for tables containing all the SCA attributes and their corresponding meanings in C.) Often, you only want to know where (in what file or module) a particular function is, so that you can go to it and edit it. You could use the first query (where i would be the name of the function) and then look through the output. The output would include all occurrences of the function, one of which would be its definition, which you could then select. Or, you could ask SCA to limit the search for you by typing the following query: FIND i AND OCCURRENCE=PRIMARY In SCA terms, a primary declaration is the most significant declaration of an item. For a C function, this means the function definition. This is in contrast to a C function declaration (for example, extern i()), which in SCA terms is an associated declaration. Another problem you might have is that there are many different items in your system having a given name. Some may be variables; others may be functions, #define constants, macros, and so forth. Suppose you want to find only the functions named i. Again, the query FIND i would give you what you wanted, but it would also give you much more. It is preferable to issue the following query: FIND i AND SYMBOL_CLASS=FUNCTION The last four examples have all selected information based on two attributes. The last example selected information based on a name attribute (in this case, i) and a symbol class attribute (in this case, FUNCTION). Note how the attributes are combined using the boolean operator AND. In general, you can select items out of your library based on any combination of attributes, using AND as well as the other logical operators OR, XOR and NOT. The next example shows another primary feature of SCA - the ability to display relationships between items. The example given here shows the most common use of this feature. It finds the complete call tree (that is, all functions called directly and indirectly), of the function named i. FIND CALLED_BY (i, DEPTH=ALL) If you want to limit the depth of the call tree, you can replace the keyword ALL by any positive integer. The final part of this section describes how to go directly to the source code once you have issued a query. After issuing the query FIND i, for example, you can have an LSE query buffer containing something that looks like the following: i variable C_MODULE\60 variable definition declaration C_MODULE\75 write reference C_MODULE\79 read reference C_MODULE\95 read, write reference C_MODULE\122 read reference C_MODULE\144 write reference C_MODULE\146 read reference C_MODULE\149 write reference C_MODULE\149 read reference C_MODULE\150 read reference C_MODULE\166 read reference The first two lines of this display will be highlighted. The first line represents the item you looked for (i), and the rest of the lines represent the different places in the code where this item occurred (that is, the occurrences of i). By using the up and down arrows on your keyboard, or by clicking on an occurrence with your mouse, you can choose the occurrence you want to see. Then all you have to do is type CTRL/G (the keyboard equivalent of the GOTO SOURCE command), and LSE will bring the source file into a buffer and position you at the occurrence you chose. To obtain help on the following topics, request help as indicated. o For help on query language, see the Basic_Query_Concepts help topic. o For help on libraries, see the Building_An_SCA_Library help topic.
8 – C Attributes Table
The following table lists the SCA symbol classes and their corresponding meanings in C. SCA Symbol Classes and Equivalent C Language Terminology SCA Term C Term Explanation Argument Formal The variable named in a function Parameter definition Component, Member A member of a structure or union Field Constant, Constant A defined value that does not change Literal Exception N/A File File A file used during compilation Function, Function Any function ( such as 'main' ) Procedure, Program, Routine, Subroutine Generic N/A Keyword Keyword PDF keyword tag Label Label A label identifier Macro Macro A Macro created by #define Module, Module Each .c source file represents a Package module Placeholder Placeholder An LSE placeholder Psect N/A Tag Tag A PDF tag Task N/A Type Type int, float, struct {...}, typedef, and so forth Unbound N/A Variable Variable Program variable The following table lists the SCA occurrence classes and their corresponding meanings in C. SCA Occurrence Classes and Equivalent C Language Terminology SCA Term C Term Explanation Primary Declaration Most significant declaration; for or definition example, a variable declaration, or a function definition Associated Declaration Other declarations; for example, function declarations or EXTERN declarations Declaration Definition or Any declaration, either primary or Declaration associated Read, Fetch Read The act of retrieving an Rvalue Write, Store Write Changing the contents of an Lvalue Address, Address The use of the & operator Pointer Call Call A function call Command_line Command_line A file specified on the command line, for example, CC foo.c Include Include A file specified in a #include preprocessor directive Precompiled N/A Reference Reference Any nondeclaration Explicit Explicit An entity that is explicitly declared Implicit Implicit An entity that is implicitly declared by the compiler; for example, a function with no type is implicitly declared as INT Visible Visible Occurrence appears in source Hidden Hidden Occurrence does not appear in source; for example, it appears only in the expansion of a macro Compilation_ Module A module unit The following table lists the SCA domain classes and their corresponding meanings in C. SCA Domain Classes and Equivalent C Language Terminology SCA Term C Term Explanation Inheritable N/A Global Globally For example, extern, globaldef, visible globalref, globalvalue Predefined Defined by For example, int, float, char the language Multi_module Predefined and global Module_ Local to one For example, static, auto, register specific module
9 – Using C++
This section contains some basic examples that illustrate what SCA can do to help you with your programs. The examples have very little explanation. If you want a more detailed explanation of the underlying concepts, see the Basic_Query_Concepts help topic. The remainder of this section is written in terms that are specific to C++ programs. If you want to follow along and try the examples, you will need to have an SCA library available. The examples use generic variable names (such as 'i'). You will have to substitute variable names that exist in your code when trying the examples. The first example is the easiest query: It lets you find all the items in your SCA library named i, and shows you all the places where they appear (all occurrences of i). FIND i You can search for any name in this manner, including using wildcard characters (for example, FIND i*). Now let's say you are looking for an occurrence, and you know that it occurs in a particular file. The following query finds all occurrences of items that are named i but will then limit them to those which happen to occur in the file named 'PROG.CXX'. FIND i AND FILE_SPEC="PROG.CXX" Another typical question one might ask is "Find all the places where this item is assigned to (or read from, called, declared,and so forth)." The next example finds all occurrences of items that are named i, but then limits them to only those occurrences where i is assigned a value. FIND i AND OCCURRENCE=WRITE (SCA understands many occurrence classes other then WRITE. See the help subtopics under Getting_Started for tables containing all the SCA attributes and their corresponding meanings in C++.) Often, you only want to know where (in what file or module) a particular function is, so that you can go to it and edit it. You could use the first query (where i would be the name of the function) and then look through the output. The output would include all occurrences of the function, one of which would be its definition, which you could then select. Or, you could ask SCA to limit the search for you by typing the following query: FIND i AND OCCURRENCE=PRIMARY In SCA terms, a primary declaration is the most significant declaration of an item. For a C++ function, this means the function definition. This is in contrast to a C++ function declaration (for example, extern i()), which in SCA terms is an associated declaration. Another problem you might have is that there are many different items in your system having a given name. Some may be variables; others may be functions, #define constants, macros, and so forth. Suppose you want to find only the functions named i. Again, the query FIND i would give you what you wanted, but it would also give you much more. It is preferable to issue the following query: FIND i AND SYMBOL_CLASS=FUNCTION The last four examples have all selected information based on two attributes. The last example selected information based on a name attribute (in this case, i) and a symbol class attribute (in this case, FUNCTION). Note how the attributes are combined using the boolean operator AND. In general, you can select items out of your library based on any combination of attributes, using AND as well as the other logical operators OR, XOR and NOT. The next example shows another primary feature of SCA - the ability to display relationships between items. The example given here shows the most common use of this feature. It finds the complete call tree (that is, all functions called directly and indirectly), of the function named i. FIND CALLED_BY (i, DEPTH=ALL) If you want to limit the depth of the call tree, you can replace the keyword ALL by any positive integer. To obtain help on the following topics, request help as indicated. o For help on query language, see the Basic_Query_Concepts help topic. o For help on libraries, see the Building_An_SCA_Library help topic.
10 – C++ Attributes Table
The following table lists the SCA symbol classes and their corresponding meanings in C++. SCA Symbol Classes and Equivalent C++ Language Terminology SCA Term C++ Term Explanation Argument Formal Formal arguement such as a routine Parameter or macro argument Class Class Any C++ class object defined by class, structure or union Component, Class, structure A component of a class, structure Field or union member or union Constant, Constant Named compile-time constants Literal Exception Exception A program exception specified by the catch, throw and try statements File File A file used during compilation Function, Function Callable routines defined by function Procedure, statements Program, Routine, Subroutine Generic Template Generic object defined by template objects Keyword Keyword PDF keyword tag Label Function Label User-specified label Macro Macro A Macro created by #define Module, Module Any logical program unit typically Package each .cxx source file represents a module Placeholder Placeholder An LSE placeholder Psect N/A Tag Tag A PDF tag Task N/A Type Type int, float, struct {...}, typedef, and so forth Unbound N/A Variable Variable Program variable The following table lists the SCA occurrence classes and their corresponding meanings in C++. SCA Occurrence Classes and Equivalent C++ Language Terminology SCA Term C++ Term Explanation Primary Declaration Most significant declaration; for or definition example, a variable declaration, or a function definition Associated Declaration Other declarations; for example, function declarations or EXTERN declarations Declaration Definition or Any declaration, either primary or Declaration associated Read, Fetch Read The act of retrieving an Rvalue Write, Store Write Changing the contents of an Lvalue Address, Address The use of the & operator Pointer Call Call A function call Command_line Command_line A file specified on the command line, for example, Cxx foo.c Include Include A file specified in a #include preprocessor directive Precompiled N/A Base Base Any base class of a class Friend Friend Any friend of a class Member Member Any member of a class Reference Reference Any nondeclaration Explicit Explicit An entity that is explicitly declared Implicit Implicit An entity that is implicitly declared by the compiler; for example, a function with no type is implicitly declared as INT Visible Visible Occurrence appears in source Hidden Hidden Occurrence does not appear in source; for example, it appears only in the expansion of a macro Compilation_ Module A module unit Private Private Any private object Protected Protected Any protected object Public Public Any public object Virtual Virtual Any virtual object The following table lists the SCA domain classes and their corresponding meanings in C++. SCA Domain Classes and Equivalent C++ Language Terminology SCA Term C++ Term Explanation Inheritable N/A Global Globally For example, extern, globaldef, visible globalref, globalvalue Predefined Defined by For example, int, float, char the language Multi_module Predefined and global Module_ Local to one For example, static, auto, register specific module
11 – Using COBOL
This section contains some basic examples that illustrate what SCA can do to help you with your programs. The examples have very little explanation. If you want a more detailed explanation of the underlying concepts, see the Basic_Query_Concepts help topic. The remainder of this section is written in terms that are specific to Cobol programs. If you want to follow along and try the examples, you will need to have an SCA library available. If you do not know how to create an SCA library, read the Building_An_SCA_Library help topic. The examples use generic variable names (such as i). You will have to substitute variable names that actually exist in your code when trying the examples. The first example is the easiest query: It lets you find all the items in your SCA library named i, and shows you all the places where they appear (all occurrences of i). FIND i You can search for any name in this manner, including using wildcard characters (for example, FIND i*). Now let's say you are looking for an occurrence, and you know that it occurs in a particular file. The following query finds all occurrences of items that are named i but will then limit them to those which happen to occur in the file named 'PROG.COB'. FIND i AND FILE_SPEC="PROG.COB" Another typical question one might ask is "Find all the places where this item is assigned to (or read from, called, declared, and so forth)." The next example finds all occurrences of items that are named i, but then limits them to only those occurrences where i is assigned a value. FIND i AND OCCURRENCE=WRITE (SCA understands many occurrence classes other then WRITE. See the help subtopics under Getting_Started for tables containing all the SCA attributes and their corresponding meanings in COBOL.) Often, you only want to know where (in what file ) a particular procedure is, so that you can go to it and edit it. You could use the first query (where i would be the program-id) and then look through the output. The output would include all occurrences of the program, one of which would be its definition, which you could then select. Or, you could ask SCA to limit the search for you by typing the following query: FIND i AND OCCURRENCE=PRIMARY In SCA terms, a primary declaration is the most significant declaration of an item. For a Cobol program, this is the program- id. This is in contrast to an associated declaration. Actually, in Cobol, associated declarations do not have much meaning. The compiler creates implicit associated declarations for a program the first time it is called. Another problem you might have is that there are many different items in your system having a given name. Some may be variables; others may be programs, paragraph names, files, and so forth. Suppose you want to find only the programs named i. Again, the query FIND i would give you what you wanted, but it would also give you much more. It is preferable to issue the following query: FIND i AND SYMBOL_CLASS=PROGRAM The last four examples have all selected information based on two attributes. The last example selected information based on a name attribute (in this case, i) and a symbol class attribute (in this case, PROGRAM). Note how the attributes are combined using the boolean operator AND. In general, you can select items out of your library based on any combination of attributes, using AND as well as the other logical operators OR, XOR and NOT. The next example shows another primary feature of SCA - the ability to display relationships between items. The example given here shows the most common use of this feature. It finds the complete call tree (that is, all programs called directly and indirectly), of the program named i. FIND CALLED_BY (I, DEPTH=ALL) If you want to limit the depth of the call tree, you can replace the keyword ALL by any positive integer. The final part of this section describes how to go directly to the source code once you have issued a query. After issuing the query FIND i, for example, you can have an LSE query buffer containing something that looks like the following: I variable COBOL_MODULE\60 data declaration COBOL_MODULE\75 write reference COBOL_MODULE\79 read reference COBOL_MODULE\122 read reference COBOL_MODULE\144 write reference COBOL_MODULE\146 read reference COBOL_MODULE\149 read reference COBOL_MODULE\166 read reference The first two lines of this display will be highlighted. The first line represents the item you looked for (I), and the rest of the lines represent the different places in the code where this item occurred (that is, the occurrences of I). By using the up and down arrows on your keyboard, or by clicking on an occurrence with your mouse, you can choose the occurrence you want to see. Then all you have to do is type CTRL/G (the keyboard equivalent of the GOTO SOURCE command), and LSE will bring the source file into a buffer and position you at the occurrence you chose. To obtain help on the following topics, request help as indicated. o For help on query language, see the Basic_Query_Concepts help topic. o For help on libraries, see the Building_An_SCA_Library help topic.
12 – COBOL Attributes Table
The following table lists the SCA symbol classes and their corresponding meanings in COBOL. SCA Symbol Classes and Equivalent COBOL Language Terminology SCA Term COBOL Term Explanation Argument Program argument Component, Group item Field Constant, A character string whose value is Literal specified by the ordered set of characters it contains, or a reserve word that is a figurative constant; for example, "1.234E7", ZERO Exception N/A File File A file used during the compilation Function, Program A program Procedure, Program, Routine, Subroutine Generic N/A Keyword Keyword A PDF keyword Label Paragraph- name or section-name Macro N/A Module, N/A Package Placeholder Placeholder An LSE placeholder Psect PSECT Tag Tag A PDF tag Task N/A Type Datatype Unbound Symbols in conditional compilation lines Variable Data item The following table lists the SCA occurrence classes and their corresponding meanings in COBOL. SCA Occurrence Classes and Equivalent COBOL Language Terminology SCA Term COBOL Term Explanation Primary Declaration Data declarations, program ids Associated Implicit declarations of called programs the first time they are seen Declaration Declaration Both primary and associated declarations Read, Fetch FETCH Write, Store STORE Address, N/A Pointer Call CALL Command_line A file specified on the command line, for example, COBOL foo.cob Include COPY Precompiled N/A Reference Reference Any nondeclaration Explicit A variable declared by the user Implicit A variable automatically defined by the compiler Visible Not hidden Hidden Hidden occurrences may be due to default conditions (for example, PIC 9(4) is given the DISPLAY TYPE) or within complex statement (for example, COMPUTE and hidden write references). Compilation_ SCP unit separately compiled unit The following table lists the SCA domain classes and their corresponding meanings in COBOL. SCA Domain Classes and Equivalent COBOL Language Terminology SCA Term COBOL Term Explanation Inheritable N/A Global EXTERNAL Predefined PREDEFINED For example, special registers Multi_module Global and predefined Module_ Not multi-module specific
13 – Using FORTRAN
This section contains some basic examples that illustrate what SCA can do to help you with your programs. The examples have very little explanation. If you want a more detailed explanation of the underlying concepts, see the Basic_Query_Concepts help topic. The remainder of this section is written in terms that are specific to FORTRAN programs. If you want to follow along and try the examples, you will need to have an SCA library available. If you do not know how to create an SCA library, read the Building_An_SCA_Library help topic. The examples use generic variable names (such as i). You will have to substitute variable names that actually exist in your code when trying the examples. The first example is the easiest query: It lets you find all the items in your SCA library named i, and shows you all the places where they appear (all occurrences of i). FIND i characters (for example, FIND i*). Now let's say you are looking for an occurrence, and you know that it occurs in a particular file. The following query finds all occurrences of items that are named i but will then limit them to those which happen to occur in the file named 'PROG.FOR'. FIND i AND FILE_SPEC="PROG.FOR" Another typical question one might ask is "Find all the places where this item is assigned to (or read from, called, declared, and so forth)." The next example finds all occurrences of items that are named i, but then limits them to only those occurrences where i is assigned a value. FIND i AND OCCURRENCE=WRITE (SCA understands many occurrence classes other then WRITE. See the help subtopics under Getting_Started for tables containing all the SCA attributes and their corresponding meanings in FORTRAN.) Often, you only want to know where (in what file or module) a particular subroutine is, so that you can go to it and edit it. You could use the first query (where i would be the name of the subroutine) and then look through the output. The output would include all occurrences of the subroutine, one of which would be its definition, which you could then select. Or, you could ask SCA to limit the search for you by typing the following query: FIND i AND OCCURRENCE=PRIMARY In SCA terms, a primary declaration is the most significant declaration of an item. For a FORTRAN subroutine, this is where the actual SUBROUTINE statement is. This is in contrast to a FORTRAN EXTERNAL declaration, which in SCA terms is an associated declaration. The FORTRAN compiler also creates implicit associated declarations for any undeclared functions. Another problem you might have is that there are many different items in your system having a given name. Some may be variables; others may be subroutines, PARAMETER constants, and so forth. Suppose you want to find only the subroutines named i. Again, the query FIND i would give you what you wanted, but it would also give you much more. It is preferable to issue the following query: FIND i AND SYMBOL_CLASS=SUBROUTINE The last four examples have all selected information based on two attributes. The last example selected information based on a name attribute (in this case, i) and a symbol class attribute (in this case, SUBROUTINE). Note how the attributes are combined using the boolean operator AND. In general, you can select items out of your library based on any combination of attributes, using AND as well as the other logical operators OR, XOR and NOT. The next example shows another primary feature of SCA - the ability to display relationships between items. The example given here shows the most common use of this feature. It finds the complete call tree (that is, all subroutines called directly and indirectly), of the subroutine named i. FIND CALLED_BY (I, DEPTH=ALL) If you want to limit the depth of the call tree, you can replace the keyword ALL by any positive integer. The final part of this section describes how to go directly to the source code once you have issued a query. After issuing the query FIND i, for example, you can have an LSE query buffer containing something that looks like the following: I variable FORTRAN_MODULE\60 variable declaration FORTRAN_MODULE\75 write reference FORTRAN_MODULE\79 read reference FORTRAN_MODULE\95 address reference FORTRAN_MODULE\122 read reference FORTRAN_MODULE\144 write reference FORTRAN_MODULE\146 read reference FORTRAN_MODULE\149 write reference FORTRAN_MODULE\149 read reference FORTRAN_MODULE\150 address reference FORTRAN_MODULE\166 read reference The first two lines of this display will be highlighted. The first line represents the item you looked for (I), and the rest of the lines represent the different places in the code where this item occurred (that is, the occurrences of I). By using the up and down arrows on your keyboard, or by clicking on an occurrence with your mouse, you can choose the occurrence you want to see. Then all you have to do is type CTRL/G (the keyboard equivalent of the GOTO SOURCE command), and LSE will bring the source file into a buffer and position you at the occurrence you chose. To obtain help on the following topics, request help as indicated. o For help on query language, see the Basic_Query_Concepts help topic. o For help on libraries, see the Building_An_SCA_Library help topic.
14 – FORTRAN Attributes Table
The following table lists the SCA symbol classes and their corresponding meanings in FORTRAN. SCA Symbol Classes and Equivalent FORTRAN Language Terminology SCA Term FORTRAN Term Explanation Argument Dummy The variable named in a function argument declaration Component, record Field component Constant, PARAMETER Literal Exception N/A File File A file used during compilation Function, SUBROUTINE or A SUBROUTINE, FUNCTION, or main Procedure, FUNCTION program Program, Routine, Subroutine Generic N/A Keyword Keyword A PDF keyword Label Label A statement label Macro N/A Module, BLOCK DATA, Package SUBROUTINE Placeholder Placeholder An LSE placeholder Psect COMMON block Tag tag A PDF tag Task N/A Type Type For example, INTEGER, REAL, COMPLEX and so forth Unbound N/A Variable Variable The following table lists the SCA occurrence classes and their corresponding meanings in FORTRAN. SCA Occurrence Classes and Equivalent FORTRAN Language Terminology SCA Term FORTRAN Term Explanation Primary Declaration The declaration containing the actual implementation Associated Declaration An EXTERNAL declaration Declaration Declaration Any declaration, either primary or associated Read, Fetch Read Write, Store Write Address, Address %LOC, actual arguments Pointer Call Call For example, a CALL statement Command_line Command line A file specified on the command line; for example, FORTRAN foo.for Include INCLUDE A file specified in an INCLUDE statement Precompiled N/A Reference Reference Any nondeclaration Explicit Explicit Any symbol declared by the user Implicit Implicit Any symbol declared by the compiler when it sees the first reference Visible Visible A symbol whose name is visible in the source Hidden Hidden A symbol whose name is not visible in the source Compilation_ Program unit A SUBROUTINE, FUNCTION, PROGRAM, unit BLOCK DATE, and so forth The following table lists the SCA domain classes and their corresponding meanings in FORTRAN. SCA Domain Classes and Equivalent FORTRAN Language Terminology SCA Term FORTRAN Term Explanation Inheritable N/A Global A SUBROUTINE, FUNCTION, or COMMON block Predefined Defined by For example, INTEGER, REAL*4, and so the language forth Multi_module GLOBAL, predefined, and inheritable Module_ Only known within a SUBROUTINE, specific FUNCTION, and so forth
15 – Using Pascal
This section contains some basic examples that illustrate what SCA can do to help you with your programs. The examples have very little explanation. If you want a more detailed explanation of the underlying concepts, see the Basic_Query_Concepts help topic. The remainder of this section is written in terms that are specific to Pascal programs. If you want to follow along and try the examples, you will need to have an SCA library available. The SCA$EXAMPLE library provided with SCA is based on Pascal, so you could use it. If you want to use your own library, but do not know how to create an SCA library, read the Building_An_SCA_Library help topic. The examples in this section use variables from the SCA$EXAMPLE library. If you use your own library, you will have to substitute variable names that actually exist in your code when trying the examples. The first example is the easiest query: It lets you find all the items in your SCA library named i, and shows you all the places where they appear (all occurrences of i). FIND i You can search for any name in this manner, including using wildcard characters (for example, FIND i*). Now let's say you are looking for an occurrence, and you know that it occurs in a particular file. The following query finds all occurrences of items that are named i but will then limit them to those which happen to occur in the file named 'BUILDTABLE.PAS'. FIND i AND FILE_SPEC="BUILDTABLE.PAS" Another typical question one might ask is "Find all the places where this item is assigned to (or read from, called, declared, and so forth)." The next example finds all occurrences of items that are named c, but then limits them to only those occurrences where c is assigned a value. FIND c AND OCCURRENCE=WRITE (SCA understands many occurrence classes other then WRITE. See the help subtopics under Getting_Started for tables containing all the SCA attributes and their corresponding meanings in Pascal.) Often, you only want to know where (in what file or module) a particular procedure is, so that you can go to it and edit it. You could use a query similar to the first (where i would be replaced by the name of the procedure) and then look through the output. The output would include all occurrences of the procedure, one of which would be its declaration, which you could then select. Or, you could ask SCA to limit the search for you by typing the following query: FIND build_table AND OCCURRENCE=PRIMARY In SCA terms, a primary declaration is the most significant declaration of an item. For a Pascal procedure, this means the place where the procedure is actually implemented. This is in contrast to FORWARD or EXTERNAL declarations, which are associated declarations. Another problem you might have is that there are many different items in your system having a given name. Some may be variables; others may be functions, constants, labels, and so forth. Suppose you want to find only the procedures named 'build_table'. Again, the query FIND build_table would give you what you wanted, but it would also give you much more. It is preferable to issue the following query: FIND build_table AND SYMBOL_CLASS=PROCEDURE The last four examples have all selected information based on two attributes. The last example selected information based on a name attribute (in this case, 'build_table') and a symbol class attribute (in this case, PROCEDURE). Note how the attributes are combined using the boolean operator AND. In general, you can select items out of your library based on any combination of attributes, using AND as well as the other logical operators OR, XOR and NOT. The next example shows another primary feature of SCA - the ability to display relationships between items. The example given here shows the most common use of this feature. It finds the complete call tree (that is, all procedures called directly and indirectly), of the procedure named 'build_table'. FIND CALLED_BY (build_table, DEPTH=ALL) If you want to limit the depth of the call tree, you can replace the keyword ALL by any positive integer. The final part of this section describes how to go directly to the source code once you have issued a query. After issuing the query FIND c, for example, you can have an LSE query buffer containing something that looks like the following: C variable EXPAND_STRING\60 VAR (variable) declaration EXPAND_STRING\75 write reference EXPAND_STRING\79 read reference EXPAND_STRING\95 read reference EXPAND_STRING\122 read reference EXPAND_STRING\144 write reference EXPAND_STRING\146 read reference EXPAND_STRING\149 write reference EXPAND_STRING\149 read reference EXPAND_STRING\150 read reference EXPAND_STRING\166 read reference The first two lines of this display will be highlighted. The first line represents the item you looked for (c), and the rest of the lines represent the different places in the code where this item occurred (that is, the occurrences of c). By using the up and down arrows on your keyboard, or by clicking on an occurrence with your mouse, you can choose the occurrence you want to see. Then all you have to do is type CTRL/G (the keyboard equivalent of the GOTO SOURCE command), and LSE will bring the source file into a buffer and position you at the occurrence you chose. To obtain help on the following topics, request help as indicated. o For help on query language, see the Basic_Query_Concepts help topic. o For help on libraries, see the Building_An_SCA_Library help topic.
16 – Pascal Attributes Table
The following table lists the SCA symbol classes and their corresponding meanings in Pascal. SCA Symbol Classes and Equivalent Pascal Language Terminology SCA Term Pascal Term Explanation Argument Formal parameter Component, Component, Components of array types, VARYING, Field String STRING; fields of records Constant, Constant CONSTants, predefined constants, Literal enumerated type constants Exception N/A File File A file used during compilation Function, Function, Procedure, procedure Program, Routine, Subroutine Generic N/A Keyword Keyword A PDF keyword Label Label Label declarations and uses Macro N/A Module, Program, Package module Placeholder Placeholder An LSE placeholder Psect Psect PSECT and COMMON attributes Tag Tag A PDF tag Task N/A Type Type For example, pointer, array, enumerated, subrange types Unbound N/A Variable Variable The following table lists the SCA occurrence classes and their corresponding meanings in Pascal. SCA Occurrence Classes and Equivalent Pascal Language Terminology SCA Term Pascal Term Explanation Primary Declaration For example, PROCEDURE XYZ; Associated FORWARD and For example, EXTERNAL PROCEDURE XYZ; EXTERNAL; declarations Declaration Declaration Both primary and associated declarations Read, Fetch Read Write, Store Write Address, Address Pointer Call Call Command_line Command line A file specified on the command line, for example, PASCAL foo.pas Include Include A file specified in an INCLUDE statement Precompiled Environment A file specified in an INHERIT clause Reference Reference Any nondeclaration Explicit Pascal has no implicit occurrences. Everything is explicit. Implicit N/A Visible Appears in the source Hidden Does not appear in the source, for example, VAR I : INTEGER VALUE 10 has a hidden write reference. Compilation_ Module, unit Program The following table lists the SCA domain classes and their corresponding meanings in Pascal. SCA Domain Classes and Equivalent Pascal Language Terminology SCA Term Pascal Term Explanation Inheritable Inherited or Items in an environment file and inheritable items inherited from an environment file Global GLOBAL Items declared with the GLOBAL attribute Predefined Predeclared For example, INTEGER, TRUE, WRITELN Multi_module Inheritable, Global, Predefined Module_ Items local to a compilation unit, specific and not in an environment file
17 – EPascal Attributes Table
The following table lists the SCA symbol classes and their corresponding meanings in EPascal. SCA Symbol Classes and Equivalent EPascal Language Terminology SCA Term EPascal Term Explanation Argument Formal parameter Component, Component, Components of array types, VARYING, Field String STRING; fields of records Constant, Constant CONSTants, predefined constants, Literal enumerated type constants Exception INTERRUPT_SERVICE Interrupt Service routine File File A file used during compilation Function, Function, Procedure, procedure Routine, Subroutine Generic N/A Keyword N/A Label Label Label declarations and uses Macro N/A Module, Program, Package module Placeholder N/A Program PROGRAM Psect Psect PSECT and COMMON attributes Tag N/A Task PROCESS_BLOCK Type Type For example, pointer, array, enumerated, subrange types Unbound Flexible type Variable Variable The following table lists the SCA occurrence classes and their corresponding meanings in EPascal. SCA Occurrence Classes and Equivalent EPascal Language Terminology SCA Term EPascal Term Explanation Primary Declaration For example, PROCEDURE XYZ; Associated FORWARD and For example, EXTERNAL PROCEDURE XYZ; EXTERNAL; declarations Declaration Declaration Both primary and associated declarations Read, Fetch Read Write, Store Write Address, Address Pointer Call Call Command_line Command line A file specified on the command line, for example, EPASCAL foo.pas Include %Include A file specified in a %INCLUDE statement Precompiled Include A file specified in an INCLUDE statement Reference Reference Any nondeclaration Explicit EPascal has no implicit occurrences. Everything is explicit. Implicit N/A Visible Appears in the source Hidden Does not appear in the source, for example, VAR I : INTEGER VALUE 10 has a hidden write reference. Compilation_ Module, unit Program The following table lists the SCA domain classes and their corresponding meanings in EPascal. SCA Domain Classes and Equivalent EPascal Language Terminology SCA Term EPascal Term Explanation Inheritable INCLUDEd Items in a precompiled file. Global GLOBAL Items declared with the GLOBAL attribute Predefined Predeclared For example, INTEGER, TRUE, WRITELN Multi_module Inheritable, Global, Predefined Module_ Items local to a compilation unit, specific and not in a precompiled file.
18 – Using SCAN
This section contains some basic examples that illustrate what SCA can do to help you with your programs. The examples have very little explanation. If you want a more detailed explanation of the underlying concepts, see the Basic_Query_Concepts help topic. The remainder of this section is written in terms that are specific to SCAN programs. If you want to follow along and try the examples, you will need to have an SCA library available. If you do not know how to create an SCA library, read the Building_An_SCA_Library help topic. The examples use generic variable names (such as i). You will have to substitute variable names that actually exist in your code when trying the examples. The first example is the easiest query: It lets you find all the items in your SCA library named i, and shows you all the places where they appear (all occurrences of i). FIND i You can search for any name in this manner, including using wildcard characters (for example, FIND i*). Now let's say you are looking for an occurrence, and you know that it occurs in a particular file. The following query finds all occurrences of items that are named i but will then limit them to those which happen to occur in the file named 'PROG.SCN'. FIND i AND FILE_SPEC="PROG.SCN" Another typical question one might ask is "Find all the places where this item is assigned to (or read from, called, declared, and so forth)." The next example finds all occurrences of items that are named i, but then limits them to only those occurrences where i is assigned a value. FIND i AND OCCURRENCE=WRITE (SCA understands many occurrence classes other then WRITE. See the help subtopics under Getting_Started for tables containing all the SCA attributes and their corresponding meanings in SCAN.) Often, you only want to know where (in what file or module) a particular procedure is, so that you can go to it and edit it. You could use the first query (where i would be the name of the procedure) and then look through the output. The output would include all occurrences of the procedure, one of which would be its declaration, which you could then select. Or, you could ask SCA to limit the search for you by typing the following query: FIND i AND OCCURRENCE=PRIMARY In SCA terms, a primary declaration is the most significant declaration of an item. For a SCAN procedure, this means the place where the procedure is actually implemented, that is, the PROCEDURE declaration. This is in contrast to FORWARD or EXTERNAL declarations, which are associated declarations Another problem you might have is that there are many different items in your system having a given name. Some may be variables; others may be procedures, constants, labels, and so forth. Suppose you want to find only the procedures named i. Again, the query FIND i would give you what you wanted, but it would also give you much more. It is preferable to issue the following query: FIND i AND SYMBOL_CLASS=PROCEDURE The last four examples have all selected information based on two attributes. The last example selected information based on a name attribute (in this case, i) and a symbol class attribute (in this case, PROCEDURE). Note how the attributes are combined using the boolean operator AND. In general, you can select items out of your library based on any combination of attributes, using AND as well as the other logical operators OR, XOR and NOT. The next example shows another primary feature of SCA - the ability to display relationships between items. The example given here shows the most common use of this feature. It finds the complete call tree (that is, all procedures called directly and indirectly), of the procedure named i. FIND CALLED_BY (i, DEPTH=ALL) If you want to limit the depth of the call tree, you can replace the keyword ALL by any positive integer. The final part of this section describes how to go directly to the source code once you have issued a query. After issuing the query FIND i, for example, you can have an LSE query buffer containing something that looks like the following: I variable SCAN_MODULE\60 variable declaration SCAN_MODULE\75 write reference SCAN_MODULE\79 read reference SCAN_MODULE\122 read reference SCAN_MODULE\144 write reference SCAN_MODULE\146 read reference SCAN_MODULE\149 write reference SCAN_MODULE\149 read reference SCAN_MODULE\150 read reference SCAN_MODULE\166 read reference The first two lines of this display will be highlighted. The first line represents the item you looked for (i), and the rest of the lines represent the different places in the code where this item occurred (that is, the occurrences of i). By using the up and down arrows on your keyboard, or by clicking on an occurrence with your mouse, you can choose the occurrence you want to see. Then all you have to do is type CTRL/G (the keyboard equivalent of the GOTO SOURCE command), and LSE will bring the source file into a buffer and position you at the occurrence you chose. To obtain help on the following topics, request help as indicated. o For help on query language, see the Basic_Query_Concepts help topic. o For help on libraries, see the Building_An_SCA_Library help topic.
19 – SCAN Attributes Table
The following table lists the SCA symbol classes and their corresponding meanings in SCAN. SCA Symbol Classes and Equivalent SCAN Language Terminology SCA Term SCAN Term Explanation Argument Formal A routine or function formal parameter parameter Component, Leaf node A leaf node of a TREE variable Field Constant, Constant A CONSTANT definition Literal Exception N/A File File A file used during compilation Function, Procedure A Procedure Procedure, Program, Routine, Subroutine Generic N/A Keyword N/A Label Label A statement label Macro N/A Module, Module A module Package Placeholder N/A Psect Psect A psect name Tag N/A Task N/A Type Type Unbound N/A Variable Variable The following table lists the SCA occurrence classes and their corresponding meanings in SCAN. SCA Occurrence Classes and Equivalent SCAN Language Terminology SCA Term SCAN Term Explanation Primary Declaration Either a DECLARE or PROCEDURE declaration Associated Declaration Either a FORWARD or EXTERNAL declaration Declaration Declaration Either primary or associated Read, Fetch Reference The value of a variable is retrieved. Write, Store Assignment A variable is assigned a value. Address, Indirect Pointer reference Call Call Command_line Command line A file specified on the command line; for example, SCAN foo.scn. Include Include A file included with the INCLUDE statement Precompiled N/A Reference Reference Any nondeclaration Explicit Explicit A variable or procedure explicitly declared with DECLARE or PROCEDURE statement Implicit Implicit A variable declared by the compiler on first reference, for example, a picture variable Visible N/A Hidden N/A Compilation_ Module unit The following table lists the SCA domain classes and their corresponding meanings in SCAN. SCA Domain Classes and Equivalent SCAN Language Terminology SCA Term SCAN Term Explanation Inheritable N/A Global Global Declaration has GLOBAL attribute Predefined Predefined Multi_module Global or predefined Module_ Local to one module specific