/* $Id$ * Include file for GNU world compatibility with reactos include files for libcaptive * Copyright (C) 2002 Jan Kratochvil * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; exactly version 2 of June 1991 is required * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* NEVER protect this include file with #ifndef/#define/#endif * wrapper as we need to be included multiple times * Despite this we still #define the symbol to be able to check it */ #ifdef _CAPTIVE_REACTOS_COMPAT_H #undef _CAPTIVE_REACTOS_COMPAT_H #define _CAPTIVE_REACTOS_COMPAT_H 2 #else #define _CAPTIVE_REACTOS_COMPAT_H 1 #endif /* NEVER use #include in this file before all the #define-s are done * as we pretend any nested #include "reactos/compat.h" automatically as 'succeeded'. * NEVER use any #include inside !REACTOS_COMPAT condition branches. * We never nest as the include is protected by #ifdef from reactos/?*.h includes. */ #ifdef _CAPTIVE_REACTOS_COMPAT_H_INSIDE #error "$(top_srcdir)/src/libcaptive/include/reactos/compat.h MUST NOT NEST!" #endif #define _CAPTIVE_REACTOS_COMPAT_H_INSIDE 1 /* reactos uses __declspec(dllimport) and __declspec(dllexport) * which gets expanded to __attribute__($2) by -D in their Makefile GCC commandline. */ #ifdef REACTOS_COMPAT #define __declspec(type) #else #undef __declspec #endif /* It gets defined to __attribute__((fastcall)) by "ddk/ntddk.h". */ #ifdef REACTOS_COMPAT #define FASTCALL #else #undef FASTCALL #endif #ifdef REACTOS_COMPAT #define wcscpy captive_reactos_wcscpy #else #undef wcscpy #endif #ifdef REACTOS_COMPAT #define wcscat captive_reactos_wcscat #else #undef wcscat #endif #ifdef REACTOS_COMPAT #define wcschr captive_reactos_wcschr #else #undef wcschr #endif #ifdef REACTOS_COMPAT #define wcsrchr captive_reactos_wcsrchr #else #undef wcsrchr #endif #ifdef REACTOS_COMPAT #define wcslen captive_reactos_wcslen #else #undef wcslen #endif #ifdef REACTOS_COMPAT #define _wcsicmp captive_reactos__wcsicmp #else #undef _wcsicmp #endif /* int iswdigit(wint_t wc); should be safe */ /* int iswlower(wint_t wc); should be safe */ /* int iswxdigit(wint_t wc); should be safe */ /* Place BEFORE "internal/debug.h" include as there is * internal/debug.h->internal/ntoskrnl.h->ddk/ntddk.h->REACTOS_UCS2() */ #ifdef REACTOS_COMPAT #include /* for wchar_t; Prevent declaration while REACTOS_COMPAT is active */ /* You MUST include "captive/unicode_reactos.h" before wchar_t redefinition! */ #include "captive/unicode_reactos.h" /* for captive_ucs4_to_ucs2_const() for crtdll/string.h/REACTOS_UCS2() and captive_ucs2 */ #define wchar_t captive_ucs2 #define REACTOS_UCS2(string_wchar32) (captive_wchar32_to_ucs2_const((string_wchar32))) #else #undef wchar_t #undef REACTOS_UCS2 #endif /* for internal/debug.h */ #ifdef REACTOS_COMPAT #define DBG 1 #else #undef DBG #endif /* -------------------------------- #include-s permitted now, #define-s forbidden * See above #define _CAPTIVE_REACTOS_COMPAT_H_INSIDE in this file. */ /* Place AFTER REACTOS_UCS2 definition as there is * internal/debug.h->internal/ntoskrnl.h->ddk/ntddk.h->REACTOS_UCS2() * Some sources (reactos/ntoskrnl/ldr/loader.c) define NDEBUG themselves! * We have to pre-define all the non-NDEBUG (=debug) macros for such source files. */ #ifdef REACTOS_COMPAT #ifdef __NTOSKRNL__ /* Don't pollute the namespace outside ntoskrnl. */ #include "reactos/internal/debug.h" #endif #endif #ifdef REACTOS_COMPAT /* All invalid reactos definitions go to captive_reactos_* as trash */ #define _KPCR captive_reactos__KPCR #define KPCR captive_reactos_KPCR #define PKPCR captive_reactos_PKPCR #define KeGetCurrentKPCR captive_reactos_KeGetCurrentKPCR #include "reactos/internal/i386/ps.h" #undef _KPCR #undef KPCR #undef PKPCR #undef KeGetCurrentKPCR /* Usable libcaptive definition for reactos go to captive_*. * Note we don't leave any defintion under its original symbol name * just to make the whole mess a bit more sane. */ #include "captive/ps_reactos.h" #define _KPCR captive__KPCR #define KPCR captive_KPCR #define PKPCR captive_PKPCR #define KeGetCurrentKPCR captive_KeGetCurrentKPCR #else #undef _KPCR #undef KPCR #undef PKPCR #undef KeGetCurrentKPCR #endif #undef _CAPTIVE_REACTOS_COMPAT_H_INSIDE