summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/cpascal.h
diff options
context:
space:
mode:
authorPeter Breitenlohner <peb@mppmu.mpg.de>2012-02-06 14:51:33 +0000
committerPeter Breitenlohner <peb@mppmu.mpg.de>2012-02-06 14:51:33 +0000
commit28d6df0334340cc773572c1c4897bdc640d5423a (patch)
tree6e52cce35b8d4b8ff25904ba0a8826ed9a2ebc62 /Build/source/texk/web2c/cpascal.h
parentedcc5909521192431cf3dc89feada0b78a307c22 (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/cpascal.h')
-rw-r--r--Build/source/texk/web2c/cpascal.h15
1 files changed, 12 insertions, 3 deletions
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)