From a99083c972c3464b16cb2d488f7e8b2519c48c41 Mon Sep 17 00:00:00 2001 From: kramm Date: Sun, 2 Feb 2003 01:07:11 +0000 Subject: [PATCH] mingw fixes --- pdf2swf/Makefile.in | 12 ++++++------ pdf2swf/SWFOutputDev.cc | 3 ++- pdf2swf/font2swf.cc | 8 ++++---- pdf2swf/pdf2swf.cc | 22 +++++++++++----------- pdf2swf/ttf2pt1/pt1.c | 4 ++-- pdf2swf/ttf2pt1/ttf.c | 4 ++-- pdf2swf/ttf2pt1/ttf2pt1.c | 12 ++++++------ pdf2swf/ttf2pt1/{windows.h => win_missing.h} | 0 pdf2swf/xpdf/Stream.cc | 2 ++ pdf2swf/xpdf/gfile.cc | 6 +++--- pdf2swf/xpdf/gfile.h | 1 + 11 files changed, 39 insertions(+), 35 deletions(-) rename pdf2swf/ttf2pt1/{windows.h => win_missing.h} (100%) diff --git a/pdf2swf/Makefile.in b/pdf2swf/Makefile.in index 759c096..613e1a1 100644 --- a/pdf2swf/Makefile.in +++ b/pdf2swf/Makefile.in @@ -8,17 +8,17 @@ all: pdf2swf font2swf fonts = n021003l.pfb n021023l.pfb n021004l.pfb n021024l.pfb n019003l.pfb n019023l.pfb n019004l.pfb n019024l.pfb n022003l.pfb n022023l.pfb n022004l.pfb n022024l.pfb s050000l.pfb d050000l.pfb n021003l.afm n021023l.afm n021004l.afm n021024l.afm n019003l.afm n019023l.afm n019004l.afm n019024l.afm n022003l.afm n022023l.afm n022004l.afm n022024l.afm s050000l.afm d050000l.afm SWFOutputDev.o: swfoutput.h SWFOutputDev.cc - $(CC) -DDATADIR=\"$(pkgdatadir)\" -I../lib -Ittf2pt1 -Ixpdf SWFOutputDev.cc -o $@ + $(CC) -DSWFTOOLS_DATADIR=\"$(pkgdatadir)\" -I../lib -Ittf2pt1 -Ixpdf SWFOutputDev.cc -o $@ spline.o: spline.cc spline.h - $(CC) -DDATADIR=\"$(pkgdatadir)\" -I../lib -Ittf2pt1 -Ixpdf spline.cc -o $@ + $(CC) -DSWFTOOLS_DATADIR=\"$(pkgdatadir)\" -I../lib -Ittf2pt1 -Ixpdf spline.cc -o $@ encodings.o: encodings.cc - $(CC) -DDATADIR=\"$(pkgdatadir)\" -I../lib -Ittf2pt1 -Ixpdf encodings.cc -o $@ + $(CC) -DSWFTOOLS_DATADIR=\"$(pkgdatadir)\" -I../lib -Ittf2pt1 -Ixpdf encodings.cc -o $@ swfoutput.o: swfoutput.cc swfoutput.h spline.h - $(CC) -DDATADIR=\"$(pkgdatadir)\" -I../lib -Ittf2pt1 -Ixpdf swfoutput.cc -o $@ + $(CC) -DSWFTOOLS_DATADIR=\"$(pkgdatadir)\" -I../lib -Ittf2pt1 -Ixpdf swfoutput.cc -o $@ pdf2swf.o: pdf2swf.cc SWFOutputDev.h - $(CC) -DDATADIR=\"$(pkgdatadir)\" -I../lib -Ittf2pt1 -Ixpdf pdf2swf.cc -o $@ + $(CC) -DSWFTOOLS_DATADIR=\"$(pkgdatadir)\" -I../lib -Ittf2pt1 -Ixpdf pdf2swf.cc -o $@ font2swf.o: font2swf.cc swfoutput.h spline.h - $(CC) -DDATADIR=\"$(pkgdatadir)\" -I../lib -Ittf2pt1 -Ixpdf font2swf.cc -o $@ + $(CC) -DSWFTOOLS_DATADIR=\"$(pkgdatadir)\" -I../lib -Ittf2pt1 -Ixpdf font2swf.cc -o $@ pdf2swf: pdf2swf.o SWFOutputDev.o swfoutput.o encodings.o spline.o xpdf/pdflib.a ttf2pt1/ttf2pt1.a ../lib/librfxswf.a $(LL) pdf2swf.o SWFOutputDev.o swfoutput.o encodings.o spline.o -o pdf2swf ../lib/librfxswf.a ttf2pt1/ttf2pt1.a xpdf/libpdf.a $(LIBS) diff --git a/pdf2swf/SWFOutputDev.cc b/pdf2swf/SWFOutputDev.cc index 070e34a..251cd04 100644 --- a/pdf2swf/SWFOutputDev.cc +++ b/pdf2swf/SWFOutputDev.cc @@ -22,7 +22,9 @@ #include #include #include +#include "../config.h" //xpdf header files +#include "config.h" #include "gfile.h" #include "GString.h" #include "gmem.h" @@ -35,7 +37,6 @@ #include "Page.h" #include "PDFDoc.h" #include "Error.h" -#include "config.h" #include "OutputDev.h" #include "GfxState.h" #include "GfxFont.h" diff --git a/pdf2swf/font2swf.cc b/pdf2swf/font2swf.cc index cc6b5ce..a1f4627 100644 --- a/pdf2swf/font2swf.cc +++ b/pdf2swf/font2swf.cc @@ -193,10 +193,10 @@ int main(int argc, char ** argv) //T1LIB_CONFIG. putenv( "T1LIB_CONFIG=/tmp/t1lib.config.tmp"); FILE*fi = fopen("/tmp/t1lib.config.tmp", "wb"); - fprintf(fi, "FONTDATABASE=/tmp/FontDataBase\n", DATADIR); - fprintf(fi, "ENCODING=%s/fonts:.\n", DATADIR); - fprintf(fi, "AFM=%s/fonts:.\n", DATADIR); - fprintf(fi, "TYPE1=%s/fonts:.\n", DATADIR); + fprintf(fi, "FONTDATABASE=/tmp/FontDataBase\n", SWFTOOLS_DATADIR); + fprintf(fi, "ENCODING=%s/fonts:.\n", SWFTOOLS_DATADIR); + fprintf(fi, "AFM=%s/fonts:.\n", SWFTOOLS_DATADIR); + fprintf(fi, "TYPE1=%s/fonts:.\n", SWFTOOLS_DATADIR); fclose(fi); fi = fopen("/tmp/FontDataBase", "wb"); if(all) { diff --git a/pdf2swf/pdf2swf.cc b/pdf2swf/pdf2swf.cc index 85c7201..faeb09e 100644 --- a/pdf2swf/pdf2swf.cc +++ b/pdf2swf/pdf2swf.cc @@ -147,14 +147,14 @@ int args_callback_option(char*name,char*val) { else if (!strcmp(name, "l")) { char buf[256]; - sprintf(buf, "%s/swfs/default_loader.swf", DATADIR); + sprintf(buf, "%s/swfs/default_loader.swf", SWFTOOLS_DATADIR); preloader = strdup(buf); return 0; } else if (!strcmp(name, "b")) { char buf[256]; - sprintf(buf, "%s/swfs/default_viewer.swf", DATADIR); + sprintf(buf, "%s/swfs/default_viewer.swf", SWFTOOLS_DATADIR); viewer = strdup(buf); return 0; } @@ -166,7 +166,7 @@ int args_callback_option(char*name,char*val) { } else { - systemf("ls %s/swfs/*_loader.swf", DATADIR); + systemf("ls %s/swfs/*_loader.swf", SWFTOOLS_DATADIR); if(!system_quiet) printf("\n"); exit(1); @@ -181,7 +181,7 @@ int args_callback_option(char*name,char*val) { } else { - systemf("ls %s/swfs/*_viewer.swf", DATADIR); + systemf("ls %s/swfs/*_viewer.swf", SWFTOOLS_DATADIR); if(!system_quiet) printf("\n"); exit(1); @@ -292,8 +292,8 @@ void args_callback_usage(char*name) #ifndef SYSTEM_BACKTICKS printf("The following might not work because your system call doesn't support command substitution:\n"); #endif - printf("-b --defaultviewer Link default viewer to the pdf (%s/swfs/default_viewer.swf)\n", DATADIR); - printf("-l --defaultpreloader Link default preloader the pdf (%s/swfs/default_loader.swf)\n", DATADIR); + printf("-b --defaultviewer Link default viewer to the pdf (%s/swfs/default_viewer.swf)\n", SWFTOOLS_DATADIR); + printf("-l --defaultpreloader Link default preloader the pdf (%s/swfs/default_loader.swf)\n", SWFTOOLS_DATADIR); printf("-B --viewer=filename Link viewer \"name\" to the pdf (\"%s -B\" for list)\n", name); printf("-L --preloader=filename Link preloader \"name\" to the pdf (\"%s -L\" for list)\n",name); } @@ -380,7 +380,7 @@ int main(int argn, char *argv[]) exit(0); } - logf(" reading font files from %s/fonts\n", DATADIR); + logf(" reading font files from %s/fonts\n", SWFTOOLS_DATADIR); //TODO: use tempnam here. Check if environment already contains a //T1LIB_CONFIG. putenv( "T1LIB_CONFIG=/tmp/t1lib.config.tmp"); @@ -392,7 +392,7 @@ int main(int argn, char *argv[]) } t1searchpath[0] = 0; #ifdef HAVE_DIRENT_H - sprintf(buf, "%s/fonts",DATADIR); + sprintf(buf, "%s/fonts",SWFTOOLS_DATADIR); // pass 1 addfontdir(0, buf, &numfonts, 0); for(t=0;t --preloader option without --viewer option doesn't make very much sense."); ret = systemf("swfcombine `swfdump -r %s` %s/swfs/PreLoaderTemplate.swf loader=%s movie=%s -o %s", - preloader, DATADIR, preloader, outputname, outputname); + preloader, SWFTOOLS_DATADIR, preloader, outputname, outputname); if(!system_quiet) printf("\n"); } @@ -480,7 +480,7 @@ int main(int argn, char *argv[]) systemf("swfcombine %s viewport=%s -o __tmp__.swf", viewer, outputname, outputname); systemf("swfcombine `swfdump -XY %s` `swfdump -r %s` %s/swfs/PreLoaderTemplate.swf loader=%s movie=__tmp__.swf -o %s", - outputname, preloader, DATADIR, preloader, outputname); + outputname, preloader, SWFTOOLS_DATADIR, preloader, outputname); systemf("rm __tmp__.swf"); } diff --git a/pdf2swf/ttf2pt1/pt1.c b/pdf2swf/ttf2pt1/pt1.c index 0099324..1ba7984 100644 --- a/pdf2swf/ttf2pt1/pt1.c +++ b/pdf2swf/ttf2pt1/pt1.c @@ -12,11 +12,11 @@ #include #include -#ifndef WINDOWS +#ifndef WIN32 # include # include #else -# include "windows.h" +# include "win_missing.h" #endif #include "ttf.h" diff --git a/pdf2swf/ttf2pt1/ttf.c b/pdf2swf/ttf2pt1/ttf.c index c59b2f7..23dcb43 100644 --- a/pdf2swf/ttf2pt1/ttf.c +++ b/pdf2swf/ttf2pt1/ttf.c @@ -17,11 +17,11 @@ #include #include -#ifndef WINDOWS +#ifndef WIN32 # include # include #else -# include "windows.h" +# include "win_missing.h" #endif #include "ttf.h" diff --git a/pdf2swf/ttf2pt1/ttf2pt1.c b/pdf2swf/ttf2pt1/ttf2pt1.c index 2de4b5f..472d1ca 100644 --- a/pdf2swf/ttf2pt1/ttf2pt1.c +++ b/pdf2swf/ttf2pt1/ttf2pt1.c @@ -69,14 +69,14 @@ #include #endif -#ifndef WINDOWS +#ifndef WIN32 # include # include # define BITBUCKET "/dev/null" # include #else # define WINDOWS_FUNCTIONS /* ask to define functions - in one file only */ -# include "windows.h" +# include "win_missing.h" # define BITBUCKET "NUL" #endif @@ -1859,7 +1859,7 @@ ttf2pt1_main( if (argv[2][0] == '-' && argv[2][1] == 0) { pfa_file = stdout; -#ifdef WINDOWS +#ifdef WIN32 if(encode) { fprintf(stderr, "**** can't write encoded file to stdout ***\n"); exit(1); @@ -1877,7 +1877,7 @@ ttf2pt1_main( afm_file=n; } } else { -#ifndef WINDOWS +#ifndef WIN32 sprintf(filename, "%s.%s", argv[2], encode ? (pfbflag ? "pfb" : "pfa") : "t1a" ); #else /* WINDOWS */ sprintf(filename, "%s.t1a", argv[2]); @@ -1899,7 +1899,7 @@ ttf2pt1_main( /* * Now check whether we want a fully encoded .pfa file */ -#ifndef WINDOWS +#ifndef WIN32 if (encode) { int p[2]; extern FILE *ifp, *ofp; /* from t1asm.c */ @@ -2280,7 +2280,7 @@ ttf2pt1_main( cursw->close(); -#ifndef WINDOWS +#ifndef WIN32 while (wait(&ws) > 0) { } #else diff --git a/pdf2swf/ttf2pt1/windows.h b/pdf2swf/ttf2pt1/win_missing.h similarity index 100% rename from pdf2swf/ttf2pt1/windows.h rename to pdf2swf/ttf2pt1/win_missing.h diff --git a/pdf2swf/xpdf/Stream.cc b/pdf2swf/xpdf/Stream.cc index 9777940..6bc1c6e 100644 --- a/pdf2swf/xpdf/Stream.cc +++ b/pdf2swf/xpdf/Stream.cc @@ -16,6 +16,8 @@ #include #ifndef WIN32 #include +#else +extern "C" int unlink(char *filename); #endif #include #include diff --git a/pdf2swf/xpdf/gfile.cc b/pdf2swf/xpdf/gfile.cc index 9c7d789..bf020e7 100644 --- a/pdf2swf/xpdf/gfile.cc +++ b/pdf2swf/xpdf/gfile.cc @@ -13,9 +13,9 @@ #ifdef WIN32 extern "C" { -# ifndef _MSC_VER -# include -# endif +//# ifndef _MSC_VER +//# include +//# endif } #else // !WIN32 # if defined(MACOS) diff --git a/pdf2swf/xpdf/gfile.h b/pdf2swf/xpdf/gfile.h index f805362..aa5e9d8 100644 --- a/pdf2swf/xpdf/gfile.h +++ b/pdf2swf/xpdf/gfile.h @@ -21,6 +21,7 @@ # include # else # include +# include # endif #elif defined(ACORN) #elif defined(MACOS) -- 1.7.10.4