# 1 "" # 1 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/intern/BLI_kdopbvh.c" /* * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * The Original Code is Copyright (C) 2006 by NaN Holding BV. * All rights reserved. * * The Original Code is: all of this file. * * Contributor(s): Daniel Genrich, Andre Pinto * * ***** END GPL LICENSE BLOCK ***** */ /** \file blender/blenlib/intern/BLI_kdopbvh.c * \ingroup bli */ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 32 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/intern/BLI_kdopbvh.c" # 1 "/usr/include/assert.h" 1 3 4 /*- * Copyright (c) 1992, 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. * 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. * * @(#)assert.h 8.2 (Berkeley) 1/21/94 * $FreeBSD: stable/10/include/assert.h 228955 2011-12-29 14:41:17Z ed $ */ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 38 "/usr/include/assert.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: stable/10/sys/sys/cdefs.h 284948 2015-06-30 08:40:15Z tijl $ */ #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) # 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_symbol #else # 218 "/usr/include/sys/cdefs.h" 3 4 #define __weak_symbol __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 defined(__COUNTER__) # 295 "/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 # 300 "/usr/include/sys/cdefs.h" 3 4 #define _Static_assert(x, y) struct __hack #endif # 302 "/usr/include/sys/cdefs.h" 3 4 #endif # 303 "/usr/include/sys/cdefs.h" 3 4 #if !__has_extension(c_thread_local) /* XXX: Change this to test against C++11 when clang in base supports it. */ #if /* (defined(__cplusplus) && __cplusplus >= 201103L) || */ \ __has_extension(cxx_thread_local) #define _Thread_local thread_local #else # 310 "/usr/include/sys/cdefs.h" 3 4 #define _Thread_local __thread #endif # 312 "/usr/include/sys/cdefs.h" 3 4 #endif # 313 "/usr/include/sys/cdefs.h" 3 4 #endif /* __STDC_VERSION__ || __STDC_VERSION__ < 201112L */ # 315 "/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 #define __generic(expr, t, yes, no) \ _Generic(expr, t: yes, default: no) #elif __GNUC_PREREQ__(3, 1) && !defined(__cplusplus) # 329 "/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 # 333 "/usr/include/sys/cdefs.h" 3 4 #if __GNUC_PREREQ__(2, 96) #define __malloc_like __attribute__((__malloc__)) #define __pure __attribute__((__pure__)) #else # 338 "/usr/include/sys/cdefs.h" 3 4 #define __malloc_like #define __pure #endif # 341 "/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 # 345 "/usr/include/sys/cdefs.h" 3 4 #define __always_inline #endif # 347 "/usr/include/sys/cdefs.h" 3 4 #if __GNUC_PREREQ__(3, 1) #define __noinline __attribute__ ((__noinline__)) #else # 351 "/usr/include/sys/cdefs.h" 3 4 #define __noinline #endif # 353 "/usr/include/sys/cdefs.h" 3 4 #if __GNUC_PREREQ__(3, 3) #define __nonnull(x) __attribute__((__nonnull__(x))) #else # 357 "/usr/include/sys/cdefs.h" 3 4 #define __nonnull(x) #endif # 359 "/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 # 364 "/usr/include/sys/cdefs.h" 3 4 #define __fastcall #define __result_use_check #endif # 367 "/usr/include/sys/cdefs.h" 3 4 #if __GNUC_PREREQ__(4, 1) #define __returns_twice __attribute__((__returns_twice__)) #else # 371 "/usr/include/sys/cdefs.h" 3 4 #define __returns_twice #endif # 373 "/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 # 378 "/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 # 382 "/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 # 389 "/usr/include/sys/cdefs.h" 3 4 #ifndef __STDC_CONSTANT_MACROS #define __STDC_CONSTANT_MACROS #endif # 392 "/usr/include/sys/cdefs.h" 3 4 #endif # 393 "/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 # 404 "/usr/include/sys/cdefs.h" 3 4 #define __restrict restrict #endif # 406 "/usr/include/sys/cdefs.h" 3 4 #endif # 407 "/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 # 440 "/usr/include/sys/cdefs.h" 3 4 #define __predict_true(exp) (exp) #define __predict_false(exp) (exp) #endif # 443 "/usr/include/sys/cdefs.h" 3 4 #if __GNUC_PREREQ__(4, 0) #define __hidden __attribute__((__visibility__("hidden"))) #define __exported __attribute__((__visibility__("default"))) #else # 448 "/usr/include/sys/cdefs.h" 3 4 #define __hidden #define __exported #endif # 451 "/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 # 459 "/usr/include/sys/cdefs.h" 3 4 #ifndef __cplusplus #define __offsetof(type, field) \ ((__size_t)(__uintptr_t)((const volatile void *)&((type *)0)->field)) #else # 463 "/usr/include/sys/cdefs.h" 3 4 #define __offsetof(type, field) \ (__offsetof__ (reinterpret_cast <__size_t> \ (&reinterpret_cast \ (static_cast (0)->field)))) #endif # 468 "/usr/include/sys/cdefs.h" 3 4 #endif # 469 "/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 # 484 "/usr/include/sys/cdefs.h" 3 4 #define __containerof(x, s, m) \ __DEQUALIFY(s *, (const volatile char *)(x) - __offsetof(s, m)) #endif # 487 "/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 # 501 "/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 # 511 "/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 # 518 "/usr/include/sys/cdefs.h" 3 4 #define __printf0like(fmtarg, firstvararg) #endif # 520 "/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 # 526 "/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 # 539 "/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__ */ # 551 "/usr/include/sys/cdefs.h" 3 4 #endif /* __GNUC__ || __INTEL_COMPILER */ # 552 "/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 # 559 "/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 # 567 "/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: stable/10/sys/sys/cdefs.h 284948 2015-06-30 08:40:15Z tijl $"); */ #ifndef __FBSDID #if !defined(lint) && !defined(STRIP_FBSDID) #define __FBSDID(s) __IDSTRING(__CONCAT(__rcsid_,__LINE__),s) #else # 578 "/usr/include/sys/cdefs.h" 3 4 #define __FBSDID(s) struct __hack #endif # 580 "/usr/include/sys/cdefs.h" 3 4 #endif # 581 "/usr/include/sys/cdefs.h" 3 4 #ifndef __RCSID #ifndef NO__RCSID #define __RCSID(s) __IDSTRING(__CONCAT(__rcsid_,__LINE__),s) #else # 586 "/usr/include/sys/cdefs.h" 3 4 #define __RCSID(s) struct __hack #endif # 588 "/usr/include/sys/cdefs.h" 3 4 #endif # 589 "/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 # 594 "/usr/include/sys/cdefs.h" 3 4 #define __RCSID_SOURCE(s) struct __hack #endif # 596 "/usr/include/sys/cdefs.h" 3 4 #endif # 597 "/usr/include/sys/cdefs.h" 3 4 #ifndef __SCCSID #ifndef NO__SCCSID #define __SCCSID(s) __IDSTRING(__CONCAT(__sccsid_,__LINE__),s) #else # 602 "/usr/include/sys/cdefs.h" 3 4 #define __SCCSID(s) struct __hack #endif # 604 "/usr/include/sys/cdefs.h" 3 4 #endif # 605 "/usr/include/sys/cdefs.h" 3 4 #ifndef __COPYRIGHT #ifndef NO__COPYRIGHT #define __COPYRIGHT(s) __IDSTRING(__CONCAT(__copyright_,__LINE__),s) #else # 610 "/usr/include/sys/cdefs.h" 3 4 #define __COPYRIGHT(s) struct __hack #endif # 612 "/usr/include/sys/cdefs.h" 3 4 #endif # 613 "/usr/include/sys/cdefs.h" 3 4 #ifndef __DECONST #define __DECONST(type, var) ((type)(__uintptr_t)(const void *)(var)) #endif # 617 "/usr/include/sys/cdefs.h" 3 4 #ifndef __DEVOLATILE #define __DEVOLATILE(type, var) ((type)(__uintptr_t)(volatile void *)(var)) #endif # 621 "/usr/include/sys/cdefs.h" 3 4 #ifndef __DEQUALIFY #define __DEQUALIFY(type, var) ((type)(__uintptr_t)(const volatile void *)(var)) #endif # 625 "/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 # 654 "/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 # 660 "/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 # 668 "/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 # 672 "/usr/include/sys/cdefs.h" 3 4 #define __XSI_VISIBLE 500 #undef _POSIX_C_SOURCE #define _POSIX_C_SOURCE 199506 #endif # 676 "/usr/include/sys/cdefs.h" 3 4 #endif # 677 "/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 # 685 "/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 # 690 "/usr/include/sys/cdefs.h" 3 4 #define __POSIX_VISIBLE 200112 #define __ISO_C_VISIBLE 1999 #elif _POSIX_C_SOURCE >= 199506 # 693 "/usr/include/sys/cdefs.h" 3 4 #define __POSIX_VISIBLE 199506 #define __ISO_C_VISIBLE 1990 #elif _POSIX_C_SOURCE >= 199309 # 696 "/usr/include/sys/cdefs.h" 3 4 #define __POSIX_VISIBLE 199309 #define __ISO_C_VISIBLE 1990 #elif _POSIX_C_SOURCE >= 199209 # 699 "/usr/include/sys/cdefs.h" 3 4 #define __POSIX_VISIBLE 199209 #define __ISO_C_VISIBLE 1990 #elif _POSIX_C_SOURCE >= 199009 # 702 "/usr/include/sys/cdefs.h" 3 4 #define __POSIX_VISIBLE 199009 #define __ISO_C_VISIBLE 1990 #else # 705 "/usr/include/sys/cdefs.h" 3 4 #define __POSIX_VISIBLE 198808 #define __ISO_C_VISIBLE 0 #endif /* _POSIX_C_SOURCE */ # 708 "/usr/include/sys/cdefs.h" 3 4 #else # 709 "/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. */ # 727 "/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. */ # 732 "/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. */ # 737 "/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 # 742 "/usr/include/sys/cdefs.h" 3 4 #endif # 743 "/usr/include/sys/cdefs.h" 3 4 #if defined(__mips) || defined(__powerpc64__) #define __NO_TLS 1 #endif # 747 "/usr/include/sys/cdefs.h" 3 4 #endif /* !_SYS_CDEFS_H_ */ # 749 "/usr/include/sys/cdefs.h" 3 4 # 39 "/usr/include/assert.h" 2 3 4 /* * Unlike other ANSI header files, may usefully be included * multiple times, with and without NDEBUG defined. */ #undef assert #undef _assert #ifdef NDEBUG #define assert(e) ((void)0) #define _assert(e) ((void)0) #else # 52 "/usr/include/assert.h" 3 4 #define _assert(e) assert(e) #define assert(e) ((e) ? (void)0 : __assert(__func__, __FILE__, \ __LINE__, #e)) #endif /* NDEBUG */ # 57 "/usr/include/assert.h" 3 4 #ifndef _ASSERT_H_ #define _ASSERT_H_ /* * Static assertions. In principle we could define static_assert for * C++ older than C++11, but this breaks if _Static_assert is * implemented as a macro. * * C++ template parameters may contain commas, even if not enclosed in * parentheses, causing the _Static_assert macro to be invoked with more * than two parameters. */ #if __ISO_C_VISIBLE >= 2011 && !defined(__cplusplus) #define static_assert _Static_assert #endif # 73 "/usr/include/assert.h" 3 4 __BEGIN_DECLS void __assert(const char *, const char *, int, const char *) __dead2; __END_DECLS #endif /* !_ASSERT_H_ */ # 79 "/usr/include/assert.h" 3 4 # 33 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/intern/BLI_kdopbvh.c" 2 #if 0 /* expanded by -frewrite-includes */ #include "MEM_guardedalloc.h" #endif /* expanded by -frewrite-includes */ # 34 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/intern/BLI_kdopbvh.c" # 1 "/usr/ports/graphics/blender/work/blender-2.75/intern/guardedalloc/MEM_guardedalloc.h" 1 /* * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. * All rights reserved. * * The Original Code is: all of this file. * * Contributor(s): Brecht Van Lommel * Campbell Barton * * ***** END GPL LICENSE BLOCK ***** */ /** * \file MEM_guardedalloc.h * \ingroup MEM * * \author Copyright (C) 2001 NaN Technologies B.V. * \brief Read \ref MEMPage * * \page MEMPage Guarded memory(de)allocation * * \section aboutmem c-style guarded memory allocation * * \subsection memabout About the MEM module * * MEM provides guarded malloc/calloc calls. All memory is enclosed by * pads, to detect out-of-bound writes. All blocks are placed in a * linked list, so they remain reachable at all times. There is no * back-up in case the linked-list related data is lost. * * \subsection memissues Known issues with MEM * * There are currently no known issues with MEM. Note that there is a * second intern/ module with MEM_ prefix, for use in c++. * * \subsection memdependencies Dependencies * - stdlib * - stdio * * \subsection memdocs API Documentation * See \ref MEM_guardedalloc.h */ #ifndef __MEM_GUARDEDALLOC_H__ #define __MEM_GUARDEDALLOC_H__ #if 0 /* expanded by -frewrite-includes */ #include /* needed for FILE* */ #endif /* expanded by -frewrite-includes */ # 63 "/usr/ports/graphics/blender/work/blender-2.75/intern/guardedalloc/MEM_guardedalloc.h" # 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: stable/10/include/stdio.h 281036 2015-04-03 17:19:29Z 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 # 40 "/usr/include/stdio.h" 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: stable/10/sys/sys/_types.h 255219 2013-09-05 00:09:56Z pjd $ */ #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: stable/10/sys/x86/include/_types.h 264496 2014-04-15 09:41:52Z 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 __uint32_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 __BSD_VISIBLE || __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 __BSD_VISIBLE || __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 <= 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 __BSD_VISIBLE || __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 /* __BSD_VISIBLE || __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 # 64 "/usr/ports/graphics/blender/work/blender-2.75/intern/guardedalloc/MEM_guardedalloc.h" 2 /* needed for uintptr_t and attributes, exception, dont use BLI anywhere else in MEM_* */ #if 0 /* expanded by -frewrite-includes */ #include "../../source/blender/blenlib/BLI_sys_types.h" #endif /* expanded by -frewrite-includes */ # 66 "/usr/ports/graphics/blender/work/blender-2.75/intern/guardedalloc/MEM_guardedalloc.h" # 1 "/usr/ports/graphics/blender/work/blender-2.75/intern/guardedalloc/../../source/blender/blenlib/BLI_sys_types.h" 1 /* * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. * All rights reserved. * * The Original Code is: all of this file. * * Contributor(s): none yet. * * ***** END GPL LICENSE BLOCK ***** */ /** \file BLI_sys_types.h * \ingroup bli * * A platform-independent definition of [u]intXX_t * Plus the accompanying header include for htonl/ntohl * * This file includes to define [u]intXX_t types, where * XX can be 8, 16, 32 or 64. Unfortunately, not all systems have this * file. * - Windows uses __intXX compiler-builtin types. These are signed, * so we have to flip the signs. * For these rogue platforms, we make the typedefs ourselves. * */ #ifndef __BLI_SYS_TYPES_H__ #define __BLI_SYS_TYPES_H__ #ifdef __cplusplus extern "C" { #endif # 49 "/usr/ports/graphics/blender/work/blender-2.75/intern/guardedalloc/../../source/blender/blenlib/BLI_sys_types.h" #if defined(__linux__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD_kernel__) || defined(__GNU__) /* Linux-i386, Linux-Alpha, Linux-ppc */ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 53 "/usr/ports/graphics/blender/work/blender-2.75/intern/guardedalloc/../../source/blender/blenlib/BLI_sys_types.h" # 54 "/usr/ports/graphics/blender/work/blender-2.75/intern/guardedalloc/../../source/blender/blenlib/BLI_sys_types.h" /* XXX */ #ifndef UINT64_MAX # define UINT64_MAX 18446744073709551615 typedef uint8_t u_int8_t; typedef uint16_t u_int16_t; typedef uint32_t u_int32_t; typedef uint64_t u_int64_t; #endif # 63 "/usr/ports/graphics/blender/work/blender-2.75/intern/guardedalloc/../../source/blender/blenlib/BLI_sys_types.h" #elif defined(__APPLE__) # 65 "/usr/ports/graphics/blender/work/blender-2.75/intern/guardedalloc/../../source/blender/blenlib/BLI_sys_types.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 66 "/usr/ports/graphics/blender/work/blender-2.75/intern/guardedalloc/../../source/blender/blenlib/BLI_sys_types.h" # 67 "/usr/ports/graphics/blender/work/blender-2.75/intern/guardedalloc/../../source/blender/blenlib/BLI_sys_types.h" /* MinGW and MSVC >= 2010 */ #elif defined(FREE_WINDOWS) || defined(_MSC_VER) # 70 "/usr/ports/graphics/blender/work/blender-2.75/intern/guardedalloc/../../source/blender/blenlib/BLI_sys_types.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 70 "/usr/ports/graphics/blender/work/blender-2.75/intern/guardedalloc/../../source/blender/blenlib/BLI_sys_types.h" # 71 "/usr/ports/graphics/blender/work/blender-2.75/intern/guardedalloc/../../source/blender/blenlib/BLI_sys_types.h" #else # 73 "/usr/ports/graphics/blender/work/blender-2.75/intern/guardedalloc/../../source/blender/blenlib/BLI_sys_types.h" /* FreeBSD, Solaris */ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 75 "/usr/ports/graphics/blender/work/blender-2.75/intern/guardedalloc/../../source/blender/blenlib/BLI_sys_types.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: stable/10/sys/sys/types.h 281538 2015-04-14 20:05:26Z 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_RIGHTS_T_DECLARED #define _CAP_RIGHTS_T_DECLARED struct cap_rights; typedef struct cap_rights cap_rights_t; #endif # 241 "/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 # 277 "/usr/include/sys/types.h" 3 4 typedef _Bool bool; #endif /* !__bool_true_false_are_defined && !__cplusplus */ # 279 "/usr/include/sys/types.h" 3 4 #define offsetof(type, field) __offsetof(type, field) #endif /* !_KERNEL */ # 283 "/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 */ # 290 "/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: stable/10/sys/sys/select.h 154090 2006-01-06 22:12:46Z marcel $ */ #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 1024U #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 # 291 "/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 # 299 "/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 # 342 "/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 # 351 "/usr/include/sys/types.h" 3 4 #define __bitcount(x) __bitcount32((unsigned int)(x)) #endif # 353 "/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 # 374 "/usr/include/sys/types.h" 3 4 #ifndef _LSEEK_DECLARED #define _LSEEK_DECLARED off_t lseek(int, off_t, int); #endif # 378 "/usr/include/sys/types.h" 3 4 #ifndef _MMAP_DECLARED #define _MMAP_DECLARED void * mmap(void *, size_t, int, int, int, off_t); #endif # 382 "/usr/include/sys/types.h" 3 4 #ifndef _TRUNCATE_DECLARED #define _TRUNCATE_DECLARED int truncate(const char *, off_t); #endif # 386 "/usr/include/sys/types.h" 3 4 __END_DECLS #endif /* !_KERNEL */ # 388 "/usr/include/sys/types.h" 3 4 #endif /* __BSD_VISIBLE */ # 390 "/usr/include/sys/types.h" 3 4 #endif /* !_SYS_TYPES_H_ */ # 392 "/usr/include/sys/types.h" 3 4 # 76 "/usr/ports/graphics/blender/work/blender-2.75/intern/guardedalloc/../../source/blender/blenlib/BLI_sys_types.h" 2 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 76 "/usr/ports/graphics/blender/work/blender-2.75/intern/guardedalloc/../../source/blender/blenlib/BLI_sys_types.h" # 1 "/usr/include/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/stdint.h" 3 4 # 33 "/usr/include/stdint.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 33 "/usr/include/stdint.h" 3 4 # 34 "/usr/include/stdint.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 35 "/usr/include/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/stdint.h" 2 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 36 "/usr/include/stdint.h" 3 4 # 37 "/usr/include/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/stdint.h" 3 4 #ifndef _UINTMAX_T_DECLARED typedef __uintmax_t uintmax_t; #define _UINTMAX_T_DECLARED #endif # 66 "/usr/include/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/stdint.h" 3 4 #define __WORDSIZE 32 #endif # 73 "/usr/include/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/stdint.h" 3 4 # 77 "/usr/ports/graphics/blender/work/blender-2.75/intern/guardedalloc/../../source/blender/blenlib/BLI_sys_types.h" 2 #endif /* ifdef platform for types */ # 79 "/usr/ports/graphics/blender/work/blender-2.75/intern/guardedalloc/../../source/blender/blenlib/BLI_sys_types.h" #if 0 /* expanded by -frewrite-includes */ #include /* size_t define */ #endif /* expanded by -frewrite-includes */ # 80 "/usr/ports/graphics/blender/work/blender-2.75/intern/guardedalloc/../../source/blender/blenlib/BLI_sys_types.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: stable/10/include/stddef.h 264496 2014-04-15 09:41:52Z tijl $ */ #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 typedef __ptrdiff_t ptrdiff_t; #if __BSD_VISIBLE #ifndef _RUNE_T_DECLARED typedef __rune_t rune_t; #define _RUNE_T_DECLARED #endif # 48 "/usr/include/stddef.h" 3 4 #endif # 49 "/usr/include/stddef.h" 3 4 #ifndef _SIZE_T_DECLARED typedef __size_t size_t; #define _SIZE_T_DECLARED #endif # 54 "/usr/include/stddef.h" 3 4 #ifndef __cplusplus #ifndef _WCHAR_T_DECLARED typedef ___wchar_t wchar_t; #define _WCHAR_T_DECLARED #endif # 60 "/usr/include/stddef.h" 3 4 #endif # 61 "/usr/include/stddef.h" 3 4 #define offsetof(type, member) __offsetof(type, member) #endif /* _STDDEF_H_ */ # 65 "/usr/include/stddef.h" 3 4 # 81 "/usr/ports/graphics/blender/work/blender-2.75/intern/guardedalloc/../../source/blender/blenlib/BLI_sys_types.h" 2 #ifdef HAVE_STDBOOL_H #if 0 /* expanded by -frewrite-includes */ # include #endif /* expanded by -frewrite-includes */ # 83 "/usr/ports/graphics/blender/work/blender-2.75/intern/guardedalloc/../../source/blender/blenlib/BLI_sys_types.h" # 1 "/usr/include/stdbool.h" 1 3 4 /* * Copyright (c) 2000 Jeroen Ruigrok van der Werven * 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/include/stdbool.h 228878 2011-12-25 20:15:41Z ed $ */ #ifndef __bool_true_false_are_defined #define __bool_true_false_are_defined 1 #ifndef __cplusplus #define false 0 #define true 1 #define bool _Bool #if __STDC_VERSION__ < 199901L && __GNUC__ < 3 && !defined(__INTEL_COMPILER) typedef int _Bool; #endif # 41 "/usr/include/stdbool.h" 3 4 #endif /* !__cplusplus */ # 43 "/usr/include/stdbool.h" 3 4 #endif /* __bool_true_false_are_defined */ # 44 "/usr/include/stdbool.h" 3 4 # 84 "/usr/ports/graphics/blender/work/blender-2.75/intern/guardedalloc/../../source/blender/blenlib/BLI_sys_types.h" 2 #elif !defined(__bool_true_false_are_defined) && !defined(__BOOL_DEFINED) # 85 "/usr/ports/graphics/blender/work/blender-2.75/intern/guardedalloc/../../source/blender/blenlib/BLI_sys_types.h" # ifndef HAVE__BOOL # ifdef __cplusplus typedef bool _BLI_Bool; # else # 89 "/usr/ports/graphics/blender/work/blender-2.75/intern/guardedalloc/../../source/blender/blenlib/BLI_sys_types.h" /* Make sure bool is alays defined with the same size for both C and C++ */ # define _BLI_Bool unsigned char # endif # 92 "/usr/ports/graphics/blender/work/blender-2.75/intern/guardedalloc/../../source/blender/blenlib/BLI_sys_types.h" # else # 93 "/usr/ports/graphics/blender/work/blender-2.75/intern/guardedalloc/../../source/blender/blenlib/BLI_sys_types.h" # define _BLI_Bool _Bool # endif # 95 "/usr/ports/graphics/blender/work/blender-2.75/intern/guardedalloc/../../source/blender/blenlib/BLI_sys_types.h" # define bool _BLI_Bool # define false 0 # define true 1 # define __bool_true_false_are_defined 1 #endif # 100 "/usr/ports/graphics/blender/work/blender-2.75/intern/guardedalloc/../../source/blender/blenlib/BLI_sys_types.h" #ifdef __cplusplus } #endif # 104 "/usr/ports/graphics/blender/work/blender-2.75/intern/guardedalloc/../../source/blender/blenlib/BLI_sys_types.h" #endif /* eof */ # 106 "/usr/ports/graphics/blender/work/blender-2.75/intern/guardedalloc/../../source/blender/blenlib/BLI_sys_types.h" # 67 "/usr/ports/graphics/blender/work/blender-2.75/intern/guardedalloc/MEM_guardedalloc.h" 2 #if 0 /* expanded by -frewrite-includes */ #include "../../source/blender/blenlib/BLI_compiler_attrs.h" #endif /* expanded by -frewrite-includes */ # 67 "/usr/ports/graphics/blender/work/blender-2.75/intern/guardedalloc/MEM_guardedalloc.h" # 1 "/usr/ports/graphics/blender/work/blender-2.75/intern/guardedalloc/../../source/blender/blenlib/BLI_compiler_attrs.h" 1 /* * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * The Original Code is Copyright (C) 2013 Blender Foundation. * All rights reserved. * * The Original Code is: all of this file. * * Contributor(s): Campbell Barton * Sergey Sharybin * * ***** END GPL LICENSE BLOCK ***** */ #ifndef __BLI_COMPILER_ATTRS_H__ #define __BLI_COMPILER_ATTRS_H__ /** \file BLI_compiler_attrs.h * \ingroup bli */ /* hint to make sure function result is actually used */ #ifdef __GNUC__ # define ATTR_WARN_UNUSED_RESULT __attribute__((warn_unused_result)) #else # 40 "/usr/ports/graphics/blender/work/blender-2.75/intern/guardedalloc/../../source/blender/blenlib/BLI_compiler_attrs.h" # define ATTR_WARN_UNUSED_RESULT #endif # 42 "/usr/ports/graphics/blender/work/blender-2.75/intern/guardedalloc/../../source/blender/blenlib/BLI_compiler_attrs.h" /* hint to mark function arguments expected to be non-null * if no arguments are given to the macro, all of pointer * arguments would be expected to be non-null */ #ifdef __GNUC__ # define ATTR_NONNULL(args ...) __attribute__((nonnull(args))) #else # 50 "/usr/ports/graphics/blender/work/blender-2.75/intern/guardedalloc/../../source/blender/blenlib/BLI_compiler_attrs.h" # define ATTR_NONNULL(...) #endif # 52 "/usr/ports/graphics/blender/work/blender-2.75/intern/guardedalloc/../../source/blender/blenlib/BLI_compiler_attrs.h" /* never returns NULL */ # if (__GNUC__ * 100 + __GNUC_MINOR__) >= 409 /* gcc4.9+ only */ # define ATTR_RETURNS_NONNULL __attribute__((returns_nonnull)) #else # 57 "/usr/ports/graphics/blender/work/blender-2.75/intern/guardedalloc/../../source/blender/blenlib/BLI_compiler_attrs.h" # define ATTR_RETURNS_NONNULL #endif # 59 "/usr/ports/graphics/blender/work/blender-2.75/intern/guardedalloc/../../source/blender/blenlib/BLI_compiler_attrs.h" /* hint to mark function as it wouldn't return */ #if defined(__GNUC__) || defined(__clang__) # define ATTR_NORETURN __attribute__((noreturn)) #else # 64 "/usr/ports/graphics/blender/work/blender-2.75/intern/guardedalloc/../../source/blender/blenlib/BLI_compiler_attrs.h" # define ATTR_NORETURN #endif # 66 "/usr/ports/graphics/blender/work/blender-2.75/intern/guardedalloc/../../source/blender/blenlib/BLI_compiler_attrs.h" /* hint to treat any non-null function return value cannot alias any other pointer */ #if (defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 403)) # define ATTR_MALLOC __attribute__((malloc)) #else # 71 "/usr/ports/graphics/blender/work/blender-2.75/intern/guardedalloc/../../source/blender/blenlib/BLI_compiler_attrs.h" # define ATTR_MALLOC #endif # 73 "/usr/ports/graphics/blender/work/blender-2.75/intern/guardedalloc/../../source/blender/blenlib/BLI_compiler_attrs.h" /* the function return value points to memory (2 args for 'size * tot') */ #if (defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 403)) # define ATTR_ALLOC_SIZE(args ...) __attribute__((alloc_size(args))) #else # 78 "/usr/ports/graphics/blender/work/blender-2.75/intern/guardedalloc/../../source/blender/blenlib/BLI_compiler_attrs.h" # define ATTR_ALLOC_SIZE(...) #endif # 80 "/usr/ports/graphics/blender/work/blender-2.75/intern/guardedalloc/../../source/blender/blenlib/BLI_compiler_attrs.h" /* ensures a NULL terminating argument as the n'th last argument of a variadic function */ #ifdef __GNUC__ # define ATTR_SENTINEL(arg_pos) __attribute__((sentinel(arg_pos))) #else # 85 "/usr/ports/graphics/blender/work/blender-2.75/intern/guardedalloc/../../source/blender/blenlib/BLI_compiler_attrs.h" # define ATTR_SENTINEL(arg_pos) #endif # 87 "/usr/ports/graphics/blender/work/blender-2.75/intern/guardedalloc/../../source/blender/blenlib/BLI_compiler_attrs.h" /* hint to compiler that function uses printf-style format string */ #ifdef __GNUC__ # define ATTR_PRINTF_FORMAT(format_param, dots_param) __attribute__((format(printf, format_param, dots_param))) #else # 92 "/usr/ports/graphics/blender/work/blender-2.75/intern/guardedalloc/../../source/blender/blenlib/BLI_compiler_attrs.h" # define ATTR_PRINTF_FORMAT(format_param, dots_param) #endif # 94 "/usr/ports/graphics/blender/work/blender-2.75/intern/guardedalloc/../../source/blender/blenlib/BLI_compiler_attrs.h" #endif /* __BLI_COMPILER_ATTRS_H__ */ # 96 "/usr/ports/graphics/blender/work/blender-2.75/intern/guardedalloc/../../source/blender/blenlib/BLI_compiler_attrs.h" # 68 "/usr/ports/graphics/blender/work/blender-2.75/intern/guardedalloc/MEM_guardedalloc.h" 2 #ifdef __cplusplus extern "C" { #endif # 72 "/usr/ports/graphics/blender/work/blender-2.75/intern/guardedalloc/MEM_guardedalloc.h" /** Returns the length of the allocated memory segment pointed at * by vmemh. If the pointer was not previously allocated by this * module, the result is undefined.*/ extern size_t (*MEM_allocN_len)(const void *vmemh) ATTR_WARN_UNUSED_RESULT; /** * Release memory previously allocated by this module. */ extern void (*MEM_freeN)(void *vmemh); #if 0 /* UNUSED */ /** * Return zero if memory is not in allocated list */ extern short (*MEM_testN)(void *vmemh); #endif # 89 "/usr/ports/graphics/blender/work/blender-2.75/intern/guardedalloc/MEM_guardedalloc.h" /** * Duplicates a block of memory, and returns a pointer to the * newly allocated block. */ extern void *(*MEM_dupallocN)(const void *vmemh) /* ATTR_MALLOC */ ATTR_WARN_UNUSED_RESULT; /** * Reallocates a block of memory, and returns pointer to the newly * allocated block, the old one is freed. this is not as optimized * as a system realloc but just makes a new allocation and copies * over from existing memory. */ extern void *(*MEM_reallocN_id)(void *vmemh, size_t len, const char *str) /* ATTR_MALLOC */ ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(2); /** * A variant of realloc which zeros new bytes */ extern void *(*MEM_recallocN_id)(void *vmemh, size_t len, const char *str) /* ATTR_MALLOC */ ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(2); #define MEM_reallocN(vmemh, len) MEM_reallocN_id(vmemh, len, __func__) #define MEM_recallocN(vmemh, len) MEM_recallocN_id(vmemh, len, __func__) /** * Allocate a block of memory of size len, with tag name str. The * memory is cleared. The name must be static, because only a * pointer to it is stored ! */ extern void *(*MEM_callocN)(size_t len, const char *str) /* ATTR_MALLOC */ ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1) ATTR_NONNULL(2); /** * Allocate a block of memory of size len, with tag name str. The * name must be a static, because only a pointer to it is stored ! * */ extern void *(*MEM_mallocN)(size_t len, const char *str) /* ATTR_MALLOC */ ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1) ATTR_NONNULL(2); /** * Allocate an aligned block of memory of size len, with tag name str. The * name must be a static, because only a pointer to it is stored ! * */ extern void *(*MEM_mallocN_aligned)(size_t len, size_t alignment, const char *str) /* ATTR_MALLOC */ ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1) ATTR_NONNULL(3); /** * Same as callocN, clears memory and uses mmap (disk cached) if supported. * Can be free'd with MEM_freeN as usual. * */ extern void *(*MEM_mapallocN)(size_t len, const char *str) /* ATTR_MALLOC */ ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1) ATTR_NONNULL(2); /** Print a list of the names and sizes of all allocated memory * blocks. as a python dict for easy investigation */ extern void (*MEM_printmemlist_pydict)(void); /** Print a list of the names and sizes of all allocated memory * blocks. */ extern void (*MEM_printmemlist)(void); /** calls the function on all allocated memory blocks. */ extern void (*MEM_callbackmemlist)(void (*func)(void *)); /** Print statistics about memory usage */ extern void (*MEM_printmemlist_stats)(void); /** Set the callback function for error output. */ extern void (*MEM_set_error_callback)(void (*func)(const char *)); /** * Are the start/end block markers still correct ? * * @retval 0 for correct memory, 1 for corrupted memory. */ extern bool (*MEM_check_memory_integrity)(void); /** Set thread locking functions for safe memory allocation from multiple * threads, pass NULL pointers to disable thread locking again. */ extern void (*MEM_set_lock_callback)(void (*lock)(void), void (*unlock)(void)); /** Attempt to enforce OSX (or other OS's) to have malloc and stack nonzero */ extern void (*MEM_set_memory_debug)(void); /** * Memory usage stats * - MEM_get_memory_in_use is all memory * - MEM_get_mapped_memory_in_use is a subset of all memory */ extern size_t (*MEM_get_memory_in_use)(void); /** Get mapped memory usage. */ extern size_t (*MEM_get_mapped_memory_in_use)(void); /** Get amount of memory blocks in use. */ extern unsigned int (*MEM_get_memory_blocks_in_use)(void); /** Reset the peak memory statistic to zero. */ extern void (*MEM_reset_peak_memory)(void); /** Get the peak memory usage in bytes, including mmap allocations. */ extern size_t (*MEM_get_peak_memory)(void) ATTR_WARN_UNUSED_RESULT; #ifdef __GNUC__ #define MEM_SAFE_FREE(v) do { \ typeof(&(v)) _v = &(v); \ if (*_v) { \ MEM_freeN(*_v); \ *_v = NULL; \ } \ } while (0) #else # 189 "/usr/ports/graphics/blender/work/blender-2.75/intern/guardedalloc/MEM_guardedalloc.h" #define MEM_SAFE_FREE(v) do { \ void ** _v = (void **)&(v); \ if (*_v) { \ MEM_freeN(*_v); \ *_v = NULL; \ } \ } while (0) #endif # 197 "/usr/ports/graphics/blender/work/blender-2.75/intern/guardedalloc/MEM_guardedalloc.h" /* overhead for lockfree allocator (use to avoid slop-space) */ #define MEM_SIZE_OVERHEAD sizeof(size_t) #define MEM_SIZE_OPTIMAL(size) ((size) - MEM_SIZE_OVERHEAD) #ifndef NDEBUG extern const char *(*MEM_name_ptr)(void *vmemh); #endif # 205 "/usr/ports/graphics/blender/work/blender-2.75/intern/guardedalloc/MEM_guardedalloc.h" /* Switch allocator to slower but fully guarded mode. */ void MEM_use_guarded_allocator(void); #ifdef __cplusplus /* alloc funcs for C++ only */ #define MEM_CXX_CLASS_ALLOC_FUNCS(_id) \ public: \ void *operator new(size_t num_bytes) { \ return MEM_mallocN(num_bytes, _id); \ } \ void operator delete(void *mem) { \ if (mem) \ MEM_freeN(mem); \ } \ void *operator new[](size_t num_bytes) { \ return MEM_mallocN(num_bytes, _id "[]"); \ } \ void operator delete[](void *mem) { \ if (mem) \ MEM_freeN(mem); \ } \ #if defined __GNUC__ || defined __sun # define OBJECT_GUARDED_NEW(type, args ...) \ new(MEM_mallocN(sizeof(type), __func__)) type(args) #else # 232 "/usr/ports/graphics/blender/work/blender-2.75/intern/guardedalloc/MEM_guardedalloc.h" # define OBJECT_GUARDED_NEW(type, ...) \ new(MEM_mallocN(sizeof(type), __FUNCTION__)) type(__VA_ARGS__) #endif # 235 "/usr/ports/graphics/blender/work/blender-2.75/intern/guardedalloc/MEM_guardedalloc.h" #define OBJECT_GUARDED_DELETE(what, type) \ { if(what) { \ ((type*)(what))->~type(); \ MEM_freeN(what); \ } } (void)0 #endif /* __cplusplus */ # 241 "/usr/ports/graphics/blender/work/blender-2.75/intern/guardedalloc/MEM_guardedalloc.h" #ifdef __cplusplus } #endif /* __cplusplus */ # 245 "/usr/ports/graphics/blender/work/blender-2.75/intern/guardedalloc/MEM_guardedalloc.h" #endif /* __MEM_GUARDEDALLOC_H__ */ # 247 "/usr/ports/graphics/blender/work/blender-2.75/intern/guardedalloc/MEM_guardedalloc.h" # 35 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/intern/BLI_kdopbvh.c" 2 #if 0 /* expanded by -frewrite-includes */ #include "BLI_utildefines.h" #endif /* expanded by -frewrite-includes */ # 36 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/intern/BLI_kdopbvh.c" # 1 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_utildefines.h" 1 /* * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. * All rights reserved. * * The Original Code is: all of this file. * * Contributor(s): none yet. * * ***** END GPL LICENSE BLOCK ***** */ #ifndef __BLI_UTILDEFINES_H__ #define __BLI_UTILDEFINES_H__ /** \file BLI_utildefines.h * \ingroup bli */ #ifdef __cplusplus extern "C" { #endif # 38 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_utildefines.h" /* avoid many includes for now */ #if 0 /* expanded by -frewrite-includes */ #include "BLI_sys_types.h" #endif /* expanded by -frewrite-includes */ # 40 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_utildefines.h" # 41 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_utildefines.h" #if 0 /* expanded by -frewrite-includes */ #include "BLI_compiler_compat.h" #endif /* expanded by -frewrite-includes */ # 41 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_utildefines.h" # 1 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_compiler_compat.h" 1 /* * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * ***** END GPL LICENSE BLOCK ***** */ #ifndef __BLI_COMPILER_COMPAT_H__ #define __BLI_COMPILER_COMPAT_H__ /** \file BLI_compiler_compat.h * \ingroup bli * * Use to help with cross platform portability. */ #if defined(_MSC_VER) # define __func__ __FUNCTION__ # define alloca _alloca #endif # 34 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_compiler_compat.h" /* alloca is defined here for MinGW32 */ #ifdef __MINGW32__ #if 0 /* expanded by -frewrite-includes */ # include #endif /* expanded by -frewrite-includes */ # 37 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_compiler_compat.h" # 38 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_compiler_compat.h" #endif # 39 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_compiler_compat.h" #if defined(__cplusplus) && ((__cplusplus >= 201103L) || (defined(_MSC_VER) && _MSC_VER >= 1800)) # define HAS_CPP11_FEATURES #endif # 43 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_compiler_compat.h" #if (defined(__GNUC__) || defined(__clang__)) && defined(HAS_CPP11_FEATURES) extern "C++" { /* Some magic to be sure we don't have reference in the type. */ template static inline T decltype_helper(T x) { return x; } # define typeof(x) decltype(decltype_helper(x)) } #endif # 51 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_compiler_compat.h" #endif /* __BLI_COMPILER_COMPAT_H__ */ # 53 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_compiler_compat.h" # 42 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_utildefines.h" 2 #ifndef NDEBUG /* for BLI_assert */ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 44 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_utildefines.h" # 45 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_utildefines.h" #endif # 46 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_utildefines.h" /* varargs macros (keep first so others can use) */ /* --- internal helpers --- */ #define _VA_NARGS_GLUE(x, y) x y #define _VA_NARGS_RETURN_COUNT(\ _1_, _2_, _3_, _4_, _5_, _6_, _7_, _8_, _9_, _10_, _11_, _12_, _13_, _14_, _15_, _16_, \ _17_, _18_, _19_, _20_, _21_, _22_, _23_, _24_, _25_, _26_, _27_, _28_, _29_, _30_, _31_, _32_, \ _33_, _34_, _35_, _36_, _37_, _38_, _39_, _40_, _41_, _42_, _43_, _44_, _45_, _46_, _47_, _48_, \ _49_, _50_, _51_, _52_, _53_, _54_, _55_, _56_, _57_, _58_, _59_, _60_, _61_, _62_, _63_, _64_, \ count, ...) count #define _VA_NARGS_EXPAND(args) _VA_NARGS_RETURN_COUNT args /* 64 args max */ #define _VA_NARGS_COUNT(...) _VA_NARGS_EXPAND((__VA_ARGS__, \ 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, \ 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, \ 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, \ 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0)) #define _VA_NARGS_OVERLOAD_MACRO2(name, count) name##count #define _VA_NARGS_OVERLOAD_MACRO1(name, count) _VA_NARGS_OVERLOAD_MACRO2(name, count) #define _VA_NARGS_OVERLOAD_MACRO(name, count) _VA_NARGS_OVERLOAD_MACRO1(name, count) /* --- expose for re-use --- */ #define VA_NARGS_CALL_OVERLOAD(name, ...) \ _VA_NARGS_GLUE(_VA_NARGS_OVERLOAD_MACRO(name, _VA_NARGS_COUNT(__VA_ARGS__)), (__VA_ARGS__)) /* useful for finding bad use of min/max */ #if 0 /* gcc only */ # define _TYPECHECK(a, b) ((void)(((typeof(a) *)0) == ((typeof(b) *)0))) # define MIN2(x, y) (_TYPECHECK(x, y), (((x) < (y) ? (x) : (y)))) # define MAX2(x, y) (_TYPECHECK(x, y), (((x) > (y) ? (x) : (y)))) #endif # 78 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_utildefines.h" /* include after _VA_NARGS macro */ #if 0 /* expanded by -frewrite-includes */ #include "BLI_compiler_typecheck.h" #endif /* expanded by -frewrite-includes */ # 80 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_utildefines.h" # 1 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_compiler_typecheck.h" 1 /* * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * ***** END GPL LICENSE BLOCK ***** */ #ifndef __BLI_COMPILER_TYPECHECK_H__ #define __BLI_COMPILER_TYPECHECK_H__ /** \file BLI_compiler_typecheck.h * \ingroup bli * * Type checking macros (often used to ensure valid use of macro args). * These depend on compiler extensions and c11 in some cases. */ /* Causes warning: * incompatible types when assigning to type 'Foo' from type 'Bar' * ... the compiler optimizes away the temp var */ #ifdef __GNUC__ #define CHECK_TYPE(var, type) { \ typeof(var) *__tmp; \ __tmp = (type *)NULL; \ (void)__tmp; \ } (void)0 #define CHECK_TYPE_PAIR(var_a, var_b) { \ typeof(var_a) *__tmp; \ __tmp = (typeof(var_b) *)NULL; \ (void)__tmp; \ } (void)0 #define CHECK_TYPE_PAIR_INLINE(var_a, var_b) ((void)({ \ typeof(var_a) *__tmp; \ __tmp = (typeof(var_b) *)NULL; \ (void)__tmp; \ })) #else # 54 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_compiler_typecheck.h" # define CHECK_TYPE(var, type) { EXPR_NOP(var); }(void)0 # define CHECK_TYPE_PAIR(var_a, var_b) { (EXPR_NOP(var_a), EXPR_NOP(var_b)); }(void)0 # define CHECK_TYPE_PAIR_INLINE(var_a, var_b) (EXPR_NOP(var_a), EXPR_NOP(var_b)) #endif # 58 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_compiler_typecheck.h" /* can be used in simple macros */ #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) # define CHECK_TYPE_INLINE(val, type) \ (void)((void)(((type)0) != (0 ? (val) : ((type)0))), \ _Generic((val), type: 0, const type: 0)) #else # 65 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_compiler_typecheck.h" # define CHECK_TYPE_INLINE(val, type) \ ((void)(((type)0) != (0 ? (val) : ((type)0)))) #endif # 68 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_compiler_typecheck.h" #if defined(__GNUC__) || defined(__clang__) # define CHECK_TYPE_NONCONST(var) __extension__ ({ \ void *non_const = 0 ? (var) : NULL; \ (void)non_const; \ }) #else # 75 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_compiler_typecheck.h" # define CHECK_TYPE_NONCONST(var) EXPR_NOP(var) #endif # 77 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_compiler_typecheck.h" /** * CHECK_TYPE_ANY: handy macro, eg: * ``CHECK_TYPE_ANY(var, Foo *, Bar *, Baz *)`` * * excuse ridiculously long generated args. * \code{.py} * for i in range(63): * args = [(chr(ord('a') + (c % 26)) + (chr(ord('0') + (c // 26)))) for c in range(i + 1)] * print("#define _VA_CHECK_TYPE_ANY%d(v, %s) \\" % (i + 2, ", ".join(args))) * print(" ((void)_Generic((v), %s))" % (": 0, ".join(args) + ": 0")) * \endcode */ #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) #define _VA_CHECK_TYPE_ANY2(v, a0) \ ((void)_Generic((v), a0: 0)) #define _VA_CHECK_TYPE_ANY3(v, a0, b0) \ ((void)_Generic((v), a0: 0, b0: 0)) #define _VA_CHECK_TYPE_ANY4(v, a0, b0, c0) \ ((void)_Generic((v), a0: 0, b0: 0, c0: 0)) #define _VA_CHECK_TYPE_ANY5(v, a0, b0, c0, d0) \ ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0)) #define _VA_CHECK_TYPE_ANY6(v, a0, b0, c0, d0, e0) \ ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0)) #define _VA_CHECK_TYPE_ANY7(v, a0, b0, c0, d0, e0, f0) \ ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0)) #define _VA_CHECK_TYPE_ANY8(v, a0, b0, c0, d0, e0, f0, g0) \ ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0)) #define _VA_CHECK_TYPE_ANY9(v, a0, b0, c0, d0, e0, f0, g0, h0) \ ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0)) #define _VA_CHECK_TYPE_ANY10(v, a0, b0, c0, d0, e0, f0, g0, h0, i0) \ ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0)) #define _VA_CHECK_TYPE_ANY11(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0) \ ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0)) #define _VA_CHECK_TYPE_ANY12(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0) \ ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0)) #define _VA_CHECK_TYPE_ANY13(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0) \ ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0)) #define _VA_CHECK_TYPE_ANY14(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0) \ ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0)) #define _VA_CHECK_TYPE_ANY15(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0) \ ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ n0: 0)) #define _VA_CHECK_TYPE_ANY16(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0) \ ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ n0: 0, o0: 0)) #define _VA_CHECK_TYPE_ANY17(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0) \ ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ n0: 0, o0: 0, p0: 0)) #define _VA_CHECK_TYPE_ANY18(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0) \ ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ n0: 0, o0: 0, p0: 0, q0: 0)) #define _VA_CHECK_TYPE_ANY19(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0) \ ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ n0: 0, o0: 0, p0: 0, q0: 0, r0: 0)) #define _VA_CHECK_TYPE_ANY20(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0) \ ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0)) #define _VA_CHECK_TYPE_ANY21(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0) \ ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0)) #define _VA_CHECK_TYPE_ANY22(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0) \ ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0)) #define _VA_CHECK_TYPE_ANY23(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \ v0) \ ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0)) #define _VA_CHECK_TYPE_ANY24(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \ v0, w0) \ ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0)) #define _VA_CHECK_TYPE_ANY25(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \ v0, w0, x0) \ ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0)) #define _VA_CHECK_TYPE_ANY26(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \ v0, w0, x0, y0) \ ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0)) #define _VA_CHECK_TYPE_ANY27(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \ v0, w0, x0, y0, z0) \ ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0)) #define _VA_CHECK_TYPE_ANY28(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \ v0, w0, x0, y0, z0, a1) \ ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0)) #define _VA_CHECK_TYPE_ANY29(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \ v0, w0, x0, y0, z0, a1, b1) \ ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0)) #define _VA_CHECK_TYPE_ANY30(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \ v0, w0, x0, y0, z0, a1, b1, c1) \ ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0)) #define _VA_CHECK_TYPE_ANY31(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \ v0, w0, x0, y0, z0, a1, b1, c1, d1) \ ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \ d1: 0)) #define _VA_CHECK_TYPE_ANY32(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \ v0, w0, x0, y0, z0, a1, b1, c1, d1, e1) \ ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \ d1: 0, e1: 0)) #define _VA_CHECK_TYPE_ANY33(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \ v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1) \ ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \ d1: 0, e1: 0, f1: 0)) #define _VA_CHECK_TYPE_ANY34(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \ v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1) \ ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \ d1: 0, e1: 0, f1: 0, g1: 0)) #define _VA_CHECK_TYPE_ANY35(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \ v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1) \ ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \ d1: 0, e1: 0, f1: 0, g1: 0, h1: 0)) #define _VA_CHECK_TYPE_ANY36(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \ v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1) \ ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \ d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0)) #define _VA_CHECK_TYPE_ANY37(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \ v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1) \ ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \ d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0, j1: 0)) #define _VA_CHECK_TYPE_ANY38(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \ v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1) \ ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \ d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0, j1: 0, k1: 0)) #define _VA_CHECK_TYPE_ANY39(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \ v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1) \ ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \ d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0, j1: 0, k1: 0, l1: 0)) #define _VA_CHECK_TYPE_ANY40(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \ v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1) \ ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \ d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0, j1: 0, k1: 0, l1: 0, m1: 0)) #define _VA_CHECK_TYPE_ANY41(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \ v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1) \ ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \ d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0, j1: 0, k1: 0, l1: 0, m1: 0, n1: 0)) #define _VA_CHECK_TYPE_ANY42(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \ v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1) \ ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \ d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0, j1: 0, k1: 0, l1: 0, m1: 0, n1: 0, o1: 0)) #define _VA_CHECK_TYPE_ANY43(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \ v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1) \ ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \ d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0, j1: 0, k1: 0, l1: 0, m1: 0, n1: 0, o1: 0, p1: 0)) #define _VA_CHECK_TYPE_ANY44(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \ v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1) \ ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \ d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0, j1: 0, k1: 0, l1: 0, m1: 0, n1: 0, o1: 0, p1: 0, q1: 0)) #define _VA_CHECK_TYPE_ANY45(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \ v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1) \ ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \ d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0, j1: 0, k1: 0, l1: 0, m1: 0, n1: 0, o1: 0, p1: 0, q1: 0, r1: 0)) #define _VA_CHECK_TYPE_ANY46(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \ v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1) \ ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \ d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0, j1: 0, k1: 0, l1: 0, m1: 0, n1: 0, o1: 0, p1: 0, q1: 0, r1: 0, s1: 0)) #define _VA_CHECK_TYPE_ANY47(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \ v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1) \ ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \ d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0, j1: 0, k1: 0, l1: 0, m1: 0, n1: 0, o1: 0, p1: 0, q1: 0, r1: 0, s1: 0, \ t1: 0)) #define _VA_CHECK_TYPE_ANY48(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \ v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1) \ ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \ d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0, j1: 0, k1: 0, l1: 0, m1: 0, n1: 0, o1: 0, p1: 0, q1: 0, r1: 0, s1: 0, \ t1: 0, u1: 0)) #define _VA_CHECK_TYPE_ANY49(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \ v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1) \ ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \ d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0, j1: 0, k1: 0, l1: 0, m1: 0, n1: 0, o1: 0, p1: 0, q1: 0, r1: 0, s1: 0, \ t1: 0, u1: 0, v1: 0)) #define _VA_CHECK_TYPE_ANY50(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \ v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, w1) \ ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \ d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0, j1: 0, k1: 0, l1: 0, m1: 0, n1: 0, o1: 0, p1: 0, q1: 0, r1: 0, s1: 0, \ t1: 0, u1: 0, v1: 0, w1: 0)) #define _VA_CHECK_TYPE_ANY51(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \ v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, w1, \ x1) \ ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \ d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0, j1: 0, k1: 0, l1: 0, m1: 0, n1: 0, o1: 0, p1: 0, q1: 0, r1: 0, s1: 0, \ t1: 0, u1: 0, v1: 0, w1: 0, x1: 0)) #define _VA_CHECK_TYPE_ANY52(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \ v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, w1, \ x1, y1) \ ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \ d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0, j1: 0, k1: 0, l1: 0, m1: 0, n1: 0, o1: 0, p1: 0, q1: 0, r1: 0, s1: 0, \ t1: 0, u1: 0, v1: 0, w1: 0, x1: 0, y1: 0)) #define _VA_CHECK_TYPE_ANY53(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \ v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, w1, \ x1, y1, z1) \ ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \ d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0, j1: 0, k1: 0, l1: 0, m1: 0, n1: 0, o1: 0, p1: 0, q1: 0, r1: 0, s1: 0, \ t1: 0, u1: 0, v1: 0, w1: 0, x1: 0, y1: 0, z1: 0)) #define _VA_CHECK_TYPE_ANY54(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \ v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, w1, \ x1, y1, z1, a2) \ ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \ d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0, j1: 0, k1: 0, l1: 0, m1: 0, n1: 0, o1: 0, p1: 0, q1: 0, r1: 0, s1: 0, \ t1: 0, u1: 0, v1: 0, w1: 0, x1: 0, y1: 0, z1: 0, a2: 0)) #define _VA_CHECK_TYPE_ANY55(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \ v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, w1, \ x1, y1, z1, a2, b2) \ ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \ d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0, j1: 0, k1: 0, l1: 0, m1: 0, n1: 0, o1: 0, p1: 0, q1: 0, r1: 0, s1: 0, \ t1: 0, u1: 0, v1: 0, w1: 0, x1: 0, y1: 0, z1: 0, a2: 0, b2: 0)) #define _VA_CHECK_TYPE_ANY56(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \ v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, w1, \ x1, y1, z1, a2, b2, c2) \ ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \ d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0, j1: 0, k1: 0, l1: 0, m1: 0, n1: 0, o1: 0, p1: 0, q1: 0, r1: 0, s1: 0, \ t1: 0, u1: 0, v1: 0, w1: 0, x1: 0, y1: 0, z1: 0, a2: 0, b2: 0, c2: 0)) #define _VA_CHECK_TYPE_ANY57(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \ v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, w1, \ x1, y1, z1, a2, b2, c2, d2) \ ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \ d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0, j1: 0, k1: 0, l1: 0, m1: 0, n1: 0, o1: 0, p1: 0, q1: 0, r1: 0, s1: 0, \ t1: 0, u1: 0, v1: 0, w1: 0, x1: 0, y1: 0, z1: 0, a2: 0, b2: 0, c2: 0, d2: 0)) #define _VA_CHECK_TYPE_ANY58(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \ v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, w1, \ x1, y1, z1, a2, b2, c2, d2, e2) \ ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \ d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0, j1: 0, k1: 0, l1: 0, m1: 0, n1: 0, o1: 0, p1: 0, q1: 0, r1: 0, s1: 0, \ t1: 0, u1: 0, v1: 0, w1: 0, x1: 0, y1: 0, z1: 0, a2: 0, b2: 0, c2: 0, d2: 0, e2: 0)) #define _VA_CHECK_TYPE_ANY59(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \ v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, w1, \ x1, y1, z1, a2, b2, c2, d2, e2, f2) \ ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \ d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0, j1: 0, k1: 0, l1: 0, m1: 0, n1: 0, o1: 0, p1: 0, q1: 0, r1: 0, s1: 0, \ t1: 0, u1: 0, v1: 0, w1: 0, x1: 0, y1: 0, z1: 0, a2: 0, b2: 0, c2: 0, d2: 0, e2: 0, f2: 0)) #define _VA_CHECK_TYPE_ANY60(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \ v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, w1, \ x1, y1, z1, a2, b2, c2, d2, e2, f2, g2) \ ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \ d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0, j1: 0, k1: 0, l1: 0, m1: 0, n1: 0, o1: 0, p1: 0, q1: 0, r1: 0, s1: 0, \ t1: 0, u1: 0, v1: 0, w1: 0, x1: 0, y1: 0, z1: 0, a2: 0, b2: 0, c2: 0, d2: 0, e2: 0, f2: 0, g2: 0)) #define _VA_CHECK_TYPE_ANY61(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \ v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, w1, \ x1, y1, z1, a2, b2, c2, d2, e2, f2, g2, h2) \ ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \ d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0, j1: 0, k1: 0, l1: 0, m1: 0, n1: 0, o1: 0, p1: 0, q1: 0, r1: 0, s1: 0, \ t1: 0, u1: 0, v1: 0, w1: 0, x1: 0, y1: 0, z1: 0, a2: 0, b2: 0, c2: 0, d2: 0, e2: 0, f2: 0, g2: 0, h2: 0)) #define _VA_CHECK_TYPE_ANY62(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \ v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, w1, \ x1, y1, z1, a2, b2, c2, d2, e2, f2, g2, h2, i2) \ ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \ d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0, j1: 0, k1: 0, l1: 0, m1: 0, n1: 0, o1: 0, p1: 0, q1: 0, r1: 0, s1: 0, \ t1: 0, u1: 0, v1: 0, w1: 0, x1: 0, y1: 0, z1: 0, a2: 0, b2: 0, c2: 0, d2: 0, e2: 0, f2: 0, g2: 0, h2: 0, i2: 0)) #define _VA_CHECK_TYPE_ANY63(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \ v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, w1, \ x1, y1, z1, a2, b2, c2, d2, e2, f2, g2, h2, i2, j2) \ ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \ d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0, j1: 0, k1: 0, l1: 0, m1: 0, n1: 0, o1: 0, p1: 0, q1: 0, r1: 0, s1: 0, \ t1: 0, u1: 0, v1: 0, w1: 0, x1: 0, y1: 0, z1: 0, a2: 0, b2: 0, c2: 0, d2: 0, e2: 0, f2: 0, g2: 0, h2: 0, i2: 0, \ j2: 0)) #define _VA_CHECK_TYPE_ANY64(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \ v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, w1, \ x1, y1, z1, a2, b2, c2, d2, e2, f2, g2, h2, i2, j2, k2) \ ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \ d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0, j1: 0, k1: 0, l1: 0, m1: 0, n1: 0, o1: 0, p1: 0, q1: 0, r1: 0, s1: 0, \ t1: 0, u1: 0, v1: 0, w1: 0, x1: 0, y1: 0, z1: 0, a2: 0, b2: 0, c2: 0, d2: 0, e2: 0, f2: 0, g2: 0, h2: 0, i2: 0, \ j2: 0, k2: 0)) # define CHECK_TYPE_ANY(...) VA_NARGS_CALL_OVERLOAD(_VA_CHECK_TYPE_ANY, __VA_ARGS__) #else # 381 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_compiler_typecheck.h" # define CHECK_TYPE_ANY(...) (void)0 #endif # 383 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_compiler_typecheck.h" /** * GENERIC_TYPE_ANY: handy macro to reuse a single expression for multiple types, eg: * * \code{.c} * _Generic(value, * GENERIC_TYPE_ANY(result_a, Foo *, Bar *, Baz *), * GENERIC_TYPE_ANY(result_b, Spam *, Spaz *, Spot *), * ) * \endcode * * excuse ridiculously long generated args. * \code{.py} * for i in range(63): * args = [(chr(ord('a') + (c % 26)) + (chr(ord('0') + (c // 26)))) for c in range(i + 1)] * print("#define _VA_GENERIC_TYPE_ANY%d(r, %s) \\" % (i + 2, ", ".join(args))) * print(" %s: r " % (": r, ".join(args))) * \endcode */ #define _VA_GENERIC_TYPE_ANY2(r, a0) \ a0: r #define _VA_GENERIC_TYPE_ANY3(r, a0, b0) \ a0: r, b0: r #define _VA_GENERIC_TYPE_ANY4(r, a0, b0, c0) \ a0: r, b0: r, c0: r #define _VA_GENERIC_TYPE_ANY5(r, a0, b0, c0, d0) \ a0: r, b0: r, c0: r, d0: r #define _VA_GENERIC_TYPE_ANY6(r, a0, b0, c0, d0, e0) \ a0: r, b0: r, c0: r, d0: r, e0: r #define _VA_GENERIC_TYPE_ANY7(r, a0, b0, c0, d0, e0, f0) \ a0: r, b0: r, c0: r, d0: r, e0: r, f0: r #define _VA_GENERIC_TYPE_ANY8(r, a0, b0, c0, d0, e0, f0, g0) \ a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r #define _VA_GENERIC_TYPE_ANY9(r, a0, b0, c0, d0, e0, f0, g0, h0) \ a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r #define _VA_GENERIC_TYPE_ANY10(r, a0, b0, c0, d0, e0, f0, g0, h0, i0) \ a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r #define _VA_GENERIC_TYPE_ANY11(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0) \ a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r #define _VA_GENERIC_TYPE_ANY12(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0) \ a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r #define _VA_GENERIC_TYPE_ANY13(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0) \ a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r #define _VA_GENERIC_TYPE_ANY14(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0) \ a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r #define _VA_GENERIC_TYPE_ANY15(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0) \ a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r #define _VA_GENERIC_TYPE_ANY16(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0) \ a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r #define _VA_GENERIC_TYPE_ANY17(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0) \ a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r #define _VA_GENERIC_TYPE_ANY18(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0) \ a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \ q0: r #define _VA_GENERIC_TYPE_ANY19(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0) \ a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \ q0: r, r0: r #define _VA_GENERIC_TYPE_ANY20(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0) \ a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \ q0: r, r0: r, s0: r #define _VA_GENERIC_TYPE_ANY21(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0) \ a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \ q0: r, r0: r, s0: r, t0: r #define _VA_GENERIC_TYPE_ANY22(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \ u0) \ a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \ q0: r, r0: r, s0: r, t0: r, u0: r #define _VA_GENERIC_TYPE_ANY23(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \ u0, v0) \ a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \ q0: r, r0: r, s0: r, t0: r, u0: r, v0: r #define _VA_GENERIC_TYPE_ANY24(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \ u0, v0, w0) \ a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \ q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r #define _VA_GENERIC_TYPE_ANY25(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \ u0, v0, w0, x0) \ a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \ q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r #define _VA_GENERIC_TYPE_ANY26(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \ u0, v0, w0, x0, y0) \ a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \ q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r #define _VA_GENERIC_TYPE_ANY27(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \ u0, v0, w0, x0, y0, z0) \ a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \ q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r #define _VA_GENERIC_TYPE_ANY28(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \ u0, v0, w0, x0, y0, z0, a1) \ a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \ q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r #define _VA_GENERIC_TYPE_ANY29(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \ u0, v0, w0, x0, y0, z0, a1, b1) \ a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \ q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r #define _VA_GENERIC_TYPE_ANY30(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \ u0, v0, w0, x0, y0, z0, a1, b1, c1) \ a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \ q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r #define _VA_GENERIC_TYPE_ANY31(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \ u0, v0, w0, x0, y0, z0, a1, b1, c1, d1) \ a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \ q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r #define _VA_GENERIC_TYPE_ANY32(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \ u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1) \ a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \ q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r #define _VA_GENERIC_TYPE_ANY33(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \ u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1) \ a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \ q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r #define _VA_GENERIC_TYPE_ANY34(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \ u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1) \ a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \ q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \ g1: r #define _VA_GENERIC_TYPE_ANY35(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \ u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1) \ a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \ q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \ g1: r, h1: r #define _VA_GENERIC_TYPE_ANY36(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \ u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1) \ a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \ q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \ g1: r, h1: r, i1: r #define _VA_GENERIC_TYPE_ANY37(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \ u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1) \ a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \ q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \ g1: r, h1: r, i1: r, j1: r #define _VA_GENERIC_TYPE_ANY38(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \ u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1) \ a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \ q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \ g1: r, h1: r, i1: r, j1: r, k1: r #define _VA_GENERIC_TYPE_ANY39(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \ u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1) \ a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \ q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \ g1: r, h1: r, i1: r, j1: r, k1: r, l1: r #define _VA_GENERIC_TYPE_ANY40(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \ u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1) \ a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \ q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \ g1: r, h1: r, i1: r, j1: r, k1: r, l1: r, m1: r #define _VA_GENERIC_TYPE_ANY41(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \ u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1) \ a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \ q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \ g1: r, h1: r, i1: r, j1: r, k1: r, l1: r, m1: r, n1: r #define _VA_GENERIC_TYPE_ANY42(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \ u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1) \ a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \ q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \ g1: r, h1: r, i1: r, j1: r, k1: r, l1: r, m1: r, n1: r, o1: r #define _VA_GENERIC_TYPE_ANY43(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \ u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1) \ a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \ q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \ g1: r, h1: r, i1: r, j1: r, k1: r, l1: r, m1: r, n1: r, o1: r, p1: r #define _VA_GENERIC_TYPE_ANY44(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \ u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1) \ a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \ q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \ g1: r, h1: r, i1: r, j1: r, k1: r, l1: r, m1: r, n1: r, o1: r, p1: r, q1: r #define _VA_GENERIC_TYPE_ANY45(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \ u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1) \ a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \ q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \ g1: r, h1: r, i1: r, j1: r, k1: r, l1: r, m1: r, n1: r, o1: r, p1: r, q1: r, r1: r #define _VA_GENERIC_TYPE_ANY46(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \ u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1) \ a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \ q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \ g1: r, h1: r, i1: r, j1: r, k1: r, l1: r, m1: r, n1: r, o1: r, p1: r, q1: r, r1: r, s1: r #define _VA_GENERIC_TYPE_ANY47(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \ u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1) \ a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \ q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \ g1: r, h1: r, i1: r, j1: r, k1: r, l1: r, m1: r, n1: r, o1: r, p1: r, q1: r, r1: r, s1: r, t1: r #define _VA_GENERIC_TYPE_ANY48(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \ u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1) \ a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \ q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \ g1: r, h1: r, i1: r, j1: r, k1: r, l1: r, m1: r, n1: r, o1: r, p1: r, q1: r, r1: r, s1: r, t1: r, u1: r #define _VA_GENERIC_TYPE_ANY49(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \ u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1) \ a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \ q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \ g1: r, h1: r, i1: r, j1: r, k1: r, l1: r, m1: r, n1: r, o1: r, p1: r, q1: r, r1: r, s1: r, t1: r, u1: r, v1: r #define _VA_GENERIC_TYPE_ANY50(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \ u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, \ w1) \ a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \ q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \ g1: r, h1: r, i1: r, j1: r, k1: r, l1: r, m1: r, n1: r, o1: r, p1: r, q1: r, r1: r, s1: r, t1: r, u1: r, v1: r, \ w1: r #define _VA_GENERIC_TYPE_ANY51(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \ u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, \ w1, x1) \ a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \ q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \ g1: r, h1: r, i1: r, j1: r, k1: r, l1: r, m1: r, n1: r, o1: r, p1: r, q1: r, r1: r, s1: r, t1: r, u1: r, v1: r, \ w1: r, x1: r #define _VA_GENERIC_TYPE_ANY52(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \ u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, \ w1, x1, y1) \ a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \ q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \ g1: r, h1: r, i1: r, j1: r, k1: r, l1: r, m1: r, n1: r, o1: r, p1: r, q1: r, r1: r, s1: r, t1: r, u1: r, v1: r, \ w1: r, x1: r, y1: r #define _VA_GENERIC_TYPE_ANY53(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \ u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, \ w1, x1, y1, z1) \ a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \ q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \ g1: r, h1: r, i1: r, j1: r, k1: r, l1: r, m1: r, n1: r, o1: r, p1: r, q1: r, r1: r, s1: r, t1: r, u1: r, v1: r, \ w1: r, x1: r, y1: r, z1: r #define _VA_GENERIC_TYPE_ANY54(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \ u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, \ w1, x1, y1, z1, a2) \ a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \ q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \ g1: r, h1: r, i1: r, j1: r, k1: r, l1: r, m1: r, n1: r, o1: r, p1: r, q1: r, r1: r, s1: r, t1: r, u1: r, v1: r, \ w1: r, x1: r, y1: r, z1: r, a2: r #define _VA_GENERIC_TYPE_ANY55(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \ u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, \ w1, x1, y1, z1, a2, b2) \ a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \ q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \ g1: r, h1: r, i1: r, j1: r, k1: r, l1: r, m1: r, n1: r, o1: r, p1: r, q1: r, r1: r, s1: r, t1: r, u1: r, v1: r, \ w1: r, x1: r, y1: r, z1: r, a2: r, b2: r #define _VA_GENERIC_TYPE_ANY56(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \ u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, \ w1, x1, y1, z1, a2, b2, c2) \ a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \ q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \ g1: r, h1: r, i1: r, j1: r, k1: r, l1: r, m1: r, n1: r, o1: r, p1: r, q1: r, r1: r, s1: r, t1: r, u1: r, v1: r, \ w1: r, x1: r, y1: r, z1: r, a2: r, b2: r, c2: r #define _VA_GENERIC_TYPE_ANY57(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \ u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, \ w1, x1, y1, z1, a2, b2, c2, d2) \ a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \ q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \ g1: r, h1: r, i1: r, j1: r, k1: r, l1: r, m1: r, n1: r, o1: r, p1: r, q1: r, r1: r, s1: r, t1: r, u1: r, v1: r, \ w1: r, x1: r, y1: r, z1: r, a2: r, b2: r, c2: r, d2: r #define _VA_GENERIC_TYPE_ANY58(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \ u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, \ w1, x1, y1, z1, a2, b2, c2, d2, e2) \ a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \ q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \ g1: r, h1: r, i1: r, j1: r, k1: r, l1: r, m1: r, n1: r, o1: r, p1: r, q1: r, r1: r, s1: r, t1: r, u1: r, v1: r, \ w1: r, x1: r, y1: r, z1: r, a2: r, b2: r, c2: r, d2: r, e2: r #define _VA_GENERIC_TYPE_ANY59(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \ u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, \ w1, x1, y1, z1, a2, b2, c2, d2, e2, f2) \ a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \ q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \ g1: r, h1: r, i1: r, j1: r, k1: r, l1: r, m1: r, n1: r, o1: r, p1: r, q1: r, r1: r, s1: r, t1: r, u1: r, v1: r, \ w1: r, x1: r, y1: r, z1: r, a2: r, b2: r, c2: r, d2: r, e2: r, f2: r #define _VA_GENERIC_TYPE_ANY60(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \ u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, \ w1, x1, y1, z1, a2, b2, c2, d2, e2, f2, g2) \ a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \ q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \ g1: r, h1: r, i1: r, j1: r, k1: r, l1: r, m1: r, n1: r, o1: r, p1: r, q1: r, r1: r, s1: r, t1: r, u1: r, v1: r, \ w1: r, x1: r, y1: r, z1: r, a2: r, b2: r, c2: r, d2: r, e2: r, f2: r, g2: r #define _VA_GENERIC_TYPE_ANY61(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \ u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, \ w1, x1, y1, z1, a2, b2, c2, d2, e2, f2, g2, h2) \ a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \ q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \ g1: r, h1: r, i1: r, j1: r, k1: r, l1: r, m1: r, n1: r, o1: r, p1: r, q1: r, r1: r, s1: r, t1: r, u1: r, v1: r, \ w1: r, x1: r, y1: r, z1: r, a2: r, b2: r, c2: r, d2: r, e2: r, f2: r, g2: r, h2: r #define _VA_GENERIC_TYPE_ANY62(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \ u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, \ w1, x1, y1, z1, a2, b2, c2, d2, e2, f2, g2, h2, i2) \ a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \ q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \ g1: r, h1: r, i1: r, j1: r, k1: r, l1: r, m1: r, n1: r, o1: r, p1: r, q1: r, r1: r, s1: r, t1: r, u1: r, v1: r, \ w1: r, x1: r, y1: r, z1: r, a2: r, b2: r, c2: r, d2: r, e2: r, f2: r, g2: r, h2: r, i2: r #define _VA_GENERIC_TYPE_ANY63(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \ u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, \ w1, x1, y1, z1, a2, b2, c2, d2, e2, f2, g2, h2, i2, j2) \ a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \ q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \ g1: r, h1: r, i1: r, j1: r, k1: r, l1: r, m1: r, n1: r, o1: r, p1: r, q1: r, r1: r, s1: r, t1: r, u1: r, v1: r, \ w1: r, x1: r, y1: r, z1: r, a2: r, b2: r, c2: r, d2: r, e2: r, f2: r, g2: r, h2: r, i2: r, j2: r #define _VA_GENERIC_TYPE_ANY64(r, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, \ u0, v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, \ w1, x1, y1, z1, a2, b2, c2, d2, e2, f2, g2, h2, i2, j2, k2) \ a0: r, b0: r, c0: r, d0: r, e0: r, f0: r, g0: r, h0: r, i0: r, j0: r, k0: r, l0: r, m0: r, n0: r, o0: r, p0: r, \ q0: r, r0: r, s0: r, t0: r, u0: r, v0: r, w0: r, x0: r, y0: r, z0: r, a1: r, b1: r, c1: r, d1: r, e1: r, f1: r, \ g1: r, h1: r, i1: r, j1: r, k1: r, l1: r, m1: r, n1: r, o1: r, p1: r, q1: r, r1: r, s1: r, t1: r, u1: r, v1: r, \ w1: r, x1: r, y1: r, z1: r, a2: r, b2: r, c2: r, d2: r, e2: r, f2: r, g2: r, h2: r, i2: r, j2: r, k2: r # define GENERIC_TYPE_ANY(...) VA_NARGS_CALL_OVERLOAD(_VA_GENERIC_TYPE_ANY, __VA_ARGS__) #endif /* __BLI_COMPILER_TYPECHECK_H__ */ # 684 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_compiler_typecheck.h" # 81 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_utildefines.h" 2 /* min/max */ #if defined(__GNUC__) || defined(__clang__) #define MIN2(a, b) __extension__ ({ \ typeof(a) a_ = (a); typeof(b) b_ = (b); \ ((a_) < (b_) ? (a_) : (b_)); }) #define MAX2(a, b) __extension__ ({ \ typeof(a) a_ = (a); typeof(b) b_ = (b); \ ((a_) > (b_) ? (a_) : (b_)); }) #define MIN3(a, b, c) __extension__ ({ \ typeof(a) a_ = (a); typeof(b) b_ = (b); typeof(c) c_ = (c); \ ((a_ < b_) ? ((a_ < c_) ? a_ : c_) : ((b_ < c_) ? b_ : c_)); }) #define MAX3(a, b, c) __extension__ ({ \ typeof(a) a_ = (a); typeof(b) b_ = (b); typeof(c) c_ = (c); \ ((a_ > b_) ? ((a_ > c_) ? a_ : c_) : ((b_ > c_) ? b_ : c_)); }) #define MIN4(a, b, c, d) __extension__ ({ \ typeof(a) a_ = (a); typeof(b) b_ = (b); typeof(c) c_ = (c); typeof(d) d_ = (d); \ ((a_ < b_) ? ((a_ < c_) ? ((a_ < d_) ? a_ : d_) : ((c_ < d_) ? c_ : d_)) : \ ((b_ < c_) ? ((b_ < d_) ? b_ : d_) : ((c_ < d_) ? c_ : d_))); }) #define MAX4(a, b, c, d) __extension__ ({ \ typeof(a) a_ = (a); typeof(b) b_ = (b); typeof(c) c_ = (c); typeof(d) d_ = (d); \ ((a_ > b_) ? ((a_ > c_) ? ((a_ > d_) ? a_ : d_) : ((c_ > d_) ? c_ : d_)) : \ ((b_ > c_) ? ((b_ > d_) ? b_ : d_) : ((c_ > d_) ? c_ : d_))); }) #else # 112 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_utildefines.h" #define MIN2(a, b) ((a) < (b) ? (a) : (b)) #define MAX2(a, b) ((a) > (b) ? (a) : (b)) #define MIN3(a, b, c) (MIN2(MIN2((a), (b)), (c))) #define MIN4(a, b, c, d) (MIN2(MIN2((a), (b)), MIN2((c), (d)))) #define MAX3(a, b, c) (MAX2(MAX2((a), (b)), (c))) #define MAX4(a, b, c, d) (MAX2(MAX2((a), (b)), MAX2((c), (d)))) #endif # 121 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_utildefines.h" /* min/max that return a value of our choice */ #define MAX3_PAIR(cmp_a, cmp_b, cmp_c, ret_a, ret_b, ret_c) \ ((cmp_a > cmp_b) ? ((cmp_a > cmp_c) ? ret_a : ret_c) : \ ((cmp_b > cmp_c) ? ret_b : ret_c)) #define MIN3_PAIR(cmp_a, cmp_b, cmp_c, ret_a, ret_b, ret_c) \ ((cmp_a < cmp_b) ? ((cmp_a < cmp_c) ? ret_a : ret_c) : \ ((cmp_b < cmp_c) ? ret_b : ret_c)) #define INIT_MINMAX(min, max) { \ (min)[0] = (min)[1] = (min)[2] = 1.0e30f; \ (max)[0] = (max)[1] = (max)[2] = -1.0e30f; \ } (void)0 #define INIT_MINMAX2(min, max) { \ (min)[0] = (min)[1] = 1.0e30f; \ (max)[0] = (max)[1] = -1.0e30f; \ } (void)0 #define DO_MIN(vec, min) { \ if ((min)[0] > (vec)[0]) (min)[0] = (vec)[0]; \ if ((min)[1] > (vec)[1]) (min)[1] = (vec)[1]; \ if ((min)[2] > (vec)[2]) (min)[2] = (vec)[2]; \ } (void)0 #define DO_MAX(vec, max) { \ if ((max)[0] < (vec)[0]) (max)[0] = (vec)[0]; \ if ((max)[1] < (vec)[1]) (max)[1] = (vec)[1]; \ if ((max)[2] < (vec)[2]) (max)[2] = (vec)[2]; \ } (void)0 #define DO_MINMAX(vec, min, max) { \ if ((min)[0] > (vec)[0] ) (min)[0] = (vec)[0]; \ if ((min)[1] > (vec)[1] ) (min)[1] = (vec)[1]; \ if ((min)[2] > (vec)[2] ) (min)[2] = (vec)[2]; \ if ((max)[0] < (vec)[0] ) (max)[0] = (vec)[0]; \ if ((max)[1] < (vec)[1] ) (max)[1] = (vec)[1]; \ if ((max)[2] < (vec)[2] ) (max)[2] = (vec)[2]; \ } (void)0 #define DO_MINMAX2(vec, min, max) { \ if ((min)[0] > (vec)[0] ) (min)[0] = (vec)[0]; \ if ((min)[1] > (vec)[1] ) (min)[1] = (vec)[1]; \ if ((max)[0] < (vec)[0] ) (max)[0] = (vec)[0]; \ if ((max)[1] < (vec)[1] ) (max)[1] = (vec)[1]; \ } (void)0 /* some math and copy defines */ #define SWAP(type, a, b) { \ type sw_ap; \ CHECK_TYPE(a, type); \ CHECK_TYPE(b, type); \ sw_ap = (a); \ (a) = (b); \ (b) = sw_ap; \ } (void)0 /* swap with a temp value */ #define SWAP_TVAL(tval, a, b) { \ CHECK_TYPE_PAIR(tval, a); \ CHECK_TYPE_PAIR(tval, b); \ (tval) = (a); \ (a) = (b); \ (b) = (tval); \ } (void)0 /* ELEM#(v, ...): is the first arg equal any others? */ /* internal helpers*/ #define _VA_ELEM2(v, a) \ ((v) == (a)) #define _VA_ELEM3(v, a, b) \ (_VA_ELEM2(v, a) || ((v) == (b))) #define _VA_ELEM4(v, a, b, c) \ (_VA_ELEM3(v, a, b) || ((v) == (c))) #define _VA_ELEM5(v, a, b, c, d) \ (_VA_ELEM4(v, a, b, c) || ((v) == (d))) #define _VA_ELEM6(v, a, b, c, d, e) \ (_VA_ELEM5(v, a, b, c, d) || ((v) == (e))) #define _VA_ELEM7(v, a, b, c, d, e, f) \ (_VA_ELEM6(v, a, b, c, d, e) || ((v) == (f))) #define _VA_ELEM8(v, a, b, c, d, e, f, g) \ (_VA_ELEM7(v, a, b, c, d, e, f) || ((v) == (g))) #define _VA_ELEM9(v, a, b, c, d, e, f, g, h) \ (_VA_ELEM8(v, a, b, c, d, e, f, g) || ((v) == (h))) #define _VA_ELEM10(v, a, b, c, d, e, f, g, h, i) \ (_VA_ELEM9(v, a, b, c, d, e, f, g, h) || ((v) == (i))) #define _VA_ELEM11(v, a, b, c, d, e, f, g, h, i, j) \ (_VA_ELEM10(v, a, b, c, d, e, f, g, h, i) || ((v) == (j))) #define _VA_ELEM12(v, a, b, c, d, e, f, g, h, i, j, k) \ (_VA_ELEM11(v, a, b, c, d, e, f, g, h, i, j) || ((v) == (k))) #define _VA_ELEM13(v, a, b, c, d, e, f, g, h, i, j, k, l) \ (_VA_ELEM12(v, a, b, c, d, e, f, g, h, i, j, k) || ((v) == (l))) #define _VA_ELEM14(v, a, b, c, d, e, f, g, h, i, j, k, l, m) \ (_VA_ELEM13(v, a, b, c, d, e, f, g, h, i, j, k, l) || ((v) == (m))) #define _VA_ELEM15(v, a, b, c, d, e, f, g, h, i, j, k, l, m, n) \ (_VA_ELEM14(v, a, b, c, d, e, f, g, h, i, j, k, l, m) || ((v) == (n))) #define _VA_ELEM16(v, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) \ (_VA_ELEM15(v, a, b, c, d, e, f, g, h, i, j, k, l, m, n) || ((v) == (o))) #define _VA_ELEM17(v, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) \ (_VA_ELEM16(v, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) || ((v) == (p))) /* reusable ELEM macro */ #define ELEM(...) VA_NARGS_CALL_OVERLOAD(_VA_ELEM, __VA_ARGS__) /* no-op for expressions we don't want to instansiate, but must remian valid */ #define EXPR_NOP(expr) (void)(0 ? ((void)(expr), 1) : 0) /* shift around elements */ #define SHIFT3(type, a, b, c) { \ type tmp; \ CHECK_TYPE(a, type); \ CHECK_TYPE(b, type); \ CHECK_TYPE(c, type); \ tmp = a; \ a = c; \ c = b; \ b = tmp; \ } (void)0 #define SHIFT4(type, a, b, c, d) { \ type tmp; \ CHECK_TYPE(a, type); \ CHECK_TYPE(b, type); \ CHECK_TYPE(c, type); \ CHECK_TYPE(d, type); \ tmp = a; \ a = d; \ d = c; \ c = b; \ b = tmp; \ } (void)0 #define FTOCHAR(val) ((CHECK_TYPE_INLINE(val, float)), \ (char)(((val) <= 0.0f) ? 0 : (((val) > (1.0f - 0.5f / 255.0f)) ? 255 : ((255.0f * (val)) + 0.5f)))) #define FTOUSHORT(val) ((CHECK_TYPE_INLINE(val, float)), \ (unsigned short)((val >= 1.0f - 0.5f / 65535) ? 65535 : (val <= 0.0f) ? 0 : (val * 65535.0f + 0.5f))) #define USHORTTOUCHAR(val) ((unsigned char)(((val) >= 65535 - 128) ? 255 : ((val) + 128) >> 8)) #define F3TOCHAR3(v2, v1) { \ (v1)[0] = FTOCHAR((v2[0])); \ (v1)[1] = FTOCHAR((v2[1])); \ (v1)[2] = FTOCHAR((v2[2])); \ } (void)0 #define F3TOCHAR4(v2, v1) { \ (v1)[0] = FTOCHAR((v2[0])); \ (v1)[1] = FTOCHAR((v2[1])); \ (v1)[2] = FTOCHAR((v2[2])); \ (v1)[3] = 255; \ } (void)0 #define F4TOCHAR4(v2, v1) { \ (v1)[0] = FTOCHAR((v2[0])); \ (v1)[1] = FTOCHAR((v2[1])); \ (v1)[2] = FTOCHAR((v2[2])); \ (v1)[3] = FTOCHAR((v2[3])); \ } (void)0 #define VECCOPY(v1, v2) { \ *(v1) = *(v2); \ *(v1 + 1) = *(v2 + 1); \ *(v1 + 2) = *(v2 + 2); \ } (void)0 #define VECCOPY2D(v1, v2) { \ *(v1) = *(v2); \ *(v1 + 1) = *(v2 + 1); \ } (void)0 #define VECADD(v1, v2, v3) { \ *(v1) = *(v2) + *(v3); \ *(v1 + 1) = *(v2 + 1) + *(v3 + 1); \ *(v1 + 2) = *(v2 + 2) + *(v3 + 2); \ } (void)0 #define VECSUB(v1, v2, v3) { \ *(v1) = *(v2) - *(v3); \ *(v1 + 1) = *(v2 + 1) - *(v3 + 1); \ *(v1 + 2) = *(v2 + 2) - *(v3 + 2); \ } (void)0 #define VECSUB2D(v1, v2, v3) { \ *(v1) = *(v2) - *(v3); \ *(v1 + 1) = *(v2 + 1) - *(v3 + 1); \ } (void)0 #define VECADDFAC(v1, v2, v3, fac) { \ *(v1) = *(v2) + *(v3) * (fac); \ *(v1 + 1) = *(v2 + 1) + *(v3 + 1) * (fac); \ *(v1 + 2) = *(v2 + 2) + *(v3 + 2) * (fac); \ } (void)0 #define VECMADD(v1, v2, v3, v4) { \ *(v1) = *(v2) + *(v3) * (*(v4)); \ *(v1 + 1) = *(v2 + 1) + *(v3 + 1) * (*(v4 + 1)); \ *(v1 + 2) = *(v2 + 2) + *(v3 + 2) * (*(v4 + 2)); \ } (void)0 #define VECSUBFAC(v1, v2, v3, fac) { \ *(v1) = *(v2) - *(v3) * (fac); \ *(v1 + 1) = *(v2 + 1) - *(v3 + 1) * (fac); \ *(v1 + 2) = *(v2 + 2) - *(v3 + 2) * (fac); \ } (void)0 /* some misc stuff.... */ /* avoid multiple access for supported compilers */ #if defined(__GNUC__) || defined(__clang__) #define ABS(a) ({ \ typeof(a) a_ = (a); \ ((a_) < 0 ? (-(a_)) : (a_)); }) #define SQUARE(a) ({ \ typeof(a) a_ = (a); \ ((a_) * (a_)); }) #else # 326 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_utildefines.h" #define ABS(a) ((a) < 0 ? (-(a)) : (a)) #define SQUARE(a) ((a) * (a)) #endif # 331 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_utildefines.h" #define CLAMPIS(a, b, c) ((a) < (b) ? (b) : (a) > (c) ? (c) : (a)) #define CLAMP(a, b, c) { \ if ((a) < (b)) (a) = (b); \ else if ((a) > (c)) (a) = (c); \ } (void)0 #define CLAMP_MAX(a, c) { \ if ((a) > (c)) (a) = (c); \ } (void)0 #define CLAMP_MIN(a, b) { \ if ((a) < (b)) (a) = (b); \ } (void)0 #define CLAMP2(vec, b, c) { \ CLAMP((vec)[0], b, c); \ CLAMP((vec)[1], b, c); \ } (void)0 #define CLAMP2_MIN(vec, b) { \ CLAMP_MIN((vec)[0], b); \ CLAMP_MIN((vec)[1], b); \ } (void)0 #define CLAMP2_MAX(vec, b) { \ CLAMP_MAX((vec)[0], b); \ CLAMP_MAX((vec)[1], b); \ } (void)0 #define CLAMP3(vec, b, c) { \ CLAMP((vec)[0], b, c); \ CLAMP((vec)[1], b, c); \ CLAMP((vec)[2], b, c); \ } (void)0 #define CLAMP3_MIN(vec, b) { \ CLAMP_MIN((vec)[0], b); \ CLAMP_MIN((vec)[1], b); \ CLAMP_MIN((vec)[2], b); \ } (void)0 #define CLAMP3_MAX(vec, b) { \ CLAMP_MAX((vec)[0], b); \ CLAMP_MAX((vec)[1], b); \ CLAMP_MAX((vec)[2], b); \ } (void)0 #define CLAMP4(vec, b, c) { \ CLAMP((vec)[0], b, c); \ CLAMP((vec)[1], b, c); \ CLAMP((vec)[2], b, c); \ CLAMP((vec)[3], b, c); \ } (void)0 #define CLAMP4_MIN(vec, b) { \ CLAMP_MIN((vec)[0], b); \ CLAMP_MIN((vec)[1], b); \ CLAMP_MIN((vec)[2], b); \ CLAMP_MIN((vec)[3], b); \ } (void)0 #define CLAMP4_MAX(vec, b) { \ CLAMP_MAX((vec)[0], b); \ CLAMP_MAX((vec)[1], b); \ CLAMP_MAX((vec)[2], b); \ CLAMP_MAX((vec)[3], b); \ } (void)0 #define IS_EQ(a, b) ( \ CHECK_TYPE_INLINE(a, double), CHECK_TYPE_INLINE(b, double), \ ((fabs((double)((a) - (b))) >= (double) FLT_EPSILON) ? false : true)) #define IS_EQF(a, b) ( \ CHECK_TYPE_INLINE(a, float), CHECK_TYPE_INLINE(b, float), \ ((fabsf((float)((a) - (b))) >= (float) FLT_EPSILON) ? false : true)) #define IS_EQT(a, b, c) ((a > b) ? (((a - b) <= c) ? 1 : 0) : ((((b - a) <= c) ? 1 : 0))) #define IN_RANGE(a, b, c) ((b < c) ? ((b < a && a < c) ? 1 : 0) : ((c < a && a < b) ? 1 : 0)) #define IN_RANGE_INCL(a, b, c) ((b < c) ? ((b <= a && a <= c) ? 1 : 0) : ((c <= a && a <= b) ? 1 : 0)) /* unpack vector for args */ #define UNPACK2(a) ((a)[0]), ((a)[1]) #define UNPACK3(a) UNPACK2(a), ((a)[2]) #define UNPACK4(a) UNPACK3(a), ((a)[3]) /* pre may be '&', '*' or func, post may be '->member' */ #define UNPACK2_EX(pre, a, post) (pre((a)[0])post), (pre((a)[1])post) #define UNPACK3_EX(pre, a, post) UNPACK2_EX(pre, a, post), (pre((a)[2])post) #define UNPACK4_EX(pre, a, post) UNPACK3_EX(pre, a, post), (pre((a)[3])post) /* array helpers */ #define ARRAY_LAST_ITEM(arr_start, arr_dtype, tot) \ (arr_dtype *)((char *)arr_start + (sizeof(*((arr_dtype *)NULL)) * (size_t)(tot - 1))) #define ARRAY_HAS_ITEM(arr_item, arr_start, tot) ( \ CHECK_TYPE_PAIR_INLINE(arr_start, arr_item), \ ((unsigned int)((arr_item) - (arr_start)) < (unsigned int)(tot))) #define ARRAY_DELETE(arr, index, tot_delete, tot) { \ BLI_assert(index + tot_delete <= tot); \ memmove(&(arr)[(index)], \ &(arr)[(index) + (tot_delete)], \ (((tot) - (index)) - (tot_delete)) * sizeof(*(arr))); \ } (void)0 /* assuming a static array */ #if defined(__GNUC__) && !defined(__cplusplus) && !defined(__clang__) # define ARRAY_SIZE(arr) \ ((sizeof(struct {int isnt_array : ((const void *)&(arr) == &(arr)[0]);}) * 0) + \ (sizeof(arr) / sizeof(*(arr)))) #else # 443 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_utildefines.h" # define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(*(arr))) #endif # 445 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_utildefines.h" /* ARRAY_SET_ITEMS#(v, ...): set indices of array 'v' */ /* internal helpers */ #define _VA_ARRAY_SET_ITEMS2(v, a) \ ((v)[0] = (a)) #define _VA_ARRAY_SET_ITEMS3(v, a, b) \ _VA_ARRAY_SET_ITEMS2(v, a); ((v)[1] = (b)) #define _VA_ARRAY_SET_ITEMS4(v, a, b, c) \ _VA_ARRAY_SET_ITEMS3(v, a, b); ((v)[2] = (c)) #define _VA_ARRAY_SET_ITEMS5(v, a, b, c, d) \ _VA_ARRAY_SET_ITEMS4(v, a, b, c); ((v)[3] = (d)) #define _VA_ARRAY_SET_ITEMS6(v, a, b, c, d, e) \ _VA_ARRAY_SET_ITEMS5(v, a, b, c, d); ((v)[4] = (e)) #define _VA_ARRAY_SET_ITEMS7(v, a, b, c, d, e, f) \ _VA_ARRAY_SET_ITEMS6(v, a, b, c, d, e); ((v)[5] = (f)) #define _VA_ARRAY_SET_ITEMS8(v, a, b, c, d, e, f, g) \ _VA_ARRAY_SET_ITEMS7(v, a, b, c, d, e, f); ((v)[6] = (g)) #define _VA_ARRAY_SET_ITEMS9(v, a, b, c, d, e, f, g, h) \ _VA_ARRAY_SET_ITEMS8(v, a, b, c, d, e, f, g); ((v)[7] = (h)) #define _VA_ARRAY_SET_ITEMS10(v, a, b, c, d, e, f, g, h, i) \ _VA_ARRAY_SET_ITEMS9(v, a, b, c, d, e, f, g, h); ((v)[8] = (i)) #define _VA_ARRAY_SET_ITEMS11(v, a, b, c, d, e, f, g, h, i, j) \ _VA_ARRAY_SET_ITEMS10(v, a, b, c, d, e, f, g, h, i); ((v)[9] = (j)) #define _VA_ARRAY_SET_ITEMS12(v, a, b, c, d, e, f, g, h, i, j, k) \ _VA_ARRAY_SET_ITEMS11(v, a, b, c, d, e, f, g, h, i, j); ((v)[10] = (k)) #define _VA_ARRAY_SET_ITEMS13(v, a, b, c, d, e, f, g, h, i, j, k, l) \ _VA_ARRAY_SET_ITEMS12(v, a, b, c, d, e, f, g, h, i, j, k); ((v)[11] = (l)) #define _VA_ARRAY_SET_ITEMS14(v, a, b, c, d, e, f, g, h, i, j, k, l, m) \ _VA_ARRAY_SET_ITEMS13(v, a, b, c, d, e, f, g, h, i, j, k, l); ((v)[12] = (m)) #define _VA_ARRAY_SET_ITEMS15(v, a, b, c, d, e, f, g, h, i, j, k, l, m, n) \ _VA_ARRAY_SET_ITEMS14(v, a, b, c, d, e, f, g, h, i, j, k, l, m); ((v)[13] = (n)) #define _VA_ARRAY_SET_ITEMS16(v, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) \ _VA_ARRAY_SET_ITEMS15(v, a, b, c, d, e, f, g, h, i, j, k, l, m, n); ((v)[14] = (o)) #define _VA_ARRAY_SET_ITEMS17(v, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) \ _VA_ARRAY_SET_ITEMS16(v, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o); ((v)[15] = (p)) /* reusable ARRAY_SET_ITEMS macro */ #define ARRAY_SET_ITEMS(...) { VA_NARGS_CALL_OVERLOAD(_VA_ARRAY_SET_ITEMS, __VA_ARGS__); } (void)0 #if defined(__GNUC__) || defined(__clang__) #define POINTER_OFFSET(v, ofs) \ ((typeof(v))((char *)(v) + ofs)) #else # 488 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_utildefines.h" #define POINTER_OFFSET(v, ofs) \ ((void *)((char *)(v) + ofs)) #endif # 491 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_utildefines.h" /* Like offsetof(typeof(), member), for non-gcc compilers */ #define OFFSETOF_STRUCT(_struct, _member) \ ((((char *)&((_struct)->_member)) - ((char *)(_struct))) + sizeof((_struct)->_member)) /** * memcpy helper, skipping the first part of a struct, * ensures 'struct_dst' isn't const and the offset can be computed at compile time. * This isn't inclusive, the value of \a member isn't copied. */ #define MEMCPY_STRUCT_OFS(struct_dst, struct_src, member) { \ CHECK_TYPE_NONCONST(struct_dst); \ ((void)(struct_dst == struct_src), \ memcpy((char *)(struct_dst) + OFFSETOF_STRUCT(struct_dst, member), \ (char *)(struct_src) + OFFSETOF_STRUCT(struct_dst, member), \ sizeof(*(struct_dst)) - OFFSETOF_STRUCT(struct_dst, member))); \ } (void)0 #define MEMSET_STRUCT_OFS(struct_var, value, member) { \ CHECK_TYPE_NONCONST(struct_var); \ memset((char *)(struct_var) + OFFSETOF_STRUCT(struct_var, member), \ value, \ sizeof(*(struct_var)) - OFFSETOF_STRUCT(struct_var, member)); \ } (void)0 /* Warning-free macros for storing ints in pointers. Use these _only_ * for storing an int in a pointer, not a pointer in an int (64bit)! */ #define SET_INT_IN_POINTER(i) ((void *)(intptr_t)(i)) #define GET_INT_FROM_POINTER(i) ((void)0, ((int)(intptr_t)(i))) #define SET_UINT_IN_POINTER(i) ((void *)(uintptr_t)(i)) #define GET_UINT_FROM_POINTER(i) ((void)0, ((unsigned int)(uintptr_t)(i))) /* Macro to convert a value to string in the preprocessor * STRINGIFY_ARG: gives the argument as a string * STRINGIFY_APPEND: appends any argument 'b' onto the string argument 'a', * used by STRINGIFY because some preprocessors warn about zero arguments * STRINGIFY: gives the argument's value as a string */ #define STRINGIFY_ARG(x) "" #x #define STRINGIFY_APPEND(a, b) "" a #b #define STRINGIFY(x) STRINGIFY_APPEND("", x) /* generic strcmp macros */ #if defined(_MSC_VER) # define strcasecmp _stricmp # define strncasecmp _strnicmp #endif # 540 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_utildefines.h" #define STREQ(a, b) (strcmp(a, b) == 0) #define STRCASEEQ(a, b) (strcasecmp(a, b) == 0) #define STREQLEN(a, b, n) (strncmp(a, b, n) == 0) #define STRCASEEQLEN(a, b, n) (strncasecmp(a, b, n) == 0) #define STRPREFIX(a, b) (strncmp((a), (b), strlen(b)) == 0) /* useful for debugging */ #define AT __FILE__ ":" STRINGIFY(__LINE__) /* UNUSED macro, for function argument */ #ifdef __GNUC__ # define UNUSED(x) UNUSED_ ## x __attribute__((__unused__)) #else # 555 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_utildefines.h" # define UNUSED(x) UNUSED_ ## x #endif # 557 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_utildefines.h" #ifdef __GNUC__ # define UNUSED_FUNCTION(x) __attribute__((__unused__)) UNUSED_ ## x #else # 561 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_utildefines.h" # define UNUSED_FUNCTION(x) UNUSED_ ## x #endif # 563 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_utildefines.h" /** * UNUSED_VARS#(a, ...): quiet unused warnings * * \code{.py} * for i in range(16): * args = [(chr(ord('a') + (c % 26)) + (chr(ord('0') + (c // 26)))) for c in range(i + 1)] * print("#define _VA_UNUSED_VARS_%d(%s) \\" % (i + 1, ", ".join(args))) * print("\t((void)(%s)%s)" % * (args[0], ((", _VA_UNUSED_VARS_" + str(i) + "(%s)") if i else "%s") % ", ".join((args[1:])))) * \endcode */ #define _VA_UNUSED_VARS_1(a0) \ ((void)(a0)) #define _VA_UNUSED_VARS_2(a0, b0) \ ((void)(a0), _VA_UNUSED_VARS_1(b0)) #define _VA_UNUSED_VARS_3(a0, b0, c0) \ ((void)(a0), _VA_UNUSED_VARS_2(b0, c0)) #define _VA_UNUSED_VARS_4(a0, b0, c0, d0) \ ((void)(a0), _VA_UNUSED_VARS_3(b0, c0, d0)) #define _VA_UNUSED_VARS_5(a0, b0, c0, d0, e0) \ ((void)(a0), _VA_UNUSED_VARS_4(b0, c0, d0, e0)) #define _VA_UNUSED_VARS_6(a0, b0, c0, d0, e0, f0) \ ((void)(a0), _VA_UNUSED_VARS_5(b0, c0, d0, e0, f0)) #define _VA_UNUSED_VARS_7(a0, b0, c0, d0, e0, f0, g0) \ ((void)(a0), _VA_UNUSED_VARS_6(b0, c0, d0, e0, f0, g0)) #define _VA_UNUSED_VARS_8(a0, b0, c0, d0, e0, f0, g0, h0) \ ((void)(a0), _VA_UNUSED_VARS_7(b0, c0, d0, e0, f0, g0, h0)) #define _VA_UNUSED_VARS_9(a0, b0, c0, d0, e0, f0, g0, h0, i0) \ ((void)(a0), _VA_UNUSED_VARS_8(b0, c0, d0, e0, f0, g0, h0, i0)) #define _VA_UNUSED_VARS_10(a0, b0, c0, d0, e0, f0, g0, h0, i0, j0) \ ((void)(a0), _VA_UNUSED_VARS_9(b0, c0, d0, e0, f0, g0, h0, i0, j0)) #define _VA_UNUSED_VARS_11(a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0) \ ((void)(a0), _VA_UNUSED_VARS_10(b0, c0, d0, e0, f0, g0, h0, i0, j0, k0)) #define _VA_UNUSED_VARS_12(a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0) \ ((void)(a0), _VA_UNUSED_VARS_11(b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0)) #define _VA_UNUSED_VARS_13(a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0) \ ((void)(a0), _VA_UNUSED_VARS_12(b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0)) #define _VA_UNUSED_VARS_14(a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0) \ ((void)(a0), _VA_UNUSED_VARS_13(b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0)) #define _VA_UNUSED_VARS_15(a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0) \ ((void)(a0), _VA_UNUSED_VARS_14(b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0)) #define _VA_UNUSED_VARS_16(a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0) \ ((void)(a0), _VA_UNUSED_VARS_15(b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0)) /* reusable ELEM macro */ #define UNUSED_VARS(...) VA_NARGS_CALL_OVERLOAD(_VA_UNUSED_VARS_, __VA_ARGS__) /* for debug-only variables */ #ifndef NDEBUG # define UNUSED_VARS_NDEBUG(...) #else # 617 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_utildefines.h" # define UNUSED_VARS_NDEBUG UNUSED_VARS #endif # 619 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_utildefines.h" /*little macro so inline keyword works*/ #if defined(_MSC_VER) # define BLI_INLINE static __forceinline #else # 624 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_utildefines.h" # if (defined(__APPLE__) && defined(__ppc__)) /* static inline __attribute__ here breaks osx ppc gcc42 build */ # define BLI_INLINE static __attribute__((always_inline)) # else # 628 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_utildefines.h" # define BLI_INLINE static inline __attribute__((always_inline)) # endif # 630 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_utildefines.h" #endif # 631 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_utildefines.h" /* BLI_assert(), default only to print * for aborting need to define WITH_ASSERT_ABORT */ #ifndef NDEBUG extern void BLI_system_backtrace(FILE *fp); # ifdef WITH_ASSERT_ABORT # define _BLI_DUMMY_ABORT abort # else # 641 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_utildefines.h" # define _BLI_DUMMY_ABORT() (void)0 # endif # 643 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_utildefines.h" # if defined(__GNUC__) || defined(_MSC_VER) /* check __func__ is available */ # define BLI_assert(a) \ (void)((!(a)) ? ( \ ( \ BLI_system_backtrace(stderr), \ fprintf(stderr, \ "BLI_assert failed: %s:%d, %s(), at \'%s\'\n", \ __FILE__, __LINE__, __func__, STRINGIFY(a)), \ _BLI_DUMMY_ABORT(), \ NULL)) : NULL) # else # 654 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_utildefines.h" # define BLI_assert(a) \ (void)((!(a)) ? ( \ ( \ fprintf(stderr, \ "BLI_assert failed: %s:%d, at \'%s\'\n", \ __FILE__, __LINE__, STRINGIFY(a)), \ _BLI_DUMMY_ABORT(), \ NULL)) : NULL) # endif # 663 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_utildefines.h" #else # 664 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_utildefines.h" # define BLI_assert(a) (void)0 #endif # 666 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_utildefines.h" /* C++ can't use _Static_assert, expects static_assert() but c++0x only, * Coverity also errors out. */ #if (!defined(__cplusplus)) && \ (!defined(__COVERITY__)) && \ (defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 406)) /* gcc4.6+ only */ # define BLI_STATIC_ASSERT(a, msg) __extension__ _Static_assert(a, msg); #else # 674 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_utildefines.h" /* TODO msvc, clang */ # define BLI_STATIC_ASSERT(a, msg) #endif # 677 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_utildefines.h" /* hints for branch prediction, only use in code that runs a _lot_ where */ #ifdef __GNUC__ # define LIKELY(x) __builtin_expect(!!(x), 1) # define UNLIKELY(x) __builtin_expect(!!(x), 0) #else # 683 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_utildefines.h" # define LIKELY(x) (x) # define UNLIKELY(x) (x) #endif # 686 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_utildefines.h" #ifdef __cplusplus } #endif # 690 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_utildefines.h" #endif /* __BLI_UTILDEFINES_H__ */ # 692 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_utildefines.h" # 37 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/intern/BLI_kdopbvh.c" 2 #if 0 /* expanded by -frewrite-includes */ #include "BLI_stack.h" #endif /* expanded by -frewrite-includes */ # 37 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/intern/BLI_kdopbvh.c" # 1 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_stack.h" 1 /* * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * Contributor(s): Nicholas Bishop * * ***** END GPL LICENSE BLOCK ***** * */ #ifndef __BLI_STACK_H__ #define __BLI_STACK_H__ /** \file BLI_stack.h * \ingroup bli */ #if 0 /* expanded by -frewrite-includes */ #include "BLI_compiler_attrs.h" #endif /* expanded by -frewrite-includes */ # 31 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_stack.h" # 32 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_stack.h" typedef struct BLI_Stack BLI_Stack; BLI_Stack *BLI_stack_new_ex( const size_t elem_size, const char *description, const size_t chunk_size) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); BLI_Stack *BLI_stack_new( const size_t elem_size, const char *description) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); void BLI_stack_free(BLI_Stack *stack) ATTR_NONNULL(); void *BLI_stack_push_r(BLI_Stack *stack) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); void BLI_stack_push(BLI_Stack *stack, const void *src) ATTR_NONNULL(); void BLI_stack_pop_n(BLI_Stack *stack, void *dst, unsigned int n) ATTR_NONNULL(); void BLI_stack_pop(BLI_Stack *stack, void *dst) ATTR_NONNULL(); void *BLI_stack_peek(BLI_Stack *stack) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); void BLI_stack_discard(BLI_Stack *stack) ATTR_NONNULL(); void BLI_stack_clear(BLI_Stack *stack) ATTR_NONNULL(); size_t BLI_stack_count(const BLI_Stack *stack) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); bool BLI_stack_is_empty(const BLI_Stack *stack) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); #endif /* __BLI_STACK_H__ */ # 58 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_stack.h" # 38 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/intern/BLI_kdopbvh.c" 2 #if 0 /* expanded by -frewrite-includes */ #include "BLI_kdopbvh.h" #endif /* expanded by -frewrite-includes */ # 38 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/intern/BLI_kdopbvh.c" # 1 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_kdopbvh.h" 1 /* * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * The Original Code is Copyright (C) 2006 by NaN Holding BV. * All rights reserved. * * The Original Code is: all of this file. * * Contributor(s): Daniel Genrich, Andre Pinto * * ***** END GPL LICENSE BLOCK ***** */ #ifndef __BLI_KDOPBVH_H__ #define __BLI_KDOPBVH_H__ /** \file BLI_kdopbvh.h * \ingroup bli * \author Daniel Genrich * \author Andre Pinto */ #ifdef __cplusplus extern "C" { #endif # 41 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_kdopbvh.h" struct BVHTree; typedef struct BVHTree BVHTree; typedef struct BVHTreeOverlap { int indexA; int indexB; } BVHTreeOverlap; /* flags */ #define BVH_ONQUAD (1 << 0) typedef struct BVHTreeNearest { int index; /* the index of the nearest found (untouched if none is found within a dist radius from the given coordinates) */ float co[3]; /* nearest coordinates (untouched it none is found within a dist radius from the given coordinates) */ float no[3]; /* normal at nearest coordinates (untouched it none is found within a dist radius from the given coordinates) */ float dist_sq; /* squared distance to search arround */ int flags; } BVHTreeNearest; typedef struct BVHTreeRay { float origin[3]; /* ray origin */ float direction[3]; /* ray direction */ float radius; /* radius around ray */ } BVHTreeRay; typedef struct BVHTreeRayHit { int index; /* index of the tree node (untouched if no hit is found) */ float co[3]; /* coordinates of the hit point */ float no[3]; /* normal on hit point */ float dist; /* distance to the hit point */ int flags; } BVHTreeRayHit; /* callback must update nearest in case it finds a nearest result */ typedef void (*BVHTree_NearestPointCallback)(void *userdata, int index, const float co[3], BVHTreeNearest *nearest); /* callback must update hit in case it finds a nearest successful hit */ typedef void (*BVHTree_RayCastCallback)(void *userdata, int index, const BVHTreeRay *ray, BVHTreeRayHit *hit); /* callback to range search query */ typedef void (*BVHTree_RangeQuery)(void *userdata, int index, float dist_sq); BVHTree *BLI_bvhtree_new(int maxsize, float epsilon, char tree_type, char axis); void BLI_bvhtree_free(BVHTree *tree); /* construct: first insert points, then call balance */ void BLI_bvhtree_insert(BVHTree *tree, int index, const float co[3], int numpoints); void BLI_bvhtree_balance(BVHTree *tree); /* update: first update points/nodes, then call update_tree to refit the bounding volumes */ bool BLI_bvhtree_update_node(BVHTree *tree, int index, const float co[3], const float co_moving[3], int numpoints); void BLI_bvhtree_update_tree(BVHTree *tree); /* collision/overlap: check two trees if they overlap, alloc's *overlap with length of the int return value */ BVHTreeOverlap *BLI_bvhtree_overlap(BVHTree *tree1, BVHTree *tree2, unsigned int *r_overlap_tot); float BLI_bvhtree_getepsilon(const BVHTree *tree); /* find nearest node to the given coordinates * (if nearest is given it will only search nodes where square distance is smaller than nearest->dist) */ int BLI_bvhtree_find_nearest(BVHTree *tree, const float co[3], BVHTreeNearest *nearest, BVHTree_NearestPointCallback callback, void *userdata); int BLI_bvhtree_ray_cast(BVHTree *tree, const float co[3], const float dir[3], float radius, BVHTreeRayHit *hit, BVHTree_RayCastCallback callback, void *userdata); /* Calls the callback for every ray intersection */ int BLI_bvhtree_ray_cast_all(BVHTree *tree, const float co[3], const float dir[3], float radius, BVHTree_RayCastCallback callback, void *userdata); float BLI_bvhtree_bb_raycast(const float bv[6], const float light_start[3], const float light_end[3], float pos[3]); /* range query */ int BLI_bvhtree_range_query(BVHTree *tree, const float co[3], float radius, BVHTree_RangeQuery callback, void *userdata); #ifdef __cplusplus } #endif # 121 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_kdopbvh.h" #endif /* __BLI_KDOPBVH_H__ */ # 123 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_kdopbvh.h" # 39 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/intern/BLI_kdopbvh.c" 2 #if 0 /* expanded by -frewrite-includes */ #include "BLI_math.h" #endif /* expanded by -frewrite-includes */ # 39 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/intern/BLI_kdopbvh.c" # 1 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math.h" 1 /* * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. * All rights reserved. * * The Original Code is: some of this file. * * ***** END GPL LICENSE BLOCK ***** * */ #ifndef __BLI_MATH_H__ #define __BLI_MATH_H__ /** \file BLI_math.h * \ingroup bli * \section mathabbrev Abbreviations * * - ``fl`` = float * - ``db`` = double * - ``v2`` = vec2 = vector 2 * - ``v3`` = vec3 = vector 3 * - ``v4`` = vec4 = vector 4 * - ``vn`` = vec4 = vector N dimensions, *passed as an arg, after the vector*. * - ``qt`` = quat = quaternion * - ``dq`` = dquat = dual quaternion * - ``m2`` = mat2 = matrix 2x2 * - ``m3`` = mat3 = matrix 3x3 * - ``m4`` = mat4 = matrix 4x4 * - ``eul`` = euler rotation * - ``eulO`` = euler with order * * \subsection mathabbrev_all Function Type Abbreviations * * For non float versions of functions (which typically operate on floats), * use single suffix abbreviations. * * - ``_d`` = double * - ``_i`` = int * - ``_u`` = unsigned int * - ``_char`` = char * - ``_uchar`` = unsigned char * * \section mathvarnames Variable Names * * - f = single value * - a, b, c = vectors * - r = result vector * - A, B, C = matrices * - R = result matrix */ #if 0 /* expanded by -frewrite-includes */ #include "BLI_math_base.h" #endif /* expanded by -frewrite-includes */ # 67 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math.h" # 1 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" 1 /* * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. * All rights reserved. * * The Original Code is: some of this file. * * ***** END GPL LICENSE BLOCK ***** * */ #ifndef __BLI_MATH_BASE_H__ #define __BLI_MATH_BASE_H__ /** \file BLI_math_base.h * \ingroup bli */ #ifdef _MSC_VER # define _USE_MATH_DEFINES #endif # 36 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 37 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.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: stable/10/lib/msun/src/math.h 284810 2015-06-25 13:01:10Z tijl $ */ #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 #ifdef __ia64__ #define FP_FAST_FMA 1 #define FP_FAST_FMAL 1 #endif # 76 "/usr/include/math.h" 3 4 /* 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) # 100 "/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 # 107 "/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 # 112 "/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 # 129 "/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 */ # 137 "/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 */ # 143 "/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 */ # 165 "/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 # 171 "/usr/include/math.h" 3 4 #define HUGE MAXFLOAT #endif # 173 "/usr/include/math.h" 3 4 #endif /* __BSD_VISIBLE */ # 174 "/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 # 235 "/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 */ # 292 "/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 # 304 "/usr/include/math.h" 3 4 #if __XSI_VISIBLE <= 600 || __BSD_VISIBLE double scalb(double, double); #endif # 308 "/usr/include/math.h" 3 4 #endif /* __BSD_VISIBLE || __XSI_VISIBLE */ # 309 "/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 # 322 "/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 */ # 343 "/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 # 410 "/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 */ # 439 "/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 */ # 504 "/usr/include/math.h" 3 4 #if __BSD_VISIBLE long double lgammal_r(long double, int *); #endif # 508 "/usr/include/math.h" 3 4 __END_DECLS #endif /* !_MATH_H_ */ # 512 "/usr/include/math.h" 3 4 # 38 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" 2 #if 0 /* expanded by -frewrite-includes */ #include "BLI_math_inline.h" #endif /* expanded by -frewrite-includes */ # 38 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" # 1 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_inline.h" 1 /* * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. * All rights reserved. * * The Original Code is: some of this file. * * ***** END GPL LICENSE BLOCK ***** * */ #ifndef __BLI_MATH_INLINE_H__ #define __BLI_MATH_INLINE_H__ /** \file BLI_math_inline.h * \ingroup bli */ #ifdef __cplusplus extern "C" { #endif # 36 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_inline.h" /* add platform/compiler checks here if it is not supported */ /* all platforms support forcing inline so this is always enabled */ #define BLI_MATH_DO_INLINE 1 #if BLI_MATH_DO_INLINE # ifdef _MSC_VER # define MINLINE static __forceinline # define MALWAYS_INLINE MINLINE # else # 46 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_inline.h" # define MINLINE static inline # if (defined(__APPLE__) && defined(__ppc__)) /* static inline __attribute__ here breaks osx ppc gcc42 build */ # define MALWAYS_INLINE static __attribute__((always_inline)) # else # 51 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_inline.h" # define MALWAYS_INLINE static inline __attribute__((always_inline)) # endif # 53 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_inline.h" # endif # 54 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_inline.h" #else # 55 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_inline.h" # define MINLINE # define MALWAYS_INLINE #endif # 58 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_inline.h" /* gcc 4.6 (supports push/pop) */ #if (defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 406)) # define BLI_MATH_GCC_WARN_PRAGMA 1 #endif # 63 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_inline.h" #ifdef __cplusplus } #endif # 67 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_inline.h" #endif /* __BLI_MATH_INLINE_H__ */ # 69 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_inline.h" # 39 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" 2 #ifdef __sun__ #if 0 /* expanded by -frewrite-includes */ #include /* for finite() */ #endif /* expanded by -frewrite-includes */ # 41 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" # 42 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" #endif # 43 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" #ifndef M_PI #define M_PI 3.14159265358979323846 /* pi */ #endif # 47 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" #ifndef M_PI_2 #define M_PI_2 1.57079632679489661923 /* pi/2 */ #endif # 50 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" #ifndef M_PI_4 #define M_PI_4 0.78539816339744830962 /* pi/4 */ #endif # 53 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" #ifndef M_SQRT2 #define M_SQRT2 1.41421356237309504880 /* sqrt(2) */ #endif # 56 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" #ifndef M_SQRT1_2 #define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */ #endif # 59 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" #ifndef M_SQRT3 #define M_SQRT3 1.73205080756887729352 /* sqrt(3) */ #endif # 62 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" #ifndef M_SQRT1_3 #define M_SQRT1_3 0.57735026918962576450 /* 1/sqrt(3) */ #endif # 65 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" #ifndef M_1_PI #define M_1_PI 0.318309886183790671538 /* 1/pi */ #endif # 68 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" #ifndef M_E #define M_E 2.7182818284590452354 /* e */ #endif # 71 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" #ifndef M_LOG2E #define M_LOG2E 1.4426950408889634074 /* log_2 e */ #endif # 74 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" #ifndef M_LOG10E #define M_LOG10E 0.43429448190325182765 /* log_10 e */ #endif # 77 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" #ifndef M_LN2 #define M_LN2 0.69314718055994530942 /* log_e 2 */ #endif # 80 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" #ifndef M_LN10 #define M_LN10 2.30258509299404568402 /* log_e 10 */ #endif # 83 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" #if defined(__GNUC__) # define NAN_FLT __builtin_nanf("") #else # 87 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" /* evil quiet NaN definition */ static const int NAN_INT = 0x7FC00000; # define NAN_FLT (*((float *)(&NAN_INT))) #endif # 91 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" /* do not redefine functions from C99, POSIX.1-2001 or MSVC12 (partial C99) */ #if !(defined(_ISOC99_SOURCE) || (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112L) || (defined(_MSC_VER) && _MSC_VER >= 1800)) #ifndef sqrtf #define sqrtf(a) ((float)sqrt(a)) #endif # 98 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" #ifndef powf #define powf(a, b) ((float)pow(a, b)) #endif # 101 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" #ifndef cosf #define cosf(a) ((float)cos(a)) #endif # 104 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" #ifndef sinf #define sinf(a) ((float)sin(a)) #endif # 107 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" #ifndef acosf #define acosf(a) ((float)acos(a)) #endif # 110 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" #ifndef asinf #define asinf(a) ((float)asin(a)) #endif # 113 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" #ifndef atan2f #define atan2f(a, b) ((float)atan2(a, b)) #endif # 116 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" #ifndef tanf #define tanf(a) ((float)tan(a)) #endif # 119 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" #ifndef atanf #define atanf(a) ((float)atan(a)) #endif # 122 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" #ifndef floorf #define floorf(a) ((float)floor(a)) #endif # 125 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" #ifndef ceilf #define ceilf(a) ((float)ceil(a)) #endif # 128 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" #ifndef fabsf #define fabsf(a) ((float)fabs(a)) #endif # 131 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" #ifndef logf #define logf(a) ((float)log(a)) #endif # 134 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" #ifndef expf #define expf(a) ((float)exp(a)) #endif # 137 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" #ifndef fmodf #define fmodf(a, b) ((float)fmod(a, b)) #endif # 140 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" #ifndef hypotf #define hypotf(a, b) ((float)hypot(a, b)) #endif # 143 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" #ifndef copysignf #define copysignf(a, b) ((float)copysign(a, b)) #endif # 146 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" #endif /* C99, POSIX.1-2001 or MSVC12 (partial C99) */ # 148 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" #ifdef WIN32 # if defined(_MSC_VER) # define finite(n) _finite(n) # endif # 153 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" #endif # 154 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" #if BLI_MATH_DO_INLINE #if 0 /* expanded by -frewrite-includes */ #include "intern/math_base_inline.c" #endif /* expanded by -frewrite-includes */ # 156 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" # 1 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/intern/math_base_inline.c" 1 /* * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. * All rights reserved. * * The Original Code is: some of this file. * * ***** END GPL LICENSE BLOCK ***** * */ /** \file blender/blenlib/intern/math_base_inline.c * \ingroup bli */ #ifndef __MATH_BASE_INLINE_C__ #define __MATH_BASE_INLINE_C__ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 33 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/intern/math_base_inline.c" # 1 "/usr/local/llvm37/bin/../lib/clang/3.7.0/include/float.h" 1 3 4 /*===---- float.h - Characteristics of floating point types ----------------=== * * 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 __FLOAT_H #define __FLOAT_H /* If we're on MinGW, fall back to the system's float.h, which might have * additional definitions provided for Windows. * For more details see http://msdn.microsoft.com/en-us/library/y0ybw9fy.aspx */ #if (defined(__MINGW32__) || defined(_MSC_VER)) && __STDC_HOSTED__ && \ (1)/*__has_include_next()*/ #if 0 /* expanded by -frewrite-includes */ # include_next #endif /* expanded by -frewrite-includes */ # 33 "/usr/local/llvm37/bin/../lib/clang/3.7.0/include/float.h" 3 4 # 34 "/usr/local/llvm37/bin/../lib/clang/3.7.0/include/float.h" 3 4 /* Undefine anything that we'll be redefining below. */ # undef FLT_EVAL_METHOD # undef FLT_ROUNDS # undef FLT_RADIX # undef FLT_MANT_DIG # undef DBL_MANT_DIG # undef LDBL_MANT_DIG # undef DECIMAL_DIG # undef FLT_DIG # undef DBL_DIG # undef LDBL_DIG # undef FLT_MIN_EXP # undef DBL_MIN_EXP # undef LDBL_MIN_EXP # undef FLT_MIN_10_EXP # undef DBL_MIN_10_EXP # undef LDBL_MIN_10_EXP # undef FLT_MAX_EXP # undef DBL_MAX_EXP # undef LDBL_MAX_EXP # undef FLT_MAX_10_EXP # undef DBL_MAX_10_EXP # undef LDBL_MAX_10_EXP # undef FLT_MAX # undef DBL_MAX # undef LDBL_MAX # undef FLT_EPSILON # undef DBL_EPSILON # undef LDBL_EPSILON # undef FLT_MIN # undef DBL_MIN # undef LDBL_MIN # if __STDC_VERSION__ >= 201112L || !defined(__STRICT_ANSI__) # undef FLT_TRUE_MIN # undef DBL_TRUE_MIN # undef LDBL_TRUE_MIN # endif # 72 "/usr/local/llvm37/bin/../lib/clang/3.7.0/include/float.h" 3 4 #endif # 73 "/usr/local/llvm37/bin/../lib/clang/3.7.0/include/float.h" 3 4 /* Characteristics of floating point types, C99 5.2.4.2.2 */ #define FLT_EVAL_METHOD __FLT_EVAL_METHOD__ #define FLT_ROUNDS (__builtin_flt_rounds()) #define FLT_RADIX __FLT_RADIX__ #define FLT_MANT_DIG __FLT_MANT_DIG__ #define DBL_MANT_DIG __DBL_MANT_DIG__ #define LDBL_MANT_DIG __LDBL_MANT_DIG__ #define DECIMAL_DIG __DECIMAL_DIG__ #define FLT_DIG __FLT_DIG__ #define DBL_DIG __DBL_DIG__ #define LDBL_DIG __LDBL_DIG__ #define FLT_MIN_EXP __FLT_MIN_EXP__ #define DBL_MIN_EXP __DBL_MIN_EXP__ #define LDBL_MIN_EXP __LDBL_MIN_EXP__ #define FLT_MIN_10_EXP __FLT_MIN_10_EXP__ #define DBL_MIN_10_EXP __DBL_MIN_10_EXP__ #define LDBL_MIN_10_EXP __LDBL_MIN_10_EXP__ #define FLT_MAX_EXP __FLT_MAX_EXP__ #define DBL_MAX_EXP __DBL_MAX_EXP__ #define LDBL_MAX_EXP __LDBL_MAX_EXP__ #define FLT_MAX_10_EXP __FLT_MAX_10_EXP__ #define DBL_MAX_10_EXP __DBL_MAX_10_EXP__ #define LDBL_MAX_10_EXP __LDBL_MAX_10_EXP__ #define FLT_MAX __FLT_MAX__ #define DBL_MAX __DBL_MAX__ #define LDBL_MAX __LDBL_MAX__ #define FLT_EPSILON __FLT_EPSILON__ #define DBL_EPSILON __DBL_EPSILON__ #define LDBL_EPSILON __LDBL_EPSILON__ #define FLT_MIN __FLT_MIN__ #define DBL_MIN __DBL_MIN__ #define LDBL_MIN __LDBL_MIN__ #if __STDC_VERSION__ >= 201112L || !defined(__STRICT_ANSI__) # define FLT_TRUE_MIN __FLT_DENORM_MIN__ # define DBL_TRUE_MIN __DBL_DENORM_MIN__ # define LDBL_TRUE_MIN __LDBL_DENORM_MIN__ #endif # 123 "/usr/local/llvm37/bin/../lib/clang/3.7.0/include/float.h" 3 4 #endif /* __FLOAT_H */ # 125 "/usr/local/llvm37/bin/../lib/clang/3.7.0/include/float.h" 3 4 # 34 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/intern/math_base_inline.c" 2 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 34 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/intern/math_base_inline.c" # 35 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/intern/math_base_inline.c" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 35 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/intern/math_base_inline.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: stable/10/include/stdlib.h 264496 2014-04-15 09:41:52Z tijl $ */ #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; 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; 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); 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 */ # 150 "/usr/include/stdlib.h" 3 4 _Noreturn void _Exit(int); #endif /* __ISO_C_VISIBLE >= 1999 */ # 153 "/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; int at_quick_exit(void (*)(void)); _Noreturn void quick_exit(int); #endif /* __ISO_C_VISIBLE >= 2011 */ # 163 "/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 # 169 "/usr/include/stdlib.h" 3 4 #if __POSIX_VISIBLE >= 199506 int rand_r(unsigned *); /* (TSF) */ #endif # 172 "/usr/include/stdlib.h" 3 4 #if __POSIX_VISIBLE >= 200112 int posix_memalign(void **, size_t, size_t); /* (ADV) */ int setenv(const char *, const char *, int); int unsetenv(const char *); #endif # 177 "/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 # 184 "/usr/include/stdlib.h" 3 4 #ifndef _MKSTEMP_DECLARED int mkstemp(char *); #define _MKSTEMP_DECLARED #endif # 188 "/usr/include/stdlib.h" 3 4 #endif /* __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE */ # 189 "/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 # 214 "/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 # 226 "/usr/include/stdlib.h" 3 4 char *setstate(/* const */ char *); void srand48(long); void srandom(unsigned long); int unlockpt(int); #endif /* __XSI_VISIBLE */ # 231 "/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) # 249 "/usr/include/stdlib.h" 3 4 void *alloca(size_t); #endif # 251 "/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); 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 *)); int l64a_r(long, char *, int); int mergesort(void *, size_t, size_t, int (*)(const void *, const void *)); 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 *reallocf(void *, size_t); 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 */ # 309 "/usr/include/stdlib.h" 3 4 __END_DECLS #endif /* !_STDLIB_H_ */ # 312 "/usr/include/stdlib.h" 3 4 # 36 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/intern/math_base_inline.c" 2 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 36 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/intern/math_base_inline.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: stable/10/include/string.h 246803 2013-02-14 19:26:58Z zeising $ */ #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: stable/10/include/strings.h 267465 2014-06-14 02:57:40Z pfg $ */ #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 __XSI_VISIBLE int ffs(int) __pure2; #endif # 49 "/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 # 56 "/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 # 60 "/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 */ # 64 "/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: stable/10/include/xlocale/_strings.h 267465 2014-06-14 02:57:40Z 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 # 65 "/usr/include/strings.h" 2 3 4 #endif # 66 "/usr/include/strings.h" 3 4 __END_DECLS #endif /* _STRINGS_H_ */ # 69 "/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 || __BSD_VISIBLE 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 || __BSD_VISIBLE 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 || __BSD_VISIBLE 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: stable/10/include/xlocale/_string.h 267465 2014-06-14 02:57:40Z 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 # 37 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/intern/math_base_inline.c" 2 #if 0 /* expanded by -frewrite-includes */ #include "BLI_math_base.h" #endif /* expanded by -frewrite-includes */ # 38 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/intern/math_base_inline.c" # 1 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" 1 /* * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. * All rights reserved. * * The Original Code is: some of this file. * * ***** END GPL LICENSE BLOCK ***** * */ #ifndef __BLI_MATH_BASE_H__ #define __BLI_MATH_BASE_H__ /** \file BLI_math_base.h * \ingroup bli */ #ifdef _MSC_VER # define _USE_MATH_DEFINES #endif # 36 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 37 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" # 38 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" #if 0 /* expanded by -frewrite-includes */ #include "BLI_math_inline.h" #endif /* expanded by -frewrite-includes */ # 38 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" # 39 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" #ifdef __sun__ #if 0 /* expanded by -frewrite-includes */ #include /* for finite() */ #endif /* expanded by -frewrite-includes */ # 41 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" # 42 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" #endif # 43 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" #ifndef M_PI #define M_PI 3.14159265358979323846 /* pi */ #endif # 47 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" #ifndef M_PI_2 #define M_PI_2 1.57079632679489661923 /* pi/2 */ #endif # 50 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" #ifndef M_PI_4 #define M_PI_4 0.78539816339744830962 /* pi/4 */ #endif # 53 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" #ifndef M_SQRT2 #define M_SQRT2 1.41421356237309504880 /* sqrt(2) */ #endif # 56 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" #ifndef M_SQRT1_2 #define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */ #endif # 59 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" #ifndef M_SQRT3 #define M_SQRT3 1.73205080756887729352 /* sqrt(3) */ #endif # 62 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" #ifndef M_SQRT1_3 #define M_SQRT1_3 0.57735026918962576450 /* 1/sqrt(3) */ #endif # 65 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" #ifndef M_1_PI #define M_1_PI 0.318309886183790671538 /* 1/pi */ #endif # 68 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" #ifndef M_E #define M_E 2.7182818284590452354 /* e */ #endif # 71 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" #ifndef M_LOG2E #define M_LOG2E 1.4426950408889634074 /* log_2 e */ #endif # 74 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" #ifndef M_LOG10E #define M_LOG10E 0.43429448190325182765 /* log_10 e */ #endif # 77 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" #ifndef M_LN2 #define M_LN2 0.69314718055994530942 /* log_e 2 */ #endif # 80 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" #ifndef M_LN10 #define M_LN10 2.30258509299404568402 /* log_e 10 */ #endif # 83 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" #if defined(__GNUC__) # define NAN_FLT __builtin_nanf("") #else # 87 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" /* evil quiet NaN definition */ static const int NAN_INT = 0x7FC00000; # define NAN_FLT (*((float *)(&NAN_INT))) #endif # 91 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" /* do not redefine functions from C99, POSIX.1-2001 or MSVC12 (partial C99) */ #if !(defined(_ISOC99_SOURCE) || (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112L) || (defined(_MSC_VER) && _MSC_VER >= 1800)) #ifndef sqrtf #define sqrtf(a) ((float)sqrt(a)) #endif # 98 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" #ifndef powf #define powf(a, b) ((float)pow(a, b)) #endif # 101 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" #ifndef cosf #define cosf(a) ((float)cos(a)) #endif # 104 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" #ifndef sinf #define sinf(a) ((float)sin(a)) #endif # 107 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" #ifndef acosf #define acosf(a) ((float)acos(a)) #endif # 110 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" #ifndef asinf #define asinf(a) ((float)asin(a)) #endif # 113 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" #ifndef atan2f #define atan2f(a, b) ((float)atan2(a, b)) #endif # 116 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" #ifndef tanf #define tanf(a) ((float)tan(a)) #endif # 119 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" #ifndef atanf #define atanf(a) ((float)atan(a)) #endif # 122 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" #ifndef floorf #define floorf(a) ((float)floor(a)) #endif # 125 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" #ifndef ceilf #define ceilf(a) ((float)ceil(a)) #endif # 128 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" #ifndef fabsf #define fabsf(a) ((float)fabs(a)) #endif # 131 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" #ifndef logf #define logf(a) ((float)log(a)) #endif # 134 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" #ifndef expf #define expf(a) ((float)exp(a)) #endif # 137 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" #ifndef fmodf #define fmodf(a, b) ((float)fmod(a, b)) #endif # 140 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" #ifndef hypotf #define hypotf(a, b) ((float)hypot(a, b)) #endif # 143 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" #ifndef copysignf #define copysignf(a, b) ((float)copysign(a, b)) #endif # 146 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" #endif /* C99, POSIX.1-2001 or MSVC12 (partial C99) */ # 148 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" #ifdef WIN32 # if defined(_MSC_VER) # define finite(n) _finite(n) # endif # 153 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" #endif # 154 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" #if BLI_MATH_DO_INLINE #if 0 /* expanded by -frewrite-includes */ #include "intern/math_base_inline.c" #endif /* expanded by -frewrite-includes */ # 156 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" # 157 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" #endif # 158 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" #ifdef BLI_MATH_GCC_WARN_PRAGMA # pragma GCC diagnostic push # pragma GCC diagnostic ignored "-Wredundant-decls" #endif # 163 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" /******************************* Float ******************************/ MINLINE float pow2f(float x); MINLINE float pow3f(float x); MINLINE float pow4f(float x); MINLINE float pow7f(float x); MINLINE float sqrt3f(float f); MINLINE double sqrt3d(double d); MINLINE float sqrtf_signed(float f); MINLINE float saacosf(float f); MINLINE float saasinf(float f); MINLINE float sasqrtf(float f); MINLINE float saacos(float fac); MINLINE float saasin(float fac); MINLINE float sasqrt(float fac); MINLINE float interpf(float a, float b, float t); MINLINE float min_ff(float a, float b); MINLINE float max_ff(float a, float b); MINLINE float min_fff(float a, float b, float c); MINLINE float max_fff(float a, float b, float c); MINLINE float min_ffff(float a, float b, float c, float d); MINLINE float max_ffff(float a, float b, float c, float d); MINLINE int min_ii(int a, int b); MINLINE int max_ii(int a, int b); MINLINE int min_iii(int a, int b, int c); MINLINE int max_iii(int a, int b, int c); MINLINE int min_iiii(int a, int b, int c, int d); MINLINE int max_iiii(int a, int b, int c, int d); MINLINE float signf(float f); MINLINE int signum_i_ex(float a, float eps); MINLINE int signum_i(float a); MINLINE float power_of_2(float f); /* these don't really fit anywhere but were being copied about a lot */ MINLINE int is_power_of_2_i(int n); MINLINE int power_of_2_max_i(int n); MINLINE int power_of_2_min_i(int n); MINLINE unsigned int power_of_2_max_u(unsigned int x); MINLINE unsigned int power_of_2_min_u(unsigned int x); MINLINE int iroundf(float a); MINLINE int divide_round_i(int a, int b); MINLINE int mod_i(int i, int n); int pow_i(int base, int exp); double double_round(double x, int ndigits); #ifdef BLI_MATH_GCC_WARN_PRAGMA # pragma GCC diagnostic pop #endif # 223 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" /* asserts, some math functions expect normalized inputs * check the vector is unit length, or zero length (which can't be helped in some cases). */ #ifndef NDEBUG /* note: 0.0001 is too small becaues normals may be converted from short's: see [#34322] */ # define BLI_ASSERT_UNIT_EPSILON 0.0002f # define BLI_ASSERT_UNIT_V3(v) { \ const float _test_unit = len_squared_v3(v); \ BLI_assert((fabsf(_test_unit - 1.0f) < BLI_ASSERT_UNIT_EPSILON) || \ (fabsf(_test_unit) < BLI_ASSERT_UNIT_EPSILON)); \ } (void)0 # define BLI_ASSERT_UNIT_V2(v) { \ const float _test_unit = len_squared_v2(v); \ BLI_assert((fabsf(_test_unit - 1.0f) < BLI_ASSERT_UNIT_EPSILON) || \ (fabsf(_test_unit) < BLI_ASSERT_UNIT_EPSILON)); \ } (void)0 # define BLI_ASSERT_UNIT_QUAT(q) { \ const float _test_unit = dot_qtqt(q, q); \ BLI_assert((fabsf(_test_unit - 1.0f) < BLI_ASSERT_UNIT_EPSILON * 10) || \ (fabsf(_test_unit) < BLI_ASSERT_UNIT_EPSILON * 10)); \ } (void)0 # define BLI_ASSERT_ZERO_M3(m) { \ BLI_assert(dot_vn_vn((const float *)m, (const float *)m, 9) != 0.0); \ } (void)0 # define BLI_ASSERT_ZERO_M4(m) { \ BLI_assert(dot_vn_vn((const float *)m, (const float *)m, 16) != 0.0); \ } (void)0 # define BLI_ASSERT_UNIT_M3(m) { \ BLI_ASSERT_UNIT_V3((m)[0]); \ BLI_ASSERT_UNIT_V3((m)[1]); \ BLI_ASSERT_UNIT_V3((m)[2]); \ } (void)0 #else # 261 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" # define BLI_ASSERT_UNIT_V2(v) (void)(v) # define BLI_ASSERT_UNIT_V3(v) (void)(v) # define BLI_ASSERT_UNIT_QUAT(v) (void)(v) # define BLI_ASSERT_ZERO_M3(m) (void)(m) # define BLI_ASSERT_ZERO_M4(m) (void)(m) # define BLI_ASSERT_UNIT_M3(m) (void)(m) #endif # 268 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" #endif /* __BLI_MATH_BASE_H__ */ # 270 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" # 39 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/intern/math_base_inline.c" 2 /* copied from BLI_utildefines.h */ #ifdef __GNUC__ # define UNLIKELY(x) __builtin_expect(!!(x), 0) #else # 44 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/intern/math_base_inline.c" # define UNLIKELY(x) (x) #endif # 46 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/intern/math_base_inline.c" /* powf is really slow for raising to integer powers. */ MINLINE float pow2f(float x) { return x * x; } MINLINE float pow3f(float x) { return pow2f(x) * x; } MINLINE float pow4f(float x) { return pow2f(pow2f(x)); } MINLINE float pow7f(float x) { return pow2f(pow3f(x)) * x; } MINLINE float sqrt3f(float f) { if (UNLIKELY(f == 0.0f)) return 0.0f; else if (UNLIKELY(f < 0.0f)) return -(float)(exp(log(-f) / 3.0)); else return (float)(exp(log( f) / 3.0)); } MINLINE double sqrt3d(double d) { if (UNLIKELY(d == 0.0)) return 0.0; else if (UNLIKELY(d < 0.0)) return -exp(log(-d) / 3.0); else return exp(log( d) / 3.0); } MINLINE float sqrtf_signed(float f) { return (f >= 0.0f) ? sqrtf(f) : -sqrtf(-f); } MINLINE float saacos(float fac) { if (UNLIKELY(fac <= -1.0f)) return (float)M_PI; else if (UNLIKELY(fac >= 1.0f)) return 0.0f; else return acosf(fac); } MINLINE float saasin(float fac) { if (UNLIKELY(fac <= -1.0f)) return (float)-M_PI / 2.0f; else if (UNLIKELY(fac >= 1.0f)) return (float) M_PI / 2.0f; else return asinf(fac); } MINLINE float sasqrt(float fac) { if (UNLIKELY(fac <= 0.0f)) return 0.0f; else return sqrtf(fac); } MINLINE float saacosf(float fac) { if (UNLIKELY(fac <= -1.0f)) return (float)M_PI; else if (UNLIKELY(fac >= 1.0f)) return 0.0f; else return acosf(fac); } MINLINE float saasinf(float fac) { if (UNLIKELY(fac <= -1.0f)) return (float)-M_PI / 2.0f; else if (UNLIKELY(fac >= 1.0f)) return (float) M_PI / 2.0f; else return asinf(fac); } MINLINE float sasqrtf(float fac) { if (UNLIKELY(fac <= 0.0f)) return 0.0f; else return sqrtf(fac); } MINLINE float interpf(float target, float origin, float fac) { return (fac * target) + (1.0f - fac) * origin; } /* used for zoom values*/ MINLINE float power_of_2(float val) { return (float)pow(2.0, ceil(log((double)val) / M_LN2)); } MINLINE int is_power_of_2_i(int n) { return (n & (n - 1)) == 0; } MINLINE int power_of_2_max_i(int n) { if (is_power_of_2_i(n)) return n; do { n = n & (n - 1); } while (!is_power_of_2_i(n)); return n * 2; } MINLINE int power_of_2_min_i(int n) { while (!is_power_of_2_i(n)) n = n & (n - 1); return n; } MINLINE unsigned int power_of_2_max_u(unsigned int x) { x -= 1; x |= (x >> 1); x |= (x >> 2); x |= (x >> 4); x |= (x >> 8); x |= (x >> 16); return x + 1; } MINLINE unsigned power_of_2_min_u(unsigned x) { x |= (x >> 1); x |= (x >> 2); x |= (x >> 4); x |= (x >> 8); x |= (x >> 16); return x - (x >> 1); } MINLINE int iroundf(float a) { return (int)floorf(a + 0.5f); } /* integer division that rounds 0.5 up, particularly useful for color blending * with integers, to avoid gradual darkening when rounding down */ MINLINE int divide_round_i(int a, int b) { return (2 * a + b) / (2 * b); } /** * modulo that handles negative numbers, works the same as Python's. */ MINLINE int mod_i(int i, int n) { return (i % n + n) % n; } MINLINE float min_ff(float a, float b) { return (a < b) ? a : b; } MINLINE float max_ff(float a, float b) { return (a > b) ? a : b; } MINLINE int min_ii(int a, int b) { return (a < b) ? a : b; } MINLINE int max_ii(int a, int b) { return (b < a) ? a : b; } MINLINE float min_fff(float a, float b, float c) { return min_ff(min_ff(a, b), c); } MINLINE float max_fff(float a, float b, float c) { return max_ff(max_ff(a, b), c); } MINLINE int min_iii(int a, int b, int c) { return min_ii(min_ii(a, b), c); } MINLINE int max_iii(int a, int b, int c) { return max_ii(max_ii(a, b), c); } MINLINE float min_ffff(float a, float b, float c, float d) { return min_ff(min_fff(a, b, c), d); } MINLINE float max_ffff(float a, float b, float c, float d) { return max_ff(max_fff(a, b, c), d); } MINLINE int min_iiii(int a, int b, int c, int d) { return min_ii(min_iii(a, b, c), d); } MINLINE int max_iiii(int a, int b, int c, int d) { return max_ii(max_iii(a, b, c), d); } MINLINE float signf(float f) { return (f < 0.f) ? -1.f : 1.f; } MINLINE int signum_i_ex(float a, float eps) { if (a > eps) return 1; if (a < -eps) return -1; else return 0; } MINLINE int signum_i(float a) { if (a > 0.0f) return 1; if (a < 0.0f) return -1; else return 0; } #endif /* __MATH_BASE_INLINE_C__ */ # 275 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/intern/math_base_inline.c" # 157 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" 2 #endif # 158 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" #ifdef BLI_MATH_GCC_WARN_PRAGMA # pragma GCC diagnostic push # pragma GCC diagnostic ignored "-Wredundant-decls" #endif # 163 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" /******************************* Float ******************************/ MINLINE float pow2f(float x); MINLINE float pow3f(float x); MINLINE float pow4f(float x); MINLINE float pow7f(float x); MINLINE float sqrt3f(float f); MINLINE double sqrt3d(double d); MINLINE float sqrtf_signed(float f); MINLINE float saacosf(float f); MINLINE float saasinf(float f); MINLINE float sasqrtf(float f); MINLINE float saacos(float fac); MINLINE float saasin(float fac); MINLINE float sasqrt(float fac); MINLINE float interpf(float a, float b, float t); MINLINE float min_ff(float a, float b); MINLINE float max_ff(float a, float b); MINLINE float min_fff(float a, float b, float c); MINLINE float max_fff(float a, float b, float c); MINLINE float min_ffff(float a, float b, float c, float d); MINLINE float max_ffff(float a, float b, float c, float d); MINLINE int min_ii(int a, int b); MINLINE int max_ii(int a, int b); MINLINE int min_iii(int a, int b, int c); MINLINE int max_iii(int a, int b, int c); MINLINE int min_iiii(int a, int b, int c, int d); MINLINE int max_iiii(int a, int b, int c, int d); MINLINE float signf(float f); MINLINE int signum_i_ex(float a, float eps); MINLINE int signum_i(float a); MINLINE float power_of_2(float f); /* these don't really fit anywhere but were being copied about a lot */ MINLINE int is_power_of_2_i(int n); MINLINE int power_of_2_max_i(int n); MINLINE int power_of_2_min_i(int n); MINLINE unsigned int power_of_2_max_u(unsigned int x); MINLINE unsigned int power_of_2_min_u(unsigned int x); MINLINE int iroundf(float a); MINLINE int divide_round_i(int a, int b); MINLINE int mod_i(int i, int n); int pow_i(int base, int exp); double double_round(double x, int ndigits); #ifdef BLI_MATH_GCC_WARN_PRAGMA # pragma GCC diagnostic pop #endif # 223 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" /* asserts, some math functions expect normalized inputs * check the vector is unit length, or zero length (which can't be helped in some cases). */ #ifndef NDEBUG /* note: 0.0001 is too small becaues normals may be converted from short's: see [#34322] */ # define BLI_ASSERT_UNIT_EPSILON 0.0002f # define BLI_ASSERT_UNIT_V3(v) { \ const float _test_unit = len_squared_v3(v); \ BLI_assert((fabsf(_test_unit - 1.0f) < BLI_ASSERT_UNIT_EPSILON) || \ (fabsf(_test_unit) < BLI_ASSERT_UNIT_EPSILON)); \ } (void)0 # define BLI_ASSERT_UNIT_V2(v) { \ const float _test_unit = len_squared_v2(v); \ BLI_assert((fabsf(_test_unit - 1.0f) < BLI_ASSERT_UNIT_EPSILON) || \ (fabsf(_test_unit) < BLI_ASSERT_UNIT_EPSILON)); \ } (void)0 # define BLI_ASSERT_UNIT_QUAT(q) { \ const float _test_unit = dot_qtqt(q, q); \ BLI_assert((fabsf(_test_unit - 1.0f) < BLI_ASSERT_UNIT_EPSILON * 10) || \ (fabsf(_test_unit) < BLI_ASSERT_UNIT_EPSILON * 10)); \ } (void)0 # define BLI_ASSERT_ZERO_M3(m) { \ BLI_assert(dot_vn_vn((const float *)m, (const float *)m, 9) != 0.0); \ } (void)0 # define BLI_ASSERT_ZERO_M4(m) { \ BLI_assert(dot_vn_vn((const float *)m, (const float *)m, 16) != 0.0); \ } (void)0 # define BLI_ASSERT_UNIT_M3(m) { \ BLI_ASSERT_UNIT_V3((m)[0]); \ BLI_ASSERT_UNIT_V3((m)[1]); \ BLI_ASSERT_UNIT_V3((m)[2]); \ } (void)0 #else # 261 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" # define BLI_ASSERT_UNIT_V2(v) (void)(v) # define BLI_ASSERT_UNIT_V3(v) (void)(v) # define BLI_ASSERT_UNIT_QUAT(v) (void)(v) # define BLI_ASSERT_ZERO_M3(m) (void)(m) # define BLI_ASSERT_ZERO_M4(m) (void)(m) # define BLI_ASSERT_UNIT_M3(m) (void)(m) #endif # 268 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" #endif /* __BLI_MATH_BASE_H__ */ # 270 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_base.h" # 68 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math.h" 2 #if 0 /* expanded by -frewrite-includes */ #include "BLI_math_color.h" #endif /* expanded by -frewrite-includes */ # 68 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math.h" # 1 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_color.h" 1 /* * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. * All rights reserved. * * The Original Code is: some of this file. * * ***** END GPL LICENSE BLOCK ***** * */ #ifndef __BLI_MATH_COLOR_H__ #define __BLI_MATH_COLOR_H__ /** \file BLI_math_color.h * \ingroup bli */ #ifdef __cplusplus extern "C" { #endif # 36 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_color.h" #if 0 /* expanded by -frewrite-includes */ #include "BLI_math_inline.h" #endif /* expanded by -frewrite-includes */ # 37 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_color.h" # 38 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_color.h" /* primaries */ #define BLI_XYZ_SMPTE 0 #define BLI_XYZ_REC709_SRGB 1 #define BLI_XYZ_CIE 2 /* built-in profiles */ #define BLI_PR_NONE 0 #define BLI_PR_SRGB 1 #define BLI_PR_REC709 2 /* YCbCr */ #define BLI_YCC_ITU_BT601 0 #define BLI_YCC_ITU_BT709 1 #define BLI_YCC_JFIF_0_255 2 /******************* Conversion to RGB ********************/ void hsv_to_rgb(float h, float s, float v, float *r, float *g, float *b); void hsv_to_rgb_v(const float hsv[3], float r_rgb[3]); void hsl_to_rgb(float h, float c, float l, float *r, float *g, float *b); void hsl_to_rgb_v(const float hcl[3], float r_rgb[3]); void hex_to_rgb(char *hexcol, float *r, float *g, float *b); void yuv_to_rgb(float y, float u, float v, float *lr, float *lg, float *lb); void ycc_to_rgb(float y, float cb, float cr, float *lr, float *lg, float *lb, int colorspace); void xyz_to_rgb(float x, float y, float z, float *r, float *g, float *b, int colorspace); void cpack_to_rgb(unsigned int col, float *r, float *g, float *b); /***************** Conversion from RGB ********************/ void rgb_to_yuv(float r, float g, float b, float *ly, float *lu, float *lv); void rgb_to_ycc(float r, float g, float b, float *ly, float *lcb, float *lcr, int colorspace); void rgb_to_hsv(float r, float g, float b, float *lh, float *ls, float *lv); void rgb_to_hsv_v(const float rgb[3], float r_hsv[3]); void rgb_to_hsl(float r, float g, float b, float *lh, float *ls, float *ll); void rgb_to_hsl_v(const float rgb[3], float r_hsl[3]); void rgb_to_hsl_compat(float r, float g, float b, float *lh, float *ls, float *ll); void rgb_to_hsl_compat_v(const float rgb[3], float r_hsl[3]); void rgb_to_hsv_compat(float r, float g, float b, float *lh, float *ls, float *lv); void rgb_to_hsv_compat_v(const float rgb[3], float r_hsv[3]); void rgb_to_lab(float r, float g, float b, float *ll, float *la, float *lb); void rgb_to_xyz(float r, float g, float b, float *x, float *y, float *z); unsigned int rgb_to_cpack(float r, float g, float b); unsigned int hsv_to_cpack(float h, float s, float v); /**************** Profile Transformations *****************/ float srgb_to_linearrgb(float c); float linearrgb_to_srgb(float c); MINLINE void srgb_to_linearrgb_v3_v3(float linear[3], const float srgb[3]); MINLINE void linearrgb_to_srgb_v3_v3(float srgb[3], const float linear[3]); MINLINE void srgb_to_linearrgb_v4(float linear[4], const float srgb[4]); MINLINE void linearrgb_to_srgb_v4(float srgb[4], const float linear[4]); MINLINE void srgb_to_linearrgb_predivide_v4(float linear[4], const float srgb[4]); MINLINE void linearrgb_to_srgb_predivide_v4(float srgb[4], const float linear[4]); MINLINE unsigned short to_srgb_table_lookup(const float f); MINLINE void linearrgb_to_srgb_ushort4(unsigned short srgb[4], const float linear[4]); MINLINE void srgb_to_linearrgb_uchar4(float linear[4], const unsigned char srgb[4]); MINLINE void srgb_to_linearrgb_uchar4_predivide(float linear[4], const unsigned char srgb[4]); MINLINE void linearrgb_to_srgb_uchar3(unsigned char srgb[3], const float linear[3]); MINLINE void linearrgb_to_srgb_uchar4(unsigned char srgb[4], const float linear[4]); void BLI_init_srgb_conversion(void); /**************** Alpha Transformations *****************/ MINLINE void premul_to_straight_v4_v4(float straight[4], const float premul[4]); MINLINE void premul_to_straight_v4(float color[4]); MINLINE void straight_to_premul_v4_v4(float straight[4], const float premul[4]); MINLINE void straight_to_premul_v4(float color[4]); MINLINE void straight_uchar_to_premul_float(float result[4], const unsigned char color[4]); MINLINE void premul_float_to_straight_uchar(unsigned char *result, const float color[4]); /************************** Other *************************/ int constrain_rgb(float *r, float *g, float *b); void minmax_rgb(short c[3]); void hsv_clamp_v(float hsv[3], float v_max); void rgb_float_set_hue_float_offset(float *rgb, float hue_offset); void rgb_byte_set_hue_float_offset(unsigned char *rgb, float hue_offset); void rgb_uchar_to_float(float r_col[3], const unsigned char col_ub[3]); void rgba_uchar_to_float(float r_col[4], const unsigned char col_ub[4]); void rgb_float_to_uchar(unsigned char r_col[3], const float col_f[3]); void rgba_float_to_uchar(unsigned char r_col[4], const float col_f[4]); void xyz_to_lab(float x, float y, float z, float *l, float *a, float *b); MINLINE float rgb_to_grayscale(const float rgb[3]); MINLINE unsigned char rgb_to_grayscale_byte(const unsigned char rgb[3]); MINLINE int compare_rgb_uchar(const unsigned char a[3], const unsigned char b[3], const int limit); MINLINE float dither_random_value(float s, float t); MINLINE void float_to_byte_dither_v3(unsigned char b[3], const float f[3], float dither, float s, float t); #define rgba_char_args_set_fl(col, r, g, b, a) \ rgba_char_args_set(col, (r) * 255, (g) * 255, (b) * 255, (a) * 255) MINLINE void rgba_char_args_set(char col[4], const char r, const char g, const char b, const char a); MINLINE void rgba_char_args_test_set(char col[4], const char r, const char g, const char b, const char a); MINLINE void cpack_cpy_3ub(unsigned char r_col[3], const unsigned int pack); /********* lift/gamma/gain / ASC-CDL conversion ***********/ void lift_gamma_gain_to_asc_cdl(float *lift, float *gamma, float *gain, float *offset, float *slope, float *power); #if BLI_MATH_DO_INLINE #if 0 /* expanded by -frewrite-includes */ #include "intern/math_color_inline.c" #endif /* expanded by -frewrite-includes */ # 153 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_color.h" # 1 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/intern/math_color_inline.c" 1 /* * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. * All rights reserved. * * The Original Code is: some of this file. * * ***** END GPL LICENSE BLOCK ***** * */ /** \file blender/blenlib/intern/math_color_inline.c * \ingroup bli */ #if 0 /* expanded by -frewrite-includes */ #include "BLI_math_color.h" #endif /* expanded by -frewrite-includes */ # 31 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/intern/math_color_inline.c" # 1 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_color.h" 1 /* * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. * All rights reserved. * * The Original Code is: some of this file. * * ***** END GPL LICENSE BLOCK ***** * */ #ifndef __BLI_MATH_COLOR_H__ #define __BLI_MATH_COLOR_H__ /** \file BLI_math_color.h * \ingroup bli */ #ifdef __cplusplus extern "C" { #endif # 36 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_color.h" #if 0 /* expanded by -frewrite-includes */ #include "BLI_math_inline.h" #endif /* expanded by -frewrite-includes */ # 37 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_color.h" # 38 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_color.h" /* primaries */ #define BLI_XYZ_SMPTE 0 #define BLI_XYZ_REC709_SRGB 1 #define BLI_XYZ_CIE 2 /* built-in profiles */ #define BLI_PR_NONE 0 #define BLI_PR_SRGB 1 #define BLI_PR_REC709 2 /* YCbCr */ #define BLI_YCC_ITU_BT601 0 #define BLI_YCC_ITU_BT709 1 #define BLI_YCC_JFIF_0_255 2 /******************* Conversion to RGB ********************/ void hsv_to_rgb(float h, float s, float v, float *r, float *g, float *b); void hsv_to_rgb_v(const float hsv[3], float r_rgb[3]); void hsl_to_rgb(float h, float c, float l, float *r, float *g, float *b); void hsl_to_rgb_v(const float hcl[3], float r_rgb[3]); void hex_to_rgb(char *hexcol, float *r, float *g, float *b); void yuv_to_rgb(float y, float u, float v, float *lr, float *lg, float *lb); void ycc_to_rgb(float y, float cb, float cr, float *lr, float *lg, float *lb, int colorspace); void xyz_to_rgb(float x, float y, float z, float *r, float *g, float *b, int colorspace); void cpack_to_rgb(unsigned int col, float *r, float *g, float *b); /***************** Conversion from RGB ********************/ void rgb_to_yuv(float r, float g, float b, float *ly, float *lu, float *lv); void rgb_to_ycc(float r, float g, float b, float *ly, float *lcb, float *lcr, int colorspace); void rgb_to_hsv(float r, float g, float b, float *lh, float *ls, float *lv); void rgb_to_hsv_v(const float rgb[3], float r_hsv[3]); void rgb_to_hsl(float r, float g, float b, float *lh, float *ls, float *ll); void rgb_to_hsl_v(const float rgb[3], float r_hsl[3]); void rgb_to_hsl_compat(float r, float g, float b, float *lh, float *ls, float *ll); void rgb_to_hsl_compat_v(const float rgb[3], float r_hsl[3]); void rgb_to_hsv_compat(float r, float g, float b, float *lh, float *ls, float *lv); void rgb_to_hsv_compat_v(const float rgb[3], float r_hsv[3]); void rgb_to_lab(float r, float g, float b, float *ll, float *la, float *lb); void rgb_to_xyz(float r, float g, float b, float *x, float *y, float *z); unsigned int rgb_to_cpack(float r, float g, float b); unsigned int hsv_to_cpack(float h, float s, float v); /**************** Profile Transformations *****************/ float srgb_to_linearrgb(float c); float linearrgb_to_srgb(float c); MINLINE void srgb_to_linearrgb_v3_v3(float linear[3], const float srgb[3]); MINLINE void linearrgb_to_srgb_v3_v3(float srgb[3], const float linear[3]); MINLINE void srgb_to_linearrgb_v4(float linear[4], const float srgb[4]); MINLINE void linearrgb_to_srgb_v4(float srgb[4], const float linear[4]); MINLINE void srgb_to_linearrgb_predivide_v4(float linear[4], const float srgb[4]); MINLINE void linearrgb_to_srgb_predivide_v4(float srgb[4], const float linear[4]); MINLINE unsigned short to_srgb_table_lookup(const float f); MINLINE void linearrgb_to_srgb_ushort4(unsigned short srgb[4], const float linear[4]); MINLINE void srgb_to_linearrgb_uchar4(float linear[4], const unsigned char srgb[4]); MINLINE void srgb_to_linearrgb_uchar4_predivide(float linear[4], const unsigned char srgb[4]); MINLINE void linearrgb_to_srgb_uchar3(unsigned char srgb[3], const float linear[3]); MINLINE void linearrgb_to_srgb_uchar4(unsigned char srgb[4], const float linear[4]); void BLI_init_srgb_conversion(void); /**************** Alpha Transformations *****************/ MINLINE void premul_to_straight_v4_v4(float straight[4], const float premul[4]); MINLINE void premul_to_straight_v4(float color[4]); MINLINE void straight_to_premul_v4_v4(float straight[4], const float premul[4]); MINLINE void straight_to_premul_v4(float color[4]); MINLINE void straight_uchar_to_premul_float(float result[4], const unsigned char color[4]); MINLINE void premul_float_to_straight_uchar(unsigned char *result, const float color[4]); /************************** Other *************************/ int constrain_rgb(float *r, float *g, float *b); void minmax_rgb(short c[3]); void hsv_clamp_v(float hsv[3], float v_max); void rgb_float_set_hue_float_offset(float *rgb, float hue_offset); void rgb_byte_set_hue_float_offset(unsigned char *rgb, float hue_offset); void rgb_uchar_to_float(float r_col[3], const unsigned char col_ub[3]); void rgba_uchar_to_float(float r_col[4], const unsigned char col_ub[4]); void rgb_float_to_uchar(unsigned char r_col[3], const float col_f[3]); void rgba_float_to_uchar(unsigned char r_col[4], const float col_f[4]); void xyz_to_lab(float x, float y, float z, float *l, float *a, float *b); MINLINE float rgb_to_grayscale(const float rgb[3]); MINLINE unsigned char rgb_to_grayscale_byte(const unsigned char rgb[3]); MINLINE int compare_rgb_uchar(const unsigned char a[3], const unsigned char b[3], const int limit); MINLINE float dither_random_value(float s, float t); MINLINE void float_to_byte_dither_v3(unsigned char b[3], const float f[3], float dither, float s, float t); #define rgba_char_args_set_fl(col, r, g, b, a) \ rgba_char_args_set(col, (r) * 255, (g) * 255, (b) * 255, (a) * 255) MINLINE void rgba_char_args_set(char col[4], const char r, const char g, const char b, const char a); MINLINE void rgba_char_args_test_set(char col[4], const char r, const char g, const char b, const char a); MINLINE void cpack_cpy_3ub(unsigned char r_col[3], const unsigned int pack); /********* lift/gamma/gain / ASC-CDL conversion ***********/ void lift_gamma_gain_to_asc_cdl(float *lift, float *gamma, float *gain, float *offset, float *slope, float *power); #if BLI_MATH_DO_INLINE #if 0 /* expanded by -frewrite-includes */ #include "intern/math_color_inline.c" #endif /* expanded by -frewrite-includes */ # 153 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_color.h" # 154 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_color.h" #endif # 155 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_color.h" #ifdef __cplusplus } #endif # 159 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_color.h" #endif /* __BLI_MATH_COLOR_H__ */ # 161 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_color.h" # 32 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/intern/math_color_inline.c" 2 #if 0 /* expanded by -frewrite-includes */ #include "BLI_utildefines.h" #endif /* expanded by -frewrite-includes */ # 32 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/intern/math_color_inline.c" # 33 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/intern/math_color_inline.c" #if 0 /* expanded by -frewrite-includes */ #include "math.h" #endif /* expanded by -frewrite-includes */ # 34 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/intern/math_color_inline.c" # 35 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/intern/math_color_inline.c" #ifndef __MATH_COLOR_INLINE_C__ #define __MATH_COLOR_INLINE_C__ /******************************** Color Space ********************************/ MINLINE void srgb_to_linearrgb_v3_v3(float linear[3], const float srgb[3]) { linear[0] = srgb_to_linearrgb(srgb[0]); linear[1] = srgb_to_linearrgb(srgb[1]); linear[2] = srgb_to_linearrgb(srgb[2]); } MINLINE void linearrgb_to_srgb_v3_v3(float srgb[3], const float linear[3]) { srgb[0] = linearrgb_to_srgb(linear[0]); srgb[1] = linearrgb_to_srgb(linear[1]); srgb[2] = linearrgb_to_srgb(linear[2]); } MINLINE void srgb_to_linearrgb_v4(float linear[4], const float srgb[4]) { srgb_to_linearrgb_v3_v3(linear, srgb); linear[3] = srgb[3]; } MINLINE void linearrgb_to_srgb_v4(float srgb[4], const float linear[4]) { linearrgb_to_srgb_v3_v3(srgb, linear); srgb[3] = linear[3]; } MINLINE void linearrgb_to_srgb_uchar3(unsigned char srgb[3], const float linear[3]) { float srgb_f[3]; linearrgb_to_srgb_v3_v3(srgb_f, linear); F3TOCHAR3(srgb_f, srgb); } MINLINE void linearrgb_to_srgb_uchar4(unsigned char srgb[4], const float linear[4]) { float srgb_f[4]; linearrgb_to_srgb_v4(srgb_f, linear); F4TOCHAR4(srgb_f, srgb); } /* predivide versions to work on associated/pre-multiplied alpha. if this should * be done or not depends on the background the image will be composited over, * ideally you would never do color space conversion on an image with alpha * because it is ill defined */ MINLINE void srgb_to_linearrgb_predivide_v4(float linear[4], const float srgb[4]) { float alpha, inv_alpha; if (srgb[3] == 1.0f || srgb[3] == 0.0f) { alpha = 1.0f; inv_alpha = 1.0f; } else { alpha = srgb[3]; inv_alpha = 1.0f / alpha; } linear[0] = srgb_to_linearrgb(srgb[0] * inv_alpha) * alpha; linear[1] = srgb_to_linearrgb(srgb[1] * inv_alpha) * alpha; linear[2] = srgb_to_linearrgb(srgb[2] * inv_alpha) * alpha; linear[3] = srgb[3]; } MINLINE void linearrgb_to_srgb_predivide_v4(float srgb[4], const float linear[4]) { float alpha, inv_alpha; if (linear[3] == 1.0f || linear[3] == 0.0f) { alpha = 1.0f; inv_alpha = 1.0f; } else { alpha = linear[3]; inv_alpha = 1.0f / alpha; } srgb[0] = linearrgb_to_srgb(linear[0] * inv_alpha) * alpha; srgb[1] = linearrgb_to_srgb(linear[1] * inv_alpha) * alpha; srgb[2] = linearrgb_to_srgb(linear[2] * inv_alpha) * alpha; srgb[3] = linear[3]; } /* LUT accelerated conversions */ extern float BLI_color_from_srgb_table[256]; extern unsigned short BLI_color_to_srgb_table[0x10000]; MINLINE unsigned short to_srgb_table_lookup(const float f) { union { float f; unsigned short us[2]; } tmp; tmp.f = f; #ifdef __BIG_ENDIAN__ return BLI_color_to_srgb_table[tmp.us[0]]; #else # 142 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/intern/math_color_inline.c" return BLI_color_to_srgb_table[tmp.us[1]]; #endif # 144 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/intern/math_color_inline.c" } MINLINE void linearrgb_to_srgb_ushort4(unsigned short srgb[4], const float linear[4]) { srgb[0] = to_srgb_table_lookup(linear[0]); srgb[1] = to_srgb_table_lookup(linear[1]); srgb[2] = to_srgb_table_lookup(linear[2]); srgb[3] = FTOUSHORT(linear[3]); } MINLINE void srgb_to_linearrgb_uchar4(float linear[4], const unsigned char srgb[4]) { linear[0] = BLI_color_from_srgb_table[srgb[0]]; linear[1] = BLI_color_from_srgb_table[srgb[1]]; linear[2] = BLI_color_from_srgb_table[srgb[2]]; linear[3] = srgb[3] * (1.0f / 255.0f); } MINLINE void srgb_to_linearrgb_uchar4_predivide(float linear[4], const unsigned char srgb[4]) { float fsrgb[4]; int i; if (srgb[3] == 255 || srgb[3] == 0) { srgb_to_linearrgb_uchar4(linear, srgb); return; } for (i = 0; i < 4; i++) fsrgb[i] = srgb[i] * (1.0f / 255.0f); srgb_to_linearrgb_predivide_v4(linear, fsrgb); } MINLINE void rgba_char_args_set(char col[4], const char r, const char g, const char b, const char a) { col[0] = r; col[1] = g; col[2] = b; col[3] = a; } MINLINE void rgba_char_args_test_set(char col[4], const char r, const char g, const char b, const char a) { if (col[3] == 0) { col[0] = r; col[1] = g; col[2] = b; col[3] = a; } } MINLINE void cpack_cpy_3ub(unsigned char r_col[3], const unsigned int pack) { r_col[0] = ((pack) >> 0) & 0xFF; r_col[1] = ((pack) >> 8) & 0xFF; r_col[2] = ((pack) >> 16) & 0xFF; } /** \name RGB/Grayscale Functions * * \warning * These are only an approximation, * in almost _all_ cases, #IMB_colormanagement_get_luminance should be used instead. * however for screen-only colors which don't depend on the currently loaded profile - this is preferred. * Checking theme colors for contrast, etc. Basically anything outside the render pipeline. * * \{ */ /** * ITU-R BT.709 primaries * http://en.wikipedia.org/wiki/Relative_luminance * * Real values are: * ``Y = 0.2126390059(R) + 0.7151686788(G) + 0.0721923154(B)`` * according to: "Derivation of Basic Television Color Equations", RP 177-1993 * * As this sums slightly above 1.0, the document recommends to use: * ``0.2126(R) + 0.7152(G) + 0.0722(B)``, as used here. * * The high precision values are used to calculate the rounded byte weights so they add up to 255: * ``54(R) + 182(G) + 19(B)`` */ MINLINE float rgb_to_grayscale(const float rgb[3]) { return (0.2126f * rgb[0]) + (0.7152f * rgb[1]) + (0.0722f * rgb[2]); } MINLINE unsigned char rgb_to_grayscale_byte(const unsigned char rgb[3]) { return (unsigned char)(((54 * (unsigned short)rgb[0]) + (182 * (unsigned short)rgb[1]) + (19 * (unsigned short)rgb[2])) / 255); } /** \} */ MINLINE int compare_rgb_uchar(const unsigned char col_a[3], const unsigned char col_b[3], const int limit) { const int r = (int)col_a[0] - (int)col_b[0]; if (ABS(r) < limit) { const int g = (int)col_a[1] - (int)col_b[1]; if (ABS(g) < limit) { const int b = (int)col_a[2] - (int)col_b[2]; if (ABS(b) < limit) { return 1; } } } return 0; } MINLINE float dither_random_value(float s, float t) { static float vec[2] = {12.9898f, 78.233f}; float value; value = sinf(s * vec[0] + t * vec[1]) * 43758.5453f; return value - floorf(value); } MINLINE void float_to_byte_dither_v3(unsigned char b[3], const float f[3], float dither, float s, float t) { float dither_value = dither_random_value(s, t) * 0.005f * dither; b[0] = FTOCHAR(dither_value + f[0]); b[1] = FTOCHAR(dither_value + f[1]); b[2] = FTOCHAR(dither_value + f[2]); } /**************** Alpha Transformations *****************/ MINLINE void premul_to_straight_v4_v4(float straight[4], const float premul[4]) { if (premul[3] == 0.0f || premul[3] == 1.0f) { straight[0] = premul[0]; straight[1] = premul[1]; straight[2] = premul[2]; straight[3] = premul[3]; } else { const float alpha_inv = 1.0f / premul[3]; straight[0] = premul[0] * alpha_inv; straight[1] = premul[1] * alpha_inv; straight[2] = premul[2] * alpha_inv; straight[3] = premul[3]; } } MINLINE void premul_to_straight_v4(float color[4]) { premul_to_straight_v4_v4(color, color); } MINLINE void straight_to_premul_v4_v4(float premul[4], const float straight[4]) { const float alpha = straight[3]; premul[0] = straight[0] * alpha; premul[1] = straight[1] * alpha; premul[2] = straight[2] * alpha; premul[3] = straight[3]; } MINLINE void straight_to_premul_v4(float color[4]) { straight_to_premul_v4_v4(color, color); } MINLINE void straight_uchar_to_premul_float(float result[4], const unsigned char color[4]) { const float alpha = color[3] * (1.0f / 255.0f); const float fac = alpha * (1.0f / 255.0f); result[0] = color[0] * fac; result[1] = color[1] * fac; result[2] = color[2] * fac; result[3] = alpha; } MINLINE void premul_float_to_straight_uchar(unsigned char *result, const float color[4]) { if (color[3] == 0.0f || color[3] == 1.0f) { result[0] = FTOCHAR(color[0]); result[1] = FTOCHAR(color[1]); result[2] = FTOCHAR(color[2]); result[3] = FTOCHAR(color[3]); } else { const float alpha_inv = 1.0f / color[3]; /* hopefully this would be optimized */ result[0] = FTOCHAR(color[0] * alpha_inv); result[1] = FTOCHAR(color[1] * alpha_inv); result[2] = FTOCHAR(color[2] * alpha_inv); result[3] = FTOCHAR(color[3]); } } #endif /* __MATH_COLOR_INLINE_C__ */ # 347 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/intern/math_color_inline.c" # 154 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_color.h" 2 #endif # 155 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_color.h" #ifdef __cplusplus } #endif # 159 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_color.h" #endif /* __BLI_MATH_COLOR_H__ */ # 161 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_color.h" # 69 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math.h" 2 #if 0 /* expanded by -frewrite-includes */ #include "BLI_math_matrix.h" #endif /* expanded by -frewrite-includes */ # 69 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math.h" # 1 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_matrix.h" 1 /* * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. * All rights reserved. * The Original Code is: some of this file. * * ***** END GPL LICENSE BLOCK ***** * */ #ifndef __BLI_MATH_MATRIX_H__ #define __BLI_MATH_MATRIX_H__ /** \file BLI_math_matrix.h * \ingroup bli */ #ifdef __cplusplus extern "C" { #endif # 36 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_matrix.h" #if 0 /* expanded by -frewrite-includes */ #include "BLI_compiler_attrs.h" #endif /* expanded by -frewrite-includes */ # 37 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_matrix.h" # 38 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_matrix.h" /********************************* Init **************************************/ void zero_m2(float R[2][2]); void zero_m3(float R[3][3]); void zero_m4(float R[4][4]); void unit_m2(float R[2][2]); void unit_m3(float R[3][3]); void unit_m4(float R[4][4]); void copy_m2_m2(float R[2][2], float A[2][2]); void copy_m3_m3(float R[3][3], float A[3][3]); void copy_m4_m4(float R[4][4], float A[4][4]); void copy_m3_m4(float R[3][3], float A[4][4]); void copy_m4_m3(float R[4][4], float A[3][3]); /* double->float */ void copy_m3_m3d(float R[3][3], double A[3][3]); void swap_m3m3(float A[3][3], float B[3][3]); void swap_m4m4(float A[4][4], float B[4][4]); /******************************** Arithmetic *********************************/ void add_m3_m3m3(float R[3][3], float A[3][3], float B[3][3]); void add_m4_m4m4(float R[4][4], float A[4][4], float B[4][4]); void sub_m3_m3m3(float R[3][3], float A[3][3], float B[3][3]); void sub_m4_m4m4(float R[4][4], float A[4][4], float B[4][4]); void mul_m3_m3m3(float R[3][3], float A[3][3], float B[3][3]); void mul_m4_m3m4(float R[4][4], float A[3][3], float B[4][4]); void mul_m4_m4m3(float R[4][4], float A[4][4], float B[3][3]); void mul_m4_m4m4(float R[4][4], float A[4][4], float B[4][4]); void mul_m3_m3m4(float R[3][3], float A[4][4], float B[3][3]); /* mul_m3_series */ void _va_mul_m3_series_3(float R[3][3], float M1[3][3], float M2[3][3]) ATTR_NONNULL(); void _va_mul_m3_series_4(float R[3][3], float M1[3][3], float M2[3][3], float M3[3][3]) ATTR_NONNULL(); void _va_mul_m3_series_5(float R[3][3], float M1[3][3], float M2[3][3], float M3[3][3], float M4[3][3]) ATTR_NONNULL(); void _va_mul_m3_series_6(float R[3][3], float M1[3][3], float M2[3][3], float M3[3][3], float M4[3][3], float M5[3][3]) ATTR_NONNULL(); void _va_mul_m3_series_7(float R[3][3], float M1[3][3], float M2[3][3], float M3[3][3], float M4[3][3], float M5[3][3], float M6[3][3]) ATTR_NONNULL(); void _va_mul_m3_series_8(float R[3][3], float M1[3][3], float M2[3][3], float M3[3][3], float M4[3][3], float M5[3][3], float M6[3][3], float M7[3][3]) ATTR_NONNULL(); void _va_mul_m3_series_9(float R[3][3], float M1[3][3], float M2[3][3], float M3[3][3], float M4[3][3], float M5[3][3], float M6[3][3], float M7[3][3], float M8[3][3]) ATTR_NONNULL(); /* mul_m4_series */ void _va_mul_m4_series_3(float R[4][4], float M1[4][4], float M2[4][4]) ATTR_NONNULL(); void _va_mul_m4_series_4(float R[4][4], float M1[4][4], float M2[4][4], float M3[4][4]) ATTR_NONNULL(); void _va_mul_m4_series_5(float R[4][4], float M1[4][4], float M2[4][4], float M3[4][4], float M4[4][4]) ATTR_NONNULL(); void _va_mul_m4_series_6(float R[4][4], float M1[4][4], float M2[4][4], float M3[4][4], float M4[4][4], float M5[4][4]) ATTR_NONNULL(); void _va_mul_m4_series_7(float R[4][4], float M1[4][4], float M2[4][4], float M3[4][4], float M4[4][4], float M5[4][4], float M6[4][4]) ATTR_NONNULL(); void _va_mul_m4_series_8(float R[4][4], float M1[4][4], float M2[4][4], float M3[4][4], float M4[4][4], float M5[4][4], float M6[4][4], float M7[4][4]) ATTR_NONNULL(); void _va_mul_m4_series_9(float R[4][4], float M1[4][4], float M2[4][4], float M3[4][4], float M4[4][4], float M5[4][4], float M6[4][4], float M7[4][4], float M8[4][4]) ATTR_NONNULL(); #define mul_m3_series(...) VA_NARGS_CALL_OVERLOAD(_va_mul_m3_series_, __VA_ARGS__) #define mul_m4_series(...) VA_NARGS_CALL_OVERLOAD(_va_mul_m4_series_, __VA_ARGS__) void mul_m4_v3(float M[4][4], float r[3]); void mul_v3_m4v3(float r[3], float M[4][4], const float v[3]); void mul_v2_m4v3(float r[2], float M[4][4], const float v[3]); void mul_v2_m2v2(float r[2], float M[2][2], const float v[2]); void mul_m2v2(float M[2][2], float v[2]); void mul_mat3_m4_v3(float M[4][4], float r[3]); void mul_v3_mat3_m4v3(float r[3], float M[4][4], const float v[3]); void mul_m4_v4(float M[4][4], float r[4]); void mul_v4_m4v4(float r[4], float M[4][4], const float v[4]); void mul_project_m4_v3(float M[4][4], float vec[3]); void mul_v3_project_m4_v3(float r[3], float mat[4][4], const float vec[3]); void mul_v2_project_m4_v3(float r[2], float M[4][4], const float vec[3]); void mul_m3_v2(float m[3][3], float r[2]); void mul_v2_m3v2(float r[2], float m[3][3], float v[2]); void mul_m3_v3(float M[3][3], float r[3]); void mul_v3_m3v3(float r[3], float M[3][3], const float a[3]); void mul_v2_m3v3(float r[2], float M[3][3], const float a[3]); void mul_transposed_m3_v3(float M[3][3], float r[3]); void mul_transposed_mat3_m4_v3(float M[4][4], float r[3]); void mul_m3_v3_double(float M[3][3], double r[3]); void mul_m3_fl(float R[3][3], float f); void mul_m4_fl(float R[4][4], float f); void mul_mat3_m4_fl(float R[4][4], float f); void negate_m3(float R[3][3]); void negate_mat3_m4(float R[4][4]); void negate_m4(float R[4][4]); bool invert_m3_ex(float m[3][3], const float epsilon); bool invert_m3_m3_ex(float m1[3][3], float m2[3][3], const float epsilon); bool invert_m3(float R[3][3]); bool invert_m3_m3(float R[3][3], float A[3][3]); bool invert_m4(float R[4][4]); bool invert_m4_m4(float R[4][4], float A[4][4]); /* double ariphmetics */ void mul_m4_v4d(float M[4][4], double r[4]); void mul_v4d_m4v4d(double r[4], float M[4][4], double v[4]); /****************************** Linear Algebra *******************************/ void transpose_m3(float R[3][3]); void transpose_m3_m3(float R[3][3], float A[3][3]); void transpose_m3_m4(float R[3][3], float A[4][4]); void transpose_m4(float R[4][4]); void transpose_m4_m4(float R[4][4], float A[4][4]); int compare_m4m4(float mat1[4][4], float mat2[4][4], float limit); void normalize_m3(float R[3][3]); void normalize_m3_m3(float R[3][3], float A[3][3]); void normalize_m4(float R[4][4]); void normalize_m4_m4(float R[4][4], float A[4][4]); void orthogonalize_m3(float R[3][3], int axis); void orthogonalize_m4(float R[4][4], int axis); bool is_orthogonal_m3(float mat[3][3]); bool is_orthogonal_m4(float mat[4][4]); bool is_orthonormal_m3(float mat[3][3]); bool is_orthonormal_m4(float mat[4][4]); bool is_uniform_scaled_m3(float mat[3][3]); bool is_uniform_scaled_m4(float m[4][4]); void adjoint_m2_m2(float R[2][2], float A[2][2]); void adjoint_m3_m3(float R[3][3], float A[3][3]); void adjoint_m4_m4(float R[4][4], float A[4][4]); float determinant_m2(float a, float b, float c, float d); float determinant_m3(float a, float b, float c, float d, float e, float f, float g, float h, float i); float determinant_m3_array(float m[3][3]); float determinant_m4(float A[4][4]); #define PSEUDOINVERSE_EPSILON 1e-8f void svd_m4(float U[4][4], float s[4], float V[4][4], float A[4][4]); void pseudoinverse_m4_m4(float Ainv[4][4], float A[4][4], float epsilon); void pseudoinverse_m3_m3(float Ainv[3][3], float A[3][3], float epsilon); bool has_zero_axis_m4(float matrix[4][4]); void invert_m4_m4_safe(float Ainv[4][4], float A[4][4]); /****************************** Transformations ******************************/ void scale_m3_fl(float R[3][3], float scale); void scale_m4_fl(float R[4][4], float scale); float mat3_to_scale(float M[3][3]); float mat4_to_scale(float M[4][4]); void size_to_mat3(float R[3][3], const float size[3]); void size_to_mat4(float R[4][4], const float size[3]); void mat3_to_size(float r[3], float M[3][3]); void mat4_to_size(float r[3], float M[4][4]); void translate_m4(float mat[4][4], float tx, float ty, float tz); void rotate_m4(float mat[4][4], const char axis, const float angle); void rotate_m2(float mat[2][2], const float angle); void transform_pivot_set_m4(float mat[4][4], const float pivot[3]); void mat3_to_rot_size(float rot[3][3], float size[3], float mat3[3][3]); void mat4_to_loc_rot_size(float loc[3], float rot[3][3], float size[3], float wmat[4][4]); void mat4_to_loc_quat(float loc[3], float quat[4], float wmat[4][4]); void mat4_decompose(float loc[3], float quat[4], float size[3], float wmat[4][4]); void loc_eul_size_to_mat4(float R[4][4], const float loc[3], const float eul[3], const float size[3]); void loc_eulO_size_to_mat4(float R[4][4], const float loc[3], const float eul[3], const float size[3], const short order); void loc_quat_size_to_mat4(float R[4][4], const float loc[3], const float quat[4], const float size[3]); void loc_axisangle_size_to_mat4(float R[4][4], const float loc[3], const float axis[4], const float angle, const float size[3]); void blend_m3_m3m3(float R[3][3], float A[3][3], float B[3][3], const float t); void blend_m4_m4m4(float R[4][4], float A[4][4], float B[4][4], const float t); bool is_negative_m3(float mat[3][3]); bool is_negative_m4(float mat[4][4]); bool is_zero_m3(float mat[3][3]); bool is_zero_m4(float mat[4][4]); /* SpaceTransform helper */ typedef struct SpaceTransform { float local2target[4][4]; float target2local[4][4]; } SpaceTransform; void BLI_space_transform_from_matrices(struct SpaceTransform *data, float local[4][4], float target[4][4]); void BLI_space_transform_apply(const struct SpaceTransform *data, float co[3]); void BLI_space_transform_invert(const struct SpaceTransform *data, float co[3]); void BLI_space_transform_apply_normal(const struct SpaceTransform *data, float no[3]); void BLI_space_transform_invert_normal(const struct SpaceTransform *data, float no[3]); #define BLI_SPACE_TRANSFORM_SETUP(data, local, target) \ BLI_space_transform_from_matrices((data), (local)->obmat, (target)->obmat) /*********************************** Other ***********************************/ void print_m3(const char *str, float M[3][3]); void print_m4(const char *str, float M[3][4]); #define print_m3_id(M) print_m3(STRINGIFY(M), M) #define print_m4_id(M) print_m4(STRINGIFY(M), M) #ifdef __cplusplus } #endif # 263 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_matrix.h" #endif /* __BLI_MATH_MATRIX_H__ */ # 265 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_matrix.h" # 70 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math.h" 2 #if 0 /* expanded by -frewrite-includes */ #include "BLI_math_rotation.h" #endif /* expanded by -frewrite-includes */ # 70 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math.h" # 1 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_rotation.h" 1 /* * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. * All rights reserved. * * The Original Code is: some of this file. * * ***** END GPL LICENSE BLOCK ***** * */ #ifndef __BLI_MATH_ROTATION_H__ #define __BLI_MATH_ROTATION_H__ /** \file BLI_math_rotation.h * \ingroup bli */ #ifdef __cplusplus extern "C" { #endif # 36 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_rotation.h" #define RAD2DEG(_rad) ((_rad) * (180.0 / M_PI)) #define DEG2RAD(_deg) ((_deg) * (M_PI / 180.0)) #define RAD2DEGF(_rad) ((_rad) * (float)(180.0 / M_PI)) #define DEG2RADF(_deg) ((_deg) * (float)(M_PI / 180.0)) /******************************** Quaternions ********************************/ /* stored in (w, x, y, z) order */ /* init */ void unit_axis_angle(float axis[3], float *angle); void unit_qt(float q[4]); void copy_qt_qt(float q[4], const float a[4]); /* arithmetic */ void mul_qt_qtqt(float q[4], const float a[4], const float b[4]); void mul_qt_v3(const float q[4], float r[3]); void mul_qt_fl(float q[4], const float f); void mul_fac_qt_fl(float q[4], const float f); void sub_qt_qtqt(float q[4], const float a[4], const float b[4]); void invert_qt(float q[4]); void invert_qt_qt(float q1[4], const float q2[4]); void conjugate_qt(float q[4]); void conjugate_qt_qt(float q1[4], const float q2[4]); float dot_qtqt(const float a[4], const float b[4]); float normalize_qt(float q[4]); float normalize_qt_qt(float q1[4], const float q2[4]); /* comparison */ bool is_zero_qt(const float q[4]); /* interpolation */ void interp_dot_slerp(const float t, const float cosom, float w[2]); void interp_qt_qtqt(float q[4], const float a[4], const float b[4], const float t); void add_qt_qtqt(float q[4], const float a[4], const float b[4], const float t); /* conversion */ void quat_to_mat3(float mat[3][3], const float q[4]); void quat_to_mat4(float mat[4][4], const float q[4]); void mat3_to_quat(float q[4], float mat[3][3]); void mat4_to_quat(float q[4], float mat[4][4]); void tri_to_quat_ex(float quat[4], const float v1[3], const float v2[3], const float v3[3], const float no_orig[3]); float tri_to_quat(float q[4], const float a[3], const float b[3], const float c[3]); void vec_to_quat(float q[4], const float vec[3], short axis, const short upflag); /* note: v1 and v2 must be normalized */ void rotation_between_vecs_to_mat3(float m[3][3], const float v1[3], const float v2[3]); void rotation_between_vecs_to_quat(float q[4], const float v1[3], const float v2[3]); void rotation_between_quats_to_quat(float q[4], const float q1[4], const float q2[4]); float angle_normalized_qt(const float q[4]); float angle_normalized_qtqt(const float q1[4], const float q2[4]); float angle_qt(const float q[4]); float angle_qtqt(const float q1[4], const float q2[4]); /* TODO: don't what this is, but it's not the same as mat3_to_quat */ void mat3_to_quat_is_ok(float q[4], float mat[3][3]); /* other */ void print_qt(const char *str, const float q[4]); #define print_qt_id(q) print_qt(STRINGIFY(q), q) /******************************** Axis Angle *********************************/ /* conversion */ void axis_angle_normalized_to_quat(float r[4], const float axis[3], const float angle); void axis_angle_to_quat(float r[4], const float axis[3], const float angle); void axis_angle_to_mat3(float R[3][3], const float axis[3], const float angle); void axis_angle_normalized_to_mat3_ex(float mat[3][3], const float axis[3], const float angle_sin, const float angle_cos); void axis_angle_normalized_to_mat3(float R[3][3], const float axis[3], const float angle); void axis_angle_to_mat4(float R[4][4], const float axis[3], const float angle); void quat_to_axis_angle(float axis[3], float *angle, const float q[4]); void mat3_to_axis_angle(float axis[3], float *angle, float M[3][3]); void mat4_to_axis_angle(float axis[3], float *angle, float M[4][4]); void axis_angle_to_mat3_single(float R[3][3], const char axis, const float angle); void angle_to_mat2(float R[2][2], const float angle); /****************************** Exponential Map ******************************/ void quat_to_expmap(float expmap[3], const float q[4]); void quat_normalized_to_expmap(float expmap[3], const float q[4]); void expmap_to_quat(float r[4], const float expmap[3]); /******************************** XYZ Eulers *********************************/ void eul_to_quat(float quat[4], const float eul[3]); void eul_to_mat3(float mat[3][3], const float eul[3]); void eul_to_mat4(float mat[4][4], const float eul[3]); void quat_to_eul(float eul[3], const float quat[4]); void mat3_to_eul(float eul[3], float mat[3][3]); void mat4_to_eul(float eul[3], float mat[4][4]); void compatible_eul(float eul[3], const float old[3]); void mat3_to_compatible_eul(float eul[3], const float old[3], float mat[3][3]); void rotate_eul(float eul[3], const char axis, const float angle); /************************** Arbitrary Order Eulers ***************************/ /* warning: must match the eRotationModes in DNA_action_types.h * order matters - types are saved to file. */ typedef enum eEulerRotationOrders { EULER_ORDER_DEFAULT = 1, /* blender classic = XYZ */ EULER_ORDER_XYZ = 1, EULER_ORDER_XZY, EULER_ORDER_YXZ, EULER_ORDER_YZX, EULER_ORDER_ZXY, EULER_ORDER_ZYX /* there are 6 more entries with dulpicate entries included */ } eEulerRotationOrders; void eulO_to_quat(float quat[4], const float eul[3], const short order); void eulO_to_mat3(float mat[3][3], const float eul[3], const short order); void eulO_to_mat4(float mat[4][4], const float eul[3], const short order); void eulO_to_axis_angle(float axis[3], float *angle, const float eul[3], const short order); void eulO_to_gimbal_axis(float gmat[3][3], const float eul[3], const short order); void quat_to_eulO(float eul[3], const short order, const float quat[4]); void mat3_to_eulO(float eul[3], const short order, float mat[3][3]); void mat4_to_eulO(float eul[3], const short order, float mat[4][4]); void axis_angle_to_eulO(float eul[3], const short order, const float axis[3], const float angle); void mat3_to_compatible_eulO(float eul[3], float old[3], const short order, float mat[3][3]); void mat4_to_compatible_eulO(float eul[3], float old[3], const short order, float mat[4][4]); void rotate_eulO(float eul[3], const short order, char axis, float angle); /******************************* Dual Quaternions ****************************/ typedef struct DualQuat { float quat[4]; float trans[4]; float scale[4][4]; float scale_weight; } DualQuat; void copy_dq_dq(DualQuat *r, const DualQuat *dq); void normalize_dq(DualQuat *dq, float totw); void add_weighted_dq_dq(DualQuat *r, const DualQuat *dq, float weight); void mul_v3m3_dq(float r[3], float R[3][3], DualQuat *dq); void mat4_to_dquat(DualQuat *r, float base[4][4], float M[4][4]); void dquat_to_mat4(float R[4][4], const DualQuat *dq); void quat_apply_track(float quat[4], short axis, short upflag); void vec_apply_track(float vec[3], short axis); float focallength_to_fov(float focal_length, float sensor); float fov_to_focallength(float fov, float sensor); float angle_wrap_rad(float angle); float angle_wrap_deg(float angle); float angle_compat_rad(float angle, float angle_compat); int mat3_from_axis_conversion(int from_forward, int from_up, int to_forward, int to_up, float r_mat[3][3]); #ifdef __cplusplus } #endif # 209 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_rotation.h" #endif /* __BLI_MATH_ROTATION_H__ */ # 211 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_rotation.h" # 71 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math.h" 2 #if 0 /* expanded by -frewrite-includes */ #include "BLI_math_vector.h" #endif /* expanded by -frewrite-includes */ # 71 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math.h" # 1 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_vector.h" 1 /* * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. * All rights reserved. * * The Original Code is: some of this file. * * ***** END GPL LICENSE BLOCK ***** * */ #ifndef __BLI_MATH_VECTOR_H__ #define __BLI_MATH_VECTOR_H__ /** \file BLI_math_vector.h * \ingroup bli */ #ifdef __cplusplus extern "C" { #endif # 36 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_vector.h" #if 0 /* expanded by -frewrite-includes */ #include "BLI_compiler_attrs.h" #endif /* expanded by -frewrite-includes */ # 37 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_vector.h" # 38 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_vector.h" #if 0 /* expanded by -frewrite-includes */ #include "BLI_math_inline.h" #endif /* expanded by -frewrite-includes */ # 38 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_vector.h" # 39 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_vector.h" /************************************* Init ***********************************/ #ifdef BLI_MATH_GCC_WARN_PRAGMA # pragma GCC diagnostic push # pragma GCC diagnostic ignored "-Wredundant-decls" #endif # 46 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_vector.h" MINLINE void zero_v2(float r[2]); MINLINE void zero_v3(float r[3]); MINLINE void zero_v4(float r[4]); MINLINE void copy_v2_v2(float r[2], const float a[2]); MINLINE void copy_v3_v3(float r[3], const float a[3]); MINLINE void copy_v4_v4(float r[4], const float a[4]); MINLINE void copy_v2_fl(float r[2], float f); MINLINE void copy_v3_fl(float r[3], float f); MINLINE void copy_v4_fl(float r[4], float f); MINLINE void swap_v2_v2(float a[2], float b[2]); MINLINE void swap_v3_v3(float a[3], float b[3]); MINLINE void swap_v4_v4(float a[4], float b[4]); /* char */ MINLINE void copy_v2_v2_char(char r[2], const char a[2]); MINLINE void copy_v3_v3_char(char r[3], const char a[3]); MINLINE void copy_v4_v4_char(char r[4], const char a[4]); /* short */ MINLINE void copy_v2_v2_short(short r[2], const short a[2]); MINLINE void copy_v3_v3_short(short r[3], const short a[3]); MINLINE void copy_v4_v4_short(short r[4], const short a[4]); /* int */ MINLINE void zero_v3_int(int r[3]); MINLINE void copy_v2_v2_int(int r[2], const int a[2]); MINLINE void copy_v3_v3_int(int r[3], const int a[3]); MINLINE void copy_v4_v4_int(int r[4], const int a[4]); /* double -> float */ MINLINE void copy_v2fl_v2db(float r[2], const double a[2]); MINLINE void copy_v3fl_v3db(float r[3], const double a[3]); MINLINE void copy_v4fl_v4db(float r[4], const double a[4]); /* float -> double */ MINLINE void copy_v2db_v2fl(double r[2], const float a[2]); MINLINE void copy_v3db_v3fl(double r[3], const float a[3]); MINLINE void copy_v4db_v4fl(double r[4], const float a[4]); /* float args -> vec */ MINLINE void copy_v2_fl2(float v[2], float x, float y); MINLINE void copy_v3_fl3(float v[3], float x, float y, float z); MINLINE void copy_v4_fl4(float v[4], float x, float y, float z, float w); /********************************* Arithmetic ********************************/ MINLINE void add_v2_fl(float r[2], float f); MINLINE void add_v3_fl(float r[3], float f); MINLINE void add_v4_fl(float r[4], float f); MINLINE void add_v2_v2(float r[2], const float a[2]); MINLINE void add_v2_v2v2(float r[2], const float a[2], const float b[2]); MINLINE void add_v2_v2v2_int(int r[2], const int a[2], const int b[2]); MINLINE void add_v3_v3(float r[3], const float a[3]); MINLINE void add_v3_v3v3(float r[3], const float a[3], const float b[3]); MINLINE void add_v4_v4(float r[4], const float a[4]); MINLINE void add_v4_v4v4(float r[4], const float a[4], const float b[4]); MINLINE void sub_v2_v2(float r[2], const float a[2]); MINLINE void sub_v2_v2v2(float r[2], const float a[2], const float b[2]); MINLINE void sub_v2_v2v2_int(int r[2], const int a[2], const int b[2]); MINLINE void sub_v3_v3(float r[3], const float a[3]); MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3]); MINLINE void sub_v4_v4(float r[4], const float a[4]); MINLINE void sub_v4_v4v4(float r[4], const float a[4], const float b[4]); MINLINE void mul_v2_fl(float r[2], float f); MINLINE void mul_v2_v2fl(float r[2], const float a[2], float f); MINLINE void mul_v3_fl(float r[3], float f); MINLINE void mul_v3_v3fl(float r[3], const float a[3], float f); MINLINE void mul_v2_v2(float r[2], const float a[2]); MINLINE void mul_v3_v3(float r[3], const float a[3]); MINLINE void mul_v3_v3v3(float r[3], const float a[3], const float b[3]); MINLINE void mul_v4_fl(float r[4], float f); MINLINE void mul_v4_v4fl(float r[3], const float a[3], float f); MINLINE void mul_v2_v2_cw(float r[2], const float mat[2], const float vec[2]); MINLINE void mul_v2_v2_ccw(float r[2], const float mat[2], const float vec[2]); MINLINE float mul_project_m4_v3_zfac(float mat[4][4], const float co[3]) ATTR_WARN_UNUSED_RESULT; MINLINE float dot_m3_v3_row_x(float M[3][3], const float a[3]) ATTR_WARN_UNUSED_RESULT; MINLINE float dot_m3_v3_row_y(float M[3][3], const float a[3]) ATTR_WARN_UNUSED_RESULT; MINLINE float dot_m3_v3_row_z(float M[3][3], const float a[3]) ATTR_WARN_UNUSED_RESULT; MINLINE float dot_m4_v3_row_x(float M[4][4], const float a[3]) ATTR_WARN_UNUSED_RESULT; MINLINE float dot_m4_v3_row_y(float M[4][4], const float a[3]) ATTR_WARN_UNUSED_RESULT; MINLINE float dot_m4_v3_row_z(float M[4][4], const float a[3]) ATTR_WARN_UNUSED_RESULT; MINLINE void madd_v2_v2fl(float r[2], const float a[2], float f); MINLINE void madd_v3_v3fl(float r[3], const float a[3], float f); MINLINE void madd_v3_v3v3(float r[3], const float a[3], const float b[3]); MINLINE void madd_v2_v2v2fl(float r[2], const float a[2], const float b[2], float f); MINLINE void madd_v3_v3v3fl(float r[3], const float a[3], const float b[3], float f); MINLINE void madd_v3_v3v3v3(float r[3], const float a[3], const float b[3], const float c[3]); MINLINE void madd_v4_v4fl(float r[4], const float a[4], float f); MINLINE void madd_v4_v4v4(float r[4], const float a[4], const float b[4]); MINLINE void negate_v2(float r[2]); MINLINE void negate_v2_v2(float r[2], const float a[2]); MINLINE void negate_v3(float r[3]); MINLINE void negate_v3_v3(float r[3], const float a[3]); MINLINE void negate_v4(float r[4]); MINLINE void negate_v4_v4(float r[4], const float a[3]); MINLINE void negate_v3_short(short r[3]); MINLINE void abs_v2(float r[2]); MINLINE void abs_v2_v2(float r[2], const float a[2]); MINLINE void abs_v3(float r[3]); MINLINE void abs_v3_v3(float r[3], const float a[3]); MINLINE void abs_v4(float r[4]); MINLINE void abs_v4_v4(float r[4], const float a[4]); MINLINE float dot_v2v2(const float a[2], const float b[2]) ATTR_WARN_UNUSED_RESULT; MINLINE float dot_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT; MINLINE float dot_v3v3v3(const float p[3], const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT; MINLINE float dot_v4v4(const float a[4], const float b[4]) ATTR_WARN_UNUSED_RESULT; MINLINE double dot_v3db_v3fl(const double a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT; MINLINE float cross_v2v2(const float a[2], const float b[2]) ATTR_WARN_UNUSED_RESULT; MINLINE void cross_v3_v3v3(float r[3], const float a[3], const float b[3]); MINLINE void add_newell_cross_v3_v3v3(float n[3], const float v_prev[3], const float v_curr[3]); MINLINE void star_m3_v3(float rmat[3][3], float a[3]); /*********************************** Length **********************************/ MINLINE float len_squared_v2(const float v[2]) ATTR_WARN_UNUSED_RESULT; MINLINE float len_squared_v3(const float v[3]) ATTR_WARN_UNUSED_RESULT; MINLINE float len_manhattan_v2(const float v[2]) ATTR_WARN_UNUSED_RESULT; MINLINE int len_manhattan_v2_int(const int v[2]) ATTR_WARN_UNUSED_RESULT; MINLINE float len_manhattan_v3(const float v[3]) ATTR_WARN_UNUSED_RESULT; MINLINE float len_v2(const float a[2]) ATTR_WARN_UNUSED_RESULT; MINLINE float len_v2v2(const float a[2], const float b[2]) ATTR_WARN_UNUSED_RESULT; MINLINE float len_v2v2_int(const int v1[2], const int v2[2]); MINLINE float len_squared_v2v2(const float a[2], const float b[2]) ATTR_WARN_UNUSED_RESULT; MINLINE float len_squared_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT; MINLINE float len_manhattan_v2v2(const float a[2], const float b[2]) ATTR_WARN_UNUSED_RESULT; MINLINE int len_manhattan_v2v2_int(const int a[2], const int b[2]) ATTR_WARN_UNUSED_RESULT; MINLINE float len_manhattan_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT; MINLINE float len_v3(const float a[3]) ATTR_WARN_UNUSED_RESULT; MINLINE float len_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT; MINLINE float normalize_v2(float r[2]); MINLINE float normalize_v2_v2(float r[2], const float a[2]); MINLINE float normalize_v3(float r[3]); MINLINE float normalize_v3_v3(float r[3], const float a[3]); MINLINE double normalize_v3_d(double n[3]); /******************************* Interpolation *******************************/ void interp_v2_v2v2(float r[2], const float a[2], const float b[2], const float t); void interp_v2_v2v2v2(float r[2], const float a[2], const float b[2], const float c[2], const float t[3]); void interp_v3_v3v3(float r[3], const float a[3], const float b[3], const float t); void interp_v3_v3v3v3(float p[3], const float v1[3], const float v2[3], const float v3[3], const float w[3]); void interp_v3_v3v3v3v3(float p[3], const float v1[3], const float v2[3], const float v3[3], const float v4[3], const float w[4]); void interp_v4_v4v4(float r[4], const float a[4], const float b[4], const float t); void interp_v4_v4v4v4(float p[4], const float v1[4], const float v2[4], const float v3[4], const float w[3]); void interp_v4_v4v4v4v4(float p[4], const float v1[4], const float v2[4], const float v3[4], const float v4[4], const float w[4]); void interp_v3_v3v3v3_uv(float p[3], const float v1[3], const float v2[3], const float v3[3], const float uv[2]); bool interp_v3_v3v3_slerp(float target[3], const float a[3], const float b[3], const float t) ATTR_WARN_UNUSED_RESULT; bool interp_v2_v2v2_slerp(float target[2], const float a[2], const float b[2], const float t) ATTR_WARN_UNUSED_RESULT; void interp_v3_v3v3_slerp_safe(float target[3], const float a[3], const float b[3], const float t); void interp_v2_v2v2_slerp_safe(float target[2], const float a[2], const float b[2], const float t); void interp_v3_v3v3_char(char target[3], const char a[3], const char b[3], const float t); void interp_v3_v3v3_uchar(unsigned char target[3], const unsigned char a[3], const unsigned char b[3], const float t); void interp_v4_v4v4_char(char target[4], const char a[4], const char b[4], const float t); void interp_v4_v4v4_uchar(unsigned char target[4], const unsigned char a[4], const unsigned char b[4], const float t); void mid_v3_v3v3(float r[3], const float a[3], const float b[3]); void mid_v2_v2v2(float r[2], const float a[2], const float b[2]); void mid_v3_v3v3v3(float v[3], const float v1[3], const float v2[3], const float v3[3]); void mid_v3_v3v3v3v3(float v[3], const float v1[3], const float v2[3], const float v3[3], const float v4[3]); void mid_v3_v3v3_angle_weighted(float r[3], const float a[3], const float b[3]); void mid_v3_angle_weighted(float r[3]); void flip_v4_v4v4(float v[4], const float v1[4], const float v2[4]); void flip_v3_v3v3(float v[3], const float v1[3], const float v2[3]); void flip_v2_v2v2(float v[2], const float v1[2], const float v2[2]); /********************************* Comparison ********************************/ MINLINE bool is_zero_v2(const float a[3]) ATTR_WARN_UNUSED_RESULT; MINLINE bool is_zero_v3(const float a[3]) ATTR_WARN_UNUSED_RESULT; MINLINE bool is_zero_v4(const float a[4]) ATTR_WARN_UNUSED_RESULT; MINLINE bool is_finite_v2(const float a[3]) ATTR_WARN_UNUSED_RESULT; MINLINE bool is_finite_v3(const float a[3]) ATTR_WARN_UNUSED_RESULT; MINLINE bool is_finite_v4(const float a[4]) ATTR_WARN_UNUSED_RESULT; MINLINE bool is_one_v3(const float a[3]) ATTR_WARN_UNUSED_RESULT; MINLINE bool equals_v2v2(const float v1[2], const float v2[2]) ATTR_WARN_UNUSED_RESULT; MINLINE bool equals_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT; MINLINE bool compare_v2v2(const float a[2], const float b[2], const float limit) ATTR_WARN_UNUSED_RESULT; MINLINE bool compare_v3v3(const float a[3], const float b[3], const float limit) ATTR_WARN_UNUSED_RESULT; MINLINE bool compare_len_v3v3(const float a[3], const float b[3], const float limit) ATTR_WARN_UNUSED_RESULT; MINLINE bool compare_len_squared_v3v3(const float a[3], const float b[3], const float limit) ATTR_WARN_UNUSED_RESULT; MINLINE bool compare_v4v4(const float a[4], const float b[4], const float limit) ATTR_WARN_UNUSED_RESULT; MINLINE bool equals_v4v4(const float a[4], const float b[4]) ATTR_WARN_UNUSED_RESULT; MINLINE float line_point_side_v2(const float l1[2], const float l2[2], const float pt[2]) ATTR_WARN_UNUSED_RESULT; /********************************** Angles ***********************************/ /* - angle with 2 arguments is angle between vector */ /* - angle with 3 arguments is angle between 3 points at the middle point */ /* - angle_normalized_* is faster equivalent if vectors are normalized */ float angle_v2v2(const float a[2], const float b[2]) ATTR_WARN_UNUSED_RESULT; float angle_signed_v2v2(const float v1[2], const float v2[2]) ATTR_WARN_UNUSED_RESULT; float angle_v2v2v2(const float a[2], const float b[2], const float c[2]) ATTR_WARN_UNUSED_RESULT; float angle_normalized_v2v2(const float a[2], const float b[2]) ATTR_WARN_UNUSED_RESULT; float angle_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT; float angle_v3v3v3(const float a[3], const float b[3], const float c[3]) ATTR_WARN_UNUSED_RESULT; float cos_v3v3v3(const float p1[3], const float p2[3], const float p3[3]) ATTR_WARN_UNUSED_RESULT; float angle_normalized_v3v3(const float v1[3], const float v2[3]) ATTR_WARN_UNUSED_RESULT; float angle_on_axis_v3v3v3_v3(const float v1[3], const float v2[3], const float v3[3], const float axis[3]) ATTR_WARN_UNUSED_RESULT; float angle_signed_on_axis_v3v3v3_v3(const float v1[3], const float v2[3], const float v3[3], const float axis[3]) ATTR_WARN_UNUSED_RESULT; void angle_tri_v3(float angles[3], const float v1[3], const float v2[3], const float v3[3]); void angle_quad_v3(float angles[4], const float v1[3], const float v2[3], const float v3[3], const float v4[3]); void angle_poly_v3(float *angles, const float *verts[3], int len); /********************************* Geometry **********************************/ void project_v2_v2v2(float c[2], const float v1[2], const float v2[2]); void project_v3_v3v3(float r[3], const float p[3], const float n[3]); void project_plane_v3_v3v3(float c[3], const float v[3], const float v_plane[3]); void project_plane_v2_v2v2(float c[2], const float v[2], const float v_plane[2]); void project_v3_plane(float v[3], const float n[3], const float p[3]); void reflect_v3_v3v3(float r[3], const float v[3], const float n[3]); void ortho_basis_v3v3_v3(float r_n1[3], float r_n2[3], const float n[3]); void ortho_v3_v3(float p[3], const float v[3]); void ortho_v2_v2(float p[2], const float v[2]); void bisect_v3_v3v3v3(float r[3], const float a[3], const float b[3], const float c[3]); void rotate_v3_v3v3fl(float v[3], const float p[3], const float axis[3], const float angle); void rotate_normalized_v3_v3v3fl(float v[3], const float p[3], const float axis[3], const float angle); /*********************************** Other ***********************************/ void print_v2(const char *str, const float a[2]); void print_v3(const char *str, const float a[3]); void print_v4(const char *str, const float a[4]); void print_vn(const char *str, const float v[], const int n); #define print_v2_id(v) print_v2(STRINGIFY(v), v) #define print_v3_id(v) print_v3(STRINGIFY(v), v) #define print_v4_id(v) print_v4(STRINGIFY(v), v) #define print_vn_id(v, n) print_vn(STRINGIFY(v), v, n) MINLINE void normal_short_to_float_v3(float r[3], const short n[3]); MINLINE void normal_float_to_short_v3(short r[3], const float n[3]); void minmax_v3v3_v3(float min[3], float max[3], const float vec[3]); void minmax_v2v2_v2(float min[2], float max[2], const float vec[2]); void minmax_v3v3_v3_array(float r_min[3], float r_max[3], float (*vec_arr)[3], int nbr); void dist_ensure_v3_v3fl(float v1[3], const float v2[3], const float dist); void dist_ensure_v2_v2fl(float v1[2], const float v2[2], const float dist); void axis_sort_v3(const float axis_values[3], int r_axis_order[3]); /***************************** Array Functions *******************************/ /* follow fixed length vector function conventions. */ double dot_vn_vn(const float *array_src_a, const float *array_src_b, const int size) ATTR_WARN_UNUSED_RESULT; double len_squared_vn(const float *array, const int size) ATTR_WARN_UNUSED_RESULT; float normalize_vn_vn(float *array_tar, const float *array_src, const int size); float normalize_vn(float *array_tar, const int size); void range_vn_i(int *array_tar, const int size, const int start); void range_vn_u(unsigned int *array_tar, const int size, const unsigned int start); void range_vn_fl(float *array_tar, const int size, const float start, const float step); void negate_vn(float *array_tar, const int size); void negate_vn_vn(float *array_tar, const float *array_src, const int size); void mul_vn_fl(float *array_tar, const int size, const float f); void mul_vn_vn_fl(float *array_tar, const float *array_src, const int size, const float f); void add_vn_vn(float *array_tar, const float *array_src, const int size); void add_vn_vnvn(float *array_tar, const float *array_src_a, const float *array_src_b, const int size); void madd_vn_vn(float *array_tar, const float *array_src, const float f, const int size); void madd_vn_vnvn(float *array_tar, const float *array_src_a, const float *array_src_b, const float f, const int size); void sub_vn_vn(float *array_tar, const float *array_src, const int size); void sub_vn_vnvn(float *array_tar, const float *array_src_a, const float *array_src_b, const int size); void msub_vn_vn(float *array_tar, const float *array_src, const float f, const int size); void msub_vn_vnvn(float *array_tar, const float *array_src_a, const float *array_src_b, const float f, const int size); void interp_vn_vn(float *array_tar, const float *array_src, const float t, const int size); void copy_vn_i(int *array_tar, const int size, const int val); void copy_vn_short(short *array_tar, const int size, const short val); void copy_vn_ushort(unsigned short *array_tar, const int size, const unsigned short val); void copy_vn_uchar(unsigned char *array_tar, const int size, const unsigned char val); void copy_vn_fl(float *array_tar, const int size, const float val); void add_vn_vn_d(double *array_tar, const double *array_src, const int size); void add_vn_vnvn_d(double *array_tar, const double *array_src_a, const double *array_src_b, const int size); void mul_vn_db(double *array_tar, const int size, const double f); /**************************** Inline Definitions ******************************/ #if BLI_MATH_DO_INLINE #if 0 /* expanded by -frewrite-includes */ #include "intern/math_vector_inline.c" #endif /* expanded by -frewrite-includes */ # 347 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_vector.h" # 1 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/intern/math_vector_inline.c" 1 /* * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. * All rights reserved. * * The Original Code is: some of this file. * * ***** END GPL LICENSE BLOCK ***** * */ /** \file blender/blenlib/intern/math_vector_inline.c * \ingroup bli */ #ifndef __MATH_VECTOR_INLINE_C__ #define __MATH_VECTOR_INLINE_C__ #if 0 /* expanded by -frewrite-includes */ #include "BLI_math.h" #endif /* expanded by -frewrite-includes */ # 33 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/intern/math_vector_inline.c" # 1 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math.h" 1 /* * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. * All rights reserved. * * The Original Code is: some of this file. * * ***** END GPL LICENSE BLOCK ***** * */ #ifndef __BLI_MATH_H__ #define __BLI_MATH_H__ /** \file BLI_math.h * \ingroup bli * \section mathabbrev Abbreviations * * - ``fl`` = float * - ``db`` = double * - ``v2`` = vec2 = vector 2 * - ``v3`` = vec3 = vector 3 * - ``v4`` = vec4 = vector 4 * - ``vn`` = vec4 = vector N dimensions, *passed as an arg, after the vector*. * - ``qt`` = quat = quaternion * - ``dq`` = dquat = dual quaternion * - ``m2`` = mat2 = matrix 2x2 * - ``m3`` = mat3 = matrix 3x3 * - ``m4`` = mat4 = matrix 4x4 * - ``eul`` = euler rotation * - ``eulO`` = euler with order * * \subsection mathabbrev_all Function Type Abbreviations * * For non float versions of functions (which typically operate on floats), * use single suffix abbreviations. * * - ``_d`` = double * - ``_i`` = int * - ``_u`` = unsigned int * - ``_char`` = char * - ``_uchar`` = unsigned char * * \section mathvarnames Variable Names * * - f = single value * - a, b, c = vectors * - r = result vector * - A, B, C = matrices * - R = result matrix */ #if 0 /* expanded by -frewrite-includes */ #include "BLI_math_base.h" #endif /* expanded by -frewrite-includes */ # 67 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math.h" # 68 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math.h" #if 0 /* expanded by -frewrite-includes */ #include "BLI_math_color.h" #endif /* expanded by -frewrite-includes */ # 68 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math.h" # 69 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math.h" #if 0 /* expanded by -frewrite-includes */ #include "BLI_math_matrix.h" #endif /* expanded by -frewrite-includes */ # 69 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math.h" # 70 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math.h" #if 0 /* expanded by -frewrite-includes */ #include "BLI_math_rotation.h" #endif /* expanded by -frewrite-includes */ # 70 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math.h" # 71 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math.h" #if 0 /* expanded by -frewrite-includes */ #include "BLI_math_vector.h" #endif /* expanded by -frewrite-includes */ # 71 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math.h" # 72 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math.h" #if 0 /* expanded by -frewrite-includes */ #include "BLI_math_geom.h" #endif /* expanded by -frewrite-includes */ # 72 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math.h" # 73 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math.h" #if 0 /* expanded by -frewrite-includes */ #include "BLI_math_interp.h" #endif /* expanded by -frewrite-includes */ # 73 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math.h" # 74 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math.h" #endif /* __BLI_MATH_H__ */ # 76 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math.h" # 34 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/intern/math_vector_inline.c" 2 /********************************** Init *************************************/ MINLINE void zero_v2(float r[2]) { r[0] = 0.0f; r[1] = 0.0f; } MINLINE void zero_v3(float r[3]) { r[0] = 0.0f; r[1] = 0.0f; r[2] = 0.0f; } MINLINE void zero_v4(float r[4]) { r[0] = 0.0f; r[1] = 0.0f; r[2] = 0.0f; r[3] = 0.0f; } MINLINE void copy_v2_v2(float r[2], const float a[2]) { r[0] = a[0]; r[1] = a[1]; } MINLINE void copy_v3_v3(float r[3], const float a[3]) { r[0] = a[0]; r[1] = a[1]; r[2] = a[2]; } MINLINE void copy_v4_v4(float r[4], const float a[4]) { r[0] = a[0]; r[1] = a[1]; r[2] = a[2]; r[3] = a[3]; } MINLINE void copy_v2_fl(float r[2], float f) { r[0] = f; r[1] = f; } MINLINE void copy_v3_fl(float r[3], float f) { r[0] = f; r[1] = f; r[2] = f; } MINLINE void copy_v4_fl(float r[4], float f) { r[0] = f; r[1] = f; r[2] = f; r[3] = f; } /* short */ MINLINE void copy_v2_v2_char(char r[2], const char a[2]) { r[0] = a[0]; r[1] = a[1]; } MINLINE void copy_v3_v3_char(char r[3], const char a[3]) { r[0] = a[0]; r[1] = a[1]; r[2] = a[2]; } MINLINE void copy_v4_v4_char(char r[4], const char a[4]) { r[0] = a[0]; r[1] = a[1]; r[2] = a[2]; r[3] = a[3]; } /* short */ MINLINE void zero_v3_int(int r[3]) { r[0] = 0; r[1] = 0; r[2] = 0; } MINLINE void copy_v2_v2_short(short r[2], const short a[2]) { r[0] = a[0]; r[1] = a[1]; } MINLINE void copy_v3_v3_short(short r[3], const short a[3]) { r[0] = a[0]; r[1] = a[1]; r[2] = a[2]; } MINLINE void copy_v4_v4_short(short r[4], const short a[4]) { r[0] = a[0]; r[1] = a[1]; r[2] = a[2]; r[3] = a[3]; } /* int */ MINLINE void copy_v2_v2_int(int r[2], const int a[2]) { r[0] = a[0]; r[1] = a[1]; } MINLINE void copy_v3_v3_int(int r[3], const int a[3]) { r[0] = a[0]; r[1] = a[1]; r[2] = a[2]; } MINLINE void copy_v4_v4_int(int r[4], const int a[4]) { r[0] = a[0]; r[1] = a[1]; r[2] = a[2]; r[3] = a[3]; } /* double -> float */ MINLINE void copy_v2fl_v2db(float r[2], const double a[2]) { r[0] = (float)a[0]; r[1] = (float)a[1]; } MINLINE void copy_v3fl_v3db(float r[3], const double a[3]) { r[0] = (float)a[0]; r[1] = (float)a[1]; r[2] = (float)a[2]; } MINLINE void copy_v4fl_v4db(float r[4], const double a[4]) { r[0] = (float)a[0]; r[1] = (float)a[1]; r[2] = (float)a[2]; r[3] = (float)a[3]; } /* float -> double */ MINLINE void copy_v2db_v2fl(double r[2], const float a[2]) { r[0] = (double)a[0]; r[1] = (double)a[1]; } MINLINE void copy_v3db_v3fl(double r[3], const float a[3]) { r[0] = (double)a[0]; r[1] = (double)a[1]; r[2] = (double)a[2]; } MINLINE void copy_v4db_v4fl(double r[4], const float a[4]) { r[0] = (double)a[0]; r[1] = (double)a[1]; r[2] = (double)a[2]; r[3] = (double)a[3]; } MINLINE void swap_v2_v2(float a[2], float b[2]) { SWAP(float, a[0], b[0]); SWAP(float, a[1], b[1]); } MINLINE void swap_v3_v3(float a[3], float b[3]) { SWAP(float, a[0], b[0]); SWAP(float, a[1], b[1]); SWAP(float, a[2], b[2]); } MINLINE void swap_v4_v4(float a[4], float b[4]) { SWAP(float, a[0], b[0]); SWAP(float, a[1], b[1]); SWAP(float, a[2], b[2]); SWAP(float, a[3], b[3]); } /* float args -> vec */ MINLINE void copy_v2_fl2(float v[2], float x, float y) { v[0] = x; v[1] = y; } MINLINE void copy_v3_fl3(float v[3], float x, float y, float z) { v[0] = x; v[1] = y; v[2] = z; } MINLINE void copy_v4_fl4(float v[4], float x, float y, float z, float w) { v[0] = x; v[1] = y; v[2] = z; v[3] = w; } /********************************* Arithmetic ********************************/ MINLINE void add_v2_fl(float r[2], float f) { r[0] += f; r[1] += f; } MINLINE void add_v3_fl(float r[3], float f) { r[0] += f; r[1] += f; r[2] += f; } MINLINE void add_v4_fl(float r[4], float f) { r[0] += f; r[1] += f; r[2] += f; r[3] += f; } MINLINE void add_v2_v2(float r[2], const float a[2]) { r[0] += a[0]; r[1] += a[1]; } MINLINE void add_v2_v2v2(float r[2], const float a[2], const float b[2]) { r[0] = a[0] + b[0]; r[1] = a[1] + b[1]; } MINLINE void add_v2_v2v2_int(int r[2], const int a[2], const int b[2]) { r[0] = a[0] + b[0]; r[1] = a[1] + b[1]; } MINLINE void add_v3_v3(float r[3], const float a[3]) { r[0] += a[0]; r[1] += a[1]; r[2] += a[2]; } MINLINE void add_v3_v3v3(float r[3], const float a[3], const float b[3]) { r[0] = a[0] + b[0]; r[1] = a[1] + b[1]; r[2] = a[2] + b[2]; } MINLINE void add_v4_v4(float r[4], const float a[4]) { r[0] += a[0]; r[1] += a[1]; r[2] += a[2]; r[3] += a[3]; } MINLINE void add_v4_v4v4(float r[4], const float a[4], const float b[4]) { r[0] = a[0] + b[0]; r[1] = a[1] + b[1]; r[2] = a[2] + b[2]; r[3] = a[3] + b[3]; } MINLINE void sub_v2_v2(float r[2], const float a[2]) { r[0] -= a[0]; r[1] -= a[1]; } MINLINE void sub_v2_v2v2(float r[2], const float a[2], const float b[2]) { r[0] = a[0] - b[0]; r[1] = a[1] - b[1]; } MINLINE void sub_v2_v2v2_int(int r[2], const int a[2], const int b[2]) { r[0] = a[0] - b[0]; r[1] = a[1] - b[1]; } MINLINE void sub_v3_v3(float r[3], const float a[3]) { r[0] -= a[0]; r[1] -= a[1]; r[2] -= a[2]; } MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3]) { r[0] = a[0] - b[0]; r[1] = a[1] - b[1]; r[2] = a[2] - b[2]; } MINLINE void sub_v4_v4(float r[4], const float a[4]) { r[0] -= a[0]; r[1] -= a[1]; r[2] -= a[2]; r[3] -= a[3]; } MINLINE void sub_v4_v4v4(float r[4], const float a[4], const float b[4]) { r[0] = a[0] - b[0]; r[1] = a[1] - b[1]; r[2] = a[2] - b[2]; r[3] = a[3] - b[3]; } MINLINE void mul_v2_fl(float r[2], float f) { r[0] *= f; r[1] *= f; } MINLINE void mul_v2_v2fl(float r[2], const float a[2], float f) { r[0] = a[0] * f; r[1] = a[1] * f; } MINLINE void mul_v3_fl(float r[3], float f) { r[0] *= f; r[1] *= f; r[2] *= f; } MINLINE void mul_v3_v3fl(float r[3], const float a[3], float f) { r[0] = a[0] * f; r[1] = a[1] * f; r[2] = a[2] * f; } MINLINE void mul_v2_v2(float r[2], const float a[2]) { r[0] *= a[0]; r[1] *= a[1]; } MINLINE void mul_v3_v3(float r[3], const float a[3]) { r[0] *= a[0]; r[1] *= a[1]; r[2] *= a[2]; } MINLINE void mul_v4_fl(float r[4], float f) { r[0] *= f; r[1] *= f; r[2] *= f; r[3] *= f; } MINLINE void mul_v4_v4fl(float r[4], const float a[4], float f) { r[0] = a[0] * f; r[1] = a[1] * f; r[2] = a[2] * f; r[3] = a[3] * f; } /** * Avoid doing: * * angle = atan2f(dvec[0], dvec[1]); * angle_to_mat2(mat, angle); * * instead use a vector as a matrix. */ MINLINE void mul_v2_v2_cw(float r[2], const float mat[2], const float vec[2]) { BLI_assert(r != vec); r[0] = mat[0] * vec[0] + (+mat[1]) * vec[1]; r[1] = mat[1] * vec[0] + (-mat[0]) * vec[1]; } MINLINE void mul_v2_v2_ccw(float r[2], const float mat[2], const float vec[2]) { BLI_assert(r != vec); r[0] = mat[0] * vec[0] + (-mat[1]) * vec[1]; r[1] = mat[1] * vec[0] + (+mat[0]) * vec[1]; } /* note: could add a matrix inline */ MINLINE float mul_project_m4_v3_zfac(float mat[4][4], const float co[3]) { return (mat[0][3] * co[0]) + (mat[1][3] * co[1]) + (mat[2][3] * co[2]) + mat[3][3]; } /** * Has the effect of #mul_m3_v3(), on a single axis. */ MINLINE float dot_m3_v3_row_x(float M[3][3], const float a[3]) { return M[0][0] * a[0] + M[1][0] * a[1] + M[2][0] * a[2]; } MINLINE float dot_m3_v3_row_y(float M[3][3], const float a[3]) { return M[0][1] * a[0] + M[1][1] * a[1] + M[2][1] * a[2]; } MINLINE float dot_m3_v3_row_z(float M[3][3], const float a[3]) { return M[0][2] * a[0] + M[1][2] * a[1] + M[2][2] * a[2]; } /** * Has the effect of #mul_mat3_m4_v3(), on a single axis. * (no adding translation) */ MINLINE float dot_m4_v3_row_x(float M[4][4], const float a[3]) { return M[0][0] * a[0] + M[1][0] * a[1] + M[2][0] * a[2]; } MINLINE float dot_m4_v3_row_y(float M[4][4], const float a[3]) { return M[0][1] * a[0] + M[1][1] * a[1] + M[2][1] * a[2]; } MINLINE float dot_m4_v3_row_z(float M[4][4], const float a[3]) { return M[0][2] * a[0] + M[1][2] * a[1] + M[2][2] * a[2]; } MINLINE void madd_v2_v2fl(float r[2], const float a[2], float f) { r[0] += a[0] * f; r[1] += a[1] * f; } MINLINE void madd_v3_v3fl(float r[3], const float a[3], float f) { r[0] += a[0] * f; r[1] += a[1] * f; r[2] += a[2] * f; } MINLINE void madd_v3_v3v3(float r[3], const float a[3], const float b[3]) { r[0] += a[0] * b[0]; r[1] += a[1] * b[1]; r[2] += a[2] * b[2]; } MINLINE void madd_v2_v2v2fl(float r[2], const float a[2], const float b[2], float f) { r[0] = a[0] + b[0] * f; r[1] = a[1] + b[1] * f; } MINLINE void madd_v3_v3v3fl(float r[3], const float a[3], const float b[3], float f) { r[0] = a[0] + b[0] * f; r[1] = a[1] + b[1] * f; r[2] = a[2] + b[2] * f; } MINLINE void madd_v3_v3v3v3(float r[3], const float a[3], const float b[3], const float c[3]) { r[0] = a[0] + b[0] * c[0]; r[1] = a[1] + b[1] * c[1]; r[2] = a[2] + b[2] * c[2]; } MINLINE void madd_v4_v4fl(float r[4], const float a[4], float f) { r[0] += a[0] * f; r[1] += a[1] * f; r[2] += a[2] * f; r[3] += a[3] * f; } MINLINE void madd_v4_v4v4(float r[4], const float a[4], const float b[4]) { r[0] += a[0] * b[0]; r[1] += a[1] * b[1]; r[2] += a[2] * b[2]; r[3] += a[3] * b[3]; } MINLINE void mul_v3_v3v3(float r[3], const float v1[3], const float v2[3]) { r[0] = v1[0] * v2[0]; r[1] = v1[1] * v2[1]; r[2] = v1[2] * v2[2]; } MINLINE void negate_v2(float r[2]) { r[0] = -r[0]; r[1] = -r[1]; } MINLINE void negate_v2_v2(float r[2], const float a[2]) { r[0] = -a[0]; r[1] = -a[1]; } MINLINE void negate_v3(float r[3]) { r[0] = -r[0]; r[1] = -r[1]; r[2] = -r[2]; } MINLINE void negate_v3_v3(float r[3], const float a[3]) { r[0] = -a[0]; r[1] = -a[1]; r[2] = -a[2]; } MINLINE void negate_v4(float r[4]) { r[0] = -r[0]; r[1] = -r[1]; r[2] = -r[2]; r[3] = -r[3]; } MINLINE void negate_v4_v4(float r[4], const float a[4]) { r[0] = -a[0]; r[1] = -a[1]; r[2] = -a[2]; r[3] = -a[3]; } /* could add more... */ MINLINE void negate_v3_short(short r[3]) { r[0] = (short)-r[0]; r[1] = (short)-r[1]; r[2] = (short)-r[2]; } MINLINE void abs_v2(float r[2]) { r[0] = fabsf(r[0]); r[1] = fabsf(r[1]); } MINLINE void abs_v2_v2(float r[2], const float a[2]) { r[0] = fabsf(a[0]); r[1] = fabsf(a[1]); } MINLINE void abs_v3(float r[3]) { r[0] = fabsf(r[0]); r[1] = fabsf(r[1]); r[2] = fabsf(r[2]); } MINLINE void abs_v3_v3(float r[3], const float a[3]) { r[0] = fabsf(a[0]); r[1] = fabsf(a[1]); r[2] = fabsf(a[2]); } MINLINE void abs_v4(float r[4]) { r[0] = fabsf(r[0]); r[1] = fabsf(r[1]); r[2] = fabsf(r[2]); r[3] = fabsf(r[3]); } MINLINE void abs_v4_v4(float r[4], const float a[4]) { r[0] = fabsf(a[0]); r[1] = fabsf(a[1]); r[2] = fabsf(a[2]); r[3] = fabsf(a[3]); } MINLINE float dot_v2v2(const float a[2], const float b[2]) { return a[0] * b[0] + a[1] * b[1]; } MINLINE float dot_v3v3(const float a[3], const float b[3]) { return a[0] * b[0] + a[1] * b[1] + a[2] * b[2]; } MINLINE float dot_v3v3v3(const float p[3], const float a[3], const float b[3]) { float vec1[3], vec2[3]; sub_v3_v3v3(vec1, a, p); sub_v3_v3v3(vec2, b, p); if (is_zero_v3(vec1) || is_zero_v3(vec2)) { return 0.0f; } return dot_v3v3(vec1, vec2); } MINLINE float dot_v4v4(const float a[4], const float b[4]) { return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3]; } MINLINE double dot_v3db_v3fl(const double a[3], const float b[3]) { return a[0] * (double)b[0] + a[1] * (double)b[1] + a[2] * (double)b[2]; } MINLINE float cross_v2v2(const float a[2], const float b[2]) { return a[0] * b[1] - a[1] * b[0]; } MINLINE void cross_v3_v3v3(float r[3], const float a[3], const float b[3]) { BLI_assert(r != a && r != b); r[0] = a[1] * b[2] - a[2] * b[1]; r[1] = a[2] * b[0] - a[0] * b[2]; r[2] = a[0] * b[1] - a[1] * b[0]; } /* Newell's Method */ /* excuse this fairly specific function, * its used for polygon normals all over the place * could use a better name */ MINLINE void add_newell_cross_v3_v3v3(float n[3], const float v_prev[3], const float v_curr[3]) { n[0] += (v_prev[1] - v_curr[1]) * (v_prev[2] + v_curr[2]); n[1] += (v_prev[2] - v_curr[2]) * (v_prev[0] + v_curr[0]); n[2] += (v_prev[0] - v_curr[0]) * (v_prev[1] + v_curr[1]); } MINLINE void star_m3_v3(float rmat[3][3], float a[3]) { rmat[0][0] = rmat[1][1] = rmat[2][2] = 0.0; rmat[0][1] = -a[2]; rmat[0][2] = a[1]; rmat[1][0] = a[2]; rmat[1][2] = -a[0]; rmat[2][0] = -a[1]; rmat[2][1] = a[0]; } /*********************************** Length **********************************/ MINLINE float len_squared_v2(const float v[2]) { return v[0] * v[0] + v[1] * v[1]; } MINLINE float len_squared_v3(const float v[3]) { return v[0] * v[0] + v[1] * v[1] + v[2] * v[2]; } MINLINE float len_manhattan_v2(const float v[2]) { return fabsf(v[0]) + fabsf(v[1]); } MINLINE int len_manhattan_v2_int(const int v[2]) { return abs(v[0]) + abs(v[1]); } MINLINE float len_manhattan_v3(const float v[3]) { return fabsf(v[0]) + fabsf(v[1]) + fabsf(v[2]); } MINLINE float len_v2(const float v[2]) { return sqrtf(v[0] * v[0] + v[1] * v[1]); } MINLINE float len_v2v2(const float v1[2], const float v2[2]) { float x, y; x = v1[0] - v2[0]; y = v1[1] - v2[1]; return sqrtf(x * x + y * y); } MINLINE float len_v2v2_int(const int v1[2], const int v2[2]) { float x, y; x = (float)(v1[0] - v2[0]); y = (float)(v1[1] - v2[1]); return sqrtf(x * x + y * y); } MINLINE float len_v3(const float a[3]) { return sqrtf(dot_v3v3(a, a)); } MINLINE float len_squared_v2v2(const float a[2], const float b[2]) { float d[2]; sub_v2_v2v2(d, b, a); return dot_v2v2(d, d); } MINLINE float len_squared_v3v3(const float a[3], const float b[3]) { float d[3]; sub_v3_v3v3(d, b, a); return dot_v3v3(d, d); } MINLINE float len_manhattan_v2v2(const float a[2], const float b[2]) { float d[2]; sub_v2_v2v2(d, b, a); return len_manhattan_v2(d); } MINLINE int len_manhattan_v2v2_int(const int a[2], const int b[2]) { int d[2]; sub_v2_v2v2_int(d, b, a); return len_manhattan_v2_int(d); } MINLINE float len_manhattan_v3v3(const float a[3], const float b[3]) { float d[3]; sub_v3_v3v3(d, b, a); return len_manhattan_v3(d); } MINLINE float len_v3v3(const float a[3], const float b[3]) { float d[3]; sub_v3_v3v3(d, b, a); return len_v3(d); } MINLINE float normalize_v2_v2(float r[2], const float a[2]) { float d = dot_v2v2(a, a); if (d > 1.0e-35f) { d = sqrtf(d); mul_v2_v2fl(r, a, 1.0f / d); } else { zero_v2(r); d = 0.0f; } return d; } MINLINE float normalize_v2(float n[2]) { return normalize_v2_v2(n, n); } MINLINE float normalize_v3_v3(float r[3], const float a[3]) { float d = dot_v3v3(a, a); /* a larger value causes normalize errors in a * scaled down models with camera extreme close */ if (d > 1.0e-35f) { d = sqrtf(d); mul_v3_v3fl(r, a, 1.0f / d); } else { zero_v3(r); d = 0.0f; } return d; } MINLINE double normalize_v3_d(double n[3]) { double d = n[0] * n[0] + n[1] * n[1] + n[2] * n[2]; /* a larger value causes normalize errors in a * scaled down models with camera extreme close */ if (d > 1.0e-35) { double mul; d = sqrt(d); mul = 1.0 / d; n[0] *= mul; n[1] *= mul; n[2] *= mul; } else { n[0] = n[1] = n[2] = 0; d = 0.0; } return d; } MINLINE float normalize_v3(float n[3]) { return normalize_v3_v3(n, n); } MINLINE void normal_short_to_float_v3(float out[3], const short in[3]) { out[0] = in[0] * (1.0f / 32767.0f); out[1] = in[1] * (1.0f / 32767.0f); out[2] = in[2] * (1.0f / 32767.0f); } MINLINE void normal_float_to_short_v3(short out[3], const float in[3]) { out[0] = (short) (in[0] * 32767.0f); out[1] = (short) (in[1] * 32767.0f); out[2] = (short) (in[2] * 32767.0f); } /********************************* Comparison ********************************/ MINLINE bool is_zero_v2(const float v[2]) { return (v[0] == 0.0f && v[1] == 0.0f); } MINLINE bool is_zero_v3(const float v[3]) { return (v[0] == 0.0f && v[1] == 0.0f && v[2] == 0.0f); } MINLINE bool is_zero_v4(const float v[4]) { return (v[0] == 0.0f && v[1] == 0.0f && v[2] == 0.0f && v[3] == 0.0f); } MINLINE bool is_finite_v2(const float v[2]) { return (finite(v[0]) && finite(v[1])); } MINLINE bool is_finite_v3(const float v[3]) { return (finite(v[0]) && finite(v[1]) && finite(v[2])); } MINLINE bool is_finite_v4(const float v[4]) { return (finite(v[0]) && finite(v[1]) && finite(v[2]) && finite(v[3])); } MINLINE bool is_one_v3(const float v[3]) { return (v[0] == 1.0f && v[1] == 1.0f && v[2] == 1.0f); } /** \name Vector Comparison * * \note use ``value <= limit``, so a limit of zero doesn't fail on an exact match. * \{ */ MINLINE bool equals_v2v2(const float v1[2], const float v2[2]) { return ((v1[0] == v2[0]) && (v1[1] == v2[1])); } MINLINE bool equals_v3v3(const float v1[3], const float v2[3]) { return ((v1[0] == v2[0]) && (v1[1] == v2[1]) && (v1[2] == v2[2])); } MINLINE bool equals_v4v4(const float v1[4], const float v2[4]) { return ((v1[0] == v2[0]) && (v1[1] == v2[1]) && (v1[2] == v2[2]) && (v1[3] == v2[3])); } MINLINE bool compare_v2v2(const float v1[2], const float v2[2], const float limit) { if (fabsf(v1[0] - v2[0]) <= limit) if (fabsf(v1[1] - v2[1]) <= limit) return true; return false; } MINLINE bool compare_v3v3(const float v1[3], const float v2[3], const float limit) { if (fabsf(v1[0] - v2[0]) <= limit) if (fabsf(v1[1] - v2[1]) <= limit) if (fabsf(v1[2] - v2[2]) <= limit) return true; return false; } MINLINE bool compare_len_v3v3(const float v1[3], const float v2[3], const float limit) { float x, y, z; x = v1[0] - v2[0]; y = v1[1] - v2[1]; z = v1[2] - v2[2]; return ((x * x + y * y + z * z) <= (limit * limit)); } MINLINE bool compare_len_squared_v3v3(const float v1[3], const float v2[3], const float limit_sq) { float x, y, z; x = v1[0] - v2[0]; y = v1[1] - v2[1]; z = v1[2] - v2[2]; return ((x * x + y * y + z * z) <= limit_sq); } MINLINE bool compare_v4v4(const float v1[4], const float v2[4], const float limit) { if (fabsf(v1[0] - v2[0]) <= limit) if (fabsf(v1[1] - v2[1]) <= limit) if (fabsf(v1[2] - v2[2]) <= limit) if (fabsf(v1[3] - v2[3]) <= limit) return true; return false; } /** *
 *        + l1
 *        |
 * neg <- | -> pos
 *        |
 *        + l2
 * 
* * \return Positive value when 'pt' is left-of-line * (looking from 'l1' -> 'l2'). */ MINLINE float line_point_side_v2(const float l1[2], const float l2[2], const float pt[2]) { return (((l1[0] - pt[0]) * (l2[1] - pt[1])) - ((l2[0] - pt[0]) * (l1[1] - pt[1]))); } /** \} */ #endif /* __MATH_VECTOR_INLINE_C__ */ # 1040 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/intern/math_vector_inline.c" # 348 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_vector.h" 2 #endif # 349 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_vector.h" #ifdef BLI_MATH_GCC_WARN_PRAGMA # pragma GCC diagnostic pop #endif # 353 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_vector.h" #ifdef __cplusplus } #endif # 357 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_vector.h" #endif /* __BLI_MATH_VECTOR_H__ */ # 359 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_vector.h" # 72 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math.h" 2 #if 0 /* expanded by -frewrite-includes */ #include "BLI_math_geom.h" #endif /* expanded by -frewrite-includes */ # 72 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math.h" # 1 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_geom.h" 1 /* * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. * All rights reserved. * * The Original Code is: some of this file. * * ***** END GPL LICENSE BLOCK ***** * */ #ifndef __BLI_MATH_GEOM_H__ #define __BLI_MATH_GEOM_H__ /** \file BLI_math_geom.h * \ingroup bli */ #ifdef __cplusplus extern "C" { #endif # 36 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_geom.h" #if 0 /* expanded by -frewrite-includes */ #include "BLI_compiler_attrs.h" #endif /* expanded by -frewrite-includes */ # 37 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_geom.h" # 38 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_geom.h" #if 0 /* expanded by -frewrite-includes */ #include "BLI_math_inline.h" #endif /* expanded by -frewrite-includes */ # 38 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_geom.h" # 39 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_geom.h" #ifdef BLI_MATH_GCC_WARN_PRAGMA # pragma GCC diagnostic push # pragma GCC diagnostic ignored "-Wredundant-decls" #endif # 44 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_geom.h" /********************************** Polygons *********************************/ void cent_tri_v3(float r[3], const float a[3], const float b[3], const float c[3]); void cent_quad_v3(float r[3], const float a[3], const float b[3], const float c[3], const float d[3]); float normal_tri_v3(float r[3], const float a[3], const float b[3], const float c[3]); float normal_quad_v3(float r[3], const float a[3], const float b[3], const float c[3], const float d[3]); float normal_poly_v3(float r[3], const float verts[][3], unsigned int nr); MINLINE float area_tri_v2(const float a[2], const float b[2], const float c[2]); MINLINE float area_squared_tri_v2(const float a[2], const float b[2], const float c[2]); MINLINE float area_tri_signed_v2(const float v1[2], const float v2[2], const float v3[2]); float area_tri_v3(const float a[3], const float b[3], const float c[3]); float area_squared_tri_v3(const float a[3], const float b[3], const float c[3]); float area_tri_signed_v3(const float v1[3], const float v2[3], const float v3[3], const float normal[3]); float area_quad_v3(const float a[3], const float b[3], const float c[3], const float d[3]); float area_squared_quad_v3(const float a[3], const float b[3], const float c[3], const float d[3]); float area_poly_v3(const float verts[][3], unsigned int nr); float area_poly_v2(const float verts[][2], unsigned int nr); float area_squared_poly_v3(const float verts[][3], unsigned int nr); float area_squared_poly_v2(const float verts[][2], unsigned int nr); float area_poly_signed_v2(const float verts[][2], unsigned int nr); float cotangent_tri_weight_v3(const float v1[3], const float v2[3], const float v3[3]); void cross_tri_v3(float n[3], const float v1[3], const float v2[3], const float v3[3]); MINLINE float cross_tri_v2(const float v1[2], const float v2[2], const float v3[2]); void cross_poly_v3(float n[3], const float verts[][3], unsigned int nr); float cross_poly_v2(const float verts[][2], unsigned int nr); /********************************* Planes **********************************/ void plane_from_point_normal_v3(float r_plane[4], const float plane_co[3], const float plane_no[3]); void plane_to_point_vector_v3(const float plane[4], float r_plane_co[3], float r_plane_no[3]); void plane_to_point_vector_v3_normalized(const float plane[4], float r_plane_co[3], float r_plane_no[3]); MINLINE float plane_point_side_v3(const float plane[4], const float co[3]); /********************************* Volume **********************************/ float volume_tetrahedron_v3(const float v1[3], const float v2[3], const float v3[3], const float v4[3]); float volume_tetrahedron_signed_v3(const float v1[3], const float v2[3], const float v3[3], const float v4[3]); bool is_quad_convex_v3(const float v1[3], const float v2[3], const float v3[3], const float v4[3]); bool is_quad_convex_v2(const float v1[2], const float v2[2], const float v3[2], const float v4[2]); bool is_poly_convex_v2(const float verts[][2], unsigned int nr); int is_quad_flip_v3(const float v1[3], const float v2[3], const float v3[3], const float v4[3]); /********************************* Distance **********************************/ float dist_squared_to_line_v2(const float p[2], const float l1[2], const float l2[2]); float dist_to_line_v2(const float p[2], const float l1[2], const float l2[2]); float dist_squared_to_line_segment_v2(const float p[2], const float l1[2], const float l2[2]); float dist_to_line_segment_v2(const float p[2], const float l1[2], const float l2[2]); void closest_to_line_segment_v2(float r_close[2], const float p[2], const float l1[2], const float l2[2]); float dist_signed_squared_to_plane_v3(const float p[3], const float plane[4]); float dist_squared_to_plane_v3(const float p[3], const float plane[4]); float dist_signed_to_plane_v3(const float p[3], const float plane[4]); float dist_to_plane_v3(const float p[3], const float plane[4]); float dist_squared_to_line_segment_v3(const float p[3], const float l1[3], const float l2[3]); float dist_to_line_segment_v3(const float p[3], const float l1[3], const float l2[3]); float dist_squared_to_line_v3(const float p[3], const float l1[3], const float l2[3]); float dist_to_line_v3(const float p[3], const float l1[3], const float l2[3]); float dist_signed_squared_to_corner_v3v3v3( const float p[3], const float v1[3], const float v2[3], const float v3[3], const float axis_ref[3]); float closest_to_line_v3(float r[3], const float p[3], const float l1[3], const float l2[3]); float closest_to_line_v2(float r[2], const float p[2], const float l1[2], const float l2[2]); void closest_to_line_segment_v3(float r_close[3], const float p[3], const float l1[3], const float l2[3]); void closest_to_plane_v3(float r_close[3], const float plane[4], const float pt[3]); /* Set 'r' to the point in triangle (t1, t2, t3) closest to point 'p' */ void closest_on_tri_to_point_v3(float r[3], const float p[3], const float t1[3], const float t2[3], const float t3[3]); float line_point_factor_v3(const float p[3], const float l1[3], const float l2[3]); float line_point_factor_v2(const float p[2], const float l1[2], const float l2[2]); float line_plane_factor_v3(const float plane_co[3], const float plane_no[3], const float l1[3], const float l2[3]); void limit_dist_v3(float v1[3], float v2[3], const float dist); /******************************* Intersection ********************************/ /* TODO int return value consistency */ /* line-line */ #define ISECT_LINE_LINE_COLINEAR -1 #define ISECT_LINE_LINE_NONE 0 #define ISECT_LINE_LINE_EXACT 1 #define ISECT_LINE_LINE_CROSS 2 int isect_line_line_v2_point(const float v1[2], const float v2[2], const float v3[2], const float v4[2], float vi[2]); int isect_line_line_v2(const float a1[2], const float a2[2], const float b1[2], const float b2[2]); int isect_line_line_v2_int(const int a1[2], const int a2[2], const int b1[2], const int b2[2]); int isect_line_sphere_v3(const float l1[3], const float l2[3], const float sp[3], const float r, float r_p1[3], float r_p2[3]); int isect_line_sphere_v2(const float l1[2], const float l2[2], const float sp[2], const float r, float r_p1[2], float r_p2[2]); int isect_seg_seg_v2_point(const float v1[2], const float v2[2], const float v3[2], const float v4[2], float vi[2]); bool isect_seg_seg_v2(const float v1[2], const float v2[2], const float v3[2], const float v4[2]); int isect_line_line_epsilon_v3( const float v1[3], const float v2[3], const float v3[3], const float v4[3], float i1[3], float i2[3], const float epsilon); int isect_line_line_v3( const float v1[3], const float v2[3], const float v3[3], const float v4[3], float i1[3], float i2[3]); bool isect_line_line_strict_v3(const float v1[3], const float v2[3], const float v3[3], const float v4[3], float vi[3], float *r_lambda); bool isect_ray_plane_v3(const float p1[3], const float d[3], const float v0[3], const float v1[3], const float v2[3], float *r_lambda, const int clip); bool isect_point_planes_v3(float (*planes)[4], int totplane, const float p[3]); bool isect_line_plane_v3(float out[3], const float l1[3], const float l2[3], const float plane_co[3], const float plane_no[3]) ATTR_WARN_UNUSED_RESULT; bool isect_plane_plane_v3(float r_isect_co[3], float r_isect_no[3], const float plane_a_co[3], const float plane_a_no[3], const float plane_b_co[3], const float plane_b_no[3]) ATTR_WARN_UNUSED_RESULT; /* line/ray triangle */ bool isect_line_tri_v3(const float p1[3], const float p2[3], const float v0[3], const float v1[3], const float v2[3], float *r_lambda, float r_uv[2]); bool isect_line_tri_epsilon_v3(const float p1[3], const float p2[3], const float v0[3], const float v1[3], const float v2[3], float *r_lambda, float r_uv[2], const float epsilon); bool isect_ray_tri_v3(const float p1[3], const float d[3], const float v0[3], const float v1[3], const float v2[3], float *r_lambda, float r_uv[2]); bool isect_ray_tri_threshold_v3(const float p1[3], const float d[3], const float v0[3], const float v1[3], const float v2[3], float *r_lambda, float r_uv[2], const float threshold); bool isect_ray_tri_epsilon_v3(const float p1[3], const float d[3], const float v0[3], const float v1[3], const float v2[3], float *r_lambda, float r_uv[2], const float epsilon); /* point in polygon */ bool isect_point_poly_v2(const float pt[2], const float verts[][2], const unsigned int nr, const bool use_holes); bool isect_point_poly_v2_int(const int pt[2], const int verts[][2], const unsigned int nr, const bool use_holes); int isect_point_quad_v2(const float p[2], const float a[2], const float b[2], const float c[2], const float d[2]); int isect_point_tri_v2(const float pt[2], const float v1[2], const float v2[2], const float v3[2]); bool isect_point_tri_v2_cw(const float pt[2], const float v1[2], const float v2[2], const float v3[2]); int isect_point_tri_v2_int(const int x1, const int y1, const int x2, const int y2, const int a, const int b); bool isect_point_tri_prism_v3(const float p[3], const float v1[3], const float v2[3], const float v3[3]); bool isect_point_tri_v3(const float p[3], const float v1[3], const float v2[3], const float v3[3], float r_vi[3]); /* axis-aligned bounding box */ bool isect_aabb_aabb_v3(const float min1[3], const float max1[3], const float min2[3], const float max2[3]); typedef struct { float ray_start[3]; float ray_inv_dir[3]; int sign[3]; } IsectRayAABBData; void isect_ray_aabb_initialize(IsectRayAABBData *data, const float ray_start[3], const float ray_direction[3]); bool isect_ray_aabb(const IsectRayAABBData *data, const float bb_min[3], const float bb_max[3], float *tmin); /* other */ bool isect_sweeping_sphere_tri_v3(const float p1[3], const float p2[3], const float radius, const float v0[3], const float v1[3], const float v2[3], float *r_lambda, float ipoint[3]); bool isect_axial_line_tri_v3(const int axis, const float co1[3], const float co2[3], const float v0[3], const float v1[3], const float v2[3], float *r_lambda); bool clip_segment_v3_plane(float p1[3], float p2[3], const float plane[4]); bool clip_segment_v3_plane_n(float p1[3], float p2[3], float plane_array[][4], const int plane_tot); void plot_line_v2v2i(const int p1[2], const int p2[2], bool (*callback)(int, int, void *), void *userData); void fill_poly_v2i_n( const int xmin, const int ymin, const int xmax, const int ymax, const int polyXY[][2], const int polyCorners, void (*callback)(int, int, void *), void *userData); /****************************** Interpolation ********************************/ /* tri or quad, d can be NULL */ void interp_weights_face_v3(float w[4], const float a[3], const float b[3], const float c[3], const float d[3], const float p[3]); void interp_weights_poly_v3(float w[], float v[][3], const int n, const float co[3]); void interp_weights_poly_v2(float w[], float v[][2], const int n, const float co[2]); void interp_cubic_v3(float x[3], float v[3], const float x1[3], const float v1[3], const float x2[3], const float v2[3], const float t); int interp_sparse_array(float *array, const int list_size, const float invalid); void transform_point_by_tri_v3( float pt_tar[3], float const pt_src[3], const float tri_tar_p1[3], const float tri_tar_p2[3], const float tri_tar_p3[3], const float tri_src_p1[3], const float tri_src_p2[3], const float tri_src_p3[3]); void transform_point_by_seg_v3( float p_dst[3], const float p_src[3], const float l_dst_p1[3], const float l_dst_p2[3], const float l_src_p1[3], const float l_src_p2[3]); void barycentric_weights_v2(const float v1[2], const float v2[2], const float v3[2], const float co[2], float w[3]); void barycentric_weights_v2_persp(const float v1[4], const float v2[4], const float v3[4], const float co[2], float w[3]); void barycentric_weights_v2_quad(const float v1[2], const float v2[2], const float v3[2], const float v4[2], const float co[2], float w[4]); bool barycentric_coords_v2(const float v1[2], const float v2[2], const float v3[2], const float co[2], float w[3]); int barycentric_inside_triangle_v2(const float w[3]); void resolve_tri_uv_v2(float r_uv[2], const float st[2], const float st0[2], const float st1[2], const float st2[2]); void resolve_tri_uv_v3(float r_uv[2], const float st[3], const float st0[3], const float st1[3], const float st2[3]); void resolve_quad_uv_v2(float r_uv[2], const float st[2], const float st0[2], const float st1[2], const float st2[2], const float st3[2]); void resolve_quad_uv_v2_deriv(float r_uv[2], float r_deriv[2][2], const float st[2], const float st0[2], const float st1[2], const float st2[2], const float st3[2]); float resolve_quad_u_v2(const float st[2], const float st0[2], const float st1[2], const float st2[2], const float st3[2]); /* use to find the point of a UV on a face */ void interp_bilinear_quad_v3(float data[4][3], float u, float v, float res[3]); void interp_barycentric_tri_v3(float data[3][3], float u, float v, float res[3]); /***************************** View & Projection *****************************/ void lookat_m4(float mat[4][4], float vx, float vy, float vz, float px, float py, float pz, float twist); void polarview_m4(float mat[4][4], float dist, float azimuth, float incidence, float twist); void perspective_m4(float mat[4][4], const float left, const float right, const float bottom, const float top, const float nearClip, const float farClip); void orthographic_m4(float mat[4][4], const float left, const float right, const float bottom, const float top, const float nearClip, const float farClip); void window_translate_m4(float winmat[4][4], float perspmat[4][4], const float x, const float y); void planes_from_projmat(float mat[4][4], float left[4], float right[4], float top[4], float bottom[4], float front[4], float back[4]); int box_clip_bounds_m4(float boundbox[2][3], const float bounds[4], float winmat[4][4]); void box_minmax_bounds_m4(float min[3], float max[3], float boundbox[2][3], float mat[4][4]); /********************************** Mapping **********************************/ void map_to_tube(float *r_u, float *r_v, const float x, const float y, const float z); void map_to_sphere(float *r_u, float *r_v, const float x, const float y, const float z); /********************************** Normals **********************************/ void accumulate_vertex_normals( float n1[3], float n2[3], float n3[3], float n4[3], const float f_no[3], const float co1[3], const float co2[3], const float co3[3], const float co4[3]); void accumulate_vertex_normals_poly( float **vertnos, const float polyno[3], const float **vertcos, float vdiffs[][3], const int nverts); /********************************* Tangents **********************************/ void tangent_from_uv( const float uv1[2], const float uv2[2], const float uv3[2], const float co1[3], const float co2[3], const float co3[3], const float n[3], float r_tang[3]); /******************************** Vector Clouds ******************************/ void vcloud_estimate_transform(int list_size, float (*pos)[3], float *weight, float (*rpos)[3], float *rweight, float lloc[3], float rloc[3], float lrot[3][3], float lscale[3][3]); /****************************** Spherical Harmonics *************************/ /* Uses 2nd order SH => 9 coefficients, stored in this order: * 0 = (0, 0), * 1 = (1, -1), 2 = (1, 0), 3 = (1, 1), * 4 = (2, -2), 5 = (2, -1), 6 = (2, 0), 7 = (2, 1), 8 = (2, 2) */ MINLINE void zero_sh(float r[9]); MINLINE void copy_sh_sh(float r[9], const float a[9]); MINLINE void mul_sh_fl(float r[9], const float f); MINLINE void add_sh_shsh(float r[9], const float a[9], const float b[9]); MINLINE float dot_shsh(const float a[9], const float b[9]); MINLINE float eval_shv3(float r[9], const float v[3]); MINLINE float diffuse_shv3(float r[9], const float v[3]); MINLINE void vec_fac_to_sh(float r[9], const float v[3], const float f); MINLINE void madd_sh_shfl(float r[9], const float sh[3], const float f); /********************************* Form Factor *******************************/ float form_factor_quad(const float p[3], const float n[3], const float q0[3], const float q1[3], const float q2[3], const float q3[3]); bool form_factor_visible_quad(const float p[3], const float n[3], const float v0[3], const float v1[3], const float v2[3], float q0[3], float q1[3], float q2[3], float q3[3]); float form_factor_hemi_poly(float p[3], float n[3], float v1[3], float v2[3], float v3[3], float v4[3]); void axis_dominant_v3_to_m3(float r_mat[3][3], const float normal[3]); MINLINE void axis_dominant_v3(int *r_axis_a, int *r_axis_b, const float axis[3]); MINLINE float axis_dominant_v3_max(int *r_axis_a, int *r_axis_b, const float axis[3]) ATTR_WARN_UNUSED_RESULT; MINLINE int axis_dominant_v3_single(const float vec[3]); MINLINE int max_axis_v3(const float vec[3]); MINLINE int min_axis_v3(const float vec[3]); MINLINE int poly_to_tri_count(const int poly_count, const int corner_count); MINLINE float shell_angle_to_dist(const float angle); MINLINE float shell_v3v3_normalized_to_dist(const float a[3], const float b[3]); MINLINE float shell_v2v2_normalized_to_dist(const float a[2], const float b[2]); MINLINE float shell_v3v3_mid_normalized_to_dist(const float a[3], const float b[3]); MINLINE float shell_v2v2_mid_normalized_to_dist(const float a[2], const float b[2]); /**************************** Inline Definitions ******************************/ #if BLI_MATH_DO_INLINE #if 0 /* expanded by -frewrite-includes */ #include "intern/math_geom_inline.c" #endif /* expanded by -frewrite-includes */ # 368 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_geom.h" # 1 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/intern/math_geom_inline.c" 1 /* * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. * All rights reserved. * * The Original Code is: some of this file. * * ***** END GPL LICENSE BLOCK ***** * */ /** \file blender/blenlib/intern/math_geom_inline.c * \ingroup bli */ #ifndef __MATH_GEOM_INLINE_C__ #define __MATH_GEOM_INLINE_C__ #if 0 /* expanded by -frewrite-includes */ #include "BLI_math.h" #endif /* expanded by -frewrite-includes */ # 33 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/intern/math_geom_inline.c" # 1 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math.h" 1 /* * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. * All rights reserved. * * The Original Code is: some of this file. * * ***** END GPL LICENSE BLOCK ***** * */ #ifndef __BLI_MATH_H__ #define __BLI_MATH_H__ /** \file BLI_math.h * \ingroup bli * \section mathabbrev Abbreviations * * - ``fl`` = float * - ``db`` = double * - ``v2`` = vec2 = vector 2 * - ``v3`` = vec3 = vector 3 * - ``v4`` = vec4 = vector 4 * - ``vn`` = vec4 = vector N dimensions, *passed as an arg, after the vector*. * - ``qt`` = quat = quaternion * - ``dq`` = dquat = dual quaternion * - ``m2`` = mat2 = matrix 2x2 * - ``m3`` = mat3 = matrix 3x3 * - ``m4`` = mat4 = matrix 4x4 * - ``eul`` = euler rotation * - ``eulO`` = euler with order * * \subsection mathabbrev_all Function Type Abbreviations * * For non float versions of functions (which typically operate on floats), * use single suffix abbreviations. * * - ``_d`` = double * - ``_i`` = int * - ``_u`` = unsigned int * - ``_char`` = char * - ``_uchar`` = unsigned char * * \section mathvarnames Variable Names * * - f = single value * - a, b, c = vectors * - r = result vector * - A, B, C = matrices * - R = result matrix */ #if 0 /* expanded by -frewrite-includes */ #include "BLI_math_base.h" #endif /* expanded by -frewrite-includes */ # 67 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math.h" # 68 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math.h" #if 0 /* expanded by -frewrite-includes */ #include "BLI_math_color.h" #endif /* expanded by -frewrite-includes */ # 68 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math.h" # 69 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math.h" #if 0 /* expanded by -frewrite-includes */ #include "BLI_math_matrix.h" #endif /* expanded by -frewrite-includes */ # 69 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math.h" # 70 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math.h" #if 0 /* expanded by -frewrite-includes */ #include "BLI_math_rotation.h" #endif /* expanded by -frewrite-includes */ # 70 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math.h" # 71 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math.h" #if 0 /* expanded by -frewrite-includes */ #include "BLI_math_vector.h" #endif /* expanded by -frewrite-includes */ # 71 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math.h" # 72 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math.h" #if 0 /* expanded by -frewrite-includes */ #include "BLI_math_geom.h" #endif /* expanded by -frewrite-includes */ # 72 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math.h" # 73 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math.h" #if 0 /* expanded by -frewrite-includes */ #include "BLI_math_interp.h" #endif /* expanded by -frewrite-includes */ # 73 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math.h" # 74 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math.h" #endif /* __BLI_MATH_H__ */ # 76 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math.h" # 34 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/intern/math_geom_inline.c" 2 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 35 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/intern/math_geom_inline.c" # 36 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/intern/math_geom_inline.c" /* A few small defines. Keep'em local! */ #define SMALL_NUMBER 1.e-8f /********************************** Polygons *********************************/ MINLINE float cross_tri_v2(const float v1[2], const float v2[2], const float v3[2]) { return (v1[0] - v2[0]) * (v2[1] - v3[1]) + (v1[1] - v2[1]) * (v3[0] - v2[0]); } MINLINE float area_tri_signed_v2(const float v1[2], const float v2[2], const float v3[2]) { return 0.5f * ((v1[0] - v2[0]) * (v2[1] - v3[1]) + (v1[1] - v2[1]) * (v3[0] - v2[0])); } MINLINE float area_tri_v2(const float v1[2], const float v2[2], const float v3[2]) { return fabsf(area_tri_signed_v2(v1, v2, v3)); } MINLINE float area_squared_tri_v2(const float v1[2], const float v2[2], const float v3[2]) { float area = area_tri_signed_v2(v1, v2, v3); return area * area; } /****************************** Spherical Harmonics **************************/ MINLINE void zero_sh(float r[9]) { memset(r, 0, sizeof(float) * 9); } MINLINE void copy_sh_sh(float r[9], const float a[9]) { memcpy(r, a, sizeof(float) * 9); } MINLINE void mul_sh_fl(float r[9], const float f) { int i; for (i = 0; i < 9; i++) r[i] *= f; } MINLINE void add_sh_shsh(float r[9], const float a[9], const float b[9]) { int i; for (i = 0; i < 9; i++) r[i] = a[i] + b[i]; } MINLINE float dot_shsh(const float a[9], const float b[9]) { float r = 0.0f; int i; for (i = 0; i < 9; i++) r += a[i] * b[i]; return r; } MINLINE float diffuse_shv3(float sh[9], const float v[3]) { /* See formula (13) in: * "An Efficient Representation for Irradiance Environment Maps" */ static const float c1 = 0.429043f, c2 = 0.511664f, c3 = 0.743125f; static const float c4 = 0.886227f, c5 = 0.247708f; float x, y, z, sum; x = v[0]; y = v[1]; z = v[2]; sum = c1 * sh[8] * (x * x - y * y); sum += c3 * sh[6] * z * z; sum += c4 * sh[0]; sum += -c5 * sh[6]; sum += 2.0f * c1 * (sh[4] * x * y + sh[7] * x * z + sh[5] * y * z); sum += 2.0f * c2 * (sh[3] * x + sh[1] * y + sh[2] * z); return sum; } MINLINE void vec_fac_to_sh(float r[9], const float v[3], const float f) { /* See formula (3) in: * "An Efficient Representation for Irradiance Environment Maps" */ float sh[9], x, y, z; x = v[0]; y = v[1]; z = v[2]; sh[0] = 0.282095f; sh[1] = 0.488603f * y; sh[2] = 0.488603f * z; sh[3] = 0.488603f * x; sh[4] = 1.092548f * x * y; sh[5] = 1.092548f * y * z; sh[6] = 0.315392f * (3.0f * z * z - 1.0f); sh[7] = 1.092548f * x * z; sh[8] = 0.546274f * (x * x - y * y); mul_sh_fl(sh, f); copy_sh_sh(r, sh); } MINLINE float eval_shv3(float sh[9], const float v[3]) { float tmp[9]; vec_fac_to_sh(tmp, v, 1.0f); return dot_shsh(tmp, sh); } MINLINE void madd_sh_shfl(float r[9], const float sh[9], const float f) { float tmp[9]; copy_sh_sh(tmp, sh); mul_sh_fl(tmp, f); add_sh_shsh(r, r, tmp); } /* get the 2 dominant axis values, 0==X, 1==Y, 2==Z */ MINLINE void axis_dominant_v3(int *r_axis_a, int *r_axis_b, const float axis[3]) { const float xn = fabsf(axis[0]); const float yn = fabsf(axis[1]); const float zn = fabsf(axis[2]); if (zn >= xn && zn >= yn) { *r_axis_a = 0; *r_axis_b = 1; } else if (yn >= xn && yn >= zn) { *r_axis_a = 0; *r_axis_b = 2; } else { *r_axis_a = 1; *r_axis_b = 2; } } /* same as axis_dominant_v3 but return the max value */ MINLINE float axis_dominant_v3_max(int *r_axis_a, int *r_axis_b, const float axis[3]) { const float xn = fabsf(axis[0]); const float yn = fabsf(axis[1]); const float zn = fabsf(axis[2]); if (zn >= xn && zn >= yn) { *r_axis_a = 0; *r_axis_b = 1; return zn; } else if (yn >= xn && yn >= zn) { *r_axis_a = 0; *r_axis_b = 2; return yn; } else { *r_axis_a = 1; *r_axis_b = 2; return xn; } } /* get the single dominant axis value, 0==X, 1==Y, 2==Z */ MINLINE int axis_dominant_v3_single(const float vec[3]) { const float x = fabsf(vec[0]); const float y = fabsf(vec[1]); const float z = fabsf(vec[2]); return ((x > y) ? ((x > z) ? 0 : 2) : ((y > z) ? 1 : 2)); } MINLINE int max_axis_v3(const float vec[3]) { const float x = vec[0]; const float y = vec[1]; const float z = vec[2]; return ((x > y) ? ((x > z) ? 0 : 2) : ((y > z) ? 1 : 2)); } MINLINE int min_axis_v3(const float vec[3]) { const float x = vec[0]; const float y = vec[1]; const float z = vec[2]; return ((x < y) ? ((x < z) ? 0 : 2) : ((y < z) ? 1 : 2)); } /** * Simple method to find how many tri's we need when we already know the corner+poly count. * * \param poly_count The number of ngon's/tris (1-2 sided faces will give incorrect results) * \param corner_count - also known as loops in BMesh/DNA */ MINLINE int poly_to_tri_count(const int poly_count, const int corner_count) { BLI_assert(!poly_count || corner_count > poly_count * 2); return corner_count - (poly_count * 2); } MINLINE float plane_point_side_v3(const float plane[4], const float co[3]) { return dot_v3v3(co, plane) + plane[3]; } /* useful to calculate an even width shell, by taking the angle between 2 planes. * The return value is a scale on the offset. * no angle between planes is 1.0, as the angle between the 2 planes approaches 180d * the distance gets very high, 180d would be inf, but this case isn't valid */ MINLINE float shell_angle_to_dist(const float angle) { return (UNLIKELY(angle < SMALL_NUMBER)) ? 1.0f : fabsf(1.0f / cosf(angle)); } /** * equivalent to ``shell_angle_to_dist(angle_normalized_v3v3(a, b))`` */ MINLINE float shell_v3v3_normalized_to_dist(const float a[3], const float b[3]) { const float angle_cos = fabsf(dot_v3v3(a, b)); BLI_ASSERT_UNIT_V3(a); BLI_ASSERT_UNIT_V3(b); return (UNLIKELY(angle_cos < SMALL_NUMBER)) ? 1.0f : (1.0f / angle_cos); } /** * equivalent to ``shell_angle_to_dist(angle_normalized_v2v2(a, b))`` */ MINLINE float shell_v2v2_normalized_to_dist(const float a[2], const float b[2]) { const float angle_cos = fabsf(dot_v2v2(a, b)); BLI_ASSERT_UNIT_V2(a); BLI_ASSERT_UNIT_V2(b); return (UNLIKELY(angle_cos < SMALL_NUMBER)) ? 1.0f : (1.0f / angle_cos); } /** * equivalent to ``shell_angle_to_dist(angle_normalized_v3v3(a, b) / 2)`` */ MINLINE float shell_v3v3_mid_normalized_to_dist(const float a[3], const float b[3]) { float angle_cos; float ab[3]; BLI_ASSERT_UNIT_V3(a); BLI_ASSERT_UNIT_V3(b); add_v3_v3v3(ab, a, b); angle_cos = (normalize_v3(ab) != 0.0f) ? fabsf(dot_v3v3(a, ab)) : 0.0f; return (UNLIKELY(angle_cos < SMALL_NUMBER)) ? 1.0f : (1.0f / angle_cos); } /** * equivalent to ``shell_angle_to_dist(angle_normalized_v2v2(a, b) / 2)`` */ MINLINE float shell_v2v2_mid_normalized_to_dist(const float a[2], const float b[2]) { float angle_cos; float ab[2]; BLI_ASSERT_UNIT_V2(a); BLI_ASSERT_UNIT_V2(b); add_v2_v2v2(ab, a, b); angle_cos = (normalize_v2(ab) != 0.0f) ? fabsf(dot_v2v2(a, ab)) : 0.0f; return (UNLIKELY(angle_cos < SMALL_NUMBER)) ? 1.0f : (1.0f / angle_cos); } #undef SMALL_NUMBER #endif /* __MATH_GEOM_INLINE_C__ */ # 299 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/intern/math_geom_inline.c" # 369 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_geom.h" 2 #endif # 370 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_geom.h" #ifdef BLI_MATH_GCC_WARN_PRAGMA # pragma GCC diagnostic pop #endif # 374 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_geom.h" #ifdef __cplusplus } #endif # 378 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_geom.h" #endif /* __BLI_MATH_GEOM_H__ */ # 380 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_geom.h" # 73 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math.h" 2 #if 0 /* expanded by -frewrite-includes */ #include "BLI_math_interp.h" #endif /* expanded by -frewrite-includes */ # 73 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math.h" # 1 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_interp.h" 1 /* * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * The Original Code is Copyright (C) 2012 by Blender Foundation. * All rights reserved. * * The Original Code is: all of this file. * * Contributor(s): Sergey Sharybin * * ***** END GPL LICENSE BLOCK ***** * */ #ifndef __BLI_MATH_INTERP_H__ #define __BLI_MATH_INTERP_H__ /** \file BLI_math_interp.h * \ingroup bli */ void BLI_bicubic_interpolation_fl(const float *buffer, float *output, int width, int height, int components, float u, float v); void BLI_bicubic_interpolation_char(const unsigned char *buffer, unsigned char *output, int width, int height, int components, float u, float v); void BLI_bilinear_interpolation_fl(const float *buffer, float *output, int width, int height, int components, float u, float v); void BLI_bilinear_interpolation_char(const unsigned char *buffer, unsigned char *output, int width, int height, int components, float u, float v); #define EWA_MAXIDX 255 extern const float EWA_WTS[EWA_MAXIDX + 1]; typedef void (*ewa_filter_read_pixel_cb) (void *userdata, int x, int y, float result[4]); void BLI_ewa_imp2radangle(float A, float B, float C, float F, float *a, float *b, float *th, float *ecc); /* TODO(sergey): Consider making this function inlined, so the pixel read callback * could also be inlined in order to avoid per-pixel function calls. */ void BLI_ewa_filter(const int width, const int height, const bool intpol, const bool use_alpha, const float uv[2], const float du[2], const float dv[2], ewa_filter_read_pixel_cb read_pixel_cb, void *customdata, float result[4]); #endif /* __BLI_MATH_INTERP_H__ */ # 69 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math_interp.h" # 74 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math.h" 2 #endif /* __BLI_MATH_H__ */ # 76 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_math.h" # 40 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/intern/BLI_kdopbvh.c" 2 #if 0 /* expanded by -frewrite-includes */ #include "BLI_strict_flags.h" #endif /* expanded by -frewrite-includes */ # 40 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/intern/BLI_kdopbvh.c" # 1 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_strict_flags.h" 1 /* * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * ***** END GPL LICENSE BLOCK ***** */ #ifndef __BLI_STRICT_FLAGS_H__ #define __BLI_STRICT_FLAGS_H__ /** \file BLI_strict_flags.h * \ingroup bli * \brief Strict compiler flags for areas of code we want * to ensure don't do conversions without us knowing about it. */ #ifdef __GNUC__ # if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406 /* gcc4.6+ only */ # pragma GCC diagnostic error "-Wsign-compare" # pragma GCC diagnostic error "-Wconversion" # endif # 35 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_strict_flags.h" # if (__GNUC__ * 100 + __GNUC_MINOR__) >= 408 /* gcc4.8+ only (behavior changed to ignore globals)*/ # pragma GCC diagnostic error "-Wshadow" /* older gcc changed behavior with ternary */ # pragma GCC diagnostic error "-Wsign-conversion" # endif # 41 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_strict_flags.h" /* pedantic gives too many issues, developers can define this for own use */ # ifdef WARN_PEDANTIC # pragma GCC diagnostic error "-Wpedantic" # ifdef __clang__ /* pedantic causes clang error */ # pragma GCC diagnostic ignored "-Wlanguage-extension-token" # endif # 47 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_strict_flags.h" # endif # 48 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_strict_flags.h" #endif # 49 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_strict_flags.h" #ifdef _MSC_VER # pragma warning(error:4018) /* signed/unsigned mismatch */ # pragma warning(error:4244) /* conversion from 'type1' to 'type2', possible loss of data */ # pragma warning(error:4245) /* conversion from 'int' to 'unsigned int' */ # pragma warning(error:4267) /* conversion from 'size_t' to 'type', possible loss of data */ # pragma warning(error:4305) /* truncation from 'type1' to 'type2' */ # pragma warning(error:4389) /* signed/unsigned mismatch */ #endif # 58 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_strict_flags.h" #endif /* __BLI_STRICT_FLAGS_H__ */ # 60 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/BLI_strict_flags.h" # 41 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/intern/BLI_kdopbvh.c" 2 #ifdef _OPENMP #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 43 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/intern/BLI_kdopbvh.c" # 1 "/usr/local/llvm37/bin/../lib/clang/3.7.0/include/omp.h" 1 3 4 /* * include/41/omp.h.var */ //===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.txt for details. // //===----------------------------------------------------------------------===// #ifndef __OMP_H # define __OMP_H # define KMP_VERSION_MAJOR 5 # define KMP_VERSION_MINOR 0 # define KMP_VERSION_BUILD 20140926 # define KMP_BUILD_DATE "No_Timestamp" # ifdef __cplusplus extern "C" { # endif # 27 "/usr/local/llvm37/bin/../lib/clang/3.7.0/include/omp.h" 3 4 # if defined(_WIN32) # define __KAI_KMPC_CONVENTION __cdecl # else # 31 "/usr/local/llvm37/bin/../lib/clang/3.7.0/include/omp.h" 3 4 # define __KAI_KMPC_CONVENTION # endif # 33 "/usr/local/llvm37/bin/../lib/clang/3.7.0/include/omp.h" 3 4 /* schedule kind constants */ typedef enum omp_sched_t { omp_sched_static = 1, omp_sched_dynamic = 2, omp_sched_guided = 3, omp_sched_auto = 4 } omp_sched_t; /* set API functions */ extern void __KAI_KMPC_CONVENTION omp_set_num_threads (int); extern void __KAI_KMPC_CONVENTION omp_set_dynamic (int); extern void __KAI_KMPC_CONVENTION omp_set_nested (int); extern void __KAI_KMPC_CONVENTION omp_set_max_active_levels (int); extern void __KAI_KMPC_CONVENTION omp_set_schedule (omp_sched_t, int); /* query API functions */ extern int __KAI_KMPC_CONVENTION omp_get_num_threads (void); extern int __KAI_KMPC_CONVENTION omp_get_dynamic (void); extern int __KAI_KMPC_CONVENTION omp_get_nested (void); extern int __KAI_KMPC_CONVENTION omp_get_max_threads (void); extern int __KAI_KMPC_CONVENTION omp_get_thread_num (void); extern int __KAI_KMPC_CONVENTION omp_get_num_procs (void); extern int __KAI_KMPC_CONVENTION omp_in_parallel (void); extern int __KAI_KMPC_CONVENTION omp_in_final (void); extern int __KAI_KMPC_CONVENTION omp_get_active_level (void); extern int __KAI_KMPC_CONVENTION omp_get_level (void); extern int __KAI_KMPC_CONVENTION omp_get_ancestor_thread_num (int); extern int __KAI_KMPC_CONVENTION omp_get_team_size (int); extern int __KAI_KMPC_CONVENTION omp_get_thread_limit (void); extern int __KAI_KMPC_CONVENTION omp_get_max_active_levels (void); extern void __KAI_KMPC_CONVENTION omp_get_schedule (omp_sched_t *, int *); /* lock API functions */ typedef struct omp_lock_t { void * _lk; } omp_lock_t; extern void __KAI_KMPC_CONVENTION omp_init_lock (omp_lock_t *); extern void __KAI_KMPC_CONVENTION omp_set_lock (omp_lock_t *); extern void __KAI_KMPC_CONVENTION omp_unset_lock (omp_lock_t *); extern void __KAI_KMPC_CONVENTION omp_destroy_lock (omp_lock_t *); extern int __KAI_KMPC_CONVENTION omp_test_lock (omp_lock_t *); /* nested lock API functions */ typedef struct omp_nest_lock_t { void * _lk; } omp_nest_lock_t; extern void __KAI_KMPC_CONVENTION omp_init_nest_lock (omp_nest_lock_t *); extern void __KAI_KMPC_CONVENTION omp_set_nest_lock (omp_nest_lock_t *); extern void __KAI_KMPC_CONVENTION omp_unset_nest_lock (omp_nest_lock_t *); extern void __KAI_KMPC_CONVENTION omp_destroy_nest_lock (omp_nest_lock_t *); extern int __KAI_KMPC_CONVENTION omp_test_nest_lock (omp_nest_lock_t *); /* lock hint type for dynamic user lock */ typedef enum kmp_lock_hint_t { kmp_lock_hint_none = 0, kmp_lock_hint_contended, kmp_lock_hint_uncontended, kmp_lock_hint_nonspeculative, kmp_lock_hint_speculative, kmp_lock_hint_adaptive, } kmp_lock_hint_t; /* hinted lock initializers */ extern void __KAI_KMPC_CONVENTION kmp_init_lock_hinted(omp_lock_t *, kmp_lock_hint_t); extern void __KAI_KMPC_CONVENTION kmp_init_nest_lock_hinted(omp_nest_lock_t *, kmp_lock_hint_t); /* time API functions */ extern double __KAI_KMPC_CONVENTION omp_get_wtime (void); extern double __KAI_KMPC_CONVENTION omp_get_wtick (void); /* OpenMP 4.0 */ extern int __KAI_KMPC_CONVENTION omp_get_default_device (void); extern void __KAI_KMPC_CONVENTION omp_set_default_device (int); extern int __KAI_KMPC_CONVENTION omp_is_initial_device (void); extern int __KAI_KMPC_CONVENTION omp_get_num_devices (void); extern int __KAI_KMPC_CONVENTION omp_get_num_teams (void); extern int __KAI_KMPC_CONVENTION omp_get_team_num (void); extern int __KAI_KMPC_CONVENTION omp_get_cancellation (void); #if 0 /* expanded by -frewrite-includes */ # include #endif /* expanded by -frewrite-includes */ # 115 "/usr/local/llvm37/bin/../lib/clang/3.7.0/include/omp.h" 3 4 # 116 "/usr/local/llvm37/bin/../lib/clang/3.7.0/include/omp.h" 3 4 /* kmp API functions */ extern int __KAI_KMPC_CONVENTION kmp_get_stacksize (void); extern void __KAI_KMPC_CONVENTION kmp_set_stacksize (int); extern size_t __KAI_KMPC_CONVENTION kmp_get_stacksize_s (void); extern void __KAI_KMPC_CONVENTION kmp_set_stacksize_s (size_t); extern int __KAI_KMPC_CONVENTION kmp_get_blocktime (void); extern int __KAI_KMPC_CONVENTION kmp_get_library (void); extern void __KAI_KMPC_CONVENTION kmp_set_blocktime (int); extern void __KAI_KMPC_CONVENTION kmp_set_library (int); extern void __KAI_KMPC_CONVENTION kmp_set_library_serial (void); extern void __KAI_KMPC_CONVENTION kmp_set_library_turnaround (void); extern void __KAI_KMPC_CONVENTION kmp_set_library_throughput (void); extern void __KAI_KMPC_CONVENTION kmp_set_defaults (char const *); /* Intel affinity API */ typedef void * kmp_affinity_mask_t; extern int __KAI_KMPC_CONVENTION kmp_set_affinity (kmp_affinity_mask_t *); extern int __KAI_KMPC_CONVENTION kmp_get_affinity (kmp_affinity_mask_t *); extern int __KAI_KMPC_CONVENTION kmp_get_affinity_max_proc (void); extern void __KAI_KMPC_CONVENTION kmp_create_affinity_mask (kmp_affinity_mask_t *); extern void __KAI_KMPC_CONVENTION kmp_destroy_affinity_mask (kmp_affinity_mask_t *); extern int __KAI_KMPC_CONVENTION kmp_set_affinity_mask_proc (int, kmp_affinity_mask_t *); extern int __KAI_KMPC_CONVENTION kmp_unset_affinity_mask_proc (int, kmp_affinity_mask_t *); extern int __KAI_KMPC_CONVENTION kmp_get_affinity_mask_proc (int, kmp_affinity_mask_t *); /* OpenMP 4.0 affinity API */ typedef enum omp_proc_bind_t { omp_proc_bind_false = 0, omp_proc_bind_true = 1, omp_proc_bind_master = 2, omp_proc_bind_close = 3, omp_proc_bind_spread = 4 } omp_proc_bind_t; extern omp_proc_bind_t __KAI_KMPC_CONVENTION omp_get_proc_bind (void); extern void * __KAI_KMPC_CONVENTION kmp_malloc (size_t); extern void * __KAI_KMPC_CONVENTION kmp_calloc (size_t, size_t); extern void * __KAI_KMPC_CONVENTION kmp_realloc (void *, size_t); extern void __KAI_KMPC_CONVENTION kmp_free (void *); extern void __KAI_KMPC_CONVENTION kmp_set_warnings_on(void); extern void __KAI_KMPC_CONVENTION kmp_set_warnings_off(void); # undef __KAI_KMPC_CONVENTION /* Warning: The following typedefs are not standard, deprecated and will be removed in a future release. */ typedef int omp_int_t; typedef double omp_wtime_t; # ifdef __cplusplus } # endif # 172 "/usr/local/llvm37/bin/../lib/clang/3.7.0/include/omp.h" 3 4 #endif /* __OMP_H */ # 174 "/usr/local/llvm37/bin/../lib/clang/3.7.0/include/omp.h" 3 4 # 44 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/intern/BLI_kdopbvh.c" 2 #endif # 45 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/intern/BLI_kdopbvh.c" /* used for iterative_raycast */ // #define USE_SKIP_LINKS #define MAX_TREETYPE 32 /* Setting zero so we can catch bugs in OpenMP/KDOPBVH. * TODO(sergey): Deduplicate the limits with PBVH from BKE. */ #ifdef _OPENMP # ifdef DEBUG # define KDOPBVH_OMP_LIMIT 0 # else # 58 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/intern/BLI_kdopbvh.c" # define KDOPBVH_OMP_LIMIT 1024 # endif # 60 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/intern/BLI_kdopbvh.c" #endif # 61 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/intern/BLI_kdopbvh.c" typedef unsigned char axis_t; typedef struct BVHNode { struct BVHNode **children; struct BVHNode *parent; /* some user defined traversed need that */ #ifdef USE_SKIP_LINKS struct BVHNode *skip[2]; #endif # 70 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/intern/BLI_kdopbvh.c" float *bv; /* Bounding volume of all nodes, max 13 axis */ int index; /* face, edge, vertex index */ char totnode; /* how many nodes are used, used for speedup */ char main_axis; /* Axis used to split this node */ } BVHNode; /* keep under 26 bytes for speed purposes */ struct BVHTree { BVHNode **nodes; BVHNode *nodearray; /* pre-alloc branch nodes */ BVHNode **nodechild; /* pre-alloc childs for nodes */ float *nodebv; /* pre-alloc bounding-volumes for nodes */ float epsilon; /* epslion is used for inflation of the k-dop */ int totleaf; /* leafs */ int totbranch; axis_t start_axis, stop_axis; /* KDOP_AXES array indices according to axis */ axis_t axis; /* kdop type (6 => OBB, 7 => AABB, ...) */ char tree_type; /* type of tree (4 => quadtree) */ }; /* optimization, ensure we stay small */ BLI_STATIC_ASSERT((sizeof(void *) == 8 && sizeof(BVHTree) <= 48) || (sizeof(void *) == 4 && sizeof(BVHTree) <= 32), "over sized") typedef struct BVHOverlapData { BVHTree *tree1, *tree2; struct BLI_Stack *overlap; /* store BVHTreeOverlap */ axis_t start_axis, stop_axis; } BVHOverlapData; typedef struct BVHNearestData { BVHTree *tree; const float *co; BVHTree_NearestPointCallback callback; void *userdata; float proj[13]; /* coordinates projection over axis */ BVHTreeNearest nearest; } BVHNearestData; typedef struct BVHRayCastData { BVHTree *tree; BVHTree_RayCastCallback callback; void *userdata; BVHTreeRay ray; float ray_dot_axis[13]; float idot_axis[13]; int index[6]; BVHTreeRayHit hit; } BVHRayCastData; /** * Bounding Volume Hierarchy Definition * * Notes: From OBB until 26-DOP --> all bounding volumes possible, just choose type below * Notes: You have to choose the type at compile time ITM * Notes: You can choose the tree type --> binary, quad, octree, choose below */ static const float KDOP_AXES[13][3] = { {1.0, 0, 0}, {0, 1.0, 0}, {0, 0, 1.0}, {1.0, 1.0, 1.0}, {1.0, -1.0, 1.0}, {1.0, 1.0, -1.0}, {1.0, -1.0, -1.0}, {1.0, 1.0, 0}, {1.0, 0, 1.0}, {0, 1.0, 1.0}, {1.0, -1.0, 0}, {1.0, 0, -1.0}, {0, 1.0, -1.0} }; MINLINE axis_t min_axis(axis_t a, axis_t b) { return (a < b) ? a : b; } #if 0 MINLINE axis_t max_axis(axis_t a, axis_t b) { return (b < a) ? a : b; } #endif # 151 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/intern/BLI_kdopbvh.c" #if 0 /* * Generic push and pop heap */ #define PUSH_HEAP_BODY(HEAP_TYPE, PRIORITY, heap, heap_size) \ { \ HEAP_TYPE element = heap[heap_size - 1]; \ int child = heap_size - 1; \ while (child != 0) { \ int parent = (child - 1) / 2; \ if (PRIORITY(element, heap[parent])) { \ heap[child] = heap[parent]; \ child = parent; \ } \ else { \ break; \ } \ } \ heap[child] = element; \ } (void)0 #define POP_HEAP_BODY(HEAP_TYPE, PRIORITY, heap, heap_size) \ { \ HEAP_TYPE element = heap[heap_size - 1]; \ int parent = 0; \ while (parent < (heap_size - 1) / 2) { \ int child2 = (parent + 1) * 2; \ if (PRIORITY(heap[child2 - 1], heap[child2])) { \ child2--; \ } \ if (PRIORITY(element, heap[child2])) { \ break; \ } \ heap[parent] = heap[child2]; \ parent = child2; \ } \ heap[parent] = element; \ } (void)0 static bool ADJUST_MEMORY(void *local_memblock, void **memblock, int new_size, int *max_size, int size_per_item) { int new_max_size = *max_size * 2; void *new_memblock = NULL; if (new_size <= *max_size) { return true; } if (*memblock == local_memblock) { new_memblock = malloc(size_per_item * new_max_size); memcpy(new_memblock, *memblock, size_per_item * *max_size); } else { new_memblock = realloc(*memblock, size_per_item * new_max_size); } if (new_memblock) { *memblock = new_memblock; *max_size = new_max_size; return true; } else { return false; } } #endif # 219 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/intern/BLI_kdopbvh.c" /** * Introsort * with permission deriven from the following Java code: * http://ralphunden.net/content/tutorials/a-guide-to-introsort/ * and he derived it from the SUN STL */ //static int size_threshold = 16; #if 0 /** * Common methods for all algorithms */ static int floor_lg(int a) { return (int)(floor(log(a) / log(2))); } #endif # 238 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/intern/BLI_kdopbvh.c" static void node_minmax_init(const BVHTree *tree, BVHNode *node) { axis_t axis_iter; float (*bv)[2] = (float (*)[2])node->bv; for (axis_iter = tree->start_axis; axis_iter != tree->stop_axis; axis_iter++) { bv[axis_iter][0] = FLT_MAX; bv[axis_iter][1] = -FLT_MAX; } } /** * Insertion sort algorithm */ static void bvh_insertionsort(BVHNode **a, int lo, int hi, int axis) { int i, j; BVHNode *t; for (i = lo; i < hi; i++) { j = i; t = a[i]; while ((j != lo) && (t->bv[axis] < (a[j - 1])->bv[axis])) { a[j] = a[j - 1]; j--; } a[j] = t; } } static int bvh_partition(BVHNode **a, int lo, int hi, BVHNode *x, int axis) { int i = lo, j = hi; while (1) { while ((a[i])->bv[axis] < x->bv[axis]) i++; j--; while (x->bv[axis] < (a[j])->bv[axis]) j--; if (!(i < j)) return i; SWAP(BVHNode *, a[i], a[j]); i++; } } #if 0 /** * Heapsort algorithm */ static void bvh_downheap(BVHNode **a, int i, int n, int lo, int axis) { BVHNode *d = a[lo + i - 1]; int child; while (i <= n / 2) { child = 2 * i; if ((child < n) && ((a[lo + child - 1])->bv[axis] < (a[lo + child])->bv[axis])) { child++; } if (!(d->bv[axis] < (a[lo + child - 1])->bv[axis])) break; a[lo + i - 1] = a[lo + child - 1]; i = child; } a[lo + i - 1] = d; } static void bvh_heapsort(BVHNode **a, int lo, int hi, int axis) { int n = hi - lo, i; for (i = n / 2; i >= 1; i = i - 1) { bvh_downheap(a, i, n, lo, axis); } for (i = n; i > 1; i = i - 1) { SWAP(BVHNode *, a[lo], a[lo + i - 1]); bvh_downheap(a, 1, i - 1, lo, axis); } } #endif # 314 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/intern/BLI_kdopbvh.c" static BVHNode *bvh_medianof3(BVHNode **a, int lo, int mid, int hi, int axis) /* returns Sortable */ { if ((a[mid])->bv[axis] < (a[lo])->bv[axis]) { if ((a[hi])->bv[axis] < (a[mid])->bv[axis]) return a[mid]; else { if ((a[hi])->bv[axis] < (a[lo])->bv[axis]) return a[hi]; else return a[lo]; } } else { if ((a[hi])->bv[axis] < (a[mid])->bv[axis]) { if ((a[hi])->bv[axis] < (a[lo])->bv[axis]) return a[lo]; else return a[hi]; } else return a[mid]; } } #if 0 /* * Quicksort algorithm modified for Introsort */ static void bvh_introsort_loop(BVHNode **a, int lo, int hi, int depth_limit, int axis) { int p; while (hi - lo > size_threshold) { if (depth_limit == 0) { bvh_heapsort(a, lo, hi, axis); return; } depth_limit = depth_limit - 1; p = bvh_partition(a, lo, hi, bvh_medianof3(a, lo, lo + ((hi - lo) / 2) + 1, hi - 1, axis), axis); bvh_introsort_loop(a, p, hi, depth_limit, axis); hi = p; } } static void sort(BVHNode **a0, int begin, int end, int axis) { if (begin < end) { BVHNode **a = a0; bvh_introsort_loop(a, begin, end, 2 * floor_lg(end - begin), axis); bvh_insertionsort(a, begin, end, axis); } } static void sort_along_axis(BVHTree *tree, int start, int end, int axis) { sort(tree->nodes, start, end, axis); } #endif # 373 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/intern/BLI_kdopbvh.c" /** * \note after a call to this function you can expect one of: * - every node to left of a[n] are smaller or equal to it * - every node to the right of a[n] are greater or equal to it */ static int partition_nth_element(BVHNode **a, int _begin, int _end, int n, int axis) { int begin = _begin, end = _end, cut; while (end - begin > 3) { cut = bvh_partition(a, begin, end, bvh_medianof3(a, begin, (begin + end) / 2, end - 1, axis), axis); if (cut <= n) begin = cut; else end = cut; } bvh_insertionsort(a, begin, end, axis); return n; } #ifdef USE_SKIP_LINKS static void build_skip_links(BVHTree *tree, BVHNode *node, BVHNode *left, BVHNode *right) { int i; node->skip[0] = left; node->skip[1] = right; for (i = 0; i < node->totnode; i++) { if (i + 1 < node->totnode) build_skip_links(tree, node->children[i], left, node->children[i + 1]); else build_skip_links(tree, node->children[i], left, right); left = node->children[i]; } } #endif # 411 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/intern/BLI_kdopbvh.c" /* * BVHTree bounding volumes functions */ static void create_kdop_hull(BVHTree *tree, BVHNode *node, const float *co, int numpoints, int moving) { float newminmax; float *bv = node->bv; int k; axis_t axis_iter; /* don't init boudings for the moving case */ if (!moving) { node_minmax_init(tree, node); } for (k = 0; k < numpoints; k++) { /* for all Axes. */ for (axis_iter = tree->start_axis; axis_iter < tree->stop_axis; axis_iter++) { newminmax = dot_v3v3(&co[k * 3], KDOP_AXES[axis_iter]); if (newminmax < bv[2 * axis_iter]) bv[2 * axis_iter] = newminmax; if (newminmax > bv[(2 * axis_iter) + 1]) bv[(2 * axis_iter) + 1] = newminmax; } } } /** * \note depends on the fact that the BVH's for each face is already build */ static void refit_kdop_hull(BVHTree *tree, BVHNode *node, int start, int end) { float newmin, newmax; float *bv = node->bv; int j; axis_t axis_iter; node_minmax_init(tree, node); for (j = start; j < end; j++) { /* for all Axes. */ for (axis_iter = tree->start_axis; axis_iter < tree->stop_axis; axis_iter++) { newmin = tree->nodes[j]->bv[(2 * axis_iter)]; if ((newmin < bv[(2 * axis_iter)])) bv[(2 * axis_iter)] = newmin; newmax = tree->nodes[j]->bv[(2 * axis_iter) + 1]; if ((newmax > bv[(2 * axis_iter) + 1])) bv[(2 * axis_iter) + 1] = newmax; } } } /** * only supports x,y,z axis in the moment * but we should use a plain and simple function here for speed sake */ static char get_largest_axis(const float *bv) { float middle_point[3]; middle_point[0] = (bv[1]) - (bv[0]); /* x axis */ middle_point[1] = (bv[3]) - (bv[2]); /* y axis */ middle_point[2] = (bv[5]) - (bv[4]); /* z axis */ if (middle_point[0] > middle_point[1]) { if (middle_point[0] > middle_point[2]) return 1; /* max x axis */ else return 5; /* max z axis */ } else { if (middle_point[1] > middle_point[2]) return 3; /* max y axis */ else return 5; /* max z axis */ } } /** * bottom-up update of bvh node BV * join the children on the parent BV */ static void node_join(BVHTree *tree, BVHNode *node) { int i; axis_t axis_iter; node_minmax_init(tree, node); for (i = 0; i < tree->tree_type; i++) { if (node->children[i]) { for (axis_iter = tree->start_axis; axis_iter < tree->stop_axis; axis_iter++) { /* update minimum */ if (node->children[i]->bv[(2 * axis_iter)] < node->bv[(2 * axis_iter)]) node->bv[(2 * axis_iter)] = node->children[i]->bv[(2 * axis_iter)]; /* update maximum */ if (node->children[i]->bv[(2 * axis_iter) + 1] > node->bv[(2 * axis_iter) + 1]) node->bv[(2 * axis_iter) + 1] = node->children[i]->bv[(2 * axis_iter) + 1]; } } else break; } } /* * Debug and information functions */ #if 0 static void bvhtree_print_tree(BVHTree *tree, BVHNode *node, int depth) { int i; axis_t axis_iter; for (i = 0; i < depth; i++) printf(" "); printf(" - %d (%ld): ", node->index, (long int)(node - tree->nodearray)); for (axis_iter = (axis_t)(2 * tree->start_axis); axis_iter < (axis_t)(2 * tree->stop_axis); axis_iter++) { printf("%.3f ", node->bv[axis_iter]); } printf("\n"); for (i = 0; i < tree->tree_type; i++) if (node->children[i]) bvhtree_print_tree(tree, node->children[i], depth + 1); } static void bvhtree_info(BVHTree *tree) { printf("BVHTree info\n"); printf("tree_type = %d, axis = %d, epsilon = %f\n", tree->tree_type, tree->axis, tree->epsilon); printf("nodes = %d, branches = %d, leafs = %d\n", tree->totbranch + tree->totleaf, tree->totbranch, tree->totleaf); printf("Memory per node = %ldbytes\n", sizeof(BVHNode) + sizeof(BVHNode *) * tree->tree_type + sizeof(float) * tree->axis); printf("BV memory = %dbytes\n", (int)MEM_allocN_len(tree->nodebv)); printf("Total memory = %ldbytes\n", sizeof(BVHTree) + MEM_allocN_len(tree->nodes) + MEM_allocN_len(tree->nodearray) + MEM_allocN_len(tree->nodechild) + MEM_allocN_len(tree->nodebv)); // bvhtree_print_tree(tree, tree->nodes[tree->totleaf], 0); } #endif # 558 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/intern/BLI_kdopbvh.c" #if 0 static void verify_tree(BVHTree *tree) { int i, j, check = 0; /* check the pointer list */ for (i = 0; i < tree->totleaf; i++) { if (tree->nodes[i]->parent == NULL) { printf("Leaf has no parent: %d\n", i); } else { for (j = 0; j < tree->tree_type; j++) { if (tree->nodes[i]->parent->children[j] == tree->nodes[i]) check = 1; } if (!check) { printf("Parent child relationship doesn't match: %d\n", i); } check = 0; } } /* check the leaf list */ for (i = 0; i < tree->totleaf; i++) { if (tree->nodearray[i].parent == NULL) { printf("Leaf has no parent: %d\n", i); } else { for (j = 0; j < tree->tree_type; j++) { if (tree->nodearray[i].parent->children[j] == &tree->nodearray[i]) check = 1; } if (!check) { printf("Parent child relationship doesn't match: %d\n", i); } check = 0; } } printf("branches: %d, leafs: %d, total: %d\n", tree->totbranch, tree->totleaf, tree->totbranch + tree->totleaf); } #endif # 603 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/intern/BLI_kdopbvh.c" /* Helper data and structures to build a min-leaf generalized implicit tree * This code can be easily reduced (basicly this is only method to calculate pow(k, n) in O(1).. and stuff like that) */ typedef struct BVHBuildHelper { int tree_type; /* */ int totleafs; /* */ int leafs_per_child[32]; /* Min number of leafs that are archievable from a node at depth N */ int branches_on_level[32]; /* Number of nodes at depth N (tree_type^N) */ int remain_leafs; /* Number of leafs that are placed on the level that is not 100% filled */ } BVHBuildHelper; static void build_implicit_tree_helper(BVHTree *tree, BVHBuildHelper *data) { int depth = 0; int remain; int nnodes; data->totleafs = tree->totleaf; data->tree_type = tree->tree_type; /* Calculate the smallest tree_type^n such that tree_type^n >= num_leafs */ for (data->leafs_per_child[0] = 1; data->leafs_per_child[0] < data->totleafs; data->leafs_per_child[0] *= data->tree_type) { /* pass */ } data->branches_on_level[0] = 1; for (depth = 1; (depth < 32) && data->leafs_per_child[depth - 1]; depth++) { data->branches_on_level[depth] = data->branches_on_level[depth - 1] * data->tree_type; data->leafs_per_child[depth] = data->leafs_per_child[depth - 1] / data->tree_type; } remain = data->totleafs - data->leafs_per_child[1]; nnodes = (remain + data->tree_type - 2) / (data->tree_type - 1); data->remain_leafs = remain + nnodes; } // return the min index of all the leafs archivable with the given branch static int implicit_leafs_index(BVHBuildHelper *data, int depth, int child_index) { int min_leaf_index = child_index * data->leafs_per_child[depth - 1]; if (min_leaf_index <= data->remain_leafs) return min_leaf_index; else if (data->leafs_per_child[depth]) return data->totleafs - (data->branches_on_level[depth - 1] - child_index) * data->leafs_per_child[depth]; else return data->remain_leafs; } /** * Generalized implicit tree build * * An implicit tree is a tree where its structure is implied, thus there is no need to store child pointers or indexs. * Its possible to find the position of the child or the parent with simple maths (multiplication and adittion). This type * of tree is for example used on heaps.. where node N has its childs at indexs N*2 and N*2+1. * * Although in this case the tree type is general.. and not know until runtime. * tree_type stands for the maximum number of childs that a tree node can have. * All tree types >= 2 are supported. * * Advantages of the used trees include: * - No need to store child/parent relations (they are implicit); * - Any node child always has an index greater than the parent; * - Brother nodes are sequential in memory; * * * Some math relations derived for general implicit trees: * * K = tree_type, ( 2 <= K ) * ROOT = 1 * N child of node A = A * K + (2 - K) + N, (0 <= N < K) * * Util methods: * TODO... * (looping elements, knowing if its a leaf or not.. etc...) */ /* This functions returns the number of branches needed to have the requested number of leafs. */ static int implicit_needed_branches(int tree_type, int leafs) { return max_ii(1, (leafs + tree_type - 3) / (tree_type - 1)); } /** * This function handles the problem of "sorting" the leafs (along the split_axis). * * It arranges the elements in the given partitions such that: * - any element in partition N is less or equal to any element in partition N+1. * - if all elements are different all partition will get the same subset of elements * as if the array was sorted. * * partition P is described as the elements in the range ( nth[P], nth[P+1] ] * * TODO: This can be optimized a bit by doing a specialized nth_element instead of K nth_elements */ static void split_leafs(BVHNode **leafs_array, int *nth, int partitions, int split_axis) { int i; for (i = 0; i < partitions - 1; i++) { if (nth[i] >= nth[partitions]) break; partition_nth_element(leafs_array, nth[i], nth[partitions], nth[i + 1], split_axis); } } /** * This functions builds an optimal implicit tree from the given leafs. * Where optimal stands for: * - The resulting tree will have the smallest number of branches; * - At most only one branch will have NULL childs; * - All leafs will be stored at level N or N+1. * * This function creates an implicit tree on branches_array, the leafs are given on the leafs_array. * * The tree is built per depth levels. First branches at depth 1.. then branches at depth 2.. etc.. * The reason is that we can build level N+1 from level N without any data dependencies.. thus it allows * to use multithread building. * * To archive this is necessary to find how much leafs are accessible from a certain branch, BVHBuildHelper * implicit_needed_branches and implicit_leafs_index are auxiliary functions to solve that "optimal-split". */ static void non_recursive_bvh_div_nodes(BVHTree *tree, BVHNode *branches_array, BVHNode **leafs_array, int num_leafs) { int i; const int tree_type = tree->tree_type; const int tree_offset = 2 - tree->tree_type; /* this value is 0 (on binary trees) and negative on the others */ const int num_branches = implicit_needed_branches(tree_type, num_leafs); BVHBuildHelper data; int depth; /* set parent from root node to NULL */ BVHNode *tmp = branches_array + 0; tmp->parent = NULL; /* Most of bvhtree code relies on 1-leaf trees having at least one branch * We handle that special case here */ if (num_leafs == 1) { BVHNode *root = branches_array + 0; refit_kdop_hull(tree, root, 0, num_leafs); root->main_axis = get_largest_axis(root->bv) / 2; root->totnode = 1; root->children[0] = leafs_array[0]; root->children[0]->parent = root; return; } branches_array--; /* Implicit trees use 1-based indexs */ build_implicit_tree_helper(tree, &data); /* Loop tree levels (log N) loops */ for (i = 1, depth = 1; i <= num_branches; i = i * tree_type + tree_offset, depth++) { const int first_of_next_level = i * tree_type + tree_offset; const int end_j = min_ii(first_of_next_level, num_branches + 1); /* index of last branch on this level */ int j; /* Loop all branches on this level */ #pragma omp parallel for private(j) schedule(static) if (num_leafs > KDOPBVH_OMP_LIMIT) for (j = i; j < end_j; j++) { int k; const int parent_level_index = j - i; BVHNode *parent = branches_array + j; int nth_positions[MAX_TREETYPE + 1]; char split_axis; int parent_leafs_begin = implicit_leafs_index(&data, depth, parent_level_index); int parent_leafs_end = implicit_leafs_index(&data, depth, parent_level_index + 1); /* This calculates the bounding box of this branch * and chooses the largest axis as the axis to divide leafs */ refit_kdop_hull(tree, parent, parent_leafs_begin, parent_leafs_end); split_axis = get_largest_axis(parent->bv); /* Save split axis (this can be used on raytracing to speedup the query time) */ parent->main_axis = split_axis / 2; /* Split the childs along the split_axis, note: its not needed to sort the whole leafs array * Only to assure that the elements are partitioned on a way that each child takes the elements * it would take in case the whole array was sorted. * Split_leafs takes care of that "sort" problem. */ nth_positions[0] = parent_leafs_begin; nth_positions[tree_type] = parent_leafs_end; for (k = 1; k < tree_type; k++) { int child_index = j * tree_type + tree_offset + k; int child_level_index = child_index - first_of_next_level; /* child level index */ nth_positions[k] = implicit_leafs_index(&data, depth + 1, child_level_index); } split_leafs(leafs_array, nth_positions, tree_type, split_axis); /* Setup children and totnode counters * Not really needed but currently most of BVH code relies on having an explicit children structure */ for (k = 0; k < tree_type; k++) { int child_index = j * tree_type + tree_offset + k; int child_level_index = child_index - first_of_next_level; /* child level index */ int child_leafs_begin = implicit_leafs_index(&data, depth + 1, child_level_index); int child_leafs_end = implicit_leafs_index(&data, depth + 1, child_level_index + 1); if (child_leafs_end - child_leafs_begin > 1) { parent->children[k] = branches_array + child_index; parent->children[k]->parent = parent; } else if (child_leafs_end - child_leafs_begin == 1) { parent->children[k] = leafs_array[child_leafs_begin]; parent->children[k]->parent = parent; } else { break; } parent->totnode = (char)(k + 1); } } } } /* -------------------------------------------------------------------- */ /* BLI_bvhtree api */ /** * \note many callers don't check for ``NULL`` return. */ BVHTree *BLI_bvhtree_new(int maxsize, float epsilon, char tree_type, char axis) { BVHTree *tree; int numnodes, i; BLI_assert(tree_type >= 2 && tree_type <= MAX_TREETYPE); tree = MEM_callocN(sizeof(BVHTree), "BVHTree"); /* tree epsilon must be >= FLT_EPSILON * so that tangent rays can still hit a bounding volume.. * this bug would show up when casting a ray aligned with a kdop-axis and with an edge of 2 faces */ epsilon = max_ff(FLT_EPSILON, epsilon); if (tree) { tree->epsilon = epsilon; tree->tree_type = tree_type; tree->axis = axis; if (axis == 26) { tree->start_axis = 0; tree->stop_axis = 13; } else if (axis == 18) { tree->start_axis = 7; tree->stop_axis = 13; } else if (axis == 14) { tree->start_axis = 0; tree->stop_axis = 7; } else if (axis == 8) { /* AABB */ tree->start_axis = 0; tree->stop_axis = 4; } else if (axis == 6) { /* OBB */ tree->start_axis = 0; tree->stop_axis = 3; } else { /* should never happen! */ BLI_assert(0); goto fail; } /* Allocate arrays */ numnodes = maxsize + implicit_needed_branches(tree_type, maxsize) + tree_type; tree->nodes = MEM_callocN(sizeof(BVHNode *) * (size_t)numnodes, "BVHNodes"); tree->nodebv = MEM_callocN(sizeof(float) * (size_t)(axis * numnodes), "BVHNodeBV"); tree->nodechild = MEM_callocN(sizeof(BVHNode *) * (size_t)(tree_type * numnodes), "BVHNodeBV"); tree->nodearray = MEM_callocN(sizeof(BVHNode) * (size_t)numnodes, "BVHNodeArray"); if (UNLIKELY((!tree->nodes) || (!tree->nodebv) || (!tree->nodechild) || (!tree->nodearray))) { goto fail; } /* link the dynamic bv and child links */ for (i = 0; i < numnodes; i++) { tree->nodearray[i].bv = &tree->nodebv[i * axis]; tree->nodearray[i].children = &tree->nodechild[i * tree_type]; } } return tree; fail: MEM_SAFE_FREE(tree->nodes); MEM_SAFE_FREE(tree->nodebv); MEM_SAFE_FREE(tree->nodechild); MEM_SAFE_FREE(tree->nodearray); MEM_freeN(tree); return NULL; } void BLI_bvhtree_free(BVHTree *tree) { if (tree) { MEM_freeN(tree->nodes); MEM_freeN(tree->nodearray); MEM_freeN(tree->nodebv); MEM_freeN(tree->nodechild); MEM_freeN(tree); } } void BLI_bvhtree_balance(BVHTree *tree) { int i; BVHNode *branches_array = tree->nodearray + tree->totleaf; BVHNode **leafs_array = tree->nodes; /* This function should only be called once (some big bug goes here if its being called more than once per tree) */ BLI_assert(tree->totbranch == 0); /* Build the implicit tree */ non_recursive_bvh_div_nodes(tree, branches_array, leafs_array, tree->totleaf); /* current code expects the branches to be linked to the nodes array * we perform that linkage here */ tree->totbranch = implicit_needed_branches(tree->tree_type, tree->totleaf); for (i = 0; i < tree->totbranch; i++) tree->nodes[tree->totleaf + i] = branches_array + i; #ifdef USE_SKIP_LINKS build_skip_links(tree, tree->nodes[tree->totleaf], NULL, NULL); #endif # 954 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/intern/BLI_kdopbvh.c" /* bvhtree_info(tree); */ } void BLI_bvhtree_insert(BVHTree *tree, int index, const float co[3], int numpoints) { axis_t axis_iter; BVHNode *node = NULL; /* insert should only possible as long as tree->totbranch is 0 */ BLI_assert(tree->totbranch <= 0); BLI_assert((size_t)tree->totleaf < MEM_allocN_len(tree->nodes) / sizeof(*(tree->nodes))); node = tree->nodes[tree->totleaf] = &(tree->nodearray[tree->totleaf]); tree->totleaf++; create_kdop_hull(tree, node, co, numpoints, 0); node->index = index; /* inflate the bv with some epsilon */ for (axis_iter = tree->start_axis; axis_iter < tree->stop_axis; axis_iter++) { node->bv[(2 * axis_iter)] -= tree->epsilon; /* minimum */ node->bv[(2 * axis_iter) + 1] += tree->epsilon; /* maximum */ } } /* call before BLI_bvhtree_update_tree() */ bool BLI_bvhtree_update_node(BVHTree *tree, int index, const float co[3], const float co_moving[3], int numpoints) { BVHNode *node = NULL; axis_t axis_iter; /* check if index exists */ if (index > tree->totleaf) return false; node = tree->nodearray + index; create_kdop_hull(tree, node, co, numpoints, 0); if (co_moving) create_kdop_hull(tree, node, co_moving, numpoints, 1); /* inflate the bv with some epsilon */ for (axis_iter = tree->start_axis; axis_iter < tree->stop_axis; axis_iter++) { node->bv[(2 * axis_iter)] -= tree->epsilon; /* minimum */ node->bv[(2 * axis_iter) + 1] += tree->epsilon; /* maximum */ } return true; } /* call BLI_bvhtree_update_node() first for every node/point/triangle */ void BLI_bvhtree_update_tree(BVHTree *tree) { /* Update bottom=>top * TRICKY: the way we build the tree all the childs have an index greater than the parent * This allows us todo a bottom up update by starting on the bigger numbered branch */ BVHNode **root = tree->nodes + tree->totleaf; BVHNode **index = tree->nodes + tree->totleaf + tree->totbranch - 1; for (; index >= root; index--) node_join(tree, *index); } float BLI_bvhtree_getepsilon(const BVHTree *tree) { return tree->epsilon; } /* -------------------------------------------------------------------- */ /* BLI_bvhtree_overlap */ /** * overlap - is it possible for 2 bv's to collide ? */ static int tree_overlap(BVHNode *node1, BVHNode *node2, axis_t start_axis, axis_t stop_axis) { const float *bv1 = node1->bv; const float *bv2 = node2->bv; const float *bv1_end = bv1 + (stop_axis << 1); bv1 += start_axis << 1; bv2 += start_axis << 1; /* test all axis if min + max overlap */ for (; bv1 != bv1_end; bv1 += 2, bv2 += 2) { if ((*(bv1) > *(bv2 + 1)) || (*(bv2) > *(bv1 + 1))) return 0; } return 1; } static void traverse(BVHOverlapData *data, BVHNode *node1, BVHNode *node2) { int j; if (tree_overlap(node1, node2, data->start_axis, data->stop_axis)) { /* check if node1 is a leaf */ if (!node1->totnode) { /* check if node2 is a leaf */ if (!node2->totnode) { BVHTreeOverlap *overlap; if (UNLIKELY(node1 == node2)) { return; } /* both leafs, insert overlap! */ overlap = BLI_stack_push_r(data->overlap); overlap->indexA = node1->index; overlap->indexB = node2->index; } else { for (j = 0; j < data->tree2->tree_type; j++) { if (node2->children[j]) traverse(data, node1, node2->children[j]); } } } else { for (j = 0; j < data->tree2->tree_type; j++) { if (node1->children[j]) traverse(data, node1->children[j], node2); } } } return; } BVHTreeOverlap *BLI_bvhtree_overlap(BVHTree *tree1, BVHTree *tree2, unsigned int *r_overlap_tot) { int j; size_t total = 0; BVHTreeOverlap *overlap = NULL, *to = NULL; BVHOverlapData **data; /* check for compatibility of both trees (can't compare 14-DOP with 18-DOP) */ if (UNLIKELY((tree1->axis != tree2->axis) && (tree1->axis == 14 || tree2->axis == 14) && (tree1->axis == 18 || tree2->axis == 18))) { BLI_assert(0); return NULL; } /* fast check root nodes for collision before doing big splitting + traversal */ if (!tree_overlap(tree1->nodes[tree1->totleaf], tree2->nodes[tree2->totleaf], min_axis(tree1->start_axis, tree2->start_axis), min_axis(tree1->stop_axis, tree2->stop_axis))) { return NULL; } data = MEM_mallocN(sizeof(BVHOverlapData *) * tree1->tree_type, "BVHOverlapData_star"); for (j = 0; j < tree1->tree_type; j++) { data[j] = MEM_mallocN(sizeof(BVHOverlapData), "BVHOverlapData"); /* init BVHOverlapData */ data[j]->overlap = BLI_stack_new(sizeof(BVHTreeOverlap), __func__); data[j]->tree1 = tree1; data[j]->tree2 = tree2; data[j]->start_axis = min_axis(tree1->start_axis, tree2->start_axis); data[j]->stop_axis = min_axis(tree1->stop_axis, tree2->stop_axis); } #pragma omp parallel for private(j) schedule(static) if (tree1->totleaf > KDOPBVH_OMP_LIMIT) for (j = 0; j < MIN2(tree1->tree_type, tree1->nodes[tree1->totleaf]->totnode); j++) { traverse(data[j], tree1->nodes[tree1->totleaf]->children[j], tree2->nodes[tree2->totleaf]); } for (j = 0; j < tree1->tree_type; j++) total += BLI_stack_count(data[j]->overlap); to = overlap = MEM_mallocN(sizeof(BVHTreeOverlap) * total, "BVHTreeOverlap"); for (j = 0; j < tree1->tree_type; j++) { unsigned int count = (unsigned int)BLI_stack_count(data[j]->overlap); BLI_stack_pop_n(data[j]->overlap, to, count); BLI_stack_free(data[j]->overlap); to += count; } for (j = 0; j < tree1->tree_type; j++) { MEM_freeN(data[j]); } MEM_freeN(data); *r_overlap_tot = (unsigned int)total; return overlap; } /* Determines the nearest point of the given node BV. Returns the squared distance to that point. */ static float calc_nearest_point_squared(const float proj[3], BVHNode *node, float nearest[3]) { int i; const float *bv = node->bv; /* nearest on AABB hull */ for (i = 0; i != 3; i++, bv += 2) { if (bv[0] > proj[i]) nearest[i] = bv[0]; else if (bv[1] < proj[i]) nearest[i] = bv[1]; else nearest[i] = proj[i]; } #if 0 /* nearest on a general hull */ copy_v3_v3(nearest, data->co); for (i = data->tree->start_axis; i != data->tree->stop_axis; i++, bv += 2) { float proj = dot_v3v3(nearest, KDOP_AXES[i]); float dl = bv[0] - proj; float du = bv[1] - proj; if (dl > 0) { madd_v3_v3fl(nearest, KDOP_AXES[i], dl); } else if (du < 0) { madd_v3_v3fl(nearest, KDOP_AXES[i], du); } } #endif # 1184 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/intern/BLI_kdopbvh.c" return len_squared_v3v3(proj, nearest); } /* TODO: use a priority queue to reduce the number of nodes looked on */ static void dfs_find_nearest_dfs(BVHNearestData *data, BVHNode *node) { if (node->totnode == 0) { if (data->callback) data->callback(data->userdata, node->index, data->co, &data->nearest); else { data->nearest.index = node->index; data->nearest.dist_sq = calc_nearest_point_squared(data->proj, node, data->nearest.co); } } else { /* Better heuristic to pick the closest node to dive on */ int i; float nearest[3]; if (data->proj[node->main_axis] <= node->children[0]->bv[node->main_axis * 2 + 1]) { for (i = 0; i != node->totnode; i++) { if (calc_nearest_point_squared(data->proj, node->children[i], nearest) >= data->nearest.dist_sq) continue; dfs_find_nearest_dfs(data, node->children[i]); } } else { for (i = node->totnode - 1; i >= 0; i--) { if (calc_nearest_point_squared(data->proj, node->children[i], nearest) >= data->nearest.dist_sq) continue; dfs_find_nearest_dfs(data, node->children[i]); } } } } static void dfs_find_nearest_begin(BVHNearestData *data, BVHNode *node) { float nearest[3], dist_sq; dist_sq = calc_nearest_point_squared(data->proj, node, nearest); if (dist_sq >= data->nearest.dist_sq) { return; } dfs_find_nearest_dfs(data, node); } #if 0 typedef struct NodeDistance { BVHNode *node; float dist; } NodeDistance; #define DEFAULT_FIND_NEAREST_HEAP_SIZE 1024 #define NodeDistance_priority(a, b) ((a).dist < (b).dist) static void NodeDistance_push_heap(NodeDistance *heap, int heap_size) PUSH_HEAP_BODY(NodeDistance, NodeDistance_priority, heap, heap_size) static void NodeDistance_pop_heap(NodeDistance *heap, int heap_size) POP_HEAP_BODY(NodeDistance, NodeDistance_priority, heap, heap_size) /* NN function that uses an heap.. this functions leads to an optimal number of min-distance * but for normal tri-faces and BV 6-dop.. a simple dfs with local heuristics (as implemented * in source/blender/blenkernel/intern/shrinkwrap.c) works faster. * * It may make sense to use this function if the callback queries are very slow.. or if its impossible * to get a nice heuristic * * this function uses "malloc/free" instead of the MEM_* because it intends to be openmp safe */ static void bfs_find_nearest(BVHNearestData *data, BVHNode *node) { int i; NodeDistance default_heap[DEFAULT_FIND_NEAREST_HEAP_SIZE]; NodeDistance *heap = default_heap, current; int heap_size = 0, max_heap_size = sizeof(default_heap) / sizeof(default_heap[0]); float nearest[3]; int callbacks = 0, push_heaps = 0; if (node->totnode == 0) { dfs_find_nearest_dfs(data, node); return; } current.node = node; current.dist = calc_nearest_point(data->proj, node, nearest); while (current.dist < data->nearest.dist) { // printf("%f : %f\n", current.dist, data->nearest.dist); for (i = 0; i < current.node->totnode; i++) { BVHNode *child = current.node->children[i]; if (child->totnode == 0) { callbacks++; dfs_find_nearest_dfs(data, child); } else { /* adjust heap size */ if ((heap_size >= max_heap_size) && ADJUST_MEMORY(default_heap, (void **)&heap, heap_size + 1, &max_heap_size, sizeof(heap[0])) == false) { printf("WARNING: bvh_find_nearest got out of memory\n"); if (heap != default_heap) free(heap); return; } heap[heap_size].node = current.node->children[i]; heap[heap_size].dist = calc_nearest_point(data->proj, current.node->children[i], nearest); if (heap[heap_size].dist >= data->nearest.dist) continue; heap_size++; NodeDistance_push_heap(heap, heap_size); // PUSH_HEAP_BODY(NodeDistance, NodeDistance_priority, heap, heap_size); push_heaps++; } } if (heap_size == 0) break; current = heap[0]; NodeDistance_pop_heap(heap, heap_size); // POP_HEAP_BODY(NodeDistance, NodeDistance_priority, heap, heap_size); heap_size--; } // printf("hsize=%d, callbacks=%d, pushs=%d\n", heap_size, callbacks, push_heaps); if (heap != default_heap) free(heap); } #endif # 1324 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/intern/BLI_kdopbvh.c" int BLI_bvhtree_find_nearest(BVHTree *tree, const float co[3], BVHTreeNearest *nearest, BVHTree_NearestPointCallback callback, void *userdata) { axis_t axis_iter; BVHNearestData data; BVHNode *root = tree->nodes[tree->totleaf]; /* init data to search */ data.tree = tree; data.co = co; data.callback = callback; data.userdata = userdata; for (axis_iter = data.tree->start_axis; axis_iter != data.tree->stop_axis; axis_iter++) { data.proj[axis_iter] = dot_v3v3(data.co, KDOP_AXES[axis_iter]); } if (nearest) { memcpy(&data.nearest, nearest, sizeof(*nearest)); } else { data.nearest.index = -1; data.nearest.dist_sq = FLT_MAX; } /* dfs search */ if (root) dfs_find_nearest_begin(&data, root); /* copy back results */ if (nearest) { memcpy(nearest, &data.nearest, sizeof(*nearest)); } return data.nearest.index; } /** * Raycast - BLI_bvhtree_ray_cast * * raycast is done by performing a DFS on the BVHTree and saving the closest hit */ /* Determines the distance that the ray must travel to hit the bounding volume of the given node */ static float ray_nearest_hit(BVHRayCastData *data, const float bv[6]) { int i; float low = 0, upper = data->hit.dist; for (i = 0; i != 3; i++, bv += 2) { if (data->ray_dot_axis[i] == 0.0f) { /* axis aligned ray */ if (data->ray.origin[i] < bv[0] - data->ray.radius || data->ray.origin[i] > bv[1] + data->ray.radius) { return FLT_MAX; } } else { float ll = (bv[0] - data->ray.radius - data->ray.origin[i]) / data->ray_dot_axis[i]; float lu = (bv[1] + data->ray.radius - data->ray.origin[i]) / data->ray_dot_axis[i]; if (data->ray_dot_axis[i] > 0.0f) { if (ll > low) low = ll; if (lu < upper) upper = lu; } else { if (lu > low) low = lu; if (ll < upper) upper = ll; } if (low > upper) return FLT_MAX; } } return low; } /** * Determines the distance that the ray must travel to hit the bounding volume of the given node * Based on Tactical Optimization of Ray/Box Intersection, by Graham Fyffe * [http://tog.acm.org/resources/RTNews/html/rtnv21n1.html#art9] * * TODO this doesn't take data->ray.radius into consideration */ static float fast_ray_nearest_hit(const BVHRayCastData *data, const BVHNode *node) { const float *bv = node->bv; float t1x = (bv[data->index[0]] - data->ray.origin[0]) * data->idot_axis[0]; float t2x = (bv[data->index[1]] - data->ray.origin[0]) * data->idot_axis[0]; float t1y = (bv[data->index[2]] - data->ray.origin[1]) * data->idot_axis[1]; float t2y = (bv[data->index[3]] - data->ray.origin[1]) * data->idot_axis[1]; float t1z = (bv[data->index[4]] - data->ray.origin[2]) * data->idot_axis[2]; float t2z = (bv[data->index[5]] - data->ray.origin[2]) * data->idot_axis[2]; if ((t1x > t2y || t2x < t1y || t1x > t2z || t2x < t1z || t1y > t2z || t2y < t1z) || (t2x < 0.0f || t2y < 0.0f || t2z < 0.0f) || (t1x > data->hit.dist || t1y > data->hit.dist || t1z > data->hit.dist)) { return FLT_MAX; } else { return max_fff(t1x, t1y, t1z); } } static void dfs_raycast(BVHRayCastData *data, BVHNode *node) { int i; /* ray-bv is really fast.. and simple tests revealed its worth to test it * before calling the ray-primitive functions */ /* XXX: temporary solution for particles until fast_ray_nearest_hit supports ray.radius */ float dist = (data->ray.radius == 0.0f) ? fast_ray_nearest_hit(data, node) : ray_nearest_hit(data, node->bv); if (dist >= data->hit.dist) return; if (node->totnode == 0) { if (data->callback) { data->callback(data->userdata, node->index, &data->ray, &data->hit); } else { data->hit.index = node->index; data->hit.dist = dist; madd_v3_v3v3fl(data->hit.co, data->ray.origin, data->ray.direction, dist); } } else { /* pick loop direction to dive into the tree (based on ray direction and split axis) */ if (data->ray_dot_axis[node->main_axis] > 0.0f) { for (i = 0; i != node->totnode; i++) { dfs_raycast(data, node->children[i]); } } else { for (i = node->totnode - 1; i >= 0; i--) { dfs_raycast(data, node->children[i]); } } } } static void dfs_raycast_all(BVHRayCastData *data, BVHNode *node) { int i; /* ray-bv is really fast.. and simple tests revealed its worth to test it * before calling the ray-primitive functions */ /* XXX: temporary solution for particles until fast_ray_nearest_hit supports ray.radius */ float dist = (data->ray.radius == 0.0f) ? fast_ray_nearest_hit(data, node) : ray_nearest_hit(data, node->bv); if (node->totnode == 0) { if (data->callback) { data->hit.index = -1; data->hit.dist = FLT_MAX; data->callback(data->userdata, node->index, &data->ray, &data->hit); } else { data->hit.index = node->index; data->hit.dist = dist; madd_v3_v3v3fl(data->hit.co, data->ray.origin, data->ray.direction, dist); } } else { /* pick loop direction to dive into the tree (based on ray direction and split axis) */ if (data->ray_dot_axis[node->main_axis] > 0.0f) { for (i = 0; i != node->totnode; i++) { dfs_raycast_all(data, node->children[i]); } } else { for (i = node->totnode - 1; i >= 0; i--) { dfs_raycast_all(data, node->children[i]); } } } } #if 0 static void iterative_raycast(BVHRayCastData *data, BVHNode *node) { while (node) { float dist = fast_ray_nearest_hit(data, node); if (dist >= data->hit.dist) { node = node->skip[1]; continue; } if (node->totnode == 0) { if (data->callback) { data->callback(data->userdata, node->index, &data->ray, &data->hit); } else { data->hit.index = node->index; data->hit.dist = dist; madd_v3_v3v3fl(data->hit.co, data->ray.origin, data->ray.direction, dist); } node = node->skip[1]; } else { node = node->children[0]; } } } #endif # 1535 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/intern/BLI_kdopbvh.c" int BLI_bvhtree_ray_cast(BVHTree *tree, const float co[3], const float dir[3], float radius, BVHTreeRayHit *hit, BVHTree_RayCastCallback callback, void *userdata) { int i; BVHRayCastData data; BVHNode *root = tree->nodes[tree->totleaf]; data.tree = tree; data.callback = callback; data.userdata = userdata; copy_v3_v3(data.ray.origin, co); copy_v3_v3(data.ray.direction, dir); data.ray.radius = radius; normalize_v3(data.ray.direction); for (i = 0; i < 3; i++) { data.ray_dot_axis[i] = dot_v3v3(data.ray.direction, KDOP_AXES[i]); data.idot_axis[i] = 1.0f / data.ray_dot_axis[i]; if (fabsf(data.ray_dot_axis[i]) < FLT_EPSILON) { data.ray_dot_axis[i] = 0.0; } data.index[2 * i] = data.idot_axis[i] < 0.0f ? 1 : 0; data.index[2 * i + 1] = 1 - data.index[2 * i]; data.index[2 * i] += 2 * i; data.index[2 * i + 1] += 2 * i; } if (hit) memcpy(&data.hit, hit, sizeof(*hit)); else { data.hit.index = -1; data.hit.dist = FLT_MAX; } if (root) { dfs_raycast(&data, root); // iterative_raycast(&data, root); } if (hit) memcpy(hit, &data.hit, sizeof(*hit)); return data.hit.index; } float BLI_bvhtree_bb_raycast(const float bv[6], const float light_start[3], const float light_end[3], float pos[3]) { BVHRayCastData data; float dist; data.hit.dist = FLT_MAX; /* get light direction */ sub_v3_v3v3(data.ray.direction, light_end, light_start); data.ray.radius = 0.0; copy_v3_v3(data.ray.origin, light_start); normalize_v3(data.ray.direction); copy_v3_v3(data.ray_dot_axis, data.ray.direction); dist = ray_nearest_hit(&data, bv); madd_v3_v3v3fl(pos, light_start, data.ray.direction, dist); return dist; } int BLI_bvhtree_ray_cast_all(BVHTree *tree, const float co[3], const float dir[3], float radius, BVHTree_RayCastCallback callback, void *userdata) { int i; BVHRayCastData data; BVHNode *root = tree->nodes[tree->totleaf]; data.tree = tree; data.callback = callback; data.userdata = userdata; copy_v3_v3(data.ray.origin, co); copy_v3_v3(data.ray.direction, dir); data.ray.radius = radius; normalize_v3(data.ray.direction); for (i = 0; i < 3; i++) { data.ray_dot_axis[i] = dot_v3v3(data.ray.direction, KDOP_AXES[i]); data.idot_axis[i] = 1.0f / data.ray_dot_axis[i]; if (fabsf(data.ray_dot_axis[i]) < FLT_EPSILON) { data.ray_dot_axis[i] = 0.0; } data.index[2 * i] = data.idot_axis[i] < 0.0f ? 1 : 0; data.index[2 * i + 1] = 1 - data.index[2 * i]; data.index[2 * i] += 2 * i; data.index[2 * i + 1] += 2 * i; } data.hit.index = -1; data.hit.dist = FLT_MAX; if (root) { dfs_raycast_all(&data, root); } return data.hit.index; } /** * Range Query - as request by broken :P * * Allocs and fills an array with the indexs of node that are on the given spherical range (center, radius) * Returns the size of the array. */ typedef struct RangeQueryData { BVHTree *tree; const float *center; float radius_sq; /* squared radius */ int hits; BVHTree_RangeQuery callback; void *userdata; } RangeQueryData; static void dfs_range_query(RangeQueryData *data, BVHNode *node) { if (node->totnode == 0) { #if 0 /*UNUSED*/ /* Calculate the node min-coords (if the node was a point then this is the point coordinates) */ float co[3]; co[0] = node->bv[0]; co[1] = node->bv[2]; co[2] = node->bv[4]; #endif # 1684 "/usr/ports/graphics/blender/work/blender-2.75/source/blender/blenlib/intern/BLI_kdopbvh.c" } else { int i; for (i = 0; i != node->totnode; i++) { float nearest[3]; float dist_sq = calc_nearest_point_squared(data->center, node->children[i], nearest); if (dist_sq < data->radius_sq) { /* Its a leaf.. call the callback */ if (node->children[i]->totnode == 0) { data->hits++; data->callback(data->userdata, node->children[i]->index, dist_sq); } else dfs_range_query(data, node->children[i]); } } } } int BLI_bvhtree_range_query(BVHTree *tree, const float co[3], float radius, BVHTree_RangeQuery callback, void *userdata) { BVHNode *root = tree->nodes[tree->totleaf]; RangeQueryData data; data.tree = tree; data.center = co; data.radius_sq = radius * radius; data.hits = 0; data.callback = callback; data.userdata = userdata; if (root != NULL) { float nearest[3]; float dist_sq = calc_nearest_point_squared(data.center, root, nearest); if (dist_sq < data.radius_sq) { /* Its a leaf.. call the callback */ if (root->totnode == 0) { data.hits++; data.callback(data.userdata, root->index, dist_sq); } else dfs_range_query(&data, root); } } return data.hits; }