# 1 "" # 1 "SDL2_imageFilter.c" /* SDL2_imageFilter.c: byte-image "filter" routines Copyright (C) 2001-2012 Andreas Schiffler Copyright (C) 2013 Sylvain Beucler This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. Andreas Schiffler -- aschiffler at ferzkopp dot net */ /* Note: Uses inline x86 MMX or ASM optimizations if available and enabled. Note: Most of the MMX code is based on published routines by Vladimir Kravtchenko at vk@cs.ubc.ca - credits go to him for his work. */ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 41 "SDL2_imageFilter.c" # 1 "/usr/include/stdio.h" 1 3 4 /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Chris Torek. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)stdio.h 8.5 (Berkeley) 4/29/95 * $FreeBSD: head/include/stdio.h 278600 2015-02-11 22:39:13Z bdrewery $ */ #ifndef _STDIO_H_ #define _STDIO_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 39 "/usr/include/stdio.h" 3 4 # 1 "/usr/include/sys/cdefs.h" 1 3 4 /*- * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Berkeley Software Design, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)cdefs.h 8.8 (Berkeley) 1/9/95 * $FreeBSD: head/sys/sys/cdefs.h 282990 2015-05-15 20:53:43Z pfg $ */ #ifndef _SYS_CDEFS_H_ #define _SYS_CDEFS_H_ /* * Testing against Clang-specific extensions. */ #ifndef __has_attribute #define __has_attribute(x) 0 #endif # 46 "/usr/include/sys/cdefs.h" 3 4 #ifndef __has_extension #define __has_extension __has_feature #endif # 49 "/usr/include/sys/cdefs.h" 3 4 #ifndef __has_feature #define __has_feature(x) 0 #endif # 52 "/usr/include/sys/cdefs.h" 3 4 #ifndef __has_include #define __has_include(x) 0 #endif # 55 "/usr/include/sys/cdefs.h" 3 4 #ifndef __has_builtin #define __has_builtin(x) 0 #endif # 58 "/usr/include/sys/cdefs.h" 3 4 #if defined(__cplusplus) #define __BEGIN_DECLS extern "C" { #define __END_DECLS } #else # 63 "/usr/include/sys/cdefs.h" 3 4 #define __BEGIN_DECLS #define __END_DECLS #endif # 66 "/usr/include/sys/cdefs.h" 3 4 /* * This code has been put in place to help reduce the addition of * compiler specific defines in FreeBSD code. It helps to aid in * having a compiler-agnostic source tree. */ #if defined(__GNUC__) || defined(__INTEL_COMPILER) #if __GNUC__ >= 3 || defined(__INTEL_COMPILER) #define __GNUCLIKE_ASM 3 #define __GNUCLIKE_MATH_BUILTIN_CONSTANTS #else # 79 "/usr/include/sys/cdefs.h" 3 4 #define __GNUCLIKE_ASM 2 #endif # 81 "/usr/include/sys/cdefs.h" 3 4 #define __GNUCLIKE___TYPEOF 1 #define __GNUCLIKE___OFFSETOF 1 #define __GNUCLIKE___SECTION 1 #ifndef __INTEL_COMPILER #define __GNUCLIKE_CTOR_SECTION_HANDLING 1 #endif # 88 "/usr/include/sys/cdefs.h" 3 4 #define __GNUCLIKE_BUILTIN_CONSTANT_P 1 #if defined(__INTEL_COMPILER) && defined(__cplusplus) && \ __INTEL_COMPILER < 800 #undef __GNUCLIKE_BUILTIN_CONSTANT_P #endif # 94 "/usr/include/sys/cdefs.h" 3 4 #if (__GNUC_MINOR__ > 95 || __GNUC__ >= 3) && !defined(__INTEL_COMPILER) #define __GNUCLIKE_BUILTIN_VARARGS 1 #define __GNUCLIKE_BUILTIN_STDARG 1 #define __GNUCLIKE_BUILTIN_VAALIST 1 #endif # 100 "/usr/include/sys/cdefs.h" 3 4 #if defined(__GNUC__) #define __GNUC_VA_LIST_COMPATIBILITY 1 #endif # 104 "/usr/include/sys/cdefs.h" 3 4 /* * Compiler memory barriers, specific to gcc and clang. */ #if defined(__GNUC__) #define __compiler_membar() __asm __volatile(" " : : : "memory") #endif # 111 "/usr/include/sys/cdefs.h" 3 4 #ifndef __INTEL_COMPILER #define __GNUCLIKE_BUILTIN_NEXT_ARG 1 #define __GNUCLIKE_MATH_BUILTIN_RELOPS #endif # 116 "/usr/include/sys/cdefs.h" 3 4 #define __GNUCLIKE_BUILTIN_MEMCPY 1 /* XXX: if __GNUC__ >= 2: not tested everywhere originally, where replaced */ #define __CC_SUPPORTS_INLINE 1 #define __CC_SUPPORTS___INLINE 1 #define __CC_SUPPORTS___INLINE__ 1 #define __CC_SUPPORTS___FUNC__ 1 #define __CC_SUPPORTS_WARNING 1 #define __CC_SUPPORTS_VARADIC_XXX 1 /* see varargs.h */ #define __CC_SUPPORTS_DYNAMIC_ARRAY_INIT 1 #endif /* __GNUC__ || __INTEL_COMPILER */ # 132 "/usr/include/sys/cdefs.h" 3 4 /* * Macro to test if we're using a specific version of gcc or later. */ #if defined(__GNUC__) && !defined(__INTEL_COMPILER) #define __GNUC_PREREQ__(ma, mi) \ (__GNUC__ > (ma) || __GNUC__ == (ma) && __GNUC_MINOR__ >= (mi)) #else # 140 "/usr/include/sys/cdefs.h" 3 4 #define __GNUC_PREREQ__(ma, mi) 0 #endif # 142 "/usr/include/sys/cdefs.h" 3 4 /* * The __CONCAT macro is used to concatenate parts of symbol names, e.g. * with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo. * The __CONCAT macro is a bit tricky to use if it must work in non-ANSI * mode -- there must be no spaces between its arguments, and for nested * __CONCAT's, all the __CONCAT's must be at the left. __CONCAT can also * concatenate double-quoted strings produced by the __STRING macro, but * this only works with ANSI C. * * __XSTRING is like __STRING, but it expands any macros in its argument * first. It is only available with ANSI C. */ #if defined(__STDC__) || defined(__cplusplus) #define __P(protos) protos /* full-blown ANSI C */ #define __CONCAT1(x,y) x ## y #define __CONCAT(x,y) __CONCAT1(x,y) #define __STRING(x) #x /* stringify without expanding x */ #define __XSTRING(x) __STRING(x) /* expand x, then stringify */ #define __const const /* define reserved names to standard */ #define __signed signed #define __volatile volatile #if defined(__cplusplus) #define __inline inline /* convert to C++ keyword */ #else # 168 "/usr/include/sys/cdefs.h" 3 4 #if !(defined(__CC_SUPPORTS___INLINE)) #define __inline /* delete GCC keyword */ #endif /* ! __CC_SUPPORTS___INLINE */ # 171 "/usr/include/sys/cdefs.h" 3 4 #endif /* !__cplusplus */ # 172 "/usr/include/sys/cdefs.h" 3 4 #else /* !(__STDC__ || __cplusplus) */ # 174 "/usr/include/sys/cdefs.h" 3 4 #define __P(protos) () /* traditional C preprocessor */ #define __CONCAT(x,y) x/**/y #define __STRING(x) "x" #if !defined(__CC_SUPPORTS___INLINE) #define __const /* delete pseudo-ANSI C keywords */ #define __inline #define __signed #define __volatile /* * In non-ANSI C environments, new programs will want ANSI-only C keywords * deleted from the program and old programs will want them left alone. * When using a compiler other than gcc, programs using the ANSI C keywords * const, inline etc. as normal identifiers should define -DNO_ANSI_KEYWORDS. * When using "gcc -traditional", we assume that this is the intent; if * __GNUC__ is defined but __STDC__ is not, we leave the new keywords alone. */ #ifndef NO_ANSI_KEYWORDS #define const /* delete ANSI C keywords */ #define inline #define signed #define volatile #endif /* !NO_ANSI_KEYWORDS */ # 197 "/usr/include/sys/cdefs.h" 3 4 #endif /* !__CC_SUPPORTS___INLINE */ # 198 "/usr/include/sys/cdefs.h" 3 4 #endif /* !(__STDC__ || __cplusplus) */ # 199 "/usr/include/sys/cdefs.h" 3 4 /* * Compiler-dependent macros to help declare dead (non-returning) and * pure (no side effects) functions, and unused variables. They are * null except for versions of gcc that are known to support the features * properly (old versions of gcc-2 supported the dead and pure features * in a different (wrong) way). If we do not provide an implementation * for a given compiler, let the compile fail if it is told to use * a feature that we cannot live without. */ #ifdef lint #define __dead2 #define __pure2 #define __unused #define __packed #define __aligned(x) #define __section(x) #define __weak #else # 218 "/usr/include/sys/cdefs.h" 3 4 #define __weak __attribute__((__weak__)) #if !__GNUC_PREREQ__(2, 5) && !defined(__INTEL_COMPILER) #define __dead2 #define __pure2 #define __unused #endif # 224 "/usr/include/sys/cdefs.h" 3 4 #if __GNUC__ == 2 && __GNUC_MINOR__ >= 5 && __GNUC_MINOR__ < 7 && !defined(__INTEL_COMPILER) #define __dead2 __attribute__((__noreturn__)) #define __pure2 __attribute__((__const__)) #define __unused /* XXX Find out what to do for __packed, __aligned and __section */ #endif # 230 "/usr/include/sys/cdefs.h" 3 4 #if __GNUC_PREREQ__(2, 7) #define __dead2 __attribute__((__noreturn__)) #define __pure2 __attribute__((__const__)) #define __unused __attribute__((__unused__)) #define __used __attribute__((__used__)) #define __packed __attribute__((__packed__)) #define __aligned(x) __attribute__((__aligned__(x))) #define __section(x) __attribute__((__section__(x))) #endif # 239 "/usr/include/sys/cdefs.h" 3 4 #if defined(__INTEL_COMPILER) #define __dead2 __attribute__((__noreturn__)) #define __pure2 __attribute__((__const__)) #define __unused __attribute__((__unused__)) #define __used __attribute__((__used__)) #define __packed __attribute__((__packed__)) #define __aligned(x) __attribute__((__aligned__(x))) #define __section(x) __attribute__((__section__(x))) #endif # 248 "/usr/include/sys/cdefs.h" 3 4 #endif /* lint */ # 249 "/usr/include/sys/cdefs.h" 3 4 #if !__GNUC_PREREQ__(2, 95) #define __alignof(x) __offsetof(struct { char __a; x __b; }, __b) #endif # 253 "/usr/include/sys/cdefs.h" 3 4 /* * Keywords added in C11. */ #if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 201112L || defined(lint) #if !__has_extension(c_alignas) #if (defined(__cplusplus) && __cplusplus >= 201103L) || \ __has_extension(cxx_alignas) #define _Alignas(x) alignas(x) #else # 265 "/usr/include/sys/cdefs.h" 3 4 /* XXX: Only emulates _Alignas(constant-expression); not _Alignas(type-name). */ #define _Alignas(x) __aligned(x) #endif # 268 "/usr/include/sys/cdefs.h" 3 4 #endif # 269 "/usr/include/sys/cdefs.h" 3 4 #if defined(__cplusplus) && __cplusplus >= 201103L #define _Alignof(x) alignof(x) #else # 273 "/usr/include/sys/cdefs.h" 3 4 #define _Alignof(x) __alignof(x) #endif # 275 "/usr/include/sys/cdefs.h" 3 4 #if !__has_extension(c_atomic) && !__has_extension(cxx_atomic) /* * No native support for _Atomic(). Place object in structure to prevent * most forms of direct non-atomic access. */ #define _Atomic(T) struct { T volatile __val; } #endif # 283 "/usr/include/sys/cdefs.h" 3 4 #if defined(__cplusplus) && __cplusplus >= 201103L #define _Noreturn [[noreturn]] #else # 287 "/usr/include/sys/cdefs.h" 3 4 #define _Noreturn __dead2 #endif # 289 "/usr/include/sys/cdefs.h" 3 4 #if !__has_extension(c_static_assert) #if (defined(__cplusplus) && __cplusplus >= 201103L) || \ __has_extension(cxx_static_assert) #define _Static_assert(x, y) static_assert(x, y) #elif __GNUC_PREREQ__(4,6) # 295 "/usr/include/sys/cdefs.h" 3 4 /* Nothing, gcc 4.6 and higher has _Static_assert built-in */ #elif defined(__COUNTER__) # 297 "/usr/include/sys/cdefs.h" 3 4 #define _Static_assert(x, y) __Static_assert(x, __COUNTER__) #define __Static_assert(x, y) ___Static_assert(x, y) #define ___Static_assert(x, y) typedef char __assert_ ## y[(x) ? 1 : -1] \ __unused #else # 302 "/usr/include/sys/cdefs.h" 3 4 #define _Static_assert(x, y) struct __hack #endif # 304 "/usr/include/sys/cdefs.h" 3 4 #endif # 305 "/usr/include/sys/cdefs.h" 3 4 #if !__has_extension(c_thread_local) /* * XXX: Some compilers (Clang 3.3, GCC 4.7) falsely announce C++11 mode * without actually supporting the thread_local keyword. Don't check for * the presence of C++11 when defining _Thread_local. */ #if /* (defined(__cplusplus) && __cplusplus >= 201103L) || */ \ __has_extension(cxx_thread_local) #define _Thread_local thread_local #else # 316 "/usr/include/sys/cdefs.h" 3 4 #define _Thread_local __thread #endif # 318 "/usr/include/sys/cdefs.h" 3 4 #endif # 319 "/usr/include/sys/cdefs.h" 3 4 #endif /* __STDC_VERSION__ || __STDC_VERSION__ < 201112L */ # 321 "/usr/include/sys/cdefs.h" 3 4 /* * Emulation of C11 _Generic(). Unlike the previously defined C11 * keywords, it is not possible to implement this using exactly the same * syntax. Therefore implement something similar under the name * __generic(). Unlike _Generic(), this macro can only distinguish * between a single type, so it requires nested invocations to * distinguish multiple cases. */ #if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || \ __has_extension(c_generic_selections) #define __generic(expr, t, yes, no) \ _Generic(expr, t: yes, default: no) #elif __GNUC_PREREQ__(3, 1) && !defined(__cplusplus) # 336 "/usr/include/sys/cdefs.h" 3 4 #define __generic(expr, t, yes, no) \ __builtin_choose_expr( \ __builtin_types_compatible_p(__typeof(expr), t), yes, no) #endif # 340 "/usr/include/sys/cdefs.h" 3 4 #if __GNUC_PREREQ__(2, 96) #define __malloc_like __attribute__((__malloc__)) #define __pure __attribute__((__pure__)) #else # 345 "/usr/include/sys/cdefs.h" 3 4 #define __malloc_like #define __pure #endif # 348 "/usr/include/sys/cdefs.h" 3 4 #if __GNUC_PREREQ__(3, 1) || (defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 800) #define __always_inline __attribute__((__always_inline__)) #else # 352 "/usr/include/sys/cdefs.h" 3 4 #define __always_inline #endif # 354 "/usr/include/sys/cdefs.h" 3 4 #if __GNUC_PREREQ__(3, 1) #define __noinline __attribute__ ((__noinline__)) #else # 358 "/usr/include/sys/cdefs.h" 3 4 #define __noinline #endif # 360 "/usr/include/sys/cdefs.h" 3 4 #if __GNUC_PREREQ__(3, 3) #define __nonnull(x) __attribute__((__nonnull__(x))) #define __nonnull_all __attribute__((__nonnull__)) #else # 365 "/usr/include/sys/cdefs.h" 3 4 #define __nonnull(x) #define __nonnull_all #endif # 368 "/usr/include/sys/cdefs.h" 3 4 #if __GNUC_PREREQ__(3, 4) #define __fastcall __attribute__((__fastcall__)) #define __result_use_check __attribute__((__warn_unused_result__)) #else # 373 "/usr/include/sys/cdefs.h" 3 4 #define __fastcall #define __result_use_check #endif # 376 "/usr/include/sys/cdefs.h" 3 4 #if __GNUC_PREREQ__(4, 1) #define __returns_twice __attribute__((__returns_twice__)) #else # 380 "/usr/include/sys/cdefs.h" 3 4 #define __returns_twice #endif # 382 "/usr/include/sys/cdefs.h" 3 4 #if __has_attribute(alloc_size) || __GNUC_PREREQ__(4, 3) #define __alloc_size(x) __attribute__((__alloc_size__(x))) #else # 386 "/usr/include/sys/cdefs.h" 3 4 #define __alloc_size(x) #endif # 388 "/usr/include/sys/cdefs.h" 3 4 #if __has_builtin(__builtin_unreachable) || __GNUC_PREREQ__(4, 6) #define __unreachable() __builtin_unreachable() #else # 392 "/usr/include/sys/cdefs.h" 3 4 #define __unreachable() ((void)0) #endif # 394 "/usr/include/sys/cdefs.h" 3 4 #if __has_attribute(alloc_align) || __GNUC_PREREQ__(4, 9) #define __alloc_align(x) __attribute__((__alloc_align__(x))) #else # 398 "/usr/include/sys/cdefs.h" 3 4 #define __alloc_align(x) #endif # 400 "/usr/include/sys/cdefs.h" 3 4 /* XXX: should use `#if __STDC_VERSION__ < 199901'. */ #if !__GNUC_PREREQ__(2, 7) && !defined(__INTEL_COMPILER) #define __func__ NULL #endif # 405 "/usr/include/sys/cdefs.h" 3 4 #if (defined(__INTEL_COMPILER) || (defined(__GNUC__) && __GNUC__ >= 2)) && !defined(__STRICT_ANSI__) || __STDC_VERSION__ >= 199901 #define __LONG_LONG_SUPPORTED #endif # 409 "/usr/include/sys/cdefs.h" 3 4 /* C++11 exposes a load of C99 stuff */ #if defined(__cplusplus) && __cplusplus >= 201103L #define __LONG_LONG_SUPPORTED #ifndef __STDC_LIMIT_MACROS #define __STDC_LIMIT_MACROS #endif # 416 "/usr/include/sys/cdefs.h" 3 4 #ifndef __STDC_CONSTANT_MACROS #define __STDC_CONSTANT_MACROS #endif # 419 "/usr/include/sys/cdefs.h" 3 4 #endif # 420 "/usr/include/sys/cdefs.h" 3 4 /* * GCC 2.95 provides `__restrict' as an extension to C90 to support the * C99-specific `restrict' type qualifier. We happen to use `__restrict' as * a way to define the `restrict' type qualifier without disturbing older * software that is unaware of C99 keywords. */ #if !(__GNUC__ == 2 && __GNUC_MINOR__ == 95) #if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901 || defined(lint) #define __restrict #else # 431 "/usr/include/sys/cdefs.h" 3 4 #define __restrict restrict #endif # 433 "/usr/include/sys/cdefs.h" 3 4 #endif # 434 "/usr/include/sys/cdefs.h" 3 4 /* * GNU C version 2.96 adds explicit branch prediction so that * the CPU back-end can hint the processor and also so that * code blocks can be reordered such that the predicted path * sees a more linear flow, thus improving cache behavior, etc. * * The following two macros provide us with a way to utilize this * compiler feature. Use __predict_true() if you expect the expression * to evaluate to true, and __predict_false() if you expect the * expression to evaluate to false. * * A few notes about usage: * * * Generally, __predict_false() error condition checks (unless * you have some _strong_ reason to do otherwise, in which case * document it), and/or __predict_true() `no-error' condition * checks, assuming you want to optimize for the no-error case. * * * Other than that, if you don't know the likelihood of a test * succeeding from empirical or other `hard' evidence, don't * make predictions. * * * These are meant to be used in places that are run `a lot'. * It is wasteful to make predictions in code that is run * seldomly (e.g. at subsystem initialization time) as the * basic block reordering that this affects can often generate * larger code. */ #if __GNUC_PREREQ__(2, 96) #define __predict_true(exp) __builtin_expect((exp), 1) #define __predict_false(exp) __builtin_expect((exp), 0) #else # 467 "/usr/include/sys/cdefs.h" 3 4 #define __predict_true(exp) (exp) #define __predict_false(exp) (exp) #endif # 470 "/usr/include/sys/cdefs.h" 3 4 #if __GNUC_PREREQ__(4, 0) #define __hidden __attribute__((__visibility__("hidden"))) #define __exported __attribute__((__visibility__("default"))) #else # 475 "/usr/include/sys/cdefs.h" 3 4 #define __hidden #define __exported #endif # 478 "/usr/include/sys/cdefs.h" 3 4 /* * We define this here since , , and * require it. */ #if __GNUC_PREREQ__(4, 1) #define __offsetof(type, field) __builtin_offsetof(type, field) #else # 486 "/usr/include/sys/cdefs.h" 3 4 #ifndef __cplusplus #define __offsetof(type, field) \ ((__size_t)(__uintptr_t)((const volatile void *)&((type *)0)->field)) #else # 490 "/usr/include/sys/cdefs.h" 3 4 #define __offsetof(type, field) \ (__offsetof__ (reinterpret_cast <__size_t> \ (&reinterpret_cast \ (static_cast (0)->field)))) #endif # 495 "/usr/include/sys/cdefs.h" 3 4 #endif # 496 "/usr/include/sys/cdefs.h" 3 4 #define __rangeof(type, start, end) \ (__offsetof(type, end) - __offsetof(type, start)) /* * Given the pointer x to the member m of the struct s, return * a pointer to the containing structure. When using GCC, we first * assign pointer x to a local variable, to check that its type is * compatible with member m. */ #if __GNUC_PREREQ__(3, 1) #define __containerof(x, s, m) ({ \ const volatile __typeof(((s *)0)->m) *__x = (x); \ __DEQUALIFY(s *, (const volatile char *)__x - __offsetof(s, m));\ }) #else # 511 "/usr/include/sys/cdefs.h" 3 4 #define __containerof(x, s, m) \ __DEQUALIFY(s *, (const volatile char *)(x) - __offsetof(s, m)) #endif # 514 "/usr/include/sys/cdefs.h" 3 4 /* * Compiler-dependent macros to declare that functions take printf-like * or scanf-like arguments. They are null except for versions of gcc * that are known to support the features properly (old versions of gcc-2 * didn't permit keeping the keywords out of the application namespace). */ #if !__GNUC_PREREQ__(2, 7) && !defined(__INTEL_COMPILER) #define __printflike(fmtarg, firstvararg) #define __scanflike(fmtarg, firstvararg) #define __format_arg(fmtarg) #define __strfmonlike(fmtarg, firstvararg) #define __strftimelike(fmtarg, firstvararg) #else # 528 "/usr/include/sys/cdefs.h" 3 4 #define __printflike(fmtarg, firstvararg) \ __attribute__((__format__ (__printf__, fmtarg, firstvararg))) #define __scanflike(fmtarg, firstvararg) \ __attribute__((__format__ (__scanf__, fmtarg, firstvararg))) #define __format_arg(fmtarg) __attribute__((__format_arg__ (fmtarg))) #define __strfmonlike(fmtarg, firstvararg) \ __attribute__((__format__ (__strfmon__, fmtarg, firstvararg))) #define __strftimelike(fmtarg, firstvararg) \ __attribute__((__format__ (__strftime__, fmtarg, firstvararg))) #endif # 538 "/usr/include/sys/cdefs.h" 3 4 /* * FORTIFY_SOURCE, and perhaps other compiler-specific features, require * the use of non-standard inlining. In general we should try to avoid * using these but GCC-compatible compilers tend to support the extensions * well enough to use them in limited cases. */ #if __GNUC_PREREQ__(4, 1) #if __has_attribute(artificial) || __GNUC_PREREQ__(4, 3) #define __gnu_inline __attribute__((__gnu_inline__, __artificial__)) #else # 549 "/usr/include/sys/cdefs.h" 3 4 #define __gnu_inline __attribute__((__gnu_inline__)) #endif /* artificial */ # 551 "/usr/include/sys/cdefs.h" 3 4 #else # 552 "/usr/include/sys/cdefs.h" 3 4 #define __gnu_inline #endif # 554 "/usr/include/sys/cdefs.h" 3 4 /* Compiler-dependent macros that rely on FreeBSD-specific extensions. */ #if defined(__FreeBSD_cc_version) && __FreeBSD_cc_version >= 300001 && \ defined(__GNUC__) && !defined(__INTEL_COMPILER) #define __printf0like(fmtarg, firstvararg) \ __attribute__((__format__ (__printf0__, fmtarg, firstvararg))) #else # 561 "/usr/include/sys/cdefs.h" 3 4 #define __printf0like(fmtarg, firstvararg) #endif # 563 "/usr/include/sys/cdefs.h" 3 4 #if defined(__GNUC__) || defined(__INTEL_COMPILER) #ifndef __INTEL_COMPILER #define __strong_reference(sym,aliassym) \ extern __typeof (sym) aliassym __attribute__ ((__alias__ (#sym))) #endif # 569 "/usr/include/sys/cdefs.h" 3 4 #ifdef __STDC__ #define __weak_reference(sym,alias) \ __asm__(".weak " #alias); \ __asm__(".equ " #alias ", " #sym) #define __warn_references(sym,msg) \ __asm__(".section .gnu.warning." #sym); \ __asm__(".asciz \"" msg "\""); \ __asm__(".previous") #define __sym_compat(sym,impl,verid) \ __asm__(".symver " #impl ", " #sym "@" #verid) #define __sym_default(sym,impl,verid) \ __asm__(".symver " #impl ", " #sym "@@" #verid) #else # 582 "/usr/include/sys/cdefs.h" 3 4 #define __weak_reference(sym,alias) \ __asm__(".weak alias"); \ __asm__(".equ alias, sym") #define __warn_references(sym,msg) \ __asm__(".section .gnu.warning.sym"); \ __asm__(".asciz \"msg\""); \ __asm__(".previous") #define __sym_compat(sym,impl,verid) \ __asm__(".symver impl, sym@verid") #define __sym_default(impl,sym,verid) \ __asm__(".symver impl, sym@@verid") #endif /* __STDC__ */ # 594 "/usr/include/sys/cdefs.h" 3 4 #endif /* __GNUC__ || __INTEL_COMPILER */ # 595 "/usr/include/sys/cdefs.h" 3 4 #define __GLOBL1(sym) __asm__(".globl " #sym) #define __GLOBL(sym) __GLOBL1(sym) #if defined(__GNUC__) || defined(__INTEL_COMPILER) #define __IDSTRING(name,string) __asm__(".ident\t\"" string "\"") #else # 602 "/usr/include/sys/cdefs.h" 3 4 /* * The following definition might not work well if used in header files, * but it should be better than nothing. If you want a "do nothing" * version, then it should generate some harmless declaration, such as: * #define __IDSTRING(name,string) struct __hack */ #define __IDSTRING(name,string) static const char name[] __unused = string #endif # 610 "/usr/include/sys/cdefs.h" 3 4 /* * Embed the rcs id of a source file in the resulting library. Note that in * more recent ELF binutils, we use .ident allowing the ID to be stripped. * Usage: * __FBSDID("$FreeBSD: head/sys/sys/cdefs.h 282990 2015-05-15 20:53:43Z pfg $"); */ #ifndef __FBSDID #if !defined(lint) && !defined(STRIP_FBSDID) #define __FBSDID(s) __IDSTRING(__CONCAT(__rcsid_,__LINE__),s) #else # 621 "/usr/include/sys/cdefs.h" 3 4 #define __FBSDID(s) struct __hack #endif # 623 "/usr/include/sys/cdefs.h" 3 4 #endif # 624 "/usr/include/sys/cdefs.h" 3 4 #ifndef __RCSID #ifndef NO__RCSID #define __RCSID(s) __IDSTRING(__CONCAT(__rcsid_,__LINE__),s) #else # 629 "/usr/include/sys/cdefs.h" 3 4 #define __RCSID(s) struct __hack #endif # 631 "/usr/include/sys/cdefs.h" 3 4 #endif # 632 "/usr/include/sys/cdefs.h" 3 4 #ifndef __RCSID_SOURCE #ifndef NO__RCSID_SOURCE #define __RCSID_SOURCE(s) __IDSTRING(__CONCAT(__rcsid_source_,__LINE__),s) #else # 637 "/usr/include/sys/cdefs.h" 3 4 #define __RCSID_SOURCE(s) struct __hack #endif # 639 "/usr/include/sys/cdefs.h" 3 4 #endif # 640 "/usr/include/sys/cdefs.h" 3 4 #ifndef __SCCSID #ifndef NO__SCCSID #define __SCCSID(s) __IDSTRING(__CONCAT(__sccsid_,__LINE__),s) #else # 645 "/usr/include/sys/cdefs.h" 3 4 #define __SCCSID(s) struct __hack #endif # 647 "/usr/include/sys/cdefs.h" 3 4 #endif # 648 "/usr/include/sys/cdefs.h" 3 4 #ifndef __COPYRIGHT #ifndef NO__COPYRIGHT #define __COPYRIGHT(s) __IDSTRING(__CONCAT(__copyright_,__LINE__),s) #else # 653 "/usr/include/sys/cdefs.h" 3 4 #define __COPYRIGHT(s) struct __hack #endif # 655 "/usr/include/sys/cdefs.h" 3 4 #endif # 656 "/usr/include/sys/cdefs.h" 3 4 #ifndef __DECONST #define __DECONST(type, var) ((type)(__uintptr_t)(const void *)(var)) #endif # 660 "/usr/include/sys/cdefs.h" 3 4 #ifndef __DEVOLATILE #define __DEVOLATILE(type, var) ((type)(__uintptr_t)(volatile void *)(var)) #endif # 664 "/usr/include/sys/cdefs.h" 3 4 #ifndef __DEQUALIFY #define __DEQUALIFY(type, var) ((type)(__uintptr_t)(const volatile void *)(var)) #endif # 668 "/usr/include/sys/cdefs.h" 3 4 /*- * The following definitions are an extension of the behavior originally * implemented in , but with a different level of granularity. * POSIX.1 requires that the macros we test be defined before any standard * header file is included. * * Here's a quick run-down of the versions: * defined(_POSIX_SOURCE) 1003.1-1988 * _POSIX_C_SOURCE == 1 1003.1-1990 * _POSIX_C_SOURCE == 2 1003.2-1992 C Language Binding Option * _POSIX_C_SOURCE == 199309 1003.1b-1993 * _POSIX_C_SOURCE == 199506 1003.1c-1995, 1003.1i-1995, * and the omnibus ISO/IEC 9945-1: 1996 * _POSIX_C_SOURCE == 200112 1003.1-2001 * _POSIX_C_SOURCE == 200809 1003.1-2008 * * In addition, the X/Open Portability Guide, which is now the Single UNIX * Specification, defines a feature-test macro which indicates the version of * that specification, and which subsumes _POSIX_C_SOURCE. * * Our macros begin with two underscores to avoid namespace screwage. */ /* Deal with IEEE Std. 1003.1-1990, in which _POSIX_C_SOURCE == 1. */ #if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE == 1 #undef _POSIX_C_SOURCE /* Probably illegal, but beyond caring now. */ #define _POSIX_C_SOURCE 199009 #endif # 697 "/usr/include/sys/cdefs.h" 3 4 /* Deal with IEEE Std. 1003.2-1992, in which _POSIX_C_SOURCE == 2. */ #if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE == 2 #undef _POSIX_C_SOURCE #define _POSIX_C_SOURCE 199209 #endif # 703 "/usr/include/sys/cdefs.h" 3 4 /* Deal with various X/Open Portability Guides and Single UNIX Spec. */ #ifdef _XOPEN_SOURCE #if _XOPEN_SOURCE - 0 >= 700 #define __XSI_VISIBLE 700 #undef _POSIX_C_SOURCE #define _POSIX_C_SOURCE 200809 #elif _XOPEN_SOURCE - 0 >= 600 # 711 "/usr/include/sys/cdefs.h" 3 4 #define __XSI_VISIBLE 600 #undef _POSIX_C_SOURCE #define _POSIX_C_SOURCE 200112 #elif _XOPEN_SOURCE - 0 >= 500 # 715 "/usr/include/sys/cdefs.h" 3 4 #define __XSI_VISIBLE 500 #undef _POSIX_C_SOURCE #define _POSIX_C_SOURCE 199506 #endif # 719 "/usr/include/sys/cdefs.h" 3 4 #endif # 720 "/usr/include/sys/cdefs.h" 3 4 /* * Deal with all versions of POSIX. The ordering relative to the tests above is * important. */ #if defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE) #define _POSIX_C_SOURCE 198808 #endif # 728 "/usr/include/sys/cdefs.h" 3 4 #ifdef _POSIX_C_SOURCE #if _POSIX_C_SOURCE >= 200809 #define __POSIX_VISIBLE 200809 #define __ISO_C_VISIBLE 1999 #elif _POSIX_C_SOURCE >= 200112 # 733 "/usr/include/sys/cdefs.h" 3 4 #define __POSIX_VISIBLE 200112 #define __ISO_C_VISIBLE 1999 #elif _POSIX_C_SOURCE >= 199506 # 736 "/usr/include/sys/cdefs.h" 3 4 #define __POSIX_VISIBLE 199506 #define __ISO_C_VISIBLE 1990 #elif _POSIX_C_SOURCE >= 199309 # 739 "/usr/include/sys/cdefs.h" 3 4 #define __POSIX_VISIBLE 199309 #define __ISO_C_VISIBLE 1990 #elif _POSIX_C_SOURCE >= 199209 # 742 "/usr/include/sys/cdefs.h" 3 4 #define __POSIX_VISIBLE 199209 #define __ISO_C_VISIBLE 1990 #elif _POSIX_C_SOURCE >= 199009 # 745 "/usr/include/sys/cdefs.h" 3 4 #define __POSIX_VISIBLE 199009 #define __ISO_C_VISIBLE 1990 #else # 748 "/usr/include/sys/cdefs.h" 3 4 #define __POSIX_VISIBLE 198808 #define __ISO_C_VISIBLE 0 #endif /* _POSIX_C_SOURCE */ # 751 "/usr/include/sys/cdefs.h" 3 4 #else # 752 "/usr/include/sys/cdefs.h" 3 4 /*- * Deal with _ANSI_SOURCE: * If it is defined, and no other compilation environment is explicitly * requested, then define our internal feature-test macros to zero. This * makes no difference to the preprocessor (undefined symbols in preprocessing * expressions are defined to have value zero), but makes it more convenient for * a test program to print out the values. * * If a program mistakenly defines _ANSI_SOURCE and some other macro such as * _POSIX_C_SOURCE, we will assume that it wants the broader compilation * environment (and in fact we will never get here). */ #if defined(_ANSI_SOURCE) /* Hide almost everything. */ #define __POSIX_VISIBLE 0 #define __XSI_VISIBLE 0 #define __BSD_VISIBLE 0 #define __ISO_C_VISIBLE 1990 #elif defined(_C99_SOURCE) /* Localism to specify strict C99 env. */ # 770 "/usr/include/sys/cdefs.h" 3 4 #define __POSIX_VISIBLE 0 #define __XSI_VISIBLE 0 #define __BSD_VISIBLE 0 #define __ISO_C_VISIBLE 1999 #elif defined(_C11_SOURCE) /* Localism to specify strict C11 env. */ # 775 "/usr/include/sys/cdefs.h" 3 4 #define __POSIX_VISIBLE 0 #define __XSI_VISIBLE 0 #define __BSD_VISIBLE 0 #define __ISO_C_VISIBLE 2011 #else /* Default environment: show everything. */ # 780 "/usr/include/sys/cdefs.h" 3 4 #define __POSIX_VISIBLE 200809 #define __XSI_VISIBLE 700 #define __BSD_VISIBLE 1 #define __ISO_C_VISIBLE 2011 #endif # 785 "/usr/include/sys/cdefs.h" 3 4 #endif # 786 "/usr/include/sys/cdefs.h" 3 4 #if defined(__mips) || defined(__powerpc64__) #define __NO_TLS 1 #endif # 790 "/usr/include/sys/cdefs.h" 3 4 /* * Type Safety Checking * * Clang provides additional attributes to enable checking type safety * properties that cannot be enforced by the C type system. */ #if __has_attribute(argument_with_type_tag) && \ __has_attribute(type_tag_for_datatype) && !defined(lint) #define __arg_type_tag(arg_kind, arg_idx, type_tag_idx) \ __attribute__((__argument_with_type_tag__(arg_kind, arg_idx, type_tag_idx))) #define __datatype_type_tag(kind, type) \ __attribute__((__type_tag_for_datatype__(kind, type))) #else # 805 "/usr/include/sys/cdefs.h" 3 4 #define __arg_type_tag(arg_kind, arg_idx, type_tag_idx) #define __datatype_type_tag(kind, type) #endif # 808 "/usr/include/sys/cdefs.h" 3 4 /* * Lock annotations. * * Clang provides support for doing basic thread-safety tests at * compile-time, by marking which locks will/should be held when * entering/leaving a functions. * * Furthermore, it is also possible to annotate variables and structure * members to enforce that they are only accessed when certain locks are * held. */ #if __has_extension(c_thread_safety_attributes) #define __lock_annotate(x) __attribute__((x)) #else # 824 "/usr/include/sys/cdefs.h" 3 4 #define __lock_annotate(x) #endif # 826 "/usr/include/sys/cdefs.h" 3 4 /* Structure implements a lock. */ #define __lockable __lock_annotate(lockable) /* Function acquires an exclusive or shared lock. */ #define __locks_exclusive(...) \ __lock_annotate(exclusive_lock_function(__VA_ARGS__)) #define __locks_shared(...) \ __lock_annotate(shared_lock_function(__VA_ARGS__)) /* Function attempts to acquire an exclusive or shared lock. */ #define __trylocks_exclusive(...) \ __lock_annotate(exclusive_trylock_function(__VA_ARGS__)) #define __trylocks_shared(...) \ __lock_annotate(shared_trylock_function(__VA_ARGS__)) /* Function releases a lock. */ #define __unlocks(...) __lock_annotate(unlock_function(__VA_ARGS__)) /* Function asserts that an exclusive or shared lock is held. */ #define __asserts_exclusive(...) \ __lock_annotate(assert_exclusive_lock(__VA_ARGS__)) #define __asserts_shared(...) \ __lock_annotate(assert_shared_lock(__VA_ARGS__)) /* Function requires that an exclusive or shared lock is or is not held. */ #define __requires_exclusive(...) \ __lock_annotate(exclusive_locks_required(__VA_ARGS__)) #define __requires_shared(...) \ __lock_annotate(shared_locks_required(__VA_ARGS__)) #define __requires_unlocked(...) \ __lock_annotate(locks_excluded(__VA_ARGS__)) /* Function should not be analyzed. */ #define __no_lock_analysis __lock_annotate(no_thread_safety_analysis) /* Guard variables and structure members by lock. */ #define __guarded_by(x) __lock_annotate(guarded_by(x)) #define __pt_guarded_by(x) __lock_annotate(pt_guarded_by(x)) #endif /* !_SYS_CDEFS_H_ */ # 867 "/usr/include/sys/cdefs.h" 3 4 # 40 "/usr/include/stdio.h" 2 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 40 "/usr/include/stdio.h" 3 4 # 1 "/usr/include/sys/_null.h" 1 3 4 /*- * Copyright (c) 2003 Marcel Moolenaar * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: stable/10/sys/sys/_null.h 228918 2011-12-27 21:36:31Z theraven $ */ #ifndef NULL #if !defined(__cplusplus) #define NULL ((void *)0) #else # 34 "/usr/include/sys/_null.h" 3 4 #if __cplusplus >= 201103L #define NULL nullptr #elif defined(__GNUG__) && defined(__GNUC__) && __GNUC__ >= 4 # 37 "/usr/include/sys/_null.h" 3 4 #define NULL __null #else # 39 "/usr/include/sys/_null.h" 3 4 #if defined(__LP64__) #define NULL (0L) #else # 42 "/usr/include/sys/_null.h" 3 4 #define NULL 0 #endif /* __LP64__ */ # 44 "/usr/include/sys/_null.h" 3 4 #endif /* __GNUG__ */ # 45 "/usr/include/sys/_null.h" 3 4 #endif /* !__cplusplus */ # 46 "/usr/include/sys/_null.h" 3 4 #endif # 48 "/usr/include/sys/_null.h" 3 4 # 41 "/usr/include/stdio.h" 2 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 41 "/usr/include/stdio.h" 3 4 # 1 "/usr/include/sys/_types.h" 1 3 4 /*- * Copyright (c) 2002 Mike Barcroft * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $FreeBSD: head/sys/sys/_types.h 276660 2015-01-04 15:26:02Z kevlo $ */ #ifndef _SYS__TYPES_H_ #define _SYS__TYPES_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 32 "/usr/include/sys/_types.h" 3 4 # 33 "/usr/include/sys/_types.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 33 "/usr/include/sys/_types.h" 3 4 # 1 "/usr/include/machine/_types.h" 1 3 4 /*- * This file is in the public domain. */ /* $FreeBSD: stable/10/sys/amd64/include/_types.h 232261 2012-02-28 18:15:28Z tijl $ */ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 6 "/usr/include/machine/_types.h" 3 4 # 1 "/usr/include/x86/_types.h" 1 3 4 /*- * Copyright (c) 2002 Mike Barcroft * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * From: @(#)ansi.h 8.2 (Berkeley) 1/4/94 * From: @(#)types.h 8.3 (Berkeley) 1/5/94 * $FreeBSD: head/sys/x86/include/_types.h 263998 2014-04-01 14:46:11Z tijl $ */ #ifndef _MACHINE__TYPES_H_ #define _MACHINE__TYPES_H_ #ifndef _SYS_CDEFS_H_ #error this file needs sys/cdefs.h as a prerequisite #endif # 45 "/usr/include/x86/_types.h" 3 4 #define __NO_STRICT_ALIGNMENT /* * Basic types upon which most other types are built. */ typedef signed char __int8_t; typedef unsigned char __uint8_t; typedef short __int16_t; typedef unsigned short __uint16_t; typedef int __int32_t; typedef unsigned int __uint32_t; #ifdef __LP64__ typedef long __int64_t; typedef unsigned long __uint64_t; #else # 61 "/usr/include/x86/_types.h" 3 4 #ifndef lint __extension__ #endif # 64 "/usr/include/x86/_types.h" 3 4 /* LONGLONG */ typedef long long __int64_t; #ifndef lint __extension__ #endif # 69 "/usr/include/x86/_types.h" 3 4 /* LONGLONG */ typedef unsigned long long __uint64_t; #endif # 72 "/usr/include/x86/_types.h" 3 4 /* * Standard type definitions. */ #ifdef __LP64__ typedef __int32_t __clock_t; /* clock()... */ typedef __int64_t __critical_t; typedef double __double_t; typedef float __float_t; typedef __int64_t __intfptr_t; typedef __int64_t __intptr_t; #else # 84 "/usr/include/x86/_types.h" 3 4 typedef unsigned long __clock_t; typedef __int32_t __critical_t; typedef long double __double_t; typedef long double __float_t; typedef __int32_t __intfptr_t; typedef __int32_t __intptr_t; #endif # 91 "/usr/include/x86/_types.h" 3 4 typedef __int64_t __intmax_t; typedef __int32_t __int_fast8_t; typedef __int32_t __int_fast16_t; typedef __int32_t __int_fast32_t; typedef __int64_t __int_fast64_t; typedef __int8_t __int_least8_t; typedef __int16_t __int_least16_t; typedef __int32_t __int_least32_t; typedef __int64_t __int_least64_t; #ifdef __LP64__ typedef __int64_t __ptrdiff_t; /* ptr1 - ptr2 */ typedef __int64_t __register_t; typedef __int64_t __segsz_t; /* segment size (in pages) */ typedef __uint64_t __size_t; /* sizeof() */ typedef __int64_t __ssize_t; /* byte count or error */ typedef __int64_t __time_t; /* time()... */ typedef __uint64_t __uintfptr_t; typedef __uint64_t __uintptr_t; #else # 110 "/usr/include/x86/_types.h" 3 4 typedef __int32_t __ptrdiff_t; typedef __int32_t __register_t; typedef __int32_t __segsz_t; typedef __uint32_t __size_t; typedef __int32_t __ssize_t; typedef __int32_t __time_t; typedef __uint32_t __uintfptr_t; typedef __uint32_t __uintptr_t; #endif # 119 "/usr/include/x86/_types.h" 3 4 typedef __uint64_t __uintmax_t; typedef __uint32_t __uint_fast8_t; typedef __uint32_t __uint_fast16_t; typedef __uint32_t __uint_fast32_t; typedef __uint64_t __uint_fast64_t; typedef __uint8_t __uint_least8_t; typedef __uint16_t __uint_least16_t; typedef __uint32_t __uint_least32_t; typedef __uint64_t __uint_least64_t; #ifdef __LP64__ typedef __uint64_t __u_register_t; typedef __uint64_t __vm_offset_t; typedef __uint64_t __vm_paddr_t; typedef __uint64_t __vm_size_t; #else # 134 "/usr/include/x86/_types.h" 3 4 typedef __uint32_t __u_register_t; typedef __uint32_t __vm_offset_t; #ifdef PAE typedef __uint64_t __vm_paddr_t; #else # 139 "/usr/include/x86/_types.h" 3 4 typedef __uint32_t __vm_paddr_t; #endif # 141 "/usr/include/x86/_types.h" 3 4 typedef __uint32_t __vm_size_t; #endif # 143 "/usr/include/x86/_types.h" 3 4 typedef __int64_t __vm_ooffset_t; typedef __uint64_t __vm_pindex_t; typedef int ___wchar_t; #define __WCHAR_MIN __INT_MIN /* min value for a wchar_t */ #define __WCHAR_MAX __INT_MAX /* max value for a wchar_t */ /* * Unusual type definitions. */ #ifdef __GNUCLIKE_BUILTIN_VARARGS typedef __builtin_va_list __va_list; /* internally known to gcc */ #elif defined(lint) # 156 "/usr/include/x86/_types.h" 3 4 typedef char * __va_list; /* pretend */ #endif # 158 "/usr/include/x86/_types.h" 3 4 #if defined(__GNUC_VA_LIST_COMPATIBILITY) && !defined(__GNUC_VA_LIST) \ && !defined(__NO_GNUC_VA_LIST) #define __GNUC_VA_LIST typedef __va_list __gnuc_va_list; /* compatibility w/GNU headers*/ #endif # 163 "/usr/include/x86/_types.h" 3 4 #endif /* !_MACHINE__TYPES_H_ */ # 165 "/usr/include/x86/_types.h" 3 4 # 7 "/usr/include/machine/_types.h" 2 3 4 # 34 "/usr/include/sys/_types.h" 2 3 4 /* * Standard type definitions. */ typedef __int32_t __blksize_t; /* file block size */ typedef __int64_t __blkcnt_t; /* file block count */ typedef __int32_t __clockid_t; /* clock_gettime()... */ typedef __uint32_t __fflags_t; /* file flags */ typedef __uint64_t __fsblkcnt_t; typedef __uint64_t __fsfilcnt_t; typedef __uint32_t __gid_t; typedef __int64_t __id_t; /* can hold a gid_t, pid_t, or uid_t */ typedef __uint32_t __ino_t; /* inode number */ typedef long __key_t; /* IPC key (for Sys V IPC) */ typedef __int32_t __lwpid_t; /* Thread ID (a.k.a. LWP) */ typedef __uint16_t __mode_t; /* permissions */ typedef int __accmode_t; /* access permissions */ typedef int __nl_item; typedef __uint16_t __nlink_t; /* link count */ typedef __int64_t __off_t; /* file offset */ typedef __int32_t __pid_t; /* process [group] */ typedef __int64_t __rlim_t; /* resource limit - intentionally */ /* signed, because of legacy code */ /* that uses -1 for RLIM_INFINITY */ typedef __uint8_t __sa_family_t; typedef __uint32_t __socklen_t; typedef long __suseconds_t; /* microseconds (signed) */ typedef struct __timer *__timer_t; /* timer_gettime()... */ typedef struct __mq *__mqd_t; /* mq_open()... */ typedef __uint32_t __uid_t; typedef unsigned int __useconds_t; /* microseconds (unsigned) */ typedef int __cpuwhich_t; /* which parameter for cpuset. */ typedef int __cpulevel_t; /* level parameter for cpuset. */ typedef int __cpusetid_t; /* cpuset identifier. */ /* * Unusual type definitions. */ /* * rune_t is declared to be an ``int'' instead of the more natural * ``unsigned long'' or ``long''. Two things are happening here. It is not * unsigned so that EOF (-1) can be naturally assigned to it and used. Also, * it looks like 10646 will be a 31 bit standard. This means that if your * ints cannot hold 32 bits, you will be in trouble. The reason an int was * chosen over a long is that the is*() and to*() routines take ints (says * ANSI C), but they use __ct_rune_t instead of int. * * NOTE: rune_t is not covered by ANSI nor other standards, and should not * be instantiated outside of lib/libc/locale. Use wchar_t. wint_t and * rune_t must be the same type. Also, wint_t should be able to hold all * members of the largest character set plus one extra value (WEOF), and * must be at least 16 bits. */ typedef int __ct_rune_t; /* arg type for ctype funcs */ typedef __ct_rune_t __rune_t; /* rune_t (see above) */ typedef __ct_rune_t __wint_t; /* wint_t (see above) */ /* Clang already provides these types as built-ins, but only in C++ mode. */ #if !defined(__clang__) || !defined(__cplusplus) typedef __uint_least16_t __char16_t; typedef __uint_least32_t __char32_t; #endif # 96 "/usr/include/sys/_types.h" 3 4 /* In C++11, char16_t and char32_t are built-in types. */ #if defined(__cplusplus) && __cplusplus >= 201103L #define _CHAR16_T_DECLARED #define _CHAR32_T_DECLARED #endif # 101 "/usr/include/sys/_types.h" 3 4 typedef __uint32_t __dev_t; /* device number */ typedef __uint32_t __fixpt_t; /* fixed point number */ /* * mbstate_t is an opaque object to keep conversion state during multibyte * stream conversions. */ typedef union { char __mbstate8[128]; __int64_t _mbstateL; /* for alignment */ } __mbstate_t; #endif /* !_SYS__TYPES_H_ */ # 116 "/usr/include/sys/_types.h" 3 4 # 42 "/usr/include/stdio.h" 2 3 4 typedef __off_t fpos_t; #ifndef _SIZE_T_DECLARED typedef __size_t size_t; #define _SIZE_T_DECLARED #endif # 49 "/usr/include/stdio.h" 3 4 #if __POSIX_VISIBLE >= 200809 #ifndef _OFF_T_DECLARED #define _OFF_T_DECLARED typedef __off_t off_t; #endif # 55 "/usr/include/stdio.h" 3 4 #ifndef _SSIZE_T_DECLARED #define _SSIZE_T_DECLARED typedef __ssize_t ssize_t; #endif # 59 "/usr/include/stdio.h" 3 4 #endif # 60 "/usr/include/stdio.h" 3 4 #if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE #ifndef _VA_LIST_DECLARED typedef __va_list va_list; #define _VA_LIST_DECLARED #endif # 66 "/usr/include/stdio.h" 3 4 #endif # 67 "/usr/include/stdio.h" 3 4 #define _FSTDIO /* Define for new stdio with functions. */ /* * NB: to fit things in six character monocase externals, the stdio * code uses the prefix `__s' for stdio objects, typically followed * by a three-character attempt at a mnemonic. */ /* stdio buffers */ struct __sbuf { unsigned char *_base; int _size; }; /* * stdio state variables. * * The following always hold: * * if (_flags&(__SLBF|__SWR)) == (__SLBF|__SWR), * _lbfsize is -_bf._size, else _lbfsize is 0 * if _flags&__SRD, _w is 0 * if _flags&__SWR, _r is 0 * * This ensures that the getc and putc macros (or inline functions) never * try to write or read from a file that is in `read' or `write' mode. * (Moreover, they can, and do, automatically switch from read mode to * write mode, and back, on "r+" and "w+" files.) * * _lbfsize is used only to make the inline line-buffered output stream * code as compact as possible. * * _ub, _up, and _ur are used when ungetc() pushes back more characters * than fit in the current _bf, or when ungetc() pushes back a character * that does not match the previous one in _bf. When this happens, * _ub._base becomes non-nil (i.e., a stream has ungetc() data iff * _ub._base!=NULL) and _up and _ur save the current values of _p and _r. * * Certain members of __sFILE are accessed directly via macros or * inline functions. To preserve ABI compat, these members must not * be disturbed. These members are marked below with (*). */ struct __sFILE { unsigned char *_p; /* (*) current position in (some) buffer */ int _r; /* (*) read space left for getc() */ int _w; /* (*) write space left for putc() */ short _flags; /* (*) flags, below; this FILE is free if 0 */ short _file; /* (*) fileno, if Unix descriptor, else -1 */ struct __sbuf _bf; /* (*) the buffer (at least 1 byte, if !NULL) */ int _lbfsize; /* (*) 0 or -_bf._size, for inline putc */ /* operations */ void *_cookie; /* (*) cookie passed to io functions */ int (*_close)(void *); int (*_read)(void *, char *, int); fpos_t (*_seek)(void *, fpos_t, int); int (*_write)(void *, const char *, int); /* separate buffer for long sequences of ungetc() */ struct __sbuf _ub; /* ungetc buffer */ unsigned char *_up; /* saved _p when _p is doing ungetc data */ int _ur; /* saved _r when _r is counting ungetc data */ /* tricks to meet minimum requirements even when malloc() fails */ unsigned char _ubuf[3]; /* guarantee an ungetc() buffer */ unsigned char _nbuf[1]; /* guarantee a getc() buffer */ /* separate buffer for fgetln() when line crosses buffer boundary */ struct __sbuf _lb; /* buffer for fgetln() */ /* Unix stdio files get aligned to block boundaries on fseek() */ int _blksize; /* stat.st_blksize (may be != _bf._size) */ fpos_t _offset; /* current lseek offset */ struct pthread_mutex *_fl_mutex; /* used for MT-safety */ struct pthread *_fl_owner; /* current owner */ int _fl_count; /* recursive lock count */ int _orientation; /* orientation for fwide() */ __mbstate_t _mbstate; /* multibyte conversion state */ }; #ifndef _STDFILE_DECLARED #define _STDFILE_DECLARED typedef struct __sFILE FILE; #endif # 152 "/usr/include/stdio.h" 3 4 #ifndef _STDSTREAM_DECLARED __BEGIN_DECLS extern FILE *__stdinp; extern FILE *__stdoutp; extern FILE *__stderrp; __END_DECLS #define _STDSTREAM_DECLARED #endif # 160 "/usr/include/stdio.h" 3 4 #define __SLBF 0x0001 /* line buffered */ #define __SNBF 0x0002 /* unbuffered */ #define __SRD 0x0004 /* OK to read */ #define __SWR 0x0008 /* OK to write */ /* RD and WR are never simultaneously asserted */ #define __SRW 0x0010 /* open for reading & writing */ #define __SEOF 0x0020 /* found EOF */ #define __SERR 0x0040 /* found error */ #define __SMBF 0x0080 /* _bf._base is from malloc */ #define __SAPP 0x0100 /* fdopen()ed in append mode */ #define __SSTR 0x0200 /* this is an sprintf/snprintf string */ #define __SOPT 0x0400 /* do fseek() optimization */ #define __SNPT 0x0800 /* do not do fseek() optimization */ #define __SOFF 0x1000 /* set iff _offset is in fact correct */ #define __SMOD 0x2000 /* true => fgetln modified _p text */ #define __SALC 0x4000 /* allocate string space dynamically */ #define __SIGN 0x8000 /* ignore this file in _fwalk */ /* * The following three definitions are for ANSI C, which took them * from System V, which brilliantly took internal interface macros and * made them official arguments to setvbuf(), without renaming them. * Hence, these ugly _IOxxx names are *supposed* to appear in user code. * * Although numbered as their counterparts above, the implementation * does not rely on this. */ #define _IOFBF 0 /* setvbuf should set fully buffered */ #define _IOLBF 1 /* setvbuf should set line buffered */ #define _IONBF 2 /* setvbuf should set unbuffered */ #define BUFSIZ 1024 /* size of buffer used by setbuf */ #define EOF (-1) /* * FOPEN_MAX is a minimum maximum, and is the number of streams that * stdio can provide without attempting to allocate further resources * (which could fail). Do not use this for anything. */ /* must be == _POSIX_STREAM_MAX */ #ifndef FOPEN_MAX #define FOPEN_MAX 20 /* must be <= OPEN_MAX */ #endif # 204 "/usr/include/stdio.h" 3 4 #define FILENAME_MAX 1024 /* must be <= PATH_MAX */ /* System V/ANSI C; this is the wrong way to do this, do *not* use these. */ #if __XSI_VISIBLE #define P_tmpdir "/tmp/" #endif # 210 "/usr/include/stdio.h" 3 4 #define L_tmpnam 1024 /* XXX must be == PATH_MAX */ #define TMP_MAX 308915776 #ifndef SEEK_SET #define SEEK_SET 0 /* set file offset to offset */ #endif # 216 "/usr/include/stdio.h" 3 4 #ifndef SEEK_CUR #define SEEK_CUR 1 /* set file offset to current plus offset */ #endif # 219 "/usr/include/stdio.h" 3 4 #ifndef SEEK_END #define SEEK_END 2 /* set file offset to EOF plus offset */ #endif # 222 "/usr/include/stdio.h" 3 4 #define stdin __stdinp #define stdout __stdoutp #define stderr __stderrp __BEGIN_DECLS #ifdef _XLOCALE_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 229 "/usr/include/stdio.h" 3 4 # 230 "/usr/include/stdio.h" 3 4 #endif # 231 "/usr/include/stdio.h" 3 4 /* * Functions defined in ANSI C standard. */ void clearerr(FILE *); int fclose(FILE *); int feof(FILE *); int ferror(FILE *); int fflush(FILE *); int fgetc(FILE *); int fgetpos(FILE * __restrict, fpos_t * __restrict); char *fgets(char * __restrict, int, FILE * __restrict); FILE *fopen(const char * __restrict, const char * __restrict); int fprintf(FILE * __restrict, const char * __restrict, ...); int fputc(int, FILE *); int fputs(const char * __restrict, FILE * __restrict); size_t fread(void * __restrict, size_t, size_t, FILE * __restrict); FILE *freopen(const char * __restrict, const char * __restrict, FILE * __restrict); int fscanf(FILE * __restrict, const char * __restrict, ...); int fseek(FILE *, long, int); int fsetpos(FILE *, const fpos_t *); long ftell(FILE *); size_t fwrite(const void * __restrict, size_t, size_t, FILE * __restrict); int getc(FILE *); int getchar(void); char *gets(char *); void perror(const char *); int printf(const char * __restrict, ...); int putc(int, FILE *); int putchar(int); int puts(const char *); int remove(const char *); int rename(const char *, const char *); void rewind(FILE *); int scanf(const char * __restrict, ...); void setbuf(FILE * __restrict, char * __restrict); int setvbuf(FILE * __restrict, char * __restrict, int, size_t); int sprintf(char * __restrict, const char * __restrict, ...); int sscanf(const char * __restrict, const char * __restrict, ...); FILE *tmpfile(void); char *tmpnam(char *); int ungetc(int, FILE *); int vfprintf(FILE * __restrict, const char * __restrict, __va_list); int vprintf(const char * __restrict, __va_list); int vsprintf(char * __restrict, const char * __restrict, __va_list); #if __ISO_C_VISIBLE >= 1999 int snprintf(char * __restrict, size_t, const char * __restrict, ...) __printflike(3, 4); int vfscanf(FILE * __restrict, const char * __restrict, __va_list) __scanflike(2, 0); int vscanf(const char * __restrict, __va_list) __scanflike(1, 0); int vsnprintf(char * __restrict, size_t, const char * __restrict, __va_list) __printflike(3, 0); int vsscanf(const char * __restrict, const char * __restrict, __va_list) __scanflike(2, 0); #endif # 289 "/usr/include/stdio.h" 3 4 /* * Functions defined in all versions of POSIX 1003.1. */ #if __BSD_VISIBLE || (__POSIX_VISIBLE && __POSIX_VISIBLE <= 199506) #define L_cuserid 17 /* size for cuserid(3); MAXLOGNAME, legacy */ #endif # 296 "/usr/include/stdio.h" 3 4 #if __POSIX_VISIBLE #define L_ctermid 1024 /* size for ctermid(3); PATH_MAX */ char *ctermid(char *); FILE *fdopen(int, const char *); int fileno(FILE *); #endif /* __POSIX_VISIBLE */ # 304 "/usr/include/stdio.h" 3 4 #if __POSIX_VISIBLE >= 199209 int pclose(FILE *); FILE *popen(const char *, const char *); #endif # 309 "/usr/include/stdio.h" 3 4 #if __POSIX_VISIBLE >= 199506 int ftrylockfile(FILE *); void flockfile(FILE *); void funlockfile(FILE *); /* * These are normally used through macros as defined below, but POSIX * requires functions as well. */ int getc_unlocked(FILE *); int getchar_unlocked(void); int putc_unlocked(int, FILE *); int putchar_unlocked(int); #endif # 324 "/usr/include/stdio.h" 3 4 #if __BSD_VISIBLE void clearerr_unlocked(FILE *); int feof_unlocked(FILE *); int ferror_unlocked(FILE *); int fileno_unlocked(FILE *); #endif # 330 "/usr/include/stdio.h" 3 4 #if __POSIX_VISIBLE >= 200112 int fseeko(FILE *, __off_t, int); __off_t ftello(FILE *); #endif # 335 "/usr/include/stdio.h" 3 4 #if __BSD_VISIBLE || __XSI_VISIBLE > 0 && __XSI_VISIBLE < 600 int getw(FILE *); int putw(int, FILE *); #endif /* BSD or X/Open before issue 6 */ # 340 "/usr/include/stdio.h" 3 4 #if __XSI_VISIBLE char *tempnam(const char *, const char *); #endif # 344 "/usr/include/stdio.h" 3 4 #if __POSIX_VISIBLE >= 200809 FILE *fmemopen(void * __restrict, size_t, const char * __restrict); ssize_t getdelim(char ** __restrict, size_t * __restrict, int, FILE * __restrict); FILE *open_memstream(char **, size_t *); int renameat(int, const char *, int, const char *); int vdprintf(int, const char * __restrict, __va_list); /* * Every programmer and his dog wrote functions called getline() and dprintf() * before POSIX.1-2008 came along and decided to usurp the names, so we * don't prototype them by default unless one of the following is true: * a) the app has requested them specifically by defining _WITH_GETLINE or * _WITH_DPRINTF, respectively * b) the app has requested a POSIX.1-2008 environment via _POSIX_C_SOURCE * c) the app defines a GNUism such as _BSD_SOURCE or _GNU_SOURCE */ #ifndef _WITH_GETLINE #if defined(_BSD_SOURCE) || defined(_GNU_SOURCE) #define _WITH_GETLINE #elif defined(_POSIX_C_SOURCE) # 366 "/usr/include/stdio.h" 3 4 #if _POSIX_C_SOURCE >= 200809 #define _WITH_GETLINE #endif # 369 "/usr/include/stdio.h" 3 4 #endif # 370 "/usr/include/stdio.h" 3 4 #endif # 371 "/usr/include/stdio.h" 3 4 #ifdef _WITH_GETLINE ssize_t getline(char ** __restrict, size_t * __restrict, FILE * __restrict); #endif # 375 "/usr/include/stdio.h" 3 4 #ifndef _WITH_DPRINTF #if defined(_BSD_SOURCE) || defined(_GNU_SOURCE) #define _WITH_DPRINTF #elif defined(_POSIX_C_SOURCE) # 380 "/usr/include/stdio.h" 3 4 #if _POSIX_C_SOURCE >= 200809 #define _WITH_DPRINTF #endif # 383 "/usr/include/stdio.h" 3 4 #endif # 384 "/usr/include/stdio.h" 3 4 #endif # 385 "/usr/include/stdio.h" 3 4 #ifdef _WITH_DPRINTF int (dprintf)(int, const char * __restrict, ...); #endif # 389 "/usr/include/stdio.h" 3 4 #endif /* __POSIX_VISIBLE >= 200809 */ # 391 "/usr/include/stdio.h" 3 4 /* * Routines that are purely local. */ #if __BSD_VISIBLE int asprintf(char **, const char *, ...) __printflike(2, 3); char *ctermid_r(char *); void fcloseall(void); char *fgetln(FILE *, size_t *); const char *fmtcheck(const char *, const char *) __format_arg(2); int fpurge(FILE *); void setbuffer(FILE *, char *, int); int setlinebuf(FILE *); int vasprintf(char **, const char *, __va_list) __printflike(2, 0); /* * The system error table contains messages for the first sys_nerr * positive errno values. Use strerror() or strerror_r() from * instead. */ extern const int sys_nerr; extern const char * const sys_errlist[]; /* * Stdio function-access interface. */ FILE *funopen(const void *, int (*)(void *, char *, int), int (*)(void *, const char *, int), fpos_t (*)(void *, fpos_t, int), int (*)(void *)); #define fropen(cookie, fn) funopen(cookie, fn, 0, 0, 0) #define fwopen(cookie, fn) funopen(cookie, 0, fn, 0, 0) /* * Portability hacks. See . */ #ifndef _FTRUNCATE_DECLARED #define _FTRUNCATE_DECLARED int ftruncate(int, __off_t); #endif # 433 "/usr/include/stdio.h" 3 4 #ifndef _LSEEK_DECLARED #define _LSEEK_DECLARED __off_t lseek(int, __off_t, int); #endif # 437 "/usr/include/stdio.h" 3 4 #ifndef _MMAP_DECLARED #define _MMAP_DECLARED void *mmap(void *, size_t, int, int, int, __off_t); #endif # 441 "/usr/include/stdio.h" 3 4 #ifndef _TRUNCATE_DECLARED #define _TRUNCATE_DECLARED int truncate(const char *, __off_t); #endif # 445 "/usr/include/stdio.h" 3 4 #endif /* __BSD_VISIBLE */ # 446 "/usr/include/stdio.h" 3 4 /* * Functions internal to the implementation. */ int __srget(FILE *); int __swbuf(int, FILE *); /* * The __sfoo macros are here so that we can * define function versions in the C library. */ #define __sgetc(p) (--(p)->_r < 0 ? __srget(p) : (int)(*(p)->_p++)) #if defined(__GNUC__) && defined(__STDC__) static __inline int __sputc(int _c, FILE *_p) { if (--_p->_w >= 0 || (_p->_w >= _p->_lbfsize && (char)_c != '\n')) return (*_p->_p++ = _c); else return (__swbuf(_c, _p)); } #else # 466 "/usr/include/stdio.h" 3 4 /* * This has been tuned to generate reasonable code on the vax using pcc. */ #define __sputc(c, p) \ (--(p)->_w < 0 ? \ (p)->_w >= (p)->_lbfsize ? \ (*(p)->_p = (c)), *(p)->_p != '\n' ? \ (int)*(p)->_p++ : \ __swbuf('\n', p) : \ __swbuf((int)(c), p) : \ (*(p)->_p = (c), (int)*(p)->_p++)) #endif # 478 "/usr/include/stdio.h" 3 4 extern int __isthreaded; #ifndef __cplusplus #define __sfeof(p) (((p)->_flags & __SEOF) != 0) #define __sferror(p) (((p)->_flags & __SERR) != 0) #define __sclearerr(p) ((void)((p)->_flags &= ~(__SERR|__SEOF))) #define __sfileno(p) ((p)->_file) #define feof(p) (!__isthreaded ? __sfeof(p) : (feof)(p)) #define ferror(p) (!__isthreaded ? __sferror(p) : (ferror)(p)) #define clearerr(p) (!__isthreaded ? __sclearerr(p) : (clearerr)(p)) #if __POSIX_VISIBLE #define fileno(p) (!__isthreaded ? __sfileno(p) : (fileno)(p)) #endif # 496 "/usr/include/stdio.h" 3 4 #define getc(fp) (!__isthreaded ? __sgetc(fp) : (getc)(fp)) #define putc(x, fp) (!__isthreaded ? __sputc(x, fp) : (putc)(x, fp)) #define getchar() getc(stdin) #define putchar(x) putc(x, stdout) #if __BSD_VISIBLE /* * See ISO/IEC 9945-1 ANSI/IEEE Std 1003.1 Second Edition 1996-07-12 * B.8.2.7 for the rationale behind the *_unlocked() macros. */ #define feof_unlocked(p) __sfeof(p) #define ferror_unlocked(p) __sferror(p) #define clearerr_unlocked(p) __sclearerr(p) #define fileno_unlocked(p) __sfileno(p) #endif # 513 "/usr/include/stdio.h" 3 4 #if __POSIX_VISIBLE >= 199506 #define getc_unlocked(fp) __sgetc(fp) #define putc_unlocked(x, fp) __sputc(x, fp) #define getchar_unlocked() getc_unlocked(stdin) #define putchar_unlocked(x) putc_unlocked(x, stdout) #endif # 520 "/usr/include/stdio.h" 3 4 #endif /* __cplusplus */ # 521 "/usr/include/stdio.h" 3 4 __END_DECLS #endif /* !_STDIO_H_ */ # 524 "/usr/include/stdio.h" 3 4 # 42 "SDL2_imageFilter.c" 2 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 42 "SDL2_imageFilter.c" # 1 "/usr/include/stdlib.h" 1 3 4 /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)stdlib.h 8.5 (Berkeley) 5/19/95 * $FreeBSD: head/include/stdlib.h 282988 2015-05-15 20:43:37Z pfg $ */ #ifndef _STDLIB_H_ #define _STDLIB_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 36 "/usr/include/stdlib.h" 3 4 # 37 "/usr/include/stdlib.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 37 "/usr/include/stdlib.h" 3 4 # 38 "/usr/include/stdlib.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 38 "/usr/include/stdlib.h" 3 4 # 39 "/usr/include/stdlib.h" 3 4 #if __BSD_VISIBLE #ifndef _RUNE_T_DECLARED typedef __rune_t rune_t; #define _RUNE_T_DECLARED #endif # 45 "/usr/include/stdlib.h" 3 4 #endif # 46 "/usr/include/stdlib.h" 3 4 #ifndef _SIZE_T_DECLARED typedef __size_t size_t; #define _SIZE_T_DECLARED #endif # 51 "/usr/include/stdlib.h" 3 4 #ifndef __cplusplus #ifndef _WCHAR_T_DECLARED typedef ___wchar_t wchar_t; #define _WCHAR_T_DECLARED #endif # 57 "/usr/include/stdlib.h" 3 4 #endif # 58 "/usr/include/stdlib.h" 3 4 typedef struct { int quot; /* quotient */ int rem; /* remainder */ } div_t; typedef struct { long quot; long rem; } ldiv_t; #define EXIT_FAILURE 1 #define EXIT_SUCCESS 0 #define RAND_MAX 0x7ffffffd __BEGIN_DECLS #ifdef _XLOCALE_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 76 "/usr/include/stdlib.h" 3 4 # 77 "/usr/include/stdlib.h" 3 4 #endif # 78 "/usr/include/stdlib.h" 3 4 extern int __mb_cur_max; extern int ___mb_cur_max(void); #define MB_CUR_MAX (___mb_cur_max()) _Noreturn void abort(void); int abs(int) __pure2; int atexit(void (*)(void)); double atof(const char *); int atoi(const char *); long atol(const char *); void *bsearch(const void *, const void *, size_t, size_t, int (*)(const void *, const void *)); void *calloc(size_t, size_t) __malloc_like __result_use_check __alloc_size(1) __alloc_size(2); div_t div(int, int) __pure2; _Noreturn void exit(int); void free(void *); char *getenv(const char *); long labs(long) __pure2; ldiv_t ldiv(long, long) __pure2; void *malloc(size_t) __malloc_like __result_use_check __alloc_size(1); int mblen(const char *, size_t); size_t mbstowcs(wchar_t * __restrict , const char * __restrict, size_t); int mbtowc(wchar_t * __restrict, const char * __restrict, size_t); void qsort(void *, size_t, size_t, int (*)(const void *, const void *)); int rand(void); void *realloc(void *, size_t) __result_use_check __alloc_size(2); void srand(unsigned); double strtod(const char * __restrict, char ** __restrict); float strtof(const char * __restrict, char ** __restrict); long strtol(const char * __restrict, char ** __restrict, int); long double strtold(const char * __restrict, char ** __restrict); unsigned long strtoul(const char * __restrict, char ** __restrict, int); int system(const char *); int wctomb(char *, wchar_t); size_t wcstombs(char * __restrict, const wchar_t * __restrict, size_t); /* * Functions added in C99 which we make conditionally available in the * BSD^C89 namespace if the compiler supports `long long'. * The #if test is more complicated than it ought to be because * __BSD_VISIBLE implies __ISO_C_VISIBLE == 1999 *even if* `long long' * is not supported in the compilation environment (which therefore means * that it can't really be ISO C99). * * (The only other extension made by C99 in thie header is _Exit().) */ #if __ISO_C_VISIBLE >= 1999 #ifdef __LONG_LONG_SUPPORTED /* LONGLONG */ typedef struct { long long quot; long long rem; } lldiv_t; /* LONGLONG */ long long atoll(const char *); /* LONGLONG */ long long llabs(long long) __pure2; /* LONGLONG */ lldiv_t lldiv(long long, long long) __pure2; /* LONGLONG */ long long strtoll(const char * __restrict, char ** __restrict, int); /* LONGLONG */ unsigned long long strtoull(const char * __restrict, char ** __restrict, int); #endif /* __LONG_LONG_SUPPORTED */ # 151 "/usr/include/stdlib.h" 3 4 _Noreturn void _Exit(int); #endif /* __ISO_C_VISIBLE >= 1999 */ # 154 "/usr/include/stdlib.h" 3 4 /* * If we're in a mode greater than C99, expose C11 functions. */ #if __ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103L void * aligned_alloc(size_t, size_t) __malloc_like __alloc_align(1) __alloc_size(2); int at_quick_exit(void (*)(void)); _Noreturn void quick_exit(int); #endif /* __ISO_C_VISIBLE >= 2011 */ # 165 "/usr/include/stdlib.h" 3 4 /* * Extensions made by POSIX relative to C. */ #if __POSIX_VISIBLE >= 199506 || __XSI_VISIBLE char *realpath(const char * __restrict, char * __restrict); #endif # 171 "/usr/include/stdlib.h" 3 4 #if __POSIX_VISIBLE >= 199506 int rand_r(unsigned *); /* (TSF) */ #endif # 174 "/usr/include/stdlib.h" 3 4 #if __POSIX_VISIBLE >= 200112 int posix_memalign(void **, size_t, size_t) __nonnull(1) __alloc_align(2) __alloc_size(3); /* (ADV) */ int setenv(const char *, const char *, int); int unsetenv(const char *); #endif # 180 "/usr/include/stdlib.h" 3 4 #if __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE int getsubopt(char **, char *const *, char **); #ifndef _MKDTEMP_DECLARED char *mkdtemp(char *); #define _MKDTEMP_DECLARED #endif # 187 "/usr/include/stdlib.h" 3 4 #ifndef _MKSTEMP_DECLARED int mkstemp(char *); #define _MKSTEMP_DECLARED #endif # 191 "/usr/include/stdlib.h" 3 4 #endif /* __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE */ # 192 "/usr/include/stdlib.h" 3 4 /* * The only changes to the XSI namespace in revision 6 were the deletion * of the ttyslot() and valloc() functions, which FreeBSD never declared * in this header. For revision 7, ecvt(), fcvt(), and gcvt(), which * FreeBSD also does not have, and mktemp(), are to be deleted. */ #if __XSI_VISIBLE /* XXX XSI requires pollution from here. We'd rather not. */ long a64l(const char *); double drand48(void); /* char *ecvt(double, int, int * __restrict, int * __restrict); */ double erand48(unsigned short[3]); /* char *fcvt(double, int, int * __restrict, int * __restrict); */ /* char *gcvt(double, int, int * __restrict, int * __restrict); */ int grantpt(int); char *initstate(unsigned long /* XSI requires u_int */, char *, long); long jrand48(unsigned short[3]); char *l64a(long); void lcong48(unsigned short[7]); long lrand48(void); #if !defined(_MKTEMP_DECLARED) && (__BSD_VISIBLE || __XSI_VISIBLE <= 600) char *mktemp(char *); #define _MKTEMP_DECLARED #endif # 217 "/usr/include/stdlib.h" 3 4 long mrand48(void); long nrand48(unsigned short[3]); int posix_openpt(int); char *ptsname(int); int putenv(char *); long random(void); unsigned short *seed48(unsigned short[3]); #ifndef _SETKEY_DECLARED int setkey(const char *); #define _SETKEY_DECLARED #endif # 229 "/usr/include/stdlib.h" 3 4 char *setstate(/* const */ char *); void srand48(long); void srandom(unsigned long); int unlockpt(int); #endif /* __XSI_VISIBLE */ # 234 "/usr/include/stdlib.h" 3 4 #if __BSD_VISIBLE extern const char *malloc_conf; extern void (*malloc_message)(void *, const char *); /* * The alloca() function can't be implemented in C, and on some * platforms it can't be implemented at all as a callable function. * The GNU C compiler provides a built-in alloca() which we can use; * in all other cases, provide a prototype, mainly to pacify various * incarnations of lint. On platforms where alloca() is not in libc, * programs which use it will fail to link when compiled with non-GNU * compilers. */ #if __GNUC__ >= 2 || defined(__INTEL_COMPILER) #undef alloca /* some GNU bits try to get cute and define this on their own */ #define alloca(sz) __builtin_alloca(sz) #elif defined(lint) # 252 "/usr/include/stdlib.h" 3 4 void *alloca(size_t); #endif # 254 "/usr/include/stdlib.h" 3 4 void abort2(const char *, int, void **) __dead2; __uint32_t arc4random(void); void arc4random_addrandom(unsigned char *, int); void arc4random_buf(void *, size_t); void arc4random_stir(void); __uint32_t arc4random_uniform(__uint32_t); #ifdef __BLOCKS__ int atexit_b(void (^)(void)); void *bsearch_b(const void *, const void *, size_t, size_t, int (^)(const void *, const void *)); #endif # 268 "/usr/include/stdlib.h" 3 4 char *getbsize(int *, long *); /* getcap(3) functions */ char *cgetcap(char *, const char *, int); int cgetclose(void); int cgetent(char **, char **, const char *); int cgetfirst(char **, char **); int cgetmatch(const char *, const char *); int cgetnext(char **, char **); int cgetnum(char *, const char *, long *); int cgetset(const char *); int cgetstr(char *, const char *, char **); int cgetustr(char *, const char *, char **); int daemon(int, int); char *devname(__dev_t, __mode_t); char *devname_r(__dev_t, __mode_t, char *, int); char *fdevname(int); char *fdevname_r(int, char *, int); int getloadavg(double [], int); const char * getprogname(void); int heapsort(void *, size_t, size_t, int (*)(const void *, const void *)); #ifdef __BLOCKS__ int heapsort_b(void *, size_t, size_t, int (^)(const void *, const void *)); void qsort_b(void *, size_t, size_t, int (^)(const void *, const void *)); #endif # 296 "/usr/include/stdlib.h" 3 4 int l64a_r(long, char *, int); int mergesort(void *, size_t, size_t, int (*)(const void *, const void *)); #ifdef __BLOCKS__ int mergesort_b(void *, size_t, size_t, int (^)(const void *, const void *)); #endif # 301 "/usr/include/stdlib.h" 3 4 int mkostemp(char *, int); int mkostemps(char *, int, int); void qsort_r(void *, size_t, size_t, void *, int (*)(void *, const void *, const void *)); int radixsort(const unsigned char **, int, const unsigned char *, unsigned); void *reallocarray(void *, size_t, size_t) __result_use_check __alloc_size(2) __alloc_size(3); void *reallocf(void *, size_t) __alloc_size(2); int rpmatch(const char *); void setprogname(const char *); int sradixsort(const unsigned char **, int, const unsigned char *, unsigned); void sranddev(void); void srandomdev(void); long long strtonum(const char *, long long, long long, const char **); /* Deprecated interfaces, to be removed in FreeBSD 6.0. */ __int64_t strtoq(const char *, char **, int); __uint64_t strtouq(const char *, char **, int); extern char *suboptarg; /* getsubopt(3) external variable */ #endif /* __BSD_VISIBLE */ # 327 "/usr/include/stdlib.h" 3 4 __END_DECLS #endif /* !_STDLIB_H_ */ # 330 "/usr/include/stdlib.h" 3 4 # 43 "SDL2_imageFilter.c" 2 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 43 "SDL2_imageFilter.c" # 1 "/usr/include/string.h" 1 3 4 /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)string.h 8.1 (Berkeley) 6/2/93 * $FreeBSD: head/include/string.h 265878 2014-05-11 13:48:21Z jilles $ */ #ifndef _STRING_H_ #define _STRING_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 36 "/usr/include/string.h" 3 4 # 37 "/usr/include/string.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 37 "/usr/include/string.h" 3 4 # 38 "/usr/include/string.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 38 "/usr/include/string.h" 3 4 # 39 "/usr/include/string.h" 3 4 /* * Prototype functions which were historically defined in , but * are required by POSIX to be prototyped in . */ #if __BSD_VISIBLE #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 45 "/usr/include/string.h" 3 4 # 1 "/usr/include/strings.h" 1 3 4 /*- * Copyright (c) 2002 Mike Barcroft * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $FreeBSD: head/include/strings.h 272673 2014-10-07 04:54:11Z delphij $ */ #ifndef _STRINGS_H_ #define _STRINGS_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 32 "/usr/include/strings.h" 3 4 # 33 "/usr/include/strings.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 33 "/usr/include/strings.h" 3 4 # 34 "/usr/include/strings.h" 3 4 #ifndef _SIZE_T_DECLARED typedef __size_t size_t; #define _SIZE_T_DECLARED #endif # 39 "/usr/include/strings.h" 3 4 __BEGIN_DECLS #if __BSD_VISIBLE || __POSIX_VISIBLE <= 200112 int bcmp(const void *, const void *, size_t) __pure; /* LEGACY */ void bcopy(const void *, void *, size_t); /* LEGACY */ void bzero(void *, size_t); /* LEGACY */ #endif # 46 "/usr/include/strings.h" 3 4 #if __BSD_VISIBLE void explicit_bzero(void *, size_t); #endif # 49 "/usr/include/strings.h" 3 4 #if __XSI_VISIBLE int ffs(int) __pure2; #endif # 52 "/usr/include/strings.h" 3 4 #if __BSD_VISIBLE int ffsl(long) __pure2; int ffsll(long long) __pure2; int fls(int) __pure2; int flsl(long) __pure2; int flsll(long long) __pure2; #endif # 59 "/usr/include/strings.h" 3 4 #if __BSD_VISIBLE || __POSIX_VISIBLE <= 200112 char *index(const char *, int) __pure; /* LEGACY */ char *rindex(const char *, int) __pure; /* LEGACY */ #endif # 63 "/usr/include/strings.h" 3 4 int strcasecmp(const char *, const char *) __pure; int strncasecmp(const char *, const char *, size_t) __pure; #if __POSIX_VISIBLE >= 200809 || defined(_XLOCALE_H_) #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 67 "/usr/include/strings.h" 3 4 # 1 "/usr/include/xlocale/_strings.h" 1 3 4 /*- * Copyright (c) 2011, 2012 The FreeBSD Foundation * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $FreeBSD: head/include/xlocale/_strings.h 266865 2014-05-30 01:09:07Z pfg $ */ #ifndef _LOCALE_T_DEFINED #define _LOCALE_T_DEFINED typedef struct _xlocale *locale_t; #endif # 33 "/usr/include/xlocale/_strings.h" 3 4 /* * This file is included from both strings.h and xlocale.h. We need to expose * the declarations unconditionally if we are included from xlocale.h, but only * if we are in POSIX2008 mode if included from string.h. */ #ifndef _XLOCALE_STRINGS1_H #define _XLOCALE_STRINGS1_H /* * POSIX2008 functions */ int strcasecmp_l(const char *, const char *, locale_t); int strncasecmp_l(const char *, const char *, size_t, locale_t); #endif /* _XLOCALE_STRINGS1_H */ # 49 "/usr/include/xlocale/_strings.h" 3 4 # 68 "/usr/include/strings.h" 2 3 4 #endif # 69 "/usr/include/strings.h" 3 4 __END_DECLS #endif /* _STRINGS_H_ */ # 72 "/usr/include/strings.h" 3 4 # 46 "/usr/include/string.h" 2 3 4 #endif # 47 "/usr/include/string.h" 3 4 #ifndef _SIZE_T_DECLARED typedef __size_t size_t; #define _SIZE_T_DECLARED #endif # 52 "/usr/include/string.h" 3 4 __BEGIN_DECLS #if __XSI_VISIBLE >= 600 void *memccpy(void * __restrict, const void * __restrict, int, size_t); #endif # 57 "/usr/include/string.h" 3 4 void *memchr(const void *, int, size_t) __pure; #if __BSD_VISIBLE void *memrchr(const void *, int, size_t) __pure; #endif # 61 "/usr/include/string.h" 3 4 int memcmp(const void *, const void *, size_t) __pure; void *memcpy(void * __restrict, const void * __restrict, size_t); #if __BSD_VISIBLE void *memmem(const void *, size_t, const void *, size_t) __pure; #endif # 66 "/usr/include/string.h" 3 4 void *memmove(void *, const void *, size_t); void *memset(void *, int, size_t); #if __POSIX_VISIBLE >= 200809 char *stpcpy(char * __restrict, const char * __restrict); char *stpncpy(char * __restrict, const char * __restrict, size_t); #endif # 72 "/usr/include/string.h" 3 4 #if __BSD_VISIBLE char *strcasestr(const char *, const char *) __pure; #endif # 75 "/usr/include/string.h" 3 4 char *strcat(char * __restrict, const char * __restrict); char *strchr(const char *, int) __pure; #if __BSD_VISIBLE char *strchrnul(const char*, int) __pure; #endif # 80 "/usr/include/string.h" 3 4 int strcmp(const char *, const char *) __pure; int strcoll(const char *, const char *); char *strcpy(char * __restrict, const char * __restrict); size_t strcspn(const char *, const char *) __pure; #if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE char *strdup(const char *) __malloc_like; #endif # 87 "/usr/include/string.h" 3 4 char *strerror(int); #if __POSIX_VISIBLE >= 200112 int strerror_r(int, char *, size_t); #endif # 91 "/usr/include/string.h" 3 4 #if __BSD_VISIBLE size_t strlcat(char * __restrict, const char * __restrict, size_t); size_t strlcpy(char * __restrict, const char * __restrict, size_t); #endif # 95 "/usr/include/string.h" 3 4 size_t strlen(const char *) __pure; #if __BSD_VISIBLE void strmode(int, char *); #endif # 99 "/usr/include/string.h" 3 4 char *strncat(char * __restrict, const char * __restrict, size_t); int strncmp(const char *, const char *, size_t) __pure; char *strncpy(char * __restrict, const char * __restrict, size_t); #if __POSIX_VISIBLE >= 200809 char *strndup(const char *, size_t) __malloc_like; size_t strnlen(const char *, size_t) __pure; #endif # 106 "/usr/include/string.h" 3 4 #if __BSD_VISIBLE char *strnstr(const char *, const char *, size_t) __pure; #endif # 109 "/usr/include/string.h" 3 4 char *strpbrk(const char *, const char *) __pure; char *strrchr(const char *, int) __pure; #if __BSD_VISIBLE char *strsep(char **, const char *); #endif # 114 "/usr/include/string.h" 3 4 #if __POSIX_VISIBLE >= 200809 char *strsignal(int); #endif # 117 "/usr/include/string.h" 3 4 size_t strspn(const char *, const char *) __pure; char *strstr(const char *, const char *) __pure; char *strtok(char * __restrict, const char * __restrict); #if __POSIX_VISIBLE >= 199506 || __XSI_VISIBLE >= 500 char *strtok_r(char *, const char *, char **); #endif # 123 "/usr/include/string.h" 3 4 size_t strxfrm(char * __restrict, const char * __restrict, size_t); #if __BSD_VISIBLE #ifndef _SWAB_DECLARED #define _SWAB_DECLARED #ifndef _SSIZE_T_DECLARED typedef __ssize_t ssize_t; #define _SSIZE_T_DECLARED #endif /* _SIZE_T_DECLARED */ # 133 "/usr/include/string.h" 3 4 void swab(const void * __restrict, void * __restrict, ssize_t); #endif /* _SWAB_DECLARED */ # 136 "/usr/include/string.h" 3 4 #endif /* __BSD_VISIBLE */ # 138 "/usr/include/string.h" 3 4 #if __POSIX_VISIBLE >= 200809 || defined(_XLOCALE_H_) #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 140 "/usr/include/string.h" 3 4 # 1 "/usr/include/xlocale/_string.h" 1 3 4 /*- * Copyright (c) 2011, 2012 The FreeBSD Foundation * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $FreeBSD: head/include/xlocale/_string.h 266865 2014-05-30 01:09:07Z pfg $ */ #ifndef _LOCALE_T_DEFINED #define _LOCALE_T_DEFINED typedef struct _xlocale *locale_t; #endif # 33 "/usr/include/xlocale/_string.h" 3 4 /* * This file is included from both string.h and xlocale.h. We need to expose * the declarations unconditionally if we are included from xlocale.h, but only * if we are in POSIX2008 mode if included from string.h. */ #ifndef _XLOCALE_STRING1_H #define _XLOCALE_STRING1_H /* * POSIX2008 functions */ int strcoll_l(const char *, const char *, locale_t); size_t strxfrm_l(char *, const char *, size_t, locale_t); #endif /* _XLOCALE_STRING1_H */ # 49 "/usr/include/xlocale/_string.h" 3 4 /* * xlocale extensions */ #ifdef _XLOCALE_H_ #ifndef _XLOCALE_STRING2_H #define _XLOCALE_STRING2_H char *strcasestr_l(const char *, const char *, locale_t); #endif /* _XLOCALE_STRING2_H */ # 59 "/usr/include/xlocale/_string.h" 3 4 #endif /* _XLOCALE_H_ */ # 60 "/usr/include/xlocale/_string.h" 3 4 # 141 "/usr/include/string.h" 2 3 4 #endif # 142 "/usr/include/string.h" 3 4 __END_DECLS #endif /* _STRING_H_ */ # 145 "/usr/include/string.h" 3 4 # 44 "SDL2_imageFilter.c" 2 #if 0 /* expanded by -frewrite-includes */ #include "SDL.h" #endif /* expanded by -frewrite-includes */ # 45 "SDL2_imageFilter.c" # 1 "/usr/local/include/SDL2/SDL.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file SDL.h * * Main include header for the SDL library */ /** * \mainpage Simple DirectMedia Layer (SDL) * * http://www.libsdl.org/ * * \section intro_sec Introduction * * Simple DirectMedia Layer is a cross-platform development library designed * to provide low level access to audio, keyboard, mouse, joystick, and * graphics hardware via OpenGL and Direct3D. It is used by video playback * software, emulators, and popular games including Valve's award winning * catalog and many Humble Bundle games. * * SDL officially supports Windows, Mac OS X, Linux, iOS, and Android. * Support for other platforms may be found in the source code. * * SDL is written in C, works natively with C++, and there are bindings * available for several other languages, including C# and Python. * * This library is distributed under the zlib license, which can be found * in the file "COPYING.txt". * * The best way to learn how to use SDL is to check out the header files in * the "include" subdirectory and the programs in the "test" subdirectory. * The header files and test programs are well commented and always up to date. * More documentation and FAQs are available online at: * http://wiki.libsdl.org/ * * If you need help with the library, or just want to discuss SDL related * issues, you can join the developers mailing list: * http://www.libsdl.org/mailing-list.php * * Enjoy! * Sam Lantinga (slouken@libsdl.org) */ #ifndef _SDL_H #define _SDL_H #if 0 /* expanded by -frewrite-includes */ #include "SDL_main.h" #endif /* expanded by -frewrite-includes */ # 67 "/usr/local/include/SDL2/SDL.h" # 1 "/usr/local/include/SDL2/SDL_main.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #ifndef _SDL_main_h #define _SDL_main_h #if 0 /* expanded by -frewrite-includes */ #include "SDL_stdinc.h" #endif /* expanded by -frewrite-includes */ # 25 "/usr/local/include/SDL2/SDL_main.h" # 1 "/usr/local/include/SDL2/SDL_stdinc.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file SDL_stdinc.h * * This is a general header that includes C language support. */ #ifndef _SDL_stdinc_h #define _SDL_stdinc_h #if 0 /* expanded by -frewrite-includes */ #include "SDL_config.h" #endif /* expanded by -frewrite-includes */ # 31 "/usr/local/include/SDL2/SDL_stdinc.h" # 1 "/usr/local/include/SDL2/SDL_config.h" 1 /* include/SDL_config.h. Generated from SDL_config.h.in by configure. */ /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #ifndef _SDL_config_h #define _SDL_config_h /** * \file SDL_config.h.in * * This is a set of defines to configure the SDL features */ /* General platform specific identifiers */ #if 0 /* expanded by -frewrite-includes */ #include "SDL_platform.h" #endif /* expanded by -frewrite-includes */ # 33 "/usr/local/include/SDL2/SDL_config.h" # 1 "/usr/local/include/SDL2/SDL_platform.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file SDL_platform.h * * Try to get a standard set of platform defines. */ #ifndef _SDL_platform_h #define _SDL_platform_h #if defined(_AIX) #undef __AIX__ #define __AIX__ 1 #endif # 35 "/usr/local/include/SDL2/SDL_platform.h" #if defined(__HAIKU__) #undef __HAIKU__ #define __HAIKU__ 1 #endif # 39 "/usr/local/include/SDL2/SDL_platform.h" #if defined(bsdi) || defined(__bsdi) || defined(__bsdi__) #undef __BSDI__ #define __BSDI__ 1 #endif # 43 "/usr/local/include/SDL2/SDL_platform.h" #if defined(_arch_dreamcast) #undef __DREAMCAST__ #define __DREAMCAST__ 1 #endif # 47 "/usr/local/include/SDL2/SDL_platform.h" #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) #undef __FREEBSD__ #define __FREEBSD__ 1 #endif # 51 "/usr/local/include/SDL2/SDL_platform.h" #if defined(hpux) || defined(__hpux) || defined(__hpux__) #undef __HPUX__ #define __HPUX__ 1 #endif # 55 "/usr/local/include/SDL2/SDL_platform.h" #if defined(sgi) || defined(__sgi) || defined(__sgi__) || defined(_SGI_SOURCE) #undef __IRIX__ #define __IRIX__ 1 #endif # 59 "/usr/local/include/SDL2/SDL_platform.h" #if defined(linux) || defined(__linux) || defined(__linux__) #undef __LINUX__ #define __LINUX__ 1 #endif # 63 "/usr/local/include/SDL2/SDL_platform.h" #if defined(ANDROID) || defined(__ANDROID__) #undef __ANDROID__ #undef __LINUX__ /* do we need to do this? */ #define __ANDROID__ 1 #endif # 68 "/usr/local/include/SDL2/SDL_platform.h" #if defined(__APPLE__) /* lets us know what version of Mac OS X we're compiling on */ #if 0 /* expanded by -frewrite-includes */ #include "AvailabilityMacros.h" #endif /* expanded by -frewrite-includes */ # 71 "/usr/local/include/SDL2/SDL_platform.h" # 72 "/usr/local/include/SDL2/SDL_platform.h" #if 0 /* expanded by -frewrite-includes */ #include "TargetConditionals.h" #endif /* expanded by -frewrite-includes */ # 72 "/usr/local/include/SDL2/SDL_platform.h" # 73 "/usr/local/include/SDL2/SDL_platform.h" #if TARGET_OS_IPHONE /* if compiling for iPhone */ #undef __IPHONEOS__ #define __IPHONEOS__ 1 #undef __MACOSX__ #else # 79 "/usr/local/include/SDL2/SDL_platform.h" /* if not compiling for iPhone */ #undef __MACOSX__ #define __MACOSX__ 1 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1050 # error SDL for Mac OS X only supports deploying on 10.5 and above. #endif /* MAC_OS_X_VERSION_MIN_REQUIRED < 1050 */ # 85 "/usr/local/include/SDL2/SDL_platform.h" #endif /* TARGET_OS_IPHONE */ # 86 "/usr/local/include/SDL2/SDL_platform.h" #endif /* defined(__APPLE__) */ # 87 "/usr/local/include/SDL2/SDL_platform.h" #if defined(__NetBSD__) #undef __NETBSD__ #define __NETBSD__ 1 #endif # 92 "/usr/local/include/SDL2/SDL_platform.h" #if defined(__OpenBSD__) #undef __OPENBSD__ #define __OPENBSD__ 1 #endif # 96 "/usr/local/include/SDL2/SDL_platform.h" #if defined(__OS2__) #undef __OS2__ #define __OS2__ 1 #endif # 100 "/usr/local/include/SDL2/SDL_platform.h" #if defined(osf) || defined(__osf) || defined(__osf__) || defined(_OSF_SOURCE) #undef __OSF__ #define __OSF__ 1 #endif # 104 "/usr/local/include/SDL2/SDL_platform.h" #if defined(__QNXNTO__) #undef __QNXNTO__ #define __QNXNTO__ 1 #endif # 108 "/usr/local/include/SDL2/SDL_platform.h" #if defined(riscos) || defined(__riscos) || defined(__riscos__) #undef __RISCOS__ #define __RISCOS__ 1 #endif # 112 "/usr/local/include/SDL2/SDL_platform.h" #if defined(__SVR4) #undef __SOLARIS__ #define __SOLARIS__ 1 #endif # 116 "/usr/local/include/SDL2/SDL_platform.h" #if defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) /* Try to find out if we're compiling for WinRT or non-WinRT */ /* If _USING_V110_SDK71_ is defined it means we are using the v110_xp or v120_xp toolset. */ #if defined(__MINGW32__) || (defined(_MSC_VER) && (_MSC_VER >= 1700) && !_USING_V110_SDK71_) /* _MSC_VER==1700 for MSVC 2012 */ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 121 "/usr/local/include/SDL2/SDL_platform.h" # 122 "/usr/local/include/SDL2/SDL_platform.h" #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) #undef __WINDOWS__ #define __WINDOWS__ 1 /* See if we're compiling for WinRT: */ #elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) # 127 "/usr/local/include/SDL2/SDL_platform.h" #undef __WINRT__ #define __WINRT__ 1 #endif # 130 "/usr/local/include/SDL2/SDL_platform.h" #else # 131 "/usr/local/include/SDL2/SDL_platform.h" #undef __WINDOWS__ #define __WINDOWS__ 1 #endif /* _MSC_VER < 1700 */ # 134 "/usr/local/include/SDL2/SDL_platform.h" #endif /* defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) */ # 135 "/usr/local/include/SDL2/SDL_platform.h" #if defined(__WINDOWS__) #undef __WIN32__ #define __WIN32__ 1 #endif # 140 "/usr/local/include/SDL2/SDL_platform.h" #if defined(__PSP__) #undef __PSP__ #define __PSP__ 1 #endif # 144 "/usr/local/include/SDL2/SDL_platform.h" #if 0 /* expanded by -frewrite-includes */ #include "begin_code.h" #endif /* expanded by -frewrite-includes */ # 145 "/usr/local/include/SDL2/SDL_platform.h" # 1 "/usr/local/include/SDL2/begin_code.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file begin_code.h * * This file sets things up for C dynamic library function definitions, * static inlined functions, and structures aligned at 4-byte alignment. * If you don't like ugly C preprocessor code, don't look at this file. :) */ /* This shouldn't be nested -- included it around code only. */ #ifdef _begin_code_h #error Nested inclusion of begin_code.h #endif # 34 "/usr/local/include/SDL2/begin_code.h" #define _begin_code_h #ifndef SDL_DEPRECATED # if (__GNUC__ >= 4) /* technically, this arrived in gcc 3.1, but oh well. */ # define SDL_DEPRECATED __attribute__((deprecated)) # else # 40 "/usr/local/include/SDL2/begin_code.h" # define SDL_DEPRECATED # endif # 42 "/usr/local/include/SDL2/begin_code.h" #endif # 43 "/usr/local/include/SDL2/begin_code.h" /* Some compilers use a special export keyword */ #ifndef DECLSPEC # if defined(__WIN32__) || defined(__WINRT__) # ifdef __BORLANDC__ # ifdef BUILD_SDL # define DECLSPEC # else # 51 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllimport) # endif # 53 "/usr/local/include/SDL2/begin_code.h" # else # 54 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllexport) # endif # 56 "/usr/local/include/SDL2/begin_code.h" # else # 57 "/usr/local/include/SDL2/begin_code.h" # if defined(__GNUC__) && __GNUC__ >= 4 # define DECLSPEC __attribute__ ((visibility("default"))) # elif defined(__GNUC__) && __GNUC__ >= 2 # 60 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllexport) # else # 62 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC # endif # 64 "/usr/local/include/SDL2/begin_code.h" # endif # 65 "/usr/local/include/SDL2/begin_code.h" #endif # 66 "/usr/local/include/SDL2/begin_code.h" /* By default SDL uses the C calling convention */ #ifndef SDLCALL #if (defined(__WIN32__) || defined(__WINRT__)) && !defined(__GNUC__) #define SDLCALL __cdecl #else # 72 "/usr/local/include/SDL2/begin_code.h" #define SDLCALL #endif # 74 "/usr/local/include/SDL2/begin_code.h" #endif /* SDLCALL */ # 75 "/usr/local/include/SDL2/begin_code.h" /* Removed DECLSPEC on Symbian OS because SDL cannot be a DLL in EPOC */ #ifdef __SYMBIAN32__ #undef DECLSPEC #define DECLSPEC #endif /* __SYMBIAN32__ */ # 81 "/usr/local/include/SDL2/begin_code.h" /* Force structure packing at 4 byte alignment. This is necessary if the header is included in code which has structure packing set to an alternate value, say for loading structures from disk. The packing is reset to the previous value in close_code.h */ #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__) #ifdef _MSC_VER #pragma warning(disable: 4103) #endif # 91 "/usr/local/include/SDL2/begin_code.h" #ifdef __BORLANDC__ #pragma nopackwarning #endif # 94 "/usr/local/include/SDL2/begin_code.h" #ifdef _M_X64 /* Use 8-byte alignment on 64-bit architectures, so pointers are aligned */ #pragma pack(push,8) #else # 98 "/usr/local/include/SDL2/begin_code.h" #pragma pack(push,4) #endif # 100 "/usr/local/include/SDL2/begin_code.h" #endif /* Compiler needs structure packing set */ # 101 "/usr/local/include/SDL2/begin_code.h" #ifndef SDL_INLINE #if defined(__GNUC__) #define SDL_INLINE __inline__ #elif defined(_MSC_VER) || defined(__BORLANDC__) || \ defined(__DMC__) || defined(__SC__) || \ defined(__WATCOMC__) || defined(__LCC__) || \ defined(__DECC) # 109 "/usr/local/include/SDL2/begin_code.h" #define SDL_INLINE __inline #ifndef __inline__ #define __inline__ __inline #endif # 113 "/usr/local/include/SDL2/begin_code.h" #else # 114 "/usr/local/include/SDL2/begin_code.h" #define SDL_INLINE inline #ifndef __inline__ #define __inline__ inline #endif # 118 "/usr/local/include/SDL2/begin_code.h" #endif # 119 "/usr/local/include/SDL2/begin_code.h" #endif /* SDL_INLINE not defined */ # 120 "/usr/local/include/SDL2/begin_code.h" #ifndef SDL_FORCE_INLINE #if defined(_MSC_VER) #define SDL_FORCE_INLINE __forceinline #elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) ) # 125 "/usr/local/include/SDL2/begin_code.h" #define SDL_FORCE_INLINE __attribute__((always_inline)) static __inline__ #else # 127 "/usr/local/include/SDL2/begin_code.h" #define SDL_FORCE_INLINE static SDL_INLINE #endif # 129 "/usr/local/include/SDL2/begin_code.h" #endif /* SDL_FORCE_INLINE not defined */ # 130 "/usr/local/include/SDL2/begin_code.h" /* Apparently this is needed by several Windows compilers */ #if !defined(__MACH__) #ifndef NULL #ifdef __cplusplus #define NULL 0 #else # 137 "/usr/local/include/SDL2/begin_code.h" #define NULL ((void *)0) #endif # 139 "/usr/local/include/SDL2/begin_code.h" #endif /* NULL */ # 140 "/usr/local/include/SDL2/begin_code.h" #endif /* ! Mac OS X - breaks precompiled headers */ # 141 "/usr/local/include/SDL2/begin_code.h" # 146 "/usr/local/include/SDL2/SDL_platform.h" 2 /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif # 150 "/usr/local/include/SDL2/SDL_platform.h" /** * \brief Gets the name of the platform. */ extern DECLSPEC const char * SDLCALL SDL_GetPlatform (void); /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif # 160 "/usr/local/include/SDL2/SDL_platform.h" #if 0 /* expanded by -frewrite-includes */ #include "close_code.h" #endif /* expanded by -frewrite-includes */ # 160 "/usr/local/include/SDL2/SDL_platform.h" # 1 "/usr/local/include/SDL2/close_code.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file close_code.h * * This file reverses the effects of begin_code.h and should be included * after you finish any function and structure declarations in your headers */ #undef _begin_code_h /* Reset structure packing at previous byte alignment */ #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__WATCOMC__) || defined(__BORLANDC__) #ifdef __BORLANDC__ #pragma nopackwarning #endif # 36 "/usr/local/include/SDL2/close_code.h" #pragma pack(pop) #endif /* Compiler needs structure packing set */ # 38 "/usr/local/include/SDL2/close_code.h" # 161 "/usr/local/include/SDL2/SDL_platform.h" 2 #endif /* _SDL_platform_h */ # 163 "/usr/local/include/SDL2/SDL_platform.h" /* vi: set ts=4 sw=4 expandtab: */ # 34 "/usr/local/include/SDL2/SDL_config.h" 2 /* Make sure that this isn't included by Visual C++ */ #ifdef _MSC_VER #error You should run hg revert SDL_config.h #endif # 39 "/usr/local/include/SDL2/SDL_config.h" /* C language features */ /* #undef const */ /* #undef inline */ /* #undef volatile */ /* C datatypes */ #ifdef __LP64__ #define SIZEOF_VOIDP 8 #else # 49 "/usr/local/include/SDL2/SDL_config.h" #define SIZEOF_VOIDP 4 #endif # 51 "/usr/local/include/SDL2/SDL_config.h" #define HAVE_GCC_ATOMICS 1 /* #undef HAVE_GCC_SYNC_LOCK_TEST_AND_SET */ #define HAVE_PTHREAD_SPINLOCK 1 /* Comment this if you want to build without any C library requirements */ #define HAVE_LIBC 1 #if HAVE_LIBC /* Useful headers */ /* #undef HAVE_ALLOCA_H */ #define HAVE_SYS_TYPES_H 1 #define HAVE_STDIO_H 1 #define STDC_HEADERS 1 #define HAVE_STDLIB_H 1 #define HAVE_STDARG_H 1 /* #undef HAVE_MALLOC_H */ #define HAVE_MEMORY_H 1 #define HAVE_STRING_H 1 #define HAVE_STRINGS_H 1 #define HAVE_INTTYPES_H 1 #define HAVE_STDINT_H 1 #define HAVE_CTYPE_H 1 #define HAVE_MATH_H 1 #define HAVE_ICONV_H 1 #define HAVE_SIGNAL_H 1 /* #undef HAVE_ALTIVEC_H */ #define HAVE_PTHREAD_NP_H 1 /* #undef HAVE_LIBUDEV_H */ /* #undef HAVE_DBUS_DBUS_H */ /* C library functions */ #define HAVE_MALLOC 1 #define HAVE_CALLOC 1 #define HAVE_REALLOC 1 #define HAVE_FREE 1 #define HAVE_ALLOCA 1 #ifndef __WIN32__ /* Don't use C runtime versions of these on Windows */ #define HAVE_GETENV 1 #define HAVE_SETENV 1 #define HAVE_PUTENV 1 #define HAVE_UNSETENV 1 #endif # 93 "/usr/local/include/SDL2/SDL_config.h" #define HAVE_QSORT 1 #define HAVE_ABS 1 #define HAVE_BCOPY 1 #define HAVE_MEMSET 1 #define HAVE_MEMCPY 1 #define HAVE_MEMMOVE 1 #define HAVE_MEMCMP 1 #define HAVE_STRLEN 1 #define HAVE_STRLCPY 1 #define HAVE_STRLCAT 1 #define HAVE_STRDUP 1 /* #undef HAVE__STRREV */ /* #undef HAVE__STRUPR */ /* #undef HAVE__STRLWR */ /* #undef HAVE_INDEX */ /* #undef HAVE_RINDEX */ #define HAVE_STRCHR 1 #define HAVE_STRRCHR 1 #define HAVE_STRSTR 1 /* #undef HAVE_ITOA */ /* #undef HAVE__LTOA */ /* #undef HAVE__UITOA */ /* #undef HAVE__ULTOA */ #define HAVE_STRTOL 1 #define HAVE_STRTOUL 1 /* #undef HAVE__I64TOA */ /* #undef HAVE__UI64TOA */ #define HAVE_STRTOLL 1 #define HAVE_STRTOULL 1 #define HAVE_STRTOD 1 #define HAVE_ATOI 1 #define HAVE_ATOF 1 #define HAVE_STRCMP 1 #define HAVE_STRNCMP 1 /* #undef HAVE__STRICMP */ #define HAVE_STRCASECMP 1 /* #undef HAVE__STRNICMP */ #define HAVE_STRNCASECMP 1 /* #undef HAVE_SSCANF */ #define HAVE_VSSCANF 1 /* #undef HAVE_SNPRINTF */ #define HAVE_VSNPRINTF 1 #define HAVE_M_PI /**/ #define HAVE_ATAN 1 #define HAVE_ATAN2 1 #define HAVE_ACOS 1 #define HAVE_ASIN 1 #define HAVE_CEIL 1 #define HAVE_COPYSIGN 1 #define HAVE_COS 1 #define HAVE_COSF 1 #define HAVE_FABS 1 #define HAVE_FLOOR 1 #define HAVE_LOG 1 #define HAVE_POW 1 #define HAVE_SCALBN 1 #define HAVE_SIN 1 #define HAVE_SINF 1 #define HAVE_SQRT 1 #define HAVE_FSEEKO 1 /* #undef HAVE_FSEEKO64 */ #define HAVE_SIGACTION 1 #define HAVE_SA_SIGACTION 1 #define HAVE_SETJMP 1 #define HAVE_NANOSLEEP 1 #define HAVE_SYSCONF 1 #define HAVE_SYSCTLBYNAME 1 #define HAVE_CLOCK_GETTIME 1 /* #undef HAVE_GETPAGESIZE */ #define HAVE_MPROTECT 1 #define HAVE_ICONV 1 /* #undef HAVE_PTHREAD_SETNAME_NP */ #define HAVE_PTHREAD_SET_NAME_NP 1 #define HAVE_SEM_TIMEDWAIT 1 #else # 169 "/usr/local/include/SDL2/SDL_config.h" #define HAVE_STDARG_H 1 #define HAVE_STDDEF_H 1 #define HAVE_STDINT_H 1 #endif /* HAVE_LIBC */ # 173 "/usr/local/include/SDL2/SDL_config.h" /* SDL internal assertion support */ /* #undef SDL_DEFAULT_ASSERT_LEVEL */ /* Allow disabling of core subsystems */ /* #undef SDL_ATOMIC_DISABLED */ /* #undef SDL_AUDIO_DISABLED */ /* #undef SDL_CPUINFO_DISABLED */ /* #undef SDL_EVENTS_DISABLED */ /* #undef SDL_FILE_DISABLED */ /* #undef SDL_JOYSTICK_DISABLED */ #define SDL_HAPTIC_DISABLED 1 /* #undef SDL_LOADSO_DISABLED */ /* #undef SDL_RENDER_DISABLED */ /* #undef SDL_THREADS_DISABLED */ /* #undef SDL_TIMERS_DISABLED */ /* #undef SDL_VIDEO_DISABLED */ /* #undef SDL_POWER_DISABLED */ /* #undef SDL_FILESYSTEM_DISABLED */ /* Enable various audio drivers */ /* #undef SDL_AUDIO_DRIVER_ALSA */ /* #undef SDL_AUDIO_DRIVER_ALSA_DYNAMIC */ /* #undef SDL_AUDIO_DRIVER_ARTS */ /* #undef SDL_AUDIO_DRIVER_ARTS_DYNAMIC */ /* #undef SDL_AUDIO_DRIVER_PULSEAUDIO */ /* #undef SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC */ /* #undef SDL_AUDIO_DRIVER_HAIKU */ /* #undef SDL_AUDIO_DRIVER_BSD */ /* #undef SDL_AUDIO_DRIVER_COREAUDIO */ #define SDL_AUDIO_DRIVER_DISK 1 #define SDL_AUDIO_DRIVER_DUMMY 1 /* #undef SDL_AUDIO_DRIVER_XAUDIO2 */ /* #undef SDL_AUDIO_DRIVER_DSOUND */ /* #undef SDL_AUDIO_DRIVER_ESD */ /* #undef SDL_AUDIO_DRIVER_ESD_DYNAMIC */ /* #undef SDL_AUDIO_DRIVER_NAS */ /* #undef SDL_AUDIO_DRIVER_NAS_DYNAMIC */ /* #undef SDL_AUDIO_DRIVER_SNDIO */ /* #undef SDL_AUDIO_DRIVER_SNDIO_DYNAMIC */ #define SDL_AUDIO_DRIVER_OSS 1 /* #undef SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H */ /* #undef SDL_AUDIO_DRIVER_PAUDIO */ /* #undef SDL_AUDIO_DRIVER_QSA */ /* #undef SDL_AUDIO_DRIVER_SUNAUDIO */ /* #undef SDL_AUDIO_DRIVER_WINMM */ /* #undef SDL_AUDIO_DRIVER_FUSIONSOUND */ /* #undef SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC */ /* Enable various input drivers */ /* #undef SDL_INPUT_LINUXEV */ /* #undef SDL_INPUT_LINUXKD */ /* #undef SDL_INPUT_TSLIB */ /* #undef SDL_JOYSTICK_HAIKU */ /* #undef SDL_JOYSTICK_DINPUT */ /* #undef SDL_JOYSTICK_DUMMY */ /* #undef SDL_JOYSTICK_IOKIT */ /* #undef SDL_JOYSTICK_LINUX */ /* #undef SDL_JOYSTICK_WINMM */ #define SDL_JOYSTICK_USBHID 1 /* #undef SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H */ /* #undef SDL_HAPTIC_DUMMY */ /* #undef SDL_HAPTIC_LINUX */ /* #undef SDL_HAPTIC_IOKIT */ /* #undef SDL_HAPTIC_DINPUT */ /* Enable various shared object loading systems */ /* #undef SDL_LOADSO_HAIKU */ #define SDL_LOADSO_DLOPEN 1 /* #undef SDL_LOADSO_DUMMY */ /* #undef SDL_LOADSO_LDG */ /* #undef SDL_LOADSO_WINDOWS */ /* Enable various threading systems */ #define SDL_THREAD_PTHREAD 1 #define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1 /* #undef SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP */ /* #undef SDL_THREAD_WINDOWS */ /* Enable various timer systems */ /* #undef SDL_TIMER_HAIKU */ /* #undef SDL_TIMER_DUMMY */ #define SDL_TIMER_UNIX 1 /* #undef SDL_TIMER_WINDOWS */ /* Enable various video drivers */ /* #undef SDL_VIDEO_DRIVER_HAIKU */ /* #undef SDL_VIDEO_DRIVER_COCOA */ /* #undef SDL_VIDEO_DRIVER_DIRECTFB */ /* #undef SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC */ #define SDL_VIDEO_DRIVER_DUMMY 1 /* #undef SDL_VIDEO_DRIVER_WINDOWS */ /* #undef SDL_VIDEO_DRIVER_WAYLAND */ /* #undef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */ /* #undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC */ /* #undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL */ /* #undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR */ /* #undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON */ /* #undef SDL_VIDEO_DRIVER_MIR */ /* #undef SDL_VIDEO_DRIVER_MIR_DYNAMIC */ /* #undef SDL_VIDEO_DRIVER_MIR_DYNAMIC_XKBCOMMON */ #define SDL_VIDEO_DRIVER_X11 1 /* #undef SDL_VIDEO_DRIVER_RPI */ #define SDL_VIDEO_DRIVER_X11_DYNAMIC "libX11.so.6" #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT "libXext.so.6" #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR "libXcursor.so.1" #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA "libXinerama.so.1" #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2 "libXi.so.6" #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR "libXrandr.so.2" #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS "libXss.so.1" #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE "libXxf86vm.so.1" #define SDL_VIDEO_DRIVER_X11_XCURSOR 1 #define SDL_VIDEO_DRIVER_X11_XINERAMA 1 #define SDL_VIDEO_DRIVER_X11_XINPUT2 1 #define SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH 1 #define SDL_VIDEO_DRIVER_X11_XRANDR 1 #define SDL_VIDEO_DRIVER_X11_XSCRNSAVER 1 #define SDL_VIDEO_DRIVER_X11_XSHAPE 1 #define SDL_VIDEO_DRIVER_X11_XVIDMODE 1 #define SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS 1 #define SDL_VIDEO_DRIVER_X11_CONST_PARAM_XDATA32 1 #define SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY 1 #define SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM 1 /* #undef SDL_VIDEO_RENDER_D3D */ /* #undef SDL_VIDEO_RENDER_D3D11 */ #define SDL_VIDEO_RENDER_OGL 1 /* #undef SDL_VIDEO_RENDER_OGL_ES */ /* #undef SDL_VIDEO_RENDER_OGL_ES2 */ /* #undef SDL_VIDEO_RENDER_DIRECTFB */ /* Enable OpenGL support */ #define SDL_VIDEO_OPENGL 1 /* #undef SDL_VIDEO_OPENGL_ES */ /* #undef SDL_VIDEO_OPENGL_ES2 */ /* #undef SDL_VIDEO_OPENGL_BGL */ /* #undef SDL_VIDEO_OPENGL_CGL */ /* #undef SDL_VIDEO_OPENGL_EGL */ #define SDL_VIDEO_OPENGL_GLX 1 /* #undef SDL_VIDEO_OPENGL_WGL */ /* #undef SDL_VIDEO_OPENGL_OSMESA */ /* #undef SDL_VIDEO_OPENGL_OSMESA_DYNAMIC */ /* Enable system power support */ /* #undef SDL_POWER_LINUX */ /* #undef SDL_POWER_WINDOWS */ /* #undef SDL_POWER_MACOSX */ /* #undef SDL_POWER_HAIKU */ /* #undef SDL_POWER_HARDWIRED */ /* Enable system filesystem support */ /* #undef SDL_FILESYSTEM_HAIKU */ /* #undef SDL_FILESYSTEM_COCOA */ /* #undef SDL_FILESYSTEM_DUMMY */ #define SDL_FILESYSTEM_UNIX 1 /* #undef SDL_FILESYSTEM_WINDOWS */ /* Enable assembly routines */ #define SDL_ASSEMBLY_ROUTINES 1 /* #undef SDL_ALTIVEC_BLITTERS */ #endif /* _SDL_config_h */ # 335 "/usr/local/include/SDL2/SDL_config.h" # 32 "/usr/local/include/SDL2/SDL_stdinc.h" 2 #ifdef HAVE_SYS_TYPES_H #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 34 "/usr/local/include/SDL2/SDL_stdinc.h" # 1 "/usr/include/sys/types.h" 1 3 4 /*- * Copyright (c) 1982, 1986, 1991, 1993, 1994 * The Regents of the University of California. All rights reserved. * (c) UNIX System Laboratories, Inc. * All or some portions of this file are derived from material licensed * to the University of California by American Telephone and Telegraph * Co. or Unix System Laboratories, Inc. and are reproduced herein with * the permission of UNIX System Laboratories, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)types.h 8.6 (Berkeley) 2/19/95 * $FreeBSD: head/sys/sys/types.h 280279 2015-03-20 10:27:06Z jhb $ */ #ifndef _SYS_TYPES_H_ #define _SYS_TYPES_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 41 "/usr/include/sys/types.h" 3 4 # 42 "/usr/include/sys/types.h" 3 4 /* Machine type dependent parameters. */ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 44 "/usr/include/sys/types.h" 3 4 # 1 "/usr/include/machine/endian.h" 1 3 4 /*- * This file is in the public domain. */ /* $FreeBSD: stable/10/sys/amd64/include/endian.h 232266 2012-02-28 19:39:54Z tijl $ */ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 6 "/usr/include/machine/endian.h" 3 4 # 1 "/usr/include/x86/endian.h" 1 3 4 /*- * Copyright (c) 1987, 1991 Regents of the University of California. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)endian.h 7.8 (Berkeley) 4/3/91 * $FreeBSD: stable/10/sys/x86/include/endian.h 233684 2012-03-29 23:31:48Z dim $ */ #ifndef _MACHINE_ENDIAN_H_ #define _MACHINE_ENDIAN_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 36 "/usr/include/x86/endian.h" 3 4 # 37 "/usr/include/x86/endian.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 37 "/usr/include/x86/endian.h" 3 4 # 38 "/usr/include/x86/endian.h" 3 4 /* * Define the order of 32-bit words in 64-bit words. */ #define _QUAD_HIGHWORD 1 #define _QUAD_LOWWORD 0 /* * Definitions for byte order, according to byte significance from low * address to high. */ #define _LITTLE_ENDIAN 1234 /* LSB first: i386, vax */ #define _BIG_ENDIAN 4321 /* MSB first: 68000, ibm, net */ #define _PDP_ENDIAN 3412 /* LSB first in word, MSW first in long */ #define _BYTE_ORDER _LITTLE_ENDIAN /* * Deprecated variants that don't have enough underscores to be useful in more * strict namespaces. */ #if __BSD_VISIBLE #define LITTLE_ENDIAN _LITTLE_ENDIAN #define BIG_ENDIAN _BIG_ENDIAN #define PDP_ENDIAN _PDP_ENDIAN #define BYTE_ORDER _BYTE_ORDER #endif # 65 "/usr/include/x86/endian.h" 3 4 #define __bswap16_gen(x) (__uint16_t)((x) << 8 | (x) >> 8) #define __bswap32_gen(x) \ (((__uint32_t)__bswap16((x) & 0xffff) << 16) | __bswap16((x) >> 16)) #define __bswap64_gen(x) \ (((__uint64_t)__bswap32((x) & 0xffffffff) << 32) | __bswap32((x) >> 32)) #ifdef __GNUCLIKE_BUILTIN_CONSTANT_P #define __bswap16(x) \ ((__uint16_t)(__builtin_constant_p(x) ? \ __bswap16_gen((__uint16_t)(x)) : __bswap16_var(x))) #define __bswap32(x) \ (__builtin_constant_p(x) ? \ __bswap32_gen((__uint32_t)(x)) : __bswap32_var(x)) #define __bswap64(x) \ (__builtin_constant_p(x) ? \ __bswap64_gen((__uint64_t)(x)) : __bswap64_var(x)) #else # 83 "/usr/include/x86/endian.h" 3 4 /* XXX these are broken for use in static initializers. */ #define __bswap16(x) __bswap16_var(x) #define __bswap32(x) __bswap32_var(x) #define __bswap64(x) __bswap64_var(x) #endif # 88 "/usr/include/x86/endian.h" 3 4 /* These are defined as functions to avoid multiple evaluation of x. */ static __inline __uint16_t __bswap16_var(__uint16_t _x) { return (__bswap16_gen(_x)); } static __inline __uint32_t __bswap32_var(__uint32_t _x) { #ifdef __GNUCLIKE_ASM __asm("bswap %0" : "+r" (_x)); return (_x); #else # 106 "/usr/include/x86/endian.h" 3 4 return (__bswap32_gen(_x)); #endif # 108 "/usr/include/x86/endian.h" 3 4 } static __inline __uint64_t __bswap64_var(__uint64_t _x) { #if defined(__amd64__) && defined(__GNUCLIKE_ASM) __asm("bswap %0" : "+r" (_x)); return (_x); #else # 118 "/usr/include/x86/endian.h" 3 4 /* * It is important for the optimizations that the following is not * really generic, but expands to 2 __bswap32_var()'s. */ return (__bswap64_gen(_x)); #endif # 124 "/usr/include/x86/endian.h" 3 4 } #define __htonl(x) __bswap32(x) #define __htons(x) __bswap16(x) #define __ntohl(x) __bswap32(x) #define __ntohs(x) __bswap16(x) #endif /* !_MACHINE_ENDIAN_H_ */ # 132 "/usr/include/x86/endian.h" 3 4 # 7 "/usr/include/machine/endian.h" 2 3 4 # 45 "/usr/include/sys/types.h" 2 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 45 "/usr/include/sys/types.h" 3 4 # 46 "/usr/include/sys/types.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 47 "/usr/include/sys/types.h" 3 4 # 1 "/usr/include/sys/_pthreadtypes.h" 1 3 4 /* * Copyright (c) 1993, 1994 by Chris Provenzano, proven@mit.edu * Copyright (c) 1995-1998 by John Birrell * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by Chris Provenzano. * 4. The name of Chris Provenzano may not be used to endorse or promote * products derived from this software without specific prior written * permission. * * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL CHRIS PROVENZANO BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $FreeBSD: stable/10/sys/sys/_pthreadtypes.h 189828 2009-03-14 20:10:14Z das $ */ #ifndef _SYS__PTHREADTYPES_H_ #define _SYS__PTHREADTYPES_H_ /* * Forward structure definitions. * * These are mostly opaque to the user. */ struct pthread; struct pthread_attr; struct pthread_cond; struct pthread_cond_attr; struct pthread_mutex; struct pthread_mutex_attr; struct pthread_once; struct pthread_rwlock; struct pthread_rwlockattr; struct pthread_barrier; struct pthread_barrier_attr; struct pthread_spinlock; /* * Primitive system data type definitions required by P1003.1c. * * Note that P1003.1c specifies that there are no defined comparison * or assignment operators for the types pthread_attr_t, pthread_cond_t, * pthread_condattr_t, pthread_mutex_t, pthread_mutexattr_t. */ #ifndef _PTHREAD_T_DECLARED typedef struct pthread *pthread_t; #define _PTHREAD_T_DECLARED #endif # 68 "/usr/include/sys/_pthreadtypes.h" 3 4 typedef struct pthread_attr *pthread_attr_t; typedef struct pthread_mutex *pthread_mutex_t; typedef struct pthread_mutex_attr *pthread_mutexattr_t; typedef struct pthread_cond *pthread_cond_t; typedef struct pthread_cond_attr *pthread_condattr_t; typedef int pthread_key_t; typedef struct pthread_once pthread_once_t; typedef struct pthread_rwlock *pthread_rwlock_t; typedef struct pthread_rwlockattr *pthread_rwlockattr_t; typedef struct pthread_barrier *pthread_barrier_t; typedef struct pthread_barrierattr *pthread_barrierattr_t; typedef struct pthread_spinlock *pthread_spinlock_t; /* * Additional type definitions: * * Note that P1003.1c reserves the prefixes pthread_ and PTHREAD_ for * use in header symbols. */ typedef void *pthread_addr_t; typedef void *(*pthread_startroutine_t)(void *); /* * Once definitions. */ struct pthread_once { int state; pthread_mutex_t mutex; }; #endif /* ! _SYS__PTHREADTYPES_H_ */ # 99 "/usr/include/sys/_pthreadtypes.h" 3 4 # 48 "/usr/include/sys/types.h" 2 3 4 #if __BSD_VISIBLE typedef unsigned char u_char; typedef unsigned short u_short; typedef unsigned int u_int; typedef unsigned long u_long; #ifndef _KERNEL typedef unsigned short ushort; /* Sys V compatibility */ typedef unsigned int uint; /* Sys V compatibility */ #endif # 58 "/usr/include/sys/types.h" 3 4 #endif # 59 "/usr/include/sys/types.h" 3 4 /* * XXX POSIX sized integrals that should appear only in . */ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 63 "/usr/include/sys/types.h" 3 4 # 1 "/usr/include/sys/_stdint.h" 1 3 4 /*- * Copyright (c) 2011 David E. O'Brien * Copyright (c) 2001 Mike Barcroft * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $FreeBSD: stable/10/sys/sys/_stdint.h 222813 2011-06-07 08:46:13Z attilio $ */ #ifndef _SYS__STDINT_H_ #define _SYS__STDINT_H_ #ifndef _INT8_T_DECLARED typedef __int8_t int8_t; #define _INT8_T_DECLARED #endif # 37 "/usr/include/sys/_stdint.h" 3 4 #ifndef _INT16_T_DECLARED typedef __int16_t int16_t; #define _INT16_T_DECLARED #endif # 42 "/usr/include/sys/_stdint.h" 3 4 #ifndef _INT32_T_DECLARED typedef __int32_t int32_t; #define _INT32_T_DECLARED #endif # 47 "/usr/include/sys/_stdint.h" 3 4 #ifndef _INT64_T_DECLARED typedef __int64_t int64_t; #define _INT64_T_DECLARED #endif # 52 "/usr/include/sys/_stdint.h" 3 4 #ifndef _UINT8_T_DECLARED typedef __uint8_t uint8_t; #define _UINT8_T_DECLARED #endif # 57 "/usr/include/sys/_stdint.h" 3 4 #ifndef _UINT16_T_DECLARED typedef __uint16_t uint16_t; #define _UINT16_T_DECLARED #endif # 62 "/usr/include/sys/_stdint.h" 3 4 #ifndef _UINT32_T_DECLARED typedef __uint32_t uint32_t; #define _UINT32_T_DECLARED #endif # 67 "/usr/include/sys/_stdint.h" 3 4 #ifndef _UINT64_T_DECLARED typedef __uint64_t uint64_t; #define _UINT64_T_DECLARED #endif # 72 "/usr/include/sys/_stdint.h" 3 4 #ifndef _INTPTR_T_DECLARED typedef __intptr_t intptr_t; #define _INTPTR_T_DECLARED #endif # 77 "/usr/include/sys/_stdint.h" 3 4 #ifndef _UINTPTR_T_DECLARED typedef __uintptr_t uintptr_t; #define _UINTPTR_T_DECLARED #endif # 81 "/usr/include/sys/_stdint.h" 3 4 #endif /* !_SYS__STDINT_H_ */ # 83 "/usr/include/sys/_stdint.h" 3 4 # 64 "/usr/include/sys/types.h" 2 3 4 typedef __uint8_t u_int8_t; /* unsigned integrals (deprecated) */ typedef __uint16_t u_int16_t; typedef __uint32_t u_int32_t; typedef __uint64_t u_int64_t; typedef __uint64_t u_quad_t; /* quads (deprecated) */ typedef __int64_t quad_t; typedef quad_t * qaddr_t; typedef char * caddr_t; /* core address */ typedef const char * c_caddr_t; /* core address, pointer to const */ #ifndef _BLKSIZE_T_DECLARED typedef __blksize_t blksize_t; #define _BLKSIZE_T_DECLARED #endif # 81 "/usr/include/sys/types.h" 3 4 typedef __cpuwhich_t cpuwhich_t; typedef __cpulevel_t cpulevel_t; typedef __cpusetid_t cpusetid_t; #ifndef _BLKCNT_T_DECLARED typedef __blkcnt_t blkcnt_t; #define _BLKCNT_T_DECLARED #endif # 90 "/usr/include/sys/types.h" 3 4 #ifndef _CLOCK_T_DECLARED typedef __clock_t clock_t; #define _CLOCK_T_DECLARED #endif # 95 "/usr/include/sys/types.h" 3 4 #ifndef _CLOCKID_T_DECLARED typedef __clockid_t clockid_t; #define _CLOCKID_T_DECLARED #endif # 100 "/usr/include/sys/types.h" 3 4 typedef __critical_t critical_t; /* Critical section value */ typedef __int64_t daddr_t; /* disk address */ #ifndef _DEV_T_DECLARED typedef __dev_t dev_t; /* device number or struct cdev */ #define _DEV_T_DECLARED #endif # 108 "/usr/include/sys/types.h" 3 4 #ifndef _FFLAGS_T_DECLARED typedef __fflags_t fflags_t; /* file flags */ #define _FFLAGS_T_DECLARED #endif # 113 "/usr/include/sys/types.h" 3 4 typedef __fixpt_t fixpt_t; /* fixed point number */ #ifndef _FSBLKCNT_T_DECLARED /* for statvfs() */ typedef __fsblkcnt_t fsblkcnt_t; typedef __fsfilcnt_t fsfilcnt_t; #define _FSBLKCNT_T_DECLARED #endif # 121 "/usr/include/sys/types.h" 3 4 #ifndef _GID_T_DECLARED typedef __gid_t gid_t; /* group id */ #define _GID_T_DECLARED #endif # 126 "/usr/include/sys/types.h" 3 4 #ifndef _IN_ADDR_T_DECLARED typedef __uint32_t in_addr_t; /* base type for internet address */ #define _IN_ADDR_T_DECLARED #endif # 131 "/usr/include/sys/types.h" 3 4 #ifndef _IN_PORT_T_DECLARED typedef __uint16_t in_port_t; #define _IN_PORT_T_DECLARED #endif # 136 "/usr/include/sys/types.h" 3 4 #ifndef _ID_T_DECLARED typedef __id_t id_t; /* can hold a uid_t or pid_t */ #define _ID_T_DECLARED #endif # 141 "/usr/include/sys/types.h" 3 4 #ifndef _INO_T_DECLARED typedef __ino_t ino_t; /* inode number */ #define _INO_T_DECLARED #endif # 146 "/usr/include/sys/types.h" 3 4 #ifndef _KEY_T_DECLARED typedef __key_t key_t; /* IPC key (for Sys V IPC) */ #define _KEY_T_DECLARED #endif # 151 "/usr/include/sys/types.h" 3 4 #ifndef _LWPID_T_DECLARED typedef __lwpid_t lwpid_t; /* Thread ID (a.k.a. LWP) */ #define _LWPID_T_DECLARED #endif # 156 "/usr/include/sys/types.h" 3 4 #ifndef _MODE_T_DECLARED typedef __mode_t mode_t; /* permissions */ #define _MODE_T_DECLARED #endif # 161 "/usr/include/sys/types.h" 3 4 #ifndef _ACCMODE_T_DECLARED typedef __accmode_t accmode_t; /* access permissions */ #define _ACCMODE_T_DECLARED #endif # 166 "/usr/include/sys/types.h" 3 4 #ifndef _NLINK_T_DECLARED typedef __nlink_t nlink_t; /* link count */ #define _NLINK_T_DECLARED #endif # 171 "/usr/include/sys/types.h" 3 4 #ifndef _OFF_T_DECLARED typedef __off_t off_t; /* file offset */ #define _OFF_T_DECLARED #endif # 176 "/usr/include/sys/types.h" 3 4 #ifndef _PID_T_DECLARED typedef __pid_t pid_t; /* process id */ #define _PID_T_DECLARED #endif # 181 "/usr/include/sys/types.h" 3 4 typedef __register_t register_t; #ifndef _RLIM_T_DECLARED typedef __rlim_t rlim_t; /* resource limit */ #define _RLIM_T_DECLARED #endif # 188 "/usr/include/sys/types.h" 3 4 typedef __int64_t sbintime_t; typedef __segsz_t segsz_t; /* segment size (in pages) */ #ifndef _SIZE_T_DECLARED typedef __size_t size_t; #define _SIZE_T_DECLARED #endif # 197 "/usr/include/sys/types.h" 3 4 #ifndef _SSIZE_T_DECLARED typedef __ssize_t ssize_t; #define _SSIZE_T_DECLARED #endif # 202 "/usr/include/sys/types.h" 3 4 #ifndef _SUSECONDS_T_DECLARED typedef __suseconds_t suseconds_t; /* microseconds (signed) */ #define _SUSECONDS_T_DECLARED #endif # 207 "/usr/include/sys/types.h" 3 4 #ifndef _TIME_T_DECLARED typedef __time_t time_t; #define _TIME_T_DECLARED #endif # 212 "/usr/include/sys/types.h" 3 4 #ifndef _TIMER_T_DECLARED typedef __timer_t timer_t; #define _TIMER_T_DECLARED #endif # 217 "/usr/include/sys/types.h" 3 4 #ifndef _MQD_T_DECLARED typedef __mqd_t mqd_t; #define _MQD_T_DECLARED #endif # 222 "/usr/include/sys/types.h" 3 4 typedef __u_register_t u_register_t; #ifndef _UID_T_DECLARED typedef __uid_t uid_t; /* user id */ #define _UID_T_DECLARED #endif # 229 "/usr/include/sys/types.h" 3 4 #ifndef _USECONDS_T_DECLARED typedef __useconds_t useconds_t; /* microseconds (unsigned) */ #define _USECONDS_T_DECLARED #endif # 234 "/usr/include/sys/types.h" 3 4 #ifndef _CAP_IOCTL_T_DECLARED #define _CAP_IOCTL_T_DECLARED typedef unsigned long cap_ioctl_t; #endif # 239 "/usr/include/sys/types.h" 3 4 #ifndef _CAP_RIGHTS_T_DECLARED #define _CAP_RIGHTS_T_DECLARED struct cap_rights; typedef struct cap_rights cap_rights_t; #endif # 246 "/usr/include/sys/types.h" 3 4 typedef __vm_offset_t vm_offset_t; typedef __vm_ooffset_t vm_ooffset_t; typedef __vm_paddr_t vm_paddr_t; typedef __vm_pindex_t vm_pindex_t; typedef __vm_size_t vm_size_t; #ifdef _KERNEL typedef int boolean_t; typedef struct device *device_t; typedef __intfptr_t intfptr_t; /* * XXX this is fixed width for historical reasons. It should have had type * __int_fast32_t. Fixed-width types should not be used unless binary * compatibility is essential. Least-width types should be used even less * since they provide smaller benefits. * * XXX should be MD. * * XXX this is bogus in -current, but still used for spl*(). */ typedef __uint32_t intrmask_t; /* Interrupt mask (spl, xxx_imask...) */ typedef __uintfptr_t uintfptr_t; typedef __uint64_t uoff_t; typedef char vm_memattr_t; /* memory attribute codes */ typedef struct vm_page *vm_page_t; #if !defined(__bool_true_false_are_defined) && !defined(__cplusplus) #define __bool_true_false_are_defined 1 #define false 0 #define true 1 #if __STDC_VERSION__ < 199901L && __GNUC__ < 3 && !defined(__INTEL_COMPILER) typedef int _Bool; #endif # 282 "/usr/include/sys/types.h" 3 4 typedef _Bool bool; #endif /* !__bool_true_false_are_defined && !__cplusplus */ # 284 "/usr/include/sys/types.h" 3 4 #define offsetof(type, field) __offsetof(type, field) #endif /* !_KERNEL */ # 288 "/usr/include/sys/types.h" 3 4 /* * The following are all things that really shouldn't exist in this header, * since its purpose is to provide typedefs, not miscellaneous doodads. */ #if __BSD_VISIBLE #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 295 "/usr/include/sys/types.h" 3 4 # 1 "/usr/include/sys/select.h" 1 3 4 /*- * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $FreeBSD: head/sys/sys/select.h 265051 2014-04-28 13:42:41Z emaste $ */ #ifndef _SYS_SELECT_H_ #define _SYS_SELECT_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 35 "/usr/include/sys/select.h" 3 4 # 36 "/usr/include/sys/select.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 36 "/usr/include/sys/select.h" 3 4 # 37 "/usr/include/sys/select.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 38 "/usr/include/sys/select.h" 3 4 # 1 "/usr/include/sys/_sigset.h" 1 3 4 /*- * Copyright (c) 1982, 1986, 1989, 1991, 1993 * The Regents of the University of California. All rights reserved. * (c) UNIX System Laboratories, Inc. * All or some portions of this file are derived from material licensed * to the University of California by American Telephone and Telegraph * Co. or Unix System Laboratories, Inc. and are reproduced herein with * the permission of UNIX System Laboratories, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)signal.h 8.4 (Berkeley) 5/4/95 * $FreeBSD: stable/10/sys/sys/_sigset.h 139825 2005-01-07 02:29:27Z imp $ */ #ifndef _SYS__SIGSET_H_ #define _SYS__SIGSET_H_ /* * sigset_t macros. */ #define _SIG_WORDS 4 #define _SIG_MAXSIG 128 #define _SIG_IDX(sig) ((sig) - 1) #define _SIG_WORD(sig) (_SIG_IDX(sig) >> 5) #define _SIG_BIT(sig) (1 << (_SIG_IDX(sig) & 31)) #define _SIG_VALID(sig) ((sig) <= _SIG_MAXSIG && (sig) > 0) typedef struct __sigset { __uint32_t __bits[_SIG_WORDS]; } __sigset_t; #if defined(_KERNEL) && defined(COMPAT_43) typedef unsigned int osigset_t; #endif # 58 "/usr/include/sys/_sigset.h" 3 4 #endif /* !_SYS__SIGSET_H_ */ # 60 "/usr/include/sys/_sigset.h" 3 4 # 39 "/usr/include/sys/select.h" 2 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 39 "/usr/include/sys/select.h" 3 4 # 1 "/usr/include/sys/_timeval.h" 1 3 4 /*- * Copyright (c) 2002 Mike Barcroft * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $FreeBSD: stable/10/sys/sys/_timeval.h 158471 2006-05-12 05:04:46Z jhb $ */ #ifndef _SYS__TIMEVAL_H_ #define _SYS__TIMEVAL_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 32 "/usr/include/sys/_timeval.h" 3 4 # 33 "/usr/include/sys/_timeval.h" 3 4 #ifndef _SUSECONDS_T_DECLARED typedef __suseconds_t suseconds_t; #define _SUSECONDS_T_DECLARED #endif # 38 "/usr/include/sys/_timeval.h" 3 4 #ifndef _TIME_T_DECLARED typedef __time_t time_t; #define _TIME_T_DECLARED #endif # 43 "/usr/include/sys/_timeval.h" 3 4 /* * Structure returned by gettimeofday(2) system call, and used in other calls. */ struct timeval { time_t tv_sec; /* seconds */ suseconds_t tv_usec; /* and microseconds */ }; #endif /* !_SYS__TIMEVAL_H_ */ # 53 "/usr/include/sys/_timeval.h" 3 4 # 40 "/usr/include/sys/select.h" 2 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 40 "/usr/include/sys/select.h" 3 4 # 1 "/usr/include/sys/timespec.h" 1 3 4 /*- * Copyright (c) 1982, 1986, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)time.h 8.5 (Berkeley) 5/4/95 * from: FreeBSD: src/sys/sys/time.h,v 1.43 2000/03/20 14:09:05 phk Exp * $FreeBSD: stable/10/sys/sys/timespec.h 205792 2010-03-28 13:13:22Z ed $ */ #ifndef _SYS_TIMESPEC_H_ #define _SYS_TIMESPEC_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 37 "/usr/include/sys/timespec.h" 3 4 # 38 "/usr/include/sys/timespec.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 38 "/usr/include/sys/timespec.h" 3 4 # 1 "/usr/include/sys/_timespec.h" 1 3 4 /*- * Copyright (c) 1982, 1986, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)time.h 8.5 (Berkeley) 5/4/95 * from: FreeBSD: src/sys/sys/time.h,v 1.43 2000/03/20 14:09:05 phk Exp * $FreeBSD: stable/10/sys/sys/_timespec.h 205792 2010-03-28 13:13:22Z ed $ */ #ifndef _SYS__TIMESPEC_H_ #define _SYS__TIMESPEC_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 37 "/usr/include/sys/_timespec.h" 3 4 # 38 "/usr/include/sys/_timespec.h" 3 4 #ifndef _TIME_T_DECLARED typedef __time_t time_t; #define _TIME_T_DECLARED #endif # 43 "/usr/include/sys/_timespec.h" 3 4 struct timespec { time_t tv_sec; /* seconds */ long tv_nsec; /* and nanoseconds */ }; #endif /* !_SYS__TIMESPEC_H_ */ # 50 "/usr/include/sys/_timespec.h" 3 4 # 39 "/usr/include/sys/timespec.h" 2 3 4 #if __BSD_VISIBLE #define TIMEVAL_TO_TIMESPEC(tv, ts) \ do { \ (ts)->tv_sec = (tv)->tv_sec; \ (ts)->tv_nsec = (tv)->tv_usec * 1000; \ } while (0) #define TIMESPEC_TO_TIMEVAL(tv, ts) \ do { \ (tv)->tv_sec = (ts)->tv_sec; \ (tv)->tv_usec = (ts)->tv_nsec / 1000; \ } while (0) #endif /* __BSD_VISIBLE */ # 53 "/usr/include/sys/timespec.h" 3 4 /* * Structure defined by POSIX.1b to be like a itimerval, but with * timespecs. Used in the timer_*() system calls. */ struct itimerspec { struct timespec it_interval; struct timespec it_value; }; #endif /* _SYS_TIMESPEC_H_ */ # 64 "/usr/include/sys/timespec.h" 3 4 # 41 "/usr/include/sys/select.h" 2 3 4 typedef unsigned long __fd_mask; #if __BSD_VISIBLE typedef __fd_mask fd_mask; #endif # 46 "/usr/include/sys/select.h" 3 4 #ifndef _SIGSET_T_DECLARED #define _SIGSET_T_DECLARED typedef __sigset_t sigset_t; #endif # 51 "/usr/include/sys/select.h" 3 4 /* * Select uses bit masks of file descriptors in longs. These macros * manipulate such bit fields (the filesystem macros use chars). * FD_SETSIZE may be defined by the user, but the default here should * be enough for most uses. */ #ifndef FD_SETSIZE #define FD_SETSIZE 1024 #endif # 61 "/usr/include/sys/select.h" 3 4 #define _NFDBITS (sizeof(__fd_mask) * 8) /* bits per mask */ #if __BSD_VISIBLE #define NFDBITS _NFDBITS #endif # 66 "/usr/include/sys/select.h" 3 4 #ifndef _howmany #define _howmany(x, y) (((x) + ((y) - 1)) / (y)) #endif # 70 "/usr/include/sys/select.h" 3 4 typedef struct fd_set { __fd_mask __fds_bits[_howmany(FD_SETSIZE, _NFDBITS)]; } fd_set; #if __BSD_VISIBLE #define fds_bits __fds_bits #endif # 77 "/usr/include/sys/select.h" 3 4 #define __fdset_mask(n) ((__fd_mask)1 << ((n) % _NFDBITS)) #define FD_CLR(n, p) ((p)->__fds_bits[(n)/_NFDBITS] &= ~__fdset_mask(n)) #if __BSD_VISIBLE #define FD_COPY(f, t) (void)(*(t) = *(f)) #endif # 83 "/usr/include/sys/select.h" 3 4 #define FD_ISSET(n, p) (((p)->__fds_bits[(n)/_NFDBITS] & __fdset_mask(n)) != 0) #define FD_SET(n, p) ((p)->__fds_bits[(n)/_NFDBITS] |= __fdset_mask(n)) #define FD_ZERO(p) do { \ fd_set *_p; \ __size_t _n; \ \ _p = (p); \ _n = _howmany(FD_SETSIZE, _NFDBITS); \ while (_n > 0) \ _p->__fds_bits[--_n] = 0; \ } while (0) #ifndef _KERNEL __BEGIN_DECLS int pselect(int, fd_set *__restrict, fd_set *__restrict, fd_set *__restrict, const struct timespec *__restrict, const sigset_t *__restrict); #ifndef _SELECT_DECLARED #define _SELECT_DECLARED /* XXX missing restrict type-qualifier */ int select(int, fd_set *, fd_set *, fd_set *, struct timeval *); #endif # 105 "/usr/include/sys/select.h" 3 4 __END_DECLS #endif /* !_KERNEL */ # 107 "/usr/include/sys/select.h" 3 4 #endif /* _SYS_SELECT_H_ */ # 109 "/usr/include/sys/select.h" 3 4 # 296 "/usr/include/sys/types.h" 2 3 4 #ifdef __POPCNT__ #define __bitcount64(x) __builtin_popcountll((__uint64_t)(x)) #define __bitcount32(x) __builtin_popcount((__uint32_t)(x)) #define __bitcount16(x) __builtin_popcount((__uint16_t)(x)) #define __bitcountl(x) __builtin_popcountl((unsigned long)(x)) #define __bitcount(x) __builtin_popcount((unsigned int)(x)) #else # 304 "/usr/include/sys/types.h" 3 4 /* * Population count algorithm using SWAR approach * - "SIMD Within A Register". */ static __inline __uint16_t __bitcount16(__uint16_t _x) { _x = (_x & 0x5555) + ((_x & 0xaaaa) >> 1); _x = (_x & 0x3333) + ((_x & 0xcccc) >> 2); _x = (_x + (_x >> 4)) & 0x0f0f; _x = (_x + (_x >> 8)) & 0x00ff; return (_x); } static __inline __uint32_t __bitcount32(__uint32_t _x) { _x = (_x & 0x55555555) + ((_x & 0xaaaaaaaa) >> 1); _x = (_x & 0x33333333) + ((_x & 0xcccccccc) >> 2); _x = (_x + (_x >> 4)) & 0x0f0f0f0f; _x = (_x + (_x >> 8)); _x = (_x + (_x >> 16)) & 0x000000ff; return (_x); } #ifdef __LP64__ static __inline __uint64_t __bitcount64(__uint64_t _x) { _x = (_x & 0x5555555555555555) + ((_x & 0xaaaaaaaaaaaaaaaa) >> 1); _x = (_x & 0x3333333333333333) + ((_x & 0xcccccccccccccccc) >> 2); _x = (_x + (_x >> 4)) & 0x0f0f0f0f0f0f0f0f; _x = (_x + (_x >> 8)); _x = (_x + (_x >> 16)); _x = (_x + (_x >> 32)) & 0x000000ff; return (_x); } #define __bitcountl(x) __bitcount64((unsigned long)(x)) #else # 347 "/usr/include/sys/types.h" 3 4 static __inline __uint64_t __bitcount64(__uint64_t _x) { return (__bitcount32(_x >> 32) + __bitcount32(_x)); } #define __bitcountl(x) __bitcount32((unsigned long)(x)) #endif # 356 "/usr/include/sys/types.h" 3 4 #define __bitcount(x) __bitcount32((unsigned int)(x)) #endif # 358 "/usr/include/sys/types.h" 3 4 /* * minor() gives a cookie instead of an index since we don't want to * change the meanings of bits 0-15 or waste time and space shifting * bits 16-31 for devices that don't use them. */ #define major(x) ((int)(((u_int)(x) >> 8)&0xff)) /* major number */ #define minor(x) ((int)((x)&0xffff00ff)) /* minor number */ #define makedev(x,y) ((dev_t)(((x) << 8) | (y))) /* create dev_t */ /* * These declarations belong elsewhere, but are repeated here and in * to give broken programs a better chance of working with * 64-bit off_t's. */ #ifndef _KERNEL __BEGIN_DECLS #ifndef _FTRUNCATE_DECLARED #define _FTRUNCATE_DECLARED int ftruncate(int, off_t); #endif # 379 "/usr/include/sys/types.h" 3 4 #ifndef _LSEEK_DECLARED #define _LSEEK_DECLARED off_t lseek(int, off_t, int); #endif # 383 "/usr/include/sys/types.h" 3 4 #ifndef _MMAP_DECLARED #define _MMAP_DECLARED void * mmap(void *, size_t, int, int, int, off_t); #endif # 387 "/usr/include/sys/types.h" 3 4 #ifndef _TRUNCATE_DECLARED #define _TRUNCATE_DECLARED int truncate(const char *, off_t); #endif # 391 "/usr/include/sys/types.h" 3 4 __END_DECLS #endif /* !_KERNEL */ # 393 "/usr/include/sys/types.h" 3 4 #endif /* __BSD_VISIBLE */ # 395 "/usr/include/sys/types.h" 3 4 #endif /* !_SYS_TYPES_H_ */ # 397 "/usr/include/sys/types.h" 3 4 # 35 "/usr/local/include/SDL2/SDL_stdinc.h" 2 #endif # 36 "/usr/local/include/SDL2/SDL_stdinc.h" #ifdef HAVE_STDIO_H #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 37 "/usr/local/include/SDL2/SDL_stdinc.h" # 38 "/usr/local/include/SDL2/SDL_stdinc.h" #endif # 39 "/usr/local/include/SDL2/SDL_stdinc.h" #if defined(STDC_HEADERS) #if 0 /* expanded by -frewrite-includes */ # include #endif /* expanded by -frewrite-includes */ # 40 "/usr/local/include/SDL2/SDL_stdinc.h" # 41 "/usr/local/include/SDL2/SDL_stdinc.h" #if 0 /* expanded by -frewrite-includes */ # include #endif /* expanded by -frewrite-includes */ # 41 "/usr/local/include/SDL2/SDL_stdinc.h" # 1 "/usr/include/stddef.h" 1 3 4 /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)stddef.h 8.1 (Berkeley) 6/2/93 * * $FreeBSD: head/include/stddef.h 270277 2014-08-21 15:10:10Z kan $ */ #ifndef _STDDEF_H_ #define _STDDEF_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 37 "/usr/include/stddef.h" 3 4 # 38 "/usr/include/stddef.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 38 "/usr/include/stddef.h" 3 4 # 39 "/usr/include/stddef.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 39 "/usr/include/stddef.h" 3 4 # 40 "/usr/include/stddef.h" 3 4 #ifndef _PTRDIFF_T_DECLARED typedef __ptrdiff_t ptrdiff_t; #define _PTRDIFF_T_DECLARED #endif # 45 "/usr/include/stddef.h" 3 4 #if __BSD_VISIBLE #ifndef _RUNE_T_DECLARED typedef __rune_t rune_t; #define _RUNE_T_DECLARED #endif # 51 "/usr/include/stddef.h" 3 4 #endif # 52 "/usr/include/stddef.h" 3 4 #ifndef _SIZE_T_DECLARED typedef __size_t size_t; #define _SIZE_T_DECLARED #endif # 57 "/usr/include/stddef.h" 3 4 #ifndef __cplusplus #ifndef _WCHAR_T_DECLARED typedef ___wchar_t wchar_t; #define _WCHAR_T_DECLARED #endif # 63 "/usr/include/stddef.h" 3 4 #endif # 64 "/usr/include/stddef.h" 3 4 #define offsetof(type, member) __offsetof(type, member) #endif /* _STDDEF_H_ */ # 68 "/usr/include/stddef.h" 3 4 # 42 "/usr/local/include/SDL2/SDL_stdinc.h" 2 #if 0 /* expanded by -frewrite-includes */ # include #endif /* expanded by -frewrite-includes */ # 42 "/usr/local/include/SDL2/SDL_stdinc.h" # 1 "/usr/include/stdarg.h" 1 3 4 /*- * This file is in the public domain. */ /* $FreeBSD: stable/10/sys/amd64/include/stdarg.h 232276 2012-02-28 22:30:58Z tijl $ */ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 6 "/usr/include/stdarg.h" 3 4 # 1 "/usr/include/x86/stdarg.h" 1 3 4 /*- * Copyright (c) 2002 David E. O'Brien. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $FreeBSD: stable/10/sys/x86/include/stdarg.h 256105 2013-10-07 10:01:23Z phk $ */ #ifndef _MACHINE_STDARG_H_ #define _MACHINE_STDARG_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 34 "/usr/include/x86/stdarg.h" 3 4 # 35 "/usr/include/x86/stdarg.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 35 "/usr/include/x86/stdarg.h" 3 4 # 36 "/usr/include/x86/stdarg.h" 3 4 #ifndef _VA_LIST_DECLARED #define _VA_LIST_DECLARED typedef __va_list va_list; #endif # 41 "/usr/include/x86/stdarg.h" 3 4 #ifdef __GNUCLIKE_BUILTIN_STDARG #define va_start(ap, last) \ __builtin_va_start((ap), (last)) #define va_arg(ap, type) \ __builtin_va_arg((ap), type) #define __va_copy(dest, src) \ __builtin_va_copy((dest), (src)) #if __ISO_C_VISIBLE >= 1999 #define va_copy(dest, src) \ __va_copy(dest, src) #endif # 57 "/usr/include/x86/stdarg.h" 3 4 #define va_end(ap) \ __builtin_va_end(ap) #elif defined(lint) # 62 "/usr/include/x86/stdarg.h" 3 4 /* Provide a fake implementation for lint's benefit */ #define __va_size(type) \ (((sizeof(type) + sizeof(long) - 1) / sizeof(long)) * sizeof(long)) #define va_start(ap, last) \ ((ap) = (va_list)&(last) + __va_size(last)) #define va_copy(dst, src) \ ((dst) = (src)) #define va_arg(ap, type) \ (*(type *)((ap) += __va_size(type), (ap) - __va_size(type))) #define va_end(ap) #else # 74 "/usr/include/x86/stdarg.h" 3 4 #error this file needs to be ported to your compiler #endif # 76 "/usr/include/x86/stdarg.h" 3 4 #endif /* !_MACHINE_STDARG_H_ */ # 78 "/usr/include/x86/stdarg.h" 3 4 # 7 "/usr/include/stdarg.h" 2 3 4 # 43 "/usr/local/include/SDL2/SDL_stdinc.h" 2 #else # 44 "/usr/local/include/SDL2/SDL_stdinc.h" # if defined(HAVE_STDLIB_H) #if 0 /* expanded by -frewrite-includes */ # include #endif /* expanded by -frewrite-includes */ # 45 "/usr/local/include/SDL2/SDL_stdinc.h" # 46 "/usr/local/include/SDL2/SDL_stdinc.h" # elif defined(HAVE_MALLOC_H) # 47 "/usr/local/include/SDL2/SDL_stdinc.h" #if 0 /* expanded by -frewrite-includes */ # include #endif /* expanded by -frewrite-includes */ # 47 "/usr/local/include/SDL2/SDL_stdinc.h" # 48 "/usr/local/include/SDL2/SDL_stdinc.h" # endif # 49 "/usr/local/include/SDL2/SDL_stdinc.h" # if defined(HAVE_STDDEF_H) #if 0 /* expanded by -frewrite-includes */ # include #endif /* expanded by -frewrite-includes */ # 50 "/usr/local/include/SDL2/SDL_stdinc.h" # 51 "/usr/local/include/SDL2/SDL_stdinc.h" # endif # 52 "/usr/local/include/SDL2/SDL_stdinc.h" # if defined(HAVE_STDARG_H) #if 0 /* expanded by -frewrite-includes */ # include #endif /* expanded by -frewrite-includes */ # 53 "/usr/local/include/SDL2/SDL_stdinc.h" # 54 "/usr/local/include/SDL2/SDL_stdinc.h" # endif # 55 "/usr/local/include/SDL2/SDL_stdinc.h" #endif # 56 "/usr/local/include/SDL2/SDL_stdinc.h" #ifdef HAVE_STRING_H # if !defined(STDC_HEADERS) && defined(HAVE_MEMORY_H) #if 0 /* expanded by -frewrite-includes */ # include #endif /* expanded by -frewrite-includes */ # 58 "/usr/local/include/SDL2/SDL_stdinc.h" # 59 "/usr/local/include/SDL2/SDL_stdinc.h" # endif # 60 "/usr/local/include/SDL2/SDL_stdinc.h" #if 0 /* expanded by -frewrite-includes */ # include #endif /* expanded by -frewrite-includes */ # 60 "/usr/local/include/SDL2/SDL_stdinc.h" # 61 "/usr/local/include/SDL2/SDL_stdinc.h" #endif # 62 "/usr/local/include/SDL2/SDL_stdinc.h" #ifdef HAVE_STRINGS_H #if 0 /* expanded by -frewrite-includes */ # include #endif /* expanded by -frewrite-includes */ # 63 "/usr/local/include/SDL2/SDL_stdinc.h" # 64 "/usr/local/include/SDL2/SDL_stdinc.h" #endif # 65 "/usr/local/include/SDL2/SDL_stdinc.h" #if defined(HAVE_INTTYPES_H) #if 0 /* expanded by -frewrite-includes */ # include #endif /* expanded by -frewrite-includes */ # 66 "/usr/local/include/SDL2/SDL_stdinc.h" # 1 "/usr/include/inttypes.h" 1 3 4 /*- * Copyright (c) 2001 Mike Barcroft * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $FreeBSD: head/include/inttypes.h 263998 2014-04-01 14:46:11Z tijl $ */ #ifndef _INTTYPES_H_ #define _INTTYPES_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 32 "/usr/include/inttypes.h" 3 4 # 1 "/usr/include/machine/_inttypes.h" 1 3 4 /*- * This file is in the public domain. */ /* $FreeBSD: stable/10/sys/amd64/include/_inttypes.h 217157 2011-01-08 18:09:48Z tijl $ */ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 6 "/usr/include/machine/_inttypes.h" 3 4 # 1 "/usr/include/x86/_inttypes.h" 1 3 4 /*- * Copyright (c) 2001 The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation * by Klaus Klein. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * * From: $NetBSD: int_fmtio.h,v 1.2 2001/04/26 16:25:21 kleink Exp $ * $FreeBSD: stable/10/sys/x86/include/_inttypes.h 217157 2011-01-08 18:09:48Z tijl $ */ #ifndef _MACHINE_INTTYPES_H_ #define _MACHINE_INTTYPES_H_ /* * Macros for format specifiers. */ #ifdef __LP64__ #define __PRI64 "l" #define __PRIptr "l" #else # 44 "/usr/include/x86/_inttypes.h" 3 4 #define __PRI64 "ll" #define __PRIptr #endif # 47 "/usr/include/x86/_inttypes.h" 3 4 /* fprintf(3) macros for signed integers. */ #define PRId8 "d" /* int8_t */ #define PRId16 "d" /* int16_t */ #define PRId32 "d" /* int32_t */ #define PRId64 __PRI64"d" /* int64_t */ #define PRIdLEAST8 "d" /* int_least8_t */ #define PRIdLEAST16 "d" /* int_least16_t */ #define PRIdLEAST32 "d" /* int_least32_t */ #define PRIdLEAST64 __PRI64"d" /* int_least64_t */ #define PRIdFAST8 "d" /* int_fast8_t */ #define PRIdFAST16 "d" /* int_fast16_t */ #define PRIdFAST32 "d" /* int_fast32_t */ #define PRIdFAST64 __PRI64"d" /* int_fast64_t */ #define PRIdMAX "jd" /* intmax_t */ #define PRIdPTR __PRIptr"d" /* intptr_t */ #define PRIi8 "i" /* int8_t */ #define PRIi16 "i" /* int16_t */ #define PRIi32 "i" /* int32_t */ #define PRIi64 __PRI64"i" /* int64_t */ #define PRIiLEAST8 "i" /* int_least8_t */ #define PRIiLEAST16 "i" /* int_least16_t */ #define PRIiLEAST32 "i" /* int_least32_t */ #define PRIiLEAST64 __PRI64"i" /* int_least64_t */ #define PRIiFAST8 "i" /* int_fast8_t */ #define PRIiFAST16 "i" /* int_fast16_t */ #define PRIiFAST32 "i" /* int_fast32_t */ #define PRIiFAST64 __PRI64"i" /* int_fast64_t */ #define PRIiMAX "ji" /* intmax_t */ #define PRIiPTR __PRIptr"i" /* intptr_t */ /* fprintf(3) macros for unsigned integers. */ #define PRIo8 "o" /* uint8_t */ #define PRIo16 "o" /* uint16_t */ #define PRIo32 "o" /* uint32_t */ #define PRIo64 __PRI64"o" /* uint64_t */ #define PRIoLEAST8 "o" /* uint_least8_t */ #define PRIoLEAST16 "o" /* uint_least16_t */ #define PRIoLEAST32 "o" /* uint_least32_t */ #define PRIoLEAST64 __PRI64"o" /* uint_least64_t */ #define PRIoFAST8 "o" /* uint_fast8_t */ #define PRIoFAST16 "o" /* uint_fast16_t */ #define PRIoFAST32 "o" /* uint_fast32_t */ #define PRIoFAST64 __PRI64"o" /* uint_fast64_t */ #define PRIoMAX "jo" /* uintmax_t */ #define PRIoPTR __PRIptr"o" /* uintptr_t */ #define PRIu8 "u" /* uint8_t */ #define PRIu16 "u" /* uint16_t */ #define PRIu32 "u" /* uint32_t */ #define PRIu64 __PRI64"u" /* uint64_t */ #define PRIuLEAST8 "u" /* uint_least8_t */ #define PRIuLEAST16 "u" /* uint_least16_t */ #define PRIuLEAST32 "u" /* uint_least32_t */ #define PRIuLEAST64 __PRI64"u" /* uint_least64_t */ #define PRIuFAST8 "u" /* uint_fast8_t */ #define PRIuFAST16 "u" /* uint_fast16_t */ #define PRIuFAST32 "u" /* uint_fast32_t */ #define PRIuFAST64 __PRI64"u" /* uint_fast64_t */ #define PRIuMAX "ju" /* uintmax_t */ #define PRIuPTR __PRIptr"u" /* uintptr_t */ #define PRIx8 "x" /* uint8_t */ #define PRIx16 "x" /* uint16_t */ #define PRIx32 "x" /* uint32_t */ #define PRIx64 __PRI64"x" /* uint64_t */ #define PRIxLEAST8 "x" /* uint_least8_t */ #define PRIxLEAST16 "x" /* uint_least16_t */ #define PRIxLEAST32 "x" /* uint_least32_t */ #define PRIxLEAST64 __PRI64"x" /* uint_least64_t */ #define PRIxFAST8 "x" /* uint_fast8_t */ #define PRIxFAST16 "x" /* uint_fast16_t */ #define PRIxFAST32 "x" /* uint_fast32_t */ #define PRIxFAST64 __PRI64"x" /* uint_fast64_t */ #define PRIxMAX "jx" /* uintmax_t */ #define PRIxPTR __PRIptr"x" /* uintptr_t */ #define PRIX8 "X" /* uint8_t */ #define PRIX16 "X" /* uint16_t */ #define PRIX32 "X" /* uint32_t */ #define PRIX64 __PRI64"X" /* uint64_t */ #define PRIXLEAST8 "X" /* uint_least8_t */ #define PRIXLEAST16 "X" /* uint_least16_t */ #define PRIXLEAST32 "X" /* uint_least32_t */ #define PRIXLEAST64 __PRI64"X" /* uint_least64_t */ #define PRIXFAST8 "X" /* uint_fast8_t */ #define PRIXFAST16 "X" /* uint_fast16_t */ #define PRIXFAST32 "X" /* uint_fast32_t */ #define PRIXFAST64 __PRI64"X" /* uint_fast64_t */ #define PRIXMAX "jX" /* uintmax_t */ #define PRIXPTR __PRIptr"X" /* uintptr_t */ /* fscanf(3) macros for signed integers. */ #define SCNd8 "hhd" /* int8_t */ #define SCNd16 "hd" /* int16_t */ #define SCNd32 "d" /* int32_t */ #define SCNd64 __PRI64"d" /* int64_t */ #define SCNdLEAST8 "hhd" /* int_least8_t */ #define SCNdLEAST16 "hd" /* int_least16_t */ #define SCNdLEAST32 "d" /* int_least32_t */ #define SCNdLEAST64 __PRI64"d" /* int_least64_t */ #define SCNdFAST8 "d" /* int_fast8_t */ #define SCNdFAST16 "d" /* int_fast16_t */ #define SCNdFAST32 "d" /* int_fast32_t */ #define SCNdFAST64 __PRI64"d" /* int_fast64_t */ #define SCNdMAX "jd" /* intmax_t */ #define SCNdPTR __PRIptr"d" /* intptr_t */ #define SCNi8 "hhi" /* int8_t */ #define SCNi16 "hi" /* int16_t */ #define SCNi32 "i" /* int32_t */ #define SCNi64 __PRI64"i" /* int64_t */ #define SCNiLEAST8 "hhi" /* int_least8_t */ #define SCNiLEAST16 "hi" /* int_least16_t */ #define SCNiLEAST32 "i" /* int_least32_t */ #define SCNiLEAST64 __PRI64"i" /* int_least64_t */ #define SCNiFAST8 "i" /* int_fast8_t */ #define SCNiFAST16 "i" /* int_fast16_t */ #define SCNiFAST32 "i" /* int_fast32_t */ #define SCNiFAST64 __PRI64"i" /* int_fast64_t */ #define SCNiMAX "ji" /* intmax_t */ #define SCNiPTR __PRIptr"i" /* intptr_t */ /* fscanf(3) macros for unsigned integers. */ #define SCNo8 "hho" /* uint8_t */ #define SCNo16 "ho" /* uint16_t */ #define SCNo32 "o" /* uint32_t */ #define SCNo64 __PRI64"o" /* uint64_t */ #define SCNoLEAST8 "hho" /* uint_least8_t */ #define SCNoLEAST16 "ho" /* uint_least16_t */ #define SCNoLEAST32 "o" /* uint_least32_t */ #define SCNoLEAST64 __PRI64"o" /* uint_least64_t */ #define SCNoFAST8 "o" /* uint_fast8_t */ #define SCNoFAST16 "o" /* uint_fast16_t */ #define SCNoFAST32 "o" /* uint_fast32_t */ #define SCNoFAST64 __PRI64"o" /* uint_fast64_t */ #define SCNoMAX "jo" /* uintmax_t */ #define SCNoPTR __PRIptr"o" /* uintptr_t */ #define SCNu8 "hhu" /* uint8_t */ #define SCNu16 "hu" /* uint16_t */ #define SCNu32 "u" /* uint32_t */ #define SCNu64 __PRI64"u" /* uint64_t */ #define SCNuLEAST8 "hhu" /* uint_least8_t */ #define SCNuLEAST16 "hu" /* uint_least16_t */ #define SCNuLEAST32 "u" /* uint_least32_t */ #define SCNuLEAST64 __PRI64"u" /* uint_least64_t */ #define SCNuFAST8 "u" /* uint_fast8_t */ #define SCNuFAST16 "u" /* uint_fast16_t */ #define SCNuFAST32 "u" /* uint_fast32_t */ #define SCNuFAST64 __PRI64"u" /* uint_fast64_t */ #define SCNuMAX "ju" /* uintmax_t */ #define SCNuPTR __PRIptr"u" /* uintptr_t */ #define SCNx8 "hhx" /* uint8_t */ #define SCNx16 "hx" /* uint16_t */ #define SCNx32 "x" /* uint32_t */ #define SCNx64 __PRI64"x" /* uint64_t */ #define SCNxLEAST8 "hhx" /* uint_least8_t */ #define SCNxLEAST16 "hx" /* uint_least16_t */ #define SCNxLEAST32 "x" /* uint_least32_t */ #define SCNxLEAST64 __PRI64"x" /* uint_least64_t */ #define SCNxFAST8 "x" /* uint_fast8_t */ #define SCNxFAST16 "x" /* uint_fast16_t */ #define SCNxFAST32 "x" /* uint_fast32_t */ #define SCNxFAST64 __PRI64"x" /* uint_fast64_t */ #define SCNxMAX "jx" /* uintmax_t */ #define SCNxPTR __PRIptr"x" /* uintptr_t */ #endif /* !_MACHINE_INTTYPES_H_ */ # 222 "/usr/include/x86/_inttypes.h" 3 4 # 7 "/usr/include/machine/_inttypes.h" 2 3 4 # 33 "/usr/include/inttypes.h" 2 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 33 "/usr/include/inttypes.h" 3 4 # 1 "/usr/include/sys/stdint.h" 1 3 4 /*- * Copyright (c) 2001 Mike Barcroft * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $FreeBSD: stable/10/sys/sys/stdint.h 237517 2012-06-24 04:15:58Z andrew $ */ #ifndef _SYS_STDINT_H_ #define _SYS_STDINT_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 32 "/usr/include/sys/stdint.h" 3 4 # 33 "/usr/include/sys/stdint.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 33 "/usr/include/sys/stdint.h" 3 4 # 34 "/usr/include/sys/stdint.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 35 "/usr/include/sys/stdint.h" 3 4 # 1 "/usr/include/machine/_stdint.h" 1 3 4 /*- * This file is in the public domain. */ /* $FreeBSD: stable/10/sys/amd64/include/_stdint.h 232264 2012-02-28 18:38:33Z tijl $ */ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 6 "/usr/include/machine/_stdint.h" 3 4 # 1 "/usr/include/x86/_stdint.h" 1 3 4 /*- * Copyright (c) 2001, 2002 Mike Barcroft * Copyright (c) 2001 The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation * by Klaus Klein. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the NetBSD * Foundation, Inc. and its contributors. * 4. Neither the name of The NetBSD Foundation nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: stable/10/sys/x86/include/_stdint.h 237517 2012-06-24 04:15:58Z andrew $ */ #ifndef _MACHINE__STDINT_H_ #define _MACHINE__STDINT_H_ #if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) #define INT8_C(c) (c) #define INT16_C(c) (c) #define INT32_C(c) (c) #define UINT8_C(c) (c) #define UINT16_C(c) (c) #define UINT32_C(c) (c ## U) #ifdef __LP64__ #define INT64_C(c) (c ## L) #define UINT64_C(c) (c ## UL) #else # 57 "/usr/include/x86/_stdint.h" 3 4 #define INT64_C(c) (c ## LL) #define UINT64_C(c) (c ## ULL) #endif # 60 "/usr/include/x86/_stdint.h" 3 4 #define INTMAX_C(c) INT64_C(c) #define UINTMAX_C(c) UINT64_C(c) #endif /* !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) */ # 65 "/usr/include/x86/_stdint.h" 3 4 #if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) /* * ISO/IEC 9899:1999 * 7.18.2.1 Limits of exact-width integer types */ #define INT8_MIN (-0x7f-1) #define INT16_MIN (-0x7fff-1) #define INT32_MIN (-0x7fffffff-1) #define INT8_MAX 0x7f #define INT16_MAX 0x7fff #define INT32_MAX 0x7fffffff #define UINT8_MAX 0xff #define UINT16_MAX 0xffff #define UINT32_MAX 0xffffffffU #ifdef __LP64__ #define INT64_MIN (-0x7fffffffffffffff-1) #define INT64_MAX 0x7fffffffffffffff #define UINT64_MAX 0xffffffffffffffff #else # 89 "/usr/include/x86/_stdint.h" 3 4 #define INT64_MIN (-0x7fffffffffffffffLL-1) #define INT64_MAX 0x7fffffffffffffffLL #define UINT64_MAX 0xffffffffffffffffULL #endif # 93 "/usr/include/x86/_stdint.h" 3 4 /* * ISO/IEC 9899:1999 * 7.18.2.2 Limits of minimum-width integer types */ /* Minimum values of minimum-width signed integer types. */ #define INT_LEAST8_MIN INT8_MIN #define INT_LEAST16_MIN INT16_MIN #define INT_LEAST32_MIN INT32_MIN #define INT_LEAST64_MIN INT64_MIN /* Maximum values of minimum-width signed integer types. */ #define INT_LEAST8_MAX INT8_MAX #define INT_LEAST16_MAX INT16_MAX #define INT_LEAST32_MAX INT32_MAX #define INT_LEAST64_MAX INT64_MAX /* Maximum values of minimum-width unsigned integer types. */ #define UINT_LEAST8_MAX UINT8_MAX #define UINT_LEAST16_MAX UINT16_MAX #define UINT_LEAST32_MAX UINT32_MAX #define UINT_LEAST64_MAX UINT64_MAX /* * ISO/IEC 9899:1999 * 7.18.2.3 Limits of fastest minimum-width integer types */ /* Minimum values of fastest minimum-width signed integer types. */ #define INT_FAST8_MIN INT32_MIN #define INT_FAST16_MIN INT32_MIN #define INT_FAST32_MIN INT32_MIN #define INT_FAST64_MIN INT64_MIN /* Maximum values of fastest minimum-width signed integer types. */ #define INT_FAST8_MAX INT32_MAX #define INT_FAST16_MAX INT32_MAX #define INT_FAST32_MAX INT32_MAX #define INT_FAST64_MAX INT64_MAX /* Maximum values of fastest minimum-width unsigned integer types. */ #define UINT_FAST8_MAX UINT32_MAX #define UINT_FAST16_MAX UINT32_MAX #define UINT_FAST32_MAX UINT32_MAX #define UINT_FAST64_MAX UINT64_MAX /* * ISO/IEC 9899:1999 * 7.18.2.4 Limits of integer types capable of holding object pointers */ #ifdef __LP64__ #define INTPTR_MIN INT64_MIN #define INTPTR_MAX INT64_MAX #define UINTPTR_MAX UINT64_MAX #else # 147 "/usr/include/x86/_stdint.h" 3 4 #define INTPTR_MIN INT32_MIN #define INTPTR_MAX INT32_MAX #define UINTPTR_MAX UINT32_MAX #endif # 151 "/usr/include/x86/_stdint.h" 3 4 /* * ISO/IEC 9899:1999 * 7.18.2.5 Limits of greatest-width integer types */ #define INTMAX_MIN INT64_MIN #define INTMAX_MAX INT64_MAX #define UINTMAX_MAX UINT64_MAX /* * ISO/IEC 9899:1999 * 7.18.3 Limits of other integer types */ #ifdef __LP64__ /* Limits of ptrdiff_t. */ #define PTRDIFF_MIN INT64_MIN #define PTRDIFF_MAX INT64_MAX /* Limits of sig_atomic_t. */ #define SIG_ATOMIC_MIN LONG_MIN #define SIG_ATOMIC_MAX LONG_MAX /* Limit of size_t. */ #define SIZE_MAX UINT64_MAX #else # 176 "/usr/include/x86/_stdint.h" 3 4 #define PTRDIFF_MIN INT32_MIN #define PTRDIFF_MAX INT32_MAX #define SIG_ATOMIC_MIN INT32_MIN #define SIG_ATOMIC_MAX INT32_MAX #define SIZE_MAX UINT32_MAX #endif # 182 "/usr/include/x86/_stdint.h" 3 4 /* Limits of wint_t. */ #define WINT_MIN INT32_MIN #define WINT_MAX INT32_MAX #endif /* !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) */ # 188 "/usr/include/x86/_stdint.h" 3 4 #endif /* !_MACHINE__STDINT_H_ */ # 190 "/usr/include/x86/_stdint.h" 3 4 # 7 "/usr/include/machine/_stdint.h" 2 3 4 # 36 "/usr/include/sys/stdint.h" 2 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 36 "/usr/include/sys/stdint.h" 3 4 # 37 "/usr/include/sys/stdint.h" 3 4 typedef __int_least8_t int_least8_t; typedef __int_least16_t int_least16_t; typedef __int_least32_t int_least32_t; typedef __int_least64_t int_least64_t; typedef __uint_least8_t uint_least8_t; typedef __uint_least16_t uint_least16_t; typedef __uint_least32_t uint_least32_t; typedef __uint_least64_t uint_least64_t; typedef __int_fast8_t int_fast8_t; typedef __int_fast16_t int_fast16_t; typedef __int_fast32_t int_fast32_t; typedef __int_fast64_t int_fast64_t; typedef __uint_fast8_t uint_fast8_t; typedef __uint_fast16_t uint_fast16_t; typedef __uint_fast32_t uint_fast32_t; typedef __uint_fast64_t uint_fast64_t; #ifndef _INTMAX_T_DECLARED typedef __intmax_t intmax_t; #define _INTMAX_T_DECLARED #endif # 62 "/usr/include/sys/stdint.h" 3 4 #ifndef _UINTMAX_T_DECLARED typedef __uintmax_t uintmax_t; #define _UINTMAX_T_DECLARED #endif # 66 "/usr/include/sys/stdint.h" 3 4 /* GNU and Darwin define this and people seem to think it's portable */ #if defined(UINTPTR_MAX) && defined(UINT64_MAX) && (UINTPTR_MAX == UINT64_MAX) #define __WORDSIZE 64 #else # 71 "/usr/include/sys/stdint.h" 3 4 #define __WORDSIZE 32 #endif # 73 "/usr/include/sys/stdint.h" 3 4 /* Limits of wchar_t. */ #define WCHAR_MIN __WCHAR_MIN #define WCHAR_MAX __WCHAR_MAX #endif /* !_SYS_STDINT_H_ */ # 79 "/usr/include/sys/stdint.h" 3 4 # 34 "/usr/include/inttypes.h" 2 3 4 #ifndef __cplusplus #ifndef _WCHAR_T_DECLARED typedef ___wchar_t wchar_t; #define _WCHAR_T_DECLARED #endif # 40 "/usr/include/inttypes.h" 3 4 #endif # 41 "/usr/include/inttypes.h" 3 4 typedef struct { intmax_t quot; /* Quotient. */ intmax_t rem; /* Remainder. */ } imaxdiv_t; __BEGIN_DECLS #ifdef _XLOCALE_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 49 "/usr/include/inttypes.h" 3 4 # 50 "/usr/include/inttypes.h" 3 4 #endif # 51 "/usr/include/inttypes.h" 3 4 intmax_t imaxabs(intmax_t) __pure2; imaxdiv_t imaxdiv(intmax_t, intmax_t) __pure2; intmax_t strtoimax(const char * __restrict, char ** __restrict, int); uintmax_t strtoumax(const char * __restrict, char ** __restrict, int); intmax_t wcstoimax(const wchar_t * __restrict, wchar_t ** __restrict, int); uintmax_t wcstoumax(const wchar_t * __restrict, wchar_t ** __restrict, int); __END_DECLS #endif /* !_INTTYPES_H_ */ # 63 "/usr/include/inttypes.h" 3 4 # 67 "/usr/local/include/SDL2/SDL_stdinc.h" 2 #elif defined(HAVE_STDINT_H) # 68 "/usr/local/include/SDL2/SDL_stdinc.h" #if 0 /* expanded by -frewrite-includes */ # include #endif /* expanded by -frewrite-includes */ # 68 "/usr/local/include/SDL2/SDL_stdinc.h" # 69 "/usr/local/include/SDL2/SDL_stdinc.h" #endif # 70 "/usr/local/include/SDL2/SDL_stdinc.h" #ifdef HAVE_CTYPE_H #if 0 /* expanded by -frewrite-includes */ # include #endif /* expanded by -frewrite-includes */ # 71 "/usr/local/include/SDL2/SDL_stdinc.h" # 1 "/usr/include/ctype.h" 1 3 4 /* * Copyright (c) 1989, 1993 * The Regents of the University of California. All rights reserved. * (c) UNIX System Laboratories, Inc. * All or some portions of this file are derived from material licensed * to the University of California by American Telephone and Telegraph * Co. or Unix System Laboratories, Inc. and are reproduced herein with * the permission of UNIX System Laboratories, Inc. * * This code is derived from software contributed to Berkeley by * Paul Borman at Krystal Technologies. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)ctype.h 8.4 (Berkeley) 1/21/94 * $FreeBSD: stable/10/include/ctype.h 233600 2012-03-28 12:11:54Z theraven $ */ #ifndef _CTYPE_H_ #define _CTYPE_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 44 "/usr/include/ctype.h" 3 4 # 45 "/usr/include/ctype.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 45 "/usr/include/ctype.h" 3 4 # 46 "/usr/include/ctype.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include <_ctype.h> #endif /* expanded by -frewrite-includes */ # 46 "/usr/include/ctype.h" 3 4 # 1 "/usr/include/_ctype.h" 1 3 4 /* * Copyright (c) 1989, 1993 * The Regents of the University of California. All rights reserved. * (c) UNIX System Laboratories, Inc. * All or some portions of this file are derived from material licensed * to the University of California by American Telephone and Telegraph * Co. or Unix System Laboratories, Inc. and are reproduced herein with * the permission of UNIX System Laboratories, Inc. * * This code is derived from software contributed to Berkeley by * Paul Borman at Krystal Technologies. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * From @(#)ctype.h 8.4 (Berkeley) 1/21/94 * From FreeBSD: src/include/ctype.h,v 1.27 2004/06/23 07:11:39 tjr Exp * $FreeBSD: stable/10/include/_ctype.h 203964 2010-02-16 19:39:50Z imp $ */ #ifndef __CTYPE_H_ #define __CTYPE_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 45 "/usr/include/_ctype.h" 3 4 # 46 "/usr/include/_ctype.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 46 "/usr/include/_ctype.h" 3 4 # 47 "/usr/include/_ctype.h" 3 4 #define _CTYPE_A 0x00000100L /* Alpha */ #define _CTYPE_C 0x00000200L /* Control */ #define _CTYPE_D 0x00000400L /* Digit */ #define _CTYPE_G 0x00000800L /* Graph */ #define _CTYPE_L 0x00001000L /* Lower */ #define _CTYPE_P 0x00002000L /* Punct */ #define _CTYPE_S 0x00004000L /* Space */ #define _CTYPE_U 0x00008000L /* Upper */ #define _CTYPE_X 0x00010000L /* X digit */ #define _CTYPE_B 0x00020000L /* Blank */ #define _CTYPE_R 0x00040000L /* Print */ #define _CTYPE_I 0x00080000L /* Ideogram */ #define _CTYPE_T 0x00100000L /* Special */ #define _CTYPE_Q 0x00200000L /* Phonogram */ #define _CTYPE_SW0 0x20000000L /* 0 width character */ #define _CTYPE_SW1 0x40000000L /* 1 width character */ #define _CTYPE_SW2 0x80000000L /* 2 width character */ #define _CTYPE_SW3 0xc0000000L /* 3 width character */ #define _CTYPE_SWM 0xe0000000L /* Mask for screen width data */ #define _CTYPE_SWS 30 /* Bits to shift to get width */ /* See comments in about __ct_rune_t. */ __BEGIN_DECLS unsigned long ___runetype(__ct_rune_t) __pure; __ct_rune_t ___tolower(__ct_rune_t) __pure; __ct_rune_t ___toupper(__ct_rune_t) __pure; __END_DECLS /* * _EXTERNALIZE_CTYPE_INLINES_ is defined in locale/nomacros.c to tell us * to generate code for extern versions of all our inline functions. */ #ifdef _EXTERNALIZE_CTYPE_INLINES_ #define _USE_CTYPE_INLINE_ #define static #define __inline #endif # 85 "/usr/include/_ctype.h" 3 4 extern int __mb_sb_limit; /* * Use inline functions if we are allowed to and the compiler supports them. */ #if !defined(_DONT_USE_CTYPE_INLINE_) && \ (defined(_USE_CTYPE_INLINE_) || defined(__GNUC__) || defined(__cplusplus)) #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 94 "/usr/include/_ctype.h" 3 4 # 1 "/usr/include/runetype.h" 1 3 4 /*- * Copyright (c) 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Paul Borman at Krystal Technologies. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)runetype.h 8.1 (Berkeley) 6/2/93 * $FreeBSD: stable/10/include/runetype.h 232620 2012-03-06 20:15:23Z dim $ */ #ifndef _RUNETYPE_H_ #define _RUNETYPE_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 39 "/usr/include/runetype.h" 3 4 # 40 "/usr/include/runetype.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 40 "/usr/include/runetype.h" 3 4 # 41 "/usr/include/runetype.h" 3 4 #define _CACHED_RUNES (1 <<8 ) /* Must be a power of 2 */ #define _CRMASK (~(_CACHED_RUNES - 1)) /* * The lower 8 bits of runetype[] contain the digit value of the rune. */ typedef struct { __rune_t __min; /* First rune of the range */ __rune_t __max; /* Last rune (inclusive) of the range */ __rune_t __map; /* What first maps to in maps */ unsigned long *__types; /* Array of types in range */ } _RuneEntry; typedef struct { int __nranges; /* Number of ranges stored */ _RuneEntry *__ranges; /* Pointer to the ranges */ } _RuneRange; typedef struct { char __magic[8]; /* Magic saying what version we are */ char __encoding[32]; /* ASCII name of this encoding */ __rune_t (*__sgetrune)(const char *, __size_t, char const **); int (*__sputrune)(__rune_t, char *, __size_t, char **); __rune_t __invalid_rune; unsigned long __runetype[_CACHED_RUNES]; __rune_t __maplower[_CACHED_RUNES]; __rune_t __mapupper[_CACHED_RUNES]; /* * The following are to deal with Runes larger than _CACHED_RUNES - 1. * Their data is actually contiguous with this structure so as to make * it easier to read/write from/to disk. */ _RuneRange __runetype_ext; _RuneRange __maplower_ext; _RuneRange __mapupper_ext; void *__variable; /* Data which depends on the encoding */ int __variable_len; /* how long that data is */ } _RuneLocale; #define _RUNE_MAGIC_1 "RuneMagi" /* Indicates version 0 of RuneLocale */ __BEGIN_DECLS extern const _RuneLocale _DefaultRuneLocale; extern const _RuneLocale *_CurrentRuneLocale; #if defined(__NO_TLS) || defined(__RUNETYPE_INTERNAL) extern const _RuneLocale *__getCurrentRuneLocale(void); #else # 92 "/usr/include/runetype.h" 3 4 extern _Thread_local const _RuneLocale *_ThreadRuneLocale; static __inline const _RuneLocale *__getCurrentRuneLocale(void) { if (_ThreadRuneLocale) return _ThreadRuneLocale; if (_CurrentRuneLocale) return _CurrentRuneLocale; return &_DefaultRuneLocale; } #endif /* __NO_TLS || __RUNETYPE_INTERNAL */ # 103 "/usr/include/runetype.h" 3 4 #define _CurrentRuneLocale (__getCurrentRuneLocale()) __END_DECLS #endif /* !_RUNETYPE_H_ */ # 107 "/usr/include/runetype.h" 3 4 # 95 "/usr/include/_ctype.h" 2 3 4 static __inline int __maskrune(__ct_rune_t _c, unsigned long _f) { return ((_c < 0 || _c >= _CACHED_RUNES) ? ___runetype(_c) : _CurrentRuneLocale->__runetype[_c]) & _f; } static __inline int __sbmaskrune(__ct_rune_t _c, unsigned long _f) { return (_c < 0 || _c >= __mb_sb_limit) ? 0 : _CurrentRuneLocale->__runetype[_c] & _f; } static __inline int __istype(__ct_rune_t _c, unsigned long _f) { return (!!__maskrune(_c, _f)); } static __inline int __sbistype(__ct_rune_t _c, unsigned long _f) { return (!!__sbmaskrune(_c, _f)); } static __inline int __isctype(__ct_rune_t _c, unsigned long _f) { return (_c < 0 || _c >= 128) ? 0 : !!(_DefaultRuneLocale.__runetype[_c] & _f); } static __inline __ct_rune_t __toupper(__ct_rune_t _c) { return (_c < 0 || _c >= _CACHED_RUNES) ? ___toupper(_c) : _CurrentRuneLocale->__mapupper[_c]; } static __inline __ct_rune_t __sbtoupper(__ct_rune_t _c) { return (_c < 0 || _c >= __mb_sb_limit) ? _c : _CurrentRuneLocale->__mapupper[_c]; } static __inline __ct_rune_t __tolower(__ct_rune_t _c) { return (_c < 0 || _c >= _CACHED_RUNES) ? ___tolower(_c) : _CurrentRuneLocale->__maplower[_c]; } static __inline __ct_rune_t __sbtolower(__ct_rune_t _c) { return (_c < 0 || _c >= __mb_sb_limit) ? _c : _CurrentRuneLocale->__maplower[_c]; } static __inline int __wcwidth(__ct_rune_t _c) { unsigned int _x; if (_c == 0) return (0); _x = (unsigned int)__maskrune(_c, _CTYPE_SWM|_CTYPE_R); if ((_x & _CTYPE_SWM) != 0) return ((_x & _CTYPE_SWM) >> _CTYPE_SWS); return ((_x & _CTYPE_R) != 0 ? 1 : -1); } #else /* not using inlines */ # 171 "/usr/include/_ctype.h" 3 4 __BEGIN_DECLS int __maskrune(__ct_rune_t, unsigned long); int __sbmaskrune(__ct_rune_t, unsigned long); int __istype(__ct_rune_t, unsigned long); int __sbistype(__ct_rune_t, unsigned long); int __isctype(__ct_rune_t, unsigned long); __ct_rune_t __toupper(__ct_rune_t); __ct_rune_t __sbtoupper(__ct_rune_t); __ct_rune_t __tolower(__ct_rune_t); __ct_rune_t __sbtolower(__ct_rune_t); int __wcwidth(__ct_rune_t); __END_DECLS #endif /* using inlines */ # 185 "/usr/include/_ctype.h" 3 4 #endif /* !__CTYPE_H_ */ # 187 "/usr/include/_ctype.h" 3 4 # 47 "/usr/include/ctype.h" 2 3 4 __BEGIN_DECLS int isalnum(int); int isalpha(int); int iscntrl(int); int isdigit(int); int isgraph(int); int islower(int); int isprint(int); int ispunct(int); int isspace(int); int isupper(int); int isxdigit(int); int tolower(int); int toupper(int); #if __XSI_VISIBLE int isascii(int); int toascii(int); #endif # 67 "/usr/include/ctype.h" 3 4 #if __ISO_C_VISIBLE >= 1999 int isblank(int); #endif # 71 "/usr/include/ctype.h" 3 4 #if __BSD_VISIBLE int digittoint(int); int ishexnumber(int); int isideogram(int); int isnumber(int); int isphonogram(int); int isrune(int); int isspecial(int); #endif # 81 "/usr/include/ctype.h" 3 4 #if __POSIX_VISIBLE >= 200809 || defined(_XLOCALE_H_) #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 83 "/usr/include/ctype.h" 3 4 # 1 "/usr/include/xlocale/_ctype.h" 1 3 4 /*- * Copyright (c) 2011 The FreeBSD Foundation * All rights reserved. * * This software was developed by David Chisnall under sponsorship from * the FreeBSD Foundation. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $FreeBSD: stable/10/include/xlocale/_ctype.h 243032 2012-11-14 17:44:37Z demon $ */ #if (defined(_XLOCALE_WCTYPES) && !defined(_XLOCALE_WCTYPE_H)) || \ (!defined(_XLOCALE_WCTYPES) && !defined(_XLOCALE_CTYPE_H)) #ifdef _XLOCALE_WCTYPES #define _XLOCALE_WCTYPE_H #else # 39 "/usr/include/xlocale/_ctype.h" 3 4 #define _XLOCALE_CTYPE_H #endif # 41 "/usr/include/xlocale/_ctype.h" 3 4 #ifndef _LOCALE_T_DEFINED #define _LOCALE_T_DEFINED typedef struct _xlocale *locale_t; #endif # 46 "/usr/include/xlocale/_ctype.h" 3 4 #ifndef _XLOCALE_RUN_FUNCTIONS_DEFINED #define _XLOCALE_RUN_FUNCTIONS_DEFINED 1 unsigned long ___runetype_l(__ct_rune_t, locale_t) __pure; __ct_rune_t ___tolower_l(__ct_rune_t, locale_t) __pure; __ct_rune_t ___toupper_l(__ct_rune_t, locale_t) __pure; _RuneLocale *__runes_for_locale(locale_t, int*); #endif # 54 "/usr/include/xlocale/_ctype.h" 3 4 #ifndef _XLOCALE_INLINE #if defined(__GNUC__) && !defined(__GNUC_STDC_INLINE__) /* GNU89 inline has nonstandard semantics. */ #define _XLOCALE_INLINE extern __inline #else # 60 "/usr/include/xlocale/_ctype.h" 3 4 /* Hack to work around people who define inline away */ #ifdef inline #define _XLOCALE_INLINE static __inline #else # 64 "/usr/include/xlocale/_ctype.h" 3 4 /* Define with C++ / C99 compatible semantics */ #define _XLOCALE_INLINE inline #endif # 67 "/usr/include/xlocale/_ctype.h" 3 4 #endif # 68 "/usr/include/xlocale/_ctype.h" 3 4 #endif /* _XLOCALE_INLINE */ # 69 "/usr/include/xlocale/_ctype.h" 3 4 #ifdef _XLOCALE_WCTYPES _XLOCALE_INLINE int __maskrune_l(__ct_rune_t __c, unsigned long __f, locale_t __loc); _XLOCALE_INLINE int __istype_l(__ct_rune_t __c, unsigned long __f, locale_t __loc); _XLOCALE_INLINE int __maskrune_l(__ct_rune_t __c, unsigned long __f, locale_t __loc) { int __limit; _RuneLocale *runes = __runes_for_locale(__loc, &__limit); return ((__c < 0 || __c >= _CACHED_RUNES) ? ___runetype_l(__c, __loc) : runes->__runetype[__c]) & __f; } _XLOCALE_INLINE int __istype_l(__ct_rune_t __c, unsigned long __f, locale_t __loc) { return (!!__maskrune_l(__c, __f, __loc)); } #define XLOCALE_ISCTYPE(fname, cat) \ _XLOCALE_INLINE int isw##fname##_l(int, locale_t);\ _XLOCALE_INLINE int isw##fname##_l(int __c, locale_t __l)\ { return __istype_l(__c, cat, __l); } #else # 96 "/usr/include/xlocale/_ctype.h" 3 4 _XLOCALE_INLINE int __sbmaskrune_l(__ct_rune_t __c, unsigned long __f, locale_t __loc); _XLOCALE_INLINE int __sbistype_l(__ct_rune_t __c, unsigned long __f, locale_t __loc); _XLOCALE_INLINE int __sbmaskrune_l(__ct_rune_t __c, unsigned long __f, locale_t __loc) { int __limit; _RuneLocale *runes = __runes_for_locale(__loc, &__limit); return (__c < 0 || __c >= __limit) ? 0 : runes->__runetype[__c] & __f; } _XLOCALE_INLINE int __sbistype_l(__ct_rune_t __c, unsigned long __f, locale_t __loc) { return (!!__sbmaskrune_l(__c, __f, __loc)); } #define XLOCALE_ISCTYPE(__fname, __cat) \ _XLOCALE_INLINE int is##__fname##_l(int, locale_t); \ _XLOCALE_INLINE int is##__fname##_l(int __c, locale_t __l)\ { return __sbistype_l(__c, __cat, __l); } #endif # 121 "/usr/include/xlocale/_ctype.h" 3 4 XLOCALE_ISCTYPE(alnum, _CTYPE_A|_CTYPE_D) XLOCALE_ISCTYPE(alpha, _CTYPE_A) XLOCALE_ISCTYPE(blank, _CTYPE_B) XLOCALE_ISCTYPE(cntrl, _CTYPE_C) XLOCALE_ISCTYPE(digit, _CTYPE_D) XLOCALE_ISCTYPE(graph, _CTYPE_G) XLOCALE_ISCTYPE(hexnumber, _CTYPE_X) XLOCALE_ISCTYPE(ideogram, _CTYPE_I) XLOCALE_ISCTYPE(lower, _CTYPE_L) XLOCALE_ISCTYPE(number, _CTYPE_D) XLOCALE_ISCTYPE(phonogram, _CTYPE_Q) XLOCALE_ISCTYPE(print, _CTYPE_R) XLOCALE_ISCTYPE(punct, _CTYPE_P) XLOCALE_ISCTYPE(rune, 0xFFFFFF00L) XLOCALE_ISCTYPE(space, _CTYPE_S) XLOCALE_ISCTYPE(special, _CTYPE_T) XLOCALE_ISCTYPE(upper, _CTYPE_U) XLOCALE_ISCTYPE(xdigit, _CTYPE_X) #undef XLOCALE_ISCTYPE #ifdef _XLOCALE_WCTYPES _XLOCALE_INLINE int towlower_l(int, locale_t); _XLOCALE_INLINE int __wcwidth_l(__ct_rune_t, locale_t); _XLOCALE_INLINE int towupper_l(int, locale_t); _XLOCALE_INLINE int towlower_l(int __c, locale_t __l) { int __limit; _RuneLocale *__runes = __runes_for_locale(__l, &__limit); return (__c < 0 || __c >= _CACHED_RUNES) ? ___tolower_l(__c, __l) : __runes->__maplower[__c]; } _XLOCALE_INLINE int towupper_l(int __c, locale_t __l) { int __limit; _RuneLocale *__runes = __runes_for_locale(__l, &__limit); return (__c < 0 || __c >= _CACHED_RUNES) ? ___toupper_l(__c, __l) : __runes->__mapupper[__c]; } _XLOCALE_INLINE int __wcwidth_l(__ct_rune_t _c, locale_t __l) { unsigned int _x; if (_c == 0) return (0); _x = (unsigned int)__maskrune_l(_c, _CTYPE_SWM|_CTYPE_R, __l); if ((_x & _CTYPE_SWM) != 0) return ((_x & _CTYPE_SWM) >> _CTYPE_SWS); return ((_x & _CTYPE_R) != 0 ? 1 : -1); } int iswctype_l(wint_t __wc, wctype_t __charclass, locale_t __l); wctype_t wctype_l(const char *property, locale_t __l); wint_t towctrans_l(wint_t __wc, wctrans_t desc, locale_t __l); wint_t nextwctype_l(wint_t __wc, wctype_t wct, locale_t __l); wctrans_t wctrans_l(const char *__charclass, locale_t __l); #undef _XLOCALE_WCTYPES #else # 180 "/usr/include/xlocale/_ctype.h" 3 4 _XLOCALE_INLINE int digittoint_l(int, locale_t); _XLOCALE_INLINE int tolower_l(int, locale_t); _XLOCALE_INLINE int toupper_l(int, locale_t); _XLOCALE_INLINE int digittoint_l(int __c, locale_t __l) { return __sbmaskrune_l((__c), 0xFF, __l); } _XLOCALE_INLINE int tolower_l(int __c, locale_t __l) { int __limit; _RuneLocale *__runes = __runes_for_locale(__l, &__limit); return (__c < 0 || __c >= __limit) ? __c : __runes->__maplower[__c]; } _XLOCALE_INLINE int toupper_l(int __c, locale_t __l) { int __limit; _RuneLocale *__runes = __runes_for_locale(__l, &__limit); return (__c < 0 || __c >= __limit) ? __c : __runes->__mapupper[__c]; } #endif # 202 "/usr/include/xlocale/_ctype.h" 3 4 #endif /* (defined(_XLOCALE_WCTYPES) && !defined(_XLOCALE_WCTYPE_H)) || \ (!defined(_XLOCALE_WCTYPES) && !defined(_XLOCALE_CTYPE_H)) */ # 204 "/usr/include/xlocale/_ctype.h" 3 4 # 84 "/usr/include/ctype.h" 2 3 4 #endif # 85 "/usr/include/ctype.h" 3 4 __END_DECLS #ifndef __cplusplus #define isalnum(c) __sbistype((c), _CTYPE_A|_CTYPE_D) #define isalpha(c) __sbistype((c), _CTYPE_A) #define iscntrl(c) __sbistype((c), _CTYPE_C) #define isdigit(c) __isctype((c), _CTYPE_D) /* ANSI -- locale independent */ #define isgraph(c) __sbistype((c), _CTYPE_G) #define islower(c) __sbistype((c), _CTYPE_L) #define isprint(c) __sbistype((c), _CTYPE_R) #define ispunct(c) __sbistype((c), _CTYPE_P) #define isspace(c) __sbistype((c), _CTYPE_S) #define isupper(c) __sbistype((c), _CTYPE_U) #define isxdigit(c) __isctype((c), _CTYPE_X) /* ANSI -- locale independent */ #define tolower(c) __sbtolower(c) #define toupper(c) __sbtoupper(c) #endif /* !__cplusplus */ # 102 "/usr/include/ctype.h" 3 4 #if __XSI_VISIBLE /* * POSIX.1-2001 specifies _tolower() and _toupper() to be macros equivalent to * tolower() and toupper() respectively, minus extra checking to ensure that * the argument is a lower or uppercase letter respectively. We've chosen to * implement these macros with the same error checking as tolower() and * toupper() since this doesn't violate the specification itself, only its * intent. We purposely leave _tolower() and _toupper() undocumented to * discourage their use. * * XXX isascii() and toascii() should similarly be undocumented. */ #define _tolower(c) __sbtolower(c) #define _toupper(c) __sbtoupper(c) #define isascii(c) (((c) & ~0x7F) == 0) #define toascii(c) ((c) & 0x7F) #endif # 120 "/usr/include/ctype.h" 3 4 #if __ISO_C_VISIBLE >= 1999 && !defined(__cplusplus) #define isblank(c) __sbistype((c), _CTYPE_B) #endif # 124 "/usr/include/ctype.h" 3 4 #if __BSD_VISIBLE #define digittoint(c) __sbmaskrune((c), 0xFF) #define ishexnumber(c) __sbistype((c), _CTYPE_X) #define isideogram(c) __sbistype((c), _CTYPE_I) #define isnumber(c) __sbistype((c), _CTYPE_D) #define isphonogram(c) __sbistype((c), _CTYPE_Q) #define isrune(c) __sbistype((c), 0xFFFFFF00L) #define isspecial(c) __sbistype((c), _CTYPE_T) #endif # 134 "/usr/include/ctype.h" 3 4 #endif /* !_CTYPE_H_ */ # 136 "/usr/include/ctype.h" 3 4 # 72 "/usr/local/include/SDL2/SDL_stdinc.h" 2 #endif # 73 "/usr/local/include/SDL2/SDL_stdinc.h" #ifdef HAVE_MATH_H # if defined(__WINRT__) /* Defining _USE_MATH_DEFINES is required to get M_PI to be defined on WinRT. See http://msdn.microsoft.com/en-us/library/4hwaceh6.aspx for more information. */ # define _USE_MATH_DEFINES # endif # 81 "/usr/local/include/SDL2/SDL_stdinc.h" #if 0 /* expanded by -frewrite-includes */ # include #endif /* expanded by -frewrite-includes */ # 81 "/usr/local/include/SDL2/SDL_stdinc.h" # 1 "/usr/include/math.h" 1 3 4 /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this * software is freely granted, provided that this notice * is preserved. * ==================================================== */ /* * from: @(#)fdlibm.h 5.1 93/09/24 * $FreeBSD: head/lib/msun/src/math.h 271651 2014-09-15 23:21:57Z kargl $ */ #ifndef _MATH_H_ #define _MATH_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 20 "/usr/include/math.h" 3 4 # 21 "/usr/include/math.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 21 "/usr/include/math.h" 3 4 # 22 "/usr/include/math.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 22 "/usr/include/math.h" 3 4 # 1 "/usr/include/machine/_limits.h" 1 3 4 /*- * This file is in the public domain. */ /* $FreeBSD: stable/10/sys/amd64/include/_limits.h 232262 2012-02-28 18:24:28Z tijl $ */ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 6 "/usr/include/machine/_limits.h" 3 4 # 1 "/usr/include/x86/_limits.h" 1 3 4 /*- * Copyright (c) 1988, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)limits.h 8.3 (Berkeley) 1/4/94 * $FreeBSD: stable/10/sys/x86/include/_limits.h 235939 2012-05-24 21:44:46Z obrien $ */ #ifndef _MACHINE__LIMITS_H_ #define _MACHINE__LIMITS_H_ /* * According to ANSI (section 2.2.4.2), the values below must be usable by * #if preprocessing directives. Additionally, the expression must have the * same type as would an expression that is an object of the corresponding * type converted according to the integral promotions. The subtraction for * INT_MIN, etc., is so the value is not unsigned; e.g., 0x80000000 is an * unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2). */ #define __CHAR_BIT 8 /* number of bits in a char */ #define __SCHAR_MAX 0x7f /* max value for a signed char */ #define __SCHAR_MIN (-0x7f - 1) /* min value for a signed char */ #define __UCHAR_MAX 0xff /* max value for an unsigned char */ #define __USHRT_MAX 0xffff /* max value for an unsigned short */ #define __SHRT_MAX 0x7fff /* max value for a short */ #define __SHRT_MIN (-0x7fff - 1) /* min value for a short */ #define __UINT_MAX 0xffffffff /* max value for an unsigned int */ #define __INT_MAX 0x7fffffff /* max value for an int */ #define __INT_MIN (-0x7fffffff - 1) /* min value for an int */ #ifdef __LP64__ #define __ULONG_MAX 0xffffffffffffffff /* max for an unsigned long */ #define __LONG_MAX 0x7fffffffffffffff /* max for a long */ #define __LONG_MIN (-0x7fffffffffffffff - 1) /* min for a long */ #else # 65 "/usr/include/x86/_limits.h" 3 4 #define __ULONG_MAX 0xffffffffUL #define __LONG_MAX 0x7fffffffL #define __LONG_MIN (-0x7fffffffL - 1) #endif # 69 "/usr/include/x86/_limits.h" 3 4 /* max value for an unsigned long long */ #define __ULLONG_MAX 0xffffffffffffffffULL #define __LLONG_MAX 0x7fffffffffffffffLL /* max value for a long long */ #define __LLONG_MIN (-0x7fffffffffffffffLL - 1) /* min for a long long */ #ifdef __LP64__ #define __SSIZE_MAX __LONG_MAX /* max value for a ssize_t */ #define __SIZE_T_MAX __ULONG_MAX /* max value for a size_t */ #define __OFF_MAX __LONG_MAX /* max value for an off_t */ #define __OFF_MIN __LONG_MIN /* min value for an off_t */ /* Quads and longs are the same on the amd64. Ensure they stay in sync. */ #define __UQUAD_MAX __ULONG_MAX /* max value for a uquad_t */ #define __QUAD_MAX __LONG_MAX /* max value for a quad_t */ #define __QUAD_MIN __LONG_MIN /* min value for a quad_t */ #define __LONG_BIT 64 #else # 86 "/usr/include/x86/_limits.h" 3 4 #define __SSIZE_MAX __INT_MAX #define __SIZE_T_MAX __UINT_MAX #define __OFF_MAX __LLONG_MAX #define __OFF_MIN __LLONG_MIN #define __UQUAD_MAX __ULLONG_MAX #define __QUAD_MAX __LLONG_MAX #define __QUAD_MIN __LLONG_MIN #define __LONG_BIT 32 #endif # 95 "/usr/include/x86/_limits.h" 3 4 #define __WORD_BIT 32 /* Minimum signal stack size. */ #define __MINSIGSTKSZ (512 * 4) #endif /* !_MACHINE__LIMITS_H_ */ # 102 "/usr/include/x86/_limits.h" 3 4 # 7 "/usr/include/machine/_limits.h" 2 3 4 # 23 "/usr/include/math.h" 2 3 4 /* * ANSI/POSIX */ extern const union __infinity_un { unsigned char __uc[8]; double __ud; } __infinity; extern const union __nan_un { unsigned char __uc[sizeof(float)]; float __uf; } __nan; #if __GNUC_PREREQ__(3, 3) || (defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 800) #define __MATH_BUILTIN_CONSTANTS #endif # 40 "/usr/include/math.h" 3 4 #if __GNUC_PREREQ__(3, 0) && !defined(__INTEL_COMPILER) #define __MATH_BUILTIN_RELOPS #endif # 44 "/usr/include/math.h" 3 4 #ifdef __MATH_BUILTIN_CONSTANTS #define HUGE_VAL __builtin_huge_val() #else # 48 "/usr/include/math.h" 3 4 #define HUGE_VAL (__infinity.__ud) #endif # 50 "/usr/include/math.h" 3 4 #if __ISO_C_VISIBLE >= 1999 #define FP_ILOGB0 (-__INT_MAX) #define FP_ILOGBNAN __INT_MAX #ifdef __MATH_BUILTIN_CONSTANTS #define HUGE_VALF __builtin_huge_valf() #define HUGE_VALL __builtin_huge_vall() #define INFINITY __builtin_inff() #define NAN __builtin_nanf("") #else # 61 "/usr/include/math.h" 3 4 #define HUGE_VALF (float)HUGE_VAL #define HUGE_VALL (long double)HUGE_VAL #define INFINITY HUGE_VALF #define NAN (__nan.__uf) #endif /* __MATH_BUILTIN_CONSTANTS */ # 66 "/usr/include/math.h" 3 4 #define MATH_ERRNO 1 #define MATH_ERREXCEPT 2 #define math_errhandling MATH_ERREXCEPT #define FP_FAST_FMAF 1 /* Symbolic constants to classify floating point numbers. */ #define FP_INFINITE 0x01 #define FP_NAN 0x02 #define FP_NORMAL 0x04 #define FP_SUBNORMAL 0x08 #define FP_ZERO 0x10 #if (__STDC_VERSION__ >= 201112L && defined(__clang__)) || \ __has_extension(c_generic_selections) #define __fp_type_select(x, f, d, ld) _Generic((x), \ float: f(x), \ double: d(x), \ long double: ld(x), \ volatile float: f(x), \ volatile double: d(x), \ volatile long double: ld(x), \ volatile const float: f(x), \ volatile const double: d(x), \ volatile const long double: ld(x), \ const float: f(x), \ const double: d(x), \ const long double: ld(x)) #elif __GNUC_PREREQ__(3, 1) && !defined(__cplusplus) # 96 "/usr/include/math.h" 3 4 #define __fp_type_select(x, f, d, ld) __builtin_choose_expr( \ __builtin_types_compatible_p(__typeof(x), long double), ld(x), \ __builtin_choose_expr( \ __builtin_types_compatible_p(__typeof(x), double), d(x), \ __builtin_choose_expr( \ __builtin_types_compatible_p(__typeof(x), float), f(x), (void)0))) #else # 103 "/usr/include/math.h" 3 4 #define __fp_type_select(x, f, d, ld) \ ((sizeof(x) == sizeof(float)) ? f(x) \ : (sizeof(x) == sizeof(double)) ? d(x) \ : ld(x)) #endif # 108 "/usr/include/math.h" 3 4 #define fpclassify(x) \ __fp_type_select(x, __fpclassifyf, __fpclassifyd, __fpclassifyl) #define isfinite(x) __fp_type_select(x, __isfinitef, __isfinite, __isfinitel) #define isinf(x) __fp_type_select(x, __isinff, __isinf, __isinfl) #define isnan(x) \ __fp_type_select(x, __inline_isnanf, __inline_isnan, __inline_isnanl) #define isnormal(x) __fp_type_select(x, __isnormalf, __isnormal, __isnormall) #ifdef __MATH_BUILTIN_RELOPS #define isgreater(x, y) __builtin_isgreater((x), (y)) #define isgreaterequal(x, y) __builtin_isgreaterequal((x), (y)) #define isless(x, y) __builtin_isless((x), (y)) #define islessequal(x, y) __builtin_islessequal((x), (y)) #define islessgreater(x, y) __builtin_islessgreater((x), (y)) #define isunordered(x, y) __builtin_isunordered((x), (y)) #else # 125 "/usr/include/math.h" 3 4 #define isgreater(x, y) (!isunordered((x), (y)) && (x) > (y)) #define isgreaterequal(x, y) (!isunordered((x), (y)) && (x) >= (y)) #define isless(x, y) (!isunordered((x), (y)) && (x) < (y)) #define islessequal(x, y) (!isunordered((x), (y)) && (x) <= (y)) #define islessgreater(x, y) (!isunordered((x), (y)) && \ ((x) > (y) || (y) > (x))) #define isunordered(x, y) (isnan(x) || isnan(y)) #endif /* __MATH_BUILTIN_RELOPS */ # 133 "/usr/include/math.h" 3 4 #define signbit(x) __fp_type_select(x, __signbitf, __signbit, __signbitl) typedef __double_t double_t; typedef __float_t float_t; #endif /* __ISO_C_VISIBLE >= 1999 */ # 139 "/usr/include/math.h" 3 4 /* * XOPEN/SVID */ #if __BSD_VISIBLE || __XSI_VISIBLE #define M_E 2.7182818284590452354 /* e */ #define M_LOG2E 1.4426950408889634074 /* log 2e */ #define M_LOG10E 0.43429448190325182765 /* log 10e */ #define M_LN2 0.69314718055994530942 /* log e2 */ #define M_LN10 2.30258509299404568402 /* log e10 */ #define M_PI 3.14159265358979323846 /* pi */ #define M_PI_2 1.57079632679489661923 /* pi/2 */ #define M_PI_4 0.78539816339744830962 /* pi/4 */ #define M_1_PI 0.31830988618379067154 /* 1/pi */ #define M_2_PI 0.63661977236758134308 /* 2/pi */ #define M_2_SQRTPI 1.12837916709551257390 /* 2/sqrt(pi) */ #define M_SQRT2 1.41421356237309504880 /* sqrt(2) */ #define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */ #define MAXFLOAT ((float)3.40282346638528860e+38) extern int signgam; #endif /* __BSD_VISIBLE || __XSI_VISIBLE */ # 161 "/usr/include/math.h" 3 4 #if __BSD_VISIBLE #if 0 /* Old value from 4.4BSD-Lite math.h; this is probably better. */ #define HUGE HUGE_VAL #else # 167 "/usr/include/math.h" 3 4 #define HUGE MAXFLOAT #endif # 169 "/usr/include/math.h" 3 4 #endif /* __BSD_VISIBLE */ # 170 "/usr/include/math.h" 3 4 /* * Most of these functions depend on the rounding mode and have the side * effect of raising floating-point exceptions, so they are not declared * as __pure2. In C99, FENV_ACCESS affects the purity of these functions. */ __BEGIN_DECLS /* * ANSI/POSIX */ int __fpclassifyd(double) __pure2; int __fpclassifyf(float) __pure2; int __fpclassifyl(long double) __pure2; int __isfinitef(float) __pure2; int __isfinite(double) __pure2; int __isfinitel(long double) __pure2; int __isinff(float) __pure2; int __isinf(double) __pure2; int __isinfl(long double) __pure2; int __isnormalf(float) __pure2; int __isnormal(double) __pure2; int __isnormall(long double) __pure2; int __signbit(double) __pure2; int __signbitf(float) __pure2; int __signbitl(long double) __pure2; static __inline int __inline_isnan(__const double __x) { return (__x != __x); } static __inline int __inline_isnanf(__const float __x) { return (__x != __x); } static __inline int __inline_isnanl(__const long double __x) { return (__x != __x); } /* * Version 2 of the Single UNIX Specification (UNIX98) defined isnan() and * isinf() as functions taking double. C99, and the subsequent POSIX revisions * (SUSv3, POSIX.1-2001, define it as a macro that accepts any real floating * point type. If we are targeting SUSv2 and C99 or C11 (or C++11) then we * expose the newer definition, assuming that the language spec takes * precedence over the operating system interface spec. */ #if __XSI_VISIBLE > 0 && __XSI_VISIBLE < 600 && __ISO_C_VISIBLE < 1999 #undef isinf #undef isnan int isinf(double); int isnan(double); #endif # 231 "/usr/include/math.h" 3 4 double acos(double); double asin(double); double atan(double); double atan2(double, double); double cos(double); double sin(double); double tan(double); double cosh(double); double sinh(double); double tanh(double); double exp(double); double frexp(double, int *); /* fundamentally !__pure2 */ double ldexp(double, int); double log(double); double log10(double); double modf(double, double *); /* fundamentally !__pure2 */ double pow(double, double); double sqrt(double); double ceil(double); double fabs(double) __pure2; double floor(double); double fmod(double, double); /* * These functions are not in C90. */ #if __BSD_VISIBLE || __ISO_C_VISIBLE >= 1999 || __XSI_VISIBLE double acosh(double); double asinh(double); double atanh(double); double cbrt(double); double erf(double); double erfc(double); double exp2(double); double expm1(double); double fma(double, double, double); double hypot(double, double); int ilogb(double) __pure2; double lgamma(double); long long llrint(double); long long llround(double); double log1p(double); double log2(double); double logb(double); long lrint(double); long lround(double); double nan(const char *) __pure2; double nextafter(double, double); double remainder(double, double); double remquo(double, double, int *); double rint(double); #endif /* __BSD_VISIBLE || __ISO_C_VISIBLE >= 1999 || __XSI_VISIBLE */ # 288 "/usr/include/math.h" 3 4 #if __BSD_VISIBLE || __XSI_VISIBLE double j0(double); double j1(double); double jn(int, double); double y0(double); double y1(double); double yn(int, double); #if __XSI_VISIBLE <= 500 || __BSD_VISIBLE double gamma(double); #endif # 300 "/usr/include/math.h" 3 4 #if __XSI_VISIBLE <= 600 || __BSD_VISIBLE double scalb(double, double); #endif # 304 "/usr/include/math.h" 3 4 #endif /* __BSD_VISIBLE || __XSI_VISIBLE */ # 305 "/usr/include/math.h" 3 4 #if __BSD_VISIBLE || __ISO_C_VISIBLE >= 1999 double copysign(double, double) __pure2; double fdim(double, double); double fmax(double, double) __pure2; double fmin(double, double) __pure2; double nearbyint(double); double round(double); double scalbln(double, long); double scalbn(double, int); double tgamma(double); double trunc(double); #endif # 318 "/usr/include/math.h" 3 4 /* * BSD math library entry points */ #if __BSD_VISIBLE double drem(double, double); int finite(double) __pure2; int isnanf(float) __pure2; /* * Reentrant version of gamma & lgamma; passes signgam back by reference * as the second argument; user must allocate space for signgam. */ double gamma_r(double, int *); double lgamma_r(double, int *); /* * IEEE Test Vector */ double significand(double); #endif /* __BSD_VISIBLE */ # 339 "/usr/include/math.h" 3 4 /* float versions of ANSI/POSIX functions */ #if __ISO_C_VISIBLE >= 1999 float acosf(float); float asinf(float); float atanf(float); float atan2f(float, float); float cosf(float); float sinf(float); float tanf(float); float coshf(float); float sinhf(float); float tanhf(float); float exp2f(float); float expf(float); float expm1f(float); float frexpf(float, int *); /* fundamentally !__pure2 */ int ilogbf(float) __pure2; float ldexpf(float, int); float log10f(float); float log1pf(float); float log2f(float); float logf(float); float modff(float, float *); /* fundamentally !__pure2 */ float powf(float, float); float sqrtf(float); float ceilf(float); float fabsf(float) __pure2; float floorf(float); float fmodf(float, float); float roundf(float); float erff(float); float erfcf(float); float hypotf(float, float); float lgammaf(float); float tgammaf(float); float acoshf(float); float asinhf(float); float atanhf(float); float cbrtf(float); float logbf(float); float copysignf(float, float) __pure2; long long llrintf(float); long long llroundf(float); long lrintf(float); long lroundf(float); float nanf(const char *) __pure2; float nearbyintf(float); float nextafterf(float, float); float remainderf(float, float); float remquof(float, float, int *); float rintf(float); float scalblnf(float, long); float scalbnf(float, int); float truncf(float); float fdimf(float, float); float fmaf(float, float, float); float fmaxf(float, float) __pure2; float fminf(float, float) __pure2; #endif # 406 "/usr/include/math.h" 3 4 /* * float versions of BSD math library entry points */ #if __BSD_VISIBLE float dremf(float, float); int finitef(float) __pure2; float gammaf(float); float j0f(float); float j1f(float); float jnf(int, float); float scalbf(float, float); float y0f(float); float y1f(float); float ynf(int, float); /* * Float versions of reentrant version of gamma & lgamma; passes * signgam back by reference as the second argument; user must * allocate space for signgam. */ float gammaf_r(float, int *); float lgammaf_r(float, int *); /* * float version of IEEE Test Vector */ float significandf(float); #endif /* __BSD_VISIBLE */ # 435 "/usr/include/math.h" 3 4 /* * long double versions of ISO/POSIX math functions */ #if __ISO_C_VISIBLE >= 1999 long double acoshl(long double); long double acosl(long double); long double asinhl(long double); long double asinl(long double); long double atan2l(long double, long double); long double atanhl(long double); long double atanl(long double); long double cbrtl(long double); long double ceill(long double); long double copysignl(long double, long double) __pure2; long double coshl(long double); long double cosl(long double); long double erfcl(long double); long double erfl(long double); long double exp2l(long double); long double expl(long double); long double expm1l(long double); long double fabsl(long double) __pure2; long double fdiml(long double, long double); long double floorl(long double); long double fmal(long double, long double, long double); long double fmaxl(long double, long double) __pure2; long double fminl(long double, long double) __pure2; long double fmodl(long double, long double); long double frexpl(long double value, int *); /* fundamentally !__pure2 */ long double hypotl(long double, long double); int ilogbl(long double) __pure2; long double ldexpl(long double, int); long double lgammal(long double); long long llrintl(long double); long long llroundl(long double); long double log10l(long double); long double log1pl(long double); long double log2l(long double); long double logbl(long double); long double logl(long double); long lrintl(long double); long lroundl(long double); long double modfl(long double, long double *); /* fundamentally !__pure2 */ long double nanl(const char *) __pure2; long double nearbyintl(long double); long double nextafterl(long double, long double); double nexttoward(double, long double); float nexttowardf(float, long double); long double nexttowardl(long double, long double); long double powl(long double, long double); long double remainderl(long double, long double); long double remquol(long double, long double, int *); long double rintl(long double); long double roundl(long double); long double scalblnl(long double, long); long double scalbnl(long double, int); long double sinhl(long double); long double sinl(long double); long double sqrtl(long double); long double tanhl(long double); long double tanl(long double); long double tgammal(long double); long double truncl(long double); #endif /* __ISO_C_VISIBLE >= 1999 */ # 500 "/usr/include/math.h" 3 4 #if __BSD_VISIBLE long double lgammal_r(long double, int *); #endif # 504 "/usr/include/math.h" 3 4 __END_DECLS #endif /* !_MATH_H_ */ # 508 "/usr/include/math.h" 3 4 # 82 "/usr/local/include/SDL2/SDL_stdinc.h" 2 #endif # 83 "/usr/local/include/SDL2/SDL_stdinc.h" #ifdef HAVE_FLOAT_H #if 0 /* expanded by -frewrite-includes */ # include #endif /* expanded by -frewrite-includes */ # 84 "/usr/local/include/SDL2/SDL_stdinc.h" # 85 "/usr/local/include/SDL2/SDL_stdinc.h" #endif # 86 "/usr/local/include/SDL2/SDL_stdinc.h" #if defined(HAVE_ICONV) && defined(HAVE_ICONV_H) #if 0 /* expanded by -frewrite-includes */ # include #endif /* expanded by -frewrite-includes */ # 87 "/usr/local/include/SDL2/SDL_stdinc.h" # 1 "/usr/local/include/iconv.h" 1 /* Copyright (C) 1999-2003, 2005-2006, 2008-2011 Free Software Foundation, Inc. This file is part of the GNU LIBICONV Library. The GNU LIBICONV Library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. The GNU LIBICONV Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with the GNU LIBICONV Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* When installed, this file is called "iconv.h". */ #ifndef _LIBICONV_H #define _LIBICONV_H #ifndef LIBICONV_PLUG #define _LIBICONV_VERSION 0x010E /* version number: (major<<8) + minor */ extern int _libiconv_version; /* Likewise */ #endif # 28 "/usr/local/include/iconv.h" /* We would like to #include any system header file which could define iconv_t, 1. in order to eliminate the risk that the user gets compilation errors because some other system header file includes /usr/include/iconv.h which defines iconv_t or declares iconv after this file, 2. when compiling for LIBICONV_PLUG, we need the proper iconv_t type in order to produce binary compatible code. But gcc's #include_next is not portable. Thus, once libiconv's iconv.h has been installed in /usr/local/include, there is no way any more to include the original /usr/include/iconv.h. We simply have to get away without it. Ad 1. The risk that a system header file does #include "iconv.h" or #include_next "iconv.h" is small. They all do #include . Ad 2. The iconv_t type is a pointer type in all cases I have seen. (It has to be a scalar type because (iconv_t)(-1) is a possible return value from iconv_open().) */ /* Define iconv_t ourselves. */ #undef iconv_t #define iconv_t libiconv_t typedef void* iconv_t; /* Get size_t declaration. Get wchar_t declaration if it exists. */ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 53 "/usr/local/include/iconv.h" # 54 "/usr/local/include/iconv.h" /* Get errno declaration and values. */ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 56 "/usr/local/include/iconv.h" # 1 "/usr/include/errno.h" 1 3 4 /*- * Copyright (c) 1982, 1986, 1989, 1993 * The Regents of the University of California. All rights reserved. * (c) UNIX System Laboratories, Inc. * All or some portions of this file are derived from material licensed * to the University of California by American Telephone and Telegraph * Co. or Unix System Laboratories, Inc. and are reproduced herein with * the permission of UNIX System Laboratories, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)errno.h 8.5 (Berkeley) 1/21/94 * $FreeBSD: stable/10/sys/sys/errno.h 250250 2013-05-04 19:07:22Z pluknet $ */ #ifndef _SYS_ERRNO_H_ #define _SYS_ERRNO_H_ #ifndef _KERNEL #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 42 "/usr/include/errno.h" 3 4 # 43 "/usr/include/errno.h" 3 4 __BEGIN_DECLS int * __error(void); __END_DECLS #define errno (* __error()) #endif # 48 "/usr/include/errno.h" 3 4 #define EPERM 1 /* Operation not permitted */ #define ENOENT 2 /* No such file or directory */ #define ESRCH 3 /* No such process */ #define EINTR 4 /* Interrupted system call */ #define EIO 5 /* Input/output error */ #define ENXIO 6 /* Device not configured */ #define E2BIG 7 /* Argument list too long */ #define ENOEXEC 8 /* Exec format error */ #define EBADF 9 /* Bad file descriptor */ #define ECHILD 10 /* No child processes */ #define EDEADLK 11 /* Resource deadlock avoided */ /* 11 was EAGAIN */ #define ENOMEM 12 /* Cannot allocate memory */ #define EACCES 13 /* Permission denied */ #define EFAULT 14 /* Bad address */ #ifndef _POSIX_SOURCE #define ENOTBLK 15 /* Block device required */ #endif # 67 "/usr/include/errno.h" 3 4 #define EBUSY 16 /* Device busy */ #define EEXIST 17 /* File exists */ #define EXDEV 18 /* Cross-device link */ #define ENODEV 19 /* Operation not supported by device */ #define ENOTDIR 20 /* Not a directory */ #define EISDIR 21 /* Is a directory */ #define EINVAL 22 /* Invalid argument */ #define ENFILE 23 /* Too many open files in system */ #define EMFILE 24 /* Too many open files */ #define ENOTTY 25 /* Inappropriate ioctl for device */ #ifndef _POSIX_SOURCE #define ETXTBSY 26 /* Text file busy */ #endif # 80 "/usr/include/errno.h" 3 4 #define EFBIG 27 /* File too large */ #define ENOSPC 28 /* No space left on device */ #define ESPIPE 29 /* Illegal seek */ #define EROFS 30 /* Read-only filesystem */ #define EMLINK 31 /* Too many links */ #define EPIPE 32 /* Broken pipe */ /* math software */ #define EDOM 33 /* Numerical argument out of domain */ #define ERANGE 34 /* Result too large */ /* non-blocking and interrupt i/o */ #define EAGAIN 35 /* Resource temporarily unavailable */ #ifndef _POSIX_SOURCE #define EWOULDBLOCK EAGAIN /* Operation would block */ #define EINPROGRESS 36 /* Operation now in progress */ #define EALREADY 37 /* Operation already in progress */ /* ipc/network software -- argument errors */ #define ENOTSOCK 38 /* Socket operation on non-socket */ #define EDESTADDRREQ 39 /* Destination address required */ #define EMSGSIZE 40 /* Message too long */ #define EPROTOTYPE 41 /* Protocol wrong type for socket */ #define ENOPROTOOPT 42 /* Protocol not available */ #define EPROTONOSUPPORT 43 /* Protocol not supported */ #define ESOCKTNOSUPPORT 44 /* Socket type not supported */ #define EOPNOTSUPP 45 /* Operation not supported */ #define ENOTSUP EOPNOTSUPP /* Operation not supported */ #define EPFNOSUPPORT 46 /* Protocol family not supported */ #define EAFNOSUPPORT 47 /* Address family not supported by protocol family */ #define EADDRINUSE 48 /* Address already in use */ #define EADDRNOTAVAIL 49 /* Can't assign requested address */ /* ipc/network software -- operational errors */ #define ENETDOWN 50 /* Network is down */ #define ENETUNREACH 51 /* Network is unreachable */ #define ENETRESET 52 /* Network dropped connection on reset */ #define ECONNABORTED 53 /* Software caused connection abort */ #define ECONNRESET 54 /* Connection reset by peer */ #define ENOBUFS 55 /* No buffer space available */ #define EISCONN 56 /* Socket is already connected */ #define ENOTCONN 57 /* Socket is not connected */ #define ESHUTDOWN 58 /* Can't send after socket shutdown */ #define ETOOMANYREFS 59 /* Too many references: can't splice */ #define ETIMEDOUT 60 /* Operation timed out */ #define ECONNREFUSED 61 /* Connection refused */ #define ELOOP 62 /* Too many levels of symbolic links */ #endif /* _POSIX_SOURCE */ # 129 "/usr/include/errno.h" 3 4 #define ENAMETOOLONG 63 /* File name too long */ /* should be rearranged */ #ifndef _POSIX_SOURCE #define EHOSTDOWN 64 /* Host is down */ #define EHOSTUNREACH 65 /* No route to host */ #endif /* _POSIX_SOURCE */ # 136 "/usr/include/errno.h" 3 4 #define ENOTEMPTY 66 /* Directory not empty */ /* quotas & mush */ #ifndef _POSIX_SOURCE #define EPROCLIM 67 /* Too many processes */ #define EUSERS 68 /* Too many users */ #define EDQUOT 69 /* Disc quota exceeded */ /* Network File System */ #define ESTALE 70 /* Stale NFS file handle */ #define EREMOTE 71 /* Too many levels of remote in path */ #define EBADRPC 72 /* RPC struct is bad */ #define ERPCMISMATCH 73 /* RPC version wrong */ #define EPROGUNAVAIL 74 /* RPC prog. not avail */ #define EPROGMISMATCH 75 /* Program version wrong */ #define EPROCUNAVAIL 76 /* Bad procedure for program */ #endif /* _POSIX_SOURCE */ # 153 "/usr/include/errno.h" 3 4 #define ENOLCK 77 /* No locks available */ #define ENOSYS 78 /* Function not implemented */ #ifndef _POSIX_SOURCE #define EFTYPE 79 /* Inappropriate file type or format */ #define EAUTH 80 /* Authentication error */ #define ENEEDAUTH 81 /* Need authenticator */ #define EIDRM 82 /* Identifier removed */ #define ENOMSG 83 /* No message of desired type */ #define EOVERFLOW 84 /* Value too large to be stored in data type */ #define ECANCELED 85 /* Operation canceled */ #define EILSEQ 86 /* Illegal byte sequence */ #define ENOATTR 87 /* Attribute not found */ #define EDOOFUS 88 /* Programming error */ #endif /* _POSIX_SOURCE */ # 170 "/usr/include/errno.h" 3 4 #define EBADMSG 89 /* Bad message */ #define EMULTIHOP 90 /* Multihop attempted */ #define ENOLINK 91 /* Link has been severed */ #define EPROTO 92 /* Protocol error */ #ifndef _POSIX_SOURCE #define ENOTCAPABLE 93 /* Capabilities insufficient */ #define ECAPMODE 94 /* Not permitted in capability mode */ #define ENOTRECOVERABLE 95 /* State not recoverable */ #define EOWNERDEAD 96 /* Previous owner died */ #endif /* _POSIX_SOURCE */ # 182 "/usr/include/errno.h" 3 4 #ifndef _POSIX_SOURCE #define ELAST 96 /* Must be equal largest errno */ #endif /* _POSIX_SOURCE */ # 186 "/usr/include/errno.h" 3 4 #ifdef _KERNEL /* pseudo-errors returned inside kernel to modify return to process */ #define ERESTART (-1) /* restart syscall */ #define EJUSTRETURN (-2) /* don't modify regs, just return */ #define ENOIOCTL (-3) /* ioctl not handled by this layer */ #define EDIRIOCTL (-4) /* do direct ioctl in GEOM */ #endif # 194 "/usr/include/errno.h" 3 4 #endif # 196 "/usr/include/errno.h" 3 4 # 57 "/usr/local/include/iconv.h" 2 /* Some systems, like SunOS 4, don't have EILSEQ. Some systems, like BSD/OS, have EILSEQ in a different header. On these systems, define EILSEQ ourselves. */ #ifndef EILSEQ #define EILSEQ #endif # 63 "/usr/local/include/iconv.h" #ifdef __cplusplus extern "C" { #endif # 68 "/usr/local/include/iconv.h" /* Allocates descriptor for code conversion from encoding ‘fromcode’ to encoding ‘tocode’. */ #ifndef LIBICONV_PLUG #define iconv_open libiconv_open #endif # 75 "/usr/local/include/iconv.h" extern iconv_t iconv_open (const char* tocode, const char* fromcode); /* Converts, using conversion descriptor ‘cd’, at most ‘*inbytesleft’ bytes starting at ‘*inbuf’, writing at most ‘*outbytesleft’ bytes starting at ‘*outbuf’. Decrements ‘*inbytesleft’ and increments ‘*inbuf’ by the same amount. Decrements ‘*outbytesleft’ and increments ‘*outbuf’ by the same amount. */ #ifndef LIBICONV_PLUG #define iconv libiconv #endif # 85 "/usr/local/include/iconv.h" extern size_t iconv (iconv_t cd, char* * inbuf, size_t *inbytesleft, char* * outbuf, size_t *outbytesleft); /* Frees resources allocated for conversion descriptor ‘cd’. */ #ifndef LIBICONV_PLUG #define iconv_close libiconv_close #endif # 91 "/usr/local/include/iconv.h" extern int iconv_close (iconv_t cd); #ifdef __cplusplus } #endif # 97 "/usr/local/include/iconv.h" /* Nonstandard extensions. */ #if 1 #if 0 /* Tru64 with Desktop Toolkit C has a bug: must be included before . BSD/OS 4.0.1 has a bug: , and must be included before . */ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 108 "/usr/local/include/iconv.h" # 109 "/usr/local/include/iconv.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 109 "/usr/local/include/iconv.h" # 110 "/usr/local/include/iconv.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 110 "/usr/local/include/iconv.h" # 111 "/usr/local/include/iconv.h" #endif # 112 "/usr/local/include/iconv.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 112 "/usr/local/include/iconv.h" # 1 "/usr/include/wchar.h" 1 3 4 /*- * Copyright (c)1999 Citrus Project, * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $FreeBSD: head/include/wchar.h 265878 2014-05-11 13:48:21Z jilles $ */ /*- * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation * by Julian Coleman. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * * $NetBSD: wchar.h,v 1.8 2000/12/22 05:31:42 itojun Exp $ */ #ifndef _WCHAR_H_ #define _WCHAR_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 63 "/usr/include/wchar.h" 3 4 # 64 "/usr/include/wchar.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 64 "/usr/include/wchar.h" 3 4 # 65 "/usr/include/wchar.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 65 "/usr/include/wchar.h" 3 4 # 66 "/usr/include/wchar.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 66 "/usr/include/wchar.h" 3 4 # 1 "/usr/include/machine/_limits.h" 1 3 4 /*- * This file is in the public domain. */ /* $FreeBSD: stable/10/sys/amd64/include/_limits.h 232262 2012-02-28 18:24:28Z tijl $ */ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 6 "/usr/include/machine/_limits.h" 3 4 # 7 "/usr/include/machine/_limits.h" 3 4 # 67 "/usr/include/wchar.h" 2 3 4 #if 0 /* expanded by -frewrite-includes */ #include <_ctype.h> #endif /* expanded by -frewrite-includes */ # 67 "/usr/include/wchar.h" 3 4 # 68 "/usr/include/wchar.h" 3 4 #ifndef _MBSTATE_T_DECLARED typedef __mbstate_t mbstate_t; #define _MBSTATE_T_DECLARED #endif # 73 "/usr/include/wchar.h" 3 4 #ifndef _SIZE_T_DECLARED typedef __size_t size_t; #define _SIZE_T_DECLARED #endif # 78 "/usr/include/wchar.h" 3 4 #ifndef __cplusplus #ifndef _WCHAR_T_DECLARED typedef ___wchar_t wchar_t; #define _WCHAR_T_DECLARED #endif # 84 "/usr/include/wchar.h" 3 4 #endif # 85 "/usr/include/wchar.h" 3 4 #ifndef _WINT_T_DECLARED typedef __wint_t wint_t; #define _WINT_T_DECLARED #endif # 90 "/usr/include/wchar.h" 3 4 #define WCHAR_MIN __WCHAR_MIN #define WCHAR_MAX __WCHAR_MAX #ifndef WEOF #define WEOF ((wint_t)-1) #endif # 97 "/usr/include/wchar.h" 3 4 #ifndef _STDFILE_DECLARED #define _STDFILE_DECLARED typedef struct __sFILE FILE; #endif # 102 "/usr/include/wchar.h" 3 4 struct tm; __BEGIN_DECLS wint_t btowc(int); wint_t fgetwc(FILE *); wchar_t * fgetws(wchar_t * __restrict, int, FILE * __restrict); wint_t fputwc(wchar_t, FILE *); int fputws(const wchar_t * __restrict, FILE * __restrict); int fwide(FILE *, int); int fwprintf(FILE * __restrict, const wchar_t * __restrict, ...); int fwscanf(FILE * __restrict, const wchar_t * __restrict, ...); wint_t getwc(FILE *); wint_t getwchar(void); size_t mbrlen(const char * __restrict, size_t, mbstate_t * __restrict); size_t mbrtowc(wchar_t * __restrict, const char * __restrict, size_t, mbstate_t * __restrict); int mbsinit(const mbstate_t *); size_t mbsrtowcs(wchar_t * __restrict, const char ** __restrict, size_t, mbstate_t * __restrict); wint_t putwc(wchar_t, FILE *); wint_t putwchar(wchar_t); int swprintf(wchar_t * __restrict, size_t n, const wchar_t * __restrict, ...); int swscanf(const wchar_t * __restrict, const wchar_t * __restrict, ...); wint_t ungetwc(wint_t, FILE *); int vfwprintf(FILE * __restrict, const wchar_t * __restrict, __va_list); int vswprintf(wchar_t * __restrict, size_t n, const wchar_t * __restrict, __va_list); int vwprintf(const wchar_t * __restrict, __va_list); size_t wcrtomb(char * __restrict, wchar_t, mbstate_t * __restrict); wchar_t *wcscat(wchar_t * __restrict, const wchar_t * __restrict); wchar_t *wcschr(const wchar_t *, wchar_t) __pure; int wcscmp(const wchar_t *, const wchar_t *) __pure; int wcscoll(const wchar_t *, const wchar_t *); wchar_t *wcscpy(wchar_t * __restrict, const wchar_t * __restrict); size_t wcscspn(const wchar_t *, const wchar_t *) __pure; size_t wcsftime(wchar_t * __restrict, size_t, const wchar_t * __restrict, const struct tm * __restrict); size_t wcslen(const wchar_t *) __pure; wchar_t *wcsncat(wchar_t * __restrict, const wchar_t * __restrict, size_t); int wcsncmp(const wchar_t *, const wchar_t *, size_t) __pure; wchar_t *wcsncpy(wchar_t * __restrict , const wchar_t * __restrict, size_t); wchar_t *wcspbrk(const wchar_t *, const wchar_t *) __pure; wchar_t *wcsrchr(const wchar_t *, wchar_t) __pure; size_t wcsrtombs(char * __restrict, const wchar_t ** __restrict, size_t, mbstate_t * __restrict); size_t wcsspn(const wchar_t *, const wchar_t *) __pure; wchar_t *wcsstr(const wchar_t * __restrict, const wchar_t * __restrict) __pure; size_t wcsxfrm(wchar_t * __restrict, const wchar_t * __restrict, size_t); int wctob(wint_t); double wcstod(const wchar_t * __restrict, wchar_t ** __restrict); wchar_t *wcstok(wchar_t * __restrict, const wchar_t * __restrict, wchar_t ** __restrict); long wcstol(const wchar_t * __restrict, wchar_t ** __restrict, int); unsigned long wcstoul(const wchar_t * __restrict, wchar_t ** __restrict, int); wchar_t *wmemchr(const wchar_t *, wchar_t, size_t) __pure; int wmemcmp(const wchar_t *, const wchar_t *, size_t) __pure; wchar_t *wmemcpy(wchar_t * __restrict, const wchar_t * __restrict, size_t); wchar_t *wmemmove(wchar_t *, const wchar_t *, size_t); wchar_t *wmemset(wchar_t *, wchar_t, size_t); int wprintf(const wchar_t * __restrict, ...); int wscanf(const wchar_t * __restrict, ...); #ifndef _STDSTREAM_DECLARED extern FILE *__stdinp; extern FILE *__stdoutp; extern FILE *__stderrp; #define _STDSTREAM_DECLARED #endif # 176 "/usr/include/wchar.h" 3 4 #define getwc(fp) fgetwc(fp) #define getwchar() fgetwc(__stdinp) #define putwc(wc, fp) fputwc(wc, fp) #define putwchar(wc) fputwc(wc, __stdoutp) #if __ISO_C_VISIBLE >= 1999 int vfwscanf(FILE * __restrict, const wchar_t * __restrict, __va_list); int vswscanf(const wchar_t * __restrict, const wchar_t * __restrict, __va_list); int vwscanf(const wchar_t * __restrict, __va_list); float wcstof(const wchar_t * __restrict, wchar_t ** __restrict); long double wcstold(const wchar_t * __restrict, wchar_t ** __restrict); #ifdef __LONG_LONG_SUPPORTED /* LONGLONG */ long long wcstoll(const wchar_t * __restrict, wchar_t ** __restrict, int); /* LONGLONG */ unsigned long long wcstoull(const wchar_t * __restrict, wchar_t ** __restrict, int); #endif # 199 "/usr/include/wchar.h" 3 4 #endif /* __ISO_C_VISIBLE >= 1999 */ # 200 "/usr/include/wchar.h" 3 4 #if __XSI_VISIBLE int wcswidth(const wchar_t *, size_t); int wcwidth(wchar_t); #define wcwidth(_c) __wcwidth(_c) #endif # 206 "/usr/include/wchar.h" 3 4 #if __POSIX_VISIBLE >= 200809 size_t mbsnrtowcs(wchar_t * __restrict, const char ** __restrict, size_t, size_t, mbstate_t * __restrict); FILE *open_wmemstream(wchar_t **, size_t *); wchar_t *wcpcpy(wchar_t * __restrict, const wchar_t * __restrict); wchar_t *wcpncpy(wchar_t * __restrict, const wchar_t * __restrict, size_t); wchar_t *wcsdup(const wchar_t *) __malloc_like; int wcscasecmp(const wchar_t *, const wchar_t *); int wcsncasecmp(const wchar_t *, const wchar_t *, size_t n); size_t wcsnlen(const wchar_t *, size_t) __pure; size_t wcsnrtombs(char * __restrict, const wchar_t ** __restrict, size_t, size_t, mbstate_t * __restrict); #endif # 220 "/usr/include/wchar.h" 3 4 #if __BSD_VISIBLE wchar_t *fgetwln(FILE * __restrict, size_t * __restrict); size_t wcslcat(wchar_t *, const wchar_t *, size_t); size_t wcslcpy(wchar_t *, const wchar_t *, size_t); #endif # 226 "/usr/include/wchar.h" 3 4 #if __POSIX_VISIBLE >= 200809 || defined(_XLOCALE_H_) #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 228 "/usr/include/wchar.h" 3 4 # 1 "/usr/include/xlocale/_wchar.h" 1 3 4 /*- * Copyright (c) 2011, 2012 The FreeBSD Foundation * All rights reserved. * * This software was developed by David Chisnall under sponsorship from * the FreeBSD Foundation. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $FreeBSD: stable/10/include/xlocale/_wchar.h 231673 2012-02-14 12:03:23Z theraven $ */ #ifndef _LOCALE_T_DEFINED #define _LOCALE_T_DEFINED typedef struct _xlocale *locale_t; #endif # 36 "/usr/include/xlocale/_wchar.h" 3 4 #ifndef _XLOCALE_WCHAR1_H #define _XLOCALE_WCHAR1_H int wcscasecmp_l(const wchar_t *, const wchar_t *, locale_t); int wcsncasecmp_l(const wchar_t *, const wchar_t *, size_t, locale_t); int wcscoll_l(const wchar_t *, const wchar_t *, locale_t); size_t wcsxfrm_l(wchar_t * __restrict, const wchar_t * __restrict, size_t, locale_t); #endif /* _XLOCALE_WCHAR1_H */ # 48 "/usr/include/xlocale/_wchar.h" 3 4 /* * Only declare the non-POSIX functions if we're included from xlocale.h. */ #ifdef _XLOCALE_H_ #ifndef _XLOCALE_WCHAR2_H #define _XLOCALE_WCHAR2_H wint_t btowc_l(int, locale_t); wint_t fgetwc_l(FILE *, locale_t); wchar_t *fgetws_l(wchar_t * __restrict, int, FILE * __restrict, locale_t); wint_t fputwc_l(wchar_t, FILE *, locale_t); int fputws_l(const wchar_t * __restrict, FILE * __restrict, locale_t); int fwprintf_l(FILE * __restrict, locale_t, const wchar_t * __restrict, ...); int fwscanf_l(FILE * __restrict, locale_t, const wchar_t * __restrict, ...); wint_t getwc_l(FILE *, locale_t); wint_t getwchar_l(locale_t); size_t mbrlen_l(const char * __restrict, size_t, mbstate_t * __restrict, locale_t); size_t mbrtowc_l(wchar_t * __restrict, const char * __restrict, size_t, mbstate_t * __restrict, locale_t); int mbsinit_l(const mbstate_t *, locale_t); size_t mbsrtowcs_l(wchar_t * __restrict, const char ** __restrict, size_t, mbstate_t * __restrict, locale_t); wint_t putwc_l(wchar_t, FILE *, locale_t); wint_t putwchar_l(wchar_t, locale_t); int swprintf_l(wchar_t * __restrict, size_t n, locale_t, const wchar_t * __restrict, ...); int swscanf_l(const wchar_t * __restrict, locale_t, const wchar_t * __restrict, ...); wint_t ungetwc_l(wint_t, FILE *, locale_t); int vfwprintf_l(FILE * __restrict, locale_t, const wchar_t * __restrict, __va_list); int vswprintf_l(wchar_t * __restrict, size_t n, locale_t, const wchar_t * __restrict, __va_list); int vwprintf_l(locale_t, const wchar_t * __restrict, __va_list); size_t wcrtomb_l(char * __restrict, wchar_t, mbstate_t * __restrict, locale_t); size_t wcsftime_l(wchar_t * __restrict, size_t, const wchar_t * __restrict, const struct tm * __restrict, locale_t); size_t wcsrtombs_l(char * __restrict, const wchar_t ** __restrict, size_t, mbstate_t * __restrict, locale_t); double wcstod_l(const wchar_t * __restrict, wchar_t ** __restrict, locale_t); long wcstol_l(const wchar_t * __restrict, wchar_t ** __restrict, int, locale_t); unsigned long wcstoul_l(const wchar_t * __restrict, wchar_t ** __restrict, int, locale_t); int wcswidth_l(const wchar_t *, size_t, locale_t); int wctob_l(wint_t, locale_t); int wcwidth_l(wchar_t, locale_t); int wprintf_l(locale_t, const wchar_t * __restrict, ...); int wscanf_l(locale_t, const wchar_t * __restrict, ...); int vfwscanf_l(FILE * __restrict, locale_t, const wchar_t * __restrict, __va_list); int vswscanf_l(const wchar_t * __restrict, locale_t, const wchar_t *__restrict, __va_list); int vwscanf_l(locale_t, const wchar_t * __restrict, __va_list); float wcstof_l(const wchar_t * __restrict, wchar_t ** __restrict, locale_t); long double wcstold_l(const wchar_t * __restrict, wchar_t ** __restrict, locale_t); long long wcstoll_l(const wchar_t * __restrict, wchar_t ** __restrict, int, locale_t); unsigned long long wcstoull_l(const wchar_t * __restrict, wchar_t ** __restrict, int, locale_t); size_t mbsnrtowcs_l(wchar_t * __restrict, const char ** __restrict, size_t, size_t, mbstate_t * __restrict, locale_t); size_t wcsnrtombs_l(char * __restrict, const wchar_t ** __restrict, size_t, size_t, mbstate_t * __restrict, locale_t); #endif /* _XLOCALE_WCHAR_H */ # 133 "/usr/include/xlocale/_wchar.h" 3 4 #endif /* _XLOCALE_H_ */ # 134 "/usr/include/xlocale/_wchar.h" 3 4 # 229 "/usr/include/wchar.h" 2 3 4 #endif # 230 "/usr/include/wchar.h" 3 4 __END_DECLS #endif /* !_WCHAR_H_ */ # 233 "/usr/include/wchar.h" 3 4 # 113 "/usr/local/include/iconv.h" 2 #endif # 114 "/usr/local/include/iconv.h" #ifdef __cplusplus extern "C" { #endif # 118 "/usr/local/include/iconv.h" /* A type that holds all memory needed by a conversion descriptor. A pointer to such an object can be used as an iconv_t. */ typedef struct { void* dummy1[28]; #if 1 mbstate_t dummy2; #endif # 126 "/usr/local/include/iconv.h" } iconv_allocation_t; /* Allocates descriptor for code conversion from encoding ‘fromcode’ to encoding ‘tocode’ into preallocated memory. Returns an error indicator (0 or -1 with errno set). */ #ifndef LIBICONV_PLUG #define iconv_open_into libiconv_open_into #endif # 134 "/usr/local/include/iconv.h" extern int iconv_open_into (const char* tocode, const char* fromcode, iconv_allocation_t* resultp); /* Control of attributes. */ #ifndef LIBICONV_PLUG #define iconvctl libiconvctl #endif # 141 "/usr/local/include/iconv.h" extern int iconvctl (iconv_t cd, int request, void* argument); /* Hook performed after every successful conversion of a Unicode character. */ typedef void (*iconv_unicode_char_hook) (unsigned int uc, void* data); /* Hook performed after every successful conversion of a wide character. */ typedef void (*iconv_wide_char_hook) (wchar_t wc, void* data); /* Set of hooks. */ struct iconv_hooks { iconv_unicode_char_hook uc_hook; iconv_wide_char_hook wc_hook; void* data; }; /* Fallback function. Invoked when a small number of bytes could not be converted to a Unicode character. This function should process all bytes from inbuf and may produce replacement Unicode characters by calling the write_replacement callback repeatedly. */ typedef void (*iconv_unicode_mb_to_uc_fallback) (const char* inbuf, size_t inbufsize, void (*write_replacement) (const unsigned int *buf, size_t buflen, void* callback_arg), void* callback_arg, void* data); /* Fallback function. Invoked when a Unicode character could not be converted to the target encoding. This function should process the character and may produce replacement bytes (in the target encoding) by calling the write_replacement callback repeatedly. */ typedef void (*iconv_unicode_uc_to_mb_fallback) (unsigned int code, void (*write_replacement) (const char *buf, size_t buflen, void* callback_arg), void* callback_arg, void* data); #if 1 /* Fallback function. Invoked when a number of bytes could not be converted to a wide character. This function should process all bytes from inbuf and may produce replacement wide characters by calling the write_replacement callback repeatedly. */ typedef void (*iconv_wchar_mb_to_wc_fallback) (const char* inbuf, size_t inbufsize, void (*write_replacement) (const wchar_t *buf, size_t buflen, void* callback_arg), void* callback_arg, void* data); /* Fallback function. Invoked when a wide character could not be converted to the target encoding. This function should process the character and may produce replacement bytes (in the target encoding) by calling the write_replacement callback repeatedly. */ typedef void (*iconv_wchar_wc_to_mb_fallback) (wchar_t code, void (*write_replacement) (const char *buf, size_t buflen, void* callback_arg), void* callback_arg, void* data); #else # 196 "/usr/local/include/iconv.h" /* If the wchar_t type does not exist, these two fallback functions are never invoked. Their argument list therefore does not matter. */ typedef void (*iconv_wchar_mb_to_wc_fallback) (); typedef void (*iconv_wchar_wc_to_mb_fallback) (); #endif # 201 "/usr/local/include/iconv.h" /* Set of fallbacks. */ struct iconv_fallbacks { iconv_unicode_mb_to_uc_fallback mb_to_uc_fallback; iconv_unicode_uc_to_mb_fallback uc_to_mb_fallback; iconv_wchar_mb_to_wc_fallback mb_to_wc_fallback; iconv_wchar_wc_to_mb_fallback wc_to_mb_fallback; void* data; }; /* Requests for iconvctl. */ #define ICONV_TRIVIALP 0 /* int *argument */ #define ICONV_GET_TRANSLITERATE 1 /* int *argument */ #define ICONV_SET_TRANSLITERATE 2 /* const int *argument */ #define ICONV_GET_DISCARD_ILSEQ 3 /* int *argument */ #define ICONV_SET_DISCARD_ILSEQ 4 /* const int *argument */ #define ICONV_SET_HOOKS 5 /* const struct iconv_hooks *argument */ #define ICONV_SET_FALLBACKS 6 /* const struct iconv_fallbacks *argument */ /* Listing of locale independent encodings. */ #ifndef LIBICONV_PLUG #define iconvlist libiconvlist #endif # 223 "/usr/local/include/iconv.h" extern void iconvlist (int (*do_one) (unsigned int namescount, const char * const * names, void* data), void* data); /* Canonicalize an encoding name. The result is either a canonical encoding name, or name itself. */ extern const char * iconv_canonicalize (const char * name); /* Support for relocatable packages. */ #ifndef LIBICONV_PLUG /* Sets the original and the current installation prefix of the package. Relocation simply replaces a pathname starting with the original prefix by the corresponding pathname with the current prefix instead. Both prefixes should be directory names without trailing slash (i.e. use "" instead of "/"). */ extern void libiconv_set_relocation_prefix (const char *orig_prefix, const char *curr_prefix); #endif # 243 "/usr/local/include/iconv.h" #ifdef __cplusplus } #endif # 247 "/usr/local/include/iconv.h" #endif /* _LIBICONV_H */ # 251 "/usr/local/include/iconv.h" # 88 "/usr/local/include/SDL2/SDL_stdinc.h" 2 #endif # 89 "/usr/local/include/SDL2/SDL_stdinc.h" /** * The number of elements in an array. */ #define SDL_arraysize(array) (sizeof(array)/sizeof(array[0])) #define SDL_TABLESIZE(table) SDL_arraysize(table) /** * \name Cast operators * * Use proper C++ casts when compiled as C++ to be compatible with the option * -Wold-style-cast of GCC (and -Werror=old-style-cast in GCC 4.2 and above). */ /* @{ */ #ifdef __cplusplus #define SDL_reinterpret_cast(type, expression) reinterpret_cast(expression) #define SDL_static_cast(type, expression) static_cast(expression) #define SDL_const_cast(type, expression) const_cast(expression) #else # 108 "/usr/local/include/SDL2/SDL_stdinc.h" #define SDL_reinterpret_cast(type, expression) ((type)(expression)) #define SDL_static_cast(type, expression) ((type)(expression)) #define SDL_const_cast(type, expression) ((type)(expression)) #endif # 112 "/usr/local/include/SDL2/SDL_stdinc.h" /* @} *//* Cast operators */ /* Define a four character code as a Uint32 */ #define SDL_FOURCC(A, B, C, D) \ ((SDL_static_cast(Uint32, SDL_static_cast(Uint8, (A))) << 0) | \ (SDL_static_cast(Uint32, SDL_static_cast(Uint8, (B))) << 8) | \ (SDL_static_cast(Uint32, SDL_static_cast(Uint8, (C))) << 16) | \ (SDL_static_cast(Uint32, SDL_static_cast(Uint8, (D))) << 24)) /** * \name Basic data types */ /* @{ */ typedef enum { SDL_FALSE = 0, SDL_TRUE = 1 } SDL_bool; /** * \brief A signed 8-bit integer type. */ typedef int8_t Sint8; /** * \brief An unsigned 8-bit integer type. */ typedef uint8_t Uint8; /** * \brief A signed 16-bit integer type. */ typedef int16_t Sint16; /** * \brief An unsigned 16-bit integer type. */ typedef uint16_t Uint16; /** * \brief A signed 32-bit integer type. */ typedef int32_t Sint32; /** * \brief An unsigned 32-bit integer type. */ typedef uint32_t Uint32; /** * \brief A signed 64-bit integer type. */ typedef int64_t Sint64; /** * \brief An unsigned 64-bit integer type. */ typedef uint64_t Uint64; /* @} *//* Basic data types */ #define SDL_COMPILE_TIME_ASSERT(name, x) \ typedef int SDL_dummy_ ## name[(x) * 2 - 1] /** \cond */ #ifndef DOXYGEN_SHOULD_IGNORE_THIS SDL_COMPILE_TIME_ASSERT(uint8, sizeof(Uint8) == 1); SDL_COMPILE_TIME_ASSERT(sint8, sizeof(Sint8) == 1); SDL_COMPILE_TIME_ASSERT(uint16, sizeof(Uint16) == 2); SDL_COMPILE_TIME_ASSERT(sint16, sizeof(Sint16) == 2); SDL_COMPILE_TIME_ASSERT(uint32, sizeof(Uint32) == 4); SDL_COMPILE_TIME_ASSERT(sint32, sizeof(Sint32) == 4); SDL_COMPILE_TIME_ASSERT(uint64, sizeof(Uint64) == 8); SDL_COMPILE_TIME_ASSERT(sint64, sizeof(Sint64) == 8); #endif /* DOXYGEN_SHOULD_IGNORE_THIS */ # 182 "/usr/local/include/SDL2/SDL_stdinc.h" /** \endcond */ /* Check to make sure enums are the size of ints, for structure packing. For both Watcom C/C++ and Borland C/C++ the compiler option that makes enums having the size of an int must be enabled. This is "-b" for Borland C/C++ and "-ei" for Watcom C/C++ (v11). */ /** \cond */ #ifndef DOXYGEN_SHOULD_IGNORE_THIS #if !defined(__ANDROID__) /* TODO: include/SDL_stdinc.h:174: error: size of array 'SDL_dummy_enum' is negative */ typedef enum { DUMMY_ENUM_VALUE } SDL_DUMMY_ENUM; SDL_COMPILE_TIME_ASSERT(enum, sizeof(SDL_DUMMY_ENUM) == sizeof(int)); #endif # 201 "/usr/local/include/SDL2/SDL_stdinc.h" #endif /* DOXYGEN_SHOULD_IGNORE_THIS */ # 202 "/usr/local/include/SDL2/SDL_stdinc.h" /** \endcond */ #if 0 /* expanded by -frewrite-includes */ #include "begin_code.h" #endif /* expanded by -frewrite-includes */ # 204 "/usr/local/include/SDL2/SDL_stdinc.h" # 1 "/usr/local/include/SDL2/begin_code.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file begin_code.h * * This file sets things up for C dynamic library function definitions, * static inlined functions, and structures aligned at 4-byte alignment. * If you don't like ugly C preprocessor code, don't look at this file. :) */ /* This shouldn't be nested -- included it around code only. */ #ifdef _begin_code_h #error Nested inclusion of begin_code.h #endif # 34 "/usr/local/include/SDL2/begin_code.h" #define _begin_code_h #ifndef SDL_DEPRECATED # if (__GNUC__ >= 4) /* technically, this arrived in gcc 3.1, but oh well. */ # define SDL_DEPRECATED __attribute__((deprecated)) # else # 40 "/usr/local/include/SDL2/begin_code.h" # define SDL_DEPRECATED # endif # 42 "/usr/local/include/SDL2/begin_code.h" #endif # 43 "/usr/local/include/SDL2/begin_code.h" /* Some compilers use a special export keyword */ #ifndef DECLSPEC # if defined(__WIN32__) || defined(__WINRT__) # ifdef __BORLANDC__ # ifdef BUILD_SDL # define DECLSPEC # else # 51 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllimport) # endif # 53 "/usr/local/include/SDL2/begin_code.h" # else # 54 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllexport) # endif # 56 "/usr/local/include/SDL2/begin_code.h" # else # 57 "/usr/local/include/SDL2/begin_code.h" # if defined(__GNUC__) && __GNUC__ >= 4 # define DECLSPEC __attribute__ ((visibility("default"))) # elif defined(__GNUC__) && __GNUC__ >= 2 # 60 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllexport) # else # 62 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC # endif # 64 "/usr/local/include/SDL2/begin_code.h" # endif # 65 "/usr/local/include/SDL2/begin_code.h" #endif # 66 "/usr/local/include/SDL2/begin_code.h" /* By default SDL uses the C calling convention */ #ifndef SDLCALL #if (defined(__WIN32__) || defined(__WINRT__)) && !defined(__GNUC__) #define SDLCALL __cdecl #else # 72 "/usr/local/include/SDL2/begin_code.h" #define SDLCALL #endif # 74 "/usr/local/include/SDL2/begin_code.h" #endif /* SDLCALL */ # 75 "/usr/local/include/SDL2/begin_code.h" /* Removed DECLSPEC on Symbian OS because SDL cannot be a DLL in EPOC */ #ifdef __SYMBIAN32__ #undef DECLSPEC #define DECLSPEC #endif /* __SYMBIAN32__ */ # 81 "/usr/local/include/SDL2/begin_code.h" /* Force structure packing at 4 byte alignment. This is necessary if the header is included in code which has structure packing set to an alternate value, say for loading structures from disk. The packing is reset to the previous value in close_code.h */ #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__) #ifdef _MSC_VER #pragma warning(disable: 4103) #endif # 91 "/usr/local/include/SDL2/begin_code.h" #ifdef __BORLANDC__ #pragma nopackwarning #endif # 94 "/usr/local/include/SDL2/begin_code.h" #ifdef _M_X64 /* Use 8-byte alignment on 64-bit architectures, so pointers are aligned */ #pragma pack(push,8) #else # 98 "/usr/local/include/SDL2/begin_code.h" #pragma pack(push,4) #endif # 100 "/usr/local/include/SDL2/begin_code.h" #endif /* Compiler needs structure packing set */ # 101 "/usr/local/include/SDL2/begin_code.h" #ifndef SDL_INLINE #if defined(__GNUC__) #define SDL_INLINE __inline__ #elif defined(_MSC_VER) || defined(__BORLANDC__) || \ defined(__DMC__) || defined(__SC__) || \ defined(__WATCOMC__) || defined(__LCC__) || \ defined(__DECC) # 109 "/usr/local/include/SDL2/begin_code.h" #define SDL_INLINE __inline #ifndef __inline__ #define __inline__ __inline #endif # 113 "/usr/local/include/SDL2/begin_code.h" #else # 114 "/usr/local/include/SDL2/begin_code.h" #define SDL_INLINE inline #ifndef __inline__ #define __inline__ inline #endif # 118 "/usr/local/include/SDL2/begin_code.h" #endif # 119 "/usr/local/include/SDL2/begin_code.h" #endif /* SDL_INLINE not defined */ # 120 "/usr/local/include/SDL2/begin_code.h" #ifndef SDL_FORCE_INLINE #if defined(_MSC_VER) #define SDL_FORCE_INLINE __forceinline #elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) ) # 125 "/usr/local/include/SDL2/begin_code.h" #define SDL_FORCE_INLINE __attribute__((always_inline)) static __inline__ #else # 127 "/usr/local/include/SDL2/begin_code.h" #define SDL_FORCE_INLINE static SDL_INLINE #endif # 129 "/usr/local/include/SDL2/begin_code.h" #endif /* SDL_FORCE_INLINE not defined */ # 130 "/usr/local/include/SDL2/begin_code.h" /* Apparently this is needed by several Windows compilers */ #if !defined(__MACH__) #ifndef NULL #ifdef __cplusplus #define NULL 0 #else # 137 "/usr/local/include/SDL2/begin_code.h" #define NULL ((void *)0) #endif # 139 "/usr/local/include/SDL2/begin_code.h" #endif /* NULL */ # 140 "/usr/local/include/SDL2/begin_code.h" #endif /* ! Mac OS X - breaks precompiled headers */ # 141 "/usr/local/include/SDL2/begin_code.h" # 205 "/usr/local/include/SDL2/SDL_stdinc.h" 2 /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif # 209 "/usr/local/include/SDL2/SDL_stdinc.h" #if defined(HAVE_ALLOCA) && !defined(alloca) # if defined(HAVE_ALLOCA_H) #if 0 /* expanded by -frewrite-includes */ # include #endif /* expanded by -frewrite-includes */ # 212 "/usr/local/include/SDL2/SDL_stdinc.h" # 213 "/usr/local/include/SDL2/SDL_stdinc.h" # elif defined(__GNUC__) # 214 "/usr/local/include/SDL2/SDL_stdinc.h" # define alloca __builtin_alloca # elif defined(_MSC_VER) # 216 "/usr/local/include/SDL2/SDL_stdinc.h" #if 0 /* expanded by -frewrite-includes */ # include #endif /* expanded by -frewrite-includes */ # 216 "/usr/local/include/SDL2/SDL_stdinc.h" # 217 "/usr/local/include/SDL2/SDL_stdinc.h" # define alloca _alloca # elif defined(__WATCOMC__) # 219 "/usr/local/include/SDL2/SDL_stdinc.h" #if 0 /* expanded by -frewrite-includes */ # include #endif /* expanded by -frewrite-includes */ # 219 "/usr/local/include/SDL2/SDL_stdinc.h" # 220 "/usr/local/include/SDL2/SDL_stdinc.h" # elif defined(__BORLANDC__) # 221 "/usr/local/include/SDL2/SDL_stdinc.h" #if 0 /* expanded by -frewrite-includes */ # include #endif /* expanded by -frewrite-includes */ # 221 "/usr/local/include/SDL2/SDL_stdinc.h" # 222 "/usr/local/include/SDL2/SDL_stdinc.h" # elif defined(__DMC__) # 223 "/usr/local/include/SDL2/SDL_stdinc.h" #if 0 /* expanded by -frewrite-includes */ # include #endif /* expanded by -frewrite-includes */ # 223 "/usr/local/include/SDL2/SDL_stdinc.h" # 224 "/usr/local/include/SDL2/SDL_stdinc.h" # elif defined(__AIX__) # 225 "/usr/local/include/SDL2/SDL_stdinc.h" #pragma alloca # elif defined(__MRC__) # 227 "/usr/local/include/SDL2/SDL_stdinc.h" void *alloca(unsigned); # else # 229 "/usr/local/include/SDL2/SDL_stdinc.h" char *alloca(); # endif # 231 "/usr/local/include/SDL2/SDL_stdinc.h" #endif # 232 "/usr/local/include/SDL2/SDL_stdinc.h" #ifdef HAVE_ALLOCA #define SDL_stack_alloc(type, count) (type*)alloca(sizeof(type)*(count)) #define SDL_stack_free(data) #else # 236 "/usr/local/include/SDL2/SDL_stdinc.h" #define SDL_stack_alloc(type, count) (type*)SDL_malloc(sizeof(type)*(count)) #define SDL_stack_free(data) SDL_free(data) #endif # 239 "/usr/local/include/SDL2/SDL_stdinc.h" extern DECLSPEC void *SDLCALL SDL_malloc(size_t size); extern DECLSPEC void *SDLCALL SDL_calloc(size_t nmemb, size_t size); extern DECLSPEC void *SDLCALL SDL_realloc(void *mem, size_t size); extern DECLSPEC void SDLCALL SDL_free(void *mem); extern DECLSPEC char *SDLCALL SDL_getenv(const char *name); extern DECLSPEC int SDLCALL SDL_setenv(const char *name, const char *value, int overwrite); extern DECLSPEC void SDLCALL SDL_qsort(void *base, size_t nmemb, size_t size, int (*compare) (const void *, const void *)); extern DECLSPEC int SDLCALL SDL_abs(int x); /* !!! FIXME: these have side effects. You probably shouldn't use them. */ /* !!! FIXME: Maybe we do forceinline functions of SDL_mini, SDL_minf, etc? */ #define SDL_min(x, y) (((x) < (y)) ? (x) : (y)) #define SDL_max(x, y) (((x) > (y)) ? (x) : (y)) extern DECLSPEC int SDLCALL SDL_isdigit(int x); extern DECLSPEC int SDLCALL SDL_isspace(int x); extern DECLSPEC int SDLCALL SDL_toupper(int x); extern DECLSPEC int SDLCALL SDL_tolower(int x); extern DECLSPEC void *SDLCALL SDL_memset(void *dst, int c, size_t len); #define SDL_zero(x) SDL_memset(&(x), 0, sizeof((x))) #define SDL_zerop(x) SDL_memset((x), 0, sizeof(*(x))) /* Note that memset() is a byte assignment and this is a 32-bit assignment, so they're not directly equivalent. */ SDL_FORCE_INLINE void SDL_memset4(void *dst, Uint32 val, size_t dwords) { #if defined(__GNUC__) && defined(i386) int u0, u1, u2; __asm__ __volatile__ ( "cld \n\t" "rep ; stosl \n\t" : "=&D" (u0), "=&a" (u1), "=&c" (u2) : "0" (dst), "1" (val), "2" (SDL_static_cast(Uint32, dwords)) : "memory" ); #else # 280 "/usr/local/include/SDL2/SDL_stdinc.h" size_t _n = (dwords + 3) / 4; Uint32 *_p = SDL_static_cast(Uint32 *, dst); Uint32 _val = (val); if (dwords == 0) return; switch (dwords % 4) { case 0: do { *_p++ = _val; case 3: *_p++ = _val; case 2: *_p++ = _val; case 1: *_p++ = _val; } while ( --_n ); } #endif # 294 "/usr/local/include/SDL2/SDL_stdinc.h" } extern DECLSPEC void *SDLCALL SDL_memcpy(void *dst, const void *src, size_t len); SDL_FORCE_INLINE void *SDL_memcpy4(void *dst, const void *src, size_t dwords) { return SDL_memcpy(dst, src, dwords * 4); } extern DECLSPEC void *SDLCALL SDL_memmove(void *dst, const void *src, size_t len); extern DECLSPEC int SDLCALL SDL_memcmp(const void *s1, const void *s2, size_t len); extern DECLSPEC size_t SDLCALL SDL_wcslen(const wchar_t *wstr); extern DECLSPEC size_t SDLCALL SDL_wcslcpy(wchar_t *dst, const wchar_t *src, size_t maxlen); extern DECLSPEC size_t SDLCALL SDL_wcslcat(wchar_t *dst, const wchar_t *src, size_t maxlen); extern DECLSPEC size_t SDLCALL SDL_strlen(const char *str); extern DECLSPEC size_t SDLCALL SDL_strlcpy(char *dst, const char *src, size_t maxlen); extern DECLSPEC size_t SDLCALL SDL_utf8strlcpy(char *dst, const char *src, size_t dst_bytes); extern DECLSPEC size_t SDLCALL SDL_strlcat(char *dst, const char *src, size_t maxlen); extern DECLSPEC char *SDLCALL SDL_strdup(const char *str); extern DECLSPEC char *SDLCALL SDL_strrev(char *str); extern DECLSPEC char *SDLCALL SDL_strupr(char *str); extern DECLSPEC char *SDLCALL SDL_strlwr(char *str); extern DECLSPEC char *SDLCALL SDL_strchr(const char *str, int c); extern DECLSPEC char *SDLCALL SDL_strrchr(const char *str, int c); extern DECLSPEC char *SDLCALL SDL_strstr(const char *haystack, const char *needle); extern DECLSPEC char *SDLCALL SDL_itoa(int value, char *str, int radix); extern DECLSPEC char *SDLCALL SDL_uitoa(unsigned int value, char *str, int radix); extern DECLSPEC char *SDLCALL SDL_ltoa(long value, char *str, int radix); extern DECLSPEC char *SDLCALL SDL_ultoa(unsigned long value, char *str, int radix); extern DECLSPEC char *SDLCALL SDL_lltoa(Sint64 value, char *str, int radix); extern DECLSPEC char *SDLCALL SDL_ulltoa(Uint64 value, char *str, int radix); extern DECLSPEC int SDLCALL SDL_atoi(const char *str); extern DECLSPEC double SDLCALL SDL_atof(const char *str); extern DECLSPEC long SDLCALL SDL_strtol(const char *str, char **endp, int base); extern DECLSPEC unsigned long SDLCALL SDL_strtoul(const char *str, char **endp, int base); extern DECLSPEC Sint64 SDLCALL SDL_strtoll(const char *str, char **endp, int base); extern DECLSPEC Uint64 SDLCALL SDL_strtoull(const char *str, char **endp, int base); extern DECLSPEC double SDLCALL SDL_strtod(const char *str, char **endp); extern DECLSPEC int SDLCALL SDL_strcmp(const char *str1, const char *str2); extern DECLSPEC int SDLCALL SDL_strncmp(const char *str1, const char *str2, size_t maxlen); extern DECLSPEC int SDLCALL SDL_strcasecmp(const char *str1, const char *str2); extern DECLSPEC int SDLCALL SDL_strncasecmp(const char *str1, const char *str2, size_t len); extern DECLSPEC int SDLCALL SDL_sscanf(const char *text, const char *fmt, ...); extern DECLSPEC int SDLCALL SDL_vsscanf(const char *text, const char *fmt, va_list ap); extern DECLSPEC int SDLCALL SDL_snprintf(char *text, size_t maxlen, const char *fmt, ...); extern DECLSPEC int SDLCALL SDL_vsnprintf(char *text, size_t maxlen, const char *fmt, va_list ap); #ifndef HAVE_M_PI #ifndef M_PI #define M_PI 3.14159265358979323846264338327950288 /* pi */ #endif # 352 "/usr/local/include/SDL2/SDL_stdinc.h" #endif # 353 "/usr/local/include/SDL2/SDL_stdinc.h" extern DECLSPEC double SDLCALL SDL_acos(double x); extern DECLSPEC double SDLCALL SDL_asin(double x); extern DECLSPEC double SDLCALL SDL_atan(double x); extern DECLSPEC double SDLCALL SDL_atan2(double x, double y); extern DECLSPEC double SDLCALL SDL_ceil(double x); extern DECLSPEC double SDLCALL SDL_copysign(double x, double y); extern DECLSPEC double SDLCALL SDL_cos(double x); extern DECLSPEC float SDLCALL SDL_cosf(float x); extern DECLSPEC double SDLCALL SDL_fabs(double x); extern DECLSPEC double SDLCALL SDL_floor(double x); extern DECLSPEC double SDLCALL SDL_log(double x); extern DECLSPEC double SDLCALL SDL_pow(double x, double y); extern DECLSPEC double SDLCALL SDL_scalbn(double x, int n); extern DECLSPEC double SDLCALL SDL_sin(double x); extern DECLSPEC float SDLCALL SDL_sinf(float x); extern DECLSPEC double SDLCALL SDL_sqrt(double x); /* The SDL implementation of iconv() returns these error codes */ #define SDL_ICONV_ERROR (size_t)-1 #define SDL_ICONV_E2BIG (size_t)-2 #define SDL_ICONV_EILSEQ (size_t)-3 #define SDL_ICONV_EINVAL (size_t)-4 /* SDL_iconv_* are now always real symbols/types, not macros or inlined. */ typedef struct _SDL_iconv_t *SDL_iconv_t; extern DECLSPEC SDL_iconv_t SDLCALL SDL_iconv_open(const char *tocode, const char *fromcode); extern DECLSPEC int SDLCALL SDL_iconv_close(SDL_iconv_t cd); extern DECLSPEC size_t SDLCALL SDL_iconv(SDL_iconv_t cd, const char **inbuf, size_t * inbytesleft, char **outbuf, size_t * outbytesleft); /** * This function converts a string between encodings in one pass, returning a * string that must be freed with SDL_free() or NULL on error. */ extern DECLSPEC char *SDLCALL SDL_iconv_string(const char *tocode, const char *fromcode, const char *inbuf, size_t inbytesleft); #define SDL_iconv_utf8_locale(S) SDL_iconv_string("", "UTF-8", S, SDL_strlen(S)+1) #define SDL_iconv_utf8_ucs2(S) (Uint16 *)SDL_iconv_string("UCS-2-INTERNAL", "UTF-8", S, SDL_strlen(S)+1) #define SDL_iconv_utf8_ucs4(S) (Uint32 *)SDL_iconv_string("UCS-4-INTERNAL", "UTF-8", S, SDL_strlen(S)+1) /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif # 401 "/usr/local/include/SDL2/SDL_stdinc.h" #if 0 /* expanded by -frewrite-includes */ #include "close_code.h" #endif /* expanded by -frewrite-includes */ # 401 "/usr/local/include/SDL2/SDL_stdinc.h" # 1 "/usr/local/include/SDL2/close_code.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file close_code.h * * This file reverses the effects of begin_code.h and should be included * after you finish any function and structure declarations in your headers */ #undef _begin_code_h /* Reset structure packing at previous byte alignment */ #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__WATCOMC__) || defined(__BORLANDC__) #ifdef __BORLANDC__ #pragma nopackwarning #endif # 36 "/usr/local/include/SDL2/close_code.h" #pragma pack(pop) #endif /* Compiler needs structure packing set */ # 38 "/usr/local/include/SDL2/close_code.h" # 402 "/usr/local/include/SDL2/SDL_stdinc.h" 2 #endif /* _SDL_stdinc_h */ # 404 "/usr/local/include/SDL2/SDL_stdinc.h" /* vi: set ts=4 sw=4 expandtab: */ # 26 "/usr/local/include/SDL2/SDL_main.h" 2 /** * \file SDL_main.h * * Redefine main() on some platforms so that it is called by SDL. */ #ifndef SDL_MAIN_HANDLED #if defined(__WIN32__) /* On Windows SDL provides WinMain(), which parses the command line and passes the arguments to your main function. If you provide your own WinMain(), you may define SDL_MAIN_HANDLED */ #define SDL_MAIN_AVAILABLE #elif defined(__WINRT__) # 43 "/usr/local/include/SDL2/SDL_main.h" /* On WinRT, SDL provides a main function that initializes CoreApplication, creating an instance of IFrameworkView in the process. Please note that #include'ing SDL_main.h is not enough to get a main() function working. In non-XAML apps, the file, src/main/winrt/SDL_WinRT_main_NonXAML.cpp, or a copy of it, must be compiled into the app itself. In XAML apps, the function, SDL_WinRTRunApp must be called, with a pointer to the Direct3D-hosted XAML control passed in. */ #define SDL_MAIN_NEEDED #elif defined(__IPHONEOS__) # 55 "/usr/local/include/SDL2/SDL_main.h" /* On iOS SDL provides a main function that creates an application delegate and starts the iOS application run loop. See src/video/uikit/SDL_uikitappdelegate.m for more details. */ #define SDL_MAIN_NEEDED #elif defined(__ANDROID__) # 63 "/usr/local/include/SDL2/SDL_main.h" /* On Android SDL provides a Java class in SDLActivity.java that is the main activity entry point. See README-android.txt for more details on extending that class. */ #define SDL_MAIN_NEEDED #endif # 71 "/usr/local/include/SDL2/SDL_main.h" #endif /* SDL_MAIN_HANDLED */ # 72 "/usr/local/include/SDL2/SDL_main.h" #ifdef __cplusplus #define C_LINKAGE "C" #else # 76 "/usr/local/include/SDL2/SDL_main.h" #define C_LINKAGE #endif /* __cplusplus */ # 78 "/usr/local/include/SDL2/SDL_main.h" /** * \file SDL_main.h * * The application's main() function must be called with C linkage, * and should be declared like this: * \code * #ifdef __cplusplus * extern "C" * #endif * int main(int argc, char *argv[]) * { * } * \endcode */ #if defined(SDL_MAIN_NEEDED) || defined(SDL_MAIN_AVAILABLE) #define main SDL_main #endif # 97 "/usr/local/include/SDL2/SDL_main.h" /** * The prototype for the application's main() function */ extern C_LINKAGE int SDL_main(int argc, char *argv[]); #if 0 /* expanded by -frewrite-includes */ #include "begin_code.h" #endif /* expanded by -frewrite-includes */ # 104 "/usr/local/include/SDL2/SDL_main.h" # 1 "/usr/local/include/SDL2/begin_code.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file begin_code.h * * This file sets things up for C dynamic library function definitions, * static inlined functions, and structures aligned at 4-byte alignment. * If you don't like ugly C preprocessor code, don't look at this file. :) */ /* This shouldn't be nested -- included it around code only. */ #ifdef _begin_code_h #error Nested inclusion of begin_code.h #endif # 34 "/usr/local/include/SDL2/begin_code.h" #define _begin_code_h #ifndef SDL_DEPRECATED # if (__GNUC__ >= 4) /* technically, this arrived in gcc 3.1, but oh well. */ # define SDL_DEPRECATED __attribute__((deprecated)) # else # 40 "/usr/local/include/SDL2/begin_code.h" # define SDL_DEPRECATED # endif # 42 "/usr/local/include/SDL2/begin_code.h" #endif # 43 "/usr/local/include/SDL2/begin_code.h" /* Some compilers use a special export keyword */ #ifndef DECLSPEC # if defined(__WIN32__) || defined(__WINRT__) # ifdef __BORLANDC__ # ifdef BUILD_SDL # define DECLSPEC # else # 51 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllimport) # endif # 53 "/usr/local/include/SDL2/begin_code.h" # else # 54 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllexport) # endif # 56 "/usr/local/include/SDL2/begin_code.h" # else # 57 "/usr/local/include/SDL2/begin_code.h" # if defined(__GNUC__) && __GNUC__ >= 4 # define DECLSPEC __attribute__ ((visibility("default"))) # elif defined(__GNUC__) && __GNUC__ >= 2 # 60 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllexport) # else # 62 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC # endif # 64 "/usr/local/include/SDL2/begin_code.h" # endif # 65 "/usr/local/include/SDL2/begin_code.h" #endif # 66 "/usr/local/include/SDL2/begin_code.h" /* By default SDL uses the C calling convention */ #ifndef SDLCALL #if (defined(__WIN32__) || defined(__WINRT__)) && !defined(__GNUC__) #define SDLCALL __cdecl #else # 72 "/usr/local/include/SDL2/begin_code.h" #define SDLCALL #endif # 74 "/usr/local/include/SDL2/begin_code.h" #endif /* SDLCALL */ # 75 "/usr/local/include/SDL2/begin_code.h" /* Removed DECLSPEC on Symbian OS because SDL cannot be a DLL in EPOC */ #ifdef __SYMBIAN32__ #undef DECLSPEC #define DECLSPEC #endif /* __SYMBIAN32__ */ # 81 "/usr/local/include/SDL2/begin_code.h" /* Force structure packing at 4 byte alignment. This is necessary if the header is included in code which has structure packing set to an alternate value, say for loading structures from disk. The packing is reset to the previous value in close_code.h */ #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__) #ifdef _MSC_VER #pragma warning(disable: 4103) #endif # 91 "/usr/local/include/SDL2/begin_code.h" #ifdef __BORLANDC__ #pragma nopackwarning #endif # 94 "/usr/local/include/SDL2/begin_code.h" #ifdef _M_X64 /* Use 8-byte alignment on 64-bit architectures, so pointers are aligned */ #pragma pack(push,8) #else # 98 "/usr/local/include/SDL2/begin_code.h" #pragma pack(push,4) #endif # 100 "/usr/local/include/SDL2/begin_code.h" #endif /* Compiler needs structure packing set */ # 101 "/usr/local/include/SDL2/begin_code.h" #ifndef SDL_INLINE #if defined(__GNUC__) #define SDL_INLINE __inline__ #elif defined(_MSC_VER) || defined(__BORLANDC__) || \ defined(__DMC__) || defined(__SC__) || \ defined(__WATCOMC__) || defined(__LCC__) || \ defined(__DECC) # 109 "/usr/local/include/SDL2/begin_code.h" #define SDL_INLINE __inline #ifndef __inline__ #define __inline__ __inline #endif # 113 "/usr/local/include/SDL2/begin_code.h" #else # 114 "/usr/local/include/SDL2/begin_code.h" #define SDL_INLINE inline #ifndef __inline__ #define __inline__ inline #endif # 118 "/usr/local/include/SDL2/begin_code.h" #endif # 119 "/usr/local/include/SDL2/begin_code.h" #endif /* SDL_INLINE not defined */ # 120 "/usr/local/include/SDL2/begin_code.h" #ifndef SDL_FORCE_INLINE #if defined(_MSC_VER) #define SDL_FORCE_INLINE __forceinline #elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) ) # 125 "/usr/local/include/SDL2/begin_code.h" #define SDL_FORCE_INLINE __attribute__((always_inline)) static __inline__ #else # 127 "/usr/local/include/SDL2/begin_code.h" #define SDL_FORCE_INLINE static SDL_INLINE #endif # 129 "/usr/local/include/SDL2/begin_code.h" #endif /* SDL_FORCE_INLINE not defined */ # 130 "/usr/local/include/SDL2/begin_code.h" /* Apparently this is needed by several Windows compilers */ #if !defined(__MACH__) #ifndef NULL #ifdef __cplusplus #define NULL 0 #else # 137 "/usr/local/include/SDL2/begin_code.h" #define NULL ((void *)0) #endif # 139 "/usr/local/include/SDL2/begin_code.h" #endif /* NULL */ # 140 "/usr/local/include/SDL2/begin_code.h" #endif /* ! Mac OS X - breaks precompiled headers */ # 141 "/usr/local/include/SDL2/begin_code.h" # 105 "/usr/local/include/SDL2/SDL_main.h" 2 #ifdef __cplusplus extern "C" { #endif # 108 "/usr/local/include/SDL2/SDL_main.h" /** * This is called by the real SDL main function to let the rest of the * library know that initialization was done properly. * * Calling this yourself without knowing what you're doing can cause * crashes and hard to diagnose problems with your application. */ extern DECLSPEC void SDLCALL SDL_SetMainReady(void); #ifdef __WIN32__ /** * This can be called to set the application class at startup */ extern DECLSPEC int SDLCALL SDL_RegisterApp(char *name, Uint32 style, void *hInst); extern DECLSPEC void SDLCALL SDL_UnregisterApp(void); #endif /* __WIN32__ */ # 128 "/usr/local/include/SDL2/SDL_main.h" #ifdef __WINRT__ /** * \brief Initializes and launches an SDL/WinRT application. * * \param mainFunction The SDL app's C-style main(). * \param xamlBackgroundPanel An optional, XAML-based, background panel. * For Non-XAML apps, this value must be set to NULL. For XAML apps, * pass in a pointer to a SwapChainBackgroundPanel, casted to an * IInspectable (via reinterpret_cast). * \ret 0 on success, -1 on failure. On failure, use SDL_GetError to retrieve more * information on the failure. */ extern DECLSPEC int SDLCALL SDL_WinRTRunApp(int (*mainFunction)(int, char **), void * xamlBackgroundPanel); #endif /* __WINRT__ */ # 146 "/usr/local/include/SDL2/SDL_main.h" #ifdef __cplusplus } #endif # 151 "/usr/local/include/SDL2/SDL_main.h" #if 0 /* expanded by -frewrite-includes */ #include "close_code.h" #endif /* expanded by -frewrite-includes */ # 151 "/usr/local/include/SDL2/SDL_main.h" # 1 "/usr/local/include/SDL2/close_code.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file close_code.h * * This file reverses the effects of begin_code.h and should be included * after you finish any function and structure declarations in your headers */ #undef _begin_code_h /* Reset structure packing at previous byte alignment */ #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__WATCOMC__) || defined(__BORLANDC__) #ifdef __BORLANDC__ #pragma nopackwarning #endif # 36 "/usr/local/include/SDL2/close_code.h" #pragma pack(pop) #endif /* Compiler needs structure packing set */ # 38 "/usr/local/include/SDL2/close_code.h" # 152 "/usr/local/include/SDL2/SDL_main.h" 2 #endif /* _SDL_main_h */ # 154 "/usr/local/include/SDL2/SDL_main.h" /* vi: set ts=4 sw=4 expandtab: */ # 68 "/usr/local/include/SDL2/SDL.h" 2 #if 0 /* expanded by -frewrite-includes */ #include "SDL_stdinc.h" #endif /* expanded by -frewrite-includes */ # 68 "/usr/local/include/SDL2/SDL.h" # 69 "/usr/local/include/SDL2/SDL.h" #if 0 /* expanded by -frewrite-includes */ #include "SDL_assert.h" #endif /* expanded by -frewrite-includes */ # 69 "/usr/local/include/SDL2/SDL.h" # 1 "/usr/local/include/SDL2/SDL_assert.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #ifndef _SDL_assert_h #define _SDL_assert_h #if 0 /* expanded by -frewrite-includes */ #include "SDL_config.h" #endif /* expanded by -frewrite-includes */ # 25 "/usr/local/include/SDL2/SDL_assert.h" # 26 "/usr/local/include/SDL2/SDL_assert.h" #if 0 /* expanded by -frewrite-includes */ #include "begin_code.h" #endif /* expanded by -frewrite-includes */ # 27 "/usr/local/include/SDL2/SDL_assert.h" # 1 "/usr/local/include/SDL2/begin_code.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file begin_code.h * * This file sets things up for C dynamic library function definitions, * static inlined functions, and structures aligned at 4-byte alignment. * If you don't like ugly C preprocessor code, don't look at this file. :) */ /* This shouldn't be nested -- included it around code only. */ #ifdef _begin_code_h #error Nested inclusion of begin_code.h #endif # 34 "/usr/local/include/SDL2/begin_code.h" #define _begin_code_h #ifndef SDL_DEPRECATED # if (__GNUC__ >= 4) /* technically, this arrived in gcc 3.1, but oh well. */ # define SDL_DEPRECATED __attribute__((deprecated)) # else # 40 "/usr/local/include/SDL2/begin_code.h" # define SDL_DEPRECATED # endif # 42 "/usr/local/include/SDL2/begin_code.h" #endif # 43 "/usr/local/include/SDL2/begin_code.h" /* Some compilers use a special export keyword */ #ifndef DECLSPEC # if defined(__WIN32__) || defined(__WINRT__) # ifdef __BORLANDC__ # ifdef BUILD_SDL # define DECLSPEC # else # 51 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllimport) # endif # 53 "/usr/local/include/SDL2/begin_code.h" # else # 54 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllexport) # endif # 56 "/usr/local/include/SDL2/begin_code.h" # else # 57 "/usr/local/include/SDL2/begin_code.h" # if defined(__GNUC__) && __GNUC__ >= 4 # define DECLSPEC __attribute__ ((visibility("default"))) # elif defined(__GNUC__) && __GNUC__ >= 2 # 60 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllexport) # else # 62 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC # endif # 64 "/usr/local/include/SDL2/begin_code.h" # endif # 65 "/usr/local/include/SDL2/begin_code.h" #endif # 66 "/usr/local/include/SDL2/begin_code.h" /* By default SDL uses the C calling convention */ #ifndef SDLCALL #if (defined(__WIN32__) || defined(__WINRT__)) && !defined(__GNUC__) #define SDLCALL __cdecl #else # 72 "/usr/local/include/SDL2/begin_code.h" #define SDLCALL #endif # 74 "/usr/local/include/SDL2/begin_code.h" #endif /* SDLCALL */ # 75 "/usr/local/include/SDL2/begin_code.h" /* Removed DECLSPEC on Symbian OS because SDL cannot be a DLL in EPOC */ #ifdef __SYMBIAN32__ #undef DECLSPEC #define DECLSPEC #endif /* __SYMBIAN32__ */ # 81 "/usr/local/include/SDL2/begin_code.h" /* Force structure packing at 4 byte alignment. This is necessary if the header is included in code which has structure packing set to an alternate value, say for loading structures from disk. The packing is reset to the previous value in close_code.h */ #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__) #ifdef _MSC_VER #pragma warning(disable: 4103) #endif # 91 "/usr/local/include/SDL2/begin_code.h" #ifdef __BORLANDC__ #pragma nopackwarning #endif # 94 "/usr/local/include/SDL2/begin_code.h" #ifdef _M_X64 /* Use 8-byte alignment on 64-bit architectures, so pointers are aligned */ #pragma pack(push,8) #else # 98 "/usr/local/include/SDL2/begin_code.h" #pragma pack(push,4) #endif # 100 "/usr/local/include/SDL2/begin_code.h" #endif /* Compiler needs structure packing set */ # 101 "/usr/local/include/SDL2/begin_code.h" #ifndef SDL_INLINE #if defined(__GNUC__) #define SDL_INLINE __inline__ #elif defined(_MSC_VER) || defined(__BORLANDC__) || \ defined(__DMC__) || defined(__SC__) || \ defined(__WATCOMC__) || defined(__LCC__) || \ defined(__DECC) # 109 "/usr/local/include/SDL2/begin_code.h" #define SDL_INLINE __inline #ifndef __inline__ #define __inline__ __inline #endif # 113 "/usr/local/include/SDL2/begin_code.h" #else # 114 "/usr/local/include/SDL2/begin_code.h" #define SDL_INLINE inline #ifndef __inline__ #define __inline__ inline #endif # 118 "/usr/local/include/SDL2/begin_code.h" #endif # 119 "/usr/local/include/SDL2/begin_code.h" #endif /* SDL_INLINE not defined */ # 120 "/usr/local/include/SDL2/begin_code.h" #ifndef SDL_FORCE_INLINE #if defined(_MSC_VER) #define SDL_FORCE_INLINE __forceinline #elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) ) # 125 "/usr/local/include/SDL2/begin_code.h" #define SDL_FORCE_INLINE __attribute__((always_inline)) static __inline__ #else # 127 "/usr/local/include/SDL2/begin_code.h" #define SDL_FORCE_INLINE static SDL_INLINE #endif # 129 "/usr/local/include/SDL2/begin_code.h" #endif /* SDL_FORCE_INLINE not defined */ # 130 "/usr/local/include/SDL2/begin_code.h" /* Apparently this is needed by several Windows compilers */ #if !defined(__MACH__) #ifndef NULL #ifdef __cplusplus #define NULL 0 #else # 137 "/usr/local/include/SDL2/begin_code.h" #define NULL ((void *)0) #endif # 139 "/usr/local/include/SDL2/begin_code.h" #endif /* NULL */ # 140 "/usr/local/include/SDL2/begin_code.h" #endif /* ! Mac OS X - breaks precompiled headers */ # 141 "/usr/local/include/SDL2/begin_code.h" # 28 "/usr/local/include/SDL2/SDL_assert.h" 2 /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif # 32 "/usr/local/include/SDL2/SDL_assert.h" #ifndef SDL_ASSERT_LEVEL #ifdef SDL_DEFAULT_ASSERT_LEVEL #define SDL_ASSERT_LEVEL SDL_DEFAULT_ASSERT_LEVEL #elif defined(_DEBUG) || defined(DEBUG) || \ (defined(__GNUC__) && !defined(__OPTIMIZE__)) # 38 "/usr/local/include/SDL2/SDL_assert.h" #define SDL_ASSERT_LEVEL 2 #else # 40 "/usr/local/include/SDL2/SDL_assert.h" #define SDL_ASSERT_LEVEL 1 #endif # 42 "/usr/local/include/SDL2/SDL_assert.h" #endif /* SDL_ASSERT_LEVEL */ # 43 "/usr/local/include/SDL2/SDL_assert.h" /* These are macros and not first class functions so that the debugger breaks on the assertion line and not in some random guts of SDL, and so each assert can have unique static variables associated with it. */ #if defined(_MSC_VER) /* Don't include intrin.h here because it contains C++ code */ extern void __cdecl __debugbreak(void); #define SDL_TriggerBreakpoint() __debugbreak() #elif (defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))) # 55 "/usr/local/include/SDL2/SDL_assert.h" #define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "int $3\n\t" ) #elif defined(HAVE_SIGNAL_H) # 57 "/usr/local/include/SDL2/SDL_assert.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 57 "/usr/local/include/SDL2/SDL_assert.h" # 58 "/usr/local/include/SDL2/SDL_assert.h" #define SDL_TriggerBreakpoint() raise(SIGTRAP) #else # 60 "/usr/local/include/SDL2/SDL_assert.h" /* How do we trigger breakpoints on this platform? */ #define SDL_TriggerBreakpoint() #endif # 63 "/usr/local/include/SDL2/SDL_assert.h" #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 supports __func__ as a standard. */ # define SDL_FUNCTION __func__ #elif ((__GNUC__ >= 2) || defined(_MSC_VER)) # 67 "/usr/local/include/SDL2/SDL_assert.h" # define SDL_FUNCTION __FUNCTION__ #else # 69 "/usr/local/include/SDL2/SDL_assert.h" # define SDL_FUNCTION "???" #endif # 71 "/usr/local/include/SDL2/SDL_assert.h" #define SDL_FILE __FILE__ #define SDL_LINE __LINE__ /* sizeof (x) makes the compiler still parse the expression even without assertions enabled, so the code is always checked at compile time, but doesn't actually generate code for it, so there are no side effects or expensive checks at run time, just the constant size of what x WOULD be, which presumably gets optimized out as unused. This also solves the problem of... int somevalue = blah(); SDL_assert(somevalue == 1); ...which would cause compiles to complain that somevalue is unused if we disable assertions. */ #ifdef _MSC_VER /* stupid /W4 warnings. */ #define SDL_NULL_WHILE_LOOP_CONDITION (-1 == __LINE__) #else # 92 "/usr/local/include/SDL2/SDL_assert.h" #define SDL_NULL_WHILE_LOOP_CONDITION (0) #endif # 94 "/usr/local/include/SDL2/SDL_assert.h" #define SDL_disabled_assert(condition) \ do { (void) sizeof ((condition)); } while (SDL_NULL_WHILE_LOOP_CONDITION) typedef enum { SDL_ASSERTION_RETRY, /**< Retry the assert immediately. */ SDL_ASSERTION_BREAK, /**< Make the debugger trigger a breakpoint. */ SDL_ASSERTION_ABORT, /**< Terminate the program. */ SDL_ASSERTION_IGNORE, /**< Ignore the assert. */ SDL_ASSERTION_ALWAYS_IGNORE /**< Ignore the assert from now on. */ } SDL_assert_state; typedef struct SDL_assert_data { int always_ignore; unsigned int trigger_count; const char *condition; const char *filename; int linenum; const char *function; const struct SDL_assert_data *next; } SDL_assert_data; #if (SDL_ASSERT_LEVEL > 0) /* Never call this directly. Use the SDL_assert* macros. */ extern DECLSPEC SDL_assert_state SDLCALL SDL_ReportAssertion(SDL_assert_data *, const char *, const char *, int) #if defined(__clang__) #if __has_feature(attribute_analyzer_noreturn) /* this tells Clang's static analysis that we're a custom assert function, and that the analyzer should assume the condition was always true past this SDL_assert test. */ __attribute__((analyzer_noreturn)) #endif # 131 "/usr/local/include/SDL2/SDL_assert.h" #endif # 132 "/usr/local/include/SDL2/SDL_assert.h" ; /* the do {} while(0) avoids dangling else problems: if (x) SDL_assert(y); else blah(); ... without the do/while, the "else" could attach to this macro's "if". We try to handle just the minimum we need here in a macro...the loop, the static vars, and break points. The heavy lifting is handled in SDL_ReportAssertion(), in SDL_assert.c. */ #define SDL_enabled_assert(condition) \ do { \ while ( !(condition) ) { \ static struct SDL_assert_data assert_data = { \ 0, 0, #condition, 0, 0, 0, 0 \ }; \ const SDL_assert_state state = SDL_ReportAssertion(&assert_data, \ SDL_FUNCTION, \ SDL_FILE, \ SDL_LINE); \ if (state == SDL_ASSERTION_RETRY) { \ continue; /* go again. */ \ } else if (state == SDL_ASSERTION_BREAK) { \ SDL_TriggerBreakpoint(); \ } \ break; /* not retrying. */ \ } \ } while (SDL_NULL_WHILE_LOOP_CONDITION) #endif /* enabled assertions support code */ # 161 "/usr/local/include/SDL2/SDL_assert.h" /* Enable various levels of assertions. */ #if SDL_ASSERT_LEVEL == 0 /* assertions disabled */ # define SDL_assert(condition) SDL_disabled_assert(condition) # define SDL_assert_release(condition) SDL_disabled_assert(condition) # define SDL_assert_paranoid(condition) SDL_disabled_assert(condition) #elif SDL_ASSERT_LEVEL == 1 /* release settings. */ # 168 "/usr/local/include/SDL2/SDL_assert.h" # define SDL_assert(condition) SDL_disabled_assert(condition) # define SDL_assert_release(condition) SDL_enabled_assert(condition) # define SDL_assert_paranoid(condition) SDL_disabled_assert(condition) #elif SDL_ASSERT_LEVEL == 2 /* normal settings. */ # 172 "/usr/local/include/SDL2/SDL_assert.h" # define SDL_assert(condition) SDL_enabled_assert(condition) # define SDL_assert_release(condition) SDL_enabled_assert(condition) # define SDL_assert_paranoid(condition) SDL_disabled_assert(condition) #elif SDL_ASSERT_LEVEL == 3 /* paranoid settings. */ # 176 "/usr/local/include/SDL2/SDL_assert.h" # define SDL_assert(condition) SDL_enabled_assert(condition) # define SDL_assert_release(condition) SDL_enabled_assert(condition) # define SDL_assert_paranoid(condition) SDL_enabled_assert(condition) #else # 180 "/usr/local/include/SDL2/SDL_assert.h" # error Unknown assertion level. #endif # 182 "/usr/local/include/SDL2/SDL_assert.h" /* this assertion is never disabled at any level. */ #define SDL_assert_always(condition) SDL_enabled_assert(condition) typedef SDL_assert_state (SDLCALL *SDL_AssertionHandler)( const SDL_assert_data* data, void* userdata); /** * \brief Set an application-defined assertion handler. * * This allows an app to show its own assertion UI and/or force the * response to an assertion failure. If the app doesn't provide this, SDL * will try to do the right thing, popping up a system-specific GUI dialog, * and probably minimizing any fullscreen windows. * * This callback may fire from any thread, but it runs wrapped in a mutex, so * it will only fire from one thread at a time. * * Setting the callback to NULL restores SDL's original internal handler. * * This callback is NOT reset to SDL's internal handler upon SDL_Quit()! * * \return SDL_assert_state value of how to handle the assertion failure. * * \param handler Callback function, called when an assertion fails. * \param userdata A pointer passed to the callback as-is. */ extern DECLSPEC void SDLCALL SDL_SetAssertionHandler( SDL_AssertionHandler handler, void *userdata); /** * \brief Get the default assertion handler. * * This returns the function pointer that is called by default when an * assertion is triggered. This is an internal function provided by SDL, * that is used for assertions when SDL_SetAssertionHandler() hasn't been * used to provide a different function. * * \return The default SDL_AssertionHandler that is called when an assert triggers. */ extern DECLSPEC SDL_AssertionHandler SDLCALL SDL_GetDefaultAssertionHandler(void); /** * \brief Get the current assertion handler. * * This returns the function pointer that is called when an assertion is * triggered. This is either the value last passed to * SDL_SetAssertionHandler(), or if no application-specified function is * set, is equivalent to calling SDL_GetDefaultAssertionHandler(). * * \param puserdata Pointer to a void*, which will store the "userdata" * pointer that was passed to SDL_SetAssertionHandler(). * This value will always be NULL for the default handler. * If you don't care about this data, it is safe to pass * a NULL pointer to this function to ignore it. * \return The SDL_AssertionHandler that is called when an assert triggers. */ extern DECLSPEC SDL_AssertionHandler SDLCALL SDL_GetAssertionHandler(void **puserdata); /** * \brief Get a list of all assertion failures. * * Get all assertions triggered since last call to SDL_ResetAssertionReport(), * or the start of the program. * * The proper way to examine this data looks something like this: * * * const SDL_assert_data *item = SDL_GetAssertionReport(); * while (item) { * printf("'%s', %s (%s:%d), triggered %u times, always ignore: %s.\n", * item->condition, item->function, item->filename, * item->linenum, item->trigger_count, * item->always_ignore ? "yes" : "no"); * item = item->next; * } * * * \return List of all assertions. * \sa SDL_ResetAssertionReport */ extern DECLSPEC const SDL_assert_data * SDLCALL SDL_GetAssertionReport(void); /** * \brief Reset the list of all assertion failures. * * Reset list of all assertions triggered. * * \sa SDL_GetAssertionReport */ extern DECLSPEC void SDLCALL SDL_ResetAssertionReport(void); /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif # 280 "/usr/local/include/SDL2/SDL_assert.h" #if 0 /* expanded by -frewrite-includes */ #include "close_code.h" #endif /* expanded by -frewrite-includes */ # 280 "/usr/local/include/SDL2/SDL_assert.h" # 1 "/usr/local/include/SDL2/close_code.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file close_code.h * * This file reverses the effects of begin_code.h and should be included * after you finish any function and structure declarations in your headers */ #undef _begin_code_h /* Reset structure packing at previous byte alignment */ #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__WATCOMC__) || defined(__BORLANDC__) #ifdef __BORLANDC__ #pragma nopackwarning #endif # 36 "/usr/local/include/SDL2/close_code.h" #pragma pack(pop) #endif /* Compiler needs structure packing set */ # 38 "/usr/local/include/SDL2/close_code.h" # 281 "/usr/local/include/SDL2/SDL_assert.h" 2 #endif /* _SDL_assert_h */ # 283 "/usr/local/include/SDL2/SDL_assert.h" /* vi: set ts=4 sw=4 expandtab: */ # 70 "/usr/local/include/SDL2/SDL.h" 2 #if 0 /* expanded by -frewrite-includes */ #include "SDL_atomic.h" #endif /* expanded by -frewrite-includes */ # 70 "/usr/local/include/SDL2/SDL.h" # 1 "/usr/local/include/SDL2/SDL_atomic.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file SDL_atomic.h * * Atomic operations. * * IMPORTANT: * If you are not an expert in concurrent lockless programming, you should * only be using the atomic lock and reference counting functions in this * file. In all other cases you should be protecting your data structures * with full mutexes. * * The list of "safe" functions to use are: * SDL_AtomicLock() * SDL_AtomicUnlock() * SDL_AtomicIncRef() * SDL_AtomicDecRef() * * Seriously, here be dragons! * ^^^^^^^^^^^^^^^^^^^^^^^^^^^ * * You can find out a little more about lockless programming and the * subtle issues that can arise here: * http://msdn.microsoft.com/en-us/library/ee418650%28v=vs.85%29.aspx * * There's also lots of good information here: * http://www.1024cores.net/home/lock-free-algorithms * http://preshing.com/ * * These operations may or may not actually be implemented using * processor specific atomic operations. When possible they are * implemented as true processor specific atomic operations. When that * is not possible the are implemented using locks that *do* use the * available atomic operations. * * All of the atomic operations that modify memory are full memory barriers. */ #ifndef _SDL_atomic_h_ #define _SDL_atomic_h_ #if 0 /* expanded by -frewrite-includes */ #include "SDL_stdinc.h" #endif /* expanded by -frewrite-includes */ # 62 "/usr/local/include/SDL2/SDL_atomic.h" # 63 "/usr/local/include/SDL2/SDL_atomic.h" #if 0 /* expanded by -frewrite-includes */ #include "SDL_platform.h" #endif /* expanded by -frewrite-includes */ # 63 "/usr/local/include/SDL2/SDL_atomic.h" # 64 "/usr/local/include/SDL2/SDL_atomic.h" #if 0 /* expanded by -frewrite-includes */ #include "begin_code.h" #endif /* expanded by -frewrite-includes */ # 65 "/usr/local/include/SDL2/SDL_atomic.h" # 1 "/usr/local/include/SDL2/begin_code.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file begin_code.h * * This file sets things up for C dynamic library function definitions, * static inlined functions, and structures aligned at 4-byte alignment. * If you don't like ugly C preprocessor code, don't look at this file. :) */ /* This shouldn't be nested -- included it around code only. */ #ifdef _begin_code_h #error Nested inclusion of begin_code.h #endif # 34 "/usr/local/include/SDL2/begin_code.h" #define _begin_code_h #ifndef SDL_DEPRECATED # if (__GNUC__ >= 4) /* technically, this arrived in gcc 3.1, but oh well. */ # define SDL_DEPRECATED __attribute__((deprecated)) # else # 40 "/usr/local/include/SDL2/begin_code.h" # define SDL_DEPRECATED # endif # 42 "/usr/local/include/SDL2/begin_code.h" #endif # 43 "/usr/local/include/SDL2/begin_code.h" /* Some compilers use a special export keyword */ #ifndef DECLSPEC # if defined(__WIN32__) || defined(__WINRT__) # ifdef __BORLANDC__ # ifdef BUILD_SDL # define DECLSPEC # else # 51 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllimport) # endif # 53 "/usr/local/include/SDL2/begin_code.h" # else # 54 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllexport) # endif # 56 "/usr/local/include/SDL2/begin_code.h" # else # 57 "/usr/local/include/SDL2/begin_code.h" # if defined(__GNUC__) && __GNUC__ >= 4 # define DECLSPEC __attribute__ ((visibility("default"))) # elif defined(__GNUC__) && __GNUC__ >= 2 # 60 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllexport) # else # 62 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC # endif # 64 "/usr/local/include/SDL2/begin_code.h" # endif # 65 "/usr/local/include/SDL2/begin_code.h" #endif # 66 "/usr/local/include/SDL2/begin_code.h" /* By default SDL uses the C calling convention */ #ifndef SDLCALL #if (defined(__WIN32__) || defined(__WINRT__)) && !defined(__GNUC__) #define SDLCALL __cdecl #else # 72 "/usr/local/include/SDL2/begin_code.h" #define SDLCALL #endif # 74 "/usr/local/include/SDL2/begin_code.h" #endif /* SDLCALL */ # 75 "/usr/local/include/SDL2/begin_code.h" /* Removed DECLSPEC on Symbian OS because SDL cannot be a DLL in EPOC */ #ifdef __SYMBIAN32__ #undef DECLSPEC #define DECLSPEC #endif /* __SYMBIAN32__ */ # 81 "/usr/local/include/SDL2/begin_code.h" /* Force structure packing at 4 byte alignment. This is necessary if the header is included in code which has structure packing set to an alternate value, say for loading structures from disk. The packing is reset to the previous value in close_code.h */ #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__) #ifdef _MSC_VER #pragma warning(disable: 4103) #endif # 91 "/usr/local/include/SDL2/begin_code.h" #ifdef __BORLANDC__ #pragma nopackwarning #endif # 94 "/usr/local/include/SDL2/begin_code.h" #ifdef _M_X64 /* Use 8-byte alignment on 64-bit architectures, so pointers are aligned */ #pragma pack(push,8) #else # 98 "/usr/local/include/SDL2/begin_code.h" #pragma pack(push,4) #endif # 100 "/usr/local/include/SDL2/begin_code.h" #endif /* Compiler needs structure packing set */ # 101 "/usr/local/include/SDL2/begin_code.h" #ifndef SDL_INLINE #if defined(__GNUC__) #define SDL_INLINE __inline__ #elif defined(_MSC_VER) || defined(__BORLANDC__) || \ defined(__DMC__) || defined(__SC__) || \ defined(__WATCOMC__) || defined(__LCC__) || \ defined(__DECC) # 109 "/usr/local/include/SDL2/begin_code.h" #define SDL_INLINE __inline #ifndef __inline__ #define __inline__ __inline #endif # 113 "/usr/local/include/SDL2/begin_code.h" #else # 114 "/usr/local/include/SDL2/begin_code.h" #define SDL_INLINE inline #ifndef __inline__ #define __inline__ inline #endif # 118 "/usr/local/include/SDL2/begin_code.h" #endif # 119 "/usr/local/include/SDL2/begin_code.h" #endif /* SDL_INLINE not defined */ # 120 "/usr/local/include/SDL2/begin_code.h" #ifndef SDL_FORCE_INLINE #if defined(_MSC_VER) #define SDL_FORCE_INLINE __forceinline #elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) ) # 125 "/usr/local/include/SDL2/begin_code.h" #define SDL_FORCE_INLINE __attribute__((always_inline)) static __inline__ #else # 127 "/usr/local/include/SDL2/begin_code.h" #define SDL_FORCE_INLINE static SDL_INLINE #endif # 129 "/usr/local/include/SDL2/begin_code.h" #endif /* SDL_FORCE_INLINE not defined */ # 130 "/usr/local/include/SDL2/begin_code.h" /* Apparently this is needed by several Windows compilers */ #if !defined(__MACH__) #ifndef NULL #ifdef __cplusplus #define NULL 0 #else # 137 "/usr/local/include/SDL2/begin_code.h" #define NULL ((void *)0) #endif # 139 "/usr/local/include/SDL2/begin_code.h" #endif /* NULL */ # 140 "/usr/local/include/SDL2/begin_code.h" #endif /* ! Mac OS X - breaks precompiled headers */ # 141 "/usr/local/include/SDL2/begin_code.h" # 66 "/usr/local/include/SDL2/SDL_atomic.h" 2 /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif # 71 "/usr/local/include/SDL2/SDL_atomic.h" /** * \name SDL AtomicLock * * The atomic locks are efficient spinlocks using CPU instructions, * but are vulnerable to starvation and can spin forever if a thread * holding a lock has been terminated. For this reason you should * minimize the code executed inside an atomic lock and never do * expensive things like API or system calls while holding them. * * The atomic locks are not safe to lock recursively. * * Porting Note: * The spin lock functions and type are required and can not be * emulated because they are used in the atomic emulation code. */ /* @{ */ typedef int SDL_SpinLock; /** * \brief Try to lock a spin lock by setting it to a non-zero value. * * \param lock Points to the lock. * * \return SDL_TRUE if the lock succeeded, SDL_FALSE if the lock is already held. */ extern DECLSPEC SDL_bool SDLCALL SDL_AtomicTryLock(SDL_SpinLock *lock); /** * \brief Lock a spin lock by setting it to a non-zero value. * * \param lock Points to the lock. */ extern DECLSPEC void SDLCALL SDL_AtomicLock(SDL_SpinLock *lock); /** * \brief Unlock a spin lock by setting it to 0. Always returns immediately * * \param lock Points to the lock. */ extern DECLSPEC void SDLCALL SDL_AtomicUnlock(SDL_SpinLock *lock); /* @} *//* SDL AtomicLock */ /** * The compiler barrier prevents the compiler from reordering * reads and writes to globally visible variables across the call. */ #if defined(_MSC_VER) && (_MSC_VER > 1200) void _ReadWriteBarrier(void); #pragma intrinsic(_ReadWriteBarrier) #define SDL_CompilerBarrier() _ReadWriteBarrier() #elif defined(__GNUC__) # 126 "/usr/local/include/SDL2/SDL_atomic.h" #define SDL_CompilerBarrier() __asm__ __volatile__ ("" : : : "memory") #else # 128 "/usr/local/include/SDL2/SDL_atomic.h" #define SDL_CompilerBarrier() \ { SDL_SpinLock _tmp = 0; SDL_AtomicLock(&_tmp); SDL_AtomicUnlock(&_tmp); } #endif # 131 "/usr/local/include/SDL2/SDL_atomic.h" /** * Memory barriers are designed to prevent reads and writes from being * reordered by the compiler and being seen out of order on multi-core CPUs. * * A typical pattern would be for thread A to write some data and a flag, * and for thread B to read the flag and get the data. In this case you * would insert a release barrier between writing the data and the flag, * guaranteeing that the data write completes no later than the flag is * written, and you would insert an acquire barrier between reading the * flag and reading the data, to ensure that all the reads associated * with the flag have completed. * * In this pattern you should always see a release barrier paired with * an acquire barrier and you should gate the data reads/writes with a * single flag variable. * * For more information on these semantics, take a look at the blog post: * http://preshing.com/20120913/acquire-and-release-semantics */ #if defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__)) #define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("lwsync" : : : "memory") #define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("lwsync" : : : "memory") #elif defined(__GNUC__) && defined(__arm__) # 155 "/usr/local/include/SDL2/SDL_atomic.h" #if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7EM__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7S__) #define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("dmb ish" : : : "memory") #define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("dmb ish" : : : "memory") #elif defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6T2__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) # 159 "/usr/local/include/SDL2/SDL_atomic.h" #ifdef __thumb__ /* The mcr instruction isn't available in thumb mode, use real functions */ extern DECLSPEC void SDLCALL SDL_MemoryBarrierRelease(); extern DECLSPEC void SDLCALL SDL_MemoryBarrierAcquire(); #else # 164 "/usr/local/include/SDL2/SDL_atomic.h" #define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" : : "r"(0) : "memory") #define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" : : "r"(0) : "memory") #endif /* __thumb__ */ # 167 "/usr/local/include/SDL2/SDL_atomic.h" #else # 168 "/usr/local/include/SDL2/SDL_atomic.h" #define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("" : : : "memory") #define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("" : : : "memory") #endif /* __GNUC__ && __arm__ */ # 171 "/usr/local/include/SDL2/SDL_atomic.h" #else # 172 "/usr/local/include/SDL2/SDL_atomic.h" /* This is correct for the x86 and x64 CPUs, and we'll expand this over time. */ #define SDL_MemoryBarrierRelease() SDL_CompilerBarrier() #define SDL_MemoryBarrierAcquire() SDL_CompilerBarrier() #endif # 176 "/usr/local/include/SDL2/SDL_atomic.h" /** * \brief A type representing an atomic integer value. It is a struct * so people don't accidentally use numeric operations on it. */ typedef struct { int value; } SDL_atomic_t; /** * \brief Set an atomic variable to a new value if it is currently an old value. * * \return SDL_TRUE if the atomic variable was set, SDL_FALSE otherwise. * * \note If you don't know what this function is for, you shouldn't use it! */ extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCAS(SDL_atomic_t *a, int oldval, int newval); /** * \brief Set an atomic variable to a value. * * \return The previous value of the atomic variable. */ extern DECLSPEC int SDLCALL SDL_AtomicSet(SDL_atomic_t *a, int v); /** * \brief Get the value of an atomic variable */ extern DECLSPEC int SDLCALL SDL_AtomicGet(SDL_atomic_t *a); /** * \brief Add to an atomic variable. * * \return The previous value of the atomic variable. * * \note This same style can be used for any number operation */ extern DECLSPEC int SDLCALL SDL_AtomicAdd(SDL_atomic_t *a, int v); /** * \brief Increment an atomic variable used as a reference count. */ #ifndef SDL_AtomicIncRef #define SDL_AtomicIncRef(a) SDL_AtomicAdd(a, 1) #endif # 219 "/usr/local/include/SDL2/SDL_atomic.h" /** * \brief Decrement an atomic variable used as a reference count. * * \return SDL_TRUE if the variable reached zero after decrementing, * SDL_FALSE otherwise */ #ifndef SDL_AtomicDecRef #define SDL_AtomicDecRef(a) (SDL_AtomicAdd(a, -1) == 1) #endif # 229 "/usr/local/include/SDL2/SDL_atomic.h" /** * \brief Set a pointer to a new value if it is currently an old value. * * \return SDL_TRUE if the pointer was set, SDL_FALSE otherwise. * * \note If you don't know what this function is for, you shouldn't use it! */ extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCASPtr(void **a, void *oldval, void *newval); /** * \brief Set a pointer to a value atomically. * * \return The previous value of the pointer. */ extern DECLSPEC void* SDLCALL SDL_AtomicSetPtr(void **a, void* v); /** * \brief Get the value of a pointer atomically. */ extern DECLSPEC void* SDLCALL SDL_AtomicGetPtr(void **a); /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif # 255 "/usr/local/include/SDL2/SDL_atomic.h" #if 0 /* expanded by -frewrite-includes */ #include "close_code.h" #endif /* expanded by -frewrite-includes */ # 256 "/usr/local/include/SDL2/SDL_atomic.h" # 1 "/usr/local/include/SDL2/close_code.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file close_code.h * * This file reverses the effects of begin_code.h and should be included * after you finish any function and structure declarations in your headers */ #undef _begin_code_h /* Reset structure packing at previous byte alignment */ #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__WATCOMC__) || defined(__BORLANDC__) #ifdef __BORLANDC__ #pragma nopackwarning #endif # 36 "/usr/local/include/SDL2/close_code.h" #pragma pack(pop) #endif /* Compiler needs structure packing set */ # 38 "/usr/local/include/SDL2/close_code.h" # 257 "/usr/local/include/SDL2/SDL_atomic.h" 2 #endif /* _SDL_atomic_h_ */ # 259 "/usr/local/include/SDL2/SDL_atomic.h" /* vi: set ts=4 sw=4 expandtab: */ # 71 "/usr/local/include/SDL2/SDL.h" 2 #if 0 /* expanded by -frewrite-includes */ #include "SDL_audio.h" #endif /* expanded by -frewrite-includes */ # 71 "/usr/local/include/SDL2/SDL.h" # 1 "/usr/local/include/SDL2/SDL_audio.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file SDL_audio.h * * Access to the raw audio mixing buffer for the SDL library. */ #ifndef _SDL_audio_h #define _SDL_audio_h #if 0 /* expanded by -frewrite-includes */ #include "SDL_stdinc.h" #endif /* expanded by -frewrite-includes */ # 31 "/usr/local/include/SDL2/SDL_audio.h" # 32 "/usr/local/include/SDL2/SDL_audio.h" #if 0 /* expanded by -frewrite-includes */ #include "SDL_error.h" #endif /* expanded by -frewrite-includes */ # 32 "/usr/local/include/SDL2/SDL_audio.h" # 1 "/usr/local/include/SDL2/SDL_error.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file SDL_error.h * * Simple error message routines for SDL. */ #ifndef _SDL_error_h #define _SDL_error_h #if 0 /* expanded by -frewrite-includes */ #include "SDL_stdinc.h" #endif /* expanded by -frewrite-includes */ # 31 "/usr/local/include/SDL2/SDL_error.h" # 32 "/usr/local/include/SDL2/SDL_error.h" #if 0 /* expanded by -frewrite-includes */ #include "begin_code.h" #endif /* expanded by -frewrite-includes */ # 33 "/usr/local/include/SDL2/SDL_error.h" # 1 "/usr/local/include/SDL2/begin_code.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file begin_code.h * * This file sets things up for C dynamic library function definitions, * static inlined functions, and structures aligned at 4-byte alignment. * If you don't like ugly C preprocessor code, don't look at this file. :) */ /* This shouldn't be nested -- included it around code only. */ #ifdef _begin_code_h #error Nested inclusion of begin_code.h #endif # 34 "/usr/local/include/SDL2/begin_code.h" #define _begin_code_h #ifndef SDL_DEPRECATED # if (__GNUC__ >= 4) /* technically, this arrived in gcc 3.1, but oh well. */ # define SDL_DEPRECATED __attribute__((deprecated)) # else # 40 "/usr/local/include/SDL2/begin_code.h" # define SDL_DEPRECATED # endif # 42 "/usr/local/include/SDL2/begin_code.h" #endif # 43 "/usr/local/include/SDL2/begin_code.h" /* Some compilers use a special export keyword */ #ifndef DECLSPEC # if defined(__WIN32__) || defined(__WINRT__) # ifdef __BORLANDC__ # ifdef BUILD_SDL # define DECLSPEC # else # 51 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllimport) # endif # 53 "/usr/local/include/SDL2/begin_code.h" # else # 54 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllexport) # endif # 56 "/usr/local/include/SDL2/begin_code.h" # else # 57 "/usr/local/include/SDL2/begin_code.h" # if defined(__GNUC__) && __GNUC__ >= 4 # define DECLSPEC __attribute__ ((visibility("default"))) # elif defined(__GNUC__) && __GNUC__ >= 2 # 60 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllexport) # else # 62 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC # endif # 64 "/usr/local/include/SDL2/begin_code.h" # endif # 65 "/usr/local/include/SDL2/begin_code.h" #endif # 66 "/usr/local/include/SDL2/begin_code.h" /* By default SDL uses the C calling convention */ #ifndef SDLCALL #if (defined(__WIN32__) || defined(__WINRT__)) && !defined(__GNUC__) #define SDLCALL __cdecl #else # 72 "/usr/local/include/SDL2/begin_code.h" #define SDLCALL #endif # 74 "/usr/local/include/SDL2/begin_code.h" #endif /* SDLCALL */ # 75 "/usr/local/include/SDL2/begin_code.h" /* Removed DECLSPEC on Symbian OS because SDL cannot be a DLL in EPOC */ #ifdef __SYMBIAN32__ #undef DECLSPEC #define DECLSPEC #endif /* __SYMBIAN32__ */ # 81 "/usr/local/include/SDL2/begin_code.h" /* Force structure packing at 4 byte alignment. This is necessary if the header is included in code which has structure packing set to an alternate value, say for loading structures from disk. The packing is reset to the previous value in close_code.h */ #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__) #ifdef _MSC_VER #pragma warning(disable: 4103) #endif # 91 "/usr/local/include/SDL2/begin_code.h" #ifdef __BORLANDC__ #pragma nopackwarning #endif # 94 "/usr/local/include/SDL2/begin_code.h" #ifdef _M_X64 /* Use 8-byte alignment on 64-bit architectures, so pointers are aligned */ #pragma pack(push,8) #else # 98 "/usr/local/include/SDL2/begin_code.h" #pragma pack(push,4) #endif # 100 "/usr/local/include/SDL2/begin_code.h" #endif /* Compiler needs structure packing set */ # 101 "/usr/local/include/SDL2/begin_code.h" #ifndef SDL_INLINE #if defined(__GNUC__) #define SDL_INLINE __inline__ #elif defined(_MSC_VER) || defined(__BORLANDC__) || \ defined(__DMC__) || defined(__SC__) || \ defined(__WATCOMC__) || defined(__LCC__) || \ defined(__DECC) # 109 "/usr/local/include/SDL2/begin_code.h" #define SDL_INLINE __inline #ifndef __inline__ #define __inline__ __inline #endif # 113 "/usr/local/include/SDL2/begin_code.h" #else # 114 "/usr/local/include/SDL2/begin_code.h" #define SDL_INLINE inline #ifndef __inline__ #define __inline__ inline #endif # 118 "/usr/local/include/SDL2/begin_code.h" #endif # 119 "/usr/local/include/SDL2/begin_code.h" #endif /* SDL_INLINE not defined */ # 120 "/usr/local/include/SDL2/begin_code.h" #ifndef SDL_FORCE_INLINE #if defined(_MSC_VER) #define SDL_FORCE_INLINE __forceinline #elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) ) # 125 "/usr/local/include/SDL2/begin_code.h" #define SDL_FORCE_INLINE __attribute__((always_inline)) static __inline__ #else # 127 "/usr/local/include/SDL2/begin_code.h" #define SDL_FORCE_INLINE static SDL_INLINE #endif # 129 "/usr/local/include/SDL2/begin_code.h" #endif /* SDL_FORCE_INLINE not defined */ # 130 "/usr/local/include/SDL2/begin_code.h" /* Apparently this is needed by several Windows compilers */ #if !defined(__MACH__) #ifndef NULL #ifdef __cplusplus #define NULL 0 #else # 137 "/usr/local/include/SDL2/begin_code.h" #define NULL ((void *)0) #endif # 139 "/usr/local/include/SDL2/begin_code.h" #endif /* NULL */ # 140 "/usr/local/include/SDL2/begin_code.h" #endif /* ! Mac OS X - breaks precompiled headers */ # 141 "/usr/local/include/SDL2/begin_code.h" # 34 "/usr/local/include/SDL2/SDL_error.h" 2 /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif # 38 "/usr/local/include/SDL2/SDL_error.h" /* Public functions */ /* SDL_SetError() unconditionally returns -1. */ extern DECLSPEC int SDLCALL SDL_SetError(const char *fmt, ...); extern DECLSPEC const char *SDLCALL SDL_GetError(void); extern DECLSPEC void SDLCALL SDL_ClearError(void); /** * \name Internal error functions * * \internal * Private error reporting function - used internally. */ /* @{ */ #define SDL_OutOfMemory() SDL_Error(SDL_ENOMEM) #define SDL_Unsupported() SDL_Error(SDL_UNSUPPORTED) #define SDL_InvalidParamError(param) SDL_SetError("Parameter '%s' is invalid", (param)) typedef enum { SDL_ENOMEM, SDL_EFREAD, SDL_EFWRITE, SDL_EFSEEK, SDL_UNSUPPORTED, SDL_LASTERROR } SDL_errorcode; /* SDL_Error() unconditionally returns -1. */ extern DECLSPEC int SDLCALL SDL_Error(SDL_errorcode code); /* @} *//* Internal error functions */ /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif # 72 "/usr/local/include/SDL2/SDL_error.h" #if 0 /* expanded by -frewrite-includes */ #include "close_code.h" #endif /* expanded by -frewrite-includes */ # 72 "/usr/local/include/SDL2/SDL_error.h" # 1 "/usr/local/include/SDL2/close_code.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file close_code.h * * This file reverses the effects of begin_code.h and should be included * after you finish any function and structure declarations in your headers */ #undef _begin_code_h /* Reset structure packing at previous byte alignment */ #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__WATCOMC__) || defined(__BORLANDC__) #ifdef __BORLANDC__ #pragma nopackwarning #endif # 36 "/usr/local/include/SDL2/close_code.h" #pragma pack(pop) #endif /* Compiler needs structure packing set */ # 38 "/usr/local/include/SDL2/close_code.h" # 73 "/usr/local/include/SDL2/SDL_error.h" 2 #endif /* _SDL_error_h */ # 75 "/usr/local/include/SDL2/SDL_error.h" /* vi: set ts=4 sw=4 expandtab: */ # 33 "/usr/local/include/SDL2/SDL_audio.h" 2 #if 0 /* expanded by -frewrite-includes */ #include "SDL_endian.h" #endif /* expanded by -frewrite-includes */ # 33 "/usr/local/include/SDL2/SDL_audio.h" # 1 "/usr/local/include/SDL2/SDL_endian.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file SDL_endian.h * * Functions for reading and writing endian-specific values */ #ifndef _SDL_endian_h #define _SDL_endian_h #if 0 /* expanded by -frewrite-includes */ #include "SDL_stdinc.h" #endif /* expanded by -frewrite-includes */ # 31 "/usr/local/include/SDL2/SDL_endian.h" # 32 "/usr/local/include/SDL2/SDL_endian.h" /** * \name The two types of endianness */ /* @{ */ #define SDL_LIL_ENDIAN 1234 #define SDL_BIG_ENDIAN 4321 /* @} */ #ifndef SDL_BYTEORDER /* Not defined in SDL_config.h? */ #ifdef __linux__ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 43 "/usr/local/include/SDL2/SDL_endian.h" # 44 "/usr/local/include/SDL2/SDL_endian.h" #define SDL_BYTEORDER __BYTE_ORDER #else /* __linux __ */ # 46 "/usr/local/include/SDL2/SDL_endian.h" #if defined(__hppa__) || \ defined(__m68k__) || defined(mc68000) || defined(_M_M68K) || \ (defined(__MIPS__) && defined(__MISPEB__)) || \ defined(__ppc__) || defined(__POWERPC__) || defined(_M_PPC) || \ defined(__sparc__) #define SDL_BYTEORDER SDL_BIG_ENDIAN #else # 53 "/usr/local/include/SDL2/SDL_endian.h" #define SDL_BYTEORDER SDL_LIL_ENDIAN #endif # 55 "/usr/local/include/SDL2/SDL_endian.h" #endif /* __linux __ */ # 56 "/usr/local/include/SDL2/SDL_endian.h" #endif /* !SDL_BYTEORDER */ # 57 "/usr/local/include/SDL2/SDL_endian.h" #if 0 /* expanded by -frewrite-includes */ #include "begin_code.h" #endif /* expanded by -frewrite-includes */ # 59 "/usr/local/include/SDL2/SDL_endian.h" # 1 "/usr/local/include/SDL2/begin_code.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file begin_code.h * * This file sets things up for C dynamic library function definitions, * static inlined functions, and structures aligned at 4-byte alignment. * If you don't like ugly C preprocessor code, don't look at this file. :) */ /* This shouldn't be nested -- included it around code only. */ #ifdef _begin_code_h #error Nested inclusion of begin_code.h #endif # 34 "/usr/local/include/SDL2/begin_code.h" #define _begin_code_h #ifndef SDL_DEPRECATED # if (__GNUC__ >= 4) /* technically, this arrived in gcc 3.1, but oh well. */ # define SDL_DEPRECATED __attribute__((deprecated)) # else # 40 "/usr/local/include/SDL2/begin_code.h" # define SDL_DEPRECATED # endif # 42 "/usr/local/include/SDL2/begin_code.h" #endif # 43 "/usr/local/include/SDL2/begin_code.h" /* Some compilers use a special export keyword */ #ifndef DECLSPEC # if defined(__WIN32__) || defined(__WINRT__) # ifdef __BORLANDC__ # ifdef BUILD_SDL # define DECLSPEC # else # 51 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllimport) # endif # 53 "/usr/local/include/SDL2/begin_code.h" # else # 54 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllexport) # endif # 56 "/usr/local/include/SDL2/begin_code.h" # else # 57 "/usr/local/include/SDL2/begin_code.h" # if defined(__GNUC__) && __GNUC__ >= 4 # define DECLSPEC __attribute__ ((visibility("default"))) # elif defined(__GNUC__) && __GNUC__ >= 2 # 60 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllexport) # else # 62 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC # endif # 64 "/usr/local/include/SDL2/begin_code.h" # endif # 65 "/usr/local/include/SDL2/begin_code.h" #endif # 66 "/usr/local/include/SDL2/begin_code.h" /* By default SDL uses the C calling convention */ #ifndef SDLCALL #if (defined(__WIN32__) || defined(__WINRT__)) && !defined(__GNUC__) #define SDLCALL __cdecl #else # 72 "/usr/local/include/SDL2/begin_code.h" #define SDLCALL #endif # 74 "/usr/local/include/SDL2/begin_code.h" #endif /* SDLCALL */ # 75 "/usr/local/include/SDL2/begin_code.h" /* Removed DECLSPEC on Symbian OS because SDL cannot be a DLL in EPOC */ #ifdef __SYMBIAN32__ #undef DECLSPEC #define DECLSPEC #endif /* __SYMBIAN32__ */ # 81 "/usr/local/include/SDL2/begin_code.h" /* Force structure packing at 4 byte alignment. This is necessary if the header is included in code which has structure packing set to an alternate value, say for loading structures from disk. The packing is reset to the previous value in close_code.h */ #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__) #ifdef _MSC_VER #pragma warning(disable: 4103) #endif # 91 "/usr/local/include/SDL2/begin_code.h" #ifdef __BORLANDC__ #pragma nopackwarning #endif # 94 "/usr/local/include/SDL2/begin_code.h" #ifdef _M_X64 /* Use 8-byte alignment on 64-bit architectures, so pointers are aligned */ #pragma pack(push,8) #else # 98 "/usr/local/include/SDL2/begin_code.h" #pragma pack(push,4) #endif # 100 "/usr/local/include/SDL2/begin_code.h" #endif /* Compiler needs structure packing set */ # 101 "/usr/local/include/SDL2/begin_code.h" #ifndef SDL_INLINE #if defined(__GNUC__) #define SDL_INLINE __inline__ #elif defined(_MSC_VER) || defined(__BORLANDC__) || \ defined(__DMC__) || defined(__SC__) || \ defined(__WATCOMC__) || defined(__LCC__) || \ defined(__DECC) # 109 "/usr/local/include/SDL2/begin_code.h" #define SDL_INLINE __inline #ifndef __inline__ #define __inline__ __inline #endif # 113 "/usr/local/include/SDL2/begin_code.h" #else # 114 "/usr/local/include/SDL2/begin_code.h" #define SDL_INLINE inline #ifndef __inline__ #define __inline__ inline #endif # 118 "/usr/local/include/SDL2/begin_code.h" #endif # 119 "/usr/local/include/SDL2/begin_code.h" #endif /* SDL_INLINE not defined */ # 120 "/usr/local/include/SDL2/begin_code.h" #ifndef SDL_FORCE_INLINE #if defined(_MSC_VER) #define SDL_FORCE_INLINE __forceinline #elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) ) # 125 "/usr/local/include/SDL2/begin_code.h" #define SDL_FORCE_INLINE __attribute__((always_inline)) static __inline__ #else # 127 "/usr/local/include/SDL2/begin_code.h" #define SDL_FORCE_INLINE static SDL_INLINE #endif # 129 "/usr/local/include/SDL2/begin_code.h" #endif /* SDL_FORCE_INLINE not defined */ # 130 "/usr/local/include/SDL2/begin_code.h" /* Apparently this is needed by several Windows compilers */ #if !defined(__MACH__) #ifndef NULL #ifdef __cplusplus #define NULL 0 #else # 137 "/usr/local/include/SDL2/begin_code.h" #define NULL ((void *)0) #endif # 139 "/usr/local/include/SDL2/begin_code.h" #endif /* NULL */ # 140 "/usr/local/include/SDL2/begin_code.h" #endif /* ! Mac OS X - breaks precompiled headers */ # 141 "/usr/local/include/SDL2/begin_code.h" # 60 "/usr/local/include/SDL2/SDL_endian.h" 2 /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif # 64 "/usr/local/include/SDL2/SDL_endian.h" /** * \file SDL_endian.h */ #if defined(__GNUC__) && defined(__i386__) && \ !(__GNUC__ == 2 && __GNUC_MINOR__ == 95 /* broken gcc version */) SDL_FORCE_INLINE Uint16 SDL_Swap16(Uint16 x) { __asm__("xchgb %b0,%h0": "=q"(x):"0"(x)); return x; } #elif defined(__GNUC__) && defined(__x86_64__) # 77 "/usr/local/include/SDL2/SDL_endian.h" SDL_FORCE_INLINE Uint16 SDL_Swap16(Uint16 x) { __asm__("xchgb %b0,%h0": "=Q"(x):"0"(x)); return x; } #elif defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__)) # 84 "/usr/local/include/SDL2/SDL_endian.h" SDL_FORCE_INLINE Uint16 SDL_Swap16(Uint16 x) { int result; __asm__("rlwimi %0,%2,8,16,23": "=&r"(result):"0"(x >> 8), "r"(x)); return (Uint16)result; } #elif defined(__GNUC__) && (defined(__M68000__) || defined(__M68020__)) && !defined(__mcoldfire__) # 93 "/usr/local/include/SDL2/SDL_endian.h" SDL_FORCE_INLINE Uint16 SDL_Swap16(Uint16 x) { __asm__("rorw #8,%0": "=d"(x): "0"(x):"cc"); return x; } #else # 100 "/usr/local/include/SDL2/SDL_endian.h" SDL_FORCE_INLINE Uint16 SDL_Swap16(Uint16 x) { return SDL_static_cast(Uint16, ((x << 8) | (x >> 8))); } #endif # 106 "/usr/local/include/SDL2/SDL_endian.h" #if defined(__GNUC__) && defined(__i386__) SDL_FORCE_INLINE Uint32 SDL_Swap32(Uint32 x) { __asm__("bswap %0": "=r"(x):"0"(x)); return x; } #elif defined(__GNUC__) && defined(__x86_64__) # 115 "/usr/local/include/SDL2/SDL_endian.h" SDL_FORCE_INLINE Uint32 SDL_Swap32(Uint32 x) { __asm__("bswapl %0": "=r"(x):"0"(x)); return x; } #elif defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__)) # 122 "/usr/local/include/SDL2/SDL_endian.h" SDL_FORCE_INLINE Uint32 SDL_Swap32(Uint32 x) { Uint32 result; __asm__("rlwimi %0,%2,24,16,23": "=&r"(result):"0"(x >> 24), "r"(x)); __asm__("rlwimi %0,%2,8,8,15": "=&r"(result):"0"(result), "r"(x)); __asm__("rlwimi %0,%2,24,0,7": "=&r"(result):"0"(result), "r"(x)); return result; } #elif defined(__GNUC__) && (defined(__M68000__) || defined(__M68020__)) && !defined(__mcoldfire__) # 133 "/usr/local/include/SDL2/SDL_endian.h" SDL_FORCE_INLINE Uint32 SDL_Swap32(Uint32 x) { __asm__("rorw #8,%0\n\tswap %0\n\trorw #8,%0": "=d"(x): "0"(x):"cc"); return x; } #else # 140 "/usr/local/include/SDL2/SDL_endian.h" SDL_FORCE_INLINE Uint32 SDL_Swap32(Uint32 x) { return SDL_static_cast(Uint32, ((x << 24) | ((x << 8) & 0x00FF0000) | ((x >> 8) & 0x0000FF00) | (x >> 24))); } #endif # 147 "/usr/local/include/SDL2/SDL_endian.h" #if defined(__GNUC__) && defined(__i386__) SDL_FORCE_INLINE Uint64 SDL_Swap64(Uint64 x) { union { struct { Uint32 a, b; } s; Uint64 u; } v; v.u = x; __asm__("bswapl %0 ; bswapl %1 ; xchgl %0,%1": "=r"(v.s.a), "=r"(v.s.b):"0"(v.s.a), "1"(v.s. b)); return v.u; } #elif defined(__GNUC__) && defined(__x86_64__) # 167 "/usr/local/include/SDL2/SDL_endian.h" SDL_FORCE_INLINE Uint64 SDL_Swap64(Uint64 x) { __asm__("bswapq %0": "=r"(x):"0"(x)); return x; } #else # 174 "/usr/local/include/SDL2/SDL_endian.h" SDL_FORCE_INLINE Uint64 SDL_Swap64(Uint64 x) { Uint32 hi, lo; /* Separate into high and low 32-bit values and swap them */ lo = SDL_static_cast(Uint32, x & 0xFFFFFFFF); x >>= 32; hi = SDL_static_cast(Uint32, x & 0xFFFFFFFF); x = SDL_Swap32(lo); x <<= 32; x |= SDL_Swap32(hi); return (x); } #endif # 189 "/usr/local/include/SDL2/SDL_endian.h" SDL_FORCE_INLINE float SDL_SwapFloat(float x) { union { float f; Uint32 ui32; } swapper; swapper.f = x; swapper.ui32 = SDL_Swap32(swapper.ui32); return swapper.f; } /** * \name Swap to native * Byteswap item from the specified endianness to the native endianness. */ /* @{ */ #if SDL_BYTEORDER == SDL_LIL_ENDIAN #define SDL_SwapLE16(X) (X) #define SDL_SwapLE32(X) (X) #define SDL_SwapLE64(X) (X) #define SDL_SwapFloatLE(X) (X) #define SDL_SwapBE16(X) SDL_Swap16(X) #define SDL_SwapBE32(X) SDL_Swap32(X) #define SDL_SwapBE64(X) SDL_Swap64(X) #define SDL_SwapFloatBE(X) SDL_SwapFloat(X) #else # 220 "/usr/local/include/SDL2/SDL_endian.h" #define SDL_SwapLE16(X) SDL_Swap16(X) #define SDL_SwapLE32(X) SDL_Swap32(X) #define SDL_SwapLE64(X) SDL_Swap64(X) #define SDL_SwapFloatLE(X) SDL_SwapFloat(X) #define SDL_SwapBE16(X) (X) #define SDL_SwapBE32(X) (X) #define SDL_SwapBE64(X) (X) #define SDL_SwapFloatBE(X) (X) #endif # 229 "/usr/local/include/SDL2/SDL_endian.h" /* @} *//* Swap to native */ /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif # 235 "/usr/local/include/SDL2/SDL_endian.h" #if 0 /* expanded by -frewrite-includes */ #include "close_code.h" #endif /* expanded by -frewrite-includes */ # 235 "/usr/local/include/SDL2/SDL_endian.h" # 1 "/usr/local/include/SDL2/close_code.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file close_code.h * * This file reverses the effects of begin_code.h and should be included * after you finish any function and structure declarations in your headers */ #undef _begin_code_h /* Reset structure packing at previous byte alignment */ #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__WATCOMC__) || defined(__BORLANDC__) #ifdef __BORLANDC__ #pragma nopackwarning #endif # 36 "/usr/local/include/SDL2/close_code.h" #pragma pack(pop) #endif /* Compiler needs structure packing set */ # 38 "/usr/local/include/SDL2/close_code.h" # 236 "/usr/local/include/SDL2/SDL_endian.h" 2 #endif /* _SDL_endian_h */ # 238 "/usr/local/include/SDL2/SDL_endian.h" /* vi: set ts=4 sw=4 expandtab: */ # 34 "/usr/local/include/SDL2/SDL_audio.h" 2 #if 0 /* expanded by -frewrite-includes */ #include "SDL_mutex.h" #endif /* expanded by -frewrite-includes */ # 34 "/usr/local/include/SDL2/SDL_audio.h" # 1 "/usr/local/include/SDL2/SDL_mutex.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #ifndef _SDL_mutex_h #define _SDL_mutex_h /** * \file SDL_mutex.h * * Functions to provide thread synchronization primitives. */ #if 0 /* expanded by -frewrite-includes */ #include "SDL_stdinc.h" #endif /* expanded by -frewrite-includes */ # 31 "/usr/local/include/SDL2/SDL_mutex.h" # 32 "/usr/local/include/SDL2/SDL_mutex.h" #if 0 /* expanded by -frewrite-includes */ #include "SDL_error.h" #endif /* expanded by -frewrite-includes */ # 32 "/usr/local/include/SDL2/SDL_mutex.h" # 33 "/usr/local/include/SDL2/SDL_mutex.h" #if 0 /* expanded by -frewrite-includes */ #include "begin_code.h" #endif /* expanded by -frewrite-includes */ # 34 "/usr/local/include/SDL2/SDL_mutex.h" # 1 "/usr/local/include/SDL2/begin_code.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file begin_code.h * * This file sets things up for C dynamic library function definitions, * static inlined functions, and structures aligned at 4-byte alignment. * If you don't like ugly C preprocessor code, don't look at this file. :) */ /* This shouldn't be nested -- included it around code only. */ #ifdef _begin_code_h #error Nested inclusion of begin_code.h #endif # 34 "/usr/local/include/SDL2/begin_code.h" #define _begin_code_h #ifndef SDL_DEPRECATED # if (__GNUC__ >= 4) /* technically, this arrived in gcc 3.1, but oh well. */ # define SDL_DEPRECATED __attribute__((deprecated)) # else # 40 "/usr/local/include/SDL2/begin_code.h" # define SDL_DEPRECATED # endif # 42 "/usr/local/include/SDL2/begin_code.h" #endif # 43 "/usr/local/include/SDL2/begin_code.h" /* Some compilers use a special export keyword */ #ifndef DECLSPEC # if defined(__WIN32__) || defined(__WINRT__) # ifdef __BORLANDC__ # ifdef BUILD_SDL # define DECLSPEC # else # 51 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllimport) # endif # 53 "/usr/local/include/SDL2/begin_code.h" # else # 54 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllexport) # endif # 56 "/usr/local/include/SDL2/begin_code.h" # else # 57 "/usr/local/include/SDL2/begin_code.h" # if defined(__GNUC__) && __GNUC__ >= 4 # define DECLSPEC __attribute__ ((visibility("default"))) # elif defined(__GNUC__) && __GNUC__ >= 2 # 60 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllexport) # else # 62 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC # endif # 64 "/usr/local/include/SDL2/begin_code.h" # endif # 65 "/usr/local/include/SDL2/begin_code.h" #endif # 66 "/usr/local/include/SDL2/begin_code.h" /* By default SDL uses the C calling convention */ #ifndef SDLCALL #if (defined(__WIN32__) || defined(__WINRT__)) && !defined(__GNUC__) #define SDLCALL __cdecl #else # 72 "/usr/local/include/SDL2/begin_code.h" #define SDLCALL #endif # 74 "/usr/local/include/SDL2/begin_code.h" #endif /* SDLCALL */ # 75 "/usr/local/include/SDL2/begin_code.h" /* Removed DECLSPEC on Symbian OS because SDL cannot be a DLL in EPOC */ #ifdef __SYMBIAN32__ #undef DECLSPEC #define DECLSPEC #endif /* __SYMBIAN32__ */ # 81 "/usr/local/include/SDL2/begin_code.h" /* Force structure packing at 4 byte alignment. This is necessary if the header is included in code which has structure packing set to an alternate value, say for loading structures from disk. The packing is reset to the previous value in close_code.h */ #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__) #ifdef _MSC_VER #pragma warning(disable: 4103) #endif # 91 "/usr/local/include/SDL2/begin_code.h" #ifdef __BORLANDC__ #pragma nopackwarning #endif # 94 "/usr/local/include/SDL2/begin_code.h" #ifdef _M_X64 /* Use 8-byte alignment on 64-bit architectures, so pointers are aligned */ #pragma pack(push,8) #else # 98 "/usr/local/include/SDL2/begin_code.h" #pragma pack(push,4) #endif # 100 "/usr/local/include/SDL2/begin_code.h" #endif /* Compiler needs structure packing set */ # 101 "/usr/local/include/SDL2/begin_code.h" #ifndef SDL_INLINE #if defined(__GNUC__) #define SDL_INLINE __inline__ #elif defined(_MSC_VER) || defined(__BORLANDC__) || \ defined(__DMC__) || defined(__SC__) || \ defined(__WATCOMC__) || defined(__LCC__) || \ defined(__DECC) # 109 "/usr/local/include/SDL2/begin_code.h" #define SDL_INLINE __inline #ifndef __inline__ #define __inline__ __inline #endif # 113 "/usr/local/include/SDL2/begin_code.h" #else # 114 "/usr/local/include/SDL2/begin_code.h" #define SDL_INLINE inline #ifndef __inline__ #define __inline__ inline #endif # 118 "/usr/local/include/SDL2/begin_code.h" #endif # 119 "/usr/local/include/SDL2/begin_code.h" #endif /* SDL_INLINE not defined */ # 120 "/usr/local/include/SDL2/begin_code.h" #ifndef SDL_FORCE_INLINE #if defined(_MSC_VER) #define SDL_FORCE_INLINE __forceinline #elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) ) # 125 "/usr/local/include/SDL2/begin_code.h" #define SDL_FORCE_INLINE __attribute__((always_inline)) static __inline__ #else # 127 "/usr/local/include/SDL2/begin_code.h" #define SDL_FORCE_INLINE static SDL_INLINE #endif # 129 "/usr/local/include/SDL2/begin_code.h" #endif /* SDL_FORCE_INLINE not defined */ # 130 "/usr/local/include/SDL2/begin_code.h" /* Apparently this is needed by several Windows compilers */ #if !defined(__MACH__) #ifndef NULL #ifdef __cplusplus #define NULL 0 #else # 137 "/usr/local/include/SDL2/begin_code.h" #define NULL ((void *)0) #endif # 139 "/usr/local/include/SDL2/begin_code.h" #endif /* NULL */ # 140 "/usr/local/include/SDL2/begin_code.h" #endif /* ! Mac OS X - breaks precompiled headers */ # 141 "/usr/local/include/SDL2/begin_code.h" # 35 "/usr/local/include/SDL2/SDL_mutex.h" 2 /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif # 39 "/usr/local/include/SDL2/SDL_mutex.h" /** * Synchronization functions which can time out return this value * if they time out. */ #define SDL_MUTEX_TIMEDOUT 1 /** * This is the timeout value which corresponds to never time out. */ #define SDL_MUTEX_MAXWAIT (~(Uint32)0) /** * \name Mutex functions */ /* @{ */ /* The SDL mutex structure, defined in SDL_sysmutex.c */ struct SDL_mutex; typedef struct SDL_mutex SDL_mutex; /** * Create a mutex, initialized unlocked. */ extern DECLSPEC SDL_mutex *SDLCALL SDL_CreateMutex(void); /** * Lock the mutex. * * \return 0, or -1 on error. */ #define SDL_mutexP(m) SDL_LockMutex(m) extern DECLSPEC int SDLCALL SDL_LockMutex(SDL_mutex * mutex); /** * Try to lock the mutex * * \return 0, SDL_MUTEX_TIMEDOUT, or -1 on error */ extern DECLSPEC int SDLCALL SDL_TryLockMutex(SDL_mutex * mutex); /** * Unlock the mutex. * * \return 0, or -1 on error. * * \warning It is an error to unlock a mutex that has not been locked by * the current thread, and doing so results in undefined behavior. */ #define SDL_mutexV(m) SDL_UnlockMutex(m) extern DECLSPEC int SDLCALL SDL_UnlockMutex(SDL_mutex * mutex); /** * Destroy a mutex. */ extern DECLSPEC void SDLCALL SDL_DestroyMutex(SDL_mutex * mutex); /* @} *//* Mutex functions */ /** * \name Semaphore functions */ /* @{ */ /* The SDL semaphore structure, defined in SDL_syssem.c */ struct SDL_semaphore; typedef struct SDL_semaphore SDL_sem; /** * Create a semaphore, initialized with value, returns NULL on failure. */ extern DECLSPEC SDL_sem *SDLCALL SDL_CreateSemaphore(Uint32 initial_value); /** * Destroy a semaphore. */ extern DECLSPEC void SDLCALL SDL_DestroySemaphore(SDL_sem * sem); /** * This function suspends the calling thread until the semaphore pointed * to by \c sem has a positive count. It then atomically decreases the * semaphore count. */ extern DECLSPEC int SDLCALL SDL_SemWait(SDL_sem * sem); /** * Non-blocking variant of SDL_SemWait(). * * \return 0 if the wait succeeds, ::SDL_MUTEX_TIMEDOUT if the wait would * block, and -1 on error. */ extern DECLSPEC int SDLCALL SDL_SemTryWait(SDL_sem * sem); /** * Variant of SDL_SemWait() with a timeout in milliseconds. * * \return 0 if the wait succeeds, ::SDL_MUTEX_TIMEDOUT if the wait does not * succeed in the allotted time, and -1 on error. * * \warning On some platforms this function is implemented by looping with a * delay of 1 ms, and so should be avoided if possible. */ extern DECLSPEC int SDLCALL SDL_SemWaitTimeout(SDL_sem * sem, Uint32 ms); /** * Atomically increases the semaphore's count (not blocking). * * \return 0, or -1 on error. */ extern DECLSPEC int SDLCALL SDL_SemPost(SDL_sem * sem); /** * Returns the current count of the semaphore. */ extern DECLSPEC Uint32 SDLCALL SDL_SemValue(SDL_sem * sem); /* @} *//* Semaphore functions */ /** * \name Condition variable functions */ /* @{ */ /* The SDL condition variable structure, defined in SDL_syscond.c */ struct SDL_cond; typedef struct SDL_cond SDL_cond; /** * Create a condition variable. * * Typical use of condition variables: * * Thread A: * SDL_LockMutex(lock); * while ( ! condition ) { * SDL_CondWait(cond, lock); * } * SDL_UnlockMutex(lock); * * Thread B: * SDL_LockMutex(lock); * ... * condition = true; * ... * SDL_CondSignal(cond); * SDL_UnlockMutex(lock); * * There is some discussion whether to signal the condition variable * with the mutex locked or not. There is some potential performance * benefit to unlocking first on some platforms, but there are some * potential race conditions depending on how your code is structured. * * In general it's safer to signal the condition variable while the * mutex is locked. */ extern DECLSPEC SDL_cond *SDLCALL SDL_CreateCond(void); /** * Destroy a condition variable. */ extern DECLSPEC void SDLCALL SDL_DestroyCond(SDL_cond * cond); /** * Restart one of the threads that are waiting on the condition variable. * * \return 0 or -1 on error. */ extern DECLSPEC int SDLCALL SDL_CondSignal(SDL_cond * cond); /** * Restart all threads that are waiting on the condition variable. * * \return 0 or -1 on error. */ extern DECLSPEC int SDLCALL SDL_CondBroadcast(SDL_cond * cond); /** * Wait on the condition variable, unlocking the provided mutex. * * \warning The mutex must be locked before entering this function! * * The mutex is re-locked once the condition variable is signaled. * * \return 0 when it is signaled, or -1 on error. */ extern DECLSPEC int SDLCALL SDL_CondWait(SDL_cond * cond, SDL_mutex * mutex); /** * Waits for at most \c ms milliseconds, and returns 0 if the condition * variable is signaled, ::SDL_MUTEX_TIMEDOUT if the condition is not * signaled in the allotted time, and -1 on error. * * \warning On some platforms this function is implemented by looping with a * delay of 1 ms, and so should be avoided if possible. */ extern DECLSPEC int SDLCALL SDL_CondWaitTimeout(SDL_cond * cond, SDL_mutex * mutex, Uint32 ms); /* @} *//* Condition variable functions */ /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif # 247 "/usr/local/include/SDL2/SDL_mutex.h" #if 0 /* expanded by -frewrite-includes */ #include "close_code.h" #endif /* expanded by -frewrite-includes */ # 247 "/usr/local/include/SDL2/SDL_mutex.h" # 1 "/usr/local/include/SDL2/close_code.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file close_code.h * * This file reverses the effects of begin_code.h and should be included * after you finish any function and structure declarations in your headers */ #undef _begin_code_h /* Reset structure packing at previous byte alignment */ #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__WATCOMC__) || defined(__BORLANDC__) #ifdef __BORLANDC__ #pragma nopackwarning #endif # 36 "/usr/local/include/SDL2/close_code.h" #pragma pack(pop) #endif /* Compiler needs structure packing set */ # 38 "/usr/local/include/SDL2/close_code.h" # 248 "/usr/local/include/SDL2/SDL_mutex.h" 2 #endif /* _SDL_mutex_h */ # 250 "/usr/local/include/SDL2/SDL_mutex.h" /* vi: set ts=4 sw=4 expandtab: */ # 35 "/usr/local/include/SDL2/SDL_audio.h" 2 #if 0 /* expanded by -frewrite-includes */ #include "SDL_thread.h" #endif /* expanded by -frewrite-includes */ # 35 "/usr/local/include/SDL2/SDL_audio.h" # 1 "/usr/local/include/SDL2/SDL_thread.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #ifndef _SDL_thread_h #define _SDL_thread_h /** * \file SDL_thread.h * * Header for the SDL thread management routines. */ #if 0 /* expanded by -frewrite-includes */ #include "SDL_stdinc.h" #endif /* expanded by -frewrite-includes */ # 31 "/usr/local/include/SDL2/SDL_thread.h" # 32 "/usr/local/include/SDL2/SDL_thread.h" #if 0 /* expanded by -frewrite-includes */ #include "SDL_error.h" #endif /* expanded by -frewrite-includes */ # 32 "/usr/local/include/SDL2/SDL_thread.h" # 33 "/usr/local/include/SDL2/SDL_thread.h" /* Thread synchronization primitives */ #if 0 /* expanded by -frewrite-includes */ #include "SDL_atomic.h" #endif /* expanded by -frewrite-includes */ # 35 "/usr/local/include/SDL2/SDL_thread.h" # 36 "/usr/local/include/SDL2/SDL_thread.h" #if 0 /* expanded by -frewrite-includes */ #include "SDL_mutex.h" #endif /* expanded by -frewrite-includes */ # 36 "/usr/local/include/SDL2/SDL_thread.h" # 37 "/usr/local/include/SDL2/SDL_thread.h" #if 0 /* expanded by -frewrite-includes */ #include "begin_code.h" #endif /* expanded by -frewrite-includes */ # 38 "/usr/local/include/SDL2/SDL_thread.h" # 1 "/usr/local/include/SDL2/begin_code.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file begin_code.h * * This file sets things up for C dynamic library function definitions, * static inlined functions, and structures aligned at 4-byte alignment. * If you don't like ugly C preprocessor code, don't look at this file. :) */ /* This shouldn't be nested -- included it around code only. */ #ifdef _begin_code_h #error Nested inclusion of begin_code.h #endif # 34 "/usr/local/include/SDL2/begin_code.h" #define _begin_code_h #ifndef SDL_DEPRECATED # if (__GNUC__ >= 4) /* technically, this arrived in gcc 3.1, but oh well. */ # define SDL_DEPRECATED __attribute__((deprecated)) # else # 40 "/usr/local/include/SDL2/begin_code.h" # define SDL_DEPRECATED # endif # 42 "/usr/local/include/SDL2/begin_code.h" #endif # 43 "/usr/local/include/SDL2/begin_code.h" /* Some compilers use a special export keyword */ #ifndef DECLSPEC # if defined(__WIN32__) || defined(__WINRT__) # ifdef __BORLANDC__ # ifdef BUILD_SDL # define DECLSPEC # else # 51 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllimport) # endif # 53 "/usr/local/include/SDL2/begin_code.h" # else # 54 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllexport) # endif # 56 "/usr/local/include/SDL2/begin_code.h" # else # 57 "/usr/local/include/SDL2/begin_code.h" # if defined(__GNUC__) && __GNUC__ >= 4 # define DECLSPEC __attribute__ ((visibility("default"))) # elif defined(__GNUC__) && __GNUC__ >= 2 # 60 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllexport) # else # 62 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC # endif # 64 "/usr/local/include/SDL2/begin_code.h" # endif # 65 "/usr/local/include/SDL2/begin_code.h" #endif # 66 "/usr/local/include/SDL2/begin_code.h" /* By default SDL uses the C calling convention */ #ifndef SDLCALL #if (defined(__WIN32__) || defined(__WINRT__)) && !defined(__GNUC__) #define SDLCALL __cdecl #else # 72 "/usr/local/include/SDL2/begin_code.h" #define SDLCALL #endif # 74 "/usr/local/include/SDL2/begin_code.h" #endif /* SDLCALL */ # 75 "/usr/local/include/SDL2/begin_code.h" /* Removed DECLSPEC on Symbian OS because SDL cannot be a DLL in EPOC */ #ifdef __SYMBIAN32__ #undef DECLSPEC #define DECLSPEC #endif /* __SYMBIAN32__ */ # 81 "/usr/local/include/SDL2/begin_code.h" /* Force structure packing at 4 byte alignment. This is necessary if the header is included in code which has structure packing set to an alternate value, say for loading structures from disk. The packing is reset to the previous value in close_code.h */ #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__) #ifdef _MSC_VER #pragma warning(disable: 4103) #endif # 91 "/usr/local/include/SDL2/begin_code.h" #ifdef __BORLANDC__ #pragma nopackwarning #endif # 94 "/usr/local/include/SDL2/begin_code.h" #ifdef _M_X64 /* Use 8-byte alignment on 64-bit architectures, so pointers are aligned */ #pragma pack(push,8) #else # 98 "/usr/local/include/SDL2/begin_code.h" #pragma pack(push,4) #endif # 100 "/usr/local/include/SDL2/begin_code.h" #endif /* Compiler needs structure packing set */ # 101 "/usr/local/include/SDL2/begin_code.h" #ifndef SDL_INLINE #if defined(__GNUC__) #define SDL_INLINE __inline__ #elif defined(_MSC_VER) || defined(__BORLANDC__) || \ defined(__DMC__) || defined(__SC__) || \ defined(__WATCOMC__) || defined(__LCC__) || \ defined(__DECC) # 109 "/usr/local/include/SDL2/begin_code.h" #define SDL_INLINE __inline #ifndef __inline__ #define __inline__ __inline #endif # 113 "/usr/local/include/SDL2/begin_code.h" #else # 114 "/usr/local/include/SDL2/begin_code.h" #define SDL_INLINE inline #ifndef __inline__ #define __inline__ inline #endif # 118 "/usr/local/include/SDL2/begin_code.h" #endif # 119 "/usr/local/include/SDL2/begin_code.h" #endif /* SDL_INLINE not defined */ # 120 "/usr/local/include/SDL2/begin_code.h" #ifndef SDL_FORCE_INLINE #if defined(_MSC_VER) #define SDL_FORCE_INLINE __forceinline #elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) ) # 125 "/usr/local/include/SDL2/begin_code.h" #define SDL_FORCE_INLINE __attribute__((always_inline)) static __inline__ #else # 127 "/usr/local/include/SDL2/begin_code.h" #define SDL_FORCE_INLINE static SDL_INLINE #endif # 129 "/usr/local/include/SDL2/begin_code.h" #endif /* SDL_FORCE_INLINE not defined */ # 130 "/usr/local/include/SDL2/begin_code.h" /* Apparently this is needed by several Windows compilers */ #if !defined(__MACH__) #ifndef NULL #ifdef __cplusplus #define NULL 0 #else # 137 "/usr/local/include/SDL2/begin_code.h" #define NULL ((void *)0) #endif # 139 "/usr/local/include/SDL2/begin_code.h" #endif /* NULL */ # 140 "/usr/local/include/SDL2/begin_code.h" #endif /* ! Mac OS X - breaks precompiled headers */ # 141 "/usr/local/include/SDL2/begin_code.h" # 39 "/usr/local/include/SDL2/SDL_thread.h" 2 /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif # 43 "/usr/local/include/SDL2/SDL_thread.h" /* The SDL thread structure, defined in SDL_thread.c */ struct SDL_Thread; typedef struct SDL_Thread SDL_Thread; /* The SDL thread ID */ typedef unsigned long SDL_threadID; /* Thread local storage ID, 0 is the invalid ID */ typedef unsigned int SDL_TLSID; /** * The SDL thread priority. * * \note On many systems you require special privileges to set high priority. */ typedef enum { SDL_THREAD_PRIORITY_LOW, SDL_THREAD_PRIORITY_NORMAL, SDL_THREAD_PRIORITY_HIGH } SDL_ThreadPriority; /** * The function passed to SDL_CreateThread(). * It is passed a void* user context parameter and returns an int. */ typedef int (SDLCALL * SDL_ThreadFunction) (void *data); #if defined(__WIN32__) && !defined(HAVE_LIBC) /** * \file SDL_thread.h * * We compile SDL into a DLL. This means, that it's the DLL which * creates a new thread for the calling process with the SDL_CreateThread() * API. There is a problem with this, that only the RTL of the SDL.DLL will * be initialized for those threads, and not the RTL of the calling * application! * * To solve this, we make a little hack here. * * We'll always use the caller's _beginthread() and _endthread() APIs to * start a new thread. This way, if it's the SDL.DLL which uses this API, * then the RTL of SDL.DLL will be used to create the new thread, and if it's * the application, then the RTL of the application will be used. * * So, in short: * Always use the _beginthread() and _endthread() of the calling runtime * library! */ #define SDL_PASSED_BEGINTHREAD_ENDTHREAD #if 0 /* expanded by -frewrite-includes */ #include /* This has _beginthread() and _endthread() defined! */ #endif /* expanded by -frewrite-includes */ # 93 "/usr/local/include/SDL2/SDL_thread.h" # 94 "/usr/local/include/SDL2/SDL_thread.h" typedef uintptr_t(__cdecl * pfnSDL_CurrentBeginThread) (void *, unsigned, unsigned (__stdcall * func) (void *), void *arg, unsigned, unsigned *threadID); typedef void (__cdecl * pfnSDL_CurrentEndThread) (unsigned code); /** * Create a thread. */ extern DECLSPEC SDL_Thread *SDLCALL SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data, pfnSDL_CurrentBeginThread pfnBeginThread, pfnSDL_CurrentEndThread pfnEndThread); /** * Create a thread. */ #if defined(SDL_CreateThread) && SDL_DYNAMIC_API #undef SDL_CreateThread #define SDL_CreateThread(fn, name, data) SDL_CreateThread_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)_endthreadex) #else # 118 "/usr/local/include/SDL2/SDL_thread.h" #define SDL_CreateThread(fn, name, data) SDL_CreateThread(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)_endthreadex) #endif # 120 "/usr/local/include/SDL2/SDL_thread.h" #else # 122 "/usr/local/include/SDL2/SDL_thread.h" /** * Create a thread. * * Thread naming is a little complicated: Most systems have very small * limits for the string length (Haiku has 32 bytes, Linux currently has 16, * Visual C++ 6.0 has nine!), and possibly other arbitrary rules. You'll * have to see what happens with your system's debugger. The name should be * UTF-8 (but using the naming limits of C identifiers is a better bet). * There are no requirements for thread naming conventions, so long as the * string is null-terminated UTF-8, but these guidelines are helpful in * choosing a name: * * http://stackoverflow.com/questions/149932/naming-conventions-for-threads * * If a system imposes requirements, SDL will try to munge the string for * it (truncate, etc), but the original string contents will be available * from SDL_GetThreadName(). */ extern DECLSPEC SDL_Thread *SDLCALL SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data); #endif # 145 "/usr/local/include/SDL2/SDL_thread.h" /** * Get the thread name, as it was specified in SDL_CreateThread(). * This function returns a pointer to a UTF-8 string that names the * specified thread, or NULL if it doesn't have a name. This is internal * memory, not to be free()'d by the caller, and remains valid until the * specified thread is cleaned up by SDL_WaitThread(). */ extern DECLSPEC const char *SDLCALL SDL_GetThreadName(SDL_Thread *thread); /** * Get the thread identifier for the current thread. */ extern DECLSPEC SDL_threadID SDLCALL SDL_ThreadID(void); /** * Get the thread identifier for the specified thread. * * Equivalent to SDL_ThreadID() if the specified thread is NULL. */ extern DECLSPEC SDL_threadID SDLCALL SDL_GetThreadID(SDL_Thread * thread); /** * Set the priority for the current thread */ extern DECLSPEC int SDLCALL SDL_SetThreadPriority(SDL_ThreadPriority priority); /** * Wait for a thread to finish. Threads that haven't been detached will * remain (as a "zombie") until this function cleans them up. Not doing so * is a resource leak. * * Once a thread has been cleaned up through this function, the SDL_Thread * that references it becomes invalid and should not be referenced again. * As such, only one thread may call SDL_WaitThread() on another. * * The return code for the thread function is placed in the area * pointed to by \c status, if \c status is not NULL. * * You may not wait on a thread that has been used in a call to * SDL_DetachThread(). Use either that function or this one, but not * both, or behavior is undefined. * * It is safe to pass NULL to this function; it is a no-op. */ extern DECLSPEC void SDLCALL SDL_WaitThread(SDL_Thread * thread, int *status); /** * A thread may be "detached" to signify that it should not remain until * another thread has called SDL_WaitThread() on it. Detaching a thread * is useful for long-running threads that nothing needs to synchronize * with or further manage. When a detached thread is done, it simply * goes away. * * There is no way to recover the return code of a detached thread. If you * need this, don't detach the thread and instead use SDL_WaitThread(). * * Once a thread is detached, you should usually assume the SDL_Thread isn't * safe to reference again, as it will become invalid immediately upon * the detached thread's exit, instead of remaining until someone has called * SDL_WaitThread() to finally clean it up. As such, don't detach the same * thread more than once. * * If a thread has already exited when passed to SDL_DetachThread(), it will * stop waiting for a call to SDL_WaitThread() and clean up immediately. * It is not safe to detach a thread that might be used with SDL_WaitThread(). * * You may not call SDL_WaitThread() on a thread that has been detached. * Use either that function or this one, but not both, or behavior is * undefined. * * It is safe to pass NULL to this function; it is a no-op. */ extern DECLSPEC void SDLCALL SDL_DetachThread(SDL_Thread * thread); /** * \brief Create an identifier that is globally visible to all threads but refers to data that is thread-specific. * * \return The newly created thread local storage identifier, or 0 on error * * \code * static SDL_SpinLock tls_lock; * static SDL_TLSID thread_local_storage; * * void SetMyThreadData(void *value) * { * if (!thread_local_storage) { * SDL_AtomicLock(&tls_lock); * if (!thread_local_storage) { * thread_local_storage = SDL_TLSCreate(); * } * SDL_AtomicUnLock(&tls_lock); * } * SDL_TLSSet(thread_local_storage, value); * } * * void *GetMyThreadData(void) * { * return SDL_TLSGet(thread_local_storage); * } * \endcode * * \sa SDL_TLSGet() * \sa SDL_TLSSet() */ extern DECLSPEC SDL_TLSID SDLCALL SDL_TLSCreate(void); /** * \brief Get the value associated with a thread local storage ID for the current thread. * * \param id The thread local storage ID * * \return The value associated with the ID for the current thread, or NULL if no value has been set. * * \sa SDL_TLSCreate() * \sa SDL_TLSSet() */ extern DECLSPEC void * SDLCALL SDL_TLSGet(SDL_TLSID id); /** * \brief Set the value associated with a thread local storage ID for the current thread. * * \param id The thread local storage ID * \param value The value to associate with the ID for the current thread * \param destructor A function called when the thread exits, to free the value. * * \return 0 on success, -1 on error * * \sa SDL_TLSCreate() * \sa SDL_TLSGet() */ extern DECLSPEC int SDLCALL SDL_TLSSet(SDL_TLSID id, const void *value, void (*destructor)(void*)); /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif # 283 "/usr/local/include/SDL2/SDL_thread.h" #if 0 /* expanded by -frewrite-includes */ #include "close_code.h" #endif /* expanded by -frewrite-includes */ # 283 "/usr/local/include/SDL2/SDL_thread.h" # 1 "/usr/local/include/SDL2/close_code.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file close_code.h * * This file reverses the effects of begin_code.h and should be included * after you finish any function and structure declarations in your headers */ #undef _begin_code_h /* Reset structure packing at previous byte alignment */ #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__WATCOMC__) || defined(__BORLANDC__) #ifdef __BORLANDC__ #pragma nopackwarning #endif # 36 "/usr/local/include/SDL2/close_code.h" #pragma pack(pop) #endif /* Compiler needs structure packing set */ # 38 "/usr/local/include/SDL2/close_code.h" # 284 "/usr/local/include/SDL2/SDL_thread.h" 2 #endif /* _SDL_thread_h */ # 286 "/usr/local/include/SDL2/SDL_thread.h" /* vi: set ts=4 sw=4 expandtab: */ # 36 "/usr/local/include/SDL2/SDL_audio.h" 2 #if 0 /* expanded by -frewrite-includes */ #include "SDL_rwops.h" #endif /* expanded by -frewrite-includes */ # 36 "/usr/local/include/SDL2/SDL_audio.h" # 1 "/usr/local/include/SDL2/SDL_rwops.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file SDL_rwops.h * * This file provides a general interface for SDL to read and write * data streams. It can easily be extended to files, memory, etc. */ #ifndef _SDL_rwops_h #define _SDL_rwops_h #if 0 /* expanded by -frewrite-includes */ #include "SDL_stdinc.h" #endif /* expanded by -frewrite-includes */ # 32 "/usr/local/include/SDL2/SDL_rwops.h" # 33 "/usr/local/include/SDL2/SDL_rwops.h" #if 0 /* expanded by -frewrite-includes */ #include "SDL_error.h" #endif /* expanded by -frewrite-includes */ # 33 "/usr/local/include/SDL2/SDL_rwops.h" # 34 "/usr/local/include/SDL2/SDL_rwops.h" #if 0 /* expanded by -frewrite-includes */ #include "begin_code.h" #endif /* expanded by -frewrite-includes */ # 35 "/usr/local/include/SDL2/SDL_rwops.h" # 1 "/usr/local/include/SDL2/begin_code.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file begin_code.h * * This file sets things up for C dynamic library function definitions, * static inlined functions, and structures aligned at 4-byte alignment. * If you don't like ugly C preprocessor code, don't look at this file. :) */ /* This shouldn't be nested -- included it around code only. */ #ifdef _begin_code_h #error Nested inclusion of begin_code.h #endif # 34 "/usr/local/include/SDL2/begin_code.h" #define _begin_code_h #ifndef SDL_DEPRECATED # if (__GNUC__ >= 4) /* technically, this arrived in gcc 3.1, but oh well. */ # define SDL_DEPRECATED __attribute__((deprecated)) # else # 40 "/usr/local/include/SDL2/begin_code.h" # define SDL_DEPRECATED # endif # 42 "/usr/local/include/SDL2/begin_code.h" #endif # 43 "/usr/local/include/SDL2/begin_code.h" /* Some compilers use a special export keyword */ #ifndef DECLSPEC # if defined(__WIN32__) || defined(__WINRT__) # ifdef __BORLANDC__ # ifdef BUILD_SDL # define DECLSPEC # else # 51 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllimport) # endif # 53 "/usr/local/include/SDL2/begin_code.h" # else # 54 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllexport) # endif # 56 "/usr/local/include/SDL2/begin_code.h" # else # 57 "/usr/local/include/SDL2/begin_code.h" # if defined(__GNUC__) && __GNUC__ >= 4 # define DECLSPEC __attribute__ ((visibility("default"))) # elif defined(__GNUC__) && __GNUC__ >= 2 # 60 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllexport) # else # 62 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC # endif # 64 "/usr/local/include/SDL2/begin_code.h" # endif # 65 "/usr/local/include/SDL2/begin_code.h" #endif # 66 "/usr/local/include/SDL2/begin_code.h" /* By default SDL uses the C calling convention */ #ifndef SDLCALL #if (defined(__WIN32__) || defined(__WINRT__)) && !defined(__GNUC__) #define SDLCALL __cdecl #else # 72 "/usr/local/include/SDL2/begin_code.h" #define SDLCALL #endif # 74 "/usr/local/include/SDL2/begin_code.h" #endif /* SDLCALL */ # 75 "/usr/local/include/SDL2/begin_code.h" /* Removed DECLSPEC on Symbian OS because SDL cannot be a DLL in EPOC */ #ifdef __SYMBIAN32__ #undef DECLSPEC #define DECLSPEC #endif /* __SYMBIAN32__ */ # 81 "/usr/local/include/SDL2/begin_code.h" /* Force structure packing at 4 byte alignment. This is necessary if the header is included in code which has structure packing set to an alternate value, say for loading structures from disk. The packing is reset to the previous value in close_code.h */ #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__) #ifdef _MSC_VER #pragma warning(disable: 4103) #endif # 91 "/usr/local/include/SDL2/begin_code.h" #ifdef __BORLANDC__ #pragma nopackwarning #endif # 94 "/usr/local/include/SDL2/begin_code.h" #ifdef _M_X64 /* Use 8-byte alignment on 64-bit architectures, so pointers are aligned */ #pragma pack(push,8) #else # 98 "/usr/local/include/SDL2/begin_code.h" #pragma pack(push,4) #endif # 100 "/usr/local/include/SDL2/begin_code.h" #endif /* Compiler needs structure packing set */ # 101 "/usr/local/include/SDL2/begin_code.h" #ifndef SDL_INLINE #if defined(__GNUC__) #define SDL_INLINE __inline__ #elif defined(_MSC_VER) || defined(__BORLANDC__) || \ defined(__DMC__) || defined(__SC__) || \ defined(__WATCOMC__) || defined(__LCC__) || \ defined(__DECC) # 109 "/usr/local/include/SDL2/begin_code.h" #define SDL_INLINE __inline #ifndef __inline__ #define __inline__ __inline #endif # 113 "/usr/local/include/SDL2/begin_code.h" #else # 114 "/usr/local/include/SDL2/begin_code.h" #define SDL_INLINE inline #ifndef __inline__ #define __inline__ inline #endif # 118 "/usr/local/include/SDL2/begin_code.h" #endif # 119 "/usr/local/include/SDL2/begin_code.h" #endif /* SDL_INLINE not defined */ # 120 "/usr/local/include/SDL2/begin_code.h" #ifndef SDL_FORCE_INLINE #if defined(_MSC_VER) #define SDL_FORCE_INLINE __forceinline #elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) ) # 125 "/usr/local/include/SDL2/begin_code.h" #define SDL_FORCE_INLINE __attribute__((always_inline)) static __inline__ #else # 127 "/usr/local/include/SDL2/begin_code.h" #define SDL_FORCE_INLINE static SDL_INLINE #endif # 129 "/usr/local/include/SDL2/begin_code.h" #endif /* SDL_FORCE_INLINE not defined */ # 130 "/usr/local/include/SDL2/begin_code.h" /* Apparently this is needed by several Windows compilers */ #if !defined(__MACH__) #ifndef NULL #ifdef __cplusplus #define NULL 0 #else # 137 "/usr/local/include/SDL2/begin_code.h" #define NULL ((void *)0) #endif # 139 "/usr/local/include/SDL2/begin_code.h" #endif /* NULL */ # 140 "/usr/local/include/SDL2/begin_code.h" #endif /* ! Mac OS X - breaks precompiled headers */ # 141 "/usr/local/include/SDL2/begin_code.h" # 36 "/usr/local/include/SDL2/SDL_rwops.h" 2 /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif # 40 "/usr/local/include/SDL2/SDL_rwops.h" /* RWops Types */ #define SDL_RWOPS_UNKNOWN 0 /* Unknown stream type */ #define SDL_RWOPS_WINFILE 1 /* Win32 file */ #define SDL_RWOPS_STDFILE 2 /* Stdio file */ #define SDL_RWOPS_JNIFILE 3 /* Android asset */ #define SDL_RWOPS_MEMORY 4 /* Memory stream */ #define SDL_RWOPS_MEMORY_RO 5 /* Read-Only memory stream */ /** * This is the read/write operation structure -- very basic. */ typedef struct SDL_RWops { /** * Return the size of the file in this rwops, or -1 if unknown */ Sint64 (SDLCALL * size) (struct SDL_RWops * context); /** * Seek to \c offset relative to \c whence, one of stdio's whence values: * RW_SEEK_SET, RW_SEEK_CUR, RW_SEEK_END * * \return the final offset in the data stream, or -1 on error. */ Sint64 (SDLCALL * seek) (struct SDL_RWops * context, Sint64 offset, int whence); /** * Read up to \c maxnum objects each of size \c size from the data * stream to the area pointed at by \c ptr. * * \return the number of objects read, or 0 at error or end of file. */ size_t (SDLCALL * read) (struct SDL_RWops * context, void *ptr, size_t size, size_t maxnum); /** * Write exactly \c num objects each of size \c size from the area * pointed at by \c ptr to data stream. * * \return the number of objects written, or 0 at error or end of file. */ size_t (SDLCALL * write) (struct SDL_RWops * context, const void *ptr, size_t size, size_t num); /** * Close and free an allocated SDL_RWops structure. * * \return 0 if successful or -1 on write error when flushing data. */ int (SDLCALL * close) (struct SDL_RWops * context); Uint32 type; union { #if defined(ANDROID) struct { void *fileNameRef; void *inputStreamRef; void *readableByteChannelRef; void *readMethod; void *assetFileDescriptorRef; long position; long size; long offset; int fd; } androidio; #elif defined(__WIN32__) # 110 "/usr/local/include/SDL2/SDL_rwops.h" struct { SDL_bool append; void *h; struct { void *data; size_t size; size_t left; } buffer; } windowsio; #endif # 122 "/usr/local/include/SDL2/SDL_rwops.h" #ifdef HAVE_STDIO_H struct { SDL_bool autoclose; FILE *fp; } stdio; #endif # 130 "/usr/local/include/SDL2/SDL_rwops.h" struct { Uint8 *base; Uint8 *here; Uint8 *stop; } mem; struct { void *data1; void *data2; } unknown; } hidden; } SDL_RWops; /** * \name RWFrom functions * * Functions to create SDL_RWops structures from various data streams. */ /* @{ */ extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromFile(const char *file, const char *mode); #ifdef HAVE_STDIO_H extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromFP(FILE * fp, SDL_bool autoclose); #else # 160 "/usr/local/include/SDL2/SDL_rwops.h" extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromFP(void * fp, SDL_bool autoclose); #endif # 163 "/usr/local/include/SDL2/SDL_rwops.h" extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromMem(void *mem, int size); extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromConstMem(const void *mem, int size); /* @} *//* RWFrom functions */ extern DECLSPEC SDL_RWops *SDLCALL SDL_AllocRW(void); extern DECLSPEC void SDLCALL SDL_FreeRW(SDL_RWops * area); #define RW_SEEK_SET 0 /**< Seek from the beginning of data */ #define RW_SEEK_CUR 1 /**< Seek relative to current read point */ #define RW_SEEK_END 2 /**< Seek relative to the end of data */ /** * \name Read/write macros * * Macros to easily read and write from an SDL_RWops structure. */ /* @{ */ #define SDL_RWsize(ctx) (ctx)->size(ctx) #define SDL_RWseek(ctx, offset, whence) (ctx)->seek(ctx, offset, whence) #define SDL_RWtell(ctx) (ctx)->seek(ctx, 0, RW_SEEK_CUR) #define SDL_RWread(ctx, ptr, size, n) (ctx)->read(ctx, ptr, size, n) #define SDL_RWwrite(ctx, ptr, size, n) (ctx)->write(ctx, ptr, size, n) #define SDL_RWclose(ctx) (ctx)->close(ctx) /* @} *//* Read/write macros */ /** * \name Read endian functions * * Read an item of the specified endianness and return in native format. */ /* @{ */ extern DECLSPEC Uint8 SDLCALL SDL_ReadU8(SDL_RWops * src); extern DECLSPEC Uint16 SDLCALL SDL_ReadLE16(SDL_RWops * src); extern DECLSPEC Uint16 SDLCALL SDL_ReadBE16(SDL_RWops * src); extern DECLSPEC Uint32 SDLCALL SDL_ReadLE32(SDL_RWops * src); extern DECLSPEC Uint32 SDLCALL SDL_ReadBE32(SDL_RWops * src); extern DECLSPEC Uint64 SDLCALL SDL_ReadLE64(SDL_RWops * src); extern DECLSPEC Uint64 SDLCALL SDL_ReadBE64(SDL_RWops * src); /* @} *//* Read endian functions */ /** * \name Write endian functions * * Write an item of native format to the specified endianness. */ /* @{ */ extern DECLSPEC size_t SDLCALL SDL_WriteU8(SDL_RWops * dst, Uint8 value); extern DECLSPEC size_t SDLCALL SDL_WriteLE16(SDL_RWops * dst, Uint16 value); extern DECLSPEC size_t SDLCALL SDL_WriteBE16(SDL_RWops * dst, Uint16 value); extern DECLSPEC size_t SDLCALL SDL_WriteLE32(SDL_RWops * dst, Uint32 value); extern DECLSPEC size_t SDLCALL SDL_WriteBE32(SDL_RWops * dst, Uint32 value); extern DECLSPEC size_t SDLCALL SDL_WriteLE64(SDL_RWops * dst, Uint64 value); extern DECLSPEC size_t SDLCALL SDL_WriteBE64(SDL_RWops * dst, Uint64 value); /* @} *//* Write endian functions */ /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif # 228 "/usr/local/include/SDL2/SDL_rwops.h" #if 0 /* expanded by -frewrite-includes */ #include "close_code.h" #endif /* expanded by -frewrite-includes */ # 228 "/usr/local/include/SDL2/SDL_rwops.h" # 1 "/usr/local/include/SDL2/close_code.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file close_code.h * * This file reverses the effects of begin_code.h and should be included * after you finish any function and structure declarations in your headers */ #undef _begin_code_h /* Reset structure packing at previous byte alignment */ #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__WATCOMC__) || defined(__BORLANDC__) #ifdef __BORLANDC__ #pragma nopackwarning #endif # 36 "/usr/local/include/SDL2/close_code.h" #pragma pack(pop) #endif /* Compiler needs structure packing set */ # 38 "/usr/local/include/SDL2/close_code.h" # 229 "/usr/local/include/SDL2/SDL_rwops.h" 2 #endif /* _SDL_rwops_h */ # 231 "/usr/local/include/SDL2/SDL_rwops.h" /* vi: set ts=4 sw=4 expandtab: */ # 37 "/usr/local/include/SDL2/SDL_audio.h" 2 #if 0 /* expanded by -frewrite-includes */ #include "begin_code.h" #endif /* expanded by -frewrite-includes */ # 38 "/usr/local/include/SDL2/SDL_audio.h" # 1 "/usr/local/include/SDL2/begin_code.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file begin_code.h * * This file sets things up for C dynamic library function definitions, * static inlined functions, and structures aligned at 4-byte alignment. * If you don't like ugly C preprocessor code, don't look at this file. :) */ /* This shouldn't be nested -- included it around code only. */ #ifdef _begin_code_h #error Nested inclusion of begin_code.h #endif # 34 "/usr/local/include/SDL2/begin_code.h" #define _begin_code_h #ifndef SDL_DEPRECATED # if (__GNUC__ >= 4) /* technically, this arrived in gcc 3.1, but oh well. */ # define SDL_DEPRECATED __attribute__((deprecated)) # else # 40 "/usr/local/include/SDL2/begin_code.h" # define SDL_DEPRECATED # endif # 42 "/usr/local/include/SDL2/begin_code.h" #endif # 43 "/usr/local/include/SDL2/begin_code.h" /* Some compilers use a special export keyword */ #ifndef DECLSPEC # if defined(__WIN32__) || defined(__WINRT__) # ifdef __BORLANDC__ # ifdef BUILD_SDL # define DECLSPEC # else # 51 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllimport) # endif # 53 "/usr/local/include/SDL2/begin_code.h" # else # 54 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllexport) # endif # 56 "/usr/local/include/SDL2/begin_code.h" # else # 57 "/usr/local/include/SDL2/begin_code.h" # if defined(__GNUC__) && __GNUC__ >= 4 # define DECLSPEC __attribute__ ((visibility("default"))) # elif defined(__GNUC__) && __GNUC__ >= 2 # 60 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllexport) # else # 62 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC # endif # 64 "/usr/local/include/SDL2/begin_code.h" # endif # 65 "/usr/local/include/SDL2/begin_code.h" #endif # 66 "/usr/local/include/SDL2/begin_code.h" /* By default SDL uses the C calling convention */ #ifndef SDLCALL #if (defined(__WIN32__) || defined(__WINRT__)) && !defined(__GNUC__) #define SDLCALL __cdecl #else # 72 "/usr/local/include/SDL2/begin_code.h" #define SDLCALL #endif # 74 "/usr/local/include/SDL2/begin_code.h" #endif /* SDLCALL */ # 75 "/usr/local/include/SDL2/begin_code.h" /* Removed DECLSPEC on Symbian OS because SDL cannot be a DLL in EPOC */ #ifdef __SYMBIAN32__ #undef DECLSPEC #define DECLSPEC #endif /* __SYMBIAN32__ */ # 81 "/usr/local/include/SDL2/begin_code.h" /* Force structure packing at 4 byte alignment. This is necessary if the header is included in code which has structure packing set to an alternate value, say for loading structures from disk. The packing is reset to the previous value in close_code.h */ #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__) #ifdef _MSC_VER #pragma warning(disable: 4103) #endif # 91 "/usr/local/include/SDL2/begin_code.h" #ifdef __BORLANDC__ #pragma nopackwarning #endif # 94 "/usr/local/include/SDL2/begin_code.h" #ifdef _M_X64 /* Use 8-byte alignment on 64-bit architectures, so pointers are aligned */ #pragma pack(push,8) #else # 98 "/usr/local/include/SDL2/begin_code.h" #pragma pack(push,4) #endif # 100 "/usr/local/include/SDL2/begin_code.h" #endif /* Compiler needs structure packing set */ # 101 "/usr/local/include/SDL2/begin_code.h" #ifndef SDL_INLINE #if defined(__GNUC__) #define SDL_INLINE __inline__ #elif defined(_MSC_VER) || defined(__BORLANDC__) || \ defined(__DMC__) || defined(__SC__) || \ defined(__WATCOMC__) || defined(__LCC__) || \ defined(__DECC) # 109 "/usr/local/include/SDL2/begin_code.h" #define SDL_INLINE __inline #ifndef __inline__ #define __inline__ __inline #endif # 113 "/usr/local/include/SDL2/begin_code.h" #else # 114 "/usr/local/include/SDL2/begin_code.h" #define SDL_INLINE inline #ifndef __inline__ #define __inline__ inline #endif # 118 "/usr/local/include/SDL2/begin_code.h" #endif # 119 "/usr/local/include/SDL2/begin_code.h" #endif /* SDL_INLINE not defined */ # 120 "/usr/local/include/SDL2/begin_code.h" #ifndef SDL_FORCE_INLINE #if defined(_MSC_VER) #define SDL_FORCE_INLINE __forceinline #elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) ) # 125 "/usr/local/include/SDL2/begin_code.h" #define SDL_FORCE_INLINE __attribute__((always_inline)) static __inline__ #else # 127 "/usr/local/include/SDL2/begin_code.h" #define SDL_FORCE_INLINE static SDL_INLINE #endif # 129 "/usr/local/include/SDL2/begin_code.h" #endif /* SDL_FORCE_INLINE not defined */ # 130 "/usr/local/include/SDL2/begin_code.h" /* Apparently this is needed by several Windows compilers */ #if !defined(__MACH__) #ifndef NULL #ifdef __cplusplus #define NULL 0 #else # 137 "/usr/local/include/SDL2/begin_code.h" #define NULL ((void *)0) #endif # 139 "/usr/local/include/SDL2/begin_code.h" #endif /* NULL */ # 140 "/usr/local/include/SDL2/begin_code.h" #endif /* ! Mac OS X - breaks precompiled headers */ # 141 "/usr/local/include/SDL2/begin_code.h" # 39 "/usr/local/include/SDL2/SDL_audio.h" 2 /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif # 43 "/usr/local/include/SDL2/SDL_audio.h" /** * \brief Audio format flags. * * These are what the 16 bits in SDL_AudioFormat currently mean... * (Unspecified bits are always zero). * * \verbatim ++-----------------------sample is signed if set || || ++-----------sample is bigendian if set || || || || ++---sample is float if set || || || || || || +---sample bit size---+ || || || | | 15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00 \endverbatim * * There are macros in SDL 2.0 and later to query these bits. */ typedef Uint16 SDL_AudioFormat; /** * \name Audio flags */ /* @{ */ #define SDL_AUDIO_MASK_BITSIZE (0xFF) #define SDL_AUDIO_MASK_DATATYPE (1<<8) #define SDL_AUDIO_MASK_ENDIAN (1<<12) #define SDL_AUDIO_MASK_SIGNED (1<<15) #define SDL_AUDIO_BITSIZE(x) (x & SDL_AUDIO_MASK_BITSIZE) #define SDL_AUDIO_ISFLOAT(x) (x & SDL_AUDIO_MASK_DATATYPE) #define SDL_AUDIO_ISBIGENDIAN(x) (x & SDL_AUDIO_MASK_ENDIAN) #define SDL_AUDIO_ISSIGNED(x) (x & SDL_AUDIO_MASK_SIGNED) #define SDL_AUDIO_ISINT(x) (!SDL_AUDIO_ISFLOAT(x)) #define SDL_AUDIO_ISLITTLEENDIAN(x) (!SDL_AUDIO_ISBIGENDIAN(x)) #define SDL_AUDIO_ISUNSIGNED(x) (!SDL_AUDIO_ISSIGNED(x)) /** * \name Audio format flags * * Defaults to LSB byte order. */ /* @{ */ #define AUDIO_U8 0x0008 /**< Unsigned 8-bit samples */ #define AUDIO_S8 0x8008 /**< Signed 8-bit samples */ #define AUDIO_U16LSB 0x0010 /**< Unsigned 16-bit samples */ #define AUDIO_S16LSB 0x8010 /**< Signed 16-bit samples */ #define AUDIO_U16MSB 0x1010 /**< As above, but big-endian byte order */ #define AUDIO_S16MSB 0x9010 /**< As above, but big-endian byte order */ #define AUDIO_U16 AUDIO_U16LSB #define AUDIO_S16 AUDIO_S16LSB /* @} */ /** * \name int32 support */ /* @{ */ #define AUDIO_S32LSB 0x8020 /**< 32-bit integer samples */ #define AUDIO_S32MSB 0x9020 /**< As above, but big-endian byte order */ #define AUDIO_S32 AUDIO_S32LSB /* @} */ /** * \name float32 support */ /* @{ */ #define AUDIO_F32LSB 0x8120 /**< 32-bit floating point samples */ #define AUDIO_F32MSB 0x9120 /**< As above, but big-endian byte order */ #define AUDIO_F32 AUDIO_F32LSB /* @} */ /** * \name Native audio byte ordering */ /* @{ */ #if SDL_BYTEORDER == SDL_LIL_ENDIAN #define AUDIO_U16SYS AUDIO_U16LSB #define AUDIO_S16SYS AUDIO_S16LSB #define AUDIO_S32SYS AUDIO_S32LSB #define AUDIO_F32SYS AUDIO_F32LSB #else # 127 "/usr/local/include/SDL2/SDL_audio.h" #define AUDIO_U16SYS AUDIO_U16MSB #define AUDIO_S16SYS AUDIO_S16MSB #define AUDIO_S32SYS AUDIO_S32MSB #define AUDIO_F32SYS AUDIO_F32MSB #endif # 132 "/usr/local/include/SDL2/SDL_audio.h" /* @} */ /** * \name Allow change flags * * Which audio format changes are allowed when opening a device. */ /* @{ */ #define SDL_AUDIO_ALLOW_FREQUENCY_CHANGE 0x00000001 #define SDL_AUDIO_ALLOW_FORMAT_CHANGE 0x00000002 #define SDL_AUDIO_ALLOW_CHANNELS_CHANGE 0x00000004 #define SDL_AUDIO_ALLOW_ANY_CHANGE (SDL_AUDIO_ALLOW_FREQUENCY_CHANGE|SDL_AUDIO_ALLOW_FORMAT_CHANGE|SDL_AUDIO_ALLOW_CHANNELS_CHANGE) /* @} */ /* @} *//* Audio flags */ /** * This function is called when the audio device needs more data. * * \param userdata An application-specific parameter saved in * the SDL_AudioSpec structure * \param stream A pointer to the audio data buffer. * \param len The length of that buffer in bytes. * * Once the callback returns, the buffer will no longer be valid. * Stereo samples are stored in a LRLRLR ordering. */ typedef void (SDLCALL * SDL_AudioCallback) (void *userdata, Uint8 * stream, int len); /** * The calculated values in this structure are calculated by SDL_OpenAudio(). */ typedef struct SDL_AudioSpec { int freq; /**< DSP frequency -- samples per second */ SDL_AudioFormat format; /**< Audio data format */ Uint8 channels; /**< Number of channels: 1 mono, 2 stereo */ Uint8 silence; /**< Audio buffer silence value (calculated) */ Uint16 samples; /**< Audio buffer size in samples (power of 2) */ Uint16 padding; /**< Necessary for some compile environments */ Uint32 size; /**< Audio buffer size in bytes (calculated) */ SDL_AudioCallback callback; void *userdata; } SDL_AudioSpec; struct SDL_AudioCVT; typedef void (SDLCALL * SDL_AudioFilter) (struct SDL_AudioCVT * cvt, SDL_AudioFormat format); /** * A structure to hold a set of audio conversion filters and buffers. */ #ifdef __GNUC__ /* This structure is 84 bytes on 32-bit architectures, make sure GCC doesn't pad it out to 88 bytes to guarantee ABI compatibility between compilers. vvv The next time we rev the ABI, make sure to size the ints and add padding. */ #define SDL_AUDIOCVT_PACKED __attribute__((packed)) #else # 194 "/usr/local/include/SDL2/SDL_audio.h" #define SDL_AUDIOCVT_PACKED #endif # 196 "/usr/local/include/SDL2/SDL_audio.h" /* */ typedef struct SDL_AudioCVT { int needed; /**< Set to 1 if conversion possible */ SDL_AudioFormat src_format; /**< Source audio format */ SDL_AudioFormat dst_format; /**< Target audio format */ double rate_incr; /**< Rate conversion increment */ Uint8 *buf; /**< Buffer to hold entire audio data */ int len; /**< Length of original audio buffer */ int len_cvt; /**< Length of converted audio buffer */ int len_mult; /**< buffer must be len*len_mult big */ double len_ratio; /**< Given len, final size is len*len_ratio */ SDL_AudioFilter filters[10]; /**< Filter list */ int filter_index; /**< Current audio conversion function */ } SDL_AUDIOCVT_PACKED SDL_AudioCVT; /* Function prototypes */ /** * \name Driver discovery functions * * These functions return the list of built in audio drivers, in the * order that they are normally initialized by default. */ /* @{ */ extern DECLSPEC int SDLCALL SDL_GetNumAudioDrivers(void); extern DECLSPEC const char *SDLCALL SDL_GetAudioDriver(int index); /* @} */ /** * \name Initialization and cleanup * * \internal These functions are used internally, and should not be used unless * you have a specific need to specify the audio driver you want to * use. You should normally use SDL_Init() or SDL_InitSubSystem(). */ /* @{ */ extern DECLSPEC int SDLCALL SDL_AudioInit(const char *driver_name); extern DECLSPEC void SDLCALL SDL_AudioQuit(void); /* @} */ /** * This function returns the name of the current audio driver, or NULL * if no driver has been initialized. */ extern DECLSPEC const char *SDLCALL SDL_GetCurrentAudioDriver(void); /** * This function opens the audio device with the desired parameters, and * returns 0 if successful, placing the actual hardware parameters in the * structure pointed to by \c obtained. If \c obtained is NULL, the audio * data passed to the callback function will be guaranteed to be in the * requested format, and will be automatically converted to the hardware * audio format if necessary. This function returns -1 if it failed * to open the audio device, or couldn't set up the audio thread. * * When filling in the desired audio spec structure, * - \c desired->freq should be the desired audio frequency in samples-per- * second. * - \c desired->format should be the desired audio format. * - \c desired->samples is the desired size of the audio buffer, in * samples. This number should be a power of two, and may be adjusted by * the audio driver to a value more suitable for the hardware. Good values * seem to range between 512 and 8096 inclusive, depending on the * application and CPU speed. Smaller values yield faster response time, * but can lead to underflow if the application is doing heavy processing * and cannot fill the audio buffer in time. A stereo sample consists of * both right and left channels in LR ordering. * Note that the number of samples is directly related to time by the * following formula: \code ms = (samples*1000)/freq \endcode * - \c desired->size is the size in bytes of the audio buffer, and is * calculated by SDL_OpenAudio(). * - \c desired->silence is the value used to set the buffer to silence, * and is calculated by SDL_OpenAudio(). * - \c desired->callback should be set to a function that will be called * when the audio device is ready for more data. It is passed a pointer * to the audio buffer, and the length in bytes of the audio buffer. * This function usually runs in a separate thread, and so you should * protect data structures that it accesses by calling SDL_LockAudio() * and SDL_UnlockAudio() in your code. * - \c desired->userdata is passed as the first parameter to your callback * function. * * The audio device starts out playing silence when it's opened, and should * be enabled for playing by calling \c SDL_PauseAudio(0) when you are ready * for your audio callback function to be called. Since the audio driver * may modify the requested size of the audio buffer, you should allocate * any local mixing buffers after you open the audio device. */ extern DECLSPEC int SDLCALL SDL_OpenAudio(SDL_AudioSpec * desired, SDL_AudioSpec * obtained); /** * SDL Audio Device IDs. * * A successful call to SDL_OpenAudio() is always device id 1, and legacy * SDL audio APIs assume you want this device ID. SDL_OpenAudioDevice() calls * always returns devices >= 2 on success. The legacy calls are good both * for backwards compatibility and when you don't care about multiple, * specific, or capture devices. */ typedef Uint32 SDL_AudioDeviceID; /** * Get the number of available devices exposed by the current driver. * Only valid after a successfully initializing the audio subsystem. * Returns -1 if an explicit list of devices can't be determined; this is * not an error. For example, if SDL is set up to talk to a remote audio * server, it can't list every one available on the Internet, but it will * still allow a specific host to be specified to SDL_OpenAudioDevice(). * * In many common cases, when this function returns a value <= 0, it can still * successfully open the default device (NULL for first argument of * SDL_OpenAudioDevice()). */ extern DECLSPEC int SDLCALL SDL_GetNumAudioDevices(int iscapture); /** * Get the human-readable name of a specific audio device. * Must be a value between 0 and (number of audio devices-1). * Only valid after a successfully initializing the audio subsystem. * The values returned by this function reflect the latest call to * SDL_GetNumAudioDevices(); recall that function to redetect available * hardware. * * The string returned by this function is UTF-8 encoded, read-only, and * managed internally. You are not to free it. If you need to keep the * string for any length of time, you should make your own copy of it, as it * will be invalid next time any of several other SDL functions is called. */ extern DECLSPEC const char *SDLCALL SDL_GetAudioDeviceName(int index, int iscapture); /** * Open a specific audio device. Passing in a device name of NULL requests * the most reasonable default (and is equivalent to calling SDL_OpenAudio()). * * The device name is a UTF-8 string reported by SDL_GetAudioDeviceName(), but * some drivers allow arbitrary and driver-specific strings, such as a * hostname/IP address for a remote audio server, or a filename in the * diskaudio driver. * * \return 0 on error, a valid device ID that is >= 2 on success. * * SDL_OpenAudio(), unlike this function, always acts on device ID 1. */ extern DECLSPEC SDL_AudioDeviceID SDLCALL SDL_OpenAudioDevice(const char *device, int iscapture, const SDL_AudioSpec * desired, SDL_AudioSpec * obtained, int allowed_changes); /** * \name Audio state * * Get the current audio state. */ /* @{ */ typedef enum { SDL_AUDIO_STOPPED = 0, SDL_AUDIO_PLAYING, SDL_AUDIO_PAUSED } SDL_AudioStatus; extern DECLSPEC SDL_AudioStatus SDLCALL SDL_GetAudioStatus(void); extern DECLSPEC SDL_AudioStatus SDLCALL SDL_GetAudioDeviceStatus(SDL_AudioDeviceID dev); /* @} *//* Audio State */ /** * \name Pause audio functions * * These functions pause and unpause the audio callback processing. * They should be called with a parameter of 0 after opening the audio * device to start playing sound. This is so you can safely initialize * data for your callback function after opening the audio device. * Silence will be written to the audio device during the pause. */ /* @{ */ extern DECLSPEC void SDLCALL SDL_PauseAudio(int pause_on); extern DECLSPEC void SDLCALL SDL_PauseAudioDevice(SDL_AudioDeviceID dev, int pause_on); /* @} *//* Pause audio functions */ /** * This function loads a WAVE from the data source, automatically freeing * that source if \c freesrc is non-zero. For example, to load a WAVE file, * you could do: * \code * SDL_LoadWAV_RW(SDL_RWFromFile("sample.wav", "rb"), 1, ...); * \endcode * * If this function succeeds, it returns the given SDL_AudioSpec, * filled with the audio data format of the wave data, and sets * \c *audio_buf to a malloc()'d buffer containing the audio data, * and sets \c *audio_len to the length of that audio buffer, in bytes. * You need to free the audio buffer with SDL_FreeWAV() when you are * done with it. * * This function returns NULL and sets the SDL error message if the * wave file cannot be opened, uses an unknown data format, or is * corrupt. Currently raw and MS-ADPCM WAVE files are supported. */ extern DECLSPEC SDL_AudioSpec *SDLCALL SDL_LoadWAV_RW(SDL_RWops * src, int freesrc, SDL_AudioSpec * spec, Uint8 ** audio_buf, Uint32 * audio_len); /** * Loads a WAV from a file. * Compatibility convenience function. */ #define SDL_LoadWAV(file, spec, audio_buf, audio_len) \ SDL_LoadWAV_RW(SDL_RWFromFile(file, "rb"),1, spec,audio_buf,audio_len) /** * This function frees data previously allocated with SDL_LoadWAV_RW() */ extern DECLSPEC void SDLCALL SDL_FreeWAV(Uint8 * audio_buf); /** * This function takes a source format and rate and a destination format * and rate, and initializes the \c cvt structure with information needed * by SDL_ConvertAudio() to convert a buffer of audio data from one format * to the other. * * \return -1 if the format conversion is not supported, 0 if there's * no conversion needed, or 1 if the audio filter is set up. */ extern DECLSPEC int SDLCALL SDL_BuildAudioCVT(SDL_AudioCVT * cvt, SDL_AudioFormat src_format, Uint8 src_channels, int src_rate, SDL_AudioFormat dst_format, Uint8 dst_channels, int dst_rate); /** * Once you have initialized the \c cvt structure using SDL_BuildAudioCVT(), * created an audio buffer \c cvt->buf, and filled it with \c cvt->len bytes of * audio data in the source format, this function will convert it in-place * to the desired format. * * The data conversion may expand the size of the audio data, so the buffer * \c cvt->buf should be allocated after the \c cvt structure is initialized by * SDL_BuildAudioCVT(), and should be \c cvt->len*cvt->len_mult bytes long. */ extern DECLSPEC int SDLCALL SDL_ConvertAudio(SDL_AudioCVT * cvt); #define SDL_MIX_MAXVOLUME 128 /** * This takes two audio buffers of the playing audio format and mixes * them, performing addition, volume adjustment, and overflow clipping. * The volume ranges from 0 - 128, and should be set to ::SDL_MIX_MAXVOLUME * for full audio volume. Note this does not change hardware volume. * This is provided for convenience -- you can mix your own audio data. */ extern DECLSPEC void SDLCALL SDL_MixAudio(Uint8 * dst, const Uint8 * src, Uint32 len, int volume); /** * This works like SDL_MixAudio(), but you specify the audio format instead of * using the format of audio device 1. Thus it can be used when no audio * device is open at all. */ extern DECLSPEC void SDLCALL SDL_MixAudioFormat(Uint8 * dst, const Uint8 * src, SDL_AudioFormat format, Uint32 len, int volume); /** * \name Audio lock functions * * The lock manipulated by these functions protects the callback function. * During a SDL_LockAudio()/SDL_UnlockAudio() pair, you can be guaranteed that * the callback function is not running. Do not call these from the callback * function or you will cause deadlock. */ /* @{ */ extern DECLSPEC void SDLCALL SDL_LockAudio(void); extern DECLSPEC void SDLCALL SDL_LockAudioDevice(SDL_AudioDeviceID dev); extern DECLSPEC void SDLCALL SDL_UnlockAudio(void); extern DECLSPEC void SDLCALL SDL_UnlockAudioDevice(SDL_AudioDeviceID dev); /* @} *//* Audio lock functions */ /** * This function shuts down audio processing and closes the audio device. */ extern DECLSPEC void SDLCALL SDL_CloseAudio(void); extern DECLSPEC void SDLCALL SDL_CloseAudioDevice(SDL_AudioDeviceID dev); /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif # 502 "/usr/local/include/SDL2/SDL_audio.h" #if 0 /* expanded by -frewrite-includes */ #include "close_code.h" #endif /* expanded by -frewrite-includes */ # 502 "/usr/local/include/SDL2/SDL_audio.h" # 1 "/usr/local/include/SDL2/close_code.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file close_code.h * * This file reverses the effects of begin_code.h and should be included * after you finish any function and structure declarations in your headers */ #undef _begin_code_h /* Reset structure packing at previous byte alignment */ #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__WATCOMC__) || defined(__BORLANDC__) #ifdef __BORLANDC__ #pragma nopackwarning #endif # 36 "/usr/local/include/SDL2/close_code.h" #pragma pack(pop) #endif /* Compiler needs structure packing set */ # 38 "/usr/local/include/SDL2/close_code.h" # 503 "/usr/local/include/SDL2/SDL_audio.h" 2 #endif /* _SDL_audio_h */ # 505 "/usr/local/include/SDL2/SDL_audio.h" /* vi: set ts=4 sw=4 expandtab: */ # 72 "/usr/local/include/SDL2/SDL.h" 2 #if 0 /* expanded by -frewrite-includes */ #include "SDL_clipboard.h" #endif /* expanded by -frewrite-includes */ # 72 "/usr/local/include/SDL2/SDL.h" # 1 "/usr/local/include/SDL2/SDL_clipboard.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file SDL_clipboard.h * * Include file for SDL clipboard handling */ #ifndef _SDL_clipboard_h #define _SDL_clipboard_h #if 0 /* expanded by -frewrite-includes */ #include "SDL_stdinc.h" #endif /* expanded by -frewrite-includes */ # 31 "/usr/local/include/SDL2/SDL_clipboard.h" # 32 "/usr/local/include/SDL2/SDL_clipboard.h" #if 0 /* expanded by -frewrite-includes */ #include "begin_code.h" #endif /* expanded by -frewrite-includes */ # 33 "/usr/local/include/SDL2/SDL_clipboard.h" # 1 "/usr/local/include/SDL2/begin_code.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file begin_code.h * * This file sets things up for C dynamic library function definitions, * static inlined functions, and structures aligned at 4-byte alignment. * If you don't like ugly C preprocessor code, don't look at this file. :) */ /* This shouldn't be nested -- included it around code only. */ #ifdef _begin_code_h #error Nested inclusion of begin_code.h #endif # 34 "/usr/local/include/SDL2/begin_code.h" #define _begin_code_h #ifndef SDL_DEPRECATED # if (__GNUC__ >= 4) /* technically, this arrived in gcc 3.1, but oh well. */ # define SDL_DEPRECATED __attribute__((deprecated)) # else # 40 "/usr/local/include/SDL2/begin_code.h" # define SDL_DEPRECATED # endif # 42 "/usr/local/include/SDL2/begin_code.h" #endif # 43 "/usr/local/include/SDL2/begin_code.h" /* Some compilers use a special export keyword */ #ifndef DECLSPEC # if defined(__WIN32__) || defined(__WINRT__) # ifdef __BORLANDC__ # ifdef BUILD_SDL # define DECLSPEC # else # 51 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllimport) # endif # 53 "/usr/local/include/SDL2/begin_code.h" # else # 54 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllexport) # endif # 56 "/usr/local/include/SDL2/begin_code.h" # else # 57 "/usr/local/include/SDL2/begin_code.h" # if defined(__GNUC__) && __GNUC__ >= 4 # define DECLSPEC __attribute__ ((visibility("default"))) # elif defined(__GNUC__) && __GNUC__ >= 2 # 60 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllexport) # else # 62 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC # endif # 64 "/usr/local/include/SDL2/begin_code.h" # endif # 65 "/usr/local/include/SDL2/begin_code.h" #endif # 66 "/usr/local/include/SDL2/begin_code.h" /* By default SDL uses the C calling convention */ #ifndef SDLCALL #if (defined(__WIN32__) || defined(__WINRT__)) && !defined(__GNUC__) #define SDLCALL __cdecl #else # 72 "/usr/local/include/SDL2/begin_code.h" #define SDLCALL #endif # 74 "/usr/local/include/SDL2/begin_code.h" #endif /* SDLCALL */ # 75 "/usr/local/include/SDL2/begin_code.h" /* Removed DECLSPEC on Symbian OS because SDL cannot be a DLL in EPOC */ #ifdef __SYMBIAN32__ #undef DECLSPEC #define DECLSPEC #endif /* __SYMBIAN32__ */ # 81 "/usr/local/include/SDL2/begin_code.h" /* Force structure packing at 4 byte alignment. This is necessary if the header is included in code which has structure packing set to an alternate value, say for loading structures from disk. The packing is reset to the previous value in close_code.h */ #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__) #ifdef _MSC_VER #pragma warning(disable: 4103) #endif # 91 "/usr/local/include/SDL2/begin_code.h" #ifdef __BORLANDC__ #pragma nopackwarning #endif # 94 "/usr/local/include/SDL2/begin_code.h" #ifdef _M_X64 /* Use 8-byte alignment on 64-bit architectures, so pointers are aligned */ #pragma pack(push,8) #else # 98 "/usr/local/include/SDL2/begin_code.h" #pragma pack(push,4) #endif # 100 "/usr/local/include/SDL2/begin_code.h" #endif /* Compiler needs structure packing set */ # 101 "/usr/local/include/SDL2/begin_code.h" #ifndef SDL_INLINE #if defined(__GNUC__) #define SDL_INLINE __inline__ #elif defined(_MSC_VER) || defined(__BORLANDC__) || \ defined(__DMC__) || defined(__SC__) || \ defined(__WATCOMC__) || defined(__LCC__) || \ defined(__DECC) # 109 "/usr/local/include/SDL2/begin_code.h" #define SDL_INLINE __inline #ifndef __inline__ #define __inline__ __inline #endif # 113 "/usr/local/include/SDL2/begin_code.h" #else # 114 "/usr/local/include/SDL2/begin_code.h" #define SDL_INLINE inline #ifndef __inline__ #define __inline__ inline #endif # 118 "/usr/local/include/SDL2/begin_code.h" #endif # 119 "/usr/local/include/SDL2/begin_code.h" #endif /* SDL_INLINE not defined */ # 120 "/usr/local/include/SDL2/begin_code.h" #ifndef SDL_FORCE_INLINE #if defined(_MSC_VER) #define SDL_FORCE_INLINE __forceinline #elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) ) # 125 "/usr/local/include/SDL2/begin_code.h" #define SDL_FORCE_INLINE __attribute__((always_inline)) static __inline__ #else # 127 "/usr/local/include/SDL2/begin_code.h" #define SDL_FORCE_INLINE static SDL_INLINE #endif # 129 "/usr/local/include/SDL2/begin_code.h" #endif /* SDL_FORCE_INLINE not defined */ # 130 "/usr/local/include/SDL2/begin_code.h" /* Apparently this is needed by several Windows compilers */ #if !defined(__MACH__) #ifndef NULL #ifdef __cplusplus #define NULL 0 #else # 137 "/usr/local/include/SDL2/begin_code.h" #define NULL ((void *)0) #endif # 139 "/usr/local/include/SDL2/begin_code.h" #endif /* NULL */ # 140 "/usr/local/include/SDL2/begin_code.h" #endif /* ! Mac OS X - breaks precompiled headers */ # 141 "/usr/local/include/SDL2/begin_code.h" # 34 "/usr/local/include/SDL2/SDL_clipboard.h" 2 /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif # 38 "/usr/local/include/SDL2/SDL_clipboard.h" /* Function prototypes */ /** * \brief Put UTF-8 text into the clipboard * * \sa SDL_GetClipboardText() */ extern DECLSPEC int SDLCALL SDL_SetClipboardText(const char *text); /** * \brief Get UTF-8 text from the clipboard, which must be freed with SDL_free() * * \sa SDL_SetClipboardText() */ extern DECLSPEC char * SDLCALL SDL_GetClipboardText(void); /** * \brief Returns a flag indicating whether the clipboard exists and contains a text string that is non-empty * * \sa SDL_GetClipboardText() */ extern DECLSPEC SDL_bool SDLCALL SDL_HasClipboardText(void); /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif # 67 "/usr/local/include/SDL2/SDL_clipboard.h" #if 0 /* expanded by -frewrite-includes */ #include "close_code.h" #endif /* expanded by -frewrite-includes */ # 67 "/usr/local/include/SDL2/SDL_clipboard.h" # 1 "/usr/local/include/SDL2/close_code.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file close_code.h * * This file reverses the effects of begin_code.h and should be included * after you finish any function and structure declarations in your headers */ #undef _begin_code_h /* Reset structure packing at previous byte alignment */ #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__WATCOMC__) || defined(__BORLANDC__) #ifdef __BORLANDC__ #pragma nopackwarning #endif # 36 "/usr/local/include/SDL2/close_code.h" #pragma pack(pop) #endif /* Compiler needs structure packing set */ # 38 "/usr/local/include/SDL2/close_code.h" # 68 "/usr/local/include/SDL2/SDL_clipboard.h" 2 #endif /* _SDL_clipboard_h */ # 70 "/usr/local/include/SDL2/SDL_clipboard.h" /* vi: set ts=4 sw=4 expandtab: */ # 73 "/usr/local/include/SDL2/SDL.h" 2 #if 0 /* expanded by -frewrite-includes */ #include "SDL_cpuinfo.h" #endif /* expanded by -frewrite-includes */ # 73 "/usr/local/include/SDL2/SDL.h" # 1 "/usr/local/include/SDL2/SDL_cpuinfo.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file SDL_cpuinfo.h * * CPU feature detection for SDL. */ #ifndef _SDL_cpuinfo_h #define _SDL_cpuinfo_h #if 0 /* expanded by -frewrite-includes */ #include "SDL_stdinc.h" #endif /* expanded by -frewrite-includes */ # 31 "/usr/local/include/SDL2/SDL_cpuinfo.h" # 32 "/usr/local/include/SDL2/SDL_cpuinfo.h" /* Need to do this here because intrin.h has C++ code in it */ /* Visual Studio 2005 has a bug where intrin.h conflicts with winnt.h */ #if defined(_MSC_VER) && (_MSC_VER >= 1500) && (defined(_M_IX86) || defined(_M_X64)) #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 36 "/usr/local/include/SDL2/SDL_cpuinfo.h" # 37 "/usr/local/include/SDL2/SDL_cpuinfo.h" #ifndef _WIN64 #define __MMX__ #define __3dNOW__ #endif # 41 "/usr/local/include/SDL2/SDL_cpuinfo.h" #define __SSE__ #define __SSE2__ #elif defined(__MINGW64_VERSION_MAJOR) # 44 "/usr/local/include/SDL2/SDL_cpuinfo.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 44 "/usr/local/include/SDL2/SDL_cpuinfo.h" # 45 "/usr/local/include/SDL2/SDL_cpuinfo.h" #else # 46 "/usr/local/include/SDL2/SDL_cpuinfo.h" #ifdef __ALTIVEC__ #if HAVE_ALTIVEC_H && !defined(__APPLE_ALTIVEC__) #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 48 "/usr/local/include/SDL2/SDL_cpuinfo.h" # 49 "/usr/local/include/SDL2/SDL_cpuinfo.h" #undef pixel #endif # 51 "/usr/local/include/SDL2/SDL_cpuinfo.h" #endif # 52 "/usr/local/include/SDL2/SDL_cpuinfo.h" #ifdef __MMX__ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 53 "/usr/local/include/SDL2/SDL_cpuinfo.h" # 1 "/usr/local/llvm-devel/bin/../lib/clang/3.7.0/include/mmintrin.h" 1 3 4 /*===---- mmintrin.h - MMX intrinsics --------------------------------------=== * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * *===-----------------------------------------------------------------------=== */ #ifndef __MMINTRIN_H #define __MMINTRIN_H #ifndef __MMX__ #error "MMX instruction set not enabled" #else # 30 "/usr/local/llvm-devel/bin/../lib/clang/3.7.0/include/mmintrin.h" 3 4 typedef long long __m64 __attribute__((__vector_size__(8))); typedef int __v2si __attribute__((__vector_size__(8))); typedef short __v4hi __attribute__((__vector_size__(8))); typedef char __v8qi __attribute__((__vector_size__(8))); static __inline__ void __attribute__((__always_inline__, __nodebug__)) _mm_empty(void) { __builtin_ia32_emms(); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_cvtsi32_si64(int __i) { return (__m64)__builtin_ia32_vec_init_v2si(__i, 0); } static __inline__ int __attribute__((__always_inline__, __nodebug__)) _mm_cvtsi64_si32(__m64 __m) { return __builtin_ia32_vec_ext_v2si((__v2si)__m, 0); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_cvtsi64_m64(long long __i) { return (__m64)__i; } static __inline__ long long __attribute__((__always_inline__, __nodebug__)) _mm_cvtm64_si64(__m64 __m) { return (long long)__m; } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_packs_pi16(__m64 __m1, __m64 __m2) { return (__m64)__builtin_ia32_packsswb((__v4hi)__m1, (__v4hi)__m2); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_packs_pi32(__m64 __m1, __m64 __m2) { return (__m64)__builtin_ia32_packssdw((__v2si)__m1, (__v2si)__m2); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_packs_pu16(__m64 __m1, __m64 __m2) { return (__m64)__builtin_ia32_packuswb((__v4hi)__m1, (__v4hi)__m2); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_unpackhi_pi8(__m64 __m1, __m64 __m2) { return (__m64)__builtin_ia32_punpckhbw((__v8qi)__m1, (__v8qi)__m2); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_unpackhi_pi16(__m64 __m1, __m64 __m2) { return (__m64)__builtin_ia32_punpckhwd((__v4hi)__m1, (__v4hi)__m2); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_unpackhi_pi32(__m64 __m1, __m64 __m2) { return (__m64)__builtin_ia32_punpckhdq((__v2si)__m1, (__v2si)__m2); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_unpacklo_pi8(__m64 __m1, __m64 __m2) { return (__m64)__builtin_ia32_punpcklbw((__v8qi)__m1, (__v8qi)__m2); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_unpacklo_pi16(__m64 __m1, __m64 __m2) { return (__m64)__builtin_ia32_punpcklwd((__v4hi)__m1, (__v4hi)__m2); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_unpacklo_pi32(__m64 __m1, __m64 __m2) { return (__m64)__builtin_ia32_punpckldq((__v2si)__m1, (__v2si)__m2); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_add_pi8(__m64 __m1, __m64 __m2) { return (__m64)__builtin_ia32_paddb((__v8qi)__m1, (__v8qi)__m2); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_add_pi16(__m64 __m1, __m64 __m2) { return (__m64)__builtin_ia32_paddw((__v4hi)__m1, (__v4hi)__m2); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_add_pi32(__m64 __m1, __m64 __m2) { return (__m64)__builtin_ia32_paddd((__v2si)__m1, (__v2si)__m2); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_adds_pi8(__m64 __m1, __m64 __m2) { return (__m64)__builtin_ia32_paddsb((__v8qi)__m1, (__v8qi)__m2); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_adds_pi16(__m64 __m1, __m64 __m2) { return (__m64)__builtin_ia32_paddsw((__v4hi)__m1, (__v4hi)__m2); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_adds_pu8(__m64 __m1, __m64 __m2) { return (__m64)__builtin_ia32_paddusb((__v8qi)__m1, (__v8qi)__m2); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_adds_pu16(__m64 __m1, __m64 __m2) { return (__m64)__builtin_ia32_paddusw((__v4hi)__m1, (__v4hi)__m2); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_sub_pi8(__m64 __m1, __m64 __m2) { return (__m64)__builtin_ia32_psubb((__v8qi)__m1, (__v8qi)__m2); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_sub_pi16(__m64 __m1, __m64 __m2) { return (__m64)__builtin_ia32_psubw((__v4hi)__m1, (__v4hi)__m2); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_sub_pi32(__m64 __m1, __m64 __m2) { return (__m64)__builtin_ia32_psubd((__v2si)__m1, (__v2si)__m2); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_subs_pi8(__m64 __m1, __m64 __m2) { return (__m64)__builtin_ia32_psubsb((__v8qi)__m1, (__v8qi)__m2); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_subs_pi16(__m64 __m1, __m64 __m2) { return (__m64)__builtin_ia32_psubsw((__v4hi)__m1, (__v4hi)__m2); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_subs_pu8(__m64 __m1, __m64 __m2) { return (__m64)__builtin_ia32_psubusb((__v8qi)__m1, (__v8qi)__m2); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_subs_pu16(__m64 __m1, __m64 __m2) { return (__m64)__builtin_ia32_psubusw((__v4hi)__m1, (__v4hi)__m2); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_madd_pi16(__m64 __m1, __m64 __m2) { return (__m64)__builtin_ia32_pmaddwd((__v4hi)__m1, (__v4hi)__m2); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_mulhi_pi16(__m64 __m1, __m64 __m2) { return (__m64)__builtin_ia32_pmulhw((__v4hi)__m1, (__v4hi)__m2); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_mullo_pi16(__m64 __m1, __m64 __m2) { return (__m64)__builtin_ia32_pmullw((__v4hi)__m1, (__v4hi)__m2); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_sll_pi16(__m64 __m, __m64 __count) { return (__m64)__builtin_ia32_psllw((__v4hi)__m, __count); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_slli_pi16(__m64 __m, int __count) { return (__m64)__builtin_ia32_psllwi((__v4hi)__m, __count); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_sll_pi32(__m64 __m, __m64 __count) { return (__m64)__builtin_ia32_pslld((__v2si)__m, __count); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_slli_pi32(__m64 __m, int __count) { return (__m64)__builtin_ia32_pslldi((__v2si)__m, __count); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_sll_si64(__m64 __m, __m64 __count) { return (__m64)__builtin_ia32_psllq(__m, __count); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_slli_si64(__m64 __m, int __count) { return (__m64)__builtin_ia32_psllqi(__m, __count); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_sra_pi16(__m64 __m, __m64 __count) { return (__m64)__builtin_ia32_psraw((__v4hi)__m, __count); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_srai_pi16(__m64 __m, int __count) { return (__m64)__builtin_ia32_psrawi((__v4hi)__m, __count); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_sra_pi32(__m64 __m, __m64 __count) { return (__m64)__builtin_ia32_psrad((__v2si)__m, __count); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_srai_pi32(__m64 __m, int __count) { return (__m64)__builtin_ia32_psradi((__v2si)__m, __count); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_srl_pi16(__m64 __m, __m64 __count) { return (__m64)__builtin_ia32_psrlw((__v4hi)__m, __count); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_srli_pi16(__m64 __m, int __count) { return (__m64)__builtin_ia32_psrlwi((__v4hi)__m, __count); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_srl_pi32(__m64 __m, __m64 __count) { return (__m64)__builtin_ia32_psrld((__v2si)__m, __count); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_srli_pi32(__m64 __m, int __count) { return (__m64)__builtin_ia32_psrldi((__v2si)__m, __count); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_srl_si64(__m64 __m, __m64 __count) { return (__m64)__builtin_ia32_psrlq(__m, __count); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_srli_si64(__m64 __m, int __count) { return (__m64)__builtin_ia32_psrlqi(__m, __count); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_and_si64(__m64 __m1, __m64 __m2) { return __builtin_ia32_pand(__m1, __m2); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_andnot_si64(__m64 __m1, __m64 __m2) { return __builtin_ia32_pandn(__m1, __m2); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_or_si64(__m64 __m1, __m64 __m2) { return __builtin_ia32_por(__m1, __m2); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_xor_si64(__m64 __m1, __m64 __m2) { return __builtin_ia32_pxor(__m1, __m2); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_cmpeq_pi8(__m64 __m1, __m64 __m2) { return (__m64)__builtin_ia32_pcmpeqb((__v8qi)__m1, (__v8qi)__m2); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_cmpeq_pi16(__m64 __m1, __m64 __m2) { return (__m64)__builtin_ia32_pcmpeqw((__v4hi)__m1, (__v4hi)__m2); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_cmpeq_pi32(__m64 __m1, __m64 __m2) { return (__m64)__builtin_ia32_pcmpeqd((__v2si)__m1, (__v2si)__m2); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_cmpgt_pi8(__m64 __m1, __m64 __m2) { return (__m64)__builtin_ia32_pcmpgtb((__v8qi)__m1, (__v8qi)__m2); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_cmpgt_pi16(__m64 __m1, __m64 __m2) { return (__m64)__builtin_ia32_pcmpgtw((__v4hi)__m1, (__v4hi)__m2); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_cmpgt_pi32(__m64 __m1, __m64 __m2) { return (__m64)__builtin_ia32_pcmpgtd((__v2si)__m1, (__v2si)__m2); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_setzero_si64(void) { return (__m64){ 0LL }; } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_set_pi32(int __i1, int __i0) { return (__m64)__builtin_ia32_vec_init_v2si(__i0, __i1); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_set_pi16(short __s3, short __s2, short __s1, short __s0) { return (__m64)__builtin_ia32_vec_init_v4hi(__s0, __s1, __s2, __s3); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_set_pi8(char __b7, char __b6, char __b5, char __b4, char __b3, char __b2, char __b1, char __b0) { return (__m64)__builtin_ia32_vec_init_v8qi(__b0, __b1, __b2, __b3, __b4, __b5, __b6, __b7); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_set1_pi32(int __i) { return _mm_set_pi32(__i, __i); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_set1_pi16(short __w) { return _mm_set_pi16(__w, __w, __w, __w); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_set1_pi8(char __b) { return _mm_set_pi8(__b, __b, __b, __b, __b, __b, __b, __b); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_setr_pi32(int __i0, int __i1) { return _mm_set_pi32(__i1, __i0); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_setr_pi16(short __w0, short __w1, short __w2, short __w3) { return _mm_set_pi16(__w3, __w2, __w1, __w0); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_setr_pi8(char __b0, char __b1, char __b2, char __b3, char __b4, char __b5, char __b6, char __b7) { return _mm_set_pi8(__b7, __b6, __b5, __b4, __b3, __b2, __b1, __b0); } /* Aliases for compatibility. */ #define _m_empty _mm_empty #define _m_from_int _mm_cvtsi32_si64 #define _m_to_int _mm_cvtsi64_si32 #define _m_packsswb _mm_packs_pi16 #define _m_packssdw _mm_packs_pi32 #define _m_packuswb _mm_packs_pu16 #define _m_punpckhbw _mm_unpackhi_pi8 #define _m_punpckhwd _mm_unpackhi_pi16 #define _m_punpckhdq _mm_unpackhi_pi32 #define _m_punpcklbw _mm_unpacklo_pi8 #define _m_punpcklwd _mm_unpacklo_pi16 #define _m_punpckldq _mm_unpacklo_pi32 #define _m_paddb _mm_add_pi8 #define _m_paddw _mm_add_pi16 #define _m_paddd _mm_add_pi32 #define _m_paddsb _mm_adds_pi8 #define _m_paddsw _mm_adds_pi16 #define _m_paddusb _mm_adds_pu8 #define _m_paddusw _mm_adds_pu16 #define _m_psubb _mm_sub_pi8 #define _m_psubw _mm_sub_pi16 #define _m_psubd _mm_sub_pi32 #define _m_psubsb _mm_subs_pi8 #define _m_psubsw _mm_subs_pi16 #define _m_psubusb _mm_subs_pu8 #define _m_psubusw _mm_subs_pu16 #define _m_pmaddwd _mm_madd_pi16 #define _m_pmulhw _mm_mulhi_pi16 #define _m_pmullw _mm_mullo_pi16 #define _m_psllw _mm_sll_pi16 #define _m_psllwi _mm_slli_pi16 #define _m_pslld _mm_sll_pi32 #define _m_pslldi _mm_slli_pi32 #define _m_psllq _mm_sll_si64 #define _m_psllqi _mm_slli_si64 #define _m_psraw _mm_sra_pi16 #define _m_psrawi _mm_srai_pi16 #define _m_psrad _mm_sra_pi32 #define _m_psradi _mm_srai_pi32 #define _m_psrlw _mm_srl_pi16 #define _m_psrlwi _mm_srli_pi16 #define _m_psrld _mm_srl_pi32 #define _m_psrldi _mm_srli_pi32 #define _m_psrlq _mm_srl_si64 #define _m_psrlqi _mm_srli_si64 #define _m_pand _mm_and_si64 #define _m_pandn _mm_andnot_si64 #define _m_por _mm_or_si64 #define _m_pxor _mm_xor_si64 #define _m_pcmpeqb _mm_cmpeq_pi8 #define _m_pcmpeqw _mm_cmpeq_pi16 #define _m_pcmpeqd _mm_cmpeq_pi32 #define _m_pcmpgtb _mm_cmpgt_pi8 #define _m_pcmpgtw _mm_cmpgt_pi16 #define _m_pcmpgtd _mm_cmpgt_pi32 #endif /* __MMX__ */ # 501 "/usr/local/llvm-devel/bin/../lib/clang/3.7.0/include/mmintrin.h" 3 4 #endif /* __MMINTRIN_H */ # 503 "/usr/local/llvm-devel/bin/../lib/clang/3.7.0/include/mmintrin.h" 3 4 # 54 "/usr/local/include/SDL2/SDL_cpuinfo.h" 2 #endif # 55 "/usr/local/include/SDL2/SDL_cpuinfo.h" #ifdef __3dNOW__ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 56 "/usr/local/include/SDL2/SDL_cpuinfo.h" # 57 "/usr/local/include/SDL2/SDL_cpuinfo.h" #endif # 58 "/usr/local/include/SDL2/SDL_cpuinfo.h" #ifdef __SSE__ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 59 "/usr/local/include/SDL2/SDL_cpuinfo.h" # 1 "/usr/local/llvm-devel/bin/../lib/clang/3.7.0/include/xmmintrin.h" 1 3 4 /*===---- xmmintrin.h - SSE intrinsics -------------------------------------=== * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * *===-----------------------------------------------------------------------=== */ #ifndef __XMMINTRIN_H #define __XMMINTRIN_H #ifndef __SSE__ #error "SSE instruction set not enabled" #else # 30 "/usr/local/llvm-devel/bin/../lib/clang/3.7.0/include/xmmintrin.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 31 "/usr/local/llvm-devel/bin/../lib/clang/3.7.0/include/xmmintrin.h" 3 4 # 32 "/usr/local/llvm-devel/bin/../lib/clang/3.7.0/include/xmmintrin.h" 3 4 typedef int __v4si __attribute__((__vector_size__(16))); typedef float __v4sf __attribute__((__vector_size__(16))); typedef float __m128 __attribute__((__vector_size__(16))); /* This header should only be included in a hosted environment as it depends on * a standard library to provide allocation routines. */ #if __STDC_HOSTED__ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 40 "/usr/local/llvm-devel/bin/../lib/clang/3.7.0/include/xmmintrin.h" 3 4 # 1 "/usr/local/llvm-devel/bin/../lib/clang/3.7.0/include/mm_malloc.h" 1 3 4 /*===---- mm_malloc.h - Allocating and Freeing Aligned Memory Blocks -------=== * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * *===-----------------------------------------------------------------------=== */ #ifndef __MM_MALLOC_H #define __MM_MALLOC_H #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 27 "/usr/local/llvm-devel/bin/../lib/clang/3.7.0/include/mm_malloc.h" 3 4 # 28 "/usr/local/llvm-devel/bin/../lib/clang/3.7.0/include/mm_malloc.h" 3 4 #ifdef _WIN32 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 30 "/usr/local/llvm-devel/bin/../lib/clang/3.7.0/include/mm_malloc.h" 3 4 # 31 "/usr/local/llvm-devel/bin/../lib/clang/3.7.0/include/mm_malloc.h" 3 4 #else # 32 "/usr/local/llvm-devel/bin/../lib/clang/3.7.0/include/mm_malloc.h" 3 4 #ifndef __cplusplus extern int posix_memalign(void **__memptr, size_t __alignment, size_t __size); #else # 35 "/usr/local/llvm-devel/bin/../lib/clang/3.7.0/include/mm_malloc.h" 3 4 // Some systems (e.g. those with GNU libc) declare posix_memalign with an // exception specifier. Via an "egregious workaround" in // Sema::CheckEquivalentExceptionSpec, Clang accepts the following as a valid // redeclaration of glibc's declaration. extern "C" int posix_memalign(void **__memptr, size_t __alignment, size_t __size); #endif # 41 "/usr/local/llvm-devel/bin/../lib/clang/3.7.0/include/mm_malloc.h" 3 4 #endif # 42 "/usr/local/llvm-devel/bin/../lib/clang/3.7.0/include/mm_malloc.h" 3 4 #if !(defined(_WIN32) && defined(_mm_malloc)) static __inline__ void *__attribute__((__always_inline__, __nodebug__, __malloc__)) _mm_malloc(size_t __size, size_t __align) { if (__align == 1) { return malloc(__size); } if (!(__align & (__align - 1)) && __align < sizeof(void *)) __align = sizeof(void *); void *__mallocedMemory; #if defined(__MINGW32__) __mallocedMemory = __mingw_aligned_malloc(__size, __align); #elif defined(_WIN32) # 59 "/usr/local/llvm-devel/bin/../lib/clang/3.7.0/include/mm_malloc.h" 3 4 __mallocedMemory = _aligned_malloc(__size, __align); #else # 61 "/usr/local/llvm-devel/bin/../lib/clang/3.7.0/include/mm_malloc.h" 3 4 if (posix_memalign(&__mallocedMemory, __align, __size)) return 0; #endif # 64 "/usr/local/llvm-devel/bin/../lib/clang/3.7.0/include/mm_malloc.h" 3 4 return __mallocedMemory; } static __inline__ void __attribute__((__always_inline__, __nodebug__)) _mm_free(void *__p) { free(__p); } #endif # 74 "/usr/local/llvm-devel/bin/../lib/clang/3.7.0/include/mm_malloc.h" 3 4 #endif /* __MM_MALLOC_H */ # 76 "/usr/local/llvm-devel/bin/../lib/clang/3.7.0/include/mm_malloc.h" 3 4 # 41 "/usr/local/llvm-devel/bin/../lib/clang/3.7.0/include/xmmintrin.h" 2 3 4 #endif # 42 "/usr/local/llvm-devel/bin/../lib/clang/3.7.0/include/xmmintrin.h" 3 4 static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_add_ss(__m128 __a, __m128 __b) { __a[0] += __b[0]; return __a; } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_add_ps(__m128 __a, __m128 __b) { return __a + __b; } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_sub_ss(__m128 __a, __m128 __b) { __a[0] -= __b[0]; return __a; } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_sub_ps(__m128 __a, __m128 __b) { return __a - __b; } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_mul_ss(__m128 __a, __m128 __b) { __a[0] *= __b[0]; return __a; } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_mul_ps(__m128 __a, __m128 __b) { return __a * __b; } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_div_ss(__m128 __a, __m128 __b) { __a[0] /= __b[0]; return __a; } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_div_ps(__m128 __a, __m128 __b) { return __a / __b; } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_sqrt_ss(__m128 __a) { __m128 __c = __builtin_ia32_sqrtss(__a); return (__m128) { __c[0], __a[1], __a[2], __a[3] }; } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_sqrt_ps(__m128 __a) { return __builtin_ia32_sqrtps(__a); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_rcp_ss(__m128 __a) { __m128 __c = __builtin_ia32_rcpss(__a); return (__m128) { __c[0], __a[1], __a[2], __a[3] }; } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_rcp_ps(__m128 __a) { return __builtin_ia32_rcpps(__a); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_rsqrt_ss(__m128 __a) { __m128 __c = __builtin_ia32_rsqrtss(__a); return (__m128) { __c[0], __a[1], __a[2], __a[3] }; } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_rsqrt_ps(__m128 __a) { return __builtin_ia32_rsqrtps(__a); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_min_ss(__m128 __a, __m128 __b) { return __builtin_ia32_minss(__a, __b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_min_ps(__m128 __a, __m128 __b) { return __builtin_ia32_minps(__a, __b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_max_ss(__m128 __a, __m128 __b) { return __builtin_ia32_maxss(__a, __b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_max_ps(__m128 __a, __m128 __b) { return __builtin_ia32_maxps(__a, __b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_and_ps(__m128 __a, __m128 __b) { return (__m128)((__v4si)__a & (__v4si)__b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_andnot_ps(__m128 __a, __m128 __b) { return (__m128)(~(__v4si)__a & (__v4si)__b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_or_ps(__m128 __a, __m128 __b) { return (__m128)((__v4si)__a | (__v4si)__b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_xor_ps(__m128 __a, __m128 __b) { return (__m128)((__v4si)__a ^ (__v4si)__b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_cmpeq_ss(__m128 __a, __m128 __b) { return (__m128)__builtin_ia32_cmpeqss(__a, __b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_cmpeq_ps(__m128 __a, __m128 __b) { return (__m128)__builtin_ia32_cmpeqps(__a, __b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_cmplt_ss(__m128 __a, __m128 __b) { return (__m128)__builtin_ia32_cmpltss(__a, __b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_cmplt_ps(__m128 __a, __m128 __b) { return (__m128)__builtin_ia32_cmpltps(__a, __b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_cmple_ss(__m128 __a, __m128 __b) { return (__m128)__builtin_ia32_cmpless(__a, __b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_cmple_ps(__m128 __a, __m128 __b) { return (__m128)__builtin_ia32_cmpleps(__a, __b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_cmpgt_ss(__m128 __a, __m128 __b) { return (__m128)__builtin_shufflevector(__a, __builtin_ia32_cmpltss(__b, __a), 4, 1, 2, 3); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_cmpgt_ps(__m128 __a, __m128 __b) { return (__m128)__builtin_ia32_cmpltps(__b, __a); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_cmpge_ss(__m128 __a, __m128 __b) { return (__m128)__builtin_shufflevector(__a, __builtin_ia32_cmpless(__b, __a), 4, 1, 2, 3); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_cmpge_ps(__m128 __a, __m128 __b) { return (__m128)__builtin_ia32_cmpleps(__b, __a); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_cmpneq_ss(__m128 __a, __m128 __b) { return (__m128)__builtin_ia32_cmpneqss(__a, __b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_cmpneq_ps(__m128 __a, __m128 __b) { return (__m128)__builtin_ia32_cmpneqps(__a, __b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_cmpnlt_ss(__m128 __a, __m128 __b) { return (__m128)__builtin_ia32_cmpnltss(__a, __b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_cmpnlt_ps(__m128 __a, __m128 __b) { return (__m128)__builtin_ia32_cmpnltps(__a, __b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_cmpnle_ss(__m128 __a, __m128 __b) { return (__m128)__builtin_ia32_cmpnless(__a, __b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_cmpnle_ps(__m128 __a, __m128 __b) { return (__m128)__builtin_ia32_cmpnleps(__a, __b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_cmpngt_ss(__m128 __a, __m128 __b) { return (__m128)__builtin_shufflevector(__a, __builtin_ia32_cmpnltss(__b, __a), 4, 1, 2, 3); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_cmpngt_ps(__m128 __a, __m128 __b) { return (__m128)__builtin_ia32_cmpnltps(__b, __a); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_cmpnge_ss(__m128 __a, __m128 __b) { return (__m128)__builtin_shufflevector(__a, __builtin_ia32_cmpnless(__b, __a), 4, 1, 2, 3); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_cmpnge_ps(__m128 __a, __m128 __b) { return (__m128)__builtin_ia32_cmpnleps(__b, __a); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_cmpord_ss(__m128 __a, __m128 __b) { return (__m128)__builtin_ia32_cmpordss(__a, __b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_cmpord_ps(__m128 __a, __m128 __b) { return (__m128)__builtin_ia32_cmpordps(__a, __b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_cmpunord_ss(__m128 __a, __m128 __b) { return (__m128)__builtin_ia32_cmpunordss(__a, __b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_cmpunord_ps(__m128 __a, __m128 __b) { return (__m128)__builtin_ia32_cmpunordps(__a, __b); } static __inline__ int __attribute__((__always_inline__, __nodebug__)) _mm_comieq_ss(__m128 __a, __m128 __b) { return __builtin_ia32_comieq(__a, __b); } static __inline__ int __attribute__((__always_inline__, __nodebug__)) _mm_comilt_ss(__m128 __a, __m128 __b) { return __builtin_ia32_comilt(__a, __b); } static __inline__ int __attribute__((__always_inline__, __nodebug__)) _mm_comile_ss(__m128 __a, __m128 __b) { return __builtin_ia32_comile(__a, __b); } static __inline__ int __attribute__((__always_inline__, __nodebug__)) _mm_comigt_ss(__m128 __a, __m128 __b) { return __builtin_ia32_comigt(__a, __b); } static __inline__ int __attribute__((__always_inline__, __nodebug__)) _mm_comige_ss(__m128 __a, __m128 __b) { return __builtin_ia32_comige(__a, __b); } static __inline__ int __attribute__((__always_inline__, __nodebug__)) _mm_comineq_ss(__m128 __a, __m128 __b) { return __builtin_ia32_comineq(__a, __b); } static __inline__ int __attribute__((__always_inline__, __nodebug__)) _mm_ucomieq_ss(__m128 __a, __m128 __b) { return __builtin_ia32_ucomieq(__a, __b); } static __inline__ int __attribute__((__always_inline__, __nodebug__)) _mm_ucomilt_ss(__m128 __a, __m128 __b) { return __builtin_ia32_ucomilt(__a, __b); } static __inline__ int __attribute__((__always_inline__, __nodebug__)) _mm_ucomile_ss(__m128 __a, __m128 __b) { return __builtin_ia32_ucomile(__a, __b); } static __inline__ int __attribute__((__always_inline__, __nodebug__)) _mm_ucomigt_ss(__m128 __a, __m128 __b) { return __builtin_ia32_ucomigt(__a, __b); } static __inline__ int __attribute__((__always_inline__, __nodebug__)) _mm_ucomige_ss(__m128 __a, __m128 __b) { return __builtin_ia32_ucomige(__a, __b); } static __inline__ int __attribute__((__always_inline__, __nodebug__)) _mm_ucomineq_ss(__m128 __a, __m128 __b) { return __builtin_ia32_ucomineq(__a, __b); } static __inline__ int __attribute__((__always_inline__, __nodebug__)) _mm_cvtss_si32(__m128 __a) { return __builtin_ia32_cvtss2si(__a); } static __inline__ int __attribute__((__always_inline__, __nodebug__)) _mm_cvt_ss2si(__m128 __a) { return _mm_cvtss_si32(__a); } #ifdef __x86_64__ static __inline__ long long __attribute__((__always_inline__, __nodebug__)) _mm_cvtss_si64(__m128 __a) { return __builtin_ia32_cvtss2si64(__a); } #endif # 427 "/usr/local/llvm-devel/bin/../lib/clang/3.7.0/include/xmmintrin.h" 3 4 static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_cvtps_pi32(__m128 __a) { return (__m64)__builtin_ia32_cvtps2pi(__a); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_cvt_ps2pi(__m128 __a) { return _mm_cvtps_pi32(__a); } static __inline__ int __attribute__((__always_inline__, __nodebug__)) _mm_cvttss_si32(__m128 __a) { return __a[0]; } static __inline__ int __attribute__((__always_inline__, __nodebug__)) _mm_cvtt_ss2si(__m128 __a) { return _mm_cvttss_si32(__a); } static __inline__ long long __attribute__((__always_inline__, __nodebug__)) _mm_cvttss_si64(__m128 __a) { return __a[0]; } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_cvttps_pi32(__m128 __a) { return (__m64)__builtin_ia32_cvttps2pi(__a); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_cvtt_ps2pi(__m128 __a) { return _mm_cvttps_pi32(__a); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_cvtsi32_ss(__m128 __a, int __b) { __a[0] = __b; return __a; } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_cvt_si2ss(__m128 __a, int __b) { return _mm_cvtsi32_ss(__a, __b); } #ifdef __x86_64__ static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_cvtsi64_ss(__m128 __a, long long __b) { __a[0] = __b; return __a; } #endif # 493 "/usr/local/llvm-devel/bin/../lib/clang/3.7.0/include/xmmintrin.h" 3 4 static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_cvtpi32_ps(__m128 __a, __m64 __b) { return __builtin_ia32_cvtpi2ps(__a, (__v2si)__b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_cvt_pi2ps(__m128 __a, __m64 __b) { return _mm_cvtpi32_ps(__a, __b); } static __inline__ float __attribute__((__always_inline__, __nodebug__)) _mm_cvtss_f32(__m128 __a) { return __a[0]; } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_loadh_pi(__m128 __a, const __m64 *__p) { typedef float __mm_loadh_pi_v2f32 __attribute__((__vector_size__(8))); struct __mm_loadh_pi_struct { __mm_loadh_pi_v2f32 __u; } __attribute__((__packed__, __may_alias__)); __mm_loadh_pi_v2f32 __b = ((struct __mm_loadh_pi_struct*)__p)->__u; __m128 __bb = __builtin_shufflevector(__b, __b, 0, 1, 0, 1); return __builtin_shufflevector(__a, __bb, 0, 1, 4, 5); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_loadl_pi(__m128 __a, const __m64 *__p) { typedef float __mm_loadl_pi_v2f32 __attribute__((__vector_size__(8))); struct __mm_loadl_pi_struct { __mm_loadl_pi_v2f32 __u; } __attribute__((__packed__, __may_alias__)); __mm_loadl_pi_v2f32 __b = ((struct __mm_loadl_pi_struct*)__p)->__u; __m128 __bb = __builtin_shufflevector(__b, __b, 0, 1, 0, 1); return __builtin_shufflevector(__a, __bb, 4, 5, 2, 3); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_load_ss(const float *__p) { struct __mm_load_ss_struct { float __u; } __attribute__((__packed__, __may_alias__)); float __u = ((struct __mm_load_ss_struct*)__p)->__u; return (__m128){ __u, 0, 0, 0 }; } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_load1_ps(const float *__p) { struct __mm_load1_ps_struct { float __u; } __attribute__((__packed__, __may_alias__)); float __u = ((struct __mm_load1_ps_struct*)__p)->__u; return (__m128){ __u, __u, __u, __u }; } #define _mm_load_ps1(p) _mm_load1_ps(p) static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_load_ps(const float *__p) { return *(__m128*)__p; } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_loadu_ps(const float *__p) { struct __loadu_ps { __m128 __v; } __attribute__((__packed__, __may_alias__)); return ((struct __loadu_ps*)__p)->__v; } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_loadr_ps(const float *__p) { __m128 __a = _mm_load_ps(__p); return __builtin_shufflevector(__a, __a, 3, 2, 1, 0); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_set_ss(float __w) { return (__m128){ __w, 0, 0, 0 }; } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_set1_ps(float __w) { return (__m128){ __w, __w, __w, __w }; } /* Microsoft specific. */ static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_set_ps1(float __w) { return _mm_set1_ps(__w); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_set_ps(float __z, float __y, float __x, float __w) { return (__m128){ __w, __x, __y, __z }; } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_setr_ps(float __z, float __y, float __x, float __w) { return (__m128){ __z, __y, __x, __w }; } static __inline__ __m128 __attribute__((__always_inline__)) _mm_setzero_ps(void) { return (__m128){ 0, 0, 0, 0 }; } static __inline__ void __attribute__((__always_inline__)) _mm_storeh_pi(__m64 *__p, __m128 __a) { __builtin_ia32_storehps((__v2si *)__p, __a); } static __inline__ void __attribute__((__always_inline__)) _mm_storel_pi(__m64 *__p, __m128 __a) { __builtin_ia32_storelps((__v2si *)__p, __a); } static __inline__ void __attribute__((__always_inline__)) _mm_store_ss(float *__p, __m128 __a) { struct __mm_store_ss_struct { float __u; } __attribute__((__packed__, __may_alias__)); ((struct __mm_store_ss_struct*)__p)->__u = __a[0]; } static __inline__ void __attribute__((__always_inline__, __nodebug__)) _mm_storeu_ps(float *__p, __m128 __a) { __builtin_ia32_storeups(__p, __a); } static __inline__ void __attribute__((__always_inline__, __nodebug__)) _mm_store1_ps(float *__p, __m128 __a) { __a = __builtin_shufflevector(__a, __a, 0, 0, 0, 0); _mm_storeu_ps(__p, __a); } static __inline__ void __attribute__((__always_inline__, __nodebug__)) _mm_store_ps1(float *__p, __m128 __a) { return _mm_store1_ps(__p, __a); } static __inline__ void __attribute__((__always_inline__, __nodebug__)) _mm_store_ps(float *__p, __m128 __a) { *(__m128 *)__p = __a; } static __inline__ void __attribute__((__always_inline__, __nodebug__)) _mm_storer_ps(float *__p, __m128 __a) { __a = __builtin_shufflevector(__a, __a, 3, 2, 1, 0); _mm_store_ps(__p, __a); } #define _MM_HINT_T0 3 #define _MM_HINT_T1 2 #define _MM_HINT_T2 1 #define _MM_HINT_NTA 0 #ifndef _MSC_VER /* FIXME: We have to #define this because "sel" must be a constant integer, and Sema doesn't do any form of constant propagation yet. */ #define _mm_prefetch(a, sel) (__builtin_prefetch((void *)(a), 0, (sel))) #endif # 681 "/usr/local/llvm-devel/bin/../lib/clang/3.7.0/include/xmmintrin.h" 3 4 static __inline__ void __attribute__((__always_inline__, __nodebug__)) _mm_stream_pi(__m64 *__p, __m64 __a) { __builtin_ia32_movntq(__p, __a); } static __inline__ void __attribute__((__always_inline__, __nodebug__)) _mm_stream_ps(float *__p, __m128 __a) { __builtin_ia32_movntps(__p, __a); } static __inline__ void __attribute__((__always_inline__, __nodebug__)) _mm_sfence(void) { __builtin_ia32_sfence(); } static __inline__ int __attribute__((__always_inline__, __nodebug__)) _mm_extract_pi16(__m64 __a, int __n) { __v4hi __b = (__v4hi)__a; return (unsigned short)__b[__n & 3]; } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_insert_pi16(__m64 __a, int __d, int __n) { __v4hi __b = (__v4hi)__a; __b[__n & 3] = __d; return (__m64)__b; } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_max_pi16(__m64 __a, __m64 __b) { return (__m64)__builtin_ia32_pmaxsw((__v4hi)__a, (__v4hi)__b); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_max_pu8(__m64 __a, __m64 __b) { return (__m64)__builtin_ia32_pmaxub((__v8qi)__a, (__v8qi)__b); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_min_pi16(__m64 __a, __m64 __b) { return (__m64)__builtin_ia32_pminsw((__v4hi)__a, (__v4hi)__b); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_min_pu8(__m64 __a, __m64 __b) { return (__m64)__builtin_ia32_pminub((__v8qi)__a, (__v8qi)__b); } static __inline__ int __attribute__((__always_inline__, __nodebug__)) _mm_movemask_pi8(__m64 __a) { return __builtin_ia32_pmovmskb((__v8qi)__a); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_mulhi_pu16(__m64 __a, __m64 __b) { return (__m64)__builtin_ia32_pmulhuw((__v4hi)__a, (__v4hi)__b); } #define _mm_shuffle_pi16(a, n) __extension__ ({ \ __m64 __a = (a); \ (__m64)__builtin_ia32_pshufw((__v4hi)__a, (n)); }) static __inline__ void __attribute__((__always_inline__, __nodebug__)) _mm_maskmove_si64(__m64 __d, __m64 __n, char *__p) { __builtin_ia32_maskmovq((__v8qi)__d, (__v8qi)__n, __p); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_avg_pu8(__m64 __a, __m64 __b) { return (__m64)__builtin_ia32_pavgb((__v8qi)__a, (__v8qi)__b); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_avg_pu16(__m64 __a, __m64 __b) { return (__m64)__builtin_ia32_pavgw((__v4hi)__a, (__v4hi)__b); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_sad_pu8(__m64 __a, __m64 __b) { return (__m64)__builtin_ia32_psadbw((__v8qi)__a, (__v8qi)__b); } static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__)) _mm_getcsr(void) { return __builtin_ia32_stmxcsr(); } static __inline__ void __attribute__((__always_inline__, __nodebug__)) _mm_setcsr(unsigned int __i) { __builtin_ia32_ldmxcsr(__i); } #define _mm_shuffle_ps(a, b, mask) __extension__ ({ \ __m128 __a = (a); \ __m128 __b = (b); \ (__m128)__builtin_shufflevector((__v4sf)__a, (__v4sf)__b, \ (mask) & 0x3, ((mask) & 0xc) >> 2, \ (((mask) & 0x30) >> 4) + 4, \ (((mask) & 0xc0) >> 6) + 4); }) static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_unpackhi_ps(__m128 __a, __m128 __b) { return __builtin_shufflevector(__a, __b, 2, 6, 3, 7); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_unpacklo_ps(__m128 __a, __m128 __b) { return __builtin_shufflevector(__a, __b, 0, 4, 1, 5); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_move_ss(__m128 __a, __m128 __b) { return __builtin_shufflevector(__a, __b, 4, 1, 2, 3); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_movehl_ps(__m128 __a, __m128 __b) { return __builtin_shufflevector(__a, __b, 6, 7, 2, 3); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_movelh_ps(__m128 __a, __m128 __b) { return __builtin_shufflevector(__a, __b, 0, 1, 4, 5); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_cvtpi16_ps(__m64 __a) { __m64 __b, __c; __m128 __r; __b = _mm_setzero_si64(); __b = _mm_cmpgt_pi16(__b, __a); __c = _mm_unpackhi_pi16(__a, __b); __r = _mm_setzero_ps(); __r = _mm_cvtpi32_ps(__r, __c); __r = _mm_movelh_ps(__r, __r); __c = _mm_unpacklo_pi16(__a, __b); __r = _mm_cvtpi32_ps(__r, __c); return __r; } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_cvtpu16_ps(__m64 __a) { __m64 __b, __c; __m128 __r; __b = _mm_setzero_si64(); __c = _mm_unpackhi_pi16(__a, __b); __r = _mm_setzero_ps(); __r = _mm_cvtpi32_ps(__r, __c); __r = _mm_movelh_ps(__r, __r); __c = _mm_unpacklo_pi16(__a, __b); __r = _mm_cvtpi32_ps(__r, __c); return __r; } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_cvtpi8_ps(__m64 __a) { __m64 __b; __b = _mm_setzero_si64(); __b = _mm_cmpgt_pi8(__b, __a); __b = _mm_unpacklo_pi8(__a, __b); return _mm_cvtpi16_ps(__b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_cvtpu8_ps(__m64 __a) { __m64 __b; __b = _mm_setzero_si64(); __b = _mm_unpacklo_pi8(__a, __b); return _mm_cvtpi16_ps(__b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_cvtpi32x2_ps(__m64 __a, __m64 __b) { __m128 __c; __c = _mm_setzero_ps(); __c = _mm_cvtpi32_ps(__c, __b); __c = _mm_movelh_ps(__c, __c); return _mm_cvtpi32_ps(__c, __a); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_cvtps_pi16(__m128 __a) { __m64 __b, __c; __b = _mm_cvtps_pi32(__a); __a = _mm_movehl_ps(__a, __a); __c = _mm_cvtps_pi32(__a); return _mm_packs_pi32(__b, __c); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_cvtps_pi8(__m128 __a) { __m64 __b, __c; __b = _mm_cvtps_pi16(__a); __c = _mm_setzero_si64(); return _mm_packs_pi16(__b, __c); } static __inline__ int __attribute__((__always_inline__, __nodebug__)) _mm_movemask_ps(__m128 __a) { return __builtin_ia32_movmskps(__a); } #define _MM_SHUFFLE(z, y, x, w) (((z) << 6) | ((y) << 4) | ((x) << 2) | (w)) #define _MM_EXCEPT_INVALID (0x0001) #define _MM_EXCEPT_DENORM (0x0002) #define _MM_EXCEPT_DIV_ZERO (0x0004) #define _MM_EXCEPT_OVERFLOW (0x0008) #define _MM_EXCEPT_UNDERFLOW (0x0010) #define _MM_EXCEPT_INEXACT (0x0020) #define _MM_EXCEPT_MASK (0x003f) #define _MM_MASK_INVALID (0x0080) #define _MM_MASK_DENORM (0x0100) #define _MM_MASK_DIV_ZERO (0x0200) #define _MM_MASK_OVERFLOW (0x0400) #define _MM_MASK_UNDERFLOW (0x0800) #define _MM_MASK_INEXACT (0x1000) #define _MM_MASK_MASK (0x1f80) #define _MM_ROUND_NEAREST (0x0000) #define _MM_ROUND_DOWN (0x2000) #define _MM_ROUND_UP (0x4000) #define _MM_ROUND_TOWARD_ZERO (0x6000) #define _MM_ROUND_MASK (0x6000) #define _MM_FLUSH_ZERO_MASK (0x8000) #define _MM_FLUSH_ZERO_ON (0x8000) #define _MM_FLUSH_ZERO_OFF (0x0000) #define _MM_GET_EXCEPTION_MASK() (_mm_getcsr() & _MM_MASK_MASK) #define _MM_GET_EXCEPTION_STATE() (_mm_getcsr() & _MM_EXCEPT_MASK) #define _MM_GET_FLUSH_ZERO_MODE() (_mm_getcsr() & _MM_FLUSH_ZERO_MASK) #define _MM_GET_ROUNDING_MODE() (_mm_getcsr() & _MM_ROUND_MASK) #define _MM_SET_EXCEPTION_MASK(x) (_mm_setcsr((_mm_getcsr() & ~_MM_MASK_MASK) | (x))) #define _MM_SET_EXCEPTION_STATE(x) (_mm_setcsr((_mm_getcsr() & ~_MM_EXCEPT_MASK) | (x))) #define _MM_SET_FLUSH_ZERO_MODE(x) (_mm_setcsr((_mm_getcsr() & ~_MM_FLUSH_ZERO_MASK) | (x))) #define _MM_SET_ROUNDING_MODE(x) (_mm_setcsr((_mm_getcsr() & ~_MM_ROUND_MASK) | (x))) #define _MM_TRANSPOSE4_PS(row0, row1, row2, row3) \ do { \ __m128 tmp3, tmp2, tmp1, tmp0; \ tmp0 = _mm_unpacklo_ps((row0), (row1)); \ tmp2 = _mm_unpacklo_ps((row2), (row3)); \ tmp1 = _mm_unpackhi_ps((row0), (row1)); \ tmp3 = _mm_unpackhi_ps((row2), (row3)); \ (row0) = _mm_movelh_ps(tmp0, tmp2); \ (row1) = _mm_movehl_ps(tmp2, tmp0); \ (row2) = _mm_movelh_ps(tmp1, tmp3); \ (row3) = _mm_movehl_ps(tmp3, tmp1); \ } while (0) /* Aliases for compatibility. */ #define _m_pextrw _mm_extract_pi16 #define _m_pinsrw _mm_insert_pi16 #define _m_pmaxsw _mm_max_pi16 #define _m_pmaxub _mm_max_pu8 #define _m_pminsw _mm_min_pi16 #define _m_pminub _mm_min_pu8 #define _m_pmovmskb _mm_movemask_pi8 #define _m_pmulhuw _mm_mulhi_pu16 #define _m_pshufw _mm_shuffle_pi16 #define _m_maskmovq _mm_maskmove_si64 #define _m_pavgb _mm_avg_pu8 #define _m_pavgw _mm_avg_pu16 #define _m_psadbw _mm_sad_pu8 #define _m_ _mm_ #define _m_ _mm_ /* Ugly hack for backwards-compatibility (compatible with gcc) */ #ifdef __SSE2__ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 998 "/usr/local/llvm-devel/bin/../lib/clang/3.7.0/include/xmmintrin.h" 3 4 # 1 "/usr/local/llvm-devel/bin/../lib/clang/3.7.0/include/emmintrin.h" 1 3 4 /*===---- emmintrin.h - SSE2 intrinsics ------------------------------------=== * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * *===-----------------------------------------------------------------------=== */ #ifndef __EMMINTRIN_H #define __EMMINTRIN_H #ifndef __SSE2__ #error "SSE2 instruction set not enabled" #else # 30 "/usr/local/llvm-devel/bin/../lib/clang/3.7.0/include/emmintrin.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 31 "/usr/local/llvm-devel/bin/../lib/clang/3.7.0/include/emmintrin.h" 3 4 # 1 "/usr/local/llvm-devel/bin/../lib/clang/3.7.0/include/xmmintrin.h" 1 3 4 /*===---- xmmintrin.h - SSE intrinsics -------------------------------------=== * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * *===-----------------------------------------------------------------------=== */ #ifndef __XMMINTRIN_H #define __XMMINTRIN_H #ifndef __SSE__ #error "SSE instruction set not enabled" #else # 30 "/usr/local/llvm-devel/bin/../lib/clang/3.7.0/include/xmmintrin.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 31 "/usr/local/llvm-devel/bin/../lib/clang/3.7.0/include/xmmintrin.h" 3 4 # 32 "/usr/local/llvm-devel/bin/../lib/clang/3.7.0/include/xmmintrin.h" 3 4 typedef int __v4si __attribute__((__vector_size__(16))); typedef float __v4sf __attribute__((__vector_size__(16))); typedef float __m128 __attribute__((__vector_size__(16))); /* This header should only be included in a hosted environment as it depends on * a standard library to provide allocation routines. */ #if __STDC_HOSTED__ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 40 "/usr/local/llvm-devel/bin/../lib/clang/3.7.0/include/xmmintrin.h" 3 4 # 41 "/usr/local/llvm-devel/bin/../lib/clang/3.7.0/include/xmmintrin.h" 3 4 #endif # 42 "/usr/local/llvm-devel/bin/../lib/clang/3.7.0/include/xmmintrin.h" 3 4 static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_add_ss(__m128 __a, __m128 __b) { __a[0] += __b[0]; return __a; } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_add_ps(__m128 __a, __m128 __b) { return __a + __b; } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_sub_ss(__m128 __a, __m128 __b) { __a[0] -= __b[0]; return __a; } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_sub_ps(__m128 __a, __m128 __b) { return __a - __b; } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_mul_ss(__m128 __a, __m128 __b) { __a[0] *= __b[0]; return __a; } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_mul_ps(__m128 __a, __m128 __b) { return __a * __b; } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_div_ss(__m128 __a, __m128 __b) { __a[0] /= __b[0]; return __a; } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_div_ps(__m128 __a, __m128 __b) { return __a / __b; } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_sqrt_ss(__m128 __a) { __m128 __c = __builtin_ia32_sqrtss(__a); return (__m128) { __c[0], __a[1], __a[2], __a[3] }; } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_sqrt_ps(__m128 __a) { return __builtin_ia32_sqrtps(__a); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_rcp_ss(__m128 __a) { __m128 __c = __builtin_ia32_rcpss(__a); return (__m128) { __c[0], __a[1], __a[2], __a[3] }; } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_rcp_ps(__m128 __a) { return __builtin_ia32_rcpps(__a); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_rsqrt_ss(__m128 __a) { __m128 __c = __builtin_ia32_rsqrtss(__a); return (__m128) { __c[0], __a[1], __a[2], __a[3] }; } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_rsqrt_ps(__m128 __a) { return __builtin_ia32_rsqrtps(__a); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_min_ss(__m128 __a, __m128 __b) { return __builtin_ia32_minss(__a, __b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_min_ps(__m128 __a, __m128 __b) { return __builtin_ia32_minps(__a, __b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_max_ss(__m128 __a, __m128 __b) { return __builtin_ia32_maxss(__a, __b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_max_ps(__m128 __a, __m128 __b) { return __builtin_ia32_maxps(__a, __b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_and_ps(__m128 __a, __m128 __b) { return (__m128)((__v4si)__a & (__v4si)__b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_andnot_ps(__m128 __a, __m128 __b) { return (__m128)(~(__v4si)__a & (__v4si)__b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_or_ps(__m128 __a, __m128 __b) { return (__m128)((__v4si)__a | (__v4si)__b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_xor_ps(__m128 __a, __m128 __b) { return (__m128)((__v4si)__a ^ (__v4si)__b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_cmpeq_ss(__m128 __a, __m128 __b) { return (__m128)__builtin_ia32_cmpeqss(__a, __b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_cmpeq_ps(__m128 __a, __m128 __b) { return (__m128)__builtin_ia32_cmpeqps(__a, __b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_cmplt_ss(__m128 __a, __m128 __b) { return (__m128)__builtin_ia32_cmpltss(__a, __b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_cmplt_ps(__m128 __a, __m128 __b) { return (__m128)__builtin_ia32_cmpltps(__a, __b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_cmple_ss(__m128 __a, __m128 __b) { return (__m128)__builtin_ia32_cmpless(__a, __b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_cmple_ps(__m128 __a, __m128 __b) { return (__m128)__builtin_ia32_cmpleps(__a, __b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_cmpgt_ss(__m128 __a, __m128 __b) { return (__m128)__builtin_shufflevector(__a, __builtin_ia32_cmpltss(__b, __a), 4, 1, 2, 3); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_cmpgt_ps(__m128 __a, __m128 __b) { return (__m128)__builtin_ia32_cmpltps(__b, __a); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_cmpge_ss(__m128 __a, __m128 __b) { return (__m128)__builtin_shufflevector(__a, __builtin_ia32_cmpless(__b, __a), 4, 1, 2, 3); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_cmpge_ps(__m128 __a, __m128 __b) { return (__m128)__builtin_ia32_cmpleps(__b, __a); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_cmpneq_ss(__m128 __a, __m128 __b) { return (__m128)__builtin_ia32_cmpneqss(__a, __b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_cmpneq_ps(__m128 __a, __m128 __b) { return (__m128)__builtin_ia32_cmpneqps(__a, __b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_cmpnlt_ss(__m128 __a, __m128 __b) { return (__m128)__builtin_ia32_cmpnltss(__a, __b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_cmpnlt_ps(__m128 __a, __m128 __b) { return (__m128)__builtin_ia32_cmpnltps(__a, __b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_cmpnle_ss(__m128 __a, __m128 __b) { return (__m128)__builtin_ia32_cmpnless(__a, __b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_cmpnle_ps(__m128 __a, __m128 __b) { return (__m128)__builtin_ia32_cmpnleps(__a, __b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_cmpngt_ss(__m128 __a, __m128 __b) { return (__m128)__builtin_shufflevector(__a, __builtin_ia32_cmpnltss(__b, __a), 4, 1, 2, 3); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_cmpngt_ps(__m128 __a, __m128 __b) { return (__m128)__builtin_ia32_cmpnltps(__b, __a); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_cmpnge_ss(__m128 __a, __m128 __b) { return (__m128)__builtin_shufflevector(__a, __builtin_ia32_cmpnless(__b, __a), 4, 1, 2, 3); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_cmpnge_ps(__m128 __a, __m128 __b) { return (__m128)__builtin_ia32_cmpnleps(__b, __a); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_cmpord_ss(__m128 __a, __m128 __b) { return (__m128)__builtin_ia32_cmpordss(__a, __b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_cmpord_ps(__m128 __a, __m128 __b) { return (__m128)__builtin_ia32_cmpordps(__a, __b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_cmpunord_ss(__m128 __a, __m128 __b) { return (__m128)__builtin_ia32_cmpunordss(__a, __b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_cmpunord_ps(__m128 __a, __m128 __b) { return (__m128)__builtin_ia32_cmpunordps(__a, __b); } static __inline__ int __attribute__((__always_inline__, __nodebug__)) _mm_comieq_ss(__m128 __a, __m128 __b) { return __builtin_ia32_comieq(__a, __b); } static __inline__ int __attribute__((__always_inline__, __nodebug__)) _mm_comilt_ss(__m128 __a, __m128 __b) { return __builtin_ia32_comilt(__a, __b); } static __inline__ int __attribute__((__always_inline__, __nodebug__)) _mm_comile_ss(__m128 __a, __m128 __b) { return __builtin_ia32_comile(__a, __b); } static __inline__ int __attribute__((__always_inline__, __nodebug__)) _mm_comigt_ss(__m128 __a, __m128 __b) { return __builtin_ia32_comigt(__a, __b); } static __inline__ int __attribute__((__always_inline__, __nodebug__)) _mm_comige_ss(__m128 __a, __m128 __b) { return __builtin_ia32_comige(__a, __b); } static __inline__ int __attribute__((__always_inline__, __nodebug__)) _mm_comineq_ss(__m128 __a, __m128 __b) { return __builtin_ia32_comineq(__a, __b); } static __inline__ int __attribute__((__always_inline__, __nodebug__)) _mm_ucomieq_ss(__m128 __a, __m128 __b) { return __builtin_ia32_ucomieq(__a, __b); } static __inline__ int __attribute__((__always_inline__, __nodebug__)) _mm_ucomilt_ss(__m128 __a, __m128 __b) { return __builtin_ia32_ucomilt(__a, __b); } static __inline__ int __attribute__((__always_inline__, __nodebug__)) _mm_ucomile_ss(__m128 __a, __m128 __b) { return __builtin_ia32_ucomile(__a, __b); } static __inline__ int __attribute__((__always_inline__, __nodebug__)) _mm_ucomigt_ss(__m128 __a, __m128 __b) { return __builtin_ia32_ucomigt(__a, __b); } static __inline__ int __attribute__((__always_inline__, __nodebug__)) _mm_ucomige_ss(__m128 __a, __m128 __b) { return __builtin_ia32_ucomige(__a, __b); } static __inline__ int __attribute__((__always_inline__, __nodebug__)) _mm_ucomineq_ss(__m128 __a, __m128 __b) { return __builtin_ia32_ucomineq(__a, __b); } static __inline__ int __attribute__((__always_inline__, __nodebug__)) _mm_cvtss_si32(__m128 __a) { return __builtin_ia32_cvtss2si(__a); } static __inline__ int __attribute__((__always_inline__, __nodebug__)) _mm_cvt_ss2si(__m128 __a) { return _mm_cvtss_si32(__a); } #ifdef __x86_64__ static __inline__ long long __attribute__((__always_inline__, __nodebug__)) _mm_cvtss_si64(__m128 __a) { return __builtin_ia32_cvtss2si64(__a); } #endif # 427 "/usr/local/llvm-devel/bin/../lib/clang/3.7.0/include/xmmintrin.h" 3 4 static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_cvtps_pi32(__m128 __a) { return (__m64)__builtin_ia32_cvtps2pi(__a); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_cvt_ps2pi(__m128 __a) { return _mm_cvtps_pi32(__a); } static __inline__ int __attribute__((__always_inline__, __nodebug__)) _mm_cvttss_si32(__m128 __a) { return __a[0]; } static __inline__ int __attribute__((__always_inline__, __nodebug__)) _mm_cvtt_ss2si(__m128 __a) { return _mm_cvttss_si32(__a); } static __inline__ long long __attribute__((__always_inline__, __nodebug__)) _mm_cvttss_si64(__m128 __a) { return __a[0]; } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_cvttps_pi32(__m128 __a) { return (__m64)__builtin_ia32_cvttps2pi(__a); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_cvtt_ps2pi(__m128 __a) { return _mm_cvttps_pi32(__a); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_cvtsi32_ss(__m128 __a, int __b) { __a[0] = __b; return __a; } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_cvt_si2ss(__m128 __a, int __b) { return _mm_cvtsi32_ss(__a, __b); } #ifdef __x86_64__ static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_cvtsi64_ss(__m128 __a, long long __b) { __a[0] = __b; return __a; } #endif # 493 "/usr/local/llvm-devel/bin/../lib/clang/3.7.0/include/xmmintrin.h" 3 4 static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_cvtpi32_ps(__m128 __a, __m64 __b) { return __builtin_ia32_cvtpi2ps(__a, (__v2si)__b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_cvt_pi2ps(__m128 __a, __m64 __b) { return _mm_cvtpi32_ps(__a, __b); } static __inline__ float __attribute__((__always_inline__, __nodebug__)) _mm_cvtss_f32(__m128 __a) { return __a[0]; } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_loadh_pi(__m128 __a, const __m64 *__p) { typedef float __mm_loadh_pi_v2f32 __attribute__((__vector_size__(8))); struct __mm_loadh_pi_struct { __mm_loadh_pi_v2f32 __u; } __attribute__((__packed__, __may_alias__)); __mm_loadh_pi_v2f32 __b = ((struct __mm_loadh_pi_struct*)__p)->__u; __m128 __bb = __builtin_shufflevector(__b, __b, 0, 1, 0, 1); return __builtin_shufflevector(__a, __bb, 0, 1, 4, 5); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_loadl_pi(__m128 __a, const __m64 *__p) { typedef float __mm_loadl_pi_v2f32 __attribute__((__vector_size__(8))); struct __mm_loadl_pi_struct { __mm_loadl_pi_v2f32 __u; } __attribute__((__packed__, __may_alias__)); __mm_loadl_pi_v2f32 __b = ((struct __mm_loadl_pi_struct*)__p)->__u; __m128 __bb = __builtin_shufflevector(__b, __b, 0, 1, 0, 1); return __builtin_shufflevector(__a, __bb, 4, 5, 2, 3); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_load_ss(const float *__p) { struct __mm_load_ss_struct { float __u; } __attribute__((__packed__, __may_alias__)); float __u = ((struct __mm_load_ss_struct*)__p)->__u; return (__m128){ __u, 0, 0, 0 }; } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_load1_ps(const float *__p) { struct __mm_load1_ps_struct { float __u; } __attribute__((__packed__, __may_alias__)); float __u = ((struct __mm_load1_ps_struct*)__p)->__u; return (__m128){ __u, __u, __u, __u }; } #define _mm_load_ps1(p) _mm_load1_ps(p) static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_load_ps(const float *__p) { return *(__m128*)__p; } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_loadu_ps(const float *__p) { struct __loadu_ps { __m128 __v; } __attribute__((__packed__, __may_alias__)); return ((struct __loadu_ps*)__p)->__v; } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_loadr_ps(const float *__p) { __m128 __a = _mm_load_ps(__p); return __builtin_shufflevector(__a, __a, 3, 2, 1, 0); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_set_ss(float __w) { return (__m128){ __w, 0, 0, 0 }; } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_set1_ps(float __w) { return (__m128){ __w, __w, __w, __w }; } /* Microsoft specific. */ static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_set_ps1(float __w) { return _mm_set1_ps(__w); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_set_ps(float __z, float __y, float __x, float __w) { return (__m128){ __w, __x, __y, __z }; } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_setr_ps(float __z, float __y, float __x, float __w) { return (__m128){ __z, __y, __x, __w }; } static __inline__ __m128 __attribute__((__always_inline__)) _mm_setzero_ps(void) { return (__m128){ 0, 0, 0, 0 }; } static __inline__ void __attribute__((__always_inline__)) _mm_storeh_pi(__m64 *__p, __m128 __a) { __builtin_ia32_storehps((__v2si *)__p, __a); } static __inline__ void __attribute__((__always_inline__)) _mm_storel_pi(__m64 *__p, __m128 __a) { __builtin_ia32_storelps((__v2si *)__p, __a); } static __inline__ void __attribute__((__always_inline__)) _mm_store_ss(float *__p, __m128 __a) { struct __mm_store_ss_struct { float __u; } __attribute__((__packed__, __may_alias__)); ((struct __mm_store_ss_struct*)__p)->__u = __a[0]; } static __inline__ void __attribute__((__always_inline__, __nodebug__)) _mm_storeu_ps(float *__p, __m128 __a) { __builtin_ia32_storeups(__p, __a); } static __inline__ void __attribute__((__always_inline__, __nodebug__)) _mm_store1_ps(float *__p, __m128 __a) { __a = __builtin_shufflevector(__a, __a, 0, 0, 0, 0); _mm_storeu_ps(__p, __a); } static __inline__ void __attribute__((__always_inline__, __nodebug__)) _mm_store_ps1(float *__p, __m128 __a) { return _mm_store1_ps(__p, __a); } static __inline__ void __attribute__((__always_inline__, __nodebug__)) _mm_store_ps(float *__p, __m128 __a) { *(__m128 *)__p = __a; } static __inline__ void __attribute__((__always_inline__, __nodebug__)) _mm_storer_ps(float *__p, __m128 __a) { __a = __builtin_shufflevector(__a, __a, 3, 2, 1, 0); _mm_store_ps(__p, __a); } #define _MM_HINT_T0 3 #define _MM_HINT_T1 2 #define _MM_HINT_T2 1 #define _MM_HINT_NTA 0 #ifndef _MSC_VER /* FIXME: We have to #define this because "sel" must be a constant integer, and Sema doesn't do any form of constant propagation yet. */ #define _mm_prefetch(a, sel) (__builtin_prefetch((void *)(a), 0, (sel))) #endif # 681 "/usr/local/llvm-devel/bin/../lib/clang/3.7.0/include/xmmintrin.h" 3 4 static __inline__ void __attribute__((__always_inline__, __nodebug__)) _mm_stream_pi(__m64 *__p, __m64 __a) { __builtin_ia32_movntq(__p, __a); } static __inline__ void __attribute__((__always_inline__, __nodebug__)) _mm_stream_ps(float *__p, __m128 __a) { __builtin_ia32_movntps(__p, __a); } static __inline__ void __attribute__((__always_inline__, __nodebug__)) _mm_sfence(void) { __builtin_ia32_sfence(); } static __inline__ int __attribute__((__always_inline__, __nodebug__)) _mm_extract_pi16(__m64 __a, int __n) { __v4hi __b = (__v4hi)__a; return (unsigned short)__b[__n & 3]; } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_insert_pi16(__m64 __a, int __d, int __n) { __v4hi __b = (__v4hi)__a; __b[__n & 3] = __d; return (__m64)__b; } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_max_pi16(__m64 __a, __m64 __b) { return (__m64)__builtin_ia32_pmaxsw((__v4hi)__a, (__v4hi)__b); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_max_pu8(__m64 __a, __m64 __b) { return (__m64)__builtin_ia32_pmaxub((__v8qi)__a, (__v8qi)__b); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_min_pi16(__m64 __a, __m64 __b) { return (__m64)__builtin_ia32_pminsw((__v4hi)__a, (__v4hi)__b); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_min_pu8(__m64 __a, __m64 __b) { return (__m64)__builtin_ia32_pminub((__v8qi)__a, (__v8qi)__b); } static __inline__ int __attribute__((__always_inline__, __nodebug__)) _mm_movemask_pi8(__m64 __a) { return __builtin_ia32_pmovmskb((__v8qi)__a); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_mulhi_pu16(__m64 __a, __m64 __b) { return (__m64)__builtin_ia32_pmulhuw((__v4hi)__a, (__v4hi)__b); } #define _mm_shuffle_pi16(a, n) __extension__ ({ \ __m64 __a = (a); \ (__m64)__builtin_ia32_pshufw((__v4hi)__a, (n)); }) static __inline__ void __attribute__((__always_inline__, __nodebug__)) _mm_maskmove_si64(__m64 __d, __m64 __n, char *__p) { __builtin_ia32_maskmovq((__v8qi)__d, (__v8qi)__n, __p); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_avg_pu8(__m64 __a, __m64 __b) { return (__m64)__builtin_ia32_pavgb((__v8qi)__a, (__v8qi)__b); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_avg_pu16(__m64 __a, __m64 __b) { return (__m64)__builtin_ia32_pavgw((__v4hi)__a, (__v4hi)__b); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_sad_pu8(__m64 __a, __m64 __b) { return (__m64)__builtin_ia32_psadbw((__v8qi)__a, (__v8qi)__b); } static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__)) _mm_getcsr(void) { return __builtin_ia32_stmxcsr(); } static __inline__ void __attribute__((__always_inline__, __nodebug__)) _mm_setcsr(unsigned int __i) { __builtin_ia32_ldmxcsr(__i); } #define _mm_shuffle_ps(a, b, mask) __extension__ ({ \ __m128 __a = (a); \ __m128 __b = (b); \ (__m128)__builtin_shufflevector((__v4sf)__a, (__v4sf)__b, \ (mask) & 0x3, ((mask) & 0xc) >> 2, \ (((mask) & 0x30) >> 4) + 4, \ (((mask) & 0xc0) >> 6) + 4); }) static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_unpackhi_ps(__m128 __a, __m128 __b) { return __builtin_shufflevector(__a, __b, 2, 6, 3, 7); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_unpacklo_ps(__m128 __a, __m128 __b) { return __builtin_shufflevector(__a, __b, 0, 4, 1, 5); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_move_ss(__m128 __a, __m128 __b) { return __builtin_shufflevector(__a, __b, 4, 1, 2, 3); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_movehl_ps(__m128 __a, __m128 __b) { return __builtin_shufflevector(__a, __b, 6, 7, 2, 3); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_movelh_ps(__m128 __a, __m128 __b) { return __builtin_shufflevector(__a, __b, 0, 1, 4, 5); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_cvtpi16_ps(__m64 __a) { __m64 __b, __c; __m128 __r; __b = _mm_setzero_si64(); __b = _mm_cmpgt_pi16(__b, __a); __c = _mm_unpackhi_pi16(__a, __b); __r = _mm_setzero_ps(); __r = _mm_cvtpi32_ps(__r, __c); __r = _mm_movelh_ps(__r, __r); __c = _mm_unpacklo_pi16(__a, __b); __r = _mm_cvtpi32_ps(__r, __c); return __r; } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_cvtpu16_ps(__m64 __a) { __m64 __b, __c; __m128 __r; __b = _mm_setzero_si64(); __c = _mm_unpackhi_pi16(__a, __b); __r = _mm_setzero_ps(); __r = _mm_cvtpi32_ps(__r, __c); __r = _mm_movelh_ps(__r, __r); __c = _mm_unpacklo_pi16(__a, __b); __r = _mm_cvtpi32_ps(__r, __c); return __r; } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_cvtpi8_ps(__m64 __a) { __m64 __b; __b = _mm_setzero_si64(); __b = _mm_cmpgt_pi8(__b, __a); __b = _mm_unpacklo_pi8(__a, __b); return _mm_cvtpi16_ps(__b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_cvtpu8_ps(__m64 __a) { __m64 __b; __b = _mm_setzero_si64(); __b = _mm_unpacklo_pi8(__a, __b); return _mm_cvtpi16_ps(__b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_cvtpi32x2_ps(__m64 __a, __m64 __b) { __m128 __c; __c = _mm_setzero_ps(); __c = _mm_cvtpi32_ps(__c, __b); __c = _mm_movelh_ps(__c, __c); return _mm_cvtpi32_ps(__c, __a); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_cvtps_pi16(__m128 __a) { __m64 __b, __c; __b = _mm_cvtps_pi32(__a); __a = _mm_movehl_ps(__a, __a); __c = _mm_cvtps_pi32(__a); return _mm_packs_pi32(__b, __c); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_cvtps_pi8(__m128 __a) { __m64 __b, __c; __b = _mm_cvtps_pi16(__a); __c = _mm_setzero_si64(); return _mm_packs_pi16(__b, __c); } static __inline__ int __attribute__((__always_inline__, __nodebug__)) _mm_movemask_ps(__m128 __a) { return __builtin_ia32_movmskps(__a); } #define _MM_SHUFFLE(z, y, x, w) (((z) << 6) | ((y) << 4) | ((x) << 2) | (w)) #define _MM_EXCEPT_INVALID (0x0001) #define _MM_EXCEPT_DENORM (0x0002) #define _MM_EXCEPT_DIV_ZERO (0x0004) #define _MM_EXCEPT_OVERFLOW (0x0008) #define _MM_EXCEPT_UNDERFLOW (0x0010) #define _MM_EXCEPT_INEXACT (0x0020) #define _MM_EXCEPT_MASK (0x003f) #define _MM_MASK_INVALID (0x0080) #define _MM_MASK_DENORM (0x0100) #define _MM_MASK_DIV_ZERO (0x0200) #define _MM_MASK_OVERFLOW (0x0400) #define _MM_MASK_UNDERFLOW (0x0800) #define _MM_MASK_INEXACT (0x1000) #define _MM_MASK_MASK (0x1f80) #define _MM_ROUND_NEAREST (0x0000) #define _MM_ROUND_DOWN (0x2000) #define _MM_ROUND_UP (0x4000) #define _MM_ROUND_TOWARD_ZERO (0x6000) #define _MM_ROUND_MASK (0x6000) #define _MM_FLUSH_ZERO_MASK (0x8000) #define _MM_FLUSH_ZERO_ON (0x8000) #define _MM_FLUSH_ZERO_OFF (0x0000) #define _MM_GET_EXCEPTION_MASK() (_mm_getcsr() & _MM_MASK_MASK) #define _MM_GET_EXCEPTION_STATE() (_mm_getcsr() & _MM_EXCEPT_MASK) #define _MM_GET_FLUSH_ZERO_MODE() (_mm_getcsr() & _MM_FLUSH_ZERO_MASK) #define _MM_GET_ROUNDING_MODE() (_mm_getcsr() & _MM_ROUND_MASK) #define _MM_SET_EXCEPTION_MASK(x) (_mm_setcsr((_mm_getcsr() & ~_MM_MASK_MASK) | (x))) #define _MM_SET_EXCEPTION_STATE(x) (_mm_setcsr((_mm_getcsr() & ~_MM_EXCEPT_MASK) | (x))) #define _MM_SET_FLUSH_ZERO_MODE(x) (_mm_setcsr((_mm_getcsr() & ~_MM_FLUSH_ZERO_MASK) | (x))) #define _MM_SET_ROUNDING_MODE(x) (_mm_setcsr((_mm_getcsr() & ~_MM_ROUND_MASK) | (x))) #define _MM_TRANSPOSE4_PS(row0, row1, row2, row3) \ do { \ __m128 tmp3, tmp2, tmp1, tmp0; \ tmp0 = _mm_unpacklo_ps((row0), (row1)); \ tmp2 = _mm_unpacklo_ps((row2), (row3)); \ tmp1 = _mm_unpackhi_ps((row0), (row1)); \ tmp3 = _mm_unpackhi_ps((row2), (row3)); \ (row0) = _mm_movelh_ps(tmp0, tmp2); \ (row1) = _mm_movehl_ps(tmp2, tmp0); \ (row2) = _mm_movelh_ps(tmp1, tmp3); \ (row3) = _mm_movehl_ps(tmp3, tmp1); \ } while (0) /* Aliases for compatibility. */ #define _m_pextrw _mm_extract_pi16 #define _m_pinsrw _mm_insert_pi16 #define _m_pmaxsw _mm_max_pi16 #define _m_pmaxub _mm_max_pu8 #define _m_pminsw _mm_min_pi16 #define _m_pminub _mm_min_pu8 #define _m_pmovmskb _mm_movemask_pi8 #define _m_pmulhuw _mm_mulhi_pu16 #define _m_pshufw _mm_shuffle_pi16 #define _m_maskmovq _mm_maskmove_si64 #define _m_pavgb _mm_avg_pu8 #define _m_pavgw _mm_avg_pu16 #define _m_psadbw _mm_sad_pu8 #define _m_ _mm_ #define _m_ _mm_ /* Ugly hack for backwards-compatibility (compatible with gcc) */ #ifdef __SSE2__ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 998 "/usr/local/llvm-devel/bin/../lib/clang/3.7.0/include/xmmintrin.h" 3 4 # 999 "/usr/local/llvm-devel/bin/../lib/clang/3.7.0/include/xmmintrin.h" 3 4 #endif # 1000 "/usr/local/llvm-devel/bin/../lib/clang/3.7.0/include/xmmintrin.h" 3 4 #endif /* __SSE__ */ # 1002 "/usr/local/llvm-devel/bin/../lib/clang/3.7.0/include/xmmintrin.h" 3 4 #endif /* __XMMINTRIN_H */ # 1004 "/usr/local/llvm-devel/bin/../lib/clang/3.7.0/include/xmmintrin.h" 3 4 # 32 "/usr/local/llvm-devel/bin/../lib/clang/3.7.0/include/emmintrin.h" 2 3 4 typedef double __m128d __attribute__((__vector_size__(16))); typedef long long __m128i __attribute__((__vector_size__(16))); /* Type defines. */ typedef double __v2df __attribute__ ((__vector_size__ (16))); typedef long long __v2di __attribute__ ((__vector_size__ (16))); typedef short __v8hi __attribute__((__vector_size__(16))); typedef char __v16qi __attribute__((__vector_size__(16))); static __inline__ __m128d __attribute__((__always_inline__, __nodebug__)) _mm_add_sd(__m128d __a, __m128d __b) { __a[0] += __b[0]; return __a; } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__)) _mm_add_pd(__m128d __a, __m128d __b) { return __a + __b; } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__)) _mm_sub_sd(__m128d __a, __m128d __b) { __a[0] -= __b[0]; return __a; } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__)) _mm_sub_pd(__m128d __a, __m128d __b) { return __a - __b; } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__)) _mm_mul_sd(__m128d __a, __m128d __b) { __a[0] *= __b[0]; return __a; } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__)) _mm_mul_pd(__m128d __a, __m128d __b) { return __a * __b; } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__)) _mm_div_sd(__m128d __a, __m128d __b) { __a[0] /= __b[0]; return __a; } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__)) _mm_div_pd(__m128d __a, __m128d __b) { return __a / __b; } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__)) _mm_sqrt_sd(__m128d __a, __m128d __b) { __m128d __c = __builtin_ia32_sqrtsd(__b); return (__m128d) { __c[0], __a[1] }; } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__)) _mm_sqrt_pd(__m128d __a) { return __builtin_ia32_sqrtpd(__a); } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__)) _mm_min_sd(__m128d __a, __m128d __b) { return __builtin_ia32_minsd(__a, __b); } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__)) _mm_min_pd(__m128d __a, __m128d __b) { return __builtin_ia32_minpd(__a, __b); } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__)) _mm_max_sd(__m128d __a, __m128d __b) { return __builtin_ia32_maxsd(__a, __b); } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__)) _mm_max_pd(__m128d __a, __m128d __b) { return __builtin_ia32_maxpd(__a, __b); } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__)) _mm_and_pd(__m128d __a, __m128d __b) { return (__m128d)((__v4si)__a & (__v4si)__b); } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__)) _mm_andnot_pd(__m128d __a, __m128d __b) { return (__m128d)(~(__v4si)__a & (__v4si)__b); } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__)) _mm_or_pd(__m128d __a, __m128d __b) { return (__m128d)((__v4si)__a | (__v4si)__b); } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__)) _mm_xor_pd(__m128d __a, __m128d __b) { return (__m128d)((__v4si)__a ^ (__v4si)__b); } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__)) _mm_cmpeq_pd(__m128d __a, __m128d __b) { return (__m128d)__builtin_ia32_cmpeqpd(__a, __b); } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__)) _mm_cmplt_pd(__m128d __a, __m128d __b) { return (__m128d)__builtin_ia32_cmpltpd(__a, __b); } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__)) _mm_cmple_pd(__m128d __a, __m128d __b) { return (__m128d)__builtin_ia32_cmplepd(__a, __b); } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__)) _mm_cmpgt_pd(__m128d __a, __m128d __b) { return (__m128d)__builtin_ia32_cmpltpd(__b, __a); } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__)) _mm_cmpge_pd(__m128d __a, __m128d __b) { return (__m128d)__builtin_ia32_cmplepd(__b, __a); } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__)) _mm_cmpord_pd(__m128d __a, __m128d __b) { return (__m128d)__builtin_ia32_cmpordpd(__a, __b); } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__)) _mm_cmpunord_pd(__m128d __a, __m128d __b) { return (__m128d)__builtin_ia32_cmpunordpd(__a, __b); } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__)) _mm_cmpneq_pd(__m128d __a, __m128d __b) { return (__m128d)__builtin_ia32_cmpneqpd(__a, __b); } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__)) _mm_cmpnlt_pd(__m128d __a, __m128d __b) { return (__m128d)__builtin_ia32_cmpnltpd(__a, __b); } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__)) _mm_cmpnle_pd(__m128d __a, __m128d __b) { return (__m128d)__builtin_ia32_cmpnlepd(__a, __b); } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__)) _mm_cmpngt_pd(__m128d __a, __m128d __b) { return (__m128d)__builtin_ia32_cmpnltpd(__b, __a); } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__)) _mm_cmpnge_pd(__m128d __a, __m128d __b) { return (__m128d)__builtin_ia32_cmpnlepd(__b, __a); } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__)) _mm_cmpeq_sd(__m128d __a, __m128d __b) { return (__m128d)__builtin_ia32_cmpeqsd(__a, __b); } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__)) _mm_cmplt_sd(__m128d __a, __m128d __b) { return (__m128d)__builtin_ia32_cmpltsd(__a, __b); } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__)) _mm_cmple_sd(__m128d __a, __m128d __b) { return (__m128d)__builtin_ia32_cmplesd(__a, __b); } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__)) _mm_cmpgt_sd(__m128d __a, __m128d __b) { __m128d __c = __builtin_ia32_cmpltsd(__b, __a); return (__m128d) { __c[0], __a[1] }; } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__)) _mm_cmpge_sd(__m128d __a, __m128d __b) { __m128d __c = __builtin_ia32_cmplesd(__b, __a); return (__m128d) { __c[0], __a[1] }; } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__)) _mm_cmpord_sd(__m128d __a, __m128d __b) { return (__m128d)__builtin_ia32_cmpordsd(__a, __b); } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__)) _mm_cmpunord_sd(__m128d __a, __m128d __b) { return (__m128d)__builtin_ia32_cmpunordsd(__a, __b); } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__)) _mm_cmpneq_sd(__m128d __a, __m128d __b) { return (__m128d)__builtin_ia32_cmpneqsd(__a, __b); } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__)) _mm_cmpnlt_sd(__m128d __a, __m128d __b) { return (__m128d)__builtin_ia32_cmpnltsd(__a, __b); } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__)) _mm_cmpnle_sd(__m128d __a, __m128d __b) { return (__m128d)__builtin_ia32_cmpnlesd(__a, __b); } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__)) _mm_cmpngt_sd(__m128d __a, __m128d __b) { __m128d __c = __builtin_ia32_cmpnltsd(__b, __a); return (__m128d) { __c[0], __a[1] }; } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__)) _mm_cmpnge_sd(__m128d __a, __m128d __b) { __m128d __c = __builtin_ia32_cmpnlesd(__b, __a); return (__m128d) { __c[0], __a[1] }; } static __inline__ int __attribute__((__always_inline__, __nodebug__)) _mm_comieq_sd(__m128d __a, __m128d __b) { return __builtin_ia32_comisdeq(__a, __b); } static __inline__ int __attribute__((__always_inline__, __nodebug__)) _mm_comilt_sd(__m128d __a, __m128d __b) { return __builtin_ia32_comisdlt(__a, __b); } static __inline__ int __attribute__((__always_inline__, __nodebug__)) _mm_comile_sd(__m128d __a, __m128d __b) { return __builtin_ia32_comisdle(__a, __b); } static __inline__ int __attribute__((__always_inline__, __nodebug__)) _mm_comigt_sd(__m128d __a, __m128d __b) { return __builtin_ia32_comisdgt(__a, __b); } static __inline__ int __attribute__((__always_inline__, __nodebug__)) _mm_comige_sd(__m128d __a, __m128d __b) { return __builtin_ia32_comisdge(__a, __b); } static __inline__ int __attribute__((__always_inline__, __nodebug__)) _mm_comineq_sd(__m128d __a, __m128d __b) { return __builtin_ia32_comisdneq(__a, __b); } static __inline__ int __attribute__((__always_inline__, __nodebug__)) _mm_ucomieq_sd(__m128d __a, __m128d __b) { return __builtin_ia32_ucomisdeq(__a, __b); } static __inline__ int __attribute__((__always_inline__, __nodebug__)) _mm_ucomilt_sd(__m128d __a, __m128d __b) { return __builtin_ia32_ucomisdlt(__a, __b); } static __inline__ int __attribute__((__always_inline__, __nodebug__)) _mm_ucomile_sd(__m128d __a, __m128d __b) { return __builtin_ia32_ucomisdle(__a, __b); } static __inline__ int __attribute__((__always_inline__, __nodebug__)) _mm_ucomigt_sd(__m128d __a, __m128d __b) { return __builtin_ia32_ucomisdgt(__a, __b); } static __inline__ int __attribute__((__always_inline__, __nodebug__)) _mm_ucomige_sd(__m128d __a, __m128d __b) { return __builtin_ia32_ucomisdge(__a, __b); } static __inline__ int __attribute__((__always_inline__, __nodebug__)) _mm_ucomineq_sd(__m128d __a, __m128d __b) { return __builtin_ia32_ucomisdneq(__a, __b); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_cvtpd_ps(__m128d __a) { return __builtin_ia32_cvtpd2ps(__a); } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__)) _mm_cvtps_pd(__m128 __a) { return __builtin_ia32_cvtps2pd(__a); } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__)) _mm_cvtepi32_pd(__m128i __a) { return __builtin_ia32_cvtdq2pd((__v4si)__a); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_cvtpd_epi32(__m128d __a) { return __builtin_ia32_cvtpd2dq(__a); } static __inline__ int __attribute__((__always_inline__, __nodebug__)) _mm_cvtsd_si32(__m128d __a) { return __builtin_ia32_cvtsd2si(__a); } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_cvtsd_ss(__m128 __a, __m128d __b) { __a[0] = __b[0]; return __a; } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__)) _mm_cvtsi32_sd(__m128d __a, int __b) { __a[0] = __b; return __a; } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__)) _mm_cvtss_sd(__m128d __a, __m128 __b) { __a[0] = __b[0]; return __a; } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_cvttpd_epi32(__m128d __a) { return (__m128i)__builtin_ia32_cvttpd2dq(__a); } static __inline__ int __attribute__((__always_inline__, __nodebug__)) _mm_cvttsd_si32(__m128d __a) { return __a[0]; } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_cvtpd_pi32(__m128d __a) { return (__m64)__builtin_ia32_cvtpd2pi(__a); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_cvttpd_pi32(__m128d __a) { return (__m64)__builtin_ia32_cvttpd2pi(__a); } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__)) _mm_cvtpi32_pd(__m64 __a) { return __builtin_ia32_cvtpi2pd((__v2si)__a); } static __inline__ double __attribute__((__always_inline__, __nodebug__)) _mm_cvtsd_f64(__m128d __a) { return __a[0]; } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__)) _mm_load_pd(double const *__dp) { return *(__m128d*)__dp; } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__)) _mm_load1_pd(double const *__dp) { struct __mm_load1_pd_struct { double __u; } __attribute__((__packed__, __may_alias__)); double __u = ((struct __mm_load1_pd_struct*)__dp)->__u; return (__m128d){ __u, __u }; } #define _mm_load_pd1(dp) _mm_load1_pd(dp) static __inline__ __m128d __attribute__((__always_inline__, __nodebug__)) _mm_loadr_pd(double const *__dp) { __m128d __u = *(__m128d*)__dp; return __builtin_shufflevector(__u, __u, 1, 0); } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__)) _mm_loadu_pd(double const *__dp) { struct __loadu_pd { __m128d __v; } __attribute__((__packed__, __may_alias__)); return ((struct __loadu_pd*)__dp)->__v; } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__)) _mm_load_sd(double const *__dp) { struct __mm_load_sd_struct { double __u; } __attribute__((__packed__, __may_alias__)); double __u = ((struct __mm_load_sd_struct*)__dp)->__u; return (__m128d){ __u, 0 }; } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__)) _mm_loadh_pd(__m128d __a, double const *__dp) { struct __mm_loadh_pd_struct { double __u; } __attribute__((__packed__, __may_alias__)); double __u = ((struct __mm_loadh_pd_struct*)__dp)->__u; return (__m128d){ __a[0], __u }; } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__)) _mm_loadl_pd(__m128d __a, double const *__dp) { struct __mm_loadl_pd_struct { double __u; } __attribute__((__packed__, __may_alias__)); double __u = ((struct __mm_loadl_pd_struct*)__dp)->__u; return (__m128d){ __u, __a[1] }; } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__)) _mm_set_sd(double __w) { return (__m128d){ __w, 0 }; } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__)) _mm_set1_pd(double __w) { return (__m128d){ __w, __w }; } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__)) _mm_set_pd(double __w, double __x) { return (__m128d){ __x, __w }; } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__)) _mm_setr_pd(double __w, double __x) { return (__m128d){ __w, __x }; } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__)) _mm_setzero_pd(void) { return (__m128d){ 0, 0 }; } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__)) _mm_move_sd(__m128d __a, __m128d __b) { return (__m128d){ __b[0], __a[1] }; } static __inline__ void __attribute__((__always_inline__, __nodebug__)) _mm_store_sd(double *__dp, __m128d __a) { struct __mm_store_sd_struct { double __u; } __attribute__((__packed__, __may_alias__)); ((struct __mm_store_sd_struct*)__dp)->__u = __a[0]; } static __inline__ void __attribute__((__always_inline__, __nodebug__)) _mm_store1_pd(double *__dp, __m128d __a) { struct __mm_store1_pd_struct { double __u[2]; } __attribute__((__packed__, __may_alias__)); ((struct __mm_store1_pd_struct*)__dp)->__u[0] = __a[0]; ((struct __mm_store1_pd_struct*)__dp)->__u[1] = __a[0]; } static __inline__ void __attribute__((__always_inline__, __nodebug__)) _mm_store_pd(double *__dp, __m128d __a) { *(__m128d *)__dp = __a; } static __inline__ void __attribute__((__always_inline__, __nodebug__)) _mm_storeu_pd(double *__dp, __m128d __a) { __builtin_ia32_storeupd(__dp, __a); } static __inline__ void __attribute__((__always_inline__, __nodebug__)) _mm_storer_pd(double *__dp, __m128d __a) { __a = __builtin_shufflevector(__a, __a, 1, 0); *(__m128d *)__dp = __a; } static __inline__ void __attribute__((__always_inline__, __nodebug__)) _mm_storeh_pd(double *__dp, __m128d __a) { struct __mm_storeh_pd_struct { double __u; } __attribute__((__packed__, __may_alias__)); ((struct __mm_storeh_pd_struct*)__dp)->__u = __a[1]; } static __inline__ void __attribute__((__always_inline__, __nodebug__)) _mm_storel_pd(double *__dp, __m128d __a) { struct __mm_storeh_pd_struct { double __u; } __attribute__((__packed__, __may_alias__)); ((struct __mm_storeh_pd_struct*)__dp)->__u = __a[0]; } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_add_epi8(__m128i __a, __m128i __b) { return (__m128i)((__v16qi)__a + (__v16qi)__b); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_add_epi16(__m128i __a, __m128i __b) { return (__m128i)((__v8hi)__a + (__v8hi)__b); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_add_epi32(__m128i __a, __m128i __b) { return (__m128i)((__v4si)__a + (__v4si)__b); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_add_si64(__m64 __a, __m64 __b) { return __a + __b; } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_add_epi64(__m128i __a, __m128i __b) { return __a + __b; } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_adds_epi8(__m128i __a, __m128i __b) { return (__m128i)__builtin_ia32_paddsb128((__v16qi)__a, (__v16qi)__b); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_adds_epi16(__m128i __a, __m128i __b) { return (__m128i)__builtin_ia32_paddsw128((__v8hi)__a, (__v8hi)__b); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_adds_epu8(__m128i __a, __m128i __b) { return (__m128i)__builtin_ia32_paddusb128((__v16qi)__a, (__v16qi)__b); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_adds_epu16(__m128i __a, __m128i __b) { return (__m128i)__builtin_ia32_paddusw128((__v8hi)__a, (__v8hi)__b); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_avg_epu8(__m128i __a, __m128i __b) { return (__m128i)__builtin_ia32_pavgb128((__v16qi)__a, (__v16qi)__b); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_avg_epu16(__m128i __a, __m128i __b) { return (__m128i)__builtin_ia32_pavgw128((__v8hi)__a, (__v8hi)__b); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_madd_epi16(__m128i __a, __m128i __b) { return (__m128i)__builtin_ia32_pmaddwd128((__v8hi)__a, (__v8hi)__b); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_max_epi16(__m128i __a, __m128i __b) { return (__m128i)__builtin_ia32_pmaxsw128((__v8hi)__a, (__v8hi)__b); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_max_epu8(__m128i __a, __m128i __b) { return (__m128i)__builtin_ia32_pmaxub128((__v16qi)__a, (__v16qi)__b); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_min_epi16(__m128i __a, __m128i __b) { return (__m128i)__builtin_ia32_pminsw128((__v8hi)__a, (__v8hi)__b); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_min_epu8(__m128i __a, __m128i __b) { return (__m128i)__builtin_ia32_pminub128((__v16qi)__a, (__v16qi)__b); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_mulhi_epi16(__m128i __a, __m128i __b) { return (__m128i)__builtin_ia32_pmulhw128((__v8hi)__a, (__v8hi)__b); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_mulhi_epu16(__m128i __a, __m128i __b) { return (__m128i)__builtin_ia32_pmulhuw128((__v8hi)__a, (__v8hi)__b); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_mullo_epi16(__m128i __a, __m128i __b) { return (__m128i)((__v8hi)__a * (__v8hi)__b); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_mul_su32(__m64 __a, __m64 __b) { return __builtin_ia32_pmuludq((__v2si)__a, (__v2si)__b); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_mul_epu32(__m128i __a, __m128i __b) { return __builtin_ia32_pmuludq128((__v4si)__a, (__v4si)__b); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_sad_epu8(__m128i __a, __m128i __b) { return __builtin_ia32_psadbw128((__v16qi)__a, (__v16qi)__b); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_sub_epi8(__m128i __a, __m128i __b) { return (__m128i)((__v16qi)__a - (__v16qi)__b); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_sub_epi16(__m128i __a, __m128i __b) { return (__m128i)((__v8hi)__a - (__v8hi)__b); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_sub_epi32(__m128i __a, __m128i __b) { return (__m128i)((__v4si)__a - (__v4si)__b); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_sub_si64(__m64 __a, __m64 __b) { return __a - __b; } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_sub_epi64(__m128i __a, __m128i __b) { return __a - __b; } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_subs_epi8(__m128i __a, __m128i __b) { return (__m128i)__builtin_ia32_psubsb128((__v16qi)__a, (__v16qi)__b); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_subs_epi16(__m128i __a, __m128i __b) { return (__m128i)__builtin_ia32_psubsw128((__v8hi)__a, (__v8hi)__b); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_subs_epu8(__m128i __a, __m128i __b) { return (__m128i)__builtin_ia32_psubusb128((__v16qi)__a, (__v16qi)__b); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_subs_epu16(__m128i __a, __m128i __b) { return (__m128i)__builtin_ia32_psubusw128((__v8hi)__a, (__v8hi)__b); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_and_si128(__m128i __a, __m128i __b) { return __a & __b; } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_andnot_si128(__m128i __a, __m128i __b) { return ~__a & __b; } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_or_si128(__m128i __a, __m128i __b) { return __a | __b; } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_xor_si128(__m128i __a, __m128i __b) { return __a ^ __b; } #define _mm_slli_si128(a, imm) __extension__ ({ \ (__m128i)__builtin_shufflevector((__v16qi)_mm_setzero_si128(), \ (__v16qi)(__m128i)(a), \ ((imm)&0xF0) ? 0 : 16 - ((imm)&0xF), \ ((imm)&0xF0) ? 0 : 17 - ((imm)&0xF), \ ((imm)&0xF0) ? 0 : 18 - ((imm)&0xF), \ ((imm)&0xF0) ? 0 : 19 - ((imm)&0xF), \ ((imm)&0xF0) ? 0 : 20 - ((imm)&0xF), \ ((imm)&0xF0) ? 0 : 21 - ((imm)&0xF), \ ((imm)&0xF0) ? 0 : 22 - ((imm)&0xF), \ ((imm)&0xF0) ? 0 : 23 - ((imm)&0xF), \ ((imm)&0xF0) ? 0 : 24 - ((imm)&0xF), \ ((imm)&0xF0) ? 0 : 25 - ((imm)&0xF), \ ((imm)&0xF0) ? 0 : 26 - ((imm)&0xF), \ ((imm)&0xF0) ? 0 : 27 - ((imm)&0xF), \ ((imm)&0xF0) ? 0 : 28 - ((imm)&0xF), \ ((imm)&0xF0) ? 0 : 29 - ((imm)&0xF), \ ((imm)&0xF0) ? 0 : 30 - ((imm)&0xF), \ ((imm)&0xF0) ? 0 : 31 - ((imm)&0xF)); }) #define _mm_bslli_si128(a, imm) \ _mm_slli_si128((a), (imm)) static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_slli_epi16(__m128i __a, int __count) { return (__m128i)__builtin_ia32_psllwi128((__v8hi)__a, __count); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_sll_epi16(__m128i __a, __m128i __count) { return (__m128i)__builtin_ia32_psllw128((__v8hi)__a, (__v8hi)__count); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_slli_epi32(__m128i __a, int __count) { return (__m128i)__builtin_ia32_pslldi128((__v4si)__a, __count); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_sll_epi32(__m128i __a, __m128i __count) { return (__m128i)__builtin_ia32_pslld128((__v4si)__a, (__v4si)__count); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_slli_epi64(__m128i __a, int __count) { return __builtin_ia32_psllqi128(__a, __count); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_sll_epi64(__m128i __a, __m128i __count) { return __builtin_ia32_psllq128(__a, __count); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_srai_epi16(__m128i __a, int __count) { return (__m128i)__builtin_ia32_psrawi128((__v8hi)__a, __count); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_sra_epi16(__m128i __a, __m128i __count) { return (__m128i)__builtin_ia32_psraw128((__v8hi)__a, (__v8hi)__count); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_srai_epi32(__m128i __a, int __count) { return (__m128i)__builtin_ia32_psradi128((__v4si)__a, __count); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_sra_epi32(__m128i __a, __m128i __count) { return (__m128i)__builtin_ia32_psrad128((__v4si)__a, (__v4si)__count); } #define _mm_srli_si128(a, imm) __extension__ ({ \ (__m128i)__builtin_shufflevector((__v16qi)(__m128i)(a), \ (__v16qi)_mm_setzero_si128(), \ ((imm)&0xF0) ? 16 : ((imm)&0xF) + 0, \ ((imm)&0xF0) ? 16 : ((imm)&0xF) + 1, \ ((imm)&0xF0) ? 16 : ((imm)&0xF) + 2, \ ((imm)&0xF0) ? 16 : ((imm)&0xF) + 3, \ ((imm)&0xF0) ? 16 : ((imm)&0xF) + 4, \ ((imm)&0xF0) ? 16 : ((imm)&0xF) + 5, \ ((imm)&0xF0) ? 16 : ((imm)&0xF) + 6, \ ((imm)&0xF0) ? 16 : ((imm)&0xF) + 7, \ ((imm)&0xF0) ? 16 : ((imm)&0xF) + 8, \ ((imm)&0xF0) ? 16 : ((imm)&0xF) + 9, \ ((imm)&0xF0) ? 16 : ((imm)&0xF) + 10, \ ((imm)&0xF0) ? 16 : ((imm)&0xF) + 11, \ ((imm)&0xF0) ? 16 : ((imm)&0xF) + 12, \ ((imm)&0xF0) ? 16 : ((imm)&0xF) + 13, \ ((imm)&0xF0) ? 16 : ((imm)&0xF) + 14, \ ((imm)&0xF0) ? 16 : ((imm)&0xF) + 15); }) #define _mm_bsrli_si128(a, imm) \ _mm_srli_si128((a), (imm)) static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_srli_epi16(__m128i __a, int __count) { return (__m128i)__builtin_ia32_psrlwi128((__v8hi)__a, __count); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_srl_epi16(__m128i __a, __m128i __count) { return (__m128i)__builtin_ia32_psrlw128((__v8hi)__a, (__v8hi)__count); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_srli_epi32(__m128i __a, int __count) { return (__m128i)__builtin_ia32_psrldi128((__v4si)__a, __count); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_srl_epi32(__m128i __a, __m128i __count) { return (__m128i)__builtin_ia32_psrld128((__v4si)__a, (__v4si)__count); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_srli_epi64(__m128i __a, int __count) { return __builtin_ia32_psrlqi128(__a, __count); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_srl_epi64(__m128i __a, __m128i __count) { return __builtin_ia32_psrlq128(__a, __count); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_cmpeq_epi8(__m128i __a, __m128i __b) { return (__m128i)((__v16qi)__a == (__v16qi)__b); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_cmpeq_epi16(__m128i __a, __m128i __b) { return (__m128i)((__v8hi)__a == (__v8hi)__b); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_cmpeq_epi32(__m128i __a, __m128i __b) { return (__m128i)((__v4si)__a == (__v4si)__b); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_cmpgt_epi8(__m128i __a, __m128i __b) { /* This function always performs a signed comparison, but __v16qi is a char which may be signed or unsigned. */ typedef signed char __v16qs __attribute__((__vector_size__(16))); return (__m128i)((__v16qs)__a > (__v16qs)__b); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_cmpgt_epi16(__m128i __a, __m128i __b) { return (__m128i)((__v8hi)__a > (__v8hi)__b); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_cmpgt_epi32(__m128i __a, __m128i __b) { return (__m128i)((__v4si)__a > (__v4si)__b); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_cmplt_epi8(__m128i __a, __m128i __b) { return _mm_cmpgt_epi8(__b, __a); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_cmplt_epi16(__m128i __a, __m128i __b) { return _mm_cmpgt_epi16(__b, __a); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_cmplt_epi32(__m128i __a, __m128i __b) { return _mm_cmpgt_epi32(__b, __a); } #ifdef __x86_64__ static __inline__ __m128d __attribute__((__always_inline__, __nodebug__)) _mm_cvtsi64_sd(__m128d __a, long long __b) { __a[0] = __b; return __a; } static __inline__ long long __attribute__((__always_inline__, __nodebug__)) _mm_cvtsd_si64(__m128d __a) { return __builtin_ia32_cvtsd2si64(__a); } static __inline__ long long __attribute__((__always_inline__, __nodebug__)) _mm_cvttsd_si64(__m128d __a) { return __a[0]; } #endif # 1047 "/usr/local/llvm-devel/bin/../lib/clang/3.7.0/include/emmintrin.h" 3 4 static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_cvtepi32_ps(__m128i __a) { return __builtin_ia32_cvtdq2ps((__v4si)__a); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_cvtps_epi32(__m128 __a) { return (__m128i)__builtin_ia32_cvtps2dq(__a); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_cvttps_epi32(__m128 __a) { return (__m128i)__builtin_ia32_cvttps2dq(__a); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_cvtsi32_si128(int __a) { return (__m128i)(__v4si){ __a, 0, 0, 0 }; } #ifdef __x86_64__ static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_cvtsi64_si128(long long __a) { return (__m128i){ __a, 0 }; } #endif # 1079 "/usr/local/llvm-devel/bin/../lib/clang/3.7.0/include/emmintrin.h" 3 4 static __inline__ int __attribute__((__always_inline__, __nodebug__)) _mm_cvtsi128_si32(__m128i __a) { __v4si __b = (__v4si)__a; return __b[0]; } #ifdef __x86_64__ static __inline__ long long __attribute__((__always_inline__, __nodebug__)) _mm_cvtsi128_si64(__m128i __a) { return __a[0]; } #endif # 1094 "/usr/local/llvm-devel/bin/../lib/clang/3.7.0/include/emmintrin.h" 3 4 static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_load_si128(__m128i const *__p) { return *__p; } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_loadu_si128(__m128i const *__p) { struct __loadu_si128 { __m128i __v; } __attribute__((__packed__, __may_alias__)); return ((struct __loadu_si128*)__p)->__v; } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_loadl_epi64(__m128i const *__p) { struct __mm_loadl_epi64_struct { long long __u; } __attribute__((__packed__, __may_alias__)); return (__m128i) { ((struct __mm_loadl_epi64_struct*)__p)->__u, 0}; } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_set_epi64x(long long q1, long long q0) { return (__m128i){ q0, q1 }; } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_set_epi64(__m64 q1, __m64 q0) { return (__m128i){ (long long)q0, (long long)q1 }; } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_set_epi32(int i3, int i2, int i1, int i0) { return (__m128i)(__v4si){ i0, i1, i2, i3}; } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_set_epi16(short w7, short w6, short w5, short w4, short w3, short w2, short w1, short w0) { return (__m128i)(__v8hi){ w0, w1, w2, w3, w4, w5, w6, w7 }; } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_set_epi8(char b15, char b14, char b13, char b12, char b11, char b10, char b9, char b8, char b7, char b6, char b5, char b4, char b3, char b2, char b1, char b0) { return (__m128i)(__v16qi){ b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15 }; } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_set1_epi64x(long long __q) { return (__m128i){ __q, __q }; } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_set1_epi64(__m64 __q) { return (__m128i){ (long long)__q, (long long)__q }; } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_set1_epi32(int __i) { return (__m128i)(__v4si){ __i, __i, __i, __i }; } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_set1_epi16(short __w) { return (__m128i)(__v8hi){ __w, __w, __w, __w, __w, __w, __w, __w }; } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_set1_epi8(char __b) { return (__m128i)(__v16qi){ __b, __b, __b, __b, __b, __b, __b, __b, __b, __b, __b, __b, __b, __b, __b, __b }; } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_setr_epi64(__m64 q0, __m64 q1) { return (__m128i){ (long long)q0, (long long)q1 }; } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_setr_epi32(int i0, int i1, int i2, int i3) { return (__m128i)(__v4si){ i0, i1, i2, i3}; } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_setr_epi16(short w0, short w1, short w2, short w3, short w4, short w5, short w6, short w7) { return (__m128i)(__v8hi){ w0, w1, w2, w3, w4, w5, w6, w7 }; } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_setr_epi8(char b0, char b1, char b2, char b3, char b4, char b5, char b6, char b7, char b8, char b9, char b10, char b11, char b12, char b13, char b14, char b15) { return (__m128i)(__v16qi){ b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15 }; } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_setzero_si128(void) { return (__m128i){ 0LL, 0LL }; } static __inline__ void __attribute__((__always_inline__, __nodebug__)) _mm_store_si128(__m128i *__p, __m128i __b) { *__p = __b; } static __inline__ void __attribute__((__always_inline__, __nodebug__)) _mm_storeu_si128(__m128i *__p, __m128i __b) { __builtin_ia32_storedqu((char *)__p, (__v16qi)__b); } static __inline__ void __attribute__((__always_inline__, __nodebug__)) _mm_maskmoveu_si128(__m128i __d, __m128i __n, char *__p) { __builtin_ia32_maskmovdqu((__v16qi)__d, (__v16qi)__n, __p); } static __inline__ void __attribute__((__always_inline__, __nodebug__)) _mm_storel_epi64(__m128i *__p, __m128i __a) { struct __mm_storel_epi64_struct { long long __u; } __attribute__((__packed__, __may_alias__)); ((struct __mm_storel_epi64_struct*)__p)->__u = __a[0]; } static __inline__ void __attribute__((__always_inline__, __nodebug__)) _mm_stream_pd(double *__p, __m128d __a) { __builtin_ia32_movntpd(__p, __a); } static __inline__ void __attribute__((__always_inline__, __nodebug__)) _mm_stream_si128(__m128i *__p, __m128i __a) { __builtin_ia32_movntdq(__p, __a); } static __inline__ void __attribute__((__always_inline__, __nodebug__)) _mm_stream_si32(int *__p, int __a) { __builtin_ia32_movnti(__p, __a); } #ifdef __x86_64__ static __inline__ void __attribute__((__always_inline__, __nodebug__)) _mm_stream_si64(long long *__p, long long __a) { __builtin_ia32_movnti64(__p, __a); } #endif # 1261 "/usr/local/llvm-devel/bin/../lib/clang/3.7.0/include/emmintrin.h" 3 4 static __inline__ void __attribute__((__always_inline__, __nodebug__)) _mm_clflush(void const *__p) { __builtin_ia32_clflush(__p); } static __inline__ void __attribute__((__always_inline__, __nodebug__)) _mm_lfence(void) { __builtin_ia32_lfence(); } static __inline__ void __attribute__((__always_inline__, __nodebug__)) _mm_mfence(void) { __builtin_ia32_mfence(); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_packs_epi16(__m128i __a, __m128i __b) { return (__m128i)__builtin_ia32_packsswb128((__v8hi)__a, (__v8hi)__b); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_packs_epi32(__m128i __a, __m128i __b) { return (__m128i)__builtin_ia32_packssdw128((__v4si)__a, (__v4si)__b); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_packus_epi16(__m128i __a, __m128i __b) { return (__m128i)__builtin_ia32_packuswb128((__v8hi)__a, (__v8hi)__b); } static __inline__ int __attribute__((__always_inline__, __nodebug__)) _mm_extract_epi16(__m128i __a, int __imm) { __v8hi __b = (__v8hi)__a; return (unsigned short)__b[__imm & 7]; } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_insert_epi16(__m128i __a, int __b, int __imm) { __v8hi __c = (__v8hi)__a; __c[__imm & 7] = __b; return (__m128i)__c; } static __inline__ int __attribute__((__always_inline__, __nodebug__)) _mm_movemask_epi8(__m128i __a) { return __builtin_ia32_pmovmskb128((__v16qi)__a); } #define _mm_shuffle_epi32(a, imm) __extension__ ({ \ (__m128i)__builtin_shufflevector((__v4si)(__m128i)(a), \ (__v4si)_mm_set1_epi32(0), \ (imm) & 0x3, ((imm) & 0xc) >> 2, \ ((imm) & 0x30) >> 4, ((imm) & 0xc0) >> 6); }) #define _mm_shufflelo_epi16(a, imm) __extension__ ({ \ (__m128i)__builtin_shufflevector((__v8hi)(__m128i)(a), \ (__v8hi)_mm_set1_epi16(0), \ (imm) & 0x3, ((imm) & 0xc) >> 2, \ ((imm) & 0x30) >> 4, ((imm) & 0xc0) >> 6, \ 4, 5, 6, 7); }) #define _mm_shufflehi_epi16(a, imm) __extension__ ({ \ (__m128i)__builtin_shufflevector((__v8hi)(__m128i)(a), \ (__v8hi)_mm_set1_epi16(0), \ 0, 1, 2, 3, \ 4 + (((imm) & 0x03) >> 0), \ 4 + (((imm) & 0x0c) >> 2), \ 4 + (((imm) & 0x30) >> 4), \ 4 + (((imm) & 0xc0) >> 6)); }) static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_unpackhi_epi8(__m128i __a, __m128i __b) { return (__m128i)__builtin_shufflevector((__v16qi)__a, (__v16qi)__b, 8, 16+8, 9, 16+9, 10, 16+10, 11, 16+11, 12, 16+12, 13, 16+13, 14, 16+14, 15, 16+15); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_unpackhi_epi16(__m128i __a, __m128i __b) { return (__m128i)__builtin_shufflevector((__v8hi)__a, (__v8hi)__b, 4, 8+4, 5, 8+5, 6, 8+6, 7, 8+7); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_unpackhi_epi32(__m128i __a, __m128i __b) { return (__m128i)__builtin_shufflevector((__v4si)__a, (__v4si)__b, 2, 4+2, 3, 4+3); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_unpackhi_epi64(__m128i __a, __m128i __b) { return (__m128i)__builtin_shufflevector(__a, __b, 1, 2+1); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_unpacklo_epi8(__m128i __a, __m128i __b) { return (__m128i)__builtin_shufflevector((__v16qi)__a, (__v16qi)__b, 0, 16+0, 1, 16+1, 2, 16+2, 3, 16+3, 4, 16+4, 5, 16+5, 6, 16+6, 7, 16+7); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_unpacklo_epi16(__m128i __a, __m128i __b) { return (__m128i)__builtin_shufflevector((__v8hi)__a, (__v8hi)__b, 0, 8+0, 1, 8+1, 2, 8+2, 3, 8+3); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_unpacklo_epi32(__m128i __a, __m128i __b) { return (__m128i)__builtin_shufflevector((__v4si)__a, (__v4si)__b, 0, 4+0, 1, 4+1); } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_unpacklo_epi64(__m128i __a, __m128i __b) { return (__m128i)__builtin_shufflevector(__a, __b, 0, 2+0); } static __inline__ __m64 __attribute__((__always_inline__, __nodebug__)) _mm_movepi64_pi64(__m128i __a) { return (__m64)__a[0]; } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_movpi64_epi64(__m64 __a) { return (__m128i){ (long long)__a, 0 }; } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_move_epi64(__m128i __a) { return __builtin_shufflevector(__a, (__m128i){ 0 }, 0, 2); } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__)) _mm_unpackhi_pd(__m128d __a, __m128d __b) { return __builtin_shufflevector(__a, __b, 1, 2+1); } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__)) _mm_unpacklo_pd(__m128d __a, __m128d __b) { return __builtin_shufflevector(__a, __b, 0, 2+0); } static __inline__ int __attribute__((__always_inline__, __nodebug__)) _mm_movemask_pd(__m128d __a) { return __builtin_ia32_movmskpd(__a); } #define _mm_shuffle_pd(a, b, i) __extension__ ({ \ __builtin_shufflevector((__m128d)(a), (__m128d)(b), \ (i) & 1, (((i) & 2) >> 1) + 2); }) static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_castpd_ps(__m128d __a) { return (__m128)__a; } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_castpd_si128(__m128d __a) { return (__m128i)__a; } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__)) _mm_castps_pd(__m128 __a) { return (__m128d)__a; } static __inline__ __m128i __attribute__((__always_inline__, __nodebug__)) _mm_castps_si128(__m128 __a) { return (__m128i)__a; } static __inline__ __m128 __attribute__((__always_inline__, __nodebug__)) _mm_castsi128_ps(__m128i __a) { return (__m128)__a; } static __inline__ __m128d __attribute__((__always_inline__, __nodebug__)) _mm_castsi128_pd(__m128i __a) { return (__m128d)__a; } static __inline__ void __attribute__((__always_inline__, __nodebug__)) _mm_pause(void) { __asm__ volatile ("pause"); } #define _MM_SHUFFLE2(x, y) (((x) << 1) | (y)) #endif /* __SSE2__ */ # 1474 "/usr/local/llvm-devel/bin/../lib/clang/3.7.0/include/emmintrin.h" 3 4 #endif /* __EMMINTRIN_H */ # 1476 "/usr/local/llvm-devel/bin/../lib/clang/3.7.0/include/emmintrin.h" 3 4 # 999 "/usr/local/llvm-devel/bin/../lib/clang/3.7.0/include/xmmintrin.h" 2 3 4 #endif # 1000 "/usr/local/llvm-devel/bin/../lib/clang/3.7.0/include/xmmintrin.h" 3 4 #endif /* __SSE__ */ # 1002 "/usr/local/llvm-devel/bin/../lib/clang/3.7.0/include/xmmintrin.h" 3 4 #endif /* __XMMINTRIN_H */ # 1004 "/usr/local/llvm-devel/bin/../lib/clang/3.7.0/include/xmmintrin.h" 3 4 # 60 "/usr/local/include/SDL2/SDL_cpuinfo.h" 2 #endif # 61 "/usr/local/include/SDL2/SDL_cpuinfo.h" #ifdef __SSE2__ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 62 "/usr/local/include/SDL2/SDL_cpuinfo.h" # 63 "/usr/local/include/SDL2/SDL_cpuinfo.h" #endif # 64 "/usr/local/include/SDL2/SDL_cpuinfo.h" #endif # 65 "/usr/local/include/SDL2/SDL_cpuinfo.h" #if 0 /* expanded by -frewrite-includes */ #include "begin_code.h" #endif /* expanded by -frewrite-includes */ # 66 "/usr/local/include/SDL2/SDL_cpuinfo.h" # 1 "/usr/local/include/SDL2/begin_code.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file begin_code.h * * This file sets things up for C dynamic library function definitions, * static inlined functions, and structures aligned at 4-byte alignment. * If you don't like ugly C preprocessor code, don't look at this file. :) */ /* This shouldn't be nested -- included it around code only. */ #ifdef _begin_code_h #error Nested inclusion of begin_code.h #endif # 34 "/usr/local/include/SDL2/begin_code.h" #define _begin_code_h #ifndef SDL_DEPRECATED # if (__GNUC__ >= 4) /* technically, this arrived in gcc 3.1, but oh well. */ # define SDL_DEPRECATED __attribute__((deprecated)) # else # 40 "/usr/local/include/SDL2/begin_code.h" # define SDL_DEPRECATED # endif # 42 "/usr/local/include/SDL2/begin_code.h" #endif # 43 "/usr/local/include/SDL2/begin_code.h" /* Some compilers use a special export keyword */ #ifndef DECLSPEC # if defined(__WIN32__) || defined(__WINRT__) # ifdef __BORLANDC__ # ifdef BUILD_SDL # define DECLSPEC # else # 51 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllimport) # endif # 53 "/usr/local/include/SDL2/begin_code.h" # else # 54 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllexport) # endif # 56 "/usr/local/include/SDL2/begin_code.h" # else # 57 "/usr/local/include/SDL2/begin_code.h" # if defined(__GNUC__) && __GNUC__ >= 4 # define DECLSPEC __attribute__ ((visibility("default"))) # elif defined(__GNUC__) && __GNUC__ >= 2 # 60 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllexport) # else # 62 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC # endif # 64 "/usr/local/include/SDL2/begin_code.h" # endif # 65 "/usr/local/include/SDL2/begin_code.h" #endif # 66 "/usr/local/include/SDL2/begin_code.h" /* By default SDL uses the C calling convention */ #ifndef SDLCALL #if (defined(__WIN32__) || defined(__WINRT__)) && !defined(__GNUC__) #define SDLCALL __cdecl #else # 72 "/usr/local/include/SDL2/begin_code.h" #define SDLCALL #endif # 74 "/usr/local/include/SDL2/begin_code.h" #endif /* SDLCALL */ # 75 "/usr/local/include/SDL2/begin_code.h" /* Removed DECLSPEC on Symbian OS because SDL cannot be a DLL in EPOC */ #ifdef __SYMBIAN32__ #undef DECLSPEC #define DECLSPEC #endif /* __SYMBIAN32__ */ # 81 "/usr/local/include/SDL2/begin_code.h" /* Force structure packing at 4 byte alignment. This is necessary if the header is included in code which has structure packing set to an alternate value, say for loading structures from disk. The packing is reset to the previous value in close_code.h */ #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__) #ifdef _MSC_VER #pragma warning(disable: 4103) #endif # 91 "/usr/local/include/SDL2/begin_code.h" #ifdef __BORLANDC__ #pragma nopackwarning #endif # 94 "/usr/local/include/SDL2/begin_code.h" #ifdef _M_X64 /* Use 8-byte alignment on 64-bit architectures, so pointers are aligned */ #pragma pack(push,8) #else # 98 "/usr/local/include/SDL2/begin_code.h" #pragma pack(push,4) #endif # 100 "/usr/local/include/SDL2/begin_code.h" #endif /* Compiler needs structure packing set */ # 101 "/usr/local/include/SDL2/begin_code.h" #ifndef SDL_INLINE #if defined(__GNUC__) #define SDL_INLINE __inline__ #elif defined(_MSC_VER) || defined(__BORLANDC__) || \ defined(__DMC__) || defined(__SC__) || \ defined(__WATCOMC__) || defined(__LCC__) || \ defined(__DECC) # 109 "/usr/local/include/SDL2/begin_code.h" #define SDL_INLINE __inline #ifndef __inline__ #define __inline__ __inline #endif # 113 "/usr/local/include/SDL2/begin_code.h" #else # 114 "/usr/local/include/SDL2/begin_code.h" #define SDL_INLINE inline #ifndef __inline__ #define __inline__ inline #endif # 118 "/usr/local/include/SDL2/begin_code.h" #endif # 119 "/usr/local/include/SDL2/begin_code.h" #endif /* SDL_INLINE not defined */ # 120 "/usr/local/include/SDL2/begin_code.h" #ifndef SDL_FORCE_INLINE #if defined(_MSC_VER) #define SDL_FORCE_INLINE __forceinline #elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) ) # 125 "/usr/local/include/SDL2/begin_code.h" #define SDL_FORCE_INLINE __attribute__((always_inline)) static __inline__ #else # 127 "/usr/local/include/SDL2/begin_code.h" #define SDL_FORCE_INLINE static SDL_INLINE #endif # 129 "/usr/local/include/SDL2/begin_code.h" #endif /* SDL_FORCE_INLINE not defined */ # 130 "/usr/local/include/SDL2/begin_code.h" /* Apparently this is needed by several Windows compilers */ #if !defined(__MACH__) #ifndef NULL #ifdef __cplusplus #define NULL 0 #else # 137 "/usr/local/include/SDL2/begin_code.h" #define NULL ((void *)0) #endif # 139 "/usr/local/include/SDL2/begin_code.h" #endif /* NULL */ # 140 "/usr/local/include/SDL2/begin_code.h" #endif /* ! Mac OS X - breaks precompiled headers */ # 141 "/usr/local/include/SDL2/begin_code.h" # 67 "/usr/local/include/SDL2/SDL_cpuinfo.h" 2 /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif # 71 "/usr/local/include/SDL2/SDL_cpuinfo.h" /* This is a guess for the cacheline size used for padding. * Most x86 processors have a 64 byte cache line. * The 64-bit PowerPC processors have a 128 byte cache line. * We'll use the larger value to be generally safe. */ #define SDL_CACHELINE_SIZE 128 /** * This function returns the number of CPU cores available. */ extern DECLSPEC int SDLCALL SDL_GetCPUCount(void); /** * This function returns the L1 cache line size of the CPU * * This is useful for determining multi-threaded structure padding * or SIMD prefetch sizes. */ extern DECLSPEC int SDLCALL SDL_GetCPUCacheLineSize(void); /** * This function returns true if the CPU has the RDTSC instruction. */ extern DECLSPEC SDL_bool SDLCALL SDL_HasRDTSC(void); /** * This function returns true if the CPU has AltiVec features. */ extern DECLSPEC SDL_bool SDLCALL SDL_HasAltiVec(void); /** * This function returns true if the CPU has MMX features. */ extern DECLSPEC SDL_bool SDLCALL SDL_HasMMX(void); /** * This function returns true if the CPU has 3DNow! features. */ extern DECLSPEC SDL_bool SDLCALL SDL_Has3DNow(void); /** * This function returns true if the CPU has SSE features. */ extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE(void); /** * This function returns true if the CPU has SSE2 features. */ extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE2(void); /** * This function returns true if the CPU has SSE3 features. */ extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE3(void); /** * This function returns true if the CPU has SSE4.1 features. */ extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE41(void); /** * This function returns true if the CPU has SSE4.2 features. */ extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE42(void); /** * This function returns true if the CPU has AVX features. */ extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX(void); /** * This function returns the amount of RAM configured in the system, in MB. */ extern DECLSPEC int SDLCALL SDL_GetSystemRAM(void); /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif # 152 "/usr/local/include/SDL2/SDL_cpuinfo.h" #if 0 /* expanded by -frewrite-includes */ #include "close_code.h" #endif /* expanded by -frewrite-includes */ # 152 "/usr/local/include/SDL2/SDL_cpuinfo.h" # 1 "/usr/local/include/SDL2/close_code.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file close_code.h * * This file reverses the effects of begin_code.h and should be included * after you finish any function and structure declarations in your headers */ #undef _begin_code_h /* Reset structure packing at previous byte alignment */ #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__WATCOMC__) || defined(__BORLANDC__) #ifdef __BORLANDC__ #pragma nopackwarning #endif # 36 "/usr/local/include/SDL2/close_code.h" #pragma pack(pop) #endif /* Compiler needs structure packing set */ # 38 "/usr/local/include/SDL2/close_code.h" # 153 "/usr/local/include/SDL2/SDL_cpuinfo.h" 2 #endif /* _SDL_cpuinfo_h */ # 155 "/usr/local/include/SDL2/SDL_cpuinfo.h" /* vi: set ts=4 sw=4 expandtab: */ # 74 "/usr/local/include/SDL2/SDL.h" 2 #if 0 /* expanded by -frewrite-includes */ #include "SDL_endian.h" #endif /* expanded by -frewrite-includes */ # 74 "/usr/local/include/SDL2/SDL.h" # 75 "/usr/local/include/SDL2/SDL.h" #if 0 /* expanded by -frewrite-includes */ #include "SDL_error.h" #endif /* expanded by -frewrite-includes */ # 75 "/usr/local/include/SDL2/SDL.h" # 76 "/usr/local/include/SDL2/SDL.h" #if 0 /* expanded by -frewrite-includes */ #include "SDL_events.h" #endif /* expanded by -frewrite-includes */ # 76 "/usr/local/include/SDL2/SDL.h" # 1 "/usr/local/include/SDL2/SDL_events.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file SDL_events.h * * Include file for SDL event handling. */ #ifndef _SDL_events_h #define _SDL_events_h #if 0 /* expanded by -frewrite-includes */ #include "SDL_stdinc.h" #endif /* expanded by -frewrite-includes */ # 31 "/usr/local/include/SDL2/SDL_events.h" # 32 "/usr/local/include/SDL2/SDL_events.h" #if 0 /* expanded by -frewrite-includes */ #include "SDL_error.h" #endif /* expanded by -frewrite-includes */ # 32 "/usr/local/include/SDL2/SDL_events.h" # 33 "/usr/local/include/SDL2/SDL_events.h" #if 0 /* expanded by -frewrite-includes */ #include "SDL_video.h" #endif /* expanded by -frewrite-includes */ # 33 "/usr/local/include/SDL2/SDL_events.h" # 1 "/usr/local/include/SDL2/SDL_video.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file SDL_video.h * * Header file for SDL video functions. */ #ifndef _SDL_video_h #define _SDL_video_h #if 0 /* expanded by -frewrite-includes */ #include "SDL_stdinc.h" #endif /* expanded by -frewrite-includes */ # 31 "/usr/local/include/SDL2/SDL_video.h" # 32 "/usr/local/include/SDL2/SDL_video.h" #if 0 /* expanded by -frewrite-includes */ #include "SDL_pixels.h" #endif /* expanded by -frewrite-includes */ # 32 "/usr/local/include/SDL2/SDL_video.h" # 1 "/usr/local/include/SDL2/SDL_pixels.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file SDL_pixels.h * * Header for the enumerated pixel format definitions. */ #ifndef _SDL_pixels_h #define _SDL_pixels_h #if 0 /* expanded by -frewrite-includes */ #include "SDL_stdinc.h" #endif /* expanded by -frewrite-includes */ # 31 "/usr/local/include/SDL2/SDL_pixels.h" # 32 "/usr/local/include/SDL2/SDL_pixels.h" #if 0 /* expanded by -frewrite-includes */ #include "begin_code.h" #endif /* expanded by -frewrite-includes */ # 33 "/usr/local/include/SDL2/SDL_pixels.h" # 1 "/usr/local/include/SDL2/begin_code.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file begin_code.h * * This file sets things up for C dynamic library function definitions, * static inlined functions, and structures aligned at 4-byte alignment. * If you don't like ugly C preprocessor code, don't look at this file. :) */ /* This shouldn't be nested -- included it around code only. */ #ifdef _begin_code_h #error Nested inclusion of begin_code.h #endif # 34 "/usr/local/include/SDL2/begin_code.h" #define _begin_code_h #ifndef SDL_DEPRECATED # if (__GNUC__ >= 4) /* technically, this arrived in gcc 3.1, but oh well. */ # define SDL_DEPRECATED __attribute__((deprecated)) # else # 40 "/usr/local/include/SDL2/begin_code.h" # define SDL_DEPRECATED # endif # 42 "/usr/local/include/SDL2/begin_code.h" #endif # 43 "/usr/local/include/SDL2/begin_code.h" /* Some compilers use a special export keyword */ #ifndef DECLSPEC # if defined(__WIN32__) || defined(__WINRT__) # ifdef __BORLANDC__ # ifdef BUILD_SDL # define DECLSPEC # else # 51 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllimport) # endif # 53 "/usr/local/include/SDL2/begin_code.h" # else # 54 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllexport) # endif # 56 "/usr/local/include/SDL2/begin_code.h" # else # 57 "/usr/local/include/SDL2/begin_code.h" # if defined(__GNUC__) && __GNUC__ >= 4 # define DECLSPEC __attribute__ ((visibility("default"))) # elif defined(__GNUC__) && __GNUC__ >= 2 # 60 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllexport) # else # 62 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC # endif # 64 "/usr/local/include/SDL2/begin_code.h" # endif # 65 "/usr/local/include/SDL2/begin_code.h" #endif # 66 "/usr/local/include/SDL2/begin_code.h" /* By default SDL uses the C calling convention */ #ifndef SDLCALL #if (defined(__WIN32__) || defined(__WINRT__)) && !defined(__GNUC__) #define SDLCALL __cdecl #else # 72 "/usr/local/include/SDL2/begin_code.h" #define SDLCALL #endif # 74 "/usr/local/include/SDL2/begin_code.h" #endif /* SDLCALL */ # 75 "/usr/local/include/SDL2/begin_code.h" /* Removed DECLSPEC on Symbian OS because SDL cannot be a DLL in EPOC */ #ifdef __SYMBIAN32__ #undef DECLSPEC #define DECLSPEC #endif /* __SYMBIAN32__ */ # 81 "/usr/local/include/SDL2/begin_code.h" /* Force structure packing at 4 byte alignment. This is necessary if the header is included in code which has structure packing set to an alternate value, say for loading structures from disk. The packing is reset to the previous value in close_code.h */ #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__) #ifdef _MSC_VER #pragma warning(disable: 4103) #endif # 91 "/usr/local/include/SDL2/begin_code.h" #ifdef __BORLANDC__ #pragma nopackwarning #endif # 94 "/usr/local/include/SDL2/begin_code.h" #ifdef _M_X64 /* Use 8-byte alignment on 64-bit architectures, so pointers are aligned */ #pragma pack(push,8) #else # 98 "/usr/local/include/SDL2/begin_code.h" #pragma pack(push,4) #endif # 100 "/usr/local/include/SDL2/begin_code.h" #endif /* Compiler needs structure packing set */ # 101 "/usr/local/include/SDL2/begin_code.h" #ifndef SDL_INLINE #if defined(__GNUC__) #define SDL_INLINE __inline__ #elif defined(_MSC_VER) || defined(__BORLANDC__) || \ defined(__DMC__) || defined(__SC__) || \ defined(__WATCOMC__) || defined(__LCC__) || \ defined(__DECC) # 109 "/usr/local/include/SDL2/begin_code.h" #define SDL_INLINE __inline #ifndef __inline__ #define __inline__ __inline #endif # 113 "/usr/local/include/SDL2/begin_code.h" #else # 114 "/usr/local/include/SDL2/begin_code.h" #define SDL_INLINE inline #ifndef __inline__ #define __inline__ inline #endif # 118 "/usr/local/include/SDL2/begin_code.h" #endif # 119 "/usr/local/include/SDL2/begin_code.h" #endif /* SDL_INLINE not defined */ # 120 "/usr/local/include/SDL2/begin_code.h" #ifndef SDL_FORCE_INLINE #if defined(_MSC_VER) #define SDL_FORCE_INLINE __forceinline #elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) ) # 125 "/usr/local/include/SDL2/begin_code.h" #define SDL_FORCE_INLINE __attribute__((always_inline)) static __inline__ #else # 127 "/usr/local/include/SDL2/begin_code.h" #define SDL_FORCE_INLINE static SDL_INLINE #endif # 129 "/usr/local/include/SDL2/begin_code.h" #endif /* SDL_FORCE_INLINE not defined */ # 130 "/usr/local/include/SDL2/begin_code.h" /* Apparently this is needed by several Windows compilers */ #if !defined(__MACH__) #ifndef NULL #ifdef __cplusplus #define NULL 0 #else # 137 "/usr/local/include/SDL2/begin_code.h" #define NULL ((void *)0) #endif # 139 "/usr/local/include/SDL2/begin_code.h" #endif /* NULL */ # 140 "/usr/local/include/SDL2/begin_code.h" #endif /* ! Mac OS X - breaks precompiled headers */ # 141 "/usr/local/include/SDL2/begin_code.h" # 34 "/usr/local/include/SDL2/SDL_pixels.h" 2 /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif # 38 "/usr/local/include/SDL2/SDL_pixels.h" /** * \name Transparency definitions * * These define alpha as the opacity of a surface. */ /* @{ */ #define SDL_ALPHA_OPAQUE 255 #define SDL_ALPHA_TRANSPARENT 0 /* @} */ /** Pixel type. */ enum { SDL_PIXELTYPE_UNKNOWN, SDL_PIXELTYPE_INDEX1, SDL_PIXELTYPE_INDEX4, SDL_PIXELTYPE_INDEX8, SDL_PIXELTYPE_PACKED8, SDL_PIXELTYPE_PACKED16, SDL_PIXELTYPE_PACKED32, SDL_PIXELTYPE_ARRAYU8, SDL_PIXELTYPE_ARRAYU16, SDL_PIXELTYPE_ARRAYU32, SDL_PIXELTYPE_ARRAYF16, SDL_PIXELTYPE_ARRAYF32 }; /** Bitmap pixel order, high bit -> low bit. */ enum { SDL_BITMAPORDER_NONE, SDL_BITMAPORDER_4321, SDL_BITMAPORDER_1234 }; /** Packed component order, high bit -> low bit. */ enum { SDL_PACKEDORDER_NONE, SDL_PACKEDORDER_XRGB, SDL_PACKEDORDER_RGBX, SDL_PACKEDORDER_ARGB, SDL_PACKEDORDER_RGBA, SDL_PACKEDORDER_XBGR, SDL_PACKEDORDER_BGRX, SDL_PACKEDORDER_ABGR, SDL_PACKEDORDER_BGRA }; /** Array component order, low byte -> high byte. */ enum { SDL_ARRAYORDER_NONE, SDL_ARRAYORDER_RGB, SDL_ARRAYORDER_RGBA, SDL_ARRAYORDER_ARGB, SDL_ARRAYORDER_BGR, SDL_ARRAYORDER_BGRA, SDL_ARRAYORDER_ABGR }; /** Packed component layout. */ enum { SDL_PACKEDLAYOUT_NONE, SDL_PACKEDLAYOUT_332, SDL_PACKEDLAYOUT_4444, SDL_PACKEDLAYOUT_1555, SDL_PACKEDLAYOUT_5551, SDL_PACKEDLAYOUT_565, SDL_PACKEDLAYOUT_8888, SDL_PACKEDLAYOUT_2101010, SDL_PACKEDLAYOUT_1010102 }; #define SDL_DEFINE_PIXELFOURCC(A, B, C, D) SDL_FOURCC(A, B, C, D) #define SDL_DEFINE_PIXELFORMAT(type, order, layout, bits, bytes) \ ((1 << 28) | ((type) << 24) | ((order) << 20) | ((layout) << 16) | \ ((bits) << 8) | ((bytes) << 0)) #define SDL_PIXELFLAG(X) (((X) >> 28) & 0x0F) #define SDL_PIXELTYPE(X) (((X) >> 24) & 0x0F) #define SDL_PIXELORDER(X) (((X) >> 20) & 0x0F) #define SDL_PIXELLAYOUT(X) (((X) >> 16) & 0x0F) #define SDL_BITSPERPIXEL(X) (((X) >> 8) & 0xFF) #define SDL_BYTESPERPIXEL(X) \ (SDL_ISPIXELFORMAT_FOURCC(X) ? \ ((((X) == SDL_PIXELFORMAT_YUY2) || \ ((X) == SDL_PIXELFORMAT_UYVY) || \ ((X) == SDL_PIXELFORMAT_YVYU)) ? 2 : 1) : (((X) >> 0) & 0xFF)) #define SDL_ISPIXELFORMAT_INDEXED(format) \ (!SDL_ISPIXELFORMAT_FOURCC(format) && \ ((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX1) || \ (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX4) || \ (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX8))) #define SDL_ISPIXELFORMAT_ALPHA(format) \ (!SDL_ISPIXELFORMAT_FOURCC(format) && \ ((SDL_PIXELORDER(format) == SDL_PACKEDORDER_ARGB) || \ (SDL_PIXELORDER(format) == SDL_PACKEDORDER_RGBA) || \ (SDL_PIXELORDER(format) == SDL_PACKEDORDER_ABGR) || \ (SDL_PIXELORDER(format) == SDL_PACKEDORDER_BGRA))) /* The flag is set to 1 because 0x1? is not in the printable ASCII range */ #define SDL_ISPIXELFORMAT_FOURCC(format) \ ((format) && (SDL_PIXELFLAG(format) != 1)) /* Note: If you modify this list, update SDL_GetPixelFormatName() */ enum { SDL_PIXELFORMAT_UNKNOWN, SDL_PIXELFORMAT_INDEX1LSB = SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX1, SDL_BITMAPORDER_4321, 0, 1, 0), SDL_PIXELFORMAT_INDEX1MSB = SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX1, SDL_BITMAPORDER_1234, 0, 1, 0), SDL_PIXELFORMAT_INDEX4LSB = SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX4, SDL_BITMAPORDER_4321, 0, 4, 0), SDL_PIXELFORMAT_INDEX4MSB = SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX4, SDL_BITMAPORDER_1234, 0, 4, 0), SDL_PIXELFORMAT_INDEX8 = SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX8, 0, 0, 8, 1), SDL_PIXELFORMAT_RGB332 = SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED8, SDL_PACKEDORDER_XRGB, SDL_PACKEDLAYOUT_332, 8, 1), SDL_PIXELFORMAT_RGB444 = SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XRGB, SDL_PACKEDLAYOUT_4444, 12, 2), SDL_PIXELFORMAT_RGB555 = SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XRGB, SDL_PACKEDLAYOUT_1555, 15, 2), SDL_PIXELFORMAT_BGR555 = SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XBGR, SDL_PACKEDLAYOUT_1555, 15, 2), SDL_PIXELFORMAT_ARGB4444 = SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_ARGB, SDL_PACKEDLAYOUT_4444, 16, 2), SDL_PIXELFORMAT_RGBA4444 = SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_RGBA, SDL_PACKEDLAYOUT_4444, 16, 2), SDL_PIXELFORMAT_ABGR4444 = SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_ABGR, SDL_PACKEDLAYOUT_4444, 16, 2), SDL_PIXELFORMAT_BGRA4444 = SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_BGRA, SDL_PACKEDLAYOUT_4444, 16, 2), SDL_PIXELFORMAT_ARGB1555 = SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_ARGB, SDL_PACKEDLAYOUT_1555, 16, 2), SDL_PIXELFORMAT_RGBA5551 = SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_RGBA, SDL_PACKEDLAYOUT_5551, 16, 2), SDL_PIXELFORMAT_ABGR1555 = SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_ABGR, SDL_PACKEDLAYOUT_1555, 16, 2), SDL_PIXELFORMAT_BGRA5551 = SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_BGRA, SDL_PACKEDLAYOUT_5551, 16, 2), SDL_PIXELFORMAT_RGB565 = SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XRGB, SDL_PACKEDLAYOUT_565, 16, 2), SDL_PIXELFORMAT_BGR565 = SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XBGR, SDL_PACKEDLAYOUT_565, 16, 2), SDL_PIXELFORMAT_RGB24 = SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_ARRAYU8, SDL_ARRAYORDER_RGB, 0, 24, 3), SDL_PIXELFORMAT_BGR24 = SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_ARRAYU8, SDL_ARRAYORDER_BGR, 0, 24, 3), SDL_PIXELFORMAT_RGB888 = SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_XRGB, SDL_PACKEDLAYOUT_8888, 24, 4), SDL_PIXELFORMAT_RGBX8888 = SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_RGBX, SDL_PACKEDLAYOUT_8888, 24, 4), SDL_PIXELFORMAT_BGR888 = SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_XBGR, SDL_PACKEDLAYOUT_8888, 24, 4), SDL_PIXELFORMAT_BGRX8888 = SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_BGRX, SDL_PACKEDLAYOUT_8888, 24, 4), SDL_PIXELFORMAT_ARGB8888 = SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_ARGB, SDL_PACKEDLAYOUT_8888, 32, 4), SDL_PIXELFORMAT_RGBA8888 = SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_RGBA, SDL_PACKEDLAYOUT_8888, 32, 4), SDL_PIXELFORMAT_ABGR8888 = SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_ABGR, SDL_PACKEDLAYOUT_8888, 32, 4), SDL_PIXELFORMAT_BGRA8888 = SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_BGRA, SDL_PACKEDLAYOUT_8888, 32, 4), SDL_PIXELFORMAT_ARGB2101010 = SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_ARGB, SDL_PACKEDLAYOUT_2101010, 32, 4), SDL_PIXELFORMAT_YV12 = /**< Planar mode: Y + V + U (3 planes) */ SDL_DEFINE_PIXELFOURCC('Y', 'V', '1', '2'), SDL_PIXELFORMAT_IYUV = /**< Planar mode: Y + U + V (3 planes) */ SDL_DEFINE_PIXELFOURCC('I', 'Y', 'U', 'V'), SDL_PIXELFORMAT_YUY2 = /**< Packed mode: Y0+U0+Y1+V0 (1 plane) */ SDL_DEFINE_PIXELFOURCC('Y', 'U', 'Y', '2'), SDL_PIXELFORMAT_UYVY = /**< Packed mode: U0+Y0+V0+Y1 (1 plane) */ SDL_DEFINE_PIXELFOURCC('U', 'Y', 'V', 'Y'), SDL_PIXELFORMAT_YVYU = /**< Packed mode: Y0+V0+Y1+U0 (1 plane) */ SDL_DEFINE_PIXELFOURCC('Y', 'V', 'Y', 'U') }; typedef struct SDL_Color { Uint8 r; Uint8 g; Uint8 b; Uint8 a; } SDL_Color; #define SDL_Colour SDL_Color typedef struct SDL_Palette { int ncolors; SDL_Color *colors; Uint32 version; int refcount; } SDL_Palette; /** * \note Everything in the pixel format structure is read-only. */ typedef struct SDL_PixelFormat { Uint32 format; SDL_Palette *palette; Uint8 BitsPerPixel; Uint8 BytesPerPixel; Uint8 padding[2]; Uint32 Rmask; Uint32 Gmask; Uint32 Bmask; Uint32 Amask; Uint8 Rloss; Uint8 Gloss; Uint8 Bloss; Uint8 Aloss; Uint8 Rshift; Uint8 Gshift; Uint8 Bshift; Uint8 Ashift; int refcount; struct SDL_PixelFormat *next; } SDL_PixelFormat; /** * \brief Get the human readable name of a pixel format */ extern DECLSPEC const char* SDLCALL SDL_GetPixelFormatName(Uint32 format); /** * \brief Convert one of the enumerated pixel formats to a bpp and RGBA masks. * * \return SDL_TRUE, or SDL_FALSE if the conversion wasn't possible. * * \sa SDL_MasksToPixelFormatEnum() */ extern DECLSPEC SDL_bool SDLCALL SDL_PixelFormatEnumToMasks(Uint32 format, int *bpp, Uint32 * Rmask, Uint32 * Gmask, Uint32 * Bmask, Uint32 * Amask); /** * \brief Convert a bpp and RGBA masks to an enumerated pixel format. * * \return The pixel format, or ::SDL_PIXELFORMAT_UNKNOWN if the conversion * wasn't possible. * * \sa SDL_PixelFormatEnumToMasks() */ extern DECLSPEC Uint32 SDLCALL SDL_MasksToPixelFormatEnum(int bpp, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask); /** * \brief Create an SDL_PixelFormat structure from a pixel format enum. */ extern DECLSPEC SDL_PixelFormat * SDLCALL SDL_AllocFormat(Uint32 pixel_format); /** * \brief Free an SDL_PixelFormat structure. */ extern DECLSPEC void SDLCALL SDL_FreeFormat(SDL_PixelFormat *format); /** * \brief Create a palette structure with the specified number of color * entries. * * \return A new palette, or NULL if there wasn't enough memory. * * \note The palette entries are initialized to white. * * \sa SDL_FreePalette() */ extern DECLSPEC SDL_Palette *SDLCALL SDL_AllocPalette(int ncolors); /** * \brief Set the palette for a pixel format structure. */ extern DECLSPEC int SDLCALL SDL_SetPixelFormatPalette(SDL_PixelFormat * format, SDL_Palette *palette); /** * \brief Set a range of colors in a palette. * * \param palette The palette to modify. * \param colors An array of colors to copy into the palette. * \param firstcolor The index of the first palette entry to modify. * \param ncolors The number of entries to modify. * * \return 0 on success, or -1 if not all of the colors could be set. */ extern DECLSPEC int SDLCALL SDL_SetPaletteColors(SDL_Palette * palette, const SDL_Color * colors, int firstcolor, int ncolors); /** * \brief Free a palette created with SDL_AllocPalette(). * * \sa SDL_AllocPalette() */ extern DECLSPEC void SDLCALL SDL_FreePalette(SDL_Palette * palette); /** * \brief Maps an RGB triple to an opaque pixel value for a given pixel format. * * \sa SDL_MapRGBA */ extern DECLSPEC Uint32 SDLCALL SDL_MapRGB(const SDL_PixelFormat * format, Uint8 r, Uint8 g, Uint8 b); /** * \brief Maps an RGBA quadruple to a pixel value for a given pixel format. * * \sa SDL_MapRGB */ extern DECLSPEC Uint32 SDLCALL SDL_MapRGBA(const SDL_PixelFormat * format, Uint8 r, Uint8 g, Uint8 b, Uint8 a); /** * \brief Get the RGB components from a pixel of the specified format. * * \sa SDL_GetRGBA */ extern DECLSPEC void SDLCALL SDL_GetRGB(Uint32 pixel, const SDL_PixelFormat * format, Uint8 * r, Uint8 * g, Uint8 * b); /** * \brief Get the RGBA components from a pixel of the specified format. * * \sa SDL_GetRGB */ extern DECLSPEC void SDLCALL SDL_GetRGBA(Uint32 pixel, const SDL_PixelFormat * format, Uint8 * r, Uint8 * g, Uint8 * b, Uint8 * a); /** * \brief Calculate a 256 entry gamma ramp for a gamma value. */ extern DECLSPEC void SDLCALL SDL_CalculateGammaRamp(float gamma, Uint16 * ramp); /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif # 425 "/usr/local/include/SDL2/SDL_pixels.h" #if 0 /* expanded by -frewrite-includes */ #include "close_code.h" #endif /* expanded by -frewrite-includes */ # 425 "/usr/local/include/SDL2/SDL_pixels.h" # 1 "/usr/local/include/SDL2/close_code.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file close_code.h * * This file reverses the effects of begin_code.h and should be included * after you finish any function and structure declarations in your headers */ #undef _begin_code_h /* Reset structure packing at previous byte alignment */ #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__WATCOMC__) || defined(__BORLANDC__) #ifdef __BORLANDC__ #pragma nopackwarning #endif # 36 "/usr/local/include/SDL2/close_code.h" #pragma pack(pop) #endif /* Compiler needs structure packing set */ # 38 "/usr/local/include/SDL2/close_code.h" # 426 "/usr/local/include/SDL2/SDL_pixels.h" 2 #endif /* _SDL_pixels_h */ # 428 "/usr/local/include/SDL2/SDL_pixels.h" /* vi: set ts=4 sw=4 expandtab: */ # 33 "/usr/local/include/SDL2/SDL_video.h" 2 #if 0 /* expanded by -frewrite-includes */ #include "SDL_rect.h" #endif /* expanded by -frewrite-includes */ # 33 "/usr/local/include/SDL2/SDL_video.h" # 1 "/usr/local/include/SDL2/SDL_rect.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file SDL_rect.h * * Header file for SDL_rect definition and management functions. */ #ifndef _SDL_rect_h #define _SDL_rect_h #if 0 /* expanded by -frewrite-includes */ #include "SDL_stdinc.h" #endif /* expanded by -frewrite-includes */ # 31 "/usr/local/include/SDL2/SDL_rect.h" # 32 "/usr/local/include/SDL2/SDL_rect.h" #if 0 /* expanded by -frewrite-includes */ #include "SDL_error.h" #endif /* expanded by -frewrite-includes */ # 32 "/usr/local/include/SDL2/SDL_rect.h" # 33 "/usr/local/include/SDL2/SDL_rect.h" #if 0 /* expanded by -frewrite-includes */ #include "SDL_pixels.h" #endif /* expanded by -frewrite-includes */ # 33 "/usr/local/include/SDL2/SDL_rect.h" # 34 "/usr/local/include/SDL2/SDL_rect.h" #if 0 /* expanded by -frewrite-includes */ #include "SDL_rwops.h" #endif /* expanded by -frewrite-includes */ # 34 "/usr/local/include/SDL2/SDL_rect.h" # 35 "/usr/local/include/SDL2/SDL_rect.h" #if 0 /* expanded by -frewrite-includes */ #include "begin_code.h" #endif /* expanded by -frewrite-includes */ # 36 "/usr/local/include/SDL2/SDL_rect.h" # 1 "/usr/local/include/SDL2/begin_code.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file begin_code.h * * This file sets things up for C dynamic library function definitions, * static inlined functions, and structures aligned at 4-byte alignment. * If you don't like ugly C preprocessor code, don't look at this file. :) */ /* This shouldn't be nested -- included it around code only. */ #ifdef _begin_code_h #error Nested inclusion of begin_code.h #endif # 34 "/usr/local/include/SDL2/begin_code.h" #define _begin_code_h #ifndef SDL_DEPRECATED # if (__GNUC__ >= 4) /* technically, this arrived in gcc 3.1, but oh well. */ # define SDL_DEPRECATED __attribute__((deprecated)) # else # 40 "/usr/local/include/SDL2/begin_code.h" # define SDL_DEPRECATED # endif # 42 "/usr/local/include/SDL2/begin_code.h" #endif # 43 "/usr/local/include/SDL2/begin_code.h" /* Some compilers use a special export keyword */ #ifndef DECLSPEC # if defined(__WIN32__) || defined(__WINRT__) # ifdef __BORLANDC__ # ifdef BUILD_SDL # define DECLSPEC # else # 51 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllimport) # endif # 53 "/usr/local/include/SDL2/begin_code.h" # else # 54 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllexport) # endif # 56 "/usr/local/include/SDL2/begin_code.h" # else # 57 "/usr/local/include/SDL2/begin_code.h" # if defined(__GNUC__) && __GNUC__ >= 4 # define DECLSPEC __attribute__ ((visibility("default"))) # elif defined(__GNUC__) && __GNUC__ >= 2 # 60 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllexport) # else # 62 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC # endif # 64 "/usr/local/include/SDL2/begin_code.h" # endif # 65 "/usr/local/include/SDL2/begin_code.h" #endif # 66 "/usr/local/include/SDL2/begin_code.h" /* By default SDL uses the C calling convention */ #ifndef SDLCALL #if (defined(__WIN32__) || defined(__WINRT__)) && !defined(__GNUC__) #define SDLCALL __cdecl #else # 72 "/usr/local/include/SDL2/begin_code.h" #define SDLCALL #endif # 74 "/usr/local/include/SDL2/begin_code.h" #endif /* SDLCALL */ # 75 "/usr/local/include/SDL2/begin_code.h" /* Removed DECLSPEC on Symbian OS because SDL cannot be a DLL in EPOC */ #ifdef __SYMBIAN32__ #undef DECLSPEC #define DECLSPEC #endif /* __SYMBIAN32__ */ # 81 "/usr/local/include/SDL2/begin_code.h" /* Force structure packing at 4 byte alignment. This is necessary if the header is included in code which has structure packing set to an alternate value, say for loading structures from disk. The packing is reset to the previous value in close_code.h */ #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__) #ifdef _MSC_VER #pragma warning(disable: 4103) #endif # 91 "/usr/local/include/SDL2/begin_code.h" #ifdef __BORLANDC__ #pragma nopackwarning #endif # 94 "/usr/local/include/SDL2/begin_code.h" #ifdef _M_X64 /* Use 8-byte alignment on 64-bit architectures, so pointers are aligned */ #pragma pack(push,8) #else # 98 "/usr/local/include/SDL2/begin_code.h" #pragma pack(push,4) #endif # 100 "/usr/local/include/SDL2/begin_code.h" #endif /* Compiler needs structure packing set */ # 101 "/usr/local/include/SDL2/begin_code.h" #ifndef SDL_INLINE #if defined(__GNUC__) #define SDL_INLINE __inline__ #elif defined(_MSC_VER) || defined(__BORLANDC__) || \ defined(__DMC__) || defined(__SC__) || \ defined(__WATCOMC__) || defined(__LCC__) || \ defined(__DECC) # 109 "/usr/local/include/SDL2/begin_code.h" #define SDL_INLINE __inline #ifndef __inline__ #define __inline__ __inline #endif # 113 "/usr/local/include/SDL2/begin_code.h" #else # 114 "/usr/local/include/SDL2/begin_code.h" #define SDL_INLINE inline #ifndef __inline__ #define __inline__ inline #endif # 118 "/usr/local/include/SDL2/begin_code.h" #endif # 119 "/usr/local/include/SDL2/begin_code.h" #endif /* SDL_INLINE not defined */ # 120 "/usr/local/include/SDL2/begin_code.h" #ifndef SDL_FORCE_INLINE #if defined(_MSC_VER) #define SDL_FORCE_INLINE __forceinline #elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) ) # 125 "/usr/local/include/SDL2/begin_code.h" #define SDL_FORCE_INLINE __attribute__((always_inline)) static __inline__ #else # 127 "/usr/local/include/SDL2/begin_code.h" #define SDL_FORCE_INLINE static SDL_INLINE #endif # 129 "/usr/local/include/SDL2/begin_code.h" #endif /* SDL_FORCE_INLINE not defined */ # 130 "/usr/local/include/SDL2/begin_code.h" /* Apparently this is needed by several Windows compilers */ #if !defined(__MACH__) #ifndef NULL #ifdef __cplusplus #define NULL 0 #else # 137 "/usr/local/include/SDL2/begin_code.h" #define NULL ((void *)0) #endif # 139 "/usr/local/include/SDL2/begin_code.h" #endif /* NULL */ # 140 "/usr/local/include/SDL2/begin_code.h" #endif /* ! Mac OS X - breaks precompiled headers */ # 141 "/usr/local/include/SDL2/begin_code.h" # 37 "/usr/local/include/SDL2/SDL_rect.h" 2 /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif # 41 "/usr/local/include/SDL2/SDL_rect.h" /** * \brief The structure that defines a point * * \sa SDL_EnclosePoints */ typedef struct SDL_Point { int x; int y; } SDL_Point; /** * \brief A rectangle, with the origin at the upper left. * * \sa SDL_RectEmpty * \sa SDL_RectEquals * \sa SDL_HasIntersection * \sa SDL_IntersectRect * \sa SDL_UnionRect * \sa SDL_EnclosePoints */ typedef struct SDL_Rect { int x, y; int w, h; } SDL_Rect; /** * \brief Returns true if the rectangle has no area. */ SDL_FORCE_INLINE SDL_bool SDL_RectEmpty(const SDL_Rect *r) { return ((!r) || (r->w <= 0) || (r->h <= 0)) ? SDL_TRUE : SDL_FALSE; } /** * \brief Returns true if the two rectangles are equal. */ SDL_FORCE_INLINE SDL_bool SDL_RectEquals(const SDL_Rect *a, const SDL_Rect *b) { return (a && b && (a->x == b->x) && (a->y == b->y) && (a->w == b->w) && (a->h == b->h)) ? SDL_TRUE : SDL_FALSE; } /** * \brief Determine whether two rectangles intersect. * * \return SDL_TRUE if there is an intersection, SDL_FALSE otherwise. */ extern DECLSPEC SDL_bool SDLCALL SDL_HasIntersection(const SDL_Rect * A, const SDL_Rect * B); /** * \brief Calculate the intersection of two rectangles. * * \return SDL_TRUE if there is an intersection, SDL_FALSE otherwise. */ extern DECLSPEC SDL_bool SDLCALL SDL_IntersectRect(const SDL_Rect * A, const SDL_Rect * B, SDL_Rect * result); /** * \brief Calculate the union of two rectangles. */ extern DECLSPEC void SDLCALL SDL_UnionRect(const SDL_Rect * A, const SDL_Rect * B, SDL_Rect * result); /** * \brief Calculate a minimal rectangle enclosing a set of points * * \return SDL_TRUE if any points were within the clipping rect */ extern DECLSPEC SDL_bool SDLCALL SDL_EnclosePoints(const SDL_Point * points, int count, const SDL_Rect * clip, SDL_Rect * result); /** * \brief Calculate the intersection of a rectangle and line segment. * * \return SDL_TRUE if there is an intersection, SDL_FALSE otherwise. */ extern DECLSPEC SDL_bool SDLCALL SDL_IntersectRectAndLine(const SDL_Rect * rect, int *X1, int *Y1, int *X2, int *Y2); /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif # 134 "/usr/local/include/SDL2/SDL_rect.h" #if 0 /* expanded by -frewrite-includes */ #include "close_code.h" #endif /* expanded by -frewrite-includes */ # 134 "/usr/local/include/SDL2/SDL_rect.h" # 1 "/usr/local/include/SDL2/close_code.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file close_code.h * * This file reverses the effects of begin_code.h and should be included * after you finish any function and structure declarations in your headers */ #undef _begin_code_h /* Reset structure packing at previous byte alignment */ #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__WATCOMC__) || defined(__BORLANDC__) #ifdef __BORLANDC__ #pragma nopackwarning #endif # 36 "/usr/local/include/SDL2/close_code.h" #pragma pack(pop) #endif /* Compiler needs structure packing set */ # 38 "/usr/local/include/SDL2/close_code.h" # 135 "/usr/local/include/SDL2/SDL_rect.h" 2 #endif /* _SDL_rect_h */ # 137 "/usr/local/include/SDL2/SDL_rect.h" /* vi: set ts=4 sw=4 expandtab: */ # 34 "/usr/local/include/SDL2/SDL_video.h" 2 #if 0 /* expanded by -frewrite-includes */ #include "SDL_surface.h" #endif /* expanded by -frewrite-includes */ # 34 "/usr/local/include/SDL2/SDL_video.h" # 1 "/usr/local/include/SDL2/SDL_surface.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file SDL_surface.h * * Header file for ::SDL_Surface definition and management functions. */ #ifndef _SDL_surface_h #define _SDL_surface_h #if 0 /* expanded by -frewrite-includes */ #include "SDL_stdinc.h" #endif /* expanded by -frewrite-includes */ # 31 "/usr/local/include/SDL2/SDL_surface.h" # 32 "/usr/local/include/SDL2/SDL_surface.h" #if 0 /* expanded by -frewrite-includes */ #include "SDL_pixels.h" #endif /* expanded by -frewrite-includes */ # 32 "/usr/local/include/SDL2/SDL_surface.h" # 33 "/usr/local/include/SDL2/SDL_surface.h" #if 0 /* expanded by -frewrite-includes */ #include "SDL_rect.h" #endif /* expanded by -frewrite-includes */ # 33 "/usr/local/include/SDL2/SDL_surface.h" # 34 "/usr/local/include/SDL2/SDL_surface.h" #if 0 /* expanded by -frewrite-includes */ #include "SDL_blendmode.h" #endif /* expanded by -frewrite-includes */ # 34 "/usr/local/include/SDL2/SDL_surface.h" # 1 "/usr/local/include/SDL2/SDL_blendmode.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file SDL_blendmode.h * * Header file declaring the SDL_BlendMode enumeration */ #ifndef _SDL_blendmode_h #define _SDL_blendmode_h #if 0 /* expanded by -frewrite-includes */ #include "begin_code.h" #endif /* expanded by -frewrite-includes */ # 31 "/usr/local/include/SDL2/SDL_blendmode.h" # 1 "/usr/local/include/SDL2/begin_code.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file begin_code.h * * This file sets things up for C dynamic library function definitions, * static inlined functions, and structures aligned at 4-byte alignment. * If you don't like ugly C preprocessor code, don't look at this file. :) */ /* This shouldn't be nested -- included it around code only. */ #ifdef _begin_code_h #error Nested inclusion of begin_code.h #endif # 34 "/usr/local/include/SDL2/begin_code.h" #define _begin_code_h #ifndef SDL_DEPRECATED # if (__GNUC__ >= 4) /* technically, this arrived in gcc 3.1, but oh well. */ # define SDL_DEPRECATED __attribute__((deprecated)) # else # 40 "/usr/local/include/SDL2/begin_code.h" # define SDL_DEPRECATED # endif # 42 "/usr/local/include/SDL2/begin_code.h" #endif # 43 "/usr/local/include/SDL2/begin_code.h" /* Some compilers use a special export keyword */ #ifndef DECLSPEC # if defined(__WIN32__) || defined(__WINRT__) # ifdef __BORLANDC__ # ifdef BUILD_SDL # define DECLSPEC # else # 51 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllimport) # endif # 53 "/usr/local/include/SDL2/begin_code.h" # else # 54 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllexport) # endif # 56 "/usr/local/include/SDL2/begin_code.h" # else # 57 "/usr/local/include/SDL2/begin_code.h" # if defined(__GNUC__) && __GNUC__ >= 4 # define DECLSPEC __attribute__ ((visibility("default"))) # elif defined(__GNUC__) && __GNUC__ >= 2 # 60 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllexport) # else # 62 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC # endif # 64 "/usr/local/include/SDL2/begin_code.h" # endif # 65 "/usr/local/include/SDL2/begin_code.h" #endif # 66 "/usr/local/include/SDL2/begin_code.h" /* By default SDL uses the C calling convention */ #ifndef SDLCALL #if (defined(__WIN32__) || defined(__WINRT__)) && !defined(__GNUC__) #define SDLCALL __cdecl #else # 72 "/usr/local/include/SDL2/begin_code.h" #define SDLCALL #endif # 74 "/usr/local/include/SDL2/begin_code.h" #endif /* SDLCALL */ # 75 "/usr/local/include/SDL2/begin_code.h" /* Removed DECLSPEC on Symbian OS because SDL cannot be a DLL in EPOC */ #ifdef __SYMBIAN32__ #undef DECLSPEC #define DECLSPEC #endif /* __SYMBIAN32__ */ # 81 "/usr/local/include/SDL2/begin_code.h" /* Force structure packing at 4 byte alignment. This is necessary if the header is included in code which has structure packing set to an alternate value, say for loading structures from disk. The packing is reset to the previous value in close_code.h */ #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__) #ifdef _MSC_VER #pragma warning(disable: 4103) #endif # 91 "/usr/local/include/SDL2/begin_code.h" #ifdef __BORLANDC__ #pragma nopackwarning #endif # 94 "/usr/local/include/SDL2/begin_code.h" #ifdef _M_X64 /* Use 8-byte alignment on 64-bit architectures, so pointers are aligned */ #pragma pack(push,8) #else # 98 "/usr/local/include/SDL2/begin_code.h" #pragma pack(push,4) #endif # 100 "/usr/local/include/SDL2/begin_code.h" #endif /* Compiler needs structure packing set */ # 101 "/usr/local/include/SDL2/begin_code.h" #ifndef SDL_INLINE #if defined(__GNUC__) #define SDL_INLINE __inline__ #elif defined(_MSC_VER) || defined(__BORLANDC__) || \ defined(__DMC__) || defined(__SC__) || \ defined(__WATCOMC__) || defined(__LCC__) || \ defined(__DECC) # 109 "/usr/local/include/SDL2/begin_code.h" #define SDL_INLINE __inline #ifndef __inline__ #define __inline__ __inline #endif # 113 "/usr/local/include/SDL2/begin_code.h" #else # 114 "/usr/local/include/SDL2/begin_code.h" #define SDL_INLINE inline #ifndef __inline__ #define __inline__ inline #endif # 118 "/usr/local/include/SDL2/begin_code.h" #endif # 119 "/usr/local/include/SDL2/begin_code.h" #endif /* SDL_INLINE not defined */ # 120 "/usr/local/include/SDL2/begin_code.h" #ifndef SDL_FORCE_INLINE #if defined(_MSC_VER) #define SDL_FORCE_INLINE __forceinline #elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) ) # 125 "/usr/local/include/SDL2/begin_code.h" #define SDL_FORCE_INLINE __attribute__((always_inline)) static __inline__ #else # 127 "/usr/local/include/SDL2/begin_code.h" #define SDL_FORCE_INLINE static SDL_INLINE #endif # 129 "/usr/local/include/SDL2/begin_code.h" #endif /* SDL_FORCE_INLINE not defined */ # 130 "/usr/local/include/SDL2/begin_code.h" /* Apparently this is needed by several Windows compilers */ #if !defined(__MACH__) #ifndef NULL #ifdef __cplusplus #define NULL 0 #else # 137 "/usr/local/include/SDL2/begin_code.h" #define NULL ((void *)0) #endif # 139 "/usr/local/include/SDL2/begin_code.h" #endif /* NULL */ # 140 "/usr/local/include/SDL2/begin_code.h" #endif /* ! Mac OS X - breaks precompiled headers */ # 141 "/usr/local/include/SDL2/begin_code.h" # 32 "/usr/local/include/SDL2/SDL_blendmode.h" 2 /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif # 36 "/usr/local/include/SDL2/SDL_blendmode.h" /** * \brief The blend mode used in SDL_RenderCopy() and drawing operations. */ typedef enum { SDL_BLENDMODE_NONE = 0x00000000, /**< no blending dstRGBA = srcRGBA */ SDL_BLENDMODE_BLEND = 0x00000001, /**< alpha blending dstRGB = (srcRGB * srcA) + (dstRGB * (1-srcA)) dstA = srcA + (dstA * (1-srcA)) */ SDL_BLENDMODE_ADD = 0x00000002, /**< additive blending dstRGB = (srcRGB * srcA) + dstRGB dstA = dstA */ SDL_BLENDMODE_MOD = 0x00000004 /**< color modulate dstRGB = srcRGB * dstRGB dstA = dstA */ } SDL_BlendMode; /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif # 59 "/usr/local/include/SDL2/SDL_blendmode.h" #if 0 /* expanded by -frewrite-includes */ #include "close_code.h" #endif /* expanded by -frewrite-includes */ # 59 "/usr/local/include/SDL2/SDL_blendmode.h" # 1 "/usr/local/include/SDL2/close_code.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file close_code.h * * This file reverses the effects of begin_code.h and should be included * after you finish any function and structure declarations in your headers */ #undef _begin_code_h /* Reset structure packing at previous byte alignment */ #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__WATCOMC__) || defined(__BORLANDC__) #ifdef __BORLANDC__ #pragma nopackwarning #endif # 36 "/usr/local/include/SDL2/close_code.h" #pragma pack(pop) #endif /* Compiler needs structure packing set */ # 38 "/usr/local/include/SDL2/close_code.h" # 60 "/usr/local/include/SDL2/SDL_blendmode.h" 2 #endif /* _SDL_video_h */ # 62 "/usr/local/include/SDL2/SDL_blendmode.h" /* vi: set ts=4 sw=4 expandtab: */ # 35 "/usr/local/include/SDL2/SDL_surface.h" 2 #if 0 /* expanded by -frewrite-includes */ #include "SDL_rwops.h" #endif /* expanded by -frewrite-includes */ # 35 "/usr/local/include/SDL2/SDL_surface.h" # 36 "/usr/local/include/SDL2/SDL_surface.h" #if 0 /* expanded by -frewrite-includes */ #include "begin_code.h" #endif /* expanded by -frewrite-includes */ # 37 "/usr/local/include/SDL2/SDL_surface.h" # 1 "/usr/local/include/SDL2/begin_code.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file begin_code.h * * This file sets things up for C dynamic library function definitions, * static inlined functions, and structures aligned at 4-byte alignment. * If you don't like ugly C preprocessor code, don't look at this file. :) */ /* This shouldn't be nested -- included it around code only. */ #ifdef _begin_code_h #error Nested inclusion of begin_code.h #endif # 34 "/usr/local/include/SDL2/begin_code.h" #define _begin_code_h #ifndef SDL_DEPRECATED # if (__GNUC__ >= 4) /* technically, this arrived in gcc 3.1, but oh well. */ # define SDL_DEPRECATED __attribute__((deprecated)) # else # 40 "/usr/local/include/SDL2/begin_code.h" # define SDL_DEPRECATED # endif # 42 "/usr/local/include/SDL2/begin_code.h" #endif # 43 "/usr/local/include/SDL2/begin_code.h" /* Some compilers use a special export keyword */ #ifndef DECLSPEC # if defined(__WIN32__) || defined(__WINRT__) # ifdef __BORLANDC__ # ifdef BUILD_SDL # define DECLSPEC # else # 51 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllimport) # endif # 53 "/usr/local/include/SDL2/begin_code.h" # else # 54 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllexport) # endif # 56 "/usr/local/include/SDL2/begin_code.h" # else # 57 "/usr/local/include/SDL2/begin_code.h" # if defined(__GNUC__) && __GNUC__ >= 4 # define DECLSPEC __attribute__ ((visibility("default"))) # elif defined(__GNUC__) && __GNUC__ >= 2 # 60 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllexport) # else # 62 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC # endif # 64 "/usr/local/include/SDL2/begin_code.h" # endif # 65 "/usr/local/include/SDL2/begin_code.h" #endif # 66 "/usr/local/include/SDL2/begin_code.h" /* By default SDL uses the C calling convention */ #ifndef SDLCALL #if (defined(__WIN32__) || defined(__WINRT__)) && !defined(__GNUC__) #define SDLCALL __cdecl #else # 72 "/usr/local/include/SDL2/begin_code.h" #define SDLCALL #endif # 74 "/usr/local/include/SDL2/begin_code.h" #endif /* SDLCALL */ # 75 "/usr/local/include/SDL2/begin_code.h" /* Removed DECLSPEC on Symbian OS because SDL cannot be a DLL in EPOC */ #ifdef __SYMBIAN32__ #undef DECLSPEC #define DECLSPEC #endif /* __SYMBIAN32__ */ # 81 "/usr/local/include/SDL2/begin_code.h" /* Force structure packing at 4 byte alignment. This is necessary if the header is included in code which has structure packing set to an alternate value, say for loading structures from disk. The packing is reset to the previous value in close_code.h */ #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__) #ifdef _MSC_VER #pragma warning(disable: 4103) #endif # 91 "/usr/local/include/SDL2/begin_code.h" #ifdef __BORLANDC__ #pragma nopackwarning #endif # 94 "/usr/local/include/SDL2/begin_code.h" #ifdef _M_X64 /* Use 8-byte alignment on 64-bit architectures, so pointers are aligned */ #pragma pack(push,8) #else # 98 "/usr/local/include/SDL2/begin_code.h" #pragma pack(push,4) #endif # 100 "/usr/local/include/SDL2/begin_code.h" #endif /* Compiler needs structure packing set */ # 101 "/usr/local/include/SDL2/begin_code.h" #ifndef SDL_INLINE #if defined(__GNUC__) #define SDL_INLINE __inline__ #elif defined(_MSC_VER) || defined(__BORLANDC__) || \ defined(__DMC__) || defined(__SC__) || \ defined(__WATCOMC__) || defined(__LCC__) || \ defined(__DECC) # 109 "/usr/local/include/SDL2/begin_code.h" #define SDL_INLINE __inline #ifndef __inline__ #define __inline__ __inline #endif # 113 "/usr/local/include/SDL2/begin_code.h" #else # 114 "/usr/local/include/SDL2/begin_code.h" #define SDL_INLINE inline #ifndef __inline__ #define __inline__ inline #endif # 118 "/usr/local/include/SDL2/begin_code.h" #endif # 119 "/usr/local/include/SDL2/begin_code.h" #endif /* SDL_INLINE not defined */ # 120 "/usr/local/include/SDL2/begin_code.h" #ifndef SDL_FORCE_INLINE #if defined(_MSC_VER) #define SDL_FORCE_INLINE __forceinline #elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) ) # 125 "/usr/local/include/SDL2/begin_code.h" #define SDL_FORCE_INLINE __attribute__((always_inline)) static __inline__ #else # 127 "/usr/local/include/SDL2/begin_code.h" #define SDL_FORCE_INLINE static SDL_INLINE #endif # 129 "/usr/local/include/SDL2/begin_code.h" #endif /* SDL_FORCE_INLINE not defined */ # 130 "/usr/local/include/SDL2/begin_code.h" /* Apparently this is needed by several Windows compilers */ #if !defined(__MACH__) #ifndef NULL #ifdef __cplusplus #define NULL 0 #else # 137 "/usr/local/include/SDL2/begin_code.h" #define NULL ((void *)0) #endif # 139 "/usr/local/include/SDL2/begin_code.h" #endif /* NULL */ # 140 "/usr/local/include/SDL2/begin_code.h" #endif /* ! Mac OS X - breaks precompiled headers */ # 141 "/usr/local/include/SDL2/begin_code.h" # 38 "/usr/local/include/SDL2/SDL_surface.h" 2 /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif # 42 "/usr/local/include/SDL2/SDL_surface.h" /** * \name Surface flags * * These are the currently supported flags for the ::SDL_Surface. * * \internal * Used internally (read-only). */ /* @{ */ #define SDL_SWSURFACE 0 /**< Just here for compatibility */ #define SDL_PREALLOC 0x00000001 /**< Surface uses preallocated memory */ #define SDL_RLEACCEL 0x00000002 /**< Surface is RLE encoded */ #define SDL_DONTFREE 0x00000004 /**< Surface is referenced internally */ /* @} *//* Surface flags */ /** * Evaluates to true if the surface needs to be locked before access. */ #define SDL_MUSTLOCK(S) (((S)->flags & SDL_RLEACCEL) != 0) /** * \brief A collection of pixels used in software blitting. * * \note This structure should be treated as read-only, except for \c pixels, * which, if not NULL, contains the raw pixel data for the surface. */ typedef struct SDL_Surface { Uint32 flags; /**< Read-only */ SDL_PixelFormat *format; /**< Read-only */ int w, h; /**< Read-only */ int pitch; /**< Read-only */ void *pixels; /**< Read-write */ /** Application data associated with the surface */ void *userdata; /**< Read-write */ /** information needed for surfaces requiring locks */ int locked; /**< Read-only */ void *lock_data; /**< Read-only */ /** clipping information */ SDL_Rect clip_rect; /**< Read-only */ /** info for fast blit mapping to other surfaces */ struct SDL_BlitMap *map; /**< Private */ /** Reference count -- used when freeing surface */ int refcount; /**< Read-mostly */ } SDL_Surface; /** * \brief The type of function used for surface blitting functions. */ typedef int (*SDL_blit) (struct SDL_Surface * src, SDL_Rect * srcrect, struct SDL_Surface * dst, SDL_Rect * dstrect); /** * Allocate and free an RGB surface. * * If the depth is 4 or 8 bits, an empty palette is allocated for the surface. * If the depth is greater than 8 bits, the pixel format is set using the * flags '[RGB]mask'. * * If the function runs out of memory, it will return NULL. * * \param flags The \c flags are obsolete and should be set to 0. * \param width The width in pixels of the surface to create. * \param height The height in pixels of the surface to create. * \param depth The depth in bits of the surface to create. * \param Rmask The red mask of the surface to create. * \param Gmask The green mask of the surface to create. * \param Bmask The blue mask of the surface to create. * \param Amask The alpha mask of the surface to create. */ extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurface (Uint32 flags, int width, int height, int depth, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask); extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurfaceFrom(void *pixels, int width, int height, int depth, int pitch, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask); extern DECLSPEC void SDLCALL SDL_FreeSurface(SDL_Surface * surface); /** * \brief Set the palette used by a surface. * * \return 0, or -1 if the surface format doesn't use a palette. * * \note A single palette can be shared with many surfaces. */ extern DECLSPEC int SDLCALL SDL_SetSurfacePalette(SDL_Surface * surface, SDL_Palette * palette); /** * \brief Sets up a surface for directly accessing the pixels. * * Between calls to SDL_LockSurface() / SDL_UnlockSurface(), you can write * to and read from \c surface->pixels, using the pixel format stored in * \c surface->format. Once you are done accessing the surface, you should * use SDL_UnlockSurface() to release it. * * Not all surfaces require locking. If SDL_MUSTLOCK(surface) evaluates * to 0, then you can read and write to the surface at any time, and the * pixel format of the surface will not change. * * No operating system or library calls should be made between lock/unlock * pairs, as critical system locks may be held during this time. * * SDL_LockSurface() returns 0, or -1 if the surface couldn't be locked. * * \sa SDL_UnlockSurface() */ extern DECLSPEC int SDLCALL SDL_LockSurface(SDL_Surface * surface); /** \sa SDL_LockSurface() */ extern DECLSPEC void SDLCALL SDL_UnlockSurface(SDL_Surface * surface); /** * Load a surface from a seekable SDL data stream (memory or file). * * If \c freesrc is non-zero, the stream will be closed after being read. * * The new surface should be freed with SDL_FreeSurface(). * * \return the new surface, or NULL if there was an error. */ extern DECLSPEC SDL_Surface *SDLCALL SDL_LoadBMP_RW(SDL_RWops * src, int freesrc); /** * Load a surface from a file. * * Convenience macro. */ #define SDL_LoadBMP(file) SDL_LoadBMP_RW(SDL_RWFromFile(file, "rb"), 1) /** * Save a surface to a seekable SDL data stream (memory or file). * * If \c freedst is non-zero, the stream will be closed after being written. * * \return 0 if successful or -1 if there was an error. */ extern DECLSPEC int SDLCALL SDL_SaveBMP_RW (SDL_Surface * surface, SDL_RWops * dst, int freedst); /** * Save a surface to a file. * * Convenience macro. */ #define SDL_SaveBMP(surface, file) \ SDL_SaveBMP_RW(surface, SDL_RWFromFile(file, "wb"), 1) /** * \brief Sets the RLE acceleration hint for a surface. * * \return 0 on success, or -1 if the surface is not valid * * \note If RLE is enabled, colorkey and alpha blending blits are much faster, * but the surface must be locked before directly accessing the pixels. */ extern DECLSPEC int SDLCALL SDL_SetSurfaceRLE(SDL_Surface * surface, int flag); /** * \brief Sets the color key (transparent pixel) in a blittable surface. * * \param surface The surface to update * \param flag Non-zero to enable colorkey and 0 to disable colorkey * \param key The transparent pixel in the native surface format * * \return 0 on success, or -1 if the surface is not valid * * You can pass SDL_RLEACCEL to enable RLE accelerated blits. */ extern DECLSPEC int SDLCALL SDL_SetColorKey(SDL_Surface * surface, int flag, Uint32 key); /** * \brief Gets the color key (transparent pixel) in a blittable surface. * * \param surface The surface to update * \param key A pointer filled in with the transparent pixel in the native * surface format * * \return 0 on success, or -1 if the surface is not valid or colorkey is not * enabled. */ extern DECLSPEC int SDLCALL SDL_GetColorKey(SDL_Surface * surface, Uint32 * key); /** * \brief Set an additional color value used in blit operations. * * \param surface The surface to update. * \param r The red color value multiplied into blit operations. * \param g The green color value multiplied into blit operations. * \param b The blue color value multiplied into blit operations. * * \return 0 on success, or -1 if the surface is not valid. * * \sa SDL_GetSurfaceColorMod() */ extern DECLSPEC int SDLCALL SDL_SetSurfaceColorMod(SDL_Surface * surface, Uint8 r, Uint8 g, Uint8 b); /** * \brief Get the additional color value used in blit operations. * * \param surface The surface to query. * \param r A pointer filled in with the current red color value. * \param g A pointer filled in with the current green color value. * \param b A pointer filled in with the current blue color value. * * \return 0 on success, or -1 if the surface is not valid. * * \sa SDL_SetSurfaceColorMod() */ extern DECLSPEC int SDLCALL SDL_GetSurfaceColorMod(SDL_Surface * surface, Uint8 * r, Uint8 * g, Uint8 * b); /** * \brief Set an additional alpha value used in blit operations. * * \param surface The surface to update. * \param alpha The alpha value multiplied into blit operations. * * \return 0 on success, or -1 if the surface is not valid. * * \sa SDL_GetSurfaceAlphaMod() */ extern DECLSPEC int SDLCALL SDL_SetSurfaceAlphaMod(SDL_Surface * surface, Uint8 alpha); /** * \brief Get the additional alpha value used in blit operations. * * \param surface The surface to query. * \param alpha A pointer filled in with the current alpha value. * * \return 0 on success, or -1 if the surface is not valid. * * \sa SDL_SetSurfaceAlphaMod() */ extern DECLSPEC int SDLCALL SDL_GetSurfaceAlphaMod(SDL_Surface * surface, Uint8 * alpha); /** * \brief Set the blend mode used for blit operations. * * \param surface The surface to update. * \param blendMode ::SDL_BlendMode to use for blit blending. * * \return 0 on success, or -1 if the parameters are not valid. * * \sa SDL_GetSurfaceBlendMode() */ extern DECLSPEC int SDLCALL SDL_SetSurfaceBlendMode(SDL_Surface * surface, SDL_BlendMode blendMode); /** * \brief Get the blend mode used for blit operations. * * \param surface The surface to query. * \param blendMode A pointer filled in with the current blend mode. * * \return 0 on success, or -1 if the surface is not valid. * * \sa SDL_SetSurfaceBlendMode() */ extern DECLSPEC int SDLCALL SDL_GetSurfaceBlendMode(SDL_Surface * surface, SDL_BlendMode *blendMode); /** * Sets the clipping rectangle for the destination surface in a blit. * * If the clip rectangle is NULL, clipping will be disabled. * * If the clip rectangle doesn't intersect the surface, the function will * return SDL_FALSE and blits will be completely clipped. Otherwise the * function returns SDL_TRUE and blits to the surface will be clipped to * the intersection of the surface area and the clipping rectangle. * * Note that blits are automatically clipped to the edges of the source * and destination surfaces. */ extern DECLSPEC SDL_bool SDLCALL SDL_SetClipRect(SDL_Surface * surface, const SDL_Rect * rect); /** * Gets the clipping rectangle for the destination surface in a blit. * * \c rect must be a pointer to a valid rectangle which will be filled * with the correct values. */ extern DECLSPEC void SDLCALL SDL_GetClipRect(SDL_Surface * surface, SDL_Rect * rect); /** * Creates a new surface of the specified format, and then copies and maps * the given surface to it so the blit of the converted surface will be as * fast as possible. If this function fails, it returns NULL. * * The \c flags parameter is passed to SDL_CreateRGBSurface() and has those * semantics. You can also pass ::SDL_RLEACCEL in the flags parameter and * SDL will try to RLE accelerate colorkey and alpha blits in the resulting * surface. */ extern DECLSPEC SDL_Surface *SDLCALL SDL_ConvertSurface (SDL_Surface * src, const SDL_PixelFormat * fmt, Uint32 flags); extern DECLSPEC SDL_Surface *SDLCALL SDL_ConvertSurfaceFormat (SDL_Surface * src, Uint32 pixel_format, Uint32 flags); /** * \brief Copy a block of pixels of one format to another format * * \return 0 on success, or -1 if there was an error */ extern DECLSPEC int SDLCALL SDL_ConvertPixels(int width, int height, Uint32 src_format, const void * src, int src_pitch, Uint32 dst_format, void * dst, int dst_pitch); /** * Performs a fast fill of the given rectangle with \c color. * * If \c rect is NULL, the whole surface will be filled with \c color. * * The color should be a pixel of the format used by the surface, and * can be generated by the SDL_MapRGB() function. * * \return 0 on success, or -1 on error. */ extern DECLSPEC int SDLCALL SDL_FillRect (SDL_Surface * dst, const SDL_Rect * rect, Uint32 color); extern DECLSPEC int SDLCALL SDL_FillRects (SDL_Surface * dst, const SDL_Rect * rects, int count, Uint32 color); /** * Performs a fast blit from the source surface to the destination surface. * * This assumes that the source and destination rectangles are * the same size. If either \c srcrect or \c dstrect are NULL, the entire * surface (\c src or \c dst) is copied. The final blit rectangles are saved * in \c srcrect and \c dstrect after all clipping is performed. * * \return If the blit is successful, it returns 0, otherwise it returns -1. * * The blit function should not be called on a locked surface. * * The blit semantics for surfaces with and without blending and colorkey * are defined as follows: * \verbatim RGBA->RGB: Source surface blend mode set to SDL_BLENDMODE_BLEND: alpha-blend (using the source alpha-channel and per-surface alpha) SDL_SRCCOLORKEY ignored. Source surface blend mode set to SDL_BLENDMODE_NONE: copy RGB. if SDL_SRCCOLORKEY set, only copy the pixels matching the RGB values of the source color key, ignoring alpha in the comparison. RGB->RGBA: Source surface blend mode set to SDL_BLENDMODE_BLEND: alpha-blend (using the source per-surface alpha) Source surface blend mode set to SDL_BLENDMODE_NONE: copy RGB, set destination alpha to source per-surface alpha value. both: if SDL_SRCCOLORKEY set, only copy the pixels matching the source color key. RGBA->RGBA: Source surface blend mode set to SDL_BLENDMODE_BLEND: alpha-blend (using the source alpha-channel and per-surface alpha) SDL_SRCCOLORKEY ignored. Source surface blend mode set to SDL_BLENDMODE_NONE: copy all of RGBA to the destination. if SDL_SRCCOLORKEY set, only copy the pixels matching the RGB values of the source color key, ignoring alpha in the comparison. RGB->RGB: Source surface blend mode set to SDL_BLENDMODE_BLEND: alpha-blend (using the source per-surface alpha) Source surface blend mode set to SDL_BLENDMODE_NONE: copy RGB. both: if SDL_SRCCOLORKEY set, only copy the pixels matching the source color key. \endverbatim * * You should call SDL_BlitSurface() unless you know exactly how SDL * blitting works internally and how to use the other blit functions. */ #define SDL_BlitSurface SDL_UpperBlit /** * This is the public blit function, SDL_BlitSurface(), and it performs * rectangle validation and clipping before passing it to SDL_LowerBlit() */ extern DECLSPEC int SDLCALL SDL_UpperBlit (SDL_Surface * src, const SDL_Rect * srcrect, SDL_Surface * dst, SDL_Rect * dstrect); /** * This is a semi-private blit function and it performs low-level surface * blitting only. */ extern DECLSPEC int SDLCALL SDL_LowerBlit (SDL_Surface * src, SDL_Rect * srcrect, SDL_Surface * dst, SDL_Rect * dstrect); /** * \brief Perform a fast, low quality, stretch blit between two surfaces of the * same pixel format. * * \note This function uses a static buffer, and is not thread-safe. */ extern DECLSPEC int SDLCALL SDL_SoftStretch(SDL_Surface * src, const SDL_Rect * srcrect, SDL_Surface * dst, const SDL_Rect * dstrect); #define SDL_BlitScaled SDL_UpperBlitScaled /** * This is the public scaled blit function, SDL_BlitScaled(), and it performs * rectangle validation and clipping before passing it to SDL_LowerBlitScaled() */ extern DECLSPEC int SDLCALL SDL_UpperBlitScaled (SDL_Surface * src, const SDL_Rect * srcrect, SDL_Surface * dst, SDL_Rect * dstrect); /** * This is a semi-private blit function and it performs low-level surface * scaled blitting only. */ extern DECLSPEC int SDLCALL SDL_LowerBlitScaled (SDL_Surface * src, SDL_Rect * srcrect, SDL_Surface * dst, SDL_Rect * dstrect); /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif # 499 "/usr/local/include/SDL2/SDL_surface.h" #if 0 /* expanded by -frewrite-includes */ #include "close_code.h" #endif /* expanded by -frewrite-includes */ # 499 "/usr/local/include/SDL2/SDL_surface.h" # 1 "/usr/local/include/SDL2/close_code.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file close_code.h * * This file reverses the effects of begin_code.h and should be included * after you finish any function and structure declarations in your headers */ #undef _begin_code_h /* Reset structure packing at previous byte alignment */ #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__WATCOMC__) || defined(__BORLANDC__) #ifdef __BORLANDC__ #pragma nopackwarning #endif # 36 "/usr/local/include/SDL2/close_code.h" #pragma pack(pop) #endif /* Compiler needs structure packing set */ # 38 "/usr/local/include/SDL2/close_code.h" # 500 "/usr/local/include/SDL2/SDL_surface.h" 2 #endif /* _SDL_surface_h */ # 502 "/usr/local/include/SDL2/SDL_surface.h" /* vi: set ts=4 sw=4 expandtab: */ # 35 "/usr/local/include/SDL2/SDL_video.h" 2 #if 0 /* expanded by -frewrite-includes */ #include "begin_code.h" #endif /* expanded by -frewrite-includes */ # 36 "/usr/local/include/SDL2/SDL_video.h" # 1 "/usr/local/include/SDL2/begin_code.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file begin_code.h * * This file sets things up for C dynamic library function definitions, * static inlined functions, and structures aligned at 4-byte alignment. * If you don't like ugly C preprocessor code, don't look at this file. :) */ /* This shouldn't be nested -- included it around code only. */ #ifdef _begin_code_h #error Nested inclusion of begin_code.h #endif # 34 "/usr/local/include/SDL2/begin_code.h" #define _begin_code_h #ifndef SDL_DEPRECATED # if (__GNUC__ >= 4) /* technically, this arrived in gcc 3.1, but oh well. */ # define SDL_DEPRECATED __attribute__((deprecated)) # else # 40 "/usr/local/include/SDL2/begin_code.h" # define SDL_DEPRECATED # endif # 42 "/usr/local/include/SDL2/begin_code.h" #endif # 43 "/usr/local/include/SDL2/begin_code.h" /* Some compilers use a special export keyword */ #ifndef DECLSPEC # if defined(__WIN32__) || defined(__WINRT__) # ifdef __BORLANDC__ # ifdef BUILD_SDL # define DECLSPEC # else # 51 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllimport) # endif # 53 "/usr/local/include/SDL2/begin_code.h" # else # 54 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllexport) # endif # 56 "/usr/local/include/SDL2/begin_code.h" # else # 57 "/usr/local/include/SDL2/begin_code.h" # if defined(__GNUC__) && __GNUC__ >= 4 # define DECLSPEC __attribute__ ((visibility("default"))) # elif defined(__GNUC__) && __GNUC__ >= 2 # 60 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllexport) # else # 62 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC # endif # 64 "/usr/local/include/SDL2/begin_code.h" # endif # 65 "/usr/local/include/SDL2/begin_code.h" #endif # 66 "/usr/local/include/SDL2/begin_code.h" /* By default SDL uses the C calling convention */ #ifndef SDLCALL #if (defined(__WIN32__) || defined(__WINRT__)) && !defined(__GNUC__) #define SDLCALL __cdecl #else # 72 "/usr/local/include/SDL2/begin_code.h" #define SDLCALL #endif # 74 "/usr/local/include/SDL2/begin_code.h" #endif /* SDLCALL */ # 75 "/usr/local/include/SDL2/begin_code.h" /* Removed DECLSPEC on Symbian OS because SDL cannot be a DLL in EPOC */ #ifdef __SYMBIAN32__ #undef DECLSPEC #define DECLSPEC #endif /* __SYMBIAN32__ */ # 81 "/usr/local/include/SDL2/begin_code.h" /* Force structure packing at 4 byte alignment. This is necessary if the header is included in code which has structure packing set to an alternate value, say for loading structures from disk. The packing is reset to the previous value in close_code.h */ #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__) #ifdef _MSC_VER #pragma warning(disable: 4103) #endif # 91 "/usr/local/include/SDL2/begin_code.h" #ifdef __BORLANDC__ #pragma nopackwarning #endif # 94 "/usr/local/include/SDL2/begin_code.h" #ifdef _M_X64 /* Use 8-byte alignment on 64-bit architectures, so pointers are aligned */ #pragma pack(push,8) #else # 98 "/usr/local/include/SDL2/begin_code.h" #pragma pack(push,4) #endif # 100 "/usr/local/include/SDL2/begin_code.h" #endif /* Compiler needs structure packing set */ # 101 "/usr/local/include/SDL2/begin_code.h" #ifndef SDL_INLINE #if defined(__GNUC__) #define SDL_INLINE __inline__ #elif defined(_MSC_VER) || defined(__BORLANDC__) || \ defined(__DMC__) || defined(__SC__) || \ defined(__WATCOMC__) || defined(__LCC__) || \ defined(__DECC) # 109 "/usr/local/include/SDL2/begin_code.h" #define SDL_INLINE __inline #ifndef __inline__ #define __inline__ __inline #endif # 113 "/usr/local/include/SDL2/begin_code.h" #else # 114 "/usr/local/include/SDL2/begin_code.h" #define SDL_INLINE inline #ifndef __inline__ #define __inline__ inline #endif # 118 "/usr/local/include/SDL2/begin_code.h" #endif # 119 "/usr/local/include/SDL2/begin_code.h" #endif /* SDL_INLINE not defined */ # 120 "/usr/local/include/SDL2/begin_code.h" #ifndef SDL_FORCE_INLINE #if defined(_MSC_VER) #define SDL_FORCE_INLINE __forceinline #elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) ) # 125 "/usr/local/include/SDL2/begin_code.h" #define SDL_FORCE_INLINE __attribute__((always_inline)) static __inline__ #else # 127 "/usr/local/include/SDL2/begin_code.h" #define SDL_FORCE_INLINE static SDL_INLINE #endif # 129 "/usr/local/include/SDL2/begin_code.h" #endif /* SDL_FORCE_INLINE not defined */ # 130 "/usr/local/include/SDL2/begin_code.h" /* Apparently this is needed by several Windows compilers */ #if !defined(__MACH__) #ifndef NULL #ifdef __cplusplus #define NULL 0 #else # 137 "/usr/local/include/SDL2/begin_code.h" #define NULL ((void *)0) #endif # 139 "/usr/local/include/SDL2/begin_code.h" #endif /* NULL */ # 140 "/usr/local/include/SDL2/begin_code.h" #endif /* ! Mac OS X - breaks precompiled headers */ # 141 "/usr/local/include/SDL2/begin_code.h" # 37 "/usr/local/include/SDL2/SDL_video.h" 2 /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif # 41 "/usr/local/include/SDL2/SDL_video.h" /** * \brief The structure that defines a display mode * * \sa SDL_GetNumDisplayModes() * \sa SDL_GetDisplayMode() * \sa SDL_GetDesktopDisplayMode() * \sa SDL_GetCurrentDisplayMode() * \sa SDL_GetClosestDisplayMode() * \sa SDL_SetWindowDisplayMode() * \sa SDL_GetWindowDisplayMode() */ typedef struct { Uint32 format; /**< pixel format */ int w; /**< width */ int h; /**< height */ int refresh_rate; /**< refresh rate (or zero for unspecified) */ void *driverdata; /**< driver-specific data, initialize to 0 */ } SDL_DisplayMode; /** * \brief The type used to identify a window * * \sa SDL_CreateWindow() * \sa SDL_CreateWindowFrom() * \sa SDL_DestroyWindow() * \sa SDL_GetWindowData() * \sa SDL_GetWindowFlags() * \sa SDL_GetWindowGrab() * \sa SDL_GetWindowPosition() * \sa SDL_GetWindowSize() * \sa SDL_GetWindowTitle() * \sa SDL_HideWindow() * \sa SDL_MaximizeWindow() * \sa SDL_MinimizeWindow() * \sa SDL_RaiseWindow() * \sa SDL_RestoreWindow() * \sa SDL_SetWindowData() * \sa SDL_SetWindowFullscreen() * \sa SDL_SetWindowGrab() * \sa SDL_SetWindowIcon() * \sa SDL_SetWindowPosition() * \sa SDL_SetWindowSize() * \sa SDL_SetWindowBordered() * \sa SDL_SetWindowTitle() * \sa SDL_ShowWindow() */ typedef struct SDL_Window SDL_Window; /** * \brief The flags on a window * * \sa SDL_GetWindowFlags() */ typedef enum { SDL_WINDOW_FULLSCREEN = 0x00000001, /**< fullscreen window */ SDL_WINDOW_OPENGL = 0x00000002, /**< window usable with OpenGL context */ SDL_WINDOW_SHOWN = 0x00000004, /**< window is visible */ SDL_WINDOW_HIDDEN = 0x00000008, /**< window is not visible */ SDL_WINDOW_BORDERLESS = 0x00000010, /**< no window decoration */ SDL_WINDOW_RESIZABLE = 0x00000020, /**< window can be resized */ SDL_WINDOW_MINIMIZED = 0x00000040, /**< window is minimized */ SDL_WINDOW_MAXIMIZED = 0x00000080, /**< window is maximized */ SDL_WINDOW_INPUT_GRABBED = 0x00000100, /**< window has grabbed input focus */ SDL_WINDOW_INPUT_FOCUS = 0x00000200, /**< window has input focus */ SDL_WINDOW_MOUSE_FOCUS = 0x00000400, /**< window has mouse focus */ SDL_WINDOW_FULLSCREEN_DESKTOP = ( SDL_WINDOW_FULLSCREEN | 0x00001000 ), SDL_WINDOW_FOREIGN = 0x00000800, /**< window not created by SDL */ SDL_WINDOW_ALLOW_HIGHDPI = 0x00002000 /**< window should be created in high-DPI mode if supported */ } SDL_WindowFlags; /** * \brief Used to indicate that you don't care what the window position is. */ #define SDL_WINDOWPOS_UNDEFINED_MASK 0x1FFF0000 #define SDL_WINDOWPOS_UNDEFINED_DISPLAY(X) (SDL_WINDOWPOS_UNDEFINED_MASK|(X)) #define SDL_WINDOWPOS_UNDEFINED SDL_WINDOWPOS_UNDEFINED_DISPLAY(0) #define SDL_WINDOWPOS_ISUNDEFINED(X) \ (((X)&0xFFFF0000) == SDL_WINDOWPOS_UNDEFINED_MASK) /** * \brief Used to indicate that the window position should be centered. */ #define SDL_WINDOWPOS_CENTERED_MASK 0x2FFF0000 #define SDL_WINDOWPOS_CENTERED_DISPLAY(X) (SDL_WINDOWPOS_CENTERED_MASK|(X)) #define SDL_WINDOWPOS_CENTERED SDL_WINDOWPOS_CENTERED_DISPLAY(0) #define SDL_WINDOWPOS_ISCENTERED(X) \ (((X)&0xFFFF0000) == SDL_WINDOWPOS_CENTERED_MASK) /** * \brief Event subtype for window events */ typedef enum { SDL_WINDOWEVENT_NONE, /**< Never used */ SDL_WINDOWEVENT_SHOWN, /**< Window has been shown */ SDL_WINDOWEVENT_HIDDEN, /**< Window has been hidden */ SDL_WINDOWEVENT_EXPOSED, /**< Window has been exposed and should be redrawn */ SDL_WINDOWEVENT_MOVED, /**< Window has been moved to data1, data2 */ SDL_WINDOWEVENT_RESIZED, /**< Window has been resized to data1xdata2 */ SDL_WINDOWEVENT_SIZE_CHANGED, /**< The window size has changed, either as a result of an API call or through the system or user changing the window size. */ SDL_WINDOWEVENT_MINIMIZED, /**< Window has been minimized */ SDL_WINDOWEVENT_MAXIMIZED, /**< Window has been maximized */ SDL_WINDOWEVENT_RESTORED, /**< Window has been restored to normal size and position */ SDL_WINDOWEVENT_ENTER, /**< Window has gained mouse focus */ SDL_WINDOWEVENT_LEAVE, /**< Window has lost mouse focus */ SDL_WINDOWEVENT_FOCUS_GAINED, /**< Window has gained keyboard focus */ SDL_WINDOWEVENT_FOCUS_LOST, /**< Window has lost keyboard focus */ SDL_WINDOWEVENT_CLOSE /**< The window manager requests that the window be closed */ } SDL_WindowEventID; /** * \brief An opaque handle to an OpenGL context. */ typedef void *SDL_GLContext; /** * \brief OpenGL configuration attributes */ typedef enum { SDL_GL_RED_SIZE, SDL_GL_GREEN_SIZE, SDL_GL_BLUE_SIZE, SDL_GL_ALPHA_SIZE, SDL_GL_BUFFER_SIZE, SDL_GL_DOUBLEBUFFER, SDL_GL_DEPTH_SIZE, SDL_GL_STENCIL_SIZE, SDL_GL_ACCUM_RED_SIZE, SDL_GL_ACCUM_GREEN_SIZE, SDL_GL_ACCUM_BLUE_SIZE, SDL_GL_ACCUM_ALPHA_SIZE, SDL_GL_STEREO, SDL_GL_MULTISAMPLEBUFFERS, SDL_GL_MULTISAMPLESAMPLES, SDL_GL_ACCELERATED_VISUAL, SDL_GL_RETAINED_BACKING, SDL_GL_CONTEXT_MAJOR_VERSION, SDL_GL_CONTEXT_MINOR_VERSION, SDL_GL_CONTEXT_EGL, SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_SHARE_WITH_CURRENT_CONTEXT, SDL_GL_FRAMEBUFFER_SRGB_CAPABLE } SDL_GLattr; typedef enum { SDL_GL_CONTEXT_PROFILE_CORE = 0x0001, SDL_GL_CONTEXT_PROFILE_COMPATIBILITY = 0x0002, SDL_GL_CONTEXT_PROFILE_ES = 0x0004 /* GLX_CONTEXT_ES2_PROFILE_BIT_EXT */ } SDL_GLprofile; typedef enum { SDL_GL_CONTEXT_DEBUG_FLAG = 0x0001, SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG = 0x0002, SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG = 0x0004, SDL_GL_CONTEXT_RESET_ISOLATION_FLAG = 0x0008 } SDL_GLcontextFlag; /* Function prototypes */ /** * \brief Get the number of video drivers compiled into SDL * * \sa SDL_GetVideoDriver() */ extern DECLSPEC int SDLCALL SDL_GetNumVideoDrivers(void); /** * \brief Get the name of a built in video driver. * * \note The video drivers are presented in the order in which they are * normally checked during initialization. * * \sa SDL_GetNumVideoDrivers() */ extern DECLSPEC const char *SDLCALL SDL_GetVideoDriver(int index); /** * \brief Initialize the video subsystem, optionally specifying a video driver. * * \param driver_name Initialize a specific driver by name, or NULL for the * default video driver. * * \return 0 on success, -1 on error * * This function initializes the video subsystem; setting up a connection * to the window manager, etc, and determines the available display modes * and pixel formats, but does not initialize a window or graphics mode. * * \sa SDL_VideoQuit() */ extern DECLSPEC int SDLCALL SDL_VideoInit(const char *driver_name); /** * \brief Shuts down the video subsystem. * * This function closes all windows, and restores the original video mode. * * \sa SDL_VideoInit() */ extern DECLSPEC void SDLCALL SDL_VideoQuit(void); /** * \brief Returns the name of the currently initialized video driver. * * \return The name of the current video driver or NULL if no driver * has been initialized * * \sa SDL_GetNumVideoDrivers() * \sa SDL_GetVideoDriver() */ extern DECLSPEC const char *SDLCALL SDL_GetCurrentVideoDriver(void); /** * \brief Returns the number of available video displays. * * \sa SDL_GetDisplayBounds() */ extern DECLSPEC int SDLCALL SDL_GetNumVideoDisplays(void); /** * \brief Get the name of a display in UTF-8 encoding * * \return The name of a display, or NULL for an invalid display index. * * \sa SDL_GetNumVideoDisplays() */ extern DECLSPEC const char * SDLCALL SDL_GetDisplayName(int displayIndex); /** * \brief Get the desktop area represented by a display, with the primary * display located at 0,0 * * \return 0 on success, or -1 if the index is out of range. * * \sa SDL_GetNumVideoDisplays() */ extern DECLSPEC int SDLCALL SDL_GetDisplayBounds(int displayIndex, SDL_Rect * rect); /** * \brief Returns the number of available display modes. * * \sa SDL_GetDisplayMode() */ extern DECLSPEC int SDLCALL SDL_GetNumDisplayModes(int displayIndex); /** * \brief Fill in information about a specific display mode. * * \note The display modes are sorted in this priority: * \li bits per pixel -> more colors to fewer colors * \li width -> largest to smallest * \li height -> largest to smallest * \li refresh rate -> highest to lowest * * \sa SDL_GetNumDisplayModes() */ extern DECLSPEC int SDLCALL SDL_GetDisplayMode(int displayIndex, int modeIndex, SDL_DisplayMode * mode); /** * \brief Fill in information about the desktop display mode. */ extern DECLSPEC int SDLCALL SDL_GetDesktopDisplayMode(int displayIndex, SDL_DisplayMode * mode); /** * \brief Fill in information about the current display mode. */ extern DECLSPEC int SDLCALL SDL_GetCurrentDisplayMode(int displayIndex, SDL_DisplayMode * mode); /** * \brief Get the closest match to the requested display mode. * * \param displayIndex The index of display from which mode should be queried. * \param mode The desired display mode * \param closest A pointer to a display mode to be filled in with the closest * match of the available display modes. * * \return The passed in value \c closest, or NULL if no matching video mode * was available. * * The available display modes are scanned, and \c closest is filled in with the * closest mode matching the requested mode and returned. The mode format and * refresh_rate default to the desktop mode if they are 0. The modes are * scanned with size being first priority, format being second priority, and * finally checking the refresh_rate. If all the available modes are too * small, then NULL is returned. * * \sa SDL_GetNumDisplayModes() * \sa SDL_GetDisplayMode() */ extern DECLSPEC SDL_DisplayMode * SDLCALL SDL_GetClosestDisplayMode(int displayIndex, const SDL_DisplayMode * mode, SDL_DisplayMode * closest); /** * \brief Get the display index associated with a window. * * \return the display index of the display containing the center of the * window, or -1 on error. */ extern DECLSPEC int SDLCALL SDL_GetWindowDisplayIndex(SDL_Window * window); /** * \brief Set the display mode used when a fullscreen window is visible. * * By default the window's dimensions and the desktop format and refresh rate * are used. * * \param window The window for which the display mode should be set. * \param mode The mode to use, or NULL for the default mode. * * \return 0 on success, or -1 if setting the display mode failed. * * \sa SDL_GetWindowDisplayMode() * \sa SDL_SetWindowFullscreen() */ extern DECLSPEC int SDLCALL SDL_SetWindowDisplayMode(SDL_Window * window, const SDL_DisplayMode * mode); /** * \brief Fill in information about the display mode used when a fullscreen * window is visible. * * \sa SDL_SetWindowDisplayMode() * \sa SDL_SetWindowFullscreen() */ extern DECLSPEC int SDLCALL SDL_GetWindowDisplayMode(SDL_Window * window, SDL_DisplayMode * mode); /** * \brief Get the pixel format associated with the window. */ extern DECLSPEC Uint32 SDLCALL SDL_GetWindowPixelFormat(SDL_Window * window); /** * \brief Create a window with the specified position, dimensions, and flags. * * \param title The title of the window, in UTF-8 encoding. * \param x The x position of the window, ::SDL_WINDOWPOS_CENTERED, or * ::SDL_WINDOWPOS_UNDEFINED. * \param y The y position of the window, ::SDL_WINDOWPOS_CENTERED, or * ::SDL_WINDOWPOS_UNDEFINED. * \param w The width of the window. * \param h The height of the window. * \param flags The flags for the window, a mask of any of the following: * ::SDL_WINDOW_FULLSCREEN, ::SDL_WINDOW_OPENGL, * ::SDL_WINDOW_HIDDEN, ::SDL_WINDOW_BORDERLESS, * ::SDL_WINDOW_RESIZABLE, ::SDL_WINDOW_MAXIMIZED, * ::SDL_WINDOW_MINIMIZED, ::SDL_WINDOW_INPUT_GRABBED, * ::SDL_WINDOW_ALLOW_HIGHDPI. * * \return The id of the window created, or zero if window creation failed. * * \sa SDL_DestroyWindow() */ extern DECLSPEC SDL_Window * SDLCALL SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags); /** * \brief Create an SDL window from an existing native window. * * \param data A pointer to driver-dependent window creation data * * \return The id of the window created, or zero if window creation failed. * * \sa SDL_DestroyWindow() */ extern DECLSPEC SDL_Window * SDLCALL SDL_CreateWindowFrom(const void *data); /** * \brief Get the numeric ID of a window, for logging purposes. */ extern DECLSPEC Uint32 SDLCALL SDL_GetWindowID(SDL_Window * window); /** * \brief Get a window from a stored ID, or NULL if it doesn't exist. */ extern DECLSPEC SDL_Window * SDLCALL SDL_GetWindowFromID(Uint32 id); /** * \brief Get the window flags. */ extern DECLSPEC Uint32 SDLCALL SDL_GetWindowFlags(SDL_Window * window); /** * \brief Set the title of a window, in UTF-8 format. * * \sa SDL_GetWindowTitle() */ extern DECLSPEC void SDLCALL SDL_SetWindowTitle(SDL_Window * window, const char *title); /** * \brief Get the title of a window, in UTF-8 format. * * \sa SDL_SetWindowTitle() */ extern DECLSPEC const char *SDLCALL SDL_GetWindowTitle(SDL_Window * window); /** * \brief Set the icon for a window. * * \param window The window for which the icon should be set. * \param icon The icon for the window. */ extern DECLSPEC void SDLCALL SDL_SetWindowIcon(SDL_Window * window, SDL_Surface * icon); /** * \brief Associate an arbitrary named pointer with a window. * * \param window The window to associate with the pointer. * \param name The name of the pointer. * \param userdata The associated pointer. * * \return The previous value associated with 'name' * * \note The name is case-sensitive. * * \sa SDL_GetWindowData() */ extern DECLSPEC void* SDLCALL SDL_SetWindowData(SDL_Window * window, const char *name, void *userdata); /** * \brief Retrieve the data pointer associated with a window. * * \param window The window to query. * \param name The name of the pointer. * * \return The value associated with 'name' * * \sa SDL_SetWindowData() */ extern DECLSPEC void *SDLCALL SDL_GetWindowData(SDL_Window * window, const char *name); /** * \brief Set the position of a window. * * \param window The window to reposition. * \param x The x coordinate of the window, ::SDL_WINDOWPOS_CENTERED, or ::SDL_WINDOWPOS_UNDEFINED. * \param y The y coordinate of the window, ::SDL_WINDOWPOS_CENTERED, or ::SDL_WINDOWPOS_UNDEFINED. * * \note The window coordinate origin is the upper left of the display. * * \sa SDL_GetWindowPosition() */ extern DECLSPEC void SDLCALL SDL_SetWindowPosition(SDL_Window * window, int x, int y); /** * \brief Get the position of a window. * * \param window The window to query. * \param x Pointer to variable for storing the x position, may be NULL * \param y Pointer to variable for storing the y position, may be NULL * * \sa SDL_SetWindowPosition() */ extern DECLSPEC void SDLCALL SDL_GetWindowPosition(SDL_Window * window, int *x, int *y); /** * \brief Set the size of a window's client area. * * \param window The window to resize. * \param w The width of the window, must be >0 * \param h The height of the window, must be >0 * * \note You can't change the size of a fullscreen window, it automatically * matches the size of the display mode. * * \sa SDL_GetWindowSize() */ extern DECLSPEC void SDLCALL SDL_SetWindowSize(SDL_Window * window, int w, int h); /** * \brief Get the size of a window's client area. * * \param window The window to query. * \param w Pointer to variable for storing the width, may be NULL * \param h Pointer to variable for storing the height, may be NULL * * \sa SDL_SetWindowSize() */ extern DECLSPEC void SDLCALL SDL_GetWindowSize(SDL_Window * window, int *w, int *h); /** * \brief Set the minimum size of a window's client area. * * \param window The window to set a new minimum size. * \param min_w The minimum width of the window, must be >0 * \param min_h The minimum height of the window, must be >0 * * \note You can't change the minimum size of a fullscreen window, it * automatically matches the size of the display mode. * * \sa SDL_GetWindowMinimumSize() * \sa SDL_SetWindowMaximumSize() */ extern DECLSPEC void SDLCALL SDL_SetWindowMinimumSize(SDL_Window * window, int min_w, int min_h); /** * \brief Get the minimum size of a window's client area. * * \param window The window to query. * \param w Pointer to variable for storing the minimum width, may be NULL * \param h Pointer to variable for storing the minimum height, may be NULL * * \sa SDL_GetWindowMaximumSize() * \sa SDL_SetWindowMinimumSize() */ extern DECLSPEC void SDLCALL SDL_GetWindowMinimumSize(SDL_Window * window, int *w, int *h); /** * \brief Set the maximum size of a window's client area. * * \param window The window to set a new maximum size. * \param max_w The maximum width of the window, must be >0 * \param max_h The maximum height of the window, must be >0 * * \note You can't change the maximum size of a fullscreen window, it * automatically matches the size of the display mode. * * \sa SDL_GetWindowMaximumSize() * \sa SDL_SetWindowMinimumSize() */ extern DECLSPEC void SDLCALL SDL_SetWindowMaximumSize(SDL_Window * window, int max_w, int max_h); /** * \brief Get the maximum size of a window's client area. * * \param window The window to query. * \param w Pointer to variable for storing the maximum width, may be NULL * \param h Pointer to variable for storing the maximum height, may be NULL * * \sa SDL_GetWindowMinimumSize() * \sa SDL_SetWindowMaximumSize() */ extern DECLSPEC void SDLCALL SDL_GetWindowMaximumSize(SDL_Window * window, int *w, int *h); /** * \brief Set the border state of a window. * * This will add or remove the window's SDL_WINDOW_BORDERLESS flag and * add or remove the border from the actual window. This is a no-op if the * window's border already matches the requested state. * * \param window The window of which to change the border state. * \param bordered SDL_FALSE to remove border, SDL_TRUE to add border. * * \note You can't change the border state of a fullscreen window. * * \sa SDL_GetWindowFlags() */ extern DECLSPEC void SDLCALL SDL_SetWindowBordered(SDL_Window * window, SDL_bool bordered); /** * \brief Show a window. * * \sa SDL_HideWindow() */ extern DECLSPEC void SDLCALL SDL_ShowWindow(SDL_Window * window); /** * \brief Hide a window. * * \sa SDL_ShowWindow() */ extern DECLSPEC void SDLCALL SDL_HideWindow(SDL_Window * window); /** * \brief Raise a window above other windows and set the input focus. */ extern DECLSPEC void SDLCALL SDL_RaiseWindow(SDL_Window * window); /** * \brief Make a window as large as possible. * * \sa SDL_RestoreWindow() */ extern DECLSPEC void SDLCALL SDL_MaximizeWindow(SDL_Window * window); /** * \brief Minimize a window to an iconic representation. * * \sa SDL_RestoreWindow() */ extern DECLSPEC void SDLCALL SDL_MinimizeWindow(SDL_Window * window); /** * \brief Restore the size and position of a minimized or maximized window. * * \sa SDL_MaximizeWindow() * \sa SDL_MinimizeWindow() */ extern DECLSPEC void SDLCALL SDL_RestoreWindow(SDL_Window * window); /** * \brief Set a window's fullscreen state. * * \return 0 on success, or -1 if setting the display mode failed. * * \sa SDL_SetWindowDisplayMode() * \sa SDL_GetWindowDisplayMode() */ extern DECLSPEC int SDLCALL SDL_SetWindowFullscreen(SDL_Window * window, Uint32 flags); /** * \brief Get the SDL surface associated with the window. * * \return The window's framebuffer surface, or NULL on error. * * A new surface will be created with the optimal format for the window, * if necessary. This surface will be freed when the window is destroyed. * * \note You may not combine this with 3D or the rendering API on this window. * * \sa SDL_UpdateWindowSurface() * \sa SDL_UpdateWindowSurfaceRects() */ extern DECLSPEC SDL_Surface * SDLCALL SDL_GetWindowSurface(SDL_Window * window); /** * \brief Copy the window surface to the screen. * * \return 0 on success, or -1 on error. * * \sa SDL_GetWindowSurface() * \sa SDL_UpdateWindowSurfaceRects() */ extern DECLSPEC int SDLCALL SDL_UpdateWindowSurface(SDL_Window * window); /** * \brief Copy a number of rectangles on the window surface to the screen. * * \return 0 on success, or -1 on error. * * \sa SDL_GetWindowSurface() * \sa SDL_UpdateWindowSurfaceRect() */ extern DECLSPEC int SDLCALL SDL_UpdateWindowSurfaceRects(SDL_Window * window, const SDL_Rect * rects, int numrects); /** * \brief Set a window's input grab mode. * * \param window The window for which the input grab mode should be set. * \param grabbed This is SDL_TRUE to grab input, and SDL_FALSE to release input. * * \sa SDL_GetWindowGrab() */ extern DECLSPEC void SDLCALL SDL_SetWindowGrab(SDL_Window * window, SDL_bool grabbed); /** * \brief Get a window's input grab mode. * * \return This returns SDL_TRUE if input is grabbed, and SDL_FALSE otherwise. * * \sa SDL_SetWindowGrab() */ extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowGrab(SDL_Window * window); /** * \brief Set the brightness (gamma correction) for a window. * * \return 0 on success, or -1 if setting the brightness isn't supported. * * \sa SDL_GetWindowBrightness() * \sa SDL_SetWindowGammaRamp() */ extern DECLSPEC int SDLCALL SDL_SetWindowBrightness(SDL_Window * window, float brightness); /** * \brief Get the brightness (gamma correction) for a window. * * \return The last brightness value passed to SDL_SetWindowBrightness() * * \sa SDL_SetWindowBrightness() */ extern DECLSPEC float SDLCALL SDL_GetWindowBrightness(SDL_Window * window); /** * \brief Set the gamma ramp for a window. * * \param window The window for which the gamma ramp should be set. * \param red The translation table for the red channel, or NULL. * \param green The translation table for the green channel, or NULL. * \param blue The translation table for the blue channel, or NULL. * * \return 0 on success, or -1 if gamma ramps are unsupported. * * Set the gamma translation table for the red, green, and blue channels * of the video hardware. Each table is an array of 256 16-bit quantities, * representing a mapping between the input and output for that channel. * The input is the index into the array, and the output is the 16-bit * gamma value at that index, scaled to the output color precision. * * \sa SDL_GetWindowGammaRamp() */ extern DECLSPEC int SDLCALL SDL_SetWindowGammaRamp(SDL_Window * window, const Uint16 * red, const Uint16 * green, const Uint16 * blue); /** * \brief Get the gamma ramp for a window. * * \param window The window from which the gamma ramp should be queried. * \param red A pointer to a 256 element array of 16-bit quantities to hold * the translation table for the red channel, or NULL. * \param green A pointer to a 256 element array of 16-bit quantities to hold * the translation table for the green channel, or NULL. * \param blue A pointer to a 256 element array of 16-bit quantities to hold * the translation table for the blue channel, or NULL. * * \return 0 on success, or -1 if gamma ramps are unsupported. * * \sa SDL_SetWindowGammaRamp() */ extern DECLSPEC int SDLCALL SDL_GetWindowGammaRamp(SDL_Window * window, Uint16 * red, Uint16 * green, Uint16 * blue); /** * \brief Destroy a window. */ extern DECLSPEC void SDLCALL SDL_DestroyWindow(SDL_Window * window); /** * \brief Returns whether the screensaver is currently enabled (default on). * * \sa SDL_EnableScreenSaver() * \sa SDL_DisableScreenSaver() */ extern DECLSPEC SDL_bool SDLCALL SDL_IsScreenSaverEnabled(void); /** * \brief Allow the screen to be blanked by a screensaver * * \sa SDL_IsScreenSaverEnabled() * \sa SDL_DisableScreenSaver() */ extern DECLSPEC void SDLCALL SDL_EnableScreenSaver(void); /** * \brief Prevent the screen from being blanked by a screensaver * * \sa SDL_IsScreenSaverEnabled() * \sa SDL_EnableScreenSaver() */ extern DECLSPEC void SDLCALL SDL_DisableScreenSaver(void); /** * \name OpenGL support functions */ /* @{ */ /** * \brief Dynamically load an OpenGL library. * * \param path The platform dependent OpenGL library name, or NULL to open the * default OpenGL library. * * \return 0 on success, or -1 if the library couldn't be loaded. * * This should be done after initializing the video driver, but before * creating any OpenGL windows. If no OpenGL library is loaded, the default * library will be loaded upon creation of the first OpenGL window. * * \note If you do this, you need to retrieve all of the GL functions used in * your program from the dynamic library using SDL_GL_GetProcAddress(). * * \sa SDL_GL_GetProcAddress() * \sa SDL_GL_UnloadLibrary() */ extern DECLSPEC int SDLCALL SDL_GL_LoadLibrary(const char *path); /** * \brief Get the address of an OpenGL function. */ extern DECLSPEC void *SDLCALL SDL_GL_GetProcAddress(const char *proc); /** * \brief Unload the OpenGL library previously loaded by SDL_GL_LoadLibrary(). * * \sa SDL_GL_LoadLibrary() */ extern DECLSPEC void SDLCALL SDL_GL_UnloadLibrary(void); /** * \brief Return true if an OpenGL extension is supported for the current * context. */ extern DECLSPEC SDL_bool SDLCALL SDL_GL_ExtensionSupported(const char *extension); /** * \brief Reset all previously set OpenGL context attributes to their default values */ extern DECLSPEC void SDLCALL SDL_GL_ResetAttributes(void); /** * \brief Set an OpenGL window attribute before window creation. */ extern DECLSPEC int SDLCALL SDL_GL_SetAttribute(SDL_GLattr attr, int value); /** * \brief Get the actual value for an attribute from the current context. */ extern DECLSPEC int SDLCALL SDL_GL_GetAttribute(SDL_GLattr attr, int *value); /** * \brief Create an OpenGL context for use with an OpenGL window, and make it * current. * * \sa SDL_GL_DeleteContext() */ extern DECLSPEC SDL_GLContext SDLCALL SDL_GL_CreateContext(SDL_Window * window); /** * \brief Set up an OpenGL context for rendering into an OpenGL window. * * \note The context must have been created with a compatible window. */ extern DECLSPEC int SDLCALL SDL_GL_MakeCurrent(SDL_Window * window, SDL_GLContext context); /** * \brief Get the currently active OpenGL window. */ extern DECLSPEC SDL_Window* SDLCALL SDL_GL_GetCurrentWindow(void); /** * \brief Get the currently active OpenGL context. */ extern DECLSPEC SDL_GLContext SDLCALL SDL_GL_GetCurrentContext(void); /** * \brief Get the size of a window's underlying drawable (for use with glViewport). * * \param window Window from which the drawable size should be queried * \param w Pointer to variable for storing the width, may be NULL * \param h Pointer to variable for storing the height, may be NULL * * This may differ from SDL_GetWindowSize if we're rendering to a high-DPI * drawable, i.e. the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a * platform with high-DPI support (Apple calls this "Retina"), and not disabled * by the SDL_HINT_VIDEO_HIGHDPI_DISABLED hint. * * \sa SDL_GetWindowSize() * \sa SDL_CreateWindow() */ extern DECLSPEC void SDLCALL SDL_GL_GetDrawableSize(SDL_Window * window, int *w, int *h); /** * \brief Set the swap interval for the current OpenGL context. * * \param interval 0 for immediate updates, 1 for updates synchronized with the * vertical retrace. If the system supports it, you may * specify -1 to allow late swaps to happen immediately * instead of waiting for the next retrace. * * \return 0 on success, or -1 if setting the swap interval is not supported. * * \sa SDL_GL_GetSwapInterval() */ extern DECLSPEC int SDLCALL SDL_GL_SetSwapInterval(int interval); /** * \brief Get the swap interval for the current OpenGL context. * * \return 0 if there is no vertical retrace synchronization, 1 if the buffer * swap is synchronized with the vertical retrace, and -1 if late * swaps happen immediately instead of waiting for the next retrace. * If the system can't determine the swap interval, or there isn't a * valid current context, this will return 0 as a safe default. * * \sa SDL_GL_SetSwapInterval() */ extern DECLSPEC int SDLCALL SDL_GL_GetSwapInterval(void); /** * \brief Swap the OpenGL buffers for a window, if double-buffering is * supported. */ extern DECLSPEC void SDLCALL SDL_GL_SwapWindow(SDL_Window * window); /** * \brief Delete an OpenGL context. * * \sa SDL_GL_CreateContext() */ extern DECLSPEC void SDLCALL SDL_GL_DeleteContext(SDL_GLContext context); /* @} *//* OpenGL support functions */ /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif # 975 "/usr/local/include/SDL2/SDL_video.h" #if 0 /* expanded by -frewrite-includes */ #include "close_code.h" #endif /* expanded by -frewrite-includes */ # 975 "/usr/local/include/SDL2/SDL_video.h" # 1 "/usr/local/include/SDL2/close_code.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file close_code.h * * This file reverses the effects of begin_code.h and should be included * after you finish any function and structure declarations in your headers */ #undef _begin_code_h /* Reset structure packing at previous byte alignment */ #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__WATCOMC__) || defined(__BORLANDC__) #ifdef __BORLANDC__ #pragma nopackwarning #endif # 36 "/usr/local/include/SDL2/close_code.h" #pragma pack(pop) #endif /* Compiler needs structure packing set */ # 38 "/usr/local/include/SDL2/close_code.h" # 976 "/usr/local/include/SDL2/SDL_video.h" 2 #endif /* _SDL_video_h */ # 978 "/usr/local/include/SDL2/SDL_video.h" /* vi: set ts=4 sw=4 expandtab: */ # 34 "/usr/local/include/SDL2/SDL_events.h" 2 #if 0 /* expanded by -frewrite-includes */ #include "SDL_keyboard.h" #endif /* expanded by -frewrite-includes */ # 34 "/usr/local/include/SDL2/SDL_events.h" # 1 "/usr/local/include/SDL2/SDL_keyboard.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file SDL_keyboard.h * * Include file for SDL keyboard event handling */ #ifndef _SDL_keyboard_h #define _SDL_keyboard_h #if 0 /* expanded by -frewrite-includes */ #include "SDL_stdinc.h" #endif /* expanded by -frewrite-includes */ # 31 "/usr/local/include/SDL2/SDL_keyboard.h" # 32 "/usr/local/include/SDL2/SDL_keyboard.h" #if 0 /* expanded by -frewrite-includes */ #include "SDL_error.h" #endif /* expanded by -frewrite-includes */ # 32 "/usr/local/include/SDL2/SDL_keyboard.h" # 33 "/usr/local/include/SDL2/SDL_keyboard.h" #if 0 /* expanded by -frewrite-includes */ #include "SDL_keycode.h" #endif /* expanded by -frewrite-includes */ # 33 "/usr/local/include/SDL2/SDL_keyboard.h" # 1 "/usr/local/include/SDL2/SDL_keycode.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file SDL_keycode.h * * Defines constants which identify keyboard keys and modifiers. */ #ifndef _SDL_keycode_h #define _SDL_keycode_h #if 0 /* expanded by -frewrite-includes */ #include "SDL_stdinc.h" #endif /* expanded by -frewrite-includes */ # 31 "/usr/local/include/SDL2/SDL_keycode.h" # 32 "/usr/local/include/SDL2/SDL_keycode.h" #if 0 /* expanded by -frewrite-includes */ #include "SDL_scancode.h" #endif /* expanded by -frewrite-includes */ # 32 "/usr/local/include/SDL2/SDL_keycode.h" # 1 "/usr/local/include/SDL2/SDL_scancode.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file SDL_scancode.h * * Defines keyboard scancodes. */ #ifndef _SDL_scancode_h #define _SDL_scancode_h #if 0 /* expanded by -frewrite-includes */ #include "SDL_stdinc.h" #endif /* expanded by -frewrite-includes */ # 31 "/usr/local/include/SDL2/SDL_scancode.h" # 32 "/usr/local/include/SDL2/SDL_scancode.h" /** * \brief The SDL keyboard scancode representation. * * Values of this type are used to represent keyboard keys, among other places * in the \link SDL_Keysym::scancode key.keysym.scancode \endlink field of the * SDL_Event structure. * * The values in this enumeration are based on the USB usage page standard: * http://www.usb.org/developers/devclass_docs/Hut1_12v2.pdf */ typedef enum { SDL_SCANCODE_UNKNOWN = 0, /** * \name Usage page 0x07 * * These values are from usage page 0x07 (USB keyboard page). */ /* @{ */ SDL_SCANCODE_A = 4, SDL_SCANCODE_B = 5, SDL_SCANCODE_C = 6, SDL_SCANCODE_D = 7, SDL_SCANCODE_E = 8, SDL_SCANCODE_F = 9, SDL_SCANCODE_G = 10, SDL_SCANCODE_H = 11, SDL_SCANCODE_I = 12, SDL_SCANCODE_J = 13, SDL_SCANCODE_K = 14, SDL_SCANCODE_L = 15, SDL_SCANCODE_M = 16, SDL_SCANCODE_N = 17, SDL_SCANCODE_O = 18, SDL_SCANCODE_P = 19, SDL_SCANCODE_Q = 20, SDL_SCANCODE_R = 21, SDL_SCANCODE_S = 22, SDL_SCANCODE_T = 23, SDL_SCANCODE_U = 24, SDL_SCANCODE_V = 25, SDL_SCANCODE_W = 26, SDL_SCANCODE_X = 27, SDL_SCANCODE_Y = 28, SDL_SCANCODE_Z = 29, SDL_SCANCODE_1 = 30, SDL_SCANCODE_2 = 31, SDL_SCANCODE_3 = 32, SDL_SCANCODE_4 = 33, SDL_SCANCODE_5 = 34, SDL_SCANCODE_6 = 35, SDL_SCANCODE_7 = 36, SDL_SCANCODE_8 = 37, SDL_SCANCODE_9 = 38, SDL_SCANCODE_0 = 39, SDL_SCANCODE_RETURN = 40, SDL_SCANCODE_ESCAPE = 41, SDL_SCANCODE_BACKSPACE = 42, SDL_SCANCODE_TAB = 43, SDL_SCANCODE_SPACE = 44, SDL_SCANCODE_MINUS = 45, SDL_SCANCODE_EQUALS = 46, SDL_SCANCODE_LEFTBRACKET = 47, SDL_SCANCODE_RIGHTBRACKET = 48, SDL_SCANCODE_BACKSLASH = 49, /**< Located at the lower left of the return * key on ISO keyboards and at the right end * of the QWERTY row on ANSI keyboards. * Produces REVERSE SOLIDUS (backslash) and * VERTICAL LINE in a US layout, REVERSE * SOLIDUS and VERTICAL LINE in a UK Mac * layout, NUMBER SIGN and TILDE in a UK * Windows layout, DOLLAR SIGN and POUND SIGN * in a Swiss German layout, NUMBER SIGN and * APOSTROPHE in a German layout, GRAVE * ACCENT and POUND SIGN in a French Mac * layout, and ASTERISK and MICRO SIGN in a * French Windows layout. */ SDL_SCANCODE_NONUSHASH = 50, /**< ISO USB keyboards actually use this code * instead of 49 for the same key, but all * OSes I've seen treat the two codes * identically. So, as an implementor, unless * your keyboard generates both of those * codes and your OS treats them differently, * you should generate SDL_SCANCODE_BACKSLASH * instead of this code. As a user, you * should not rely on this code because SDL * will never generate it with most (all?) * keyboards. */ SDL_SCANCODE_SEMICOLON = 51, SDL_SCANCODE_APOSTROPHE = 52, SDL_SCANCODE_GRAVE = 53, /**< Located in the top left corner (on both ANSI * and ISO keyboards). Produces GRAVE ACCENT and * TILDE in a US Windows layout and in US and UK * Mac layouts on ANSI keyboards, GRAVE ACCENT * and NOT SIGN in a UK Windows layout, SECTION * SIGN and PLUS-MINUS SIGN in US and UK Mac * layouts on ISO keyboards, SECTION SIGN and * DEGREE SIGN in a Swiss German layout (Mac: * only on ISO keyboards), CIRCUMFLEX ACCENT and * DEGREE SIGN in a German layout (Mac: only on * ISO keyboards), SUPERSCRIPT TWO and TILDE in a * French Windows layout, COMMERCIAL AT and * NUMBER SIGN in a French Mac layout on ISO * keyboards, and LESS-THAN SIGN and GREATER-THAN * SIGN in a Swiss German, German, or French Mac * layout on ANSI keyboards. */ SDL_SCANCODE_COMMA = 54, SDL_SCANCODE_PERIOD = 55, SDL_SCANCODE_SLASH = 56, SDL_SCANCODE_CAPSLOCK = 57, SDL_SCANCODE_F1 = 58, SDL_SCANCODE_F2 = 59, SDL_SCANCODE_F3 = 60, SDL_SCANCODE_F4 = 61, SDL_SCANCODE_F5 = 62, SDL_SCANCODE_F6 = 63, SDL_SCANCODE_F7 = 64, SDL_SCANCODE_F8 = 65, SDL_SCANCODE_F9 = 66, SDL_SCANCODE_F10 = 67, SDL_SCANCODE_F11 = 68, SDL_SCANCODE_F12 = 69, SDL_SCANCODE_PRINTSCREEN = 70, SDL_SCANCODE_SCROLLLOCK = 71, SDL_SCANCODE_PAUSE = 72, SDL_SCANCODE_INSERT = 73, /**< insert on PC, help on some Mac keyboards (but does send code 73, not 117) */ SDL_SCANCODE_HOME = 74, SDL_SCANCODE_PAGEUP = 75, SDL_SCANCODE_DELETE = 76, SDL_SCANCODE_END = 77, SDL_SCANCODE_PAGEDOWN = 78, SDL_SCANCODE_RIGHT = 79, SDL_SCANCODE_LEFT = 80, SDL_SCANCODE_DOWN = 81, SDL_SCANCODE_UP = 82, SDL_SCANCODE_NUMLOCKCLEAR = 83, /**< num lock on PC, clear on Mac keyboards */ SDL_SCANCODE_KP_DIVIDE = 84, SDL_SCANCODE_KP_MULTIPLY = 85, SDL_SCANCODE_KP_MINUS = 86, SDL_SCANCODE_KP_PLUS = 87, SDL_SCANCODE_KP_ENTER = 88, SDL_SCANCODE_KP_1 = 89, SDL_SCANCODE_KP_2 = 90, SDL_SCANCODE_KP_3 = 91, SDL_SCANCODE_KP_4 = 92, SDL_SCANCODE_KP_5 = 93, SDL_SCANCODE_KP_6 = 94, SDL_SCANCODE_KP_7 = 95, SDL_SCANCODE_KP_8 = 96, SDL_SCANCODE_KP_9 = 97, SDL_SCANCODE_KP_0 = 98, SDL_SCANCODE_KP_PERIOD = 99, SDL_SCANCODE_NONUSBACKSLASH = 100, /**< This is the additional key that ISO * keyboards have over ANSI ones, * located between left shift and Y. * Produces GRAVE ACCENT and TILDE in a * US or UK Mac layout, REVERSE SOLIDUS * (backslash) and VERTICAL LINE in a * US or UK Windows layout, and * LESS-THAN SIGN and GREATER-THAN SIGN * in a Swiss German, German, or French * layout. */ SDL_SCANCODE_APPLICATION = 101, /**< windows contextual menu, compose */ SDL_SCANCODE_POWER = 102, /**< The USB document says this is a status flag, * not a physical key - but some Mac keyboards * do have a power key. */ SDL_SCANCODE_KP_EQUALS = 103, SDL_SCANCODE_F13 = 104, SDL_SCANCODE_F14 = 105, SDL_SCANCODE_F15 = 106, SDL_SCANCODE_F16 = 107, SDL_SCANCODE_F17 = 108, SDL_SCANCODE_F18 = 109, SDL_SCANCODE_F19 = 110, SDL_SCANCODE_F20 = 111, SDL_SCANCODE_F21 = 112, SDL_SCANCODE_F22 = 113, SDL_SCANCODE_F23 = 114, SDL_SCANCODE_F24 = 115, SDL_SCANCODE_EXECUTE = 116, SDL_SCANCODE_HELP = 117, SDL_SCANCODE_MENU = 118, SDL_SCANCODE_SELECT = 119, SDL_SCANCODE_STOP = 120, SDL_SCANCODE_AGAIN = 121, /**< redo */ SDL_SCANCODE_UNDO = 122, SDL_SCANCODE_CUT = 123, SDL_SCANCODE_COPY = 124, SDL_SCANCODE_PASTE = 125, SDL_SCANCODE_FIND = 126, SDL_SCANCODE_MUTE = 127, SDL_SCANCODE_VOLUMEUP = 128, SDL_SCANCODE_VOLUMEDOWN = 129, /* not sure whether there's a reason to enable these */ /* SDL_SCANCODE_LOCKINGCAPSLOCK = 130, */ /* SDL_SCANCODE_LOCKINGNUMLOCK = 131, */ /* SDL_SCANCODE_LOCKINGSCROLLLOCK = 132, */ SDL_SCANCODE_KP_COMMA = 133, SDL_SCANCODE_KP_EQUALSAS400 = 134, SDL_SCANCODE_INTERNATIONAL1 = 135, /**< used on Asian keyboards, see footnotes in USB doc */ SDL_SCANCODE_INTERNATIONAL2 = 136, SDL_SCANCODE_INTERNATIONAL3 = 137, /**< Yen */ SDL_SCANCODE_INTERNATIONAL4 = 138, SDL_SCANCODE_INTERNATIONAL5 = 139, SDL_SCANCODE_INTERNATIONAL6 = 140, SDL_SCANCODE_INTERNATIONAL7 = 141, SDL_SCANCODE_INTERNATIONAL8 = 142, SDL_SCANCODE_INTERNATIONAL9 = 143, SDL_SCANCODE_LANG1 = 144, /**< Hangul/English toggle */ SDL_SCANCODE_LANG2 = 145, /**< Hanja conversion */ SDL_SCANCODE_LANG3 = 146, /**< Katakana */ SDL_SCANCODE_LANG4 = 147, /**< Hiragana */ SDL_SCANCODE_LANG5 = 148, /**< Zenkaku/Hankaku */ SDL_SCANCODE_LANG6 = 149, /**< reserved */ SDL_SCANCODE_LANG7 = 150, /**< reserved */ SDL_SCANCODE_LANG8 = 151, /**< reserved */ SDL_SCANCODE_LANG9 = 152, /**< reserved */ SDL_SCANCODE_ALTERASE = 153, /**< Erase-Eaze */ SDL_SCANCODE_SYSREQ = 154, SDL_SCANCODE_CANCEL = 155, SDL_SCANCODE_CLEAR = 156, SDL_SCANCODE_PRIOR = 157, SDL_SCANCODE_RETURN2 = 158, SDL_SCANCODE_SEPARATOR = 159, SDL_SCANCODE_OUT = 160, SDL_SCANCODE_OPER = 161, SDL_SCANCODE_CLEARAGAIN = 162, SDL_SCANCODE_CRSEL = 163, SDL_SCANCODE_EXSEL = 164, SDL_SCANCODE_KP_00 = 176, SDL_SCANCODE_KP_000 = 177, SDL_SCANCODE_THOUSANDSSEPARATOR = 178, SDL_SCANCODE_DECIMALSEPARATOR = 179, SDL_SCANCODE_CURRENCYUNIT = 180, SDL_SCANCODE_CURRENCYSUBUNIT = 181, SDL_SCANCODE_KP_LEFTPAREN = 182, SDL_SCANCODE_KP_RIGHTPAREN = 183, SDL_SCANCODE_KP_LEFTBRACE = 184, SDL_SCANCODE_KP_RIGHTBRACE = 185, SDL_SCANCODE_KP_TAB = 186, SDL_SCANCODE_KP_BACKSPACE = 187, SDL_SCANCODE_KP_A = 188, SDL_SCANCODE_KP_B = 189, SDL_SCANCODE_KP_C = 190, SDL_SCANCODE_KP_D = 191, SDL_SCANCODE_KP_E = 192, SDL_SCANCODE_KP_F = 193, SDL_SCANCODE_KP_XOR = 194, SDL_SCANCODE_KP_POWER = 195, SDL_SCANCODE_KP_PERCENT = 196, SDL_SCANCODE_KP_LESS = 197, SDL_SCANCODE_KP_GREATER = 198, SDL_SCANCODE_KP_AMPERSAND = 199, SDL_SCANCODE_KP_DBLAMPERSAND = 200, SDL_SCANCODE_KP_VERTICALBAR = 201, SDL_SCANCODE_KP_DBLVERTICALBAR = 202, SDL_SCANCODE_KP_COLON = 203, SDL_SCANCODE_KP_HASH = 204, SDL_SCANCODE_KP_SPACE = 205, SDL_SCANCODE_KP_AT = 206, SDL_SCANCODE_KP_EXCLAM = 207, SDL_SCANCODE_KP_MEMSTORE = 208, SDL_SCANCODE_KP_MEMRECALL = 209, SDL_SCANCODE_KP_MEMCLEAR = 210, SDL_SCANCODE_KP_MEMADD = 211, SDL_SCANCODE_KP_MEMSUBTRACT = 212, SDL_SCANCODE_KP_MEMMULTIPLY = 213, SDL_SCANCODE_KP_MEMDIVIDE = 214, SDL_SCANCODE_KP_PLUSMINUS = 215, SDL_SCANCODE_KP_CLEAR = 216, SDL_SCANCODE_KP_CLEARENTRY = 217, SDL_SCANCODE_KP_BINARY = 218, SDL_SCANCODE_KP_OCTAL = 219, SDL_SCANCODE_KP_DECIMAL = 220, SDL_SCANCODE_KP_HEXADECIMAL = 221, SDL_SCANCODE_LCTRL = 224, SDL_SCANCODE_LSHIFT = 225, SDL_SCANCODE_LALT = 226, /**< alt, option */ SDL_SCANCODE_LGUI = 227, /**< windows, command (apple), meta */ SDL_SCANCODE_RCTRL = 228, SDL_SCANCODE_RSHIFT = 229, SDL_SCANCODE_RALT = 230, /**< alt gr, option */ SDL_SCANCODE_RGUI = 231, /**< windows, command (apple), meta */ SDL_SCANCODE_MODE = 257, /**< I'm not sure if this is really not covered * by any of the above, but since there's a * special KMOD_MODE for it I'm adding it here */ /* @} *//* Usage page 0x07 */ /** * \name Usage page 0x0C * * These values are mapped from usage page 0x0C (USB consumer page). */ /* @{ */ SDL_SCANCODE_AUDIONEXT = 258, SDL_SCANCODE_AUDIOPREV = 259, SDL_SCANCODE_AUDIOSTOP = 260, SDL_SCANCODE_AUDIOPLAY = 261, SDL_SCANCODE_AUDIOMUTE = 262, SDL_SCANCODE_MEDIASELECT = 263, SDL_SCANCODE_WWW = 264, SDL_SCANCODE_MAIL = 265, SDL_SCANCODE_CALCULATOR = 266, SDL_SCANCODE_COMPUTER = 267, SDL_SCANCODE_AC_SEARCH = 268, SDL_SCANCODE_AC_HOME = 269, SDL_SCANCODE_AC_BACK = 270, SDL_SCANCODE_AC_FORWARD = 271, SDL_SCANCODE_AC_STOP = 272, SDL_SCANCODE_AC_REFRESH = 273, SDL_SCANCODE_AC_BOOKMARKS = 274, /* @} *//* Usage page 0x0C */ /** * \name Walther keys * * These are values that Christian Walther added (for mac keyboard?). */ /* @{ */ SDL_SCANCODE_BRIGHTNESSDOWN = 275, SDL_SCANCODE_BRIGHTNESSUP = 276, SDL_SCANCODE_DISPLAYSWITCH = 277, /**< display mirroring/dual display switch, video mode switch */ SDL_SCANCODE_KBDILLUMTOGGLE = 278, SDL_SCANCODE_KBDILLUMDOWN = 279, SDL_SCANCODE_KBDILLUMUP = 280, SDL_SCANCODE_EJECT = 281, SDL_SCANCODE_SLEEP = 282, SDL_SCANCODE_APP1 = 283, SDL_SCANCODE_APP2 = 284, /* @} *//* Walther keys */ /* Add any other keys here. */ SDL_NUM_SCANCODES = 512 /**< not a key, just marks the number of scancodes for array bounds */ } SDL_Scancode; #endif /* _SDL_scancode_h */ # 400 "/usr/local/include/SDL2/SDL_scancode.h" /* vi: set ts=4 sw=4 expandtab: */ # 33 "/usr/local/include/SDL2/SDL_keycode.h" 2 /** * \brief The SDL virtual key representation. * * Values of this type are used to represent keyboard keys using the current * layout of the keyboard. These values include Unicode values representing * the unmodified character that would be generated by pressing the key, or * an SDLK_* constant for those keys that do not generate characters. */ typedef Sint32 SDL_Keycode; #define SDLK_SCANCODE_MASK (1<<30) #define SDL_SCANCODE_TO_KEYCODE(X) (X | SDLK_SCANCODE_MASK) enum { SDLK_UNKNOWN = 0, SDLK_RETURN = '\r', SDLK_ESCAPE = '\033', SDLK_BACKSPACE = '\b', SDLK_TAB = '\t', SDLK_SPACE = ' ', SDLK_EXCLAIM = '!', SDLK_QUOTEDBL = '"', SDLK_HASH = '#', SDLK_PERCENT = '%', SDLK_DOLLAR = '$', SDLK_AMPERSAND = '&', SDLK_QUOTE = '\'', SDLK_LEFTPAREN = '(', SDLK_RIGHTPAREN = ')', SDLK_ASTERISK = '*', SDLK_PLUS = '+', SDLK_COMMA = ',', SDLK_MINUS = '-', SDLK_PERIOD = '.', SDLK_SLASH = '/', SDLK_0 = '0', SDLK_1 = '1', SDLK_2 = '2', SDLK_3 = '3', SDLK_4 = '4', SDLK_5 = '5', SDLK_6 = '6', SDLK_7 = '7', SDLK_8 = '8', SDLK_9 = '9', SDLK_COLON = ':', SDLK_SEMICOLON = ';', SDLK_LESS = '<', SDLK_EQUALS = '=', SDLK_GREATER = '>', SDLK_QUESTION = '?', SDLK_AT = '@', /* Skip uppercase letters */ SDLK_LEFTBRACKET = '[', SDLK_BACKSLASH = '\\', SDLK_RIGHTBRACKET = ']', SDLK_CARET = '^', SDLK_UNDERSCORE = '_', SDLK_BACKQUOTE = '`', SDLK_a = 'a', SDLK_b = 'b', SDLK_c = 'c', SDLK_d = 'd', SDLK_e = 'e', SDLK_f = 'f', SDLK_g = 'g', SDLK_h = 'h', SDLK_i = 'i', SDLK_j = 'j', SDLK_k = 'k', SDLK_l = 'l', SDLK_m = 'm', SDLK_n = 'n', SDLK_o = 'o', SDLK_p = 'p', SDLK_q = 'q', SDLK_r = 'r', SDLK_s = 's', SDLK_t = 't', SDLK_u = 'u', SDLK_v = 'v', SDLK_w = 'w', SDLK_x = 'x', SDLK_y = 'y', SDLK_z = 'z', SDLK_CAPSLOCK = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CAPSLOCK), SDLK_F1 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F1), SDLK_F2 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F2), SDLK_F3 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F3), SDLK_F4 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F4), SDLK_F5 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F5), SDLK_F6 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F6), SDLK_F7 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F7), SDLK_F8 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F8), SDLK_F9 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F9), SDLK_F10 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F10), SDLK_F11 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F11), SDLK_F12 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F12), SDLK_PRINTSCREEN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PRINTSCREEN), SDLK_SCROLLLOCK = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SCROLLLOCK), SDLK_PAUSE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PAUSE), SDLK_INSERT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_INSERT), SDLK_HOME = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_HOME), SDLK_PAGEUP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PAGEUP), SDLK_DELETE = '\177', SDLK_END = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_END), SDLK_PAGEDOWN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PAGEDOWN), SDLK_RIGHT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RIGHT), SDLK_LEFT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LEFT), SDLK_DOWN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_DOWN), SDLK_UP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_UP), SDLK_NUMLOCKCLEAR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_NUMLOCKCLEAR), SDLK_KP_DIVIDE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_DIVIDE), SDLK_KP_MULTIPLY = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MULTIPLY), SDLK_KP_MINUS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MINUS), SDLK_KP_PLUS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_PLUS), SDLK_KP_ENTER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_ENTER), SDLK_KP_1 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_1), SDLK_KP_2 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_2), SDLK_KP_3 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_3), SDLK_KP_4 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_4), SDLK_KP_5 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_5), SDLK_KP_6 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_6), SDLK_KP_7 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_7), SDLK_KP_8 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_8), SDLK_KP_9 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_9), SDLK_KP_0 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_0), SDLK_KP_PERIOD = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_PERIOD), SDLK_APPLICATION = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_APPLICATION), SDLK_POWER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_POWER), SDLK_KP_EQUALS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_EQUALS), SDLK_F13 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F13), SDLK_F14 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F14), SDLK_F15 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F15), SDLK_F16 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F16), SDLK_F17 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F17), SDLK_F18 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F18), SDLK_F19 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F19), SDLK_F20 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F20), SDLK_F21 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F21), SDLK_F22 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F22), SDLK_F23 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F23), SDLK_F24 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F24), SDLK_EXECUTE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_EXECUTE), SDLK_HELP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_HELP), SDLK_MENU = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MENU), SDLK_SELECT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SELECT), SDLK_STOP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_STOP), SDLK_AGAIN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AGAIN), SDLK_UNDO = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_UNDO), SDLK_CUT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CUT), SDLK_COPY = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_COPY), SDLK_PASTE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PASTE), SDLK_FIND = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_FIND), SDLK_MUTE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MUTE), SDLK_VOLUMEUP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_VOLUMEUP), SDLK_VOLUMEDOWN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_VOLUMEDOWN), SDLK_KP_COMMA = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_COMMA), SDLK_KP_EQUALSAS400 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_EQUALSAS400), SDLK_ALTERASE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_ALTERASE), SDLK_SYSREQ = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SYSREQ), SDLK_CANCEL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CANCEL), SDLK_CLEAR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CLEAR), SDLK_PRIOR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PRIOR), SDLK_RETURN2 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RETURN2), SDLK_SEPARATOR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SEPARATOR), SDLK_OUT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_OUT), SDLK_OPER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_OPER), SDLK_CLEARAGAIN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CLEARAGAIN), SDLK_CRSEL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CRSEL), SDLK_EXSEL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_EXSEL), SDLK_KP_00 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_00), SDLK_KP_000 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_000), SDLK_THOUSANDSSEPARATOR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_THOUSANDSSEPARATOR), SDLK_DECIMALSEPARATOR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_DECIMALSEPARATOR), SDLK_CURRENCYUNIT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CURRENCYUNIT), SDLK_CURRENCYSUBUNIT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CURRENCYSUBUNIT), SDLK_KP_LEFTPAREN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_LEFTPAREN), SDLK_KP_RIGHTPAREN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_RIGHTPAREN), SDLK_KP_LEFTBRACE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_LEFTBRACE), SDLK_KP_RIGHTBRACE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_RIGHTBRACE), SDLK_KP_TAB = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_TAB), SDLK_KP_BACKSPACE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_BACKSPACE), SDLK_KP_A = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_A), SDLK_KP_B = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_B), SDLK_KP_C = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_C), SDLK_KP_D = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_D), SDLK_KP_E = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_E), SDLK_KP_F = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_F), SDLK_KP_XOR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_XOR), SDLK_KP_POWER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_POWER), SDLK_KP_PERCENT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_PERCENT), SDLK_KP_LESS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_LESS), SDLK_KP_GREATER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_GREATER), SDLK_KP_AMPERSAND = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_AMPERSAND), SDLK_KP_DBLAMPERSAND = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_DBLAMPERSAND), SDLK_KP_VERTICALBAR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_VERTICALBAR), SDLK_KP_DBLVERTICALBAR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_DBLVERTICALBAR), SDLK_KP_COLON = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_COLON), SDLK_KP_HASH = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_HASH), SDLK_KP_SPACE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_SPACE), SDLK_KP_AT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_AT), SDLK_KP_EXCLAM = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_EXCLAM), SDLK_KP_MEMSTORE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMSTORE), SDLK_KP_MEMRECALL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMRECALL), SDLK_KP_MEMCLEAR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMCLEAR), SDLK_KP_MEMADD = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMADD), SDLK_KP_MEMSUBTRACT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMSUBTRACT), SDLK_KP_MEMMULTIPLY = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMMULTIPLY), SDLK_KP_MEMDIVIDE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMDIVIDE), SDLK_KP_PLUSMINUS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_PLUSMINUS), SDLK_KP_CLEAR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_CLEAR), SDLK_KP_CLEARENTRY = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_CLEARENTRY), SDLK_KP_BINARY = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_BINARY), SDLK_KP_OCTAL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_OCTAL), SDLK_KP_DECIMAL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_DECIMAL), SDLK_KP_HEXADECIMAL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_HEXADECIMAL), SDLK_LCTRL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LCTRL), SDLK_LSHIFT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LSHIFT), SDLK_LALT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LALT), SDLK_LGUI = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LGUI), SDLK_RCTRL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RCTRL), SDLK_RSHIFT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RSHIFT), SDLK_RALT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RALT), SDLK_RGUI = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RGUI), SDLK_MODE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MODE), SDLK_AUDIONEXT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIONEXT), SDLK_AUDIOPREV = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOPREV), SDLK_AUDIOSTOP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOSTOP), SDLK_AUDIOPLAY = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOPLAY), SDLK_AUDIOMUTE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOMUTE), SDLK_MEDIASELECT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MEDIASELECT), SDLK_WWW = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_WWW), SDLK_MAIL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MAIL), SDLK_CALCULATOR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CALCULATOR), SDLK_COMPUTER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_COMPUTER), SDLK_AC_SEARCH = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_SEARCH), SDLK_AC_HOME = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_HOME), SDLK_AC_BACK = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_BACK), SDLK_AC_FORWARD = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_FORWARD), SDLK_AC_STOP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_STOP), SDLK_AC_REFRESH = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_REFRESH), SDLK_AC_BOOKMARKS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_BOOKMARKS), SDLK_BRIGHTNESSDOWN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_BRIGHTNESSDOWN), SDLK_BRIGHTNESSUP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_BRIGHTNESSUP), SDLK_DISPLAYSWITCH = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_DISPLAYSWITCH), SDLK_KBDILLUMTOGGLE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KBDILLUMTOGGLE), SDLK_KBDILLUMDOWN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KBDILLUMDOWN), SDLK_KBDILLUMUP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KBDILLUMUP), SDLK_EJECT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_EJECT), SDLK_SLEEP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SLEEP) }; /** * \brief Enumeration of valid key mods (possibly OR'd together). */ typedef enum { KMOD_NONE = 0x0000, KMOD_LSHIFT = 0x0001, KMOD_RSHIFT = 0x0002, KMOD_LCTRL = 0x0040, KMOD_RCTRL = 0x0080, KMOD_LALT = 0x0100, KMOD_RALT = 0x0200, KMOD_LGUI = 0x0400, KMOD_RGUI = 0x0800, KMOD_NUM = 0x1000, KMOD_CAPS = 0x2000, KMOD_MODE = 0x4000, KMOD_RESERVED = 0x8000 } SDL_Keymod; #define KMOD_CTRL (KMOD_LCTRL|KMOD_RCTRL) #define KMOD_SHIFT (KMOD_LSHIFT|KMOD_RSHIFT) #define KMOD_ALT (KMOD_LALT|KMOD_RALT) #define KMOD_GUI (KMOD_LGUI|KMOD_RGUI) #endif /* _SDL_keycode_h */ # 340 "/usr/local/include/SDL2/SDL_keycode.h" /* vi: set ts=4 sw=4 expandtab: */ # 34 "/usr/local/include/SDL2/SDL_keyboard.h" 2 #if 0 /* expanded by -frewrite-includes */ #include "SDL_video.h" #endif /* expanded by -frewrite-includes */ # 34 "/usr/local/include/SDL2/SDL_keyboard.h" # 35 "/usr/local/include/SDL2/SDL_keyboard.h" #if 0 /* expanded by -frewrite-includes */ #include "begin_code.h" #endif /* expanded by -frewrite-includes */ # 36 "/usr/local/include/SDL2/SDL_keyboard.h" # 1 "/usr/local/include/SDL2/begin_code.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file begin_code.h * * This file sets things up for C dynamic library function definitions, * static inlined functions, and structures aligned at 4-byte alignment. * If you don't like ugly C preprocessor code, don't look at this file. :) */ /* This shouldn't be nested -- included it around code only. */ #ifdef _begin_code_h #error Nested inclusion of begin_code.h #endif # 34 "/usr/local/include/SDL2/begin_code.h" #define _begin_code_h #ifndef SDL_DEPRECATED # if (__GNUC__ >= 4) /* technically, this arrived in gcc 3.1, but oh well. */ # define SDL_DEPRECATED __attribute__((deprecated)) # else # 40 "/usr/local/include/SDL2/begin_code.h" # define SDL_DEPRECATED # endif # 42 "/usr/local/include/SDL2/begin_code.h" #endif # 43 "/usr/local/include/SDL2/begin_code.h" /* Some compilers use a special export keyword */ #ifndef DECLSPEC # if defined(__WIN32__) || defined(__WINRT__) # ifdef __BORLANDC__ # ifdef BUILD_SDL # define DECLSPEC # else # 51 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllimport) # endif # 53 "/usr/local/include/SDL2/begin_code.h" # else # 54 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllexport) # endif # 56 "/usr/local/include/SDL2/begin_code.h" # else # 57 "/usr/local/include/SDL2/begin_code.h" # if defined(__GNUC__) && __GNUC__ >= 4 # define DECLSPEC __attribute__ ((visibility("default"))) # elif defined(__GNUC__) && __GNUC__ >= 2 # 60 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllexport) # else # 62 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC # endif # 64 "/usr/local/include/SDL2/begin_code.h" # endif # 65 "/usr/local/include/SDL2/begin_code.h" #endif # 66 "/usr/local/include/SDL2/begin_code.h" /* By default SDL uses the C calling convention */ #ifndef SDLCALL #if (defined(__WIN32__) || defined(__WINRT__)) && !defined(__GNUC__) #define SDLCALL __cdecl #else # 72 "/usr/local/include/SDL2/begin_code.h" #define SDLCALL #endif # 74 "/usr/local/include/SDL2/begin_code.h" #endif /* SDLCALL */ # 75 "/usr/local/include/SDL2/begin_code.h" /* Removed DECLSPEC on Symbian OS because SDL cannot be a DLL in EPOC */ #ifdef __SYMBIAN32__ #undef DECLSPEC #define DECLSPEC #endif /* __SYMBIAN32__ */ # 81 "/usr/local/include/SDL2/begin_code.h" /* Force structure packing at 4 byte alignment. This is necessary if the header is included in code which has structure packing set to an alternate value, say for loading structures from disk. The packing is reset to the previous value in close_code.h */ #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__) #ifdef _MSC_VER #pragma warning(disable: 4103) #endif # 91 "/usr/local/include/SDL2/begin_code.h" #ifdef __BORLANDC__ #pragma nopackwarning #endif # 94 "/usr/local/include/SDL2/begin_code.h" #ifdef _M_X64 /* Use 8-byte alignment on 64-bit architectures, so pointers are aligned */ #pragma pack(push,8) #else # 98 "/usr/local/include/SDL2/begin_code.h" #pragma pack(push,4) #endif # 100 "/usr/local/include/SDL2/begin_code.h" #endif /* Compiler needs structure packing set */ # 101 "/usr/local/include/SDL2/begin_code.h" #ifndef SDL_INLINE #if defined(__GNUC__) #define SDL_INLINE __inline__ #elif defined(_MSC_VER) || defined(__BORLANDC__) || \ defined(__DMC__) || defined(__SC__) || \ defined(__WATCOMC__) || defined(__LCC__) || \ defined(__DECC) # 109 "/usr/local/include/SDL2/begin_code.h" #define SDL_INLINE __inline #ifndef __inline__ #define __inline__ __inline #endif # 113 "/usr/local/include/SDL2/begin_code.h" #else # 114 "/usr/local/include/SDL2/begin_code.h" #define SDL_INLINE inline #ifndef __inline__ #define __inline__ inline #endif # 118 "/usr/local/include/SDL2/begin_code.h" #endif # 119 "/usr/local/include/SDL2/begin_code.h" #endif /* SDL_INLINE not defined */ # 120 "/usr/local/include/SDL2/begin_code.h" #ifndef SDL_FORCE_INLINE #if defined(_MSC_VER) #define SDL_FORCE_INLINE __forceinline #elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) ) # 125 "/usr/local/include/SDL2/begin_code.h" #define SDL_FORCE_INLINE __attribute__((always_inline)) static __inline__ #else # 127 "/usr/local/include/SDL2/begin_code.h" #define SDL_FORCE_INLINE static SDL_INLINE #endif # 129 "/usr/local/include/SDL2/begin_code.h" #endif /* SDL_FORCE_INLINE not defined */ # 130 "/usr/local/include/SDL2/begin_code.h" /* Apparently this is needed by several Windows compilers */ #if !defined(__MACH__) #ifndef NULL #ifdef __cplusplus #define NULL 0 #else # 137 "/usr/local/include/SDL2/begin_code.h" #define NULL ((void *)0) #endif # 139 "/usr/local/include/SDL2/begin_code.h" #endif /* NULL */ # 140 "/usr/local/include/SDL2/begin_code.h" #endif /* ! Mac OS X - breaks precompiled headers */ # 141 "/usr/local/include/SDL2/begin_code.h" # 37 "/usr/local/include/SDL2/SDL_keyboard.h" 2 /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif # 41 "/usr/local/include/SDL2/SDL_keyboard.h" /** * \brief The SDL keysym structure, used in key events. * * \note If you are looking for translated character input, see the ::SDL_TEXTINPUT event. */ typedef struct SDL_Keysym { SDL_Scancode scancode; /**< SDL physical key code - see ::SDL_Scancode for details */ SDL_Keycode sym; /**< SDL virtual key code - see ::SDL_Keycode for details */ Uint16 mod; /**< current key modifiers */ Uint32 unused; } SDL_Keysym; /* Function prototypes */ /** * \brief Get the window which currently has keyboard focus. */ extern DECLSPEC SDL_Window * SDLCALL SDL_GetKeyboardFocus(void); /** * \brief Get a snapshot of the current state of the keyboard. * * \param numkeys if non-NULL, receives the length of the returned array. * * \return An array of key states. Indexes into this array are obtained by using ::SDL_Scancode values. * * \b Example: * \code * const Uint8 *state = SDL_GetKeyboardState(NULL); * if ( state[SDL_SCANCODE_RETURN] ) { * printf(" is pressed.\n"); * } * \endcode */ extern DECLSPEC const Uint8 *SDLCALL SDL_GetKeyboardState(int *numkeys); /** * \brief Get the current key modifier state for the keyboard. */ extern DECLSPEC SDL_Keymod SDLCALL SDL_GetModState(void); /** * \brief Set the current key modifier state for the keyboard. * * \note This does not change the keyboard state, only the key modifier flags. */ extern DECLSPEC void SDLCALL SDL_SetModState(SDL_Keymod modstate); /** * \brief Get the key code corresponding to the given scancode according * to the current keyboard layout. * * See ::SDL_Keycode for details. * * \sa SDL_GetKeyName() */ extern DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromScancode(SDL_Scancode scancode); /** * \brief Get the scancode corresponding to the given key code according to the * current keyboard layout. * * See ::SDL_Scancode for details. * * \sa SDL_GetScancodeName() */ extern DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromKey(SDL_Keycode key); /** * \brief Get a human-readable name for a scancode. * * \return A pointer to the name for the scancode. * If the scancode doesn't have a name, this function returns * an empty string (""). * * \sa SDL_Scancode */ extern DECLSPEC const char *SDLCALL SDL_GetScancodeName(SDL_Scancode scancode); /** * \brief Get a scancode from a human-readable name * * \return scancode, or SDL_SCANCODE_UNKNOWN if the name wasn't recognized * * \sa SDL_Scancode */ extern DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromName(const char *name); /** * \brief Get a human-readable name for a key. * * \return A pointer to a UTF-8 string that stays valid at least until the next * call to this function. If you need it around any longer, you must * copy it. If the key doesn't have a name, this function returns an * empty string (""). * * \sa SDL_Key */ extern DECLSPEC const char *SDLCALL SDL_GetKeyName(SDL_Keycode key); /** * \brief Get a key code from a human-readable name * * \return key code, or SDLK_UNKNOWN if the name wasn't recognized * * \sa SDL_Keycode */ extern DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromName(const char *name); /** * \brief Start accepting Unicode text input events. * This function will show the on-screen keyboard if supported. * * \sa SDL_StopTextInput() * \sa SDL_SetTextInputRect() * \sa SDL_HasScreenKeyboardSupport() */ extern DECLSPEC void SDLCALL SDL_StartTextInput(void); /** * \brief Return whether or not Unicode text input events are enabled. * * \sa SDL_StartTextInput() * \sa SDL_StopTextInput() */ extern DECLSPEC SDL_bool SDLCALL SDL_IsTextInputActive(void); /** * \brief Stop receiving any text input events. * This function will hide the on-screen keyboard if supported. * * \sa SDL_StartTextInput() * \sa SDL_HasScreenKeyboardSupport() */ extern DECLSPEC void SDLCALL SDL_StopTextInput(void); /** * \brief Set the rectangle used to type Unicode text inputs. * This is used as a hint for IME and on-screen keyboard placement. * * \sa SDL_StartTextInput() */ extern DECLSPEC void SDLCALL SDL_SetTextInputRect(SDL_Rect *rect); /** * \brief Returns whether the platform has some screen keyboard support. * * \return SDL_TRUE if some keyboard support is available else SDL_FALSE. * * \note Not all screen keyboard functions are supported on all platforms. * * \sa SDL_IsScreenKeyboardShown() */ extern DECLSPEC SDL_bool SDLCALL SDL_HasScreenKeyboardSupport(void); /** * \brief Returns whether the screen keyboard is shown for given window. * * \param window The window for which screen keyboard should be queried. * * \return SDL_TRUE if screen keyboard is shown else SDL_FALSE. * * \sa SDL_HasScreenKeyboardSupport() */ extern DECLSPEC SDL_bool SDLCALL SDL_IsScreenKeyboardShown(SDL_Window *window); /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif # 213 "/usr/local/include/SDL2/SDL_keyboard.h" #if 0 /* expanded by -frewrite-includes */ #include "close_code.h" #endif /* expanded by -frewrite-includes */ # 213 "/usr/local/include/SDL2/SDL_keyboard.h" # 1 "/usr/local/include/SDL2/close_code.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file close_code.h * * This file reverses the effects of begin_code.h and should be included * after you finish any function and structure declarations in your headers */ #undef _begin_code_h /* Reset structure packing at previous byte alignment */ #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__WATCOMC__) || defined(__BORLANDC__) #ifdef __BORLANDC__ #pragma nopackwarning #endif # 36 "/usr/local/include/SDL2/close_code.h" #pragma pack(pop) #endif /* Compiler needs structure packing set */ # 38 "/usr/local/include/SDL2/close_code.h" # 214 "/usr/local/include/SDL2/SDL_keyboard.h" 2 #endif /* _SDL_keyboard_h */ # 216 "/usr/local/include/SDL2/SDL_keyboard.h" /* vi: set ts=4 sw=4 expandtab: */ # 35 "/usr/local/include/SDL2/SDL_events.h" 2 #if 0 /* expanded by -frewrite-includes */ #include "SDL_mouse.h" #endif /* expanded by -frewrite-includes */ # 35 "/usr/local/include/SDL2/SDL_events.h" # 1 "/usr/local/include/SDL2/SDL_mouse.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file SDL_mouse.h * * Include file for SDL mouse event handling. */ #ifndef _SDL_mouse_h #define _SDL_mouse_h #if 0 /* expanded by -frewrite-includes */ #include "SDL_stdinc.h" #endif /* expanded by -frewrite-includes */ # 31 "/usr/local/include/SDL2/SDL_mouse.h" # 32 "/usr/local/include/SDL2/SDL_mouse.h" #if 0 /* expanded by -frewrite-includes */ #include "SDL_error.h" #endif /* expanded by -frewrite-includes */ # 32 "/usr/local/include/SDL2/SDL_mouse.h" # 33 "/usr/local/include/SDL2/SDL_mouse.h" #if 0 /* expanded by -frewrite-includes */ #include "SDL_video.h" #endif /* expanded by -frewrite-includes */ # 33 "/usr/local/include/SDL2/SDL_mouse.h" # 34 "/usr/local/include/SDL2/SDL_mouse.h" #if 0 /* expanded by -frewrite-includes */ #include "begin_code.h" #endif /* expanded by -frewrite-includes */ # 35 "/usr/local/include/SDL2/SDL_mouse.h" # 1 "/usr/local/include/SDL2/begin_code.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file begin_code.h * * This file sets things up for C dynamic library function definitions, * static inlined functions, and structures aligned at 4-byte alignment. * If you don't like ugly C preprocessor code, don't look at this file. :) */ /* This shouldn't be nested -- included it around code only. */ #ifdef _begin_code_h #error Nested inclusion of begin_code.h #endif # 34 "/usr/local/include/SDL2/begin_code.h" #define _begin_code_h #ifndef SDL_DEPRECATED # if (__GNUC__ >= 4) /* technically, this arrived in gcc 3.1, but oh well. */ # define SDL_DEPRECATED __attribute__((deprecated)) # else # 40 "/usr/local/include/SDL2/begin_code.h" # define SDL_DEPRECATED # endif # 42 "/usr/local/include/SDL2/begin_code.h" #endif # 43 "/usr/local/include/SDL2/begin_code.h" /* Some compilers use a special export keyword */ #ifndef DECLSPEC # if defined(__WIN32__) || defined(__WINRT__) # ifdef __BORLANDC__ # ifdef BUILD_SDL # define DECLSPEC # else # 51 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllimport) # endif # 53 "/usr/local/include/SDL2/begin_code.h" # else # 54 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllexport) # endif # 56 "/usr/local/include/SDL2/begin_code.h" # else # 57 "/usr/local/include/SDL2/begin_code.h" # if defined(__GNUC__) && __GNUC__ >= 4 # define DECLSPEC __attribute__ ((visibility("default"))) # elif defined(__GNUC__) && __GNUC__ >= 2 # 60 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllexport) # else # 62 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC # endif # 64 "/usr/local/include/SDL2/begin_code.h" # endif # 65 "/usr/local/include/SDL2/begin_code.h" #endif # 66 "/usr/local/include/SDL2/begin_code.h" /* By default SDL uses the C calling convention */ #ifndef SDLCALL #if (defined(__WIN32__) || defined(__WINRT__)) && !defined(__GNUC__) #define SDLCALL __cdecl #else # 72 "/usr/local/include/SDL2/begin_code.h" #define SDLCALL #endif # 74 "/usr/local/include/SDL2/begin_code.h" #endif /* SDLCALL */ # 75 "/usr/local/include/SDL2/begin_code.h" /* Removed DECLSPEC on Symbian OS because SDL cannot be a DLL in EPOC */ #ifdef __SYMBIAN32__ #undef DECLSPEC #define DECLSPEC #endif /* __SYMBIAN32__ */ # 81 "/usr/local/include/SDL2/begin_code.h" /* Force structure packing at 4 byte alignment. This is necessary if the header is included in code which has structure packing set to an alternate value, say for loading structures from disk. The packing is reset to the previous value in close_code.h */ #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__) #ifdef _MSC_VER #pragma warning(disable: 4103) #endif # 91 "/usr/local/include/SDL2/begin_code.h" #ifdef __BORLANDC__ #pragma nopackwarning #endif # 94 "/usr/local/include/SDL2/begin_code.h" #ifdef _M_X64 /* Use 8-byte alignment on 64-bit architectures, so pointers are aligned */ #pragma pack(push,8) #else # 98 "/usr/local/include/SDL2/begin_code.h" #pragma pack(push,4) #endif # 100 "/usr/local/include/SDL2/begin_code.h" #endif /* Compiler needs structure packing set */ # 101 "/usr/local/include/SDL2/begin_code.h" #ifndef SDL_INLINE #if defined(__GNUC__) #define SDL_INLINE __inline__ #elif defined(_MSC_VER) || defined(__BORLANDC__) || \ defined(__DMC__) || defined(__SC__) || \ defined(__WATCOMC__) || defined(__LCC__) || \ defined(__DECC) # 109 "/usr/local/include/SDL2/begin_code.h" #define SDL_INLINE __inline #ifndef __inline__ #define __inline__ __inline #endif # 113 "/usr/local/include/SDL2/begin_code.h" #else # 114 "/usr/local/include/SDL2/begin_code.h" #define SDL_INLINE inline #ifndef __inline__ #define __inline__ inline #endif # 118 "/usr/local/include/SDL2/begin_code.h" #endif # 119 "/usr/local/include/SDL2/begin_code.h" #endif /* SDL_INLINE not defined */ # 120 "/usr/local/include/SDL2/begin_code.h" #ifndef SDL_FORCE_INLINE #if defined(_MSC_VER) #define SDL_FORCE_INLINE __forceinline #elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) ) # 125 "/usr/local/include/SDL2/begin_code.h" #define SDL_FORCE_INLINE __attribute__((always_inline)) static __inline__ #else # 127 "/usr/local/include/SDL2/begin_code.h" #define SDL_FORCE_INLINE static SDL_INLINE #endif # 129 "/usr/local/include/SDL2/begin_code.h" #endif /* SDL_FORCE_INLINE not defined */ # 130 "/usr/local/include/SDL2/begin_code.h" /* Apparently this is needed by several Windows compilers */ #if !defined(__MACH__) #ifndef NULL #ifdef __cplusplus #define NULL 0 #else # 137 "/usr/local/include/SDL2/begin_code.h" #define NULL ((void *)0) #endif # 139 "/usr/local/include/SDL2/begin_code.h" #endif /* NULL */ # 140 "/usr/local/include/SDL2/begin_code.h" #endif /* ! Mac OS X - breaks precompiled headers */ # 141 "/usr/local/include/SDL2/begin_code.h" # 36 "/usr/local/include/SDL2/SDL_mouse.h" 2 /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif # 40 "/usr/local/include/SDL2/SDL_mouse.h" typedef struct SDL_Cursor SDL_Cursor; /* Implementation dependent */ /** * \brief Cursor types for SDL_CreateSystemCursor. */ typedef enum { SDL_SYSTEM_CURSOR_ARROW, /**< Arrow */ SDL_SYSTEM_CURSOR_IBEAM, /**< I-beam */ SDL_SYSTEM_CURSOR_WAIT, /**< Wait */ SDL_SYSTEM_CURSOR_CROSSHAIR, /**< Crosshair */ SDL_SYSTEM_CURSOR_WAITARROW, /**< Small wait cursor (or Wait if not available) */ SDL_SYSTEM_CURSOR_SIZENWSE, /**< Double arrow pointing northwest and southeast */ SDL_SYSTEM_CURSOR_SIZENESW, /**< Double arrow pointing northeast and southwest */ SDL_SYSTEM_CURSOR_SIZEWE, /**< Double arrow pointing west and east */ SDL_SYSTEM_CURSOR_SIZENS, /**< Double arrow pointing north and south */ SDL_SYSTEM_CURSOR_SIZEALL, /**< Four pointed arrow pointing north, south, east, and west */ SDL_SYSTEM_CURSOR_NO, /**< Slashed circle or crossbones */ SDL_SYSTEM_CURSOR_HAND, /**< Hand */ SDL_NUM_SYSTEM_CURSORS } SDL_SystemCursor; /* Function prototypes */ /** * \brief Get the window which currently has mouse focus. */ extern DECLSPEC SDL_Window * SDLCALL SDL_GetMouseFocus(void); /** * \brief Retrieve the current state of the mouse. * * The current button state is returned as a button bitmask, which can * be tested using the SDL_BUTTON(X) macros, and x and y are set to the * mouse cursor position relative to the focus window for the currently * selected mouse. You can pass NULL for either x or y. */ extern DECLSPEC Uint32 SDLCALL SDL_GetMouseState(int *x, int *y); /** * \brief Retrieve the relative state of the mouse. * * The current button state is returned as a button bitmask, which can * be tested using the SDL_BUTTON(X) macros, and x and y are set to the * mouse deltas since the last call to SDL_GetRelativeMouseState(). */ extern DECLSPEC Uint32 SDLCALL SDL_GetRelativeMouseState(int *x, int *y); /** * \brief Moves the mouse to the given position within the window. * * \param window The window to move the mouse into, or NULL for the current mouse focus * \param x The x coordinate within the window * \param y The y coordinate within the window * * \note This function generates a mouse motion event */ extern DECLSPEC void SDLCALL SDL_WarpMouseInWindow(SDL_Window * window, int x, int y); /** * \brief Set relative mouse mode. * * \param enabled Whether or not to enable relative mode * * \return 0 on success, or -1 if relative mode is not supported. * * While the mouse is in relative mode, the cursor is hidden, and the * driver will try to report continuous motion in the current window. * Only relative motion events will be delivered, the mouse position * will not change. * * \note This function will flush any pending mouse motion. * * \sa SDL_GetRelativeMouseMode() */ extern DECLSPEC int SDLCALL SDL_SetRelativeMouseMode(SDL_bool enabled); /** * \brief Query whether relative mouse mode is enabled. * * \sa SDL_SetRelativeMouseMode() */ extern DECLSPEC SDL_bool SDLCALL SDL_GetRelativeMouseMode(void); /** * \brief Create a cursor, using the specified bitmap data and * mask (in MSB format). * * The cursor width must be a multiple of 8 bits. * * The cursor is created in black and white according to the following: * * * * * * *
data mask resulting pixel on screen
0 1 White
1 1 Black
0 0 Transparent
1 0 Inverted color if possible, black * if not.
* * \sa SDL_FreeCursor() */ extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateCursor(const Uint8 * data, const Uint8 * mask, int w, int h, int hot_x, int hot_y); /** * \brief Create a color cursor. * * \sa SDL_FreeCursor() */ extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateColorCursor(SDL_Surface *surface, int hot_x, int hot_y); /** * \brief Create a system cursor. * * \sa SDL_FreeCursor() */ extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateSystemCursor(SDL_SystemCursor id); /** * \brief Set the active cursor. */ extern DECLSPEC void SDLCALL SDL_SetCursor(SDL_Cursor * cursor); /** * \brief Return the active cursor. */ extern DECLSPEC SDL_Cursor *SDLCALL SDL_GetCursor(void); /** * \brief Return the default cursor. */ extern DECLSPEC SDL_Cursor *SDLCALL SDL_GetDefaultCursor(void); /** * \brief Frees a cursor created with SDL_CreateCursor(). * * \sa SDL_CreateCursor() */ extern DECLSPEC void SDLCALL SDL_FreeCursor(SDL_Cursor * cursor); /** * \brief Toggle whether or not the cursor is shown. * * \param toggle 1 to show the cursor, 0 to hide it, -1 to query the current * state. * * \return 1 if the cursor is shown, or 0 if the cursor is hidden. */ extern DECLSPEC int SDLCALL SDL_ShowCursor(int toggle); /** * Used as a mask when testing buttons in buttonstate. * - Button 1: Left mouse button * - Button 2: Middle mouse button * - Button 3: Right mouse button */ #define SDL_BUTTON(X) (1 << ((X)-1)) #define SDL_BUTTON_LEFT 1 #define SDL_BUTTON_MIDDLE 2 #define SDL_BUTTON_RIGHT 3 #define SDL_BUTTON_X1 4 #define SDL_BUTTON_X2 5 #define SDL_BUTTON_LMASK SDL_BUTTON(SDL_BUTTON_LEFT) #define SDL_BUTTON_MMASK SDL_BUTTON(SDL_BUTTON_MIDDLE) #define SDL_BUTTON_RMASK SDL_BUTTON(SDL_BUTTON_RIGHT) #define SDL_BUTTON_X1MASK SDL_BUTTON(SDL_BUTTON_X1) #define SDL_BUTTON_X2MASK SDL_BUTTON(SDL_BUTTON_X2) /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif # 220 "/usr/local/include/SDL2/SDL_mouse.h" #if 0 /* expanded by -frewrite-includes */ #include "close_code.h" #endif /* expanded by -frewrite-includes */ # 220 "/usr/local/include/SDL2/SDL_mouse.h" # 1 "/usr/local/include/SDL2/close_code.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file close_code.h * * This file reverses the effects of begin_code.h and should be included * after you finish any function and structure declarations in your headers */ #undef _begin_code_h /* Reset structure packing at previous byte alignment */ #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__WATCOMC__) || defined(__BORLANDC__) #ifdef __BORLANDC__ #pragma nopackwarning #endif # 36 "/usr/local/include/SDL2/close_code.h" #pragma pack(pop) #endif /* Compiler needs structure packing set */ # 38 "/usr/local/include/SDL2/close_code.h" # 221 "/usr/local/include/SDL2/SDL_mouse.h" 2 #endif /* _SDL_mouse_h */ # 223 "/usr/local/include/SDL2/SDL_mouse.h" /* vi: set ts=4 sw=4 expandtab: */ # 36 "/usr/local/include/SDL2/SDL_events.h" 2 #if 0 /* expanded by -frewrite-includes */ #include "SDL_joystick.h" #endif /* expanded by -frewrite-includes */ # 36 "/usr/local/include/SDL2/SDL_events.h" # 1 "/usr/local/include/SDL2/SDL_joystick.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file SDL_joystick.h * * Include file for SDL joystick event handling * * The term "device_index" identifies currently plugged in joystick devices between 0 and SDL_NumJoysticks, with the exact joystick * behind a device_index changing as joysticks are plugged and unplugged. * * The term "instance_id" is the current instantiation of a joystick device in the system, if the joystick is removed and then re-inserted * then it will get a new instance_id, instance_id's are monotonically increasing identifiers of a joystick plugged in. * * The term JoystickGUID is a stable 128-bit identifier for a joystick device that does not change over time, it identifies class of * the device (a X360 wired controller for example). This identifier is platform dependent. * * */ #ifndef _SDL_joystick_h #define _SDL_joystick_h #if 0 /* expanded by -frewrite-includes */ #include "SDL_stdinc.h" #endif /* expanded by -frewrite-includes */ # 42 "/usr/local/include/SDL2/SDL_joystick.h" # 43 "/usr/local/include/SDL2/SDL_joystick.h" #if 0 /* expanded by -frewrite-includes */ #include "SDL_error.h" #endif /* expanded by -frewrite-includes */ # 43 "/usr/local/include/SDL2/SDL_joystick.h" # 44 "/usr/local/include/SDL2/SDL_joystick.h" #if 0 /* expanded by -frewrite-includes */ #include "begin_code.h" #endif /* expanded by -frewrite-includes */ # 45 "/usr/local/include/SDL2/SDL_joystick.h" # 1 "/usr/local/include/SDL2/begin_code.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file begin_code.h * * This file sets things up for C dynamic library function definitions, * static inlined functions, and structures aligned at 4-byte alignment. * If you don't like ugly C preprocessor code, don't look at this file. :) */ /* This shouldn't be nested -- included it around code only. */ #ifdef _begin_code_h #error Nested inclusion of begin_code.h #endif # 34 "/usr/local/include/SDL2/begin_code.h" #define _begin_code_h #ifndef SDL_DEPRECATED # if (__GNUC__ >= 4) /* technically, this arrived in gcc 3.1, but oh well. */ # define SDL_DEPRECATED __attribute__((deprecated)) # else # 40 "/usr/local/include/SDL2/begin_code.h" # define SDL_DEPRECATED # endif # 42 "/usr/local/include/SDL2/begin_code.h" #endif # 43 "/usr/local/include/SDL2/begin_code.h" /* Some compilers use a special export keyword */ #ifndef DECLSPEC # if defined(__WIN32__) || defined(__WINRT__) # ifdef __BORLANDC__ # ifdef BUILD_SDL # define DECLSPEC # else # 51 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllimport) # endif # 53 "/usr/local/include/SDL2/begin_code.h" # else # 54 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllexport) # endif # 56 "/usr/local/include/SDL2/begin_code.h" # else # 57 "/usr/local/include/SDL2/begin_code.h" # if defined(__GNUC__) && __GNUC__ >= 4 # define DECLSPEC __attribute__ ((visibility("default"))) # elif defined(__GNUC__) && __GNUC__ >= 2 # 60 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllexport) # else # 62 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC # endif # 64 "/usr/local/include/SDL2/begin_code.h" # endif # 65 "/usr/local/include/SDL2/begin_code.h" #endif # 66 "/usr/local/include/SDL2/begin_code.h" /* By default SDL uses the C calling convention */ #ifndef SDLCALL #if (defined(__WIN32__) || defined(__WINRT__)) && !defined(__GNUC__) #define SDLCALL __cdecl #else # 72 "/usr/local/include/SDL2/begin_code.h" #define SDLCALL #endif # 74 "/usr/local/include/SDL2/begin_code.h" #endif /* SDLCALL */ # 75 "/usr/local/include/SDL2/begin_code.h" /* Removed DECLSPEC on Symbian OS because SDL cannot be a DLL in EPOC */ #ifdef __SYMBIAN32__ #undef DECLSPEC #define DECLSPEC #endif /* __SYMBIAN32__ */ # 81 "/usr/local/include/SDL2/begin_code.h" /* Force structure packing at 4 byte alignment. This is necessary if the header is included in code which has structure packing set to an alternate value, say for loading structures from disk. The packing is reset to the previous value in close_code.h */ #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__) #ifdef _MSC_VER #pragma warning(disable: 4103) #endif # 91 "/usr/local/include/SDL2/begin_code.h" #ifdef __BORLANDC__ #pragma nopackwarning #endif # 94 "/usr/local/include/SDL2/begin_code.h" #ifdef _M_X64 /* Use 8-byte alignment on 64-bit architectures, so pointers are aligned */ #pragma pack(push,8) #else # 98 "/usr/local/include/SDL2/begin_code.h" #pragma pack(push,4) #endif # 100 "/usr/local/include/SDL2/begin_code.h" #endif /* Compiler needs structure packing set */ # 101 "/usr/local/include/SDL2/begin_code.h" #ifndef SDL_INLINE #if defined(__GNUC__) #define SDL_INLINE __inline__ #elif defined(_MSC_VER) || defined(__BORLANDC__) || \ defined(__DMC__) || defined(__SC__) || \ defined(__WATCOMC__) || defined(__LCC__) || \ defined(__DECC) # 109 "/usr/local/include/SDL2/begin_code.h" #define SDL_INLINE __inline #ifndef __inline__ #define __inline__ __inline #endif # 113 "/usr/local/include/SDL2/begin_code.h" #else # 114 "/usr/local/include/SDL2/begin_code.h" #define SDL_INLINE inline #ifndef __inline__ #define __inline__ inline #endif # 118 "/usr/local/include/SDL2/begin_code.h" #endif # 119 "/usr/local/include/SDL2/begin_code.h" #endif /* SDL_INLINE not defined */ # 120 "/usr/local/include/SDL2/begin_code.h" #ifndef SDL_FORCE_INLINE #if defined(_MSC_VER) #define SDL_FORCE_INLINE __forceinline #elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) ) # 125 "/usr/local/include/SDL2/begin_code.h" #define SDL_FORCE_INLINE __attribute__((always_inline)) static __inline__ #else # 127 "/usr/local/include/SDL2/begin_code.h" #define SDL_FORCE_INLINE static SDL_INLINE #endif # 129 "/usr/local/include/SDL2/begin_code.h" #endif /* SDL_FORCE_INLINE not defined */ # 130 "/usr/local/include/SDL2/begin_code.h" /* Apparently this is needed by several Windows compilers */ #if !defined(__MACH__) #ifndef NULL #ifdef __cplusplus #define NULL 0 #else # 137 "/usr/local/include/SDL2/begin_code.h" #define NULL ((void *)0) #endif # 139 "/usr/local/include/SDL2/begin_code.h" #endif /* NULL */ # 140 "/usr/local/include/SDL2/begin_code.h" #endif /* ! Mac OS X - breaks precompiled headers */ # 141 "/usr/local/include/SDL2/begin_code.h" # 46 "/usr/local/include/SDL2/SDL_joystick.h" 2 /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif # 50 "/usr/local/include/SDL2/SDL_joystick.h" /** * \file SDL_joystick.h * * In order to use these functions, SDL_Init() must have been called * with the ::SDL_INIT_JOYSTICK flag. This causes SDL to scan the system * for joysticks, and load appropriate drivers. * * If you would like to receive joystick updates while the application * is in the background, you should set the following hint before calling * SDL_Init(): SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS */ /* The joystick structure used to identify an SDL joystick */ struct _SDL_Joystick; typedef struct _SDL_Joystick SDL_Joystick; /* A structure that encodes the stable unique id for a joystick device */ typedef struct { Uint8 data[16]; } SDL_JoystickGUID; typedef Sint32 SDL_JoystickID; /* Function prototypes */ /** * Count the number of joysticks attached to the system right now */ extern DECLSPEC int SDLCALL SDL_NumJoysticks(void); /** * Get the implementation dependent name of a joystick. * This can be called before any joysticks are opened. * If no name can be found, this function returns NULL. */ extern DECLSPEC const char *SDLCALL SDL_JoystickNameForIndex(int device_index); /** * Open a joystick for use. * The index passed as an argument refers tothe N'th joystick on the system. * This index is the value which will identify this joystick in future joystick * events. * * \return A joystick identifier, or NULL if an error occurred. */ extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickOpen(int device_index); /** * Return the name for this currently opened joystick. * If no name can be found, this function returns NULL. */ extern DECLSPEC const char *SDLCALL SDL_JoystickName(SDL_Joystick * joystick); /** * Return the GUID for the joystick at this index */ extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetDeviceGUID(int device_index); /** * Return the GUID for this opened joystick */ extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUID(SDL_Joystick * joystick); /** * Return a string representation for this guid. pszGUID must point to at least 33 bytes * (32 for the string plus a NULL terminator). */ extern DECLSPEC void SDLCALL SDL_JoystickGetGUIDString(SDL_JoystickGUID guid, char *pszGUID, int cbGUID); /** * convert a string into a joystick formatted guid */ extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUIDFromString(const char *pchGUID); /** * Returns SDL_TRUE if the joystick has been opened and currently connected, or SDL_FALSE if it has not. */ extern DECLSPEC SDL_bool SDLCALL SDL_JoystickGetAttached(SDL_Joystick * joystick); /** * Get the instance ID of an opened joystick or -1 if the joystick is invalid. */ extern DECLSPEC SDL_JoystickID SDLCALL SDL_JoystickInstanceID(SDL_Joystick * joystick); /** * Get the number of general axis controls on a joystick. */ extern DECLSPEC int SDLCALL SDL_JoystickNumAxes(SDL_Joystick * joystick); /** * Get the number of trackballs on a joystick. * * Joystick trackballs have only relative motion events associated * with them and their state cannot be polled. */ extern DECLSPEC int SDLCALL SDL_JoystickNumBalls(SDL_Joystick * joystick); /** * Get the number of POV hats on a joystick. */ extern DECLSPEC int SDLCALL SDL_JoystickNumHats(SDL_Joystick * joystick); /** * Get the number of buttons on a joystick. */ extern DECLSPEC int SDLCALL SDL_JoystickNumButtons(SDL_Joystick * joystick); /** * Update the current state of the open joysticks. * * This is called automatically by the event loop if any joystick * events are enabled. */ extern DECLSPEC void SDLCALL SDL_JoystickUpdate(void); /** * Enable/disable joystick event polling. * * If joystick events are disabled, you must call SDL_JoystickUpdate() * yourself and check the state of the joystick when you want joystick * information. * * The state can be one of ::SDL_QUERY, ::SDL_ENABLE or ::SDL_IGNORE. */ extern DECLSPEC int SDLCALL SDL_JoystickEventState(int state); /** * Get the current state of an axis control on a joystick. * * The state is a value ranging from -32768 to 32767. * * The axis indices start at index 0. */ extern DECLSPEC Sint16 SDLCALL SDL_JoystickGetAxis(SDL_Joystick * joystick, int axis); /** * \name Hat positions */ /* @{ */ #define SDL_HAT_CENTERED 0x00 #define SDL_HAT_UP 0x01 #define SDL_HAT_RIGHT 0x02 #define SDL_HAT_DOWN 0x04 #define SDL_HAT_LEFT 0x08 #define SDL_HAT_RIGHTUP (SDL_HAT_RIGHT|SDL_HAT_UP) #define SDL_HAT_RIGHTDOWN (SDL_HAT_RIGHT|SDL_HAT_DOWN) #define SDL_HAT_LEFTUP (SDL_HAT_LEFT|SDL_HAT_UP) #define SDL_HAT_LEFTDOWN (SDL_HAT_LEFT|SDL_HAT_DOWN) /* @} */ /** * Get the current state of a POV hat on a joystick. * * The hat indices start at index 0. * * \return The return value is one of the following positions: * - ::SDL_HAT_CENTERED * - ::SDL_HAT_UP * - ::SDL_HAT_RIGHT * - ::SDL_HAT_DOWN * - ::SDL_HAT_LEFT * - ::SDL_HAT_RIGHTUP * - ::SDL_HAT_RIGHTDOWN * - ::SDL_HAT_LEFTUP * - ::SDL_HAT_LEFTDOWN */ extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetHat(SDL_Joystick * joystick, int hat); /** * Get the ball axis change since the last poll. * * \return 0, or -1 if you passed it invalid parameters. * * The ball indices start at index 0. */ extern DECLSPEC int SDLCALL SDL_JoystickGetBall(SDL_Joystick * joystick, int ball, int *dx, int *dy); /** * Get the current state of a button on a joystick. * * The button indices start at index 0. */ extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetButton(SDL_Joystick * joystick, int button); /** * Close a joystick previously opened with SDL_JoystickOpen(). */ extern DECLSPEC void SDLCALL SDL_JoystickClose(SDL_Joystick * joystick); /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif # 249 "/usr/local/include/SDL2/SDL_joystick.h" #if 0 /* expanded by -frewrite-includes */ #include "close_code.h" #endif /* expanded by -frewrite-includes */ # 249 "/usr/local/include/SDL2/SDL_joystick.h" # 1 "/usr/local/include/SDL2/close_code.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file close_code.h * * This file reverses the effects of begin_code.h and should be included * after you finish any function and structure declarations in your headers */ #undef _begin_code_h /* Reset structure packing at previous byte alignment */ #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__WATCOMC__) || defined(__BORLANDC__) #ifdef __BORLANDC__ #pragma nopackwarning #endif # 36 "/usr/local/include/SDL2/close_code.h" #pragma pack(pop) #endif /* Compiler needs structure packing set */ # 38 "/usr/local/include/SDL2/close_code.h" # 250 "/usr/local/include/SDL2/SDL_joystick.h" 2 #endif /* _SDL_joystick_h */ # 252 "/usr/local/include/SDL2/SDL_joystick.h" /* vi: set ts=4 sw=4 expandtab: */ # 37 "/usr/local/include/SDL2/SDL_events.h" 2 #if 0 /* expanded by -frewrite-includes */ #include "SDL_gamecontroller.h" #endif /* expanded by -frewrite-includes */ # 37 "/usr/local/include/SDL2/SDL_events.h" # 1 "/usr/local/include/SDL2/SDL_gamecontroller.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file SDL_gamecontroller.h * * Include file for SDL game controller event handling */ #ifndef _SDL_gamecontroller_h #define _SDL_gamecontroller_h #if 0 /* expanded by -frewrite-includes */ #include "SDL_stdinc.h" #endif /* expanded by -frewrite-includes */ # 31 "/usr/local/include/SDL2/SDL_gamecontroller.h" # 32 "/usr/local/include/SDL2/SDL_gamecontroller.h" #if 0 /* expanded by -frewrite-includes */ #include "SDL_error.h" #endif /* expanded by -frewrite-includes */ # 32 "/usr/local/include/SDL2/SDL_gamecontroller.h" # 33 "/usr/local/include/SDL2/SDL_gamecontroller.h" #if 0 /* expanded by -frewrite-includes */ #include "SDL_rwops.h" #endif /* expanded by -frewrite-includes */ # 33 "/usr/local/include/SDL2/SDL_gamecontroller.h" # 34 "/usr/local/include/SDL2/SDL_gamecontroller.h" #if 0 /* expanded by -frewrite-includes */ #include "SDL_joystick.h" #endif /* expanded by -frewrite-includes */ # 34 "/usr/local/include/SDL2/SDL_gamecontroller.h" # 35 "/usr/local/include/SDL2/SDL_gamecontroller.h" #if 0 /* expanded by -frewrite-includes */ #include "begin_code.h" #endif /* expanded by -frewrite-includes */ # 36 "/usr/local/include/SDL2/SDL_gamecontroller.h" # 1 "/usr/local/include/SDL2/begin_code.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file begin_code.h * * This file sets things up for C dynamic library function definitions, * static inlined functions, and structures aligned at 4-byte alignment. * If you don't like ugly C preprocessor code, don't look at this file. :) */ /* This shouldn't be nested -- included it around code only. */ #ifdef _begin_code_h #error Nested inclusion of begin_code.h #endif # 34 "/usr/local/include/SDL2/begin_code.h" #define _begin_code_h #ifndef SDL_DEPRECATED # if (__GNUC__ >= 4) /* technically, this arrived in gcc 3.1, but oh well. */ # define SDL_DEPRECATED __attribute__((deprecated)) # else # 40 "/usr/local/include/SDL2/begin_code.h" # define SDL_DEPRECATED # endif # 42 "/usr/local/include/SDL2/begin_code.h" #endif # 43 "/usr/local/include/SDL2/begin_code.h" /* Some compilers use a special export keyword */ #ifndef DECLSPEC # if defined(__WIN32__) || defined(__WINRT__) # ifdef __BORLANDC__ # ifdef BUILD_SDL # define DECLSPEC # else # 51 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllimport) # endif # 53 "/usr/local/include/SDL2/begin_code.h" # else # 54 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllexport) # endif # 56 "/usr/local/include/SDL2/begin_code.h" # else # 57 "/usr/local/include/SDL2/begin_code.h" # if defined(__GNUC__) && __GNUC__ >= 4 # define DECLSPEC __attribute__ ((visibility("default"))) # elif defined(__GNUC__) && __GNUC__ >= 2 # 60 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllexport) # else # 62 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC # endif # 64 "/usr/local/include/SDL2/begin_code.h" # endif # 65 "/usr/local/include/SDL2/begin_code.h" #endif # 66 "/usr/local/include/SDL2/begin_code.h" /* By default SDL uses the C calling convention */ #ifndef SDLCALL #if (defined(__WIN32__) || defined(__WINRT__)) && !defined(__GNUC__) #define SDLCALL __cdecl #else # 72 "/usr/local/include/SDL2/begin_code.h" #define SDLCALL #endif # 74 "/usr/local/include/SDL2/begin_code.h" #endif /* SDLCALL */ # 75 "/usr/local/include/SDL2/begin_code.h" /* Removed DECLSPEC on Symbian OS because SDL cannot be a DLL in EPOC */ #ifdef __SYMBIAN32__ #undef DECLSPEC #define DECLSPEC #endif /* __SYMBIAN32__ */ # 81 "/usr/local/include/SDL2/begin_code.h" /* Force structure packing at 4 byte alignment. This is necessary if the header is included in code which has structure packing set to an alternate value, say for loading structures from disk. The packing is reset to the previous value in close_code.h */ #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__) #ifdef _MSC_VER #pragma warning(disable: 4103) #endif # 91 "/usr/local/include/SDL2/begin_code.h" #ifdef __BORLANDC__ #pragma nopackwarning #endif # 94 "/usr/local/include/SDL2/begin_code.h" #ifdef _M_X64 /* Use 8-byte alignment on 64-bit architectures, so pointers are aligned */ #pragma pack(push,8) #else # 98 "/usr/local/include/SDL2/begin_code.h" #pragma pack(push,4) #endif # 100 "/usr/local/include/SDL2/begin_code.h" #endif /* Compiler needs structure packing set */ # 101 "/usr/local/include/SDL2/begin_code.h" #ifndef SDL_INLINE #if defined(__GNUC__) #define SDL_INLINE __inline__ #elif defined(_MSC_VER) || defined(__BORLANDC__) || \ defined(__DMC__) || defined(__SC__) || \ defined(__WATCOMC__) || defined(__LCC__) || \ defined(__DECC) # 109 "/usr/local/include/SDL2/begin_code.h" #define SDL_INLINE __inline #ifndef __inline__ #define __inline__ __inline #endif # 113 "/usr/local/include/SDL2/begin_code.h" #else # 114 "/usr/local/include/SDL2/begin_code.h" #define SDL_INLINE inline #ifndef __inline__ #define __inline__ inline #endif # 118 "/usr/local/include/SDL2/begin_code.h" #endif # 119 "/usr/local/include/SDL2/begin_code.h" #endif /* SDL_INLINE not defined */ # 120 "/usr/local/include/SDL2/begin_code.h" #ifndef SDL_FORCE_INLINE #if defined(_MSC_VER) #define SDL_FORCE_INLINE __forceinline #elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) ) # 125 "/usr/local/include/SDL2/begin_code.h" #define SDL_FORCE_INLINE __attribute__((always_inline)) static __inline__ #else # 127 "/usr/local/include/SDL2/begin_code.h" #define SDL_FORCE_INLINE static SDL_INLINE #endif # 129 "/usr/local/include/SDL2/begin_code.h" #endif /* SDL_FORCE_INLINE not defined */ # 130 "/usr/local/include/SDL2/begin_code.h" /* Apparently this is needed by several Windows compilers */ #if !defined(__MACH__) #ifndef NULL #ifdef __cplusplus #define NULL 0 #else # 137 "/usr/local/include/SDL2/begin_code.h" #define NULL ((void *)0) #endif # 139 "/usr/local/include/SDL2/begin_code.h" #endif /* NULL */ # 140 "/usr/local/include/SDL2/begin_code.h" #endif /* ! Mac OS X - breaks precompiled headers */ # 141 "/usr/local/include/SDL2/begin_code.h" # 37 "/usr/local/include/SDL2/SDL_gamecontroller.h" 2 /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif # 41 "/usr/local/include/SDL2/SDL_gamecontroller.h" /** * \file SDL_gamecontroller.h * * In order to use these functions, SDL_Init() must have been called * with the ::SDL_INIT_JOYSTICK flag. This causes SDL to scan the system * for game controllers, and load appropriate drivers. * * If you would like to receive controller updates while the application * is in the background, you should set the following hint before calling * SDL_Init(): SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS */ /* The gamecontroller structure used to identify an SDL game controller */ struct _SDL_GameController; typedef struct _SDL_GameController SDL_GameController; typedef enum { SDL_CONTROLLER_BINDTYPE_NONE = 0, SDL_CONTROLLER_BINDTYPE_BUTTON, SDL_CONTROLLER_BINDTYPE_AXIS, SDL_CONTROLLER_BINDTYPE_HAT } SDL_GameControllerBindType; /** * Get the SDL joystick layer binding for this controller button/axis mapping */ typedef struct SDL_GameControllerButtonBind { SDL_GameControllerBindType bindType; union { int button; int axis; struct { int hat; int hat_mask; } hat; } value; } SDL_GameControllerButtonBind; /** * To count the number of game controllers in the system for the following: * int nJoysticks = SDL_NumJoysticks(); * int nGameControllers = 0; * for ( int i = 0; i < nJoysticks; i++ ) { * if ( SDL_IsGameController(i) ) { * nGameControllers++; * } * } * * Using the SDL_HINT_GAMECONTROLLERCONFIG hint or the SDL_GameControllerAddMapping you can add support for controllers SDL is unaware of or cause an existing controller to have a different binding. The format is: * guid,name,mappings * * Where GUID is the string value from SDL_JoystickGetGUIDString(), name is the human readable string for the device and mappings are controller mappings to joystick ones. * Under Windows there is a reserved GUID of "xinput" that covers any XInput devices. * The mapping format for joystick is: * bX - a joystick button, index X * hX.Y - hat X with value Y * aX - axis X of the joystick * Buttons can be used as a controller axis and vice versa. * * This string shows an example of a valid mapping for a controller * "341a3608000000000000504944564944,Afterglow PS3 Controller,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b8,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftshoulder:b4,rightshoulder:b5,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7", * */ /** * Load a set of mappings from a seekable SDL data stream (memory or file), filtered by the current SDL_GetPlatform() * A community sourced database of controllers is available at https://raw.github.com/gabomdq/SDL_GameControllerDB/master/gamecontrollerdb.txt * * If \c freerw is non-zero, the stream will be closed after being read. * * \return number of mappings added, -1 on error */ extern DECLSPEC int SDLCALL SDL_GameControllerAddMappingsFromRW( SDL_RWops * rw, int freerw ); /** * Load a set of mappings from a file, filtered by the current SDL_GetPlatform() * * Convenience macro. */ #define SDL_GameControllerAddMappingsFromFile(file) SDL_GameControllerAddMappingsFromRW(SDL_RWFromFile(file, "rb"), 1) /** * Add or update an existing mapping configuration * * \return 1 if mapping is added, 0 if updated, -1 on error */ extern DECLSPEC int SDLCALL SDL_GameControllerAddMapping( const char* mappingString ); /** * Get a mapping string for a GUID * * \return the mapping string. Must be freed with SDL_free. Returns NULL if no mapping is available */ extern DECLSPEC char * SDLCALL SDL_GameControllerMappingForGUID( SDL_JoystickGUID guid ); /** * Get a mapping string for an open GameController * * \return the mapping string. Must be freed with SDL_free. Returns NULL if no mapping is available */ extern DECLSPEC char * SDLCALL SDL_GameControllerMapping( SDL_GameController * gamecontroller ); /** * Is the joystick on this index supported by the game controller interface? */ extern DECLSPEC SDL_bool SDLCALL SDL_IsGameController(int joystick_index); /** * Get the implementation dependent name of a game controller. * This can be called before any controllers are opened. * If no name can be found, this function returns NULL. */ extern DECLSPEC const char *SDLCALL SDL_GameControllerNameForIndex(int joystick_index); /** * Open a game controller for use. * The index passed as an argument refers to the N'th game controller on the system. * This index is the value which will identify this controller in future controller * events. * * \return A controller identifier, or NULL if an error occurred. */ extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerOpen(int joystick_index); /** * Return the name for this currently opened controller */ extern DECLSPEC const char *SDLCALL SDL_GameControllerName(SDL_GameController *gamecontroller); /** * Returns SDL_TRUE if the controller has been opened and currently connected, * or SDL_FALSE if it has not. */ extern DECLSPEC SDL_bool SDLCALL SDL_GameControllerGetAttached(SDL_GameController *gamecontroller); /** * Get the underlying joystick object used by a controller */ extern DECLSPEC SDL_Joystick *SDLCALL SDL_GameControllerGetJoystick(SDL_GameController *gamecontroller); /** * Enable/disable controller event polling. * * If controller events are disabled, you must call SDL_GameControllerUpdate() * yourself and check the state of the controller when you want controller * information. * * The state can be one of ::SDL_QUERY, ::SDL_ENABLE or ::SDL_IGNORE. */ extern DECLSPEC int SDLCALL SDL_GameControllerEventState(int state); /** * Update the current state of the open game controllers. * * This is called automatically by the event loop if any game controller * events are enabled. */ extern DECLSPEC void SDLCALL SDL_GameControllerUpdate(void); /** * The list of axes available from a controller */ typedef enum { SDL_CONTROLLER_AXIS_INVALID = -1, SDL_CONTROLLER_AXIS_LEFTX, SDL_CONTROLLER_AXIS_LEFTY, SDL_CONTROLLER_AXIS_RIGHTX, SDL_CONTROLLER_AXIS_RIGHTY, SDL_CONTROLLER_AXIS_TRIGGERLEFT, SDL_CONTROLLER_AXIS_TRIGGERRIGHT, SDL_CONTROLLER_AXIS_MAX } SDL_GameControllerAxis; /** * turn this string into a axis mapping */ extern DECLSPEC SDL_GameControllerAxis SDLCALL SDL_GameControllerGetAxisFromString(const char *pchString); /** * turn this axis enum into a string mapping */ extern DECLSPEC const char* SDLCALL SDL_GameControllerGetStringForAxis(SDL_GameControllerAxis axis); /** * Get the SDL joystick layer binding for this controller button mapping */ extern DECLSPEC SDL_GameControllerButtonBind SDLCALL SDL_GameControllerGetBindForAxis(SDL_GameController *gamecontroller, SDL_GameControllerAxis axis); /** * Get the current state of an axis control on a game controller. * * The state is a value ranging from -32768 to 32767. * * The axis indices start at index 0. */ extern DECLSPEC Sint16 SDLCALL SDL_GameControllerGetAxis(SDL_GameController *gamecontroller, SDL_GameControllerAxis axis); /** * The list of buttons available from a controller */ typedef enum { SDL_CONTROLLER_BUTTON_INVALID = -1, SDL_CONTROLLER_BUTTON_A, SDL_CONTROLLER_BUTTON_B, SDL_CONTROLLER_BUTTON_X, SDL_CONTROLLER_BUTTON_Y, SDL_CONTROLLER_BUTTON_BACK, SDL_CONTROLLER_BUTTON_GUIDE, SDL_CONTROLLER_BUTTON_START, SDL_CONTROLLER_BUTTON_LEFTSTICK, SDL_CONTROLLER_BUTTON_RIGHTSTICK, SDL_CONTROLLER_BUTTON_LEFTSHOULDER, SDL_CONTROLLER_BUTTON_RIGHTSHOULDER, SDL_CONTROLLER_BUTTON_DPAD_UP, SDL_CONTROLLER_BUTTON_DPAD_DOWN, SDL_CONTROLLER_BUTTON_DPAD_LEFT, SDL_CONTROLLER_BUTTON_DPAD_RIGHT, SDL_CONTROLLER_BUTTON_MAX } SDL_GameControllerButton; /** * turn this string into a button mapping */ extern DECLSPEC SDL_GameControllerButton SDLCALL SDL_GameControllerGetButtonFromString(const char *pchString); /** * turn this button enum into a string mapping */ extern DECLSPEC const char* SDLCALL SDL_GameControllerGetStringForButton(SDL_GameControllerButton button); /** * Get the SDL joystick layer binding for this controller button mapping */ extern DECLSPEC SDL_GameControllerButtonBind SDLCALL SDL_GameControllerGetBindForButton(SDL_GameController *gamecontroller, SDL_GameControllerButton button); /** * Get the current state of a button on a game controller. * * The button indices start at index 0. */ extern DECLSPEC Uint8 SDLCALL SDL_GameControllerGetButton(SDL_GameController *gamecontroller, SDL_GameControllerButton button); /** * Close a controller previously opened with SDL_GameControllerOpen(). */ extern DECLSPEC void SDLCALL SDL_GameControllerClose(SDL_GameController *gamecontroller); /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif # 312 "/usr/local/include/SDL2/SDL_gamecontroller.h" #if 0 /* expanded by -frewrite-includes */ #include "close_code.h" #endif /* expanded by -frewrite-includes */ # 312 "/usr/local/include/SDL2/SDL_gamecontroller.h" # 1 "/usr/local/include/SDL2/close_code.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file close_code.h * * This file reverses the effects of begin_code.h and should be included * after you finish any function and structure declarations in your headers */ #undef _begin_code_h /* Reset structure packing at previous byte alignment */ #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__WATCOMC__) || defined(__BORLANDC__) #ifdef __BORLANDC__ #pragma nopackwarning #endif # 36 "/usr/local/include/SDL2/close_code.h" #pragma pack(pop) #endif /* Compiler needs structure packing set */ # 38 "/usr/local/include/SDL2/close_code.h" # 313 "/usr/local/include/SDL2/SDL_gamecontroller.h" 2 #endif /* _SDL_gamecontroller_h */ # 315 "/usr/local/include/SDL2/SDL_gamecontroller.h" /* vi: set ts=4 sw=4 expandtab: */ # 38 "/usr/local/include/SDL2/SDL_events.h" 2 #if 0 /* expanded by -frewrite-includes */ #include "SDL_quit.h" #endif /* expanded by -frewrite-includes */ # 38 "/usr/local/include/SDL2/SDL_events.h" # 1 "/usr/local/include/SDL2/SDL_quit.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file SDL_quit.h * * Include file for SDL quit event handling. */ #ifndef _SDL_quit_h #define _SDL_quit_h #if 0 /* expanded by -frewrite-includes */ #include "SDL_stdinc.h" #endif /* expanded by -frewrite-includes */ # 31 "/usr/local/include/SDL2/SDL_quit.h" # 32 "/usr/local/include/SDL2/SDL_quit.h" #if 0 /* expanded by -frewrite-includes */ #include "SDL_error.h" #endif /* expanded by -frewrite-includes */ # 32 "/usr/local/include/SDL2/SDL_quit.h" # 33 "/usr/local/include/SDL2/SDL_quit.h" /** * \file SDL_quit.h * * An ::SDL_QUIT event is generated when the user tries to close the application * window. If it is ignored or filtered out, the window will remain open. * If it is not ignored or filtered, it is queued normally and the window * is allowed to close. When the window is closed, screen updates will * complete, but have no effect. * * SDL_Init() installs signal handlers for SIGINT (keyboard interrupt) * and SIGTERM (system termination request), if handlers do not already * exist, that generate ::SDL_QUIT events as well. There is no way * to determine the cause of an ::SDL_QUIT event, but setting a signal * handler in your application will override the default generation of * quit events for that signal. * * \sa SDL_Quit() */ /* There are no functions directly affecting the quit event */ #define SDL_QuitRequested() \ (SDL_PumpEvents(), (SDL_PeepEvents(NULL,0,SDL_PEEKEVENT,SDL_QUIT,SDL_QUIT) > 0)) #endif /* _SDL_quit_h */ # 59 "/usr/local/include/SDL2/SDL_quit.h" # 39 "/usr/local/include/SDL2/SDL_events.h" 2 #if 0 /* expanded by -frewrite-includes */ #include "SDL_gesture.h" #endif /* expanded by -frewrite-includes */ # 39 "/usr/local/include/SDL2/SDL_events.h" # 1 "/usr/local/include/SDL2/SDL_gesture.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file SDL_gesture.h * * Include file for SDL gesture event handling. */ #ifndef _SDL_gesture_h #define _SDL_gesture_h #if 0 /* expanded by -frewrite-includes */ #include "SDL_stdinc.h" #endif /* expanded by -frewrite-includes */ # 31 "/usr/local/include/SDL2/SDL_gesture.h" # 32 "/usr/local/include/SDL2/SDL_gesture.h" #if 0 /* expanded by -frewrite-includes */ #include "SDL_error.h" #endif /* expanded by -frewrite-includes */ # 32 "/usr/local/include/SDL2/SDL_gesture.h" # 33 "/usr/local/include/SDL2/SDL_gesture.h" #if 0 /* expanded by -frewrite-includes */ #include "SDL_video.h" #endif /* expanded by -frewrite-includes */ # 33 "/usr/local/include/SDL2/SDL_gesture.h" # 34 "/usr/local/include/SDL2/SDL_gesture.h" #if 0 /* expanded by -frewrite-includes */ #include "SDL_touch.h" #endif /* expanded by -frewrite-includes */ # 35 "/usr/local/include/SDL2/SDL_gesture.h" # 1 "/usr/local/include/SDL2/SDL_touch.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file SDL_touch.h * * Include file for SDL touch event handling. */ #ifndef _SDL_touch_h #define _SDL_touch_h #if 0 /* expanded by -frewrite-includes */ #include "SDL_stdinc.h" #endif /* expanded by -frewrite-includes */ # 31 "/usr/local/include/SDL2/SDL_touch.h" # 32 "/usr/local/include/SDL2/SDL_touch.h" #if 0 /* expanded by -frewrite-includes */ #include "SDL_error.h" #endif /* expanded by -frewrite-includes */ # 32 "/usr/local/include/SDL2/SDL_touch.h" # 33 "/usr/local/include/SDL2/SDL_touch.h" #if 0 /* expanded by -frewrite-includes */ #include "SDL_video.h" #endif /* expanded by -frewrite-includes */ # 33 "/usr/local/include/SDL2/SDL_touch.h" # 34 "/usr/local/include/SDL2/SDL_touch.h" #if 0 /* expanded by -frewrite-includes */ #include "begin_code.h" #endif /* expanded by -frewrite-includes */ # 35 "/usr/local/include/SDL2/SDL_touch.h" # 1 "/usr/local/include/SDL2/begin_code.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file begin_code.h * * This file sets things up for C dynamic library function definitions, * static inlined functions, and structures aligned at 4-byte alignment. * If you don't like ugly C preprocessor code, don't look at this file. :) */ /* This shouldn't be nested -- included it around code only. */ #ifdef _begin_code_h #error Nested inclusion of begin_code.h #endif # 34 "/usr/local/include/SDL2/begin_code.h" #define _begin_code_h #ifndef SDL_DEPRECATED # if (__GNUC__ >= 4) /* technically, this arrived in gcc 3.1, but oh well. */ # define SDL_DEPRECATED __attribute__((deprecated)) # else # 40 "/usr/local/include/SDL2/begin_code.h" # define SDL_DEPRECATED # endif # 42 "/usr/local/include/SDL2/begin_code.h" #endif # 43 "/usr/local/include/SDL2/begin_code.h" /* Some compilers use a special export keyword */ #ifndef DECLSPEC # if defined(__WIN32__) || defined(__WINRT__) # ifdef __BORLANDC__ # ifdef BUILD_SDL # define DECLSPEC # else # 51 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllimport) # endif # 53 "/usr/local/include/SDL2/begin_code.h" # else # 54 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllexport) # endif # 56 "/usr/local/include/SDL2/begin_code.h" # else # 57 "/usr/local/include/SDL2/begin_code.h" # if defined(__GNUC__) && __GNUC__ >= 4 # define DECLSPEC __attribute__ ((visibility("default"))) # elif defined(__GNUC__) && __GNUC__ >= 2 # 60 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllexport) # else # 62 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC # endif # 64 "/usr/local/include/SDL2/begin_code.h" # endif # 65 "/usr/local/include/SDL2/begin_code.h" #endif # 66 "/usr/local/include/SDL2/begin_code.h" /* By default SDL uses the C calling convention */ #ifndef SDLCALL #if (defined(__WIN32__) || defined(__WINRT__)) && !defined(__GNUC__) #define SDLCALL __cdecl #else # 72 "/usr/local/include/SDL2/begin_code.h" #define SDLCALL #endif # 74 "/usr/local/include/SDL2/begin_code.h" #endif /* SDLCALL */ # 75 "/usr/local/include/SDL2/begin_code.h" /* Removed DECLSPEC on Symbian OS because SDL cannot be a DLL in EPOC */ #ifdef __SYMBIAN32__ #undef DECLSPEC #define DECLSPEC #endif /* __SYMBIAN32__ */ # 81 "/usr/local/include/SDL2/begin_code.h" /* Force structure packing at 4 byte alignment. This is necessary if the header is included in code which has structure packing set to an alternate value, say for loading structures from disk. The packing is reset to the previous value in close_code.h */ #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__) #ifdef _MSC_VER #pragma warning(disable: 4103) #endif # 91 "/usr/local/include/SDL2/begin_code.h" #ifdef __BORLANDC__ #pragma nopackwarning #endif # 94 "/usr/local/include/SDL2/begin_code.h" #ifdef _M_X64 /* Use 8-byte alignment on 64-bit architectures, so pointers are aligned */ #pragma pack(push,8) #else # 98 "/usr/local/include/SDL2/begin_code.h" #pragma pack(push,4) #endif # 100 "/usr/local/include/SDL2/begin_code.h" #endif /* Compiler needs structure packing set */ # 101 "/usr/local/include/SDL2/begin_code.h" #ifndef SDL_INLINE #if defined(__GNUC__) #define SDL_INLINE __inline__ #elif defined(_MSC_VER) || defined(__BORLANDC__) || \ defined(__DMC__) || defined(__SC__) || \ defined(__WATCOMC__) || defined(__LCC__) || \ defined(__DECC) # 109 "/usr/local/include/SDL2/begin_code.h" #define SDL_INLINE __inline #ifndef __inline__ #define __inline__ __inline #endif # 113 "/usr/local/include/SDL2/begin_code.h" #else # 114 "/usr/local/include/SDL2/begin_code.h" #define SDL_INLINE inline #ifndef __inline__ #define __inline__ inline #endif # 118 "/usr/local/include/SDL2/begin_code.h" #endif # 119 "/usr/local/include/SDL2/begin_code.h" #endif /* SDL_INLINE not defined */ # 120 "/usr/local/include/SDL2/begin_code.h" #ifndef SDL_FORCE_INLINE #if defined(_MSC_VER) #define SDL_FORCE_INLINE __forceinline #elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) ) # 125 "/usr/local/include/SDL2/begin_code.h" #define SDL_FORCE_INLINE __attribute__((always_inline)) static __inline__ #else # 127 "/usr/local/include/SDL2/begin_code.h" #define SDL_FORCE_INLINE static SDL_INLINE #endif # 129 "/usr/local/include/SDL2/begin_code.h" #endif /* SDL_FORCE_INLINE not defined */ # 130 "/usr/local/include/SDL2/begin_code.h" /* Apparently this is needed by several Windows compilers */ #if !defined(__MACH__) #ifndef NULL #ifdef __cplusplus #define NULL 0 #else # 137 "/usr/local/include/SDL2/begin_code.h" #define NULL ((void *)0) #endif # 139 "/usr/local/include/SDL2/begin_code.h" #endif /* NULL */ # 140 "/usr/local/include/SDL2/begin_code.h" #endif /* ! Mac OS X - breaks precompiled headers */ # 141 "/usr/local/include/SDL2/begin_code.h" # 36 "/usr/local/include/SDL2/SDL_touch.h" 2 /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif # 40 "/usr/local/include/SDL2/SDL_touch.h" typedef Sint64 SDL_TouchID; typedef Sint64 SDL_FingerID; typedef struct SDL_Finger { SDL_FingerID id; float x; float y; float pressure; } SDL_Finger; /* Used as the device ID for mouse events simulated with touch input */ #define SDL_TOUCH_MOUSEID ((Uint32)-1) /* Function prototypes */ /** * \brief Get the number of registered touch devices. */ extern DECLSPEC int SDLCALL SDL_GetNumTouchDevices(void); /** * \brief Get the touch ID with the given index, or 0 if the index is invalid. */ extern DECLSPEC SDL_TouchID SDLCALL SDL_GetTouchDevice(int index); /** * \brief Get the number of active fingers for a given touch device. */ extern DECLSPEC int SDLCALL SDL_GetNumTouchFingers(SDL_TouchID touchID); /** * \brief Get the finger object of the given touch, with the given index. */ extern DECLSPEC SDL_Finger * SDLCALL SDL_GetTouchFinger(SDL_TouchID touchID, int index); /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif # 82 "/usr/local/include/SDL2/SDL_touch.h" #if 0 /* expanded by -frewrite-includes */ #include "close_code.h" #endif /* expanded by -frewrite-includes */ # 82 "/usr/local/include/SDL2/SDL_touch.h" # 1 "/usr/local/include/SDL2/close_code.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file close_code.h * * This file reverses the effects of begin_code.h and should be included * after you finish any function and structure declarations in your headers */ #undef _begin_code_h /* Reset structure packing at previous byte alignment */ #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__WATCOMC__) || defined(__BORLANDC__) #ifdef __BORLANDC__ #pragma nopackwarning #endif # 36 "/usr/local/include/SDL2/close_code.h" #pragma pack(pop) #endif /* Compiler needs structure packing set */ # 38 "/usr/local/include/SDL2/close_code.h" # 83 "/usr/local/include/SDL2/SDL_touch.h" 2 #endif /* _SDL_touch_h */ # 85 "/usr/local/include/SDL2/SDL_touch.h" /* vi: set ts=4 sw=4 expandtab: */ # 36 "/usr/local/include/SDL2/SDL_gesture.h" 2 #if 0 /* expanded by -frewrite-includes */ #include "begin_code.h" #endif /* expanded by -frewrite-includes */ # 38 "/usr/local/include/SDL2/SDL_gesture.h" # 1 "/usr/local/include/SDL2/begin_code.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file begin_code.h * * This file sets things up for C dynamic library function definitions, * static inlined functions, and structures aligned at 4-byte alignment. * If you don't like ugly C preprocessor code, don't look at this file. :) */ /* This shouldn't be nested -- included it around code only. */ #ifdef _begin_code_h #error Nested inclusion of begin_code.h #endif # 34 "/usr/local/include/SDL2/begin_code.h" #define _begin_code_h #ifndef SDL_DEPRECATED # if (__GNUC__ >= 4) /* technically, this arrived in gcc 3.1, but oh well. */ # define SDL_DEPRECATED __attribute__((deprecated)) # else # 40 "/usr/local/include/SDL2/begin_code.h" # define SDL_DEPRECATED # endif # 42 "/usr/local/include/SDL2/begin_code.h" #endif # 43 "/usr/local/include/SDL2/begin_code.h" /* Some compilers use a special export keyword */ #ifndef DECLSPEC # if defined(__WIN32__) || defined(__WINRT__) # ifdef __BORLANDC__ # ifdef BUILD_SDL # define DECLSPEC # else # 51 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllimport) # endif # 53 "/usr/local/include/SDL2/begin_code.h" # else # 54 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllexport) # endif # 56 "/usr/local/include/SDL2/begin_code.h" # else # 57 "/usr/local/include/SDL2/begin_code.h" # if defined(__GNUC__) && __GNUC__ >= 4 # define DECLSPEC __attribute__ ((visibility("default"))) # elif defined(__GNUC__) && __GNUC__ >= 2 # 60 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllexport) # else # 62 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC # endif # 64 "/usr/local/include/SDL2/begin_code.h" # endif # 65 "/usr/local/include/SDL2/begin_code.h" #endif # 66 "/usr/local/include/SDL2/begin_code.h" /* By default SDL uses the C calling convention */ #ifndef SDLCALL #if (defined(__WIN32__) || defined(__WINRT__)) && !defined(__GNUC__) #define SDLCALL __cdecl #else # 72 "/usr/local/include/SDL2/begin_code.h" #define SDLCALL #endif # 74 "/usr/local/include/SDL2/begin_code.h" #endif /* SDLCALL */ # 75 "/usr/local/include/SDL2/begin_code.h" /* Removed DECLSPEC on Symbian OS because SDL cannot be a DLL in EPOC */ #ifdef __SYMBIAN32__ #undef DECLSPEC #define DECLSPEC #endif /* __SYMBIAN32__ */ # 81 "/usr/local/include/SDL2/begin_code.h" /* Force structure packing at 4 byte alignment. This is necessary if the header is included in code which has structure packing set to an alternate value, say for loading structures from disk. The packing is reset to the previous value in close_code.h */ #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__) #ifdef _MSC_VER #pragma warning(disable: 4103) #endif # 91 "/usr/local/include/SDL2/begin_code.h" #ifdef __BORLANDC__ #pragma nopackwarning #endif # 94 "/usr/local/include/SDL2/begin_code.h" #ifdef _M_X64 /* Use 8-byte alignment on 64-bit architectures, so pointers are aligned */ #pragma pack(push,8) #else # 98 "/usr/local/include/SDL2/begin_code.h" #pragma pack(push,4) #endif # 100 "/usr/local/include/SDL2/begin_code.h" #endif /* Compiler needs structure packing set */ # 101 "/usr/local/include/SDL2/begin_code.h" #ifndef SDL_INLINE #if defined(__GNUC__) #define SDL_INLINE __inline__ #elif defined(_MSC_VER) || defined(__BORLANDC__) || \ defined(__DMC__) || defined(__SC__) || \ defined(__WATCOMC__) || defined(__LCC__) || \ defined(__DECC) # 109 "/usr/local/include/SDL2/begin_code.h" #define SDL_INLINE __inline #ifndef __inline__ #define __inline__ __inline #endif # 113 "/usr/local/include/SDL2/begin_code.h" #else # 114 "/usr/local/include/SDL2/begin_code.h" #define SDL_INLINE inline #ifndef __inline__ #define __inline__ inline #endif # 118 "/usr/local/include/SDL2/begin_code.h" #endif # 119 "/usr/local/include/SDL2/begin_code.h" #endif /* SDL_INLINE not defined */ # 120 "/usr/local/include/SDL2/begin_code.h" #ifndef SDL_FORCE_INLINE #if defined(_MSC_VER) #define SDL_FORCE_INLINE __forceinline #elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) ) # 125 "/usr/local/include/SDL2/begin_code.h" #define SDL_FORCE_INLINE __attribute__((always_inline)) static __inline__ #else # 127 "/usr/local/include/SDL2/begin_code.h" #define SDL_FORCE_INLINE static SDL_INLINE #endif # 129 "/usr/local/include/SDL2/begin_code.h" #endif /* SDL_FORCE_INLINE not defined */ # 130 "/usr/local/include/SDL2/begin_code.h" /* Apparently this is needed by several Windows compilers */ #if !defined(__MACH__) #ifndef NULL #ifdef __cplusplus #define NULL 0 #else # 137 "/usr/local/include/SDL2/begin_code.h" #define NULL ((void *)0) #endif # 139 "/usr/local/include/SDL2/begin_code.h" #endif /* NULL */ # 140 "/usr/local/include/SDL2/begin_code.h" #endif /* ! Mac OS X - breaks precompiled headers */ # 141 "/usr/local/include/SDL2/begin_code.h" # 39 "/usr/local/include/SDL2/SDL_gesture.h" 2 /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif # 43 "/usr/local/include/SDL2/SDL_gesture.h" typedef Sint64 SDL_GestureID; /* Function prototypes */ /** * \brief Begin Recording a gesture on the specified touch, or all touches (-1) * * */ extern DECLSPEC int SDLCALL SDL_RecordGesture(SDL_TouchID touchId); /** * \brief Save all currently loaded Dollar Gesture templates * * */ extern DECLSPEC int SDLCALL SDL_SaveAllDollarTemplates(SDL_RWops *dst); /** * \brief Save a currently loaded Dollar Gesture template * * */ extern DECLSPEC int SDLCALL SDL_SaveDollarTemplate(SDL_GestureID gestureId,SDL_RWops *dst); /** * \brief Load Dollar Gesture templates from a file * * */ extern DECLSPEC int SDLCALL SDL_LoadDollarTemplates(SDL_TouchID touchId, SDL_RWops *src); /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif # 83 "/usr/local/include/SDL2/SDL_gesture.h" #if 0 /* expanded by -frewrite-includes */ #include "close_code.h" #endif /* expanded by -frewrite-includes */ # 83 "/usr/local/include/SDL2/SDL_gesture.h" # 1 "/usr/local/include/SDL2/close_code.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file close_code.h * * This file reverses the effects of begin_code.h and should be included * after you finish any function and structure declarations in your headers */ #undef _begin_code_h /* Reset structure packing at previous byte alignment */ #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__WATCOMC__) || defined(__BORLANDC__) #ifdef __BORLANDC__ #pragma nopackwarning #endif # 36 "/usr/local/include/SDL2/close_code.h" #pragma pack(pop) #endif /* Compiler needs structure packing set */ # 38 "/usr/local/include/SDL2/close_code.h" # 84 "/usr/local/include/SDL2/SDL_gesture.h" 2 #endif /* _SDL_gesture_h */ # 86 "/usr/local/include/SDL2/SDL_gesture.h" /* vi: set ts=4 sw=4 expandtab: */ # 40 "/usr/local/include/SDL2/SDL_events.h" 2 #if 0 /* expanded by -frewrite-includes */ #include "SDL_touch.h" #endif /* expanded by -frewrite-includes */ # 40 "/usr/local/include/SDL2/SDL_events.h" # 41 "/usr/local/include/SDL2/SDL_events.h" #if 0 /* expanded by -frewrite-includes */ #include "begin_code.h" #endif /* expanded by -frewrite-includes */ # 42 "/usr/local/include/SDL2/SDL_events.h" # 1 "/usr/local/include/SDL2/begin_code.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file begin_code.h * * This file sets things up for C dynamic library function definitions, * static inlined functions, and structures aligned at 4-byte alignment. * If you don't like ugly C preprocessor code, don't look at this file. :) */ /* This shouldn't be nested -- included it around code only. */ #ifdef _begin_code_h #error Nested inclusion of begin_code.h #endif # 34 "/usr/local/include/SDL2/begin_code.h" #define _begin_code_h #ifndef SDL_DEPRECATED # if (__GNUC__ >= 4) /* technically, this arrived in gcc 3.1, but oh well. */ # define SDL_DEPRECATED __attribute__((deprecated)) # else # 40 "/usr/local/include/SDL2/begin_code.h" # define SDL_DEPRECATED # endif # 42 "/usr/local/include/SDL2/begin_code.h" #endif # 43 "/usr/local/include/SDL2/begin_code.h" /* Some compilers use a special export keyword */ #ifndef DECLSPEC # if defined(__WIN32__) || defined(__WINRT__) # ifdef __BORLANDC__ # ifdef BUILD_SDL # define DECLSPEC # else # 51 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllimport) # endif # 53 "/usr/local/include/SDL2/begin_code.h" # else # 54 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllexport) # endif # 56 "/usr/local/include/SDL2/begin_code.h" # else # 57 "/usr/local/include/SDL2/begin_code.h" # if defined(__GNUC__) && __GNUC__ >= 4 # define DECLSPEC __attribute__ ((visibility("default"))) # elif defined(__GNUC__) && __GNUC__ >= 2 # 60 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllexport) # else # 62 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC # endif # 64 "/usr/local/include/SDL2/begin_code.h" # endif # 65 "/usr/local/include/SDL2/begin_code.h" #endif # 66 "/usr/local/include/SDL2/begin_code.h" /* By default SDL uses the C calling convention */ #ifndef SDLCALL #if (defined(__WIN32__) || defined(__WINRT__)) && !defined(__GNUC__) #define SDLCALL __cdecl #else # 72 "/usr/local/include/SDL2/begin_code.h" #define SDLCALL #endif # 74 "/usr/local/include/SDL2/begin_code.h" #endif /* SDLCALL */ # 75 "/usr/local/include/SDL2/begin_code.h" /* Removed DECLSPEC on Symbian OS because SDL cannot be a DLL in EPOC */ #ifdef __SYMBIAN32__ #undef DECLSPEC #define DECLSPEC #endif /* __SYMBIAN32__ */ # 81 "/usr/local/include/SDL2/begin_code.h" /* Force structure packing at 4 byte alignment. This is necessary if the header is included in code which has structure packing set to an alternate value, say for loading structures from disk. The packing is reset to the previous value in close_code.h */ #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__) #ifdef _MSC_VER #pragma warning(disable: 4103) #endif # 91 "/usr/local/include/SDL2/begin_code.h" #ifdef __BORLANDC__ #pragma nopackwarning #endif # 94 "/usr/local/include/SDL2/begin_code.h" #ifdef _M_X64 /* Use 8-byte alignment on 64-bit architectures, so pointers are aligned */ #pragma pack(push,8) #else # 98 "/usr/local/include/SDL2/begin_code.h" #pragma pack(push,4) #endif # 100 "/usr/local/include/SDL2/begin_code.h" #endif /* Compiler needs structure packing set */ # 101 "/usr/local/include/SDL2/begin_code.h" #ifndef SDL_INLINE #if defined(__GNUC__) #define SDL_INLINE __inline__ #elif defined(_MSC_VER) || defined(__BORLANDC__) || \ defined(__DMC__) || defined(__SC__) || \ defined(__WATCOMC__) || defined(__LCC__) || \ defined(__DECC) # 109 "/usr/local/include/SDL2/begin_code.h" #define SDL_INLINE __inline #ifndef __inline__ #define __inline__ __inline #endif # 113 "/usr/local/include/SDL2/begin_code.h" #else # 114 "/usr/local/include/SDL2/begin_code.h" #define SDL_INLINE inline #ifndef __inline__ #define __inline__ inline #endif # 118 "/usr/local/include/SDL2/begin_code.h" #endif # 119 "/usr/local/include/SDL2/begin_code.h" #endif /* SDL_INLINE not defined */ # 120 "/usr/local/include/SDL2/begin_code.h" #ifndef SDL_FORCE_INLINE #if defined(_MSC_VER) #define SDL_FORCE_INLINE __forceinline #elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) ) # 125 "/usr/local/include/SDL2/begin_code.h" #define SDL_FORCE_INLINE __attribute__((always_inline)) static __inline__ #else # 127 "/usr/local/include/SDL2/begin_code.h" #define SDL_FORCE_INLINE static SDL_INLINE #endif # 129 "/usr/local/include/SDL2/begin_code.h" #endif /* SDL_FORCE_INLINE not defined */ # 130 "/usr/local/include/SDL2/begin_code.h" /* Apparently this is needed by several Windows compilers */ #if !defined(__MACH__) #ifndef NULL #ifdef __cplusplus #define NULL 0 #else # 137 "/usr/local/include/SDL2/begin_code.h" #define NULL ((void *)0) #endif # 139 "/usr/local/include/SDL2/begin_code.h" #endif /* NULL */ # 140 "/usr/local/include/SDL2/begin_code.h" #endif /* ! Mac OS X - breaks precompiled headers */ # 141 "/usr/local/include/SDL2/begin_code.h" # 43 "/usr/local/include/SDL2/SDL_events.h" 2 /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif # 47 "/usr/local/include/SDL2/SDL_events.h" /* General keyboard/mouse state definitions */ #define SDL_RELEASED 0 #define SDL_PRESSED 1 /** * \brief The types of events that can be delivered. */ typedef enum { SDL_FIRSTEVENT = 0, /**< Unused (do not remove) */ /* Application events */ SDL_QUIT = 0x100, /**< User-requested quit */ /* These application events have special meaning on iOS, see README-ios.txt for details */ SDL_APP_TERMINATING, /**< The application is being terminated by the OS Called on iOS in applicationWillTerminate() Called on Android in onDestroy() */ SDL_APP_LOWMEMORY, /**< The application is low on memory, free memory if possible. Called on iOS in applicationDidReceiveMemoryWarning() Called on Android in onLowMemory() */ SDL_APP_WILLENTERBACKGROUND, /**< The application is about to enter the background Called on iOS in applicationWillResignActive() Called on Android in onPause() */ SDL_APP_DIDENTERBACKGROUND, /**< The application did enter the background and may not get CPU for some time Called on iOS in applicationDidEnterBackground() Called on Android in onPause() */ SDL_APP_WILLENTERFOREGROUND, /**< The application is about to enter the foreground Called on iOS in applicationWillEnterForeground() Called on Android in onResume() */ SDL_APP_DIDENTERFOREGROUND, /**< The application is now interactive Called on iOS in applicationDidBecomeActive() Called on Android in onResume() */ /* Window events */ SDL_WINDOWEVENT = 0x200, /**< Window state change */ SDL_SYSWMEVENT, /**< System specific event */ /* Keyboard events */ SDL_KEYDOWN = 0x300, /**< Key pressed */ SDL_KEYUP, /**< Key released */ SDL_TEXTEDITING, /**< Keyboard text editing (composition) */ SDL_TEXTINPUT, /**< Keyboard text input */ /* Mouse events */ SDL_MOUSEMOTION = 0x400, /**< Mouse moved */ SDL_MOUSEBUTTONDOWN, /**< Mouse button pressed */ SDL_MOUSEBUTTONUP, /**< Mouse button released */ SDL_MOUSEWHEEL, /**< Mouse wheel motion */ /* Joystick events */ SDL_JOYAXISMOTION = 0x600, /**< Joystick axis motion */ SDL_JOYBALLMOTION, /**< Joystick trackball motion */ SDL_JOYHATMOTION, /**< Joystick hat position change */ SDL_JOYBUTTONDOWN, /**< Joystick button pressed */ SDL_JOYBUTTONUP, /**< Joystick button released */ SDL_JOYDEVICEADDED, /**< A new joystick has been inserted into the system */ SDL_JOYDEVICEREMOVED, /**< An opened joystick has been removed */ /* Game controller events */ SDL_CONTROLLERAXISMOTION = 0x650, /**< Game controller axis motion */ SDL_CONTROLLERBUTTONDOWN, /**< Game controller button pressed */ SDL_CONTROLLERBUTTONUP, /**< Game controller button released */ SDL_CONTROLLERDEVICEADDED, /**< A new Game controller has been inserted into the system */ SDL_CONTROLLERDEVICEREMOVED, /**< An opened Game controller has been removed */ SDL_CONTROLLERDEVICEREMAPPED, /**< The controller mapping was updated */ /* Touch events */ SDL_FINGERDOWN = 0x700, SDL_FINGERUP, SDL_FINGERMOTION, /* Gesture events */ SDL_DOLLARGESTURE = 0x800, SDL_DOLLARRECORD, SDL_MULTIGESTURE, /* Clipboard events */ SDL_CLIPBOARDUPDATE = 0x900, /**< The clipboard changed */ /* Drag and drop events */ SDL_DROPFILE = 0x1000, /**< The system requests a file open */ /* Render events */ SDL_RENDER_TARGETS_RESET = 0x2000, /**< The render targets have been reset */ /** Events ::SDL_USEREVENT through ::SDL_LASTEVENT are for your use, * and should be allocated with SDL_RegisterEvents() */ SDL_USEREVENT = 0x8000, /** * This last event is only for bounding internal arrays */ SDL_LASTEVENT = 0xFFFF } SDL_EventType; /** * \brief Fields shared by every event */ typedef struct SDL_CommonEvent { Uint32 type; Uint32 timestamp; } SDL_CommonEvent; /** * \brief Window state change event data (event.window.*) */ typedef struct SDL_WindowEvent { Uint32 type; /**< ::SDL_WINDOWEVENT */ Uint32 timestamp; Uint32 windowID; /**< The associated window */ Uint8 event; /**< ::SDL_WindowEventID */ Uint8 padding1; Uint8 padding2; Uint8 padding3; Sint32 data1; /**< event dependent data */ Sint32 data2; /**< event dependent data */ } SDL_WindowEvent; /** * \brief Keyboard button event structure (event.key.*) */ typedef struct SDL_KeyboardEvent { Uint32 type; /**< ::SDL_KEYDOWN or ::SDL_KEYUP */ Uint32 timestamp; Uint32 windowID; /**< The window with keyboard focus, if any */ Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */ Uint8 repeat; /**< Non-zero if this is a key repeat */ Uint8 padding2; Uint8 padding3; SDL_Keysym keysym; /**< The key that was pressed or released */ } SDL_KeyboardEvent; #define SDL_TEXTEDITINGEVENT_TEXT_SIZE (32) /** * \brief Keyboard text editing event structure (event.edit.*) */ typedef struct SDL_TextEditingEvent { Uint32 type; /**< ::SDL_TEXTEDITING */ Uint32 timestamp; Uint32 windowID; /**< The window with keyboard focus, if any */ char text[SDL_TEXTEDITINGEVENT_TEXT_SIZE]; /**< The editing text */ Sint32 start; /**< The start cursor of selected editing text */ Sint32 length; /**< The length of selected editing text */ } SDL_TextEditingEvent; #define SDL_TEXTINPUTEVENT_TEXT_SIZE (32) /** * \brief Keyboard text input event structure (event.text.*) */ typedef struct SDL_TextInputEvent { Uint32 type; /**< ::SDL_TEXTINPUT */ Uint32 timestamp; Uint32 windowID; /**< The window with keyboard focus, if any */ char text[SDL_TEXTINPUTEVENT_TEXT_SIZE]; /**< The input text */ } SDL_TextInputEvent; /** * \brief Mouse motion event structure (event.motion.*) */ typedef struct SDL_MouseMotionEvent { Uint32 type; /**< ::SDL_MOUSEMOTION */ Uint32 timestamp; Uint32 windowID; /**< The window with mouse focus, if any */ Uint32 which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */ Uint32 state; /**< The current button state */ Sint32 x; /**< X coordinate, relative to window */ Sint32 y; /**< Y coordinate, relative to window */ Sint32 xrel; /**< The relative motion in the X direction */ Sint32 yrel; /**< The relative motion in the Y direction */ } SDL_MouseMotionEvent; /** * \brief Mouse button event structure (event.button.*) */ typedef struct SDL_MouseButtonEvent { Uint32 type; /**< ::SDL_MOUSEBUTTONDOWN or ::SDL_MOUSEBUTTONUP */ Uint32 timestamp; Uint32 windowID; /**< The window with mouse focus, if any */ Uint32 which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */ Uint8 button; /**< The mouse button index */ Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */ Uint8 clicks; /**< 1 for single-click, 2 for double-click, etc. */ Uint8 padding1; Sint32 x; /**< X coordinate, relative to window */ Sint32 y; /**< Y coordinate, relative to window */ } SDL_MouseButtonEvent; /** * \brief Mouse wheel event structure (event.wheel.*) */ typedef struct SDL_MouseWheelEvent { Uint32 type; /**< ::SDL_MOUSEWHEEL */ Uint32 timestamp; Uint32 windowID; /**< The window with mouse focus, if any */ Uint32 which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */ Sint32 x; /**< The amount scrolled horizontally, positive to the right and negative to the left */ Sint32 y; /**< The amount scrolled vertically, positive away from the user and negative toward the user */ } SDL_MouseWheelEvent; /** * \brief Joystick axis motion event structure (event.jaxis.*) */ typedef struct SDL_JoyAxisEvent { Uint32 type; /**< ::SDL_JOYAXISMOTION */ Uint32 timestamp; SDL_JoystickID which; /**< The joystick instance id */ Uint8 axis; /**< The joystick axis index */ Uint8 padding1; Uint8 padding2; Uint8 padding3; Sint16 value; /**< The axis value (range: -32768 to 32767) */ Uint16 padding4; } SDL_JoyAxisEvent; /** * \brief Joystick trackball motion event structure (event.jball.*) */ typedef struct SDL_JoyBallEvent { Uint32 type; /**< ::SDL_JOYBALLMOTION */ Uint32 timestamp; SDL_JoystickID which; /**< The joystick instance id */ Uint8 ball; /**< The joystick trackball index */ Uint8 padding1; Uint8 padding2; Uint8 padding3; Sint16 xrel; /**< The relative motion in the X direction */ Sint16 yrel; /**< The relative motion in the Y direction */ } SDL_JoyBallEvent; /** * \brief Joystick hat position change event structure (event.jhat.*) */ typedef struct SDL_JoyHatEvent { Uint32 type; /**< ::SDL_JOYHATMOTION */ Uint32 timestamp; SDL_JoystickID which; /**< The joystick instance id */ Uint8 hat; /**< The joystick hat index */ Uint8 value; /**< The hat position value. * \sa ::SDL_HAT_LEFTUP ::SDL_HAT_UP ::SDL_HAT_RIGHTUP * \sa ::SDL_HAT_LEFT ::SDL_HAT_CENTERED ::SDL_HAT_RIGHT * \sa ::SDL_HAT_LEFTDOWN ::SDL_HAT_DOWN ::SDL_HAT_RIGHTDOWN * * Note that zero means the POV is centered. */ Uint8 padding1; Uint8 padding2; } SDL_JoyHatEvent; /** * \brief Joystick button event structure (event.jbutton.*) */ typedef struct SDL_JoyButtonEvent { Uint32 type; /**< ::SDL_JOYBUTTONDOWN or ::SDL_JOYBUTTONUP */ Uint32 timestamp; SDL_JoystickID which; /**< The joystick instance id */ Uint8 button; /**< The joystick button index */ Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */ Uint8 padding1; Uint8 padding2; } SDL_JoyButtonEvent; /** * \brief Joystick device event structure (event.jdevice.*) */ typedef struct SDL_JoyDeviceEvent { Uint32 type; /**< ::SDL_JOYDEVICEADDED or ::SDL_JOYDEVICEREMOVED */ Uint32 timestamp; Sint32 which; /**< The joystick device index for the ADDED event, instance id for the REMOVED event */ } SDL_JoyDeviceEvent; /** * \brief Game controller axis motion event structure (event.caxis.*) */ typedef struct SDL_ControllerAxisEvent { Uint32 type; /**< ::SDL_CONTROLLERAXISMOTION */ Uint32 timestamp; SDL_JoystickID which; /**< The joystick instance id */ Uint8 axis; /**< The controller axis (SDL_GameControllerAxis) */ Uint8 padding1; Uint8 padding2; Uint8 padding3; Sint16 value; /**< The axis value (range: -32768 to 32767) */ Uint16 padding4; } SDL_ControllerAxisEvent; /** * \brief Game controller button event structure (event.cbutton.*) */ typedef struct SDL_ControllerButtonEvent { Uint32 type; /**< ::SDL_CONTROLLERBUTTONDOWN or ::SDL_CONTROLLERBUTTONUP */ Uint32 timestamp; SDL_JoystickID which; /**< The joystick instance id */ Uint8 button; /**< The controller button (SDL_GameControllerButton) */ Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */ Uint8 padding1; Uint8 padding2; } SDL_ControllerButtonEvent; /** * \brief Controller device event structure (event.cdevice.*) */ typedef struct SDL_ControllerDeviceEvent { Uint32 type; /**< ::SDL_CONTROLLERDEVICEADDED, ::SDL_CONTROLLERDEVICEREMOVED, or ::SDL_CONTROLLERDEVICEREMAPPED */ Uint32 timestamp; Sint32 which; /**< The joystick device index for the ADDED event, instance id for the REMOVED or REMAPPED event */ } SDL_ControllerDeviceEvent; /** * \brief Touch finger event structure (event.tfinger.*) */ typedef struct SDL_TouchFingerEvent { Uint32 type; /**< ::SDL_FINGERMOTION or ::SDL_FINGERDOWN or ::SDL_FINGERUP */ Uint32 timestamp; SDL_TouchID touchId; /**< The touch device id */ SDL_FingerID fingerId; float x; /**< Normalized in the range 0...1 */ float y; /**< Normalized in the range 0...1 */ float dx; /**< Normalized in the range 0...1 */ float dy; /**< Normalized in the range 0...1 */ float pressure; /**< Normalized in the range 0...1 */ } SDL_TouchFingerEvent; /** * \brief Multiple Finger Gesture Event (event.mgesture.*) */ typedef struct SDL_MultiGestureEvent { Uint32 type; /**< ::SDL_MULTIGESTURE */ Uint32 timestamp; SDL_TouchID touchId; /**< The touch device index */ float dTheta; float dDist; float x; float y; Uint16 numFingers; Uint16 padding; } SDL_MultiGestureEvent; /** * \brief Dollar Gesture Event (event.dgesture.*) */ typedef struct SDL_DollarGestureEvent { Uint32 type; /**< ::SDL_DOLLARGESTURE */ Uint32 timestamp; SDL_TouchID touchId; /**< The touch device id */ SDL_GestureID gestureId; Uint32 numFingers; float error; float x; /**< Normalized center of gesture */ float y; /**< Normalized center of gesture */ } SDL_DollarGestureEvent; /** * \brief An event used to request a file open by the system (event.drop.*) * This event is disabled by default, you can enable it with SDL_EventState() * \note If you enable this event, you must free the filename in the event. */ typedef struct SDL_DropEvent { Uint32 type; /**< ::SDL_DROPFILE */ Uint32 timestamp; char *file; /**< The file name, which should be freed with SDL_free() */ } SDL_DropEvent; /** * \brief The "quit requested" event */ typedef struct SDL_QuitEvent { Uint32 type; /**< ::SDL_QUIT */ Uint32 timestamp; } SDL_QuitEvent; /** * \brief OS Specific event */ typedef struct SDL_OSEvent { Uint32 type; /**< ::SDL_QUIT */ Uint32 timestamp; } SDL_OSEvent; /** * \brief A user-defined event type (event.user.*) */ typedef struct SDL_UserEvent { Uint32 type; /**< ::SDL_USEREVENT through ::SDL_LASTEVENT-1 */ Uint32 timestamp; Uint32 windowID; /**< The associated window if any */ Sint32 code; /**< User defined event code */ void *data1; /**< User defined data pointer */ void *data2; /**< User defined data pointer */ } SDL_UserEvent; struct SDL_SysWMmsg; typedef struct SDL_SysWMmsg SDL_SysWMmsg; /** * \brief A video driver dependent system event (event.syswm.*) * This event is disabled by default, you can enable it with SDL_EventState() * * \note If you want to use this event, you should include SDL_syswm.h. */ typedef struct SDL_SysWMEvent { Uint32 type; /**< ::SDL_SYSWMEVENT */ Uint32 timestamp; SDL_SysWMmsg *msg; /**< driver dependent data, defined in SDL_syswm.h */ } SDL_SysWMEvent; /** * \brief General event structure */ typedef union SDL_Event { Uint32 type; /**< Event type, shared with all events */ SDL_CommonEvent common; /**< Common event data */ SDL_WindowEvent window; /**< Window event data */ SDL_KeyboardEvent key; /**< Keyboard event data */ SDL_TextEditingEvent edit; /**< Text editing event data */ SDL_TextInputEvent text; /**< Text input event data */ SDL_MouseMotionEvent motion; /**< Mouse motion event data */ SDL_MouseButtonEvent button; /**< Mouse button event data */ SDL_MouseWheelEvent wheel; /**< Mouse wheel event data */ SDL_JoyAxisEvent jaxis; /**< Joystick axis event data */ SDL_JoyBallEvent jball; /**< Joystick ball event data */ SDL_JoyHatEvent jhat; /**< Joystick hat event data */ SDL_JoyButtonEvent jbutton; /**< Joystick button event data */ SDL_JoyDeviceEvent jdevice; /**< Joystick device change event data */ SDL_ControllerAxisEvent caxis; /**< Game Controller axis event data */ SDL_ControllerButtonEvent cbutton; /**< Game Controller button event data */ SDL_ControllerDeviceEvent cdevice; /**< Game Controller device event data */ SDL_QuitEvent quit; /**< Quit request event data */ SDL_UserEvent user; /**< Custom event data */ SDL_SysWMEvent syswm; /**< System dependent window event data */ SDL_TouchFingerEvent tfinger; /**< Touch finger event data */ SDL_MultiGestureEvent mgesture; /**< Gesture event data */ SDL_DollarGestureEvent dgesture; /**< Gesture event data */ SDL_DropEvent drop; /**< Drag and drop event data */ /* This is necessary for ABI compatibility between Visual C++ and GCC Visual C++ will respect the push pack pragma and use 52 bytes for this structure, and GCC will use the alignment of the largest datatype within the union, which is 8 bytes. So... we'll add padding to force the size to be 56 bytes for both. */ Uint8 padding[56]; } SDL_Event; /* Function prototypes */ /** * Pumps the event loop, gathering events from the input devices. * * This function updates the event queue and internal input device state. * * This should only be run in the thread that sets the video mode. */ extern DECLSPEC void SDLCALL SDL_PumpEvents(void); /* @{ */ typedef enum { SDL_ADDEVENT, SDL_PEEKEVENT, SDL_GETEVENT } SDL_eventaction; /** * Checks the event queue for messages and optionally returns them. * * If \c action is ::SDL_ADDEVENT, up to \c numevents events will be added to * the back of the event queue. * * If \c action is ::SDL_PEEKEVENT, up to \c numevents events at the front * of the event queue, within the specified minimum and maximum type, * will be returned and will not be removed from the queue. * * If \c action is ::SDL_GETEVENT, up to \c numevents events at the front * of the event queue, within the specified minimum and maximum type, * will be returned and will be removed from the queue. * * \return The number of events actually stored, or -1 if there was an error. * * This function is thread-safe. */ extern DECLSPEC int SDLCALL SDL_PeepEvents(SDL_Event * events, int numevents, SDL_eventaction action, Uint32 minType, Uint32 maxType); /* @} */ /** * Checks to see if certain event types are in the event queue. */ extern DECLSPEC SDL_bool SDLCALL SDL_HasEvent(Uint32 type); extern DECLSPEC SDL_bool SDLCALL SDL_HasEvents(Uint32 minType, Uint32 maxType); /** * This function clears events from the event queue */ extern DECLSPEC void SDLCALL SDL_FlushEvent(Uint32 type); extern DECLSPEC void SDLCALL SDL_FlushEvents(Uint32 minType, Uint32 maxType); /** * \brief Polls for currently pending events. * * \return 1 if there are any pending events, or 0 if there are none available. * * \param event If not NULL, the next event is removed from the queue and * stored in that area. */ extern DECLSPEC int SDLCALL SDL_PollEvent(SDL_Event * event); /** * \brief Waits indefinitely for the next available event. * * \return 1, or 0 if there was an error while waiting for events. * * \param event If not NULL, the next event is removed from the queue and * stored in that area. */ extern DECLSPEC int SDLCALL SDL_WaitEvent(SDL_Event * event); /** * \brief Waits until the specified timeout (in milliseconds) for the next * available event. * * \return 1, or 0 if there was an error while waiting for events. * * \param event If not NULL, the next event is removed from the queue and * stored in that area. * \param timeout The timeout (in milliseconds) to wait for next event. */ extern DECLSPEC int SDLCALL SDL_WaitEventTimeout(SDL_Event * event, int timeout); /** * \brief Add an event to the event queue. * * \return 1 on success, 0 if the event was filtered, or -1 if the event queue * was full or there was some other error. */ extern DECLSPEC int SDLCALL SDL_PushEvent(SDL_Event * event); typedef int (SDLCALL * SDL_EventFilter) (void *userdata, SDL_Event * event); /** * Sets up a filter to process all events before they change internal state and * are posted to the internal event queue. * * The filter is prototyped as: * \code * int SDL_EventFilter(void *userdata, SDL_Event * event); * \endcode * * If the filter returns 1, then the event will be added to the internal queue. * If it returns 0, then the event will be dropped from the queue, but the * internal state will still be updated. This allows selective filtering of * dynamically arriving events. * * \warning Be very careful of what you do in the event filter function, as * it may run in a different thread! * * There is one caveat when dealing with the ::SDL_QuitEvent event type. The * event filter is only called when the window manager desires to close the * application window. If the event filter returns 1, then the window will * be closed, otherwise the window will remain open if possible. * * If the quit event is generated by an interrupt signal, it will bypass the * internal queue and be delivered to the application at the next event poll. */ extern DECLSPEC void SDLCALL SDL_SetEventFilter(SDL_EventFilter filter, void *userdata); /** * Return the current event filter - can be used to "chain" filters. * If there is no event filter set, this function returns SDL_FALSE. */ extern DECLSPEC SDL_bool SDLCALL SDL_GetEventFilter(SDL_EventFilter * filter, void **userdata); /** * Add a function which is called when an event is added to the queue. */ extern DECLSPEC void SDLCALL SDL_AddEventWatch(SDL_EventFilter filter, void *userdata); /** * Remove an event watch function added with SDL_AddEventWatch() */ extern DECLSPEC void SDLCALL SDL_DelEventWatch(SDL_EventFilter filter, void *userdata); /** * Run the filter function on the current event queue, removing any * events for which the filter returns 0. */ extern DECLSPEC void SDLCALL SDL_FilterEvents(SDL_EventFilter filter, void *userdata); /* @{ */ #define SDL_QUERY -1 #define SDL_IGNORE 0 #define SDL_DISABLE 0 #define SDL_ENABLE 1 /** * This function allows you to set the state of processing certain events. * - If \c state is set to ::SDL_IGNORE, that event will be automatically * dropped from the event queue and will not event be filtered. * - If \c state is set to ::SDL_ENABLE, that event will be processed * normally. * - If \c state is set to ::SDL_QUERY, SDL_EventState() will return the * current processing state of the specified event. */ extern DECLSPEC Uint8 SDLCALL SDL_EventState(Uint32 type, int state); /* @} */ #define SDL_GetEventState(type) SDL_EventState(type, SDL_QUERY) /** * This function allocates a set of user-defined events, and returns * the beginning event number for that set of events. * * If there aren't enough user-defined events left, this function * returns (Uint32)-1 */ extern DECLSPEC Uint32 SDLCALL SDL_RegisterEvents(int numevents); /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif # 719 "/usr/local/include/SDL2/SDL_events.h" #if 0 /* expanded by -frewrite-includes */ #include "close_code.h" #endif /* expanded by -frewrite-includes */ # 719 "/usr/local/include/SDL2/SDL_events.h" # 1 "/usr/local/include/SDL2/close_code.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file close_code.h * * This file reverses the effects of begin_code.h and should be included * after you finish any function and structure declarations in your headers */ #undef _begin_code_h /* Reset structure packing at previous byte alignment */ #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__WATCOMC__) || defined(__BORLANDC__) #ifdef __BORLANDC__ #pragma nopackwarning #endif # 36 "/usr/local/include/SDL2/close_code.h" #pragma pack(pop) #endif /* Compiler needs structure packing set */ # 38 "/usr/local/include/SDL2/close_code.h" # 720 "/usr/local/include/SDL2/SDL_events.h" 2 #endif /* _SDL_events_h */ # 722 "/usr/local/include/SDL2/SDL_events.h" /* vi: set ts=4 sw=4 expandtab: */ # 77 "/usr/local/include/SDL2/SDL.h" 2 #if 0 /* expanded by -frewrite-includes */ #include "SDL_filesystem.h" #endif /* expanded by -frewrite-includes */ # 77 "/usr/local/include/SDL2/SDL.h" # 1 "/usr/local/include/SDL2/SDL_filesystem.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file SDL_filesystem.h * * \brief Include file for filesystem SDL API functions */ #ifndef _SDL_filesystem_h #define _SDL_filesystem_h #if 0 /* expanded by -frewrite-includes */ #include "SDL_stdinc.h" #endif /* expanded by -frewrite-includes */ # 31 "/usr/local/include/SDL2/SDL_filesystem.h" # 32 "/usr/local/include/SDL2/SDL_filesystem.h" #if 0 /* expanded by -frewrite-includes */ #include "begin_code.h" #endif /* expanded by -frewrite-includes */ # 33 "/usr/local/include/SDL2/SDL_filesystem.h" # 1 "/usr/local/include/SDL2/begin_code.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file begin_code.h * * This file sets things up for C dynamic library function definitions, * static inlined functions, and structures aligned at 4-byte alignment. * If you don't like ugly C preprocessor code, don't look at this file. :) */ /* This shouldn't be nested -- included it around code only. */ #ifdef _begin_code_h #error Nested inclusion of begin_code.h #endif # 34 "/usr/local/include/SDL2/begin_code.h" #define _begin_code_h #ifndef SDL_DEPRECATED # if (__GNUC__ >= 4) /* technically, this arrived in gcc 3.1, but oh well. */ # define SDL_DEPRECATED __attribute__((deprecated)) # else # 40 "/usr/local/include/SDL2/begin_code.h" # define SDL_DEPRECATED # endif # 42 "/usr/local/include/SDL2/begin_code.h" #endif # 43 "/usr/local/include/SDL2/begin_code.h" /* Some compilers use a special export keyword */ #ifndef DECLSPEC # if defined(__WIN32__) || defined(__WINRT__) # ifdef __BORLANDC__ # ifdef BUILD_SDL # define DECLSPEC # else # 51 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllimport) # endif # 53 "/usr/local/include/SDL2/begin_code.h" # else # 54 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllexport) # endif # 56 "/usr/local/include/SDL2/begin_code.h" # else # 57 "/usr/local/include/SDL2/begin_code.h" # if defined(__GNUC__) && __GNUC__ >= 4 # define DECLSPEC __attribute__ ((visibility("default"))) # elif defined(__GNUC__) && __GNUC__ >= 2 # 60 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllexport) # else # 62 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC # endif # 64 "/usr/local/include/SDL2/begin_code.h" # endif # 65 "/usr/local/include/SDL2/begin_code.h" #endif # 66 "/usr/local/include/SDL2/begin_code.h" /* By default SDL uses the C calling convention */ #ifndef SDLCALL #if (defined(__WIN32__) || defined(__WINRT__)) && !defined(__GNUC__) #define SDLCALL __cdecl #else # 72 "/usr/local/include/SDL2/begin_code.h" #define SDLCALL #endif # 74 "/usr/local/include/SDL2/begin_code.h" #endif /* SDLCALL */ # 75 "/usr/local/include/SDL2/begin_code.h" /* Removed DECLSPEC on Symbian OS because SDL cannot be a DLL in EPOC */ #ifdef __SYMBIAN32__ #undef DECLSPEC #define DECLSPEC #endif /* __SYMBIAN32__ */ # 81 "/usr/local/include/SDL2/begin_code.h" /* Force structure packing at 4 byte alignment. This is necessary if the header is included in code which has structure packing set to an alternate value, say for loading structures from disk. The packing is reset to the previous value in close_code.h */ #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__) #ifdef _MSC_VER #pragma warning(disable: 4103) #endif # 91 "/usr/local/include/SDL2/begin_code.h" #ifdef __BORLANDC__ #pragma nopackwarning #endif # 94 "/usr/local/include/SDL2/begin_code.h" #ifdef _M_X64 /* Use 8-byte alignment on 64-bit architectures, so pointers are aligned */ #pragma pack(push,8) #else # 98 "/usr/local/include/SDL2/begin_code.h" #pragma pack(push,4) #endif # 100 "/usr/local/include/SDL2/begin_code.h" #endif /* Compiler needs structure packing set */ # 101 "/usr/local/include/SDL2/begin_code.h" #ifndef SDL_INLINE #if defined(__GNUC__) #define SDL_INLINE __inline__ #elif defined(_MSC_VER) || defined(__BORLANDC__) || \ defined(__DMC__) || defined(__SC__) || \ defined(__WATCOMC__) || defined(__LCC__) || \ defined(__DECC) # 109 "/usr/local/include/SDL2/begin_code.h" #define SDL_INLINE __inline #ifndef __inline__ #define __inline__ __inline #endif # 113 "/usr/local/include/SDL2/begin_code.h" #else # 114 "/usr/local/include/SDL2/begin_code.h" #define SDL_INLINE inline #ifndef __inline__ #define __inline__ inline #endif # 118 "/usr/local/include/SDL2/begin_code.h" #endif # 119 "/usr/local/include/SDL2/begin_code.h" #endif /* SDL_INLINE not defined */ # 120 "/usr/local/include/SDL2/begin_code.h" #ifndef SDL_FORCE_INLINE #if defined(_MSC_VER) #define SDL_FORCE_INLINE __forceinline #elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) ) # 125 "/usr/local/include/SDL2/begin_code.h" #define SDL_FORCE_INLINE __attribute__((always_inline)) static __inline__ #else # 127 "/usr/local/include/SDL2/begin_code.h" #define SDL_FORCE_INLINE static SDL_INLINE #endif # 129 "/usr/local/include/SDL2/begin_code.h" #endif /* SDL_FORCE_INLINE not defined */ # 130 "/usr/local/include/SDL2/begin_code.h" /* Apparently this is needed by several Windows compilers */ #if !defined(__MACH__) #ifndef NULL #ifdef __cplusplus #define NULL 0 #else # 137 "/usr/local/include/SDL2/begin_code.h" #define NULL ((void *)0) #endif # 139 "/usr/local/include/SDL2/begin_code.h" #endif /* NULL */ # 140 "/usr/local/include/SDL2/begin_code.h" #endif /* ! Mac OS X - breaks precompiled headers */ # 141 "/usr/local/include/SDL2/begin_code.h" # 34 "/usr/local/include/SDL2/SDL_filesystem.h" 2 /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif # 39 "/usr/local/include/SDL2/SDL_filesystem.h" /** * \brief Get the path where the application resides. * * Get the "base path". This is the directory where the application was run * from, which is probably the installation directory, and may or may not * be the process's current working directory. * * This returns an absolute path in UTF-8 encoding, and is guaranteed to * end with a path separator ('\\' on Windows, '/' most other places). * * The pointer returned by this function is owned by you. Please call * SDL_free() on the pointer when you are done with it, or it will be a * memory leak. This is not necessarily a fast call, though, so you should * call this once near startup and save the string if you need it. * * Some platforms can't determine the application's path, and on other * platforms, this might be meaningless. In such cases, this function will * return NULL. * * \return String of base dir in UTF-8 encoding, or NULL on error. * * \sa SDL_GetPrefPath */ extern DECLSPEC char *SDLCALL SDL_GetBasePath(void); /** * \brief Get the user-and-app-specific path where files can be written. * * Get the "pref dir". This is meant to be where users can write personal * files (preferences and save games, etc) that are specific to your * application. This directory is unique per user, per application. * * This function will decide the appropriate location in the native filesystem, * create the directory if necessary, and return a string of the absolute * path to the directory in UTF-8 encoding. * * On Windows, the string might look like: * "C:\\Users\\bob\\AppData\\Roaming\\My Company\\My Program Name\\" * * On Linux, the string might look like: * "/home/bob/.local/share/My Program Name/" * * On Mac OS X, the string might look like: * "/Users/bob/Library/Application Support/My Program Name/" * * (etc.) * * You specify the name of your organization (if it's not a real organization, * your name or an Internet domain you own might do) and the name of your * application. These should be untranslated proper names. * * Both the org and app strings may become part of a directory name, so * please follow these rules: * * - Try to use the same org string (including case-sensitivity) for * all your applications that use this function. * - Always use a unique app string for each one, and make sure it never * changes for an app once you've decided on it. * - Unicode characters are legal, as long as it's UTF-8 encoded, but... * - ...only use letters, numbers, and spaces. Avoid punctuation like * "Game Name 2: Bad Guy's Revenge!" ... "Game Name 2" is sufficient. * * This returns an absolute path in UTF-8 encoding, and is guaranteed to * end with a path separator ('\\' on Windows, '/' most other places). * * The pointer returned by this function is owned by you. Please call * SDL_free() on the pointer when you are done with it, or it will be a * memory leak. This is not necessarily a fast call, though, so you should * call this once near startup and save the string if you need it. * * You should assume the path returned by this function is the only safe * place to write files (and that SDL_GetBasePath(), while it might be * writable, or even the parent of the returned path, aren't where you * should be writing things). * * Some platforms can't determine the pref path, and on other * platforms, this might be meaningless. In such cases, this function will * return NULL. * * \param org The name of your organization. * \param app The name of your application. * \return UTF-8 string of user dir in platform-dependent notation. NULL * if there's a problem (creating directory failed, etc). * * \sa SDL_GetBasePath */ extern DECLSPEC char *SDLCALL SDL_GetPrefPath(const char *org, const char *app); /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif # 132 "/usr/local/include/SDL2/SDL_filesystem.h" #if 0 /* expanded by -frewrite-includes */ #include "close_code.h" #endif /* expanded by -frewrite-includes */ # 132 "/usr/local/include/SDL2/SDL_filesystem.h" # 1 "/usr/local/include/SDL2/close_code.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file close_code.h * * This file reverses the effects of begin_code.h and should be included * after you finish any function and structure declarations in your headers */ #undef _begin_code_h /* Reset structure packing at previous byte alignment */ #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__WATCOMC__) || defined(__BORLANDC__) #ifdef __BORLANDC__ #pragma nopackwarning #endif # 36 "/usr/local/include/SDL2/close_code.h" #pragma pack(pop) #endif /* Compiler needs structure packing set */ # 38 "/usr/local/include/SDL2/close_code.h" # 133 "/usr/local/include/SDL2/SDL_filesystem.h" 2 #endif /* _SDL_system_h */ # 135 "/usr/local/include/SDL2/SDL_filesystem.h" /* vi: set ts=4 sw=4 expandtab: */ # 78 "/usr/local/include/SDL2/SDL.h" 2 #if 0 /* expanded by -frewrite-includes */ #include "SDL_joystick.h" #endif /* expanded by -frewrite-includes */ # 78 "/usr/local/include/SDL2/SDL.h" # 79 "/usr/local/include/SDL2/SDL.h" #if 0 /* expanded by -frewrite-includes */ #include "SDL_gamecontroller.h" #endif /* expanded by -frewrite-includes */ # 79 "/usr/local/include/SDL2/SDL.h" # 80 "/usr/local/include/SDL2/SDL.h" #if 0 /* expanded by -frewrite-includes */ #include "SDL_haptic.h" #endif /* expanded by -frewrite-includes */ # 80 "/usr/local/include/SDL2/SDL.h" # 1 "/usr/local/include/SDL2/SDL_haptic.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file SDL_haptic.h * * \brief The SDL Haptic subsystem allows you to control haptic (force feedback) * devices. * * The basic usage is as follows: * - Initialize the Subsystem (::SDL_INIT_HAPTIC). * - Open a Haptic Device. * - SDL_HapticOpen() to open from index. * - SDL_HapticOpenFromJoystick() to open from an existing joystick. * - Create an effect (::SDL_HapticEffect). * - Upload the effect with SDL_HapticNewEffect(). * - Run the effect with SDL_HapticRunEffect(). * - (optional) Free the effect with SDL_HapticDestroyEffect(). * - Close the haptic device with SDL_HapticClose(). * * \par Simple rumble example: * \code * SDL_Haptic *haptic; * * // Open the device * haptic = SDL_HapticOpen( 0 ); * if (haptic == NULL) * return -1; * * // Initialize simple rumble * if (SDL_HapticRumbleInit( haptic ) != 0) * return -1; * * // Play effect at 50% strength for 2 seconds * if (SDL_HapticRumblePlay( haptic, 0.5, 2000 ) != 0) * return -1; * SDL_Delay( 2000 ); * * // Clean up * SDL_HapticClose( haptic ); * \endcode * * \par Complete example: * \code * int test_haptic( SDL_Joystick * joystick ) { * SDL_Haptic *haptic; * SDL_HapticEffect effect; * int effect_id; * * // Open the device * haptic = SDL_HapticOpenFromJoystick( joystick ); * if (haptic == NULL) return -1; // Most likely joystick isn't haptic * * // See if it can do sine waves * if ((SDL_HapticQuery(haptic) & SDL_HAPTIC_SINE)==0) { * SDL_HapticClose(haptic); // No sine effect * return -1; * } * * // Create the effect * memset( &effect, 0, sizeof(SDL_HapticEffect) ); // 0 is safe default * effect.type = SDL_HAPTIC_SINE; * effect.periodic.direction.type = SDL_HAPTIC_POLAR; // Polar coordinates * effect.periodic.direction.dir[0] = 18000; // Force comes from south * effect.periodic.period = 1000; // 1000 ms * effect.periodic.magnitude = 20000; // 20000/32767 strength * effect.periodic.length = 5000; // 5 seconds long * effect.periodic.attack_length = 1000; // Takes 1 second to get max strength * effect.periodic.fade_length = 1000; // Takes 1 second to fade away * * // Upload the effect * effect_id = SDL_HapticNewEffect( haptic, &effect ); * * // Test the effect * SDL_HapticRunEffect( haptic, effect_id, 1 ); * SDL_Delay( 5000); // Wait for the effect to finish * * // We destroy the effect, although closing the device also does this * SDL_HapticDestroyEffect( haptic, effect_id ); * * // Close the device * SDL_HapticClose(haptic); * * return 0; // Success * } * \endcode * * You can also find out more information on my blog: * http://bobbens.dyndns.org/journal/2010/sdl_haptic/ * * \author Edgar Simo Serra */ #ifndef _SDL_haptic_h #define _SDL_haptic_h #if 0 /* expanded by -frewrite-includes */ #include "SDL_stdinc.h" #endif /* expanded by -frewrite-includes */ # 115 "/usr/local/include/SDL2/SDL_haptic.h" # 116 "/usr/local/include/SDL2/SDL_haptic.h" #if 0 /* expanded by -frewrite-includes */ #include "SDL_error.h" #endif /* expanded by -frewrite-includes */ # 116 "/usr/local/include/SDL2/SDL_haptic.h" # 117 "/usr/local/include/SDL2/SDL_haptic.h" #if 0 /* expanded by -frewrite-includes */ #include "SDL_joystick.h" #endif /* expanded by -frewrite-includes */ # 117 "/usr/local/include/SDL2/SDL_haptic.h" # 118 "/usr/local/include/SDL2/SDL_haptic.h" #if 0 /* expanded by -frewrite-includes */ #include "begin_code.h" #endif /* expanded by -frewrite-includes */ # 119 "/usr/local/include/SDL2/SDL_haptic.h" # 1 "/usr/local/include/SDL2/begin_code.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file begin_code.h * * This file sets things up for C dynamic library function definitions, * static inlined functions, and structures aligned at 4-byte alignment. * If you don't like ugly C preprocessor code, don't look at this file. :) */ /* This shouldn't be nested -- included it around code only. */ #ifdef _begin_code_h #error Nested inclusion of begin_code.h #endif # 34 "/usr/local/include/SDL2/begin_code.h" #define _begin_code_h #ifndef SDL_DEPRECATED # if (__GNUC__ >= 4) /* technically, this arrived in gcc 3.1, but oh well. */ # define SDL_DEPRECATED __attribute__((deprecated)) # else # 40 "/usr/local/include/SDL2/begin_code.h" # define SDL_DEPRECATED # endif # 42 "/usr/local/include/SDL2/begin_code.h" #endif # 43 "/usr/local/include/SDL2/begin_code.h" /* Some compilers use a special export keyword */ #ifndef DECLSPEC # if defined(__WIN32__) || defined(__WINRT__) # ifdef __BORLANDC__ # ifdef BUILD_SDL # define DECLSPEC # else # 51 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllimport) # endif # 53 "/usr/local/include/SDL2/begin_code.h" # else # 54 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllexport) # endif # 56 "/usr/local/include/SDL2/begin_code.h" # else # 57 "/usr/local/include/SDL2/begin_code.h" # if defined(__GNUC__) && __GNUC__ >= 4 # define DECLSPEC __attribute__ ((visibility("default"))) # elif defined(__GNUC__) && __GNUC__ >= 2 # 60 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllexport) # else # 62 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC # endif # 64 "/usr/local/include/SDL2/begin_code.h" # endif # 65 "/usr/local/include/SDL2/begin_code.h" #endif # 66 "/usr/local/include/SDL2/begin_code.h" /* By default SDL uses the C calling convention */ #ifndef SDLCALL #if (defined(__WIN32__) || defined(__WINRT__)) && !defined(__GNUC__) #define SDLCALL __cdecl #else # 72 "/usr/local/include/SDL2/begin_code.h" #define SDLCALL #endif # 74 "/usr/local/include/SDL2/begin_code.h" #endif /* SDLCALL */ # 75 "/usr/local/include/SDL2/begin_code.h" /* Removed DECLSPEC on Symbian OS because SDL cannot be a DLL in EPOC */ #ifdef __SYMBIAN32__ #undef DECLSPEC #define DECLSPEC #endif /* __SYMBIAN32__ */ # 81 "/usr/local/include/SDL2/begin_code.h" /* Force structure packing at 4 byte alignment. This is necessary if the header is included in code which has structure packing set to an alternate value, say for loading structures from disk. The packing is reset to the previous value in close_code.h */ #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__) #ifdef _MSC_VER #pragma warning(disable: 4103) #endif # 91 "/usr/local/include/SDL2/begin_code.h" #ifdef __BORLANDC__ #pragma nopackwarning #endif # 94 "/usr/local/include/SDL2/begin_code.h" #ifdef _M_X64 /* Use 8-byte alignment on 64-bit architectures, so pointers are aligned */ #pragma pack(push,8) #else # 98 "/usr/local/include/SDL2/begin_code.h" #pragma pack(push,4) #endif # 100 "/usr/local/include/SDL2/begin_code.h" #endif /* Compiler needs structure packing set */ # 101 "/usr/local/include/SDL2/begin_code.h" #ifndef SDL_INLINE #if defined(__GNUC__) #define SDL_INLINE __inline__ #elif defined(_MSC_VER) || defined(__BORLANDC__) || \ defined(__DMC__) || defined(__SC__) || \ defined(__WATCOMC__) || defined(__LCC__) || \ defined(__DECC) # 109 "/usr/local/include/SDL2/begin_code.h" #define SDL_INLINE __inline #ifndef __inline__ #define __inline__ __inline #endif # 113 "/usr/local/include/SDL2/begin_code.h" #else # 114 "/usr/local/include/SDL2/begin_code.h" #define SDL_INLINE inline #ifndef __inline__ #define __inline__ inline #endif # 118 "/usr/local/include/SDL2/begin_code.h" #endif # 119 "/usr/local/include/SDL2/begin_code.h" #endif /* SDL_INLINE not defined */ # 120 "/usr/local/include/SDL2/begin_code.h" #ifndef SDL_FORCE_INLINE #if defined(_MSC_VER) #define SDL_FORCE_INLINE __forceinline #elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) ) # 125 "/usr/local/include/SDL2/begin_code.h" #define SDL_FORCE_INLINE __attribute__((always_inline)) static __inline__ #else # 127 "/usr/local/include/SDL2/begin_code.h" #define SDL_FORCE_INLINE static SDL_INLINE #endif # 129 "/usr/local/include/SDL2/begin_code.h" #endif /* SDL_FORCE_INLINE not defined */ # 130 "/usr/local/include/SDL2/begin_code.h" /* Apparently this is needed by several Windows compilers */ #if !defined(__MACH__) #ifndef NULL #ifdef __cplusplus #define NULL 0 #else # 137 "/usr/local/include/SDL2/begin_code.h" #define NULL ((void *)0) #endif # 139 "/usr/local/include/SDL2/begin_code.h" #endif /* NULL */ # 140 "/usr/local/include/SDL2/begin_code.h" #endif /* ! Mac OS X - breaks precompiled headers */ # 141 "/usr/local/include/SDL2/begin_code.h" # 120 "/usr/local/include/SDL2/SDL_haptic.h" 2 /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ # 124 "/usr/local/include/SDL2/SDL_haptic.h" /** * \typedef SDL_Haptic * * \brief The haptic structure used to identify an SDL haptic. * * \sa SDL_HapticOpen * \sa SDL_HapticOpenFromJoystick * \sa SDL_HapticClose */ struct _SDL_Haptic; typedef struct _SDL_Haptic SDL_Haptic; /** * \name Haptic features * * Different haptic features a device can have. */ /* @{ */ /** * \name Haptic effects */ /* @{ */ /** * \brief Constant effect supported. * * Constant haptic effect. * * \sa SDL_HapticCondition */ #define SDL_HAPTIC_CONSTANT (1<<0) /** * \brief Sine wave effect supported. * * Periodic haptic effect that simulates sine waves. * * \sa SDL_HapticPeriodic */ #define SDL_HAPTIC_SINE (1<<1) /** * \brief Left/Right effect supported. * * Haptic effect for direct control over high/low frequency motors. * * \sa SDL_HapticLeftRight * \warning this value was SDL_HAPTIC_SQUARE right before 2.0.0 shipped. Sorry, * we ran out of bits, and this is important for XInput devices. */ #define SDL_HAPTIC_LEFTRIGHT (1<<2) /* !!! FIXME: put this back when we have more bits in 2.1 */ /* #define SDL_HAPTIC_SQUARE (1<<2) */ /** * \brief Triangle wave effect supported. * * Periodic haptic effect that simulates triangular waves. * * \sa SDL_HapticPeriodic */ #define SDL_HAPTIC_TRIANGLE (1<<3) /** * \brief Sawtoothup wave effect supported. * * Periodic haptic effect that simulates saw tooth up waves. * * \sa SDL_HapticPeriodic */ #define SDL_HAPTIC_SAWTOOTHUP (1<<4) /** * \brief Sawtoothdown wave effect supported. * * Periodic haptic effect that simulates saw tooth down waves. * * \sa SDL_HapticPeriodic */ #define SDL_HAPTIC_SAWTOOTHDOWN (1<<5) /** * \brief Ramp effect supported. * * Ramp haptic effect. * * \sa SDL_HapticRamp */ #define SDL_HAPTIC_RAMP (1<<6) /** * \brief Spring effect supported - uses axes position. * * Condition haptic effect that simulates a spring. Effect is based on the * axes position. * * \sa SDL_HapticCondition */ #define SDL_HAPTIC_SPRING (1<<7) /** * \brief Damper effect supported - uses axes velocity. * * Condition haptic effect that simulates dampening. Effect is based on the * axes velocity. * * \sa SDL_HapticCondition */ #define SDL_HAPTIC_DAMPER (1<<8) /** * \brief Inertia effect supported - uses axes acceleration. * * Condition haptic effect that simulates inertia. Effect is based on the axes * acceleration. * * \sa SDL_HapticCondition */ #define SDL_HAPTIC_INERTIA (1<<9) /** * \brief Friction effect supported - uses axes movement. * * Condition haptic effect that simulates friction. Effect is based on the * axes movement. * * \sa SDL_HapticCondition */ #define SDL_HAPTIC_FRICTION (1<<10) /** * \brief Custom effect is supported. * * User defined custom haptic effect. */ #define SDL_HAPTIC_CUSTOM (1<<11) /* @} *//* Haptic effects */ /* These last few are features the device has, not effects */ /** * \brief Device can set global gain. * * Device supports setting the global gain. * * \sa SDL_HapticSetGain */ #define SDL_HAPTIC_GAIN (1<<12) /** * \brief Device can set autocenter. * * Device supports setting autocenter. * * \sa SDL_HapticSetAutocenter */ #define SDL_HAPTIC_AUTOCENTER (1<<13) /** * \brief Device can be queried for effect status. * * Device can be queried for effect status. * * \sa SDL_HapticGetEffectStatus */ #define SDL_HAPTIC_STATUS (1<<14) /** * \brief Device can be paused. * * \sa SDL_HapticPause * \sa SDL_HapticUnpause */ #define SDL_HAPTIC_PAUSE (1<<15) /** * \name Direction encodings */ /* @{ */ /** * \brief Uses polar coordinates for the direction. * * \sa SDL_HapticDirection */ #define SDL_HAPTIC_POLAR 0 /** * \brief Uses cartesian coordinates for the direction. * * \sa SDL_HapticDirection */ #define SDL_HAPTIC_CARTESIAN 1 /** * \brief Uses spherical coordinates for the direction. * * \sa SDL_HapticDirection */ #define SDL_HAPTIC_SPHERICAL 2 /* @} *//* Direction encodings */ /* @} *//* Haptic features */ /* * Misc defines. */ /** * \brief Used to play a device an infinite number of times. * * \sa SDL_HapticRunEffect */ #define SDL_HAPTIC_INFINITY 4294967295U /** * \brief Structure that represents a haptic direction. * * Directions can be specified by: * - ::SDL_HAPTIC_POLAR : Specified by polar coordinates. * - ::SDL_HAPTIC_CARTESIAN : Specified by cartesian coordinates. * - ::SDL_HAPTIC_SPHERICAL : Specified by spherical coordinates. * * Cardinal directions of the haptic device are relative to the positioning * of the device. North is considered to be away from the user. * * The following diagram represents the cardinal directions: * \verbatim .--. |__| .-------. |=.| |.-----.| |--| || || | | |'-----'| |__|~')_____(' [ COMPUTER ] North (0,-1) ^ | | (1,0) West <----[ HAPTIC ]----> East (-1,0) | | v South (0,1) [ USER ] \|||/ (o o) ---ooO-(_)-Ooo--- \endverbatim * * If type is ::SDL_HAPTIC_POLAR, direction is encoded by hundredths of a * degree starting north and turning clockwise. ::SDL_HAPTIC_POLAR only uses * the first \c dir parameter. The cardinal directions would be: * - North: 0 (0 degrees) * - East: 9000 (90 degrees) * - South: 18000 (180 degrees) * - West: 27000 (270 degrees) * * If type is ::SDL_HAPTIC_CARTESIAN, direction is encoded by three positions * (X axis, Y axis and Z axis (with 3 axes)). ::SDL_HAPTIC_CARTESIAN uses * the first three \c dir parameters. The cardinal directions would be: * - North: 0,-1, 0 * - East: -1, 0, 0 * - South: 0, 1, 0 * - West: 1, 0, 0 * * The Z axis represents the height of the effect if supported, otherwise * it's unused. In cartesian encoding (1, 2) would be the same as (2, 4), you * can use any multiple you want, only the direction matters. * * If type is ::SDL_HAPTIC_SPHERICAL, direction is encoded by two rotations. * The first two \c dir parameters are used. The \c dir parameters are as * follows (all values are in hundredths of degrees): * - Degrees from (1, 0) rotated towards (0, 1). * - Degrees towards (0, 0, 1) (device needs at least 3 axes). * * * Example of force coming from the south with all encodings (force coming * from the south means the user will have to pull the stick to counteract): * \code * SDL_HapticDirection direction; * * // Cartesian directions * direction.type = SDL_HAPTIC_CARTESIAN; // Using cartesian direction encoding. * direction.dir[0] = 0; // X position * direction.dir[1] = 1; // Y position * // Assuming the device has 2 axes, we don't need to specify third parameter. * * // Polar directions * direction.type = SDL_HAPTIC_POLAR; // We'll be using polar direction encoding. * direction.dir[0] = 18000; // Polar only uses first parameter * * // Spherical coordinates * direction.type = SDL_HAPTIC_SPHERICAL; // Spherical encoding * direction.dir[0] = 9000; // Since we only have two axes we don't need more parameters. * \endcode * * \sa SDL_HAPTIC_POLAR * \sa SDL_HAPTIC_CARTESIAN * \sa SDL_HAPTIC_SPHERICAL * \sa SDL_HapticEffect * \sa SDL_HapticNumAxes */ typedef struct SDL_HapticDirection { Uint8 type; /**< The type of encoding. */ Sint32 dir[3]; /**< The encoded direction. */ } SDL_HapticDirection; /** * \brief A structure containing a template for a Constant effect. * * The struct is exclusive to the ::SDL_HAPTIC_CONSTANT effect. * * A constant effect applies a constant force in the specified direction * to the joystick. * * \sa SDL_HAPTIC_CONSTANT * \sa SDL_HapticEffect */ typedef struct SDL_HapticConstant { /* Header */ Uint16 type; /**< ::SDL_HAPTIC_CONSTANT */ SDL_HapticDirection direction; /**< Direction of the effect. */ /* Replay */ Uint32 length; /**< Duration of the effect. */ Uint16 delay; /**< Delay before starting the effect. */ /* Trigger */ Uint16 button; /**< Button that triggers the effect. */ Uint16 interval; /**< How soon it can be triggered again after button. */ /* Constant */ Sint16 level; /**< Strength of the constant effect. */ /* Envelope */ Uint16 attack_length; /**< Duration of the attack. */ Uint16 attack_level; /**< Level at the start of the attack. */ Uint16 fade_length; /**< Duration of the fade. */ Uint16 fade_level; /**< Level at the end of the fade. */ } SDL_HapticConstant; /** * \brief A structure containing a template for a Periodic effect. * * The struct handles the following effects: * - ::SDL_HAPTIC_SINE * - ::SDL_HAPTIC_LEFTRIGHT * - ::SDL_HAPTIC_TRIANGLE * - ::SDL_HAPTIC_SAWTOOTHUP * - ::SDL_HAPTIC_SAWTOOTHDOWN * * A periodic effect consists in a wave-shaped effect that repeats itself * over time. The type determines the shape of the wave and the parameters * determine the dimensions of the wave. * * Phase is given by hundredth of a cycle meaning that giving the phase a value * of 9000 will displace it 25% of its period. Here are sample values: * - 0: No phase displacement. * - 9000: Displaced 25% of its period. * - 18000: Displaced 50% of its period. * - 27000: Displaced 75% of its period. * - 36000: Displaced 100% of its period, same as 0, but 0 is preferred. * * Examples: * \verbatim SDL_HAPTIC_SINE __ __ __ __ / \ / \ / \ / / \__/ \__/ \__/ SDL_HAPTIC_SQUARE __ __ __ __ __ | | | | | | | | | | | |__| |__| |__| |__| | SDL_HAPTIC_TRIANGLE /\ /\ /\ /\ /\ / \ / \ / \ / \ / / \/ \/ \/ \/ SDL_HAPTIC_SAWTOOTHUP /| /| /| /| /| /| /| / | / | / | / | / | / | / | / |/ |/ |/ |/ |/ |/ | SDL_HAPTIC_SAWTOOTHDOWN \ |\ |\ |\ |\ |\ |\ | \ | \ | \ | \ | \ | \ | \ | \| \| \| \| \| \| \| \endverbatim * * \sa SDL_HAPTIC_SINE * \sa SDL_HAPTIC_LEFTRIGHT * \sa SDL_HAPTIC_TRIANGLE * \sa SDL_HAPTIC_SAWTOOTHUP * \sa SDL_HAPTIC_SAWTOOTHDOWN * \sa SDL_HapticEffect */ typedef struct SDL_HapticPeriodic { /* Header */ Uint16 type; /**< ::SDL_HAPTIC_SINE, ::SDL_HAPTIC_LEFTRIGHT, ::SDL_HAPTIC_TRIANGLE, ::SDL_HAPTIC_SAWTOOTHUP or ::SDL_HAPTIC_SAWTOOTHDOWN */ SDL_HapticDirection direction; /**< Direction of the effect. */ /* Replay */ Uint32 length; /**< Duration of the effect. */ Uint16 delay; /**< Delay before starting the effect. */ /* Trigger */ Uint16 button; /**< Button that triggers the effect. */ Uint16 interval; /**< How soon it can be triggered again after button. */ /* Periodic */ Uint16 period; /**< Period of the wave. */ Sint16 magnitude; /**< Peak value. */ Sint16 offset; /**< Mean value of the wave. */ Uint16 phase; /**< Horizontal shift given by hundredth of a cycle. */ /* Envelope */ Uint16 attack_length; /**< Duration of the attack. */ Uint16 attack_level; /**< Level at the start of the attack. */ Uint16 fade_length; /**< Duration of the fade. */ Uint16 fade_level; /**< Level at the end of the fade. */ } SDL_HapticPeriodic; /** * \brief A structure containing a template for a Condition effect. * * The struct handles the following effects: * - ::SDL_HAPTIC_SPRING: Effect based on axes position. * - ::SDL_HAPTIC_DAMPER: Effect based on axes velocity. * - ::SDL_HAPTIC_INERTIA: Effect based on axes acceleration. * - ::SDL_HAPTIC_FRICTION: Effect based on axes movement. * * Direction is handled by condition internals instead of a direction member. * The condition effect specific members have three parameters. The first * refers to the X axis, the second refers to the Y axis and the third * refers to the Z axis. The right terms refer to the positive side of the * axis and the left terms refer to the negative side of the axis. Please * refer to the ::SDL_HapticDirection diagram for which side is positive and * which is negative. * * \sa SDL_HapticDirection * \sa SDL_HAPTIC_SPRING * \sa SDL_HAPTIC_DAMPER * \sa SDL_HAPTIC_INERTIA * \sa SDL_HAPTIC_FRICTION * \sa SDL_HapticEffect */ typedef struct SDL_HapticCondition { /* Header */ Uint16 type; /**< ::SDL_HAPTIC_SPRING, ::SDL_HAPTIC_DAMPER, ::SDL_HAPTIC_INERTIA or ::SDL_HAPTIC_FRICTION */ SDL_HapticDirection direction; /**< Direction of the effect - Not used ATM. */ /* Replay */ Uint32 length; /**< Duration of the effect. */ Uint16 delay; /**< Delay before starting the effect. */ /* Trigger */ Uint16 button; /**< Button that triggers the effect. */ Uint16 interval; /**< How soon it can be triggered again after button. */ /* Condition */ Uint16 right_sat[3]; /**< Level when joystick is to the positive side. */ Uint16 left_sat[3]; /**< Level when joystick is to the negative side. */ Sint16 right_coeff[3]; /**< How fast to increase the force towards the positive side. */ Sint16 left_coeff[3]; /**< How fast to increase the force towards the negative side. */ Uint16 deadband[3]; /**< Size of the dead zone. */ Sint16 center[3]; /**< Position of the dead zone. */ } SDL_HapticCondition; /** * \brief A structure containing a template for a Ramp effect. * * This struct is exclusively for the ::SDL_HAPTIC_RAMP effect. * * The ramp effect starts at start strength and ends at end strength. * It augments in linear fashion. If you use attack and fade with a ramp * the effects get added to the ramp effect making the effect become * quadratic instead of linear. * * \sa SDL_HAPTIC_RAMP * \sa SDL_HapticEffect */ typedef struct SDL_HapticRamp { /* Header */ Uint16 type; /**< ::SDL_HAPTIC_RAMP */ SDL_HapticDirection direction; /**< Direction of the effect. */ /* Replay */ Uint32 length; /**< Duration of the effect. */ Uint16 delay; /**< Delay before starting the effect. */ /* Trigger */ Uint16 button; /**< Button that triggers the effect. */ Uint16 interval; /**< How soon it can be triggered again after button. */ /* Ramp */ Sint16 start; /**< Beginning strength level. */ Sint16 end; /**< Ending strength level. */ /* Envelope */ Uint16 attack_length; /**< Duration of the attack. */ Uint16 attack_level; /**< Level at the start of the attack. */ Uint16 fade_length; /**< Duration of the fade. */ Uint16 fade_level; /**< Level at the end of the fade. */ } SDL_HapticRamp; /** * \brief A structure containing a template for a Left/Right effect. * * This struct is exclusively for the ::SDL_HAPTIC_LEFTRIGHT effect. * * The Left/Right effect is used to explicitly control the large and small * motors, commonly found in modern game controllers. One motor is high * frequency, the other is low frequency. * * \sa SDL_HAPTIC_LEFTRIGHT * \sa SDL_HapticEffect */ typedef struct SDL_HapticLeftRight { /* Header */ Uint16 type; /**< ::SDL_HAPTIC_LEFTRIGHT */ /* Replay */ Uint32 length; /**< Duration of the effect. */ /* Rumble */ Uint16 large_magnitude; /**< Control of the large controller motor. */ Uint16 small_magnitude; /**< Control of the small controller motor. */ } SDL_HapticLeftRight; /** * \brief A structure containing a template for the ::SDL_HAPTIC_CUSTOM effect. * * A custom force feedback effect is much like a periodic effect, where the * application can define its exact shape. You will have to allocate the * data yourself. Data should consist of channels * samples Uint16 samples. * * If channels is one, the effect is rotated using the defined direction. * Otherwise it uses the samples in data for the different axes. * * \sa SDL_HAPTIC_CUSTOM * \sa SDL_HapticEffect */ typedef struct SDL_HapticCustom { /* Header */ Uint16 type; /**< ::SDL_HAPTIC_CUSTOM */ SDL_HapticDirection direction; /**< Direction of the effect. */ /* Replay */ Uint32 length; /**< Duration of the effect. */ Uint16 delay; /**< Delay before starting the effect. */ /* Trigger */ Uint16 button; /**< Button that triggers the effect. */ Uint16 interval; /**< How soon it can be triggered again after button. */ /* Custom */ Uint8 channels; /**< Axes to use, minimum of one. */ Uint16 period; /**< Sample periods. */ Uint16 samples; /**< Amount of samples. */ Uint16 *data; /**< Should contain channels*samples items. */ /* Envelope */ Uint16 attack_length; /**< Duration of the attack. */ Uint16 attack_level; /**< Level at the start of the attack. */ Uint16 fade_length; /**< Duration of the fade. */ Uint16 fade_level; /**< Level at the end of the fade. */ } SDL_HapticCustom; /** * \brief The generic template for any haptic effect. * * All values max at 32767 (0x7FFF). Signed values also can be negative. * Time values unless specified otherwise are in milliseconds. * * You can also pass ::SDL_HAPTIC_INFINITY to length instead of a 0-32767 * value. Neither delay, interval, attack_length nor fade_length support * ::SDL_HAPTIC_INFINITY. Fade will also not be used since effect never ends. * * Additionally, the ::SDL_HAPTIC_RAMP effect does not support a duration of * ::SDL_HAPTIC_INFINITY. * * Button triggers may not be supported on all devices, it is advised to not * use them if possible. Buttons start at index 1 instead of index 0 like * the joystick. * * If both attack_length and fade_level are 0, the envelope is not used, * otherwise both values are used. * * Common parts: * \code * // Replay - All effects have this * Uint32 length; // Duration of effect (ms). * Uint16 delay; // Delay before starting effect. * * // Trigger - All effects have this * Uint16 button; // Button that triggers effect. * Uint16 interval; // How soon before effect can be triggered again. * * // Envelope - All effects except condition effects have this * Uint16 attack_length; // Duration of the attack (ms). * Uint16 attack_level; // Level at the start of the attack. * Uint16 fade_length; // Duration of the fade out (ms). * Uint16 fade_level; // Level at the end of the fade. * \endcode * * * Here we have an example of a constant effect evolution in time: * \verbatim Strength ^ | | effect level --> _________________ | / \ | / \ | / \ | / \ | attack_level --> | \ | | | <--- fade_level | +--------------------------------------------------> Time [--] [---] attack_length fade_length [------------------][-----------------------] delay length \endverbatim * * Note either the attack_level or the fade_level may be above the actual * effect level. * * \sa SDL_HapticConstant * \sa SDL_HapticPeriodic * \sa SDL_HapticCondition * \sa SDL_HapticRamp * \sa SDL_HapticLeftRight * \sa SDL_HapticCustom */ typedef union SDL_HapticEffect { /* Common for all force feedback effects */ Uint16 type; /**< Effect type. */ SDL_HapticConstant constant; /**< Constant effect. */ SDL_HapticPeriodic periodic; /**< Periodic effect. */ SDL_HapticCondition condition; /**< Condition effect. */ SDL_HapticRamp ramp; /**< Ramp effect. */ SDL_HapticLeftRight leftright; /**< Left/Right effect. */ SDL_HapticCustom custom; /**< Custom effect. */ } SDL_HapticEffect; /* Function prototypes */ /** * \brief Count the number of haptic devices attached to the system. * * \return Number of haptic devices detected on the system. */ extern DECLSPEC int SDLCALL SDL_NumHaptics(void); /** * \brief Get the implementation dependent name of a Haptic device. * * This can be called before any joysticks are opened. * If no name can be found, this function returns NULL. * * \param device_index Index of the device to get its name. * \return Name of the device or NULL on error. * * \sa SDL_NumHaptics */ extern DECLSPEC const char *SDLCALL SDL_HapticName(int device_index); /** * \brief Opens a Haptic device for usage. * * The index passed as an argument refers to the N'th Haptic device on this * system. * * When opening a haptic device, its gain will be set to maximum and * autocenter will be disabled. To modify these values use * SDL_HapticSetGain() and SDL_HapticSetAutocenter(). * * \param device_index Index of the device to open. * \return Device identifier or NULL on error. * * \sa SDL_HapticIndex * \sa SDL_HapticOpenFromMouse * \sa SDL_HapticOpenFromJoystick * \sa SDL_HapticClose * \sa SDL_HapticSetGain * \sa SDL_HapticSetAutocenter * \sa SDL_HapticPause * \sa SDL_HapticStopAll */ extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpen(int device_index); /** * \brief Checks if the haptic device at index has been opened. * * \param device_index Index to check to see if it has been opened. * \return 1 if it has been opened or 0 if it hasn't. * * \sa SDL_HapticOpen * \sa SDL_HapticIndex */ extern DECLSPEC int SDLCALL SDL_HapticOpened(int device_index); /** * \brief Gets the index of a haptic device. * * \param haptic Haptic device to get the index of. * \return The index of the haptic device or -1 on error. * * \sa SDL_HapticOpen * \sa SDL_HapticOpened */ extern DECLSPEC int SDLCALL SDL_HapticIndex(SDL_Haptic * haptic); /** * \brief Gets whether or not the current mouse has haptic capabilities. * * \return SDL_TRUE if the mouse is haptic, SDL_FALSE if it isn't. * * \sa SDL_HapticOpenFromMouse */ extern DECLSPEC int SDLCALL SDL_MouseIsHaptic(void); /** * \brief Tries to open a haptic device from the current mouse. * * \return The haptic device identifier or NULL on error. * * \sa SDL_MouseIsHaptic * \sa SDL_HapticOpen */ extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpenFromMouse(void); /** * \brief Checks to see if a joystick has haptic features. * * \param joystick Joystick to test for haptic capabilities. * \return 1 if the joystick is haptic, 0 if it isn't * or -1 if an error ocurred. * * \sa SDL_HapticOpenFromJoystick */ extern DECLSPEC int SDLCALL SDL_JoystickIsHaptic(SDL_Joystick * joystick); /** * \brief Opens a Haptic device for usage from a Joystick device. * * You must still close the haptic device seperately. It will not be closed * with the joystick. * * When opening from a joystick you should first close the haptic device before * closing the joystick device. If not, on some implementations the haptic * device will also get unallocated and you'll be unable to use force feedback * on that device. * * \param joystick Joystick to create a haptic device from. * \return A valid haptic device identifier on success or NULL on error. * * \sa SDL_HapticOpen * \sa SDL_HapticClose */ extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpenFromJoystick(SDL_Joystick * joystick); /** * \brief Closes a Haptic device previously opened with SDL_HapticOpen(). * * \param haptic Haptic device to close. */ extern DECLSPEC void SDLCALL SDL_HapticClose(SDL_Haptic * haptic); /** * \brief Returns the number of effects a haptic device can store. * * On some platforms this isn't fully supported, and therefore is an * approximation. Always check to see if your created effect was actually * created and do not rely solely on SDL_HapticNumEffects(). * * \param haptic The haptic device to query effect max. * \return The number of effects the haptic device can store or * -1 on error. * * \sa SDL_HapticNumEffectsPlaying * \sa SDL_HapticQuery */ extern DECLSPEC int SDLCALL SDL_HapticNumEffects(SDL_Haptic * haptic); /** * \brief Returns the number of effects a haptic device can play at the same * time. * * This is not supported on all platforms, but will always return a value. * Added here for the sake of completeness. * * \param haptic The haptic device to query maximum playing effects. * \return The number of effects the haptic device can play at the same time * or -1 on error. * * \sa SDL_HapticNumEffects * \sa SDL_HapticQuery */ extern DECLSPEC int SDLCALL SDL_HapticNumEffectsPlaying(SDL_Haptic * haptic); /** * \brief Gets the haptic devices supported features in bitwise matter. * * Example: * \code * if (SDL_HapticQuery(haptic) & SDL_HAPTIC_CONSTANT) { * printf("We have constant haptic effect!"); * } * \endcode * * \param haptic The haptic device to query. * \return Haptic features in bitwise manner (OR'd). * * \sa SDL_HapticNumEffects * \sa SDL_HapticEffectSupported */ extern DECLSPEC unsigned int SDLCALL SDL_HapticQuery(SDL_Haptic * haptic); /** * \brief Gets the number of haptic axes the device has. * * \sa SDL_HapticDirection */ extern DECLSPEC int SDLCALL SDL_HapticNumAxes(SDL_Haptic * haptic); /** * \brief Checks to see if effect is supported by haptic. * * \param haptic Haptic device to check on. * \param effect Effect to check to see if it is supported. * \return SDL_TRUE if effect is supported, SDL_FALSE if it isn't or -1 on error. * * \sa SDL_HapticQuery * \sa SDL_HapticNewEffect */ extern DECLSPEC int SDLCALL SDL_HapticEffectSupported(SDL_Haptic * haptic, SDL_HapticEffect * effect); /** * \brief Creates a new haptic effect on the device. * * \param haptic Haptic device to create the effect on. * \param effect Properties of the effect to create. * \return The id of the effect on success or -1 on error. * * \sa SDL_HapticUpdateEffect * \sa SDL_HapticRunEffect * \sa SDL_HapticDestroyEffect */ extern DECLSPEC int SDLCALL SDL_HapticNewEffect(SDL_Haptic * haptic, SDL_HapticEffect * effect); /** * \brief Updates the properties of an effect. * * Can be used dynamically, although behaviour when dynamically changing * direction may be strange. Specifically the effect may reupload itself * and start playing from the start. You cannot change the type either when * running SDL_HapticUpdateEffect(). * * \param haptic Haptic device that has the effect. * \param effect Effect to update. * \param data New effect properties to use. * \return 0 on success or -1 on error. * * \sa SDL_HapticNewEffect * \sa SDL_HapticRunEffect * \sa SDL_HapticDestroyEffect */ extern DECLSPEC int SDLCALL SDL_HapticUpdateEffect(SDL_Haptic * haptic, int effect, SDL_HapticEffect * data); /** * \brief Runs the haptic effect on its associated haptic device. * * If iterations are ::SDL_HAPTIC_INFINITY, it'll run the effect over and over * repeating the envelope (attack and fade) every time. If you only want the * effect to last forever, set ::SDL_HAPTIC_INFINITY in the effect's length * parameter. * * \param haptic Haptic device to run the effect on. * \param effect Identifier of the haptic effect to run. * \param iterations Number of iterations to run the effect. Use * ::SDL_HAPTIC_INFINITY for infinity. * \return 0 on success or -1 on error. * * \sa SDL_HapticStopEffect * \sa SDL_HapticDestroyEffect * \sa SDL_HapticGetEffectStatus */ extern DECLSPEC int SDLCALL SDL_HapticRunEffect(SDL_Haptic * haptic, int effect, Uint32 iterations); /** * \brief Stops the haptic effect on its associated haptic device. * * \param haptic Haptic device to stop the effect on. * \param effect Identifier of the effect to stop. * \return 0 on success or -1 on error. * * \sa SDL_HapticRunEffect * \sa SDL_HapticDestroyEffect */ extern DECLSPEC int SDLCALL SDL_HapticStopEffect(SDL_Haptic * haptic, int effect); /** * \brief Destroys a haptic effect on the device. * * This will stop the effect if it's running. Effects are automatically * destroyed when the device is closed. * * \param haptic Device to destroy the effect on. * \param effect Identifier of the effect to destroy. * * \sa SDL_HapticNewEffect */ extern DECLSPEC void SDLCALL SDL_HapticDestroyEffect(SDL_Haptic * haptic, int effect); /** * \brief Gets the status of the current effect on the haptic device. * * Device must support the ::SDL_HAPTIC_STATUS feature. * * \param haptic Haptic device to query the effect status on. * \param effect Identifier of the effect to query its status. * \return 0 if it isn't playing, 1 if it is playing or -1 on error. * * \sa SDL_HapticRunEffect * \sa SDL_HapticStopEffect */ extern DECLSPEC int SDLCALL SDL_HapticGetEffectStatus(SDL_Haptic * haptic, int effect); /** * \brief Sets the global gain of the device. * * Device must support the ::SDL_HAPTIC_GAIN feature. * * The user may specify the maximum gain by setting the environment variable * SDL_HAPTIC_GAIN_MAX which should be between 0 and 100. All calls to * SDL_HapticSetGain() will scale linearly using SDL_HAPTIC_GAIN_MAX as the * maximum. * * \param haptic Haptic device to set the gain on. * \param gain Value to set the gain to, should be between 0 and 100. * \return 0 on success or -1 on error. * * \sa SDL_HapticQuery */ extern DECLSPEC int SDLCALL SDL_HapticSetGain(SDL_Haptic * haptic, int gain); /** * \brief Sets the global autocenter of the device. * * Autocenter should be between 0 and 100. Setting it to 0 will disable * autocentering. * * Device must support the ::SDL_HAPTIC_AUTOCENTER feature. * * \param haptic Haptic device to set autocentering on. * \param autocenter Value to set autocenter to, 0 disables autocentering. * \return 0 on success or -1 on error. * * \sa SDL_HapticQuery */ extern DECLSPEC int SDLCALL SDL_HapticSetAutocenter(SDL_Haptic * haptic, int autocenter); /** * \brief Pauses a haptic device. * * Device must support the ::SDL_HAPTIC_PAUSE feature. Call * SDL_HapticUnpause() to resume playback. * * Do not modify the effects nor add new ones while the device is paused. * That can cause all sorts of weird errors. * * \param haptic Haptic device to pause. * \return 0 on success or -1 on error. * * \sa SDL_HapticUnpause */ extern DECLSPEC int SDLCALL SDL_HapticPause(SDL_Haptic * haptic); /** * \brief Unpauses a haptic device. * * Call to unpause after SDL_HapticPause(). * * \param haptic Haptic device to pause. * \return 0 on success or -1 on error. * * \sa SDL_HapticPause */ extern DECLSPEC int SDLCALL SDL_HapticUnpause(SDL_Haptic * haptic); /** * \brief Stops all the currently playing effects on a haptic device. * * \param haptic Haptic device to stop. * \return 0 on success or -1 on error. */ extern DECLSPEC int SDLCALL SDL_HapticStopAll(SDL_Haptic * haptic); /** * \brief Checks to see if rumble is supported on a haptic device. * * \param haptic Haptic device to check to see if it supports rumble. * \return SDL_TRUE if effect is supported, SDL_FALSE if it isn't or -1 on error. * * \sa SDL_HapticRumbleInit * \sa SDL_HapticRumblePlay * \sa SDL_HapticRumbleStop */ extern DECLSPEC int SDLCALL SDL_HapticRumbleSupported(SDL_Haptic * haptic); /** * \brief Initializes the haptic device for simple rumble playback. * * \param haptic Haptic device to initialize for simple rumble playback. * \return 0 on success or -1 on error. * * \sa SDL_HapticOpen * \sa SDL_HapticRumbleSupported * \sa SDL_HapticRumblePlay * \sa SDL_HapticRumbleStop */ extern DECLSPEC int SDLCALL SDL_HapticRumbleInit(SDL_Haptic * haptic); /** * \brief Runs simple rumble on a haptic device * * \param haptic Haptic device to play rumble effect on. * \param strength Strength of the rumble to play as a 0-1 float value. * \param length Length of the rumble to play in milliseconds. * \return 0 on success or -1 on error. * * \sa SDL_HapticRumbleSupported * \sa SDL_HapticRumbleInit * \sa SDL_HapticRumbleStop */ extern DECLSPEC int SDLCALL SDL_HapticRumblePlay(SDL_Haptic * haptic, float strength, Uint32 length ); /** * \brief Stops the simple rumble on a haptic device. * * \param haptic Haptic to stop the rumble on. * \return 0 on success or -1 on error. * * \sa SDL_HapticRumbleSupported * \sa SDL_HapticRumbleInit * \sa SDL_HapticRumblePlay */ extern DECLSPEC int SDLCALL SDL_HapticRumbleStop(SDL_Haptic * haptic); /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif # 1221 "/usr/local/include/SDL2/SDL_haptic.h" #if 0 /* expanded by -frewrite-includes */ #include "close_code.h" #endif /* expanded by -frewrite-includes */ # 1221 "/usr/local/include/SDL2/SDL_haptic.h" # 1 "/usr/local/include/SDL2/close_code.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file close_code.h * * This file reverses the effects of begin_code.h and should be included * after you finish any function and structure declarations in your headers */ #undef _begin_code_h /* Reset structure packing at previous byte alignment */ #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__WATCOMC__) || defined(__BORLANDC__) #ifdef __BORLANDC__ #pragma nopackwarning #endif # 36 "/usr/local/include/SDL2/close_code.h" #pragma pack(pop) #endif /* Compiler needs structure packing set */ # 38 "/usr/local/include/SDL2/close_code.h" # 1222 "/usr/local/include/SDL2/SDL_haptic.h" 2 #endif /* _SDL_haptic_h */ # 1224 "/usr/local/include/SDL2/SDL_haptic.h" /* vi: set ts=4 sw=4 expandtab: */ # 81 "/usr/local/include/SDL2/SDL.h" 2 #if 0 /* expanded by -frewrite-includes */ #include "SDL_hints.h" #endif /* expanded by -frewrite-includes */ # 81 "/usr/local/include/SDL2/SDL.h" # 1 "/usr/local/include/SDL2/SDL_hints.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file SDL_hints.h * * Official documentation for SDL configuration variables * * This file contains functions to set and get configuration hints, * as well as listing each of them alphabetically. * * The convention for naming hints is SDL_HINT_X, where "SDL_X" is * the environment variable that can be used to override the default. * * In general these hints are just that - they may or may not be * supported or applicable on any given platform, but they provide * a way for an application or user to give the library a hint as * to how they would like the library to work. */ #ifndef _SDL_hints_h #define _SDL_hints_h #if 0 /* expanded by -frewrite-includes */ #include "SDL_stdinc.h" #endif /* expanded by -frewrite-includes */ # 42 "/usr/local/include/SDL2/SDL_hints.h" # 43 "/usr/local/include/SDL2/SDL_hints.h" #if 0 /* expanded by -frewrite-includes */ #include "begin_code.h" #endif /* expanded by -frewrite-includes */ # 44 "/usr/local/include/SDL2/SDL_hints.h" # 1 "/usr/local/include/SDL2/begin_code.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file begin_code.h * * This file sets things up for C dynamic library function definitions, * static inlined functions, and structures aligned at 4-byte alignment. * If you don't like ugly C preprocessor code, don't look at this file. :) */ /* This shouldn't be nested -- included it around code only. */ #ifdef _begin_code_h #error Nested inclusion of begin_code.h #endif # 34 "/usr/local/include/SDL2/begin_code.h" #define _begin_code_h #ifndef SDL_DEPRECATED # if (__GNUC__ >= 4) /* technically, this arrived in gcc 3.1, but oh well. */ # define SDL_DEPRECATED __attribute__((deprecated)) # else # 40 "/usr/local/include/SDL2/begin_code.h" # define SDL_DEPRECATED # endif # 42 "/usr/local/include/SDL2/begin_code.h" #endif # 43 "/usr/local/include/SDL2/begin_code.h" /* Some compilers use a special export keyword */ #ifndef DECLSPEC # if defined(__WIN32__) || defined(__WINRT__) # ifdef __BORLANDC__ # ifdef BUILD_SDL # define DECLSPEC # else # 51 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllimport) # endif # 53 "/usr/local/include/SDL2/begin_code.h" # else # 54 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllexport) # endif # 56 "/usr/local/include/SDL2/begin_code.h" # else # 57 "/usr/local/include/SDL2/begin_code.h" # if defined(__GNUC__) && __GNUC__ >= 4 # define DECLSPEC __attribute__ ((visibility("default"))) # elif defined(__GNUC__) && __GNUC__ >= 2 # 60 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllexport) # else # 62 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC # endif # 64 "/usr/local/include/SDL2/begin_code.h" # endif # 65 "/usr/local/include/SDL2/begin_code.h" #endif # 66 "/usr/local/include/SDL2/begin_code.h" /* By default SDL uses the C calling convention */ #ifndef SDLCALL #if (defined(__WIN32__) || defined(__WINRT__)) && !defined(__GNUC__) #define SDLCALL __cdecl #else # 72 "/usr/local/include/SDL2/begin_code.h" #define SDLCALL #endif # 74 "/usr/local/include/SDL2/begin_code.h" #endif /* SDLCALL */ # 75 "/usr/local/include/SDL2/begin_code.h" /* Removed DECLSPEC on Symbian OS because SDL cannot be a DLL in EPOC */ #ifdef __SYMBIAN32__ #undef DECLSPEC #define DECLSPEC #endif /* __SYMBIAN32__ */ # 81 "/usr/local/include/SDL2/begin_code.h" /* Force structure packing at 4 byte alignment. This is necessary if the header is included in code which has structure packing set to an alternate value, say for loading structures from disk. The packing is reset to the previous value in close_code.h */ #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__) #ifdef _MSC_VER #pragma warning(disable: 4103) #endif # 91 "/usr/local/include/SDL2/begin_code.h" #ifdef __BORLANDC__ #pragma nopackwarning #endif # 94 "/usr/local/include/SDL2/begin_code.h" #ifdef _M_X64 /* Use 8-byte alignment on 64-bit architectures, so pointers are aligned */ #pragma pack(push,8) #else # 98 "/usr/local/include/SDL2/begin_code.h" #pragma pack(push,4) #endif # 100 "/usr/local/include/SDL2/begin_code.h" #endif /* Compiler needs structure packing set */ # 101 "/usr/local/include/SDL2/begin_code.h" #ifndef SDL_INLINE #if defined(__GNUC__) #define SDL_INLINE __inline__ #elif defined(_MSC_VER) || defined(__BORLANDC__) || \ defined(__DMC__) || defined(__SC__) || \ defined(__WATCOMC__) || defined(__LCC__) || \ defined(__DECC) # 109 "/usr/local/include/SDL2/begin_code.h" #define SDL_INLINE __inline #ifndef __inline__ #define __inline__ __inline #endif # 113 "/usr/local/include/SDL2/begin_code.h" #else # 114 "/usr/local/include/SDL2/begin_code.h" #define SDL_INLINE inline #ifndef __inline__ #define __inline__ inline #endif # 118 "/usr/local/include/SDL2/begin_code.h" #endif # 119 "/usr/local/include/SDL2/begin_code.h" #endif /* SDL_INLINE not defined */ # 120 "/usr/local/include/SDL2/begin_code.h" #ifndef SDL_FORCE_INLINE #if defined(_MSC_VER) #define SDL_FORCE_INLINE __forceinline #elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) ) # 125 "/usr/local/include/SDL2/begin_code.h" #define SDL_FORCE_INLINE __attribute__((always_inline)) static __inline__ #else # 127 "/usr/local/include/SDL2/begin_code.h" #define SDL_FORCE_INLINE static SDL_INLINE #endif # 129 "/usr/local/include/SDL2/begin_code.h" #endif /* SDL_FORCE_INLINE not defined */ # 130 "/usr/local/include/SDL2/begin_code.h" /* Apparently this is needed by several Windows compilers */ #if !defined(__MACH__) #ifndef NULL #ifdef __cplusplus #define NULL 0 #else # 137 "/usr/local/include/SDL2/begin_code.h" #define NULL ((void *)0) #endif # 139 "/usr/local/include/SDL2/begin_code.h" #endif /* NULL */ # 140 "/usr/local/include/SDL2/begin_code.h" #endif /* ! Mac OS X - breaks precompiled headers */ # 141 "/usr/local/include/SDL2/begin_code.h" # 45 "/usr/local/include/SDL2/SDL_hints.h" 2 /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif # 49 "/usr/local/include/SDL2/SDL_hints.h" /** * \brief A variable controlling how 3D acceleration is used to accelerate the SDL screen surface. * * SDL can try to accelerate the SDL screen surface by using streaming * textures with a 3D rendering engine. This variable controls whether and * how this is done. * * This variable can be set to the following values: * "0" - Disable 3D acceleration * "1" - Enable 3D acceleration, using the default renderer. * "X" - Enable 3D acceleration, using X where X is one of the valid rendering drivers. (e.g. "direct3d", "opengl", etc.) * * By default SDL tries to make a best guess for each platform whether * to use acceleration or not. */ #define SDL_HINT_FRAMEBUFFER_ACCELERATION "SDL_FRAMEBUFFER_ACCELERATION" /** * \brief A variable specifying which render driver to use. * * If the application doesn't pick a specific renderer to use, this variable * specifies the name of the preferred renderer. If the preferred renderer * can't be initialized, the normal default renderer is used. * * This variable is case insensitive and can be set to the following values: * "direct3d" * "opengl" * "opengles2" * "opengles" * "software" * * The default varies by platform, but it's the first one in the list that * is available on the current platform. */ #define SDL_HINT_RENDER_DRIVER "SDL_RENDER_DRIVER" /** * \brief A variable controlling whether the OpenGL render driver uses shaders if they are available. * * This variable can be set to the following values: * "0" - Disable shaders * "1" - Enable shaders * * By default shaders are used if OpenGL supports them. */ #define SDL_HINT_RENDER_OPENGL_SHADERS "SDL_RENDER_OPENGL_SHADERS" /** * \brief A variable controlling whether the Direct3D device is initialized for thread-safe operations. * * This variable can be set to the following values: * "0" - Thread-safety is not enabled (faster) * "1" - Thread-safety is enabled * * By default the Direct3D device is created with thread-safety disabled. */ #define SDL_HINT_RENDER_DIRECT3D_THREADSAFE "SDL_RENDER_DIRECT3D_THREADSAFE" /** * \brief A variable controlling whether to enable Direct3D 11+'s Debug Layer. * * This variable does not have any effect on the Direct3D 9 based renderer. * * This variable can be set to the following values: * "0" - Disable Debug Layer use * "1" - Enable Debug Layer use * * By default, SDL does not use Direct3D Debug Layer. */ #define SDL_HINT_RENDER_DIRECT3D11_DEBUG "SDL_HINT_RENDER_DIRECT3D11_DEBUG" /** * \brief A variable controlling the scaling quality * * This variable can be set to the following values: * "0" or "nearest" - Nearest pixel sampling * "1" or "linear" - Linear filtering (supported by OpenGL and Direct3D) * "2" or "best" - Currently this is the same as "linear" * * By default nearest pixel sampling is used */ #define SDL_HINT_RENDER_SCALE_QUALITY "SDL_RENDER_SCALE_QUALITY" /** * \brief A variable controlling whether updates to the SDL screen surface should be synchronized with the vertical refresh, to avoid tearing. * * This variable can be set to the following values: * "0" - Disable vsync * "1" - Enable vsync * * By default SDL does not sync screen surface updates with vertical refresh. */ #define SDL_HINT_RENDER_VSYNC "SDL_RENDER_VSYNC" /** * \brief A variable controlling whether the screensaver is enabled. * * This variable can be set to the following values: * "0" - Disable screensaver * "1" - Enable screensaver * * By default SDL will disable the screensaver. */ #define SDL_HINT_VIDEO_ALLOW_SCREENSAVER "SDL_VIDEO_ALLOW_SCREENSAVER" /** * \brief A variable controlling whether the X11 VidMode extension should be used. * * This variable can be set to the following values: * "0" - Disable XVidMode * "1" - Enable XVidMode * * By default SDL will use XVidMode if it is available. */ #define SDL_HINT_VIDEO_X11_XVIDMODE "SDL_VIDEO_X11_XVIDMODE" /** * \brief A variable controlling whether the X11 Xinerama extension should be used. * * This variable can be set to the following values: * "0" - Disable Xinerama * "1" - Enable Xinerama * * By default SDL will use Xinerama if it is available. */ #define SDL_HINT_VIDEO_X11_XINERAMA "SDL_VIDEO_X11_XINERAMA" /** * \brief A variable controlling whether the X11 XRandR extension should be used. * * This variable can be set to the following values: * "0" - Disable XRandR * "1" - Enable XRandR * * By default SDL will not use XRandR because of window manager issues. */ #define SDL_HINT_VIDEO_X11_XRANDR "SDL_VIDEO_X11_XRANDR" /** * \brief A variable controlling whether grabbing input grabs the keyboard * * This variable can be set to the following values: * "0" - Grab will affect only the mouse * "1" - Grab will affect mouse and keyboard * * By default SDL will not grab the keyboard so system shortcuts still work. */ #define SDL_HINT_GRAB_KEYBOARD "SDL_GRAB_KEYBOARD" /** * \brief A variable controlling whether relative mouse mode is implemented using mouse warping * * This variable can be set to the following values: * "0" - Relative mouse mode uses raw input * "1" - Relative mouse mode uses mouse warping * * By default SDL will use raw input for relative mouse mode */ #define SDL_HINT_MOUSE_RELATIVE_MODE_WARP "SDL_MOUSE_RELATIVE_MODE_WARP" /** * \brief Minimize your SDL_Window if it loses key focus when in fullscreen mode. Defaults to true. * */ #define SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS "SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS" /** * \brief A variable controlling whether the idle timer is disabled on iOS. * * When an iOS app does not receive touches for some time, the screen is * dimmed automatically. For games where the accelerometer is the only input * this is problematic. This functionality can be disabled by setting this * hint. * * This variable can be set to the following values: * "0" - Enable idle timer * "1" - Disable idle timer */ #define SDL_HINT_IDLE_TIMER_DISABLED "SDL_IOS_IDLE_TIMER_DISABLED" /** * \brief A variable controlling which orientations are allowed on iOS. * * In some circumstances it is necessary to be able to explicitly control * which UI orientations are allowed. * * This variable is a space delimited list of the following values: * "LandscapeLeft", "LandscapeRight", "Portrait" "PortraitUpsideDown" */ #define SDL_HINT_ORIENTATIONS "SDL_IOS_ORIENTATIONS" /** * \brief A variable controlling whether an Android built-in accelerometer should be * listed as a joystick device, rather than listing actual joysticks only. * * This variable can be set to the following values: * "0" - List only real joysticks and accept input from them * "1" - List real joysticks along with the accelerometer as if it were a 3 axis joystick (the default). */ #define SDL_HINT_ACCELEROMETER_AS_JOYSTICK "SDL_ACCELEROMETER_AS_JOYSTICK" /** * \brief A variable that lets you disable the detection and use of Xinput gamepad devices * * The variable can be set to the following values: * "0" - Disable XInput detection (only uses direct input) * "1" - Enable XInput detection (the default) */ #define SDL_HINT_XINPUT_ENABLED "SDL_XINPUT_ENABLED" /** * \brief A variable that lets you manually hint extra gamecontroller db entries * * The variable should be newline delimited rows of gamecontroller config data, see SDL_gamecontroller.h * * This hint must be set before calling SDL_Init(SDL_INIT_GAMECONTROLLER) * You can update mappings after the system is initialized with SDL_GameControllerMappingForGUID() and SDL_GameControllerAddMapping() */ #define SDL_HINT_GAMECONTROLLERCONFIG "SDL_GAMECONTROLLERCONFIG" /** * \brief A variable that lets you enable joystick (and gamecontroller) events even when your app is in the background. * * The variable can be set to the following values: * "0" - Disable joystick & gamecontroller input events when the * application is in the background. * "1" - Enable joystick & gamecontroller input events when the * application is in the background. * * The default value is "0". This hint may be set at any time. */ #define SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS "SDL_JOYSTICK_ALLOW_BACKGROUND_EVENTS" /** * \brief If set to 0 then never set the top most bit on a SDL Window, even if the video mode expects it. * This is a debugging aid for developers and not expected to be used by end users. The default is "1" * * This variable can be set to the following values: * "0" - don't allow topmost * "1" - allow topmost */ #define SDL_HINT_ALLOW_TOPMOST "SDL_ALLOW_TOPMOST" /** * \brief A variable that controls the timer resolution, in milliseconds. * * The higher resolution the timer, the more frequently the CPU services * timer interrupts, and the more precise delays are, but this takes up * power and CPU time. This hint is only used on Windows 7 and earlier. * * See this blog post for more information: * http://randomascii.wordpress.com/2013/07/08/windows-timer-resolution-megawatts-wasted/ * * If this variable is set to "0", the system timer resolution is not set. * * The default value is "1". This hint may be set at any time. */ #define SDL_HINT_TIMER_RESOLUTION "SDL_TIMER_RESOLUTION" /** * \brief If set to 1, then do not allow high-DPI windows. ("Retina" on Mac) */ #define SDL_HINT_VIDEO_HIGHDPI_DISABLED "SDL_VIDEO_HIGHDPI_DISABLED" /** * \brief A variable that determines whether ctrl+click should generate a right-click event on Mac * * If present, holding ctrl while left clicking will generate a right click * event when on Mac. */ #define SDL_HINT_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK "SDL_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK" /** * \brief A variable specifying which shader compiler to preload when using the Chrome ANGLE binaries * * SDL has EGL and OpenGL ES2 support on Windows via the ANGLE project. It * can use two different sets of binaries, those compiled by the user from source * or those provided by the Chrome browser. In the later case, these binaries require * that SDL loads a DLL providing the shader compiler. * * This variable can be set to the following values: * "d3dcompiler_46.dll" - default, best for Vista or later. * "d3dcompiler_43.dll" - for XP support. * "none" - do not load any library, useful if you compiled ANGLE from source and included the compiler in your binaries. * */ #define SDL_HINT_VIDEO_WIN_D3DCOMPILER "SDL_VIDEO_WIN_D3DCOMPILER" /** * \brief A variable that is the address of another SDL_Window* (as a hex string formatted with "%p"). * * If this hint is set before SDL_CreateWindowFrom() and the SDL_Window* it is set to has * SDL_WINDOW_OPENGL set (and running on WGL only, currently), then two things will occur on the newly * created SDL_Window: * * 1. Its pixel format will be set to the same pixel format as this SDL_Window. This is * needed for example when sharing an OpenGL context across multiple windows. * * 2. The flag SDL_WINDOW_OPENGL will be set on the new window so it can be used for * OpenGL rendering. * * This variable can be set to the following values: * The address (as a string "%p") of the SDL_Window* that new windows created with SDL_CreateWindowFrom() should * share a pixel format with. */ #define SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT "SDL_VIDEO_WINDOW_SHARE_PIXEL_FORMAT" /* * \brief A URL to a WinRT app's privacy policy * * All network-enabled WinRT apps must make a privacy policy available to its * users. On Windows 8, 8.1, and RT, Microsoft mandates that this policy be * be available in the Windows Settings charm, as accessed from within the app. * SDL provides code to add a URL-based link there, which can point to the app's * privacy policy. * * To setup a URL to an app's privacy policy, set SDL_HINT_WINRT_PRIVACY_POLICY_URL * before calling any SDL_Init functions. The contents of the hint should * be a valid URL. For example, "http://www.example.com". * * The default value is "", which will prevent SDL from adding a privacy policy * link to the Settings charm. This hint should only be set during app init. * * The label text of an app's "Privacy Policy" link may be customized via another * hint, SDL_HINT_WINRT_PRIVACY_POLICY_LABEL. * * Please note that on Windows Phone, Microsoft does not provide standard UI * for displaying a privacy policy link, and as such, SDL_HINT_WINRT_PRIVACY_POLICY_URL * will not get used on that platform. Network-enabled phone apps should display * their privacy policy through some other, in-app means. */ #define SDL_HINT_WINRT_PRIVACY_POLICY_URL "SDL_HINT_WINRT_PRIVACY_POLICY_URL" /** \brief Label text for a WinRT app's privacy policy link * * Network-enabled WinRT apps must include a privacy policy. On Windows 8, 8.1, and RT, * Microsoft mandates that this policy be available via the Windows Settings charm. * SDL provides code to add a link there, with it's label text being set via the * optional hint, SDL_HINT_WINRT_PRIVACY_POLICY_LABEL. * * Please note that a privacy policy's contents are not set via this hint. A separate * hint, SDL_HINT_WINRT_PRIVACY_POLICY_URL, is used to link to the actual text of the * policy. * * The contents of this hint should be encoded as a UTF8 string. * * The default value is "Privacy Policy". This hint should only be set during app * initialization, preferably before any calls to SDL_Init. * * For additional information on linking to a privacy policy, see the documentation for * SDL_HINT_WINRT_PRIVACY_POLICY_URL. */ #define SDL_HINT_WINRT_PRIVACY_POLICY_LABEL "SDL_HINT_WINRT_PRIVACY_POLICY_LABEL" /** \brief If set to 1, back button press events on Windows Phone 8+ will be marked as handled. * * TODO, WinRT: document SDL_HINT_WINRT_HANDLE_BACK_BUTTON need and use * For now, more details on why this is needed can be found at the * beginning of the following web page: * http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj247550(v=vs.105).aspx */ #define SDL_HINT_WINRT_HANDLE_BACK_BUTTON "SDL_HINT_WINRT_HANDLE_BACK_BUTTON" /** * \brief A variable that dictates policy for fullscreen Spaces on Mac OS X. * * This hint only applies to Mac OS X. * * The variable can be set to the following values: * "0" - Disable Spaces support (FULLSCREEN_DESKTOP won't use them and * SDL_WINDOW_RESIZABLE windows won't offer the "fullscreen" * button on their titlebars). * "1" - Enable Spaces support (FULLSCREEN_DESKTOP will use them and * SDL_WINDOW_RESIZABLE windows will offer the "fullscreen" * button on their titlebars. * * The default value is "1". Spaces are disabled regardless of this hint if * the OS isn't at least Mac OS X Lion (10.7). This hint must be set before * any windows are created. */ #define SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES "SDL_VIDEO_MAC_FULLSCREEN_SPACES" /** * \brief An enumeration of hint priorities */ typedef enum { SDL_HINT_DEFAULT, SDL_HINT_NORMAL, SDL_HINT_OVERRIDE } SDL_HintPriority; /** * \brief Set a hint with a specific priority * * The priority controls the behavior when setting a hint that already * has a value. Hints will replace existing hints of their priority and * lower. Environment variables are considered to have override priority. * * \return SDL_TRUE if the hint was set, SDL_FALSE otherwise */ extern DECLSPEC SDL_bool SDLCALL SDL_SetHintWithPriority(const char *name, const char *value, SDL_HintPriority priority); /** * \brief Set a hint with normal priority * * \return SDL_TRUE if the hint was set, SDL_FALSE otherwise */ extern DECLSPEC SDL_bool SDLCALL SDL_SetHint(const char *name, const char *value); /** * \brief Get a hint * * \return The string value of a hint variable. */ extern DECLSPEC const char * SDLCALL SDL_GetHint(const char *name); /** * \brief Add a function to watch a particular hint * * \param name The hint to watch * \param callback The function to call when the hint value changes * \param userdata A pointer to pass to the callback function */ typedef void (*SDL_HintCallback)(void *userdata, const char *name, const char *oldValue, const char *newValue); extern DECLSPEC void SDLCALL SDL_AddHintCallback(const char *name, SDL_HintCallback callback, void *userdata); /** * \brief Remove a function watching a particular hint * * \param name The hint being watched * \param callback The function being called when the hint value changes * \param userdata A pointer being passed to the callback function */ extern DECLSPEC void SDLCALL SDL_DelHintCallback(const char *name, SDL_HintCallback callback, void *userdata); /** * \brief Clear all hints * * This function is called during SDL_Quit() to free stored hints. */ extern DECLSPEC void SDLCALL SDL_ClearHints(void); /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif # 513 "/usr/local/include/SDL2/SDL_hints.h" #if 0 /* expanded by -frewrite-includes */ #include "close_code.h" #endif /* expanded by -frewrite-includes */ # 513 "/usr/local/include/SDL2/SDL_hints.h" # 1 "/usr/local/include/SDL2/close_code.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file close_code.h * * This file reverses the effects of begin_code.h and should be included * after you finish any function and structure declarations in your headers */ #undef _begin_code_h /* Reset structure packing at previous byte alignment */ #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__WATCOMC__) || defined(__BORLANDC__) #ifdef __BORLANDC__ #pragma nopackwarning #endif # 36 "/usr/local/include/SDL2/close_code.h" #pragma pack(pop) #endif /* Compiler needs structure packing set */ # 38 "/usr/local/include/SDL2/close_code.h" # 514 "/usr/local/include/SDL2/SDL_hints.h" 2 #endif /* _SDL_hints_h */ # 516 "/usr/local/include/SDL2/SDL_hints.h" /* vi: set ts=4 sw=4 expandtab: */ # 82 "/usr/local/include/SDL2/SDL.h" 2 #if 0 /* expanded by -frewrite-includes */ #include "SDL_loadso.h" #endif /* expanded by -frewrite-includes */ # 82 "/usr/local/include/SDL2/SDL.h" # 1 "/usr/local/include/SDL2/SDL_loadso.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file SDL_loadso.h * * System dependent library loading routines * * Some things to keep in mind: * \li These functions only work on C function names. Other languages may * have name mangling and intrinsic language support that varies from * compiler to compiler. * \li Make sure you declare your function pointers with the same calling * convention as the actual library function. Your code will crash * mysteriously if you do not do this. * \li Avoid namespace collisions. If you load a symbol from the library, * it is not defined whether or not it goes into the global symbol * namespace for the application. If it does and it conflicts with * symbols in your code or other shared libraries, you will not get * the results you expect. :) */ #ifndef _SDL_loadso_h #define _SDL_loadso_h #if 0 /* expanded by -frewrite-includes */ #include "SDL_stdinc.h" #endif /* expanded by -frewrite-includes */ # 44 "/usr/local/include/SDL2/SDL_loadso.h" # 45 "/usr/local/include/SDL2/SDL_loadso.h" #if 0 /* expanded by -frewrite-includes */ #include "SDL_error.h" #endif /* expanded by -frewrite-includes */ # 45 "/usr/local/include/SDL2/SDL_loadso.h" # 46 "/usr/local/include/SDL2/SDL_loadso.h" #if 0 /* expanded by -frewrite-includes */ #include "begin_code.h" #endif /* expanded by -frewrite-includes */ # 47 "/usr/local/include/SDL2/SDL_loadso.h" # 1 "/usr/local/include/SDL2/begin_code.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file begin_code.h * * This file sets things up for C dynamic library function definitions, * static inlined functions, and structures aligned at 4-byte alignment. * If you don't like ugly C preprocessor code, don't look at this file. :) */ /* This shouldn't be nested -- included it around code only. */ #ifdef _begin_code_h #error Nested inclusion of begin_code.h #endif # 34 "/usr/local/include/SDL2/begin_code.h" #define _begin_code_h #ifndef SDL_DEPRECATED # if (__GNUC__ >= 4) /* technically, this arrived in gcc 3.1, but oh well. */ # define SDL_DEPRECATED __attribute__((deprecated)) # else # 40 "/usr/local/include/SDL2/begin_code.h" # define SDL_DEPRECATED # endif # 42 "/usr/local/include/SDL2/begin_code.h" #endif # 43 "/usr/local/include/SDL2/begin_code.h" /* Some compilers use a special export keyword */ #ifndef DECLSPEC # if defined(__WIN32__) || defined(__WINRT__) # ifdef __BORLANDC__ # ifdef BUILD_SDL # define DECLSPEC # else # 51 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllimport) # endif # 53 "/usr/local/include/SDL2/begin_code.h" # else # 54 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllexport) # endif # 56 "/usr/local/include/SDL2/begin_code.h" # else # 57 "/usr/local/include/SDL2/begin_code.h" # if defined(__GNUC__) && __GNUC__ >= 4 # define DECLSPEC __attribute__ ((visibility("default"))) # elif defined(__GNUC__) && __GNUC__ >= 2 # 60 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllexport) # else # 62 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC # endif # 64 "/usr/local/include/SDL2/begin_code.h" # endif # 65 "/usr/local/include/SDL2/begin_code.h" #endif # 66 "/usr/local/include/SDL2/begin_code.h" /* By default SDL uses the C calling convention */ #ifndef SDLCALL #if (defined(__WIN32__) || defined(__WINRT__)) && !defined(__GNUC__) #define SDLCALL __cdecl #else # 72 "/usr/local/include/SDL2/begin_code.h" #define SDLCALL #endif # 74 "/usr/local/include/SDL2/begin_code.h" #endif /* SDLCALL */ # 75 "/usr/local/include/SDL2/begin_code.h" /* Removed DECLSPEC on Symbian OS because SDL cannot be a DLL in EPOC */ #ifdef __SYMBIAN32__ #undef DECLSPEC #define DECLSPEC #endif /* __SYMBIAN32__ */ # 81 "/usr/local/include/SDL2/begin_code.h" /* Force structure packing at 4 byte alignment. This is necessary if the header is included in code which has structure packing set to an alternate value, say for loading structures from disk. The packing is reset to the previous value in close_code.h */ #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__) #ifdef _MSC_VER #pragma warning(disable: 4103) #endif # 91 "/usr/local/include/SDL2/begin_code.h" #ifdef __BORLANDC__ #pragma nopackwarning #endif # 94 "/usr/local/include/SDL2/begin_code.h" #ifdef _M_X64 /* Use 8-byte alignment on 64-bit architectures, so pointers are aligned */ #pragma pack(push,8) #else # 98 "/usr/local/include/SDL2/begin_code.h" #pragma pack(push,4) #endif # 100 "/usr/local/include/SDL2/begin_code.h" #endif /* Compiler needs structure packing set */ # 101 "/usr/local/include/SDL2/begin_code.h" #ifndef SDL_INLINE #if defined(__GNUC__) #define SDL_INLINE __inline__ #elif defined(_MSC_VER) || defined(__BORLANDC__) || \ defined(__DMC__) || defined(__SC__) || \ defined(__WATCOMC__) || defined(__LCC__) || \ defined(__DECC) # 109 "/usr/local/include/SDL2/begin_code.h" #define SDL_INLINE __inline #ifndef __inline__ #define __inline__ __inline #endif # 113 "/usr/local/include/SDL2/begin_code.h" #else # 114 "/usr/local/include/SDL2/begin_code.h" #define SDL_INLINE inline #ifndef __inline__ #define __inline__ inline #endif # 118 "/usr/local/include/SDL2/begin_code.h" #endif # 119 "/usr/local/include/SDL2/begin_code.h" #endif /* SDL_INLINE not defined */ # 120 "/usr/local/include/SDL2/begin_code.h" #ifndef SDL_FORCE_INLINE #if defined(_MSC_VER) #define SDL_FORCE_INLINE __forceinline #elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) ) # 125 "/usr/local/include/SDL2/begin_code.h" #define SDL_FORCE_INLINE __attribute__((always_inline)) static __inline__ #else # 127 "/usr/local/include/SDL2/begin_code.h" #define SDL_FORCE_INLINE static SDL_INLINE #endif # 129 "/usr/local/include/SDL2/begin_code.h" #endif /* SDL_FORCE_INLINE not defined */ # 130 "/usr/local/include/SDL2/begin_code.h" /* Apparently this is needed by several Windows compilers */ #if !defined(__MACH__) #ifndef NULL #ifdef __cplusplus #define NULL 0 #else # 137 "/usr/local/include/SDL2/begin_code.h" #define NULL ((void *)0) #endif # 139 "/usr/local/include/SDL2/begin_code.h" #endif /* NULL */ # 140 "/usr/local/include/SDL2/begin_code.h" #endif /* ! Mac OS X - breaks precompiled headers */ # 141 "/usr/local/include/SDL2/begin_code.h" # 48 "/usr/local/include/SDL2/SDL_loadso.h" 2 /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif # 52 "/usr/local/include/SDL2/SDL_loadso.h" /** * This function dynamically loads a shared object and returns a pointer * to the object handle (or NULL if there was an error). * The 'sofile' parameter is a system dependent name of the object file. */ extern DECLSPEC void *SDLCALL SDL_LoadObject(const char *sofile); /** * Given an object handle, this function looks up the address of the * named function in the shared object and returns it. This address * is no longer valid after calling SDL_UnloadObject(). */ extern DECLSPEC void *SDLCALL SDL_LoadFunction(void *handle, const char *name); /** * Unload a shared object from memory. */ extern DECLSPEC void SDLCALL SDL_UnloadObject(void *handle); /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif # 77 "/usr/local/include/SDL2/SDL_loadso.h" #if 0 /* expanded by -frewrite-includes */ #include "close_code.h" #endif /* expanded by -frewrite-includes */ # 77 "/usr/local/include/SDL2/SDL_loadso.h" # 1 "/usr/local/include/SDL2/close_code.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file close_code.h * * This file reverses the effects of begin_code.h and should be included * after you finish any function and structure declarations in your headers */ #undef _begin_code_h /* Reset structure packing at previous byte alignment */ #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__WATCOMC__) || defined(__BORLANDC__) #ifdef __BORLANDC__ #pragma nopackwarning #endif # 36 "/usr/local/include/SDL2/close_code.h" #pragma pack(pop) #endif /* Compiler needs structure packing set */ # 38 "/usr/local/include/SDL2/close_code.h" # 78 "/usr/local/include/SDL2/SDL_loadso.h" 2 #endif /* _SDL_loadso_h */ # 80 "/usr/local/include/SDL2/SDL_loadso.h" /* vi: set ts=4 sw=4 expandtab: */ # 83 "/usr/local/include/SDL2/SDL.h" 2 #if 0 /* expanded by -frewrite-includes */ #include "SDL_log.h" #endif /* expanded by -frewrite-includes */ # 83 "/usr/local/include/SDL2/SDL.h" # 1 "/usr/local/include/SDL2/SDL_log.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file SDL_log.h * * Simple log messages with categories and priorities. * * By default logs are quiet, but if you're debugging SDL you might want: * * SDL_LogSetAllPriority(SDL_LOG_PRIORITY_WARN); * * Here's where the messages go on different platforms: * Windows: debug output stream * Android: log output * Others: standard error output (stderr) */ #ifndef _SDL_log_h #define _SDL_log_h #if 0 /* expanded by -frewrite-includes */ #include "SDL_stdinc.h" #endif /* expanded by -frewrite-includes */ # 40 "/usr/local/include/SDL2/SDL_log.h" # 41 "/usr/local/include/SDL2/SDL_log.h" #if 0 /* expanded by -frewrite-includes */ #include "begin_code.h" #endif /* expanded by -frewrite-includes */ # 42 "/usr/local/include/SDL2/SDL_log.h" # 1 "/usr/local/include/SDL2/begin_code.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file begin_code.h * * This file sets things up for C dynamic library function definitions, * static inlined functions, and structures aligned at 4-byte alignment. * If you don't like ugly C preprocessor code, don't look at this file. :) */ /* This shouldn't be nested -- included it around code only. */ #ifdef _begin_code_h #error Nested inclusion of begin_code.h #endif # 34 "/usr/local/include/SDL2/begin_code.h" #define _begin_code_h #ifndef SDL_DEPRECATED # if (__GNUC__ >= 4) /* technically, this arrived in gcc 3.1, but oh well. */ # define SDL_DEPRECATED __attribute__((deprecated)) # else # 40 "/usr/local/include/SDL2/begin_code.h" # define SDL_DEPRECATED # endif # 42 "/usr/local/include/SDL2/begin_code.h" #endif # 43 "/usr/local/include/SDL2/begin_code.h" /* Some compilers use a special export keyword */ #ifndef DECLSPEC # if defined(__WIN32__) || defined(__WINRT__) # ifdef __BORLANDC__ # ifdef BUILD_SDL # define DECLSPEC # else # 51 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllimport) # endif # 53 "/usr/local/include/SDL2/begin_code.h" # else # 54 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllexport) # endif # 56 "/usr/local/include/SDL2/begin_code.h" # else # 57 "/usr/local/include/SDL2/begin_code.h" # if defined(__GNUC__) && __GNUC__ >= 4 # define DECLSPEC __attribute__ ((visibility("default"))) # elif defined(__GNUC__) && __GNUC__ >= 2 # 60 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllexport) # else # 62 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC # endif # 64 "/usr/local/include/SDL2/begin_code.h" # endif # 65 "/usr/local/include/SDL2/begin_code.h" #endif # 66 "/usr/local/include/SDL2/begin_code.h" /* By default SDL uses the C calling convention */ #ifndef SDLCALL #if (defined(__WIN32__) || defined(__WINRT__)) && !defined(__GNUC__) #define SDLCALL __cdecl #else # 72 "/usr/local/include/SDL2/begin_code.h" #define SDLCALL #endif # 74 "/usr/local/include/SDL2/begin_code.h" #endif /* SDLCALL */ # 75 "/usr/local/include/SDL2/begin_code.h" /* Removed DECLSPEC on Symbian OS because SDL cannot be a DLL in EPOC */ #ifdef __SYMBIAN32__ #undef DECLSPEC #define DECLSPEC #endif /* __SYMBIAN32__ */ # 81 "/usr/local/include/SDL2/begin_code.h" /* Force structure packing at 4 byte alignment. This is necessary if the header is included in code which has structure packing set to an alternate value, say for loading structures from disk. The packing is reset to the previous value in close_code.h */ #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__) #ifdef _MSC_VER #pragma warning(disable: 4103) #endif # 91 "/usr/local/include/SDL2/begin_code.h" #ifdef __BORLANDC__ #pragma nopackwarning #endif # 94 "/usr/local/include/SDL2/begin_code.h" #ifdef _M_X64 /* Use 8-byte alignment on 64-bit architectures, so pointers are aligned */ #pragma pack(push,8) #else # 98 "/usr/local/include/SDL2/begin_code.h" #pragma pack(push,4) #endif # 100 "/usr/local/include/SDL2/begin_code.h" #endif /* Compiler needs structure packing set */ # 101 "/usr/local/include/SDL2/begin_code.h" #ifndef SDL_INLINE #if defined(__GNUC__) #define SDL_INLINE __inline__ #elif defined(_MSC_VER) || defined(__BORLANDC__) || \ defined(__DMC__) || defined(__SC__) || \ defined(__WATCOMC__) || defined(__LCC__) || \ defined(__DECC) # 109 "/usr/local/include/SDL2/begin_code.h" #define SDL_INLINE __inline #ifndef __inline__ #define __inline__ __inline #endif # 113 "/usr/local/include/SDL2/begin_code.h" #else # 114 "/usr/local/include/SDL2/begin_code.h" #define SDL_INLINE inline #ifndef __inline__ #define __inline__ inline #endif # 118 "/usr/local/include/SDL2/begin_code.h" #endif # 119 "/usr/local/include/SDL2/begin_code.h" #endif /* SDL_INLINE not defined */ # 120 "/usr/local/include/SDL2/begin_code.h" #ifndef SDL_FORCE_INLINE #if defined(_MSC_VER) #define SDL_FORCE_INLINE __forceinline #elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) ) # 125 "/usr/local/include/SDL2/begin_code.h" #define SDL_FORCE_INLINE __attribute__((always_inline)) static __inline__ #else # 127 "/usr/local/include/SDL2/begin_code.h" #define SDL_FORCE_INLINE static SDL_INLINE #endif # 129 "/usr/local/include/SDL2/begin_code.h" #endif /* SDL_FORCE_INLINE not defined */ # 130 "/usr/local/include/SDL2/begin_code.h" /* Apparently this is needed by several Windows compilers */ #if !defined(__MACH__) #ifndef NULL #ifdef __cplusplus #define NULL 0 #else # 137 "/usr/local/include/SDL2/begin_code.h" #define NULL ((void *)0) #endif # 139 "/usr/local/include/SDL2/begin_code.h" #endif /* NULL */ # 140 "/usr/local/include/SDL2/begin_code.h" #endif /* ! Mac OS X - breaks precompiled headers */ # 141 "/usr/local/include/SDL2/begin_code.h" # 43 "/usr/local/include/SDL2/SDL_log.h" 2 /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif # 47 "/usr/local/include/SDL2/SDL_log.h" /** * \brief The maximum size of a log message * * Messages longer than the maximum size will be truncated */ #define SDL_MAX_LOG_MESSAGE 4096 /** * \brief The predefined log categories * * By default the application category is enabled at the INFO level, * the assert category is enabled at the WARN level, test is enabled * at the VERBOSE level and all other categories are enabled at the * CRITICAL level. */ enum { SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_CATEGORY_ERROR, SDL_LOG_CATEGORY_ASSERT, SDL_LOG_CATEGORY_SYSTEM, SDL_LOG_CATEGORY_AUDIO, SDL_LOG_CATEGORY_VIDEO, SDL_LOG_CATEGORY_RENDER, SDL_LOG_CATEGORY_INPUT, SDL_LOG_CATEGORY_TEST, /* Reserved for future SDL library use */ SDL_LOG_CATEGORY_RESERVED1, SDL_LOG_CATEGORY_RESERVED2, SDL_LOG_CATEGORY_RESERVED3, SDL_LOG_CATEGORY_RESERVED4, SDL_LOG_CATEGORY_RESERVED5, SDL_LOG_CATEGORY_RESERVED6, SDL_LOG_CATEGORY_RESERVED7, SDL_LOG_CATEGORY_RESERVED8, SDL_LOG_CATEGORY_RESERVED9, SDL_LOG_CATEGORY_RESERVED10, /* Beyond this point is reserved for application use, e.g. enum { MYAPP_CATEGORY_AWESOME1 = SDL_LOG_CATEGORY_CUSTOM, MYAPP_CATEGORY_AWESOME2, MYAPP_CATEGORY_AWESOME3, ... }; */ SDL_LOG_CATEGORY_CUSTOM }; /** * \brief The predefined log priorities */ typedef enum { SDL_LOG_PRIORITY_VERBOSE = 1, SDL_LOG_PRIORITY_DEBUG, SDL_LOG_PRIORITY_INFO, SDL_LOG_PRIORITY_WARN, SDL_LOG_PRIORITY_ERROR, SDL_LOG_PRIORITY_CRITICAL, SDL_NUM_LOG_PRIORITIES } SDL_LogPriority; /** * \brief Set the priority of all log categories */ extern DECLSPEC void SDLCALL SDL_LogSetAllPriority(SDL_LogPriority priority); /** * \brief Set the priority of a particular log category */ extern DECLSPEC void SDLCALL SDL_LogSetPriority(int category, SDL_LogPriority priority); /** * \brief Get the priority of a particular log category */ extern DECLSPEC SDL_LogPriority SDLCALL SDL_LogGetPriority(int category); /** * \brief Reset all priorities to default. * * \note This is called in SDL_Quit(). */ extern DECLSPEC void SDLCALL SDL_LogResetPriorities(void); /** * \brief Log a message with SDL_LOG_CATEGORY_APPLICATION and SDL_LOG_PRIORITY_INFO */ extern DECLSPEC void SDLCALL SDL_Log(const char *fmt, ...); /** * \brief Log a message with SDL_LOG_PRIORITY_VERBOSE */ extern DECLSPEC void SDLCALL SDL_LogVerbose(int category, const char *fmt, ...); /** * \brief Log a message with SDL_LOG_PRIORITY_DEBUG */ extern DECLSPEC void SDLCALL SDL_LogDebug(int category, const char *fmt, ...); /** * \brief Log a message with SDL_LOG_PRIORITY_INFO */ extern DECLSPEC void SDLCALL SDL_LogInfo(int category, const char *fmt, ...); /** * \brief Log a message with SDL_LOG_PRIORITY_WARN */ extern DECLSPEC void SDLCALL SDL_LogWarn(int category, const char *fmt, ...); /** * \brief Log a message with SDL_LOG_PRIORITY_ERROR */ extern DECLSPEC void SDLCALL SDL_LogError(int category, const char *fmt, ...); /** * \brief Log a message with SDL_LOG_PRIORITY_CRITICAL */ extern DECLSPEC void SDLCALL SDL_LogCritical(int category, const char *fmt, ...); /** * \brief Log a message with the specified category and priority. */ extern DECLSPEC void SDLCALL SDL_LogMessage(int category, SDL_LogPriority priority, const char *fmt, ...); /** * \brief Log a message with the specified category and priority. */ extern DECLSPEC void SDLCALL SDL_LogMessageV(int category, SDL_LogPriority priority, const char *fmt, va_list ap); /** * \brief The prototype for the log output function */ typedef void (*SDL_LogOutputFunction)(void *userdata, int category, SDL_LogPriority priority, const char *message); /** * \brief Get the current log output function. */ extern DECLSPEC void SDLCALL SDL_LogGetOutputFunction(SDL_LogOutputFunction *callback, void **userdata); /** * \brief This function allows you to replace the default log output * function with one of your own. */ extern DECLSPEC void SDLCALL SDL_LogSetOutputFunction(SDL_LogOutputFunction callback, void *userdata); /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif # 207 "/usr/local/include/SDL2/SDL_log.h" #if 0 /* expanded by -frewrite-includes */ #include "close_code.h" #endif /* expanded by -frewrite-includes */ # 207 "/usr/local/include/SDL2/SDL_log.h" # 1 "/usr/local/include/SDL2/close_code.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file close_code.h * * This file reverses the effects of begin_code.h and should be included * after you finish any function and structure declarations in your headers */ #undef _begin_code_h /* Reset structure packing at previous byte alignment */ #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__WATCOMC__) || defined(__BORLANDC__) #ifdef __BORLANDC__ #pragma nopackwarning #endif # 36 "/usr/local/include/SDL2/close_code.h" #pragma pack(pop) #endif /* Compiler needs structure packing set */ # 38 "/usr/local/include/SDL2/close_code.h" # 208 "/usr/local/include/SDL2/SDL_log.h" 2 #endif /* _SDL_log_h */ # 210 "/usr/local/include/SDL2/SDL_log.h" /* vi: set ts=4 sw=4 expandtab: */ # 84 "/usr/local/include/SDL2/SDL.h" 2 #if 0 /* expanded by -frewrite-includes */ #include "SDL_messagebox.h" #endif /* expanded by -frewrite-includes */ # 84 "/usr/local/include/SDL2/SDL.h" # 1 "/usr/local/include/SDL2/SDL_messagebox.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #ifndef _SDL_messagebox_h #define _SDL_messagebox_h #if 0 /* expanded by -frewrite-includes */ #include "SDL_stdinc.h" #endif /* expanded by -frewrite-includes */ # 25 "/usr/local/include/SDL2/SDL_messagebox.h" # 26 "/usr/local/include/SDL2/SDL_messagebox.h" #if 0 /* expanded by -frewrite-includes */ #include "SDL_video.h" /* For SDL_Window */ #endif /* expanded by -frewrite-includes */ # 26 "/usr/local/include/SDL2/SDL_messagebox.h" # 27 "/usr/local/include/SDL2/SDL_messagebox.h" #if 0 /* expanded by -frewrite-includes */ #include "begin_code.h" #endif /* expanded by -frewrite-includes */ # 28 "/usr/local/include/SDL2/SDL_messagebox.h" # 1 "/usr/local/include/SDL2/begin_code.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file begin_code.h * * This file sets things up for C dynamic library function definitions, * static inlined functions, and structures aligned at 4-byte alignment. * If you don't like ugly C preprocessor code, don't look at this file. :) */ /* This shouldn't be nested -- included it around code only. */ #ifdef _begin_code_h #error Nested inclusion of begin_code.h #endif # 34 "/usr/local/include/SDL2/begin_code.h" #define _begin_code_h #ifndef SDL_DEPRECATED # if (__GNUC__ >= 4) /* technically, this arrived in gcc 3.1, but oh well. */ # define SDL_DEPRECATED __attribute__((deprecated)) # else # 40 "/usr/local/include/SDL2/begin_code.h" # define SDL_DEPRECATED # endif # 42 "/usr/local/include/SDL2/begin_code.h" #endif # 43 "/usr/local/include/SDL2/begin_code.h" /* Some compilers use a special export keyword */ #ifndef DECLSPEC # if defined(__WIN32__) || defined(__WINRT__) # ifdef __BORLANDC__ # ifdef BUILD_SDL # define DECLSPEC # else # 51 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllimport) # endif # 53 "/usr/local/include/SDL2/begin_code.h" # else # 54 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllexport) # endif # 56 "/usr/local/include/SDL2/begin_code.h" # else # 57 "/usr/local/include/SDL2/begin_code.h" # if defined(__GNUC__) && __GNUC__ >= 4 # define DECLSPEC __attribute__ ((visibility("default"))) # elif defined(__GNUC__) && __GNUC__ >= 2 # 60 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllexport) # else # 62 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC # endif # 64 "/usr/local/include/SDL2/begin_code.h" # endif # 65 "/usr/local/include/SDL2/begin_code.h" #endif # 66 "/usr/local/include/SDL2/begin_code.h" /* By default SDL uses the C calling convention */ #ifndef SDLCALL #if (defined(__WIN32__) || defined(__WINRT__)) && !defined(__GNUC__) #define SDLCALL __cdecl #else # 72 "/usr/local/include/SDL2/begin_code.h" #define SDLCALL #endif # 74 "/usr/local/include/SDL2/begin_code.h" #endif /* SDLCALL */ # 75 "/usr/local/include/SDL2/begin_code.h" /* Removed DECLSPEC on Symbian OS because SDL cannot be a DLL in EPOC */ #ifdef __SYMBIAN32__ #undef DECLSPEC #define DECLSPEC #endif /* __SYMBIAN32__ */ # 81 "/usr/local/include/SDL2/begin_code.h" /* Force structure packing at 4 byte alignment. This is necessary if the header is included in code which has structure packing set to an alternate value, say for loading structures from disk. The packing is reset to the previous value in close_code.h */ #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__) #ifdef _MSC_VER #pragma warning(disable: 4103) #endif # 91 "/usr/local/include/SDL2/begin_code.h" #ifdef __BORLANDC__ #pragma nopackwarning #endif # 94 "/usr/local/include/SDL2/begin_code.h" #ifdef _M_X64 /* Use 8-byte alignment on 64-bit architectures, so pointers are aligned */ #pragma pack(push,8) #else # 98 "/usr/local/include/SDL2/begin_code.h" #pragma pack(push,4) #endif # 100 "/usr/local/include/SDL2/begin_code.h" #endif /* Compiler needs structure packing set */ # 101 "/usr/local/include/SDL2/begin_code.h" #ifndef SDL_INLINE #if defined(__GNUC__) #define SDL_INLINE __inline__ #elif defined(_MSC_VER) || defined(__BORLANDC__) || \ defined(__DMC__) || defined(__SC__) || \ defined(__WATCOMC__) || defined(__LCC__) || \ defined(__DECC) # 109 "/usr/local/include/SDL2/begin_code.h" #define SDL_INLINE __inline #ifndef __inline__ #define __inline__ __inline #endif # 113 "/usr/local/include/SDL2/begin_code.h" #else # 114 "/usr/local/include/SDL2/begin_code.h" #define SDL_INLINE inline #ifndef __inline__ #define __inline__ inline #endif # 118 "/usr/local/include/SDL2/begin_code.h" #endif # 119 "/usr/local/include/SDL2/begin_code.h" #endif /* SDL_INLINE not defined */ # 120 "/usr/local/include/SDL2/begin_code.h" #ifndef SDL_FORCE_INLINE #if defined(_MSC_VER) #define SDL_FORCE_INLINE __forceinline #elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) ) # 125 "/usr/local/include/SDL2/begin_code.h" #define SDL_FORCE_INLINE __attribute__((always_inline)) static __inline__ #else # 127 "/usr/local/include/SDL2/begin_code.h" #define SDL_FORCE_INLINE static SDL_INLINE #endif # 129 "/usr/local/include/SDL2/begin_code.h" #endif /* SDL_FORCE_INLINE not defined */ # 130 "/usr/local/include/SDL2/begin_code.h" /* Apparently this is needed by several Windows compilers */ #if !defined(__MACH__) #ifndef NULL #ifdef __cplusplus #define NULL 0 #else # 137 "/usr/local/include/SDL2/begin_code.h" #define NULL ((void *)0) #endif # 139 "/usr/local/include/SDL2/begin_code.h" #endif /* NULL */ # 140 "/usr/local/include/SDL2/begin_code.h" #endif /* ! Mac OS X - breaks precompiled headers */ # 141 "/usr/local/include/SDL2/begin_code.h" # 29 "/usr/local/include/SDL2/SDL_messagebox.h" 2 /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif # 33 "/usr/local/include/SDL2/SDL_messagebox.h" /** * \brief SDL_MessageBox flags. If supported will display warning icon, etc. */ typedef enum { SDL_MESSAGEBOX_ERROR = 0x00000010, /**< error dialog */ SDL_MESSAGEBOX_WARNING = 0x00000020, /**< warning dialog */ SDL_MESSAGEBOX_INFORMATION = 0x00000040 /**< informational dialog */ } SDL_MessageBoxFlags; /** * \brief Flags for SDL_MessageBoxButtonData. */ typedef enum { SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT = 0x00000001, /**< Marks the default button when return is hit */ SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT = 0x00000002 /**< Marks the default button when escape is hit */ } SDL_MessageBoxButtonFlags; /** * \brief Individual button data. */ typedef struct { Uint32 flags; /**< ::SDL_MessageBoxButtonFlags */ int buttonid; /**< User defined button id (value returned via SDL_ShowMessageBox) */ const char * text; /**< The UTF-8 button text */ } SDL_MessageBoxButtonData; /** * \brief RGB value used in a message box color scheme */ typedef struct { Uint8 r, g, b; } SDL_MessageBoxColor; typedef enum { SDL_MESSAGEBOX_COLOR_BACKGROUND, SDL_MESSAGEBOX_COLOR_TEXT, SDL_MESSAGEBOX_COLOR_BUTTON_BORDER, SDL_MESSAGEBOX_COLOR_BUTTON_BACKGROUND, SDL_MESSAGEBOX_COLOR_BUTTON_SELECTED, SDL_MESSAGEBOX_COLOR_MAX } SDL_MessageBoxColorType; /** * \brief A set of colors to use for message box dialogs */ typedef struct { SDL_MessageBoxColor colors[SDL_MESSAGEBOX_COLOR_MAX]; } SDL_MessageBoxColorScheme; /** * \brief MessageBox structure containing title, text, window, etc. */ typedef struct { Uint32 flags; /**< ::SDL_MessageBoxFlags */ SDL_Window *window; /**< Parent window, can be NULL */ const char *title; /**< UTF-8 title */ const char *message; /**< UTF-8 message text */ int numbuttons; const SDL_MessageBoxButtonData *buttons; const SDL_MessageBoxColorScheme *colorScheme; /**< ::SDL_MessageBoxColorScheme, can be NULL to use system settings */ } SDL_MessageBoxData; /** * \brief Create a modal message box. * * \param messageboxdata The SDL_MessageBoxData structure with title, text, etc. * \param buttonid The pointer to which user id of hit button should be copied. * * \return -1 on error, otherwise 0 and buttonid contains user id of button * hit or -1 if dialog was closed. * * \note This function should be called on the thread that created the parent * window, or on the main thread if the messagebox has no parent. It will * block execution of that thread until the user clicks a button or * closes the messagebox. */ extern DECLSPEC int SDLCALL SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid); /** * \brief Create a simple modal message box * * \param flags ::SDL_MessageBoxFlags * \param title UTF-8 title text * \param message UTF-8 message text * \param window The parent window, or NULL for no parent * * \return 0 on success, -1 on error * * \sa SDL_ShowMessageBox */ extern DECLSPEC int SDLCALL SDL_ShowSimpleMessageBox(Uint32 flags, const char *title, const char *message, SDL_Window *window); /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif # 140 "/usr/local/include/SDL2/SDL_messagebox.h" #if 0 /* expanded by -frewrite-includes */ #include "close_code.h" #endif /* expanded by -frewrite-includes */ # 140 "/usr/local/include/SDL2/SDL_messagebox.h" # 1 "/usr/local/include/SDL2/close_code.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file close_code.h * * This file reverses the effects of begin_code.h and should be included * after you finish any function and structure declarations in your headers */ #undef _begin_code_h /* Reset structure packing at previous byte alignment */ #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__WATCOMC__) || defined(__BORLANDC__) #ifdef __BORLANDC__ #pragma nopackwarning #endif # 36 "/usr/local/include/SDL2/close_code.h" #pragma pack(pop) #endif /* Compiler needs structure packing set */ # 38 "/usr/local/include/SDL2/close_code.h" # 141 "/usr/local/include/SDL2/SDL_messagebox.h" 2 #endif /* _SDL_messagebox_h */ # 143 "/usr/local/include/SDL2/SDL_messagebox.h" /* vi: set ts=4 sw=4 expandtab: */ # 85 "/usr/local/include/SDL2/SDL.h" 2 #if 0 /* expanded by -frewrite-includes */ #include "SDL_mutex.h" #endif /* expanded by -frewrite-includes */ # 85 "/usr/local/include/SDL2/SDL.h" # 86 "/usr/local/include/SDL2/SDL.h" #if 0 /* expanded by -frewrite-includes */ #include "SDL_power.h" #endif /* expanded by -frewrite-includes */ # 86 "/usr/local/include/SDL2/SDL.h" # 1 "/usr/local/include/SDL2/SDL_power.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #ifndef _SDL_power_h #define _SDL_power_h /** * \file SDL_power.h * * Header for the SDL power management routines. */ #if 0 /* expanded by -frewrite-includes */ #include "SDL_stdinc.h" #endif /* expanded by -frewrite-includes */ # 31 "/usr/local/include/SDL2/SDL_power.h" # 32 "/usr/local/include/SDL2/SDL_power.h" #if 0 /* expanded by -frewrite-includes */ #include "begin_code.h" #endif /* expanded by -frewrite-includes */ # 33 "/usr/local/include/SDL2/SDL_power.h" # 1 "/usr/local/include/SDL2/begin_code.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file begin_code.h * * This file sets things up for C dynamic library function definitions, * static inlined functions, and structures aligned at 4-byte alignment. * If you don't like ugly C preprocessor code, don't look at this file. :) */ /* This shouldn't be nested -- included it around code only. */ #ifdef _begin_code_h #error Nested inclusion of begin_code.h #endif # 34 "/usr/local/include/SDL2/begin_code.h" #define _begin_code_h #ifndef SDL_DEPRECATED # if (__GNUC__ >= 4) /* technically, this arrived in gcc 3.1, but oh well. */ # define SDL_DEPRECATED __attribute__((deprecated)) # else # 40 "/usr/local/include/SDL2/begin_code.h" # define SDL_DEPRECATED # endif # 42 "/usr/local/include/SDL2/begin_code.h" #endif # 43 "/usr/local/include/SDL2/begin_code.h" /* Some compilers use a special export keyword */ #ifndef DECLSPEC # if defined(__WIN32__) || defined(__WINRT__) # ifdef __BORLANDC__ # ifdef BUILD_SDL # define DECLSPEC # else # 51 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllimport) # endif # 53 "/usr/local/include/SDL2/begin_code.h" # else # 54 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllexport) # endif # 56 "/usr/local/include/SDL2/begin_code.h" # else # 57 "/usr/local/include/SDL2/begin_code.h" # if defined(__GNUC__) && __GNUC__ >= 4 # define DECLSPEC __attribute__ ((visibility("default"))) # elif defined(__GNUC__) && __GNUC__ >= 2 # 60 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllexport) # else # 62 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC # endif # 64 "/usr/local/include/SDL2/begin_code.h" # endif # 65 "/usr/local/include/SDL2/begin_code.h" #endif # 66 "/usr/local/include/SDL2/begin_code.h" /* By default SDL uses the C calling convention */ #ifndef SDLCALL #if (defined(__WIN32__) || defined(__WINRT__)) && !defined(__GNUC__) #define SDLCALL __cdecl #else # 72 "/usr/local/include/SDL2/begin_code.h" #define SDLCALL #endif # 74 "/usr/local/include/SDL2/begin_code.h" #endif /* SDLCALL */ # 75 "/usr/local/include/SDL2/begin_code.h" /* Removed DECLSPEC on Symbian OS because SDL cannot be a DLL in EPOC */ #ifdef __SYMBIAN32__ #undef DECLSPEC #define DECLSPEC #endif /* __SYMBIAN32__ */ # 81 "/usr/local/include/SDL2/begin_code.h" /* Force structure packing at 4 byte alignment. This is necessary if the header is included in code which has structure packing set to an alternate value, say for loading structures from disk. The packing is reset to the previous value in close_code.h */ #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__) #ifdef _MSC_VER #pragma warning(disable: 4103) #endif # 91 "/usr/local/include/SDL2/begin_code.h" #ifdef __BORLANDC__ #pragma nopackwarning #endif # 94 "/usr/local/include/SDL2/begin_code.h" #ifdef _M_X64 /* Use 8-byte alignment on 64-bit architectures, so pointers are aligned */ #pragma pack(push,8) #else # 98 "/usr/local/include/SDL2/begin_code.h" #pragma pack(push,4) #endif # 100 "/usr/local/include/SDL2/begin_code.h" #endif /* Compiler needs structure packing set */ # 101 "/usr/local/include/SDL2/begin_code.h" #ifndef SDL_INLINE #if defined(__GNUC__) #define SDL_INLINE __inline__ #elif defined(_MSC_VER) || defined(__BORLANDC__) || \ defined(__DMC__) || defined(__SC__) || \ defined(__WATCOMC__) || defined(__LCC__) || \ defined(__DECC) # 109 "/usr/local/include/SDL2/begin_code.h" #define SDL_INLINE __inline #ifndef __inline__ #define __inline__ __inline #endif # 113 "/usr/local/include/SDL2/begin_code.h" #else # 114 "/usr/local/include/SDL2/begin_code.h" #define SDL_INLINE inline #ifndef __inline__ #define __inline__ inline #endif # 118 "/usr/local/include/SDL2/begin_code.h" #endif # 119 "/usr/local/include/SDL2/begin_code.h" #endif /* SDL_INLINE not defined */ # 120 "/usr/local/include/SDL2/begin_code.h" #ifndef SDL_FORCE_INLINE #if defined(_MSC_VER) #define SDL_FORCE_INLINE __forceinline #elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) ) # 125 "/usr/local/include/SDL2/begin_code.h" #define SDL_FORCE_INLINE __attribute__((always_inline)) static __inline__ #else # 127 "/usr/local/include/SDL2/begin_code.h" #define SDL_FORCE_INLINE static SDL_INLINE #endif # 129 "/usr/local/include/SDL2/begin_code.h" #endif /* SDL_FORCE_INLINE not defined */ # 130 "/usr/local/include/SDL2/begin_code.h" /* Apparently this is needed by several Windows compilers */ #if !defined(__MACH__) #ifndef NULL #ifdef __cplusplus #define NULL 0 #else # 137 "/usr/local/include/SDL2/begin_code.h" #define NULL ((void *)0) #endif # 139 "/usr/local/include/SDL2/begin_code.h" #endif /* NULL */ # 140 "/usr/local/include/SDL2/begin_code.h" #endif /* ! Mac OS X - breaks precompiled headers */ # 141 "/usr/local/include/SDL2/begin_code.h" # 34 "/usr/local/include/SDL2/SDL_power.h" 2 /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif # 38 "/usr/local/include/SDL2/SDL_power.h" /** * \brief The basic state for the system's power supply. */ typedef enum { SDL_POWERSTATE_UNKNOWN, /**< cannot determine power status */ SDL_POWERSTATE_ON_BATTERY, /**< Not plugged in, running on the battery */ SDL_POWERSTATE_NO_BATTERY, /**< Plugged in, no battery available */ SDL_POWERSTATE_CHARGING, /**< Plugged in, charging battery */ SDL_POWERSTATE_CHARGED /**< Plugged in, battery charged */ } SDL_PowerState; /** * \brief Get the current power supply details. * * \param secs Seconds of battery life left. You can pass a NULL here if * you don't care. Will return -1 if we can't determine a * value, or we're not running on a battery. * * \param pct Percentage of battery life left, between 0 and 100. You can * pass a NULL here if you don't care. Will return -1 if we * can't determine a value, or we're not running on a battery. * * \return The state of the battery (if any). */ extern DECLSPEC SDL_PowerState SDLCALL SDL_GetPowerInfo(int *secs, int *pct); /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif # 71 "/usr/local/include/SDL2/SDL_power.h" #if 0 /* expanded by -frewrite-includes */ #include "close_code.h" #endif /* expanded by -frewrite-includes */ # 71 "/usr/local/include/SDL2/SDL_power.h" # 1 "/usr/local/include/SDL2/close_code.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file close_code.h * * This file reverses the effects of begin_code.h and should be included * after you finish any function and structure declarations in your headers */ #undef _begin_code_h /* Reset structure packing at previous byte alignment */ #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__WATCOMC__) || defined(__BORLANDC__) #ifdef __BORLANDC__ #pragma nopackwarning #endif # 36 "/usr/local/include/SDL2/close_code.h" #pragma pack(pop) #endif /* Compiler needs structure packing set */ # 38 "/usr/local/include/SDL2/close_code.h" # 72 "/usr/local/include/SDL2/SDL_power.h" 2 #endif /* _SDL_power_h */ # 74 "/usr/local/include/SDL2/SDL_power.h" /* vi: set ts=4 sw=4 expandtab: */ # 87 "/usr/local/include/SDL2/SDL.h" 2 #if 0 /* expanded by -frewrite-includes */ #include "SDL_render.h" #endif /* expanded by -frewrite-includes */ # 87 "/usr/local/include/SDL2/SDL.h" # 1 "/usr/local/include/SDL2/SDL_render.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file SDL_render.h * * Header file for SDL 2D rendering functions. * * This API supports the following features: * * single pixel points * * single pixel lines * * filled rectangles * * texture images * * The primitives may be drawn in opaque, blended, or additive modes. * * The texture images may be drawn in opaque, blended, or additive modes. * They can have an additional color tint or alpha modulation applied to * them, and may also be stretched with linear interpolation. * * This API is designed to accelerate simple 2D operations. You may * want more functionality such as polygons and particle effects and * in that case you should use SDL's OpenGL/Direct3D support or one * of the many good 3D engines. * * These functions must be called from the main thread. * See this bug for details: http://bugzilla.libsdl.org/show_bug.cgi?id=1995 */ #ifndef _SDL_render_h #define _SDL_render_h #if 0 /* expanded by -frewrite-includes */ #include "SDL_stdinc.h" #endif /* expanded by -frewrite-includes */ # 51 "/usr/local/include/SDL2/SDL_render.h" # 52 "/usr/local/include/SDL2/SDL_render.h" #if 0 /* expanded by -frewrite-includes */ #include "SDL_rect.h" #endif /* expanded by -frewrite-includes */ # 52 "/usr/local/include/SDL2/SDL_render.h" # 53 "/usr/local/include/SDL2/SDL_render.h" #if 0 /* expanded by -frewrite-includes */ #include "SDL_video.h" #endif /* expanded by -frewrite-includes */ # 53 "/usr/local/include/SDL2/SDL_render.h" # 54 "/usr/local/include/SDL2/SDL_render.h" #if 0 /* expanded by -frewrite-includes */ #include "begin_code.h" #endif /* expanded by -frewrite-includes */ # 55 "/usr/local/include/SDL2/SDL_render.h" # 1 "/usr/local/include/SDL2/begin_code.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file begin_code.h * * This file sets things up for C dynamic library function definitions, * static inlined functions, and structures aligned at 4-byte alignment. * If you don't like ugly C preprocessor code, don't look at this file. :) */ /* This shouldn't be nested -- included it around code only. */ #ifdef _begin_code_h #error Nested inclusion of begin_code.h #endif # 34 "/usr/local/include/SDL2/begin_code.h" #define _begin_code_h #ifndef SDL_DEPRECATED # if (__GNUC__ >= 4) /* technically, this arrived in gcc 3.1, but oh well. */ # define SDL_DEPRECATED __attribute__((deprecated)) # else # 40 "/usr/local/include/SDL2/begin_code.h" # define SDL_DEPRECATED # endif # 42 "/usr/local/include/SDL2/begin_code.h" #endif # 43 "/usr/local/include/SDL2/begin_code.h" /* Some compilers use a special export keyword */ #ifndef DECLSPEC # if defined(__WIN32__) || defined(__WINRT__) # ifdef __BORLANDC__ # ifdef BUILD_SDL # define DECLSPEC # else # 51 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllimport) # endif # 53 "/usr/local/include/SDL2/begin_code.h" # else # 54 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllexport) # endif # 56 "/usr/local/include/SDL2/begin_code.h" # else # 57 "/usr/local/include/SDL2/begin_code.h" # if defined(__GNUC__) && __GNUC__ >= 4 # define DECLSPEC __attribute__ ((visibility("default"))) # elif defined(__GNUC__) && __GNUC__ >= 2 # 60 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllexport) # else # 62 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC # endif # 64 "/usr/local/include/SDL2/begin_code.h" # endif # 65 "/usr/local/include/SDL2/begin_code.h" #endif # 66 "/usr/local/include/SDL2/begin_code.h" /* By default SDL uses the C calling convention */ #ifndef SDLCALL #if (defined(__WIN32__) || defined(__WINRT__)) && !defined(__GNUC__) #define SDLCALL __cdecl #else # 72 "/usr/local/include/SDL2/begin_code.h" #define SDLCALL #endif # 74 "/usr/local/include/SDL2/begin_code.h" #endif /* SDLCALL */ # 75 "/usr/local/include/SDL2/begin_code.h" /* Removed DECLSPEC on Symbian OS because SDL cannot be a DLL in EPOC */ #ifdef __SYMBIAN32__ #undef DECLSPEC #define DECLSPEC #endif /* __SYMBIAN32__ */ # 81 "/usr/local/include/SDL2/begin_code.h" /* Force structure packing at 4 byte alignment. This is necessary if the header is included in code which has structure packing set to an alternate value, say for loading structures from disk. The packing is reset to the previous value in close_code.h */ #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__) #ifdef _MSC_VER #pragma warning(disable: 4103) #endif # 91 "/usr/local/include/SDL2/begin_code.h" #ifdef __BORLANDC__ #pragma nopackwarning #endif # 94 "/usr/local/include/SDL2/begin_code.h" #ifdef _M_X64 /* Use 8-byte alignment on 64-bit architectures, so pointers are aligned */ #pragma pack(push,8) #else # 98 "/usr/local/include/SDL2/begin_code.h" #pragma pack(push,4) #endif # 100 "/usr/local/include/SDL2/begin_code.h" #endif /* Compiler needs structure packing set */ # 101 "/usr/local/include/SDL2/begin_code.h" #ifndef SDL_INLINE #if defined(__GNUC__) #define SDL_INLINE __inline__ #elif defined(_MSC_VER) || defined(__BORLANDC__) || \ defined(__DMC__) || defined(__SC__) || \ defined(__WATCOMC__) || defined(__LCC__) || \ defined(__DECC) # 109 "/usr/local/include/SDL2/begin_code.h" #define SDL_INLINE __inline #ifndef __inline__ #define __inline__ __inline #endif # 113 "/usr/local/include/SDL2/begin_code.h" #else # 114 "/usr/local/include/SDL2/begin_code.h" #define SDL_INLINE inline #ifndef __inline__ #define __inline__ inline #endif # 118 "/usr/local/include/SDL2/begin_code.h" #endif # 119 "/usr/local/include/SDL2/begin_code.h" #endif /* SDL_INLINE not defined */ # 120 "/usr/local/include/SDL2/begin_code.h" #ifndef SDL_FORCE_INLINE #if defined(_MSC_VER) #define SDL_FORCE_INLINE __forceinline #elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) ) # 125 "/usr/local/include/SDL2/begin_code.h" #define SDL_FORCE_INLINE __attribute__((always_inline)) static __inline__ #else # 127 "/usr/local/include/SDL2/begin_code.h" #define SDL_FORCE_INLINE static SDL_INLINE #endif # 129 "/usr/local/include/SDL2/begin_code.h" #endif /* SDL_FORCE_INLINE not defined */ # 130 "/usr/local/include/SDL2/begin_code.h" /* Apparently this is needed by several Windows compilers */ #if !defined(__MACH__) #ifndef NULL #ifdef __cplusplus #define NULL 0 #else # 137 "/usr/local/include/SDL2/begin_code.h" #define NULL ((void *)0) #endif # 139 "/usr/local/include/SDL2/begin_code.h" #endif /* NULL */ # 140 "/usr/local/include/SDL2/begin_code.h" #endif /* ! Mac OS X - breaks precompiled headers */ # 141 "/usr/local/include/SDL2/begin_code.h" # 56 "/usr/local/include/SDL2/SDL_render.h" 2 /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif # 60 "/usr/local/include/SDL2/SDL_render.h" /** * \brief Flags used when creating a rendering context */ typedef enum { SDL_RENDERER_SOFTWARE = 0x00000001, /**< The renderer is a software fallback */ SDL_RENDERER_ACCELERATED = 0x00000002, /**< The renderer uses hardware acceleration */ SDL_RENDERER_PRESENTVSYNC = 0x00000004, /**< Present is synchronized with the refresh rate */ SDL_RENDERER_TARGETTEXTURE = 0x00000008 /**< The renderer supports rendering to texture */ } SDL_RendererFlags; /** * \brief Information on the capabilities of a render driver or context. */ typedef struct SDL_RendererInfo { const char *name; /**< The name of the renderer */ Uint32 flags; /**< Supported ::SDL_RendererFlags */ Uint32 num_texture_formats; /**< The number of available texture formats */ Uint32 texture_formats[16]; /**< The available texture formats */ int max_texture_width; /**< The maximimum texture width */ int max_texture_height; /**< The maximimum texture height */ } SDL_RendererInfo; /** * \brief The access pattern allowed for a texture. */ typedef enum { SDL_TEXTUREACCESS_STATIC, /**< Changes rarely, not lockable */ SDL_TEXTUREACCESS_STREAMING, /**< Changes frequently, lockable */ SDL_TEXTUREACCESS_TARGET /**< Texture can be used as a render target */ } SDL_TextureAccess; /** * \brief The texture channel modulation used in SDL_RenderCopy(). */ typedef enum { SDL_TEXTUREMODULATE_NONE = 0x00000000, /**< No modulation */ SDL_TEXTUREMODULATE_COLOR = 0x00000001, /**< srcC = srcC * color */ SDL_TEXTUREMODULATE_ALPHA = 0x00000002 /**< srcA = srcA * alpha */ } SDL_TextureModulate; /** * \brief Flip constants for SDL_RenderCopyEx */ typedef enum { SDL_FLIP_NONE = 0x00000000, /**< Do not flip */ SDL_FLIP_HORIZONTAL = 0x00000001, /**< flip horizontally */ SDL_FLIP_VERTICAL = 0x00000002 /**< flip vertically */ } SDL_RendererFlip; /** * \brief A structure representing rendering state */ struct SDL_Renderer; typedef struct SDL_Renderer SDL_Renderer; /** * \brief An efficient driver-specific representation of pixel data */ struct SDL_Texture; typedef struct SDL_Texture SDL_Texture; /* Function prototypes */ /** * \brief Get the number of 2D rendering drivers available for the current * display. * * A render driver is a set of code that handles rendering and texture * management on a particular display. Normally there is only one, but * some drivers may have several available with different capabilities. * * \sa SDL_GetRenderDriverInfo() * \sa SDL_CreateRenderer() */ extern DECLSPEC int SDLCALL SDL_GetNumRenderDrivers(void); /** * \brief Get information about a specific 2D rendering driver for the current * display. * * \param index The index of the driver to query information about. * \param info A pointer to an SDL_RendererInfo struct to be filled with * information on the rendering driver. * * \return 0 on success, -1 if the index was out of range. * * \sa SDL_CreateRenderer() */ extern DECLSPEC int SDLCALL SDL_GetRenderDriverInfo(int index, SDL_RendererInfo * info); /** * \brief Create a window and default renderer * * \param width The width of the window * \param height The height of the window * \param window_flags The flags used to create the window * \param window A pointer filled with the window, or NULL on error * \param renderer A pointer filled with the renderer, or NULL on error * * \return 0 on success, or -1 on error */ extern DECLSPEC int SDLCALL SDL_CreateWindowAndRenderer( int width, int height, Uint32 window_flags, SDL_Window **window, SDL_Renderer **renderer); /** * \brief Create a 2D rendering context for a window. * * \param window The window where rendering is displayed. * \param index The index of the rendering driver to initialize, or -1 to * initialize the first one supporting the requested flags. * \param flags ::SDL_RendererFlags. * * \return A valid rendering context or NULL if there was an error. * * \sa SDL_CreateSoftwareRenderer() * \sa SDL_GetRendererInfo() * \sa SDL_DestroyRenderer() */ extern DECLSPEC SDL_Renderer * SDLCALL SDL_CreateRenderer(SDL_Window * window, int index, Uint32 flags); /** * \brief Create a 2D software rendering context for a surface. * * \param surface The surface where rendering is done. * * \return A valid rendering context or NULL if there was an error. * * \sa SDL_CreateRenderer() * \sa SDL_DestroyRenderer() */ extern DECLSPEC SDL_Renderer * SDLCALL SDL_CreateSoftwareRenderer(SDL_Surface * surface); /** * \brief Get the renderer associated with a window. */ extern DECLSPEC SDL_Renderer * SDLCALL SDL_GetRenderer(SDL_Window * window); /** * \brief Get information about a rendering context. */ extern DECLSPEC int SDLCALL SDL_GetRendererInfo(SDL_Renderer * renderer, SDL_RendererInfo * info); /** * \brief Get the output size of a rendering context. */ extern DECLSPEC int SDLCALL SDL_GetRendererOutputSize(SDL_Renderer * renderer, int *w, int *h); /** * \brief Create a texture for a rendering context. * * \param renderer The renderer. * \param format The format of the texture. * \param access One of the enumerated values in ::SDL_TextureAccess. * \param w The width of the texture in pixels. * \param h The height of the texture in pixels. * * \return The created texture is returned, or 0 if no rendering context was * active, the format was unsupported, or the width or height were out * of range. * * \sa SDL_QueryTexture() * \sa SDL_UpdateTexture() * \sa SDL_DestroyTexture() */ extern DECLSPEC SDL_Texture * SDLCALL SDL_CreateTexture(SDL_Renderer * renderer, Uint32 format, int access, int w, int h); /** * \brief Create a texture from an existing surface. * * \param renderer The renderer. * \param surface The surface containing pixel data used to fill the texture. * * \return The created texture is returned, or 0 on error. * * \note The surface is not modified or freed by this function. * * \sa SDL_QueryTexture() * \sa SDL_DestroyTexture() */ extern DECLSPEC SDL_Texture * SDLCALL SDL_CreateTextureFromSurface(SDL_Renderer * renderer, SDL_Surface * surface); /** * \brief Query the attributes of a texture * * \param texture A texture to be queried. * \param format A pointer filled in with the raw format of the texture. The * actual format may differ, but pixel transfers will use this * format. * \param access A pointer filled in with the actual access to the texture. * \param w A pointer filled in with the width of the texture in pixels. * \param h A pointer filled in with the height of the texture in pixels. * * \return 0 on success, or -1 if the texture is not valid. */ extern DECLSPEC int SDLCALL SDL_QueryTexture(SDL_Texture * texture, Uint32 * format, int *access, int *w, int *h); /** * \brief Set an additional color value used in render copy operations. * * \param texture The texture to update. * \param r The red color value multiplied into copy operations. * \param g The green color value multiplied into copy operations. * \param b The blue color value multiplied into copy operations. * * \return 0 on success, or -1 if the texture is not valid or color modulation * is not supported. * * \sa SDL_GetTextureColorMod() */ extern DECLSPEC int SDLCALL SDL_SetTextureColorMod(SDL_Texture * texture, Uint8 r, Uint8 g, Uint8 b); /** * \brief Get the additional color value used in render copy operations. * * \param texture The texture to query. * \param r A pointer filled in with the current red color value. * \param g A pointer filled in with the current green color value. * \param b A pointer filled in with the current blue color value. * * \return 0 on success, or -1 if the texture is not valid. * * \sa SDL_SetTextureColorMod() */ extern DECLSPEC int SDLCALL SDL_GetTextureColorMod(SDL_Texture * texture, Uint8 * r, Uint8 * g, Uint8 * b); /** * \brief Set an additional alpha value used in render copy operations. * * \param texture The texture to update. * \param alpha The alpha value multiplied into copy operations. * * \return 0 on success, or -1 if the texture is not valid or alpha modulation * is not supported. * * \sa SDL_GetTextureAlphaMod() */ extern DECLSPEC int SDLCALL SDL_SetTextureAlphaMod(SDL_Texture * texture, Uint8 alpha); /** * \brief Get the additional alpha value used in render copy operations. * * \param texture The texture to query. * \param alpha A pointer filled in with the current alpha value. * * \return 0 on success, or -1 if the texture is not valid. * * \sa SDL_SetTextureAlphaMod() */ extern DECLSPEC int SDLCALL SDL_GetTextureAlphaMod(SDL_Texture * texture, Uint8 * alpha); /** * \brief Set the blend mode used for texture copy operations. * * \param texture The texture to update. * \param blendMode ::SDL_BlendMode to use for texture blending. * * \return 0 on success, or -1 if the texture is not valid or the blend mode is * not supported. * * \note If the blend mode is not supported, the closest supported mode is * chosen. * * \sa SDL_GetTextureBlendMode() */ extern DECLSPEC int SDLCALL SDL_SetTextureBlendMode(SDL_Texture * texture, SDL_BlendMode blendMode); /** * \brief Get the blend mode used for texture copy operations. * * \param texture The texture to query. * \param blendMode A pointer filled in with the current blend mode. * * \return 0 on success, or -1 if the texture is not valid. * * \sa SDL_SetTextureBlendMode() */ extern DECLSPEC int SDLCALL SDL_GetTextureBlendMode(SDL_Texture * texture, SDL_BlendMode *blendMode); /** * \brief Update the given texture rectangle with new pixel data. * * \param texture The texture to update * \param rect A pointer to the rectangle of pixels to update, or NULL to * update the entire texture. * \param pixels The raw pixel data. * \param pitch The number of bytes between rows of pixel data. * * \return 0 on success, or -1 if the texture is not valid. * * \note This is a fairly slow function. */ extern DECLSPEC int SDLCALL SDL_UpdateTexture(SDL_Texture * texture, const SDL_Rect * rect, const void *pixels, int pitch); /** * \brief Update a rectangle within a planar YV12 or IYUV texture with new pixel data. * * \param texture The texture to update * \param rect A pointer to the rectangle of pixels to update, or NULL to * update the entire texture. * \param Yplane The raw pixel data for the Y plane. * \param Ypitch The number of bytes between rows of pixel data for the Y plane. * \param Uplane The raw pixel data for the U plane. * \param Upitch The number of bytes between rows of pixel data for the U plane. * \param Vplane The raw pixel data for the V plane. * \param Vpitch The number of bytes between rows of pixel data for the V plane. * * \return 0 on success, or -1 if the texture is not valid. * * \note You can use SDL_UpdateTexture() as long as your pixel data is * a contiguous block of Y and U/V planes in the proper order, but * this function is available if your pixel data is not contiguous. */ extern DECLSPEC int SDLCALL SDL_UpdateYUVTexture(SDL_Texture * texture, const SDL_Rect * rect, const Uint8 *Yplane, int Ypitch, const Uint8 *Uplane, int Upitch, const Uint8 *Vplane, int Vpitch); /** * \brief Lock a portion of the texture for write-only pixel access. * * \param texture The texture to lock for access, which was created with * ::SDL_TEXTUREACCESS_STREAMING. * \param rect A pointer to the rectangle to lock for access. If the rect * is NULL, the entire texture will be locked. * \param pixels This is filled in with a pointer to the locked pixels, * appropriately offset by the locked area. * \param pitch This is filled in with the pitch of the locked pixels. * * \return 0 on success, or -1 if the texture is not valid or was not created with ::SDL_TEXTUREACCESS_STREAMING. * * \sa SDL_UnlockTexture() */ extern DECLSPEC int SDLCALL SDL_LockTexture(SDL_Texture * texture, const SDL_Rect * rect, void **pixels, int *pitch); /** * \brief Unlock a texture, uploading the changes to video memory, if needed. * * \sa SDL_LockTexture() */ extern DECLSPEC void SDLCALL SDL_UnlockTexture(SDL_Texture * texture); /** * \brief Determines whether a window supports the use of render targets * * \param renderer The renderer that will be checked * * \return SDL_TRUE if supported, SDL_FALSE if not. */ extern DECLSPEC SDL_bool SDLCALL SDL_RenderTargetSupported(SDL_Renderer *renderer); /** * \brief Set a texture as the current rendering target. * * \param renderer The renderer. * \param texture The targeted texture, which must be created with the SDL_TEXTUREACCESS_TARGET flag, or NULL for the default render target * * \return 0 on success, or -1 on error * * \sa SDL_GetRenderTarget() */ extern DECLSPEC int SDLCALL SDL_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture); /** * \brief Get the current render target or NULL for the default render target. * * \return The current render target * * \sa SDL_SetRenderTarget() */ extern DECLSPEC SDL_Texture * SDLCALL SDL_GetRenderTarget(SDL_Renderer *renderer); /** * \brief Set device independent resolution for rendering * * \param renderer The renderer for which resolution should be set. * \param w The width of the logical resolution * \param h The height of the logical resolution * * This function uses the viewport and scaling functionality to allow a fixed logical * resolution for rendering, regardless of the actual output resolution. If the actual * output resolution doesn't have the same aspect ratio the output rendering will be * centered within the output display. * * If the output display is a window, mouse events in the window will be filtered * and scaled so they seem to arrive within the logical resolution. * * \note If this function results in scaling or subpixel drawing by the * rendering backend, it will be handled using the appropriate * quality hints. * * \sa SDL_RenderGetLogicalSize() * \sa SDL_RenderSetScale() * \sa SDL_RenderSetViewport() */ extern DECLSPEC int SDLCALL SDL_RenderSetLogicalSize(SDL_Renderer * renderer, int w, int h); /** * \brief Get device independent resolution for rendering * * \param renderer The renderer from which resolution should be queried. * \param w A pointer filled with the width of the logical resolution * \param h A pointer filled with the height of the logical resolution * * \sa SDL_RenderSetLogicalSize() */ extern DECLSPEC void SDLCALL SDL_RenderGetLogicalSize(SDL_Renderer * renderer, int *w, int *h); /** * \brief Set the drawing area for rendering on the current target. * * \param renderer The renderer for which the drawing area should be set. * \param rect The rectangle representing the drawing area, or NULL to set the viewport to the entire target. * * The x,y of the viewport rect represents the origin for rendering. * * \return 0 on success, or -1 on error * * \note If the window associated with the renderer is resized, the viewport is automatically reset. * * \sa SDL_RenderGetViewport() * \sa SDL_RenderSetLogicalSize() */ extern DECLSPEC int SDLCALL SDL_RenderSetViewport(SDL_Renderer * renderer, const SDL_Rect * rect); /** * \brief Get the drawing area for the current target. * * \sa SDL_RenderSetViewport() */ extern DECLSPEC void SDLCALL SDL_RenderGetViewport(SDL_Renderer * renderer, SDL_Rect * rect); /** * \brief Set the clip rectangle for the current target. * * \param renderer The renderer for which clip rectangle should be set. * \param rect A pointer to the rectangle to set as the clip rectangle, or * NULL to disable clipping. * * \return 0 on success, or -1 on error * * \sa SDL_RenderGetClipRect() */ extern DECLSPEC int SDLCALL SDL_RenderSetClipRect(SDL_Renderer * renderer, const SDL_Rect * rect); /** * \brief Get the clip rectangle for the current target. * * \param renderer The renderer from which clip rectangle should be queried. * \param rect A pointer filled in with the current clip rectangle, or * an empty rectangle if clipping is disabled. * * \sa SDL_RenderSetClipRect() */ extern DECLSPEC void SDLCALL SDL_RenderGetClipRect(SDL_Renderer * renderer, SDL_Rect * rect); /** * \brief Set the drawing scale for rendering on the current target. * * \param renderer The renderer for which the drawing scale should be set. * \param scaleX The horizontal scaling factor * \param scaleY The vertical scaling factor * * The drawing coordinates are scaled by the x/y scaling factors * before they are used by the renderer. This allows resolution * independent drawing with a single coordinate system. * * \note If this results in scaling or subpixel drawing by the * rendering backend, it will be handled using the appropriate * quality hints. For best results use integer scaling factors. * * \sa SDL_RenderGetScale() * \sa SDL_RenderSetLogicalSize() */ extern DECLSPEC int SDLCALL SDL_RenderSetScale(SDL_Renderer * renderer, float scaleX, float scaleY); /** * \brief Get the drawing scale for the current target. * * \param renderer The renderer from which drawing scale should be queried. * \param scaleX A pointer filled in with the horizontal scaling factor * \param scaleY A pointer filled in with the vertical scaling factor * * \sa SDL_RenderSetScale() */ extern DECLSPEC void SDLCALL SDL_RenderGetScale(SDL_Renderer * renderer, float *scaleX, float *scaleY); /** * \brief Set the color used for drawing operations (Rect, Line and Clear). * * \param renderer The renderer for which drawing color should be set. * \param r The red value used to draw on the rendering target. * \param g The green value used to draw on the rendering target. * \param b The blue value used to draw on the rendering target. * \param a The alpha value used to draw on the rendering target, usually * ::SDL_ALPHA_OPAQUE (255). * * \return 0 on success, or -1 on error */ extern DECLSPEC int SDLCALL SDL_SetRenderDrawColor(SDL_Renderer * renderer, Uint8 r, Uint8 g, Uint8 b, Uint8 a); /** * \brief Get the color used for drawing operations (Rect, Line and Clear). * * \param renderer The renderer from which drawing color should be queried. * \param r A pointer to the red value used to draw on the rendering target. * \param g A pointer to the green value used to draw on the rendering target. * \param b A pointer to the blue value used to draw on the rendering target. * \param a A pointer to the alpha value used to draw on the rendering target, * usually ::SDL_ALPHA_OPAQUE (255). * * \return 0 on success, or -1 on error */ extern DECLSPEC int SDLCALL SDL_GetRenderDrawColor(SDL_Renderer * renderer, Uint8 * r, Uint8 * g, Uint8 * b, Uint8 * a); /** * \brief Set the blend mode used for drawing operations (Fill and Line). * * \param renderer The renderer for which blend mode should be set. * \param blendMode ::SDL_BlendMode to use for blending. * * \return 0 on success, or -1 on error * * \note If the blend mode is not supported, the closest supported mode is * chosen. * * \sa SDL_GetRenderDrawBlendMode() */ extern DECLSPEC int SDLCALL SDL_SetRenderDrawBlendMode(SDL_Renderer * renderer, SDL_BlendMode blendMode); /** * \brief Get the blend mode used for drawing operations. * * \param renderer The renderer from which blend mode should be queried. * \param blendMode A pointer filled in with the current blend mode. * * \return 0 on success, or -1 on error * * \sa SDL_SetRenderDrawBlendMode() */ extern DECLSPEC int SDLCALL SDL_GetRenderDrawBlendMode(SDL_Renderer * renderer, SDL_BlendMode *blendMode); /** * \brief Clear the current rendering target with the drawing color * * This function clears the entire rendering target, ignoring the viewport. * * \return 0 on success, or -1 on error */ extern DECLSPEC int SDLCALL SDL_RenderClear(SDL_Renderer * renderer); /** * \brief Draw a point on the current rendering target. * * \param renderer The renderer which should draw a point. * \param x The x coordinate of the point. * \param y The y coordinate of the point. * * \return 0 on success, or -1 on error */ extern DECLSPEC int SDLCALL SDL_RenderDrawPoint(SDL_Renderer * renderer, int x, int y); /** * \brief Draw multiple points on the current rendering target. * * \param renderer The renderer which should draw multiple points. * \param points The points to draw * \param count The number of points to draw * * \return 0 on success, or -1 on error */ extern DECLSPEC int SDLCALL SDL_RenderDrawPoints(SDL_Renderer * renderer, const SDL_Point * points, int count); /** * \brief Draw a line on the current rendering target. * * \param renderer The renderer which should draw a line. * \param x1 The x coordinate of the start point. * \param y1 The y coordinate of the start point. * \param x2 The x coordinate of the end point. * \param y2 The y coordinate of the end point. * * \return 0 on success, or -1 on error */ extern DECLSPEC int SDLCALL SDL_RenderDrawLine(SDL_Renderer * renderer, int x1, int y1, int x2, int y2); /** * \brief Draw a series of connected lines on the current rendering target. * * \param renderer The renderer which should draw multiple lines. * \param points The points along the lines * \param count The number of points, drawing count-1 lines * * \return 0 on success, or -1 on error */ extern DECLSPEC int SDLCALL SDL_RenderDrawLines(SDL_Renderer * renderer, const SDL_Point * points, int count); /** * \brief Draw a rectangle on the current rendering target. * * \param renderer The renderer which should draw a rectangle. * \param rect A pointer to the destination rectangle, or NULL to outline the entire rendering target. * * \return 0 on success, or -1 on error */ extern DECLSPEC int SDLCALL SDL_RenderDrawRect(SDL_Renderer * renderer, const SDL_Rect * rect); /** * \brief Draw some number of rectangles on the current rendering target. * * \param renderer The renderer which should draw multiple rectangles. * \param rects A pointer to an array of destination rectangles. * \param count The number of rectangles. * * \return 0 on success, or -1 on error */ extern DECLSPEC int SDLCALL SDL_RenderDrawRects(SDL_Renderer * renderer, const SDL_Rect * rects, int count); /** * \brief Fill a rectangle on the current rendering target with the drawing color. * * \param renderer The renderer which should fill a rectangle. * \param rect A pointer to the destination rectangle, or NULL for the entire * rendering target. * * \return 0 on success, or -1 on error */ extern DECLSPEC int SDLCALL SDL_RenderFillRect(SDL_Renderer * renderer, const SDL_Rect * rect); /** * \brief Fill some number of rectangles on the current rendering target with the drawing color. * * \param renderer The renderer which should fill multiple rectangles. * \param rects A pointer to an array of destination rectangles. * \param count The number of rectangles. * * \return 0 on success, or -1 on error */ extern DECLSPEC int SDLCALL SDL_RenderFillRects(SDL_Renderer * renderer, const SDL_Rect * rects, int count); /** * \brief Copy a portion of the texture to the current rendering target. * * \param renderer The renderer which should copy parts of a texture. * \param texture The source texture. * \param srcrect A pointer to the source rectangle, or NULL for the entire * texture. * \param dstrect A pointer to the destination rectangle, or NULL for the * entire rendering target. * * \return 0 on success, or -1 on error */ extern DECLSPEC int SDLCALL SDL_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, const SDL_Rect * srcrect, const SDL_Rect * dstrect); /** * \brief Copy a portion of the source texture to the current rendering target, rotating it by angle around the given center * * \param renderer The renderer which should copy parts of a texture. * \param texture The source texture. * \param srcrect A pointer to the source rectangle, or NULL for the entire * texture. * \param dstrect A pointer to the destination rectangle, or NULL for the * entire rendering target. * \param angle An angle in degrees that indicates the rotation that will be applied to dstrect * \param center A pointer to a point indicating the point around which dstrect will be rotated (if NULL, rotation will be done aroud dstrect.w/2, dstrect.h/2) * \param flip An SDL_RendererFlip value stating which flipping actions should be performed on the texture * * \return 0 on success, or -1 on error */ extern DECLSPEC int SDLCALL SDL_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture, const SDL_Rect * srcrect, const SDL_Rect * dstrect, const double angle, const SDL_Point *center, const SDL_RendererFlip flip); /** * \brief Read pixels from the current rendering target. * * \param renderer The renderer from which pixels should be read. * \param rect A pointer to the rectangle to read, or NULL for the entire * render target. * \param format The desired format of the pixel data, or 0 to use the format * of the rendering target * \param pixels A pointer to be filled in with the pixel data * \param pitch The pitch of the pixels parameter. * * \return 0 on success, or -1 if pixel reading is not supported. * * \warning This is a very slow operation, and should not be used frequently. */ extern DECLSPEC int SDLCALL SDL_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect, Uint32 format, void *pixels, int pitch); /** * \brief Update the screen with rendering performed. */ extern DECLSPEC void SDLCALL SDL_RenderPresent(SDL_Renderer * renderer); /** * \brief Destroy the specified texture. * * \sa SDL_CreateTexture() * \sa SDL_CreateTextureFromSurface() */ extern DECLSPEC void SDLCALL SDL_DestroyTexture(SDL_Texture * texture); /** * \brief Destroy the rendering context for a window and free associated * textures. * * \sa SDL_CreateRenderer() */ extern DECLSPEC void SDLCALL SDL_DestroyRenderer(SDL_Renderer * renderer); /** * \brief Bind the texture to the current OpenGL/ES/ES2 context for use with * OpenGL instructions. * * \param texture The SDL texture to bind * \param texw A pointer to a float that will be filled with the texture width * \param texh A pointer to a float that will be filled with the texture height * * \return 0 on success, or -1 if the operation is not supported */ extern DECLSPEC int SDLCALL SDL_GL_BindTexture(SDL_Texture *texture, float *texw, float *texh); /** * \brief Unbind a texture from the current OpenGL/ES/ES2 context. * * \param texture The SDL texture to unbind * * \return 0 on success, or -1 if the operation is not supported */ extern DECLSPEC int SDLCALL SDL_GL_UnbindTexture(SDL_Texture *texture); /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif # 866 "/usr/local/include/SDL2/SDL_render.h" #if 0 /* expanded by -frewrite-includes */ #include "close_code.h" #endif /* expanded by -frewrite-includes */ # 866 "/usr/local/include/SDL2/SDL_render.h" # 1 "/usr/local/include/SDL2/close_code.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file close_code.h * * This file reverses the effects of begin_code.h and should be included * after you finish any function and structure declarations in your headers */ #undef _begin_code_h /* Reset structure packing at previous byte alignment */ #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__WATCOMC__) || defined(__BORLANDC__) #ifdef __BORLANDC__ #pragma nopackwarning #endif # 36 "/usr/local/include/SDL2/close_code.h" #pragma pack(pop) #endif /* Compiler needs structure packing set */ # 38 "/usr/local/include/SDL2/close_code.h" # 867 "/usr/local/include/SDL2/SDL_render.h" 2 #endif /* _SDL_render_h */ # 869 "/usr/local/include/SDL2/SDL_render.h" /* vi: set ts=4 sw=4 expandtab: */ # 88 "/usr/local/include/SDL2/SDL.h" 2 #if 0 /* expanded by -frewrite-includes */ #include "SDL_rwops.h" #endif /* expanded by -frewrite-includes */ # 88 "/usr/local/include/SDL2/SDL.h" # 89 "/usr/local/include/SDL2/SDL.h" #if 0 /* expanded by -frewrite-includes */ #include "SDL_system.h" #endif /* expanded by -frewrite-includes */ # 89 "/usr/local/include/SDL2/SDL.h" # 1 "/usr/local/include/SDL2/SDL_system.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file SDL_system.h * * Include file for platform specific SDL API functions */ #ifndef _SDL_system_h #define _SDL_system_h #if 0 /* expanded by -frewrite-includes */ #include "SDL_stdinc.h" #endif /* expanded by -frewrite-includes */ # 31 "/usr/local/include/SDL2/SDL_system.h" # 32 "/usr/local/include/SDL2/SDL_system.h" #if 0 /* expanded by -frewrite-includes */ #include "SDL_keyboard.h" #endif /* expanded by -frewrite-includes */ # 32 "/usr/local/include/SDL2/SDL_system.h" # 33 "/usr/local/include/SDL2/SDL_system.h" #if 0 /* expanded by -frewrite-includes */ #include "SDL_render.h" #endif /* expanded by -frewrite-includes */ # 33 "/usr/local/include/SDL2/SDL_system.h" # 34 "/usr/local/include/SDL2/SDL_system.h" #if 0 /* expanded by -frewrite-includes */ #include "SDL_video.h" #endif /* expanded by -frewrite-includes */ # 34 "/usr/local/include/SDL2/SDL_system.h" # 35 "/usr/local/include/SDL2/SDL_system.h" #if 0 /* expanded by -frewrite-includes */ #include "begin_code.h" #endif /* expanded by -frewrite-includes */ # 36 "/usr/local/include/SDL2/SDL_system.h" # 1 "/usr/local/include/SDL2/begin_code.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file begin_code.h * * This file sets things up for C dynamic library function definitions, * static inlined functions, and structures aligned at 4-byte alignment. * If you don't like ugly C preprocessor code, don't look at this file. :) */ /* This shouldn't be nested -- included it around code only. */ #ifdef _begin_code_h #error Nested inclusion of begin_code.h #endif # 34 "/usr/local/include/SDL2/begin_code.h" #define _begin_code_h #ifndef SDL_DEPRECATED # if (__GNUC__ >= 4) /* technically, this arrived in gcc 3.1, but oh well. */ # define SDL_DEPRECATED __attribute__((deprecated)) # else # 40 "/usr/local/include/SDL2/begin_code.h" # define SDL_DEPRECATED # endif # 42 "/usr/local/include/SDL2/begin_code.h" #endif # 43 "/usr/local/include/SDL2/begin_code.h" /* Some compilers use a special export keyword */ #ifndef DECLSPEC # if defined(__WIN32__) || defined(__WINRT__) # ifdef __BORLANDC__ # ifdef BUILD_SDL # define DECLSPEC # else # 51 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllimport) # endif # 53 "/usr/local/include/SDL2/begin_code.h" # else # 54 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllexport) # endif # 56 "/usr/local/include/SDL2/begin_code.h" # else # 57 "/usr/local/include/SDL2/begin_code.h" # if defined(__GNUC__) && __GNUC__ >= 4 # define DECLSPEC __attribute__ ((visibility("default"))) # elif defined(__GNUC__) && __GNUC__ >= 2 # 60 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllexport) # else # 62 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC # endif # 64 "/usr/local/include/SDL2/begin_code.h" # endif # 65 "/usr/local/include/SDL2/begin_code.h" #endif # 66 "/usr/local/include/SDL2/begin_code.h" /* By default SDL uses the C calling convention */ #ifndef SDLCALL #if (defined(__WIN32__) || defined(__WINRT__)) && !defined(__GNUC__) #define SDLCALL __cdecl #else # 72 "/usr/local/include/SDL2/begin_code.h" #define SDLCALL #endif # 74 "/usr/local/include/SDL2/begin_code.h" #endif /* SDLCALL */ # 75 "/usr/local/include/SDL2/begin_code.h" /* Removed DECLSPEC on Symbian OS because SDL cannot be a DLL in EPOC */ #ifdef __SYMBIAN32__ #undef DECLSPEC #define DECLSPEC #endif /* __SYMBIAN32__ */ # 81 "/usr/local/include/SDL2/begin_code.h" /* Force structure packing at 4 byte alignment. This is necessary if the header is included in code which has structure packing set to an alternate value, say for loading structures from disk. The packing is reset to the previous value in close_code.h */ #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__) #ifdef _MSC_VER #pragma warning(disable: 4103) #endif # 91 "/usr/local/include/SDL2/begin_code.h" #ifdef __BORLANDC__ #pragma nopackwarning #endif # 94 "/usr/local/include/SDL2/begin_code.h" #ifdef _M_X64 /* Use 8-byte alignment on 64-bit architectures, so pointers are aligned */ #pragma pack(push,8) #else # 98 "/usr/local/include/SDL2/begin_code.h" #pragma pack(push,4) #endif # 100 "/usr/local/include/SDL2/begin_code.h" #endif /* Compiler needs structure packing set */ # 101 "/usr/local/include/SDL2/begin_code.h" #ifndef SDL_INLINE #if defined(__GNUC__) #define SDL_INLINE __inline__ #elif defined(_MSC_VER) || defined(__BORLANDC__) || \ defined(__DMC__) || defined(__SC__) || \ defined(__WATCOMC__) || defined(__LCC__) || \ defined(__DECC) # 109 "/usr/local/include/SDL2/begin_code.h" #define SDL_INLINE __inline #ifndef __inline__ #define __inline__ __inline #endif # 113 "/usr/local/include/SDL2/begin_code.h" #else # 114 "/usr/local/include/SDL2/begin_code.h" #define SDL_INLINE inline #ifndef __inline__ #define __inline__ inline #endif # 118 "/usr/local/include/SDL2/begin_code.h" #endif # 119 "/usr/local/include/SDL2/begin_code.h" #endif /* SDL_INLINE not defined */ # 120 "/usr/local/include/SDL2/begin_code.h" #ifndef SDL_FORCE_INLINE #if defined(_MSC_VER) #define SDL_FORCE_INLINE __forceinline #elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) ) # 125 "/usr/local/include/SDL2/begin_code.h" #define SDL_FORCE_INLINE __attribute__((always_inline)) static __inline__ #else # 127 "/usr/local/include/SDL2/begin_code.h" #define SDL_FORCE_INLINE static SDL_INLINE #endif # 129 "/usr/local/include/SDL2/begin_code.h" #endif /* SDL_FORCE_INLINE not defined */ # 130 "/usr/local/include/SDL2/begin_code.h" /* Apparently this is needed by several Windows compilers */ #if !defined(__MACH__) #ifndef NULL #ifdef __cplusplus #define NULL 0 #else # 137 "/usr/local/include/SDL2/begin_code.h" #define NULL ((void *)0) #endif # 139 "/usr/local/include/SDL2/begin_code.h" #endif /* NULL */ # 140 "/usr/local/include/SDL2/begin_code.h" #endif /* ! Mac OS X - breaks precompiled headers */ # 141 "/usr/local/include/SDL2/begin_code.h" # 37 "/usr/local/include/SDL2/SDL_system.h" 2 /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif # 41 "/usr/local/include/SDL2/SDL_system.h" /* Platform specific functions for Windows */ #ifdef __WIN32__ /* Returns the D3D9 adapter index that matches the specified display index. This adapter index can be passed to IDirect3D9::CreateDevice and controls on which monitor a full screen application will appear. */ extern DECLSPEC int SDLCALL SDL_Direct3D9GetAdapterIndex( int displayIndex ); /* Returns the D3D device associated with a renderer, or NULL if it's not a D3D renderer. Once you are done using the device, you should release it to avoid a resource leak. */ typedef struct IDirect3DDevice9 IDirect3DDevice9; extern DECLSPEC IDirect3DDevice9* SDLCALL SDL_RenderGetD3D9Device(SDL_Renderer * renderer); /* Returns the DXGI Adapter and Output indices for the specified display index. These can be passed to EnumAdapters and EnumOutputs respectively to get the objects required to create a DX10 or DX11 device and swap chain. */ extern DECLSPEC void SDLCALL SDL_DXGIGetOutputInfo( int displayIndex, int *adapterIndex, int *outputIndex ); #endif /* __WIN32__ */ # 65 "/usr/local/include/SDL2/SDL_system.h" /* Platform specific functions for iOS */ #if defined(__IPHONEOS__) && __IPHONEOS__ extern DECLSPEC int SDLCALL SDL_iPhoneSetAnimationCallback(SDL_Window * window, int interval, void (*callback)(void*), void *callbackParam); extern DECLSPEC void SDLCALL SDL_iPhoneSetEventPump(SDL_bool enabled); #endif /* __IPHONEOS__ */ # 74 "/usr/local/include/SDL2/SDL_system.h" /* Platform specific functions for Android */ #if defined(__ANDROID__) && __ANDROID__ /* Get the JNI environment for the current thread This returns JNIEnv*, but the prototype is void* so we don't need jni.h */ extern DECLSPEC void * SDLCALL SDL_AndroidGetJNIEnv(); /* Get the SDL Activity object for the application This returns jobject, but the prototype is void* so we don't need jni.h The jobject returned by SDL_AndroidGetActivity is a local reference. It is the caller's responsibility to properly release it (using env->Push/PopLocalFrame or manually with env->DeleteLocalRef) */ extern DECLSPEC void * SDLCALL SDL_AndroidGetActivity(); /* See the official Android developer guide for more information: http://developer.android.com/guide/topics/data/data-storage.html */ #define SDL_ANDROID_EXTERNAL_STORAGE_READ 0x01 #define SDL_ANDROID_EXTERNAL_STORAGE_WRITE 0x02 /* Get the path used for internal storage for this application. This path is unique to your application and cannot be written to by other applications. */ extern DECLSPEC const char * SDLCALL SDL_AndroidGetInternalStoragePath(); /* Get the current state of external storage, a bitmask of these values: SDL_ANDROID_EXTERNAL_STORAGE_READ SDL_ANDROID_EXTERNAL_STORAGE_WRITE If external storage is currently unavailable, this will return 0. */ extern DECLSPEC int SDLCALL SDL_AndroidGetExternalStorageState(); /* Get the path used for external storage for this application. This path is unique to your application, but is public and can be written to by other applications. */ extern DECLSPEC const char * SDLCALL SDL_AndroidGetExternalStoragePath(); #endif /* __ANDROID__ */ # 118 "/usr/local/include/SDL2/SDL_system.h" /* Platform specific functions for WinRT */ #if defined(__WINRT__) && __WINRT__ /** * \brief WinRT / Windows Phone path types */ typedef enum { /** \brief The installed app's root directory. Files here are likely to be read-only. */ SDL_WINRT_PATH_INSTALLED_LOCATION, /** \brief The app's local data store. Files may be written here */ SDL_WINRT_PATH_LOCAL_FOLDER, /** \brief The app's roaming data store. Unsupported on Windows Phone. Files written here may be copied to other machines via a network connection. */ SDL_WINRT_PATH_ROAMING_FOLDER, /** \brief The app's temporary data store. Unsupported on Windows Phone. Files written here may be deleted at any time. */ SDL_WINRT_PATH_TEMP_FOLDER } SDL_WinRT_Path; /** * \brief Retrieves a WinRT defined path on the local file system * * \note Documentation on most app-specific path types on WinRT * can be found on MSDN, at the URL: * http://msdn.microsoft.com/en-us/library/windows/apps/hh464917.aspx * * \param pathType The type of path to retrieve. * \ret A UCS-2 string (16-bit, wide-char) containing the path, or NULL * if the path is not available for any reason. Not all paths are * available on all versions of Windows. This is especially true on * Windows Phone. Check the documentation for the given * SDL_WinRT_Path for more information on which path types are * supported where. */ extern DECLSPEC const wchar_t * SDLCALL SDL_WinRTGetFSPathUNICODE(SDL_WinRT_Path pathType); /** * \brief Retrieves a WinRT defined path on the local file system * * \note Documentation on most app-specific path types on WinRT * can be found on MSDN, at the URL: * http://msdn.microsoft.com/en-us/library/windows/apps/hh464917.aspx * * \param pathType The type of path to retrieve. * \ret A UTF-8 string (8-bit, multi-byte) containing the path, or NULL * if the path is not available for any reason. Not all paths are * available on all versions of Windows. This is especially true on * Windows Phone. Check the documentation for the given * SDL_WinRT_Path for more information on which path types are * supported where. */ extern DECLSPEC const char * SDLCALL SDL_WinRTGetFSPathUTF8(SDL_WinRT_Path pathType); #endif /* __WINRT__ */ # 181 "/usr/local/include/SDL2/SDL_system.h" /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif # 187 "/usr/local/include/SDL2/SDL_system.h" #if 0 /* expanded by -frewrite-includes */ #include "close_code.h" #endif /* expanded by -frewrite-includes */ # 187 "/usr/local/include/SDL2/SDL_system.h" # 1 "/usr/local/include/SDL2/close_code.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file close_code.h * * This file reverses the effects of begin_code.h and should be included * after you finish any function and structure declarations in your headers */ #undef _begin_code_h /* Reset structure packing at previous byte alignment */ #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__WATCOMC__) || defined(__BORLANDC__) #ifdef __BORLANDC__ #pragma nopackwarning #endif # 36 "/usr/local/include/SDL2/close_code.h" #pragma pack(pop) #endif /* Compiler needs structure packing set */ # 38 "/usr/local/include/SDL2/close_code.h" # 188 "/usr/local/include/SDL2/SDL_system.h" 2 #endif /* _SDL_system_h */ # 190 "/usr/local/include/SDL2/SDL_system.h" /* vi: set ts=4 sw=4 expandtab: */ # 90 "/usr/local/include/SDL2/SDL.h" 2 #if 0 /* expanded by -frewrite-includes */ #include "SDL_thread.h" #endif /* expanded by -frewrite-includes */ # 90 "/usr/local/include/SDL2/SDL.h" # 91 "/usr/local/include/SDL2/SDL.h" #if 0 /* expanded by -frewrite-includes */ #include "SDL_timer.h" #endif /* expanded by -frewrite-includes */ # 91 "/usr/local/include/SDL2/SDL.h" # 1 "/usr/local/include/SDL2/SDL_timer.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #ifndef _SDL_timer_h #define _SDL_timer_h /** * \file SDL_timer.h * * Header for the SDL time management routines. */ #if 0 /* expanded by -frewrite-includes */ #include "SDL_stdinc.h" #endif /* expanded by -frewrite-includes */ # 31 "/usr/local/include/SDL2/SDL_timer.h" # 32 "/usr/local/include/SDL2/SDL_timer.h" #if 0 /* expanded by -frewrite-includes */ #include "SDL_error.h" #endif /* expanded by -frewrite-includes */ # 32 "/usr/local/include/SDL2/SDL_timer.h" # 33 "/usr/local/include/SDL2/SDL_timer.h" #if 0 /* expanded by -frewrite-includes */ #include "begin_code.h" #endif /* expanded by -frewrite-includes */ # 34 "/usr/local/include/SDL2/SDL_timer.h" # 1 "/usr/local/include/SDL2/begin_code.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file begin_code.h * * This file sets things up for C dynamic library function definitions, * static inlined functions, and structures aligned at 4-byte alignment. * If you don't like ugly C preprocessor code, don't look at this file. :) */ /* This shouldn't be nested -- included it around code only. */ #ifdef _begin_code_h #error Nested inclusion of begin_code.h #endif # 34 "/usr/local/include/SDL2/begin_code.h" #define _begin_code_h #ifndef SDL_DEPRECATED # if (__GNUC__ >= 4) /* technically, this arrived in gcc 3.1, but oh well. */ # define SDL_DEPRECATED __attribute__((deprecated)) # else # 40 "/usr/local/include/SDL2/begin_code.h" # define SDL_DEPRECATED # endif # 42 "/usr/local/include/SDL2/begin_code.h" #endif # 43 "/usr/local/include/SDL2/begin_code.h" /* Some compilers use a special export keyword */ #ifndef DECLSPEC # if defined(__WIN32__) || defined(__WINRT__) # ifdef __BORLANDC__ # ifdef BUILD_SDL # define DECLSPEC # else # 51 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllimport) # endif # 53 "/usr/local/include/SDL2/begin_code.h" # else # 54 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllexport) # endif # 56 "/usr/local/include/SDL2/begin_code.h" # else # 57 "/usr/local/include/SDL2/begin_code.h" # if defined(__GNUC__) && __GNUC__ >= 4 # define DECLSPEC __attribute__ ((visibility("default"))) # elif defined(__GNUC__) && __GNUC__ >= 2 # 60 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllexport) # else # 62 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC # endif # 64 "/usr/local/include/SDL2/begin_code.h" # endif # 65 "/usr/local/include/SDL2/begin_code.h" #endif # 66 "/usr/local/include/SDL2/begin_code.h" /* By default SDL uses the C calling convention */ #ifndef SDLCALL #if (defined(__WIN32__) || defined(__WINRT__)) && !defined(__GNUC__) #define SDLCALL __cdecl #else # 72 "/usr/local/include/SDL2/begin_code.h" #define SDLCALL #endif # 74 "/usr/local/include/SDL2/begin_code.h" #endif /* SDLCALL */ # 75 "/usr/local/include/SDL2/begin_code.h" /* Removed DECLSPEC on Symbian OS because SDL cannot be a DLL in EPOC */ #ifdef __SYMBIAN32__ #undef DECLSPEC #define DECLSPEC #endif /* __SYMBIAN32__ */ # 81 "/usr/local/include/SDL2/begin_code.h" /* Force structure packing at 4 byte alignment. This is necessary if the header is included in code which has structure packing set to an alternate value, say for loading structures from disk. The packing is reset to the previous value in close_code.h */ #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__) #ifdef _MSC_VER #pragma warning(disable: 4103) #endif # 91 "/usr/local/include/SDL2/begin_code.h" #ifdef __BORLANDC__ #pragma nopackwarning #endif # 94 "/usr/local/include/SDL2/begin_code.h" #ifdef _M_X64 /* Use 8-byte alignment on 64-bit architectures, so pointers are aligned */ #pragma pack(push,8) #else # 98 "/usr/local/include/SDL2/begin_code.h" #pragma pack(push,4) #endif # 100 "/usr/local/include/SDL2/begin_code.h" #endif /* Compiler needs structure packing set */ # 101 "/usr/local/include/SDL2/begin_code.h" #ifndef SDL_INLINE #if defined(__GNUC__) #define SDL_INLINE __inline__ #elif defined(_MSC_VER) || defined(__BORLANDC__) || \ defined(__DMC__) || defined(__SC__) || \ defined(__WATCOMC__) || defined(__LCC__) || \ defined(__DECC) # 109 "/usr/local/include/SDL2/begin_code.h" #define SDL_INLINE __inline #ifndef __inline__ #define __inline__ __inline #endif # 113 "/usr/local/include/SDL2/begin_code.h" #else # 114 "/usr/local/include/SDL2/begin_code.h" #define SDL_INLINE inline #ifndef __inline__ #define __inline__ inline #endif # 118 "/usr/local/include/SDL2/begin_code.h" #endif # 119 "/usr/local/include/SDL2/begin_code.h" #endif /* SDL_INLINE not defined */ # 120 "/usr/local/include/SDL2/begin_code.h" #ifndef SDL_FORCE_INLINE #if defined(_MSC_VER) #define SDL_FORCE_INLINE __forceinline #elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) ) # 125 "/usr/local/include/SDL2/begin_code.h" #define SDL_FORCE_INLINE __attribute__((always_inline)) static __inline__ #else # 127 "/usr/local/include/SDL2/begin_code.h" #define SDL_FORCE_INLINE static SDL_INLINE #endif # 129 "/usr/local/include/SDL2/begin_code.h" #endif /* SDL_FORCE_INLINE not defined */ # 130 "/usr/local/include/SDL2/begin_code.h" /* Apparently this is needed by several Windows compilers */ #if !defined(__MACH__) #ifndef NULL #ifdef __cplusplus #define NULL 0 #else # 137 "/usr/local/include/SDL2/begin_code.h" #define NULL ((void *)0) #endif # 139 "/usr/local/include/SDL2/begin_code.h" #endif /* NULL */ # 140 "/usr/local/include/SDL2/begin_code.h" #endif /* ! Mac OS X - breaks precompiled headers */ # 141 "/usr/local/include/SDL2/begin_code.h" # 35 "/usr/local/include/SDL2/SDL_timer.h" 2 /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif # 39 "/usr/local/include/SDL2/SDL_timer.h" /** * \brief Get the number of milliseconds since the SDL library initialization. * * \note This value wraps if the program runs for more than ~49 days. */ extern DECLSPEC Uint32 SDLCALL SDL_GetTicks(void); /** * \brief Compare SDL ticks values, and return true if A has passed B * * e.g. if you want to wait 100 ms, you could do this: * Uint32 timeout = SDL_GetTicks() + 100; * while (!SDL_TICKS_PASSED(SDL_GetTicks(), timeout)) { * ... do work until timeout has elapsed * } */ #define SDL_TICKS_PASSED(A, B) ((Sint32)((B) - (A)) <= 0) /** * \brief Get the current value of the high resolution counter */ extern DECLSPEC Uint64 SDLCALL SDL_GetPerformanceCounter(void); /** * \brief Get the count per second of the high resolution counter */ extern DECLSPEC Uint64 SDLCALL SDL_GetPerformanceFrequency(void); /** * \brief Wait a specified number of milliseconds before returning. */ extern DECLSPEC void SDLCALL SDL_Delay(Uint32 ms); /** * Function prototype for the timer callback function. * * The callback function is passed the current timer interval and returns * the next timer interval. If the returned value is the same as the one * passed in, the periodic alarm continues, otherwise a new alarm is * scheduled. If the callback returns 0, the periodic alarm is cancelled. */ typedef Uint32 (SDLCALL * SDL_TimerCallback) (Uint32 interval, void *param); /** * Definition of the timer ID type. */ typedef int SDL_TimerID; /** * \brief Add a new timer to the pool of timers already running. * * \return A timer ID, or NULL when an error occurs. */ extern DECLSPEC SDL_TimerID SDLCALL SDL_AddTimer(Uint32 interval, SDL_TimerCallback callback, void *param); /** * \brief Remove a timer knowing its ID. * * \return A boolean value indicating success or failure. * * \warning It is not safe to remove a timer multiple times. */ extern DECLSPEC SDL_bool SDLCALL SDL_RemoveTimer(SDL_TimerID id); /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif # 111 "/usr/local/include/SDL2/SDL_timer.h" #if 0 /* expanded by -frewrite-includes */ #include "close_code.h" #endif /* expanded by -frewrite-includes */ # 111 "/usr/local/include/SDL2/SDL_timer.h" # 1 "/usr/local/include/SDL2/close_code.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file close_code.h * * This file reverses the effects of begin_code.h and should be included * after you finish any function and structure declarations in your headers */ #undef _begin_code_h /* Reset structure packing at previous byte alignment */ #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__WATCOMC__) || defined(__BORLANDC__) #ifdef __BORLANDC__ #pragma nopackwarning #endif # 36 "/usr/local/include/SDL2/close_code.h" #pragma pack(pop) #endif /* Compiler needs structure packing set */ # 38 "/usr/local/include/SDL2/close_code.h" # 112 "/usr/local/include/SDL2/SDL_timer.h" 2 #endif /* _SDL_timer_h */ # 114 "/usr/local/include/SDL2/SDL_timer.h" /* vi: set ts=4 sw=4 expandtab: */ # 92 "/usr/local/include/SDL2/SDL.h" 2 #if 0 /* expanded by -frewrite-includes */ #include "SDL_version.h" #endif /* expanded by -frewrite-includes */ # 92 "/usr/local/include/SDL2/SDL.h" # 1 "/usr/local/include/SDL2/SDL_version.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file SDL_version.h * * This header defines the current SDL version. */ #ifndef _SDL_version_h #define _SDL_version_h #if 0 /* expanded by -frewrite-includes */ #include "SDL_stdinc.h" #endif /* expanded by -frewrite-includes */ # 31 "/usr/local/include/SDL2/SDL_version.h" # 32 "/usr/local/include/SDL2/SDL_version.h" #if 0 /* expanded by -frewrite-includes */ #include "begin_code.h" #endif /* expanded by -frewrite-includes */ # 33 "/usr/local/include/SDL2/SDL_version.h" # 1 "/usr/local/include/SDL2/begin_code.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file begin_code.h * * This file sets things up for C dynamic library function definitions, * static inlined functions, and structures aligned at 4-byte alignment. * If you don't like ugly C preprocessor code, don't look at this file. :) */ /* This shouldn't be nested -- included it around code only. */ #ifdef _begin_code_h #error Nested inclusion of begin_code.h #endif # 34 "/usr/local/include/SDL2/begin_code.h" #define _begin_code_h #ifndef SDL_DEPRECATED # if (__GNUC__ >= 4) /* technically, this arrived in gcc 3.1, but oh well. */ # define SDL_DEPRECATED __attribute__((deprecated)) # else # 40 "/usr/local/include/SDL2/begin_code.h" # define SDL_DEPRECATED # endif # 42 "/usr/local/include/SDL2/begin_code.h" #endif # 43 "/usr/local/include/SDL2/begin_code.h" /* Some compilers use a special export keyword */ #ifndef DECLSPEC # if defined(__WIN32__) || defined(__WINRT__) # ifdef __BORLANDC__ # ifdef BUILD_SDL # define DECLSPEC # else # 51 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllimport) # endif # 53 "/usr/local/include/SDL2/begin_code.h" # else # 54 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllexport) # endif # 56 "/usr/local/include/SDL2/begin_code.h" # else # 57 "/usr/local/include/SDL2/begin_code.h" # if defined(__GNUC__) && __GNUC__ >= 4 # define DECLSPEC __attribute__ ((visibility("default"))) # elif defined(__GNUC__) && __GNUC__ >= 2 # 60 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllexport) # else # 62 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC # endif # 64 "/usr/local/include/SDL2/begin_code.h" # endif # 65 "/usr/local/include/SDL2/begin_code.h" #endif # 66 "/usr/local/include/SDL2/begin_code.h" /* By default SDL uses the C calling convention */ #ifndef SDLCALL #if (defined(__WIN32__) || defined(__WINRT__)) && !defined(__GNUC__) #define SDLCALL __cdecl #else # 72 "/usr/local/include/SDL2/begin_code.h" #define SDLCALL #endif # 74 "/usr/local/include/SDL2/begin_code.h" #endif /* SDLCALL */ # 75 "/usr/local/include/SDL2/begin_code.h" /* Removed DECLSPEC on Symbian OS because SDL cannot be a DLL in EPOC */ #ifdef __SYMBIAN32__ #undef DECLSPEC #define DECLSPEC #endif /* __SYMBIAN32__ */ # 81 "/usr/local/include/SDL2/begin_code.h" /* Force structure packing at 4 byte alignment. This is necessary if the header is included in code which has structure packing set to an alternate value, say for loading structures from disk. The packing is reset to the previous value in close_code.h */ #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__) #ifdef _MSC_VER #pragma warning(disable: 4103) #endif # 91 "/usr/local/include/SDL2/begin_code.h" #ifdef __BORLANDC__ #pragma nopackwarning #endif # 94 "/usr/local/include/SDL2/begin_code.h" #ifdef _M_X64 /* Use 8-byte alignment on 64-bit architectures, so pointers are aligned */ #pragma pack(push,8) #else # 98 "/usr/local/include/SDL2/begin_code.h" #pragma pack(push,4) #endif # 100 "/usr/local/include/SDL2/begin_code.h" #endif /* Compiler needs structure packing set */ # 101 "/usr/local/include/SDL2/begin_code.h" #ifndef SDL_INLINE #if defined(__GNUC__) #define SDL_INLINE __inline__ #elif defined(_MSC_VER) || defined(__BORLANDC__) || \ defined(__DMC__) || defined(__SC__) || \ defined(__WATCOMC__) || defined(__LCC__) || \ defined(__DECC) # 109 "/usr/local/include/SDL2/begin_code.h" #define SDL_INLINE __inline #ifndef __inline__ #define __inline__ __inline #endif # 113 "/usr/local/include/SDL2/begin_code.h" #else # 114 "/usr/local/include/SDL2/begin_code.h" #define SDL_INLINE inline #ifndef __inline__ #define __inline__ inline #endif # 118 "/usr/local/include/SDL2/begin_code.h" #endif # 119 "/usr/local/include/SDL2/begin_code.h" #endif /* SDL_INLINE not defined */ # 120 "/usr/local/include/SDL2/begin_code.h" #ifndef SDL_FORCE_INLINE #if defined(_MSC_VER) #define SDL_FORCE_INLINE __forceinline #elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) ) # 125 "/usr/local/include/SDL2/begin_code.h" #define SDL_FORCE_INLINE __attribute__((always_inline)) static __inline__ #else # 127 "/usr/local/include/SDL2/begin_code.h" #define SDL_FORCE_INLINE static SDL_INLINE #endif # 129 "/usr/local/include/SDL2/begin_code.h" #endif /* SDL_FORCE_INLINE not defined */ # 130 "/usr/local/include/SDL2/begin_code.h" /* Apparently this is needed by several Windows compilers */ #if !defined(__MACH__) #ifndef NULL #ifdef __cplusplus #define NULL 0 #else # 137 "/usr/local/include/SDL2/begin_code.h" #define NULL ((void *)0) #endif # 139 "/usr/local/include/SDL2/begin_code.h" #endif /* NULL */ # 140 "/usr/local/include/SDL2/begin_code.h" #endif /* ! Mac OS X - breaks precompiled headers */ # 141 "/usr/local/include/SDL2/begin_code.h" # 34 "/usr/local/include/SDL2/SDL_version.h" 2 /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif # 38 "/usr/local/include/SDL2/SDL_version.h" /** * \brief Information the version of SDL in use. * * Represents the library's version as three levels: major revision * (increments with massive changes, additions, and enhancements), * minor revision (increments with backwards-compatible changes to the * major revision), and patchlevel (increments with fixes to the minor * revision). * * \sa SDL_VERSION * \sa SDL_GetVersion */ typedef struct SDL_version { Uint8 major; /**< major version */ Uint8 minor; /**< minor version */ Uint8 patch; /**< update version */ } SDL_version; /* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL */ #define SDL_MAJOR_VERSION 2 #define SDL_MINOR_VERSION 0 #define SDL_PATCHLEVEL 3 /** * \brief Macro to determine SDL version program was compiled against. * * This macro fills in a SDL_version structure with the version of the * library you compiled against. This is determined by what header the * compiler uses. Note that if you dynamically linked the library, you might * have a slightly newer or older version at runtime. That version can be * determined with SDL_GetVersion(), which, unlike SDL_VERSION(), * is not a macro. * * \param x A pointer to a SDL_version struct to initialize. * * \sa SDL_version * \sa SDL_GetVersion */ #define SDL_VERSION(x) \ { \ (x)->major = SDL_MAJOR_VERSION; \ (x)->minor = SDL_MINOR_VERSION; \ (x)->patch = SDL_PATCHLEVEL; \ } /** * This macro turns the version numbers into a numeric value: * \verbatim (1,2,3) -> (1203) \endverbatim * * This assumes that there will never be more than 100 patchlevels. */ #define SDL_VERSIONNUM(X, Y, Z) \ ((X)*1000 + (Y)*100 + (Z)) /** * This is the version number macro for the current SDL version. */ #define SDL_COMPILEDVERSION \ SDL_VERSIONNUM(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL) /** * This macro will evaluate to true if compiled with SDL at least X.Y.Z. */ #define SDL_VERSION_ATLEAST(X, Y, Z) \ (SDL_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z)) /** * \brief Get the version of SDL that is linked against your program. * * If you are linking to SDL dynamically, then it is possible that the * current version will be different than the version you compiled against. * This function returns the current version, while SDL_VERSION() is a * macro that tells you what version you compiled with. * * \code * SDL_version compiled; * SDL_version linked; * * SDL_VERSION(&compiled); * SDL_GetVersion(&linked); * printf("We compiled against SDL version %d.%d.%d ...\n", * compiled.major, compiled.minor, compiled.patch); * printf("But we linked against SDL version %d.%d.%d.\n", * linked.major, linked.minor, linked.patch); * \endcode * * This function may be called safely at any time, even before SDL_Init(). * * \sa SDL_VERSION */ extern DECLSPEC void SDLCALL SDL_GetVersion(SDL_version * ver); /** * \brief Get the code revision of SDL that is linked against your program. * * Returns an arbitrary string (a hash value) uniquely identifying the * exact revision of the SDL library in use, and is only useful in comparing * against other revisions. It is NOT an incrementing number. */ extern DECLSPEC const char *SDLCALL SDL_GetRevision(void); /** * \brief Get the revision number of SDL that is linked against your program. * * Returns a number uniquely identifying the exact revision of the SDL * library in use. It is an incrementing number based on commits to * hg.libsdl.org. */ extern DECLSPEC int SDLCALL SDL_GetRevisionNumber(void); /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif # 158 "/usr/local/include/SDL2/SDL_version.h" #if 0 /* expanded by -frewrite-includes */ #include "close_code.h" #endif /* expanded by -frewrite-includes */ # 158 "/usr/local/include/SDL2/SDL_version.h" # 1 "/usr/local/include/SDL2/close_code.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file close_code.h * * This file reverses the effects of begin_code.h and should be included * after you finish any function and structure declarations in your headers */ #undef _begin_code_h /* Reset structure packing at previous byte alignment */ #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__WATCOMC__) || defined(__BORLANDC__) #ifdef __BORLANDC__ #pragma nopackwarning #endif # 36 "/usr/local/include/SDL2/close_code.h" #pragma pack(pop) #endif /* Compiler needs structure packing set */ # 38 "/usr/local/include/SDL2/close_code.h" # 159 "/usr/local/include/SDL2/SDL_version.h" 2 #endif /* _SDL_version_h */ # 161 "/usr/local/include/SDL2/SDL_version.h" /* vi: set ts=4 sw=4 expandtab: */ # 93 "/usr/local/include/SDL2/SDL.h" 2 #if 0 /* expanded by -frewrite-includes */ #include "SDL_video.h" #endif /* expanded by -frewrite-includes */ # 93 "/usr/local/include/SDL2/SDL.h" # 94 "/usr/local/include/SDL2/SDL.h" #if 0 /* expanded by -frewrite-includes */ #include "begin_code.h" #endif /* expanded by -frewrite-includes */ # 95 "/usr/local/include/SDL2/SDL.h" # 1 "/usr/local/include/SDL2/begin_code.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file begin_code.h * * This file sets things up for C dynamic library function definitions, * static inlined functions, and structures aligned at 4-byte alignment. * If you don't like ugly C preprocessor code, don't look at this file. :) */ /* This shouldn't be nested -- included it around code only. */ #ifdef _begin_code_h #error Nested inclusion of begin_code.h #endif # 34 "/usr/local/include/SDL2/begin_code.h" #define _begin_code_h #ifndef SDL_DEPRECATED # if (__GNUC__ >= 4) /* technically, this arrived in gcc 3.1, but oh well. */ # define SDL_DEPRECATED __attribute__((deprecated)) # else # 40 "/usr/local/include/SDL2/begin_code.h" # define SDL_DEPRECATED # endif # 42 "/usr/local/include/SDL2/begin_code.h" #endif # 43 "/usr/local/include/SDL2/begin_code.h" /* Some compilers use a special export keyword */ #ifndef DECLSPEC # if defined(__WIN32__) || defined(__WINRT__) # ifdef __BORLANDC__ # ifdef BUILD_SDL # define DECLSPEC # else # 51 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllimport) # endif # 53 "/usr/local/include/SDL2/begin_code.h" # else # 54 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllexport) # endif # 56 "/usr/local/include/SDL2/begin_code.h" # else # 57 "/usr/local/include/SDL2/begin_code.h" # if defined(__GNUC__) && __GNUC__ >= 4 # define DECLSPEC __attribute__ ((visibility("default"))) # elif defined(__GNUC__) && __GNUC__ >= 2 # 60 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC __declspec(dllexport) # else # 62 "/usr/local/include/SDL2/begin_code.h" # define DECLSPEC # endif # 64 "/usr/local/include/SDL2/begin_code.h" # endif # 65 "/usr/local/include/SDL2/begin_code.h" #endif # 66 "/usr/local/include/SDL2/begin_code.h" /* By default SDL uses the C calling convention */ #ifndef SDLCALL #if (defined(__WIN32__) || defined(__WINRT__)) && !defined(__GNUC__) #define SDLCALL __cdecl #else # 72 "/usr/local/include/SDL2/begin_code.h" #define SDLCALL #endif # 74 "/usr/local/include/SDL2/begin_code.h" #endif /* SDLCALL */ # 75 "/usr/local/include/SDL2/begin_code.h" /* Removed DECLSPEC on Symbian OS because SDL cannot be a DLL in EPOC */ #ifdef __SYMBIAN32__ #undef DECLSPEC #define DECLSPEC #endif /* __SYMBIAN32__ */ # 81 "/usr/local/include/SDL2/begin_code.h" /* Force structure packing at 4 byte alignment. This is necessary if the header is included in code which has structure packing set to an alternate value, say for loading structures from disk. The packing is reset to the previous value in close_code.h */ #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__) #ifdef _MSC_VER #pragma warning(disable: 4103) #endif # 91 "/usr/local/include/SDL2/begin_code.h" #ifdef __BORLANDC__ #pragma nopackwarning #endif # 94 "/usr/local/include/SDL2/begin_code.h" #ifdef _M_X64 /* Use 8-byte alignment on 64-bit architectures, so pointers are aligned */ #pragma pack(push,8) #else # 98 "/usr/local/include/SDL2/begin_code.h" #pragma pack(push,4) #endif # 100 "/usr/local/include/SDL2/begin_code.h" #endif /* Compiler needs structure packing set */ # 101 "/usr/local/include/SDL2/begin_code.h" #ifndef SDL_INLINE #if defined(__GNUC__) #define SDL_INLINE __inline__ #elif defined(_MSC_VER) || defined(__BORLANDC__) || \ defined(__DMC__) || defined(__SC__) || \ defined(__WATCOMC__) || defined(__LCC__) || \ defined(__DECC) # 109 "/usr/local/include/SDL2/begin_code.h" #define SDL_INLINE __inline #ifndef __inline__ #define __inline__ __inline #endif # 113 "/usr/local/include/SDL2/begin_code.h" #else # 114 "/usr/local/include/SDL2/begin_code.h" #define SDL_INLINE inline #ifndef __inline__ #define __inline__ inline #endif # 118 "/usr/local/include/SDL2/begin_code.h" #endif # 119 "/usr/local/include/SDL2/begin_code.h" #endif /* SDL_INLINE not defined */ # 120 "/usr/local/include/SDL2/begin_code.h" #ifndef SDL_FORCE_INLINE #if defined(_MSC_VER) #define SDL_FORCE_INLINE __forceinline #elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) ) # 125 "/usr/local/include/SDL2/begin_code.h" #define SDL_FORCE_INLINE __attribute__((always_inline)) static __inline__ #else # 127 "/usr/local/include/SDL2/begin_code.h" #define SDL_FORCE_INLINE static SDL_INLINE #endif # 129 "/usr/local/include/SDL2/begin_code.h" #endif /* SDL_FORCE_INLINE not defined */ # 130 "/usr/local/include/SDL2/begin_code.h" /* Apparently this is needed by several Windows compilers */ #if !defined(__MACH__) #ifndef NULL #ifdef __cplusplus #define NULL 0 #else # 137 "/usr/local/include/SDL2/begin_code.h" #define NULL ((void *)0) #endif # 139 "/usr/local/include/SDL2/begin_code.h" #endif /* NULL */ # 140 "/usr/local/include/SDL2/begin_code.h" #endif /* ! Mac OS X - breaks precompiled headers */ # 141 "/usr/local/include/SDL2/begin_code.h" # 96 "/usr/local/include/SDL2/SDL.h" 2 /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif # 100 "/usr/local/include/SDL2/SDL.h" /* As of version 0.5, SDL is loaded dynamically into the application */ /** * \name SDL_INIT_* * * These are the flags which may be passed to SDL_Init(). You should * specify the subsystems which you will be using in your application. */ /* @{ */ #define SDL_INIT_TIMER 0x00000001 #define SDL_INIT_AUDIO 0x00000010 #define SDL_INIT_VIDEO 0x00000020 /**< SDL_INIT_VIDEO implies SDL_INIT_EVENTS */ #define SDL_INIT_JOYSTICK 0x00000200 /**< SDL_INIT_JOYSTICK implies SDL_INIT_EVENTS */ #define SDL_INIT_HAPTIC 0x00001000 #define SDL_INIT_GAMECONTROLLER 0x00002000 /**< SDL_INIT_GAMECONTROLLER implies SDL_INIT_JOYSTICK */ #define SDL_INIT_EVENTS 0x00004000 #define SDL_INIT_NOPARACHUTE 0x00100000 /**< Don't catch fatal signals */ #define SDL_INIT_EVERYTHING ( \ SDL_INIT_TIMER | SDL_INIT_AUDIO | SDL_INIT_VIDEO | SDL_INIT_EVENTS | \ SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC | SDL_INIT_GAMECONTROLLER \ ) /* @} */ /** * This function initializes the subsystems specified by \c flags * Unless the ::SDL_INIT_NOPARACHUTE flag is set, it will install cleanup * signal handlers for some commonly ignored fatal signals (like SIGSEGV). */ extern DECLSPEC int SDLCALL SDL_Init(Uint32 flags); /** * This function initializes specific SDL subsystems */ extern DECLSPEC int SDLCALL SDL_InitSubSystem(Uint32 flags); /** * This function cleans up specific SDL subsystems */ extern DECLSPEC void SDLCALL SDL_QuitSubSystem(Uint32 flags); /** * This function returns a mask of the specified subsystems which have * previously been initialized. * * If \c flags is 0, it returns a mask of all initialized subsystems. */ extern DECLSPEC Uint32 SDLCALL SDL_WasInit(Uint32 flags); /** * This function cleans up all initialized subsystems. You should * call it upon all exit conditions. */ extern DECLSPEC void SDLCALL SDL_Quit(void); /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif # 159 "/usr/local/include/SDL2/SDL.h" #if 0 /* expanded by -frewrite-includes */ #include "close_code.h" #endif /* expanded by -frewrite-includes */ # 159 "/usr/local/include/SDL2/SDL.h" # 1 "/usr/local/include/SDL2/close_code.h" 1 /* Simple DirectMedia Layer Copyright (C) 1997-2014 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file close_code.h * * This file reverses the effects of begin_code.h and should be included * after you finish any function and structure declarations in your headers */ #undef _begin_code_h /* Reset structure packing at previous byte alignment */ #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__WATCOMC__) || defined(__BORLANDC__) #ifdef __BORLANDC__ #pragma nopackwarning #endif # 36 "/usr/local/include/SDL2/close_code.h" #pragma pack(pop) #endif /* Compiler needs structure packing set */ # 38 "/usr/local/include/SDL2/close_code.h" # 160 "/usr/local/include/SDL2/SDL.h" 2 #endif /* _SDL_H */ # 162 "/usr/local/include/SDL2/SDL.h" /* vi: set ts=4 sw=4 expandtab: */ # 46 "SDL2_imageFilter.c" 2 /* Use GCC intrinsics if available: they support both i386 and x86_64, provide ASM-grade performances, and lift the PUSHA/POPA issues. */ #ifdef __GNUC__ # ifdef USE_MMX #if 0 /* expanded by -frewrite-includes */ # include #endif /* expanded by -frewrite-includes */ # 51 "SDL2_imageFilter.c" # 52 "SDL2_imageFilter.c" # endif # 53 "SDL2_imageFilter.c" #if 0 /* expanded by -frewrite-includes */ # include #endif /* expanded by -frewrite-includes */ # 53 "SDL2_imageFilter.c" # 54 "SDL2_imageFilter.c" #endif # 55 "SDL2_imageFilter.c" #if 0 /* expanded by -frewrite-includes */ #include "SDL2_imageFilter.h" #endif /* expanded by -frewrite-includes */ # 56 "SDL2_imageFilter.c" # 1 "./SDL2_imageFilter.h" 1 /* SDL2_imageFilter.h: byte-image "filter" routines Copyright (C) 2001-2012 Andreas Schiffler This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. Andreas Schiffler -- aschiffler at ferzkopp dot net */ #ifndef _SDL2_imageFilter_h #define _SDL2_imageFilter_h /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif # 37 "./SDL2_imageFilter.h" /* ---- Function Prototypes */ #ifdef _MSC_VER # if defined(DLL_EXPORT) && !defined(LIBSDL2_GFX_DLL_IMPORT) # define SDL2_IMAGEFILTER_SCOPE __declspec(dllexport) # else # 44 "./SDL2_imageFilter.h" # ifdef LIBSDL2_GFX_DLL_IMPORT # define SDL2_IMAGEFILTER_SCOPE __declspec(dllimport) # endif # 47 "./SDL2_imageFilter.h" # endif # 48 "./SDL2_imageFilter.h" #endif # 49 "./SDL2_imageFilter.h" #ifndef SDL2_IMAGEFILTER_SCOPE # define SDL2_IMAGEFILTER_SCOPE extern #endif # 52 "./SDL2_imageFilter.h" /* Comments: */ /* 1.) MMX functions work best if all data blocks are aligned on a 32 bytes boundary. */ /* 2.) Data that is not within an 8 byte boundary is processed using the C routine. */ /* 3.) Convolution routines do not have C routines at this time. */ // Detect MMX capability in CPU SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterMMXdetect(void); // Force use of MMX off (or turn possible use back on) SDL2_IMAGEFILTER_SCOPE void SDL_imageFilterMMXoff(void); SDL2_IMAGEFILTER_SCOPE void SDL_imageFilterMMXon(void); // // All routines return: // 0 OK // -1 Error (internal error, parameter error) // // SDL_imageFilterAdd: D = saturation255(S1 + S2) SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterAdd(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length); // SDL_imageFilterMean: D = S1/2 + S2/2 SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterMean(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length); // SDL_imageFilterSub: D = saturation0(S1 - S2) SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterSub(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length); // SDL_imageFilterAbsDiff: D = | S1 - S2 | SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterAbsDiff(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length); // SDL_imageFilterMult: D = saturation(S1 * S2) SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterMult(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length); // SDL_imageFilterMultNor: D = S1 * S2 (non-MMX) SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterMultNor(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length); // SDL_imageFilterMultDivby2: D = saturation255(S1/2 * S2) SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterMultDivby2(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length); // SDL_imageFilterMultDivby4: D = saturation255(S1/2 * S2/2) SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterMultDivby4(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length); // SDL_imageFilterBitAnd: D = S1 & S2 SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterBitAnd(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length); // SDL_imageFilterBitOr: D = S1 | S2 SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterBitOr(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length); // SDL_imageFilterDiv: D = S1 / S2 (non-MMX) SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterDiv(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length); // SDL_imageFilterBitNegation: D = !S SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterBitNegation(unsigned char *Src1, unsigned char *Dest, unsigned int length); // SDL_imageFilterAddByte: D = saturation255(S + C) SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterAddByte(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char C); // SDL_imageFilterAddUint: D = saturation255(S + (uint)C) SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterAddUint(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned int C); // SDL_imageFilterAddByteToHalf: D = saturation255(S/2 + C) SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterAddByteToHalf(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char C); // SDL_imageFilterSubByte: D = saturation0(S - C) SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterSubByte(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char C); // SDL_imageFilterSubUint: D = saturation0(S - (uint)C) SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterSubUint(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned int C); // SDL_imageFilterShiftRight: D = saturation0(S >> N) SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterShiftRight(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char N); // SDL_imageFilterShiftRightUint: D = saturation0((uint)S >> N) SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterShiftRightUint(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char N); // SDL_imageFilterMultByByte: D = saturation255(S * C) SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterMultByByte(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char C); // SDL_imageFilterShiftRightAndMultByByte: D = saturation255((S >> N) * C) SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterShiftRightAndMultByByte(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char N, unsigned char C); // SDL_imageFilterShiftLeftByte: D = (S << N) SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterShiftLeftByte(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char N); // SDL_imageFilterShiftLeftUint: D = ((uint)S << N) SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterShiftLeftUint(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char N); // SDL_imageFilterShiftLeft: D = saturation255(S << N) SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterShiftLeft(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char N); // SDL_imageFilterBinarizeUsingThreshold: D = S >= T ? 255:0 SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterBinarizeUsingThreshold(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char T); // SDL_imageFilterClipToRange: D = (S >= Tmin) & (S <= Tmax) 255:0 SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterClipToRange(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char Tmin, unsigned char Tmax); // SDL_imageFilterNormalizeLinear: D = saturation255((Nmax - Nmin)/(Cmax - Cmin)*(S - Cmin) + Nmin) SDL2_IMAGEFILTER_SCOPE int SDL_imageFilterNormalizeLinear(unsigned char *Src, unsigned char *Dest, unsigned int length, int Cmin, int Cmax, int Nmin, int Nmax); /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif # 165 "./SDL2_imageFilter.h" #endif /* _SDL_imageFilter_h */ # 167 "./SDL2_imageFilter.h" # 57 "SDL2_imageFilter.c" 2 /*! \brief Swaps the byte order in a 32bit integer (LSB becomes MSB, etc.). */ #define SWAP_32(x) (((x) >> 24) | (((x) & 0x00ff0000) >> 8) | (((x) & 0x0000ff00) << 8) | ((x) << 24)) /* ------ Static variables ----- */ /*! \brief Static state which enables the use of the MMX routines. Enabled by default */ static int SDL_imageFilterUseMMX = 1; /* Detect GCC */ #if defined(__GNUC__) #define GCC__ #endif # 74 "SDL2_imageFilter.c" /*! \brief MMX detection routine (with override flag). \returns 1 of MMX was detected, 0 otherwise. */ int SDL_imageFilterMMXdetect(void) { /* Check override flag */ if (SDL_imageFilterUseMMX == 0) { return (0); } return SDL_HasMMX(); } /*! \brief Disable MMX check for filter functions and and force to use non-MMX C based code. */ void SDL_imageFilterMMXoff() { SDL_imageFilterUseMMX = 0; } /*! \brief Enable MMX check for filter functions and use MMX code if available. */ void SDL_imageFilterMMXon() { SDL_imageFilterUseMMX = 1; } /* ------------------------------------------------------------------------------------ */ /*! \brief Internal MMX Filter using Add: D = saturation255(S1 + S2) \param Src1 Pointer to the start of the first source byte array (S1). \param Src2 Pointer to the start of the second source byte array (S2). \param Dest Pointer to the start of the destination byte array (D). \param SrcLength The number of bytes in the source arrays. \return Returns 0 for success or -1 for error. */ static int SDL_imageFilterAddMMX(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int SrcLength) { #ifdef USE_MMX #if !defined(GCC__) __asm { pusha mov eax, Src1 /* load Src1 address into eax */ mov ebx, Src2 /* load Src2 address into ebx */ mov edi, Dest /* load Dest address into edi */ mov ecx, SrcLength /* load loop counter (SIZE) into ecx */ shr ecx, 3 /* counter/8 (MMX loads 8 bytes at a time) */ align 16 /* 16 byte alignment of the loop entry */ L1010: movq mm1, [eax] /* load 8 bytes from Src1 into mm1 */ paddusb mm1, [ebx] /* mm1=Src1+Src2 (add 8 bytes with saturation) */ movq [edi], mm1 /* store result in Dest */ add eax, 8 /* increase Src1, Src2 and Dest */ add ebx, 8 /* register pointers by 8 */ add edi, 8 dec ecx /* decrease loop counter */ jnz L1010 /* check loop termination, proceed if required */ emms /* exit MMX state */ popa } #else # 144 "SDL2_imageFilter.c" /* i386 and x86_64 */ __m64 *mSrc1 = (__m64*)Src1; __m64 *mSrc2 = (__m64*)Src2; __m64 *mDest = (__m64*)Dest; int i; for (i = 0; i < SrcLength/8; i++) { *mDest = _m_paddusb(*mSrc1, *mSrc2); /* Src1+Src2 (add 8 bytes with saturation) */ mSrc1++; mSrc2++; mDest++; } _m_empty(); /* clean MMX state */ #endif # 157 "SDL2_imageFilter.c" return (0); #else # 159 "SDL2_imageFilter.c" return (-1); #endif # 161 "SDL2_imageFilter.c" } /*! \brief Filter using Add: D = saturation255(S1 + S2) \param Src1 Pointer to the start of the first source byte array (S1). \param Src2 Pointer to the start of the second source byte array (S2). \param Dest Pointer to the start of the destination byte array (D). \param length The number of bytes in the source arrays. \return Returns 0 for success or -1 for error. */ int SDL_imageFilterAdd(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length) { unsigned int i, istart; unsigned char *cursrc1, *cursrc2, *curdst; int result; /* Validate input parameters */ if ((Src1 == NULL) || (Src2 == NULL) || (Dest == NULL)) return(-1); if (length == 0) return(0); if ((SDL_imageFilterMMXdetect()) && (length > 7)) { /* Use MMX assembly routine */ SDL_imageFilterAddMMX(Src1, Src2, Dest, length); /* Check for unaligned bytes */ if ((length & 7) > 0) { /* Setup to process unaligned bytes */ istart = length & 0xfffffff8; cursrc1 = &Src1[istart]; cursrc2 = &Src2[istart]; curdst = &Dest[istart]; } else { /* No unaligned bytes - we are done */ return (0); } } else { /* Setup to process whole image */ istart = 0; cursrc1 = Src1; cursrc2 = Src2; curdst = Dest; } /* C routine to process image */ for (i = istart; i < length; i++) { result = (int) *cursrc1 + (int) *cursrc2; if (result > 255) result = 255; *curdst = (unsigned char) result; /* Advance pointers */ cursrc1++; cursrc2++; curdst++; } return (0); } /*! \brief Internal MMX Filter using Mean: D = S1/2 + S2/2 \param Src1 Pointer to the start of the first source byte array (S1). \param Src2 Pointer to the start of the second source byte array (S2). \param Dest Pointer to the start of the destination byte array (D). \param SrcLength The number of bytes in the source arrays. \param Mask Mask array containing 8 bytes with 0x7F value. ] \return Returns 0 for success or -1 for error. */ static int SDL_imageFilterMeanMMX(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int SrcLength, unsigned char *Mask) { #ifdef USE_MMX #if !defined(GCC__) __asm { pusha mov edx, Mask /* load Mask address into edx */ movq mm0, [edx] /* load Mask into mm0 */ mov eax, Src1 /* load Src1 address into eax */ mov ebx, Src2 /* load Src2 address into ebx */ mov edi, Dest /* load Dest address into edi */ mov ecx, SrcLength /* load loop counter (SIZE) into ecx */ shr ecx, 3 /* counter/8 (MMX loads 8 bytes at a time) */ align 16 /* 16 byte alignment of the loop entry */ L21011: movq mm1, [eax] /* load 8 bytes from Src1 into mm1 */ movq mm2, [ebx] /* load 8 bytes from Src2 into mm2 */ /* --- Byte shift via Word shift --- */ psrlw mm1, 1 /* shift 4 WORDS of mm1 1 bit to the right */ psrlw mm2, 1 /* shift 4 WORDS of mm2 1 bit to the right */ pand mm1, mm0 // apply Mask to 8 BYTES of mm1 */ /* byte 0x0f, 0xdb, 0xc8 */ pand mm2, mm0 // apply Mask to 8 BYTES of mm2 */ /* byte 0x0f, 0xdb, 0xd0 */ paddusb mm1, mm2 /* mm1=mm1+mm2 (add 8 bytes with saturation) */ movq [edi], mm1 /* store result in Dest */ add eax, 8 /* increase Src1, Src2 and Dest */ add ebx, 8 /* register pointers by 8 */ add edi, 8 dec ecx /* decrease loop counter */ jnz L21011 /* check loop termination, proceed if required */ emms /* exit MMX state */ popa } #else # 272 "SDL2_imageFilter.c" /* i386 and x86_64 */ __m64 *mSrc1 = (__m64*)Src1; __m64 *mSrc2 = (__m64*)Src2; __m64 *mDest = (__m64*)Dest; __m64 *mMask = (__m64*)Mask; int i; for (i = 0; i < SrcLength/8; i++) { __m64 mm1 = *mSrc1, mm2 = *mSrc2; mm1 = _m_psrlwi(mm1, 1); /* shift 4 WORDS of mm1 1 bit to the right */ mm2 = _m_psrlwi(mm2, 1); /* shift 4 WORDS of mm2 1 bit to the right */ mm1 = _m_pand(mm1, *mMask); /* apply Mask to 8 BYTES of mm1 */ mm2 = _m_pand(mm2, *mMask); /* apply Mask to 8 BYTES of mm2 */ *mDest = _m_paddusb(mm1, mm2); /* mm1+mm2 (add 8 bytes with saturation) */ mSrc1++; mSrc2++; mDest++; } _m_empty(); /* clean MMX state */ #endif # 292 "SDL2_imageFilter.c" return (0); #else # 294 "SDL2_imageFilter.c" return (-1); #endif # 296 "SDL2_imageFilter.c" } /*! \brief Filter using Mean: D = S1/2 + S2/2 \param Src1 Pointer to the start of the first source byte array (S1). \param Src2 Pointer to the start of the second source byte array (S2). \param Dest Pointer to the start of the destination byte array (D). \param length The number of bytes in the source arrays. \return Returns 0 for success or -1 for error. */ int SDL_imageFilterMean(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length) { static unsigned char Mask[8] = { 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F }; unsigned int i, istart; unsigned char *cursrc1, *cursrc2, *curdst; int result; /* Validate input parameters */ if ((Src1 == NULL) || (Src2 == NULL) || (Dest == NULL)) return(-1); if (length == 0) return(0); if ((SDL_imageFilterMMXdetect()) && (length > 7)) { /* MMX routine */ SDL_imageFilterMeanMMX(Src1, Src2, Dest, length, Mask); /* Check for unaligned bytes */ if ((length & 7) > 0) { /* Setup to process unaligned bytes */ istart = length & 0xfffffff8; cursrc1 = &Src1[istart]; cursrc2 = &Src2[istart]; curdst = &Dest[istart]; } else { /* No unaligned bytes - we are done */ return (0); } } else { /* Setup to process whole image */ istart = 0; cursrc1 = Src1; cursrc2 = Src2; curdst = Dest; } /* C routine to process image */ for (i = istart; i < length; i++) { result = (int) *cursrc1 / 2 + (int) *cursrc2 / 2; *curdst = (unsigned char) result; /* Advance pointers */ cursrc1++; cursrc2++; curdst++; } return (0); } /*! \brief Internal MMX Filter using Sub: D = saturation0(S1 - S2) \param Src1 Pointer to the start of the first source byte array (S1). \param Src2 Pointer to the start of the second source byte array (S2). \param Dest Pointer to the start of the destination byte array (D). \param SrcLength The number of bytes in the source arrays. \return Returns 0 for success or -1 for error. */ static int SDL_imageFilterSubMMX(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int SrcLength) { #ifdef USE_MMX #if !defined(GCC__) __asm { pusha mov eax, Src1 /* load Src1 address into eax */ mov ebx, Src2 /* load Src2 address into ebx */ mov edi, Dest /* load Dest address into edi */ mov ecx, SrcLength /* load loop counter (SIZE) into ecx */ shr ecx, 3 /* counter/8 (MMX loads 8 bytes at a time) */ align 16 /* 16 byte alignment of the loop entry */ L1012: movq mm1, [eax] /* load 8 bytes from Src1 into mm1 */ psubusb mm1, [ebx] /* mm1=Src1-Src2 (sub 8 bytes with saturation) */ movq [edi], mm1 /* store result in Dest */ add eax, 8 /* increase Src1, Src2 and Dest */ add ebx, 8 /* register pointers by 8 */ add edi, 8 dec ecx /* decrease loop counter */ jnz L1012 /* check loop termination, proceed if required */ emms /* exit MMX state */ popa } #else # 393 "SDL2_imageFilter.c" /* i386 and x86_64 */ __m64 *mSrc1 = (__m64*)Src1; __m64 *mSrc2 = (__m64*)Src2; __m64 *mDest = (__m64*)Dest; int i; for (i = 0; i < SrcLength/8; i++) { *mDest = _m_psubusb(*mSrc1, *mSrc2); /* Src1-Src2 (sub 8 bytes with saturation) */ mSrc1++; mSrc2++; mDest++; } _m_empty(); /* clean MMX state */ #endif # 406 "SDL2_imageFilter.c" return (0); #else # 408 "SDL2_imageFilter.c" return (-1); #endif # 410 "SDL2_imageFilter.c" } /*! \brief Filter using Sub: D = saturation0(S1 - S2) \param Src1 Pointer to the start of the first source byte array (S1). \param Src2 Pointer to the start of the second source byte array (S2). \param Dest Pointer to the start of the destination byte array (D). \param length The number of bytes in the source arrays. \return Returns 0 for success or -1 for error. */ int SDL_imageFilterSub(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length) { unsigned int i, istart; unsigned char *cursrc1, *cursrc2, *curdst; int result; /* Validate input parameters */ if ((Src1 == NULL) || (Src2 == NULL) || (Dest == NULL)) return(-1); if (length == 0) return(0); if ((SDL_imageFilterMMXdetect()) && (length > 7)) { /* MMX routine */ SDL_imageFilterSubMMX(Src1, Src2, Dest, length); /* Check for unaligned bytes */ if ((length & 7) > 0) { /* Setup to process unaligned bytes */ istart = length & 0xfffffff8; cursrc1 = &Src1[istart]; cursrc2 = &Src2[istart]; curdst = &Dest[istart]; } else { /* No unaligned bytes - we are done */ return (0); } } else { /* Setup to process whole image */ istart = 0; cursrc1 = Src1; cursrc2 = Src2; curdst = Dest; } /* C routine to process image */ for (i = istart; i < length; i++) { result = (int) *cursrc1 - (int) *cursrc2; if (result < 0) result = 0; *curdst = (unsigned char) result; /* Advance pointers */ cursrc1++; cursrc2++; curdst++; } return (0); } /*! \brief Internal MMX Filter using AbsDiff: D = | S1 - S2 | \param Src1 Pointer to the start of the first source byte array (S1). \param Src2 Pointer to the start of the second source byte array (S2). \param Dest Pointer to the start of the destination byte array (D). \param SrcLength The number of bytes in the source arrays. \return Returns 0 for success or -1 for error. */ static int SDL_imageFilterAbsDiffMMX(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int SrcLength) { #ifdef USE_MMX #if !defined(GCC__) __asm { pusha mov eax, Src1 /* load Src1 address into eax */ mov ebx, Src2 /* load Src2 address into ebx */ mov edi, Dest /* load Dest address into edi */ mov ecx, SrcLength /* load loop counter (SIZE) into ecx */ shr ecx, 3 /* counter/8 (MMX loads 8 bytes at a time) */ align 16 /* 16 byte alignment of the loop entry */ L1013: movq mm1, [eax] /* load 8 bytes from Src1 into mm1 */ movq mm2, [ebx] /* load 8 bytes from Src2 into mm2 */ psubusb mm1, [ebx] /* mm1=Src1-Src2 (sub 8 bytes with saturation) */ psubusb mm2, [eax] /* mm2=Src2-Src1 (sub 8 bytes with saturation) */ por mm1, mm2 /* combine both mm2 and mm1 results */ movq [edi], mm1 /* store result in Dest */ add eax, 8 /* increase Src1, Src2 and Dest */ add ebx, 8 /* register pointers by 8 */ add edi, 8 dec ecx /* decrease loop counter */ jnz L1013 /* check loop termination, proceed if required */ emms /* exit MMX state */ popa } #else # 511 "SDL2_imageFilter.c" /* i386 and x86_64 */ __m64 *mSrc1 = (__m64*)Src1; __m64 *mSrc2 = (__m64*)Src2; __m64 *mDest = (__m64*)Dest; int i; for (i = 0; i < SrcLength/8; i++) { __m64 mm1 = _m_psubusb(*mSrc2, *mSrc1); /* Src1-Src2 (sub 8 bytes with saturation) */ __m64 mm2 = _m_psubusb(*mSrc1, *mSrc2); /* Src2-Src1 (sub 8 bytes with saturation) */ *mDest = _m_por(mm1, mm2); /* combine both mm2 and mm1 results */ mSrc1++; mSrc2++; mDest++; } _m_empty(); /* clean MMX state */ #endif # 526 "SDL2_imageFilter.c" return (0); #else # 528 "SDL2_imageFilter.c" return (-1); #endif # 530 "SDL2_imageFilter.c" } /*! \brief Filter using AbsDiff: D = | S1 - S2 | \param Src1 Pointer to the start of the first source byte array (S1). \param Src2 Pointer to the start of the second source byte array (S2). \param Dest Pointer to the start of the destination byte array (D). \param length The number of bytes in the source arrays. \return Returns 0 for success or -1 for error. */ int SDL_imageFilterAbsDiff(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length) { unsigned int i, istart; unsigned char *cursrc1, *cursrc2, *curdst; int result; /* Validate input parameters */ if ((Src1 == NULL) || (Src2 == NULL) || (Dest == NULL)) return(-1); if (length == 0) return(0); if ((SDL_imageFilterMMXdetect()) && (length > 7)) { /* MMX routine */ SDL_imageFilterAbsDiffMMX(Src1, Src2, Dest, length); /* Check for unaligned bytes */ if ((length & 7) > 0) { /* Setup to process unaligned bytes */ istart = length & 0xfffffff8; cursrc1 = &Src1[istart]; cursrc2 = &Src2[istart]; curdst = &Dest[istart]; } else { /* No unaligned bytes - we are done */ return (0); } } else { /* Setup to process whole image */ istart = 0; cursrc1 = Src1; cursrc2 = Src2; curdst = Dest; } /* C routine to process image */ for (i = istart; i < length; i++) { result = abs((int) *cursrc1 - (int) *cursrc2); *curdst = (unsigned char) result; /* Advance pointers */ cursrc1++; cursrc2++; curdst++; } return (0); } /*! \brief Internal MMX Filter using Mult: D = saturation255(S1 * S2) \param Src1 Pointer to the start of the first source byte array (S1). \param Src2 Pointer to the start of the second source byte array (S2). \param Dest Pointer to the start of the destination byte array (D). \param SrcLength The number of bytes in the source arrays. \return Returns 0 for success or -1 for error. */ static int SDL_imageFilterMultMMX(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int SrcLength) { #ifdef USE_MMX #if !defined(GCC__) __asm { pusha mov eax, Src1 /* load Src1 address into eax */ mov ebx, Src2 /* load Src2 address into ebx */ mov edi, Dest /* load Dest address into edi */ mov ecx, SrcLength /* load loop counter (SIZE) into ecx */ shr ecx, 3 /* counter/8 (MMX loads 8 bytes at a time) */ pxor mm0, mm0 /* zero mm0 register */ align 16 /* 16 byte alignment of the loop entry */ L1014: movq mm1, [eax] /* load 8 bytes from Src1 into mm1 */ movq mm3, [ebx] /* load 8 bytes from Src2 into mm3 */ movq mm2, mm1 /* copy mm1 into mm2 */ movq mm4, mm3 /* copy mm3 into mm4 */ punpcklbw mm1, mm0 /* unpack low bytes of Src1 into words */ punpckhbw mm2, mm0 /* unpack high bytes of Src1 into words */ punpcklbw mm3, mm0 /* unpack low bytes of Src2 into words */ punpckhbw mm4, mm0 /* unpack high bytes of Src2 into words */ pmullw mm1, mm3 /* mul low bytes of Src1 and Src2 */ pmullw mm2, mm4 /* mul high bytes of Src1 and Src2 */ /* Take abs value of the results (signed words) */ movq mm5, mm1 /* copy mm1 into mm5 */ movq mm6, mm2 /* copy mm2 into mm6 */ psraw mm5, 15 /* fill mm5 words with word sign bit */ psraw mm6, 15 /* fill mm6 words with word sign bit */ pxor mm1, mm5 /* take 1's compliment of only neg. words */ pxor mm2, mm6 /* take 1's compliment of only neg. words */ psubsw mm1, mm5 /* add 1 to only neg. words, W-(-1) or W-0 */ psubsw mm2, mm6 /* add 1 to only neg. words, W-(-1) or W-0 */ packuswb mm1, mm2 /* pack words back into bytes with saturation */ movq [edi], mm1 /* store result in Dest */ add eax, 8 /* increase Src1, Src2 and Dest */ add ebx, 8 /* register pointers by 8 */ add edi, 8 dec ecx /* decrease loop counter */ jnz L1014 /* check loop termination, proceed if required */ emms /* exit MMX state */ popa } #else # 645 "SDL2_imageFilter.c" /* i386 ASM with constraints: */ /* asm volatile ( */ /* "shr $3, %%ecx \n\t" /\* counter/8 (MMX loads 8 bytes at a time) *\/ */ /* "pxor %%mm0, %%mm0 \n\t" /\* zero mm0 register *\/ */ /* ".align 16 \n\t" /\* 16 byte alignment of the loop entry *\/ */ /* "1: movq (%%eax), %%mm1 \n\t" /\* load 8 bytes from Src1 into mm1 *\/ */ /* "movq (%%ebx), %%mm3 \n\t" /\* load 8 bytes from Src2 into mm3 *\/ */ /* "movq %%mm1, %%mm2 \n\t" /\* copy mm1 into mm2 *\/ */ /* "movq %%mm3, %%mm4 \n\t" /\* copy mm3 into mm4 *\/ */ /* "punpcklbw %%mm0, %%mm1 \n\t" /\* unpack low bytes of Src1 into words *\/ */ /* "punpckhbw %%mm0, %%mm2 \n\t" /\* unpack high bytes of Src1 into words *\/ */ /* "punpcklbw %%mm0, %%mm3 \n\t" /\* unpack low bytes of Src2 into words *\/ */ /* "punpckhbw %%mm0, %%mm4 \n\t" /\* unpack high bytes of Src2 into words *\/ */ /* "pmullw %%mm3, %%mm1 \n\t" /\* mul low bytes of Src1 and Src2 *\/ */ /* "pmullw %%mm4, %%mm2 \n\t" /\* mul high bytes of Src1 and Src2 *\/ */ /* /\* Take abs value of the results (signed words) *\/ */ /* "movq %%mm1, %%mm5 \n\t" /\* copy mm1 into mm5 *\/ */ /* "movq %%mm2, %%mm6 \n\t" /\* copy mm2 into mm6 *\/ */ /* "psraw $15, %%mm5 \n\t" /\* fill mm5 words with word sign bit *\/ */ /* "psraw $15, %%mm6 \n\t" /\* fill mm6 words with word sign bit *\/ */ /* "pxor %%mm5, %%mm1 \n\t" /\* take 1's compliment of only neg. words *\/ */ /* "pxor %%mm6, %%mm2 \n\t" /\* take 1's compliment of only neg. words *\/ */ /* "psubsw %%mm5, %%mm1 \n\t" /\* add 1 to only neg. words, W-(-1) or W-0 *\/ */ /* "psubsw %%mm6, %%mm2 \n\t" /\* add 1 to only neg. words, W-(-1) or W-0 *\/ */ /* "packuswb %%mm2, %%mm1 \n\t" /\* pack words back into bytes with saturation *\/ */ /* "movq %%mm1, (%%edi) \n\t" /\* store result in Dest *\/ */ /* "add $8, %%eax \n\t" /\* increase Src1, Src2 and Dest *\/ */ /* "add $8, %%ebx \n\t" /\* register pointers by 8 *\/ */ /* "add $8, %%edi \n\t" */ /* "dec %%ecx \n\t" /\* decrease loop counter *\/ */ /* "jnz 1b \n\t" /\* check loop termination, proceed if required *\/ */ /* "emms \n\t" /\* exit MMX state *\/ */ /* : "+a" (Src1), /\* load Src1 address into rax, modified by the loop *\/ */ /* "+b" (Src2), /\* load Src2 address into rbx, modified by the loop *\/ */ /* "+c" (SrcLength), /\* load loop counter (SIZE) into rcx, modified by the loop *\/ */ /* "+D" (Dest) /\* load Dest address into rdi, modified by the loop *\/ */ /* : */ /* : "memory", /\* *Dest is modified *\/ */ /* "mm0","mm1","mm2","mm3","mm4","mm5","mm6" /\* registers modified *\/ */ /* ); */ /* i386 and x86_64 */ __m64 *mSrc1 = (__m64*)Src1; __m64 *mSrc2 = (__m64*)Src2; __m64 *mDest = (__m64*)Dest; __m64 mm0 = _m_from_int(0); /* zero mm0 register */ int i; for (i = 0; i < SrcLength/8; i++) { __m64 mm1, mm2, mm3, mm4, mm5, mm6; mm1 = _m_punpcklbw(*mSrc1, mm0); /* unpack low bytes of Src1 into words */ mm2 = _m_punpckhbw(*mSrc1, mm0); /* unpack high bytes of Src1 into words */ mm3 = _m_punpcklbw(*mSrc2, mm0); /* unpack low bytes of Src2 into words */ mm4 = _m_punpckhbw(*mSrc2, mm0); /* unpack high bytes of Src2 into words */ mm1 = _m_pmullw(mm1, mm3); /* mul low bytes of Src1 and Src2 */ mm2 = _m_pmullw(mm2, mm4); /* mul high bytes of Src1 and Src2 */ mm5 = _m_psrawi(mm1, 15); /* fill mm5 words with word sign bit */ mm6 = _m_psrawi(mm2, 15); /* fill mm6 words with word sign bit */ mm1 = _m_pxor(mm1, mm5); /* take 1's compliment of only neg. words */ mm2 = _m_pxor(mm2, mm6); /* take 1's compliment of only neg. words */ mm1 = _m_psubsw(mm1, mm5); /* add 1 to only neg. words, W-(-1) or W-0 */ mm2 = _m_psubsw(mm2, mm6); /* add 1 to only neg. words, W-(-1) or W-0 */ *mDest = _m_packuswb(mm1, mm2); /* pack words back into bytes with saturation */ mSrc1++; mSrc2++; mDest++; } _m_empty(); /* clean MMX state */ #endif # 713 "SDL2_imageFilter.c" return (0); #else # 715 "SDL2_imageFilter.c" return (-1); #endif # 717 "SDL2_imageFilter.c" } /*! \brief Filter using Mult: D = saturation255(S1 * S2) \param Src1 Pointer to the start of the first source byte array (S1). \param Src2 Pointer to the start of the second source byte array (S2). \param Dest Pointer to the start of the destination byte array (D). \param length The number of bytes in the source arrays. \return Returns 0 for success or -1 for error. */ int SDL_imageFilterMult(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length) { unsigned int i, istart; unsigned char *cursrc1, *cursrc2, *curdst; int result; /* Validate input parameters */ if ((Src1 == NULL) || (Src2 == NULL) || (Dest == NULL)) return(-1); if (length == 0) return(0); if ((SDL_imageFilterMMXdetect()) && (length > 7)) { /* MMX routine */ SDL_imageFilterMultMMX(Src1, Src2, Dest, length); /* Check for unaligned bytes */ if ((length & 7) > 0) { /* Setup to process unaligned bytes */ istart = length & 0xfffffff8; cursrc1 = &Src1[istart]; cursrc2 = &Src2[istart]; curdst = &Dest[istart]; } else { /* No unaligned bytes - we are done */ return (0); } } else { /* Setup to process whole image */ istart = 0; cursrc1 = Src1; cursrc2 = Src2; curdst = Dest; } /* C routine to process image */ for (i = istart; i < length; i++) { /* NOTE: this is probably wrong - dunno what the MMX code does */ result = (int) *cursrc1 * (int) *cursrc2; if (result > 255) result = 255; *curdst = (unsigned char) result; /* Advance pointers */ cursrc1++; cursrc2++; curdst++; } return (0); } /*! \brief Internal ASM Filter using MultNor: D = S1 * S2 \param Src1 Pointer to the start of the first source byte array (S1). \param Src2 Pointer to the start of the second source byte array (S2). \param Dest Pointer to the start of the destination byte array (D). \param SrcLength The number of bytes in the source arrays. \return Returns 0 for success or -1 for error. */ int SDL_imageFilterMultNorASM(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int SrcLength) { #ifdef USE_MMX #if !defined(GCC__) __asm { pusha mov edx, Src1 /* load Src1 address into edx */ mov esi, Src2 /* load Src2 address into esi */ mov edi, Dest /* load Dest address into edi */ mov ecx, SrcLength /* load loop counter (SIZE) into ecx */ align 16 /* 16 byte alignment of the loop entry */ L10141: mov al, [edx] /* load a byte from Src1 */ mul [esi] /* mul with a byte from Src2 */ mov [edi], al /* move a byte result to Dest */ inc edx /* increment Src1, Src2, Dest */ inc esi /* pointer registers by one */ inc edi dec ecx /* decrease loop counter */ jnz L10141 /* check loop termination, proceed if required */ popa } #else # 816 "SDL2_imageFilter.c" /* Note: ~5% gain on i386, less efficient than C on x86_64 */ /* Also depends on whether this function is static (?!) */ asm volatile ( ".align 16 \n\t" /* 16 byte alignment of the loop entry */ # if defined(i386) "1:mov (%%edx), %%al \n\t" /* load a byte from Src1 */ "mulb (%%esi) \n\t" /* mul with a byte from Src2 */ "mov %%al, (%%edi) \n\t" /* move a byte result to Dest */ "inc %%edx \n\t" /* increment Src1, Src2, Dest */ "inc %%esi \n\t" /* pointer registers by one */ "inc %%edi \n\t" "dec %%ecx \n\t" /* decrease loop counter */ # elif defined(__x86_64__) # 829 "SDL2_imageFilter.c" "1:mov (%%rdx), %%al \n\t" /* load a byte from Src1 */ "mulb (%%rsi) \n\t" /* mul with a byte from Src2 */ "mov %%al, (%%rdi) \n\t" /* move a byte result to Dest */ "inc %%rdx \n\t" /* increment Src1, Src2, Dest */ "inc %%rsi \n\t" /* pointer registers by one */ "inc %%rdi \n\t" "dec %%rcx \n\t" /* decrease loop counter */ # endif # 837 "SDL2_imageFilter.c" "jnz 1b \n\t" /* check loop termination, proceed if required */ : "+d" (Src1), /* load Src1 address into edx */ "+S" (Src2), /* load Src2 address into esi */ "+c" (SrcLength), /* load loop counter (SIZE) into ecx */ "+D" (Dest) /* load Dest address into edi */ : : "memory", "rax" ); #endif # 846 "SDL2_imageFilter.c" return (0); #else # 848 "SDL2_imageFilter.c" return (-1); #endif # 850 "SDL2_imageFilter.c" } /*! \brief Filter using MultNor: D = S1 * S2 \param Src1 Pointer to the start of the first source byte array (S1). \param Src2 Pointer to the start of the second source byte array (S2). \param Dest Pointer to the start of the destination byte array (D). \param length The number of bytes in the source arrays. \return Returns 0 for success or -1 for error. */ int SDL_imageFilterMultNor(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length) { unsigned int i, istart; unsigned char *cursrc1, *cursrc2, *curdst; /* Validate input parameters */ if ((Src1 == NULL) || (Src2 == NULL) || (Dest == NULL)) return(-1); if (length == 0) return(0); if (SDL_imageFilterMMXdetect()) { if (length > 0) { /* ASM routine */ SDL_imageFilterMultNorASM(Src1, Src2, Dest, length); /* Check for unaligned bytes */ if ((length & 7) > 0) { /* Setup to process unaligned bytes */ istart = length & 0xfffffff8; cursrc1 = &Src1[istart]; cursrc2 = &Src2[istart]; curdst = &Dest[istart]; } else { /* No unaligned bytes - we are done */ return (0); } } else { /* No bytes - we are done */ return (0); } } else { /* Setup to process whole image */ istart = 0; cursrc1 = Src1; cursrc2 = Src2; curdst = Dest; } /* C routine to process image */ for (i = istart; i < length; i++) { *curdst = (int)*cursrc1 * (int)*cursrc2; // (int) for efficiency /* Advance pointers */ cursrc1++; cursrc2++; curdst++; } return (0); } /*! \brief Internal MMX Filter using MultDivby2: D = saturation255(S1/2 * S2) \param Src1 Pointer to the start of the first source byte array (S1). \param Src2 Pointer to the start of the second source byte array (S2). \param Dest Pointer to the start of the destination byte array (D). \param SrcLength The number of bytes in the source arrays. \return Returns 0 for success or -1 for error. */ static int SDL_imageFilterMultDivby2MMX(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int SrcLength) { #ifdef USE_MMX #if !defined(GCC__) __asm { pusha mov eax, Src1 /* load Src1 address into eax */ mov ebx, Src2 /* load Src2 address into ebx */ mov edi, Dest /* load Dest address into edi */ mov ecx, SrcLength /* load loop counter (SIZE) into ecx */ shr ecx, 3 /* counter/8 (MMX loads 8 bytes at a time) */ pxor mm0, mm0 /* zero mm0 register */ align 16 /* 16 byte alignment of the loop entry */ L1015: movq mm1, [eax] /* load 8 bytes from Src1 into mm1 */ movq mm3, [ebx] /* load 8 bytes from Src2 into mm3 */ movq mm2, mm1 /* copy mm1 into mm2 */ movq mm4, mm3 /* copy mm3 into mm4 */ punpcklbw mm1, mm0 /* unpack low bytes of Src1 into words */ punpckhbw mm2, mm0 /* unpack high bytes of Src1 into words */ punpcklbw mm3, mm0 /* unpack low bytes of Src2 into words */ punpckhbw mm4, mm0 /* unpack high bytes of Src2 into words */ psrlw mm1, 1 /* divide mm1 words by 2, Src1 low bytes */ psrlw mm2, 1 /* divide mm2 words by 2, Src1 high bytes */ pmullw mm1, mm3 /* mul low bytes of Src1 and Src2 */ pmullw mm2, mm4 /* mul high bytes of Src1 and Src2 */ packuswb mm1, mm2 /* pack words back into bytes with saturation */ movq [edi], mm1 /* store result in Dest */ add eax, 8 /* increase Src1, Src2 and Dest */ add ebx, 8 /* register pointers by 8 */ add edi, 8 dec ecx /* decrease loop counter */ jnz L1015 /* check loop termination, proceed if required */ emms /* exit MMX state */ popa } #else # 961 "SDL2_imageFilter.c" /* i386 and x86_64 */ __m64 *mSrc1 = (__m64*)Src1; __m64 *mSrc2 = (__m64*)Src2; __m64 *mDest = (__m64*)Dest; __m64 mm0 = _m_from_int(0); /* zero mm0 register */ int i; for (i = 0; i < SrcLength/8; i++) { __m64 mm1, mm2, mm3, mm4, mm5, mm6; mm1 = _m_punpcklbw(*mSrc1, mm0); /* unpack low bytes of Src1 into words */ mm2 = _m_punpckhbw(*mSrc1, mm0); /* unpack high bytes of Src1 into words */ mm3 = _m_punpcklbw(*mSrc2, mm0); /* unpack low bytes of Src2 into words */ mm4 = _m_punpckhbw(*mSrc2, mm0); /* unpack high bytes of Src2 into words */ mm1 = _m_psrlwi(mm1, 1); /* divide mm1 words by 2, Src1 low bytes */ mm2 = _m_psrlwi(mm2, 1); /* divide mm2 words by 2, Src1 high bytes */ mm1 = _m_pmullw(mm1, mm3); /* mul low bytes of Src1 and Src2 */ mm2 = _m_pmullw(mm2, mm4); /* mul high bytes of Src1 and Src2 */ *mDest = _m_packuswb(mm1, mm2); /* pack words back into bytes with saturation */ mSrc1++; mSrc2++; mDest++; } _m_empty(); /* clean MMX state */ #endif # 984 "SDL2_imageFilter.c" return (0); #else # 986 "SDL2_imageFilter.c" return (-1); #endif # 988 "SDL2_imageFilter.c" } /*! \brief Filter using MultDivby2: D = saturation255(S1/2 * S2) \param Src1 Pointer to the start of the first source byte array (S1). \param Src2 Pointer to the start of the second source byte array (S2). \param Dest Pointer to the start of the destination byte array (D). \param length The number of bytes in the source arrays. \return Returns 0 for success or -1 for error. */ int SDL_imageFilterMultDivby2(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length) { unsigned int i, istart; unsigned char *cursrc1, *cursrc2, *curdst; int result; /* Validate input parameters */ if ((Src1 == NULL) || (Src2 == NULL) || (Dest == NULL)) return(-1); if (length == 0) return(0); if ((SDL_imageFilterMMXdetect()) && (length > 7)) { /* MMX routine */ SDL_imageFilterMultDivby2MMX(Src1, Src2, Dest, length); /* Check for unaligned bytes */ if ((length & 7) > 0) { /* Setup to process unaligned bytes */ istart = length & 0xfffffff8; cursrc1 = &Src1[istart]; cursrc2 = &Src2[istart]; curdst = &Dest[istart]; } else { /* No unaligned bytes - we are done */ return (0); } } else { /* Setup to process whole image */ istart = 0; cursrc1 = Src1; cursrc2 = Src2; curdst = Dest; } /* C routine to process image */ for (i = istart; i < length; i++) { result = ((int) *cursrc1 / 2) * (int) *cursrc2; if (result > 255) result = 255; *curdst = (unsigned char) result; /* Advance pointers */ cursrc1++; cursrc2++; curdst++; } return (0); } /*! \brief Internal MMX Filter using MultDivby4: D = saturation255(S1/2 * S2/2) \param Src1 Pointer to the start of the first source byte array (S1). \param Src2 Pointer to the start of the second source byte array (S2). \param Dest Pointer to the start of the destination byte array (D). \param SrcLength The number of bytes in the source arrays. \return Returns 0 for success or -1 for error. */ static int SDL_imageFilterMultDivby4MMX(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int SrcLength) { #ifdef USE_MMX #if !defined(GCC__) __asm { pusha mov eax, Src1 /* load Src1 address into eax */ mov ebx, Src2 /* load Src2 address into ebx */ mov edi, Dest /* load Dest address into edi */ mov ecx, SrcLength /* load loop counter (SIZE) into ecx */ shr ecx, 3 /* counter/8 (MMX loads 8 bytes at a time) */ pxor mm0, mm0 /* zero mm0 register */ align 16 /* 16 byte alignment of the loop entry */ L1016: movq mm1, [eax] /* load 8 bytes from Src1 into mm1 */ movq mm3, [ebx] /* load 8 bytes from Src2 into mm3 */ movq mm2, mm1 /* copy mm1 into mm2 */ movq mm4, mm3 /* copy mm3 into mm4 */ punpcklbw mm1, mm0 /* unpack low bytes of Src1 into words */ punpckhbw mm2, mm0 /* unpack high bytes of Src1 into words */ punpcklbw mm3, mm0 /* unpack low bytes of Src2 into words */ punpckhbw mm4, mm0 /* unpack high bytes of Src2 into words */ psrlw mm1, 1 /* divide mm1 words by 2, Src1 low bytes */ psrlw mm2, 1 /* divide mm2 words by 2, Src1 high bytes */ psrlw mm3, 1 /* divide mm3 words by 2, Src2 low bytes */ psrlw mm4, 1 /* divide mm4 words by 2, Src2 high bytes */ pmullw mm1, mm3 /* mul low bytes of Src1 and Src2 */ pmullw mm2, mm4 /* mul high bytes of Src1 and Src2 */ packuswb mm1, mm2 /* pack words back into bytes with saturation */ movq [edi], mm1 /* store result in Dest */ add eax, 8 /* increase Src1, Src2 and Dest */ add ebx, 8 /* register pointers by 8 */ add edi, 8 dec ecx /* decrease loop counter */ jnz L1016 /* check loop termination, proceed if required */ emms /* exit MMX state */ popa } #else # 1100 "SDL2_imageFilter.c" /* i386 and x86_64 */ __m64 *mSrc1 = (__m64*)Src1; __m64 *mSrc2 = (__m64*)Src2; __m64 *mDest = (__m64*)Dest; __m64 mm0 = _m_from_int(0); /* zero mm0 register */ int i; for (i = 0; i < SrcLength/8; i++) { __m64 mm1, mm2, mm3, mm4, mm5, mm6; mm1 = _m_punpcklbw(*mSrc1, mm0); /* unpack low bytes of Src1 into words */ mm2 = _m_punpckhbw(*mSrc1, mm0); /* unpack high bytes of Src1 into words */ mm3 = _m_punpcklbw(*mSrc2, mm0); /* unpack low bytes of Src2 into words */ mm4 = _m_punpckhbw(*mSrc2, mm0); /* unpack high bytes of Src2 into words */ mm1 = _m_psrlwi(mm1, 1); /* divide mm1 words by 2, Src1 low bytes */ mm2 = _m_psrlwi(mm2, 1); /* divide mm2 words by 2, Src1 high bytes */ mm3 = _m_psrlwi(mm3, 1); /* divide mm3 words by 2, Src2 low bytes */ mm4 = _m_psrlwi(mm4, 1); /* divide mm4 words by 2, Src2 high bytes */ mm1 = _m_pmullw(mm1, mm3); /* mul low bytes of Src1 and Src2 */ mm2 = _m_pmullw(mm2, mm4); /* mul high bytes of Src1 and Src2 */ *mDest = _m_packuswb(mm1, mm2); /* pack words back into bytes with saturation */ mSrc1++; mSrc2++; mDest++; } _m_empty(); /* clean MMX state */ #endif # 1125 "SDL2_imageFilter.c" return (0); #else # 1127 "SDL2_imageFilter.c" return (-1); #endif # 1129 "SDL2_imageFilter.c" } /*! \brief Filter using MultDivby4: D = saturation255(S1/2 * S2/2) \param Src1 Pointer to the start of the first source byte array (S1). \param Src2 Pointer to the start of the second source byte array (S2). \param Dest Pointer to the start of the destination byte array (D). \param length The number of bytes in the source arrays. \return Returns 0 for success or -1 for error. */ int SDL_imageFilterMultDivby4(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length) { unsigned int i, istart; unsigned char *cursrc1, *cursrc2, *curdst; int result; /* Validate input parameters */ if ((Src1 == NULL) || (Src2 == NULL) || (Dest == NULL)) return(-1); if (length == 0) return(0); if ((SDL_imageFilterMMXdetect()) && (length > 7)) { /* MMX routine */ SDL_imageFilterMultDivby4MMX(Src1, Src2, Dest, length); /* Check for unaligned bytes */ if ((length & 7) > 0) { /* Setup to process unaligned bytes */ istart = length & 0xfffffff8; cursrc1 = &Src1[istart]; cursrc2 = &Src2[istart]; curdst = &Dest[istart]; } else { /* No unaligned bytes - we are done */ return (0); } } else { /* Setup to process whole image */ istart = 0; cursrc1 = Src1; cursrc2 = Src2; curdst = Dest; } /* C routine to process image */ for (i = istart; i < length; i++) { result = ((int) *cursrc1 / 2) * ((int) *cursrc2 / 2); if (result > 255) result = 255; *curdst = (unsigned char) result; /* Advance pointers */ cursrc1++; cursrc2++; curdst++; } return (0); } /*! \brief Internal MMX Filter using BitAnd: D = S1 & S2 \param Src1 Pointer to the start of the first source byte array (S1). \param Src2 Pointer to the start of the second source byte array (S2). \param Dest Pointer to the start of the destination byte array (D). \param SrcLength The number of bytes in the source arrays. \return Returns 0 for success or -1 for error. */ static int SDL_imageFilterBitAndMMX(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int SrcLength) { #ifdef USE_MMX #if !defined(GCC__) __asm { pusha mov eax, Src1 /* load Src1 address into eax */ mov ebx, Src2 /* load Src2 address into ebx */ mov edi, Dest /* load Dest address into edi */ mov ecx, SrcLength /* load loop counter (SIZE) into ecx */ shr ecx, 3 /* counter/8 (MMX loads 8 bytes at a time) */ align 16 /* 16 byte alignment of the loop entry */ L1017: movq mm1, [eax] /* load 8 bytes from Src1 into mm1 */ pand mm1, [ebx] /* mm1=Src1&Src2 */ movq [edi], mm1 /* store result in Dest */ add eax, 8 /* increase Src1, Src2 and Dest */ add ebx, 8 /* register pointers by 8 */ add edi, 8 dec ecx /* decrease loop counter */ jnz L1017 /* check loop termination, proceed if required */ emms /* exit MMX state */ popa } #else # 1227 "SDL2_imageFilter.c" /* x86_64 ASM with constraints: */ /* asm volatile ( */ /* "shr $3, %%rcx \n\t" /\* counter/8 (MMX loads 8 bytes at a time) *\/ */ /* ".align 16 \n\t" /\* 16 byte alignment of the loop entry *\/ */ /* "1: movq (%%rax), %%mm1 \n\t" /\* load 8 bytes from Src1 into mm1 *\/ */ /* "pand (%%rbx), %%mm1 \n\t" /\* mm1=Src1&Src2 *\/ */ /* "movq %%mm1, (%%rdi) \n\t" /\* store result in Dest *\/ */ /* "add $8, %%rax \n\t" /\* increase Src1, Src2 and Dest *\/ */ /* "add $8, %%rbx \n\t" /\* register pointers by 8 *\/ */ /* "add $8, %%rdi \n\t" */ /* "dec %%rcx \n\t" /\* decrease loop counter *\/ */ /* "jnz 1b \n\t" /\* check loop termination, proceed if required *\/ */ /* "emms \n\t" /\* exit MMX state *\/ */ /* : "+a" (Src1), /\* load Src1 address into rax, modified by the loop *\/ */ /* "+b" (Src2), /\* load Src2 address into rbx, modified by the loop *\/ */ /* "+c" (SrcLength), /\* load loop counter (SIZE) into rcx, modified by the loop *\/ */ /* "+D" (Dest) /\* load Dest address into rdi, modified by the loop *\/ */ /* : */ /* : "memory", /\* *Dest is modified *\/ */ /* "mm1" /\* register mm1 modified *\/ */ /* ); */ /* i386 and x86_64 */ __m64 *mSrc1 = (__m64*)Src1; __m64 *mSrc2 = (__m64*)Src2; __m64 *mDest = (__m64*)Dest; int i; for (i = 0; i < SrcLength/8; i++) { *mDest = _m_pand(*mSrc1, *mSrc2); /* Src1&Src2 */ mSrc1++; mSrc2++; mDest++; } _m_empty(); /* clean MMX state */ #endif # 1262 "SDL2_imageFilter.c" return (0); #else # 1264 "SDL2_imageFilter.c" return (-1); #endif # 1266 "SDL2_imageFilter.c" } /*! \brief Filter using BitAnd: D = S1 & S2 \param Src1 Pointer to the start of the first source byte array (S1). \param Src2 Pointer to the start of the second source byte array (S2). \param Dest Pointer to the start of the destination byte array (D). \param length The number of bytes in the source arrays. \return Returns 0 for success or -1 for error. */ int SDL_imageFilterBitAnd(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length) { unsigned int i, istart; unsigned char *cursrc1, *cursrc2, *curdst; /* Validate input parameters */ if ((Src1 == NULL) || (Src2 == NULL) || (Dest == NULL)) return(-1); if (length == 0) return(0); if ((SDL_imageFilterMMXdetect()>0) && (length>7)) { /* if (length > 7) { */ /* Call MMX routine */ SDL_imageFilterBitAndMMX(Src1, Src2, Dest, length); /* Check for unaligned bytes */ if ((length & 7) > 0) { /* Setup to process unaligned bytes */ istart = length & 0xfffffff8; cursrc1 = &Src1[istart]; cursrc2 = &Src2[istart]; curdst = &Dest[istart]; } else { /* No unaligned bytes - we are done */ return (0); } } else { /* Setup to process whole image */ istart = 0; cursrc1 = Src1; cursrc2 = Src2; curdst = Dest; } /* C routine to process image */ for (i = istart; i < length; i++) { *curdst = (*cursrc1) & (*cursrc2); /* Advance pointers */ cursrc1++; cursrc2++; curdst++; } return (0); } /*! \brief Internal MMX Filter using BitOr: D = S1 | S2 \param Src1 Pointer to the start of the first source byte array (S1). \param Src2 Pointer to the start of the second source byte array (S2). \param Dest Pointer to the start of the destination byte array (D). \param SrcLength The number of bytes in the source arrays. \return Returns 0 for success or -1 for error. */ static int SDL_imageFilterBitOrMMX(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int SrcLength) { #ifdef USE_MMX #if !defined(GCC__) __asm { pusha mov eax, Src1 /* load Src1 address into eax */ mov ebx, Src2 /* load Src2 address into ebx */ mov edi, Dest /* load Dest address into edi */ mov ecx, SrcLength /* load loop counter (SIZE) into ecx */ shr ecx, 3 /* counter/8 (MMX loads 8 bytes at a time) */ align 16 /* 16 byte alignment of the loop entry */ L91017: movq mm1, [eax] /* load 8 bytes from Src1 into mm1 */ por mm1, [ebx] /* mm1=Src1|Src2 */ movq [edi], mm1 /* store result in Dest */ add eax, 8 /* increase Src1, Src2 and Dest */ add ebx, 8 /* register pointers by 8 */ add edi, 8 dec ecx /* decrease loop counter */ jnz L91017 /* check loop termination, proceed if required */ emms /* exit MMX state */ popa } #else # 1363 "SDL2_imageFilter.c" /* i386 and x86_64 */ __m64 *mSrc1 = (__m64*)Src1; __m64 *mSrc2 = (__m64*)Src2; __m64 *mDest = (__m64*)Dest; int i; for (i = 0; i < SrcLength/8; i++) { *mDest = _m_por(*mSrc1, *mSrc2); /* Src1|Src2 */ mSrc1++; mSrc2++; mDest++; } _m_empty(); /* clean MMX state */ #endif # 1376 "SDL2_imageFilter.c" return (0); #else # 1378 "SDL2_imageFilter.c" return (-1); #endif # 1380 "SDL2_imageFilter.c" } /*! \brief Filter using BitOr: D = S1 | S2 \param Src1 Pointer to the start of the first source byte array (S1). \param Src2 Pointer to the start of the second source byte array (S2). \param Dest Pointer to the start of the destination byte array (D). \param length The number of bytes in the source arrays. \return Returns 0 for success or -1 for error. */ int SDL_imageFilterBitOr(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length) { unsigned int i, istart; unsigned char *cursrc1, *cursrc2, *curdst; /* Validate input parameters */ if ((Src1 == NULL) || (Src2 == NULL) || (Dest == NULL)) return(-1); if (length == 0) return(0); if ((SDL_imageFilterMMXdetect()) && (length > 7)) { /* MMX routine */ SDL_imageFilterBitOrMMX(Src1, Src2, Dest, length); /* Check for unaligned bytes */ if ((length & 7) > 0) { /* Setup to process unaligned bytes */ istart = length & 0xfffffff8; cursrc1 = &Src1[istart]; cursrc2 = &Src2[istart]; curdst = &Dest[istart]; } else { /* No unaligned bytes - we are done */ return (0); } } else { /* Setup to process whole image */ istart = 0; cursrc1 = Src1; cursrc2 = Src2; curdst = Dest; } /* C routine to process image */ for (i = istart; i < length; i++) { *curdst = *cursrc1 | *cursrc2; /* Advance pointers */ cursrc1++; cursrc2++; curdst++; } return (0); } /*! \brief Internal ASM Filter using Div: D = S1 / S2 \param Src1 Pointer to the start of the first source byte array (S1). \param Src2 Pointer to the start of the second source byte array (S2). \param Dest Pointer to the start of the destination byte array (D). \param SrcLength The number of bytes in the source arrays. \return Returns 0 for success or -1 for error. */ static int SDL_imageFilterDivASM(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int SrcLength) { #ifdef USE_MMX #if !defined(GCC__) __asm { pusha mov edx, Src1 /* load Src1 address into edx */ mov esi, Src2 /* load Src2 address into esi */ mov edi, Dest /* load Dest address into edi */ mov ecx, SrcLength /* load loop counter (SIZE) into ecx */ align 16 /* 16 byte alignment of the loop entry */ L10191: mov bl, [esi] /* load a byte from Src2 */ cmp bl, 0 /* check if it zero */ jnz L10192 mov [edi], 255 /* division by zero = 255 !!! */ jmp L10193 L10192: xor ah, ah /* prepare AX, zero AH register */ mov al, [edx] /* load a byte from Src1 into AL */ div bl /* divide AL by BL */ mov [edi], al /* move a byte result to Dest */ L10193: inc edx /* increment Src1, Src2, Dest */ inc esi /* pointer registers by one */ inc edi dec ecx /* decrease loop counter */ jnz L10191 /* check loop termination, proceed if required */ popa } #else # 1480 "SDL2_imageFilter.c" /* Note: ~15% gain on i386, less efficient than C on x86_64 */ /* Also depends on whether the function is static (?!) */ /* Also depends on whether we work on malloc() or static char[] */ asm volatile ( # if defined(i386) "pushl %%ebx \n\t" /* %ebx may be the PIC register. */ ".align 16 \n\t" /* 16 byte alignment of the loop entry */ "1: mov (%%esi), %%bl \n\t" /* load a byte from Src2 */ "cmp $0, %%bl \n\t" /* check if it zero */ "jnz 2f \n\t" "movb $255, (%%edi) \n\t" /* division by zero = 255 !!! */ "jmp 3f \n\t" "2: xor %%ah, %%ah \n\t" /* prepare AX, zero AH register */ "mov (%%edx), %%al \n\t" /* load a byte from Src1 into AL */ "div %%bl \n\t" /* divide AL by BL */ "mov %%al, (%%edi) \n\t" /* move a byte result to Dest */ "3: inc %%edx \n\t" /* increment Src1, Src2, Dest */ "inc %%esi \n\t" /* pointer registers by one */ "inc %%edi \n\t" "dec %%ecx \n\t" /* decrease loop counter */ "jnz 1b \n\t" /* check loop termination, proceed if required */ "popl %%ebx \n\t" /* restore %ebx */ : "+d" (Src1), /* load Src1 address into edx */ "+S" (Src2), /* load Src2 address into esi */ "+c" (SrcLength), /* load loop counter (SIZE) into ecx */ "+D" (Dest) /* load Dest address into edi */ : : "memory", "rax" # elif defined(__x86_64__) # 1509 "SDL2_imageFilter.c" ".align 16 \n\t" /* 16 byte alignment of the loop entry */ "1: mov (%%rsi), %%bl \n\t" /* load a byte from Src2 */ "cmp $0, %%bl \n\t" /* check if it zero */ "jnz 2f \n\t" "movb $255, (%%rdi) \n\t" /* division by zero = 255 !!! */ "jmp 3f \n\t" "2: xor %%ah, %%ah \n\t" /* prepare AX, zero AH register */ "mov (%%rdx), %%al \n\t" /* load a byte from Src1 into AL */ "div %%bl \n\t" /* divide AL by BL */ "mov %%al, (%%rdi) \n\t" /* move a byte result to Dest */ "3: inc %%rdx \n\t" /* increment Src1, Src2, Dest */ "inc %%rsi \n\t" /* pointer registers by one */ "inc %%rdi \n\t" "dec %%rcx \n\t" /* decrease loop counter */ "jnz 1b \n\t" /* check loop termination, proceed if required */ : "+d" (Src1), /* load Src1 address into edx */ "+S" (Src2), /* load Src2 address into esi */ "+c" (SrcLength), /* load loop counter (SIZE) into ecx */ "+D" (Dest) /* load Dest address into edi */ : : "memory", "rax", "rbx" # endif # 1531 "SDL2_imageFilter.c" ); #endif # 1533 "SDL2_imageFilter.c" return (0); #else # 1535 "SDL2_imageFilter.c" return (-1); #endif # 1537 "SDL2_imageFilter.c" } /*! \brief Filter using Div: D = S1 / S2 \param Src1 Pointer to the start of the first source byte array (S1). \param Src2 Pointer to the start of the second source byte array (S2). \param Dest Pointer to the start of the destination byte array (D). \param length The number of bytes in the source arrays. \return Returns 0 for success or -1 for error. */ int SDL_imageFilterDiv(unsigned char *Src1, unsigned char *Src2, unsigned char *Dest, unsigned int length) { unsigned int i, istart; unsigned char *cursrc1, *cursrc2, *curdst; /* Validate input parameters */ if ((Src1 == NULL) || (Src2 == NULL) || (Dest == NULL)) return(-1); if (length == 0) return(0); if (SDL_imageFilterMMXdetect()) { if (length > 0) { /* Call ASM routine */ SDL_imageFilterDivASM(Src1, Src2, Dest, length); /* Never unaligned bytes - we are done */ return (0); } else { return (-1); } } /* Setup to process whole image */ istart = 0; cursrc1 = Src1; cursrc2 = Src2; curdst = Dest; /* C routine to process image */ /* for (i = istart; i < length; i++) { */ /* if (*cursrc2 == 0) { */ /* *curdst = 255; */ /* } else { */ /* result = (int) *cursrc1 / (int) *cursrc2; */ /* *curdst = (unsigned char) result; */ /* } */ /* /\* Advance pointers *\/ */ /* cursrc1++; */ /* cursrc2++; */ /* curdst++; */ /* } */ for (i = istart; i < length; i++) { if (*cursrc2 == 0) { *curdst = 255; } else { *curdst = (int)*cursrc1 / (int)*cursrc2; // (int) for efficiency } /* Advance pointers */ cursrc1++; cursrc2++; curdst++; } return (0); } /* ------------------------------------------------------------------------------------ */ /*! \brief Internal MMX Filter using BitNegation: D = !S \param Src1 Pointer to the start of the source byte array (S1). \param Dest Pointer to the start of the destination byte array (D). \param SrcLength The number of bytes in the source array. \return Returns 0 for success or -1 for error. */ static int SDL_imageFilterBitNegationMMX(unsigned char *Src1, unsigned char *Dest, unsigned int SrcLength) { #ifdef USE_MMX #if !defined(GCC__) __asm { pusha pcmpeqb mm1, mm1 /* generate all 1's in mm1 */ mov eax, Src1 /* load Src1 address into eax */ mov edi, Dest /* load Dest address into edi */ mov ecx, SrcLength /* load loop counter (SIZE) into ecx */ shr ecx, 3 /* counter/8 (MMX loads 8 bytes at a time) */ align 16 /* 16 byte alignment of the loop entry */ L91117: movq mm0, [eax] /* load 8 bytes from Src1 into mm1 */ pxor mm0, mm1 /* negate mm0 by xoring with mm1 */ movq [edi], mm0 /* store result in Dest */ add eax, 8 /* increase Src1, Src2 and Dest */ add edi, 8 dec ecx /* decrease loop counter */ jnz L91117 /* check loop termination, proceed if required */ emms /* exit MMX state */ popa } #else # 1642 "SDL2_imageFilter.c" /* i386 and x86_64 */ __m64 *mSrc1 = (__m64*)Src1; __m64 *mDest = (__m64*)Dest; __m64 mm1; mm1 = _m_pcmpeqb(mm1, mm1); /* generate all 1's in mm1 */ int i; for (i = 0; i < SrcLength/8; i++) { *mDest = _m_pxor(*mSrc1, mm1); /* negate mm0 by xoring with mm1 */ mSrc1++; mDest++; } _m_empty(); /* clean MMX state */ #endif # 1656 "SDL2_imageFilter.c" return (0); #else # 1658 "SDL2_imageFilter.c" return (-1); #endif # 1660 "SDL2_imageFilter.c" } /*! \brief Filter using BitNegation: D = !S \param Src1 Pointer to the start of the source byte array (S). \param Dest Pointer to the start of the destination byte array (D). \param length The number of bytes in the source array. \return Returns 0 for success or -1 for error. */ int SDL_imageFilterBitNegation(unsigned char *Src1, unsigned char *Dest, unsigned int length) { unsigned int i, istart; unsigned char *cursrc1, *curdst; /* Validate input parameters */ if ((Src1 == NULL) || (Dest == NULL)) return(-1); if (length == 0) return(0); if ((SDL_imageFilterMMXdetect()) && (length > 7)) { /* MMX routine */ SDL_imageFilterBitNegationMMX(Src1, Dest, length); /* Check for unaligned bytes */ if ((length & 7) > 0) { /* Setup to process unaligned bytes */ istart = length & 0xfffffff8; cursrc1 = &Src1[istart]; curdst = &Dest[istart]; } else { /* No unaligned bytes - we are done */ return (0); } } else { /* Setup to process whole image */ istart = 0; cursrc1 = Src1; curdst = Dest; } /* C routine to process image */ for (i = istart; i < length; i++) { *curdst = ~(*cursrc1); /* Advance pointers */ cursrc1++; curdst++; } return (0); } /*! \brief Internal MMX Filter using AddByte: D = saturation255(S + C) \param Src1 Pointer to the start of the source byte array (S). \param Dest Pointer to the start of the destination byte array (D). \param SrcLength The number of bytes in the source array. \param C Constant value to add (C). \return Returns 0 for success or -1 for error. */ static int SDL_imageFilterAddByteMMX(unsigned char *Src1, unsigned char *Dest, unsigned int SrcLength, unsigned char C) { #ifdef USE_MMX #if !defined(GCC__) __asm { pusha /* ** Duplicate C in 8 bytes of MM1 ** */ mov al, C /* load C into AL */ mov ah, al /* copy AL into AH */ mov bx, ax /* copy AX into BX */ shl eax, 16 /* shift 2 bytes of EAX left */ mov ax, bx /* copy BX into AX */ movd mm1, eax /* copy EAX into MM1 */ movd mm2, eax /* copy EAX into MM2 */ punpckldq mm1, mm2 /* fill higher bytes of MM1 with C */ mov eax, Src1 /* load Src1 address into eax */ mov edi, Dest /* load Dest address into edi */ mov ecx, SrcLength /* load loop counter (SIZE) into ecx */ shr ecx, 3 /* counter/8 (MMX loads 8 bytes at a time) */ align 16 /* 16 byte alignment of the loop entry */ L1021: movq mm0, [eax] /* load 8 bytes from Src1 into MM0 */ paddusb mm0, mm1 /* MM0=SrcDest+C (add 8 bytes with saturation) */ movq [edi], mm0 /* store result in Dest */ add eax, 8 /* increase Dest register pointer by 8 */ add edi, 8 /* increase Dest register pointer by 8 */ dec ecx /* decrease loop counter */ jnz L1021 /* check loop termination, proceed if required */ emms /* exit MMX state */ popa } #else # 1757 "SDL2_imageFilter.c" /* i386 and x86_64 */ __m64 *mSrc1 = (__m64*)Src1; __m64 *mDest = (__m64*)Dest; /* Duplicate C in 8 bytes of MM1 */ int i; memset(&i, C, 4); __m64 mm1 = _m_from_int(i); __m64 mm2 = _m_from_int(i); mm1 = _m_punpckldq(mm1, mm2); /* fill higher bytes of MM1 with C */ //__m64 mm1 = _m_from_int64(lli); // x86_64 only for (i = 0; i < SrcLength/8; i++) { *mDest = _m_paddusb(*mSrc1, mm1); /* Src1+C (add 8 bytes with saturation) */ mSrc1++; mDest++; } _m_empty(); /* clean MMX state */ #endif # 1774 "SDL2_imageFilter.c" return (0); #else # 1776 "SDL2_imageFilter.c" return (-1); #endif # 1778 "SDL2_imageFilter.c" } /*! \brief Filter using AddByte: D = saturation255(S + C) \param Src1 Pointer to the start of the source byte array (S). \param Dest Pointer to the start of the destination byte array (D). \param length The number of bytes in the source array. \param C Constant value to add (C). \return Returns 0 for success or -1 for error. */ int SDL_imageFilterAddByte(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char C) { unsigned int i, istart; int iC; unsigned char *cursrc1, *curdest; int result; /* Validate input parameters */ if ((Src1 == NULL) || (Dest == NULL)) return(-1); if (length == 0) return(0); /* Special case: C==0 */ if (C == 0) { memcpy(Src1, Dest, length); return (0); } if ((SDL_imageFilterMMXdetect()) && (length > 7)) { /* MMX routine */ SDL_imageFilterAddByteMMX(Src1, Dest, length, C); /* Check for unaligned bytes */ if ((length & 7) > 0) { /* Setup to process unaligned bytes */ istart = length & 0xfffffff8; cursrc1 = &Src1[istart]; curdest = &Dest[istart]; } else { /* No unaligned bytes - we are done */ return (0); } } else { /* Setup to process whole image */ istart = 0; cursrc1 = Src1; curdest = Dest; } /* C routine to process image */ iC = (int) C; for (i = istart; i < length; i++) { result = (int) *cursrc1 + iC; if (result > 255) result = 255; *curdest = (unsigned char) result; /* Advance pointers */ cursrc1++; curdest++; } return (0); } /*! \brief Internal MMX Filter using AddUint: D = saturation255((S[i] + Cs[i % 4]), Cs=Swap32((uint)C) \param Src1 Pointer to the start of the source byte array (S). \param Dest Pointer to the start of the destination byte array (D). \param SrcLength The number of bytes in the source array. \param C Constant to add (C). \param D Byteorder-swapped constant to add (Cs). \return Returns 0 for success or -1 for error. */ static int SDL_imageFilterAddUintMMX(unsigned char *Src1, unsigned char *Dest, unsigned int SrcLength, unsigned int C, unsigned int D) { #ifdef USE_MMX #if !defined(GCC__) __asm { pusha /* ** Duplicate (int)C in 8 bytes of MM1 ** */ mov eax, C /* load C into EAX */ movd mm1, eax /* copy EAX into MM1 */ mov eax, D /* load D into EAX */ movd mm2, eax /* copy EAX into MM2 */ punpckldq mm1, mm2 /* fill higher bytes of MM1 with C */ mov eax, Src1 /* load Src1 address into eax */ mov edi, Dest /* load Dest address into edi */ mov ecx, SrcLength /* load loop counter (SIZE) into ecx */ shr ecx, 3 /* counter/8 (MMX loads 8 bytes at a time) */ align 16 /* 16 byte alignment of the loop entry */ L11023: movq mm0, [eax] /* load 8 bytes from SrcDest into MM0 */ paddusb mm0, mm1 /* MM0=SrcDest+C (add 8 bytes with saturation) */ movq [edi], mm0 /* store result in SrcDest */ add eax, 8 /* increase Src1 register pointer by 8 */ add edi, 8 /* increase Dest register pointer by 8 */ dec ecx /* decrease loop counter */ jnz L11023 /* check loop termination, proceed if required */ emms /* exit MMX state */ popa } #else # 1887 "SDL2_imageFilter.c" /* i386 and x86_64 */ __m64 *mSrc1 = (__m64*)Src1; __m64 *mDest = (__m64*)Dest; /* Duplicate (int)C in 8 bytes of MM1 */ __m64 mm1 = _m_from_int(C); __m64 mm2 = _m_from_int(C); mm1 = _m_punpckldq(mm1, mm2); /* fill higher bytes of MM1 with C */ //__m64 mm1 = _m_from_int64(lli); // x86_64 only int i; for (i = 0; i < SrcLength/8; i++) { *mDest = _m_paddusb(*mSrc1, mm1); /* Src1+C (add 8 bytes with saturation) */ mSrc1++; mDest++; } _m_empty(); /* clean MMX state */ #endif # 1903 "SDL2_imageFilter.c" return (0); #else # 1905 "SDL2_imageFilter.c" return (-1); #endif # 1907 "SDL2_imageFilter.c" } /*! \brief Filter using AddUint: D = saturation255((S[i] + Cs[i % 4]), Cs=Swap32((uint)C) \param Src1 Pointer to the start of the source byte array (S). \param Dest Pointer to the start of the destination byte array (D). \param length The number of bytes in the source array. \param C Constant to add (C). \return Returns 0 for success or -1 for error. */ int SDL_imageFilterAddUint(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned int C) { unsigned int i, j, istart, D; int iC[4]; unsigned char *cursrc1; unsigned char *curdest; int result; /* Validate input parameters */ if ((Src1 == NULL) || (Dest == NULL)) return(-1); if (length == 0) return(0); /* Special case: C==0 */ if (C == 0) { memcpy(Src1, Dest, length); return (0); } if ((SDL_imageFilterMMXdetect()) && (length > 7)) { /* MMX routine */ D=SWAP_32(C); SDL_imageFilterAddUintMMX(Src1, Dest, length, C, D); /* Check for unaligned bytes */ if ((length & 7) > 0) { /* Setup to process unaligned bytes */ istart = length & 0xfffffff8; cursrc1 = &Src1[istart]; curdest = &Dest[istart]; } else { /* No unaligned bytes - we are done */ return (0); } } else { /* Setup to process whole image */ istart = 0; cursrc1 = Src1; curdest = Dest; } /* C routine to process bytes */ iC[3] = (int) ((C >> 24) & 0xff); iC[2] = (int) ((C >> 16) & 0xff); iC[1] = (int) ((C >> 8) & 0xff); iC[0] = (int) ((C >> 0) & 0xff); for (i = istart; i < length; i += 4) { for (j = 0; j < 4; j++) { if ((i+j) 255) result = 255; *curdest = (unsigned char) result; /* Advance pointers */ cursrc1++; curdest++; } } } return (0); } /*! \brief Internal MMX Filter using AddByteToHalf: D = saturation255(S/2 + C) \param Src1 Pointer to the start of the source byte array (S). \param Dest Pointer to the start of the destination byte array (D). \param SrcLength The number of bytes in the source array. \param C Constant to add (C). \param Mask Pointer to 8 mask bytes of value 0x7F. \return Returns 0 for success or -1 for error. */ static int SDL_imageFilterAddByteToHalfMMX(unsigned char *Src1, unsigned char *Dest, unsigned int SrcLength, unsigned char C, unsigned char *Mask) { #ifdef USE_MMX #if !defined(GCC__) __asm { pusha /* ** Duplicate C in 8 bytes of MM1 ** */ mov al, C /* load C into AL */ mov ah, al /* copy AL into AH */ mov bx, ax /* copy AX into BX */ shl eax, 16 /* shift 2 bytes of EAX left */ mov ax, bx /* copy BX into AX */ movd mm1, eax /* copy EAX into MM1 */ movd mm2, eax /* copy EAX into MM2 */ punpckldq mm1, mm2 /* fill higher bytes of MM1 with C */ mov edx, Mask /* load Mask address into edx */ movq mm0, [edx] /* load Mask into mm0 */ mov eax, Src1 /* load Src1 address into eax */ mov edi, Dest /* load Dest address into edi */ mov ecx, SrcLength /* load loop counter (SIZE) into ecx */ shr ecx, 3 /* counter/8 (MMX loads 8 bytes at a time) */ align 16 /* 16 byte alignment of the loop entry */ L1022: movq mm2, [eax] /* load 8 bytes from Src1 into MM2 */ psrlw mm2, 1 /* shift 4 WORDS of MM2 1 bit to the right */ pand mm2, mm0 // apply Mask to 8 BYTES of MM2 */ paddusb mm2, mm1 /* MM2=SrcDest+C (add 8 bytes with saturation) */ movq [edi], mm2 /* store result in Dest */ add eax, 8 /* increase Src1 register pointer by 8 */ add edi, 8 /* increase Dest register pointer by 8 */ dec ecx /* decrease loop counter */ jnz L1022 /* check loop termination, proceed if required */ emms /* exit MMX state */ popa } #else # 2031 "SDL2_imageFilter.c" /* i386 and x86_64 */ __m64 *mSrc1 = (__m64*)Src1; __m64 *mDest = (__m64*)Dest; __m64 *mMask = (__m64*)Mask; /* Duplicate C in 8 bytes of MM1 */ int i; memset(&i, C, 4); __m64 mm1 = _m_from_int(i); __m64 mm2 = _m_from_int(i); mm1 = _m_punpckldq(mm1, mm2); /* fill higher bytes of MM1 with C */ //__m64 mm1 = _m_from_int64(lli); // x86_64 only for (i = 0; i < SrcLength/8; i++) { __m64 mm2 = _m_psrlwi(*mSrc1, 1); /* shift 4 WORDS of MM2 1 bit to the right */ mm2 = _m_pand(mm2, *mMask); /* apply Mask to 8 BYTES of MM2 */ /* byte 0x0f, 0xdb, 0xd0 */ *mDest = _m_paddusb(mm1, mm2); /* Src1+C (add 8 bytes with saturation) */ mSrc1++; mDest++; } _m_empty(); /* clean MMX state */ #endif # 2052 "SDL2_imageFilter.c" return (0); #else # 2054 "SDL2_imageFilter.c" return (-1); #endif # 2056 "SDL2_imageFilter.c" } /*! \brief Filter using AddByteToHalf: D = saturation255(S/2 + C) \param Src1 Pointer to the start of the source byte array (S). \param Dest Pointer to the start of the destination byte array (D). \param length The number of bytes in the source array. \param C Constant to add (C). \return Returns 0 for success or -1 for error. */ int SDL_imageFilterAddByteToHalf(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char C) { static unsigned char Mask[8] = { 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F }; unsigned int i, istart; int iC; unsigned char *cursrc1; unsigned char *curdest; int result; /* Validate input parameters */ if ((Src1 == NULL) || (Dest == NULL)) return(-1); if (length == 0) return(0); if ((SDL_imageFilterMMXdetect()) && (length > 7)) { /* MMX routine */ SDL_imageFilterAddByteToHalfMMX(Src1, Dest, length, C, Mask); /* Check for unaligned bytes */ if ((length & 7) > 0) { /* Setup to process unaligned bytes */ istart = length & 0xfffffff8; cursrc1 = &Src1[istart]; curdest = &Dest[istart]; } else { /* No unaligned bytes - we are done */ return (0); } } else { /* Setup to process whole image */ istart = 0; cursrc1 = Src1; curdest = Dest; } /* C routine to process image */ iC = (int) C; for (i = istart; i < length; i++) { result = (int) (*cursrc1 / 2) + iC; if (result > 255) result = 255; *curdest = (unsigned char) result; /* Advance pointers */ cursrc1++; curdest++; } return (0); } /*! \brief Internal MMX Filter using SubByte: D = saturation0(S - C) \param Src1 Pointer to the start of the source byte array (S). \param Dest Pointer to the start of the destination byte array (D). \param SrcLength The number of bytes in the source array. \param C Constant to subtract (C). \return Returns 0 for success or -1 for error. */ int SDL_imageFilterSubByteMMX(unsigned char *Src1, unsigned char *Dest, unsigned int SrcLength, unsigned char C) { #ifdef USE_MMX #if !defined(GCC__) __asm { pusha /* ** Duplicate C in 8 bytes of MM1 ** */ mov al, C /* load C into AL */ mov ah, al /* copy AL into AH */ mov bx, ax /* copy AX into BX */ shl eax, 16 /* shift 2 bytes of EAX left */ mov ax, bx /* copy BX into AX */ movd mm1, eax /* copy EAX into MM1 */ movd mm2, eax /* copy EAX into MM2 */ punpckldq mm1, mm2 /* fill higher bytes of MM1 with C */ mov eax, Src1 /* load Src1 address into eax */ mov edi, Dest /* load Dest address into edi */ mov ecx, SrcLength /* load loop counter (SIZE) into ecx */ shr ecx, 3 /* counter/8 (MMX loads 8 bytes at a time) */ align 16 /* 16 byte alignment of the loop entry */ L1023: movq mm0, [eax] /* load 8 bytes from SrcDest into MM0 */ psubusb mm0, mm1 /* MM0=SrcDest-C (sub 8 bytes with saturation) */ movq [edi], mm0 /* store result in SrcDest */ add eax, 8 /* increase Src1 register pointer by 8 */ add edi, 8 /* increase Dest register pointer by 8 */ dec ecx /* decrease loop counter */ jnz L1023 /* check loop termination, proceed if required */ emms /* exit MMX state */ popa } #else # 2163 "SDL2_imageFilter.c" /* i386 and x86_64 */ __m64 *mSrc1 = (__m64*)Src1; __m64 *mDest = (__m64*)Dest; /* Duplicate C in 8 bytes of MM1 */ int i; memset(&i, C, 4); __m64 mm1 = _m_from_int(i); __m64 mm2 = _m_from_int(i); mm1 = _m_punpckldq(mm1, mm2); /* fill higher bytes of MM1 with C */ //__m64 mm1 = _m_from_int64(lli); // x86_64 only for (i = 0; i < SrcLength/8; i++) { *mDest = _m_psubusb(*mSrc1, mm1); /* Src1-C (sub 8 bytes with saturation) */ mSrc1++; mDest++; } _m_empty(); /* clean MMX state */ #endif # 2180 "SDL2_imageFilter.c" return (0); #else # 2182 "SDL2_imageFilter.c" return (-1); #endif # 2184 "SDL2_imageFilter.c" } /*! \brief Filter using SubByte: D = saturation0(S - C) \param Src1 Pointer to the start of the source byte array (S). \param Dest Pointer to the start of the destination byte array (D). \param length The number of bytes in the source arrays. \param C Constant to subtract (C). \return Returns 0 for success or -1 for error. */ int SDL_imageFilterSubByte(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char C) { unsigned int i, istart; int iC; unsigned char *cursrc1; unsigned char *curdest; int result; /* Validate input parameters */ if ((Src1 == NULL) || (Dest == NULL)) return(-1); if (length == 0) return(0); /* Special case: C==0 */ if (C == 0) { memcpy(Src1, Dest, length); return (0); } if ((SDL_imageFilterMMXdetect()) && (length > 7)) { /* MMX routine */ SDL_imageFilterSubByteMMX(Src1, Dest, length, C); /* Check for unaligned bytes */ if ((length & 7) > 0) { /* Setup to process unaligned bytes */ istart = length & 0xfffffff8; cursrc1 = &Src1[istart]; curdest = &Dest[istart]; } else { /* No unaligned bytes - we are done */ return (0); } } else { /* Setup to process whole image */ istart = 0; cursrc1 = Src1; curdest = Dest; } /* C routine to process image */ iC = (int) C; for (i = istart; i < length; i++) { result = (int) *cursrc1 - iC; if (result < 0) result = 0; *curdest = (unsigned char) result; /* Advance pointers */ cursrc1++; curdest++; } return (0); } /*! \brief Internal MMX Filter using SubUint: D = saturation0(S[i] - Cs[i % 4]), Cs=Swap32((uint)C) \param Src1 Pointer to the start of the source byte array (S). \param Dest Pointer to the start of the destination byte array (D). \param SrcLength The number of bytes in the source array. \param C Constant to subtract (C). \param D Byteorder-swapped constant to subtract (Cs). \return Returns 0 for success or -1 for error. */ static int SDL_imageFilterSubUintMMX(unsigned char *Src1, unsigned char *Dest, unsigned int SrcLength, unsigned int C, unsigned int D) { #ifdef USE_MMX #if !defined(GCC__) __asm { pusha /* ** Duplicate (int)C in 8 bytes of MM1 ** */ mov eax, C /* load C into EAX */ movd mm1, eax /* copy EAX into MM1 */ mov eax, D /* load D into EAX */ movd mm2, eax /* copy EAX into MM2 */ punpckldq mm1, mm2 /* fill higher bytes of MM1 with C */ mov eax, Src1 /* load Src1 address into eax */ mov edi, Dest /* load Dest address into edi */ mov ecx, SrcLength /* load loop counter (SIZE) into ecx */ shr ecx, 3 /* counter/8 (MMX loads 8 bytes at a time) */ align 16 /* 16 byte alignment of the loop entry */ L11024: movq mm0, [eax] /* load 8 bytes from SrcDest into MM0 */ psubusb mm0, mm1 /* MM0=SrcDest-C (sub 8 bytes with saturation) */ movq [edi], mm0 /* store result in SrcDest */ add eax, 8 /* increase Src1 register pointer by 8 */ add edi, 8 /* increase Dest register pointer by 8 */ dec ecx /* decrease loop counter */ jnz L11024 /* check loop termination, proceed if required */ emms /* exit MMX state */ popa } #else # 2293 "SDL2_imageFilter.c" /* i386 and x86_64 */ __m64 *mSrc1 = (__m64*)Src1; __m64 *mDest = (__m64*)Dest; /* Duplicate (int)C in 8 bytes of MM1 */ __m64 mm1 = _m_from_int(C); __m64 mm2 = _m_from_int(C); mm1 = _m_punpckldq(mm1, mm2); /* fill higher bytes of MM1 with C */ //__m64 mm1 = _m_from_int64(lli); // x86_64 only int i; for (i = 0; i < SrcLength/8; i++) { *mDest = _m_psubusb(*mSrc1, mm1); /* Src1-C (sub 8 bytes with saturation) */ mSrc1++; mDest++; } _m_empty(); /* clean MMX state */ #endif # 2309 "SDL2_imageFilter.c" return (0); #else # 2311 "SDL2_imageFilter.c" return (-1); #endif # 2313 "SDL2_imageFilter.c" } /*! \brief Filter using SubUint: D = saturation0(S[i] - Cs[i % 4]), Cs=Swap32((uint)C) \param Src1 Pointer to the start of the source byte array (S1). \param Dest Pointer to the start of the destination byte array (D). \param length The number of bytes in the source array. \param C Constant to subtract (C). \return Returns 0 for success or -1 for error. */ int SDL_imageFilterSubUint(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned int C) { unsigned int i, j, istart, D; int iC[4]; unsigned char *cursrc1; unsigned char *curdest; int result; /* Validate input parameters */ if ((Src1 == NULL) || (Dest == NULL)) return(-1); if (length == 0) return(0); /* Special case: C==0 */ if (C == 0) { memcpy(Src1, Dest, length); return (0); } if ((SDL_imageFilterMMXdetect()) && (length > 7)) { /* MMX routine */ D=SWAP_32(C); SDL_imageFilterSubUintMMX(Src1, Dest, length, C, D); /* Check for unaligned bytes */ if ((length & 7) > 0) { /* Setup to process unaligned bytes */ istart = length & 0xfffffff8; cursrc1 = &Src1[istart]; curdest = &Dest[istart]; } else { /* No unaligned bytes - we are done */ return (0); } } else { /* Setup to process whole image */ istart = 0; cursrc1 = Src1; curdest = Dest; } /* C routine to process image */ iC[3] = (int) ((C >> 24) & 0xff); iC[2] = (int) ((C >> 16) & 0xff); iC[1] = (int) ((C >> 8) & 0xff); iC[0] = (int) ((C >> 0) & 0xff); for (i = istart; i < length; i += 4) { for (j = 0; j < 4; j++) { if ((i+j)> N) \param Src1 Pointer to the start of the source byte array (S). \param Dest Pointer to the start of the destination byte array (D). \param SrcLength The number of bytes in the source array. \param N Number of bit-positions to shift (N). Valid range is 0 to 8. \param Mask Byte array containing 8 bytes with 0x7F value. \return Returns 0 for success or -1 for error. */ static int SDL_imageFilterShiftRightMMX(unsigned char *Src1, unsigned char *Dest, unsigned int SrcLength, unsigned char N, unsigned char *Mask) { #ifdef USE_MMX #if !defined(GCC__) __asm { pusha mov edx, Mask /* load Mask address into edx */ movq mm0, [edx] /* load Mask into mm0 */ xor ecx, ecx /* zero ECX */ mov cl, N /* load loop counter (N) into CL */ movd mm3, ecx /* copy (N) into MM3 */ pcmpeqb mm1, mm1 /* generate all 1's in mm1 */ L10240: /* ** Prepare proper bit-Mask in MM1 ** */ psrlw mm1, 1 /* shift 4 WORDS of MM1 1 bit to the right */ pand mm1, mm0 // apply Mask to 8 BYTES of MM1 */ /* byte 0x0f, 0xdb, 0xc8 */ dec cl /* decrease loop counter */ jnz L10240 /* check loop termination, proceed if required */ /* ** Shift all bytes of the image ** */ mov eax, Src1 /* load Src1 address into eax */ mov edi, Dest /* load Dest address into edi */ mov ecx, SrcLength /* load loop counter (SIZE) into ecx */ shr ecx, 3 /* counter/8 (MMX loads 8 bytes at a time) */ align 16 /* 16 byte alignment of the loop entry */ L10241: movq mm0, [eax] /* load 8 bytes from SrcDest into MM0 */ psrlw mm0, mm3 /* shift 4 WORDS of MM0 (N) bits to the right */ pand mm0, mm1 // apply proper bit-Mask to 8 BYTES of MM0 */ /* byte 0x0f, 0xdb, 0xc1 */ movq [edi], mm0 /* store result in SrcDest */ add eax, 8 /* increase Src1 register pointer by 8 */ add edi, 8 /* increase Dest register pointer by 8 */ dec ecx /* decrease loop counter */ jnz L10241 /* check loop termination, proceed if required */ emms /* exit MMX state */ popa } #else # 2439 "SDL2_imageFilter.c" /* i386 and x86_64 */ __m64 *mSrc1 = (__m64*)Src1; __m64 *mDest = (__m64*)Dest; __m64 *mMask = (__m64*)Mask; __m64 mm1; int i; mm1 = _m_pcmpeqb(mm1, mm1); /* generate all 1's in mm1 */ /* Prepare proper bit-Mask in MM1 */ for (i = 0; i < N; i++) { mm1 = _m_psrlwi(mm1, 1); /* shift 4 WORDS of MM1 1 bit to the right */ mm1 = _m_pand(mm1, *mMask); /* apply Mask to 8 BYTES of MM1 */ } /* Shift all bytes of the image */ for (i = 0; i < SrcLength/8; i++) { __m64 mm0 = _m_psrlwi(*mSrc1, N); /* shift 4 WORDS of MM0 (N) bits to the right */ *mDest = _m_pand(mm0, mm1); /* apply proper bit-Mask to 8 BYTES of MM0 */ mSrc1++; mDest++; } _m_empty(); /* clean MMX state */ #endif # 2460 "SDL2_imageFilter.c" return (0); #else # 2462 "SDL2_imageFilter.c" return (-1); #endif # 2464 "SDL2_imageFilter.c" } /*! \brief Filter using ShiftRight: D = saturation0(S >> N) \param Src1 Pointer to the start of the source byte array (S). \param Dest Pointer to the start of the destination byte array (D). \param length The number of bytes in the source array. \param N Number of bit-positions to shift (N). Valid range is 0 to 8. \return Returns 0 for success or -1 for error. */ int SDL_imageFilterShiftRight(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char N) { static unsigned char Mask[8] = { 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F }; unsigned int i, istart; unsigned char *cursrc1; unsigned char *curdest; /* Validate input parameters */ if ((Src1 == NULL) || (Dest == NULL)) return(-1); if (length == 0) return(0); /* Check shift */ if (N > 8) { return (-1); } /* Special case: N==0 */ if (N == 0) { memcpy(Src1, Dest, length); return (0); } if ((SDL_imageFilterMMXdetect()) && (length > 7)) { /* MMX routine */ SDL_imageFilterShiftRightMMX(Src1, Dest, length, N, Mask); /* Check for unaligned bytes */ if ((length & 7) > 0) { /* Setup to process unaligned bytes */ istart = length & 0xfffffff8; cursrc1 = &Src1[istart]; curdest = &Dest[istart]; } else { /* No unaligned bytes - we are done */ return (0); } } else { /* Setup to process whole image */ istart = 0; cursrc1 = Src1; curdest = Dest; } /* C routine to process image */ for (i = istart; i < length; i++) { *curdest = (unsigned char) *cursrc1 >> N; /* Advance pointers */ cursrc1++; curdest++; } return (0); } /*! \brief Internal MMX Filter using ShiftRightUint: D = saturation0((uint)S[i] >> N) \param Src1 Pointer to the start of the source byte array (S1). \param Dest Pointer to the start of the destination byte array (D). \param SrcLength The number of bytes in the source array. \param N Number of bit-positions to shift (N). \return Returns 0 for success or -1 for error. */ static int SDL_imageFilterShiftRightUintMMX(unsigned char *Src1, unsigned char *Dest, unsigned int SrcLength, unsigned char N) { #ifdef USE_MMX #if !defined(GCC__) __asm { pusha mov eax, Src1 /* load Src1 address into eax */ mov edi, Dest /* load Dest address into edi */ mov ecx, SrcLength /* load loop counter (SIZE) into ecx */ shr ecx, 3 /* counter/8 (MMX loads 8 bytes at a time) */ align 16 /* 16 byte alignment of the loop entry */ L13023: movq mm0, [eax] /* load 8 bytes from SrcDest into MM0 */ psrld mm0, N movq [edi], mm0 /* store result in SrcDest */ add eax, 8 /* increase Src1 register pointer by 8 */ add edi, 8 /* increase Dest register pointer by 8 */ dec ecx /* decrease loop counter */ jnz L13023 /* check loop termination, proceed if required */ emms /* exit MMX state */ popa } #else # 2567 "SDL2_imageFilter.c" /* i386 and x86_64 */ __m64 *mSrc1 = (__m64*)Src1; __m64 *mDest = (__m64*)Dest; int i; for (i = 0; i < SrcLength/8; i++) { *mDest = _m_psrldi(*mSrc1, N); mSrc1++; mDest++; } _m_empty(); /* clean MMX state */ #endif # 2578 "SDL2_imageFilter.c" return (0); #else # 2580 "SDL2_imageFilter.c" return (-1); #endif # 2582 "SDL2_imageFilter.c" } /*! \brief Filter using ShiftRightUint: D = saturation0((uint)S[i] >> N) \param Src1 Pointer to the start of the source byte array (S1). \param Dest Pointer to the start of the destination byte array (D). \param length The number of bytes in the source array. \param N Number of bit-positions to shift (N). Valid range is 0 to 32. \return Returns 0 for success or -1 for error. */ int SDL_imageFilterShiftRightUint(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char N) { unsigned int i, istart; unsigned char *cursrc1, *curdest; unsigned int *icursrc1, *icurdest; unsigned int result; /* Validate input parameters */ if ((Src1 == NULL) || (Dest == NULL)) return(-1); if (length == 0) return(0); if (N > 32) { return (-1); } /* Special case: N==0 */ if (N == 0) { memcpy(Src1, Dest, length); return (0); } if ((SDL_imageFilterMMXdetect()) && (length > 7)) { SDL_imageFilterShiftRightUintMMX(Src1, Dest, length, N); /* Check for unaligned bytes */ if ((length & 7) > 0) { /* Setup to process unaligned bytes */ istart = length & 0xfffffff8; cursrc1 = &Src1[istart]; curdest = &Dest[istart]; } else { /* No unaligned bytes - we are done */ return (0); } } else { /* Setup to process whole image */ istart = 0; cursrc1 = Src1; curdest = Dest; } /* C routine to process image */ icursrc1=(unsigned int *)cursrc1; icurdest=(unsigned int *)curdest; for (i = istart; i < length; i += 4) { if ((i+4)> N); *icurdest = result; } /* Advance pointers */ icursrc1++; icurdest++; } return (0); } /*! \brief Internal MMX Filter using MultByByte: D = saturation255(S * C) \param Src1 Pointer to the start of the source byte array (S). \param Dest Pointer to the start of the destination byte array (D). \param SrcLength The number of bytes in the source array. \param C Constant to multiply with (C). \return Returns 0 for success or -1 for error. */ static int SDL_imageFilterMultByByteMMX(unsigned char *Src1, unsigned char *Dest, unsigned int SrcLength, unsigned char C) { #ifdef USE_MMX #if !defined(GCC__) __asm { pusha /* ** Duplicate C in 4 words of MM1 ** */ mov al, C /* load C into AL */ xor ah, ah /* zero AH */ mov bx, ax /* copy AX into BX */ shl eax, 16 /* shift 2 bytes of EAX left */ mov ax, bx /* copy BX into AX */ movd mm1, eax /* copy EAX into MM1 */ movd mm2, eax /* copy EAX into MM2 */ punpckldq mm1, mm2 /* fill higher words of MM1 with C */ pxor mm0, mm0 /* zero MM0 register */ mov eax, Src1 /* load Src1 address into eax */ mov edi, Dest /* load Dest address into edi */ mov ecx, SrcLength /* load loop counter (SIZE) into ecx */ shr ecx, 3 /* counter/8 (MMX loads 8 bytes at a time) */ cmp al, 128 /* if (C <= 128) execute more efficient code */ jg L10251 align 16 /* 16 byte alignment of the loop entry */ L10250: movq mm3, [eax] /* load 8 bytes from Src1 into MM3 */ movq mm4, mm3 /* copy MM3 into MM4 */ punpcklbw mm3, mm0 /* unpack low bytes of SrcDest into words */ punpckhbw mm4, mm0 /* unpack high bytes of SrcDest into words */ pmullw mm3, mm1 /* mul low bytes of SrcDest and MM1 */ pmullw mm4, mm1 /* mul high bytes of SrcDest and MM1 */ packuswb mm3, mm4 /* pack words back into bytes with saturation */ movq [edi], mm3 /* store result in Dest */ add eax, 8 /* increase Src1 register pointer by 8 */ add edi, 8 /* increase Dest register pointer by 8 */ dec ecx /* decrease loop counter */ jnz L10250 /* check loop termination, proceed if required */ jmp L10252 align 16 /* 16 byte alignment of the loop entry */ L10251: movq mm3, [eax] /* load 8 bytes from Src1 into MM3 */ movq mm4, mm3 /* copy MM3 into MM4 */ punpcklbw mm3, mm0 /* unpack low bytes of SrcDest into words */ punpckhbw mm4, mm0 /* unpack high bytes of SrcDest into words */ pmullw mm3, mm1 /* mul low bytes of SrcDest and MM1 */ pmullw mm4, mm1 /* mul high bytes of SrcDest and MM1 */ /* ** Take abs value of the results (signed words) ** */ movq mm5, mm3 /* copy mm3 into mm5 */ movq mm6, mm4 /* copy mm4 into mm6 */ psraw mm5, 15 /* fill mm5 words with word sign bit */ psraw mm6, 15 /* fill mm6 words with word sign bit */ pxor mm3, mm5 /* take 1's compliment of only neg words */ pxor mm4, mm6 /* take 1's compliment of only neg words */ psubsw mm3, mm5 /* add 1 to only neg words, W-(-1) or W-0 */ psubsw mm4, mm6 /* add 1 to only neg words, W-(-1) or W-0 */ packuswb mm3, mm4 /* pack words back into bytes with saturation */ movq [edi], mm3 /* store result in Dest */ add eax, 8 /* increase Src1 register pointer by 8 */ add edi, 8 /* increase Dest register pointer by 8 */ dec ecx /* decrease loop counter */ jnz L10251 /* check loop termination, proceed if required */ L10252: emms /* exit MMX state */ popa } #else # 2730 "SDL2_imageFilter.c" /* i386 and x86_64 */ __m64 *mSrc1 = (__m64*)Src1; __m64 *mDest = (__m64*)Dest; __m64 mm0 = _m_from_int(0); /* zero mm0 register */ /* Duplicate C in 4 words of MM1 */ int i; i = C | C<<16; __m64 mm1 = _m_from_int(i); __m64 mm2 = _m_from_int(i); mm1 = _m_punpckldq(mm1, mm2); /* fill higher words of MM1 with C */ // long long lli = C | C<<16 | (long long)C<<32 | (long long)C<<48; //__m64 mm1 = _m_from_int64(lli); // x86_64 only if (C <= 128) { /* if (C <= 128) execute more efficient code */ for (i = 0; i < SrcLength/8; i++) { __m64 mm3, mm4; mm3 = _m_punpcklbw(*mSrc1, mm0); /* unpack low bytes of Src1 into words */ mm4 = _m_punpckhbw(*mSrc1, mm0); /* unpack high bytes of Src1 into words */ mm3 = _m_pmullw(mm3, mm1); /* mul low bytes of Src1 and MM1 */ mm4 = _m_pmullw(mm4, mm1); /* mul high bytes of Src1 and MM1 */ *mDest = _m_packuswb(mm3, mm4); /* pack words back into bytes with saturation */ mSrc1++; mDest++; } } else { for (i = 0; i < SrcLength/8; i++) { __m64 mm3, mm4, mm5, mm6; mm3 = _m_punpcklbw(*mSrc1, mm0); /* unpack low bytes of Src1 into words */ mm4 = _m_punpckhbw(*mSrc1, mm0); /* unpack high bytes of Src1 into words */ mm3 = _m_pmullw(mm3, mm1); /* mul low bytes of Src1 and MM1 */ mm4 = _m_pmullw(mm4, mm1); /* mul high bytes of Src1 and MM1 */ /* Take abs value of the results (signed words) */ mm5 = _m_psrawi(mm3, 15); /* fill mm5 words with word sign bit */ mm6 = _m_psrawi(mm4, 15); /* fill mm6 words with word sign bit */ mm3 = _m_pxor(mm3, mm5); /* take 1's compliment of only neg. words */ mm4 = _m_pxor(mm4, mm6); /* take 1's compliment of only neg. words */ mm3 = _m_psubsw(mm3, mm5); /* add 1 to only neg. words, W-(-1) or W-0 */ mm4 = _m_psubsw(mm4, mm6); /* add 1 to only neg. words, W-(-1) or W-0 */ *mDest = _m_packuswb(mm3, mm4); /* pack words back into bytes with saturation */ mSrc1++; mDest++; } } _m_empty(); /* clean MMX state */ #endif # 2774 "SDL2_imageFilter.c" return (0); #else # 2776 "SDL2_imageFilter.c" return (-1); #endif # 2778 "SDL2_imageFilter.c" } /*! \brief Filter using MultByByte: D = saturation255(S * C) \param Src1 Pointer to the start of the source byte array (S). \param Dest Pointer to the start of the destination byte array (D). \param length The number of bytes in the source arrays. \param C Constant to multiply with (C). \return Returns 0 for success or -1 for error. */ int SDL_imageFilterMultByByte(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char C) { unsigned int i, istart; int iC; unsigned char *cursrc1; unsigned char *curdest; int result; /* Validate input parameters */ if ((Src1 == NULL) || (Dest == NULL)) return(-1); if (length == 0) return(0); /* Special case: C==1 */ if (C == 1) { memcpy(Src1, Dest, length); return (0); } if ((SDL_imageFilterMMXdetect()) && (length > 7)) { SDL_imageFilterMultByByteMMX(Src1, Dest, length, C); /* Check for unaligned bytes */ if ((length & 7) > 0) { /* Setup to process unaligned bytes */ istart = length & 0xfffffff8; cursrc1 = &Src1[istart]; curdest = &Dest[istart]; } else { /* No unaligned bytes - we are done */ return (0); } } else { /* Setup to process whole image */ istart = 0; cursrc1 = Src1; curdest = Dest; } /* C routine to process image */ iC = (int) C; for (i = istart; i < length; i++) { result = (int) *cursrc1 * iC; if (result > 255) result = 255; *curdest = (unsigned char) result; /* Advance pointers */ cursrc1++; curdest++; } return (0); } /*! \brief Internal MMX Filter using ShiftRightAndMultByByteMMX: D = saturation255((S >> N) * C) \param Src1 Pointer to the start of the source byte array (S). \param Dest Pointer to the start of the destination byte array (D). \param SrcLength The number of bytes in the source array. \param N Number of bit-positions to shift (N). Valid range is 0 to 8. \param C Constant to multiply with (C). \return Returns 0 for success or -1 for error. */ static int SDL_imageFilterShiftRightAndMultByByteMMX(unsigned char *Src1, unsigned char *Dest, unsigned int SrcLength, unsigned char N, unsigned char C) { #ifdef USE_MMX #if !defined(GCC__) __asm { pusha /* ** Duplicate C in 4 words of MM1 ** */ mov al, C /* load C into AL */ xor ah, ah /* zero AH */ mov bx, ax /* copy AX into BX */ shl eax, 16 /* shift 2 bytes of EAX left */ mov ax, bx /* copy BX into AX */ movd mm1, eax /* copy EAX into MM1 */ movd mm2, eax /* copy EAX into MM2 */ punpckldq mm1, mm2 /* fill higher words of MM1 with C */ xor ecx, ecx /* zero ECX */ mov cl, N /* load N into CL */ movd mm7, ecx /* copy N into MM7 */ pxor mm0, mm0 /* zero MM0 register */ mov eax, Src1 /* load Src1 address into eax */ mov edi, Dest /* load Dest address into edi */ mov ecx, SrcLength /* load loop counter (SIZE) into ecx */ shr ecx, 3 /* counter/8 (MMX loads 8 bytes at a time) */ align 16 /* 16 byte alignment of the loop entry */ L1026: movq mm3, [eax] /* load 8 bytes from Src1 into MM3 */ movq mm4, mm3 /* copy MM3 into MM4 */ punpcklbw mm3, mm0 /* unpack low bytes of SrcDest into words */ punpckhbw mm4, mm0 /* unpack high bytes of SrcDest into words */ psrlw mm3, mm7 /* shift 4 WORDS of MM3 (N) bits to the right */ psrlw mm4, mm7 /* shift 4 WORDS of MM4 (N) bits to the right */ pmullw mm3, mm1 /* mul low bytes of SrcDest by MM1 */ pmullw mm4, mm1 /* mul high bytes of SrcDest by MM1 */ packuswb mm3, mm4 /* pack words back into bytes with saturation */ movq [edi], mm3 /* store result in Dest */ add eax, 8 /* increase Src1 register pointer by 8 */ add edi, 8 /* increase Dest register pointer by 8 */ dec ecx /* decrease loop counter */ jnz L1026 /* check loop termination, proceed if required */ emms /* exit MMX state */ popa } #else # 2902 "SDL2_imageFilter.c" /* i386 and x86_64 */ __m64 *mSrc1 = (__m64*)Src1; __m64 *mDest = (__m64*)Dest; __m64 mm0 = _m_from_int(0); /* zero mm0 register */ /* Duplicate C in 4 words of MM1 */ int i; i = (C<<16)|C; __m64 mm1 = _m_from_int(i); __m64 mm2 = _m_from_int(i); mm1 = _m_punpckldq(mm1, mm2); /* fill higher words of MM1 with C */ for (i = 0; i < SrcLength/8; i++) { __m64 mm3, mm4, mm5, mm6; mm3 = _m_punpcklbw(*mSrc1, mm0); /* unpack low bytes of Src1 into words */ mm4 = _m_punpckhbw(*mSrc1, mm0); /* unpack high bytes of Src1 into words */ mm3 = _m_psrlwi(mm3, N); /* shift 4 WORDS of MM3 (N) bits to the right */ mm4 = _m_psrlwi(mm4, N); /* shift 4 WORDS of MM4 (N) bits to the right */ mm3 = _m_pmullw(mm3, mm1); /* mul low bytes of Src1 and MM1 */ mm4 = _m_pmullw(mm4, mm1); /* mul high bytes of Src1 and MM1 */ *mDest = _m_packuswb(mm3, mm4); /* pack words back into bytes with saturation */ mSrc1++; mDest++; } _m_empty(); /* clean MMX state */ #endif # 2926 "SDL2_imageFilter.c" return (0); #else # 2928 "SDL2_imageFilter.c" return (-1); #endif # 2930 "SDL2_imageFilter.c" } /*! \brief Filter using ShiftRightAndMultByByte: D = saturation255((S >> N) * C) \param Src1 Pointer to the start of the source byte array (S). \param Dest Pointer to the start of the destination byte array (D). \param length The number of bytes in the source array. \param N Number of bit-positions to shift (N). Valid range is 0 to 8. \param C Constant to multiply with (C). \return Returns 0 for success or -1 for error. */ int SDL_imageFilterShiftRightAndMultByByte(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char N, unsigned char C) { unsigned int i, istart; int iC; unsigned char *cursrc1; unsigned char *curdest; int result; /* Validate input parameters */ if ((Src1 == NULL) || (Dest == NULL)) return(-1); if (length == 0) return(0); /* Check shift */ if (N > 8) { return (-1); } /* Special case: N==0 && C==1 */ if ((N == 0) && (C == 1)) { memcpy(Src1, Dest, length); return (0); } if ((SDL_imageFilterMMXdetect()) && (length > 7)) { SDL_imageFilterShiftRightAndMultByByteMMX(Src1, Dest, length, N, C); /* Check for unaligned bytes */ if ((length & 7) > 0) { /* Setup to process unaligned bytes */ istart = length & 0xfffffff8; cursrc1 = &Src1[istart]; curdest = &Dest[istart]; } else { /* No unaligned bytes - we are done */ return (0); } } else { /* Setup to process whole image */ istart = 0; cursrc1 = Src1; curdest = Dest; } /* C routine to process image */ iC = (int) C; for (i = istart; i < length; i++) { result = (int) (*cursrc1 >> N) * iC; if (result > 255) result = 255; *curdest = (unsigned char) result; /* Advance pointers */ cursrc1++; curdest++; } return (0); } /*! \brief Internal MMX Filter using ShiftLeftByte: D = (S << N) \param Src1 Pointer to the start of the source byte array (S). \param Dest Pointer to the start of the destination byte array (D). \param SrcLength The number of bytes in the source arrays. \param N Number of bit-positions to shift (N). Valid range is 0 to 8. \param Mask Byte array containing 8 bytes of 0xFE value. \return Returns 0 for success or -1 for error. */ static int SDL_imageFilterShiftLeftByteMMX(unsigned char *Src1, unsigned char *Dest, unsigned int SrcLength, unsigned char N, unsigned char *Mask) { #ifdef USE_MMX #if !defined(GCC__) __asm { pusha mov edx, Mask /* load Mask address into edx */ movq mm0, [edx] /* load Mask into mm0 */ xor ecx, ecx /* zero ECX */ mov cl, N /* load loop counter (N) into CL */ movd mm3, ecx /* copy (N) into MM3 */ pcmpeqb mm1, mm1 /* generate all 1's in mm1 */ L10270: /* ** Prepare proper bit-Mask in MM1 ** */ psllw mm1, 1 /* shift 4 WORDS of MM1 1 bit to the left */ pand mm1, mm0 // apply Mask to 8 BYTES of MM1 */ /* byte 0x0f, 0xdb, 0xc8 */ dec cl /* decrease loop counter */ jnz L10270 /* check loop termination, proceed if required */ /* ** Shift all bytes of the image ** */ mov eax, Src1 /* load Src1 address into eax */ mov edi, Dest /* load SrcDest address into edi */ mov ecx, SrcLength /* load loop counter (SIZE) into ecx */ shr ecx, 3 /* counter/8 (MMX loads 8 bytes at a time) */ align 16 /* 16 byte alignment of the loop entry */ L10271: movq mm0, [eax] /* load 8 bytes from Src1 into MM0 */ psllw mm0, mm3 /* shift 4 WORDS of MM0 (N) bits to the left */ pand mm0, mm1 // apply proper bit-Mask to 8 BYTES of MM0 */ /* byte 0x0f, 0xdb, 0xc1 */ movq [edi], mm0 /* store result in Dest */ add eax, 8 /* increase Src1 register pointer by 8 */ add edi, 8 /* increase Dest register pointer by 8 */ dec ecx /* decrease loop counter */ jnz L10271 /* check loop termination, proceed if required */ emms /* exit MMX state */ popa } #else # 3056 "SDL2_imageFilter.c" /* i386 and x86_64 */ __m64 *mSrc1 = (__m64*)Src1; __m64 *mDest = (__m64*)Dest; __m64 *mMask = (__m64*)Mask; __m64 mm1; int i; mm1 = _m_pcmpeqb(mm1, mm1); /* generate all 1's in mm1 */ /* Prepare proper bit-Mask in MM1 */ for (i = 0; i < N; i++) { mm1 = _m_psllwi(mm1, 1); /* shift 4 WORDS of MM1 1 bit to the left */ mm1 = _m_pand(mm1, *mMask); /* apply Mask to 8 BYTES of MM1 */ } /* ** Shift all bytes of the image ** */ for (i = 0; i < SrcLength/8; i++) { __m64 mm0 = _m_psllwi(*mSrc1, N); /* shift 4 WORDS of MM0 (N) bits to the left */ *mDest = _m_pand(mm0, mm1); /* apply proper bit-Mask to 8 BYTES of MM0 */ mSrc1++; mDest++; } _m_empty(); /* clean MMX state */ #endif # 3077 "SDL2_imageFilter.c" return (0); #else # 3079 "SDL2_imageFilter.c" return (-1); #endif # 3081 "SDL2_imageFilter.c" } /*! \brief Filter using ShiftLeftByte: D = (S << N) \param Src1 Pointer to the start of the source byte array (S). \param Dest Pointer to the start of the destination byte array (D). \param length The number of bytes in the source arrays. \param N Number of bit-positions to shift (N). Valid range is 0 to 8. \return Returns 0 for success or -1 for error. */ int SDL_imageFilterShiftLeftByte(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char N) { static unsigned char Mask[8] = { 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE }; unsigned int i, istart; unsigned char *cursrc1, *curdest; int result; /* Validate input parameters */ if ((Src1 == NULL) || (Dest == NULL)) return(-1); if (length == 0) return(0); if (N > 8) { return (-1); } /* Special case: N==0 */ if (N == 0) { memcpy(Src1, Dest, length); return (0); } if ((SDL_imageFilterMMXdetect()) && (length > 7)) { SDL_imageFilterShiftLeftByteMMX(Src1, Dest, length, N, Mask); /* Check for unaligned bytes */ if ((length & 7) > 0) { /* Setup to process unaligned bytes */ istart = length & 0xfffffff8; cursrc1 = &Src1[istart]; curdest = &Dest[istart]; } else { /* No unaligned bytes - we are done */ return (0); } } else { /* Setup to process whole image */ istart = 0; cursrc1 = Src1; curdest = Dest; } /* C routine to process image */ for (i = istart; i < length; i++) { result = ((int) *cursrc1 << N) & 0xff; *curdest = (unsigned char) result; /* Advance pointers */ cursrc1++; curdest++; } return (0); } /*! \brief Internal MMX Filter using ShiftLeftUint: D = ((uint)S << N) \param Src1 Pointer to the start of the source byte array (S). \param Dest Pointer to the start of the destination byte array (D). \param SrcLength The number of bytes in the source array. \param N Number of bit-positions to shift (N). Valid range is 0 to 32. \return Returns 0 for success or -1 for error. */ static int SDL_imageFilterShiftLeftUintMMX(unsigned char *Src1, unsigned char *Dest, unsigned int SrcLength, unsigned char N) { #ifdef USE_MMX #if !defined(GCC__) __asm { pusha mov eax, Src1 /* load Src1 address into eax */ mov edi, Dest /* load Dest address into edi */ mov ecx, SrcLength /* load loop counter (SIZE) into ecx */ shr ecx, 3 /* counter/8 (MMX loads 8 bytes at a time) */ align 16 /* 16 byte alignment of the loop entry */ L12023: movq mm0, [eax] /* load 8 bytes from SrcDest into MM0 */ pslld mm0, N /* MM0=SrcDest+C (add 8 bytes with saturation) */ movq [edi], mm0 /* store result in SrcDest */ add eax, 8 /* increase Src1 register pointer by 8 */ add edi, 8 /* increase Dest register pointer by 8 */ dec ecx /* decrease loop counter */ jnz L12023 /* check loop termination, proceed if required */ emms /* exit MMX state */ popa } #else # 3183 "SDL2_imageFilter.c" /* i386 and x86_64 */ __m64 *mSrc1 = (__m64*)Src1; __m64 *mDest = (__m64*)Dest; int i; for (i = 0; i < SrcLength/8; i++) { *mDest = _m_pslldi(*mSrc1, N); /* Src1+C (add 8 bytes with saturation) */ mSrc1++; mDest++; } _m_empty(); /* clean MMX state */ #endif # 3194 "SDL2_imageFilter.c" return (0); #else # 3196 "SDL2_imageFilter.c" return (-1); #endif # 3198 "SDL2_imageFilter.c" } /*! \brief Filter using ShiftLeftUint: D = ((uint)S << N) \param Src1 Pointer to the start of the source byte array (S). \param Dest Pointer to the start of the destination byte array (D). \param length The number of bytes in the source array. \param N Number of bit-positions to shift (N). Valid range is 0 to 32. \return Returns 0 for success or -1 for error. */ int SDL_imageFilterShiftLeftUint(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char N) { unsigned int i, istart; unsigned char *cursrc1, *curdest; unsigned int *icursrc1, *icurdest; unsigned int result; /* Validate input parameters */ if ((Src1 == NULL) || (Dest == NULL)) return(-1); if (length == 0) return(0); if (N > 32) { return (-1); } /* Special case: N==0 */ if (N == 0) { memcpy(Src1, Dest, length); return (0); } if ((SDL_imageFilterMMXdetect()) && (length > 7)) { SDL_imageFilterShiftLeftUintMMX(Src1, Dest, length, N); /* Check for unaligned bytes */ if ((length & 7) > 0) { /* Setup to process unaligned bytes */ istart = length & 0xfffffff8; cursrc1 = &Src1[istart]; curdest = &Dest[istart]; } else { /* No unaligned bytes - we are done */ return (0); } } else { /* Setup to process whole image */ istart = 0; cursrc1 = Src1; curdest = Dest; } /* C routine to process image */ icursrc1=(unsigned int *)cursrc1; icurdest=(unsigned int *)curdest; for (i = istart; i < length; i += 4) { if ((i+4) 8) { return (-1); } /* Special case: N==0 */ if (N == 0) { memcpy(Src1, Dest, length); return (0); } if ((SDL_imageFilterMMXdetect()) && (length > 7)) { SDL_imageFilterShiftLeftMMX(Src1, Dest, length, N); /* Check for unaligned bytes */ if ((length & 7) > 0) { /* Setup to process unaligned bytes */ istart = length & 0xfffffff8; cursrc1 = &Src1[istart]; curdest = &Dest[istart]; } else { /* No unaligned bytes - we are done */ return (0); } } else { /* Setup to process whole image */ istart = 0; cursrc1 = Src1; curdest = Dest; } /* C routine to process image */ for (i = istart; i < length; i++) { result = (int) *cursrc1 << N; if (result > 255) result = 255; *curdest = (unsigned char) result; /* Advance pointers */ cursrc1++; curdest++; } return (0); } /*! \brief MMX BinarizeUsingThreshold: D = (S >= T) ? 255:0 \param Src1 Pointer to the start of the source byte array (S). \param Dest Pointer to the start of the destination byte array (D). \param SrcLength The number of bytes in the source array. \param T The threshold boundary (inclusive). \return Returns 0 for success or -1 for error. */ static int SDL_imageFilterBinarizeUsingThresholdMMX(unsigned char *Src1, unsigned char *Dest, unsigned int SrcLength, unsigned char T) { #ifdef USE_MMX #if !defined(GCC__) __asm { pusha /* ** Duplicate T in 8 bytes of MM3 ** */ pcmpeqb mm1, mm1 /* generate all 1's in mm1 */ pcmpeqb mm2, mm2 /* generate all 1's in mm2 */ mov al, T /* load T into AL */ mov ah, al /* copy AL into AH */ mov bx, ax /* copy AX into BX */ shl eax, 16 /* shift 2 bytes of EAX left */ mov ax, bx /* copy BX into AX */ movd mm3, eax /* copy EAX into MM3 */ movd mm4, eax /* copy EAX into MM4 */ punpckldq mm3, mm4 /* fill higher bytes of MM3 with T */ psubusb mm2, mm3 /* store 0xFF - T in MM2 */ mov eax, Src1 /* load Src1 address into eax */ mov edi, Dest /* load Dest address into edi */ mov ecx, SrcLength /* load loop counter (SIZE) into ecx */ shr ecx, 3 /* counter/8 (MMX loads 8 bytes at a time) */ align 16 /* 16 byte alignment of the loop entry */ L1029: movq mm0, [eax] /* load 8 bytes from SrcDest into MM0 */ paddusb mm0, mm2 /* MM0=SrcDest+(0xFF-T) (add 8 bytes with saturation) */ pcmpeqb mm0, mm1 /* binarize 255:0, comparing to 255 */ movq [edi], mm0 /* store result in SrcDest */ add eax, 8 /* increase Src1 register pointer by 8 */ add edi, 8 /* increase Dest register pointer by 8 */ dec ecx /* decrease loop counter */ jnz L1029 /* check loop termination, proceed if required */ emms /* exit MMX state */ popa } #else # 3497 "SDL2_imageFilter.c" /* i386 and x86_64 */ __m64 *mSrc1 = (__m64*)Src1; __m64 *mDest = (__m64*)Dest; /* Duplicate T in 8 bytes of MM3 */ __m64 mm1 = _m_pcmpeqb(mm1, mm1); /* generate all 1's in mm1 */ __m64 mm2 = _m_pcmpeqb(mm2, mm2); /* generate all 1's in mm1 */ int i; memset(&i, T, 4); __m64 mm3 = _m_from_int(i); __m64 mm4 = _m_from_int(i); mm3 = _m_punpckldq(mm3, mm4); /* fill higher bytes of MM3 with T */ mm2 = _m_psubusb(mm2, mm3); /* store 0xFF - T in MM2 */ //__m64 mm3 = _m_from_int64(lli); // x86_64 only for (i = 0; i < SrcLength/8; i++) { __m64 mm0 = _m_paddusb(*mSrc1, mm2); /* Src1+(0xFF-T) (add 8 bytes with saturation) */ *mDest = _m_pcmpeqb(mm0, mm1); /* binarize 255:0, comparing to 255 */ mSrc1++; mDest++; } _m_empty(); /* clean MMX state */ #endif # 3518 "SDL2_imageFilter.c" return (0); #else # 3520 "SDL2_imageFilter.c" return (-1); #endif # 3522 "SDL2_imageFilter.c" } /*! \brief Filter using BinarizeUsingThreshold: D = (S >= T) ? 255:0 \param Src1 Pointer to the start of the source byte array (S). \param Dest Pointer to the start of the destination byte array (D). \param length The number of bytes in the source array. \param T The threshold boundary (inclusive). \return Returns 0 for success or -1 for error. */ int SDL_imageFilterBinarizeUsingThreshold(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char T) { unsigned int i, istart; unsigned char *cursrc1; unsigned char *curdest; /* Validate input parameters */ if ((Src1 == NULL) || (Dest == NULL)) return(-1); if (length == 0) return(0); /* Special case: T==0 */ if (T == 0) { memset(Dest, 255, length); return (0); } if ((SDL_imageFilterMMXdetect()) && (length > 7)) { SDL_imageFilterBinarizeUsingThresholdMMX(Src1, Dest, length, T); /* Check for unaligned bytes */ if ((length & 7) > 0) { /* Setup to process unaligned bytes */ istart = length & 0xfffffff8; cursrc1 = &Src1[istart]; curdest = &Dest[istart]; } else { /* No unaligned bytes - we are done */ return (0); } } else { /* Setup to process whole image */ istart = 0; cursrc1 = Src1; curdest = Dest; } /* C routine to process image */ for (i = istart; i < length; i++) { *curdest = (unsigned char)(((unsigned char)*cursrc1 >= T) ? 255 : 0); /* Advance pointers */ cursrc1++; curdest++; } return (0); } /*! \brief Internal MMX Filter using ClipToRange: D = (S >= Tmin) & (S <= Tmax) S:Tmin | Tmax \param Src1 Pointer to the start of the source byte array (S). \param Dest Pointer to the start of the destination byte array (D). \param SrcLength The number of bytes in the source array. \param Tmin Lower (inclusive) boundary of the clipping range. \param Tmax Upper (inclusive) boundary of the clipping range. \return Returns 0 for success or -1 for error. */ static int SDL_imageFilterClipToRangeMMX(unsigned char *Src1, unsigned char *Dest, unsigned int SrcLength, unsigned char Tmin, unsigned char Tmax) { #ifdef USE_MMX #if !defined(GCC__) __asm { pusha pcmpeqb mm1, mm1 /* generate all 1's in mm1 */ /* ** Duplicate Tmax in 8 bytes of MM3 ** */ mov al, Tmax /* load Tmax into AL */ mov ah, al /* copy AL into AH */ mov bx, ax /* copy AX into BX */ shl eax, 16 /* shift 2 bytes of EAX left */ mov ax, bx /* copy BX into AX */ movd mm3, eax /* copy EAX into MM3 */ movd mm4, eax /* copy EAX into MM4 */ punpckldq mm3, mm4 /* fill higher bytes of MM3 with Tmax */ psubusb mm1, mm3 /* store 0xFF - Tmax in MM1 */ /* ** Duplicate Tmin in 8 bytes of MM5 ** */ mov al, Tmin /* load Tmin into AL */ mov ah, al /* copy AL into AH */ mov bx, ax /* copy AX into BX */ shl eax, 16 /* shift 2 bytes of EAX left */ mov ax, bx /* copy BX into AX */ movd mm5, eax /* copy EAX into MM5 */ movd mm4, eax /* copy EAX into MM4 */ punpckldq mm5, mm4 /* fill higher bytes of MM5 with Tmin */ movq mm7, mm5 /* copy MM5 into MM7 */ paddusb mm7, mm1 /* store 0xFF - Tmax + Tmin in MM7 */ mov eax, Src1 /* load Src1 address into eax */ mov edi, Dest /* load Dest address into edi */ mov ecx, SrcLength /* load loop counter (SIZE) into ecx */ shr ecx, 3 /* counter/8 (MMX loads 8 bytes at a time) */ align 16 /* 16 byte alignment of the loop entry */ L1030: movq mm0, [eax] /* load 8 bytes from Src1 into MM0 */ paddusb mm0, mm1 /* MM0=SrcDest+(0xFF-Tmax) */ psubusb mm0, mm7 /* MM0=MM0-(0xFF-Tmax+Tmin) */ paddusb mm0, mm5 /* MM0=MM0+Tmin */ movq [edi], mm0 /* store result in Dest */ add eax, 8 /* increase Src1 register pointer by 8 */ add edi, 8 /* increase Dest register pointer by 8 */ dec ecx /* decrease loop counter */ jnz L1030 /* check loop termination, proceed if required */ emms /* exit MMX state */ popa } #else # 3644 "SDL2_imageFilter.c" /* i386 and x86_64 */ __m64 *mSrc1 = (__m64*)Src1; __m64 *mDest = (__m64*)Dest; __m64 mm1 = _m_pcmpeqb(mm1, mm1); /* generate all 1's in mm1 */ int i; /* Duplicate Tmax in 8 bytes of MM3 */ __m64 mm3, mm4; memset(&i, Tmax, 4); mm3 = _m_from_int(i); mm4 = _m_from_int(i); mm3 = _m_punpckldq(mm3, mm4); /* fill higher bytes of MM3 with Tmax */ mm1 = _m_psubusb(mm1, mm3); /* store 0xFF - Tmax in MM1 */ //__m64 mm3 = _m_from_int64(lli); // x86_64 only /* Duplicate Tmax in 8 bytes of MM3 */ __m64 mm5, mm7; memset(&i, Tmin, 4); mm5 = _m_from_int(i); mm4 = _m_from_int(i); mm5 = _m_punpckldq(mm5, mm4); /* fill higher bytes of MM5 with Tmin */ mm7 = _m_paddusb(mm5, mm1); /* store 0xFF - Tmax + Tmin in MM7 */ for (i = 0; i < SrcLength/8; i++) { __m64 mm0; mm0 = _m_paddusb(*mSrc1, mm1); /* MM0=Src1+(0xFF-Tmax) */ mm0 = _m_psubusb(mm0, mm7); /* MM0=MM0-(0xFF-Tmax+Tmin) */ *mDest = _m_paddusb(mm0, mm5); /* MM0+Tmin */ mSrc1++; mDest++; } _m_empty(); /* clean MMX state */ #endif # 3674 "SDL2_imageFilter.c" return (0); #else # 3676 "SDL2_imageFilter.c" return (-1); #endif # 3678 "SDL2_imageFilter.c" } /*! \brief Filter using ClipToRange: D = (S >= Tmin) & (S <= Tmax) S:Tmin | Tmax \param Src1 Pointer to the start of the source byte array (S). \param Dest Pointer to the start of the destination byte array (D). \param length The number of bytes in the source array. \param Tmin Lower (inclusive) boundary of the clipping range. \param Tmax Upper (inclusive) boundary of the clipping range. \return Returns 0 for success or -1 for error. */ int SDL_imageFilterClipToRange(unsigned char *Src1, unsigned char *Dest, unsigned int length, unsigned char Tmin, unsigned char Tmax) { unsigned int i, istart; unsigned char *cursrc1; unsigned char *curdest; /* Validate input parameters */ if ((Src1 == NULL) || (Dest == NULL)) return(-1); if (length == 0) return(0); /* Special case: Tmin==0 && Tmax = 255 */ if ((Tmin == 0) && (Tmax == 25)) { memcpy(Src1, Dest, length); return (0); } if ((SDL_imageFilterMMXdetect()) && (length > 7)) { SDL_imageFilterClipToRangeMMX(Src1, Dest, length, Tmin, Tmax); /* Check for unaligned bytes */ if ((length & 7) > 0) { /* Setup to process unaligned bytes */ istart = length & 0xfffffff8; cursrc1 = &Src1[istart]; curdest = &Dest[istart]; } else { /* No unaligned bytes - we are done */ return (0); } } else { /* Setup to process whole image */ istart = 0; cursrc1 = Src1; curdest = Dest; } /* C routine to process image */ for (i = istart; i < length; i++) { if (*cursrc1 < Tmin) { *curdest = Tmin; } else if (*cursrc1 > Tmax) { *curdest = Tmax; } else { *curdest = *cursrc1; } /* Advance pointers */ cursrc1++; curdest++; } return (0); } /*! \brief Internal MMX Filter using NormalizeLinear: D = saturation255((Nmax - Nmin)/(Cmax - Cmin)*(S - Cmin) + Nmin) \param Src1 Pointer to the start of the source byte array (S). \param Dest Pointer to the start of the destination byte array (D). \param SrcLength The number of bytes in the source array. \param Cmin Normalization constant (Cmin). \param Cmax Normalization constant (Cmax). \param Nmin Normalization constant (Nmin). \param Nmax Normalization constant (Nmax). \return Returns 0 for success or -1 for error. */ static int SDL_imageFilterNormalizeLinearMMX(unsigned char *Src1, unsigned char *Dest, unsigned int SrcLength, int Cmin, int Cmax, int Nmin, int Nmax) { #ifdef USE_MMX #if !defined(GCC__) __asm { pusha mov ax, WORD PTR Nmax /* load Nmax in AX */ mov bx, WORD PTR Cmax /* load Cmax in BX */ sub ax, WORD PTR Nmin /* AX = Nmax - Nmin */ sub bx, WORD PTR Cmin /* BX = Cmax - Cmin */ jz L10311 /* check division by zero */ xor dx, dx /* prepare for division, zero DX */ div bx /* AX = AX/BX */ jmp L10312 L10311: mov ax, 255 /* if div by zero, assume result max byte value */ L10312: /* ** Duplicate AX in 4 words of MM0 ** */ mov bx, ax /* copy AX into BX */ shl eax, 16 /* shift 2 bytes of EAX left */ mov ax, bx /* copy BX into AX */ movd mm0, eax /* copy EAX into MM0 */ movd mm1, eax /* copy EAX into MM1 */ punpckldq mm0, mm1 /* fill higher words of MM0 with AX */ /* ** Duplicate Cmin in 4 words of MM1 ** */ mov ax, WORD PTR Cmin /* load Cmin into AX */ mov bx, ax /* copy AX into BX */ shl eax, 16 /* shift 2 bytes of EAX left */ mov ax, bx /* copy BX into AX */ movd mm1, eax /* copy EAX into MM1 */ movd mm2, eax /* copy EAX into MM2 */ punpckldq mm1, mm2 /* fill higher words of MM1 with Cmin */ /* ** Duplicate Nmin in 4 words of MM2 ** */ mov ax, WORD PTR Nmin /* load Nmin into AX */ mov bx, ax /* copy AX into BX */ shl eax, 16 /* shift 2 bytes of EAX left */ mov ax, bx /* copy BX into AX */ movd mm2, eax /* copy EAX into MM2 */ movd mm3, eax /* copy EAX into MM3 */ punpckldq mm2, mm3 /* fill higher words of MM2 with Nmin */ pxor mm7, mm7 /* zero MM7 register */ mov eax, Src1 /* load Src1 address into eax */ mov edi, Dest /* load Dest address into edi */ mov ecx, SrcLength /* load loop counter (SIZE) into ecx */ shr ecx, 3 /* counter/8 (MMX loads 8 bytes at a time) */ align 16 /* 16 byte alignment of the loop entry */ L1031: movq mm3, [eax] /* load 8 bytes from Src1 into MM3 */ movq mm4, mm3 /* copy MM3 into MM4 */ punpcklbw mm3, mm7 /* unpack low bytes of SrcDest into words */ punpckhbw mm4, mm7 /* unpack high bytes of SrcDest into words */ psubusb mm3, mm1 /* S-Cmin, low bytes */ psubusb mm4, mm1 /* S-Cmin, high bytes */ pmullw mm3, mm0 /* MM0*(S-Cmin), low bytes */ pmullw mm4, mm0 /* MM0*(S-Cmin), high bytes */ paddusb mm3, mm2 /* MM0*(S-Cmin)+Nmin, low bytes */ paddusb mm4, mm2 /* MM0*(S-Cmin)+Nmin, high bytes */ /* ** Take abs value of the signed words ** */ movq mm5, mm3 /* copy mm3 into mm5 */ movq mm6, mm4 /* copy mm4 into mm6 */ psraw mm5, 15 /* fill mm5 words with word sign bit */ psraw mm6, 15 /* fill mm6 words with word sign bit */ pxor mm3, mm5 /* take 1's compliment of only neg words */ pxor mm4, mm6 /* take 1's compliment of only neg words */ psubsw mm3, mm5 /* add 1 to only neg words, W-(-1) or W-0 */ psubsw mm4, mm6 /* add 1 to only neg words, W-(-1) or W-0 */ packuswb mm3, mm4 /* pack words back into bytes with saturation */ movq [edi], mm3 /* store result in Dest */ add eax, 8 /* increase Src1 register pointer by 8 */ add edi, 8 /* increase Dest register pointer by 8 */ dec ecx /* decrease loop counter */ jnz L1031 /* check loop termination, proceed if required */ emms /* exit MMX state */ popa } #else # 3838 "SDL2_imageFilter.c" /* i386 and x86_64 */ __m64 *mSrc1 = (__m64*)Src1; __m64 *mDest = (__m64*)Dest; __m64 mm0, mm1, mm2, mm3; int i; /* Duplicate (Nmax-Nmin)/(Cmax-Cmin) in 4 words of MM0 */ unsigned short a = Nmax - Nmin; unsigned short b = Cmax - Cmin; if (b == 0) { a = 255; } else { a /= b; } i = (a<<16)|a; mm0 = _m_from_int(i); mm1 = _m_from_int(i); mm0 = _m_punpckldq(mm0, mm1); /* fill higher words of MM0 with AX */ /* Duplicate Cmin in 4 words of MM1 */ i = (Cmin<<16)|(short)Cmin; mm1 = _m_from_int(i); mm2 = _m_from_int(i); mm1 = _m_punpckldq(mm1, mm2); /* fill higher words of MM1 with Cmin */ /* Duplicate Nmin in 4 words of MM2 */ i = (Nmin<<16)|(short)Nmin; mm2 = _m_from_int(i); mm3 = _m_from_int(i); mm2 = _m_punpckldq(mm2, mm3); /* fill higher words of MM2 with Nmin */ __m64 mm7 = _m_from_int(0); /* zero mm0 register */ for (i = 0; i < SrcLength/8; i++) { __m64 mm3, mm4, mm5, mm6; mm3 = _m_punpcklbw(*mSrc1, mm7); /* unpack low bytes of Src1 into words */ mm4 = _m_punpckhbw(*mSrc1, mm7); /* unpack high bytes of Src1 into words */ mm3 = _m_psubusb(mm3, mm1); /* S-Cmin, low bytes */ mm4 = _m_psubusb(mm4, mm1); /* S-Cmin, high bytes */ mm3 = _m_pmullw(mm3, mm0); /* MM0*(S-Cmin), low bytes */ mm4 = _m_pmullw(mm4, mm0); /* MM0*(S-Cmin), high bytes */ mm3 = _m_paddusb(mm3, mm2); /* MM0*(S-Cmin)+Nmin, low bytes */ mm4 = _m_paddusb(mm4, mm2); /* MM0*(S-Cmin)+Nmin, high bytes */ /* Take abs value of the signed words */ mm5 = _m_psrawi(mm3, 15); /* fill mm5 words with word sign bit */ mm6 = _m_psrawi(mm4, 15); /* fill mm6 words with word sign bit */ mm3 = _m_pxor(mm3, mm5); /* take 1's compliment of only neg. words */ mm4 = _m_pxor(mm4, mm6); /* take 1's compliment of only neg. words */ mm3 = _m_psubsw(mm3, mm5); /* add 1 to only neg. words, W-(-1) or W-0 */ mm4 = _m_psubsw(mm4, mm6); /* add 1 to only neg. words, W-(-1) or W-0 */ *mDest = _m_packuswb(mm3, mm4); /* pack words back into bytes with saturation */ mSrc1++; mDest++; } _m_empty(); /* clean MMX state */ #endif # 3890 "SDL2_imageFilter.c" return (0); #else # 3892 "SDL2_imageFilter.c" return (-1); #endif # 3894 "SDL2_imageFilter.c" } /*! \brief Filter using NormalizeLinear: D = saturation255((Nmax - Nmin)/(Cmax - Cmin)*(S - Cmin) + Nmin) \param Src Pointer to the start of the source byte array (S). \param Dest Pointer to the start of the destination byte array (D). \param length The number of bytes in the source array. \param Cmin Normalization constant. \param Cmax Normalization constant. \param Nmin Normalization constant. \param Nmax Normalization constant. \return Returns 0 for success or -1 for error. */ int SDL_imageFilterNormalizeLinear(unsigned char *Src, unsigned char *Dest, unsigned int length, int Cmin, int Cmax, int Nmin, int Nmax) { unsigned int i, istart; unsigned char *cursrc; unsigned char *curdest; int dN, dC, factor; int result; /* Validate input parameters */ if ((Src == NULL) || (Dest == NULL)) return(-1); if (length == 0) return(0); if ((SDL_imageFilterMMXdetect()) && (length > 7)) { SDL_imageFilterNormalizeLinearMMX(Src, Dest, length, Cmin, Cmax, Nmin, Nmax); /* Check for unaligned bytes */ if ((length & 7) > 0) { /* Setup to process unaligned bytes */ istart = length & 0xfffffff8; cursrc = &Src[istart]; curdest = &Dest[istart]; } else { /* No unaligned bytes - we are done */ return (0); } } else { /* Setup to process whole image */ istart = 0; cursrc = Src; curdest = Dest; } /* C routine to process image */ dC = Cmax - Cmin; if (dC == 0) return (0); dN = Nmax - Nmin; factor = dN / dC; for (i = istart; i < length; i++) { result = factor * ((int) (*cursrc) - Cmin) + Nmin; if (result > 255) result = 255; *curdest = (unsigned char) result; /* Advance pointers */ cursrc++; curdest++; } return (0); } /* ------------------------------------------------------------------------------------ */ /*! \brief Filter using ConvolveKernel3x3Divide: Dij = saturation0and255( ... ) \param Src The source 2D byte array to convolve. Should be different from destination. \param Dest The destination 2D byte array to store the result in. Should be different from source. \param rows Number of rows in source/destination array. Must be >2. \param columns Number of columns in source/destination array. Must be >2. \param Kernel The 2D convolution kernel of size 3x3. \param Divisor The divisor of the convolution sum. Must be >0. Note: Non-MMX implementation not available for this function. \return Returns 1 if filter was applied, 0 otherwise. */ int SDL_imageFilterConvolveKernel3x3Divide(unsigned char *Src, unsigned char *Dest, int rows, int columns, signed short *Kernel, unsigned char Divisor) { /* Validate input parameters */ if ((Src == NULL) || (Dest == NULL) || (Kernel == NULL)) return(-1); if ((columns < 3) || (rows < 3) || (Divisor == 0)) return (-1); if ((SDL_imageFilterMMXdetect())) { //#ifdef USE_MMX #if defined(USE_MMX) && defined(i386) #if !defined(GCC__) __asm { pusha pxor mm0, mm0 /* zero MM0 */ xor ebx, ebx /* zero EBX */ mov bl, Divisor /* load Divisor into BL */ mov edx, Kernel /* load Kernel address into EDX */ movq mm5, [edx] /* MM5 = {0,K2,K1,K0} */ add edx, 8 /* second row |K0 K1 K2 0| */ movq mm6, [edx] /* MM6 = {0,K5,K4,K3} K = |K3 K4 K5 0| */ add edx, 8 /* third row |K6 K7 K8 0| */ movq mm7, [edx] /* MM7 = {0,K8,K7,K6} */ /* ---, */ mov eax, columns /* load columns into EAX */ mov esi, Src /* ESI = Src row 0 address */ mov edi, Dest /* load Dest address to EDI */ add edi, eax /* EDI = EDI + columns */ inc edi /* 1 byte offset from the left edge */ mov edx, rows /* initialize ROWS counter */ sub edx, 2 /* do not use first and last row */ /* ---, */ L10320: mov ecx, eax /* initialize COLUMS counter */ sub ecx, 2 /* do not use first and last column */ align 16 /* 16 byte alignment of the loop entry */ L10322: /* ---, */ movq mm1, [esi] /* load 8 bytes of the image first row */ add esi, eax /* move one row below */ movq mm2, [esi] /* load 8 bytes of the image second row */ add esi, eax /* move one row below */ movq mm3, [esi] /* load 8 bytes of the image third row */ punpcklbw mm1, mm0 /* unpack first 4 bytes into words */ punpcklbw mm2, mm0 /* unpack first 4 bytes into words */ punpcklbw mm3, mm0 /* unpack first 4 bytes into words */ pmullw mm1, mm5 /* multiply words first row image*Kernel */ pmullw mm2, mm6 /* multiply words second row image*Kernel */ pmullw mm3, mm7 /* multiply words third row image*Kernel */ paddsw mm1, mm2 /* add 4 words of the first and second rows */ paddsw mm1, mm3 /* add 4 words of the third row and result */ movq mm2, mm1 /* copy MM1 into MM2 */ psrlq mm1, 32 /* shift 2 left words to the right */ paddsw mm1, mm2 /* add 2 left and 2 right result words */ movq mm3, mm1 /* copy MM1 into MM3 */ psrlq mm1, 16 /* shift 1 left word to the right */ paddsw mm1, mm3 /* add 1 left and 1 right result words */ /* --, */ movd mm2, eax /* save EAX in MM2 */ movd mm3, edx /* save EDX in MM3 */ movd eax, mm1 /* copy MM1 into EAX */ psraw mm1, 15 /* spread sign bit of the result */ movd edx, mm1 /* fill EDX with a sign bit */ idiv bx /* IDIV - VERY EXPENSIVE */ movd mm1, eax /* move result of division into MM1 */ packuswb mm1, mm0 /* pack division result with saturation */ movd eax, mm1 /* copy saturated result into EAX */ mov [edi], al /* copy a byte result into Dest */ movd edx, mm3 /* restore saved EDX */ movd eax, mm2 /* restore saved EAX */ /* --, */ sub esi, eax /* move two rows up */ sub esi, eax /* */ inc esi /* move Src pointer to the next pixel */ inc edi /* move Dest pointer to the next pixel */ /* ---, */ dec ecx /* decrease loop counter COLUMNS */ jnz L10322 /* check loop termination, proceed if required */ add esi, 2 /* move to the next row in Src */ add edi, 2 /* move to the next row in Dest */ dec edx /* decrease loop counter ROWS */ jnz L10320 /* check loop termination, proceed if required */ /* ---, */ emms /* exit MMX state */ popa } #else # 4070 "SDL2_imageFilter.c" asm volatile ("pusha \n\t" "pxor %%mm0, %%mm0 \n\t" /* zero MM0 */ "xor %%ebx, %%ebx \n\t" /* zero EBX */ "mov %5, %%bl \n\t" /* load Divisor into BL */ "mov %4, %%edx \n\t" /* load Kernel address into EDX */ "movq (%%edx), %%mm5 \n\t" /* MM5 = {0,K2,K1,K0} */ "add $8, %%edx \n\t" /* second row |K0 K1 K2 0| */ "movq (%%edx), %%mm6 \n\t" /* MM6 = {0,K5,K4,K3} K = |K3 K4 K5 0| */ "add $8, %%edx \n\t" /* third row |K6 K7 K8 0| */ "movq (%%edx), %%mm7 \n\t" /* MM7 = {0,K8,K7,K6} */ /* --- */ "mov %3, %%eax \n\t" /* load columns into EAX */ "mov %1, %%esi \n\t" /* ESI = Src row 0 address */ "mov %0, %%edi \n\t" /* load Dest address to EDI */ "add %%eax, %%edi \n\t" /* EDI = EDI + columns */ "inc %%edi \n\t" /* 1 byte offset from the left edge */ "mov %2, %%edx \n\t" /* initialize ROWS counter */ "sub $2, %%edx \n\t" /* do not use first and last row */ /* --- */ ".L10320: \n\t" "mov %%eax, %%ecx \n\t" /* initialize COLUMS counter */ "sub $2, %%ecx \n\t" /* do not use first and last column */ ".align 16 \n\t" /* 16 byte alignment of the loop entry */ ".L10322: \n\t" /* --- */ "movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the image first row */ "add %%eax, %%esi \n\t" /* move one row below */ "movq (%%esi), %%mm2 \n\t" /* load 8 bytes of the image second row */ "add %%eax, %%esi \n\t" /* move one row below */ "movq (%%esi), %%mm3 \n\t" /* load 8 bytes of the image third row */ "punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */ "punpcklbw %%mm0, %%mm2 \n\t" /* unpack first 4 bytes into words */ "punpcklbw %%mm0, %%mm3 \n\t" /* unpack first 4 bytes into words */ "pmullw %%mm5, %%mm1 \n\t" /* multiply words first row image*Kernel */ "pmullw %%mm6, %%mm2 \n\t" /* multiply words second row image*Kernel */ "pmullw %%mm7, %%mm3 \n\t" /* multiply words third row image*Kernel */ "paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the first and second rows */ "paddsw %%mm3, %%mm1 \n\t" /* add 4 words of the third row and result */ "movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */ "psrlq $32, %%mm1 \n\t" /* shift 2 left words to the right */ "paddsw %%mm2, %%mm1 \n\t" /* add 2 left and 2 right result words */ "movq %%mm1, %%mm3 \n\t" /* copy MM1 into MM3 */ "psrlq $16, %%mm1 \n\t" /* shift 1 left word to the right */ "paddsw %%mm3, %%mm1 \n\t" /* add 1 left and 1 right result words */ /* -- */ "movd %%eax, %%mm2 \n\t" /* save EAX in MM2 */ "movd %%edx, %%mm3 \n\t" /* save EDX in MM3 */ "movd %%mm1, %%eax \n\t" /* copy MM1 into EAX */ "psraw $15, %%mm1 \n\t" /* spread sign bit of the result */ "movd %%mm1, %%edx \n\t" /* fill EDX with a sign bit */ "idivw %%bx \n\t" /* IDIV - VERY EXPENSIVE */ "movd %%eax, %%mm1 \n\t" /* move result of division into MM1 */ "packuswb %%mm0, %%mm1 \n\t" /* pack division result with saturation */ "movd %%mm1, %%eax \n\t" /* copy saturated result into EAX */ "mov %%al, (%%edi) \n\t" /* copy a byte result into Dest */ "movd %%mm3, %%edx \n\t" /* restore saved EDX */ "movd %%mm2, %%eax \n\t" /* restore saved EAX */ /* -- */ "sub %%eax, %%esi \n\t" /* move two rows up */ "sub %%eax, %%esi \n\t" /* */ "inc %%esi \n\t" /* move Src pointer to the next pixel */ "inc %%edi \n\t" /* move Dest pointer to the next pixel */ /* --- */ "dec %%ecx \n\t" /* decrease loop counter COLUMNS */ "jnz .L10322 \n\t" /* check loop termination, proceed if required */ "add $2, %%esi \n\t" /* move to the next row in Src */ "add $2, %%edi \n\t" /* move to the next row in Dest */ "dec %%edx \n\t" /* decrease loop counter ROWS */ "jnz .L10320 \n\t" /* check loop termination, proceed if required */ /* --- */ "emms \n\t" /* exit MMX state */ "popa \n\t":"=m" (Dest) /* %0 */ :"m"(Src), /* %1 */ "m"(rows), /* %2 */ "m"(columns), /* %3 */ "m"(Kernel), /* %4 */ "m"(Divisor) /* %5 */ ); #endif # 4148 "SDL2_imageFilter.c" #endif # 4149 "SDL2_imageFilter.c" return (0); } else { /* No non-MMX implementation yet */ return (-1); } } /*! \brief Filter using ConvolveKernel5x5Divide: Dij = saturation0and255( ... ) \param Src The source 2D byte array to convolve. Should be different from destination. \param Dest The destination 2D byte array to store the result in. Should be different from source. \param rows Number of rows in source/destination array. Must be >4. \param columns Number of columns in source/destination array. Must be >4. \param Kernel The 2D convolution kernel of size 5x5. \param Divisor The divisor of the convolution sum. Must be >0. Note: Non-MMX implementation not available for this function. \return Returns 1 if filter was applied, 0 otherwise. */ int SDL_imageFilterConvolveKernel5x5Divide(unsigned char *Src, unsigned char *Dest, int rows, int columns, signed short *Kernel, unsigned char Divisor) { /* Validate input parameters */ if ((Src == NULL) || (Dest == NULL) || (Kernel == NULL)) return(-1); if ((columns < 5) || (rows < 5) || (Divisor == 0)) return (-1); if ((SDL_imageFilterMMXdetect())) { //#ifdef USE_MMX #if defined(USE_MMX) && defined(i386) #if !defined(GCC__) __asm { pusha pxor mm0, mm0 /* zero MM0 */ xor ebx, ebx /* zero EBX */ mov bl, Divisor /* load Divisor into BL */ movd mm5, ebx /* copy Divisor into MM5 */ mov edx, Kernel /* load Kernel address into EDX */ mov esi, Src /* load Src address to ESI */ mov edi, Dest /* load Dest address to EDI */ add edi, 2 /* 2 column offset from the left edge */ mov eax, columns /* load columns into EAX */ shl eax, 1 /* EAX = columns * 2 */ add edi, eax /* 2 row offset from the top edge */ shr eax, 1 /* EAX = columns */ mov ebx, rows /* initialize ROWS counter */ sub ebx, 4 /* do not use first 2 and last 2 rows */ /* ---, */ L10330: mov ecx, eax /* initialize COLUMNS counter */ sub ecx, 4 /* do not use first 2 and last 2 columns */ align 16 /* 16 byte alignment of the loop entry */ L10332: pxor mm7, mm7 /* zero MM7 (accumulator) */ movd mm6, esi /* save ESI in MM6 */ /* --- 1 */ movq mm1, [esi] /* load 8 bytes of the Src */ movq mm2, mm1 /* copy MM1 into MM2 */ add esi, eax /* move Src pointer 1 row below */ movq mm3, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ movq mm4, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ punpcklbw mm1, mm0 /* unpack first 4 bytes into words */ punpckhbw mm2, mm0 /* unpack second 4 bytes into words */ pmullw mm1, mm3 /* mult 4 low words of Src and Kernel */ pmullw mm2, mm4 /* mult 4 high words of Src and Kernel */ paddsw mm1, mm2 /* add 4 words of the high and low bytes */ paddsw mm7, mm1 /* add MM1 to accumulator MM7 */ /* --- 2 */ movq mm1, [esi] /* load 8 bytes of the Src */ movq mm2, mm1 /* copy MM1 into MM2 */ add esi, eax /* move Src pointer 1 row below */ movq mm3, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ movq mm4, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ punpcklbw mm1, mm0 /* unpack first 4 bytes into words */ punpckhbw mm2, mm0 /* unpack second 4 bytes into words */ pmullw mm1, mm3 /* mult 4 low words of Src and Kernel */ pmullw mm2, mm4 /* mult 4 high words of Src and Kernel */ paddsw mm1, mm2 /* add 4 words of the high and low bytes */ paddsw mm7, mm1 /* add MM1 to accumulator MM7 */ /* --- 3 */ movq mm1, [esi] /* load 8 bytes of the Src */ movq mm2, mm1 /* copy MM1 into MM2 */ add esi, eax /* move Src pointer 1 row below */ movq mm3, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ movq mm4, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ punpcklbw mm1, mm0 /* unpack first 4 bytes into words */ punpckhbw mm2, mm0 /* unpack second 4 bytes into words */ pmullw mm1, mm3 /* mult 4 low words of Src and Kernel */ pmullw mm2, mm4 /* mult 4 high words of Src and Kernel */ paddsw mm1, mm2 /* add 4 words of the high and low bytes */ paddsw mm7, mm1 /* add MM1 to accumulator MM7 */ /* --- 4 */ movq mm1, [esi] /* load 8 bytes of the Src */ movq mm2, mm1 /* copy MM1 into MM2 */ add esi, eax /* move Src pointer 1 row below */ movq mm3, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ movq mm4, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ punpcklbw mm1, mm0 /* unpack first 4 bytes into words */ punpckhbw mm2, mm0 /* unpack second 4 bytes into words */ pmullw mm1, mm3 /* mult 4 low words of Src and Kernel */ pmullw mm2, mm4 /* mult 4 high words of Src and Kernel */ paddsw mm1, mm2 /* add 4 words of the high and low bytes */ paddsw mm7, mm1 /* add MM1 to accumulator MM7 */ /* --- 5 */ movq mm1, [esi] /* load 8 bytes of the Src */ movq mm2, mm1 /* copy MM1 into MM2 */ movq mm3, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ movq mm4, [edx] /* load 4 words of Kernel */ punpcklbw mm1, mm0 /* unpack first 4 bytes into words */ punpckhbw mm2, mm0 /* unpack second 4 bytes into words */ pmullw mm1, mm3 /* mult 4 low words of Src and Kernel */ pmullw mm2, mm4 /* mult 4 high words of Src and Kernel */ paddsw mm1, mm2 /* add 4 words of the high and low bytes */ paddsw mm7, mm1 /* add MM1 to accumulator MM7 */ /* ---, */ movq mm3, mm7 /* copy MM7 into MM3 */ psrlq mm7, 32 /* shift 2 left words to the right */ paddsw mm7, mm3 /* add 2 left and 2 right result words */ movq mm2, mm7 /* copy MM7 into MM2 */ psrlq mm7, 16 /* shift 1 left word to the right */ paddsw mm7, mm2 /* add 1 left and 1 right result words */ /* ---, */ movd mm1, eax /* save EDX in MM1 */ movd mm2, ebx /* save EDX in MM2 */ movd mm3, edx /* save EDX in MM3 */ movd eax, mm7 /* load summation result into EAX */ psraw mm7, 15 /* spread sign bit of the result */ movd ebx, mm5 /* load Divisor into EBX */ movd edx, mm7 /* fill EDX with a sign bit */ idiv bx /* IDIV - VERY EXPENSIVE */ movd mm7, eax /* move result of division into MM7 */ packuswb mm7, mm0 /* pack division result with saturation */ movd eax, mm7 /* copy saturated result into EAX */ mov [edi], al /* copy a byte result into Dest */ movd edx, mm3 /* restore saved EDX */ movd ebx, mm2 /* restore saved EBX */ movd eax, mm1 /* restore saved EAX */ /* --, */ movd esi, mm6 /* move Src pointer to the top pixel */ sub edx, 72 /* EDX = Kernel address */ inc esi /* move Src pointer to the next pixel */ inc edi /* move Dest pointer to the next pixel */ /* ---, */ dec ecx /* decrease loop counter COLUMNS */ jnz L10332 /* check loop termination, proceed if required */ add esi, 4 /* move to the next row in Src */ add edi, 4 /* move to the next row in Dest */ dec ebx /* decrease loop counter ROWS */ jnz L10330 /* check loop termination, proceed if required */ /* ---, */ emms /* exit MMX state */ popa } #else # 4317 "SDL2_imageFilter.c" asm volatile ("pusha \n\t" "pxor %%mm0, %%mm0 \n\t" /* zero MM0 */ "xor %%ebx, %%ebx \n\t" /* zero EBX */ "mov %5, %%bl \n\t" /* load Divisor into BL */ "movd %%ebx, %%mm5 \n\t" /* copy Divisor into MM5 */ "mov %4, %%edx \n\t" /* load Kernel address into EDX */ "mov %1, %%esi \n\t" /* load Src address to ESI */ "mov %0, %%edi \n\t" /* load Dest address to EDI */ "add $2, %%edi \n\t" /* 2 column offset from the left edge */ "mov %3, %%eax \n\t" /* load columns into EAX */ "shl $1, %%eax \n\t" /* EAX = columns * 2 */ "add %%eax, %%edi \n\t" /* 2 row offset from the top edge */ "shr $1, %%eax \n\t" /* EAX = columns */ "mov %2, %%ebx \n\t" /* initialize ROWS counter */ "sub $4, %%ebx \n\t" /* do not use first 2 and last 2 rows */ /* --- */ ".L10330: \n\t" "mov %%eax, %%ecx \n\t" /* initialize COLUMNS counter */ "sub $4, %%ecx \n\t" /* do not use first 2 and last 2 columns */ ".align 16 \n\t" /* 16 byte alignment of the loop entry */ ".L10332: \n\t" "pxor %%mm7, %%mm7 \n\t" /* zero MM7 (accumulator) */ "movd %%esi, %%mm6 \n\t" /* save ESI in MM6 */ /* --- 1 */ "movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */ "movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */ "add %%eax, %%esi \n\t" /* move Src pointer 1 row below */ "movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "movq (%%edx), %%mm4 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */ "punpckhbw %%mm0, %%mm2 \n\t" /* unpack second 4 bytes into words */ "pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */ "pmullw %%mm4, %%mm2 \n\t" /* mult. 4 high words of Src and Kernel */ "paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the high and low bytes */ "paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */ /* --- 2 */ "movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */ "movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */ "add %%eax, %%esi \n\t" /* move Src pointer 1 row below */ "movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "movq (%%edx), %%mm4 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */ "punpckhbw %%mm0, %%mm2 \n\t" /* unpack second 4 bytes into words */ "pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */ "pmullw %%mm4, %%mm2 \n\t" /* mult. 4 high words of Src and Kernel */ "paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the high and low bytes */ "paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */ /* --- 3 */ "movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */ "movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */ "add %%eax, %%esi \n\t" /* move Src pointer 1 row below */ "movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "movq (%%edx), %%mm4 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */ "punpckhbw %%mm0, %%mm2 \n\t" /* unpack second 4 bytes into words */ "pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */ "pmullw %%mm4, %%mm2 \n\t" /* mult. 4 high words of Src and Kernel */ "paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the high and low bytes */ "paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */ /* --- 4 */ "movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */ "movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */ "add %%eax, %%esi \n\t" /* move Src pointer 1 row below */ "movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "movq (%%edx), %%mm4 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */ "punpckhbw %%mm0, %%mm2 \n\t" /* unpack second 4 bytes into words */ "pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */ "pmullw %%mm4, %%mm2 \n\t" /* mult. 4 high words of Src and Kernel */ "paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the high and low bytes */ "paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */ /* --- 5 */ "movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */ "movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */ "movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "movq (%%edx), %%mm4 \n\t" /* load 4 words of Kernel */ "punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */ "punpckhbw %%mm0, %%mm2 \n\t" /* unpack second 4 bytes into words */ "pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */ "pmullw %%mm4, %%mm2 \n\t" /* mult. 4 high words of Src and Kernel */ "paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the high and low bytes */ "paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */ /* --- */ "movq %%mm7, %%mm3 \n\t" /* copy MM7 into MM3 */ "psrlq $32, %%mm7 \n\t" /* shift 2 left words to the right */ "paddsw %%mm3, %%mm7 \n\t" /* add 2 left and 2 right result words */ "movq %%mm7, %%mm2 \n\t" /* copy MM7 into MM2 */ "psrlq $16, %%mm7 \n\t" /* shift 1 left word to the right */ "paddsw %%mm2, %%mm7 \n\t" /* add 1 left and 1 right result words */ /* --- */ "movd %%eax, %%mm1 \n\t" /* save EDX in MM1 */ "movd %%ebx, %%mm2 \n\t" /* save EDX in MM2 */ "movd %%edx, %%mm3 \n\t" /* save EDX in MM3 */ "movd %%mm7, %%eax \n\t" /* load summation result into EAX */ "psraw $15, %%mm7 \n\t" /* spread sign bit of the result */ "movd %%mm5, %%ebx \n\t" /* load Divisor into EBX */ "movd %%mm7, %%edx \n\t" /* fill EDX with a sign bit */ "idivw %%bx \n\t" /* IDIV - VERY EXPENSIVE */ "movd %%eax, %%mm7 \n\t" /* move result of division into MM7 */ "packuswb %%mm0, %%mm7 \n\t" /* pack division result with saturation */ "movd %%mm7, %%eax \n\t" /* copy saturated result into EAX */ "mov %%al, (%%edi) \n\t" /* copy a byte result into Dest */ "movd %%mm3, %%edx \n\t" /* restore saved EDX */ "movd %%mm2, %%ebx \n\t" /* restore saved EBX */ "movd %%mm1, %%eax \n\t" /* restore saved EAX */ /* -- */ "movd %%mm6, %%esi \n\t" /* move Src pointer to the top pixel */ "sub $72, %%edx \n\t" /* EDX = Kernel address */ "inc %%esi \n\t" /* move Src pointer to the next pixel */ "inc %%edi \n\t" /* move Dest pointer to the next pixel */ /* --- */ "dec %%ecx \n\t" /* decrease loop counter COLUMNS */ "jnz .L10332 \n\t" /* check loop termination, proceed if required */ "add $4, %%esi \n\t" /* move to the next row in Src */ "add $4, %%edi \n\t" /* move to the next row in Dest */ "dec %%ebx \n\t" /* decrease loop counter ROWS */ "jnz .L10330 \n\t" /* check loop termination, proceed if required */ /* --- */ "emms \n\t" /* exit MMX state */ "popa \n\t":"=m" (Dest) /* %0 */ :"m"(Src), /* %1 */ "m"(rows), /* %2 */ "m"(columns), /* %3 */ "m"(Kernel), /* %4 */ "m"(Divisor) /* %5 */ ); #endif # 4451 "SDL2_imageFilter.c" #endif # 4452 "SDL2_imageFilter.c" return (0); } else { /* No non-MMX implementation yet */ return (-1); } } /*! \brief Filter using ConvolveKernel7x7Divide: Dij = saturation0and255( ... ) \param Src The source 2D byte array to convolve. Should be different from destination. \param Dest The destination 2D byte array to store the result in. Should be different from source. \param rows Number of rows in source/destination array. Must be >6. \param columns Number of columns in source/destination array. Must be >6. \param Kernel The 2D convolution kernel of size 7x7. \param Divisor The divisor of the convolution sum. Must be >0. Note: Non-MMX implementation not available for this function. \return Returns 1 if filter was applied, 0 otherwise. */ int SDL_imageFilterConvolveKernel7x7Divide(unsigned char *Src, unsigned char *Dest, int rows, int columns, signed short *Kernel, unsigned char Divisor) { /* Validate input parameters */ if ((Src == NULL) || (Dest == NULL) || (Kernel == NULL)) return(-1); if ((columns < 7) || (rows < 7) || (Divisor == 0)) return (-1); if ((SDL_imageFilterMMXdetect())) { //#ifdef USE_MMX #if defined(USE_MMX) && defined(i386) #if !defined(GCC__) __asm { pusha pxor mm0, mm0 /* zero MM0 */ xor ebx, ebx /* zero EBX */ mov bl, Divisor /* load Divisor into BL */ movd mm5, ebx /* copy Divisor into MM5 */ mov edx, Kernel /* load Kernel address into EDX */ mov esi, Src /* load Src address to ESI */ mov edi, Dest /* load Dest address to EDI */ add edi, 3 /* 3 column offset from the left edge */ mov eax, columns /* load columns into EAX */ add edi, eax /* 3 row offset from the top edge */ add edi, eax add edi, eax mov ebx, rows /* initialize ROWS counter */ sub ebx, 6 /* do not use first 3 and last 3 rows */ /* ---, */ L10340: mov ecx, eax /* initialize COLUMNS counter */ sub ecx, 6 /* do not use first 3 and last 3 columns */ align 16 /* 16 byte alignment of the loop entry */ L10342: pxor mm7, mm7 /* zero MM7 (accumulator) */ movd mm6, esi /* save ESI in MM6 */ /* --- 1 */ movq mm1, [esi] /* load 8 bytes of the Src */ movq mm2, mm1 /* copy MM1 into MM2 */ add esi, eax /* move Src pointer 1 row below */ movq mm3, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ movq mm4, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ punpcklbw mm1, mm0 /* unpack first 4 bytes into words */ punpckhbw mm2, mm0 /* unpack second 4 bytes into words */ pmullw mm1, mm3 /* mult 4 low words of Src and Kernel */ pmullw mm2, mm4 /* mult 4 high words of Src and Kernel */ paddsw mm1, mm2 /* add 4 words of the high and low bytes */ paddsw mm7, mm1 /* add MM1 to accumulator MM7 */ /* --- 2 */ movq mm1, [esi] /* load 8 bytes of the Src */ movq mm2, mm1 /* copy MM1 into MM2 */ add esi, eax /* move Src pointer 1 row below */ movq mm3, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ movq mm4, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ punpcklbw mm1, mm0 /* unpack first 4 bytes into words */ punpckhbw mm2, mm0 /* unpack second 4 bytes into words */ pmullw mm1, mm3 /* mult 4 low words of Src and Kernel */ pmullw mm2, mm4 /* mult 4 high words of Src and Kernel */ paddsw mm1, mm2 /* add 4 words of the high and low bytes */ paddsw mm7, mm1 /* add MM1 to accumulator MM7 */ /* --- 3 */ movq mm1, [esi] /* load 8 bytes of the Src */ movq mm2, mm1 /* copy MM1 into MM2 */ add esi, eax /* move Src pointer 1 row below */ movq mm3, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ movq mm4, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ punpcklbw mm1, mm0 /* unpack first 4 bytes into words */ punpckhbw mm2, mm0 /* unpack second 4 bytes into words */ pmullw mm1, mm3 /* mult 4 low words of Src and Kernel */ pmullw mm2, mm4 /* mult 4 high words of Src and Kernel */ paddsw mm1, mm2 /* add 4 words of the high and low bytes */ paddsw mm7, mm1 /* add MM1 to accumulator MM7 */ /* --- 4 */ movq mm1, [esi] /* load 8 bytes of the Src */ movq mm2, mm1 /* copy MM1 into MM2 */ add esi, eax /* move Src pointer 1 row below */ movq mm3, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ movq mm4, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ punpcklbw mm1, mm0 /* unpack first 4 bytes into words */ punpckhbw mm2, mm0 /* unpack second 4 bytes into words */ pmullw mm1, mm3 /* mult 4 low words of Src and Kernel */ pmullw mm2, mm4 /* mult 4 high words of Src and Kernel */ paddsw mm1, mm2 /* add 4 words of the high and low bytes */ paddsw mm7, mm1 /* add MM1 to accumulator MM7 */ /* --- 5 */ movq mm1, [esi] /* load 8 bytes of the Src */ movq mm2, mm1 /* copy MM1 into MM2 */ add esi, eax /* move Src pointer 1 row below */ movq mm3, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ movq mm4, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ punpcklbw mm1, mm0 /* unpack first 4 bytes into words */ punpckhbw mm2, mm0 /* unpack second 4 bytes into words */ pmullw mm1, mm3 /* mult 4 low words of Src and Kernel */ pmullw mm2, mm4 /* mult 4 high words of Src and Kernel */ paddsw mm1, mm2 /* add 4 words of the high and low bytes */ paddsw mm7, mm1 /* add MM1 to accumulator MM7 */ /* --- 6 */ movq mm1, [esi] /* load 8 bytes of the Src */ movq mm2, mm1 /* copy MM1 into MM2 */ add esi, eax /* move Src pointer 1 row below */ movq mm3, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ movq mm4, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ punpcklbw mm1, mm0 /* unpack first 4 bytes into words */ punpckhbw mm2, mm0 /* unpack second 4 bytes into words */ pmullw mm1, mm3 /* mult 4 low words of Src and Kernel */ pmullw mm2, mm4 /* mult 4 high words of Src and Kernel */ paddsw mm1, mm2 /* add 4 words of the high and low bytes */ paddsw mm7, mm1 /* add MM1 to accumulator MM7 */ /* --- 7 */ movq mm1, [esi] /* load 8 bytes of the Src */ movq mm2, mm1 /* copy MM1 into MM2 */ movq mm3, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ movq mm4, [edx] /* load 4 words of Kernel */ punpcklbw mm1, mm0 /* unpack first 4 bytes into words */ punpckhbw mm2, mm0 /* unpack second 4 bytes into words */ pmullw mm1, mm3 /* mult 4 low words of Src and Kernel */ pmullw mm2, mm4 /* mult 4 high words of Src and Kernel */ paddsw mm1, mm2 /* add 4 words of the high and low bytes */ paddsw mm7, mm1 /* add MM1 to accumulator MM7 */ /* ---, */ movq mm3, mm7 /* copy MM7 into MM3 */ psrlq mm7, 32 /* shift 2 left words to the right */ paddsw mm7, mm3 /* add 2 left and 2 right result words */ movq mm2, mm7 /* copy MM7 into MM2 */ psrlq mm7, 16 /* shift 1 left word to the right */ paddsw mm7, mm2 /* add 1 left and 1 right result words */ /* ---, */ movd mm1, eax /* save EDX in MM1 */ movd mm2, ebx /* save EDX in MM2 */ movd mm3, edx /* save EDX in MM3 */ movd eax, mm7 /* load summation result into EAX */ psraw mm7, 15 /* spread sign bit of the result */ movd ebx, mm5 /* load Divisor into EBX */ movd edx, mm7 /* fill EDX with a sign bit */ idiv bx /* IDIV - VERY EXPENSIVE */ movd mm7, eax /* move result of division into MM7 */ packuswb mm7, mm0 /* pack division result with saturation */ movd eax, mm7 /* copy saturated result into EAX */ mov [edi], al /* copy a byte result into Dest */ movd edx, mm3 /* restore saved EDX */ movd ebx, mm2 /* restore saved EBX */ movd eax, mm1 /* restore saved EAX */ /* --, */ movd esi, mm6 /* move Src pointer to the top pixel */ sub edx, 104 /* EDX = Kernel address */ inc esi /* move Src pointer to the next pixel */ inc edi /* move Dest pointer to the next pixel */ /* ---, */ dec ecx /* decrease loop counter COLUMNS */ jnz L10342 /* check loop termination, proceed if required */ add esi, 6 /* move to the next row in Src */ add edi, 6 /* move to the next row in Dest */ dec ebx /* decrease loop counter ROWS */ jnz L10340 /* check loop termination, proceed if required */ /* ---, */ emms /* exit MMX state */ popa } #else # 4648 "SDL2_imageFilter.c" asm volatile ("pusha \n\t" "pxor %%mm0, %%mm0 \n\t" /* zero MM0 */ "xor %%ebx, %%ebx \n\t" /* zero EBX */ "mov %5, %%bl \n\t" /* load Divisor into BL */ "movd %%ebx, %%mm5 \n\t" /* copy Divisor into MM5 */ "mov %4, %%edx \n\t" /* load Kernel address into EDX */ "mov %1, %%esi \n\t" /* load Src address to ESI */ "mov %0, %%edi \n\t" /* load Dest address to EDI */ "add $3, %%edi \n\t" /* 3 column offset from the left edge */ "mov %3, %%eax \n\t" /* load columns into EAX */ "add %%eax, %%edi \n\t" /* 3 row offset from the top edge */ "add %%eax, %%edi \n\t" "add %%eax, %%edi \n\t" "mov %2, %%ebx \n\t" /* initialize ROWS counter */ "sub $6, %%ebx \n\t" /* do not use first 3 and last 3 rows */ /* --- */ ".L10340: \n\t" "mov %%eax, %%ecx \n\t" /* initialize COLUMNS counter */ "sub $6, %%ecx \n\t" /* do not use first 3 and last 3 columns */ ".align 16 \n\t" /* 16 byte alignment of the loop entry */ ".L10342: \n\t" "pxor %%mm7, %%mm7 \n\t" /* zero MM7 (accumulator) */ "movd %%esi, %%mm6 \n\t" /* save ESI in MM6 */ /* --- 1 */ "movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */ "movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */ "add %%eax, %%esi \n\t" /* move Src pointer 1 row below */ "movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "movq (%%edx), %%mm4 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */ "punpckhbw %%mm0, %%mm2 \n\t" /* unpack second 4 bytes into words */ "pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */ "pmullw %%mm4, %%mm2 \n\t" /* mult. 4 high words of Src and Kernel */ "paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the high and low bytes */ "paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */ /* --- 2 */ "movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */ "movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */ "add %%eax, %%esi \n\t" /* move Src pointer 1 row below */ "movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "movq (%%edx), %%mm4 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */ "punpckhbw %%mm0, %%mm2 \n\t" /* unpack second 4 bytes into words */ "pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */ "pmullw %%mm4, %%mm2 \n\t" /* mult. 4 high words of Src and Kernel */ "paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the high and low bytes */ "paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */ /* --- 3 */ "movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */ "movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */ "add %%eax, %%esi \n\t" /* move Src pointer 1 row below */ "movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "movq (%%edx), %%mm4 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */ "punpckhbw %%mm0, %%mm2 \n\t" /* unpack second 4 bytes into words */ "pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */ "pmullw %%mm4, %%mm2 \n\t" /* mult. 4 high words of Src and Kernel */ "paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the high and low bytes */ "paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */ /* --- 4 */ "movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */ "movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */ "add %%eax, %%esi \n\t" /* move Src pointer 1 row below */ "movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "movq (%%edx), %%mm4 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */ "punpckhbw %%mm0, %%mm2 \n\t" /* unpack second 4 bytes into words */ "pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */ "pmullw %%mm4, %%mm2 \n\t" /* mult. 4 high words of Src and Kernel */ "paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the high and low bytes */ "paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */ /* --- 5 */ "movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */ "movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */ "add %%eax, %%esi \n\t" /* move Src pointer 1 row below */ "movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "movq (%%edx), %%mm4 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */ "punpckhbw %%mm0, %%mm2 \n\t" /* unpack second 4 bytes into words */ "pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */ "pmullw %%mm4, %%mm2 \n\t" /* mult. 4 high words of Src and Kernel */ "paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the high and low bytes */ "paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */ /* --- 6 */ "movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */ "movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */ "add %%eax, %%esi \n\t" /* move Src pointer 1 row below */ "movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "movq (%%edx), %%mm4 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */ "punpckhbw %%mm0, %%mm2 \n\t" /* unpack second 4 bytes into words */ "pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */ "pmullw %%mm4, %%mm2 \n\t" /* mult. 4 high words of Src and Kernel */ "paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the high and low bytes */ "paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */ /* --- 7 */ "movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */ "movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */ "movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "movq (%%edx), %%mm4 \n\t" /* load 4 words of Kernel */ "punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */ "punpckhbw %%mm0, %%mm2 \n\t" /* unpack second 4 bytes into words */ "pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */ "pmullw %%mm4, %%mm2 \n\t" /* mult. 4 high words of Src and Kernel */ "paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the high and low bytes */ "paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */ /* --- */ "movq %%mm7, %%mm3 \n\t" /* copy MM7 into MM3 */ "psrlq $32, %%mm7 \n\t" /* shift 2 left words to the right */ "paddsw %%mm3, %%mm7 \n\t" /* add 2 left and 2 right result words */ "movq %%mm7, %%mm2 \n\t" /* copy MM7 into MM2 */ "psrlq $16, %%mm7 \n\t" /* shift 1 left word to the right */ "paddsw %%mm2, %%mm7 \n\t" /* add 1 left and 1 right result words */ /* --- */ "movd %%eax, %%mm1 \n\t" /* save EDX in MM1 */ "movd %%ebx, %%mm2 \n\t" /* save EDX in MM2 */ "movd %%edx, %%mm3 \n\t" /* save EDX in MM3 */ "movd %%mm7, %%eax \n\t" /* load summation result into EAX */ "psraw $15, %%mm7 \n\t" /* spread sign bit of the result */ "movd %%mm5, %%ebx \n\t" /* load Divisor into EBX */ "movd %%mm7, %%edx \n\t" /* fill EDX with a sign bit */ "idivw %%bx \n\t" /* IDIV - VERY EXPENSIVE */ "movd %%eax, %%mm7 \n\t" /* move result of division into MM7 */ "packuswb %%mm0, %%mm7 \n\t" /* pack division result with saturation */ "movd %%mm7, %%eax \n\t" /* copy saturated result into EAX */ "mov %%al, (%%edi) \n\t" /* copy a byte result into Dest */ "movd %%mm3, %%edx \n\t" /* restore saved EDX */ "movd %%mm2, %%ebx \n\t" /* restore saved EBX */ "movd %%mm1, %%eax \n\t" /* restore saved EAX */ /* -- */ "movd %%mm6, %%esi \n\t" /* move Src pointer to the top pixel */ "sub $104, %%edx \n\t" /* EDX = Kernel address */ "inc %%esi \n\t" /* move Src pointer to the next pixel */ "inc %%edi \n\t" /* move Dest pointer to the next pixel */ /* --- */ "dec %%ecx \n\t" /* decrease loop counter COLUMNS */ "jnz .L10342 \n\t" /* check loop termination, proceed if required */ "add $6, %%esi \n\t" /* move to the next row in Src */ "add $6, %%edi \n\t" /* move to the next row in Dest */ "dec %%ebx \n\t" /* decrease loop counter ROWS */ "jnz .L10340 \n\t" /* check loop termination, proceed if required */ /* --- */ "emms \n\t" /* exit MMX state */ "popa \n\t":"=m" (Dest) /* %0 */ :"m"(Src), /* %1 */ "m"(rows), /* %2 */ "m"(columns), /* %3 */ "m"(Kernel), /* %4 */ "m"(Divisor) /* %5 */ ); #endif # 4808 "SDL2_imageFilter.c" #endif # 4809 "SDL2_imageFilter.c" return (0); } else { /* No non-MMX implementation yet */ return (-1); } } /*! \brief Filter using ConvolveKernel9x9Divide: Dij = saturation0and255( ... ) \param Src The source 2D byte array to convolve. Should be different from destination. \param Dest The destination 2D byte array to store the result in. Should be different from source. \param rows Number of rows in source/destination array. Must be >8. \param columns Number of columns in source/destination array. Must be >8. \param Kernel The 2D convolution kernel of size 9x9. \param Divisor The divisor of the convolution sum. Must be >0. Note: Non-MMX implementation not available for this function. \return Returns 1 if filter was applied, 0 otherwise. */ int SDL_imageFilterConvolveKernel9x9Divide(unsigned char *Src, unsigned char *Dest, int rows, int columns, signed short *Kernel, unsigned char Divisor) { /* Validate input parameters */ if ((Src == NULL) || (Dest == NULL) || (Kernel == NULL)) return(-1); if ((columns < 9) || (rows < 9) || (Divisor == 0)) return (-1); if ((SDL_imageFilterMMXdetect())) { //#ifdef USE_MMX #if defined(USE_MMX) && defined(i386) #if !defined(GCC__) __asm { pusha pxor mm0, mm0 /* zero MM0 */ xor ebx, ebx /* zero EBX */ mov bl, Divisor /* load Divisor into BL */ movd mm5, ebx /* copy Divisor into MM5 */ mov edx, Kernel /* load Kernel address into EDX */ mov esi, Src /* load Src address to ESI */ mov edi, Dest /* load Dest address to EDI */ add edi, 4 /* 4 column offset from the left edge */ mov eax, columns /* load columns into EAX */ add edi, eax /* 4 row offset from the top edge */ add edi, eax add edi, eax add edi, eax mov ebx, rows /* initialize ROWS counter */ sub ebx, 8 /* do not use first 4 and last 4 rows */ /* ---, */ L10350: mov ecx, eax /* initialize COLUMNS counter */ sub ecx, 8 /* do not use first 4 and last 4 columns */ align 16 /* 16 byte alignment of the loop entry */ L10352: pxor mm7, mm7 /* zero MM7 (accumulator) */ movd mm6, esi /* save ESI in MM6 */ /* --- 1 */ movq mm1, [esi] /* load 8 bytes of the Src */ movq mm2, mm1 /* copy MM1 into MM2 */ inc esi /* move pointer to the next 8 bytes of Src */ movq mm3, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ movq mm4, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ punpcklbw mm1, mm0 /* unpack first 4 bytes into words */ punpckhbw mm2, mm0 /* unpack second 4 bytes into words */ pmullw mm1, mm3 /* mult. 4 low words of Src and Kernel */ pmullw mm2, mm4 /* mult. 4 high words of Src and Kernel */ paddsw mm1, mm2 /* add 4 words of the high and low bytes */ paddsw mm7, mm1 /* add MM1 to accumulator MM7 */ movq mm1, [esi] /* load 8 bytes of the Src */ dec esi add esi, eax /* move Src pointer 1 row below */ movq mm3, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ punpcklbw mm1, mm0 /* unpack first 4 bytes into words */ pmullw mm1, mm3 /* mult. 4 low words of Src and Kernel */ paddsw mm7, mm1 /* add MM1 to accumulator MM7 */ /* --- 2 */ movq mm1, [esi] /* load 8 bytes of the Src */ movq mm2, mm1 /* copy MM1 into MM2 */ inc esi /* move pointer to the next 8 bytes of Src */ movq mm3, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ movq mm4, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ punpcklbw mm1, mm0 /* unpack first 4 bytes into words */ punpckhbw mm2, mm0 /* unpack second 4 bytes into words */ pmullw mm1, mm3 /* mult. 4 low words of Src and Kernel */ pmullw mm2, mm4 /* mult. 4 high words of Src and Kernel */ paddsw mm1, mm2 /* add 4 words of the high and low bytes */ paddsw mm7, mm1 /* add MM1 to accumulator MM7 */ movq mm1, [esi] /* load 8 bytes of the Src */ dec esi add esi, eax /* move Src pointer 1 row below */ movq mm3, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ punpcklbw mm1, mm0 /* unpack first 4 bytes into words */ pmullw mm1, mm3 /* mult. 4 low words of Src and Kernel */ paddsw mm7, mm1 /* add MM1 to accumulator MM7 */ /* --- 3 */ movq mm1, [esi] /* load 8 bytes of the Src */ movq mm2, mm1 /* copy MM1 into MM2 */ inc esi /* move pointer to the next 8 bytes of Src */ movq mm3, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ movq mm4, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ punpcklbw mm1, mm0 /* unpack first 4 bytes into words */ punpckhbw mm2, mm0 /* unpack second 4 bytes into words */ pmullw mm1, mm3 /* mult. 4 low words of Src and Kernel */ pmullw mm2, mm4 /* mult. 4 high words of Src and Kernel */ paddsw mm1, mm2 /* add 4 words of the high and low bytes */ paddsw mm7, mm1 /* add MM1 to accumulator MM7 */ movq mm1, [esi] /* load 8 bytes of the Src */ dec esi add esi, eax /* move Src pointer 1 row below */ movq mm3, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ punpcklbw mm1, mm0 /* unpack first 4 bytes into words */ pmullw mm1, mm3 /* mult. 4 low words of Src and Kernel */ paddsw mm7, mm1 /* add MM1 to accumulator MM7 */ /* --- 4 */ movq mm1, [esi] /* load 8 bytes of the Src */ movq mm2, mm1 /* copy MM1 into MM2 */ inc esi /* move pointer to the next 8 bytes of Src */ movq mm3, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ movq mm4, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ punpcklbw mm1, mm0 /* unpack first 4 bytes into words */ punpckhbw mm2, mm0 /* unpack second 4 bytes into words */ pmullw mm1, mm3 /* mult. 4 low words of Src and Kernel */ pmullw mm2, mm4 /* mult. 4 high words of Src and Kernel */ paddsw mm1, mm2 /* add 4 words of the high and low bytes */ paddsw mm7, mm1 /* add MM1 to accumulator MM7 */ movq mm1, [esi] /* load 8 bytes of the Src */ dec esi add esi, eax /* move Src pointer 1 row below */ movq mm3, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ punpcklbw mm1, mm0 /* unpack first 4 bytes into words */ pmullw mm1, mm3 /* mult. 4 low words of Src and Kernel */ paddsw mm7, mm1 /* add MM1 to accumulator MM7 */ /* --- 5 */ movq mm1, [esi] /* load 8 bytes of the Src */ movq mm2, mm1 /* copy MM1 into MM2 */ inc esi /* move pointer to the next 8 bytes of Src */ movq mm3, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ movq mm4, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ punpcklbw mm1, mm0 /* unpack first 4 bytes into words */ punpckhbw mm2, mm0 /* unpack second 4 bytes into words */ pmullw mm1, mm3 /* mult. 4 low words of Src and Kernel */ pmullw mm2, mm4 /* mult. 4 high words of Src and Kernel */ paddsw mm1, mm2 /* add 4 words of the high and low bytes */ paddsw mm7, mm1 /* add MM1 to accumulator MM7 */ movq mm1, [esi] /* load 8 bytes of the Src */ dec esi add esi, eax /* move Src pointer 1 row below */ movq mm3, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ punpcklbw mm1, mm0 /* unpack first 4 bytes into words */ pmullw mm1, mm3 /* mult. 4 low words of Src and Kernel */ paddsw mm7, mm1 /* add MM1 to accumulator MM7 */ /* --- 6 */ movq mm1, [esi] /* load 8 bytes of the Src */ movq mm2, mm1 /* copy MM1 into MM2 */ inc esi /* move pointer to the next 8 bytes of Src */ movq mm3, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ movq mm4, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ punpcklbw mm1, mm0 /* unpack first 4 bytes into words */ punpckhbw mm2, mm0 /* unpack second 4 bytes into words */ pmullw mm1, mm3 /* mult. 4 low words of Src and Kernel */ pmullw mm2, mm4 /* mult. 4 high words of Src and Kernel */ paddsw mm1, mm2 /* add 4 words of the high and low bytes */ paddsw mm7, mm1 /* add MM1 to accumulator MM7 */ movq mm1, [esi] /* load 8 bytes of the Src */ dec esi add esi, eax /* move Src pointer 1 row below */ movq mm3, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ punpcklbw mm1, mm0 /* unpack first 4 bytes into words */ pmullw mm1, mm3 /* mult. 4 low words of Src and Kernel */ paddsw mm7, mm1 /* add MM1 to accumulator MM7 */ /* --- 7 */ movq mm1, [esi] /* load 8 bytes of the Src */ movq mm2, mm1 /* copy MM1 into MM2 */ inc esi /* move pointer to the next 8 bytes of Src */ movq mm3, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ movq mm4, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ punpcklbw mm1, mm0 /* unpack first 4 bytes into words */ punpckhbw mm2, mm0 /* unpack second 4 bytes into words */ pmullw mm1, mm3 /* mult. 4 low words of Src and Kernel */ pmullw mm2, mm4 /* mult. 4 high words of Src and Kernel */ paddsw mm1, mm2 /* add 4 words of the high and low bytes */ paddsw mm7, mm1 /* add MM1 to accumulator MM7 */ movq mm1, [esi] /* load 8 bytes of the Src */ dec esi add esi, eax /* move Src pointer 1 row below */ movq mm3, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ punpcklbw mm1, mm0 /* unpack first 4 bytes into words */ pmullw mm1, mm3 /* mult. 4 low words of Src and Kernel */ paddsw mm7, mm1 /* add MM1 to accumulator MM7 */ /* --- 8 */ movq mm1, [esi] /* load 8 bytes of the Src */ movq mm2, mm1 /* copy MM1 into MM2 */ inc esi /* move pointer to the next 8 bytes of Src */ movq mm3, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ movq mm4, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ punpcklbw mm1, mm0 /* unpack first 4 bytes into words */ punpckhbw mm2, mm0 /* unpack second 4 bytes into words */ pmullw mm1, mm3 /* mult. 4 low words of Src and Kernel */ pmullw mm2, mm4 /* mult. 4 high words of Src and Kernel */ paddsw mm1, mm2 /* add 4 words of the high and low bytes */ paddsw mm7, mm1 /* add MM1 to accumulator MM7 */ movq mm1, [esi] /* load 8 bytes of the Src */ dec esi add esi, eax /* move Src pointer 1 row below */ movq mm3, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ punpcklbw mm1, mm0 /* unpack first 4 bytes into words */ pmullw mm1, mm3 /* mult. 4 low words of Src and Kernel */ paddsw mm7, mm1 /* add MM1 to accumulator MM7 */ /* --- 9 */ movq mm1, [esi] /* load 8 bytes of the Src */ movq mm2, mm1 /* copy MM1 into MM2 */ inc esi /* move pointer to the next 8 bytes of Src */ movq mm3, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ movq mm4, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ punpcklbw mm1, mm0 /* unpack first 4 bytes into words */ punpckhbw mm2, mm0 /* unpack second 4 bytes into words */ pmullw mm1, mm3 /* mult. 4 low words of Src and Kernel */ pmullw mm2, mm4 /* mult. 4 high words of Src and Kernel */ paddsw mm1, mm2 /* add 4 words of the high and low bytes */ paddsw mm7, mm1 /* add MM1 to accumulator MM7 */ movq mm1, [esi] /* load 8 bytes of the Src */ movq mm3, [edx] /* load 4 words of Kernel */ punpcklbw mm1, mm0 /* unpack first 4 bytes into words */ pmullw mm1, mm3 /* mult. 4 low words of Src and Kernel */ paddsw mm7, mm1 /* add MM1 to accumulator MM7 */ /* ---, */ movq mm3, mm7 /* copy MM7 into MM3 */ psrlq mm7, 32 /* shift 2 left words to the right */ paddsw mm7, mm3 /* add 2 left and 2 right result words */ movq mm2, mm7 /* copy MM7 into MM2 */ psrlq mm7, 16 /* shift 1 left word to the right */ paddsw mm7, mm2 /* add 1 left and 1 right result words */ /* ---, */ movd mm1, eax /* save EDX in MM1 */ movd mm2, ebx /* save EDX in MM2 */ movd mm3, edx /* save EDX in MM3 */ movd eax, mm7 /* load summation result into EAX */ psraw mm7, 15 /* spread sign bit of the result */ movd ebx, mm5 /* load Divisor into EBX */ movd edx, mm7 /* fill EDX with a sign bit */ idiv bx /* IDIV - VERY EXPENSIVE */ movd mm7, eax /* move result of division into MM7 */ packuswb mm7, mm0 /* pack division result with saturation */ movd eax, mm7 /* copy saturated result into EAX */ mov [edi], al /* copy a byte result into Dest */ movd edx, mm3 /* restore saved EDX */ movd ebx, mm2 /* restore saved EBX */ movd eax, mm1 /* restore saved EAX */ /* --, */ movd esi, mm6 /* move Src pointer to the top pixel */ sub edx, 208 /* EDX = Kernel address */ inc esi /* move Src pointer to the next pixel */ inc edi /* move Dest pointer to the next pixel */ /* ---, */ dec ecx /* decrease loop counter COLUMNS */ jnz L10352 /* check loop termination, proceed if required */ add esi, 8 /* move to the next row in Src */ add edi, 8 /* move to the next row in Dest */ dec ebx /* decrease loop counter ROWS */ jnz L10350 /* check loop termination, proceed if required */ /* ---, */ emms /* exit MMX state */ popa } #else # 5105 "SDL2_imageFilter.c" asm volatile ("pusha \n\t" "pxor %%mm0, %%mm0 \n\t" /* zero MM0 */ "xor %%ebx, %%ebx \n\t" /* zero EBX */ "mov %5, %%bl \n\t" /* load Divisor into BL */ "movd %%ebx, %%mm5 \n\t" /* copy Divisor into MM5 */ "mov %4, %%edx \n\t" /* load Kernel address into EDX */ "mov %1, %%esi \n\t" /* load Src address to ESI */ "mov %0, %%edi \n\t" /* load Dest address to EDI */ "add $4, %%edi \n\t" /* 4 column offset from the left edge */ "mov %3, %%eax \n\t" /* load columns into EAX */ "add %%eax, %%edi \n\t" /* 4 row offset from the top edge */ "add %%eax, %%edi \n\t" "add %%eax, %%edi \n\t" "add %%eax, %%edi \n\t" "mov %2, %%ebx \n\t" /* initialize ROWS counter */ "sub $8, %%ebx \n\t" /* do not use first 4 and last 4 rows */ /* --- */ ".L10350: \n\t" "mov %%eax, %%ecx \n\t" /* initialize COLUMNS counter */ "sub $8, %%ecx \n\t" /* do not use first 4 and last 4 columns */ ".align 16 \n\t" /* 16 byte alignment of the loop entry */ ".L10352: \n\t" "pxor %%mm7, %%mm7 \n\t" /* zero MM7 (accumulator) */ "movd %%esi, %%mm6 \n\t" /* save ESI in MM6 */ /* --- 1 */ "movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */ "movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */ "inc %%esi \n\t" /* move pointer to the next 8 bytes of Src */ "movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "movq (%%edx), %%mm4 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */ "punpckhbw %%mm0, %%mm2 \n\t" /* unpack second 4 bytes into words */ "pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */ "pmullw %%mm4, %%mm2 \n\t" /* mult. 4 high words of Src and Kernel */ "paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the high and low bytes */ "paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */ "movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */ "dec %%esi \n\t" "add %%eax, %%esi \n\t" /* move Src pointer 1 row below */ "movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */ "pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */ "paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */ /* --- 2 */ "movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */ "movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */ "inc %%esi \n\t" /* move pointer to the next 8 bytes of Src */ "movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "movq (%%edx), %%mm4 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */ "punpckhbw %%mm0, %%mm2 \n\t" /* unpack second 4 bytes into words */ "pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */ "pmullw %%mm4, %%mm2 \n\t" /* mult. 4 high words of Src and Kernel */ "paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the high and low bytes */ "paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */ "movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */ "dec %%esi \n\t" "add %%eax, %%esi \n\t" /* move Src pointer 1 row below */ "movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */ "pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */ "paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */ /* --- 3 */ "movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */ "movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */ "inc %%esi \n\t" /* move pointer to the next 8 bytes of Src */ "movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "movq (%%edx), %%mm4 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */ "punpckhbw %%mm0, %%mm2 \n\t" /* unpack second 4 bytes into words */ "pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */ "pmullw %%mm4, %%mm2 \n\t" /* mult. 4 high words of Src and Kernel */ "paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the high and low bytes */ "paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */ "movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */ "dec %%esi \n\t" "add %%eax, %%esi \n\t" /* move Src pointer 1 row below */ "movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */ "pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */ "paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */ /* --- 4 */ "movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */ "movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */ "inc %%esi \n\t" /* move pointer to the next 8 bytes of Src */ "movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "movq (%%edx), %%mm4 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */ "punpckhbw %%mm0, %%mm2 \n\t" /* unpack second 4 bytes into words */ "pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */ "pmullw %%mm4, %%mm2 \n\t" /* mult. 4 high words of Src and Kernel */ "paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the high and low bytes */ "paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */ "movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */ "dec %%esi \n\t" "add %%eax, %%esi \n\t" /* move Src pointer 1 row below */ "movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */ "pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */ "paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */ /* --- 5 */ "movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */ "movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */ "inc %%esi \n\t" /* move pointer to the next 8 bytes of Src */ "movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "movq (%%edx), %%mm4 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */ "punpckhbw %%mm0, %%mm2 \n\t" /* unpack second 4 bytes into words */ "pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */ "pmullw %%mm4, %%mm2 \n\t" /* mult. 4 high words of Src and Kernel */ "paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the high and low bytes */ "paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */ "movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */ "dec %%esi \n\t" "add %%eax, %%esi \n\t" /* move Src pointer 1 row below */ "movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */ "pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */ "paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */ /* --- 6 */ "movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */ "movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */ "inc %%esi \n\t" /* move pointer to the next 8 bytes of Src */ "movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "movq (%%edx), %%mm4 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */ "punpckhbw %%mm0, %%mm2 \n\t" /* unpack second 4 bytes into words */ "pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */ "pmullw %%mm4, %%mm2 \n\t" /* mult. 4 high words of Src and Kernel */ "paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the high and low bytes */ "paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */ "movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */ "dec %%esi \n\t" "add %%eax, %%esi \n\t" /* move Src pointer 1 row below */ "movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */ "pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */ "paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */ /* --- 7 */ "movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */ "movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */ "inc %%esi \n\t" /* move pointer to the next 8 bytes of Src */ "movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "movq (%%edx), %%mm4 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */ "punpckhbw %%mm0, %%mm2 \n\t" /* unpack second 4 bytes into words */ "pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */ "pmullw %%mm4, %%mm2 \n\t" /* mult. 4 high words of Src and Kernel */ "paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the high and low bytes */ "paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */ "movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */ "dec %%esi \n\t" "add %%eax, %%esi \n\t" /* move Src pointer 1 row below */ "movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */ "pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */ "paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */ /* --- 8 */ "movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */ "movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */ "inc %%esi \n\t" /* move pointer to the next 8 bytes of Src */ "movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "movq (%%edx), %%mm4 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */ "punpckhbw %%mm0, %%mm2 \n\t" /* unpack second 4 bytes into words */ "pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */ "pmullw %%mm4, %%mm2 \n\t" /* mult. 4 high words of Src and Kernel */ "paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the high and low bytes */ "paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */ "movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */ "dec %%esi \n\t" "add %%eax, %%esi \n\t" /* move Src pointer 1 row below */ "movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */ "pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */ "paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */ /* --- 9 */ "movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */ "movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */ "inc %%esi \n\t" /* move pointer to the next 8 bytes of Src */ "movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "movq (%%edx), %%mm4 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */ "punpckhbw %%mm0, %%mm2 \n\t" /* unpack second 4 bytes into words */ "pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */ "pmullw %%mm4, %%mm2 \n\t" /* mult. 4 high words of Src and Kernel */ "paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the high and low bytes */ "paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */ "movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */ "movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */ "punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */ "pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */ "paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */ /* --- */ "movq %%mm7, %%mm3 \n\t" /* copy MM7 into MM3 */ "psrlq $32, %%mm7 \n\t" /* shift 2 left words to the right */ "paddsw %%mm3, %%mm7 \n\t" /* add 2 left and 2 right result words */ "movq %%mm7, %%mm2 \n\t" /* copy MM7 into MM2 */ "psrlq $16, %%mm7 \n\t" /* shift 1 left word to the right */ "paddsw %%mm2, %%mm7 \n\t" /* add 1 left and 1 right result words */ /* --- */ "movd %%eax, %%mm1 \n\t" /* save EDX in MM1 */ "movd %%ebx, %%mm2 \n\t" /* save EDX in MM2 */ "movd %%edx, %%mm3 \n\t" /* save EDX in MM3 */ "movd %%mm7, %%eax \n\t" /* load summation result into EAX */ "psraw $15, %%mm7 \n\t" /* spread sign bit of the result */ "movd %%mm5, %%ebx \n\t" /* load Divisor into EBX */ "movd %%mm7, %%edx \n\t" /* fill EDX with a sign bit */ "idivw %%bx \n\t" /* IDIV - VERY EXPENSIVE */ "movd %%eax, %%mm7 \n\t" /* move result of division into MM7 */ "packuswb %%mm0, %%mm7 \n\t" /* pack division result with saturation */ "movd %%mm7, %%eax \n\t" /* copy saturated result into EAX */ "mov %%al, (%%edi) \n\t" /* copy a byte result into Dest */ "movd %%mm3, %%edx \n\t" /* restore saved EDX */ "movd %%mm2, %%ebx \n\t" /* restore saved EBX */ "movd %%mm1, %%eax \n\t" /* restore saved EAX */ /* -- */ "movd %%mm6, %%esi \n\t" /* move Src pointer to the top pixel */ "sub $208, %%edx \n\t" /* EDX = Kernel address */ "inc %%esi \n\t" /* move Src pointer to the next pixel */ "inc %%edi \n\t" /* move Dest pointer to the next pixel */ /* --- */ "dec %%ecx \n\t" /* decrease loop counter COLUMNS */ "jnz .L10352 \n\t" /* check loop termination, proceed if required */ "add $8, %%esi \n\t" /* move to the next row in Src */ "add $8, %%edi \n\t" /* move to the next row in Dest */ "dec %%ebx \n\t" /* decrease loop counter ROWS */ "jnz .L10350 \n\t" /* check loop termination, proceed if required */ /* --- */ "emms \n\t" /* exit MMX state */ "popa \n\t":"=m" (Dest) /* %0 */ :"m"(Src), /* %1 */ "m"(rows), /* %2 */ "m"(columns), /* %3 */ "m"(Kernel), /* %4 */ "m"(Divisor) /* %5 */ ); #endif # 5356 "SDL2_imageFilter.c" #endif # 5357 "SDL2_imageFilter.c" return (0); } else { /* No non-MMX implementation yet */ return (-1); } } /*! \brief Filter using ConvolveKernel3x3ShiftRight: Dij = saturation0and255( ... ) \param Src The source 2D byte array to convolve. Should be different from destination. \param Dest The destination 2D byte array to store the result in. Should be different from source. \param rows Number of rows in source/destination array. Must be >2. \param columns Number of columns in source/destination array. Must be >2. \param Kernel The 2D convolution kernel of size 3x3. \param NRightShift The number of right bit shifts to apply to the convolution sum. Must be <7. Note: Non-MMX implementation not available for this function. \return Returns 1 if filter was applied, 0 otherwise. */ int SDL_imageFilterConvolveKernel3x3ShiftRight(unsigned char *Src, unsigned char *Dest, int rows, int columns, signed short *Kernel, unsigned char NRightShift) { /* Validate input parameters */ if ((Src == NULL) || (Dest == NULL) || (Kernel == NULL)) return(-1); if ((columns < 3) || (rows < 3) || (NRightShift > 7)) return (-1); if ((SDL_imageFilterMMXdetect())) { //#ifdef USE_MMX #if defined(USE_MMX) && defined(i386) #if !defined(GCC__) __asm { pusha pxor mm0, mm0 /* zero MM0 */ xor ebx, ebx /* zero EBX */ mov bl, NRightShift /* load NRightShift into BL */ movd mm4, ebx /* copy NRightShift into MM4 */ mov edx, Kernel /* load Kernel address into EDX */ movq mm5, [edx] /* MM5 = {0,K2,K1,K0} */ add edx, 8 /* second row |K0 K1 K2 0| */ movq mm6, [edx] /* MM6 = {0,K5,K4,K3} K = |K3 K4 K5 0| */ add edx, 8 /* third row |K6 K7 K8 0| */ movq mm7, [edx] /* MM7 = {0,K8,K7,K6} */ /* ---, */ mov eax, columns /* load columns into EAX */ mov esi, Src /* ESI = Src row 0 address */ mov edi, Dest /* load Dest address to EDI */ add edi, eax /* EDI = EDI + columns */ inc edi /* 1 byte offset from the left edge */ mov edx, rows /* initialize ROWS counter */ sub edx, 2 /* do not use first and last row */ /* ---, */ L10360: mov ecx, eax /* initialize COLUMS counter */ sub ecx, 2 /* do not use first and last column */ align 16 /* 16 byte alignment of the loop entry */ L10362: /* ---, */ movq mm1, [esi] /* load 8 bytes of the image first row */ add esi, eax /* move one row below */ movq mm2, [esi] /* load 8 bytes of the image second row */ add esi, eax /* move one row below */ movq mm3, [esi] /* load 8 bytes of the image third row */ punpcklbw mm1, mm0 /* unpack first 4 bytes into words */ punpcklbw mm2, mm0 /* unpack first 4 bytes into words */ punpcklbw mm3, mm0 /* unpack first 4 bytes into words */ psrlw mm1, mm4 /* shift right each pixel NshiftRight times */ psrlw mm2, mm4 /* shift right each pixel NshiftRight times */ psrlw mm3, mm4 /* shift right each pixel NshiftRight times */ pmullw mm1, mm5 /* multiply words first row image*Kernel */ pmullw mm2, mm6 /* multiply words second row image*Kernel */ pmullw mm3, mm7 /* multiply words third row image*Kernel */ paddsw mm1, mm2 /* add 4 words of the first and second rows */ paddsw mm1, mm3 /* add 4 words of the third row and result */ movq mm2, mm1 /* copy MM1 into MM2 */ psrlq mm1, 32 /* shift 2 left words to the right */ paddsw mm1, mm2 /* add 2 left and 2 right result words */ movq mm3, mm1 /* copy MM1 into MM3 */ psrlq mm1, 16 /* shift 1 left word to the right */ paddsw mm1, mm3 /* add 1 left and 1 right result words */ packuswb mm1, mm0 /* pack shift result with saturation */ movd ebx, mm1 /* copy saturated result into EBX */ mov [edi], bl /* copy a byte result into Dest */ /* --, */ sub esi, eax /* move two rows up */ sub esi, eax inc esi /* move Src pointer to the next pixel */ inc edi /* move Dest pointer to the next pixel */ /* ---, */ dec ecx /* decrease loop counter COLUMNS */ jnz L10362 /* check loop termination, proceed if required */ add esi, 2 /* move to the next row in Src */ add edi, 2 /* move to the next row in Dest */ dec edx /* decrease loop counter ROWS */ jnz L10360 /* check loop termination, proceed if required */ /* ---, */ emms /* exit MMX state */ popa } #else # 5462 "SDL2_imageFilter.c" asm volatile ("pusha \n\t" "pxor %%mm0, %%mm0 \n\t" /* zero MM0 */ "xor %%ebx, %%ebx \n\t" /* zero EBX */ "mov %5, %%bl \n\t" /* load NRightShift into BL */ "movd %%ebx, %%mm4 \n\t" /* copy NRightShift into MM4 */ "mov %4, %%edx \n\t" /* load Kernel address into EDX */ "movq (%%edx), %%mm5 \n\t" /* MM5 = {0,K2,K1,K0} */ "add $8, %%edx \n\t" /* second row |K0 K1 K2 0| */ "movq (%%edx), %%mm6 \n\t" /* MM6 = {0,K5,K4,K3} K = |K3 K4 K5 0| */ "add $8, %%edx \n\t" /* third row |K6 K7 K8 0| */ "movq (%%edx), %%mm7 \n\t" /* MM7 = {0,K8,K7,K6} */ /* --- */ "mov %3, %%eax \n\t" /* load columns into EAX */ "mov %1, %%esi \n\t" /* ESI = Src row 0 address */ "mov %0, %%edi \n\t" /* load Dest address to EDI */ "add %%eax, %%edi \n\t" /* EDI = EDI + columns */ "inc %%edi \n\t" /* 1 byte offset from the left edge */ "mov %2, %%edx \n\t" /* initialize ROWS counter */ "sub $2, %%edx \n\t" /* do not use first and last row */ /* --- */ ".L10360: \n\t" "mov %%eax, %%ecx \n\t" /* initialize COLUMS counter */ "sub $2, %%ecx \n\t" /* do not use first and last column */ ".align 16 \n\t" /* 16 byte alignment of the loop entry */ ".L10362: \n\t" /* --- */ "movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the image first row */ "add %%eax, %%esi \n\t" /* move one row below */ "movq (%%esi), %%mm2 \n\t" /* load 8 bytes of the image second row */ "add %%eax, %%esi \n\t" /* move one row below */ "movq (%%esi), %%mm3 \n\t" /* load 8 bytes of the image third row */ "punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */ "punpcklbw %%mm0, %%mm2 \n\t" /* unpack first 4 bytes into words */ "punpcklbw %%mm0, %%mm3 \n\t" /* unpack first 4 bytes into words */ "psrlw %%mm4, %%mm1 \n\t" /* shift right each pixel NshiftRight times */ "psrlw %%mm4, %%mm2 \n\t" /* shift right each pixel NshiftRight times */ "psrlw %%mm4, %%mm3 \n\t" /* shift right each pixel NshiftRight times */ "pmullw %%mm5, %%mm1 \n\t" /* multiply words first row image*Kernel */ "pmullw %%mm6, %%mm2 \n\t" /* multiply words second row image*Kernel */ "pmullw %%mm7, %%mm3 \n\t" /* multiply words third row image*Kernel */ "paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the first and second rows */ "paddsw %%mm3, %%mm1 \n\t" /* add 4 words of the third row and result */ "movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */ "psrlq $32, %%mm1 \n\t" /* shift 2 left words to the right */ "paddsw %%mm2, %%mm1 \n\t" /* add 2 left and 2 right result words */ "movq %%mm1, %%mm3 \n\t" /* copy MM1 into MM3 */ "psrlq $16, %%mm1 \n\t" /* shift 1 left word to the right */ "paddsw %%mm3, %%mm1 \n\t" /* add 1 left and 1 right result words */ "packuswb %%mm0, %%mm1 \n\t" /* pack shift result with saturation */ "movd %%mm1, %%ebx \n\t" /* copy saturated result into EBX */ "mov %%bl, (%%edi) \n\t" /* copy a byte result into Dest */ /* -- */ "sub %%eax, %%esi \n\t" /* move two rows up */ "sub %%eax, %%esi \n\t" "inc %%esi \n\t" /* move Src pointer to the next pixel */ "inc %%edi \n\t" /* move Dest pointer to the next pixel */ /* --- */ "dec %%ecx \n\t" /* decrease loop counter COLUMNS */ "jnz .L10362 \n\t" /* check loop termination, proceed if required */ "add $2, %%esi \n\t" /* move to the next row in Src */ "add $2, %%edi \n\t" /* move to the next row in Dest */ "dec %%edx \n\t" /* decrease loop counter ROWS */ "jnz .L10360 \n\t" /* check loop termination, proceed if required */ /* --- */ "emms \n\t" /* exit MMX state */ "popa \n\t":"=m" (Dest) /* %0 */ :"m"(Src), /* %1 */ "m"(rows), /* %2 */ "m"(columns), /* %3 */ "m"(Kernel), /* %4 */ "m"(NRightShift) /* %5 */ ); #endif # 5533 "SDL2_imageFilter.c" #endif # 5534 "SDL2_imageFilter.c" return (0); } else { /* No non-MMX implementation yet */ return (-1); } } /*! \brief Filter using ConvolveKernel5x5ShiftRight: Dij = saturation0and255( ... ) \param Src The source 2D byte array to convolve. Should be different from destination. \param Dest The destination 2D byte array to store the result in. Should be different from source. \param rows Number of rows in source/destination array. Must be >4. \param columns Number of columns in source/destination array. Must be >4. \param Kernel The 2D convolution kernel of size 5x5. \param NRightShift The number of right bit shifts to apply to the convolution sum. Must be <7. Note: Non-MMX implementation not available for this function. \return Returns 1 if filter was applied, 0 otherwise. */ int SDL_imageFilterConvolveKernel5x5ShiftRight(unsigned char *Src, unsigned char *Dest, int rows, int columns, signed short *Kernel, unsigned char NRightShift) { /* Validate input parameters */ if ((Src == NULL) || (Dest == NULL) || (Kernel == NULL)) return(-1); if ((columns < 5) || (rows < 5) || (NRightShift > 7)) return (-1); if ((SDL_imageFilterMMXdetect())) { //#ifdef USE_MMX #if defined(USE_MMX) && defined(i386) #if !defined(GCC__) __asm { pusha pxor mm0, mm0 /* zero MM0 */ xor ebx, ebx /* zero EBX */ mov bl, NRightShift /* load NRightShift into BL */ movd mm5, ebx /* copy NRightShift into MM5 */ mov edx, Kernel /* load Kernel address into EDX */ mov esi, Src /* load Src address to ESI */ mov edi, Dest /* load Dest address to EDI */ add edi, 2 /* 2 column offset from the left edge */ mov eax, columns /* load columns into EAX */ shl eax, 1 /* EAX = columns * 2 */ add edi, eax /* 2 row offset from the top edge */ shr eax, 1 /* EAX = columns */ mov ebx, rows /* initialize ROWS counter */ sub ebx, 4 /* do not use first 2 and last 2 rows */ /* ---, */ L10370: mov ecx, eax /* initialize COLUMNS counter */ sub ecx, 4 /* do not use first 2 and last 2 columns */ align 16 /* 16 byte alignment of the loop entry */ L10372: pxor mm7, mm7 /* zero MM7 (accumulator) */ movd mm6, esi /* save ESI in MM6 */ /* --- 1 */ movq mm1, [esi] /* load 8 bytes of the Src */ movq mm2, mm1 /* copy MM1 into MM2 */ add esi, eax /* move Src pointer 1 row below */ movq mm3, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ movq mm4, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ punpcklbw mm1, mm0 /* unpack first 4 bytes into words */ punpckhbw mm2, mm0 /* unpack second 4 bytes into words */ psrlw mm1, mm5 /* shift right each pixel NshiftRight times */ psrlw mm2, mm5 /* shift right each pixel NshiftRight times */ pmullw mm1, mm3 /* mult 4 low words of Src and Kernel */ pmullw mm2, mm4 /* mult 4 high words of Src and Kernel */ paddsw mm1, mm2 /* add 4 words of the high and low bytes */ paddsw mm7, mm1 /* add MM1 to accumulator MM7 */ /* --- 2 */ movq mm1, [esi] /* load 8 bytes of the Src */ movq mm2, mm1 /* copy MM1 into MM2 */ add esi, eax /* move Src pointer 1 row below */ movq mm3, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ movq mm4, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ punpcklbw mm1, mm0 /* unpack first 4 bytes into words */ punpckhbw mm2, mm0 /* unpack second 4 bytes into words */ psrlw mm1, mm5 /* shift right each pixel NshiftRight times */ psrlw mm2, mm5 /* shift right each pixel NshiftRight times */ pmullw mm1, mm3 /* mult 4 low words of Src and Kernel */ pmullw mm2, mm4 /* mult 4 high words of Src and Kernel */ paddsw mm1, mm2 /* add 4 words of the high and low bytes */ paddsw mm7, mm1 /* add MM1 to accumulator MM7 */ /* --- 3 */ movq mm1, [esi] /* load 8 bytes of the Src */ movq mm2, mm1 /* copy MM1 into MM2 */ add esi, eax /* move Src pointer 1 row below */ movq mm3, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ movq mm4, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ punpcklbw mm1, mm0 /* unpack first 4 bytes into words */ punpckhbw mm2, mm0 /* unpack second 4 bytes into words */ psrlw mm1, mm5 /* shift right each pixel NshiftRight times */ psrlw mm2, mm5 /* shift right each pixel NshiftRight times */ pmullw mm1, mm3 /* mult 4 low words of Src and Kernel */ pmullw mm2, mm4 /* mult 4 high words of Src and Kernel */ paddsw mm1, mm2 /* add 4 words of the high and low bytes */ paddsw mm7, mm1 /* add MM1 to accumulator MM7 */ /* --- 4 */ movq mm1, [esi] /* load 8 bytes of the Src */ movq mm2, mm1 /* copy MM1 into MM2 */ add esi, eax /* move Src pointer 1 row below */ movq mm3, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ movq mm4, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ punpcklbw mm1, mm0 /* unpack first 4 bytes into words */ punpckhbw mm2, mm0 /* unpack second 4 bytes into words */ psrlw mm1, mm5 /* shift right each pixel NshiftRight times */ psrlw mm2, mm5 /* shift right each pixel NshiftRight times */ pmullw mm1, mm3 /* mult 4 low words of Src and Kernel */ pmullw mm2, mm4 /* mult 4 high words of Src and Kernel */ paddsw mm1, mm2 /* add 4 words of the high and low bytes */ paddsw mm7, mm1 /* add MM1 to accumulator MM7 */ /* --- 5 */ movq mm1, [esi] /* load 8 bytes of the Src */ movq mm2, mm1 /* copy MM1 into MM2 */ movq mm3, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ movq mm4, [edx] /* load 4 words of Kernel */ punpcklbw mm1, mm0 /* unpack first 4 bytes into words */ punpckhbw mm2, mm0 /* unpack second 4 bytes into words */ psrlw mm1, mm5 /* shift right each pixel NshiftRight times */ psrlw mm2, mm5 /* shift right each pixel NshiftRight times */ pmullw mm1, mm3 /* mult 4 low words of Src and Kernel */ pmullw mm2, mm4 /* mult 4 high words of Src and Kernel */ paddsw mm1, mm2 /* add 4 words of the high and low bytes */ paddsw mm7, mm1 /* add MM1 to accumulator MM7 */ /* ---, */ movq mm3, mm7 /* copy MM7 into MM3 */ psrlq mm7, 32 /* shift 2 left words to the right */ paddsw mm7, mm3 /* add 2 left and 2 right result words */ movq mm2, mm7 /* copy MM7 into MM2 */ psrlq mm7, 16 /* shift 1 left word to the right */ paddsw mm7, mm2 /* add 1 left and 1 right result words */ movd mm1, eax /* save EAX in MM1 */ packuswb mm7, mm0 /* pack division result with saturation */ movd eax, mm7 /* copy saturated result into EAX */ mov [edi], al /* copy a byte result into Dest */ movd eax, mm1 /* restore saved EAX */ /* --, */ movd esi, mm6 /* move Src pointer to the top pixel */ sub edx, 72 /* EDX = Kernel address */ inc esi /* move Src pointer to the next pixel */ inc edi /* move Dest pointer to the next pixel */ /* ---, */ dec ecx /* decrease loop counter COLUMNS */ jnz L10372 /* check loop termination, proceed if required */ add esi, 4 /* move to the next row in Src */ add edi, 4 /* move to the next row in Dest */ dec ebx /* decrease loop counter ROWS */ jnz L10370 /* check loop termination, proceed if required */ /* ---, */ emms /* exit MMX state */ popa } #else # 5701 "SDL2_imageFilter.c" asm volatile ("pusha \n\t" "pxor %%mm0, %%mm0 \n\t" /* zero MM0 */ "xor %%ebx, %%ebx \n\t" /* zero EBX */ "mov %5, %%bl \n\t" /* load NRightShift into BL */ "movd %%ebx, %%mm5 \n\t" /* copy NRightShift into MM5 */ "mov %4, %%edx \n\t" /* load Kernel address into EDX */ "mov %1, %%esi \n\t" /* load Src address to ESI */ "mov %0, %%edi \n\t" /* load Dest address to EDI */ "add $2, %%edi \n\t" /* 2 column offset from the left edge */ "mov %3, %%eax \n\t" /* load columns into EAX */ "shl $1, %%eax \n\t" /* EAX = columns * 2 */ "add %%eax, %%edi \n\t" /* 2 row offset from the top edge */ "shr $1, %%eax \n\t" /* EAX = columns */ "mov %2, %%ebx \n\t" /* initialize ROWS counter */ "sub $4, %%ebx \n\t" /* do not use first 2 and last 2 rows */ /* --- */ ".L10370: \n\t" "mov %%eax, %%ecx \n\t" /* initialize COLUMNS counter */ "sub $4, %%ecx \n\t" /* do not use first 2 and last 2 columns */ ".align 16 \n\t" /* 16 byte alignment of the loop entry */ ".L10372: \n\t" "pxor %%mm7, %%mm7 \n\t" /* zero MM7 (accumulator) */ "movd %%esi, %%mm6 \n\t" /* save ESI in MM6 */ /* --- 1 */ "movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */ "movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */ "add %%eax, %%esi \n\t" /* move Src pointer 1 row below */ "movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "movq (%%edx), %%mm4 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */ "punpckhbw %%mm0, %%mm2 \n\t" /* unpack second 4 bytes into words */ "psrlw %%mm5, %%mm1 \n\t" /* shift right each pixel NshiftRight times */ "psrlw %%mm5, %%mm2 \n\t" /* shift right each pixel NshiftRight times */ "pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */ "pmullw %%mm4, %%mm2 \n\t" /* mult. 4 high words of Src and Kernel */ "paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the high and low bytes */ "paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */ /* --- 2 */ "movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */ "movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */ "add %%eax, %%esi \n\t" /* move Src pointer 1 row below */ "movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "movq (%%edx), %%mm4 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */ "punpckhbw %%mm0, %%mm2 \n\t" /* unpack second 4 bytes into words */ "psrlw %%mm5, %%mm1 \n\t" /* shift right each pixel NshiftRight times */ "psrlw %%mm5, %%mm2 \n\t" /* shift right each pixel NshiftRight times */ "pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */ "pmullw %%mm4, %%mm2 \n\t" /* mult. 4 high words of Src and Kernel */ "paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the high and low bytes */ "paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */ /* --- 3 */ "movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */ "movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */ "add %%eax, %%esi \n\t" /* move Src pointer 1 row below */ "movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "movq (%%edx), %%mm4 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */ "punpckhbw %%mm0, %%mm2 \n\t" /* unpack second 4 bytes into words */ "psrlw %%mm5, %%mm1 \n\t" /* shift right each pixel NshiftRight times */ "psrlw %%mm5, %%mm2 \n\t" /* shift right each pixel NshiftRight times */ "pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */ "pmullw %%mm4, %%mm2 \n\t" /* mult. 4 high words of Src and Kernel */ "paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the high and low bytes */ "paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */ /* --- 4 */ "movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */ "movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */ "add %%eax, %%esi \n\t" /* move Src pointer 1 row below */ "movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "movq (%%edx), %%mm4 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */ "punpckhbw %%mm0, %%mm2 \n\t" /* unpack second 4 bytes into words */ "psrlw %%mm5, %%mm1 \n\t" /* shift right each pixel NshiftRight times */ "psrlw %%mm5, %%mm2 \n\t" /* shift right each pixel NshiftRight times */ "pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */ "pmullw %%mm4, %%mm2 \n\t" /* mult. 4 high words of Src and Kernel */ "paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the high and low bytes */ "paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */ /* --- 5 */ "movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */ "movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */ "movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "movq (%%edx), %%mm4 \n\t" /* load 4 words of Kernel */ "punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */ "punpckhbw %%mm0, %%mm2 \n\t" /* unpack second 4 bytes into words */ "psrlw %%mm5, %%mm1 \n\t" /* shift right each pixel NshiftRight times */ "psrlw %%mm5, %%mm2 \n\t" /* shift right each pixel NshiftRight times */ "pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */ "pmullw %%mm4, %%mm2 \n\t" /* mult. 4 high words of Src and Kernel */ "paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the high and low bytes */ "paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */ /* --- */ "movq %%mm7, %%mm3 \n\t" /* copy MM7 into MM3 */ "psrlq $32, %%mm7 \n\t" /* shift 2 left words to the right */ "paddsw %%mm3, %%mm7 \n\t" /* add 2 left and 2 right result words */ "movq %%mm7, %%mm2 \n\t" /* copy MM7 into MM2 */ "psrlq $16, %%mm7 \n\t" /* shift 1 left word to the right */ "paddsw %%mm2, %%mm7 \n\t" /* add 1 left and 1 right result words */ "movd %%eax, %%mm1 \n\t" /* save EAX in MM1 */ "packuswb %%mm0, %%mm7 \n\t" /* pack division result with saturation */ "movd %%mm7, %%eax \n\t" /* copy saturated result into EAX */ "mov %%al, (%%edi) \n\t" /* copy a byte result into Dest */ "movd %%mm1, %%eax \n\t" /* restore saved EAX */ /* -- */ "movd %%mm6, %%esi \n\t" /* move Src pointer to the top pixel */ "sub $72, %%edx \n\t" /* EDX = Kernel address */ "inc %%esi \n\t" /* move Src pointer to the next pixel */ "inc %%edi \n\t" /* move Dest pointer to the next pixel */ /* --- */ "dec %%ecx \n\t" /* decrease loop counter COLUMNS */ "jnz .L10372 \n\t" /* check loop termination, proceed if required */ "add $4, %%esi \n\t" /* move to the next row in Src */ "add $4, %%edi \n\t" /* move to the next row in Dest */ "dec %%ebx \n\t" /* decrease loop counter ROWS */ "jnz .L10370 \n\t" /* check loop termination, proceed if required */ /* --- */ "emms \n\t" /* exit MMX state */ "popa \n\t":"=m" (Dest) /* %0 */ :"m"(Src), /* %1 */ "m"(rows), /* %2 */ "m"(columns), /* %3 */ "m"(Kernel), /* %4 */ "m"(NRightShift) /* %5 */ ); #endif # 5834 "SDL2_imageFilter.c" #endif # 5835 "SDL2_imageFilter.c" return (0); } else { /* No non-MMX implementation yet */ return (-1); } } /*! \brief Filter using ConvolveKernel7x7ShiftRight: Dij = saturation0and255( ... ) \param Src The source 2D byte array to convolve. Should be different from destination. \param Dest The destination 2D byte array to store the result in. Should be different from source. \param rows Number of rows in source/destination array. Must be >6. \param columns Number of columns in source/destination array. Must be >6. \param Kernel The 2D convolution kernel of size 7x7. \param NRightShift The number of right bit shifts to apply to the convolution sum. Must be <7. Note: Non-MMX implementation not available for this function. \return Returns 1 if filter was applied, 0 otherwise. */ int SDL_imageFilterConvolveKernel7x7ShiftRight(unsigned char *Src, unsigned char *Dest, int rows, int columns, signed short *Kernel, unsigned char NRightShift) { /* Validate input parameters */ if ((Src == NULL) || (Dest == NULL) || (Kernel == NULL)) return(-1); if ((columns < 7) || (rows < 7) || (NRightShift > 7)) return (-1); if ((SDL_imageFilterMMXdetect())) { //#ifdef USE_MMX #if defined(USE_MMX) && defined(i386) #if !defined(GCC__) __asm { pusha pxor mm0, mm0 /* zero MM0 */ xor ebx, ebx /* zero EBX */ mov bl, NRightShift /* load NRightShift into BL */ movd mm5, ebx /* copy NRightShift into MM5 */ mov edx, Kernel /* load Kernel address into EDX */ mov esi, Src /* load Src address to ESI */ mov edi, Dest /* load Dest address to EDI */ add edi, 3 /* 3 column offset from the left edge */ mov eax, columns /* load columns into EAX */ add edi, eax /* 3 row offset from the top edge */ add edi, eax add edi, eax mov ebx, rows /* initialize ROWS counter */ sub ebx, 6 /* do not use first 3 and last 3 rows */ /* ---, */ L10380: mov ecx, eax /* initialize COLUMNS counter */ sub ecx, 6 /* do not use first 3 and last 3 columns */ align 16 /* 16 byte alignment of the loop entry */ L10382: pxor mm7, mm7 /* zero MM7 (accumulator) */ movd mm6, esi /* save ESI in MM6 */ /* --- 1 */ movq mm1, [esi] /* load 8 bytes of the Src */ movq mm2, mm1 /* copy MM1 into MM2 */ add esi, eax /* move Src pointer 1 row below */ movq mm3, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ movq mm4, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ punpcklbw mm1, mm0 /* unpack first 4 bytes into words */ punpckhbw mm2, mm0 /* unpack second 4 bytes into words */ psrlw mm1, mm5 /* shift right each pixel NshiftRight times */ psrlw mm2, mm5 /* shift right each pixel NshiftRight times */ pmullw mm1, mm3 /* mult 4 low words of Src and Kernel */ pmullw mm2, mm4 /* mult 4 high words of Src and Kernel */ paddsw mm1, mm2 /* add 4 words of the high and low bytes */ paddsw mm7, mm1 /* add MM1 to accumulator MM7 */ /* --- 2 */ movq mm1, [esi] /* load 8 bytes of the Src */ movq mm2, mm1 /* copy MM1 into MM2 */ add esi, eax /* move Src pointer 1 row below */ movq mm3, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ movq mm4, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ punpcklbw mm1, mm0 /* unpack first 4 bytes into words */ punpckhbw mm2, mm0 /* unpack second 4 bytes into words */ psrlw mm1, mm5 /* shift right each pixel NshiftRight times */ psrlw mm2, mm5 /* shift right each pixel NshiftRight times */ pmullw mm1, mm3 /* mult 4 low words of Src and Kernel */ pmullw mm2, mm4 /* mult 4 high words of Src and Kernel */ paddsw mm1, mm2 /* add 4 words of the high and low bytes */ paddsw mm7, mm1 /* add MM1 to accumulator MM7 */ /* --- 3 */ movq mm1, [esi] /* load 8 bytes of the Src */ movq mm2, mm1 /* copy MM1 into MM2 */ add esi, eax /* move Src pointer 1 row below */ movq mm3, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ movq mm4, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ punpcklbw mm1, mm0 /* unpack first 4 bytes into words */ punpckhbw mm2, mm0 /* unpack second 4 bytes into words */ psrlw mm1, mm5 /* shift right each pixel NshiftRight times */ psrlw mm2, mm5 /* shift right each pixel NshiftRight times */ pmullw mm1, mm3 /* mult 4 low words of Src and Kernel */ pmullw mm2, mm4 /* mult 4 high words of Src and Kernel */ paddsw mm1, mm2 /* add 4 words of the high and low bytes */ paddsw mm7, mm1 /* add MM1 to accumulator MM7 */ /* --- 4 */ movq mm1, [esi] /* load 8 bytes of the Src */ movq mm2, mm1 /* copy MM1 into MM2 */ add esi, eax /* move Src pointer 1 row below */ movq mm3, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ movq mm4, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ punpcklbw mm1, mm0 /* unpack first 4 bytes into words */ punpckhbw mm2, mm0 /* unpack second 4 bytes into words */ psrlw mm1, mm5 /* shift right each pixel NshiftRight times */ psrlw mm2, mm5 /* shift right each pixel NshiftRight times */ pmullw mm1, mm3 /* mult 4 low words of Src and Kernel */ pmullw mm2, mm4 /* mult 4 high words of Src and Kernel */ paddsw mm1, mm2 /* add 4 words of the high and low bytes */ paddsw mm7, mm1 /* add MM1 to accumulator MM7 */ /* --- 5 */ movq mm1, [esi] /* load 8 bytes of the Src */ movq mm2, mm1 /* copy MM1 into MM2 */ add esi, eax /* move Src pointer 1 row below */ movq mm3, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ movq mm4, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ punpcklbw mm1, mm0 /* unpack first 4 bytes into words */ punpckhbw mm2, mm0 /* unpack second 4 bytes into words */ psrlw mm1, mm5 /* shift right each pixel NshiftRight times */ psrlw mm2, mm5 /* shift right each pixel NshiftRight times */ pmullw mm1, mm3 /* mult 4 low words of Src and Kernel */ pmullw mm2, mm4 /* mult 4 high words of Src and Kernel */ paddsw mm1, mm2 /* add 4 words of the high and low bytes */ paddsw mm7, mm1 /* add MM1 to accumulator MM7 */ /* --- 6 */ movq mm1, [esi] /* load 8 bytes of the Src */ movq mm2, mm1 /* copy MM1 into MM2 */ add esi, eax /* move Src pointer 1 row below */ movq mm3, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ movq mm4, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ punpcklbw mm1, mm0 /* unpack first 4 bytes into words */ punpckhbw mm2, mm0 /* unpack second 4 bytes into words */ psrlw mm1, mm5 /* shift right each pixel NshiftRight times */ psrlw mm2, mm5 /* shift right each pixel NshiftRight times */ pmullw mm1, mm3 /* mult 4 low words of Src and Kernel */ pmullw mm2, mm4 /* mult 4 high words of Src and Kernel */ paddsw mm1, mm2 /* add 4 words of the high and low bytes */ paddsw mm7, mm1 /* add MM1 to accumulator MM7 */ /* --- 7 */ movq mm1, [esi] /* load 8 bytes of the Src */ movq mm2, mm1 /* copy MM1 into MM2 */ movq mm3, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ movq mm4, [edx] /* load 4 words of Kernel */ punpcklbw mm1, mm0 /* unpack first 4 bytes into words */ punpckhbw mm2, mm0 /* unpack second 4 bytes into words */ psrlw mm1, mm5 /* shift right each pixel NshiftRight times */ psrlw mm2, mm5 /* shift right each pixel NshiftRight times */ pmullw mm1, mm3 /* mult 4 low words of Src and Kernel */ pmullw mm2, mm4 /* mult 4 high words of Src and Kernel */ paddsw mm1, mm2 /* add 4 words of the high and low bytes */ paddsw mm7, mm1 /* add MM1 to accumulator MM7 */ /* ---, */ movq mm3, mm7 /* copy MM7 into MM3 */ psrlq mm7, 32 /* shift 2 left words to the right */ paddsw mm7, mm3 /* add 2 left and 2 right result words */ movq mm2, mm7 /* copy MM7 into MM2 */ psrlq mm7, 16 /* shift 1 left word to the right */ paddsw mm7, mm2 /* add 1 left and 1 right result words */ movd mm1, eax /* save EAX in MM1 */ packuswb mm7, mm0 /* pack division result with saturation */ movd eax, mm7 /* copy saturated result into EAX */ mov [edi], al /* copy a byte result into Dest */ movd eax, mm1 /* restore saved EAX */ /* --, */ movd esi, mm6 /* move Src pointer to the top pixel */ sub edx, 104 /* EDX = Kernel address */ inc esi /* move Src pointer to the next pixel */ inc edi /* move Dest pointer to the next pixel */ /* ---, */ dec ecx /* decrease loop counter COLUMNS */ jnz L10382 /* check loop termination, proceed if required */ add esi, 6 /* move to the next row in Src */ add edi, 6 /* move to the next row in Dest */ dec ebx /* decrease loop counter ROWS */ jnz L10380 /* check loop termination, proceed if required */ /* ---, */ emms /* exit MMX state */ popa } #else # 6034 "SDL2_imageFilter.c" asm volatile ("pusha \n\t" "pxor %%mm0, %%mm0 \n\t" /* zero MM0 */ "xor %%ebx, %%ebx \n\t" /* zero EBX */ "mov %5, %%bl \n\t" /* load NRightShift into BL */ "movd %%ebx, %%mm5 \n\t" /* copy NRightShift into MM5 */ "mov %4, %%edx \n\t" /* load Kernel address into EDX */ "mov %1, %%esi \n\t" /* load Src address to ESI */ "mov %0, %%edi \n\t" /* load Dest address to EDI */ "add $3, %%edi \n\t" /* 3 column offset from the left edge */ "mov %3, %%eax \n\t" /* load columns into EAX */ "add %%eax, %%edi \n\t" /* 3 row offset from the top edge */ "add %%eax, %%edi \n\t" "add %%eax, %%edi \n\t" "mov %2, %%ebx \n\t" /* initialize ROWS counter */ "sub $6, %%ebx \n\t" /* do not use first 3 and last 3 rows */ /* --- */ ".L10380: \n\t" "mov %%eax, %%ecx \n\t" /* initialize COLUMNS counter */ "sub $6, %%ecx \n\t" /* do not use first 3 and last 3 columns */ ".align 16 \n\t" /* 16 byte alignment of the loop entry */ ".L10382: \n\t" "pxor %%mm7, %%mm7 \n\t" /* zero MM7 (accumulator) */ "movd %%esi, %%mm6 \n\t" /* save ESI in MM6 */ /* --- 1 */ "movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */ "movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */ "add %%eax, %%esi \n\t" /* move Src pointer 1 row below */ "movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "movq (%%edx), %%mm4 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */ "punpckhbw %%mm0, %%mm2 \n\t" /* unpack second 4 bytes into words */ "psrlw %%mm5, %%mm1 \n\t" /* shift right each pixel NshiftRight times */ "psrlw %%mm5, %%mm2 \n\t" /* shift right each pixel NshiftRight times */ "pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */ "pmullw %%mm4, %%mm2 \n\t" /* mult. 4 high words of Src and Kernel */ "paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the high and low bytes */ "paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */ /* --- 2 */ "movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */ "movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */ "add %%eax, %%esi \n\t" /* move Src pointer 1 row below */ "movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "movq (%%edx), %%mm4 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */ "punpckhbw %%mm0, %%mm2 \n\t" /* unpack second 4 bytes into words */ "psrlw %%mm5, %%mm1 \n\t" /* shift right each pixel NshiftRight times */ "psrlw %%mm5, %%mm2 \n\t" /* shift right each pixel NshiftRight times */ "pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */ "pmullw %%mm4, %%mm2 \n\t" /* mult. 4 high words of Src and Kernel */ "paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the high and low bytes */ "paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */ /* --- 3 */ "movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */ "movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */ "add %%eax, %%esi \n\t" /* move Src pointer 1 row below */ "movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "movq (%%edx), %%mm4 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */ "punpckhbw %%mm0, %%mm2 \n\t" /* unpack second 4 bytes into words */ "psrlw %%mm5, %%mm1 \n\t" /* shift right each pixel NshiftRight times */ "psrlw %%mm5, %%mm2 \n\t" /* shift right each pixel NshiftRight times */ "pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */ "pmullw %%mm4, %%mm2 \n\t" /* mult. 4 high words of Src and Kernel */ "paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the high and low bytes */ "paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */ /* --- 4 */ "movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */ "movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */ "add %%eax, %%esi \n\t" /* move Src pointer 1 row below */ "movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "movq (%%edx), %%mm4 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */ "punpckhbw %%mm0, %%mm2 \n\t" /* unpack second 4 bytes into words */ "psrlw %%mm5, %%mm1 \n\t" /* shift right each pixel NshiftRight times */ "psrlw %%mm5, %%mm2 \n\t" /* shift right each pixel NshiftRight times */ "pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */ "pmullw %%mm4, %%mm2 \n\t" /* mult. 4 high words of Src and Kernel */ "paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the high and low bytes */ "paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */ /* --- 5 */ "movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */ "movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */ "add %%eax, %%esi \n\t" /* move Src pointer 1 row below */ "movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "movq (%%edx), %%mm4 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */ "punpckhbw %%mm0, %%mm2 \n\t" /* unpack second 4 bytes into words */ "psrlw %%mm5, %%mm1 \n\t" /* shift right each pixel NshiftRight times */ "psrlw %%mm5, %%mm2 \n\t" /* shift right each pixel NshiftRight times */ "pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */ "pmullw %%mm4, %%mm2 \n\t" /* mult. 4 high words of Src and Kernel */ "paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the high and low bytes */ "paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */ /* --- 6 */ "movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */ "movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */ "add %%eax, %%esi \n\t" /* move Src pointer 1 row below */ "movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "movq (%%edx), %%mm4 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */ "punpckhbw %%mm0, %%mm2 \n\t" /* unpack second 4 bytes into words */ "psrlw %%mm5, %%mm1 \n\t" /* shift right each pixel NshiftRight times */ "psrlw %%mm5, %%mm2 \n\t" /* shift right each pixel NshiftRight times */ "pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */ "pmullw %%mm4, %%mm2 \n\t" /* mult. 4 high words of Src and Kernel */ "paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the high and low bytes */ "paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */ /* --- 7 */ "movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */ "movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */ "movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "movq (%%edx), %%mm4 \n\t" /* load 4 words of Kernel */ "punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */ "punpckhbw %%mm0, %%mm2 \n\t" /* unpack second 4 bytes into words */ "psrlw %%mm5, %%mm1 \n\t" /* shift right each pixel NshiftRight times */ "psrlw %%mm5, %%mm2 \n\t" /* shift right each pixel NshiftRight times */ "pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */ "pmullw %%mm4, %%mm2 \n\t" /* mult. 4 high words of Src and Kernel */ "paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the high and low bytes */ "paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */ /* --- */ "movq %%mm7, %%mm3 \n\t" /* copy MM7 into MM3 */ "psrlq $32, %%mm7 \n\t" /* shift 2 left words to the right */ "paddsw %%mm3, %%mm7 \n\t" /* add 2 left and 2 right result words */ "movq %%mm7, %%mm2 \n\t" /* copy MM7 into MM2 */ "psrlq $16, %%mm7 \n\t" /* shift 1 left word to the right */ "paddsw %%mm2, %%mm7 \n\t" /* add 1 left and 1 right result words */ "movd %%eax, %%mm1 \n\t" /* save EAX in MM1 */ "packuswb %%mm0, %%mm7 \n\t" /* pack division result with saturation */ "movd %%mm7, %%eax \n\t" /* copy saturated result into EAX */ "mov %%al, (%%edi) \n\t" /* copy a byte result into Dest */ "movd %%mm1, %%eax \n\t" /* restore saved EAX */ /* -- */ "movd %%mm6, %%esi \n\t" /* move Src pointer to the top pixel */ "sub $104, %%edx \n\t" /* EDX = Kernel address */ "inc %%esi \n\t" /* move Src pointer to the next pixel */ "inc %%edi \n\t" /* move Dest pointer to the next pixel */ /* --- */ "dec %%ecx \n\t" /* decrease loop counter COLUMNS */ "jnz .L10382 \n\t" /* check loop termination, proceed if required */ "add $6, %%esi \n\t" /* move to the next row in Src */ "add $6, %%edi \n\t" /* move to the next row in Dest */ "dec %%ebx \n\t" /* decrease loop counter ROWS */ "jnz .L10380 \n\t" /* check loop termination, proceed if required */ /* --- */ "emms \n\t" /* exit MMX state */ "popa \n\t":"=m" (Dest) /* %0 */ :"m"(Src), /* %1 */ "m"(rows), /* %2 */ "m"(columns), /* %3 */ "m"(Kernel), /* %4 */ "m"(NRightShift) /* %5 */ ); #endif # 6197 "SDL2_imageFilter.c" #endif # 6198 "SDL2_imageFilter.c" return (0); } else { /* No non-MMX implementation yet */ return (-1); } } /*! \brief Filter using ConvolveKernel9x9ShiftRight: Dij = saturation255( ... ) \param Src The source 2D byte array to convolve. Should be different from destination. \param Dest The destination 2D byte array to store the result in. Should be different from source. \param rows Number of rows in source/destination array. Must be >8. \param columns Number of columns in source/destination array. Must be >8. \param Kernel The 2D convolution kernel of size 9x9. \param NRightShift The number of right bit shifts to apply to the convolution sum. Must be <7. Note: Non-MMX implementation not available for this function. \return Returns 1 if filter was applied, 0 otherwise. */ int SDL_imageFilterConvolveKernel9x9ShiftRight(unsigned char *Src, unsigned char *Dest, int rows, int columns, signed short *Kernel, unsigned char NRightShift) { /* Validate input parameters */ if ((Src == NULL) || (Dest == NULL) || (Kernel == NULL)) return(-1); if ((columns < 9) || (rows < 9) || (NRightShift > 7)) return (-1); if ((SDL_imageFilterMMXdetect())) { //#ifdef USE_MMX #if defined(USE_MMX) && defined(i386) #if !defined(GCC__) __asm { pusha pxor mm0, mm0 /* zero MM0 */ xor ebx, ebx /* zero EBX */ mov bl, NRightShift /* load NRightShift into BL */ movd mm5, ebx /* copy NRightShift into MM5 */ mov edx, Kernel /* load Kernel address into EDX */ mov esi, Src /* load Src address to ESI */ mov edi, Dest /* load Dest address to EDI */ add edi, 4 /* 4 column offset from the left edge */ mov eax, columns /* load columns into EAX */ add edi, eax /* 4 row offset from the top edge */ add edi, eax add edi, eax add edi, eax mov ebx, rows /* initialize ROWS counter */ sub ebx, 8 /* do not use first 4 and last 4 rows */ /* ---, */ L10390: mov ecx, eax /* initialize COLUMNS counter */ sub ecx, 8 /* do not use first 4 and last 4 columns */ align 16 /* 16 byte alignment of the loop entry */ L10392: pxor mm7, mm7 /* zero MM7 (accumulator) */ movd mm6, esi /* save ESI in MM6 */ /* --- 1 */ movq mm1, [esi] /* load 8 bytes of the Src */ movq mm2, mm1 /* copy MM1 into MM2 */ inc esi /* move pointer to the next 8 bytes of Src */ movq mm3, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ movq mm4, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ punpcklbw mm1, mm0 /* unpack first 4 bytes into words */ punpckhbw mm2, mm0 /* unpack second 4 bytes into words */ psrlw mm1, mm5 /* shift right each pixel NshiftRight times */ psrlw mm2, mm5 /* shift right each pixel NshiftRight times */ pmullw mm1, mm3 /* mult 4 low words of Src and Kernel */ pmullw mm2, mm4 /* mult 4 high words of Src and Kernel */ paddsw mm1, mm2 /* add 4 words of the high and low bytes */ paddsw mm7, mm1 /* add MM1 to accumulator MM7 */ movq mm1, [esi] /* load 8 bytes of the Src */ dec esi add esi, eax /* move Src pointer 1 row below */ movq mm3, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ punpcklbw mm1, mm0 /* unpack first 4 bytes into words */ psrlw mm1, mm5 /* shift right each pixel NshiftRight times */ pmullw mm1, mm3 /* mult 4 low words of Src and Kernel */ paddsw mm7, mm1 /* add MM1 to accumulator MM7 */ /* --- 2 */ movq mm1, [esi] /* load 8 bytes of the Src */ movq mm2, mm1 /* copy MM1 into MM2 */ inc esi /* move pointer to the next 8 bytes of Src */ movq mm3, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ movq mm4, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ punpcklbw mm1, mm0 /* unpack first 4 bytes into words */ punpckhbw mm2, mm0 /* unpack second 4 bytes into words */ psrlw mm1, mm5 /* shift right each pixel NshiftRight times */ psrlw mm2, mm5 /* shift right each pixel NshiftRight times */ pmullw mm1, mm3 /* mult 4 low words of Src and Kernel */ pmullw mm2, mm4 /* mult 4 high words of Src and Kernel */ paddsw mm1, mm2 /* add 4 words of the high and low bytes */ paddsw mm7, mm1 /* add MM1 to accumulator MM7 */ movq mm1, [esi] /* load 8 bytes of the Src */ dec esi add esi, eax /* move Src pointer 1 row below */ movq mm3, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ punpcklbw mm1, mm0 /* unpack first 4 bytes into words */ psrlw mm1, mm5 /* shift right each pixel NshiftRight times */ pmullw mm1, mm3 /* mult 4 low words of Src and Kernel */ paddsw mm7, mm1 /* add MM1 to accumulator MM7 */ /* --- 3 */ movq mm1, [esi] /* load 8 bytes of the Src */ movq mm2, mm1 /* copy MM1 into MM2 */ inc esi /* move pointer to the next 8 bytes of Src */ movq mm3, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ movq mm4, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ punpcklbw mm1, mm0 /* unpack first 4 bytes into words */ punpckhbw mm2, mm0 /* unpack second 4 bytes into words */ psrlw mm1, mm5 /* shift right each pixel NshiftRight times */ psrlw mm2, mm5 /* shift right each pixel NshiftRight times */ pmullw mm1, mm3 /* mult 4 low words of Src and Kernel */ pmullw mm2, mm4 /* mult 4 high words of Src and Kernel */ paddsw mm1, mm2 /* add 4 words of the high and low bytes */ paddsw mm7, mm1 /* add MM1 to accumulator MM7 */ movq mm1, [esi] /* load 8 bytes of the Src */ dec esi add esi, eax /* move Src pointer 1 row below */ movq mm3, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ punpcklbw mm1, mm0 /* unpack first 4 bytes into words */ psrlw mm1, mm5 /* shift right each pixel NshiftRight times */ pmullw mm1, mm3 /* mult 4 low words of Src and Kernel */ paddsw mm7, mm1 /* add MM1 to accumulator MM7 */ /* --- 4 */ movq mm1, [esi] /* load 8 bytes of the Src */ movq mm2, mm1 /* copy MM1 into MM2 */ inc esi /* move pointer to the next 8 bytes of Src */ movq mm3, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ movq mm4, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ punpcklbw mm1, mm0 /* unpack first 4 bytes into words */ punpckhbw mm2, mm0 /* unpack second 4 bytes into words */ psrlw mm1, mm5 /* shift right each pixel NshiftRight times */ psrlw mm2, mm5 /* shift right each pixel NshiftRight times */ pmullw mm1, mm3 /* mult 4 low words of Src and Kernel */ pmullw mm2, mm4 /* mult 4 high words of Src and Kernel */ paddsw mm1, mm2 /* add 4 words of the high and low bytes */ paddsw mm7, mm1 /* add MM1 to accumulator MM7 */ movq mm1, [esi] /* load 8 bytes of the Src */ dec esi add esi, eax /* move Src pointer 1 row below */ movq mm3, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ punpcklbw mm1, mm0 /* unpack first 4 bytes into words */ psrlw mm1, mm5 /* shift right each pixel NshiftRight times */ pmullw mm1, mm3 /* mult 4 low words of Src and Kernel */ paddsw mm7, mm1 /* add MM1 to accumulator MM7 */ /* --- 5 */ movq mm1, [esi] /* load 8 bytes of the Src */ movq mm2, mm1 /* copy MM1 into MM2 */ inc esi /* move pointer to the next 8 bytes of Src */ movq mm3, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ movq mm4, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ punpcklbw mm1, mm0 /* unpack first 4 bytes into words */ punpckhbw mm2, mm0 /* unpack second 4 bytes into words */ psrlw mm1, mm5 /* shift right each pixel NshiftRight times */ psrlw mm2, mm5 /* shift right each pixel NshiftRight times */ pmullw mm1, mm3 /* mult 4 low words of Src and Kernel */ pmullw mm2, mm4 /* mult 4 high words of Src and Kernel */ paddsw mm1, mm2 /* add 4 words of the high and low bytes */ paddsw mm7, mm1 /* add MM1 to accumulator MM7 */ movq mm1, [esi] /* load 8 bytes of the Src */ dec esi add esi, eax /* move Src pointer 1 row below */ movq mm3, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ punpcklbw mm1, mm0 /* unpack first 4 bytes into words */ psrlw mm1, mm5 /* shift right each pixel NshiftRight times */ pmullw mm1, mm3 /* mult 4 low words of Src and Kernel */ paddsw mm7, mm1 /* add MM1 to accumulator MM7 */ /* --- 6 */ movq mm1, [esi] /* load 8 bytes of the Src */ movq mm2, mm1 /* copy MM1 into MM2 */ inc esi /* move pointer to the next 8 bytes of Src */ movq mm3, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ movq mm4, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ punpcklbw mm1, mm0 /* unpack first 4 bytes into words */ punpckhbw mm2, mm0 /* unpack second 4 bytes into words */ psrlw mm1, mm5 /* shift right each pixel NshiftRight times */ psrlw mm2, mm5 /* shift right each pixel NshiftRight times */ pmullw mm1, mm3 /* mult 4 low words of Src and Kernel */ pmullw mm2, mm4 /* mult 4 high words of Src and Kernel */ paddsw mm1, mm2 /* add 4 words of the high and low bytes */ paddsw mm7, mm1 /* add MM1 to accumulator MM7 */ movq mm1, [esi] /* load 8 bytes of the Src */ dec esi add esi, eax /* move Src pointer 1 row below */ movq mm3, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ punpcklbw mm1, mm0 /* unpack first 4 bytes into words */ psrlw mm1, mm5 /* shift right each pixel NshiftRight times */ pmullw mm1, mm3 /* mult 4 low words of Src and Kernel */ paddsw mm7, mm1 /* add MM1 to accumulator MM7 */ /* --- 7 */ movq mm1, [esi] /* load 8 bytes of the Src */ movq mm2, mm1 /* copy MM1 into MM2 */ inc esi /* move pointer to the next 8 bytes of Src */ movq mm3, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ movq mm4, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ punpcklbw mm1, mm0 /* unpack first 4 bytes into words */ punpckhbw mm2, mm0 /* unpack second 4 bytes into words */ psrlw mm1, mm5 /* shift right each pixel NshiftRight times */ psrlw mm2, mm5 /* shift right each pixel NshiftRight times */ pmullw mm1, mm3 /* mult 4 low words of Src and Kernel */ pmullw mm2, mm4 /* mult 4 high words of Src and Kernel */ paddsw mm1, mm2 /* add 4 words of the high and low bytes */ paddsw mm7, mm1 /* add MM1 to accumulator MM7 */ movq mm1, [esi] /* load 8 bytes of the Src */ dec esi add esi, eax /* move Src pointer 1 row below */ movq mm3, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ punpcklbw mm1, mm0 /* unpack first 4 bytes into words */ psrlw mm1, mm5 /* shift right each pixel NshiftRight times */ pmullw mm1, mm3 /* mult 4 low words of Src and Kernel */ paddsw mm7, mm1 /* add MM1 to accumulator MM7 */ /* --- 8 */ movq mm1, [esi] /* load 8 bytes of the Src */ movq mm2, mm1 /* copy MM1 into MM2 */ inc esi /* move pointer to the next 8 bytes of Src */ movq mm3, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ movq mm4, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ punpcklbw mm1, mm0 /* unpack first 4 bytes into words */ punpckhbw mm2, mm0 /* unpack second 4 bytes into words */ psrlw mm1, mm5 /* shift right each pixel NshiftRight times */ psrlw mm2, mm5 /* shift right each pixel NshiftRight times */ pmullw mm1, mm3 /* mult 4 low words of Src and Kernel */ pmullw mm2, mm4 /* mult 4 high words of Src and Kernel */ paddsw mm1, mm2 /* add 4 words of the high and low bytes */ paddsw mm7, mm1 /* add MM1 to accumulator MM7 */ movq mm1, [esi] /* load 8 bytes of the Src */ dec esi add esi, eax /* move Src pointer 1 row below */ movq mm3, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ punpcklbw mm1, mm0 /* unpack first 4 bytes into words */ psrlw mm1, mm5 /* shift right each pixel NshiftRight times */ pmullw mm1, mm3 /* mult 4 low words of Src and Kernel */ paddsw mm7, mm1 /* add MM1 to accumulator MM7 */ /* --- 9 */ movq mm1, [esi] /* load 8 bytes of the Src */ movq mm2, mm1 /* copy MM1 into MM2 */ inc esi /* move pointer to the next 8 bytes of Src */ movq mm3, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ movq mm4, [edx] /* load 4 words of Kernel */ add edx, 8 /* move pointer to other 4 words */ punpcklbw mm1, mm0 /* unpack first 4 bytes into words */ punpckhbw mm2, mm0 /* unpack second 4 bytes into words */ psrlw mm1, mm5 /* shift right each pixel NshiftRight times */ psrlw mm2, mm5 /* shift right each pixel NshiftRight times */ pmullw mm1, mm3 /* mult 4 low words of Src and Kernel */ pmullw mm2, mm4 /* mult 4 high words of Src and Kernel */ paddsw mm1, mm2 /* add 4 words of the high and low bytes */ paddsw mm7, mm1 /* add MM1 to accumulator MM7 */ movq mm1, [esi] /* load 8 bytes of the Src */ movq mm3, [edx] /* load 4 words of Kernel */ punpcklbw mm1, mm0 /* unpack first 4 bytes into words */ psrlw mm1, mm5 /* shift right each pixel NshiftRight times */ pmullw mm1, mm3 /* mult 4 low words of Src and Kernel */ paddsw mm7, mm1 /* add MM1 to accumulator MM7 */ /* ---, */ movq mm3, mm7 /* copy MM7 into MM3 */ psrlq mm7, 32 /* shift 2 left words to the right */ paddsw mm7, mm3 /* add 2 left and 2 right result words */ movq mm2, mm7 /* copy MM7 into MM2 */ psrlq mm7, 16 /* shift 1 left word to the right */ paddsw mm7, mm2 /* add 1 left and 1 right result words */ movd mm1, eax /* save EAX in MM1 */ packuswb mm7, mm0 /* pack division result with saturation */ movd eax, mm7 /* copy saturated result into EAX */ mov [edi], al /* copy a byte result into Dest */ movd eax, mm1 /* restore saved EAX */ /* --, */ movd esi, mm6 /* move Src pointer to the top pixel */ sub edx, 208 /* EDX = Kernel address */ inc esi /* move Src pointer to the next pixel */ inc edi /* move Dest pointer to the next pixel */ /* ---, */ dec ecx /* decrease loop counter COLUMNS */ jnz L10392 /* check loop termination, proceed if required */ add esi, 8 /* move to the next row in Src */ add edi, 8 /* move to the next row in Dest */ dec ebx /* decrease loop counter ROWS */ jnz L10390 /* check loop termination, proceed if required */ /* ---, */ emms /* exit MMX state */ popa } #else # 6510 "SDL2_imageFilter.c" asm volatile ("pusha \n\t" "pxor %%mm0, %%mm0 \n\t" /* zero MM0 */ "xor %%ebx, %%ebx \n\t" /* zero EBX */ "mov %5, %%bl \n\t" /* load NRightShift into BL */ "movd %%ebx, %%mm5 \n\t" /* copy NRightShift into MM5 */ "mov %4, %%edx \n\t" /* load Kernel address into EDX */ "mov %1, %%esi \n\t" /* load Src address to ESI */ "mov %0, %%edi \n\t" /* load Dest address to EDI */ "add $4, %%edi \n\t" /* 4 column offset from the left edge */ "mov %3, %%eax \n\t" /* load columns into EAX */ "add %%eax, %%edi \n\t" /* 4 row offset from the top edge */ "add %%eax, %%edi \n\t" "add %%eax, %%edi \n\t" "add %%eax, %%edi \n\t" "mov %2, %%ebx \n\t" /* initialize ROWS counter */ "sub $8, %%ebx \n\t" /* do not use first 4 and last 4 rows */ /* --- */ ".L10390: \n\t" "mov %%eax, %%ecx \n\t" /* initialize COLUMNS counter */ "sub $8, %%ecx \n\t" /* do not use first 4 and last 4 columns */ ".align 16 \n\t" /* 16 byte alignment of the loop entry */ ".L10392: \n\t" "pxor %%mm7, %%mm7 \n\t" /* zero MM7 (accumulator) */ "movd %%esi, %%mm6 \n\t" /* save ESI in MM6 */ /* --- 1 */ "movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */ "movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */ "inc %%esi \n\t" /* move pointer to the next 8 bytes of Src */ "movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "movq (%%edx), %%mm4 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */ "punpckhbw %%mm0, %%mm2 \n\t" /* unpack second 4 bytes into words */ "psrlw %%mm5, %%mm1 \n\t" /* shift right each pixel NshiftRight times */ "psrlw %%mm5, %%mm2 \n\t" /* shift right each pixel NshiftRight times */ "pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */ "pmullw %%mm4, %%mm2 \n\t" /* mult. 4 high words of Src and Kernel */ "paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the high and low bytes */ "paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */ "movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */ "dec %%esi \n\t" "add %%eax, %%esi \n\t" /* move Src pointer 1 row below */ "movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */ "psrlw %%mm5, %%mm1 \n\t" /* shift right each pixel NshiftRight times */ "pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */ "paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */ /* --- 2 */ "movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */ "movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */ "inc %%esi \n\t" /* move pointer to the next 8 bytes of Src */ "movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "movq (%%edx), %%mm4 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */ "punpckhbw %%mm0, %%mm2 \n\t" /* unpack second 4 bytes into words */ "psrlw %%mm5, %%mm1 \n\t" /* shift right each pixel NshiftRight times */ "psrlw %%mm5, %%mm2 \n\t" /* shift right each pixel NshiftRight times */ "pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */ "pmullw %%mm4, %%mm2 \n\t" /* mult. 4 high words of Src and Kernel */ "paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the high and low bytes */ "paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */ "movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */ "dec %%esi \n\t" "add %%eax, %%esi \n\t" /* move Src pointer 1 row below */ "movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */ "psrlw %%mm5, %%mm1 \n\t" /* shift right each pixel NshiftRight times */ "pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */ "paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */ /* --- 3 */ "movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */ "movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */ "inc %%esi \n\t" /* move pointer to the next 8 bytes of Src */ "movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "movq (%%edx), %%mm4 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */ "punpckhbw %%mm0, %%mm2 \n\t" /* unpack second 4 bytes into words */ "psrlw %%mm5, %%mm1 \n\t" /* shift right each pixel NshiftRight times */ "psrlw %%mm5, %%mm2 \n\t" /* shift right each pixel NshiftRight times */ "pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */ "pmullw %%mm4, %%mm2 \n\t" /* mult. 4 high words of Src and Kernel */ "paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the high and low bytes */ "paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */ "movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */ "dec %%esi \n\t" "add %%eax, %%esi \n\t" /* move Src pointer 1 row below */ "movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */ "psrlw %%mm5, %%mm1 \n\t" /* shift right each pixel NshiftRight times */ "pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */ "paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */ /* --- 4 */ "movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */ "movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */ "inc %%esi \n\t" /* move pointer to the next 8 bytes of Src */ "movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "movq (%%edx), %%mm4 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */ "punpckhbw %%mm0, %%mm2 \n\t" /* unpack second 4 bytes into words */ "psrlw %%mm5, %%mm1 \n\t" /* shift right each pixel NshiftRight times */ "psrlw %%mm5, %%mm2 \n\t" /* shift right each pixel NshiftRight times */ "pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */ "pmullw %%mm4, %%mm2 \n\t" /* mult. 4 high words of Src and Kernel */ "paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the high and low bytes */ "paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */ "movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */ "dec %%esi \n\t" "add %%eax, %%esi \n\t" /* move Src pointer 1 row below */ "movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */ "psrlw %%mm5, %%mm1 \n\t" /* shift right each pixel NshiftRight times */ "pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */ "paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */ /* --- 5 */ "movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */ "movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */ "inc %%esi \n\t" /* move pointer to the next 8 bytes of Src */ "movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "movq (%%edx), %%mm4 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */ "punpckhbw %%mm0, %%mm2 \n\t" /* unpack second 4 bytes into words */ "psrlw %%mm5, %%mm1 \n\t" /* shift right each pixel NshiftRight times */ "psrlw %%mm5, %%mm2 \n\t" /* shift right each pixel NshiftRight times */ "pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */ "pmullw %%mm4, %%mm2 \n\t" /* mult. 4 high words of Src and Kernel */ "paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the high and low bytes */ "paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */ "movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */ "dec %%esi \n\t" "add %%eax, %%esi \n\t" /* move Src pointer 1 row below */ "movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */ "psrlw %%mm5, %%mm1 \n\t" /* shift right each pixel NshiftRight times */ "pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */ "paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */ /* --- 6 */ "movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */ "movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */ "inc %%esi \n\t" /* move pointer to the next 8 bytes of Src */ "movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "movq (%%edx), %%mm4 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */ "punpckhbw %%mm0, %%mm2 \n\t" /* unpack second 4 bytes into words */ "psrlw %%mm5, %%mm1 \n\t" /* shift right each pixel NshiftRight times */ "psrlw %%mm5, %%mm2 \n\t" /* shift right each pixel NshiftRight times */ "pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */ "pmullw %%mm4, %%mm2 \n\t" /* mult. 4 high words of Src and Kernel */ "paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the high and low bytes */ "paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */ "movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */ "dec %%esi \n\t" "add %%eax, %%esi \n\t" /* move Src pointer 1 row below */ "movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */ "psrlw %%mm5, %%mm1 \n\t" /* shift right each pixel NshiftRight times */ "pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */ "paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */ /* --- 7 */ "movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */ "movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */ "inc %%esi \n\t" /* move pointer to the next 8 bytes of Src */ "movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "movq (%%edx), %%mm4 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */ "punpckhbw %%mm0, %%mm2 \n\t" /* unpack second 4 bytes into words */ "psrlw %%mm5, %%mm1 \n\t" /* shift right each pixel NshiftRight times */ "psrlw %%mm5, %%mm2 \n\t" /* shift right each pixel NshiftRight times */ "pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */ "pmullw %%mm4, %%mm2 \n\t" /* mult. 4 high words of Src and Kernel */ "paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the high and low bytes */ "paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */ "movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */ "dec %%esi \n\t" "add %%eax, %%esi \n\t" /* move Src pointer 1 row below */ "movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */ "psrlw %%mm5, %%mm1 \n\t" /* shift right each pixel NshiftRight times */ "pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */ "paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */ /* --- 8 */ "movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */ "movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */ "inc %%esi \n\t" /* move pointer to the next 8 bytes of Src */ "movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "movq (%%edx), %%mm4 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */ "punpckhbw %%mm0, %%mm2 \n\t" /* unpack second 4 bytes into words */ "psrlw %%mm5, %%mm1 \n\t" /* shift right each pixel NshiftRight times */ "psrlw %%mm5, %%mm2 \n\t" /* shift right each pixel NshiftRight times */ "pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */ "pmullw %%mm4, %%mm2 \n\t" /* mult. 4 high words of Src and Kernel */ "paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the high and low bytes */ "paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */ "movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */ "dec %%esi \n\t" "add %%eax, %%esi \n\t" /* move Src pointer 1 row below */ "movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */ "psrlw %%mm5, %%mm1 \n\t" /* shift right each pixel NshiftRight times */ "pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */ "paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */ /* --- 9 */ "movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */ "movq %%mm1, %%mm2 \n\t" /* copy MM1 into MM2 */ "inc %%esi \n\t" /* move pointer to the next 8 bytes of Src */ "movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "movq (%%edx), %%mm4 \n\t" /* load 4 words of Kernel */ "add $8, %%edx \n\t" /* move pointer to other 4 words */ "punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */ "punpckhbw %%mm0, %%mm2 \n\t" /* unpack second 4 bytes into words */ "psrlw %%mm5, %%mm1 \n\t" /* shift right each pixel NshiftRight times */ "psrlw %%mm5, %%mm2 \n\t" /* shift right each pixel NshiftRight times */ "pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */ "pmullw %%mm4, %%mm2 \n\t" /* mult. 4 high words of Src and Kernel */ "paddsw %%mm2, %%mm1 \n\t" /* add 4 words of the high and low bytes */ "paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */ "movq (%%esi), %%mm1 \n\t" /* load 8 bytes of the Src */ "movq (%%edx), %%mm3 \n\t" /* load 4 words of Kernel */ "punpcklbw %%mm0, %%mm1 \n\t" /* unpack first 4 bytes into words */ "psrlw %%mm5, %%mm1 \n\t" /* shift right each pixel NshiftRight times */ "pmullw %%mm3, %%mm1 \n\t" /* mult. 4 low words of Src and Kernel */ "paddsw %%mm1, %%mm7 \n\t" /* add MM1 to accumulator MM7 */ /* --- */ "movq %%mm7, %%mm3 \n\t" /* copy MM7 into MM3 */ "psrlq $32, %%mm7 \n\t" /* shift 2 left words to the right */ "paddsw %%mm3, %%mm7 \n\t" /* add 2 left and 2 right result words */ "movq %%mm7, %%mm2 \n\t" /* copy MM7 into MM2 */ "psrlq $16, %%mm7 \n\t" /* shift 1 left word to the right */ "paddsw %%mm2, %%mm7 \n\t" /* add 1 left and 1 right result words */ "movd %%eax, %%mm1 \n\t" /* save EAX in MM1 */ "packuswb %%mm0, %%mm7 \n\t" /* pack division result with saturation */ "movd %%mm7, %%eax \n\t" /* copy saturated result into EAX */ "mov %%al, (%%edi) \n\t" /* copy a byte result into Dest */ "movd %%mm1, %%eax \n\t" /* restore saved EAX */ /* -- */ "movd %%mm6, %%esi \n\t" /* move Src pointer to the top pixel */ "sub $208, %%edx \n\t" /* EDX = Kernel address */ "inc %%esi \n\t" /* move Src pointer to the next pixel */ "inc %%edi \n\t" /* move Dest pointer to the next pixel */ /* --- */ "dec %%ecx \n\t" /* decrease loop counter COLUMNS */ "jnz .L10392 \n\t" /* check loop termination, proceed if required */ "add $8, %%esi \n\t" /* move to the next row in Src */ "add $8, %%edi \n\t" /* move to the next row in Dest */ "dec %%ebx \n\t" /* decrease loop counter ROWS */ "jnz .L10390 \n\t" /* check loop termination, proceed if required */ /* --- */ "emms \n\t" /* exit MMX state */ "popa \n\t":"=m" (Dest) /* %0 */ :"m"(Src), /* %1 */ "m"(rows), /* %2 */ "m"(columns), /* %3 */ "m"(Kernel), /* %4 */ "m"(NRightShift) /* %5 */ ); #endif # 6777 "SDL2_imageFilter.c" #endif # 6778 "SDL2_imageFilter.c" return (0); } else { /* No non-MMX implementation yet */ return (-1); } } /* ------------------------------------------------------------------------------------ */ /*! \brief Filter using SobelX: Dij = saturation255( ... ) \param Src The source 2D byte array to sobel-filter. Should be different from destination. \param Dest The destination 2D byte array to store the result in. Should be different from source. \param rows Number of rows in source/destination array. Must be >2. \param columns Number of columns in source/destination array. Must be >7. Note: Non-MMX implementation not available for this function. \return Returns 1 if filter was applied, 0 otherwise. */ int SDL_imageFilterSobelX(unsigned char *Src, unsigned char *Dest, int rows, int columns) { /* Validate input parameters */ if ((Src == NULL) || (Dest == NULL)) return(-1); if ((columns < 8) || (rows < 3)) return (-1); if ((SDL_imageFilterMMXdetect())) { //#ifdef USE_MMX #if defined(USE_MMX) && defined(i386) #if !defined(GCC__) __asm { pusha pxor mm0, mm0 /* zero MM0 */ mov eax, columns /* load columns into EAX */ /* ---, */ mov esi, Src /* ESI = Src row 0 address */ mov edi, Dest /* load Dest address to EDI */ add edi, eax /* EDI = EDI + columns */ inc edi /* 1 byte offset from the left edge */ mov edx, rows /* initialize ROWS counter */ sub edx, 2 /* do not use first and last rows */ /* ---, */ L10400: mov ecx, eax /* initialize COLUMS counter */ shr ecx, 3 /* EBX/8 (MMX loads 8 bytes at a time) */ mov ebx, esi /* save ESI in EBX */ movd mm1, edi /* save EDI in MM1 */ align 16 /* 16 byte alignment of the loop entry */ L10402: /* ---, */ movq mm4, [esi] /* load 8 bytes from Src */ movq mm5, mm4 /* save MM4 in MM5 */ add esi, 2 /* move ESI pointer 2 bytes right */ punpcklbw mm4, mm0 /* unpack 4 low bytes into words */ punpckhbw mm5, mm0 /* unpack 4 high bytes into words */ movq mm6, [esi] /* load 8 bytes from Src */ movq mm7, mm6 /* save MM6 in MM7 */ sub esi, 2 /* move ESI pointer back 2 bytes left */ punpcklbw mm6, mm0 /* unpack 4 low bytes into words */ punpckhbw mm7, mm0 /* unpack 4 high bytes into words */ add esi, eax /* move to the next row of Src */ movq mm2, [esi] /* load 8 bytes from Src */ movq mm3, mm2 /* save MM2 in MM3 */ add esi, 2 /* move ESI pointer 2 bytes right */ punpcklbw mm2, mm0 /* unpack 4 low bytes into words */ punpckhbw mm3, mm0 /* unpack 4 high bytes into words */ paddw mm4, mm2 /* add 4 low bytes to accumolator MM4 */ paddw mm5, mm3 /* add 4 high bytes to accumolator MM5 */ paddw mm4, mm2 /* add 4 low bytes to accumolator MM4 */ paddw mm5, mm3 /* add 4 high bytes to accumolator MM5 */ movq mm2, [esi] /* load 8 bytes from Src */ movq mm3, mm2 /* save MM2 in MM3 */ sub esi, 2 /* move ESI pointer back 2 bytes left */ punpcklbw mm2, mm0 /* unpack 4 low bytes into words */ punpckhbw mm3, mm0 /* unpack 4 high bytes into words */ paddw mm6, mm2 /* add 4 low bytes to accumolator MM6 */ paddw mm7, mm3 /* add 4 high bytes to accumolator MM7 */ paddw mm6, mm2 /* add 4 low bytes to accumolator MM6 */ paddw mm7, mm3 /* add 4 high bytes to accumolator MM7 */ add esi, eax /* move to the next row of Src */ movq mm2, [esi] /* load 8 bytes from Src */ movq mm3, mm2 /* save MM2 in MM3 */ add esi, 2 /* move ESI pointer 2 bytes right */ punpcklbw mm2, mm0 /* unpack 4 low bytes into words */ punpckhbw mm3, mm0 /* unpack 4 high bytes into words */ paddw mm4, mm2 /* add 4 low bytes to accumolator MM4 */ paddw mm5, mm3 /* add 4 high bytes to accumolator MM5 */ movq mm2, [esi] /* load 8 bytes from Src */ movq mm3, mm2 /* save MM2 in MM3 */ sub esi, 2 /* move ESI pointer back 2 bytes left */ punpcklbw mm2, mm0 /* unpack 4 low bytes into words */ punpckhbw mm3, mm0 /* unpack 4 high bytes into words */ paddw mm6, mm2 /* add 4 low bytes to accumolator MM6 */ paddw mm7, mm3 /* add 4 high bytes to accumolator MM7 */ /* ---, */ movq mm2, mm4 /* copy MM4 into MM2 */ psrlq mm4, 32 /* shift 2 left words to the right */ psubw mm4, mm2 /* MM4 = MM4 - MM2 */ movq mm3, mm6 /* copy MM6 into MM3 */ psrlq mm6, 32 /* shift 2 left words to the right */ psubw mm6, mm3 /* MM6 = MM6 - MM3 */ punpckldq mm4, mm6 /* combine 2 words of MM6 and 2 words of MM4 */ movq mm2, mm5 /* copy MM6 into MM2 */ psrlq mm5, 32 /* shift 2 left words to the right */ psubw mm5, mm2 /* MM5 = MM5 - MM2 */ movq mm3, mm7 /* copy MM7 into MM3 */ psrlq mm7, 32 /* shift 2 left words to the right */ psubw mm7, mm3 /* MM7 = MM7 - MM3 */ punpckldq mm5, mm7 /* combine 2 words of MM7 and 2 words of MM5 */ /* Take abs values of MM4 and MM5 */ movq mm6, mm4 /* copy MM4 into MM6 */ movq mm7, mm5 /* copy MM5 into MM7 */ psraw mm6, 15 /* fill MM6 words with word sign bit */ psraw mm7, 15 /* fill MM7 words with word sign bit */ pxor mm4, mm6 /* take 1's compliment of only neg words */ pxor mm5, mm7 /* take 1's compliment of only neg words */ psubsw mm4, mm6 /* add 1 to only neg words, W-(-1) or W-0 */ psubsw mm5, mm7 /* add 1 to only neg words, W-(-1) or W-0 */ packuswb mm4, mm5 /* combine and pack/saturate MM5 and MM4 */ movq [edi], mm4 /* store result in Dest */ /* ---, */ sub esi, eax /* move to the current top row in Src */ sub esi, eax add esi, 8 /* move Src pointer to the next 8 pixels */ add edi, 8 /* move Dest pointer to the next 8 pixels */ /* ---, */ dec ecx /* decrease loop counter COLUMNS */ jnz L10402 /* check loop termination, proceed if required */ mov esi, ebx /* restore most left current row Src address */ movd edi, mm1 /* restore most left current row Dest address */ add esi, eax /* move to the next row in Src */ add edi, eax /* move to the next row in Dest */ dec edx /* decrease loop counter ROWS */ jnz L10400 /* check loop termination, proceed if required */ /* ---, */ emms /* exit MMX state */ popa } #else # 6922 "SDL2_imageFilter.c" asm volatile ("pusha \n\t" "pxor %%mm0, %%mm0 \n\t" /* zero MM0 */ "mov %3, %%eax \n\t" /* load columns into EAX */ /* --- */ "mov %1, %%esi \n\t" /* ESI = Src row 0 address */ "mov %0, %%edi \n\t" /* load Dest address to EDI */ "add %%eax, %%edi \n\t" /* EDI = EDI + columns */ "inc %%edi \n\t" /* 1 byte offset from the left edge */ "mov %2, %%edx \n\t" /* initialize ROWS counter */ "sub $2, %%edx \n\t" /* do not use first and last rows */ /* --- */ ".L10400: \n\t" "mov %%eax, %%ecx \n\t" /* initialize COLUMS counter */ "shr $3, %%ecx \n\t" /* EBX/8 (MMX loads 8 bytes at a time) */ "mov %%esi, %%ebx \n\t" /* save ESI in EBX */ "movd %%edi, %%mm1 \n\t" /* save EDI in MM1 */ ".align 16 \n\t" /* 16 byte alignment of the loop entry */ ".L10402: \n\t" /* --- */ "movq (%%esi), %%mm4 \n\t" /* load 8 bytes from Src */ "movq %%mm4, %%mm5 \n\t" /* save MM4 in MM5 */ "add $2, %%esi \n\t" /* move ESI pointer 2 bytes right */ "punpcklbw %%mm0, %%mm4 \n\t" /* unpack 4 low bytes into words */ "punpckhbw %%mm0, %%mm5 \n\t" /* unpack 4 high bytes into words */ "movq (%%esi), %%mm6 \n\t" /* load 8 bytes from Src */ "movq %%mm6, %%mm7 \n\t" /* save MM6 in MM7 */ "sub $2, %%esi \n\t" /* move ESI pointer back 2 bytes left */ "punpcklbw %%mm0, %%mm6 \n\t" /* unpack 4 low bytes into words */ "punpckhbw %%mm0, %%mm7 \n\t" /* unpack 4 high bytes into words */ "add %%eax, %%esi \n\t" /* move to the next row of Src */ "movq (%%esi), %%mm2 \n\t" /* load 8 bytes from Src */ "movq %%mm2, %%mm3 \n\t" /* save MM2 in MM3 */ "add $2, %%esi \n\t" /* move ESI pointer 2 bytes right */ "punpcklbw %%mm0, %%mm2 \n\t" /* unpack 4 low bytes into words */ "punpckhbw %%mm0, %%mm3 \n\t" /* unpack 4 high bytes into words */ "paddw %%mm2, %%mm4 \n\t" /* add 4 low bytes to accumolator MM4 */ "paddw %%mm3, %%mm5 \n\t" /* add 4 high bytes to accumolator MM5 */ "paddw %%mm2, %%mm4 \n\t" /* add 4 low bytes to accumolator MM4 */ "paddw %%mm3, %%mm5 \n\t" /* add 4 high bytes to accumolator MM5 */ "movq (%%esi), %%mm2 \n\t" /* load 8 bytes from Src */ "movq %%mm2, %%mm3 \n\t" /* save MM2 in MM3 */ "sub $2, %%esi \n\t" /* move ESI pointer back 2 bytes left */ "punpcklbw %%mm0, %%mm2 \n\t" /* unpack 4 low bytes into words */ "punpckhbw %%mm0, %%mm3 \n\t" /* unpack 4 high bytes into words */ "paddw %%mm2, %%mm6 \n\t" /* add 4 low bytes to accumolator MM6 */ "paddw %%mm3, %%mm7 \n\t" /* add 4 high bytes to accumolator MM7 */ "paddw %%mm2, %%mm6 \n\t" /* add 4 low bytes to accumolator MM6 */ "paddw %%mm3, %%mm7 \n\t" /* add 4 high bytes to accumolator MM7 */ "add %%eax, %%esi \n\t" /* move to the next row of Src */ "movq (%%esi), %%mm2 \n\t" /* load 8 bytes from Src */ "movq %%mm2, %%mm3 \n\t" /* save MM2 in MM3 */ "add $2, %%esi \n\t" /* move ESI pointer 2 bytes right */ "punpcklbw %%mm0, %%mm2 \n\t" /* unpack 4 low bytes into words */ "punpckhbw %%mm0, %%mm3 \n\t" /* unpack 4 high bytes into words */ "paddw %%mm2, %%mm4 \n\t" /* add 4 low bytes to accumolator MM4 */ "paddw %%mm3, %%mm5 \n\t" /* add 4 high bytes to accumolator MM5 */ "movq (%%esi), %%mm2 \n\t" /* load 8 bytes from Src */ "movq %%mm2, %%mm3 \n\t" /* save MM2 in MM3 */ "sub $2, %%esi \n\t" /* move ESI pointer back 2 bytes left */ "punpcklbw %%mm0, %%mm2 \n\t" /* unpack 4 low bytes into words */ "punpckhbw %%mm0, %%mm3 \n\t" /* unpack 4 high bytes into words */ "paddw %%mm2, %%mm6 \n\t" /* add 4 low bytes to accumolator MM6 */ "paddw %%mm3, %%mm7 \n\t" /* add 4 high bytes to accumolator MM7 */ /* --- */ "movq %%mm4, %%mm2 \n\t" /* copy MM4 into MM2 */ "psrlq $32, %%mm4 \n\t" /* shift 2 left words to the right */ "psubw %%mm2, %%mm4 \n\t" /* MM4 = MM4 - MM2 */ "movq %%mm6, %%mm3 \n\t" /* copy MM6 into MM3 */ "psrlq $32, %%mm6 \n\t" /* shift 2 left words to the right */ "psubw %%mm3, %%mm6 \n\t" /* MM6 = MM6 - MM3 */ "punpckldq %%mm6, %%mm4 \n\t" /* combine 2 words of MM6 and 2 words of MM4 */ "movq %%mm5, %%mm2 \n\t" /* copy MM6 into MM2 */ "psrlq $32, %%mm5 \n\t" /* shift 2 left words to the right */ "psubw %%mm2, %%mm5 \n\t" /* MM5 = MM5 - MM2 */ "movq %%mm7, %%mm3 \n\t" /* copy MM7 into MM3 */ "psrlq $32, %%mm7 \n\t" /* shift 2 left words to the right */ "psubw %%mm3, %%mm7 \n\t" /* MM7 = MM7 - MM3 */ "punpckldq %%mm7, %%mm5 \n\t" /* combine 2 words of MM7 and 2 words of MM5 */ /* Take abs values of MM4 and MM5 */ "movq %%mm4, %%mm6 \n\t" /* copy MM4 into MM6 */ "movq %%mm5, %%mm7 \n\t" /* copy MM5 into MM7 */ "psraw $15, %%mm6 \n\t" /* fill MM6 words with word sign bit */ "psraw $15, %%mm7 \n\t" /* fill MM7 words with word sign bit */ "pxor %%mm6, %%mm4 \n\t" /* take 1's compliment of only neg. words */ "pxor %%mm7, %%mm5 \n\t" /* take 1's compliment of only neg. words */ "psubsw %%mm6, %%mm4 \n\t" /* add 1 to only neg. words, W-(-1) or W-0 */ "psubsw %%mm7, %%mm5 \n\t" /* add 1 to only neg. words, W-(-1) or W-0 */ "packuswb %%mm5, %%mm4 \n\t" /* combine and pack/saturate MM5 and MM4 */ "movq %%mm4, (%%edi) \n\t" /* store result in Dest */ /* --- */ "sub %%eax, %%esi \n\t" /* move to the current top row in Src */ "sub %%eax, %%esi \n\t" "add $8, %%esi \n\t" /* move Src pointer to the next 8 pixels */ "add $8, %%edi \n\t" /* move Dest pointer to the next 8 pixels */ /* --- */ "dec %%ecx \n\t" /* decrease loop counter COLUMNS */ "jnz .L10402 \n\t" /* check loop termination, proceed if required */ "mov %%ebx, %%esi \n\t" /* restore most left current row Src address */ "movd %%mm1, %%edi \n\t" /* restore most left current row Dest address */ "add %%eax, %%esi \n\t" /* move to the next row in Src */ "add %%eax, %%edi \n\t" /* move to the next row in Dest */ "dec %%edx \n\t" /* decrease loop counter ROWS */ "jnz .L10400 \n\t" /* check loop termination, proceed if required */ /* --- */ "emms \n\t" /* exit MMX state */ "popa \n\t":"=m" (Dest) /* %0 */ :"m"(Src), /* %1 */ "m"(rows), /* %2 */ "m"(columns) /* %3 */ ); #endif # 7031 "SDL2_imageFilter.c" #endif # 7032 "SDL2_imageFilter.c" return (0); } else { /* No non-MMX implementation yet */ return (-1); } } /*! \brief Filter using SobelXShiftRight: Dij = saturation255( ... ) \param Src The source 2D byte array to sobel-filter. Should be different from destination. \param Dest The destination 2D byte array to store the result in. Should be different from source. \param rows Number of rows in source/destination array. Must be >2. \param columns Number of columns in source/destination array. Must be >8. \param NRightShift The number of right bit shifts to apply to the filter sum. Must be <7. Note: Non-MMX implementation not available for this function. \return Returns 1 if filter was applied, 0 otherwise. */ int SDL_imageFilterSobelXShiftRight(unsigned char *Src, unsigned char *Dest, int rows, int columns, unsigned char NRightShift) { /* Validate input parameters */ if ((Src == NULL) || (Dest == NULL)) return(-1); if ((columns < 8) || (rows < 3) || (NRightShift > 7)) return (-1); if ((SDL_imageFilterMMXdetect())) { //#ifdef USE_MMX #if defined(USE_MMX) && defined(i386) #if !defined(GCC__) __asm { pusha pxor mm0, mm0 /* zero MM0 */ mov eax, columns /* load columns into EAX */ xor ebx, ebx /* zero EBX */ mov bl, NRightShift /* load NRightShift into BL */ movd mm1, ebx /* copy NRightShift into MM1 */ /* ---, */ mov esi, Src /* ESI = Src row 0 address */ mov edi, Dest /* load Dest address to EDI */ add edi, eax /* EDI = EDI + columns */ inc edi /* 1 byte offset from the left edge */ /* initialize ROWS counter */ sub rows, 2 /* do not use first and last rows */ /* ---, */ L10410: mov ecx, eax /* initialize COLUMS counter */ shr ecx, 3 /* EBX/8 (MMX loads 8 bytes at a time) */ mov ebx, esi /* save ESI in EBX */ mov edx, edi /* save EDI in EDX */ align 16 /* 16 byte alignment of the loop entry */ L10412: /* ---, */ movq mm4, [esi] /* load 8 bytes from Src */ movq mm5, mm4 /* save MM4 in MM5 */ add esi, 2 /* move ESI pointer 2 bytes right */ punpcklbw mm4, mm0 /* unpack 4 low bytes into words */ punpckhbw mm5, mm0 /* unpack 4 high bytes into words */ psrlw mm4, mm1 /* shift right each pixel NshiftRight times */ psrlw mm5, mm1 /* shift right each pixel NshiftRight times */ movq mm6, [esi] /* load 8 bytes from Src */ movq mm7, mm6 /* save MM6 in MM7 */ sub esi, 2 /* move ESI pointer back 2 bytes left */ punpcklbw mm6, mm0 /* unpack 4 low bytes into words */ punpckhbw mm7, mm0 /* unpack 4 high bytes into words */ psrlw mm6, mm1 /* shift right each pixel NshiftRight times */ psrlw mm7, mm1 /* shift right each pixel NshiftRight times */ add esi, eax /* move to the next row of Src */ movq mm2, [esi] /* load 8 bytes from Src */ movq mm3, mm2 /* save MM2 in MM3 */ add esi, 2 /* move ESI pointer 2 bytes right */ punpcklbw mm2, mm0 /* unpack 4 low bytes into words */ punpckhbw mm3, mm0 /* unpack 4 high bytes into words */ psrlw mm2, mm1 /* shift right each pixel NshiftRight times */ psrlw mm3, mm1 /* shift right each pixel NshiftRight times */ paddw mm4, mm2 /* add 4 low bytes to accumolator MM4 */ paddw mm5, mm3 /* add 4 high bytes to accumolator MM5 */ paddw mm4, mm2 /* add 4 low bytes to accumolator MM4 */ paddw mm5, mm3 /* add 4 high bytes to accumolator MM5 */ movq mm2, [esi] /* load 8 bytes from Src */ movq mm3, mm2 /* save MM2 in MM3 */ sub esi, 2 /* move ESI pointer back 2 bytes left */ punpcklbw mm2, mm0 /* unpack 4 low bytes into words */ punpckhbw mm3, mm0 /* unpack 4 high bytes into words */ psrlw mm2, mm1 /* shift right each pixel NshiftRight times */ psrlw mm3, mm1 /* shift right each pixel NshiftRight times */ paddw mm6, mm2 /* add 4 low bytes to accumolator MM6 */ paddw mm7, mm3 /* add 4 high bytes to accumolator MM7 */ paddw mm6, mm2 /* add 4 low bytes to accumolator MM6 */ paddw mm7, mm3 /* add 4 high bytes to accumolator MM7 */ add esi, eax /* move to the next row of Src */ movq mm2, [esi] /* load 8 bytes from Src */ movq mm3, mm2 /* save MM2 in MM3 */ add esi, 2 /* move ESI pointer 2 bytes right */ punpcklbw mm2, mm0 /* unpack 4 low bytes into words */ punpckhbw mm3, mm0 /* unpack 4 high bytes into words */ psrlw mm2, mm1 /* shift right each pixel NshiftRight times */ psrlw mm3, mm1 /* shift right each pixel NshiftRight times */ paddw mm4, mm2 /* add 4 low bytes to accumolator MM4 */ paddw mm5, mm3 /* add 4 high bytes to accumolator MM5 */ movq mm2, [esi] /* load 8 bytes from Src */ movq mm3, mm2 /* save MM2 in MM3 */ sub esi, 2 /* move ESI pointer back 2 bytes left */ punpcklbw mm2, mm0 /* unpack 4 low bytes into words */ punpckhbw mm3, mm0 /* unpack 4 high bytes into words */ psrlw mm2, mm1 /* shift right each pixel NshiftRight times */ psrlw mm3, mm1 /* shift right each pixel NshiftRight times */ paddw mm6, mm2 /* add 4 low bytes to accumolator MM6 */ paddw mm7, mm3 /* add 4 high bytes to accumolator MM7 */ /* ---, */ movq mm2, mm4 /* copy MM4 into MM2 */ psrlq mm4, 32 /* shift 2 left words to the right */ psubw mm4, mm2 /* MM4 = MM4 - MM2 */ movq mm3, mm6 /* copy MM6 into MM3 */ psrlq mm6, 32 /* shift 2 left words to the right */ psubw mm6, mm3 /* MM6 = MM6 - MM3 */ punpckldq mm4, mm6 /* combine 2 words of MM6 and 2 words of MM4 */ movq mm2, mm5 /* copy MM6 into MM2 */ psrlq mm5, 32 /* shift 2 left words to the right */ psubw mm5, mm2 /* MM5 = MM5 - MM2 */ movq mm3, mm7 /* copy MM7 into MM3 */ psrlq mm7, 32 /* shift 2 left words to the right */ psubw mm7, mm3 /* MM7 = MM7 - MM3 */ punpckldq mm5, mm7 /* combine 2 words of MM7 and 2 words of MM5 */ /* Take abs values of MM4 and MM5 */ movq mm6, mm4 /* copy MM4 into MM6 */ movq mm7, mm5 /* copy MM5 into MM7 */ psraw mm6, 15 /* fill MM6 words with word sign bit */ psraw mm7, 15 /* fill MM7 words with word sign bit */ pxor mm4, mm6 /* take 1's compliment of only neg words */ pxor mm5, mm7 /* take 1's compliment of only neg words */ psubsw mm4, mm6 /* add 1 to only neg words, W-(-1) or W-0 */ psubsw mm5, mm7 /* add 1 to only neg words, W-(-1) or W-0 */ packuswb mm4, mm5 /* combine and pack/saturate MM5 and MM4 */ movq [edi], mm4 /* store result in Dest */ /* ---, */ sub esi, eax /* move to the current top row in Src */ sub esi, eax add esi, 8 /* move Src pointer to the next 8 pixels */ add edi, 8 /* move Dest pointer to the next 8 pixels */ /* ---, */ dec ecx /* decrease loop counter COLUMNS */ jnz L10412 /* check loop termination, proceed if required */ mov esi, ebx /* restore most left current row Src address */ mov edi, edx /* restore most left current row Dest address */ add esi, eax /* move to the next row in Src */ add edi, eax /* move to the next row in Dest */ dec rows /* decrease loop counter ROWS */ jnz L10410 /* check loop termination, proceed if required */ /* ---, */ emms /* exit MMX state */ popa } #else # 7190 "SDL2_imageFilter.c" asm volatile ("pusha \n\t" "pxor %%mm0, %%mm0 \n\t" /* zero MM0 */ "mov %3, %%eax \n\t" /* load columns into EAX */ "xor %%ebx, %%ebx \n\t" /* zero EBX */ "mov %4, %%bl \n\t" /* load NRightShift into BL */ "movd %%ebx, %%mm1 \n\t" /* copy NRightShift into MM1 */ /* --- */ "mov %1, %%esi \n\t" /* ESI = Src row 0 address */ "mov %0, %%edi \n\t" /* load Dest address to EDI */ "add %%eax, %%edi \n\t" /* EDI = EDI + columns */ "inc %%edi \n\t" /* 1 byte offset from the left edge */ /* initialize ROWS counter */ "subl $2, %2 \n\t" /* do not use first and last rows */ /* --- */ ".L10410: \n\t" "mov %%eax, %%ecx \n\t" /* initialize COLUMS counter */ "shr $3, %%ecx \n\t" /* EBX/8 (MMX loads 8 bytes at a time) */ "mov %%esi, %%ebx \n\t" /* save ESI in EBX */ "mov %%edi, %%edx \n\t" /* save EDI in EDX */ ".align 16 \n\t" /* 16 byte alignment of the loop entry */ ".L10412: \n\t" /* --- */ "movq (%%esi), %%mm4 \n\t" /* load 8 bytes from Src */ "movq %%mm4, %%mm5 \n\t" /* save MM4 in MM5 */ "add $2, %%esi \n\t" /* move ESI pointer 2 bytes right */ "punpcklbw %%mm0, %%mm4 \n\t" /* unpack 4 low bytes into words */ "punpckhbw %%mm0, %%mm5 \n\t" /* unpack 4 high bytes into words */ "psrlw %%mm1, %%mm4 \n\t" /* shift right each pixel NshiftRight times */ "psrlw %%mm1, %%mm5 \n\t" /* shift right each pixel NshiftRight times */ "movq (%%esi), %%mm6 \n\t" /* load 8 bytes from Src */ "movq %%mm6, %%mm7 \n\t" /* save MM6 in MM7 */ "sub $2, %%esi \n\t" /* move ESI pointer back 2 bytes left */ "punpcklbw %%mm0, %%mm6 \n\t" /* unpack 4 low bytes into words */ "punpckhbw %%mm0, %%mm7 \n\t" /* unpack 4 high bytes into words */ "psrlw %%mm1, %%mm6 \n\t" /* shift right each pixel NshiftRight times */ "psrlw %%mm1, %%mm7 \n\t" /* shift right each pixel NshiftRight times */ "add %%eax, %%esi \n\t" /* move to the next row of Src */ "movq (%%esi), %%mm2 \n\t" /* load 8 bytes from Src */ "movq %%mm2, %%mm3 \n\t" /* save MM2 in MM3 */ "add $2, %%esi \n\t" /* move ESI pointer 2 bytes right */ "punpcklbw %%mm0, %%mm2 \n\t" /* unpack 4 low bytes into words */ "punpckhbw %%mm0, %%mm3 \n\t" /* unpack 4 high bytes into words */ "psrlw %%mm1, %%mm2 \n\t" /* shift right each pixel NshiftRight times */ "psrlw %%mm1, %%mm3 \n\t" /* shift right each pixel NshiftRight times */ "paddw %%mm2, %%mm4 \n\t" /* add 4 low bytes to accumolator MM4 */ "paddw %%mm3, %%mm5 \n\t" /* add 4 high bytes to accumolator MM5 */ "paddw %%mm2, %%mm4 \n\t" /* add 4 low bytes to accumolator MM4 */ "paddw %%mm3, %%mm5 \n\t" /* add 4 high bytes to accumolator MM5 */ "movq (%%esi), %%mm2 \n\t" /* load 8 bytes from Src */ "movq %%mm2, %%mm3 \n\t" /* save MM2 in MM3 */ "sub $2, %%esi \n\t" /* move ESI pointer back 2 bytes left */ "punpcklbw %%mm0, %%mm2 \n\t" /* unpack 4 low bytes into words */ "punpckhbw %%mm0, %%mm3 \n\t" /* unpack 4 high bytes into words */ "psrlw %%mm1, %%mm2 \n\t" /* shift right each pixel NshiftRight times */ "psrlw %%mm1, %%mm3 \n\t" /* shift right each pixel NshiftRight times */ "paddw %%mm2, %%mm6 \n\t" /* add 4 low bytes to accumolator MM6 */ "paddw %%mm3, %%mm7 \n\t" /* add 4 high bytes to accumolator MM7 */ "paddw %%mm2, %%mm6 \n\t" /* add 4 low bytes to accumolator MM6 */ "paddw %%mm3, %%mm7 \n\t" /* add 4 high bytes to accumolator MM7 */ "add %%eax, %%esi \n\t" /* move to the next row of Src */ "movq (%%esi), %%mm2 \n\t" /* load 8 bytes from Src */ "movq %%mm2, %%mm3 \n\t" /* save MM2 in MM3 */ "add $2, %%esi \n\t" /* move ESI pointer 2 bytes right */ "punpcklbw %%mm0, %%mm2 \n\t" /* unpack 4 low bytes into words */ "punpckhbw %%mm0, %%mm3 \n\t" /* unpack 4 high bytes into words */ "psrlw %%mm1, %%mm2 \n\t" /* shift right each pixel NshiftRight times */ "psrlw %%mm1, %%mm3 \n\t" /* shift right each pixel NshiftRight times */ "paddw %%mm2, %%mm4 \n\t" /* add 4 low bytes to accumolator MM4 */ "paddw %%mm3, %%mm5 \n\t" /* add 4 high bytes to accumolator MM5 */ "movq (%%esi), %%mm2 \n\t" /* load 8 bytes from Src */ "movq %%mm2, %%mm3 \n\t" /* save MM2 in MM3 */ "sub $2, %%esi \n\t" /* move ESI pointer back 2 bytes left */ "punpcklbw %%mm0, %%mm2 \n\t" /* unpack 4 low bytes into words */ "punpckhbw %%mm0, %%mm3 \n\t" /* unpack 4 high bytes into words */ "psrlw %%mm1, %%mm2 \n\t" /* shift right each pixel NshiftRight times */ "psrlw %%mm1, %%mm3 \n\t" /* shift right each pixel NshiftRight times */ "paddw %%mm2, %%mm6 \n\t" /* add 4 low bytes to accumolator MM6 */ "paddw %%mm3, %%mm7 \n\t" /* add 4 high bytes to accumolator MM7 */ /* --- */ "movq %%mm4, %%mm2 \n\t" /* copy MM4 into MM2 */ "psrlq $32, %%mm4 \n\t" /* shift 2 left words to the right */ "psubw %%mm2, %%mm4 \n\t" /* MM4 = MM4 - MM2 */ "movq %%mm6, %%mm3 \n\t" /* copy MM6 into MM3 */ "psrlq $32, %%mm6 \n\t" /* shift 2 left words to the right */ "psubw %%mm3, %%mm6 \n\t" /* MM6 = MM6 - MM3 */ "punpckldq %%mm6, %%mm4 \n\t" /* combine 2 words of MM6 and 2 words of MM4 */ "movq %%mm5, %%mm2 \n\t" /* copy MM6 into MM2 */ "psrlq $32, %%mm5 \n\t" /* shift 2 left words to the right */ "psubw %%mm2, %%mm5 \n\t" /* MM5 = MM5 - MM2 */ "movq %%mm7, %%mm3 \n\t" /* copy MM7 into MM3 */ "psrlq $32, %%mm7 \n\t" /* shift 2 left words to the right */ "psubw %%mm3, %%mm7 \n\t" /* MM7 = MM7 - MM3 */ "punpckldq %%mm7, %%mm5 \n\t" /* combine 2 words of MM7 and 2 words of MM5 */ /* Take abs values of MM4 and MM5 */ "movq %%mm4, %%mm6 \n\t" /* copy MM4 into MM6 */ "movq %%mm5, %%mm7 \n\t" /* copy MM5 into MM7 */ "psraw $15, %%mm6 \n\t" /* fill MM6 words with word sign bit */ "psraw $15, %%mm7 \n\t" /* fill MM7 words with word sign bit */ "pxor %%mm6, %%mm4 \n\t" /* take 1's compliment of only neg. words */ "pxor %%mm7, %%mm5 \n\t" /* take 1's compliment of only neg. words */ "psubsw %%mm6, %%mm4 \n\t" /* add 1 to only neg. words, W-(-1) or W-0 */ "psubsw %%mm7, %%mm5 \n\t" /* add 1 to only neg. words, W-(-1) or W-0 */ "packuswb %%mm5, %%mm4 \n\t" /* combine and pack/saturate MM5 and MM4 */ "movq %%mm4, (%%edi) \n\t" /* store result in Dest */ /* --- */ "sub %%eax, %%esi \n\t" /* move to the current top row in Src */ "sub %%eax, %%esi \n\t" "add $8, %%esi \n\t" /* move Src pointer to the next 8 pixels */ "add $8, %%edi \n\t" /* move Dest pointer to the next 8 pixels */ /* --- */ "dec %%ecx \n\t" /* decrease loop counter COLUMNS */ "jnz .L10412 \n\t" /* check loop termination, proceed if required */ "mov %%ebx, %%esi \n\t" /* restore most left current row Src address */ "mov %%edx, %%edi \n\t" /* restore most left current row Dest address */ "add %%eax, %%esi \n\t" /* move to the next row in Src */ "add %%eax, %%edi \n\t" /* move to the next row in Dest */ "decl %2 \n\t" /* decrease loop counter ROWS */ "jnz .L10410 \n\t" /* check loop termination, proceed if required */ /* --- */ "emms \n\t" /* exit MMX state */ "popa \n\t":"=m" (Dest) /* %0 */ :"m"(Src), /* %1 */ "m"(rows), /* %2 */ "m"(columns), /* %3 */ "m"(NRightShift) /* %4 */ ); #endif # 7315 "SDL2_imageFilter.c" #endif # 7316 "SDL2_imageFilter.c" return (0); } else { /* No non-MMX implementation yet */ return (-1); } } /*! \brief Align stack to 32 byte boundary, */ void SDL_imageFilterAlignStack(void) { #ifdef USE_MMX #if !defined(GCC__) __asm { /* --- stack alignment --- */ mov ebx, esp /* load ESP into EBX */ sub ebx, 4 /* reserve space on stack for old value of ESP */ and ebx, -32 /* align EBX along a 32 byte boundary */ mov [ebx], esp /* save old value of ESP in stack, behind the bndry */ mov esp, ebx /* align ESP along a 32 byte boundary */ } #else # 7339 "SDL2_imageFilter.c" asm volatile ( /* --- stack alignment --- */ "mov %%esp, %%ebx \n\t" /* load ESP into EBX */ "sub $4, %%ebx \n\t" /* reserve space on stack for old value of ESP */ "and $-32, %%ebx \n\t" /* align EBX along a 32 byte boundary */ "mov %%esp, (%%ebx) \n\t" /* save old value of ESP in stack, behind the bndry */ "mov %%ebx, %%esp \n\t" /* align ESP along a 32 byte boundary */ ::); #endif # 7348 "SDL2_imageFilter.c" #endif # 7349 "SDL2_imageFilter.c" } /*! \brief Restore previously aligned stack. */ void SDL_imageFilterRestoreStack(void) { #ifdef USE_MMX #if !defined(GCC__) __asm { /* --- restoring old stack --- */ mov ebx, [esp] /* load old value of ESP */ mov esp, ebx /* restore old value of ESP */ } #else # 7364 "SDL2_imageFilter.c" asm volatile ( /* --- restoring old stack --- */ "mov (%%esp), %%ebx \n\t" /* load old value of ESP */ "mov %%ebx, %%esp \n\t" /* restore old value of ESP */ ::); #endif # 7370 "SDL2_imageFilter.c" #endif # 7371 "SDL2_imageFilter.c" }