Mainly just added some small #ifdef sections for a little portability.
authorRobert Dickenson <robd@reactos.org>
Sun, 24 Nov 2002 18:24:52 +0000 (18:24 +0000)
committerRobert Dickenson <robd@reactos.org>
Sun, 24 Nov 2002 18:24:52 +0000 (18:24 +0000)
svn path=/trunk/; revision=3778

12 files changed:
reactos/include/funcs.h
reactos/include/napi/npipe.h
reactos/include/napi/teb.h
reactos/include/ntos.h
reactos/include/ntos/except.h
reactos/include/ntos/rtltypes.h
reactos/include/ntos/security.h
reactos/include/ntos/types.h
reactos/include/pe.h
reactos/include/structs.h
reactos/include/win32k/math.h
reactos/include/windows.h

index 0e4aa97..2a6d214 100644 (file)
@@ -932,7 +932,11 @@ LockResource(
             );
 
 int
+#ifdef __GNUC__
 STDCALL
+#else
+__stdcall
+#endif
 WinMain(
        HINSTANCE hInstance,
        HINSTANCE hPrevInstance,
index b89972f..58c1b1a 100644 (file)
@@ -135,9 +135,11 @@ typedef struct _NPFS_WAIT_PIPE
    LARGE_INTEGER Timeout;
 } NPFS_WAIT_PIPE, *PNPFS_WAIT_PIPE;
 
+#ifdef __GNUC__ // robd
 typedef struct _NPFS_LISTEN
 {
 } NPFS_LISTEN, *PNPFS_LISTEN;
+#endif
 
 typedef struct _NPFS_SET_STATE
 {
index ec94959..63ff5aa 100644 (file)
@@ -97,7 +97,7 @@ typedef struct _PEB_LDR_DATA
    LIST_ENTRY InInitializationOrderModuleList;
 } PEB_LDR_DATA, *PPEB_LDR_DATA;
 
-typedef VOID STDCALL (*PPEBLOCKROUTINE)(PVOID);
+typedef VOID STDCALL_FUNC (*PPEBLOCKROUTINE)(PVOID);
 
 typedef struct _PEB
 {
index 6e14bd0..4af8fed 100644 (file)
@@ -1,6 +1,6 @@
 #ifndef _NTOS_H
 #define _NTOS_H
-/* $Id: ntos.h,v 1.7 2002/11/14 18:21:02 chorns Exp $ */
+/* $Id: ntos.h,v 1.8 2002/11/24 18:24:51 robd Exp $ */
 
 #if defined(NTOS_MODE_USER)
 // include windows.h before ntddk.h to get user mode prototype for InterlockedXxx functions
@@ -47,6 +47,7 @@
 #include "kernel32/error.h"
 #else // Assume kernel mode
 #include <ddk/ntddk.h>
+//#include "ntos/types.h" // robd
 #include <ddk/ntifs.h>
 #include "ntos/types.h"
 #include "ntos/cdrom.h"
index 6299241..d464c56 100644 (file)
@@ -25,11 +25,19 @@ struct _EXCEPTION_REGISTRATION;
  * The type of function that is expected as an exception handler to be
  * installed with _try1.
  */
-typedef EXCEPTION_DISPOSITION CDECL (*PEXCEPTION_HANDLER)(
+#ifdef __GNUC__
+typedef EXCEPTION_DISPOSITION (CDECL *PEXCEPTION_HANDLER)(
   struct _EXCEPTION_RECORD* ExceptionRecord,
   struct _EXCEPTION_REGISTRATION* ExceptionRegistration,
   PCONTEXT Context,
   PVOID DispatcherContext);
+#else
+typedef EXCEPTION_DISPOSITION (CDECL *PEXCEPTION_HANDLER)(
+  struct _EXCEPTION_RECORD* ExceptionRecord,
+  struct _EXCEPTION_REGISTRATION* ExceptionRegistration,
+  PCONTEXT Context,
+  PVOID DispatcherContext);
+#endif /*__GNUC__*/
 
 #ifndef __USE_W32API
 
@@ -108,8 +116,13 @@ typedef PEXCEPTION_REGISTRATION PEXCEPTION_REGISTRATION_RECORD;
 #endif /* _GNU_H_WINDOWS32_DEFINES */
 
 // Functions of the following prototype return one of the above constants
+#ifdef __GNUC__
 typedef DWORD CDECL (*PSCOPE_EXCEPTION_FILTER)(VOID);
 typedef VOID CDECL (*PSCOPE_EXCEPTION_HANDLER)(VOID);
+#else
+typedef DWORD (CDECL *PSCOPE_EXCEPTION_FILTER)(VOID);
+typedef VOID (CDECL *PSCOPE_EXCEPTION_HANDLER)(VOID);
+#endif /*__GNUC__*/
 
 typedef struct _SCOPETABLE_ENTRY
 {
index fc594e1..f5f03bf 100755 (executable)
@@ -1,4 +1,4 @@
-/* $Id: rtltypes.h,v 1.1 2002/11/15 21:56:37 chorns Exp $
+/* $Id: rtltypes.h,v 1.2 2002/11/24 18:24:51 robd Exp $
  * 
  */
 
@@ -67,7 +67,7 @@ typedef struct _RTL_BITMAP
   PULONG Buffer;
 } RTL_BITMAP, *PRTL_BITMAP;
 
-typedef NTSTATUS STDCALL
+typedef NTSTATUS STDCALL_FUNC
 (*PRTL_QUERY_REGISTRY_ROUTINE)(PWSTR ValueName,
                               ULONG ValueType,
                               PVOID ValueData,
index d7b5359..6fc42b5 100644 (file)
@@ -62,9 +62,11 @@ typedef struct
 } ACE, *PACE;
 #endif
 
+#ifdef __GNU__
 typedef struct _SECURITY_DESCRIPTOR_CONTEXT
 {
 } SECURITY_DESCRIPTOR_CONTEXT, *PSECURITY_DESCRIPTOR_CONTEXT;
+#endif
 
 
 #ifndef __USE_W32API
index f1667db..0a7518e 100644 (file)
 
 #include <basetsd.h>
 
+#ifdef __GNUC__
+//#define STDCALL_FUNCPTR(a) STDCALL (* a)
+//#define STDCALL_FUNC(a) (STDCALL a )
+#define STDCALL_FUNC STDCALL
+#else
+//#define STDCALL_FUNCPTR(a) (STDCALL * a )
+#define STDCALL_FUNC(a) (__stdcall a )
+#endif /*__GNUC__*/
+
 /* Fixed precision types */
 typedef signed char         INT8, *PINT8;
 typedef signed short        INT16, *PINT16;
@@ -40,11 +49,20 @@ typedef short SHORT;
 #define CALLBACK    WINAPI
 #define PASCAL      WINAPI
 #else
+
+#ifdef __GNUC__
 #define STDCALL
 #define CDECL
 #define CALLBACK
 #define PASCAL
-#endif
+#else
+#define STDCALL __stdcall
+#define CDECL __cdecl
+#define CALLBACK
+#define PASCAL
+#endif /*__GNUC__*/
+
+#endif /*i386*/
 
 #ifdef _WIN64
 
@@ -85,10 +103,31 @@ typedef void *LPVOID;
 typedef float *PFLOAT;
 typedef unsigned short *PWCH;
 typedef unsigned short *PWORD;
-typedef long long LONGLONG;
-typedef unsigned long long ULONGLONG;
-typedef long long *PLONGLONG;
-typedef unsigned long long *PULONGLONG;
+
+#ifdef __GNUC__
+//typedef long long LONGLONG;
+//typedef unsigned long long ULONGLONG;
+//typedef long long *PLONGLONG;
+//typedef unsigned long long *PULONGLONG;
+#define LONGLONG long long
+#define ULONGLONG unsigned long long
+#define PLONGLONG long long *
+#define PULONGLONG unsigned long long *
+#else
+//typedef double LONGLONG;
+//typedef double ULONGLONG;
+//typedef double *PLONGLONG;
+//typedef double *PULONGLONG;
+#include <msvcrt\crttypes.h>
+#define inline __inline
+#define __asm__
+#define __volatile__(a)
+#define __attribute__(a)
+struct _KTHREAD { int foobar; };
+struct _ETHREAD { int foobar; };
+struct _EPROCESS { int foobar; };
+#endif
+
 typedef const void *LPCVOID;
 typedef BYTE *LPBYTE, *PBYTE;
 typedef BOOL *PBOOL;
@@ -109,7 +148,11 @@ typedef USHORT CSHORT;
 typedef const unsigned short *PCWSTR;
 typedef char* PCSZ;
 
+#ifdef __GNUC__
 typedef DWORD STDCALL (*PTHREAD_START_ROUTINE) (LPVOID);
+#else
+typedef DWORD (STDCALL *PTHREAD_START_ROUTINE) (LPVOID);
+#endif /*__GNUC__*/
 
 typedef union _LARGE_INTEGER
 {
@@ -410,12 +453,21 @@ typedef struct _SMALL_RECT
 } SMALL_RECT, *PSMALL_RECT;
 
 
+#ifdef __GNUC__
 typedef VOID STDCALL
 (*PTIMERAPCROUTINE)(
        LPVOID lpArgToCompletionRoutine,
        DWORD dwTimerLowValue,
        DWORD dwTimerHighValue
        );
+#else
+typedef VOID
+(STDCALL *PTIMERAPCROUTINE)(
+       LPVOID lpArgToCompletionRoutine,
+       DWORD dwTimerLowValue,
+       DWORD dwTimerHighValue
+       );
+#endif /*__GNUC__*/
 
 #include "except.h"
 
index 344fea1..b618758 100644 (file)
@@ -1,8 +1,25 @@
 #ifndef __INCLUDE_PE_H
 #define __INCLUDE_PE_H
 
+//#define _ANONYMOUS_UNION __extension__
+//#define _ANONYMOUS_STRUCT __extension__
+
+#ifdef __GNUC__
+#ifndef NONAMELESSUNION
+#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
 #define _ANONYMOUS_UNION __extension__
 #define _ANONYMOUS_STRUCT __extension__
+#else
+#if defined(__cplusplus)
+#define _ANONYMOUS_UNION __extension__
+#endif
+#endif /* __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) */
+#endif /* NONAMELESSUNION */
+#else
+#define _ANONYMOUS_UNION
+#define _ANONYMOUS_STRUCT
+#endif /* __GNUC__ */
+
 
 #ifndef NTAPI
 #define NTAPI STDCALL
index 56e0947..95732e7 100644 (file)
@@ -2434,6 +2434,8 @@ typedef struct tagMETAFILEPICT {
   LONG      xExt;
   LONG      yExt;
   HMETAFILE hMF;
+#else
+  LONG      mm; // robd
 #endif
 } METAFILEPICT, *PMETAFILEPICT, *LPMETAFILEPICT;
 
index f28111b..99d8981 100644 (file)
@@ -18,9 +18,9 @@
  *  DISCLAMED. This includes but is not limited to warranties of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  *
- * $Revision: 1.1 $
- * $Author: jfilby $
- * $Date: 2000/06/16 20:58:56 $
+ * $Revision: 1.2 $
+ * $Author: robd $
+ * $Date: 2002/11/24 18:24:52 $
  *
  */
 // added modfl 
@@ -42,7 +42,7 @@ extern "C" {
  *
  * NOTE: The CRTDLL version uses _HUGE_dll instead.
  */
-#if __MSVCRT__
+#ifdef __MSVCRT__
 extern double* __imp__HUGE;
 #define        HUGE_VAL        (*__imp__HUGE)
 #else
index 8e62678..6404819 100644 (file)
 #endif
 #endif /* __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) */
 #endif /* NONAMELESSUNION */
+#else
+#define _ANONYMOUS_UNION
+#define _ANONYMOUS_STRUCT
 #endif /* __GNUC__ */
 
 #ifndef _ANONYMOUS_UNION