CLAN is a Visual Prolog system development-related tool with two main functions:

  • XGREP - an enhanced grep-type functionality which can (a) search for multiple strings in a set of source files, and (b) carry out string substitutions in a set of files.

  • ANALYZER - a Visual Prolog v.6 project analyzer which analyzes class and predicate usage, counts source lines and other.

Target Directory

CLAN always work with a specified target directory. The target directory is shown to the right in the toolbar. You can change target project directory while working with CLAN.

XGREP

XGREP is an enhanced grep or text file search utility. XGREP operates in three modes:

  • find: search a set of files for a set of texts;
  • substitute: search a set of files for a set of texts T1, T2, ..., Tn and replace these with R1, R2, ..., Rn;
  • list: list a set of files.

A file set is defined by the target directory with or without sub-directories and limited to files matching the specified file mask.

 You must specify whether the files are ASCII or UNICODE, and whether or not searching is case sensitive. (Replacement strings in case of substitution are always case sensitive).

Analyzer

The analyzer analyzes all source files in a project i.e. the project's .pack and .ph file, and all files referenced in these files recursively. However, it will only analyze files:

  • file is in the target directory or sub-directories (as long as the file's directory is not explicitly excluded); or
  • file is specified with complete explicit path (as long as the file's directory is not explicitly excluded); or
  • file is in a directory which is explicitly included.

Example

The target directory c:\vip_apps\pro3_611 and the root package is pro3_611. All  source modules in the target directory and its subdirectories, and referred by the root package (recursively), will be included. Source modules in the c:\vip_apps\library directory and sub-directories will also be included. Source modules in the c:\Program Files\Visual Prolog 6.1 will be explicitly excluded from the analysis. So will also classes core, resourceidentifiers and prohectttoolbar as well as all classes starting with vpi/

The analyzer analyzes .ph, .pack, .cl, .i and .pro files. The scope of the analysis is only the included source files, e.g. a class not referring to any classes in the scope, is regarded as a class not referring to any other classes (even if it happens to refer to classes outside the scope).

LIMITATIONS AND PROBLEMS

The analyzer uses a simpler syntax analyzer than VIP itself. It has problems with elements like S="\"" which it reports as an unterminated string. To get around this you might consider changing the source to e.g. Quote=string::toString('"'), S=Quote.

PROJECT METRICS

A set of basic project metrics are displayed after the source file analysis is completed:

REPORTS

The following reports are available:

  • Predicates by name
  •  All object relations.

    Objects:

    I - interface.
    CL - class.
    PACK - package.
    PH - package header. PRO - implementation.
    PRO - implementation.
    OT - object type.
    PUCP - public class predicate.
    PUOP - public object predicate.
    PRCP - private class predicate.
    PROP - private object predicate.

    Relations:

    EXP - exports.
    INC - uses.
    INH - inherits.
    SUP - supports.
    OPN - opens.
    REQ - requires.
    HAS - has.
    HCN - has constructor.
    REF - refers.
    USP - uses publicly.
    USE - uses.
    GEN - generates.
    DEF - is definition for.
    DEP - depends on.

 

  • All included source files
  • Top level class (classes not referred by other classes within the scope of the analysis)
  • Basic classes (class not referring other classes within the scope of the analysis)
  • Class Dependencies (detailed) (class entity referring to class entity relations, where class entities are classes, implementations, interfaces and object types. See also MS Visio Export.
  • Class Dependencies (summarized) (same as over, but with no distinction between different class entities and without indicating type of reference). See also MS Visio Export.

REPORT OUTPUT OPTIONS

Output are either in table or text window format. Text window format can optionally use line-wrapping. These preferences are set via the File-menu or via two toggles in the menu bar:

EXPORT TO PRO/3

The result of the analysis i.e. all object relations as well class interdependencies can be exported to a Pro/3 knowledge base (clan.3kb). This knowledge is preloaded with a number of rules and built-in queries which further analyses the project. clan.3kb makes ad-hoc browsing in the often considerable volume of data easy.

MS VISIO EXPORT

Class dependency graphs can be exported to MS Visio. The graphs correspond to the two class dependency reports described over.  

The generated export files are called VisioClasses.txt and VisioClassDetailed.txt. The files are imported to MS Visio as follows:

  1. Start MS Visio
  2. Select Tools
  3. Select Macros
  4. Select Flowchart
  5. Select Import Flowchart Data Wizard
  6. Press Next
  7. Select Read Data From Existing File
  8. Browse and select the generated file (.TXT)
  9. Press Next
  10. Press Finish
  11. Select comma (,) as field separator.
  12. Press Ok

Classes are drawn as rectangles, interfaces as "rounded rectangles", object types as diamonds and implementations as "pointed rectangles". The MS Visio exports require the stencil file clan.vss.