       SCANTEX/SCANWEAVE

User’s Guide

E. W. (Wayne) Sewell Software Engineering Specialist E-Systems, Garland Division Mail Stop 53730, P. O. Box 660023 Dallas, Texas 75266–0023

June 2, 1987

1 Introduction

This document describes the use of the SCANTEX and SCANWEAVE programs. The following is excerpted from the TUGboat article:

The sample program provided with this article, SCANTEX, actually performs a useful function. It scans a TEX file generated by WEAVE (or MWEAVE, of course) and copies only the sections which have been modified by a change file to a new TEX file, resulting in an abbreviated program listing containing only the changes. The unchanged sections are not copied, nor are the cross-references, the section names, or the title page, which includes the table of contents. Typically, a WEB program running on a wide range of machines (such as TEX itself) has a great number of change files applied to it. For the most part, the main portion of the program is identical in all implementations and certain sections, containing “system dependencies”, are different for each one. Since WEAVE generates a complete listing every time it is run, and a program the size of WEAVE or TANGLE runs to about a hundred pages (and that is small compared to TEX or ), a lot of paper is consumed printing several large listings that are essentially the same. Since writing SCANTEX, I have adopted the practice of printing one full listing generated from the pure WEB source (the way it comes from Stanford, with no change files applied), followed by an abbreviated listing generated by SCANTEX for each change file applied to that program. (In fact, in some cases I print only the changed sections, referring to published versions of the pure WEB source rather than printing it myself. In the case of TEX, I refer to the book TEX: The Program; most of the other Stanford-developed programs also exist as bound documents (available from Maria Code).

Experienced WEB users may wonder why I went to the trouble of writing a program to duplicate a function already provided by the WEB system itself, since the suppression of unchanged sections can be accomplished by placing

    \let\maybe=\iffalse

into the limbo section of the WEB file. The reasons were:

1. SCANTEX does not print the index. Since the index contains entries for the full listing rather than just the abbreviated one, a program the size of TEX can have an index that is much longer than the rest of the listing.

2. Since SCANTEX is an external program, neither the WEB file nor the changefile must be modified to turn suppression on or off.

3. If the TEX file is to be saved, the reduced version generated by SCANTEX takes up much less disk space.

4. I was unaware that the builtin mechanism existed when I wrote SCANTEX (the real reason). Since it is buried deep in Appendix G of the WEB manual, it is easy to miss.

SCANTEX and SCANWEAVE are two different versions of the same program. SCANWEAVE is written in regular WEB, while SCANTEX is written in MWEB, a variation of WEB system for the Modula-2 language. The two programs are logically identical. The reason they have different names is because the file type of both of the source files is ‘.web’. SCANTEX was originally written as an example of programming in MWEB, but turned out to be so genuinely useful that I rewrote it in regular WEB so the people without a Modula-2 compiler could use it too.

Ready-to-run versions are provided for VAX/VMS and for MS-DOS. Instructions to port both programs to other systems are also provided. In general, if you have the regular WEB system running, you can run SCANTEX

and SCANWEAVE.

The following files should be present for all implementations:

SCANTEX.WEB    MWEB source file for SCANTEX

SCANTEX.MOD  Modula-2 source file for SCANTEX

SCANTEX.TEX  TEX file for SCANTEX listing
SCANTEX.DVI  DVI file for SCANTEX listing

SCANUSER.TEX LaTEX file for SCANTEX user guide (this document)
SCANUSER.DVI DVI file for SCANTEX user guide (this document)

SCANWEAVE.WEB  WEB file for SCANWEAVE
SCANWEAVE.VAX VAX change file for SCANWEAVE

SCANWEAVE.MSP Microsoft Pascal change file for SCANWEAVE
SCANWEAVE.TUR Turbo Pascal change file for SCANWEAVE

SCANWEAVE.TEX TEX file for SCANWEAVE listing
SCANWEAVE.DVI DVI file for SCANWEAVE listing

2 VAX/VMS

The following additional files should be present for the VAX implementation:

SCANWEAVE.CLD VMS Command Language Definition file for SCANWEAVE
SCANWEAVE.COM VMS command procedure to build SCANWEAVE

SCANWEAVE.PAS VAX Pascal file for SCANWEAVE
SCANWEAVE.OBJ VMS object file for SCANWEAVE
SCANWEAVE.EXE VMS executable file for SCANWEAVE

SCANWEAVE.EXE should be copied to whatever directory contains the other TEX-related executables. If the Kellerman & Smith system (this is the implementation assumed by these instructions), then SYS$SYSTEM is the location of these images. If the images are elsewhere, the command language definition file (SCANWEAVE.CLD) must be modified to reflect this.

The command to run SCANWEAVE must be loaded into the DCL tables. To do this on a process-local basis use

 $ set command scanweave

To permanently install the commands system wide:

 $ set command/replace/table=sys$library:dcltables -
        /output=sys$library:dcltables  scanweave

To run SCANWEAVE, type :

$ scanweave inputTEXfile outputTEXfile

The default extensions are ‘.tex’ for inputTEXfile and ‘.outtex’ for outputTEXfile.

If the executable image must be rebuilt, because of a new release of VMS, VAX Pascal, or SCANWEAVE itself, the EXE can be rebuilt from the source using SCANWEAVE.COM. This command procedure assumes a Kellerman & Smith configuration—i. e. PROMPT.MAR in [TEX.TEX], etc. To actually do the build, set the default directory to be that of SCANWEAVE and enter

     $ @scanweave

After the build completes, copy the new executable to SYS$SYSTEM (or whatever directory contains the TEX executables).

3 MS-DOS

The following additional files should be present for the MS-DOS implementation:

    SCANWEAV.BAT batch file to build SCANWEAVE
    SCANWEAV.PAS Microsoft Pascal file for SCANWEAVE
    SCANWEAV.TP Turbo Pascal file for SCANWEAVE

SCANWEAV.EXE MS-DOS executable file for SCANWEAVE

    SCANWEAV.COM MS-DOS COM file for SCANWEAVE
    SCANTEX.BAT batch file to build SCANTEX

SCANTEX.EXE MS-DOS executable file for SCANTEX
MSPSUPP.WEB Microsoft Pascal support module
MSPSUPP.PAS source file of Microsoft Pascal support module
MSPSUPP.TEX TEX file of Microsoft Pascal support module
MSPSUPP.DVI DVI file of Microsoft Pascal support module

There are three executables, two versions of SCANWEAVE and one of SCANTEX, for the MS-DOS system. Of the three, two of them are EXE files and the third is a COM. Any of the three can be used if all you want to do is just run the program. If you want to modify it, which one you use depends on which compiler you have: Microsoft Pascal, Turbo Pascal, or Logitech Modula-2. Note: because of the precedence of COM files over EXE files, the COM version of SCANWEAVE will always execute if they are both in the same directory. To run SCANTEX, type :

scantex inputTEXfile outputTEXfile

inputTEXfile is the WEAVE-generated full listing file; outputTEXfile is the abbreviated listing to be generated by SCANTEX. To run SCANWEAVE, type :

scanweav inputTEXfile outputTEXfile

inputTEXfile is the WEAVE-generated full listing file; outputTEXfile is the abbreviated listing to be generated by SCANWEAVE. Both parameters are required. The default extensions for the filenames are ‘.tex’ for the input TEX file and ‘.out’ for the output file. If the base file name for the output file is the same as for the TEX file, an asterisk (*) means that the base file name should with the default extension should be used for that parameter.

For instance:

     scanweav junk *

would read from ‘junk.tex’ and write to ‘junk.out’.

4 Other implementations

In order to run SCANWEAVE with any other computer system, a change file must be created with the modifications to tailor the program to that particular system. SCANWEAVE was cloned from TANGLE, so the changefile used to adapt TANGLE to your system can be used as a starting point. Much of the input file handling was lifted verbatim from TANGLE, so the parts of the changefile dealing with input files can probably be reused. The code to generate the Pascal output and everything related to changefiles was deleted in its entirety, so it can also be deleted from the change file.