U S E R S G U I D E A N D R E F E R E N C E
4.1
Corporate Headquarters
Wind River Systems, Inc.
500 Wind River Way
Alameda, CA 94501-1153
U.S.A.
toll free ( U.S.): 800/545-WIND
telephone: 510/748-4100
facsimile: 510/749-2010
For additional contact information, please visit the Wind River URL:
http://www.windriver.com
For information on how to contact Customer Support, please visit the following URL:
http://www.windriver.com/support
Contents
Part I
Documentation Guidelines
This Manual . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
The SNiFF+ Documentation SetGuidelines . . . . . . . . . . . . . . . . . 4
Feedback and Useful Links . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Terminology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Menu References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
A Note on Unix/Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Typography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Part II
7
8
8
8
9
What is a Project? . . . . . . . . . . . . . . . . . . .
IntroductionProjects . . . . . . . . . . .
Some Advantages of Projects . . . . .
What Does a Project Know? . . . . .
......
......
......
......
......
......
......
......
.......
.......
.......
.......
....
....
....
....
13
14
14
16
What is a Workspace? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
IntroductionWorkspaces and Projects . . . . . . . . . . . . . . . . . . . .
What are Workspaces For? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Sharing or Layering Workspaces. . . . . . . . . . . . . . . . . . . . . . . . . .
What is a Workspace? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Location of Root Directories . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
17
18
18
20
21
24
Part III
Workspace Management
......
......
......
......
......
......
......
......
.......
.......
.......
.......
.41
.42
.42
.44
Contents
....
....
....
....
....
....
....
....
65
66
66
67
67
68
69
70
Managing Workspaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Reorganizing Workspaces. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Workspace Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Modifying Workspace Build Properties . . . . . . . . . . . . . . . . . . . . .
Version-Controlling Build Properties . . . . . . . . . . . . . . . . . . . . . . .
71
72
72
73
74
75
Part IV
.......
.......
.......
.......
.......
.......
.......
.......
Project Creation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
You Only Create a Project Once . . . . . . . . . . . . . . . . . . . . . . . . . .
Wizard or Template? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Project and Workspace Creation in One . . . . . . . . . . . . . . . . . . . .
Project Creation in Existing Workspaces. . . . . . . . . . . . . . . . . . . .
Post-Setup Project Tuning. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Project Templates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Absolute Projects. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
81
82
82
83
83
84
87
88
88
103
104
104
105
106
107
Part V
Contents
170
171
173
175
176
181
182
182
183
IDL Projects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
IDL File Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Projects and Derived File Types . . . . . . . . . . . . . . . . . . . . . . . . .
What to Do. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
How File Compilation Works . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Browsing IDL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
187
188
188
189
189
190
191
193
194
194
195
197
198
198
202
202
.......
.......
.......
.......
.......
...
...
...
...
...
211
212
212
213
213
214
214
215
216
Part VI
Part VII
Contents
What is a Freeze-Point . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
What is a Change-Set? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
What is a Branch? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
What is HEAD? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
What is INIT? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
257
257
257
258
258
259
260
261
261
262
263
264
264
265
268
Integrating ClearCase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Assumptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Integration Features. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
How to integrate SNiFF+ and ClearCase . . . . . . . . . . . . . . . . . .
VOBs and Views in SNiFF+. . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Creating SNiFF+ Projects for ClearCase-Controlled Code . . . . .
Changing the config spec . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Synchronizing SNiFF+ Projects with View Changes . . . . . . . . . .
Using clearmake . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
269
270
270
271
271
271
272
273
273
277
278
279
279
282
284
286
287
287
288
Part VIII
Contents
Part IX
SniffAPI
SniffAPI - Concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Basic Idea . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Overall Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Query Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Usage Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Scope Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
The ID Concept . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
339
340
340
340
341
342
345
347
SniffAPIGetting Started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
What You Need . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Directory Structure of SniffAPI. . . . . . . . . . . . . . . . . . . . . . . .
Setting up JAR files for compilation of a SniffAPI client. . . . .
Compiling the Sample Program. . . . . . . . . . . . . . . . . . . . . . .
Running the Sample Program . . . . . . . . . . . . . . . . . . . . . . . .
...
...
...
...
...
...
353
354
354
354
356
356
...
...
...
...
...
361
362
362
363
367
Sniffaccess. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Introducing Sniffaccess . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Preparing the Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Invoking Sniffaccess . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Connection Management. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Input and Output of Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Sniffaccess Command Reference . . . . . . . . . . . . . . . . . . . . . . . .
Appendix: What is Python? . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
371
372
372
373
374
375
381
391
391
393
395
395
396
397
397
Part X
Advanced Reference
Custom Menus. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Preparation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
The Custom Menu Configuration File . . . . . . . . . . . . . . . . . .
Custom Menu Configuration File: EBNF Specification . . . . .
Part XI
Appendix
Part I
Documentation Guidelines
This Manual
Conventions
1
This Manual
Overview
Browsing Tour
Create a Project to browse either your own source code, or sample code
provided with SNiFF+. Get to know the SNiFF+ browsing tools and navigation features.
Working in Teams
An outline of procedures for setting up a team work-organization.
This Manual
The SNiFF+ Documentation SetGuidelines
Europe
support-ec@windriver.com
USA
support@windriver.com
Useful Links
A number of useful links (Knowledge Base, FAQs, Users Mailing List ...)
are available under:
http://www.windriver.com/sniff
2
Conventions
Overview
Terminology page 8
Typography page 9
2.1 Terminology
The terminology described in this section is used throughout this guide
and in all SNiFF+ documentation.
SNIFF_DIR4
This refers to your SNiFF+ installation directory.
Symbol
Any programming language construct such as a class, method, etc.
We use forward slashes ( / ) in path specifications. If you are on Windows, read backslash ( \ ) instead.
The screenshots in this manual are all done on Windows NT. If you are
working on Unix, what you see on your screen may look slightly different.
Conventions
Typography
2.4 Typography
2
Capitalized Words
Italics
Names of manuals, newly introduced terms, and emphasized words are in italics.
Examples: User's Guide , the Workspace concept, do
not do something.
Boldface and
Bold italics
Monospace
<Keys>
Special keys are printed in monospace type with enclosing '< >'.
Examples: <CTRL>, <Return> , <Meta>.
10
Part II
Projects and Workspaces
What is a Project?
What is a Workspace?
12
3
What is a Project?
Overview
IntroductionProjects page 14
13
3.1 IntroductionProjects
A SNiFF+ Project is the main structuring element for grouping files on
your file system that logically belong together. In other words, elements
that you want to handle (browse, build, or document) together can be
grouped (modularized) in Projects, without having to modify file-system
locations.
A software system will generally be structured as a hierarchical tree of
Projects (or trees of Projects), whereby the relative position of nodes in
the tree reflects logical (build-)dependency relationships. For example,
building a top-level Project target will generally depend on a prior build of
its (recursive) Subprojects.
14
What is a Project?
Some Advantages of Projects
If you use SNiFF+ Build Support, the Project structure defines the traversal order of Projects during system Build; furthermore SNiFF+ can,
based on the parsed source files, also generate per-Project dependency
information. This means that once targets and the structural organization of the tree have been defined, the build system is practically selfmaintaining.
15
16
4
What is a Workspace?
Overview
Storage page 18
Building page 20
Flexibility page 20
TerminologySource Root, Project and Makefiles Location, Generated Files Location, and Repository page 21
17
4.2.1 Storage
One function of a Workspace is storage. When Projects are first opened
in a Workspace, you can have SNiFF+ generate symbol, cross-reference, and dependency information.
This information is stored persistently in the Workspace, and only needs
to be incrementally (if at all) updated when next you open Projects in the
Workspace.
18
What is a Workspace?
What are Workspaces For?
19
4.2.6 Building
A teams work may be distributed over different operating systems, and
the product may be targeted to run on multiple systems.
On the one hand, this may mean that you are working on a Windows
machine but need to build and debug on a remote Unix machine. On the
other, if you access your sources over a network file system, you can
improve Build performance by redirecting output to a directory on your
local machine.
Workspace defaults can be set for the target operating system, where
and how you build (for example, with debug information or optimized),
and you can switch between different options and target platforms within
one and the same Workspace.
(See also SNiFF+ PRO Build/Debug: How To page 137.)
4.2.7 Flexibility
Development teams are dynamic, they can grow and shrink again. As a
team grows, new Workspaces that are consistent with existing ones are
quickly created, and, conversely, simply removed when no longer
needed.
20
What is a Workspace?
What is a Workspace?
Each Workspace points to its own Source Root, its own Project and
Makefiles Location, and its own Generated Files Location, and may be
associated with a specific Repository.
The Source Root of a Workspace points to the root directory (somewhere) below which all sources of a software system should lie (or will lie
when they are checked out/opened for the first time).
The Project and Makefiles Location is used for storing Project Description
Files, Makefiles, and Build Support files. These can therefore kept in a
directory separate from the source files, but still be normally version controlled. Generally, a subdirectory below the Source Root is used.
21
Figure 4-1
Workspace
Copy of
directory
structure
only
Workspace Info
Project Information
File System Directory
22
What is a Workspace?
What is a Workspace?
23
check files out from, for example, a Repository location for RCS, or the
view extended path name for ClearCase and which revisions to check
out/in by default. File revisions are checked out from the version control
system to the locations below the Source Root.
24
What is a Workspace?
Location of Root Directories
4.5.3 Exception: Generated Files (and Project and Makefiles) Locations Not Relative
If multi-layered Workspaces are and will not be used (for example, under
ClearCase this is not supported), you can also have the Generated Files
Location outside the Source Root.
However, for normal team development work and version controlling, you
have to make sure that SNiFF+ Project Description Files and Makefiles
are properly version controlled. So you can store Project Description and
Makefiles in a subdirectory of the Source Root, and other generated files
that are entirely SNIFF+-maintained elsewhere. This is the recom-
25
26
Part III
Workspace Management
Workspace Organization
Stand-Alone Workspaces
Managing Workspaces
28
5
Workspace Organization
Overview
Introduction page 30
Performance page 32
29
5.1 Introduction
We assume that you are familiar with the SNiFF+ concepts, Project and
Workspace. If not, please refer to Projects and Workspaces page 11.
No relationship (non-version-controlled)
This, the trivial case, is where an individual Workspace has absolutely
nothing to do with anythingneither with any other Workspace, nor with
a version control Repository. It is completely isolated. Suitable for
browsing and code comprehension, or for small-scale experimental work
that is not shared or version controlled.
Creating this kind of Environment is described under Stand-Alone Workspaces page 35.
Hierarchical relationship
Workspaces are directly dependent on other Workspaces. More complicated, cannot be used in all cases (e.g. ClearCase, Java code...), does
not generally make sense on Windows. The main advantage is diskspace savings (only on Unix, where symbolic links are supported).
(See also Hierarchical vs. Flat Workspace System page 31.)
30
Workspace Organization
Hierarchical vs. Flat Workspace System
Figure 5-1
Hierarchically layered
You are working on Java Projects on Unix. The Java compiler cannot follow symbolic links.
31
On Windows, where symbolic links are not supported, hierarchically layered Workspaces require more disk-space.
In the lower-level Workspaces, local copies of source files, symbol,
cross-reference and dependency information, as well as objects in the
higher-level Workspace are created. This means one extra unnecessary (but see also below) set of data per higher-level Environment.
5.3.3 Performance
In hierarchically layered systems (Unix and Windows), performance
improvements can be expected under the following circumstances (on
Windows, however, less so than on Unix because of the copying-time
overhead):
When Projects are first opened in (newly created) lower-level Workspaces. This is because the initial parsing of symbol, cross-reference and
other information is not necessary.
If, for example, a globally included header has been modified, a full rebuild is necessary. With layered Workspaces, this need be done only
once. In flat Workspace systems, a re-build has to be done for each
Workspace.
32
Workspace Organization
Reorganizing Workspaces
33
34
6
Stand-Alone Workspaces
Overview
Assumptions page 36
35
6.1 Assumptions
We assume that you are familiar with the SNiFF+ concepts, Project and
Workspace. If not, please refer to Projects and Workspaces page 11,
or at least make sure you know what is meant by the terms Source Root,
Proect and Makefiles Loction, and Generated Files Location (see TerminologySource Root, Project and Makefiles Location, Generated Files
Location, and Repository page 21 for a summary description).
If you do not need to do any serious development work on, for example, a
third-party library, and only want to browse and analyze code, this kind of
stand-alone Workspace is perfectly adequate. This applies particularly
also to read-only code, where version-controlling is not an issue. An interesting thing about this kind of Workspace is that it can be simultaneously
used by multiple users (see Special Case: Stand-Alone Analysis Environment page 39).
Or maybe you want to create a Workspace for code that does not yet
exist. For example, an Environment for experimental work that may, or
may not, grow into something bigger. If the experiment does grow into
something worth version controlling, you can easily change at any time.
36
Stand-Alone Workspaces
Stand-Alone Workspace Plus Project
In the Workspace Manager, click into the Workspaces Tree (left pane),
and press the <ESC> key.
Nothing should now be selected.
Now choose
Project > New > With Wizard...
Specify that you do not want to use a version control tool for the Project.
Specify the root directory that holds (or will hold) your sources.
Use the Exclude... button to select which directories to include/exclude
in/from the Project.
Note that deselecting a directory also excludes all subdirectories.
Although the subdirectories are still checkmarked, Projects will not be
created for them (a missing link).
The Wizard scans the specified directory tree for known File Types.
If you are creating a Workspace/Project for an empty directory, obviously no File Types will be matched. So, simply click Next.
If there are source files below the root directory you specified, accept
or modify the File Types as necessary.
37
In the box that appears, enter a name for the Workspace, and the location
of the Source Root directory. SNiFF+ offers a default Project and Makefiles Location, and a default Generated Files Location (specified in the
Preferences).
It is best to accept, and always use, these defaults. If you do not have
write permission below the Source Root, you can specify locations
outside the Source Root.
When you click Add, the new Workspace is shown in the Workspace
Manager.
In the Workspace Manager, you can save the new Workspace constellation by choosing
Workspace > Save All
38
Stand-Alone Workspaces
Special Case: Stand-Alone Analysis Environment
39
40
7
Workspaces and User
Autonomy
Overview
42
In the Preferences
Figure 7-1
42
8
Team Workspaces from
Scratch
Overview
Introduction page 46
45
8.1 Introduction
Regardless of how you want to organize your Workspaces (Flat or Hierarchical, see Workspace Organization page 29), there will always be a
first Workspace.
Once things work for one person, its a small step to let Workspaces take
care of the rest of the team-setup work for you.
Theres no need to do everything at once. You can set up a team organization without, for example, initially worrying about any of the more complicated build-related stuff. Your in-house Build expert can set up the
Build system at any time (in his/her Workspace), and the benefits can
then be transparently passed on, via Workspace mechanisms, to the rest
of the team.
46
Make sure that all the files for which you want to create the team Project
are under ClearCase control. In other words, the files should already be
elements of a VOB.
Make sure that you have a ClearCase view that accesses the VOB.
When you create a Project/Workspace for use with ClearCase you can
store Project Description FIles and Makefiles under a subdirectory
(default name sniff_data).
In this case, Project Description Files and Makefiles will still be under
ClearCase control, but not intermingled with the source code files.
To improve performance, use an absolute path that points to a location
outside the Source Root (and therefore outside ClearCase control) for
the Generated Files directory.
47
The first team member creates the Project that will be used by the
entire team.
So, to set up the first team members Workspace, complete with Repository, ready-for-work source code, and Project information, use the Project
Creation Wizard.
48
In the opening page of the Wizard, make sure you specify that
you want to version control the Project you are about to set up.
Click: Yes, and make sure the correct version control tool is selected.
Here we will use RCS as an example for repository-based systems, and
also point out issues to be aware of if you are using ClearCase.
Click Next.
49
This page does not appear for all version control tools.
The page prompting for a Repository Location only appears for some
version control tools, for example, RCS. The Repository Location can
point to any directory where you have write permission.
RCS will, for example, create a directory named RCS under the directory
you point to, and store all file revisions in this subdirectory.
If you are already using a Repository, obviously this is the directory you
will point to. Note that, in this case, you also have the option of checking
out the files directly from the Repository to the Source Root location you
specify on the following Wizard page.
Select the Project type that most closely approximates the software system you will be working on. This generally relates to the standard File
Types that will be recognized by the Project (whether such files already
exist or not), as well as, in some cases, to the standard default build-targets that will be created (this applies specifically to VxWorks/Tornado
Project types).
Location: This will be the first Workspaces Source Root . Be sure to point
to a root directory that holds (or will hold) all source code somewhere
below it.
If unrelated directories exist below this root directory, use the Exclude...
button to clear the checkboxes next to these directories. No Projects will
be created for directories that are not checkmarked; nor will Projects be
created for subdirectories of uncheckmarked directories (missing link)!
If your source code is still in a Repository (this depends also on the
version control tool used, see Where is the Repository? page 50), the
Location here refers to the target directory where files will be checked
out to during the Project creation process.
50
A default Name for the Project is taken from the directory name; you
might want to change this.
Selecting the check-box means that SNiFF+ will scan directories and
check for file extensions that do not normally belong to the selected
Project type.
Clearing the checkbox means that SNiFF+ will not scan directories for
additional File Types over and above the ones it would normally
expect to belong to the type of Project you selected above. This can
save time for large directory trees.
The Wizard offers default storage locations for Project and Makefiles as
well as for other Generated Files.
Accepting these defaults is generally recommended, especially also to
ensure consistency in team development situations.
Splitting these two types files is relevant mainly for version control tools
like ClearCase (that is, tools that also version control directories). Project
Description Files and build-related files are kept within (subdirectories of)
version controlled directories (that is, for example, within a ClearCase
view). Symbol tables and databases, on the other hand, need not be version controlled because they are maintained entirely by SNiFF+. Storing
these generated files outside version controlled directories will therefore
improve performance on such systems. In this case point the Generated
Files location to an absolute location outside the ClearCase view.
51
No Build Support
This option is for (sub-) Projects that you only want to browse, for
example, third party library code.
After the sources have been parsed and the necessary information
generated, the Project is opened in the Project Browser.
52
To display the File List, click the Files tab at the bottom-left of the Project
Browser (the main MDI window).
Make sure that all Projects in the File Lists Project Tree are checkmarked.
Click into the File List and choose Edit > Select All,
then Right-click > Check In.
53
Depending on the version control system you use, the Workspaces may
be attached to the Repository node indirectly. That is, they are attached
to a Configuration node, which is in turn attached to the Repository (for
more information, please see Workspaces, Configurations, and Branches
page 263).
Note to ClearCase Users
If you are using ClearCase, the Repository node has no ClearCase-specific functionality. However, you (and SNiFF+) use this
node as a point of reference for adding new Workspaces.
54
Whichever system (Flat or Hierarchical) you use, you will have to tell all
team members where on the file system the Repository (or the ClearCase VOB) is located.
Note that you will only have to tell people this (and the other things
mentioned below) if they each use their own, user-level Workspace
Configuration Directory.
If a common, site-level location is used, you neednt tell them anything,
you will have to do everything for them.
Tell team members the name of the Project the Wizard has just created for you.
Continue with the chapter New Team Members (Flat Workspace System) page 57.
Tell team members the file-system location of the root directory holding your source code (the one you entered in the Wizard). This is
known as the Workspace Source Root, and will also be accessed by
all other Workspace.
55
56
9
New Team Members (Flat
Workspace System)
Overview
Introduction page 58
9.1 Introduction
If you want to set up a Hierarchical Workspace system, youre in the
wrong chapter; go to New Team Members (Hierarchical Workspace System) page 65.
One person (The First Team Member page 48) imports code into
SNiFF+ by creating a Project, a Workspace, and a Repository. (We
assume that this has been done. If not, youre also in the wrong chapter;
go to Team Workspaces from Scratch page 45.)
In a Flat Workspace system, each related Workspace must access the
same Repository. (Related here means the Workspaces used by developers working on the same software system.)
If you are not The First Team Member page 48, and if you use your
own, user-level Workspace Configuration Directory (see Autonomous
Workspace Configuration page 42), you will not see the Repository or
the Workspace that has already been created.
In this case, continue with Create a Repository Node? page 59.
If you are The First Team Member page 48, or you are using a common, site-level Workspace Configuration Directory (see Site-Level Workspace Configuration page 44), you will see the Repository and the
Workspace that has already been created.
In this case, continue with Create a New Workspace page 60.
56
Your first step is to ask the The First Team Member page 48 where the
team Repository (ClearCase VOB) is located.
57
ClearCase: navigate to the (directory in) the view of the VOB you will
work in.
In the Project and Makefiles Files Location field, accept the default.
We assume that The First Team Member page 48 also accepted the
default.
To synchronize team Workspaces correctly, the name and relative location (default: immediately below the Source Root), must be the same in
each related Workspace.
Click Add.
In the Workspace Manager you will see a new Workspace suspended
from the Repository.
56
57
To check out the Project, highlight the newly created Workspace, and
Right-click > Scan Repository.
The box that appears shows a list of all Project Description Files in the
Repository.
Click into the list and type the first few letters of the Project name. When
the list positions to the correct file name, click the Check Out button.
Note
This is not possible for all version control systems (e.g. CVS).
If you are using a version control system where this is not
supported, copy the root Projects Project Description File
(.proj extension) from the first Workspace to the new
Workspace.
Whether you copy it to the Source Root directory, or the
Generated Files directory will depend on how the Workspace you are copying from is set up (checkbox below Generated Files Location field in the Workspace Properties).
After you have copied the root Project Description File, proceed as described under Open the Project page 62
In the Workspace Manager, you should see the Project on the right.
If not, on the Workspace,
Right-click > Update Project Tree
56
SNiFF+ recreates the Project structure, and checks out all the files to the
new Workspace. When this is done, the Project is opened in the new
Workspace, and you are ready to start work.
57
56
10
New Team Members
(Hierarchical Workspace
System)
Overview
Introduction page 66
65
10.1 Introduction
If you want to set up a Flat Workspace system, youre in the wrong chapter; go to New Team Members (Flat Workspace System) page 57.
One person (The First Team Member page 48) imports code into
SNiFF+ by creating a Project, a Workspace, and a Repository. (We
assume that this has been done. If not, youre also in the wrong chapter;
go to Team Workspaces from Scratch page 45.)
The first Workspace created by The First Team Member page 48 is
the one that will be shared. That is, all other related Workspaces will
access (depend on), and inherit from, this shared Workspace. (Related
here means the Workspaces used by developers working on the same
software system.)
The shared Environment will not generally be used for day-to-day development. It will be a reference Environment containing the most stable,
canonical code.
Each developer needs (at least) one dependent Environment that
accesses the shared Environment.
If you are not The First Team Member page 48, and if you use your
own, user-level Workspace Configuration Directory (see Autonomous
Workspace Configuration page 42), you will not see the Repository or
the Workspace that has already been created.
In this case, continue with Create a Repository Node page 67.
If you are The First Team Member page 48, or you are using a common, site-level Workspace Configuration Directory (see Site-Level Workspace Configuration page 44), you will see the Repository and the
Workspace that has already been created.
In this case, continue with Create a Dependent Workspace page 68.
66
Your first step is to ask the The First Team Member page 48 where the
team Repository (ClearCase VOB) is located.
You need to know the Source Root location of the Workspace created by
The First Team Member page 48.
Remember, this will be the Workspace that you share.
67
In the Project and Makefiles Files Location field, accept the default.
We assume that The First Team Member page 48 also accepted the
default.
To synchronize team Workspaces correctly, the name and relative location (default: immediately below the Source Root), must be the same in
each related Workspace.
Click Add.
In the Workspace Manager you will see a new Workspace suspended
from the Repository.
You should also see the Project tree on the right.
If not, on the new Workspace node,
Right-click > Update Project Tree
This node represents the Workspace that you will be sharing. Your next
step, therefore, is to a create Workspace for yourself. That is, the one
where you will actually work.
In the Project and Makefiles Files Location field the Generated Files
Location fields, accept the default.
(We assume that The First Team Member page 48 also accepted the
default.)
68
Click Add.
In the Workspace Manager you will see a new Workspace suspended
from the node of the Workspace that you want to share.
You should also see the Project tree on the right.
If not, on the new Workspace,
Right-click > Update Project Tree
10
69
70
11
Managing Workspaces
Overview
Introduction page 72
Creating a New File Type for the Build Properties File page 76
71
11.1 Introduction
As long as your Workspaces are consistent in terms of internal structure
(see Location of Root Directories page 24), you can reorganize them
at any time.
That is, you can, for example, move from a hierarchically layered system
to a flat system, or start version controlling a previously non-version-controlled Environment quite easily.
First, close any Projects that may be open in Workspaces you want to
move/modify.
72
Managing Workspaces
Workspace Properties
The Owner of a Workspace is, by default, the login name of the person
who created the Workspace.
Advanced
Locations for building on remote machines, and for redirecting build output to absolute locations are set here.
Specifying an absolute path for redirecting build-output can be useful for
improving build-performance. If your sources (and, more specifically, your
Generated Files location) are mounted over a network file system, for
example, build-time performance will naturally improve if the output is
written to a local disk.
(See also Remote Build and Debug page 197.)
73
11
74
Managing Workspaces
Version-Controlling Build Properties
75
11.5.2 Creating a New File Type for the Build Properties File
Whether you create a special Project for the Build Properties file, or simply add the file to an existing Project, you will probably have to create a
new File Type for it.
New File Types are best created in the Preferences. You can open the
Preferences either from the Workspace Manager, or the main Project
Browser.
The following outlines the minimum necessary steps for creating the new
File Type. (See Creating New File Types page 106 for more information.)
76
Managing Workspaces
Version-Controlling Build Properties
Figure 11-1
11
In the box that appears, enter a name for the new File Type, for example,
sniff_stuff
You do not need a special subcategory. Unless you want to, for example,
associate a special icon with this File Type, you can leave the Subcategory field blank.
*.sniff.*
All files with the above filename pattern (not a regular expression!) will
now be recognized as belonging to the sniff_stuff File Type (or
whatever you named the new File Type, above).
77
In the Workspace Manager, highlight the Workspace for which you want
to create the Build Properties Project.
In the Wizard
In the first Wizard page, click Browse... and navigate down to the Project
and Makefiles Location, normally (if you accepted, and have not since
modified, the defaults offered by SNiFF+ when the Workspace was first
created): you would navigate down to
<Source_Root>sniff_data/.sniffwe.Vn.nn:
If you proceeded as described under Creating a New File Type for the
Build Properties File page 76, the Wizard will recognize the Build
Properties file. Click Next.
In the final Wizard page give the Project a reasonable name that you will
later recognize, and click Finish.
The Build Properties can now be version controlled like any other
normal file.
78
Part IV
Working with Projects
Project Creation
Documenting Projects
Synchronizing Projects
80
12
Project Creation
Overview
Introduction page 82
81
12.1 Introduction
We assume that you are familiar with the SNiFF+ concepts, Project and
Workspace.
If not, please refer to Projects and Workspaces page 11, or at least
make sure you know what is meant by the terms Source Root and Generated Files Location (see TerminologySource Root, Project and Makefiles Location, Generated Files Location, and Repository page 21).
82
Project Creation
Wizard or Template?
Both the Wizard and the Template method can set many default properties for Projects.
However, not everything is or can/should be generically set. In this
context, please refer to Post-Setup Project Tuning page 87.
You can use the Wizard to create a Project and a new Workspace all at
once.
Using a Template, you first create (must have) a Workspace, and then
only can you create the Project.
The Wizard actually takes some of its default information from a Project
Template named default. So, be sure not to (re-)move this Template!
83
12
If you have used the Workspace Manager in the current SNiFF+ session,
make sure no Workspace is highlighted. You can deselect highlighted
Workspaces with the <ESC> key, or you can close the Workspace
Manager.
If a Workspace is highlighted, the Wizard will attempt to create a Project
using this Workspace, which is what the following section is all about.
Both the Project Creation Wizard and a Project Template let you create
Projects within existing Workspaces.
Using a Template, you must first create (have) a Workspace, and then
create the Project.
84
Project Creation
Project Creation in Existing Workspaces
Select the Project type that most closely approximates the Project you
intend creating.
A default Name for the Project is taken from the directory name; you
might want to change this.
If you do not select the Scan for existing files option the Project knows
a number of standard file types based on the Project Type you selected
above. If you select the option, the Wizard scans the directory tree and
presents a list of File Types (not) recognized by SNiFF+.
Note that if, for example, you create a new File Type here, this applies for
the current Project only. To make the File Type available also for future
Projects you would make the necessary changes in the SNiFF+ Preferences (see Creating New File Types page 106).
85
12
No Build Support
This option is for (sub-) projects athat you only want to browse, for
example, third party library code.
After the sources have been parsed and the necessary information
generated, the Project is opened in the Project Browser.
86
Project Creation
Post-Setup Project Tuning
87
12
88
Project Creation
Absolute Projects
89
12
90
13
Working with Projects
Overview
91
In the Welcome dialog, choose from a list of recent Projects. The list
shows recently opened projects in the form
92
Administration only
If you have very large Projects, and you need to open them for purely
administrative reasons, e.g. structural changes, you can save time by
opening them without symbol information.
Building
Note that if you want to build Java Projects, you must open them with
symbol information. This is because the SNiFF+ Java Build Support uses
symbol information.
To build C/C++ and other Projects, you can open them without symbol
information.
93
13
Locked database
This is only really applicable to Projects in hierarchically layered Workspaces, or in situations as described under Special Case: Stand-Alone
Analysis Environment page 39.
If a higher level (shared) Workspace has an exclusive lock on the crossreference and dependency database (for example, during an update),
you can still open Projects in lower-level (or even the same) Environments without symbol information. (For more detailed information, see XRef Database Access Control page 416.)
Changes are made to Projects and files between SNiFF+ sessions, that
is, outside of SNiFF+,
94
Select the Workspace where you want to change the default openingmode and Right-click > Properties....
95
13
96
Use the Other Files tab to see files that are not in checkmarked Projects,
but that are located in Project-related directories.
If you use SNiFF+ Build Support, Projects are built in the order they
appear (from bottom to top at each level) in the tree.
For Java Projects, the Project structure must conform to the package
structure.
Drag-and-Drop
The easiest way to modify Project structure and content is by drag-anddrop.
To add a (new) file to a Project, highlight the Project, and use the
Right-click > File > Add commands.
If the file is not of a type that the Project knows, SNiFF+ checks the Preferences.
If SNiFF+ finds a defined File Type in the Preferences that matches the
signature, it is added to the Project, and so is the file.
If not, SNiFF+ will not add the file. In this case you would first have to
define a File Type, either in the Project Properties dialog, or (recommended) in the Preferences. Please refer to Creating New File Types
page 106 for more information.
97
13
To add a (new) Subproject, highlight the Project you want to add it to and
use the Right-click > Subproject > Add commands.
If you add new Subprojects, that is, create and add in one step, please
be aware of the consequences if the new Projects sources lie outside
the currently open Projects Workspace Source Root (discussed under
Absolute Projects page 88).
98
99
13
100
General Node
These are mostly per-Project settings defined during Project creation.
Build-related Nodes
Please refer to
SNiFF+ PRO Build System Concepts page 219 for more detailed
information.
Build Options: Build-target names and the Build Tool used to build the
target naturally have to set on a per-Project basis.
Build Tool Settings: Workspace settings are used here by default. If you
need to modify them at Project level, only the differences are stored by
the Project. (The icon to the left of each field indicates which level is
used.)
Java Build Options: These are per-Project settings. In most cases,
these will be the same for all (checkmarked) Projects. As long as the
sourcepath begins somewhere below the Source Root location, the
difference can be generated during Project creation.
Parser Node
Preferences/Template determine defaults.
101
13
102
14
Working with File Types
Overview
103
Programming language, if any, and therefore which parser to use, applicable syntax and keyword highlighting, and other language-specific
details.
104
14
105
In the File Types node, either select a File Type that looks like it comes
close to the Type you want to create and click Copy, or click New.
In the box that appears, enter a name for the new File Type.
From the Category drop-down, select the entry that seems most appropriate. If in doubt select Other.
These Categories are predefined and you cannot create any new ones.
The Categories are used only for grouping (filtering) Subcategories in the
Categories node.
The Language drop-down lets you select a named group of programming-language-related properties as defined in the Languages node.
Since these properties relate to which parser is used, keyword highlighting, and syntax details, it will generally not make much sense to
create new languages (such property groups for all languages supported
by SNiFF+ are already provided).
The Signatures field lets you enter file-naming patterns (not necessarily
only file name extensions) that SNiFF+ will recognize as belonging to a
particular Type. If you enter multiple patterns, use a colon (:) as separator. Use an asterisk (*) as wild card.
Note that each compilable File Type can be associated with only one
Build Tool. For multi-step processing you would have to assign a File
Type for each intermediate product (see also below).
106
An existing object or class file, although derived from a source file, is not
generally subject to further modification. Any further handling (archiving,
linking) is therefore delegated entirely to the Build System, and these files
do not require any specific File Type.
Derived File Types differ from Normal File Types in that the former is
dynamically recognized. That is, if a Project knows about a Derived Type,
files of this type are automatically displayed and/or further processed if
and when they come into existence. On the other hand, a file of Normal
Type is ignored unless it has been explicitly added to a Project.
you want to be able to view/edit the derived products, and therefore want
to access these files from SNiFF+ File Lists.
you want to version control the generated products from within SNiFF+
(see previous point).
107
14
C++ Compiler
Intermediate
Derived File Type 2
(e.g. IDL-Server)
Final output
products (e.g.
object files).
No File Type
necessary
Example: IDL
The IDL compiler generates, for example, client- and server-side files
that are then further processed by a C++ compiler.
It would not be enough to create a File Type called, for example,
IDL_Output.
SNiFF+ has to be able to distinguish between the different Derived File
Types (client- and server-side) generated from IDL Interface Files in
order to generate unambiguous rules for creating final products.
(For information on how setting up IDL Projects, see IDL Projects
page 187.)
108
Caution!
In the Preferences, File Types node, Derived Settings tab, you can specify:
Whether you want to see the generated files of the Derived File Type in
File Lists.
And, whether SNiFF+ should scan directories for more than one generated file per Derived Type and input file.
If the derived files are not needed for further processing, you can
select this checkbox. However, be aware that SNiFF+ always has
scan entire directories to ensure that it finds all possible derived files
in order to display them.
109
14
110
15
Working with Fortran
Overview
111
112
In the Project tree at the right, checkmark the Projects with free-form files.
From the drop-down above the File Type Settings group, choose
Replace in Checkmarked Projects
Click Apply.
From the drop-down above the File Type Settings group, choose
Replace in Checkmarked Projects
Click Apply.
You have now changed the Language associated with the FortranImplementation and the Fortran-Header File Types in the checkmarked Projects. A different Parser will therefore be used for the files in
these Projects.
113
15
Figure 15-1
After you have closed the Project Properties, you have to reload and reparse the Project so that the changes take effect. To do so, choose
114
Then make sure all Projects are checkmarked in the Project Manager and
choose one of the Project > Reparse commands.
Now select the Fortran-Header File Type, and in the Language dropdown, select Fortran-Free.
Click OK.
Because you have changed the Language associated with the FortranHeader and the Fortran-Implementation File Types, a different Parser
will be used for all future Wizard-created Projects.
115
15
-lnnn
whereby nnn is the line length
Default: 72
-tnn
whereby nn is the number of spaces a tab is interpreted as
Default: 6
-e
Case Modes
116
15
117
118
16
Documenting Projects
Overview
119
16.1 Introduction
The SNiFF+ Documenter works for Java Projects and C++ Projects. Documentation is generated as an inter-linked system of HTML files to a
directory of your choice.
Be aware that:
generating documentation for large projects takes a lot of time and memory
cross-references to Projects/Java packages outside the currently generated documentation set cannot work
120
Documenting Projects
Generating C++ Documentation
generated class descriptions, as well as enumerators, variables and functions declared outside of classes.
121
The first line starts with the begin-comment symbol ( /** ) followed by
a return.
122
Documenting Projects
Documentation Comments
@author <text>
Creates an Author entry (if the Author option is selected in the Documenter dialog). The text has no special internal structure.
A comment may contain multiple @author tags.
@version <text>
Adds a Version entry (if the Version option is selected in the Documenter dialog). The text has no special internal structure. A comment
may contain at most one @version tag. Version normally refers to the
version of the software that contains this feature.
@return <text>
Adds a "Returns" section, which contains the description of the return
value.
123
16
@since <text>
Adds a "Since" entry. The text has no special internal structure. This tag
means that this change or feature has existed since the release number
of the software specified by the since-text.
@see
Adds a hyperlinked "See Also" entry to the entity.
Examples:
@see #<symbolname> works if <symbolname> is a member of
the same class.
The character # separates the name of a class or interface from the
name of one of its fields, methods, or constructors.
One of several overloaded methods or constructors may be selected by
including a parenthesized list of argument types after the method or
constructor name.
Whitespace in @see's classname is significant. If there is more than
one argument, there must be a single blank character between the arguments.
A comment may contain more than one @see tag.
@see classname
Adds a hyperlinked See Also entry to the class.
Note
An URL (as follows) is not allowed in an @see tag if you use JDK
1.1.x:
124
17
Synchronizing Projects
Overview
125
17.1 Introduction
SNiFF+ provides updating mechanisms to ensure that all members in
your development team are working on the latest, most stable version of
your software system. Updates and builds of Projects in Workspaces can
also be done outside of active SNiFF+ sessions, for example, also overnight.
126
Synchronizing Projects
Synchronizing Projects within SNiFF+
127
17
This will open a Wizard allowing you filter according to file and directory
name patterns, as well as a number of other options.
sniffpython
This is a Python interpreter.
updateWS.py
This Python script is located in SNIFF_DIR4/etc.
The script starts SNiFF+ in batch mode (see also SNiFF+ in Batch Mode
page 130), or connects to a specific SNiFF+ session and synchronizes Projects in a given Workspace. Projects are updated with respect
to the latest file revisions, or with respect to specified Configurations, in
your Workspace.
After an update, SNiFF+ can create a log file with a summary report in
directories where the updateWS.py script was executed. This
summary report can also be automatically sent to you by e-mail (if e-mail
address and mail server are specified).
128
Synchronizing Projects
Synchronizing Projects Outside of SNiFF+
syncProject.py
This Python script is located in SNIFF_DIR4/etc.
The script starts SNiFF+ in batch mode (see also SNiFF+ in Batch Mode
page 130), or connects to a specific SNiFF+ session and synchronizes Projects with on disk changes that occurred outside of SNiFF+
control.
After synchronizing, SNiFF+ can create a log file with a summary report
in directories where the syncProject.py script was executed. This
summary report can also be automatically sent to you by e-mail (if e-mail
address and mail server are specified).
SNIFF_DIR4/bin
The LD_LIBRARY_PATH environment variable should point to
SNIFF_DIR4/lib
Start external Workspace updates from any Shell and call the script (all in
one line):
sniffpython $SNIFF_DIR4/etc/updateWS.py \
-ws <Workspace> -project <Project> [options]
Start external disk synchronization from any Shell and call the script (all
in one line):
sniffpython $SNIFF_DIR4/etc/syncProject.py \
-ws <Workspace> -project <Project> [options]
On Windows
To ensure that the Python interpreter can be called elsewhere in a Command Prompt, the PATH environment variable should point to
SNIFF_DIR4\bin
SNIFF_DIR4\lib
SNIFF_DIR\bin\gnu-win32
129
17
Start external updates from the Command Prompt and call the script (all
in one line):
sniffpython %SNIFF_DIR4%\etc\updateWS.py \
-ws <Workspace> -project <Project> [options]
Start external disk synchronization from the Command Prompt and call
the script (all in one line):
sniffpython %SNIFF_DIR4%\etc\syncProject.py \
-ws <Workspace> -project <Project> [options]
130
On Unix, unattended updates can be run using the cron (crontab) utility.
On Windows NT, unattended updates are run using a utility like, for example, at.
Synchronizing Projects
Update Script Parameters
[-help]
Show help message (usage summary).
Default: no help message will be shown.
131
-ws <Workspace>
Refers to the Workspace where Projects are to be updated.
Enter the full hierarchy of the Workspace (including the Workspace
Default Configuration), as displayed in the Workspace Manager. The
hierarchy always starts with a slash, each layer in the hierarchy is also
separated by a slash.
(When a Project is open, this hierarchy is displayed in the Project
Browsers title bar - after the relative Project path used in the project
parameter, see below.)
Example
/Repository/HEAD/common/complex
-project <project>
The specific Project that is to be updated. A Project is specified by the
relative path with respect to the Workspace Root directory (see
Workspace parameter above) and the physical Project Description File
name (as displayed in the Project Browsers title bar, where it is followed
by the - Workspace parameter, above).
Example
complex/complex.proj
[-noUpdate]
Prevents a Update of the Project. This may be useful in case you just
want to build.
Default: update files of Project.
[-noBuild]
Prevents a recursive Build of the Project after the update.
Default: build target (Workspace default Platform).
{-buildFlag <aFlag>}
Build flag, for example -i. The flag value will be directly handed to the
Build. Therefore you have to know the syntax of flags. In the given
example, the minus sign is mandatory.
Default: no flags will be used.
[-buildPlatform <platform>]
Specify a Platform other than the default platform to build target.
Option can be specified more than once to build target for multiple platforms.
Default: build target for Workspaces default Platform.
132
Synchronizing Projects
Update Script Parameters
[-buildLog <file>]
File to save Build log information.
Default: a generated file name will be used.
[-noClean]
Prevent a recursive clean of the Project after the update.
Default: clean target before building it.
[-referenceTime <aTime>]
Update on a certain time stamp.
The time stamp format is YYY/MM/DD HH:MM:SS.
Default: recent file version will be used.
[-forceReparse]
Force a reparse of the Project.
Default: no reparse of Project will be done.
[-upDateIndex]
Update Retriever index.
Default: no update of Retriever index
[-updateXRef]
Force update of Cross-Reference Information.
Default: no update of Cross-Reference information.
17
[-projectDiffs]
List files added to/removed from Projects in update-log file.
Default: not listed.
[printTiming]
Show how long each operation takes.
Default: not shown.
[verbose]
Print informational text to stdout.
Default: non-verbose.
133
[-help]
Show help message (usage summary).
Default: no help message will be shown.
-ws <Workspace>
Refers to the Workspace where Projects are to be updated.
Enter the full hierarchy of the Workspace (including the Workspace
Default Configuration), as displayed in the Workspace Manager. The
hierarchy always starts with a slash, each layer in the hierarchy is also
separated by a slash.
(When a Project is open, this hierarchy is displayed in the Project
Browsers title bar - after the relative Project path used in the project
parameter, see below.)
Example
/Repository/HEAD/common/complex
134
Synchronizing Projects
Update Script Parameters
-project <project>
The specific Project that is to be updated. A Project is specified by the
relative path with respect to the Workspace Root directory (see
Workspace parameter above) and the physical Project Description File
name (as displayed in the Project Browsers title bar, where it is followed
by the - Workspace parameter, above).
Example
complex/complex.proj
[checkin]
Check in modified and newly added files.
Default: not checked in.
[absolutePaths]
Consider non Workspace-relative paths.
Default: not considered.
[connectProjects]
Add existing project definition files as sub-projects.
[createProjects]
Create Subprojects for new directories.
Default: Projects will be created; set to zero to disable.
17
[projectTemplate]
Template for new projects.
Default: default.ptmpl
[exclude <patterns>]
File and directory exclusion patterns (blank-separated list).
Default: *.bak *~ #* *,v'
[include <patterns>]
Additional file inclusion patterns (blank-separated list); that is, patterns
not belonging to recognized Project File Types.
Default: none
[recursive]
Scan directories recursively.
Default: Directories scanned recursively; set to zero to disable.
135
[dry]
Dry run; do not modify any files, report only.
Default: not dry.
[projectDiffs]
Report added/removed files after synchronization.
Default: No report
[printTiming]
Show how long each operation takes.
Default: not shown.
[verbose]
Print informational text to stdout.
Default: non-verbose.
136
Part V
SNiFF+ PRO Build/Debug: How To
C/C++ Projects
Java Projects
Ada Projects
IDL Projects
138
18
C/C++ Projects
Overview
139
140
C/C++ Projects
Setting C/C++ Targets and the Debugger Adaptor
Figure 18-1
In the navigation tree at the left, select the Build Options node.
Project Properties Build options
18
141
You would use the Ignore Dependencies to option only for Subprojects
you have added for browsing-only purposes. For example, you have
added a third-party library you want to browse. However, you do not want
the Build System to generate dependencies into this library, and subsequently therefore, to rebuild the dependent files if headers have changed.
If you change this setting, you need to reparse after you close the Project
Properties (choose Project > Reparse).
In the Project Tree at the right, highlight the Project you want to set a (any
kind of) target for.
Target Definitions
From the Build Tool drop-down, select the tool that will determine the
kind of target you want to build. For example, to build an executable, you
would select the Linker entry.
142
C/C++ Projects
Setting Include Paths
If you did not select the Linker to build an executable target, but, for
example, Librarian to build a library, the Passed to Superproject setting
for the defined target is enabled. This means that the target can be
exported to be linked into another target further up in the Project hierarchy.
18
143
Your default Platform for the current Workspace will already be selected
in the Platform drop-down.
In the Build Tool list, select C++ Compiler (or C Compiler, as the case
may be).
After clicking Apply, if you did not generate includes for all Platforms, use
the Edit All Platforms... button to open a dialog box where you can
selectively apply/edit the currently highlighted build tool setting (current
Project only) for other platforms.
In particular, you would probably want to set the includes also for the
other Platform-variant (debug or release ).
144
C/C++ Projects
Setting Include Paths
Figure 18-2
18
If your source files also include headers outside the current Project structure, set these at Workspace level!. Please see C/C++ Include Directives
page 229 for more information.
145
From the Platforms drop-down, select each Platform you use in turn, and
proceed as follows.
146
C/C++ Projects
Verify Tool Settings
Figure 18-3
Note that the Workspace Build Properties must be writable (checked out)
for this to work.
Promote Build Tool Settings to Workspace Level
18
147
148
19
Java Projects
Overview
Setting Java Application Targets and the Debugger Adaptor page 153
Compiler Flag for JDK 1.1.x (-c Command Line Length) page 158
149
150
Java Projects
Identify Libraries for Browsing Only
If you created the Project using a Project Template, you need to generate/set the path to source code packages and, optionally, the destination directory for generated classes (the -sourcepath and -d
options). If your source packages start below the Workspaces Source
Root, the source path can be generated. If your packages start outside the Workspaces Source Root, you will have set an absolute path
(usually using an environment variable).
If you created the Project using the Wizard, and your source packages start below the Workspaces Source Root, the Wizard will have
generated the source path and a corresponding output directory
already (the -sourcepath and -d options); you need not do anything. If, however, your packages start outside the Workspaces
Source Root, you will have set an absolute path (usually using an
environment variable).
6. If your Project uses external (third party) class libraries that are not part of
the Project, you need to set the appropriate classpath(s).
In the navigation tree at the left, select the Build Options node.
19
Make sure none of your own Projects (the ones you want to build) are
checkmarked.
151
Figure 19-1
152
Select (highlight) the library root node (in Figure 19-1 this is the
jdk_src Project); collapse and checkmark it. This will automatically
checkmark all its subnodes. Note again: the collapsed library root Project
must be checkmarked and highlighted.
Java Projects
Setting Java Application Targets and the Debugger Adaptor
In the navigation tree at the left, select the Build Options node.
In the Project Tree at the right, highlight the Project where a main
method is implemented.
Click the New... button.
In the box that appears, enter the exact name (case-sensitive, no extension!) of the class implementing main.
When you close the box, the target name appears, and is highlighted, in
the Target Definitions list.
You will notice that the Debugger Adaptor drop-down is now also
enabled. From the Debugger Adaptor drop-down choose:
If you use the SDK 1.2.2 or higher, in the second drop-down, select
sniffjdb JPDA (java 2)
Repeat the above steps for any other application classes in your Project.
153
19
To do so, you would select any Java File where a main (or init )
method is implemented and choose
Right-click > Add to Execution Targets.
154
SNiFF+ Projects use the Workspace Source Root as their point of reference.
The generated source path is therefore the relative path, if any, from the
Workspace Source Root to the start of your packages. Because this path
is relative, it will be the same for all Workspaces.
Java Projects
Setting Java Build Options
If the start of your packages lies outside the Workspace Source Root,
however, a relative path that can be used by all team members cannot be
properly calculated.
The solution is to set the source path using an environment variable.
That way, different users can set the same variable name to point to
different absolute paths.
The environment variable is set outside of SNiFF+. Within SNiFF+, you
set the source path for the Project by entering the variable name, not the
actual path. The Project thus knows only the name of the variable.
However, at build-time, the variable is expanded to whatever it is set to in
the current users environment.
If your code does not use packages, all files must be in the Source Root
directory of the Project, and you neednt set anything.
155
19
If you simply enter a name, a directory of this name will be created below
the Platform Redirection Directory when the Project is first built.
If you use an absolute path (environment variable), the directory must
exist.
1. In the Output Directory field, enter either a name for a new directory to
be created below the Platform Redirection Directory, or (not recommended) an absolute path, or an environment variable (in the form
$VariableName).
2. Generally, you will generate all classes below this root directory. So, in the
Project Tree at the right, checkmark all (Java) Projects.
3. In the drop-down next to the Output Directory field, select
Checkmarked Projects.
4. To apply the settings, click Apply.
For a .jar or .zip file that contains .class files, the path ends
with the name of the .zip or .jar file.
For .class files in an unnamed package, the path ends with the
directory that contains the .class files.
For .class files in a named package, the path ends with the directory that contains the root package (the first package in the full package name).
2. You can use the Preview button to see exactly what is written to the Build
Support files.
3. To apply the settings, click the Apply button.
All Projects will now be able to find the libraries.
156
Java Projects
Verify Compiler and Other Java Tool Settings
If this is the first Project-Build you are setting up, you might want to check
that the correct tools are set. Here, we will look at the Java compiler as an
example.
Also, if you are using JDK 1.1.x, you have to modify a compiler flag.
From the Platforms drop-down, make sure the entry that corresponds
most closely to your compile-time system is selected. For Java this basically means either any Unix, or any Windows Platform.
In the Build Tool list select SniffJMake
If you do not see SniffJMake in the list, this means there are no Java
files in the Project highlighted in the tree on the right; highlight a Project
that does have Java files.
Is this the correct compiler? If not, in the Edit field, enter the correct
value, and modify the other fields as necessary.
You can also use the Edit All Platforms... button to selectively apply/edit
the currently highlighted build tool setting (current Project only) for other
platforms.
In particular, you would probably want to do this, at least, for the other
Platform-variant (debug or release).
You will notice that the icons next to modified fields change from a Workspaces icon to a Project icon. This indicates that changes apply to the
current (highlighted) Project only, which is probably not what you want for
a setting like this.
So, read on under Promoting Build Tool Settings to Workspace Level
page 158.
(See also Modifying Build Tools and Settings page 205.)
157
19
19.6.2 Compiler Flag for JDK 1.1.x (-c Command Line Length)
In the Build Tool Settings, the SniffJMake Build Tool has is a field
named SNIFFJMAKE_FLAGS.
The preconfigured tool call command, SniffJMake, is optimized for SDK
1.2.x. That is, the compiler is passed a file list for compilation.
However, if you are using JDK 1.1.x compilation lists are not supported,
and you have to pass the -c flag, with your maximum command line
length, to the javac compiler.
To do so, you would highlight SNIFFJMAKE_FLAGS, and in the Edit
field, enter the value for the field as:
-c 1024
(assuming a maximum command-line length of 1024 characters).
As soon as you hit <Tab> (leave the field), you will notice that the icon
next to the SNIFFJMAKE_FLAGS field changes from a Workspace icon
to a Project icon. This indicates that changes apply to the current (highlighted) Project only, which is probably not what you want for a setting
like this.
So, read on below.
158
Java Projects
Building Java Projects
First, to make sure the Build-Support files are up to date, highlight your
top-most Project, and choose
Build > Update Build-Support Files
To build any other kind of defined Target, highlight the Project for which a
target is defined, and choose
Build > Build > Platform Target.
If a Target depends on *.class files (e.g. a JAR), these must first
exist.
An individual file (and necessary dependencies). The file must have focus
(either in the Source Editor, or highlighted in a File List):
Build > FileName.class
159
Highlight the top-most Project of the tree you want to rebuild, and choose
Build > Build > clean
This will remove all existing class files in the tree, up to and including
those for the highlighted Project.
Now change the Platform selection in the Builder (Tools > Builder), and
rebuild.
Or, change the Output Directory value in the Project Properties, Java
Build Options (see Setting the Output Directory Path page 155).
Now change the Platform selection in the Builder (Tools > Builder), and
rebuild.
in debug mode
160
Java Projects
Remote Java Debugging
See also Remote Java page 203 for notes on build and debug on a
remote physical machine.
Click OK to connect.
19
On Windows
Make sure your PATH environment variable points to
SNIFF_DIR4\lib\java\jpda\win
On Unix
Make sure your LD_LIBRARY_PATH environment variable points to
SNIFF_DIR4/lib/java/jpda/<platform>
161
Operating System
On Windows, you can use the shared memory (dt_shmem ) transport.
With the shared memory transport, the debugger and the target VM must
reside on the same physical machine.
In all (other) cases you can use socket (dt_socket) transport.
162
Java Projects
Remote Java Debugging
This port address is the one you need to connect to the target VM from
the debugger VM. (Please refer to the Sun documentation mentioned
above for more information, especially also in connection with the
Xrunjdwp sub-options.)
Now, in the SNiFF+ Debugger start-up dialog:
-attach
In the end field (after -attach) enter the address generated above.
Click OK to connect.
19
163
164
20
Ada Projects
Overview
165
one of the GNAT versions listed under What You Need (General) page
166, as well as
the corresponding (2.x or AE) GNATPro for VxWorks package(s) for your
target CPU(s)
166
Modify the entry in the Executable field (the command line calling the
debugger) as needed.
Ada Projects
GNAT and Tornado/VxWorks Requirements
Highlight the Workspace for your Tornado Projects, and choose Workspace > Properties...
Choose the Definition node (under Platforms, see Figure 20-1 Make a
Platform Copy page 168).
20
167
Figure 20-1
After creating a copy Platform, you need to modify four settings in the
copy (you do all this in the Workspace Properties).
The first two relate to the location of Build output products and the setting
of the default Platform. The other two settings both relate to the output
file name extension (.exe).
Note that these latter two (Build Tool) settings are described here for
convenience (to keep all the Tornado/VxWorks-related information in one
place), you can only actually modify (see) them after you have integrated
GNAT (see Run the GNAT Integration Script page 170).
Platform Settings
In the Workspace Properties, select the Platforms node (see Figure 20-2
Set the New Platform page 169).
At top of the Settings group, select the name of your newly created copy
platform from the drop-down.
168
Ada Projects
GNAT and Tornado/VxWorks Requirements
Figure 20-2
From the Default Platform drop-down, again select the name of your
newly created copy platform.
Set the New Platform
In the Workspace Properties, select the Build Tool Settings node (see
Figure 20-3 Change the Output File Name Extension page 170).
In the Derived File Signature field, change the value ( *.out) to read
*.exe
169
20
Now, select the ADA_MAIN_UNIT field and, in the edit field below the
Field/Value table, modify the value to read
This completes the necessary Tornado/VxWorks related steps (on Windows, where applicable).
170
Ada Projects
What the GNAT Integration Script Does
On Windows
On Unix
Run SNIFF_DIR4/integrations/install.sh
The most visible effect of the script is that a new GNAT Pro menu
appears in the SNiFF+ Project Browser.
This menu provides direct access to some GNAT functionality and the
GNAT documentation.
The integration, less visibly, also modifies the SNiFF+ Build Support system.
171
20
If you do not use gmake, after running the GNAT integration script, open
the file:
SNIFF_DIR4/config/templates/template.general.incl
Look for the following lines (near the end of the file):
ifdef ADA_SEARCH_PATH
.PHONY: $(PROJECT_TARGETS)
endif
Open you Ada root Project in SNiFF+, and from the menu, choose
Build > Update Build Support Files...
172
In the box that appears, be sure to select Force Update, and click OK.
Ada Projects
Check Workspace Settings
Figure 20-4
This will ensure that the relevant Project Build Support file is also
recopied from the template you edited above.
First, make sure that all Projects are closed (at least in the Workspace(s)
you want to set).
In the Platforms node, make sure the correct platform is selected in the
Default Platform drop-down.
173
Select the Advanced Build Settings node (under Build Tool Settings).
Figure 20-5
174
Ada Projects
Setting Ada Targets and Debugger Adaptor
Figure 20-6
In the navigation tree at the left, select the Build Options node.
Project Properties Build options
20
175
Target Definitions
For Ada Projects, you can ignore the rest of the settings.
Close the Project Properties, and choose Project > Save All.
You are now ready to build the Project.
176
Ada Projects
Ada and C/C++ Mixed Language Projects
A basic requirement for building mixed language Projects is that you have
all the necessary tools installed, and that these are mutually compatible
and properly configured.
In other words, a build using SNiFF+ Build Support will only be
successful if a command-line build would also work.
Make sure the Project containing the main Ada procedure is highlighted.
In the Build Options node, make sure an executable target has been set
(see Setting Ada Targets and Debugger Adaptor page 175).
In the Build Tool Settings (see Figure 20-7 Selections in the Build Tool
Settings page 178):
177
20
Figure 20-7
-largs
followed by a space and the name(s) of the object files and/or libraries
(recommend if many C/C++ files) created from C/C++ sources that you
want to link with Ada products.
Arguments must be separated by a space (or, if you use the Edit...
button, enter one argument per line).
Enter the object/archive file names with extension, and with the path
relative to the location of the executable target.
Note: Relative here can mean different things, depending on how your
build system is set up.
If you use the standard SNiFF+ Build setup, that is with object redirection to subdirectories relative to the Workspace root directory, enter
the paths as follows
../relative_path_to_subdir/$(OBJ_DIR)/file.o
whereby $(OBJ_DIR) will be expanded by SNiFF+.
178
Ada Projects
Ada and C/C++ Mixed Language Projects
-largs %objects%
This syntax will be expanded to absolute paths by the SNiFF+ Build
service.
When you are finished, you will probably want to set these Project arguments for other Platforms as well, so click
Edit Multiple Platforms...
In the dialog box that appears, select the Overwrite tab, and then select
and set the required Platforms.
When you are finished you will notice that the icon next to the
ADA_POST_FLAGS has changed to a Project icon, indicating that the
setting is Project-specific, and does not apply to all Projects in the Workspace (you can right-click on the icon and use the context menu to promote the setting to Workspace level if this is what you want).
20
179
180
21
JAR, Java IDL, JNI, and RMI
Settings
Overview
181
21.1 Introduction
This chapter outlines the procedures for setting up Project Targets and
settings for the following preconfigured Build Tools:
182
IDL Java CompilerTarget Project contains IDL files you want to generate Java files from.
In the Project Properties, Build Options node, highlight the Project you
want to set a Target for (see also below for guidelines).
Click New, and, in the box that appears, enter a name for the Target.
Highlight the Target, and in the Build Tool drop-down, associate a Build
Tool with the Target.
In the Project Tree on the right, make sure the Project you have created
the Target for is highlighted.
In the Build Tools list select the tool you want to check.
Under the Command, you will see the selected Build Tools Fields and
their assigned Values.
In the following, only the most commonly needed options (Fields) for the
respective tools are mentioned.
Please refer also to the (Java) tool-specific documentation for syntax of
tool options.
21
183
JAR_FILES
By default, all classes in the package tree that the Project belongs to are
archived.
If you do not want to archive all classes in the package tree, click Edit, and
enter the names (with .class extension) of the classes you do want to
include. Direct entries (not using the Edit button), are separated by blanks.
If you only want to include certain (sub-) directories (=Subprojects), enter the
directory path.
For example, backoffice/*.class, this will archive only classes in
backoffice, and will not consider the rest of the package tree.
JAR_FILES_OPTION
`cat $(@F).lst`
The ` (accents graves, or backticks) above are necessary!
@ $(@F).lst
IDLJ
Make sure the value here corresponds to the compiler you have installed
(generally either idlj or idltojava).
IDLJ_FLAGS
If you have to change the IDLJ value, you will also need to check the flags
passed to the new compiler; see your compiler documentation for details.
JNI_CLASSES
Click Edit to enter the names (without .class extension) of the classes for
which native interfaces need to be compiled.
Note: The location of C/C++ shared library for which the interface is generated,
and which is subsequently used by the Java application has to be set outside
of SNIFF+.
RMI_CLASSES
Click Edit to enter the names (without .class extension) of classes
whose methods will be invoked remotely by clients.
21
185
186
22
IDL Projects
Overview
187
22.1 Introduction
This chapter outlines the steps for generating IDL client- and server-side
output ( *C.cc and *S.cc , respectively, as well as the *.hh files)
using SNiFF+ PRO Build Support.
The chapter closes on a few notes on browsing IDL code with SNiFF+.
22.1.1 Assumptions
We assume
188
IDL-Header (*.hh)
IDL Projects
Projects and Derived File Types
22.4 What to Do
22.4.1 Requirements
All IDL-derived files must be somewhere below (or be generated to) the
same Workspace Source Root.
You should know where (to which directory) you want IDL-client files to
go, and where you want the server files to go. These are referred to as the
IDL output target directories.
A SNiFF+ (Sub-)Project must exist for each IDL output target directory.
All such (Sub-)Projects are referred to in the following as the Project.
The IDL-Interface (*.idl) source files for generated output per target
directory must be added to the Project. The physical location of the
IDL-Interface files themselves is irrelevant; they need not lie in the same
Project directory.
189
22
If the target directory is to be for server-side files only (*S.cc and *.hh),
add the following File Types to the directorys Project:
IDL-Server Implementation
IDL-Header
IDL-Interface
Do not add the IDL-Client Implementation File Type!
If the target directory is to be for client-side files only (*C.cc and *.hh), add
the following File Types to the directorys Project:
IDL-Client Implementation
IDL-Header
IDL-Interface
Do not add the IDL-Server Implementation File Type!
When you build the Project, the correct IDL-compiler output files will be generated to the correct place; subsequently the *.cc files will be automatically
compiled by the C++ compiler.
You can of course generate both client- and server-side files to the same directories. In this case you would add all 4 IDL File Types to the Project(s).
IDL Projects
Browsing IDL
Information in IDL
definition of a type
type definition
definition/usage of a constant
constant
definition/usage of an attribute
instance variable
definition/usage of an operation
function
Note
Modal parameters (in, out, inout) and context arguments in IDL do
not have corresponding C/C++ data types.
22
191
192
23
Custom Build Setup
Overview
193
23.1 Introduction
Custom Build as used here refers to a Build System where you already
have your own make and make support files in place to control your
product-builds. In this case you may want to continue using your own
system and not change to using (full) SNiFF+ Build Support. However, by
appropriately identifying executable targets, you can still build, run and
debug these from within SNiFF+ using the Build menu. You might also
find it useful to use SNiFF+s Build Support files (for example, generated
dependency information) for your own custom Build Support.
194
Figure 23-1
In the Project Tree (File List, Symbol List, or Project Manger), highlight
the Project corresponding to the directory where the target is to be built.
This Project is referred to in the following as the Target Project.
195
23
196
Enter the name for the executable target as it appears in your Makefiles;
this name will later also appear in the Build menu. Click Next.
On the next page of the Wizard, select the required debugger adapter
and click Finish.
The following menus will now be enabled in the Build menu when the Target Project (above) is highlighted (the latter two will be enabled once the
target exists):
24
Remote Build and Debug
Overview
197
24.1 Introduction
You can build, run and debug applications from Windows to Unix, or Unix
to Unix.
All initial settings to do with building/running/debugging applications on
remote machines are defined at Workspace level.
Once you have set up the remote host(s) in the Workspaces, remember
to verify that Project Properties (debugger...) are also correctly set for the
remote machines Platform.
198
Optionally, define a remote machine as the default host to build, run, and
debug applications using a given Platform.
Verify that Project Properties are correctly set for the remote hosts Platform.
In the (Source Root Location) As Seen From Remote Host field, enter
the path to the directory specified in the Local field (that is, the Source
Root Location) as the remote host would see it.
If the remote host(s) sees the Source Root exactly as it is specified in the
Local field, you can leave this field blank.
If you use multiple remote hosts, all of them must be able to find the
directory using this path.
Caution: Not all debuggers support the use of environment variables. To
be in the safe side (for this and other reasons), we recommend that you
enter an absolute path without environment variables in this field.
To improve build performance on a remote host, you can specify an absolute path to redirect build output to the build host, rather than having to
write output back over a network file system. You do so in the
(Absolute Redirection Directory) Remote field.
24
199
In the Remote Build Host Settings node, click the New button. In the box that
appears, enter a name for the host.
The name you enter is a label used by SNiFF+ (and you) to identify the host
machine and its associated settings.
In the Name field, enter the machine name as you address it when you log in
on the remote machine.
In the Username field, if you access the remote machine with the same username as on the local machine, leave this field blank.
In the Password Request field, enter the string used by the remote system to
prompt you for your password (not your password itself).
In the Wait field, enter the number of seconds to delay execution in order to
ensure that a shell is up, running, and ready to execute.
Figure 24-2
In the Workspace Properties, select the Platforms node (under Build Tool
Settings).
Setting a Default Host for a Platform
From the drop-down near the top, select a Platform that conforms to a
remote host operating system.
From the Default Remote Build Host drop-down, select a default host to
associate with the Platform you selected above.
Whenever you build using the selected Platform, this host will be used by
default.
24
201
202
Note also that, if you do not use the IP address, set the display name
without the terminating :0.0.
If this does not work, and you have to use the terminating :0.0 to set
the display name, then you can modify the following file
SNIFF_DIR4/config/templates/remote_build.sh
Look for:
DISPLAY=$2:0.0
and change it to DISPLAY=$2
24
203
204
25
Modifying Build Tools and
Settings
Overview
205
25.1 Introduction
The SNiFF+ Build System uses Platforms to maintain information about
which tools are used to build targets for which operating system, and how
the target is to be built (for example, with or without debug information). A
number of these Platforms are preconfigured and supplied with
SNiFF+. Should you want to use, for example, a compiler other than the
one set in a preconfigured Platform, you can either change the settings in
an existing Platform or create a new Platform (copy of an existing one),
and change settings there.
206
To ensure that all newly created Workspaces use the changed settings,
you would change them in the Site-Level Preferences.
Once you are in the Preferences, the procedure is exactly the same as
you would go through at Workspace level.
So, below, we will only describe how to get to the right place in the Preferences. Once you are there, you can simply follow the steps as outlined
for Workspaces.
In the Preferences
25
207
If you use a version control system, you may first have to check out the
Workspace Build Properties information. To do so
Highlight the Workspace you are interested in and choose
Workspace > Build Properties > Check Out
In the Check-Out dialog box, use the Exclusive option.
(Build Properties are not something everyone should be hacking around
in at the same time.)
In the navigation tree at the left of the Properties, select the Platforms
node.
From the Default Platform drop-down, select the platform that corresponds most closely to the compile-time requirements you need most
often.
Now, in the navigation tree, select the Build Tool Settings node.
208
Edit the value of the CXX field, and also the values for the various
options.
Or (recommended and described below) create a copy of the Platform, and then modify the values in the copy.
In the Platforms list, select the entry that corresponds most closely to
your compile-time default requirements.
Click Copy and, in the box that appears, enter a name for the new Platform.
The name of the new Platform appears in the list.
In the Build Tool Settings node, from the Platforms drop-down, select
the Platform you have just created.
In the Tool Settings, select the fields where you want to modify values,
and in the Edit field below, make the appropriate changes.
Repeat the procedure for the second copy (release/debug variant) of the
Platform.
In the Default Platform drop-down, select the newly created platform you
want to use by default.
25
209
210
26
Running and Debugging
Targets
Overview
211
212
26
213
To set a breakpoint, double-click into the left margin of the Source Editor
(make sure the breakpoint is set at a line where there is executable code),
or click into the line you want to break at and use the appropriate toolbar
button, or use the Debug menu, or the command line, or the Breakpoints
dialog box.
The breakpoint is displayed in the margin.
214
Breakpoints can be removed analogously to the ways they are set (see
above).
Using the dialogs Store button, you can also save the breakpoints (files,
line numbers and enabled/disabled status) for reuse in subsequent
debugging sessions (Load button).
Note, however, that if you load a breakpoint configuration, any breakpoints you have manually set in the current session will be removed.
this variable
In object oriented languages, displays members of current object
instance.
215
26
local variables
Displays arguments and variables defined in the current scope.
display variables
You can add variables to the display node either by entering
display <VariableName> at the command line, or by clicking on
a variable in the Source Editor and choosing
Right-click > Display <VariableName>
Values of variables added to this node are constantly displayed and
updated whenever the debugger gains control, or if you navigate the
programs call stack in the Execution Context View, or if you enter
sniff variables on the debugger command line.
If a displayed variables value changes, the value is shown in red.
Note that, if many variables are displayed in the View, this can slow
debugging considerably. To overcome this you can temporarily collapse
the nodes.
216
The active thread is displayed in bold and has the call stack expanded
with the innermost stack frame on top.
If the frames are within the context of the currently open SNiFF+ Project,
Double-click on a frame to have the Source Editor jump to the call, and
to update data related to this stack frame in other open views.
217
26
218
Part VI
SNiFF+ PRO Build System Concepts
220
27
SNiFF+ PRO Build System:
Introduction
Overview
221
27.1 Introduction
SNiFF+ does not have its own compiler, debugger, or any other real
tools required in the build process. Instead, SNiFF+ supplies an open
and easily configurable interface to tools of your own choice.
Pre-configured tool-calls are provided for the most common tools and target operating systems. Over and above this, the SNiFF+ Build System is
designed to be able to produce and efficiently manage different kinds of
Build output for one and the same input.
The kind of output produced depends not only on where (which operating
systems) you want your product to run. It also depends on what you want
to do with the output. For example, do you need debug information, or an
optimized release version? SNiFF+ therefore lets you quickly switch
between build variants.
27.2 Assumptions
We assume that you are familiar with the SNiFF+ concepts, Project and
Workspace.
If not, please refer to Projects and Workspaces page 11, or at least
make sure you know what is meant by the terms Source Root and Generated Files Location (see TerminologySource Root, Project and Makefiles Location, Generated Files Location, and Repository page 21).
222
27.3 Platforms
The SNiFF+ Build System uses the Platform as a concept to handle different kinds of output for the same software system.
Platforms are defined as Workspace Properties (defaults are inherited
from the Preferences when a Workspace is created). To look at this,
choose
Figure 27-1
223
27
uct variants per operating system, one with debug information, and
another, optimized release version. All this is done in a set of named
Platform definitions.
In SNiFF+, a Platform is a name, or label, for a set of Build Settings.
Generally, the intention is to produce output variants for a given target
operating system with a given set of tools.
The term Platform is, therefore, no more than a label that expresses this
general intention.
Each Platform uses a standard command for calling your make utility.
224
In the tree at the left of the Workspace Properties, select the Platforms
node (under the Build Tool Settings node).
Figure 27-2
Platform
If you simply enter a string, build-output for the selected Platform is redirected to a tree under a subdirectory with the name you enter.
This subdirectory (actually a subdirectory-system in non-Java languages)
will be either under the Generated Files Location (General Properties),
or appended to an absolute path if you specified one (Advanced Properties).
27
225
226
Figure 27-3
In the navigation tree at the left, select the Build Tool Settings node.
Workspace Properties The Build Settings Node
27
227
228
Take a look at the value in the CXX field, you will see that the field is set to
the cl (unless you, or someone else, has changed it).
Take a look at the value in the CXX field, you will see that the field is set to
the value gcc.
Now check the correspond -release Platforms, and notice the different
values in the CXXDEFINES and the CXXFLAGS fields.
Take a look at the value in the CXXINCLUDES field, you will see that the
field is set to the $(SNIFF_INCLUDES).
The $(SNIFF_INCLUDES) macro will expand to the include paths
generated at Project-level. So, do not delete this macro!
If you want to add additional global includes at Workspace (or Project)
level, you can add these before and/or after the macro, depending on the
order you want them to be read by the compiler.
27
229
230
28
A Closer Look at Build Tools,
Tool Settings and Platforms
Overview
231
28.1 Introduction
One of the keys to understanding the SNiFF+ Build System is to have a
clear idea of what the SNiFF+ concepts Build Tool, Build Tool Settings,
and a Platform really are. This chapter therefore concentrates on clarifying this, and tries to ignore everything that distracts from this objective.
You might want to do the same, or you might simply want to ignore this
chapter.
232
CAUTION
Although macro names are arbitrary as far as the Build System is concerned, some of these names are referenced for use by parsers!
So, do not change the names of macros in pre-configured Build Tool
Templates provided with SNiFF+. But feel free to use whatever names
you like for new macros in new or existing Build Tool Templates.
The field names CXXFLAGS and CCFLAGS are also used internally by
SNiFF+ to provide GUI-supported editing for some compilers (Windows
native and Diab platforms).
28
233
%InFile%
Expands to the current input file.
%Outfile%
Expands to $@. This is interpreted by make as the current output file.
%Objects%
Expands to the file system locations of object files created from the
current Project and to those passed up from Subprojects.
%Libraries%
Expands to the file system locations of libraries passed from
Subprojects.
234
28
235
Build Tool
Template
Platform
Build Tool
Settings tie the
knot between
Platforms and
Build Tools
Take a look at the Build Tool Settings node of the Workspace Properties
dialog.
All settings apply to the selection in the Platform drop-down.
236
237
28
However, for some settings the order will be important, that is, you may
have to pass the Project-level values (e.g. to a compiler) before the
Workspace values.
Target
For example, a linker, which is not directly dependent on a source file
type, but rather links together a number of object files to create a target.
File Type
For example, a compiler, which can be directly related to a source file
type.
238
Executable
If the tool called by the command generates an executable target (e.g.
Linker), select this checkbox. This will enable Run and Debug menu
commands for Projects where targets produced by this tool are specified.
(The Debug menu command also requires a debugger adaptor to be set
at Project level.)
Object
Select to specify that the generated output an object. In this case the
output will be added to the list of objects that are (or can be) passed
(exported) to the Superproject for further processing.
If the output is not a machine-language object file (e.g lex or idl output),
do not select this checkbox.
Build Priority
This determines the order in which Build Tools are called; the higher the
number, the later the call. For example, a Compiler must be called
before a Linker or Librarian.
28
239
240
29
Inheritance of Build Information
Overview
241
242
29
Each newly created Workspace is initialized using the site-wide Preference settings. All Build Tool information inherited from the Preferences
can be redefined in each Workspace.
A Workspace provides the Build defaults for all Projects it contains. Furthermore, the Build Tool Templates (as opposed to the actual Build Tool
Settings) are used, and cannot be overridden, by all Projects in the
Workspace.
Workspace Build Tool Settings can be levelled at Project level. That is, for
performance and efficiency reasons, individual Projects will store only
differences, if any, to the Workspace Settings.
Caution is therefore advised when changing Workspace Build Tool Settings or Build Tool Templates! Deleting any kind of build-related settings
at Workspace level can lead to strange problems at Project-level, where
only differences are stored (difference to what?)!
243
Figure 29-1
Site
Preferences
Newly created
Workspaces
inherit Build
System defaults
directly from
Site-Level
Preferences
Site
Preferences
User
Preferences
Workspaces know
nothing about File
Types
Workspace
Project
Project
File
File
Dotted downward arrows indicate that defaults are inherited from the higher level. As long as
there are no modifications at lower levels, these settings will be directly used; this avoids
maintaining the same information at different levels.
Solid upward arrows indicate that any modifications to the defaults at lower levels are
relative to the higher level. That is, only differences are stored for the lower levels.
Caution: Changes (especially removal or other decreases in scope) at higher levels can lead
to unpredictable results at lower levels!
Some properties are directly shared, and can only be modified at the higher level.
The dotted upward arrow between Project and User Preferences in the File Types inheritance
does not directly affect the Build system; it is included here for the sake of completeness.
This arrow indicates a back-reference, whereby the Project stores a keyword as a pointer to a
whole field of associated Preference-level elements. That is, a change in any Preference
elements associated with the keyword will be immediately effective for all Projects.
244
30
Building Project Structures and
Compiling Files
Overview
245
246
The default Build Tool Settings for files are taken from the Project to which
the files belong. In rare cases, however, you might want to override the
file compilation settings for individual files.
You can view/modify compilation settings of an individual file by selecting
it in a File List and choosing
Right-click > Build Properties...
247
30
248
Part VII
Version Control and Configuration
Management
Integrating ClearCase
250
31
Integration of Version Control
Tools
Overview
251
CVS
ClearCase
PVCS
Visual SourceSafe
252
In the Integrations node, from the Default CMVC Tool drop-down, select
your version control tool.
The RCS and Clearcase version control commands are integrated in the
standard SNiFF+ File menu.
The integrations for PVCS, CVS, and Visual SourceSafe use a custom
menu (called Custom), the corresponding commands in the menu will be
enabled when you close the Preferences.
253
31
254
32
CMVC: Basic Concepts and
Terminology
Overview
255
32.1.1 Repository
A Repository is the place where your version control tool, for example,
RCS, maintains file revision history information.
ClearCase does not have a Repository as such. However, SNiFF+ needs
a Repository node in the Workspace Manager as a point of Reference.
32.1.3 Lock
When you check out a file revision from the Repository, you will generally want to lock that revision in the Repository to prevent others from
modifying it at the same time.
32.1.4 Check in
The process of creating a new file revision in the Repository and thus,
usually, at the same time making it available also to other team members.
256
In SNiFF+, a Configuration is a virtual snapshot of your Project at a certain point in time. The elements of a Configuration are the specific revisions of the files in the Repository at the time of the snapshot. Which
revisions are included in the snapshot is determined by the Workspace
Default Configuration setting.
Generally, you would have a main line of development and, at certain
times, either regularly, or whenever the software system reaches a consistent state, you would create a Freeze-point.
The Configuration Manager is the SNiFF+ tool for creating Freeze-points,
comparing, maintaining and merging Configurations.
257
32
258
33
Working with Branches:
Introduction
Overview
259
33.1 Introduction
Note to ClearCase Users
This chapter is not relevant for ClearCase users because all
Branch/Configuration-related control is delegated to ClearCase.
SNiFF+ supports the use of development Branches, or multiple parallel
lines of development. This, of course, assumes that your version control
tool itself supports Branches.
Creating Branches works for individual and multiple files (e.g. ChangeSets).
You can
260
Freeze the latest revisions of all files on a particular Branch and assign a
Freeze-point name to the set.
Merge a Branch revision of a file back into the main trunk of the files revision tree, or into another Branch.
Temporary fixes and/or customizationYou may be asked by a customer to develop a site-specific version of your software system. You
dont want this work to affect the main development work on the software
system. You could create a temporary Branch for the customization, and
then reintegrate this Branch with the main trunk at a later, opportune time.
Check out the same file revision with a concurrent lock. This results in
a local, writable copy of the file in your Workspace. After making and
testing your modifications, you check the file in as a Branch revision.
261
33
3. If the file you selected is not in bold typeface, it is not writable. You should
have a lock on a file you want to create a Branch revision for (youll see
why later).
So, if the file you selected is not shown in bold typeface,
Right-click > Lock
4. Now choose File > Check In
It does not matter if someone else has the file checked out because you
will be checking it in to a Branch.
262
34
Workspaces, Configurations,
and Branches
Overview
263
for setting the default value when you choose one of the various version
control commands (e.g., check out and check in)
for updating files in a Workspace. Files are updated with respect to the
Workspaces Default Configuration
If the Default Configuration is HEAD, the most current file revisions available in the Repository are used. If another named Configuration is set,
the revisions that are elements of that Configuration are used.
264
Figure 34-1
265
34
Figure 34-2 illustrates how you would set up a Workspace for Branch work.
Forward-development continues normally in MyDesk and YourDesk . That
is, in these Workspaces, the latest file revisions (HEAD) are checked out/in by
default. Updates will also synchronize with the latest file revisions in the
Repository.
The BugFixer Workspace, however, will use BRANCH_bugfix. If you try
to check out a file that does not yet have a revision on the Branch, SNiFF+ will
offer to check out the revision in the RELEASE_1 Configuration. When you
check the file back in, the default will be to BRANCH_bugfix .
Equally, when you synchronize (update) the Projects that use the BugFixer
Workspace, the latest revisions on BRANCH_bugfix are used, or, if there
are none, the elements of the RELEASE_1 Configuration.
Note that, in Figure 34-2, the Branch Configuration has the name
HEAD_BRANCH_bugfix
The HEAD_ prefix is obligatory for Branches. However, you only use it when
you create the Branch Configuration in the Workspace Manager, and when
you check out files. You do not use the prefix when you check in files.
How to...
Before re-organizing Workspaces you have to close all Projects that are open
in them. So close the necessary Projects, and then choose
Tools > Workspace Manager
Caution
The name you enter must be an existing freeze-point label. That is,
you must create the freeze-point in the Configuration Manager (described above).
The new Configuration appears in the Workspaces Tree, suspended from
the Repository.
3. Highlight the newly created RELEASE_1 Configuration and
Right-click > New > Configuration....
4. In the box that appears, enter the name of the Branch Configuration prefixed by HEAD_, that is, HEAD_BRANCH_bugfix, and click Add.
Remember, the HEAD_ prefix is obligatory for Branches. However, you
only use it when you create the Branch Configuration in the Workspace
Manager, and when you check out files. You do not use the prefix when
you check in files.
The new Configuration appears in the Workspaces Tree, suspended from
RELEASE_1.
5. You can now either, assign a new default to an existing Workspace, or
create a new Workspace.
To change the default Configuration of an existing Workspace, dragand-drop the Workspace onto
HEAD_BRANCH_bugfix.
When next you synchronize Projects in the Workspace, this will be
done with respect to the latest revisions on
267
34
268
35
Integrating ClearCase
Overview
269
35.1 Assumptions
Please note that this integration supports Base ClearCase, not UCM.
We assume
your code is under ClearCase control; that is, the ClearCase views and
VOBS you want to use already exist
270
The integration allows direct access to the most commonly used ClearCase commands and tools. Context specific commands are generally
available in the expected contexts (e.g. File menu, or right-click context
menu), direct access to native ClearCase GUI elements is provided under
the Tools menu.
Features include:
Check out/in
Merge Manager
Home Base/xclearcase
ClearCase Details
History Browser
Switch View
...
Integrating ClearCase
How to integrate SNiFF+ and ClearCase
35
271
272
Integrating ClearCase
Synchronizing SNiFF+ Projects with View Changes
273
35
On Unix
On Windows
general.incl
This is because of problems with the clearmake and the sh shell on Windows. You may also have problems because of blanks in your path to
SNIFF_DIR4.
These problem can be overcome by using the bash shell supplied in
your SNiFF+ installation directory (note that this is a customized bash).
The general.incl file is created under the Generated Files Location of each Workspace when you first attempt a Build.
In the general.incl file, insert the following lines:
SHELL = bash.exe
MAKE = clearmake
The SNiFF+ bash shell will now be called in this Workspace.
See also Note to Windows Users: bash Shell as Default for New Workspaces page 276
274
Integrating ClearCase
Using clearmake
In the Preferences
1. Select the Site Level tab.
2. Select the Build Tool Settings Platforms node.
3. In the Make Command field, replace the existing entry with
On Unix
On Windows
275
35
template.general.incl
This is because of problems with the clearmake and the sh shell on Windows. You may also have problems because of blanks in your path to
SNIFF_DIR4.
These problem can be overcome by using the bash shell supplied in
your SNiFF+ installation directory (note that this is a customized bash).
The template.general.incl is located in
SNIFF_DIR4/config/templates/
In the template.general.incl file, insert the following line:
SHELL = bash.exe
MAKE = clearmake
The bash shell will now be called in all newly created Workspaces. See
also Windows Users: bash Shell for Existing Workspaces page 274.
276
36
Integrating SNiFF+ with CVS
Overview
277
36.1 Introduction
First of all, you have to get your code into SNiFF+, and SNiFF+ has to
know that want to use CVS for version control. The SNiFF+ CVS adaptor
then provides an integrated interface to the most important CVS functionality.
When you first import your code into SNIFF+, your code either is, or is
not, already under CVS control (checked in to a CVS Repository).
Depending on which situation applies to you, the procedure will differ
slightly.
Once you have imported your code into SNiFF+ (you only do this once),
you will need to create (at least) one Workspace for each team member
who will work on the code.
There are various strategies for going about this, as described in the section Workspace Management page 27. Here, we shall assume that
one person, a Workspace Administrator, is responsible for setting up
Workspaces.
36.1.1 Assumptions
We assume:
You are familiar with the SNiFF+ Project and Workspace concepts.
278
SNiFF+ Versions
CVS Versions
Start SNiFF+.
In the Preferences
In the Integrations node, from the Default CMVC Tool drop-down, select
CVS
CVS will now be offered as the initial default whenever you need to
specify a version control tool.
Use the SNiFF+ Project Creation Wizard to import your code from a
directory as described in the various language-specific Beginners
Guides.
In the Wizard, make sure that CVS is selected as your Version Control
Tool.
If you proceeded as described under Tell SNiFF+ to use CVS page
279, CVS will already be selected by default.
279
36
Figure 36-1
Figure 36-2
280
You will need the PDFs to initialize additional SNiFF+ Workspaces for
other team members.
PDFs, shared across the version control system, ensure the consistency
and synchronicity of all team members access to the software system.
In the Navigation Pane, at the left of the Project Browser, click into the
File List to ensure that it is in focus.
From the drop-down, select the correct CVSRoot, or fill in the appropriate
fields (Location and Method).
If you have set the CVSROOT environment variable, the field will already
be initialized with this value.
Note
281
36
If the Repository is new (not yet initialized as a CVS Repository), click the
Init button.
Click OK.
The Repository will be initialized (if necessary) and all files checked in.
Once all source and SNiFF+ Project files have been checked in, the
Workspace (initially created by the Project Creation Wizard) knows all it
needs to know about the Repository.
From now on, check-out/in from/to this Workspace will automatically be
from/to this Repository. That is, it you will normally simply check in the
files with seeing this, second dialog box.
Your next step is to create more Workspaces that access this same
Repository for the other members of your team.
How to go about this is described under Create Additional Workspaces
page 284.
Before you start, create an empty directory to hold your future Workspace.
Repository source files will be checked out to this directory, so make sure
you have write permissions.
In the SNiFF+ Project Creation Wizard, make sure that CVS is selected
as your Version Control Tool.
(If you proceeded as described under Tell SNiFF+ to use CVS page
279, CVS will already be selected by default.)
282
When you are asked for the Repository location, navigate to the Repository root directory.
Then, use the Exclude... button to deselect directories that you do not
want to create SNiFF+ Projects for.
You will, for example, not want to create a Project for the CVSROOT
directory in the Repository.
Also, you will want to exclude directories that are not related to the software system you are importing.
your source code files are checked out to a newly created SNiFF+
Workspace
PDFs are needed to create additional SNiFF+ Workspaces for other team
members
PDFs, shared across the version control system, ensure the consistency
and synchronicity of all team members access to the software system.
In the Navigation Pane, at the left of the Project Browser, click into the
File List to ensure that it is in focus.
283
36
All source and Project Description files are in (have been checked in to) a
CVS Repository.
284
Figure 36-3
36
In the Source Root Location field, enter the root directory (one of the
directories you created under Root Directories and the Workspace
Manager page 284) where source code will be checked out to.
Click Add to confirm your entries and close the dialog box.
You should now see the newly created Workspace suspended from
the Repository.
285
If no, you can either create CVS modules (you can open the original
Project in SNiFF+ and choose Tools > Edit modules File...), or proceed
as described under First Check-Out page 61.
286
287
36
In the box that appears, select or enter the CVSROOT and click Login.
288
36.9.4 Pitfalls/Limitations
Both SNiFF+ and CVS keep track of the files and directories you work on.
To stay in sync, all structural changes should be done in SNiFF+.
Adding and (re-)moving in SNiFF+ will automatically update the CVS
structure.
If files are added or removed outside of SNiFF+, manually add/remove
these files form the SNiFF+ Projects.
It is not possible to use Workspace Default Configurations with the current version of the CVS Adaptor. Use CVS sticky tags instead.
36
289
290
37
Integrating SNiFF+ with PVCS
Overview
291
37.1 Introduction
This chapter describes how to integrate INTERSOLV's PVCS Version
Manager with SNiFF+.
PVCS Version Manager is a version control system for Windows, Unix,
and OS/2.
The PVCS adaptor provided with this package can be used for both Unix
and Windows platforms. It ensures a complete mapping of SNiFF+'s version control interface to PVCS Version Manager, and it is also the missing link between the cross-platform abilities of SNiFF+ as well as PVCS.
Hence, it would be possible, for instance, to create a repository on platform A, check out a file on platform B, switch back to platform A, and
check the file in there. On both platforms, you would issue the corresponding commands from SNiFF+, with PVCS as the underlying version
control tool.
The PVCS adaptor is included in the SNiFF+ 4.x installation.
37.1.1 Assumptions
You should have a working PVCS installation on your system, and you
should be able to execute PVCS commands from your Operating System
Command Line. Although SNiFF+ helps you performing PVCS commands, you should know the PVCS concept and how to operate the
PVCS system from the command line as well.
Note that this chapter does not replace an introduction on PVCS. For
background information, please refer to the PVCS documentation.
You should also be familiar with SNiFF+ Project and Workspace concepts.
292
SNiFF+ Versions
6.7
293
294
Full support of PVCS configuration files (see PVCS and Adaptor Configuration Files page 295 for details)
Ability to move a label from one revision to another revision for one file
Multiple PVCS archive suffix meta rules (include a '?' inside the extension) are not supported.
PVCS access lists, access database and the promotion model is not supported by this version of the adaptor.
In the SNiFF+ Project Browser, choose Project > New > With Wizard...
The Project Creation Wizard appears.
In the Project Creation Wizard, select PVCS as your version control tool
and follow the rest of the instructions in the Wizard.
For more information on how to create a Project in SNiFF+, please refer
to the SNiFF+ Users Guide and Reference or the language-specific
Beginners Guides.
295
37
The PVCS adaptor uses a fixed file to store all configuration settings necessary for SNiFF+. This is the master configuration file of the PVCS
adaptor and contains all settings necessary for SNiFF+:
PVCS Version 6.0
SNIFF_DIR4/config/integrations/pvcs/Pvcs60_4Sniff.cfg
contains the archive suffix rule:
".? = ??v___"
If you want to use this file, rename it to Pvcs4Sniff.cfg (after making a backup of the original!).
PVCS Version 6.5
SNIFF_DIR4/config/integrations/pvcs/Pvcs4Sniff.cfg
contains the archive suffix rule:
".? = +-arc;. = +.-arc"
Note
All archive suffix rules will be stored in this file. This file must be writable for all users who are allowed to change the archive suffix rules.
The configuration files will be read in the following order:
296
QUIET
display only minimal messages
NOSIGNON
no PVCS copyright message
IGNOREPATH
use VCSDIR to specify repository directory
NODELETEWORK WRITEPROTECT
check-in doesn't remove the work files
EXPANDKEYWORDS TOUCH
keyword expansion changes the timestamp of the work file
NOSHARE
set exclusive use of archives for all operations
All other configuration settings can be overwritten or deleted from the
SNiFF+ configuration file if you are using the master and/or project configuration files. Otherwise deletion of configuration settings can disable
some functionality.
Note
Because of several problems with incorrectly configured PVCS configuration files, the SNiFF+ PVCS adaptor generates the directives
IgnorePath and ExpandKeywords Touch inside a dynamically generated temporary configration file for every repository access.
297
37
298
38
Integrating SNiFF+ with Visual
SourceSafe
Overview
299
38.1 Compatibility
This integration was developed with MS Visual SourceSafe version 6 and
SNiFF+ version 4.0.
38.2 Prerequisites
For SNiFF+ to integrate with Visual SourceSafe, you must set Visual
SourceSafe as your default CMVC tool, either during the SNiFF+ installation, or subsequently in the Preferences.
Once you've installed SNiFF+, you must add Visual SourceSafe to your
PATH environment variable.
To test whether Visual SourceSafe is in your path, open a shell and
enter:
ss About
You should then see version information about your SourceSafe installation.
Open the Visual SourceSafe Admin program and create a User (if one
has not been created). If your SourceSafe Username does not resemble
your Login name, you must set the environment variable
SNIFF_VSS_USER
to the login name you would like to use within SourceSafe.
300
38
301
then the path to the repository of the Subproject will be generated as follows:
$/complex/complexlib
302
Exclusive Lock, this command puts an exclusive lock on the file in the version tool. An exclusive lock means that nobody else can lock the same
version. The working file status is set to writable.
No lock, this makes the local copy read-only. No lock is set on the file.
SNiFF+'s version control interface provides means to create branch versions of repository files during check in or check out. These features are
not supported with Visual SourceSafe as the underlying version control
tool.
Visual SourceSafe allows labels consisting of more than one word, however SNiFF+ does not support this feature, therefore these labels are
separated by underscores in SNiFF+, e.g. this is a label will be displayed in SNiFF+ as this_is_a_label.
303
38
304
Part VIII
Editor and Other Integrations
Emacs Integration
SlickEdit Integration
Vim Integration
306
39
Emacs Integration
Overview
307
308
Emacs Integration
Integrating Emacs
39
Create a shortcut to sniffstart.cmd and in its Properties > Target field, add
-s EE
or
-s EE
after
start sniff.exe
309
(load "sniff-mode")
(load "$SNIFF_DIR4/config/integrations/emacs/
sniff-mode")
(sniff-connect)
You can have only one Emacs-SNiFF+ connection active at a given time.
310
Emacs Integration
Working with Emacs and SNiFF+
311
312
Emacs Integration
Command Reference
sniff-goto-symbol
Show Symbol... Shortcut: C-c C-g
sniff-browse-class
Browse Class... Shortcut: C-c C-b
sniff-hierarchy
Show <Classname> In Entire Hierarchy... Shortcut: C-c C-h
sniff-restr-hier
Show <Classname> Relatives... Shortcut: C-c C- M-h
sniff-retrieve
Retrieve in Edited File... Shortcut: C-c C-r
sniff-retrieve-proj
Retrieve In Project of Edited File...
sniff-retrieve-allprojs
Retrieve From All Projects...
sniff-retrieve-next
Retrieve In Marked Projects Shortcut: C-c C- M-r
313
39
sniff-xref-to
Refers To... Shortcut: C-c C-x
sniff-xref-by
Referred By... Shortcut: C-c C- M-x
sniff-xref-has
Refers To Components... Shortcut: C-c C-c
sniff-xref-used by
Referred By As Component... Shortcut: C-c C- M-c
sniff-reparse
Reparse...
sniff-connect
Connect
sniff-disconnect
Disconnect
314
40
SlickEdit Integration
Overview
315
40.1 Introduction
MicroEdge Visual SlickEdit can be used for editing source code in
SNiFF+. SNiFF+ commands can be issued directly from the SlickEdit
menu, and all editing requests issued from SNiFF+ are answered by
SlickEdit.
40.1.1 Compatibility
The integration was developed for Visual SlickEdit 5.0 and SNiFF+ 4.0
and newer.
40.2 Installation
SNIFF_DIR4\config\integrations\slickedit\
to the macros subdirectory in your SlickEdit installation directory.
316
SlickEdit Integration
Working with Visual SlickEdit and SNiFF+
In addition to the SNiFF+ menu, the SlickEdit File menu has an additional
command, namely, File > Save in SNiFF+.
This command serves both to save the file, and to update the symbol
information maintained and displayed by SNiFF+.
Note that when you call SNiFF+ from SlickEdit, SNiFF+ may be hidden by
other Windows; this behavior depends on your Windows installation.
40
317
318
41
Vim Integration
Overview
319
SNiFF+ recognizes and updates all browsers when a file is saved in Vim.
320
Vim Integration
How the Integration Works
41.2.1 Prerequisites
SNIFF_DIR4/bin
On Windows
SNIFF_DIR4/bin;SNIFF_DIR4/lib.
Vim 5.x with sniff support installed at your site. You can download Vim
and the necessary files for this integration from the following Website:
ftp.home.vim.org/pub/vim
Information on Vim can be obtained from the following Website:
http://www.vim.org
On Windows
1. A pre-compiled and configured version of Vim 5.3 comes with the SNiFF+
distribution or can be downloaded from (all one line);
ftp://ftp.takefive.com/pub/SNiFF/4.0_Win/vim-win32/
vim_for_40.tgz.
2. Extract the .tgz file into your SNiFF+ 4.0 installation directory.
On Unix
You need to download original vim sources including the SNiFF+ integration and compile it at your site. You can download Vim and the files for
this integration from the following Website:
http://www.vim.org
1. Downloaded the Vim source files, e.g.,
vim-5.7-src.tar.gz
and the sources for the SNiFF+ Vim integration, e.g.,
vim-5.7-extra.tar.gz
2. Extract the above mentioned .tar.gz files to a directory where you
have write permissions.
321
41
Note
Throughout this chapter, we will use SNIFF_DIR4 to refer to your
SNiFF+ 4.0 installation directory.
2. Set up your PATH to point to
On Unix
SNIFF_DIR4/bin
On Windows
322
Vim Integration
Making the Connection
start sniff.exe
41
323
Insert the following (one line) into the .vimrc file before the line that
contains sniff connect:
let sniff_mappings = "$SNIFF_DIR4/config/ \
integrations/vim/sniff.vim"
324
Vim Integration
Command Reference
41
:sniff goto-symbol
Vim shows the declaration or implementation of the selected symbol. If
the selected symbol is ambiguous, a dialog opens with a list of valid
alternatives.
Shortcut: sg
Corresponding menu command: Show Symbol
:sniff browse-class
Displays the members of the selected class in the Class Browser.
Shortcut: sb
Corresponding menu command: Browse Class
:sniff hierarchy
Shows the entire class hierarchy in the Hierarchy Browser.
Shortcut: sh
Corresponding menu command: Show Class in Entire Hierarchy
325
:sniff restr-hier
Shows base and derived classes of the selected class in the Hierarchy
Browser.
Shortcut: sH
Corresponding menu command: Show Class Relatives
:sniff retrieve-next
Opens the Retriever and retrieves all occurrences of the selected string
from the Projects that are checkmarked in the Project Tree. Also all other
settings in the Retriever, except filters, are applied.
Shortcut: sR
Corresponding menu command: Retrieve
:sniff retrieve-all-projects
Opens a Retriever and retrieves all occurrences of the selected string
from all projects in the Project Tree.
Shortcut: srP
Corresponding menu command: Retrieve from All Projects
:sniff retrieve-project
Opens a Retriever and retrieves all occurrences of the selected string
from the project to which the current file belongs.
Shortcut: srp
Corresponding menu command: Retrieve from Project of Edited File
:sniff retrieve-file
Opens a Retriever and retrieves all occurrences of the selected string
from the current file.
Shortcut: srf
Corresponding menu command: Retrieve from Edited File
:sniff xref-to
Opens the Cross Referencer and shows all symbols that the selected
symbol references.
Shortcut: sxt
Corresponding menu command: Refers To
326
Vim Integration
Command Reference
:sniff xref-by
Opens a Cross Referencer and shows all symbols that are referenced by
the selected symbol. The Filter settings are used as the query parameters.
Shortcut: sxb
Corresponding menu command: Referenced By
:sniff xref-has
Opens a Cross Referencer and shows all symbols (classes and structures) that are components of the selected class. If the current selection
is a member of a class/structure, the class/structure is taken for this
query
Shortcut: sxh
Corresponding menu command: Refers To Components
:sniff xref-used-by
Opens a Cross Referencer and shows all symbols that are referenced by
the selected symbol. The Filter settings are used as the query parameters.
Shortcut: sxu
Corresponding menu command: Referenced As Component By
:sniff connect
Establishes connection with SNiFF+. Make sure that SNiFF+ is in Vim
mode.
Shortcut: sc
Corresponding menu command: Connect
:sniff disconnect
Disconnects from SNiFF+. You can reconnect at any time with :sniff
connect.
Shortcut: sq
Corresponding menu command: Disconnect
327
41
328
42
Rational Rose Integration
Overview
329
42.1 Introduction
Rational Rose is a graphical software-engineering tool which supports
the most popular OO analysis and design methods. This integration provides a bi-directional navigation between SNiFF+ and Rational Rose for
both source code that has been generated from a Rose Design and
Rose models that have been created from source code by the Rose Analyzer.
42.1.1 Compatibility
The integration has been developed for Rational Rose 98i and Rational
Rose 2000. It was tested under Microsoft Windows NT4 SP6.
42.2 Installation
42.2.1 Preconditions
Rational Rose 98i, Rational Rose 2000, or Rational Rose 2001a has to
be installed on a Microsoft Windows PC.
Open a shell and change to the bin directory of the SNiFF+ installation.
Rosereg will write some entries for Rational Rose in the Microsoft
Windows Registry.
330
Start SNiFF+.
42
42.2.4 Result
In SNiFF+, you will see the menu, Custom > Rational Rose. Additional
context menus (in Source Editor, File List, etc.) can only be seen in open
SNiFF+ Projects.
In Rational Rose you will see Tools > SNiFF+.
Note: When you use one of the above mentioned menu items, SNiFF+
will be brought into the foreground. In cases where you cannot see the
expected result in SNiFF+ (e.g. your class in the Class Browser), a dialog
may be hidden, waiting for your input. This dialog appears if the selected
symbol is ambiguous.
331
332
Start Rose
Terminate Rose
42
333
334
Browse Class
Loads the class selected in a class diagram into the SNiFF+ Content
Browser.
Edit Symbol
Loads the class selected in a class diagram into the SNiFF+ Source
Editor.
42
335
File Type
Signature
Description
Rose Model
*.mdl
Rose Category
*.cat
Rose Analyzer
Project
*.pjt
Rose Re-engineered
Code
*.red
336
Part IX
SniffAPI
SniffAPI - Concepts
SniffAPIGetting Started
338
43
SniffAPI - Concepts
Overview
339
43.1 Introduction
This document provides an overview of the basic idea, the overall architecture, and the usage model of the SniffAPI.
340
SniffAPI - Concepts
Query Interface
the SniffAPI client side, which reads the information from the socket and
transfers it to your installed data handlers via the builder pattern. In our
sample application, the data handlers print the Project structure to the
console.
43
All information about definitions and declarations and short cross-reference information.
All information about definitions and declarations and long cross-reference information.
The information transfer mode is selected when the information is
requested from a SniffController instance ( getProjectData or
getFileData).
341
In the short cross-reference transfer mode, only the IDs of the referencer
and the referenced symbol and attributes describing the reference type
are transmitted. In the long cross-reference mode, enough information is
transmitted to find the referenced symbol in a symbol table.
An entire section is dedicated to the SniffAPI ID concept.
SNIFF_DIR4/SniffAPI/Example
The UML class diagram in the illustration below gives you an overview of
the most important classes of the sample application. The framework
classes have boxes with fine lines, and the application-specific classes
have boxes with bold lines.
342
SniffAPI - Concepts
Usage Model
43
343
Example 1
As mentioned above, you integrate your software as part of a builder pattern by installing your application-specific handler objects to the default
ImplementationHandlerFactory that is managed by a SniffController object. In our example, we are interested in information on
Projects ( ProjectHandler ), files (FileHandler ), and classes
(SymbolHandler).
SniffController controller= new SniffController();
InformationHandlerFactory
factory=controller.getHandlerFactory();
factory.setProjectHandler(new
DemoProjectHandler(writer));
factory.setFileHandler(new DemoFileHandler(writer));
factory.setSymbolHandler(new
DemoSymbolHandler(writer));
Example 2
Once the factory is configured, the connection to SNiFF+ is established
and (in our example) the request to send the information for a specific
Project is sent to SNiFF+.
During the getProjectData call, the framework takes control, manages the communication with SNiFF+, and transfers the information to
the handler objects installed in the factory in step one.
int referenceAmount= SniffController.eFullReferences;
boolean recursively= true;
Boolean absolutePos= true;
try {
controller.connect(absolutePos);
}
catch( CannotConnectException e ){ ... }
try {
controller.getProjectData(sendSymbols,
referenceAmount, recursively, projectFilePath,
wePath);
}
catch(CannotAccessProjectException e ){ ... }
catch(ConnectionBrokenException e ){ ... }
controller.disconnect();
344
SniffAPI - Concepts
Scope Handling
Example 3
In the application-specific handler objects, the information is received as
data objects and used for whatever purpose needed.
public class DemoSymbolHandler extends SymbolHandler {
public void handleClass(ClassData data)
{
System.out.println("Class " + data.getName());
System.out.println("
Position " +
data.getPosition().getAbsoluteStart() + " " +
data.getPosition().getAbsoluteEnd());
if (data.isFinal())
System.out.println("
final");
if (data.isAbstract())
System.out.println("
abstract");
...
}
}
43
345
Example 4
The following code snippet exemplifies how a list of scopes is traversed.
void traverseScope(Scope scope) {
while (scope != null) {
printScope(scope);
scope= scope.getPrev();
if (scope != null)
System.out.println("
contained in");
}
}
void printScope(Scope scope) {
System.out.println(
getScopeKindName(scope.getKind()
+ " scope "
+ scope.getName()
+ " in " + printPosition(scopeGetPosition()));
}
String getScopeKindName(int kind) {
switch (kind) {
case eGlobal:
return "Global";
....
}
}
346
SniffAPI - Concepts
The ID Concept
an ID (reference), or
347
43
348
unknown scope
global scope
file scope
5 - 13
20 - 41
42 - 49
SniffAPI - Concepts
The ID Concept
SNIFF_DIR4/SniffAPI/javadocs
The illustration below shows a partial view of the data classes used by
the SniffAPI to transfer the information.
43
43.7.4 Completeness
The SniffAPI transfers all symbol information currently available in
SNiFF+'s symbol table. This information is tailored to support the browsing of large software systems and is, therefore, not complete. Certain
parts of the interface are marked with not yet supported these are
areas where we consider it probable that more information will be available in the future.
One of the reasons why we have chosen to transfer all information
through data objects is that this makes it possible to extend the interface
without breaking user code.
349
There are a lot of attributes that can be specified for C++ and Java symbols. The following table gives an overview of what kind of attributes are
supported by the language definitions and the information about which
attribute is provided by the SniffAPI.
Keyword
C/C++
auto
yes
abstract
const
yes
yes
Description
SNiFF+ 4.x
(SniffAPI)
not supported
Java: yes
Member functions,
variables and member variables can be
defined const.
C++: yes
explicit
yes
not supported
extern
yes
Variable or function
has external linkage,
or linkage conversion of another language
not supported
Java: yes
final
350
Java
yes
SniffAPI - Concepts
The ID Concept
Keyword
C/C++
friend
inline
Description
SNiFF+ 4.x
(SniffAPI)
yes
yes
yes
Function or method is
marked as inline,
which is a suggestion
to the compiler to
generate inline code.
Java: yes
not supported
yes
Java: yes
interface
mutable
Java
yes
yes
native
private
yes
yes
Visibility of members
in C++ and Java, visibility of inheritance in
C++.
protected
yes
yes
Visibility of members
in C++ and Java.
public
yes
yes
Visibility of members
in C++ and Java, visibility of inheritance in
C++, visibility of
classes in Java.
351
43
Keyword
C/C++
register
yes
synchronized
static
yes
transient
352
virtual
yes
volatile
yes
Java
Description
SNiFF+ 4.x
(SniffAPI)
not supported
yes
Modifier to specify
thread-safe methods
not supported
yes
Variables, functions
(visibility during linkage C/C++ only),
member functions
and variables (class
methods and variables)
yes
yes
Java: yes
Polymorphism for
functions, inheritance, enables multiple inheritance
without duplicate
members when inheriting from the
same class more
then once
Java: yes
yes
44
SniffAPIGetting Started
Overview
353
SNIFF_DIR4/lib/java
JAR files of client interface
SNIFF_DIR4/SniffAPI/Source
Source code of interface of client framework
SNIFF_DIR4/SniffAPI/Example
Source code of sample client ProjectTreePrinter
SNIFF_DIR4/lib/java/sniff.jar
and also the location of the other libraries needed by the client, which are
located in the same directory.
For this reason your Java classpath must be set correctly.
354
SniffAPIGetting Started
Setting up JAR files for compilation of a SniffAPI client
355
44
SNIFF_DIR4/SniffAPI/Example
and start the sample program as follows (all one line):
java com.windriver.sniffapi.client.clientdemo.
ProjectTreePrinter <ProjectPath> <WorkingEnvironmentPath>
SNIFF_DIR4/SniffAPI/Example/example.proj
On Windows: If the path to your Project contains blanks, enter the full,
absolute path enclosed in double quotes, e.g.,
"C:\Program Files\Sniff\Example\example.proj"
example.proj - /repository/MyDesk
Above, the WorkspacePath is
/repository/MyDesk
Note the / at the beginning. Note further that MyDesk is not a file-system
location, but a Workspace name.
SniffAPIGetting Started
Running the Sample Program
44
357
358
Part X
Advanced Reference
Custom Menus
Sniffaccess
Cross-Reference Information
45
Custom Menus
Overview
361
45.1 Introduction
SNiFF+ lets you define custom menus. Custom menus can be useful for
a variety of tasks. For example, you might want to call an external application to process a selected file directly from SNiFF+. You can also use
ready-made dialogs to get information from the user.
Custom menus are defined in a special configuration file. Items defined
in this file can also be used for FIle Type right-click context menus. These
context menus are then available in the File List.
We recommend that you create a SNiFF+ Project for the custom menu
configuration file. This allows you to properly edit the file with SNiFF+
(including syntax highlighting), and to version control it (and therefore
also share it).
The configuration file itself has several examples that are fully commented. The best way to understand how custom menus work is therefore probably to look at the configuration file.
This chapter provides a general introduction to the custom menu configuration file, and a full EBNF description.
45.2 Preparation
We assume you will set up a Project as recommended above.
Before going on to set up a Project, there are a few things to do.
362
Custom Menus
The Custom Menu Configuration File
On Windows
In SNIFF_DIR4/config/Profiles/<user_name>/
create a directory called integrations
On Unix
In $HOME/.sniffrc
create a directory called integrations
In the Wizard, the source code location is the directory you created
above.
When the Wizard has run its course, the Project opens in the Project
Browser.
Caution: Be very careful with the syntax! Always make sure parentheses
are closed, etc. If not, you may experience some very weird problems.
There are a number of examples in the file. When you write your own
menus, the best thing to do is copy/paste whole blocks and then modify
within the pasted block.
363
The top level definition uses an array of item identifiers. These can be
called anything you like, but each must be enclosed in double quotes.
Each item identifier must be defined somewhere further down in the file.
This identifier can also be used to define custom right-click context
menus for File Types. That is, simply enter the identifier in the Preferences (a File Type Subcategory Setting).
364
Custom Menus
The Custom Menu Configuration File
A Name, that is, the identifier used also in the menu definition.
States
Basically, this syntactical block defines the label as you see it in the menu
(the & defines the accelerator key), and the text that appears in the
status line.
"|Application|ExecProcess"
or
"|Application|ExecPython"
That is, you can either run an external application, or call a Python function (SNiFF+ handles the Python environment).
CustomShowFileAttributes
Accessor (
Item : struct (
Name : "#Project|ConvertPIPToPath"
Args : array (
Accessor ( Name : "#Project|GetSelectedFile" )
)
)
)
365
45
To see what happens, uncomment the following lines in the menu definition (use either the toolbar button, or remove the two minus signs at the
line-beginning):
"<MENU>"
"CustomPythonDialogSubMenu"
"</>"
366
Custom Menus
Custom Menu Configuration File: EBNF Specification
Location
On Windows
SNIFF_DIR4/config/tools/integrations
or
SNIFF_DIR4/config/Profiles/<user_name>/integrations
On Unix
SNIFF_DIR4/config/tools/integrations
or
$HOME/.sniffrc/integrations
367
45
Accessor = MenuEntry.
MenuEntryMacroSpec = 'struct' '(' 'Name' ':' Action [ 'Args' ':' ActionArgumentSpec ] ')'.
45.4.3 Actions
Action = '|Application|ExecProcess' | '|Application|ExecPython'
368
Custom Menus
Custom Menu Configuration File: EBNF Specification
45.4.4 Parameters
"#Project|ConvertPIPToRepositoryPath"
path(s) argument converter
...
SNiFF+
file
Repository
45
369
370
46
Sniffaccess
Overview
371
Driving SNiFF+ in batch mode. For example, this is used for unattended
updates and builds of Workspaces.
Integrating SNiFF+ with other third-party tools like CASE tools and GUI
builders.
372
Sniffaccess
Invoking Sniffaccess
Example of usage:
sniffpython MyPythonScript.py -session mySession
Example MyPythonScript.py:
from sniffaccess.Sniffaccess import *
# --- test class
class Tests:
# --- constructor
def __init__(self, aSession):
port = SA_GetPortForSession(aSession)
self.sa = Sniffaccess(port, "localhost")
# --- Check modification of Working
#
Environment
def CheckModification(self):
print self.sa.SA_IsWorkspaceModified()
# --- main entry point
if __name__ == '__main__':
try:
if sys.argv[1] == "-session":
session = sys.argv[2]
except IndexError:
print "*** Error: session missing!"
sys.exit()
test = Tests(session)
test.CheckModification()
373
46
374
Sniffaccess
Input and Output of Data
375
46
WorkspacePath
Describes Source Root of a Workspace.
Note: The leading slash in the path expression is important.
Example
wsPath = WorkspacePath("/rep1/Freeze/Freeze1/ws")
The parameter passed to WorkspacePath is the SNiFF+ representation of the Workspace structure (as displayed also in the titlebar of the
Project Browser).
ProjectPath
Describes the context of a SNiFF+ Project. The context is defined by a
Project Description File for the named Project, a Project Description File
for the root Project (both relative to the Workspace), and a
WorkspacePath.
(If the named Project is itself the root Project, then its Project Description File is passed twice.)
Example
wsPath = WorkspacePath("/rep1/Freeze/Freeze1/
ws","DEFAULT")
rootPdfPath ="test/complex/complex.proj"
pdfPath = "test/complex/iolib/iolib.proj"
projPath = ProjectPath(pdfPath, rootPdfPath,
str(wsPath))
sa.SA_ListDirs(projPath)
ProjectPathArray
An array of ProjectPath objects. It is sometimes necessary to
handle a collection of Projects (e.g. Subprojects).
Example
projPathArray = ProjectPathArray()
projPathArray.Add(projPath)
sa.SA_UpdateFilesOfProject(projPathArray)
ProjectItemPath
Describes a Project item (e.g. file). It is defined by a filename (including
path) and a ProjectPath.
376
Sniffaccess
Input and Output of Data
Example
item = "HelloWorld.java"
projItemPath = ProjectItemPath(item, projPath)
print sa.SA_GetFileTarget(projItemPath)
ProjectItemPathArray
An array of ProjectItemPath objects. It is sometimes necessary to
handle a collection of Project items.
Example
file = "HelloWorld.java"
projItemPath = ProjectItemPath(file, str(projPath))
projItemPathArray = ProjectItemPathArray()
projItemPathArray.Add(projItemPath)
sa.SA_Lock(projItemPathArray, "HEAD")
CombindWorkspaceSource
Represents a typical Workspace. It is a combination of the classes
WorkspaceSource and WorkspaceOrganisation.
Example
objFact = ObjectFactory.ObjectFactory()
wsSrc = objFact.CreateObject("WorkspaceSource")
wsSrc.SetName("A added TestRootEnv")
wsSrc.SetOwner("dummy")
wsSrc.SetDirectory("/WS/tests")
wsOrg = objFact.CreateObject("WorkspaceOrganisation")
combWsSrc =
objFact.CreateObject("CombindWorkspaceSource")
combWsSrc.SetWorkspaceSource(WsSrc)
combWsSrc.SetWorkspaceOrganisation(wsOrg)
newID = sa.SA_AddRootWorkspace(combWsSrc)
377
46
Project
Represents a SNiFF+ Project. It is defined by a ProjectPath and an
array of Subprojects.
project = sa.SA_GetProjectTree(projPath)
# show first two levels of the tree
project.GetProjectPath().GetProject()
projects = project.GetSubProjects()
for i in range (len(projects)):
proj = projects[i]
print "+-",
proj.GetProjectPath().GetProject()
subProjects = proj.GetSubProjects()
for j in range(len(subProjects)):
subProj = subProjects[j]
print " +-",
Snurl
Describes symbol information. A Snurl is only valid (for an instant) as
long as no modifications (e.g. removing a file, or adding a new class)
were made in the Project. Therefore it doesnt make sense to permanently store a Snurl.
Example
className = "HelloWorld"
classes = sa.SA_GetClassFromName(className)
print "--- NavigateToSymbol"
if len(classes) > 0:
ret = sa.SA_NavigateToSymbol(classes[0])
else:
print "No such class!"
WorkspaceOrganisation
Describes name, directory, and build specific attributes like platform of a
Workspace.
Note: It is part of CombindWorkspaceSource.
Example
wsAttr =
sa.SA_GetWorkspaceAttributes(wsPath)
wsOrg = wsAttr.GetWorkspaceOrganisation()
print "Name ", wsOrg.GetName()
print "BuildProfile ", wsOrg.GetBuildProfile()
378
Sniffaccess
Input and Output of Data
WorkspaceSource
Describes name, directory, owner, remote directory, WorkspacePath,
and ProjectPath of a Workspace.
Note: It is part of CombindWorkspaceSource.
Example
wsAttr = sa.SA_GetWorkspaceAttributes(wsPath)
wsSource = wsAttr.GetWorkspaceSource()
print "Name =", wsSource.GetName()
print "Owner = ", wsSource.GetOwner()
print "Directory = ", wsSource.GetDirectory()
WorkspaceRepository
Describes name, directory, version control tool, and version control tool
specifics for a Workspace Repository.
GenProjectAttributes
Helper class to generate Project Properties, especially used for creating
new Projects.
Describes
Project name
Project template
whether
directories
(notRecursive)
should
be
recursively
379
scanned
46
Example
dir = "/WS/autoGenProj"
#dir = "Y:/WS/autoGenProj"
projAttr = GenProjectAttributes()
projAttr.SetTemplate("default.ptmpl")
projAttr.SetRemoveEmpty(0) # do not remove
# empty projects
ignoreDirs = []
ignoreDirs.append("/WS/autoGenProj/dummy1")
ignoreDirs.append("/WS/autoGenProj/dummy2")
projAttr.SetIgnoreDirs(ignoreDirs)
sa.SA_GenerateProjects(dir, wsPath, projAttr)
380
Sniffaccess
Examples
46.6 Examples
the following section contains some useful examples and code fragments. The examples should show how Sniffaccess can be used to perform certain tasks.
Example
from sniffaccess.Sniffaccess import *
from sniffaccess.WorkspaceRepository import *
# --- start a SNiFF session
port = SA_StartSniff("MySession")
sa = Sniffaccess(port)
# --wss = self.s.SA_GetWorkspaces()
for i in range(len(wss)):
print "name =", wss[i].GetName(), " wsPath =",
str(wss[i].GetWorkspacePath())
print " Directory=", wss[i].GetDirectory()
if isinstance(wss[i], WorkspaceRepository):
print " VCTool=", wss[i].GetVcTool()
46
381
open Project
Example
from sniffaccess.Sniffaccess import *
# --- start a SNiFF session
port = SA_StartSniff("MySession")
sa = Sniffaccess(port)
# --wsPath = WorkspacePath("/MyRepository/
J_HelloWorld","DEFAULT")
pdfPath = "HelloWorld.proj"
sa.SA_OpenProject(pdfPath, wsPath)
projPath = ProjectPath(pdfPath, pdfPath, str(wsPath))
print "--- GetProjectAttributes"
attr = "DisplayName"
print "DisplayName (before change) =",
sa.SA_GetProjectAttributes(projPath, attr)
print "--- SetProjectAttributes"
value = "modifiedProject.proj"
sa.SA_SetProjectAttributes(projPath, attr, value)
print "--- GetProjectAttributes"
print "DisplayName (after change) =",
sa.SA_GetProjectAttributes(projPath, attr)
# --self.s.SA_CloseProject()
382
Sniffaccess
Examples
Open Project
File name
Example
from sniffaccess.Sniffaccess import *
# --- start a SNiFF session
port = SA_StartSniff("MySession")
sa = Sniffaccess(port)
# --wsPath = WorkspacePath("/MyRepository/
J_HelloWorld","DEFAULT")
pdfPath = "HelloWorld.proj"
projPath = sa.SA_OpenProject(pdfPath, wsPath)
print "--- AddFile"
projPath = ProjectPath(pdfPath, pdfPath,
str(wsPath))
file = "Y:/ws/HelloWorld/fileToAdd.java"
sa.SA_AddFile(projPath, file)
# ---
sa.SA_CloseProject()
46
383
Open Project
File name
Example
from sniffaccess.Sniffaccess import *
# --- start a SNiFF session
port = SA_StartSniff("MySession")
sa = Sniffaccess(port)
# --wsPath = WorkspacePath("/MyRepository/
J_HelloWorld","DEFAULT")
pdfPath = "HelloWorld.proj"
sa.SA_OpenProject(pdfPath, wsPath)
print "--- Lock File"
file = "HelloWorld.java"
projPath = ProjectPath(pdfPath, pdfPath, str(wsPath))
projItemPath = ProjectItemPath(file, str(projPath))
projItemPathArray = ProjectItemPathArray()
projItemPathArray.Add(projItemPath)
version = "HEAD"
sa.SA_Lock(projItemPathArray, version)
# --sa.SA_CloseProject()
384
Sniffaccess
Examples
Level
Either Site or User
Specification
of the following: BuildAttributes,
WSBuildAttributes, WindowSystem
One
Tools,
Types,
Item name
Depends on Specification.
Example
from sniffaccess.Sniffaccess import *
# --- start a SNiFF session
port = SA_StartSniff("MySession")
sa = Sniffaccess(port)
print "--- GetPreferences before modification"
specification = "Tools"
prefs = sa.SA_GetPreferences(specification)
undo = int(prefs['UndoLevels'])
print "UndoLevels =", undo
print "--- set UndoLevels"
undo = int(prefs['UndoLevels'])
undo = undo + 100
level = "User"
data = PotDict()
data['UndoLevels'] = undo
sa.SA_SetPreferences(level, specification, data)
print "--- GetPreferences after modification"
prefs = sa.SA_GetPreferences(specification)
undo = int(prefs['UndoLevels'])
print "UndoLevels =", undo
385
46
Open Project
Class name
If class name is ambiguous, SNiFF+ will pop up a dialog where you have
to select the preferred one.
Example
from sniffaccess.Sniffaccess import *
# --- start a SNiFF session
port = SA_StartSniff("MySession")
sa = Sniffaccess(port)
# --- open project
wsPath = WorkspacePath("/MyRepository/
J_HelloWorld","DEFAULT")
pdfPath = "HelloWorld.proj"
projPath = ProjectPath(pdfPath, pdfPath, str(wsPath))
projPathTmp = sa.SA_OpenProject(pdfPath, wsPath)
# --- navigate to symbol
className = "HelloWorld"
classes =
sa.SA_GetClassFromName(className)
if len(classes) > 0:
sa.SA_NavigateToSymbol(classes[0])
else:
print "No such class!"
386
Sniffaccess
Examples
Workspace
Platform name
The Platform name depends on your Workspace Properties.
Example
from sniffaccess.Sniffaccess import *
# --- start a SNiFF session
port = SA_StartSniff("MySession")
sa = Sniffaccess(port)
# --print "--- GetWorkspaceAttributes (before change) ---"
wsPath = WorkspacePath("MyRepository/
J_HelloWorld","DEFAULT")
wsAttr = sa.SA_GetWorkspaceAttributes(wsPath)
wsOrg = wsAttr.GetWorkspaceOrganisation()
print "BuildPlatform = ", wsOrg.GetBuildPlatform()
print "--- SetWorkspaceAttributes---"
oldPlatform = wsOrg.GetBuildPlatform()
if oldPlatform == "Unix":
newPlatform = "Windows"
else:
newPlatform = "Unix"
wsOrg.SetBuildPlatform(newPlatform)
wsAttr.SetWorkspaceOrganisation(wsOrg)
sa.SA_SetWorkspaceAttributes(wsAttr.GetWorkspaceId(),
wsAttr)
print "--- GetWorkspaceAttributes (after change) ---"
wsAttr = sa.SA_GetWorkspaceAttributes(wsPath)
wsOrg = wsAttr.GetWorkspaceOrganisation()
print "BuildPlatform = ", wsOrg.GetBuildPlatform()
387
46
Action name
The action name has to be a known action like OpenProject,
ForceReparse, etc.
Note that Sniffaccess only supports synchronous notification. This
means that SA_WaitForNotification waits until the specified
action occurrs.
Example
from sniffaccess.Sniffaccess import *
# --- start a SNiFF session
port = SA_StartSniff("MySession")
sa = Sniffaccess(port)
print "--- Open the Workspace Manager"
print "--- Open a project from the Workspace Manager"
sa.SA_WaitForNotification("OpenProject")
print "--- Reparse the project"
sa.SA_WaitForNotification("ForceReparse")
print "--- Close the Working Envionments Tool"
sa.SA_WaitForNotification("CloseTool")
388
Sniffaccess
Examples
Options
-ws aWorkingEnv
Refers to the Workspace where Projects are to be generated.
Enter the full hierarchy of the Workspace. The hierarchy always starts
with a slash, each layer in the hierarchy is also separated by a slash.
[-help]
Show a help message.
[-template aTemplate]
A project template (see SNIFF_DIR4/config/templates ).
[-removeEmptyProjects]
46
Remove empty projects. An empty project does not have any file, except
a Project Description File.
[-notRecursive]
Don't walk recursively through the file system tree.
{-scanDir aDirectory}
Scan for files in the given directory(s) and add them to the generated
project.
{-createDir aDirectory}
Create a project for the given directory. Note that this it does not influence where PDFs will be stored.
389
{-ignoreDir aDirectory}
Ignore this directory; don't create a Project for that directory and don't
add it to the project tree.
Examples
390
Sniffaccess
Sniffaccess Command Reference
SNIFF_DIR4/docs/sniffaccess.pdf
391
46
392
47
Configuring the C++ Parser
Overview
393
394
47.1 Introduction
You can influence how your source code is parsed either directly in the
Project Properties dialog (for simple options)use <F1> for context help
in the Project Propertiesor using a configuration file (the location of
which must also be specified in the Project Properties).
Options such as patterns to be ignored or replaced, context definitions,
and general options such as where to send error messages can be configured.
The file is in plain text, lines have to end with newline (\n)like standard
Unix text filesor with carriage return, newline (\r\n) - like standard
Windows text files.
Each line may contain one or, in many cases, more configuration options.
If more than one option per line is used, each option must end with the
appropriate option separator.
Multiple parser filter rules on the same line must be separated by ';'.
In general, option-values (e.g. filenames, macro-values etc.) may not contain any whitespace characters. If whitespace characters are needed
(e.g. in c:\my files\source\), the value has to be enclosed in double
quotes: "c:\my files\source\". On the other hand, any unnecessary whitespace characters are ignored (including empty lines and trailing
blanks before the end of line characters).
Comments may be used anywhere in the file. They start with // and
extend to the end of the line.
395
47
47.3 Ignore-Rules
You can define rules for ignoring patterns.
A pattern can, for example, define a string, or a line containing a string,
as well as a number of other things (see Parser Filter Patterns page
398)
Example
The pattern: string "foo" will match foo
The pattern: line "foo" will match a line containing foo
Ignore-rules
ignore <ignore-pattern>
To use multiple ignore rules on a single line, use ';' as separator, e.g.,
ignore string "foo" ; ignore string "bar"
ignore <pattern>
ignore <from-to-pattern>
Ignores the given pattern.
396
wordchars := <charset>
Sets the word character set.
wordchars += <charset>
Adds the charset to the word character set.
wordchars -= <charset>
Removes the charset from the word character set.
<charset> must be written in flex syntax as
397
47
[<character1><character2>...]
Note
398
leading
Only match at the beginning of a word.
trailing
Only match at the end of a word.
anywhere
Match anywhere in a word.
whole
Used together with the modifiers leading, trailing, or anywhere; if
a part of the word is matched with these modifiers, the whole modifier
will output the whole that was partially matched.
<default>
If none of the above modifiers are used for string matches, only whole
words are matched.
47
399
400
begin
Only match at beginning of the line.
inclusive
start-at rule in context definition: the matched text is part of the
context to be started here, that is, the matched text is rescanned by all
rules which are active in this context.
exclusive
from-to patterns: Does not change the text matched by the "from"string and the text matched by the "to"-string. The text matched by the
"to"-string is rescanned and is considered for matches by other rules.
end-at rule in context definition: The matched text is not part of the
context to be ended here. The text matched by the pattern is rescanned
in the context which is active after leaving the context to be ended with
this rule.
switch-to context rule in context definition: The matched text is not
part of the context to be ended but it is part of the context to be started,
i.e., the matched text is rescanned by all rules which are active in the
context to be started.
start-at rule in context definition: "exclusive" is not yet supported
for this type of rule.
target_inclusive
Only valid for the switch-to context rule: The matched text is part of
the context to be started here, i.e. the matched text is rescanned by all
rules which are active in this context. Only valid if "exclusive" is also
set.
no_default
Do not match in the default context (see Real Contexts page 401
for more information about the default context).
<contextname>
Also match in the context 'contextname'. contextname' may be a real
context or a set. Multiple context names may be specified. The default
context is assumed implicitly except if the modifier no_default is specified (see also Context Rules page 401).
401
47
If, within a context "foo", the start pattern of another context ("bar") is
matched, "foo" becomes inactive, and "bar" becomes active. When the
end of the "bar" context is reached, "foo" becomes active again.
"start at"
Push the context onto the context stack.
"end at"
Pop the context from the context stack.
The context at the top of the stack is active; that is,. all patterns are
active that have this context specified as a modifier.
Multiple contexts
A filter-rule can be active in multiple contexts, just specify all the contexts as modifiers of this rule, e.g.
402
Syntax of <context-definition>
<context-definition-body> may contain the following rules:
Note
Multiple rules (even of the same rule-type) are allowed.
start at <pattern>
start at <pattern> replace by <replacement-string>
start at <pattern> ignore
Defines the start of the context, optionally with implicit replacements/
ignore which replace/ignore the text matched by the pattern of this rule.
end at <pattern>
end at <pattern> replace by <replacement-string>
end at <pattern> ignore
Defines the end of the pattern.
403
by
47
Syntax of <context-set>
The list of contexts defining a context set must always be enclosed in
parenthesis.
<context-set> can be:
404
( )
Empty context set, not even the default context.
not ( )
Set of all contexts. This means all contexts defined implicitly or in the
parser-configuration file, even if the definition of the context appears after
this context set expression.
A context set can be used as a modifier for a rule instead of specifying all
the contexts as modifiers, for example:
ignore string "xyz" foo bar baz
is equivalent to the following construct using the context set fbb.
context fbb := ( foo bar baz )
ignore string "xyz" fbb
The definition of a context set may contain other context sets, for example:
context abc := ( foo bar )
context xyz := ( abc baz )
Then "xyz" contains "foo", "bar" and "baz".
In the following definition, the context set "all" contains all contexts:
context all := not ()
405
47
-e
Send errors to log
-e=filename
-e="filename"
Save errors to file filename. The errors are always appended to this
file. Therefore, we suggest that you delete this error-log file from time to
time.
-S
-C
Deprecated options, a warning is generated
define macroname
define macroname text....
define macroname(param1,...) text...
undef macroname
Like the #define command of the C preprocessor. Text may extend past
the end of the line, if the line ends with '\' (also as in standard C syntax).
Caution
Do not write #define macroname in the configuration file instead
of define macroname, since the '#' character denotes the start of
a comment.
406
define_predefined macroname
define_predefined macroname text....
define_predefined macroname(param1,...) text...
undef_predefined macroname
like define/undef, but denotes a predefined macro. Predefined
macros can be cleared using the -N' option (see below)
The following options must end either with a newline character or any
amount of whitespace characters and may be followed by other options
on the same line like all options that start with "-".
-Dmacroname
-Dmacroname=value
-Dmacroname="value"
-Umacroname
like standard C++ compiler semantics: -D defines a macro, -U undefines it.
-N
No predefined macros. Undefines all predefined macros like __STDC__
__cplusplus__ etc.
-Ipath
-I"path"
Append 'path' to the standard and user include paths.
Note
The standard include path is the path used by
47
-IClear the standard include path, i.e., all "-I-" options specified before "-I-"
are only interpreted by #include "file.h" but not by #include
<file.h>
-Lfilename
-L"filename"
Preload include file. Has the same effect as prepending '#include
"filename"' to every file the parser is going to process.
407
-Pfilename
As in -LFileName (above); no dependency information is, however,
generated for these files, nor are these files displayed in the Include
Browser.
Use e.g. for resolving macros defined in files where no direct dependency exists.
--no-error-std-include
Do not generate error messages for unfound standard includes, e.g.
#include
<stdio.h>
47.10 Examples
47.10.1 Simple Parser Filter Configuration
ignore string "foo"
replace regex /fo*/ begin by "bar"
// replace 'f' followed by any number of 'o's
// by "bar", but only at the beginning of a line
408
47
409
410
411
47
412
48
Cross-Reference Information
Overview
413
48.1 Introduction
Cross-reference (X-Ref) information describes where a certain construct
is used (referenced) and which other constructs it in turn uses (or refers
to).
SNiFF+ distinguishes between structural symbol information and symbol
usage (X-Ref) information. For non-C/C++ languages, this differentiation
is transparent to the user. For C/C++, automatic generation of X-Ref
information can be suppressed if performance becomes a problem in
very large and complex Projects.
Cross-reference information is stored in a database. In layered Workspaces, this database is shared, which means that access controls have
to be implemented to ensure consistency.
In the following, suppression and on-demand updates of X-Ref information in C/C++ Projects is described. The implications of database sharing among Workspaces are illustrated by a number of examples.
when Projects are opened if the symbol table is not available or out-ofdate
All structural symbol information is written to the symbol table, that is in
.sniff/*.symtab.V* files stored per Project directory under the
Workspace Generated Files Location.
All generated X-Ref (usage) information is written to a database and
s tore d a t th e Wo rk sp ac e Gen erate d F iles L oc atio n in th e
.sniffdb.V* directory.
414
Cross-Reference Information
C/C++: Automatic Generation of Cross-Reference Information
In the Workspace Manager, highlight the Workspace you want to set, and
choose Right-click > Workspace Properties.
415
48
416
Cross-Reference Information
Workspaces and Cross-Referencing
Example
For day-to-day development work, you will generally open Projects (with
symbol information) in your own Workspace. Because you will want any
changes you make to be reflected also in the cross-reference information, you need Write access to the X-Ref database for that Workspace.
Which is not a problem. A problem will only arises if and when another
SNiFF+ session tries to open Projects (with symbols) in that same Workspace.
Example
What happens when a shared Workspace needs to be updated?
Updating a Workspace means, among other things, Write access to its
X-Ref database. And Write access is hierarchically absolutely exclusive, that is, all Projects open (with symbol information) in lower-level
Workspaces have to be closed. Please refer also to Write access to an
X-Ref database that is already opened in Read mode. page 418.
Example
Each user may have Projects opened (with symbols) in his or her own
Workspace, that is, with Write access to the Workspaces X-Ref database. These private Workspaces may all access a common parent Workspace. All team members will therefore have Read access to the shared
Workspaces X-Ref database.
417
48
418
Cross-Reference Information
Location and Repair of X-Ref Databases
419
420
Part XI
Appendix
Glossary
422
A
Regular Expressions in SNiFF+
Overview
423
A.1 Introduction
Basically, regular expressions are a system of matching character patterns.
Regular expressions (regex) are a powerful means to specify patterns for
filters and search strings in the various SNiFF+ tools.
The syntax in SNiFF+ conforms largely to the GNU regular expression
syntax used in the Emacs editor, with some SNiFF+ specific enhancements.
424
Regex
matches
escape
beginning of line
end of line
[...]
character list
[^...]
!<regex>
\b<regex>
<regex>\b
\B<regex>
<regex>\B
Regex
matches
\<regex>
<regex>\
\f
formfeed
\n
newline
\r
carriage return
\t
tab
\v
vertical tab
\s
[ \f\n\r\t\v]
\S
\d
\D
\w
\W
\(<regex>\)
groups
\0...\9
\|
alternative
%s
425
Expression
Matches
b, ...
ABC
ABC
123, ...
Backslash (\)
Period (.)
Asterisk (*)
Caret (^)
426
Expression
Matches
\, ...
Expression
Matches
\\
\ \, ...
\n
n, \, ...
\a
\, ...
Expression
Matches
.et
got...
427
428
Expression
Matches
Do*Command
DCommand
myDoCommand
DoooCommand ...
DoMenuCommand
abc ...
Do+Command
DoCommand
myDoooCommands ...
DCommand
DoMenuCommand ...
Do?Command
DCommand
DoCommand
(anything else)
Expression
Matches
\bCommand
Command
DoCommand
Command er
...
Command
DoCommand
Commander
\bCommand\b
Command (only)
(anything else)
get\B
getDate, forgetful
get, forget...
\Bget
forget, forgetful
get, getDate...
Command\b
...
429
Expression
Matches
^void
// void, avoid,
void preceded by any
characters...
)$
anything where ) is
followed by any characters, e.g. ;
430
Expression
Matches
\.*
.*\
Space <space>
Formfeed \f
Newline \n
Carriage-return \r
Tab \t
Vertical tab \v
Expression
Matches
[ \t]+$
431
Expression
Matches
[gs]et
(anything else)
Expression
Matches
Do[A-Za-z]*Command
DoCommand
DoMyCommand
Do-Command
Do88Command
abc...
432
Expression
Matches
Do[^\s(Cc]
DoMenuCommand
DomouseCommand
Domino
Do (followed by space)
Do(
DoCommand
abc...
To include the minus sign itself in a range, it must be the first character
(after an initial ^, if any see Excluding a Character List page 432),
e.g., Do[-A-Za-z]*Command would also match Do-Command.
If a right square bracket (]) immediately follows a left square bracket, it
does not terminate the set but is considered to be one of the characters
to match.
The caret (^) in first position negates the rest of the character class.
All other metacharacters, such as backslash (\), asterisk (*), or plus
sign (+) etc., are also matched literally if they are inside square brackets.
433
Example
The following example tries to match any call of foo that takes at least one
parameter. The first expression tries to achieve this by excluding ), but
neglects the possibility of nonprinting characters, compound words and nested
parentheses. The second expression covers these eventualities and matches
the entire call up to, and including, the final closing parentheses.
Expression
Matches
Does not
match
foo([^)]+)
foo(a)
foo( )
myfoo(int a, int b, c)...
foo (a)
foo()
(anything else)
<foo\s*(\s*[^)\s][.\n]*])
...
To group an expression so that it can be treated as if it were a single character. For example, a group will be governed by a quantifier like * as if it
were a single character:
Thus, ba\(na\)* matches ba, bana, banana, bananana, etc.
To mark a matched substring for back references. The first nine groups in
a regex can be referenced using \1 through \9.
For example, \(bo)\1 will match bobo. Groups, alternation and back
references can be useful in find/change operations either for global
editing in the Retriever or in the Source Editors Find/Change dialog.
435
Examples
1. This example matches
Find:
Setup\(Menu\|Styles\)
Change to:
Update\1Always
Good results
Found DoSetupMenu and changed to DoUpdateMenuAlways
Found SetupStyles and changed to UpdateStylesAlways
Potential pitfall
Found SetupMenu Styles and changed
waysStyles
Remember: "The first match always wins."
436
to
UpdateMenuAl-
foo(parameter1,parameter2)
and changes the parameter order. Nonprinting characters are not taken
into account, nor are nested parentheses considered.
Find:
<foo(\([^,]+\), \([^,]+\)
Change to:
foo(\2,\1)
Good results
Found foo(a,b) and changed to foo(b,a)
Found foo(int a,char* b) and changed to foo(char* b,int a)
Potential pitfall
Found foo(f(x,y),int b) and changed to foo(y),f(x,int b)
You could of course "fix" the regex by matching ; at the end, but that
does not solve the actual problem. As always, its safer to check before
globally changing things.
Regular expressions are cumbersome for nested parentheses of any
depth, and cannot handle arbitrary depths.
437
438
B
Glossary
Overview
439
440
Browser
A Browser is a tool that is used for viewing data. SNiFF+ offers several
browsers, such as the Include Browser, the Class Browser, or the Hierarchy Browser. The information displayed in a browser can be filtered to
make it more specific.
Editor
An editor is a tool that is used for both viewing and changing data.
SNiFF+ offers a number of editors, such as the Source Editor and the
Diff-Merge tool.
File Type
In order that SNiFF+ can deal with a file correctly, it must be assigned a
File Type, based on its signature. Knowing a files type, SNiFF+ is able to
display the correct icon for the file, present the correct context menu, and
parse the files contents correctly to extract symbol information. Examples of File Types are C++ Implementation, and Java Source.
Index
An index stores references to names and other strings in such a way that
searching can be done quickly by the Retriever. An index saves time
when many searches are to be done, but generating an index for the first
time may require a little patience, and some disk space.
Information Pane
The part of the graphical user interface where the information log and
other non-browser information is displayed. You can hide the pane if you
need more space for browsers.
Navigation Pane
The part of the graphical user interface containing the file list, and symbol
lists. Using the navigation pane, you can quickly find the symbol or file
that interests you, then use browsers to examine how its used in the
source code. You can hide the pane if you need more space for
browsers.
PDF
See Project Description File.
Glossary
Preference
Preferences are the customizable attributes of SNiFF+. SNiFF+ supports
user-level and site-level preferences. Most preferences can be edited
with the Preferences dialog.
Project
A Project is used to modularize source code in a system. Each Project
may contain files, and depend on other Projects, which are called
Subprojects. Use Projects to group and organize your source code.
Project Browser
The main view to a Project; the main SNiFF+ window that holds all other
tools used to work with a Project.
Source Root
Where a Workspaces source code files are stored. Project Description
Files normally refer to source code files using locations which are relative
to the Source Root, so that the same Project can be used in different
Workspaces, each with their own source code.
Symbol
A symbol is a named language construct in the source code. Examples
include classes, global functions and preprocessor macros.
Symbol Table
A Symbol Table is the information base that contains information about
the declaration, definition and use of named program elements such as
classes, methods, variables and functions of a Project. Each Project has
its own Symbol Table that is generated and maintained by the appropriate language parser. Symbol Tables are kept in memory and are
persistently stored to disk.
Template
A generic model for a Project, which can be used to create many
Projects with similar properties. For example, a C Project template may
specify that C source files and C header files are to be included in
Projects instantiated from it.
441
442
Workspace
A Workspace offers a complete source-code engineering context, which
allows a user to develop software, isolated from others. It has its own set
of properties affecting, for example, source-code parsing, and the build
system. The Workspace usually provides file-system storage for its own
copies of source code, using the Source Root, although Workspaces
which refer to source code which do not need to provide their own
storage. The Workspace also specifies where the Project Description
Files, which organize the source code, are stored, as well as other
adminstrative files generated and maintained by SNiFF+, using the
Generated Files Location. The Workspace Manager presents all the
Workspaces available to a user, and shows which Projects are present in
each one.
Workspace Hierarchy
Workspaces may be organized into a hierarchy. In such a hierarchy,
lower Workspaces depend on higher Workspaces. The lower will use the
files present in the upper, except for files which are to be modified (overridden) in the lower. On operating systems which provide symbolic links
(such as Unix), this technique can save space when large amounts of
source code are common between two Workspaces. However, on operating systems without symbolic links (such as Windows), such a technique is less useful.
Glossary
Adaptor
An Adaptor wraps a specific CMVC tool so that SNiFF+ can use it to
implement the generic functions provided to users in the graphical user
interface. For example, both RCS and SCCS are presented to the user in
a similar way through the SNiFF+ menus, despite the fact that the
command-line interfaces to these tools are quite different.
Branch
A Branch occurs in a version tree when you create new revisions of an
element from the middle instead of the end of its history tree. This can be
useful, for example, when fixing bugs in older revisions.
Change-Set
When checking a set of files in (or even just one file), SNiFF+ allows you
to name the related changes by putting a logical label on the revision(s)
created.
Check-in
Check-in is the process of creating a new revision of a file in the Repository. In order to check a file in, you must have locked the repository file
(because otherwise another user might have checked changes in which
you would overwrite). A file check-in can be associated with a ChangeSet. SNiFF+ delegates the actual check-in operation to your underlying
CMVC tool (by means of CMVC adaptors). SNiFF+ allows you to check
multiple files in at once, linking them with a Change-Set.
Check-out
Check-out is the process of obtaining a working file in a Workspace from
a specific revision in the Repository. An exclusive check-out places a lock
in the Repository, and creates a writable working file, while a concurrent
check-out creates a writable working file without locking the Repository.
Finally, a no-lock check-out creates a read-only working file. If you check
a file out while you have a writable working copy, SNiFF+ will ask you to
confirm overwriting your existing working copy.
CMVC
Configuration Management and Version Control.
Configuration
A configuration is usually a coherent and consistent state of a system
(composed of a set of files). Typically, a configuration is a buildable state
of a system. You can freeze such a configuration by giving it a name and
443
thereby creating a virtual snapshot of the system. That is, specific revisions of files then belong to the same, named Freeze-point. See also
Freeze-Point page 444.
Configuration management
Configuration management is the process of controlling and administrating the components of configurations. Configuration management
includes the definition of Freeze-points.
Default Configuration
A Default Configuration is the Configuration of your software system that
you work on. You can set your Default Configuration when you define
your Workspace, by making it dependent on a Configuration node in the
Workspace Manager. SNiFF+ uses your Default Configuration for the
default value when you choose one of the various version control
commands, such as checking files out, and locking and unlocking revisions in the Repository. Source files are made up-to-date with respect to
the Default Configuration.
By default, the HEAD version of your software system is the Default
Configuration for your Workspaces.
Freeze-Point
A Freeze-point is a virtual snapshot of your system at a given point in
time. This configuration of file revisions, usually a stable system, is given
a name and frozen. See also Configuration page 443.
Merge
Merge is the process of combining the contents of two or more files into a
single file. Typically, the files involved in a merge are revisions of a single
Repository element. A merge can be done automatically, but often
requires manual intervention to resolve conflicts. SNiFF+s Diff-Merge
tool is a powerful editor for merging files.
HEAD
HEAD is the latest revision on the trunk or branch of a files history tree.
History
The History reflects all the different revisions of a file and is stored in the
Repository.
INIT
444
Glossary
Integration
Please see Adaptor.
Lock
A lock is a mechanism that controls creation of successor revisions of
elements in the Repository. SNiFF+ distinguishes between exclusive
locks (only one developer can modify a specific revision) and concurrent
locks (multiple developers can simultaneously modify the same revision).
Main branch
A main branch is the starting branch of a file's version tree. Unless otherwise specified by your default configuration, the main branch is the
default branch for CMVC operations.
Repository
A Repository contains all Repository Elements of version-controlled
Projects. The Repository is typically directly accessed only by the
managing CMVC tool, controlled by SNiFF+ through an Adaptor.
Repository Element
A Repository Element is the object in the Repository that saves the
complete history tree of a file.
Revision
A Revision is a specific version of a file. Each time a file is checked in to
the version control system, a new Revision of the file is created. The
Revision history of a file can be viewed using the Revisions tool.
State
State is a descriptive string that can added specified as property of a file
revision. Generally a house-convention is used to identify all file revisions
at the same state of development. This property is then changed when
the file reaches a new state of development. Examples could be
approved or released etc.
Update
Updating is the process of checking out all new HEAD versions of
Projects in a working environment, in order to come up-to-date with the
latest development state. Working files which are writable will not be
overwritten by an update. Updates can be done manually, or automatically
VCS
Version Control System.
445
446
Version
A file can have several versions. Likewise, a software product can have
several versions. Versions in the first sense are called Revisions in
SNiFF+, and versions in the second sense are called Configurations.
This usage helps to avoid confusion caused by the word version.
Version control
Version control is the process of managing and administrating file revisions. Most functionality is accessed through the file list in the navigation
pane.
Working File
A working file is a checked-out revision of a Repository Element, located
in a working environment. Any changes to the working file will be local,
unless the modified file is checked in. Working files are not affected by
new revisions checked into the repository by other users unless an
update is done.
Glossary
Adaptor
An Adaptor wraps a specific debugger, so that SNiFF+ can provide
access to its functionality generically through the graphical user interface.
For example, an adaptor for the GNU debugger gdb allows you to step
through your codes execution and monitor variable values without having
to learn any specific command-line controls.
Build
Building is the process of creating the targets of a Project, usually by
compiling source code files, then possibly linking object files. Building is
controlled by the dependencies described in Build-Support files.
Build-Properties
When a particular file requires special settings for the tool used to build it,
this may be done using the files build properties. For example, a file may
require a specific preprocessor macro to be set, which is not relevant for
any other file in the system. Such local build-properties override more
general properties defined by the environment.
Build-Support File
A Build-Support file is a control file for the Build process, generated by
SNiFF+. It contains information about dependencies, based on SNiFF+s
knowledge of the source code, and information about which Build Tools
to use. For example, such a file may specify that A.obj is to be built if
A.cpp is newer, using the C++ compiler.
Build Tool
A Build Tool is a translator (such as a compiler) that must be used to
generate a derived file from the files it is dependent on. The precise
settings for each Build Tool are selected according to the chosen Platform.
Dependency
A dependency is a relationship between two files that implies that one file
must be updated or rebuilt when the other one changes. For example, an
object file (or a class file) is dependent on the source code file that its
compiled from. Source-level dependencies can be extracted from source
code and are typically stored in dependency files. SNiFF+ generates
dependency files that are included by Makefiles as part of its BuildSupport feature.
447
448
Derived file
A derived file is a file that can be generated (derived) from another file. A
typical example is an object file, generated from a source file through
compilation.
Make
Make is the program that reads Makefiles and drives the build process.
SNiFF+ integrates a wide range of different Make implementations.
Makefile
A Makefile is a text file read by Make programs that describes the
building of targets. A Makefile contains source-level dependencies and
build-order dependencies. As part of its Make Support feature, SNiFF+
generates Build Support Files that contain both kinds dependency information.
Platform
A Platform identifies a particular target architecture for the Build process,
for example, Windows or Linux. Each Platform specification has its own
settings for Build Tools: for the Windows Platform, the C++ compiler may
be called cl, while on Linux its name would be g++. Output for different
Platforms is normally placed in different Redirection Directories.
Redirection Directory
When a Build is performed, the results of the build are placed in a
specific Redirection Directory, based on the Platform selected by the
user. This avoids problems such as linking together code compiled for
different architectures, or accidently linking debug and optimized code
together.
Target
Making a target up-to-date is the aim of the build process. A target is
often an output file, such as a executable, or a library. SNiFF+ allows
multiple targets to be specified for a single Project. Building the target
means checking (transitively) all the dependencies of the target, and
using the correct Build Tool to update any out-of-date files.
Index
A
absolute project 88
how and why 89
ada
set targets and debugger 175
ada and tornado 165
ada and vwxorks 165
ada integration script 170
adaptor, create version control 252
additional includes 145
administrator, workspaces 33
analysis and browsing workspace 39
application target (java), build 159
autonomous workspace 42
B
batch mode 130
branch 257
create branch revision 261
from configuration 258
head and 258
using 261
working on 262
working with, introduction 259
build
ada projects 165
c/c++, additional includes 145
c/c++, summary of steps 140
concepts 447
custom setup 193
custom target 193
gnat 165
idl projects 187
ignore dependencies 151
inheritance of properties 241
introduction to the system 222
jar targets 181
java file 159
java idl 181
java project 159
java projects 149
jni 181
platform change in batch mode 132
project structure restrictions, c/c++ 246
project structure restrictions, java 246
remote 197
rmi 181
tool assignment 238
unattended for different platforms 132
workspace and, introduction 20
build host, remote 226
settings 74
build properties
file 75
file type for version controlling 76
file, create project for 78
inheritance, cascading and levelling 242
inheritance, file level 243
449
234
C
c++ code documentation
generate 121
introduction 120
tags recognized 123
c++ parser 393
configuration options, general 406
configure 393
c/c++ project
additional includes 145
automatic generation of cross-reference
information 415
build setup, summary of steps 140
build system and project structure 246
build tool settings, verify 146
parsing 73
set include paths 143
set targets and debugger adaptor 141, 175
change-set 257
check in 256
first 53
check out 256
first 61
class path to libraries 156
clearcase
change config spec 272
change view 271
clearmake 273
create project for 271
how to integrate 271
preparation 47
set generated files location 272
synchronize project with view changes 273
vobs and views in sniff+ 271
workspaces 47
clearmake
default for new workspace 275
existing workspace, and 273
using 273
cmvc, basic concepts and terminology 255
code documentation comments 122
code location 84
command line
sniff 130
synchronize 128
update 128
update script paramaters 131
comments, for code documentation 122
compile, file 246
compiler
c++ 228
flag for jdk 1.1.x (-c command line length) 158
java 206
concepts, glossary 439
build 447
system 440
version control 443
configuration 256
branch from 258
context menu, custom 361
context menu,context 364
create
450
Index
custom template 88
file type 106
project for build properties file 78
project for clearcase-controlled code 271
project from template 87
project with wizard 85
create file 96
creation wizard, project 49
cross-reference system 413
c/c++ vs. other languages 415
database access control 416
force update 416
location and repair of databases 419
update 416
workspace properties, set 415
workspace, and 416
workspace, synchronize 419
custom build setup 193
custom menu 361
right-click 364
custom menu configuration file 362
specification 367
custom project template 88
custom targets, enable menu 193
cvs
integrate 277
migrating to 288
pitfalls 289
remote repository and multi-site development 288
version and compatibility 278
windows to unix 288
cvvs
synchronize project with on-disk changes 287
D
database
location 419
repair 419
debug 211
and own makefiles 193
application project 212
debugger 213
java,remote vm 160
java,startup parameters 162
multiple sessions 217
remote 197
romote target vm 160
target 213
default configuration
assign to workspace 266
branch development, and 19
hierarchical workspace, and 268
default platform 209, 226
delete file from disk 96
delete project 98
derived file
signature 229
derived file type 104, 107
as intermediate product 108
directory
documenter output 121
java output classes 155
location of redirection 225
make command and redirection 224
scan project 99
workspace configuration 43
documentation
code, introduction 120
comment, description section 122
comments 122
general form and location 122
generate for c++ code 121
tag list 123
documention
output directory 121
E
emacs 307
command reference 313
connect 310
how integration works 308
integrate 309
451
265
check-in 53
check-out 61
team member 48
flag for jdk 1.1.x compiler 158
flat workspace, hierarchical vs. 31
force update, cross-reference information 416
format of parser configuration file, general 395
fortran 111
freeze head 265
generate
c++ documentation 121
include-paths 144
generated documetation, general form and location
generated files location 23
generated files, relative location 25
generated includes 229
generated target settings 238
gnat
build 165
gnat and tornado/vxworks 165
gnat integration 170
gnat integration script 170
H
head 258
branch, and 258
freeze 265
hierarchical workspace 31
do not use if 31
host settings, remote build 74
host, remote build 226
how and why absolute projects 89
452
122
Index
I
idl
add file 190
add file type 190
browsing 191
derived file types 188
file types 188
how mapped 191
interface file type 188
java compiler 184
parser mapping 191
project 187
requirements 189
symbol 191
what to do 189
ignore dependencies 151
implicit workspace selection 89
include-directives, order 237
include-paths, generate 144
includes, additional 145
includes, generated 229
inheritance of build information 241
init 258
integration
emacs 307
pvcs 291
rose 329
set version control tool 253
sourcesafe 299
version control tools 251
vim 319
integration script 170
J
jar 181, 184
java
application target, build 159
archive builder 184
build project 159
build project classes 159
L
layered workspace, do not use if 31
literals and metacharacters 426
location
generated files 24
project and makefiles 24
redirection directories 225
source code 84
source root 24
lock 256
453
158
output location
N
new
file type, create 106
platform as default 209
project from template 87
project with wizard 85
team members 63, 70
workspace 63, 69
O
obsolete files 99, 128
open
options for opening projects 93
project 62, 92
project from workspace 92
open-project options, accessing 95
options, syncProj.py 134
options, updateWs.py 131
other files 99
output directory, documenter 121
224
P
parameters
remote java debug 162
parameters, project synchronization script 134
parameters, update script 131
parser
c++ configuration file, general format of 395
c++ configuration options, general 406
configure the c++ 393
configuring c++, introduction 395
parsing, c/c++ 73
passed to super project format 229
passed to superproject format 229
paths, generated include- 144
percent sign, used in macros 234
platform 223, 231, 235
build tools and settings 232, 236
change in batch builds 132
copy 209
default 226
default, new 209
pre-defined field names, arbitrary and 234
preferences 242
file types 105
modify site-level 207
project 13
absolute 88
absolute, how and why 89
absolute,whats wrong with 88
add files 99
add/remove file 97
add/remove subprojects 98
and workspace, create 37
application 212
build 245
build ada 165
build and structure, c/c++ 246
build and structure, java 246
build c/c++ 139
454
Index
R
rational rose integration 329
read-only database access 94
redirection directory
location of 225
make command and 224
455
restrictions
c++, project build structure 246
java, project build structure 246
reverse order 237
right-click custom menu 364
right-click menu, custom 361
rmi 181
rmi stub compiler 185
rose integration 329
run 211
application project 212
custom target 193
target 212
run sniff without gui 130
S
script, ada integration 170
set
project targets and build tools 182
remote build hosts for workspace 198
remote host as default 201
version control integration 253
settings
build tool 74, 247
modify build tool template, and 205
remote build host 74
sharing or layering workspace 20
site-level preferences
build properties and 207
modify 207
site-level workspace configuration 44
sniff in batch mode 130
sniff+ pro build system, introduction 221
sniff+, version control tools and 252
SNIFF_DIR4 8
sniffaccess
connecting to 374
data input/output 375
datatypes 375
examples 381
introduction 372
456
Index
invoking 373
terminating sniff 375
sniffapi
architecture 340
compile sample program 356
concepts 339
data model 349
encoding details 348
getting started 353
id concept 347
introduction 340
jar file setup 355
query interface 341
requirements 354
run sample program 356
scope handling 345
set up jar files for client compilation
usage model 342
source code location 84
source root 22
location 24
write permission 48
sourcesafe 299
branch 303
change-set 303
check in 302
compatibility 300
configuration 303
file descriptions 303
integrate 299
locking 303
prerequisites 300
set up project with 301
start sniff in batch mode 130
startup parameters
java debug 162
subprojects, add/remove 98
subroject
add new 89
supported version control tools 252
synchronizing projects 125
outside of sniff+ 128
126
T
tags
354
123
documentation, java 124
documentation, java and c/c++ 123
target
build application 159
debug 213
properties 238
run 212
team project
preparation 46
template
create custom 88
create project from 87
terminology 439
source root, generated files location, and
repository 21
version control 256
tornado/vxworks and gnat 165
U
unattended updates 130
update
project from command line 128
update cross-reference information 416
update script parameters 131
update-order, workspace 127
updateWS.py, parameters 131
V
verify project platform settings
version control
457
202
W
wizard
create project with 85
project creation 49
templates and 83
workspace 17, 21, 29
administrator 33
analysis and browsing only 39
and projects, introduction 18
and repository access 264
assign default configuration 266
assign default configuration to 266
autonomous 42
branches and default configurations 264
build properties, modify 74, 208
build properties, project for 78
configuration data 42
configuration directory 43
configuration, site-level 44
configurations, and branches 263
create 38
create dependent 68
create new 60
create node for shared 67
default configuration 266
disk space,and 32
existing, and clearmake 273
first 46
flat, new team members 57
hierarchical vs. flat 31
hierarchical, caveate 31
hierarchical, new team members 65
hierarchical, not suitable 31
hierarchical, organization and coordination
hierarchical,issues 32
implicit selection 89
manage 71
name and locations 73
new 63, 69
open project from 92
organization systems 30
performance 32
properties 73
reorganizing 72
stand-alone 35, 36
stand-alone plus project 36
stand-alone without project 38
storage 18
synchronize build properties 210
teams from scratch 45
user autonomy, and 41
what for 18
write/read-only database-access 94
458
54