previous next top contents index framed top this page unframed
XREF writes a cross-reference for a text file. The cross-reference lists each non-keyword MAINSAIL identifier along with each page and line on which it occurs. Identifiers within STRING quotes and in comments, and characters after single quotes, are ignored. The case of identifiers is ignored; e.g., abc is the same as ABC and aBc.
XREF prompts for the keyword option to be used when scanning the input files (keywords are omitted from the cross-reference listing). Table 36–1 lists the available responses. Only enough of the option to make it uniquely identifiable need be typed.
Table 36–1. XREF Keyword Options
| no keywords |
| MAINSAIL keywords |
| just keyword file |
| keyword file plus MAINSAIL keywords |
| help |
Options include specifying MAINSAIL keywords, those in a user file, both MAINSAIL keywords and those in a user file, and no keywords. The keyword file is assumed to consist of keywords separated by any mixture of blanks, tabs, eols or eops. MAINSAIL keywords (reserved identifiers) are listed in Appendix G of the MAINSAIL Language Manual.
After the keyword option has been specified, XREF prompts for the start and stop columns, startCol and stopCol, for the page.line information for each identifier. The cross-referenced identifiers are output in alphabetic order, beginning in column 0. The page.line information is listed in ascending order beginning with column startCol and not exceeding column stopCol (startCol and stopCol are 0-origin). The default startCol is column 20; the default stopCol is 71.
When startCol and stopCol have been read, XREF prompts for input-output file pairs. To exit, type <eol> in response to the Next input file prompt.
Example 36–2 shows a sample use of XREF. User responses are underlined. A cross-reference listing for the file sample is written to the file sample-xrf. MAINSAIL keywords are not included in the list. XREF prints the number of identifiers in the file and the total number of occurrences.
| MAINSAIL (R) Version 16.20.<release> (? for help) Revision: <date> Copyright (c) 1984-1998 by XIDAK, Inc., Point Arena, California, USA. *xref<eol> Keyword option (? for responses): m<eol> startCol stopCol (just eol for 20 71, ? for help): <eol> Next input file (just eol for none): sample<eol> Output file: sample-xrf<eol> 12 different ids. 33 occurrences. Next input file (just eol for none): <eol> * |
Example 36–3 gives the XREF output for the file sample.
Example 36–3. XREF Output for sample
| Keyword Options: MAINSAIL keywords Input File: sample Statistics: 12 different ids. 33 occurrences. BUCKETSIZE 1.3 1.11 1.17 CREAD 1.10 CVI 1.17 EOL 1.20 1.20 H 1.8 1.9 1.9 1.10 1.11 HASH 1.6 1.20 I 1.8 1.9 1.10 J 1.8 1.9 1.10 1.10 LENGTH 1.9 S 1.6 1.9 1.10 1.16 1.19 1.20 TTYREAD 1.17 1.19 TTYWRITE 1.17 1.18 1.20 |
For information on cross-reference information available directly from the MAINSAIL compiler, see the descriptions of the utility XRFMRG in Chapter 6 of the MAINSAIL Compiler User's Guide and of the ITFXRF and FLDXRF compiler subcommands in Sections 4.18 and 4.10 of the MAINSAIL Compiler User's Guide.
MAINSAIL Utilities User's Guide, Chapter 36