changeset 525:2ff26b697877

Fixes for building with Innotek GCC. Will have to check for regressions with VAC and EMX.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sat, 20 Mar 2004 01:21:13 +0000
parents 55c9fa60af78
children d3ce0afa6cf5
files compat.h dw.h makefile.emx os2/dirent.c platform/dirent.h
diffstat 5 files changed, 31 insertions(+), 39 deletions(-) [+]
line wrap: on
line diff
--- 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 <dirent.h>
+#endif
 #include <sys/stat.h>
 #define HAVE_PIPE
 #ifdef FD_SETSIZE
--- 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
 
--- 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 $<	
 
--- 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 <string.h>
 #include <ctype.h>
 
+#define INCL_DOSFILEMGR
+#define INCL_DOSERRORS
+#include "dw.h"
 #include "platform/dirent.h"
 #include <errno.h>
 
-/*#ifndef __EMX__ 
-#include <libx.h>
-#endif */
-
-#define INCL_DOSFILEMGR
-#define INCL_DOSERRORS
-#include <os2.h>
-
 # 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);
--- 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 <stdio.h>
 #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