applied Benjamin Riefenstahl's patches for building on Windows

This commit is contained in:
vdvo 2002-05-27 16:45:32 +00:00
parent a80a9680fe
commit 79fe4b68df
15 changed files with 76 additions and 113 deletions

View File

@ -20,12 +20,8 @@
Arturo Tena <arturo@directmail.org> Arturo Tena <arturo@directmail.org>
*/ */
#if !(defined( __BORLANDC__ ) || defined( __WIN32__ ))
#include "config.h" #include "config.h"
#include "cole.h" #include "cole.h"
#else
#include "cole.h.in"
#endif
#include "internal.h" #include "internal.h"
#include <stdlib.h> #include <stdlib.h>
@ -193,7 +189,7 @@ cole_umount (COLEFS *colefilesystem, COLERRNO *colerrno)
if (colerrno != NULL) *colerrno = COLE_ECLOSEFILE; if (colerrno != NULL) *colerrno = COLE_ECLOSEFILE;
ret = 1; ret = 1;
} }
#if defined(__WIN32__) || (__BORLANDC__) #if defined(WIN32)
if (remove (colefilesystem->sbfilename) && !ret) { if (remove (colefilesystem->sbfilename) && !ret) {
if (colerrno != NULL) *colerrno = COLE_EREMOVE; if (colerrno != NULL) *colerrno = COLE_EREMOVE;
ret = 1; ret = 1;
@ -247,6 +243,9 @@ __cole_print_tree_indir(COLEDIR *cd, void *info, COLERRNO *colerrno)
* Modify colerrno comment in the functions that call it, * Modify colerrno comment in the functions that call it,
* ie. cole_print_tree(). * ie. cole_print_tree().
*/ */
(void) cd; /*UNUSED*/
(void) colerrno; /*UNUSED*/
(*((long*)info))++; (*((long*)info))++;
return 0; return 0;
} }
@ -259,6 +258,9 @@ __cole_print_tree_outdir(COLEDIR *cd, void *info, COLERRNO *colerrno)
* Modify colerrno comment in the functions that call it, * Modify colerrno comment in the functions that call it,
* ie. cole_print_tree(). * ie. cole_print_tree().
*/ */
(void) cd; /*UNUSED*/
(void) colerrno; /*UNUSED*/
(*((long*)info))--; (*((long*)info))--;
return 0; return 0;
} }
@ -273,6 +275,9 @@ __cole_print_tree_inroot(COLEDIR *cd, void *info, COLERRNO *colerrno)
*/ */
char *entry_name; char *entry_name;
(void) info; /*UNUSED*/
(void) colerrno; /*UNUSED*/
printf ("DIR "); printf ("DIR ");
printf (" %7zu", cole_dir_getsize (cd)); printf (" %7zu", cole_dir_getsize (cd));
printf (" %08lx-%08lx %08lx-%08lx", printf (" %08lx-%08lx %08lx-%08lx",
@ -301,6 +306,8 @@ __cole_print_tree_indirentry(COLEDIRENT *cde, void *info, COLERRNO *colerrno)
long level; long level;
long i; long i;
(void) colerrno; /*UNUSED*/
level = *((long*)info); level = *((long*)info);
for (i = 0; i < level; i++) { for (i = 0; i < level; i++) {
if (i == level - 1) if (i == level - 1)
@ -405,6 +412,8 @@ cole_opendir_direntry (COLEDIRENT *coledirentry, COLERRNO *colerrno)
int int
cole_closedir (COLEDIR *coledir, COLERRNO *colerrno) cole_closedir (COLEDIR *coledir, COLERRNO *colerrno)
{ {
(void) colerrno; /*UNUSED*/
free (coledir); free (coledir);
return 0; return 0;
@ -1136,6 +1145,8 @@ cole_locate_filename (COLEFS *colefilesystem, char *filename,
static int static int
__cole_locate_filename_visitdir (COLEDIR *cd, void *info) __cole_locate_filename_visitdir (COLEDIR *cd, void *info)
{ {
(void) cd; /*UNUSED*/
return ((struct __cole_locate_filenameinfo *)info)->visitdir; return ((struct __cole_locate_filenameinfo *)info)->visitdir;
} }

View File

@ -23,7 +23,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#if !(defined( __WIN32__ ) || defined( __BORLANDC__ )) #if !defined(WIN32)
#include <unistd.h> #include <unistd.h>
#endif #endif
@ -45,7 +45,7 @@ __cole_extract_file (FILE **file, char **filename, U32 size, U32 pps_start,
long FilePos; long FilePos;
size_t bytes_to_copy; size_t bytes_to_copy;
U8 Block[0x0200]; U8 Block[0x0200];
#if defined( __WIN32__ ) || defined( __BORLANDC__ ) #if defined(WIN32)
FILE *ret; FILE *ret;
*filename = (char *)malloc (TMPNAM_LEN); *filename = (char *)malloc (TMPNAM_LEN);

View File

@ -33,7 +33,7 @@ extern "C" {
#include "support.h" #include "support.h"
#endif #endif
#if defined( __WIN32__ ) || defined( __BORLANDC__ ) #if defined(WIN32)
#define TMPNAM_LEN L_tmpnam #define TMPNAM_LEN L_tmpnam
#else #else
#define TMPNAM_LEN 18 /* /tmp/xlHtmlXXXXXX + NULL */ #define TMPNAM_LEN 18 /* /tmp/xlHtmlXXXXXX + NULL */

View File

@ -25,11 +25,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <assert.h> #include <assert.h>
#if !(defined( __BORLANDC__ ) || defined( __WIN32__ ))
#include "cole.h" #include "cole.h"
#else
#include "cole.h.in"
#endif
#include "support.h" #include "support.h"
#include "internal.h" #include "internal.h"
@ -537,6 +533,8 @@ nextff_##var=&##var;
nextff (cff); nextff (cff);
#endif #endif
(void) size; /*UNUSED*/
verbose ("calling: add_MY_FILE_entry ()"); verbose ("calling: add_MY_FILE_entry ()");
#ifdef VERBOSE #ifdef VERBOSE

View File

@ -43,12 +43,10 @@
#include <sys/types.h> #include <sys/types.h>
#include <assert.h> #include <assert.h>
#if !(defined( __BORLANDC__ ) || defined( __WIN32__ ))
#include "cole.h" #include "cole.h"
#include "config.h" #include "config.h"
#if !defined(WIN32)
#include <unistd.h> /* for unlink() */ #include <unistd.h> /* for unlink() */
#else
#include "cole.h.in"
#endif #endif
/* FIXME: replace all VERBOSE with COLE_VERBOSE */ /* FIXME: replace all VERBOSE with COLE_VERBOSE */
#ifdef COLE_VERBOSE #ifdef COLE_VERBOSE
@ -475,7 +473,7 @@ int __OLEdecode (char *OLEfilename, pps_entry ** stream_list, U32 * root,
test_exitf (OLEfile != NULL, 7, ends ()); test_exitf (OLEfile != NULL, 7, ends ());
verboseS (sbfilename); verboseS (sbfilename);
*/ */
#if defined( __WIN32__ ) || defined( __BORLANDC__ ) #if defined(WIN32)
*_sbfilename = (U8 *)malloc (TMPNAM_LEN); *_sbfilename = (U8 *)malloc (TMPNAM_LEN);
test_exitf (*_sbfilename != NULL, 10, ends ()); test_exitf (*_sbfilename != NULL, 10, ends ());
tmpnam (*_sbfilename); tmpnam (*_sbfilename);
@ -508,7 +506,7 @@ int __OLEdecode (char *OLEfilename, pps_entry ** stream_list, U32 * root,
/* other entry, save in a file */ /* other entry, save in a file */
{ {
/* this branch is never executed now */ /* this branch is never executed now */
#if defined( __WIN32__ ) || defined( __BORLANDC__ ) #if defined(WIN32)
tmpnam (pps_list[i].filename); tmpnam (pps_list[i].filename);
test_exitf (pps_list[i].filename[0], 7, ends ()); test_exitf (pps_list[i].filename[0], 7, ends ());
verbose(pps_list[i].name + (!isprint(pps_list[i].name[0]) ? 1 : 0)); verbose(pps_list[i].name + (!isprint(pps_list[i].name[0]) ? 1 : 0));

View File

@ -37,9 +37,23 @@ extern "C" {
#include <ctype.h> #include <ctype.h>
#include <stdio.h> #include <stdio.h>
#if !(defined( __BORLANDC__ ) || defined( __WIN32__ ))
#include "config.h" #include "config.h"
#if defined(WIN32)
#define SIZEOF_FLOAT 4
#define SIZEOF_DOUBLE 8
#define SIZEOF_UNSIGNED_CHAR 1
#define SIZEOF_UNSIGNED_SHORT 2
#define SIZEOF_UNSIGNED_LONG 4
/* compile time checks for good measure */
#define COMPILE_TIME_CHECK(tag,expr) \
typedef char tag##_CHECK[ (expr) ? 1 : -1 ]
COMPILE_TIME_CHECK( FLOAT, sizeof(float) == SIZEOF_FLOAT );
COMPILE_TIME_CHECK( DOUBLE, sizeof(double) == SIZEOF_DOUBLE );
COMPILE_TIME_CHECK( CHAR, sizeof(char) == SIZEOF_UNSIGNED_CHAR );
COMPILE_TIME_CHECK( SHORT, sizeof(short) == SIZEOF_UNSIGNED_SHORT );
COMPILE_TIME_CHECK( LONG, sizeof(long) == SIZEOF_UNSIGNED_LONG );
#endif
/* F32 */ /* F32 */
#if SIZEOF_FLOAT == 4 #if SIZEOF_FLOAT == 4
@ -114,19 +128,6 @@ extern "C" {
#error No 4 byte length type found. #error No 4 byte length type found.
#endif #endif
#else
/* Borland or Wintel constants */
#define F32 float
#define F64 double
#define U8 unsigned char
#define U16 unsigned short
#define S16 signed short
#define U32 unsigned long
#define S32 signed long
#endif
U16 fil_sreadU16 (U8 * in); U16 fil_sreadU16 (U8 * in);
U32 fil_sreadU32 (U8 * in); U32 fil_sreadU32 (U8 * in);
F64 fil_sreadF64 (U8 * in); F64 fil_sreadF64 (U8 * in);

View File

@ -1,13 +1,5 @@
#ifndef __BORLANDC__
int cole_major_version = @COLE_MAJOR@; int cole_major_version = @COLE_MAJOR@;
int cole_minor_version = @COLE_MINOR@; int cole_minor_version = @COLE_MINOR@;
int cole_micro_version = @COLE_MICRO@; int cole_micro_version = @COLE_MICRO@;
char * cole_version = "@COLE_MAJOR@.@COLE_MINOR@.@COLE_MICRO@"; char * cole_version = "@COLE_MAJOR@.@COLE_MINOR@.@COLE_MICRO@";
char * cole_host_info = "@HOST_ALIAS_NAME@ (@HOST_CANONICAL_NAME@): @HOST_CPU@, @HOST_VENDOR@, @HOST_OS@"; char * cole_host_info = "@HOST_ALIAS_NAME@ (@HOST_CANONICAL_NAME@): @HOST_CPU@, @HOST_VENDOR@, @HOST_OS@";
#else
int cole_major_version = 2;
int cole_minor_version = 0;
int cole_micro_version = 1;
char * cole_version = "2.0.1";
char * cole_host_info = "BORLANDC (Windows): i386, GPL, Win32";
#endif

View File

@ -17,17 +17,10 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#if !(defined( __BORLANDC__ ) || defined( __WIN32__ ))
#include "config.h" /* Created by ./configure script */ #include "config.h" /* Created by ./configure script */
#include "support.h" /* Needs to be before internal.h */ #include "support.h" /* Needs to be before internal.h */
#include "internal.h" /* Needs to be before cole */ #include "internal.h" /* Needs to be before cole */
#include "cole.h" #include "cole.h"
#else
#include "config.h.in" /* Created by ./configure script */
#include "support.h" /* Needs to be before internal.h */
#include "internal.h" /* Needs to be before cole */
#include "cole.h.in"
#endif
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -108,6 +101,8 @@ void dump_file(COLEDIRENT *cde, void *_info)
COLEFILE *cf; COLEFILE *cf;
COLERRNO err; COLERRNO err;
(void) _info; /*UNUSED*/
cf = cole_fopen_direntry(cde, &err); cf = cole_fopen_direntry(cde, &err);
/* Ouput Header */ /* Ouput Header */

View File

@ -17,17 +17,12 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#if !(defined( __BORLANDC__ ) || defined( __WIN32__ ))
#include "config.h" /* Created by ./configure script */ #include "config.h" /* Created by ./configure script */
#include "support.h" /* Needs to be before internal.h */ #include "support.h" /* Needs to be before internal.h */
#include "internal.h" /* Needs to be before cole */ #include "internal.h" /* Needs to be before cole */
#include "cole.h" #include "cole.h"
#else #if defined(WIN32)
#include "config.h.in" /* Created by ./configure script */ #include <direct.h> /* _chdrive() */
#include "support.h" /* Needs to be before internal.h */
#include "internal.h" /* Needs to be before cole */
#include "cole.h.in"
#include <dir.h>
#endif #endif
@ -38,7 +33,7 @@
#define PRGNAME "pptHtml" #define PRGNAME "pptHtml"
#if !(defined( __WIN32__ ) || defined( __BORLANDC__ )) #if defined(VERSION)
#define PRGVER VERSION #define PRGVER VERSION
#else #else
#define PRGVER "0.4" #define PRGVER "0.4"
@ -82,24 +77,13 @@ int main (int argc, char **argv)
else else
{ {
strncpy(filename, argv[1], 124); strncpy(filename, argv[1], 124);
#if defined( __WIN32__ ) || defined( __BORLANDC__ ) #if 1 && defined(WIN32)
if( 0 != filename[0] && ':' == filename[1] )
{ {
char *ptr = strchr(filename, ':'); _chdrive(tolower((unsigned char)filename[0]) - 'a' + 1);
if (ptr) /* cut the drive from the filename */
{ memmove(filename,filename+2,strlen(filename+2)+1);
int len; }
char new_drive[MAXPATH];
fnsplit(filename, new_drive, 0, 0, 0);
if (new_drive[0] >= 'a')
setdisk(new_drive[0] - 'a');
else
setdisk(new_drive[0] - 'A');
ptr++; /* Get past the colon */
len = strlen(ptr);
memmove(filename, ptr, len);
filename[len] = 0;
}
}
#endif #endif
cfs = cole_mount (filename, &colerrno); cfs = cole_mount (filename, &colerrno);
if (cfs == NULL) if (cfs == NULL)
@ -139,6 +123,8 @@ void dump_file(COLEDIRENT *cde, void *_info)
COLEFILE *cf; COLEFILE *cf;
COLERRNO err; COLERRNO err;
(void) _info; /*UNUSED*/
cf = cole_fopen_direntry(cde, &err); cf = cole_fopen_direntry(cde, &err);
/* Ouput Header */ /* Ouput Header */

View File

@ -28,6 +28,7 @@
#include <stdlib.h> #include <stdlib.h>
int DatesR1904 = 0; /*!< Flag that the dates are based on McIntosh Dates system */
void print_version(void) void print_version(void)
{ {
@ -167,8 +168,6 @@ void NumToDate(long num, int *year, int *month, int *day)
const int ldays[]={31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; const int ldays[]={31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
const int ndays[]={31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; const int ndays[]={31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
extern int DatesR1904;
int t, i, y = 0; int t, i, y = 0;
num = num%36525L; /* Trim century */ num = num%36525L; /* Trim century */

View File

@ -14,4 +14,6 @@ extern void FracToTime(U8 *cnum, int *hr, int *minut, int *sec, int *msec);
extern S32 getLong(U8 *ptr); extern S32 getLong(U8 *ptr);
extern void RKtoDouble(S32 n, F64 *d); extern void RKtoDouble(S32 n, F64 *d);
extern int DatesR1904;
#endif #endif

View File

@ -17,14 +17,8 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#if !(defined( __BORLANDC__ ) || defined( __WIN32__ ))
#include "config.h" /* Created by ./configure script */ #include "config.h" /* Created by ./configure script */
#include "cole.h" #include "cole.h"
#else
#include "config.h.in" /* Created by ./configure script */
#include "cole.h.in"
#include <io.h> /* for umask */
#endif
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> /* for strcpy() */ #include <string.h> /* for strcpy() */
@ -51,6 +45,8 @@ static void output_opcode_string(int);
/* Global data */ /* Global data */
static char filename[128]; static char filename[128];
int aggressive = 0; /*!< Aggressive html optimization */
int main (int argc, char **argv) int main (int argc, char **argv)
{ {
@ -103,6 +99,8 @@ void dump_file(COLEDIRENT *cde, void *_info)
COLEFILE *cf; COLEFILE *cf;
COLERRNO err; COLERRNO err;
(void) _info; /*UNUSED*/
cf = cole_fopen_direntry(cde, &err); cf = cole_fopen_direntry(cde, &err);
/* Ouput Header */ /* Ouput Header */

View File

@ -17,14 +17,8 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#if !(defined( __BORLANDC__ ) || defined( __WIN32__ ))
#include "config.h" /* Created by ./configure script */ #include "config.h" /* Created by ./configure script */
#include "cole.h" #include "cole.h"
#else
#include "config.h.in" /* Created by ./configure script */
#include "cole.h.in"
#include <io.h> /* for umask */
#endif
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> /* for strcpy() */ #include <string.h> /* for strcpy() */
@ -52,6 +46,8 @@ static void output_opcode_string(int);
/* Global data */ /* Global data */
static char filename[128]; static char filename[128];
int aggressive = 0; /*!< Aggressive html optimization */
int main (int argc, char **argv) int main (int argc, char **argv)
{ {
@ -104,6 +100,8 @@ void dump_file(COLEDIRENT *cde, void *_info)
COLEFILE *cf; COLEFILE *cf;
COLERRNO err; COLERRNO err;
(void) _info; /*UNUSED*/
cf = cole_fopen_direntry(cde, &err); cf = cole_fopen_direntry(cde, &err);
/* Ouput Header */ /* Ouput Header */

View File

@ -110,8 +110,6 @@ char colorTab[MAX_COLORS][8] =
"FFFFFF" /* 0x40 */ "FFFFFF" /* 0x40 */
}; };
int DatesR1904 = 0; /*!< Flag that the dates are based on McIntosh Dates system */
/* FIXME: Support major languages here...not just English */ /* FIXME: Support major languages here...not just English */
const char month_abbr[12][5] = { "Jan", "Feb", "Mar", "Apr", "May", "June", const char month_abbr[12][5] = { "Jan", "Feb", "Mar", "Apr", "May", "June",
"July", "Aug", "Sep", "Oct", "Nov", "Dec" }; "July", "Aug", "Sep", "Oct", "Nov", "Dec" };
@ -395,25 +393,15 @@ int main (int argc, char **argv)
uni_string_clear(&default_font); uni_string_clear(&default_font);
umask(GLOBAL_UMASK); umask(GLOBAL_UMASK);
#if defined( __WIN32__ ) || defined( __BORLANDC__ ) #if 1 && defined(WIN32)
if( 0 != filename[0] && ':' == filename[1] )
{ {
char *ptr = strchr(filename, ':'); _chdrive(tolower((unsigned char)filename[0]) - 'a' + 1);
if (ptr) /* cut the drive from the filename */
{ memmove(filename,filename+2,strlen(filename+2)+1);
int len;
char new_drive[MAXPATH];
fnsplit(filename, new_drive, 0, 0, 0);
if (new_drive[0] >= 'a')
setdisk(new_drive[0] - 'a');
else
setdisk(new_drive[0] - 'A');
ptr++; /* Get past the colon */
len = strlen(ptr);
memmove(filename, ptr, len);
filename[len] = 0;
}
} }
#endif #endif
/* If successful, this calls scan_file to extract the work book... */ /* If successful, this calls scan_file to extract the work book... */
cfs = cole_mount(filename, &colerrno); cfs = cole_mount(filename, &colerrno);
if (cfs == NULL) if (cfs == NULL)
@ -533,6 +521,8 @@ void scan_file(COLEDIRENT *cde, void *_info)
COLEFILE *cf; COLEFILE *cf;
COLERRNO err; COLERRNO err;
(void) _info; /*UNUSED*/
cf = cole_fopen_direntry(cde, &err); cf = cole_fopen_direntry(cde, &err);
if (cf == 0) if (cf == 0)
{ /* error abort processing */ { /* error abort processing */

View File

@ -26,18 +26,13 @@
#if !(defined( __BORLANDC__ ) || defined( __WIN32__ ))
#include "config.h" /* Created by ./configure script */ #include "config.h" /* Created by ./configure script */
#include "support.h" /* Needs to be before internal.h */ #include "support.h" /* Needs to be before internal.h */
#include "internal.h" /* Needs to be before cole */ #include "internal.h" /* Needs to be before cole */
#include "cole.h" #include "cole.h"
#else #if defined(WIN32)
#include "config.h.in" /* Created by ./configure script */
#include "support.h" /* Needs to be before internal.h */
#include "internal.h" /* Needs to be before cole */
#include "cole.h.in"
#include <io.h> /* for umask */ #include <io.h> /* for umask */
#include <dir.h> #include <direct.h> /* _chdrive() */
#endif #endif
#include <stdlib.h> /* For atof(), calloc() */ #include <stdlib.h> /* For atof(), calloc() */
#include <string.h> /* For string functions */ #include <string.h> /* For string functions */
@ -60,11 +55,11 @@
#define MAX_COLORS 65 /*!< This is the size of the built-in color table */ #define MAX_COLORS 65 /*!< This is the size of the built-in color table */
#define EXCEL95 0x500 /*!< This is the file stamp for biff7 - Excel 5 & 95 */ #define EXCEL95 0x500 /*!< This is the file stamp for biff7 - Excel 5 & 95 */
#define EXCEL97 0x600 /*!< This is the file stamp for biff8 - Excel 97 & 2000 */ #define EXCEL97 0x600 /*!< This is the file stamp for biff8 - Excel 97 & 2000 */
#if !(defined( __WIN32__ ) || defined( __BORLANDC__ ))
#include <sys/stat.h> #include <sys/stat.h>
#define GLOBAL_UMASK (S_IXUSR|S_IWGRP|S_IRGRP|S_IXGRP|S_IWOTH|S_IROTH|S_IXOTH) #if !defined(S_IWGRP) && !defined(S_IWOTH) && defined(S_IEXEC)
#define GLOBAL_UMASK S_IEXEC
#else #else
#define GLOBAL_UMASK (2) #define GLOBAL_UMASK (S_IXUSR|S_IWGRP|S_IRGRP|S_IXGRP|S_IWOTH|S_IROTH|S_IXOTH)
#endif #endif
/*! \brief This encapsulates the Unicode String */ /*! \brief This encapsulates the Unicode String */