00REVHST.TXT.200, 17-Nov-87 20:02:40, Edit by BEEBE This file contains a reverse chronological log of changes made to the TeX DVI Driver family. Version history: 2.10 [01-Nov-87] 2.09 [23-Sep-87] 2.08 [15-Aug-87] 2.07 [15-Apr-87] 2.06 [1986-1987] The version number does not change with minor modifications that affect only a few drivers, so the file write dates on the master directories at Utah (and recorded on distribution tapes and floppies) must be consulted to determine whether a particular distribution contains these corrections. Where feasible, this change log contains sufficient information to allow hand installation of bug fixes. Changes will generally not be logged at new versions, since they may be extensive. [07-Jun-88] {Thanks to Hans Irtel } In initglob.h about line 51, change size_limit = 255; /* largest character size */ to size_limit = 128; /* largest character size */ The HP LaserJet Plus has a character cell height and width range limitation of 1..255, but further restricts individual character dimensions to 0..128. This bug is exposed if you attempt to print characters at size magstep 4 or larger, such as the following test TeX file supplied by William E. Anderson : \magnification=\magstep4 $$f(x)=\int{g(x)\over x}\,dx$$ \vfill\eject\bye for which the integral sign will be lost without the fix, and will appear once the fix is applied. [31-May-88] Issued newsletter #17. [30-May-88] {Thanks to Jerry Leichter (LEICHTER@Venus.YCC.Yale.Edu) for providing an example that exposed this bug.} In dvijep.c, rules are output one dot too high. According to the HP documentation, the position of a rule is the upper-left corner. I took this to mean that the rule would be output starting just under the pixel at (x,y) in that corner. What they must mean is that (x,y) is the position of the pixel in the upper-left corner of the filled area. Change the definitions of RULE() and RULE2() about line 160 to reduce the height value by 1 in the arguments to MOVETO(): diff -c dvijep.c,75 dvijep.c *** dvijep.c,75 Wed May 18 09:42:01 1988 --- dvijep.c Mon May 30 19:03:07 1988 *************** *** 162,174 **** lower-left corner, while the LaserJet Plus uses the upper-left corner. */ #define RULE(x,y,width,height) {\ ! MOVETO(x,(y)+height);PUTESC;\ sprintf(plotfs,"*c%da%dbP",width,height); OUTST(plotfs);\ } /* Set rule of same size as previous one at TeX position (x,y). The device coordinates will be changed on completion. */ #define RULE2(x,y) {\ ! MOVETO(x,(y)+rule_height);\ PUTESC;OUTST("*cP");\ } /* Set the current font and character in preparation for a DOWNLOADCHAR */ --- 162,174 ---- lower-left corner, while the LaserJet Plus uses the upper-left corner. */ #define RULE(x,y,width,height) {\ ! MOVETO(x,(y)+height-1);PUTESC;\ sprintf(plotfs,"*c%da%dbP",width,height); OUTST(plotfs);\ } /* Set rule of same size as previous one at TeX position (x,y). The device coordinates will be changed on completion. */ #define RULE2(x,y) {\ ! MOVETO(x,(y)+rule_height-1);\ PUTESC;OUTST("*cP");\ } /* Set the current font and character in preparation for a DOWNLOADCHAR */ The same correction must be made to dvilzr.c for the DataProducts laser printer. I had previously received reports of suspicions of an error in dvijep's rule positions, but no one ever was able to supply an example that I could reproduce locally. Here is Jerry's excellent little test file: \documentstyle[12pt]{article} \def\vec(#1,#2){\put(0,0){\vector(#1,#2){50}}} \begin{document} \setlength{\unitlength}{.01in} \begin{picture}(0,0)(100,100) \vec(-1,0) \vec(1,0) \vec(0,1) \vec(0,-1) % \vec(-4,1)\vec(-3,1)\vec(-2,1)\vec(-1,1) \vec(4,1)\vec(3,1)\vec(2,1)\vec(1,1) % \vec(-3,2)\vec(-1,2) \vec(3,2)\vec(1,2) % \vec(-4,3)\vec(-2,3)\vec(-1,3) \vec(4,3)\vec(2,3)\vec(1,3) % \vec(-3,4)\vec(-1,4) \vec(3,4)\vec(1,4) % \vec(-4,-1)\vec(-3,-1)\vec(-2,-1)\vec(-1,-1) \vec(4,-1)\vec(3,-1)\vec(2,-1)\vec(1,-1) % \vec(-3,-2)\vec(-1,-2) \vec(3,-2)\vec(1,-2) % \vec(-4,-3)\vec(-2,-3)\vec(-1,-3) \vec(4,-3)\vec(2,-3)\vec(1,-3) % \vec(-3,-4)\vec(-1,-4) \vec(3,-4)\vec(1,-4) % \end{picture} \end{document} When printed with dvialw, the two horizontal rules are printed correctly; before the above correction to dvijep, they were one pixel too high, (this gives a visible white streak). The correction should also fix the misalignment with the arrowheads. [30-May-88] The following bug in dvialw.c was fixed on 3-Feb-88, but unfortunately didn't make it into this log. diff -c dvialw.c,78 dvialw.c,79 *** dvialw.c,78 Sun Nov 1 11:21:38 1987 --- dvialw.c,79 Wed Feb 3 16:38:28 1988 *************** *** 1080,1085 **** --- 1080,1086 ---- } OUT_CHR('('); OUT_XCHR(c); + OUT_CHR(')'); if (ycp != str_ycp) { OUT_NUM(xcp); There was a missing ')' in the output. [26-May-88] Issued newsletter #16. [18-May-88] In dvijep.c about line 180, change {PUTESC; sprintf(plotfs,"*c%dE",MAP_CHAR(ch)); OUTST(plotfs); }\ to {PUTESC; sprintf(plotfs,"*cd%dE",MAP_CHAR(ch)); OUTST(plotfs); }\ This correction sets the font number to 0; the old one works on the HP LaserJet, but might break on clones. [14-Apr-88] Changed system() in vaxvms.c to allow warning and information status returns to be treated as success. The body of system() now reads: t.dsc$w_length = strlen(s); t.dsc$a_pointer = s; t.dsc$b_class = DSC$K_CLASS_S; t.dsc$b_dtype = DSC$K_DTYPE_T; /* The 3 low-order bits of stat are 0 (warning), 1 (success), 2 (error), 3 (information), or 4 (severe or fatal error) Consider values of 0, 1, or 3 to be success. LIB$SPAWN will usually return SS$_NORMAL, independent of the value of stat. */ if (LIB$SPAWN(&t,0,0,0,0,0,&stat) != SS$_NORMAL) return (127); switch (stat & 7) { case 0: case 1: case 3: return (0); default: return (127); } [07-Mar-88] Changed type of main() in keytst.c and lptops.c from void to int, and inserted return(0) at end to keep lint and VAX VMS C compiler happy. Draft ANSI C (Oct-86 and Jan-88) does not specify what the type of main() should be, and most compilers don't care. VMS C 2.3 however produces an annoying warning message if main() is not of type int; I view this behavior as erroneous, because main() is only a convention in C, and it is possible to write C programs in many implementations that do not have a main(). [02-Mar-88] Added code to findpost.h to ignore trailing NULs in a .DVI file, borrowing code from readpxl.h and readgf.h that do the same thing for font files. Users (including me) have been annoyed by the inability of the drivers to handle a .DVI file which has passed through a VAX VMS system where gratuitous NULs are appended to pad the file length to a multiple of 512 bytes. This effort revealed another problem under VAX VMS, and that is that the code in FSEEK() in vaxvms.c on a request to position at end-of-file actually positions before the last character, instead of after it. An attempt at correcting this was foiled by the VMS library ftell() which returns 0 when the position set by FSEEK() is outside the actual file limits, and while FTELL() can correct the brain-damaged value returned by ftell(), it cannot distinguish a nonsensical 0 result from ftell() at end-of-file from one at the beginning of the file. Consequently, it has been necessary in findpost.h to bump the postambleptr value by one. Since this modification can be installed independently in even old versions of the DVI driver family, and a context difference listing is larger than findpost.h, here is the complete new version: /* -*-C-*- findpost.h */ /*-->findpost*/ /**********************************************************************/ /****************************** findpost ******************************/ /**********************************************************************/ void findpost() { register long postambleptr; register BYTE i; register UNSIGN16 the_char; /* loop index */ (void) FSEEK (dvifp, 0L, 2); /* goto end of file */ /* VAX VMS binary files are stored with NUL padding to the next 512 byte multiple. We therefore search backwards to the last non-NULL byte to find the real end-of-file, then move back from that. Even if we are not on a VAX VMS system, the DVI file might have passed through one on its way to the current host, so we ignore trailing NULs on all machines. */ while (FSEEK(dvifp,-1L,1) == 0) { the_char = (UNSIGN16)fgetc(dvifp); if (the_char) break; /* exit leaving pointer PAST last non-NUL */ UNGETC((char)the_char,dvifp); } postambleptr = FTELL(dvifp) - 4; #if OS_VAXVMS /* There is a problem with FSEEK() that I cannot fix just now. A request to position to end-of-file cannot be made to work correctly, so FSEEK() positions in front of the last byte, instead of past it. We therefore modify postambleptr accordingly to account for this. */ postambleptr++; #endif (void) FSEEK (dvifp, postambleptr, 0); while (TRUE) { (void) FSEEK (dvifp, --(postambleptr), 0); if (((i = (BYTE)nosignex(dvifp,(BYTE)1)) != 223) && (i != DVIFORMAT)) (void)fatal("findpost(): Bad end of DVI file"); if (i == DVIFORMAT) break; } (void) FSEEK (dvifp, postambleptr - 4, 0); (void) FSEEK (dvifp, (long)nosignex(dvifp,(BYTE)4), 0); } [06-Feb-88] Revised lpt.ps to handle formfeed and tabs. [17-Nov-87] Installation of the DVI driver family under Microsoft C Version 5.0 resulted in a number of changes more fully described in 01README.TXT (to be included in the next DVI newsletter). This is the first compiler that fully conforms to draft ANSI C (October 1986) in both the language and the run-time library. Added missing typecast in dvieps.c and dvie72.c. In dvihead.h, added #include's for io.h and time.h for IBM_PC_MICROSOFT. Added two missing typecasts in dvijep.c, and inserted the missing condition "(t->istoobig) ||" to BIGCHAR(). In gblprocs.h, replaced ANSI flag by ANSI_LIBRARY and ANSI_PROTOTYPES to distinguish between library conformance, and ANSI function prototype use, and adjusted many function declarations accordingly. In keybrd.c, provided alternate name for interrupt(); its use otherwise causes an compiler error with MSC 5.0. In keydef.h, replaced ANSI section by ANSI_LIBRARY and ANSI_PROTOTYPE sections. In keytst.c, added some comments, and changed the test to loop a maximum of five times with no input. Introduced an implementation of sleep() for OS_PCDOS. In lptops.c, replaced ANSI section by ANSI_LIBRARY and ANSI_PROTOTYPE sections, and reset a couple of constants to type long. In machdefs.h, replaced ANSI section by ANSI_LIBRARY and ANSI_PROTOTYPE sections, and for IBM_PC_MICROSOFT, defined float to be double to reduce data conversion warnings. In main.h, removed #include's of stdlib.h and string.h; they are already in machdefs.h. In option.h, removed use of ABS() for a floating-point argument to remove data conversion warning. In texidx.c, changed preprocessor symbol MSC to IBM_PC_MICROSOFT. In tosprx.c, replaced ANSI section by ANSI_LIBRARY and ANSI_PROTOTYPE sections. Revised IBM PC-specific version of Make to work with Microsoft C Version 5.0, eliminating some severe limitations imposed by Wizard C, and permitting the MAKEFILE.MSC to be completely self-contained, instead of having to reference MAKEFILE.1 .. MAKEFILE.4. Several new features were also implemented in Make; they are described in a 00README.TXT file in the PCMAKE directory. [01-Nov-87] Replaced references to (void)fprintf(..., plotfp) with references to new macros OUTF(...), OUTF2(...), and OUTF3(...), or existing ones OUTC() and OUTS(). Replaced all instances of putc(*c++,plotfp) by "OUTC(*c);c++". Since putc() is usually a macro, there is a potential incorrect side effect if its first argument is evaluated more than once. Most C implementations use it only in the two branches of a conditional expression, which is safe. [01-Nov-87] Completed major overhaul of dvijep.c. The font deletion mechanism was not successful, partly because the font number was not subsequently reset in one place, but mostly because it causes a page eject. This would make it impossible to print some documents. dvijep now keeps track of both the number of fonts in use on the current page, and the total number in use in the document. When either of these limits is reached, the characters in those fonts are sent as bitmaps, instead of as downloaded fonts. It is still possible to have a document which is too complex for the LaserJet to print (raising error code 21 on the printer front panel status display), but that is now a limit imposed by the printer, rather than the DVI driver, and cannot be gotten around. There is room for further work here, however. Most documents do not require an excessively large number of fonts. For example, dvidriver.ltx uses 23 fonts, and weave.tex uses 15, but the TeXbook uses 54. When the DVI driver begins execution, through the call chain main() -> dvifile() -> readpost() -> getfntdf() -> readfont() -> reldfont() -> read{pk|gf|pxl}() -> newfont(), it normally reads in the font definitions from the DVI file postamble and assigns font numbers in order of occurrence, and builds its internal font and character tables. Later, as pages are processed, font changes occasioned by DVI fnt_num_0 .. fnt_num_63 and fnt1 .. fnt4 commands result in setting the global flag font_switched, which in turn causes setchar() and setstr() to output font switch commands to the device. The implication of this for dvijep is that all fonts beyond the first 32 are marked as non-downloadable. In the case of the TeXbook, it turns out that this includes the heavily-used cmr, cmsy, and cmmi fonts at 5, 6, 7, 8, 9, and 10 pt sizes, which means that almost all of the characters set on a page will be sent as bitmaps, instead of as downloaded characters. On my HP LaserJet Plus, every page raised printer error code 21. This might not happen on an HP LaserJet Series II, which can have substantially more memory, but I haven't one locally to try the experiment. The solution to this problem is to delay font number assignment until the font is actually referenced. Since a considerably smaller number of fonts are needed on each page, it is then possible to download most of them, and a font-rich document like the TeXbook can be printed successfully in sections. The change involves moving the body of newfont() to a new function, makefont(), and having newfont() only initialize the font_number with a special "undefined" value. The macro SET_CURRENT_FONT has become big enough that it has been transformed into a function, setfont(). setfont() now checks font_number for the undefined value, and in such a case, calls makefont() to assign the font a number and create it in the printer. With this change, the TeXbook can be printed successfully. [30-Oct-87] Changed vaxvms.c, gblprocs.h, openfont.h, and machdefs.h to support dynamic determination of the limit on the number of open files for VAX VMS. This is a VMS quota parameter whose dynamic value depends on the number of subprocesses. Previously, a user with too small a limit would find the dvi drivers could fail because the hard limit on the number of open font files was too large. [29-Oct-87] In LW78.C, removed typeout of final CR LF in Get_Msg(), and inserted system call to dismiss the process until the output buffer is empty at the start of Put_Packet(). LW78 had been experiencing I/O error returns from the Apple LaserWriter Plus, and when I attempted to copy a PostScript file directly to the printer, the same thing happened, only much earlier in the job. This raised the suspicion of buffer overrun in the printer. Three experiments using a 100-page document with (1) a 5-second sleep before outputting each buffer, (2) process dismissal until the buffer was empty, and (3) the Kermit TRANSMIT command (which waits for a prompt from the LaserWriter after each line) all resulted in successful printing, and I have confidence that this change in LW78 will provide superior performance. With the new LW78, I sent dvidriver.dvi-alw with the modified BOP and EOP definitions given below, and printed the 100 pages at an average rate of 5 pages per minute. Virtual memory usage was initially 2Kb to 4Kb per page while fonts were being downloaded, and in later pages, dropped to a low of 1105 bytes/page. Pages with that low figure had only text set on them, and no fonts downloaded, with the text guarded by save/restore sequences. That virtual memory was still consumed leads one to wonder if there is not a bug in the PostScript memory allocation code which causes some "seepage" loss. If one of dvialw's macros were leaving unclaimable garbage behind, one would expect that the garbage amount would vary, but many different pages had the same 1105 bytes/page consumption. Total virtual memory consumed by the job was 112Kb, with 78Kb remaining available at end-of-job. [27-Oct-87] Simplified beginning-of-page and end-of-page code in prtpage.h by creating bopact() and eopact() routines in several drivers, and removed bopact.h and eopact.h (which were previously used only by dvibit), including references to them in makefile.*. [27-Oct-87] Numerous small editorial changes for code consistency, and to reduce the number of warnings from the lint utility. [27-Oct-87] {Thanks to John Pavel (mcvax!nplpsg!jrp@uunet.uu.net) for urging this change} On Unix only, Version 2.10 now permits input to come from stdin, and output to go to stdout, allowing use of the drivers as filters. This choice is automatically made when no file names are specified on the command line. Use of stdout for binary files is generally impossible for other operating systems, which either make a distinction between text and binary file formats, or use line terminators other than , necessitating translation of Unix end-of-line '\n' on input and output. With the exception of dvialw, all the drivers produce binary output files. [27-Oct-87] {Thanks to Bernhard Nebel (NEBEL@DB0TUI11.BITNET) for useful suggestions} Completed major overhaul of dvialw.c. A fundamental problem with existing PostScript interpreters is that they lack garbage collection, and the PostScript programmer is expected to manage storage with save/restore command judiciously wrapped around throw-away code. The problem this poses for a TeX environment is that one does not wish to discard downloaded fonts, since they will likely be needed again. In the previous version of dvialw, the -s and -v options provided some user control of this, but such user control is only of marginal utility. It proved interesting to install the following PostScript code segment immediately before the BOJ (beginning of job) command in an output file from dvialw produced from Appendix F of the TeXBook. The TeXbook uses 54 fonts, and therefore puts a sizeable burden on a printer that has only limited font memory. % These provide alternate definitions of BOP and EOP in dvialw.ps % which cause CPU time and virtual memory statistics to be printed % at the bottom of each output page /BOP { clear Mtrx setmatrix 25 0 translate vmstatus pop /VMUSED exch def pop usertime } bdf /EOP { /#copies exch def /USERTIMEIN exch def save /pt {Resolution 72 div mul} def /Helvetica-BoldOblique findfont 12 pt scalefont setfont /SP {12 pt 0 pt rmoveto} def /PN {SP 10 vmstr cvrs show} def /vmstr 15 string def 36 pt 36 pt moveto ([VMstatus:) show vmstatus PN PN PN (]) show SP SP ([VMpage:) show vmstatus pop exch pop VMUSED sub PN (]) show SP SP ([Page time:) show usertime USERTIMEIN sub PN ( msec]) show restore showpage } bdf With this addition, each page now carries both memory usage and (printer) CPU time statistics at the bottom of each page. On the Apple LaserWriter with paper type "note", there is about 250Kb of virtual memory available at job start. Here is a table of the memory requirements for successive pages of Appendix F of the TeXbook: ---- ----------- ----------- Page DVIALW 2.09 DVIALW 2.10 ---- ----------- ----------- 431 4953 432 26057 433 3713 434 9693 435 27948 21101 436 18971 13421 437 15644 10109 438 21764 15324 439 27064 19596 440 8172 6628 ---- ----------- ----------- Version 2.09 reached a VM error condition (virtual memory exhausted) on page 434, while Version 2.10 was able to proceed 4 pages beyond that before hitting the same limit. Each page in Version 2.10 requires about 30% less virtual memory. Initially, I wrote a short filter program that moved the text strings on each page to after the font download sequences, wrapping the text in a save/restore pair to recover the virtual memory needed to store them. This proved to be quite straightforward, requiring only about 60 lines of C code. To implement the same facility in dvialw proved much more complex, because I was not willing to suffer the performance penalty of reading each page of the DVI file twice, once to collect needed fonts, and a second time to set text and rules. Instead, a completely new mechanism is implemented whereby output is channelled through several new routines, which ultimately reach the low-level textchr() routine which gets a single character to process. Based on a global flag, textchr() either outputs this immediately (e.g. for macros, rules, and font downloading), or stores it in an internal buffer (text setting). On the basis of examination of .dvi-alw files for the DVI driver manual, and the TeXbook, the internal buffer is chosen to be large enough so that it will usually only need to be dumped once per page. PostScript loop tests on the Apple LaserWriter Plus (Version 38.0 PostScript) give execution times of about 0.25 msec for one iteration of an empty loop, determined by executing usertime 10000 {} repeat usertime exch sub and 55 msec for one save/restore pair: usertime 1000 {save restore} repeat usertime exch sub Consequently, one does NOT want to do a save/restore around every string, but only around large groups of strings. Because of the use of relative coordinates in most output typeset text (the T macro instead of the S macro), and the use of remembered rule widths (w and h in the B and Q macros), it is not trivial to correctly handle the case of more than one bufferful per page (since intervening non-buffered output might change the font or current point), and it took a considerable number of iterations to get it working satisfactorily, with the buffer size temporarily set artificially low. Having the output being filtered through a central location, textchr(), has made it possible to further economize on the output volume (e.g by collapsing to , and to more closely approach a constant line width (except for PostScript from a \special{} command, which is output verbatim). Some operating systems have trouble with long lines in files, and Version 2.10 should now largely remove this problem. The line breaking algorithm implemented in textchr() and textflush() is far from trivial, because PostScript does not uniformly recognize as a continuation sequence that can be discarded; instead, it permits this continuation mechanism only in parenthesized strings. Otherwise, comments cannot be continued, angle-bracketed strings can be continued by simply inserting a bare newline, and elsewhere, a newline can be used any place a blank is used. Some of the comment lines produced by dvialw are long; they are now split automatically by placing a hyphen in the last column of the line, and continuing with "%-" on the next line. Any software that takes advantage of the %%PageTable at the end will therefore need adjusting (I doubt that any exists, so this change does not concern me). It is regrettable that the PostScript developers did not give line continuation more thought. Font change commands are now defined more compactly as "F#" or "F##", where "#" is the sequential number of the font in the document. This further helps to reduce output volume. The initial font definitions (the NF macro) still use the full name, and carry a comment with the font file name, so it is still possible to easily find out what font file was used for any part of the output. The problem of corrupted font files has come to my attention on several occasions, so it is worthwhile to maintain this connection in dvialw, which is the only driver that produces human-readable printer output. On Appendix F of the TeXbook, these changes reduced the output file size by about 8% compared to Version 2.09, and about 9% when PS_SHORTLINES was non-zero. On the DVI driver manual (99 pages), the file size from Version 2.10 with PS_SHORTLINES defined was 15% shorter than that from Version 2.09. Since a non-zero PS_SHORTLINES produces marginally smaller output, it is now the default for all implementations, but it can be overridden by a compile-time redefinition. [22-Oct-87] {Thanks to Marcus Moehrmann (marcus%fkihh@unido.uucp)} Added drivers dvieps and dvie72 for Epson 9-pin printers and compatibles. dvieps is for 240H x 216V resolution, and dvie72 for 60H x 72V resolution (same as dviprx for Printronix printers). It was necessary to make a number of changes to the submitted code to bring it up-to-date with the rest of the family, and to conform to my coding practices. Since I do not have an Epson printer on which to test this locally, the version number carries the suffix "[experimental]". The same suffix appears in dvica2. These will be removed when the drivers are considered ready for final release, based on positive user feedback. [22-Oct-87] Added debug option 128 (DBG_SET_TEXT) to display each piece of text set by the driver, together with its page coordinates in dots, and its font name. This of course produces voluminous output, but is quite handy when you are trying to step a long way into execution to track down a bug. [22-Oct-87] All debug options have been turned into symbolic references, e.g. if (DBGOPT(DBG_OFF_PAGE)) instead of if (debug_code & 32) It was clearly a mistake not to have done this in the first place. I also wish that I had made these options sequential numbers, instead of powers of two, but it is probably too late to change that now. [12-Oct-87] Edited dviman.texinfo to bring it up-to-date with dvi.1l and dviman.ltx. [01-Oct-87] Created Unix-style man page file, dvi.1l. [01-Oct-87] Added support for a "-z" option (typein of "DVISPOOL dvifilename") for 4.xBSD Unix systems, which have imitated TOPS-20's STI% (Simulate Terminal Input) JSYS facility with ioctl(fildes, TIOCSTI, *char). [30-Sep-87] {Thanks to Stefan Kronberg (ZEFFI@FINABO.BITNET)} Added support of font files with up to 256 characters. Normal TeX Computer Modern fonts use only 128 characters per font, but extensions for European alphabets, and Japanese fonts, will require more than 128. Unfortunately, this was not quite as trivial as I had originally intended, where the values LASTPXLCHAR and NPXLCHARS in gendefs.h need only be increased from 127 and 128 to 255 and 256 respectively. The problem is that several loops used code like BYTE k; ... for (k = FIRSTPXLCHAR; k <= LASTPXLCHAR; ++k) With LASTPXLCHAR = 255, the last loop iteration will increment k to 256, but since it is a byte value, this wraps to 0, and the loop becomes infinite on a byte-oriented machine. This made it necessary to retype the offending loop indices as UNSIGN16. The context diff listing for these changes is rather long (about 1200 lines), so I do not include it here. [30-Sep-87] Changed -d option processing in option.h to allow multiple -d options to accumulate, instead of requiring them to be set with one -d option. The change is simple: replace debug_code = (BYTE)atoi(optstr+2); by debug_code |= (BYTE)atoi(optstr+2); [29-Sep-87] Because of problems on record-oriented file systems (VAX VMS being the worst offender), the code in dvialw.c does more when PS_SHORTLINES is defined; it now keeps track of output widths, and will not produce output lines more than a couple of characters longer than a fixed value, PS_MAXWIDTH. However, no such limit is placed on comments, or macros retrieved from dvialw.ps; both of these are already of limited length. Changed machdefs.h to allow PS_SHORTLINES to be set at compile time. A single experiment on a 20-page DVI file showed that the .dvi-alw output was about 3% longer when a version of dvialw with PS_SHORTLINES set was used. [29-Sep-87] {Thanks to John Pavel (mcvax!nplpsg!jrp@seismo.css.gov) and Brendan McKay (munnari!anucsd.oz!dbm@seismo.css.gov)} The code in dvialw.c in functions setchar() and setstr() emits a save/restore pair around a large character font definition. On the Apple LaserWriter Plus (which I only recently got as a replacement for our stolen ALW), this results in a "Fatal system error @ 0X2e6bec". The fix is fortunately simple. Change those two instances of OUTS("save"); (but NOT the one in special()) to OUTS("save /temporary_font NF 1 /temporary_font SF"); This will put the character in a temporary font which is discarded when the restore command is executed. Here is simple test file using cminch; it produces a large (~400Kb) .dvi-alw file. % test for dvialw downloading of large characters \font\bigfont=cminch This file tests a DVI driver's capability to support downloading of large characters. The following uninteresting tables of the Roman alphabet are printed in font {\it cminch\/}. \bigfont \obeylines ABC DEF GHI JKL MNO PQR STU VWX YZ \vfill\eject\end [29-Sep-87] {Thanks to John Pavel (mcvax!nplpsg!jrp@seismo.css.gov)} Removed obsolete SHORTLINES references from machdefs.h; PS_SHORTLINES remains, and can now be set in machdefs.h, instead of only in dvialw.c. The default setting in machdefs.h now is #define PS_SHORTLINES 0 and dvialw.c now has #ifndef PS_SHORTLINES #define PS_SHORTLINES 0 /* run with long output lines */ #endif [28-Sep-87] Updated all makefiles to include a generic target dvi$(PGM) and an extra compilation flag value XCFLAGS, so test versions can be constructed by a command like "make PGM=foo XCFLAGS=-g dvifoo". [28-Sep-87] {Thanks to Ian Young (ian@latlog.uucp)} At the end of readgf.h, newfont() is called before the loop which retrieves character metrics via chargf(). This is incorrect for HPJETPLUS, where the newfont() code in dvijep.c uses some of the metrics. For the other devices, newfont() only sets values in the font character tables. Therefore, move the newfont() call to AFTER the loop, so that the code reads in readgf.H: for (the_char = FIRSTPXLCHAR; the_char <= LASTPXLCHAR; the_char++) { /* Get remaining character metrics, and ignore error returns for now. */ tcharptr = &(fontptr->ch[the_char]); if (tcharptr->fontrp >= 0L) (void)chargf(the_char,(void(*)())NULL); } #if (BBNBITGRAPH | HPJETPLUS | POSTSCRIPT | IMPRESS | CANON_A2) (void)newfont(); #endif [28-Sep-87] On Unix systems, getlogin() returns (char*)NULL if the process is not attached to a terminal, in particular, if the process is attached to a pseudo-terminal (pty), such as a window or an editor shell buffer. The way to get the real login name in these circumstances is to use cuserid((char*)NULL) in place of getlogin(), and I have according made that change in dvialw.c and lptops.c, and added appropriate function declarations in gblprocs.h. This change affects only text output in a PostScript comment. Both cuserid() and getlogin() are defined in 4.2BSD Unix, AT&T SYS V Unix, HPUX, KCC (version 4), and IEEE Posix (which draft ANSI C follows). PCC and V7 Unix had only getlogin(). VAX VMS C has only cuserid(). KCC (version 3), Microsoft C, Lattice C, and Wizard C have neither. [23-Sep-87] {Version 2.09 announcement} Testing of the Free Software Foundation gcc compiler has uncovered two bugs so far in the compiler (they are being fixed rapidly). gcc produces code for both VAX and Motorola architectures, and is being used to develop the GNU operating system. The testing also found a serious bug in my code which unfortunately impacts most of the DVI drivers, and can be the cause of core dumps or other failures. The value of XSIZE in dvi*.c is currently computed as XDPI*XPSIZE, that is, the number of dots across the page. Unfortunately, one or more local arrays are later allocated and used with the assumption that XSIZE is a multiple of the machine word size, HOST_WORD_SIZE, and in dvijet, it was assumed to be a multiple of 2*HOST_WORD_SIZE. This bug was never caught on the DEC-20, because there stacks grow upward, so beyond-bounds references to stack arrays may just be writing into unused memory. However, on the VAX, Intel iAPX, and Motorola architectures, stacks grow downward, and such references can wipe out the call history, precipitating at best an address exception or illegal instruction violation when the return instruction is executed. This would only happen if text was set against the right-hand side of the page, and since TeX documents usually produce wide margins, this may be unlikely to happen. To avoid complex dimension computations, and preserve uniformity of definition among the family, XSIZE is now increased to a multiple of 2*HOST_WORD_SIZE throughout. The fix is to change #define XSIZE (XDPI*XPSIZE) /* number of horizontal dots */ to #define XSIZE (((XDPI*XPSIZE+2*HOST_WORD_SIZE-1)/\ (2*HOST_WORD_SIZE))*(2*HOST_WORD_SIZE)) /* number of horizontal dots; */ /* MUST BE multiple of */ /* 2*HOST_WORD_SIZE */ in all the dvi*.c files. I view this bug fix to be important enough to warrant a version number change, so the family is now at version 2.09. The following Unix script can be used on Unix systems to automate the patch: #!/bin/csh foreach f (dvi*.c) echo $f mv $f $f-old sed -f bugfix.sed <$f-old >$f end Here is bugfix.sed: s|"2.08|"2.09| s|(XDPI\*XPSIZE)[ ]*/\* number of horizontal dots \*/|(((XDPI*XPSIZE+2*HOST_WORD_SIZE-1)/\\\ (2*HOST_WORD_SIZE))*(2*HOST_WORD_SIZE))\ /* number of horizontal dots; */\ /* MUST BE multiple of */\ /* 2*HOST_WORD_SIZE */| [23-Sep-87] In openfont.h, nopen is incremented when the requested font is not found in the list of currently open files, but the code forgets to decrement it if the request font never gets successfully opened, which can happen if the font file cannot be found, and no substitution font is provided. Change the code about line 185 to decrement nopen on open failure, so that it now reads: if (fontfp == (FILE*)NULL) { --nopen; /* don't count this failed open */ (void)sprintf(message,"Font file [%s [mag %d]] could not be \ [18-Sep-87] In LW78.C, Wait_For_Printer_Ready(), removed output of Ctl-D; with the Apple LaserWriter Plus, this causes the printer to respond to the following Ctl-T with "printer busy", instead of "idle", like the old Apple LaserWriter did. [18-Sep-87] {Thanks to Mic Kaczmarczik (CC.KCACMARCZIK@A20.CC.UTEXAS.EDU)} When dvialw.ps is modified to select LANDSCAPE mode instead of NOTE (portrait), the output is positioned incorrectly, and character bitmaps look somewhat ragged. The former is due to a missing translation command, and the latter to tiny non-zero transformation matrix elements which introduce computed coordinates which are in error by one pixel. I have also taken the liberty of installing a fix for the fact that NOTE is not defined on non-Apple PostScript printers. It should no longer be necessary to edit dvialw.ps for Texas Instruments, QMS, et al PostScript printers. There is one problem with this change, and that is that the SNAP call in the CharBuilder routine must now be executed for each character set on the page, so the output may prove to be somewhat slower. To check this, I downloaded dvialw.ps to our new Apple LaserWriter Plus, then executed TeXdict begin usertime 10000 {0 0 SNAP pop pop} repeat usertime exch sub pstack which results in a time of 70844 msec for 10000 calls, or an extra overhead of 7 msec per character. Repeating the experiment using an empty procedure body gives a loop overhead time of 0.2 msec. With an average of 3000 characters set per page, this amounts to 21 sec per page, which is definitely not negligible. You may therefore wish to leave the SNAP call out of a version of dvialw.ps that is used only for portrait orientation output. Similar timing loops can be used to reveal an average execution time of 1 msec for any arithmetic operation (+-/*); PostScript interpreters badly need hardware floating-point support! There is a repeatable difference of about 10% increase in speed when operands are floating-point instead of integer values. dvialw could be changed to write floating-point values instead of integer ones, with a tradeoff of slightly increased output file size to be balanced against slightly faster arithmetic. At the same time, I increased XPSIZE to 14 in dvialw.c so that landscape mode output is not clipped. Future work should introduce a general flexible solution to the problem of paper size specification for all of the drivers. Here is a context difference which records the changes. Additions are flagged with a "+" in the first column, and changes with a "!", with the old code first, and the new second. *** dvialw.ps-old Wed Jul 29 14:35:41 1987 --- dvialw.ps Fri Sep 18 17:48:10 1987 *************** *** 1,3 **** --- 1,10 ---- + % DVIALW.PS.17, 18-Sep-87 17:48:04, Edit by BEEBE + % Add test for note paper and if unknown, use letter paper instead. + % Non-Apple PostScript implementations do not know about note paper + % but its use on the Apple LaserWriter gains 92K of virtual memory + % DVIALW.PS.16, 18-Sep-87 15:50:52, Edit by BEEBE + % Modify coordinate computations to remove round-off errors + % in landscape mode, and correct landscape page origin % DVIALW.PS.14, 22-Jun-87 09:55:05, Edit by BEEBE % Add missing "0 900 translate Mtrx currentmatrix pop" to /LEGAL % DVIALW.PS.13, 7-Jan-87 17:38:51, Edit by BEEBE *************** *** 110,116 **** /BOJ { 72 Resolution div 72 Resolution div scale ! NOTE % default page format } bdf % BOP -- beginning of page --- 117,126 ---- /BOJ { 72 Resolution div 72 Resolution div scale ! userdict /note known ! {NOTE} % default page format for ALW ! {LETTER} % default page format for others ! ifelse } bdf % BOP -- beginning of page *************** *** 146,151 **** --- 156,162 ---- ch-xoff neg ch-yoff ch-height sub ch-width ch-xoff sub ch-yoff setcachedevice + 0 0 SNAP translate ch-width ch-height true [ 1 0 0 -1 ch-xoff ch-yoff ] {ch-image} imagemask } if *************** *** 185,190 **** --- 196,202 ---- 72 Resolution div dup scale 0 3300 translate -90 rotate + 0 -750 translate Mtrx currentmatrix pop } bdf *************** *** 271,276 **** --- 283,292 ---- % SF -- set new font at scale nnn (nnn = 1 normally; 2 gives double size chars) % Usage -- nnn /fontname SF /SF {findfont exch scalefont setfont} bdf() pop + + % SNAP -- convert coordinates to integer device coordinates and back again + % Usage -- xxx yyy SNAP (leave xxx' yyy' on stack) + /SNAP {transform 2 {floor 0.5 add exch} repeat itransform} bdf % T -- move absolute horizontally and show string, updating horizontal position % to new endpt [08-Sep-87] In lptops.c, change OUTSTR(getlogin()); to if (getlogin() != (char*)NULL) OUTSTR(getlogin()); because getlogin() can sometimes return a null pointer, instead of a null string. [31-Aug-87] {Thanks to HUXTABLE@UKANVAX.BITNET} In gblprocs.h in the ANSI type declarations for dvifile and main, change "char *[0]" to "char *[]". The "[0]" is an odd production of Microsoft C which was used to prepare the type declarations at compile time. It sneaked through the editing (it is not needed for Microsoft C to compile these). VAX VMS C version 2.3-024 now supports ANSI function declaration prototypes; I don't have it up yet. [14-Aug-87] Released Version 2.08 in time for TUG meeting. [14-Aug-87] {Thanks to Matthias Moritz (U608017@NHYKUN11.EARN) for Atari support additions} Merged in support for the Atari 520ST+ using the Mark Williams C Compiler. makefile.ast should build it. Since this involves changes in many routines, I took the opportunity to introduce a few other changes as well, and incremented the version number of dvi*.c from 2.07 to 2.08. The new versions should be functionally identical to the previous ones for virtually everyone. The Mark Williams compiler has some limitations, and could not handle long macro definitions, in particular DEBUG_OPEN and FONTLIST. I have therefore made DEBUG_OPEN() expand to dbgopen(), where the latter is defined at the end of dviinit.h; this does not follow my standard practice of one function per file. FONTLIST was simply removed, and the two instances of its use were replaced by its definition. There are about 40 instances in the driver source code of macros continued over multiple lines. They are written that way to prevent long lines in the source code (80 is the absolute limit), which is an even more serious barrier to portability. The default stacksize on the Atari is often too small; for the time being, main programs have been set to declare a larger stack. On PC DOS (which Atari GEMDOS resembles), the Microsoft EXEMOD utility can be used to change the stacksize of an executable program without requiring code modification. I don't know whether there is something similar on the Atari. I removed the OS_xxxx-dependent conditional code in dvi*.c for output file extension selection, by introduction of a new variable, DVIPREFIX, in machdefs.h. This is prepended to the default file extension, which is now always identical to the letters following dvi in the dvi*.c files. On systems which do not support long file extensions, it will be a null string; otherwise, it will be "dvi-". In dvialw.c, a genuine BUG surfaced; PSDEF_PATH should be #define'd to be subpath instead of SUBPATH. Otherwise, it cannot be overridden by an environment variable. Thanks to Matthias Moritz for catching this one. An experimental version of a Canon A2 driver has been added as dvica2.c, based on work by Pekka Pietilainen (TFYS-PP@FINOU.BITNET), starting from dvican.c. I have merged in his changes and removed Unix-isms. This driver is intentionally not included in the Makefiles. Only a few sites have the Canon A2 printer, and once more experience is obtained, it may replace dvican.c. If you have such a printer, you can easily modify the appropriate Makefile to support it, or you can just compile and load dvica2 manually. For debugging purposes, three additional option switches are accepted in option.h; they will disappear as the code settles. More experience with the drivers at many VAX VMS sites has indicated that variable-length record files for the output are probably undesirable until DEC gets its act in gear and makes all VMS utilities handle such files properly. I have therefore modified the code in dviinit.h to use the fixed-block binary format for all but POSTSCRIPT devices (for which the output is truly an ordinary text file); previously, this format was only selected for IMPRESS (dviimp). For non-Unix operating systems, it is generally necessary to open binary files differently than text files, since the C-runtime libraries use that distinction to decide how to translate Unix line terminators. Every system so far has used the letter "b" in the fopen() mode string to select this mode, and every Unix system ignores the "b", except Ultrix, which raises a run-time error, sigh... I have therefore replaced the mode string by RB_OPEN and WB_OPEN, and they are set in machdefs.h. For all Unix systems they will be "r" and "w", and for most non-Unix systems, "rb" and "wb". Lines longer than 80 characters in *.c and *.h files have been wrapped. The header "%!PS-Adobe-1.0" in dvialw.c has been shortened to "%!"; the Adobe TranScript spooler software thinks it is allowed to do page reversal when it sees this, but dvialw output pages cannot be reordered because fonts are defined only on demand. The similar header in lptops.c is all right; the pages there ARE independent. The sources have been run through 4.2BSD lint and System V lint. A number of missing typecasts have been supplied, and several unreferenced local variables have been eliminated. lint still produces many warnings, but the remaining ones seem to be benign, or simply red herrings. lint revealed numerous problems with texidx.c (which came from the GNU Project). I have eliminated unused variables and functions, but there remain some serious errors of incorrect argument lists to sort_in_core() and sort_offline(). I am not proposing to fix these now, because at least 3 comprehensive indexing packages for TeX have appeared recently, and texidx.c may rapidly become obsolete. I have changed the handling of some preprocessor symbols in several routines so as to eliminate redefinition warnings, and any assumptions that undefined symbols evaluate to 0. The draft ANSI C standard REQUIRES that all undefined symbols evaluate to 0 in preprocessor expressions, but many compilers to do yet follow this rule (VAX VMS C in particular). [15-Aug-87] {Thanks to Julian Perry (seismo!mcvax!zen.co.uk!jules)} The code in option.h in the -o switch section that forced page_begin[npage] <= page_end[npage] conflicts with negative page numbers for counting from the end. I have removed the code there, and then in dvifile.h, before the main page loop, inserted code to reset the page_begin[] and page_end[] arrays to positive values (this can only be done after page_count is known), and to order them properly. [10-Aug-87] {Thanks to Gary Beihl (beihl%bell.cad.mcc.com@mcc.com)} In lw78.c and dvialw.c, change instances of time(0) to time((long*)NULL). [27-Jul-87] {Thanks to Charles Karney (Karney%ppc.mfenet@nmfecc.arpa)} Here are two small changes to vaxvms.c: In vmsexit(), we turn on a high bit on a non-zero status code to suppress a useless VMS message: 150,151c150,151 < exit((1 << 28) + 2); /* error */ < break; /* (suppresses %NONAME-E-NOMSG) */ --- > exit(2); /* error */ > break; 457d456 In system(), add a test for the status code returned by LIB$SPAWN; for the MAKE utility, this allows recognition of errors returned from a compilation. < int stat; 463,464c462 < return ((LIB$SPAWN(&t,0,0,0,0,0,&stat) == SS$_NORMAL) < && ((stat & 1) > 0)) ? 0 : 127; --- > return (LIB$SPAWN(&t) == SS$_NORMAL) ? 0 : 127; [20-Jul-87] Updated cross-referencing awk scripts for use on Sun OS 3.3 using standard cxref utility, replaced old x*.awk by xref, xref1.awk, xref2.awk, and xref3.awk, and replaced dvi.lrf and dvi.rby by dvi.xrf. [20-Jul-87] {Thanks to Eric M. Carroll (Eric.M.Carroll@uunet.uu.net)} In dvialw.c, getlogin() can return a NULL pointer, so we need to guard against that. Change (void)fprintf(plotfp,"%%%%Creator: %s and ",getlogin()); to (void)fprintf(plotfp,"%%%%Creator: %s and ", (getlogin() == (char*)NULL) ? "" : getlogin()); [08-Jul-87] Update makefile.* to reflect new dvil3p, and remove obsolete makefile.eun (for Eunice). [08-Jul-87] Add symbol DECLN03PLUS and change SUBPATH for Unix from /usr/lib/tex/inputs/ to /usr/lib/tex/macros to match Washington TeX distribution. [08-Jul-87] In gblprocs.h, add OS_VAXVMS to the list of hosts where sprintf() is not declared (because it is in system include files). [08-Jul-87] Change type of main() from void to int in gblprocs.h and main.h to bring them into conformance with the draft ANSI C Standard. [08-Jul-87] In fontfile.h, changed VMS section to allow for the possibility that TEXFONTS is a logical name list (thanks for John Sauter for this). [08-Jul-87] {Thanks to John Sauter (Sauter@dssdev.dec.com)} Add dvil3p.c for DEC LN03+ printer. [08-Jul-87] In dvil75.c in prtbmap(), change OUTC('-') to OUTS("-\n") so as to avoid long output lines. [10-Jun-87] Fix several spelling errors: machdefs.h: "you machine" -> "your machine" dvi.hlp: "cmr10.300pxl" -> "cmr10.1500pxl" "setenv VAR=value" -> "setenv VAR value" dviman.ltx: "cmr10.300pxl" -> "cmr10.1500pxl" "setenv VAR=value" -> "setenv VAR value" dviman.texinfo: "cmr10.300pxl" -> "cmr10.1500pxl" "setenv VAR=value" -> "setenv VAR value" [20-May-87] from Brendan Mackay (munnari!anucsd.oz!bdm@seismo.CSS.GOV) In openfont.h, the virtual font section can erroneously reference a null fontfp; change if (virt_font) to if (virt_font && (fontfp != (FILE*)NULL)) and if (virt_font && virt_save[fileno(fp)].base != (char *)NULL) to if (virt_font && (fp != (FILE*)NULL) && (virt_save[fileno(fp)].base != (char *)NULL)) [15-May-87] On line 127 of execute.c in the IBM PC-specific MAKE utility, change *str >= 'A' && *str <= 'A' || to *str >= 'A' && *str <= 'Z' || [29-Apr-87] from Brendan Mackay (munnari!anucsd.oz!bdm@seismo.CSS.GOV) In machdefs.h, change #define REWIND(fp) fseek(fp,0L,0) to #define REWIND(fp) FSEEK(fp,0L,0) This is not necessary for the family as distributed, but Brendan has implemented the virtual font changes necessary for VAX VMS; they should be incorporated in a future release. [29-Apr-87] from Brendan Mackay (munnari!anucsd.oz!bdm@seismo.CSS.GOV) The code for vms_read() [in vaxvms.c] has problems. One is that you don't test for end of file. The other is that there is a bug in the C library which prevents you asking for more than 65535 bytes at a time. It is documented that no more than 65535 bytes will be returned, but not that you can't ask for more. If you do, it reduces your request mod 65536! Here's a replacement: /**********************************************************************/ /*-->READ*/ int READ(file_desc,buffer,nbytes) register int file_desc; register char *buffer; register int nbytes; { register int ngot; register int left; for (left = nbytes; left > 0; /* NOOP */) { ngot = read(file_desc,buffer,(left > 65024 ? 65024 : left)); if (ngot < 0) return (-1); /* error occurred */ if (ngot == 0) /* eof occurred */ return(nbytes-left); buffer += ngot; left -= ngot; } return(nbytes-left); } [15-Apr-87] Completed version 2.07 for general release. [04-Apr-87] to [15-Apr-87] Changed texidx.c to check for special characters in generated \initial{} commands and suitably protect them. Changed dviinit.h to try to open output file and log file in current directory if open in the directory of the .dvi file fails (presumably because no write access to that directory). Adapted loadbmap() code from dvican.c to dvijep.c, and added function declaration in gblprocs.h, finally removing the limitation dvijep had for large font characters. Rearranged some struct members in gblvars.h to ease debugging. Added check in openfont.h for null pfontptr. Updated Makefile's and added ones for KCC, PCC, and VMS. Rewrote 00arit.c to test short, int, and long integer arithmetic. Changed version numbers in dvi*.c from 2.06 to 2.07. Split bopact.h (beginning of page action) out of eopact.h. Rewrote eopact.h to reflect new instant keyboard response and better control over page positioning. Increased value of BIGBGCHAR in dvibit.c to allow large characters to be sent as fonts, rather than bitmaps. There seems to be a bug in BitGraph Version 3.10 which causes characters to be overwritten at the right margin when the actual screen width is used. Reduced value of XSIZE in dvibit.c to fix the problem. Decreased YSIZE in dvibit.c to make space for larger command and status area at top of screen. Added keybrd.c and keydef.h to handle keyboard input. keybrd.c was a major effort (900 lines of code and comments), but now nicely hides the ugliness of instant keyboard input on all the operating systems presently supported in the DVI family. Removed references to Berkeley Unix sgtty.h file and tty structures in dvibit.c and gblvars.h; no longer needed since keybrd.c hides those details. Use JSok instead of JSerr in f20open.h to allow jsys() calls to work for both KCC-20 and PCC-20. Modified character screen clipping decision in setchar() in dvibit.c. Changed raster-op code from 3 to 9 in BBNDPD command in setchar() in dvibit.c so that display is correct with both inverse video and normal video. Split reldfont.h out of readfont.h to support font unloading needed for dvibit zoom commands. Added #include "reldfont.h" to dvi*.c. Removed conditionals around #include statements and put them in the #include'd file instead; this reduces the number of changes needed in the dvi*.c files as new implementations are made. This affects f20open.h, strchr.h, and strrchr.h. Added KCC support changes to dvihead.h, fatal.h, f20open.h, gblprocs.h, machdefs.h, main.h, strchr.h, strrchr.h, texid3.h. Added terminal backslash to lines in multi-line macro invocations in dvijep.c and getbmap.h (KCC restriction). Added new function declarations to gblprocs.h. Changed dimension of message[] in gblvars.h from MAXSTR to MAXMSG; it needs to be larger than MAXSTR in order to hold error messages containing strings of size MAXSTR. MAXMSG is defined in gendefs.h. Updated lptops.c and lw78.c for KCC. Added conditionals to lptops.c to initialize all unset symbols to 0 (KCC requires this), and default to OS_UNIX if no host is defined. Added KCC_20 and DECLA75 symbols to machdefs.h. Changed major DVI command loop in prtpage.h to call kbinput(), bopact(), and eopact() for BBN BitGraph, and changed full screen erase to partial erase to preserve command/status window. In texid3.c, changed short name readln to rdline to remove conflict with KCC library. Added GETCHAR routine to vaxvms.c; this is not needed by the DVI driver family, but the idea was used in keybrd.c. [01-Apr-87] Begin work on Version 2.07 General work: major changes to support new KCC-20 compiler, substantially enhance DVIBIT, and add DVIL75. ======================================================================== [01-Apr-87] End work on Version 2.06: [04-Mar-87] Added declaration of errno in dvihead.h for BSD41 and BSD42; they don't have it in errno.h. [04-Mar-87] Added test for null file pointer before calls to fclose() in abortrun.h and dviterm.h; failure to do so causes core dumps when exit() is entered in 4.1 and 4.2BSD Unix. [27-Feb-87] option.h did not support negative magnifications, like -m-0.5 and -m-1, which was advertised in the documentation, dviman.ltx. Code has now been added to handle that case. Without the fix, it is of course still possible to get any magnification value, since e.g. if -m1500 is the default on a 300 dpi printer, then -m-0.5 is equivalent to -m1369 (1369 = 1500/(1.2**(-0.5))). [26-Feb-87] In dispchar.h, change the line rightones[HOST_WORD_SIZE - 1 - bits_to_next] & to rightones[bits_to_next] & This code is not active for non 32-bit machines, or the IBM PC, and the local 32-bit Unix machines running the driver family have been using only the laser printer members, so the bug was not caught until we actually tried DVIPRX output under VAX VMS. The effect it has is that large vertical white streaks appear in the output bitmap; dispchar() is used by all the low-resolution dot matrix printers. [25-Feb-87] Added code to prtbmap() in dviprx.c to print bitmap in hexadecimal when (debug_code & 1) is non-zero. [21-Feb-87] In prtpage.h, corrected "\special" to "\\special"; this error was caught by the KCC-20 compiler. [10-Feb-87] Yesterday I discovered that VAX VMS 4.4 printf() wipes out the stack and kills the process if a long string is printed. This turns out to be the case in outline() in dvitos.c; the code has been modified to use fputs() there instead. [10-Feb-87] Several debugging sessions on VAX VMS stepping through the call chain fflush() -> _flsbuf() -> _flsbuf_record() -> write_record() -> write_buffer() -> write_imbed() -> write_output() ->signal() -> c$$translate() have made it clear that the simple scheme in dvi*.c and lptops.c of checking for a non-zero return value from fflush() or ferror() is an unreliable way to conclude a legitimate error (specifically, disk storage exhausted) exists. Consequently, these routines have been modified to call clearerr() at the beginning of loadchar() and prtbmap(), then to use a macro DISKFULL() to test for the error condition. DISKFULL() is defined in machdefs.h, and errno.h is now included by dvihead.h. This regrettably introduces small changes in a number of routines, but no other clean way of doing the job appeared to be feasible. [02-Feb-87] Changed "pagecollation on" to "pagecollation off" in dviimp.c. With version 3.3 of the Imagen Image Processor software, there seems to be a bug in that "pagecollation on" causes page reversal. I have reported this to Imagen. [20-Jan-87] Replaced page_xxx[] arguments to sscanf() in option.h with int temporaries p1,p2,p3; the page_xxx[] values are of type INT16 which does not match the %d format items. The use of sscanf() in fontsub() is okay. The one in special() in dvialw.c has the type COORDINATE for the variables llx, lly, urx, ury; the type has been changed to int. This bug surfaced on an HP Unix system with the FOCUS chip; it is disguised on the DEC-20 by virtue of short, int, and long all being one word long, and on the VAX and Intel architectures which address these values by their low-order, rather than high-order, byte (i.e. little Endian order). [16-Jan-87] Corrected error in tosprx.c which resulted in loss of first page, and added test to avoid unnecessary OR'ing zero bits into bitmap. [10-Jan-86] In machdefs.h, reset MAXOPEN to NFILES-6 or less, where NFILES is the limit on the number of open files set in stdio.h. It was previously NFILES-5, which can cause an abort with a message "unable to open error log file" because all file handles are in use. [07-Jan-86] Finished preliminary release of DVICAN for the Canon LBP-8 A2 laser printer. At present, this is forced to send bitmaps for every single typeset character, since the downloaded font mechanism does not work reliably. Canon's documentation is abysmal, and after tearing my hair out staring at hex dumps of the output of many test files, I received a hex dump of a file from a site in Holland using a driver obtained from Japan; to my surprise, they did not use the download mechanism, just bitmaps, so I expect they hit the same problems I did. I intend to try to find out more detailed information from the local Canon dealer--perhaps there is something magic missing. It is indeed suspicious however, when TeX input "ABABABABAB" produces "ABA A A A ", and "A SHORT STORY" produces "A SH RT T Y"--characters apparently randomly (though reproducibly) dropped from the printed page. The penalty for sending bitmaps instead of fonts is severe--on a 15-page test file, it took 10.8 times as many bytes/page as DVIJEP, averaging nearly 95K characters/page, for a throughput of one printed page every 2 to 4 minutes, instead of the 4/minute available from the LaserJet Plus. [20-Dec-86] Updated DVIBIT, fixing several things that had been broken by changes which could not be tested earlier, and improving the interactive interface. End-of-page action in prtpage.h has been expanded and moved out to eopact.h. Warning messages are suppressed for DVIBIT when quiet mode (-q) is selected to avoid needlessly trashing the screen. Default magnification for low-resolution devices changed from 579 (magstep -3 in 200dpi family) to 603 (magstep -5 in 300dpi family). Added run-time selectable virtual font support for performance improvement, particular on networked file systems where the overhead of reading small packets becomes unacceptably large. With .PK fonts, most font files for normal sized text are 4K to 8K bytes, and for SliTeX text, 15K to 20K bytes. With up to 15 fonts open, this probably requires less than 200K bytes of memory, which is available for the non-bitmapped drivers even on my IBM PC. [15-Dec-86] Reorganized machdefs.h to group each set of machine-specific changes inside one conditional for that machine. Removed #undef's--if the compiler warns of redefinitions, that is useful feedback that the right set has been chosen. Completed port to VAX VMS. VMS C has an incomplete library and faulty implementations of fseek(), ftell(), and ungetc(). To get around these, macros FSEEK, FTELL, and UNGETC have been used throughout the code, and machdefs.h will define them to point to special versions found in vaxvms.c in the OS_VAXVMS conditional section. The VMS debugger, particular in screen mode where the source code, output, and debug input are displayed in three windows is excellent, though unnecessarily verbose. VMS C makes memory page 0 inaccessible. This caught two instances of dereferencing of NULL pointers in movedown.h and moveover.h. Logical names for VAX VMS are chosen to match the Kellerman and Smith TeX implementation. DVI and font file formats are assumed to be fixed binary; stream files would be better (since fseek() and ftell() work properly for them, and padding to block boundaries is unnecessary), but their use would require rewriting change files for all the TeXware. [05-Dec-86] In dviinit.h (TOPS-20 and VMS only), fix bug causing referencing of *(NULL + 1). Change "if (isdigit(*(tcp1+1)))" to "if ((tcp1 != (char*)NULL) && isdigit(*(tcp1+1)))" [15-Nov-86] In fontfile.h (bug found Unix conditional code, but could happen if other machines were added), in the loop beginning m = 0; /* index in filelist[] */ for (k = 0; k < MAXFORMATS; ++k) /* loop over possible file types */ { *filelist[k] = '\0'; /* Initially, all filenames are empty */ the filelist[] entry is cleared on each loop iteration, but in the Unix code section, it is actually advancing over two entries at a time. The initialization must be moved out into a separate new loop preceding the old one: for (k = 0; k < MAXFORMATS; ++k) *filelist[k] = '\0'; /* Initially, all filenames are empty */ [13-Nov-86] Update makefile.1, makefile.2, makefile.msc for IBM PC. [13-Nov-86] Add extra library .h file #include's in dvihead.h for IBM PC MICROSOFT C library function declarations. [12-Nov-86] Change malloc to MALLOC in getbmap.h, loadchar.h, machdefs.h, and readfont.h; for IBM PC Microsoft, this is defined to use calloc() instead of malloc() in machdefs.h. This seems to remove a long-standing bug of the driver hanging the machine after printing the last page, presumably while in the free() calls in dviterm(). I made extensive tests on the DEC-20 to try to reproduce this bug, by using DDT to introduce code that initializes the free stack area and malloc()'d memory to values which would cause integer overflow if used as integers, and would cause illegal memory references if used as pointers. No failure could be precipitated by this. On the IBM PC, the symptom was that the driver would run on a freshly-booted machine (booting sets memory to a specific non-zero bit pattern), but if other programs had been run, it would sometimes hang. I found that by using the debugger to preinitialize memory to a fixed bit pattern before running DVIJEP, I could repeatedly run DVIJEP all night long. The change from malloc() to calloc(), which zeroes the returned memory, permitted DVIJEP to run successfully 85 times in a row; when I subsequently reran the old version, it hung the PC. Recent netmail has carried numerous discussions of irregularities of both Lattice and Microsoft C malloc()'s; this may be one more manifestation. [31-Oct-86] Fixed a dumb typo in dvialw.c and dvijep.c; in setstr(), change (void)fprintf(stderr,isprint(c) ? "%c" : "\\%03o",c); to (void)fprintf(stderr,isprint(str[k]) ? "%c" : "\\%03o",str[k]); [24-Oct-86] Whoops! Somehow, warning() lost its code to write its message on stderr as well as the log file. At the end, add the lines NEWLINE(stderr); #if (OS_TOPS20 | OS_VAXVMS) (void)putc('%',stderr); /* percent at start of line */ #endif (void)fputs(msg,stderr); NEWLINE(stderr); if (g_logname[0]) { (void)fprintf(stderr, "Current TeX page counters: [%s]",tctos()); NEWLINE(stderr); } The check of g_logname[0] suppresses an attempt to supply page counters when no .DVI file has yet been opened. [24-Oct-86] If an invalid option is detected in option(), then warning() and/or fatal() will be called. However, there is not yet a file name available for a log file, and g_dolog is initially TRUE, so both warning() and fatal() will abort because the log file cannot be opened. Change the "if (g_dolog ...) statements in fatal.h and warning.h to include the condition "&& g_logname[0]". Since C requires external variables to be initialized to zero, g_logname[0] = '\0' when option() is called, and no attempt will be made to open the log file in warning() and fatal(). [21-Oct-86] For TOPS-20 only, set output and log file generation retention counts to zero, implying all generations will be kept. That way, if the user runs dvixxx for the same file, but with different parameters (-x and -y are good examples), the earlier versions will not be lost. This adds some new flags to machdefs.h, and some additional code to dviinit.h, fatal.h, and warning.h right after their fopen() calls. fopen(,"w+") will reuse an existing file, so we changed the logfile generation to "-1", always giving a new file. [21-Oct-86] In prtpage.h, inserted rule_height = -1; /* reset last rule parameters */ rule_width = -1; before line str_ycp = -1; in POSTSCRIPT section (about line 115) of case BOP. I caught this when I did `dvialw foo.dvi.*' today-- after the first file, the PostScript output contained a reference to the Q macro before a B had been issued to define h and w, the previous bar dimensions. [13-Oct-86] Added -d32 option to cause display of all truncated off-page text strings. This was prompted by my wasting time looking for what I thought was a bug in setstr() with long strings. Changes in functions setstr() and setchar() in dvialw.c and dvijep.c, and setchar.h, as well as documentation in dviman.ltx and dviman.texinfo. [15-Sep-86] Added -z option for PostScript and HP LaserJet Plus on TOPS-20 only; this types in a command "DVISPOOL: dvifilename\n", permitting the user to define a spooler for the DVI file. This typein is not automatic as in TOPS-20 TeX, because it may interfere with batch and .mic files; however, the final newline is supplied, because it is assumed the user wanted it if the option switch was given. Changes in dviterm.h, gblvars.h, option.h, and usage.h, with new BOOLEAN global variable "spool_output". [15-Sep-86] Added page_step[] to allow printing pages in steps other 1, such as for duplex printing, and option -obeginpage:endpage:steppage; this required changes in dvifile.h, gblvars.h, main.h, option.h, and usage.h. [09-Sep-86] Changed checksum error message in readgf.h, readpk.h, and readpxl.h to output checksums in octal and hexadecimal as well as decimal, and explain why the mismatch is likely to have occurred. Changed debug_code to debug_code & 4 in dvijep.c, and updated dviman.ltx to define settings of -d# option for selective debug output. Added DEBUG_OPEN() calls to dvialw.c, dviinit.h, fatal.h, fontsub.h, openfont.h, and warning.h, and definition of DEBUG_OPEN() to gendefs.h. Delete doubled word in comment in charpk.h. Insert typecast in fillrect.h: *p = (UNSIGN32)ONES. Insert typecast in dvibit.c: tcharptr->istoobig = ((int)(tcharptr->hp* ((tcharptr->wp+15) >> 4)) >= BIGBGCHAR); Change macro argument c to ch in dvijep.c (Microsoft C version 4.0 otherwise thinks that the c in the format specification is to be expanded too): #define SETCHARCODE(fontnumber,ch) {\ if (fontnumber)\ (void)fprintf(plotfp,"\033*c%dd%dE",fontnumber,MAPCHAR(ch));\ else\ (void)fprintf(plotfp,"\033*cd%dE",MAPCHAR(ch));\ } [04-Sep-86] Fixed handling of -o-# in option.h; I forgot to check for signs in skipping the number. [28-Aug-86] Wrote errshow.c; it is a filter which merges the error message file output by Microsoft C with a copy of the source line causing the error message. [28-Aug-86] Minor changes for type matching. Added typecasts in chargf.h, charpk.h, dvialw.c, and dvijep.c. Changed type declarations of m_begin, m_end, m_step in dvitype.h, of k in fontfile.h, and of fontfile() arguments in gblprocs.h. Added code for IBM_PC_MICROSOFT to include stdlib.h and string.h in main.h. Version 3.0 of Microsoft C has a number of errors and inconsistencies in the library file type declarations for stdio.h and string.h. I fixed declarations and use of putc(), putchar(), fileno(), _flsbuf(), thereby eliminating "strong type mismatch" errors on every instance of use of these functions. Declarations of argument types for strxxx() have int instead of char, and unsigned int instead of int, for strchr(), strlen(), strrchr(), strncpy(), strncat(), and strncmp(), which is at variance with Kernighan & Ritchie, and with Harbison & Steele, so use of these still gives type mismatch errors. I am not fixing the library file declarations pending seeing what Version 4.0 has to offer, and what the ANSI C Standard committee does with them. [21-Aug-86] Add -e option in option.h for run-time command-line definition of ``environment'' variables, and move initialization of xx_index out of initglob() into dvifile(). This was prompted by the use of Unix server invocations of the drivers through calls to ``system("dvixxx filename")''. Such a call creates a new shell which, although it inherits the caller's environment, may in fact require different environment variables, especially for things like FONTLIST and TEXFONTS. [21-Aug-86] Change fontlist.h, gendefs.h, and openfont.h to support a more general mechanism of font file name generation. fontlist() now returns a list of pointers to a series of possible font file names; the first null string in the list terminates it. The Unix and VAX VMS code sections in fontlist.h now generate names with the magnification both in the directory name as well as in the extension. This was prompted by a local need at Utah with some networked Unix workstations which have both flavors of font file storage. [21-Aug-86] Change handling of TeX \countn values to INT32, instead of UNSIGN32; roman-numeral pages come out with negative page numbers in PLAIN.TEX. This affects the declaration and use of tex_counters[] in dviinit.h, gblvars.h, prtpage.h, and tctos.h. [18-Aug-86] Allow negative page numbers on -o#:# switch to mean pages from end (-1 = last, -2 = next to last, etc.). sscanf() format change in option(), and introduce PAGENUMBER() macro in dvifile(). [15-Aug-86] Conversion of the font magnification factor for *.*pxl files in fontfile.h to dots/inch for the *.*gf and *.*pk files forgot to round up. Thus, mag 1643 became 328 instead of 329. Because fontfile() gets a truncated magnification value, the rounding is non-trivial; comments in fontfile() describe what is necessary. ; Local Modes: ; Mode:Text ; Comment Column:0 ; Auto Fill Mode:1 ; Fill Column:65 ; Fill Prefix:" " ; Indent Tabs Mode:0 ; End: