Topic: ALL macro - non-unique line condensed display (1 of 1), Read 98 times
Conf: VEDIT Macro Library
From: Deleted User
Date: Tuesday, March 09, 1999 08:56 AM

The macros I placed in this forum earlier, CONDCOB and CONDC, used to
present a condensed listing of COBOL and C programs, rely on the fact
that the lines shown in the condensation display are UNIQUE. For
example, in a COBOL program, paragraph names (at the place where the
paragraph is defined) are guaranteed unique, since a paragraph name
starts in columns 8 thru 11. A REFERENCE to that paragraph anywhere else
in the program will have to be in columns 12 thru 68. This is almost the
same in a C program, since the macro assumes that the function
definition starts in column 1, and few programmers REFERENCE functions
in column 1, and also the reference usually looks different, with
arguments passed to the function.

The above allows these macros to do a SEARCH of the line on the
condensed display when trying to find it in the full file. it works
nicely, especially since Vedit's searching is so fast. It has the added
benefit that the condensed view will still function correctly after
changes have been made to the original file.

However, sometimes you want a condensed view of lines that are NOT
guaranteed to be unique. This is where the macro ALL.VDM comes in. It
lets you get a condensed display of all lines in a file matching a
search string that you provide. The macro works by building an array of
the line numbers that match the criteria, and returning to the line to
position you in the original file.

ALL comes with a support macro named ALLDEL.VDM. It allows you to block
(select) lines in the condensed display that you want deleted from the
ORIGINAL file. You then run the macro (via hot-key CTRL-D or via a
LOAD/EXECUTE) and it deletes the lines from the original file, marking
them as deleted in the condensed display. As a safety precaution, ALLDEL
checks the characters in the line in the original file to make sure they
match the characters from the line in the condensed listing before
doing the deletion.

ALL was my first attempt to use an array in Vedit. Pretty hairy, but it
seems to work OK.