FreeBSD Bugzilla – Attachment 249713 Details for
Bug 278174
Clang-17 crashes without printing any asserts on the C++ module from the new version 4.5.0 of science/siconos
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
test_pinv-72007e.c
test_pinv-72007e.c (text/plain), 260.24 KB, created by
Yuri Victorovich
on 2024-04-04 19:07:45 UTC
(
hide
)
Description:
test_pinv-72007e.c
Filename:
MIME Type:
Creator:
Yuri Victorovich
Created:
2024-04-04 19:07:45 UTC
Size:
260.24 KB
patch
obsolete
># 1 "<built-in>" ># 1 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/test/test_pinv.c" >#if 0 /* expanded by -frewrite-includes */ >#include <stdio.h> // for printf, NULL, fclose, fopen, FILE >#endif /* expanded by -frewrite-includes */ ># 1 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/test/test_pinv.c" ># 1 "/usr/include/stdio.h" 1 3 4 >/*- > * SPDX-License-Identifier: BSD-3-Clause > * > * 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 > */ > >#ifndef _STDIO_H_ >#define _STDIO_H_ > >#if 0 /* expanded by -frewrite-includes */ >#include <sys/cdefs.h> >#endif /* expanded by -frewrite-includes */ ># 40 "/usr/include/stdio.h" 3 4 ># 1 "/usr/include/sys/cdefs.h" 1 3 4 >/*- > * SPDX-License-Identifier: BSD-3-Clause > * > * 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. > * 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. > * > * @(#)cdefs.h 8.8 (Berkeley) 1/9/95 > */ > >#ifndef _SYS_CDEFS_H_ >#define _SYS_CDEFS_H_ > >#if 0 /* disabled by -frewrite-includes */ >#if defined(_KERNEL) && defined(_STANDALONE) >#endif >#endif /* disabled by -frewrite-includes */ >#if 0 /* evaluated by -frewrite-includes */ ># 41 "/usr/include/sys/cdefs.h" 3 4 >#error "_KERNEL and _STANDALONE are mutually exclusive" >#endif ># 43 "/usr/include/sys/cdefs.h" 3 4 > >/* > * Testing against Clang-specific extensions. > */ >#ifndef __has_attribute >#define __has_attribute(x) 0 >#endif ># 50 "/usr/include/sys/cdefs.h" 3 4 >#ifndef __has_extension >#define __has_extension __has_feature >#endif ># 53 "/usr/include/sys/cdefs.h" 3 4 >#ifndef __has_feature >#define __has_feature(x) 0 >#endif ># 56 "/usr/include/sys/cdefs.h" 3 4 >#ifndef __has_include >#define __has_include(x) 0 >#endif ># 59 "/usr/include/sys/cdefs.h" 3 4 >#ifndef __has_builtin >#define __has_builtin(x) 0 >#endif ># 62 "/usr/include/sys/cdefs.h" 3 4 > >#if 0 /* disabled by -frewrite-includes */ >#if defined(__cplusplus) >#endif >#endif /* disabled by -frewrite-includes */ >#if 0 /* evaluated by -frewrite-includes */ ># 64 "/usr/include/sys/cdefs.h" 3 4 >#define __BEGIN_DECLS extern "C" { >#define __END_DECLS } >#else ># 67 "/usr/include/sys/cdefs.h" 3 4 >#define __BEGIN_DECLS >#define __END_DECLS >#endif ># 70 "/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 0 /* disabled by -frewrite-includes */ >#if defined(__GNUC__) >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 78 "/usr/include/sys/cdefs.h" 3 4 > >#if 0 /* disabled by -frewrite-includes */ >#if __GNUC__ >= 3 >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 80 "/usr/include/sys/cdefs.h" 3 4 >#define __GNUCLIKE_ASM 3 >#define __GNUCLIKE_MATH_BUILTIN_CONSTANTS >#else ># 83 "/usr/include/sys/cdefs.h" 3 4 >#define __GNUCLIKE_ASM 2 >#endif ># 85 "/usr/include/sys/cdefs.h" 3 4 >#define __GNUCLIKE___TYPEOF 1 >#define __GNUCLIKE___SECTION 1 > >#define __GNUCLIKE_CTOR_SECTION_HANDLING 1 > >#define __GNUCLIKE_BUILTIN_CONSTANT_P 1 > >#if 0 /* disabled by -frewrite-includes */ >#if (__GNUC_MINOR__ > 95 || __GNUC__ >= 3) >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 93 "/usr/include/sys/cdefs.h" 3 4 >#define __GNUCLIKE_BUILTIN_VARARGS 1 >#define __GNUCLIKE_BUILTIN_STDARG 1 >#define __GNUCLIKE_BUILTIN_VAALIST 1 >#endif ># 97 "/usr/include/sys/cdefs.h" 3 4 > >#define __GNUC_VA_LIST_COMPATIBILITY 1 > >/* > * Compiler memory barriers, specific to gcc and clang. > */ >#define __compiler_membar() __asm __volatile(" " : : : "memory") > >#define __GNUCLIKE_BUILTIN_NEXT_ARG 1 >#define __GNUCLIKE_MATH_BUILTIN_RELOPS > >#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__ */ ># 123 "/usr/include/sys/cdefs.h" 3 4 > >/* > * Macro to test if we're using a specific version of gcc or later. > */ >#if 0 /* disabled by -frewrite-includes */ >#if defined(__GNUC__) >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 128 "/usr/include/sys/cdefs.h" 3 4 >#define __GNUC_PREREQ__(ma, mi) \ > (__GNUC__ > (ma) || __GNUC__ == (ma) && __GNUC_MINOR__ >= (mi)) >#else ># 131 "/usr/include/sys/cdefs.h" 3 4 >#define __GNUC_PREREQ__(ma, mi) 0 >#endif ># 133 "/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 0 /* disabled by -frewrite-includes */ >#if defined(__STDC__) || defined(__cplusplus) >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 147 "/usr/include/sys/cdefs.h" 3 4 >#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 0 /* disabled by -frewrite-includes */ >#if defined(__cplusplus) >#endif >#endif /* disabled by -frewrite-includes */ >#if 0 /* evaluated by -frewrite-includes */ ># 157 "/usr/include/sys/cdefs.h" 3 4 >#define __inline inline /* convert to C++ keyword */ >#else ># 159 "/usr/include/sys/cdefs.h" 3 4 >#if 0 /* disabled by -frewrite-includes */ >#if !(defined(__CC_SUPPORTS___INLINE)) >#endif >#endif /* disabled by -frewrite-includes */ >#if 0 /* evaluated by -frewrite-includes */ ># 160 "/usr/include/sys/cdefs.h" 3 4 >#define __inline /* delete GCC keyword */ >#endif /* ! __CC_SUPPORTS___INLINE */ ># 162 "/usr/include/sys/cdefs.h" 3 4 >#endif /* !__cplusplus */ ># 163 "/usr/include/sys/cdefs.h" 3 4 > >#else /* !(__STDC__ || __cplusplus) */ ># 165 "/usr/include/sys/cdefs.h" 3 4 >#define __P(protos) () /* traditional C preprocessor */ >#define __CONCAT(x,y) x/**/y >#define __STRING(x) "x" > >#if 0 /* disabled by -frewrite-includes */ >#if !defined(__CC_SUPPORTS___INLINE) >#endif >#endif /* disabled by -frewrite-includes */ >#if 0 /* evaluated by -frewrite-includes */ ># 170 "/usr/include/sys/cdefs.h" 3 4 >#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 */ ># 188 "/usr/include/sys/cdefs.h" 3 4 >#endif /* !__CC_SUPPORTS___INLINE */ ># 189 "/usr/include/sys/cdefs.h" 3 4 >#endif /* !(__STDC__ || __cplusplus) */ ># 190 "/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. > */ >#define __weak_symbol __attribute__((__weak__)) >#if 0 /* disabled by -frewrite-includes */ >#if !__GNUC_PREREQ__(2, 5) >#endif >#endif /* disabled by -frewrite-includes */ >#if 0 /* evaluated by -frewrite-includes */ ># 202 "/usr/include/sys/cdefs.h" 3 4 >#define __dead2 >#define __pure2 >#define __unused >#endif ># 206 "/usr/include/sys/cdefs.h" 3 4 >#if 0 /* disabled by -frewrite-includes */ >#if __GNUC__ == 2 && __GNUC_MINOR__ >= 5 && __GNUC_MINOR__ < 7 >#endif >#endif /* disabled by -frewrite-includes */ >#if 0 /* evaluated by -frewrite-includes */ ># 207 "/usr/include/sys/cdefs.h" 3 4 >#define __dead2 __attribute__((__noreturn__)) >#define __pure2 __attribute__((__const__)) >#define __unused >/* XXX Find out what to do for __packed, __aligned and __section */ >#endif ># 212 "/usr/include/sys/cdefs.h" 3 4 >#if 0 /* disabled by -frewrite-includes */ >#if __GNUC_PREREQ__(2, 7) >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 213 "/usr/include/sys/cdefs.h" 3 4 >#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 ># 221 "/usr/include/sys/cdefs.h" 3 4 >#if 0 /* disabled by -frewrite-includes */ >#if __GNUC_PREREQ__(4, 3) || __has_attribute(__alloc_size__) >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 222 "/usr/include/sys/cdefs.h" 3 4 >#define __alloc_size(x) __attribute__((__alloc_size__(x))) >#define __alloc_size2(n, x) __attribute__((__alloc_size__(n, x))) >#else ># 225 "/usr/include/sys/cdefs.h" 3 4 >#define __alloc_size(x) >#define __alloc_size2(n, x) >#endif ># 228 "/usr/include/sys/cdefs.h" 3 4 >#if 0 /* disabled by -frewrite-includes */ >#if __GNUC_PREREQ__(4, 9) || __has_attribute(__alloc_align__) >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 229 "/usr/include/sys/cdefs.h" 3 4 >#define __alloc_align(x) __attribute__((__alloc_align__(x))) >#else ># 231 "/usr/include/sys/cdefs.h" 3 4 >#define __alloc_align(x) >#endif ># 233 "/usr/include/sys/cdefs.h" 3 4 > >#if 0 /* disabled by -frewrite-includes */ >#if !__GNUC_PREREQ__(2, 95) >#endif >#endif /* disabled by -frewrite-includes */ >#if 0 /* evaluated by -frewrite-includes */ ># 235 "/usr/include/sys/cdefs.h" 3 4 >#define __alignof(x) __offsetof(struct { char __a; x __b; }, __b) >#endif ># 237 "/usr/include/sys/cdefs.h" 3 4 > >/* > * Keywords added in C11. > */ > >#if 0 /* disabled by -frewrite-includes */ >#if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 201112L >#endif >#endif /* disabled by -frewrite-includes */ >#if 0 /* evaluated by -frewrite-includes */ ># 243 "/usr/include/sys/cdefs.h" 3 4 > >#if 0 /* disabled by -frewrite-includes */ >#if !__has_extension(c_alignas) >#endif >#endif /* disabled by -frewrite-includes */ >#if 0 /* evaluated by -frewrite-includes */ ># 245 "/usr/include/sys/cdefs.h" 3 4 >#if 0 /* disabled by -frewrite-includes */ >#if (defined(__cplusplus) && __cplusplus >= 201103L) || \ > __has_extension(cxx_alignas) >#endif >#endif /* disabled by -frewrite-includes */ >#if 0 /* evaluated by -frewrite-includes */ ># 247 "/usr/include/sys/cdefs.h" 3 4 >#define _Alignas(x) alignas(x) >#else ># 249 "/usr/include/sys/cdefs.h" 3 4 >/* XXX: Only emulates _Alignas(constant-expression); not _Alignas(type-name). */ >#define _Alignas(x) __aligned(x) >#endif ># 252 "/usr/include/sys/cdefs.h" 3 4 >#endif ># 253 "/usr/include/sys/cdefs.h" 3 4 > >#if 0 /* disabled by -frewrite-includes */ >#if defined(__cplusplus) && __cplusplus >= 201103L >#endif >#endif /* disabled by -frewrite-includes */ >#if 0 /* evaluated by -frewrite-includes */ ># 255 "/usr/include/sys/cdefs.h" 3 4 >#define _Alignof(x) alignof(x) >#else ># 257 "/usr/include/sys/cdefs.h" 3 4 >#define _Alignof(x) __alignof(x) >#endif ># 259 "/usr/include/sys/cdefs.h" 3 4 > >#if 0 /* disabled by -frewrite-includes */ >#if !defined(__cplusplus) && !__has_extension(c_atomic) && \ > !__has_extension(cxx_atomic) && !__GNUC_PREREQ__(4, 7) >#endif >#endif /* disabled by -frewrite-includes */ >#if 0 /* evaluated by -frewrite-includes */ ># 262 "/usr/include/sys/cdefs.h" 3 4 >/* > * 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 ># 268 "/usr/include/sys/cdefs.h" 3 4 > >#if 0 /* disabled by -frewrite-includes */ >#if defined(__cplusplus) && __cplusplus >= 201103L >#endif >#endif /* disabled by -frewrite-includes */ >#if 0 /* evaluated by -frewrite-includes */ ># 270 "/usr/include/sys/cdefs.h" 3 4 >#define _Noreturn [[noreturn]] >#else ># 272 "/usr/include/sys/cdefs.h" 3 4 >#define _Noreturn __dead2 >#endif ># 274 "/usr/include/sys/cdefs.h" 3 4 > >#if 0 /* disabled by -frewrite-includes */ >#if !__has_extension(c_static_assert) >#endif >#endif /* disabled by -frewrite-includes */ >#if 0 /* evaluated by -frewrite-includes */ ># 276 "/usr/include/sys/cdefs.h" 3 4 >#if 0 /* disabled by -frewrite-includes */ >#if (defined(__cplusplus) && __cplusplus >= 201103L) || \ > __has_extension(cxx_static_assert) >#endif >#endif /* disabled by -frewrite-includes */ >#if 0 /* evaluated by -frewrite-includes */ ># 278 "/usr/include/sys/cdefs.h" 3 4 >#define _Static_assert(x, y) static_assert(x, y) >#if 0 /* disabled by -frewrite-includes */ >#if 0 >#elif __GNUC_PREREQ__(4,6) && !defined(__cplusplus) >#endif >#endif /* disabled by -frewrite-includes */ >#elif 0 /* evaluated by -frewrite-includes */ ># 280 "/usr/include/sys/cdefs.h" 3 4 >/* Nothing, gcc 4.6 and higher has _Static_assert built-in */ >#if 0 /* disabled by -frewrite-includes */ >#if 0 >#elif defined(__COUNTER__) >#endif >#endif /* disabled by -frewrite-includes */ >#elif 0 /* evaluated by -frewrite-includes */ ># 282 "/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 ># 287 "/usr/include/sys/cdefs.h" 3 4 >#define _Static_assert(x, y) struct __hack >#endif ># 289 "/usr/include/sys/cdefs.h" 3 4 >#endif ># 290 "/usr/include/sys/cdefs.h" 3 4 > >#if 0 /* disabled by -frewrite-includes */ >#if !__has_extension(c_thread_local) >#endif >#endif /* disabled by -frewrite-includes */ >#if 0 /* evaluated by -frewrite-includes */ ># 292 "/usr/include/sys/cdefs.h" 3 4 >/* > * XXX: Some compilers (Clang 3.3, GCC 4.7) falsely announce C++11 mode > * without actually supporting the thread_local keyword. Don't check for > * the presence of C++11 when defining _Thread_local. > */ >#if 0 /* disabled by -frewrite-includes */ >#if /* (defined(__cplusplus) && __cplusplus >= 201103L) || */ \ > __has_extension(cxx_thread_local) >#endif >#endif /* disabled by -frewrite-includes */ >#if 0 /* evaluated by -frewrite-includes */ ># 299 "/usr/include/sys/cdefs.h" 3 4 >#define _Thread_local thread_local >#else ># 301 "/usr/include/sys/cdefs.h" 3 4 >#define _Thread_local __thread >#endif ># 303 "/usr/include/sys/cdefs.h" 3 4 >#endif ># 304 "/usr/include/sys/cdefs.h" 3 4 > >#endif /* __STDC_VERSION__ || __STDC_VERSION__ < 201112L */ ># 306 "/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. > * > * Note that the comma operator is used to force expr to decay in > * order to match _Generic(). > */ > >#if 0 /* disabled by -frewrite-includes */ >#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || \ > __has_extension(c_generic_selections) >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 321 "/usr/include/sys/cdefs.h" 3 4 >#define __generic(expr, t, yes, no) \ > _Generic(expr, t: yes, default: no) >#if 0 /* disabled by -frewrite-includes */ >#if 0 >#elif __GNUC_PREREQ__(3, 1) && !defined(__cplusplus) >#endif >#endif /* disabled by -frewrite-includes */ >#elif 0 /* evaluated by -frewrite-includes */ ># 324 "/usr/include/sys/cdefs.h" 3 4 >#define __generic(expr, t, yes, no) \ > __builtin_choose_expr( \ > __builtin_types_compatible_p(__typeof((0, (expr))), t), yes, no) >#endif ># 328 "/usr/include/sys/cdefs.h" 3 4 > >/* > * C99 Static array indices in function parameter declarations. Syntax such as: > * void bar(int myArray[static 10]); > * is allowed in C99 but not in C++. Define __min_size appropriately so > * headers using it can be compiled in either language. Use like this: > * void bar(int myArray[__min_size(10)]); > */ >#if 0 /* disabled by -frewrite-includes */ >#if !defined(__cplusplus) && \ > (defined(__clang__) || __GNUC_PREREQ__(4, 6)) && \ > (!defined(__STDC_VERSION__) || (__STDC_VERSION__ >= 199901)) >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 339 "/usr/include/sys/cdefs.h" 3 4 >#define __min_size(x) static (x) >#else ># 341 "/usr/include/sys/cdefs.h" 3 4 >#define __min_size(x) (x) >#endif ># 343 "/usr/include/sys/cdefs.h" 3 4 > >#if 0 /* disabled by -frewrite-includes */ >#if __GNUC_PREREQ__(2, 96) >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 345 "/usr/include/sys/cdefs.h" 3 4 >#define __malloc_like __attribute__((__malloc__)) >#define __pure __attribute__((__pure__)) >#else ># 348 "/usr/include/sys/cdefs.h" 3 4 >#define __malloc_like >#define __pure >#endif ># 351 "/usr/include/sys/cdefs.h" 3 4 > >#if 0 /* disabled by -frewrite-includes */ >#if __GNUC_PREREQ__(3, 1) >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 353 "/usr/include/sys/cdefs.h" 3 4 >#define __always_inline __attribute__((__always_inline__)) >#else ># 355 "/usr/include/sys/cdefs.h" 3 4 >#define __always_inline >#endif ># 357 "/usr/include/sys/cdefs.h" 3 4 > >#if 0 /* disabled by -frewrite-includes */ >#if __GNUC_PREREQ__(3, 1) >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 359 "/usr/include/sys/cdefs.h" 3 4 >#define __noinline __attribute__ ((__noinline__)) >#else ># 361 "/usr/include/sys/cdefs.h" 3 4 >#define __noinline >#endif ># 363 "/usr/include/sys/cdefs.h" 3 4 > >#if 0 /* disabled by -frewrite-includes */ >#if __GNUC_PREREQ__(3, 4) >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 365 "/usr/include/sys/cdefs.h" 3 4 >#define __fastcall __attribute__((__fastcall__)) >#define __result_use_check __attribute__((__warn_unused_result__)) >#else ># 368 "/usr/include/sys/cdefs.h" 3 4 >#define __fastcall >#define __result_use_check >#endif ># 371 "/usr/include/sys/cdefs.h" 3 4 > >#if 0 /* disabled by -frewrite-includes */ >#if __GNUC_PREREQ__(4, 1) >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 373 "/usr/include/sys/cdefs.h" 3 4 >#define __returns_twice __attribute__((__returns_twice__)) >#else ># 375 "/usr/include/sys/cdefs.h" 3 4 >#define __returns_twice >#endif ># 377 "/usr/include/sys/cdefs.h" 3 4 > >#if 0 /* disabled by -frewrite-includes */ >#if __GNUC_PREREQ__(4, 6) || __has_builtin(__builtin_unreachable) >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 379 "/usr/include/sys/cdefs.h" 3 4 >#define __unreachable() __builtin_unreachable() >#else ># 381 "/usr/include/sys/cdefs.h" 3 4 >#define __unreachable() ((void)0) >#endif ># 383 "/usr/include/sys/cdefs.h" 3 4 > >/* XXX: should use `#if __STDC_VERSION__ < 199901'. */ >#if 0 /* disabled by -frewrite-includes */ >#if !__GNUC_PREREQ__(2, 7) >#endif >#endif /* disabled by -frewrite-includes */ >#if 0 /* evaluated by -frewrite-includes */ ># 386 "/usr/include/sys/cdefs.h" 3 4 >#define __func__ NULL >#endif ># 388 "/usr/include/sys/cdefs.h" 3 4 > >#if 0 /* disabled by -frewrite-includes */ >#if (defined(__GNUC__) && __GNUC__ >= 2) && !defined(__STRICT_ANSI__) || __STDC_VERSION__ >= 199901 >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 390 "/usr/include/sys/cdefs.h" 3 4 >#define __LONG_LONG_SUPPORTED >#endif ># 392 "/usr/include/sys/cdefs.h" 3 4 > >/* C++11 exposes a load of C99 stuff */ >#if 0 /* disabled by -frewrite-includes */ >#if defined(__cplusplus) && __cplusplus >= 201103L >#endif >#endif /* disabled by -frewrite-includes */ >#if 0 /* evaluated by -frewrite-includes */ ># 395 "/usr/include/sys/cdefs.h" 3 4 >#define __LONG_LONG_SUPPORTED >#ifndef __STDC_LIMIT_MACROS >#define __STDC_LIMIT_MACROS >#endif ># 399 "/usr/include/sys/cdefs.h" 3 4 >#ifndef __STDC_CONSTANT_MACROS >#define __STDC_CONSTANT_MACROS >#endif ># 402 "/usr/include/sys/cdefs.h" 3 4 >#endif ># 403 "/usr/include/sys/cdefs.h" 3 4 > >/* > * We use `__restrict' as a way to define the `restrict' type qualifier > * without disturbing older software that is unaware of C99 keywords. > * GCC also provides `__restrict' as an extension to support C99-style > * restricted pointers in other language modes. > */ >#if 0 /* disabled by -frewrite-includes */ >#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901 >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 411 "/usr/include/sys/cdefs.h" 3 4 >#define __restrict restrict >#if 0 /* disabled by -frewrite-includes */ >#if 0 >#elif !__GNUC_PREREQ__(2, 95) >#endif >#endif /* disabled by -frewrite-includes */ >#elif 0 /* evaluated by -frewrite-includes */ ># 413 "/usr/include/sys/cdefs.h" 3 4 >#define __restrict >#endif ># 415 "/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 0 /* disabled by -frewrite-includes */ >#if __GNUC_PREREQ__(2, 96) >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 445 "/usr/include/sys/cdefs.h" 3 4 >#define __predict_true(exp) __builtin_expect((exp), 1) >#define __predict_false(exp) __builtin_expect((exp), 0) >#else ># 448 "/usr/include/sys/cdefs.h" 3 4 >#define __predict_true(exp) (exp) >#define __predict_false(exp) (exp) >#endif ># 451 "/usr/include/sys/cdefs.h" 3 4 > >#if 0 /* disabled by -frewrite-includes */ >#if __GNUC_PREREQ__(4, 0) >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 453 "/usr/include/sys/cdefs.h" 3 4 >#define __null_sentinel __attribute__((__sentinel__)) >#define __exported __attribute__((__visibility__("default"))) >#define __hidden __attribute__((__visibility__("hidden"))) >#else ># 457 "/usr/include/sys/cdefs.h" 3 4 >#define __null_sentinel >#define __exported >#define __hidden >#endif ># 461 "/usr/include/sys/cdefs.h" 3 4 > >/* > * We define this here since <stddef.h>, <sys/queue.h>, and <sys/types.h> > * require it. > */ >#if 0 /* disabled by -frewrite-includes */ >#if __GNUC_PREREQ__(4, 1) >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 467 "/usr/include/sys/cdefs.h" 3 4 >#define __offsetof(type, field) __builtin_offsetof(type, field) >#else ># 469 "/usr/include/sys/cdefs.h" 3 4 >#ifndef __cplusplus >#define __offsetof(type, field) \ > ((__size_t)(__uintptr_t)((const volatile void *)&((type *)0)->field)) >#else ># 473 "/usr/include/sys/cdefs.h" 3 4 >#define __offsetof(type, field) \ > (__offsetof__ (reinterpret_cast <__size_t> \ > (&reinterpret_cast <const volatile char &> \ > (static_cast<type *> (0)->field)))) >#endif ># 478 "/usr/include/sys/cdefs.h" 3 4 >#endif ># 479 "/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 0 /* disabled by -frewrite-includes */ >#if __GNUC_PREREQ__(3, 1) >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 489 "/usr/include/sys/cdefs.h" 3 4 >#define __containerof(x, s, m) ({ \ > const volatile __typeof(((s *)0)->m) *__x = (x); \ > __DEQUALIFY(s *, (const volatile char *)__x - __offsetof(s, m));\ >}) >#else ># 494 "/usr/include/sys/cdefs.h" 3 4 >#define __containerof(x, s, m) \ > __DEQUALIFY(s *, (const volatile char *)(x) - __offsetof(s, m)) >#endif ># 497 "/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 0 /* disabled by -frewrite-includes */ >#if !__GNUC_PREREQ__(2, 7) >#endif >#endif /* disabled by -frewrite-includes */ >#if 0 /* evaluated by -frewrite-includes */ ># 505 "/usr/include/sys/cdefs.h" 3 4 >#define __printflike(fmtarg, firstvararg) >#define __scanflike(fmtarg, firstvararg) >#define __format_arg(fmtarg) >#define __strfmonlike(fmtarg, firstvararg) >#define __strftimelike(fmtarg, firstvararg) >#else ># 511 "/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 ># 521 "/usr/include/sys/cdefs.h" 3 4 > >/* Compiler-dependent macros that rely on FreeBSD-specific extensions. */ >#if 0 /* disabled by -frewrite-includes */ >#if defined(__FreeBSD_cc_version) && __FreeBSD_cc_version >= 300001 && \ > defined(__GNUC__) >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 525 "/usr/include/sys/cdefs.h" 3 4 >#define __printf0like(fmtarg, firstvararg) \ > __attribute__((__format__ (__printf0__, fmtarg, firstvararg))) >#else ># 528 "/usr/include/sys/cdefs.h" 3 4 >#define __printf0like(fmtarg, firstvararg) >#endif ># 530 "/usr/include/sys/cdefs.h" 3 4 > >#if 0 /* disabled by -frewrite-includes */ >#if defined(__GNUC__) >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 532 "/usr/include/sys/cdefs.h" 3 4 >#define __strong_reference(sym,aliassym) \ > extern __typeof (sym) aliassym __attribute__ ((__alias__ (#sym))) >#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 ># 547 "/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__ */ ># 559 "/usr/include/sys/cdefs.h" 3 4 >#endif /* __GNUC__ */ ># 560 "/usr/include/sys/cdefs.h" 3 4 > >#define __GLOBL(sym) __asm__(".globl " __XSTRING(sym)) >#define __WEAK(sym) __asm__(".weak " __XSTRING(sym)) > >#if 0 /* disabled by -frewrite-includes */ >#if defined(__GNUC__) >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 565 "/usr/include/sys/cdefs.h" 3 4 >#define __IDSTRING(name,string) __asm__(".ident\t\"" string "\"") >#else ># 567 "/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 ># 575 "/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: > */ >#ifndef __FBSDID >#if 0 /* disabled by -frewrite-includes */ >#if !defined(STRIP_FBSDID) >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 583 "/usr/include/sys/cdefs.h" 3 4 >#define __FBSDID(s) __IDSTRING(__CONCAT(__rcsid_,__LINE__),s) >#else ># 585 "/usr/include/sys/cdefs.h" 3 4 >#define __FBSDID(s) struct __hack >#endif ># 587 "/usr/include/sys/cdefs.h" 3 4 >#endif ># 588 "/usr/include/sys/cdefs.h" 3 4 > >#ifndef __RCSID >#ifndef NO__RCSID >#define __RCSID(s) __IDSTRING(__CONCAT(__rcsid_,__LINE__),s) >#else ># 593 "/usr/include/sys/cdefs.h" 3 4 >#define __RCSID(s) struct __hack >#endif ># 595 "/usr/include/sys/cdefs.h" 3 4 >#endif ># 596 "/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 ># 601 "/usr/include/sys/cdefs.h" 3 4 >#define __RCSID_SOURCE(s) struct __hack >#endif ># 603 "/usr/include/sys/cdefs.h" 3 4 >#endif ># 604 "/usr/include/sys/cdefs.h" 3 4 > >#ifndef __SCCSID >#ifndef NO__SCCSID >#define __SCCSID(s) __IDSTRING(__CONCAT(__sccsid_,__LINE__),s) >#else ># 609 "/usr/include/sys/cdefs.h" 3 4 >#define __SCCSID(s) struct __hack >#endif ># 611 "/usr/include/sys/cdefs.h" 3 4 >#endif ># 612 "/usr/include/sys/cdefs.h" 3 4 > >#ifndef __COPYRIGHT >#ifndef NO__COPYRIGHT >#define __COPYRIGHT(s) __IDSTRING(__CONCAT(__copyright_,__LINE__),s) >#else ># 617 "/usr/include/sys/cdefs.h" 3 4 >#define __COPYRIGHT(s) struct __hack >#endif ># 619 "/usr/include/sys/cdefs.h" 3 4 >#endif ># 620 "/usr/include/sys/cdefs.h" 3 4 > >#ifndef __DECONST >#define __DECONST(type, var) ((type)(__uintptr_t)(const void *)(var)) >#endif ># 624 "/usr/include/sys/cdefs.h" 3 4 > >#ifndef __DEVOLATILE >#define __DEVOLATILE(type, var) ((type)(__uintptr_t)(volatile void *)(var)) >#endif ># 628 "/usr/include/sys/cdefs.h" 3 4 > >#ifndef __DEQUALIFY >#define __DEQUALIFY(type, var) ((type)(__uintptr_t)(const volatile void *)(var)) >#endif ># 632 "/usr/include/sys/cdefs.h" 3 4 > >/*- > * The following definitions are an extension of the behavior originally > * implemented in <sys/_posix.h>, 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 (and some informal names) > * defined(_POSIX_SOURCE) 1003.1-1988 > * encoded as 198808 below > * _POSIX_C_SOURCE == 1 1003.1-1990 > * encoded as 199009 below > * _POSIX_C_SOURCE == 2 1003.2-1992 C Language Binding Option > * encoded as 199209 below > * _POSIX_C_SOURCE == 199309 1003.1b-1993 > * (1003.1 Issue 4, Single Unix Spec v1, Unix 93) > * _POSIX_C_SOURCE == 199506 1003.1c-1995, 1003.1i-1995, > * and the omnibus ISO/IEC 9945-1: 1996 > * (1003.1 Issue 5, Single Unix Spec v2, Unix 95) > * _POSIX_C_SOURCE == 200112 1003.1-2001 (1003.1 Issue 6, Unix 03) > * _POSIX_C_SOURCE == 200809 1003.1-2008 (1003.1 Issue 7) > * IEEE Std 1003.1-2017 (Rev of 1003.1-2008) is > * 1003.1-2008 with two TCs applied with > * _POSIX_C_SOURCE=200809 and _XOPEN_SOURCE=700 > * > * 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 0 /* disabled by -frewrite-includes */ >#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE == 1 >#endif >#endif /* disabled by -frewrite-includes */ >#if 0 /* evaluated by -frewrite-includes */ ># 666 "/usr/include/sys/cdefs.h" 3 4 >#undef _POSIX_C_SOURCE /* Probably illegal, but beyond caring now. */ >#define _POSIX_C_SOURCE 199009 >#endif ># 669 "/usr/include/sys/cdefs.h" 3 4 > >/* Deal with IEEE Std. 1003.2-1992, in which _POSIX_C_SOURCE == 2. */ >#if 0 /* disabled by -frewrite-includes */ >#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE == 2 >#endif >#endif /* disabled by -frewrite-includes */ >#if 0 /* evaluated by -frewrite-includes */ ># 672 "/usr/include/sys/cdefs.h" 3 4 >#undef _POSIX_C_SOURCE >#define _POSIX_C_SOURCE 199209 >#endif ># 675 "/usr/include/sys/cdefs.h" 3 4 > >/* Deal with various X/Open Portability Guides and Single UNIX Spec. */ >#ifdef _XOPEN_SOURCE >#if 0 /* disabled by -frewrite-includes */ >#if _XOPEN_SOURCE - 0 >= 700 >#endif >#endif /* disabled by -frewrite-includes */ >#if 0 /* evaluated by -frewrite-includes */ ># 679 "/usr/include/sys/cdefs.h" 3 4 >#define __XSI_VISIBLE 700 >#undef _POSIX_C_SOURCE >#define _POSIX_C_SOURCE 200809 >#if 0 /* disabled by -frewrite-includes */ >#if 0 >#elif _XOPEN_SOURCE - 0 >= 600 >#endif >#endif /* disabled by -frewrite-includes */ >#elif 0 /* evaluated by -frewrite-includes */ ># 683 "/usr/include/sys/cdefs.h" 3 4 >#define __XSI_VISIBLE 600 >#undef _POSIX_C_SOURCE >#define _POSIX_C_SOURCE 200112 >#if 0 /* disabled by -frewrite-includes */ >#if 0 >#elif _XOPEN_SOURCE - 0 >= 500 >#endif >#endif /* disabled by -frewrite-includes */ >#elif 0 /* evaluated by -frewrite-includes */ ># 687 "/usr/include/sys/cdefs.h" 3 4 >#define __XSI_VISIBLE 500 >#undef _POSIX_C_SOURCE >#define _POSIX_C_SOURCE 199506 >#endif ># 691 "/usr/include/sys/cdefs.h" 3 4 >#endif ># 692 "/usr/include/sys/cdefs.h" 3 4 > >/* > * Deal with all versions of POSIX. The ordering relative to the tests above is > * important. > */ >#if 0 /* disabled by -frewrite-includes */ >#if defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE) >#endif >#endif /* disabled by -frewrite-includes */ >#if 0 /* evaluated by -frewrite-includes */ ># 698 "/usr/include/sys/cdefs.h" 3 4 >#define _POSIX_C_SOURCE 198808 >#endif ># 700 "/usr/include/sys/cdefs.h" 3 4 >#ifdef _POSIX_C_SOURCE >#if 0 /* disabled by -frewrite-includes */ >#if _POSIX_C_SOURCE >= 200809 >#endif >#endif /* disabled by -frewrite-includes */ >#if 0 /* evaluated by -frewrite-includes */ ># 702 "/usr/include/sys/cdefs.h" 3 4 >#define __POSIX_VISIBLE 200809 >#define __ISO_C_VISIBLE 1999 >#if 0 /* disabled by -frewrite-includes */ >#if 0 >#elif _POSIX_C_SOURCE >= 200112 >#endif >#endif /* disabled by -frewrite-includes */ >#elif 0 /* evaluated by -frewrite-includes */ ># 705 "/usr/include/sys/cdefs.h" 3 4 >#define __POSIX_VISIBLE 200112 >#define __ISO_C_VISIBLE 1999 >#if 0 /* disabled by -frewrite-includes */ >#if 0 >#elif _POSIX_C_SOURCE >= 199506 >#endif >#endif /* disabled by -frewrite-includes */ >#elif 0 /* evaluated by -frewrite-includes */ ># 708 "/usr/include/sys/cdefs.h" 3 4 >#define __POSIX_VISIBLE 199506 >#define __ISO_C_VISIBLE 1990 >#if 0 /* disabled by -frewrite-includes */ >#if 0 >#elif _POSIX_C_SOURCE >= 199309 >#endif >#endif /* disabled by -frewrite-includes */ >#elif 0 /* evaluated by -frewrite-includes */ ># 711 "/usr/include/sys/cdefs.h" 3 4 >#define __POSIX_VISIBLE 199309 >#define __ISO_C_VISIBLE 1990 >#if 0 /* disabled by -frewrite-includes */ >#if 0 >#elif _POSIX_C_SOURCE >= 199209 >#endif >#endif /* disabled by -frewrite-includes */ >#elif 0 /* evaluated by -frewrite-includes */ ># 714 "/usr/include/sys/cdefs.h" 3 4 >#define __POSIX_VISIBLE 199209 >#define __ISO_C_VISIBLE 1990 >#if 0 /* disabled by -frewrite-includes */ >#if 0 >#elif _POSIX_C_SOURCE >= 199009 >#endif >#endif /* disabled by -frewrite-includes */ >#elif 0 /* evaluated by -frewrite-includes */ ># 717 "/usr/include/sys/cdefs.h" 3 4 >#define __POSIX_VISIBLE 199009 >#define __ISO_C_VISIBLE 1990 >#else ># 720 "/usr/include/sys/cdefs.h" 3 4 >#define __POSIX_VISIBLE 198808 >#define __ISO_C_VISIBLE 0 >#endif /* _POSIX_C_SOURCE */ ># 723 "/usr/include/sys/cdefs.h" 3 4 >/* > * Both glibc and OpenBSD enable c11 features when _ISOC11_SOURCE is defined, or > * when compiling with -stdc=c11. A strict reading of the standard would suggest > * doing it only for the former. However, a strict reading also requires C99 > * mode only, so building with C11 is already undefined. Follow glibc's and > * OpenBSD's lead for this non-standard configuration for maximum compatibility. > */ >#if 0 /* disabled by -frewrite-includes */ >#if _ISOC11_SOURCE || (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) >#endif >#endif /* disabled by -frewrite-includes */ >#if 0 /* evaluated by -frewrite-includes */ ># 731 "/usr/include/sys/cdefs.h" 3 4 >#undef __ISO_C_VISIBLE >#define __ISO_C_VISIBLE 2011 >#endif ># 734 "/usr/include/sys/cdefs.h" 3 4 >#else ># 735 "/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 0 /* disabled by -frewrite-includes */ >#if defined(_ANSI_SOURCE) /* Hide almost everything. */ >#endif >#endif /* disabled by -frewrite-includes */ >#if 0 /* evaluated by -frewrite-includes */ ># 748 "/usr/include/sys/cdefs.h" 3 4 >#define __POSIX_VISIBLE 0 >#define __XSI_VISIBLE 0 >#define __BSD_VISIBLE 0 >#define __ISO_C_VISIBLE 1990 >#define __EXT1_VISIBLE 0 >#if 0 /* disabled by -frewrite-includes */ >#if 0 >#elif defined(_C99_SOURCE) /* Localism to specify strict C99 env. */ >#endif >#endif /* disabled by -frewrite-includes */ >#elif 0 /* evaluated by -frewrite-includes */ ># 754 "/usr/include/sys/cdefs.h" 3 4 >#define __POSIX_VISIBLE 0 >#define __XSI_VISIBLE 0 >#define __BSD_VISIBLE 0 >#define __ISO_C_VISIBLE 1999 >#define __EXT1_VISIBLE 0 >#if 0 /* disabled by -frewrite-includes */ >#if 0 >#elif defined(_C11_SOURCE) /* Localism to specify strict C11 env. */ >#endif >#endif /* disabled by -frewrite-includes */ >#elif 0 /* evaluated by -frewrite-includes */ ># 760 "/usr/include/sys/cdefs.h" 3 4 >#define __POSIX_VISIBLE 0 >#define __XSI_VISIBLE 0 >#define __BSD_VISIBLE 0 >#define __ISO_C_VISIBLE 2011 >#define __EXT1_VISIBLE 0 >#else /* Default environment: show everything. */ ># 766 "/usr/include/sys/cdefs.h" 3 4 >#define __POSIX_VISIBLE 200809 >#define __XSI_VISIBLE 700 >#define __BSD_VISIBLE 1 >#define __ISO_C_VISIBLE 2011 >#define __EXT1_VISIBLE 1 >#endif ># 772 "/usr/include/sys/cdefs.h" 3 4 >#endif ># 773 "/usr/include/sys/cdefs.h" 3 4 > >/* User override __EXT1_VISIBLE */ >#if 0 /* disabled by -frewrite-includes */ >#if defined(__STDC_WANT_LIB_EXT1__) >#endif >#endif /* disabled by -frewrite-includes */ >#if 0 /* evaluated by -frewrite-includes */ ># 776 "/usr/include/sys/cdefs.h" 3 4 >#undef __EXT1_VISIBLE >#if 0 /* disabled by -frewrite-includes */ >#if __STDC_WANT_LIB_EXT1__ >#endif >#endif /* disabled by -frewrite-includes */ >#if 0 /* evaluated by -frewrite-includes */ ># 778 "/usr/include/sys/cdefs.h" 3 4 >#define __EXT1_VISIBLE 1 >#else ># 780 "/usr/include/sys/cdefs.h" 3 4 >#define __EXT1_VISIBLE 0 >#endif ># 782 "/usr/include/sys/cdefs.h" 3 4 >#endif /* __STDC_WANT_LIB_EXT1__ */ ># 783 "/usr/include/sys/cdefs.h" 3 4 > >/* > * Old versions of GCC use non-standard ARM arch symbols; acle-compat.h > * translates them to __ARM_ARCH and the modern feature symbols defined by ARM. > */ >#if 0 /* disabled by -frewrite-includes */ >#if defined(__arm__) && !defined(__ARM_ARCH) >#endif >#endif /* disabled by -frewrite-includes */ >#if 0 /* evaluated by -frewrite-includes */ ># 789 "/usr/include/sys/cdefs.h" 3 4 >#if 0 /* expanded by -frewrite-includes */ >#include <machine/acle-compat.h> >#endif /* expanded by -frewrite-includes */ ># 789 "/usr/include/sys/cdefs.h" 3 4 ># 790 "/usr/include/sys/cdefs.h" 3 4 >#endif ># 791 "/usr/include/sys/cdefs.h" 3 4 > >/* > * Nullability qualifiers: currently only supported by Clang. > */ >#if 0 /* disabled by -frewrite-includes */ >#if !(defined(__clang__) && __has_feature(nullability)) >#endif >#endif /* disabled by -frewrite-includes */ >#if 0 /* evaluated by -frewrite-includes */ ># 796 "/usr/include/sys/cdefs.h" 3 4 >#define _Nonnull >#define _Nullable >#define _Null_unspecified >#define __NULLABILITY_PRAGMA_PUSH >#define __NULLABILITY_PRAGMA_POP >#else ># 802 "/usr/include/sys/cdefs.h" 3 4 >#define __NULLABILITY_PRAGMA_PUSH _Pragma("clang diagnostic push") \ > _Pragma("clang diagnostic ignored \"-Wnullability-completeness\"") >#define __NULLABILITY_PRAGMA_POP _Pragma("clang diagnostic pop") >#endif ># 806 "/usr/include/sys/cdefs.h" 3 4 > >/* > * Type Safety Checking > * > * Clang provides additional attributes to enable checking type safety > * properties that cannot be enforced by the C type system. > */ > >#if 0 /* disabled by -frewrite-includes */ >#if __has_attribute(__argument_with_type_tag__) && \ > __has_attribute(__type_tag_for_datatype__) >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 816 "/usr/include/sys/cdefs.h" 3 4 >#define __arg_type_tag(arg_kind, arg_idx, type_tag_idx) \ > __attribute__((__argument_with_type_tag__(arg_kind, arg_idx, type_tag_idx))) >#define __datatype_type_tag(kind, type) \ > __attribute__((__type_tag_for_datatype__(kind, type))) >#else ># 821 "/usr/include/sys/cdefs.h" 3 4 >#define __arg_type_tag(arg_kind, arg_idx, type_tag_idx) >#define __datatype_type_tag(kind, type) >#endif ># 824 "/usr/include/sys/cdefs.h" 3 4 > >/* > * Lock annotations. > * > * Clang provides support for doing basic thread-safety tests at > * compile-time, by marking which locks will/should be held when > * entering/leaving a functions. > * > * Furthermore, it is also possible to annotate variables and structure > * members to enforce that they are only accessed when certain locks are > * held. > */ > >#if 0 /* disabled by -frewrite-includes */ >#if __has_extension(c_thread_safety_attributes) >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 838 "/usr/include/sys/cdefs.h" 3 4 >#define __lock_annotate(x) __attribute__((x)) >#else ># 840 "/usr/include/sys/cdefs.h" 3 4 >#define __lock_annotate(x) >#endif ># 842 "/usr/include/sys/cdefs.h" 3 4 > >/* Structure implements a lock. */ >#define __lockable __lock_annotate(lockable) > >/* Function acquires an exclusive or shared lock. */ >#define __locks_exclusive(...) \ > __lock_annotate(exclusive_lock_function(__VA_ARGS__)) >#define __locks_shared(...) \ > __lock_annotate(shared_lock_function(__VA_ARGS__)) > >/* Function attempts to acquire an exclusive or shared lock. */ >#define __trylocks_exclusive(...) \ > __lock_annotate(exclusive_trylock_function(__VA_ARGS__)) >#define __trylocks_shared(...) \ > __lock_annotate(shared_trylock_function(__VA_ARGS__)) > >/* Function releases a lock. */ >#define __unlocks(...) __lock_annotate(unlock_function(__VA_ARGS__)) > >/* Function asserts that an exclusive or shared lock is held. */ >#define __asserts_exclusive(...) \ > __lock_annotate(assert_exclusive_lock(__VA_ARGS__)) >#define __asserts_shared(...) \ > __lock_annotate(assert_shared_lock(__VA_ARGS__)) > >/* Function requires that an exclusive or shared lock is or is not held. */ >#define __requires_exclusive(...) \ > __lock_annotate(exclusive_locks_required(__VA_ARGS__)) >#define __requires_shared(...) \ > __lock_annotate(shared_locks_required(__VA_ARGS__)) >#define __requires_unlocked(...) \ > __lock_annotate(locks_excluded(__VA_ARGS__)) > >/* Function should not be analyzed. */ >#define __no_lock_analysis __lock_annotate(no_thread_safety_analysis) > >/* > * Function or variable should not be sanitized, e.g., by AddressSanitizer. > * GCC has the nosanitize attribute, but as a function attribute only, and > * warns on use as a variable attribute. > */ >#if 0 /* disabled by -frewrite-includes */ >#if __has_attribute(no_sanitize) && defined(__clang__) >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 884 "/usr/include/sys/cdefs.h" 3 4 >#ifdef _KERNEL >#define __nosanitizeaddress __attribute__((no_sanitize("kernel-address"))) >#define __nosanitizememory __attribute__((no_sanitize("kernel-memory"))) >#else ># 888 "/usr/include/sys/cdefs.h" 3 4 >#define __nosanitizeaddress __attribute__((no_sanitize("address"))) >#define __nosanitizememory __attribute__((no_sanitize("memory"))) >#endif ># 891 "/usr/include/sys/cdefs.h" 3 4 >#define __nosanitizethread __attribute__((no_sanitize("thread"))) >#else ># 893 "/usr/include/sys/cdefs.h" 3 4 >#define __nosanitizeaddress >#define __nosanitizememory >#define __nosanitizethread >#endif ># 897 "/usr/include/sys/cdefs.h" 3 4 > >/* > * Make it possible to opt out of stack smashing protection. > */ >#if 0 /* disabled by -frewrite-includes */ >#if __has_attribute(no_stack_protector) >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 902 "/usr/include/sys/cdefs.h" 3 4 >#define __nostackprotector __attribute__((no_stack_protector)) >#else ># 904 "/usr/include/sys/cdefs.h" 3 4 >#define __nostackprotector \ > __attribute__((__optimize__("-fno-stack-protector"))) >#endif ># 907 "/usr/include/sys/cdefs.h" 3 4 > >/* Guard variables and structure members by lock. */ >#define __guarded_by(x) __lock_annotate(guarded_by(x)) >#define __pt_guarded_by(x) __lock_annotate(pt_guarded_by(x)) > >/* Alignment builtins for better type checking and improved code generation. */ >/* Provide fallback versions for other compilers (GCC/Clang < 10): */ >#if 0 /* disabled by -frewrite-includes */ >#if !__has_builtin(__builtin_is_aligned) >#endif >#endif /* disabled by -frewrite-includes */ >#if 0 /* evaluated by -frewrite-includes */ ># 915 "/usr/include/sys/cdefs.h" 3 4 >#define __builtin_is_aligned(x, align) \ > (((__uintptr_t)x & ((align) - 1)) == 0) >#endif ># 918 "/usr/include/sys/cdefs.h" 3 4 >#if 0 /* disabled by -frewrite-includes */ >#if !__has_builtin(__builtin_align_up) >#endif >#endif /* disabled by -frewrite-includes */ >#if 0 /* evaluated by -frewrite-includes */ ># 919 "/usr/include/sys/cdefs.h" 3 4 >#define __builtin_align_up(x, align) \ > ((__typeof__(x))(((__uintptr_t)(x)+((align)-1))&(~((align)-1)))) >#endif ># 922 "/usr/include/sys/cdefs.h" 3 4 >#if 0 /* disabled by -frewrite-includes */ >#if !__has_builtin(__builtin_align_down) >#endif >#endif /* disabled by -frewrite-includes */ >#if 0 /* evaluated by -frewrite-includes */ ># 923 "/usr/include/sys/cdefs.h" 3 4 >#define __builtin_align_down(x, align) \ > ((__typeof__(x))((x)&(~((align)-1)))) >#endif ># 926 "/usr/include/sys/cdefs.h" 3 4 > >#define __align_up(x, y) __builtin_align_up(x, y) >#define __align_down(x, y) __builtin_align_down(x, y) >#define __is_aligned(x, y) __builtin_is_aligned(x, y) > >#endif /* !_SYS_CDEFS_H_ */ ># 932 "/usr/include/sys/cdefs.h" 3 4 ># 41 "/usr/include/stdio.h" 2 3 4 >#if 0 /* expanded by -frewrite-includes */ >#include <sys/_null.h> >#endif /* expanded by -frewrite-includes */ ># 41 "/usr/include/stdio.h" 3 4 ># 1 "/usr/include/sys/_null.h" 1 3 4 >/*- > * SPDX-License-Identifier: BSD-2-Clause > * > * 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. > */ > >#ifndef NULL > >#if 0 /* disabled by -frewrite-includes */ >#if !defined(__cplusplus) >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 32 "/usr/include/sys/_null.h" 3 4 >#define NULL ((void *)0) >#else ># 34 "/usr/include/sys/_null.h" 3 4 >#if 0 /* disabled by -frewrite-includes */ >#if __cplusplus >= 201103L >#endif >#endif /* disabled by -frewrite-includes */ >#if 0 /* evaluated by -frewrite-includes */ ># 35 "/usr/include/sys/_null.h" 3 4 >#define NULL nullptr >#if 0 /* disabled by -frewrite-includes */ >#if 0 >#elif defined(__GNUG__) && defined(__GNUC__) && __GNUC__ >= 4 >#endif >#endif /* disabled by -frewrite-includes */ >#elif 0 /* evaluated by -frewrite-includes */ ># 37 "/usr/include/sys/_null.h" 3 4 >#define NULL __null >#else ># 39 "/usr/include/sys/_null.h" 3 4 >#if 0 /* disabled by -frewrite-includes */ >#if defined(__LP64__) >#endif >#endif /* disabled by -frewrite-includes */ >#if 0 /* evaluated by -frewrite-includes */ ># 40 "/usr/include/sys/_null.h" 3 4 >#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 ># 42 "/usr/include/stdio.h" 2 3 4 >#if 0 /* expanded by -frewrite-includes */ >#include <sys/_types.h> >#endif /* expanded by -frewrite-includes */ ># 42 "/usr/include/stdio.h" 3 4 ># 1 "/usr/include/sys/_types.h" 1 3 4 >/*- > * SPDX-License-Identifier: BSD-2-Clause > * > * Copyright (c) 2002 Mike Barcroft <mike@FreeBSD.org> > * 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. > */ > >#ifndef _SYS__TYPES_H_ >#define _SYS__TYPES_H_ > >#if 0 /* expanded by -frewrite-includes */ >#include <sys/cdefs.h> >#endif /* expanded by -frewrite-includes */ ># 32 "/usr/include/sys/_types.h" 3 4 ># 33 "/usr/include/sys/_types.h" 3 4 > >/* > * Basic types upon which most other types are built. > * > * Note: It would be nice to simply use the compiler-provided __FOO_TYPE__ > * macros. However, in order to do so we have to check that those match the > * previous typedefs exactly (not just that they have the same size) since any > * change would be an ABI break. For example, changing `long` to `long long` > * results in different C++ name mangling. > */ >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; >#if 0 /* disabled by -frewrite-includes */ >#if __SIZEOF_LONG__ == 8 >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 50 "/usr/include/sys/_types.h" 3 4 >typedef long __int64_t; >typedef unsigned long __uint64_t; >#if 0 /* disabled by -frewrite-includes */ >#if 0 >#elif __SIZEOF_LONG__ == 4 >#endif >#endif /* disabled by -frewrite-includes */ >#elif 0 /* evaluated by -frewrite-includes */ ># 53 "/usr/include/sys/_types.h" 3 4 >__extension__ >typedef long long __int64_t; >__extension__ >typedef unsigned long long __uint64_t; >#else ># 58 "/usr/include/sys/_types.h" 3 4 >#error unsupported long size >#endif ># 60 "/usr/include/sys/_types.h" 3 4 > >typedef __int8_t __int_least8_t; >typedef __int16_t __int_least16_t; >typedef __int32_t __int_least32_t; >typedef __int64_t __int_least64_t; >typedef __int64_t __intmax_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; >typedef __uint64_t __uintmax_t; > >#if 0 /* disabled by -frewrite-includes */ >#if __SIZEOF_POINTER__ == 8 >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 73 "/usr/include/sys/_types.h" 3 4 >typedef __int64_t __intptr_t; >typedef __int64_t __intfptr_t; >typedef __uint64_t __uintptr_t; >typedef __uint64_t __uintfptr_t; >typedef __uint64_t __vm_offset_t; >typedef __uint64_t __vm_size_t; >#if 0 /* disabled by -frewrite-includes */ >#if 0 >#elif __SIZEOF_POINTER__ == 4 >#endif >#endif /* disabled by -frewrite-includes */ >#elif 0 /* evaluated by -frewrite-includes */ ># 80 "/usr/include/sys/_types.h" 3 4 >typedef __int32_t __intptr_t; >typedef __int32_t __intfptr_t; >typedef __uint32_t __uintptr_t; >typedef __uint32_t __uintfptr_t; >typedef __uint32_t __vm_offset_t; >typedef __uint32_t __vm_size_t; >#else ># 87 "/usr/include/sys/_types.h" 3 4 >#error unsupported pointer size >#endif ># 89 "/usr/include/sys/_types.h" 3 4 > >#if 0 /* disabled by -frewrite-includes */ >#if __SIZEOF_SIZE_T__ == 8 >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 91 "/usr/include/sys/_types.h" 3 4 >typedef __uint64_t __size_t; /* sizeof() */ >typedef __int64_t __ssize_t; /* byte count or error */ >#if 0 /* disabled by -frewrite-includes */ >#if 0 >#elif __SIZEOF_SIZE_T__ == 4 >#endif >#endif /* disabled by -frewrite-includes */ >#elif 0 /* evaluated by -frewrite-includes */ ># 94 "/usr/include/sys/_types.h" 3 4 >typedef __uint32_t __size_t; /* sizeof() */ >typedef __int32_t __ssize_t; /* byte count or error */ >#else ># 97 "/usr/include/sys/_types.h" 3 4 >#error unsupported size_t size >#endif ># 99 "/usr/include/sys/_types.h" 3 4 > >#if 0 /* disabled by -frewrite-includes */ >#if __SIZEOF_PTRDIFF_T__ == 8 >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 101 "/usr/include/sys/_types.h" 3 4 >typedef __int64_t __ptrdiff_t; /* ptr1 - ptr2 */ >#if 0 /* disabled by -frewrite-includes */ >#if 0 >#elif __SIZEOF_PTRDIFF_T__ == 4 >#endif >#endif /* disabled by -frewrite-includes */ >#elif 0 /* evaluated by -frewrite-includes */ ># 103 "/usr/include/sys/_types.h" 3 4 >typedef __int32_t __ptrdiff_t; /* ptr1 - ptr2 */ >#else ># 105 "/usr/include/sys/_types.h" 3 4 >#error unsupported ptrdiff_t size >#endif ># 107 "/usr/include/sys/_types.h" 3 4 > >/* > * Target-dependent type definitions. > */ >#if 0 /* expanded by -frewrite-includes */ >#include <machine/_types.h> >#endif /* expanded by -frewrite-includes */ ># 111 "/usr/include/sys/_types.h" 3 4 ># 1 "/usr/include/machine/_types.h" 1 3 4 >/*- > * This file is in the public domain. > */ > >#if 0 /* expanded by -frewrite-includes */ >#include <x86/_types.h> >#endif /* expanded by -frewrite-includes */ ># 5 "/usr/include/machine/_types.h" 3 4 ># 1 "/usr/include/x86/_types.h" 1 3 4 >/*- > * SPDX-License-Identifier: BSD-4-Clause > * > * Copyright (c) 2002 Mike Barcroft <mike@FreeBSD.org> > * 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 > */ > >#ifndef _MACHINE__TYPES_H_ >#define _MACHINE__TYPES_H_ > >#ifndef _SYS__TYPES_H_ >#error do not include this header, use sys/_types.h >#endif ># 46 "/usr/include/x86/_types.h" 3 4 > >#if 0 /* expanded by -frewrite-includes */ >#include <machine/_limits.h> >#endif /* expanded by -frewrite-includes */ ># 47 "/usr/include/x86/_types.h" 3 4 ># 1 "/usr/include/machine/_limits.h" 1 3 4 >/*- > * This file is in the public domain. > */ > >#if 0 /* expanded by -frewrite-includes */ >#include <x86/_limits.h> >#endif /* expanded by -frewrite-includes */ ># 5 "/usr/include/machine/_limits.h" 3 4 ># 1 "/usr/include/x86/_limits.h" 1 3 4 >/*- > * SPDX-License-Identifier: BSD-3-Clause > * > * 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. > * 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. > * > * @(#)limits.h 8.3 (Berkeley) 1/4/94 > */ > >#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 ># 66 "/usr/include/x86/_limits.h" 3 4 >#define __ULONG_MAX 0xffffffffUL >#define __LONG_MAX 0x7fffffffL >#define __LONG_MIN (-0x7fffffffL - 1) >#endif ># 70 "/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 ># 87 "/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 ># 96 "/usr/include/x86/_limits.h" 3 4 > >#define __WORD_BIT 32 > >/* Minimum signal stack size. */ >#define __MINSIGSTKSZ (512 * 4) > >#endif /* !_MACHINE__LIMITS_H_ */ ># 103 "/usr/include/x86/_limits.h" 3 4 ># 6 "/usr/include/machine/_limits.h" 2 3 4 ># 48 "/usr/include/x86/_types.h" 2 3 4 > >#define __NO_STRICT_ALIGNMENT > >/* > * Standard type definitions. > */ >#ifdef __LP64__ >typedef __int32_t __clock_t; /* clock()... */ >typedef __int64_t __critical_t; >#ifndef _STANDALONE >typedef double __double_t; >typedef float __float_t; >#endif ># 61 "/usr/include/x86/_types.h" 3 4 >#else ># 62 "/usr/include/x86/_types.h" 3 4 >typedef unsigned long __clock_t; >typedef __int32_t __critical_t; >#ifndef _STANDALONE >typedef long double __double_t; >typedef long double __float_t; >#endif ># 68 "/usr/include/x86/_types.h" 3 4 >#endif ># 69 "/usr/include/x86/_types.h" 3 4 >typedef __int32_t __int_fast8_t; >typedef __int32_t __int_fast16_t; >typedef __int32_t __int_fast32_t; >typedef __int64_t __int_fast64_t; >#ifdef __LP64__ >typedef __int64_t __register_t; >typedef __int64_t __segsz_t; /* segment size (in pages) */ >typedef __int64_t __time_t; /* time()... */ >#else ># 78 "/usr/include/x86/_types.h" 3 4 >typedef __int32_t __register_t; >typedef __int32_t __segsz_t; >typedef __int32_t __time_t; >#endif ># 82 "/usr/include/x86/_types.h" 3 4 >typedef __uint32_t __uint_fast8_t; >typedef __uint32_t __uint_fast16_t; >typedef __uint32_t __uint_fast32_t; >typedef __uint64_t __uint_fast64_t; >#ifdef __LP64__ >typedef __uint64_t __u_register_t; >typedef __uint64_t __vm_paddr_t; >#else ># 90 "/usr/include/x86/_types.h" 3 4 >typedef __uint32_t __u_register_t; >typedef __uint64_t __vm_paddr_t; >#endif ># 93 "/usr/include/x86/_types.h" 3 4 >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 */ > >#endif /* !_MACHINE__TYPES_H_ */ ># 99 "/usr/include/x86/_types.h" 3 4 ># 6 "/usr/include/machine/_types.h" 2 3 4 ># 112 "/usr/include/sys/_types.h" 2 3 4 > >/* > * Standard type definitions. > */ >typedef __int32_t __blksize_t; /* file block size */ >typedef __int64_t __blkcnt_t; /* file block count */ >typedef __int32_t __clockid_t; /* clock_gettime()... */ >typedef __uint32_t __fflags_t; /* file flags */ >typedef __uint64_t __fsblkcnt_t; >typedef __uint64_t __fsfilcnt_t; >typedef __uint32_t __gid_t; >typedef __int64_t __id_t; /* can hold a gid_t, pid_t, or uid_t */ >typedef __uint64_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 __uint64_t __nlink_t; /* link count */ >typedef __int64_t __off_t; /* file offset */ >typedef __int64_t __off64_t; /* file offset (alias) */ >typedef __int32_t __pid_t; /* process [group] */ >typedef __int64_t __sbintime_t; >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. */ >typedef __int64_t __daddr_t; /* bwrite(3), FIOBMAP2, etc */ > >/* > * 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 0 /* disabled by -frewrite-includes */ >#if !defined(__clang__) || !defined(__cplusplus) >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 174 "/usr/include/sys/_types.h" 3 4 >typedef __uint_least16_t __char16_t; >typedef __uint_least32_t __char32_t; >#endif ># 177 "/usr/include/sys/_types.h" 3 4 >/* In C++11, char16_t and char32_t are built-in types. */ >#if 0 /* disabled by -frewrite-includes */ >#if defined(__cplusplus) && __cplusplus >= 201103L >#endif >#endif /* disabled by -frewrite-includes */ >#if 0 /* evaluated by -frewrite-includes */ ># 179 "/usr/include/sys/_types.h" 3 4 >#define _CHAR16_T_DECLARED >#define _CHAR32_T_DECLARED >#endif ># 182 "/usr/include/sys/_types.h" 3 4 > >typedef struct { > long long __max_align1 __aligned(_Alignof(long long)); >#ifndef _STANDALONE > long double __max_align2 __aligned(_Alignof(long double)); >#endif ># 188 "/usr/include/sys/_types.h" 3 4 >} __max_align_t; > >typedef __uint64_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; > >typedef __uintmax_t __rman_res_t; > >/* > * Types for varargs. These are all provided by builtin types these > * days, so centralize their definition. > */ >typedef __builtin_va_list __va_list; /* internally known to gcc */ >#if 0 /* disabled by -frewrite-includes */ >#if !defined(__GNUC_VA_LIST) && !defined(__NO_GNUC_VA_LIST) >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 211 "/usr/include/sys/_types.h" 3 4 >#define __GNUC_VA_LIST >typedef __va_list __gnuc_va_list; /* compatibility w/GNU headers*/ >#endif ># 214 "/usr/include/sys/_types.h" 3 4 > >/* > * When the following macro is defined, the system uses 64-bit inode numbers. > * Programs can use this to avoid including <sys/param.h>, with its associated > * namespace pollution. > */ >#define __INO64 > >#endif /* !_SYS__TYPES_H_ */ ># 223 "/usr/include/sys/_types.h" 3 4 ># 43 "/usr/include/stdio.h" 2 3 4 > >__NULLABILITY_PRAGMA_PUSH > >typedef __off_t fpos_t; > >#ifndef _SIZE_T_DECLARED >typedef __size_t size_t; >#define _SIZE_T_DECLARED >#endif ># 52 "/usr/include/stdio.h" 3 4 > >#ifndef _RSIZE_T_DEFINED >#define _RSIZE_T_DEFINED >typedef size_t rsize_t; >#endif ># 57 "/usr/include/stdio.h" 3 4 > >#if 0 /* disabled by -frewrite-includes */ >#if __POSIX_VISIBLE >= 200809 >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 59 "/usr/include/stdio.h" 3 4 >#ifndef _OFF_T_DECLARED >#define _OFF_T_DECLARED >typedef __off_t off_t; >#endif ># 63 "/usr/include/stdio.h" 3 4 >#ifndef _SSIZE_T_DECLARED >#define _SSIZE_T_DECLARED >typedef __ssize_t ssize_t; >#endif ># 67 "/usr/include/stdio.h" 3 4 >#endif ># 68 "/usr/include/stdio.h" 3 4 > >#ifndef _OFF64_T_DECLARED >#define _OFF64_T_DECLARED >typedef __off64_t off64_t; >#endif ># 73 "/usr/include/stdio.h" 3 4 > >#if 0 /* disabled by -frewrite-includes */ >#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 75 "/usr/include/stdio.h" 3 4 >#ifndef _VA_LIST_DECLARED >typedef __va_list va_list; >#define _VA_LIST_DECLARED >#endif ># 79 "/usr/include/stdio.h" 3 4 >#endif ># 80 "/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 (* _Nullable _close)(void *); > int (* _Nullable _read)(void *, char *, int); > fpos_t (* _Nullable _seek)(void *, fpos_t, int); > int (* _Nullable _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 */ > int _flags2; /* additional flags */ >}; >#ifndef _STDFILE_DECLARED >#define _STDFILE_DECLARED >typedef struct __sFILE FILE; >#endif ># 166 "/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 ># 174 "/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 */ > >#define __S2OAP 0x0001 /* O_APPEND mode is set */ > >/* > * 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 <limits.h> */ >#ifndef FOPEN_MAX >#define FOPEN_MAX 20 /* must be <= OPEN_MAX <sys/syslimits.h> */ >#endif ># 220 "/usr/include/stdio.h" 3 4 >#define FILENAME_MAX 1024 /* must be <= PATH_MAX <sys/syslimits.h> */ > >/* System V/ANSI C; this is the wrong way to do this, do *not* use these. */ >#if 0 /* disabled by -frewrite-includes */ >#if __XSI_VISIBLE >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 224 "/usr/include/stdio.h" 3 4 >#define P_tmpdir "/tmp/" >#endif ># 226 "/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 ># 232 "/usr/include/stdio.h" 3 4 >#ifndef SEEK_CUR >#define SEEK_CUR 1 /* set file offset to current plus offset */ >#endif ># 235 "/usr/include/stdio.h" 3 4 >#ifndef SEEK_END >#define SEEK_END 2 /* set file offset to EOF plus offset */ >#endif ># 238 "/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 <xlocale/_stdio.h> >#endif /* expanded by -frewrite-includes */ ># 245 "/usr/include/stdio.h" 3 4 ># 246 "/usr/include/stdio.h" 3 4 >#endif ># 247 "/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); >#if 0 /* disabled by -frewrite-includes */ >#if __EXT1_VISIBLE >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 272 "/usr/include/stdio.h" 3 4 >char *gets_s(char *, rsize_t); >#endif ># 274 "/usr/include/stdio.h" 3 4 >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 0 /* disabled by -frewrite-includes */ >#if __ISO_C_VISIBLE >= 1999 || __POSIX_VISIBLE >= 199506 >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 297 "/usr/include/stdio.h" 3 4 >int snprintf(char * __restrict, size_t, const char * __restrict, > ...) __printflike(3, 4); >int vsnprintf(char * __restrict, size_t, const char * __restrict, > __va_list) __printflike(3, 0); >#endif ># 302 "/usr/include/stdio.h" 3 4 >#if 0 /* disabled by -frewrite-includes */ >#if __ISO_C_VISIBLE >= 1999 >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 303 "/usr/include/stdio.h" 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 vsscanf(const char * __restrict, const char * __restrict, __va_list) > __scanflike(2, 0); >#endif ># 309 "/usr/include/stdio.h" 3 4 > >/* > * Functions defined in all versions of POSIX 1003.1. > */ >#if 0 /* disabled by -frewrite-includes */ >#if __BSD_VISIBLE || (__POSIX_VISIBLE && __POSIX_VISIBLE <= 199506) >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 314 "/usr/include/stdio.h" 3 4 >#define L_cuserid 17 /* size for cuserid(3); MAXLOGNAME, legacy */ >#endif ># 316 "/usr/include/stdio.h" 3 4 > >#if 0 /* disabled by -frewrite-includes */ >#if __POSIX_VISIBLE >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 318 "/usr/include/stdio.h" 3 4 >#define L_ctermid 1024 /* size for ctermid(3); PATH_MAX */ > >char *ctermid(char *); >FILE *fdopen(int, const char *); >int fileno(FILE *); >#endif /* __POSIX_VISIBLE */ ># 324 "/usr/include/stdio.h" 3 4 > >#if 0 /* disabled by -frewrite-includes */ >#if __POSIX_VISIBLE >= 199209 >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 326 "/usr/include/stdio.h" 3 4 >int pclose(FILE *); >FILE *popen(const char *, const char *); >#endif ># 329 "/usr/include/stdio.h" 3 4 > >#if 0 /* disabled by -frewrite-includes */ >#if __POSIX_VISIBLE >= 199506 >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 331 "/usr/include/stdio.h" 3 4 >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 ># 344 "/usr/include/stdio.h" 3 4 >#if 0 /* disabled by -frewrite-includes */ >#if __BSD_VISIBLE >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 345 "/usr/include/stdio.h" 3 4 >void clearerr_unlocked(FILE *); >int feof_unlocked(FILE *); >int ferror_unlocked(FILE *); >int fflush_unlocked(FILE *); >int fileno_unlocked(FILE *); >int fputc_unlocked(int, FILE *); >int fputs_unlocked(const char * __restrict, FILE * __restrict); >size_t fread_unlocked(void * __restrict, size_t, size_t, FILE * __restrict); >size_t fwrite_unlocked(const void * __restrict, size_t, size_t, > FILE * __restrict); >#endif ># 356 "/usr/include/stdio.h" 3 4 > >#if 0 /* disabled by -frewrite-includes */ >#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE >= 500 >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 358 "/usr/include/stdio.h" 3 4 >int fseeko(FILE *, __off_t, int); >__off_t ftello(FILE *); >#endif ># 361 "/usr/include/stdio.h" 3 4 > >#if 0 /* disabled by -frewrite-includes */ >#if __BSD_VISIBLE || __XSI_VISIBLE > 0 && __XSI_VISIBLE < 600 >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 363 "/usr/include/stdio.h" 3 4 >int getw(FILE *); >int putw(int, FILE *); >#endif /* BSD or X/Open before issue 6 */ ># 366 "/usr/include/stdio.h" 3 4 > >#if 0 /* disabled by -frewrite-includes */ >#if __XSI_VISIBLE >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 368 "/usr/include/stdio.h" 3 4 >char *tempnam(const char *, const char *); >#endif ># 370 "/usr/include/stdio.h" 3 4 > >#if 0 /* disabled by -frewrite-includes */ >#if __POSIX_VISIBLE >= 200809 >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 372 "/usr/include/stdio.h" 3 4 >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) __printflike(2, 0); >/* _WITH_GETLINE to allow pre 11 sources to build on 11+ systems */ >ssize_t getline(char ** __restrict, size_t * __restrict, FILE * __restrict); >int dprintf(int, const char * __restrict, ...) __printflike(2, 3); >#endif /* __POSIX_VISIBLE >= 200809 */ ># 382 "/usr/include/stdio.h" 3 4 > >/* > * Routines that are purely local. > */ >#if 0 /* disabled by -frewrite-includes */ >#if __BSD_VISIBLE >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 387 "/usr/include/stdio.h" 3 4 >int asprintf(char **, const char *, ...) __printflike(2, 3); >char *ctermid_r(char *); >void fcloseall(void); >int fdclose(FILE *, int *); >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 <string.h> > * instead. > */ >extern const int sys_nerr; >extern const char * const sys_errlist[]; > >/* > * Stdio function-access interface. > */ >FILE *funopen(const void *, > int (* _Nullable)(void *, char *, int), > int (* _Nullable)(void *, const char *, int), > fpos_t (* _Nullable)(void *, fpos_t, int), > int (* _Nullable)(void *)); >#define fropen(cookie, fn) funopen(cookie, fn, 0, 0, 0) >#define fwopen(cookie, fn) funopen(cookie, 0, fn, 0, 0) > >typedef __ssize_t cookie_read_function_t(void *, char *, size_t); >typedef __ssize_t cookie_write_function_t(void *, const char *, size_t); >typedef int cookie_seek_function_t(void *, off64_t *, int); >typedef int cookie_close_function_t(void *); >typedef struct { > cookie_read_function_t *read; > cookie_write_function_t *write; > cookie_seek_function_t *seek; > cookie_close_function_t *close; >} cookie_io_functions_t; >FILE *fopencookie(void *, const char *, cookie_io_functions_t); > >/* > * Portability hacks. See <sys/types.h>. > */ >#ifndef _FTRUNCATE_DECLARED >#define _FTRUNCATE_DECLARED >int ftruncate(int, __off_t); >#endif ># 437 "/usr/include/stdio.h" 3 4 >#ifndef _LSEEK_DECLARED >#define _LSEEK_DECLARED >__off_t lseek(int, __off_t, int); >#endif ># 441 "/usr/include/stdio.h" 3 4 >#ifndef _MMAP_DECLARED >#define _MMAP_DECLARED >void *mmap(void *, size_t, int, int, int, __off_t); >#endif ># 445 "/usr/include/stdio.h" 3 4 >#ifndef _TRUNCATE_DECLARED >#define _TRUNCATE_DECLARED >int truncate(const char *, __off_t); >#endif ># 449 "/usr/include/stdio.h" 3 4 >#endif /* __BSD_VISIBLE */ ># 450 "/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 0 /* disabled by -frewrite-includes */ >#if defined(__GNUC__) && defined(__STDC__) >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 463 "/usr/include/stdio.h" 3 4 >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 ># 470 "/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 ># 482 "/usr/include/stdio.h" 3 4 > >#ifndef __LIBC_ISTHREADED_DECLARED >#define __LIBC_ISTHREADED_DECLARED >extern int __isthreaded; >#endif ># 487 "/usr/include/stdio.h" 3 4 > >#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 0 /* disabled by -frewrite-includes */ >#if __POSIX_VISIBLE >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 501 "/usr/include/stdio.h" 3 4 >#define fileno(p) (!__isthreaded ? __sfileno(p) : (fileno)(p)) >#endif ># 503 "/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 0 /* disabled by -frewrite-includes */ >#if __BSD_VISIBLE >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 511 "/usr/include/stdio.h" 3 4 >/* > * 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 clearerr_unlocked(p) __sclearerr(p) >#define feof_unlocked(p) __sfeof(p) >#define ferror_unlocked(p) __sferror(p) >#define fileno_unlocked(p) __sfileno(p) >#define fputc_unlocked(s, p) __sputc(s, p) >#endif ># 521 "/usr/include/stdio.h" 3 4 >#if 0 /* disabled by -frewrite-includes */ >#if __POSIX_VISIBLE >= 199506 >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 522 "/usr/include/stdio.h" 3 4 >#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 ># 528 "/usr/include/stdio.h" 3 4 >#endif /* __cplusplus */ ># 529 "/usr/include/stdio.h" 3 4 > >__END_DECLS >__NULLABILITY_PRAGMA_POP > >#endif /* !_STDIO_H_ */ ># 534 "/usr/include/stdio.h" 3 4 ># 2 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/test/test_pinv.c" 2 >#if 0 /* expanded by -frewrite-includes */ >#include <stdlib.h> // for free, malloc >#endif /* expanded by -frewrite-includes */ ># 2 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/test/test_pinv.c" ># 1 "/usr/include/stdlib.h" 1 3 4 >/*- > * SPDX-License-Identifier: BSD-3-Clause > * > * 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 > */ > >#ifndef _STDLIB_H_ >#define _STDLIB_H_ > >#if 0 /* expanded by -frewrite-includes */ >#include <sys/cdefs.h> >#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 <sys/_null.h> >#endif /* expanded by -frewrite-includes */ ># 38 "/usr/include/stdlib.h" 3 4 ># 39 "/usr/include/stdlib.h" 3 4 >#if 0 /* expanded by -frewrite-includes */ >#include <sys/_types.h> >#endif /* expanded by -frewrite-includes */ ># 39 "/usr/include/stdlib.h" 3 4 ># 40 "/usr/include/stdlib.h" 3 4 > >__NULLABILITY_PRAGMA_PUSH > >#if 0 /* disabled by -frewrite-includes */ >#if __BSD_VISIBLE >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 44 "/usr/include/stdlib.h" 3 4 >#ifndef _RUNE_T_DECLARED >typedef __rune_t rune_t; >#define _RUNE_T_DECLARED >#endif ># 48 "/usr/include/stdlib.h" 3 4 >#endif ># 49 "/usr/include/stdlib.h" 3 4 > >#ifndef _SIZE_T_DECLARED >typedef __size_t size_t; >#define _SIZE_T_DECLARED >#endif ># 54 "/usr/include/stdlib.h" 3 4 > >#ifndef __cplusplus >#ifndef _WCHAR_T_DECLARED >typedef ___wchar_t wchar_t; >#define _WCHAR_T_DECLARED >#endif ># 60 "/usr/include/stdlib.h" 3 4 >#endif ># 61 "/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 > >/* > * I.e., INT_MAX; rand(3) returns a signed integer but must produce output in > * the range [0, RAND_MAX], so half of the possible output range is unused. > */ >#define RAND_MAX 0x7fffffff > >__BEGIN_DECLS >#ifdef _XLOCALE_H_ >#if 0 /* expanded by -frewrite-includes */ >#include <xlocale/_stdlib.h> >#endif /* expanded by -frewrite-includes */ ># 83 "/usr/include/stdlib.h" 3 4 ># 84 "/usr/include/stdlib.h" 3 4 >#endif ># 85 "/usr/include/stdlib.h" 3 4 >extern int __mb_cur_max; >extern int ___mb_cur_max(void); >#define MB_CUR_MAX ((size_t)___mb_cur_max()) > >_Noreturn void abort(void); >int abs(int) __pure2; >int atexit(void (* _Nonnull)(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 * _Nonnull, const void *)); >void *calloc(size_t, size_t) __malloc_like __result_use_check > __alloc_size2(1, 2); >div_t div(int, int) __pure2; >_Noreturn void exit(int); >void free(void *); >char *getenv(const char *); >long labs(long) __pure2; >ldiv_t ldiv(long, long) __pure2; >void *malloc(size_t) __malloc_like __result_use_check __alloc_size(1); >int mblen(const char *, size_t); >size_t mbstowcs(wchar_t * __restrict , const char * __restrict, size_t); >int mbtowc(wchar_t * __restrict, const char * __restrict, size_t); >void qsort(void *, size_t, size_t, > int (* _Nonnull)(const void *, const void *)); >int rand(void); >void *realloc(void *, size_t) __result_use_check __alloc_size(2); >void srand(unsigned); >double strtod(const char * __restrict, char ** __restrict); >float strtof(const char * __restrict, char ** __restrict); >long strtol(const char * __restrict, char ** __restrict, int); >long double > strtold(const char * __restrict, char ** __restrict); >unsigned long > strtoul(const char * __restrict, char ** __restrict, int); >int system(const char *); >int wctomb(char *, wchar_t); >size_t wcstombs(char * __restrict, const wchar_t * __restrict, size_t); > >/* > * Functions added in C99 which we make conditionally available in the > * BSD^C89 namespace if the compiler supports `long long'. > * The #if test is more complicated than it ought to be because > * __BSD_VISIBLE implies __ISO_C_VISIBLE == 1999 *even if* `long long' > * is not supported in the compilation environment (which therefore means > * that it can't really be ISO C99). > * > * (The only other extension made by C99 in this header is _Exit().) > */ >#if 0 /* disabled by -frewrite-includes */ >#if __ISO_C_VISIBLE >= 1999 || defined(__cplusplus) >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 136 "/usr/include/stdlib.h" 3 4 >#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 */ ># 158 "/usr/include/stdlib.h" 3 4 > >_Noreturn void _Exit(int); >#endif /* __ISO_C_VISIBLE >= 1999 */ ># 161 "/usr/include/stdlib.h" 3 4 > >/* > * If we're in a mode greater than C99, expose C11 functions. > */ >#if 0 /* disabled by -frewrite-includes */ >#if __ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103L >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 166 "/usr/include/stdlib.h" 3 4 >void * aligned_alloc(size_t, size_t) __malloc_like __alloc_align(1) > __alloc_size(2); >int at_quick_exit(void (*)(void)); >_Noreturn void > quick_exit(int); >#endif /* __ISO_C_VISIBLE >= 2011 */ ># 172 "/usr/include/stdlib.h" 3 4 >/* > * Extensions made by POSIX relative to C. > */ >#if 0 /* disabled by -frewrite-includes */ >#if __POSIX_VISIBLE >= 199506 || __XSI_VISIBLE >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 176 "/usr/include/stdlib.h" 3 4 >char *realpath(const char * __restrict, char * __restrict); >#endif ># 178 "/usr/include/stdlib.h" 3 4 >#if 0 /* disabled by -frewrite-includes */ >#if __POSIX_VISIBLE >= 199506 >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 179 "/usr/include/stdlib.h" 3 4 >int rand_r(unsigned *); /* (TSF) */ >#endif ># 181 "/usr/include/stdlib.h" 3 4 >#if 0 /* disabled by -frewrite-includes */ >#if __POSIX_VISIBLE >= 200112 >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 182 "/usr/include/stdlib.h" 3 4 >int posix_memalign(void **, size_t, size_t); /* (ADV) */ >int setenv(const char *, const char *, int); >int unsetenv(const char *); >#endif ># 186 "/usr/include/stdlib.h" 3 4 > >#if 0 /* disabled by -frewrite-includes */ >#if __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 188 "/usr/include/stdlib.h" 3 4 >int getsubopt(char **, char *const *, char **); >#ifndef _MKDTEMP_DECLARED >char *mkdtemp(char *); >#define _MKDTEMP_DECLARED >#endif ># 193 "/usr/include/stdlib.h" 3 4 >#ifndef _MKSTEMP_DECLARED >int mkstemp(char *); >#define _MKSTEMP_DECLARED >#endif ># 197 "/usr/include/stdlib.h" 3 4 >#endif /* __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE */ ># 198 "/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 0 /* disabled by -frewrite-includes */ >#if __XSI_VISIBLE >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 206 "/usr/include/stdlib.h" 3 4 >/* XXX XSI requires pollution from <sys/wait.h> 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); */ >char *initstate(unsigned int, char *, size_t); >long jrand48(unsigned short[3]); >char *l64a(long); >void lcong48(unsigned short[7]); >long lrand48(void); >#if 0 /* disabled by -frewrite-includes */ >#if !defined(_MKTEMP_DECLARED) && (__BSD_VISIBLE || __XSI_VISIBLE <= 600) >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 219 "/usr/include/stdlib.h" 3 4 >char *mktemp(char *); >#define _MKTEMP_DECLARED >#endif ># 222 "/usr/include/stdlib.h" 3 4 >long mrand48(void); >long nrand48(unsigned short[3]); >int putenv(char *); >long random(void); >unsigned short > *seed48(unsigned short[3]); >char *setstate(/* const */ char *); >void srand48(long); >void srandom(unsigned int); >#endif /* __XSI_VISIBLE */ ># 232 "/usr/include/stdlib.h" 3 4 > >#if 0 /* disabled by -frewrite-includes */ >#if __XSI_VISIBLE >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 234 "/usr/include/stdlib.h" 3 4 >int grantpt(int); >int posix_openpt(int); >char *ptsname(int); >int unlockpt(int); >#endif /* __XSI_VISIBLE */ ># 239 "/usr/include/stdlib.h" 3 4 >#if 0 /* disabled by -frewrite-includes */ >#if __BSD_VISIBLE >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 240 "/usr/include/stdlib.h" 3 4 >/* ptsname_r will be included in POSIX issue 8 */ >int ptsname_r(int, char *, size_t); >#endif ># 243 "/usr/include/stdlib.h" 3 4 > >#if 0 /* disabled by -frewrite-includes */ >#if __BSD_VISIBLE >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 245 "/usr/include/stdlib.h" 3 4 >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. > * On platforms where alloca() is not in libc, programs which use it > * will fail to link when compiled with non-GNU compilers. > */ >#if 0 /* disabled by -frewrite-includes */ >#if __GNUC__ >= 2 >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 256 "/usr/include/stdlib.h" 3 4 >#undef alloca /* some GNU bits try to get cute and define this on their own */ >#define alloca(sz) __builtin_alloca(sz) >#endif ># 259 "/usr/include/stdlib.h" 3 4 > >void abort2(const char *, int, void **) __dead2; >__uint32_t > arc4random(void); >void arc4random_buf(void *, size_t); >__uint32_t > arc4random_uniform(__uint32_t); > >#ifdef __BLOCKS__ >int atexit_b(void (^ _Nonnull)(void)); >void *bsearch_b(const void *, const void *, size_t, > size_t, int (^ _Nonnull)(const void *, const void *)); >#endif ># 272 "/usr/include/stdlib.h" 3 4 >char *getbsize(int *, long *); > /* getcap(3) functions */ >char *cgetcap(char *, const char *, int); >int cgetclose(void); >int cgetent(char **, char **, const char *); >int cgetfirst(char **, char **); >int cgetmatch(const char *, const char *); >int cgetnext(char **, char **); >int cgetnum(char *, const char *, long *); >int cgetset(const char *); >int cgetstr(char *, const char *, char **); >int cgetustr(char *, const char *, char **); > >int clearenv(void); > >int daemon(int, int); >int daemonfd(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 (* _Nonnull)(const void *, const void *)); >#ifdef __BLOCKS__ >int heapsort_b(void *, size_t, size_t, > int (^ _Nonnull)(const void *, const void *)); >void qsort_b(void *, size_t, size_t, > int (^ _Nonnull)(const void *, const void *)); >#endif ># 305 "/usr/include/stdlib.h" 3 4 >int l64a_r(long, char *, int); >int mergesort(void *, size_t, size_t, int (*)(const void *, const void *)); >#ifdef __BLOCKS__ >int mergesort_b(void *, size_t, size_t, int (^)(const void *, const void *)); >#endif ># 310 "/usr/include/stdlib.h" 3 4 >int mkostemp(char *, int); >int mkostemps(char *, int, int); >int mkostempsat(int, char *, int, int); >void qsort_r(void *, size_t, size_t, > int (*)(const void *, const void *, void *), void *); >int radixsort(const unsigned char **, int, const unsigned char *, > unsigned); >void *reallocarray(void *, size_t, size_t) __result_use_check > __alloc_size2(2, 3); >void *reallocf(void *, size_t) __result_use_check __alloc_size(2); >int rpmatch(const char *); >char *secure_getenv(const char *); >void setprogname(const char *); >int sradixsort(const unsigned char **, int, const unsigned char *, > unsigned); >void srandomdev(void); >long long > strtonum(const char *, long long, long long, const char **); > >/* Deprecated interfaces, to be removed. */ >__int64_t > strtoq(const char *, char **, int); >__uint64_t > strtouq(const char *, char **, int); > >/* > * In FreeBSD 14, the prototype of qsort_r() was modified to comply with > * POSIX. The standardized qsort_r()'s order of last two parameters was > * changed, and the comparator function is now taking thunk as its last > * parameter, and both are different from the ones expected by the historical > * FreeBSD qsort_r() interface. > * > * Apply a workaround where we explicitly link against the historical > * interface, qsort_r@FBSD_1.0, in case when qsort_r() is called with > * the last parameter with a function pointer that exactly matches the > * historical FreeBSD qsort_r() comparator signature, so applications > * written for the historical interface can continue to work without > * modification. > */ >#if 0 /* disabled by -frewrite-includes */ >#if defined(__generic) || defined(__cplusplus) >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 350 "/usr/include/stdlib.h" 3 4 >void __qsort_r_compat(void *, size_t, size_t, void *, > int (*)(void *, const void *, const void *)); >__sym_compat(qsort_r, __qsort_r_compat, FBSD_1.0); >#endif ># 354 "/usr/include/stdlib.h" 3 4 >#if 0 /* disabled by -frewrite-includes */ >#if defined(__generic) && !defined(__cplusplus) >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 355 "/usr/include/stdlib.h" 3 4 >#define qsort_r(base, nel, width, arg4, arg5) \ > __generic(arg5, int (*)(void *, const void *, const void *), \ > __qsort_r_compat, qsort_r)(base, nel, width, arg4, arg5) >#if 0 /* disabled by -frewrite-includes */ >#if 0 >#elif defined(__cplusplus) >#endif >#endif /* disabled by -frewrite-includes */ >#elif 0 /* evaluated by -frewrite-includes */ ># 359 "/usr/include/stdlib.h" 3 4 >__END_DECLS >extern "C++" { >static inline void qsort_r(void *base, size_t nmemb, size_t size, > void *thunk, int (*compar)(void *, const void *, const void *)) { > __qsort_r_compat(base, nmemb, size, thunk, compar); >} >} >__BEGIN_DECLS >#endif ># 368 "/usr/include/stdlib.h" 3 4 > >extern char *suboptarg; /* getsubopt(3) external variable */ >#endif /* __BSD_VISIBLE */ ># 371 "/usr/include/stdlib.h" 3 4 > >#if 0 /* disabled by -frewrite-includes */ >#if __EXT1_VISIBLE >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 373 "/usr/include/stdlib.h" 3 4 > >#ifndef _RSIZE_T_DEFINED >#define _RSIZE_T_DEFINED >typedef size_t rsize_t; >#endif ># 378 "/usr/include/stdlib.h" 3 4 > >#ifndef _ERRNO_T_DEFINED >#define _ERRNO_T_DEFINED >typedef int errno_t; >#endif ># 383 "/usr/include/stdlib.h" 3 4 > >/* K.3.6 */ >typedef void (*constraint_handler_t)(const char * __restrict, > void * __restrict, errno_t); >/* K.3.6.1.1 */ >constraint_handler_t set_constraint_handler_s(constraint_handler_t handler); >/* K.3.6.1.2 */ >_Noreturn void abort_handler_s(const char * __restrict, void * __restrict, > errno_t); >/* K3.6.1.3 */ >void ignore_handler_s(const char * __restrict, void * __restrict, errno_t); >/* K.3.6.3.2 */ >errno_t qsort_s(void *, rsize_t, rsize_t, > int (*)(const void *, const void *, void *), void *); >#endif /* __EXT1_VISIBLE */ ># 398 "/usr/include/stdlib.h" 3 4 > >__END_DECLS >__NULLABILITY_PRAGMA_POP > >#endif /* !_STDLIB_H_ */ ># 403 "/usr/include/stdlib.h" 3 4 ># 3 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/test/test_pinv.c" 2 >#if 0 /* expanded by -frewrite-includes */ >#include <string.h> // for memcpy >#endif /* expanded by -frewrite-includes */ ># 3 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/test/test_pinv.c" ># 1 "/usr/include/string.h" 1 3 4 >/*- > * SPDX-License-Identifier: BSD-3-Clause > * > * 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 > */ > >#ifndef _STRING_H_ >#define _STRING_H_ > >#if 0 /* expanded by -frewrite-includes */ >#include <sys/cdefs.h> >#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 <sys/_null.h> >#endif /* expanded by -frewrite-includes */ ># 38 "/usr/include/string.h" 3 4 ># 39 "/usr/include/string.h" 3 4 >#if 0 /* expanded by -frewrite-includes */ >#include <sys/_types.h> >#endif /* expanded by -frewrite-includes */ ># 39 "/usr/include/string.h" 3 4 ># 40 "/usr/include/string.h" 3 4 > >/* > * Prototype functions which were historically defined in <string.h>, but > * are required by POSIX to be prototyped in <strings.h>. > */ >#if 0 /* disabled by -frewrite-includes */ >#if __BSD_VISIBLE >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 46 "/usr/include/string.h" 3 4 >#if 0 /* expanded by -frewrite-includes */ >#include <strings.h> >#endif /* expanded by -frewrite-includes */ ># 46 "/usr/include/string.h" 3 4 ># 1 "/usr/include/strings.h" 1 3 4 >/*- > * SPDX-License-Identifier: BSD-2-Clause > * > * Copyright (c) 2002 Mike Barcroft <mike@FreeBSD.org> > * 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. > */ > >#ifndef _STRINGS_H_ >#define _STRINGS_H_ > >#if 0 /* expanded by -frewrite-includes */ >#include <sys/cdefs.h> >#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 <sys/_types.h> >#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 0 /* disabled by -frewrite-includes */ >#if __BSD_VISIBLE || __POSIX_VISIBLE <= 200112 >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 42 "/usr/include/strings.h" 3 4 >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 0 /* disabled by -frewrite-includes */ >#if __BSD_VISIBLE >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 47 "/usr/include/strings.h" 3 4 >void explicit_bzero(void *, size_t); >#endif ># 49 "/usr/include/strings.h" 3 4 >#if 0 /* disabled by -frewrite-includes */ >#if __XSI_VISIBLE >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 50 "/usr/include/strings.h" 3 4 >int ffs(int) __pure2; >#endif ># 52 "/usr/include/strings.h" 3 4 >#if 0 /* disabled by -frewrite-includes */ >#if __BSD_VISIBLE >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 53 "/usr/include/strings.h" 3 4 >int ffsl(long) __pure2; >int ffsll(long long) __pure2; >int fls(int) __pure2; >int flsl(long) __pure2; >int flsll(long long) __pure2; >#endif ># 59 "/usr/include/strings.h" 3 4 >#if 0 /* disabled by -frewrite-includes */ >#if __BSD_VISIBLE || __POSIX_VISIBLE <= 200112 >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 60 "/usr/include/strings.h" 3 4 >char *index(const char *, int) __pure; /* LEGACY */ >char *rindex(const char *, int) __pure; /* LEGACY */ >#endif ># 63 "/usr/include/strings.h" 3 4 >int strcasecmp(const char *, const char *) __pure; >int strncasecmp(const char *, const char *, size_t) __pure; > >#if 0 /* disabled by -frewrite-includes */ >#if __POSIX_VISIBLE >= 200809 || defined(_XLOCALE_H_) >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 67 "/usr/include/strings.h" 3 4 >#if 0 /* expanded by -frewrite-includes */ >#include <xlocale/_strings.h> >#endif /* expanded by -frewrite-includes */ ># 67 "/usr/include/strings.h" 3 4 ># 1 "/usr/include/xlocale/_strings.h" 1 3 4 >/*- > * Copyright (c) 2011, 2012 The FreeBSD Foundation > * > * 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. > */ > >#ifndef _LOCALE_T_DEFINED >#define _LOCALE_T_DEFINED >typedef struct _xlocale *locale_t; >#endif ># 30 "/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 */ ># 46 "/usr/include/xlocale/_strings.h" 3 4 ># 68 "/usr/include/strings.h" 2 3 4 >#endif ># 69 "/usr/include/strings.h" 3 4 >__END_DECLS > >#endif /* _STRINGS_H_ */ ># 72 "/usr/include/strings.h" 3 4 ># 47 "/usr/include/string.h" 2 3 4 >#endif ># 48 "/usr/include/string.h" 3 4 > >#ifndef _SIZE_T_DECLARED >typedef __size_t size_t; >#define _SIZE_T_DECLARED >#endif ># 53 "/usr/include/string.h" 3 4 > >__BEGIN_DECLS >#if 0 /* disabled by -frewrite-includes */ >#if __XSI_VISIBLE >= 600 >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 56 "/usr/include/string.h" 3 4 >void *memccpy(void * __restrict, const void * __restrict, int, size_t); >#endif ># 58 "/usr/include/string.h" 3 4 >void *memchr(const void *, int, size_t) __pure; >#if 0 /* disabled by -frewrite-includes */ >#if __BSD_VISIBLE >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 60 "/usr/include/string.h" 3 4 >void *memrchr(const void *, int, size_t) __pure; >#endif ># 62 "/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 0 /* disabled by -frewrite-includes */ >#if __BSD_VISIBLE >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 65 "/usr/include/string.h" 3 4 >void *memmem(const void *, size_t, const void *, size_t) __pure; >#endif ># 67 "/usr/include/string.h" 3 4 >void *memmove(void *, const void *, size_t); >#if 0 /* disabled by -frewrite-includes */ >#if __BSD_VISIBLE >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 69 "/usr/include/string.h" 3 4 >void *mempcpy(void * __restrict, const void * __restrict, size_t); >#endif ># 71 "/usr/include/string.h" 3 4 >void *memset(void *, int, size_t); >#if 0 /* disabled by -frewrite-includes */ >#if __POSIX_VISIBLE >= 200809 >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 73 "/usr/include/string.h" 3 4 >char *stpcpy(char * __restrict, const char * __restrict); >char *stpncpy(char * __restrict, const char * __restrict, size_t); >#endif ># 76 "/usr/include/string.h" 3 4 >#if 0 /* disabled by -frewrite-includes */ >#if __BSD_VISIBLE >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 77 "/usr/include/string.h" 3 4 >char *strcasestr(const char *, const char *) __pure; >#endif ># 79 "/usr/include/string.h" 3 4 >char *strcat(char * __restrict, const char * __restrict); >char *strchr(const char *, int) __pure; >#if 0 /* disabled by -frewrite-includes */ >#if __BSD_VISIBLE >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 82 "/usr/include/string.h" 3 4 >char *strchrnul(const char*, int) __pure; >int strverscmp(const char *, const char *) __pure; >#endif ># 85 "/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 0 /* disabled by -frewrite-includes */ >#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 90 "/usr/include/string.h" 3 4 >char *strdup(const char *) __malloc_like; >#endif ># 92 "/usr/include/string.h" 3 4 >char *strerror(int); >#if 0 /* disabled by -frewrite-includes */ >#if __POSIX_VISIBLE >= 200112 >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 94 "/usr/include/string.h" 3 4 >int strerror_r(int, char *, size_t); >#endif ># 96 "/usr/include/string.h" 3 4 >#if 0 /* disabled by -frewrite-includes */ >#if __BSD_VISIBLE >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 97 "/usr/include/string.h" 3 4 >size_t strlcat(char * __restrict, const char * __restrict, size_t); >size_t strlcpy(char * __restrict, const char * __restrict, size_t); >#endif ># 100 "/usr/include/string.h" 3 4 >size_t strlen(const char *) __pure; >#if 0 /* disabled by -frewrite-includes */ >#if __BSD_VISIBLE >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 102 "/usr/include/string.h" 3 4 > >#ifndef _MODE_T_DECLARED >typedef __mode_t mode_t; >#define _MODE_T_DECLARED >#endif ># 107 "/usr/include/string.h" 3 4 > >void strmode(mode_t, char *); >#endif ># 110 "/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 0 /* disabled by -frewrite-includes */ >#if __POSIX_VISIBLE >= 200809 >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 114 "/usr/include/string.h" 3 4 >char *strndup(const char *, size_t) __malloc_like; >size_t strnlen(const char *, size_t) __pure; >#endif ># 117 "/usr/include/string.h" 3 4 >#if 0 /* disabled by -frewrite-includes */ >#if __BSD_VISIBLE >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 118 "/usr/include/string.h" 3 4 >char *strnstr(const char *, const char *, size_t) __pure; >#endif ># 120 "/usr/include/string.h" 3 4 >char *strpbrk(const char *, const char *) __pure; >char *strrchr(const char *, int) __pure; >#if 0 /* disabled by -frewrite-includes */ >#if __BSD_VISIBLE >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 123 "/usr/include/string.h" 3 4 >char *strsep(char **, const char *); >#endif ># 125 "/usr/include/string.h" 3 4 >#if 0 /* disabled by -frewrite-includes */ >#if __POSIX_VISIBLE >= 200809 >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 126 "/usr/include/string.h" 3 4 >char *strsignal(int); >#endif ># 128 "/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 0 /* disabled by -frewrite-includes */ >#if __POSIX_VISIBLE >= 199506 || __XSI_VISIBLE >= 500 >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 132 "/usr/include/string.h" 3 4 >char *strtok_r(char *, const char *, char **); >#endif ># 134 "/usr/include/string.h" 3 4 >size_t strxfrm(char * __restrict, const char * __restrict, size_t); >#if 0 /* disabled by -frewrite-includes */ >#if __BSD_VISIBLE >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 136 "/usr/include/string.h" 3 4 > >#ifndef _SWAB_DECLARED >#define _SWAB_DECLARED > >#ifndef _SSIZE_T_DECLARED >typedef __ssize_t ssize_t; >#define _SSIZE_T_DECLARED >#endif /* _SIZE_T_DECLARED */ ># 144 "/usr/include/string.h" 3 4 > >void swab(const void * __restrict, void * __restrict, ssize_t); >#endif /* _SWAB_DECLARED */ ># 147 "/usr/include/string.h" 3 4 > >int timingsafe_bcmp(const void *, const void *, size_t); >int timingsafe_memcmp(const void *, const void *, size_t); >#endif /* __BSD_VISIBLE */ ># 151 "/usr/include/string.h" 3 4 > >#if 0 /* disabled by -frewrite-includes */ >#if __POSIX_VISIBLE >= 200112 || defined(_XLOCALE_H_) >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 153 "/usr/include/string.h" 3 4 >#if 0 /* expanded by -frewrite-includes */ >#include <xlocale/_string.h> >#endif /* expanded by -frewrite-includes */ ># 153 "/usr/include/string.h" 3 4 ># 1 "/usr/include/xlocale/_string.h" 1 3 4 >/*- > * SPDX-License-Identifier: BSD-2-Clause > * > * Copyright (c) 2011, 2012 The FreeBSD Foundation > * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions > * are met: > * 1. Redistributions of source code must retain the above copyright > * notice, this list of conditions and the following disclaimer. > * 2. Redistributions in binary form must reproduce the above copyright > * notice, this list of conditions and the following disclaimer in the > * documentation and/or other materials provided with the distribution. > * > * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND > * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE > * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE > * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE > * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL > * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS > * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) > * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT > * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY > * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF > * SUCH DAMAGE. > */ > >#ifndef _LOCALE_T_DEFINED >#define _LOCALE_T_DEFINED >typedef struct _xlocale *locale_t; >#endif ># 32 "/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); >char *strerror_l(int num, 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 ># 154 "/usr/include/string.h" 2 3 4 >#endif ># 155 "/usr/include/string.h" 3 4 > >#if 0 /* disabled by -frewrite-includes */ >#if __EXT1_VISIBLE >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 157 "/usr/include/string.h" 3 4 > >#ifndef _RSIZE_T_DEFINED >#define _RSIZE_T_DEFINED >typedef size_t rsize_t; >#endif ># 162 "/usr/include/string.h" 3 4 > >#ifndef _ERRNO_T_DEFINED >#define _ERRNO_T_DEFINED >typedef int errno_t; >#endif ># 167 "/usr/include/string.h" 3 4 > >/* ISO/IEC 9899:2011 K.3.7.4.1.1 */ >errno_t memset_s(void *, rsize_t, int, rsize_t); >#endif /* __EXT1_VISIBLE */ ># 171 "/usr/include/string.h" 3 4 >__END_DECLS > >#endif /* _STRING_H_ */ ># 174 "/usr/include/string.h" 3 4 ># 4 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/test/test_pinv.c" 2 >#if 0 /* expanded by -frewrite-includes */ >#include "NumericsFwd.h" // for NumericsMatrix >#endif /* expanded by -frewrite-includes */ ># 4 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/test/test_pinv.c" ># 1 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/./NumericsFwd.h" 1 >/* Siconos is a program dedicated to modeling, simulation and control > * of non smooth dynamical systems. > * > * Copyright 2024 INRIA. > * > * Licensed under the Apache License, Version 2.0 (the "License"); > * you may not use this file except in compliance with the License. > * You may obtain a copy of the License at > * > * http://www.apache.org/licenses/LICENSE-2.0 > * > * Unless required by applicable law or agreed to in writing, software > * distributed under the License is distributed on an "AS IS" BASIS, > * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. > * See the License for the specific language governing permissions and > * limitations under the License. >*/ > >/*!\file NumericsFwd.h > * \brief Forward declaration of numerics structures*/ > >#ifndef NumericsFwd_h >#define NumericsFwd_h > >#define TYPEDEF_STRUCT(X) \ > typedef struct X X; \ > >// Matrices storage >TYPEDEF_STRUCT(NumericsMatrix) >TYPEDEF_STRUCT(NumericsSparseMatrix) >TYPEDEF_STRUCT(NSM_linear_solver_params) >TYPEDEF_STRUCT(SparseBlockStructuredMatrix) >TYPEDEF_STRUCT(SparseBlockStructuredMatrixPred) >TYPEDEF_STRUCT(SparseBlockCoordinateMatrix) > >// Nonsmooth solvers >TYPEDEF_STRUCT(SolverOptions) > >// Nonsmooth problems >TYPEDEF_STRUCT(SecondOrderConeLinearComplementarityProblem) >TYPEDEF_STRUCT(SecondOrderConeLinearComplementarityProblem_as_VI) >TYPEDEF_STRUCT(RelayProblem) >TYPEDEF_STRUCT(NonlinearComplementarityProblem) >TYPEDEF_STRUCT(MixedLinearComplementarityProblem) >TYPEDEF_STRUCT(MixedComplementarityProblem_old) >TYPEDEF_STRUCT(MixedComplementarityProblem) >TYPEDEF_STRUCT(LinearComplementarityProblem) >TYPEDEF_STRUCT(LinearComplementarityProblem_as_ConvexQP) >TYPEDEF_STRUCT(GlobalFrictionContactProblem) >TYPEDEF_STRUCT(RollingFrictionContactProblem) >TYPEDEF_STRUCT(GlobalRollingFrictionContactProblem) >TYPEDEF_STRUCT(GenericMechanicalProblem) >TYPEDEF_STRUCT(listNumericsProblem) >TYPEDEF_STRUCT(FrictionContactProblem_as_VI) >TYPEDEF_STRUCT(FrictionContactProblem_as_ConvexQP) >TYPEDEF_STRUCT(GlobalFrictionContactProblem_as_VI) >TYPEDEF_STRUCT(GlobalFrictionContactProblem_as_ConvexQP) >TYPEDEF_STRUCT(FrictionContactProblem) >TYPEDEF_STRUCT(SplittedFrictionContactProblem) >TYPEDEF_STRUCT(VariationalInequality) >TYPEDEF_STRUCT(AffineVariationalInequalities) >TYPEDEF_STRUCT(ConvexQP) >TYPEDEF_STRUCT(ConvexQP_as_VI) >TYPEDEF_STRUCT(GlobalFrictionContactProblem_balancing_data) >#endif ># 66 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/./NumericsFwd.h" ># 5 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/test/test_pinv.c" 2 >#if 0 /* expanded by -frewrite-includes */ >#include "NumericsMatrix.h" // for NumericsMatrix, NM_clear, NM_new, NM_writ... >#endif /* expanded by -frewrite-includes */ ># 5 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/test/test_pinv.c" ># 1 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/NumericsMatrix.h" 1 >/* Siconos is a program dedicated to modeling, simulation and control > * of non smooth dynamical systems. > * > * Copyright 2024 INRIA. > * > * Licensed under the Apache License, Version 2.0 (the "License"); > * you may not use this file except in compliance with the License. > * You may obtain a copy of the License at > * > * http://www.apache.org/licenses/LICENSE-2.0 > * > * Unless required by applicable law or agreed to in writing, software > * distributed under the License is distributed on an "AS IS" BASIS, > * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. > * See the License for the specific language governing permissions and > * limitations under the License. >*/ > >#ifndef NumericsMatrix_H >#define NumericsMatrix_H > >/*!\file NumericsMatrix.h > \brief Structure definition and functions related to matrix storage in Numerics >*/ > >#if 0 /* expanded by -frewrite-includes */ >#include <assert.h> // for assert >#endif /* expanded by -frewrite-includes */ ># 26 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/NumericsMatrix.h" ># 1 "/usr/include/assert.h" 1 3 4 >/*- > * SPDX-License-Identifier: BSD-3-Clause > * > * 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 > */ > >#if 0 /* expanded by -frewrite-includes */ >#include <sys/cdefs.h> >#endif /* expanded by -frewrite-includes */ ># 39 "/usr/include/assert.h" 3 4 ># 40 "/usr/include/assert.h" 3 4 > >/* > * Unlike other ANSI header files, <assert.h> 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 ># 53 "/usr/include/assert.h" 3 4 >#define _assert(e) assert(e) > >#define assert(e) ((e) ? (void)0 : __assert(__func__, __FILE__, \ > __LINE__, #e)) >#endif /* NDEBUG */ ># 58 "/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 0 /* disabled by -frewrite-includes */ >#if __ISO_C_VISIBLE >= 2011 && !defined(__cplusplus) >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 72 "/usr/include/assert.h" 3 4 >#define static_assert _Static_assert >#endif ># 74 "/usr/include/assert.h" 3 4 > >__BEGIN_DECLS >void __assert(const char *, const char *, int, const char *) __dead2; >__END_DECLS > >#endif /* !_ASSERT_H_ */ ># 80 "/usr/include/assert.h" 3 4 ># 27 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/NumericsMatrix.h" 2 >#if 0 /* expanded by -frewrite-includes */ >#include <stdio.h> // for size_t, FILE, NULL >#endif /* expanded by -frewrite-includes */ ># 27 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/NumericsMatrix.h" ># 28 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/NumericsMatrix.h" >#if 0 /* expanded by -frewrite-includes */ >#include <stdlib.h> // for malloc >#endif /* expanded by -frewrite-includes */ ># 28 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/NumericsMatrix.h" ># 29 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/NumericsMatrix.h" >#if 0 /* expanded by -frewrite-includes */ >#include "CSparseMatrix.h" // for CS_INT, CSparseMatrix >#endif /* expanded by -frewrite-includes */ ># 29 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/NumericsMatrix.h" ># 1 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/CSparseMatrix.h" 1 >/* Copyright 2024 INRIA. > * Siconos is a program dedicated to modeling, simulation and control > * of non smooth dynamical systems. > * Siconos is a free software; you can redistribute it and/or modify > * it under the terms of the GNU Lesser General Public License as published by > * the Free Software Foundation; either version 2 of the License, or > * (at your option) any later version. > * Siconos 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 Lesser General Public License for more details. > * > * You should have received a copy of the GNU Lesser General Public License > * along with Siconos; if not, write to the Free Software > * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA > * > * Contact: Vincent ACARY, siconos-team@lists.gforge.inria.fr > */ > >#ifndef SparseMatrix_H >#define SparseMatrix_H > >#if 0 /* expanded by -frewrite-includes */ >#include <stdio.h> >#endif /* expanded by -frewrite-includes */ ># 23 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/CSparseMatrix.h" ># 24 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/CSparseMatrix.h" > >/*!\file CSparseMatrix.h > Structure definition and functions related to sparse matrix storage in Numerics >*/ > >#if 0 /* expanded by -frewrite-includes */ >#include "SiconosConfig.h" >#endif /* expanded by -frewrite-includes */ ># 29 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/CSparseMatrix.h" ># 1 "/usr/ports/science/siconos/work/.build/SiconosConfig.h" 1 >/** -*- C -*- !! Do not edit this file !! > >SiconosConfig.h is generated by cmake from config.h.cmake >depending on the current configuration, on user options (WITH_...) and on their >availability on your system. >Example : if cmake is executed with WITH_MPI=ON >--> if a proper mpi installation is found on your system, then > SICONOS_HAS_MPI is on and will be defined in this file. >**/ > >#ifndef SICONOSCONFIG_H >#define SICONOSCONFIG_H > >#define WITH_CMAKE > >// -- Siconos components -- >#define HAVE_SICONOS_EXTERNALS >#define HAVE_SICONOS_NUMERICS >#define HAVE_SICONOS_KERNEL >#define HAVE_SICONOS_CONTROL >#define HAVE_SICONOS_MECHANICS >/* #undef HAVE_SICONOS_MECHANISMS */ >#define HAVE_SICONOS_IO > >// -- Global options -- >// openmp required and available - >/* #undef WITH_OPENMP */ >// Fortran sources included in the build - >#define HAS_FORTRAN >// Use c++ to build externals and numerics >/* #undef BUILD_AS_CPP */ >// Which version of C++ was used to compile siconos, needed for swig >//#define SICONOS_CXXVERSION >#define SICONOS_USE_MAP_FOR_HASH >// are int 64 bits longs >#define SICONOS_INT64 > >// use to force 32 bits int when creating numpy array >// Useful to support old scipy version (< 0.14.0) >/* #undef SICONOS_FORCE_NPY_INT32 */ > >// on opensuse 42.3 Stdxx.h, failure with cxx11 and using std::isnan >/* #undef SICONOS_STD_ISNAN_ALREADY_HERE_AND_I_DO_NOT_KNOW_WHY */ > >// -- Blas Lapack config -- >// Where does cblas comes from? >/* #undef HAS_MKL_CBLAS */ >/* #undef HAS_ACCELERATE */ >#define HAS_OpenBLAS >// mkl stuff. >/* #undef WITH_MKL_SPBLAS */ >/* #undef WITH_MKL_PARDISO */ > >// Which Lapack? >/* #undef HAS_MKL_LAPACKE */ >/* #undef HAS_MATLAB_LAPACK */ > >// Which functions are defined in lapack? >// This concerns only functions that are not available in all implementations. >#define HAS_LAPACK_dgesvd >#define HAS_LAPACK_dtrtrs >#define HAS_LAPACK_dgels > > >// -- Optional parts in externals -- >#define HAVE_SORT >#define HAVE_QL0001 >// Some definitions required for boost numeric_bindings >#define BOOST_NUMERIC_BINDINGS_BLAS_CBLAS >#if 0 /* disabled by -frewrite-includes */ >#if defined(HAS_MKL_CBLAS) >#endif >#endif /* disabled by -frewrite-includes */ >#if 0 /* evaluated by -frewrite-includes */ ># 71 "/usr/ports/science/siconos/work/.build/SiconosConfig.h" >#define BOOST_NUMERIC_BINDINGS_BLAS_MKL >#endif ># 73 "/usr/ports/science/siconos/work/.build/SiconosConfig.h" > >// -- Optional solvers and tools for numerics -- >// - Simplex solver - >/* #undef HAVE_MLCPSIMPLEX */ >// LP solver >/* #undef HAS_ONE_LP_SOLVER */ >/* #undef HAS_EXTREME_POINT_ALGO */ >// Gams stuff >/* #undef GAMS_MODELS_SOURCE_DIR */ >/* #undef GAMS_MODELS_SHARE_DIR */ >/* #undef GAMS_DIR */ >/* #undef HAVE_GAMS_C_API */ >// - Path solver - >/* #undef HAVE_PATHFERRIS */ >/* #undef HAVE_PATHVI */ >// umfpack solvers >/* #undef WITH_UMFPACK */ >// SuperLU solvers >/* #undef WITH_SUPERLU */ >/* #undef WITH_SUPERLU_MT */ >/* #undef WITH_SUPERLU_dist */ > >/* #undef WITH_MA57 */ >// - internal timer - >/* #undef HAVE_TIME_H */ >/* #undef HAVE_SYSTIMES_H */ >/* #undef WITH_TIMERS */ >// - mpi part - >/* #undef SICONOS_HAS_MPI */ >/* #undef WITH_MPI4PY */ >// - mumps solver - >/* #undef WITH_MUMPS */ >// - fclib interface - >/* #undef WITH_FCLIB */ >// option in fc problems used to dump some info. >/* #undef DUMP_PROBLEM */ > >// for sha1 signatures >/* #undef WITH_OPENSSL */ > >// factorization debug, need WITH_OPENSSL >/* #undef FACTORIZATION_DEBUG */ > >// -- Optional parts for mechanics -- >#define SICONOS_HAS_BULLET >/* #undef SICONOS_HAS_OpenCASCADE */ > >// -- Optional parts for io -- >/* #undef SICONOS_HAS_VTK */ >/* #undef HAVE_SERIALIZATION */ >/* #undef WITH_SERIALIZATION */ >/* #undef HAVE_GENERATION */ >/* #undef WITH_HDF5 */ > > > >#endif ># 130 "/usr/ports/science/siconos/work/.build/SiconosConfig.h" > ># 30 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/CSparseMatrix.h" 2 > >/* Compile-time assertion: users of SparseMatrix.h must have CS_LONG > * set if and only if SICONOS_INT64 is also set. If it is unset, it is > * set here. */ >#ifdef SICONOS_INT64 >#ifndef CS_LONG >#define CS_LONG >#endif ># 38 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/CSparseMatrix.h" >#else ># 39 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/CSparseMatrix.h" >#ifdef CS_LONG >#error "CS_LONG (set) does not correspond with SICONOS_INT64 (unset)" >#endif ># 42 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/CSparseMatrix.h" >#endif ># 43 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/CSparseMatrix.h" > >#ifndef CS_INT > >/* From cs.h */ >#ifdef CS_LONG >#define CS_INT long >#else ># 50 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/CSparseMatrix.h" >#define CS_INT int >#endif ># 52 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/CSparseMatrix.h" > >/* Treat CXSparse structs as opaque types. Users may #include "cs.h" > * to use them outside Siconos. */ >struct cs_dl_sparse; >struct cs_di_sparse; >struct cs_dl_symbolic; >struct cs_di_symbolic; >struct cs_dl_numeric; >struct cs_di_numeric; >typedef struct cs_dl_symbolic cs_dls; >typedef struct cs_di_symbolic cs_dis; >typedef struct cs_dl_numeric cs_dln; >typedef struct cs_di_numeric cs_din; > >#ifdef SICONOS_INT64 // SWIG gives syntax error for CS_NAME(_sparse) >#ifndef css >#define css cs_dls >#endif ># 70 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/CSparseMatrix.h" >#ifndef csn >#define csn cs_dln >#endif ># 73 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/CSparseMatrix.h" >#else ># 74 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/CSparseMatrix.h" >#ifndef css >#define css cs_dis >#endif ># 77 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/CSparseMatrix.h" >#ifndef csn >#define csn cs_din >#endif ># 80 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/CSparseMatrix.h" >#endif ># 81 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/CSparseMatrix.h" > >#endif ># 83 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/CSparseMatrix.h" > >#ifdef SICONOS_INT64 // SWIG gives syntax error for CS_NAME(_sparse) >typedef struct cs_dl_sparse CSparseMatrix; >#else ># 87 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/CSparseMatrix.h" >typedef struct cs_di_sparse CSparseMatrix; >#endif ># 89 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/CSparseMatrix.h" > > >/* we use csparse from Timothy Davis > > Timothy Davis, > Direct Methods for Sparse Linear Systems, > SIAM, 2006, > ISBN: 0898716136, > LC: QA188.D386. > > matrix in compressed row/column or triplet form : >{ >csi nzmax ; : maximum number of entries >csi m ; : number of rows >csi n ; : number of columns >csi *p ; : compressed: row (size m+1) or column (size n+1) pointers; triplet: row indices (size nz) >csi *i ; : compressed: column or row indices, size nzmax; triplet: column indices (size nz) >double *x ; : numerical values, size nzmax >csi nz ; : # of entries in triplet matrix; >-1 for compressed columns; >-2 for compressed rows > >} > >csi is either int64_t or int32_t and this is controlled at compile time*/ > > >#define NSM_UNKNOWN_ERR(func, orig) \ >fprintf(stderr, #func ": unknown origin %d for sparse matrix\n", orig); > > >#define NSM_NROW_CSR(mat) mat->n >#define NSM_NCOL_CSR(mat) mat->m > >#if 0 /* disabled by -frewrite-includes */ >#if defined(__cplusplus) && !defined(BUILD_AS_CPP) >#endif >#endif /* disabled by -frewrite-includes */ >#if 0 /* evaluated by -frewrite-includes */ ># 124 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/CSparseMatrix.h" >extern "C" >{ >#endif ># 127 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/CSparseMatrix.h" > > /** Information used and produced by CSparse for an LU factorization*/ > typedef struct { > CS_INT n; /**< size of linear system */ > css* S; /**< symbolic analysis */ > csn* N; /**< numerics factorization */ > } CSparseMatrix_factors; > > /** compute a LU factorization of A and store it in a workspace > * > * \param order control if ordering is used > * \param A the sparse matrix > * \param tol the tolerance > * \param cs_lu_A the parameter structure that eventually holds the factors > * \return 1 if the factorization was successful, 1 otherwise > */ > int CSparseMatrix_lu_factorization(CS_INT order, const CSparseMatrix *A, double tol, CSparseMatrix_factors * cs_lu_A); > > /** compute a Cholesky factorization of A and store it in a workspace > * > * \param order control if ordering is used > * \param A the sparse matrix > * \param cs_chol_A the parameter structure that eventually holds the factors > * \return 1 if the factorization was successful, 1 otherwise > */ > int CSparseMatrix_chol_factorization(CS_INT order, const CSparseMatrix *A, CSparseMatrix_factors * cs_chol_A); > > /** compute a LDLT factorization of A and store it in a workspace > * > * \param order control if ordering is used > * \param A the sparse matrix > * \param cs_ldlt_A the parameter structure that eventually holds the factors > * \return 1 if the factorization was successful, 1 otherwise > */ > int CSparseMatrix_ldlt_factorization(CS_INT order, const CSparseMatrix *A, CSparseMatrix_factors * cs_ldlt_A); > > /** reuse a LU factorization (stored in the cs_lu_A) to solve a linear system Ax = b > * > * \param cs_lu_A contains the LU factors of A, permutation information > * \param x workspace > * \param[in,out] b on input RHS of the linear system; on output the solution > * \return 0 if failed, 1 otherwise*/ > CS_INT CSparseMatrix_solve(CSparseMatrix_factors* cs_lu_A, double* x, double *b); > > /** reuse a LU factorization (stored in the cs_lu_A) to solve a linear system Ax = B > * with a sparse r.h.s > * > * \param cs_lu_A contains the LU factors of A, permutation information > * \param X a csc sparse matrix workspace > * \param[in,out] B on input sparse RHS of the linear system; on output the solution > * \return 0 if failed, 1 otherwise*/ > CS_INT CSparseMatrix_spsolve(CSparseMatrix_factors* cs_lu_A, CSparseMatrix* X, CSparseMatrix* B); > > /** reuse a Cholesky factorization (stored in the cs_chol_A) to solve a linear system Ax = b > * > * \param cs_chol_A contains the Cholesky factors of A, permutation information > * \param x workspace > * \param[in,out] b on input RHS of the linear system; on output the solution > * \return 0 if failed, 1 otherwise*/ > CS_INT CSparseMatrix_chol_solve(CSparseMatrix_factors* cs_chol_A, double* x, double *b); > > /** reuse a Cholesky factorization (stored in the cs_chol_A) to solve a linear system Ax = B > * with a sparse r.h.s > * > * \param cs_chol_A contains the Cholesky factors of A, permutation information > * \param X a csc sparse matrix workspace > * \param[in,out] b on input sparse RHS of the linear system; on output the solution > * \return 0 if failed, 1 otherwise*/ > CS_INT CSparseMatrix_chol_spsolve(CSparseMatrix_factors* cs_chol_A, CSparseMatrix* X, CSparseMatrix* B); > > /** reuse a LDLT factorization (stored in the cs_ldlt_A) to solve a linear system Ax = b > * > * \param cs_ldlt_A contains the LDLT factors of A, permutation information > * \param x workspace > * \param[in,out] b on input RHS of the linear system; on output the solution > * \return 0 if failed, 1 otherwise*/ > CS_INT CSparseMatrix_ldlt_solve(CSparseMatrix_factors* cs_ldlt_A, double* x, double *b); > > /** Free a workspace related to a LU factorization > * > * \param cs_lu_A the structure to free > */ > void CSparseMatrix_free_lu_factors(CSparseMatrix_factors* cs_lu_A); > > /** Matrix vector multiplication : y = alpha*A*x+beta*y > * > * \param[in] alpha matrix coefficient > * \param[in] A the sparse matrix > * \param[in] x pointer on a dense vector of size A->n > * \param[in] beta vector coefficient > * \param[in, out] y pointer on a dense vector of size A->n > * \return 0 if A x or y is NULL else 1 > */ > int CSparseMatrix_aaxpby(const double alpha, const CSparseMatrix *A, const double *x, > const double beta, double *y); > > /** Allocate a CSparse matrix for future copy (as in NSM_copy) > * > * \param m the matrix used as model > * \return an newly allocated matrix > */ > CSparseMatrix* CSparseMatrix_alloc_for_copy(const CSparseMatrix* const m); > > CS_INT CSparseMatrix_to_dense(const CSparseMatrix* const A, double * B); > > /** print a matrix to std output > * > * \param A matrix to print > * \param brief if positive, print only a portion of the matrix > */ > int CSparseMatrix_print(const CSparseMatrix *A, int brief); > > /** print a matrix to a text file > * > * \param A matrix to print > * \param brief if positive, print only a portion of the matrix > * \param file file descriptor*/ > int CSparseMatrix_print_in_file(const CSparseMatrix *A, int brief, FILE* file); > > int CSparseMatrix_print_in_Matlab_file(const CSparseMatrix *A, int brief, FILE* file); > > CSparseMatrix * CSparseMatrix_new_from_file(FILE* file); > > /** Add an entry to a triplet matrix only if the absolute value is > * greater than threshold > * > * \param T the sparse matrix > * \param i row index > * \param j column index > * \param x the value > * \return integer value : 1 if the absolute value is less than > * DBL_EPSILON, otherwise the return value of cs_entry. > */ > CS_INT CSparseMatrix_zentry(CSparseMatrix *T, CS_INT i, CS_INT j, double x, double threshold); > > /* add a block (col-major dense) to triplet matrix only if value is not (nearly) null */ > CS_INT CSparseMatrix_block_dense_zentry(CSparseMatrix *T, CS_INT row_off, CS_INT col_off, double * x, CS_INT row_size, CS_INT col_size, double threshold); > > /** Add an entry to a symmetric triplet matrix only if the absolute value is > * greater than threshold > * > * \param T the sparse matrix > * \param i row index > * \param j column index > * \param x the value > * \return integer value : 1 if the absolute value is less than > * DBL_EPSILON, otherwise the return value of cs_entry. > */ > CS_INT CSparseMatrix_symmetric_zentry(CSparseMatrix *T, CS_INT i, CS_INT j, double x, double threshold); > > /** Add an entry to a triplet matrix > * > * \param T the sparse matrix > * \param i row index > * \param j column index > * \param x the value > */ > CS_INT CSparseMatrix_entry(CSparseMatrix *T, CS_INT i, CS_INT j, double x); > > /** Add an entry to a symmetric triplet matrix > * > * \param T the sparse matrix > * \param i row index > * \param j column index > * \param x the value > */ > CS_INT CSparseMatrix_symmetric_entry(CSparseMatrix *T, CS_INT i, CS_INT j, double x); > > /** Check if the given triplet matrix is properly constructed (col and row indices are correct) > * > * \param T the sparse matrix to check > * \return 0 if the matrix is fine, 1 otherwise > */ > int CSparseMatrix_check_triplet(CSparseMatrix *T); > > /** Check if the given triplet matrix is properly constructed (col and row indices are correct) > * > * \param T the sparse matrix to check > * \return 0 if the matrix is fine, 1 otherwise > */ > int CSparseMatrix_check_csc(CSparseMatrix *T); > > /** Free space allocated for a SparseMatrix. note : cs_spfree also > * free the cs_struct this fails when the struct is allocated on > * the stack. > * > * \param A the sparse matrix > * \return NULL on success > */ > CSparseMatrix* CSparseMatrix_spfree_on_stack(CSparseMatrix* A); > > /** Copy a CSparseMatrix inside another CSparseMatrix. > * Reallocations are performed if B cannot hold a copy of A > * > * \param[in] A a CSparseMatrix > * \param[in,out] B a CSparseMatrix > */ > void CSparseMatrix_copy(const CSparseMatrix* const A, CSparseMatrix* B); > > /** Multiply a matrix with a double alpha*A --> A > * > * \param alpha the coefficient > * \param A the matrix > */ > int CSparseMatrix_scal(const double alpha, const CSparseMatrix *A); > > > /** Return the element A(i,j) > * > * \param A the sparse matrix > * \param i the row index > * \param j the column index > */ > double CSparseMatrix_get_value(const CSparseMatrix *A, CS_INT i, CS_INT j); > > /** print a matrix to a text file in pyhton format > * > * \param m matrix to print > * \param file file descriptor*/ > void CSparseMatrix_write_in_file_python(const CSparseMatrix* const m, FILE* file); > > /** Compute the max by columns of a sparse matrix > * > * \param A the sparse matrix > * \param max the vector of maximum by columns > * \param j the column index > */ > int CSparseMatrix_max_by_columns(const CSparseMatrix *A, double * max); > > /** Compute the max in absolute value by columns of a sparse matrix > * > * \param A the sparse matrix > * \param max the vector of maximum by columns > * \param j the column index > */ > int CSparseMatrix_max_abs_by_columns(const CSparseMatrix *A, double * max); > >#if 0 /* disabled by -frewrite-includes */ >#if defined(__cplusplus) && !defined(BUILD_AS_CPP) >#endif >#endif /* disabled by -frewrite-includes */ >#if 0 /* evaluated by -frewrite-includes */ ># 365 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/CSparseMatrix.h" >} >#endif ># 367 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/CSparseMatrix.h" > >#endif ># 369 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/CSparseMatrix.h" ># 30 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/NumericsMatrix.h" 2 >#if 0 /* expanded by -frewrite-includes */ >#include "NumericsFwd.h" // for NumericsMatrix, NumericsSparseMatrix, Spa... >#endif /* expanded by -frewrite-includes */ ># 30 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/NumericsMatrix.h" ># 31 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/NumericsMatrix.h" >#if 0 /* expanded by -frewrite-includes */ >#include "NumericsDataVersion.h" // Versioning >#endif /* expanded by -frewrite-includes */ ># 31 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/NumericsMatrix.h" ># 1 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/NumericsDataVersion.h" 1 >/* Siconos is a program dedicated to modeling, simulation and control > * of non smooth dynamical systems. > * > * Copyright 2024 INRIA. > * > * Licensed under the Apache License, Version 2.0 (the "License"); > * you may not use this file except in compliance with the License. > * You may obtain a copy of the License at > * > * http://www.apache.org/licenses/LICENSE-2.0 > * > * Unless required by applicable law or agreed to in writing, software > * distributed under the License is distributed on an "AS IS" BASIS, > * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. > * See the License for the specific language governing permissions and > * limitations under the License. >*/ >#ifndef NumericsDataVersion_h >#define NumericsDataVersion_h > >#if 0 /* expanded by -frewrite-includes */ >#include <limits.h> >#endif /* expanded by -frewrite-includes */ ># 21 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/NumericsDataVersion.h" ># 1 "/usr/include/limits.h" 1 3 4 >/*- > * SPDX-License-Identifier: BSD-3-Clause > * > * 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. > * 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. > * > * @(#)limits.h 8.2 (Berkeley) 1/4/94 > */ > >#ifndef _LIMITS_H_ >#define _LIMITS_H_ > >#if 0 /* expanded by -frewrite-includes */ >#include <sys/cdefs.h> >#endif /* expanded by -frewrite-includes */ ># 37 "/usr/include/limits.h" 3 4 ># 38 "/usr/include/limits.h" 3 4 > >#if 0 /* disabled by -frewrite-includes */ >#if __POSIX_VISIBLE >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 40 "/usr/include/limits.h" 3 4 >#define _POSIX_ARG_MAX 4096 >#define _POSIX_LINK_MAX 8 >#define _POSIX_MAX_CANON 255 >#define _POSIX_MAX_INPUT 255 >#define _POSIX_NAME_MAX 14 >#define _POSIX_PIPE_BUF 512 >#define _POSIX_SSIZE_MAX 32767 >#define _POSIX_STREAM_MAX 8 > >#if 0 /* disabled by -frewrite-includes */ >#if __POSIX_VISIBLE >= 200112 >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 50 "/usr/include/limits.h" 3 4 >#define _POSIX_CHILD_MAX 25 >#define _POSIX_NGROUPS_MAX 8 >#define _POSIX_OPEN_MAX 20 >#define _POSIX_PATH_MAX 256 >#define _POSIX_TZNAME_MAX 6 >#else ># 56 "/usr/include/limits.h" 3 4 >#define _POSIX_CHILD_MAX 6 >#define _POSIX_NGROUPS_MAX 0 >#define _POSIX_OPEN_MAX 16 >#define _POSIX_PATH_MAX 255 >#define _POSIX_TZNAME_MAX 3 >#endif ># 62 "/usr/include/limits.h" 3 4 > >#if 0 /* disabled by -frewrite-includes */ >#if __POSIX_VISIBLE >= 200112 >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 64 "/usr/include/limits.h" 3 4 >#define BC_BASE_MAX 99 /* max ibase/obase values in bc(1) */ >#define BC_DIM_MAX 2048 /* max array elements in bc(1) */ >#define BC_SCALE_MAX 99 /* max scale value in bc(1) */ >#define BC_STRING_MAX 1000 /* max const string length in bc(1) */ >#define CHARCLASS_NAME_MAX 14 /* max character class name size */ >#define COLL_WEIGHTS_MAX 10 /* max weights for order keyword */ >#define EXPR_NEST_MAX 32 /* max expressions nested in expr(1) */ >#define LINE_MAX 2048 /* max bytes in an input line */ >#define RE_DUP_MAX 255 /* max RE's in interval notation */ > >#define _POSIX2_BC_BASE_MAX 99 >#define _POSIX2_BC_DIM_MAX 2048 >#define _POSIX2_BC_SCALE_MAX 99 >#define _POSIX2_BC_STRING_MAX 1000 >#define _POSIX2_CHARCLASS_NAME_MAX 14 >#define _POSIX2_COLL_WEIGHTS_MAX 2 >#define _POSIX2_EQUIV_CLASS_MAX 2 >#define _POSIX2_EXPR_NEST_MAX 32 >#define _POSIX2_LINE_MAX 2048 >#define _POSIX2_RE_DUP_MAX 255 >#endif ># 85 "/usr/include/limits.h" 3 4 >#endif ># 86 "/usr/include/limits.h" 3 4 > >#if 0 /* disabled by -frewrite-includes */ >#if __POSIX_VISIBLE >= 199309 >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 88 "/usr/include/limits.h" 3 4 >#define _POSIX_AIO_LISTIO_MAX 2 >#define _POSIX_AIO_MAX 1 >#define _POSIX_DELAYTIMER_MAX 32 >#define _POSIX_MQ_OPEN_MAX 8 >#define _POSIX_MQ_PRIO_MAX 32 >#define _POSIX_RTSIG_MAX 8 >#define _POSIX_SEM_NSEMS_MAX 256 >#define _POSIX_SEM_VALUE_MAX 32767 >#define _POSIX_SIGQUEUE_MAX 32 >#define _POSIX_TIMER_MAX 32 > >#define _POSIX_CLOCKRES_MIN 20000000 >#endif ># 101 "/usr/include/limits.h" 3 4 > >#if 0 /* disabled by -frewrite-includes */ >#if __POSIX_VISIBLE >= 199506 >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 103 "/usr/include/limits.h" 3 4 >#define _POSIX_THREAD_DESTRUCTOR_ITERATIONS 4 >#define _POSIX_THREAD_KEYS_MAX 128 >#define _POSIX_THREAD_THREADS_MAX 64 >#endif ># 107 "/usr/include/limits.h" 3 4 > >#if 0 /* disabled by -frewrite-includes */ >#if __POSIX_VISIBLE >= 200112 >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 109 "/usr/include/limits.h" 3 4 >#define _POSIX_HOST_NAME_MAX 255 >#define _POSIX_LOGIN_NAME_MAX 9 >#define _POSIX_SS_REPL_MAX 4 >#define _POSIX_SYMLINK_MAX 255 >#define _POSIX_SYMLOOP_MAX 8 >#define _POSIX_TRACE_EVENT_NAME_MAX 30 >#define _POSIX_TRACE_NAME_MAX 8 >#define _POSIX_TRACE_SYS_MAX 8 >#define _POSIX_TRACE_USER_EVENT_MAX 32 >#define _POSIX_TTY_NAME_MAX 9 > >#define _POSIX_RE_DUP_MAX _POSIX2_RE_DUP_MAX >#endif ># 122 "/usr/include/limits.h" 3 4 > >#if 0 /* disabled by -frewrite-includes */ >#if __XSI_VISIBLE || __POSIX_VISIBLE >= 200809 >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 124 "/usr/include/limits.h" 3 4 >#define NL_ARGMAX 4096 /* max # of position args for printf */ >#define NL_MSGMAX 32767 >#define NL_SETMAX 255 >#define NL_TEXTMAX 2048 >#endif ># 129 "/usr/include/limits.h" 3 4 > >#if 0 /* disabled by -frewrite-includes */ >#if __XSI_VISIBLE >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 131 "/usr/include/limits.h" 3 4 >#define _XOPEN_IOV_MAX 16 >#define _XOPEN_NAME_MAX 255 >#define _XOPEN_PATH_MAX 1024 >#define PASS_MAX 128 /* _PASSWORD_LEN from <pwd.h> */ > >#define NL_LANGMAX 31 /* max LANG name length */ >#define NL_NMAX 1 >#endif ># 139 "/usr/include/limits.h" 3 4 > >#define MB_LEN_MAX 6 /* 31-bit UTF-8 */ > >#if 0 /* expanded by -frewrite-includes */ >#include <sys/limits.h> >#endif /* expanded by -frewrite-includes */ ># 142 "/usr/include/limits.h" 3 4 ># 1 "/usr/include/sys/limits.h" 1 3 4 >/*- > * SPDX-License-Identifier: BSD-3-Clause > * > * 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. > * 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. > */ > >#ifndef _SYS_LIMITS_H_ >#define _SYS_LIMITS_H_ > >#if 0 /* expanded by -frewrite-includes */ >#include <sys/cdefs.h> >#endif /* expanded by -frewrite-includes */ ># 35 "/usr/include/sys/limits.h" 3 4 ># 36 "/usr/include/sys/limits.h" 3 4 >#if 0 /* expanded by -frewrite-includes */ >#include <machine/_limits.h> >#endif /* expanded by -frewrite-includes */ ># 36 "/usr/include/sys/limits.h" 3 4 ># 1 "/usr/include/machine/_limits.h" 1 3 4 >/*- > * This file is in the public domain. > */ > >#if 0 /* expanded by -frewrite-includes */ >#include <x86/_limits.h> >#endif /* expanded by -frewrite-includes */ ># 5 "/usr/include/machine/_limits.h" 3 4 ># 6 "/usr/include/machine/_limits.h" 3 4 ># 37 "/usr/include/sys/limits.h" 2 3 4 > >#define CHAR_BIT __CHAR_BIT /* number of bits in a char */ > >#define SCHAR_MAX __SCHAR_MAX /* max value for a signed char */ >#define SCHAR_MIN __SCHAR_MIN /* min value for a signed char */ > >#define UCHAR_MAX __UCHAR_MAX /* max value for an unsigned char */ > >#ifdef __CHAR_UNSIGNED__ >#define CHAR_MAX UCHAR_MAX /* max value for a char */ >#define CHAR_MIN 0 /* min value for a char */ >#else ># 49 "/usr/include/sys/limits.h" 3 4 >#define CHAR_MAX SCHAR_MAX >#define CHAR_MIN SCHAR_MIN >#endif ># 52 "/usr/include/sys/limits.h" 3 4 > >#define USHRT_MAX __USHRT_MAX /* max value for an unsigned short */ >#define SHRT_MAX __SHRT_MAX /* max value for a short */ >#define SHRT_MIN __SHRT_MIN /* min value for a short */ > >#define UINT_MAX __UINT_MAX /* max value for an unsigned int */ >#define INT_MAX __INT_MAX /* max value for an int */ >#define INT_MIN __INT_MIN /* min value for an int */ > >#define ULONG_MAX __ULONG_MAX /* max for an unsigned long */ >#define LONG_MAX __LONG_MAX /* max for a long */ >#define LONG_MIN __LONG_MIN /* min for a long */ > >#ifdef __LONG_LONG_SUPPORTED >#define ULLONG_MAX __ULLONG_MAX /* max for an unsigned long long */ >#define LLONG_MAX __LLONG_MAX /* max for a long long */ >#define LLONG_MIN __LLONG_MIN /* min for a long long */ >#endif ># 70 "/usr/include/sys/limits.h" 3 4 > >#if 0 /* disabled by -frewrite-includes */ >#if __POSIX_VISIBLE || __XSI_VISIBLE >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 72 "/usr/include/sys/limits.h" 3 4 >#define SSIZE_MAX __SSIZE_MAX /* max value for an ssize_t */ >#endif ># 74 "/usr/include/sys/limits.h" 3 4 > >#if 0 /* disabled by -frewrite-includes */ >#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 76 "/usr/include/sys/limits.h" 3 4 >#define SIZE_T_MAX __SIZE_T_MAX /* max value for a size_t */ > >#define OFF_MAX __OFF_MAX /* max value for an off_t */ >#define OFF_MIN __OFF_MIN /* min value for an off_t */ >#endif ># 81 "/usr/include/sys/limits.h" 3 4 > >#if 0 /* disabled by -frewrite-includes */ >#if __BSD_VISIBLE >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 83 "/usr/include/sys/limits.h" 3 4 >#define GID_MAX UINT_MAX /* max value for a gid_t */ >#define UID_MAX UINT_MAX /* max value for a uid_t */ > >#define UQUAD_MAX (__UQUAD_MAX) /* max value for a uquad_t */ >#define QUAD_MAX (__QUAD_MAX) /* max value for a quad_t */ >#define QUAD_MIN (__QUAD_MIN) /* min value for a quad_t */ >#endif ># 90 "/usr/include/sys/limits.h" 3 4 > >#if 0 /* disabled by -frewrite-includes */ >#if __XSI_VISIBLE || __POSIX_VISIBLE >= 200809 >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 92 "/usr/include/sys/limits.h" 3 4 >#define LONG_BIT __LONG_BIT >#define WORD_BIT __WORD_BIT >#endif ># 95 "/usr/include/sys/limits.h" 3 4 > >#if 0 /* disabled by -frewrite-includes */ >#if __POSIX_VISIBLE >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 97 "/usr/include/sys/limits.h" 3 4 >#define MQ_PRIO_MAX 64 >#endif ># 99 "/usr/include/sys/limits.h" 3 4 > >#endif /* !_SYS_LIMITS_H_ */ ># 101 "/usr/include/sys/limits.h" 3 4 ># 143 "/usr/include/limits.h" 2 3 4 > >#if 0 /* disabled by -frewrite-includes */ >#if __POSIX_VISIBLE >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 145 "/usr/include/limits.h" 3 4 >#if 0 /* expanded by -frewrite-includes */ >#include <sys/syslimits.h> >#endif /* expanded by -frewrite-includes */ ># 145 "/usr/include/limits.h" 3 4 ># 1 "/usr/include/sys/syslimits.h" 1 3 4 >/*- > * SPDX-License-Identifier: BSD-3-Clause > * > * 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. > * 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. > * > * @(#)syslimits.h 8.1 (Berkeley) 6/2/93 > */ > >#ifndef _SYS_SYSLIMITS_H_ >#define _SYS_SYSLIMITS_H_ > >#if 0 /* disabled by -frewrite-includes */ >#if !defined(_STANDALONE) && !defined(_KERNEL) && !defined(_LIMITS_H_) && !defined(_SYS_PARAM_H_) >#endif >#endif /* disabled by -frewrite-includes */ >#if 0 /* evaluated by -frewrite-includes */ ># 38 "/usr/include/sys/syslimits.h" 3 4 >#warning "No user-serviceable parts inside." >#endif ># 40 "/usr/include/sys/syslimits.h" 3 4 > >/* > * Do not add any new variables here. (See the comment at the end of > * the file for why.) > */ >#ifndef __ILP32__ >#define ARG_MAX (2 * 256 * 1024) /* max bytes for an exec function */ >#else ># 48 "/usr/include/sys/syslimits.h" 3 4 >#define ARG_MAX (256 * 1024) /* max bytes for KVA-starved archs */ >#endif ># 50 "/usr/include/sys/syslimits.h" 3 4 >#ifndef CHILD_MAX >#define CHILD_MAX 40 /* max simultaneous processes */ >#endif ># 53 "/usr/include/sys/syslimits.h" 3 4 >#define MAX_CANON 255 /* max bytes in term canon input line */ >#define MAX_INPUT 255 /* max bytes in terminal input */ >#define NAME_MAX 255 /* max bytes in a file name */ >#ifndef NGROUPS_MAX >#define NGROUPS_MAX 1023 /* max supplemental group id's */ >#endif ># 59 "/usr/include/sys/syslimits.h" 3 4 >#ifndef OPEN_MAX >#define OPEN_MAX 64 /* max open files per process */ >#endif ># 62 "/usr/include/sys/syslimits.h" 3 4 >#define PATH_MAX 1024 /* max bytes in pathname */ >#define PIPE_BUF 512 /* max bytes for atomic pipe writes */ >#define IOV_MAX 1024 /* max elements in i/o vector */ > >/* > * We leave the following values undefined to force applications to either > * assume conservative values or call sysconf() to get the current value. > * > * HOST_NAME_MAX > * > * (We should do this for most of the values currently defined here, > * but many programs are not prepared to deal with this yet.) > */ >#endif ># 76 "/usr/include/sys/syslimits.h" 3 4 ># 146 "/usr/include/limits.h" 2 3 4 >#endif ># 147 "/usr/include/limits.h" 3 4 > >#endif /* !_LIMITS_H_ */ ># 149 "/usr/include/limits.h" 3 4 ># 22 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/NumericsDataVersion.h" 2 >#if 0 /* expanded by -frewrite-includes */ >#include <stdint.h> >#endif /* expanded by -frewrite-includes */ ># 22 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/NumericsDataVersion.h" ># 1 "/usr/include/stdint.h" 1 3 4 >/*- > * SPDX-License-Identifier: BSD-2-Clause > * > * Copyright (c) 2001 Mike Barcroft <mike@FreeBSD.org> > * 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. > */ > >#ifndef _SYS_STDINT_H_ >#define _SYS_STDINT_H_ > >#if 0 /* expanded by -frewrite-includes */ >#include <sys/cdefs.h> >#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 <sys/_types.h> >#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 <machine/_stdint.h> >#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. > */ > >#if 0 /* expanded by -frewrite-includes */ >#include <x86/_stdint.h> >#endif /* expanded by -frewrite-includes */ ># 5 "/usr/include/machine/_stdint.h" 3 4 ># 1 "/usr/include/x86/_stdint.h" 1 3 4 >/*- > * SPDX-License-Identifier: BSD-4-Clause > * > * Copyright (c) 2001, 2002 Mike Barcroft <mike@FreeBSD.org> > * 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. > */ > >#ifndef _MACHINE__STDINT_H_ >#define _MACHINE__STDINT_H_ > >#if 0 /* disabled by -frewrite-includes */ >#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 44 "/usr/include/x86/_stdint.h" 3 4 > >#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 0 /* disabled by -frewrite-includes */ >#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 67 "/usr/include/x86/_stdint.h" 3 4 > >/* > * 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 INT64_MIN >#define SIG_ATOMIC_MAX INT64_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 ># 6 "/usr/include/machine/_stdint.h" 2 3 4 ># 36 "/usr/include/stdint.h" 2 3 4 >#if 0 /* expanded by -frewrite-includes */ >#include <sys/_stdint.h> >#endif /* expanded by -frewrite-includes */ ># 36 "/usr/include/stdint.h" 3 4 ># 1 "/usr/include/sys/_stdint.h" 1 3 4 >/*- > * SPDX-License-Identifier: BSD-2-Clause > * > * Copyright (c) 2011 David E. O'Brien <obrien@FreeBSD.org> > * Copyright (c) 2001 Mike Barcroft <mike@FreeBSD.org> > * 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. > */ > >#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 >#ifndef _INTMAX_T_DECLARED >typedef __intmax_t intmax_t; >#define _INTMAX_T_DECLARED >#endif ># 85 "/usr/include/sys/_stdint.h" 3 4 >#ifndef _UINTMAX_T_DECLARED >typedef __uintmax_t uintmax_t; >#define _UINTMAX_T_DECLARED >#endif ># 89 "/usr/include/sys/_stdint.h" 3 4 > >#endif /* !_SYS__STDINT_H_ */ ># 91 "/usr/include/sys/_stdint.h" 3 4 ># 37 "/usr/include/stdint.h" 2 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; > >/* GNU and Darwin define this and people seem to think it's portable */ >#if 0 /* disabled by -frewrite-includes */ >#if defined(UINTPTR_MAX) && defined(UINT64_MAX) && (UINTPTR_MAX == UINT64_MAX) >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 60 "/usr/include/stdint.h" 3 4 >#define __WORDSIZE 64 >#else ># 62 "/usr/include/stdint.h" 3 4 >#define __WORDSIZE 32 >#endif ># 64 "/usr/include/stdint.h" 3 4 > >/* Limits of wchar_t. */ >#define WCHAR_MIN __WCHAR_MIN >#define WCHAR_MAX __WCHAR_MAX > >#if 0 /* disabled by -frewrite-includes */ >#if __EXT1_VISIBLE >#endif >#endif /* disabled by -frewrite-includes */ >#if 1 /* evaluated by -frewrite-includes */ ># 70 "/usr/include/stdint.h" 3 4 >/* ISO/IEC 9899:2011 K.3.4.4 */ >#ifndef RSIZE_MAX >#define RSIZE_MAX (SIZE_MAX >> 1) >#endif ># 74 "/usr/include/stdint.h" 3 4 >#endif /* __EXT1_VISIBLE */ ># 75 "/usr/include/stdint.h" 3 4 > >#endif /* !_SYS_STDINT_H_ */ ># 77 "/usr/include/stdint.h" 3 4 ># 23 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/NumericsDataVersion.h" 2 >#if 0 /* expanded by -frewrite-includes */ >#include <assert.h> >#endif /* expanded by -frewrite-includes */ ># 23 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/NumericsDataVersion.h" ># 1 "/usr/include/assert.h" 1 3 4 >/*- > * SPDX-License-Identifier: BSD-3-Clause > * > * 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 > */ > >#if 0 /* expanded by -frewrite-includes */ >#include <sys/cdefs.h> >#endif /* expanded by -frewrite-includes */ ># 39 "/usr/include/assert.h" 3 4 ># 40 "/usr/include/assert.h" 3 4 > >/* > * Unlike other ANSI header files, <assert.h> 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 ># 53 "/usr/include/assert.h" 3 4 >#define _assert(e) assert(e) > >#define assert(e) ((e) ? (void)0 : __assert(__func__, __FILE__, \ > __LINE__, #e)) >#endif /* NDEBUG */ ># 58 "/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 0 /* disabled by -frewrite-includes */ >#if __ISO_C_VISIBLE >= 2011 && !defined(__cplusplus) >#endif >#endif /* disabled by -frewrite-includes */ >#if 0 /* evaluated by -frewrite-includes */ ># 72 "/usr/include/assert.h" 3 4 >#define static_assert _Static_assert >#endif ># 74 "/usr/include/assert.h" 3 4 > >__BEGIN_DECLS >void __assert(const char *, const char *, int, const char *) __dead2; >__END_DECLS > >#endif /* !_ASSERT_H_ */ ># 80 "/usr/include/assert.h" 3 4 ># 24 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/NumericsDataVersion.h" 2 > >typedef uint64_t version_t; > >/** \struct DataVersioning data */ >typedef struct >{ > version_t number; >} NumericsDataVersion; > >static inline version_t NDV_value(const NumericsDataVersion* v) >{ > return v->number; >} > >static inline void NDV_set_value(NumericsDataVersion* v, version_t value) >{ > v->number = value; >} > >static inline void NDV_reset(NumericsDataVersion* v) >{ > v->number = 0; >} > >static inline void NDV_inc(NumericsDataVersion* v) >{ > assert (v->number < UINT64_MAX); > v->number += 1; >} > >#if 0 /* disabled by -frewrite-includes */ >#if defined(__cplusplus) && !defined(BUILD_AS_CPP) >#endif >#endif /* disabled by -frewrite-includes */ >#if 0 /* evaluated by -frewrite-includes */ ># 55 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/NumericsDataVersion.h" >extern "C" >{ >#endif ># 58 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/NumericsDataVersion.h" > >#if 0 /* disabled by -frewrite-includes */ >#if defined(__cplusplus) && !defined(BUILD_AS_CPP) >#endif >#endif /* disabled by -frewrite-includes */ >#if 0 /* evaluated by -frewrite-includes */ ># 60 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/NumericsDataVersion.h" >} >#endif ># 62 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/NumericsDataVersion.h" > >#endif ># 64 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/NumericsDataVersion.h" > > ># 32 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/NumericsMatrix.h" 2 >#if 0 /* expanded by -frewrite-includes */ >#include "NumericsSparseMatrix.h" // for NSM_linear_solver typedef >#endif /* expanded by -frewrite-includes */ ># 32 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/NumericsMatrix.h" ># 1 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/NumericsSparseMatrix.h" 1 >/* Siconos is a program dedicated to modeling, simulation and control > * of non smooth dynamical systems. > * > * Copyright 2024 INRIA. > * > * Licensed under the Apache License, Version 2.0 (the "License"); > * you may not use this file except in compliance with the License. > * You may obtain a copy of the License at > * > * http://www.apache.org/licenses/LICENSE-2.0 > * > * Unless required by applicable law or agreed to in writing, software > * distributed under the License is distributed on an "AS IS" BASIS, > * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. > * See the License for the specific language governing permissions and > * limitations under the License. >*/ > >#ifndef NumericsSparseMatrix_H >#define NumericsSparseMatrix_H > >/*!\file NumericsSparseMatrix.h > * Data structures and functions for sparse matrices > * > */ > >#if 0 /* expanded by -frewrite-includes */ >#include <stdio.h> // for size_t, FILE >#endif /* expanded by -frewrite-includes */ ># 27 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/NumericsSparseMatrix.h" ># 28 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/NumericsSparseMatrix.h" >#if 0 /* expanded by -frewrite-includes */ >#include "CSparseMatrix.h" // for CSparseMatrix, CS_INT >#endif /* expanded by -frewrite-includes */ ># 28 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/NumericsSparseMatrix.h" ># 29 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/NumericsSparseMatrix.h" >#if 0 /* expanded by -frewrite-includes */ >#include "NumericsFwd.h" // for NumericsSparseMatrix, NSM_linear_solver_p... >#endif /* expanded by -frewrite-includes */ ># 29 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/NumericsSparseMatrix.h" ># 30 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/NumericsSparseMatrix.h" >#if 0 /* expanded by -frewrite-includes */ >#include "SiconosConfig.h" // for BUILD_AS_CPP // IWYU pragma: keep >#endif /* expanded by -frewrite-includes */ ># 30 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/NumericsSparseMatrix.h" ># 31 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/NumericsSparseMatrix.h" > >#if 0 /* expanded by -frewrite-includes */ >#include "NumericsDataVersion.h" >#endif /* expanded by -frewrite-includes */ ># 32 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/NumericsSparseMatrix.h" ># 33 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/NumericsSparseMatrix.h" > >/**\struct linalg_data_t NumericsSparseMatrix.h > * generic data struct for linear algebra operations > */ >typedef struct linalg_data_t >{ > int id; > void (*free_fn)(struct linalg_data_t*); >} linalg_data_t; > >typedef enum { SN_LINALG_UNKNOWN, SN_LINALG_MKL } linalg_data_id; > >#if 0 /* disabled by -frewrite-includes */ >#if defined(__cplusplus) && !defined(BUILD_AS_CPP) >#endif >#endif /* disabled by -frewrite-includes */ >#if 0 /* evaluated by -frewrite-includes */ ># 46 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/NumericsSparseMatrix.h" >extern "C" >{ >#endif ># 49 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/NumericsSparseMatrix.h" > > > /** \enum NSM_linear_solver NumericsSparseMatrix.h > * id for linear algebra solvers */ > typedef enum { NSM_CSPARSE, NSM_MUMPS, NSM_UMFPACK, NSM_MKL_PARDISO, NSM_SUPERLU, NSM_SUPERLU_MT, NSM_HSL } NSM_linear_solver; > > typedef void (*freeNSLSP)(void* p); > > /** \enum NumericsSparseTypesNZ > * value of nz for some matrix storage type */ > typedef enum { NSM_CS_CSC = -1, NSM_CS_CSR = -2 } NumericsSparseTypesNZ; > > /** \struct NSM_linear_solver_params NumericsSparseMatrix.h > * solver-specific parameters*/ > struct NSM_linear_solver_params > { > > NumericsMatrix * parent_matrix; > NSM_linear_solver solver; > NSM_linear_solver LDLT_solver; > > void* linear_solver_data; /**< solver-specific data (or workspace) */ > freeNSLSP solver_free_hook; /**< solver-specific hook to free linear_solver_data */ > > int* iWork; /**< integer work vector array (internal) */ > int iWorkSize; /**< size of integer work vector array */ > double* dWork; > int dWorkSize; > > linalg_data_t* linalg_data; /**< data for the linear algebra */ > }; > > /**\enum NumericsSparseOrigin NumericsSparseMatrix.h > * matrix storage types */ > typedef enum { NSM_UNKNOWN, NSM_TRIPLET, NSM_CSC, NSM_CSR, NSM_HALF_TRIPLET } NumericsSparseOrigin; > > typedef NumericsSparseOrigin NSM_t; > > /** \struct NumericsSparseMatrix NumericsSparseMatrix.h > * Sparse matrix representation in Numerics. The supported format are: > * triplet (aka coordinate, COO), CSC (via CSparse) and CSR if MKL is used */ > struct NumericsSparseMatrix > { > CSparseMatrix* triplet; /**< triplet format, aka coordinate */ > CSparseMatrix* half_triplet; /**< half triplet format for symmetric matrices */ > CSparseMatrix* csc; /**< csc matrix */ > CSparseMatrix* trans_csc; /**< transpose of a csc matrix (used by CSparse) */ > CSparseMatrix* csr; /**< csr matrix, only supported with mkl */ > CS_INT* diag_indx; /**< indices for the diagonal terms. > Very useful for the proximal perturbation */ > NSM_t origin; /**< original format of the matrix */ > NSM_linear_solver_params* linearSolverParams; > /**< solver-specific parameters */ > > NumericsDataVersion versions[5]; > }; > > > /** Initialize the fields of a NumericsSparseMatrix > * > * \param A the sparse matrix > */ > void NSM_null(NumericsSparseMatrix* A); > > /** New and empty NumericsSparseMatrix with correctly initialized fields. > * > * \return a pointer on the allocated space. > */ > NumericsSparseMatrix* NSM_new(void); > > NumericsSparseMatrix * NSM_triplet_eye(unsigned int size); > > NumericsSparseMatrix * NSM_triplet_scalar(unsigned int size, double s); > > /** Free allocated space for a NumericsSparseMatrix. > * > * \param A a NumericsSparseMatrix > * \return NULL on success > */ > NumericsSparseMatrix* NSM_clear(NumericsSparseMatrix* A); > > /** Copy NumericsSparseMatrix version. > * > * \param A a NumericsSparseMatrix > * \param B a NumericsSparseMatrix > */ > void NSM_version_copy(const NumericsSparseMatrix* const A, > NumericsSparseMatrix* B); > > /** Copy a NumericsSparseMatrix. > * > * \param A a NumericsSparseMatrix > * \param B a NumericsSparseMatrix > */ > void NSM_copy(NumericsSparseMatrix* A, NumericsSparseMatrix* B); > > /** Free a workspace related to a LU factorization > * > * \param p the structure to free > */ > void NSM_clear_p(void *p); > > /** Get the data part of sparse matrix > * > * \param A the sparse matrix > * \return a pointer to the data array > */ > double* NSM_data(NumericsSparseMatrix* A); > > > /** Get the LU factors for cs_lusol > * > * \param p the structure holding the data for the solver > */ > static inline void* NSM_linear_solver_data(NSM_linear_solver_params* p) > { > return p->linear_solver_data; > } > /** Get the workspace for the sparse solver > * > * \param p the structure holding the data for the solver > * \return the (double) workspace > */ > static inline double* NSM_workspace(NSM_linear_solver_params* p) > > { > return p->dWork; > } > > /** get the number of non-zero (nnz) in a sparse matrix > * > * \param A the matrix > * \return the number of non-zero elements in the matrix > */ > size_t NSM_nnz(const CSparseMatrix* const A); > > /** return the set of indices corresponding to the diagonal elements of the > * matrix > * \warning should be better tested > * > * \param M the matrix > * \return the list of indices for the diagonal elements > */ > CS_INT* NSM_diag_indices(NumericsMatrix* M); > > > /** Extract a block from a sparse matrix > * > * \param M matrix > * \param blockM dense storage for the block > * \param pos_row starting row for the block > * \param pos_col starting column for the block > * \param block_row_size block width > * \param block_col_size block height > */ > void NSM_extract_block(NumericsMatrix* M, double* blockM, size_t pos_row, size_t pos_col, size_t block_row_size, size_t block_col_size); > > /** Free allocated space for NSM_linear_solver_params. > * > * \param p a NSM_linear_solver_params > * \return NULL on success > */ > NSM_linear_solver_params* NSM_linearSolverParams_free(NSM_linear_solver_params* p); > > /** New and empty NSM_linear_solver_params. > * > * \return a pointer on the allocated space. > */ > NSM_linear_solver_params* NSM_linearSolverParams_new(void); > > > /** Get linear solver parameters with initialization if needed. > * > * \param[in,out] A a NumericsMatrix. > * \return a pointer on parameters. > */ > NSM_linear_solver_params* NSM_linearSolverParams(NumericsMatrix* A); > > /** Check and fix a matrix, if needed > * > * \param A the matrix to check, modified if necessary to have ordered indices > */ > void NSM_fix_csc(CSparseMatrix* A); > > void NSM_sort_csc(CSparseMatrix* A); > > /** return the origin of a sparse part of a matrix > * > * \param M the matrix > * \return -1 if the matrix has no sparse representation, the origin > * otherwise*/ > unsigned NSM_origin(const NumericsSparseMatrix* M); > > /** return the sparse matrix that has the original label > * > * \param M the matrix > * \return the sparse matrix that is at the origin, or NULL if an error occur > **/ > CSparseMatrix* NSM_get_origin(const NumericsSparseMatrix* M); > > void NSM_write_in_file(const NumericsSparseMatrix* m, FILE* file); > > /** New and empty NumericsSparseMatrix with correctly initialized fields. > * > * \return a pointer on the allocated space. > */ > NumericsSparseMatrix* NSM_new_from_file(FILE *file); > > int NSM_to_dense(const NumericsSparseMatrix * const A, double * B); > > /** Get current version of a type of csparse matrix. > * > * \param M the NumericsSparseMatrix, > * \param type the type of sparse storage from NumericsSparseOrigin > * \return a comparable version. */ > version_t NSM_version(const NumericsSparseMatrix* M, NSM_t type); > > /** Get the maximum of versions of csparse matrices. > * > * \param M the NumericsSparseMatrix, > * \return a comparable version. */ > version_t NSM_max_version(const NumericsSparseMatrix* M); > > /** Set the version of a NumericsSparseMatrix. > * > * \param M the NumericsSparseMatrix, > * \param type the NumericsSparseOrigin of storage, > * \param value the new version. > */ > void NSM_set_version(NumericsSparseMatrix* M, NSM_t type, > version_t value); > > /** Reset all versions of a NumericsSparseMatrix. > * > * \param M the NumericsSparseMatrix. > */ > void NSM_reset_versions(NumericsSparseMatrix *M); > > /** Reset version of a sparse storage. > * > * \param M the NumericsSparseMatrix, > * \param type the NumericsSparseOrigin of storage. > */ > void NSM_reset_version(NumericsSparseMatrix*M, NSM_t type); > > /** Increment the version of a NumericsSparseMatrix. > * > * \param M the NumericsSparseMatrix, > * \param type the NumericsSparseOrigin of storage > */ > void NSM_inc_version(NumericsSparseMatrix* M, NSM_t type); > > /** Get the NumericsSparseOrigin with the latest version. > * > * \param M the NumericsSparseMatrix > * \return the NumericsSparseOrigin. > */ > NSM_t NSM_latest_id(const NumericsSparseMatrix* M); > > /** Get most recent CSparseMatrix. > * > * \param M the NumericsSparseMatrix > * \return a pointer on a CSparseMatrix. > */ > CSparseMatrix* NSM_latest(const NumericsSparseMatrix* M); > > /** Sync matrix origin and version > * \param M the NumericsSparseMatrix > */ > void NSM_version_sync(NumericsSparseMatrix* M); > >#if 0 /* disabled by -frewrite-includes */ >#if defined(__cplusplus) && !defined(BUILD_AS_CPP) >#endif >#endif /* disabled by -frewrite-includes */ >#if 0 /* evaluated by -frewrite-includes */ ># 321 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/NumericsSparseMatrix.h" >} >#endif ># 323 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/NumericsSparseMatrix.h" > >#endif ># 325 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/NumericsSparseMatrix.h" ># 33 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/NumericsMatrix.h" 2 >#if 0 /* expanded by -frewrite-includes */ >#include "SiconosConfig.h" // for BUILD_AS_CPP, SICONOS_HAS_MP // IWYU pragma: keep >#endif /* expanded by -frewrite-includes */ ># 33 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/NumericsMatrix.h" ># 34 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/NumericsMatrix.h" >#if 0 /* expanded by -frewrite-includes */ >#include "NM_MPI.h" >#endif /* expanded by -frewrite-includes */ ># 34 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/NumericsMatrix.h" ># 1 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/NM_MPI.h" 1 >/* Siconos is a program dedicated to modeling, simulation and control > * of non smooth dynamical systems. > * > * Copyright 2024 INRIA. > * > * Licensed under the Apache License, Version 2.0 (the "License"); > * you may not use this file except in compliance with the License. > * You may obtain a copy of the License at > * > * http://www.apache.org/licenses/LICENSE-2.0 > * > * Unless required by applicable law or agreed to in writing, software > * distributed under the License is distributed on an "AS IS" BASIS, > * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. > * See the License for the specific language governing permissions and > * limitations under the License. >*/ > >#if 0 /* expanded by -frewrite-includes */ >#include "NumericsFwd.h" // for NumericsMatrix >#endif /* expanded by -frewrite-includes */ ># 19 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/NM_MPI.h" ># 20 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/NM_MPI.h" >#if 0 /* expanded by -frewrite-includes */ >#include "SiconosConfig.h" // for BUILD_AS_CPP, SICONOS_HAS_MPI // IWYU pragma: keep >#endif /* expanded by -frewrite-includes */ ># 20 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/NM_MPI.h" ># 21 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/NM_MPI.h" > >#ifdef SICONOS_HAS_MPI >#if 0 /* expanded by -frewrite-includes */ >#include <mpi.h> >#endif /* expanded by -frewrite-includes */ ># 23 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/NM_MPI.h" ># 24 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/NM_MPI.h" >#endif ># 25 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/NM_MPI.h" > >#if 0 /* disabled by -frewrite-includes */ >#if defined(__cplusplus) && !defined(BUILD_AS_CPP) >#endif >#endif /* disabled by -frewrite-includes */ >#if 0 /* evaluated by -frewrite-includes */ ># 27 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/NM_MPI.h" >extern "C" >{ >#endif ># 30 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/NM_MPI.h" > >#ifdef SICONOS_HAS_MPI >MPI_Comm NM_MPI_comm(NumericsMatrix* A); >void NM_MPI_set_comm(NumericsMatrix* A, MPI_Comm comm); >#if 0 /* expanded by -frewrite-includes */ >#include <stdio.h> >#endif /* expanded by -frewrite-includes */ ># 34 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/NM_MPI.h" ># 35 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/NM_MPI.h" >#define CHECK_MPI(COMM, EXPR) \ > do \ > { \ > int error_code = EXPR; \ > MPI_Comm_set_errhandler(COMM, MPI_ERRORS_RETURN); \ > if (error_code != MPI_SUCCESS) { \ > char error_string[1024]; \ > int length_of_error_string, error_class; \ > MPI_Error_class(error_code, &error_class); \ > MPI_Error_string(error_class, error_string, &length_of_error_string); \ > fprintf(stderr, "%3d: %s\n", 0, error_string); \ > MPI_Error_string(error_code, error_string, &length_of_error_string); \ > fprintf(stderr, "%3d: %s\n", 0, error_string); \ > MPI_Abort(COMM, error_code); \ > }; \ > } while(0) >#endif ># 52 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/NM_MPI.h" > > int NM_MPI_rank(NumericsMatrix* A); > > void NM_MPI_copy(const NumericsMatrix* A, NumericsMatrix* B); > >#if 0 /* disabled by -frewrite-includes */ >#if defined(__cplusplus) && !defined(BUILD_AS_CPP) >#endif >#endif /* disabled by -frewrite-includes */ >#if 0 /* evaluated by -frewrite-includes */ ># 58 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/NM_MPI.h" >} >#endif ># 60 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/NM_MPI.h" > ># 35 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/NumericsMatrix.h" 2 >#ifndef __cplusplus >#if 0 /* expanded by -frewrite-includes */ >#include <stdbool.h> // for bool >#endif /* expanded by -frewrite-includes */ ># 36 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/NumericsMatrix.h" ># 1 "/usr/include/stdbool.h" 1 3 4 >/* > * SPDX-License-Identifier: BSD-2-Clause > * > * Copyright (c) 2000 Jeroen Ruigrok van der Werven <asmodai@FreeBSD.org> > * 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. > */ > >#ifndef __bool_true_false_are_defined >#define __bool_true_false_are_defined 1 > >#ifndef __cplusplus > >#define false 0 >#define true 1 > >#define bool _Bool > >#endif /* !__cplusplus */ ># 40 "/usr/include/stdbool.h" 3 4 >#endif /* __bool_true_false_are_defined */ ># 41 "/usr/include/stdbool.h" 3 4 ># 37 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/NumericsMatrix.h" 2 >#endif ># 38 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/NumericsMatrix.h" > >#ifdef WITH_OPENSSL >#if 0 /* expanded by -frewrite-includes */ >#include <openssl/sha.h> >#endif /* expanded by -frewrite-includes */ ># 40 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/NumericsMatrix.h" ># 41 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/NumericsMatrix.h" >#endif ># 42 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/NumericsMatrix.h" > >/** \struct NumericsMatrixInternalData NumericsMatrix.h > * Structure for simple workspaces > */ >typedef struct >{ > size_t iWorkSize; /**< size of iWork */ > void *iWork; /**< integer workspace */ > size_t sizeof_elt ; /**< sizeof_elt of an element in bytes (result of sizeof for instance)*/ > size_t dWorkSize; /**< size of dWork */ > double *dWork; /**< double workspace */ > bool isLUfactorized; /**< true if the matrix has already been LU-factorized */ > bool isCholeskyfactorized; /**< true if the matrix has already been Cholesky factorized */ > bool isLDLTfactorized; /**< true if the matrix has already been LDLT factorized */ > bool isInversed; /**< true if the matrix contains its inverse (in place inversion) */ >#ifdef SICONOS_HAS_MPI > MPI_Comm mpi_comm; /**< optional mpi communicator */ >#endif ># 60 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/NumericsMatrix.h" >#ifdef WITH_OPENSSL > unsigned int values_sha1_count; /**< counter for sha1 */ > unsigned char values_sha1[SHA_DIGEST_LENGTH]; /**< sha1 hash of > * values. Matrices of > * differents sizes may have > * the same hash */ >#endif ># 67 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/NumericsMatrix.h" >} NumericsMatrixInternalData; > >/*! Available types of storage for NumericsMatrix */ >typedef enum NumericsMatrix_types { > NM_DENSE, /**< dense format */ > NM_SPARSE_BLOCK, /**< sparse block format */ > NM_SPARSE, /**< compressed column format */ > NM_UNKNOWN, /**< unset. Used in NM_null */ >} NM_types; > >/** \struct NumericsMatrix NumericsMatrix.h > Interface to different type of matrices in numerics component. > > See NM_* functions for linear algebra operations on dense, sparse block and sparse storage. >*/ >struct NumericsMatrix >{ > NM_types storageType; /**< the type of storage: > 0: dense (double*), > 1: SparseBlockStructuredMatrix, > 2: classical sparse (csc, csr or triplet) via CSparse (from T. Davis)*/ > int size0; /**< number of rows */ > int size1; /**< number of columns */ > double* matrix0; /**< dense storage */ > SparseBlockStructuredMatrix* matrix1; /**< sparse block storage */ > NumericsSparseMatrix* matrix2; /**< csc, csr or triplet storage */ > > NumericsMatrixInternalData* internalData; /**< internal storage, used for workspace among other things */ > > NumericsDataVersion version; /*< version of dense storage */ > > NumericsMatrix* destructible; /**<pointer on the destructible > * matrix, by default points toward > * the matrix itself */ >}; > >typedef struct >{ > int size0; > int size1; > NumericsMatrix* D1; > NumericsMatrix* D2; > NumericsMatrix* A; >} BalancingMatrices; > >/*! RawNumericsMatrix is used without conversion in python */ >typedef NumericsMatrix RawNumericsMatrix; > > >typedef enum { > NM_NONE, /**< keep nothing */ > NM_KEEP_FACTORS, /**< keep all the factorization data (useful to reuse the factorization) */ > NM_PRESERVE /**< keep the matrix as-is (useful for the dense case) */ >} NM_gesv_opts; > >#if 0 /* disabled by -frewrite-includes */ >#if defined(__cplusplus) && !defined(BUILD_AS_CPP) >#endif >#endif /* disabled by -frewrite-includes */ >#if 0 /* evaluated by -frewrite-includes */ ># 123 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/NumericsMatrix.h" >extern "C" >{ >#endif ># 126 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/NumericsMatrix.h" > /**************************************************/ > /** Constructors and destructors ****************/ > /**************************************************/ > > /** Creation of an empty NumericsMatrix. > * > * \return a pointer to allocated space > */ > RawNumericsMatrix* NM_new(void); > RawNumericsMatrix* NM_eye(int size); > RawNumericsMatrix* NM_scalar(int size, double s); > > /** create a NumericsMatrix and allocate the memory according to the matrix type > * > * \param storageType the type of storage > * \param size0 number of rows > * \param size1 number of columns > * \return a pointer to a NumericsMatrix > */ > RawNumericsMatrix* NM_create(NM_types storageType, int size0, int size1); > > /** create a NumericsMatrix and possibly set the data > * > * \param storageType the type of storage > * \param size0 number of rows > * \param size1 number of columns > * \param data pointer to the matrix data. If NULL, all matrixX fields are > * set to NULL > * \return a pointer to a NumericsMatrix > */ > RawNumericsMatrix* NM_create_from_data(int storageType, int size0, int size1, void* data); > RawNumericsMatrix* NM_create_from_filename(const char *filename); > RawNumericsMatrix* NM_create_from_file(FILE *file); > > /** Copy NumericsMatrix version. > * > * \param[in] A a NumericsMatrix > * \param[in,out] B a NumericsMatrix > */ > void NM_version_copy(const NumericsMatrix* const A, NumericsMatrix* B); > > /** Copy a NumericsMatrix inside another NumericsMatrix (deep). > * Reallocations are performed if B cannot hold a copy of A > * > * \param[in] A a NumericsMatrix > * \param[in,out] B a NumericsMatrix > */ > void NM_copy(const NumericsMatrix* const A, NumericsMatrix* B); > > /** Copy a NumericsMatrix to s sparse one. > * Allocation or reallocation are performed on B > * \warning It is assumed that B has been properly initialized: its storageType must > * be set to NM_SPARSE. > * > * \param[in] A a NumericsMatrix > * \param[in,out] B a NumericsMatrix > * \param threshold if the original matrix is dense, a threshold can be applied > * on the absolute value of the entries > */ > void NM_copy_to_sparse(NumericsMatrix* A, NumericsMatrix* B, double threshold); > > /** create a NumericsMatrix similar to the another one. The structure is the same > * > * \param mat the model matrix > * \return a pointer to a NumericsMatrix > */ > RawNumericsMatrix* NM_duplicate(NumericsMatrix* mat); > > > /** Creation, if needed, of sparse matrix storage. > * > * \param[in,out] A a NumericsMatrix > * \return a pointer on the sparse matrix storage > */ > NumericsSparseMatrix* numericsSparseMatrix(NumericsMatrix* A); > > /** Creation, if needed, of triplet storage from sparse block storage. > * > * \param[in,out] A a NumericsMatrix initialized with sparsed block storage. > * \return the triplet sparse Matrix created in A. > */ > CSparseMatrix* NM_triplet(NumericsMatrix* A); > > /** Creation, if needed, of half triplet storage from sparse block storage. > * > * \param[in,out] A a NumericsMatrix initialized with sparsed block storage. > * \return the triplet sparse Matrix created in A. > */ > CSparseMatrix* NM_half_triplet(NumericsMatrix* A); > > /** Creation, if needed, of compress column storage of a NumericsMatrix. > * > * \param[in,out] A a NumericsMatrix with sparse block storage initialized > * \return the compressed column CSparseMatrix created in A. > */ > CSparseMatrix* NM_csc(NumericsMatrix *A); > > /** Creation, if needed, of the transposed compress column storage > * from compress column storage. > * > * \param[in,out] A a NumericsMatrix with sparse block storage. > * \return the transposed compressed column matrix created in A. > */ > CSparseMatrix* NM_csc_trans(NumericsMatrix* A); > > /** Creation, if needed, of compress row storage of a NumericsMatrix > * \warning This rely on the MKL > * > * \param[in,out] A a NumericsMatrix with sparse block storage initialized > * \return the compressed row CSparseMatrix created in A. > */ > CSparseMatrix* NM_csr(NumericsMatrix *A); > > /** fill an existing NumericsMatrix struct > * > * \param[in,out] M the struct to fill > * \param storageType the type of storage > * \param size0 number of rows > * \param size1 number of columns > * \param data pointer to the matrix data. If NULL, all matrixX fields are > * set to NULL > */ > void NM_fill(NumericsMatrix* M, NM_types storageType, int size0, int size1, void* data); > > /** new NumericsMatrix with sparse storage from minimal set of data > * > * \param[in] size0 number of rows > * \param[in] size1 number of columns > * \param[in] m1 the SparseBlockStructuredMatrix > * \return a pointer to a NumericsMatrix > */ > RawNumericsMatrix* NM_new_SBM(int size0, int size1, SparseBlockStructuredMatrix* m1); > > /** new NumericsMatrix equal to the transpose of a given matrix > * > * \param[in] A > * \return a pointer to a NumericsMatrix > */ > RawNumericsMatrix* NM_transpose(NumericsMatrix * A); > > /** set NumericsMatrix fields to NULL > * > * \param A a matrix > */ > void NM_null(NumericsMatrix* A); > > /** Check if a matrix is destructible. > * > * \param[in] A the NumericsMatrix > * \return true if the matrix is destructible */ > bool NM_destructible(const NumericsMatrix* A); > > /** Preservation of a matrix before in-place transformations such as > * factorizations. > * > * \param[in] A the NumericsMatrix > * \return a pointer on the preserved Matrix; > */ > RawNumericsMatrix* NM_preserve(NumericsMatrix* A); > > /** Set the matrix as destructible, clear the preserved data. > * > * \param[in] A the NumericsMatrix > * \return a pointer on the Matrix; > */ > RawNumericsMatrix* NM_unpreserve(NumericsMatrix* A); > > /** Check for a previous LU factorization. > * > * \param[in] A the NumericsMatrix > * \return true if the matrix has been LU factorized. > */ > bool NM_LU_factorized(const NumericsMatrix* const A); > > /** Check for a previous Cholesky factorization. > * > * \param[in] A the NumericsMatrix > * \return true if the matrix has been Cholesky factorized. > */ > bool NM_Cholesky_factorized(const NumericsMatrix* const A); > > /** Check for a previous LDLT factorization. > * > * \param[in] A the NumericsMatrix > * \return true if the matrix has been Cholesky factorized. > */ > bool NM_LDLT_factorized(const NumericsMatrix* const A); > > /** Set the factorization flag. > * > * \param[in] A the NumericsMatrix, > * \param[in] flag a boolean. > */ > void NM_set_LU_factorized(NumericsMatrix* A, bool flag); > void NM_set_Cholesky_factorized(NumericsMatrix* A, bool flag); > void NM_set_LDLT_factorized(NumericsMatrix* A, bool flag); > > /** update the size of the matrix based on the matrix data > * > * \param[in,out] A the matrix which size is updated*/ > void NM_update_size(NumericsMatrix* A); > > /** Allocate a csc matrix in A > * > * \param A the matrix > * \param nzmax number of non-zero elements > */ > void NM_csc_alloc(NumericsMatrix* A, CS_INT nzmax); > > /** Allocate a csc matrix in A and set the vector of > * column pointers to 0 such that the matrix is empty. > * > * \param A the matrix > * \param nzmax number of non-zero elements > */ > void NM_csc_empty_alloc(NumericsMatrix* A, CS_INT nzmax); > > /** Allocate a triplet matrix in A > * > * \param A the matrix > * \param nzmax maximum number of non-zero elements > */ > void NM_triplet_alloc(NumericsMatrix* A, CS_INT nzmax); > > > /** > Free memory for a NumericsMatrix. Warning: call this function only if you are sure that > memory has been allocated for the structure in Numerics. This function is assumed that the memory is "owned" by this structure. > Note that this function does not free m. > > \param m the matrix to be deleted. > */ > > void NM_clear(NumericsMatrix* m); > > NumericsMatrix * NM_free(NumericsMatrix* m); > > /** > Free memory for a NumericsMatrix except the dense matrix that is assumed not to be owned. > > \param m the matrix to be cleared. > */ > void NM_clear_not_dense(NumericsMatrix* m); > NumericsMatrix * NM_free_not_dense(NumericsMatrix* m); > /** > Free memory for a NumericsMatrix except the SBM matrix that is assumed not to be owned. > Note that this function does not free m. > > \param m the matrix to be cleared. > */ > void NM_clear_not_SBM(NumericsMatrix* m); > NumericsMatrix * NM_free_not_SBM(NumericsMatrix* m); > > > /** Free memory for a NumericsMatrix except for a given storage. Warning: call this function only if you are sure that > memory has been allocated for the structure in Numerics. This function is assumed that the memory is "owned" by this structure. > Note that this function does not free m. > > \param m the matrix to be deleted. > \param storageType to be kept. > */ > void NM_clear_other_storages(NumericsMatrix* M, NM_types storageType); > > /** insert an non zero entry into a NumericsMatrix. > * for storageType = NM_SPARSE, a conversion to triplet is done for performing the entry in the > * matrix. This method is expensive in terms of memory management. For a lot of entries, use > * preferably a triplet matrix. > * > * \param M the NumericsMatrix > * \param i row index > * \param j column index > * \param val the value to be inserted. > * \param threshold a threshold to filter the small value in magnitude (useful for dense to sparse conversion) > */ > void NM_zentry(NumericsMatrix* M, int i, int j, double val, double threshold); > > /** insert an entry into a NumericsMatrix. > * for storageType = NM_SPARSE, a conversion to triplet is done for performing the entry in the > * matrix. This method is expensive in terms of memory management. For a lot of entries, use > * preferably a triplet matrix. > * > * \param M the NumericsMatrix > * \param i row index > * \param j column index > * \param val the value to be inserted. > */ > void NM_entry(NumericsMatrix* M, int i, int j, double val); > > /** get the value of a NumericsMatrix. > * > * \param M the NumericsMatrix > * \param i row index > * \param j column index > * \return the value to be inserted. > */ > double NM_get_value(const NumericsMatrix* const M, int i, int j); > > /** compare to NumericsMatrix up to machine accuracy (DBL_EPSILON) > * > * \param A the NumericsMatrix > * \param B the NumericsMatrix > */ > bool NM_equal(NumericsMatrix* A, NumericsMatrix* B); > > /** compare to NumericsMatrix up to a given tolerance > * > * \param A the NumericsMatrix > * \param B the NumericsMatrix > * \param tol the tolerance > */ > bool NM_compare(NumericsMatrix* A, NumericsMatrix* B, double tol); > > /** return the number of non-zero element. For a dense matrix, it is the > * product of the dimensions (e.g. an upper bound). For a sparse matrix, it is the true number > * > * \param M the matrix > * \return the number (or an upper bound) of non-zero elements in the matrix > */ > size_t NM_nnz(const NumericsMatrix* M); > > /** get the (square) diagonal block of a NumericsMatrix. No allocation is done. > * > * \param[in] M a NumericsMatrix > * \param[in] block_row_nb the number of the block Row. Useful only in sparse case > * \param[in] start_row the starting row. Useful only in dense case. > * \param[in] size of the diag block. Only useful in dense case. > * \param[out] Block the target. In the dense and sparse case (*Block) must be allocated by caller. > * In case of SBM case **Bout contains the resulting block (from the SBM). > */ > void NM_extract_diag_block(NumericsMatrix* M, int block_row_nb, size_t start_row, > int size, double **Block); > > /** get a 3x3 diagonal block of a NumericsMatrix. No allocation is done. > * > * \param[in] M a NumericsMatrix > * \param[in] block_row_nb the number of the block row > * \param[out] Block the target. In the dense and sparse case (*Block) must be allocated by caller. > * In case of SBM case **Bout contains the resulting block (from the SBM). > */ > > void NM_extract_diag_block3(NumericsMatrix* M, int block_row_nb, double **Block); > > /** get a 2x2 diagonal block of a NumericsMatrix. No allocation is done. > * > * \param[in] M a NumericsMatrix > * \param[in] block_row_nb the number of the block row > * \param[out] Block the target. In the dense and sparse case (*Block) must be allocated by caller. > * In case of SBM case **Bout contains the resulting block (from the SBM). > */ > > void NM_extract_diag_block2(NumericsMatrix* M, int block_row_nb, double **Block); > > /** get a 5x5 diagonal block of a NumericsMatrix. No allocation is done. > * > * \param[in] M a NumericsMatrix > * \param[in] block_row_nb the number of the block row > * \param[out] Block the target. In the dense and sparse case (*Block) must be allocated by caller. > * In case of SBM case **Bout contains the resulting block (from the SBM). > */ > void NM_extract_diag_block5(NumericsMatrix* M, int block_row_nb, double **Block); > > /** get a 3x3 diagonal block of a NumericsMatrix. No allocation is done. > * > * \param[in] M a NumericsMatrix > * \param[in] block_row_nb the number of the block row > * \param[out] Block the target. > * In all cases (dense, sbm, and sparse) (*Block) must be allocated by caller. > * A copy is always performed > */ > void NM_copy_diag_block3(NumericsMatrix* M, int block_row_nb, double **Block); > > > /** Set the submatrix B into the matrix A on the position defined in > * (start_i, start_j) position. > * > * \param[in] A a pointer to NumerixMatrix > * \param[in] B a pointer toNumericsMatrix > * \param[in] start_i a start row index > * \param[in] start_j a start column index > */ > void NM_insert(NumericsMatrix* A, const NumericsMatrix* const B, > const unsigned int start_i, const unsigned int start_j); > > // Matrix - vector product > > /** > Matrix - vector product y = A*x + y > > \param[in] sizeX dim of the vector x > \param[in] sizeY dim of the vector y > \param[in] A the matrix to be multiplied > \param[in] x the vector to be multiplied > \param[in,out] y the resulting vector > */ > void NM_prod_mv_3x3(int sizeX, int sizeY, NumericsMatrix* A, > double* const x, double* y); > > /** > Row of a Matrix - vector product y = rowA*x or y += rowA*x, rowA being a submatrix of A (sizeY rows and sizeX columns) > > \param[in] sizeX dim of the vector x > \param[in] sizeY dim of the vector y > \param[in] currentRowNumber position of the first row of rowA in A (warning: real row if A is a double*, block-row if A is a SparseBlockStructuredMatrix) > \param[in] A the matrix to be multiplied > \param[in] x the vector to be multiplied > \param[in,out] y the resulting vector > \param[in] init = 0 for y += Ax, =1 for y = Ax > */ > void NM_row_prod(int sizeX, int sizeY, int currentRowNumber, NumericsMatrix* A, const double* const x, double* y, int init); > > /** > Row of a Matrix - vector product y = rowA*x or y += rowA*x, rowA being a submatrix of A (sizeY rows and sizeX columns) > > \param[in] sizeX dim of the vector x > \param[in] sizeY dim of the vector y > \param[in] block_start block number (only used for SBM) > \param[in] row_start position of the first row of A (unused if A is SBM) > \param[in] A the matrix to be multiplied > \param[in] x the vector to be multiplied > \param[in,out] y the resulting vector > \param[in] xsave storage for saving the part of x set to 0 > \param[in] init if True y = Ax, else y += Ax > */ > void NM_row_prod_no_diag(size_t sizeX, size_t sizeY, int block_start, size_t row_start, NumericsMatrix* A, double* x, double* y, double* xsave, bool init); > > /** > Row of a Matrix - vector product y = rowA*x or y += rowA*x, rowA being a submatrix of A (3 rows and sizeX columns) > > \param[in] sizeX dim of the vector x > \param[in] block_start block number (only used for SBM) > \param[in] row_start position of the first row of A (unused if A is SBM) > \param[in] A the matrix to be multiplied > \param[in] x the vector to be multiplied > \param[in,out] y the resulting vector > \param[in] init if True y = Ax, else y += Ax > */ > void NM_row_prod_no_diag3(size_t sizeX, int block_start, size_t row_start, NumericsMatrix* A, double* x, double* y, bool init); > > /** Row of a Matrix - vector product y = rowA*x or y += rowA*x, rowA being a submatrix of A (2 rows and sizeX columns) > \param[in] sizeX dim of the vector x > \param[in] block_start block number (only used for SBM) > \param[in] row_start position of the first row of A (unused if A is SBM) > \param[in] A the matrix to be multiplied > \param[in] x the vector to be multiplied > \param[in,out] y the resulting vector > \param[in] init if True y = Ax, else y += Ax > */ > void NM_row_prod_no_diag2(size_t sizeX, int block_start, size_t row_start, NumericsMatrix* A, double* x, double* y, bool init); > > > void NM_row_prod_no_diag1x1(size_t sizeX, int block_start, size_t row_start, NumericsMatrix* A, double* x, double* y, bool init); > > /** Matrix vector multiplication : y = alpha A x + beta y > * > * \param[in] alpha scalar > * \param[in] A a NumericsMatrix > * \param[in] x pointer on a dense vector of size A->size1 > * \param[in] beta scalar > * \param[in,out] y pointer on a dense vector of size A->size1 > */ > void NM_gemv(const double alpha, NumericsMatrix* A, const double *x, > const double beta, > double *y); > > /** Matrix matrix multiplication : C = alpha A B + beta C > * > * \param[in] alpha scalar > * \param[in] A a NumericsMatrix > * \param[in] B a NumericsMatrix > * \param[in] beta scalar > * \param[in,out] C a NumericsMatrix > */ > void NM_gemm(const double alpha, NumericsMatrix* A, NumericsMatrix* B, > const double beta, NumericsMatrix *C); > > /** Matrix matrix multiplication : C = A B > * > * \param[in] A a NumericsMatrix > * \param[in] B a NumericsMatrix > * \param[in,out] C a NumericsMatrix > */ > RawNumericsMatrix * NM_multiply(NumericsMatrix* A, NumericsMatrix* B); > > /** Transposed matrix multiplication : y += alpha transpose(A) x + y > * > * \param[in] alpha scalar > * \param[in] A a NumericsMatrix > * \param[in] x pointer on a dense vector of size A->size1 > * \param[in] beta scalar > * \param[in,out] y pointer on a dense vector of size A->size1 > */ > void NM_tgemv(const double alpha, NumericsMatrix* A, const double *x, > const double beta, > double *y); > > > // matrix and vector display > > void NM_dense_to_sparse(NumericsMatrix* A, NumericsMatrix* B, double threshold); > > /** > Copy a NumericsMatrix into another with dense storage. > > \param A source matrix (any kind of storage) > \param B targeted matrix, must be dense with the same dimension as A > */ > int NM_to_dense(NumericsMatrix* A, NumericsMatrix* B); > > /** > Screen display of the matrix content stored as a double * array in Fortran style > > \param m the matrix to be displayed > \param nRow the number of rows > \param nCol the number of columns > \param lDim the leading dimension of M > */ > void NM_dense_display_matlab(double * m, int nRow, int nCol, int lDim); > > /** > Screen display of the matrix content stored as a double * array in Fortran style > > \param m the matrix to be displayed > \param nRow the number of rows > \param nCol the number of columns > \param lDim the leading dimension of M > */ > void NM_dense_display(double * m, int nRow, int nCol, int lDim); > > /** > Screen display of the vector content stored as a double * array > > \param m the vector to be displayed > \param nRow the number of rows > */ > void NM_vector_display(double * m, int nRow); > > > /** > Screen display of the matrix content > > \param M the matrix to be displayed > */ > void NM_display(const NumericsMatrix* const M); > > /** > Screen display of the matrix storage > > \param M the matrix to be displayed > */ > void NM_display_storageType(const NumericsMatrix* const M); > > > /** > Screen display raw by raw of the matrix content > > \param m the matrix to be displayed > */ > void NM_display_row_by_row(const NumericsMatrix* const m); > > /**************************************************/ > /** matrix I/O *********************/ > /**************************************************/ > > /** > PrintInFile of the matrix content > > \param M the matrix to be printed > \param filename the corresponding name of the file > */ > void NM_write_in_filename(const NumericsMatrix* const M, const char *filename); > > /** > Read in file of the matrix content > > \param M the matrix to be read > \param filename the corresponding name of the file > */ > void NM_read_in_filename(NumericsMatrix* const M, const char *filename); > > /** > PrintInFile of the matrix content > > \param M the matrix to be printed > \param file filename the corresponding file > */ > > void NM_write_in_file(const NumericsMatrix* const M, FILE* file); > > /** > Read in file of the matrix content without performing memory allocation > > \param M the matrix to be read > \param file the corresponding file > */ > void NM_read_in_file(NumericsMatrix* const M, FILE *file); > > /** > Create from file a NumericsMatrix with memory allocation > > \param file the corresponding file > \return 0 if the matrix > */ > RawNumericsMatrix* NM_new_from_file(FILE *file); > RawNumericsMatrix* NM_new_from_filename(const char * filename); > > /** > NM_write_in_file_scilab of the matrix content > > \param M the matrix to be printed > \param file the corresponding file > */ > void NM_write_in_file_scilab(const NumericsMatrix* const M, FILE* file); > > /** > NM_write_in_file_python of the matrix content > > \param M the matrix to be printed > \param file the corresponding file > */ > void NM_write_in_file_python(const NumericsMatrix* const M, FILE* file); > > /** > Read in file for scilab of the matrix content > > \param M the matrix to be read > \param file the corresponding file > */ > void NM_read_in_file_scilab(NumericsMatrix* const M, FILE *file); > > /** Clear dense storage, if it is existent. > * > * \param[in,out] A a Numericsmatrix > */ > void NM_clearDense(NumericsMatrix* A); > > /** Clear sparse block storage, if it is existent. > * > * \param[in,out] A a Numericsmatrix > */ > void NM_clearSparseBlock(NumericsMatrix* A); > > /** Clear sparse data, if it is existent. > * The linear solver parameters are also cleared. > * > * \param[in,out] A a Numericsmatrix > */ > void NM_clearSparse(NumericsMatrix* A); > > /** Clear triplet storage, if it is existent. > * > * \param[in,out] A a Numericsmatrix > */ > void NM_clearTriplet(NumericsMatrix* A); > > /** Clear half triplet storage, if it is existent. > * > * \param[in,out] A a Numericsmatrix > */ > void NM_clearHalfTriplet(NumericsMatrix* A); > > /** Clear compressed column storage, if it is existent. > * > * \param[in,out] A a Numericsmatrix > */ > void NM_clearCSC(NumericsMatrix* A); > > /** Clear transposed compressed column storage, if it is existent. > * > * \param[in,out] A a Numericsmatrix > */ > void NM_clearCSCTranspose(NumericsMatrix* A); > > /** Clear compressed row storage, if it is existent. > * > * \param[in,out] A a Numericsmatrix > */ > void NM_clearCSR(NumericsMatrix* A); > > /** Clear triplet, csc, csc transposed storage, if they are existent. > * Linear solver parameters are preserved. > * > * \param[in,out] A a Numericsmatrix > */ > void NM_clearSparseStorage(NumericsMatrix *A); > > > > /* XXXXXX: to be rewritten Direct computation of the solution of a real system of linear > * equations: A x = b. The factorized matrix A is kept for future solve. > * If A is already factorized, the solve the linear system from it > * \warning this is not enable for all the solvers, your mileage may vary > * \param[in,out] A a NumericsMatrix. On a dense factorisation > * A.iWork is initialized. > * > * \param[in,out] b pointer on a dense vector of size A->size1 > * \param keep if set to NM_KEEP_FACTORS, keep all the info related to the factorization to > * allow for future solves. If A is already factorized, just solve the linear > * system. If set to NM_PRESERVE, preserve the original matrix (just used in > * the dense case). if NM_NONE, discard everything. > * \return 0 if successful, else the error is specific to the backend solver > * used > */ > > /** > LU factorization of the matrix. If the matrix has already been > factorized (i.e if NM_LU_factorized(A) return true), nothing is > done. To force a new factorization one has to set factorization > flag to false : NM_set_LU_factorized(A, false) before the call to > NM_LU_factorize. > If the matrix is preserved, that means that a call to > NM_preserve(A) has been done before the call to NM_LU_factorize, > it is not destroyed, but the factorized part remains accessible for > subsequent calls to NM_LU_solve. > If the matrix is not preserved, then it is replaced by the > factorized part. > > \param[in] A the NumericsMatrix > \return an int, 0 means the matrix has been factorized. > */ > int NM_LU_factorize(NumericsMatrix* A); > int NM_Cholesky_factorize(NumericsMatrix* A); > int NM_LDLT_factorize(NumericsMatrix* A); > > /** Solve linear system with multiple right hand size. A call to > * NM_LU_factorize is done at the beginning. > > * \param[in] A the NumericsMatrix. A is not destroyed if it has > * been preserved by a call to NM_preserve(A). > > * \param[in,out] b the right hand size which is a pointer on a > * matrix of double. It is replaced by the solutions > > * \param[in] nrhs the number of right hand side. > * \return 0 if the solve succeeded. > */ > int NM_LU_solve(NumericsMatrix* A, double *b, unsigned int nrhs); > int NM_LU_solve_matrix_rhs(NumericsMatrix* Ao, NumericsMatrix* B); > int NM_LU_refine(NumericsMatrix* A, double *x, double tol, int max_iter, double *residu); > int NM_Cholesky_solve(NumericsMatrix* A, double *b, unsigned int nrhs); > int NM_Cholesky_solve_matrix_rhs(NumericsMatrix* Ao, NumericsMatrix* B); > int NM_LDLT_solve(NumericsMatrix* A, double *b, unsigned int nrhs); > int NM_LDLT_refine(NumericsMatrix* Ao, double *x , double *b, unsigned int nrhs, double tol, int maxitref, int job ); > > > int NM_gesv_expert(NumericsMatrix* A, double *b, unsigned keep); > int NM_posv_expert(NumericsMatrix* A, double *b, unsigned keep); > > int NM_gesv_expert_multiple_rhs(NumericsMatrix* A, double *b, unsigned int n_rhs, unsigned keep); > > int NM_Linear_solver_finalize(NumericsMatrix* Ao); > > /** Computation of the inverse of a NumericsMatrix A usinf NM_gesv_expert > * > * \param[in,out] A a NumericsMatrix. > * \return the matrix inverse. > */ > NumericsMatrix* NM_LU_inv(NumericsMatrix* A); > > > int NM_inverse_diagonal_block_matrix_in_place(NumericsMatrix* A); > > /** Computation of the inverse of a NumericsMatrix A composed of diagonal blocks > * for each block a dense inverse is performed and then inserted into the > * global inverse > * \param[in] A a NumericsMatrix. > * \param[in] block_number the number of blocks > * \param[in] blocksize the sizes of diagonal blocks > * \return the matrix inverse. > */ > NumericsMatrix * NM_inverse_diagonal_block_matrix(NumericsMatrix* A, unsigned int block_number, unsigned int * blocksizes); > > /** Direct computation of the solution of a real system of linear > * equations: A x = b. > * > * \param[in,out] A a NumericsMatrix. On a dense factorisation > * A.iWork is initialized. > * \param[in,out] b pointer on a dense vector of size A->size1 > * \param preserve preserve the original matrix data. Only useful in the > * dense case, where the LU factorization is done in-place. > * \return 0 if successful, else the error is specific to the backend solver > * used > */ > static inline int NM_gesv(NumericsMatrix* A, double *b, bool preserve) > { > return NM_gesv_expert(A, b, preserve ? NM_PRESERVE : NM_NONE); > } > > /** Computation of the inverse of a NumericsMatrix A usinf NM_gesv_expert > * > * \param[in,out] A a NumericsMatrix. > * \return the matrix inverse. > */ > NumericsMatrix* NM_gesv_inv(NumericsMatrix* A); > > > > > /** Set the linear solver > * > * \param A the matrix > * \param solver_id id of the solver > */ > void NM_setSparseSolver(NumericsMatrix* A, NSM_linear_solver solver_id); > > /** Get Matrix internal data with initialization if needed. > * > * \param[in,out] A a NumericsMatrix. > * \return a pointer on internal data. > */ > NumericsMatrixInternalData* NM_internalData(NumericsMatrix* A); > > /** Allocate the internalData structure (but not its content!) > * > * \param M the matrix to modify > */ > void NM_internalData_new(NumericsMatrix* M); > > /** Copy the internalData structure > * > * \param M the matrix to modify > */ > void NM_internalData_copy(const NumericsMatrix* const A, NumericsMatrix* B ); > > /** Integer work vector initialization, if needed. > * > * \param[in,out] A pointer on a NumericsMatrix. > * \param[in] size number of element to allocate > * \param[in] sizeof_elt of an element in bytes (result of sizeof for instance) > * \return pointer on A->iWork allocated space of with the right size > */ > void* NM_iWork(NumericsMatrix *A, size_t size, size_t sizeof_elt); > > /** Double workspace initialization, if needed. > * > * \param[in,out] A pointer on a NumericsMatrix. > * \param[in] size the size of needed space. > * \return pointer on A->dWork allocated space of with the right size > */ > double* NM_dWork(NumericsMatrix *A, int size); > > /** Add a constant term to the diagonal elements, when the block of the SBM > * are 3x3 > * > * \param M the matrix > * \param alpha the term to add > */ > void NM_add_to_diag3(NumericsMatrix* M, double alpha); > > /** Add a constant term to the diagonal elements, when the block of the SBM > * are 5x5 > * > * \param M the matrix > * \param alpha the term to add > */ > void NM_add_to_diag5(NumericsMatrix* M, double alpha); > > /** Add two matrices with coefficients C = alpha*A + beta*B > * > * \param alpha the first coefficient > * \param A the first matrix > * \param beta the second coefficient > * \param B the second matrix > * \return C a new NumericsMatrix > */ > RawNumericsMatrix * NM_add(double alpha, NumericsMatrix* A, double beta, NumericsMatrix* B); > > /** Multiply a matrix with a double alpha*A --> A > * > * \param alpha the coefficient > * \param A the matrix > */ > void NM_scal(double alpha, NumericsMatrix* A); > > /** assert that a NumericsMatrix has the right structure given its type > * > * \param type expected type > * \param M the matrix to check > */ > static inline void NM_assert(NM_types type, NumericsMatrix* M) > { >#ifndef NDEBUG > assert(M && "NM_assert :: the matrix is NULL"); > assert(M->storageType == type && "NM_assert :: the matrix has the wrong type"); > switch(type) > { > case NM_DENSE: > assert(M->matrix0); > break; > case NM_SPARSE_BLOCK: > assert(M->matrix1); > break; > case NM_SPARSE: > assert(M->matrix2); > break; > default: > assert(0 && "NM_assert :: unknown storageType"); > } >#endif ># 1024 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/NumericsMatrix.h" > } > > /** Check the matrix (the sparse format for now) > * > * \param A the matrix to check > * \return 0 if the matrix storage is fine, 1 if not*/ > int NM_check(const NumericsMatrix* const A); > > /** Compute the 1-norm of a sparse matrix = max (sum (abs (A))), largest column sum of a matrix (the sparse format for now) > * > * \param A the matrix > * \return the norm*/ > double NM_norm_1(NumericsMatrix* const A); > > /** Compute the inf-norm of a sparse matrix = max (sum (abs (A^T))), largest row sum of a matrix (the sparse format for now) > * > * \param A the matrix > * \return the norm*/ > double NM_norm_inf(NumericsMatrix* const A); > > int NM_is_symmetric(NumericsMatrix* A); > double NM_symmetry_discrepancy(NumericsMatrix* A); > > > /** Pass a NumericsMatrix through swig typemaps. > * This is only useful in python. > * > * \param A the matrix > * \return a NumericsMatrix > */ > static inline NumericsMatrix* NM_convert(NumericsMatrix* A) > { > return A; > } > > /** Compute the maximum eigenvalue with the iterated power method > * > * \param A the matrix > * \return the maximum eigenvalue*/ > double NM_iterated_power_method(NumericsMatrix* A, double tol, int itermax); > > /** Compute the maximum values by columns > * > * \param A the matrix > * \param max the vector of max that must be preallocated > * \return info > */ > int NM_max_by_columns(NumericsMatrix *A, double * max); > > /** Compute the maximum values by rows > * > * \param A the matrix > * \param max the vector of max that must be preallocated > * \return info > */ > int NM_max_by_rows(NumericsMatrix *A, double * max); > > /** Compute the maximum absolute values by columns > * > * \param A the matrix > * \param max the vector of max that must be preallocated > * \return info > */ > int NM_max_abs_by_columns(NumericsMatrix *A, double * max); > > /** Compute the maximum absolute values by rows > * > * \param A the matrix > * \param max the vector of max that must be preallocated > * \return info > */ > int NM_max_abs_by_rows(NumericsMatrix *A, double * max); > > /** Compute the balancing matrices for a given matrix by iteration > * > * \param A the matrix > * \param tol tolerance on the balanced matrix > * \param itermax max number of iterations > * \param alloated structure for the balancing matrices and the balanced matrix > * \return 0 if succeed. > */ > int NM_compute_balancing_matrices(NumericsMatrix* A, double tol, int itermax, BalancingMatrices * B); > > /** Create a Balancing Matrices structure > * > * \param A the matrix to be balanced > */ > BalancingMatrices * NM_BalancingMatrices_new(NumericsMatrix* A); > > > /** free a Balancing Matrices structure > */ > BalancingMatrices * NM_BalancingMatrices_free(BalancingMatrices* A); > > /** Reset the version of a NM_types storage. > * > * \param M the NumericsMatrix, > * \param id the NM_types storage > */ > void NM_reset_version(NumericsMatrix* M, NM_types id); > > /** Reset versions of all storages. > * > * \param M the NumericsMatrix > */ > void NM_reset_versions(NumericsMatrix* M); > > /* Sync storageType from version. > * \param M the NumericsMatrix > */ > void NM_version_sync(NumericsMatrix* M); > > /* Check if an entry in the matrix is NaN . > *\param M the NumericsMatrix > *\return int = 1 if a NaN is found, 0 otherwise > */ > int NM_isnan(NumericsMatrix* M); > >#ifdef WITH_OPENSSL > /** Compute sha1 hash of matrix values. Matrices of differents size and same > * values have the same hash. > * > * \param[in] A the matrix > * \param[in,out] digest an allocated space of size SHA_DIGEST_LENGTH > */ > void NM_compute_values_sha1(NumericsMatrix* A, unsigned char * digest); > > /** Get stored sha1 hash of a matrix. > * > * \param[in] A the matrix > * \return a pointer on the current raw sha1 hash > */ > unsigned char* NM_values_sha1(NumericsMatrix* A); > > /** Set sha1 hash of a matrix. Matrices of differents size and same > * values have the same hash. > * > * \param[in] A the matrix > */ > void NM_set_values_sha1(NumericsMatrix* A); > > /** Clear sha1 hash of a matrix. > * > * \param[in] A the matrix > */ > void NM_clear_values_sha1(NumericsMatrix* A); > > /** Check if matrix has beend modified after a previous NM_set_values_sha1. > * > * \param[in] A the NumericsMatrix > * \return true if the matrix is the same > */ > bool NM_check_values_sha1(NumericsMatrix* A); > > /** Compare two matrices with sha1. NM_set_values_sha1 must be called > * on the two matrices before. > * > * \param[in] A a NumericsMatrix > * \param[in] B a NumericsMatrix > * \return true if the matrices have the same values > */ > bool NM_equal_values_sha1(NumericsMatrix* A, NumericsMatrix* B); > >#endif ># 1188 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/NumericsMatrix.h" > >#if 0 /* disabled by -frewrite-includes */ >#if defined(__cplusplus) && !defined(BUILD_AS_CPP) >#endif >#endif /* disabled by -frewrite-includes */ >#if 0 /* evaluated by -frewrite-includes */ ># 1190 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/NumericsMatrix.h" >} >#endif ># 1192 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/NumericsMatrix.h" > >#endif ># 1194 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/NumericsMatrix.h" ># 6 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/test/test_pinv.c" 2 >#if 0 /* expanded by -frewrite-includes */ >#include "pinv.h" // for pinv >#endif /* expanded by -frewrite-includes */ ># 6 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/test/test_pinv.c" ># 1 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/pinv.h" 1 >/* Siconos is a program dedicated to modeling, simulation and control > * of non smooth dynamical systems. > * > * Copyright 2024 INRIA. > * > * Licensed under the Apache License, Version 2.0 (the "License"); > * you may not use this file except in compliance with the License. > * You may obtain a copy of the License at > * > * http://www.apache.org/licenses/LICENSE-2.0 > * > * Unless required by applicable law or agreed to in writing, software > * distributed under the License is distributed on an "AS IS" BASIS, > * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. > * See the License for the specific language governing permissions and > * limitations under the License. >*/ > >/*!\file pinv.h > * \brief peseudo-inverse computations*/ > >#ifndef Pinv_H >#define Pinv_H > >#if 0 /* expanded by -frewrite-includes */ >#include "SiconosConfig.h" // for BUILD_AS_CPP // IWYU pragma: keep >#endif /* expanded by -frewrite-includes */ ># 25 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/pinv.h" ># 26 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/pinv.h" > >#if 0 /* disabled by -frewrite-includes */ >#if defined(__cplusplus) && !defined(BUILD_AS_CPP) >#endif >#endif /* disabled by -frewrite-includes */ >#if 0 /* evaluated by -frewrite-includes */ ># 28 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/pinv.h" >extern "C" >{ >#endif ># 31 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/pinv.h" > > /** Compute the pseudo-inverse of dense matrix with column major storage > \param A the matrix to be inversed > \param n the number of rows of A > \param m the number of columns of A > \param tolerance threshold used to validate the computation: if the error is less than this value, the computation is considered valid > \return the conditioning > */ > double pinv(double * A, int n, int m, double tolerance); > > >#if 0 /* disabled by -frewrite-includes */ >#if defined(__cplusplus) && !defined(BUILD_AS_CPP) >#endif >#endif /* disabled by -frewrite-includes */ >#if 0 /* evaluated by -frewrite-includes */ ># 43 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/pinv.h" >} >#endif ># 45 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/pinv.h" >#endif ># 46 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/pinv.h" ># 7 "/usr/ports/science/siconos/work/siconos-4.5.0/numerics/src/tools/test/test_pinv.c" 2 >int main(void) >{ > int n = 4; > int m = 5; > int info = -1; > > double * W = (double*)malloc(n * m * sizeof(double)); > double * Wpinv = (double*)malloc(n * m * sizeof(double)); > double * Wpinvtest = (double*)malloc(m * n * sizeof(double)); > > for(int i = 0; i < n; i++) > { > for(int j = 0; j < m; j++) > { > W[i + j * n] = 0.0; > } > } > for(int i = 0; i < m; i++) > { > for(int j = 0; j < n; j++) > { > Wpinv[i + j * m] = 0.0; > Wpinvtest[i + j * m] = 0.0; > } > } > W[0 + 0 * n] = 1.0; > W[0 + 4 * n] = 2.0; > W[1 + 2 * n] = 3.0; > W[3 + 1 * n] = 4.0; > > printf("Original Matrix W\n"); > for(int i = 0; i < n; i++) > { > for(int j = 0; j < m; j++) > { > printf("%8.6e\t", W[i + j * n]) ; > } > printf("\n"); > } > > NumericsMatrix *Wnum = NM_new(); > Wnum->storageType = 0; > Wnum-> size0 = n; > Wnum-> size1 = m; > Wnum->matrix1 = NULL; > Wnum->matrix2 = NULL; > Wnum->internalData = NULL; > Wnum->matrix0 = W; > > FILE * file1 = fopen("dataW.dat", "w"); > NM_write_in_file_scilab(Wnum, file1); > fclose(file1); > > NumericsMatrix *WnumpInv = NM_new(); > WnumpInv->storageType = 0; > WnumpInv-> size0 = n; > WnumpInv-> size1 = m; > WnumpInv->matrix1 = NULL; > WnumpInv->matrix2 = NULL; > WnumpInv->internalData = NULL; > WnumpInv->matrix0 = Wpinv; > > double tol = 1e-24; > memcpy(Wpinv, W, n * m * sizeof(double)); > pinv(Wpinv, n, m, tol); > printf("Winvtest\n"); > for(int i = 0; i < m; i++) > { > for(int j = 0; j < n; j++) > { > printf("%8.6e\t", Wpinvtest[i + j * m]) ; > } > printf("\n"); > } > > Wpinvtest[0 + 0 * m] = 0.2; > Wpinvtest[4 + 0 * m] = 0.4; > Wpinvtest[2 + 1 * m] = 1.0 / 3.0; > Wpinvtest[1 + 3 * m] = 1.0 / 4.0; > > printf("Winvtest\n"); > for(int i = 0; i < m; i++) > { > for(int j = 0; j < n; j++) > { > printf("%8.6e\t", Wpinvtest[i + j * m]) ; > } > printf("\n"); > } > printf("Pseudo inverseWinv\n"); > double err = 0.0; > for(int i = 0; i < m; i++) > { > for(int j = 0; j < n; j++) > { > printf("%8.6e\t", Wpinv[i + j * m]) ; > err += (Wpinv[i + j * m] - Wpinvtest[i + j * m]) * (Wpinv[i + j * m] - Wpinvtest[i + j * m]); > } > printf("\n"); > } > > if(err < 1e-16) info = 0 ; > > > printf("--------------------------\n"); > printf("test with transpose matrix\n"); > printf("--------------------------\n"); > > for(int i = 0; i < m; i++) > { > for(int j = 0; j < n; j++) > { > W[i + j * m] = W[j + i * n]; > } > } > W[4 + 0 * m] = 2.0; > for(int i = 0; i < n; i++) > { > for(int j = 0; j < m; j++) > { > Wpinv[i + j * n] = 0.0; > Wpinvtest[i + j * n] = 0.0; > } > } > Wpinvtest[0 + 0 * n] = 0.2; > Wpinvtest[0 + 4 * n] = 0.4; > Wpinvtest[1 + 2 * n] = 1.0 / 3.0; > Wpinvtest[3 + 1 * n] = 1.0 / 4.0; > > memcpy(Wpinv, W, n * m * sizeof(double)); > > pinv(Wpinv, m, n, tol); > printf("Winvtest\n"); > > for(int i = 0; i < n; i++) > { > for(int j = 0; j < m; j++) > { > printf("%8.6e\t", Wpinvtest[i + j * n]) ; > } > printf("\n"); > } > printf("Pseudo inverseWinv\n"); > err = 0.0; > for(int i = 0; i < n; i++) > { > for(int j = 0; j < m; j++) > { > printf("%8.6e\t", Wpinv[i + j * n]) ; > err += (Wpinv[i + j * n] - Wpinvtest[i + j * n]) * (Wpinv[i + j * n] - Wpinvtest[i + j * n]); > } > printf("\n"); > } > > if(err < 1e-16) info = 0 ; > > > FILE * file2 = fopen("dataWPseudoInverse.dat", "w"); > NM_write_in_file_scilab(WnumpInv, file2); > fclose(file2); > > > > > > free(Wpinvtest); > NM_clear(Wnum); > NM_clear(WnumpInv); > free(Wnum); > free(WnumpInv); > > printf("-----------------------------------\n"); > printf("test with nearly 10*identity matrix\n"); > printf("-----------------------------------\n"); > n = 4; > m = 4; > W = (double*)malloc(n * m * sizeof(double)); > Wpinv = (double*)malloc(n * m * sizeof(double)); > for(int i = 0; i < n; i++) > { > for(int j = 0; j < m; j++) > { > W[i + j * n] = 0.0; > } > W[i + i * n] = 10.0; > } > W[1 + 1 * n] = 1e-18; > tol = 1e-16; > memcpy(Wpinv, W, n * m * sizeof(double)); > pinv(Wpinv, n, m, tol); > > > free(W); > free(Wpinv); > > > return info; > >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 278174
: 249713 |
249714