[tex-live] dvips patch again
Roozbeh Pournader
roozbeh@sharif.edu
Sat, 1 Jun 2002 00:54:55 +0430 (IRST)
It seems that attachments don't make it here. I need to know if I can
apply the following patch to TeX Live tree. Sebastian told me that it may
be controversial.
roozbeh
==== //depot/Build/source.development/TeX/texk/dvipsk/afm2tfm.c#7 - /home/roozbeh/texlive/Build/source.development/TeX/texk/dvipsk/afm2tfm.c ====
@@ -24,6 +24,7 @@
#include "config.h"
#include <kpathsea/c-ctype.h>
#include <kpathsea/progname.h>
+#include <math.h>
#else /* ! KPATHSEA */
#include <stdio.h>
#include <stdlib.h>
@@ -320,7 +321,7 @@
if (len > 65500L)
error("! can't allocate more than 64K!") ;
#endif
- p = malloc((unsigned)len) ;
+ p = (char *) malloc((unsigned)len) ;
if (p==NULL)
error("! out of memory") ;
for (i=0; i<len; i++)
@@ -570,7 +571,7 @@
}
}
-struct encoding *readencoding() ;
+struct encoding *readencoding P1H(char *) ;
void
makeaccentligs P1H(void) {
@@ -701,8 +702,7 @@
* characters, we would prefer to use the original ordering. It just
* makes more sense.
*/
-struct adobeinfo *revlist(p)
-struct adobeinfo *p ;
+struct adobeinfo *revlist P1C(struct adobeinfo *, p)
{
struct adobeinfo *q = 0, *t ;
@@ -1229,8 +1229,7 @@
int forceoctal = 0 ;
char vcharbuf[6] ;
-char *vchar(c)
-int c ;
+char *vchar P1C(int, c)
{
if (forceoctal == 0 && ISALNUM (c))
(void) sprintf(vcharbuf,"C %c",
@@ -1540,7 +1539,9 @@
void
openfiles P2C(int, argc, char **, argv)
{
+#ifndef KPATHSEA
register int lastext ;
+#endif
register int i ;
char *p ;
int arginc ;
==== //depot/Build/source.development/TeX/texk/dvipsk/bbox.c#1 - /home/roozbeh/texlive/Build/source.development/TeX/texk/dvipsk/bbox.c ====
@@ -50,7 +50,7 @@
shalfword bc, ec ;
#ifdef Omega
integer scaled[65536] ;
- unsigned chardat[65536] ;
+ integer chardat[65536] ;
integer font_level;
integer pretend_no_chars;
#else
@@ -188,13 +188,13 @@
/* convert from magnified PostScript units back to scaled points */
real conv = 72.0 * (real)num / (real)den * (real)mag / 254000000.0 ;
if (llx > h + r[0] / conv)
- llx = h + r[0] / conv ;
+ llx = (integer) (h + r[0] / conv) ;
if (lly > v - r[3] / conv)
- lly = v - r[3] / conv ;
+ lly = (integer) (v - r[3] / conv) ;
if (urx < h + r[2] / conv)
- urx = h + r[2] / conv ;
+ urx = (integer) (h + r[2] / conv) ;
if (ury < v - r[1] / conv)
- ury = v - r[1] / conv ;
+ ury = (integer) (v - r[1] / conv) ;
}
}
void bbdopage()
@@ -378,8 +378,8 @@
fseek(dvifile, bop, 0) ;
bbdopage() ;
fseek(dvifile, curpos, 0) ;
- lly = vsize - 2 * off - lly ;
- ury = vsize - 2 * off - ury ;
+ lly = (int) (vsize - 2 * off - lly) ;
+ ury = (int) (vsize - 2 * off - ury) ;
llx = (int)floor((llx + off - margin) * conv - hadj + 0.5) ;
lly = (int)floor((lly + off + margin) * conv - vadj + 0.5) ;
urx = (int)floor((urx + off + margin) * conv - hadj + 0.5) ;
==== //depot/Build/source.development/TeX/texk/dvipsk/dopage.c#1 - /home/roozbeh/texlive/Build/source.development/TeX/texk/dvipsk/dopage.c ====
@@ -112,8 +112,8 @@
H_BREAK = (30 * DPI / 400 ) ; /* 30 seems to have worked well at 400 dpi */
#endif
w = x = y = z = 0 ;
- h = DPI / conv * hoff / 4736286.72 ;
- v = DPI / conv * voff / 4736286.72 ;
+ h = (integer) (DPI / conv * hoff / 4736286.72) ;
+ v = (integer) (DPI / conv * voff / 4736286.72) ;
hh = PixRound(h) ;
vv = PixRound(v) ;
curfnt = NULL ;
==== //depot/Build/source.development/TeX/texk/dvipsk/download.c#6 - /home/roozbeh/texlive/Build/source.development/TeX/texk/dvipsk/download.c ====
@@ -410,7 +410,7 @@
char *startOfAdd = 0 ;
if (len + glyphSizeUsed + 3 > extraGlyphSize) {
extraGlyphSize = 2 * (extraGlyphSize + len + 100) ;
- extraGlyphSpace = xrealloc(extraGlyphSpace, extraGlyphSize) ;
+ extraGlyphSpace = (char *) xrealloc(extraGlyphSpace, extraGlyphSize) ;
}
extraGlyphs = extraGlyphSpace ;
if (glyphSizeUsed == 0) {
==== //depot/Build/source.development/TeX/texk/dvipsk/drawPS.c#1 - /home/roozbeh/texlive/Build/source.development/TeX/texk/dvipsk/drawPS.c ====
@@ -150,7 +150,7 @@
/* forward declarations */
/* static void doShading(); */
-static integer zPixRound(); /* (int)(x/y)PixRound((int)x,(int)y) */
+static integer zPixRound P2H(integer, integer); /* (int)(x/y)PixRound((int)x,(int)y) */
static double shadetp = 0.5;
/* shading level, initialized as requested by tpic 2.0 -- MJ */
==== //depot/Build/source.development/TeX/texk/dvipsk/dvips.c#4 - /home/roozbeh/texlive/Build/source.development/TeX/texk/dvipsk/dvips.c ====
@@ -407,7 +407,7 @@
#endif
}
#endif
- p = malloc(n) ;
+ p = (char *) malloc(n) ;
if (p == NULL)
error("! no memory") ;
return p ;
@@ -1202,7 +1202,7 @@
if (!quiet && warningmsg)
error(warningmsg) ;
headersready = 1 ;
- headerfile = (compressed? CHEADERFILE : HEADERFILE) ;
+ headerfile = (char *) (compressed? CHEADERFILE : HEADERFILE) ;
(void)add_header(headerfile) ;
if (*iname != 0) {
fulliname = nextstring ;
==== //depot/Build/source.development/TeX/texk/dvipsk/emspecial.c#1 - /home/roozbeh/texlive/Build/source.development/TeX/texk/dvipsk/emspecial.c ====
@@ -831,7 +831,7 @@
}
}
newline();
- mhexout(line,(long)tobyte(wide));
+ mhexout((unsigned char *) line,(long)tobyte(wide));
}
free(linelen);
free(line);
@@ -873,7 +873,7 @@
for (i = 0; i < high; i++) {
fread(line, 1, tobyte(wide), f);
newline();
- mhexout(line,(long)tobyte(wide));
+ mhexout((unsigned char *) line,(long)tobyte(wide));
}
free(line);
}
@@ -1340,7 +1340,7 @@
}
}
newline();
- mhexout(pshexa,(long)tobyte(bmih.width));
+ mhexout((unsigned char *) pshexa,(long)tobyte(bmih.width));
}
imagetail() ;
free(pshexa);
==== //depot/Build/source.development/TeX/texk/dvipsk/fontdef.c#1 - /home/roozbeh/texlive/Build/source.development/TeX/texk/dvipsk/fontdef.c ====
@@ -127,7 +127,7 @@
register fontmaptype *cfnt ;
char *name, *area ;
integer cksum, scsize, dssize ;
- extern void skipover() ;
+ extern void skipover(int) ;
fn = dvibyte() ;
while (siz-- > 1)
==== //depot/Build/source.development/TeX/texk/dvipsk/hps.c#2 - /home/roozbeh/texlive/Build/source.development/TeX/texk/dvipsk/hps.c ====
@@ -348,7 +348,7 @@
int vert_loc P1C(int, i)
{
int return_value ;
- return_value = (i + (PAGESIZE / 4) + FUDGE) ;
+ return_value = (int) (i + (PAGESIZE / 4) + FUDGE) ;
if ( return_value > PAGESIZE) {
return((int)PAGESIZE) ;
} else if (return_value < (PAGESIZE / 4.0)) {
==== //depot/Build/source.development/TeX/texk/dvipsk/protos.h#1 - /home/roozbeh/texlive/Build/source.development/TeX/texk/dvipsk/protos.h ====
@@ -363,4 +363,8 @@
extern struct tft *vfontdef P2H(int s, int siz);
extern Boolean virtualfont P1H(fontdesctype *curfnt);
+/* prototypes for functions from writet1.c */
+extern void load_enc P2H(char *, char **);
+extern boolean t1_subset_2 P3H(char *, unsigned char *, char *);
+
#endif
==== //depot/Build/source.development/TeX/texk/dvipsk/t1part.c#1 - /home/roozbeh/texlive/Build/source.development/TeX/texk/dvipsk/t1part.c ====
@@ -293,7 +293,7 @@
for(i=0;*TypeFonts[i].extension;i++)
{
- if(strstr(name,TypeFonts[i].extension)!=0)
+ if(strstr((char *)name,TypeFonts[i].extension)!=0)
return(TypeFonts[i].num);
}
return -1;
@@ -430,7 +430,7 @@
while(isdigit(*temp))
*tmp++= *temp++;
*tmp = '\0';
- return(atoi(token));
+ return(atoi((char *)token));
}
temp++;
}
@@ -503,10 +503,10 @@
{
int length;
- CHAR *ThisChar = getmem(sizeof(CHAR));
- length = strlen(CharName);
- ThisChar->name = getmem(length+1);
- strcpy(ThisChar->name, CharName);
+ CHAR *ThisChar = (CHAR*) getmem(sizeof(CHAR));
+ length = strlen((char *) CharName);
+ ThisChar->name = (unsigned char *) getmem(length+1);
+ strcpy((char *) ThisChar->name, (char *) CharName);
ThisChar->length= length;
ThisChar->num=num;
ThisChar->NextChar = TmpChar;
@@ -519,10 +519,10 @@
{
int length;
- STRING *ThisStr = getmem(sizeof(STRING));
- length = strlen(name);
- ThisStr->name = getmem(length+1);
- strcpy(ThisStr->name, name);
+ STRING *ThisStr = (STRING *) getmem(sizeof(STRING));
+ length = strlen((char *) name);
+ ThisStr->name = (unsigned char *) getmem(length+1);
+ strcpy((char *) ThisStr->name, (char *) name);
ThisStr->num=num;
ThisStr->NextStr = FirstStr;
@@ -545,7 +545,7 @@
{
if (label[i].select==FLG_BINARY)
{
- CHAR *Rev_Char = getmem(sizeof(CHAR));
+ CHAR *Rev_Char = (CHAR *) getmem(sizeof(CHAR));
Rev_Char->name = ThisChar->name;
Rev_Char->num = ThisChar->num;
@@ -604,7 +604,7 @@
if(TmpStr->num < tmp)
{
- STRING *ThisStr = getmem(sizeof(STRING));
+ STRING *ThisStr = (STRING *) getmem(sizeof(STRING));
ThisStr->name = TmpStr->name;
ThisStr->NextStr = RevStr;
@@ -673,13 +673,13 @@
{
int length;
CHAR *ThisChar = TmpChar;
- length=strlen(name);
+ length=strlen((char *) name);
while (ThisChar != NULL)
{
CHAR *NextChar = ThisChar->NextChar;
if(ThisChar->length==length)
{
- if (strcmp(name, ThisChar->name) == 0)
+ if (strcmp((char *) name, (char *) ThisChar->name) == 0)
{
ThisChar->choose=1;
return 1;
@@ -691,9 +691,9 @@
* O'Neill; bugs in application of fix due to me.
*/
if (NextChar == 0) {
- NextChar = getmem(sizeof(CHAR)) ;
- NextChar->name = getmem(length + 1) ;
- strcpy(NextChar->name, name) ;
+ NextChar = (CHAR *) getmem(sizeof(CHAR)) ;
+ NextChar->name = (unsigned char *) getmem(length + 1) ;
+ strcpy((char *) NextChar->name, (char *) name) ;
NextChar->length = length ;
NextChar->num = -1 ;
NextChar->NextChar = 0 ;
@@ -754,7 +754,7 @@
if(ThisChar->length==length)
{
- if (strcmp(name, ThisChar->name) == 0)
+ if (strcmp((char *) name, (char *) ThisChar->name) == 0)
{
if(ThisChar->choose==1)
{
@@ -828,7 +828,7 @@
{
while (TmpChar != NULL) {
{
- CHAR *ThisChar = getmem(sizeof(CHAR));
+ CHAR *ThisChar = (CHAR *) getmem(sizeof(CHAR));
ThisChar->name = TmpChar->name;
ThisChar->length = TmpChar->length;
ThisChar->num = TmpChar->num;
@@ -908,7 +908,7 @@
{
if(word_type==2)
{
- if(!strcmp(token,Dup))
+ if(!strcmp((char *) token,Dup))
{
if(test==0)
test=1;
@@ -1319,8 +1319,8 @@
{
if(word_type>=3)
{
- strcpy(tmp_token, token);
- str_len = strlen(token);
+ strcpy((char *) tmp_token, (char *) token);
+ str_len = strlen((char *) token);
if(CharCount!=0)
@@ -1347,7 +1347,7 @@
#endif
if(word_type>3)
{
- if(strstr(token, notdef)!=NULL)
+ if(strstr((char *) token, (char *) notdef)!=NULL)
{
CharCount--;
label[number].num = -2;
@@ -1487,7 +1487,7 @@
{
for(i=First_Key; i<=lastkey; i++)
{
- if(!strcmp(token, Key[i].name))
+ if(!strcmp((char *) token, Key[i].name))
{
tmp_num = GetNum();
if(tmp_num<0)
@@ -1498,7 +1498,7 @@
exit(1);
}
keyword[current].oldnum = tmp_num;
- keyword[current].length=strlen(token);
+ keyword[current].length=strlen((char *) token);
keyword[current].begin=temp - keyword[current].length;
return i;
}
@@ -1676,12 +1676,12 @@
return -1;
if(err_num==5)
- refer[ind_ref].num[i++]=atoi(token);
+ refer[ind_ref].num[i++]=atoi((char *) token);
else
{
for(j=0; *RefKey[j]; j++)
{
- if(strcmp(token, RefKey[j]) ==0)
+ if(strcmp((char *) token, RefKey[j]) ==0)
break;
}
switch(j)
@@ -1705,7 +1705,7 @@
refer[ind_ref].num[1] = 1;
refer[ind_ref].num[2] = refer[ind_ref].num[0];
GetWord(token);
- refer[ind_ref].num[0]= atoi(token);
+ refer[ind_ref].num[0]= atoi((char *) token);
}
i=0;
refer[ind_ref].select=1;
@@ -1757,7 +1757,7 @@
if(err_token==2)
{
- if(strcmp(token, Dup) ==0)
+ if(strcmp((char *) token, Dup) ==0)
{
err_token=GetWord(token);
if(err_token<0)
@@ -1765,7 +1765,7 @@
if(err_token!=2) /* define "dup word" */
{
- num=atoi(token);
+ num=atoi((char *) token);
err_token=GetWord(token);
if(err_token<0)
@@ -1811,7 +1811,7 @@
{
if(num_err==3)
{
- if (strcmp(token,"/Encoding") == 0)
+ if (strcmp((char *) token,"/Encoding") == 0)
{
tmpnum=GetWord(token);
@@ -1962,7 +1962,7 @@
FindEncoding();
}
- line=KillUnique(tmpline);
+ line=(unsigned char *) KillUnique((char *) tmpline);
if(keep_flg==0)
fprintf(fout,"%s", line);
@@ -2046,17 +2046,17 @@
memory = BASE_MEM;
addmemory= ADD_MEM;
length=0;
- temp=UniGetMem(memory);
+ temp=(typetemp *) UniGetMem(memory);
begin_of_scan=temp;
for(;;)
{
- if(fgets(buf,BUFSIZ,fin)==NULL)
+ if(fgets((char *)buf,BUFSIZ,fin)==NULL)
break;
switch (type)
{
case FLG_ASCII:
- if(strstr(buf,"currentfile eexec") != NULL)
+ if(strstr((char *)buf,"currentfile eexec") != NULL)
{
type=FLG_BINARY;
}
@@ -2067,7 +2067,7 @@
}
if(keep_flg==0)
- fprintf(fout,"%s", KillUnique(buf));
+ fprintf(fout,"%s", KillUnique((char *)buf));
else
{
AddStr(buf,keep_num);
@@ -2108,11 +2108,11 @@
OutHEX(fout);
UniFree(begin_of_scan);
- fprintf(fout, "%s", KillUnique(buf));
+ fprintf(fout, "%s", KillUnique((char*) buf));
break;
}
- add_of_len=strlen(buf)/2;
+ add_of_len=strlen((char *) buf)/2;
length=length + add_of_len;
if(length>memory)
@@ -2120,7 +2120,7 @@
memory = memory + addmemory;
/* Using "memory = length;" retains minimum */
/* of memory but it will be more slowly */
- begin_of_scan = UniRealloc(begin_of_scan, memory);
+ begin_of_scan = (typetemp*) UniRealloc(begin_of_scan, memory);
temp = begin_of_scan + length - add_of_len;
}
HexEDeCrypt(buf);
@@ -2217,7 +2217,7 @@
if(sub_type == FIRST_BINARY)
{
sub_type = NEXT_BINARY;
- temp=UniGetMem(t_length);
+ temp=(typetemp*) UniGetMem(t_length);
begin_of_scan=temp;
}
}
@@ -2362,13 +2362,13 @@
}
afmfile[i]='\0';
- strcat(afmfile,".afm");
+ strcat((char *) afmfile,".afm");
fprintf(stderr, "<%s>", afmfile);
- if ((fafm = psfopen(afmfile, "r")) == NULL)
+ if ((fafm = psfopen((char *) afmfile, "r")) == NULL)
{
NameOfProgram();
- perror(afmfile);
+ perror((char *) afmfile);
return -1;
}
@@ -2376,10 +2376,10 @@
{
line = tmpline;
- if(fgets(line,BUFSIZ,fafm)==NULL)
+ if(fgets((char *) line,BUFSIZ,fafm)==NULL)
break;
- if(strstr(line, AfmKey[j])!=NULL)
+ if(strstr((char *) line, AfmKey[j])!=NULL)
{
if(j==0)
{
@@ -2400,12 +2400,12 @@
err_num=GetWord(token);
if(err_num==2)
{
- if(strcmp(token,InfoKey[k])==0)
+ if(strcmp((char *) token,InfoKey[k])==0)
{
if(k==0)
{
err_num=GetWord(token);
- num=atoi(token);
+ num=atoi((char *) token);
k=1;
continue;
}
@@ -2414,7 +2414,7 @@
err_num=GetWord(token);
name[0]='/';
name[1]='\0';
- strcat(name,token);
+ strcat((char *) name, (char *) token);
if(num>=0)
FirstCharA=AddChar(FirstCharA, name, num);
break;
@@ -2442,7 +2442,7 @@
lastpart=0;
keep_flg=0;
flg_seac=0;
- strcpy(psfontfile,fontfile);
+ strcpy((char *) psfontfile, (char *) fontfile);
find_encod=0;
CharCount=0;
@@ -2452,7 +2452,7 @@
label[i].num=CHAR_NOT_DEF;
- strcpy(psvectfile, basevect);
+ strcpy((char *) psvectfile, (char *) basevect);
#ifdef DEBUG
if(dd(D_VIEW_VECTOR))
@@ -2471,7 +2471,7 @@
if(vectfile)
{
reencode=FLG_REENCODE;
- strcpy(psvectfile,vectfile);
+ strcpy((char *) psvectfile, (char *) vectfile);
}
for(num=0;num<NUM_LABEL;num++)
@@ -2480,10 +2480,10 @@
switch(DefTypeFont(fontfile))
{
case PFA:
- if ((fin = psfopen(fontfile, "r"))==NULL)
+ if ((fin = psfopen((char *) fontfile, "r"))==NULL)
{
NameOfProgram();
- perror(fontfile);
+ perror((char *) fontfile);
return -1;
}
rc = PartialPFA(fin,fout);
@@ -2497,10 +2497,10 @@
break;
case PFB:
- if ((fin = psfopen(fontfile, OPEN_READ_BINARY))==NULL)
+ if ((fin = psfopen((char *) fontfile, OPEN_READ_BINARY))==NULL)
{
NameOfProgram();
- perror(fontfile);
+ perror((char *) fontfile);
return -1;
}
rc = PartialPFB(fin,fout);
@@ -2553,10 +2553,10 @@
CharCount = 0;
- if ((fvect = psfopen(psvectfile, "r")) == NULL)
+ if ((fvect = psfopen((char *) psvectfile, "r")) == NULL)
{
NameOfProgram();
- perror(psvectfile);
+ perror((char *) psvectfile);
return -1;
}
@@ -2564,7 +2564,7 @@
{
line = tmpline;
- if((fgets(line,BUFSIZ,fvect)==NULL)||(end_vect!=0))
+ if((fgets((char*)line,BUFSIZ,fvect)==NULL)||(end_vect!=0))
break;
for(;;)
==== //depot/Build/source.development/TeX/texk/dvipsk/writet1.c#5 - /home/roozbeh/texlive/Build/source.development/TeX/texk/dvipsk/writet1.c ====
@@ -28,6 +28,7 @@
#else /* writet1 used with dvips */
#include "ptexmac.h"
#include "dvips.h"
+#include "protos.h"
#undef fm_extend
#define fm_extend(f) 0
#undef fm_slant
@@ -524,7 +525,7 @@
p = t1_line_ptr - 5;
while (*p != ' ')
p--;
- t1_cslen = l = t1_scan_num(p + 1, 0);
+ t1_cslen = l = (int) t1_scan_num(p + 1, 0);
cs_start = t1_line_ptr;
check_buf(t1_line_ptr - t1_line + l, T1_BUF_SIZE);
while (l-- > 0)
@@ -810,7 +811,7 @@
if (!t1_scan || *t1_line != '/')
return;
if (t1_prefix(lenIV)) {
- t1_lenIV = t1_scan_num(t1_line + strlen(lenIV), 0);
+ t1_lenIV = (int) t1_scan_num(t1_line + strlen(lenIV), 0);
return;
}
t1_scan_keys();
@@ -1078,7 +1079,7 @@
for (p = t1_line, q = t1_buf; *p != ' '; *q++ = *p++);
*q = 0;
if (is_subr) {
- subr = t1_scan_num(p + 1, 0);
+ subr = (int) t1_scan_num(p + 1, 0);
check_subr(subr);
ptr = subr_tab + subr;
}
@@ -1445,7 +1446,7 @@
return;
subr_size_pos = strlen("/Subrs") + 1;
/* subr_size_pos points to the number indicating dict size after "/Subrs" */
- subr_size = t1_scan_num(t1_line + subr_size_pos, 0);
+ subr_size = (int) t1_scan_num(t1_line + subr_size_pos, 0);
if (subr_size == 0) {
while (!t1_charstrings())
t1_getline();
@@ -1640,7 +1641,7 @@
- t1_line + 1;
/* cs_size_pos points to the number indicating
dict size after "/CharStrings" */
- cs_size = t1_scan_num(t1_line + cs_size_pos, 0);
+ cs_size = (int) t1_scan_num(t1_line + cs_size_pos, 0);
cs_ptr = cs_tab = xtalloc(cs_size, cs_entry);
for (ptr = cs_tab; ptr - cs_tab < cs_size; ptr++)
init_cs_entry(ptr);