diff options
author | Peter Breitenlohner <peb@mppmu.mpg.de> | 2012-02-06 14:51:33 +0000 |
---|---|---|
committer | Peter Breitenlohner <peb@mppmu.mpg.de> | 2012-02-06 14:51:33 +0000 |
commit | 28d6df0334340cc773572c1c4897bdc640d5423a (patch) | |
tree | 6e52cce35b8d4b8ff25904ba0a8826ed9a2ebc62 /Build/source/texk/web2c | |
parent | edcc5909521192431cf3dc89feada0b78a307c22 (diff) |
GFtoDVI: write DVI file with error checking (as in TeX)
git-svn-id: svn://tug.org/texlive/trunk@25318 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c')
-rw-r--r-- | Build/source/texk/web2c/ChangeLog | 8 | ||||
-rw-r--r-- | Build/source/texk/web2c/cpascal.h | 15 | ||||
-rw-r--r-- | Build/source/texk/web2c/gftodvi.ch | 8 | ||||
-rw-r--r-- | Build/source/texk/web2c/luatexdir/ChangeLog | 4 | ||||
-rw-r--r-- | Build/source/texk/web2c/luatexdir/luatex.h | 8 | ||||
-rw-r--r-- | Build/source/texk/web2c/texmfmp.h | 8 | ||||
-rw-r--r-- | Build/source/texk/web2c/web2c/ChangeLog | 7 | ||||
-rw-r--r-- | Build/source/texk/web2c/web2c/common.defines | 2 | ||||
-rw-r--r-- | Build/source/texk/web2c/web2c/texmf.defines | 1 |
9 files changed, 37 insertions, 24 deletions
diff --git a/Build/source/texk/web2c/ChangeLog b/Build/source/texk/web2c/ChangeLog index 9bfd0594720..c84f5f320d9 100644 --- a/Build/source/texk/web2c/ChangeLog +++ b/Build/source/texk/web2c/ChangeLog @@ -1,3 +1,11 @@ +2012-02-06 Peter Breitenlohner <peb@mppmu.mpg.de> + + * texmfmp.h: Moved WRITE_OUT from here ... + * cpascal.h: ... to here for use in GFtoDVI. + + * gftodvi.ch (write_dvi): Done in C as for TeX. + * cpascal.h: Drop writechunk, GFtoDVI now uses writedvi. + 2012-02-04 Peter Breitenlohner <peb@mppmu.mpg.de> * vftovp.ch: Allow arbitrarily large TFM files as in TFtoPL. diff --git a/Build/source/texk/web2c/cpascal.h b/Build/source/texk/web2c/cpascal.h index ce83bc53be3..c9717f28c1a 100644 --- a/Build/source/texk/web2c/cpascal.h +++ b/Build/source/texk/web2c/cpascal.h @@ -144,9 +144,18 @@ typedef FILE *text; typedef unsigned char *pointertobyte; #define casttobytepointer(e) ((pointertobyte) e) -/* Write out elements START through END of BUF to the file F. For gftodvi. */ -#define writechunk(f, buf, start, end) \ - (void) fwrite (&buf[start], sizeof (buf[start]), end - start + 1, f) +/* How to output to the GF or DVI file. */ +#define WRITE_OUT(a, b) \ + if ((size_t) fwrite ((char *) &OUT_BUF[a], sizeof (OUT_BUF[a]), \ + (size_t) ((size_t)(b) - (size_t)(a) + 1), OUT_FILE) \ + != (size_t) ((size_t) (b) - (size_t) (a) + 1)) \ + FATAL_PERROR ("fwrite"); + +#ifdef GFTODVI +#define writedvi WRITE_OUT +#define OUT_FILE dvifile +#define OUT_BUF dvibuf +#endif /* PatGen 2 uses this. */ #define input2ints(a,b) zinput2ints (&a, &b) diff --git a/Build/source/texk/web2c/gftodvi.ch b/Build/source/texk/web2c/gftodvi.ch index 3a523ec8163..5e0092cee7c 100644 --- a/Build/source/texk/web2c/gftodvi.ch +++ b/Build/source/texk/web2c/gftodvi.ch @@ -468,11 +468,9 @@ var k:dvi_index; begin for k:=a to b do write(dvi_file,dvi_buf[k]); end; @y -In C, we can write out the entire array with one call. -@p procedure write_dvi(@!a,@!b:dvi_index); -begin - write_chunk (dvi_file, dvi_buf, a, b); -end; +In C, we use a macro to call |fwrite| or |write| directly, writing all +the bytes in one shot. Much better even than writing four +bytes at a time. @z @x [108] dvi_swap: check dvi file size diff --git a/Build/source/texk/web2c/luatexdir/ChangeLog b/Build/source/texk/web2c/luatexdir/ChangeLog index e0e43e8d65c..65e5bd6e9bc 100644 --- a/Build/source/texk/web2c/luatexdir/ChangeLog +++ b/Build/source/texk/web2c/luatexdir/ChangeLog @@ -1,3 +1,7 @@ +2012-02-06 Peter Breitenlohner <peb@mppmu.mpg.de> + + * luatex.h: Remove definition of WRITE_OUT, now in ../cpascal.h. + 2012-01-18 Peter Breitenlohner <peb@mppmu.mpg.de> * image/writejbig2.w (getstreamlen): Change type to `off_t'. diff --git a/Build/source/texk/web2c/luatexdir/luatex.h b/Build/source/texk/web2c/luatexdir/luatex.h index b933237dfce..f10165aa8ee 100644 --- a/Build/source/texk/web2c/luatexdir/luatex.h +++ b/Build/source/texk/web2c/luatexdir/luatex.h @@ -90,13 +90,7 @@ extern void ipcpage(int); # endif /* IPC */ -/* How to output to the GF or DVI file. */ -# define WRITE_OUT(a, b) \ - if (fwrite ((char *) &OUT_BUF[a], sizeof (OUT_BUF[a]), \ - (int) ((b) - (a) + 1), OUT_FILE) \ - != (int) ((b) - (a) + 1)) \ - FATAL_PERROR ("fwrite"); - +/* How to flush the DVI file. */ # define flush_out() fflush (OUT_FILE) /* Read a line of input as quickly as possible. */ diff --git a/Build/source/texk/web2c/texmfmp.h b/Build/source/texk/web2c/texmfmp.h index e40a6169dde..02510f70673 100644 --- a/Build/source/texk/web2c/texmfmp.h +++ b/Build/source/texk/web2c/texmfmp.h @@ -174,13 +174,7 @@ extern void ipcpage (int); #endif /* IPC */ #endif /* TeX */ -/* How to output to the GF or DVI file. */ -#define WRITE_OUT(a, b) \ - if ((size_t) fwrite ((char *) &OUT_BUF[a], sizeof (OUT_BUF[a]), \ - (size_t) ((size_t)(b) - (size_t)(a) + 1), OUT_FILE) \ - != (size_t) ((size_t) (b) - (size_t) (a) + 1)) \ - FATAL_PERROR ("fwrite"); - +/* How to flush the DVI file. */ #define flush_out() fflush (OUT_FILE) /* Used to write to a TFM file. */ diff --git a/Build/source/texk/web2c/web2c/ChangeLog b/Build/source/texk/web2c/web2c/ChangeLog index a5b011a9294..b2f709262d5 100644 --- a/Build/source/texk/web2c/web2c/ChangeLog +++ b/Build/source/texk/web2c/web2c/ChangeLog @@ -1,3 +1,10 @@ +2012-02-06 Peter Breitenlohner <peb@mppmu.mpg.de> + + * texmf.defines: Moved writedvi from here ... + * common.defines: ... to here for use in GFtoDVI. + + * common.defines: Drop writechunk, GFtoDVI now uses writedvi. + 2012-01-09 Peter Breitenlohner <peb@mppmu.mpg.de> * fixwrites.c: Replace 'fprintf(filename, "%c\n", char);' by diff --git a/Build/source/texk/web2c/web2c/common.defines b/Build/source/texk/web2c/web2c/common.defines index a635025e816..3e86f6b9efa 100644 --- a/Build/source/texk/web2c/web2c/common.defines +++ b/Build/source/texk/web2c/web2c/common.defines @@ -192,7 +192,7 @@ @define procedure uexit (); @define procedure vgetc (); @define procedure write (); -@define procedure writechunk (); +@define procedure writedvi (); @define procedure writeln (); @define procedure xfclose (); @define procedure xfseek (); diff --git a/Build/source/texk/web2c/web2c/texmf.defines b/Build/source/texk/web2c/web2c/texmf.defines index 1d846976b88..bb7081c63a6 100644 --- a/Build/source/texk/web2c/web2c/texmf.defines +++ b/Build/source/texk/web2c/web2c/texmf.defines @@ -68,7 +68,6 @@ @define procedure updatescreen; @define procedure wakeupterminal; @define procedure wclose (); -@define procedure writedvi (); @define procedure writegf (); @define type fourquarters; |