texlive[56299] Build/source/texk/seetexk: dvibook, dvitodvi: remove
commits+karl at tug.org
commits+karl at tug.org
Tue Sep 8 23:36:38 CEST 2020
Revision: 56299
http://tug.org/svn/texlive?view=revision&revision=56299
Author: karl
Date: 2020-09-08 23:36:37 +0200 (Tue, 08 Sep 2020)
Log Message:
-----------
dvibook, dvitodvi: remove fixed limit of 1000 pages
Modified Paths:
--------------
trunk/Build/source/texk/seetexk/ChangeLog
trunk/Build/source/texk/seetexk/dvibook.c
trunk/Build/source/texk/seetexk/dvibook.man
trunk/Build/source/texk/seetexk/dvitodvi.c
trunk/Build/source/texk/seetexk/dvitodvi.man
Modified: trunk/Build/source/texk/seetexk/ChangeLog
===================================================================
--- trunk/Build/source/texk/seetexk/ChangeLog 2020-09-08 21:07:59 UTC (rev 56298)
+++ trunk/Build/source/texk/seetexk/ChangeLog 2020-09-08 21:36:37 UTC (rev 56299)
@@ -1,3 +1,14 @@
+2020-09-08 Karl Berry <karl at freefriends.org>
+
+ * dvitodvi.man,
+ * dvibook.man: insert date, mention maintained as part of TL.
+
+2020-05-01 Manuel Stoeckl <texlive at mstoeckl.com>
+
+ * dvitodvi.c,
+ * dvibook.c (MAXDVIPAGES): remove; dynamically allocate.
+ https://tug.org/pipermail/tex-live/2020-September/046051.html
+
2020-05-01 TANAKA Takuji <ttk at t-lab.opal.ne.jp>
* configure.ac: SeeTeX Ver.20200501
Modified: trunk/Build/source/texk/seetexk/dvibook.c
===================================================================
--- trunk/Build/source/texk/seetexk/dvibook.c 2020-09-08 21:07:59 UTC (rev 56298)
+++ trunk/Build/source/texk/seetexk/dvibook.c 2020-09-08 21:36:37 UTC (rev 56299)
@@ -1,4 +1,4 @@
-/* Copyright (c) 1987, 1989, 2012 University of Maryland Department of
+/* Copyright (c) 1987, 1989, 2012, 2020 University of Maryland Department of
Computer Science.
Permission is hereby granted, free of charge, to any person obtaining
@@ -60,8 +60,6 @@
#define white(x) ((x) == ' ' || (x) == '\t' || (x) == ',')
-#define MAXDVIPAGES 1000 /* max (absolute) pages in DVI file */
-
char *ProgName;
/* Globals */
@@ -100,8 +98,8 @@
FILE *inf; /* the input file itself */
FILE *outf; /* the output DVI file */
-long StartOfPage[MAXDVIPAGES]; /* The file positions of the
- input pages */
+long *StartOfPage; /* The file positions of the input pages */
+long StartOfPageSpace; /* Number of entries of StartOfPage array */
long StartOfLastPage; /* The file position just before we
started the last page */
@@ -126,7 +124,8 @@
char writeerr[] = "error writing DVI file";
#ifndef KPATHSEA
-char *malloc(), *realloc();
+void *malloc(), *realloc();
+void free();
#endif
/*
* You may get lint warnings about sprintf's return value.
@@ -519,6 +518,12 @@
#endif
InputPageNumber = 0;
StartOfLastPage = -1;
+ StartOfPageSpace = 32;
+ StartOfPage = malloc(sizeof(long) * StartOfPageSpace);
+ if (!StartOfPage) {
+ error(1, -1, "cannot allocate list of pages; out of memory");
+ }
+
HandlePreAmble();
ScanDVIFile();
#ifdef ASCIIPTEX
@@ -527,6 +532,7 @@
else
#endif
HandleDVIFile();
+ free(StartOfPage);
HandlePostAmble();
if (!SFlag)
(void) fprintf(stderr, "\nWrote %d page%s, %ld bytes\n",
@@ -730,11 +736,23 @@
static void
ScanDVIFile(void)
{
+ long *tmp;
+
UseThisPage = 0;
StartOfPage[InputPageNumber] = ftell(inf);
while (HandlePage()) { /* scan DVI file */
- StartOfPage[++InputPageNumber] = ftell(inf);
+ ++InputPageNumber;
+ if (InputPageNumber >= StartOfPageSpace) {
+ StartOfPageSpace *= 2;
+ tmp = realloc(StartOfPage, sizeof(long) * StartOfPageSpace);
+ if (!tmp) {
+ error(1, -1, "cannot grow list of pages; out of memory");
+ }
+ StartOfPage = tmp;
+ }
+
+ StartOfPage[InputPageNumber] = ftell(inf);
}
}
Modified: trunk/Build/source/texk/seetexk/dvibook.man
===================================================================
--- trunk/Build/source/texk/seetexk/dvibook.man 2020-09-08 21:07:59 UTC (rev 56298)
+++ trunk/Build/source/texk/seetexk/dvibook.man 2020-09-08 21:36:37 UTC (rev 56299)
@@ -1,6 +1,6 @@
-.\" Copyright (c) 1987-2012 UMD-CS, released under the X11 license;
+.\" Copyright (c) 1987-2020 UMD-CS, released under the X11 license;
.\" see README and source files.
-.TH DVIBOOK 1
+.TH DVIBOOK 1 "8 September 2020" "TeX Live"
.SH NAME
dvibook \- rearrange pages in DVI file into signatures
.SH SYNOPSIS
@@ -48,13 +48,12 @@
option suppresses this.
.SH AUTHOR
Angus Duggan, from dviselect(1), by
-Chris Torek, University of Maryland
+Chris Torek, University of Maryland. Currently maintained as part
+of TeX Live (https://tug.org/texlive).
.SH "SEE ALSO"
-dviconcat(1), dviselect(1), latex(1), tex(1)
+dvitodvi(1), dviconcat(1), dviselect(1), latex(1), tex(1)
.br
.I "MC-TeX User's Guide"
-.br
-.I "The TeXbook"
.SH BUGS
.I Dvibook
does not adjust the parameters in the postamble; however, since these
Modified: trunk/Build/source/texk/seetexk/dvitodvi.c
===================================================================
--- trunk/Build/source/texk/seetexk/dvitodvi.c 2020-09-08 21:07:59 UTC (rev 56298)
+++ trunk/Build/source/texk/seetexk/dvitodvi.c 2020-09-08 21:36:37 UTC (rev 56299)
@@ -1,4 +1,4 @@
-/* Copyright (c) 1987, 1989, 2012 University of Maryland Department of
+/* Copyright (c) 1987, 1989, 2012, 2020 University of Maryland Department of
Computer Science.
Permission is hereby granted, free of charge, to any person obtaining
@@ -60,8 +60,6 @@
#define white(x) ((x) == ' ' || (x) == '\t' || (x) == ',')
-#define MAXDVIPAGES 1000 /* max (absolute) pages in DVI file */
-
char *ProgName;
/* Globals */
@@ -105,8 +103,8 @@
FILE *inf; /* the input file itself */
FILE *outf; /* the output DVI file */
-long StartOfPage[MAXDVIPAGES]; /* The file positions of the
- input pages */
+long *StartOfPage; /* The file positions of the input pages */
+long StartOfPageSpace; /* Number of entries of StartOfPage array */
long StartOfLastPage; /* The file position just before we
started the last page */
@@ -131,7 +129,8 @@
/* save some string space: we use this a lot */
char writeerr[] = "error writing DVI file";
#ifndef KPATHSEA
-char *malloc(), *realloc();
+void *malloc(), *realloc();
+void free();
#endif
static void WriteFont(struct fontinfo *fi);
@@ -739,7 +738,13 @@
ptexdvi = 0;
#endif
InputPageNumber = 0;
+ StartOfPageSpace = 32;
StartOfLastPage = -1;
+ StartOfPage = malloc(sizeof(long) * StartOfPageSpace);
+ if (!StartOfPage) {
+ error(1, -1, "cannot allocate list of pages; out of memory");
+ }
+
HandlePreAmble();
ScanDVIFile();
if (fseek(inf, 16L, 1) == -1)
@@ -753,6 +758,7 @@
PageSpecs = ParseSpecs(specstring, 1);
HandleDVIFile();
+ free(StartOfPage);
if (WritingPage)
EndPage(1);
HandlePostAmble();
@@ -1186,11 +1192,23 @@
static void
ScanDVIFile(void)
{
+ long *tmp;
+
UseThisPage = 0;
StartOfPage[InputPageNumber] = ftell(inf);
while (HandlePage(0, 0, 0, 0)) { /* scan DVI file */
- StartOfPage[++InputPageNumber] = ftell(inf);
+ ++InputPageNumber;
+ if (InputPageNumber >= StartOfPageSpace) {
+ StartOfPageSpace *= 2;
+ tmp = realloc(StartOfPage, sizeof(long) * StartOfPageSpace);
+ if (!tmp) {
+ error(1, -1, "cannot grow list of pages; out of memory");
+ }
+ StartOfPage = tmp;
+ }
+
+ StartOfPage[InputPageNumber] = ftell(inf);
}
}
Modified: trunk/Build/source/texk/seetexk/dvitodvi.man
===================================================================
--- trunk/Build/source/texk/seetexk/dvitodvi.man 2020-09-08 21:07:59 UTC (rev 56298)
+++ trunk/Build/source/texk/seetexk/dvitodvi.man 2020-09-08 21:36:37 UTC (rev 56299)
@@ -1,6 +1,6 @@
-.\" Copyright (c) 1987-2013 UMD-CS, released under the X11 license;
+.\" Copyright (c) 1987-2020 UMD-CS, released under the X11 license;
.\" see README and source files.
-.TH DVITODVI 1
+.TH DVITODVI 1 "8 September 2020" "TeX Live"
.SH NAME
dvitodvi \- rearrange pages in a DVI file
.SH SYNOPSIS
@@ -128,13 +128,12 @@
.sp
.SH AUTHOR
Angus Duggan, from dviselect(1), by
-Chris Torek, University of Maryland
+Chris Torek, University of Maryland. Currently maintained as part
+of TeX Live (https://tug.org/texlive).
.SH "SEE ALSO"
-dviconcat(1), dvibook(1), dviselect(1), latex(1), tex(1)
+dvibook(1), dviconcat(1), dviselect(1), latex(1), tex(1)
.br
.I "MC-TeX User's Guide"
-.br
-.I "The TeXbook"
.SH BUGS
.I Dvitodvi
does not adjust some of the parameters in the postamble. This may be a problem
More information about the tex-live-commits
mailing list.