home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-12-11 | 54.7 KB | 2,473 lines |
- Newsgroups: comp.sources.misc
- From: bkw@uecok.ECOK.EDU (Bill Walker)
- Subject: v26i099: wroff - text formatter for HP LaserJet with PDS 25-font cartridge, Part03/05
- Message-ID: <1991Dec10.063609.9741@sparky.imd.sterling.com>
- X-Md4-Signature: 21643e284efc9cc014da8d64c7752599
- Date: Tue, 10 Dec 1991 06:36:09 GMT
- Approved: kent@sparky.imd.sterling.com
-
- Submitted-by: bkw@uecok.ECOK.EDU (Bill Walker)
- Posting-number: Volume 26, Issue 99
- Archive-name: wroff/part03
- Environment: SCO, HPUX, MS-DOS, CPM-68K
-
- #! /bin/sh
- # into a shell via "sh file" or similar. To overwrite existing files,
- # type "sh file -c".
- # The tool that generated this appeared in the comp.sources.unix newsgroup;
- # send mail to comp-sources-unix@uunet.uu.net if you want that tool.
- # Contents: Fonts/Line8.5H Fonts/sampler MACROS/mathmacs Makefile
- # TestData/hw2.w TestData/lesson1.w TestData/lesson2.w
- # TestData/mathdemo.w source/alg.c source/defs.h source/expr.c
- # source/externs.c source/globals.c source/macros.c source/main.c
- # source/makefile source/rpn.c source/stacks.c source/tags
- # source/test.c source/traps.c
- # Wrapped by kent@sparky on Tue Dec 10 00:26:39 1991
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- echo If this archive is complete, you will see the following message:
- echo ' "shar: End of archive 3 (of 5)."'
- if test -f 'Fonts/Line8.5H' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'Fonts/Line8.5H'\"
- else
- echo shar: Extracting \"'Fonts/Line8.5H'\" \(313 characters\)
- sed "s/^X//" >'Fonts/Line8.5H' <<'END_OF_FILE'
- XE&l1OE(0UE(sp16.66h8.5vsb0T
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- X18
- END_OF_FILE
- if test 313 -ne `wc -c <'Fonts/Line8.5H'`; then
- echo shar: \"'Fonts/Line8.5H'\" unpacked with wrong size!
- fi
- # end of 'Fonts/Line8.5H'
- fi
- if test -f 'Fonts/sampler' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'Fonts/sampler'\"
- else
- echo shar: Extracting \"'Fonts/sampler'\" \(3498 characters\)
- sed "s/^X//" >'Fonts/sampler' <<'END_OF_FILE'
- X.fm RESET
- X\fMFont RESET will clear the printer to default\fP
- X.sp
- XThis is a print sampler.
- X.sp 4
- X.fm LGN9.5A
- X\fMFont LGN9.5A is Letter Gothic, Normal, 9.5 point, ASCII\fP
- X.sp
- X.fm LGN14L
- X\fMFont LGN14L is Letter Gothic, Norman, 14 point, LEGAL\fP
- X.sp
- X.fm TMN10B
- XFont TMN10B is a math font: \fM abcdefgh\fP
- X.sp
- X.fm PAFS4.8_12
- X\fMFont\fP PAFS4.8_12 \fM is PDP AFS 4.8 point, 12 lpi\fP
- X.sp
- X.fm PAFS4.8_16
- X\fMFont\fP PAFS4.8_16 \fM is PDP AFS 4.8 point, 16 lpi\fP
- X.sp
- X.fm PCLine14
- XFont PCLine14 is a line drawing font: \fM0123456789\fP
- X.sp
- X.fm TaxB12
- XFont TaxB12 is a tax form font, boldfaced: \fMabcdefgh\fP
- X.sp
- X.fm LineDraw12
- XFont LineDraw12 is a line drawing font: \fMabcdefgh\fP
- X.sp
- X.fm LGN14A
- X\fMFont LGN14A is Letter Gothic, Normal, 14 point, ASCII\fP
- X.sp
- X.fm LGB12A
- X\fMFont LGB12A is Letter Gothic, Bold, 12 point, ASCII\fP
- X.sp
- X.fm LP8.5PC
- X\fMFont LP8.5PC is Line Printer, 8.5 point, PC\fP
- X.sp
- X.fm ci12
- X\fMFont ci12 is Courier, Italic, 12 point, ASCII\fP
- X.sp
- X.fm cn12
- X\fMFont cn12 is Courier, Normal, 12 point, ASCII\fP
- X.sp
- X.fm pen7
- X\fMFont pen7 is Prestige Elite, Normal, 7 point, ASCII\fP
- X.sp
- X.fm lp8.5
- X\fMFont lp8.5 is a Line Printer, 8.5 point, ASCII\fP
- X.sp
- X.fm pb18
- X\fMFont pb18 is Presentation, Bold, 18 point, ASCII\fP
- X.sp
- X.fm pb16a
- X\fMFont pb16a is Presentation, Bold, 16 point, ASCII\fP
- X.sp
- X.fm pei10.l
- X\fMFont pei10.l is Prestige Elite, Italic, 10 point, Legal\fP
- X.sp
- X.fm pen10.l
- X\fMFont pen10.l is Prestige Elite, Normal, 10 point, Legal\fP
- X.sp
- X.fm peb10.l
- X\fMFont peb10.l is Prestige Elite, Bold, 10 point, Legal\fP
- X.sp
- X.fm ct12r-8
- X\fMFont ct12r-8 is Courier, Italic, 12 point, Roman-8\fP
- X.sp
- X.fm pb14
- X\fMFont pb14 is Presentation, Bold, 14 points, ASCII\fP
- X.sp
- X.fm HB14ECMA
- X\fMFont HB14ECMA is Helvetica, Bold, 14 point, ECMA, 10 series\fP
- X.sp
- X.fm TMN8A
- XFont TMN8A is Times Math, Normal, 8 point, MATH A \fMabcdefg1234567\fP
- X.sp
- X.fm HN10
- X\fMFont HN10 is Helvetica, Normal, 10 point, ASCII\fP
- X.sp
- X.fm HI10
- X\fMFont HI10 is Helvetica, Italic, 10 point, ASCII\fP
- X.sp
- X.fm HB8
- X\fMFont HB8 is Helvetica, Bold, 8 point, ASCII\fP
- X.sp
- X.fm HN8
- X\fMFont HN8 is Helvetica, Normal, 8 point, ASCII\fP
- X.sp
- X.fm HN6
- X\fMFont HN6 is Helvetic, Normal, 6 point, ASCII\fP
- X.sp
- X.fm trn12
- X\fMFont trn12 is Times Roman, Normal, 12 point, ASCII\fP
- X.sp
- X.fm trb12
- X\fMFont trb12 is Times Roman, Bold, 12 point, ASCII\fP
- X.sp
- X.fm tri12
- X\fMFont tri12 is Times Roman, Italic, 12 point, ASCII\fP
- X.sp
- X.fm trn8
- X\fMFont trn8 is Times Roman, Normal, 8 point, ASCII\fP
- X.sp
- X.fm tri10
- X\fMFont tri10 is Times Roman, Italic, 10 point, ASCII\fP
- X.sp
- X.fm trn10
- X\fMFont trn10 is Times Roman, Normal, 10 point, ASCII\fP
- X.sp
- X.fm trb10
- X\fMFont trb10 is Times Roman, Bold, 10 point, ASCII\fP
- X.sp
- X.fm lgn12
- X\fMFont lgn12 is Letter Gothic, Normal, 12 point, ASCII\fP
- X.sp
- X.fm lgi12
- X\fMFont lgi12 is Letter Gothic, Italic, 12 point, ASCII\fP
- X.sp
- X.fm PB18L
- X\fMFont PB18L is Presentation, Bold, 18 point, Legal\fP
- X.sp
- X.fm PB16L
- X\fMFont PB16L is Presentation, Bold, 16 point, Legal\fP
- X.sp
- X.fm PB14L
- X\fMFont PB14L is Presentation, Bold, 14 point, Legal\fP
- X.sp
- X.fm HB14
- X\fMFont HB14 is Helvetica, Bold, 14 point, ASCII\fP
- X.sp
- X.fm TMN8B
- XFont TMN8B is Times Math, Normal, 8 point, MATH B \fMabcdef123456\fP
- X.sp
- X.fm HB12
- X\fMFont HB12 is Helvetica, Bold, 12 point, ASCII\fP
- X.sp
- X.fm HN12
- X\fMFont HN12 is Helvetica, Normal, 12 point, ASCII\fP
- X.sp
- X.fm HI12
- X\fMFont HI12 is Helvetica, Italic, 12 point, ASCII\fP
- X.sp
- X.fm HB10
- X\fMFont HB10 is Helvetica, Bold, 10 point, ASCII\fP
- X.sp
- X.fm PEN7L
- X\fMFont PEN7L is Prestige Elite, Normal, 7 point, Legal\fP
- END_OF_FILE
- if test 3498 -ne `wc -c <'Fonts/sampler'`; then
- echo shar: \"'Fonts/sampler'\" unpacked with wrong size!
- fi
- # end of 'Fonts/sampler'
- fi
- if test -f 'MACROS/mathmacs' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'MACROS/mathmacs'\"
- else
- echo shar: Extracting \"'MACROS/mathmacs'\" \(797 characters\)
- sed "s/^X//" >'MACROS/mathmacs' <<'END_OF_FILE'
- X.de INT
- X.fm TMN10B
- X\fMu\fP
- X\[ p = X + M + L ]
- X.gx -48
- X.gy +8
- X\fMg\fP
- X.gx -48
- X.gy -16
- X\fMe\fP
- X.gy +8
- X.gx \(p)
- X.gy +12
- X$1
- X.gx \(p)
- X.gy -24
- X$2
- X.gy +12
- X\fP
- X.en
- X.de LBRACE
- X.fm TMN10B
- X\fMc\fP
- X\[ p = X + M + L -140 ]
- X.gx -48
- X.gy +8
- X\fMd\fP
- X.gx -48
- X.gy -16
- X\fMb\fP
- X.gy +8
- X.gx \(p)
- X\fP
- X.en
- X.de RBRACE
- X.fm TMN10B
- X\fMs\fP
- X\[ p = X + M + L - 175 ]
- X.gx -48
- X.gy +8
- X\fMt\fP
- X.gx -48
- X.gy -16
- X\fMr\fP
- X.gy +8
- X.gx \(p)
- X\fP
- X.en
- X.de int
- X.fm TMN10B
- X\fMU\fP
- X.en
- X.de lbrace
- X\f0{\fP
- X.en
- X.de rbrace
- X\f0}\fP
- X.en
- X.de SU
- X.gy -5
- X\f2$1\fP
- X.gy +5
- X.en
- X.de SB
- X.gy +3
- X\f2$1\fP
- X.gy -3
- X.en
- X.de SUM
- X.fm TMN10B
- X\[ p = X + M + L +50 ]
- X.gy +4
- X\fMj\fP
- X.gx -48
- X.gy -8
- X\fMh\fP
- X.gy +4
- X.gx \(p)
- X.en
- X
- X
- X
- X\{INT 1 2} \{LBRACE} (x \{SU 2} - y \{SB 4} + (r + s) \{SU 3} ) \{RBRACE} dx
- X
- X
- X
- X
- X\{int} \{lbrace} ( \{SUM} some function) \{rbrace} dx
- X
- X
- END_OF_FILE
- if test 797 -ne `wc -c <'MACROS/mathmacs'`; then
- echo shar: \"'MACROS/mathmacs'\" unpacked with wrong size!
- fi
- # end of 'MACROS/mathmacs'
- fi
- if test -f 'Makefile' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'Makefile'\"
- else
- echo shar: Extracting \"'Makefile'\" \(1812 characters\)
- sed "s/^X//" >'Makefile' <<'END_OF_FILE'
- X
- X# this is the command to print something on your laser printer
- XPRINT=lp
- X
- X# the owner of the system files --- need not be root
- XOWNER=root
- X
- X# directory to contain the font tables
- X# leave as it is for testing, but change it for production
- X#FONTS='"./Fonts"'
- X#here's where we keep it, but you will want to change it.
- XFONTS='"/usr/ECU/Fonts"'
- X
- X#source is located in this directory
- XSOURCE=./source
- X
- X#documentation is contained in this directory
- XDOCDIR=./doc
- X
- X#local bin directory
- X#leave it as is for testing, but change it for actual installation
- X#BINDIR=./bin
- X# we use this, but again you will certainly want to change it
- XBINDIR=/usr/ECU/bin
- X
- XCFLAGS = -DFONTSDIR='"$(FONTS)"' -i -DUNIX -g
- X
- X
- Xa.out :
- X cd source; make -f makefile -k "CC=$(CC)" "CFLAGS=$(CFLAGS)"; \
- X mv a.out ../a.out
- X
- X
- X# be sure you have write permission whereever these directories are
- Xinstall :
- X strip a.out
- X mv a.out $(BINDIR)/wroff
- X cp ./Fonts/* $(FONTSDIR)
- X chmod $(OWNER) $(FONTSDIR)/*
- X chmod u+r $(FONTSDIR)/*
- X chmod go+rx $(BINDIR)/wroff
- X chown $(OWNER) $(BINDIR)/wroff
- X
- X
- X# make "manual page" documentation for wroff -- it is stored under DOCDIR
- X# note that we assume that the (unstripped) wroff executable is named "a.out"
- X
- Xmanpage :
- X a.out $(DOCDIR)/macs.w $(DOCDIR)/wroff.1.w -p -k -o $(DOCDIR)/doc.pr
- X
- X# make a tutorial for wroff -- store it in the DOCDIR
- X# note that we assume that the (unstripped) wroff executable is named "a.out"
- X
- Xtut :
- X a.out $(DOCDIR)/macs.w $(DOCDIR)/wroff.tut.w -p -k -o $(DOCDIR)/tut.pr
- X
- X
- X#clean up the mess
- Xclean:
- X rm $(SOURCE)/*.o
- X
- X
- X# this will test wroff to see if it works at all
- Xtest :
- X $(BINDIR)/wroff $(DOCDIR)/welcome
- X $(BINDIR)/wroff $(DOCDIR)/welcome | $(PRINT)
- X
- X
- X# this will print a convenient "sampler" to demonstrate the available fonts
- Xsampler:
- X $(BINDIR)/wroff TestData/sampler | $(PRINT)
- X
- END_OF_FILE
- if test 1812 -ne `wc -c <'Makefile'`; then
- echo shar: \"'Makefile'\" unpacked with wrong size!
- fi
- # end of 'Makefile'
- fi
- if test -f 'TestData/hw2.w' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'TestData/hw2.w'\"
- else
- echo shar: Extracting \"'TestData/hw2.w'\" \(541 characters\)
- sed "s/^X//" >'TestData/hw2.w' <<'END_OF_FILE'
- X.de SU
- X.gy -5
- X\f2$1\f0
- X.gy +5
- X.en
- X.ce 10
- X\fBComputer Science 1133
- XThird Homework Assignment
- XDue: September 22, 1989\fP
- X.ce 0
- X.sp 2
- X.PP
- XThe purpose of this assignment is to illustrate the use of
- Xfunction subprograms, and illustrate a loop that "quits"
- Xafter an indefinite number of iterations.
- X.PP
- XYou are to use Newton's Method to solve the following
- Xequations:
- X
- X.sp 3
- X.in +5
- Xx \{SU 3} - x = 0 (Answer: 0, 1, -1)
- X.sp 3
- Xx \{SU 2} + 3x + 2 = 0 (Answer: -1, -2)
- X.sp 3
- Xx sin(x) - 3 = 0 (Answer: could be several -- check it)
- END_OF_FILE
- if test 541 -ne `wc -c <'TestData/hw2.w'`; then
- echo shar: \"'TestData/hw2.w'\" unpacked with wrong size!
- fi
- # end of 'TestData/hw2.w'
- fi
- if test -f 'TestData/lesson1.w' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'TestData/lesson1.w'\"
- else
- echo shar: Extracting \"'TestData/lesson1.w'\" \(1401 characters\)
- sed "s/^X//" >'TestData/lesson1.w' <<'END_OF_FILE'
- X.ce 10
- X\fBFirst Lesson
- XComputer Programming II\fP
- X.ce 0
- X.sp
- X.in 15
- X.ti -5
- X\fBvi editor exercise:\fP Here are the commands that you will need
- Xto know about today:
- X.nf
- X
- X.in +5
- X\fBvi file.pas
- X
- Xi \f|- \f|insert
- XESC \f|- \f|quit inserting
- Xx \f|- \f|cross out character
- X:wq \f|- \f|save work and quit
- X
- X^u \f|- \f|move up half page
- X^d \f|- \f|move down half page
- X^p \f|- \f|previous line
- X^n \f|- \f|next line
- X^h \f|- \f|left one character
- Xspace \f|- \f|right one character\fP
- X
- XEnter the following code:
- X
- X.nf
- X\fT
- Xprogram summer (input, output);
- X var i, sum : integer;
- X
- Xbegin
- X sum := 0;
- X
- X i := 1;
- X while i <= 10 do
- X begin
- X sum := sum + i;
- X i := i + 1;
- X end;
- X writeln('the sum is ', sum);
- Xend.
- X\fP
- X.fi
- X.bp
- X.OP 1.
- XEnter and execute the program. This will require that you know how
- Xto log in, how to use \fBpc file.pas\fP, and how to execute a program by
- Xtyping \fBa.out\fP. You may also find \fBls\fP handy.
- X.OP 2.
- XModify the program to sum the first 100 positive integers instead.
- X.OP 3.
- XModify the program to sum the first 25 positive integers.
- X.OP 4.
- XUse \fBcat file.pas\fP to print the program on your screen, then
- Xuse \fBcat file.pas | lp\fP to print the program on the printer.
- X.OP 5.
- XUse \fBa.out\fP to execute the program on your screen, then use
- X\fBa.out | lp\fP to print the output of the program on the printer.
- X\fBDO NOT USE "cat a.out" FOR ANYTHING!\fP
- END_OF_FILE
- if test 1401 -ne `wc -c <'TestData/lesson1.w'`; then
- echo shar: \"'TestData/lesson1.w'\" unpacked with wrong size!
- fi
- # end of 'TestData/lesson1.w'
- fi
- if test -f 'TestData/lesson2.w' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'TestData/lesson2.w'\"
- else
- echo shar: Extracting \"'TestData/lesson2.w'\" \(3630 characters\)
- sed "s/^X//" >'TestData/lesson2.w' <<'END_OF_FILE'
- X.ce 10
- X\fBSecond Lesson
- XComputer Programming II\fP
- X.ce 0
- X.sp 3
- X.in +5
- X.ti -5
- XHere are the commands that you will need to know about
- Xtoday:
- X.sp 2
- X\fB
- X.nf
- Xpasswd \f|- \f|change your password
- Xls \f|- \f|list contents of directory
- Xdate \f|- \f|show the time and date
- Xwho \f|- \f|determine who is on the system
- Xmkdir \f|- \f|create a new subdirectory
- Xcd \f|- \f|change the working directory
- Xpwd \f|- \f|print the working directory
- Xwc \f|- \f|count lines, words, and characters
- Xlp \f|- \f|copy standard input to the printer
- Xcat file \f|- \f|copy file to standard output
- Xvisprint \f|- \f|copy standard input to both printer and screen
- X| \f|- \f|connect standard output of one program
- X \f|to standard input of another ("pipe")
- Xmailx \f|- \f|send or receive electronic mail
- Xname \f|- \f|determine login ids
- Xvnews \f|- \f|read public electronic news
- X\fP
- X.fi
- X.in +5
- X.vl 5
- X.sp 2
- X.OP 1.
- XLog into the machine.
- X.OP 2.
- XChange your password by using \fBpasswd\fP. Note that
- X\fBpasswd\fP asks you for your previous password, and then
- Xfor a new password. It does not print on the screen when
- Xyou type, so be prepared to type "in the blind."
- X.OP 3.
- XWhen you logged in, you almost certainly received notice
- Xthat there was "news". To read this news, type \fBvnews\fP.
- XAt any time while vnews is running, you can type a \fB?\fP
- Xto get some help. Use the letter "n" to page through the
- Xnews.
- X.OP 4.
- XUse \fBdate\fP to determine today's date, and then use \fBwho\fP to
- Xdetermine who is on the system.
- X.OP 5.
- XThe symbol "|" connects the output of one program to the
- Xinput of a second program. The program \fBwc\fP is used to count
- Xthe number of lines, words, and characters that appear in
- Xits input. What does the sequence \fBwho | wc\fP determine ?
- XTry \fBdate | wc\fP . What did you get ?
- X.OP 6.
- XThe programs \fBlp\fP and \fBvisprint\fP are somewhat similar. Both
- Xprint their input to the printer. The \fBvisprint\fP program also
- Xprints its input to the screen as well.
- XWhat happens if you type \fBwho | lp\fP ? What if you type
- X\fBwho | visprint\fP ? What about \fBwho | wc | visprint\fP ?
- X.OP 7.
- XUse \fBls\fP to determine the contents of your
- Xdirectory. (Could you print this on the printer if you
- Xneeded to ?) Now use \fBmkdir pascal\fP to create a new
- Xdirectory. Issue another \fBls\fP. What happened ?
- X.OP 8.
- XType \fBpwd\fP and see what you get, then
- Xuse \fBcd pascal\fP to "change directory" to the pascal
- Xdirectory, and type \fBpwd\fP again. Use \fBls\fP to see if
- Xthere is anything in the directory that you just created.
- XYou can return "home" by just saying \fBcd\fP.
- X.OP 9.
- XReturn to "home" and create another directory called
- X"wordproc" that can be used to hold your word processing
- Xfiles. Confirm that it exists, and is empty.
- X.OP 10.
- XFrom now on, when you write a program in Pascal, be
- Xsure to first \fBcd pascal\fP before you start to program.
- X.OP 11.
- XIf you had a message concerning "mail", you may want to
- Xread your mail. To do so, just type \fBmailx\fP. You will
- Xbe given a list of your messages. Select the one(s) you
- Xwant to read by typing the number of the message. When you
- Xare done with a message, type \fBd\fP to delete that message
- X(otherwise it is saved, which is usually messy.) When you
- Xhave read all the mail, type \fBq\fP to quit the mail
- Xsystem.
- X.OP 12.
- XUse \fBname myfriend\fP to determine the login id of
- Xyour friend. Then send mail to your friend by typing
- X\fBmailx loginid\fP, where "loginid" is the login id of your
- Xfriend. Everything you type on the terminal will be mailed
- Xto your friend. End your letter by putting a period (".")
- Xon a line by itself.
- END_OF_FILE
- if test 3630 -ne `wc -c <'TestData/lesson2.w'`; then
- echo shar: \"'TestData/lesson2.w'\" unpacked with wrong size!
- fi
- # end of 'TestData/lesson2.w'
- fi
- if test -f 'TestData/mathdemo.w' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'TestData/mathdemo.w'\"
- else
- echo shar: Extracting \"'TestData/mathdemo.w'\" \(797 characters\)
- sed "s/^X//" >'TestData/mathdemo.w' <<'END_OF_FILE'
- X.de INT
- X.fm TMN10B
- X\fMu\fP
- X\[ p = X + M + L ]
- X.gx -48
- X.gy +8
- X\fMg\fP
- X.gx -48
- X.gy -16
- X\fMe\fP
- X.gy +8
- X.gx \(p)
- X.gy +12
- X$1
- X.gx \(p)
- X.gy -24
- X$2
- X.gy +12
- X\fP
- X.en
- X.de LBRACE
- X.fm TMN10B
- X\fMc\fP
- X\[ p = X + M + L -140 ]
- X.gx -48
- X.gy +8
- X\fMd\fP
- X.gx -48
- X.gy -16
- X\fMb\fP
- X.gy +8
- X.gx \(p)
- X\fP
- X.en
- X.de RBRACE
- X.fm TMN10B
- X\fMs\fP
- X\[ p = X + M + L - 175 ]
- X.gx -48
- X.gy +8
- X\fMt\fP
- X.gx -48
- X.gy -16
- X\fMr\fP
- X.gy +8
- X.gx \(p)
- X\fP
- X.en
- X.de int
- X.fm TMN10B
- X\fMU\fP
- X.en
- X.de lbrace
- X\f0{\fP
- X.en
- X.de rbrace
- X\f0}\fP
- X.en
- X.de SU
- X.gy -5
- X\f2$1\fP
- X.gy +5
- X.en
- X.de SB
- X.gy +3
- X\f2$1\fP
- X.gy -3
- X.en
- X.de SUM
- X.fm TMN10B
- X\[ p = X + M + L +50 ]
- X.gy +4
- X\fMj\fP
- X.gx -48
- X.gy -8
- X\fMh\fP
- X.gy +4
- X.gx \(p)
- X.en
- X
- X
- X
- X\{INT 1 2} \{LBRACE} (x \{SU 2} - y \{SB 4} + (r + s) \{SU 3} ) \{RBRACE} dx
- X
- X
- X
- X
- X\{int} \{lbrace} ( \{SUM} some function) \{rbrace} dx
- X
- X
- END_OF_FILE
- if test 797 -ne `wc -c <'TestData/mathdemo.w'`; then
- echo shar: \"'TestData/mathdemo.w'\" unpacked with wrong size!
- fi
- # end of 'TestData/mathdemo.w'
- fi
- if test -f 'source/alg.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'source/alg.c'\"
- else
- echo shar: Extracting \"'source/alg.c'\" \(927 characters\)
- sed "s/^X//" >'source/alg.c' <<'END_OF_FILE'
- X#include <stdio.h>
- X#define VOID
- X
- X
- Xextern float rpn();
- Xextern struct cstack;
- Xextern int iscempty();
- Xextern char cpop();
- Xextern int cpush();
- X
- Xstruct cstack *s;
- X
- XVOID alg(as,t)
- X char as[],t[];
- X{
- X int i,j;
- X char c;
- X initcs(&s);
- X i = 0;
- X j = 0;
- X while (t[i] != '\0') {
- X if (isdigit(t[i]) || t[i] == '.' || t[i] == ' ') {
- X as[j++] = t[i++];
- X }
- X else if (t[i] == '(') {
- X cpush(&s,t[i++]);
- X }
- X else if ( t[i] == ')' ) {
- X while ((c=cpop(&s)) != '('){
- X as[j++] = ' ';
- X as[j++]=c;
- X as[j++] = ' ';
- X }
- X i++;
- X }
- X else {
- X while (prec(t[i]) <= prec(ctopofstack(s) ) ) {
- X as[j++] = cpop(&s);
- X }
- X cpush(&s,t[i++]);
- X }
- X }
- X
- X
- X while ( !iscempty(s) )
- X as[j++] = cpop(&s);
- X as[j] = t[i];
- X}
- X
- X
- X
- Xint prec(ch)
- Xchar ch;
- X{
- X if (ch == '+' || ch == '-')
- X return 1;
- X else if (ch == '/' || ch == '*')
- X return 2;
- X else if (ch == '(')
- X return 0;
- X}
- END_OF_FILE
- if test 927 -ne `wc -c <'source/alg.c'`; then
- echo shar: \"'source/alg.c'\" unpacked with wrong size!
- fi
- # end of 'source/alg.c'
- fi
- if test -f 'source/defs.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'source/defs.h'\"
- else
- echo shar: Extracting \"'source/defs.h'\" \(1973 characters\)
- sed "s/^X//" >'source/defs.h' <<'END_OF_FILE'
- X/* maximum length of string */
- X#define MAXSTR 512
- X
- X/* maximum output buffer size */
- X#define MAXBUF 1024
- X
- X/* length of a "short string" */
- X#define SHORTSTR 60
- X
- X/* number of files that can appear on command line */
- X#define MAXFILE 20
- X
- X/* for portability's sake */
- X#define VOID int
- X
- X/* number of format fields possible for a title field */
- X#define FNUMBER 20
- X
- X/* a big number */
- X#define HUGE 32767
- X
- X#ifdef UNIX
- X#define TRUE (1==1)
- X#define FALSE (1==0)
- X#else
- X#define TRUE 0
- X#define FALSE 1
- X#endif
- X
- X/* number of defined registers */
- X#define MAXREG 255
- X
- X/* reference register x, where x is a letter */
- X#define REG(x) reg[x-32]
- X
- X/* maximum number of arguments in a command line */
- X#define MAXCMD 10
- X
- X/* default left margin */
- X#define DEFLMARGIN 300
- X
- X/* default right margin */
- X#define DEFRMARGIN 2100
- X
- X/* default page length */
- X#define DEFPAGELENGTH 480
- X
- X/* default line spacing */
- X#define DEFLSPACE 1
- X
- X/* default general value for ti, bd, it, etc. */
- X#define DEFCOUNT 1
- X
- X/* an ESCAPE character */
- X#define ESC '\033'
- X
- X/* a form-feed */
- X#define FF '\014'
- X
- X/* a SHIFTOUT */
- X#define SHIFTOUT '\016'
- X
- X/* the ANCHOR character */
- X#define ANCHOR '\017'
- X
- X/* dots per 1/10 inch */
- X#define DOTSCHAR 30
- X
- X/* registers */
- X#define CURRPAGE REG('#')
- X#define NEXTPAGE REG('A')
- X#define BOTTOMMARGIN REG('B')
- X#define CNTRCNT REG('C')
- X#define DIVLEN REG('D')
- X#define ITALCNT REG('E')
- X#define CURRFONT REG('F')
- X#define BOLDCNT REG('G')
- X#define RJUSTIFY REG('H')
- X#define FILLMODE REG('I')
- X#define TDLIM REG('J')
- X#define TABLEMODE REG('K')
- X#define LMARGIN REG('L')
- X#define TEMPINDENT REG('M')
- X#define ULCOUNT REG('N')
- X#define PAGECHAR REG('O')
- X#define PAGELENGTH REG('P')
- X#define CHARCNT REG('Q')
- X#define RMARGIN REG('R')
- X#define LSPACE REG('S')
- X#define TOPMARGIN REG('T')
- X#define SPACEWIDTH REG('U')
- X#define VSPACE REG('V')
- X#define IPARA REG('W')
- X#define CURRX REG('X')
- X#define CURRY REG('Y')
- X#define ULSTATE REG('Z')
- X#define TABSTOPS REG('!')
- X#define MTHREE REG('_')
- X#define MTWO REG('^')
- X
- END_OF_FILE
- if test 1973 -ne `wc -c <'source/defs.h'`; then
- echo shar: \"'source/defs.h'\" unpacked with wrong size!
- fi
- # end of 'source/defs.h'
- fi
- if test -f 'source/expr.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'source/expr.c'\"
- else
- echo shar: Extracting \"'source/expr.c'\" \(3196 characters\)
- sed "s/^X//" >'source/expr.c' <<'END_OF_FILE'
- X#include <stdio.h>
- X#include <ctype.h>
- X
- X#include "defs.h"
- X#include "externs.c"
- X
- Xextern float rpneval();
- X
- X/* function eval is to evaluate an in-line expression */
- Xeval(estr)
- Xchar estr[];
- X{
- X char lhs;
- X char algstr[MAXSTR];
- X char tempstr[MAXSTR];
- X char temp1[MAXSTR];
- X int i,j,k;
- X
- X /* the idea is that the estr is of the form
- X
- X lhs = rhs
- X
- X and we therefore should "peel off" the lhs, and the
- X '=' sign. The only possibility for the lhs is the
- X name of a register, which must be a single letter.
- X The rhs can consist of arithmetic expressions made
- X with numbers, including floating point numbers, and
- X single-letter registers. */
- X
- X i = 0;
- X while (estr[i] != '\0' && isspace(estr[i]) ) i++;
- X lhs = estr[i];
- X i++;
- X while (estr[i] != '\0' && (estr[i] == '=' || isspace(estr[i]) ) )
- X i++;
- X /* here is the first of the rhs */
- X j = 0;
- X while (estr[i] != '\0') {
- X algstr[j] = estr[i];
- X i++;
- X j++;
- X }
- X algstr[j] = '\0';
- X
- X /* now replace every "letter" in algstr by a number */
- X k = 0;
- X j = 0;
- X while (algstr[j] != '\0') {
- X if (isalpha(algstr[j]) ) {
- X sprintf(temp1,"%d",REG(algstr[j]));
- X i = 0;
- X while (temp1[i] != '\0') {
- X tempstr[k] = temp1[i];
- X i++;
- X k++;
- X }
- X }
- X else {
- X tempstr[k] = algstr[j];
- X k++;
- X }
- X j++;
- X }
- X tempstr[k] = '\0';
- X
- X strcpy(algstr,tempstr);
- X alg(tempstr,algstr);
- X REG(lhs) = rpneval(tempstr);
- X
- X
- X}
- X
- X
- X
- X/* function Beval takes a boolean expression and evaluates it */
- Xint Beval(s)
- Xchar s[];
- X{
- X int i, j, k;
- X char lhs[SHORTSTR];
- X char rhs[SHORTSTR];
- X char rel[SHORTSTR];
- X char temp1[MAXSTR];
- X char tempstr[MAXSTR];
- X char rpnstr[MAXSTR];
- X float left,right;
- X
- X left = 0.0;
- X right = 0.0;
- X
- X /* now replace every "letter" in algstr by a number */
- X k = 0;
- X j = 0;
- X while (s[j] != '\0') {
- X if (isalpha(s[j]) ) {
- X sprintf(temp1,"%d",REG(s[j]));
- X i = 0;
- X while (temp1[i] != '\0') {
- X tempstr[k] = temp1[i];
- X i++;
- X k++;
- X }
- X }
- X else {
- X tempstr[k] = s[j];
- X k++;
- X }
- X j++;
- X }
- X tempstr[k] = '\0';
- X
- X strcpy(s,tempstr);
- X i = 0;
- X j = 0;
- X while (s[i] != '\0' && !isrelop(s[i]) ) {
- X lhs[j] = s[i];
- X i++;
- X j++;
- X }
- X lhs[j] = '\0';
- X
- X /* if s[i] is a relop then we need to know which one */
- X
- X j = 0;
- X while (s[i] != '\0' && isrelop(s[i]) ) {
- X rel[j] = s[i];
- X i++;
- X j++;
- X }
- X rel[j] = '\0';
- X
- X /* if there is a rhs, we need to copy it */
- X j = 0;
- X while (s[i] != '\0') {
- X rhs[j] = s[i];
- X i++;
- X j++;
- X }
- X rhs[j] = '\0';
- X
- X if (lhs[0] != '\0') {
- X alg(rpnstr,lhs);
- X left = rpneval(rpnstr);
- X }
- X if (rhs[0] != '\0') {
- X alg(rpnstr,rhs);
- X right = rpneval(rpnstr);
- X }
- X if (rel[0] == '\0')
- X return (left == 0.0);
- X else {
- X if (streq(rel,"<")) {
- X return (left < right);
- X }
- X else if (streq(rel,"<=")) {
- X return (left <= right);
- X }
- X else if (streq(rel,">")) {
- X return (left > right);
- X }
- X else if (streq(rel,">=")) {
- X return (left >= right);
- X }
- X else if (streq(rel,"==")) {
- X return (left == right);
- X }
- X else if (streq(rel,"!=")) {
- X return (left != right);
- X }
- X else {
- X fprintf(stderr,"error in boolean expression %s\n",s);
- X exit(0);
- X }
- X }
- X
- X
- X}
- X
- Xint isrelop(c)
- Xchar c;
- X{
- X if (
- X c == '<'
- X || c == '='
- X || c == '>'
- X || c == '!'
- X )
- X
- X return TRUE;
- X else
- X return FALSE;
- X}
- X
- END_OF_FILE
- if test 3196 -ne `wc -c <'source/expr.c'`; then
- echo shar: \"'source/expr.c'\" unpacked with wrong size!
- fi
- # end of 'source/expr.c'
- fi
- if test -f 'source/externs.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'source/externs.c'\"
- else
- echo shar: Extracting \"'source/externs.c'\" \(3026 characters\)
- sed "s/^X//" >'source/externs.c' <<'END_OF_FILE'
- X/* the externally defined stuff */
- X#include "defs.h"
- X
- Xextern char outbuf[MAXSTR]; /* the output buffer */
- Xextern int obufpos; /* position of next character to go
- X into the output buffer */
- X
- Xextern int FONTCHANGE; /* do emit all font changes */
- Xextern int FIRSTPAGE; /* first page to print */
- Xextern int LASTPAGE; /* last page to print */
- Xextern int FORMFEED; /* use formfeeds to go to next page */
- Xextern int SCANONLY; /* do not just scan the text for errors */
- Xextern char CMDCHAR; /* startup command character */
- Xextern int ISTTY; /* output is to a tty */
- Xextern int CLEANPAGE; /* the output page is still clean */
- Xextern int LASTPERIOD; /* last output character was a period */
- Xextern int InExpression; /* not in an expression */
- Xextern int ShouldPrint; /* print output by default */
- Xextern int InMacro; /* not in an in-line macro at first */
- Xextern int InDiversion; /* not in a diversion at first */
- Xextern int tplace; /* a global counter */
- Xextern int DivStart; /* place last diversion started */
- Xextern int shadd; /* should add a space to the buffer before
- X anything else */
- X
- Xextern int reg[MAXREG]; /* registers */
- X
- Xextern char prinit[SHORTSTR]; /* printer initialization string */
- Xextern char cfont[SHORTSTR]; /* current font */
- Xextern int *clen; /* pointer to length array */
- Xextern int *defl; /* pointer to default length array */
- Xextern char header[MAXSTR]; /* header line */
- Xextern char footer[MAXSTR]; /* footer line */
- Xextern char tfor[FNUMBER]; /* title formats */
- Xextern char expstr[MAXSTR]; /* expression string */
- Xextern char macline[MAXSTR]; /* in-line macro command line */
- Xextern char outselect; /* output method selector */
- X
- X/* holds the length of characters for each font measured in "dots" */
- Xextern int H12nl[127]; /* Helvetica 12 point normal */
- Xextern int H12bl[127]; /* Helvetica 12 point bold */
- Xextern int P18bl[127]; /* Presentation 18 point bold */
- Xextern char Pres[SHORTSTR]; /* to initialize mountable font */
- Xextern int H6nl[127]; /* Helvetica 6 point normal */
- Xextern int C12nl[127]; /* Courier 12 point fixed spacing */
- Xextern int H12il[127]; /* Helvetica 12 point italics */
- X
- X
- X
- X
- X/* here is the macrolist and definitions for the macros */
- X
- Xextern struct machead {
- X char mname[SHORTSTR];
- X struct macro *mfront, *mback;
- X struct machead *nextmacro;
- X};
- X
- Xextern struct machead *macrolist ;
- X
- Xextern struct macro {
- X char mline[MAXSTR];
- X struct macro *mnext;
- X};
- X
- X
- X/* the trap line stuff is here */
- X
- Xextern struct traphead {
- X int location;
- X int dirty;
- X char tname[SHORTSTR];
- X struct traphead *nexttrap;
- X};
- Xextern struct traphead *traplist ;
- X
- X
- X
- X
- X/* here is the stuff for the font stack */
- X
- Xextern struct macro *fstk ;
- X
- X
- X
- X
- X/* a stack of pointers to integers */
- Xextern struct intpstk {
- X int *iptr;
- X struct intpstk *inext;
- X};
- X
- Xextern struct intpstk *ipstk;
- X
- X
- Xextern struct cstack {
- X char datum;
- X struct cstack *link;
- X};
- X
- X
- Xextern struct stack {
- X float gdatum;
- X struct stack *glink;
- X};
- X
- X
- Xextern float pop();
- Xextern char cpop();
- Xextern char ctopofstack();
- END_OF_FILE
- if test 3026 -ne `wc -c <'source/externs.c'`; then
- echo shar: \"'source/externs.c'\" unpacked with wrong size!
- fi
- # end of 'source/externs.c'
- fi
- if test -f 'source/globals.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'source/globals.c'\"
- else
- echo shar: Extracting \"'source/globals.c'\" \(2820 characters\)
- sed "s/^X//" >'source/globals.c' <<'END_OF_FILE'
- X#include <stdio.h>
- X#include "defs.h"
- X
- X/* global variables */
- Xchar outbuf[MAXBUF]; /* the output buffer */
- Xint obufpos = 0; /* the position of the next character
- X to go in the output buffer */
- X
- Xint FONTCHANGE = TRUE; /* do emit all font changes */
- Xint FIRSTPAGE = 1; /* first page to print */
- Xint LASTPAGE = HUGE; /* last page to print */
- Xint FORMFEED = TRUE; /* use formfeeds to go to next page */
- Xint SCANONLY = FALSE; /* do not just scan the text for errors */
- Xchar CMDCHAR = '.'; /* startup command character */
- Xint ISTTY = TRUE; /* output is to a tty */
- Xint CLEANPAGE = TRUE; /* the output page is still clean */
- Xint LASTPERIOD = FALSE; /* last output character was a period */
- Xint InExpression = FALSE; /* not in an expression */
- Xint ShouldPrint = TRUE; /* default is to output text */
- Xint InMacro = FALSE; /* we are not in macro at first */
- Xint InDiversion = FALSE; /* we are not in a diversion at first */
- Xint tplace = 0; /* a global counter */
- Xint DivStart = 0; /* start of a diversion */
- Xint shadd = TRUE; /* should add a space to the buffer before
- X appending output */
- X
- Xint reg[MAXREG]; /* registers */
- Xchar prinit[SHORTSTR]; /* printer initialization string */
- Xchar cfont[SHORTSTR]; /* the current font */
- Xint *clen; /* pointer to the current length array */
- Xint *defl; /* pointer to the default font length array */
- Xchar header[MAXSTR]; /* header line */
- Xchar footer[MAXSTR]; /* footer line */
- Xchar tfor[FNUMBER]; /* title formats */
- Xchar expstr[MAXSTR]; /* expression string */
- Xchar macline[MAXSTR]; /* an in-line macro command line */
- Xchar outselect; /* output method selector */
- X
- X
- X/* holds the length of characters for each font measured in "dots" */
- Xint H12nl[127]; /* Helvetica 12 point normal */
- Xint H12bl[127]; /* Helvetica 12 point bold */
- Xint P18bl[127]; /* Presentation 18 point bold */
- Xchar Pres[SHORTSTR]; /* string to initialize Presentation (mountable) font */
- Xint H6nl[127]; /* Helvetica 6 point normal */
- Xint C12nl[127]; /* Courier 12 point fixed spacing */
- Xint H12il[127]; /* Helvetica 12 point italics */
- X
- X
- X/* here is the macrolist and definitions for the macros */
- X
- Xstruct machead {
- X char mname[SHORTSTR];
- X struct macro *mfront, *mback;
- X struct machead *nextmacro;
- X} ;
- Xstruct machead *macrolist = NULL;
- X
- Xstruct macro {
- X char mline[MAXSTR];
- X struct macro *mnext;
- X};
- X
- X
- X/* the trap line stuff is here */
- X
- Xstruct traphead {
- X int location;
- X int dirty;
- X char tname[SHORTSTR];
- X struct traphead *nexttrap;
- X} ;
- Xstruct traphead *traplist = NULL;
- X
- X
- X
- X/* here is the font stack */
- Xstruct macro *fstk = NULL;
- X
- X/* a stack of pointers to integers */
- Xstruct intpstk {
- X int *iptr;
- X struct intpstk *inext;
- X} ;
- Xstruct intpstk *ipstk = NULL;
- X
- X
- Xstruct cstack {
- X char datum;
- X struct cstack *link;
- X};
- X
- X
- Xstruct stack {
- X float gdatum;
- X struct stack *glink;
- X};
- X
- X
- END_OF_FILE
- if test 2820 -ne `wc -c <'source/globals.c'`; then
- echo shar: \"'source/globals.c'\" unpacked with wrong size!
- fi
- # end of 'source/globals.c'
- fi
- if test -f 'source/macros.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'source/macros.c'\"
- else
- echo shar: Extracting \"'source/macros.c'\" \(3338 characters\)
- sed "s/^X//" >'source/macros.c' <<'END_OF_FILE'
- X#include <stdio.h>
- X#include <ctype.h>
- X#include "defs.h"
- X#include "externs.c"
- X
- X/* this file contains the stuff pertaining to macros */
- X/* a macro consists of a header with the macro name in it,
- X and a pointer to a linked list of lines. The macrolist
- X is a linked list of macros */
- X
- X
- X/* add a line to the macro whose header is headptr */
- XVOID macaddline(headptr,s)
- Xstruct machead *headptr;
- Xchar s[];
- X{
- X struct macro *temp;
- X if (headptr == NULL) {
- X fprintf(stderr,"macro not defined -- fatal error \n");
- X exit(1);
- X }
- X else {
- X temp = (struct macro *) (malloc(sizeof(struct macro)));
- X strcpy(temp->mline,s);
- X temp->mnext = NULL;
- X if (headptr->mfront == NULL) {
- X headptr->mfront = temp;
- X headptr->mback = temp;
- X }
- X else {
- X headptr->mback->mnext = temp;
- X headptr->mback = temp;
- X }
- X }
- X}
- X
- X
- X
- X/* add a macro of name s to the macro list ... the macro does not yet
- X have any lines in it. The macro list is actually a stack of macros. */
- XVOID defmac(s,list)
- Xchar s[];
- Xstruct machead **list;
- X{
- X struct machead *temp;
- X temp = (struct machead *)(malloc(sizeof(struct machead)));
- X temp->mfront = NULL;
- X temp->mback = NULL;
- X temp->nextmacro = *list;
- X strcpy(temp->mname,s);
- X *list = temp;
- X}
- X
- X
- X
- X/* find a macro definition header by name */
- Xstruct machead * findmac(s)
- Xchar s[];
- X{
- X struct machead *temp;
- X temp = macrolist;
- X while (temp != NULL && !streq(temp->mname,s)) {
- X temp = temp->nextmacro;
- X }
- X return temp;
- X}
- X
- X
- X
- X/* process a macro */
- Xprocmacro (cline, ifile,ofile)
- Xchar cline[];
- XFILE *ifile,*ofile;
- X{
- X
- X struct machead *macptr;
- X struct macro *lineptr;
- X char temp[MAXSTR];
- X char args[MAXCMD][MAXSTR];
- X int i,j, k, cmdnbr;
- X
- X /* first parse out any arguments in the cline */
- X for (i = 0; i < MAXCMD; i++)
- X args[i][0] = '\0';
- X i = 0;
- X j = 0;
- X k = 0;
- X cmdnbr = 0;
- X /* move in cline to skip the cmdchar */
- X while (cline[i] != '\0' && (isspace(cline[i]) || cline[i] == CMDCHAR) )
- X i++;
- X
- X
- X /* copy each nonspace to argument */
- X while (cline[i] != '\0') {
- X j = 0;
- X while ( cline[i] != '\0' && ! isspace(cline[i])) {
- X args[cmdnbr][j] = cline[i];
- X i++;
- X j++;
- X }
- X args[cmdnbr][j] = '\0';
- X cmdnbr++;
- X /* skip white space */
- X while (cline[i] != '\0' && isspace(cline[i]))
- X i++;
- X }
- X
- X macptr = findmac(args[0]);
- X if (macptr == NULL) {
- X fprintf(stderr,"command %s not found\n",args[0]);
- X exit(1);
- X }
- X else {
- X /* run through the lines in the macro */
- X lineptr = macptr->mfront;
- X while (lineptr != NULL) {
- X
- X /* expand the line lineptr->mline to include
- X any references to "$#" stuff */
- X
- X j = 0;
- X i = 0;
- X k = 0;
- X temp[0] = '\0';
- X while (lineptr->mline[i] != '\0') {
- X if(lineptr->mline[i] == '$') {
- X /* see if next is a digit */
- X if (isdigit(lineptr->mline[i+1]) ){
- X i++; /* skip the $ */
- X cmdnbr = lineptr->mline[i] - '0';
- X i++; /* skip the digit */
- X k = 0;
- X while (args[cmdnbr][k] != '\0') {
- X temp[j] = args[cmdnbr][k];
- X k++;
- X j++;
- X }
- X }
- X else {
- X /* just copy it */
- X temp[j] = lineptr->mline[i];
- X i++;
- X j++;
- X }
- X }
- X else {
- X temp[j] = lineptr->mline[i];
- X i++;
- X j++;
- X }
- X }
- X temp[j] = '\0';
- X
- X
- X procline(ifile,ofile,temp);
- X lineptr = lineptr->mnext;
- X }
- X }
- X}
- X
- X
- END_OF_FILE
- if test 3338 -ne `wc -c <'source/macros.c'`; then
- echo shar: \"'source/macros.c'\" unpacked with wrong size!
- fi
- # end of 'source/macros.c'
- fi
- if test -f 'source/main.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'source/main.c'\"
- else
- echo shar: Extracting \"'source/main.c'\" \(4740 characters\)
- sed "s/^X//" >'source/main.c' <<'END_OF_FILE'
- X#include <stdio.h>
- X#include <ctype.h>
- X
- X#include "defs.h"
- X#include "globals.c"
- X
- XFILE *fopen(), *infile, *outfile;
- Xextern char First();
- X
- X
- X
- Xmain(argc, argv)
- Xint argc;
- Xchar *argv[];
- X{ int argnbr; /* number of non-switch command line arguments */
- X
- X char *d; /* a character pointer */
- X
- X int tint; /* temporary integer */
- X char tchar; /* temporary character */
- X char tempstr[MAXSTR]; /* temporary string */
- X
- X
- X
- X char filename[MAXFILE][SHORTSTR]; /* array of filenames */
- X int filenbr, fnbr; /* number of files on command line */
- X
- X/* make all initializations */
- Xinit();
- X
- X filenbr = 0;
- X infile = stdin;
- X outfile = stdout;
- X
- X /* is the output to a tty ? */
- X if (isatty(1) == 1) {
- X ISTTY = TRUE;
- X }
- X else {
- X ISTTY = FALSE;
- X }
- X
- X
- X if (argc == 1) {
- X infile = stdin;
- X outfile = stdout;
- X filenbr = 0;
- X }
- X else {
- X /* skip the first argument, since it is meaningless */
- X argc--;
- X argv++;
- X
- X/* now process the remaining arguments until there are no more */
- X
- X argnbr = 0; /* number of non-switch arguments */
- X while (argc > 0 ) {
- X d = argv[0];
- X if (*d == '-') {
- X /* its a switch */
- X d++; /* skip the '-' */
- X while (*d != '\0') {
- X switch(*d) {
- X
- X case 'b': /* begin printing with page */
- X argv++;
- X argc--;
- X FIRSTPAGE = atoi(argv[0]);
- X ShouldPrint = FALSE;
- X break;
- X
- X case 'e': /* end printing after page */
- X argv++;
- X argc--;
- X LASTPAGE = atoi(argv[0]);
- X break;
- X
- X case 'd': /* define a register to have a certain value */
- X argv++;
- X argc--;
- X tchar = argv[0][0];
- X argv++;
- X argc--;
- X tint = atoi(argv[0]);
- X REG(tchar) = tint;
- X break;
- X
- X case 'k': /* do not use formfeeds to go to next page */
- X FORMFEED = FALSE;
- X break;
- X
- X case 'o': /* use next file as outfile */
- X argv++;
- X argc--;
- X ISTTY = FALSE;
- X outfile = fopen(argv[0],"w");
- X break;
- X
- X
- X case 'p' : /* preview mode: do not emit font changes */
- X FONTCHANGE = FALSE;
- X break;
- X
- X
- X case 's': /* scan for errors only */
- X SCANONLY = TRUE;
- X outfile = fopen("/dev/null","w");
- X break;
- X
- X case 't': /* set tabstops at n */
- X argv++;
- X argc--;
- X TABSTOPS = atoi(argv[0]);
- X break;
- X
- X case 'v': /* print version number and exit */
- X printf("Wroff version: 2.2, September 4, 1991\n");
- X exit(0);
- X break;
- X
- X default : fprintf(stderr,"unknown switch %c\n",*d);
- X fprintf(stderr,"usage: wroff [-kpsv] [-b n] [-e n] [-t n] [-d reg value] [-p] [-o outfile] [infilelist]\n");
- X exit(1);
- X break;
- X
- X } /* end of switch */
- X d++; /* move to next character */
- X } /* of while */
- X }
- X else {
- X /* its not a switch */
- X argnbr++; /* number of non-switch arguments processed so far
- X including this one */
- X strcpy(filename[filenbr],argv[0]);
- X filenbr++;
- X }
- X
- X /* move to next argument */
- X argc--;
- X argv++;
- X } /* of while */
- X } /* of else */
- X
- X/* end of argument processing */
- Xif (ISTTY)
- X FONTCHANGE = FALSE;
- X
- X/* this is the START of the ACTION */
- X /* initialize the printer */
- X if (FONTCHANGE) {
- X sprintf(outbuf,"%s",prinit);
- X sprintf(tempstr,"%c&l%dC",ESC,VSPACE);
- X strcat(outbuf,tempstr);
- X putout(outfile,outbuf);
- X outbuf[0] = '\0';
- X tempstr[0] = '\0';
- X }
- X
- X if (filenbr == 0 )
- X procfile(infile,outfile);
- X else {
- X fnbr = 0;
- X while (fnbr < filenbr ) {
- X infile = fopen(filename[fnbr],"r");
- X if (infile == NULL) {
- X fprintf(stderr,"file %s not found\n",filename[fnbr]);
- X exit(1);
- X }
- X procfile(infile,outfile);
- X fclose(infile);
- X fnbr++;
- X } /* of while fnbr < filenbr */
- X }
- X
- X brek(infile,outfile);
- X brpage(infile,outfile);
- X fclose(infile);
- X fclose(outfile);
- X exit(0);
- X
- X
- X} /* of main */
- X
- X
- XVOID procfile(ifile,ofile)
- XFILE *ifile, * ofile;
- X{
- X char line[MAXSTR];
- X while (getline(line,ifile) != EOF) {
- X procline(ifile,ofile,line);
- X }
- X procline(ifile,ofile,line);
- X}
- X
- XVOID procline(ifile,ofile,line)
- XFILE *ifile,*ofile;
- Xchar line[];
- X{
- X checktraps(CURRY,ifile,ofile);
- X if (First(line) == CMDCHAR)
- X command(line,ifile,ofile);
- X else if (isblank(line)) {
- X outbuf[obufpos] = '\0';
- X brek(ifile,ofile);
- X /* end the current line */
- X endln();
- X finishline(ifile,ofile);
- X }
- X else if (!FILLMODE)
- X nonfill(line,ifile,ofile);
- X else
- X format(line,ifile,ofile);
- X
- X}
- X
- X
- X/* routine to finish a line and reinitialize all the counters */
- XVOID finishline(ifile,ofile)
- XFILE *ifile,*ofile;
- X{
- X int i;
- X /* now tack on any CR */
- X
- X
- X for (i = 1; i <= LSPACE; i++) {
- X if (ShouldPrint) putit('\n',ofile);
- X CURRY = CURRY + VSPACE;
- X }
- X
- X
- X /* be sure to empty the buffer again */
- X outbuf[0] = '\0';
- X obufpos = 0;
- X CHARCNT = 0;
- X if (CURRY + MTHREE > (PAGELENGTH - BOTTOMMARGIN)) {
- X brek(ifile,ofile);
- X brpage(ifile,ofile);
- X }
- X}
- X
- X
- END_OF_FILE
- if test 4740 -ne `wc -c <'source/main.c'`; then
- echo shar: \"'source/main.c'\" unpacked with wrong size!
- fi
- # end of 'source/main.c'
- fi
- if test -f 'source/makefile' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'source/makefile'\"
- else
- echo shar: Extracting \"'source/makefile'\" \(581 characters\)
- sed "s/^X//" >'source/makefile' <<'END_OF_FILE'
- XCFLAGS= -i
- XGLOBALS = globals.c defs.h
- XEXTERNS = externs.c
- XOBJS = main.o util.o io.o command.o init.o format.o macros.o traps.o stacks.o \
- X expr.o alg.o rpn.o
- Xa.out : $(OBJS)
- X $(CC) $(CFLAGS) $(OBJS)
- X
- Xmain.o : $(GLOBALS)
- X$(OBJS) : $(EXTERNS)
- X
- Xinstall :
- X strip a.out
- X mv a.out /usr/ECU/bin/wroff
- X chmod go+rx /usr/ECU/bin/wroff
- X chown root /usr/ECU/bin/wroff
- X
- Xdoc : macs.w wroff.1.w
- X a.out macs.w wroff.1.w -p -k -o doc.pr
- X
- Xtut : macs.w wroff.tut.w
- X a.out macs.w wroff.tut.w -p -k -o tut.pr
- X
- Xtar :
- X rm wroff.tar
- X tar cvf ../wroff.tar *
- X mv ../wroff.tar .
- X
- X
- Xclean:
- X rm a.out *.o
- END_OF_FILE
- if test 581 -ne `wc -c <'source/makefile'`; then
- echo shar: \"'source/makefile'\" unpacked with wrong size!
- fi
- # end of 'source/makefile'
- fi
- if test -f 'source/rpn.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'source/rpn.c'\"
- else
- echo shar: Extracting \"'source/rpn.c'\" \(1324 characters\)
- sed "s/^X//" >'source/rpn.c' <<'END_OF_FILE'
- X#include <stdio.h>
- X#include "defs.h"
- X#include "externs.c"
- X
- Xextern struct stack;
- Xextern float pop();
- Xextern int push();
- Xextern int inits();
- Xstruct stack *st;
- X
- Xint isdigit(c)
- Xchar c;
- X{
- X return ( (c <= '9') && (c >= '0'));
- X}
- X
- X
- Xint isop(ch)
- Xchar ch;
- X{
- X return ( (ch == '+')
- X || (ch == '-')
- X || (ch == '*')
- X || (ch == '/')
- X || (ch == ' ')
- X );
- X}
- X
- X
- X
- Xfloat rpneval(s)
- Xchar *s;
- X{
- X float i,j ;
- X float sumr,sumi;
- X float frac;
- X inits(&st);
- X while (*s != '\0') {
- X if (isop(*s)) {
- X switch(*s) {
- X case '+' :
- X i = pop(&st);
- X j = pop (&st);
- X push(&st,i+j);
- X break;
- X case '-' :
- X i = pop(&st);
- X j = pop(&st);
- X push(&st,j-i);
- X break;
- X case '*' :
- X i = pop(&st);
- X j = pop(&st);
- X push(&st,i*j);
- X break;
- X case '/' :
- X i = pop(&st);
- X j = pop(&st);
- X push(&st,(j / i) );
- X break;
- X case ' ' :
- X break;
- X }
- X }
- X else {
- X if (isdigit(*s)) {
- X sumi = 0.0;
- X sumr = 0.0;
- X while (isdigit(*s)) {
- X sumi = 10 * sumi + (*s - '0');
- X s++;
- X }
- X if ((*s) == '.') {
- X s++;
- X sumr = 0.0;
- X frac = 0.1;
- X while (isdigit(*s)) {
- X sumr = sumr + (*s -'0') * frac;
- X frac = frac * 0.1;
- X s++;
- X }
- X }
- X push(&st,sumi + sumr);
- X s--;
- X }
- X
- X }
- X s++;
- X }
- X return pop(&st);
- X }
- X
- END_OF_FILE
- if test 1324 -ne `wc -c <'source/rpn.c'`; then
- echo shar: \"'source/rpn.c'\" unpacked with wrong size!
- fi
- # end of 'source/rpn.c'
- fi
- if test -f 'source/stacks.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'source/stacks.c'\"
- else
- echo shar: Extracting \"'source/stacks.c'\" \(2664 characters\)
- sed "s/^X//" >'source/stacks.c' <<'END_OF_FILE'
- X#include <stdio.h>
- X#include "defs.h"
- X#include "externs.c"
- X
- X/* this file contains the stack handlers */
- X
- X
- X/* we use pushf to push a font onto the font stack */
- X/* note that the same struct as for macros is used */
- XVOID pushf(s,l)
- Xchar s[];
- Xstruct macro **l;
- X{
- X struct macro *temp;
- X temp = (struct macro *) (malloc(sizeof(struct macro)));
- X strcpy(temp->mline,s);
- X temp->mnext = *l;
- X *l = temp;
- X}
- X
- XVOID popf(s,l)
- Xchar s[];
- Xstruct macro **l;
- X{
- X struct macro *temp;
- X temp = *l;
- X if (temp != NULL) {
- X strcpy(s,temp->mline);
- X (*l) = temp->mnext;
- X free(temp);
- X }
- X else {
- X strcpy(s,prinit);
- X }
- X
- X}
- X
- XVOID popi(x,l)
- Xint **x;
- Xstruct intpstk **l;
- X{
- X struct intpstk *temp;
- X temp = *l;
- X if ( temp != NULL) {
- X *x = (temp->iptr);
- X (*l) = temp->inext;
- X free (temp);
- X }
- X else
- X *x = defl;
- X}
- X
- X
- XVOID pushi(x,l)
- Xint *x;
- Xstruct intpstk **l;
- X{
- X struct intpstk *temp;
- X temp = (struct intpstk *) (malloc(sizeof(struct intpstk)));
- X temp->iptr = x;
- X (temp->inext) = (*l);
- X (*l) = temp;
- X}
- X
- Xstruct stack *stackalloc()
- X{
- X return ((struct stack *)( malloc(sizeof(struct stack))));
- X};
- X
- Xstruct cstack *cstackalloc()
- X{
- X return (( struct cstack*)(malloc(sizeof(struct cstack))));
- X};
- X
- X
- X
- XVOID push(s,item)
- X struct stack **s;
- X float item;
- X{
- X struct stack *t;
- X t = stackalloc();
- X t->gdatum = item;
- X t->glink = *s;
- X *s = t;
- X}
- X
- XVOID cpush(s,item)
- X struct cstack **s;
- X char item;
- X{
- X struct cstack *t;
- X t = cstackalloc();
- X t->datum = item;
- X t->link = *s;
- X *s = t;
- X}
- X
- X
- X
- X
- Xfloat pop(s)
- X struct stack **s;
- X{
- X struct stack *t;
- X t = *s;
- X *s = (*s)->glink;
- X return (t->gdatum);
- X}
- X
- Xchar cpop(s)
- X struct cstack **s;
- X{
- X struct cstack *t;
- X t = *s;
- X *s = (*s)->link;
- X return (t->datum);
- X}
- X
- Xchar ctopofstack(s)
- X struct cstack *s;
- X {
- X if (! iscempty(s) )
- X return (s)->datum;
- X else
- X return NULL;
- X }
- X
- X
- XVOID inits(s)
- X struct stack **s;
- X {
- X *s = NULL;
- X }
- X
- XVOID initcs(s)
- X struct cstack **s;
- X {
- X *s = NULL;
- X}
- X
- X
- Xint isempty(s)
- X struct stack *s;
- X {
- X return (s == NULL);
- X }
- X
- X
- Xint iscempty(s)
- X struct cstack*s;
- X {
- X return (s == NULL);
- X}
- X
- X
- X
- XVOID getint(pn)
- X int *pn;
- X{
- X int sign;
- X int sum;
- X char c;
- X
- X while (( c = getchar()) == ' ' || c == '\n' || c == '\t')
- X ;
- X sign = 1;
- X
- X if (c == '+' || c == '-') {
- X sign = (c=='+') ? 1 : -1;
- X c = getchar();
- X }
- X
- X sum = 0;
- X
- X while ( (c >= '0') && (c <= '9') ) {
- X sum = 10 * (sum ) + c - '0';
- X
- X c = getchar();
- X }
- X
- X sum *= sign;
- X (*pn) = sum;
- X
- X
- X}
- X
- XVOID dumpfstack(st)
- Xstruct stack *st;
- X{
- X while (st != NULL) {
- X printf("=== %10.2f\n",st->gdatum);
- X st = st->glink;
- X }
- X}
- X
- XVOID dumpcstack(st)
- X struct cstack *st;
- X{
- X while (st != NULL ) {
- X printf("=== %c\n",st->datum);
- X st = st->link;
- X }
- X}
- X
- X
- END_OF_FILE
- if test 2664 -ne `wc -c <'source/stacks.c'`; then
- echo shar: \"'source/stacks.c'\" unpacked with wrong size!
- fi
- # end of 'source/stacks.c'
- fi
- if test -f 'source/tags' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'source/tags'\"
- else
- echo shar: Extracting \"'source/tags'\" \(2969 characters\)
- sed "s/^X//" >'source/tags' <<'END_OF_FILE'
- XBeval expr.c ?^int Beval(s)$?
- XFirst util.c ?^char First(s)$?
- XMmain main.c ?^main(argc, argv)$?
- XMmaketest maketest.c ?^VOID finishline(ifile,ofile)$$?
- Xaddbuf util.c ?^addbuf(s)$?
- Xaddstr util.c ?^VOID addstr(s,sf,sb)$?
- Xalg alg.c ?^VOID alg(as,t)$?
- Xappend format.c ?^VOID append(s,chcnt)$?
- Xargtype command.c ?^int argtype (s)$?
- Xargval command.c ?^int argval(s)$?
- Xbrek format.c ?^VOID brek(ifile,ofile)$?
- Xbrpage io.c ?^VOID brpage(ifile,f) $?
- Xchecktraps traps.c ?^checktraps(n,ifile,ofile)$?
- Xcleantraps traps.c ?^cleantraps()$?
- Xcommand command.c ?^command(s,ifile,ofile)$?
- Xcpop stacks.c ?^char cpop(s)$?
- Xcpush stacks.c ?^VOID cpush(s,item)$?
- Xcstackalloc stacks.c ?^struct cstack *cstackalloc()$?
- Xctopofstack stacks.c ?^char ctopofstack(s)$?
- Xdefmac macros.c ?^VOID defmac(s,list)$?
- Xdeftrap traps.c ?^VOID deftrap(s,loc,list)$?
- Xdumpcstack stacks.c ?^VOID dumpcstack(st)$?
- Xdumpfstack stacks.c ?^VOID dumpfstack(st)$?
- Xdumptraps traps.c ?^dumptraps()$?
- Xendln io.c ?^VOID endln()$?
- Xerror util.c ?^VOID error(s)$?
- Xeval expr.c ?^eval(estr)$?
- Xexpand util.c ?^VOID expand(tempstr,s)$?
- Xexpndreg util.c ?^expndreg(cmd1,cmd2)$?
- Xfindmac macros.c ?^struct machead * findmac(s)$?
- Xfinishline main.c ?^VOID finishline(ifile,ofile)$?
- Xformat format.c ?^format(s,ifile,f)$?
- Xforprint io.c ?^VOID forprint(ifile,f,diff)$?
- Xgetint stacks.c ?^VOID getint(pn)$?
- Xgetline io.c ?^VOID getline(s,f)$?
- Xgetword format.c ?^VOID getword(t,s,i)$?
- XgotoX io.c ?^gotoX(ifile,ofile,s)$?
- XgotoXY io.c ?^gotoXY(ifile,ofile,x,y)$?
- XgotoY io.c ?^gotoY(ifile,ofile,s)$?
- Xinit init.c ?^VOID init()$?
- Xinitcs stacks.c ?^VOID initcs(s)$?
- Xinits stacks.c ?^VOID inits(s)$?
- Xisblank util.c ?^int isblank(s)$?
- Xiscempty stacks.c ?^int iscempty(s)$?
- Xisdigit rpn.c ?^int isdigit(c)$?
- Xisempty stacks.c ?^int isempty(s)$?
- Xisop rpn.c ?^int isop(ch)$?
- Xisrelop expr.c ?^int isrelop(c)$?
- Xlength format.c ?^int length(c)$?
- Xmacaddline macros.c ?^VOID macaddline(headptr,s)$?
- Xnonfill format.c ?^nonfill(s,ifile,f)$?
- Xnullprint io.c ?^VOID nullprint(ifile,ofile,diff)$?
- Xoutput io.c ?^VOID output(ifile,ofile,n)$?
- Xparseword format.c ?^VOID parseword(tstring,word,wordlength,chcnt,ifile?
- Xpop stacks.c ?^float pop(s)$?
- Xpopf stacks.c ?^VOID popf(s,l)$?
- Xpopi stacks.c ?^VOID popi(x,l)$?
- Xprec alg.c ?^int prec(ch)$?
- Xprocfile main.c ?^VOID procfile(ifile,ofile)$?
- Xprocline main.c ?^VOID procline(ifile,ofile,line)$?
- Xprocmacro macros.c ?^procmacro (cline, ifile,ofile)$?
- Xpush stacks.c ?^VOID push(s,item)$?
- Xpushf stacks.c ?^VOID pushf(s,l)$?
- Xpushi stacks.c ?^VOID pushi(x,l)$?
- Xputfoot io.c ?^putfoot(ifile,ofile)$?
- Xputhead io.c ?^puthead(ifile,ofile)$?
- Xputit io.c ?^VOID putit(c,f)$?
- Xputout io.c ?^VOID putout(f,s)$?
- Xrawout io.c ?^VOID rawout(f,s)$?
- Xrpneval rpn.c ?^float rpneval(s)$?
- Xsetparm command.c ?^int setparm(sparm,satype,svalue,sdflt,smin,smax)$?
- Xstackalloc stacks.c ?^struct stack *stackalloc()$?
- Xstreq util.c ?^int streq(s,t)$?
- Xtitle util.c ?^VOID title(ostr,istr,lmargin,rmargin,delim,tcnt,fs?
- Xtprint io.c ?^VOID tprint(ifile,ofile,diff)$?
- END_OF_FILE
- if test 2969 -ne `wc -c <'source/tags'`; then
- echo shar: \"'source/tags'\" unpacked with wrong size!
- fi
- # end of 'source/tags'
- fi
- if test -f 'source/test.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'source/test.c'\"
- else
- echo shar: Extracting \"'source/test.c'\" \(1442 characters\)
- sed "s/^X//" >'source/test.c' <<'END_OF_FILE'
- X/* transparent mode */
- X{
- X char xch;
- X int xquit;
- X
- X xquit = FALSE;
- X
- X while ( (xch = getc(ifile)) != EOF && !xquit) {
- X if (xch == '\n') { /* we have a newline, so must check what comes next */
- X xch = getc(ifile);
- X /* it could be EOF !*/
- X if (xch == EOF) { /* the file ended with a newline */
- X fprintf(ofile,"\n");
- X xquit = TRUE;
- X }
- X else if (xch == CMDCHAR ){ /* if we have a CMDCHAR we may be in business */
- X xch = getc(ifile);
- X /* be sure it isn't an EOF */
- X if (xch == EOF) { /* file ended with "\nCMDCHAR" */
- X fprintf(ofile,"\n%c",CMDCHAR);
- X xquit = TRUE;
- X }
- X else { /* we now have "\nCMDCHAR" followed by something real */
- X if (xch == 'e') { /* wow --- getting close */
- X xch = getc(ifile);
- X /* is it? is it? a "t" ?*/
- X if (xch == EOF) { /* nuts */
- X fprintf(ofile,"\n%ce",CMDCHAR);
- X xquit = TRUE;
- X }
- X else if (xch == 't') { /* GOT IT! Yea! */
- X
- X xquit = TRUE;
- X }
- X else { /* gloom! */
- X fprintf(ofile,"\n%ce%c",CMDCHAR,xch);
- X }
- X }
- X else { /* broken heart */
- X fprintf(ofile,"\n%c%c",CMDCHAR,xch);
- X }
- X }
- X
- X }
- X else { /* not a CMDCHAR -- just copy \n and the char to the output */
- X fprintf(ofile,"\n%c",xch);
- X }
- X }
- X else { /* just copy the character to output */
- X putc(xch,ofile);
- X }
- X
- X } /* of while loop */
- X
- X /* at end of the loop output a newline */
- X putc('\n',ofile);
- X
- X
- X
- X}
- X /* end of transparent mode */
- END_OF_FILE
- if test 1442 -ne `wc -c <'source/test.c'`; then
- echo shar: \"'source/test.c'\" unpacked with wrong size!
- fi
- # end of 'source/test.c'
- fi
- if test -f 'source/traps.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'source/traps.c'\"
- else
- echo shar: Extracting \"'source/traps.c'\" \(1706 characters\)
- sed "s/^X//" >'source/traps.c' <<'END_OF_FILE'
- X#include <stdio.h>
- X#include "defs.h"
- X#include "externs.c"
- X
- X/* this file contains the stuff pertaining to traps.*/
- X/* a trap consists of a header with the trap name in it,
- X and a pointer to a linked list of lines. The traplist
- X is a linked list of traps */
- X
- X
- X
- X
- X/* add a trap of name s to the trap list ... the trap does not yet
- X have any lines in it. The list is HAS to be kept ordered ! */
- XVOID deftrap(s,loc,list)
- Xchar s[];
- Xint loc;
- Xstruct traphead **list;
- X{
- X struct traphead *temp;
- X if ((*list == NULL) || (loc < (*list)->location) ) {
- X temp = (struct traphead *)(malloc(sizeof(struct traphead)));
- X temp->nexttrap= *list;
- X temp->location = loc;
- X temp->dirty = FALSE;
- X strcpy(temp->tname,s);
- X *list = temp;
- X }
- X else
- X deftrap(s,loc,&((*list)->nexttrap));
- X}
- X
- X
- X
- X/* make the trap line 'clean' instead of dirty */
- Xcleantraps()
- X{
- X struct traphead *temp;
- X temp = traplist;
- X while (temp != NULL) {
- X temp->dirty = FALSE;
- X temp = temp->nexttrap;
- X }
- X}
- X
- X/* check for any traps that are "clean" but that must be sprung
- X before the CURRY exceeds N --- spring these traps */
- Xchecktraps(n,ifile,ofile)
- Xint n;
- XFILE *ifile, *ofile;
- X{
- X
- X struct traphead *temp;
- X temp = traplist;
- X while (temp != NULL) {
- X if ((temp->location <= n) && (temp->dirty == FALSE) ){
- X temp->dirty = TRUE;
- X /* go to that place on the page */
- X gotoXY(ifile,ofile,LMARGIN - length(' '),temp->location);
- X procmacro(temp->tname,ifile,ofile);
- X }
- X temp = temp->nexttrap;
- X }
- X
- X}
- X
- X
- X
- X/* debug procedure to dump trap line */
- Xdumptraps()
- X{
- X struct traphead *temp;
- X temp = traplist;
- X while (temp != NULL) {
- X fprintf(stderr,"debug: trap line holds macro ->%s<- at %d\n",
- X temp->tname,temp->location);
- X temp = temp->nexttrap;
- X }
- X}
- X
- X
- END_OF_FILE
- if test 1706 -ne `wc -c <'source/traps.c'`; then
- echo shar: \"'source/traps.c'\" unpacked with wrong size!
- fi
- # end of 'source/traps.c'
- fi
- echo shar: End of archive 3 \(of 5\).
- cp /dev/null ark3isdone
- MISSING=""
- for I in 1 2 3 4 5 ; do
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have unpacked all 5 archives.
- rm -f ark[1-9]isdone
- else
- echo You still must unpack the following archives:
- echo " " ${MISSING}
- fi
- exit 0
- exit 0 # Just in case...
- --
- Kent Landfield INTERNET: kent@sparky.IMD.Sterling.COM
- Sterling Software, IMD UUCP: uunet!sparky!kent
- Phone: (402) 291-8300 FAX: (402) 291-4362
- Please send comp.sources.misc-related mail to kent@uunet.uu.net.
-