# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1038741101 0 # Node ID 0fc45e386376925811b5efc727ef6156f92715c8 # Parent b8e93557b2c7afa106b4a3539f88034ff4c065ed Get Dynamic Windows building with Watcom. diff -r b8e93557b2c7 -r 0fc45e386376 compat.c --- a/compat.c Sat Nov 30 16:25:06 2002 +0000 +++ b/compat.c Sun Dec 01 11:11:41 2002 +0000 @@ -70,7 +70,7 @@ int makedir(char *path) { -#if defined(__IBMC__) || (defined(__WIN32__) && !defined(__CYGWIN32__)) +#if defined(__IBMC__) || defined(__WATCOMC__) || (defined(__WIN32__) && !defined(__CYGWIN32__)) return mkdir(path); #else return mkdir(path,S_IRWXU); @@ -79,7 +79,7 @@ void nonblock(int fd) { -#ifdef __IBMC__ +#if defined(__OS2__) && !defined(__EMX__) static int _nonblock = 1; ioctl(fd, FIONBIO, (char *)&_nonblock, sizeof(_nonblock)); @@ -94,7 +94,7 @@ void block(int fd) { -#ifdef __IBMC__ +#if defined(__OS2__) && !defined(__EMX__) static int _nonblock = 0; ioctl(fd, FIONBIO, (char *)&_nonblock, sizeof(_nonblock)); @@ -631,7 +631,7 @@ /* Sharable fopen() and fclose() calls. */ FILE *fsopen(char *path, char *modes) { -#if defined(__OS2__) || defined(__WIN32__) +#if (defined(__OS2__) && !defined(__WATCOMC__)) || defined(__WIN32__) int z; if(!FSIRoot) diff -r b8e93557b2c7 -r 0fc45e386376 compat.h --- a/compat.h Sat Nov 30 16:25:06 2002 +0000 +++ b/compat.h Sun Dec 01 11:11:41 2002 +0000 @@ -1,7 +1,7 @@ /* $Id$ */ /* This header includes and defines everything needed for a given OS/compiler */ -#if !defined(__EMX__) && !defined(__IBMC__) && !defined(__WIN32__) && !defined(WINNT) +#ifdef __UNIX__ #include "config.h" #include @@ -35,7 +35,7 @@ #undef DIRSEP #endif -#if defined(__EMX__) || defined(__IBMC__) || defined(__WIN32__) || defined(WINNT) +#if defined(__EMX__) || defined(__OS2__) || defined(__WIN32__) || defined(WINNT) #include #include @@ -49,7 +49,7 @@ #endif /* OS/2 */ -#if defined(__EMX__) || defined(__IBMC__) +#if defined(__EMX__) || defined(__OS2__) #define INCL_WIN #define INCL_GPI #define INCL_VIO @@ -68,9 +68,12 @@ #undef FD_SETSIZE #endif #define FD_SETSIZE 1024 +#endif /* __EMX__ */ + +#if defined(__EMX__) || defined(__WATCOMC__) #define strcasecmp stricmp #define strncasecmp strnicmp -#endif /* __EMX__ */ +#endif #ifndef OS2 #define OS2 @@ -89,7 +92,7 @@ #define TPIPENAME "/tmp/" __TARGET__ "%d" #endif /* __EMX__ || __IBMC__ */ -#ifdef __IBMC__ +#if defined(__OS2__) && (defined(__IBMC__) || defined(__WATCOMC__)) #define BSD_SELECT #include @@ -100,8 +103,10 @@ #include #include /* For VAC we are using the Mozilla dirent.c */ +#ifndef __WATCOMC__ #include "platform/dirent.h" #endif +#endif /* Windows */ #if defined(__WIN32__) || defined(WINNT) @@ -156,6 +161,9 @@ #include #include #include +#if defined(__OS2__) && defined(RES_DEFAULT) +#undef RES_DEFAULT +#endif #include #if defined(STDC_HEADERS) || defined(__EMX__) #include diff -r b8e93557b2c7 -r 0fc45e386376 makefile.wpm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/makefile.wpm Sun Dec 01 11:11:41 2002 +0000 @@ -0,0 +1,24 @@ +#=================================================================== +# +# Auto-dependency information +# +#=================================================================== +OS22_H = $(%WATCOM)\h\os2 +CFLAGS = -i=os2 -i=$(OS22_H) -bt=OS2 -zq -d2 -bd + +.SUFFIXES: +.SUFFIXES: .obj .c +.c.obj: .AUTODEPEND + wcc386 $(CFLAGS) $*.c + +all: dw.dll dwcompat.dll + +dwcompat.dll: compat.obj + wlink name dwcompat.dll system os2v2_pm library so32dll,tcp32dll d a option symf f $[@ + +dw.dll: dw.obj + wlink name dw.dll system os2v2_pm d a option symf f $[@ + +dw.obj: os2\dw.c + wcc386 $(CFLAGS) os2\dw.c + diff -r b8e93557b2c7 -r 0fc45e386376 os2/dw.c --- a/os2/dw.c Sat Nov 30 16:25:06 2002 +0000 +++ b/os2/dw.c Sun Dec 01 11:11:41 2002 +0000 @@ -2200,7 +2200,6 @@ tmp = tmp->next; } - return (MRESULT)result; } @@ -4211,7 +4210,7 @@ HWND dw_slider_new(int vertical, int increments, ULONG id) { WindowData *blah = calloc(1, sizeof(WindowData)); - SLDCDATA sldcData = { sizeof(SLDCDATA), increments, 0, 0, 0 }; + SLDCDATA sldcData = { 0, 0, 0, 0, 0 }; HWND tmp = WinCreateWindow(HWND_OBJECT, WC_SLIDER, "", @@ -4224,6 +4223,8 @@ &sldcData, NULL); + sldcData.cbSize = sizeof(SLDCDATA); + sldcData.usScale1Increments = increments; blah->oldproc = WinSubclassWindow(tmp, _entryproc); WinSetWindowPtr(tmp, QWP_USER, blah); @@ -4362,12 +4363,12 @@ */ char *dw_window_get_text(HWND handle) { - char tempbuf[4096] = ""; - - WinQueryWindowText(handle, 4095, tempbuf); - tempbuf[4095] = 0; - - return strdup(tempbuf); + int len = WinQueryWindowTextLength(handle); + char *tempbuf = calloc(1, len + 2); + + WinQueryWindowText(handle, len + 1, tempbuf); + + return tempbuf; } /* @@ -7072,9 +7073,12 @@ ULONG ulBuild = 0; if (DosQuerySysInfo (QSV_BOOT_DRIVE, QSV_BOOT_DRIVE, &ulBootDrive, sizeof (ulBootDrive)) == NO_ERROR) { - char achFileName[11] = { (char)('A'+ulBootDrive-1),':','\\','O','S','2','K','R','N','L','\0' }; + char achFileName[11] = "C:\\OS2KRNL"; HFILE hfile; ULONG ulResult; + + achFileName[0] = (char)('A'+ulBootDrive-1); + if (DosOpen (achFileName, &hfile, &ulResult, 0, 0, OPEN_ACTION_FAIL_IF_NEW | OPEN_ACTION_OPEN_IF_EXISTS, OPEN_FLAGS_FAIL_ON_ERROR | OPEN_FLAGS_NO_CACHE | OPEN_FLAGS_SEQUENTIAL | OPEN_SHARE_DENYNONE | OPEN_ACCESS_READONLY, NULL) == NO_ERROR) { ULONG ulFileSize = 0; @@ -7255,6 +7259,7 @@ /* Internal function to set drive and directory */ int _SetPath(char *path) { +#ifndef __WATCOMC__ if(strlen(path) > 2) { if(path[1] == ':') @@ -7263,6 +7268,7 @@ _chdrive((drive - 'A')+1); } } +#endif return chdir(path); } @@ -7316,7 +7322,7 @@ if(stricmp(&browser[len], "explore.exe") == 0) { int newlen, z; - newurl = alloca(strlen(url) + 2); + newurl = malloc(strlen(url) + 2); sprintf(newurl, "file:///%s", &url[7]); newlen = strlen(newurl); for(z=8;z<(newlen-8);z++) @@ -7337,6 +7343,8 @@ _SetPath(olddir); free(olddir); } + if(newurl) + free(newurl); return ret; }