Subject: Re: Spider Web port to OS/2

From: [email-masked] (Bruce Dubbs)
Date: Mon, 15 Feb 93 17:24:16 CST

Attached are the final changes I made to the Spider WEB system for
porting to OS/2.  Also is the readme.os2 and makefile.emx that I
included in the package.  The file, spider.zip, is now at
ftp-os2.nmsu.edu in the /pub/uploads directory, but it should be moved
to the /pub/os2/2.0/programming directory in a week or two.

I made the bug fixes in common.ch because I did not want to change
your distribution code until you made the changes public.  I also made
a slight change to weave.web (weave.ch) because ceeweave was giving
an error at a single @ inside a /* ... */ comment.

   -- Bruce Dubbs

---readme.os2----------------------------------------------------------
This is the OS/2 2.0 port of Norman Ramsey's Spider WEB.  

Briefly, WEB is a system that allows the creation of computer source
code and typeset documentation from a single source file.  The file is
processed by tangle for input to the target compiler and the same
source is processed be weave for input to TeX for typeset
documentation.

This port includes the entire source for Ramsey's system that allows
the creation of custom tangle and weave processors for arbitrary
computer languages.  Included in the main directory of this port is a
set of OS/2 specific files:

README.OS2    -- This file
ceeweave.exe  -- C Weave executable
ceetangle.exe -- C Tangle executable
awkweave.exe  -- AWK Weave executable
awktangle.exe -- AWK Tangle executable
cweb.tex      -- include file for Woven C tex files
awkweb.tex    -- include file for Woven AWK tex files
makefile.emx  -- make for C and AWK executatables and dvi
                 documentation
common.ch     -- change file for common.web
weave.ch      -- change file for weave.web
emxlibc.dll   -- emx C dynamic link library

The only change I have made to the original files is to rename
common.c to common.c.old in order to force the makefile to create a
new common.c from the combination of common.web and common.ch.

INSTALLATION:

Copy the executables above to a directoru on your PATH.
Copy cweb.tex, awkweb.tex, and webkernel.tex to the directory that TeX
normally looks for inputs.
Copy the emxlibc.dll file to a directory on your LIBPATH.

>From this point, you should be able to run the appropriate version of
tangle and weave from any location.

That it.

NOTES:

1.  I have assumed the files here are on an HPFS directory.  This means
that the capability for long filenames is assumed.

2.  The TeX include file webkernel.tex appears to be too long for
tex386, but internally tex386 processes the \input command properly
and will find webkernel.tex properly if it is in the current directory
or the proper TEXINPUT directory.  However, tex386 will not recognize
a file on the command line linger tahn the 8.3 format.

MAKING IT YOURSELF:

The makefile "makefile.emx" will create the executables and dvi files
of the sources and documentation.  The primary commands are:

    make -f makefile.emx exe    (default - makes executables)
    make -f makefile.emx docs   (makes dvi files of documentation)
    make -f makefile.emx dvi    (makes dvi files from Spider sources)
    make -f makefile.emx all    (all of the above)
    make -f makefile.emx clean  (removes all non-essential files)

It takes about 13 minutes to to a `make all' on my 386/33 + 387 + 16Mb RAM.

The makefile assumes a lot about utilities that are available.  I used
the emx 0.8f gcc compiler, gawk, sort, rm, cat, and sort.  It also
uses tex386 from the emTeX package using both plain and LaTeX styles.
All of these are available from ftp-os2.nms.edu.

If you want to develop one of the other Spider WEB languages, take a
look at the makefile closely.  You may even want to develop a Spider
Web for a new language.

  -- Bruce Dubbs
     [email-masked] or
     [email-masked]  (after August 1993)

REFERENCES:
[1] Wayne Sewell, Weaving a Program: Literate Programming in WEB.
Van Nostrand Reinhold, New York, 1988

[2] Donald Knuth, Literate Programming.  Center for the Study of
Language and Information, Leland Stanford Junior University, CA, 1992.
--------common.ch------------------------------------------------
% Change file to common.web for Spider Web generation for OS2
% Not to be sold, but may be used freely for any purpose
% For more information, see file COPYRIGHT in the parent directory

% This file is part of Spidery WEB

% This program by Norman Ramsey is based on programs Silvio Levy
% and D. E. Knuth.  Silvio Levy wrote most of the code.
% It is distributed WITHOUT ANY WARRANTY, express or implied.
% Dec 1987

% Change file by Bruce Dubbs, Texas A&M University, [email-masked]

@x  Module  7  Sun Feb 14 01:12:22 1993
@ The \.{WEAVE} and \.{TANGLE} processors convert between ASCII code and
the user's external character set by means of arrays |xord| and |xchr|
that are analogous to PASCAL's |ord| and |chr| functions.

@<Definitions...@>=
ASCII xord[last_text_char]; /* specifies conversion of input characters */
outer_char xchr[@'200]; /* specifies conversion of output characters */
@y  Module  7  Sun Feb 14 01:12:22 1993
@ The \.{WEAVE} and \.{TANGLE} processors convert between ASCII code and
the user's external character set by means of arrays |xord| and |xchr|
that are analogous to PASCAL's |ord| and |chr| functions.

We have to change the size of xord to |last_text_char|+1 to cover the 
entire 128 byte ASCII array.

@<Definitions...@>=
ASCII xord[last_text_char+1]; /* specifies conversion of input characters */
outer_char xchr[@'200]; /* specifies conversion of output characters */
@z  Module  7  Sun Feb 14 01:12:22 1993

@x  Module  8  Sun Feb 14 01:16:14 1993
@ Every system supporting \cee\ must be able to read and write the 95
visible characters of standard ASCII above (although not necessarily using the
ASCII codes to represent them).  Conversely, these characters, plus
the newline, are sufficient to write any \cee\ program.  Other
characters are desirable mainly in strings, and they can be referred
to by means of escape sequences like \.{'\t'}.

The basic implementation of \.{WEB}, then, only has to assign an
|xord| to these 95 characters (newlines are swallowed by the reading
routines).  The easiest way to do this is to assign the characters to
their positions in |xchr| and then invert the correspondence:

@<Functions...@>=
common_init()
{
  strcpy(xchr,"                                 !\"#$%&'()*+,-./0123456789\
:;<=>?@@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ ");
  @<System-dependent parts of character set@>;
  @<Invert |xchr| to get |xord|@>;
  @<Initialize pointers@>;
  setting_up=1;
  @<Scan arguments and open output files@>;
  setting_up=0;
}
@y  Module  8  Sun Feb 14 01:16:14 1993
@ Every system supporting \cee\ must be able to read and write the 95
visible characters of standard ASCII above (although not necessarily using the
ASCII codes to represent them).  Conversely, these characters, plus
the newline, are sufficient to write any \cee\ program.  Other
characters are desirable mainly in strings, and they can be referred
to by means of escape sequences like \.{'\t'}.

The basic implementation of \.{WEB}, then, only has to assign an
|xord| to these 95 characters (newlines are swallowed by the reading
routines).  The easiest way to do this is to assign the characters to
their positions in |xchr| and then invert the correspondence:

We make a change here so the string copy does not add a null to the |xchr|
array.

@<Functions...@>=
common_init()
{
  strncpy(xchr,"                                 !\"#$%&'()*+,-./0123456789\
:;<=>?@@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ ",128);
  @<System-dependent parts of character set@>;
  @<Invert |xchr| to get |xord|@>;
  @<Initialize pointers@>;
  setting_up=1;
  @<Scan arguments and open output files@>;
  setting_up=0;
}
@z  Module  8  Sun Feb 14 01:16:14 1993

@x  Module  28  Sun Feb 14 01:17:40 1993
@ When a \.{@@i} line is found in the |cur_file|, we must temporarily
stop reading it and start reading from the named include file.  The
\.{@@i} line should give a complete file name with or without \.{"..."};
\.{WEB} will look for include files in standard directories using
the |pathopen| module.
That is set up at the beginning using the {\tt -I} arguments 
and the {\tt WEBPATH} environment variable.
@<Add environment variable |"WEBPATH"| to search path@>=
	pathaddpath(getenv("WEBPATH"),':');
@y  Module  28  Sun Feb 14 01:17:40 1993
@ When a \.{@@i} line is found in the |cur_file|, we must temporarily
stop reading it and start reading from the named include file.  The
\.{@@i} line should give a complete file name with or without \.{"..."};
\.{WEB} will look for include files in standard directories using
the |pathopen| module.
That is set up at the beginning using the {\tt -I} arguments 
and the {\tt WEBPATH} environment variable.

We change the path delimeter to a semi-colon for OS/2.

@<Add environment variable |"WEBPATH"| to search path@>=
	pathaddpath(getenv("WEBPATH"),';');
@z  Module  28  Sun Feb 14 01:17:40 1993

@x  Module  70  Sun Feb 14 01:19:06 1993
@ @<Set up null...@>= 
#ifdef MSDOS
strcpy(change_file_name,"NUL");
#else
strcpy(change_file_name,"/dev/null");
#endif
@y  Module  70  Sun Feb 14 01:19:06 1993
@ OS/2 uses {\tt /dev/nul} instead of {\tt /dev/null}.

@<Set up null...@>= 
strcpy(change_file_name,"/dev/nul");  
@z  Module  70  Sun Feb 14 01:19:06 1993
-----------weave.ch---------------------------------------------
% Copyright 1989 by Norman Ramsey, Odyssey Research Associates
% Not to be sold, but may be used freely for any purpose
% For more information, see file COPYRIGHT in the parent directory

% This file is part of Spidery WEB
% This program by Norman Ramsey is based on programs Silvio Levy
% and D. E. Knuth.  Silvio Levy wrote most of the code.
% It is distributed WITHOUT ANY WARRANTY, express or implied.
% Dec 1987

% Change made to overcome a small error.  There is a comment that 
% only use a single at-sign.  We change it here to at-at.

@x
@ Control codes in \.{WEB}, which begin with `\.{@@}', are converted
into a numeric code designed to simplify \.{CWEAVE}'s logic; for example,
larger numbers are given to the control codes that denote more significant
milestones, and the code of |new_module| should be the largest of
all. Some of these numeric control codes take the place of ASCII
control codes that will not otherwise appear in the output of the
scanning routines.
@^ASCII code@>

@d ignore = 0 /* control code of no interest to \.{CWEAVE} */
@d verbatim = @'2 /* extended ASCII alpha will not appear */
		 /* extended ASCII beta will not appear */
@d begin_comment = @'10 /* ASCII tab mark will not appear */
@d octal = @'14 /* ASCII carriage return will not appear */
@d hex = @'15 /* ASCII form feed will not appear */
@d switch_math_flag = @'175 /* this code will be intercepted without confusion */
@d underline = @'176 /* this code will be intercepted without confusion */
@d param = @'177 /* ASCII delete will not appear */
/* identifier =200 or octal @'310 */
@#/* following three must be conseccutive for indexing to work */
@d xref_roman = (identifier+roman) /* control code for `\.{@@\^}' */
@d xref_wildcard = (identifier+wildcard) /* control code for `\.{@@:}' */
@d xref_typewriter = (identifier+typewriter) /* control code for `\.{@@.}' */
@d TeX_string = @'356 /* control code for `\.{@@t}' */
@d ascii_constant = @'357 /* control code for `\.{@@`}' */
@d join = @'360 /* control code for `\.{@@\&}' */
@d thin_space = @'361 /* control code for `\.{@@,}' */
@d math_break = @'362 /* control code for `\.{@@\char'174}' */
@d line_force = @'363 /* control code for `\.{@@/}' */
@d line_break = @'364 /* control code for `\.{@@-}' */
@d big_line_break = @'365 /* control code for `\.{@@\#}' */
@d no_line_break = @'366 /* control code for `\.{@@+}' */
@d pseudo_semi = @'367 /* control code for `\.{@@;}' */
@d vertical_bar = @'370 /* The `\v' used to mark Ada text */
@d trace = @'371 /* control code for `\.{@@0}', `\.{@@1}' and `\.{@@2}' */
@d format = @'373 /* control code for `\.{@@f}' */
@d definition = @'374 /* control code for `\.{@@d}' */
@d begin_unnamed = @'375 /* control code for `\.{@@u}' */
@d module_name = @'376 /* control code for `\.{@@<}' */
@d new_module = @'377 /* control code for `\.{@@\ }' and `\.{@@*}' */
@y
@ Control codes in \.{WEB}, which begin with `\.{@@}', are converted
into a numeric code designed to simplify \.{CWEAVE}'s logic; for example,
larger numbers are given to the control codes that denote more significant
milestones, and the code of |new_module| should be the largest of
all. Some of these numeric control codes take the place of ASCII
control codes that will not otherwise appear in the output of the
scanning routines.
@^ASCII code@>

@d ignore = 0 /* control code of no interest to \.{CWEAVE} */
@d verbatim = @'2 /* extended ASCII alpha will not appear */
		 /* extended ASCII beta will not appear */
@d begin_comment = @'10 /* ASCII tab mark will not appear */
@d octal = @'14 /* ASCII carriage return will not appear */
@d hex = @'15 /* ASCII form feed will not appear */
@d switch_math_flag = @'175 /* this code will be intercepted without confusion */
@d underline = @'176 /* this code will be intercepted without confusion */
@d param = @'177 /* ASCII delete will not appear */

% This is where the change is

/* identifier =200 or octal @@'310 */

@#/* following three must be conseccutive for indexing to work */
@d xref_roman = (identifier+roman) /* control code for `\.{@@\^}' */
@d xref_wildcard = (identifier+wildcard) /* control code for `\.{@@:}' */
@d xref_typewriter = (identifier+typewriter) /* control code for `\.{@@.}' */
@d TeX_string = @'356 /* control code for `\.{@@t}' */
@d ascii_constant = @'357 /* control code for `\.{@@`}' */
@d join = @'360 /* control code for `\.{@@\&}' */
@d thin_space = @'361 /* control code for `\.{@@,}' */
@d math_break = @'362 /* control code for `\.{@@\char'174}' */
@d line_force = @'363 /* control code for `\.{@@/}' */
@d line_break = @'364 /* control code for `\.{@@-}' */
@d big_line_break = @'365 /* control code for `\.{@@\#}' */
@d no_line_break = @'366 /* control code for `\.{@@+}' */
@d pseudo_semi = @'367 /* control code for `\.{@@;}' */
@d vertical_bar = @'370 /* The `\v' used to mark Ada text */
@d trace = @'371 /* control code for `\.{@@0}', `\.{@@1}' and `\.{@@2}' */
@d format = @'373 /* control code for `\.{@@f}' */
@d definition = @'374 /* control code for `\.{@@d}' */
@d begin_unnamed = @'375 /* control code for `\.{@@u}' */
@d module_name = @'376 /* control code for `\.{@@<}' */
@d new_module = @'377 /* control code for `\.{@@\ }' and `\.{@@*}' */
@z
----------------makefile.emx--------------------------------------
# Makefile for awkweb and ceeweb of OS/2 2.0 with emx/gcc
# Run the file from a directory containing the master\ and awk\
# subdirectories.  Edit this file to make the ROOT variable the
# same as your main spider directory.

# That is, the directory structure should look like:
#   spider\
#   spider\master\
#   spider\awk\
#   spider\c\

# make -f makefile.emx [argument]

CC = gcc -Zomf -Zmt -O
O = .obj
A = .lib

LIBS =
CFLAGS = 

# Basic directory definitions

ROOT = \spider

C       = $(ROOT)\c
AWK     = $(ROOT)\awk
MASTER  = $(ROOT)\master
DOC     = $(ROOT)\doc
OS2     = $(ROOT)

# Executables used

CTANGLE   = $(ROOT)\ceetangle.exe
CWEAVE    = $(ROOT)\ceeweave.exe
AWKTANGLE = $(ROOT)\awktangle.exe
AWKWEAVE  = $(ROOT)\awkweave.exe
TEX       = tex386
LATEX     = $(TEX) `&lplain`

# Files to make
# Note that we need ceetangle to make a new ceetangle if we do not
#   have the C version of tangle.c--its recursive.

# Also, if we lose spider.awk, it can be remade from spider.web but
#  we need awktangle to do it.

CEE_EXE = $(CTANGLE) $(CWEAVE)
AWK_EXE = $(AWKTANGLE) $(AWKWEAVE)

CEE_DVI = $(OS2)\ceeweave.dvi $(OS2)\ctangle.dvi
A_DVI   = $(OS2)\awkweave.dvi $(OS2)\atangle.dvi
AWK_DVI = $(OS2)\spider.dvi $(OS2)\cycle.dvi

COMMON_DVI   = $(OS2)\common.dvi
PATHOPEN_DVI = $(OS2)\pathopen.dvi

CACM         = $(OS2)\cacm.dvi
S_WEBMAN     = $(OS2)\s_webman.dvi
S_MAN        = $(OS2)\s_man.dvi
OVERVIEW     = $(OS2)\overview.dvi

EXE = $(CEE_EXE) $(AWK_EXE)
DVI =  $(COMMON_DVI) $(PATHOPEN_DVI) $(AWK_DVI) $(A_DVI) $(CEE_DVI)

DOCS = $(CACM) $(S_WEBMAN) $(S_MAN) $(OVERVIEW)

# What we want to make
#  The default is the AWK and C versions of tangle and weave

exe: $(EXE)

dvi: $(DVI)

docs: $(DOCS)

all: $(EXE) $(DVI) $(DOCS)

# This is how we make ceeweave and ceetangle

$(CTANGLE): $(C)\tangle$(O) $(MASTER)\common$(O) $(MASTER)\pathopen$(O) 
	$(CC) $(CFLAGS) -o $(CTANGLE) $(C)\tangle$(O) $(MASTER)\common$(O) \
          $(MASTER)\pathopen$(O)

$(C)\tangle$(O): $(C)\tangle.c
	cd $(C)
	$(CC) $(CFLAGS) -c tangle.c
	cd $(OS2)

$(C)\tangle.c: $(MASTER)\common.h $(C)\outtoks.web $(MASTER)\tangle.web
	copy $(MASTER)\tangle.web $(C)
	copy $(MASTER)\common.h $(C)
	cd $(C)
	$(CTANGLE) tangle.web
	cd $(OS2)

$(CWEAVE):  $(C)\weave$(O) $(MASTER)\common$(O) $(MASTER)\pathopen$(O)
	$(CC) $(CFLAGS) -o $(CWEAVE) $(C)\weave$(O) $(MASTER)\common$(O) \
          $(MASTER)\pathopen$(O)

$(C)\weave$(O): $(C)\weave.c 
	cd $(C)
	$(CC) $(CFLAGS) -c weave.c
	cd $(OS2)

$(C)\weave.c: $(MASTER)\weave.web $(MASTER)\common.h $(C)\grammar.web
	copy $(MASTER)\common.h $(C)
	copy $(MASTER)\weave.web $(C)
	cd $(C)
	$(CTANGLE) weave $(OS2)\weave.ch
	rm common.h weave.web
	cd $(OS2)

$(C)\grammar.web $(C)\outtoks.web $(OS2)\cweb.tex: \
             $(MASTER)\cycle.awk $(MASTER)\spider.awk $(C)\c.spider
	cd $(C)
	gawk -f $(MASTER)\spider.awk c.spider
	cat $(MASTER)\transcheck.list trans_keys.unsorted | \
           gawk -f $(MASTER)\transcheck.awk
	gawk -f $(MASTER)\cycle.awk < cycle.test
	cat *.unsorted | sort | gawk -f $(MASTER)\nodups.awk
	copy cweb.tex $(OS2)
	cd $(OS2)

# This is how we make awkweave and awktangle

$(AWKTANGLE): $(AWK)\tangle$(O) $(MASTER)\common$(O) $(MASTER)\pathopen$(O) 
	cd $(AWK)
	$(CC) $(CFLAGS) -o $(AWKTANGLE) $(AWK)\tangle$(O) $(MASTER)\common$(O)\
          $(MASTER)\pathopen$(O)
	cd $(OS2)

$(AWK)\tangle$(O): $(C)\tangle.c
	cd $(AWK)
	$(CC) $(CFLAGS) -c tangle.c
	cd $(OS2)

$(AWK)\tangle.c: $(MASTER)\common.h $(AWK)\outtoks.web $(MASTER)\tangle.web
	copy $(MASTER)\tangle.web $(AWK)
	copy $(MASTER)\common.h $(AWK)
	cd $(AWK)
	$(CTANGLE) tangle.web
	rm $(AWK)\tangle.web $(AWK)\common.h
	cd $(OS2)

$(AWKWEAVE):  $(AWK)\weave$(O) $(MASTER)\common$(O) $(MASTER)\pathopen$(O)
	$(CC) $(CFLAGS) -o $(AWKWEAVE) $(AWK)\weave$(O) $(MASTER)\common$(O) \
          $(MASTER)\pathopen$(O)

$(AWK)\weave$(O): $(AWK)\weave.c 
	cd $(AWK)
	$(CC) $(CFLAGS) -c weave.c
	cd $(OS2)

$(AWK)\weave.c: $(MASTER)\weave.web $(MASTER)\common.h $(AWK)\grammar.web
	copy $(MASTER)\weave.web $(AWK)
	copy $(MASTER)\common.h $(AWK)
	cd $(AWK)
	$(CTANGLE) weave $(OS2)\weave.ch
	cd $(OS2)

$(AWK)\grammar.web $(AWK)\outtoks.web $(OS2)\awkweb.tex:  \
                  $(MASTER)\cycle.awk $(MASTER)\spider.awk $(AWK)\awk.spider
	cd $(AWK)
	gawk -f $(MASTER)\spider.awk awk.spider
	cat $(MASTER)\transcheck.list trans_keys.unsorted | \
           gawk -f $(MASTER)\transcheck.awk
	gawk -f $(MASTER)\cycle.awk < cycle.test
	cat *.unsorted | sort | gawk -f $(MASTER)\nodups.awk
	copy awkweb.tex $(OS2)
	cd $(OS2)

$(MASTER)\spider.awk: $(MASTER)\spider.web
	cd $(MASTER)
	$(AWKTANGLE) $(MASTER)\spider.web
	cd $(OS2)

# This is how we make the files needed for all executables

$(MASTER)\pathopen$(O): $(MASTER)\pathopen.c
	cd $(MASTER)
	$(CC) $(CFLAGS) -c pathopen.c
	cd $(OS2)

$(MASTER)\pathopen.c $(MASTER)\pathopen.h: $(MASTER)\pathopen.web
	cd $(MASTER)
	$(CTANGLE) pathopen.web
	cd $(OS2)

# Note the OS2 change file here

$(MASTER)\common.c: $(MASTER)\common.web $(OS2)\common.ch
	cd $(MASTER)
	$(CTANGLE) common.web $(OS2)\common.ch
	cd $(OS2)

$(MASTER)\common$(O): $(MASTER)\common.c 
	cd $(MASTER)
	$(CC) $(CFLAGS) -c common.c
	cd $(OS2)

$(OS2)\common.dvi: $(MASTER)\common.tex $(OS2)\cweb.tex
	copy $(MASTER)\common.tex $(OS2)
	-$(TEX) common.tex
	rm $(OS2)\common.tex 

$(MASTER)\common.tex: $(MASTER)\common.web $(MASTER)\pathopen.h $(CWEAVE)
	cd $(MASTER)
	$(CWEAVE) common.web
	cd $(OS2)

$(OS2)\pathopen.dvi: $(MASTER)\pathopen.tex $(OS2)\cweb.tex
	copy $(MASTER)\pathopen.tex $(OS2)
	-$(TEX) pathopen.tex
	rm $(OS2)\pathopen.tex 

$(MASTER)\pathopen.tex: $(MASTER)\pathopen.web $(CWEAVE)
	cd $(MASTER)
	$(CWEAVE) pathopen.web
	cd $(OS2)

$(OS2)\cycle.dvi: $(MASTER)\cycle.tex $(OS2)\awkweb.tex
	copy $(MASTER)\cycle.tex $(OS2)
	-$(TEX) cycle.tex
	rm $(OS2)\cycle.tex 

$(MASTER)\cycle.tex: $(MASTER)\cycle.web $(AWKWEAVE)
	cd $(MASTER)
	$(AWKWEAVE) cycle.web
	cd $(OS2)

$(OS2)\spider.dvi: $(MASTER)\spider.tex $(OS2)\awkweb.tex
	copy $(MASTER)\spider.tex $(OS2)
	-$(TEX) spider.tex
	rm $(OS2)\spider.tex 

$(MASTER)\spider.tex: $(MASTER)\spider.web $(AWkWEAVE)
	cd $(MASTER)
	$(AWKWEAVE) spider.web
	cd $(OS2)

$(OS2)\atangle.dvi: $(AWK)\atangle.tex $(OS2)\cweb.tex
	copy $(AWK)\atangle.tex $(OS2)
	-$(TEX) atangle.tex
	rm $(OS2)\atangle.tex 

$(AWK)\atangle.tex: $(MASTER)\tangle.web $(AWK)\outtoks.web
	cd $(AWK)
	copy $(MASTER)\common.h $(AWK)
	copy $(MASTER)\tangle.web $(AWK)
	$(CWEAVE) tangle.web
	rename tangle.tex atangle.tex
	cd $(OS2)

$(OS2)\awkweave.dvi: $(AWK)\awkweave.tex $(OS2)\cweb.tex
	copy $(AWK)\awkweave.tex $(OS2)
	-$(TEX) awkweave.tex
	rm $(OS2)\awkweave.tex 

$(AWK)\awkweave.tex: $(MASTER)\weave.web $(AWK)\grammar.web $(OS2)\weave.ch
	cd $(AWK)
	copy $(MASTER)\common.h $(AWK)
	copy $(MASTER)\weave.web $(AWK)
	$(CWEAVE) weave.web $(OS2)\weave.ch
	rename weave.tex awkweave.tex
	cd $(OS2)

$(OS2)\ceeweave.dvi: $(C)\ceeweave.tex $(OS2)\cweb.tex
	copy $(C)\ceeweave.tex $(OS2)
	-$(TEX) ceeweave.tex
	rm $(OS2)\ceeweave.tex 

$(C)\ceeweave.tex: $(MASTER)\weave.web $(C)\grammar.web $(OS2)\weave.ch
	cd $(C)
	copy $(MASTER)\common.h $(C)
	copy $(MASTER)\weave.web $(C)
	$(CWEAVE) weave.web $(OS2)\weave.ch
	rename weave.tex ceeweave.tex
	cd $(OS2)

# I wanted to call this ceetangle.dvi, but tex386 only understands
# the 8.3 filenames right now so ceetangle was one character too long.

$(OS2)\ctangle.dvi: $(C)\ctangle.tex $(OS2)\cweb.tex
	copy $(C)\ctangle.tex $(OS2)
	-$(TEX) ctangle.tex
	rm $(OS2)\ctangle.tex 

$(C)\ctangle.tex: $(MASTER)\tangle.web $(C)\outtoks.web
	cd $(C)
	copy $(MASTER)\common.h $(C)
	copy $(MASTER)\tangle.web $(C)
	$(CWEAVE) tangle.web
	rename tangle.tex ctangle.tex
	cd $(OS2)

# This cleanup applies to the root directoru, master\, c\, and awk\.

clean:
	cd $(AWK)
	-rm  -f tangle.* weave.* common.* 
	-rm  -f *.unsorted *.list grammar.web outtoks.web scraps.web 
	-rm  -f cycle.test spider.slog *.obj
	-rm  -f *.c *.o *.tex *.toc *.dvi *.log *.makelog *~ *.wlog *.printlog
	cd $(C)
	-rm  -f tangle.* weave.* common.* 
	-rm  -f *.unsorted *.list grammar.web outtoks.web scraps.web 
	-rm  -f cycle.test spider.slog *.obj
	-rm  -f *.c *.o *.tex *.toc *.dvi *.log *.makelog *~ *.wlog *.printlog
	cd $(MASTER)
	-rm  -f *.tex *.obj common.c
	cd $(OS2)
	-rm  -f *.dvi *.log *.toc

$(CACM): $(DOC)\cacm.tex
	copy $(DOC)\cacm.* $(OS2)
	-$(LATEX) cacm
	-rm  -f cacm.tex cacm.aux cacm.log 

$(S_WEBMAN): $(DOC)\spiderwebman.tex
	copy $(DOC)\spiderwebman.tex $(OS2)\s_webman.tex
	-$(TEX) s_webman.tex
	-rm  -f *.log *.aux s_webman.tex

$(S_MAN): $(DOC)\spiderman.tex
	copy $(DOC)\spiderman.tex $(OS2)\s_man.tex
	-$(LATEX) s_man.tex
	-$(LATEX) s_man.tex
	-rm  -f *.log *.aux s_man.tex

$(OVERVIEW): $(DOC)\overview.tex
	copy $(DOC)\overview.tex $(OS2)
	-$(LATEX) overview.tex
	-$(LATEX) overview.tex
	-rm  -f *.log *.aux overview.tex