Super
Previous Next

Using the Wasp analyser

Wasp analysis is initiated from the command line either for one Java program:

      wasp <java file name> [<options>]

or for list of Java programs:

      wasp <file included list of java file names> [<options>]

where <options> is a list of options separated by spaces.

When applied to a java program, Wasp produces a message listing (see Wasp messages) and stores it in the file <program name>.mes. It also produces a method call graph (see Method call graph) in the file <program name>.grf.


Super
Previous Next

Options

Options are used to control Wasp work.

<Option> ::=
      -<Option name> | 
      -<Option name>=<option value> | 
      <Path option>

Spaces are not permitted within <option value> when option is used as a command line parameter; such value must be enclosed in quotes.

Wasp options are described in the chapter Wasp options.

<Path option> ::=
      -sourcepath <space> <path specification> | 
      -classpath <space> <path and arhive specification> | 
      -msgpath <space> <directory name> | 
      -grfpath <space> <directory name> | 
      -irfpath <space> <directory name>  

where <space> is the space symbol, <directory name> is in the portal notation (see Portable notation for file and directory names).

<path specification> ::=
      <directory name> [<path separator> <path specification>]
<path and arhive specification> ::=
      <directory name> [<path separator> <path and arhive specification>] |
      <arhive file name> [<path separator> <path and arhive specification>]
<path separator> ::=
      :  

The -sourcepath and -classpath options define paths for searching source code files and class-files, respectively. Also, for class-files, the jar and zip archives of packages may be defined.

The -msgpath, -grfpath, or -irfpath option defines the directory where Wasp will write message listings (see Wasp messages), method call graphs (see Method call graph), or partially analysed programs (see Wasp strategy for big programs), respectively. By default, if any of the mentioned options not specified Wasp will write the respective files into the current directory where Wasp is launched.

Wasp may receive options from the system file .wasprc, from the configuration file wasp.cfg, or from the command line parameters.

The system file .wasprc is created by the Wasp installer in the user home directory. Initially, this file includes the -classpath option to the Sun JDK class-files and the -sourcepath option to the package mJDK for modelling some JDK classes.

The configuration file wasp.cfg is created by a user in the directory from where Wasp is launched. It includes list of options; each line consists of one option. The rest of line after the "%" token is considered as commentary.

Options from command line overrides ones from the configuration file wasp.cfg except the -sourcepath and -classpath options which values are appended to the previous ones.


Super
Previous Next

Invoking Wasp for one Java program

Wasp analysis of a Java program is initiated from the command line:

      wasp <top file name> [<options>]

where <top file name> is the name of the source code file.

The top file should include the public static void main(String []) method. The Wasp analyser builds the analysed configuration of the program starting from the main method (see Analysed configuration).

The top file should be accessible through <top file name> either from the current directory directly or from the directories specified by the -sourcepath options.

The Wasp utility installed includes the Samples directory. Let the Samples directory to be current. To run the simple java program consisted of the single file linnew.java, type the following:

       wasp linnew.java

To run the program which top file is RunTests.java in the bench package included to the Samples directory, type the following:

       wasp bench/RunTests.java

For examples above, the message listings linnew.mes and RunTests.mes and the method call graphs linnew.grf and RunTests.grf will be produced.


Super
Previous Next

Invoking Wasp for list of Java programs

The Wasp invocation:

        wasp -scan

outputs the list of names of top Java files (with the public static void main(String []) method) for the directory hierarchy based on the current directory to stdout.

The Wasp invocation:

        wasp -scan <directory name>

outputs the file name list for the directory hierarchy from the directory specified by the parameter of the -scan option.

Wasp analysis for a list of Java programs is initiated from the command line:

        wasp <name of file included file name list> [<options>]

where the first parameter defines the file produced by the launch verb'wasp -scan'; for the name of this file, the extension "java" is forbidden.

The Wasp analysis will be applied for each program in the list. If compiler error were found for some program, the analysis of the list would be stopped.

Let the Samples directory from the Wasp utility to be current. In order to obtain the list of programs that can be passed through Wasp type the string:

        wasp -scan >samples.list

The result will be the following file samples.list:

Contexts.java
errorLevels.java
linnew.java
Previous.java
bench/RunTests.java

Now, to analyse all listed Java programs, type the string:

        wasp samples.list

As a result, in the Samples directory you will find message listings and method call graphs for all listed programs.


Copyright 2000, 2001, 2002, 2003 AcademSoft. All rights reserved.