======== cxrefbas ======== ---------------------------------------------------------- Code cross-reference for tokenized Atari 8-bit BASIC files ---------------------------------------------------------- .. include:: manhdr.rst SYNOPSIS ======== cxrefbas [**-v**] **input-file** DESCRIPTION =========== **cxrefbas** reads an Atari 8-bit BASIC tokenized program. For each line number in the program, it prints a list of lines that reference it. **input-file** must be a tokenized (SAVEd) Atari BASIC program. Use *-* to read from standard input, but **cxrefbas** will refuse to read from standard input if it's a terminal. Each line number reference in the output is followed by a letter that indicates the type of reference: **G** *GOTO* (without *ON*) or *GO TO*. **S** *GOSUB* (without *ON*). **I** *IF* with line number only, e.g. *IF X THEN 1000*. **O** *ON/GOTO* or *ON/GOSUB*. **R** *RESTORE*. **T** *TRAP*. **L** *LIST*. It's very rare for a program to *LIST* parts of itself, but it's allowed by BASIC so it's supported here. If a line doesn't exist, but is referenced (e.g. *GOTO 100*, but there is no line 100), it's printed in the table, prefixed with *!*. Any command that uses a computed value for a line number will print a warning on standard error, e.g. *GOTO A* or *GOSUB 100\*A*. Even *GOTO 100+0* is a computed value, since BASIC doesn't do constant folding. Line numbers above 32767, e.g. *TRAP 40000*, are not listed. Atari BASIC allows fractional line numbers, such as *GOTO 123.4*. These are rounded to the nearest integer when the program is executed. **cxrefbas** handles these correctly, although you're not likely to run into them in real-world programs. OPTIONS ======= There are no application-specific options. .. include:: genopts.rst EXAMPLE ======= This program:: 10 GOSUB 100:GOSUB 200 100 RESTORE 1000:IF A THEN 120 110 GOTO 200 120 ON B GOTO 300,310,320 200 RETURN 300 PRINT 1 310 PRINT 2 1000 DATA XYZ Produces this output:: 100: 10:S 120: 100:I 200: 10:S 110:G 300: 120:O 310: 120:O !320: 120:O 1000: 100:R Note that line 320 doesn't exist in the program, so it's shown with *!* in the output. Line 120 has *100:I*; if the *THEN 120* were changed to *THEN GOTO 120*, line 120 would read *100:G*. EXIT STATUS =========== 0 for success, 1 for failure. .. include:: manftr.rst