2 * Include file for GNU world compatibility with reactos include files for libcaptive
3 * Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; exactly version 2 of June 1991 is required
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 /* NEVER protect this include file with #ifndef/#define/#endif
21 * wrapper as we need to be included multiple times
22 * Despite this we still #define the symbol to be able to check it
24 #ifdef _CAPTIVE_REACTOS_COMPAT_H
25 #undef _CAPTIVE_REACTOS_COMPAT_H
26 #define _CAPTIVE_REACTOS_COMPAT_H 2
28 #define _CAPTIVE_REACTOS_COMPAT_H 1
31 /* NEVER use #include in this file before all the #define-s are done
32 * as we pretend any nested #include "reactos/compat.h" automatically as 'succeeded'.
33 * NEVER use any #include inside !REACTOS_COMPAT condition branches.
34 * We never nest as the include is protected by #ifdef from reactos/?*.h includes.
36 #ifdef _CAPTIVE_REACTOS_COMPAT_H_INSIDE
37 #error "$(top_srcdir)/src/libcaptive/include/reactos/compat.h MUST NOT NEST!"
39 #define _CAPTIVE_REACTOS_COMPAT_H_INSIDE 1
42 /* reactos uses __declspec(dllimport) and __declspec(dllexport)
43 * which gets expanded to __attribute__($2) by -D in their Makefile GCC commandline.
46 #define __declspec(type)
51 /* It gets defined to __attribute__((fastcall)) by "ddk/ntddk.h". */
58 /* It gets defined to __attribute__((stdcall)) by "base.h" and "ntos/types.h". */
65 /* It gets defined to __attribute__((cdecl)) by "base.h" and "ntos/types.h"; should not hurt. */
73 #define wcscpy captive_reactos_wcscpy
79 #define wcscat captive_reactos_wcscat
85 #define wcschr captive_reactos_wcschr
91 #define wcsrchr captive_reactos_wcsrchr
97 #define wcslen captive_reactos_wcslen
102 #ifdef REACTOS_COMPAT
103 #define _wcsicmp captive_reactos__wcsicmp
108 /* int iswdigit(wint_t wc); should be safe */
109 /* int iswlower(wint_t wc); should be safe */
110 /* int iswxdigit(wint_t wc); should be safe */
112 /* Place BEFORE "internal/debug.h" include as there is
113 * internal/debug.h->internal/ntoskrnl.h->ddk/ntddk.h->REACTOS_UCS2()
115 #ifdef REACTOS_COMPAT
116 #include <stddef.h> /* for wchar_t; Prevent <stddef.h> declaration while REACTOS_COMPAT is active */
117 /* You MUST include "captive/unicode_reactos.h" before wchar_t redefinition! */
118 #include "captive/unicode_reactos.h" /* for captive_ucs4_to_ucs2_const() for crtdll/string.h/REACTOS_UCS2() and captive_ucs2 */
119 #define wchar_t captive_ucs2
120 #define REACTOS_UCS2(string_wchar32) (captive_wchar32_to_ucs2_const((string_wchar32)))
126 /* for internal/debug.h */
127 #ifdef REACTOS_COMPAT
134 /* -------------------------------- #include-s permitted now, #define-s forbidden
135 * See above #define _CAPTIVE_REACTOS_COMPAT_H_INSIDE in this file.
139 /* Place AFTER REACTOS_UCS2 definition as there is
140 * internal/debug.h->internal/ntoskrnl.h->ddk/ntddk.h->REACTOS_UCS2()
141 * Some sources (reactos/ntoskrnl/ldr/loader.c) define NDEBUG themselves!
142 * We have to pre-define all the non-NDEBUG (=debug) macros for such source files.
144 #ifdef REACTOS_COMPAT
145 #ifdef __NTOSKRNL__ /* Don't pollute the namespace outside ntoskrnl. */
146 #include "reactos/internal/debug.h"
150 #ifdef REACTOS_COMPAT
151 /* All invalid reactos definitions go to captive_reactos_* as trash */
152 #define _KPCR captive_reactos__KPCR
153 #define KPCR captive_reactos_KPCR
154 #define PKPCR captive_reactos_PKPCR
155 #define KeGetCurrentKPCR captive_reactos_KeGetCurrentKPCR
156 #include "reactos/internal/i386/ps.h"
160 #undef KeGetCurrentKPCR
161 /* Usable libcaptive definition for reactos go to captive_*.
162 * Note we don't leave any defintion under its original symbol name
163 * just to make the whole mess a bit more sane.
165 #include "captive/ps_reactos.h"
166 #define _KPCR captive__KPCR
167 #define KPCR captive_KPCR
168 #define PKPCR captive_PKPCR
169 #define KeGetCurrentKPCR captive_KeGetCurrentKPCR
174 #undef KeGetCurrentKPCR
178 #undef _CAPTIVE_REACTOS_COMPAT_H_INSIDE