# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1079745673 0 # Node ID 2ff26b697877cd48b51af5fd40c9faf9480c3f0b # Parent 55c9fa60af787aa6bbfa181fc9e89a08f2aad67b Fixes for building with Innotek GCC. Will have to check for regressions with VAC and EMX. diff -r 55c9fa60af78 -r 2ff26b697877 compat.h --- a/compat.h Wed Mar 17 18:49:14 2004 +0000 +++ b/compat.h Sat Mar 20 01:21:13 2004 +0000 @@ -61,14 +61,18 @@ #define INCL_DEV #define INCL_DOSERRORS -#if defined(__IBMC__) && !defined(API) +#if (defined(__IBMC__) || defined(_System)) && !defined(API) #define API _System #endif #define msleep(a) DosSleep(a) #ifdef __EMX__ +#ifdef _System +#include "platform/dirent.h" +#else #include +#endif #include #define HAVE_PIPE #ifdef FD_SETSIZE diff -r 55c9fa60af78 -r 2ff26b697877 dw.h --- a/dw.h Wed Mar 17 18:49:14 2004 +0000 +++ b/dw.h Sat Mar 20 01:21:13 2004 +0000 @@ -52,7 +52,7 @@ #if defined(__OS2__) || defined(__WIN32__) || defined(__MAC__) || defined(WINNT) || defined(__EMX__) /* OS/2, Windows or MacOS */ -#if defined(__IBMC__) && !defined(API) +#if (defined(__IBMC__) || defined(_System)) && !defined(API) #define API _System #endif diff -r 55c9fa60af78 -r 2ff26b697877 makefile.emx --- a/makefile.emx Wed Mar 17 18:49:14 2004 +0000 +++ b/makefile.emx Sat Mar 20 01:21:13 2004 +0000 @@ -11,12 +11,12 @@ DEFS = LIBS = -CFLAGS = -O -g -Zomf -Zmt -D__OS2__ -D__ST_MT_ERRNO__ -I. -Wall +CFLAGS = -O -g -Zomf -Zmt -D__OS2__ -D__ST_MT_ERRNO__ -I. -Wall -o $(@) LDFLAGS = -Zdll -Zcrtdll RCFLAGS = -r -COMPATOBJECTS = compat.o dirent.o +COMPATOBJECTS = compat.obj dirent.obj COMPATSOURCES = compat.c dirent.c all: dw.dll dwcompat.dll dwtest.exe @@ -43,15 +43,15 @@ clean: $(RM) $(OBJECTS) dwtest.exe -dw.o: dw.c +dw.obj: dw.c $(CC) $(CFLAGS) -c $< -compat.o: compat.c +compat.obj: compat.c $(CC) $(CFLAGS) -c $< -dirent.o: os2/dirent.c +dirent.obj: os2/dirent.c $(CC) $(CFLAGS) -c $< -dwtest.o: dwtest.c +dwtest.obj: dwtest.c $(CC) $(CFLAGS) -c $< diff -r 55c9fa60af78 -r 2ff26b697877 os2/dirent.c --- a/os2/dirent.c Wed Mar 17 18:49:14 2004 +0000 +++ b/os2/dirent.c Sat Mar 20 01:21:13 2004 +0000 @@ -3,17 +3,12 @@ #include #include +#define INCL_DOSFILEMGR +#define INCL_DOSERRORS +#include "dw.h" #include "platform/dirent.h" #include -/*#ifndef __EMX__ -#include -#endif */ - -#define INCL_DOSFILEMGR -#define INCL_DOSERRORS -#include - # define FFBUF FILEFINDBUF3 # define Word ULONG /* @@ -59,8 +54,7 @@ /* * Return first char of filesystem type, or 0 if unknown. */ -static char -getFSType(const char *path) +static char API getFSType(const char *path) { static char cache[1+26]; char drive[3], info[512]; @@ -97,8 +91,7 @@ return cache [unit] = r; } -char * -_abs_path(const char *name, char *buffer, int len) +char * API _abs_path(const char *name, char *buffer, int len) { char buf[4]; if (isalpha((int)name[0]) && name[1] == ':' && name[2] == '\0') { @@ -113,8 +106,7 @@ return buffer; } -DIR * -_openxdir(const char *path, unsigned att_mask) +DIR * API _openxdir(const char *path, unsigned att_mask) { DIR *dir; char name[MAXPATHLEN+3]; @@ -171,14 +163,12 @@ return (DIR *)dir; } -DIR * -_opendir(const char *pathname) +DIR * API _opendir(const char *pathname) { return openxdir(pathname, 0); } -struct dirent * -_readdir(DIR *dir) +struct dirent * API _readdir(DIR *dir) { static int dummy_ino = 2; @@ -225,14 +215,12 @@ return &dir->entry; } -long -_telldir(DIR *dir) +long API _telldir(DIR *dir) { return dir->number; } -void -_seekdir(DIR *dir, long off) +void API _seekdir(DIR *dir, long off) { if (dir->number > off) { char name[MAXPATHLEN+2]; @@ -265,8 +253,7 @@ ; } -void -_closedir(DIR *dir) +void API _closedir(DIR *dir) { DosFindClose(dir->handle); free(dir); diff -r 55c9fa60af78 -r 2ff26b697877 platform/dirent.h --- a/platform/dirent.h Wed Mar 17 18:49:14 2004 +0000 +++ b/platform/dirent.h Sat Mar 20 01:21:13 2004 +0000 @@ -4,6 +4,7 @@ #ifndef __DIRENT_H__ #define __DIRENT_H__ +#include "compat.h" #include #ifdef MAXPATHLEN #undef MAXPATHLEN @@ -39,21 +40,21 @@ typedef struct _dirdescr DIR; /* the structs do not have to be defined here */ -extern DIR *_opendir(const char *); +extern DIR * API _opendir(const char *); #define opendir(a) _opendir(a) -extern DIR *_openxdir(const char *, unsigned); +extern DIR *API _openxdir(const char *, unsigned); #define openxdir(a, b) _openxdir(a, b) -extern struct dirent *_readdir(DIR *); +extern struct dirent * API _readdir(DIR *); #define readdir(a) _readdir(a) -extern void _seekdir(DIR *, long); +extern void API _seekdir(DIR *, long); #define seekdir(a, b) _seekdir(a, b) -extern long _telldir(DIR *); +extern long API _telldir(DIR *); #define telldir(a) _telldir(a) -extern void _closedir(DIR *); +extern void API _closedir(DIR *); #define closedir(a) _closedir(a) #define rewinddir(dirp) _seekdir(dirp, 0L) -extern char * _abs_path(const char *name, char *buffer, int len); +extern char * API _abs_path(const char *name, char *buffer, int len); #define abs_path(a, b, c) _abs_path(a, b, c) #ifndef S_IFMT