diff options
author | Peter Breitenlohner <peb@mppmu.mpg.de> | 2014-10-12 10:31:23 +0000 |
---|---|---|
committer | Peter Breitenlohner <peb@mppmu.mpg.de> | 2014-10-12 10:31:23 +0000 |
commit | 43ad3d03311b20d626c35d8a1537d13e5764d625 (patch) | |
tree | 48f91f8039f5c22cc5891a2f4f97a4b4f439abcc /Build/source/texk/ps2pkm | |
parent | 5c7cda775a2f1bffea4e622099d226715b57dc6a (diff) |
texk/ps2pkm: General cleanup: ANSI/ISO C functions and more
git-svn-id: svn://tug.org/texlive/trunk@35361 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/ps2pkm')
45 files changed, 871 insertions, 1180 deletions
diff --git a/Build/source/texk/ps2pkm/ChangeLog b/Build/source/texk/ps2pkm/ChangeLog index a44f50fd5f4..6a6ed4234b2 100644 --- a/Build/source/texk/ps2pkm/ChangeLog +++ b/Build/source/texk/ps2pkm/ChangeLog @@ -1,3 +1,18 @@ +2014-10-09 Peter Breitenlohner <peb@mppmu.mpg.de> + + More general cleanup: + * *.[ch]: ANSI/ISO C function prototypes and definitions. + Extern declarations in only in headers. + Drop unused functions and variables. + Declare functions used in only one file as static. + * Makefile.am: t1imager.h. t1stub.c, and trig.h are not used. + Enable compiler warnings. + +2014-10-12 Peter Breitenlohner <peb@mppmu.mpg.de> + + * basics.h: Declare fatal() as noreturn (gcc and MSVC). + * pkout.c (magnification): Fatal error if no value found. + 2014-10-08 Peter Breitenlohner <peb@mppmu.mpg.de> * ps2pk.c: Add return type for main and GetClientResolutions. diff --git a/Build/source/texk/ps2pkm/Makefile.am b/Build/source/texk/ps2pkm/Makefile.am index 1b18c8ab556..f2421c35a7d 100644 --- a/Build/source/texk/ps2pkm/Makefile.am +++ b/Build/source/texk/ps2pkm/Makefile.am @@ -6,7 +6,7 @@ bin_PROGRAMS = mag pfb2pfa pk2bm ps2pk AM_CPPFLAGS = $(KPATHSEA_INCLUDES) -DUNIX -DKPATHSEA -AM_CFLAGS = #$(WARNING_CFLAGS) +AM_CFLAGS = $(WARNING_CFLAGS) LDADD = $(KPATHSEA_LIBS) pk2bm_CPPFLAGS = @@ -77,17 +77,14 @@ ps2pk_SOURCES = \ strokes.h \ t1funcs.c \ t1hdigit.h \ - t1imager.h \ t1info.c \ t1intf.h \ t1io.c \ - t1snap.c \ + t1snap.c \ t1stdio.h \ - t1stub.c \ token.c \ token.h \ tokst.h \ - trig.h \ type1.c \ types.h \ util.c \ @@ -124,8 +121,11 @@ EXTRA_DIST += \ sexpr.c \ strexpr.c \ strexpr.h \ + t1imager.h \ + t1stub.c \ t1test.c \ texfiles.c \ texfiles.h \ + trig.h \ usenet diff --git a/Build/source/texk/ps2pkm/Makefile.in b/Build/source/texk/ps2pkm/Makefile.in index baf7bf57527..e78f1ca0e31 100644 --- a/Build/source/texk/ps2pkm/Makefile.in +++ b/Build/source/texk/ps2pkm/Makefile.in @@ -142,8 +142,8 @@ am_ps2pk_OBJECTS = arith.$(OBJEXT) basics.$(OBJEXT) bstring.$(OBJEXT) \ objects.$(OBJEXT) paths.$(OBJEXT) pkout.$(OBJEXT) \ ps2pk.$(OBJEXT) regions.$(OBJEXT) scanfont.$(OBJEXT) \ spaces.$(OBJEXT) t1funcs.$(OBJEXT) t1info.$(OBJEXT) \ - t1io.$(OBJEXT) t1snap.$(OBJEXT) t1stub.$(OBJEXT) \ - token.$(OBJEXT) type1.$(OBJEXT) util.$(OBJEXT) + t1io.$(OBJEXT) t1snap.$(OBJEXT) token.$(OBJEXT) \ + type1.$(OBJEXT) util.$(OBJEXT) ps2pk_OBJECTS = $(am_ps2pk_OBJECTS) ps2pk_LDADD = $(LDADD) ps2pk_DEPENDENCIES = $(am__DEPENDENCIES_1) @@ -554,7 +554,7 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CPPFLAGS = $(KPATHSEA_INCLUDES) -DUNIX -DKPATHSEA -AM_CFLAGS = #$(WARNING_CFLAGS) +AM_CFLAGS = $(WARNING_CFLAGS) LDADD = $(KPATHSEA_LIBS) pk2bm_CPPFLAGS = pk2bm_CFLAGS = $(WARNING_CFLAGS) @@ -623,17 +623,14 @@ ps2pk_SOURCES = \ strokes.h \ t1funcs.c \ t1hdigit.h \ - t1imager.h \ t1info.c \ t1intf.h \ t1io.c \ - t1snap.c \ + t1snap.c \ t1stdio.h \ - t1stub.c \ token.c \ token.h \ tokst.h \ - trig.h \ type1.c \ types.h \ util.c \ @@ -645,8 +642,8 @@ EXTRA_DIST = $(TESTS) tests/Symbol.afm tests/Symbol.alpha.hex \ tests/Symbol.alpha.pix tests/Symbol.pfa tests/Symbol.pfb \ tests/Symbol10.300pk CHANGES.type1 INSTALLATION README.14m \ README.type1 basename.c flisearch.c pktest.c protos.h \ - psearch.c sexpr.c strexpr.c strexpr.h t1test.c texfiles.c \ - texfiles.h usenet + psearch.c sexpr.c strexpr.c strexpr.h t1imager.h t1stub.c \ + t1test.c texfiles.c texfiles.h trig.h usenet DISTCLEANFILES = Symbol* all: c-auto.h $(MAKE) $(AM_MAKEFLAGS) all-am @@ -798,7 +795,6 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t1info.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t1io.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t1snap.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t1stub.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/token.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/type1.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/util.Po@am__quote@ diff --git a/Build/source/texk/ps2pkm/arith.c b/Build/source/texk/ps2pkm/arith.c index 49327041dad..9199042ecea 100644 --- a/Build/source/texk/ps2pkm/arith.c +++ b/Build/source/texk/ps2pkm/arith.c @@ -105,10 +105,7 @@ SIGNBITON tests the high order bit of a long 'w': The two multiplicands must be positive. */ -void DLmult(product, u, v) - register doublelong *product; - register ULONG u; - register ULONG v; +void DLmult(register doublelong *product, register ULONG u, register ULONG v) { register ULONG u1, u2; /* the digits of u */ register ULONG v1, v2; /* the digits of v */ @@ -150,9 +147,9 @@ void DLmult(product, u, v) Both the dividend and the divisor must be positive. */ -void DLdiv(quotient, divisor) - doublelong *quotient; /* also where dividend is, originally */ - ULONG divisor; +void DLdiv( + doublelong *quotient, /* also where dividend is, originally */ + ULONG divisor) { register ULONG u1u2 = quotient->high; register ULONG u3u4 = quotient->low; @@ -288,9 +285,7 @@ carry. Conversely, if there was a carry, the sum of the lows must be less than the max of the lows. So, the test is "if and only if". */ -void DLadd(u, v) - doublelong *u; /* u = u + v */ - doublelong *v; +void DLadd(doublelong *u, doublelong *v) /* u = u + v */ { register ULONG lowmax = MAX(u->low, v->low); @@ -307,9 +302,7 @@ Testing for a borrow is even easier. If the v.low is greater than u.low, there must be a borrow. */ -void DLsub(u, v) - doublelong *u; /* u = u - v */ - doublelong *v; +void DLsub(doublelong *u, doublelong *v) /* u = u - v */ { /* printf("DLsub(%x %x, %x %x)\n", u->high, u->low, v->high, v->low);*/ u->high -= v->high; @@ -335,8 +328,7 @@ overflow will occur when the resulting value is passed back as a fractpel. */ -fractpel FPmult(u, v) - register fractpel u,v; +fractpel FPmult(register fractpel u, register fractpel v) { doublelong w; register int negative = FALSE; /* sign flag */ @@ -366,9 +358,7 @@ fractpel FPmult(u, v) These values may be signed. The function returns the quotient. */ -fractpel FPdiv(dividend, divisor) - register fractpel dividend; - register fractpel divisor; +fractpel FPdiv(register fractpel dividend, register fractpel divisor) { doublelong w; /* result will be built here */ int negative = FALSE; /* flag for sign bit */ @@ -399,8 +389,8 @@ an operator that first multiplies by one constant then divides by another, keeping the intermediate result in extended precision. */ -fractpel FPstarslash(a, b, c) - register fractpel a,b,c; /* result = a * b / c */ +fractpel FPstarslash(register fractpel a, register fractpel b, + register fractpel c) /* result = a * b / c */ { doublelong w; /* result will be built here */ int negative = FALSE; diff --git a/Build/source/texk/ps2pkm/arith.h b/Build/source/texk/ps2pkm/arith.h index 3f2e4b8d038..9b0d4e063be 100644 --- a/Build/source/texk/ps2pkm/arith.h +++ b/Build/source/texk/ps2pkm/arith.h @@ -28,17 +28,6 @@ */ /*SHARED*/ -#include "types.h" - -void DLmult(),DLdiv(),DLadd(),DLsub(); - -fractpel FPmult(); -fractpel FPdiv(); -fractpel FPstarslash(); - -/*END SHARED*/ -/*SHARED*/ - /* MAXSHORT may be defined by <limits.h> */ #ifdef MAXSHORT #undef MAXSHORT @@ -65,3 +54,17 @@ typedef struct { } /*END SHARED*/ +/*SHARED*/ + +#include "types.h" + +void DLmult(doublelong *, ULONG, ULONG), + DLdiv(doublelong *, ULONG), + DLadd(doublelong *, doublelong *), + DLsub(doublelong *, doublelong *); + +fractpel FPmult(fractpel, fractpel); +fractpel FPdiv(fractpel, fractpel); +fractpel FPstarslash(fractpel, fractpel, fractpel); + +/*END SHARED*/ diff --git a/Build/source/texk/ps2pkm/basics.h b/Build/source/texk/ps2pkm/basics.h index 944e6a94890..8c20a75dae2 100644 --- a/Build/source/texk/ps2pkm/basics.h +++ b/Build/source/texk/ps2pkm/basics.h @@ -77,9 +77,16 @@ #include <stdarg.h> +#if defined __GNUC__ && __GNUC__ >=3 +__attribute__((__noreturn__)) +#elif defined _MSC_VER && 1200 <= _MSC_VER +__declspec (noreturn) +#endif void fatal(const char *fmt, ...); void msg(const char *fmt, ...); +extern char *encfile, *afmfile; + /* For debugging purposes it is handy to have a fopen() function that * shows which files are opened. */ diff --git a/Build/source/texk/ps2pkm/blues.h b/Build/source/texk/ps2pkm/blues.h index a5cdafb8b72..8d6a486e040 100644 --- a/Build/source/texk/ps2pkm/blues.h +++ b/Build/source/texk/ps2pkm/blues.h @@ -31,8 +31,6 @@ #include "types.h" -extern psobj *GetType1CharString(); - #define TOPLEFT 1 #define BOTTOMRIGHT 2 diff --git a/Build/source/texk/ps2pkm/curves.c b/Build/source/texk/ps2pkm/curves.c index 507e0a73cd2..77da96b5dfa 100644 --- a/Build/source/texk/ps2pkm/curves.c +++ b/Build/source/texk/ps2pkm/curves.c @@ -89,8 +89,8 @@ struct bezierinfo { to subdivide. */ -int BezierTerminationTest(xa,ya,xb,yb,xc,yc,xd,yd) -fractpel xa,ya,xb,yb,xc,yc,xd,yd; +static int BezierTerminationTest(fractpel xa, fractpel ya, fractpel xb, fractpel yb, + fractpel xc, fractpel yc, fractpel xd, fractpel yd) { fractpel dmax; dmax = ABS(xa - xb); @@ -192,12 +192,12 @@ the starting values. If this overflows, a 'long', we are in trouble: This is the entry point called from outside the module. */ -struct segment *StepBezier(R, xA, yA, xB, yB, xC, yC, xD, yD) - struct region *R; /* Region under construction or NULL */ - fractpel xA,yA; /* A control point */ - fractpel xB,yB; /* B control point */ - fractpel xC,yC; /* C control point */ - fractpel xD,yD; /* D control point */ +struct segment *StepBezier( + struct region *R, /* Region under construction or NULL */ + fractpel xA, fractpel yA, /* A control point */ + fractpel xB, fractpel yB, /* B control point */ + fractpel xC, fractpel yC, /* C control point */ + fractpel xD, fractpel yD) /* D control point */ { struct bezierinfo Info; diff --git a/Build/source/texk/ps2pkm/curves.h b/Build/source/texk/ps2pkm/curves.h index 80a73be2dd6..cfa07b2bb70 100644 --- a/Build/source/texk/ps2pkm/curves.h +++ b/Build/source/texk/ps2pkm/curves.h @@ -35,6 +35,7 @@ #define FlattenBezier(xB,yB,xC,yC,xD,yD) t1_StepBezier(NULL,(fractpel)0,(fractpel)0,xB,yB,xC,yC,xD,yD) struct segment *t1_StepConic(); -struct segment *t1_StepBezier(); +struct segment *t1_StepBezier(struct region *, fractpel, fractpel, fractpel, + fractpel, fractpel, fractpel, fractpel, fractpel); /*END SHARED*/ diff --git a/Build/source/texk/ps2pkm/encoding.c b/Build/source/texk/ps2pkm/encoding.c index 542431016ee..c8e28949a55 100644 --- a/Build/source/texk/ps2pkm/encoding.c +++ b/Build/source/texk/ps2pkm/encoding.c @@ -19,6 +19,7 @@ * Version 1.4 (December 1993) */ +#include "types.h" #include "basics.h" #include <ctype.h> #include <stdio.h> @@ -30,8 +31,6 @@ static void remove_string(void); static void addcc(char *name, int charcode); static int getcc(char *name); -extern char *encfile, *afmfile; - /* return a pointer to first non space character after occurence of string t, * the scan starts at pointer s */ @@ -121,8 +120,6 @@ static char *nextpsname(void) return name; } -typedef char *encoding[256]; - void getenc(char **fontname, char **encname, encoding ev, int width[256]) { int i, len, SCMseen, Ccnt, wx, cc; FILE *afm; @@ -256,7 +253,9 @@ static int freenode = 0; static short root = -1; static void addcc(char *name, int charcode) -{ short r, p, q; +{ + short p = 0, q; + int r = 0; q = root; while (q != -1) { diff --git a/Build/source/texk/ps2pkm/ffilest.h b/Build/source/texk/ps2pkm/ffilest.h index 0bc413d3477..c84f4f5b216 100644 --- a/Build/source/texk/ps2pkm/ffilest.h +++ b/Build/source/texk/ps2pkm/ffilest.h @@ -39,7 +39,7 @@ #include "fontxlfd.h" typedef struct _FontName { - char *name; + const char *name; short length; short ndashes; } FontNameRec; @@ -148,4 +148,6 @@ typedef struct _BitmapSources { extern BitmapSourcesRec FontFileBitmapSources; +extern void Type1CloseFont(FontPtr); + #endif /* _FONTFILEST_H_ */ diff --git a/Build/source/texk/ps2pkm/fontfcn.c b/Build/source/texk/ps2pkm/fontfcn.c index 0a1adaa9031..e4dfb2360b6 100644 --- a/Build/source/texk/ps2pkm/fontfcn.c +++ b/Build/source/texk/ps2pkm/fontfcn.c @@ -29,17 +29,19 @@ */ /* Author: Katherine A. Hitchcock IBM Almaden Research Laboratory */ -#include "t1imager.h" #include <stdio.h> #include <string.h> +#include "objects.h" +#include "spaces.h" +#include "paths.h" +#include "regions.h" #include "util.h" -#include "fontfcn.h" #include "fontmisc.h" - -extern void objFormatName(psobj *, int, const char *); +#include "ffilest.h" +#include "fontfcn.h" -extern xobject Type1Char(); -extern boolean Init_BuiltInEncoding(); +#define FF_PARSE_ERROR 5 +#define FF_PATH 1 /***================================================================***/ /* GLOBALS */ @@ -57,9 +59,7 @@ psfont TheCurrentFont; /* return 0 - not found. */ /* return n - nth element in dictionary. */ /***================================================================***/ -int SearchDictName(dictP,keyP) - psdict *dictP; - psobj *keyP; +int SearchDictName(psdict *dictP, psobj *keyP) { int i,n; @@ -78,7 +78,7 @@ int SearchDictName(dictP,keyP) return(0); } /***================================================================***/ -boolean initFont() +static boolean initFont(void) { if (!(vm_init())) return(FALSE); @@ -92,8 +92,7 @@ boolean initFont() return(TRUE); } /***================================================================***/ -void resetFont(env) -char *env; +static void resetFont(char *env) { vm_next = FontP->vm_start; @@ -118,8 +117,7 @@ char *env; amounts of memory until it really runs out or the font loads successfully. (ndw) */ -int readFont(env) -char *env; +static int readFont(char *env) { int rcode; @@ -130,15 +128,8 @@ char *env; return(rcode); } /***================================================================***/ -xobject fontfcnB(S,code,lenP,mode) -XYspace S; -unsigned char *code; -int *lenP; -int *mode; +struct region *fontfcnB(struct XYspace *S, unsigned char *code, int *lenP, int *mode) { -#if 0 - path updateWidth(); -#endif psobj *charnameP; /* points to psobj that is name of character*/ int N; psdict *CharStringsDictP; /* dictionary with char strings */ @@ -146,7 +137,7 @@ int *mode; psobj *SubrsArrayP; psobj *theStringP; - path charpath; /* the path for this character */ + struct region *charpath; /* the path for this character */ charnameP = &CodeName; charnameP->len = *lenP; @@ -167,16 +158,16 @@ int *mode; SubrsArrayP = &(FontP->Subrs); /* scale the Adobe fonts to 1 unit high */ - S = Permanent(Scale(S, 1.0 , 1.0)); + S = (struct XYspace *)Permanent(Scale((struct xobject *)S, 1.0 , 1.0)); /* call the type 1 routine to rasterize the character */ - charpath = Type1Char(FontP,S,theStringP,SubrsArrayP,NULL, - FontP->BluesP , mode); + charpath = (struct region *)Type1Char(FontP,S,theStringP,SubrsArrayP,NULL, + FontP->BluesP , mode); Destroy(S); /* if Type1Char reported an error, then return */ if ( *mode == FF_PARSE_ERROR) return(NULL); /* fill with winding rule unless path was requested */ if (*mode != FF_PATH) { - charpath = Interior(charpath,WINDINGRULE+CONTINUITY); + charpath = Interior((struct segment *)charpath,WINDINGRULE+CONTINUITY); } return(charpath); } @@ -188,9 +179,7 @@ int *mode; /* 1) initialize the font - global indicates it has been done */ /* 2) load the font */ /***================================================================***/ -Bool fontfcnA(env,mode) -char *env; -int *mode; +Bool fontfcnA(char *env, int *mode) { int rc; @@ -230,11 +219,10 @@ int *mode; /* 3) use the font to call getInfo for that value. */ /***================================================================***/ -void QueryFontLib(env,infoName,infoValue,rcodeP) -char *env; -const char *infoName; -pointer infoValue; /* parameter returned here */ -int *rcodeP; +void QueryFontLib( + char *env, const char *infoName, + void *infoValue, /* parameter returned here */ + int *rcodeP) { int rc,N,i; psdict *dictP; diff --git a/Build/source/texk/ps2pkm/fontfcn.h b/Build/source/texk/ps2pkm/fontfcn.h index 0c2fda1f7bf..fdabdd89cf7 100644 --- a/Build/source/texk/ps2pkm/fontfcn.h +++ b/Build/source/texk/ps2pkm/fontfcn.h @@ -38,12 +38,35 @@ typedef struct ps_font { struct blues_struct *BluesP; } psfont; /***================================================================***/ +/* Globals */ +/***================================================================***/ + +extern int currentchar; /* for error reporting */ +/***================================================================***/ /* Routines in scan_font */ /***================================================================***/ + +extern boolean Init_BuiltInEncoding(void); +extern int SearchDictName(psdict *, psobj *); +extern int scan_font(psfont *); +extern struct xobject *Type1Char(psfont *, struct XYspace *, psobj *, psobj *, + psobj *, struct blues_struct *, int *); +extern void objFormatName(psobj *, int, const char *); +extern Bool fontfcnA(char *env,int *mode); +extern struct region *fontfcnB(struct XYspace *S, unsigned char *code, + int *lenP, int *mode); +/***================================================================***/ +/* Entry point for Type1Char to get entry from CharStrings */ +/***================================================================***/ +extern psobj *GetType1CharString(psfont *, unsigned char); + +extern int Type1OpenScalable(encoding, FontPtr *, int, FontEntryPtr, char *, + FontScalablePtr, fsBitmapFormat, + fsBitmapFormatMask, DOUBLE, DOUBLE); +extern void Type1RegisterFontFileFunctions(void); +extern void Type1CloseFont(); +extern int CheckFSFormat(int format,int fmask,int *bit,int *byte,int *scan,int *glyph,int *image); -extern boolean Init_StdEnc(); -extern int scan_font(); -extern int GetFontInfo(); /***================================================================***/ /* Return codes from scan_font */ /***================================================================***/ diff --git a/Build/source/texk/ps2pkm/fonts.h b/Build/source/texk/ps2pkm/fonts.h index cf29c3c8f25..497206bf2dd 100644 --- a/Build/source/texk/ps2pkm/fonts.h +++ b/Build/source/texk/ps2pkm/fonts.h @@ -45,5 +45,3 @@ #define InitFonts() #define InitFiles() #define TraceClose() - -#define FF_PARSE_ERROR -1 diff --git a/Build/source/texk/ps2pkm/fontxlfd.h b/Build/source/texk/ps2pkm/fontxlfd.h index 573b4617507..9ea8090c309 100644 --- a/Build/source/texk/ps2pkm/fontxlfd.h +++ b/Build/source/texk/ps2pkm/fontxlfd.h @@ -33,12 +33,7 @@ typedef struct _FontScalable { x, y, width; -} FontScalableRec, *FontScalablePtr; - -#ifdef WIN32 -extern void -FontParseXLFDName(char *scaledName, FontScalablePtr Vals, int foo ); -#endif +} FontScalableRec, *FontScalablePtr; #define FONT_XLFD_REPLACE_NONE 0 #define FONT_XLFD_REPLACE_STAR 1 diff --git a/Build/source/texk/ps2pkm/hints.c b/Build/source/texk/ps2pkm/hints.c index 4d5adf735fd..33fe5639d3d 100644 --- a/Build/source/texk/ps2pkm/hints.c +++ b/Build/source/texk/ps2pkm/hints.c @@ -82,7 +82,7 @@ static struct { #define FPFLOOR(fp) TOFRACTPEL((fp) >> FRACTBITS) #define FPROUND(fp) FPFLOOR((fp) + FPHALF) -void InitHints() +void InitHints(void) { int i; @@ -97,8 +97,7 @@ void InitHints() :h3.CloseHints(hintP) - Reverse hints that are still open */ -void CloseHints(hintP) - struct fractpoint *hintP; +void CloseHints(struct fractpoint *hintP) { int i; @@ -224,12 +223,10 @@ multiple of 90 degrees. :h3.ProcessHint(hP, currX, currY, hintP) - Process a rasterization hint */ -void ProcessHint(hP, currX, currY, hintP) - struct hintsegment *hP; - fractpel currX, currY; - struct fractpoint *hintP; +void ProcessHint(struct hintsegment *hP, fractpel currX, fractpel currY, + struct fractpoint *hintP) { - struct fractpoint thisHint; + struct fractpoint thisHint = { 0, 0 }; IfTrace4((HintDebug > 1)," ref=(%dl,%dl), width=(%dl,%dl)", hP->ref.x, hP->ref.y, @@ -811,8 +808,7 @@ This is the externally visible routine called from the REGIONS module when the +CONTINUITY flag is on the Interior() fill rule. */ -void ApplyContinuity(R) -struct region *R; +void ApplyContinuity(struct region *R) { struct edgelist *left; struct edgelist *right; diff --git a/Build/source/texk/ps2pkm/hints.h b/Build/source/texk/ps2pkm/hints.h index 79a96b42527..a3f91675cb9 100644 --- a/Build/source/texk/ps2pkm/hints.h +++ b/Build/source/texk/ps2pkm/hints.h @@ -28,15 +28,16 @@ */ /*SHARED*/ -#define InitHints() t1_InitHints() -void t1_InitHints(); /* Initialize hint data structure */ +#define InitHints t1_InitHints +void t1_InitHints(void); /* Initialize hint data structure */ #define CloseHints(hintP) t1_CloseHints(hintP) -void t1_CloseHints(); /* Reverse hints that are still open */ +void t1_CloseHints(struct fractpoint *); /* Reverse hints that are still open */ #define ProcessHint(hP, currX, currY, hintP) t1_ProcessHint(hP, currX, currY, hintP) -void t1_ProcessHint(); /* Process a rasterization hint */ +void t1_ProcessHint(struct hintsegment *, fractpel, fractpel, + struct fractpoint *); /* Process a rasterization hint */ #define ApplyContinuity(R) t1_ApplyContinuity(R) -void t1_ApplyContinuity(); /* fix false connection breaks in a region */ +void t1_ApplyContinuity(struct region *); /* fix false connection breaks in a region */ /*END SHARED*/ diff --git a/Build/source/texk/ps2pkm/lines.c b/Build/source/texk/ps2pkm/lines.c index 9da51242ecc..10b282e7348 100644 --- a/Build/source/texk/ps2pkm/lines.c +++ b/Build/source/texk/ps2pkm/lines.c @@ -41,6 +41,7 @@ The included files are: #include "types.h" #include "objects.h" #include "spaces.h" +#include "paths.h" #include "regions.h" #include "lines.h" @@ -70,11 +71,15 @@ None. The main work is done by Bresenham(); here we just perform checks and get the line so that its Y direction is always increasing: */ - -void StepLine(R, x1, y1, x2, y2) - register struct region *R; /* region being built */ - register fractpel x1,y1; /* starting point */ - register fractpel x2,y2; /* ending point */ + +static void Bresenham(pel *, fractpel, fractpel, fractpel, fractpel); + +void StepLine( + register struct region *R, /* region being built */ + register fractpel x1, /* starting ... */ + register fractpel y1, /* ... point */ + register fractpel x2, /* ending ... */ + register fractpel y2) /* ... point */ { register fractpel dy; @@ -122,10 +127,12 @@ TruncFP() truncates down by 'b' bits: #define TruncFP(xy,b) ((xy)>>(b)) -void Bresenham(edgeP,x1,y1,x2,y2) - register pel *edgeP; /* pointer to top of list (y == 0) */ - register fractpel x1,y1; /* starting point on line */ - register fractpel x2,y2; /* ending point on the line (down) */ +static void Bresenham( + register pel *edgeP, /* pointer to top of list (y == 0) */ + register fractpel x1, /* starting point ... */ + register fractpel y1, /* ... on line */ + register fractpel x2, /* ending point ... */ + register fractpel y2) /* ... on the line (down) */ { register LONG dx,dy; /* change in x and y, in my own precision */ register LONG x,y; /* integer pel starting point */ diff --git a/Build/source/texk/ps2pkm/lines.h b/Build/source/texk/ps2pkm/lines.h index 44b0da1a178..011955c2994 100644 --- a/Build/source/texk/ps2pkm/lines.h +++ b/Build/source/texk/ps2pkm/lines.h @@ -29,9 +29,8 @@ /*SHARED*/ #define StepLine(R,x1,y1,x2,y2) t1_StepLine(R,x1,y1,x2,y2) -#define Bresenham(e,x1,y1,x2,y2) t1_Bresenham(e,x1,y1,x2,y2) -void t1_StepLine(); /* check for special conditions, call Bresenham */ -void t1_Bresenham(); /* produce run ends for lines */ +void t1_StepLine(struct region *, fractpel, fractpel, fractpel, + fractpel); /* check for special conditions, call Bresenham */ /*END SHARED*/ diff --git a/Build/source/texk/ps2pkm/objects.c b/Build/source/texk/ps2pkm/objects.c index 5718acaebfb..9906466984c 100644 --- a/Build/source/texk/ps2pkm/objects.c +++ b/Build/source/texk/ps2pkm/objects.c @@ -56,6 +56,7 @@ you do do not need to include these header files. #include "types.h" #include <string.h> #include <ctype.h> +#include "util.h" /* override incorrect system functions; for example you might define @@ -282,16 +283,20 @@ set to 1. So, a nun-NULL template must also have a "references" field. PNM 3-26-91 */ -struct xobject *t1_Allocate(size, template, extra) /* non-ANSI; type checking was too strict */ - register int size; /* number of bytes to allocate & initialize */ - register struct xobject *template; /* example structure to allocate */ - register int extra; /* any extra uninitialized bytes needed contiguously */ +struct xobject *t1_Allocate( + register int size, /* number of bytes to allocate & initialize */ + void *p, /* example structure to allocate */ + register int extra) /* any extra uninitialized bytes needed contiguously */ { -#ifdef WIN32 - extern char *Xalloc(int); /* standard C routine */ -#else - extern char *Xalloc(); /* standard C routine */ -#endif +/* the actual argument p is one of + struct XYspace * + struct edgelist * + struct hintsegment * + struct region * + struct segment * + struct xobject * +*/ + register struct xobject *template = p; register struct xobject *r; /* @@ -354,9 +359,17 @@ In either case, the object must not be the NULL pointer. This preserves portability, as the C system Xfree() will not always accept NULL. */ -void Free(obj) /* non-ANSI to avoid overly strict type checking */ - register struct xobject *obj; /* structure to free */ +void Free(void *p) /* structure to free */ { +/* the actual argument p is one of + struct XYspace * + struct edgelist * + struct region * + struct segment * + struct xobject * +*/ + register struct xobject *obj = p; + if (obj->type == INVALIDTYPE) t1_abort("Free of already freed object?"); obj->type = INVALIDTYPE; @@ -394,9 +407,14 @@ done is to change one of the old temporary handles to a permanent one. 3-26-91 PNM */ -struct xobject *t1_Permanent(obj) /* non-ANSI to avoid overly strict type checking */ - register struct xobject *obj; /* object to be made permanent */ +struct xobject *t1_Permanent(void *p) /* object to be made permanent */ { +/* the actual argument p is one of + struct segment * + struct xobject * +*/ + register struct xobject *obj = p; + IfTrace1((MustTraceCalls),"Permanent(%p)\n", obj); if ( (obj != NULL) && ( !(ISPERMANENT(obj->flag)) ) ) @@ -419,7 +437,8 @@ struct xobject *t1_Permanent(obj) /* non-ANSI to avoid overly strict type checki } return(obj); } - + +#if 0 /* :h3.Temporary() - Undoes the Effect of "Permanent()" @@ -438,8 +457,8 @@ lost a permanent handle and gained a temporary one. PNM 3-2-6-91 */ -struct xobject *xiTemporary(obj) /* non-ANSI to avoid overly strict type checking */ - register struct xobject *obj; /* object to be made permanent */ +struct xobject *xiTemporary( + register struct xobject *obj) /* object to be made not permanent */ { IfTrace1((MustTraceCalls),"Temporary(%p)\n", obj); @@ -472,6 +491,7 @@ struct xobject *xiTemporary(obj) /* non-ANSI to avoid overly strict type checkin } return(obj); } +#endif /* :h3.Dup() - Duplicate an Object @@ -483,8 +503,8 @@ Note that Dup() retains the state of the permanent flag. */ -struct xobject *t1_Dup(obj) /* non-ANSI avoids overly strict type checking */ - register struct xobject *obj; /* object to be duplicated */ +struct xobject *t1_Dup( + register struct xobject *obj) /* object to be duplicated */ { register char oldflag; /* copy of original object's flag byte */ @@ -528,22 +548,22 @@ let each module provide us a routine (or macro) that duplicates the objects it knows about. */ -struct xobject *t1_Copy(obj) - register struct xobject *obj; /* object to be Copy'ed */ +struct xobject *t1_Copy( + register struct xobject *obj) /* object to be Copy'ed */ { if (obj == NULL) return(NULL); if (ISPATHTYPE(obj->type)) - obj = (struct xobject *) CopyPath(obj); + obj = (struct xobject *) CopyPath((struct segment *)obj); else switch (obj->type) { case SPACETYPE: - obj = (struct xobject *) CopySpace(obj); break; + obj = (struct xobject *) CopySpace((struct XYspace *)obj); break; case FONTTYPE: obj = (struct xobject *) CopyFont(obj); break; case REGIONTYPE: - obj = (struct xobject *) CopyRegion(obj); break; + obj = (struct xobject *) CopyRegion((struct region *)obj); break; case PICTURETYPE: obj = (struct xobject *) CopyPicture(obj); break; case LINESTYLETYPE: @@ -565,9 +585,15 @@ struct xobject *t1_Copy(obj) This can get complicated. Just like with Copy(), we let the experts handle it. */ -struct xobject *Destroy(obj) /* non-ANSI avoids overly strict type checking */ - register struct xobject *obj; /* object to be destroyed */ +struct xobject *Destroy(void *p) /* object to be destroyed */ { +/* the actual argument p is one of + struct region * + struct segment * + struct xobject * +*/ + register struct xobject *obj = p; + IfTrace1((MustTraceCalls),"Destroy(%p)\n", obj); if (obj == NULL) @@ -577,11 +603,11 @@ struct xobject *Destroy(obj) /* non-ANSI avoids overly strict type checking */ return(NULL); } if (ISPATHTYPE(obj->type)) - KillPath(obj); + KillPath((struct segment *)obj); else { switch (obj->type) { case REGIONTYPE: - KillRegion(obj); + KillRegion((struct region *)obj); break; case SPACETYPE: KillSpace(obj); @@ -722,8 +748,7 @@ because permanent objects, by definition, are persistent. 3-2-6-91 PNM :eol. */ -struct xobject *t1_Unique(obj) - struct xobject *obj; +struct xobject *t1_Unique(struct xobject *obj) { /* if the original object is not already unique, make a unique copy...Note also that if the object was not permanent, we must @@ -760,7 +785,7 @@ have to handle that with #defines too. */ /*SHARED LINE(S) ORIGINATED HERE*/ -static char *ErrorMessage = NULL; +static const char *ErrorMessage = NULL; /* :h3.Pragmatics() - Set/Reset Debug Flags @@ -916,12 +941,20 @@ Consume(int n, ...) :h3.TypeErr() - Handles "Invalid Object Type" Errors */ -struct xobject *TypeErr(name, obj, expect, ret) /* non-ANSI avoids overly strict type checking */ - char *name; /* Name of routine (for error message) */ - struct xobject *obj; /* Object in error */ - int expect; /* type expected */ - struct xobject *ret; /* object to return to caller */ +struct xobject *TypeErr( + const char *name, /* Name of routine (for error message) */ + void *p, /* Object in error */ + int expect, /* type expected */ + void *q) /* object to return to caller */ { +/* the actual arguments p and q are one of + struct XYspace * + struct segment * + struct xobject * +*/ + struct xobject *obj = p; + struct xobject *ret = q; + static char typemsg[80]; if (MustCrash) @@ -998,8 +1031,6 @@ This is a subroutine of TypeErr() and ArgErr(). static int ObjectPostMortem(register struct xobject *obj) { - extern struct XYspace *USER; - Pragmatics("Debug", 10); IfTrace2(TRUE,"Bad object is of %s type %p\n", TypeFmt(obj->type), obj); @@ -1019,11 +1050,19 @@ is returned to the caller in case MustCrash is FALSE and ArgErr returns to its caller. */ -struct xobject *ArgErr(str, obj, ret) /* non-ANSI avoids overly strict type checking */ - char *str; /* description of error */ - struct xobject *obj; /* object, if any, that was in error */ - struct xobject *ret; /* object returned to caller or NULL */ +struct xobject *ArgErr( + const char *str, /* description of error */ + void *p, /* object, if any, that was in error */ + void *q) /* object returned to caller or NULL */ { +/* the actual argument p is one of + struct XYspace * + struct segment * + struct xobject * +*/ + struct xobject *obj = p; + struct xobject *ret = q; + if (MustCrash) LineIOTrace = TRUE; IfTrace1(TRUE,"ARGUMENT ERROR-- %s.\n", str); @@ -1046,8 +1085,7 @@ environment). static int test = 0; /*ARGSUSED*/ -void t1_abort(str) - const char *str; +void t1_abort(const char *str) { LineIOTrace = TRUE; IfTrace1(TRUE,"\nABORT: reason='%s'\n", str); @@ -1062,9 +1100,9 @@ void t1_abort(str) :h4.ErrorMsg() - Return the User an Error Message */ -char *ErrorMsg() +const char *ErrorMsg(void) { - register char *r; + register const char *r; r = ErrorMessage; ErrorMessage = NULL; @@ -1080,7 +1118,7 @@ anyway.) Note that TYPE1IMAGER makes no assumptions about the size of an 'int'! :i1/portability assumptions/ */ -void InitImager() +void InitImager(void) { /* Check to see if we have been using our own malloc. If so,*/ @@ -1103,14 +1141,16 @@ In some environments, constants and/or exception handling need to be This only makes sense in a server environment; true TYPE1IMAGER needs do nothing. */ -void TermImager() +void TermImager(void) { return; } +#if 0 /* :h4.reportusage() - A Stub to Get a Clean Link with Portable PMP */ -void reportusage() +void reportusage(void) { return; } +#endif diff --git a/Build/source/texk/ps2pkm/objects.h b/Build/source/texk/ps2pkm/objects.h index 4c6c0d4557b..aad912d3f65 100644 --- a/Build/source/texk/ps2pkm/objects.h +++ b/Build/source/texk/ps2pkm/objects.h @@ -41,21 +41,18 @@ #include "types.h" #define Permanent(obj) t1_Permanent(obj) -#define Temporary(obj) t1_Temporary(obj) #define Destroy(obj) t1_Destroy(obj) #define Dup(obj) t1_Dup(obj) -#define InitImager() t1_InitImager() -#define TermImager() t1_TermImager() -#define Pragmatics(f,v) t1_Pragmatics(f,v) -#define ErrorMsg() t1_ErrorMsg() - -struct xobject *t1_Permanent(); /* make an object permanent */ -struct xobject *t1_Temporary(); /* make an object temporary */ -struct xobject *t1_Destroy(); /* destroy an object */ -struct xobject *t1_Dup(); /* duplicate an object */ -void t1_InitImager(); /* initialize TYPE1IMAGER */ -void t1_TermImager(); /* terminate TYPE1IMAGER */ -char *t1_ErrorMsg(); /* return last TYPE1IMAGER error message */ +#define InitImager t1_InitImager +#define TermImager t1_TermImager +#define ErrorMsg t1_ErrorMsg + +struct xobject *t1_Permanent(void *); /* make an object permanent */ +struct xobject *t1_Destroy(void *); /* destroy an object */ +struct xobject *t1_Dup(struct xobject *); /* duplicate an object */ +void t1_InitImager(void); /* initialize TYPE1IMAGER */ +void t1_TermImager(void); /* terminate TYPE1IMAGER */ +const char *t1_ErrorMsg(void); /* return last TYPE1IMAGER error message */ /*END SHARED*/ /*SHARED*/ @@ -69,14 +66,18 @@ char *t1_ErrorMsg(); /* return last TYPE1IMAGER error message #define Copy(obj) t1_Copy(obj) #define Unique(obj) t1_Unique(obj) -void t1_abort(); /* crash; software logic error */ -struct xobject *t1_Allocate(); /* allocate memory */ -void t1_Free(); /* free memory */ -struct xobject *t1_Unique(); /* make a unique temporary copy of an object */ -struct xobject *t1_ArgErr(); /* handle argument errors */ -struct xobject *t1_TypeErr(); /* handle 'bad type' argument errors */ +void t1_abort(const char *); /* crash; software logic error */ +struct xobject *t1_Allocate(int, void *, int); /* allocate memory */ +void t1_Free(void *); /* free memory */ +struct xobject *t1_Unique(struct xobject *); + /* make a unique temporary copy of an object */ +struct xobject *t1_ArgErr(const char *, void *, void *); + /* handle argument errors */ +struct xobject *t1_TypeErr(const char *, void *, int, void *); + /* handle 'bad type' argument errors */ void t1_Consume(int, ...); /* consume a variable number of arguments */ -struct xobject *t1_Copy(); /* make a new copy, not reference bump PNM */ +struct xobject *t1_Copy(struct xobject *); + /* make a new copy, not reference bump PNM */ /*END SHARED*/ /*SHARED*/ @@ -295,21 +296,4 @@ extern char Continuity INITIALIZED(2); extern void Xfree(void*); -/* -We define other routines formatting parameters -*/ -#define DumpArea(area) t1_DumpArea(area) -#define DumpText(text) t1_DumpText(text) -#define DumpPath(path) t1_DumpPath(path) -#define DumpSpace(space) t1_DumpSpace(space) -#define DumpEdges(e) t1_DumpEdges(e) -#define FormatFP(s,p) t1_FormatFP(s,p) - -void t1_DumpArea(); /* dump a region structure */ -void t1_DumpText(); /* dump a textpath structure */ -void t1_DumpPath(); /* dump a path list */ -void t1_DumpSpace(); /* dump a coordinate space structure */ -void t1_DumpEdges(); /* dump a region's edge list */ -void t1_FormatFP(); /* dump a format a "fractpel" coordinate */ - /*END SHARED*/ diff --git a/Build/source/texk/ps2pkm/paths.c b/Build/source/texk/ps2pkm/paths.c index 4c80ac69528..77d7bde70c2 100644 --- a/Build/source/texk/ps2pkm/paths.c +++ b/Build/source/texk/ps2pkm/paths.c @@ -50,10 +50,8 @@ The included files are: #include "fonts.h" /* understands about TEXTTYPEs */ #include "pictures.h" /* understands about handles */ #include "strokes.h" /* understands how to coerce stroke paths */ -#include "trig.h" static void UnClose(struct segment *); -extern void DumpText(struct segment *); /* :h3.Routines Available to the TYPE1IMAGER User @@ -116,8 +114,8 @@ text, which has some auxilliary things involved. We don't feel competent to duplicate text in this module, so we call someone who knows how (in the FONTS module). */ -struct segment *CopyPath(p0) - register struct segment *p0; /* path to duplicate */ +struct segment *CopyPath( + register struct segment *p0) /* path to duplicate */ { register struct segment *p,*n,*last,*anchor; @@ -154,8 +152,8 @@ At this point we have a chain of newly allocated segments hanging off Destroying a path is simply a matter of freeing each segment in the linked list. Again, we let the experts handle text. */ -void KillPath(p) - register struct segment *p; /* path to destroy */ +void KillPath( + register struct segment *p) /* path to destroy */ { register struct segment *linkp; /* temp register holding next segment*/ @@ -204,9 +202,9 @@ static struct segment movetemplate = { MOVETYPE, 0, 1, sizeof(struct segment), 0 */ -struct segment *t1_Loc(S, x, y) - register struct XYspace *S; /* coordinate space to interpret X,Y */ - DOUBLE x,y; /* destination point */ +struct segment *t1_Loc( + register struct XYspace *S, /* coordinate space to interpret X,Y */ + DOUBLE x, DOUBLE y) /* destination point */ { register struct segment *r; @@ -226,9 +224,9 @@ struct segment *t1_Loc(S, x, y) :h3.ILoc() - Loc() With Integer Arguments */ -struct segment *ILoc(S, x, y) - register struct XYspace *S; /* coordinate space to interpret X,Y */ - register int x,y; /* destination point */ +struct segment *ILoc( + register struct XYspace *S, /* coordinate space to interpret X,Y */ + register int x, register int y) /* destination point */ { register struct segment *r; @@ -245,31 +243,6 @@ struct segment *ILoc(S, x, y) } /* -:h3.SubLoc() - Vector Subtraction of Two Locition Objects - -This user operator subtracts two location objects, yielding a new -location object that is the result. - -The symmetrical function AddLoc() is totally redundent with Join(), -so it is not provided. -*/ - -struct segment *SubLoc(p1, p2) - register struct segment *p1; - register struct segment *p2; -{ - IfTrace2((MustTraceCalls),"SubLoc(%p, %p)\n", p1, p2); - - ARGCHECK(!ISLOCATION(p1), "SubLoc: bad first arg", p1, NULL, (0), struct segment *); - ARGCHECK(!ISLOCATION(p2), "SubLoc: bad second arg", p2, NULL, (0), struct segment *); - p1 = UniquePath(p1); - p1->dest.x -= p2->dest.x; - p1->dest.y -= p2->dest.y; - ConsumePath(p2); - return(p1); -} - -/* :h2.Straight Line Segments :h3.PathSegment() - Create a Generic Path Segment @@ -281,9 +254,9 @@ conversion is unnecessary. PathSegment() is an internal routine provided to the rest of TYPE1IMAGER for handling these cases. */ -struct segment *t1_PathSegment(type, x, y) - int type; /* LINETYPE or MOVETYPE */ - fractpel x,y; /* where to go to, if known */ +struct segment *t1_PathSegment( + int type, /* LINETYPE or MOVETYPE */ + fractpel x, fractpel y) /* where to go to, if known */ { register struct segment *r; /* newly created segment */ @@ -299,8 +272,8 @@ struct segment *t1_PathSegment(type, x, y) This involves just creating and filling out a segment structure: */ -struct segment *Line(P) - register struct segment *P; /* relevant coordinate space */ +struct segment *Line( + register struct segment *P) /* relevant coordinate space */ { IfTrace1((MustTraceCalls),"..Line(%p)\n", P); @@ -334,10 +307,10 @@ inversely related to the length |CD|. Point A is always point (0,0). This is just a simple matter of filling out a 'beziersegment' structure: */ -struct beziersegment *Bezier(B, C, D) - register struct segment *B; /* second control point */ - register struct segment *C; /* third control point */ - register struct segment *D; /* fourth control point (ending point) */ +struct beziersegment *Bezier( + register struct segment *B, /* second control point */ + register struct segment *C, /* third control point */ + register struct segment *D) /* fourth control point (ending point) */ { /* added reference field of 1 to temporary template below 3-26-91 PNM */ static struct beziersegment template = @@ -375,15 +348,15 @@ This is temporary code while we experiment with hints. */ /*SHARED LINE(S) ORIGINATED HERE*/ -struct hintsegment *Hint(S, ref, width, orientation, hinttype, adjusttype, direction, label) - struct XYspace *S; - float ref; - float width; - char orientation; - char hinttype; - char adjusttype; - char direction; - int label; +struct hintsegment *Hint( + struct XYspace *S, + float ref, + float width, + char orientation, + char hinttype, + char adjusttype, + char direction, + int label) { /* added reference field of 1 to hintsegment template below 3-26-91 PNM */ static struct hintsegment template = { HINTTYPE, 0, 1, sizeof(struct hintsegment), 0, @@ -450,8 +423,8 @@ types other than paths, and also check for certain path consistency rules. */ -struct segment *Join(p1, p2) - register struct segment *p1,*p2; +struct segment *Join( + register struct segment *p1, register struct segment *p2) { IfTrace2((MustTraceCalls),"..Join(%p, %p)\n", p1, p2); /* @@ -461,7 +434,7 @@ We start with a whole bunch of very straightforward argument tests: if (!ISPATHTYPE(p2->type)) { if (p1 == NULL) - return((struct segment *)Unique(p2)); + return((struct segment *)Unique((struct xobject *)p2)); switch (p1->type) { @@ -496,7 +469,7 @@ are when 'p2' begins with a move-type segment: } } else - return((struct segment *)Unique(p1)); + return((struct segment *)Unique((struct xobject *)p1)); if (p1 != NULL) { if (!ISPATHTYPE(p1->type)) @@ -572,12 +545,12 @@ actually do the join. This is just invoking the CONCAT macro: This internal function is quicker than a full-fledged join because it can do much less checking. */ - -struct segment *t1_JoinSegment(before, type, x, y, after) - register struct segment *before; /* path to join before new segment */ - int type; /* type of new segment (MOVETYPE or LINETYPE) */ - fractpel x,y; /* x,y of new segment */ - register struct segment *after; /* path to join after new segment */ + +struct segment *t1_JoinSegment( + register struct segment *before, /* path to join before new segment */ + int type, /* type of new segment (MOVETYPE or LINETYPE) */ + fractpel x, fractpel y, /* x,y of new segment */ + register struct segment *after) /* path to join after new segment */ { register struct segment *r; /* returned path built here */ @@ -599,20 +572,19 @@ struct segment *t1_JoinSegment(before, type, x, y, after) */ -struct segment *t1_ClosePath(p0,lastonly) - register struct segment *p0; /* path to close */ - register int lastonly; /* flag deciding to close all subpaths or... */ +struct segment *t1_ClosePath( + register struct segment *p0, /* path to close */ + register int lastonly) /* flag deciding to close all subpaths or... */ { register struct segment *p,*last,*start; /* used in looping through path */ register fractpel x,y; /* current position in path */ register fractpel firstx,firsty; /* start position of sub path */ - register struct segment *lastnonhint; /* last non-hint segment in path */ IfTrace1((MustTraceCalls),"ClosePath(%p)\n", p0); if (p0 != NULL && p0->type == TEXTTYPE) return(UniquePath(p0)); if (p0->type == STROKEPATHTYPE) - return((struct segment *)Unique(p0)); + return((struct segment *)Unique((struct xobject *)p0)); /* * NOTE: a null closed path is different from a null open path * and is denoted by a closed (0,0) move segment. We make @@ -634,8 +606,7 @@ At each break, we insert a close segment. */ for (p = p0, x = y = 0, start = NULL; p != NULL; - x += p->dest.x, y += p->dest.y, last = p, p = p->link) - { + x += p->dest.x, y += p->dest.y, last = p, p = p->link) { if (p->type == MOVETYPE) { if (start != NULL && (lastonly?p->link==NULL:TRUE) && @@ -648,22 +619,18 @@ At each break, we insert a close segment. INSERT(last, r, p); r->flag |= LASTCLOSED(ON); /*< adjust 'last' if possible for a 0,0 close >*/ -{ - + #define CLOSEFUDGE 3 /* if we are this close, let's change last segment */ - - if (r->dest.x != 0 || r->dest.y != 0) { - if (r->dest.x <= CLOSEFUDGE && r->dest.x >= -CLOSEFUDGE - && r->dest.y <= CLOSEFUDGE && r->dest.y >= -CLOSEFUDGE) { - IfTrace2((PathDebug), - "ClosePath forced closed by (%d,%d)\n", - r->dest.x, r->dest.y); - lastnonhint->dest.x += r->dest.x; - lastnonhint->dest.y += r->dest.y; - r->dest.x = r->dest.y = 0; - } - } -} + + if (r->dest.x != 0 || r->dest.y != 0) { + if (r->dest.x <= CLOSEFUDGE && r->dest.x >= -CLOSEFUDGE + && r->dest.y <= CLOSEFUDGE && r->dest.y >= -CLOSEFUDGE) { + IfTrace2((PathDebug), + "ClosePath forced closed by (%d,%d)\n", + r->dest.x, r->dest.y); + r->dest.x = r->dest.y = 0; + } + } if (p->link != NULL) { p->dest.x += x - firstx; p->dest.y += y - firsty; @@ -675,8 +642,6 @@ At each break, we insert a close segment. firstx = x + p->dest.x; firsty = y + p->dest.y; } - else if (p->type != HINTTYPE) - lastnonhint = p; } return(p0); } @@ -702,8 +667,8 @@ static struct segment *ReverseSubPath(struct segment *); /* reverses a single s This operator reverses the entire path. */ -struct segment *Reverse(p) - register struct segment *p; /* full path to reverse */ +struct segment *Reverse( + register struct segment *p) /* full path to reverse */ { register struct segment *r; /* output path built here */ register struct segment *nextp; /* contains next sub-path */ @@ -863,8 +828,8 @@ This user operator reverses the sub-paths in a path, but leaves the already established. */ -struct segment *ReverseSubPaths(p) - register struct segment *p; /* input path */ +struct segment *ReverseSubPaths( + register struct segment *p) /* input path */ { register struct segment *r; /* reversed path will be created here */ register struct segment *nextp; /* temporary variable used in loop */ @@ -953,9 +918,9 @@ The transform is described as a "space", that way we can use our old friend the "iconvert" function, which should be very efficient. */ -struct segment *PathTransform(p0, S) - register struct segment *p0; /* path to transform */ - register struct XYspace *S; /* pseudo space to transform in */ +struct segment *PathTransform( + register struct segment *p0, /* path to transform */ + register struct XYspace *S) /* pseudo space to transform in */ { register struct segment *p; /* to loop through path with */ register fractpel newx,newy; /* current transformed position in path */ @@ -1041,9 +1006,9 @@ struct segment *PathTransform(p0, S) :h3.PathDelta() - Return a Path's Ending Point */ -void PathDelta(p, pt) - register struct segment *p; /* input path */ - register struct fractpoint *pt; /* pointer to x,y to set */ +void PathDelta( + register struct segment *p, /* input path */ + register struct fractpoint *pt) /* pointer to x,y to set */ { struct fractpoint mypoint; /* I pass this to TextDelta */ register fractpel x,y; /* working variables for path current point */ @@ -1069,8 +1034,8 @@ This function is called by image code, when we know the size of the image in pels, and need to get a bounding box path that surrounds it. The starting/ending handle is in the lower right hand corner. */ -struct segment *BoundingBox(h, w) - register pel h,w; /* size of box */ +struct segment *BoundingBox( + register pel h, register pel w) /* size of box */ { register struct segment *path; @@ -1088,10 +1053,11 @@ struct segment *BoundingBox(h, w) :h3.QueryLoc() - Return the X,Y of a Locition */ -void QueryLoc(P, S, xP, yP) - register struct segment *P; /* location to query, not consumed */ - register struct XYspace *S; /* XY space to return coordinates in */ - register DOUBLE *xP,*yP; /* coordinates returned here */ +void QueryLoc( + register struct segment *P, /* location to query, not consumed */ + register struct XYspace *S, /* XY space to return coordinates in */ + register DOUBLE *xP, /* coordinates ... */ + register DOUBLE *yP) /* ... returned here */ { IfTrace4((MustTraceCalls),"QueryLoc(P=%p, S=%p, (%p, %p))\n", P, S, xP, yP); @@ -1116,13 +1082,13 @@ a move segment, for example, he only needs to pass pointers to return one control point. */ -void QueryPath(path, typeP, Bp, Cp, Dp, fP) - register struct segment *path; /* path to check */ - register int *typeP; /* return the type of path here */ - register struct segment **Bp; /* return location of first point */ - register struct segment **Cp; /* return location of second point */ - register struct segment **Dp; /* return location of third point */ - register DOUBLE *fP; /* return Conic sharpness */ +void QueryPath( + register struct segment *path, /* path to check */ + register int *typeP, /* return the type of path here */ + register struct segment **Bp, /* return location of first point */ + register struct segment **Cp, /* return location of second point */ + register struct segment **Dp, /* return location of third point */ + register DOUBLE *fP) /* return Conic sharpness */ { register int coerced = FALSE; /* did I coerce a text path? */ @@ -1190,11 +1156,11 @@ void QueryPath(path, typeP, Bp, Cp, Dp, fP) Returns the bounding box by setting the user's variables. */ -void QueryBounds(p0, S, xminP, yminP, xmaxP, ymaxP) - register struct segment *p0; /* object to check for bound */ - struct XYspace *S; /* coordinate space of returned values */ - DOUBLE *xminP,*yminP; /* lower left hand corner (set by routine) */ - DOUBLE *xmaxP,*ymaxP; /* upper right hand corner (set by routine) */ +void QueryBounds( + register struct segment *p0, /* object to check for bound */ + struct XYspace *S, /* coordinate space of returned values */ + DOUBLE *xminP, DOUBLE *yminP, /* lower left hand corner (set by routine) */ + DOUBLE *xmaxP, DOUBLE *ymaxP) /* upper right hand corner (set by routine) */ { register struct segment *path; /* loop variable for path segments */ register fractpel lastx,lasty; /* loop variables: previous endingpoint */ @@ -1218,10 +1184,10 @@ void QueryBounds(p0, S, xminP, yminP, xmaxP, ymaxP) switch(p0->type) { case STROKEPATHTYPE: /* replaced DupStrokePath() with Dup() 3-26-91 PNM */ - p0 = (struct segment *) DoStroke(Dup(p0)); + p0 = (struct segment *) DoStroke(Dup((struct xobject *)p0)); /* no break here, we have a region in p0 */ case REGIONTYPE: - p0 = RegionBounds(p0); + p0 = RegionBounds((struct region *)p0); break; case PICTURETYPE: @@ -1236,7 +1202,7 @@ void QueryBounds(p0, S, xminP, yminP, xmaxP, ymaxP) } if (p0->type == TEXTTYPE) { /* replaced CopyPath() with Dup() 3-26-91 PNM */ - p0 = (struct segment *)CoerceText(Dup(p0)); /* there are faster ways */ + p0 = (struct segment *)CoerceText(Dup((struct xobject *)p0)); /* there are faster ways */ coerced = TRUE; } if (p0->type == MOVETYPE) { @@ -1358,9 +1324,7 @@ done: /* :h3.BoxPath() */ -struct segment *BoxPath(S, h, w) - struct XYspace *S; - int h,w; +struct segment *BoxPath(struct XYspace *S, int h, int w) { struct segment *path; @@ -1377,8 +1341,7 @@ shorter. It can be used in conjunction with QueryPath(), for example, to ask about an entire path. */ -struct segment *DropSegment(path) - register struct segment *path; +struct segment *DropSegment(register struct segment *path) { IfTrace1((MustTraceCalls),"DropSegment(%p)\n", path); if (path != NULL && path->type == STROKEPATHTYPE) @@ -1399,8 +1362,8 @@ This routine takes the path and returns a new path consists of the first segment only. */ -struct segment *HeadSegment(path) - register struct segment *path; /* input path */ +struct segment *HeadSegment( + register struct segment *path) /* input path */ { IfTrace1((MustTraceCalls),"HeadSegment(%p)\n", path); if (path == NULL) @@ -1418,91 +1381,3 @@ struct segment *HeadSegment(path) path->last = path; return(path); } - -/* -:h2.Path Debug Routines - -:h3.DumpPath() - Display a Path on the Trace File -*/ - -void DumpPath(p) - register struct segment *p; -{ - register fractpel x,y; - register fractpel lastx,lasty; - DOUBLE roundness; - - IfTrace1(TRUE,"Dumping path, anchor=%p:\n", p); - lastx = lasty = 0; - - for (;p != NULL; p=p->link) { - - IfTrace0(TRUE,". "); - x = p->dest.x; - y = p->dest.y; - switch (p->type) { - - case LINETYPE: - IfTrace1(TRUE,". line<%x> to", (LONG) p->flag); - IfTrace4(TRUE," (%d,%d), delta=(%d,%d)", - x + lastx, y + lasty, x, y); - break; - - case MOVETYPE: - IfTrace1(TRUE,"MOVE<%x> to", (LONG) p->flag); - IfTrace4(TRUE,"(%d,%d), delta=(%d,%d)", - x + lastx, y + lasty, x, y); - break; - - case CONICTYPE: - { - register struct conicsegment *cp = (struct conicsegment *) p; - - roundness = cp->roundness; - IfTrace2(TRUE, ". conic to (%d,%d),", - x + lastx, y + lasty); - IfTrace3(TRUE," M=(%d,%d), r=%f", cp->M.x + lastx, - cp->M.y + lasty, roundness); - } - break; - - case BEZIERTYPE: - { - register struct beziersegment *bp = (struct beziersegment *) p; - - IfTrace4(TRUE,". bezier to (%d,%d), B=(%d,%d)", - x + lastx, y + lasty, - bp->B.x + lastx, bp->B.y + lasty); - IfTrace2(TRUE, ", C=(%d,%d)", - bp->C.x + lastx, bp->C.y + lasty); - } - break; - - case HINTTYPE: - { - register struct hintsegment *hp = (struct hintsegment *) p; - - IfTrace4(TRUE,". hint ref=(%d,%d), width=(%d,%d)", - hp->ref.x + lastx, hp->ref.y + lasty, - hp->width.x, hp->width.y); - IfTrace4(TRUE, ", %c %c %c %c", - hp->orientation, hp->hinttype, - hp->adjusttype, hp->direction); - IfTrace1(TRUE, ", %d", (LONG) hp->label); - } - break; - - case TEXTTYPE: - DumpText(p); - break; - - default: - IfTrace0(TRUE, "bad path segment?"); - } - IfTrace1(TRUE," at %p\n", p); - lastx += x; - lasty += y; - } -} - - diff --git a/Build/source/texk/ps2pkm/paths.h b/Build/source/texk/ps2pkm/paths.h index a09debac579..f16fd551361 100644 --- a/Build/source/texk/ps2pkm/paths.h +++ b/Build/source/texk/ps2pkm/paths.h @@ -45,7 +45,9 @@ #define Reverse(p) t1_Reverse(p) #define ReverseSubPaths(p) t1_ReverseSubPaths(p) #define AddLoc(p1,p2) t1_Join(p1,p2) +#if 0 #define SubLoc(p1,p2) t1_SubLoc(p1,p2) +#endif #define DropSegment(p) t1_DropSegment(p) #define HeadSegment(p) t1_HeadSegment(p) #define QueryLoc(P,S,x,y) t1_QueryLoc(P,S,x,y) @@ -53,25 +55,38 @@ #define QueryBounds(p,S,x1,y1,x2,y2) t1_QueryBounds(p,S,x1,y1,x2,y2) -struct segment *t1_Loc(); /* create a location object (or "move" segment) */ -struct segment *t1_ILoc(); /* integer argument version of same */ -struct segment *t1_Line(); /* straight line path segment */ -struct segment *t1_Join(); /* join two paths or regions together */ -struct segment *t1_ClosePath(); /* close a path or path set */ +struct segment *t1_Loc(struct XYspace *, DOUBLE, DOUBLE); + /* create a location object (or "move" segment) */ +struct segment *t1_ILoc(struct XYspace *, int, int); + /* integer argument version of same */ +struct segment *t1_Line(struct segment *); /* straight line path segment */ +struct segment *t1_Join(struct segment *, struct segment *); + /* join two paths or regions together */ +struct segment *t1_ClosePath(struct segment *, int); + /* close a path or path set */ struct conicsegment *t1_Conic(); /* conic curve path segment */ struct conicsegment *t1_RoundConic(); /* ditto, specified another way */ struct conicsegment *t1_ArcP3(); /* circular path segment with three points */ struct conicsegment *t1_ArcCA(); /* ditto, with center point and angle */ -struct beziersegment *t1_Bezier(); /* Bezier third order curve path segment */ -struct hintsegment *t1_Hint(); /* produce a font 'hint' path segment */ -struct segment *t1_Reverse(); /* reverse the complete order of paths */ -struct segment *t1_ReverseSubPaths(); /* reverse only sub-paths; moves unchanged */ -struct segment *t1_SubLoc(); /* subtract two location objects */ -struct segment *t1_DropSegment(); /* Drop the first segment in a path */ -struct segment *t1_HeadSegment(); /* return the first segment in a path */ -void t1_QueryLoc(); /* Query location; return its (x,y) */ -void t1_QueryPath(); /* Query segment at head of a path */ -void t1_QueryBounds(); /* Query the bounding box of a path */ +struct beziersegment *t1_Bezier(struct segment *, struct segment *, + struct segment *); /* Bezier third order curve path segment */ +struct hintsegment *t1_Hint(struct XYspace *, float, float, char, + char, char, char, int); /* produce a font 'hint' path segment */ +struct segment *t1_Reverse(struct segment *); + /* reverse the complete order of paths */ +struct segment *t1_ReverseSubPaths(struct segment *); + /* reverse only sub-paths; moves unchanged */ +struct segment *t1_DropSegment(struct segment *); + /* Drop the first segment in a path */ +struct segment *t1_HeadSegment(struct segment *); + /* return the first segment in a path */ +void t1_QueryLoc(struct segment *, struct XYspace *, DOUBLE *, DOUBLE *); + /* Query location; return its (x,y) */ +void t1_QueryPath(struct segment *, int *typeP, struct segment **, + struct segment **, struct segment **, DOUBLE *); + /* Query segment at head of a path */ +void t1_QueryBounds(struct segment *, struct XYspace *, DOUBLE *, DOUBLE *, + DOUBLE *, DOUBLE *); /* Query the bounding box of a path */ /*END SHARED*/ /*SHARED*/ @@ -86,14 +101,20 @@ void t1_QueryBounds(); /* Query the bounding box of a path */ #define Hypoteneuse(dx,dy) t1_Hypoteneuse(dx,dy) #define BoxPath(S,h,w) t1_BoxPath(S,h,w) -struct segment *t1_CopyPath(); /* duplicate a path */ -void t1_KillPath(); /* destroy a path */ -struct segment *t1_PathXform(); /* transform a path arbitrarily */ -void t1_PathDelta(); /* calculate the ending point of a path */ -struct segment *t1_PathSegment(); /* produce a MOVE or LINE segment */ -struct segment *t1_JoinSegment(); /* join a MOVE or LINE segment to a path */ +struct segment *t1_CopyPath(struct segment *); /* duplicate a path */ +void t1_KillPath(struct segment *); /* destroy a path */ +struct segment *t1_PathXform(struct segment *, struct XYspace *); + /* transform a path arbitrarily */ +void t1_PathDelta(struct segment *, struct fractpoint *); + /* calculate the ending point of a path */ +struct segment *t1_BoundingBox(pel, pel); /* produce a Bounding Box Path */ +struct segment *t1_PathSegment(int, fractpel, fractpel); + /* produce a MOVE or LINE segment */ +struct segment *t1_JoinSegment(struct segment *, int, fractpel, fractpel, + struct segment *); /* join a MOVE or LINE segment to a path */ DOUBLE t1_Hypoteneuse(); /* returns the length of a line */ -struct segment *t1_BoxPath(); /* returns a rectangular path */ +struct segment *t1_BoxPath(struct XYspace *, int, int); + /* returns a rectangular path */ /*END SHARED*/ /*SHARED*/ diff --git a/Build/source/texk/ps2pkm/pictures.h b/Build/source/texk/ps2pkm/pictures.h index 69ecf0a4f6b..cd9aab1e094 100644 --- a/Build/source/texk/ps2pkm/pictures.h +++ b/Build/source/texk/ps2pkm/pictures.h @@ -44,5 +44,5 @@ struct picture { #define Phantom(o) t1_Phantom(o) #define Snap(o) t1_Snap(o) -struct segment *t1_Phantom(); -struct segment *t1_Snap(); +struct segment *t1_Phantom(struct segment *); +struct segment *t1_Snap(struct segment *); diff --git a/Build/source/texk/ps2pkm/pkout.c b/Build/source/texk/ps2pkm/pkout.c index aa97a0e99b0..82441da3844 100644 --- a/Build/source/texk/ps2pkm/pkout.c +++ b/Build/source/texk/ps2pkm/pkout.c @@ -42,7 +42,7 @@ void pk_open(char *pkname) if (pkfile == NULL) fatal("Can not open %s\n", pkname); } -void pk_close() +void pk_close(void) { fclose(pkfile); } @@ -356,6 +356,7 @@ static void pk_bitmap(int width, int cnt, int runlength[]) buff = 0; p_bit = 8; h_bit = width; state = 0; rc = 0; + r_on = s_on = r_count = s_count = r_i = s_i = 0; /* avoid warnings */ on = 1; count = runlength[0]; i = 1; while (i < cnt || state || count>0) { if (state) { @@ -537,12 +538,13 @@ static char *magnification (int dpi, int BDPI) { return mag_str; } } + fatal("PK could not determine magnification\n"); } /* * Barebone postample */ -void pk_postamble() +void pk_postamble(void) { pk1(PK_POST); while (pk_len % 4 != 0) pk1(PK_NOOP); diff --git a/Build/source/texk/ps2pkm/pkout.h b/Build/source/texk/ps2pkm/pkout.h index cd14c8e38ae..2fd03256e0d 100644 --- a/Build/source/texk/ps2pkm/pkout.h +++ b/Build/source/texk/ps2pkm/pkout.h @@ -21,7 +21,7 @@ typedef int INT32; void pk_open(char *name); /* A function for closing a pk file */ -void pk_close(); +void pk_close(void); /* A function for writing the preamble */ void pk_preamble(char *comment, /* comment string: source of font */ @@ -41,7 +41,7 @@ void pk_char(int char_code, /* character code 0..255 */ int (*next_pixel)()); /* user's pixel generator */ /* Barebone postample */ -void pk_postamble(); +void pk_postamble(void); /* PS2PK postamble */ void ps2pk_postamble(char *fontname, /* The real FontName from the afm */ diff --git a/Build/source/texk/ps2pkm/ps2pk.c b/Build/source/texk/ps2pkm/ps2pk.c index ab4ce9e3ee6..50b297b9f7b 100644 --- a/Build/source/texk/ps2pkm/ps2pk.c +++ b/Build/source/texk/ps2pkm/ps2pk.c @@ -197,21 +197,22 @@ /* begin interface to type 1 software */ #include "ffilest.h" +#include "objects.h" +#include "spaces.h" +#include "paths.h" +#include "regions.h" +#include "t1stdio.h" +#include "util.h" +#include "fontfcn.h" + FontScalableRec vals; FontEntryRec entry; #define Succesful 85 - -extern int Type1OpenScalable (); -extern void Type1RegisterFontFileFunctions(void); -extern void Type1CloseFont(); - /* end interface to type 1 software */ char *encfile = NULL, *afmfile; char ps2pk_args[MAXSTRLEN] = "none"; /* essential ps2pk arguments */ -typedef char *encoding[256]; -void getenc(char **, char **, encoding, int [256]); #define POINTSPERINCH 72.27 #define DEFAULTRES 300 @@ -227,13 +228,15 @@ int verbose = 0, debug = 0; /* Provide old (-O flag) and new (default) checksum function */ typedef unsigned int UINT32; -UINT32 checksum(encoding, int [256]); -UINT32 old_checksum(encoding, int [256]); +static UINT32 checksum(encoding, int [256]); +static UINT32 old_checksum(encoding, int [256]); UINT32 (*pchecksum)(encoding, int [256]) = checksum; /* Prototypes */ static int next_pixel(void); +#if 0 static void print_pixmap(void); +#endif static void first_pixel(CharInfoRec *); static INT32 TFMwidth(int); static int h_escapement(int); @@ -545,7 +548,7 @@ int main(int argc, char *argv[]) * The checksum should garantee that our PK file belongs to the correct TFM * file! Exactly the same as the afm2tfm (dvips5487) calculation. */ -UINT32 old_checksum(encoding ev, int width[256]) +static UINT32 old_checksum(encoding ev, int width[256]) { int i; UINT32 s1 = 0, s2 = 0; @@ -563,7 +566,7 @@ UINT32 old_checksum(encoding ev, int width[256]) /* * The new checksum algorithm. */ -UINT32 checksum(encoding ev, int width[256]) +static UINT32 checksum(encoding ev, int width[256]) { int i; UINT32 s1 = 0, s2 = 0; @@ -608,6 +611,7 @@ first_pixel(CharInfoRec *G) bitno = 0; } +#if 0 static void print_pixmap(void) { @@ -626,6 +630,7 @@ print_pixmap(void) p_data = save_p_data; bitno = 0; row = 0; col = 0; } +#endif /* Next function computes the width as a fix_word. A fix_word is an integer representation for fractions. The decimal point is @@ -666,8 +671,8 @@ add_option(const char *option, const char *value) /* Next stuff is needed by type1 rendering functions */ -int CheckFSFormat(format, fmask, bit, Byte, scan, glyph, image) - int format,fmask,*bit,*Byte,*scan,*glyph,*image; +int CheckFSFormat(int format, int fmask, int *bit, int *Byte, int *scan, + int *glyph, int *image) { *bit = *Byte = 1; *glyph = *scan = *image = 1; @@ -675,19 +680,21 @@ int CheckFSFormat(format, fmask, bit, Byte, scan, glyph, image) } -long MakeAtom(const char *p, unsigned int len, Bool foo) +long MakeAtom(const char *p, unsigned int len, int foo) { return (long)p; } +#if 0 void GetClientResolutions(int *resP) { *resP = 0; } +#endif -char *Xalloc(size_t size) +void *Xalloc(size_t size) { - char *p; + void *p; p = malloc(size); if (p == NULL) fatal("Out of memory\n"); return p; @@ -697,21 +704,3 @@ void Xfree(void *p) { free(p); } - -#ifdef WIN32 -void FontDefaultFormat(int *bit, int *byte, - CharInfoRec *glyphs, int *scan) { ; } -void FontFileRegisterRenderer(FontRendererRec *foo) { ; } -void FontParseXLFDName(char *scaledName, FontScalablePtr Vals, int foo ) { ; } -FontComputeInfoAccelerators(FontInfoPtr foo) { ; } -#else -void FontDefaultFormat() { ; } - -void FontFileRegisterRenderer() { ; } - -GenericGetBitmaps() { ; } -GenericGetExtents() { ; } - -void FontParseXLFDName() { ; } -FontComputeInfoAccelerators() { ; } -#endif diff --git a/Build/source/texk/ps2pkm/regions.c b/Build/source/texk/ps2pkm/regions.c index 657d9214526..b0d16bab16c 100644 --- a/Build/source/texk/ps2pkm/regions.c +++ b/Build/source/texk/ps2pkm/regions.c @@ -43,8 +43,8 @@ The included files are: #include "types.h" #include "objects.h" #include "spaces.h" -#include "regions.h" #include "paths.h" +#include "regions.h" #include "curves.h" #include "lines.h" #include "pictures.h" @@ -56,14 +56,11 @@ static void newfilledge(register struct region *, fractpel, fractpel, fractpel, fractpel, int); static void vertjoin(register struct edgelist *, register struct edgelist *); static void discard(register struct edgelist *, register struct edgelist *); -static void cedgemin(register int, register pel *, register pel); -static void cedgemax(register int, register pel *, register pel); static void edgemin(register int, register pel *, register pel *); static void edgemax(register int, register pel *, register pel *); static struct edgelist *splitedge(struct edgelist *, pel); static int touches(int, pel *, pel *); static int crosses(int, pel *, pel *); -static void edgecheck(struct edgelist *, int, int); static struct edgelist *NewEdge(pel, pel, pel, pel, pel *, int); /* @@ -227,8 +224,8 @@ associated (thresholded) picture. Note - added conditional return based on references 3-26-91 PNM */ -void KillRegion(area) - register struct region *area; /* area to free */ +void KillRegion( + register struct region *area) /* area to free */ { register struct edgelist *p; /* loop variable */ register struct edgelist *next; /* loop variable */ @@ -250,8 +247,8 @@ void KillRegion(area) /* :h3.CopyRegion() - Makes a Copy of a Region */ -struct region *CopyRegion(area) - register struct region *area; /* region to duplicate */ +struct region *CopyRegion( + register struct region *area) /* region to duplicate */ { register struct region *r; /* output region built here */ register struct edgelist *last; /* loop variable */ @@ -272,7 +269,7 @@ struct region *CopyRegion(area) } if (area->thresholded != NULL) /* replaced DupPicture with Dup() 3-26-91 PNM */ - r->thresholded = (struct picture *)Dup(area->thresholded); + r->thresholded = (struct picture *)Dup((struct xobject *)area->thresholded); return(r); } /* @@ -357,16 +354,19 @@ structure; for Interior, this function is 'newfilledge'. then, call SortSwath to sort it onto the linked list being built at the region "anchor". :eol. - + By making the function called by ChangeDirection be a parameter of the region, we allow the same ChangeDirection logic to be used by stroking. */ +static struct edgelist *SortSwath( struct edgelist *, struct edgelist *, + struct edgelist *(*)()); + /*SHARED LINE(S) ORIGINATED HERE*/ -struct region *Interior(p, fillrule) - register struct segment *p; /* take interior of this path */ - register int fillrule; /* rule to follow if path crosses itself */ +struct region *Interior( + register struct segment *p, /* take interior of this path */ + register int fillrule) /* rule to follow if path crosses itself */ { register fractpel x,y; /* keeps ending point of path segment */ fractpel lastx,lasty; /* previous x,y from path segment before */ @@ -404,8 +404,8 @@ user asked, >1: do it regardless). return((struct region *)DoStroke(p)); else p = CoercePath(p); - } + R = (struct region *)Allocate(sizeof(struct region), &EmptyRegion, 0); ARGCHECK(!ISPATHANCHOR(p), "Interior: bad path", p, R, (0), struct region *); @@ -487,7 +487,7 @@ segment (or NULL), and each hint segment will be freed if necessary. while ((nextP != NULL) && (nextP->type == HINTTYPE)) { if (ProcessHints) - ProcessHint(nextP, x + hint.x, y + hint.y, &hint); + ProcessHint((struct hintsegment *)nextP, x + hint.x, y + hint.y, &hint); { register struct segment *saveP = nextP; @@ -650,14 +650,13 @@ emerging edgelist at 'anchor' by calling whatever "newedgefcn" is appropriate. */ -void ChangeDirection(type, R, x, y, dy) - int type; /* CD_FIRST, CD_CONTINUE, or CD_LAST */ - register struct region *R; /* region in which we are changing direction */ - fractpel x,y; /* current beginning x,y */ - fractpel dy; /* direction and magnitude of change in y */ +void ChangeDirection( + int type, /* CD_FIRST, CD_CONTINUE, or CD_LAST */ + register struct region *R, /* region in which we are changing direction */ + fractpel x, fractpel y, /* current beginning x,y */ + fractpel dy) /* direction and magnitude of change in y */ { register fractpel ymin,ymax; /* minimum and maximum Y since last call */ - register fractpel x_at_ymin,x_at_ymax; /* their respective X's */ register pel iy; /* nearest integer pel to 'y' */ register pel idy; /* nearest integer pel to 'dy' */ register int ydiff; /* allowed Y difference in 'currentworkarea' */ @@ -669,15 +668,11 @@ void ChangeDirection(type, R, x, y, dy) if (R->lastdy > 0) { ymin = R->firsty; - x_at_ymin = R->firstx; ymax = y; - x_at_ymax = x; } else { ymin = y; - x_at_ymin = x; ymax = R->firsty; - x_at_ymax = R->firstx; } if (ymax < ymin) @@ -736,12 +731,11 @@ building at "anchor". This function also has to keep the bounding box of the region up to date. */ +static struct edgelist *swathxsort(struct edgelist *, struct edgelist *); static void newfilledge(register struct region *R, fractpel xmin, fractpel xmax, fractpel ymin, fractpel ymax, int isdown) { - struct edgelist *swathxsort(); /* 'SortSwath' function */ - register pel pelxmin,pelymin,pelxmax,pelymax; /* pel versions of bounds */ register struct edgelist *edge; /* newly created edge */ @@ -792,16 +786,16 @@ exactly where the bottom part belongs. #define TOP(e) ((e)->ymin) /* the top of an edge (for readability */ #define BOTTOM(e) ((e)->ymax) /* the bottom of an edge (for readability */ -struct edgelist *SortSwath(anchor, edge, swathfcn) - struct edgelist *anchor; /* list being built */ - register struct edgelist *edge; /* incoming edge or pair of edges */ - struct edgelist *(*swathfcn)(); /* horizontal sorter */ +static struct edgelist *SortSwath( + struct edgelist *anchor, /* list being built */ + register struct edgelist *edge, /* incoming edge or pair of edges */ + struct edgelist *(*swathfcn)()) /* horizontal sorter */ { register struct edgelist *before,*after; struct edgelist base; if (RegionDebug > 0) { - IfTrace3(TRUE,"SortSwath(anchor=%p, edge=%p, fcn=%p)\n", + IfTrace3(TRUE,"SortSwath(anchor=%p, edge=%p, fcn=%p)\n", anchor, edge, swathfcn); } if (anchor == NULL) @@ -994,13 +988,13 @@ all swath functions, this function returns a pointer to the edge BEFORE the given edge in the sort. */ -struct edgelist *swathxsort(before0, edge) - register struct edgelist *before0; /* edge before this swath */ - register struct edgelist *edge; /* input edge */ +static struct edgelist *swathxsort( + register struct edgelist *before0, /* edge before this swath */ + register struct edgelist *edge) /* input edge */ { register struct edgelist *before; register struct edgelist *after; - register pel y; + register pel y = 0; before = before0; after = before->link; @@ -1070,9 +1064,9 @@ fun comes in they overlap the existing edges. Then some edges will disappear. */ -struct edgelist *SwathUnion(before0, edge) - register struct edgelist *before0; /* edge before the swath */ - register struct edgelist *edge; /* list of two edges to be unioned */ +static struct edgelist *SwathUnion( + register struct edgelist *before0, /* edge before the swath */ + register struct edgelist *edge) /* list of two edges to be unioned */ { register int h; /* saves height of edge */ register struct edgelist *rightedge; /* saves right edge of 'edge' */ @@ -1139,7 +1133,7 @@ out the new situation: if (after != NULL && TOP(after) == TOP(edge)) h -= touches(h, rightedge->xvalues, after->xvalues); if (h < h0) - SortSwath(before0->link, splitedge(edge, edge->ymin + h), t1_SwathUnion); + SortSwath(before0->link, splitedge(edge, edge->ymin + h), SwathUnion); /* go to "return" this edge pair; it is totally disjoint */ } else { @@ -1198,7 +1192,7 @@ in our current swath: if (h < h0) { SortSwath(before0->link, splitedge(edge, edge->ymin + h), - t1_SwathUnion); + SwathUnion); if (after == NULL || TOP(after) != TOP(edge)) for (after = before0->link; @@ -1220,6 +1214,7 @@ were overlapped and have been combined with the new incoming 'edge': } return(before); } +#if 0 /* :h3.swathrightmost() - Simply Sorts New Edge to Rightmost of Swath @@ -1227,9 +1222,9 @@ Like all swath functions, this function returns a pointer to the edge BEFORE the given edge in the sort. */ -struct edgelist *swathrightmost(before, edge) - register struct edgelist *before; /* edge before this swath */ - register struct edgelist *edge; /* input edge */ +struct edgelist *swathrightmost( + register struct edgelist *before, /* edge before this swath */ + register struct edgelist *edge) /* input edge */ { register struct edgelist *after; @@ -1243,6 +1238,7 @@ struct edgelist *swathrightmost(before, edge) return(before); } +#endif /* :h3.touches() - Returns the Remaining Height When Two Edges Touch @@ -1270,6 +1266,7 @@ static int crosses(register int h, register pel *left, register pel *right) break; return(h); } +#if 0 /* :h3.cedgemin() - Stores the Mininum of an Edge and an X Value */ @@ -1290,6 +1287,7 @@ static void cedgemax(register int h, register pel *e1, register pel x) if (*e1 < x) *e1 = x; } +#endif /* :h3.edgemin() - Stores the Mininum of Two Edges in First Edge */ @@ -1366,9 +1364,10 @@ region. */ -void MoveEdges(R, dx, dy) - register struct region *R; /* region to modify */ - register fractpel dx,dy; /* delta X and Y to move edge list by */ +void MoveEdges( + register struct region *R, /* region to modify */ + register fractpel dx, /* delta X ... */ + register fractpel dy) /* ... and Y to move edge list by */ { register struct edgelist *edge; /* for looping through edges */ @@ -1415,8 +1414,8 @@ From now on we will deal with dx and dy as integer pel values: It is an open question whether it pays in general to do this. */ -void UnJumble(region) - struct region *region; /* region to sort */ +void UnJumble( + struct region *region) /* region to sort */ { register struct edgelist *anchor; /* new lists built here */ register struct edgelist *edge; /* edge pointer for loop */ @@ -1429,7 +1428,7 @@ void UnJumble(region) t1_abort("UnJumble: unpaired edge?"); next = edge->link->link; edge->link->link = NULL; - anchor = SortSwath(anchor, edge, t1_SwathUnion); + anchor = SortSwath(anchor, edge, SwathUnion); } if (edge != NULL) @@ -1440,40 +1439,6 @@ void UnJumble(region) } /* -*/ - -static void OptimizeRegion( - struct region *R) /* region to optimize */ -{ - register pel *xP; /* pel pointer for inner loop */ - register int x; /* holds X value */ - register int xmin,xmax; /* holds X range */ - register int h; /* loop counter */ - register struct edgelist *e; /* edgelist pointer for loop */ - - R->flag |= ISRECTANGULAR(ON); - - for (e = R->anchor; VALIDEDGE(e); e=e->link) { - xmin = MAXPEL; - xmax = MINPEL; - for (h = e->ymax - e->ymin, xP = e->xvalues; --h >= 0;) { - x = *xP++; - if (x < xmin) xmin = x; - if (x > xmax) xmax = x; - } - if (xmin != xmax || (xmin != R->xmin && xmax != R->xmax)) - R->flag &= ~ISRECTANGULAR(ON); - if (xmin < e->xmin || xmax > e->xmax) - t1_abort("Tighten: existing edge bound was bad"); - if (xmin < R->xmin || xmax > R->xmax) - t1_abort("Tighten: existing region bound was bad"); - e->xmin = xmin; - e->xmax = xmax; - } - R->flag |= ISOPTIMIZED(ON); -} - -/* :h2.Miscelaneous Routines :h3.MoreWorkArea() - Allocate New Space for "edge" @@ -1484,10 +1449,10 @@ it gets a shorter 'dy'. */ /*ARGSUSED*/ -void MoreWorkArea(R, x1, y1, x2, y2) - struct region *R; /* region we are generating */ - fractpel x1,y1; /* starting point of line */ - fractpel x2,y2; /* ending point of line */ +void MoreWorkArea( + struct region *R, /* region we are generating */ + fractpel x1, fractpel y1, /* starting point of line */ + fractpel x2, fractpel y2) /* ending point of line */ { register int idy; /* integer dy of line */ @@ -1509,114 +1474,11 @@ void MoreWorkArea(R, x1, y1, x2, y2) } /* -:h3.BoxClip() - Clip a Region to a Rectangle - -BoxClip also duplicates the region if it is permanent. Note the -clipping box is specified in REGION coordinates, that is, in -coordinates relative to the region (0,0) point -*/ - -static struct region *BoxClip( - register struct region *R, /* region to clip */ - register pel xmin, register pel ymin, /* upper left hand corner of rectangle */ - register pel xmax, register pel ymax) /* lower right hand corner */ -{ - struct edgelist anchor; /* pretend edgelist to facilitate discards */ - register struct edgelist *e,*laste; - - IfTrace1((OffPageDebug),"BoxClip of %p:\n", R); - - R = UniqueRegion(R); - - if (xmin > R->xmin) { - IfTrace2((OffPageDebug),"BoxClip: left clip old %d new %d\n", - (LONG) R->xmin, (LONG) xmin); - R->xmin = xmin; - } - if (xmax < R->xmax) { - IfTrace2((OffPageDebug),"BoxClip: right clip old %d new %d\n", - (LONG) R->xmax, (LONG) xmax); - R->xmax = xmax; - } - - if (ymin > R->ymin) { - IfTrace2((OffPageDebug),"BoxClip: top clip old %d new %d\n", - (LONG) R->ymin, (LONG) ymin); - R->ymin = ymin; - } - if (ymax < R->ymax) { - IfTrace2((OffPageDebug),"BoxClip: bottom clip old %d new %d\n", - (LONG) R->ymax, (LONG) ymax); - R->ymax = ymax; - } - - - laste = &anchor; - anchor.link = R->anchor; - - for (e = R->anchor; VALIDEDGE(e); e = e->link) { - if (TOP(e) < ymin) { - e->xvalues += ymin - e->ymin; - e->ymin = ymin; - } - if (BOTTOM(e) > ymax) - e->ymax = ymax; - if (TOP(e) >= BOTTOM(e)) { - discard(laste, e->link->link); - e = laste; - continue; - } - if (e->xmin < xmin) { - cedgemax(BOTTOM(e) - TOP(e), e->xvalues, xmin); - e->xmin = xmin; - e->xmax = MAX(e->xmax, xmin); - } - if (e->xmax > xmax) { - cedgemin(BOTTOM(e) - TOP(e), e->xvalues, xmax); - e->xmin = MIN(e->xmin, xmax); - e->xmax = xmax; - } - laste = e; - } - - R->anchor = anchor.link; - - return(R); -} - -#ifdef notdef -/* -:h3.CoerceRegion() - Force a TextPath Structure to Become a Region - -We also save the newly created region in the textpath structure, if the -structure was permanent. Then we don't have to do this again. Why not -save it all the time? Well, we certainly could, but I suspect it -wouldn't pay. We would have to make this region permanent (because we -couldn't have it be consumed) and this would probably require -unnecessary CopyRegions in most cases. -*/ - -struct region *CoerceRegion(tp) - register struct textpath *tp; /* input TEXTTYPE */ -{ - struct segment *path; /* temporary character path */ - struct region *R; /* returned region */ - - - R = Interior(path, EVENODDRULE); - return(R); -} -#endif - -/* :h3.RegionBounds() - Returns Bounding Box of a Region */ -struct segment *RegionBounds(R) - register struct region *R; +struct segment *RegionBounds(register struct region *R) { - extern struct XYspace *IDENTITY; - register struct segment *path; /* returned path */ path = BoxPath(IDENTITY, R->ymax - R->ymin, R->xmax - R->xmin); @@ -1626,13 +1488,13 @@ struct segment *RegionBounds(R) return(path); } +#if 0 /* :h2.Formatting/Dump Routines for Debug :h3.DumpArea() - Display a Region */ -void DumpArea(area) - register struct region *area; +void DumpArea(register struct region *area) { IfTrace1(TRUE,"Dumping area %p,", area); IfTrace4(TRUE," X %d:%d Y %d:%d;", (LONG) area->xmin, @@ -1650,8 +1512,7 @@ void DumpArea(area) static pel RegionDebugYMin = MINPEL; static pel RegionDebugYMax = MAXPEL; -void DumpEdges(edges) - register struct edgelist *edges; +void DumpEdges(register struct edgelist *edges) { register struct edgelist *p,*p2; register pel ymin = MINPEL; @@ -1721,3 +1582,4 @@ out: /* if (edge->ymin < oldmax && edge->ymin != oldmin) t1_abort("EDGE ERROR: overlapping swaths"); */ } +#endif diff --git a/Build/source/texk/ps2pkm/regions.h b/Build/source/texk/ps2pkm/regions.h index 5e907f1e18f..aec9323f29f 100644 --- a/Build/source/texk/ps2pkm/regions.h +++ b/Build/source/texk/ps2pkm/regions.h @@ -28,88 +28,6 @@ */ /*SHARED*/ -#define Interior(p,rule) t1_Interior(p,rule) -#define Union(a1,a2) t1_Union(a1,a2) -#define Intersect(a1,a2) t1_Intersect(a1,a2) -#define Complement(area) t1_Complement(area) -#define Overlap(a1,a2) t1_OverLap(a1,a2) - -struct region *t1_Interior(); /* returns the interior of a closed path */ -struct region *t1_Union(); /* set union of paths or regions */ -struct region *t1_Intersect(); /* set intersection of regions */ -struct region *t1_Complement(); /* complement of a region */ -int t1_Overlap(); /* returns a Boolean; TRUE if regions overlap */ - -#define T1_INFINITY t1_Infinity - -/*END SHARED*/ -/*SHARED*/ - -#define ChangeDirection(type,R,x,y,dy) t1_ChangeDirection(type,R,x,y,dy) - -void t1_ChangeDirection(); /* called when we change direction in Y */ -#define CD_FIRST -1 /* enumeration of ChangeDirection type */ -#define CD_CONTINUE 0 /* enumeration of ChangeDirection type */ -#define CD_LAST 1 /* enumeration of ChangeDirection type */ - -#define MoreWorkArea(R,x1,y1,x2,y2) t1_MoreWorkArea(R,x1,y1,x2,y2) -#define KillRegion(area) t1_KillRegion(area) -#define CopyRegion(area) t1_CopyRegion(area) -#define SortSwath(a,p,f) t1_SortSwath(a,p,f) -#define SwathUnion(b,e) t1_SwathUnion(b,e) -#define RegionBounds(r) t1_RegionBounds(r) -#define CoerceRegion(p) t1_CoerceRegion(p) -#define MoveEdges(R,dx,dy) t1_MoveEdges(R,dx,dy) -#define UnJumble(R) t1_UnJumble(R) - -void t1_MoreWorkArea(); /* get longer edge list for stepping */ -struct region *t1_CopyRegion(); /* duplicate a region */ -void t1_KillRegion(); /* destroy a region */ -struct edgelist *t1_SortSwath(); /* sort edges onto growing edge list */ -struct edgelist *t1_SwathUnion(); /* 'union' two edges into a swath */ -struct segment *t1_RegionBounds(); /* returns bounding box of a region */ -struct region *t1_CoerceRegion(); /* force text to become a true region */ -void t1_MoveEdges(); /* moves the edge values in a region */ -void t1_UnJumble(); /* sort the edges and reset the jumbled flag */ - -/*END SHARED*/ -/*SHARED*/ - -#define GOING_TO(R, x1, y1, x2, y2, dy) { \ - if (dy < 0) { \ - if (R->lastdy >= 0) \ - ChangeDirection(CD_CONTINUE, R, x1, y1, dy); \ - if (y2 < R->edgeYstop) \ - MoreWorkArea(R, x1, y1, x2, y2); \ - } \ - else if (dy > 0) { \ - if (R->lastdy <= 0) \ - ChangeDirection(CD_CONTINUE, R, x1, y1, dy); \ - if (y2 > R->edgeYstop) \ - MoreWorkArea(R, x1, y1, x2, y2); \ - } \ - else /* dy == 0 */ ChangeDirection(CD_CONTINUE, R, x1, y1, dy); \ - if (x2 < R->edgexmin) R->edgexmin = x2; \ - else if (x2 > R->edgexmax) R->edgexmax = x2; \ -} - - -#define MINPEL (-1<<(8*sizeof(pel)-1)) /* smallest value fitting in a pel */ -#define MAXPEL ((1<<(8*sizeof(pel)-1))-1)/* largest value fitting in a pel */ - -/* -The "Unique"-type macro is different (unique?) for regions, because some -regions structures are shared among several objects, and might have -to be made unique for that reason (i.e., references > 1). -*/ - -#define ConsumeRegion(R) MAKECONSUME(R,KillRegion(R)) -#define UniqueRegion(R) MAKEUNIQUE(R,CopyRegion(R)) - - -/*END SHARED*/ -/*SHARED*/ - struct region { XOBJ_COMMON /* xobject common data define 3-26-91 PNM */ /* type = REGIONTYPE */ @@ -185,6 +103,90 @@ predicate to test for the opposite of these conditions: /*END SHARED*/ /*SHARED*/ +#define Interior(p,rule) t1_Interior(p,rule) +#define Union(a1,a2) t1_Union(a1,a2) +#define Intersect(a1,a2) t1_Intersect(a1,a2) +#define Complement(area) t1_Complement(area) +#define Overlap(a1,a2) t1_OverLap(a1,a2) + +struct region *t1_Interior(struct segment *, int); + /* returns the interior of a closed path */ +struct region *t1_Union(); /* set union of paths or regions */ +struct region *t1_Intersect(); /* set intersection of regions */ +struct region *t1_Complement(); /* complement of a region */ +int t1_Overlap(); /* returns a Boolean; TRUE if regions overlap */ + +#define T1_INFINITY t1_Infinity + +/*END SHARED*/ +/*SHARED*/ + +#define ChangeDirection(type,R,x,y,dy) t1_ChangeDirection(type,R,x,y,dy) + +void t1_ChangeDirection(int, struct region *, fractpel, fractpel, fractpel); + /* called when we change direction in Y */ +#define CD_FIRST -1 /* enumeration of ChangeDirection type */ +#define CD_CONTINUE 0 /* enumeration of ChangeDirection type */ +#define CD_LAST 1 /* enumeration of ChangeDirection type */ + +#define MoreWorkArea(R,x1,y1,x2,y2) t1_MoreWorkArea(R,x1,y1,x2,y2) +#define KillRegion(area) t1_KillRegion(area) +#define CopyRegion(area) t1_CopyRegion(area) +#define RegionBounds(r) t1_RegionBounds(r) +#define CoerceRegion(p) t1_CoerceRegion(p) +#define MoveEdges(R,dx,dy) t1_MoveEdges(R,dx,dy) +#define UnJumble(R) t1_UnJumble(R) + +void t1_MoreWorkArea(struct region *, fractpel, fractpel, fractpel, + fractpel); /* get longer edge list for stepping */ +struct region *t1_CopyRegion(struct region *); /* duplicate a region */ +void t1_KillRegion(struct region *); /* destroy a region */ +struct segment *t1_RegionBounds(struct region *); + /* returns bounding box of a region */ +struct region *t1_CoerceRegion(); /* force text to become a true region */ +void t1_MoveEdges(struct region *, fractpel, fractpel); + /* moves the edge values in a region */ +void t1_UnJumble(struct region *); + /* sort the edges and reset the jumbled flag */ + +/*END SHARED*/ +/*SHARED*/ + +#define GOING_TO(R, x1, y1, x2, y2, dy) { \ + if (dy < 0) { \ + if (R->lastdy >= 0) \ + ChangeDirection(CD_CONTINUE, R, x1, y1, dy); \ + if (y2 < R->edgeYstop) \ + MoreWorkArea(R, x1, y1, x2, y2); \ + } \ + else if (dy > 0) { \ + if (R->lastdy <= 0) \ + ChangeDirection(CD_CONTINUE, R, x1, y1, dy); \ + if (y2 > R->edgeYstop) \ + MoreWorkArea(R, x1, y1, x2, y2); \ + } \ + else /* dy == 0 */ ChangeDirection(CD_CONTINUE, R, x1, y1, dy); \ + if (x2 < R->edgexmin) R->edgexmin = x2; \ + else if (x2 > R->edgexmax) R->edgexmax = x2; \ +} + + +#define MINPEL (-1<<(8*sizeof(pel)-1)) /* smallest value fitting in a pel */ +#define MAXPEL ((1<<(8*sizeof(pel)-1))-1)/* largest value fitting in a pel */ + +/* +The "Unique"-type macro is different (unique?) for regions, because some +regions structures are shared among several objects, and might have +to be made unique for that reason (i.e., references > 1). +*/ + +#define ConsumeRegion(R) MAKECONSUME(R,KillRegion(R)) +#define UniqueRegion(R) MAKEUNIQUE(R,CopyRegion(R)) + + +/*END SHARED*/ +/*SHARED*/ + #define ISDOWN(f) ((f)&0x80) #define ISAMBIGUOUS(f) ((f)&0x40) diff --git a/Build/source/texk/ps2pkm/scanfont.c b/Build/source/texk/ps2pkm/scanfont.c index ced7feedbe1..92249282468 100644 --- a/Build/source/texk/ps2pkm/scanfont.c +++ b/Build/source/texk/ps2pkm/scanfont.c @@ -35,22 +35,14 @@ #include "t1stdio.h" #include "util.h" #include "token.h" +#include "objects.h" +#include "spaces.h" +#include "fontmisc.h" +#include "ffilest.h" #include "fontfcn.h" #include "blues.h" -extern void objFormatInteger(psobj *,int); -extern void objFormatReal(psobj *, float); -extern void objFormatBoolean(psobj *, boolean); -extern void objFormatEncoding(psobj *, int, psobj *); -extern void objFormatArray(psobj *, int, psobj *); -extern void objFormatString(psobj *, int, char *); -extern void objFormatName(psobj *, int, const char *); -extern void objFormatFile(psobj *, FILE *); -extern int SearchDictName(psdict *, psobj *); -extern int T1Getc(struct F_FILE *f); -extern int T1Ungetc(int c,struct F_FILE *f); - static int rc; static boolean InPrivateDict; static boolean WantFontInfo; @@ -445,7 +437,7 @@ static psobj *MakeEncodingArrayP(EncodingTable *encodingTable) return(encodingArrayP); } -boolean Init_BuiltInEncoding() +boolean Init_BuiltInEncoding(void) { StdEncArrayP = MakeEncodingArrayP(StdEnc); ISOLatin1EncArrayP = MakeEncodingArrayP(ISO8859Enc); @@ -1210,9 +1202,7 @@ static int GetType1Blues(psfont *fontP) /* */ /* Returns a psobj (string) */ /**********************************************************************/ -psobj *GetType1CharString(fontP, code) -psfont *fontP; -unsigned char code; +psobj *GetType1CharString(psfont *fontP, unsigned char code) { int N; /* the 'Nth' entry in the CharStrings */ psobj *charnameP; /* points to psobj that is name of character*/ @@ -1338,8 +1328,7 @@ static int FindDictValue(psdict *dictP) * Result is placed on the Operand Stack as next object * ------------------------------------------------------------------- */ -int scan_font(FontP) - psfont *FontP; +int scan_font(psfont *FontP) { diff --git a/Build/source/texk/ps2pkm/spaces.c b/Build/source/texk/ps2pkm/spaces.c index bd3f63c375d..aca852743a8 100644 --- a/Build/source/texk/ps2pkm/spaces.c +++ b/Build/source/texk/ps2pkm/spaces.c @@ -44,7 +44,6 @@ This module is responsible for handling the TYPE1IMAGER "XYspace" object. #include "pictures.h" #include "fonts.h" #include "arith.h" -#include "trig.h" static void FindFfcn(DOUBLE, DOUBLE, fractpel (**)()); static void FindIfcn(DOUBLE, DOUBLE, fractpel *, fractpel *, fractpel (**)()); @@ -122,8 +121,7 @@ The XYspace structure represents the XYspace object. static unsigned int SpaceID = 1; -struct XYspace *CopySpace(S) - register struct XYspace *S; +struct XYspace *CopySpace(register struct XYspace *S) { S = (struct XYspace *)Allocate(sizeof(struct XYspace), S, 0); S->ID = NEXTID; @@ -178,18 +176,12 @@ struct XYspace *IDENTITY = &identity; static struct doublematrix contexts[MAXCONTEXTS]; -#ifdef notdef +#if 0 static int nextcontext = 1; /*SHARED LINE(S) ORIGINATED HERE*/ -#if __STDC__ -#define pointer void * -#else -#define pointer char * -#endif - /* :h3.FindDeviceContext() - Find the Context Given a Device @@ -238,8 +230,8 @@ the context array. If it cannot find it, it will allocate a new array entry and fill it out. */ -int FindContext(M) - DOUBLE M[2][2]; /* array to search for */ +int FindContext( + DOUBLE M[2][2]) /* array to search for */ { register int i; /* loop variable for search */ for (i=0; i < nextcontext; i++) @@ -266,9 +258,9 @@ array index, then transforming IDENTITY space to create an appropriate cooridnate space. */ -struct XYspace *Context(device, units) - pointer device; /* device token */ - DOUBLE units; /* multiples of one inch */ +struct XYspace *Context( + void *device, /* device token */ + DOUBLE units) /* multiples of one inch */ { DOUBLE M[2][2]; /* device transformation matrix */ register int n; /* will hold device context number */ @@ -328,7 +320,7 @@ static void ConsiderContext( context = S->context; } else if (obj->type == PICTURETYPE) { - + context = NULLCONTEXT; } else context = NULLCONTEXT; @@ -361,19 +353,19 @@ These secondary routines come in many flavors to handle different special cases as quickly as possible. */ -void FXYConvert(pt, S, x, y) - register struct fractpoint *pt; /* point to set */ - register struct XYspace *S; /* relevant coordinate space */ - register DOUBLE x,y; /* user's coordinates of point */ +static void FXYConvert( + register struct fractpoint *pt, /* point to set */ + register struct XYspace *S, /* relevant coordinate space */ + register DOUBLE x, register DOUBLE y) /* user's coordinates of point */ { pt->x = (*S->xconvert)(S->tofract.normal[0][0], S->tofract.normal[1][0], x, y); pt->y = (*S->yconvert)(S->tofract.normal[0][1], S->tofract.normal[1][1], x, y); } -void IXYConvert(pt, S, x, y) - register struct fractpoint *pt; /* point to set */ - register struct XYspace *S; /* relevant coordinate space */ - register LONG x,y; /* user's coordinates of point */ +static void IXYConvert( + register struct fractpoint *pt, /* point to set */ + register struct XYspace *S, /* relevant coordinate space */ + register LONG x, register LONG y) /* user's coordinates of point */ { pt->x = (*S->ixconvert)(S->itofract[0][0], S->itofract[1][0], x, y); pt->y = (*S->iyconvert)(S->itofract[0][1], S->itofract[1][1], x, y); @@ -386,10 +378,10 @@ precision in the answer with fixed point arithmetic. So, we force the integers to floats, and do the arithmetic all with floats: */ -void ForceFloat(pt, S, x, y) - register struct fractpoint *pt; /* point to set */ - register struct XYspace *S; /* relevant coordinate space */ - register LONG x,y; /* user's coordinates of point */ +static void ForceFloat( + register struct fractpoint *pt, /* point to set */ + register struct XYspace *S, /* relevant coordinate space */ + register LONG x, register LONG y) /* user's coordinates of point */ { (*S->convert)(pt, S, (DOUBLE) x, (DOUBLE) y); } @@ -403,9 +395,9 @@ FXonly() and FYonly() are special cases when one of the coefficients is 0.0. */ -fractpel FXYboth(cx, cy, x, y) - register DOUBLE cx,cy; /* x and y coefficients */ - register DOUBLE x,y; /* user x,y */ +static fractpel FXYboth( + register DOUBLE cx, register DOUBLE cy, /* x and y coefficients */ + register DOUBLE x, register DOUBLE y) /* user x,y */ { register DOUBLE r; /* temporary float */ @@ -414,9 +406,9 @@ fractpel FXYboth(cx, cy, x, y) } /*ARGSUSED*/ -fractpel FXonly(cx, cy, x, y) - register DOUBLE cx,cy; /* x and y coefficients */ - register DOUBLE x,y; /* user x,y */ +static fractpel FXonly( + register DOUBLE cx, register DOUBLE cy, /* x and y coefficients */ + register DOUBLE x, register DOUBLE y) /* user x,y */ { register DOUBLE r; /* temporary float */ @@ -425,9 +417,9 @@ fractpel FXonly(cx, cy, x, y) } /*ARGSUSED*/ -fractpel FYonly(cx, cy, x, y) - register DOUBLE cx,cy; /* x and y coefficients */ - register DOUBLE x,y; /* user x,y */ +static fractpel FYonly( + register DOUBLE cx, register DOUBLE cy, /* x and y coefficients */ + register DOUBLE x, register DOUBLE y) /* user x,y */ { register DOUBLE r; /* temporary float */ @@ -445,25 +437,25 @@ IXYboth() is the general purpose routine; IXonly() and IYonly() are special cases when one of the coefficients is 0. */ -fractpel IXYboth(cx, cy, x, y) - register fractpel cx,cy; /* x and y coefficients */ - register LONG x,y; /* user x,y */ +static fractpel IXYboth( + register fractpel cx, register fractpel cy, /* x and y coefficients */ + register LONG x, register LONG y) /* user x,y */ { return(x * cx + y * cy); } /*ARGSUSED*/ -fractpel IXonly(cx, cy, x, y) - register fractpel cx,cy; /* x and y coefficients */ - register LONG x,y; /* user x,y */ +static fractpel IXonly( + register fractpel cx, register fractpel cy, /* x and y coefficients */ + register LONG x, register LONG y) /* user x,y */ { return(x * cx); } /*ARGSUSED*/ -fractpel IYonly(cx, cy, x, y) - register fractpel cx,cy; /* x and y coefficients */ - register LONG x,y; /* user x,y */ +static fractpel IYonly( + register fractpel cx, register fractpel cy, /* x and y coefficients */ + register LONG x, register LONG y) /* user x,y */ { return(y * cy); } @@ -486,25 +478,25 @@ Note that it is perfectly possible for us to calculate X with the on how the functions in the XYspace structure are filled out. */ -fractpel FPXYboth(cx, cy, x, y) - register fractpel cx,cy; /* x and y coefficients */ - register LONG x,y; /* user x,y */ +static fractpel FPXYboth( + register fractpel cx, register fractpel cy, /* x and y coefficients */ + register LONG x, register LONG y) /* user x,y */ { return( FPmult(x, cx) + FPmult(y, cy) ); } /*ARGSUSED*/ -fractpel FPXonly(cx, cy, x, y) - register fractpel cx,cy; /* x and y coefficients */ - register LONG x,y; /* user x,y */ +static fractpel FPXonly( + register fractpel cx, register fractpel cy, /* x and y coefficients */ + register LONG x, register LONG y) /* user x,y */ { return( FPmult(x, cx) ); } /*ARGSUSED*/ -fractpel FPYonly(cx, cy, x, y) - register fractpel cx,cy; /* x and y coefficients */ - register LONG x,y; /* user x,y */ +static fractpel FPYonly( + register fractpel cx, register fractpel cy, /* x and y coefficients */ + register LONG x, register LONG y) /* user x,y */ { return( FPmult(y, cy) ); } @@ -637,10 +629,10 @@ zero determinants, so by convention, we mark the matrix is invalid by marking both X terms zero. */ -void UnConvert(S, pt, xp, yp) - register struct XYspace *S; /* relevant coordinate space */ - register struct fractpoint *pt; /* device coordinates */ - DOUBLE *xp,*yp; /* where to store resulting x,y */ +void UnConvert( + register struct XYspace *S, /* relevant coordinate space */ + register struct fractpoint *pt, /* device coordinates */ + DOUBLE *xp, DOUBLE *yp) /* where to store resulting x,y */ { DOUBLE x,y; @@ -669,10 +661,11 @@ the space transform on the right, yielding SRTD in this case. We will get the same result if we did S, then R, then T on the space and mapping an unmodified font through that space. */ +static void PseudoSpace(struct XYspace *, DOUBLE[2][2]); -struct xobject *t1_Xform(obj, M) - register struct xobject *obj; /* object to transform */ - register DOUBLE M[2][2]; /* transformation matrix */ +struct xobject *t1_Xform( + register struct xobject *obj, /* object to transform */ + register DOUBLE M[2][2]) /* transformation matrix */ { if (obj == NULL) return(NULL); @@ -705,7 +698,7 @@ transformation matrix and keep the handles up to date. if (ISPATHTYPE(obj->type)) { struct XYspace pseudo; /* local temporary space */ PseudoSpace(&pseudo, M); - return((struct xobject *) PathTransform(obj, &pseudo)); + return((struct xobject *) PathTransform((struct segment *)obj, &pseudo)); } @@ -736,9 +729,10 @@ transformation matrix and keep the handles up to date. This is the external user's entry point. */ -struct xobject *t1_Transform(obj, cxx, cyx, cxy, cyy) - struct xobject *obj; - DOUBLE cxx,cyx,cxy,cyy; /* 2x2 transform matrix elements in row order */ +struct xobject *t1_Transform( + struct xobject *obj, + DOUBLE cxx, DOUBLE cyx, /* 2x2 transform matrix ... */ + DOUBLE cxy, DOUBLE cyy) /* ... elements in row order */ { DOUBLE M[2][2]; @@ -758,9 +752,9 @@ struct xobject *t1_Transform(obj, cxx, cyx, cxy, cyy) This is a user operator. */ -struct xobject *t1_Scale(obj, sx, sy) - struct xobject *obj; /* object to scale */ - DOUBLE sx,sy; /* scale factors in x and y */ +struct xobject *t1_Scale( + struct xobject *obj, /* object to scale */ + DOUBLE sx, DOUBLE sy) /* scale factors in x and y */ { DOUBLE M[2][2]; IfTrace3((MustTraceCalls),"Scale(%p, %f, %f)\n", obj, sx, sy); @@ -771,6 +765,7 @@ struct xobject *t1_Scale(obj, sx, sy) return(Xform(obj, M)); } +#if 0 /* :h3 id=rotate.Rotate() - Special Case of Transform() @@ -778,15 +773,14 @@ We special-case different settings of 'degrees' for performance and accuracy within the DegreeSin() and DegreeCos() routines themselves. */ -#ifdef notdef -struct xobject *xiRotate(obj, degrees) - struct xobject *obj; /* object to be transformed */ - DOUBLE degrees; /* degrees of COUNTER-clockwise rotation */ +struct xobject *xiRotate( + struct xobject *obj, /* object to be transformed */ + DOUBLE degrees) /* degrees of COUNTER-clockwise rotation */ { DOUBLE M[2][2]; - IfTrace2((MustTraceCalls),"Rotate(%p, %f)\n", obj, degrees); + IfTrace2((MustTraceCalls),"Rotate(%p, %f)\n", obj, °rees); M[0][0] = M[1][1] = DegreeCos(degrees); M[1][0] = - (M[0][1] = DegreeSin(degrees)); @@ -806,9 +800,9 @@ subroutine takes the arbitrary matrix and builds a coordinate space, with all its nifty function pointers. */ -void PseudoSpace(S, M) - struct XYspace *S; /* coordinate space structure to fill out */ - DOUBLE M[2][2]; /* matrix that will become 'tofract.normal' */ +static void PseudoSpace( + struct XYspace *S, /* coordinate space structure to fill out */ + DOUBLE M[2][2]) /* matrix that will become 'tofract.normal' */ { S->type = SPACETYPE; S->flag = ISPERMANENT(ON) + ISIMMORTAL(ON); @@ -851,9 +845,10 @@ To remind myself, matrix multiplication goes rows of A times columns of B. The output matrix may be the same as one of the input matrices. */ -void MatrixMultiply(A, B, C) - register DOUBLE A[2][2],B[2][2]; /* input matrices */ - register DOUBLE C[2][2]; /* output matrix */ +void MatrixMultiply( + register DOUBLE A[2][2], /* input ... */ + register DOUBLE B[2][2], /* ... matrices */ + register DOUBLE C[2][2]) /* output matrix */ { register DOUBLE txx,txy,tyx,tyy; @@ -873,9 +868,9 @@ void MatrixMultiply(A, B, C) My reference for matrix inversion was :hp1/Elementary Linear Algebra/ by Paul C. Shields, Worth Publishers, Inc., 1968. */ -void MatrixInvert(M, Mprime) - DOUBLE M[2][2]; /* input matrix */ - DOUBLE Mprime[2][2]; /* output inverted matrix */ +void MatrixInvert( + DOUBLE M[2][2], /* input matrix */ + DOUBLE Mprime[2][2]) /* output inverted matrix */ { register DOUBLE D; /* determinant of matrix M */ register DOUBLE txx,txy,tyx,tyy; @@ -906,10 +901,8 @@ maps 72nds of an inch to pels on the default device. struct XYspace *USER = &identity; -void InitSpaces() +void InitSpaces(void) { - extern char *DEFAULTDEVICE; - IDENTITY->type = SPACETYPE; FillOutFcns(IDENTITY); @@ -934,9 +927,10 @@ must be taken out before we return the matrix to the user. Fortunately, this is simple: just multiply by the inverse of IDENTITY! */ -void QuerySpace(S, cxxP, cyxP, cxyP, cyyP) - register struct XYspace *S; /* space asked about */ - register DOUBLE *cxxP,*cyxP,*cxyP,*cyyP; /* where to put answer */ +void QuerySpace( + register struct XYspace *S, /* space asked about */ + register DOUBLE *cxxP, register DOUBLE *cyxP, /* where to ... */ + register DOUBLE *cxyP, register DOUBLE *cyyP) /* ... put answer */ { DOUBLE M[2][2]; /* temp matrix to build user's answer */ @@ -951,6 +945,7 @@ void QuerySpace(S, cxxP, cyxP, cxyP, cyyP) *cyyP = M[1][1]; } +#if 0 /* :h3.FormatFP() - Format a Fixed Point Pel @@ -963,9 +958,9 @@ We make sure we have N (FRACTBITS/4) digits past the decimal point. */ #define FRACTMASK ((1<<FRACTBITS)-1) /* mask for fractional part */ -void FormatFP(str, fpel) - register char *str; /* output str */ - register fractpel fpel; /* fractional pel input */ +static void FormatFP( + register char *str, /* output str */ + register fractpel fpel) /* fractional pel input */ { char temp[8]; register char *s; @@ -988,8 +983,7 @@ void FormatFP(str, fpel) :h3.DumpSpace() - Display a Coordinate Space */ /*ARGSUSED*/ -void DumpSpace(S) - register struct XYspace *S; +void DumpSpace(register struct XYspace *S) { IfTrace4(TRUE,"--Coordinate space at %p,ID=%d,convert=%p,iconvert=%p\n", S, S->ID, S->convert, S->iconvert); @@ -1000,3 +994,4 @@ void DumpSpace(S) S->tofract.normal[1][0], S->tofract.normal[1][1]); IfTrace2(TRUE," [ %d %d ]\n", S->itofract[1][0], S->itofract[1][1]); } +#endif diff --git a/Build/source/texk/ps2pkm/spaces.h b/Build/source/texk/ps2pkm/spaces.h index 10023195345..cbd2e02e9f8 100644 --- a/Build/source/texk/ps2pkm/spaces.h +++ b/Build/source/texk/ps2pkm/spaces.h @@ -33,59 +33,6 @@ #define USER t1_User #define IDENTITY t1_Identity -#define Context(d,u) t1_Context(d,u) -#define Transform(o,f1,f2,f3,f4) t1_Transform(o,f1,f2,f3,f4) -#define Rotate(o,d) t1_Rotate(o,d) -#define Scale(o,sx,sy) t1_Scale(o,sx,sy) -#define QuerySpace(S,f1,f2,f3,f4) t1_QuerySpace(S,f1,f2,f3,f4) -#define Warp(s1,o,s2) t1_Warp(s1,o,s2) - -struct XYspace *t1_Context(); /* creates a coordinate space for a device */ -struct xobject *t1_Transform(); /* transform an object */ -struct xobject *t1_Rotate(); /* rotate an object */ -struct xobject *t1_Scale(); /* scale an object */ -struct xobject *t1_Warp(); /* transform like delta of two spaces */ -void t1_QuerySpace(); /* returns coordinate space matrix */ - -/*END SHARED*/ -/*SHARED*/ - -#define DeviceResolution t1_DeviceResolution -#define InitSpaces() t1_InitSpaces() -#define CopySpace(s) t1_CopySpace(s) -#define Xform(o,M) t1_Xform(o,M) -#define UnConvert(S,pt,xp,yp) t1_UnConvert(S,pt,xp,yp) -#define MatrixMultiply(A,B,C) t1_MMultiply(A,B,C) -#define MatrixInvert(A,B) t1_MInvert(A,B) -#define PseudoSpace(S,M) t1_PseudoSpace(S,M) -#define FindContext(M) t1_FindContext(M) - -void t1_InitSpaces(); /* initialize pre-defined coordinate spaces */ -struct XYspace *t1_CopySpace(); /* duplicate a coordinate space */ -struct xobject *t1_Xform(); /* transform object by matrix */ -void t1_UnConvert(); /* return user coordinates from device coordinates */ -void t1_MMultiply(); /* multiply two matrices */ -void t1_MInvert(); /* invert a matrix */ -void t1_PseudoSpace(); /* force a coordinate space from a matrix */ -int t1_FindContext(); /* return the "context" represented by a matrix */ - -/*END SHARED*/ -/*SHARED*/ - -/* #define KillSpace(s) Free(s) -Note - redefined KillSpace() to check references ! -3-26-91 PNM */ - -#define KillSpace(s) if ( (--(s->references) == 0) ||\ - ( (s->references == 1) && ISPERMANENT(s->flag) ) )\ - Free(s) - -#define ConsumeSpace(s) MAKECONSUME(s,KillSpace(s)) -#define UniqueSpace(s) MAKEUNIQUE(s,CopySpace(s)) - -/*END SHARED*/ -/*SHARED*/ - typedef SHORT pel; /* integer pel locations */ typedef LONG fractpel; /* fractional pel locations */ @@ -136,6 +83,69 @@ struct fractpoint { /*END SHARED*/ /*SHARED*/ + +extern struct XYspace *IDENTITY; +extern struct XYspace *USER; + +/*END SHARED*/ +/*SHARED*/ + +#define Context(d,u) t1_Context(d,u) +#define Transform(o,f1,f2,f3,f4) t1_Transform(o,f1,f2,f3,f4) +#define Rotate(o,d) t1_Rotate(o,d) +#define Scale(o,sx,sy) t1_Scale(o,sx,sy) +#define QuerySpace(S,f1,f2,f3,f4) t1_QuerySpace(S,f1,f2,f3,f4) +#define Warp(s1,o,s2) t1_Warp(s1,o,s2) + +struct XYspace *t1_Context(); /* creates a coordinate space for a device */ +struct xobject *t1_Transform(struct xobject *, DOUBLE, DOUBLE, DOUBLE, + DOUBLE); /* transform an object */ +struct xobject *t1_Rotate(); /* rotate an object */ +struct xobject *t1_Scale(struct xobject *, DOUBLE, DOUBLE); /* scale an object */ +struct xobject *t1_Warp(); /* transform like delta of two spaces */ +void t1_QuerySpace(struct XYspace *, DOUBLE *, DOUBLE *, DOUBLE *, DOUBLE *); + /* returns coordinate space matrix */ + +/*END SHARED*/ +/*SHARED*/ + +#define DeviceResolution t1_DeviceResolution +#define InitSpaces t1_InitSpaces +#define CopySpace(s) t1_CopySpace(s) +#define Xform(o,M) t1_Xform(o,M) +#define UnConvert(S,pt,xp,yp) t1_UnConvert(S,pt,xp,yp) +#define MatrixMultiply(A,B,C) t1_MMultiply(A,B,C) +#define MatrixInvert(A,B) t1_MInvert(A,B) +#define FindContext(M) t1_FindContext(M) + +void t1_InitSpaces(void); /* initialize pre-defined coordinate spaces */ +struct XYspace *t1_CopySpace(struct XYspace *); + /* duplicate a coordinate space */ +struct xobject *t1_Xform(struct xobject *, DOUBLE[2][2]); + /* transform object by matrix */ +void t1_UnConvert(struct XYspace *, struct fractpoint *, DOUBLE *, DOUBLE *); + /* return user coordinates from device coordinates */ +void t1_MMultiply(DOUBLE[2][2], DOUBLE[2][2], DOUBLE[2][2]); + /* multiply two matrices */ +void t1_MInvert(DOUBLE[2][2], DOUBLE[2][2]); /* invert a matrix */ +int t1_FindContext(); /* return the "context" represented by a matrix */ + +/*END SHARED*/ +/*SHARED*/ + +/* #define KillSpace(s) Free(s) +Note - redefined KillSpace() to check references ! +3-26-91 PNM */ + +#define KillSpace(s) if ( (--(s->references) == 0) ||\ + ( (s->references == 1) && ISPERMANENT(s->flag) ) )\ + Free(s) + +#define ConsumeSpace(s) MAKECONSUME(s,KillSpace(s)) +#define UniqueSpace(s) MAKEUNIQUE(s,CopySpace(s)) + +/*END SHARED*/ +/*SHARED*/ #define NULLCONTEXT 0 diff --git a/Build/source/texk/ps2pkm/t1funcs.c b/Build/source/texk/ps2pkm/t1funcs.c index f5c052cd104..364f53a5aec 100644 --- a/Build/source/texk/ps2pkm/t1funcs.c +++ b/Build/source/texk/ps2pkm/t1funcs.c @@ -65,69 +65,38 @@ #include "objects.h" #include "spaces.h" +#include "paths.h" #include "regions.h" #include "t1stdio.h" #include "util.h" #include "fontfcn.h" -typedef char *encoding[256]; - -int Type1OpenScalable(char **ev, struct _Font **ppFont, int flags, - struct _FontEntry *entry, char *fileName, - struct _FontScalable *vals, fsBitmapFormat format, - ULONG fmask, double efactor,double slant); static int Type1GetGlyphs(struct _Font *pFont, ULONG count, unsigned char *chars, FontEncoding charEncoding, ULONG *glyphCount, struct _CharInfo **glyphs); -void Type1CloseFont(struct _Font *pFont); -extern int Type1GetInfoScalable(struct _FontPathElement *fpe, - struct _FontInfo *pInfo, - struct _FontEntry *entry, - struct _FontName *fontName, - char *fileName, - struct _FontScalable *Vals); static int Type1GetMetrics(struct _Font *pFont, ULONG count, unsigned char *chars, FontEncoding charEncoding, ULONG *glyphCount, xCharInfo **glyphs ); static void fillrun(register char *p,pel x0,pel x1,int bit); -extern char * Xalloc(int size); -extern void Xfree(void*); static void fill(char *dest,int h,int w,struct region *area, int byte,int bit,int wordsize); -extern Bool fontfcnA(char *env,int *mode); -extern struct region *fontfcnB(struct XYspace *S, unsigned char *code, - int *lenP, int *mode); -extern int FontDefaultFormat(int *bit, int *byte, - int *glyphs, int *scan); -extern int CheckFSFormat(int format,int fmask,int *bit,int *byte,int *scan,int *glyph,int *image); -extern void QueryFontLib(char *env,const char *infoName,void *infoValue,int *rcodeP); -extern void T1FillFontInfo(struct _Font *pFont,struct _FontScalable *Vals,char *Filename,char *Fontname); -extern void T1InitStdProps(void); -extern int FontFileRegisterRenderer(FontRendererRec *); +static void FontDefaultFormat(int *bit, int *byte, int *glyphs, int *scan); -extern psfont *FontP; -extern psobj *ISOLatin1EncArrayP; - #define DECIPOINTSPERINCH 722.7 -extern int currentchar; /* for error reporting */ - /*ARGSUSED*/ -int Type1OpenScalable (ev, ppFont, flags, entry, fileName, vals, format, - fmask, efactor, slant) - encoding ev; - FontPtr *ppFont; - int flags; - FontEntryPtr entry; - char *fileName; - FontScalablePtr vals; - fsBitmapFormat format; - fsBitmapFormatMask fmask; - DOUBLE efactor; - DOUBLE slant; +int Type1OpenScalable ( + encoding ev, + FontPtr *ppFont, + int flags, + FontEntryPtr entry, + char *fileName, + FontScalablePtr vals, + fsBitmapFormat format, + fsBitmapFormatMask fmask, + DOUBLE efactor, + DOUBLE slant) { - extern struct XYspace *IDENTITY; - FontPtr pFont; int bit, byte, @@ -180,23 +149,23 @@ int Type1OpenScalable (ev, ppFont, flags, entry, fileName, vals, format, int rc; QueryFontLib(fileName,"FontMatrix",fontmatrix,&rc); if (!rc) { - S = (struct XYspace *) Transform(IDENTITY, + S = (struct XYspace *) Transform((struct xobject *)IDENTITY, fontmatrix[0], fontmatrix[1], fontmatrix[2], fontmatrix[3]); } else { - S = (struct XYspace *) Scale(IDENTITY,0.001,0.001); + S = (struct XYspace *) Scale((struct xobject *)IDENTITY,0.001,0.001); } } /* End of additional code */ if (efactor == 1.0 && slant == 0.0) - S = (struct XYspace *)Permanent(Scale(S, scale, - scale)); + S = (struct XYspace *)Permanent(Scale((struct xobject *)S, scale, - scale)); else { txx = (DOUBLE)vals->x * efactor * vals->point / DECIPOINTSPERINCH; tyy = (DOUBLE)vals->y * vals->point / DECIPOINTSPERINCH; tyx = 0.0; txy = (DOUBLE)vals->x * slant * vals->point / DECIPOINTSPERINCH; - S = (struct XYspace *) Permanent(Transform(S, txx, tyx, txy, -tyy)); + S = (struct XYspace *) Permanent(Transform((struct xobject *)S, txx, tyx, txy, -tyy)); } glyphs = type1->glyphs; @@ -386,8 +355,7 @@ Type1GetMetrics( return ret; } -void Type1CloseFont(pFont) - FontPtr pFont; +void Type1CloseFont(FontPtr pFont) { register int i; struct type1font *type1; @@ -408,7 +376,6 @@ void Type1CloseFont(pFont) } - static void fill( register char *dest, /* destination bitmap */ int h, int w, /* dimensions of 'dest', w padded */ @@ -518,18 +485,9 @@ static void fillrun(register char *p, pel x0, pel x1, int bit) } -static FontRendererRec renderers[] = { - { ".pfa", 4, (int (*)()) 0, Type1OpenScalable, - (int (*)()) 0, Type1GetInfoScalable, 0 }, - { ".pfb", 4, (int (*)()) 0, Type1OpenScalable, - (int (*)()) 0, Type1GetInfoScalable, 0 } -}; - void Type1RegisterFontFileFunctions(void) { - int i; - T1InitStdProps(); - for (i=0; i < sizeof(renderers) / sizeof(FontRendererRec); i++) - FontFileRegisterRenderer(&renderers[i]); } + +static void FontDefaultFormat(int *bit, int *byte, int *glyphs, int *scan) { ; } diff --git a/Build/source/texk/ps2pkm/t1info.c b/Build/source/texk/ps2pkm/t1info.c index 48e8eec6e56..5e1767bbb00 100644 --- a/Build/source/texk/ps2pkm/t1info.c +++ b/Build/source/texk/ps2pkm/t1info.c @@ -57,26 +57,17 @@ #include "types.h" #include <stdio.h> #include <string.h> +#include "util.h" #include "ffilest.h" #ifdef XSERVER #include "FSproto.h" #endif -#include "ffilest.h" #include "t1intf.h" -extern char *Xalloc(int size); -extern void Xfree(void *); -extern int FontComputeInfoAccelerators(FontInfoPtr); -extern long MakeAtom(const char *, unsigned int, Bool); -extern int Type1OpenScalable(FontPathElementPtr ev , FontPtr *ppFont , - int flags, - FontEntryPtr entry, - char *fileName, - FontScalablePtr vals, - unsigned long format, - unsigned long fmask,double efactor,double slant); -extern void Type1CloseFont(struct _Font *pFont); -extern void QueryFontLib(char *env,const char *infoName,void *infoValue,int *rcodeP); +#ifdef WIN32 +static void FontParseXLFDName(char *, FontScalablePtr, int); +#endif +static void FontComputeInfoAccelerators(FontInfoPtr); #define DECIPOINTSPERINCH 722.7 #define DEFAULTRES 75 @@ -92,7 +83,7 @@ typedef struct _fontProp { const char *name; LONG atom; enum scaleType type; -} fontProp; +} fontProp; static fontProp fontNamePropTable[] = { /* Example: */ { "FOUNDRY", 0, atom }, /* adobe */ @@ -256,7 +247,7 @@ ComputeStdProps( FontInfoPtr pInfo, FontScalablePtr Vals, char *Filename, - char *Fontname) + const char *Fontname) { FontPropPtr pp; int i, @@ -323,6 +314,8 @@ ComputeStdProps( case average_width: pp->value = Vals->width; break; + default: /* scaledX, scaledY, unscaled, scaledXoverY, and uncomputed */ + break; } } @@ -348,41 +341,12 @@ ComputeStdProps( } } -/*ARGSUSED*/ -int -Type1GetInfoScalable(fpe, pInfo, entry, fontName, fileName, Vals) - FontPathElementPtr fpe; - FontInfoPtr pInfo; - FontEntryPtr entry; - FontNamePtr fontName; - char *fileName; - FontScalablePtr Vals; -{ - FontPtr pfont; - int flags = 0; - LONG format = 0; /* It doesn't matter what format for just info */ - LONG fmask = 0; - int ret; - - ret = Type1OpenScalable(fpe, &pfont, flags, entry, fileName, Vals, format, fmask, 1.0, 0.0); - if (ret != Successful) - return ret; - *pInfo = pfont->info; - - /* XXX - Set pointers in pfont->info to NULL so they are not freed. */ - pfont->info.props = NULL; - pfont->info.isStringProp = NULL; - - Type1CloseFont(pfont); - return Successful; -} - void -T1FillFontInfo(pFont, Vals, Filename, Fontname) - FontPtr pFont; - FontScalablePtr Vals; - char *Filename; - char *Fontname; +T1FillFontInfo( + FontPtr pFont, + FontScalablePtr Vals, + char *Filename, + const char *Fontname) { FontInfoPtr pInfo = &pFont->info; struct type1font *p = (struct type1font *)pFont->fontPrivate; @@ -397,7 +361,7 @@ T1FillFontInfo(pFont, Vals, Filename, Fontname) /* Called once, at renderer registration time */ void -T1InitStdProps() +T1InitStdProps(void) { int i; fontProp *t; @@ -409,3 +373,8 @@ T1InitStdProps() for (t = extraProps; i; i--, t++) t->atom = MakeAtom(t->name, (unsigned) strlen(t->name), TRUE); } + +#ifdef WIN32 +static void FontParseXLFDName(char *scaledName, FontScalablePtr Vals, int foo) { ; } +#endif +static void FontComputeInfoAccelerators(FontInfoPtr foo) { ; } diff --git a/Build/source/texk/ps2pkm/t1intf.h b/Build/source/texk/ps2pkm/t1intf.h index 21eb910d2ad..b79e1cf481e 100644 --- a/Build/source/texk/ps2pkm/t1intf.h +++ b/Build/source/texk/ps2pkm/t1intf.h @@ -34,3 +34,9 @@ struct type1font { CharInfoPtr pDefault; CharInfoRec glyphs[256-FIRSTCOL]; }; + +extern void T1FillFontInfo(struct _Font *pFont, + struct _FontScalable *Vals, + char *Filename, + const char *Fontname); +extern void T1InitStdProps(void); diff --git a/Build/source/texk/ps2pkm/t1io.c b/Build/source/texk/ps2pkm/t1io.c index 322ceb478f6..6dca5507c82 100644 --- a/Build/source/texk/ps2pkm/t1io.c +++ b/Build/source/texk/ps2pkm/t1io.c @@ -59,16 +59,13 @@ STATIC F_FILE TheFile; STATIC unsigned char TheBuffer[F_BUFSIZ]; /* Our routines */ -F_FILE *T1Open(), *T1Eexec(); -int T1Close(); -int T1Read(), T1Getc(), T1Ungetc(); STATIC int T1Decrypt(unsigned char *, int), T1Fill(F_FILE *); /* -------------------------------------------------------------- */ /*ARGSUSED*/ -F_FILE *T1Open(fn, mode) - char *fn; /* Pointer to filename */ - char *mode; /* Pointer to open mode string */ +F_FILE *T1Open( + char *fn, /* Pointer to filename */ + char *mode) /* Pointer to open mode string */ { F_FILE *of = &TheFile; @@ -93,8 +90,8 @@ F_FILE *T1Open(fn, mode) } /* end Open */ /* -------------------------------------------------------------- */ -int T1Getc(f) /* Read one character */ - F_FILE *f; /* Stream descriptor */ +int T1Getc( /* Read one character */ + F_FILE *f) /* Stream descriptor */ { if (f->b_base == NULL) return EOF; /* already closed */ @@ -113,9 +110,9 @@ int T1Getc(f) /* Read one character */ } /* end Getc */ /* -------------------------------------------------------------- */ -int T1Ungetc(c, f) /* Put back one character */ - int c; - F_FILE *f; /* Stream descriptor */ +int T1Ungetc( /* Put back one character */ + int c, + F_FILE *f) /* Stream descriptor */ { if (c != EOF) { f->ungotc = c; @@ -126,11 +123,11 @@ int T1Ungetc(c, f) /* Put back one character */ } /* end Ungetc */ /* -------------------------------------------------------------- */ -int T1Read(buffP, size, n, f) /* Read n items into caller's buffer */ - char *buffP; /* Buffer to be filled */ - int size; /* Size of each item */ - int n; /* Number of items to read */ - F_FILE *f; /* Stream descriptor */ +int T1Read( /* Read n items into caller's buffer */ + char *buffP, /* Buffer to be filled */ + int size, /* Size of each item */ + int n, /* Number of items to read */ + F_FILE *f) /* Stream descriptor */ { int bytelen, cnt, i; F_char *p = (F_char *)buffP; @@ -164,8 +161,8 @@ int T1Read(buffP, size, n, f) /* Read n items into caller's buffer */ } /* end Read */ /* -------------------------------------------------------------- */ -int T1Close(f) /* Close the file */ - F_FILE *f; /* Stream descriptor */ +int T1Close( /* Close the file */ + F_FILE *f) /* Stream descriptor */ { if (f->b_base == NULL) return 0; /* already closed */ f->b_base = NULL; /* no valid stream */ @@ -173,8 +170,8 @@ int T1Close(f) /* Close the file */ } /* end Close */ /* -------------------------------------------------------------- */ -F_FILE *T1eexec(f) /* Initialization */ - F_FILE *f; /* Stream descriptor */ +F_FILE *T1eexec( /* Initialization */ + F_FILE *f) /* Stream descriptor */ { int i, c; int H; @@ -193,7 +190,7 @@ F_FILE *T1eexec(f) /* Initialization */ /* If ASCII, the next 7 chars are guaranteed consecutive */ randomP[0] = c; /* store first non white space char */ - fread(randomP+1, 1, 3, f); /* read 3 more, for a total of 4 */ + fread((char *)randomP+1, 1, 3, f); /* read 3 more, for a total of 4 */ /* store first four chars */ for (i=0,p=randomP; i<4; i++) { /* Check 4 valid ASCIIEncode chars */ if (HighHexP[*p++] > LAST_HDIGIT) { /* non-ASCII byte */ @@ -202,7 +199,7 @@ F_FILE *T1eexec(f) /* Initialization */ } } if (asc) { /* ASCII form, convert first eight bytes to binary */ - fread(randomP+4, 1, 4, f); /* Need four more */ + fread((char *)randomP+4, 1, 4, f); /* Need four more */ for (i=0,p=randomP; i<4; i++) { /* Convert */ H = HighHexP[*p++]; randomP[i] = H | LowHexP[*p++]; @@ -224,7 +221,7 @@ F_FILE *T1eexec(f) /* Initialization */ STATIC int T1Decrypt(unsigned char *p, int len) { int n; - int H, L; + int H = 0, L; unsigned char *inp = p; unsigned char *tblP; diff --git a/Build/source/texk/ps2pkm/t1snap.c b/Build/source/texk/ps2pkm/t1snap.c index 988539b49cb..62c85dbeffa 100644 --- a/Build/source/texk/ps2pkm/t1snap.c +++ b/Build/source/texk/ps2pkm/t1snap.c @@ -31,6 +31,7 @@ #include "objects.h" #include "spaces.h" #include "paths.h" +#include "pictures.h" /* :h2.Handle Functions @@ -40,8 +41,8 @@ This is a user operator. Its new name is QueryHandle. */ -struct segment *t1_Phantom(obj) - register struct xobject *obj; /* object to take the Phantom of */ +struct segment *t1_Phantom( + register struct segment *obj) /* object to take the Phantom of */ { struct fractpoint pt; /* handle size will built here */ @@ -59,8 +60,8 @@ struct segment *t1_Phantom(obj) This is a user operator. */ -struct xobject *t1_Snap(p) - register struct segment *p; /* path to snap */ +struct segment *t1_Snap( + register struct segment *p) /* path to snap */ { struct fractpoint pt; /* for finding length of path */ @@ -75,5 +76,5 @@ struct xobject *t1_Snap(p) } else p = JoinSegment(p, MOVETYPE, -pt.x, -pt.y, NULL); - return((struct xobject *)p); + return(p); } diff --git a/Build/source/texk/ps2pkm/t1stdio.h b/Build/source/texk/ps2pkm/t1stdio.h index f2d89b17c9a..5398966276e 100644 --- a/Build/source/texk/ps2pkm/t1stdio.h +++ b/Build/source/texk/ps2pkm/t1stdio.h @@ -95,10 +95,12 @@ typedef struct F_FILE { ( (f)->b_cnt--, (unsigned int)*( (f)->b_ptr++ ) ) : \ T1Getc(f) \ ) - -extern FILE *T1Open(), *T1eexec(); -extern int T1Close(), T1ungetc(), T1Read(); - + +extern F_FILE *T1Open(char *, char *), *T1eexec(F_FILE *); +extern int T1Close(F_FILE *); +extern int T1Read(char *, int, int, F_FILE *), + T1Getc(F_FILE *), T1Ungetc(int, F_FILE *); + #define fclose(f) T1Close(f) #define fopen(name,mode) T1Open(name,mode) #define ungetc(c,f) T1Ungetc(c,f) diff --git a/Build/source/texk/ps2pkm/t1stub.c b/Build/source/texk/ps2pkm/t1stub.c index d530be6d598..6405b64c106 100644 --- a/Build/source/texk/ps2pkm/t1stub.c +++ b/Build/source/texk/ps2pkm/t1stub.c @@ -30,7 +30,7 @@ #include "objects.h" /* get #define for t1_abort() */ -static void xiStub(void) +xiStub(void) { printf("xiStub called\n"); t1_abort("xiStub called"); @@ -38,7 +38,7 @@ static void xiStub(void) struct segment; -void t1_DumpText(struct segment *foo) +void t1_DumpText(struct segment * foo) { xiStub(); } diff --git a/Build/source/texk/ps2pkm/token.c b/Build/source/texk/ps2pkm/token.c index f27db8d29fa..d175b6f24e2 100644 --- a/Build/source/texk/ps2pkm/token.c +++ b/Build/source/texk/ps2pkm/token.c @@ -35,9 +35,6 @@ #include "token.h" #include "tokst.h" #include "hdigit.h" - -extern int T1Getc(struct F_FILE *f); -extern int T1Ungetc(int c,struct F_FILE *f); /* * ------------------------------------------------------------------- * Globals @@ -1120,8 +1117,7 @@ static int NO_TOKEN(int ch) * * ------------------------------------------------------------------- */ -void scan_token(inputP) - psobj *inputP; +void scan_token(psobj *inputP) { int ch; unsigned char *stateP = s0; diff --git a/Build/source/texk/ps2pkm/token.h b/Build/source/texk/ps2pkm/token.h index 6fcfa0e63ce..272da4cbaa6 100644 --- a/Build/source/texk/ps2pkm/token.h +++ b/Build/source/texk/ps2pkm/token.h @@ -56,22 +56,6 @@ #define TOKEN_IMMED_NAME (16) /* Token routines */ -extern void scan_token(); - -/* - * ------------------------------------------------------------------------- - * Globals shared -- (everyone else KEEP YOUR MITTS OFF THEM!) - * ------------------------------------------------------------------------- - */ - -/* These variables are set by the caller */ -extern char *tokenStartP; /* Pointer to token buffer in VM */ -extern char *tokenMaxP; /* Pointer to end of VM we may use + 1 */ - -/* These variables are set by P_TOKEN */ -extern int tokenLength; /* Characters in token */ -extern boolean tokenTooLong; /* Token too long for space available */ -extern int tokenType; /* Type of token identified */ -extern psvalue tokenValue; /* Token value */ +extern void scan_token(psobj *); #endif /* TOKEN_H */ diff --git a/Build/source/texk/ps2pkm/type1.c b/Build/source/texk/ps2pkm/type1.c index cc8bc6daa8a..edb112c70d5 100644 --- a/Build/source/texk/ps2pkm/type1.c +++ b/Build/source/texk/ps2pkm/type1.c @@ -54,10 +54,11 @@ #include "paths.h" #include "fonts.h" /* understands about TEXTTYPEs */ #include "pictures.h" /* understands about handles */ - -typedef struct xobject xobject; #include "util.h" /* PostScript objects */ #include "blues.h" /* Blues structure for font-level hints */ +#include "fontmisc.h" +#include "ffilest.h" +#include "fontfcn.h" /**********************************/ /* Type1 Constants and Structures */ @@ -141,8 +142,6 @@ struct stem { /* representation of a STEM hint */ struct segment *rthint, *rtrevhint; /* right or top hint adjustment */ }; -extern struct XYspace *IDENTITY; - static DOUBLE escapementX, escapementY; static DOUBLE sidebearingX, sidebearingY; static DOUBLE accentoffsetX, accentoffsetY; @@ -153,7 +152,7 @@ static int errflag; /*************************************************/ /* Global variables to hold Type1Char parameters */ /*************************************************/ -static char *Environment; +static psfont *Environment; static struct XYspace *CharSpace; static psobj *CharStringP, *SubrsP, *OtherSubrsP; static int *ModeP; @@ -206,7 +205,6 @@ static void FlxProc2(void); static void HintReplace(void); static void CallOtherSubr(int othersubrno); static void SetCurrentPoint(DOUBLE x,DOUBLE y); -extern struct xobject *Type1Char(char *env,struct XYspace *S,psobj *charstrP,psobj *subrsP,psobj *osubrsP,struct blues_struct *bluesP,int *modeP); /*****************************************/ /* statics for Flex procedures (FlxProc) */ @@ -1200,10 +1198,10 @@ static void RRCurveTo(DOUBLE dx1, DOUBLE dy1, DOUBLE dx2, DOUBLE dy2, DOUBLE dx3 /* Since XIMAGER is not completely relative, */ /* we need to add up the delta values */ - C = Join(C, Dup(B)); - D = Join(D, Dup(C)); + C = Join(C, (struct segment *)Dup((struct xobject *)B)); + D = Join(D, (struct segment *)Dup((struct xobject *)C)); - path = Join(path, Bezier(B, C, D)); + path = Join(path, (struct segment *)Bezier(B, C, D)); } /* - CLOSEPATH |- */ @@ -1714,14 +1712,14 @@ static void SetCurrentPoint(DOUBLE x, DOUBLE y) /* The Type1Char routine for use by PostScript. */ /************************************************/ -struct xobject *Type1Char(env, S, charstrP, subrsP, osubrsP, bluesP, modeP) - char *env; - struct XYspace *S; - psobj *charstrP; - psobj *subrsP; - psobj *osubrsP; - struct blues_struct *bluesP; /* FontID's ptr to the blues struct */ - int *modeP; +struct xobject *Type1Char( + psfont *FontP, + struct XYspace *S, + psobj *charstrP, + psobj *subrsP, + psobj *osubrsP, + struct blues_struct *bluesP, /* FontID's ptr to the blues struct */ + int *modeP) { int Code; @@ -1729,7 +1727,7 @@ struct xobject *Type1Char(env, S, charstrP, subrsP, osubrsP, bluesP, modeP) errflag = FALSE; /* Make parameters available to all Type1 routines */ - Environment = env; + Environment = FontP; CharSpace = S; /* used when creating path elements */ CharStringP = charstrP; SubrsP = subrsP; diff --git a/Build/source/texk/ps2pkm/types.h b/Build/source/texk/ps2pkm/types.h index e935bc3c874..42d38d1c454 100644 --- a/Build/source/texk/ps2pkm/types.h +++ b/Build/source/texk/ps2pkm/types.h @@ -14,27 +14,24 @@ #include <c-auto.h> #endif /* KPATHSEA */ -#if defined(WORD16) typedef unsigned short USHORT; /* 16 bits */ typedef short SHORT; /* 16 bits */ +#if defined(WORD16) typedef long LONG; /* 32 bits */ typedef unsigned long ULONG; /* 32 bits */ -typedef double DOUBLE; /* 64 bits */ #elif defined(WORD64) -typedef unsigned short USHORT; /* 16 bits */ -typedef short SHORT; /* 16 bits */ typedef int LONG; /* 32 bits */ typedef unsigned long ULONG; /* 32 bits */ -typedef double DOUBLE; /* 64 bits */ #else /* default: WORD32 */ -typedef unsigned short USHORT; /* 16 bits */ -typedef short SHORT; /* 16 bits */ # ifndef WIN32 /* These are already defined under WIN32 */ typedef int LONG; /* 32 bits */ typedef unsigned int ULONG; /* 32 bits */ # endif -typedef double DOUBLE; /* 64 bits */ #endif +typedef double DOUBLE; /* 64 bits */ + +typedef char *encoding[256]; +extern void getenc(char **, char **, encoding, int [256]); #endif /* __PS2PK_TYPES__ */ diff --git a/Build/source/texk/ps2pkm/util.c b/Build/source/texk/ps2pkm/util.c index 5c093b3cef1..d2310bb989f 100644 --- a/Build/source/texk/ps2pkm/util.c +++ b/Build/source/texk/ps2pkm/util.c @@ -34,8 +34,6 @@ #include "util.h" #include "fontmisc.h" -extern char *Xalloc(); - static char *vm_base = NULL; /* Start of virtual memory area */ char *vm_next = NULL; /* Pointer to first free byte */ LONG vm_free = 0; /* Count of free bytes */ @@ -45,9 +43,7 @@ static char *vm_base = NULL; /* Start of virtual memory area */ * Initialize memory. */ -extern char *tokenMaxP; /* Pointer to end of VM we may use + 1 */ - -boolean vm_init() +boolean vm_init(void) { vm_next = vm_base = (char *) Xalloc(MAX_STRING_LEN); @@ -61,8 +57,7 @@ boolean vm_init() return(FALSE); } -char *vm_alloc(bytes) - unsigned int bytes; +char *vm_alloc(unsigned int bytes) { char *answer; @@ -87,9 +82,7 @@ char *vm_alloc(bytes) /* * Format an Integer object */ -void objFormatInteger(objP,value) - psobj *objP; - int value; +void objFormatInteger(psobj *objP, int value) { if (objP != NULL) { objP->type = OBJ_INTEGER; @@ -101,13 +94,7 @@ void objFormatInteger(objP,value) /* * Format a Real object */ -#if 0 -void objFormatReal(objP,value) - psobj *objP; - float value; -#else void objFormatReal(psobj *objP, float value) -#endif { if (objP != NULL) { objP->type = OBJ_REAL; @@ -119,9 +106,7 @@ void objFormatReal(psobj *objP, float value) /* * Format a Boolean object */ -void objFormatBoolean(objP,value) - psobj *objP; - boolean value; +void objFormatBoolean(psobj *objP, boolean value) { if (objP != NULL) { objP->type = OBJ_BOOLEAN; @@ -133,10 +118,7 @@ void objFormatBoolean(objP,value) /* * Format an Encoding object */ -void objFormatEncoding(objP,length,valueP) - psobj *objP; - int length; - psobj *valueP; +void objFormatEncoding(psobj *objP, int length, psobj *valueP) { if (objP != NULL) { objP->type = OBJ_ENCODING; @@ -148,10 +130,7 @@ void objFormatEncoding(objP,length,valueP) /* * Format an Array object */ -void objFormatArray(objP,length,valueP) - psobj *objP; - int length; - psobj *valueP; +void objFormatArray(psobj *objP, int length, psobj *valueP) { if (objP != NULL) { objP->type = OBJ_ARRAY; @@ -164,10 +143,7 @@ void objFormatArray(objP,length,valueP) /* * Format a String object */ -void objFormatString(objP,length,valueP) - psobj *objP; - int length; - char *valueP; +void objFormatString(psobj *objP, int length, char *valueP) { if (objP != NULL) { objP->type = OBJ_STRING; @@ -179,10 +155,7 @@ void objFormatString(objP,length,valueP) /* * Format a Name object */ -void objFormatName(objP,length,valueP) - psobj *objP; - int length; - const char *valueP; +void objFormatName(psobj *objP, int length, const char *valueP) { if (objP != NULL) { objP->type = OBJ_NAME; @@ -194,9 +167,7 @@ void objFormatName(objP,length,valueP) /* * Format a File object */ -void objFormatFile(objP,valueP) - psobj *objP; - FILE *valueP; +void objFormatFile(psobj *objP, FILE *valueP) { if (objP != NULL) { objP->type = OBJ_FILE; diff --git a/Build/source/texk/ps2pkm/util.h b/Build/source/texk/ps2pkm/util.h index 342c726e50e..2db9a14ddd4 100644 --- a/Build/source/texk/ps2pkm/util.h +++ b/Build/source/texk/ps2pkm/util.h @@ -73,11 +73,11 @@ typedef int boolean; /***================================================================***/ /* Routines for managing virtual memory */ /***================================================================***/ -extern boolean vm_init(); +extern boolean vm_init(void); extern LONG vm_free; extern LONG vm_size; extern char *vm_next; -extern char *vm_alloc(); +extern char *vm_alloc(unsigned int bytes); /***================================================================***/ /* Macros for managing virtual memory */ /***================================================================***/ @@ -176,9 +176,34 @@ typedef struct ps_dict { #define objPSetName(o) ((o)->type = OBJ_NAME) #define objPSetFile(o) ((o)->type = OBJ_FILE) -/***================================================================***/ -/* Entry point for Type1Char to get entry from CharStrings */ -/***================================================================***/ -extern psobj *GetType1CharString(); +extern void objFormatInteger(psobj *,int); +extern void objFormatReal(psobj *, float); +extern void objFormatBoolean(psobj *, boolean); +extern void objFormatEncoding(psobj *, int, psobj *); +extern void objFormatArray(psobj *, int, psobj *); +extern void objFormatString(psobj *, int, char *); +extern void objFormatName(psobj *, int, const char *); +extern void objFormatFile(psobj *, FILE *); + +extern void *Xalloc(size_t); +extern void Xfree(void *); +extern long MakeAtom(const char *, unsigned int, int); +extern void QueryFontLib(char *, const char *, void *, int *); + +/* + * ------------------------------------------------------------------------- + * Globals shared -- (everyone else KEEP YOUR MITTS OFF THEM!) + * ------------------------------------------------------------------------- + */ + +/* These variables are set by the caller */ +extern char *tokenStartP; /* Pointer to token buffer in VM */ +extern char *tokenMaxP; /* Pointer to end of VM we may use + 1 */ + +/* These variables are set by P_TOKEN */ +extern int tokenLength; /* Characters in token */ +extern boolean tokenTooLong; /* Token too long for space available */ +extern int tokenType; /* Type of token identified */ +extern psvalue tokenValue; /* Token value */ #endif |