From 3dab9e16d83abdc20d094081ffc6a536ba1089e0 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 6 May 2007 17:24:27 +0000 Subject: improvements to ps fonts as headers, from Akira git-svn-id: svn://tug.org/texlive/trunk@4252 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/dvipsk/ChangeLog | 6 ++++++ Build/source/texk/dvipsk/download.c | 7 ++++--- Build/source/texk/dvipsk/dvips.c | 35 ++++++++++++++++++++++++++--------- Build/source/texk/dvipsk/finclude.c | 12 ++++++------ 4 files changed, 42 insertions(+), 18 deletions(-) (limited to 'Build/source') diff --git a/Build/source/texk/dvipsk/ChangeLog b/Build/source/texk/dvipsk/ChangeLog index 773a00a6e7b..8063cfc2fc8 100644 --- a/Build/source/texk/dvipsk/ChangeLog +++ b/Build/source/texk/dvipsk/ChangeLog @@ -1,3 +1,9 @@ +2007-05-06 Karl Berry + + * finclude.c, dvips.c: keep track of last-unused psname (Akira). + * dvips.c (DEFRES): move down. + * dvips.c (--help): just mention Tom R. + 2007-05-05 Karl Berry * dvips.h (DOWNLOADEDPSSIZE): new constant. diff --git a/Build/source/texk/dvipsk/download.c b/Build/source/texk/dvipsk/download.c index 02e01f1bf54..dba78211f6c 100644 --- a/Build/source/texk/dvipsk/download.c +++ b/Build/source/texk/dvipsk/download.c @@ -433,7 +433,8 @@ static void addGlyph(char *glyphName) { * Download a PostScript font, using partial font downloading if * necessary. */ -extern char *downloadedpsname[]; +extern char *downloadedpsnames[]; +extern int unused_top_of_psnames; void downpsfont P2C(charusetype *, p, charusetype *, all) { @@ -461,8 +462,8 @@ void downpsfont P2C(charusetype *, p, charusetype *, all) return ; if (rf->sent == 2) /* sent as header, from a PS file */ return ; - for (j=0; downloadedpsname[j] && j < DOWNLOADEDPSSIZE; j++) { - if (strcmp (downloadedpsname[j], rf->PSname) == 0) + for (j=0; downloadedpsnames[j] && j < unused_top_of_psnames; j++) { + if (strcmp (downloadedpsnames[j], rf->PSname) == 0) return; } if (all->fd == 0) diff --git a/Build/source/texk/dvipsk/dvips.c b/Build/source/texk/dvipsk/dvips.c index 9f78ccbced7..c01681b9709 100644 --- a/Build/source/texk/dvipsk/dvips.c +++ b/Build/source/texk/dvipsk/dvips.c @@ -1,10 +1,6 @@ /* * This is the main routine. */ -#ifndef DEFRES -#define DEFRES (600) -#endif - #include "dvips.h" /* The copyright notice there is included too! */ #ifdef KPATHSEA #include @@ -44,13 +40,22 @@ extern char *strtok() ; /* some systems don't have this in strings.h */ #include descrip #endif #endif + +#ifndef DEFRES +#define DEFRES (600) +#endif + /* * First we define some globals. */ #ifdef VMS static char ofnme[252],infnme[252],pap[40],thh[20]; #endif -char *downloadedpsname[DOWNLOADEDPSSIZE]; /* PS names fully downloaded as headers */ + +/* PS fonts fully downloaded as headers */ +char *downloadedpsnames[DOWNLOADEDPSSIZE]; + +int unused_top_of_psnames ; /* unused top number of downloadedpsnames[#] */ fontdesctype *fonthead ; /* list of all fonts mentioned so far */ fontdesctype *curfnt ; /* the currently selected font */ sectiontype *sections ; /* sections to process document in */ @@ -308,6 +313,16 @@ help P1C(int, status) fputs (kpse_bug_address, f); #endif } + +void +freememforpsnames(void) +{ + int i; + + for (i = 0; i < unused_top_of_psnames && downloadedpsnames[i]; i++) + free (downloadedpsnames[i]); +} + /* * This error routine prints an error message; if the first * character is !, it aborts the job. @@ -330,6 +345,7 @@ error_with_perror P2C(char *, s, char *, fname) } if (*s=='!') { + freememforpsnames() ; if (bitfile != NULL) { cleanprinter() ; } @@ -442,6 +458,8 @@ initialize P1H(void) i = 10; for (s="abcdef"; *s!=0; s++) xdig[(int)*s] = i++; + for(i=0 ; i < DOWNLOADEDPSSIZE; i++) + downloadedpsnames[i] = NULL; morestrings() ; maxpages = 100000 ; numcopies = 1 ; @@ -554,10 +572,8 @@ main P2C(int, argc, char **, argv) #ifdef MVSXA int firstext = -1 ; #endif - register sectiontype *sects ; + sectiontype *sects ; - for(i=0 ; i < DOWNLOADEDPSSIZE; i++) - downloadedpsname[i] = NULL; #ifdef KPATHSEA kpse_set_program_name (argv[0], "dvips"); kpse_set_program_enabled (kpse_pk_format, MAKE_TEX_PK_BY_DEFAULT, kpse_src_compile); @@ -619,7 +635,7 @@ under the terms of the GNU General Public License\n\ and the Dvips copyright.\n\ For more information about these matters, see the files\n\ named COPYING and dvips.h.\n\ -Primary author of Dvips: T. Rokicki; -k maintainer: T. Kacvinsky/ S. Rahtz."); +Primary author of Dvips: T. Rokicki."); exit (0); } if (argc == 2 && strncmp(argv[1], "-?", 2) == 0) { @@ -1391,6 +1407,7 @@ default: } } } + freememforpsnames() ; if (! sepfiles) { #ifdef HPS if (HPS_FLAG) diff --git a/Build/source/texk/dvipsk/finclude.c b/Build/source/texk/dvipsk/finclude.c index 8e902f0c265..f76d2da52a3 100644 --- a/Build/source/texk/dvipsk/finclude.c +++ b/Build/source/texk/dvipsk/finclude.c @@ -57,7 +57,8 @@ extern int to_close ; extern integer debug_flag; #endif /* DEBUG */ -extern char *downloadedpsname[]; +extern char *downloadedpsnames[]; +extern int unused_top_of_psnames; /* * Create a font descriptor for a font included in a psfile. There will be @@ -256,7 +257,7 @@ scan_fontnames P2C(char *, str, char *, psfile) int i; int j = 0; - while (downloadedpsname[j] != NULL && j < DOWNLOADEDPSSIZE) + while (downloadedpsnames[j] != NULL && j < DOWNLOADEDPSSIZE) j++; /* Turn all newlines, CRs, and tabs into spaces. */ @@ -318,10 +319,9 @@ scan_fontnames P2C(char *, str, char *, psfile) infont = 0 ; } re->sent = 2 ; - if (j < DOWNLOADEDPSSIZE) { - downloadedpsname[j] = (char *)xmalloc(strlen(re->PSname) + 1); - strcpy (downloadedpsname[j], re->PSname); - j++; + if (unused_top_of_psnames < DOWNLOADEDPSSIZE) { + downloadedpsnames[unused_top_of_psnames] = xstrdup (re->PSname); + unused_top_of_psnames++; } } else { char eb[1000]; -- cgit v1.2.3