changeset 24:d9e87e8bcf1d

Updated dynamic windows to build with EMX.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Fri, 17 Aug 2001 11:44:05 +0000
parents 2932f9d2c7d5
children f9fd7238635c
files compat.h dirent.h dw.def dw.h makefile.vac os2/dirent.c os2/dw.c platform/dirent.h
diffstat 8 files changed, 203 insertions(+), 194 deletions(-) [+]
line wrap: on
line diff
--- a/compat.h	Sat Aug 04 19:36:21 2001 +0000
+++ b/compat.h	Fri Aug 17 11:44:05 2001 +0000
@@ -55,6 +55,11 @@
 #define msleep(a) DosSleep(a)
 
 #ifdef __EMX__
+#include <dirent.h>
+#include <sys/stat.h>
+#ifdef FD_SETSIZE
+#undef FD_SETSIZE
+#endif
 #define FD_SETSIZE 1024
 #define strcasecmp stricmp
 #define strncasecmp strnicmp
@@ -88,7 +93,7 @@
 #include <direct.h>
 #include <stdarg.h>
 /* For VAC we are using the Mozilla dirent.c */
-#include "dirent.h"
+#include "platform/dirent.h"
 #endif
 
 /* Windows */
@@ -99,7 +104,7 @@
 #include <process.h>
 #include <sys/stat.h>
 #ifdef MSVC
-#include "dirent.h"
+#include "platform/dirent.h"
 #else
 #include <dir.h>
 #include <dirent.h>
@@ -145,7 +150,7 @@
 #include <netdb.h>
 #include <arpa/nameser.h>
 #include <resolv.h>
-#ifdef STDC_HEADERS
+#if defined(STDC_HEADERS) || defined(__EMX__)
 #include <stdarg.h>
 #include <string.h>
 #endif /* STDC_HEADERS */
@@ -191,4 +196,5 @@
 FILE *fsopen(char *path, char *modes);
 int fsclose(FILE *fp);
 char *fsgets(char *str, int size, FILE *stream);
+int fsseek(FILE *stream, long offset, int whence);
 
--- a/dirent.h	Sat Aug 04 19:36:21 2001 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,181 +0,0 @@
-#ifdef OS2
-#ifndef __DIRENT_H__
-#define __DIRENT_H__
-
-#ifdef __EMX__
-#include <sys/param.h>
-#else
-#if defined(__IBMC__) || defined(__IBMCPP__) || defined(XP_W32_MSVC)
-#include <stdio.h>
-#ifdef MAXPATHLEN
-	#undef MAXPATHLEN
-#endif
-#define MAXPATHLEN (FILENAME_MAX*4)
-#define MAXNAMLEN FILENAME_MAX
-
-#else
-#include <param.h>
-#endif
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* attribute stuff */
-#ifndef A_RONLY
-# define A_RONLY   0x01
-# define A_HIDDEN  0x02
-# define A_SYSTEM  0x04
-# define A_LABEL   0x08
-# define A_DIR     0x10
-# define A_ARCHIVE 0x20
-#endif
-
-struct dirent {
-#if defined(OS2) || defined(WIN32)        /* use the layout of EMX to avoid trouble */
-    int            d_ino;                 /* Dummy */
-    int            d_reclen;		  /* Dummy, same as d_namlen */
-    int            d_namlen;              /* length of name */
-    char           d_name[MAXNAMLEN + 1];
-    unsigned long  d_size;
-    unsigned short d_attribute;           /* attributes (see above) */
-    unsigned short d_time;                /* modification time */
-    unsigned short d_date;                /* modification date */
-#else
-    char	   d_name[MAXNAMLEN + 1]; /* garentee null termination */
-    char	   d_attribute;		  /* .. extension .. */
-    unsigned long  d_size;		  /* .. extension .. */
-#endif
-};
-
-typedef struct _dirdescr DIR;
-/* the structs do not have to be defined here */
-
-extern DIR		*opendir(const char *);
-extern DIR		*openxdir(const char *, unsigned);
-extern struct dirent	*readdir(DIR *);
-extern void		seekdir(DIR *, long);
-extern long		telldir(DIR *);
-extern void 		closedir(DIR *);
-#define			rewinddir(dirp) seekdir(dirp, 0L)
-
-extern char *		abs_path(const char *name, char *buffer, int len);
-
-#ifndef S_IFMT
-#define S_IFMT ( S_IFDIR | S_IFREG )
-#endif
-
-#ifndef S_ISDIR
-#define S_ISDIR( m )                    (((m) & S_IFMT) == S_IFDIR)
-#endif
-
-#ifndef S_ISREG
-#define S_ISREG( m )                    (((m) & S_IFMT) == S_IFREG)
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-#endif
-
-#ifdef WIN32
-#ifndef __DIRENT_H__
-#define __DIRENT_H__
-/*
- * @(#)msd_dir.h 1.4 87/11/06   Public Domain.
- *
- *  A public domain implementation of BSD directory routines for
- *  MS-DOS.  Written by Michael Rendell ({uunet,utai}michael@garfield),
- *  August 1897
- *
- *  Extended by Peter Lim (lim@mullian.oz) to overcome some MS DOS quirks
- *  and returns 2 more pieces of information - file size & attribute.
- *  Plus a little reshuffling of some #define's positions    December 1987
- *
- *  Some modifications by Martin Junius                      02-14-89
- *
- *	AK900712
- *	AK910410	abs_path - make absolute path
- *
- */
-
-#ifdef __EMX__
-#include <sys/param.h>
-#else
-#if defined(__IBMC__) || defined(__IBMCPP__) || defined(MSVC)
-#include <stdio.h>
-#ifdef MAXPATHLEN
-	#undef MAXPATHLEN
-#endif
-#define MAXPATHLEN (FILENAME_MAX*4)
-#define MAXNAMLEN FILENAME_MAX
-#else
-#include <param.h>
-#endif
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* attribute stuff */
-#ifndef A_RONLY
-# define A_RONLY   0x01
-# define A_HIDDEN  0x02
-# define A_SYSTEM  0x04
-# define A_LABEL   0x08
-# define A_DIR     0x10
-# define A_ARCHIVE 0x20
-#endif
-
-struct dirent {
-#if defined(OS2) || defined(WIN32)        /* use the layout of EMX to avoid trouble */
-    int            d_ino;                 /* Dummy */
-    int            d_reclen;		  /* Dummy, same as d_namlen */
-    int            d_namlen;              /* length of name */
-    char           d_name[MAXNAMLEN + 1];
-    unsigned long  d_size;
-    unsigned short d_attribute;           /* attributes (see above) */
-    unsigned short d_time;                /* modification time */
-    unsigned short d_date;                /* modification date */
-#else
-    char	   d_name[MAXNAMLEN + 1]; /* garentee null termination */
-    char	   d_attribute;		  /* .. extension .. */
-    unsigned long  d_size;		  /* .. extension .. */
-#endif
-};
-
-typedef struct _dirdescr DIR;
-/* the structs do not have to be defined here */
-
-extern DIR		*opendir(const char *);
-extern DIR		*openxdir(const char *, unsigned);
-extern struct dirent	*readdir(DIR *);
-extern void		seekdir(DIR *, long);
-extern long		telldir(DIR *);
-extern void 		closedir(DIR *);
-#define			rewinddir(dirp) seekdir(dirp, 0L)
-
-extern char *		abs_path(const char *name, char *buffer, int len);
-
-#ifndef S_IFMT
-#define S_IFMT ( S_IFDIR | S_IFREG )
-#endif
-
-#ifndef S_ISDIR
-#define S_ISDIR( m )                    (((m) & S_IFMT) == S_IFDIR)
-#endif
-
-#ifndef S_ISREG
-#define S_ISREG( m )                    (((m) & S_IFMT) == S_IFREG)
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-#endif
--- a/dw.def	Sat Aug 04 19:36:21 2001 +0000
+++ b/dw.def	Fri Aug 17 11:44:05 2001 +0000
@@ -21,7 +21,7 @@
   dw_user_dir                            @20
   dw_flush                               @21
   dw_free                                @22
-                                         
+                                       
   dw_box_new                             @40
   dw_groupbox_new                        @41
   dw_box_pack_start                      @42
@@ -183,7 +183,7 @@
   dw_pixmap_new                          @341
   dw_pixmap_grab                         @342
   dw_pixmap_destroy                      @343
-                                         
+                                   
   dw_dialog_new                          @350
   dw_dialog_dismiss                      @351
   dw_dialog_wait                         @352
--- a/dw.h	Sat Aug 04 19:36:21 2001 +0000
+++ b/dw.h	Fri Aug 17 11:44:05 2001 +0000
@@ -307,7 +307,7 @@
 typedef struct _box {
 #if defined(__WIN32__) || defined(WINNT)
 	ColorInfo cinfo;
-#elif defined(__OS2__)
+#elif defined(__OS2__) || defined(__EMX__)
 	PFNWP oldproc;
 #endif
     /* Number of items in the box */
@@ -555,14 +555,14 @@
 #define DW_BLUE_VALUE(a) ((a & DW_BLUE_MASK) >> 16)
 #define DW_RGB(a, b, c) (0xFF000000 | a | b << 8 | c << 16)
 
-#ifdef __OS2__
+#if defined(__OS2__) || defined(__EMX__)
 #define DW_OS2_RGB(a) ((DW_RED_VALUE(a) << 16) | (DW_GREEN_VALUE(a) << 8) | DW_BLUE_VALUE(a))
 #endif
 
 /* Public function prototypes */
 void dw_box_pack_start(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad);
 void dw_box_pack_end(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad);
-#if !defined(__OS2__) && !defined(__WIN32__)
+#if !defined(__OS2__) && !defined(__WIN32__) && !defined(__EMX__)
 int dw_int_init(DWResources *res, int newthread, int argc, char *argv[]);
 #define dw_init(a, b, c) dw_int_init(&_resources, a, b, c)
 #else
--- a/makefile.vac	Sat Aug 04 19:36:21 2001 +0000
+++ b/makefile.vac	Fri Aug 17 11:44:05 2001 +0000
@@ -5,7 +5,7 @@
     .\dwcompat.dll
 
 .c.obj:
-  icc.exe  /DOS2 /DTCPV40HDRS /DBUILD_DLL /I. /I..\..\include /Tdc /Ss /Wprorearet /Wpro+ /V"Dynamic Windows Compatibility" /Ti /Gm /Gd- /G5 /Ge- /C /W3 /Wini+ /Wpar+ /Wpro+ /Wuse+ %s
+  icc.exe  /DOS2 /DTCPV40HDRS /DBUILD_DLL /I. /Tdc /Ss /Wprorearet /Wpro+ /V"Dynamic Windows Compatibility" /Ti /Gm /Gd- /G5 /Ge- /C /W3 /Wini+ /Wpar+ /Wpro+ /Wuse+ %s
 
 .\dw.dll: \
     .\os2\dw.obj
--- a/os2/dirent.c	Sat Aug 04 19:36:21 2001 +0000
+++ b/os2/dirent.c	Fri Aug 17 11:44:05 2001 +0000
@@ -5,7 +5,7 @@
 #include <string.h>
 #include <ctype.h>
 
-#include "dirent.h"
+#include "platform/dirent.h"
 #include <errno.h>
 
 /*#ifndef __EMX__ 
@@ -122,6 +122,9 @@
 	char name[MAXPATHLEN+3];
 	Word rc;
 
+	if(!path)
+		return NULL;
+
 	dir = malloc(sizeof(DIR));
 	if (dir == NULL) {
 		errno = ENOMEM;
--- a/os2/dw.c	Sat Aug 04 19:36:21 2001 +0000
+++ b/os2/dw.c	Fri Aug 17 11:44:05 2001 +0000
@@ -1096,7 +1096,7 @@
 			GpiSetColor(hpsPaint, CLR_PALEGRAY);
 
 			ptl.x = 0;
-			ptl.y = 99;
+			ptl.y = 0;
 			GpiMove(hpsPaint, &ptl);
 
 			ptl.x = width;
@@ -1210,7 +1210,7 @@
 
 					if(hWnd == tmp->window || WinWindowFromID(tmp->window, FID_CLIENT) == hWnd || WinQueryCapture(HWND_DESKTOP) == tmp->window)
 					{
-						int button;
+						int button = 0;
 
 						switch(origmsg)
 						{
@@ -1237,7 +1237,7 @@
 
 					if(hWnd == tmp->window || WinWindowFromID(tmp->window, FID_CLIENT) == hWnd || WinQueryCapture(HWND_DESKTOP) == tmp->window)
 					{
-						int button;
+						int button = 0;
 
 						switch(origmsg)
 						{
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/platform/dirent.h	Fri Aug 17 11:44:05 2001 +0000
@@ -0,0 +1,181 @@
+#ifdef __OS2__
+#ifndef __DIRENT_H__
+#define __DIRENT_H__
+
+#ifdef __EMX__
+#include <sys/param.h>
+#else
+#if defined(__IBMC__) || defined(__IBMCPP__) || defined(XP_W32_MSVC)
+#include <stdio.h>
+#ifdef MAXPATHLEN
+	#undef MAXPATHLEN
+#endif
+#define MAXPATHLEN (FILENAME_MAX*4)
+#define MAXNAMLEN FILENAME_MAX
+
+#else
+#include <param.h>
+#endif
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* attribute stuff */
+#ifndef A_RONLY
+# define A_RONLY   0x01
+# define A_HIDDEN  0x02
+# define A_SYSTEM  0x04
+# define A_LABEL   0x08
+# define A_DIR     0x10
+# define A_ARCHIVE 0x20
+#endif
+
+struct dirent {
+#if defined(__OS2__) || defined(__WIN32__) /* use the layout of EMX to avoid trouble */
+    int            d_ino;                 /* Dummy */
+    int            d_reclen;		  /* Dummy, same as d_namlen */
+    int            d_namlen;              /* length of name */
+    char           d_name[MAXNAMLEN + 1];
+    unsigned long  d_size;
+    unsigned short d_attribute;           /* attributes (see above) */
+    unsigned short d_time;                /* modification time */
+    unsigned short d_date;                /* modification date */
+#else
+    char	   d_name[MAXNAMLEN + 1]; /* garentee null termination */
+    char	   d_attribute;		  /* .. extension .. */
+    unsigned long  d_size;		  /* .. extension .. */
+#endif
+};
+
+typedef struct _dirdescr DIR;
+/* the structs do not have to be defined here */
+
+extern DIR		*opendir(const char *);
+extern DIR		*openxdir(const char *, unsigned);
+extern struct dirent	*readdir(DIR *);
+extern void		seekdir(DIR *, long);
+extern long		telldir(DIR *);
+extern void 		closedir(DIR *);
+#define			rewinddir(dirp) seekdir(dirp, 0L)
+
+extern char *		abs_path(const char *name, char *buffer, int len);
+
+#ifndef S_IFMT
+#define S_IFMT ( S_IFDIR | S_IFREG )
+#endif
+
+#ifndef S_ISDIR
+#define S_ISDIR( m )                    (((m) & S_IFMT) == S_IFDIR)
+#endif
+
+#ifndef S_ISREG
+#define S_ISREG( m )                    (((m) & S_IFMT) == S_IFREG)
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+#endif
+
+#ifdef __WIN32__
+#ifndef __DIRENT_H__
+#define __DIRENT_H__
+/*
+ * @(#)msd_dir.h 1.4 87/11/06   Public Domain.
+ *
+ *  A public domain implementation of BSD directory routines for
+ *  MS-DOS.  Written by Michael Rendell ({uunet,utai}michael@garfield),
+ *  August 1897
+ *
+ *  Extended by Peter Lim (lim@mullian.oz) to overcome some MS DOS quirks
+ *  and returns 2 more pieces of information - file size & attribute.
+ *  Plus a little reshuffling of some #define's positions    December 1987
+ *
+ *  Some modifications by Martin Junius                      02-14-89
+ *
+ *	AK900712
+ *	AK910410	abs_path - make absolute path
+ *
+ */
+
+#ifdef __EMX__
+#include <sys/param.h>
+#else
+#if defined(__IBMC__) || defined(__IBMCPP__) || defined(MSVC)
+#include <stdio.h>
+#ifdef MAXPATHLEN
+	#undef MAXPATHLEN
+#endif
+#define MAXPATHLEN (FILENAME_MAX*4)
+#define MAXNAMLEN FILENAME_MAX
+#else
+#include <param.h>
+#endif
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* attribute stuff */
+#ifndef A_RONLY
+# define A_RONLY   0x01
+# define A_HIDDEN  0x02
+# define A_SYSTEM  0x04
+# define A_LABEL   0x08
+# define A_DIR     0x10
+# define A_ARCHIVE 0x20
+#endif
+
+struct dirent {
+#if defined(__OS2__) || defined(__WIN32__)        /* use the layout of EMX to avoid trouble */
+    int            d_ino;                 /* Dummy */
+    int            d_reclen;		  /* Dummy, same as d_namlen */
+    int            d_namlen;              /* length of name */
+    char           d_name[MAXNAMLEN + 1];
+    unsigned long  d_size;
+    unsigned short d_attribute;           /* attributes (see above) */
+    unsigned short d_time;                /* modification time */
+    unsigned short d_date;                /* modification date */
+#else
+    char	   d_name[MAXNAMLEN + 1]; /* garentee null termination */
+    char	   d_attribute;		  /* .. extension .. */
+    unsigned long  d_size;		  /* .. extension .. */
+#endif
+};
+
+typedef struct _dirdescr DIR;
+/* the structs do not have to be defined here */
+
+extern DIR		*opendir(const char *);
+extern DIR		*openxdir(const char *, unsigned);
+extern struct dirent	*readdir(DIR *);
+extern void		seekdir(DIR *, long);
+extern long		telldir(DIR *);
+extern void 		closedir(DIR *);
+#define			rewinddir(dirp) seekdir(dirp, 0L)
+
+extern char *		abs_path(const char *name, char *buffer, int len);
+
+#ifndef S_IFMT
+#define S_IFMT ( S_IFDIR | S_IFREG )
+#endif
+
+#ifndef S_ISDIR
+#define S_ISDIR( m )                    (((m) & S_IFMT) == S_IFDIR)
+#endif
+
+#ifndef S_ISREG
+#define S_ISREG( m )                    (((m) & S_IFMT) == S_IFREG)
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+#endif