This is the mail archive of the cygwin-patches@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Fwd: [Mingw-users] w32api & Watcom ( second try )


Hello
The following patch to make w32api headers compatible with Watcom compiler
has been posted to mingw users list.   Any objections?

Danny

--- Mattia Barbon <mbarbon@dsi.unive.it> wrote: > From: "Mattia Barbon"
<mbarbon@dsi.unive.it>
> To: mingw-users@lists.sourceforge.net
> Reply-to: mbarbon@dsi.unive.it
> Subject: [Mingw-users] w32api & Watcom ( second try )
> Date: Fri, 2 Nov 2001 11:47:00 +0100
> 
> Changes from the last are:
> * some more corrections
> * the introduction of
>   DECLARE_STDCALL_P( type ) that resolves ( in an ugly way )
>   the problem of __stdcall foo* functions
> 
>   DECLARE_STDCALL_P( type ) expands to
>   __stdcall type for GCC  and
>   type __stdcall for watcom
> 
> If the patch looks ok I'll submit a changelog, too
> 
> Regards
> Mattia
>   
> 
> > Index: include/largeint.h
> ===================================================================
> RCS file: /cvsroot/mingw/w32api/include/largeint.h,v
> retrieving revision 1.1.1.1
> diff -u -2 -r1.1.1.1 largeint.h
> --- include/largeint.h	2001/06/05 01:36:38	1.1.1.1
> +++ include/largeint.h	2001/11/01 22:33:28
> @@ -14,5 +14,5 @@
>  #endif
>  
> -#ifdef _HAVE_INT64
> +#if defined(_HAVE_INT64) || defined(__WATCOMC__)
>  #define _toi (__int64)
>  #define _toui (unsigned __int64)
> Index: include/rpcdcep.h
> ===================================================================
> RCS file: /cvsroot/mingw/w32api/include/rpcdcep.h,v
> retrieving revision 1.1.1.1
> diff -u -2 -r1.1.1.1 rpcdcep.h
> --- include/rpcdcep.h	2001/06/05 01:36:41	1.1.1.1
> +++ include/rpcdcep.h	2001/11/01 22:33:29
> @@ -82,5 +82,5 @@
>  void __stdcall I_RpcClearMutex(I_RPC_MUTEX);
>  void __stdcall I_RpcDeleteMutex(I_RPC_MUTEX);
> -__stdcall void *I_RpcAllocate(unsigned int);
> +DECLARE_STDCALL_P(void *) I_RpcAllocate(unsigned int);
>  void __stdcall I_RpcFree(void*);
>  void __stdcall I_RpcPauseExecution(unsigned long);
> Index: include/windef.h
> ===================================================================
> RCS file: /cvsroot/mingw/w32api/include/windef.h,v
> retrieving revision 1.1.1.1
> diff -u -2 -r1.1.1.1 windef.h
> --- include/windef.h	2001/06/05 01:36:42	1.1.1.1
> +++ include/windef.h	2001/11/01 22:33:29
> @@ -89,5 +89,13 @@
>  #define DECLSPEC_IMPORT __declspec(dllimport)
>  #define DECLSPEC_EXPORT __declspec(dllexport)
> +#ifdef __GNUC__
>  #define DECLSPEC_NORETURN __declspec(noreturn)
> +#define DECLARE_STDCALL_P( type ) __stdcall type
> +#else
> +#if defined(__WATCOMC__)
> +#define DECLSPEC_NORETURN
> +#define DECLARE_STDCALL_P( type ) type __stdcall
> +#endif
> +#endif
>  #define MAKEWORD(a,b)	((WORD)(((BYTE)(a))|(((WORD)((BYTE)(b)))<<8)))
>  #define MAKELONG(a,b)	((LONG)(((WORD)(a))|(((DWORD)((WORD)(b)))<<16)))
> Index: include/windows.h
> ===================================================================
> RCS file: /cvsroot/mingw/w32api/include/windows.h,v
> retrieving revision 1.2
> diff -u -2 -r1.2 windows.h
> --- include/windows.h	2001/08/29 17:07:20	1.2
> +++ include/windows.h	2001/11/01 22:33:29
> @@ -49,7 +49,12 @@
>  #if defined(__cplusplus)
>  #define _ANONYMOUS_UNION __extension__
> -#endif
> +#endif /* __cplusplus */
>  #endif /* __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) */
>  #endif /* NONAMELESSUNION */
> +#else
> +#if defined(__WATCOMC__)
> +#define _ANONYMOUS_UNION
> +#define _ANONYMOUS_STRUCT
> +#endif /* __WATCOMC__ */
>  #endif /* __GNUC__ */
>  
> Index: include/winnt.h
> ===================================================================
> RCS file: /cvsroot/mingw/w32api/include/winnt.h,v
> retrieving revision 1.11
> diff -u -2 -r1.11 winnt.h
> --- include/winnt.h	2001/10/30 01:37:18	1.11
> +++ include/winnt.h	2001/11/01 22:33:35
> @@ -2525,4 +2525,7 @@
>  	WORD   UnparsedNameLength;
>  } REPARSE_POINT_INFORMATION, *PREPARSE_POINT_INFORMATION;
> +
> +#if defined(__GNUC__)
> +
>  extern __inline__ PVOID GetCurrentFiber(void)
>  {
> @@ -2547,4 +2550,21 @@
>      return ret;
>  }
> +
> +#else
> +
> +extern PVOID GetCurrentFiber(void);
> +#pragma aux GetCurrentFiber = \
> +        "mov	eax, dword ptr fs:0x10" \
> +        value [eax] \
> +        modify [eax];
> +
> +extern PVOID GetFiberData(void);
> +#pragma aux GetFiberData = \
> +	"mov	eax, dword ptr fs:0x10" \
> +	"mov	eax, [eax]" \
> +        value [eax] \
> +        modify [eax];
> +        
> +#endif /* __GNUC__ */
>  
>  #endif
> Index: include/winsock.h
> ===================================================================
> RCS file: /cvsroot/mingw/w32api/include/winsock.h,v
> retrieving revision 1.2
> diff -u -2 -r1.2 winsock.h
> --- include/winsock.h	2001/08/29 17:07:20	1.2
> +++ include/winsock.h	2001/11/01 22:33:36
> @@ -430,5 +430,5 @@
>  int PASCAL getsockopt(SOCKET,int,int,char*,int*);
>  unsigned long PASCAL inet_addr(const char*);
> -PASCAL char *inet_ntoa(struct in_addr);
> +DECLARE_STDCALL_P(char *) inet_ntoa(struct in_addr);
>  int PASCAL listen(SOCKET,int);
>  int PASCAL recv(SOCKET,char*,int,int);
> @@ -439,10 +439,10 @@
>  int PASCAL shutdown(SOCKET,int);
>  SOCKET PASCAL socket(int,int,int);
> -PASCAL struct hostent *gethostbyaddr(const char*,int,int);
> -PASCAL struct hostent *gethostbyname(const char*);
> -PASCAL struct servent *getservbyport(int,const char*);
> -PASCAL struct servent *getservbyname(const char*,const char*);
> -PASCAL struct protoent *getprotobynumber(int);
> -PASCAL struct protoent *getprotobyname(const char*);
> +DECLARE_STDCALL_P(struct hostent *) gethostbyaddr(const char*,int,int);
> +DECLARE_STDCALL_P(struct hostent *) gethostbyname(const char*);
> +DECLARE_STDCALL_P(struct servent *) getservbyport(int,const char*);
> +DECLARE_STDCALL_P(struct servent *) getservbyname(const char*,const
> char*);
> +DECLARE_STDCALL_P(struct protoent *) getprotobynumber(int);
> +DECLARE_STDCALL_P(struct protoent *) getprotobyname(const char*);
>  int PASCAL WSAStartup(WORD,LPWSADATA);
>  int PASCAL WSACleanup(void);
> Index: lib/dinput.c
> ===================================================================
> RCS file: /cvsroot/mingw/w32api/lib/dinput.c,v
> retrieving revision 1.1.1.1
> diff -u -2 -r1.1.1.1 dinput.c
> --- lib/dinput.c	2001/06/05 01:36:46	1.1.1.1
> +++ lib/dinput.c	2001/11/01 22:33:39
> @@ -22,5 +22,5 @@
>  */
>  
> -#if defined(__LCC__) || defined(__GNUC__)
> +#if defined(__LCC__) || defined(__GNUC__) || defined(__WATCOMC__)
>  #include <windows.h>
>  #include <objbase.h>
> Index: lib/kernel32.c
> ===================================================================
> RCS file: /cvsroot/mingw/w32api/lib/kernel32.c,v
> retrieving revision 1.1
> diff -u -2 -r1.1 kernel32.c
> --- lib/kernel32.c	2001/08/10 07:11:32	1.1
> +++ lib/kernel32.c	2001/11/01 22:33:40
> @@ -1,4 +1,6 @@
>  /* extern (library) versions of inline functions defined in winnt.h */
>  
> +#if defined(__GNUC__)
> +
>  void* GetCurrentFiber(void)
>  {
> @@ -24,2 +26,26 @@
>  }
>  
> +#else
> +
> +void* GetCurrentFiber(void)
> +{
> +    void* res;
> +    _asm {
> +    	mov	eax, dword ptr fs:0x10
> +    	mov	res, eax
> +    };
> +    return res;
> +}
> +
> +void* GetFiberData(void)
> +{
> +    void* res;
> +    _asm {
> +	mov	eax, dword ptr fs:0x10
> +	mov	eax, [eax]
> +	mov	res, eax
> +    };
> +    return res;
> +}
> +
> +#endif /* __GNUC__ */
> Index: lib/scrnsave.c
> ===================================================================
> RCS file: /cvsroot/mingw/w32api/lib/scrnsave.c,v
> retrieving revision 1.1.1.1
> diff -u -2 -r1.1.1.1 scrnsave.c
> --- lib/scrnsave.c	2001/06/05 01:36:46	1.1.1.1
> +++ lib/scrnsave.c	2001/11/01 22:33:48
> @@ -156,5 +156,5 @@
>          case '/':
>          case ' ':
> -        default:
> +        default: break;
>          }
>      }
>  


http://briefcase.yahoo.com.au - Yahoo! Briefcase
- Manage your files online.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]