Tools overview, Alt-f10, Crtags: cross-referencing source files crtags – Crunch CRiSP File Editor 6 User Manual

Page 10

Advertising
background image

Page 10

the usability features of CRiSP but also contain useful real-life examples of various aspects of CRiSP
macro programming.

3.

Where possibly, try and maintain a macro programming style. Do not write throwaway macros - treat
them with respect. For example, format them nicely, comment them, lay them out well. You will find it so
much easier to revisit your macros at a later date, or if you need to pass them on to people, they will
actually understand your code. Of course, this is what you should be doing with all your code, whether it
be CRiSP or C or Ada.

The macros supplied with CRiSP cover a lot of ground. These macros have evolved and grown over the
years. Some of these macros represent good solid examples of programming, others are not quite in the
same calibre. Many of these macros have evolved from an experiment to real use. So the coding styles are
not necessarily consistent. As each new version of CRiSP is released, new ideas are tried and the macros
are refined. As an example the capability to declare static variables and static functions is a relatively recent
addition to CRiSP. So not all functions which should be are marked with the static storage class specifier.

If you are planning to write a large complex macro, then the best recommendation is to start off with
something simple - experimenting at each step of the way, slowly refining and adding the required
functionality. This is how all of the functions in CRiSP have evolved. If you write a large macro without
experimentation, then you may find it very difficult to debug unless you have a good understanding of all the
information available. Although CRiSP looks and feels like a C interpreter, you should remember that it is
really an extensible file editor. By being very focused in your aims and expectations, you can know what to
look for.

Tools Overview

This section provides command line summary information of the various command line tools provided with
CRiSP. As a macro programmer, the tool you are most likely to use is the crunch compiler. If you are not
interested in writing CRiSP macros, then you are more likely to find the crtags tool of use to you.

cm(pg. 90).

This is a low level macro language compiler. It is provided for completeness and
backwards compatibility with the older BRIEF .m style macros.

crpp

This is the macro language preprocessor. It is very similar to a C or C++ preprocessor, but
is supplied as part of the macro compilation system, since it is not possible to rely on
customers having a C compiler installed on their system. It is not normally invoked
directly, but is used by the crunch compiler.

crunch(pg. 14). This is the main macro compiler which you can use to compile source files in the crunch

language (extension .cr) into compiled macro files (extension .cm). This is invoked
automatically if you use the <Alt-F10> key in CRiSP to compile the current buffer, or the
load command at the Command: prompt.

<Alt-F10>

crtags(pg. 10).

This command is used to generate a cross reference tags file for source files. A number of
languages are supported. Although this command has nothing to do with macro writing (it
can be used on crunch macro files however), it is described in this document.

CRiSP provides a full user interface for manipulating tag files - creating tags, and using
the class browser window to view the objects defined in a user's project.

crtags: cross-referencing source files

crtags

The crtags program is an enhanced tags utility loosely based on the Unix program 'tags' which is

normally used in conjunction with the 'vi' editor. A tags file is a file which contains a database of all language
specific constructs of source files, e.g. function definitions, type definitions, constants, etc.

The crtags program can be used to scan source files in various languages and produce a database file
listing the occurrences of important elements of the language, such as function definitions, constant
definitions, structures, classes, etc.

The supported languages are listed later in this section together with some application notes relating to each
language.

You can get a quick command line summary using the '-help' command line switch.

The basic command line syntax is:

Advertising