Dec 282017
A generic cross reference generator for C, Turbo Pascal, and Basic.
File XR10.ZIP from The Programmer’s Corner in
Category Miscellaneous Language Source Code
A generic cross reference generator for C, Turbo Pascal, and Basic.
File Name File Size Zip Size Zip Type
BAS.XRF 885 484 deflated
C.XRF 873 472 deflated
PAS.XRF 1053 601 deflated
XR.C 24790 5604 deflated
XR.DOC 3372 1559 deflated
XR.EXE 16365 9781 deflated
XR10 535 360 deflated

Download File XR10.ZIP Here

Contents of the XR.DOC file

XR.EXE ver 1.0 by Bob Montgomery 9-12-88

A generic cross reference generator for C, Turbo Pascal, and Basic (regular and
QuickBasic). The command line format is given by entering XR, and is:

XR [options] input_name.ext [/o output_name]
Options: /wn sets listing width to n chars/line (132 default)
/ln sets listing length to n lines/page (80 default)
/mn sets left margin in listing to n characters (5 default)\n")
/dfv d=print duplicate line #s, v=variables only,
f=functions only

The extension on the input file tells XR which language to use, and it loads
a file of reserved words peculiar to that language with extension XRF. In the
XRF file, any line beginning with a # is a comment line, and all the words on
that line are ignored. The words on all other lines (seperated by spaces or a
carriage return) are loaded into memory as a 'dictionary' of symbols to be
ignored by XR. There are XRF files included for C, Turbo Pascal, and Basic.
These may be modified to suit your needs with any editor, and may hold up to
500 words.

The C source for XR is included, in case you need to modify it to handle a
different language, or a newer version of an included language. Almost all the
differences between the languages are handled by the filter() function, which
removes comments and punctuation. The source is heavily commented, so you
should not have much trouble following it.

The program builds a binary tree of symbol structures, where each symbol
structure has a pointer to the symbol name, the number of occurances of the
symbol in the input file, a pointer to the first line_number structure for that
symbol, and left and right pointers for the binary tree. Each line_number
structure has the line number where the symbol occured, and a pointer to the
next line_number structure for that symbol. The name strings are stored in
memory more or less at random, with an array of pointers to the dictionary
string locations (Exceptions), and a pointer in the symbol structures to the
symbol names for variables and functions.

The printout module symprint() recursively traverses the binary tree to give an
alphabetical listing of the symbols in the input file. It calls numprint(),
which recursively prints the line numbers where the symbol occured. This
consumes stack space, hence the /STACK:10000 linker switch requirement. The /o
switch sends the formatted output to a file, which may then be copied to the

The other command line options allow you to format the output the way you like
(line/page, chars/line, and left margin) and the /d, f, or v switches give
added options. If the last line on a page is a symbol, and the line number
listing is only one line long, XR goes ahead and prints the line numbers before
doing a form feed.

Enjoy, but please do not modify the contents of this ARC file and reupload. It
is very hard to answer questions about a modified program.
Bob Montgomey CIS [73357,3140]
132 Parsons Road
Longwood, Fl 32779
Any suggestions or comments can be mailed directly to me, or left on the
following BBS's:
Compuserve (PICS Forum)
Tsunami BBS, Half Moon Bay, Calif. (415) 726-2726
PC Rockland, S. Nyack, NY (914) 353-2538 [Freeboard] 600+ Meg Online

 December 28, 2017  Add comments

Leave a Reply