diff options
author | bugaevskiy <bugaevskiy@yandex-team.com> | 2022-12-31 17:40:08 +0300 |
---|---|---|
committer | bugaevskiy <bugaevskiy@yandex-team.com> | 2022-12-31 17:40:08 +0300 |
commit | 030896f914b07ae082ccf0b6b00df926d22d2454 (patch) | |
tree | e520bd22d01faaf07ff303c49ad2fdfefa114f67 | |
parent | 014fdab1c4bb0fedea59974a6bb13ef3ec3b67cb (diff) | |
download | ydb-030896f914b07ae082ccf0b6b00df926d22d2454.tar.gz |
Remove Boost metaproject
487 files changed, 0 insertions, 72437 deletions
diff --git a/contrib/libs/backtrace/LICENSE b/contrib/libs/backtrace/LICENSE deleted file mode 100644 index 097d2774e5..0000000000 --- a/contrib/libs/backtrace/LICENSE +++ /dev/null @@ -1,29 +0,0 @@ -# Copyright (C) 2012-2016 Free Software Foundation, 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) The name of the author may not be used to -# endorse or promote products derived from this software without -# specific prior written permission. - -# 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. diff --git a/contrib/libs/backtrace/README.md b/contrib/libs/backtrace/README.md deleted file mode 100644 index c82834d174..0000000000 --- a/contrib/libs/backtrace/README.md +++ /dev/null @@ -1,36 +0,0 @@ -# libbacktrace -A C library that may be linked into a C/C++ program to produce symbolic backtraces - -Initially written by Ian Lance Taylor <iant@golang.org>. - -This is version 1.0. -It is likely that this will always be version 1.0. - -The libbacktrace library may be linked into a program or library and -used to produce symbolic backtraces. -Sample uses would be to print a detailed backtrace when an error -occurs or to gather detailed profiling information. -In general the functions provided by this library are async-signal-safe, -meaning that they may be safely called from a signal handler. - -The libbacktrace library is provided under a BSD license. -See the source files for the exact license text. - -The public functions are declared and documented in the header file -backtrace.h, which should be #include'd by a user of the library. - -Building libbacktrace will generate a file backtrace-supported.h, -which a user of the library may use to determine whether backtraces -will work. -See the source file backtrace-supported.h.in for the macros that it -defines. - -As of October 2020, libbacktrace supports ELF, PE/COFF, Mach-O, and -XCOFF executables with DWARF debugging information. -In other words, it supports GNU/Linux, *BSD, macOS, Windows, and AIX. -The library is written to make it straightforward to add support for -other object file and debugging formats. - -The library relies on the C++ unwind API defined at -https://itanium-cxx-abi.github.io/cxx-abi/abi-eh.html -This API is provided by GCC and clang. diff --git a/contrib/libs/backtrace/atomic.c b/contrib/libs/backtrace/atomic.c deleted file mode 100644 index fcac485b23..0000000000 --- a/contrib/libs/backtrace/atomic.c +++ /dev/null @@ -1,113 +0,0 @@ -/* atomic.c -- Support for atomic functions if not present. - Copyright (C) 2013-2021 Free Software Foundation, Inc. - Written by Ian Lance Taylor, Google. - -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) The name of the author may not be used to - endorse or promote products derived from this software without - specific prior written permission. - -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. */ - -#include "config.h" - -#include <sys/types.h> - -#include "backtrace.h" -#include "backtrace-supported.h" -#include "internal.h" - -/* This file holds implementations of the atomic functions that are - used if the host compiler has the sync functions but not the atomic - functions, as is true of versions of GCC before 4.7. */ - -#if !defined (HAVE_ATOMIC_FUNCTIONS) && defined (HAVE_SYNC_FUNCTIONS) - -/* Do an atomic load of a pointer. */ - -void * -backtrace_atomic_load_pointer (void *arg) -{ - void **pp; - void *p; - - pp = (void **) arg; - p = *pp; - while (!__sync_bool_compare_and_swap (pp, p, p)) - p = *pp; - return p; -} - -/* Do an atomic load of an int. */ - -int -backtrace_atomic_load_int (int *p) -{ - int i; - - i = *p; - while (!__sync_bool_compare_and_swap (p, i, i)) - i = *p; - return i; -} - -/* Do an atomic store of a pointer. */ - -void -backtrace_atomic_store_pointer (void *arg, void *p) -{ - void **pp; - void *old; - - pp = (void **) arg; - old = *pp; - while (!__sync_bool_compare_and_swap (pp, old, p)) - old = *pp; -} - -/* Do an atomic store of a size_t value. */ - -void -backtrace_atomic_store_size_t (size_t *p, size_t v) -{ - size_t old; - - old = *p; - while (!__sync_bool_compare_and_swap (p, old, v)) - old = *p; -} - -/* Do an atomic store of a int value. */ - -void -backtrace_atomic_store_int (int *p, int v) -{ - size_t old; - - old = *p; - while (!__sync_bool_compare_and_swap (p, old, v)) - old = *p; -} - -#endif diff --git a/contrib/libs/backtrace/backtrace-supported.h b/contrib/libs/backtrace/backtrace-supported.h deleted file mode 100644 index 1ece38888f..0000000000 --- a/contrib/libs/backtrace/backtrace-supported.h +++ /dev/null @@ -1,66 +0,0 @@ -/* backtrace-supported.h.in -- Whether stack backtrace is supported. - Copyright (C) 2012-2021 Free Software Foundation, Inc. - Written by Ian Lance Taylor, Google. - -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) The name of the author may not be used to - endorse or promote products derived from this software without - specific prior written permission. - -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. */ - -/* The file backtrace-supported.h.in is used by configure to generate - the file backtrace-supported.h. The file backtrace-supported.h may - be #include'd to see whether the backtrace library will be able to - get a backtrace and produce symbolic information. */ - - -/* BACKTRACE_SUPPORTED will be #define'd as 1 if the backtrace library - should work, 0 if it will not. Libraries may #include this to make - other arrangements. */ - -#define BACKTRACE_SUPPORTED 1 - -/* BACKTRACE_USES_MALLOC will be #define'd as 1 if the backtrace - library will call malloc as it works, 0 if it will call mmap - instead. This may be used to determine whether it is safe to call - the backtrace functions from a signal handler. In general this - only applies to calls like backtrace and backtrace_pcinfo. It does - not apply to backtrace_simple, which never calls malloc. It does - not apply to backtrace_print, which always calls fprintf and - therefore malloc. */ - -#define BACKTRACE_USES_MALLOC 0 - -/* BACKTRACE_SUPPORTS_THREADS will be #define'd as 1 if the backtrace - library is configured with threading support, 0 if not. If this is - 0, the threaded parameter to backtrace_create_state must be passed - as 0. */ - -#define BACKTRACE_SUPPORTS_THREADS 1 - -/* BACKTRACE_SUPPORTS_DATA will be #defined'd as 1 if the backtrace_syminfo - will work for variables. It will always work for functions. */ - -#define BACKTRACE_SUPPORTS_DATA 1 diff --git a/contrib/libs/backtrace/backtrace.c b/contrib/libs/backtrace/backtrace.c deleted file mode 100644 index 7b62900852..0000000000 --- a/contrib/libs/backtrace/backtrace.c +++ /dev/null @@ -1,129 +0,0 @@ -/* backtrace.c -- Entry point for stack backtrace library. - Copyright (C) 2012-2021 Free Software Foundation, Inc. - Written by Ian Lance Taylor, Google. - -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) The name of the author may not be used to - endorse or promote products derived from this software without - specific prior written permission. - -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. */ - -#include "config.h" - -#include <sys/types.h> - -#include "unwind.h" -#include "backtrace.h" -#include "internal.h" - -/* The main backtrace_full routine. */ - -/* Data passed through _Unwind_Backtrace. */ - -struct backtrace_data -{ - /* Number of frames to skip. */ - int skip; - /* Library state. */ - struct backtrace_state *state; - /* Callback routine. */ - backtrace_full_callback callback; - /* Error callback routine. */ - backtrace_error_callback error_callback; - /* Data to pass to callback routines. */ - void *data; - /* Value to return from backtrace_full. */ - int ret; - /* Whether there is any memory available. */ - int can_alloc; -}; - -/* Unwind library callback routine. This is passed to - _Unwind_Backtrace. */ - -static _Unwind_Reason_Code -unwind (struct _Unwind_Context *context, void *vdata) -{ - struct backtrace_data *bdata = (struct backtrace_data *) vdata; - uintptr_t pc; - int ip_before_insn = 0; - -#ifdef HAVE_GETIPINFO - pc = _Unwind_GetIPInfo (context, &ip_before_insn); -#else - pc = _Unwind_GetIP (context); -#endif - - if (bdata->skip > 0) - { - --bdata->skip; - return _URC_NO_REASON; - } - - if (!ip_before_insn) - --pc; - - if (!bdata->can_alloc) - bdata->ret = bdata->callback (bdata->data, pc, NULL, 0, NULL); - else - bdata->ret = backtrace_pcinfo (bdata->state, pc, bdata->callback, - bdata->error_callback, bdata->data); - if (bdata->ret != 0) - return _URC_END_OF_STACK; - - return _URC_NO_REASON; -} - -/* Get a stack backtrace. */ - -int __attribute__((noinline)) -backtrace_full (struct backtrace_state *state, int skip, - backtrace_full_callback callback, - backtrace_error_callback error_callback, void *data) -{ - struct backtrace_data bdata; - void *p; - - bdata.skip = skip + 1; - bdata.state = state; - bdata.callback = callback; - bdata.error_callback = error_callback; - bdata.data = data; - bdata.ret = 0; - - /* If we can't allocate any memory at all, don't try to produce - file/line information. */ - p = backtrace_alloc (state, 4096, NULL, NULL); - if (p == NULL) - bdata.can_alloc = 0; - else - { - backtrace_free (state, p, 4096, NULL, NULL); - bdata.can_alloc = 1; - } - - _Unwind_Backtrace (unwind, &bdata); - return bdata.ret; -} diff --git a/contrib/libs/backtrace/backtrace.h b/contrib/libs/backtrace/backtrace.h deleted file mode 100644 index 69cea4ca1e..0000000000 --- a/contrib/libs/backtrace/backtrace.h +++ /dev/null @@ -1,189 +0,0 @@ -/* backtrace.h -- Public header file for stack backtrace library. - Copyright (C) 2012-2021 Free Software Foundation, Inc. - Written by Ian Lance Taylor, Google. - -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) The name of the author may not be used to - endorse or promote products derived from this software without - specific prior written permission. - -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 BACKTRACE_H -#define BACKTRACE_H - -#include <stddef.h> -#include <stdint.h> -#include <stdio.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/* The backtrace state. This struct is intentionally not defined in - the public interface. */ - -struct backtrace_state; - -/* The type of the error callback argument to backtrace functions. - This function, if not NULL, will be called for certain error cases. - The DATA argument is passed to the function that calls this one. - The MSG argument is an error message. The ERRNUM argument, if - greater than 0, holds an errno value. The MSG buffer may become - invalid after this function returns. - - As a special case, the ERRNUM argument will be passed as -1 if no - debug info can be found for the executable, or if the debug info - exists but has an unsupported version, but the function requires - debug info (e.g., backtrace_full, backtrace_pcinfo). The MSG in - this case will be something along the lines of "no debug info". - Similarly, ERRNUM will be passed as -1 if there is no symbol table, - but the function requires a symbol table (e.g., backtrace_syminfo). - This may be used as a signal that some other approach should be - tried. */ - -typedef void (*backtrace_error_callback) (void *data, const char *msg, - int errnum); - -/* Create state information for the backtrace routines. This must be - called before any of the other routines, and its return value must - be passed to all of the other routines. FILENAME is the path name - of the executable file; if it is NULL the library will try - system-specific path names. If not NULL, FILENAME must point to a - permanent buffer. If THREADED is non-zero the state may be - accessed by multiple threads simultaneously, and the library will - use appropriate atomic operations. If THREADED is zero the state - may only be accessed by one thread at a time. This returns a state - pointer on success, NULL on error. If an error occurs, this will - call the ERROR_CALLBACK routine. - - Calling this function allocates resources that cannot be freed. - There is no backtrace_free_state function. The state is used to - cache information that is expensive to recompute. Programs are - expected to call this function at most once and to save the return - value for all later calls to backtrace functions. */ - -extern struct backtrace_state *backtrace_create_state ( - const char *filename, int threaded, - backtrace_error_callback error_callback, void *data); - -/* The type of the callback argument to the backtrace_full function. - DATA is the argument passed to backtrace_full. PC is the program - counter. FILENAME is the name of the file containing PC, or NULL - if not available. LINENO is the line number in FILENAME containing - PC, or 0 if not available. FUNCTION is the name of the function - containing PC, or NULL if not available. This should return 0 to - continuing tracing. The FILENAME and FUNCTION buffers may become - invalid after this function returns. */ - -typedef int (*backtrace_full_callback) (void *data, uintptr_t pc, - const char *filename, int lineno, - const char *function); - -/* Get a full stack backtrace. SKIP is the number of frames to skip; - passing 0 will start the trace with the function calling - backtrace_full. DATA is passed to the callback routine. If any - call to CALLBACK returns a non-zero value, the stack backtrace - stops, and backtrace returns that value; this may be used to limit - the number of stack frames desired. If all calls to CALLBACK - return 0, backtrace returns 0. The backtrace_full function will - make at least one call to either CALLBACK or ERROR_CALLBACK. This - function requires debug info for the executable. */ - -extern int backtrace_full (struct backtrace_state *state, int skip, - backtrace_full_callback callback, - backtrace_error_callback error_callback, - void *data); - -/* The type of the callback argument to the backtrace_simple function. - DATA is the argument passed to simple_backtrace. PC is the program - counter. This should return 0 to continue tracing. */ - -typedef int (*backtrace_simple_callback) (void *data, uintptr_t pc); - -/* Get a simple backtrace. SKIP is the number of frames to skip, as - in backtrace. DATA is passed to the callback routine. If any call - to CALLBACK returns a non-zero value, the stack backtrace stops, - and backtrace_simple returns that value. Otherwise - backtrace_simple returns 0. The backtrace_simple function will - make at least one call to either CALLBACK or ERROR_CALLBACK. This - function does not require any debug info for the executable. */ - -extern int backtrace_simple (struct backtrace_state *state, int skip, - backtrace_simple_callback callback, - backtrace_error_callback error_callback, - void *data); - -/* Print the current backtrace in a user readable format to a FILE. - SKIP is the number of frames to skip, as in backtrace_full. Any - error messages are printed to stderr. This function requires debug - info for the executable. */ - -extern void backtrace_print (struct backtrace_state *state, int skip, FILE *); - -/* Given PC, a program counter in the current program, call the - callback function with filename, line number, and function name - information. This will normally call the callback function exactly - once. However, if the PC happens to describe an inlined call, and - the debugging information contains the necessary information, then - this may call the callback function multiple times. This will make - at least one call to either CALLBACK or ERROR_CALLBACK. This - returns the first non-zero value returned by CALLBACK, or 0. */ - -extern int backtrace_pcinfo (struct backtrace_state *state, uintptr_t pc, - backtrace_full_callback callback, - backtrace_error_callback error_callback, - void *data); - -/* The type of the callback argument to backtrace_syminfo. DATA and - PC are the arguments passed to backtrace_syminfo. SYMNAME is the - name of the symbol for the corresponding code. SYMVAL is the - value and SYMSIZE is the size of the symbol. SYMNAME will be NULL - if no error occurred but the symbol could not be found. */ - -typedef void (*backtrace_syminfo_callback) (void *data, uintptr_t pc, - const char *symname, - uintptr_t symval, - uintptr_t symsize); - -/* Given ADDR, an address or program counter in the current program, - call the callback information with the symbol name and value - describing the function or variable in which ADDR may be found. - This will call either CALLBACK or ERROR_CALLBACK exactly once. - This returns 1 on success, 0 on failure. This function requires - the symbol table but does not require the debug info. Note that if - the symbol table is present but ADDR could not be found in the - table, CALLBACK will be called with a NULL SYMNAME argument. - Returns 1 on success, 0 on error. */ - -extern int backtrace_syminfo (struct backtrace_state *state, uintptr_t addr, - backtrace_syminfo_callback callback, - backtrace_error_callback error_callback, - void *data); - -#ifdef __cplusplus -} /* End extern "C". */ -#endif - -#endif diff --git a/contrib/libs/backtrace/config-armv7a.h b/contrib/libs/backtrace/config-armv7a.h deleted file mode 100644 index 2e036a2b5e..0000000000 --- a/contrib/libs/backtrace/config-armv7a.h +++ /dev/null @@ -1,2 +0,0 @@ -#include "config-linux.h" -#undef HAVE_GETIPINFO diff --git a/contrib/libs/backtrace/config-linux.h b/contrib/libs/backtrace/config-linux.h deleted file mode 100644 index 8cec45b181..0000000000 --- a/contrib/libs/backtrace/config-linux.h +++ /dev/null @@ -1,173 +0,0 @@ -/* config.h. Generated from config.h.in by configure. */ -/* config.h.in. Generated from configure.ac by autoheader. */ - -/* ELF size: 32 or 64 */ -#define BACKTRACE_ELF_SIZE 64 - -/* XCOFF size: 32 or 64 */ -#define BACKTRACE_XCOFF_SIZE unused - -/* Define to 1 if you have the __atomic functions */ -#define HAVE_ATOMIC_FUNCTIONS 1 - -/* Define to 1 if you have the `clock_gettime' function. */ -#define HAVE_CLOCK_GETTIME 1 - -/* Define to 1 if you have the declaration of `getpagesize', and to 0 if you - don't. */ -#define HAVE_DECL_GETPAGESIZE 1 - -/* Define to 1 if you have the declaration of `strnlen', and to 0 if you - don't. */ -#define HAVE_DECL_STRNLEN 1 - -/* Define to 1 if you have the <dlfcn.h> header file. */ -#define HAVE_DLFCN_H 1 - -/* Define if dl_iterate_phdr is available. */ -#define HAVE_DL_ITERATE_PHDR 1 - -/* Define to 1 if you have the fcntl function */ -#define HAVE_FCNTL 1 - -/* Define if getexecname is available. */ -/* #undef HAVE_GETEXECNAME */ - -/* Define if _Unwind_GetIPInfo is available. */ -#define HAVE_GETIPINFO 1 - -/* Define to 1 if you have the <inttypes.h> header file. */ -#define HAVE_INTTYPES_H 1 - -/* Define to 1 if you have KERN_PROC and KERN_PROC_PATHNAME in <sys/sysctl.h>. - */ -/* #undef HAVE_KERN_PROC */ - -/* Define to 1 if you have KERN_PROCARGS and KERN_PROC_PATHNAME in - <sys/sysctl.h>. */ -/* #undef HAVE_KERN_PROC_ARGS */ - -/* Define if -llzma is available. */ -/* #undef HAVE_LIBLZMA */ - -/* Define to 1 if you have the <link.h> header file. */ -#define HAVE_LINK_H 1 - -/* Define if AIX loadquery is available. */ -/* #undef HAVE_LOADQUERY */ - -/* Define to 1 if you have the `lstat' function. */ -#define HAVE_LSTAT 1 - -/* Define to 1 if you have the <mach-o/dyld.h> header file. */ -/* #undef HAVE_MACH_O_DYLD_H */ - -/* Define to 1 if you have the <memory.h> header file. */ -#define HAVE_MEMORY_H 1 - -/* Define to 1 if you have the `readlink' function. */ -#define HAVE_READLINK 1 - -/* Define to 1 if you have the <stdint.h> header file. */ -#define HAVE_STDINT_H 1 - -/* Define to 1 if you have the <stdlib.h> header file. */ -#define HAVE_STDLIB_H 1 - -/* Define to 1 if you have the <strings.h> header file. */ -#define HAVE_STRINGS_H 1 - -/* Define to 1 if you have the <string.h> header file. */ -#define HAVE_STRING_H 1 - -/* Define to 1 if you have the __sync functions */ -#define HAVE_SYNC_FUNCTIONS 1 - -/* Define to 1 if you have the <sys/ldr.h> header file. */ -/* #undef HAVE_SYS_LDR_H */ - -/* Define to 1 if you have the <sys/link.h> header file. */ -/* #undef HAVE_SYS_LINK_H */ - -/* Define to 1 if you have the <sys/mman.h> header file. */ -#define HAVE_SYS_MMAN_H 1 - -/* Define to 1 if you have the <sys/stat.h> header file. */ -#define HAVE_SYS_STAT_H 1 - -/* Define to 1 if you have the <sys/types.h> header file. */ -#define HAVE_SYS_TYPES_H 1 - -/* Define to 1 if you have the <unistd.h> header file. */ -#define HAVE_UNISTD_H 1 - -/* Define if -lz is available. */ -/* #undef HAVE_ZLIB */ - -/* Define to the sub-directory in which libtool stores uninstalled libraries. - */ -#define LT_OBJDIR ".libs/" - -/* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "" - -/* Define to the full name of this package. */ -#define PACKAGE_NAME "package-unused" - -/* Define to the full name and version of this package. */ -#define PACKAGE_STRING "package-unused version-unused" - -/* Define to the one symbol short name of this package. */ -#define PACKAGE_TARNAME "libbacktrace" - -/* Define to the home page for this package. */ -#define PACKAGE_URL "" - -/* Define to the version of this package. */ -#define PACKAGE_VERSION "version-unused" - -/* Define to 1 if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Enable extensions on AIX 3, Interix. */ -#ifndef _ALL_SOURCE -# define _ALL_SOURCE 1 -#endif -/* Enable GNU extensions on systems that have them. */ -#ifndef _GNU_SOURCE -# define _GNU_SOURCE 1 -#endif -/* Enable threading extensions on Solaris. */ -#ifndef _POSIX_PTHREAD_SEMANTICS -# define _POSIX_PTHREAD_SEMANTICS 1 -#endif -/* Enable extensions on HP NonStop. */ -#ifndef _TANDEM_SOURCE -# define _TANDEM_SOURCE 1 -#endif -/* Enable general extensions on Solaris. */ -#ifndef __EXTENSIONS__ -# define __EXTENSIONS__ 1 -#endif - - -/* Enable large inode numbers on Mac OS X 10.5. */ -#ifndef _DARWIN_USE_64_BIT_INODE -# define _DARWIN_USE_64_BIT_INODE 1 -#endif - -/* Number of bits in a file offset, on hosts where this is settable. */ -/* #undef _FILE_OFFSET_BITS */ - -/* Define for large files, on AIX-style hosts. */ -/* #undef _LARGE_FILES */ - -/* Define to 1 if on MINIX. */ -/* #undef _MINIX */ - -/* Define to 2 if the system does not provide POSIX.1 features except with - this defined. */ -/* #undef _POSIX_1_SOURCE */ - -/* Define to 1 if you need to in order for `stat' and other things to work. */ -/* #undef _POSIX_SOURCE */ diff --git a/contrib/libs/backtrace/config-osx.h b/contrib/libs/backtrace/config-osx.h deleted file mode 100644 index ab7295ea4c..0000000000 --- a/contrib/libs/backtrace/config-osx.h +++ /dev/null @@ -1,7 +0,0 @@ -#pragma once -#include "config-linux.h" - -/* Set the defines to use dyld instead of ld on macOS */ -#undef HAVE_DL_ITERATE_PHDR -#undef HAVE_LINK_H -#define HAVE_MACH_O_DYLD_H 1 diff --git a/contrib/libs/backtrace/config.h b/contrib/libs/backtrace/config.h deleted file mode 100644 index 44ded9375a..0000000000 --- a/contrib/libs/backtrace/config.h +++ /dev/null @@ -1,11 +0,0 @@ -#pragma once - -#if defined(__APPLE__) -# include "config-osx.h" -#else -# include "config-linux.h" -#endif - -#if defined(__arm__) || defined(__ARM__) -# include "config-armv7a.h" -#endif diff --git a/contrib/libs/backtrace/dwarf.c b/contrib/libs/backtrace/dwarf.c deleted file mode 100644 index 5b2724e6a7..0000000000 --- a/contrib/libs/backtrace/dwarf.c +++ /dev/null @@ -1,4402 +0,0 @@ -/* dwarf.c -- Get file/line information from DWARF for backtraces. - Copyright (C) 2012-2021 Free Software Foundation, Inc. - Written by Ian Lance Taylor, Google. - -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) The name of the author may not be used to - endorse or promote products derived from this software without - specific prior written permission. - -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. */ - -#include "config.h" - -#include <errno.h> -#include <stdlib.h> -#include <string.h> -#include <sys/types.h> - -#include "filenames.h" - -#include "backtrace.h" -#include "internal.h" - -/* DWARF constants. */ - -enum dwarf_tag { - DW_TAG_entry_point = 0x3, - DW_TAG_compile_unit = 0x11, - DW_TAG_inlined_subroutine = 0x1d, - DW_TAG_subprogram = 0x2e, - DW_TAG_skeleton_unit = 0x4a, -}; - -enum dwarf_form { - DW_FORM_addr = 0x01, - DW_FORM_block2 = 0x03, - DW_FORM_block4 = 0x04, - DW_FORM_data2 = 0x05, - DW_FORM_data4 = 0x06, - DW_FORM_data8 = 0x07, - DW_FORM_string = 0x08, - DW_FORM_block = 0x09, - DW_FORM_block1 = 0x0a, - DW_FORM_data1 = 0x0b, - DW_FORM_flag = 0x0c, - DW_FORM_sdata = 0x0d, - DW_FORM_strp = 0x0e, - DW_FORM_udata = 0x0f, - DW_FORM_ref_addr = 0x10, - DW_FORM_ref1 = 0x11, - DW_FORM_ref2 = 0x12, - DW_FORM_ref4 = 0x13, - DW_FORM_ref8 = 0x14, - DW_FORM_ref_udata = 0x15, - DW_FORM_indirect = 0x16, - DW_FORM_sec_offset = 0x17, - DW_FORM_exprloc = 0x18, - DW_FORM_flag_present = 0x19, - DW_FORM_ref_sig8 = 0x20, - DW_FORM_strx = 0x1a, - DW_FORM_addrx = 0x1b, - DW_FORM_ref_sup4 = 0x1c, - DW_FORM_strp_sup = 0x1d, - DW_FORM_data16 = 0x1e, - DW_FORM_line_strp = 0x1f, - DW_FORM_implicit_const = 0x21, - DW_FORM_loclistx = 0x22, - DW_FORM_rnglistx = 0x23, - DW_FORM_ref_sup8 = 0x24, - DW_FORM_strx1 = 0x25, - DW_FORM_strx2 = 0x26, - DW_FORM_strx3 = 0x27, - DW_FORM_strx4 = 0x28, - DW_FORM_addrx1 = 0x29, - DW_FORM_addrx2 = 0x2a, - DW_FORM_addrx3 = 0x2b, - DW_FORM_addrx4 = 0x2c, - DW_FORM_GNU_addr_index = 0x1f01, - DW_FORM_GNU_str_index = 0x1f02, - DW_FORM_GNU_ref_alt = 0x1f20, - DW_FORM_GNU_strp_alt = 0x1f21 -}; - -enum dwarf_attribute { - DW_AT_sibling = 0x01, - DW_AT_location = 0x02, - DW_AT_name = 0x03, - DW_AT_ordering = 0x09, - DW_AT_subscr_data = 0x0a, - DW_AT_byte_size = 0x0b, - DW_AT_bit_offset = 0x0c, - DW_AT_bit_size = 0x0d, - DW_AT_element_list = 0x0f, - DW_AT_stmt_list = 0x10, - DW_AT_low_pc = 0x11, - DW_AT_high_pc = 0x12, - DW_AT_language = 0x13, - DW_AT_member = 0x14, - DW_AT_discr = 0x15, - DW_AT_discr_value = 0x16, - DW_AT_visibility = 0x17, - DW_AT_import = 0x18, - DW_AT_string_length = 0x19, - DW_AT_common_reference = 0x1a, - DW_AT_comp_dir = 0x1b, - DW_AT_const_value = 0x1c, - DW_AT_containing_type = 0x1d, - DW_AT_default_value = 0x1e, - DW_AT_inline = 0x20, - DW_AT_is_optional = 0x21, - DW_AT_lower_bound = 0x22, - DW_AT_producer = 0x25, - DW_AT_prototyped = 0x27, - DW_AT_return_addr = 0x2a, - DW_AT_start_scope = 0x2c, - DW_AT_bit_stride = 0x2e, - DW_AT_upper_bound = 0x2f, - DW_AT_abstract_origin = 0x31, - DW_AT_accessibility = 0x32, - DW_AT_address_class = 0x33, - DW_AT_artificial = 0x34, - DW_AT_base_types = 0x35, - DW_AT_calling_convention = 0x36, - DW_AT_count = 0x37, - DW_AT_data_member_location = 0x38, - DW_AT_decl_column = 0x39, - DW_AT_decl_file = 0x3a, - DW_AT_decl_line = 0x3b, - DW_AT_declaration = 0x3c, - DW_AT_discr_list = 0x3d, - DW_AT_encoding = 0x3e, - DW_AT_external = 0x3f, - DW_AT_frame_base = 0x40, - DW_AT_friend = 0x41, - DW_AT_identifier_case = 0x42, - DW_AT_macro_info = 0x43, - DW_AT_namelist_items = 0x44, - DW_AT_priority = 0x45, - DW_AT_segment = 0x46, - DW_AT_specification = 0x47, - DW_AT_static_link = 0x48, - DW_AT_type = 0x49, - DW_AT_use_location = 0x4a, - DW_AT_variable_parameter = 0x4b, - DW_AT_virtuality = 0x4c, - DW_AT_vtable_elem_location = 0x4d, - DW_AT_allocated = 0x4e, - DW_AT_associated = 0x4f, - DW_AT_data_location = 0x50, - DW_AT_byte_stride = 0x51, - DW_AT_entry_pc = 0x52, - DW_AT_use_UTF8 = 0x53, - DW_AT_extension = 0x54, - DW_AT_ranges = 0x55, - DW_AT_trampoline = 0x56, - DW_AT_call_column = 0x57, - DW_AT_call_file = 0x58, - DW_AT_call_line = 0x59, - DW_AT_description = 0x5a, - DW_AT_binary_scale = 0x5b, - DW_AT_decimal_scale = 0x5c, - DW_AT_small = 0x5d, - DW_AT_decimal_sign = 0x5e, - DW_AT_digit_count = 0x5f, - DW_AT_picture_string = 0x60, - DW_AT_mutable = 0x61, - DW_AT_threads_scaled = 0x62, - DW_AT_explicit = 0x63, - DW_AT_object_pointer = 0x64, - DW_AT_endianity = 0x65, - DW_AT_elemental = 0x66, - DW_AT_pure = 0x67, - DW_AT_recursive = 0x68, - DW_AT_signature = 0x69, - DW_AT_main_subprogram = 0x6a, - DW_AT_data_bit_offset = 0x6b, - DW_AT_const_expr = 0x6c, - DW_AT_enum_class = 0x6d, - DW_AT_linkage_name = 0x6e, - DW_AT_string_length_bit_size = 0x6f, - DW_AT_string_length_byte_size = 0x70, - DW_AT_rank = 0x71, - DW_AT_str_offsets_base = 0x72, - DW_AT_addr_base = 0x73, - DW_AT_rnglists_base = 0x74, - DW_AT_dwo_name = 0x76, - DW_AT_reference = 0x77, - DW_AT_rvalue_reference = 0x78, - DW_AT_macros = 0x79, - DW_AT_call_all_calls = 0x7a, - DW_AT_call_all_source_calls = 0x7b, - DW_AT_call_all_tail_calls = 0x7c, - DW_AT_call_return_pc = 0x7d, - DW_AT_call_value = 0x7e, - DW_AT_call_origin = 0x7f, - DW_AT_call_parameter = 0x80, - DW_AT_call_pc = 0x81, - DW_AT_call_tail_call = 0x82, - DW_AT_call_target = 0x83, - DW_AT_call_target_clobbered = 0x84, - DW_AT_call_data_location = 0x85, - DW_AT_call_data_value = 0x86, - DW_AT_noreturn = 0x87, - DW_AT_alignment = 0x88, - DW_AT_export_symbols = 0x89, - DW_AT_deleted = 0x8a, - DW_AT_defaulted = 0x8b, - DW_AT_loclists_base = 0x8c, - DW_AT_lo_user = 0x2000, - DW_AT_hi_user = 0x3fff, - DW_AT_MIPS_fde = 0x2001, - DW_AT_MIPS_loop_begin = 0x2002, - DW_AT_MIPS_tail_loop_begin = 0x2003, - DW_AT_MIPS_epilog_begin = 0x2004, - DW_AT_MIPS_loop_unroll_factor = 0x2005, - DW_AT_MIPS_software_pipeline_depth = 0x2006, - DW_AT_MIPS_linkage_name = 0x2007, - DW_AT_MIPS_stride = 0x2008, - DW_AT_MIPS_abstract_name = 0x2009, - DW_AT_MIPS_clone_origin = 0x200a, - DW_AT_MIPS_has_inlines = 0x200b, - DW_AT_HP_block_index = 0x2000, - DW_AT_HP_unmodifiable = 0x2001, - DW_AT_HP_prologue = 0x2005, - DW_AT_HP_epilogue = 0x2008, - DW_AT_HP_actuals_stmt_list = 0x2010, - DW_AT_HP_proc_per_section = 0x2011, - DW_AT_HP_raw_data_ptr = 0x2012, - DW_AT_HP_pass_by_reference = 0x2013, - DW_AT_HP_opt_level = 0x2014, - DW_AT_HP_prof_version_id = 0x2015, - DW_AT_HP_opt_flags = 0x2016, - DW_AT_HP_cold_region_low_pc = 0x2017, - DW_AT_HP_cold_region_high_pc = 0x2018, - DW_AT_HP_all_variables_modifiable = 0x2019, - DW_AT_HP_linkage_name = 0x201a, - DW_AT_HP_prof_flags = 0x201b, - DW_AT_HP_unit_name = 0x201f, - DW_AT_HP_unit_size = 0x2020, - DW_AT_HP_widened_byte_size = 0x2021, - DW_AT_HP_definition_points = 0x2022, - DW_AT_HP_default_location = 0x2023, - DW_AT_HP_is_result_param = 0x2029, - DW_AT_sf_names = 0x2101, - DW_AT_src_info = 0x2102, - DW_AT_mac_info = 0x2103, - DW_AT_src_coords = 0x2104, - DW_AT_body_begin = 0x2105, - DW_AT_body_end = 0x2106, - DW_AT_GNU_vector = 0x2107, - DW_AT_GNU_guarded_by = 0x2108, - DW_AT_GNU_pt_guarded_by = 0x2109, - DW_AT_GNU_guarded = 0x210a, - DW_AT_GNU_pt_guarded = 0x210b, - DW_AT_GNU_locks_excluded = 0x210c, - DW_AT_GNU_exclusive_locks_required = 0x210d, - DW_AT_GNU_shared_locks_required = 0x210e, - DW_AT_GNU_odr_signature = 0x210f, - DW_AT_GNU_template_name = 0x2110, - DW_AT_GNU_call_site_value = 0x2111, - DW_AT_GNU_call_site_data_value = 0x2112, - DW_AT_GNU_call_site_target = 0x2113, - DW_AT_GNU_call_site_target_clobbered = 0x2114, - DW_AT_GNU_tail_call = 0x2115, - DW_AT_GNU_all_tail_call_sites = 0x2116, - DW_AT_GNU_all_call_sites = 0x2117, - DW_AT_GNU_all_source_call_sites = 0x2118, - DW_AT_GNU_macros = 0x2119, - DW_AT_GNU_deleted = 0x211a, - DW_AT_GNU_dwo_name = 0x2130, - DW_AT_GNU_dwo_id = 0x2131, - DW_AT_GNU_ranges_base = 0x2132, - DW_AT_GNU_addr_base = 0x2133, - DW_AT_GNU_pubnames = 0x2134, - DW_AT_GNU_pubtypes = 0x2135, - DW_AT_GNU_discriminator = 0x2136, - DW_AT_GNU_locviews = 0x2137, - DW_AT_GNU_entry_view = 0x2138, - DW_AT_VMS_rtnbeg_pd_address = 0x2201, - DW_AT_use_GNAT_descriptive_type = 0x2301, - DW_AT_GNAT_descriptive_type = 0x2302, - DW_AT_GNU_numerator = 0x2303, - DW_AT_GNU_denominator = 0x2304, - DW_AT_GNU_bias = 0x2305, - DW_AT_upc_threads_scaled = 0x3210, - DW_AT_PGI_lbase = 0x3a00, - DW_AT_PGI_soffset = 0x3a01, - DW_AT_PGI_lstride = 0x3a02, - DW_AT_APPLE_optimized = 0x3fe1, - DW_AT_APPLE_flags = 0x3fe2, - DW_AT_APPLE_isa = 0x3fe3, - DW_AT_APPLE_block = 0x3fe4, - DW_AT_APPLE_major_runtime_vers = 0x3fe5, - DW_AT_APPLE_runtime_class = 0x3fe6, - DW_AT_APPLE_omit_frame_ptr = 0x3fe7, - DW_AT_APPLE_property_name = 0x3fe8, - DW_AT_APPLE_property_getter = 0x3fe9, - DW_AT_APPLE_property_setter = 0x3fea, - DW_AT_APPLE_property_attribute = 0x3feb, - DW_AT_APPLE_objc_complete_type = 0x3fec, - DW_AT_APPLE_property = 0x3fed -}; - -enum dwarf_line_number_op { - DW_LNS_extended_op = 0x0, - DW_LNS_copy = 0x1, - DW_LNS_advance_pc = 0x2, - DW_LNS_advance_line = 0x3, - DW_LNS_set_file = 0x4, - DW_LNS_set_column = 0x5, - DW_LNS_negate_stmt = 0x6, - DW_LNS_set_basic_block = 0x7, - DW_LNS_const_add_pc = 0x8, - DW_LNS_fixed_advance_pc = 0x9, - DW_LNS_set_prologue_end = 0xa, - DW_LNS_set_epilogue_begin = 0xb, - DW_LNS_set_isa = 0xc, -}; - -enum dwarf_extended_line_number_op { - DW_LNE_end_sequence = 0x1, - DW_LNE_set_address = 0x2, - DW_LNE_define_file = 0x3, - DW_LNE_set_discriminator = 0x4, -}; - -enum dwarf_line_number_content_type { - DW_LNCT_path = 0x1, - DW_LNCT_directory_index = 0x2, - DW_LNCT_timestamp = 0x3, - DW_LNCT_size = 0x4, - DW_LNCT_MD5 = 0x5, - DW_LNCT_lo_user = 0x2000, - DW_LNCT_hi_user = 0x3fff -}; - -enum dwarf_range_list_entry { - DW_RLE_end_of_list = 0x00, - DW_RLE_base_addressx = 0x01, - DW_RLE_startx_endx = 0x02, - DW_RLE_startx_length = 0x03, - DW_RLE_offset_pair = 0x04, - DW_RLE_base_address = 0x05, - DW_RLE_start_end = 0x06, - DW_RLE_start_length = 0x07 -}; - -enum dwarf_unit_type { - DW_UT_compile = 0x01, - DW_UT_type = 0x02, - DW_UT_partial = 0x03, - DW_UT_skeleton = 0x04, - DW_UT_split_compile = 0x05, - DW_UT_split_type = 0x06, - DW_UT_lo_user = 0x80, - DW_UT_hi_user = 0xff -}; - -#if !defined(HAVE_DECL_STRNLEN) || !HAVE_DECL_STRNLEN - -/* If strnlen is not declared, provide our own version. */ - -static size_t -xstrnlen (const char *s, size_t maxlen) -{ - size_t i; - - for (i = 0; i < maxlen; ++i) - if (s[i] == '\0') - break; - return i; -} - -#define strnlen xstrnlen - -#endif - -/* A buffer to read DWARF info. */ - -struct dwarf_buf -{ - /* Buffer name for error messages. */ - const char *name; - /* Start of the buffer. */ - const unsigned char *start; - /* Next byte to read. */ - const unsigned char *buf; - /* The number of bytes remaining. */ - size_t left; - /* Whether the data is big-endian. */ - int is_bigendian; - /* Error callback routine. */ - backtrace_error_callback error_callback; - /* Data for error_callback. */ - void *data; - /* Non-zero if we've reported an underflow error. */ - int reported_underflow; -}; - -/* A single attribute in a DWARF abbreviation. */ - -struct attr -{ - /* The attribute name. */ - enum dwarf_attribute name; - /* The attribute form. */ - enum dwarf_form form; - /* The attribute value, for DW_FORM_implicit_const. */ - int64_t val; -}; - -/* A single DWARF abbreviation. */ - -struct abbrev -{ - /* The abbrev code--the number used to refer to the abbrev. */ - uint64_t code; - /* The entry tag. */ - enum dwarf_tag tag; - /* Non-zero if this abbrev has child entries. */ - int has_children; - /* The number of attributes. */ - size_t num_attrs; - /* The attributes. */ - struct attr *attrs; -}; - -/* The DWARF abbreviations for a compilation unit. This structure - only exists while reading the compilation unit. Most DWARF readers - seem to a hash table to map abbrev ID's to abbrev entries. - However, we primarily care about GCC, and GCC simply issues ID's in - numerical order starting at 1. So we simply keep a sorted vector, - and try to just look up the code. */ - -struct abbrevs -{ - /* The number of abbrevs in the vector. */ - size_t num_abbrevs; - /* The abbrevs, sorted by the code field. */ - struct abbrev *abbrevs; -}; - -/* The different kinds of attribute values. */ - -enum attr_val_encoding -{ - /* No attribute value. */ - ATTR_VAL_NONE, - /* An address. */ - ATTR_VAL_ADDRESS, - /* An index into the .debug_addr section, whose value is relative to - * the DW_AT_addr_base attribute of the compilation unit. */ - ATTR_VAL_ADDRESS_INDEX, - /* A unsigned integer. */ - ATTR_VAL_UINT, - /* A sigd integer. */ - ATTR_VAL_SINT, - /* A string. */ - ATTR_VAL_STRING, - /* An index into the .debug_str_offsets section. */ - ATTR_VAL_STRING_INDEX, - /* An offset to other data in the containing unit. */ - ATTR_VAL_REF_UNIT, - /* An offset to other data within the .debug_info section. */ - ATTR_VAL_REF_INFO, - /* An offset to other data within the alt .debug_info section. */ - ATTR_VAL_REF_ALT_INFO, - /* An offset to data in some other section. */ - ATTR_VAL_REF_SECTION, - /* A type signature. */ - ATTR_VAL_REF_TYPE, - /* An index into the .debug_rnglists section. */ - ATTR_VAL_RNGLISTS_INDEX, - /* A block of data (not represented). */ - ATTR_VAL_BLOCK, - /* An expression (not represented). */ - ATTR_VAL_EXPR, -}; - -/* An attribute value. */ - -struct attr_val -{ - /* How the value is stored in the field u. */ - enum attr_val_encoding encoding; - union - { - /* ATTR_VAL_ADDRESS*, ATTR_VAL_UINT, ATTR_VAL_REF*. */ - uint64_t uint; - /* ATTR_VAL_SINT. */ - int64_t sint; - /* ATTR_VAL_STRING. */ - const char *string; - /* ATTR_VAL_BLOCK not stored. */ - } u; -}; - -/* The line number program header. */ - -struct line_header -{ - /* The version of the line number information. */ - int version; - /* Address size. */ - int addrsize; - /* The minimum instruction length. */ - unsigned int min_insn_len; - /* The maximum number of ops per instruction. */ - unsigned int max_ops_per_insn; - /* The line base for special opcodes. */ - int line_base; - /* The line range for special opcodes. */ - unsigned int line_range; - /* The opcode base--the first special opcode. */ - unsigned int opcode_base; - /* Opcode lengths, indexed by opcode - 1. */ - const unsigned char *opcode_lengths; - /* The number of directory entries. */ - size_t dirs_count; - /* The directory entries. */ - const char **dirs; - /* The number of filenames. */ - size_t filenames_count; - /* The filenames. */ - const char **filenames; -}; - -/* A format description from a line header. */ - -struct line_header_format -{ - int lnct; /* LNCT code. */ - enum dwarf_form form; /* Form of entry data. */ -}; - -/* Map a single PC value to a file/line. We will keep a vector of - these sorted by PC value. Each file/line will be correct from the - PC up to the PC of the next entry if there is one. We allocate one - extra entry at the end so that we can use bsearch. */ - -struct line -{ - /* PC. */ - uintptr_t pc; - /* File name. Many entries in the array are expected to point to - the same file name. */ - const char *filename; - /* Line number. */ - int lineno; - /* Index of the object in the original array read from the DWARF - section, before it has been sorted. The index makes it possible - to use Quicksort and maintain stability. */ - int idx; -}; - -/* A growable vector of line number information. This is used while - reading the line numbers. */ - -struct line_vector -{ - /* Memory. This is an array of struct line. */ - struct backtrace_vector vec; - /* Number of valid mappings. */ - size_t count; -}; - -/* A function described in the debug info. */ - -struct function -{ - /* The name of the function. */ - const char *name; - /* If this is an inlined function, the filename of the call - site. */ - const char *caller_filename; - /* If this is an inlined function, the line number of the call - site. */ - int caller_lineno; - /* Map PC ranges to inlined functions. */ - struct function_addrs *function_addrs; - size_t function_addrs_count; -}; - -/* An address range for a function. This maps a PC value to a - specific function. */ - -struct function_addrs -{ - /* Range is LOW <= PC < HIGH. */ - uint64_t low; - uint64_t high; - /* Function for this address range. */ - struct function *function; -}; - -/* A growable vector of function address ranges. */ - -struct function_vector -{ - /* Memory. This is an array of struct function_addrs. */ - struct backtrace_vector vec; - /* Number of address ranges present. */ - size_t count; -}; - -/* A DWARF compilation unit. This only holds the information we need - to map a PC to a file and line. */ - -struct unit -{ - /* The first entry for this compilation unit. */ - const unsigned char *unit_data; - /* The length of the data for this compilation unit. */ - size_t unit_data_len; - /* The offset of UNIT_DATA from the start of the information for - this compilation unit. */ - size_t unit_data_offset; - /* Offset of the start of the compilation unit from the start of the - .debug_info section. */ - size_t low_offset; - /* Offset of the end of the compilation unit from the start of the - .debug_info section. */ - size_t high_offset; - /* DWARF version. */ - int version; - /* Whether unit is DWARF64. */ - int is_dwarf64; - /* Address size. */ - int addrsize; - /* Offset into line number information. */ - off_t lineoff; - /* Offset of compilation unit in .debug_str_offsets. */ - uint64_t str_offsets_base; - /* Offset of compilation unit in .debug_addr. */ - uint64_t addr_base; - /* Offset of compilation unit in .debug_rnglists. */ - uint64_t rnglists_base; - /* Primary source file. */ - const char *filename; - /* Compilation command working directory. */ - const char *comp_dir; - /* Absolute file name, only set if needed. */ - const char *abs_filename; - /* The abbreviations for this unit. */ - struct abbrevs abbrevs; - - /* The fields above this point are read in during initialization and - may be accessed freely. The fields below this point are read in - as needed, and therefore require care, as different threads may - try to initialize them simultaneously. */ - - /* PC to line number mapping. This is NULL if the values have not - been read. This is (struct line *) -1 if there was an error - reading the values. */ - struct line *lines; - /* Number of entries in lines. */ - size_t lines_count; - /* PC ranges to function. */ - struct function_addrs *function_addrs; - size_t function_addrs_count; -}; - -/* An address range for a compilation unit. This maps a PC value to a - specific compilation unit. Note that we invert the representation - in DWARF: instead of listing the units and attaching a list of - ranges, we list the ranges and have each one point to the unit. - This lets us do a binary search to find the unit. */ - -struct unit_addrs -{ - /* Range is LOW <= PC < HIGH. */ - uint64_t low; - uint64_t high; - /* Compilation unit for this address range. */ - struct unit *u; -}; - -/* A growable vector of compilation unit address ranges. */ - -struct unit_addrs_vector -{ - /* Memory. This is an array of struct unit_addrs. */ - struct backtrace_vector vec; - /* Number of address ranges present. */ - size_t count; -}; - -/* A growable vector of compilation unit pointer. */ - -struct unit_vector -{ - struct backtrace_vector vec; - size_t count; -}; - -/* The information we need to map a PC to a file and line. */ - -struct dwarf_data -{ - /* The data for the next file we know about. */ - struct dwarf_data *next; - /* The data for .gnu_debugaltlink. */ - struct dwarf_data *altlink; - /* The base address for this file. */ - uintptr_t base_address; - /* A sorted list of address ranges. */ - struct unit_addrs *addrs; - /* Number of address ranges in list. */ - size_t addrs_count; - /* A sorted list of units. */ - struct unit **units; - /* Number of units in the list. */ - size_t units_count; - /* The unparsed DWARF debug data. */ - struct dwarf_sections dwarf_sections; - /* Whether the data is big-endian or not. */ - int is_bigendian; - /* A vector used for function addresses. We keep this here so that - we can grow the vector as we read more functions. */ - struct function_vector fvec; -}; - -/* Report an error for a DWARF buffer. */ - -static void -dwarf_buf_error (struct dwarf_buf *buf, const char *msg, int errnum) -{ - char b[200]; - - snprintf (b, sizeof b, "%s in %s at %d", - msg, buf->name, (int) (buf->buf - buf->start)); - buf->error_callback (buf->data, b, errnum); -} - -/* Require at least COUNT bytes in BUF. Return 1 if all is well, 0 on - error. */ - -static int -require (struct dwarf_buf *buf, size_t count) -{ - if (buf->left >= count) - return 1; - - if (!buf->reported_underflow) - { - dwarf_buf_error (buf, "DWARF underflow", 0); - buf->reported_underflow = 1; - } - - return 0; -} - -/* Advance COUNT bytes in BUF. Return 1 if all is well, 0 on - error. */ - -static int -advance (struct dwarf_buf *buf, size_t count) -{ - if (!require (buf, count)) - return 0; - buf->buf += count; - buf->left -= count; - return 1; -} - -/* Read one zero-terminated string from BUF and advance past the string. */ - -static const char * -read_string (struct dwarf_buf *buf) -{ - const char *p = (const char *)buf->buf; - size_t len = strnlen (p, buf->left); - - /* - If len == left, we ran out of buffer before finding the zero terminator. - Generate an error by advancing len + 1. - - If len < left, advance by len + 1 to skip past the zero terminator. */ - size_t count = len + 1; - - if (!advance (buf, count)) - return NULL; - - return p; -} - -/* Read one byte from BUF and advance 1 byte. */ - -static unsigned char -read_byte (struct dwarf_buf *buf) -{ - const unsigned char *p = buf->buf; - - if (!advance (buf, 1)) - return 0; - return p[0]; -} - -/* Read a signed char from BUF and advance 1 byte. */ - -static signed char -read_sbyte (struct dwarf_buf *buf) -{ - const unsigned char *p = buf->buf; - - if (!advance (buf, 1)) - return 0; - return (*p ^ 0x80) - 0x80; -} - -/* Read a uint16 from BUF and advance 2 bytes. */ - -static uint16_t -read_uint16 (struct dwarf_buf *buf) -{ - const unsigned char *p = buf->buf; - - if (!advance (buf, 2)) - return 0; - if (buf->is_bigendian) - return ((uint16_t) p[0] << 8) | (uint16_t) p[1]; - else - return ((uint16_t) p[1] << 8) | (uint16_t) p[0]; -} - -/* Read a 24 bit value from BUF and advance 3 bytes. */ - -static uint32_t -read_uint24 (struct dwarf_buf *buf) -{ - const unsigned char *p = buf->buf; - - if (!advance (buf, 3)) - return 0; - if (buf->is_bigendian) - return (((uint32_t) p[0] << 16) | ((uint32_t) p[1] << 8) - | (uint32_t) p[2]); - else - return (((uint32_t) p[2] << 16) | ((uint32_t) p[1] << 8) - | (uint32_t) p[0]); -} - -/* Read a uint32 from BUF and advance 4 bytes. */ - -static uint32_t -read_uint32 (struct dwarf_buf *buf) -{ - const unsigned char *p = buf->buf; - - if (!advance (buf, 4)) - return 0; - if (buf->is_bigendian) - return (((uint32_t) p[0] << 24) | ((uint32_t) p[1] << 16) - | ((uint32_t) p[2] << 8) | (uint32_t) p[3]); - else - return (((uint32_t) p[3] << 24) | ((uint32_t) p[2] << 16) - | ((uint32_t) p[1] << 8) | (uint32_t) p[0]); -} - -/* Read a uint64 from BUF and advance 8 bytes. */ - -static uint64_t -read_uint64 (struct dwarf_buf *buf) -{ - const unsigned char *p = buf->buf; - - if (!advance (buf, 8)) - return 0; - if (buf->is_bigendian) - return (((uint64_t) p[0] << 56) | ((uint64_t) p[1] << 48) - | ((uint64_t) p[2] << 40) | ((uint64_t) p[3] << 32) - | ((uint64_t) p[4] << 24) | ((uint64_t) p[5] << 16) - | ((uint64_t) p[6] << 8) | (uint64_t) p[7]); - else - return (((uint64_t) p[7] << 56) | ((uint64_t) p[6] << 48) - | ((uint64_t) p[5] << 40) | ((uint64_t) p[4] << 32) - | ((uint64_t) p[3] << 24) | ((uint64_t) p[2] << 16) - | ((uint64_t) p[1] << 8) | (uint64_t) p[0]); -} - -/* Read an offset from BUF and advance the appropriate number of - bytes. */ - -static uint64_t -read_offset (struct dwarf_buf *buf, int is_dwarf64) -{ - if (is_dwarf64) - return read_uint64 (buf); - else - return read_uint32 (buf); -} - -/* Read an address from BUF and advance the appropriate number of - bytes. */ - -static uint64_t -read_address (struct dwarf_buf *buf, int addrsize) -{ - switch (addrsize) - { - case 1: - return read_byte (buf); - case 2: - return read_uint16 (buf); - case 4: - return read_uint32 (buf); - case 8: - return read_uint64 (buf); - default: - dwarf_buf_error (buf, "unrecognized address size", 0); - return 0; - } -} - -/* Return whether a value is the highest possible address, given the - address size. */ - -static int -is_highest_address (uint64_t address, int addrsize) -{ - switch (addrsize) - { - case 1: - return address == (unsigned char) -1; - case 2: - return address == (uint16_t) -1; - case 4: - return address == (uint32_t) -1; - case 8: - return address == (uint64_t) -1; - default: - return 0; - } -} - -/* Read an unsigned LEB128 number. */ - -static uint64_t -read_uleb128 (struct dwarf_buf *buf) -{ - uint64_t ret; - unsigned int shift; - int overflow; - unsigned char b; - - ret = 0; - shift = 0; - overflow = 0; - do - { - const unsigned char *p; - - p = buf->buf; - if (!advance (buf, 1)) - return 0; - b = *p; - if (shift < 64) - ret |= ((uint64_t) (b & 0x7f)) << shift; - else if (!overflow) - { - dwarf_buf_error (buf, "LEB128 overflows uint64_t", 0); - overflow = 1; - } - shift += 7; - } - while ((b & 0x80) != 0); - - return ret; -} - -/* Read a signed LEB128 number. */ - -static int64_t -read_sleb128 (struct dwarf_buf *buf) -{ - uint64_t val; - unsigned int shift; - int overflow; - unsigned char b; - - val = 0; - shift = 0; - overflow = 0; - do - { - const unsigned char *p; - - p = buf->buf; - if (!advance (buf, 1)) - return 0; - b = *p; - if (shift < 64) - val |= ((uint64_t) (b & 0x7f)) << shift; - else if (!overflow) - { - dwarf_buf_error (buf, "signed LEB128 overflows uint64_t", 0); - overflow = 1; - } - shift += 7; - } - while ((b & 0x80) != 0); - - if ((b & 0x40) != 0 && shift < 64) - val |= ((uint64_t) -1) << shift; - - return (int64_t) val; -} - -/* Return the length of an LEB128 number. */ - -static size_t -leb128_len (const unsigned char *p) -{ - size_t ret; - - ret = 1; - while ((*p & 0x80) != 0) - { - ++p; - ++ret; - } - return ret; -} - -/* Read initial_length from BUF and advance the appropriate number of bytes. */ - -static uint64_t -read_initial_length (struct dwarf_buf *buf, int *is_dwarf64) -{ - uint64_t len; - - len = read_uint32 (buf); - if (len == 0xffffffff) - { - len = read_uint64 (buf); - *is_dwarf64 = 1; - } - else - *is_dwarf64 = 0; - - return len; -} - -/* Free an abbreviations structure. */ - -static void -free_abbrevs (struct backtrace_state *state, struct abbrevs *abbrevs, - backtrace_error_callback error_callback, void *data) -{ - size_t i; - - for (i = 0; i < abbrevs->num_abbrevs; ++i) - backtrace_free (state, abbrevs->abbrevs[i].attrs, - abbrevs->abbrevs[i].num_attrs * sizeof (struct attr), - error_callback, data); - backtrace_free (state, abbrevs->abbrevs, - abbrevs->num_abbrevs * sizeof (struct abbrev), - error_callback, data); - abbrevs->num_abbrevs = 0; - abbrevs->abbrevs = NULL; -} - -/* Read an attribute value. Returns 1 on success, 0 on failure. If - the value can be represented as a uint64_t, sets *VAL and sets - *IS_VALID to 1. We don't try to store the value of other attribute - forms, because we don't care about them. */ - -static int -read_attribute (enum dwarf_form form, uint64_t implicit_val, - struct dwarf_buf *buf, int is_dwarf64, int version, - int addrsize, const struct dwarf_sections *dwarf_sections, - struct dwarf_data *altlink, struct attr_val *val) -{ - /* Avoid warnings about val.u.FIELD may be used uninitialized if - this function is inlined. The warnings aren't valid but can - occur because the different fields are set and used - conditionally. */ - memset (val, 0, sizeof *val); - - switch (form) - { - case DW_FORM_addr: - val->encoding = ATTR_VAL_ADDRESS; - val->u.uint = read_address (buf, addrsize); - return 1; - case DW_FORM_block2: - val->encoding = ATTR_VAL_BLOCK; - return advance (buf, read_uint16 (buf)); - case DW_FORM_block4: - val->encoding = ATTR_VAL_BLOCK; - return advance (buf, read_uint32 (buf)); - case DW_FORM_data2: - val->encoding = ATTR_VAL_UINT; - val->u.uint = read_uint16 (buf); - return 1; - case DW_FORM_data4: - val->encoding = ATTR_VAL_UINT; - val->u.uint = read_uint32 (buf); - return 1; - case DW_FORM_data8: - val->encoding = ATTR_VAL_UINT; - val->u.uint = read_uint64 (buf); - return 1; - case DW_FORM_data16: - val->encoding = ATTR_VAL_BLOCK; - return advance (buf, 16); - case DW_FORM_string: - val->encoding = ATTR_VAL_STRING; - val->u.string = read_string (buf); - return val->u.string == NULL ? 0 : 1; - case DW_FORM_block: - val->encoding = ATTR_VAL_BLOCK; - return advance (buf, read_uleb128 (buf)); - case DW_FORM_block1: - val->encoding = ATTR_VAL_BLOCK; - return advance (buf, read_byte (buf)); - case DW_FORM_data1: - val->encoding = ATTR_VAL_UINT; - val->u.uint = read_byte (buf); - return 1; - case DW_FORM_flag: - val->encoding = ATTR_VAL_UINT; - val->u.uint = read_byte (buf); - return 1; - case DW_FORM_sdata: - val->encoding = ATTR_VAL_SINT; - val->u.sint = read_sleb128 (buf); - return 1; - case DW_FORM_strp: - { - uint64_t offset; - - offset = read_offset (buf, is_dwarf64); - if (offset >= dwarf_sections->size[DEBUG_STR]) - { - dwarf_buf_error (buf, "DW_FORM_strp out of range", 0); - return 0; - } - val->encoding = ATTR_VAL_STRING; - val->u.string = - (const char *) dwarf_sections->data[DEBUG_STR] + offset; - return 1; - } - case DW_FORM_line_strp: - { - uint64_t offset; - - offset = read_offset (buf, is_dwarf64); - if (offset >= dwarf_sections->size[DEBUG_LINE_STR]) - { - dwarf_buf_error (buf, "DW_FORM_line_strp out of range", 0); - return 0; - } - val->encoding = ATTR_VAL_STRING; - val->u.string = - (const char *) dwarf_sections->data[DEBUG_LINE_STR] + offset; - return 1; - } - case DW_FORM_udata: - val->encoding = ATTR_VAL_UINT; - val->u.uint = read_uleb128 (buf); - return 1; - case DW_FORM_ref_addr: - val->encoding = ATTR_VAL_REF_INFO; - if (version == 2) - val->u.uint = read_address (buf, addrsize); - else - val->u.uint = read_offset (buf, is_dwarf64); - return 1; - case DW_FORM_ref1: - val->encoding = ATTR_VAL_REF_UNIT; - val->u.uint = read_byte (buf); - return 1; - case DW_FORM_ref2: - val->encoding = ATTR_VAL_REF_UNIT; - val->u.uint = read_uint16 (buf); - return 1; - case DW_FORM_ref4: - val->encoding = ATTR_VAL_REF_UNIT; - val->u.uint = read_uint32 (buf); - return 1; - case DW_FORM_ref8: - val->encoding = ATTR_VAL_REF_UNIT; - val->u.uint = read_uint64 (buf); - return 1; - case DW_FORM_ref_udata: - val->encoding = ATTR_VAL_REF_UNIT; - val->u.uint = read_uleb128 (buf); - return 1; - case DW_FORM_indirect: - { - uint64_t form; - - form = read_uleb128 (buf); - if (form == DW_FORM_implicit_const) - { - dwarf_buf_error (buf, - "DW_FORM_indirect to DW_FORM_implicit_const", - 0); - return 0; - } - return read_attribute ((enum dwarf_form) form, 0, buf, is_dwarf64, - version, addrsize, dwarf_sections, altlink, - val); - } - case DW_FORM_sec_offset: - val->encoding = ATTR_VAL_REF_SECTION; - val->u.uint = read_offset (buf, is_dwarf64); - return 1; - case DW_FORM_exprloc: - val->encoding = ATTR_VAL_EXPR; - return advance (buf, read_uleb128 (buf)); - case DW_FORM_flag_present: - val->encoding = ATTR_VAL_UINT; - val->u.uint = 1; - return 1; - case DW_FORM_ref_sig8: - val->encoding = ATTR_VAL_REF_TYPE; - val->u.uint = read_uint64 (buf); - return 1; - case DW_FORM_strx: case DW_FORM_strx1: case DW_FORM_strx2: - case DW_FORM_strx3: case DW_FORM_strx4: - { - uint64_t offset; - - switch (form) - { - case DW_FORM_strx: - offset = read_uleb128 (buf); - break; - case DW_FORM_strx1: - offset = read_byte (buf); - break; - case DW_FORM_strx2: - offset = read_uint16 (buf); - break; - case DW_FORM_strx3: - offset = read_uint24 (buf); - break; - case DW_FORM_strx4: - offset = read_uint32 (buf); - break; - default: - /* This case can't happen. */ - return 0; - } - val->encoding = ATTR_VAL_STRING_INDEX; - val->u.uint = offset; - return 1; - } - case DW_FORM_addrx: case DW_FORM_addrx1: case DW_FORM_addrx2: - case DW_FORM_addrx3: case DW_FORM_addrx4: - { - uint64_t offset; - - switch (form) - { - case DW_FORM_addrx: - offset = read_uleb128 (buf); - break; - case DW_FORM_addrx1: - offset = read_byte (buf); - break; - case DW_FORM_addrx2: - offset = read_uint16 (buf); - break; - case DW_FORM_addrx3: - offset = read_uint24 (buf); - break; - case DW_FORM_addrx4: - offset = read_uint32 (buf); - break; - default: - /* This case can't happen. */ - return 0; - } - val->encoding = ATTR_VAL_ADDRESS_INDEX; - val->u.uint = offset; - return 1; - } - case DW_FORM_ref_sup4: - val->encoding = ATTR_VAL_REF_SECTION; - val->u.uint = read_uint32 (buf); - return 1; - case DW_FORM_ref_sup8: - val->encoding = ATTR_VAL_REF_SECTION; - val->u.uint = read_uint64 (buf); - return 1; - case DW_FORM_implicit_const: - val->encoding = ATTR_VAL_UINT; - val->u.uint = implicit_val; - return 1; - case DW_FORM_loclistx: - /* We don't distinguish this from DW_FORM_sec_offset. It - * shouldn't matter since we don't care about loclists. */ - val->encoding = ATTR_VAL_REF_SECTION; - val->u.uint = read_uleb128 (buf); - return 1; - case DW_FORM_rnglistx: - val->encoding = ATTR_VAL_RNGLISTS_INDEX; - val->u.uint = read_uleb128 (buf); - return 1; - case DW_FORM_GNU_addr_index: - val->encoding = ATTR_VAL_REF_SECTION; - val->u.uint = read_uleb128 (buf); - return 1; - case DW_FORM_GNU_str_index: - val->encoding = ATTR_VAL_REF_SECTION; - val->u.uint = read_uleb128 (buf); - return 1; - case DW_FORM_GNU_ref_alt: - val->u.uint = read_offset (buf, is_dwarf64); - if (altlink == NULL) - { - val->encoding = ATTR_VAL_NONE; - return 1; - } - val->encoding = ATTR_VAL_REF_ALT_INFO; - return 1; - case DW_FORM_strp_sup: case DW_FORM_GNU_strp_alt: - { - uint64_t offset; - - offset = read_offset (buf, is_dwarf64); - if (altlink == NULL) - { - val->encoding = ATTR_VAL_NONE; - return 1; - } - if (offset >= altlink->dwarf_sections.size[DEBUG_STR]) - { - dwarf_buf_error (buf, "DW_FORM_strp_sup out of range", 0); - return 0; - } - val->encoding = ATTR_VAL_STRING; - val->u.string = - (const char *) altlink->dwarf_sections.data[DEBUG_STR] + offset; - return 1; - } - default: - dwarf_buf_error (buf, "unrecognized DWARF form", -1); - return 0; - } -} - -/* If we can determine the value of a string attribute, set *STRING to - point to the string. Return 1 on success, 0 on error. If we don't - know the value, we consider that a success, and we don't change - *STRING. An error is only reported for some sort of out of range - offset. */ - -static int -resolve_string (const struct dwarf_sections *dwarf_sections, int is_dwarf64, - int is_bigendian, uint64_t str_offsets_base, - const struct attr_val *val, - backtrace_error_callback error_callback, void *data, - const char **string) -{ - switch (val->encoding) - { - case ATTR_VAL_STRING: - *string = val->u.string; - return 1; - - case ATTR_VAL_STRING_INDEX: - { - uint64_t offset; - struct dwarf_buf offset_buf; - - offset = val->u.uint * (is_dwarf64 ? 8 : 4) + str_offsets_base; - if (offset + (is_dwarf64 ? 8 : 4) - > dwarf_sections->size[DEBUG_STR_OFFSETS]) - { - error_callback (data, "DW_FORM_strx value out of range", 0); - return 0; - } - - offset_buf.name = ".debug_str_offsets"; - offset_buf.start = dwarf_sections->data[DEBUG_STR_OFFSETS]; - offset_buf.buf = dwarf_sections->data[DEBUG_STR_OFFSETS] + offset; - offset_buf.left = dwarf_sections->size[DEBUG_STR_OFFSETS] - offset; - offset_buf.is_bigendian = is_bigendian; - offset_buf.error_callback = error_callback; - offset_buf.data = data; - offset_buf.reported_underflow = 0; - - offset = read_offset (&offset_buf, is_dwarf64); - if (offset >= dwarf_sections->size[DEBUG_STR]) - { - dwarf_buf_error (&offset_buf, - "DW_FORM_strx offset out of range", - 0); - return 0; - } - *string = (const char *) dwarf_sections->data[DEBUG_STR] + offset; - return 1; - } - - default: - return 1; - } -} - -/* Set *ADDRESS to the real address for a ATTR_VAL_ADDRESS_INDEX. - Return 1 on success, 0 on error. */ - -static int -resolve_addr_index (const struct dwarf_sections *dwarf_sections, - uint64_t addr_base, int addrsize, int is_bigendian, - uint64_t addr_index, - backtrace_error_callback error_callback, void *data, - uint64_t *address) -{ - uint64_t offset; - struct dwarf_buf addr_buf; - - offset = addr_index * addrsize + addr_base; - if (offset + addrsize > dwarf_sections->size[DEBUG_ADDR]) - { - error_callback (data, "DW_FORM_addrx value out of range", 0); - return 0; - } - - addr_buf.name = ".debug_addr"; - addr_buf.start = dwarf_sections->data[DEBUG_ADDR]; - addr_buf.buf = dwarf_sections->data[DEBUG_ADDR] + offset; - addr_buf.left = dwarf_sections->size[DEBUG_ADDR] - offset; - addr_buf.is_bigendian = is_bigendian; - addr_buf.error_callback = error_callback; - addr_buf.data = data; - addr_buf.reported_underflow = 0; - - *address = read_address (&addr_buf, addrsize); - return 1; -} - -/* Compare a unit offset against a unit for bsearch. */ - -static int -units_search (const void *vkey, const void *ventry) -{ - const size_t *key = (const size_t *) vkey; - const struct unit *entry = *((const struct unit *const *) ventry); - size_t offset; - - offset = *key; - if (offset < entry->low_offset) - return -1; - else if (offset >= entry->high_offset) - return 1; - else - return 0; -} - -/* Find a unit in PU containing OFFSET. */ - -static struct unit * -find_unit (struct unit **pu, size_t units_count, size_t offset) -{ - struct unit **u; - u = bsearch (&offset, pu, units_count, sizeof (struct unit *), units_search); - return u == NULL ? NULL : *u; -} - -/* Compare function_addrs for qsort. When ranges are nested, make the - smallest one sort last. */ - -static int -function_addrs_compare (const void *v1, const void *v2) -{ - const struct function_addrs *a1 = (const struct function_addrs *) v1; - const struct function_addrs *a2 = (const struct function_addrs *) v2; - - if (a1->low < a2->low) - return -1; - if (a1->low > a2->low) - return 1; - if (a1->high < a2->high) - return 1; - if (a1->high > a2->high) - return -1; - return strcmp (a1->function->name, a2->function->name); -} - -/* Compare a PC against a function_addrs for bsearch. We always - allocate an entra entry at the end of the vector, so that this - routine can safely look at the next entry. Note that if there are - multiple ranges containing PC, which one will be returned is - unpredictable. We compensate for that in dwarf_fileline. */ - -static int -function_addrs_search (const void *vkey, const void *ventry) -{ - const uintptr_t *key = (const uintptr_t *) vkey; - const struct function_addrs *entry = (const struct function_addrs *) ventry; - uintptr_t pc; - - pc = *key; - if (pc < entry->low) - return -1; - else if (pc > (entry + 1)->low) - return 1; - else - return 0; -} - -/* Add a new compilation unit address range to a vector. This is - called via add_ranges. Returns 1 on success, 0 on failure. */ - -static int -add_unit_addr (struct backtrace_state *state, void *rdata, - uint64_t lowpc, uint64_t highpc, - backtrace_error_callback error_callback, void *data, - void *pvec) -{ - struct unit *u = (struct unit *) rdata; - struct unit_addrs_vector *vec = (struct unit_addrs_vector *) pvec; - struct unit_addrs *p; - - /* Try to merge with the last entry. */ - if (vec->count > 0) - { - p = (struct unit_addrs *) vec->vec.base + (vec->count - 1); - if ((lowpc == p->high || lowpc == p->high + 1) - && u == p->u) - { - if (highpc > p->high) - p->high = highpc; - return 1; - } - } - - p = ((struct unit_addrs *) - backtrace_vector_grow (state, sizeof (struct unit_addrs), - error_callback, data, &vec->vec)); - if (p == NULL) - return 0; - - p->low = lowpc; - p->high = highpc; - p->u = u; - - ++vec->count; - - return 1; -} - -/* Compare unit_addrs for qsort. When ranges are nested, make the - smallest one sort last. */ - -static int -unit_addrs_compare (const void *v1, const void *v2) -{ - const struct unit_addrs *a1 = (const struct unit_addrs *) v1; - const struct unit_addrs *a2 = (const struct unit_addrs *) v2; - - if (a1->low < a2->low) - return -1; - if (a1->low > a2->low) - return 1; - if (a1->high < a2->high) - return 1; - if (a1->high > a2->high) - return -1; - if (a1->u->lineoff < a2->u->lineoff) - return -1; - if (a1->u->lineoff > a2->u->lineoff) - return 1; - return 0; -} - -/* Compare a PC against a unit_addrs for bsearch. We always allocate - an entry entry at the end of the vector, so that this routine can - safely look at the next entry. Note that if there are multiple - ranges containing PC, which one will be returned is unpredictable. - We compensate for that in dwarf_fileline. */ - -static int -unit_addrs_search (const void *vkey, const void *ventry) -{ - const uintptr_t *key = (const uintptr_t *) vkey; - const struct unit_addrs *entry = (const struct unit_addrs *) ventry; - uintptr_t pc; - - pc = *key; - if (pc < entry->low) - return -1; - else if (pc > (entry + 1)->low) - return 1; - else - return 0; -} - -/* Sort the line vector by PC. We want a stable sort here to maintain - the order of lines for the same PC values. Since the sequence is - being sorted in place, their addresses cannot be relied on to - maintain stability. That is the purpose of the index member. */ - -static int -line_compare (const void *v1, const void *v2) -{ - const struct line *ln1 = (const struct line *) v1; - const struct line *ln2 = (const struct line *) v2; - - if (ln1->pc < ln2->pc) - return -1; - else if (ln1->pc > ln2->pc) - return 1; - else if (ln1->idx < ln2->idx) - return -1; - else if (ln1->idx > ln2->idx) - return 1; - else - return 0; -} - -/* Find a PC in a line vector. We always allocate an extra entry at - the end of the lines vector, so that this routine can safely look - at the next entry. Note that when there are multiple mappings for - the same PC value, this will return the last one. */ - -static int -line_search (const void *vkey, const void *ventry) -{ - const uintptr_t *key = (const uintptr_t *) vkey; - const struct line *entry = (const struct line *) ventry; - uintptr_t pc; - - pc = *key; - if (pc < entry->pc) - return -1; - else if (pc >= (entry + 1)->pc) - return 1; - else - return 0; -} - -/* Sort the abbrevs by the abbrev code. This function is passed to - both qsort and bsearch. */ - -static int -abbrev_compare (const void *v1, const void *v2) -{ - const struct abbrev *a1 = (const struct abbrev *) v1; - const struct abbrev *a2 = (const struct abbrev *) v2; - - if (a1->code < a2->code) - return -1; - else if (a1->code > a2->code) - return 1; - else - { - /* This really shouldn't happen. It means there are two - different abbrevs with the same code, and that means we don't - know which one lookup_abbrev should return. */ - return 0; - } -} - -/* Read the abbreviation table for a compilation unit. Returns 1 on - success, 0 on failure. */ - -static int -read_abbrevs (struct backtrace_state *state, uint64_t abbrev_offset, - const unsigned char *dwarf_abbrev, size_t dwarf_abbrev_size, - int is_bigendian, backtrace_error_callback error_callback, - void *data, struct abbrevs *abbrevs) -{ - struct dwarf_buf abbrev_buf; - struct dwarf_buf count_buf; - size_t num_abbrevs; - - abbrevs->num_abbrevs = 0; - abbrevs->abbrevs = NULL; - - if (abbrev_offset >= dwarf_abbrev_size) - { - error_callback (data, "abbrev offset out of range", 0); - return 0; - } - - abbrev_buf.name = ".debug_abbrev"; - abbrev_buf.start = dwarf_abbrev; - abbrev_buf.buf = dwarf_abbrev + abbrev_offset; - abbrev_buf.left = dwarf_abbrev_size - abbrev_offset; - abbrev_buf.is_bigendian = is_bigendian; - abbrev_buf.error_callback = error_callback; - abbrev_buf.data = data; - abbrev_buf.reported_underflow = 0; - - /* Count the number of abbrevs in this list. */ - - count_buf = abbrev_buf; - num_abbrevs = 0; - while (read_uleb128 (&count_buf) != 0) - { - if (count_buf.reported_underflow) - return 0; - ++num_abbrevs; - // Skip tag. - read_uleb128 (&count_buf); - // Skip has_children. - read_byte (&count_buf); - // Skip attributes. - while (read_uleb128 (&count_buf) != 0) - { - uint64_t form; - - form = read_uleb128 (&count_buf); - if ((enum dwarf_form) form == DW_FORM_implicit_const) - read_sleb128 (&count_buf); - } - // Skip form of last attribute. - read_uleb128 (&count_buf); - } - - if (count_buf.reported_underflow) - return 0; - - if (num_abbrevs == 0) - return 1; - - abbrevs->abbrevs = ((struct abbrev *) - backtrace_alloc (state, - num_abbrevs * sizeof (struct abbrev), - error_callback, data)); - if (abbrevs->abbrevs == NULL) - return 0; - abbrevs->num_abbrevs = num_abbrevs; - memset (abbrevs->abbrevs, 0, num_abbrevs * sizeof (struct abbrev)); - - num_abbrevs = 0; - while (1) - { - uint64_t code; - struct abbrev a; - size_t num_attrs; - struct attr *attrs; - - if (abbrev_buf.reported_underflow) - goto fail; - - code = read_uleb128 (&abbrev_buf); - if (code == 0) - break; - - a.code = code; - a.tag = (enum dwarf_tag) read_uleb128 (&abbrev_buf); - a.has_children = read_byte (&abbrev_buf); - - count_buf = abbrev_buf; - num_attrs = 0; - while (read_uleb128 (&count_buf) != 0) - { - uint64_t form; - - ++num_attrs; - form = read_uleb128 (&count_buf); - if ((enum dwarf_form) form == DW_FORM_implicit_const) - read_sleb128 (&count_buf); - } - - if (num_attrs == 0) - { - attrs = NULL; - read_uleb128 (&abbrev_buf); - read_uleb128 (&abbrev_buf); - } - else - { - attrs = ((struct attr *) - backtrace_alloc (state, num_attrs * sizeof *attrs, - error_callback, data)); - if (attrs == NULL) - goto fail; - num_attrs = 0; - while (1) - { - uint64_t name; - uint64_t form; - - name = read_uleb128 (&abbrev_buf); - form = read_uleb128 (&abbrev_buf); - if (name == 0) - break; - attrs[num_attrs].name = (enum dwarf_attribute) name; - attrs[num_attrs].form = (enum dwarf_form) form; - if ((enum dwarf_form) form == DW_FORM_implicit_const) - attrs[num_attrs].val = read_sleb128 (&abbrev_buf); - else - attrs[num_attrs].val = 0; - ++num_attrs; - } - } - - a.num_attrs = num_attrs; - a.attrs = attrs; - - abbrevs->abbrevs[num_abbrevs] = a; - ++num_abbrevs; - } - - backtrace_qsort (abbrevs->abbrevs, abbrevs->num_abbrevs, - sizeof (struct abbrev), abbrev_compare); - - return 1; - - fail: - free_abbrevs (state, abbrevs, error_callback, data); - return 0; -} - -/* Return the abbrev information for an abbrev code. */ - -static const struct abbrev * -lookup_abbrev (struct abbrevs *abbrevs, uint64_t code, - backtrace_error_callback error_callback, void *data) -{ - struct abbrev key; - void *p; - - /* With GCC, where abbrevs are simply numbered in order, we should - be able to just look up the entry. */ - if (code - 1 < abbrevs->num_abbrevs - && abbrevs->abbrevs[code - 1].code == code) - return &abbrevs->abbrevs[code - 1]; - - /* Otherwise we have to search. */ - memset (&key, 0, sizeof key); - key.code = code; - p = bsearch (&key, abbrevs->abbrevs, abbrevs->num_abbrevs, - sizeof (struct abbrev), abbrev_compare); - if (p == NULL) - { - error_callback (data, "invalid abbreviation code", 0); - return NULL; - } - return (const struct abbrev *) p; -} - -/* This struct is used to gather address range information while - reading attributes. We use this while building a mapping from - address ranges to compilation units and then again while mapping - from address ranges to function entries. Normally either - lowpc/highpc is set or ranges is set. */ - -struct pcrange { - uint64_t lowpc; /* The low PC value. */ - int have_lowpc; /* Whether a low PC value was found. */ - int lowpc_is_addr_index; /* Whether lowpc is in .debug_addr. */ - uint64_t highpc; /* The high PC value. */ - int have_highpc; /* Whether a high PC value was found. */ - int highpc_is_relative; /* Whether highpc is relative to lowpc. */ - int highpc_is_addr_index; /* Whether highpc is in .debug_addr. */ - uint64_t ranges; /* Offset in ranges section. */ - int have_ranges; /* Whether ranges is valid. */ - int ranges_is_index; /* Whether ranges is DW_FORM_rnglistx. */ -}; - -/* Update PCRANGE from an attribute value. */ - -static void -update_pcrange (const struct attr* attr, const struct attr_val* val, - struct pcrange *pcrange) -{ - switch (attr->name) - { - case DW_AT_low_pc: - if (val->encoding == ATTR_VAL_ADDRESS) - { - pcrange->lowpc = val->u.uint; - pcrange->have_lowpc = 1; - } - else if (val->encoding == ATTR_VAL_ADDRESS_INDEX) - { - pcrange->lowpc = val->u.uint; - pcrange->have_lowpc = 1; - pcrange->lowpc_is_addr_index = 1; - } - break; - - case DW_AT_high_pc: - if (val->encoding == ATTR_VAL_ADDRESS) - { - pcrange->highpc = val->u.uint; - pcrange->have_highpc = 1; - } - else if (val->encoding == ATTR_VAL_UINT) - { - pcrange->highpc = val->u.uint; - pcrange->have_highpc = 1; - pcrange->highpc_is_relative = 1; - } - else if (val->encoding == ATTR_VAL_ADDRESS_INDEX) - { - pcrange->highpc = val->u.uint; - pcrange->have_highpc = 1; - pcrange->highpc_is_addr_index = 1; - } - break; - - case DW_AT_ranges: - if (val->encoding == ATTR_VAL_UINT - || val->encoding == ATTR_VAL_REF_SECTION) - { - pcrange->ranges = val->u.uint; - pcrange->have_ranges = 1; - } - else if (val->encoding == ATTR_VAL_RNGLISTS_INDEX) - { - pcrange->ranges = val->u.uint; - pcrange->have_ranges = 1; - pcrange->ranges_is_index = 1; - } - break; - - default: - break; - } -} - -/* Call ADD_RANGE for a low/high PC pair. Returns 1 on success, 0 on - error. */ - -static int -add_low_high_range (struct backtrace_state *state, - const struct dwarf_sections *dwarf_sections, - uintptr_t base_address, int is_bigendian, - struct unit *u, const struct pcrange *pcrange, - int (*add_range) (struct backtrace_state *state, - void *rdata, uint64_t lowpc, - uint64_t highpc, - backtrace_error_callback error_callback, - void *data, void *vec), - void *rdata, - backtrace_error_callback error_callback, void *data, - void *vec) -{ - uint64_t lowpc; - uint64_t highpc; - - lowpc = pcrange->lowpc; - if (pcrange->lowpc_is_addr_index) - { - if (!resolve_addr_index (dwarf_sections, u->addr_base, u->addrsize, - is_bigendian, lowpc, error_callback, data, - &lowpc)) - return 0; - } - - highpc = pcrange->highpc; - if (pcrange->highpc_is_addr_index) - { - if (!resolve_addr_index (dwarf_sections, u->addr_base, u->addrsize, - is_bigendian, highpc, error_callback, data, - &highpc)) - return 0; - } - if (pcrange->highpc_is_relative) - highpc += lowpc; - - /* Add in the base address of the module when recording PC values, - so that we can look up the PC directly. */ - lowpc += base_address; - highpc += base_address; - - return add_range (state, rdata, lowpc, highpc, error_callback, data, vec); -} - -/* Call ADD_RANGE for each range read from .debug_ranges, as used in - DWARF versions 2 through 4. */ - -static int -add_ranges_from_ranges ( - struct backtrace_state *state, - const struct dwarf_sections *dwarf_sections, - uintptr_t base_address, int is_bigendian, - struct unit *u, uint64_t base, - const struct pcrange *pcrange, - int (*add_range) (struct backtrace_state *state, void *rdata, - uint64_t lowpc, uint64_t highpc, - backtrace_error_callback error_callback, void *data, - void *vec), - void *rdata, - backtrace_error_callback error_callback, void *data, - void *vec) -{ - struct dwarf_buf ranges_buf; - - if (pcrange->ranges >= dwarf_sections->size[DEBUG_RANGES]) - { - error_callback (data, "ranges offset out of range", 0); - return 0; - } - - ranges_buf.name = ".debug_ranges"; - ranges_buf.start = dwarf_sections->data[DEBUG_RANGES]; - ranges_buf.buf = dwarf_sections->data[DEBUG_RANGES] + pcrange->ranges; - ranges_buf.left = dwarf_sections->size[DEBUG_RANGES] - pcrange->ranges; - ranges_buf.is_bigendian = is_bigendian; - ranges_buf.error_callback = error_callback; - ranges_buf.data = data; - ranges_buf.reported_underflow = 0; - - while (1) - { - uint64_t low; - uint64_t high; - - if (ranges_buf.reported_underflow) - return 0; - - low = read_address (&ranges_buf, u->addrsize); - high = read_address (&ranges_buf, u->addrsize); - - if (low == 0 && high == 0) - break; - - if (is_highest_address (low, u->addrsize)) - base = high; - else - { - if (!add_range (state, rdata, - low + base + base_address, - high + base + base_address, - error_callback, data, vec)) - return 0; - } - } - - if (ranges_buf.reported_underflow) - return 0; - - return 1; -} - -/* Call ADD_RANGE for each range read from .debug_rnglists, as used in - DWARF version 5. */ - -static int -add_ranges_from_rnglists ( - struct backtrace_state *state, - const struct dwarf_sections *dwarf_sections, - uintptr_t base_address, int is_bigendian, - struct unit *u, uint64_t base, - const struct pcrange *pcrange, - int (*add_range) (struct backtrace_state *state, void *rdata, - uint64_t lowpc, uint64_t highpc, - backtrace_error_callback error_callback, void *data, - void *vec), - void *rdata, - backtrace_error_callback error_callback, void *data, - void *vec) -{ - uint64_t offset; - struct dwarf_buf rnglists_buf; - - if (!pcrange->ranges_is_index) - offset = pcrange->ranges; - else - offset = u->rnglists_base + pcrange->ranges * (u->is_dwarf64 ? 8 : 4); - if (offset >= dwarf_sections->size[DEBUG_RNGLISTS]) - { - error_callback (data, "rnglists offset out of range", 0); - return 0; - } - - rnglists_buf.name = ".debug_rnglists"; - rnglists_buf.start = dwarf_sections->data[DEBUG_RNGLISTS]; - rnglists_buf.buf = dwarf_sections->data[DEBUG_RNGLISTS] + offset; - rnglists_buf.left = dwarf_sections->size[DEBUG_RNGLISTS] - offset; - rnglists_buf.is_bigendian = is_bigendian; - rnglists_buf.error_callback = error_callback; - rnglists_buf.data = data; - rnglists_buf.reported_underflow = 0; - - if (pcrange->ranges_is_index) - { - offset = read_offset (&rnglists_buf, u->is_dwarf64); - offset += u->rnglists_base; - if (offset >= dwarf_sections->size[DEBUG_RNGLISTS]) - { - error_callback (data, "rnglists index offset out of range", 0); - return 0; - } - rnglists_buf.buf = dwarf_sections->data[DEBUG_RNGLISTS] + offset; - rnglists_buf.left = dwarf_sections->size[DEBUG_RNGLISTS] - offset; - } - - while (1) - { - unsigned char rle; - - rle = read_byte (&rnglists_buf); - if (rle == DW_RLE_end_of_list) - break; - switch (rle) - { - case DW_RLE_base_addressx: - { - uint64_t index; - - index = read_uleb128 (&rnglists_buf); - if (!resolve_addr_index (dwarf_sections, u->addr_base, - u->addrsize, is_bigendian, index, - error_callback, data, &base)) - return 0; - } - break; - - case DW_RLE_startx_endx: - { - uint64_t index; - uint64_t low; - uint64_t high; - - index = read_uleb128 (&rnglists_buf); - if (!resolve_addr_index (dwarf_sections, u->addr_base, - u->addrsize, is_bigendian, index, - error_callback, data, &low)) - return 0; - index = read_uleb128 (&rnglists_buf); - if (!resolve_addr_index (dwarf_sections, u->addr_base, - u->addrsize, is_bigendian, index, - error_callback, data, &high)) - return 0; - if (!add_range (state, rdata, low + base_address, - high + base_address, error_callback, data, - vec)) - return 0; - } - break; - - case DW_RLE_startx_length: - { - uint64_t index; - uint64_t low; - uint64_t length; - - index = read_uleb128 (&rnglists_buf); - if (!resolve_addr_index (dwarf_sections, u->addr_base, - u->addrsize, is_bigendian, index, - error_callback, data, &low)) - return 0; - length = read_uleb128 (&rnglists_buf); - low += base_address; - if (!add_range (state, rdata, low, low + length, - error_callback, data, vec)) - return 0; - } - break; - - case DW_RLE_offset_pair: - { - uint64_t low; - uint64_t high; - - low = read_uleb128 (&rnglists_buf); - high = read_uleb128 (&rnglists_buf); - if (!add_range (state, rdata, low + base + base_address, - high + base + base_address, - error_callback, data, vec)) - return 0; - } - break; - - case DW_RLE_base_address: - base = read_address (&rnglists_buf, u->addrsize); - break; - - case DW_RLE_start_end: - { - uint64_t low; - uint64_t high; - - low = read_address (&rnglists_buf, u->addrsize); - high = read_address (&rnglists_buf, u->addrsize); - if (!add_range (state, rdata, low + base_address, - high + base_address, error_callback, data, - vec)) - return 0; - } - break; - - case DW_RLE_start_length: - { - uint64_t low; - uint64_t length; - - low = read_address (&rnglists_buf, u->addrsize); - length = read_uleb128 (&rnglists_buf); - low += base_address; - if (!add_range (state, rdata, low, low + length, - error_callback, data, vec)) - return 0; - } - break; - - default: - dwarf_buf_error (&rnglists_buf, "unrecognized DW_RLE value", -1); - return 0; - } - } - - if (rnglists_buf.reported_underflow) - return 0; - - return 1; -} - -/* Call ADD_RANGE for each lowpc/highpc pair in PCRANGE. RDATA is - passed to ADD_RANGE, and is either a struct unit * or a struct - function *. VEC is the vector we are adding ranges to, and is - either a struct unit_addrs_vector * or a struct function_vector *. - Returns 1 on success, 0 on error. */ - -static int -add_ranges (struct backtrace_state *state, - const struct dwarf_sections *dwarf_sections, - uintptr_t base_address, int is_bigendian, - struct unit *u, uint64_t base, const struct pcrange *pcrange, - int (*add_range) (struct backtrace_state *state, void *rdata, - uint64_t lowpc, uint64_t highpc, - backtrace_error_callback error_callback, - void *data, void *vec), - void *rdata, - backtrace_error_callback error_callback, void *data, - void *vec) -{ - if (pcrange->have_lowpc && pcrange->have_highpc) - return add_low_high_range (state, dwarf_sections, base_address, - is_bigendian, u, pcrange, add_range, rdata, - error_callback, data, vec); - - if (!pcrange->have_ranges) - { - /* Did not find any address ranges to add. */ - return 1; - } - - if (u->version < 5) - return add_ranges_from_ranges (state, dwarf_sections, base_address, - is_bigendian, u, base, pcrange, add_range, - rdata, error_callback, data, vec); - else - return add_ranges_from_rnglists (state, dwarf_sections, base_address, - is_bigendian, u, base, pcrange, add_range, - rdata, error_callback, data, vec); -} - -/* Find the address range covered by a compilation unit, reading from - UNIT_BUF and adding values to U. Returns 1 if all data could be - read, 0 if there is some error. */ - -static int -find_address_ranges (struct backtrace_state *state, uintptr_t base_address, - struct dwarf_buf *unit_buf, - const struct dwarf_sections *dwarf_sections, - int is_bigendian, struct dwarf_data *altlink, - backtrace_error_callback error_callback, void *data, - struct unit *u, struct unit_addrs_vector *addrs, - enum dwarf_tag *unit_tag) -{ - while (unit_buf->left > 0) - { - uint64_t code; - const struct abbrev *abbrev; - struct pcrange pcrange; - struct attr_val name_val; - int have_name_val; - struct attr_val comp_dir_val; - int have_comp_dir_val; - size_t i; - - code = read_uleb128 (unit_buf); - if (code == 0) - return 1; - - abbrev = lookup_abbrev (&u->abbrevs, code, error_callback, data); - if (abbrev == NULL) - return 0; - - if (unit_tag != NULL) - *unit_tag = abbrev->tag; - - memset (&pcrange, 0, sizeof pcrange); - memset (&name_val, 0, sizeof name_val); - have_name_val = 0; - memset (&comp_dir_val, 0, sizeof comp_dir_val); - have_comp_dir_val = 0; - for (i = 0; i < abbrev->num_attrs; ++i) - { - struct attr_val val; - - if (!read_attribute (abbrev->attrs[i].form, abbrev->attrs[i].val, - unit_buf, u->is_dwarf64, u->version, - u->addrsize, dwarf_sections, altlink, &val)) - return 0; - - switch (abbrev->attrs[i].name) - { - case DW_AT_low_pc: case DW_AT_high_pc: case DW_AT_ranges: - update_pcrange (&abbrev->attrs[i], &val, &pcrange); - break; - - case DW_AT_stmt_list: - if ((abbrev->tag == DW_TAG_compile_unit - || abbrev->tag == DW_TAG_skeleton_unit) - && (val.encoding == ATTR_VAL_UINT - || val.encoding == ATTR_VAL_REF_SECTION)) - u->lineoff = val.u.uint; - break; - - case DW_AT_name: - if (abbrev->tag == DW_TAG_compile_unit - || abbrev->tag == DW_TAG_skeleton_unit) - { - name_val = val; - have_name_val = 1; - } - break; - - case DW_AT_comp_dir: - if (abbrev->tag == DW_TAG_compile_unit - || abbrev->tag == DW_TAG_skeleton_unit) - { - comp_dir_val = val; - have_comp_dir_val = 1; - } - break; - - case DW_AT_str_offsets_base: - if ((abbrev->tag == DW_TAG_compile_unit - || abbrev->tag == DW_TAG_skeleton_unit) - && val.encoding == ATTR_VAL_REF_SECTION) - u->str_offsets_base = val.u.uint; - break; - - case DW_AT_addr_base: - if ((abbrev->tag == DW_TAG_compile_unit - || abbrev->tag == DW_TAG_skeleton_unit) - && val.encoding == ATTR_VAL_REF_SECTION) - u->addr_base = val.u.uint; - break; - - case DW_AT_rnglists_base: - if ((abbrev->tag == DW_TAG_compile_unit - || abbrev->tag == DW_TAG_skeleton_unit) - && val.encoding == ATTR_VAL_REF_SECTION) - u->rnglists_base = val.u.uint; - break; - - default: - break; - } - } - - // Resolve strings after we're sure that we have seen - // DW_AT_str_offsets_base. - if (have_name_val) - { - if (!resolve_string (dwarf_sections, u->is_dwarf64, is_bigendian, - u->str_offsets_base, &name_val, - error_callback, data, &u->filename)) - return 0; - } - if (have_comp_dir_val) - { - if (!resolve_string (dwarf_sections, u->is_dwarf64, is_bigendian, - u->str_offsets_base, &comp_dir_val, - error_callback, data, &u->comp_dir)) - return 0; - } - - if (abbrev->tag == DW_TAG_compile_unit - || abbrev->tag == DW_TAG_subprogram - || abbrev->tag == DW_TAG_skeleton_unit) - { - if (!add_ranges (state, dwarf_sections, base_address, - is_bigendian, u, pcrange.lowpc, &pcrange, - add_unit_addr, (void *) u, error_callback, data, - (void *) addrs)) - return 0; - - /* If we found the PC range in the DW_TAG_compile_unit or - DW_TAG_skeleton_unit, we can stop now. */ - if ((abbrev->tag == DW_TAG_compile_unit - || abbrev->tag == DW_TAG_skeleton_unit) - && (pcrange.have_ranges - || (pcrange.have_lowpc && pcrange.have_highpc))) - return 1; - } - - if (abbrev->has_children) - { - if (!find_address_ranges (state, base_address, unit_buf, - dwarf_sections, is_bigendian, altlink, - error_callback, data, u, addrs, NULL)) - return 0; - } - } - - return 1; -} - -/* Build a mapping from address ranges to the compilation units where - the line number information for that range can be found. Returns 1 - on success, 0 on failure. */ - -static int -build_address_map (struct backtrace_state *state, uintptr_t base_address, - const struct dwarf_sections *dwarf_sections, - int is_bigendian, struct dwarf_data *altlink, - backtrace_error_callback error_callback, void *data, - struct unit_addrs_vector *addrs, - struct unit_vector *unit_vec) -{ - struct dwarf_buf info; - struct backtrace_vector units; - size_t units_count; - size_t i; - struct unit **pu; - size_t unit_offset = 0; - struct unit_addrs *pa; - - memset (&addrs->vec, 0, sizeof addrs->vec); - memset (&unit_vec->vec, 0, sizeof unit_vec->vec); - addrs->count = 0; - unit_vec->count = 0; - - /* Read through the .debug_info section. FIXME: Should we use the - .debug_aranges section? gdb and addr2line don't use it, but I'm - not sure why. */ - - info.name = ".debug_info"; - info.start = dwarf_sections->data[DEBUG_INFO]; - info.buf = info.start; - info.left = dwarf_sections->size[DEBUG_INFO]; - info.is_bigendian = is_bigendian; - info.error_callback = error_callback; - info.data = data; - info.reported_underflow = 0; - - memset (&units, 0, sizeof units); - units_count = 0; - - while (info.left > 0) - { - const unsigned char *unit_data_start; - uint64_t len; - int is_dwarf64; - struct dwarf_buf unit_buf; - int version; - int unit_type; - uint64_t abbrev_offset; - int addrsize; - struct unit *u; - enum dwarf_tag unit_tag; - - if (info.reported_underflow) - goto fail; - - unit_data_start = info.buf; - - len = read_initial_length (&info, &is_dwarf64); - unit_buf = info; - unit_buf.left = len; - - if (!advance (&info, len)) - goto fail; - - version = read_uint16 (&unit_buf); - if (version < 2 || version > 5) - { - dwarf_buf_error (&unit_buf, "unrecognized DWARF version", -1); - goto fail; - } - - if (version < 5) - unit_type = 0; - else - { - unit_type = read_byte (&unit_buf); - if (unit_type == DW_UT_type || unit_type == DW_UT_split_type) - { - /* This unit doesn't have anything we need. */ - continue; - } - } - - pu = ((struct unit **) - backtrace_vector_grow (state, sizeof (struct unit *), - error_callback, data, &units)); - if (pu == NULL) - goto fail; - - u = ((struct unit *) - backtrace_alloc (state, sizeof *u, error_callback, data)); - if (u == NULL) - goto fail; - - *pu = u; - ++units_count; - - if (version < 5) - addrsize = 0; /* Set below. */ - else - addrsize = read_byte (&unit_buf); - - memset (&u->abbrevs, 0, sizeof u->abbrevs); - abbrev_offset = read_offset (&unit_buf, is_dwarf64); - if (!read_abbrevs (state, abbrev_offset, - dwarf_sections->data[DEBUG_ABBREV], - dwarf_sections->size[DEBUG_ABBREV], - is_bigendian, error_callback, data, &u->abbrevs)) - goto fail; - - if (version < 5) - addrsize = read_byte (&unit_buf); - - switch (unit_type) - { - case 0: - break; - case DW_UT_compile: case DW_UT_partial: - break; - case DW_UT_skeleton: case DW_UT_split_compile: - read_uint64 (&unit_buf); /* dwo_id */ - break; - default: - break; - } - - u->low_offset = unit_offset; - unit_offset += len + (is_dwarf64 ? 12 : 4); - u->high_offset = unit_offset; - u->unit_data = unit_buf.buf; - u->unit_data_len = unit_buf.left; - u->unit_data_offset = unit_buf.buf - unit_data_start; - u->version = version; - u->is_dwarf64 = is_dwarf64; - u->addrsize = addrsize; - u->filename = NULL; - u->comp_dir = NULL; - u->abs_filename = NULL; - u->lineoff = 0; - u->str_offsets_base = 0; - u->addr_base = 0; - u->rnglists_base = 0; - - /* The actual line number mappings will be read as needed. */ - u->lines = NULL; - u->lines_count = 0; - u->function_addrs = NULL; - u->function_addrs_count = 0; - - if (!find_address_ranges (state, base_address, &unit_buf, dwarf_sections, - is_bigendian, altlink, error_callback, data, - u, addrs, &unit_tag)) - goto fail; - - if (unit_buf.reported_underflow) - goto fail; - } - if (info.reported_underflow) - goto fail; - - /* Add a trailing addrs entry, but don't include it in addrs->count. */ - pa = ((struct unit_addrs *) - backtrace_vector_grow (state, sizeof (struct unit_addrs), - error_callback, data, &addrs->vec)); - if (pa == NULL) - goto fail; - pa->low = 0; - --pa->low; - pa->high = pa->low; - pa->u = NULL; - - unit_vec->vec = units; - unit_vec->count = units_count; - return 1; - - fail: - if (units_count > 0) - { - pu = (struct unit **) units.base; - for (i = 0; i < units_count; i++) - { - free_abbrevs (state, &pu[i]->abbrevs, error_callback, data); - backtrace_free (state, pu[i], sizeof **pu, error_callback, data); - } - backtrace_vector_free (state, &units, error_callback, data); - } - if (addrs->count > 0) - { - backtrace_vector_free (state, &addrs->vec, error_callback, data); - addrs->count = 0; - } - return 0; -} - -/* Add a new mapping to the vector of line mappings that we are - building. Returns 1 on success, 0 on failure. */ - -static int -add_line (struct backtrace_state *state, struct dwarf_data *ddata, - uintptr_t pc, const char *filename, int lineno, - backtrace_error_callback error_callback, void *data, - struct line_vector *vec) -{ - struct line *ln; - - /* If we are adding the same mapping, ignore it. This can happen - when using discriminators. */ - if (vec->count > 0) - { - ln = (struct line *) vec->vec.base + (vec->count - 1); - if (pc == ln->pc && filename == ln->filename && lineno == ln->lineno) - return 1; - } - - ln = ((struct line *) - backtrace_vector_grow (state, sizeof (struct line), error_callback, - data, &vec->vec)); - if (ln == NULL) - return 0; - - /* Add in the base address here, so that we can look up the PC - directly. */ - ln->pc = pc + ddata->base_address; - - ln->filename = filename; - ln->lineno = lineno; - ln->idx = vec->count; - - ++vec->count; - - return 1; -} - -/* Free the line header information. */ - -static void -free_line_header (struct backtrace_state *state, struct line_header *hdr, - backtrace_error_callback error_callback, void *data) -{ - if (hdr->dirs_count != 0) - backtrace_free (state, hdr->dirs, hdr->dirs_count * sizeof (const char *), - error_callback, data); - backtrace_free (state, hdr->filenames, - hdr->filenames_count * sizeof (char *), - error_callback, data); -} - -/* Read the directories and file names for a line header for version - 2, setting fields in HDR. Return 1 on success, 0 on failure. */ - -static int -read_v2_paths (struct backtrace_state *state, struct unit *u, - struct dwarf_buf *hdr_buf, struct line_header *hdr) -{ - const unsigned char *p; - const unsigned char *pend; - size_t i; - - /* Count the number of directory entries. */ - hdr->dirs_count = 0; - p = hdr_buf->buf; - pend = p + hdr_buf->left; - while (p < pend && *p != '\0') - { - p += strnlen((const char *) p, pend - p) + 1; - ++hdr->dirs_count; - } - - /* The index of the first entry in the list of directories is 1. Index 0 is - used for the current directory of the compilation. To simplify index - handling, we set entry 0 to the compilation unit directory. */ - ++hdr->dirs_count; - hdr->dirs = ((const char **) - backtrace_alloc (state, - hdr->dirs_count * sizeof (const char *), - hdr_buf->error_callback, - hdr_buf->data)); - if (hdr->dirs == NULL) - return 0; - - hdr->dirs[0] = u->comp_dir; - i = 1; - while (*hdr_buf->buf != '\0') - { - if (hdr_buf->reported_underflow) - return 0; - - hdr->dirs[i] = read_string (hdr_buf); - if (hdr->dirs[i] == NULL) - return 0; - ++i; - } - if (!advance (hdr_buf, 1)) - return 0; - - /* Count the number of file entries. */ - hdr->filenames_count = 0; - p = hdr_buf->buf; - pend = p + hdr_buf->left; - while (p < pend && *p != '\0') - { - p += strnlen ((const char *) p, pend - p) + 1; - p += leb128_len (p); - p += leb128_len (p); - p += leb128_len (p); - ++hdr->filenames_count; - } - - /* The index of the first entry in the list of file names is 1. Index 0 is - used for the DW_AT_name of the compilation unit. To simplify index - handling, we set entry 0 to the compilation unit file name. */ - ++hdr->filenames_count; - hdr->filenames = ((const char **) - backtrace_alloc (state, - hdr->filenames_count * sizeof (char *), - hdr_buf->error_callback, - hdr_buf->data)); - if (hdr->filenames == NULL) - return 0; - hdr->filenames[0] = u->filename; - i = 1; - while (*hdr_buf->buf != '\0') - { - const char *filename; - uint64_t dir_index; - - if (hdr_buf->reported_underflow) - return 0; - - filename = read_string (hdr_buf); - if (filename == NULL) - return 0; - dir_index = read_uleb128 (hdr_buf); - if (IS_ABSOLUTE_PATH (filename) - || (dir_index < hdr->dirs_count && hdr->dirs[dir_index] == NULL)) - hdr->filenames[i] = filename; - else - { - const char *dir; - size_t dir_len; - size_t filename_len; - char *s; - - if (dir_index < hdr->dirs_count) - dir = hdr->dirs[dir_index]; - else - { - dwarf_buf_error (hdr_buf, - ("invalid directory index in " - "line number program header"), - 0); - return 0; - } - dir_len = strlen (dir); - filename_len = strlen (filename); - s = ((char *) backtrace_alloc (state, dir_len + filename_len + 2, - hdr_buf->error_callback, - hdr_buf->data)); - if (s == NULL) - return 0; - memcpy (s, dir, dir_len); - /* FIXME: If we are on a DOS-based file system, and the - directory or the file name use backslashes, then we - should use a backslash here. */ - s[dir_len] = '/'; - memcpy (s + dir_len + 1, filename, filename_len + 1); - hdr->filenames[i] = s; - } - - /* Ignore the modification time and size. */ - read_uleb128 (hdr_buf); - read_uleb128 (hdr_buf); - - ++i; - } - - return 1; -} - -/* Read a single version 5 LNCT entry for a directory or file name in a - line header. Sets *STRING to the resulting name, ignoring other - data. Return 1 on success, 0 on failure. */ - -static int -read_lnct (struct backtrace_state *state, struct dwarf_data *ddata, - struct unit *u, struct dwarf_buf *hdr_buf, - const struct line_header *hdr, size_t formats_count, - const struct line_header_format *formats, const char **string) -{ - size_t i; - const char *dir; - const char *path; - - dir = NULL; - path = NULL; - for (i = 0; i < formats_count; i++) - { - struct attr_val val; - - if (!read_attribute (formats[i].form, 0, hdr_buf, u->is_dwarf64, - u->version, hdr->addrsize, &ddata->dwarf_sections, - ddata->altlink, &val)) - return 0; - switch (formats[i].lnct) - { - case DW_LNCT_path: - if (!resolve_string (&ddata->dwarf_sections, u->is_dwarf64, - ddata->is_bigendian, u->str_offsets_base, - &val, hdr_buf->error_callback, hdr_buf->data, - &path)) - return 0; - break; - case DW_LNCT_directory_index: - if (val.encoding == ATTR_VAL_UINT) - { - if (val.u.uint >= hdr->dirs_count) - { - dwarf_buf_error (hdr_buf, - ("invalid directory index in " - "line number program header"), - 0); - return 0; - } - dir = hdr->dirs[val.u.uint]; - } - break; - default: - /* We don't care about timestamps or sizes or hashes. */ - break; - } - } - - if (path == NULL) - { - dwarf_buf_error (hdr_buf, - "missing file name in line number program header", - 0); - return 0; - } - - if (dir == NULL) - *string = path; - else - { - size_t dir_len; - size_t path_len; - char *s; - - dir_len = strlen (dir); - path_len = strlen (path); - s = (char *) backtrace_alloc (state, dir_len + path_len + 2, - hdr_buf->error_callback, hdr_buf->data); - if (s == NULL) - return 0; - memcpy (s, dir, dir_len); - /* FIXME: If we are on a DOS-based file system, and the - directory or the path name use backslashes, then we should - use a backslash here. */ - s[dir_len] = '/'; - memcpy (s + dir_len + 1, path, path_len + 1); - *string = s; - } - - return 1; -} - -/* Read a set of DWARF 5 line header format entries, setting *PCOUNT - and *PPATHS. Return 1 on success, 0 on failure. */ - -static int -read_line_header_format_entries (struct backtrace_state *state, - struct dwarf_data *ddata, - struct unit *u, - struct dwarf_buf *hdr_buf, - struct line_header *hdr, - size_t *pcount, - const char ***ppaths) -{ - size_t formats_count; - struct line_header_format *formats; - size_t paths_count; - const char **paths; - size_t i; - int ret; - - formats_count = read_byte (hdr_buf); - if (formats_count == 0) - formats = NULL; - else - { - formats = ((struct line_header_format *) - backtrace_alloc (state, - (formats_count - * sizeof (struct line_header_format)), - hdr_buf->error_callback, - hdr_buf->data)); - if (formats == NULL) - return 0; - - for (i = 0; i < formats_count; i++) - { - formats[i].lnct = (int) read_uleb128(hdr_buf); - formats[i].form = (enum dwarf_form) read_uleb128 (hdr_buf); - } - } - - paths_count = read_uleb128 (hdr_buf); - if (paths_count == 0) - { - *pcount = 0; - *ppaths = NULL; - ret = 1; - goto exit; - } - - paths = ((const char **) - backtrace_alloc (state, paths_count * sizeof (const char *), - hdr_buf->error_callback, hdr_buf->data)); - if (paths == NULL) - { - ret = 0; - goto exit; - } - for (i = 0; i < paths_count; i++) - { - if (!read_lnct (state, ddata, u, hdr_buf, hdr, formats_count, - formats, &paths[i])) - { - backtrace_free (state, paths, - paths_count * sizeof (const char *), - hdr_buf->error_callback, hdr_buf->data); - ret = 0; - goto exit; - } - } - - *pcount = paths_count; - *ppaths = paths; - - ret = 1; - - exit: - if (formats != NULL) - backtrace_free (state, formats, - formats_count * sizeof (struct line_header_format), - hdr_buf->error_callback, hdr_buf->data); - - return ret; -} - -/* Read the line header. Return 1 on success, 0 on failure. */ - -static int -read_line_header (struct backtrace_state *state, struct dwarf_data *ddata, - struct unit *u, int is_dwarf64, struct dwarf_buf *line_buf, - struct line_header *hdr) -{ - uint64_t hdrlen; - struct dwarf_buf hdr_buf; - - hdr->version = read_uint16 (line_buf); - if (hdr->version < 2 || hdr->version > 5) - { - dwarf_buf_error (line_buf, "unsupported line number version", -1); - return 0; - } - - if (hdr->version < 5) - hdr->addrsize = u->addrsize; - else - { - hdr->addrsize = read_byte (line_buf); - /* We could support a non-zero segment_selector_size but I doubt - we'll ever see it. */ - if (read_byte (line_buf) != 0) - { - dwarf_buf_error (line_buf, - "non-zero segment_selector_size not supported", - -1); - return 0; - } - } - - hdrlen = read_offset (line_buf, is_dwarf64); - - hdr_buf = *line_buf; - hdr_buf.left = hdrlen; - - if (!advance (line_buf, hdrlen)) - return 0; - - hdr->min_insn_len = read_byte (&hdr_buf); - if (hdr->version < 4) - hdr->max_ops_per_insn = 1; - else - hdr->max_ops_per_insn = read_byte (&hdr_buf); - - /* We don't care about default_is_stmt. */ - read_byte (&hdr_buf); - - hdr->line_base = read_sbyte (&hdr_buf); - hdr->line_range = read_byte (&hdr_buf); - - hdr->opcode_base = read_byte (&hdr_buf); - hdr->opcode_lengths = hdr_buf.buf; - if (!advance (&hdr_buf, hdr->opcode_base - 1)) - return 0; - - if (hdr->version < 5) - { - if (!read_v2_paths (state, u, &hdr_buf, hdr)) - return 0; - } - else - { - if (!read_line_header_format_entries (state, ddata, u, &hdr_buf, hdr, - &hdr->dirs_count, - &hdr->dirs)) - return 0; - if (!read_line_header_format_entries (state, ddata, u, &hdr_buf, hdr, - &hdr->filenames_count, - &hdr->filenames)) - return 0; - } - - if (hdr_buf.reported_underflow) - return 0; - - return 1; -} - -/* Read the line program, adding line mappings to VEC. Return 1 on - success, 0 on failure. */ - -static int -read_line_program (struct backtrace_state *state, struct dwarf_data *ddata, - const struct line_header *hdr, struct dwarf_buf *line_buf, - struct line_vector *vec) -{ - uint64_t address; - unsigned int op_index; - const char *reset_filename; - const char *filename; - int lineno; - - address = 0; - op_index = 0; - if (hdr->filenames_count > 1) - reset_filename = hdr->filenames[1]; - else - reset_filename = ""; - filename = reset_filename; - lineno = 1; - while (line_buf->left > 0) - { - unsigned int op; - - op = read_byte (line_buf); - if (op >= hdr->opcode_base) - { - unsigned int advance; - - /* Special opcode. */ - op -= hdr->opcode_base; - advance = op / hdr->line_range; - address += (hdr->min_insn_len * (op_index + advance) - / hdr->max_ops_per_insn); - op_index = (op_index + advance) % hdr->max_ops_per_insn; - lineno += hdr->line_base + (int) (op % hdr->line_range); - add_line (state, ddata, address, filename, lineno, - line_buf->error_callback, line_buf->data, vec); - } - else if (op == DW_LNS_extended_op) - { - uint64_t len; - - len = read_uleb128 (line_buf); - op = read_byte (line_buf); - switch (op) - { - case DW_LNE_end_sequence: - /* FIXME: Should we mark the high PC here? It seems - that we already have that information from the - compilation unit. */ - address = 0; - op_index = 0; - filename = reset_filename; - lineno = 1; - break; - case DW_LNE_set_address: - address = read_address (line_buf, hdr->addrsize); - break; - case DW_LNE_define_file: - { - const char *f; - unsigned int dir_index; - - f = read_string (line_buf); - if (f == NULL) - return 0; - dir_index = read_uleb128 (line_buf); - /* Ignore that time and length. */ - read_uleb128 (line_buf); - read_uleb128 (line_buf); - if (IS_ABSOLUTE_PATH (f)) - filename = f; - else - { - const char *dir; - size_t dir_len; - size_t f_len; - char *p; - - if (dir_index < hdr->dirs_count) - dir = hdr->dirs[dir_index]; - else - { - dwarf_buf_error (line_buf, - ("invalid directory index " - "in line number program"), - 0); - return 0; - } - dir_len = strlen (dir); - f_len = strlen (f); - p = ((char *) - backtrace_alloc (state, dir_len + f_len + 2, - line_buf->error_callback, - line_buf->data)); - if (p == NULL) - return 0; - memcpy (p, dir, dir_len); - /* FIXME: If we are on a DOS-based file system, - and the directory or the file name use - backslashes, then we should use a backslash - here. */ - p[dir_len] = '/'; - memcpy (p + dir_len + 1, f, f_len + 1); - filename = p; - } - } - break; - case DW_LNE_set_discriminator: - /* We don't care about discriminators. */ - read_uleb128 (line_buf); - break; - default: - if (!advance (line_buf, len - 1)) - return 0; - break; - } - } - else - { - switch (op) - { - case DW_LNS_copy: - add_line (state, ddata, address, filename, lineno, - line_buf->error_callback, line_buf->data, vec); - break; - case DW_LNS_advance_pc: - { - uint64_t advance; - - advance = read_uleb128 (line_buf); - address += (hdr->min_insn_len * (op_index + advance) - / hdr->max_ops_per_insn); - op_index = (op_index + advance) % hdr->max_ops_per_insn; - } - break; - case DW_LNS_advance_line: - lineno += (int) read_sleb128 (line_buf); - break; - case DW_LNS_set_file: - { - uint64_t fileno; - - fileno = read_uleb128 (line_buf); - if (fileno >= hdr->filenames_count) - { - dwarf_buf_error (line_buf, - ("invalid file number in " - "line number program"), - 0); - return 0; - } - filename = hdr->filenames[fileno]; - } - break; - case DW_LNS_set_column: - read_uleb128 (line_buf); - break; - case DW_LNS_negate_stmt: - break; - case DW_LNS_set_basic_block: - break; - case DW_LNS_const_add_pc: - { - unsigned int advance; - - op = 255 - hdr->opcode_base; - advance = op / hdr->line_range; - address += (hdr->min_insn_len * (op_index + advance) - / hdr->max_ops_per_insn); - op_index = (op_index + advance) % hdr->max_ops_per_insn; - } - break; - case DW_LNS_fixed_advance_pc: - address += read_uint16 (line_buf); - op_index = 0; - break; - case DW_LNS_set_prologue_end: - break; - case DW_LNS_set_epilogue_begin: - break; - case DW_LNS_set_isa: - read_uleb128 (line_buf); - break; - default: - { - unsigned int i; - - for (i = hdr->opcode_lengths[op - 1]; i > 0; --i) - read_uleb128 (line_buf); - } - break; - } - } - } - - return 1; -} - -/* Read the line number information for a compilation unit. Returns 1 - on success, 0 on failure. */ - -static int -read_line_info (struct backtrace_state *state, struct dwarf_data *ddata, - backtrace_error_callback error_callback, void *data, - struct unit *u, struct line_header *hdr, struct line **lines, - size_t *lines_count) -{ - struct line_vector vec; - struct dwarf_buf line_buf; - uint64_t len; - int is_dwarf64; - struct line *ln; - - memset (&vec.vec, 0, sizeof vec.vec); - vec.count = 0; - - memset (hdr, 0, sizeof *hdr); - - if (u->lineoff != (off_t) (size_t) u->lineoff - || (size_t) u->lineoff >= ddata->dwarf_sections.size[DEBUG_LINE]) - { - error_callback (data, "unit line offset out of range", 0); - goto fail; - } - - line_buf.name = ".debug_line"; - line_buf.start = ddata->dwarf_sections.data[DEBUG_LINE]; - line_buf.buf = ddata->dwarf_sections.data[DEBUG_LINE] + u->lineoff; - line_buf.left = ddata->dwarf_sections.size[DEBUG_LINE] - u->lineoff; - line_buf.is_bigendian = ddata->is_bigendian; - line_buf.error_callback = error_callback; - line_buf.data = data; - line_buf.reported_underflow = 0; - - len = read_initial_length (&line_buf, &is_dwarf64); - line_buf.left = len; - - if (!read_line_header (state, ddata, u, is_dwarf64, &line_buf, hdr)) - goto fail; - - if (!read_line_program (state, ddata, hdr, &line_buf, &vec)) - goto fail; - - if (line_buf.reported_underflow) - goto fail; - - if (vec.count == 0) - { - /* This is not a failure in the sense of a generating an error, - but it is a failure in that sense that we have no useful - information. */ - goto fail; - } - - /* Allocate one extra entry at the end. */ - ln = ((struct line *) - backtrace_vector_grow (state, sizeof (struct line), error_callback, - data, &vec.vec)); - if (ln == NULL) - goto fail; - ln->pc = (uintptr_t) -1; - ln->filename = NULL; - ln->lineno = 0; - ln->idx = 0; - - if (!backtrace_vector_release (state, &vec.vec, error_callback, data)) - goto fail; - - ln = (struct line *) vec.vec.base; - backtrace_qsort (ln, vec.count, sizeof (struct line), line_compare); - - *lines = ln; - *lines_count = vec.count; - - return 1; - - fail: - backtrace_vector_free (state, &vec.vec, error_callback, data); - free_line_header (state, hdr, error_callback, data); - *lines = (struct line *) (uintptr_t) -1; - *lines_count = 0; - return 0; -} - -static const char *read_referenced_name (struct dwarf_data *, struct unit *, - uint64_t, backtrace_error_callback, - void *); - -/* Read the name of a function from a DIE referenced by ATTR with VAL. */ - -static const char * -read_referenced_name_from_attr (struct dwarf_data *ddata, struct unit *u, - struct attr *attr, struct attr_val *val, - backtrace_error_callback error_callback, - void *data) -{ - switch (attr->name) - { - case DW_AT_abstract_origin: - case DW_AT_specification: - break; - default: - return NULL; - } - - if (attr->form == DW_FORM_ref_sig8) - return NULL; - - if (val->encoding == ATTR_VAL_REF_INFO) - { - struct unit *unit - = find_unit (ddata->units, ddata->units_count, - val->u.uint); - if (unit == NULL) - return NULL; - - uint64_t offset = val->u.uint - unit->low_offset; - return read_referenced_name (ddata, unit, offset, error_callback, data); - } - - if (val->encoding == ATTR_VAL_UINT - || val->encoding == ATTR_VAL_REF_UNIT) - return read_referenced_name (ddata, u, val->u.uint, error_callback, data); - - if (val->encoding == ATTR_VAL_REF_ALT_INFO) - { - struct unit *alt_unit - = find_unit (ddata->altlink->units, ddata->altlink->units_count, - val->u.uint); - if (alt_unit == NULL) - return NULL; - - uint64_t offset = val->u.uint - alt_unit->low_offset; - return read_referenced_name (ddata->altlink, alt_unit, offset, - error_callback, data); - } - - return NULL; -} - -/* Read the name of a function from a DIE referenced by a - DW_AT_abstract_origin or DW_AT_specification tag. OFFSET is within - the same compilation unit. */ - -static const char * -read_referenced_name (struct dwarf_data *ddata, struct unit *u, - uint64_t offset, backtrace_error_callback error_callback, - void *data) -{ - struct dwarf_buf unit_buf; - uint64_t code; - const struct abbrev *abbrev; - const char *ret; - size_t i; - - /* OFFSET is from the start of the data for this compilation unit. - U->unit_data is the data, but it starts U->unit_data_offset bytes - from the beginning. */ - - if (offset < u->unit_data_offset - || offset - u->unit_data_offset >= u->unit_data_len) - { - error_callback (data, - "abstract origin or specification out of range", - 0); - return NULL; - } - - offset -= u->unit_data_offset; - - unit_buf.name = ".debug_info"; - unit_buf.start = ddata->dwarf_sections.data[DEBUG_INFO]; - unit_buf.buf = u->unit_data + offset; - unit_buf.left = u->unit_data_len - offset; - unit_buf.is_bigendian = ddata->is_bigendian; - unit_buf.error_callback = error_callback; - unit_buf.data = data; - unit_buf.reported_underflow = 0; - - code = read_uleb128 (&unit_buf); - if (code == 0) - { - dwarf_buf_error (&unit_buf, - "invalid abstract origin or specification", - 0); - return NULL; - } - - abbrev = lookup_abbrev (&u->abbrevs, code, error_callback, data); - if (abbrev == NULL) - return NULL; - - ret = NULL; - for (i = 0; i < abbrev->num_attrs; ++i) - { - struct attr_val val; - - if (!read_attribute (abbrev->attrs[i].form, abbrev->attrs[i].val, - &unit_buf, u->is_dwarf64, u->version, u->addrsize, - &ddata->dwarf_sections, ddata->altlink, &val)) - return NULL; - - switch (abbrev->attrs[i].name) - { - case DW_AT_name: - /* Third name preference: don't override. A name we found in some - other way, will normally be more useful -- e.g., this name is - normally not mangled. */ - if (ret != NULL) - break; - if (!resolve_string (&ddata->dwarf_sections, u->is_dwarf64, - ddata->is_bigendian, u->str_offsets_base, - &val, error_callback, data, &ret)) - return NULL; - break; - - case DW_AT_linkage_name: - case DW_AT_MIPS_linkage_name: - /* First name preference: override all. */ - { - const char *s; - - s = NULL; - if (!resolve_string (&ddata->dwarf_sections, u->is_dwarf64, - ddata->is_bigendian, u->str_offsets_base, - &val, error_callback, data, &s)) - return NULL; - if (s != NULL) - return s; - } - break; - - case DW_AT_specification: - /* Second name preference: override DW_AT_name, don't override - DW_AT_linkage_name. */ - { - const char *name; - - name = read_referenced_name_from_attr (ddata, u, &abbrev->attrs[i], - &val, error_callback, data); - if (name != NULL) - ret = name; - } - break; - - default: - break; - } - } - - return ret; -} - -/* Add a range to a unit that maps to a function. This is called via - add_ranges. Returns 1 on success, 0 on error. */ - -static int -add_function_range (struct backtrace_state *state, void *rdata, - uint64_t lowpc, uint64_t highpc, - backtrace_error_callback error_callback, void *data, - void *pvec) -{ - struct function *function = (struct function *) rdata; - struct function_vector *vec = (struct function_vector *) pvec; - struct function_addrs *p; - - if (vec->count > 0) - { - p = (struct function_addrs *) vec->vec.base + (vec->count - 1); - if ((lowpc == p->high || lowpc == p->high + 1) - && function == p->function) - { - if (highpc > p->high) - p->high = highpc; - return 1; - } - } - - p = ((struct function_addrs *) - backtrace_vector_grow (state, sizeof (struct function_addrs), - error_callback, data, &vec->vec)); - if (p == NULL) - return 0; - - p->low = lowpc; - p->high = highpc; - p->function = function; - - ++vec->count; - - return 1; -} - -/* Read one entry plus all its children. Add function addresses to - VEC. Returns 1 on success, 0 on error. */ - -static int -read_function_entry (struct backtrace_state *state, struct dwarf_data *ddata, - struct unit *u, uint64_t base, struct dwarf_buf *unit_buf, - const struct line_header *lhdr, - backtrace_error_callback error_callback, void *data, - struct function_vector *vec_function, - struct function_vector *vec_inlined) -{ - while (unit_buf->left > 0) - { - uint64_t code; - const struct abbrev *abbrev; - int is_function; - struct function *function; - struct function_vector *vec; - size_t i; - struct pcrange pcrange; - int have_linkage_name; - - code = read_uleb128 (unit_buf); - if (code == 0) - return 1; - - abbrev = lookup_abbrev (&u->abbrevs, code, error_callback, data); - if (abbrev == NULL) - return 0; - - is_function = (abbrev->tag == DW_TAG_subprogram - || abbrev->tag == DW_TAG_entry_point - || abbrev->tag == DW_TAG_inlined_subroutine); - - if (abbrev->tag == DW_TAG_inlined_subroutine) - vec = vec_inlined; - else - vec = vec_function; - - function = NULL; - if (is_function) - { - function = ((struct function *) - backtrace_alloc (state, sizeof *function, - error_callback, data)); - if (function == NULL) - return 0; - memset (function, 0, sizeof *function); - } - - memset (&pcrange, 0, sizeof pcrange); - have_linkage_name = 0; - for (i = 0; i < abbrev->num_attrs; ++i) - { - struct attr_val val; - - if (!read_attribute (abbrev->attrs[i].form, abbrev->attrs[i].val, - unit_buf, u->is_dwarf64, u->version, - u->addrsize, &ddata->dwarf_sections, - ddata->altlink, &val)) - return 0; - - /* The compile unit sets the base address for any address - ranges in the function entries. */ - if ((abbrev->tag == DW_TAG_compile_unit - || abbrev->tag == DW_TAG_skeleton_unit) - && abbrev->attrs[i].name == DW_AT_low_pc) - { - if (val.encoding == ATTR_VAL_ADDRESS) - base = val.u.uint; - else if (val.encoding == ATTR_VAL_ADDRESS_INDEX) - { - if (!resolve_addr_index (&ddata->dwarf_sections, - u->addr_base, u->addrsize, - ddata->is_bigendian, val.u.uint, - error_callback, data, &base)) - return 0; - } - } - - if (is_function) - { - switch (abbrev->attrs[i].name) - { - case DW_AT_call_file: - if (val.encoding == ATTR_VAL_UINT) - { - if (val.u.uint >= lhdr->filenames_count) - { - dwarf_buf_error (unit_buf, - ("invalid file number in " - "DW_AT_call_file attribute"), - 0); - return 0; - } - function->caller_filename = lhdr->filenames[val.u.uint]; - } - break; - - case DW_AT_call_line: - if (val.encoding == ATTR_VAL_UINT) - function->caller_lineno = val.u.uint; - break; - - case DW_AT_abstract_origin: - case DW_AT_specification: - /* Second name preference: override DW_AT_name, don't override - DW_AT_linkage_name. */ - if (have_linkage_name) - break; - { - const char *name; - - name - = read_referenced_name_from_attr (ddata, u, - &abbrev->attrs[i], &val, - error_callback, data); - if (name != NULL) - function->name = name; - } - break; - - case DW_AT_name: - /* Third name preference: don't override. */ - if (function->name != NULL) - break; - if (!resolve_string (&ddata->dwarf_sections, u->is_dwarf64, - ddata->is_bigendian, - u->str_offsets_base, &val, - error_callback, data, &function->name)) - return 0; - break; - - case DW_AT_linkage_name: - case DW_AT_MIPS_linkage_name: - /* First name preference: override all. */ - { - const char *s; - - s = NULL; - if (!resolve_string (&ddata->dwarf_sections, u->is_dwarf64, - ddata->is_bigendian, - u->str_offsets_base, &val, - error_callback, data, &s)) - return 0; - if (s != NULL) - { - function->name = s; - have_linkage_name = 1; - } - } - break; - - case DW_AT_low_pc: case DW_AT_high_pc: case DW_AT_ranges: - update_pcrange (&abbrev->attrs[i], &val, &pcrange); - break; - - default: - break; - } - } - } - - /* If we couldn't find a name for the function, we have no use - for it. */ - if (is_function && function->name == NULL) - { - backtrace_free (state, function, sizeof *function, - error_callback, data); - is_function = 0; - } - - if (is_function) - { - if (pcrange.have_ranges - || (pcrange.have_lowpc && pcrange.have_highpc)) - { - if (!add_ranges (state, &ddata->dwarf_sections, - ddata->base_address, ddata->is_bigendian, - u, base, &pcrange, add_function_range, - (void *) function, error_callback, data, - (void *) vec)) - return 0; - } - else - { - backtrace_free (state, function, sizeof *function, - error_callback, data); - is_function = 0; - } - } - - if (abbrev->has_children) - { - if (!is_function) - { - if (!read_function_entry (state, ddata, u, base, unit_buf, lhdr, - error_callback, data, vec_function, - vec_inlined)) - return 0; - } - else - { - struct function_vector fvec; - - /* Gather any information for inlined functions in - FVEC. */ - - memset (&fvec, 0, sizeof fvec); - - if (!read_function_entry (state, ddata, u, base, unit_buf, lhdr, - error_callback, data, vec_function, - &fvec)) - return 0; - - if (fvec.count > 0) - { - struct function_addrs *p; - struct function_addrs *faddrs; - - /* Allocate a trailing entry, but don't include it - in fvec.count. */ - p = ((struct function_addrs *) - backtrace_vector_grow (state, - sizeof (struct function_addrs), - error_callback, data, - &fvec.vec)); - if (p == NULL) - return 0; - p->low = 0; - --p->low; - p->high = p->low; - p->function = NULL; - - if (!backtrace_vector_release (state, &fvec.vec, - error_callback, data)) - return 0; - - faddrs = (struct function_addrs *) fvec.vec.base; - backtrace_qsort (faddrs, fvec.count, - sizeof (struct function_addrs), - function_addrs_compare); - - function->function_addrs = faddrs; - function->function_addrs_count = fvec.count; - } - } - } - } - - return 1; -} - -/* Read function name information for a compilation unit. We look - through the whole unit looking for function tags. */ - -static void -read_function_info (struct backtrace_state *state, struct dwarf_data *ddata, - const struct line_header *lhdr, - backtrace_error_callback error_callback, void *data, - struct unit *u, struct function_vector *fvec, - struct function_addrs **ret_addrs, - size_t *ret_addrs_count) -{ - struct function_vector lvec; - struct function_vector *pfvec; - struct dwarf_buf unit_buf; - struct function_addrs *p; - struct function_addrs *addrs; - size_t addrs_count; - - /* Use FVEC if it is not NULL. Otherwise use our own vector. */ - if (fvec != NULL) - pfvec = fvec; - else - { - memset (&lvec, 0, sizeof lvec); - pfvec = &lvec; - } - - unit_buf.name = ".debug_info"; - unit_buf.start = ddata->dwarf_sections.data[DEBUG_INFO]; - unit_buf.buf = u->unit_data; - unit_buf.left = u->unit_data_len; - unit_buf.is_bigendian = ddata->is_bigendian; - unit_buf.error_callback = error_callback; - unit_buf.data = data; - unit_buf.reported_underflow = 0; - - while (unit_buf.left > 0) - { - if (!read_function_entry (state, ddata, u, 0, &unit_buf, lhdr, - error_callback, data, pfvec, pfvec)) - return; - } - - if (pfvec->count == 0) - return; - - /* Allocate a trailing entry, but don't include it in - pfvec->count. */ - p = ((struct function_addrs *) - backtrace_vector_grow (state, sizeof (struct function_addrs), - error_callback, data, &pfvec->vec)); - if (p == NULL) - return; - p->low = 0; - --p->low; - p->high = p->low; - p->function = NULL; - - addrs_count = pfvec->count; - - if (fvec == NULL) - { - if (!backtrace_vector_release (state, &lvec.vec, error_callback, data)) - return; - addrs = (struct function_addrs *) pfvec->vec.base; - } - else - { - /* Finish this list of addresses, but leave the remaining space in - the vector available for the next function unit. */ - addrs = ((struct function_addrs *) - backtrace_vector_finish (state, &fvec->vec, - error_callback, data)); - if (addrs == NULL) - return; - fvec->count = 0; - } - - backtrace_qsort (addrs, addrs_count, sizeof (struct function_addrs), - function_addrs_compare); - - *ret_addrs = addrs; - *ret_addrs_count = addrs_count; -} - -/* See if PC is inlined in FUNCTION. If it is, print out the inlined - information, and update FILENAME and LINENO for the caller. - Returns whatever CALLBACK returns, or 0 to keep going. */ - -static int -report_inlined_functions (uintptr_t pc, struct function *function, - backtrace_full_callback callback, void *data, - const char **filename, int *lineno) -{ - struct function_addrs *p; - struct function_addrs *match; - struct function *inlined; - int ret; - - if (function->function_addrs_count == 0) - return 0; - - /* Our search isn't safe if pc == -1, as that is the sentinel - value. */ - if (pc + 1 == 0) - return 0; - - p = ((struct function_addrs *) - bsearch (&pc, function->function_addrs, - function->function_addrs_count, - sizeof (struct function_addrs), - function_addrs_search)); - if (p == NULL) - return 0; - - /* Here pc >= p->low && pc < (p + 1)->low. The function_addrs are - sorted by low, so if pc > p->low we are at the end of a range of - function_addrs with the same low value. If pc == p->low walk - forward to the end of the range with that low value. Then walk - backward and use the first range that includes pc. */ - while (pc == (p + 1)->low) - ++p; - match = NULL; - while (1) - { - if (pc < p->high) - { - match = p; - break; - } - if (p == function->function_addrs) - break; - if ((p - 1)->low < p->low) - break; - --p; - } - if (match == NULL) - return 0; - - /* We found an inlined call. */ - - inlined = match->function; - - /* Report any calls inlined into this one. */ - ret = report_inlined_functions (pc, inlined, callback, data, - filename, lineno); - if (ret != 0) - return ret; - - /* Report this inlined call. */ - ret = callback (data, pc, *filename, *lineno, inlined->name); - if (ret != 0) - return ret; - - /* Our caller will report the caller of the inlined function; tell - it the appropriate filename and line number. */ - *filename = inlined->caller_filename; - *lineno = inlined->caller_lineno; - - return 0; -} - -/* Look for a PC in the DWARF mapping for one module. On success, - call CALLBACK and return whatever it returns. On error, call - ERROR_CALLBACK and return 0. Sets *FOUND to 1 if the PC is found, - 0 if not. */ - -static int -dwarf_lookup_pc (struct backtrace_state *state, struct dwarf_data *ddata, - uintptr_t pc, backtrace_full_callback callback, - backtrace_error_callback error_callback, void *data, - int *found) -{ - struct unit_addrs *entry; - int found_entry; - struct unit *u; - int new_data; - struct line *lines; - struct line *ln; - struct function_addrs *p; - struct function_addrs *fmatch; - struct function *function; - const char *filename; - int lineno; - int ret; - - *found = 1; - - /* Find an address range that includes PC. Our search isn't safe if - PC == -1, as we use that as a sentinel value, so skip the search - in that case. */ - entry = (ddata->addrs_count == 0 || pc + 1 == 0 - ? NULL - : bsearch (&pc, ddata->addrs, ddata->addrs_count, - sizeof (struct unit_addrs), unit_addrs_search)); - - if (entry == NULL) - { - *found = 0; - return 0; - } - - /* Here pc >= entry->low && pc < (entry + 1)->low. The unit_addrs - are sorted by low, so if pc > p->low we are at the end of a range - of unit_addrs with the same low value. If pc == p->low walk - forward to the end of the range with that low value. Then walk - backward and use the first range that includes pc. */ - while (pc == (entry + 1)->low) - ++entry; - found_entry = 0; - while (1) - { - if (pc < entry->high) - { - found_entry = 1; - break; - } - if (entry == ddata->addrs) - break; - if ((entry - 1)->low < entry->low) - break; - --entry; - } - if (!found_entry) - { - *found = 0; - return 0; - } - - /* We need the lines, lines_count, function_addrs, - function_addrs_count fields of u. If they are not set, we need - to set them. When running in threaded mode, we need to allow for - the possibility that some other thread is setting them - simultaneously. */ - - u = entry->u; - lines = u->lines; - - /* Skip units with no useful line number information by walking - backward. Useless line number information is marked by setting - lines == -1. */ - while (entry > ddata->addrs - && pc >= (entry - 1)->low - && pc < (entry - 1)->high) - { - if (state->threaded) - lines = (struct line *) backtrace_atomic_load_pointer (&u->lines); - - if (lines != (struct line *) (uintptr_t) -1) - break; - - --entry; - - u = entry->u; - lines = u->lines; - } - - if (state->threaded) - lines = backtrace_atomic_load_pointer (&u->lines); - - new_data = 0; - if (lines == NULL) - { - struct function_addrs *function_addrs; - size_t function_addrs_count; - struct line_header lhdr; - size_t count; - - /* We have never read the line information for this unit. Read - it now. */ - - function_addrs = NULL; - function_addrs_count = 0; - if (read_line_info (state, ddata, error_callback, data, entry->u, &lhdr, - &lines, &count)) - { - struct function_vector *pfvec; - - /* If not threaded, reuse DDATA->FVEC for better memory - consumption. */ - if (state->threaded) - pfvec = NULL; - else - pfvec = &ddata->fvec; - read_function_info (state, ddata, &lhdr, error_callback, data, - entry->u, pfvec, &function_addrs, - &function_addrs_count); - free_line_header (state, &lhdr, error_callback, data); - new_data = 1; - } - - /* Atomically store the information we just read into the unit. - If another thread is simultaneously writing, it presumably - read the same information, and we don't care which one we - wind up with; we just leak the other one. We do have to - write the lines field last, so that the acquire-loads above - ensure that the other fields are set. */ - - if (!state->threaded) - { - u->lines_count = count; - u->function_addrs = function_addrs; - u->function_addrs_count = function_addrs_count; - u->lines = lines; - } - else - { - backtrace_atomic_store_size_t (&u->lines_count, count); - backtrace_atomic_store_pointer (&u->function_addrs, function_addrs); - backtrace_atomic_store_size_t (&u->function_addrs_count, - function_addrs_count); - backtrace_atomic_store_pointer (&u->lines, lines); - } - } - - /* Now all fields of U have been initialized. */ - - if (lines == (struct line *) (uintptr_t) -1) - { - /* If reading the line number information failed in some way, - try again to see if there is a better compilation unit for - this PC. */ - if (new_data) - return dwarf_lookup_pc (state, ddata, pc, callback, error_callback, - data, found); - return callback (data, pc, NULL, 0, NULL); - } - - /* Search for PC within this unit. */ - - ln = (struct line *) bsearch (&pc, lines, entry->u->lines_count, - sizeof (struct line), line_search); - if (ln == NULL) - { - /* The PC is between the low_pc and high_pc attributes of the - compilation unit, but no entry in the line table covers it. - This implies that the start of the compilation unit has no - line number information. */ - - if (entry->u->abs_filename == NULL) - { - const char *filename; - - filename = entry->u->filename; - if (filename != NULL - && !IS_ABSOLUTE_PATH (filename) - && entry->u->comp_dir != NULL) - { - size_t filename_len; - const char *dir; - size_t dir_len; - char *s; - - filename_len = strlen (filename); - dir = entry->u->comp_dir; - dir_len = strlen (dir); - s = (char *) backtrace_alloc (state, dir_len + filename_len + 2, - error_callback, data); - if (s == NULL) - { - *found = 0; - return 0; - } - memcpy (s, dir, dir_len); - /* FIXME: Should use backslash if DOS file system. */ - s[dir_len] = '/'; - memcpy (s + dir_len + 1, filename, filename_len + 1); - filename = s; - } - entry->u->abs_filename = filename; - } - - return callback (data, pc, entry->u->abs_filename, 0, NULL); - } - - /* Search for function name within this unit. */ - - if (entry->u->function_addrs_count == 0) - return callback (data, pc, ln->filename, ln->lineno, NULL); - - p = ((struct function_addrs *) - bsearch (&pc, entry->u->function_addrs, - entry->u->function_addrs_count, - sizeof (struct function_addrs), - function_addrs_search)); - if (p == NULL) - return callback (data, pc, ln->filename, ln->lineno, NULL); - - /* Here pc >= p->low && pc < (p + 1)->low. The function_addrs are - sorted by low, so if pc > p->low we are at the end of a range of - function_addrs with the same low value. If pc == p->low walk - forward to the end of the range with that low value. Then walk - backward and use the first range that includes pc. */ - while (pc == (p + 1)->low) - ++p; - fmatch = NULL; - while (1) - { - if (pc < p->high) - { - fmatch = p; - break; - } - if (p == entry->u->function_addrs) - break; - if ((p - 1)->low < p->low) - break; - --p; - } - if (fmatch == NULL) - return callback (data, pc, ln->filename, ln->lineno, NULL); - - function = fmatch->function; - - filename = ln->filename; - lineno = ln->lineno; - - ret = report_inlined_functions (pc, function, callback, data, - &filename, &lineno); - if (ret != 0) - return ret; - - return callback (data, pc, filename, lineno, function->name); -} - - -/* Return the file/line information for a PC using the DWARF mapping - we built earlier. */ - -static int -dwarf_fileline (struct backtrace_state *state, uintptr_t pc, - backtrace_full_callback callback, - backtrace_error_callback error_callback, void *data) -{ - struct dwarf_data *ddata; - int found; - int ret; - - if (!state->threaded) - { - for (ddata = (struct dwarf_data *) state->fileline_data; - ddata != NULL; - ddata = ddata->next) - { - ret = dwarf_lookup_pc (state, ddata, pc, callback, error_callback, - data, &found); - if (ret != 0 || found) - return ret; - } - } - else - { - struct dwarf_data **pp; - - pp = (struct dwarf_data **) (void *) &state->fileline_data; - while (1) - { - ddata = backtrace_atomic_load_pointer (pp); - if (ddata == NULL) - break; - - ret = dwarf_lookup_pc (state, ddata, pc, callback, error_callback, - data, &found); - if (ret != 0 || found) - return ret; - - pp = &ddata->next; - } - } - - /* FIXME: See if any libraries have been dlopen'ed. */ - - return callback (data, pc, NULL, 0, NULL); -} - -/* Initialize our data structures from the DWARF debug info for a - file. Return NULL on failure. */ - -static struct dwarf_data * -build_dwarf_data (struct backtrace_state *state, - uintptr_t base_address, - const struct dwarf_sections *dwarf_sections, - int is_bigendian, - struct dwarf_data *altlink, - backtrace_error_callback error_callback, - void *data) -{ - struct unit_addrs_vector addrs_vec; - struct unit_addrs *addrs; - size_t addrs_count; - struct unit_vector units_vec; - struct unit **units; - size_t units_count; - struct dwarf_data *fdata; - - if (!build_address_map (state, base_address, dwarf_sections, is_bigendian, - altlink, error_callback, data, &addrs_vec, - &units_vec)) - return NULL; - - if (!backtrace_vector_release (state, &addrs_vec.vec, error_callback, data)) - return NULL; - if (!backtrace_vector_release (state, &units_vec.vec, error_callback, data)) - return NULL; - addrs = (struct unit_addrs *) addrs_vec.vec.base; - units = (struct unit **) units_vec.vec.base; - addrs_count = addrs_vec.count; - units_count = units_vec.count; - backtrace_qsort (addrs, addrs_count, sizeof (struct unit_addrs), - unit_addrs_compare); - /* No qsort for units required, already sorted. */ - - fdata = ((struct dwarf_data *) - backtrace_alloc (state, sizeof (struct dwarf_data), - error_callback, data)); - if (fdata == NULL) - return NULL; - - fdata->next = NULL; - fdata->altlink = altlink; - fdata->base_address = base_address; - fdata->addrs = addrs; - fdata->addrs_count = addrs_count; - fdata->units = units; - fdata->units_count = units_count; - fdata->dwarf_sections = *dwarf_sections; - fdata->is_bigendian = is_bigendian; - memset (&fdata->fvec, 0, sizeof fdata->fvec); - - return fdata; -} - -/* Build our data structures from the DWARF sections for a module. - Set FILELINE_FN and STATE->FILELINE_DATA. Return 1 on success, 0 - on failure. */ - -int -backtrace_dwarf_add (struct backtrace_state *state, - uintptr_t base_address, - const struct dwarf_sections *dwarf_sections, - int is_bigendian, - struct dwarf_data *fileline_altlink, - backtrace_error_callback error_callback, - void *data, fileline *fileline_fn, - struct dwarf_data **fileline_entry) -{ - struct dwarf_data *fdata; - - fdata = build_dwarf_data (state, base_address, dwarf_sections, is_bigendian, - fileline_altlink, error_callback, data); - if (fdata == NULL) - return 0; - - if (fileline_entry != NULL) - *fileline_entry = fdata; - - if (!state->threaded) - { - struct dwarf_data **pp; - - for (pp = (struct dwarf_data **) (void *) &state->fileline_data; - *pp != NULL; - pp = &(*pp)->next) - ; - *pp = fdata; - } - else - { - while (1) - { - struct dwarf_data **pp; - - pp = (struct dwarf_data **) (void *) &state->fileline_data; - - while (1) - { - struct dwarf_data *p; - - p = backtrace_atomic_load_pointer (pp); - - if (p == NULL) - break; - - pp = &p->next; - } - - if (__sync_bool_compare_and_swap (pp, NULL, fdata)) - break; - } - } - - *fileline_fn = dwarf_fileline; - - return 1; -} diff --git a/contrib/libs/backtrace/elf.c b/contrib/libs/backtrace/elf.c deleted file mode 100644 index 77a1a728fd..0000000000 --- a/contrib/libs/backtrace/elf.c +++ /dev/null @@ -1,4924 +0,0 @@ -/* elf.c -- Get debug data from an ELF file for backtraces. - Copyright (C) 2012-2021 Free Software Foundation, Inc. - Written by Ian Lance Taylor, Google. - -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) The name of the author may not be used to - endorse or promote products derived from this software without - specific prior written permission. - -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. */ - -#include "config.h" - -#include <errno.h> -#include <stdlib.h> -#include <string.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <unistd.h> - -#ifdef HAVE_DL_ITERATE_PHDR - #ifdef HAVE_LINK_H - #include <link.h> - #endif - #ifdef HAVE_SYS_LINK_H - #error #include <sys/link.h> - #endif -#endif - -#include "backtrace.h" -#include "internal.h" - -#ifndef S_ISLNK - #ifndef S_IFLNK - #define S_IFLNK 0120000 - #endif - #ifndef S_IFMT - #define S_IFMT 0170000 - #endif - #define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) -#endif - -#ifndef __GNUC__ -#define __builtin_prefetch(p, r, l) -#define unlikely(x) (x) -#else -#define unlikely(x) __builtin_expect(!!(x), 0) -#endif - -#if !defined(HAVE_DECL_STRNLEN) || !HAVE_DECL_STRNLEN - -/* If strnlen is not declared, provide our own version. */ - -static size_t -xstrnlen (const char *s, size_t maxlen) -{ - size_t i; - - for (i = 0; i < maxlen; ++i) - if (s[i] == '\0') - break; - return i; -} - -#define strnlen xstrnlen - -#endif - -#ifndef HAVE_LSTAT - -/* Dummy version of lstat for systems that don't have it. */ - -static int -xlstat (const char *path ATTRIBUTE_UNUSED, struct stat *st ATTRIBUTE_UNUSED) -{ - return -1; -} - -#define lstat xlstat - -#endif - -#ifndef HAVE_READLINK - -/* Dummy version of readlink for systems that don't have it. */ - -static ssize_t -xreadlink (const char *path ATTRIBUTE_UNUSED, char *buf ATTRIBUTE_UNUSED, - size_t bufsz ATTRIBUTE_UNUSED) -{ - return -1; -} - -#define readlink xreadlink - -#endif - -#ifndef HAVE_DL_ITERATE_PHDR - -/* Dummy version of dl_iterate_phdr for systems that don't have it. */ - -#define dl_phdr_info x_dl_phdr_info -#define dl_iterate_phdr x_dl_iterate_phdr - -struct dl_phdr_info -{ - uintptr_t dlpi_addr; - const char *dlpi_name; -}; - -static int -dl_iterate_phdr (int (*callback) (struct dl_phdr_info *, - size_t, void *) ATTRIBUTE_UNUSED, - void *data ATTRIBUTE_UNUSED) -{ - return 0; -} - -#endif /* ! defined (HAVE_DL_ITERATE_PHDR) */ - -/* The configure script must tell us whether we are 32-bit or 64-bit - ELF. We could make this code test and support either possibility, - but there is no point. This code only works for the currently - running executable, which means that we know the ELF mode at - configure time. */ - -#if BACKTRACE_ELF_SIZE != 32 && BACKTRACE_ELF_SIZE != 64 -#error "Unknown BACKTRACE_ELF_SIZE" -#endif - -/* <link.h> might #include <elf.h> which might define our constants - with slightly different values. Undefine them to be safe. */ - -#undef EI_NIDENT -#undef EI_MAG0 -#undef EI_MAG1 -#undef EI_MAG2 -#undef EI_MAG3 -#undef EI_CLASS -#undef EI_DATA -#undef EI_VERSION -#undef ELF_MAG0 -#undef ELF_MAG1 -#undef ELF_MAG2 -#undef ELF_MAG3 -#undef ELFCLASS32 -#undef ELFCLASS64 -#undef ELFDATA2LSB -#undef ELFDATA2MSB -#undef EV_CURRENT -#undef ET_DYN -#undef EM_PPC64 -#undef EF_PPC64_ABI -#undef SHN_LORESERVE -#undef SHN_XINDEX -#undef SHN_UNDEF -#undef SHT_PROGBITS -#undef SHT_SYMTAB -#undef SHT_STRTAB -#undef SHT_DYNSYM -#undef SHF_COMPRESSED -#undef STT_OBJECT -#undef STT_FUNC -#undef NT_GNU_BUILD_ID -#undef ELFCOMPRESS_ZLIB - -/* Basic types. */ - -typedef uint16_t b_elf_half; /* Elf_Half. */ -typedef uint32_t b_elf_word; /* Elf_Word. */ -typedef int32_t b_elf_sword; /* Elf_Sword. */ - -#if BACKTRACE_ELF_SIZE == 32 - -typedef uint32_t b_elf_addr; /* Elf_Addr. */ -typedef uint32_t b_elf_off; /* Elf_Off. */ - -typedef uint32_t b_elf_wxword; /* 32-bit Elf_Word, 64-bit ELF_Xword. */ - -#else - -typedef uint64_t b_elf_addr; /* Elf_Addr. */ -typedef uint64_t b_elf_off; /* Elf_Off. */ -typedef uint64_t b_elf_xword; /* Elf_Xword. */ -typedef int64_t b_elf_sxword; /* Elf_Sxword. */ - -typedef uint64_t b_elf_wxword; /* 32-bit Elf_Word, 64-bit ELF_Xword. */ - -#endif - -/* Data structures and associated constants. */ - -#define EI_NIDENT 16 - -typedef struct { - unsigned char e_ident[EI_NIDENT]; /* ELF "magic number" */ - b_elf_half e_type; /* Identifies object file type */ - b_elf_half e_machine; /* Specifies required architecture */ - b_elf_word e_version; /* Identifies object file version */ - b_elf_addr e_entry; /* Entry point virtual address */ - b_elf_off e_phoff; /* Program header table file offset */ - b_elf_off e_shoff; /* Section header table file offset */ - b_elf_word e_flags; /* Processor-specific flags */ - b_elf_half e_ehsize; /* ELF header size in bytes */ - b_elf_half e_phentsize; /* Program header table entry size */ - b_elf_half e_phnum; /* Program header table entry count */ - b_elf_half e_shentsize; /* Section header table entry size */ - b_elf_half e_shnum; /* Section header table entry count */ - b_elf_half e_shstrndx; /* Section header string table index */ -} b_elf_ehdr; /* Elf_Ehdr. */ - -#define EI_MAG0 0 -#define EI_MAG1 1 -#define EI_MAG2 2 -#define EI_MAG3 3 -#define EI_CLASS 4 -#define EI_DATA 5 -#define EI_VERSION 6 - -#define ELFMAG0 0x7f -#define ELFMAG1 'E' -#define ELFMAG2 'L' -#define ELFMAG3 'F' - -#define ELFCLASS32 1 -#define ELFCLASS64 2 - -#define ELFDATA2LSB 1 -#define ELFDATA2MSB 2 - -#define EV_CURRENT 1 - -#define ET_DYN 3 - -#define EM_PPC64 21 -#define EF_PPC64_ABI 3 - -typedef struct { - b_elf_word sh_name; /* Section name, index in string tbl */ - b_elf_word sh_type; /* Type of section */ - b_elf_wxword sh_flags; /* Miscellaneous section attributes */ - b_elf_addr sh_addr; /* Section virtual addr at execution */ - b_elf_off sh_offset; /* Section file offset */ - b_elf_wxword sh_size; /* Size of section in bytes */ - b_elf_word sh_link; /* Index of another section */ - b_elf_word sh_info; /* Additional section information */ - b_elf_wxword sh_addralign; /* Section alignment */ - b_elf_wxword sh_entsize; /* Entry size if section holds table */ -} b_elf_shdr; /* Elf_Shdr. */ - -#define SHN_UNDEF 0x0000 /* Undefined section */ -#define SHN_LORESERVE 0xFF00 /* Begin range of reserved indices */ -#define SHN_XINDEX 0xFFFF /* Section index is held elsewhere */ - -#define SHT_PROGBITS 1 -#define SHT_SYMTAB 2 -#define SHT_STRTAB 3 -#define SHT_DYNSYM 11 - -#define SHF_COMPRESSED 0x800 - -#if BACKTRACE_ELF_SIZE == 32 - -typedef struct -{ - b_elf_word st_name; /* Symbol name, index in string tbl */ - b_elf_addr st_value; /* Symbol value */ - b_elf_word st_size; /* Symbol size */ - unsigned char st_info; /* Symbol binding and type */ - unsigned char st_other; /* Visibility and other data */ - b_elf_half st_shndx; /* Symbol section index */ -} b_elf_sym; /* Elf_Sym. */ - -#else /* BACKTRACE_ELF_SIZE != 32 */ - -typedef struct -{ - b_elf_word st_name; /* Symbol name, index in string tbl */ - unsigned char st_info; /* Symbol binding and type */ - unsigned char st_other; /* Visibility and other data */ - b_elf_half st_shndx; /* Symbol section index */ - b_elf_addr st_value; /* Symbol value */ - b_elf_xword st_size; /* Symbol size */ -} b_elf_sym; /* Elf_Sym. */ - -#endif /* BACKTRACE_ELF_SIZE != 32 */ - -#define STT_OBJECT 1 -#define STT_FUNC 2 - -typedef struct -{ - uint32_t namesz; - uint32_t descsz; - uint32_t type; - char name[1]; -} b_elf_note; - -#define NT_GNU_BUILD_ID 3 - -#if BACKTRACE_ELF_SIZE == 32 - -typedef struct -{ - b_elf_word ch_type; /* Compresstion algorithm */ - b_elf_word ch_size; /* Uncompressed size */ - b_elf_word ch_addralign; /* Alignment for uncompressed data */ -} b_elf_chdr; /* Elf_Chdr */ - -#else /* BACKTRACE_ELF_SIZE != 32 */ - -typedef struct -{ - b_elf_word ch_type; /* Compression algorithm */ - b_elf_word ch_reserved; /* Reserved */ - b_elf_xword ch_size; /* Uncompressed size */ - b_elf_xword ch_addralign; /* Alignment for uncompressed data */ -} b_elf_chdr; /* Elf_Chdr */ - -#endif /* BACKTRACE_ELF_SIZE != 32 */ - -#define ELFCOMPRESS_ZLIB 1 - -/* Names of sections, indexed by enum dwarf_section in internal.h. */ - -static const char * const dwarf_section_names[DEBUG_MAX] = -{ - ".debug_info", - ".debug_line", - ".debug_abbrev", - ".debug_ranges", - ".debug_str", - ".debug_addr", - ".debug_str_offsets", - ".debug_line_str", - ".debug_rnglists" -}; - -/* Information we gather for the sections we care about. */ - -struct debug_section_info -{ - /* Section file offset. */ - off_t offset; - /* Section size. */ - size_t size; - /* Section contents, after read from file. */ - const unsigned char *data; - /* Whether the SHF_COMPRESSED flag is set for the section. */ - int compressed; -}; - -/* Information we keep for an ELF symbol. */ - -struct elf_symbol -{ - /* The name of the symbol. */ - const char *name; - /* The address of the symbol. */ - uintptr_t address; - /* The size of the symbol. */ - size_t size; -}; - -/* Information to pass to elf_syminfo. */ - -struct elf_syminfo_data -{ - /* Symbols for the next module. */ - struct elf_syminfo_data *next; - /* The ELF symbols, sorted by address. */ - struct elf_symbol *symbols; - /* The number of symbols. */ - size_t count; -}; - -/* A view that works for either a file or memory. */ - -struct elf_view -{ - struct backtrace_view view; - int release; /* If non-zero, must call backtrace_release_view. */ -}; - -/* Information about PowerPC64 ELFv1 .opd section. */ - -struct elf_ppc64_opd_data -{ - /* Address of the .opd section. */ - b_elf_addr addr; - /* Section data. */ - const char *data; - /* Size of the .opd section. */ - size_t size; - /* Corresponding section view. */ - struct elf_view view; -}; - -/* Create a view of SIZE bytes from DESCRIPTOR/MEMORY at OFFSET. */ - -static int -elf_get_view (struct backtrace_state *state, int descriptor, - const unsigned char *memory, size_t memory_size, off_t offset, - uint64_t size, backtrace_error_callback error_callback, - void *data, struct elf_view *view) -{ - if (memory == NULL) - { - view->release = 1; - return backtrace_get_view (state, descriptor, offset, size, - error_callback, data, &view->view); - } - else - { - if ((uint64_t) offset + size > (uint64_t) memory_size) - { - error_callback (data, "out of range for in-memory file", 0); - return 0; - } - view->view.data = (const void *) (memory + offset); - view->view.base = NULL; - view->view.len = size; - view->release = 0; - return 1; - } -} - -/* Release a view read by elf_get_view. */ - -static void -elf_release_view (struct backtrace_state *state, struct elf_view *view, - backtrace_error_callback error_callback, void *data) -{ - if (view->release) - backtrace_release_view (state, &view->view, error_callback, data); -} - -/* Compute the CRC-32 of BUF/LEN. This uses the CRC used for - .gnu_debuglink files. */ - -static uint32_t -elf_crc32 (uint32_t crc, const unsigned char *buf, size_t len) -{ - static const uint32_t crc32_table[256] = - { - 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, - 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, - 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, - 0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, - 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856, - 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, - 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, - 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, - 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, - 0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a, - 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, - 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, - 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, - 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, - 0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e, - 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, - 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, - 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, - 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, - 0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, - 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, - 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, - 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010, - 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, - 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, - 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, - 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, - 0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, - 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344, - 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, - 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, - 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, - 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, - 0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c, - 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, - 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, - 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, - 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, - 0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c, - 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, - 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, - 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, - 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, - 0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, - 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278, - 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, - 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66, - 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, - 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, - 0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, - 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, - 0x2d02ef8d - }; - const unsigned char *end; - - crc = ~crc; - for (end = buf + len; buf < end; ++ buf) - crc = crc32_table[(crc ^ *buf) & 0xff] ^ (crc >> 8); - return ~crc; -} - -/* Return the CRC-32 of the entire file open at DESCRIPTOR. */ - -static uint32_t -elf_crc32_file (struct backtrace_state *state, int descriptor, - backtrace_error_callback error_callback, void *data) -{ - struct stat st; - struct backtrace_view file_view; - uint32_t ret; - - if (fstat (descriptor, &st) < 0) - { - error_callback (data, "fstat", errno); - return 0; - } - - if (!backtrace_get_view (state, descriptor, 0, st.st_size, error_callback, - data, &file_view)) - return 0; - - ret = elf_crc32 (0, (const unsigned char *) file_view.data, st.st_size); - - backtrace_release_view (state, &file_view, error_callback, data); - - return ret; -} - -/* A dummy callback function used when we can't find a symbol - table. */ - -static void -elf_nosyms (struct backtrace_state *state ATTRIBUTE_UNUSED, - uintptr_t addr ATTRIBUTE_UNUSED, - backtrace_syminfo_callback callback ATTRIBUTE_UNUSED, - backtrace_error_callback error_callback, void *data) -{ - error_callback (data, "no symbol table in ELF executable", -1); -} - -/* A callback function used when we can't find any debug info. */ - -static int -elf_nodebug (struct backtrace_state *state, uintptr_t pc, - backtrace_full_callback callback, - backtrace_error_callback error_callback, void *data) -{ - if (state->syminfo_fn != NULL && state->syminfo_fn != elf_nosyms) - { - struct backtrace_call_full bdata; - - /* Fetch symbol information so that we can least get the - function name. */ - - bdata.full_callback = callback; - bdata.full_error_callback = error_callback; - bdata.full_data = data; - bdata.ret = 0; - state->syminfo_fn (state, pc, backtrace_syminfo_to_full_callback, - backtrace_syminfo_to_full_error_callback, &bdata); - return bdata.ret; - } - - error_callback (data, "no debug info in ELF executable", -1); - return 0; -} - -/* Compare struct elf_symbol for qsort. */ - -static int -elf_symbol_compare (const void *v1, const void *v2) -{ - const struct elf_symbol *e1 = (const struct elf_symbol *) v1; - const struct elf_symbol *e2 = (const struct elf_symbol *) v2; - - if (e1->address < e2->address) - return -1; - else if (e1->address > e2->address) - return 1; - else - return 0; -} - -/* Compare an ADDR against an elf_symbol for bsearch. We allocate one - extra entry in the array so that this can look safely at the next - entry. */ - -static int -elf_symbol_search (const void *vkey, const void *ventry) -{ - const uintptr_t *key = (const uintptr_t *) vkey; - const struct elf_symbol *entry = (const struct elf_symbol *) ventry; - uintptr_t addr; - - addr = *key; - if (addr < entry->address) - return -1; - else if (addr >= entry->address + entry->size) - return 1; - else - return 0; -} - -/* Initialize the symbol table info for elf_syminfo. */ - -static int -elf_initialize_syminfo (struct backtrace_state *state, - uintptr_t base_address, - const unsigned char *symtab_data, size_t symtab_size, - const unsigned char *strtab, size_t strtab_size, - backtrace_error_callback error_callback, - void *data, struct elf_syminfo_data *sdata, - struct elf_ppc64_opd_data *opd) -{ - size_t sym_count; - const b_elf_sym *sym; - size_t elf_symbol_count; - size_t elf_symbol_size; - struct elf_symbol *elf_symbols; - size_t i; - unsigned int j; - - sym_count = symtab_size / sizeof (b_elf_sym); - - /* We only care about function symbols. Count them. */ - sym = (const b_elf_sym *) symtab_data; - elf_symbol_count = 0; - for (i = 0; i < sym_count; ++i, ++sym) - { - int info; - - info = sym->st_info & 0xf; - if ((info == STT_FUNC || info == STT_OBJECT) - && sym->st_shndx != SHN_UNDEF) - ++elf_symbol_count; - } - - elf_symbol_size = elf_symbol_count * sizeof (struct elf_symbol); - elf_symbols = ((struct elf_symbol *) - backtrace_alloc (state, elf_symbol_size, error_callback, - data)); - if (elf_symbols == NULL) - return 0; - - sym = (const b_elf_sym *) symtab_data; - j = 0; - for (i = 0; i < sym_count; ++i, ++sym) - { - int info; - - info = sym->st_info & 0xf; - if (info != STT_FUNC && info != STT_OBJECT) - continue; - if (sym->st_shndx == SHN_UNDEF) - continue; - if (sym->st_name >= strtab_size) - { - error_callback (data, "symbol string index out of range", 0); - backtrace_free (state, elf_symbols, elf_symbol_size, error_callback, - data); - return 0; - } - elf_symbols[j].name = (const char *) strtab + sym->st_name; - /* Special case PowerPC64 ELFv1 symbols in .opd section, if the symbol - is a function descriptor, read the actual code address from the - descriptor. */ - if (opd - && sym->st_value >= opd->addr - && sym->st_value < opd->addr + opd->size) - elf_symbols[j].address - = *(const b_elf_addr *) (opd->data + (sym->st_value - opd->addr)); - else - elf_symbols[j].address = sym->st_value; - elf_symbols[j].address += base_address; - elf_symbols[j].size = sym->st_size; - ++j; - } - - backtrace_qsort (elf_symbols, elf_symbol_count, sizeof (struct elf_symbol), - elf_symbol_compare); - - sdata->next = NULL; - sdata->symbols = elf_symbols; - sdata->count = elf_symbol_count; - - return 1; -} - -/* Add EDATA to the list in STATE. */ - -static void -elf_add_syminfo_data (struct backtrace_state *state, - struct elf_syminfo_data *edata) -{ - if (!state->threaded) - { - struct elf_syminfo_data **pp; - - for (pp = (struct elf_syminfo_data **) (void *) &state->syminfo_data; - *pp != NULL; - pp = &(*pp)->next) - ; - *pp = edata; - } - else - { - while (1) - { - struct elf_syminfo_data **pp; - - pp = (struct elf_syminfo_data **) (void *) &state->syminfo_data; - - while (1) - { - struct elf_syminfo_data *p; - - p = backtrace_atomic_load_pointer (pp); - - if (p == NULL) - break; - - pp = &p->next; - } - - if (__sync_bool_compare_and_swap (pp, NULL, edata)) - break; - } - } -} - -/* Return the symbol name and value for an ADDR. */ - -static void -elf_syminfo (struct backtrace_state *state, uintptr_t addr, - backtrace_syminfo_callback callback, - backtrace_error_callback error_callback ATTRIBUTE_UNUSED, - void *data) -{ - struct elf_syminfo_data *edata; - struct elf_symbol *sym = NULL; - - if (!state->threaded) - { - for (edata = (struct elf_syminfo_data *) state->syminfo_data; - edata != NULL; - edata = edata->next) - { - sym = ((struct elf_symbol *) - bsearch (&addr, edata->symbols, edata->count, - sizeof (struct elf_symbol), elf_symbol_search)); - if (sym != NULL) - break; - } - } - else - { - struct elf_syminfo_data **pp; - - pp = (struct elf_syminfo_data **) (void *) &state->syminfo_data; - while (1) - { - edata = backtrace_atomic_load_pointer (pp); - if (edata == NULL) - break; - - sym = ((struct elf_symbol *) - bsearch (&addr, edata->symbols, edata->count, - sizeof (struct elf_symbol), elf_symbol_search)); - if (sym != NULL) - break; - - pp = &edata->next; - } - } - - if (sym == NULL) - callback (data, addr, NULL, 0, 0); - else - callback (data, addr, sym->name, sym->address, sym->size); -} - -/* Return whether FILENAME is a symlink. */ - -static int -elf_is_symlink (const char *filename) -{ - struct stat st; - - if (lstat (filename, &st) < 0) - return 0; - return S_ISLNK (st.st_mode); -} - -/* Return the results of reading the symlink FILENAME in a buffer - allocated by backtrace_alloc. Return the length of the buffer in - *LEN. */ - -static char * -elf_readlink (struct backtrace_state *state, const char *filename, - backtrace_error_callback error_callback, void *data, - size_t *plen) -{ - size_t len; - char *buf; - - len = 128; - while (1) - { - ssize_t rl; - - buf = backtrace_alloc (state, len, error_callback, data); - if (buf == NULL) - return NULL; - rl = readlink (filename, buf, len); - if (rl < 0) - { - backtrace_free (state, buf, len, error_callback, data); - return NULL; - } - if ((size_t) rl < len - 1) - { - buf[rl] = '\0'; - *plen = len; - return buf; - } - backtrace_free (state, buf, len, error_callback, data); - len *= 2; - } -} - -#define SYSTEM_BUILD_ID_DIR "/usr/lib/debug/.build-id/" - -/* Open a separate debug info file, using the build ID to find it. - Returns an open file descriptor, or -1. - - The GDB manual says that the only place gdb looks for a debug file - when the build ID is known is in /usr/lib/debug/.build-id. */ - -static int -elf_open_debugfile_by_buildid (struct backtrace_state *state, - const char *buildid_data, size_t buildid_size, - backtrace_error_callback error_callback, - void *data) -{ - const char * const prefix = SYSTEM_BUILD_ID_DIR; - const size_t prefix_len = strlen (prefix); - const char * const suffix = ".debug"; - const size_t suffix_len = strlen (suffix); - size_t len; - char *bd_filename; - char *t; - size_t i; - int ret; - int does_not_exist; - - len = prefix_len + buildid_size * 2 + suffix_len + 2; - bd_filename = backtrace_alloc (state, len, error_callback, data); - if (bd_filename == NULL) - return -1; - - t = bd_filename; - memcpy (t, prefix, prefix_len); - t += prefix_len; - for (i = 0; i < buildid_size; i++) - { - unsigned char b; - unsigned char nib; - - b = (unsigned char) buildid_data[i]; - nib = (b & 0xf0) >> 4; - *t++ = nib < 10 ? '0' + nib : 'a' + nib - 10; - nib = b & 0x0f; - *t++ = nib < 10 ? '0' + nib : 'a' + nib - 10; - if (i == 0) - *t++ = '/'; - } - memcpy (t, suffix, suffix_len); - t[suffix_len] = '\0'; - - ret = backtrace_open (bd_filename, error_callback, data, &does_not_exist); - - backtrace_free (state, bd_filename, len, error_callback, data); - - /* gdb checks that the debuginfo file has the same build ID note. - That seems kind of pointless to me--why would it have the right - name but not the right build ID?--so skipping the check. */ - - return ret; -} - -/* Try to open a file whose name is PREFIX (length PREFIX_LEN) - concatenated with PREFIX2 (length PREFIX2_LEN) concatenated with - DEBUGLINK_NAME. Returns an open file descriptor, or -1. */ - -static int -elf_try_debugfile (struct backtrace_state *state, const char *prefix, - size_t prefix_len, const char *prefix2, size_t prefix2_len, - const char *debuglink_name, - backtrace_error_callback error_callback, void *data) -{ - size_t debuglink_len; - size_t try_len; - char *try; - int does_not_exist; - int ret; - - debuglink_len = strlen (debuglink_name); - try_len = prefix_len + prefix2_len + debuglink_len + 1; - try = backtrace_alloc (state, try_len, error_callback, data); - if (try == NULL) - return -1; - - memcpy (try, prefix, prefix_len); - memcpy (try + prefix_len, prefix2, prefix2_len); - memcpy (try + prefix_len + prefix2_len, debuglink_name, debuglink_len); - try[prefix_len + prefix2_len + debuglink_len] = '\0'; - - ret = backtrace_open (try, error_callback, data, &does_not_exist); - - backtrace_free (state, try, try_len, error_callback, data); - - return ret; -} - -/* Find a separate debug info file, using the debuglink section data - to find it. Returns an open file descriptor, or -1. */ - -static int -elf_find_debugfile_by_debuglink (struct backtrace_state *state, - const char *filename, - const char *debuglink_name, - backtrace_error_callback error_callback, - void *data) -{ - int ret; - char *alc; - size_t alc_len; - const char *slash; - int ddescriptor; - const char *prefix; - size_t prefix_len; - - /* Resolve symlinks in FILENAME. Since FILENAME is fairly likely to - be /proc/self/exe, symlinks are common. We don't try to resolve - the whole path name, just the base name. */ - ret = -1; - alc = NULL; - alc_len = 0; - while (elf_is_symlink (filename)) - { - char *new_buf; - size_t new_len; - - new_buf = elf_readlink (state, filename, error_callback, data, &new_len); - if (new_buf == NULL) - break; - - if (new_buf[0] == '/') - filename = new_buf; - else - { - slash = strrchr (filename, '/'); - if (slash == NULL) - filename = new_buf; - else - { - size_t clen; - char *c; - - slash++; - clen = slash - filename + strlen (new_buf) + 1; - c = backtrace_alloc (state, clen, error_callback, data); - if (c == NULL) - goto done; - - memcpy (c, filename, slash - filename); - memcpy (c + (slash - filename), new_buf, strlen (new_buf)); - c[slash - filename + strlen (new_buf)] = '\0'; - backtrace_free (state, new_buf, new_len, error_callback, data); - filename = c; - new_buf = c; - new_len = clen; - } - } - - if (alc != NULL) - backtrace_free (state, alc, alc_len, error_callback, data); - alc = new_buf; - alc_len = new_len; - } - - /* Look for DEBUGLINK_NAME in the same directory as FILENAME. */ - - slash = strrchr (filename, '/'); - if (slash == NULL) - { - prefix = ""; - prefix_len = 0; - } - else - { - slash++; - prefix = filename; - prefix_len = slash - filename; - } - - ddescriptor = elf_try_debugfile (state, prefix, prefix_len, "", 0, - debuglink_name, error_callback, data); - if (ddescriptor >= 0) - { - ret = ddescriptor; - goto done; - } - - /* Look for DEBUGLINK_NAME in a .debug subdirectory of FILENAME. */ - - ddescriptor = elf_try_debugfile (state, prefix, prefix_len, ".debug/", - strlen (".debug/"), debuglink_name, - error_callback, data); - if (ddescriptor >= 0) - { - ret = ddescriptor; - goto done; - } - - /* Look for DEBUGLINK_NAME in /usr/lib/debug. */ - - ddescriptor = elf_try_debugfile (state, "/usr/lib/debug/", - strlen ("/usr/lib/debug/"), prefix, - prefix_len, debuglink_name, - error_callback, data); - if (ddescriptor >= 0) - ret = ddescriptor; - - done: - if (alc != NULL && alc_len > 0) - backtrace_free (state, alc, alc_len, error_callback, data); - return ret; -} - -/* Open a separate debug info file, using the debuglink section data - to find it. Returns an open file descriptor, or -1. */ - -static int -elf_open_debugfile_by_debuglink (struct backtrace_state *state, - const char *filename, - const char *debuglink_name, - uint32_t debuglink_crc, - backtrace_error_callback error_callback, - void *data) -{ - int ddescriptor; - - ddescriptor = elf_find_debugfile_by_debuglink (state, filename, - debuglink_name, - error_callback, data); - if (ddescriptor < 0) - return -1; - - if (debuglink_crc != 0) - { - uint32_t got_crc; - - got_crc = elf_crc32_file (state, ddescriptor, error_callback, data); - if (got_crc != debuglink_crc) - { - backtrace_close (ddescriptor, error_callback, data); - return -1; - } - } - - return ddescriptor; -} - -/* A function useful for setting a breakpoint for an inflation failure - when this code is compiled with -g. */ - -static void -elf_uncompress_failed(void) -{ -} - -/* *PVAL is the current value being read from the stream, and *PBITS - is the number of valid bits. Ensure that *PVAL holds at least 15 - bits by reading additional bits from *PPIN, up to PINEND, as - needed. Updates *PPIN, *PVAL and *PBITS. Returns 1 on success, 0 - on error. */ - -static int -elf_zlib_fetch (const unsigned char **ppin, const unsigned char *pinend, - uint64_t *pval, unsigned int *pbits) -{ - unsigned int bits; - const unsigned char *pin; - uint64_t val; - uint32_t next; - - bits = *pbits; - if (bits >= 15) - return 1; - pin = *ppin; - val = *pval; - - if (unlikely (pinend - pin < 4)) - { - elf_uncompress_failed (); - return 0; - } - -#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) \ - && defined(__ORDER_BIG_ENDIAN__) \ - && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ \ - || __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) - /* We've ensured that PIN is aligned. */ - next = *(const uint32_t *)pin; - -#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ - next = __builtin_bswap32 (next); -#endif -#else - next = pin[0] | (pin[1] << 8) | (pin[2] << 16) | (pin[3] << 24); -#endif - - val |= (uint64_t)next << bits; - bits += 32; - pin += 4; - - /* We will need the next four bytes soon. */ - __builtin_prefetch (pin, 0, 0); - - *ppin = pin; - *pval = val; - *pbits = bits; - return 1; -} - -/* Huffman code tables, like the rest of the zlib format, are defined - by RFC 1951. We store a Huffman code table as a series of tables - stored sequentially in memory. Each entry in a table is 16 bits. - The first, main, table has 256 entries. It is followed by a set of - secondary tables of length 2 to 128 entries. The maximum length of - a code sequence in the deflate format is 15 bits, so that is all we - need. Each secondary table has an index, which is the offset of - the table in the overall memory storage. - - The deflate format says that all codes of a given bit length are - lexicographically consecutive. Perhaps we could have 130 values - that require a 15-bit code, perhaps requiring three secondary - tables of size 128. I don't know if this is actually possible, but - it suggests that the maximum size required for secondary tables is - 3 * 128 + 3 * 64 ... == 768. The zlib enough program reports 660 - as the maximum. We permit 768, since in addition to the 256 for - the primary table, with two bytes per entry, and with the two - tables we need, that gives us a page. - - A single table entry needs to store a value or (for the main table - only) the index and size of a secondary table. Values range from 0 - to 285, inclusive. Secondary table indexes, per above, range from - 0 to 510. For a value we need to store the number of bits we need - to determine that value (one value may appear multiple times in the - table), which is 1 to 8. For a secondary table we need to store - the number of bits used to index into the table, which is 1 to 7. - And of course we need 1 bit to decide whether we have a value or a - secondary table index. So each entry needs 9 bits for value/table - index, 3 bits for size, 1 bit what it is. For simplicity we use 16 - bits per entry. */ - -/* Number of entries we allocate to for one code table. We get a page - for the two code tables we need. */ - -#define HUFFMAN_TABLE_SIZE (1024) - -/* Bit masks and shifts for the values in the table. */ - -#define HUFFMAN_VALUE_MASK 0x01ff -#define HUFFMAN_BITS_SHIFT 9 -#define HUFFMAN_BITS_MASK 0x7 -#define HUFFMAN_SECONDARY_SHIFT 12 - -/* For working memory while inflating we need two code tables, we need - an array of code lengths (max value 15, so we use unsigned char), - and an array of unsigned shorts used while building a table. The - latter two arrays must be large enough to hold the maximum number - of code lengths, which RFC 1951 defines as 286 + 30. */ - -#define ZDEBUG_TABLE_SIZE \ - (2 * HUFFMAN_TABLE_SIZE * sizeof (uint16_t) \ - + (286 + 30) * sizeof (uint16_t) \ - + (286 + 30) * sizeof (unsigned char)) - -#define ZDEBUG_TABLE_CODELEN_OFFSET \ - (2 * HUFFMAN_TABLE_SIZE * sizeof (uint16_t) \ - + (286 + 30) * sizeof (uint16_t)) - -#define ZDEBUG_TABLE_WORK_OFFSET \ - (2 * HUFFMAN_TABLE_SIZE * sizeof (uint16_t)) - -#ifdef BACKTRACE_GENERATE_FIXED_HUFFMAN_TABLE - -/* Used by the main function that generates the fixed table to learn - the table size. */ -static size_t final_next_secondary; - -#endif - -/* Build a Huffman code table from an array of lengths in CODES of - length CODES_LEN. The table is stored into *TABLE. ZDEBUG_TABLE - is the same as for elf_zlib_inflate, used to find some work space. - Returns 1 on success, 0 on error. */ - -static int -elf_zlib_inflate_table (unsigned char *codes, size_t codes_len, - uint16_t *zdebug_table, uint16_t *table) -{ - uint16_t count[16]; - uint16_t start[16]; - uint16_t prev[16]; - uint16_t firstcode[7]; - uint16_t *next; - size_t i; - size_t j; - unsigned int code; - size_t next_secondary; - - /* Count the number of code of each length. Set NEXT[val] to be the - next value after VAL with the same bit length. */ - - next = (uint16_t *) (((unsigned char *) zdebug_table) - + ZDEBUG_TABLE_WORK_OFFSET); - - memset (&count[0], 0, 16 * sizeof (uint16_t)); - for (i = 0; i < codes_len; ++i) - { - if (unlikely (codes[i] >= 16)) - { - elf_uncompress_failed (); - return 0; - } - - if (count[codes[i]] == 0) - { - start[codes[i]] = i; - prev[codes[i]] = i; - } - else - { - next[prev[codes[i]]] = i; - prev[codes[i]] = i; - } - - ++count[codes[i]]; - } - - /* For each length, fill in the table for the codes of that - length. */ - - memset (table, 0, HUFFMAN_TABLE_SIZE * sizeof (uint16_t)); - - /* Handle the values that do not require a secondary table. */ - - code = 0; - for (j = 1; j <= 8; ++j) - { - unsigned int jcnt; - unsigned int val; - - jcnt = count[j]; - if (jcnt == 0) - continue; - - if (unlikely (jcnt > (1U << j))) - { - elf_uncompress_failed (); - return 0; - } - - /* There are JCNT values that have this length, the values - starting from START[j] continuing through NEXT[VAL]. Those - values are assigned consecutive values starting at CODE. */ - - val = start[j]; - for (i = 0; i < jcnt; ++i) - { - uint16_t tval; - size_t ind; - unsigned int incr; - - /* In the compressed bit stream, the value VAL is encoded as - J bits with the value C. */ - - if (unlikely ((val & ~HUFFMAN_VALUE_MASK) != 0)) - { - elf_uncompress_failed (); - return 0; - } - - tval = val | ((j - 1) << HUFFMAN_BITS_SHIFT); - - /* The table lookup uses 8 bits. If J is less than 8, we - don't know what the other bits will be. We need to fill - in all possibilities in the table. Since the Huffman - code is unambiguous, those entries can't be used for any - other code. */ - - for (ind = code; ind < 0x100; ind += 1 << j) - { - if (unlikely (table[ind] != 0)) - { - elf_uncompress_failed (); - return 0; - } - table[ind] = tval; - } - - /* Advance to the next value with this length. */ - if (i + 1 < jcnt) - val = next[val]; - - /* The Huffman codes are stored in the bitstream with the - most significant bit first, as is required to make them - unambiguous. The effect is that when we read them from - the bitstream we see the bit sequence in reverse order: - the most significant bit of the Huffman code is the least - significant bit of the value we read from the bitstream. - That means that to make our table lookups work, we need - to reverse the bits of CODE. Since reversing bits is - tedious and in general requires using a table, we instead - increment CODE in reverse order. That is, if the number - of bits we are currently using, here named J, is 3, we - count as 000, 100, 010, 110, 001, 101, 011, 111, which is - to say the numbers from 0 to 7 but with the bits - reversed. Going to more bits, aka incrementing J, - effectively just adds more zero bits as the beginning, - and as such does not change the numeric value of CODE. - - To increment CODE of length J in reverse order, find the - most significant zero bit and set it to one while - clearing all higher bits. In other words, add 1 modulo - 2^J, only reversed. */ - - incr = 1U << (j - 1); - while ((code & incr) != 0) - incr >>= 1; - if (incr == 0) - code = 0; - else - { - code &= incr - 1; - code += incr; - } - } - } - - /* Handle the values that require a secondary table. */ - - /* Set FIRSTCODE, the number at which the codes start, for each - length. */ - - for (j = 9; j < 16; j++) - { - unsigned int jcnt; - unsigned int k; - - jcnt = count[j]; - if (jcnt == 0) - continue; - - /* There are JCNT values that have this length, the values - starting from START[j]. Those values are assigned - consecutive values starting at CODE. */ - - firstcode[j - 9] = code; - - /* Reverse add JCNT to CODE modulo 2^J. */ - for (k = 0; k < j; ++k) - { - if ((jcnt & (1U << k)) != 0) - { - unsigned int m; - unsigned int bit; - - bit = 1U << (j - k - 1); - for (m = 0; m < j - k; ++m, bit >>= 1) - { - if ((code & bit) == 0) - { - code += bit; - break; - } - code &= ~bit; - } - jcnt &= ~(1U << k); - } - } - if (unlikely (jcnt != 0)) - { - elf_uncompress_failed (); - return 0; - } - } - - /* For J from 9 to 15, inclusive, we store COUNT[J] consecutive - values starting at START[J] with consecutive codes starting at - FIRSTCODE[J - 9]. In the primary table we need to point to the - secondary table, and the secondary table will be indexed by J - 9 - bits. We count down from 15 so that we install the larger - secondary tables first, as the smaller ones may be embedded in - the larger ones. */ - - next_secondary = 0; /* Index of next secondary table (after primary). */ - for (j = 15; j >= 9; j--) - { - unsigned int jcnt; - unsigned int val; - size_t primary; /* Current primary index. */ - size_t secondary; /* Offset to current secondary table. */ - size_t secondary_bits; /* Bit size of current secondary table. */ - - jcnt = count[j]; - if (jcnt == 0) - continue; - - val = start[j]; - code = firstcode[j - 9]; - primary = 0x100; - secondary = 0; - secondary_bits = 0; - for (i = 0; i < jcnt; ++i) - { - uint16_t tval; - size_t ind; - unsigned int incr; - - if ((code & 0xff) != primary) - { - uint16_t tprimary; - - /* Fill in a new primary table entry. */ - - primary = code & 0xff; - - tprimary = table[primary]; - if (tprimary == 0) - { - /* Start a new secondary table. */ - - if (unlikely ((next_secondary & HUFFMAN_VALUE_MASK) - != next_secondary)) - { - elf_uncompress_failed (); - return 0; - } - - secondary = next_secondary; - secondary_bits = j - 8; - next_secondary += 1 << secondary_bits; - table[primary] = (secondary - + ((j - 8) << HUFFMAN_BITS_SHIFT) - + (1U << HUFFMAN_SECONDARY_SHIFT)); - } - else - { - /* There is an existing entry. It had better be a - secondary table with enough bits. */ - if (unlikely ((tprimary & (1U << HUFFMAN_SECONDARY_SHIFT)) - == 0)) - { - elf_uncompress_failed (); - return 0; - } - secondary = tprimary & HUFFMAN_VALUE_MASK; - secondary_bits = ((tprimary >> HUFFMAN_BITS_SHIFT) - & HUFFMAN_BITS_MASK); - if (unlikely (secondary_bits < j - 8)) - { - elf_uncompress_failed (); - return 0; - } - } - } - - /* Fill in secondary table entries. */ - - tval = val | ((j - 8) << HUFFMAN_BITS_SHIFT); - - for (ind = code >> 8; - ind < (1U << secondary_bits); - ind += 1U << (j - 8)) - { - if (unlikely (table[secondary + 0x100 + ind] != 0)) - { - elf_uncompress_failed (); - return 0; - } - table[secondary + 0x100 + ind] = tval; - } - - if (i + 1 < jcnt) - val = next[val]; - - incr = 1U << (j - 1); - while ((code & incr) != 0) - incr >>= 1; - if (incr == 0) - code = 0; - else - { - code &= incr - 1; - code += incr; - } - } - } - -#ifdef BACKTRACE_GENERATE_FIXED_HUFFMAN_TABLE - final_next_secondary = next_secondary; -#endif - - return 1; -} - -#ifdef BACKTRACE_GENERATE_FIXED_HUFFMAN_TABLE - -/* Used to generate the fixed Huffman table for block type 1. */ - -#include <stdio.h> - -static uint16_t table[ZDEBUG_TABLE_SIZE]; -static unsigned char codes[288]; - -int -main () -{ - size_t i; - - for (i = 0; i <= 143; ++i) - codes[i] = 8; - for (i = 144; i <= 255; ++i) - codes[i] = 9; - for (i = 256; i <= 279; ++i) - codes[i] = 7; - for (i = 280; i <= 287; ++i) - codes[i] = 8; - if (!elf_zlib_inflate_table (&codes[0], 288, &table[0], &table[0])) - { - fprintf (stderr, "elf_zlib_inflate_table failed\n"); - exit (EXIT_FAILURE); - } - - printf ("static const uint16_t elf_zlib_default_table[%#zx] =\n", - final_next_secondary + 0x100); - printf ("{\n"); - for (i = 0; i < final_next_secondary + 0x100; i += 8) - { - size_t j; - - printf (" "); - for (j = i; j < final_next_secondary + 0x100 && j < i + 8; ++j) - printf (" %#x,", table[j]); - printf ("\n"); - } - printf ("};\n"); - printf ("\n"); - - for (i = 0; i < 32; ++i) - codes[i] = 5; - if (!elf_zlib_inflate_table (&codes[0], 32, &table[0], &table[0])) - { - fprintf (stderr, "elf_zlib_inflate_table failed\n"); - exit (EXIT_FAILURE); - } - - printf ("static const uint16_t elf_zlib_default_dist_table[%#zx] =\n", - final_next_secondary + 0x100); - printf ("{\n"); - for (i = 0; i < final_next_secondary + 0x100; i += 8) - { - size_t j; - - printf (" "); - for (j = i; j < final_next_secondary + 0x100 && j < i + 8; ++j) - printf (" %#x,", table[j]); - printf ("\n"); - } - printf ("};\n"); - - return 0; -} - -#endif - -/* The fixed tables generated by the #ifdef'ed out main function - above. */ - -static const uint16_t elf_zlib_default_table[0x170] = -{ - 0xd00, 0xe50, 0xe10, 0xf18, 0xd10, 0xe70, 0xe30, 0x1230, - 0xd08, 0xe60, 0xe20, 0x1210, 0xe00, 0xe80, 0xe40, 0x1250, - 0xd04, 0xe58, 0xe18, 0x1200, 0xd14, 0xe78, 0xe38, 0x1240, - 0xd0c, 0xe68, 0xe28, 0x1220, 0xe08, 0xe88, 0xe48, 0x1260, - 0xd02, 0xe54, 0xe14, 0xf1c, 0xd12, 0xe74, 0xe34, 0x1238, - 0xd0a, 0xe64, 0xe24, 0x1218, 0xe04, 0xe84, 0xe44, 0x1258, - 0xd06, 0xe5c, 0xe1c, 0x1208, 0xd16, 0xe7c, 0xe3c, 0x1248, - 0xd0e, 0xe6c, 0xe2c, 0x1228, 0xe0c, 0xe8c, 0xe4c, 0x1268, - 0xd01, 0xe52, 0xe12, 0xf1a, 0xd11, 0xe72, 0xe32, 0x1234, - 0xd09, 0xe62, 0xe22, 0x1214, 0xe02, 0xe82, 0xe42, 0x1254, - 0xd05, 0xe5a, 0xe1a, 0x1204, 0xd15, 0xe7a, 0xe3a, 0x1244, - 0xd0d, 0xe6a, 0xe2a, 0x1224, 0xe0a, 0xe8a, 0xe4a, 0x1264, - 0xd03, 0xe56, 0xe16, 0xf1e, 0xd13, 0xe76, 0xe36, 0x123c, - 0xd0b, 0xe66, 0xe26, 0x121c, 0xe06, 0xe86, 0xe46, 0x125c, - 0xd07, 0xe5e, 0xe1e, 0x120c, 0xd17, 0xe7e, 0xe3e, 0x124c, - 0xd0f, 0xe6e, 0xe2e, 0x122c, 0xe0e, 0xe8e, 0xe4e, 0x126c, - 0xd00, 0xe51, 0xe11, 0xf19, 0xd10, 0xe71, 0xe31, 0x1232, - 0xd08, 0xe61, 0xe21, 0x1212, 0xe01, 0xe81, 0xe41, 0x1252, - 0xd04, 0xe59, 0xe19, 0x1202, 0xd14, 0xe79, 0xe39, 0x1242, - 0xd0c, 0xe69, 0xe29, 0x1222, 0xe09, 0xe89, 0xe49, 0x1262, - 0xd02, 0xe55, 0xe15, 0xf1d, 0xd12, 0xe75, 0xe35, 0x123a, - 0xd0a, 0xe65, 0xe25, 0x121a, 0xe05, 0xe85, 0xe45, 0x125a, - 0xd06, 0xe5d, 0xe1d, 0x120a, 0xd16, 0xe7d, 0xe3d, 0x124a, - 0xd0e, 0xe6d, 0xe2d, 0x122a, 0xe0d, 0xe8d, 0xe4d, 0x126a, - 0xd01, 0xe53, 0xe13, 0xf1b, 0xd11, 0xe73, 0xe33, 0x1236, - 0xd09, 0xe63, 0xe23, 0x1216, 0xe03, 0xe83, 0xe43, 0x1256, - 0xd05, 0xe5b, 0xe1b, 0x1206, 0xd15, 0xe7b, 0xe3b, 0x1246, - 0xd0d, 0xe6b, 0xe2b, 0x1226, 0xe0b, 0xe8b, 0xe4b, 0x1266, - 0xd03, 0xe57, 0xe17, 0xf1f, 0xd13, 0xe77, 0xe37, 0x123e, - 0xd0b, 0xe67, 0xe27, 0x121e, 0xe07, 0xe87, 0xe47, 0x125e, - 0xd07, 0xe5f, 0xe1f, 0x120e, 0xd17, 0xe7f, 0xe3f, 0x124e, - 0xd0f, 0xe6f, 0xe2f, 0x122e, 0xe0f, 0xe8f, 0xe4f, 0x126e, - 0x290, 0x291, 0x292, 0x293, 0x294, 0x295, 0x296, 0x297, - 0x298, 0x299, 0x29a, 0x29b, 0x29c, 0x29d, 0x29e, 0x29f, - 0x2a0, 0x2a1, 0x2a2, 0x2a3, 0x2a4, 0x2a5, 0x2a6, 0x2a7, - 0x2a8, 0x2a9, 0x2aa, 0x2ab, 0x2ac, 0x2ad, 0x2ae, 0x2af, - 0x2b0, 0x2b1, 0x2b2, 0x2b3, 0x2b4, 0x2b5, 0x2b6, 0x2b7, - 0x2b8, 0x2b9, 0x2ba, 0x2bb, 0x2bc, 0x2bd, 0x2be, 0x2bf, - 0x2c0, 0x2c1, 0x2c2, 0x2c3, 0x2c4, 0x2c5, 0x2c6, 0x2c7, - 0x2c8, 0x2c9, 0x2ca, 0x2cb, 0x2cc, 0x2cd, 0x2ce, 0x2cf, - 0x2d0, 0x2d1, 0x2d2, 0x2d3, 0x2d4, 0x2d5, 0x2d6, 0x2d7, - 0x2d8, 0x2d9, 0x2da, 0x2db, 0x2dc, 0x2dd, 0x2de, 0x2df, - 0x2e0, 0x2e1, 0x2e2, 0x2e3, 0x2e4, 0x2e5, 0x2e6, 0x2e7, - 0x2e8, 0x2e9, 0x2ea, 0x2eb, 0x2ec, 0x2ed, 0x2ee, 0x2ef, - 0x2f0, 0x2f1, 0x2f2, 0x2f3, 0x2f4, 0x2f5, 0x2f6, 0x2f7, - 0x2f8, 0x2f9, 0x2fa, 0x2fb, 0x2fc, 0x2fd, 0x2fe, 0x2ff, -}; - -static const uint16_t elf_zlib_default_dist_table[0x100] = -{ - 0x800, 0x810, 0x808, 0x818, 0x804, 0x814, 0x80c, 0x81c, - 0x802, 0x812, 0x80a, 0x81a, 0x806, 0x816, 0x80e, 0x81e, - 0x801, 0x811, 0x809, 0x819, 0x805, 0x815, 0x80d, 0x81d, - 0x803, 0x813, 0x80b, 0x81b, 0x807, 0x817, 0x80f, 0x81f, - 0x800, 0x810, 0x808, 0x818, 0x804, 0x814, 0x80c, 0x81c, - 0x802, 0x812, 0x80a, 0x81a, 0x806, 0x816, 0x80e, 0x81e, - 0x801, 0x811, 0x809, 0x819, 0x805, 0x815, 0x80d, 0x81d, - 0x803, 0x813, 0x80b, 0x81b, 0x807, 0x817, 0x80f, 0x81f, - 0x800, 0x810, 0x808, 0x818, 0x804, 0x814, 0x80c, 0x81c, - 0x802, 0x812, 0x80a, 0x81a, 0x806, 0x816, 0x80e, 0x81e, - 0x801, 0x811, 0x809, 0x819, 0x805, 0x815, 0x80d, 0x81d, - 0x803, 0x813, 0x80b, 0x81b, 0x807, 0x817, 0x80f, 0x81f, - 0x800, 0x810, 0x808, 0x818, 0x804, 0x814, 0x80c, 0x81c, - 0x802, 0x812, 0x80a, 0x81a, 0x806, 0x816, 0x80e, 0x81e, - 0x801, 0x811, 0x809, 0x819, 0x805, 0x815, 0x80d, 0x81d, - 0x803, 0x813, 0x80b, 0x81b, 0x807, 0x817, 0x80f, 0x81f, - 0x800, 0x810, 0x808, 0x818, 0x804, 0x814, 0x80c, 0x81c, - 0x802, 0x812, 0x80a, 0x81a, 0x806, 0x816, 0x80e, 0x81e, - 0x801, 0x811, 0x809, 0x819, 0x805, 0x815, 0x80d, 0x81d, - 0x803, 0x813, 0x80b, 0x81b, 0x807, 0x817, 0x80f, 0x81f, - 0x800, 0x810, 0x808, 0x818, 0x804, 0x814, 0x80c, 0x81c, - 0x802, 0x812, 0x80a, 0x81a, 0x806, 0x816, 0x80e, 0x81e, - 0x801, 0x811, 0x809, 0x819, 0x805, 0x815, 0x80d, 0x81d, - 0x803, 0x813, 0x80b, 0x81b, 0x807, 0x817, 0x80f, 0x81f, - 0x800, 0x810, 0x808, 0x818, 0x804, 0x814, 0x80c, 0x81c, - 0x802, 0x812, 0x80a, 0x81a, 0x806, 0x816, 0x80e, 0x81e, - 0x801, 0x811, 0x809, 0x819, 0x805, 0x815, 0x80d, 0x81d, - 0x803, 0x813, 0x80b, 0x81b, 0x807, 0x817, 0x80f, 0x81f, - 0x800, 0x810, 0x808, 0x818, 0x804, 0x814, 0x80c, 0x81c, - 0x802, 0x812, 0x80a, 0x81a, 0x806, 0x816, 0x80e, 0x81e, - 0x801, 0x811, 0x809, 0x819, 0x805, 0x815, 0x80d, 0x81d, - 0x803, 0x813, 0x80b, 0x81b, 0x807, 0x817, 0x80f, 0x81f, -}; - -/* Inflate a zlib stream from PIN/SIN to POUT/SOUT. Return 1 on - success, 0 on some error parsing the stream. */ - -static int -elf_zlib_inflate (const unsigned char *pin, size_t sin, uint16_t *zdebug_table, - unsigned char *pout, size_t sout) -{ - unsigned char *porigout; - const unsigned char *pinend; - unsigned char *poutend; - - /* We can apparently see multiple zlib streams concatenated - together, so keep going as long as there is something to read. - The last 4 bytes are the checksum. */ - porigout = pout; - pinend = pin + sin; - poutend = pout + sout; - while ((pinend - pin) > 4) - { - uint64_t val; - unsigned int bits; - int last; - - /* Read the two byte zlib header. */ - - if (unlikely ((pin[0] & 0xf) != 8)) /* 8 is zlib encoding. */ - { - /* Unknown compression method. */ - elf_uncompress_failed (); - return 0; - } - if (unlikely ((pin[0] >> 4) > 7)) - { - /* Window size too large. Other than this check, we don't - care about the window size. */ - elf_uncompress_failed (); - return 0; - } - if (unlikely ((pin[1] & 0x20) != 0)) - { - /* Stream expects a predefined dictionary, but we have no - dictionary. */ - elf_uncompress_failed (); - return 0; - } - val = (pin[0] << 8) | pin[1]; - if (unlikely (val % 31 != 0)) - { - /* Header check failure. */ - elf_uncompress_failed (); - return 0; - } - pin += 2; - - /* Align PIN to a 32-bit boundary. */ - - val = 0; - bits = 0; - while ((((uintptr_t) pin) & 3) != 0) - { - val |= (uint64_t)*pin << bits; - bits += 8; - ++pin; - } - - /* Read blocks until one is marked last. */ - - last = 0; - - while (!last) - { - unsigned int type; - const uint16_t *tlit; - const uint16_t *tdist; - - if (!elf_zlib_fetch (&pin, pinend, &val, &bits)) - return 0; - - last = val & 1; - type = (val >> 1) & 3; - val >>= 3; - bits -= 3; - - if (unlikely (type == 3)) - { - /* Invalid block type. */ - elf_uncompress_failed (); - return 0; - } - - if (type == 0) - { - uint16_t len; - uint16_t lenc; - - /* An uncompressed block. */ - - /* If we've read ahead more than a byte, back up. */ - while (bits >= 8) - { - --pin; - bits -= 8; - } - - val = 0; - bits = 0; - if (unlikely ((pinend - pin) < 4)) - { - /* Missing length. */ - elf_uncompress_failed (); - return 0; - } - len = pin[0] | (pin[1] << 8); - lenc = pin[2] | (pin[3] << 8); - pin += 4; - lenc = ~lenc; - if (unlikely (len != lenc)) - { - /* Corrupt data. */ - elf_uncompress_failed (); - return 0; - } - if (unlikely (len > (unsigned int) (pinend - pin) - || len > (unsigned int) (poutend - pout))) - { - /* Not enough space in buffers. */ - elf_uncompress_failed (); - return 0; - } - memcpy (pout, pin, len); - pout += len; - pin += len; - - /* Align PIN. */ - while ((((uintptr_t) pin) & 3) != 0) - { - val |= (uint64_t)*pin << bits; - bits += 8; - ++pin; - } - - /* Go around to read the next block. */ - continue; - } - - if (type == 1) - { - tlit = elf_zlib_default_table; - tdist = elf_zlib_default_dist_table; - } - else - { - unsigned int nlit; - unsigned int ndist; - unsigned int nclen; - unsigned char codebits[19]; - unsigned char *plenbase; - unsigned char *plen; - unsigned char *plenend; - - /* Read a Huffman encoding table. The various magic - numbers here are from RFC 1951. */ - - if (!elf_zlib_fetch (&pin, pinend, &val, &bits)) - return 0; - - nlit = (val & 0x1f) + 257; - val >>= 5; - ndist = (val & 0x1f) + 1; - val >>= 5; - nclen = (val & 0xf) + 4; - val >>= 4; - bits -= 14; - if (unlikely (nlit > 286 || ndist > 30)) - { - /* Values out of range. */ - elf_uncompress_failed (); - return 0; - } - - /* Read and build the table used to compress the - literal, length, and distance codes. */ - - memset(&codebits[0], 0, 19); - - /* There are always at least 4 elements in the - table. */ - - if (!elf_zlib_fetch (&pin, pinend, &val, &bits)) - return 0; - - codebits[16] = val & 7; - codebits[17] = (val >> 3) & 7; - codebits[18] = (val >> 6) & 7; - codebits[0] = (val >> 9) & 7; - val >>= 12; - bits -= 12; - - if (nclen == 4) - goto codebitsdone; - - codebits[8] = val & 7; - val >>= 3; - bits -= 3; - - if (nclen == 5) - goto codebitsdone; - - if (!elf_zlib_fetch (&pin, pinend, &val, &bits)) - return 0; - - codebits[7] = val & 7; - val >>= 3; - bits -= 3; - - if (nclen == 6) - goto codebitsdone; - - codebits[9] = val & 7; - val >>= 3; - bits -= 3; - - if (nclen == 7) - goto codebitsdone; - - codebits[6] = val & 7; - val >>= 3; - bits -= 3; - - if (nclen == 8) - goto codebitsdone; - - codebits[10] = val & 7; - val >>= 3; - bits -= 3; - - if (nclen == 9) - goto codebitsdone; - - codebits[5] = val & 7; - val >>= 3; - bits -= 3; - - if (nclen == 10) - goto codebitsdone; - - if (!elf_zlib_fetch (&pin, pinend, &val, &bits)) - return 0; - - codebits[11] = val & 7; - val >>= 3; - bits -= 3; - - if (nclen == 11) - goto codebitsdone; - - codebits[4] = val & 7; - val >>= 3; - bits -= 3; - - if (nclen == 12) - goto codebitsdone; - - codebits[12] = val & 7; - val >>= 3; - bits -= 3; - - if (nclen == 13) - goto codebitsdone; - - codebits[3] = val & 7; - val >>= 3; - bits -= 3; - - if (nclen == 14) - goto codebitsdone; - - codebits[13] = val & 7; - val >>= 3; - bits -= 3; - - if (nclen == 15) - goto codebitsdone; - - if (!elf_zlib_fetch (&pin, pinend, &val, &bits)) - return 0; - - codebits[2] = val & 7; - val >>= 3; - bits -= 3; - - if (nclen == 16) - goto codebitsdone; - - codebits[14] = val & 7; - val >>= 3; - bits -= 3; - - if (nclen == 17) - goto codebitsdone; - - codebits[1] = val & 7; - val >>= 3; - bits -= 3; - - if (nclen == 18) - goto codebitsdone; - - codebits[15] = val & 7; - val >>= 3; - bits -= 3; - - codebitsdone: - - if (!elf_zlib_inflate_table (codebits, 19, zdebug_table, - zdebug_table)) - return 0; - - /* Read the compressed bit lengths of the literal, - length, and distance codes. We have allocated space - at the end of zdebug_table to hold them. */ - - plenbase = (((unsigned char *) zdebug_table) - + ZDEBUG_TABLE_CODELEN_OFFSET); - plen = plenbase; - plenend = plen + nlit + ndist; - while (plen < plenend) - { - uint16_t t; - unsigned int b; - uint16_t v; - - if (!elf_zlib_fetch (&pin, pinend, &val, &bits)) - return 0; - - t = zdebug_table[val & 0xff]; - - /* The compression here uses bit lengths up to 7, so - a secondary table is never necessary. */ - if (unlikely ((t & (1U << HUFFMAN_SECONDARY_SHIFT)) != 0)) - { - elf_uncompress_failed (); - return 0; - } - - b = (t >> HUFFMAN_BITS_SHIFT) & HUFFMAN_BITS_MASK; - val >>= b + 1; - bits -= b + 1; - - v = t & HUFFMAN_VALUE_MASK; - if (v < 16) - *plen++ = v; - else if (v == 16) - { - unsigned int c; - unsigned int prev; - - /* Copy previous entry 3 to 6 times. */ - - if (unlikely (plen == plenbase)) - { - elf_uncompress_failed (); - return 0; - } - - /* We used up to 7 bits since the last - elf_zlib_fetch, so we have at least 8 bits - available here. */ - - c = 3 + (val & 0x3); - val >>= 2; - bits -= 2; - if (unlikely ((unsigned int) (plenend - plen) < c)) - { - elf_uncompress_failed (); - return 0; - } - - prev = plen[-1]; - switch (c) - { - case 6: - *plen++ = prev; - ATTRIBUTE_FALLTHROUGH; - case 5: - *plen++ = prev; - ATTRIBUTE_FALLTHROUGH; - case 4: - *plen++ = prev; - } - *plen++ = prev; - *plen++ = prev; - *plen++ = prev; - } - else if (v == 17) - { - unsigned int c; - - /* Store zero 3 to 10 times. */ - - /* We used up to 7 bits since the last - elf_zlib_fetch, so we have at least 8 bits - available here. */ - - c = 3 + (val & 0x7); - val >>= 3; - bits -= 3; - if (unlikely ((unsigned int) (plenend - plen) < c)) - { - elf_uncompress_failed (); - return 0; - } - - switch (c) - { - case 10: - *plen++ = 0; - ATTRIBUTE_FALLTHROUGH; - case 9: - *plen++ = 0; - ATTRIBUTE_FALLTHROUGH; - case 8: - *plen++ = 0; - ATTRIBUTE_FALLTHROUGH; - case 7: - *plen++ = 0; - ATTRIBUTE_FALLTHROUGH; - case 6: - *plen++ = 0; - ATTRIBUTE_FALLTHROUGH; - case 5: - *plen++ = 0; - ATTRIBUTE_FALLTHROUGH; - case 4: - *plen++ = 0; - } - *plen++ = 0; - *plen++ = 0; - *plen++ = 0; - } - else if (v == 18) - { - unsigned int c; - - /* Store zero 11 to 138 times. */ - - /* We used up to 7 bits since the last - elf_zlib_fetch, so we have at least 8 bits - available here. */ - - c = 11 + (val & 0x7f); - val >>= 7; - bits -= 7; - if (unlikely ((unsigned int) (plenend - plen) < c)) - { - elf_uncompress_failed (); - return 0; - } - - memset (plen, 0, c); - plen += c; - } - else - { - elf_uncompress_failed (); - return 0; - } - } - - /* Make sure that the stop code can appear. */ - - plen = plenbase; - if (unlikely (plen[256] == 0)) - { - elf_uncompress_failed (); - return 0; - } - - /* Build the decompression tables. */ - - if (!elf_zlib_inflate_table (plen, nlit, zdebug_table, - zdebug_table)) - return 0; - if (!elf_zlib_inflate_table (plen + nlit, ndist, zdebug_table, - zdebug_table + HUFFMAN_TABLE_SIZE)) - return 0; - tlit = zdebug_table; - tdist = zdebug_table + HUFFMAN_TABLE_SIZE; - } - - /* Inflate values until the end of the block. This is the - main loop of the inflation code. */ - - while (1) - { - uint16_t t; - unsigned int b; - uint16_t v; - unsigned int lit; - - if (!elf_zlib_fetch (&pin, pinend, &val, &bits)) - return 0; - - t = tlit[val & 0xff]; - b = (t >> HUFFMAN_BITS_SHIFT) & HUFFMAN_BITS_MASK; - v = t & HUFFMAN_VALUE_MASK; - - if ((t & (1U << HUFFMAN_SECONDARY_SHIFT)) == 0) - { - lit = v; - val >>= b + 1; - bits -= b + 1; - } - else - { - t = tlit[v + 0x100 + ((val >> 8) & ((1U << b) - 1))]; - b = (t >> HUFFMAN_BITS_SHIFT) & HUFFMAN_BITS_MASK; - lit = t & HUFFMAN_VALUE_MASK; - val >>= b + 8; - bits -= b + 8; - } - - if (lit < 256) - { - if (unlikely (pout == poutend)) - { - elf_uncompress_failed (); - return 0; - } - - *pout++ = lit; - - /* We will need to write the next byte soon. We ask - for high temporal locality because we will write - to the whole cache line soon. */ - __builtin_prefetch (pout, 1, 3); - } - else if (lit == 256) - { - /* The end of the block. */ - break; - } - else - { - unsigned int dist; - unsigned int len; - - /* Convert lit into a length. */ - - if (lit < 265) - len = lit - 257 + 3; - else if (lit == 285) - len = 258; - else if (unlikely (lit > 285)) - { - elf_uncompress_failed (); - return 0; - } - else - { - unsigned int extra; - - if (!elf_zlib_fetch (&pin, pinend, &val, &bits)) - return 0; - - /* This is an expression for the table of length - codes in RFC 1951 3.2.5. */ - lit -= 265; - extra = (lit >> 2) + 1; - len = (lit & 3) << extra; - len += 11; - len += ((1U << (extra - 1)) - 1) << 3; - len += val & ((1U << extra) - 1); - val >>= extra; - bits -= extra; - } - - if (!elf_zlib_fetch (&pin, pinend, &val, &bits)) - return 0; - - t = tdist[val & 0xff]; - b = (t >> HUFFMAN_BITS_SHIFT) & HUFFMAN_BITS_MASK; - v = t & HUFFMAN_VALUE_MASK; - - if ((t & (1U << HUFFMAN_SECONDARY_SHIFT)) == 0) - { - dist = v; - val >>= b + 1; - bits -= b + 1; - } - else - { - t = tdist[v + 0x100 + ((val >> 8) & ((1U << b) - 1))]; - b = (t >> HUFFMAN_BITS_SHIFT) & HUFFMAN_BITS_MASK; - dist = t & HUFFMAN_VALUE_MASK; - val >>= b + 8; - bits -= b + 8; - } - - /* Convert dist to a distance. */ - - if (dist == 0) - { - /* A distance of 1. A common case, meaning - repeat the last character LEN times. */ - - if (unlikely (pout == porigout)) - { - elf_uncompress_failed (); - return 0; - } - - if (unlikely ((unsigned int) (poutend - pout) < len)) - { - elf_uncompress_failed (); - return 0; - } - - memset (pout, pout[-1], len); - pout += len; - } - else if (unlikely (dist > 29)) - { - elf_uncompress_failed (); - return 0; - } - else - { - if (dist < 4) - dist = dist + 1; - else - { - unsigned int extra; - - if (!elf_zlib_fetch (&pin, pinend, &val, &bits)) - return 0; - - /* This is an expression for the table of - distance codes in RFC 1951 3.2.5. */ - dist -= 4; - extra = (dist >> 1) + 1; - dist = (dist & 1) << extra; - dist += 5; - dist += ((1U << (extra - 1)) - 1) << 2; - dist += val & ((1U << extra) - 1); - val >>= extra; - bits -= extra; - } - - /* Go back dist bytes, and copy len bytes from - there. */ - - if (unlikely ((unsigned int) (pout - porigout) < dist)) - { - elf_uncompress_failed (); - return 0; - } - - if (unlikely ((unsigned int) (poutend - pout) < len)) - { - elf_uncompress_failed (); - return 0; - } - - if (dist >= len) - { - memcpy (pout, pout - dist, len); - pout += len; - } - else - { - while (len > 0) - { - unsigned int copy; - - copy = len < dist ? len : dist; - memcpy (pout, pout - dist, copy); - len -= copy; - pout += copy; - } - } - } - } - } - } - } - - /* We should have filled the output buffer. */ - if (unlikely (pout != poutend)) - { - elf_uncompress_failed (); - return 0; - } - - return 1; -} - -/* Verify the zlib checksum. The checksum is in the 4 bytes at - CHECKBYTES, and the uncompressed data is at UNCOMPRESSED / - UNCOMPRESSED_SIZE. Returns 1 on success, 0 on failure. */ - -static int -elf_zlib_verify_checksum (const unsigned char *checkbytes, - const unsigned char *uncompressed, - size_t uncompressed_size) -{ - unsigned int i; - unsigned int cksum; - const unsigned char *p; - uint32_t s1; - uint32_t s2; - size_t hsz; - - cksum = 0; - for (i = 0; i < 4; i++) - cksum = (cksum << 8) | checkbytes[i]; - - s1 = 1; - s2 = 0; - - /* Minimize modulo operations. */ - - p = uncompressed; - hsz = uncompressed_size; - while (hsz >= 5552) - { - for (i = 0; i < 5552; i += 16) - { - /* Manually unroll loop 16 times. */ - s1 = s1 + *p++; - s2 = s2 + s1; - s1 = s1 + *p++; - s2 = s2 + s1; - s1 = s1 + *p++; - s2 = s2 + s1; - s1 = s1 + *p++; - s2 = s2 + s1; - s1 = s1 + *p++; - s2 = s2 + s1; - s1 = s1 + *p++; - s2 = s2 + s1; - s1 = s1 + *p++; - s2 = s2 + s1; - s1 = s1 + *p++; - s2 = s2 + s1; - s1 = s1 + *p++; - s2 = s2 + s1; - s1 = s1 + *p++; - s2 = s2 + s1; - s1 = s1 + *p++; - s2 = s2 + s1; - s1 = s1 + *p++; - s2 = s2 + s1; - s1 = s1 + *p++; - s2 = s2 + s1; - s1 = s1 + *p++; - s2 = s2 + s1; - s1 = s1 + *p++; - s2 = s2 + s1; - s1 = s1 + *p++; - s2 = s2 + s1; - } - hsz -= 5552; - s1 %= 65521; - s2 %= 65521; - } - - while (hsz >= 16) - { - /* Manually unroll loop 16 times. */ - s1 = s1 + *p++; - s2 = s2 + s1; - s1 = s1 + *p++; - s2 = s2 + s1; - s1 = s1 + *p++; - s2 = s2 + s1; - s1 = s1 + *p++; - s2 = s2 + s1; - s1 = s1 + *p++; - s2 = s2 + s1; - s1 = s1 + *p++; - s2 = s2 + s1; - s1 = s1 + *p++; - s2 = s2 + s1; - s1 = s1 + *p++; - s2 = s2 + s1; - s1 = s1 + *p++; - s2 = s2 + s1; - s1 = s1 + *p++; - s2 = s2 + s1; - s1 = s1 + *p++; - s2 = s2 + s1; - s1 = s1 + *p++; - s2 = s2 + s1; - s1 = s1 + *p++; - s2 = s2 + s1; - s1 = s1 + *p++; - s2 = s2 + s1; - s1 = s1 + *p++; - s2 = s2 + s1; - s1 = s1 + *p++; - s2 = s2 + s1; - - hsz -= 16; - } - - for (i = 0; i < hsz; ++i) - { - s1 = s1 + *p++; - s2 = s2 + s1; - } - - s1 %= 65521; - s2 %= 65521; - - if (unlikely ((s2 << 16) + s1 != cksum)) - { - elf_uncompress_failed (); - return 0; - } - - return 1; -} - -/* Inflate a zlib stream from PIN/SIN to POUT/SOUT, and verify the - checksum. Return 1 on success, 0 on error. */ - -static int -elf_zlib_inflate_and_verify (const unsigned char *pin, size_t sin, - uint16_t *zdebug_table, unsigned char *pout, - size_t sout) -{ - if (!elf_zlib_inflate (pin, sin, zdebug_table, pout, sout)) - return 0; - if (!elf_zlib_verify_checksum (pin + sin - 4, pout, sout)) - return 0; - return 1; -} - -/* Uncompress the old compressed debug format, the one emitted by - --compress-debug-sections=zlib-gnu. The compressed data is in - COMPRESSED / COMPRESSED_SIZE, and the function writes to - *UNCOMPRESSED / *UNCOMPRESSED_SIZE. ZDEBUG_TABLE is work space to - hold Huffman tables. Returns 0 on error, 1 on successful - decompression or if something goes wrong. In general we try to - carry on, by returning 1, even if we can't decompress. */ - -static int -elf_uncompress_zdebug (struct backtrace_state *state, - const unsigned char *compressed, size_t compressed_size, - uint16_t *zdebug_table, - backtrace_error_callback error_callback, void *data, - unsigned char **uncompressed, size_t *uncompressed_size) -{ - size_t sz; - size_t i; - unsigned char *po; - - *uncompressed = NULL; - *uncompressed_size = 0; - - /* The format starts with the four bytes ZLIB, followed by the 8 - byte length of the uncompressed data in big-endian order, - followed by a zlib stream. */ - - if (compressed_size < 12 || memcmp (compressed, "ZLIB", 4) != 0) - return 1; - - sz = 0; - for (i = 0; i < 8; i++) - sz = (sz << 8) | compressed[i + 4]; - - if (*uncompressed != NULL && *uncompressed_size >= sz) - po = *uncompressed; - else - { - po = (unsigned char *) backtrace_alloc (state, sz, error_callback, data); - if (po == NULL) - return 0; - } - - if (!elf_zlib_inflate_and_verify (compressed + 12, compressed_size - 12, - zdebug_table, po, sz)) - return 1; - - *uncompressed = po; - *uncompressed_size = sz; - - return 1; -} - -/* Uncompress the new compressed debug format, the official standard - ELF approach emitted by --compress-debug-sections=zlib-gabi. The - compressed data is in COMPRESSED / COMPRESSED_SIZE, and the - function writes to *UNCOMPRESSED / *UNCOMPRESSED_SIZE. - ZDEBUG_TABLE is work space as for elf_uncompress_zdebug. Returns 0 - on error, 1 on successful decompression or if something goes wrong. - In general we try to carry on, by returning 1, even if we can't - decompress. */ - -static int -elf_uncompress_chdr (struct backtrace_state *state, - const unsigned char *compressed, size_t compressed_size, - uint16_t *zdebug_table, - backtrace_error_callback error_callback, void *data, - unsigned char **uncompressed, size_t *uncompressed_size) -{ - const b_elf_chdr *chdr; - unsigned char *po; - - *uncompressed = NULL; - *uncompressed_size = 0; - - /* The format starts with an ELF compression header. */ - if (compressed_size < sizeof (b_elf_chdr)) - return 1; - - chdr = (const b_elf_chdr *) compressed; - - if (chdr->ch_type != ELFCOMPRESS_ZLIB) - { - /* Unsupported compression algorithm. */ - return 1; - } - - if (*uncompressed != NULL && *uncompressed_size >= chdr->ch_size) - po = *uncompressed; - else - { - po = (unsigned char *) backtrace_alloc (state, chdr->ch_size, - error_callback, data); - if (po == NULL) - return 0; - } - - if (!elf_zlib_inflate_and_verify (compressed + sizeof (b_elf_chdr), - compressed_size - sizeof (b_elf_chdr), - zdebug_table, po, chdr->ch_size)) - return 1; - - *uncompressed = po; - *uncompressed_size = chdr->ch_size; - - return 1; -} - -/* This function is a hook for testing the zlib support. It is only - used by tests. */ - -int -backtrace_uncompress_zdebug (struct backtrace_state *state, - const unsigned char *compressed, - size_t compressed_size, - backtrace_error_callback error_callback, - void *data, unsigned char **uncompressed, - size_t *uncompressed_size) -{ - uint16_t *zdebug_table; - int ret; - - zdebug_table = ((uint16_t *) backtrace_alloc (state, ZDEBUG_TABLE_SIZE, - error_callback, data)); - if (zdebug_table == NULL) - return 0; - ret = elf_uncompress_zdebug (state, compressed, compressed_size, - zdebug_table, error_callback, data, - uncompressed, uncompressed_size); - backtrace_free (state, zdebug_table, ZDEBUG_TABLE_SIZE, - error_callback, data); - return ret; -} - -/* Number of LZMA states. */ -#define LZMA_STATES (12) - -/* Number of LZMA position states. The pb value of the property byte - is the number of bits to include in these states, and the maximum - value of pb is 4. */ -#define LZMA_POS_STATES (16) - -/* Number of LZMA distance states. These are used match distances - with a short match length: up to 4 bytes. */ -#define LZMA_DIST_STATES (4) - -/* Number of LZMA distance slots. LZMA uses six bits to encode larger - match lengths, so 1 << 6 possible probabilities. */ -#define LZMA_DIST_SLOTS (64) - -/* LZMA distances 0 to 3 are encoded directly, larger values use a - probability model. */ -#define LZMA_DIST_MODEL_START (4) - -/* The LZMA probability model ends at 14. */ -#define LZMA_DIST_MODEL_END (14) - -/* LZMA distance slots for distances less than 127. */ -#define LZMA_FULL_DISTANCES (128) - -/* LZMA uses four alignment bits. */ -#define LZMA_ALIGN_SIZE (16) - -/* LZMA match length is encoded with 4, 5, or 10 bits, some of which - are already known. */ -#define LZMA_LEN_LOW_SYMBOLS (8) -#define LZMA_LEN_MID_SYMBOLS (8) -#define LZMA_LEN_HIGH_SYMBOLS (256) - -/* LZMA literal encoding. */ -#define LZMA_LITERAL_CODERS_MAX (16) -#define LZMA_LITERAL_CODER_SIZE (0x300) - -/* LZMA is based on a large set of probabilities, each managed - independently. Each probability is an 11 bit number that we store - in a uint16_t. We use a single large array of probabilities. */ - -/* Lengths of entries in the LZMA probabilities array. The names used - here are copied from the Linux kernel implementation. */ - -#define LZMA_PROB_IS_MATCH_LEN (LZMA_STATES * LZMA_POS_STATES) -#define LZMA_PROB_IS_REP_LEN LZMA_STATES -#define LZMA_PROB_IS_REP0_LEN LZMA_STATES -#define LZMA_PROB_IS_REP1_LEN LZMA_STATES -#define LZMA_PROB_IS_REP2_LEN LZMA_STATES -#define LZMA_PROB_IS_REP0_LONG_LEN (LZMA_STATES * LZMA_POS_STATES) -#define LZMA_PROB_DIST_SLOT_LEN (LZMA_DIST_STATES * LZMA_DIST_SLOTS) -#define LZMA_PROB_DIST_SPECIAL_LEN (LZMA_FULL_DISTANCES - LZMA_DIST_MODEL_END) -#define LZMA_PROB_DIST_ALIGN_LEN LZMA_ALIGN_SIZE -#define LZMA_PROB_MATCH_LEN_CHOICE_LEN 1 -#define LZMA_PROB_MATCH_LEN_CHOICE2_LEN 1 -#define LZMA_PROB_MATCH_LEN_LOW_LEN (LZMA_POS_STATES * LZMA_LEN_LOW_SYMBOLS) -#define LZMA_PROB_MATCH_LEN_MID_LEN (LZMA_POS_STATES * LZMA_LEN_MID_SYMBOLS) -#define LZMA_PROB_MATCH_LEN_HIGH_LEN LZMA_LEN_HIGH_SYMBOLS -#define LZMA_PROB_REP_LEN_CHOICE_LEN 1 -#define LZMA_PROB_REP_LEN_CHOICE2_LEN 1 -#define LZMA_PROB_REP_LEN_LOW_LEN (LZMA_POS_STATES * LZMA_LEN_LOW_SYMBOLS) -#define LZMA_PROB_REP_LEN_MID_LEN (LZMA_POS_STATES * LZMA_LEN_MID_SYMBOLS) -#define LZMA_PROB_REP_LEN_HIGH_LEN LZMA_LEN_HIGH_SYMBOLS -#define LZMA_PROB_LITERAL_LEN \ - (LZMA_LITERAL_CODERS_MAX * LZMA_LITERAL_CODER_SIZE) - -/* Offsets into the LZMA probabilities array. This is mechanically - generated from the above lengths. */ - -#define LZMA_PROB_IS_MATCH_OFFSET 0 -#define LZMA_PROB_IS_REP_OFFSET \ - (LZMA_PROB_IS_MATCH_OFFSET + LZMA_PROB_IS_MATCH_LEN) -#define LZMA_PROB_IS_REP0_OFFSET \ - (LZMA_PROB_IS_REP_OFFSET + LZMA_PROB_IS_REP_LEN) -#define LZMA_PROB_IS_REP1_OFFSET \ - (LZMA_PROB_IS_REP0_OFFSET + LZMA_PROB_IS_REP0_LEN) -#define LZMA_PROB_IS_REP2_OFFSET \ - (LZMA_PROB_IS_REP1_OFFSET + LZMA_PROB_IS_REP1_LEN) -#define LZMA_PROB_IS_REP0_LONG_OFFSET \ - (LZMA_PROB_IS_REP2_OFFSET + LZMA_PROB_IS_REP2_LEN) -#define LZMA_PROB_DIST_SLOT_OFFSET \ - (LZMA_PROB_IS_REP0_LONG_OFFSET + LZMA_PROB_IS_REP0_LONG_LEN) -#define LZMA_PROB_DIST_SPECIAL_OFFSET \ - (LZMA_PROB_DIST_SLOT_OFFSET + LZMA_PROB_DIST_SLOT_LEN) -#define LZMA_PROB_DIST_ALIGN_OFFSET \ - (LZMA_PROB_DIST_SPECIAL_OFFSET + LZMA_PROB_DIST_SPECIAL_LEN) -#define LZMA_PROB_MATCH_LEN_CHOICE_OFFSET \ - (LZMA_PROB_DIST_ALIGN_OFFSET + LZMA_PROB_DIST_ALIGN_LEN) -#define LZMA_PROB_MATCH_LEN_CHOICE2_OFFSET \ - (LZMA_PROB_MATCH_LEN_CHOICE_OFFSET + LZMA_PROB_MATCH_LEN_CHOICE_LEN) -#define LZMA_PROB_MATCH_LEN_LOW_OFFSET \ - (LZMA_PROB_MATCH_LEN_CHOICE2_OFFSET + LZMA_PROB_MATCH_LEN_CHOICE2_LEN) -#define LZMA_PROB_MATCH_LEN_MID_OFFSET \ - (LZMA_PROB_MATCH_LEN_LOW_OFFSET + LZMA_PROB_MATCH_LEN_LOW_LEN) -#define LZMA_PROB_MATCH_LEN_HIGH_OFFSET \ - (LZMA_PROB_MATCH_LEN_MID_OFFSET + LZMA_PROB_MATCH_LEN_MID_LEN) -#define LZMA_PROB_REP_LEN_CHOICE_OFFSET \ - (LZMA_PROB_MATCH_LEN_HIGH_OFFSET + LZMA_PROB_MATCH_LEN_HIGH_LEN) -#define LZMA_PROB_REP_LEN_CHOICE2_OFFSET \ - (LZMA_PROB_REP_LEN_CHOICE_OFFSET + LZMA_PROB_REP_LEN_CHOICE_LEN) -#define LZMA_PROB_REP_LEN_LOW_OFFSET \ - (LZMA_PROB_REP_LEN_CHOICE2_OFFSET + LZMA_PROB_REP_LEN_CHOICE2_LEN) -#define LZMA_PROB_REP_LEN_MID_OFFSET \ - (LZMA_PROB_REP_LEN_LOW_OFFSET + LZMA_PROB_REP_LEN_LOW_LEN) -#define LZMA_PROB_REP_LEN_HIGH_OFFSET \ - (LZMA_PROB_REP_LEN_MID_OFFSET + LZMA_PROB_REP_LEN_MID_LEN) -#define LZMA_PROB_LITERAL_OFFSET \ - (LZMA_PROB_REP_LEN_HIGH_OFFSET + LZMA_PROB_REP_LEN_HIGH_LEN) - -#define LZMA_PROB_TOTAL_COUNT \ - (LZMA_PROB_LITERAL_OFFSET + LZMA_PROB_LITERAL_LEN) - -/* Check that the number of LZMA probabilities is the same as the - Linux kernel implementation. */ - -#if LZMA_PROB_TOTAL_COUNT != 1846 + (1 << 4) * 0x300 - #error Wrong number of LZMA probabilities -#endif - -/* Expressions for the offset in the LZMA probabilities array of a - specific probability. */ - -#define LZMA_IS_MATCH(state, pos) \ - (LZMA_PROB_IS_MATCH_OFFSET + (state) * LZMA_POS_STATES + (pos)) -#define LZMA_IS_REP(state) \ - (LZMA_PROB_IS_REP_OFFSET + (state)) -#define LZMA_IS_REP0(state) \ - (LZMA_PROB_IS_REP0_OFFSET + (state)) -#define LZMA_IS_REP1(state) \ - (LZMA_PROB_IS_REP1_OFFSET + (state)) -#define LZMA_IS_REP2(state) \ - (LZMA_PROB_IS_REP2_OFFSET + (state)) -#define LZMA_IS_REP0_LONG(state, pos) \ - (LZMA_PROB_IS_REP0_LONG_OFFSET + (state) * LZMA_POS_STATES + (pos)) -#define LZMA_DIST_SLOT(dist, slot) \ - (LZMA_PROB_DIST_SLOT_OFFSET + (dist) * LZMA_DIST_SLOTS + (slot)) -#define LZMA_DIST_SPECIAL(dist) \ - (LZMA_PROB_DIST_SPECIAL_OFFSET + (dist)) -#define LZMA_DIST_ALIGN(dist) \ - (LZMA_PROB_DIST_ALIGN_OFFSET + (dist)) -#define LZMA_MATCH_LEN_CHOICE \ - LZMA_PROB_MATCH_LEN_CHOICE_OFFSET -#define LZMA_MATCH_LEN_CHOICE2 \ - LZMA_PROB_MATCH_LEN_CHOICE2_OFFSET -#define LZMA_MATCH_LEN_LOW(pos, sym) \ - (LZMA_PROB_MATCH_LEN_LOW_OFFSET + (pos) * LZMA_LEN_LOW_SYMBOLS + (sym)) -#define LZMA_MATCH_LEN_MID(pos, sym) \ - (LZMA_PROB_MATCH_LEN_MID_OFFSET + (pos) * LZMA_LEN_MID_SYMBOLS + (sym)) -#define LZMA_MATCH_LEN_HIGH(sym) \ - (LZMA_PROB_MATCH_LEN_HIGH_OFFSET + (sym)) -#define LZMA_REP_LEN_CHOICE \ - LZMA_PROB_REP_LEN_CHOICE_OFFSET -#define LZMA_REP_LEN_CHOICE2 \ - LZMA_PROB_REP_LEN_CHOICE2_OFFSET -#define LZMA_REP_LEN_LOW(pos, sym) \ - (LZMA_PROB_REP_LEN_LOW_OFFSET + (pos) * LZMA_LEN_LOW_SYMBOLS + (sym)) -#define LZMA_REP_LEN_MID(pos, sym) \ - (LZMA_PROB_REP_LEN_MID_OFFSET + (pos) * LZMA_LEN_MID_SYMBOLS + (sym)) -#define LZMA_REP_LEN_HIGH(sym) \ - (LZMA_PROB_REP_LEN_HIGH_OFFSET + (sym)) -#define LZMA_LITERAL(code, size) \ - (LZMA_PROB_LITERAL_OFFSET + (code) * LZMA_LITERAL_CODER_SIZE + (size)) - -/* Read an LZMA varint from BUF, reading and updating *POFFSET, - setting *VAL. Returns 0 on error, 1 on success. */ - -static int -elf_lzma_varint (const unsigned char *compressed, size_t compressed_size, - size_t *poffset, uint64_t *val) -{ - size_t off; - int i; - uint64_t v; - unsigned char b; - - off = *poffset; - i = 0; - v = 0; - while (1) - { - if (unlikely (off >= compressed_size)) - { - elf_uncompress_failed (); - return 0; - } - b = compressed[off]; - v |= (b & 0x7f) << (i * 7); - ++off; - if ((b & 0x80) == 0) - { - *poffset = off; - *val = v; - return 1; - } - ++i; - if (unlikely (i >= 9)) - { - elf_uncompress_failed (); - return 0; - } - } -} - -/* Normalize the LZMA range decoder, pulling in an extra input byte if - needed. */ - -static void -elf_lzma_range_normalize (const unsigned char *compressed, - size_t compressed_size, size_t *poffset, - uint32_t *prange, uint32_t *pcode) -{ - if (*prange < (1U << 24)) - { - if (unlikely (*poffset >= compressed_size)) - { - /* We assume this will be caught elsewhere. */ - elf_uncompress_failed (); - return; - } - *prange <<= 8; - *pcode <<= 8; - *pcode += compressed[*poffset]; - ++*poffset; - } -} - -/* Read and return a single bit from the LZMA stream, reading and - updating *PROB. Each bit comes from the range coder. */ - -static int -elf_lzma_bit (const unsigned char *compressed, size_t compressed_size, - uint16_t *prob, size_t *poffset, uint32_t *prange, - uint32_t *pcode) -{ - uint32_t bound; - - elf_lzma_range_normalize (compressed, compressed_size, poffset, - prange, pcode); - bound = (*prange >> 11) * (uint32_t) *prob; - if (*pcode < bound) - { - *prange = bound; - *prob += ((1U << 11) - *prob) >> 5; - return 0; - } - else - { - *prange -= bound; - *pcode -= bound; - *prob -= *prob >> 5; - return 1; - } -} - -/* Read an integer of size BITS from the LZMA stream, most significant - bit first. The bits are predicted using PROBS. */ - -static uint32_t -elf_lzma_integer (const unsigned char *compressed, size_t compressed_size, - uint16_t *probs, uint32_t bits, size_t *poffset, - uint32_t *prange, uint32_t *pcode) -{ - uint32_t sym; - uint32_t i; - - sym = 1; - for (i = 0; i < bits; i++) - { - int bit; - - bit = elf_lzma_bit (compressed, compressed_size, probs + sym, poffset, - prange, pcode); - sym <<= 1; - sym += bit; - } - return sym - (1 << bits); -} - -/* Read an integer of size BITS from the LZMA stream, least - significant bit first. The bits are predicted using PROBS. */ - -static uint32_t -elf_lzma_reverse_integer (const unsigned char *compressed, - size_t compressed_size, uint16_t *probs, - uint32_t bits, size_t *poffset, uint32_t *prange, - uint32_t *pcode) -{ - uint32_t sym; - uint32_t val; - uint32_t i; - - sym = 1; - val = 0; - for (i = 0; i < bits; i++) - { - int bit; - - bit = elf_lzma_bit (compressed, compressed_size, probs + sym, poffset, - prange, pcode); - sym <<= 1; - sym += bit; - val += bit << i; - } - return val; -} - -/* Read a length from the LZMA stream. IS_REP picks either LZMA_MATCH - or LZMA_REP probabilities. */ - -static uint32_t -elf_lzma_len (const unsigned char *compressed, size_t compressed_size, - uint16_t *probs, int is_rep, unsigned int pos_state, - size_t *poffset, uint32_t *prange, uint32_t *pcode) -{ - uint16_t *probs_choice; - uint16_t *probs_sym; - uint32_t bits; - uint32_t len; - - probs_choice = probs + (is_rep - ? LZMA_REP_LEN_CHOICE - : LZMA_MATCH_LEN_CHOICE); - if (elf_lzma_bit (compressed, compressed_size, probs_choice, poffset, - prange, pcode)) - { - probs_choice = probs + (is_rep - ? LZMA_REP_LEN_CHOICE2 - : LZMA_MATCH_LEN_CHOICE2); - if (elf_lzma_bit (compressed, compressed_size, probs_choice, - poffset, prange, pcode)) - { - probs_sym = probs + (is_rep - ? LZMA_REP_LEN_HIGH (0) - : LZMA_MATCH_LEN_HIGH (0)); - bits = 8; - len = 2 + 8 + 8; - } - else - { - probs_sym = probs + (is_rep - ? LZMA_REP_LEN_MID (pos_state, 0) - : LZMA_MATCH_LEN_MID (pos_state, 0)); - bits = 3; - len = 2 + 8; - } - } - else - { - probs_sym = probs + (is_rep - ? LZMA_REP_LEN_LOW (pos_state, 0) - : LZMA_MATCH_LEN_LOW (pos_state, 0)); - bits = 3; - len = 2; - } - - len += elf_lzma_integer (compressed, compressed_size, probs_sym, bits, - poffset, prange, pcode); - return len; -} - -/* Uncompress one LZMA block from a minidebug file. The compressed - data is at COMPRESSED + *POFFSET. Update *POFFSET. Store the data - into the memory at UNCOMPRESSED, size UNCOMPRESSED_SIZE. CHECK is - the stream flag from the xz header. Return 1 on successful - decompression. */ - -static int -elf_uncompress_lzma_block (const unsigned char *compressed, - size_t compressed_size, unsigned char check, - uint16_t *probs, unsigned char *uncompressed, - size_t uncompressed_size, size_t *poffset) -{ - size_t off; - size_t block_header_offset; - size_t block_header_size; - unsigned char block_flags; - uint64_t header_compressed_size; - uint64_t header_uncompressed_size; - unsigned char lzma2_properties; - uint32_t computed_crc; - uint32_t stream_crc; - size_t uncompressed_offset; - size_t dict_start_offset; - unsigned int lc; - unsigned int lp; - unsigned int pb; - uint32_t range; - uint32_t code; - uint32_t lstate; - uint32_t dist[4]; - - off = *poffset; - block_header_offset = off; - - /* Block header size is a single byte. */ - if (unlikely (off >= compressed_size)) - { - elf_uncompress_failed (); - return 0; - } - block_header_size = (compressed[off] + 1) * 4; - if (unlikely (off + block_header_size > compressed_size)) - { - elf_uncompress_failed (); - return 0; - } - - /* Block flags. */ - block_flags = compressed[off + 1]; - if (unlikely ((block_flags & 0x3c) != 0)) - { - elf_uncompress_failed (); - return 0; - } - - off += 2; - - /* Optional compressed size. */ - header_compressed_size = 0; - if ((block_flags & 0x40) != 0) - { - *poffset = off; - if (!elf_lzma_varint (compressed, compressed_size, poffset, - &header_compressed_size)) - return 0; - off = *poffset; - } - - /* Optional uncompressed size. */ - header_uncompressed_size = 0; - if ((block_flags & 0x80) != 0) - { - *poffset = off; - if (!elf_lzma_varint (compressed, compressed_size, poffset, - &header_uncompressed_size)) - return 0; - off = *poffset; - } - - /* The recipe for creating a minidebug file is to run the xz program - with no arguments, so we expect exactly one filter: lzma2. */ - - if (unlikely ((block_flags & 0x3) != 0)) - { - elf_uncompress_failed (); - return 0; - } - - if (unlikely (off + 2 >= block_header_offset + block_header_size)) - { - elf_uncompress_failed (); - return 0; - } - - /* The filter ID for LZMA2 is 0x21. */ - if (unlikely (compressed[off] != 0x21)) - { - elf_uncompress_failed (); - return 0; - } - ++off; - - /* The size of the filter properties for LZMA2 is 1. */ - if (unlikely (compressed[off] != 1)) - { - elf_uncompress_failed (); - return 0; - } - ++off; - - lzma2_properties = compressed[off]; - ++off; - - if (unlikely (lzma2_properties > 40)) - { - elf_uncompress_failed (); - return 0; - } - - /* The properties describe the dictionary size, but we don't care - what that is. */ - - /* Block header padding. */ - if (unlikely (off + 4 > compressed_size)) - { - elf_uncompress_failed (); - return 0; - } - - off = (off + 3) &~ (size_t) 3; - - if (unlikely (off + 4 > compressed_size)) - { - elf_uncompress_failed (); - return 0; - } - - /* Block header CRC. */ - computed_crc = elf_crc32 (0, compressed + block_header_offset, - block_header_size - 4); - stream_crc = (compressed[off] - | (compressed[off + 1] << 8) - | (compressed[off + 2] << 16) - | (compressed[off + 3] << 24)); - if (unlikely (computed_crc != stream_crc)) - { - elf_uncompress_failed (); - return 0; - } - off += 4; - - /* Read a sequence of LZMA2 packets. */ - - uncompressed_offset = 0; - dict_start_offset = 0; - lc = 0; - lp = 0; - pb = 0; - lstate = 0; - while (off < compressed_size) - { - unsigned char control; - - range = 0xffffffff; - code = 0; - - control = compressed[off]; - ++off; - if (unlikely (control == 0)) - { - /* End of packets. */ - break; - } - - if (control == 1 || control >= 0xe0) - { - /* Reset dictionary to empty. */ - dict_start_offset = uncompressed_offset; - } - - if (control < 0x80) - { - size_t chunk_size; - - /* The only valid values here are 1 or 2. A 1 means to - reset the dictionary (done above). Then we see an - uncompressed chunk. */ - - if (unlikely (control > 2)) - { - elf_uncompress_failed (); - return 0; - } - - /* An uncompressed chunk is a two byte size followed by - data. */ - - if (unlikely (off + 2 > compressed_size)) - { - elf_uncompress_failed (); - return 0; - } - - chunk_size = compressed[off] << 8; - chunk_size += compressed[off + 1]; - ++chunk_size; - - off += 2; - - if (unlikely (off + chunk_size > compressed_size)) - { - elf_uncompress_failed (); - return 0; - } - if (unlikely (uncompressed_offset + chunk_size > uncompressed_size)) - { - elf_uncompress_failed (); - return 0; - } - - memcpy (uncompressed + uncompressed_offset, compressed + off, - chunk_size); - uncompressed_offset += chunk_size; - off += chunk_size; - } - else - { - size_t uncompressed_chunk_start; - size_t uncompressed_chunk_size; - size_t compressed_chunk_size; - size_t limit; - - /* An LZMA chunk. This starts with an uncompressed size and - a compressed size. */ - - if (unlikely (off + 4 >= compressed_size)) - { - elf_uncompress_failed (); - return 0; - } - - uncompressed_chunk_start = uncompressed_offset; - - uncompressed_chunk_size = (control & 0x1f) << 16; - uncompressed_chunk_size += compressed[off] << 8; - uncompressed_chunk_size += compressed[off + 1]; - ++uncompressed_chunk_size; - - compressed_chunk_size = compressed[off + 2] << 8; - compressed_chunk_size += compressed[off + 3]; - ++compressed_chunk_size; - - off += 4; - - /* Bit 7 (0x80) is set. - Bits 6 and 5 (0x40 and 0x20) are as follows: - 0: don't reset anything - 1: reset state - 2: reset state, read properties - 3: reset state, read properties, reset dictionary (done above) */ - - if (control >= 0xc0) - { - unsigned char props; - - /* Bit 6 is set, read properties. */ - - if (unlikely (off >= compressed_size)) - { - elf_uncompress_failed (); - return 0; - } - props = compressed[off]; - ++off; - if (unlikely (props > (4 * 5 + 4) * 9 + 8)) - { - elf_uncompress_failed (); - return 0; - } - pb = 0; - while (props >= 9 * 5) - { - props -= 9 * 5; - ++pb; - } - lp = 0; - while (props > 9) - { - props -= 9; - ++lp; - } - lc = props; - if (unlikely (lc + lp > 4)) - { - elf_uncompress_failed (); - return 0; - } - } - - if (control >= 0xa0) - { - size_t i; - - /* Bit 5 or 6 is set, reset LZMA state. */ - - lstate = 0; - memset (&dist, 0, sizeof dist); - for (i = 0; i < LZMA_PROB_TOTAL_COUNT; i++) - probs[i] = 1 << 10; - range = 0xffffffff; - code = 0; - } - - /* Read the range code. */ - - if (unlikely (off + 5 > compressed_size)) - { - elf_uncompress_failed (); - return 0; - } - - /* The byte at compressed[off] is ignored for some - reason. */ - - code = ((compressed[off + 1] << 24) - + (compressed[off + 2] << 16) - + (compressed[off + 3] << 8) - + compressed[off + 4]); - off += 5; - - /* This is the main LZMA decode loop. */ - - limit = off + compressed_chunk_size; - *poffset = off; - while (*poffset < limit) - { - unsigned int pos_state; - - if (unlikely (uncompressed_offset - == (uncompressed_chunk_start - + uncompressed_chunk_size))) - { - /* We've decompressed all the expected bytes. */ - break; - } - - pos_state = ((uncompressed_offset - dict_start_offset) - & ((1 << pb) - 1)); - - if (elf_lzma_bit (compressed, compressed_size, - probs + LZMA_IS_MATCH (lstate, pos_state), - poffset, &range, &code)) - { - uint32_t len; - - if (elf_lzma_bit (compressed, compressed_size, - probs + LZMA_IS_REP (lstate), - poffset, &range, &code)) - { - int short_rep; - uint32_t next_dist; - - /* Repeated match. */ - - short_rep = 0; - if (elf_lzma_bit (compressed, compressed_size, - probs + LZMA_IS_REP0 (lstate), - poffset, &range, &code)) - { - if (elf_lzma_bit (compressed, compressed_size, - probs + LZMA_IS_REP1 (lstate), - poffset, &range, &code)) - { - if (elf_lzma_bit (compressed, compressed_size, - probs + LZMA_IS_REP2 (lstate), - poffset, &range, &code)) - { - next_dist = dist[3]; - dist[3] = dist[2]; - } - else - { - next_dist = dist[2]; - } - dist[2] = dist[1]; - } - else - { - next_dist = dist[1]; - } - - dist[1] = dist[0]; - dist[0] = next_dist; - } - else - { - if (!elf_lzma_bit (compressed, compressed_size, - (probs - + LZMA_IS_REP0_LONG (lstate, - pos_state)), - poffset, &range, &code)) - short_rep = 1; - } - - if (lstate < 7) - lstate = short_rep ? 9 : 8; - else - lstate = 11; - - if (short_rep) - len = 1; - else - len = elf_lzma_len (compressed, compressed_size, - probs, 1, pos_state, poffset, - &range, &code); - } - else - { - uint32_t dist_state; - uint32_t dist_slot; - uint16_t *probs_dist; - - /* Match. */ - - if (lstate < 7) - lstate = 7; - else - lstate = 10; - dist[3] = dist[2]; - dist[2] = dist[1]; - dist[1] = dist[0]; - len = elf_lzma_len (compressed, compressed_size, - probs, 0, pos_state, poffset, - &range, &code); - - if (len < 4 + 2) - dist_state = len - 2; - else - dist_state = 3; - probs_dist = probs + LZMA_DIST_SLOT (dist_state, 0); - dist_slot = elf_lzma_integer (compressed, - compressed_size, - probs_dist, 6, - poffset, &range, - &code); - if (dist_slot < LZMA_DIST_MODEL_START) - dist[0] = dist_slot; - else - { - uint32_t limit; - - limit = (dist_slot >> 1) - 1; - dist[0] = 2 + (dist_slot & 1); - if (dist_slot < LZMA_DIST_MODEL_END) - { - dist[0] <<= limit; - probs_dist = (probs - + LZMA_DIST_SPECIAL(dist[0] - - dist_slot - - 1)); - dist[0] += - elf_lzma_reverse_integer (compressed, - compressed_size, - probs_dist, - limit, poffset, - &range, &code); - } - else - { - uint32_t dist0; - uint32_t i; - - dist0 = dist[0]; - for (i = 0; i < limit - 4; i++) - { - uint32_t mask; - - elf_lzma_range_normalize (compressed, - compressed_size, - poffset, - &range, &code); - range >>= 1; - code -= range; - mask = -(code >> 31); - code += range & mask; - dist0 <<= 1; - dist0 += mask + 1; - } - dist0 <<= 4; - probs_dist = probs + LZMA_DIST_ALIGN (0); - dist0 += - elf_lzma_reverse_integer (compressed, - compressed_size, - probs_dist, 4, - poffset, - &range, &code); - dist[0] = dist0; - } - } - } - - if (unlikely (uncompressed_offset - - dict_start_offset < dist[0] + 1)) - { - elf_uncompress_failed (); - return 0; - } - if (unlikely (uncompressed_offset + len > uncompressed_size)) - { - elf_uncompress_failed (); - return 0; - } - - if (dist[0] == 0) - { - /* A common case, meaning repeat the last - character LEN times. */ - memset (uncompressed + uncompressed_offset, - uncompressed[uncompressed_offset - 1], - len); - uncompressed_offset += len; - } - else if (dist[0] + 1 >= len) - { - memcpy (uncompressed + uncompressed_offset, - uncompressed + uncompressed_offset - dist[0] - 1, - len); - uncompressed_offset += len; - } - else - { - while (len > 0) - { - uint32_t copy; - - copy = len < dist[0] + 1 ? len : dist[0] + 1; - memcpy (uncompressed + uncompressed_offset, - (uncompressed + uncompressed_offset - - dist[0] - 1), - copy); - len -= copy; - uncompressed_offset += copy; - } - } - } - else - { - unsigned char prev; - unsigned char low; - size_t high; - uint16_t *lit_probs; - unsigned int sym; - - /* Literal value. */ - - if (uncompressed_offset > 0) - prev = uncompressed[uncompressed_offset - 1]; - else - prev = 0; - low = prev >> (8 - lc); - high = (((uncompressed_offset - dict_start_offset) - & ((1 << lp) - 1)) - << lc); - lit_probs = probs + LZMA_LITERAL (low + high, 0); - if (lstate < 7) - sym = elf_lzma_integer (compressed, compressed_size, - lit_probs, 8, poffset, &range, - &code); - else - { - unsigned int match; - unsigned int bit; - unsigned int match_bit; - unsigned int idx; - - sym = 1; - if (uncompressed_offset >= dist[0] + 1) - match = uncompressed[uncompressed_offset - dist[0] - 1]; - else - match = 0; - match <<= 1; - bit = 0x100; - do - { - match_bit = match & bit; - match <<= 1; - idx = bit + match_bit + sym; - sym <<= 1; - if (elf_lzma_bit (compressed, compressed_size, - lit_probs + idx, poffset, - &range, &code)) - { - ++sym; - bit &= match_bit; - } - else - { - bit &= ~ match_bit; - } - } - while (sym < 0x100); - } - - if (unlikely (uncompressed_offset >= uncompressed_size)) - { - elf_uncompress_failed (); - return 0; - } - - uncompressed[uncompressed_offset] = (unsigned char) sym; - ++uncompressed_offset; - if (lstate <= 3) - lstate = 0; - else if (lstate <= 9) - lstate -= 3; - else - lstate -= 6; - } - } - - elf_lzma_range_normalize (compressed, compressed_size, poffset, - &range, &code); - - off = *poffset; - } - } - - /* We have reached the end of the block. Pad to four byte - boundary. */ - off = (off + 3) &~ (size_t) 3; - if (unlikely (off > compressed_size)) - { - elf_uncompress_failed (); - return 0; - } - - switch (check) - { - case 0: - /* No check. */ - break; - - case 1: - /* CRC32 */ - if (unlikely (off + 4 > compressed_size)) - { - elf_uncompress_failed (); - return 0; - } - computed_crc = elf_crc32 (0, uncompressed, uncompressed_offset); - stream_crc = (compressed[off] - | (compressed[off + 1] << 8) - | (compressed[off + 2] << 16) - | (compressed[off + 3] << 24)); - if (computed_crc != stream_crc) - { - elf_uncompress_failed (); - return 0; - } - off += 4; - break; - - case 4: - /* CRC64. We don't bother computing a CRC64 checksum. */ - if (unlikely (off + 8 > compressed_size)) - { - elf_uncompress_failed (); - return 0; - } - off += 8; - break; - - case 10: - /* SHA. We don't bother computing a SHA checksum. */ - if (unlikely (off + 32 > compressed_size)) - { - elf_uncompress_failed (); - return 0; - } - off += 32; - break; - - default: - elf_uncompress_failed (); - return 0; - } - - *poffset = off; - - return 1; -} - -/* Uncompress LZMA data found in a minidebug file. The minidebug - format is described at - https://sourceware.org/gdb/current/onlinedocs/gdb/MiniDebugInfo.html. - Returns 0 on error, 1 on successful decompression. For this - function we return 0 on failure to decompress, as the calling code - will carry on in that case. */ - -static int -elf_uncompress_lzma (struct backtrace_state *state, - const unsigned char *compressed, size_t compressed_size, - backtrace_error_callback error_callback, void *data, - unsigned char **uncompressed, size_t *uncompressed_size) -{ - size_t header_size; - size_t footer_size; - unsigned char check; - uint32_t computed_crc; - uint32_t stream_crc; - size_t offset; - size_t index_size; - size_t footer_offset; - size_t index_offset; - uint64_t index_compressed_size; - uint64_t index_uncompressed_size; - unsigned char *mem; - uint16_t *probs; - size_t compressed_block_size; - - /* The format starts with a stream header and ends with a stream - footer. */ - header_size = 12; - footer_size = 12; - if (unlikely (compressed_size < header_size + footer_size)) - { - elf_uncompress_failed (); - return 0; - } - - /* The stream header starts with a magic string. */ - if (unlikely (memcmp (compressed, "\375" "7zXZ\0", 6) != 0)) - { - elf_uncompress_failed (); - return 0; - } - - /* Next come stream flags. The first byte is zero, the second byte - is the check. */ - if (unlikely (compressed[6] != 0)) - { - elf_uncompress_failed (); - return 0; - } - check = compressed[7]; - if (unlikely ((check & 0xf8) != 0)) - { - elf_uncompress_failed (); - return 0; - } - - /* Next comes a CRC of the stream flags. */ - computed_crc = elf_crc32 (0, compressed + 6, 2); - stream_crc = (compressed[8] - | (compressed[9] << 8) - | (compressed[10] << 16) - | (compressed[11] << 24)); - if (unlikely (computed_crc != stream_crc)) - { - elf_uncompress_failed (); - return 0; - } - - /* Now that we've parsed the header, parse the footer, so that we - can get the uncompressed size. */ - - /* The footer ends with two magic bytes. */ - - offset = compressed_size; - if (unlikely (memcmp (compressed + offset - 2, "YZ", 2) != 0)) - { - elf_uncompress_failed (); - return 0; - } - offset -= 2; - - /* Before that are the stream flags, which should be the same as the - flags in the header. */ - if (unlikely (compressed[offset - 2] != 0 - || compressed[offset - 1] != check)) - { - elf_uncompress_failed (); - return 0; - } - offset -= 2; - - /* Before that is the size of the index field, which precedes the - footer. */ - index_size = (compressed[offset - 4] - | (compressed[offset - 3] << 8) - | (compressed[offset - 2] << 16) - | (compressed[offset - 1] << 24)); - index_size = (index_size + 1) * 4; - offset -= 4; - - /* Before that is a footer CRC. */ - computed_crc = elf_crc32 (0, compressed + offset, 6); - stream_crc = (compressed[offset - 4] - | (compressed[offset - 3] << 8) - | (compressed[offset - 2] << 16) - | (compressed[offset - 1] << 24)); - if (unlikely (computed_crc != stream_crc)) - { - elf_uncompress_failed (); - return 0; - } - offset -= 4; - - /* The index comes just before the footer. */ - if (unlikely (offset < index_size + header_size)) - { - elf_uncompress_failed (); - return 0; - } - - footer_offset = offset; - offset -= index_size; - index_offset = offset; - - /* The index starts with a zero byte. */ - if (unlikely (compressed[offset] != 0)) - { - elf_uncompress_failed (); - return 0; - } - ++offset; - - /* Next is the number of blocks. We expect zero blocks for an empty - stream, and otherwise a single block. */ - if (unlikely (compressed[offset] == 0)) - { - *uncompressed = NULL; - *uncompressed_size = 0; - return 1; - } - if (unlikely (compressed[offset] != 1)) - { - elf_uncompress_failed (); - return 0; - } - ++offset; - - /* Next is the compressed size and the uncompressed size. */ - if (!elf_lzma_varint (compressed, compressed_size, &offset, - &index_compressed_size)) - return 0; - if (!elf_lzma_varint (compressed, compressed_size, &offset, - &index_uncompressed_size)) - return 0; - - /* Pad to a four byte boundary. */ - offset = (offset + 3) &~ (size_t) 3; - - /* Next is a CRC of the index. */ - computed_crc = elf_crc32 (0, compressed + index_offset, - offset - index_offset); - stream_crc = (compressed[offset] - | (compressed[offset + 1] << 8) - | (compressed[offset + 2] << 16) - | (compressed[offset + 3] << 24)); - if (unlikely (computed_crc != stream_crc)) - { - elf_uncompress_failed (); - return 0; - } - offset += 4; - - /* We should now be back at the footer. */ - if (unlikely (offset != footer_offset)) - { - elf_uncompress_failed (); - return 0; - } - - /* Allocate space to hold the uncompressed data. If we succeed in - uncompressing the LZMA data, we never free this memory. */ - mem = (unsigned char *) backtrace_alloc (state, index_uncompressed_size, - error_callback, data); - if (unlikely (mem == NULL)) - return 0; - *uncompressed = mem; - *uncompressed_size = index_uncompressed_size; - - /* Allocate space for probabilities. */ - probs = ((uint16_t *) - backtrace_alloc (state, - LZMA_PROB_TOTAL_COUNT * sizeof (uint16_t), - error_callback, data)); - if (unlikely (probs == NULL)) - { - backtrace_free (state, mem, index_uncompressed_size, error_callback, - data); - return 0; - } - - /* Uncompress the block, which follows the header. */ - offset = 12; - if (!elf_uncompress_lzma_block (compressed, compressed_size, check, probs, - mem, index_uncompressed_size, &offset)) - { - backtrace_free (state, mem, index_uncompressed_size, error_callback, - data); - return 0; - } - - compressed_block_size = offset - 12; - if (unlikely (compressed_block_size - != ((index_compressed_size + 3) &~ (size_t) 3))) - { - elf_uncompress_failed (); - backtrace_free (state, mem, index_uncompressed_size, error_callback, - data); - return 0; - } - - offset = (offset + 3) &~ (size_t) 3; - if (unlikely (offset != index_offset)) - { - elf_uncompress_failed (); - backtrace_free (state, mem, index_uncompressed_size, error_callback, - data); - return 0; - } - - return 1; -} - -/* This function is a hook for testing the LZMA support. It is only - used by tests. */ - -int -backtrace_uncompress_lzma (struct backtrace_state *state, - const unsigned char *compressed, - size_t compressed_size, - backtrace_error_callback error_callback, - void *data, unsigned char **uncompressed, - size_t *uncompressed_size) -{ - return elf_uncompress_lzma (state, compressed, compressed_size, - error_callback, data, uncompressed, - uncompressed_size); -} - -/* Add the backtrace data for one ELF file. Returns 1 on success, - 0 on failure (in both cases descriptor is closed) or -1 if exe - is non-zero and the ELF file is ET_DYN, which tells the caller that - elf_add will need to be called on the descriptor again after - base_address is determined. */ - -static int -elf_add (struct backtrace_state *state, const char *filename, int descriptor, - const unsigned char *memory, size_t memory_size, - uintptr_t base_address, backtrace_error_callback error_callback, - void *data, fileline *fileline_fn, int *found_sym, int *found_dwarf, - struct dwarf_data **fileline_entry, int exe, int debuginfo, - const char *with_buildid_data, uint32_t with_buildid_size) -{ - struct elf_view ehdr_view; - b_elf_ehdr ehdr; - off_t shoff; - unsigned int shnum; - unsigned int shstrndx; - struct elf_view shdrs_view; - int shdrs_view_valid; - const b_elf_shdr *shdrs; - const b_elf_shdr *shstrhdr; - size_t shstr_size; - off_t shstr_off; - struct elf_view names_view; - int names_view_valid; - const char *names; - unsigned int symtab_shndx; - unsigned int dynsym_shndx; - unsigned int i; - struct debug_section_info sections[DEBUG_MAX]; - struct debug_section_info zsections[DEBUG_MAX]; - struct elf_view symtab_view; - int symtab_view_valid; - struct elf_view strtab_view; - int strtab_view_valid; - struct elf_view buildid_view; - int buildid_view_valid; - const char *buildid_data; - uint32_t buildid_size; - struct elf_view debuglink_view; - int debuglink_view_valid; - const char *debuglink_name; - uint32_t debuglink_crc; - struct elf_view debugaltlink_view; - int debugaltlink_view_valid; - const char *debugaltlink_name; - const char *debugaltlink_buildid_data; - uint32_t debugaltlink_buildid_size; - struct elf_view gnu_debugdata_view; - int gnu_debugdata_view_valid; - size_t gnu_debugdata_size; - unsigned char *gnu_debugdata_uncompressed; - size_t gnu_debugdata_uncompressed_size; - off_t min_offset; - off_t max_offset; - off_t debug_size; - struct elf_view debug_view; - int debug_view_valid; - unsigned int using_debug_view; - uint16_t *zdebug_table; - struct elf_view split_debug_view[DEBUG_MAX]; - unsigned char split_debug_view_valid[DEBUG_MAX]; - struct elf_ppc64_opd_data opd_data, *opd; - struct dwarf_sections dwarf_sections; - - if (!debuginfo) - { - *found_sym = 0; - *found_dwarf = 0; - } - - shdrs_view_valid = 0; - names_view_valid = 0; - symtab_view_valid = 0; - strtab_view_valid = 0; - buildid_view_valid = 0; - buildid_data = NULL; - buildid_size = 0; - debuglink_view_valid = 0; - debuglink_name = NULL; - debuglink_crc = 0; - debugaltlink_view_valid = 0; - debugaltlink_name = NULL; - debugaltlink_buildid_data = NULL; - debugaltlink_buildid_size = 0; - gnu_debugdata_view_valid = 0; - gnu_debugdata_size = 0; - debug_view_valid = 0; - memset (&split_debug_view_valid[0], 0, sizeof split_debug_view_valid); - opd = NULL; - - if (!elf_get_view (state, descriptor, memory, memory_size, 0, sizeof ehdr, - error_callback, data, &ehdr_view)) - goto fail; - - memcpy (&ehdr, ehdr_view.view.data, sizeof ehdr); - - elf_release_view (state, &ehdr_view, error_callback, data); - - if (ehdr.e_ident[EI_MAG0] != ELFMAG0 - || ehdr.e_ident[EI_MAG1] != ELFMAG1 - || ehdr.e_ident[EI_MAG2] != ELFMAG2 - || ehdr.e_ident[EI_MAG3] != ELFMAG3) - { - error_callback (data, "executable file is not ELF", 0); - goto fail; - } - if (ehdr.e_ident[EI_VERSION] != EV_CURRENT) - { - error_callback (data, "executable file is unrecognized ELF version", 0); - goto fail; - } - -#if BACKTRACE_ELF_SIZE == 32 -#define BACKTRACE_ELFCLASS ELFCLASS32 -#else -#define BACKTRACE_ELFCLASS ELFCLASS64 -#endif - - if (ehdr.e_ident[EI_CLASS] != BACKTRACE_ELFCLASS) - { - error_callback (data, "executable file is unexpected ELF class", 0); - goto fail; - } - - if (ehdr.e_ident[EI_DATA] != ELFDATA2LSB - && ehdr.e_ident[EI_DATA] != ELFDATA2MSB) - { - error_callback (data, "executable file has unknown endianness", 0); - goto fail; - } - - /* If the executable is ET_DYN, it is either a PIE, or we are running - directly a shared library with .interp. We need to wait for - dl_iterate_phdr in that case to determine the actual base_address. */ - if (exe && ehdr.e_type == ET_DYN) - return -1; - - shoff = ehdr.e_shoff; - shnum = ehdr.e_shnum; - shstrndx = ehdr.e_shstrndx; - - if ((shnum == 0 || shstrndx == SHN_XINDEX) - && shoff != 0) - { - struct elf_view shdr_view; - const b_elf_shdr *shdr; - - if (!elf_get_view (state, descriptor, memory, memory_size, shoff, - sizeof shdr, error_callback, data, &shdr_view)) - goto fail; - - shdr = (const b_elf_shdr *) shdr_view.view.data; - - if (shnum == 0) - shnum = shdr->sh_size; - - if (shstrndx == SHN_XINDEX) - { - shstrndx = shdr->sh_link; - - /* Versions of the GNU binutils between 2.12 and 2.18 did - not handle objects with more than SHN_LORESERVE sections - correctly. All large section indexes were offset by - 0x100. There is more information at - http://sourceware.org/bugzilla/show_bug.cgi?id-5900 . - Fortunately these object files are easy to detect, as the - GNU binutils always put the section header string table - near the end of the list of sections. Thus if the - section header string table index is larger than the - number of sections, then we know we have to subtract - 0x100 to get the real section index. */ - if (shstrndx >= shnum && shstrndx >= SHN_LORESERVE + 0x100) - shstrndx -= 0x100; - } - - elf_release_view (state, &shdr_view, error_callback, data); - } - - if (shnum == 0 || shstrndx == 0) - goto fail; - - /* To translate PC to file/line when using DWARF, we need to find - the .debug_info and .debug_line sections. */ - - /* Read the section headers, skipping the first one. */ - - if (!elf_get_view (state, descriptor, memory, memory_size, - shoff + sizeof (b_elf_shdr), - (shnum - 1) * sizeof (b_elf_shdr), - error_callback, data, &shdrs_view)) - goto fail; - shdrs_view_valid = 1; - shdrs = (const b_elf_shdr *) shdrs_view.view.data; - - /* Read the section names. */ - - shstrhdr = &shdrs[shstrndx - 1]; - shstr_size = shstrhdr->sh_size; - shstr_off = shstrhdr->sh_offset; - - if (!elf_get_view (state, descriptor, memory, memory_size, shstr_off, - shstrhdr->sh_size, error_callback, data, &names_view)) - goto fail; - names_view_valid = 1; - names = (const char *) names_view.view.data; - - symtab_shndx = 0; - dynsym_shndx = 0; - - memset (sections, 0, sizeof sections); - memset (zsections, 0, sizeof zsections); - - /* Look for the symbol table. */ - for (i = 1; i < shnum; ++i) - { - const b_elf_shdr *shdr; - unsigned int sh_name; - const char *name; - int j; - - shdr = &shdrs[i - 1]; - - if (shdr->sh_type == SHT_SYMTAB) - symtab_shndx = i; - else if (shdr->sh_type == SHT_DYNSYM) - dynsym_shndx = i; - - sh_name = shdr->sh_name; - if (sh_name >= shstr_size) - { - error_callback (data, "ELF section name out of range", 0); - goto fail; - } - - name = names + sh_name; - - for (j = 0; j < (int) DEBUG_MAX; ++j) - { - if (strcmp (name, dwarf_section_names[j]) == 0) - { - sections[j].offset = shdr->sh_offset; - sections[j].size = shdr->sh_size; - sections[j].compressed = (shdr->sh_flags & SHF_COMPRESSED) != 0; - break; - } - } - - if (name[0] == '.' && name[1] == 'z') - { - for (j = 0; j < (int) DEBUG_MAX; ++j) - { - if (strcmp (name + 2, dwarf_section_names[j] + 1) == 0) - { - zsections[j].offset = shdr->sh_offset; - zsections[j].size = shdr->sh_size; - break; - } - } - } - - /* Read the build ID if present. This could check for any - SHT_NOTE section with the right note name and type, but gdb - looks for a specific section name. */ - if ((!debuginfo || with_buildid_data != NULL) - && !buildid_view_valid - && strcmp (name, ".note.gnu.build-id") == 0) - { - const b_elf_note *note; - - if (!elf_get_view (state, descriptor, memory, memory_size, - shdr->sh_offset, shdr->sh_size, error_callback, - data, &buildid_view)) - goto fail; - - buildid_view_valid = 1; - note = (const b_elf_note *) buildid_view.view.data; - if (note->type == NT_GNU_BUILD_ID - && note->namesz == 4 - && strncmp (note->name, "GNU", 4) == 0 - && shdr->sh_size <= 12 + ((note->namesz + 3) & ~ 3) + note->descsz) - { - buildid_data = ¬e->name[0] + ((note->namesz + 3) & ~ 3); - buildid_size = note->descsz; - } - - if (with_buildid_size != 0) - { - if (buildid_size != with_buildid_size) - goto fail; - - if (memcmp (buildid_data, with_buildid_data, buildid_size) != 0) - goto fail; - } - } - - /* Read the debuglink file if present. */ - if (!debuginfo - && !debuglink_view_valid - && strcmp (name, ".gnu_debuglink") == 0) - { - const char *debuglink_data; - size_t crc_offset; - - if (!elf_get_view (state, descriptor, memory, memory_size, - shdr->sh_offset, shdr->sh_size, error_callback, - data, &debuglink_view)) - goto fail; - - debuglink_view_valid = 1; - debuglink_data = (const char *) debuglink_view.view.data; - crc_offset = strnlen (debuglink_data, shdr->sh_size); - crc_offset = (crc_offset + 3) & ~3; - if (crc_offset + 4 <= shdr->sh_size) - { - debuglink_name = debuglink_data; - debuglink_crc = *(const uint32_t*)(debuglink_data + crc_offset); - } - } - - if (!debugaltlink_view_valid - && strcmp (name, ".gnu_debugaltlink") == 0) - { - const char *debugaltlink_data; - size_t debugaltlink_name_len; - - if (!elf_get_view (state, descriptor, memory, memory_size, - shdr->sh_offset, shdr->sh_size, error_callback, - data, &debugaltlink_view)) - goto fail; - - debugaltlink_view_valid = 1; - debugaltlink_data = (const char *) debugaltlink_view.view.data; - debugaltlink_name = debugaltlink_data; - debugaltlink_name_len = strnlen (debugaltlink_data, shdr->sh_size); - if (debugaltlink_name_len < shdr->sh_size) - { - /* Include terminating zero. */ - debugaltlink_name_len += 1; - - debugaltlink_buildid_data - = debugaltlink_data + debugaltlink_name_len; - debugaltlink_buildid_size = shdr->sh_size - debugaltlink_name_len; - } - } - - if (!gnu_debugdata_view_valid - && strcmp (name, ".gnu_debugdata") == 0) - { - if (!elf_get_view (state, descriptor, memory, memory_size, - shdr->sh_offset, shdr->sh_size, error_callback, - data, &gnu_debugdata_view)) - goto fail; - - gnu_debugdata_size = shdr->sh_size; - gnu_debugdata_view_valid = 1; - } - - /* Read the .opd section on PowerPC64 ELFv1. */ - if (ehdr.e_machine == EM_PPC64 - && (ehdr.e_flags & EF_PPC64_ABI) < 2 - && shdr->sh_type == SHT_PROGBITS - && strcmp (name, ".opd") == 0) - { - if (!elf_get_view (state, descriptor, memory, memory_size, - shdr->sh_offset, shdr->sh_size, error_callback, - data, &opd_data.view)) - goto fail; - - opd = &opd_data; - opd->addr = shdr->sh_addr; - opd->data = (const char *) opd_data.view.view.data; - opd->size = shdr->sh_size; - } - } - - if (symtab_shndx == 0) - symtab_shndx = dynsym_shndx; - if (symtab_shndx != 0 && !debuginfo) - { - const b_elf_shdr *symtab_shdr; - unsigned int strtab_shndx; - const b_elf_shdr *strtab_shdr; - struct elf_syminfo_data *sdata; - - symtab_shdr = &shdrs[symtab_shndx - 1]; - strtab_shndx = symtab_shdr->sh_link; - if (strtab_shndx >= shnum) - { - error_callback (data, - "ELF symbol table strtab link out of range", 0); - goto fail; - } - strtab_shdr = &shdrs[strtab_shndx - 1]; - - if (!elf_get_view (state, descriptor, memory, memory_size, - symtab_shdr->sh_offset, symtab_shdr->sh_size, - error_callback, data, &symtab_view)) - goto fail; - symtab_view_valid = 1; - - if (!elf_get_view (state, descriptor, memory, memory_size, - strtab_shdr->sh_offset, strtab_shdr->sh_size, - error_callback, data, &strtab_view)) - goto fail; - strtab_view_valid = 1; - - sdata = ((struct elf_syminfo_data *) - backtrace_alloc (state, sizeof *sdata, error_callback, data)); - if (sdata == NULL) - goto fail; - - if (!elf_initialize_syminfo (state, base_address, - symtab_view.view.data, symtab_shdr->sh_size, - strtab_view.view.data, strtab_shdr->sh_size, - error_callback, data, sdata, opd)) - { - backtrace_free (state, sdata, sizeof *sdata, error_callback, data); - goto fail; - } - - /* We no longer need the symbol table, but we hold on to the - string table permanently. */ - elf_release_view (state, &symtab_view, error_callback, data); - symtab_view_valid = 0; - strtab_view_valid = 0; - - *found_sym = 1; - - elf_add_syminfo_data (state, sdata); - } - - elf_release_view (state, &shdrs_view, error_callback, data); - shdrs_view_valid = 0; - elf_release_view (state, &names_view, error_callback, data); - names_view_valid = 0; - - /* If the debug info is in a separate file, read that one instead. */ - - if (buildid_data != NULL) - { - int d; - - d = elf_open_debugfile_by_buildid (state, buildid_data, buildid_size, - error_callback, data); - if (d >= 0) - { - int ret; - - elf_release_view (state, &buildid_view, error_callback, data); - if (debuglink_view_valid) - elf_release_view (state, &debuglink_view, error_callback, data); - if (debugaltlink_view_valid) - elf_release_view (state, &debugaltlink_view, error_callback, data); - ret = elf_add (state, "", d, NULL, 0, base_address, error_callback, - data, fileline_fn, found_sym, found_dwarf, NULL, 0, - 1, NULL, 0); - if (ret < 0) - backtrace_close (d, error_callback, data); - else if (descriptor >= 0) - backtrace_close (descriptor, error_callback, data); - return ret; - } - } - - if (buildid_view_valid) - { - elf_release_view (state, &buildid_view, error_callback, data); - buildid_view_valid = 0; - } - - if (opd) - { - elf_release_view (state, &opd->view, error_callback, data); - opd = NULL; - } - - if (debuglink_name != NULL) - { - int d; - - d = elf_open_debugfile_by_debuglink (state, filename, debuglink_name, - debuglink_crc, error_callback, - data); - if (d >= 0) - { - int ret; - - elf_release_view (state, &debuglink_view, error_callback, data); - if (debugaltlink_view_valid) - elf_release_view (state, &debugaltlink_view, error_callback, data); - ret = elf_add (state, "", d, NULL, 0, base_address, error_callback, - data, fileline_fn, found_sym, found_dwarf, NULL, 0, - 1, NULL, 0); - if (ret < 0) - backtrace_close (d, error_callback, data); - else if (descriptor >= 0) - backtrace_close(descriptor, error_callback, data); - return ret; - } - } - - if (debuglink_view_valid) - { - elf_release_view (state, &debuglink_view, error_callback, data); - debuglink_view_valid = 0; - } - - struct dwarf_data *fileline_altlink = NULL; - if (debugaltlink_name != NULL) - { - int d; - - d = elf_open_debugfile_by_debuglink (state, filename, debugaltlink_name, - 0, error_callback, data); - if (d >= 0) - { - int ret; - - ret = elf_add (state, filename, d, NULL, 0, base_address, - error_callback, data, fileline_fn, found_sym, - found_dwarf, &fileline_altlink, 0, 1, - debugaltlink_buildid_data, debugaltlink_buildid_size); - elf_release_view (state, &debugaltlink_view, error_callback, data); - debugaltlink_view_valid = 0; - if (ret < 0) - { - backtrace_close (d, error_callback, data); - return ret; - } - } - } - - if (debugaltlink_view_valid) - { - elf_release_view (state, &debugaltlink_view, error_callback, data); - debugaltlink_view_valid = 0; - } - - if (gnu_debugdata_view_valid) - { - int ret; - - ret = elf_uncompress_lzma (state, - ((const unsigned char *) - gnu_debugdata_view.view.data), - gnu_debugdata_size, error_callback, data, - &gnu_debugdata_uncompressed, - &gnu_debugdata_uncompressed_size); - - elf_release_view (state, &gnu_debugdata_view, error_callback, data); - gnu_debugdata_view_valid = 0; - - if (ret) - { - ret = elf_add (state, filename, -1, gnu_debugdata_uncompressed, - gnu_debugdata_uncompressed_size, base_address, - error_callback, data, fileline_fn, found_sym, - found_dwarf, NULL, 0, 0, NULL, 0); - if (ret >= 0 && descriptor >= 0) - backtrace_close(descriptor, error_callback, data); - return ret; - } - } - - /* Read all the debug sections in a single view, since they are - probably adjacent in the file. If any of sections are - uncompressed, we never release this view. */ - - min_offset = 0; - max_offset = 0; - debug_size = 0; - for (i = 0; i < (int) DEBUG_MAX; ++i) - { - off_t end; - - if (sections[i].size != 0) - { - if (min_offset == 0 || sections[i].offset < min_offset) - min_offset = sections[i].offset; - end = sections[i].offset + sections[i].size; - if (end > max_offset) - max_offset = end; - debug_size += sections[i].size; - } - if (zsections[i].size != 0) - { - if (min_offset == 0 || zsections[i].offset < min_offset) - min_offset = zsections[i].offset; - end = zsections[i].offset + zsections[i].size; - if (end > max_offset) - max_offset = end; - debug_size += zsections[i].size; - } - } - if (min_offset == 0 || max_offset == 0) - { - if (descriptor >= 0) - { - if (!backtrace_close (descriptor, error_callback, data)) - goto fail; - } - return 1; - } - - /* If the total debug section size is large, assume that there are - gaps between the sections, and read them individually. */ - - if (max_offset - min_offset < 0x20000000 - || max_offset - min_offset < debug_size + 0x10000) - { - if (!elf_get_view (state, descriptor, memory, memory_size, min_offset, - max_offset - min_offset, error_callback, data, - &debug_view)) - goto fail; - debug_view_valid = 1; - } - else - { - memset (&split_debug_view[0], 0, sizeof split_debug_view); - for (i = 0; i < (int) DEBUG_MAX; ++i) - { - struct debug_section_info *dsec; - - if (sections[i].size != 0) - dsec = §ions[i]; - else if (zsections[i].size != 0) - dsec = &zsections[i]; - else - continue; - - if (!elf_get_view (state, descriptor, memory, memory_size, - dsec->offset, dsec->size, error_callback, data, - &split_debug_view[i])) - goto fail; - split_debug_view_valid[i] = 1; - - if (sections[i].size != 0) - sections[i].data = ((const unsigned char *) - split_debug_view[i].view.data); - else - zsections[i].data = ((const unsigned char *) - split_debug_view[i].view.data); - } - } - - /* We've read all we need from the executable. */ - if (descriptor >= 0) - { - if (!backtrace_close (descriptor, error_callback, data)) - goto fail; - descriptor = -1; - } - - using_debug_view = 0; - if (debug_view_valid) - { - for (i = 0; i < (int) DEBUG_MAX; ++i) - { - if (sections[i].size == 0) - sections[i].data = NULL; - else - { - sections[i].data = ((const unsigned char *) debug_view.view.data - + (sections[i].offset - min_offset)); - ++using_debug_view; - } - - if (zsections[i].size == 0) - zsections[i].data = NULL; - else - zsections[i].data = ((const unsigned char *) debug_view.view.data - + (zsections[i].offset - min_offset)); - } - } - - /* Uncompress the old format (--compress-debug-sections=zlib-gnu). */ - - zdebug_table = NULL; - for (i = 0; i < (int) DEBUG_MAX; ++i) - { - if (sections[i].size == 0 && zsections[i].size > 0) - { - unsigned char *uncompressed_data; - size_t uncompressed_size; - - if (zdebug_table == NULL) - { - zdebug_table = ((uint16_t *) - backtrace_alloc (state, ZDEBUG_TABLE_SIZE, - error_callback, data)); - if (zdebug_table == NULL) - goto fail; - } - - uncompressed_data = NULL; - uncompressed_size = 0; - if (!elf_uncompress_zdebug (state, zsections[i].data, - zsections[i].size, zdebug_table, - error_callback, data, - &uncompressed_data, &uncompressed_size)) - goto fail; - sections[i].data = uncompressed_data; - sections[i].size = uncompressed_size; - sections[i].compressed = 0; - - if (split_debug_view_valid[i]) - { - elf_release_view (state, &split_debug_view[i], - error_callback, data); - split_debug_view_valid[i] = 0; - } - } - } - - /* Uncompress the official ELF format - (--compress-debug-sections=zlib-gabi). */ - for (i = 0; i < (int) DEBUG_MAX; ++i) - { - unsigned char *uncompressed_data; - size_t uncompressed_size; - - if (sections[i].size == 0 || !sections[i].compressed) - continue; - - if (zdebug_table == NULL) - { - zdebug_table = ((uint16_t *) - backtrace_alloc (state, ZDEBUG_TABLE_SIZE, - error_callback, data)); - if (zdebug_table == NULL) - goto fail; - } - - uncompressed_data = NULL; - uncompressed_size = 0; - if (!elf_uncompress_chdr (state, sections[i].data, sections[i].size, - zdebug_table, error_callback, data, - &uncompressed_data, &uncompressed_size)) - goto fail; - sections[i].data = uncompressed_data; - sections[i].size = uncompressed_size; - sections[i].compressed = 0; - - if (debug_view_valid) - --using_debug_view; - else if (split_debug_view_valid[i]) - { - elf_release_view (state, &split_debug_view[i], error_callback, data); - split_debug_view_valid[i] = 0; - } - } - - if (zdebug_table != NULL) - backtrace_free (state, zdebug_table, ZDEBUG_TABLE_SIZE, - error_callback, data); - - if (debug_view_valid && using_debug_view == 0) - { - elf_release_view (state, &debug_view, error_callback, data); - debug_view_valid = 0; - } - - for (i = 0; i < (int) DEBUG_MAX; ++i) - { - dwarf_sections.data[i] = sections[i].data; - dwarf_sections.size[i] = sections[i].size; - } - - if (!backtrace_dwarf_add (state, base_address, &dwarf_sections, - ehdr.e_ident[EI_DATA] == ELFDATA2MSB, - fileline_altlink, - error_callback, data, fileline_fn, - fileline_entry)) - goto fail; - - *found_dwarf = 1; - - return 1; - - fail: - if (shdrs_view_valid) - elf_release_view (state, &shdrs_view, error_callback, data); - if (names_view_valid) - elf_release_view (state, &names_view, error_callback, data); - if (symtab_view_valid) - elf_release_view (state, &symtab_view, error_callback, data); - if (strtab_view_valid) - elf_release_view (state, &strtab_view, error_callback, data); - if (debuglink_view_valid) - elf_release_view (state, &debuglink_view, error_callback, data); - if (debugaltlink_view_valid) - elf_release_view (state, &debugaltlink_view, error_callback, data); - if (gnu_debugdata_view_valid) - elf_release_view (state, &gnu_debugdata_view, error_callback, data); - if (buildid_view_valid) - elf_release_view (state, &buildid_view, error_callback, data); - if (debug_view_valid) - elf_release_view (state, &debug_view, error_callback, data); - for (i = 0; i < (int) DEBUG_MAX; ++i) - { - if (split_debug_view_valid[i]) - elf_release_view (state, &split_debug_view[i], error_callback, data); - } - if (opd) - elf_release_view (state, &opd->view, error_callback, data); - if (descriptor >= 0) - backtrace_close (descriptor, error_callback, data); - return 0; -} - -/* Data passed to phdr_callback. */ - -struct phdr_data -{ - struct backtrace_state *state; - backtrace_error_callback error_callback; - void *data; - fileline *fileline_fn; - int *found_sym; - int *found_dwarf; - const char *exe_filename; - int exe_descriptor; -}; - -/* Callback passed to dl_iterate_phdr. Load debug info from shared - libraries. */ - -static int -#ifdef __i386__ -__attribute__ ((__force_align_arg_pointer__)) -#endif -phdr_callback (struct dl_phdr_info *info, size_t size ATTRIBUTE_UNUSED, - void *pdata) -{ - struct phdr_data *pd = (struct phdr_data *) pdata; - const char *filename; - int descriptor; - int does_not_exist; - fileline elf_fileline_fn; - int found_dwarf; - - /* There is not much we can do if we don't have the module name, - unless executable is ET_DYN, where we expect the very first - phdr_callback to be for the PIE. */ - if (info->dlpi_name == NULL || info->dlpi_name[0] == '\0') - { - if (pd->exe_descriptor == -1) - return 0; - filename = pd->exe_filename; - descriptor = pd->exe_descriptor; - pd->exe_descriptor = -1; - } - else - { - if (pd->exe_descriptor != -1) - { - backtrace_close (pd->exe_descriptor, pd->error_callback, pd->data); - pd->exe_descriptor = -1; - } - - filename = info->dlpi_name; - descriptor = backtrace_open (info->dlpi_name, pd->error_callback, - pd->data, &does_not_exist); - if (descriptor < 0) - return 0; - } - - if (elf_add (pd->state, filename, descriptor, NULL, 0, info->dlpi_addr, - pd->error_callback, pd->data, &elf_fileline_fn, pd->found_sym, - &found_dwarf, NULL, 0, 0, NULL, 0)) - { - if (found_dwarf) - { - *pd->found_dwarf = 1; - *pd->fileline_fn = elf_fileline_fn; - } - } - - return 0; -} - -/* Initialize the backtrace data we need from an ELF executable. At - the ELF level, all we need to do is find the debug info - sections. */ - -int -backtrace_initialize (struct backtrace_state *state, const char *filename, - int descriptor, backtrace_error_callback error_callback, - void *data, fileline *fileline_fn) -{ - int ret; - int found_sym; - int found_dwarf; - fileline elf_fileline_fn = elf_nodebug; - struct phdr_data pd; - - ret = elf_add (state, filename, descriptor, NULL, 0, 0, error_callback, data, - &elf_fileline_fn, &found_sym, &found_dwarf, NULL, 1, 0, NULL, - 0); - if (!ret) - return 0; - - pd.state = state; - pd.error_callback = error_callback; - pd.data = data; - pd.fileline_fn = &elf_fileline_fn; - pd.found_sym = &found_sym; - pd.found_dwarf = &found_dwarf; - pd.exe_filename = filename; - pd.exe_descriptor = ret < 0 ? descriptor : -1; - - dl_iterate_phdr (phdr_callback, (void *) &pd); - - if (!state->threaded) - { - if (found_sym) - state->syminfo_fn = elf_syminfo; - else if (state->syminfo_fn == NULL) - state->syminfo_fn = elf_nosyms; - } - else - { - if (found_sym) - backtrace_atomic_store_pointer (&state->syminfo_fn, elf_syminfo); - else - (void) __sync_bool_compare_and_swap (&state->syminfo_fn, NULL, - elf_nosyms); - } - - if (!state->threaded) - *fileline_fn = state->fileline_fn; - else - *fileline_fn = backtrace_atomic_load_pointer (&state->fileline_fn); - - if (*fileline_fn == NULL || *fileline_fn == elf_nodebug) - *fileline_fn = elf_fileline_fn; - - return 1; -} diff --git a/contrib/libs/backtrace/fileline.c b/contrib/libs/backtrace/fileline.c deleted file mode 100644 index 0472f4721a..0000000000 --- a/contrib/libs/backtrace/fileline.c +++ /dev/null @@ -1,346 +0,0 @@ -/* fileline.c -- Get file and line number information in a backtrace. - Copyright (C) 2012-2021 Free Software Foundation, Inc. - Written by Ian Lance Taylor, Google. - -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) The name of the author may not be used to - endorse or promote products derived from this software without - specific prior written permission. - -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. */ - -#include "config.h" - -#include <sys/types.h> -#include <sys/stat.h> -#include <errno.h> -#include <fcntl.h> -#include <stdlib.h> -#include <unistd.h> - -#if defined (HAVE_KERN_PROC_ARGS) || defined (HAVE_KERN_PROC) -#include <sys/sysctl.h> -#endif - -#ifdef HAVE_MACH_O_DYLD_H -#include <mach-o/dyld.h> -#endif - -#include "backtrace.h" -#include "internal.h" - -#ifndef HAVE_GETEXECNAME -#define getexecname() NULL -#endif - -#if !defined (HAVE_KERN_PROC_ARGS) && !defined (HAVE_KERN_PROC) - -#define sysctl_exec_name1(state, error_callback, data) NULL -#define sysctl_exec_name2(state, error_callback, data) NULL - -#else /* defined (HAVE_KERN_PROC_ARGS) || |defined (HAVE_KERN_PROC) */ - -static char * -sysctl_exec_name (struct backtrace_state *state, - int mib0, int mib1, int mib2, int mib3, - backtrace_error_callback error_callback, void *data) -{ - int mib[4]; - size_t len; - char *name; - size_t rlen; - - mib[0] = mib0; - mib[1] = mib1; - mib[2] = mib2; - mib[3] = mib3; - - if (sysctl (mib, 4, NULL, &len, NULL, 0) < 0) - return NULL; - name = (char *) backtrace_alloc (state, len, error_callback, data); - if (name == NULL) - return NULL; - rlen = len; - if (sysctl (mib, 4, name, &rlen, NULL, 0) < 0) - { - backtrace_free (state, name, len, error_callback, data); - return NULL; - } - return name; -} - -#ifdef HAVE_KERN_PROC_ARGS - -static char * -sysctl_exec_name1 (struct backtrace_state *state, - backtrace_error_callback error_callback, void *data) -{ - /* This variant is used on NetBSD. */ - return sysctl_exec_name (state, CTL_KERN, KERN_PROC_ARGS, -1, - KERN_PROC_PATHNAME, error_callback, data); -} - -#else - -#define sysctl_exec_name1(state, error_callback, data) NULL - -#endif - -#ifdef HAVE_KERN_PROC - -static char * -sysctl_exec_name2 (struct backtrace_state *state, - backtrace_error_callback error_callback, void *data) -{ - /* This variant is used on FreeBSD. */ - return sysctl_exec_name (state, CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1, - error_callback, data); -} - -#else - -#define sysctl_exec_name2(state, error_callback, data) NULL - -#endif - -#endif /* defined (HAVE_KERN_PROC_ARGS) || |defined (HAVE_KERN_PROC) */ - -#ifdef HAVE_MACH_O_DYLD_H - -static char * -macho_get_executable_path (struct backtrace_state *state, - backtrace_error_callback error_callback, void *data) -{ - uint32_t len; - char *name; - - len = 0; - if (_NSGetExecutablePath (NULL, &len) == 0) - return NULL; - name = (char *) backtrace_alloc (state, len, error_callback, data); - if (name == NULL) - return NULL; - if (_NSGetExecutablePath (name, &len) != 0) - { - backtrace_free (state, name, len, error_callback, data); - return NULL; - } - return name; -} - -#else /* !defined (HAVE_MACH_O_DYLD_H) */ - -#define macho_get_executable_path(state, error_callback, data) NULL - -#endif /* !defined (HAVE_MACH_O_DYLD_H) */ - -/* Initialize the fileline information from the executable. Returns 1 - on success, 0 on failure. */ - -static int -fileline_initialize (struct backtrace_state *state, - backtrace_error_callback error_callback, void *data) -{ - int failed; - fileline fileline_fn; - int pass; - int called_error_callback; - int descriptor; - const char *filename; - char buf[64]; - - if (!state->threaded) - failed = state->fileline_initialization_failed; - else - failed = backtrace_atomic_load_int (&state->fileline_initialization_failed); - - if (failed) - { - error_callback (data, "failed to read executable information", -1); - return 0; - } - - if (!state->threaded) - fileline_fn = state->fileline_fn; - else - fileline_fn = backtrace_atomic_load_pointer (&state->fileline_fn); - if (fileline_fn != NULL) - return 1; - - /* We have not initialized the information. Do it now. */ - - descriptor = -1; - called_error_callback = 0; - for (pass = 0; pass < 8; ++pass) - { - int does_not_exist; - - switch (pass) - { - case 0: - filename = state->filename; - break; - case 1: - filename = getexecname (); - break; - case 2: - filename = "/proc/self/exe"; - break; - case 3: - filename = "/proc/curproc/file"; - break; - case 4: - snprintf (buf, sizeof (buf), "/proc/%ld/object/a.out", - (long) getpid ()); - filename = buf; - break; - case 5: - filename = sysctl_exec_name1 (state, error_callback, data); - break; - case 6: - filename = sysctl_exec_name2 (state, error_callback, data); - break; - case 7: - filename = macho_get_executable_path (state, error_callback, data); - break; - default: - abort (); - } - - if (filename == NULL) - continue; - - descriptor = backtrace_open (filename, error_callback, data, - &does_not_exist); - if (descriptor < 0 && !does_not_exist) - { - called_error_callback = 1; - break; - } - if (descriptor >= 0) - break; - } - - if (descriptor < 0) - { - if (!called_error_callback) - { - if (state->filename != NULL) - error_callback (data, state->filename, ENOENT); - else - error_callback (data, - "libbacktrace could not find executable to open", - 0); - } - failed = 1; - } - - if (!failed) - { - if (!backtrace_initialize (state, filename, descriptor, error_callback, - data, &fileline_fn)) - failed = 1; - } - - if (failed) - { - if (!state->threaded) - state->fileline_initialization_failed = 1; - else - backtrace_atomic_store_int (&state->fileline_initialization_failed, 1); - return 0; - } - - if (!state->threaded) - state->fileline_fn = fileline_fn; - else - { - backtrace_atomic_store_pointer (&state->fileline_fn, fileline_fn); - - /* Note that if two threads initialize at once, one of the data - sets may be leaked. */ - } - - return 1; -} - -/* Given a PC, find the file name, line number, and function name. */ - -int -backtrace_pcinfo (struct backtrace_state *state, uintptr_t pc, - backtrace_full_callback callback, - backtrace_error_callback error_callback, void *data) -{ - if (!fileline_initialize (state, error_callback, data)) - return 0; - - if (state->fileline_initialization_failed) - return 0; - - return state->fileline_fn (state, pc, callback, error_callback, data); -} - -/* Given a PC, find the symbol for it, and its value. */ - -int -backtrace_syminfo (struct backtrace_state *state, uintptr_t pc, - backtrace_syminfo_callback callback, - backtrace_error_callback error_callback, void *data) -{ - if (!fileline_initialize (state, error_callback, data)) - return 0; - - if (state->fileline_initialization_failed) - return 0; - - state->syminfo_fn (state, pc, callback, error_callback, data); - return 1; -} - -/* A backtrace_syminfo_callback that can call into a - backtrace_full_callback, used when we have a symbol table but no - debug info. */ - -void -backtrace_syminfo_to_full_callback (void *data, uintptr_t pc, - const char *symname, - uintptr_t symval ATTRIBUTE_UNUSED, - uintptr_t symsize ATTRIBUTE_UNUSED) -{ - struct backtrace_call_full *bdata = (struct backtrace_call_full *) data; - - bdata->ret = bdata->full_callback (bdata->full_data, pc, NULL, 0, symname); -} - -/* An error callback that corresponds to - backtrace_syminfo_to_full_callback. */ - -void -backtrace_syminfo_to_full_error_callback (void *data, const char *msg, - int errnum) -{ - struct backtrace_call_full *bdata = (struct backtrace_call_full *) data; - - bdata->full_error_callback (bdata->full_data, msg, errnum); -} diff --git a/contrib/libs/backtrace/filenames.h b/contrib/libs/backtrace/filenames.h deleted file mode 100644 index aa7bd7adff..0000000000 --- a/contrib/libs/backtrace/filenames.h +++ /dev/null @@ -1,52 +0,0 @@ -/* btest.c -- Filename header for libbacktrace library - Copyright (C) 2012-2018 Free Software Foundation, Inc. - Written by Ian Lance Taylor, Google. - -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) The name of the author may not be used to - endorse or promote products derived from this software without - specific prior written permission. - -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 GCC_VERSION -# define GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__) -#endif - -#if (GCC_VERSION < 2007) -# define __attribute__(x) -#endif - -#ifndef ATTRIBUTE_UNUSED -# define ATTRIBUTE_UNUSED __attribute__ ((__unused__)) -#endif - -#if defined(__MSDOS__) || defined(_WIN32) || defined(__OS2__) || defined (__CYGWIN__) -# define IS_DIR_SEPARATOR(c) ((c) == '/' || (c) == '\\') -# define HAS_DRIVE_SPEC(f) ((f)[0] != '\0' && (f)[1] == ':') -# define IS_ABSOLUTE_PATH(f) (IS_DIR_SEPARATOR((f)[0]) || HAS_DRIVE_SPEC(f)) -#else -# define IS_DIR_SEPARATOR(c) ((c) == '/') -# define IS_ABSOLUTE_PATH(f) (IS_DIR_SEPARATOR((f)[0])) -#endif diff --git a/contrib/libs/backtrace/internal.h b/contrib/libs/backtrace/internal.h deleted file mode 100644 index bb481f373b..0000000000 --- a/contrib/libs/backtrace/internal.h +++ /dev/null @@ -1,380 +0,0 @@ -/* internal.h -- Internal header file for stack backtrace library. - Copyright (C) 2012-2021 Free Software Foundation, Inc. - Written by Ian Lance Taylor, Google. - -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) The name of the author may not be used to - endorse or promote products derived from this software without - specific prior written permission. - -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 BACKTRACE_INTERNAL_H -#define BACKTRACE_INTERNAL_H - -/* We assume that <sys/types.h> and "backtrace.h" have already been - included. */ - -#ifndef GCC_VERSION -# define GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__) -#endif - -#if (GCC_VERSION < 2007) -# define __attribute__(x) -#endif - -#ifndef ATTRIBUTE_UNUSED -# define ATTRIBUTE_UNUSED __attribute__ ((__unused__)) -#endif - -#ifndef ATTRIBUTE_MALLOC -# if (GCC_VERSION >= 2096) -# define ATTRIBUTE_MALLOC __attribute__ ((__malloc__)) -# else -# define ATTRIBUTE_MALLOC -# endif -#endif - -#ifndef ATTRIBUTE_FALLTHROUGH -# if (GCC_VERSION >= 7000) -# define ATTRIBUTE_FALLTHROUGH __attribute__ ((__fallthrough__)) -# else -# define ATTRIBUTE_FALLTHROUGH -# endif -#endif - -#ifndef HAVE_SYNC_FUNCTIONS - -/* Define out the sync functions. These should never be called if - they are not available. */ - -#define __sync_bool_compare_and_swap(A, B, C) (abort(), 1) -#define __sync_lock_test_and_set(A, B) (abort(), 0) -#define __sync_lock_release(A) abort() - -#endif /* !defined (HAVE_SYNC_FUNCTIONS) */ - -#ifdef HAVE_ATOMIC_FUNCTIONS - -/* We have the atomic builtin functions. */ - -#define backtrace_atomic_load_pointer(p) \ - __atomic_load_n ((p), __ATOMIC_ACQUIRE) -#define backtrace_atomic_load_int(p) \ - __atomic_load_n ((p), __ATOMIC_ACQUIRE) -#define backtrace_atomic_store_pointer(p, v) \ - __atomic_store_n ((p), (v), __ATOMIC_RELEASE) -#define backtrace_atomic_store_size_t(p, v) \ - __atomic_store_n ((p), (v), __ATOMIC_RELEASE) -#define backtrace_atomic_store_int(p, v) \ - __atomic_store_n ((p), (v), __ATOMIC_RELEASE) - -#else /* !defined (HAVE_ATOMIC_FUNCTIONS) */ -#ifdef HAVE_SYNC_FUNCTIONS - -/* We have the sync functions but not the atomic functions. Define - the atomic ones in terms of the sync ones. */ - -extern void *backtrace_atomic_load_pointer (void *); -extern int backtrace_atomic_load_int (int *); -extern void backtrace_atomic_store_pointer (void *, void *); -extern void backtrace_atomic_store_size_t (size_t *, size_t); -extern void backtrace_atomic_store_int (int *, int); - -#else /* !defined (HAVE_SYNC_FUNCTIONS) */ - -/* We have neither the sync nor the atomic functions. These will - never be called. */ - -#define backtrace_atomic_load_pointer(p) (abort(), (void *) NULL) -#define backtrace_atomic_load_int(p) (abort(), 0) -#define backtrace_atomic_store_pointer(p, v) abort() -#define backtrace_atomic_store_size_t(p, v) abort() -#define backtrace_atomic_store_int(p, v) abort() - -#endif /* !defined (HAVE_SYNC_FUNCTIONS) */ -#endif /* !defined (HAVE_ATOMIC_FUNCTIONS) */ - -/* The type of the function that collects file/line information. This - is like backtrace_pcinfo. */ - -typedef int (*fileline) (struct backtrace_state *state, uintptr_t pc, - backtrace_full_callback callback, - backtrace_error_callback error_callback, void *data); - -/* The type of the function that collects symbol information. This is - like backtrace_syminfo. */ - -typedef void (*syminfo) (struct backtrace_state *state, uintptr_t pc, - backtrace_syminfo_callback callback, - backtrace_error_callback error_callback, void *data); - -/* What the backtrace state pointer points to. */ - -struct backtrace_state -{ - /* The name of the executable. */ - const char *filename; - /* Non-zero if threaded. */ - int threaded; - /* The master lock for fileline_fn, fileline_data, syminfo_fn, - syminfo_data, fileline_initialization_failed and everything the - data pointers point to. */ - void *lock; - /* The function that returns file/line information. */ - fileline fileline_fn; - /* The data to pass to FILELINE_FN. */ - void *fileline_data; - /* The function that returns symbol information. */ - syminfo syminfo_fn; - /* The data to pass to SYMINFO_FN. */ - void *syminfo_data; - /* Whether initializing the file/line information failed. */ - int fileline_initialization_failed; - /* The lock for the freelist. */ - int lock_alloc; - /* The freelist when using mmap. */ - struct backtrace_freelist_struct *freelist; -}; - -/* Open a file for reading. Returns -1 on error. If DOES_NOT_EXIST - is not NULL, *DOES_NOT_EXIST will be set to 0 normally and set to 1 - if the file does not exist. If the file does not exist and - DOES_NOT_EXIST is not NULL, the function will return -1 and will - not call ERROR_CALLBACK. On other errors, or if DOES_NOT_EXIST is - NULL, the function will call ERROR_CALLBACK before returning. */ -extern int backtrace_open (const char *filename, - backtrace_error_callback error_callback, - void *data, - int *does_not_exist); - -/* A view of the contents of a file. This supports mmap when - available. A view will remain in memory even after backtrace_close - is called on the file descriptor from which the view was - obtained. */ - -struct backtrace_view -{ - /* The data that the caller requested. */ - const void *data; - /* The base of the view. */ - void *base; - /* The total length of the view. */ - size_t len; -}; - -/* Create a view of SIZE bytes from DESCRIPTOR at OFFSET. Store the - result in *VIEW. Returns 1 on success, 0 on error. */ -extern int backtrace_get_view (struct backtrace_state *state, int descriptor, - off_t offset, uint64_t size, - backtrace_error_callback error_callback, - void *data, struct backtrace_view *view); - -/* Release a view created by backtrace_get_view. */ -extern void backtrace_release_view (struct backtrace_state *state, - struct backtrace_view *view, - backtrace_error_callback error_callback, - void *data); - -/* Close a file opened by backtrace_open. Returns 1 on success, 0 on - error. */ - -extern int backtrace_close (int descriptor, - backtrace_error_callback error_callback, - void *data); - -/* Sort without using memory. */ - -extern void backtrace_qsort (void *base, size_t count, size_t size, - int (*compar) (const void *, const void *)); - -/* Allocate memory. This is like malloc. If ERROR_CALLBACK is NULL, - this does not report an error, it just returns NULL. */ - -extern void *backtrace_alloc (struct backtrace_state *state, size_t size, - backtrace_error_callback error_callback, - void *data) ATTRIBUTE_MALLOC; - -/* Free memory allocated by backtrace_alloc. If ERROR_CALLBACK is - NULL, this does not report an error. */ - -extern void backtrace_free (struct backtrace_state *state, void *mem, - size_t size, - backtrace_error_callback error_callback, - void *data); - -/* A growable vector of some struct. This is used for more efficient - allocation when we don't know the final size of some group of data - that we want to represent as an array. */ - -struct backtrace_vector -{ - /* The base of the vector. */ - void *base; - /* The number of bytes in the vector. */ - size_t size; - /* The number of bytes available at the current allocation. */ - size_t alc; -}; - -/* Grow VEC by SIZE bytes. Return a pointer to the newly allocated - bytes. Note that this may move the entire vector to a new memory - location. Returns NULL on failure. */ - -extern void *backtrace_vector_grow (struct backtrace_state *state, size_t size, - backtrace_error_callback error_callback, - void *data, - struct backtrace_vector *vec); - -/* Finish the current allocation on VEC. Prepare to start a new - allocation. The finished allocation will never be freed. Returns - a pointer to the base of the finished entries, or NULL on - failure. */ - -extern void* backtrace_vector_finish (struct backtrace_state *state, - struct backtrace_vector *vec, - backtrace_error_callback error_callback, - void *data); - -/* Release any extra space allocated for VEC. This may change - VEC->base. Returns 1 on success, 0 on failure. */ - -extern int backtrace_vector_release (struct backtrace_state *state, - struct backtrace_vector *vec, - backtrace_error_callback error_callback, - void *data); - -/* Free the space managed by VEC. This will reset VEC. */ - -static inline void -backtrace_vector_free (struct backtrace_state *state, - struct backtrace_vector *vec, - backtrace_error_callback error_callback, void *data) -{ - vec->alc += vec->size; - vec->size = 0; - backtrace_vector_release (state, vec, error_callback, data); -} - -/* Read initial debug data from a descriptor, and set the - fileline_data, syminfo_fn, and syminfo_data fields of STATE. - Return the fileln_fn field in *FILELN_FN--this is done this way so - that the synchronization code is only implemented once. This is - called after the descriptor has first been opened. It will close - the descriptor if it is no longer needed. Returns 1 on success, 0 - on error. There will be multiple implementations of this function, - for different file formats. Each system will compile the - appropriate one. */ - -extern int backtrace_initialize (struct backtrace_state *state, - const char *filename, - int descriptor, - backtrace_error_callback error_callback, - void *data, - fileline *fileline_fn); - -/* An enum for the DWARF sections we care about. */ - -enum dwarf_section -{ - DEBUG_INFO, - DEBUG_LINE, - DEBUG_ABBREV, - DEBUG_RANGES, - DEBUG_STR, - DEBUG_ADDR, - DEBUG_STR_OFFSETS, - DEBUG_LINE_STR, - DEBUG_RNGLISTS, - - DEBUG_MAX -}; - -/* Data for the DWARF sections we care about. */ - -struct dwarf_sections -{ - const unsigned char *data[DEBUG_MAX]; - size_t size[DEBUG_MAX]; -}; - -/* DWARF data read from a file, used for .gnu_debugaltlink. */ - -struct dwarf_data; - -/* Add file/line information for a DWARF module. */ - -extern int backtrace_dwarf_add (struct backtrace_state *state, - uintptr_t base_address, - const struct dwarf_sections *dwarf_sections, - int is_bigendian, - struct dwarf_data *fileline_altlink, - backtrace_error_callback error_callback, - void *data, fileline *fileline_fn, - struct dwarf_data **fileline_entry); - -/* A data structure to pass to backtrace_syminfo_to_full. */ - -struct backtrace_call_full -{ - backtrace_full_callback full_callback; - backtrace_error_callback full_error_callback; - void *full_data; - int ret; -}; - -/* A backtrace_syminfo_callback that can call into a - backtrace_full_callback, used when we have a symbol table but no - debug info. */ - -extern void backtrace_syminfo_to_full_callback (void *data, uintptr_t pc, - const char *symname, - uintptr_t symval, - uintptr_t symsize); - -/* An error callback that corresponds to - backtrace_syminfo_to_full_callback. */ - -extern void backtrace_syminfo_to_full_error_callback (void *, const char *, - int); - -/* A test-only hook for elf_uncompress_zdebug. */ - -extern int backtrace_uncompress_zdebug (struct backtrace_state *, - const unsigned char *compressed, - size_t compressed_size, - backtrace_error_callback, void *data, - unsigned char **uncompressed, - size_t *uncompressed_size); - -/* A test-only hook for elf_uncompress_lzma. */ - -extern int backtrace_uncompress_lzma (struct backtrace_state *, - const unsigned char *compressed, - size_t compressed_size, - backtrace_error_callback, void *data, - unsigned char **uncompressed, - size_t *uncompressed_size); - -#endif diff --git a/contrib/libs/backtrace/mmap.c b/contrib/libs/backtrace/mmap.c deleted file mode 100644 index d7313be73f..0000000000 --- a/contrib/libs/backtrace/mmap.c +++ /dev/null @@ -1,331 +0,0 @@ -/* mmap.c -- Memory allocation with mmap. - Copyright (C) 2012-2021 Free Software Foundation, Inc. - Written by Ian Lance Taylor, Google. - -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) The name of the author may not be used to - endorse or promote products derived from this software without - specific prior written permission. - -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. */ - -#include "config.h" - -#include <errno.h> -#include <string.h> -#include <stdlib.h> -#include <unistd.h> -#include <sys/types.h> -#include <sys/mman.h> - -#include "backtrace.h" -#include "internal.h" - -#ifndef HAVE_DECL_GETPAGESIZE -extern int getpagesize (void); -#endif - -/* Memory allocation on systems that provide anonymous mmap. This - permits the backtrace functions to be invoked from a signal - handler, assuming that mmap is async-signal safe. */ - -#ifndef MAP_ANONYMOUS -#define MAP_ANONYMOUS MAP_ANON -#endif - -#ifndef MAP_FAILED -#define MAP_FAILED ((void *)-1) -#endif - -/* A list of free memory blocks. */ - -struct backtrace_freelist_struct -{ - /* Next on list. */ - struct backtrace_freelist_struct *next; - /* Size of this block, including this structure. */ - size_t size; -}; - -/* Free memory allocated by backtrace_alloc. */ - -static void -backtrace_free_locked (struct backtrace_state *state, void *addr, size_t size) -{ - /* Just leak small blocks. We don't have to be perfect. Don't put - more than 16 entries on the free list, to avoid wasting time - searching when allocating a block. If we have more than 16 - entries, leak the smallest entry. */ - - if (size >= sizeof (struct backtrace_freelist_struct)) - { - size_t c; - struct backtrace_freelist_struct **ppsmall; - struct backtrace_freelist_struct **pp; - struct backtrace_freelist_struct *p; - - c = 0; - ppsmall = NULL; - for (pp = &state->freelist; *pp != NULL; pp = &(*pp)->next) - { - if (ppsmall == NULL || (*pp)->size < (*ppsmall)->size) - ppsmall = pp; - ++c; - } - if (c >= 16) - { - if (size <= (*ppsmall)->size) - return; - *ppsmall = (*ppsmall)->next; - } - - p = (struct backtrace_freelist_struct *) addr; - p->next = state->freelist; - p->size = size; - state->freelist = p; - } -} - -/* Allocate memory like malloc. If ERROR_CALLBACK is NULL, don't - report an error. */ - -void * -backtrace_alloc (struct backtrace_state *state, - size_t size, backtrace_error_callback error_callback, - void *data) -{ - void *ret; - int locked; - struct backtrace_freelist_struct **pp; - size_t pagesize; - size_t asksize; - void *page; - - ret = NULL; - - /* If we can acquire the lock, then see if there is space on the - free list. If we can't acquire the lock, drop straight into - using mmap. __sync_lock_test_and_set returns the old state of - the lock, so we have acquired it if it returns 0. */ - - if (!state->threaded) - locked = 1; - else - locked = __sync_lock_test_and_set (&state->lock_alloc, 1) == 0; - - if (locked) - { - for (pp = &state->freelist; *pp != NULL; pp = &(*pp)->next) - { - if ((*pp)->size >= size) - { - struct backtrace_freelist_struct *p; - - p = *pp; - *pp = p->next; - - /* Round for alignment; we assume that no type we care about - is more than 8 bytes. */ - size = (size + 7) & ~ (size_t) 7; - if (size < p->size) - backtrace_free_locked (state, (char *) p + size, - p->size - size); - - ret = (void *) p; - - break; - } - } - - if (state->threaded) - __sync_lock_release (&state->lock_alloc); - } - - if (ret == NULL) - { - /* Allocate a new page. */ - - pagesize = getpagesize (); - asksize = (size + pagesize - 1) & ~ (pagesize - 1); - page = mmap (NULL, asksize, PROT_READ | PROT_WRITE, - MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); - if (page == MAP_FAILED) - { - if (error_callback) - error_callback (data, "mmap", errno); - } - else - { - size = (size + 7) & ~ (size_t) 7; - if (size < asksize) - backtrace_free (state, (char *) page + size, asksize - size, - error_callback, data); - - ret = page; - } - } - - return ret; -} - -/* Free memory allocated by backtrace_alloc. */ - -void -backtrace_free (struct backtrace_state *state, void *addr, size_t size, - backtrace_error_callback error_callback ATTRIBUTE_UNUSED, - void *data ATTRIBUTE_UNUSED) -{ - int locked; - - /* If we are freeing a large aligned block, just release it back to - the system. This case arises when growing a vector for a large - binary with lots of debug info. Calling munmap here may cause us - to call mmap again if there is also a large shared library; we - just live with that. */ - if (size >= 16 * 4096) - { - size_t pagesize; - - pagesize = getpagesize (); - if (((uintptr_t) addr & (pagesize - 1)) == 0 - && (size & (pagesize - 1)) == 0) - { - /* If munmap fails for some reason, just add the block to - the freelist. */ - if (munmap (addr, size) == 0) - return; - } - } - - /* If we can acquire the lock, add the new space to the free list. - If we can't acquire the lock, just leak the memory. - __sync_lock_test_and_set returns the old state of the lock, so we - have acquired it if it returns 0. */ - - if (!state->threaded) - locked = 1; - else - locked = __sync_lock_test_and_set (&state->lock_alloc, 1) == 0; - - if (locked) - { - backtrace_free_locked (state, addr, size); - - if (state->threaded) - __sync_lock_release (&state->lock_alloc); - } -} - -/* Grow VEC by SIZE bytes. */ - -void * -backtrace_vector_grow (struct backtrace_state *state,size_t size, - backtrace_error_callback error_callback, - void *data, struct backtrace_vector *vec) -{ - void *ret; - - if (size > vec->alc) - { - size_t pagesize; - size_t alc; - void *base; - - pagesize = getpagesize (); - alc = vec->size + size; - if (vec->size == 0) - alc = 16 * size; - else if (alc < pagesize) - { - alc *= 2; - if (alc > pagesize) - alc = pagesize; - } - else - { - alc *= 2; - alc = (alc + pagesize - 1) & ~ (pagesize - 1); - } - base = backtrace_alloc (state, alc, error_callback, data); - if (base == NULL) - return NULL; - if (vec->base != NULL) - { - memcpy (base, vec->base, vec->size); - backtrace_free (state, vec->base, vec->size + vec->alc, - error_callback, data); - } - vec->base = base; - vec->alc = alc - vec->size; - } - - ret = (char *) vec->base + vec->size; - vec->size += size; - vec->alc -= size; - return ret; -} - -/* Finish the current allocation on VEC. */ - -void * -backtrace_vector_finish ( - struct backtrace_state *state ATTRIBUTE_UNUSED, - struct backtrace_vector *vec, - backtrace_error_callback error_callback ATTRIBUTE_UNUSED, - void *data ATTRIBUTE_UNUSED) -{ - void *ret; - - ret = vec->base; - vec->base = (char *) vec->base + vec->size; - vec->size = 0; - return ret; -} - -/* Release any extra space allocated for VEC. */ - -int -backtrace_vector_release (struct backtrace_state *state, - struct backtrace_vector *vec, - backtrace_error_callback error_callback, - void *data) -{ - size_t size; - size_t alc; - size_t aligned; - - /* Make sure that the block that we free is aligned on an 8-byte - boundary. */ - size = vec->size; - alc = vec->alc; - aligned = (size + 7) & ~ (size_t) 7; - alc -= aligned - size; - - backtrace_free (state, (char *) vec->base + aligned, alc, - error_callback, data); - vec->alc = 0; - if (vec->size == 0) - vec->base = NULL; - return 1; -} diff --git a/contrib/libs/backtrace/mmapio.c b/contrib/libs/backtrace/mmapio.c deleted file mode 100644 index 7f6fa8d274..0000000000 --- a/contrib/libs/backtrace/mmapio.c +++ /dev/null @@ -1,110 +0,0 @@ -/* mmapio.c -- File views using mmap. - Copyright (C) 2012-2021 Free Software Foundation, Inc. - Written by Ian Lance Taylor, Google. - -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) The name of the author may not be used to - endorse or promote products derived from this software without - specific prior written permission. - -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. */ - -#include "config.h" - -#include <errno.h> -#include <sys/types.h> -#include <sys/mman.h> -#include <unistd.h> - -#include "backtrace.h" -#include "internal.h" - -#ifndef HAVE_DECL_GETPAGESIZE -extern int getpagesize (void); -#endif - -#ifndef MAP_FAILED -#define MAP_FAILED ((void *)-1) -#endif - -/* This file implements file views and memory allocation when mmap is - available. */ - -/* Create a view of SIZE bytes from DESCRIPTOR at OFFSET. */ - -int -backtrace_get_view (struct backtrace_state *state ATTRIBUTE_UNUSED, - int descriptor, off_t offset, uint64_t size, - backtrace_error_callback error_callback, - void *data, struct backtrace_view *view) -{ - size_t pagesize; - unsigned int inpage; - off_t pageoff; - void *map; - - if ((uint64_t) (size_t) size != size) - { - error_callback (data, "file size too large", 0); - return 0; - } - - pagesize = getpagesize (); - inpage = offset % pagesize; - pageoff = offset - inpage; - - size += inpage; - size = (size + (pagesize - 1)) & ~ (pagesize - 1); - - map = mmap (NULL, size, PROT_READ, MAP_PRIVATE, descriptor, pageoff); - if (map == MAP_FAILED) - { - error_callback (data, "mmap", errno); - return 0; - } - - view->data = (char *) map + inpage; - view->base = map; - view->len = size; - - return 1; -} - -/* Release a view read by backtrace_get_view. */ - -void -backtrace_release_view (struct backtrace_state *state ATTRIBUTE_UNUSED, - struct backtrace_view *view, - backtrace_error_callback error_callback, - void *data) -{ - union { - const void *cv; - void *v; - } const_cast; - - const_cast.cv = view->base; - if (munmap (const_cast.v, view->len) < 0) - error_callback (data, "munmap", errno); -} diff --git a/contrib/libs/backtrace/posix.c b/contrib/libs/backtrace/posix.c deleted file mode 100644 index 924631d2e6..0000000000 --- a/contrib/libs/backtrace/posix.c +++ /dev/null @@ -1,104 +0,0 @@ -/* posix.c -- POSIX file I/O routines for the backtrace library. - Copyright (C) 2012-2021 Free Software Foundation, Inc. - Written by Ian Lance Taylor, Google. - -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) The name of the author may not be used to - endorse or promote products derived from this software without - specific prior written permission. - -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. */ - -#include "config.h" - -#include <errno.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <unistd.h> - -#include "backtrace.h" -#include "internal.h" - -#ifndef O_BINARY -#define O_BINARY 0 -#endif - -#ifndef O_CLOEXEC -#define O_CLOEXEC 0 -#endif - -#ifndef FD_CLOEXEC -#define FD_CLOEXEC 1 -#endif - -/* Open a file for reading. */ - -int -backtrace_open (const char *filename, backtrace_error_callback error_callback, - void *data, int *does_not_exist) -{ - int descriptor; - - if (does_not_exist != NULL) - *does_not_exist = 0; - - descriptor = open (filename, (int) (O_RDONLY | O_BINARY | O_CLOEXEC)); - if (descriptor < 0) - { - /* If DOES_NOT_EXIST is not NULL, then don't call ERROR_CALLBACK - if the file does not exist. We treat lacking permission to - open the file as the file not existing; this case arises when - running the libgo syscall package tests as root. */ - if (does_not_exist != NULL && (errno == ENOENT || errno == EACCES)) - *does_not_exist = 1; - else - error_callback (data, filename, errno); - return -1; - } - -#ifdef HAVE_FCNTL - /* Set FD_CLOEXEC just in case the kernel does not support - O_CLOEXEC. It doesn't matter if this fails for some reason. - FIXME: At some point it should be safe to only do this if - O_CLOEXEC == 0. */ - fcntl (descriptor, F_SETFD, FD_CLOEXEC); -#endif - - return descriptor; -} - -/* Close DESCRIPTOR. */ - -int -backtrace_close (int descriptor, backtrace_error_callback error_callback, - void *data) -{ - if (close (descriptor) < 0) - { - error_callback (data, "close", errno); - return 0; - } - return 1; -} diff --git a/contrib/libs/backtrace/print.c b/contrib/libs/backtrace/print.c deleted file mode 100644 index 93d0d3abb4..0000000000 --- a/contrib/libs/backtrace/print.c +++ /dev/null @@ -1,92 +0,0 @@ -/* print.c -- Print the current backtrace. - Copyright (C) 2012-2021 Free Software Foundation, Inc. - Written by Ian Lance Taylor, Google. - -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) The name of the author may not be used to - endorse or promote products derived from this software without - specific prior written permission. - -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. */ - -#include "config.h" - -#include <stdio.h> -#include <string.h> -#include <sys/types.h> - -#include "backtrace.h" -#include "internal.h" - -/* Passed to callbacks. */ - -struct print_data -{ - struct backtrace_state *state; - FILE *f; -}; - -/* Print one level of a backtrace. */ - -static int -print_callback (void *data, uintptr_t pc, const char *filename, int lineno, - const char *function) -{ - struct print_data *pdata = (struct print_data *) data; - - fprintf (pdata->f, "0x%lx %s\n\t%s:%d\n", - (unsigned long) pc, - function == NULL ? "???" : function, - filename == NULL ? "???" : filename, - lineno); - return 0; -} - -/* Print errors to stderr. */ - -static void -error_callback (void *data, const char *msg, int errnum) -{ - struct print_data *pdata = (struct print_data *) data; - - if (pdata->state->filename != NULL) - fprintf (stderr, "%s: ", pdata->state->filename); - fprintf (stderr, "libbacktrace: %s", msg); - if (errnum > 0) - fprintf (stderr, ": %s", strerror (errnum)); - fputc ('\n', stderr); -} - -/* Print a backtrace. */ - -void __attribute__((noinline)) -backtrace_print (struct backtrace_state *state, int skip, FILE *f) -{ - struct print_data data; - - data.state = state; - data.f = f; - backtrace_full (state, skip + 1, print_callback, error_callback, - (void *) &data); -} diff --git a/contrib/libs/backtrace/simple.c b/contrib/libs/backtrace/simple.c deleted file mode 100644 index 785e726e6b..0000000000 --- a/contrib/libs/backtrace/simple.c +++ /dev/null @@ -1,108 +0,0 @@ -/* simple.c -- The backtrace_simple function. - Copyright (C) 2012-2021 Free Software Foundation, Inc. - Written by Ian Lance Taylor, Google. - -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) The name of the author may not be used to - endorse or promote products derived from this software without - specific prior written permission. - -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. */ - -#include "config.h" - -#include "unwind.h" -#include "backtrace.h" - -/* The simple_backtrace routine. */ - -/* Data passed through _Unwind_Backtrace. */ - -struct backtrace_simple_data -{ - /* Number of frames to skip. */ - int skip; - /* Library state. */ - struct backtrace_state *state; - /* Callback routine. */ - backtrace_simple_callback callback; - /* Error callback routine. */ - backtrace_error_callback error_callback; - /* Data to pass to callback routine. */ - void *data; - /* Value to return from backtrace. */ - int ret; -}; - -/* Unwind library callback routine. This is passed to - _Unwind_Backtrace. */ - -static _Unwind_Reason_Code -simple_unwind (struct _Unwind_Context *context, void *vdata) -{ - struct backtrace_simple_data *bdata = (struct backtrace_simple_data *) vdata; - uintptr_t pc; - int ip_before_insn = 0; - -#ifdef HAVE_GETIPINFO - pc = _Unwind_GetIPInfo (context, &ip_before_insn); -#else - pc = _Unwind_GetIP (context); -#endif - - if (bdata->skip > 0) - { - --bdata->skip; - return _URC_NO_REASON; - } - - if (!ip_before_insn) - --pc; - - bdata->ret = bdata->callback (bdata->data, pc); - - if (bdata->ret != 0) - return _URC_END_OF_STACK; - - return _URC_NO_REASON; -} - -/* Get a simple stack backtrace. */ - -int __attribute__((noinline)) -backtrace_simple (struct backtrace_state *state, int skip, - backtrace_simple_callback callback, - backtrace_error_callback error_callback, void *data) -{ - struct backtrace_simple_data bdata; - - bdata.skip = skip + 1; - bdata.state = state; - bdata.callback = callback; - bdata.error_callback = error_callback; - bdata.data = data; - bdata.ret = 0; - _Unwind_Backtrace (simple_unwind, &bdata); - return bdata.ret; -} diff --git a/contrib/libs/backtrace/sort.c b/contrib/libs/backtrace/sort.c deleted file mode 100644 index a60a980e65..0000000000 --- a/contrib/libs/backtrace/sort.c +++ /dev/null @@ -1,108 +0,0 @@ -/* sort.c -- Sort without allocating memory - Copyright (C) 2012-2021 Free Software Foundation, Inc. - Written by Ian Lance Taylor, Google. - -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) The name of the author may not be used to - endorse or promote products derived from this software without - specific prior written permission. - -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. */ - -#include "config.h" - -#include <stddef.h> -#include <sys/types.h> - -#include "backtrace.h" -#include "internal.h" - -/* The GNU glibc version of qsort allocates memory, which we must not - do if we are invoked by a signal handler. So provide our own - sort. */ - -static void -swap (char *a, char *b, size_t size) -{ - size_t i; - - for (i = 0; i < size; i++, a++, b++) - { - char t; - - t = *a; - *a = *b; - *b = t; - } -} - -void -backtrace_qsort (void *basearg, size_t count, size_t size, - int (*compar) (const void *, const void *)) -{ - char *base = (char *) basearg; - size_t i; - size_t mid; - - tail_recurse: - if (count < 2) - return; - - /* The symbol table and DWARF tables, which is all we use this - routine for, tend to be roughly sorted. Pick the middle element - in the array as our pivot point, so that we are more likely to - cut the array in half for each recursion step. */ - swap (base, base + (count / 2) * size, size); - - mid = 0; - for (i = 1; i < count; i++) - { - if ((*compar) (base, base + i * size) > 0) - { - ++mid; - if (i != mid) - swap (base + mid * size, base + i * size, size); - } - } - - if (mid > 0) - swap (base, base + mid * size, size); - - /* Recurse with the smaller array, loop with the larger one. That - ensures that our maximum stack depth is log count. */ - if (2 * mid < count) - { - backtrace_qsort (base, mid, size, compar); - base += (mid + 1) * size; - count -= mid + 1; - goto tail_recurse; - } - else - { - backtrace_qsort (base + (mid + 1) * size, count - (mid + 1), - size, compar); - count = mid; - goto tail_recurse; - } -} diff --git a/contrib/libs/backtrace/state.c b/contrib/libs/backtrace/state.c deleted file mode 100644 index 0f368a2390..0000000000 --- a/contrib/libs/backtrace/state.c +++ /dev/null @@ -1,72 +0,0 @@ -/* state.c -- Create the backtrace state. - Copyright (C) 2012-2021 Free Software Foundation, Inc. - Written by Ian Lance Taylor, Google. - -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) The name of the author may not be used to - endorse or promote products derived from this software without - specific prior written permission. - -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. */ - -#include "config.h" - -#include <string.h> -#include <sys/types.h> - -#include "backtrace.h" -#include "backtrace-supported.h" -#include "internal.h" - -/* Create the backtrace state. This will then be passed to all the - other routines. */ - -struct backtrace_state * -backtrace_create_state (const char *filename, int threaded, - backtrace_error_callback error_callback, - void *data) -{ - struct backtrace_state init_state; - struct backtrace_state *state; - -#ifndef HAVE_SYNC_FUNCTIONS - if (threaded) - { - error_callback (data, "backtrace library does not support threads", 0); - return NULL; - } -#endif - - memset (&init_state, 0, sizeof init_state); - init_state.filename = filename; - init_state.threaded = threaded; - - state = ((struct backtrace_state *) - backtrace_alloc (&init_state, sizeof *state, error_callback, data)); - if (state == NULL) - return NULL; - *state = init_state; - - return state; -} diff --git a/contrib/libs/python/Include/bufferobject.h b/contrib/libs/python/Include/bufferobject.h deleted file mode 100644 index aed38f50a9..0000000000 --- a/contrib/libs/python/Include/bufferobject.h +++ /dev/null @@ -1,7 +0,0 @@ -#pragma once - -#ifdef USE_PYTHON3 -#error "No <bufferobject.h> in Python3" -#else -#include <contrib/tools/python/src/Include/bufferobject.h> -#endif diff --git a/contrib/libs/python/Include/cellobject.h b/contrib/libs/python/Include/cellobject.h deleted file mode 100644 index 3345daa7fd..0000000000 --- a/contrib/libs/python/Include/cellobject.h +++ /dev/null @@ -1,7 +0,0 @@ -#pragma once - -#ifdef USE_PYTHON3 -#include <contrib/tools/python3/src/Include/cellobject.h> -#else -#include <contrib/tools/python/src/Include/cellobject.h> -#endif diff --git a/contrib/libs/python/Include/ceval.h b/contrib/libs/python/Include/ceval.h deleted file mode 100644 index f169fdbe79..0000000000 --- a/contrib/libs/python/Include/ceval.h +++ /dev/null @@ -1,7 +0,0 @@ -#pragma once - -#ifdef USE_PYTHON3 -#include <contrib/tools/python3/src/Include/ceval.h> -#else -#include <contrib/tools/python/src/Include/ceval.h> -#endif diff --git a/contrib/libs/python/Include/classobject.h b/contrib/libs/python/Include/classobject.h deleted file mode 100644 index 6f7a4f5e6e..0000000000 --- a/contrib/libs/python/Include/classobject.h +++ /dev/null @@ -1,7 +0,0 @@ -#pragma once - -#ifdef USE_PYTHON3 -#include <contrib/tools/python3/src/Include/classobject.h> -#else -#include <contrib/tools/python/src/Include/classobject.h> -#endif diff --git a/contrib/libs/python/Include/cobject.h b/contrib/libs/python/Include/cobject.h deleted file mode 100644 index 8fd2754e01..0000000000 --- a/contrib/libs/python/Include/cobject.h +++ /dev/null @@ -1,7 +0,0 @@ -#pragma once - -#ifdef USE_PYTHON3 -#error "No <cobject.h> in Python3" -#else -#include <contrib/tools/python/src/Include/cobject.h> -#endif diff --git a/contrib/libs/python/Include/codecs.h b/contrib/libs/python/Include/codecs.h deleted file mode 100644 index 52f76040fb..0000000000 --- a/contrib/libs/python/Include/codecs.h +++ /dev/null @@ -1,7 +0,0 @@ -#pragma once - -#ifdef USE_PYTHON3 -#include <contrib/tools/python3/src/Include/codecs.h> -#else -#include <contrib/tools/python/src/Include/codecs.h> -#endif diff --git a/contrib/libs/python/Include/complexobject.h b/contrib/libs/python/Include/complexobject.h deleted file mode 100644 index 2c510c47f4..0000000000 --- a/contrib/libs/python/Include/complexobject.h +++ /dev/null @@ -1,7 +0,0 @@ -#pragma once - -#ifdef USE_PYTHON3 -#include <contrib/tools/python3/src/Include/complexobject.h> -#else -#include <contrib/tools/python/src/Include/complexobject.h> -#endif diff --git a/contrib/libs/python/Include/dictobject.h b/contrib/libs/python/Include/dictobject.h deleted file mode 100644 index 36026b4962..0000000000 --- a/contrib/libs/python/Include/dictobject.h +++ /dev/null @@ -1,7 +0,0 @@ -#pragma once - -#ifdef USE_PYTHON3 -#include <contrib/tools/python3/src/Include/dictobject.h> -#else -#include <contrib/tools/python/src/Include/dictobject.h> -#endif diff --git a/contrib/libs/python/Include/fileobject.h b/contrib/libs/python/Include/fileobject.h deleted file mode 100644 index ac3aa4c7a2..0000000000 --- a/contrib/libs/python/Include/fileobject.h +++ /dev/null @@ -1,7 +0,0 @@ -#pragma once - -#ifdef USE_PYTHON3 -#include <contrib/tools/python3/src/Include/fileobject.h> -#else -#include <contrib/tools/python/src/Include/fileobject.h> -#endif diff --git a/contrib/libs/python/Include/floatobject.h b/contrib/libs/python/Include/floatobject.h deleted file mode 100644 index d08083f632..0000000000 --- a/contrib/libs/python/Include/floatobject.h +++ /dev/null @@ -1,7 +0,0 @@ -#pragma once - -#ifdef USE_PYTHON3 -#include <contrib/tools/python3/src/Include/floatobject.h> -#else -#include <contrib/tools/python/src/Include/floatobject.h> -#endif diff --git a/contrib/libs/python/Include/funcobject.h b/contrib/libs/python/Include/funcobject.h deleted file mode 100644 index d0bde3deb4..0000000000 --- a/contrib/libs/python/Include/funcobject.h +++ /dev/null @@ -1,7 +0,0 @@ -#pragma once - -#ifdef USE_PYTHON3 -#include <contrib/tools/python3/src/Include/funcobject.h> -#else -#include <contrib/tools/python/src/Include/funcobject.h> -#endif diff --git a/contrib/libs/python/Include/import.h b/contrib/libs/python/Include/import.h deleted file mode 100644 index cfa6515cdf..0000000000 --- a/contrib/libs/python/Include/import.h +++ /dev/null @@ -1,7 +0,0 @@ -#pragma once - -#ifdef USE_PYTHON3 -#include <contrib/tools/python3/src/Include/import.h> -#else -#include <contrib/tools/python/src/Include/import.h> -#endif diff --git a/contrib/libs/python/Include/intobject.h b/contrib/libs/python/Include/intobject.h deleted file mode 100644 index 4ec1b915df..0000000000 --- a/contrib/libs/python/Include/intobject.h +++ /dev/null @@ -1,7 +0,0 @@ -#pragma once - -#ifdef USE_PYTHON3 -#error "No <intobject.h> in Python3" -#else -#include <contrib/tools/python/src/Include/intobject.h> -#endif diff --git a/contrib/libs/python/Include/intrcheck.h b/contrib/libs/python/Include/intrcheck.h deleted file mode 100644 index 68aabf6d48..0000000000 --- a/contrib/libs/python/Include/intrcheck.h +++ /dev/null @@ -1,7 +0,0 @@ -#pragma once - -#ifdef USE_PYTHON3 -#include <contrib/tools/python3/src/Include/intrcheck.h> -#else -#include <contrib/tools/python/src/Include/intrcheck.h> -#endif diff --git a/contrib/libs/python/Include/iterobject.h b/contrib/libs/python/Include/iterobject.h deleted file mode 100644 index 19b24e317a..0000000000 --- a/contrib/libs/python/Include/iterobject.h +++ /dev/null @@ -1,7 +0,0 @@ -#pragma once - -#ifdef USE_PYTHON3 -#include <contrib/tools/python3/src/Include/iterobject.h> -#else -#include <contrib/tools/python/src/Include/iterobject.h> -#endif diff --git a/contrib/libs/python/Include/listobject.h b/contrib/libs/python/Include/listobject.h deleted file mode 100644 index e16f38f988..0000000000 --- a/contrib/libs/python/Include/listobject.h +++ /dev/null @@ -1,7 +0,0 @@ -#pragma once - -#ifdef USE_PYTHON3 -#include <contrib/tools/python3/src/Include/listobject.h> -#else -#include <contrib/tools/python/src/Include/listobject.h> -#endif diff --git a/contrib/libs/python/Include/longobject.h b/contrib/libs/python/Include/longobject.h deleted file mode 100644 index 18760d63cc..0000000000 --- a/contrib/libs/python/Include/longobject.h +++ /dev/null @@ -1,7 +0,0 @@ -#pragma once - -#ifdef USE_PYTHON3 -#include <contrib/tools/python3/src/Include/longobject.h> -#else -#include <contrib/tools/python/src/Include/longobject.h> -#endif diff --git a/contrib/libs/python/Include/methodobject.h b/contrib/libs/python/Include/methodobject.h deleted file mode 100644 index 12ff79b2e2..0000000000 --- a/contrib/libs/python/Include/methodobject.h +++ /dev/null @@ -1,7 +0,0 @@ -#pragma once - -#ifdef USE_PYTHON3 -#include <contrib/tools/python3/src/Include/methodobject.h> -#else -#include <contrib/tools/python/src/Include/methodobject.h> -#endif diff --git a/contrib/libs/python/Include/modsupport.h b/contrib/libs/python/Include/modsupport.h deleted file mode 100644 index 61dae25ba3..0000000000 --- a/contrib/libs/python/Include/modsupport.h +++ /dev/null @@ -1,7 +0,0 @@ -#pragma once - -#ifdef USE_PYTHON3 -#include <contrib/tools/python3/src/Include/modsupport.h> -#else -#include <contrib/tools/python/src/Include/modsupport.h> -#endif diff --git a/contrib/libs/python/Include/moduleobject.h b/contrib/libs/python/Include/moduleobject.h deleted file mode 100644 index d138ab73ca..0000000000 --- a/contrib/libs/python/Include/moduleobject.h +++ /dev/null @@ -1,7 +0,0 @@ -#pragma once - -#ifdef USE_PYTHON3 -#include <contrib/tools/python3/src/Include/moduleobject.h> -#else -#include <contrib/tools/python/src/Include/moduleobject.h> -#endif diff --git a/contrib/libs/python/Include/object.h b/contrib/libs/python/Include/object.h deleted file mode 100644 index 1a7e8a96bd..0000000000 --- a/contrib/libs/python/Include/object.h +++ /dev/null @@ -1,7 +0,0 @@ -#pragma once - -#ifdef USE_PYTHON3 -#include <contrib/tools/python3/src/Include/object.h> -#else -#include <contrib/tools/python/src/Include/object.h> -#endif diff --git a/contrib/libs/python/Include/objimpl.h b/contrib/libs/python/Include/objimpl.h deleted file mode 100644 index d33a4815a5..0000000000 --- a/contrib/libs/python/Include/objimpl.h +++ /dev/null @@ -1,7 +0,0 @@ -#pragma once - -#ifdef USE_PYTHON3 -#include <contrib/tools/python3/src/Include/objimpl.h> -#else -#include <contrib/tools/python/src/Include/objimpl.h> -#endif diff --git a/contrib/libs/python/Include/patchlevel.h b/contrib/libs/python/Include/patchlevel.h deleted file mode 100644 index 75ce0b8f9a..0000000000 --- a/contrib/libs/python/Include/patchlevel.h +++ /dev/null @@ -1,7 +0,0 @@ -#pragma once - -#ifdef USE_PYTHON3 -#include <contrib/tools/python3/src/Include/patchlevel.h> -#else -#include <contrib/tools/python/src/Include/patchlevel.h> -#endif diff --git a/contrib/libs/python/Include/pydebug.h b/contrib/libs/python/Include/pydebug.h deleted file mode 100644 index c20724196b..0000000000 --- a/contrib/libs/python/Include/pydebug.h +++ /dev/null @@ -1,7 +0,0 @@ -#pragma once - -#ifdef USE_PYTHON3 -#error "No <pydebug.h> in Python3" -#else -#include <contrib/tools/python/src/Include/pydebug.h> -#endif diff --git a/contrib/libs/python/Include/pyerrors.h b/contrib/libs/python/Include/pyerrors.h deleted file mode 100644 index 587690a2b2..0000000000 --- a/contrib/libs/python/Include/pyerrors.h +++ /dev/null @@ -1,7 +0,0 @@ -#pragma once - -#ifdef USE_PYTHON3 -#include <contrib/tools/python3/src/Include/pyerrors.h> -#else -#include <contrib/tools/python/src/Include/pyerrors.h> -#endif diff --git a/contrib/libs/python/Include/pyfpe.h b/contrib/libs/python/Include/pyfpe.h deleted file mode 100644 index bafbbb8cf3..0000000000 --- a/contrib/libs/python/Include/pyfpe.h +++ /dev/null @@ -1,7 +0,0 @@ -#pragma once - -#ifdef USE_PYTHON3 -#error "No <pyfpe.h> in Python3" -#else -#include <contrib/tools/python/src/Include/pyfpe.h> -#endif diff --git a/contrib/libs/python/Include/pyport.h b/contrib/libs/python/Include/pyport.h deleted file mode 100644 index a32beac0c1..0000000000 --- a/contrib/libs/python/Include/pyport.h +++ /dev/null @@ -1,7 +0,0 @@ -#pragma once - -#ifdef USE_PYTHON3 -#include <contrib/tools/python3/src/Include/pyport.h> -#else -#include <contrib/tools/python/src/Include/pyport.h> -#endif diff --git a/contrib/libs/python/Include/pythonrun.h b/contrib/libs/python/Include/pythonrun.h deleted file mode 100644 index 381610c54e..0000000000 --- a/contrib/libs/python/Include/pythonrun.h +++ /dev/null @@ -1,7 +0,0 @@ -#pragma once - -#ifdef USE_PYTHON3 -#include <contrib/tools/python3/src/Include/pythonrun.h> -#else -#include <contrib/tools/python/src/Include/pythonrun.h> -#endif diff --git a/contrib/libs/python/Include/rangeobject.h b/contrib/libs/python/Include/rangeobject.h deleted file mode 100644 index dc0b4a219b..0000000000 --- a/contrib/libs/python/Include/rangeobject.h +++ /dev/null @@ -1,7 +0,0 @@ -#pragma once - -#ifdef USE_PYTHON3 -#include <contrib/tools/python3/src/Include/rangeobject.h> -#else -#include <contrib/tools/python/src/Include/rangeobject.h> -#endif diff --git a/contrib/libs/python/Include/sliceobject.h b/contrib/libs/python/Include/sliceobject.h deleted file mode 100644 index b124a7a15b..0000000000 --- a/contrib/libs/python/Include/sliceobject.h +++ /dev/null @@ -1,7 +0,0 @@ -#pragma once - -#ifdef USE_PYTHON3 -#include <contrib/tools/python3/src/Include/sliceobject.h> -#else -#include <contrib/tools/python/src/Include/sliceobject.h> -#endif diff --git a/contrib/libs/python/Include/stringobject.h b/contrib/libs/python/Include/stringobject.h deleted file mode 100644 index 374c66667b..0000000000 --- a/contrib/libs/python/Include/stringobject.h +++ /dev/null @@ -1,7 +0,0 @@ -#pragma once - -#ifdef USE_PYTHON3 -#error "No <stringobject.h> in Python3" -#else -#include <contrib/tools/python/src/Include/stringobject.h> -#endif diff --git a/contrib/libs/python/Include/sysmodule.h b/contrib/libs/python/Include/sysmodule.h deleted file mode 100644 index 6b50a48c2d..0000000000 --- a/contrib/libs/python/Include/sysmodule.h +++ /dev/null @@ -1,7 +0,0 @@ -#pragma once - -#ifdef USE_PYTHON3 -#include <contrib/tools/python3/src/Include/sysmodule.h> -#else -#include <contrib/tools/python/src/Include/sysmodule.h> -#endif diff --git a/contrib/libs/python/Include/tupleobject.h b/contrib/libs/python/Include/tupleobject.h deleted file mode 100644 index 8b924b9b4c..0000000000 --- a/contrib/libs/python/Include/tupleobject.h +++ /dev/null @@ -1,7 +0,0 @@ -#pragma once - -#ifdef USE_PYTHON3 -#include <contrib/tools/python3/src/Include/tupleobject.h> -#else -#include <contrib/tools/python/src/Include/tupleobject.h> -#endif diff --git a/contrib/libs/python/Include/weakrefobject.h b/contrib/libs/python/Include/weakrefobject.h deleted file mode 100644 index 3fed3fa764..0000000000 --- a/contrib/libs/python/Include/weakrefobject.h +++ /dev/null @@ -1,7 +0,0 @@ -#pragma once - -#ifdef USE_PYTHON3 -#include <contrib/tools/python3/src/Include/weakrefobject.h> -#else -#include <contrib/tools/python/src/Include/weakrefobject.h> -#endif diff --git a/contrib/restricted/boost/CMakeLists.darwin.txt b/contrib/restricted/boost/CMakeLists.darwin.txt index f9b9094540..24df71a5fe 100644 --- a/contrib/restricted/boost/CMakeLists.darwin.txt +++ b/contrib/restricted/boost/CMakeLists.darwin.txt @@ -89,8 +89,3 @@ add_subdirectory(variant) add_subdirectory(variant2) add_subdirectory(winapi) add_subdirectory(xpressive) - -add_library(contrib-restricted-boost INTERFACE) -target_link_libraries(contrib-restricted-boost INTERFACE - contrib-libs-cxxsupp -) diff --git a/contrib/restricted/boost/CMakeLists.linux-aarch64.txt b/contrib/restricted/boost/CMakeLists.linux-aarch64.txt index dce4fe4558..3a27c3b8eb 100644 --- a/contrib/restricted/boost/CMakeLists.linux-aarch64.txt +++ b/contrib/restricted/boost/CMakeLists.linux-aarch64.txt @@ -80,9 +80,3 @@ add_subdirectory(utility) add_subdirectory(variant) add_subdirectory(variant2) add_subdirectory(winapi) - -add_library(contrib-restricted-boost INTERFACE) -target_link_libraries(contrib-restricted-boost INTERFACE - contrib-libs-linux-headers - contrib-libs-cxxsupp -) diff --git a/contrib/restricted/boost/CMakeLists.linux.txt b/contrib/restricted/boost/CMakeLists.linux.txt index efb1653516..24df71a5fe 100644 --- a/contrib/restricted/boost/CMakeLists.linux.txt +++ b/contrib/restricted/boost/CMakeLists.linux.txt @@ -89,9 +89,3 @@ add_subdirectory(variant) add_subdirectory(variant2) add_subdirectory(winapi) add_subdirectory(xpressive) - -add_library(contrib-restricted-boost INTERFACE) -target_link_libraries(contrib-restricted-boost INTERFACE - contrib-libs-linux-headers - contrib-libs-cxxsupp -) diff --git a/contrib/restricted/boost/algorithm/include/boost/algorithm/cxx11/all_of.hpp b/contrib/restricted/boost/algorithm/include/boost/algorithm/cxx11/all_of.hpp deleted file mode 100644 index f7ee311b28..0000000000 --- a/contrib/restricted/boost/algorithm/include/boost/algorithm/cxx11/all_of.hpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - Copyright (c) Marshall Clow 2008-2012. - - Distributed under the Boost Software License, Version 1.0. (See accompanying - file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -*/ - -/// \file all_of.hpp -/// \brief Test ranges to see if all elements match a value or predicate. -/// \author Marshall Clow - -#ifndef BOOST_ALGORITHM_ALL_OF_HPP -#define BOOST_ALGORITHM_ALL_OF_HPP - -#include <boost/config.hpp> -#include <boost/range/begin.hpp> -#include <boost/range/end.hpp> - -namespace boost { namespace algorithm { - -/// \fn all_of ( InputIterator first, InputIterator last, Predicate p ) -/// \return true if all elements in [first, last) satisfy the predicate 'p' -/// \note returns true on an empty range -/// -/// \param first The start of the input sequence -/// \param last One past the end of the input sequence -/// \param p A predicate for testing the elements of the sequence -/// -/// \note This function is part of the C++2011 standard library. -template<typename InputIterator, typename Predicate> -BOOST_CXX14_CONSTEXPR bool all_of ( InputIterator first, InputIterator last, Predicate p ) -{ - for ( ; first != last; ++first ) - if ( !p(*first)) - return false; - return true; -} - -/// \fn all_of ( const Range &r, Predicate p ) -/// \return true if all elements in the range satisfy the predicate 'p' -/// \note returns true on an empty range -/// -/// \param r The input range -/// \param p A predicate for testing the elements of the range -/// -template<typename Range, typename Predicate> -BOOST_CXX14_CONSTEXPR bool all_of ( const Range &r, Predicate p ) -{ - return boost::algorithm::all_of ( boost::begin (r), boost::end (r), p ); -} - -/// \fn all_of_equal ( InputIterator first, InputIterator last, const T &val ) -/// \return true if all elements in [first, last) are equal to 'val' -/// \note returns true on an empty range -/// -/// \param first The start of the input sequence -/// \param last One past the end of the input sequence -/// \param val A value to compare against -/// -template<typename InputIterator, typename T> -BOOST_CXX14_CONSTEXPR bool all_of_equal ( InputIterator first, InputIterator last, const T &val ) -{ - for ( ; first != last; ++first ) - if ( val != *first ) - return false; - return true; -} - -/// \fn all_of_equal ( const Range &r, const T &val ) -/// \return true if all elements in the range are equal to 'val' -/// \note returns true on an empty range -/// -/// \param r The input range -/// \param val A value to compare against -/// -template<typename Range, typename T> -BOOST_CXX14_CONSTEXPR bool all_of_equal ( const Range &r, const T &val ) -{ - return boost::algorithm::all_of_equal ( boost::begin (r), boost::end (r), val ); -} - -}} // namespace boost and algorithm - -#endif // BOOST_ALGORITHM_ALL_OF_HPP diff --git a/contrib/restricted/boost/assign/LICENSE b/contrib/restricted/boost/assign/LICENSE deleted file mode 100644 index 36b7cd93cd..0000000000 --- a/contrib/restricted/boost/assign/LICENSE +++ /dev/null @@ -1,23 +0,0 @@ -Boost Software License - Version 1.0 - August 17th, 2003 - -Permission is hereby granted, free of charge, to any person or organization -obtaining a copy of the software and accompanying documentation covered by -this license (the "Software") to use, reproduce, display, distribute, -execute, and transmit the Software, and to prepare derivative works of the -Software, and to permit third-parties to whom the Software is furnished to -do so, all subject to the following: - -The copyright notices in the Software and this entire statement, including -the above license grant, this restriction and the following disclaimer, -must be included in all copies of the Software, in whole or in part, and -all derivative works of the Software, unless such copies or derivative -works are solely in the form of machine-executable object code generated by -a source language processor. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT -SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE -FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. diff --git a/contrib/restricted/boost/assign/README.md b/contrib/restricted/boost/assign/README.md deleted file mode 100644 index 225ec10b99..0000000000 --- a/contrib/restricted/boost/assign/README.md +++ /dev/null @@ -1,33 +0,0 @@ -Assign, part of collection of the [Boost C++ Libraries](http://github.com/boostorg), makes it easy to fill containers with data by overloading operator() and operator()(). - -### License - -Distributed under the [Boost Software License, Version 1.0](http://www.boost.org/LICENSE_1_0.txt). - -### Properties - -* C++03 -* Header Only - -### Build Status - -Branch | GHA CI | Appveyor | Coverity Scan | codecov.io | Deps | Docs | Tests | -:-------------: | ------ | -------- | ------------- | ---------- | ---- | ---- | ----- | -[`master`](https://github.com/boostorg/assign/tree/master) | [![Build Status](https://github.com/boostorg/assign/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/boostorg/assign/actions?query=branch:master) | [![Build status](https://ci.appveyor.com/api/projects/status/a8pip7fvp609f0v2/branch/master?svg=true)](https://ci.appveyor.com/project/jeking3/assign-4i3tt/branch/master) | [![Coverity Scan Build Status](https://scan.coverity.com/projects/16318/badge.svg)](https://scan.coverity.com/projects/boostorg-assign) | [![codecov](https://codecov.io/gh/boostorg/assign/branch/master/graph/badge.svg)](https://codecov.io/gh/boostorg/assign/branch/master)| [![Deps](https://img.shields.io/badge/deps-master-brightgreen.svg)](https://pdimov.github.io/boostdep-report/master/assign.html) | [![Documentation](https://img.shields.io/badge/docs-master-brightgreen.svg)](http://www.boost.org/doc/libs/master/doc/html/assign.html) | [![Enter the Matrix](https://img.shields.io/badge/matrix-master-brightgreen.svg)](http://www.boost.org/development/tests/master/developer/assign.html) -[`develop`](https://github.com/boostorg/assign/tree/develop) | [![Build Status](https://github.com/boostorg/assign/actions/workflows/ci.yml/badge.svg?branch=develop)](https://github.com/boostorg/assign/actions?query=branch:develop) | [![Build status](https://ci.appveyor.com/api/projects/status/a8pip7fvp609f0v2/branch/develop?svg=true)](https://ci.appveyor.com/project/jeking3/assign-4i3tt/branch/develop) | [![Coverity Scan Build Status](https://scan.coverity.com/projects/16318/badge.svg)](https://scan.coverity.com/projects/boostorg-assign) | [![codecov](https://codecov.io/gh/boostorg/assign/branch/develop/graph/badge.svg)](https://codecov.io/gh/boostorg/assign/branch/develop) | [![Deps](https://img.shields.io/badge/deps-develop-brightgreen.svg)](https://pdimov.github.io/boostdep-report/develop/assign.html) | [![Documentation](https://img.shields.io/badge/docs-develop-brightgreen.svg)](http://www.boost.org/doc/libs/develop/doc/html/assign.html) | [![Enter the Matrix](https://img.shields.io/badge/matrix-develop-brightgreen.svg)](http://www.boost.org/development/tests/develop/developer/assign.html) - -### Directories - -| Name | Purpose | -| ----------- | ------------------------------ | -| `doc` | documentation | -| `include` | headers | -| `test` | unit tests | - -### More information - -* [Ask questions](http://stackoverflow.com/questions/ask?tags=c%2B%2B,boost,boost-assign) -* [Report bugs](https://github.com/boostorg/assign/issues): Be sure to mention Boost version, platform and compiler you're using. A small compilable code sample to reproduce the problem is always good as well. -* Submit your patches as pull requests against **develop** branch. Note that by submitting patches you agree to license your modifications under the [Boost Software License, Version 1.0](http://www.boost.org/LICENSE_1_0.txt). -* Discussions about the library are held on the [Boost developers mailing list](http://www.boost.org/community/groups.html#main). Be sure to read the [discussion policy](http://www.boost.org/community/policy.html) before posting and add the `[assign]` tag at the beginning of the subject line. - diff --git a/contrib/restricted/boost/beast/CHANGELOG.md b/contrib/restricted/boost/beast/CHANGELOG.md deleted file mode 100644 index bf481e2ca2..0000000000 --- a/contrib/restricted/boost/beast/CHANGELOG.md +++ /dev/null @@ -1,2332 +0,0 @@ -Version 167: - -* Revert: Tidy up calls to post() - --------------------------------------------------------------------------------- - -Version 166: - -* Use boost::is_convertible as a workaround - --------------------------------------------------------------------------------- - -Version 165: - -* Fix BOOST_NO_CXX11_ALLOCATOR check -* Tidy up a warning - --------------------------------------------------------------------------------- - -Version 164: - -* Fix masking on continuation frames -* Add Access-Control-Expose-Headers field constant - --------------------------------------------------------------------------------- - -Version 163: - -* Tidy up calls to post() -* Fix narrowing warnings - --------------------------------------------------------------------------------- - -Version 162: - -* Add asio_handler_invoke overloads for stream algorithms -* Improve websocket::stream::control_callback javadoc - --------------------------------------------------------------------------------- - -Version 161: - -* Don't copy the handler in write_some_op -* Add move-only handler tests -* Fix handler parameter javadocs - --------------------------------------------------------------------------------- - -Version 160: - -* Examples clear the HTTP message before reading - --------------------------------------------------------------------------------- - -Version 159: - -* Fix typo in release notes -* Safe treatment of zero-length string arguments in basic_fields -* Some basic_fields operations now give the strong exception guarantee - --------------------------------------------------------------------------------- - -Version 158: - -* Tidy up end_of_stream javadoc -* Tidy up websocket docs -* Examples set reuse_address(true) -* Advanced servers support clean shutdown via SIGINT or SIGTERM -* DynamicBuffer input areas are not mutable -* Tidy up some documentation - -API Changes: - -* get_lowest_layer is a type alias - -Actions required: - -* Replace instances of `typename get_lowest_layer<T>::type` - with `get_lowest_layer<T>`. - --------------------------------------------------------------------------------- - -Version 157: - -* Fix teardown for TIME_WAIT -* Fix big-endian websocket masking - --------------------------------------------------------------------------------- - -Version 156: - -* Don't use typeid -* Add release notes to documentation -* Fix stale link for void-or-deduced - --------------------------------------------------------------------------------- - -Version 155: - -* Fix memory leak in advanced server examples -* Fix soft-mutex assert in websocket stream -* Fix fallthrough warnings -* Tidy up bind_handler doc - --------------------------------------------------------------------------------- - -Version 154: - -* Type check completion handlers -* bind_handler doc update -* bind_handler works with boost placeholders - --------------------------------------------------------------------------------- - -Version 153: - -* Remove BOOST_VERSION checks -* Use make_error_code for setting an error_code from errc -* Use boost::winapi::GetLastError() consistently -* Update README.md for branches -* Avoid string_view::clear -* Fix iterator version of basic_fields::erase -* Fix use-after-move in example request handlers -* Add Bishop Fox interview media - --------------------------------------------------------------------------------- - -Version 152: - -* Refactor detect_ssl_op -* Disable gdb on Travis for Meltdown - -WebSocket: - -* Redistribute the read tests in the translation units -* Refactor error headers -* Add WebSocket error conditions - -API Changes: - -* Refactor WebSocket errors (API Change): - -Actions Required: - -* Code which explicitly compares error_code values against the - constant `websocket::error::handshake_failed` should compare - against `websocket::condition::handshake_failed` instead. - -* Code which explicitly compares error_code values against the - constant `websocket::error::failed` should compare - against `websocket::condition::protocol_violation` instead. - --------------------------------------------------------------------------------- - -Version 151: - -* Sanitizer failures are errors -* Depend on container_hash -* Fix high-ASCII in source file - -WebSocket: - -* Control callback is invoked on the execution context -* Add stream_fwd.hpp -* Remove unnecessary include - -API Changes: - -* http::parser is not MoveConstructible -* permessage-deflate is a compile-time feature - --------------------------------------------------------------------------------- - -Version 150: - -* handler_ptr tests -* Documentation - -API Changes: - -* serializer::reader_impl is deprecated - -Actions Required: - -* Call serializer::writer_impl instead of reader_impl - --------------------------------------------------------------------------------- - -Version 149: - -* built-in r-value return values can't be assigned -* Tidy up ssl_stream special members -* Fix CMakeLists.txt variable -* Protect calls from macros -* pausation always allocates -* Don't copy completion handlers -* handler_ptr is move-only -* Fix Travis memory utilization - -API Changes: - -* handler_ptr gives the strong exception guarantee - -Actions Required: - -* Change the constructor signature for state objects - used with handler_ptr to receive a const reference to - the handler. - --------------------------------------------------------------------------------- - -Version 148: - -* Install codecov on codecov CI targets only -* Update reports for hybrid assessment -* Handle invalid deflate frames - --------------------------------------------------------------------------------- - -Version 147: - -* Don't use boost::string_ref -* Use iterator wrapper in detail::buffers_range - -HTTP: - -* Tidy up basic_fields exception specifiers - -WebSocket: - -* control callback is copied or moved -* Send idle pings in advanced servers - --------------------------------------------------------------------------------- - -Version 146: - -* Fix some typos -* Faster ascii_tolower -* Documentation tidying -* Fix typo in examples documentation -* Add detail::aligned_union and tidy up -* Use variant in buffers_cat_view - -API Changes: - -* Remove unintended public members of handler_ptr - --------------------------------------------------------------------------------- - -Version 145: - -* Rename some detail functions -* Refactor basic_fields allocator internals -* Refactor HTTP async read composed operations -* null_buffers is deprecated -* Version 124 works with Boost 1.65.1 and earlier -* basic_fields does not support fancy pointers - --------------------------------------------------------------------------------- - -Version 144-hf1: - -* Update reports for hybrid assessment -* Handle invalid deflate frames -* Install codecov on codecov CI targets only - --------------------------------------------------------------------------------- - -Version 144: - -* Fix websocket permessage-deflate negotiation - --------------------------------------------------------------------------------- - -Version 143: - -* Fix autobahn report link - --------------------------------------------------------------------------------- - -Version 142: - -* Warn about upcoming API changes to certain concepts -* Fix name typo in http write test - --------------------------------------------------------------------------------- - -Version 141: - -* Tidy up some documentation - --------------------------------------------------------------------------------- - -Version 140: - -* Fix some integer warnings in 64-bit builds -* Fix utf8_checker test failures -* Fix signature for async_read_some, and tests -* Tidy up basic_parser -* Some basic_fields special members are protected - --------------------------------------------------------------------------------- - -Version 139: - -* Revisit boost library min/max guidance - --------------------------------------------------------------------------------- - -Version 138: - -* Tidy up some documentation - --------------------------------------------------------------------------------- - -Version 137: - -* ConstBufferSequence mandates pointer equivalence -* Add FieldsWriter constructor requirement -* Tidy up some documented constructor syntax - --------------------------------------------------------------------------------- - -Version 136: - -* Tidy up message doc image - --------------------------------------------------------------------------------- - -Version 135: - -* Fix typo in example server help text - --------------------------------------------------------------------------------- - -Version 134: - -* Add static_buffer_base default constructor definition - --------------------------------------------------------------------------------- - -Version 133: - -* Remove const&& overload of message::body - --------------------------------------------------------------------------------- - -Version 132: - -* Tidy up project folders in CMakeLists.txt -* Rename Cmake variables for clarity -* Add ref-qualified overloads for message::body -* Tidy up FieldsReader doc - -API Changes: - -* Fields::writer replaces Fields::reader -* BodyReader and BodyWriter names are swapped - -Actions Required: - -* Rename reader to writer for user defined Fields -* Swap the reader and writer names for user defined Body types -* Swap use of is_body_reader and is_body_writer - --------------------------------------------------------------------------------- - -Version 131: - -* basic_fields returns const values -* Set SNI hostname in example SSL clients - --------------------------------------------------------------------------------- - -Version 130: - -* Tidy up fallthrough warning -* Remove cxx11_sfinae_expr build requirement from tests - --------------------------------------------------------------------------------- - -Version 129: - -* Add autobahn test report to doc -* Documentation tidying -* Fix prepare_payload: chunked is HTTP/1.1 - --------------------------------------------------------------------------------- - -Version 128: - -* Update doc links -* Add explicit-failures-markup.xml - -HTTP: - -* Add message::need_eof -* Use message::need_eof in example servers -* Use synchronous writes in chunk output example - -WebSocket: - -* Fix utf8 validation for autobahn -* Temporarily disable utf8 validation tests -* Tidy up fast websocket server host names - -API Changes: - -* Remove serializer::keep_alive -* Remove serializer::chunked -* Add has_content_length_impl to Fields -* Add message::has_content_length -* Rename some basic_parser observers - -Actions Required: - -* Call message::keep_alive instead of serializer::keep_alive -* Call serializer::get::chunked instead of serializer::chunked -* Implement has_content_length_impl for user-defined Fields -* Remove the "is_" prefix from call sites invoking certain basic_parser members - --------------------------------------------------------------------------------- - -Version 127: - -* Add BOOST_BEAST_NO_POSIX_FADVISE -* Version command line option for HTTP client examples -* More Jamfile compiler requirements for tests - --------------------------------------------------------------------------------- - -Version 126: - -* Add CppCon2017 presentation link -* Update README.md -* Update stream write documentation for end of stream changes -* Tidy up unused variable warnings -* Don't return end_of_stream on win32 file body writes -* Fix doc typo -* Fix shadowing in session_alloc -* Fix executor type compilation -* Add Travis tests with the default compilers -* Update Boost.WinAPI usage to the new location and namespace. -* Fix buffered_read_stream async_read_some signature - --------------------------------------------------------------------------------- - -Version 125: - -API Changes: - -* Update for Net-TS Asio - -Actions Required: - -* Use BOOST_ASIO_HANDLER_TYPE instead of handler_type -* Use BOOST_ASIO_INITFN_RESULT_TYPE instead of async_result -* Use boost::asio::async_completion -* Use boost::asio::is_dynamic_buffer -* Use boost::asio::is_const_buffer_sequence -* Use boost::asio::is_mutable_buffer_sequence -* boost::asio::associated_allocator_t replaces handler_alloc - --------------------------------------------------------------------------------- - -Version 124: - -* Fix for a test matrix compiler -* Fix basic_fields javadoc - -API Changes: - -* http write returns success on connection close - -Actions Required: - -* Add code to servers to close the connection after successfully - writing a message where `message::keep_alive()` would return `false`. - --------------------------------------------------------------------------------- - -Version 123: - -* Use unit-test subtree -* Fix spurious race in websocket close test -* Check compiler feature in Jamfile -* Clear previous message fields in parser - --------------------------------------------------------------------------------- - -Version 122: - -* Add test for issue 807 -* assert on empty buffer in websocket read -* Fix zlib symbol conflicts -* CMake 3.5.1 is required -* config.hpp is not a public header -* Add missing case in error test - --------------------------------------------------------------------------------- - -Version 121: - -* Add test for issue 802 -* Fix enum and non-enum in conditional exp. warning - --------------------------------------------------------------------------------- - -Version 120: - -* Fix spurious strand_ in advanced_server_flex -* OpenSSL targets are optional (CMake) - --------------------------------------------------------------------------------- - -Version 119: - -* Tidy up doc badge links - --------------------------------------------------------------------------------- - -Version 118: - -* file_win32 opens for read-only in shared mode -* Remove unused strands in server examples -* Update build instructions -* Doc root is at index.html - -HTTP: - -* Fix writing header into std::ostream - --------------------------------------------------------------------------------- - -Version 117: - -* Add buffers_to_string - -API Changes: - -* buffers_suffix replaces consuming_buffers -* buffers_prefix replaces buffer_prefix -* buffers_prefix_view replaces buffer_prefix_view -* buffers_front replaces buffer_front -* buffers_cat replaces buffer_cat -* buffers_cat_view replaces buffer_cat_view -* Remove buffers_suffix::get - -Actions Required: - -* Use buffers_suffix instead of consuming_buffers -* Use buffers_prefix instead of buffer_prefix -* Use buffers_prefix_view instead of buffer_prefix_view -* Use buffers_front instead of buffer_front -* Use buffers_cat instead of buffer_cat -* Use buffers_cat_view instead of buffer_cat_view -* Avoid calling buffers_suffix::get - --------------------------------------------------------------------------------- - -Version 116: - -API Changes: - -* message::body is a member function -* message::version is a member function - -Actions Required: - -* Call member function message::body instead of accessing - the data member at call sites. - -* Call member function message::version instead of accessing - the version member at call sites. - --------------------------------------------------------------------------------- - -Version 115: - -* Update README.md master doc link - --------------------------------------------------------------------------------- - -Version 114: - -(No changes) - --------------------------------------------------------------------------------- - -Version 113: - -* Fix handler signature in async_read_header -* Remove field_range copy constructor - --------------------------------------------------------------------------------- - -Version 112: - -* Update websocket notes - -API Changes: - -* WebSocket writes return the bytes transferred - -* HTTP reads and writes return bytes transferred - -Actions Required: - -* Modify websocket write completion handlers to receive - the extra std::size_t bytes_transferred parameter. - -* Modify HTTP read and/or write completion handlers to - receive the extra std::size_t bytes_transferred parameter. - --------------------------------------------------------------------------------- - -Version 111: - -WebSocket: - -* Fix utf8 check split code point at buffer end -* Refactor stream operations and tests plus coverage -* Suspended ops special members - --------------------------------------------------------------------------------- - -Version 110: - -* Refactor stream open state variable -* Refactor websocket stream members -* Refactor websocket stream: fixes and tests -* Add test::stream::lowest_layer -* Fix invalid iterator in test reporter - --------------------------------------------------------------------------------- - -Version 109: - -* refactor test::stream - -WebSocket: - -* Fix async_read_some handler signature -* websocket close fixes and tests -* websocket handshake uses coroutine -* websocket ping tests -* Fix websocket close_op resume state -* websocket write tests -* split up websocket tests -* websocket read tests - -API Changes: - -* websocket accept refactoring - -Actions Required: - -* Do not call websocket accept overloads which take - both a message and a buffer sequence, as it is - illegal per rfc6455. - --------------------------------------------------------------------------------- - -Version 108: - -* Fix argument parsing in HTTP examples -* Don't use async_write_msg in examples - --------------------------------------------------------------------------------- - -Version 107: - -* Use test::stream - -WebSocket - -* Fix done state for WebSocket reads -* Fix utf8 check for compressed frames -* Rename frame and header buffer types - --------------------------------------------------------------------------------- - -Version 106: - -* Dynamic buffer input areas are mutable -* Add flat_static_buffer::reset - -HTTP: - -* Fix for basic_parser::skip(true) and docs - -WebSocket: - -* websocket test improvements -* Remove obsolete write_op -* Refactor write_op -* Refactor ping_op -* Refactor fail_op -* Refactor read_op -* Refactor close_op -* Refactor read_op + fail_op -* Websocket close will automatically drain -* Autobahn|Testsuite fixes -* Tidy up utf8_checker and tests - --------------------------------------------------------------------------------- - -Version 105: - -* Fix compile error in websocket snippet -* Tidy up Jamfile and tests - --------------------------------------------------------------------------------- - -Version 104: - -* Remove unused include -* Use #error in config.hpp -* Only set -std=c++11 on Travis -* Only set /permissive- on Appveyor -* Tidy up some test warnings -* tools/ renamed from build/ - -WebSocket: - -* Fix pausation::save - --------------------------------------------------------------------------------- - -Version 103: - -* Boost test matrix fixes -* Tidy up allocator usage -* Example HTTP server fixes - --------------------------------------------------------------------------------- - -Version 102: - -* Section headings in examples - --------------------------------------------------------------------------------- - -Version 101: - -* Refactor all examples - --------------------------------------------------------------------------------- - -Version 100: - -* Fix doc convenience includes -* Fix doc includes -* Remove unused test header -* Rename test macros -* Reorder define test macro params -* vcxproj workaround for include symlinks -* Add variadic min/max - -WebSocket: - -* Remove obsolete frame tests -* Refactor fail/clode code -* Call do_fail from read_some -* eof on accept returns error::closed -* Fix stream::read_size_hint calculation -* Documentation - -API Changes: - -* Calls to stream::close and stream::async_close will - automatically perform the required read operations - -* drain_buffer is removed - -* role_type replaces teardown_tag - -Actions Required: - -* Remove calling code which drains the connection after - calling stream::close or stream::async_close - -* Replace code which uses drain_buffer. For websocket::stream, - it is no longer necessary to manually drain the connection - after closing. - -* Modify signatures of teardown and async_teardown to use - role_type instead of teardown_tag - -* Change calls to teardown and async_teardown to pass the - correct role_type, client or server, depending on context. - --------------------------------------------------------------------------------- - -Version 99: - -* Log the value of LIB_DIR for doc builds (debug) -* Use correct handler signature in fail_op -* Fix doc typo - --------------------------------------------------------------------------------- - -Version 98: - -* basic_fields::key_compare is noexcept -* Fix bench-zlib cmake -* Use unique names Jam projects -* Trim utf8 checker test - --------------------------------------------------------------------------------- - -Version 97: - -* Update redirect - --------------------------------------------------------------------------------- - -Version 96: - -* Move bench/ to test/ -* Move extras/ to test/ -* Use <valgrind> property -* Rename wsload compile target -* Fix library.json -* Update boostorg links -* Add bench-zlib -* Faster zlib tests -* Less compression on websocket test - --------------------------------------------------------------------------------- - -Version 95: - -* Tidy up Travis build scripts -* Move scripts to build/ -* Fix race in test::pipe -* close on test::pipe teardown -* Add test::stream -* Tidy up static_buffer braced init -* Fix html redirect -* Add valgrind variant, fix false positives - --------------------------------------------------------------------------------- - -Version 94: - -* Use off-site Quick Start link temporarily - --------------------------------------------------------------------------------- - -Version 93: - -* Unset BOOST_COROUTINES_NO_DEPRECATION_WARNING - --------------------------------------------------------------------------------- - -Version 92: - -* Fix typo in test/CMakeLists.txt -* basic_fields::value_type is not copyable -* Update repository links in source comments -* Ignore Content-Length in some cases -* Tidy up doc snippet paths -* Use off-site doc link - --------------------------------------------------------------------------------- - -Version 91: - -* Adjust redirect html -* Don't build pre-C++11 -* source.dox is path-independent -* Tidy up namespace qualifiers -* Tidy up MSVC CMakeLists.txt -* Optimize buffered_read_stream -* constexpr in derived buffers -* Set BOOST_ASIO_NO_DEPRECATED -* Use Asio array optimization in static_buffer_base -* Rename wstest source file -* Use fopen_s on Windows -* Fix Appveyor script -* Update project metadata -* Move benchmarks to bench/ -* Fix doc title -* Build stand-alone doc -* Update doc copyrights -* Refactor test build scripts - -WebSocket: - -* Tidy up websocket javadocs -* Refactor accept, handshake ops -* Use read buffer instead of buffered stream - -API Changes - -* control frame callbacks are non-const references - -Actions Required: - -* Modify calls to set the control frame callback, to - pass non-const reference instances, and manage the - lifetime of the instance. - --------------------------------------------------------------------------------- - -Version 90: - -* Fix websocket read of zero length message -* Fix typo in equal_range -* Output to integrated documentation - --------------------------------------------------------------------------------- - -Version 89: - -* Fix CONTRIBUTING.md links - --------------------------------------------------------------------------------- - -Version 88: - -* Update doc links in README.md -* Refactor tests Jamfile -* Don't use program_options - -WebSocket: - -* Fix uninitialized frame done - --------------------------------------------------------------------------------- - -Version 87: - -* Update appveyor for Boost branch -* Rename to BEAST_EXPECT -* variant fixes and tests -* Update README, add CONTRIBUTING.md and CODE_OF_CONDUCT.md - --------------------------------------------------------------------------------- - -Version 86: - -* Boost prep -* Remove use of lexical_cast -* Use custom variant -* Update README.md -* Add local-travis.sh -* Use winapi -* Update CMakeLists.txt for boost -* Update documentation for boost -* Update copyrights -* Remove spurious declaration -* Tidy up Jamfile -* Normalize doc build scripts -* Use configured doxygen and xsltproc -* Fix Deferred Body Type Example Documentation -* Add library metadata - -API Changes: - -* websocket read returns the number of bytes inserted - -Actions Required: - -* Change the signature of completion handlers used with - websocket::stream::async_read to void(error_code, std::size_t) - --------------------------------------------------------------------------------- - -Version 85: - -* Fix test failure -* Tidy up test warning - --------------------------------------------------------------------------------- - -Version 84: - -* Tidy up buffer_front -* static_buffer::consume improvement -* multi_buffer is type-check friendly -* bind_handler allows placeholders -* Add consuming_buffers::get - -WebSocket: - -* WebSocket read optimization - -API Changes: - -* websocket::stream::read_buffer_size is removed - -Actions Required: - -* Remove calls websocket::stream::read_buffer_size -* Use read_some and write_some instead of read_frame and write_frame - --------------------------------------------------------------------------------- - -Version 83: - -* Add flat_static_buffer::mutable_data -* Add buffer_front -* Add wstest compression option -* Turn some flat_static_buffer_tests on -* Documentation work -* read_some, async_read_some return bytes used -* Fix private timer::clock_type - -WebSocket - -* Add wstest compression option -* Fix buffer lifetime in websocket write - -API Changes: - -* Add static_buffer - -Actions Required: - -* Callers who depend on static_buffer returning sequences of - exactly length one should switch to flat_static_buffer. - --------------------------------------------------------------------------------- - -Version 82: - -* Documentation tidying -* is_invocable works with move-only types -* Use std::function and reference wrapper -* Add session_alloc to example/common -* Silence spurious warning - -HTTP - -* Fix extraneous argument in async_write_header - -WebSocket - -* stream tidying -* Add rd_close_ to websocket stream state -* stream uses flat_buffer -* accept requires a message -* Add wstest benchmark tool - -API Changes: - -* Rename to flat_static_buffer and flat_static_buffer_base - -Actions Required: - -* Rename static_buffer to flat_static_buffer_base -* Rename static_buffer_n to flat_static_buffer - --------------------------------------------------------------------------------- - -Version 81: - -* Pass string_view by value -* better is_final on empty_base_optimization -* Suppress incorrect GCC warning -* multi_buffer ctor is explicit -* File is not copy-constructible - -API Changes: - -* Refactor basic_parser, chunk parsing: - -Actions Required: - -* Adjust signatures for required members of user-defined - subclasses of basic_parser - -* Use the new basic_parser chunk callbacks for accessing - chunk extensions and chunk bodies. - --------------------------------------------------------------------------------- - -Version 80: - -* Javadoc tidying -* Add basic_dynamic_body.hpp -* Shrink buffer_prefix_view -* Remove unused file_path -* Add basic_file_body.hpp -* buffers_ref is Assignable - -HTTP - -* Shrink chunk header buffer sequence size - -API Changes: - -* Refactor chunked-encoding serialization - -Actions Required: - -* Remove references to ChunkDecorators. Use the new chunk-encoding - buffer sequences to manually produce a chunked payload body in - the case where control over the chunk-extensions and/or trailers - is required. - --------------------------------------------------------------------------------- - -Version 79: - -* Remove spurious fallthrough guidance - --------------------------------------------------------------------------------- - -Version 78: - -* Add span -* Documentation work -* Use make_unique_noinit -* Fix warning in zlib -* Header file tidying -* Tidy up FieldsReader doc -* Add Boost.Locale utf8 benchmark comparison -* Tidy up dstream for existing Boost versions -* Tidy up file_posix unused variable -* Fix warning in root ca declaration - -HTTP: - -* Tidy up basic_string_body -* Add vector_body -* span, string, vector bodies are public -* Fix spurious uninitialized warning -* fields temp string uses allocator - -API Changes: - -* Add message::keep_alive() -* Add message::chunked() and message::content_length() -* Remove string_view_body - -Actions Required: - -* Change user defined implementations of Fields and - FieldsReader to meet the new requirements. - -* Use span_body<char> instead of string_view_body - --------------------------------------------------------------------------------- - -Version 77: - -* file_posix works without large file support - --------------------------------------------------------------------------------- - -Version 76: - -* Always go through write_some -* Use Boost.Config -* BodyReader may construct from a non-const message -* Add serializer::get -* Add serializer::chunked -* Serializer members are not const -* serializing file_body is not const -* Add file_body_win32 -* Fix parse illegal characters in obs-fold -* Disable SSE4.2 optimizations - -API Changes: - -* Rename to serializer::keep_alive -* BodyReader, BodyWriter use two-phase init - -Actions Required: - -* Use serializer::keep_alive instead of serializer::close and - take the logical NOT of the return value. - -* Modify instances of user-defined BodyReader and BodyWriter - types to perfrom two-phase initialization, as per the - updated documented type requirements. - --------------------------------------------------------------------------------- - -Version 75: - -* Use file_body for valid requests, string_body otherwise. -* Construct buffer_prefix_view in-place -* Shrink serializer buffers using buffers_ref -* Tidy up BEAST_NO_BIG_VARIANTS -* Shrink serializer buffers using buffers_ref -* Add serializer::limit -* file_body tests -* Using SSE4.2 intrinsics in basic_parser if available - --------------------------------------------------------------------------------- - -Version 74: - -* Add file_stdio and File concept -* Add file_win32 -* Add file_body -* Remove common/file_body.hpp -* Add file_posix -* Fix Beast include directories for cmake targets -* remove redundant flush() from example - --------------------------------------------------------------------------------- - -Version 73: - -* Jamroot tweak -* Verify certificates in SSL clients -* Adjust benchmarks -* Initialize local variable in basic_parser -* Fixes for gcc-4.8 - -HTTP: - -* basic_parser optimizations -* Add basic_parser tests - -API Changes: - -* Refactor header and message constructors -* serializer::next replaces serializer::get - -Actions Required: - -* Evaluate each message constructor call site and - adjust the constructor argument list as needed. - -* Use serializer::next instead of serializer::get at call sites - --------------------------------------------------------------------------------- - -Version 72: - -HTTP: - -* Tidy up set payload in http-server-fast -* Refine Body::size specification -* Newly constructed responses have a 200 OK result -* Refactor file_body for best practices -* Add http-server-threaded example -* Documentation tidying -* Various improvements to http_server_fast.cpp - -WebSocket: - -* Add websocket-server-async example - --------------------------------------------------------------------------------- - -Version 71: - -* Fix extra ; warning -* Documentation revision -* Fix spurious on_chunk invocation -* Call prepare_payload in HTTP example -* Check trailers in test -* Fix buffer overflow handling for string_body and mutable_body -* Concept check in basic_dynamic_body -* Tidy up http_sync_port error check -* Tidy up Jamroot /permissive- - -WebSockets: - -* Fine tune websocket op asserts -* Refactor websocket composed ops -* Allow close, ping, and write to happen concurrently -* Fix race in websocket read op -* Fix websocket write op -* Add cmake options for examples and tests - -API Changes: - -* Return `std::size_t` from `Body::writer::put` - -Actions Required: - -* Return the number of bytes actually transferred from the - input buffers in user defined `Body::writer::put` functions. - --------------------------------------------------------------------------------- - -Version 70: - -* Serialize in one step when possible -* Add basic_parser header and body limits -* Add parser::on_header to set a callback -* Fix BEAST_FALLTHROUGH -* Fix HEAD response in file_service - -API Changes: - -* Rename to message::base -* basic_parser default limits are now 1MB/8MB - -Actions Required: - -* Change calls to message::header_part() with message::base() - -* Call body_limit and/or header_limit as needed to adjust the - limits to suitable values if the defaults are insufficient. - --------------------------------------------------------------------------------- - -Version 69: - -* basic_parser optimizations -* Use BEAST_FALLTHROUGH to silence warnings -* Add /permissive- to msvc toolchain - --------------------------------------------------------------------------------- - -Version 68: - -* Split common tests to a new project -* Small speed up in fields comparisons -* Adjust buffer size in fast server -* Use string_ref in older Boost versions -* Optimize field lookups -* Add const_body, mutable_body to examples -* Link statically on cmake MSVC - -API Changes: - -* Change BodyReader, BodyWriter requirements -* Remove BodyReader::is_deferred -* http::error::bad_target replaces bad_path - -Actions Required: - -* Change user defined instances of BodyReader and BodyWriter - to meet the new requirements. - -* Replace references to http::error::bad_path with http::error::bad_target - --------------------------------------------------------------------------------- - -Version 67: - -* Fix doc example link -* Add http-server-small example -* Merge stream_base to stream and tidy -* Use boost::string_view -* Rename to http-server-fast -* Appveyor use Boost 1.64.0 -* Group common example headers - -API Changes: - -* control_callback replaces ping_callback - -Actions Required: - -* Change calls to websocket::stream::ping_callback to use - websocket::stream::control_callback - -* Change user defined ping callbacks to have the new - signature and adjust the callback definition appropriately. - --------------------------------------------------------------------------------- - -Version 66: - -* string_param optimizations -* Add serializer request/response aliases -* Make consuming_buffers smaller -* Fix costly potential value-init in parser -* Fix unused parameter warning -* Handle bad_alloc in parser -* Tidy up message piecewise ctors -* Add header aliases -* basic_fields optimizations -* Add http-server example -* Squelch spurious warning on gcc - --------------------------------------------------------------------------------- - -Version 65: - -* Enable narrowing warning on msvc cmake -* Fix integer types in deflate_stream::bi_reverse -* Fix narrowing in static_ostream -* Fix narrowing in ostream -* Fix narrowing in inflate_stream -* Fix narrowing in deflate_stream -* Fix integer warnings -* Enable unused variable warning on msvc cmake - --------------------------------------------------------------------------------- - -Version 64: - -* Simplify buffered_read_stream composed op -* Simplify ssl teardown composed op -* Simplify websocket write_op -* Exemplars are compiled code -* Better User-Agent in examples -* async_write requires a non-const message -* Doc tidying -* Add link_directories to cmake - -API Changes: - -* Remove make_serializer - -Actions Required: - -* Replace calls to make_serializer with variable declarations - --------------------------------------------------------------------------------- - -Version 63: - -* Use std::to_string instead of lexical_cast -* Don't use cached Boost -* Put num_jobs back up on Travis -* Only build and run tests in variant=coverage -* Move benchmarks to a separate project -* Only run the tests under ubasan -* Tidy up CMakeLists.txt -* Tidy up Jamfiles -* Control running with valgrind explicitly - --------------------------------------------------------------------------------- - -Version 62: - -* Remove libssl-dev from a Travis matrix item -* Increase detail::static_ostream coverage -* Add server-framework tests -* Doc fixes and tidy -* Tidy up namespaces in examples -* Clear the error faster -* Avoid explicit operator bool for error -* Add http::is_fields trait -* Squelch harmless not_connected errors -* Put slow tests back for coverage builds - -API Changes: - -* parser requires basic_fields -* Refine FieldsReader concept -* message::prepare_payload replaces message::prepare - -Actions Required: - -* Callers using `parser` with Fields types other than basic_fields - will need to create their own subclass of basic_parser to work - with their custom fields type. - -* Implement chunked() and keep_alive() for user defined FieldsReader types. - -* Change calls to msg.prepare to msg.prepare_payload. For messages - with a user-defined Fields, provide the function prepare_payload_impl - in the fields type according to the Fields requirements. - --------------------------------------------------------------------------------- - -Version 61: - -* Remove Spirit dependency -* Use generic_cateogry for errno -* Reorganize SSL examples -* Tidy up some integer conversion warnings -* Add message::header_part() -* Tidy up names in error categories -* Flush the output stream in the example -* Clean close in Secure WebSocket client -* Add server-framework SSL HTTP and WebSocket ports -* Fix shadowing warnings -* Tidy up http-crawl example -* Add multi_port to server-framework -* Tidy up resolver calls -* Use one job on CI -* Don't run slow tests on certain targets - -API Changes: - -* header::version is unsigned -* status-codes is unsigned - --------------------------------------------------------------------------------- - -Version 60: - -* String comparisons are public interfaces -* Fix response message type in async websocket accept -* New server-framework, full featured server example - --------------------------------------------------------------------------------- - -Version 59: - -* Integrated Beast INTERFACE (cmake) -* Fix base64 alphabet -* Remove obsolete doc/README.md - -API Changes: - -* Change Body::size signature (API Change): - -Actions Required: - -* For any user-defined models of Body, change the function signature - to accept `value_type const&` and modify the function definition - accordingly. - --------------------------------------------------------------------------------- - -Version 58: - -* Fix unaligned reads in utf8-checker -* Qualify size_t in message template -* Reorganize examples -* Specification for http read -* Avoid `std::string` in websocket -* Fix basic_fields insert ordering -* basic_fields::set optimization -* basic_parser::put doc -* Use static string in basic_fields::reader -* Remove redundant code -* Fix parsing chunk size with leading zeroes -* Better message formal parameter names - -API Changes: - -* `basic_fields::set` renamed from `basic_fields::replace` - -Actions Required: - -* Rename calls to `basic_fields::replace` to `basic_fields::set` - --------------------------------------------------------------------------------- - -Version 57: - -* Fix message.hpp javadocs -* Fix warning in basic_parser.cpp -* Integrate docca for documentation and tidy - --------------------------------------------------------------------------------- - -Version 56: - -* Add provisional IANA header field names -* Add string_view_body -* Call on_chunk when the extension is empty -* HTTP/1.1 is the default version -* Try harder to find Boost (cmake) -* Reset error codes -* More basic_parser tests -* Add an INTERFACE cmake target -* Convert buffer in range loops - --------------------------------------------------------------------------------- - -Version 55: - -* Don't allocate memory to handle obs-fold -* Avoid a parser allocation using non-flat buffer -* read_size replaces read_size_helper - --------------------------------------------------------------------------------- - -Version 54: - -* static_buffer coverage -* flat_buffer coverage -* multi_buffer coverage -* consuming_buffers members and coverage -* basic_fields members and coverage -* Add string_param -* Retain ownership when reading using a message -* Fix incorrect use of [[fallthrough]] - -API Changes: - -* basic_fields refactor - --------------------------------------------------------------------------------- - -Version 53: - -* Fix basic_parser::maybe_flatten -* Fix read_size_helper usage - --------------------------------------------------------------------------------- - -Version 52: - -* flat_buffer is an AllocatorAwareContainer -* Add drain_buffer class - -API Changes: - -* `auto_fragment` is a member of `stream` -* `binary`, `text` are members of `stream` -* read_buffer_size is a member of `stream` -* read_message_max is a member of `stream` -* `write_buffer_size` is a member of `stream` -* `ping_callback` is a member of stream -* Remove `opcode` from `read`, `async_read` -* `read_frame` returns `bool` fin -* `opcode` is private -* finish(error_code&) is a BodyReader requirement - -Actions Required: - -* Change call sites which use `auto_fragment` with `set_option` - to call `stream::auto_fragment` instead. - -* Change call sites which use message_type with `set_option` - to call `stream::binary` or `stream::text` instead. - -* Change call sites which use `read_buffer_size` with `set_option` to - call `stream::read_buffer_size` instead. - -* Change call sites which use `read_message_max` with `set_option` to - call `stream::read_message_max` instead. - -* Change call sites which use `write_buffer_size` with `set_option` to - call `stream::write_buffer_size` instead. - -* Change call sites which use `ping_callback1 with `set_option` to - call `stream::ping_callback` instead. - -* Remove the `opcode` reference parameter from calls to synchronous - and asynchronous read functions, replace the logic with calls to - `stream::got_binary` and `stream::got_text` instead. - -* Remove the `frame_info` parameter from all read frame call sites - -* Check the return value 'fin' for calls to `read_frame` - -* Change ReadHandlers passed to `async_read_frame` to have - the signature `void(error_code, bool fin)`, use the `bool` - to indicate if the frame is the last frame. - -* Remove all occurrences of the `opcode` enum at call sites - --------------------------------------------------------------------------------- - -Version 51 - -* Fix operator<< for header -* Tidy up file_body -* Fix file_body::get() not setting the more flag correctly -* Use BOOST_FALLTHROUGH -* Use BOOST_STRINGIZE -* DynamicBuffer benchmarks -* Add construct, destroy to handler_alloc -* Fix infinite loop in basic_parser - -API Changes: - -* Tune up static_buffer -* multi_buffer implementation change - -Actions Required: - -* Call sites passing a number to multi_buffer's constructor - will need to be adjusted, see the corresponding commit message. - --------------------------------------------------------------------------------- - -Version 50 - -* parser is constructible from other body types -* Add field enumeration -* Use allocator more in basic_fields -* Fix basic_fields allocator awareness -* Use field in basic_fields and call sites -* Use field in basic_parser -* Tidy up basic_fields, header, and field concepts -* Fields concept work -* Body documentation work -* Add missing handler_alloc nested types -* Fix chunk delimiter parsing -* Fix test::pipe read_size -* Fix chunk header parsing - -API Changes: - -* Remove header_parser -* Add verb to on_request for parsers -* Refactor prepare -* Protect basic_fields special members -* Remove message connection settings -* Remove message free functions -* Remove obsolete serializer allocator -* http read_some, async_read_some don't return bytes - --------------------------------------------------------------------------------- - -Version 49 - -* Use <iosfwd> instead of <ostream> - -HTTP: - -* Add HEAD request example - -API Changes: - -* Refactor method and verb -* Canonicalize string_view parameter types -* Tidy up empty_body writer error -* Refactor header status, reason, and target - --------------------------------------------------------------------------------- - -Version 48 - -* Make buffer_prefix_view public -* Remove detail::sync_ostream -* Tidy up core type traits - -API Changes: - -* Tidy up chunk decorator -* Rename to buffer_cat_view -* Consolidate parsers to parser.hpp -* Rename to parser - --------------------------------------------------------------------------------- - -Version 47 - -* Disable operator<< for buffer_body -* buffer_size overload for basic_multi_buffer::const_buffers_type -* Fix undefined behavior in pausation -* Fix leak in basic_flat_buffer - -API Changes: - -* Refactor treatment of request-method -* Refactor treatment of status code and obsolete reason -* Refactor HTTP serialization and parsing - --------------------------------------------------------------------------------- - -Version 46 - -* Add test::pipe -* Documentation work - -API Changes: - -* Remove HTTP header aliases -* Refactor HTTP serialization -* Refactor type traits - --------------------------------------------------------------------------------- - -Version 45 - -* Workaround for boost::asio::basic_streambuf type check -* Fix message doc image -* Better test::enable_yield_to -* Fix header::reason -* Documentation work -* buffer_view skips empty buffer sequences -* Disable reverse_iterator buffer_view test - --------------------------------------------------------------------------------- - -Version 44 - -* Use BOOST_THROW_EXCEPTION -* Tidy up read_size_helper and dynamic buffers -* Require Boost 1.58.0 or later -* Tidy up and make get_lowest_layer public -* Use BOOST_STATIC_ASSERT -* Fix async return values in docs -* Fix README websocket example -* Add buffers_adapter regression test -* Tidy up is_dynamic_buffer traits test -* Make buffers_adapter meet requirements - --------------------------------------------------------------------------------- - -Version 43 - -* Require Boost 1.64.0 -* Fix strict aliasing warnings in buffers_view -* Tidy up buffer_prefix overloads and test -* Add write limit to test::string_ostream -* Additional constructors for consuming_buffers - --------------------------------------------------------------------------------- - -Version 42 - -* Fix javadoc typo -* Add formal review notes -* Make buffers_view a public interface - --------------------------------------------------------------------------------- - -Version 41 - -* Trim Appveyor matrix rows -* Concept revision and documentation -* Remove coveralls integration -* Tidy up formal parameter names - -WebSocket - -* Tidy up websocket::close_code enum and constructors - -API Changes - -* Return http::error::end_of_stream on HTTP read eof -* Remove placeholders -* Rename prepare_buffer(s) to buffer_prefix -* Remove handler helpers, tidy up hook invocations - --------------------------------------------------------------------------------- - -Version 40 - -* Add to_static_string -* Consolidate get_lowest_layer in type_traits.hpp -* Fix basic_streambuf movable trait -* Tidy up .travis.yml - --------------------------------------------------------------------------------- - -Version 39 - -Beast versions are now identified by a single integer which -is incremented on each merge. The macro BEAST_VERSION -identifies the version number, currently at 39. A version -setting commit will always be at the tip of the master -and develop branches. - -* Use beast::string_view alias -* Fixed braced-init error with older gcc - -HTTP - -* Tidy up basic_parser javadocs - -WebSocket: - -* Add websocket async echo ssl server test: -* Fix eof error on ssl::stream shutdown - -API Changes: - -* Refactor http::header contents -* New ostream() returns dynamic buffer output stream -* New buffers() replaces to_string() -* Rename to multi_buffer, basic_multi_buffer -* Rename to flat_buffer, basic_flat_buffer -* Rename to static_buffer, static_buffer_n -* Rename to buffered_read_stream -* Harmonize concepts and identifiers with net-ts -* Tidy up HTTP reason_string - --------------------------------------------------------------------------------- - -1.0.0-b38 - -* Refactor static_string -* Refactor base64 -* Use static_string for WebSocket handshakes -* Simplify get_lowest_layer test -* Add test_allocator to extras/test -* More flat_streambuf tests -* WebSocket doc work -* Prevent basic_fields operator[] assignment - -API Changes: - -* Refactor WebSocket error codes -* Remove websocket::keep_alive option - --------------------------------------------------------------------------------- - -1.0.0-b37 - -* CMake hide command lines in .vcxproj Output windows" -* Rename to detail::is_invocable -* Rename project to http-bench -* Fix flat_streambuf -* Add ub sanitizer blacklist -* Add -funsigned-char to asan build target -* Fix narrowing warning in table constants - -WebSocket: - -* Add is_upgrade() free function -* Document websocket::stream thread safety -* Rename to websocket::detail::pausation - -API Changes: - -* Provide websocket::stream accept() overloads -* Refactor websocket decorators -* Move everything in basic_fields.hpp to fields.hpp -* Rename to http::dynamic_body, consolidate header - --------------------------------------------------------------------------------- - -1.0.0-b36 - -* Update README.md - --------------------------------------------------------------------------------- - -1.0.0-b35 - -* Add Appveyor build scripts and badge -* Tidy up MSVC CMake configuration -* Make close_code a proper enum -* Add flat_streambuf -* Rename to BEAST_DOXYGEN -* Update .gitignore for VS2017 -* Fix README.md CMake instructions - -API Changes: - -* New HTTP interfaces -* Remove http::empty_body - --------------------------------------------------------------------------------- - -1.0.0-b34 - -* Fix and tidy up CMake build scripts - --------------------------------------------------------------------------------- - -1.0.0-b33 - -* Require Visual Studio 2015 Update 3 or later - -HTTP - -* Use fwrite return value in file_body - -WebSocket - -* Set internal state correctly when writing frames -* Add decorator unit test -* Add write_frames unit test - --------------------------------------------------------------------------------- - -1.0.0-b32 - -* Add io_service completion invariants test -* Update CMake scripts for finding packages - -API Changes: - -* Remove http Writer suspend and resume feature - --------------------------------------------------------------------------------- - -1.0.0-b31 - -* Tidy up build settings -* Add missing dynabuf_readstream member - -WebSocket - -* Move the handler, don't copy it - --------------------------------------------------------------------------------- - -1.0.0-b30 - -WebSocket - -* Fix race in pings during reads -* Fix race in close frames during reads -* Fix race when write suspends -* Allow concurrent websocket async ping and writes - --------------------------------------------------------------------------------- - -1.0.0-b29 - -* Fix compilation error in non-template class -* Document type-pun in buffer_cat -* Correctly check ostream modifier (/extras) - -HTTP - -* Fix Body requirements doc -* Fix illegal HTTP characters accepted as hex zero -* Fix Writer return value documentation - -WebSocket - -* Fix race in writes during reads -* Fix doc link typo - --------------------------------------------------------------------------------- - -1.0.0-b28 - -* Split out and rename test stream classes -* Restyle async result constructions -* Fix HTTP split parse edge case - --------------------------------------------------------------------------------- - -1.0.0-b27 - -* Tidy up tests and docs -* Add documentation building instructions - -API Changes: - -* Invoke callback on pings and pongs -* Move basic_streambuf to streambuf.hpp - --------------------------------------------------------------------------------- - -1.0.0-b26 - -* Tidy up warnings and tests - --------------------------------------------------------------------------------- - -1.0.0-b25 - -* Fixes for WebSocket echo server -* Fix 32-bit arm7 warnings -* Remove unnecessary include -* WebSocket server examples and test tidying -* Fix deflate setup bug - -API Changes: - -* Better handler_ptr - --------------------------------------------------------------------------------- - -1.0.0-b24 - -* bjam use clang on MACOSX -* Simplify Travis package install specification -* Add optional yield_to arguments -* Make decorator copyable -* Add WebSocket permessage-deflate extension support - --------------------------------------------------------------------------------- - -1.0.0-b23 - -* Tune websocket echo server for performance -* Add file and line number to thrown exceptions -* Better logging in async echo server -* Add copy special members -* Fix message constructor and special members -* Travis CI improvements - --------------------------------------------------------------------------------- - -1.0.0-b22 - -* Fix broken Intellisense -* Implement the Asio deallocation-before-invocation guarantee -* Add handler helpers -* Avoid copies in handler_alloc -* Update README.md example programs -* Fix websocket stream read documentation -* Disable Boost.Coroutine deprecation warning -* Update documentation examples - --------------------------------------------------------------------------------- - -1.0.0-b21 - -* Remove extraneous includes - --------------------------------------------------------------------------------- - -1.0.0-b20 - -ZLib - -* Add ZLib module - -API Changes: - -* Rename HTTP identifiers - --------------------------------------------------------------------------------- - -1.0.0-b19 - -* Boost library min/max guidance -* Improvements to code coverage -* Use boost::lexical_cast instead of std::to_string -* Fix prepare_buffers value_type -* Fix consuming_buffers value_type -* Better buffer_cat - -HTTP - -* Make chunk_encode public -* Add write, async_write, operator<< for message_headers -* Add read, async_read for message_headers -* Fix with_body example - -WebSocket - -* Optimize utf8 validation -* Optimize mask operations - -API Changes: - -* Refactor message and message_headers declarations -* prepared_buffers is private -* consume_buffers is removed - --------------------------------------------------------------------------------- - -1.0.0-b18 - -* Increase optimization settings for MSVC builds - -HTTP - -* Check invariants in parse_op: -* Clean up message docs - -WebSocket - -* Write buffer option does not change capacity -* Close connection during async_read on close frame -* Add pong, async pong to stream - -Core - -* Meet DynamicBuffer requirements for static_streambuf -* Fix write_frame masking and auto-fragment handling - -Extras - -* unit_test::suite fixes: - - New overload of fail() specifies file and line - - BEAST_EXPECTS only evaluates the reason string on a failure -* Add zlib module - --------------------------------------------------------------------------------- - -1.0.0-b17 - -* Change implicit to default value in example -* Tidy up some declarations -* Fix basic_streambuf::capacity -* Add basic_streambuf::alloc_size -* Parser callbacks may not throw -* Fix Reader concept doc typo -* Add is_Reader trait -* Tidy up basic_headers for documentation -* Tidy up documentation -* Add basic_parser_v1::reset -* Fix handling of body_what::pause in basic_parser_v1 -* Add headers_parser -* Engaged invokable is destructible -* Improve websocket example in README.md -* Refactor read_size_helper - -API Changes: - -* Added init() to Reader requirements -* Reader must be nothrow constructible -* Reader is now constructed right before reading the body - - The message passed on construction is filled in -* Rework HTTP concepts: - - Writer uses write instead of operator() - - Refactor traits to use void_t - - Remove is_ReadableBody, is_WritableBody - - Add has_reader, has_writer, is_Reader, is_Writer - - More friendly compile errors on failed concept checks -* basic_parser_v1 requires all callbacks present -* on_headers parser callback now returns void -* on_body_what is a new required parser callback returning body_what - --------------------------------------------------------------------------------- - -1.0.0-b16 - -* Make value optional in param-list -* Frame processing routines are member functions -* Fix on_headers called twice from basic_parser_v1 -* Constrain parser_v1 constructor -* Improve first line serialization -* Add pause option to on_headers interface -* Refactor base_parser_v1 callback traits: -* Refine Parser concept -* Relax ForwardIterator requirements in FieldSequence -* Fix websocket failure testing -* Refine Writer concept and fix exemplar in documentation - -API Changes: - -* Rename mask_buffer_size to write_buffer_size -* Make auto_fragment a boolean option - -The message class hierarchy is refactored (breaking change): - -* One message class now models both HTTP/1 and HTTP/2 messages -* message_v1, request_v1, response_v1 removed -* New classes basic_request and basic_response model - messages without the body. - - Error resolution: Callers should use message, request, - and response instead of message_v1, request_v1, and - response_v1 respectively. - --------------------------------------------------------------------------------- - -1.0.0-b15 - -* rfc7230 section 3.3.2 compliance -* Add HTTPS example -* Add Secure WebSocket example -* Fix message_v1 constructor -* Tidy up DynamicBuffer requirements -* Tidy up error types and headers -* Fix handling empty HTTP headers in parser_v1 - --------------------------------------------------------------------------------- - -1.0.0-b14 - -* Add missing rebind to handler_alloc -* Fix error handling in http server examples -* Fix CMake scripts for MinGW -* Use BOOST_ASSERT -* Better WebSocket decorator -* Update and tidy documentation - --------------------------------------------------------------------------------- - -1.0.0-b13 - -* dstream improvements -* Remove bin and bin64 directories -* Tidy up .vcxproj file groupings - --------------------------------------------------------------------------------- - -1.0.0-b12 - -* Use -p to print suites from unit test main. -* BEAST_EXPECTS to add a reason string to test failures -* Fix unit test runner to output all case names -* Update README for build requirements -* Rename to CHANGELOG.md - --------------------------------------------------------------------------------- - -1.0.0-b11 - -* Set URI in generated WebSocket Upgrade requests -* Rename echo server class and file names -* Rename to DynamicBuffer in some code and documentation -* Fix integer warnings in Windows builds -* Add 32 and 64 bit Windows build support -* Update README for build instructions and more -* Add repository and documention banners - --------------------------------------------------------------------------------- - -1.0.0-b10 - -* Fix compilation warnings -* Add websocketpp comparison to HTML documentation - --------------------------------------------------------------------------------- - -1.0.0-b9 - -* Fix CMakeLists.txt - --------------------------------------------------------------------------------- - -1.0.0-b8 - -* Fix include in example code -* Fix basic_headers rfc2616 Section 4.2 compliance - --------------------------------------------------------------------------------- - -1.0.0-b7 - -* Fix prepare by calling init. prepare() can throw depending on the - implementation of Writer. Publicly provided beast::http writers never throw. -* Fixes to example HTTP server -* Fully qualify ambiguous calls to read and parse -* Remove deprecated http::stream wrapper -* Example HTTP server now calculates the MIME-type -* Fixes and documentation for teardown and use with SSL: -* Add example code to rfc7230 javadocs -* Remove extraneous header file <beast/http/status.hpp> -* Add skip_body parser option - --------------------------------------------------------------------------------- - -1.0.0-b6 - -* Use SFINAE on return values -* Use beast::error_code instead of nested types -* Tidy up use of GENERATING_DOCS -* Remove obsolete RFC2616 functions -* Add message swap members and free functions -* Add HTTP field value parser containers: ext_list, param_list, token_list -* Fixes for some corner cases in basic_parser_v1 -* Configurable limits on headers and body sizes in basic_parser_v1 - -API Changes: - -* ci_equal is moved to beast::http namespace, in rfc7230.hpp - -* "DynamicBuffer","dynabuf" renamed from "Streambuf", "streambuf". See: - http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4478.html#requirements.dynamic_buffers - -* basic_parser_v1 adheres to rfc7230 as strictly as possible - --------------------------------------------------------------------------------- diff --git a/contrib/restricted/boost/beast/CODE_OF_CONDUCT.md b/contrib/restricted/boost/beast/CODE_OF_CONDUCT.md deleted file mode 100644 index f20c98a738..0000000000 --- a/contrib/restricted/boost/beast/CODE_OF_CONDUCT.md +++ /dev/null @@ -1,9 +0,0 @@ -# Code of Conduct - -* Be respectful of others - -* Please use professional conduct - -* Treat others the way you want to be treated - -Thank you! diff --git a/contrib/restricted/boost/beast/CONTRIBUTING.md b/contrib/restricted/boost/beast/CONTRIBUTING.md deleted file mode 100644 index de3f11cf1a..0000000000 --- a/contrib/restricted/boost/beast/CONTRIBUTING.md +++ /dev/null @@ -1,65 +0,0 @@ -# Contributing to Beast - -Thank you for taking the time to read this document! - -:heart_eyes: **please star the Boost.Beast repository!** :heart_eyes: - -First make sure you're on the -[official repository page](https://github.com/boostorg/beast/blob/master/CONTRIBUTING.md), -then just press the button labeled "star" in the top right of the page -to give Beast a star! Your stars create generate additional visibility, -which leads to more users, more bug reports, more fixes, more testing, -more features, and a better product! - -<a href="https://github.com/boostorg/beast/blob/master/CONTRIBUTING.md"> -<img width="400" height = "150" alt = "Please Star the Repository" - src="https://raw.githubusercontent.com/vinniefalco/BeastAssets/master/StarTheRepo.png"> -</a> - -Click the image above to make sure you're on the official -Boost repository page so you can give Beast a star! - -# Ways to Contribute - -No contribution to Beast is too big or too small! We are -always happy to see user participation in all of its forms. -Here are some of the ways that you can contribute (this is -by no means an exhaustive list): - -* Submit a - [bug report](https://github.com/boostorg/beast/issues). - We love hearing about broken things, so - that we can fix them. Any problem is fair game, this includes - the documentation examples, tests, and repository as well as the - library itself. Bug reports should be opened on the - [Issues](https://github.com/boostorg/beast/issues) page. - -* Provide - [feedback](https://github.com/boostorg/beast/issues). - about the library. If you have used, are using, - or are thinking about using the library we want to hear about it! - The more information you provide, the better we will be able - to ensure that Beast meets your needs. You can provide feedback - as an issue, or email the author directly. - -* Test Beast. When changes are made, they are submitted as a - [Pull Request](https://github.com/boostorg/beast/pulls). - Everyone is welcome to examine these upcoming changes, test them, - and report on the results. This form of quality assurance is very - helpful so we can keep delivering a great product. Consider - subscribing to repository notifications to get alerted to new - pull requests. - -* Code Review on - [Pull Requests](https://github.com/boostorg/beast/pulls). - This is one of the most valuable ways to contribute, because it helps - to improve code and features, and helps to find bugs, before the code - gets merged. A little bit of time investment from just a few people on - each pull request goes a **long** way to increasing the quality of the - final product. For tips on how to participate in pull requests please - view the - [README.md](https://github.com/boostorg/beast#contributing-we-need-your-help). - -* Use Beast in your next application! At the end of the day, it is the - goal of the library to provide utility to users so the best way you - can contribute is simply to use the library! diff --git a/contrib/restricted/boost/beast/LICENSE_1_0.txt b/contrib/restricted/boost/beast/LICENSE_1_0.txt deleted file mode 100644 index 36b7cd93cd..0000000000 --- a/contrib/restricted/boost/beast/LICENSE_1_0.txt +++ /dev/null @@ -1,23 +0,0 @@ -Boost Software License - Version 1.0 - August 17th, 2003 - -Permission is hereby granted, free of charge, to any person or organization -obtaining a copy of the software and accompanying documentation covered by -this license (the "Software") to use, reproduce, display, distribute, -execute, and transmit the Software, and to prepare derivative works of the -Software, and to permit third-parties to whom the Software is furnished to -do so, all subject to the following: - -The copyright notices in the Software and this entire statement, including -the above license grant, this restriction and the following disclaimer, -must be included in all copies of the Software, in whole or in part, and -all derivative works of the Software, unless such copies or derivative -works are solely in the form of machine-executable object code generated by -a source language processor. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT -SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE -FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. diff --git a/contrib/restricted/boost/beast/README.md b/contrib/restricted/boost/beast/README.md deleted file mode 100644 index 62220de99f..0000000000 --- a/contrib/restricted/boost/beast/README.md +++ /dev/null @@ -1,212 +0,0 @@ -<img width="880" height = "80" alt = "Boost.Beast Title" - src="https://raw.githubusercontent.com/boostorg/beast/master/doc/images/readme2.png"> - -# HTTP and WebSocket built on Boost.Asio in C++11 - -Branch | Linux/OSX | Windows | Coverage | Documentation | Matrix -------------|-----------|---------|----------|---------------|-------- -[master](https://github.com/boostorg/beast/tree/master) | [![Build Status](https://travis-ci.org/boostorg/beast.svg?branch=master)](https://travis-ci.org/boostorg/beast) | [![Build status](https://ci.appveyor.com/api/projects/status/g0llpbvhpjuxjnlw/branch/master?svg=true)](https://ci.appveyor.com/project/vinniefalco/beast/branch/master) | [![codecov](https://codecov.io/gh/boostorg/Beast/branch/master/graph/badge.svg)](https://codecov.io/gh/boostorg/beast/branch/master) | [![Documentation](https://img.shields.io/badge/documentation-master-brightgreen.svg)](http://www.boost.org/doc/libs/master/libs/beast/doc/html/index.html) | [![Matrix](https://img.shields.io/badge/matrix-master-brightgreen.svg)](http://www.boost.org/development/tests/master/developer/beast.html) -[develop](https://github.com/boostorg/beast/tree/develop) | [![Build Status](https://travis-ci.org/boostorg/beast.svg?branch=develop)](https://travis-ci.org/boostorg/beast) | [![Build status](https://ci.appveyor.com/api/projects/status/g0llpbvhpjuxjnlw/branch/develop?svg=true)](https://ci.appveyor.com/project/vinniefalco/beast/branch/develop) | [![codecov](https://codecov.io/gh/boostorg/Beast/branch/develop/graph/badge.svg)](https://codecov.io/gh/boostorg/beast/branch/develop) | [![Documentation](https://img.shields.io/badge/documentation-develop-brightgreen.svg)](http://www.boost.org/doc/libs/develop/libs/beast/index.html) | [![Matrix](https://img.shields.io/badge/matrix-develop-brightgreen.svg)](http://www.boost.org/development/tests/develop/developer/beast.html) - -## Contents - -- [Introduction](#introduction) -- [Appearances](#appearances) -- [Description](#description) -- [Requirements](#requirements) -- [Git Branches](#branches) -- [Building](#building) -- [Usage](#usage) -- [License](#license) -- [Contact](#contact) -- [Contributing](#Contributing) - -## Introduction - -Beast is a C++ header-only library serving as a foundation for writing -interoperable networking libraries by providing **low-level HTTP/1, -WebSocket, and networking protocol** vocabulary types and algorithms -using the consistent asynchronous model of Boost.Asio. - -This library is designed for: - -* **Symmetry:** Algorithms are role-agnostic; build clients, servers, or both. - -* **Ease of Use:** Boost.Asio users will immediately understand Beast. - -* **Flexibility:** Users make the important decisions such as buffer or - thread management. - -* **Performance:** Build applications handling thousands of connections or more. - -* **Basis for Further Abstraction.** Components are well-suited for building upon. - -## Appearances - -| <a href="https://www.bishopfox.com/case_study/securing-beast/">Bishop Fox 2018</a> | -| ------------ | -| <a href="https://youtu.be/4TtyYbGDAj0"><img width="320" height = "180" alt="Beast Security Review" src="https://raw.githubusercontent.com/vinniefalco/BeastAssets/master/BishopFox2018.png"></a> | - -| <a href="https://raw.githubusercontent.com/vinniefalco/CppCon2017/master/Make%20Classes%20Great%20Again%20-%20Vinnie%20Falco%20-%20CppCon%202017.pdf">CppCon 2017</a> | <a href="http://cppcast.com/2017/01/vinnie-falco/">CppCast 2017</a> | <a href="https://raw.githubusercontent.com/vinniefalco/BeastAssets/master/CppCon2016.pdf">CppCon 2016</a> | -| ------------ | ------------ | ----------- | -| <a href="https://www.youtube.com/watch?v=WsUnnYEKPnI"><img width="320" height = "180" alt="Beast" src="https://raw.githubusercontent.com/vinniefalco/CppCon2017/master/CppCon2017.png"></a> | <a href="http://cppcast.com/2017/01/vinnie-falco/"><img width="180" height="180" alt="Vinnie Falco" src="https://avatars1.githubusercontent.com/u/1503976?v=3&u=76c56d989ef4c09625256662eca2775df78a16ad&s=180"></a> | <a href="https://www.youtube.com/watch?v=uJZgRcvPFwI"><img width="320" height = "180" alt="Beast" src="https://raw.githubusercontent.com/vinniefalco/BeastAssets/master/CppCon2016.png"></a> | - -## Description - -This software is in its first official release. Interfaces -may change in response to user feedback. For recent changes -see the [CHANGELOG](CHANGELOG.md). - -* [Official Site](https://github.com/boostorg/beast) -* [Documentation](http://www.boost.org/doc/libs/master/libs/beast/) (master branch) -* [Autobahn|Testsuite WebSocket Results](https://vinniefalco.github.io/boost/beast/reports/autobahn/index.html) - -## Requirements - -This library is for programmers familiar with Boost.Asio. Users -who wish to use asynchronous interfaces should already know how to -create concurrent network programs using callbacks or coroutines. - -* **C++11:** Robust support for most language features. -* **Boost:** Boost.Asio and some other parts of Boost. -* **OpenSSL:** Optional, for using TLS/Secure sockets. - -When using Microsoft Visual C++, Visual Studio 2015 Update 3 or later is required. - -One of these components is required in order to build the tests and examples: - -* Properly configured bjam/b2 -* CMake 3.5.1 or later (Windows only) - -## Branches - -The official repository contains the following branches: - -* [**master**](https://github.com/boostorg/beast/tree/master) This - holds the most recent snapshot with code that is known to be stable. - -* [**develop**](https://github.com/boostorg/beast/tree/develop) This - holds the most recent snapshot. It may contain unstable code. - -Each of these branches requires a corresponding Boost branch and -all of its subprojects. For example, if you wish to use the **master** -branch version of Beast, you should clone the Boost superproject, -switch to the **master** branch in the superproject and acquire -all the Boost libraries corresponding to that branch including Beast. - -Or, to use the latest shipping version of Beast, simply use it -from the corresponding distribution of Boost. - -## Building - -Beast is header-only. To use it just add the necessary `#include` line -to your source files, like this: -```C++ -#include <boost/beast.hpp> -``` - -To build your program successfully, you'll need to add the Boost.System -library to link with. If you use coroutines you'll also need to link -with the Boost.Coroutine library. Please visit the Boost documentation -for instructions on how to do this for your particular build system. - -To build the documentation, examples, tests, and benchmarks it is -necessary to first obtain the Boost "superproject" along with sources of -all of the Boost libraries, then run the `b2` command to build the Boost -libraries. -Instructions for doing so may be found on -the [Boost Wiki](https://github.com/boostorg/boost/wiki/Getting-Started). -These commamnds will build the programs and documentation that come -with Beast (omit the cxxflags parameter when building using MSVC): - -``` -cd boost # The directory containing the Boost superproject and libraries -b2 libs/beast/test cxxflags="-std=c++11" # bjam must be in your $PATH -b2 libs/beast/example cxxflags="-std=c++11" -b2 libs/beast/doc -``` - -On Windows platforms only, CMake may be used to generate a Visual Studio -solution and a set of Visual Studio project files using these commands: - -``` -cd boost # The directory containing the Boost superproject and libraries -cd libs/beast -mkdir bin -cd bin -cmake .. # for 32-bit Windows builds, or -cmake -G"Visual Studio 14 2015 Win64" .. # for 64-bit Windows builds (VS2015), or -cmake -G"Visual Studio 15 2017 Win64" .. # for 64-bit Windows builds (VS2017) -``` - -The files in the repository are laid out thusly: - -``` -./ - bin/ Create this to hold executables and project files - bin64/ Create this to hold 64-bit Windows executables and project files - doc/ Source code and scripts for the documentation - include/ Where the header files live - extras/ Additional APIs, may change - example/ Self contained example programs - meta/ Metadata for Boost integration - scripts/ Small scripts used with CI systems - test/ Unit tests -``` - -## Usage - -These examples are complete, self-contained programs that you can build -and run yourself (they are in the `example` directory). - -http://www.boost.org/doc/libs/develop/libs/beast/doc/html/beast/quick_start.html - -## License - -Distributed under the Boost Software License, Version 1.0. -(See accompanying file [LICENSE_1_0.txt](LICENSE_1_0.txt) or copy at -http://www.boost.org/LICENSE_1_0.txt) - -## Contact - -Please report issues or questions here: -https://github.com/boostorg/beast/issues - ---- - -## Contributing (We Need Your Help!) - -If you would like to contribute to Beast and help us maintain high -quality, consider performing code reviews on active pull requests. -Any feedback from users and stakeholders, even simple questions about -how things work or why they were done a certain way, carries value -and can be used to improve the library. Code review provides these -benefits: - -* Identify bugs -* Documentation proof-reading -* Adjust interfaces to suit use-cases -* Simplify code - -You can look through the Closed pull requests to get an idea of how -reviews are performed. To give a code review just sign in with your -GitHub account and then add comments to any open pull requests below, -don't be shy! -<p>https://github.com/boostorg/beast/pulls</p> - -Here are some resources to learn more about -code reviews: - -* <a href="https://blog.scottnonnenberg.com/top-ten-pull-request-review-mistakes/">Top 10 Pull Request Review Mistakes</a> -* <a href="https://smartbear.com/SmartBear/media/pdfs/best-kept-secrets-of-peer-code-review.pdf">Best Kept Secrets of Peer Code Review (pdf)</a> -* <a href="http://support.smartbear.com/support/media/resources/cc/11_Best_Practices_for_Peer_Code_Review.pdf">11 Best Practices for Peer Code Review (pdf)</a> -* <a href="http://www.evoketechnologies.com/blog/code-review-checklist-perform-effective-code-reviews/">Code Review Checklist – To Perform Effective Code Reviews</a> -* <a href="https://www.codeproject.com/Articles/524235/Codeplusreviewplusguidelines">Code review guidelines</a> -* <a href="https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md">C++ Core Guidelines</a> -* <a href="https://doc.lagout.org/programmation/C/CPP101.pdf">C++ Coding Standards (Sutter & Andrescu)</a> - -Beast thrives on code reviews and any sort of feedback from users and -stakeholders about its interfaces. Even if you just have questions, -asking them in the code review or in issues provides valuable information -that can be used to improve the library - do not hesitate, no question -is insignificant or unimportant! diff --git a/contrib/restricted/boost/callable_traits/LICENSE.md b/contrib/restricted/boost/callable_traits/LICENSE.md deleted file mode 100644 index 901f174c9b..0000000000 --- a/contrib/restricted/boost/callable_traits/LICENSE.md +++ /dev/null @@ -1,25 +0,0 @@ -Copyright 2015-2016 Barrett Adair - -Boost Software License - Version 1.0 - August 17th, 2003 - -Permission is hereby granted, free of charge, to any person or organization -obtaining a copy of the software and accompanying documentation covered by -this license (the "Software") to use, reproduce, display, distribute, -execute, and transmit the Software, and to prepare derivative works of the -Software, and to permit third-parties to whom the Software is furnished to -do so, all subject to the following: - -The copyright notices in the Software and this entire statement, including -the above license grant, this restriction and the following disclaimer, -must be included in all copies of the Software, in whole or in part, and -all derivative works of the Software, unless such copies or derivative -works are solely in the form of machine-executable object code generated by -a source language processor. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT -SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE -FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. diff --git a/contrib/restricted/boost/callable_traits/README.md b/contrib/restricted/boost/callable_traits/README.md deleted file mode 100644 index 2e1f378425..0000000000 --- a/contrib/restricted/boost/callable_traits/README.md +++ /dev/null @@ -1,18 +0,0 @@ -<!-- -Copyright Barrett Adair 2016-2021 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) ---> - -# Boost.CallableTraits <a target="_blank" href="https://github.com/boostorg/callable_traits/actions/workflows/ci.yml">![CI][badge.CI]</a> - -CallableTraits is a standalone C++11 header-only library for the inspection, synthesis, and decomposition of callable types. Language features added in later C++ standards are also supported. - -The latest documentation is available [here](http://www.boost.org/doc/libs/master/libs/callable_traits/doc/html/index.html). - -CallableTraits is released as part of the [Boost C++ Libraries](http://www.boost.org/). Since it only depends on the standard library headers, you can also download it as a standalone library [here](https://github.com/boostorg/callable_traits/releases/latest). - -Licensed under the [Boost Software License, Version 1.0](LICENSE.md). - -<!-- Links --> -[badge.CI]: https://github.com/boostorg/callable_traits/actions/workflows/ci.yml/badge.svg diff --git a/contrib/restricted/boost/context/README.md b/contrib/restricted/boost/context/README.md deleted file mode 100644 index 44aeff04f3..0000000000 --- a/contrib/restricted/boost/context/README.md +++ /dev/null @@ -1,21 +0,0 @@ -boost.context -============= - -boost.context is a foundational library that provides a sort of cooperative multitasking on a single thread. -By providing an abstraction of the current execution state in the current thread, including the stack (with -local variables) and stack pointer, all registers and CPU flags, and the instruction pointer, a execution_context -instance represents a specific point in the application's execution path. This is useful for building -higher-level abstractions, like coroutines, cooperative threads (userland threads) or an equivalent to -C# keyword yield in C++. - -A fiber provides the means to suspend the current execution path and to transfer execution control, -thereby permitting another fiber to run on the current thread. This state full transfer mechanism -enables a fiber to suspend execution from within nested functions and, later, to resume from where it -was suspended. While the execution path represented by a fiber only runs on a single thread, it can be -migrated to another thread at any given time. - -A context switch between threads requires system calls (involving the OS kernel), which can cost more than -thousand CPU cycles on x86 CPUs. By contrast, transferring control among fibers requires only fewer than -hundred CPU cycles because it does not involve system calls as it is done within a single thread. - -boost.context requires C++11! diff --git a/contrib/restricted/boost/context/include/boost/context/continuation_ucontext.hpp b/contrib/restricted/boost/context/include/boost/context/continuation_ucontext.hpp deleted file mode 100644 index 951e542983..0000000000 --- a/contrib/restricted/boost/context/include/boost/context/continuation_ucontext.hpp +++ /dev/null @@ -1,538 +0,0 @@ - -// Copyright Oliver Kowalke 2017. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_CONTEXT_CONTINUATION_H -#define BOOST_CONTEXT_CONTINUATION_H - -#include <boost/predef.h> -#if BOOST_OS_MACOS -#define _XOPEN_SOURCE 600 -#endif - -extern "C" { -#include <ucontext.h> -} - -#include <boost/context/detail/config.hpp> - -#include <algorithm> -#include <cstddef> -#include <cstdint> -#include <cstdlib> -#include <cstring> -#include <functional> -#include <memory> -#include <ostream> -#include <system_error> -#include <tuple> -#include <utility> - -#include <boost/assert.hpp> -#include <boost/config.hpp> - -#include <boost/context/detail/disable_overload.hpp> -#if defined(BOOST_NO_CXX14_STD_EXCHANGE) -#include <boost/context/detail/exchange.hpp> -#endif -#include <boost/context/detail/externc.hpp> -#if defined(BOOST_NO_CXX17_STD_INVOKE) -#include <boost/context/detail/invoke.hpp> -#endif -#include <boost/context/fixedsize_stack.hpp> -#include <boost/context/flags.hpp> -#include <boost/context/preallocated.hpp> -#if defined(BOOST_USE_SEGMENTED_STACKS) -#include <boost/context/segmented_stack.hpp> -#endif -#include <boost/context/stack_context.hpp> - -#ifdef BOOST_HAS_ABI_HEADERS -# include BOOST_ABI_PREFIX -#endif - -namespace boost { -namespace context { -namespace detail { - -// tampoline function -// entered if the execution context -// is resumed for the first time -template< typename Record > -static void entry_func( void * data) noexcept { - Record * record = static_cast< Record * >( data); - BOOST_ASSERT( nullptr != record); - // start execution of toplevel context-function - record->run(); -} - -struct BOOST_CONTEXT_DECL activation_record { - ucontext_t uctx{}; - stack_context sctx{}; - bool main_ctx{ true }; - activation_record * from{ nullptr }; - std::function< activation_record*(activation_record*&) > ontop{}; - bool terminated{ false }; - bool force_unwind{ false }; -#if defined(BOOST_USE_ASAN) - void * fake_stack{ nullptr }; - void * stack_bottom{ nullptr }; - std::size_t stack_size{ 0 }; -#endif - - static activation_record *& current() noexcept; - - // used for toplevel-context - // (e.g. main context, thread-entry context) - activation_record() { - if ( BOOST_UNLIKELY( 0 != ::getcontext( & uctx) ) ) { - throw std::system_error( - std::error_code( errno, std::system_category() ), - "getcontext() failed"); - } - } - - activation_record( stack_context sctx_) noexcept : - sctx( sctx_ ), - main_ctx( false ) { - } - - virtual ~activation_record() { - } - - activation_record( activation_record const&) = delete; - activation_record & operator=( activation_record const&) = delete; - - bool is_main_context() const noexcept { - return main_ctx; - } - - activation_record * resume() { - from = current(); - // store `this` in static, thread local pointer - // `this` will become the active (running) context - current() = this; -#if defined(BOOST_USE_SEGMENTED_STACKS) - // adjust segmented stack properties - __splitstack_getcontext( from->sctx.segments_ctx); - __splitstack_setcontext( sctx.segments_ctx); -#endif -#if defined(BOOST_USE_ASAN) - if ( terminated) { - __sanitizer_start_switch_fiber( nullptr, stack_bottom, stack_size); - } else { - __sanitizer_start_switch_fiber( & from->fake_stack, stack_bottom, stack_size); - } -#endif - // context switch from parent context to `this`-context - ::swapcontext( & from->uctx, & uctx); -#if defined(BOOST_USE_ASAN) - __sanitizer_finish_switch_fiber( current()->fake_stack, - (const void **) & current()->from->stack_bottom, - & current()->from->stack_size); -#endif -#if defined(BOOST_NO_CXX14_STD_EXCHANGE) - return exchange( current()->from, nullptr); -#else - return std::exchange( current()->from, nullptr); -#endif - } - - template< typename Ctx, typename Fn > - activation_record * resume_with( Fn && fn) { - from = current(); - // store `this` in static, thread local pointer - // `this` will become the active (running) context - // returned by continuation::current() - current() = this; -#if defined(BOOST_NO_CXX14_GENERIC_LAMBDAS) - current()->ontop = std::bind( - [](typename std::decay< Fn >::type & fn, activation_record *& ptr){ - Ctx c{ ptr }; - c = fn( std::move( c) ); - if ( ! c) { - ptr = nullptr; - } -#if defined(BOOST_NO_CXX14_STD_EXCHANGE) - return exchange( c.ptr_, nullptr); -#else - return std::exchange( c.ptr_, nullptr); -#endif - }, - std::forward< Fn >( fn), - std::placeholders::_1); -#else - current()->ontop = [fn=std::forward<Fn>(fn)](activation_record *& ptr){ - Ctx c{ ptr }; - c = fn( std::move( c) ); - if ( ! c) { - ptr = nullptr; - } -#if defined(BOOST_NO_CXX14_STD_EXCHANGE) - return exchange( c.ptr_, nullptr); -#else - return std::exchange( c.ptr_, nullptr); -#endif - }; -#endif -#if defined(BOOST_USE_SEGMENTED_STACKS) - // adjust segmented stack properties - __splitstack_getcontext( from->sctx.segments_ctx); - __splitstack_setcontext( sctx.segments_ctx); -#endif -#if defined(BOOST_USE_ASAN) - __sanitizer_start_switch_fiber( & from->fake_stack, stack_bottom, stack_size); -#endif - // context switch from parent context to `this`-context - ::swapcontext( & from->uctx, & uctx); -#if defined(BOOST_USE_ASAN) - __sanitizer_finish_switch_fiber( current()->fake_stack, - (const void **) & current()->from->stack_bottom, - & current()->from->stack_size); -#endif -#if defined(BOOST_NO_CXX14_STD_EXCHANGE) - return exchange( current()->from, nullptr); -#else - return std::exchange( current()->from, nullptr); -#endif - } - - virtual void deallocate() noexcept { - } -}; - -struct BOOST_CONTEXT_DECL activation_record_initializer { - activation_record_initializer() noexcept; - ~activation_record_initializer(); -}; - -struct forced_unwind { - activation_record * from{ nullptr }; - - forced_unwind( activation_record * from_) noexcept : - from{ from_ } { - } -}; - -template< typename Ctx, typename StackAlloc, typename Fn > -class capture_record : public activation_record { -private: - typename std::decay< StackAlloc >::type salloc_; - typename std::decay< Fn >::type fn_; - - static void destroy( capture_record * p) noexcept { - typename std::decay< StackAlloc >::type salloc = std::move( p->salloc_); - stack_context sctx = p->sctx; - // deallocate activation record - p->~capture_record(); - // destroy stack with stack allocator - salloc.deallocate( sctx); - } - -public: - capture_record( stack_context sctx, StackAlloc && salloc, Fn && fn) noexcept : - activation_record{ sctx }, - salloc_{ std::forward< StackAlloc >( salloc) }, - fn_( std::forward< Fn >( fn) ) { - } - - void deallocate() noexcept override final { - BOOST_ASSERT( main_ctx || ( ! main_ctx && terminated) ); - destroy( this); - } - - void run() { -#if defined(BOOST_USE_ASAN) - __sanitizer_finish_switch_fiber( fake_stack, - (const void **) & from->stack_bottom, - & from->stack_size); -#endif - Ctx c{ from }; - try { - // invoke context-function -#if defined(BOOST_NO_CXX17_STD_INVOKE) - c = boost::context::detail::invoke( fn_, std::move( c) ); -#else - c = std::invoke( fn_, std::move( c) ); -#endif - } catch ( forced_unwind const& ex) { - c = Ctx{ ex.from }; - } - // this context has finished its task - from = nullptr; - ontop = nullptr; - terminated = true; - force_unwind = false; - c.resume(); - BOOST_ASSERT_MSG( false, "continuation already terminated"); - } -}; - -template< typename Ctx, typename StackAlloc, typename Fn > -static activation_record * create_context1( StackAlloc && salloc, Fn && fn) { - typedef capture_record< Ctx, StackAlloc, Fn > capture_t; - - auto sctx = salloc.allocate(); - // reserve space for control structure - void * storage = reinterpret_cast< void * >( - ( reinterpret_cast< uintptr_t >( sctx.sp) - static_cast< uintptr_t >( sizeof( capture_t) ) ) - & ~ static_cast< uintptr_t >( 0xff) ); - // placment new for control structure on context stack - capture_t * record = new ( storage) capture_t{ - sctx, std::forward< StackAlloc >( salloc), std::forward< Fn >( fn) }; - // stack bottom - void * stack_bottom = reinterpret_cast< void * >( - reinterpret_cast< uintptr_t >( sctx.sp) - static_cast< uintptr_t >( sctx.size) ); - // create user-context - if ( BOOST_UNLIKELY( 0 != ::getcontext( & record->uctx) ) ) { - record->~capture_t(); - salloc.deallocate( sctx); - throw std::system_error( - std::error_code( errno, std::system_category() ), - "getcontext() failed"); - } - record->uctx.uc_stack.ss_sp = stack_bottom; - // 64byte gap between control structure and stack top - record->uctx.uc_stack.ss_size = reinterpret_cast< uintptr_t >( storage) - - reinterpret_cast< uintptr_t >( stack_bottom) - static_cast< uintptr_t >( 64); - record->uctx.uc_link = nullptr; - ::makecontext( & record->uctx, ( void (*)() ) & entry_func< capture_t >, 1, record); -#if defined(BOOST_USE_ASAN) - record->stack_bottom = record->uctx.uc_stack.ss_sp; - record->stack_size = record->uctx.uc_stack.ss_size; -#endif - return record; -} - -template< typename Ctx, typename StackAlloc, typename Fn > -static activation_record * create_context2( preallocated palloc, StackAlloc && salloc, Fn && fn) { - typedef capture_record< Ctx, StackAlloc, Fn > capture_t; - - // reserve space for control structure - void * storage = reinterpret_cast< void * >( - ( reinterpret_cast< uintptr_t >( palloc.sp) - static_cast< uintptr_t >( sizeof( capture_t) ) ) - & ~ static_cast< uintptr_t >( 0xff) ); - // placment new for control structure on context stack - capture_t * record = new ( storage) capture_t{ - palloc.sctx, std::forward< StackAlloc >( salloc), std::forward< Fn >( fn) }; - // stack bottom - void * stack_bottom = reinterpret_cast< void * >( - reinterpret_cast< uintptr_t >( palloc.sctx.sp) - static_cast< uintptr_t >( palloc.sctx.size) ); - // create user-context - if ( BOOST_UNLIKELY( 0 != ::getcontext( & record->uctx) ) ) { - record->~capture_t(); - salloc.deallocate( palloc.sctx); - throw std::system_error( - std::error_code( errno, std::system_category() ), - "getcontext() failed"); - } - record->uctx.uc_stack.ss_sp = stack_bottom; - // 64byte gap between control structure and stack top - record->uctx.uc_stack.ss_size = reinterpret_cast< uintptr_t >( storage) - - reinterpret_cast< uintptr_t >( stack_bottom) - static_cast< uintptr_t >( 64); - record->uctx.uc_link = nullptr; - ::makecontext( & record->uctx, ( void (*)() ) & entry_func< capture_t >, 1, record); -#if defined(BOOST_USE_ASAN) - record->stack_bottom = record->uctx.uc_stack.ss_sp; - record->stack_size = record->uctx.uc_stack.ss_size; -#endif - return record; -} - -} - -class BOOST_CONTEXT_DECL continuation { -private: - friend struct detail::activation_record; - - template< typename Ctx, typename StackAlloc, typename Fn > - friend class detail::capture_record; - - template< typename Ctx, typename StackAlloc, typename Fn > - friend detail::activation_record * detail::create_context1( StackAlloc &&, Fn &&); - - template< typename Ctx, typename StackAlloc, typename Fn > - friend detail::activation_record * detail::create_context2( preallocated, StackAlloc &&, Fn &&); - - template< typename StackAlloc, typename Fn > - friend continuation - callcc( std::allocator_arg_t, StackAlloc &&, Fn &&); - - template< typename StackAlloc, typename Fn > - friend continuation - callcc( std::allocator_arg_t, preallocated, StackAlloc &&, Fn &&); - - detail::activation_record * ptr_{ nullptr }; - - continuation( detail::activation_record * ptr) noexcept : - ptr_{ ptr } { - } - -public: - continuation() = default; - - ~continuation() { - if ( BOOST_UNLIKELY( nullptr != ptr_) && ! ptr_->main_ctx) { - if ( BOOST_LIKELY( ! ptr_->terminated) ) { - ptr_->force_unwind = true; - ptr_->resume(); - BOOST_ASSERT( ptr_->terminated); - } - ptr_->deallocate(); - } - } - - continuation( continuation const&) = delete; - continuation & operator=( continuation const&) = delete; - - continuation( continuation && other) noexcept { - swap( other); - } - - continuation & operator=( continuation && other) noexcept { - if ( BOOST_LIKELY( this != & other) ) { - continuation tmp = std::move( other); - swap( tmp); - } - return * this; - } - - continuation resume() & { - return std::move( * this).resume(); - } - - continuation resume() && { -#if defined(BOOST_NO_CXX14_STD_EXCHANGE) - detail::activation_record * ptr = detail::exchange( ptr_, nullptr)->resume(); -#else - detail::activation_record * ptr = std::exchange( ptr_, nullptr)->resume(); -#endif - if ( BOOST_UNLIKELY( detail::activation_record::current()->force_unwind) ) { - throw detail::forced_unwind{ ptr}; - } else if ( BOOST_UNLIKELY( nullptr != detail::activation_record::current()->ontop) ) { - ptr = detail::activation_record::current()->ontop( ptr); - detail::activation_record::current()->ontop = nullptr; - } - return { ptr }; - } - - template< typename Fn > - continuation resume_with( Fn && fn) & { - return std::move( * this).resume_with( std::forward< Fn >( fn) ); - } - - template< typename Fn > - continuation resume_with( Fn && fn) && { -#if defined(BOOST_NO_CXX14_STD_EXCHANGE) - detail::activation_record * ptr = - detail::exchange( ptr_, nullptr)->resume_with< continuation >( std::forward< Fn >( fn) ); -#else - detail::activation_record * ptr = - std::exchange( ptr_, nullptr)->resume_with< continuation >( std::forward< Fn >( fn) ); -#endif - if ( BOOST_UNLIKELY( detail::activation_record::current()->force_unwind) ) { - throw detail::forced_unwind{ ptr}; - } else if ( BOOST_UNLIKELY( nullptr != detail::activation_record::current()->ontop) ) { - ptr = detail::activation_record::current()->ontop( ptr); - detail::activation_record::current()->ontop = nullptr; - } - return { ptr }; - } - - explicit operator bool() const noexcept { - return nullptr != ptr_ && ! ptr_->terminated; - } - - bool operator!() const noexcept { - return nullptr == ptr_ || ptr_->terminated; - } - - bool operator<( continuation const& other) const noexcept { - return ptr_ < other.ptr_; - } - - #if !defined(BOOST_EMBTC) - - template< typename charT, class traitsT > - friend std::basic_ostream< charT, traitsT > & - operator<<( std::basic_ostream< charT, traitsT > & os, continuation const& other) { - if ( nullptr != other.ptr_) { - return os << other.ptr_; - } else { - return os << "{not-a-context}"; - } - } - - #else - - template< typename charT, class traitsT > - friend std::basic_ostream< charT, traitsT > & - operator<<( std::basic_ostream< charT, traitsT > & os, continuation const& other); - - #endif - - void swap( continuation & other) noexcept { - std::swap( ptr_, other.ptr_); - } -}; - -#if defined(BOOST_EMBTC) - - template< typename charT, class traitsT > - inline std::basic_ostream< charT, traitsT > & - operator<<( std::basic_ostream< charT, traitsT > & os, continuation const& other) { - if ( nullptr != other.ptr_) { - return os << other.ptr_; - } else { - return os << "{not-a-context}"; - } - } - -#endif - -template< - typename Fn, - typename = detail::disable_overload< continuation, Fn > -> -continuation -callcc( Fn && fn) { - return callcc( - std::allocator_arg, -#if defined(BOOST_USE_SEGMENTED_STACKS) - segmented_stack(), -#else - fixedsize_stack(), -#endif - std::forward< Fn >( fn) ); -} - -template< typename StackAlloc, typename Fn > -continuation -callcc( std::allocator_arg_t, StackAlloc && salloc, Fn && fn) { - return continuation{ - detail::create_context1< continuation >( - std::forward< StackAlloc >( salloc), std::forward< Fn >( fn) ) }.resume(); -} - -template< typename StackAlloc, typename Fn > -continuation -callcc( std::allocator_arg_t, preallocated palloc, StackAlloc && salloc, Fn && fn) { - return continuation{ - detail::create_context2< continuation >( - palloc, std::forward< StackAlloc >( salloc), std::forward< Fn >( fn) ) }.resume(); -} - -inline -void swap( continuation & l, continuation & r) noexcept { - l.swap( r); -} - -}} - -#ifdef BOOST_HAS_ABI_HEADERS -# include BOOST_ABI_SUFFIX -#endif - -#endif // BOOST_CONTEXT_CONTINUATION_H diff --git a/contrib/restricted/boost/context/include/boost/context/continuation_winfib.hpp b/contrib/restricted/boost/context/include/boost/context/continuation_winfib.hpp deleted file mode 100644 index 856c868469..0000000000 --- a/contrib/restricted/boost/context/include/boost/context/continuation_winfib.hpp +++ /dev/null @@ -1,473 +0,0 @@ - -// Copyright Oliver Kowalke 2017. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_CONTEXT_CONTINUATION_H -#define BOOST_CONTEXT_CONTINUATION_H - -#include <windows.h> - -#include <boost/context/detail/config.hpp> - -#include <algorithm> -#include <cstddef> -#include <cstdint> -#include <cstdlib> -#include <cstring> -#include <functional> -#include <memory> -#include <ostream> -#include <system_error> -#include <tuple> -#include <utility> - -#include <boost/assert.hpp> -#include <boost/config.hpp> - -#include <boost/context/detail/disable_overload.hpp> -#if defined(BOOST_NO_CXX14_STD_EXCHANGE) -#include <boost/context/detail/exchange.hpp> -#endif -#if defined(BOOST_NO_CXX17_STD_INVOKE) -#include <boost/context/detail/invoke.hpp> -#endif -#include <boost/context/fixedsize_stack.hpp> -#include <boost/context/flags.hpp> -#include <boost/context/preallocated.hpp> -#include <boost/context/stack_context.hpp> - -#ifdef BOOST_HAS_ABI_HEADERS -# include BOOST_ABI_PREFIX -#endif - -#if defined(BOOST_MSVC) -# pragma warning(push) -# pragma warning(disable: 4702) -#endif - -namespace boost { -namespace context { -namespace detail { - -// tampoline function -// entered if the execution context -// is resumed for the first time -template< typename Record > -static VOID WINAPI entry_func( LPVOID data) noexcept { - Record * record = static_cast< Record * >( data); - BOOST_ASSERT( nullptr != record); - // start execution of toplevel context-function - record->run(); -} - -struct BOOST_CONTEXT_DECL activation_record { - LPVOID fiber{ nullptr }; - stack_context sctx{}; - bool main_ctx{ true }; - activation_record * from{ nullptr }; - std::function< activation_record*(activation_record*&) > ontop{}; - bool terminated{ false }; - bool force_unwind{ false }; - - static activation_record *& current() noexcept; - - // used for toplevel-context - // (e.g. main context, thread-entry context) - activation_record() noexcept { -#if ( _WIN32_WINNT > 0x0600) - if ( ::IsThreadAFiber() ) { - fiber = ::GetCurrentFiber(); - } else { - fiber = ::ConvertThreadToFiber( nullptr); - } -#else - fiber = ::ConvertThreadToFiber( nullptr); - if ( BOOST_UNLIKELY( nullptr == fiber) ) { - DWORD err = ::GetLastError(); - BOOST_ASSERT( ERROR_ALREADY_FIBER == err); - fiber = ::GetCurrentFiber(); - BOOST_ASSERT( nullptr != fiber); - BOOST_ASSERT( reinterpret_cast< LPVOID >( 0x1E00) != fiber); - } -#endif - } - - activation_record( stack_context sctx_) noexcept : - sctx{ sctx_ }, - main_ctx{ false } { - } - - virtual ~activation_record() { - if ( BOOST_UNLIKELY( main_ctx) ) { - ::ConvertFiberToThread(); - } else { - ::DeleteFiber( fiber); - } - } - - activation_record( activation_record const&) = delete; - activation_record & operator=( activation_record const&) = delete; - - bool is_main_context() const noexcept { - return main_ctx; - } - - activation_record * resume() { - from = current(); - // store `this` in static, thread local pointer - // `this` will become the active (running) context - current() = this; - // context switch from parent context to `this`-context - // context switch - ::SwitchToFiber( fiber); -#if defined(BOOST_NO_CXX14_STD_EXCHANGE) - return detail::exchange( current()->from, nullptr); -#else - return std::exchange( current()->from, nullptr); -#endif - } - - template< typename Ctx, typename Fn > - activation_record * resume_with( Fn && fn) { - from = current(); - // store `this` in static, thread local pointer - // `this` will become the active (running) context - // returned by continuation::current() - current() = this; -#if defined(BOOST_NO_CXX14_GENERIC_LAMBDAS) - current()->ontop = std::bind( - [](typename std::decay< Fn >::type & fn, activation_record *& ptr){ - Ctx c{ ptr }; - c = fn( std::move( c) ); - if ( ! c) { - ptr = nullptr; - } -#if defined(BOOST_NO_CXX14_STD_EXCHANGE) - return exchange( c.ptr_, nullptr); -#else - return std::exchange( c.ptr_, nullptr); -#endif - }, - std::forward< Fn >( fn), - std::placeholders::_1); -#else - current()->ontop = [fn=std::forward<Fn>(fn)](activation_record *& ptr){ - Ctx c{ ptr }; - c = fn( std::move( c) ); - if ( ! c) { - ptr = nullptr; - } -#if defined(BOOST_NO_CXX14_STD_EXCHANGE) - return exchange( c.ptr_, nullptr); -#else - return std::exchange( c.ptr_, nullptr); -#endif - }; -#endif - // context switch - ::SwitchToFiber( fiber); -#if defined(BOOST_NO_CXX14_STD_EXCHANGE) - return detail::exchange( current()->from, nullptr); -#else - return std::exchange( current()->from, nullptr); -#endif - } - - virtual void deallocate() noexcept { - } -}; - -struct BOOST_CONTEXT_DECL activation_record_initializer { - activation_record_initializer() noexcept; - ~activation_record_initializer(); -}; - -struct forced_unwind { - activation_record * from{ nullptr }; - - explicit forced_unwind( activation_record * from_) : - from{ from_ } { - } -}; - -template< typename Ctx, typename StackAlloc, typename Fn > -class capture_record : public activation_record { -private: - typename std::decay< StackAlloc >::type salloc_; - typename std::decay< Fn >::type fn_; - - static void destroy( capture_record * p) noexcept { - typename std::decay< StackAlloc >::type salloc = std::move( p->salloc_); - stack_context sctx = p->sctx; - // deallocate activation record - p->~capture_record(); - // destroy stack with stack allocator - salloc.deallocate( sctx); - } - -public: - capture_record( stack_context sctx, StackAlloc && salloc, Fn && fn) noexcept : - activation_record( sctx), - salloc_( std::forward< StackAlloc >( salloc)), - fn_( std::forward< Fn >( fn) ) { - } - - void deallocate() noexcept override final { - BOOST_ASSERT( main_ctx || ( ! main_ctx && terminated) ); - destroy( this); - } - - void run() { - Ctx c{ from }; - try { - // invoke context-function -#if defined(BOOST_NO_CXX17_STD_INVOKE) - c = boost::context::detail::invoke( fn_, std::move( c) ); -#else - c = std::invoke( fn_, std::move( c) ); -#endif - } catch ( forced_unwind const& ex) { - c = Ctx{ ex.from }; - } - // this context has finished its task - from = nullptr; - ontop = nullptr; - terminated = true; - force_unwind = false; - c.resume(); - BOOST_ASSERT_MSG( false, "continuation already terminated"); - } -}; - -template< typename Ctx, typename StackAlloc, typename Fn > -static activation_record * create_context1( StackAlloc && salloc, Fn && fn) { - typedef capture_record< Ctx, StackAlloc, Fn > capture_t; - - auto sctx = salloc.allocate(); - BOOST_ASSERT( ( sizeof( capture_t) ) < sctx.size); - // reserve space for control structure - void * storage = reinterpret_cast< void * >( - ( reinterpret_cast< uintptr_t >( sctx.sp) - static_cast< uintptr_t >( sizeof( capture_t) ) ) - & ~ static_cast< uintptr_t >( 0xff) ); - // placment new for control structure on context stack - capture_t * record = new ( storage) capture_t{ - sctx, std::forward< StackAlloc >( salloc), std::forward< Fn >( fn) }; - // create user-context - record->fiber = ::CreateFiber( sctx.size, & detail::entry_func< capture_t >, record); - return record; -} - -template< typename Ctx, typename StackAlloc, typename Fn > -static activation_record * create_context2( preallocated palloc, StackAlloc && salloc, Fn && fn) { - typedef capture_record< Ctx, StackAlloc, Fn > capture_t; - - BOOST_ASSERT( ( sizeof( capture_t) ) < palloc.size); - // reserve space for control structure - void * storage = reinterpret_cast< void * >( - ( reinterpret_cast< uintptr_t >( palloc.sp) - static_cast< uintptr_t >( sizeof( capture_t) ) ) - & ~ static_cast< uintptr_t >( 0xff) ); - // placment new for control structure on context stack - capture_t * record = new ( storage) capture_t{ - palloc.sctx, std::forward< StackAlloc >( salloc), std::forward< Fn >( fn) }; - // create user-context - record->fiber = ::CreateFiber( palloc.sctx.size, & detail::entry_func< capture_t >, record); - return record; -} - -} - -class BOOST_CONTEXT_DECL continuation { -private: - friend struct detail::activation_record; - - template< typename Ctx, typename StackAlloc, typename Fn > - friend class detail::capture_record; - - template< typename Ctx, typename StackAlloc, typename Fn > - friend detail::activation_record * detail::create_context1( StackAlloc &&, Fn &&); - - template< typename Ctx, typename StackAlloc, typename Fn > - friend detail::activation_record * detail::create_context2( preallocated, StackAlloc &&, Fn &&); - - template< typename StackAlloc, typename Fn > - friend continuation - callcc( std::allocator_arg_t, StackAlloc &&, Fn &&); - - template< typename StackAlloc, typename Fn > - friend continuation - callcc( std::allocator_arg_t, preallocated, StackAlloc &&, Fn &&); - - detail::activation_record * ptr_{ nullptr }; - - continuation( detail::activation_record * ptr) noexcept : - ptr_{ ptr } { - } - -public: - continuation() = default; - - ~continuation() { - if ( BOOST_UNLIKELY( nullptr != ptr_) && ! ptr_->main_ctx) { - if ( BOOST_LIKELY( ! ptr_->terminated) ) { - ptr_->force_unwind = true; - ptr_->resume(); - BOOST_ASSERT( ptr_->terminated); - } - ptr_->deallocate(); - } - } - - continuation( continuation const&) = delete; - continuation & operator=( continuation const&) = delete; - - continuation( continuation && other) noexcept { - swap( other); - } - - continuation & operator=( continuation && other) noexcept { - if ( BOOST_LIKELY( this != & other) ) { - continuation tmp = std::move( other); - swap( tmp); - } - return * this; - } - - continuation resume() & { - return std::move( * this).resume(); - } - - continuation resume() && { -#if defined(BOOST_NO_CXX14_STD_EXCHANGE) - detail::activation_record * ptr = detail::exchange( ptr_, nullptr)->resume(); -#else - detail::activation_record * ptr = std::exchange( ptr_, nullptr)->resume(); -#endif - if ( BOOST_UNLIKELY( detail::activation_record::current()->force_unwind) ) { - throw detail::forced_unwind{ ptr}; - } else if ( BOOST_UNLIKELY( nullptr != detail::activation_record::current()->ontop) ) { - ptr = detail::activation_record::current()->ontop( ptr); - detail::activation_record::current()->ontop = nullptr; - } - return { ptr }; - } - - template< typename Fn > - continuation resume_with( Fn && fn) & { - return std::move( * this).resume_with( std::forward< Fn >( fn) ); - } - - template< typename Fn > - continuation resume_with( Fn && fn) && { -#if defined(BOOST_NO_CXX14_STD_EXCHANGE) - detail::activation_record * ptr = - detail::exchange( ptr_, nullptr)->resume_with< continuation >( std::forward< Fn >( fn) ); -#else - detail::activation_record * ptr = - std::exchange( ptr_, nullptr)->resume_with< continuation >( std::forward< Fn >( fn) ); -#endif - if ( BOOST_UNLIKELY( detail::activation_record::current()->force_unwind) ) { - throw detail::forced_unwind{ ptr}; - } else if ( BOOST_UNLIKELY( nullptr != detail::activation_record::current()->ontop) ) { - ptr = detail::activation_record::current()->ontop( ptr); - detail::activation_record::current()->ontop = nullptr; - } - return { ptr }; - } - - explicit operator bool() const noexcept { - return nullptr != ptr_ && ! ptr_->terminated; - } - - bool operator!() const noexcept { - return nullptr == ptr_ || ptr_->terminated; - } - - bool operator<( continuation const& other) const noexcept { - return ptr_ < other.ptr_; - } - - #if !defined(BOOST_EMBTC) - - template< typename charT, class traitsT > - friend std::basic_ostream< charT, traitsT > & - operator<<( std::basic_ostream< charT, traitsT > & os, continuation const& other) { - if ( nullptr != other.ptr_) { - return os << other.ptr_; - } else { - return os << "{not-a-context}"; - } - } - - #else - - template< typename charT, class traitsT > - friend std::basic_ostream< charT, traitsT > & - operator<<( std::basic_ostream< charT, traitsT > & os, continuation const& other); - - #endif - - void swap( continuation & other) noexcept { - std::swap( ptr_, other.ptr_); - } -}; - -#if defined(BOOST_EMBTC) - - template< typename charT, class traitsT > - inline std::basic_ostream< charT, traitsT > & - operator<<( std::basic_ostream< charT, traitsT > & os, continuation const& other) { - if ( nullptr != other.ptr_) { - return os << other.ptr_; - } else { - return os << "{not-a-context}"; - } - } - -#endif - -template< - typename Fn, - typename = detail::disable_overload< continuation, Fn > -> -continuation -callcc( Fn && fn) { - return callcc( - std::allocator_arg, - fixedsize_stack(), - std::forward< Fn >( fn) ); -} - -template< typename StackAlloc, typename Fn > -continuation -callcc( std::allocator_arg_t, StackAlloc && salloc, Fn && fn) { - return continuation{ - detail::create_context1< continuation >( - std::forward< StackAlloc >( salloc), std::forward< Fn >( fn) ) }.resume(); -} - -template< typename StackAlloc, typename Fn > -continuation -callcc( std::allocator_arg_t, preallocated palloc, StackAlloc && salloc, Fn && fn) { - return continuation{ - detail::create_context2< continuation >( - palloc, std::forward< StackAlloc >( salloc), std::forward< Fn >( fn) ) }.resume(); -} - -inline -void swap( continuation & l, continuation & r) noexcept { - l.swap( r); -} - -}} - -#if defined(BOOST_MSVC) -# pragma warning(pop) -#endif - -#ifdef BOOST_HAS_ABI_HEADERS -# include BOOST_ABI_SUFFIX -#endif - -#endif // BOOST_CONTEXT_CONTINUATION_H diff --git a/contrib/restricted/boost/context/include/boost/context/detail/disable_overload.hpp b/contrib/restricted/boost/context/include/boost/context/detail/disable_overload.hpp deleted file mode 100644 index c88f916e39..0000000000 --- a/contrib/restricted/boost/context/include/boost/context/detail/disable_overload.hpp +++ /dev/null @@ -1,40 +0,0 @@ - -// Copyright Oliver Kowalke 2014. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_CONTEXT_DETAIL_DISABLE_OVERLOAD_H -#define BOOST_CONTEXT_DETAIL_DISABLE_OVERLOAD_H - -#include <type_traits> - -#include <boost/config.hpp> - -#include <boost/context/detail/config.hpp> - -#ifdef BOOST_HAS_ABI_HEADERS -# include BOOST_ABI_PREFIX -#endif - -namespace boost { -namespace context { -namespace detail { - -// http://ericniebler.com/2013/08/07/universal-references-and-the-copy-constructo/ -template< typename X, typename Y > -using disable_overload = - typename std::enable_if< - ! std::is_base_of< - X, - typename std::decay< Y >::type - >::value - >::type; - -}}} - -#ifdef BOOST_HAS_ABI_HEADERS -#include BOOST_ABI_SUFFIX -#endif - -#endif // BOOST_CONTEXT_DETAIL_DISABLE_OVERLOAD_H diff --git a/contrib/restricted/boost/context/include/boost/context/detail/exchange.hpp b/contrib/restricted/boost/context/include/boost/context/detail/exchange.hpp deleted file mode 100644 index c5ee91284e..0000000000 --- a/contrib/restricted/boost/context/include/boost/context/detail/exchange.hpp +++ /dev/null @@ -1,36 +0,0 @@ - -// Copyright Oliver Kowalke 2014. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_CONTEXT_DETAIL_EXCHANGE_H -#define BOOST_CONTEXT_DETAIL_EXCHANGE_H - -#include <algorithm> -#include <utility> - -#include <boost/config.hpp> - -#ifdef BOOST_HAS_ABI_HEADERS -# include BOOST_ABI_PREFIX -#endif - -namespace boost { -namespace context { -namespace detail { - -template< typename T, typename U = T > -T exchange( T & t, U && nv) { - T ov = std::move( t); - t = std::forward< U >( nv); - return ov; -} - -}}} - -#ifdef BOOST_HAS_ABI_HEADERS -#include BOOST_ABI_SUFFIX -#endif - -#endif // BOOST_CONTEXT_DETAIL_EXCHANGE_H diff --git a/contrib/restricted/boost/context/include/boost/context/detail/externc.hpp b/contrib/restricted/boost/context/include/boost/context/detail/externc.hpp deleted file mode 100644 index 850bc1a3d7..0000000000 --- a/contrib/restricted/boost/context/include/boost/context/detail/externc.hpp +++ /dev/null @@ -1,23 +0,0 @@ - -// Copyright Oliver Kowalke 2014. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// - -#include <boost/config.hpp> -#include <boost/context/detail/config.hpp> - -#if defined(BOOST_USE_ASAN) -extern "C" { -void __sanitizer_start_switch_fiber( void **, const void *, size_t); -void __sanitizer_finish_switch_fiber( void *, const void **, size_t *); -} -#endif - -#if defined(BOOST_USE_SEGMENTED_STACKS) -extern "C" { -void __splitstack_getcontext( void * [BOOST_CONTEXT_SEGMENTS]); -void __splitstack_setcontext( void * [BOOST_CONTEXT_SEGMENTS]); -} -#endif diff --git a/contrib/restricted/boost/context/include/boost/context/detail/invoke.hpp b/contrib/restricted/boost/context/include/boost/context/detail/invoke.hpp deleted file mode 100644 index 9173cbc793..0000000000 --- a/contrib/restricted/boost/context/include/boost/context/detail/invoke.hpp +++ /dev/null @@ -1,50 +0,0 @@ - -// Copyright Oliver Kowalke 2014. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_CONTEXT_DETAIL_INVOKE_H -#define BOOST_CONTEXT_DETAIL_INVOKE_H - -#include <functional> -#include <type_traits> -#include <utility> - -#include <boost/config.hpp> - -#include <boost/context/detail/config.hpp> - -#ifdef BOOST_HAS_ABI_HEADERS -# include BOOST_ABI_PREFIX -#endif - -namespace boost { -namespace context { -namespace detail { - -template< typename Fn, typename ... Args > -typename std::enable_if< - std::is_member_pointer< typename std::decay< Fn >::type >::value, - typename std::result_of< Fn &&( Args && ... ) >::type ->::type -invoke( Fn && fn, Args && ... args) { - return std::mem_fn( fn)( std::forward< Args >( args) ... ); -} - -template< typename Fn, typename ... Args > -typename std::enable_if< - ! std::is_member_pointer< typename std::decay< Fn >::type >::value, - typename std::result_of< Fn &&( Args && ... ) >::type ->::type -invoke( Fn && fn, Args && ... args) { - return std::forward< Fn >( fn)( std::forward< Args >( args) ... ); -} - -}}} - -#ifdef BOOST_HAS_ABI_HEADERS -#include BOOST_ABI_SUFFIX -#endif - -#endif // BOOST_CONTEXT_DETAIL_INVOKE_H diff --git a/contrib/restricted/boost/context/include/boost/context/fiber_ucontext.hpp b/contrib/restricted/boost/context/include/boost/context/fiber_ucontext.hpp deleted file mode 100644 index 696ce58084..0000000000 --- a/contrib/restricted/boost/context/include/boost/context/fiber_ucontext.hpp +++ /dev/null @@ -1,558 +0,0 @@ - -// Copyright Oliver Kowalke 2017. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_CONTEXT_FIBER_H -#define BOOST_CONTEXT_FIBER_H - -#include <boost/predef.h> -#if BOOST_OS_MACOS -#define _XOPEN_SOURCE 600 -#endif - -extern "C" { -#include <ucontext.h> -} - -#include <boost/context/detail/config.hpp> - -#include <algorithm> -#include <cstddef> -#include <cstdint> -#include <cstdlib> -#include <cstring> -#include <functional> -#include <memory> -#include <ostream> -#include <system_error> -#include <tuple> -#include <utility> - -#include <boost/assert.hpp> -#include <boost/config.hpp> -#include <boost/predef.h> - -#include <boost/context/detail/disable_overload.hpp> -#if defined(BOOST_NO_CXX14_STD_EXCHANGE) -#include <boost/context/detail/exchange.hpp> -#endif -#include <boost/context/detail/externc.hpp> -#if defined(BOOST_NO_CXX17_STD_INVOKE) -#include <boost/context/detail/invoke.hpp> -#endif -#include <boost/context/fixedsize_stack.hpp> -#include <boost/context/flags.hpp> -#include <boost/context/preallocated.hpp> -#if defined(BOOST_USE_SEGMENTED_STACKS) -#include <boost/context/segmented_stack.hpp> -#endif -#include <boost/context/stack_context.hpp> - -#ifdef BOOST_HAS_ABI_HEADERS -# include BOOST_ABI_PREFIX -#endif - -#ifdef BOOST_USE_TSAN -#include <sanitizer/tsan_interface.h> -#endif - -namespace boost { -namespace context { -namespace detail { - -// tampoline function -// entered if the execution context -// is resumed for the first time -template< typename Record > -static void fiber_entry_func( void * data) noexcept { - Record * record = static_cast< Record * >( data); - BOOST_ASSERT( nullptr != record); - // start execution of toplevel context-function - record->run(); -} - -struct BOOST_CONTEXT_DECL fiber_activation_record { - ucontext_t uctx{}; - stack_context sctx{}; - bool main_ctx{ true }; - fiber_activation_record * from{ nullptr }; - std::function< fiber_activation_record*(fiber_activation_record*&) > ontop{}; - bool terminated{ false }; - bool force_unwind{ false }; -#if defined(BOOST_USE_ASAN) - void * fake_stack{ nullptr }; - void * stack_bottom{ nullptr }; - std::size_t stack_size{ 0 }; -#endif - -#if defined(BOOST_USE_TSAN) - void * tsan_fiber{ nullptr }; - bool destroy_tsan_fiber{ true }; -#endif - - static fiber_activation_record *& current() noexcept; - - // used for toplevel-context - // (e.g. main context, thread-entry context) - fiber_activation_record() { - if ( BOOST_UNLIKELY( 0 != ::getcontext( & uctx) ) ) { - throw std::system_error( - std::error_code( errno, std::system_category() ), - "getcontext() failed"); - } - -#if defined(BOOST_USE_TSAN) - tsan_fiber = __tsan_get_current_fiber(); - destroy_tsan_fiber = false; -#endif - } - - fiber_activation_record( stack_context sctx_) noexcept : - sctx( sctx_ ), - main_ctx( false ) { - } - - virtual ~fiber_activation_record() { -#if defined(BOOST_USE_TSAN) - if (destroy_tsan_fiber) - __tsan_destroy_fiber(tsan_fiber); -#endif - } - - fiber_activation_record( fiber_activation_record const&) = delete; - fiber_activation_record & operator=( fiber_activation_record const&) = delete; - - bool is_main_context() const noexcept { - return main_ctx; - } - - fiber_activation_record * resume() { - from = current(); - // store `this` in static, thread local pointer - // `this` will become the active (running) context - current() = this; -#if defined(BOOST_USE_SEGMENTED_STACKS) - // adjust segmented stack properties - __splitstack_getcontext( from->sctx.segments_ctx); - __splitstack_setcontext( sctx.segments_ctx); -#endif -#if defined(BOOST_USE_ASAN) - if ( terminated) { - __sanitizer_start_switch_fiber( nullptr, stack_bottom, stack_size); - } else { - __sanitizer_start_switch_fiber( & from->fake_stack, stack_bottom, stack_size); - } -#endif -#if defined (BOOST_USE_TSAN) - __tsan_switch_to_fiber(tsan_fiber, 0); -#endif - // context switch from parent context to `this`-context - ::swapcontext( & from->uctx, & uctx); -#if defined(BOOST_USE_ASAN) - __sanitizer_finish_switch_fiber( current()->fake_stack, - (const void **) & current()->from->stack_bottom, - & current()->from->stack_size); -#endif -#if defined(BOOST_NO_CXX14_STD_EXCHANGE) - return exchange( current()->from, nullptr); -#else - return std::exchange( current()->from, nullptr); -#endif - } - - template< typename Ctx, typename Fn > - fiber_activation_record * resume_with( Fn && fn) { - from = current(); - // store `this` in static, thread local pointer - // `this` will become the active (running) context - // returned by fiber::current() - current() = this; -#if defined(BOOST_NO_CXX14_GENERIC_LAMBDAS) - current()->ontop = std::bind( - [](typename std::decay< Fn >::type & fn, fiber_activation_record *& ptr){ - Ctx c{ ptr }; - c = fn( std::move( c) ); - if ( ! c) { - ptr = nullptr; - } -#if defined(BOOST_NO_CXX14_STD_EXCHANGE) - return exchange( c.ptr_, nullptr); -#else - return std::exchange( c.ptr_, nullptr); -#endif - }, - std::forward< Fn >( fn), - std::placeholders::_1); -#else - current()->ontop = [fn=std::forward<Fn>(fn)](fiber_activation_record *& ptr){ - Ctx c{ ptr }; - c = fn( std::move( c) ); - if ( ! c) { - ptr = nullptr; - } -#if defined(BOOST_NO_CXX14_STD_EXCHANGE) - return exchange( c.ptr_, nullptr); -#else - return std::exchange( c.ptr_, nullptr); -#endif - }; -#endif -#if defined(BOOST_USE_SEGMENTED_STACKS) - // adjust segmented stack properties - __splitstack_getcontext( from->sctx.segments_ctx); - __splitstack_setcontext( sctx.segments_ctx); -#endif -#if defined(BOOST_USE_ASAN) - __sanitizer_start_switch_fiber( & from->fake_stack, stack_bottom, stack_size); -#endif -#if defined (BOOST_USE_TSAN) - __tsan_switch_to_fiber(tsan_fiber, 0); -#endif - // context switch from parent context to `this`-context - ::swapcontext( & from->uctx, & uctx); -#if defined(BOOST_USE_ASAN) - __sanitizer_finish_switch_fiber( current()->fake_stack, - (const void **) & current()->from->stack_bottom, - & current()->from->stack_size); -#endif -#if defined(BOOST_NO_CXX14_STD_EXCHANGE) - return exchange( current()->from, nullptr); -#else - return std::exchange( current()->from, nullptr); -#endif - } - - virtual void deallocate() noexcept { - } -}; - -struct BOOST_CONTEXT_DECL fiber_activation_record_initializer { - fiber_activation_record_initializer() noexcept; - ~fiber_activation_record_initializer(); -}; - -struct forced_unwind { - fiber_activation_record * from{ nullptr }; - - forced_unwind( fiber_activation_record * from_) noexcept : - from{ from_ } { - } -}; - -template< typename Ctx, typename StackAlloc, typename Fn > -class fiber_capture_record : public fiber_activation_record { -private: - typename std::decay< StackAlloc >::type salloc_; - typename std::decay< Fn >::type fn_; - - static void destroy( fiber_capture_record * p) noexcept { - typename std::decay< StackAlloc >::type salloc = std::move( p->salloc_); - stack_context sctx = p->sctx; - // deallocate activation record - p->~fiber_capture_record(); - // destroy stack with stack allocator - salloc.deallocate( sctx); - } - -public: - fiber_capture_record( stack_context sctx, StackAlloc && salloc, Fn && fn) noexcept : - fiber_activation_record{ sctx }, - salloc_{ std::forward< StackAlloc >( salloc) }, - fn_( std::forward< Fn >( fn) ) { - } - - void deallocate() noexcept override final { - BOOST_ASSERT( main_ctx || ( ! main_ctx && terminated) ); - destroy( this); - } - - void run() { -#if defined(BOOST_USE_ASAN) - __sanitizer_finish_switch_fiber( fake_stack, - (const void **) & from->stack_bottom, - & from->stack_size); -#endif - Ctx c{ from }; - try { - // invoke context-function -#if defined(BOOST_NO_CXX17_STD_INVOKE) - c = boost::context::detail::invoke( fn_, std::move( c) ); -#else - c = std::invoke( fn_, std::move( c) ); -#endif - } catch ( forced_unwind const& ex) { - c = Ctx{ ex.from }; - } - // this context has finished its task - from = nullptr; - ontop = nullptr; - terminated = true; - force_unwind = false; - std::move( c).resume(); - BOOST_ASSERT_MSG( false, "fiber already terminated"); - } -}; - -template< typename Ctx, typename StackAlloc, typename Fn > -static fiber_activation_record * create_fiber1( StackAlloc && salloc, Fn && fn) { - typedef fiber_capture_record< Ctx, StackAlloc, Fn > capture_t; - - auto sctx = salloc.allocate(); - // reserve space for control structure - void * storage = reinterpret_cast< void * >( - ( reinterpret_cast< uintptr_t >( sctx.sp) - static_cast< uintptr_t >( sizeof( capture_t) ) ) - & ~ static_cast< uintptr_t >( 0xff) ); - // placment new for control structure on context stack - capture_t * record = new ( storage) capture_t{ - sctx, std::forward< StackAlloc >( salloc), std::forward< Fn >( fn) }; - // stack bottom - void * stack_bottom = reinterpret_cast< void * >( - reinterpret_cast< uintptr_t >( sctx.sp) - static_cast< uintptr_t >( sctx.size) ); - // create user-context - if ( BOOST_UNLIKELY( 0 != ::getcontext( & record->uctx) ) ) { - record->~capture_t(); - salloc.deallocate( sctx); - throw std::system_error( - std::error_code( errno, std::system_category() ), - "getcontext() failed"); - } -#if BOOST_OS_BSD_FREE - // because FreeBSD defines stack_t::ss_sp as char * - record->uctx.uc_stack.ss_sp = static_cast< char * >( stack_bottom); -#else - record->uctx.uc_stack.ss_sp = stack_bottom; -#endif - // 64byte gap between control structure and stack top - record->uctx.uc_stack.ss_size = reinterpret_cast< uintptr_t >( storage) - - reinterpret_cast< uintptr_t >( stack_bottom) - static_cast< uintptr_t >( 64); - record->uctx.uc_link = nullptr; - ::makecontext( & record->uctx, ( void (*)() ) & fiber_entry_func< capture_t >, 1, record); -#if defined(BOOST_USE_ASAN) - record->stack_bottom = record->uctx.uc_stack.ss_sp; - record->stack_size = record->uctx.uc_stack.ss_size; -#endif -#if defined (BOOST_USE_TSAN) - record->tsan_fiber = __tsan_create_fiber(0); -#endif - return record; -} - -template< typename Ctx, typename StackAlloc, typename Fn > -static fiber_activation_record * create_fiber2( preallocated palloc, StackAlloc && salloc, Fn && fn) { - typedef fiber_capture_record< Ctx, StackAlloc, Fn > capture_t; - - // reserve space for control structure - void * storage = reinterpret_cast< void * >( - ( reinterpret_cast< uintptr_t >( palloc.sp) - static_cast< uintptr_t >( sizeof( capture_t) ) ) - & ~ static_cast< uintptr_t >( 0xff) ); - // placment new for control structure on context stack - capture_t * record = new ( storage) capture_t{ - palloc.sctx, std::forward< StackAlloc >( salloc), std::forward< Fn >( fn) }; - // stack bottom - void * stack_bottom = reinterpret_cast< void * >( - reinterpret_cast< uintptr_t >( palloc.sctx.sp) - static_cast< uintptr_t >( palloc.sctx.size) ); - // create user-context - if ( BOOST_UNLIKELY( 0 != ::getcontext( & record->uctx) ) ) { - record->~capture_t(); - salloc.deallocate( palloc.sctx); - throw std::system_error( - std::error_code( errno, std::system_category() ), - "getcontext() failed"); - } -#if BOOST_OS_BSD_FREE - // because FreeBSD defines stack_t::ss_sp as char * - record->uctx.uc_stack.ss_sp = static_cast< char * >( stack_bottom); -#else - record->uctx.uc_stack.ss_sp = stack_bottom; -#endif - // 64byte gap between control structure and stack top - record->uctx.uc_stack.ss_size = reinterpret_cast< uintptr_t >( storage) - - reinterpret_cast< uintptr_t >( stack_bottom) - static_cast< uintptr_t >( 64); - record->uctx.uc_link = nullptr; - ::makecontext( & record->uctx, ( void (*)() ) & fiber_entry_func< capture_t >, 1, record); -#if defined(BOOST_USE_ASAN) - record->stack_bottom = record->uctx.uc_stack.ss_sp; - record->stack_size = record->uctx.uc_stack.ss_size; -#endif -#if defined (BOOST_USE_TSAN) - record->tsan_fiber = __tsan_create_fiber(0); -#endif - return record; -} - -} - -class BOOST_CONTEXT_DECL fiber { -private: - friend struct detail::fiber_activation_record; - - template< typename Ctx, typename StackAlloc, typename Fn > - friend class detail::fiber_capture_record; - - template< typename Ctx, typename StackAlloc, typename Fn > - friend detail::fiber_activation_record * detail::create_fiber1( StackAlloc &&, Fn &&); - - template< typename Ctx, typename StackAlloc, typename Fn > - friend detail::fiber_activation_record * detail::create_fiber2( preallocated, StackAlloc &&, Fn &&); - - detail::fiber_activation_record * ptr_{ nullptr }; - - fiber( detail::fiber_activation_record * ptr) noexcept : - ptr_{ ptr } { - } - -public: - fiber() = default; - - template< typename Fn, typename = detail::disable_overload< fiber, Fn > > - fiber( Fn && fn) : - fiber{ - std::allocator_arg, -#if defined(BOOST_USE_SEGMENTED_STACKS) - segmented_stack(), -#else - fixedsize_stack(), -#endif - std::forward< Fn >( fn) } { - } - - template< typename StackAlloc, typename Fn > - fiber( std::allocator_arg_t, StackAlloc && salloc, Fn && fn) : - ptr_{ detail::create_fiber1< fiber >( - std::forward< StackAlloc >( salloc), std::forward< Fn >( fn) ) } { - } - - template< typename StackAlloc, typename Fn > - fiber( std::allocator_arg_t, preallocated palloc, StackAlloc && salloc, Fn && fn) : - ptr_{ detail::create_fiber2< fiber >( - palloc, std::forward< StackAlloc >( salloc), std::forward< Fn >( fn) ) } { - } - - ~fiber() { - if ( BOOST_UNLIKELY( nullptr != ptr_) && ! ptr_->main_ctx) { - if ( BOOST_LIKELY( ! ptr_->terminated) ) { - ptr_->force_unwind = true; - ptr_->resume(); - BOOST_ASSERT( ptr_->terminated); - } - ptr_->deallocate(); - } - } - - fiber( fiber const&) = delete; - fiber & operator=( fiber const&) = delete; - - fiber( fiber && other) noexcept { - swap( other); - } - - fiber & operator=( fiber && other) noexcept { - if ( BOOST_LIKELY( this != & other) ) { - fiber tmp = std::move( other); - swap( tmp); - } - return * this; - } - - fiber resume() && { - BOOST_ASSERT( nullptr != ptr_); -#if defined(BOOST_NO_CXX14_STD_EXCHANGE) - detail::fiber_activation_record * ptr = detail::exchange( ptr_, nullptr)->resume(); -#else - detail::fiber_activation_record * ptr = std::exchange( ptr_, nullptr)->resume(); -#endif - if ( BOOST_UNLIKELY( detail::fiber_activation_record::current()->force_unwind) ) { - throw detail::forced_unwind{ ptr}; - } else if ( BOOST_UNLIKELY( nullptr != detail::fiber_activation_record::current()->ontop) ) { - ptr = detail::fiber_activation_record::current()->ontop( ptr); - detail::fiber_activation_record::current()->ontop = nullptr; - } - return { ptr }; - } - - template< typename Fn > - fiber resume_with( Fn && fn) && { - BOOST_ASSERT( nullptr != ptr_); -#if defined(BOOST_NO_CXX14_STD_EXCHANGE) - detail::fiber_activation_record * ptr = - detail::exchange( ptr_, nullptr)->resume_with< fiber >( std::forward< Fn >( fn) ); -#else - detail::fiber_activation_record * ptr = - std::exchange( ptr_, nullptr)->resume_with< fiber >( std::forward< Fn >( fn) ); -#endif - if ( BOOST_UNLIKELY( detail::fiber_activation_record::current()->force_unwind) ) { - throw detail::forced_unwind{ ptr}; - } else if ( BOOST_UNLIKELY( nullptr != detail::fiber_activation_record::current()->ontop) ) { - ptr = detail::fiber_activation_record::current()->ontop( ptr); - detail::fiber_activation_record::current()->ontop = nullptr; - } - return { ptr }; - } - - explicit operator bool() const noexcept { - return nullptr != ptr_ && ! ptr_->terminated; - } - - bool operator!() const noexcept { - return nullptr == ptr_ || ptr_->terminated; - } - - bool operator<( fiber const& other) const noexcept { - return ptr_ < other.ptr_; - } - - #if !defined(BOOST_EMBTC) - - template< typename charT, class traitsT > - friend std::basic_ostream< charT, traitsT > & - operator<<( std::basic_ostream< charT, traitsT > & os, fiber const& other) { - if ( nullptr != other.ptr_) { - return os << other.ptr_; - } else { - return os << "{not-a-context}"; - } - } - - #else - - template< typename charT, class traitsT > - friend std::basic_ostream< charT, traitsT > & - operator<<( std::basic_ostream< charT, traitsT > & os, fiber const& other); - - #endif - - void swap( fiber & other) noexcept { - std::swap( ptr_, other.ptr_); - } -}; - -#if defined(BOOST_EMBTC) - - template< typename charT, class traitsT > - inline std::basic_ostream< charT, traitsT > & - operator<<( std::basic_ostream< charT, traitsT > & os, fiber const& other) { - if ( nullptr != other.ptr_) { - return os << other.ptr_; - } else { - return os << "{not-a-context}"; - } - } - -#endif - -inline -void swap( fiber & l, fiber & r) noexcept { - l.swap( r); -} - -typedef fiber fiber_context; - -}} - -#ifdef BOOST_HAS_ABI_HEADERS -# include BOOST_ABI_SUFFIX -#endif - -#endif // BOOST_CONTEXT_FIBER_H diff --git a/contrib/restricted/boost/context/include/boost/context/fiber_winfib.hpp b/contrib/restricted/boost/context/include/boost/context/fiber_winfib.hpp deleted file mode 100644 index cd496d1be1..0000000000 --- a/contrib/restricted/boost/context/include/boost/context/fiber_winfib.hpp +++ /dev/null @@ -1,450 +0,0 @@ - -// Copyright Oliver Kowalke 2017. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_CONTEXT_FIBER_H -#define BOOST_CONTEXT_FIBER_H - -#include <windows.h> - -#include <boost/context/detail/config.hpp> - -#include <algorithm> -#include <cstddef> -#include <cstdint> -#include <cstdlib> -#include <cstring> -#include <functional> -#include <memory> -#include <ostream> -#include <system_error> -#include <tuple> -#include <utility> - -#include <boost/assert.hpp> -#include <boost/config.hpp> - -#include <boost/context/detail/disable_overload.hpp> -#if defined(BOOST_NO_CXX14_STD_EXCHANGE) -#include <boost/context/detail/exchange.hpp> -#endif -#if defined(BOOST_NO_CXX17_STD_INVOKE) -#include <boost/context/detail/invoke.hpp> -#endif -#include <boost/context/fixedsize_stack.hpp> -#include <boost/context/flags.hpp> -#include <boost/context/preallocated.hpp> -#include <boost/context/stack_context.hpp> - -#ifdef BOOST_HAS_ABI_HEADERS -# include BOOST_ABI_PREFIX -#endif - -#if defined(BOOST_MSVC) -# pragma warning(push) -# pragma warning(disable: 4702) -#endif - -namespace boost { -namespace context { -namespace detail { - -// tampoline function -// entered if the execution context -// is resumed for the first time -template< typename Record > -static VOID WINAPI fiber_entry_func( LPVOID data) noexcept { - Record * record = static_cast< Record * >( data); - BOOST_ASSERT( nullptr != record); - // start execution of toplevel context-function - record->run(); -} - -struct BOOST_CONTEXT_DECL fiber_activation_record { - LPVOID fiber{ nullptr }; - stack_context sctx{}; - bool main_ctx{ true }; - fiber_activation_record * from{ nullptr }; - std::function< fiber_activation_record*(fiber_activation_record*&) > ontop{}; - bool terminated{ false }; - bool force_unwind{ false }; - - static fiber_activation_record *& current() noexcept; - - // used for toplevel-context - // (e.g. main context, thread-entry context) - fiber_activation_record() noexcept { -#if ( _WIN32_WINNT > 0x0600) - if ( ::IsThreadAFiber() ) { - fiber = ::GetCurrentFiber(); - } else { - fiber = ::ConvertThreadToFiber( nullptr); - } -#else - fiber = ::ConvertThreadToFiber( nullptr); - if ( BOOST_UNLIKELY( nullptr == fiber) ) { - BOOST_ASSERT( ERROR_ALREADY_FIBER == ::GetLastError()); - fiber = ::GetCurrentFiber(); - BOOST_ASSERT( nullptr != fiber); - BOOST_ASSERT( reinterpret_cast< LPVOID >( 0x1E00) != fiber); - } -#endif - } - - fiber_activation_record( stack_context sctx_) noexcept : - sctx{ sctx_ }, - main_ctx{ false } { - } - - virtual ~fiber_activation_record() { - if ( BOOST_UNLIKELY( main_ctx) ) { - ::ConvertFiberToThread(); - } else { - ::DeleteFiber( fiber); - } - } - - fiber_activation_record( fiber_activation_record const&) = delete; - fiber_activation_record & operator=( fiber_activation_record const&) = delete; - - bool is_main_context() const noexcept { - return main_ctx; - } - - fiber_activation_record * resume() { - from = current(); - // store `this` in static, thread local pointer - // `this` will become the active (running) context - current() = this; - // context switch from parent context to `this`-context - // context switch - ::SwitchToFiber( fiber); -#if defined(BOOST_NO_CXX14_STD_EXCHANGE) - return detail::exchange( current()->from, nullptr); -#else - return std::exchange( current()->from, nullptr); -#endif - } - - template< typename Ctx, typename Fn > - fiber_activation_record * resume_with( Fn && fn) { - from = current(); - // store `this` in static, thread local pointer - // `this` will become the active (running) context - // returned by fiber::current() - current() = this; -#if defined(BOOST_NO_CXX14_GENERIC_LAMBDAS) - current()->ontop = std::bind( - [](typename std::decay< Fn >::type & fn, fiber_activation_record *& ptr){ - Ctx c{ ptr }; - c = fn( std::move( c) ); - if ( ! c) { - ptr = nullptr; - } -#if defined(BOOST_NO_CXX14_STD_EXCHANGE) - return exchange( c.ptr_, nullptr); -#else - return std::exchange( c.ptr_, nullptr); -#endif - }, - std::forward< Fn >( fn), - std::placeholders::_1); -#else - current()->ontop = [fn=std::forward<Fn>(fn)](fiber_activation_record *& ptr){ - Ctx c{ ptr }; - c = fn( std::move( c) ); - if ( ! c) { - ptr = nullptr; - } -#if defined(BOOST_NO_CXX14_STD_EXCHANGE) - return exchange( c.ptr_, nullptr); -#else - return std::exchange( c.ptr_, nullptr); -#endif - }; -#endif - // context switch - ::SwitchToFiber( fiber); -#if defined(BOOST_NO_CXX14_STD_EXCHANGE) - return detail::exchange( current()->from, nullptr); -#else - return std::exchange( current()->from, nullptr); -#endif - } - - virtual void deallocate() noexcept { - } -}; - -struct BOOST_CONTEXT_DECL fiber_activation_record_initializer { - fiber_activation_record_initializer() noexcept; - ~fiber_activation_record_initializer(); -}; - -struct forced_unwind { - fiber_activation_record * from{ nullptr }; - - explicit forced_unwind( fiber_activation_record * from_) : - from{ from_ } { - } -}; - -template< typename Ctx, typename StackAlloc, typename Fn > -class fiber_capture_record : public fiber_activation_record { -private: - typename std::decay< StackAlloc >::type salloc_; - typename std::decay< Fn >::type fn_; - - static void destroy( fiber_capture_record * p) noexcept { - typename std::decay< StackAlloc >::type salloc = std::move( p->salloc_); - stack_context sctx = p->sctx; - // deallocate activation record - p->~fiber_capture_record(); - // destroy stack with stack allocator - salloc.deallocate( sctx); - } - -public: - fiber_capture_record( stack_context sctx, StackAlloc && salloc, Fn && fn) noexcept : - fiber_activation_record( sctx), - salloc_( std::forward< StackAlloc >( salloc)), - fn_( std::forward< Fn >( fn) ) { - } - - void deallocate() noexcept override final { - BOOST_ASSERT( main_ctx || ( ! main_ctx && terminated) ); - destroy( this); - } - - void run() { - Ctx c{ from }; - try { - // invoke context-function -#if defined(BOOST_NO_CXX17_STD_INVOKE) - c = boost::context::detail::invoke( fn_, std::move( c) ); -#else - c = std::invoke( fn_, std::move( c) ); -#endif - } catch ( forced_unwind const& ex) { - c = Ctx{ ex.from }; - } - // this context has finished its task - from = nullptr; - ontop = nullptr; - terminated = true; - force_unwind = false; - std::move( c).resume(); - BOOST_ASSERT_MSG( false, "fiber already terminated"); - } -}; - -template< typename Ctx, typename StackAlloc, typename Fn > -static fiber_activation_record * create_fiber1( StackAlloc && salloc, Fn && fn) { - typedef fiber_capture_record< Ctx, StackAlloc, Fn > capture_t; - - auto sctx = salloc.allocate(); - BOOST_ASSERT( ( sizeof( capture_t) ) < sctx.size); - // reserve space for control structure - void * storage = reinterpret_cast< void * >( - ( reinterpret_cast< uintptr_t >( sctx.sp) - static_cast< uintptr_t >( sizeof( capture_t) ) ) - & ~ static_cast< uintptr_t >( 0xff) ); - // placment new for control structure on context stack - capture_t * record = new ( storage) capture_t{ - sctx, std::forward< StackAlloc >( salloc), std::forward< Fn >( fn) }; - // create user-context - record->fiber = ::CreateFiber( sctx.size, & detail::fiber_entry_func< capture_t >, record); - return record; -} - -template< typename Ctx, typename StackAlloc, typename Fn > -static fiber_activation_record * create_fiber2( preallocated palloc, StackAlloc && salloc, Fn && fn) { - typedef fiber_capture_record< Ctx, StackAlloc, Fn > capture_t; - - BOOST_ASSERT( ( sizeof( capture_t) ) < palloc.size); - // reserve space for control structure - void * storage = reinterpret_cast< void * >( - ( reinterpret_cast< uintptr_t >( palloc.sp) - static_cast< uintptr_t >( sizeof( capture_t) ) ) - & ~ static_cast< uintptr_t >( 0xff) ); - // placment new for control structure on context stack - capture_t * record = new ( storage) capture_t{ - palloc.sctx, std::forward< StackAlloc >( salloc), std::forward< Fn >( fn) }; - // create user-context - record->fiber = ::CreateFiber( palloc.sctx.size, & detail::fiber_entry_func< capture_t >, record); - return record; -} - -} - -class BOOST_CONTEXT_DECL fiber { -private: - friend struct detail::fiber_activation_record; - - template< typename Ctx, typename StackAlloc, typename Fn > - friend class detail::fiber_capture_record; - - template< typename Ctx, typename StackAlloc, typename Fn > - friend detail::fiber_activation_record * detail::create_fiber1( StackAlloc &&, Fn &&); - - template< typename Ctx, typename StackAlloc, typename Fn > - friend detail::fiber_activation_record * detail::create_fiber2( preallocated, StackAlloc &&, Fn &&); - - detail::fiber_activation_record * ptr_{ nullptr }; - - fiber( detail::fiber_activation_record * ptr) noexcept : - ptr_{ ptr } { - } - -public: - fiber() = default; - - template< typename Fn, typename = detail::disable_overload< fiber, Fn > > - fiber( Fn && fn) : - fiber{ std::allocator_arg, - fixedsize_stack(), - std::forward< Fn >( fn) } { - } - - template< typename StackAlloc, typename Fn > - fiber( std::allocator_arg_t, StackAlloc && salloc, Fn && fn) : - ptr_{ detail::create_fiber1< fiber >( - std::forward< StackAlloc >( salloc), std::forward< Fn >( fn) ) } {; - } - - template< typename StackAlloc, typename Fn > - fiber( std::allocator_arg_t, preallocated palloc, StackAlloc && salloc, Fn && fn) : - ptr_{ detail::create_fiber2< fiber >( - palloc, std::forward< StackAlloc >( salloc), std::forward< Fn >( fn) ) } { - } - - ~fiber() { - if ( BOOST_UNLIKELY( nullptr != ptr_) && ! ptr_->main_ctx) { - if ( BOOST_LIKELY( ! ptr_->terminated) ) { - ptr_->force_unwind = true; - ptr_->resume(); - BOOST_ASSERT( ptr_->terminated); - } - ptr_->deallocate(); - } - } - - fiber( fiber const&) = delete; - fiber & operator=( fiber const&) = delete; - - fiber( fiber && other) noexcept { - swap( other); - } - - fiber & operator=( fiber && other) noexcept { - if ( BOOST_LIKELY( this != & other) ) { - fiber tmp = std::move( other); - swap( tmp); - } - return * this; - } - - fiber resume() && { - BOOST_ASSERT( nullptr != ptr_); -#if defined(BOOST_NO_CXX14_STD_EXCHANGE) - detail::fiber_activation_record * ptr = detail::exchange( ptr_, nullptr)->resume(); -#else - detail::fiber_activation_record * ptr = std::exchange( ptr_, nullptr)->resume(); -#endif - if ( BOOST_UNLIKELY( detail::fiber_activation_record::current()->force_unwind) ) { - throw detail::forced_unwind{ ptr}; - } else if ( BOOST_UNLIKELY( nullptr != detail::fiber_activation_record::current()->ontop) ) { - ptr = detail::fiber_activation_record::current()->ontop( ptr); - detail::fiber_activation_record::current()->ontop = nullptr; - } - return { ptr }; - } - - template< typename Fn > - fiber resume_with( Fn && fn) && { - BOOST_ASSERT( nullptr != ptr_); -#if defined(BOOST_NO_CXX14_STD_EXCHANGE) - detail::fiber_activation_record * ptr = - detail::exchange( ptr_, nullptr)->resume_with< fiber >( std::forward< Fn >( fn) ); -#else - detail::fiber_activation_record * ptr = - std::exchange( ptr_, nullptr)->resume_with< fiber >( std::forward< Fn >( fn) ); -#endif - if ( BOOST_UNLIKELY( detail::fiber_activation_record::current()->force_unwind) ) { - throw detail::forced_unwind{ ptr}; - } else if ( BOOST_UNLIKELY( nullptr != detail::fiber_activation_record::current()->ontop) ) { - ptr = detail::fiber_activation_record::current()->ontop( ptr); - detail::fiber_activation_record::current()->ontop = nullptr; - } - return { ptr }; - } - - explicit operator bool() const noexcept { - return nullptr != ptr_ && ! ptr_->terminated; - } - - bool operator!() const noexcept { - return nullptr == ptr_ || ptr_->terminated; - } - - bool operator<( fiber const& other) const noexcept { - return ptr_ < other.ptr_; - } - - #if !defined(BOOST_EMBTC) - - template< typename charT, class traitsT > - friend std::basic_ostream< charT, traitsT > & - operator<<( std::basic_ostream< charT, traitsT > & os, fiber const& other) { - if ( nullptr != other.ptr_) { - return os << other.ptr_; - } else { - return os << "{not-a-context}"; - } - } - - #else - - template< typename charT, class traitsT > - friend std::basic_ostream< charT, traitsT > & - operator<<( std::basic_ostream< charT, traitsT > & os, fiber const& other); - - #endif - - void swap( fiber & other) noexcept { - std::swap( ptr_, other.ptr_); - } -}; - -#if defined(BOOST_EMBTC) - - template< typename charT, class traitsT > - inline std::basic_ostream< charT, traitsT > & - operator<<( std::basic_ostream< charT, traitsT > & os, fiber const& other) { - if ( nullptr != other.ptr_) { - return os << other.ptr_; - } else { - return os << "{not-a-context}"; - } - } - -#endif - -inline -void swap( fiber & l, fiber & r) noexcept { - l.swap( r); -} - -typedef fiber fiber_context; - -}} - -#if defined(BOOST_MSVC) -# pragma warning(pop) -#endif - -#ifdef BOOST_HAS_ABI_HEADERS -# include BOOST_ABI_SUFFIX -#endif - -#endif // BOOST_CONTEXT_FIBER_H diff --git a/contrib/restricted/boost/context/include/boost/context/fixedsize_stack.hpp b/contrib/restricted/boost/context/include/boost/context/fixedsize_stack.hpp deleted file mode 100644 index c309347935..0000000000 --- a/contrib/restricted/boost/context/include/boost/context/fixedsize_stack.hpp +++ /dev/null @@ -1,97 +0,0 @@ - -// Copyright Oliver Kowalke 2014. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_CONTEXT_FIXEDSIZE_H -#define BOOST_CONTEXT_FIXEDSIZE_H - -#include <cstddef> -#include <cstdlib> -#include <new> - -#include <boost/assert.hpp> -#include <boost/config.hpp> - -#include <boost/context/detail/config.hpp> -#include <boost/context/stack_context.hpp> -#include <boost/context/stack_traits.hpp> - -#if defined(BOOST_CONTEXT_USE_MAP_STACK) -extern "C" { -#include <sys/mman.h> -} -#endif - -#if defined(BOOST_USE_VALGRIND) -#include <valgrind/valgrind.h> -#endif - -#ifdef BOOST_HAS_ABI_HEADERS -# include BOOST_ABI_PREFIX -#endif - -namespace boost { -namespace context { - -template< typename traitsT > -class basic_fixedsize_stack { -private: - std::size_t size_; - -public: - typedef traitsT traits_type; - - basic_fixedsize_stack( std::size_t size = traits_type::default_size() ) BOOST_NOEXCEPT_OR_NOTHROW : - size_( size) { - } - - stack_context allocate() { -#if defined(BOOST_CONTEXT_USE_MAP_STACK) - void * vp = ::mmap( 0, size_, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON | MAP_STACK, -1, 0); - if ( vp == MAP_FAILED) { - throw std::bad_alloc(); - } -#else - void * vp = std::malloc( size_); - if ( ! vp) { - throw std::bad_alloc(); - } -#endif - stack_context sctx; - sctx.size = size_; - sctx.sp = static_cast< char * >( vp) + sctx.size; -#if defined(BOOST_USE_VALGRIND) - sctx.valgrind_stack_id = VALGRIND_STACK_REGISTER( sctx.sp, vp); -#endif - return sctx; - } - - void deallocate( stack_context & sctx) BOOST_NOEXCEPT_OR_NOTHROW { - BOOST_ASSERT( sctx.sp); - -#if defined(BOOST_USE_VALGRIND) - VALGRIND_STACK_DEREGISTER( sctx.valgrind_stack_id); -#endif - void * vp = static_cast< char * >( sctx.sp) - sctx.size; -#if defined(BOOST_CONTEXT_USE_MAP_STACK) - ::munmap( vp, sctx.size); -#else - std::free( vp); -#endif - } -}; - -typedef basic_fixedsize_stack< stack_traits > fixedsize_stack; -# if ! defined(BOOST_USE_SEGMENTED_STACKS) -typedef fixedsize_stack default_stack; -# endif - -}} - -#ifdef BOOST_HAS_ABI_HEADERS -# include BOOST_ABI_SUFFIX -#endif - -#endif // BOOST_CONTEXT_FIXEDSIZE_H diff --git a/contrib/restricted/boost/context/include/boost/context/flags.hpp b/contrib/restricted/boost/context/include/boost/context/flags.hpp deleted file mode 100644 index c7ff1179da..0000000000 --- a/contrib/restricted/boost/context/include/boost/context/flags.hpp +++ /dev/null @@ -1,28 +0,0 @@ - -// Copyright Oliver Kowalke 2014. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_CONTEXT_FLAGS_H -#define BOOST_CONTEXT_FLAGS_H - -# include <boost/config.hpp> - -# ifdef BOOST_HAS_ABI_HEADERS -# include BOOST_ABI_PREFIX -# endif - -namespace boost { -namespace context { - -struct exec_ontop_arg_t {}; -const exec_ontop_arg_t exec_ontop_arg{}; - -}} - -# ifdef BOOST_HAS_ABI_HEADERS -# include BOOST_ABI_SUFFIX -# endif - -#endif // BOOST_CONTEXT_FLAGS_H diff --git a/contrib/restricted/boost/context/include/boost/context/posix/segmented_stack.hpp b/contrib/restricted/boost/context/include/boost/context/posix/segmented_stack.hpp deleted file mode 100644 index e3d2efcb5b..0000000000 --- a/contrib/restricted/boost/context/include/boost/context/posix/segmented_stack.hpp +++ /dev/null @@ -1,82 +0,0 @@ - -// Copyright Oliver Kowalke 2014. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_CONTEXT_SEGMENTED_H -#define BOOST_CONTEXT_SEGMENTED_H - -#include <cstddef> -#include <new> - -#include <boost/config.hpp> - -#include <boost/context/detail/config.hpp> -#include <boost/context/stack_context.hpp> -#include <boost/context/stack_traits.hpp> - -#ifdef BOOST_HAS_ABI_HEADERS -# include BOOST_ABI_PREFIX -#endif - -// forward declaration for splitstack-functions defined in libgcc -extern "C" { -void *__splitstack_makecontext( std::size_t, - void * [BOOST_CONTEXT_SEGMENTS], - std::size_t *); - -void __splitstack_releasecontext( void * [BOOST_CONTEXT_SEGMENTS]); - -void __splitstack_resetcontext( void * [BOOST_CONTEXT_SEGMENTS]); - -void __splitstack_block_signals_context( void * [BOOST_CONTEXT_SEGMENTS], - int * new_value, int * old_value); -} - -namespace boost { -namespace context { - -template< typename traitsT > -class basic_segmented_stack { -private: - std::size_t size_; - -public: - typedef traitsT traits_type; - - basic_segmented_stack( std::size_t size = traits_type::default_size() ) BOOST_NOEXCEPT_OR_NOTHROW : - size_( size) { - } - - stack_context allocate() { - stack_context sctx; - void * vp = __splitstack_makecontext( size_, sctx.segments_ctx, & sctx.size); - if ( ! vp) throw std::bad_alloc(); - - // sctx.size is already filled by __splitstack_makecontext - sctx.sp = static_cast< char * >( vp) + sctx.size; - - int off = 0; - __splitstack_block_signals_context( sctx.segments_ctx, & off, 0); - - return sctx; - } - - void deallocate( stack_context & sctx) BOOST_NOEXCEPT_OR_NOTHROW { - __splitstack_releasecontext( sctx.segments_ctx); - } -}; - -typedef basic_segmented_stack< stack_traits > segmented_stack; -# if defined(BOOST_USE_SEGMENTED_STACKS) -typedef segmented_stack default_stack; -# endif - -}} - -#ifdef BOOST_HAS_ABI_HEADERS -# include BOOST_ABI_SUFFIX -#endif - -#endif // BOOST_CONTEXT_SEGMENTED_H diff --git a/contrib/restricted/boost/context/include/boost/context/preallocated.hpp b/contrib/restricted/boost/context/include/boost/context/preallocated.hpp deleted file mode 100644 index 862a6a5060..0000000000 --- a/contrib/restricted/boost/context/include/boost/context/preallocated.hpp +++ /dev/null @@ -1,39 +0,0 @@ - -// Copyright Oliver Kowalke 2014. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_CONTEXT_PREALLOCATED_H -#define BOOST_CONTEXT_PREALLOCATED_H - -#include <cstddef> - -#include <boost/config.hpp> - -#include <boost/context/detail/config.hpp> - -#ifdef BOOST_HAS_ABI_HEADERS -# include BOOST_ABI_PREFIX -#endif - -namespace boost { -namespace context { - -struct preallocated { - void * sp; - std::size_t size; - stack_context sctx; - - preallocated( void * sp_, std::size_t size_, stack_context sctx_) noexcept : - sp( sp_), size( size_), sctx( sctx_) { - } -}; - -}} - -#ifdef BOOST_HAS_ABI_HEADERS -# include BOOST_ABI_SUFFIX -#endif - -#endif // BOOST_CONTEXT_PREALLOCATED_H diff --git a/contrib/restricted/boost/context/include/boost/context/segmented_stack.hpp b/contrib/restricted/boost/context/include/boost/context/segmented_stack.hpp deleted file mode 100644 index 88e3e6a61f..0000000000 --- a/contrib/restricted/boost/context/include/boost/context/segmented_stack.hpp +++ /dev/null @@ -1,13 +0,0 @@ - -// Copyright Oliver Kowalke 2014. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#include <boost/config.hpp> - -#if defined(BOOST_USE_SEGMENTED_STACKS) -# if ! defined(BOOST_WINDOWS) -# include <boost/context/posix/segmented_stack.hpp> -# endif -#endif diff --git a/contrib/restricted/boost/context/src/continuation.cpp b/contrib/restricted/boost/context/src/continuation.cpp deleted file mode 100644 index 2d7769602a..0000000000 --- a/contrib/restricted/boost/context/src/continuation.cpp +++ /dev/null @@ -1,58 +0,0 @@ - -// Copyright Oliver Kowalke 2017. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#if defined(BOOST_USE_UCONTEXT) -#include "boost/context/continuation_ucontext.hpp" -#elif defined(BOOST_USE_WINFIB) -#include "boost/context/continuation_winfib.hpp" -#endif - -#include <boost/config.hpp> - -#ifdef BOOST_HAS_ABI_HEADERS -# include BOOST_ABI_PREFIX -#endif - -namespace boost { -namespace context { -namespace detail { - -// zero-initialization -thread_local activation_record * current_rec; -thread_local static std::size_t counter; - -// schwarz counter -activation_record_initializer::activation_record_initializer() noexcept { - if ( 0 == counter++) { - current_rec = new activation_record(); - } -} - -activation_record_initializer::~activation_record_initializer() { - if ( 0 == --counter) { - BOOST_ASSERT( current_rec->is_main_context() ); - delete current_rec; - } -} - -} - -namespace detail { - -activation_record *& -activation_record::current() noexcept { - // initialized the first time control passes; per thread - thread_local static activation_record_initializer initializer; - return current_rec; -} - -} - -}} - -#ifdef BOOST_HAS_ABI_HEADERS -# include BOOST_ABI_SUFFIX -#endif diff --git a/contrib/restricted/boost/context/src/fiber.cpp b/contrib/restricted/boost/context/src/fiber.cpp deleted file mode 100644 index b6b790df54..0000000000 --- a/contrib/restricted/boost/context/src/fiber.cpp +++ /dev/null @@ -1,58 +0,0 @@ - -// Copyright Oliver Kowalke 2017. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#if defined(BOOST_USE_UCONTEXT) -#include "boost/context/fiber_ucontext.hpp" -#elif defined(BOOST_USE_WINFIB) -#include "boost/context/fiber_winfib.hpp" -#endif - -#include <boost/config.hpp> - -#ifdef BOOST_HAS_ABI_HEADERS -# include BOOST_ABI_PREFIX -#endif - -namespace boost { -namespace context { -namespace detail { - -// zero-initialization -thread_local fiber_activation_record * fib_current_rec; -thread_local static std::size_t counter; - -// schwarz counter -fiber_activation_record_initializer::fiber_activation_record_initializer() noexcept { - if ( 0 == counter++) { - fib_current_rec = new fiber_activation_record(); - } -} - -fiber_activation_record_initializer::~fiber_activation_record_initializer() { - if ( 0 == --counter) { - BOOST_ASSERT( fib_current_rec->is_main_context() ); - delete fib_current_rec; - } -} - -} - -namespace detail { - -fiber_activation_record *& -fiber_activation_record::current() noexcept { - // initialized the first time control passes; per thread - thread_local static fiber_activation_record_initializer initializer; - return fib_current_rec; -} - -} - -}} - -#ifdef BOOST_HAS_ABI_HEADERS -# include BOOST_ABI_SUFFIX -#endif diff --git a/contrib/restricted/boost/conversion/include/boost/polymorphic_cast.hpp b/contrib/restricted/boost/conversion/include/boost/polymorphic_cast.hpp deleted file mode 100644 index 3592506003..0000000000 --- a/contrib/restricted/boost/conversion/include/boost/polymorphic_cast.hpp +++ /dev/null @@ -1,126 +0,0 @@ -// boost polymorphic_cast.hpp header file ----------------------------------------------// - -// (C) Copyright Kevlin Henney and Dave Abrahams 1999. -// (C) Copyright Boris Rasin 2014. -// Distributed under the Boost -// Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/conversion for Documentation. - -// Revision History -// 10 Nov 14 polymorphic_pointer_downcast moved to a separate header, -// minor improvements to stisfy latest Boost coding style -// 08 Nov 14 Add polymorphic_pointer_downcast (Boris Rasin) -// 09 Jun 14 "cast.hpp" was renamed to "polymorphic_cast.hpp" and -// inclusion of numeric_cast was removed (Antony Polukhin) -// 23 Jun 05 numeric_cast removed and redirected to the new verion (Fernando Cacciola) -// 02 Apr 01 Removed BOOST_NO_LIMITS workarounds and included -// <boost/limits.hpp> instead (the workaround did not -// actually compile when BOOST_NO_LIMITS was defined in -// any case, so we loose nothing). (John Maddock) -// 21 Jan 01 Undid a bug I introduced yesterday. numeric_cast<> never -// worked with stock GCC; trying to get it to do that broke -// vc-stlport. -// 20 Jan 01 Moved BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS to config.hpp. -// Removed unused BOOST_EXPLICIT_TARGET macro. Moved -// boost::detail::type to boost/type.hpp. Made it compile with -// stock gcc again (Dave Abrahams) -// 29 Nov 00 Remove nested namespace cast, cleanup spacing before Formal -// Review (Beman Dawes) -// 19 Oct 00 Fix numeric_cast for floating-point types (Dave Abrahams) -// 15 Jul 00 Suppress numeric_cast warnings for GCC, Borland and MSVC -// (Dave Abrahams) -// 30 Jun 00 More MSVC6 wordarounds. See comments below. (Dave Abrahams) -// 28 Jun 00 Removed implicit_cast<>. See comment below. (Beman Dawes) -// 27 Jun 00 More MSVC6 workarounds -// 15 Jun 00 Add workarounds for MSVC6 -// 2 Feb 00 Remove bad_numeric_cast ";" syntax error (Doncho Angelov) -// 26 Jan 00 Add missing throw() to bad_numeric_cast::what(0 (Adam Levar) -// 29 Dec 99 Change using declarations so usages in other namespaces work -// correctly (Dave Abrahams) -// 23 Sep 99 Change polymorphic_downcast assert to also detect M.I. errors -// as suggested Darin Adler and improved by Valentin Bonnard. -// 2 Sep 99 Remove controversial asserts, simplify, rename. -// 30 Aug 99 Move to cast.hpp, replace value_cast with numeric_cast, -// place in nested namespace. -// 3 Aug 99 Initial version - -#ifndef BOOST_POLYMORPHIC_CAST_HPP -#define BOOST_POLYMORPHIC_CAST_HPP - -# include <boost/config.hpp> - -#ifdef BOOST_HAS_PRAGMA_ONCE -# pragma once -#endif - -# include <boost/assert.hpp> -# include <boost/core/addressof.hpp> -# include <boost/core/enable_if.hpp> -# include <boost/throw_exception.hpp> -# include <boost/type_traits/is_reference.hpp> -# include <boost/type_traits/remove_reference.hpp> - -# include <typeinfo> - -namespace boost -{ -// See the documentation for descriptions of how to choose between -// static_cast<>, dynamic_cast<>, polymorphic_cast<> and polymorphic_downcast<> - -// polymorphic_cast --------------------------------------------------------// - - // Runtime checked polymorphic downcasts and crosscasts. - // Suggested in The C++ Programming Language, 3rd Ed, Bjarne Stroustrup, - // section 15.8 exercise 1, page 425. - - template <class Target, class Source> - inline Target polymorphic_cast(Source* x) - { - Target tmp = dynamic_cast<Target>(x); - if ( tmp == 0 ) boost::throw_exception( std::bad_cast() ); - return tmp; - } - -// polymorphic_downcast ----------------------------------------------------// - - // BOOST_ASSERT() checked raw pointer polymorphic downcast. Crosscasts prohibited. - - // WARNING: Because this cast uses BOOST_ASSERT(), it violates - // the One Definition Rule if used in multiple translation units - // where BOOST_DISABLE_ASSERTS, BOOST_ENABLE_ASSERT_HANDLER - // NDEBUG are defined inconsistently. - - // Contributed by Dave Abrahams - - template <class Target, class Source> - inline Target polymorphic_downcast(Source* x) - { - BOOST_ASSERT( dynamic_cast<Target>(x) == x ); // detect logic error - return static_cast<Target>(x); - } - - // BOOST_ASSERT() checked reference polymorphic downcast. Crosscasts prohibited. - - // WARNING: Because this cast uses BOOST_ASSERT(), it violates - // the One Definition Rule if used in multiple translation units - // where BOOST_DISABLE_ASSERTS, BOOST_ENABLE_ASSERT_HANDLER - // NDEBUG are defined inconsistently. - - // Contributed by Julien Delacroix - - template <class Target, class Source> - inline typename boost::enable_if_c< - boost::is_reference<Target>::value, Target - >::type polymorphic_downcast(Source& x) - { - typedef typename boost::remove_reference<Target>::type* target_pointer_type; - return *boost::polymorphic_downcast<target_pointer_type>( - boost::addressof(x) - ); - } - -} // namespace boost - -#endif // BOOST_POLYMORPHIC_CAST_HPP diff --git a/contrib/restricted/boost/coroutine2/README.md b/contrib/restricted/boost/coroutine2/README.md deleted file mode 100644 index 784164a3d0..0000000000 --- a/contrib/restricted/boost/coroutine2/README.md +++ /dev/null @@ -1,14 +0,0 @@ -boost.coroutine2 -=============== - -boost.coroutine2 provides templates for generalized subroutines which allow multiple entry points for -suspending and resuming execution at certain locations. It preserves the local state of execution and -allows re-entering subroutines more than once (useful if state must be kept across function calls). - -Coroutines can be viewed as a language-level construct providing a special kind of control flow. - -In contrast to threads, which are pre-emptive, coroutines switches are cooperative (programmer controls -when a switch will happen). The kernel is not involved in the coroutine switches. - -boost.coroutine2 requires C++11! -Note that boost.coroutine2 is the successor of the deprectated boost.coroutine. diff --git a/contrib/restricted/boost/detail/include/boost/cstdlib.hpp b/contrib/restricted/boost/detail/include/boost/cstdlib.hpp deleted file mode 100644 index 6322146354..0000000000 --- a/contrib/restricted/boost/detail/include/boost/cstdlib.hpp +++ /dev/null @@ -1,41 +0,0 @@ -// boost/cstdlib.hpp header ------------------------------------------------// - -// Copyright Beman Dawes 2001. Distributed under the Boost -// Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/utility/cstdlib.html for documentation. - -// Revision History -// 26 Feb 01 Initial version (Beman Dawes) - -#ifndef BOOST_CSTDLIB_HPP -#define BOOST_CSTDLIB_HPP - -#include <cstdlib> - -namespace boost -{ - // The intent is to propose the following for addition to namespace std - // in the C++ Standard Library, and to then deprecate EXIT_SUCCESS and - // EXIT_FAILURE. As an implementation detail, this header defines the - // new constants in terms of EXIT_SUCCESS and EXIT_FAILURE. In a new - // standard, the constants would be implementation-defined, although it - // might be worthwhile to "suggest" (which a standard is allowed to do) - // values of 0 and 1 respectively. - - // Rationale for having multiple failure values: some environments may - // wish to distinguish between different classes of errors. - // Rationale for choice of values: programs often use values < 100 for - // their own error reporting. Values > 255 are sometimes reserved for - // system detected errors. 200/201 were suggested to minimize conflict. - - const int exit_success = EXIT_SUCCESS; // implementation-defined value - const int exit_failure = EXIT_FAILURE; // implementation-defined value - const int exit_exception_failure = 200; // otherwise uncaught exception - const int exit_test_failure = 201; // report_error or - // report_critical_error called. -} - -#endif - diff --git a/contrib/restricted/boost/detail/include/boost/detail/binary_search.hpp b/contrib/restricted/boost/detail/include/boost/detail/binary_search.hpp deleted file mode 100644 index 0591563673..0000000000 --- a/contrib/restricted/boost/detail/include/boost/detail/binary_search.hpp +++ /dev/null @@ -1,216 +0,0 @@ -// Copyright (c) 2000 David Abrahams. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// Copyright (c) 1994 -// Hewlett-Packard Company -// -// Permission to use, copy, modify, distribute and sell this software -// and its documentation for any purpose is hereby granted without fee, -// provided that the above copyright notice appear in all copies and -// that both that copyright notice and this permission notice appear -// in supporting documentation. Hewlett-Packard Company makes no -// representations about the suitability of this software for any -// purpose. It is provided "as is" without express or implied warranty. -// -// Copyright (c) 1996 -// Silicon Graphics Computer Systems, Inc. -// -// Permission to use, copy, modify, distribute and sell this software -// and its documentation for any purpose is hereby granted without fee, -// provided that the above copyright notice appear in all copies and -// that both that copyright notice and this permission notice appear -// in supporting documentation. Silicon Graphics makes no -// representations about the suitability of this software for any -// purpose. It is provided "as is" without express or implied warranty. -// -#ifndef BINARY_SEARCH_DWA_122600_H_ -# define BINARY_SEARCH_DWA_122600_H_ - -# include <utility> -# include <iterator> - -namespace boost { namespace detail { - -template <class ForwardIter, class Tp> -ForwardIter lower_bound(ForwardIter first, ForwardIter last, - const Tp& val) -{ - typedef std::iterator_traits<ForwardIter> traits; - - typename traits::difference_type len = std::distance(first, last); - typename traits::difference_type half; - ForwardIter middle; - - while (len > 0) { - half = len >> 1; - middle = first; - std::advance(middle, half); - if (*middle < val) { - first = middle; - ++first; - len = len - half - 1; - } - else - len = half; - } - return first; -} - -template <class ForwardIter, class Tp, class Compare> -ForwardIter lower_bound(ForwardIter first, ForwardIter last, - const Tp& val, Compare comp) -{ - typedef std::iterator_traits<ForwardIter> traits; - - typename traits::difference_type len = std::distance(first, last); - typename traits::difference_type half; - ForwardIter middle; - - while (len > 0) { - half = len >> 1; - middle = first; - std::advance(middle, half); - if (comp(*middle, val)) { - first = middle; - ++first; - len = len - half - 1; - } - else - len = half; - } - return first; -} - -template <class ForwardIter, class Tp> -ForwardIter upper_bound(ForwardIter first, ForwardIter last, - const Tp& val) -{ - typedef std::iterator_traits<ForwardIter> traits; - - typename traits::difference_type len = std::distance(first, last); - typename traits::difference_type half; - ForwardIter middle; - - while (len > 0) { - half = len >> 1; - middle = first; - std::advance(middle, half); - if (val < *middle) - len = half; - else { - first = middle; - ++first; - len = len - half - 1; - } - } - return first; -} - -template <class ForwardIter, class Tp, class Compare> -ForwardIter upper_bound(ForwardIter first, ForwardIter last, - const Tp& val, Compare comp) -{ - typedef std::iterator_traits<ForwardIter> traits; - - typename traits::difference_type len = std::distance(first, last); - typename traits::difference_type half; - ForwardIter middle; - - while (len > 0) { - half = len >> 1; - middle = first; - std::advance(middle, half); - if (comp(val, *middle)) - len = half; - else { - first = middle; - ++first; - len = len - half - 1; - } - } - return first; -} - -template <class ForwardIter, class Tp> -std::pair<ForwardIter, ForwardIter> -equal_range(ForwardIter first, ForwardIter last, const Tp& val) -{ - typedef std::iterator_traits<ForwardIter> traits; - - typename traits::difference_type len = std::distance(first, last); - typename traits::difference_type half; - ForwardIter middle, left, right; - - while (len > 0) { - half = len >> 1; - middle = first; - std::advance(middle, half); - if (*middle < val) { - first = middle; - ++first; - len = len - half - 1; - } - else if (val < *middle) - len = half; - else { - left = boost::detail::lower_bound(first, middle, val); - std::advance(first, len); - right = boost::detail::upper_bound(++middle, first, val); - return std::pair<ForwardIter, ForwardIter>(left, right); - } - } - return std::pair<ForwardIter, ForwardIter>(first, first); -} - -template <class ForwardIter, class Tp, class Compare> -std::pair<ForwardIter, ForwardIter> -equal_range(ForwardIter first, ForwardIter last, const Tp& val, - Compare comp) -{ - typedef std::iterator_traits<ForwardIter> traits; - - typename traits::difference_type len = std::distance(first, last); - typename traits::difference_type half; - ForwardIter middle, left, right; - - while (len > 0) { - half = len >> 1; - middle = first; - std::advance(middle, half); - if (comp(*middle, val)) { - first = middle; - ++first; - len = len - half - 1; - } - else if (comp(val, *middle)) - len = half; - else { - left = boost::detail::lower_bound(first, middle, val, comp); - std::advance(first, len); - right = boost::detail::upper_bound(++middle, first, val, comp); - return std::pair<ForwardIter, ForwardIter>(left, right); - } - } - return std::pair<ForwardIter, ForwardIter>(first, first); -} - -template <class ForwardIter, class Tp> -bool binary_search(ForwardIter first, ForwardIter last, - const Tp& val) { - ForwardIter i = boost::detail::lower_bound(first, last, val); - return i != last && !(val < *i); -} - -template <class ForwardIter, class Tp, class Compare> -bool binary_search(ForwardIter first, ForwardIter last, - const Tp& val, - Compare comp) { - ForwardIter i = boost::detail::lower_bound(first, last, val, comp); - return i != last && !comp(val, *i); -} - -}} // namespace boost::detail - -#endif // BINARY_SEARCH_DWA_122600_H_ diff --git a/contrib/restricted/boost/detail/include/boost/detail/fenv.hpp b/contrib/restricted/boost/detail/include/boost/detail/fenv.hpp deleted file mode 100644 index b268f5c1cc..0000000000 --- a/contrib/restricted/boost/detail/include/boost/detail/fenv.hpp +++ /dev/null @@ -1,101 +0,0 @@ -/*============================================================================= - Copyright (c) 2010 Bryce Lelbach - - Distributed under the Boost Software License, Version 1.0. (See accompanying - file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -=============================================================================*/ - -#include <boost/config.hpp> - -#if defined(BOOST_NO_FENV_H) - #error This platform does not have a floating point environment -#endif - -#if !defined(BOOST_DETAIL_FENV_HPP) -#define BOOST_DETAIL_FENV_HPP - -/* If we're using clang + glibc, we have to get hacky. - * See http://llvm.org/bugs/show_bug.cgi?id=6907 */ -#if defined(__clang__) && (__clang_major__ < 3) && \ - defined(__GNU_LIBRARY__) && /* up to version 5 */ \ - defined(__GLIBC__) && /* version 6 + */ \ - !defined(_FENV_H) - #define _FENV_H - - #include <features.h> - #include <bits/fenv.h> - - extern "C" { - extern int fegetexceptflag (fexcept_t*, int) __THROW; - extern int fesetexceptflag (__const fexcept_t*, int) __THROW; - extern int feclearexcept (int) __THROW; - extern int feraiseexcept (int) __THROW; - extern int fetestexcept (int) __THROW; - extern int fegetround (void) __THROW; - extern int fesetround (int) __THROW; - extern int fegetenv (fenv_t*) __THROW; - extern int fesetenv (__const fenv_t*) __THROW; - extern int feupdateenv (__const fenv_t*) __THROW; - extern int feholdexcept (fenv_t*) __THROW; - - #ifdef __USE_GNU - extern int feenableexcept (int) __THROW; - extern int fedisableexcept (int) __THROW; - extern int fegetexcept (void) __THROW; - #endif - } - - namespace std { namespace tr1 { - using ::fenv_t; - using ::fexcept_t; - using ::fegetexceptflag; - using ::fesetexceptflag; - using ::feclearexcept; - using ::feraiseexcept; - using ::fetestexcept; - using ::fegetround; - using ::fesetround; - using ::fegetenv; - using ::fesetenv; - using ::feupdateenv; - using ::feholdexcept; - } } - -#elif defined(__MINGW32__) && defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 408 - - // MinGW (32-bit) has a bug in mingw32/bits/c++config.h, it does not define _GLIBCXX_HAVE_FENV_H, - // which prevents the C fenv.h header contents to be included in the C++ wrapper header fenv.h. This is at least - // the case with gcc 4.8.1 packages tested so far, up to 4.8.1-4. Note that there is no issue with - // MinGW-w64. - // To work around the bug we avoid including the C++ wrapper header and include the C header directly - // and import all relevant symbols into std:: ourselves. - - #include <../include/fenv.h> - - namespace std { - using ::fenv_t; - using ::fexcept_t; - using ::fegetexceptflag; - using ::fesetexceptflag; - using ::feclearexcept; - using ::feraiseexcept; - using ::fetestexcept; - using ::fegetround; - using ::fesetround; - using ::fegetenv; - using ::fesetenv; - using ::feupdateenv; - using ::feholdexcept; - } - -#else /* if we're not using GNU's C stdlib, fenv.h should work with clang */ - - #if defined(__SUNPRO_CC) /* lol suncc */ - #include <stdio.h> - #endif - - #include <fenv.h> - -#endif - -#endif /* BOOST_DETAIL_FENV_HPP */ diff --git a/contrib/restricted/boost/detail/include/boost/detail/is_xxx.hpp b/contrib/restricted/boost/detail/include/boost/detail/is_xxx.hpp deleted file mode 100644 index d54bf7b88c..0000000000 --- a/contrib/restricted/boost/detail/include/boost/detail/is_xxx.hpp +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright David Abrahams 2005. Distributed under the Boost -// Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_DETAIL_IS_XXX_DWA20051011_HPP -# define BOOST_DETAIL_IS_XXX_DWA20051011_HPP - -# include <boost/config.hpp> -# include <boost/type_traits/integral_constant.hpp> -# include <boost/preprocessor/enum_params.hpp> - - -# define BOOST_DETAIL_IS_XXX_DEF(name, qualified_name, nargs) \ -template <class T> \ -struct is_##name : boost::false_type \ -{ \ -}; \ - \ -template < BOOST_PP_ENUM_PARAMS_Z(1, nargs, class T) > \ -struct is_##name< \ - qualified_name< BOOST_PP_ENUM_PARAMS_Z(1, nargs, T) > \ -> \ - : boost::true_type \ -{ \ -}; - - -#endif // BOOST_DETAIL_IS_XXX_DWA20051011_HPP diff --git a/contrib/restricted/boost/geometry/CONTRIBUTING.md b/contrib/restricted/boost/geometry/CONTRIBUTING.md deleted file mode 100644 index e783514c52..0000000000 --- a/contrib/restricted/boost/geometry/CONTRIBUTING.md +++ /dev/null @@ -1,14 +0,0 @@ -# Contributing to Boost.Geometry - -Boost.Geometry is a member of [Boost](https://www.boost.org) libraries. - - -## Table of Contents - -* [**Contribution Tutorial**](http://github.com/boostorg/geometry/wiki/Contribution-Tutorial) -* [**Guidelines for Developers**](http://github.com/boostorg/geometry/wiki/Guidelines-for-Developers) -* [**Generating and Improving Documentation**](https://github.com/boostorg/geometry/wiki/Generating-and-Improving-Documentation) - -### Resources -* [**Debugging**](http://github.com/boostorg/geometry/wiki/Debugging) -* [**Talks**](http://github.com/boostorg/geometry/wiki/Talks) diff --git a/contrib/restricted/boost/geometry/LICENSE_1_0.txt b/contrib/restricted/boost/geometry/LICENSE_1_0.txt deleted file mode 100644 index 36b7cd93cd..0000000000 --- a/contrib/restricted/boost/geometry/LICENSE_1_0.txt +++ /dev/null @@ -1,23 +0,0 @@ -Boost Software License - Version 1.0 - August 17th, 2003 - -Permission is hereby granted, free of charge, to any person or organization -obtaining a copy of the software and accompanying documentation covered by -this license (the "Software") to use, reproduce, display, distribute, -execute, and transmit the Software, and to prepare derivative works of the -Software, and to permit third-parties to whom the Software is furnished to -do so, all subject to the following: - -The copyright notices in the Software and this entire statement, including -the above license grant, this restriction and the following disclaimer, -must be included in all copies of the Software, in whole or in part, and -all derivative works of the Software, unless such copies or derivative -works are solely in the form of machine-executable object code generated by -a source language processor. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT -SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE -FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. diff --git a/contrib/restricted/boost/geometry/README.md b/contrib/restricted/boost/geometry/README.md deleted file mode 100644 index 9532cec9cb..0000000000 --- a/contrib/restricted/boost/geometry/README.md +++ /dev/null @@ -1,26 +0,0 @@ -# ![Boost.Geometry](doc/other/logo/logo_bkg.png) - -Boost.Geometry, part of collection of the [Boost C++ Libraries](http://github.com/boostorg), defines concepts, primitives and algorithms for solving geometry problems. Boost.Geometry is a C++14 header-only library. - -[![Licence](https://img.shields.io/badge/license-boost-4480cc.png)](http://www.boost.org/LICENSE_1_0.txt) -[![Documentation](https://img.shields.io/badge/-documentation-4480cc.png)](http://boost.org/libs/geometry) -[![Wiki](https://img.shields.io/badge/-wiki-4480cc.png)](https://github.com/boostorg/geometry/wiki) -[![Mailing List](https://img.shields.io/badge/-mailing%20list-4eb899.png)](http://lists.boost.org/geometry/) -[![Chat](https://badges.gitter.im/boostorg/geometry.png)](https://gitter.im/boostorg/geometry?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) - -### Test results - - Branch | Build | Coverage | Regression | Documentation -------------|---------------|----------------|------------|-------------- -**develop** | [![circleci](https://circleci.com/gh/boostorg/geometry/tree/develop.svg?style=shield)](https://circleci.com/gh/boostorg/geometry/tree/develop) <br> [![minimal](https://github.com/boostorg/geometry/workflows/minimal/badge.svg?branch=develop)](https://github.com/boostorg/geometry/actions?query=branch:develop+workflow:minimal) | [![coveralls](https://coveralls.io/repos/github/boostorg/geometry/badge.svg?branch=develop)](https://coveralls.io/github/boostorg/geometry?branch=develop) <br> [![codecov](https://codecov.io/gh/boostorg/geometry/branch/develop/graph/badge.svg)](https://codecov.io/gh/boostorg/geometry/branch/develop) | [![geometry](https://img.shields.io/badge/-geometry-4480cc.png)](http://www.boost.org/development/tests/develop/developer/geometry.html) [![index](https://img.shields.io/badge/-index-4480cc.png)](http://www.boost.org/development/tests/develop/developer/geometry-index.html) [![extensions](https://img.shields.io/badge/-extensions-4480cc.png)](http://www.boost.org/development/tests/develop/developer/geometry-extensions.html) | [![documentation](https://github.com/boostorg/geometry/workflows/documentation/badge.svg?branch=develop)](https://github.com/boostorg/geometry/actions?query=branch:develop+workflow:documentation) -**master** | [![circleci](https://circleci.com/gh/boostorg/geometry/tree/master.svg?style=shield)](https://circleci.com/gh/boostorg/geometry/tree/master) <br> [![minimal](https://github.com/boostorg/geometry/workflows/minimal/badge.svg?branch=master)](https://github.com/boostorg/geometry/actions?query=branch:master+workflow:minimal) | [![coveralls](https://coveralls.io/repos/github/boostorg/geometry/badge.svg?branch=master)](https://coveralls.io/github/boostorg/geometry?branch=master) <br> [![codecov](https://codecov.io/gh/boostorg/geometry/branch/master/graph/badge.svg)](https://codecov.io/gh/boostorg/geometry/branch/master) | [![geometry](https://img.shields.io/badge/-geometry-4480cc.png)](http://www.boost.org/development/tests/master/developer/geometry.html) [![index](https://img.shields.io/badge/-index-4480cc.png)](http://www.boost.org/development/tests/master/developer/geometry-index.html) | [![documentation](https://github.com/boostorg/geometry/workflows/documentation/badge.svg?branch=master)](https://github.com/boostorg/geometry/actions?query=branch:master+workflow:documentation) - -### Directories - -* **doc** - QuickBook documentation sources -* **example** - Boost.Geometry examples -* **_extensions_** - examples and tests for the extensions - _develop branch_ -* **include** - the sourcecode of Boost.Geometry -* **index** - examples and tests for the Spatial Index -* **meta** - library metadata -* **test** - Boost.Geometry unit tests diff --git a/contrib/restricted/boost/hana/CONTRIBUTING.md b/contrib/restricted/boost/hana/CONTRIBUTING.md deleted file mode 100644 index 52d0858a6a..0000000000 --- a/contrib/restricted/boost/hana/CONTRIBUTING.md +++ /dev/null @@ -1,63 +0,0 @@ -# How to contribute - -Contributions are always very much appreciated. However, to make sure the -process of accepting patches goes smoothly for everyone (especially for -the maintainer), you should try to follow these few simple guidelines when -you contribute: - -1. Fork the repository. -2. Create a new branch based on the `develop` branch (`git checkout -b your_branch develop`). - If your contribution is a bug fix, you should name your branch `bugfix/xxx`; - for a feature, it should be `feature/xxx`. Otherwise, just use your good - judgment. Consistent naming of branches is appreciated since it makes the - output of `git branch` easier to understand with a single glance. -3. Do your modifications on that branch. Except for special cases, your - contribution should include proper unit tests and documentation. Also, - please try to follow the style guide below. -4. Make sure your modifications did not break anything by building and - running the tests: - - ```shell - mkdir build - cd build - cmake .. - cmake --build . --target check - ``` -5. Commit your changes. Your commit message should start with a one line - short description of the modifications, with the details and explanations - of your modifications following in subsequent paragraphs or bullet points. - Please limit your lines to about 78 characters in commit messages, since - it makes the output easier to read in `git log`. Also, starting your commit - message with a tag describing the nature of the commit is nice, since it - makes the commit history easier to skim through. For commits that do not - change any functionality (e.g. refactoring or fixing typos), the `[NFC]` - tag (No Functionality Change) can be used. Here's an example of an - acceptable commit message: - ``` - [Searchable] Refactor the interface - - - Rename elem to contains - - Rename subset to is_subset, and make is_subset applicable in infix notation - - Add the at_key method - - operator[] is now bound to at_key instead of find - ``` - When applicable, please squash adjacent _wip_ commits into a single - _logical_ commit. If your contribution has several logical commits, - it's fine. -6. Push the changes to your fork (`git push origin your_branch`). -7. Open a pull request against Hana's `develop` branch (not against `master`). - I will do my best to respond in a timely manner. I might discuss your patch - and suggest some modifications, or I might amend your patch myself and ask - you for feedback. You will always be given proper credit. - - -## Style guide - -I'm not going to write an exhaustive style guide, but here are a couple of -points you should watch out for: -- Indent using 4 spaces. -- Do not leave trailing white spaces at the end of lines, and no more than a - single newline at the end of a source file. -- Hana's `#include`s go first, then a blank line and system headers. - `#include`s within each block should be sorted in alphabetical order. -- Use your own judgment and stick to the style of the surrounding code. diff --git a/contrib/restricted/boost/hana/LICENSE.md b/contrib/restricted/boost/hana/LICENSE.md deleted file mode 100644 index 8639127154..0000000000 --- a/contrib/restricted/boost/hana/LICENSE.md +++ /dev/null @@ -1,25 +0,0 @@ -Copyright Louis Dionne 2013-2017 - -Boost Software License - Version 1.0 - August 17th, 2003 - -Permission is hereby granted, free of charge, to any person or organization -obtaining a copy of the software and accompanying documentation covered by -this license (the "Software") to use, reproduce, display, distribute, -execute, and transmit the Software, and to prepare derivative works of the -Software, and to permit third-parties to whom the Software is furnished to -do so, all subject to the following: - -The copyright notices in the Software and this entire statement, including -the above license grant, this restriction and the following disclaimer, -must be included in all copies of the Software, in whole or in part, and -all derivative works of the Software, unless such copies or derivative -works are solely in the form of machine-executable object code generated by -a source language processor. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT -SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE -FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. diff --git a/contrib/restricted/boost/hana/README.md b/contrib/restricted/boost/hana/README.md deleted file mode 100644 index 93364118b7..0000000000 --- a/contrib/restricted/boost/hana/README.md +++ /dev/null @@ -1,193 +0,0 @@ -# Boost.Hana <a target="_blank" href="http://semver.org">![Version][badge.version]</a> <a target="_blank" href="https://travis-ci.org/boostorg/hana">![Travis status][badge.Travis]</a> <a target="_blank" href="https://ci.appveyor.com/project/ldionne/hana">![Appveyor status][badge.Appveyor]</a> <a target="_blank" href="http://melpon.org/wandbox/permlink/g4ozIK33ITDtyGa3">![Try it online][badge.wandbox]</a> <a target="_blank" href="https://gitter.im/boostorg/hana">![Gitter Chat][badge.Gitter]</a> - -> Your standard library for metaprogramming - -## Overview -<!-- Important: keep this in sync with example/overview.cpp --> -```cpp -#include <boost/hana.hpp> -#include <cassert> -#include <string> -namespace hana = boost::hana; -using namespace hana::literals; - -struct Fish { std::string name; }; -struct Cat { std::string name; }; -struct Dog { std::string name; }; - -int main() { - // Sequences capable of holding heterogeneous objects, and algorithms - // to manipulate them. - auto animals = hana::make_tuple(Fish{"Nemo"}, Cat{"Garfield"}, Dog{"Snoopy"}); - auto names = hana::transform(animals, [](auto a) { - return a.name; - }); - assert(hana::reverse(names) == hana::make_tuple("Snoopy", "Garfield", "Nemo")); - - // No compile-time information is lost: even if `animals` can't be a - // constant expression because it contains strings, its length is constexpr. - static_assert(hana::length(animals) == 3u, ""); - - // Computations on types can be performed with the same syntax as that of - // normal C++. Believe it or not, everything is done at compile-time. - auto animal_types = hana::make_tuple(hana::type_c<Fish*>, hana::type_c<Cat&>, hana::type_c<Dog*>); - auto animal_ptrs = hana::filter(animal_types, [](auto a) { - return hana::traits::is_pointer(a); - }); - static_assert(animal_ptrs == hana::make_tuple(hana::type_c<Fish*>, hana::type_c<Dog*>), ""); - - // And many other goodies to make your life easier, including: - // 1. Access to elements in a tuple with a sane syntax. - static_assert(animal_ptrs[0_c] == hana::type_c<Fish*>, ""); - static_assert(animal_ptrs[1_c] == hana::type_c<Dog*>, ""); - - // 2. Unroll loops at compile-time without hassle. - std::string s; - hana::int_c<10>.times([&]{ s += "x"; }); - // equivalent to s += "x"; s += "x"; ... s += "x"; - - // 3. Easily check whether an expression is valid. - // This is usually achieved with complex SFINAE-based tricks. - auto has_name = hana::is_valid([](auto&& x) -> decltype((void)x.name) { }); - static_assert(has_name(animals[0_c]), ""); - static_assert(!has_name(1), ""); -} -``` - - -## Documentation -You can browse the documentation online at http://boostorg.github.io/hana. -The documentation covers everything you should need including installing the -library, a tutorial explaining what Hana is and how to use it, and an extensive -reference section with examples. The remainder of this README is mostly for -people that wish to work on the library itself, not for its users. - -An offline copy of the documentation can be obtained by checking out the -`gh-pages` branch. To avoid overwriting the current directory, you can clone -the `gh-pages` branch into a subdirectory like `doc/html`: -```shell -git clone http://github.com/boostorg/hana --branch=gh-pages --depth=1 doc/html -``` - -After issuing this, `doc/html` will contain exactly the same static website -that is [available online][Hana.docs]. Note that `doc/html` is automatically -ignored by Git so updating the documentation won't pollute your index. - - -## Hacking on Hana -Setting yourself up to work on Hana is easy. First, you will need an -installation of [CMake][]. Once this is done, you can `cd` to the root -of the project and setup the build directory: -```shell -mkdir build -cd build -cmake .. -``` - -Usually, you'll want to specify a custom compiler because the system's -compiler is too old: -```shell -cmake .. -DCMAKE_CXX_COMPILER=/path/to/compiler -``` - -Usually, this will work just fine. However, on some systems, the standard -library and/or compiler provided by default does not support C++14. If -this is your case, the [wiki][Hana.wiki] has more information about -setting you up on different systems. - -Normally, Hana tries to find Boost headers if you have them on your system. -It's also fine if you don't have them; a few tests requiring the Boost headers -will be disabled in that case. However, if you'd like Hana to use a custom -installation of Boost, you can specify the path to this custom installation: -```shell -cmake .. -DCMAKE_CXX_COMPILER=/path/to/compiler -DBOOST_ROOT=/path/to/boost -``` - -You can now build and run the unit tests and the examples: -```shell -cmake --build . --target check -``` - -You should be aware that compiling the unit tests is pretty time and RAM -consuming, especially the tests for external adapters. This is due to the -fact that Hana's unit tests are very thorough, and also that heterogeneous -sequences in other libraries tend to have horrible compile-time performance. - -There are also optional targets which are enabled only when the required -software is available on your computer. For example, generating the -documentation requires [Doxygen][] to be installed. An informative message -will be printed during the CMake generation step whenever an optional target -is disabled. You can install any missing software and then re-run the CMake -generation to update the list of available targets. - -> #### Tip -> You can use the `help` target to get a list of all the available targets. - -If you want to add unit tests or examples, just add a source file in `test/` -or `example/` and then re-run the CMake generation step so the new source -file is known to the build system. Let's suppose the relative path from the -root of the project to the new source file is `path/to/file.cpp`. When you -re-run the CMake generation step, a new target named `path.to.file` will be -created, and a test of the same name will also be created. Hence, -```shell -cd build # Go back to the build directory -cmake --build . --target path.to.file # Builds the program associated to path/to/file.cpp -ctest -R path.to.file # Runs the program as a test -``` - -> #### Tip for Sublime Text users -> If you use the provided [hana.sublime-project](hana.sublime-project) file, -> you can select the "[Hana] Build current file" build system. When viewing a -> file to which a target is associated (like a test or an example), you can -> then compile it by pressing ⌘B, or compile and then run it using ⇧⌘B. - - -## Project organization -The project is organized in a couple of subdirectories. -- The [benchmark](benchmark) directory contains compile-time and runtime - benchmarks to make sure the library is as fast as advertised. The benchmark - code is written mostly in the form of [eRuby][] templates. The templates - are used to generate C++ files which are then compiled while gathering - compilation and execution statistics. -- The [cmake](cmake) directory contains various CMake modules and other - scripts needed by the build system. -- The [doc](doc) directory contains configuration files needed to generate - the documentation. The `doc/html` subdirectory is automatically ignored - by Git; you can conveniently store a local copy of the documentation by - cloning the `gh-pages` branch into that directory, as explained above. -- The [example](example) directory contains the source code for all the - examples of both the tutorial and the reference documentation. -- The [include](include) directory contains the library itself, which is - header only. -- The [test](test) directory contains the source code for all the unit tests. - - -## Contributing -Please see [CONTRIBUTING.md](CONTRIBUTING.md). - - -## License -Please see [LICENSE.md](LICENSE.md). - - -## Releasing -To release a new version of Hana, use the `util/release.sh` script. The script -will merge `develop` to `master`, create a tag on `master` and then bump the -version on `develop`. The tag on `master` will be annotated with the contents -of the `RELEASE_NOTES.md` file. Once the `release.sh` script has been run, the -`master` and `develop` branches should be pushed manually, as well as the tag -that was created on `master`. Finally, create a GitHub release pointing to the -new tag on `master`. - - -<!-- Links --> -[badge.Appveyor]: https://ci.appveyor.com/api/projects/status/github/boostorg/hana?svg=true&branch=master -[badge.Gitter]: https://img.shields.io/badge/gitter-join%20chat-blue.svg -[badge.Travis]: https://travis-ci.org/boostorg/hana.svg?branch=master -[badge.version]: https://badge.fury.io/gh/boostorg%2Fhana.svg -[badge.Wandbox]: https://img.shields.io/badge/try%20it-online-blue.svg -[CMake]: http://www.cmake.org -[Doxygen]: http://www.doxygen.org -[eRuby]: http://en.wikipedia.org/wiki/ERuby -[Hana.docs]: http://boostorg.github.io/hana -[Hana.wiki]: https://github.com/boostorg/hana/wiki diff --git a/contrib/restricted/boost/hana/RELEASE_NOTES.md b/contrib/restricted/boost/hana/RELEASE_NOTES.md deleted file mode 100644 index c10c2a0a25..0000000000 --- a/contrib/restricted/boost/hana/RELEASE_NOTES.md +++ /dev/null @@ -1,2 +0,0 @@ -Release notes for Hana 1.6.2 -============================ diff --git a/contrib/restricted/boost/interval/LICENSE b/contrib/restricted/boost/interval/LICENSE deleted file mode 100644 index 36b7cd93cd..0000000000 --- a/contrib/restricted/boost/interval/LICENSE +++ /dev/null @@ -1,23 +0,0 @@ -Boost Software License - Version 1.0 - August 17th, 2003 - -Permission is hereby granted, free of charge, to any person or organization -obtaining a copy of the software and accompanying documentation covered by -this license (the "Software") to use, reproduce, display, distribute, -execute, and transmit the Software, and to prepare derivative works of the -Software, and to permit third-parties to whom the Software is furnished to -do so, all subject to the following: - -The copyright notices in the Software and this entire statement, including -the above license grant, this restriction and the following disclaimer, -must be included in all copies of the Software, in whole or in part, and -all derivative works of the Software, unless such copies or derivative -works are solely in the form of machine-executable object code generated by -a source language processor. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT -SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE -FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. diff --git a/contrib/restricted/boost/interval/README.md b/contrib/restricted/boost/interval/README.md deleted file mode 100644 index f193e4eadf..0000000000 --- a/contrib/restricted/boost/interval/README.md +++ /dev/null @@ -1,34 +0,0 @@ -Interval, part of the collection of [Boost C++ Libraries](http://github.com/boostorg), is intended to help manipulating mathematical intervals. - -### License - -Distributed under the [Boost Software License, Version 1.0](http://www.boost.org/LICENSE_1_0.txt). - -### Properties - -* C++03 -* Header-only - -### Build Status - -Branch | GHA CI | Appveyor | Coverity Scan | codecov.io | Deps | Docs | Tests | -:-------------: | ------ | -------- | ------------- | ---------- | ---- | ---- | ----- | -[`master`](https://github.com/boostorg/interval/tree/master) | [![Build Status](https://github.com/boostorg/interval/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/boostorg/interval/actions?query=branch:master) | [![Build status](https://ci.appveyor.com/api/projects/status/wx6gsonby36or5m2/branch/master?svg=true)](https://ci.appveyor.com/project/jeking3/interval-o0u28/branch/master) | [![Coverity Scan Build Status](https://scan.coverity.com/projects/17151/badge.svg)](https://scan.coverity.com/projects/boostorg-interval) | [![codecov](https://codecov.io/gh/boostorg/interval/branch/master/graph/badge.svg)](https://codecov.io/gh/boostorg/interval/branch/master) | [![Deps](https://img.shields.io/badge/deps-master-brightgreen.svg)](https://pdimov.github.io/boostdep-report/master/interval.html) | [![Documentation](https://img.shields.io/badge/docs-master-brightgreen.svg)](https://www.boost.org/doc/libs/master/libs/numeric/interval/doc/interval.htm) | [![Enter the Matrix](https://img.shields.io/badge/matrix-master-brightgreen.svg)](http://www.boost.org/development/tests/master/developer/interval.html) -[`develop`](https://github.com/boostorg/interval/tree/develop) | [![Build Status](https://github.com/boostorg/interval/actions/workflows/ci.yml/badge.svg?branch=develop)](https://github.com/boostorg/interval/actions?query=branch:develop) | [![Build status](https://ci.appveyor.com/api/projects/status/wx6gsonby36or5m2/branch/develop?svg=true)](https://ci.appveyor.com/project/jeking3/interval-o0u28/branch/develop) | [![Coverity Scan Build Status](https://scan.coverity.com/projects/17151/badge.svg)](https://scan.coverity.com/projects/boostorg-interval) | [![codecov](https://codecov.io/gh/boostorg/interval/branch/develop/graph/badge.svg)](https://codecov.io/gh/boostorg/interval/branch/develop) | [![Deps](https://img.shields.io/badge/deps-develop-brightgreen.svg)](https://pdimov.github.io/boostdep-report/develop/interval.html) | [![Documentation](https://img.shields.io/badge/docs-develop-brightgreen.svg)](https://www.boost.org/doc/libs/develop/libs/numeric/interval/doc/interval.htm) | [![Enter the Matrix](https://img.shields.io/badge/matrix-develop-brightgreen.svg)](http://www.boost.org/development/tests/develop/developer/interval.html) - -### Directories - -| Name | Purpose | -| ----------- | ------------------------------ | -| `doc` | documentation | -| `examples` | use case examples | -| `include` | headers | -| `test` | unit tests | - -### More inintervalion - -* [Ask questions](http://stackoverflow.com/questions/ask?tags=c%2B%2B,boost,boost-interval): Be sure to read the documentation first as Boost.Interval has specific requirements. -* [Report bugs](https://github.com/boostorg/interval/issues): Be sure to mention Boost version, platform and compiler you're using. A small compilable code sample to reproduce the problem is always good as well. -* [Submit Pull Requests](https://github.com/boostorg/interval/pulls) against the **develop** branch. Note that by submitting patches you agree to license your modifications under the [Boost Software License, Version 1.0](http://www.boost.org/LICENSE_1_0.txt). Be sure to include tests proving your changes work properly. -* Discussions about the library are held on the [Boost developers mailing list](http://www.boost.org/community/groups.html#main). Be sure to read the [discussion policy](http://www.boost.org/community/policy.html) before posting and add the `[interval]` tag at the beginning of the subject line. - diff --git a/contrib/restricted/boost/logic/LICENSE b/contrib/restricted/boost/logic/LICENSE deleted file mode 100644 index 36b7cd93cd..0000000000 --- a/contrib/restricted/boost/logic/LICENSE +++ /dev/null @@ -1,23 +0,0 @@ -Boost Software License - Version 1.0 - August 17th, 2003 - -Permission is hereby granted, free of charge, to any person or organization -obtaining a copy of the software and accompanying documentation covered by -this license (the "Software") to use, reproduce, display, distribute, -execute, and transmit the Software, and to prepare derivative works of the -Software, and to permit third-parties to whom the Software is furnished to -do so, all subject to the following: - -The copyright notices in the Software and this entire statement, including -the above license grant, this restriction and the following disclaimer, -must be included in all copies of the Software, in whole or in part, and -all derivative works of the Software, unless such copies or derivative -works are solely in the form of machine-executable object code generated by -a source language processor. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT -SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE -FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. diff --git a/contrib/restricted/boost/logic/README.md b/contrib/restricted/boost/logic/README.md deleted file mode 100644 index 290f4cbcab..0000000000 --- a/contrib/restricted/boost/logic/README.md +++ /dev/null @@ -1,34 +0,0 @@ -Logic, part of collection of the [Boost C++ Libraries](http://github.com/boostorg), provides `boost::logic::tribool` for 3-state boolean logic. - -### License - -Distributed under the [Boost Software License, Version 1.0](http://www.boost.org/LICENSE_1_0.txt). - -### Properties - -* C++03 -* Header Only - -### Build Status - -Branch | GHA CI | Appveyor | Coverity Scan | codecov.io | Deps | Docs | Tests | -:-------------: | ------ | -------- | ------------- | ---------- | ---- | ---- | ----- | -[`master`](https://github.com/boostorg/logic/tree/master) | [![Build Status](https://github.com/boostorg/logic/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/boostorg/logic/actions?query=branch:master) | [![Build status](https://ci.appveyor.com/api/projects/status/a898pj8spmo2t3x9/branch/master?svg=true)](https://ci.appveyor.com/project/jeking3/logic-vv3ct/branch/master) | [![Coverity Scan Build Status](https://scan.coverity.com/projects/16173/badge.svg)](https://scan.coverity.com/projects/boostorg-logic) | [![codecov](https://codecov.io/gh/boostorg/logic/branch/master/graph/badge.svg)](https://codecov.io/gh/boostorg/logic/branch/master)| [![Deps](https://img.shields.io/badge/deps-master-brightgreen.svg)](https://pdimov.github.io/boostdep-report/master/logic.html) | [![Documentation](https://img.shields.io/badge/docs-master-brightgreen.svg)](http://www.boost.org/doc/libs/master/doc/html/tribool.html) | [![Enter the Matrix](https://img.shields.io/badge/matrix-master-brightgreen.svg)](http://www.boost.org/development/tests/master/developer/logic.html) -[`develop`](https://github.com/boostorg/logic/tree/develop) | [![Build Status](https://github.com/boostorg/logic/actions/workflows/ci.yml/badge.svg?branch=develop)](https://github.com/boostorg/logic/actions?query=branch:develop) | [![Build status](https://ci.appveyor.com/api/projects/status/a898pj8spmo2t3x9/branch/develop?svg=true)](https://ci.appveyor.com/project/jeking3/logic-vv3ct/branch/develop) | [![Coverity Scan Build Status](https://scan.coverity.com/projects/16173/badge.svg)](https://scan.coverity.com/projects/boostorg-logic) | [![codecov](https://codecov.io/gh/boostorg/logic/branch/develop/graph/badge.svg)](https://codecov.io/gh/boostorg/logic/branch/develop) | [![Deps](https://img.shields.io/badge/deps-develop-brightgreen.svg)](https://pdimov.github.io/boostdep-report/develop/logic.html) | [![Documentation](https://img.shields.io/badge/docs-develop-brightgreen.svg)](http://www.boost.org/doc/libs/develop/doc/html/tribool.html) | [![Enter the Matrix](https://img.shields.io/badge/matrix-develop-brightgreen.svg)](http://www.boost.org/development/tests/develop/developer/logic.html) - -### Directories - -| Name | Purpose | -| ----------- | ------------------------------ | -| `doc` | documentation | -| `example` | examples | -| `include` | headers | -| `test` | unit tests | - -### More information - -* [Ask questions](http://stackoverflow.com/questions/ask?tags=c%2B%2B,boost,boost-logic) -* [Report bugs](https://github.com/boostorg/logic/issues): Be sure to mention Boost version, platform and compiler you're using. A small compilable code sample to reproduce the problem is always good as well. -* Submit your patches as pull requests against **develop** branch. Note that by submitting patches you agree to license your modifications under the [Boost Software License, Version 1.0](http://www.boost.org/LICENSE_1_0.txt). -* Discussions about the library are held on the [Boost developers mailing list](http://www.boost.org/community/groups.html#main). Be sure to read the [discussion policy](http://www.boost.org/community/policy.html) before posting and add the `[logic]` tag at the beginning of the subject line. - diff --git a/contrib/restricted/boost/mp11/include/boost/mp11/detail/mpl_common.hpp b/contrib/restricted/boost/mp11/include/boost/mp11/detail/mpl_common.hpp deleted file mode 100644 index 208885cbd0..0000000000 --- a/contrib/restricted/boost/mp11/include/boost/mp11/detail/mpl_common.hpp +++ /dev/null @@ -1,160 +0,0 @@ -#ifndef BOOST_MP11_DETAIL_MPL_COMMON_HPP_INCLUDED -#define BOOST_MP11_DETAIL_MPL_COMMON_HPP_INCLUDED - -// Copyright 2017, 2019 Peter Dimov. -// -// Distributed under the Boost Software License, Version 1.0. -// -// See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt - -#include <boost/mp11/list.hpp> -#include <boost/mp11/algorithm.hpp> - -namespace boost -{ -namespace mpl -{ - -struct forward_iterator_tag; - -namespace aux -{ - -struct mp11_tag {}; - -template<class L> struct mp11_iterator -{ - using category = forward_iterator_tag; - - using type = mp11::mp_first<L>; - using next = mp11_iterator<mp11::mp_rest<L>>; -}; - -} // namespace aux - -// at - -template< typename Tag > struct at_impl; - -template<> struct at_impl<aux::mp11_tag> -{ - template<class L, class I> struct apply - { - using type = mp11::mp_at<L, I>; - }; -}; - -// back - -template< typename Tag > struct back_impl; - -template<> struct back_impl<aux::mp11_tag> -{ - template<class L> struct apply - { - using N = mp11::mp_size<L>; - using type = mp11::mp_at_c<L, N::value - 1>; - }; -}; - -// begin - -template< typename Tag > struct begin_impl; - -template<> struct begin_impl<aux::mp11_tag> -{ - template<class L> struct apply - { - using type = aux::mp11_iterator<L>; - }; -}; - -// clear - -template< typename Tag > struct clear_impl; - -template<> struct clear_impl<aux::mp11_tag> -{ - template<class L> struct apply - { - using type = mp11::mp_clear<L>; - }; -}; - -// end - -template< typename Tag > struct end_impl; - -template<> struct end_impl<aux::mp11_tag> -{ - template<class L> struct apply - { - using type = aux::mp11_iterator<mp11::mp_clear<L>>; - }; -}; - -// front - -template< typename Tag > struct front_impl; - -template<> struct front_impl<aux::mp11_tag> -{ - template<class L> struct apply - { - using type = mp11::mp_front<L>; - }; -}; - -// pop_front - -template< typename Tag > struct pop_front_impl; - -template<> struct pop_front_impl<aux::mp11_tag> -{ - template<class L> struct apply - { - using type = mp11::mp_pop_front<L>; - }; -}; - -// push_back - -template< typename Tag > struct push_back_impl; - -template<> struct push_back_impl<aux::mp11_tag> -{ - template<class L, class T> struct apply - { - using type = mp11::mp_push_back<L, T>; - }; -}; - -// push_front - -template< typename Tag > struct push_front_impl; - -template<> struct push_front_impl<aux::mp11_tag> -{ - template<class L, class T> struct apply - { - using type = mp11::mp_push_front<L, T>; - }; -}; - -// size - -template< typename Tag > struct size_impl; - -template<> struct size_impl<aux::mp11_tag> -{ - template<class L> struct apply - { - using type = mp11::mp_size<L>; - }; -}; - -} // namespace mpl -} // namespace boost - -#endif // #ifndef BOOST_MP11_DETAIL_MPL_COMMON_HPP_INCLUDED diff --git a/contrib/restricted/boost/mp11/include/boost/mp11/map.hpp b/contrib/restricted/boost/mp11/include/boost/mp11/map.hpp deleted file mode 100644 index b9581ac922..0000000000 --- a/contrib/restricted/boost/mp11/include/boost/mp11/map.hpp +++ /dev/null @@ -1,119 +0,0 @@ -#ifndef BOOST_MP11_MAP_HPP_INCLUDED -#define BOOST_MP11_MAP_HPP_INCLUDED - -// Copyright 2015-2017 Peter Dimov. -// -// Distributed under the Boost Software License, Version 1.0. -// -// See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt - -#include <boost/mp11/detail/mp_map_find.hpp> -#include <boost/mp11/list.hpp> -#include <boost/mp11/integral.hpp> -#include <boost/mp11/utility.hpp> -#include <boost/mp11/algorithm.hpp> -#include <boost/mp11/function.hpp> -#include <boost/mp11/set.hpp> -#include <type_traits> - -namespace boost -{ -namespace mp11 -{ - -// mp_map_contains<M, K> -template<class M, class K> using mp_map_contains = mp_not<std::is_same<mp_map_find<M, K>, void>>; - -// mp_map_insert<M, T> -template<class M, class T> using mp_map_insert = mp_if< mp_map_contains<M, mp_first<T>>, M, mp_push_back<M, T> >; - -// mp_map_replace<M, T> -namespace detail -{ - -template<class M, class T> struct mp_map_replace_impl; - -template<template<class...> class M, class... U, class T> struct mp_map_replace_impl<M<U...>, T> -{ - using K = mp_first<T>; - - // mp_replace_if is inlined here using a struct _f because of msvc-14.0 - - template<class V> struct _f { using type = mp_if< std::is_same<mp_first<V>, K>, T, V >; }; - - using type = mp_if< mp_map_contains<M<U...>, K>, M<typename _f<U>::type...>, M<U..., T> >; -}; - -} // namespace detail - -template<class M, class T> using mp_map_replace = typename detail::mp_map_replace_impl<M, T>::type; - -// mp_map_update<M, T, F> -namespace detail -{ - -template<class M, class T, template<class...> class F> struct mp_map_update_impl -{ - template<class U> using _f = std::is_same<mp_first<T>, mp_first<U>>; - - // _f3<L<X, Y...>> -> L<X, F<X, Y...>> - template<class L> using _f3 = mp_assign<L, mp_list<mp_first<L>, mp_rename<L, F> > >; - - using type = mp_if< mp_map_contains<M, mp_first<T>>, mp_transform_if<_f, _f3, M>, mp_push_back<M, T> >; -}; - -} // namespace detail - -template<class M, class T, template<class...> class F> using mp_map_update = typename detail::mp_map_update_impl<M, T, F>::type; -template<class M, class T, class Q> using mp_map_update_q = mp_map_update<M, T, Q::template fn>; - -// mp_map_erase<M, K> -namespace detail -{ - -template<class M, class K> struct mp_map_erase_impl -{ - template<class T> using _f = std::is_same<mp_first<T>, K>; - using type = mp_remove_if<M, _f>; -}; - -} // namespace detail - -template<class M, class K> using mp_map_erase = typename detail::mp_map_erase_impl<M, K>::type; - -// mp_map_keys<M> -template<class M> using mp_map_keys = mp_transform<mp_first, M>; - -// mp_is_map<M> -namespace detail -{ - -template<class L> struct mp_is_map_element: mp_false -{ -}; - -template<template<class...> class L, class T1, class... T> struct mp_is_map_element<L<T1, T...>>: mp_true -{ -}; - -template<class M> using mp_keys_are_set = mp_is_set<mp_map_keys<M>>; - -template<class M> struct mp_is_map_impl -{ - using type = mp_false; -}; - -template<template<class...> class M, class... T> struct mp_is_map_impl<M<T...>> -{ - using type = mp_eval_if<mp_not<mp_all<mp_is_map_element<T>...>>, mp_false, mp_keys_are_set, M<T...>>; -}; - -} // namespace detail - -template<class M> using mp_is_map = typename detail::mp_is_map_impl<M>::type; - -} // namespace mp11 -} // namespace boost - -#endif // #ifndef BOOST_MP11_MAP_HPP_INCLUDED diff --git a/contrib/restricted/boost/mp11/include/boost/mp11/mpl.hpp b/contrib/restricted/boost/mp11/include/boost/mp11/mpl.hpp deleted file mode 100644 index 994705ffc4..0000000000 --- a/contrib/restricted/boost/mp11/include/boost/mp11/mpl.hpp +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef BOOST_MP11_MPL_HPP_INCLUDED -#define BOOST_MP11_MPL_HPP_INCLUDED - -// Copyright 2017, 2019 Peter Dimov. -// -// Distributed under the Boost Software License, Version 1.0. -// -// See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt - -#include <boost/mp11/mpl_list.hpp> -#include <boost/mp11/mpl_tuple.hpp> - -#endif // #ifndef BOOST_MP11_MPL_HPP_INCLUDED diff --git a/contrib/restricted/boost/mp11/include/boost/mp11/mpl_list.hpp b/contrib/restricted/boost/mp11/include/boost/mp11/mpl_list.hpp deleted file mode 100644 index 643da43a08..0000000000 --- a/contrib/restricted/boost/mp11/include/boost/mp11/mpl_list.hpp +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef BOOST_MP11_MPL_LIST_HPP_INCLUDED -#define BOOST_MP11_MPL_LIST_HPP_INCLUDED - -// Copyright 2017, 2019 Peter Dimov. -// -// Distributed under the Boost Software License, Version 1.0. -// -// See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt - -#include <boost/mp11/detail/mpl_common.hpp> - -namespace boost -{ -namespace mpl -{ - -template< typename Sequence > struct sequence_tag; - -template<class... T> struct sequence_tag<mp11::mp_list<T...>> -{ - using type = aux::mp11_tag; -}; - -} // namespace mpl -} // namespace boost - -#endif // #ifndef BOOST_MP11_MPL_LIST_HPP_INCLUDED diff --git a/contrib/restricted/boost/mp11/include/boost/mp11/mpl_tuple.hpp b/contrib/restricted/boost/mp11/include/boost/mp11/mpl_tuple.hpp deleted file mode 100644 index b6900b1cd4..0000000000 --- a/contrib/restricted/boost/mp11/include/boost/mp11/mpl_tuple.hpp +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef BOOST_MP11_MPL_TUPLE_HPP_INCLUDED -#define BOOST_MP11_MPL_TUPLE_HPP_INCLUDED - -// Copyright 2017, 2019 Peter Dimov. -// -// Distributed under the Boost Software License, Version 1.0. -// -// See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt - -#include <boost/mp11/detail/mpl_common.hpp> -#include <tuple> - -namespace boost -{ -namespace mpl -{ - -template< typename Sequence > struct sequence_tag; - -template<class... T> struct sequence_tag<std::tuple<T...>> -{ - using type = aux::mp11_tag; -}; - -} // namespace mpl -} // namespace boost - -#endif // #ifndef BOOST_MP11_MPL_TUPLE_HPP_INCLUDED diff --git a/contrib/restricted/boost/multiprecision/LICENSE b/contrib/restricted/boost/multiprecision/LICENSE deleted file mode 100644 index 36b7cd93cd..0000000000 --- a/contrib/restricted/boost/multiprecision/LICENSE +++ /dev/null @@ -1,23 +0,0 @@ -Boost Software License - Version 1.0 - August 17th, 2003 - -Permission is hereby granted, free of charge, to any person or organization -obtaining a copy of the software and accompanying documentation covered by -this license (the "Software") to use, reproduce, display, distribute, -execute, and transmit the Software, and to prepare derivative works of the -Software, and to permit third-parties to whom the Software is furnished to -do so, all subject to the following: - -The copyright notices in the Software and this entire statement, including -the above license grant, this restriction and the following disclaimer, -must be included in all copies of the Software, in whole or in part, and -all derivative works of the Software, unless such copies or derivative -works are solely in the form of machine-executable object code generated by -a source language processor. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT -SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE -FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. diff --git a/contrib/restricted/boost/multiprecision/README.md b/contrib/restricted/boost/multiprecision/README.md deleted file mode 100644 index 07a480377f..0000000000 --- a/contrib/restricted/boost/multiprecision/README.md +++ /dev/null @@ -1,65 +0,0 @@ -Boost Multiprecision Library -============================ - ->ANNOUNCEMENT: Support for C++11 will be deprecated in this library starting in July 2023 (Boost 1.82). ->New features will require *at least* C++14, as will existing features starting with the deprecation release. - -| | Master | Develop | -|------------------|----------|-------------| -| Drone | [![Build Status](https://drone.cpp.al/api/badges/boostorg/multiprecision/status.svg?ref=refs/heads/master)](https://drone.cpp.al/boostorg/multiprecision) | [![Build Status](https://drone.cpp.al/api/badges/boostorg/multiprecision/status.svg)](https://drone.cpp.al/boostorg/multiprecision) | -| Github Actions | [![Build Status](https://github.com/boostorg/multiprecision/workflows/multiprecision/badge.svg?branch=master)](https://github.com/boostorg/multiprecision/actions) | [![Build Status](https://github.com/boostorg/multiprecision/workflows/multiprecision/badge.svg?branch=develop)](https://github.com/boostorg/multiprecision/actions) | - - The Multiprecision Library provides integer, rational, floating-point, complex and interval number types in C++ that have more range and - precision than C++'s ordinary built-in types. The big number types in Multiprecision can be used with a wide selection of basic - mathematical operations, elementary transcendental functions as well as the functions in Boost.Math. The Multiprecision types can - also interoperate with the built-in types in C++ using clearly defined conversion rules. This allows Boost.Multiprecision to be - used for all kinds of mathematical calculations involving integer, rational and floating-point types requiring extended range and precision. - -Multiprecision consists of a generic interface to the mathematics of large numbers as well as a selection of big number back ends, with -support for integer, rational and floating-point types. Boost.Multiprecision provides a selection of back ends provided off-the-rack in -including interfaces to GMP, MPFR, MPIR, TomMath as well as its own collection of Boost-licensed, header-only back ends for integers, -rationals, floats and complex. In addition, user-defined back ends can be created and used with the interface of Multiprecision, provided the class implementation adheres to the necessary concepts. - -Depending upon the number type, precision may be arbitrarily large (limited only by available memory), fixed at compile time -(for example 50 or 100 decimal digits), or a variable controlled at run-time by member functions. The types are expression-template-enabled -for better performance than naive user-defined types. - -The full documentation is available on [boost.org](http://www.boost.org/doc/libs/release/libs/multiprecision/index.html). - -## Standalone (BETA) ## - -Defining BOOST_MP_STANDALONE allows Boost.Multiprecision to be used with the only dependency being [Boost.Config](https://github.com/boostorg/config). Our package on this page -already includes a copy of Boost.Config so no other donwloads are required. Some functionality is reduced in this mode. A static_assert message will alert you if a particular feature has been disabled by standalone mode. -[Boost.Math](https://github.com/boostorg/math) standalone mode is compatiable, and recommended if special functions is required. - -## Support, bugs and feature requests ## - -Bugs and feature requests can be reported through the [Gitub issue tracker](https://github.com/boostorg/multiprecision/issues) -(see [open issues](https://github.com/boostorg/multiprecision/issues) and -[closed issues](https://github.com/boostorg/multiprecision/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aclosed)). - -You can submit your changes through a [pull request](https://github.com/boostorg/multiprecision/pulls). - -There is no mailing-list specific to Boost Multiprecision, although you can use the general-purpose Boost [mailing-list](http://lists.boost.org/mailman/listinfo.cgi/boost-users) using the tag [multiprecision]. - - -## Development ## - -Clone the whole boost project, which includes the individual Boost projects as submodules ([see boost+git doc](https://github.com/boostorg/boost/wiki/Getting-Started)): - - git clone https://github.com/boostorg/boost - cd boost - git submodule update --init - -The Boost Multiprecision Library is located in `libs/multiprecision/`. - -### Running tests ### -First, build the B2 engine by running `bootstrap.sh` in the root of the boost directory. This will generate B2 configuration in `project-config.jam`. - - ./bootstrap.sh - -Now make sure you are in `libs/multiprecision/test`. You can either run all the tests listed in `Jamfile.v2` or run a single test: - - ../../../b2 <- run all tests - ../../../b2 test_complex <- single test - diff --git a/contrib/restricted/boost/numeric_conversion/include/boost/cast.hpp b/contrib/restricted/boost/numeric_conversion/include/boost/cast.hpp deleted file mode 100644 index ab452bdf16..0000000000 --- a/contrib/restricted/boost/numeric_conversion/include/boost/cast.hpp +++ /dev/null @@ -1,20 +0,0 @@ -// boost cast.hpp header file -// -// (C) Copyright Antony Polukhin 2014. -// -// Distributed under the Boost -// Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/conversion for Documentation. - -// This is a DEPRECATED header file! -// Use <boost/polymorphic_cast.hpp> or <boost/numeric/conversion/cast.hpp> instead - -#ifndef BOOST_CAST_HPP -#define BOOST_CAST_HPP - -# include <boost/polymorphic_cast.hpp> -# include <boost/numeric/conversion/cast.hpp> - -#endif // BOOST_CAST_HPP diff --git a/contrib/restricted/boost/odeint/CHANGELOG b/contrib/restricted/boost/odeint/CHANGELOG deleted file mode 100644 index b1537eb1ac..0000000000 --- a/contrib/restricted/boost/odeint/CHANGELOG +++ /dev/null @@ -1,9 +0,0 @@ -odeint 2.1 - -* versioning system -* generation functions -* bugfixing - -odeint 2.2 (still running) - -* removing same_size and resize from state_wrapper into separate functions diff --git a/contrib/restricted/boost/odeint/README.md b/contrib/restricted/boost/odeint/README.md deleted file mode 100644 index 23e4f88b5d..0000000000 --- a/contrib/restricted/boost/odeint/README.md +++ /dev/null @@ -1,3 +0,0 @@ -[![Build Status](https://travis-ci.org/headmyshoulder/odeint-v2.svg?branch=master)](https://travis-ci.org/headmyshoulder/odeint-v2) - -odeint is a highly flexible library for solving ordinary differential equations. diff --git a/contrib/restricted/boost/process/README.md b/contrib/restricted/boost/process/README.md deleted file mode 100644 index e0a141a8d6..0000000000 --- a/contrib/restricted/boost/process/README.md +++ /dev/null @@ -1,24 +0,0 @@ -# [Boost Process (Boost.Process)](https://github.com/klemens-morgenstern/boost-process) - -Boost.process is a library for comfortable management of processes, released with boost 1.64.0. - -### Test results - -Branches | Build | Tests coverage | -----------------|-------------- | -------------- | -Develop: | [![Build Status](https://travis-ci.org/klemens-morgenstern/boost-process.svg?branch=develop)](https://travis-ci.org/klemens-morgenstern/boost-process) [![Build status](https://ci.appveyor.com/api/projects/status/peup7e6m0e1bb5ba?svg=true)](https://ci.appveyor.com/project/klemens-morgenstern/boost-process) | [![Coverage Status](https://coveralls.io/repos/github/klemens-morgenstern/boost-process/badge.svg?branch=develop)](https://coveralls.io/github/klemens-morgenstern/boost-process?branch=develop) | -Master: | [![Build Status](https://travis-ci.org/klemens-morgenstern/boost-process.svg?branch=master)](https://travis-ci.org/klemens-morgenstern/boost-process) [![Build status](https://ci.appveyor.com/api/projects/status/peup7e6m0e1bb5ba/branch/master?svg=true)](https://ci.appveyor.com/project/klemens-morgenstern/boost-process/branch/master) | [![Coverage Status](https://coveralls.io/repos/github/klemens-morgenstern/boost-process/badge.svg?branch=master)](https://coveralls.io/github/klemens-morgenstern/boost-process?branch=master) | - -[Open Issues](https://github.com/klemens-morgenstern/boost-process/issues) - -[Latest developer documentation](http://klemens-morgenstern.github.io/process/) - -### About -This C++11 library is the current result of a long attempt to get a boost.process library, which is going on since 2006. - -### License -Distributed under the [Boost Software License, Version 1.0](http://www.boost.org/LICENSE_1_0.txt). - -### Dependency - -This library requires boost 1.64 with which it is released. diff --git a/contrib/restricted/boost/ptr_container/LICENSE b/contrib/restricted/boost/ptr_container/LICENSE deleted file mode 100644 index 36b7cd93cd..0000000000 --- a/contrib/restricted/boost/ptr_container/LICENSE +++ /dev/null @@ -1,23 +0,0 @@ -Boost Software License - Version 1.0 - August 17th, 2003 - -Permission is hereby granted, free of charge, to any person or organization -obtaining a copy of the software and accompanying documentation covered by -this license (the "Software") to use, reproduce, display, distribute, -execute, and transmit the Software, and to prepare derivative works of the -Software, and to permit third-parties to whom the Software is furnished to -do so, all subject to the following: - -The copyright notices in the Software and this entire statement, including -the above license grant, this restriction and the following disclaimer, -must be included in all copies of the Software, in whole or in part, and -all derivative works of the Software, unless such copies or derivative -works are solely in the form of machine-executable object code generated by -a source language processor. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT -SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE -FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. diff --git a/contrib/restricted/boost/ptr_container/README.md b/contrib/restricted/boost/ptr_container/README.md deleted file mode 100644 index 86fd73b80d..0000000000 --- a/contrib/restricted/boost/ptr_container/README.md +++ /dev/null @@ -1,33 +0,0 @@ -PtrContainer, part of collection of the [Boost C++ Libraries](http://github.com/boostorg), provides containers for holding heap-allocated objects in an exception-safe manner and with minimal overhead. - -### License - -Distributed under the [Boost Software License, Version 1.0](http://www.boost.org/LICENSE_1_0.txt). - -### Properties - -* C++03 -* Header Only - -### Build Status - -Branch | GHA CI | Appveyor | Coverity Scan | codecov.io | Deps | Docs | Tests | -:-------------: | ------ | -------- | ------------- | ---------- | ---- | ---- | ----- | -[`master`](https://github.com/boostorg/ptr_container/tree/master) | [![Build Status](https://github.com/boostorg/ptr_container/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/boostorg/ptr_container/actions?query=branch:master) | [![Build status](https://ci.appveyor.com/api/projects/status/xsoiss46xfe6ilig/branch/master?svg=true)](https://ci.appveyor.com/project/jeking3/ptr-container-lviqw/branch/master) | [![Coverity Scan Build Status](https://scan.coverity.com/projects/15842/badge.svg)](https://scan.coverity.com/projects/boostorg-ptr_container) | [![codecov](https://codecov.io/gh/boostorg/ptr_container/branch/master/graph/badge.svg)](https://codecov.io/gh/boostorg/ptr_container/branch/master)| [![Deps](https://img.shields.io/badge/deps-master-brightgreen.svg)](https://pdimov.github.io/boostdep-report/master/ptr_container.html) | [![Documentation](https://img.shields.io/badge/docs-master-brightgreen.svg)](https://www.boost.org/doc/libs/master/libs/ptr_container/doc/ptr_container.html) | [![Enter the Matrix](https://img.shields.io/badge/matrix-master-brightgreen.svg)](http://www.boost.org/development/tests/master/developer/ptr_container.html) -[`develop`](https://github.com/boostorg/ptr_container/tree/develop) | [![Build Status](https://github.com/boostorg/ptr_container/actions/workflows/ci.yml/badge.svg?branch=develop)](https://github.com/boostorg/ptr_container/actions?query=branch:develop) | [![Build status](https://ci.appveyor.com/api/projects/status/xsoiss46xfe6ilig/branch/develop?svg=true)](https://ci.appveyor.com/project/jeking3/ptr-container-lviqw/branch/develop) | [![Coverity Scan Build Status](https://scan.coverity.com/projects/15842/badge.svg)](https://scan.coverity.com/projects/boostorg-ptr_container) | [![codecov](https://codecov.io/gh/boostorg/ptr_container/branch/develop/graph/badge.svg)](https://codecov.io/gh/boostorg/ptr_container/branch/develop) | [![Deps](https://img.shields.io/badge/deps-develop-brightgreen.svg)](https://pdimov.github.io/boostdep-report/develop/ptr_container.html) | [![Documentation](https://img.shields.io/badge/docs-develop-brightgreen.svg)](https://www.boost.org/doc/libs/develop/libs/ptr_container/doc/ptr_container.html) | [![Enter the Matrix](https://img.shields.io/badge/matrix-develop-brightgreen.svg)](http://www.boost.org/development/tests/develop/developer/ptr_container.html) - -### Directories - -| Name | Purpose | -| ----------- | ------------------------------ | -| `doc` | documentation | -| `include` | headers | -| `test` | unit tests | - -### More information - -* [Ask questions](http://stackoverflow.com/questions/ask?tags=c%2B%2B,boost,boost-ptr_container) -* [Report bugs](https://github.com/boostorg/ptr_container/issues): Be sure to mention Boost version, platform and compiler you're using. A small compilable code sample to reproduce the problem is always good as well. -* Submit your patches as pull requests against **develop** branch. Note that by submitting patches you agree to license your modifications under the [Boost Software License, Version 1.0](http://www.boost.org/LICENSE_1_0.txt). -* Discussions about the library are held on the [Boost developers mailing list](http://www.boost.org/community/groups.html#main). Be sure to read the [discussion policy](http://www.boost.org/community/policy.html) before posting and add the `[ptr_container]` tag at the beginning of the subject line. - diff --git a/contrib/restricted/boost/python/LICENSE_1_0.txt b/contrib/restricted/boost/python/LICENSE_1_0.txt deleted file mode 100644 index 36b7cd93cd..0000000000 --- a/contrib/restricted/boost/python/LICENSE_1_0.txt +++ /dev/null @@ -1,23 +0,0 @@ -Boost Software License - Version 1.0 - August 17th, 2003 - -Permission is hereby granted, free of charge, to any person or organization -obtaining a copy of the software and accompanying documentation covered by -this license (the "Software") to use, reproduce, display, distribute, -execute, and transmit the Software, and to prepare derivative works of the -Software, and to permit third-parties to whom the Software is furnished to -do so, all subject to the following: - -The copyright notices in the Software and this entire statement, including -the above license grant, this restriction and the following disclaimer, -must be included in all copies of the Software, in whole or in part, and -all derivative works of the Software, unless such copies or derivative -works are solely in the form of machine-executable object code generated by -a source language processor. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT -SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE -FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. diff --git a/contrib/restricted/boost/python/README.md b/contrib/restricted/boost/python/README.md deleted file mode 100644 index f57b97505a..0000000000 --- a/contrib/restricted/boost/python/README.md +++ /dev/null @@ -1,59 +0,0 @@ -![logo](https://raw.githubusercontent.com/boostorg/python/develop/doc/images/bpl.png) - -# Synopsis - -[![Join the chat at https://gitter.im/boostorg/python](https://badges.gitter.im/boostorg/python.svg)](https://gitter.im/boostorg/python?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) - -Welcome to Boost.Python, a C++ library which enables seamless interoperability between C++ and the Python programming language. The library includes support for: - -* References and Pointers -* Globally Registered Type Coercions -* Automatic Cross-Module Type Conversions -* Efficient Function Overloading -* C++ to Python Exception Translation -* Default Arguments -* Keyword Arguments -* Manipulating Python objects in C++ -* Exporting C++ Iterators as Python Iterators -* Documentation Strings - -See the [Boost.Python](http://boostorg.github.io/python) documentation for details. - -**Hint :** Check out the [development version](http://boostorg.github.io/python/develop) of the documentation to see work in progress. - -# Building ![Test Ubuntu](https://github.com/boostorg/python/workflows/Test%20Ubuntu/badge.svg) ![Test OSX](https://github.com/boostorg/python/workflows/Test%20OSX/badge.svg) ![Test Windows](https://github.com/boostorg/python/workflows/Test%20Windows/badge.svg) - -While Boost.Python is part of the Boost C++ Libraries super-project, and thus can be compiled as part of Boost, it can also be compiled and installed stand-alone, i.e. against a pre-installed Boost package. - -## Prerequisites - -* [Python](http://www.python.org) -* [Boost](http://www.boost.org) -* [Faber](https://stefanseefeld.github.io/faber) - -## Build - -Run - -``` -faber -``` -to build the library. - -## Test - -Run - -``` -faber test.report -``` -to run the tests. - -## Build docs - -Run - -``` -faber doc.html -``` -to build the documentation. diff --git a/contrib/restricted/boost/python/include/boost/python/arg_from_python.hpp b/contrib/restricted/boost/python/include/boost/python/arg_from_python.hpp deleted file mode 100644 index 983726b065..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/arg_from_python.hpp +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef ARG_FROM_PYTHON_DWA2002128_HPP -# define ARG_FROM_PYTHON_DWA2002128_HPP - -# include <boost/python/detail/prefix.hpp> -# include <boost/python/converter/arg_from_python.hpp> -# if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1400)) \ - || BOOST_WORKAROUND(BOOST_INTEL_WIN, BOOST_TESTED_AT(800)) -# include <boost/python/detail/type_traits.hpp> -#endif - -namespace boost { namespace python { - -template <class T> -struct arg_from_python - : converter::select_arg_from_python< -# if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1400)) \ - || BOOST_WORKAROUND(BOOST_INTEL_WIN, BOOST_TESTED_AT(800)) - typename detail::remove_cv<T>::type -# else - T -# endif - >::type -{ - typedef typename converter::select_arg_from_python< -# if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1400)) \ - || BOOST_WORKAROUND(BOOST_INTEL_WIN, BOOST_TESTED_AT(800)) - typename detail::remove_cv<T>::type -# else - T -# endif - >::type base; - - arg_from_python(PyObject*); -}; - -// specialization for PyObject* -template <> -struct arg_from_python<PyObject*> -{ - typedef PyObject* result_type; - - arg_from_python(PyObject* p) : m_source(p) {} - bool convertible() const { return true; } - PyObject* operator()() const { return m_source; } - private: - PyObject* m_source; -}; - -template <> -struct arg_from_python<PyObject* const&> -{ - typedef PyObject* const& result_type; - - arg_from_python(PyObject* p) : m_source(p) {} - bool convertible() const { return true; } - PyObject*const& operator()() const { return m_source; } - private: - PyObject* m_source; -}; - -// -// implementations -// -template <class T> -inline arg_from_python<T>::arg_from_python(PyObject* source) - : base(source) -{ -} - -}} // namespace boost::python - -#endif // ARG_FROM_PYTHON_DWA2002128_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/args.hpp b/contrib/restricted/boost/python/include/boost/python/args.hpp deleted file mode 100644 index 27731bd8c9..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/args.hpp +++ /dev/null @@ -1,146 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef KEYWORDS_DWA2002323_HPP -# define KEYWORDS_DWA2002323_HPP - -# include <boost/python/detail/prefix.hpp> - -# include <boost/python/args_fwd.hpp> -# include <boost/config.hpp> -# include <boost/python/detail/preprocessor.hpp> -# include <boost/python/detail/type_list.hpp> -# include <boost/python/detail/type_traits.hpp> - -# include <boost/preprocessor/enum_params.hpp> -# include <boost/preprocessor/repeat.hpp> -# include <boost/preprocessor/facilities/intercept.hpp> -# include <boost/preprocessor/iteration/local.hpp> - -# include <boost/python/detail/mpl_lambda.hpp> -# include <boost/python/object_core.hpp> - -# include <boost/mpl/bool.hpp> - -# include <cstddef> -# include <algorithm> - -namespace boost { namespace python { - -typedef detail::keywords<1> arg; -typedef arg arg_; // gcc 2.96 workaround - -namespace detail -{ - template <std::size_t nkeywords> - struct keywords_base - { - BOOST_STATIC_CONSTANT(std::size_t, size = nkeywords); - - keyword_range range() const - { - return keyword_range(elements, elements + nkeywords); - } - - keyword elements[nkeywords]; - - keywords<nkeywords+1> - operator,(python::arg const &k) const; - - keywords<nkeywords + 1> - operator,(char const *name) const; - }; - - template <std::size_t nkeywords> - struct keywords : keywords_base<nkeywords> - { - }; - - template <> - struct keywords<1> : keywords_base<1> - { - explicit keywords(char const *name) - { - elements[0].name = name; - } - - template <class T> - python::arg& operator=(T const& value) - { - object z(value); - elements[0].default_value = handle<>(python::borrowed(object(value).ptr())); - return *this; - } - - operator detail::keyword const&() const - { - return elements[0]; - } - }; - - template <std::size_t nkeywords> - inline - keywords<nkeywords+1> - keywords_base<nkeywords>::operator,(python::arg const &k) const - { - keywords<nkeywords> const& l = *static_cast<keywords<nkeywords> const*>(this); - python::detail::keywords<nkeywords+1> res; - std::copy(l.elements, l.elements+nkeywords, res.elements); - res.elements[nkeywords] = k.elements[0]; - return res; - } - - template <std::size_t nkeywords> - inline - keywords<nkeywords + 1> - keywords_base<nkeywords>::operator,(char const *name) const - { - return this->operator,(python::arg(name)); - } - - template<typename T> - struct is_keywords - { - BOOST_STATIC_CONSTANT(bool, value = false); - }; - - template<std::size_t nkeywords> - struct is_keywords<keywords<nkeywords> > - { - BOOST_STATIC_CONSTANT(bool, value = true); - }; - template <class T> - struct is_reference_to_keywords - { - BOOST_STATIC_CONSTANT(bool, is_ref = detail::is_reference<T>::value); - typedef typename detail::remove_reference<T>::type deref; - typedef typename detail::remove_cv<deref>::type key_t; - BOOST_STATIC_CONSTANT(bool, is_key = is_keywords<key_t>::value); - BOOST_STATIC_CONSTANT(bool, value = (is_ref & is_key)); - - typedef mpl::bool_<value> type; - BOOST_PYTHON_MPL_LAMBDA_SUPPORT(1,is_reference_to_keywords,(T)) - }; -} - -inline detail::keywords<1> args(char const* name) -{ - return detail::keywords<1>(name); -} - -# define BOOST_PYTHON_ASSIGN_NAME(z, n, _) result.elements[n].name = name##n; -# define BOOST_PP_LOCAL_MACRO(n) \ -inline detail::keywords<n> args(BOOST_PP_ENUM_PARAMS_Z(1, n, char const* name)) \ -{ \ - detail::keywords<n> result; \ - BOOST_PP_REPEAT_1(n, BOOST_PYTHON_ASSIGN_NAME, _) \ - return result; \ -} -# define BOOST_PP_LOCAL_LIMITS (2, BOOST_PYTHON_MAX_ARITY) -# include BOOST_PP_LOCAL_ITERATE() - -}} // namespace boost::python - - -# endif // KEYWORDS_DWA2002323_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/args_fwd.hpp b/contrib/restricted/boost/python/include/boost/python/args_fwd.hpp deleted file mode 100644 index 39239461b0..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/args_fwd.hpp +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef ARGS_FWD_DWA2002927_HPP -# define ARGS_FWD_DWA2002927_HPP - -# include <boost/python/detail/prefix.hpp> - -# include <boost/python/handle.hpp> -# include <boost/config.hpp> -# include <cstddef> -# include <utility> - -namespace boost { namespace python { - -namespace detail -{ - struct keyword - { - keyword(char const* name_=0) - : name(name_) - {} - - char const* name; - handle<> default_value; - }; - - template <std::size_t nkeywords = 0> struct keywords; - - typedef std::pair<keyword const*, keyword const*> keyword_range; - - template <> - struct keywords<0> - { - BOOST_STATIC_CONSTANT(std::size_t, size = 0); - static keyword_range range() { return keyword_range(); } - }; - - namespace error - { - template <int keywords, int function_args> - struct more_keywords_than_function_arguments - { - typedef char too_many_keywords[keywords > function_args ? -1 : 1]; - }; - } -} - -}} // namespace boost::python - -#endif // ARGS_FWD_DWA2002927_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/back_reference.hpp b/contrib/restricted/boost/python/include/boost/python/back_reference.hpp deleted file mode 100644 index e68066f7d5..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/back_reference.hpp +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef BACK_REFERENCE_DWA2002510_HPP -# define BACK_REFERENCE_DWA2002510_HPP - -# include <boost/python/detail/prefix.hpp> - -# include <boost/python/object_fwd.hpp> -# include <boost/python/detail/dependent.hpp> -# include <boost/python/detail/raw_pyobject.hpp> - -namespace boost { namespace python { - -template <class T> -struct back_reference -{ - private: // types - typedef typename detail::dependent<object,T>::type source_t; - public: - typedef T type; - - back_reference(PyObject*, T); - source_t const& source() const; - T get() const; - private: - source_t m_source; - T m_value; -}; - -template<typename T> -class is_back_reference -{ - public: - BOOST_STATIC_CONSTANT(bool, value = false); -}; - -template<typename T> -class is_back_reference<back_reference<T> > -{ - public: - BOOST_STATIC_CONSTANT(bool, value = true); -}; - - -// -// implementations -// -template <class T> -back_reference<T>::back_reference(PyObject* p, T x) - : m_source(detail::borrowed_reference(p)) - , m_value(x) -{ -} - -template <class T> -typename back_reference<T>::source_t const& back_reference<T>::source() const -{ - return m_source; -} - -template <class T> -T back_reference<T>::get() const -{ - return m_value; -} - -}} // namespace boost::python - -#endif // BACK_REFERENCE_DWA2002510_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/base_type_traits.hpp b/contrib/restricted/boost/python/include/boost/python/base_type_traits.hpp deleted file mode 100644 index e1c6a4843f..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/base_type_traits.hpp +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef BASE_TYPE_TRAITS_DWA2002614_HPP -# define BASE_TYPE_TRAITS_DWA2002614_HPP - -# include <boost/python/detail/prefix.hpp> - -namespace boost { namespace python { - -namespace detail -{ - struct unspecialized {}; -} - -// Derive from unspecialized so we can detect whether traits are -// specialized -template <class T> struct base_type_traits - : detail::unspecialized -{}; - -template <> -struct base_type_traits<PyObject> -{ - typedef PyObject type; -}; - -template <> -struct base_type_traits<PyTypeObject> -{ - typedef PyObject type; -}; - -template <> -struct base_type_traits<PyMethodObject> -{ - typedef PyObject type; -}; - -}} // namespace boost::python - -#endif // BASE_TYPE_TRAITS_DWA2002614_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/borrowed.hpp b/contrib/restricted/boost/python/include/boost/python/borrowed.hpp deleted file mode 100644 index fd2716bfbd..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/borrowed.hpp +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef BORROWED_DWA2002614_HPP -# define BORROWED_DWA2002614_HPP - -# include <boost/python/detail/prefix.hpp> -# include <boost/python/detail/borrowed_ptr.hpp> - -namespace boost { namespace python { - -template <class T> -inline python::detail::borrowed<T>* borrowed(T* p) -{ - return (detail::borrowed<T>*)p; -} - -}} // namespace boost::python - -#endif // BORROWED_DWA2002614_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/call.hpp b/contrib/restricted/boost/python/include/boost/python/call.hpp deleted file mode 100644 index c057ee9a12..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/call.hpp +++ /dev/null @@ -1,83 +0,0 @@ -#if !defined(BOOST_PP_IS_ITERATING) - -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -# ifndef CALL_DWA2002411_HPP -# define CALL_DWA2002411_HPP - -# include <boost/python/detail/prefix.hpp> - -# include <boost/type.hpp> - -# include <boost/python/converter/arg_to_python.hpp> -# include <boost/python/converter/return_from_python.hpp> -# include <boost/python/detail/preprocessor.hpp> -# include <boost/python/detail/void_return.hpp> - -# include <boost/preprocessor/comma_if.hpp> -# include <boost/preprocessor/iterate.hpp> -# include <boost/preprocessor/repeat.hpp> -# include <boost/preprocessor/debug/line.hpp> -# include <boost/preprocessor/repetition/enum_trailing_params.hpp> -# include <boost/preprocessor/repetition/enum_binary_params.hpp> - -namespace boost { namespace python { - -# define BOOST_PYTHON_FAST_ARG_TO_PYTHON_GET(z, n, _) \ - , converter::arg_to_python<A##n>(a##n).get() - -# define BOOST_PP_ITERATION_PARAMS_1 (3, (0, BOOST_PYTHON_MAX_ARITY, <boost/python/call.hpp>)) -# include BOOST_PP_ITERATE() - -# undef BOOST_PYTHON_FAST_ARG_TO_PYTHON_GET - -}} // namespace boost::python - -# endif // CALL_DWA2002411_HPP - -// For gcc 4.4 compatability, we must include the -// BOOST_PP_ITERATION_DEPTH test inside an #else clause. -#else // BOOST_PP_IS_ITERATING -#if BOOST_PP_ITERATION_DEPTH() == 1 -# if !(BOOST_WORKAROUND(__MWERKS__, > 0x3100) \ - && BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3201))) -# line BOOST_PP_LINE(__LINE__, call.hpp) -# endif - -# define N BOOST_PP_ITERATION() - -template < - class R - BOOST_PP_ENUM_TRAILING_PARAMS_Z(1, N, class A) - > -typename detail::returnable<R>::type -call(PyObject* callable - BOOST_PP_COMMA_IF(N) BOOST_PP_ENUM_BINARY_PARAMS_Z(1, N, A, const& a) - , boost::type<R>* = 0 - ) -{ - PyObject* const result = - PyObject_CallFunction( - callable - , const_cast<char*>("(" BOOST_PP_REPEAT_1ST(N, BOOST_PYTHON_FIXED, "O") ")") - BOOST_PP_REPEAT_1ST(N, BOOST_PYTHON_FAST_ARG_TO_PYTHON_GET, nil) - ); - - // This conversion *must not* be done in the same expression as - // the call, because, in the special case where the result is a - // reference a Python object which was created by converting a C++ - // argument for passing to PyObject_CallFunction, its reference - // count will be 2 until the end of the full expression containing - // the conversion, and that interferes with dangling - // pointer/reference detection. - converter::return_from_python<R> converter; - return converter(result); -} - -# undef N - -#endif // BOOST_PP_ITERATION_DEPTH() -#endif diff --git a/contrib/restricted/boost/python/include/boost/python/cast.hpp b/contrib/restricted/boost/python/include/boost/python/cast.hpp deleted file mode 100644 index c0dd229e84..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/cast.hpp +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef CAST_DWA200269_HPP -# define CAST_DWA200269_HPP - -# include <boost/python/detail/prefix.hpp> -# include <boost/python/detail/type_traits.hpp> - -# include <boost/type.hpp> -# include <boost/python/base_type_traits.hpp> -# include <boost/python/detail/convertible.hpp> - -namespace boost { namespace python { - -namespace detail -{ - template <class Source, class Target> inline Target* upcast_impl(Source*, Target*); - - template <class Source, class Target> - inline Target* upcast(Source* p, yes_convertible, no_convertible, Target*) - { - return p; - } - - template <class Source, class Target> - inline Target* upcast(Source* p, no_convertible, no_convertible, Target*) - { - typedef typename base_type_traits<Source>::type base; - - return detail::upcast_impl((base*)p, (Target*)0); - } - - template <bool is_same = true> - struct upcaster - { - template <class T> - static inline T* execute(T* x, T*) { return x; } - }; - - template <> - struct upcaster<false> - { - template <class Source, class Target> - static inline Target* execute(Source* x, Target*) - { - return detail::upcast( - x, detail::convertible<Target*>::check(x) - , detail::convertible<Source*>::check((Target*)0) - , (Target*)0); - } - }; - - - template <class Target, class Source> - inline Target* downcast(Source* p, yes_convertible) - { - return static_cast<Target*>(p); - } - - template <class Target, class Source> - inline Target* downcast(Source* p, no_convertible, boost::type<Target>* = 0) - { - typedef typename base_type_traits<Source>::type base; - return (Target*)detail::downcast<base>(p, convertible<Source*>::check((base*)0)); - } - - template <class T> - inline void assert_castable(boost::type<T>* = 0) - { - typedef char must_be_a_complete_type[sizeof(T)] BOOST_ATTRIBUTE_UNUSED; - } - - template <class Source, class Target> - inline Target* upcast_impl(Source* x, Target*) - { - typedef typename detail::add_cv<Source>::type src_t; - typedef typename detail::add_cv<Target>::type target_t; - bool const same = detail::is_same<src_t,target_t>::value; - - return detail::upcaster<same>::execute(x, (Target*)0); - } -} - -template <class Target, class Source> -inline Target* upcast(Source* x, Target* = 0) -{ - detail::assert_castable<Source>(); - detail::assert_castable<Target>(); - return detail::upcast_impl(x, (Target*)0); - -} - -template <class Target, class Source> -inline Target* downcast(Source* x, Target* = 0) -{ - detail::assert_castable<Source>(); - detail::assert_castable<Target>(); - return detail::downcast<Target>(x, detail::convertible<Source*>::check((Target*)0)); -} - -}} // namespace boost::python - -#endif // CAST_DWA200269_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/converter/arg_from_python.hpp b/contrib/restricted/boost/python/include/boost/python/converter/arg_from_python.hpp deleted file mode 100644 index 0c0daabc1f..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/converter/arg_from_python.hpp +++ /dev/null @@ -1,335 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef ARG_FROM_PYTHON_DWA2002127_HPP -# define ARG_FROM_PYTHON_DWA2002127_HPP - -# include <boost/python/detail/prefix.hpp> -# include <boost/python/converter/from_python.hpp> -# include <boost/python/detail/indirect_traits.hpp> -# include <boost/python/detail/type_traits.hpp> -# include <boost/python/converter/rvalue_from_python_data.hpp> -# include <boost/mpl/eval_if.hpp> -# include <boost/mpl/if.hpp> -# include <boost/mpl/identity.hpp> -# include <boost/mpl/and.hpp> -# include <boost/mpl/or.hpp> -# include <boost/mpl/not.hpp> -# include <boost/python/converter/registry.hpp> -# include <boost/python/converter/registered.hpp> -# include <boost/python/converter/registered_pointee.hpp> -# include <boost/python/detail/void_ptr.hpp> -# include <boost/python/back_reference.hpp> -# include <boost/python/detail/referent_storage.hpp> -# include <boost/python/converter/obj_mgr_arg_from_python.hpp> - -namespace boost { namespace python -{ - template <class T> struct arg_from_python; -}} - -// This header defines Python->C++ function argument converters, -// parametrized on the argument type. - -namespace boost { namespace python { namespace converter { - -// -// lvalue converters -// -// These require that an lvalue of the type U is stored somewhere in -// the Python object being converted. - -// Used when T == U*const& -template <class T> -struct pointer_cref_arg_from_python -{ - typedef T result_type; - - pointer_cref_arg_from_python(PyObject*); - T operator()() const; - bool convertible() const; - - private: // storage for a U* - // needed because not all compilers will let us declare U* as the - // return type of operator() -- we return U*const& instead - typename python::detail::referent_storage<T>::type m_result; -}; - -// Base class for pointer and reference converters -struct arg_lvalue_from_python_base -{ - public: // member functions - arg_lvalue_from_python_base(void* result); - bool convertible() const; - - protected: // member functions - void*const& result() const; - - private: // data members - void* m_result; -}; - -// Used when T == U* -template <class T> -struct pointer_arg_from_python : arg_lvalue_from_python_base -{ - typedef T result_type; - - pointer_arg_from_python(PyObject*); - T operator()() const; -}; - -// Used when T == U& and (T != V const& or T == W volatile&) -template <class T> -struct reference_arg_from_python : arg_lvalue_from_python_base -{ - typedef T result_type; - - reference_arg_from_python(PyObject*); - T operator()() const; -}; - -// =================== - -// -// rvalue converters -// -// These require only that an object of type T can be created from -// the given Python object, but not that the T object exist -// somewhere in storage. -// - -// Used when T is a plain value (non-pointer, non-reference) type or -// a (non-volatile) const reference to a plain value type. -template <class T> -struct arg_rvalue_from_python -{ - typedef typename boost::python::detail::add_lvalue_reference< - T - // We can't add_const here, or it would be impossible to pass - // auto_ptr<U> args from Python to C++ - >::type result_type; - - arg_rvalue_from_python(PyObject*); - bool convertible() const; - -# if _MSC_FULL_VER > 13102196 - typename arg_rvalue_from_python<T>:: -# endif - result_type operator()(); - - private: - rvalue_from_python_data<result_type> m_data; - PyObject* m_source; -}; - - -// ================== - -// Converts to a (PyObject*,T) bundle, for when you need a reference -// back to the Python object -template <class T> -struct back_reference_arg_from_python - : boost::python::arg_from_python<typename T::type> -{ - typedef T result_type; - - back_reference_arg_from_python(PyObject*); - T operator()(); - private: - typedef boost::python::arg_from_python<typename T::type> base; - PyObject* m_source; -}; - - -// ================== - -template <class C, class T, class F> -struct if_2 -{ - typedef typename mpl::eval_if<C, mpl::identity<T>, F>::type type; -}; - -// This metafunction selects the appropriate arg_from_python converter -// type for an argument of type T. -template <class T> -struct select_arg_from_python -{ - typedef typename if_2< - is_object_manager<T> - , object_manager_value_arg_from_python<T> - , if_2< - is_reference_to_object_manager<T> - , object_manager_ref_arg_from_python<T> - , if_2< - is_pointer<T> - , pointer_arg_from_python<T> - , if_2< - mpl::and_< - indirect_traits::is_reference_to_pointer<T> - , indirect_traits::is_reference_to_const<T> - , mpl::not_<indirect_traits::is_reference_to_volatile<T> > - > - , pointer_cref_arg_from_python<T> - , if_2< - mpl::or_< - indirect_traits::is_reference_to_non_const<T> - , indirect_traits::is_reference_to_volatile<T> - > - , reference_arg_from_python<T> - , mpl::if_< - boost::python::is_back_reference<T> - , back_reference_arg_from_python<T> - , arg_rvalue_from_python<T> - > - > - > - > - > - >::type type; -}; - -// ================== - -// -// implementations -// - -// arg_lvalue_from_python_base -// -inline arg_lvalue_from_python_base::arg_lvalue_from_python_base(void* result) - : m_result(result) -{ -} - -inline bool arg_lvalue_from_python_base::convertible() const -{ - return m_result != 0; -} - -inline void*const& arg_lvalue_from_python_base::result() const -{ - return m_result; -} - -// pointer_cref_arg_from_python -// -namespace detail -{ - // null_ptr_reference -- a function returning a reference to a null - // pointer of type U. Needed so that extractors for T*const& can - // convert Python's None. - template <class T> - struct null_ptr_owner - { - static T value; - }; - template <class T> T null_ptr_owner<T>::value = 0; - - template <class U> - inline U& null_ptr_reference(U&(*)()) - { - return null_ptr_owner<U>::value; - } -} - -template <class T> -inline pointer_cref_arg_from_python<T>::pointer_cref_arg_from_python(PyObject* p) -{ - // T == U*const&: store a U* in the m_result storage. Nonzero - // indicates success. If find returns nonzero, it's a pointer to - // a U object. - python::detail::write_void_ptr_reference( - m_result.bytes - , p == Py_None ? p : converter::get_lvalue_from_python(p, registered_pointee<T>::converters) - , (T(*)())0); -} - -template <class T> -inline bool pointer_cref_arg_from_python<T>::convertible() const -{ - return python::detail::void_ptr_to_reference(m_result.bytes, (T(*)())0) != 0; -} -template <class T> -inline T pointer_cref_arg_from_python<T>::operator()() const -{ - return (*(void**)m_result.bytes == Py_None) // None ==> 0 - ? detail::null_ptr_reference((T(*)())0) - // Otherwise, return a U*const& to the m_result storage. - : python::detail::void_ptr_to_reference(m_result.bytes, (T(*)())0); -} - -// pointer_arg_from_python -// -template <class T> -inline pointer_arg_from_python<T>::pointer_arg_from_python(PyObject* p) - : arg_lvalue_from_python_base( - p == Py_None ? p : converter::get_lvalue_from_python(p, registered_pointee<T>::converters)) -{ -} - -template <class T> -inline T pointer_arg_from_python<T>::operator()() const -{ - return (result() == Py_None) ? 0 : T(result()); -} - -// reference_arg_from_python -// -template <class T> -inline reference_arg_from_python<T>::reference_arg_from_python(PyObject* p) - : arg_lvalue_from_python_base(converter::get_lvalue_from_python(p,registered<T>::converters)) -{ -} - -template <class T> -inline T reference_arg_from_python<T>::operator()() const -{ - return python::detail::void_ptr_to_reference(result(), (T(*)())0); -} - - -// arg_rvalue_from_python -// -template <class T> -inline arg_rvalue_from_python<T>::arg_rvalue_from_python(PyObject* obj) - : m_data(converter::rvalue_from_python_stage1(obj, registered<T>::converters)) - , m_source(obj) -{ -} - -template <class T> -inline bool arg_rvalue_from_python<T>::convertible() const -{ - return m_data.stage1.convertible != 0; -} - -template <class T> -inline typename arg_rvalue_from_python<T>::result_type -arg_rvalue_from_python<T>::operator()() -{ - if (m_data.stage1.construct != 0) - m_data.stage1.construct(m_source, &m_data.stage1); - - return python::detail::void_ptr_to_reference(m_data.stage1.convertible, (result_type(*)())0); -} - -// back_reference_arg_from_python -// -template <class T> -back_reference_arg_from_python<T>::back_reference_arg_from_python(PyObject* x) - : base(x), m_source(x) -{ -} - -template <class T> -inline T -back_reference_arg_from_python<T>::operator()() -{ - return T(m_source, base::operator()()); -} - -}}} // namespace boost::python::converter - -#endif // ARG_FROM_PYTHON_DWA2002127_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/converter/arg_to_python.hpp b/contrib/restricted/boost/python/include/boost/python/converter/arg_to_python.hpp deleted file mode 100644 index bbecae72e5..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/converter/arg_to_python.hpp +++ /dev/null @@ -1,257 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef ARG_TO_PYTHON_DWA200265_HPP -# define ARG_TO_PYTHON_DWA200265_HPP - -# include <boost/python/ptr.hpp> -# include <boost/python/tag.hpp> -# include <boost/python/to_python_indirect.hpp> - -# include <boost/python/converter/registered.hpp> -# include <boost/python/converter/registered_pointee.hpp> -# include <boost/python/converter/arg_to_python_base.hpp> -# include <boost/python/converter/shared_ptr_to_python.hpp> -// Bring in specializations -# include <boost/python/converter/builtin_converters.hpp> - -# include <boost/python/object/function_handle.hpp> - -# include <boost/python/base_type_traits.hpp> - -# include <boost/python/detail/indirect_traits.hpp> -# include <boost/python/detail/convertible.hpp> -# include <boost/python/detail/string_literal.hpp> -# include <boost/python/detail/value_is_shared_ptr.hpp> -# include <boost/python/detail/type_traits.hpp> - -# include <boost/mpl/or.hpp> - -namespace boost { namespace python { namespace converter { - -template <class T> struct is_object_manager; - -namespace detail -{ - template <class T> - struct function_arg_to_python : handle<> - { - function_arg_to_python(T const& x); - }; - - template <class T> - struct reference_arg_to_python : handle<> - { - reference_arg_to_python(T& x); - private: - static PyObject* get_object(T& x); - }; - - template <class T> - struct shared_ptr_arg_to_python : handle<> - { - shared_ptr_arg_to_python(T const& x); - private: - static PyObject* get_object(T& x); - }; - - template <class T> - struct value_arg_to_python : arg_to_python_base - { - // Throw an exception if the conversion can't succeed - value_arg_to_python(T const&); - }; - - template <class Ptr> - struct pointer_deep_arg_to_python : arg_to_python_base - { - // Throw an exception if the conversion can't succeed - pointer_deep_arg_to_python(Ptr); - }; - - template <class Ptr> - struct pointer_shallow_arg_to_python : handle<> - { - // Throw an exception if the conversion can't succeed - pointer_shallow_arg_to_python(Ptr); - private: - static PyObject* get_object(Ptr p); - }; - - // Convert types that manage a Python object to_python - template <class T> - struct object_manager_arg_to_python - { - object_manager_arg_to_python(T const& x) : m_src(x) {} - - PyObject* get() const - { - return python::upcast<PyObject>(get_managed_object(m_src, tag)); - } - - private: - T const& m_src; - }; - - template <class T> - struct select_arg_to_python - { - typedef typename unwrap_reference<T>::type unwrapped_referent; - typedef typename unwrap_pointer<T>::type unwrapped_ptr; - - typedef typename mpl::if_< - // Special handling for char const[N]; interpret them as char - // const* for the sake of conversion - python::detail::is_string_literal<T const> - , arg_to_python<char const*> - - , typename mpl::if_< - python::detail::value_is_shared_ptr<T> - , shared_ptr_arg_to_python<T> - - , typename mpl::if_< - mpl::or_< - boost::python::detail::is_function<T> - , indirect_traits::is_pointer_to_function<T> - , boost::python::detail::is_member_function_pointer<T> - > - , function_arg_to_python<T> - - , typename mpl::if_< - is_object_manager<T> - , object_manager_arg_to_python<T> - - , typename mpl::if_< - boost::python::detail::is_pointer<T> - , pointer_deep_arg_to_python<T> - - , typename mpl::if_< - is_pointer_wrapper<T> - , pointer_shallow_arg_to_python<unwrapped_ptr> - - , typename mpl::if_< - is_reference_wrapper<T> - , reference_arg_to_python<unwrapped_referent> - , value_arg_to_python<T> - >::type - >::type - >::type - >::type - >::type - >::type - >::type - - type; - }; -} - -template <class T> -struct arg_to_python - : detail::select_arg_to_python<T>::type -{ - typedef typename detail::select_arg_to_python<T>::type base; - public: // member functions - // Throw an exception if the conversion can't succeed - arg_to_python(T const& x); -}; - -// -// implementations -// -namespace detail -{ - // reject_raw_object_ptr -- cause a compile-time error if the user - // should pass a raw Python object pointer - using python::detail::yes_convertible; - using python::detail::no_convertible; - using python::detail::unspecialized; - - template <class T> struct cannot_convert_raw_PyObject; - - template <class T, class Convertibility> - struct reject_raw_object_helper - { - static void error(Convertibility) - { - cannot_convert_raw_PyObject<T*>::to_python_use_handle_instead(); - } - static void error(...) {} - }; - - template <class T> - inline void reject_raw_object_ptr(T*) - { - reject_raw_object_helper<T,yes_convertible>::error( - python::detail::convertible<PyObject const volatile*>::check((T*)0)); - - typedef typename remove_cv<T>::type value_type; - - reject_raw_object_helper<T,no_convertible>::error( - python::detail::convertible<unspecialized*>::check( - (base_type_traits<value_type>*)0 - )); - } - // --------- - - template <class T> - inline function_arg_to_python<T>::function_arg_to_python(T const& x) - : handle<>(python::objects::make_function_handle(x)) - { - } - - template <class T> - inline value_arg_to_python<T>::value_arg_to_python(T const& x) - : arg_to_python_base(&x, registered<T>::converters) - { - } - - template <class Ptr> - inline pointer_deep_arg_to_python<Ptr>::pointer_deep_arg_to_python(Ptr x) - : arg_to_python_base(x, registered_pointee<Ptr>::converters) - { - detail::reject_raw_object_ptr((Ptr)0); - } - - template <class T> - inline PyObject* reference_arg_to_python<T>::get_object(T& x) - { - to_python_indirect<T&,python::detail::make_reference_holder> convert; - return convert(x); - } - - template <class T> - inline reference_arg_to_python<T>::reference_arg_to_python(T& x) - : handle<>(reference_arg_to_python<T>::get_object(x)) - { - } - - template <class T> - inline shared_ptr_arg_to_python<T>::shared_ptr_arg_to_python(T const& x) - : handle<>(shared_ptr_to_python(x)) - { - } - - template <class Ptr> - inline pointer_shallow_arg_to_python<Ptr>::pointer_shallow_arg_to_python(Ptr x) - : handle<>(pointer_shallow_arg_to_python<Ptr>::get_object(x)) - { - detail::reject_raw_object_ptr((Ptr)0); - } - - template <class Ptr> - inline PyObject* pointer_shallow_arg_to_python<Ptr>::get_object(Ptr x) - { - to_python_indirect<Ptr,python::detail::make_reference_holder> convert; - return convert(x); - } -} - -template <class T> -inline arg_to_python<T>::arg_to_python(T const& x) - : base(x) -{} - -}}} // namespace boost::python::converter - -#endif // ARG_TO_PYTHON_DWA200265_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/converter/arg_to_python_base.hpp b/contrib/restricted/boost/python/include/boost/python/converter/arg_to_python_base.hpp deleted file mode 100644 index c66ce9c3e0..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/converter/arg_to_python_base.hpp +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef ARG_TO_PYTHON_BASE_DWA200237_HPP -# define ARG_TO_PYTHON_BASE_DWA200237_HPP -# include <boost/python/handle.hpp> - -namespace boost { namespace python { namespace converter { - -struct registration; - -namespace detail -{ - struct BOOST_PYTHON_DECL arg_to_python_base - : handle<> - { - arg_to_python_base(void const volatile* source, registration const&); - }; -} - -}}} // namespace boost::python::converter - -#endif // ARG_TO_PYTHON_BASE_DWA200237_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/converter/builtin_converters.hpp b/contrib/restricted/boost/python/include/boost/python/converter/builtin_converters.hpp deleted file mode 100644 index c2e01c03d3..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/converter/builtin_converters.hpp +++ /dev/null @@ -1,190 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef BUILTIN_CONVERTERS_DWA2002124_HPP -# define BUILTIN_CONVERTERS_DWA2002124_HPP -# include <boost/python/detail/prefix.hpp> -# include <boost/python/detail/none.hpp> -# include <boost/python/handle.hpp> -# include <boost/python/ssize_t.hpp> -# include <boost/implicit_cast.hpp> -# include <string> -# include <complex> -# include <boost/limits.hpp> - -// Since all we can use to decide how to convert an object to_python -// is its C++ type, there can be only one such converter for each -// type. Therefore, for built-in conversions we can bypass registry -// lookups using explicit specializations of arg_to_python and -// result_to_python. - -namespace boost { namespace python { - -namespace converter -{ - template <class T> struct arg_to_python; - BOOST_PYTHON_DECL PyObject* do_return_to_python(char); - BOOST_PYTHON_DECL PyObject* do_return_to_python(char const*); - BOOST_PYTHON_DECL PyObject* do_return_to_python(PyObject*); - BOOST_PYTHON_DECL PyObject* do_arg_to_python(PyObject*); -} - -// Provide specializations of to_python_value -template <class T> struct to_python_value; - -namespace detail -{ - // Since there's no registry lookup, always report the existence of - // a converter. - struct builtin_to_python - { - // This information helps make_getter() decide whether to try to - // return an internal reference or not. I don't like it much, - // but it will have to serve for now. - BOOST_STATIC_CONSTANT(bool, uses_registry = false); - }; -} - -// Use expr to create the PyObject corresponding to x -# define BOOST_PYTHON_RETURN_TO_PYTHON_BY_VALUE(T, expr, pytype)\ - template <> struct to_python_value<T&> \ - : detail::builtin_to_python \ - { \ - inline PyObject* operator()(T const& x) const \ - { \ - return (expr); \ - } \ - inline PyTypeObject const* get_pytype() const \ - { \ - return (pytype); \ - } \ - }; \ - template <> struct to_python_value<T const&> \ - : detail::builtin_to_python \ - { \ - inline PyObject* operator()(T const& x) const \ - { \ - return (expr); \ - } \ - inline PyTypeObject const* get_pytype() const \ - { \ - return (pytype); \ - } \ - }; - -# define BOOST_PYTHON_ARG_TO_PYTHON_BY_VALUE(T, expr) \ - namespace converter \ - { \ - template <> struct arg_to_python< T > \ - : handle<> \ - { \ - arg_to_python(T const& x) \ - : python::handle<>(expr) {} \ - }; \ - } - -// Specialize argument and return value converters for T using expr -# define BOOST_PYTHON_TO_PYTHON_BY_VALUE(T, expr, pytype) \ - BOOST_PYTHON_RETURN_TO_PYTHON_BY_VALUE(T,expr, pytype) \ - BOOST_PYTHON_ARG_TO_PYTHON_BY_VALUE(T,expr) - -// Specialize converters for signed and unsigned T to Python Int -#if PY_VERSION_HEX >= 0x03000000 - -# define BOOST_PYTHON_TO_INT(T) \ - BOOST_PYTHON_TO_PYTHON_BY_VALUE(signed T, ::PyLong_FromLong(x), &PyLong_Type) \ - BOOST_PYTHON_TO_PYTHON_BY_VALUE(unsigned T, ::PyLong_FromUnsignedLong(x), &PyLong_Type) - -#else - -# define BOOST_PYTHON_TO_INT(T) \ - BOOST_PYTHON_TO_PYTHON_BY_VALUE(signed T, ::PyInt_FromLong(x), &PyInt_Type) \ - BOOST_PYTHON_TO_PYTHON_BY_VALUE( \ - unsigned T \ - , static_cast<unsigned long>(x) > static_cast<unsigned long>( \ - (std::numeric_limits<long>::max)()) \ - ? ::PyLong_FromUnsignedLong(x) \ - : ::PyInt_FromLong(x), &PyInt_Type) -#endif - -// Bool is not signed. -#if PY_VERSION_HEX >= 0x02030000 -BOOST_PYTHON_TO_PYTHON_BY_VALUE(bool, ::PyBool_FromLong(x), &PyBool_Type) -#else -BOOST_PYTHON_TO_PYTHON_BY_VALUE(bool, ::PyInt_FromLong(x), &PyInt_Type) -#endif - -// note: handles signed char and unsigned char, but not char (see below) -BOOST_PYTHON_TO_INT(char) - -BOOST_PYTHON_TO_INT(short) -BOOST_PYTHON_TO_INT(int) -BOOST_PYTHON_TO_INT(long) - -# if defined(_MSC_VER) && defined(_WIN64) && PY_VERSION_HEX < 0x03000000 -/* Under 64-bit Windows std::size_t is "unsigned long long". To avoid - getting a Python long for each std::size_t the value is checked before - the conversion. A std::size_t is converted to a simple Python int - if possible; a Python long appears only if the value is too small or - too large to fit into a simple int. */ -BOOST_PYTHON_TO_PYTHON_BY_VALUE( - signed BOOST_PYTHON_LONG_LONG, - ( x < static_cast<signed BOOST_PYTHON_LONG_LONG>( - (std::numeric_limits<long>::min)()) - || x > static_cast<signed BOOST_PYTHON_LONG_LONG>( - (std::numeric_limits<long>::max)())) - ? ::PyLong_FromLongLong(x) - : ::PyInt_FromLong(static_cast<long>(x)), &PyInt_Type) -BOOST_PYTHON_TO_PYTHON_BY_VALUE( - unsigned BOOST_PYTHON_LONG_LONG, - x > static_cast<unsigned BOOST_PYTHON_LONG_LONG>( - (std::numeric_limits<long>::max)()) - ? ::PyLong_FromUnsignedLongLong(x) - : ::PyInt_FromLong(static_cast<long>(x)), &PyInt_Type) -// -# elif defined(HAVE_LONG_LONG) // using Python's macro instead of Boost's - // - we don't seem to get the config right - // all the time. -BOOST_PYTHON_TO_PYTHON_BY_VALUE(signed BOOST_PYTHON_LONG_LONG, ::PyLong_FromLongLong(x), &PyLong_Type) -BOOST_PYTHON_TO_PYTHON_BY_VALUE(unsigned BOOST_PYTHON_LONG_LONG, ::PyLong_FromUnsignedLongLong(x), &PyLong_Type) -# endif - -# undef BOOST_TO_PYTHON_INT - -#if PY_VERSION_HEX >= 0x03000000 -BOOST_PYTHON_TO_PYTHON_BY_VALUE(char, converter::do_return_to_python(x), &PyUnicode_Type) -BOOST_PYTHON_TO_PYTHON_BY_VALUE(char const*, converter::do_return_to_python(x), &PyUnicode_Type) -BOOST_PYTHON_TO_PYTHON_BY_VALUE(std::string, ::PyUnicode_FromStringAndSize(x.data(),implicit_cast<ssize_t>(x.size())), &PyUnicode_Type) -#else -BOOST_PYTHON_TO_PYTHON_BY_VALUE(char, converter::do_return_to_python(x), &PyString_Type) -BOOST_PYTHON_TO_PYTHON_BY_VALUE(char const*, converter::do_return_to_python(x), &PyString_Type) -BOOST_PYTHON_TO_PYTHON_BY_VALUE(std::string, ::PyString_FromStringAndSize(x.data(),implicit_cast<ssize_t>(x.size())), &PyString_Type) -#endif - -#if defined(Py_USING_UNICODE) && !defined(BOOST_NO_STD_WSTRING) -BOOST_PYTHON_TO_PYTHON_BY_VALUE(std::wstring, ::PyUnicode_FromWideChar(x.data(),implicit_cast<ssize_t>(x.size())), &PyUnicode_Type) -# endif -BOOST_PYTHON_TO_PYTHON_BY_VALUE(float, ::PyFloat_FromDouble(x), &PyFloat_Type) -BOOST_PYTHON_TO_PYTHON_BY_VALUE(double, ::PyFloat_FromDouble(x), &PyFloat_Type) -BOOST_PYTHON_TO_PYTHON_BY_VALUE(long double, ::PyFloat_FromDouble(x), &PyFloat_Type) -BOOST_PYTHON_RETURN_TO_PYTHON_BY_VALUE(PyObject*, converter::do_return_to_python(x), 0) -BOOST_PYTHON_TO_PYTHON_BY_VALUE(std::complex<float>, ::PyComplex_FromDoubles(x.real(), x.imag()), &PyComplex_Type) -BOOST_PYTHON_TO_PYTHON_BY_VALUE(std::complex<double>, ::PyComplex_FromDoubles(x.real(), x.imag()), &PyComplex_Type) -BOOST_PYTHON_TO_PYTHON_BY_VALUE(std::complex<long double>, ::PyComplex_FromDoubles(x.real(), x.imag()), &PyComplex_Type) - -# undef BOOST_PYTHON_RETURN_TO_PYTHON_BY_VALUE -# undef BOOST_PYTHON_ARG_TO_PYTHON_BY_VALUE -# undef BOOST_PYTHON_TO_PYTHON_BY_VALUE -# undef BOOST_PYTHON_TO_INT - -namespace converter -{ - - void initialize_builtin_converters(); - -} - -}} // namespace boost::python::converter - -#endif // BUILTIN_CONVERTERS_DWA2002124_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/converter/constructor_function.hpp b/contrib/restricted/boost/python/include/boost/python/converter/constructor_function.hpp deleted file mode 100644 index 814aa7d763..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/converter/constructor_function.hpp +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef CONSTRUCTOR_FUNCTION_DWA200278_HPP -# define CONSTRUCTOR_FUNCTION_DWA200278_HPP - -namespace boost { namespace python { namespace converter { - -// Declares the type of functions used to construct C++ objects for -// rvalue from_python conversions. -struct rvalue_from_python_stage1_data; -typedef void (*constructor_function)(PyObject* source, rvalue_from_python_stage1_data*); - -}}} // namespace boost::python::converter - -#endif // CONSTRUCTOR_FUNCTION_DWA200278_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/converter/context_result_converter.hpp b/contrib/restricted/boost/python/include/boost/python/converter/context_result_converter.hpp deleted file mode 100644 index beb7e9f098..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/converter/context_result_converter.hpp +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright David Abrahams 2003. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef CONTEXT_RESULT_CONVERTER_DWA2003917_HPP -# define CONTEXT_RESULT_CONVERTER_DWA2003917_HPP - -namespace boost { namespace python { namespace converter { - -// A ResultConverter base class used to indicate that this result -// converter should be constructed with the original Python argument -// list. -struct context_result_converter {}; - -}}} // namespace boost::python::converter - -#endif // CONTEXT_RESULT_CONVERTER_DWA2003917_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/converter/convertible_function.hpp b/contrib/restricted/boost/python/include/boost/python/converter/convertible_function.hpp deleted file mode 100644 index 4b29fbb00b..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/converter/convertible_function.hpp +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef CONVERTIBLE_FUNCTION_DWA200278_HPP -# define CONVERTIBLE_FUNCTION_DWA200278_HPP - -namespace boost { namespace python { namespace converter { - -typedef void* (*convertible_function)(PyObject*); - -}}} // namespace boost::python::converter - -#endif // CONVERTIBLE_FUNCTION_DWA200278_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/converter/from_python.hpp b/contrib/restricted/boost/python/include/boost/python/converter/from_python.hpp deleted file mode 100644 index b2f24b3519..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/converter/from_python.hpp +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef FIND_FROM_PYTHON_DWA2002223_HPP -# define FIND_FROM_PYTHON_DWA2002223_HPP - -# include <boost/python/detail/prefix.hpp> -# include <boost/python/converter/rvalue_from_python_data.hpp> - -namespace boost { namespace python { namespace converter { - -struct registration; - - -BOOST_PYTHON_DECL void* get_lvalue_from_python( - PyObject* source, registration const&); - -BOOST_PYTHON_DECL bool implicit_rvalue_convertible_from_python( - PyObject* source, registration const&); - -BOOST_PYTHON_DECL rvalue_from_python_stage1_data rvalue_from_python_stage1( - PyObject* source, registration const&); - -BOOST_PYTHON_DECL void* rvalue_from_python_stage2( - PyObject* source, rvalue_from_python_stage1_data&, registration const&); - -BOOST_PYTHON_DECL void* rvalue_result_from_python( - PyObject*, rvalue_from_python_stage1_data&); - -BOOST_PYTHON_DECL void* reference_result_from_python(PyObject*, registration const&); -BOOST_PYTHON_DECL void* pointer_result_from_python(PyObject*, registration const&); - -BOOST_PYTHON_DECL void void_result_from_python(PyObject*); - -BOOST_PYTHON_DECL void throw_no_pointer_from_python(PyObject*, registration const&); -BOOST_PYTHON_DECL void throw_no_reference_from_python(PyObject*, registration const&); - -}}} // namespace boost::python::converter - -#endif // FIND_FROM_PYTHON_DWA2002223_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/converter/obj_mgr_arg_from_python.hpp b/contrib/restricted/boost/python/include/boost/python/converter/obj_mgr_arg_from_python.hpp deleted file mode 100644 index 5132804082..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/converter/obj_mgr_arg_from_python.hpp +++ /dev/null @@ -1,121 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef OBJ_MGR_ARG_FROM_PYTHON_DWA2002628_HPP -# define OBJ_MGR_ARG_FROM_PYTHON_DWA2002628_HPP - -# include <boost/python/detail/prefix.hpp> -# include <boost/python/detail/referent_storage.hpp> -# include <boost/python/detail/destroy.hpp> -# include <boost/python/detail/construct.hpp> -# include <boost/python/converter/object_manager.hpp> -# include <boost/python/detail/raw_pyobject.hpp> -# include <boost/python/tag.hpp> - -// -// arg_from_python converters for Python type wrappers, to be used as -// base classes for specializations. -// -namespace boost { namespace python { namespace converter { - -template <class T> -struct object_manager_value_arg_from_python -{ - typedef T result_type; - - object_manager_value_arg_from_python(PyObject*); - bool convertible() const; - T operator()() const; - private: - PyObject* m_source; -}; - -// Used for converting reference-to-object-manager arguments from -// python. The process used here is a little bit odd. Upon -// construction, we build the object manager object in the m_result -// object, *forcing* it to accept the source Python object by casting -// its pointer to detail::borrowed_reference. This is supposed to -// bypass any type checking of the source object. The convertible -// check then extracts the owned object and checks it. If the check -// fails, nothing else in the program ever gets to touch this strange -// "forced" object. -template <class Ref> -struct object_manager_ref_arg_from_python -{ - typedef Ref result_type; - - object_manager_ref_arg_from_python(PyObject*); - bool convertible() const; - Ref operator()() const; - ~object_manager_ref_arg_from_python(); - private: - typename python::detail::referent_storage<Ref>::type m_result; -}; - -// -// implementations -// - -template <class T> -inline object_manager_value_arg_from_python<T>::object_manager_value_arg_from_python(PyObject* x) - : m_source(x) -{ -} - -template <class T> -inline bool object_manager_value_arg_from_python<T>::convertible() const -{ - return object_manager_traits<T>::check(m_source); -} - -template <class T> -inline T object_manager_value_arg_from_python<T>::operator()() const -{ - return T(python::detail::borrowed_reference(m_source)); -} - -template <class Ref> -inline object_manager_ref_arg_from_python<Ref>::object_manager_ref_arg_from_python(PyObject* x) -{ -# if defined(__EDG_VERSION__) && __EDG_VERSION__ <= 243 - // needed for warning suppression - python::detail::borrowed_reference x_ = python::detail::borrowed_reference(x); - python::detail::construct_referent<Ref>(m_result.bytes, x_); -# else - python::detail::construct_referent<Ref>(m_result.bytes, (python::detail::borrowed_reference)x); -# endif -} - -template <class Ref> -inline object_manager_ref_arg_from_python<Ref>::~object_manager_ref_arg_from_python() -{ - python::detail::destroy_referent<Ref>(this->m_result.bytes); -} - -namespace detail -{ - template <class T> - inline bool object_manager_ref_check(T const& x) - { - return object_manager_traits<T>::check(get_managed_object(x, tag)); - } -} - -template <class Ref> -inline bool object_manager_ref_arg_from_python<Ref>::convertible() const -{ - return detail::object_manager_ref_check( - python::detail::void_ptr_to_reference(this->m_result.bytes, (Ref(*)())0)); -} - -template <class Ref> -inline Ref object_manager_ref_arg_from_python<Ref>::operator()() const -{ - return python::detail::void_ptr_to_reference( - this->m_result.bytes, (Ref(*)())0); -} - -}}} // namespace boost::python::converter - -#endif // OBJ_MGR_ARG_FROM_PYTHON_DWA2002628_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/converter/object_manager.hpp b/contrib/restricted/boost/python/include/boost/python/converter/object_manager.hpp deleted file mode 100644 index b2271a7ea2..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/converter/object_manager.hpp +++ /dev/null @@ -1,156 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef OBJECT_MANAGER_DWA2002614_HPP -# define OBJECT_MANAGER_DWA2002614_HPP - -# include <boost/python/handle.hpp> -# include <boost/python/cast.hpp> -# include <boost/python/converter/pyobject_traits.hpp> -# include <boost/python/detail/type_traits.hpp> -# include <boost/mpl/if.hpp> -# include <boost/python/detail/indirect_traits.hpp> -# include <boost/mpl/bool.hpp> - -// Facilities for dealing with types which always manage Python -// objects. Some examples are object, list, str, et. al. Different -// to_python/from_python conversion rules apply here because in -// contrast to other types which are typically embedded inside a -// Python object, these are wrapped around a Python object. For most -// object managers T, a C++ non-const T reference argument does not -// imply the existence of a T lvalue embedded in the corresponding -// Python argument, since mutating member functions on T actually only -// modify the held Python object. -// -// handle<T> is an object manager, though strictly speaking it should -// not be. In other words, even though mutating member functions of -// hanlde<T> actually modify the handle<T> and not the T object, -// handle<T>& arguments of wrapped functions will bind to "rvalues" -// wrapping the actual Python argument, just as with other object -// manager classes. Making an exception for handle<T> is simply not -// worth the trouble. -// -// borrowed<T> cv* is an object manager so that we can use the general -// to_python mechanisms to convert raw Python object pointers to -// python, without the usual semantic problems of using raw pointers. - - -// Object Manager Concept requirements: -// -// T is an Object Manager -// p is a PyObject* -// x is a T -// -// * object_manager_traits<T>::is_specialized == true -// -// * T(detail::borrowed_reference(p)) -// Manages p without checking its type -// -// * get_managed_object(x, boost::python::tag) -// Convertible to PyObject* -// -// Additional requirements if T can be converted from_python: -// -// * T(object_manager_traits<T>::adopt(p)) -// steals a reference to p, or throws a TypeError exception if -// p doesn't have an appropriate type. May assume p is non-null -// -// * X::check(p) -// convertible to bool. True iff T(X::construct(p)) will not -// throw. - -// Forward declarations -// -namespace boost { namespace python -{ - namespace api - { - class object; - } -}} - -namespace boost { namespace python { namespace converter { - - -// Specializations for handle<T> -template <class T> -struct handle_object_manager_traits - : pyobject_traits<typename T::element_type> -{ - private: - typedef pyobject_traits<typename T::element_type> base; - - public: - BOOST_STATIC_CONSTANT(bool, is_specialized = true); - - // Initialize with a null_ok pointer for efficiency, bypassing the - // null check since the source is always non-null. - static null_ok<typename T::element_type>* adopt(PyObject* p) - { - return python::allow_null(base::checked_downcast(p)); - } -}; - -template <class T> -struct default_object_manager_traits -{ - BOOST_STATIC_CONSTANT( - bool, is_specialized = python::detail::is_borrowed_ptr<T>::value - ); -}; - -template <class T> -struct object_manager_traits - : mpl::if_c< - is_handle<T>::value - , handle_object_manager_traits<T> - , default_object_manager_traits<T> - >::type -{ -}; - -// -// Traits for detecting whether a type is an object manager or a -// (cv-qualified) reference to an object manager. -// - -template <class T> -struct is_object_manager - : mpl::bool_<object_manager_traits<T>::is_specialized> -{ -}; - -template <class T> -struct is_reference_to_object_manager - : mpl::false_ -{ -}; - -template <class T> -struct is_reference_to_object_manager<T&> - : is_object_manager<T> -{ -}; - -template <class T> -struct is_reference_to_object_manager<T const&> - : is_object_manager<T> -{ -}; - -template <class T> -struct is_reference_to_object_manager<T volatile&> - : is_object_manager<T> -{ -}; - -template <class T> -struct is_reference_to_object_manager<T const volatile&> - : is_object_manager<T> -{ -}; - -}}} // namespace boost::python::converter - -#endif // OBJECT_MANAGER_DWA2002614_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/converter/pointer_type_id.hpp b/contrib/restricted/boost/python/include/boost/python/converter/pointer_type_id.hpp deleted file mode 100644 index 49eeda42cb..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/converter/pointer_type_id.hpp +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef POINTER_TYPE_ID_DWA2002222_HPP -# define POINTER_TYPE_ID_DWA2002222_HPP - -# include <boost/python/type_id.hpp> -# include <boost/python/detail/type_traits.hpp> - -namespace boost { namespace python { namespace converter { - -namespace detail -{ - template <bool is_ref = false> - struct pointer_typeid_select - { - template <class T> - static inline type_info execute(T*(*)() = 0) - { - return type_id<T>(); - } - }; - - template <> - struct pointer_typeid_select<true> - { - template <class T> - static inline type_info execute(T* const volatile&(*)() = 0) - { - return type_id<T>(); - } - - template <class T> - static inline type_info execute(T*volatile&(*)() = 0) - { - return type_id<T>(); - } - - template <class T> - static inline type_info execute(T*const&(*)() = 0) - { - return type_id<T>(); - } - - template <class T> - static inline type_info execute(T*&(*)() = 0) - { - return type_id<T>(); - } - }; -} - -// Usage: pointer_type_id<T>() -// -// Returns a type_info associated with the type pointed -// to by T, which may be a pointer or a reference to a pointer. -template <class T> -type_info pointer_type_id(T(*)() = 0) -{ - return detail::pointer_typeid_select< - boost::python::detail::is_lvalue_reference<T>::value - >::execute((T(*)())0); -} - -}}} // namespace boost::python::converter - -#endif // POINTER_TYPE_ID_DWA2002222_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/converter/pyobject_traits.hpp b/contrib/restricted/boost/python/include/boost/python/converter/pyobject_traits.hpp deleted file mode 100644 index 43e384af8d..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/converter/pyobject_traits.hpp +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef PYOBJECT_TRAITS_DWA2002720_HPP -# define PYOBJECT_TRAITS_DWA2002720_HPP - -# include <boost/python/detail/prefix.hpp> -# include <boost/python/converter/pyobject_type.hpp> - -namespace boost { namespace python { namespace converter { - -template <class> struct pyobject_traits; - -template <> -struct pyobject_traits<PyObject> -{ - // All objects are convertible to PyObject - static bool check(PyObject*) { return true; } - static PyObject* checked_downcast(PyObject* x) { return x; } -#ifndef BOOST_PYTHON_NO_PY_SIGNATURES - static PyTypeObject const* get_pytype() { return 0; } -#endif -}; - -// -// Specializations -// - -# define BOOST_PYTHON_BUILTIN_OBJECT_TRAITS(T) \ - template <> struct pyobject_traits<Py##T##Object> \ - : pyobject_type<Py##T##Object, &Py##T##_Type> {} - -// This is not an exhaustive list; should be expanded. -BOOST_PYTHON_BUILTIN_OBJECT_TRAITS(Type); -BOOST_PYTHON_BUILTIN_OBJECT_TRAITS(List); -#if PY_VERSION_HEX < 0x03000000 -BOOST_PYTHON_BUILTIN_OBJECT_TRAITS(Int); -#endif -BOOST_PYTHON_BUILTIN_OBJECT_TRAITS(Long); -BOOST_PYTHON_BUILTIN_OBJECT_TRAITS(Dict); -BOOST_PYTHON_BUILTIN_OBJECT_TRAITS(Tuple); - -}}} // namespace boost::python::converter - -#endif // PYOBJECT_TRAITS_DWA2002720_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/converter/pyobject_type.hpp b/contrib/restricted/boost/python/include/boost/python/converter/pyobject_type.hpp deleted file mode 100644 index bde39e8057..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/converter/pyobject_type.hpp +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef PYOBJECT_TYPE_DWA2002720_HPP -# define PYOBJECT_TYPE_DWA2002720_HPP - -# include <boost/python/cast.hpp> - -namespace boost { namespace python { namespace converter { - -BOOST_PYTHON_DECL inline -PyObject* checked_downcast_impl(PyObject *obj, PyTypeObject *type) -{ - return (PyType_IsSubtype(Py_TYPE(obj), type) ? obj : NULL); -} -// Used as a base class for specializations which need to provide -// Python type checking capability. -template <class Object, PyTypeObject* pytype> -struct pyobject_type -{ - static bool check(PyObject* x) - { - return ::PyObject_IsInstance(x, (PyObject*)pytype); - } - - static Object* checked_downcast(PyObject* x) - { - return python::downcast<Object>( - (checked_downcast_impl)(x, pytype) - ); - } -#ifndef BOOST_PYTHON_NO_PY_SIGNATURES - static PyTypeObject const* get_pytype() { return pytype; } -#endif -}; - -}}} // namespace boost::python::converter - -#endif // PYOBJECT_TYPE_DWA2002720_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/converter/pytype_function.hpp b/contrib/restricted/boost/python/include/boost/python/converter/pytype_function.hpp deleted file mode 100644 index 8e0a4e7995..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/converter/pytype_function.hpp +++ /dev/null @@ -1,133 +0,0 @@ -// Copyright David Abrahams 2002, Nikolay Mladenov 2007. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef WRAP_PYTYPE_NM20070606_HPP -# define WRAP_PYTYPE_NM20070606_HPP - -# include <boost/python/detail/prefix.hpp> -# include <boost/python/converter/registered.hpp> -# include <boost/python/detail/unwind_type.hpp> -# include <boost/python/detail/type_traits.hpp> - - -namespace boost { namespace python { - -namespace converter -{ -template <PyTypeObject const* python_type> -struct wrap_pytype -{ - static PyTypeObject const* get_pytype() - { - return python_type; - } -}; - -typedef PyTypeObject const* (*pytype_function)(); - -#ifndef BOOST_PYTHON_NO_PY_SIGNATURES - - - -namespace detail -{ -struct unwind_type_id_helper{ - typedef python::type_info result_type; - template <class U> - static result_type execute(U* ){ - return python::type_id<U>(); - } -}; - -template <class T> -inline python::type_info unwind_type_id_(boost::type<T>* = 0, mpl::false_ * =0) -{ - return boost::python::detail::unwind_type<unwind_type_id_helper, T> (); -} - -inline python::type_info unwind_type_id_(boost::type<void>* = 0, mpl::true_* =0) -{ - return type_id<void>(); -} - -template <class T> -inline python::type_info unwind_type_id(boost::type<T>* p= 0) -{ - return unwind_type_id_(p, (mpl::bool_<boost::python::detail::is_void<T>::value >*)0 ); -} -} - - -template <class T> -struct expected_pytype_for_arg -{ - static PyTypeObject const *get_pytype() - { - const converter::registration *r=converter::registry::query( - detail::unwind_type_id_((boost::type<T>*)0, (mpl::bool_<boost::python::detail::is_void<T>::value >*)0 ) - ); - return r ? r->expected_from_python_type(): 0; - } -}; - - -template <class T> -struct registered_pytype -{ - static PyTypeObject const *get_pytype() - { - const converter::registration *r=converter::registry::query( - detail::unwind_type_id_((boost::type<T>*) 0, (mpl::bool_<boost::python::detail::is_void<T>::value >*)0 ) - ); - return r ? r->m_class_object: 0; - } -}; - - -template <class T> -struct registered_pytype_direct -{ - static PyTypeObject const* get_pytype() - { - return registered<T>::converters.m_class_object; - } -}; - -template <class T> -struct expected_from_python_type : expected_pytype_for_arg<T>{}; - -template <class T> -struct expected_from_python_type_direct -{ - static PyTypeObject const* get_pytype() - { - return registered<T>::converters.expected_from_python_type(); - } -}; - -template <class T> -struct to_python_target_type -{ - static PyTypeObject const *get_pytype() - { - const converter::registration *r=converter::registry::query( - detail::unwind_type_id_((boost::type<T>*)0, (mpl::bool_<boost::python::detail::is_void<T>::value >*)0 ) - ); - return r ? r->to_python_target_type(): 0; - } -}; - -template <class T> -struct to_python_target_type_direct -{ - static PyTypeObject const *get_pytype() - { - return registered<T>::converters.to_python_target_type(); - } -}; -#endif - -}}} // namespace boost::python - -#endif // WRAP_PYTYPE_NM20070606_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/converter/pytype_object_mgr_traits.hpp b/contrib/restricted/boost/python/include/boost/python/converter/pytype_object_mgr_traits.hpp deleted file mode 100644 index 8f5b2b7677..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/converter/pytype_object_mgr_traits.hpp +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef PYTYPE_OBJECT_MANAGER_TRAITS_DWA2002716_HPP -# define PYTYPE_OBJECT_MANAGER_TRAITS_DWA2002716_HPP - -# include <boost/python/detail/prefix.hpp> -# include <boost/python/detail/raw_pyobject.hpp> -# include <boost/python/cast.hpp> -# include <boost/python/converter/pyobject_type.hpp> -# include <boost/python/errors.hpp> - -namespace boost { namespace python { namespace converter { - -// Provide a forward declaration as a convenience for clients, who all -// need it. -template <class T> struct object_manager_traits; - -// Derive specializations of object_manager_traits from this class -// when T is an object manager for a particular Python type hierarchy. -// -template <PyTypeObject* pytype, class T> -struct pytype_object_manager_traits - : pyobject_type<T, pytype> // provides check() -{ - BOOST_STATIC_CONSTANT(bool, is_specialized = true); - static inline python::detail::new_reference adopt(PyObject*); -}; - -// -// implementations -// -template <PyTypeObject* pytype, class T> -inline python::detail::new_reference pytype_object_manager_traits<pytype,T>::adopt(PyObject* x) -{ - return python::detail::new_reference(python::pytype_check(pytype, x)); -} - -}}} // namespace boost::python::converter - -#endif // PYTYPE_OBJECT_MANAGER_TRAITS_DWA2002716_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/converter/registered.hpp b/contrib/restricted/boost/python/include/boost/python/converter/registered.hpp deleted file mode 100644 index 98013052ec..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/converter/registered.hpp +++ /dev/null @@ -1,124 +0,0 @@ -// Copyright David Abrahams 2002. -// Copyright Stefan Seefeld 2016. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef boost_python_converter_registered_hpp_ -#define boost_python_converter_registered_hpp_ - -#include <boost/python/type_id.hpp> -#include <boost/python/converter/registry.hpp> -#include <boost/python/converter/registrations.hpp> -#include <boost/python/detail/type_traits.hpp> -#include <boost/detail/workaround.hpp> -#include <boost/type.hpp> -#include <memory> -#if defined(BOOST_PYTHON_TRACE_REGISTRY) \ - || defined(BOOST_PYTHON_CONVERTER_REGISTRY_APPLE_MACH_WORKAROUND) -# include <iostream> -#endif - -namespace boost { - -// You'll see shared_ptr mentioned in this header because we need to -// note which types are shared_ptrs in their registrations, to -// implement special shared_ptr handling for rvalue conversions. -template <class T> class shared_ptr; - -namespace python { namespace converter { - -struct registration; - -namespace detail -{ - template <class T> - struct registered_base - { - static registration const& converters; - }; -} - -template <class T> -struct registered - : detail::registered_base< - typename boost::python::detail::add_lvalue_reference< - typename boost::python::detail::add_cv<T>::type - >::type - > -{ -}; - -# if !BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1310)) -// collapses a few more types to the same static instance. MSVC7.1 -// fails to strip cv-qualification from array types in typeid. For -// some reason we can't use this collapse there or array converters -// will not be found. -template <class T> -struct registered<T&> - : registered<T> {}; -# endif - -// -// implementations -// -namespace detail -{ - inline void - register_shared_ptr0(...) - { - } - - template <class T> - inline void - register_shared_ptr0(shared_ptr<T>*) - { - registry::lookup_shared_ptr(type_id<shared_ptr<T> >()); - } - -#if !defined(BOOST_NO_CXX11_SMART_PTR) - template <class T> - inline void - register_shared_ptr0(std::shared_ptr<T>*) - { - registry::lookup_shared_ptr(type_id<std::shared_ptr<T> >()); - } -#endif - - template <class T> - inline void - register_shared_ptr1(T const volatile*) - { - detail::register_shared_ptr0((T*)0); - } - - template <class T> - inline registration const& - registry_lookup2(T&(*)()) - { - detail::register_shared_ptr1((T*)0); - return registry::lookup(type_id<T&>()); - } - - template <class T> - inline registration const& - registry_lookup1(type<T>) - { - return registry_lookup2((T(*)())0); - } - - inline registration const& - registry_lookup1(type<const volatile void>) - { - detail::register_shared_ptr1((void*)0); - return registry::lookup(type_id<void>()); - } - - template <class T> - registration const& registered_base<T>::converters = detail::registry_lookup1(type<T>()); - -} - -}}} // namespace boost::python::converter - -#endif diff --git a/contrib/restricted/boost/python/include/boost/python/converter/registered_pointee.hpp b/contrib/restricted/boost/python/include/boost/python/converter/registered_pointee.hpp deleted file mode 100644 index 28b2988c7f..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/converter/registered_pointee.hpp +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef REGISTERED_POINTEE_DWA2002710_HPP -# define REGISTERED_POINTEE_DWA2002710_HPP -# include <boost/python/converter/registered.hpp> -# include <boost/python/converter/pointer_type_id.hpp> -# include <boost/python/converter/registry.hpp> -# include <boost/python/detail/type_traits.hpp> - -namespace boost { namespace python { namespace converter { - -struct registration; - -template <class T> -struct registered_pointee - : registered< - typename boost::python::detail::remove_pointer< - typename boost::python::detail::remove_cv< - typename boost::python::detail::remove_reference<T>::type - >::type - >::type - > -{ -}; -}}} // namespace boost::python::converter - -#endif // REGISTERED_POINTEE_DWA2002710_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/converter/registrations.hpp b/contrib/restricted/boost/python/include/boost/python/converter/registrations.hpp deleted file mode 100644 index 7ef74e8f40..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/converter/registrations.hpp +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef REGISTRATIONS_DWA2002223_HPP -# define REGISTRATIONS_DWA2002223_HPP - -# include <boost/python/detail/prefix.hpp> - -# include <boost/python/type_id.hpp> - -# include <boost/python/converter/convertible_function.hpp> -# include <boost/python/converter/constructor_function.hpp> -# include <boost/python/converter/to_python_function_type.hpp> - -# include <boost/detail/workaround.hpp> - -namespace boost { namespace python { namespace converter { - -struct lvalue_from_python_chain -{ - convertible_function convert; - lvalue_from_python_chain* next; -}; - -struct rvalue_from_python_chain -{ - convertible_function convertible; - constructor_function construct; - PyTypeObject const* (*expected_pytype)(); - rvalue_from_python_chain* next; -}; - -struct BOOST_PYTHON_DECL registration -{ - public: // member functions - explicit registration(type_info target, bool is_shared_ptr = false); - ~registration(); - - // Convert the appropriately-typed data to Python - PyObject* to_python(void const volatile*) const; - - // Return the class object, or raise an appropriate Python - // exception if no class has been registered. - PyTypeObject* get_class_object() const; - - // Return common denominator of the python class objects, - // convertable to target. Inspects the m_class_object and the value_chains. - PyTypeObject const* expected_from_python_type() const; - PyTypeObject const* to_python_target_type() const; - - public: // data members. So sue me. - const python::type_info target_type; - - // The chain of eligible from_python converters when an lvalue is required - lvalue_from_python_chain* lvalue_chain; - - // The chain of eligible from_python converters when an rvalue is acceptable - rvalue_from_python_chain* rvalue_chain; - - // The class object associated with this type - PyTypeObject* m_class_object; - - // The unique to_python converter for the associated C++ type. - to_python_function_t m_to_python; - PyTypeObject const* (*m_to_python_target_type)(); - - - // True iff this type is a shared_ptr. Needed for special rvalue - // from_python handling. - const bool is_shared_ptr; - -# if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003)) - private: - void operator=(registration); // This is not defined, and just keeps MWCW happy. -# endif -}; - -// -// implementations -// -inline registration::registration(type_info target_type, bool is_shared_ptr) - : target_type(target_type) - , lvalue_chain(0) - , rvalue_chain(0) - , m_class_object(0) - , m_to_python(0) - , m_to_python_target_type(0) - , is_shared_ptr(is_shared_ptr) -{} - -inline bool operator<(registration const& lhs, registration const& rhs) -{ - return lhs.target_type < rhs.target_type; -} - -}}} // namespace boost::python::converter - -#endif // REGISTRATIONS_DWA2002223_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/converter/registry.hpp b/contrib/restricted/boost/python/include/boost/python/converter/registry.hpp deleted file mode 100644 index 368adcc61d..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/converter/registry.hpp +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright David Abrahams 2001. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef REGISTRY_DWA20011127_HPP -# define REGISTRY_DWA20011127_HPP -# include <boost/python/type_id.hpp> -# include <boost/python/converter/to_python_function_type.hpp> -# include <boost/python/converter/rvalue_from_python_data.hpp> -# include <boost/python/converter/constructor_function.hpp> -# include <boost/python/converter/convertible_function.hpp> - -namespace boost { namespace python { namespace converter { - -struct registration; - -// This namespace acts as a sort of singleton -namespace registry -{ - // Get the registration corresponding to the type, creating it if necessary - BOOST_PYTHON_DECL registration const& lookup(type_info); - - // Get the registration corresponding to the type, creating it if - // necessary. Use this first when the type is a shared_ptr. - BOOST_PYTHON_DECL registration const& lookup_shared_ptr(type_info); - - // Return a pointer to the corresponding registration, if one exists - BOOST_PYTHON_DECL registration const* query(type_info); - - BOOST_PYTHON_DECL void insert(to_python_function_t, type_info, PyTypeObject const* (*to_python_target_type)() = 0); - - // Insert an lvalue from_python converter - BOOST_PYTHON_DECL void insert(convertible_function, type_info, PyTypeObject const* (*expected_pytype)() = 0); - - // Insert an rvalue from_python converter - BOOST_PYTHON_DECL void insert( - convertible_function - , constructor_function - , type_info - , PyTypeObject const* (*expected_pytype)() = 0 - ); - - // Insert an rvalue from_python converter at the tail of the - // chain. Used for implicit conversions - BOOST_PYTHON_DECL void push_back( - convertible_function - , constructor_function - , type_info - , PyTypeObject const* (*expected_pytype)() = 0 - ); -} - -}}} // namespace boost::python::converter - -#endif // REGISTRY_DWA20011127_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/converter/return_from_python.hpp b/contrib/restricted/boost/python/include/boost/python/converter/return_from_python.hpp deleted file mode 100644 index a995a2905a..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/converter/return_from_python.hpp +++ /dev/null @@ -1,162 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef RETURN_FROM_PYTHON_DWA200265_HPP -# define RETURN_FROM_PYTHON_DWA200265_HPP - -# include <boost/python/converter/from_python.hpp> -# include <boost/python/converter/rvalue_from_python_data.hpp> -# include <boost/python/converter/registered.hpp> -# include <boost/python/converter/registered_pointee.hpp> -# include <boost/python/converter/object_manager.hpp> -# include <boost/python/detail/void_ptr.hpp> -# include <boost/python/detail/void_return.hpp> -# include <boost/python/errors.hpp> -# include <boost/python/handle.hpp> -# include <boost/python/detail/type_traits.hpp> -# include <boost/mpl/and.hpp> -# include <boost/mpl/bool.hpp> - -namespace boost { namespace python { namespace converter { - -template <class T> struct is_object_manager; - -namespace detail -{ - template <class T> - struct return_pointer_from_python - { - typedef T result_type; - T operator()(PyObject*) const; - }; - - template <class T> - struct return_reference_from_python - { - typedef T result_type; - T operator()(PyObject*) const; - }; - - template <class T> - struct return_rvalue_from_python - { - typedef T result_type; - - return_rvalue_from_python(); - result_type operator()(PyObject*); - private: - rvalue_from_python_data<T> m_data; - }; - - template <class T> - struct return_object_manager_from_python - { - typedef T result_type; - result_type operator()(PyObject*) const; - }; - - template <class T> - struct select_return_from_python - { - BOOST_STATIC_CONSTANT( - bool, obj_mgr = is_object_manager<T>::value); - - BOOST_STATIC_CONSTANT( - bool, ptr = is_pointer<T>::value); - - BOOST_STATIC_CONSTANT( - bool, ref = is_reference<T>::value); - - typedef typename mpl::if_c< - obj_mgr - , return_object_manager_from_python<T> - , typename mpl::if_c< - ptr - , return_pointer_from_python<T> - , typename mpl::if_c< - ref - , return_reference_from_python<T> - , return_rvalue_from_python<T> - >::type - >::type - >::type type; - }; -} - -template <class T> -struct return_from_python - : detail::select_return_from_python<T>::type -{ -}; - -// Specialization as a convenience for call and call_method -template <> -struct return_from_python<void> -{ - typedef python::detail::returnable<void>::type result_type; - - result_type operator()(PyObject* x) const - { - (void_result_from_python)(x); -# ifdef BOOST_NO_VOID_RETURNS - return result_type(); -# endif - } -}; - -// -// Implementations -// -namespace detail -{ - template <class T> - inline return_rvalue_from_python<T>::return_rvalue_from_python() - : m_data( - const_cast<registration*>(®istered<T>::converters) - ) - { - } - - template <class T> - inline typename return_rvalue_from_python<T>::result_type - return_rvalue_from_python<T>::operator()(PyObject* obj) - { - // Take possession of the source object here. If the result is in - // fact going to be a copy of an lvalue embedded in the object, - // and we take possession inside rvalue_result_from_python, it - // will be destroyed too early. - handle<> holder(obj); - - return *(T*) - (rvalue_result_from_python)(obj, m_data.stage1); - } - - template <class T> - inline T return_reference_from_python<T>::operator()(PyObject* obj) const - { - return python::detail::void_ptr_to_reference( - (reference_result_from_python)(obj, registered<T>::converters) - , (T(*)())0); - } - - template <class T> - inline T return_pointer_from_python<T>::operator()(PyObject* obj) const - { - return T( - (pointer_result_from_python)(obj, registered_pointee<T>::converters) - ); - } - - template <class T> - inline T return_object_manager_from_python<T>::operator()(PyObject* obj) const - { - return T( - object_manager_traits<T>::adopt(expect_non_null(obj)) - ); - } -} - -}}} // namespace boost::python::converter - -#endif // RETURN_FROM_PYTHON_DWA200265_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/converter/rvalue_from_python_data.hpp b/contrib/restricted/boost/python/include/boost/python/converter/rvalue_from_python_data.hpp deleted file mode 100644 index d728681b3e..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/converter/rvalue_from_python_data.hpp +++ /dev/null @@ -1,147 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef FROM_PYTHON_AUX_DATA_DWA2002128_HPP -# define FROM_PYTHON_AUX_DATA_DWA2002128_HPP - -# include <boost/python/converter/constructor_function.hpp> -# include <boost/python/detail/referent_storage.hpp> -# include <boost/python/detail/destroy.hpp> -# include <boost/python/detail/type_traits.hpp> -# include <boost/align/align.hpp> -# include <boost/static_assert.hpp> -# include <cstddef> - -// Data management for potential rvalue conversions from Python to C++ -// types. When a client requests a conversion to T* or T&, we -// generally require that an object of type T exists in the source -// Python object, and the code here does not apply**. This implements -// conversions which may create new temporaries of type T. The classic -// example is a conversion which converts a Python tuple to a -// std::vector. Since no std::vector lvalue exists in the Python -// object -- it must be created "on-the-fly" by the converter, and -// which must manage the lifetime of the created object. -// -// Note that the client is not precluded from using a registered -// lvalue conversion to T in this case. In other words, we will -// happily accept a Python object which /does/ contain a std::vector -// lvalue, provided an appropriate converter is registered. So, while -// this is an rvalue conversion from the client's point-of-view, the -// converter registry may serve up lvalue or rvalue conversions for -// the target type. -// -// ** C++ argument from_python conversions to T const& are an -// exception to the rule for references: since in C++, const -// references can bind to temporary rvalues, we allow rvalue -// converters to be chosen when the target type is T const& for some -// T. -namespace boost { namespace python { namespace converter { - -// Conversions begin by filling in and returning a copy of this -// structure. The process looks up a converter in the rvalue converter -// registry for the target type. It calls the convertible() function -// of each registered converter, passing the source PyObject* as an -// argument, until a non-null result is returned. This result goes in -// the convertible field, and the converter's construct() function is -// stored in the construct field. -// -// If no appropriate converter is found, conversion fails and the -// convertible field is null. When used in argument conversion for -// wrapped C++ functions, it causes overload resolution to reject the -// current function but not to fail completely. If an exception is -// thrown, overload resolution stops and the exception propagates back -// through the caller. -// -// If an lvalue converter is matched, its convertible() function is -// expected to return a pointer to the stored T object; its -// construct() function will be NULL. The convertible() function of -// rvalue converters may return any non-singular pointer; the actual -// target object will only be available once the converter's -// construct() function is called. -struct rvalue_from_python_stage1_data -{ - void* convertible; - constructor_function construct; -}; - -// Augments rvalue_from_python_stage1_data by adding storage for -// constructing an object of remove_reference<T>::type. The -// construct() function of rvalue converters (stored in m_construct -// above) will cast the rvalue_from_python_stage1_data to an -// appropriate instantiation of this template in order to access that -// storage. -template <class T> -struct rvalue_from_python_storage -{ - rvalue_from_python_stage1_data stage1; - - // Storage for the result, in case an rvalue must be constructed - typename python::detail::referent_storage< - typename boost::python::detail::add_lvalue_reference<T>::type - >::type storage; -}; - -// Augments rvalue_from_python_storage<T> with a destructor. If -// stage1.convertible == storage.bytes, it indicates that an object of -// remove_reference<T>::type has been constructed in storage and -// should will be destroyed in ~rvalue_from_python_data(). It is -// crucial that successful rvalue conversions establish this equality -// and that unsuccessful ones do not. -template <class T> -struct rvalue_from_python_data : rvalue_from_python_storage<T> -{ -# if (!defined(__MWERKS__) || __MWERKS__ >= 0x3000) \ - && (!defined(__EDG_VERSION__) || __EDG_VERSION__ >= 245) \ - && (!defined(__DECCXX_VER) || __DECCXX_VER > 60590014) \ - && !defined(BOOST_PYTHON_SYNOPSIS) /* Synopsis' OpenCXX has trouble parsing this */ - // This must always be a POD struct with m_data its first member. - BOOST_STATIC_ASSERT(BOOST_PYTHON_OFFSETOF(rvalue_from_python_storage<T>,stage1) == 0); -# endif - - // The usual constructor - rvalue_from_python_data(rvalue_from_python_stage1_data const&); - - // This constructor just sets m_convertible -- used by - // implicitly_convertible<> to perform the final step of the - // conversion, where the construct() function is already known. - rvalue_from_python_data(void* convertible); - - // Destroys any object constructed in the storage. - ~rvalue_from_python_data(); - private: - typedef typename boost::python::detail::add_lvalue_reference< - typename boost::python::detail::add_cv<T>::type>::type ref_type; -}; - -// -// Implementataions -// -template <class T> -inline rvalue_from_python_data<T>::rvalue_from_python_data(rvalue_from_python_stage1_data const& _stage1) -{ - this->stage1 = _stage1; -} - -template <class T> -inline rvalue_from_python_data<T>::rvalue_from_python_data(void* convertible) -{ - this->stage1.convertible = convertible; -} - -template <class T> -inline rvalue_from_python_data<T>::~rvalue_from_python_data() -{ - if (this->stage1.convertible == this->storage.bytes) - { - size_t allocated = sizeof(this->storage); - void *ptr = this->storage.bytes; - void *aligned_storage = - ::boost::alignment::align(boost::python::detail::alignment_of<T>::value, 0, ptr, allocated); - python::detail::destroy_referent<ref_type>(aligned_storage); - } -} - -}}} // namespace boost::python::converter - -#endif // FROM_PYTHON_AUX_DATA_DWA2002128_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/converter/shared_ptr_deleter.hpp b/contrib/restricted/boost/python/include/boost/python/converter/shared_ptr_deleter.hpp deleted file mode 100644 index 926508d00e..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/converter/shared_ptr_deleter.hpp +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef SHARED_PTR_DELETER_DWA2002121_HPP -# define SHARED_PTR_DELETER_DWA2002121_HPP - -namespace boost { namespace python { namespace converter { - -struct BOOST_PYTHON_DECL shared_ptr_deleter -{ - shared_ptr_deleter(handle<> owner); - ~shared_ptr_deleter(); - - void operator()(void const*); - - handle<> owner; -}; - -}}} // namespace boost::python::converter - -#endif // SHARED_PTR_DELETER_DWA2002121_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/converter/shared_ptr_to_python.hpp b/contrib/restricted/boost/python/include/boost/python/converter/shared_ptr_to_python.hpp deleted file mode 100644 index 02649d406e..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/converter/shared_ptr_to_python.hpp +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright David Abrahams 2003. -// Copyright Stefan Seefeld 2016. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef boost_python_converter_shared_ptr_to_python_hpp_ -#define boost_python_converter_shared_ptr_to_python_hpp_ - -#include <boost/python/refcount.hpp> -#include <boost/python/converter/shared_ptr_deleter.hpp> -#include <boost/shared_ptr.hpp> -#include <boost/get_pointer.hpp> - -namespace boost { namespace python { namespace converter { - -template <class T> -PyObject* shared_ptr_to_python(shared_ptr<T> const& x) -{ - if (!x) - return python::detail::none(); - else if (shared_ptr_deleter* d = boost::get_deleter<shared_ptr_deleter>(x)) - return incref( get_pointer( d->owner ) ); - else - return converter::registered<shared_ptr<T> const&>::converters.to_python(&x); -} - -#if !defined(BOOST_NO_CXX11_SMART_PTR) -template <class T> -PyObject* shared_ptr_to_python(std::shared_ptr<T> const& x) -{ - if (!x) - return python::detail::none(); - else if (shared_ptr_deleter* d = std::get_deleter<shared_ptr_deleter>(x)) - return incref(get_pointer(d->owner)); - else - return converter::registered<std::shared_ptr<T> const&>::converters.to_python(&x); -} -#endif - -}}} // namespace boost::python::converter - -#endif diff --git a/contrib/restricted/boost/python/include/boost/python/converter/to_python_function_type.hpp b/contrib/restricted/boost/python/include/boost/python/converter/to_python_function_type.hpp deleted file mode 100644 index cccd014d68..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/converter/to_python_function_type.hpp +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef TO_PYTHON_FUNCTION_TYPE_DWA200236_HPP -# define TO_PYTHON_FUNCTION_TYPE_DWA200236_HPP -# include <boost/python/detail/prefix.hpp> -# include <boost/static_assert.hpp> - -namespace boost { namespace python { namespace converter { - -// The type of stored function pointers which actually do conversion -// by-value. The void* points to the object to be converted, and -// type-safety is preserved through runtime registration. -typedef PyObject* (*to_python_function_t)(void const*); - -}}} // namespace boost::python::converter - -#endif // TO_PYTHON_FUNCTION_TYPE_DWA200236_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/def_visitor.hpp b/contrib/restricted/boost/python/include/boost/python/def_visitor.hpp deleted file mode 100644 index 18dd928684..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/def_visitor.hpp +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright David Abrahams 2003. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef DEF_VISITOR_DWA2003810_HPP -# define DEF_VISITOR_DWA2003810_HPP - -# include <boost/python/detail/prefix.hpp> -# include <boost/detail/workaround.hpp> - -namespace boost { namespace python { - -template <class DerivedVisitor> class def_visitor; -template <class T, class X1, class X2, class X3> class class_; - -class def_visitor_access -{ -# if defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS) \ - || BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x551)) - // Tasteless as this may seem, making all members public allows member templates - // to work in the absence of member template friends. - public: -# else - template <class Derived> friend class def_visitor; -# endif - - // unnamed visit, c.f. init<...>, container suites - template <class V, class classT> - static void visit(V const& v, classT& c) - { - v.derived_visitor().visit(c); - } - - // named visit, c.f. object, pure_virtual - template <class V, class classT, class OptionalArgs> - static void visit( - V const& v - , classT& c - , char const* name - , OptionalArgs const& options - ) - { - v.derived_visitor().visit(c, name, options); - } - -}; - - -template <class DerivedVisitor> -class def_visitor -{ - friend class def_visitor_access; - -# if defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS) \ - || BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x551)) - // Tasteless as this may seem, making all members public allows member templates - // to work in the absence of member template friends. - public: -# else - template <class T, class X1, class X2, class X3> friend class class_; -# endif - - // unnamed visit, c.f. init<...>, container suites - template <class classT> - void visit(classT& c) const - { - def_visitor_access::visit(*this, c); - } - - // named visit, c.f. object, pure_virtual - template <class classT, class OptionalArgs> - void visit(classT& c, char const* name, OptionalArgs const& options) const - { - def_visitor_access::visit(*this, c, name, options); - } - - protected: - DerivedVisitor const& derived_visitor() const - { - return static_cast<DerivedVisitor const&>(*this); - } -}; - -}} // namespace boost::python - -#endif // DEF_VISITOR_DWA2003810_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/default_call_policies.hpp b/contrib/restricted/boost/python/include/boost/python/default_call_policies.hpp deleted file mode 100644 index c882257348..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/default_call_policies.hpp +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef DEFAULT_CALL_POLICIES_DWA2002131_HPP -# define DEFAULT_CALL_POLICIES_DWA2002131_HPP - -# include <boost/python/detail/prefix.hpp> -# include <boost/mpl/if.hpp> -# include <boost/python/to_python_value.hpp> -# include <boost/python/detail/type_traits.hpp> -# include <boost/python/detail/value_arg.hpp> -# include <boost/mpl/or.hpp> -# include <boost/mpl/front.hpp> - -namespace boost { namespace python { - -template <class T> struct to_python_value; - -namespace detail -{ -// for "readable" error messages - template <class T> struct specify_a_return_value_policy_to_wrap_functions_returning -# if defined(__GNUC__) || defined(__EDG__) - {} -# endif - ; -} - -struct default_result_converter; - -struct default_call_policies -{ - // Ownership of this argument tuple will ultimately be adopted by - // the caller. - template <class ArgumentPackage> - static bool precall(ArgumentPackage const&) - { - return true; - } - - // Pass the result through - template <class ArgumentPackage> - static PyObject* postcall(ArgumentPackage const&, PyObject* result) - { - return result; - } - - typedef default_result_converter result_converter; - typedef PyObject* argument_package; - - template <class Sig> - struct extract_return_type : mpl::front<Sig> - { - }; - -}; - -struct default_result_converter -{ - template <class R> - struct apply - { - typedef typename mpl::if_< - mpl::or_<detail::is_pointer<R>, detail::is_reference<R> > - , detail::specify_a_return_value_policy_to_wrap_functions_returning<R> - , boost::python::to_python_value< - typename detail::value_arg<R>::type - > - >::type type; - }; -}; - -// Exceptions for c strings an PyObject*s -template <> -struct default_result_converter::apply<char const*> -{ - typedef boost::python::to_python_value<char const*const&> type; -}; - -template <> -struct default_result_converter::apply<PyObject*> -{ - typedef boost::python::to_python_value<PyObject*const&> type; -}; - -}} // namespace boost::python - -#endif // DEFAULT_CALL_POLICIES_DWA2002131_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/detail/borrowed_ptr.hpp b/contrib/restricted/boost/python/include/boost/python/detail/borrowed_ptr.hpp deleted file mode 100644 index 7d78739ed9..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/detail/borrowed_ptr.hpp +++ /dev/null @@ -1,80 +0,0 @@ -#ifndef BORROWED_PTR_DWA20020601_HPP -# define BORROWED_PTR_DWA20020601_HPP -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -# include <boost/config.hpp> -# include <boost/type.hpp> -# include <boost/mpl/if.hpp> -# include <boost/python/detail/type_traits.hpp> -# include <boost/python/tag.hpp> - -namespace boost { namespace python { namespace detail { - -template<class T> class borrowed -{ - typedef T type; -}; - -template<typename T> -struct is_borrowed_ptr -{ - BOOST_STATIC_CONSTANT(bool, value = false); -}; - -# if !defined(__MWERKS__) || __MWERKS__ > 0x3000 -template<typename T> -struct is_borrowed_ptr<borrowed<T>*> -{ - BOOST_STATIC_CONSTANT(bool, value = true); -}; - -template<typename T> -struct is_borrowed_ptr<borrowed<T> const*> -{ - BOOST_STATIC_CONSTANT(bool, value = true); -}; - -template<typename T> -struct is_borrowed_ptr<borrowed<T> volatile*> -{ - BOOST_STATIC_CONSTANT(bool, value = true); -}; - -template<typename T> -struct is_borrowed_ptr<borrowed<T> const volatile*> -{ - BOOST_STATIC_CONSTANT(bool, value = true); -}; -# else -template<typename T> -struct is_borrowed -{ - BOOST_STATIC_CONSTANT(bool, value = false); -}; -template<typename T> -struct is_borrowed<borrowed<T> > -{ - BOOST_STATIC_CONSTANT(bool, value = true); -}; -template<typename T> -struct is_borrowed_ptr<T*> - : is_borrowed<typename remove_cv<T>::type> -{ -}; -# endif - - -} - -template <class T> -inline T* get_managed_object(detail::borrowed<T> const volatile* p, tag_t) -{ - return (T*)p; -} - -}} // namespace boost::python::detail - -#endif // #ifndef BORROWED_PTR_DWA20020601_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/detail/caller.hpp b/contrib/restricted/boost/python/include/boost/python/detail/caller.hpp deleted file mode 100644 index 2834d6da99..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/detail/caller.hpp +++ /dev/null @@ -1,270 +0,0 @@ -#if !defined(BOOST_PP_IS_ITERATING) - -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -# ifndef CALLER_DWA20021121_HPP -# define CALLER_DWA20021121_HPP - -# include <boost/python/type_id.hpp> -# include <boost/python/handle.hpp> - -# include <boost/detail/indirect_traits.hpp> - -# include <boost/python/detail/invoke.hpp> -# include <boost/python/detail/signature.hpp> -# include <boost/python/detail/preprocessor.hpp> -# include <boost/python/detail/type_traits.hpp> - -# include <boost/python/arg_from_python.hpp> -# include <boost/python/converter/context_result_converter.hpp> -# include <boost/python/converter/builtin_converters.hpp> - -# include <boost/preprocessor/iterate.hpp> -# include <boost/preprocessor/cat.hpp> -# include <boost/preprocessor/dec.hpp> -# include <boost/preprocessor/if.hpp> -# include <boost/preprocessor/iteration/local.hpp> -# include <boost/preprocessor/repetition/enum_trailing_params.hpp> -# include <boost/preprocessor/repetition/repeat.hpp> - -# include <boost/compressed_pair.hpp> - -# include <boost/mpl/apply.hpp> -# include <boost/mpl/eval_if.hpp> -# include <boost/mpl/identity.hpp> -# include <boost/mpl/size.hpp> -# include <boost/mpl/at.hpp> -# include <boost/mpl/int.hpp> -# include <boost/mpl/next.hpp> - -namespace boost { namespace python { namespace detail { - -template <int N> -inline PyObject* get(mpl::int_<N>, PyObject* const& args_) -{ - return PyTuple_GET_ITEM(args_,N); -} - -inline Py_ssize_t arity(PyObject* const& args_) -{ - return PyTuple_GET_SIZE(args_); -} - -// This "result converter" is really just used as -// a dispatch tag to invoke(...), selecting the appropriate -// implementation -typedef int void_result_to_python; - -// Given a model of CallPolicies and a C++ result type, this -// metafunction selects the appropriate converter to use for -// converting the result to python. -template <class Policies, class Result> -struct select_result_converter - : mpl::eval_if< - is_same<Result,void> - , mpl::identity<void_result_to_python> - , mpl::apply1<typename Policies::result_converter,Result> - > -{ -}; - -template <class ArgPackage, class ResultConverter> -inline ResultConverter create_result_converter( - ArgPackage const& args_ - , ResultConverter* - , converter::context_result_converter* -) -{ - return ResultConverter(args_); -} - -template <class ArgPackage, class ResultConverter> -inline ResultConverter create_result_converter( - ArgPackage const& - , ResultConverter* - , ... -) -{ - return ResultConverter(); -} - -#ifndef BOOST_PYTHON_NO_PY_SIGNATURES -template <class ResultConverter> -struct converter_target_type -{ - static PyTypeObject const *get_pytype() - { - return create_result_converter((PyObject*)0, (ResultConverter *)0, (ResultConverter *)0).get_pytype(); - } -}; - -template < > -struct converter_target_type <void_result_to_python > -{ - static PyTypeObject const *get_pytype() - { - return 0; - } -}; - -// Generation of ret moved from caller_arity<N>::impl::signature to here due to "feature" in MSVC 15.7.2 with /O2 -// which left the ret uninitialized and caused segfaults in Python interpreter. -template<class Policies, class Sig> const signature_element* get_ret() -{ - typedef BOOST_DEDUCED_TYPENAME Policies::template extract_return_type<Sig>::type rtype; - typedef typename select_result_converter<Policies, rtype>::type result_converter; - - static const signature_element ret = { - (is_void<rtype>::value ? "void" : type_id<rtype>().name()) - , &detail::converter_target_type<result_converter>::get_pytype - , boost::detail::indirect_traits::is_reference_to_non_const<rtype>::value - }; - - return &ret; -} - -#endif - - -template <unsigned> struct caller_arity; - -template <class F, class CallPolicies, class Sig> -struct caller; - -# define BOOST_PYTHON_NEXT(init,name,n) \ - typedef BOOST_PP_IF(n,typename mpl::next< BOOST_PP_CAT(name,BOOST_PP_DEC(n)) >::type, init) name##n; - -# define BOOST_PYTHON_ARG_CONVERTER(n) \ - BOOST_PYTHON_NEXT(typename mpl::next<first>::type, arg_iter,n) \ - typedef arg_from_python<BOOST_DEDUCED_TYPENAME arg_iter##n::type> c_t##n; \ - c_t##n c##n(get(mpl::int_<n>(), inner_args)); \ - if (!c##n.convertible()) \ - return 0; - -# define BOOST_PP_ITERATION_PARAMS_1 \ - (3, (0, BOOST_PYTHON_MAX_ARITY + 1, <boost/python/detail/caller.hpp>)) -# include BOOST_PP_ITERATE() - -# undef BOOST_PYTHON_ARG_CONVERTER -# undef BOOST_PYTHON_NEXT - -// A metafunction returning the base class used for caller<class F, -// class ConverterGenerators, class CallPolicies, class Sig>. -template <class F, class CallPolicies, class Sig> -struct caller_base_select -{ - enum { arity = mpl::size<Sig>::value - 1 }; - typedef typename caller_arity<arity>::template impl<F,CallPolicies,Sig> type; -}; - -// A function object type which wraps C++ objects as Python callable -// objects. -// -// Template Arguments: -// -// F - -// the C++ `function object' that will be called. Might -// actually be any data for which an appropriate invoke_tag() can -// be generated. invoke(...) takes care of the actual invocation syntax. -// -// CallPolicies - -// The precall, postcall, and what kind of resultconverter to -// generate for mpl::front<Sig>::type -// -// Sig - -// The `intended signature' of the function. An MPL sequence -// beginning with a result type and continuing with a list of -// argument types. -template <class F, class CallPolicies, class Sig> -struct caller - : caller_base_select<F,CallPolicies,Sig>::type -{ - typedef typename caller_base_select< - F,CallPolicies,Sig - >::type base; - - typedef PyObject* result_type; - - caller(F f, CallPolicies p) : base(f,p) {} - -}; - -}}} // namespace boost::python::detail - -# endif // CALLER_DWA20021121_HPP - -#else - -# define N BOOST_PP_ITERATION() - -template <> -struct caller_arity<N> -{ - template <class F, class Policies, class Sig> - struct impl - { - impl(F f, Policies p) : m_data(f,p) {} - - PyObject* operator()(PyObject* args_, PyObject*) // eliminate - // this - // trailing - // keyword dict - { - typedef typename mpl::begin<Sig>::type first; - typedef typename first::type result_t; - typedef typename select_result_converter<Policies, result_t>::type result_converter; - typedef typename Policies::argument_package argument_package; - - argument_package inner_args(args_); - -# if N -# define BOOST_PP_LOCAL_MACRO(i) BOOST_PYTHON_ARG_CONVERTER(i) -# define BOOST_PP_LOCAL_LIMITS (0, N-1) -# include BOOST_PP_LOCAL_ITERATE() -# endif - // all converters have been checked. Now we can do the - // precall part of the policy - if (!m_data.second().precall(inner_args)) - return 0; - - PyObject* result = detail::invoke( - detail::invoke_tag<result_t,F>() - , create_result_converter(args_, (result_converter*)0, (result_converter*)0) - , m_data.first() - BOOST_PP_ENUM_TRAILING_PARAMS(N, c) - ); - - return m_data.second().postcall(inner_args, result); - } - - static unsigned min_arity() { return N; } - - static py_func_sig_info signature() - { - const signature_element * sig = detail::signature<Sig>::elements(); -#ifndef BOOST_PYTHON_NO_PY_SIGNATURES - // MSVC 15.7.2, when compiling to /O2 left the static const signature_element ret, - // originally defined here, uninitialized. This in turn led to SegFault in Python interpreter. - // Issue is resolved by moving the generation of ret to separate function in detail namespace (see above). - const signature_element * ret = detail::get_ret<Policies, Sig>(); - - py_func_sig_info res = {sig, ret }; -#else - py_func_sig_info res = {sig, sig }; -#endif - - return res; - } - private: - compressed_pair<F,Policies> m_data; - }; -}; - - - -#endif // BOOST_PP_IS_ITERATING - - diff --git a/contrib/restricted/boost/python/include/boost/python/detail/config.hpp b/contrib/restricted/boost/python/include/boost/python/detail/config.hpp deleted file mode 100644 index 8dce9b742e..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/detail/config.hpp +++ /dev/null @@ -1,134 +0,0 @@ -// (C) Copyright David Abrahams 2000. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// The author gratefully acknowleges the support of Dragon Systems, Inc., in -// producing this work. - -// Revision History: -// 04 Mar 01 Some fixes so it will compile with Intel C++ (Dave Abrahams) - -#ifndef CONFIG_DWA052200_H_ -# define CONFIG_DWA052200_H_ - -# include <boost/config.hpp> -# include <boost/detail/workaround.hpp> - -# ifdef BOOST_NO_OPERATORS_IN_NAMESPACE - // A gcc bug forces some symbols into the global namespace -# define BOOST_PYTHON_BEGIN_CONVERSION_NAMESPACE -# define BOOST_PYTHON_END_CONVERSION_NAMESPACE -# define BOOST_PYTHON_CONVERSION -# define BOOST_PYTHON_IMPORT_CONVERSION(x) using ::x -# else -# define BOOST_PYTHON_BEGIN_CONVERSION_NAMESPACE namespace boost { namespace python { -# define BOOST_PYTHON_END_CONVERSION_NAMESPACE }} // namespace boost::python -# define BOOST_PYTHON_CONVERSION boost::python -# define BOOST_PYTHON_IMPORT_CONVERSION(x) void never_defined() // so we can follow the macro with a ';' -# endif - -# if defined(BOOST_MSVC) - -# pragma warning (disable : 4786) // disable truncated debug symbols -# pragma warning (disable : 4251) // disable exported dll function -# pragma warning (disable : 4800) //'int' : forcing value to bool 'true' or 'false' -# pragma warning (disable : 4275) // non dll-interface class - -# elif defined(__ICL) && __ICL < 600 // Intel C++ 5 - -# pragma warning(disable: 985) // identifier was truncated in debug information - -# endif - -// The STLport puts all of the standard 'C' library names in std (as far as the -// user is concerned), but without it you need a fix if you're using MSVC or -// Intel C++ -# if defined(BOOST_NO_STDC_NAMESPACE) -# define BOOST_CSTD_ -# else -# define BOOST_CSTD_ std -# endif - -/***************************************************************************** - * - * Set up dll import/export options: - * - ****************************************************************************/ - -// backwards compatibility: -#ifdef BOOST_PYTHON_STATIC_LIB -# define BOOST_PYTHON_STATIC_LINK -# elif !defined(BOOST_PYTHON_DYNAMIC_LIB) -# define BOOST_PYTHON_DYNAMIC_LIB -#endif - -#if defined(BOOST_PYTHON_DYNAMIC_LIB) -# if defined(BOOST_SYMBOL_EXPORT) -# if defined(BOOST_PYTHON_SOURCE) -# define BOOST_PYTHON_DECL BOOST_SYMBOL_EXPORT -# define BOOST_PYTHON_DECL_FORWARD BOOST_SYMBOL_FORWARD_EXPORT -# define BOOST_PYTHON_DECL_EXCEPTION BOOST_EXCEPTION_EXPORT -# define BOOST_PYTHON_BUILD_DLL -# else -# define BOOST_PYTHON_DECL BOOST_SYMBOL_IMPORT -# define BOOST_PYTHON_DECL_FORWARD BOOST_SYMBOL_FORWARD_IMPORT -# define BOOST_PYTHON_DECL_EXCEPTION BOOST_EXCEPTION_IMPORT -# endif -# endif -#endif - -#ifndef BOOST_PYTHON_DECL -# define BOOST_PYTHON_DECL -#endif - -#ifndef BOOST_PYTHON_DECL_FORWARD -# define BOOST_PYTHON_DECL_FORWARD -#endif - -#ifndef BOOST_PYTHON_DECL_EXCEPTION -# define BOOST_PYTHON_DECL_EXCEPTION -#endif - -#if BOOST_WORKAROUND(__DECCXX_VER, BOOST_TESTED_AT(60590042)) -// Replace broken Tru64/cxx offsetof macro -# define BOOST_PYTHON_OFFSETOF(s_name, s_member) \ - ((size_t)__INTADDR__(&(((s_name *)0)->s_member))) -#else -# define BOOST_PYTHON_OFFSETOF offsetof -#endif - -// enable automatic library variant selection ------------------------------// - -#if !defined(BOOST_PYTHON_SOURCE) && !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_PYTHON_NO_LIB) -// -// Set the name of our library, this will get undef'ed by auto_link.hpp -// once it's done with it: -// -#define _BOOST_PYTHON_CONCAT(N, M, m) N ## M ## m -#define BOOST_PYTHON_CONCAT(N, M, m) _BOOST_PYTHON_CONCAT(N, M, m) -#define BOOST_LIB_NAME BOOST_PYTHON_CONCAT(boost_python, PY_MAJOR_VERSION, PY_MINOR_VERSION) -// -// If we're importing code from a dll, then tell auto_link.hpp about it: -// -#ifdef BOOST_PYTHON_DYNAMIC_LIB -# define BOOST_DYN_LINK -#endif -// -// And include the header that does the work: -// -#include <boost/config/auto_link.hpp> -#endif // auto-linking disabled - -#undef BOOST_PYTHON_CONCAT -#undef _BOOST_PYTHON_CONCAT - -#ifndef BOOST_PYTHON_NO_PY_SIGNATURES -#define BOOST_PYTHON_SUPPORTS_PY_SIGNATURES // enables smooth transition -#endif - -#if !defined(BOOST_ATTRIBUTE_UNUSED) && defined(__GNUC__) && (__GNUC__ >= 4) -# define BOOST_ATTRIBUTE_UNUSED __attribute__((unused)) -#endif - -#endif // CONFIG_DWA052200_H_ diff --git a/contrib/restricted/boost/python/include/boost/python/detail/construct.hpp b/contrib/restricted/boost/python/include/boost/python/detail/construct.hpp deleted file mode 100644 index e69fbc7538..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/detail/construct.hpp +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef CONSTRUCT_REFERENCE_DWA2002716_HPP -# define CONSTRUCT_REFERENCE_DWA2002716_HPP - -namespace boost { namespace python { namespace detail { - -template <class T, class Arg> -void construct_pointee(void* storage, Arg& x, T const volatile*) -{ - new (storage) T(x); -} - -template <class T, class Arg> -void construct_referent_impl(void* storage, Arg& x, T&(*)()) -{ - construct_pointee(storage, x, (T*)0); -} - -template <class T, class Arg> -void construct_referent(void* storage, Arg const& x, T(*tag)() = 0) -{ - construct_referent_impl(storage, x, tag); -} - -template <class T, class Arg> -void construct_referent(void* storage, Arg& x, T(*tag)() = 0) -{ - construct_referent_impl(storage, x, tag); -} - -}}} // namespace boost::python::detail - -#endif // CONSTRUCT_REFERENCE_DWA2002716_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/detail/convertible.hpp b/contrib/restricted/boost/python/include/boost/python/detail/convertible.hpp deleted file mode 100644 index 1ff350ec24..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/detail/convertible.hpp +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef CONVERTIBLE_DWA2002614_HPP -# define CONVERTIBLE_DWA2002614_HPP - -# if defined(__EDG_VERSION__) && __EDG_VERSION__ <= 241 -# include <boost/mpl/if.hpp> -# include <boost/python/detail/type_traits.hpp> -# endif - -// Supplies a runtime is_convertible check which can be used with tag -// dispatching to work around the Metrowerks Pro7 limitation with boost/std::is_convertible -namespace boost { namespace python { namespace detail { - -typedef char* yes_convertible; -typedef int* no_convertible; - -template <class Target> -struct convertible -{ -# if !defined(__EDG_VERSION__) || __EDG_VERSION__ > 241 || __EDG_VERSION__ == 238 - static inline no_convertible check(...) { return 0; } - static inline yes_convertible check(Target) { return 0; } -# else - template <class X> - static inline typename mpl::if_c< - is_convertible<X,Target>::value - , yes_convertible - , no_convertible - >::type check(X const&) { return 0; } -# endif -}; - -}}} // namespace boost::python::detail - -#endif // CONVERTIBLE_DWA2002614_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/detail/copy_ctor_mutates_rhs.hpp b/contrib/restricted/boost/python/include/boost/python/detail/copy_ctor_mutates_rhs.hpp deleted file mode 100644 index 4ca8d03911..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/detail/copy_ctor_mutates_rhs.hpp +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright David Abrahams 2003. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef COPY_CTOR_MUTATES_RHS_DWA2003219_HPP -# define COPY_CTOR_MUTATES_RHS_DWA2003219_HPP - -#include <boost/python/detail/is_auto_ptr.hpp> -#include <boost/mpl/bool.hpp> - -namespace boost { namespace python { namespace detail { - -template <class T> -struct copy_ctor_mutates_rhs - : is_auto_ptr<T> -{ -}; - -}}} // namespace boost::python::detail - -#endif // COPY_CTOR_MUTATES_RHS_DWA2003219_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/detail/cv_category.hpp b/contrib/restricted/boost/python/include/boost/python/detail/cv_category.hpp deleted file mode 100644 index eb5a8eb9da..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/detail/cv_category.hpp +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef CV_CATEGORY_DWA200222_HPP -# define CV_CATEGORY_DWA200222_HPP -# include <boost/python/detail/type_traits.hpp> - -namespace boost { namespace python { namespace detail { - -template <bool is_const_, bool is_volatile_> -struct cv_tag -{ - BOOST_STATIC_CONSTANT(bool, is_const = is_const_); - BOOST_STATIC_CONSTANT(bool, is_volatile = is_volatile_); -}; - -typedef cv_tag<false,false> cv_unqualified; -typedef cv_tag<true,false> const_; -typedef cv_tag<false,true> volatile_; -typedef cv_tag<true,true> const_volatile_; - -template <class T> -struct cv_category -{ -// BOOST_STATIC_CONSTANT(bool, c = is_const<T>::value); -// BOOST_STATIC_CONSTANT(bool, v = is_volatile<T>::value); - typedef cv_tag< - is_const<T>::value - , is_volatile<T>::value - > type; -}; - -}}} // namespace boost::python::detail - -#endif // CV_CATEGORY_DWA200222_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/detail/decorated_type_id.hpp b/contrib/restricted/boost/python/include/boost/python/detail/decorated_type_id.hpp deleted file mode 100644 index 2596f3104a..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/detail/decorated_type_id.hpp +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef DECORATED_TYPE_ID_DWA2002517_HPP -# define DECORATED_TYPE_ID_DWA2002517_HPP - -# include <boost/python/type_id.hpp> -# include <boost/python/detail/indirect_traits.hpp> -# include <boost/python/detail/type_traits.hpp> - -namespace boost { namespace python { namespace detail { - -struct decorated_type_info : totally_ordered<decorated_type_info> -{ - enum decoration { const_ = 0x1, volatile_ = 0x2, reference = 0x4 }; - - decorated_type_info(type_info, decoration = decoration()); - - inline bool operator<(decorated_type_info const& rhs) const; - inline bool operator==(decorated_type_info const& rhs) const; - - friend BOOST_PYTHON_DECL std::ostream& operator<<(std::ostream&, decorated_type_info const&); - - operator type_info const&() const; - private: // type - typedef type_info base_id_t; - - private: // data members - decoration m_decoration; - base_id_t m_base_type; -}; - -template <class T> -inline decorated_type_info decorated_type_id(boost::type<T>* = 0) -{ - return decorated_type_info( - type_id<T>() - , decorated_type_info::decoration( - (is_const<T>::value || indirect_traits::is_reference_to_const<T>::value - ? decorated_type_info::const_ : 0) - | (is_volatile<T>::value || indirect_traits::is_reference_to_volatile<T>::value - ? decorated_type_info::volatile_ : 0) - | (is_reference<T>::value ? decorated_type_info::reference : 0) - ) - ); -} - -inline decorated_type_info::decorated_type_info(type_info base_t, decoration decoration) - : m_decoration(decoration) - , m_base_type(base_t) -{ -} - -inline bool decorated_type_info::operator<(decorated_type_info const& rhs) const -{ - return m_decoration < rhs.m_decoration - || (m_decoration == rhs.m_decoration - && m_base_type < rhs.m_base_type); -} - -inline bool decorated_type_info::operator==(decorated_type_info const& rhs) const -{ - return m_decoration == rhs.m_decoration && m_base_type == rhs.m_base_type; -} - -inline decorated_type_info::operator type_info const&() const -{ - return m_base_type; -} - -BOOST_PYTHON_DECL std::ostream& operator<<(std::ostream&, decorated_type_info const&); - -}}} // namespace boost::python::detail - -#endif // DECORATED_TYPE_ID_DWA2002517_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/detail/decref_guard.hpp b/contrib/restricted/boost/python/include/boost/python/detail/decref_guard.hpp deleted file mode 100644 index d713e0a604..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/detail/decref_guard.hpp +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef DECREF_GUARD_DWA20021220_HPP -# define DECREF_GUARD_DWA20021220_HPP - -namespace boost { namespace python { namespace detail { - -struct decref_guard -{ - decref_guard(PyObject* o) : obj(o) {} - ~decref_guard() { Py_XDECREF(obj); } - void cancel() { obj = 0; } - private: - PyObject* obj; -}; - -}}} // namespace boost::python::detail - -#endif // DECREF_GUARD_DWA20021220_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/detail/def_helper_fwd.hpp b/contrib/restricted/boost/python/include/boost/python/detail/def_helper_fwd.hpp deleted file mode 100644 index 31c22e97a3..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/detail/def_helper_fwd.hpp +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright David Abrahams 2003. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef DEF_HELPER_FWD_DWA2003810_HPP -# define DEF_HELPER_FWD_DWA2003810_HPP - -# include <boost/python/detail/not_specified.hpp> - -namespace boost { namespace python { namespace detail { - -template <class T1, class T2 = not_specified, class T3 = not_specified, class T4 = not_specified> -struct def_helper; - -}}} // namespace boost::python::detail - -#endif // DEF_HELPER_FWD_DWA2003810_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/detail/dependent.hpp b/contrib/restricted/boost/python/include/boost/python/detail/dependent.hpp deleted file mode 100644 index 70392c4d78..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/detail/dependent.hpp +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef DEPENDENT_DWA200286_HPP -# define DEPENDENT_DWA200286_HPP - -namespace boost { namespace python { namespace detail { - -// A way to turn a concrete type T into a type dependent on U. This -// keeps conforming compilers (those implementing proper 2-phase -// name lookup for templates) from complaining about incomplete -// types in situations where it would otherwise be inconvenient or -// impossible to re-order code so that all types are defined in time. - -// One such use is when we must return an incomplete T from a member -// function template (which must be defined in the class body to -// keep MSVC happy). -template <class T, class U> -struct dependent -{ - typedef T type; -}; - -}}} // namespace boost::python::detail - -#endif // DEPENDENT_DWA200286_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/detail/destroy.hpp b/contrib/restricted/boost/python/include/boost/python/detail/destroy.hpp deleted file mode 100644 index d35b2b536e..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/detail/destroy.hpp +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef DESTROY_DWA2002221_HPP -# define DESTROY_DWA2002221_HPP - -# include <boost/python/detail/type_traits.hpp> -# include <boost/detail/workaround.hpp> -namespace boost { namespace python { namespace detail { - -template <bool array> struct value_destroyer; - -template <> -struct value_destroyer<false> -{ - template <class T> - static void execute(T const volatile* p) - { - p->~T(); - } -}; - -template <> -struct value_destroyer<true> -{ - template <class A, class T> - static void execute(A*, T const volatile* const first) - { - for (T const volatile* p = first; p != first + sizeof(A)/sizeof(T); ++p) - { - value_destroyer< - is_array<T>::value - >::execute(p); - } - } - - template <class T> - static void execute(T const volatile* p) - { - execute(p, *p); - } -}; - -template <class T> -inline void destroy_referent_impl(void* p, T& (*)()) -{ - // note: cv-qualification needed for MSVC6 - // must come *before* T for metrowerks - value_destroyer< - (is_array<T>::value) - >::execute((const volatile T*)p); -} - -template <class T> -inline void destroy_referent(void* p, T(*)() = 0) -{ - destroy_referent_impl(p, (T(*)())0); -} - -}}} // namespace boost::python::detail - -#endif // DESTROY_DWA2002221_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/detail/exception_handler.hpp b/contrib/restricted/boost/python/include/boost/python/detail/exception_handler.hpp deleted file mode 100644 index fdc9989836..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/detail/exception_handler.hpp +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef EXCEPTION_HANDLER_DWA2002810_HPP -# define EXCEPTION_HANDLER_DWA2002810_HPP - -# include <boost/python/detail/config.hpp> -# include <boost/function/function0.hpp> -# include <boost/function/function2.hpp> - -namespace boost { namespace python { namespace detail { - -struct exception_handler; - -typedef function2<bool, exception_handler const&, function0<void> const&> handler_function; - -struct BOOST_PYTHON_DECL exception_handler -{ - private: // types - - public: - explicit exception_handler(handler_function const& impl); - - inline bool handle(function0<void> const& f) const; - - bool operator()(function0<void> const& f) const; - - static exception_handler* chain; - - private: - static exception_handler* tail; - - handler_function m_impl; - exception_handler* m_next; -}; - - -inline bool exception_handler::handle(function0<void> const& f) const -{ - return this->m_impl(*this, f); -} - -BOOST_PYTHON_DECL void register_exception_handler(handler_function const& f); - -}}} // namespace boost::python::detail - -#endif // EXCEPTION_HANDLER_DWA2002810_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/detail/force_instantiate.hpp b/contrib/restricted/boost/python/include/boost/python/detail/force_instantiate.hpp deleted file mode 100644 index a8901b2da7..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/detail/force_instantiate.hpp +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef FORCE_INSTANTIATE_DWA200265_HPP -# define FORCE_INSTANTIATE_DWA200265_HPP - -namespace boost { namespace python { namespace detail { - -// Allows us to force the argument to be instantiated without -// incurring unused variable warnings - -template <class T> -inline void force_instantiate(T const&) {} - -}}} // namespace boost::python::detail - -#endif // FORCE_INSTANTIATE_DWA200265_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/detail/indirect_traits.hpp b/contrib/restricted/boost/python/include/boost/python/detail/indirect_traits.hpp deleted file mode 100644 index ce8ba310a2..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/detail/indirect_traits.hpp +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright David Abrahams 2004. Distributed under the Boost -// Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -#ifndef INDIRECT_TRAITS_DWA2004915_HPP -# define INDIRECT_TRAITS_DWA2004915_HPP - -# include <boost/detail/indirect_traits.hpp> - -namespace boost { namespace python { -namespace indirect_traits = boost::detail::indirect_traits; -}} // namespace boost::python::detail - -#endif // INDIRECT_TRAITS_DWA2004915_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/detail/invoke.hpp b/contrib/restricted/boost/python/include/boost/python/detail/invoke.hpp deleted file mode 100644 index 4c5296ff12..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/detail/invoke.hpp +++ /dev/null @@ -1,98 +0,0 @@ -#if !defined(BOOST_PP_IS_ITERATING) - -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -# ifndef INVOKE_DWA20021122_HPP -# define INVOKE_DWA20021122_HPP - -# include <boost/python/detail/prefix.hpp> -# include <boost/python/detail/preprocessor.hpp> -# include <boost/python/detail/none.hpp> - -# include <boost/preprocessor/iterate.hpp> -# include <boost/preprocessor/facilities/intercept.hpp> -# include <boost/preprocessor/repetition/enum_trailing_params.hpp> -# include <boost/preprocessor/repetition/enum_trailing_binary_params.hpp> -# include <boost/preprocessor/repetition/enum_binary_params.hpp> -# include <boost/python/to_python_value.hpp> - -// This file declares a series of overloaded invoke(...) functions, -// used to invoke wrapped C++ function (object)s from Python. Each one -// accepts: -// -// - a tag which identifies the invocation syntax (e.g. member -// functions must be invoked with a different syntax from regular -// functions) -// -// - a pointer to a result converter type, used solely as a way of -// transmitting the type of the result converter to the function (or -// an int, if the return type is void). -// -// - the "function", which may be a function object, a function or -// member function pointer, or a defaulted_virtual_fn. -// -// - The arg_from_python converters for each of the arguments to be -// passed to the function being invoked. - -namespace boost { namespace python { namespace detail { - -// This "result converter" is really just used as a dispatch tag to -// invoke(...), selecting the appropriate implementation -typedef int void_result_to_python; - -template <bool void_return, bool member> -struct invoke_tag_ {}; - -// A metafunction returning the appropriate tag type for invoking an -// object of type F with return type R. -template <class R, class F> -struct invoke_tag - : invoke_tag_< - is_same<R,void>::value - , is_member_function_pointer<F>::value - > -{ -}; - -# define BOOST_PP_ITERATION_PARAMS_1 \ - (3, (0, BOOST_PYTHON_MAX_ARITY, <boost/python/detail/invoke.hpp>)) -# include BOOST_PP_ITERATE() - -}}} // namespace boost::python::detail - -# endif // INVOKE_DWA20021122_HPP -#else - -# define N BOOST_PP_ITERATION() - -template <class RC, class F BOOST_PP_ENUM_TRAILING_PARAMS_Z(1, N, class AC)> -inline PyObject* invoke(invoke_tag_<false,false>, RC const& rc, F& f BOOST_PP_ENUM_TRAILING_BINARY_PARAMS_Z(1, N, AC, & ac) ) -{ - return rc(f( BOOST_PP_ENUM_BINARY_PARAMS_Z(1, N, ac, () BOOST_PP_INTERCEPT) )); -} - -template <class RC, class F BOOST_PP_ENUM_TRAILING_PARAMS_Z(1, N, class AC)> -inline PyObject* invoke(invoke_tag_<true,false>, RC const&, F& f BOOST_PP_ENUM_TRAILING_BINARY_PARAMS_Z(1, N, AC, & ac) ) -{ - f( BOOST_PP_ENUM_BINARY_PARAMS_Z(1, N, ac, () BOOST_PP_INTERCEPT) ); - return none(); -} - -template <class RC, class F, class TC BOOST_PP_ENUM_TRAILING_PARAMS_Z(1, N, class AC)> -inline PyObject* invoke(invoke_tag_<false,true>, RC const& rc, F& f, TC& tc BOOST_PP_ENUM_TRAILING_BINARY_PARAMS_Z(1, N, AC, & ac) ) -{ - return rc( (tc().*f)(BOOST_PP_ENUM_BINARY_PARAMS_Z(1, N, ac, () BOOST_PP_INTERCEPT)) ); -} - -template <class RC, class F, class TC BOOST_PP_ENUM_TRAILING_PARAMS_Z(1, N, class AC)> -inline PyObject* invoke(invoke_tag_<true,true>, RC const&, F& f, TC& tc BOOST_PP_ENUM_TRAILING_BINARY_PARAMS_Z(1, N, AC, & ac) ) -{ - (tc().*f)(BOOST_PP_ENUM_BINARY_PARAMS_Z(1, N, ac, () BOOST_PP_INTERCEPT)); - return none(); -} - -# undef N - -#endif // BOOST_PP_IS_ITERATING diff --git a/contrib/restricted/boost/python/include/boost/python/detail/is_auto_ptr.hpp b/contrib/restricted/boost/python/include/boost/python/detail/is_auto_ptr.hpp deleted file mode 100644 index 3b8198b8dd..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/detail/is_auto_ptr.hpp +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright David Abrahams 2003. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef IS_AUTO_PTR_DWA2003224_HPP -# define IS_AUTO_PTR_DWA2003224_HPP - -# ifndef BOOST_NO_AUTO_PTR -# include <boost/python/detail/is_xxx.hpp> -# include <memory> -# endif - -namespace boost { namespace python { namespace detail { - -# if !defined(BOOST_NO_AUTO_PTR) - -BOOST_PYTHON_IS_XXX_DEF(auto_ptr, std::auto_ptr, 1) - -# else - -template <class T> -struct is_auto_ptr : mpl::false_ -{ -}; - -# endif - -}}} // namespace boost::python::detail - -#endif // IS_AUTO_PTR_DWA2003224_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/detail/is_shared_ptr.hpp b/contrib/restricted/boost/python/include/boost/python/detail/is_shared_ptr.hpp deleted file mode 100644 index 383383bc12..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/detail/is_shared_ptr.hpp +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright David Abrahams 2003. -// Copyright Stefan Seefeld 2016. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef boost_python_detail_is_shared_ptr_hpp_ -#define boost_python_detail_is_shared_ptr_hpp_ - -#include <boost/python/detail/is_xxx.hpp> -#include <boost/shared_ptr.hpp> - -namespace boost { namespace python { namespace detail { - -BOOST_PYTHON_IS_XXX_DEF(shared_ptr, shared_ptr, 1) -#if !defined(BOOST_NO_CXX11_SMART_PTR) -template <typename T> -struct is_shared_ptr<std::shared_ptr<T> > : std::true_type {}; -#endif - -}}} // namespace boost::python::detail - -#endif diff --git a/contrib/restricted/boost/python/include/boost/python/detail/is_xxx.hpp b/contrib/restricted/boost/python/include/boost/python/detail/is_xxx.hpp deleted file mode 100644 index 9ddfafd3c0..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/detail/is_xxx.hpp +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright David Abrahams 2005. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef IS_XXX_DWA2003224_HPP -# define IS_XXX_DWA2003224_HPP - -# include <boost/detail/is_xxx.hpp> - -# define BOOST_PYTHON_IS_XXX_DEF(name, qualified_name, nargs) \ - BOOST_DETAIL_IS_XXX_DEF(name, qualified_name, nargs) - -#endif // IS_XXX_DWA2003224_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/detail/map_entry.hpp b/contrib/restricted/boost/python/include/boost/python/detail/map_entry.hpp deleted file mode 100644 index 8bf1759f9f..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/detail/map_entry.hpp +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef MAP_ENTRY_DWA2002118_HPP -# define MAP_ENTRY_DWA2002118_HPP - -namespace boost { namespace python { namespace detail { - -// A trivial type that works well as the value_type of associative -// vector maps -template <class Key, class Value> -struct map_entry -{ - map_entry() {} - map_entry(Key k) : key(k), value() {} - map_entry(Key k, Value v) : key(k), value(v) {} - - bool operator<(map_entry const& rhs) const - { - return this->key < rhs.key; - } - - Key key; - Value value; -}; - -template <class Key, class Value> -bool operator<(map_entry<Key,Value> const& e, Key const& k) -{ - return e.key < k; -} - -template <class Key, class Value> -bool operator<(Key const& k, map_entry<Key,Value> const& e) -{ - return k < e.key; -} - - -}}} // namespace boost::python::detail - -#endif // MAP_ENTRY_DWA2002118_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/detail/mpl_lambda.hpp b/contrib/restricted/boost/python/include/boost/python/detail/mpl_lambda.hpp deleted file mode 100644 index a20608e710..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/detail/mpl_lambda.hpp +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef MPL_LAMBDA_DWA2002122_HPP -# define MPL_LAMBDA_DWA2002122_HPP - -// this header should go away soon -# include <boost/mpl/aux_/lambda_support.hpp> -# define BOOST_PYTHON_MPL_LAMBDA_SUPPORT BOOST_MPL_AUX_LAMBDA_SUPPORT - -#endif // MPL_LAMBDA_DWA2002122_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/detail/msvc_typeinfo.hpp b/contrib/restricted/boost/python/include/boost/python/detail/msvc_typeinfo.hpp deleted file mode 100644 index bfc84164f0..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/detail/msvc_typeinfo.hpp +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef MSVC_TYPEINFO_DWA200222_HPP -# define MSVC_TYPEINFO_DWA200222_HPP - -#include <typeinfo> -#include <boost/type.hpp> - -// -// Fix for icc's broken typeid() implementation which doesn't strip -// decoration. This fix doesn't handle cv-qualified array types. It -// could probably be done, but I haven't figured it out yet. -// - -// Note: This file is badly named. It initially was MSVC specific, but was -// extended to cover intel too. Now the old version of MSVC is no longer -// supported, but the intel version is still supported. - -# if defined(BOOST_INTEL_CXX_VERSION) && BOOST_INTEL_CXX_VERSION <= 700 - -namespace boost { namespace python { namespace detail { - -typedef std::type_info const& typeinfo; - -template <class T> -static typeinfo typeid_nonref(T const volatile*) { return typeid(T); } - -template <class T> -inline typeinfo typeid_ref_1(T&(*)()) -{ - return detail::typeid_nonref((T*)0); -} - -// A non-reference -template <class T> -inline typeinfo typeid_ref(type<T>*, T&(*)(type<T>)) -{ - return detail::typeid_nonref((T*)0); -} - -// A reference -template <class T> -inline typeinfo typeid_ref(type<T>*, ...) -{ - return detail::typeid_ref_1((T(*)())0); -} - -#if defined(BOOST_MSVC) || (defined(__BORLANDC__) && !defined(BOOST_DISABLE_WIN32)) -# define BOOST_PYTT_DECL __cdecl -#else -# define BOOST_PYTT_DECL /**/ -#endif - -template< typename T > T&(* is_ref_tester1(type<T>) )(type<T>) { return 0; } -inline char BOOST_PYTT_DECL is_ref_tester1(...) { return 0; } - -template <class T> -inline typeinfo msvc_typeid(boost::type<T>*) -{ - return detail::typeid_ref( - (boost::type<T>*)0, detail::is_ref_tester1(type<T>()) - ); -} - -template <> -inline typeinfo msvc_typeid<void>(boost::type<void>*) -{ - return typeid(void); -} - -# ifndef NDEBUG -inline typeinfo assert_array_typeid_compiles() -{ - return msvc_typeid((boost::type<char const[3]>*)0) - , msvc_typeid((boost::type<char[3]>*)0); -} -# endif - -}}} // namespace boost::python::detail - -# endif // BOOST_INTEL_CXX_VERSION -#endif // MSVC_TYPEINFO_DWA200222_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/detail/none.hpp b/contrib/restricted/boost/python/include/boost/python/detail/none.hpp deleted file mode 100644 index bc3337a234..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/detail/none.hpp +++ /dev/null @@ -1,20 +0,0 @@ -// (C) Copyright David Abrahams 2000. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// The author gratefully acknowleges the support of Dragon Systems, Inc., in -// producing this work. - -#ifndef NONE_DWA_052000_H_ -# define NONE_DWA_052000_H_ - -# include <boost/python/detail/prefix.hpp> - -namespace boost { namespace python { namespace detail { - -inline PyObject* none() { Py_INCREF(Py_None); return Py_None; } - -}}} // namespace boost::python::detail - -#endif // NONE_DWA_052000_H_ diff --git a/contrib/restricted/boost/python/include/boost/python/detail/not_specified.hpp b/contrib/restricted/boost/python/include/boost/python/detail/not_specified.hpp deleted file mode 100644 index 2f7c7ad997..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/detail/not_specified.hpp +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef NOT_SPECIFIED_DWA2002321_HPP -# define NOT_SPECIFIED_DWA2002321_HPP - -namespace boost { namespace python { namespace detail { - - struct not_specified {}; - -}}} // namespace boost::python::detail - -#endif // NOT_SPECIFIED_DWA2002321_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/detail/prefix.hpp b/contrib/restricted/boost/python/include/boost/python/detail/prefix.hpp deleted file mode 100644 index 8b34ed7701..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/detail/prefix.hpp +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright David Abrahams 2003. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef PREFIX_DWA2003531_HPP -# define PREFIX_DWA2003531_HPP - -// The rule is that <Python.h> must be included before any system -// headers (so it can get control over some awful macros). -// Unfortunately, Boost.Python needs to #include <limits.h> first, at -// least... but this gets us as close as possible. - -# include <boost/python/detail/wrap_python.hpp> -# include <boost/python/detail/config.hpp> - -#endif // PREFIX_DWA2003531_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/detail/preprocessor.hpp b/contrib/restricted/boost/python/include/boost/python/detail/preprocessor.hpp deleted file mode 100644 index 2c1b2e84ea..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/detail/preprocessor.hpp +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef PREPROCESSOR_DWA200247_HPP -# define PREPROCESSOR_DWA200247_HPP - -# include <boost/preprocessor/cat.hpp> -# include <boost/preprocessor/comma_if.hpp> -# include <boost/preprocessor/repeat.hpp> -# include <boost/preprocessor/tuple/elem.hpp> - -// stuff that should be in the preprocessor library - -# define BOOST_PYTHON_APPLY(x) BOOST_PP_CAT(BOOST_PYTHON_APPLY_, x) - -# define BOOST_PYTHON_APPLY_BOOST_PYTHON_ITEM(v) v -# define BOOST_PYTHON_APPLY_BOOST_PYTHON_NIL - -// cv-qualifiers - -# if !defined(__MWERKS__) || __MWERKS__ > 0x2407 -# define BOOST_PYTHON_CV_COUNT 4 -# else -# define BOOST_PYTHON_CV_COUNT 1 -# endif - -# ifndef BOOST_PYTHON_MAX_ARITY -# define BOOST_PYTHON_MAX_ARITY 15 -# endif - -# ifndef BOOST_PYTHON_MAX_BASES -# define BOOST_PYTHON_MAX_BASES 10 -# endif - -# define BOOST_PYTHON_CV_QUALIFIER(i) \ - BOOST_PYTHON_APPLY( \ - BOOST_PP_TUPLE_ELEM(4, i, BOOST_PYTHON_CV_QUALIFIER_I) \ - ) - -# define BOOST_PYTHON_CV_QUALIFIER_I \ - ( \ - BOOST_PYTHON_NIL, \ - BOOST_PYTHON_ITEM(const), \ - BOOST_PYTHON_ITEM(volatile), \ - BOOST_PYTHON_ITEM(const volatile) \ - ) - -// enumerators -# define BOOST_PYTHON_UNARY_ENUM(c, text) BOOST_PP_REPEAT(c, BOOST_PYTHON_UNARY_ENUM_I, text) -# define BOOST_PYTHON_UNARY_ENUM_I(z, n, text) BOOST_PP_COMMA_IF(n) text ## n - -# define BOOST_PYTHON_BINARY_ENUM(c, a, b) BOOST_PP_REPEAT(c, BOOST_PYTHON_BINARY_ENUM_I, (a, b)) -# define BOOST_PYTHON_BINARY_ENUM_I(z, n, _) BOOST_PP_COMMA_IF(n) BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM(2, 0, _), n) BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM(2, 1, _), n) - -# define BOOST_PYTHON_ENUM_WITH_DEFAULT(c, text, def) BOOST_PP_REPEAT(c, BOOST_PYTHON_ENUM_WITH_DEFAULT_I, (text, def)) -# define BOOST_PYTHON_ENUM_WITH_DEFAULT_I(z, n, _) BOOST_PP_COMMA_IF(n) BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM(2, 0, _), n) = BOOST_PP_TUPLE_ELEM(2, 1, _) - -// fixed text (no commas) -# define BOOST_PYTHON_FIXED(z, n, text) text - -// flags -# define BOOST_PYTHON_FUNCTION_POINTER 0x0001 -# define BOOST_PYTHON_POINTER_TO_MEMBER 0x0002 - -#endif // PREPROCESSOR_DWA200247_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/detail/python22_fixed.h b/contrib/restricted/boost/python/include/boost/python/detail/python22_fixed.h deleted file mode 100644 index 32bf941fef..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/detail/python22_fixed.h +++ /dev/null @@ -1,152 +0,0 @@ -// This file is a modified version of Python 2.2/2.2.1 Python.h. As -// such it is: -// -// Copyright (c) 2001, 2002 Python Software Foundation; All Rights -// Reserved -// -// boostinspect:nolicense (don't complain about the lack of a Boost license) -// -// Changes from the original: -// 1. #includes <unistd.h> for Python 2.2.1 -// 2. Provides missing extern "C" wrapper for "iterobject.h" and "descrobject.h". -// - -// Changes marked with "Boost.Python modification" -#ifndef Py_PYTHON_H -#define Py_PYTHON_H -/* Since this is a "meta-include" file, no #ifdef __cplusplus / extern "C" { */ - - -/* Enable compiler features; switching on C lib defines doesn't work - here, because the symbols haven't necessarily been defined yet. */ -#ifndef _GNU_SOURCE -# define _GNU_SOURCE 1 -#endif - -/* Forcing SUSv2 compatibility still produces problems on some - platforms, True64 and SGI IRIX begin two of them, so for now the - define is switched off. */ -#if 0 -#ifndef _XOPEN_SOURCE -# define _XOPEN_SOURCE 500 -#endif -#endif - -/* Include nearly all Python header files */ - -#include "patchlevel.h" -#include "pyconfig.h" - -#ifdef HAVE_LIMITS_H -#include <limits.h> -#endif - -/* pyconfig.h may or may not define DL_IMPORT */ -#ifndef DL_IMPORT /* declarations for DLL import/export */ -#define DL_IMPORT(RTYPE) RTYPE -#endif -#ifndef DL_EXPORT /* declarations for DLL import/export */ -#define DL_EXPORT(RTYPE) RTYPE -#endif - -#if defined(__sgi) && defined(WITH_THREAD) && !defined(_SGI_MP_SOURCE) -#define _SGI_MP_SOURCE -#endif - -#include <stdio.h> -#ifndef NULL -# error "Python.h requires that stdio.h define NULL." -#endif - -#include <string.h> -#include <errno.h> -#ifdef HAVE_STDLIB_H -#include <stdlib.h> -#endif -#if PY_MICRO_VERSION == 1 // Boost.Python modification: emulate Python 2.2 -#ifdef HAVE_UNISTD_H -#include <unistd.h> -#endif -#endif // Boost.Python modification: emulate Python 2.2 - -/* CAUTION: Build setups should ensure that NDEBUG is defined on the - * compiler command line when building Python in release mode; else - * assert() calls won't be removed. - */ -#include <assert.h> - -#include "pyport.h" - -#include "pymem.h" - -#include "object.h" -#include "objimpl.h" - -#include "pydebug.h" - -#include "unicodeobject.h" -#include "intobject.h" -#include "longobject.h" -#include "floatobject.h" -#ifndef WITHOUT_COMPLEX -#include "complexobject.h" -#endif -#include "rangeobject.h" -#include "stringobject.h" -#include "bufferobject.h" -#include "tupleobject.h" -#include "listobject.h" -#include "dictobject.h" -#include "methodobject.h" -#include "moduleobject.h" -#include "funcobject.h" -#include "classobject.h" -#include "fileobject.h" -#include "cobject.h" -#include "traceback.h" -#include "sliceobject.h" -#include "cellobject.h" -extern "C" { // Boost.Python modification: provide missing extern "C" -#include "iterobject.h" -#include "descrobject.h" -} // Boost.Python modification: provide missing extern "C" -#include "weakrefobject.h" - -#include "codecs.h" -#include "pyerrors.h" - -#include "pystate.h" - -#include "modsupport.h" -#include "pythonrun.h" -#include "ceval.h" -#include "sysmodule.h" -#include "intrcheck.h" -#include "import.h" - -#include "abstract.h" - -#define PyArg_GetInt(v, a) PyArg_Parse((v), "i", (a)) -#define PyArg_NoArgs(v) PyArg_Parse(v, "") - -/* Convert a possibly signed character to a nonnegative int */ -/* XXX This assumes characters are 8 bits wide */ -#ifdef __CHAR_UNSIGNED__ -#define Py_CHARMASK(c) (c) -#else -#define Py_CHARMASK(c) ((c) & 0xff) -#endif - -#include "pyfpe.h" - -/* These definitions must match corresponding definitions in graminit.h. - There's code in compile.c that checks that they are the same. */ -#define Py_single_input 256 -#define Py_file_input 257 -#define Py_eval_input 258 - -#ifdef HAVE_PTH -/* GNU pth user-space thread support */ -#include <pth.h> -#endif -#endif /* !Py_PYTHON_H */ diff --git a/contrib/restricted/boost/python/include/boost/python/detail/raw_pyobject.hpp b/contrib/restricted/boost/python/include/boost/python/detail/raw_pyobject.hpp deleted file mode 100644 index 194409eda4..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/detail/raw_pyobject.hpp +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef RAW_PYOBJECT_DWA2002628_HPP -# define RAW_PYOBJECT_DWA2002628_HPP - -namespace boost { namespace python { namespace detail { - -// -// Define some types which we can use to get around the vagaries of -// PyObject*. We will use these to initialize object instances, and -// keep them in namespace detail to make sure they stay out of the -// hands of users. That is much simpler than trying to grant -// friendship to all the appropriate parties. -// - -// New references are normally checked for null -struct new_reference_t; -typedef new_reference_t* new_reference; - -// Borrowed references are assumed to be non-null -struct borrowed_reference_t; -typedef borrowed_reference_t* borrowed_reference; - -// New references which aren't checked for null -struct new_non_null_reference_t; -typedef new_non_null_reference_t* new_non_null_reference; - -}}} // namespace boost::python::detail - -#endif // RAW_PYOBJECT_DWA2002628_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/detail/referent_storage.hpp b/contrib/restricted/boost/python/include/boost/python/detail/referent_storage.hpp deleted file mode 100644 index f646d2ae1d..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/detail/referent_storage.hpp +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef REFERENT_STORAGE_DWA200278_HPP -# define REFERENT_STORAGE_DWA200278_HPP -# include <boost/mpl/if.hpp> -# include <boost/type_traits/aligned_storage.hpp> -# include <cstddef> - -namespace boost { namespace python { namespace detail { - -template <std::size_t size, std::size_t alignment = std::size_t(-1)> -struct aligned_storage -{ - union type - { - typename ::boost::aligned_storage<size, alignment>::type data; - char bytes[size]; - }; -}; - - // Compute the size of T's referent. We wouldn't need this at all, - // but sizeof() is broken in CodeWarriors <= 8.0 - template <class T> struct referent_size; - - - template <class T> - struct referent_size<T&> - { - BOOST_STATIC_CONSTANT( - std::size_t, value = sizeof(T)); - }; - -// A metafunction returning a POD type which can store U, where T == -// U&. If T is not a reference type, returns a POD which can store T. -template <class T> -struct referent_storage -{ - typedef typename aligned_storage<referent_size<T>::value, alignment_of<T>::value>::type type; -}; - -}}} // namespace boost::python::detail - -#endif // REFERENT_STORAGE_DWA200278_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/detail/sfinae.hpp b/contrib/restricted/boost/python/include/boost/python/detail/sfinae.hpp deleted file mode 100644 index 6281875111..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/detail/sfinae.hpp +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright David Abrahams 2004. Distributed under the Boost -// Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -#ifndef SFINAE_DWA2004723_HPP -# define SFINAE_DWA2004723_HPP - -# include <boost/python/detail/prefix.hpp> - -# if defined(BOOST_NO_SFINAE) && !defined(BOOST_MSVC) -# define BOOST_PYTHON_NO_SFINAE -# endif - -#endif // SFINAE_DWA2004723_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/detail/signature.hpp b/contrib/restricted/boost/python/include/boost/python/detail/signature.hpp deleted file mode 100644 index 11268b92cf..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/detail/signature.hpp +++ /dev/null @@ -1,106 +0,0 @@ -#if !defined(BOOST_PP_IS_ITERATING) - -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -# ifndef SIGNATURE_DWA20021121_HPP -# define SIGNATURE_DWA20021121_HPP - -# include <boost/python/type_id.hpp> - -# include <boost/python/detail/preprocessor.hpp> -# include <boost/python/detail/indirect_traits.hpp> -# include <boost/python/converter/pytype_function.hpp> - -# include <boost/preprocessor/iterate.hpp> -# include <boost/preprocessor/iteration/local.hpp> - -# include <boost/mpl/at.hpp> -# include <boost/mpl/size.hpp> - -namespace boost { namespace python { namespace detail { - -struct signature_element -{ - char const* basename; - converter::pytype_function pytype_f; - bool lvalue; -}; - -struct py_func_sig_info -{ - signature_element const *signature; - signature_element const *ret; -}; - -template <unsigned> struct signature_arity; - -# define BOOST_PP_ITERATION_PARAMS_1 \ - (3, (0, BOOST_PYTHON_MAX_ARITY + 1, <boost/python/detail/signature.hpp>)) -# include BOOST_PP_ITERATE() - -// A metafunction returning the base class used for -// -// signature<class F, class CallPolicies, class Sig>. -// -template <class Sig> -struct signature_base_select -{ - enum { arity = mpl::size<Sig>::value - 1 }; - typedef typename signature_arity<arity>::template impl<Sig> type; -}; - -template <class Sig> -struct signature - : signature_base_select<Sig>::type -{ -}; - -}}} // namespace boost::python::detail - -# endif // SIGNATURE_DWA20021121_HPP - -#else - -# define N BOOST_PP_ITERATION() - -template <> -struct signature_arity<N> -{ - template <class Sig> - struct impl - { - static signature_element const* elements() - { - static signature_element const result[N+2] = { - -#ifndef BOOST_PYTHON_NO_PY_SIGNATURES -# define BOOST_PP_LOCAL_MACRO(i) \ - { \ - type_id<BOOST_DEDUCED_TYPENAME mpl::at_c<Sig,i>::type>().name() \ - , &converter::expected_pytype_for_arg<BOOST_DEDUCED_TYPENAME mpl::at_c<Sig,i>::type>::get_pytype \ - , indirect_traits::is_reference_to_non_const<BOOST_DEDUCED_TYPENAME mpl::at_c<Sig,i>::type>::value \ - }, -#else -# define BOOST_PP_LOCAL_MACRO(i) \ - { \ - type_id<BOOST_DEDUCED_TYPENAME mpl::at_c<Sig,i>::type>().name() \ - , 0 \ - , indirect_traits::is_reference_to_non_const<BOOST_DEDUCED_TYPENAME mpl::at_c<Sig,i>::type>::value \ - }, -#endif - -# define BOOST_PP_LOCAL_LIMITS (0, N) -# include BOOST_PP_LOCAL_ITERATE() - {0,0,0} - }; - return result; - } - }; -}; - -#endif // BOOST_PP_IS_ITERATING - - diff --git a/contrib/restricted/boost/python/include/boost/python/detail/string_literal.hpp b/contrib/restricted/boost/python/include/boost/python/detail/string_literal.hpp deleted file mode 100644 index 0961ec7c4e..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/detail/string_literal.hpp +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef STRING_LITERAL_DWA2002629_HPP -# define STRING_LITERAL_DWA2002629_HPP - -# include <cstddef> -# include <boost/type.hpp> -# include <boost/python/detail/type_traits.hpp> -# include <boost/mpl/bool.hpp> -# include <boost/detail/workaround.hpp> - -namespace boost { namespace python { namespace detail { - -template <class T> -struct is_string_literal : mpl::false_ -{ -}; - -# if !defined(__MWERKS__) || __MWERKS__ > 0x2407 -template <std::size_t n> -struct is_string_literal<char const[n]> : mpl::true_ -{ -}; - -# if BOOST_WORKAROUND(__DECCXX_VER, BOOST_TESTED_AT(60590040)) \ - || (defined(__sgi) && defined(_COMPILER_VERSION) && _COMPILER_VERSION <= 730) -// This compiler mistakenly gets the type of string literals as char* -// instead of char[NN]. -template <> -struct is_string_literal<char* const> : mpl::true_ -{ -}; -# endif - -# else - -// CWPro7 has trouble with the array type deduction above -template <class T, std::size_t n> -struct is_string_literal<T[n]> - : is_same<T, char const> -{ -}; -# endif - -}}} // namespace boost::python::detail - -#endif // STRING_LITERAL_DWA2002629_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/detail/type_list.hpp b/contrib/restricted/boost/python/include/boost/python/detail/type_list.hpp deleted file mode 100644 index 0ad3f63d84..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/detail/type_list.hpp +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef TYPE_LIST_DWA2002913_HPP -# define TYPE_LIST_DWA2002913_HPP - -# include <boost/config.hpp> -# include <boost/python/detail/preprocessor.hpp> -# include <boost/preprocessor/arithmetic/inc.hpp> - -# if BOOST_PYTHON_MAX_ARITY + 2 > BOOST_PYTHON_MAX_BASES -# define BOOST_PYTHON_LIST_SIZE BOOST_PP_INC(BOOST_PP_INC(BOOST_PYTHON_MAX_ARITY)) -# else -# define BOOST_PYTHON_LIST_SIZE BOOST_PYTHON_MAX_BASES -# endif - -// Compute the MPL vector header to use for lists up to BOOST_PYTHON_LIST_SIZE in length -# if BOOST_PYTHON_LIST_SIZE > 48 -# error Arities above 48 not supported by Boost.Python due to MPL internal limit -# elif BOOST_PYTHON_LIST_SIZE > 38 -# include <boost/mpl/vector/vector50.hpp> -# elif BOOST_PYTHON_LIST_SIZE > 28 -# include <boost/mpl/vector/vector40.hpp> -# elif BOOST_PYTHON_LIST_SIZE > 18 -# include <boost/mpl/vector/vector30.hpp> -# elif BOOST_PYTHON_LIST_SIZE > 8 -# include <boost/mpl/vector/vector20.hpp> -# else -# include <boost/mpl/vector/vector10.hpp> -# endif - -# include <boost/python/detail/type_list_impl.hpp> - -#endif // TYPE_LIST_DWA2002913_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/detail/type_list_impl.hpp b/contrib/restricted/boost/python/include/boost/python/detail/type_list_impl.hpp deleted file mode 100644 index fdcfa85030..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/detail/type_list_impl.hpp +++ /dev/null @@ -1,57 +0,0 @@ -#ifndef BOOST_PP_IS_ITERATING -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -# ifndef TYPE_LIST_IMPL_DWA2002913_HPP -# define TYPE_LIST_IMPL_DWA2002913_HPP - -# include <boost/python/detail/type_list.hpp> - -# include <boost/preprocessor/enum_params.hpp> -# include <boost/preprocessor/enum_params_with_a_default.hpp> -# include <boost/preprocessor/repetition/enum.hpp> -# include <boost/preprocessor/comma_if.hpp> -# include <boost/preprocessor/arithmetic/sub.hpp> -# include <boost/preprocessor/iterate.hpp> -# include <boost/preprocessor/repetition/enum_trailing.hpp> - -namespace boost { namespace python { namespace detail { - -template <BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(BOOST_PYTHON_LIST_SIZE, class T, mpl::void_)> -struct type_list - : BOOST_PP_CAT(mpl::vector,BOOST_PYTHON_LIST_SIZE)<BOOST_PP_ENUM_PARAMS_Z(1, BOOST_PYTHON_LIST_SIZE, T)> -{ -}; - -# define BOOST_PP_ITERATION_PARAMS_1 \ - (3, (0, BOOST_PP_DEC(BOOST_PYTHON_LIST_SIZE), <boost/python/detail/type_list_impl.hpp>)) -# include BOOST_PP_ITERATE() - - -}}} // namespace boost::python::detail - -# endif // TYPE_LIST_IMPL_DWA2002913_HPP - -#else // BOOST_PP_IS_ITERATING - -# define N BOOST_PP_ITERATION() -# define BOOST_PYTHON_VOID_ARGS BOOST_PP_SUB_D(1,BOOST_PYTHON_LIST_SIZE,N) - -template < - BOOST_PP_ENUM_PARAMS_Z(1, N, class T) - > -struct type_list< - BOOST_PP_ENUM_PARAMS_Z(1, N, T) - BOOST_PP_COMMA_IF(N) - BOOST_PP_ENUM( - BOOST_PYTHON_VOID_ARGS, BOOST_PYTHON_FIXED, mpl::void_) - > - : BOOST_PP_CAT(mpl::vector,N)<BOOST_PP_ENUM_PARAMS_Z(1, N, T)> -{ -}; - -# undef BOOST_PYTHON_VOID_ARGS -# undef N - -#endif // BOOST_PP_IS_ITERATING diff --git a/contrib/restricted/boost/python/include/boost/python/detail/type_traits.hpp b/contrib/restricted/boost/python/include/boost/python/detail/type_traits.hpp deleted file mode 100644 index fda54c80f2..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/detail/type_traits.hpp +++ /dev/null @@ -1,111 +0,0 @@ -// Copyright Shreyans Doshi 2017. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_PYTHON_DETAIL_TYPE_TRAITS_HPP -# define BOOST_PYTHON_DETAIL_TYPE_TRAITS_HPP - - -#include <boost/config.hpp> -#ifdef BOOST_NO_CXX11_HDR_TYPE_TRAITS -# include <boost/type_traits/transform_traits.hpp> -# include <boost/type_traits/same_traits.hpp> -# include <boost/type_traits/cv_traits.hpp> -# include <boost/type_traits/is_polymorphic.hpp> -# include <boost/type_traits/composite_traits.hpp> -# include <boost/type_traits/conversion_traits.hpp> -# include <boost/type_traits/add_pointer.hpp> -# include <boost/type_traits/remove_pointer.hpp> -# include <boost/type_traits/is_void.hpp> -# include <boost/type_traits/object_traits.hpp> -# include <boost/type_traits/add_lvalue_reference.hpp> -# include <boost/type_traits/function_traits.hpp> -# include <boost/type_traits/is_scalar.hpp> -# include <boost/type_traits/alignment_traits.hpp> -# include <boost/mpl/bool.hpp> -#else -# include <type_traits> -#endif - -# include <boost/type_traits/is_base_and_derived.hpp> -# include <boost/type_traits/alignment_traits.hpp> -# include <boost/type_traits/has_trivial_copy.hpp> - - -namespace boost { namespace python { namespace detail { - -#ifdef BOOST_NO_CXX11_HDR_TYPE_TRAITS - using boost::alignment_of; - using boost::add_const; - using boost::add_cv; - using boost::add_lvalue_reference; - using boost::add_pointer; - - using boost::is_array; - using boost::is_class; - using boost::is_const; - using boost::is_convertible; - using boost::is_enum; - using boost::is_function; - using boost::is_integral; - using boost::is_lvalue_reference; - using boost::is_member_function_pointer; - using boost::is_member_pointer; - using boost::is_pointer; - using boost::is_polymorphic; - using boost::is_reference; - using boost::is_same; - using boost::is_scalar; - using boost::is_union; - using boost::is_void; - using boost::is_volatile; - - using boost::remove_reference; - using boost::remove_pointer; - using boost::remove_cv; - using boost::remove_const; - - using boost::mpl::true_; - using boost::mpl::false_; -#else - using std::alignment_of; - using std::add_const; - using std::add_cv; - using std::add_lvalue_reference; - using std::add_pointer; - - using std::is_array; - using std::is_class; - using std::is_const; - using std::is_convertible; - using std::is_enum; - using std::is_function; - using std::is_integral; - using std::is_lvalue_reference; - using std::is_member_function_pointer; - using std::is_member_pointer; - using std::is_pointer; - using std::is_polymorphic; - using std::is_reference; - using std::is_same; - using std::is_scalar; - using std::is_union; - using std::is_void; - using std::is_volatile; - - using std::remove_reference; - using std::remove_pointer; - using std::remove_cv; - using std::remove_const; - - typedef std::integral_constant<bool, true> true_; - typedef std::integral_constant<bool, false> false_; -#endif - using boost::is_base_and_derived; - using boost::type_with_alignment; - using boost::has_trivial_copy; -}}} // namespace boost::python::detail - - -#endif //BOOST_DETAIL_TYPE_TRAITS_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/detail/unwind_type.hpp b/contrib/restricted/boost/python/include/boost/python/detail/unwind_type.hpp deleted file mode 100644 index b81bf7c898..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/detail/unwind_type.hpp +++ /dev/null @@ -1,172 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef UNWIND_TYPE_DWA200222_HPP -# define UNWIND_TYPE_DWA200222_HPP - -# include <boost/python/detail/cv_category.hpp> -# include <boost/python/detail/indirect_traits.hpp> -# include <boost/python/detail/type_traits.hpp> - -namespace boost { namespace python { namespace detail { - -#if (!defined(_MSC_VER) || _MSC_VER >= 1915) -// If forward declared, msvc6.5 does not recognize them as inline. -// However, as of msvc14.15 (_MSC_VER 1915/Visual Studio 15.8.0) name lookup is now consistent with other compilers. -// forward declaration, required (at least) by Tru64 cxx V6.5-042 and msvc14.15 -template <class Generator, class U> -inline typename Generator::result_type -unwind_type(U const& p, Generator* = 0); - -// forward declaration, required (at least) by Tru64 cxx V6.5-042 and msvc14.15 -template <class Generator, class U> -inline typename Generator::result_type -unwind_type(boost::type<U>*p = 0, Generator* = 0); -#endif - -template <class Generator, class U> -inline typename Generator::result_type -unwind_type_cv(U* p, cv_unqualified, Generator* = 0) -{ - return Generator::execute(p); -} - -template <class Generator, class U> -inline typename Generator::result_type -unwind_type_cv(U const* p, const_, Generator* = 0) -{ - return unwind_type(const_cast<U*>(p), (Generator*)0); -} - -template <class Generator, class U> -inline typename Generator::result_type -unwind_type_cv(U volatile* p, volatile_, Generator* = 0) -{ - return unwind_type(const_cast<U*>(p), (Generator*)0); -} - -template <class Generator, class U> -inline typename Generator::result_type -unwind_type_cv(U const volatile* p, const_volatile_, Generator* = 0) -{ - return unwind_type(const_cast<U*>(p), (Generator*)0); -} - -template <class Generator, class U> -inline typename Generator::result_type -unwind_ptr_type(U* p, Generator* = 0) -{ - typedef typename cv_category<U>::type tag; - return unwind_type_cv<Generator>(p, tag()); -} - -template <bool is_ptr> -struct unwind_helper -{ - template <class Generator, class U> - static typename Generator::result_type - execute(U p, Generator* = 0) - { - return unwind_ptr_type(p, (Generator*)0); - } -}; - -template <> -struct unwind_helper<false> -{ - template <class Generator, class U> - static typename Generator::result_type - execute(U& p, Generator* = 0) - { - return unwind_ptr_type(&p, (Generator*)0); - } -}; - -template <class Generator, class U> -inline typename Generator::result_type -#if (!defined(_MSC_VER) || _MSC_VER >= 1915) -unwind_type(U const& p, Generator*) -#else -unwind_type(U const& p, Generator* = 0) -#endif -{ - return unwind_helper<is_pointer<U>::value>::execute(p, (Generator*)0); -} - -enum { direct_ = 0, pointer_ = 1, reference_ = 2, reference_to_pointer_ = 3 }; -template <int indirection> struct unwind_helper2; - -template <> -struct unwind_helper2<direct_> -{ - template <class Generator, class U> - static typename Generator::result_type - execute(U(*)(), Generator* = 0) - { - return unwind_ptr_type((U*)0, (Generator*)0); - } -}; - -template <> -struct unwind_helper2<pointer_> -{ - template <class Generator, class U> - static typename Generator::result_type - execute(U*(*)(), Generator* = 0) - { - return unwind_ptr_type((U*)0, (Generator*)0); - } -}; - -template <> -struct unwind_helper2<reference_> -{ - template <class Generator, class U> - static typename Generator::result_type - execute(U&(*)(), Generator* = 0) - { - return unwind_ptr_type((U*)0, (Generator*)0); - } -}; - -template <> -struct unwind_helper2<reference_to_pointer_> -{ - template <class Generator, class U> - static typename Generator::result_type - execute(U&(*)(), Generator* = 0) - { - return unwind_ptr_type(U(0), (Generator*)0); - } -}; - -// Call this one with both template parameters explicitly specified -// and no function arguments: -// -// return unwind_type<my_generator,T>(); -// -// Doesn't work if T is an array type; we could handle that case, but -// why bother? -template <class Generator, class U> -inline typename Generator::result_type -#if (!defined(_MSC_VER) || _MSC_VER >= 1915) -unwind_type(boost::type<U>*, Generator*) -#else -unwind_type(boost::type<U>*p =0, Generator* =0) -#endif -{ - BOOST_STATIC_CONSTANT(int, indirection - = (is_pointer<U>::value ? pointer_ : 0) - + (indirect_traits::is_reference_to_pointer<U>::value - ? reference_to_pointer_ - : is_lvalue_reference<U>::value - ? reference_ - : 0)); - - return unwind_helper2<indirection>::execute((U(*)())0,(Generator*)0); -} - -}}} // namespace boost::python::detail - -#endif // UNWIND_TYPE_DWA200222_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/detail/value_arg.hpp b/contrib/restricted/boost/python/include/boost/python/detail/value_arg.hpp deleted file mode 100644 index 2c938dacca..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/detail/value_arg.hpp +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright David Abrahams 2004. Distributed under the Boost -// Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -#ifndef VALUE_ARG_DWA2004312_HPP -# define VALUE_ARG_DWA2004312_HPP - -# include <boost/python/detail/copy_ctor_mutates_rhs.hpp> -# include <boost/mpl/if.hpp> -# include <boost/python/detail/indirect_traits.hpp> - -namespace boost { namespace python { namespace detail { - -template <class T> -struct value_arg - : mpl::if_< - copy_ctor_mutates_rhs<T> - , T - , typename add_lvalue_reference< - typename add_const<T>::type - >::type - > -{}; - -}}} // namespace boost::python::detail - -#endif // VALUE_ARG_DWA2004312_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/detail/value_is_shared_ptr.hpp b/contrib/restricted/boost/python/include/boost/python/detail/value_is_shared_ptr.hpp deleted file mode 100644 index 53e687f016..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/detail/value_is_shared_ptr.hpp +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright David Abrahams 2003. -// Copyright Stefan Seefeld 2016. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef boost_python_detail_value_is_shared_ptr_hpp_ -#define boost_python_detail_value_is_shared_ptr_hpp_ - -#include <boost/python/detail/value_is_xxx.hpp> -#include <boost/python/detail/is_shared_ptr.hpp> - -namespace boost { namespace python { namespace detail { - -template <class X_> -struct value_is_shared_ptr -{ - static bool const value = is_shared_ptr<typename remove_cv< - typename remove_reference<X_> - ::type> - ::type> - ::value; - typedef mpl::bool_<value> type; -}; - -}}} // namespace boost::python::detail - -#endif // VALUE_IS_SHARED_PTR_DWA2003224_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/detail/value_is_xxx.hpp b/contrib/restricted/boost/python/include/boost/python/detail/value_is_xxx.hpp deleted file mode 100644 index e270f89ca3..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/detail/value_is_xxx.hpp +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright David Abrahams 2003. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef VALUE_IS_XXX_DWA2003224_HPP -# define VALUE_IS_XXX_DWA2003224_HPP - -# include <boost/config.hpp> -# include <boost/mpl/bool.hpp> -# include <boost/preprocessor/enum_params.hpp> - -# include <boost/python/detail/type_traits.hpp> -# include <boost/python/detail/is_xxx.hpp> - -namespace boost { namespace python { namespace detail { - -# define BOOST_PYTHON_VALUE_IS_XXX_DEF(name, qualified_name, nargs) \ -template <class X_> \ -struct value_is_##name \ -{ \ - BOOST_PYTHON_IS_XXX_DEF(name,qualified_name,nargs) \ - BOOST_STATIC_CONSTANT(bool, value = is_##name< \ - typename remove_cv< \ - typename remove_reference<X_>::type \ - >::type \ - >::value); \ - typedef mpl::bool_<value> type; \ - \ -}; - -}}} // namespace boost::python::detail - -#endif // VALUE_IS_XXX_DWA2003224_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/detail/void_ptr.hpp b/contrib/restricted/boost/python/include/boost/python/detail/void_ptr.hpp deleted file mode 100644 index 5543b23a4a..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/detail/void_ptr.hpp +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef VOID_PTR_DWA200239_HPP -# define VOID_PTR_DWA200239_HPP - -# include <boost/python/detail/type_traits.hpp> - -namespace boost { namespace python { namespace detail { - -template <class U> -inline U& void_ptr_to_reference(void const volatile* p, U&(*)()) -{ - return *(U*)p; -} - -template <class T> -inline void write_void_ptr(void const volatile* storage, void* ptr, T*) -{ - *(T**)storage = (T*)ptr; -} - -// writes U(ptr) into the storage -template <class U> -inline void write_void_ptr_reference(void const volatile* storage, void* ptr, U&(*)()) -{ - // stripping CV qualification suppresses warnings on older EDGs - typedef typename remove_cv<U>::type u_stripped; - write_void_ptr(storage, ptr, u_stripped(0)); -} - -}}} // namespace boost::python::detail - -#endif // VOID_PTR_DWA200239_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/detail/void_return.hpp b/contrib/restricted/boost/python/include/boost/python/detail/void_return.hpp deleted file mode 100644 index 30db825177..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/detail/void_return.hpp +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef VOID_RETURN_DWA200274_HPP -# define VOID_RETURN_DWA200274_HPP - -# include <boost/config.hpp> - -namespace boost { namespace python { namespace detail { - -struct void_return -{ - void_return() {} - private: - void operator=(void_return const&); -}; - -template <class T> -struct returnable -{ - typedef T type; -}; - -# ifdef BOOST_NO_VOID_RETURNS -template <> -struct returnable<void> -{ - typedef void_return type; -}; - -# ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS -template <> struct returnable<const void> : returnable<void> {}; -template <> struct returnable<volatile void> : returnable<void> {}; -template <> struct returnable<const volatile void> : returnable<void> {}; -# endif - -# endif // BOOST_NO_VOID_RETURNS - -}}} // namespace boost::python::detail - -#endif // VOID_RETURN_DWA200274_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/detail/wrap_python.hpp b/contrib/restricted/boost/python/include/boost/python/detail/wrap_python.hpp deleted file mode 100644 index 037e4bf2ec..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/detail/wrap_python.hpp +++ /dev/null @@ -1,252 +0,0 @@ -// (C) Copyright David Abrahams 2000. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// The author gratefully acknowleges the support of Dragon Systems, Inc., in -// producing this work. - -// This file serves as a wrapper around <Python.h> which allows it to be -// compiled with GCC 2.95.2 under Win32 and which disables the default MSVC -// behavior so that a program may be compiled in debug mode without requiring a -// special debugging build of the Python library. - - -// To use the Python debugging library, #define BOOST_DEBUG_PYTHON on the -// compiler command-line. - -// Revision History: -// 05 Mar 01 Suppress warnings under Cygwin with Python 2.0 (Dave Abrahams) -// 04 Mar 01 Rolled in some changes from the Dragon fork (Dave Abrahams) -// 01 Mar 01 define PyObject_INIT() for Python 1.x (Dave Abrahams) - -#ifdef _DEBUG -# ifndef BOOST_DEBUG_PYTHON -# ifdef _MSC_VER - // VC8.0 will complain if system headers are #included both with - // and without _DEBUG defined, so we have to #include all the - // system headers used by pyconfig.h right here. -# include <stddef.h> -# include <stdarg.h> -# include <stdio.h> -# include <stdlib.h> -# include <assert.h> -# include <errno.h> -# include <ctype.h> -# include <wchar.h> -# include <basetsd.h> -# include <io.h> -# include <limits.h> -# include <float.h> -# include <string.h> -# include <math.h> -# include <time.h> -# endif -# undef _DEBUG // Don't let Python force the debug library just because we're debugging. -# define DEBUG_UNDEFINED_FROM_WRAP_PYTHON_H -# endif -#endif - -// pyconfig.h defines a macro with hypot name, what breaks libstdc++ math headers -// that Python.h tries to include afterwards. -#if defined(__MINGW32__) -# include <cmath> -# include <math.h> -#endif - -# include <pyconfig.h> -# if defined(_SGI_COMPILER_VERSION) && _SGI_COMPILER_VERSION >= 740 -# undef _POSIX_C_SOURCE -# undef _XOPEN_SOURCE -# undef HAVE_STDINT_H // undo Python 2.5.1 define -# endif - -// -// Python's LongObject.h helpfully #defines ULONGLONG_MAX for us, -// which confuses Boost's config -// -#include <limits.h> -#ifndef ULONG_MAX -# define BOOST_PYTHON_ULONG_MAX_UNDEFINED -#endif -#ifndef LONGLONG_MAX -# define BOOST_PYTHON_LONGLONG_MAX_UNDEFINED -#endif -#ifndef ULONGLONG_MAX -# define BOOST_PYTHON_ULONGLONG_MAX_UNDEFINED -#endif - -// -// Get ahold of Python's version number -// -#include <patchlevel.h> - -#if PY_MAJOR_VERSION<2 || PY_MAJOR_VERSION==2 && PY_MINOR_VERSION<2 -#error Python 2.2 or higher is required for this version of Boost.Python. -#endif - -// -// Some things we need in order to get Python.h to work with compilers other -// than MSVC on Win32 -// -#if defined(_WIN32) || defined(__CYGWIN__) - -# if defined(__GNUC__) && defined(__CYGWIN__) - -# if defined(__LP64__) -# define SIZEOF_LONG 8 -# else -# define SIZEOF_LONG 4 -# endif - - -# if PY_MAJOR_VERSION < 2 || PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION <= 2 - -typedef int pid_t; - -# if defined(__LP64__) -# define WORD_BIT 64 -# else -# define WORD_BIT 32 -# endif -# define hypot _hypot -# include <stdio.h> - -# if PY_MAJOR_VERSION < 2 -# define HAVE_CLOCK -# define HAVE_STRFTIME -# define HAVE_STRERROR -# endif - -# define NT_THREADS - -# ifndef NETSCAPE_PI -# define USE_SOCKET -# endif - -# ifdef USE_DL_IMPORT -# define DL_IMPORT(RTYPE) __declspec(dllimport) RTYPE -# endif - -# ifdef USE_DL_EXPORT -# define DL_IMPORT(RTYPE) __declspec(dllexport) RTYPE -# define DL_EXPORT(RTYPE) __declspec(dllexport) RTYPE -# endif - -# define HAVE_LONG_LONG 1 -# define LONG_LONG long long -# endif - -# elif defined(__MWERKS__) - -# ifndef _MSC_VER -# define PY_MSC_VER_DEFINED_FROM_WRAP_PYTHON_H 1 -# define _MSC_VER 900 -# endif - -# undef hypot // undo the evil #define left by Python. - -# elif defined(__BORLANDC__) && !defined(__clang__) -# undef HAVE_HYPOT -# define HAVE_HYPOT 1 -# endif - -#endif // _WIN32 - -#if defined(__GNUC__) -# if defined(__has_warning) -# define BOOST_PYTHON_GCC_HAS_WREGISTER __has_warning("-Wregister") -# else -# define BOOST_PYTHON_GCC_HAS_WREGISTER __GNUC__ >= 7 -# endif -#else -# define BOOST_PYTHON_GCC_HAS_WREGISTER 0 -#endif - -// Python.h header uses `register` keyword until Python 3.4 -#if BOOST_PYTHON_GCC_HAS_WREGISTER -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wregister" -#elif defined(_MSC_VER) -# pragma warning(push) -# pragma warning(disable : 5033) // 'register' is no longer a supported storage class -#endif - -#if PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION == 2 && PY_MICRO_VERSION < 2 -# include <boost/python/detail/python22_fixed.h> -#else -# include <Python.h> -#endif - -#if BOOST_PYTHON_GCC_HAS_WREGISTER -# pragma GCC diagnostic pop -#elif defined(_MSC_VER) -# pragma warning(pop) -#endif -#undef BOOST_PYTHON_GCC_HAS_WREGISTER - -#ifdef BOOST_PYTHON_ULONG_MAX_UNDEFINED -# undef ULONG_MAX -# undef BOOST_PYTHON_ULONG_MAX_UNDEFINED -#endif - -#ifdef BOOST_PYTHON_LONGLONG_MAX_UNDEFINED -# undef LONGLONG_MAX -# undef BOOST_PYTHON_LONGLONG_MAX_UNDEFINED -#endif - -#ifdef BOOST_PYTHON_ULONGLONG_MAX_UNDEFINED -# undef ULONGLONG_MAX -# undef BOOST_PYTHON_ULONGLONG_MAX_UNDEFINED -#endif - -#ifdef PY_MSC_VER_DEFINED_FROM_WRAP_PYTHON_H -# undef _MSC_VER -#endif - -#ifdef DEBUG_UNDEFINED_FROM_WRAP_PYTHON_H -# undef DEBUG_UNDEFINED_FROM_WRAP_PYTHON_H -# define _DEBUG -# ifdef _CRT_NOFORCE_MANIFEST_DEFINED_FROM_WRAP_PYTHON_H -# undef _CRT_NOFORCE_MANIFEST_DEFINED_FROM_WRAP_PYTHON_H -# undef _CRT_NOFORCE_MANIFEST -# endif -#endif - -#if !defined(PY_MAJOR_VERSION) || PY_MAJOR_VERSION < 2 -# define PyObject_INIT(op, typeobj) \ - ( (op)->ob_type = (typeobj), _Py_NewReference((PyObject *)(op)), (op) ) -#endif - -// Define Python 3 macros for Python 2.x -#if PY_VERSION_HEX < 0x02060000 - -# define Py_TYPE(o) (((PyObject*)(o))->ob_type) -# define Py_REFCNT(o) (((PyObject*)(o))->ob_refcnt) -# define Py_SIZE(o) (((PyVarObject*)(o))->ob_size) - -# define PyVarObject_HEAD_INIT(type, size) \ - PyObject_HEAD_INIT(type) size, -#endif - -#if PY_VERSION_HEX < 0x030900A4 -# define Py_SET_TYPE(obj, type) ((Py_TYPE(obj) = (type)), (void)0) -# define Py_SET_SIZE(obj, size) ((Py_SIZE(obj) = (size)), (void)0) -#endif - - -#ifdef __MWERKS__ -# pragma warn_possunwant off -#elif _MSC_VER -# pragma warning(disable:4786) -#endif - -#if defined(HAVE_LONG_LONG) -# if defined(PY_LONG_LONG) -# define BOOST_PYTHON_LONG_LONG PY_LONG_LONG -# elif defined(LONG_LONG) -# define BOOST_PYTHON_LONG_LONG LONG_LONG -# else -# error "HAVE_LONG_LONG defined but not PY_LONG_LONG or LONG_LONG" -# endif -#endif diff --git a/contrib/restricted/boost/python/include/boost/python/detail/wrapper_base.hpp b/contrib/restricted/boost/python/include/boost/python/detail/wrapper_base.hpp deleted file mode 100644 index 60ac99436e..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/detail/wrapper_base.hpp +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright David Abrahams 2004. Distributed under the Boost -// Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -#ifndef WRAPPER_BASE_DWA2004722_HPP -# define WRAPPER_BASE_DWA2004722_HPP - -# include <boost/python/detail/prefix.hpp> -# include <boost/python/detail/type_traits.hpp> - -namespace boost { namespace python { - -class override; - -namespace detail -{ - class wrapper_base; - - namespace wrapper_base_ // ADL disabler - { - inline PyObject* get_owner(wrapper_base const volatile& w); - - inline PyObject* - owner_impl(void const volatile* /*x*/, detail::false_) - { - return 0; - } - - template <class T> - inline PyObject* - owner_impl(T const volatile* x, detail::true_); - - template <class T> - inline PyObject* - owner(T const volatile* x) - { - return wrapper_base_::owner_impl(x,is_polymorphic<T>()); - } - } - - class BOOST_PYTHON_DECL wrapper_base - { - friend void initialize_wrapper(PyObject* self, wrapper_base* w); - friend PyObject* wrapper_base_::get_owner(wrapper_base const volatile& w); - protected: - wrapper_base() : m_self(0) {} - - override get_override( - char const* name, PyTypeObject* class_object) const; - - private: - void detach(); - - private: - PyObject* m_self; - }; - - namespace wrapper_base_ // ADL disabler - { - template <class T> - inline PyObject* - owner_impl(T const volatile* x, detail::true_) - { - if (wrapper_base const volatile* w = dynamic_cast<wrapper_base const volatile*>(x)) - { - return wrapper_base_::get_owner(*w); - } - return 0; - } - - inline PyObject* get_owner(wrapper_base const volatile& w) - { - return w.m_self; - } - } - - inline void initialize_wrapper(PyObject* self, wrapper_base* w) - { - w->m_self = self; - } - - inline void initialize_wrapper(PyObject* /*self*/, ...) {} - - - -} // namespace detail - -}} // namespace boost::python - -#endif // WRAPPER_BASE_DWA2004722_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/dict.hpp b/contrib/restricted/boost/python/include/boost/python/dict.hpp deleted file mode 100644 index 6fcaf14382..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/dict.hpp +++ /dev/null @@ -1,152 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef DICT_20020706_HPP -#define DICT_20020706_HPP - -# include <boost/python/detail/prefix.hpp> - -#include <boost/python/object.hpp> -#include <boost/python/list.hpp> -#include <boost/python/tuple.hpp> -#include <boost/python/converter/pytype_object_mgr_traits.hpp> - -namespace boost { namespace python { - -class dict; - -namespace detail -{ - struct BOOST_PYTHON_DECL dict_base : object - { - // D.clear() -> None. Remove all items from D. - void clear(); - - // D.copy() -> a shallow copy of D - dict copy(); - - // D.get(k[,d]) -> D[k] if D.has_key(k), else d. d defaults to None. - object get(object_cref k) const; - - object get(object_cref k, object_cref d) const; - - // D.has_key(k) -> 1 if D has a key k, else 0 - bool has_key(object_cref k) const; - - // D.items() -> list of D's (key, value) pairs, as 2-tuples - list items() const; - - // D.iteritems() -> an iterator over the (key, value) items of D - object iteritems() const; - - // D.iterkeys() -> an iterator over the keys of D - object iterkeys() const; - - // D.itervalues() -> an iterator over the values of D - object itervalues() const; - - // D.keys() -> list of D's keys - list keys() const; - - // D.popitem() -> (k, v), remove and return some (key, value) pair as a - // 2-tuple; but raise KeyError if D is empty - tuple popitem(); - - // D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if not D.has_key(k) - object setdefault(object_cref k); - - object setdefault(object_cref k, object_cref d); - - // D.update(E) -> None. Update D from E: for k in E.keys(): D[k] = E[k] - void update(object_cref E); - - // D.values() -> list of D's values - list values() const; - - protected: - // dict() -> new empty dictionary. - // dict(mapping) -> new dictionary initialized from a mapping object's - // (key, value) pairs. - // dict(seq) -> new dictionary initialized as if via: - dict_base(); // new dict - explicit dict_base(object_cref data); - - BOOST_PYTHON_FORWARD_OBJECT_CONSTRUCTORS(dict_base, object) - private: - static detail::new_reference call(object const&); - }; -} - -class dict : public detail::dict_base -{ - typedef detail::dict_base base; - public: - // dict() -> new empty dictionary. - // dict(mapping) -> new dictionary initialized from a mapping object's - // (key, value) pairs. - // dict(seq) -> new dictionary initialized as if via: - dict() {} // new dict - - template <class T> - explicit dict(T const& data) - : base(object(data)) - { - } - - template<class T> - object get(T const& k) const - { - return base::get(object(k)); - } - - template<class T1, class T2> - object get(T1 const& k, T2 const& d) const - { - return base::get(object(k),object(d)); - } - - template<class T> - bool has_key(T const& k) const - { - return base::has_key(object(k)); - } - - template<class T> - object setdefault(T const& k) - { - return base::setdefault(object(k)); - } - - template<class T1, class T2> - object setdefault(T1 const& k, T2 const& d) - { - return base::setdefault(object(k),object(d)); - } - - template<class T> - void update(T const& E) - { - base::update(object(E)); - } - - public: // implementation detail -- for internal use only - BOOST_PYTHON_FORWARD_OBJECT_CONSTRUCTORS(dict, base) -}; - -// -// Converter Specializations -// -namespace converter -{ - template <> - struct object_manager_traits<dict> - : pytype_object_manager_traits<&PyDict_Type,dict> - { - }; -} - -}} // namespace boost::python - -#endif - diff --git a/contrib/restricted/boost/python/include/boost/python/docstring_options.hpp b/contrib/restricted/boost/python/include/boost/python/docstring_options.hpp deleted file mode 100644 index 1914bd51a5..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/docstring_options.hpp +++ /dev/null @@ -1,127 +0,0 @@ -// Copyright Ralf W. Grosse-Kunstleve 2006. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef DOCSTRING_OPTIONS_RWGK20060111_HPP -# define DOCSTRING_OPTIONS_RWGK20060111_HPP - -#include <boost/python/object/function.hpp> - -namespace boost { namespace python { - -// Note: the static data members are defined in object/function.cpp - -class BOOST_PYTHON_DECL docstring_options : boost::noncopyable -{ - public: - docstring_options(bool show_all=true) - { - previous_show_user_defined_ = show_user_defined_; - previous_show_py_signatures_ = show_py_signatures_; - previous_show_cpp_signatures_ = show_cpp_signatures_; - show_user_defined_ = show_all; - show_cpp_signatures_ = show_all; - show_py_signatures_ = show_all; - } - - docstring_options(bool show_user_defined, bool show_signatures) - { - previous_show_user_defined_ = show_user_defined_; - previous_show_cpp_signatures_ = show_cpp_signatures_; - previous_show_py_signatures_ = show_py_signatures_; - show_user_defined_ = show_user_defined; - show_cpp_signatures_ = show_signatures; - show_py_signatures_ = show_signatures; - } - - docstring_options(bool show_user_defined, bool show_py_signatures, bool show_cpp_signatures) - { - previous_show_user_defined_ = show_user_defined_; - previous_show_cpp_signatures_ = show_cpp_signatures_; - previous_show_py_signatures_ = show_py_signatures_; - show_user_defined_ = show_user_defined; - show_cpp_signatures_ = show_cpp_signatures; - show_py_signatures_ = show_py_signatures; - } - - ~docstring_options() - { - show_user_defined_ = previous_show_user_defined_; - show_cpp_signatures_ = previous_show_cpp_signatures_; - show_py_signatures_ = previous_show_py_signatures_; - } - - void - disable_user_defined() { show_user_defined_ = false; } - - void - enable_user_defined() { show_user_defined_ = true; } - - void - disable_py_signatures() - { - show_py_signatures_ = false; - } - - void - enable_py_signatures() - { - show_py_signatures_ = true; - } - - void - disable_cpp_signatures() - { - show_cpp_signatures_ = false; - } - - void - enable_cpp_signatures() - { - show_cpp_signatures_ = true; - } - - void - disable_signatures() - { - show_cpp_signatures_ = false; - show_py_signatures_ = false; - } - - void - enable_signatures() - { - show_cpp_signatures_ = true; - show_py_signatures_ = true; - } - - void - disable_all() - { - show_user_defined_ = false; - show_cpp_signatures_ = false; - show_py_signatures_ = false; - } - - void - enable_all() - { - show_user_defined_ = true; - show_cpp_signatures_ = true; - show_py_signatures_ = true; - } - - friend struct objects::function; - - private: - static volatile bool show_user_defined_; - static volatile bool show_cpp_signatures_; - static volatile bool show_py_signatures_; - bool previous_show_user_defined_; - bool previous_show_cpp_signatures_; - bool previous_show_py_signatures_; -}; - -}} // namespace boost::python - -#endif // DOCSTRING_OPTIONS_RWGK20060111_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/errors.hpp b/contrib/restricted/boost/python/include/boost/python/errors.hpp deleted file mode 100644 index 1eec6c2fe6..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/errors.hpp +++ /dev/null @@ -1,55 +0,0 @@ -// (C) Copyright David Abrahams 2000. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// The author gratefully acknowleges the support of Dragon Systems, Inc., in -// producing this work. - -#ifndef ERRORS_DWA052500_H_ -# define ERRORS_DWA052500_H_ - -# include <boost/python/detail/prefix.hpp> -# include <boost/function/function0.hpp> - -namespace boost { namespace python { - -struct BOOST_PYTHON_DECL error_already_set -{ - virtual ~error_already_set(); -}; - -// Handles exceptions caught just before returning to Python code. -// Returns true iff an exception was caught. -BOOST_PYTHON_DECL bool handle_exception_impl(function0<void>); - -template <class T> -bool handle_exception(T f) -{ - return handle_exception_impl(function0<void>(boost::ref(f))); -} - -namespace detail { inline void rethrow() { throw; } } - -inline void handle_exception() -{ - handle_exception(detail::rethrow); -} - -BOOST_PYTHON_DECL void throw_error_already_set(); - -template <class T> -inline T* expect_non_null(T* x) -{ - if (x == 0) - throw_error_already_set(); - return x; -} - -// Return source if it is an instance of pytype; throw an appropriate -// exception otherwise. -BOOST_PYTHON_DECL PyObject* pytype_check(PyTypeObject* pytype, PyObject* source); - -}} // namespace boost::python - -#endif // ERRORS_DWA052500_H_ diff --git a/contrib/restricted/boost/python/include/boost/python/exec.hpp b/contrib/restricted/boost/python/include/boost/python/exec.hpp deleted file mode 100644 index 32a74991a7..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/exec.hpp +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright Stefan Seefeld 2005. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef EXEC_SS20050616_HPP -# define EXEC_SS20050616_HPP - -# include <boost/python/object.hpp> -# include <boost/python/str.hpp> - -namespace boost -{ -namespace python -{ - -// Evaluate python expression from str. -// global and local are the global and local scopes respectively, -// used during evaluation. -object -BOOST_PYTHON_DECL -eval(str string, object global = object(), object local = object()); - -object -BOOST_PYTHON_DECL -eval(char const *string, object global = object(), object local = object()); - -// Execute an individual python statement from str. -// global and local are the global and local scopes respectively, -// used during execution. -object -BOOST_PYTHON_DECL -exec_statement(str string, object global = object(), object local = object()); - -object -BOOST_PYTHON_DECL -exec_statement(char const *string, object global = object(), object local = object()); - -// Execute python source code from str. -// global and local are the global and local scopes respectively, -// used during execution. -object -BOOST_PYTHON_DECL -exec(str string, object global = object(), object local = object()); - -object -BOOST_PYTHON_DECL -exec(char const *string, object global = object(), object local = object()); - -// Execute python source code from file filename. -// global and local are the global and local scopes respectively, -// used during execution. -object -BOOST_PYTHON_DECL -exec_file(str filename, object global = object(), object local = object()); - -object -BOOST_PYTHON_DECL -exec_file(char const *filename, object global = object(), object local = object()); - -} -} - -#endif diff --git a/contrib/restricted/boost/python/include/boost/python/extract.hpp b/contrib/restricted/boost/python/include/boost/python/extract.hpp deleted file mode 100644 index bfdeb83ce7..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/extract.hpp +++ /dev/null @@ -1,259 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef EXTRACT_DWA200265_HPP -# define EXTRACT_DWA200265_HPP - -# include <boost/python/detail/prefix.hpp> - -# include <boost/python/converter/object_manager.hpp> -# include <boost/python/converter/from_python.hpp> -# include <boost/python/converter/rvalue_from_python_data.hpp> -# include <boost/python/converter/registered.hpp> -# include <boost/python/converter/registered_pointee.hpp> - -# include <boost/python/object_core.hpp> -# include <boost/python/refcount.hpp> - -# include <boost/python/detail/copy_ctor_mutates_rhs.hpp> -# include <boost/python/detail/void_ptr.hpp> -# include <boost/python/detail/void_return.hpp> -# include <boost/call_traits.hpp> - -#if BOOST_WORKAROUND(BOOST_INTEL_WIN, <= 900) -# define BOOST_EXTRACT_WORKAROUND () -#else -# define BOOST_EXTRACT_WORKAROUND -#endif - -namespace boost { namespace python { - -namespace api -{ - class object; -} - -namespace converter -{ - template <class Ptr> - struct extract_pointer - { - typedef Ptr result_type; - extract_pointer(PyObject*); - - bool check() const; - Ptr operator()() const; - - private: - PyObject* m_source; - void* m_result; - }; - - template <class Ref> - struct extract_reference - { - typedef Ref result_type; - extract_reference(PyObject*); - - bool check() const; - Ref operator()() const; - - private: - PyObject* m_source; - void* m_result; - }; - - template <class T> - struct extract_rvalue : private noncopyable - { - typedef typename mpl::if_< - python::detail::copy_ctor_mutates_rhs<T> - , T& - , typename call_traits<T>::param_type - >::type result_type; - - extract_rvalue(PyObject*); - - bool check() const; - result_type operator()() const; - private: - PyObject* m_source; - mutable rvalue_from_python_data<T> m_data; - }; - - template <class T> - struct extract_object_manager - { - typedef T result_type; - extract_object_manager(PyObject*); - - bool check() const; - result_type operator()() const; - private: - PyObject* m_source; - }; - - template <class T> - struct select_extract - { - BOOST_STATIC_CONSTANT( - bool, obj_mgr = is_object_manager<T>::value); - - BOOST_STATIC_CONSTANT( - bool, ptr = is_pointer<T>::value); - - BOOST_STATIC_CONSTANT( - bool, ref = is_reference<T>::value); - - typedef typename mpl::if_c< - obj_mgr - , extract_object_manager<T> - , typename mpl::if_c< - ptr - , extract_pointer<T> - , typename mpl::if_c< - ref - , extract_reference<T> - , extract_rvalue<T> - >::type - >::type - >::type type; - }; -} - -template <class T> -struct extract - : converter::select_extract<T>::type -{ - private: - typedef typename converter::select_extract<T>::type base; - public: - typedef typename base::result_type result_type; - - operator result_type() const - { - return (*this)(); - } - - extract(PyObject*); - extract(api::object const&); -}; - -// -// Implementations -// -template <class T> -inline extract<T>::extract(PyObject* o) - : base(o) -{ -} - -template <class T> -inline extract<T>::extract(api::object const& o) - : base(o.ptr()) -{ -} - -namespace converter -{ - template <class T> - inline extract_rvalue<T>::extract_rvalue(PyObject* x) - : m_source(x) - , m_data( - (rvalue_from_python_stage1)(x, registered<T>::converters) - ) - { - } - - template <class T> - inline bool - extract_rvalue<T>::check() const - { - return m_data.stage1.convertible; - } - - template <class T> - inline typename extract_rvalue<T>::result_type - extract_rvalue<T>::operator()() const - { - return *(T*)( - // Only do the stage2 conversion once - m_data.stage1.convertible == m_data.storage.bytes - ? m_data.storage.bytes - : (rvalue_from_python_stage2)(m_source, m_data.stage1, registered<T>::converters) - ); - } - - template <class Ref> - inline extract_reference<Ref>::extract_reference(PyObject* obj) - : m_source(obj) - , m_result( - (get_lvalue_from_python)(obj, registered<Ref>::converters) - ) - { - } - - template <class Ref> - inline bool extract_reference<Ref>::check() const - { - return m_result != 0; - } - - template <class Ref> - inline Ref extract_reference<Ref>::operator()() const - { - if (m_result == 0) - (throw_no_reference_from_python)(m_source, registered<Ref>::converters); - - return python::detail::void_ptr_to_reference(m_result, (Ref(*)())0); - } - - template <class Ptr> - inline extract_pointer<Ptr>::extract_pointer(PyObject* obj) - : m_source(obj) - , m_result( - obj == Py_None ? 0 : (get_lvalue_from_python)(obj, registered_pointee<Ptr>::converters) - ) - { - } - - template <class Ptr> - inline bool extract_pointer<Ptr>::check() const - { - return m_source == Py_None || m_result != 0; - } - - template <class Ptr> - inline Ptr extract_pointer<Ptr>::operator()() const - { - if (m_result == 0 && m_source != Py_None) - (throw_no_pointer_from_python)(m_source, registered_pointee<Ptr>::converters); - - return Ptr(m_result); - } - - template <class T> - inline extract_object_manager<T>::extract_object_manager(PyObject* obj) - : m_source(obj) - { - } - - template <class T> - inline bool extract_object_manager<T>::check() const - { - return object_manager_traits<T>::check(m_source); - } - - template <class T> - inline T extract_object_manager<T>::operator()() const - { - return T( - object_manager_traits<T>::adopt(python::incref(m_source)) - ); - } -} - -}} // namespace boost::python::converter - -#endif // EXTRACT_DWA200265_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/handle.hpp b/contrib/restricted/boost/python/include/boost/python/handle.hpp deleted file mode 100644 index ee9a7cd09d..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/handle.hpp +++ /dev/null @@ -1,237 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef HANDLE_DWA200269_HPP -# define HANDLE_DWA200269_HPP - -# include <boost/python/detail/prefix.hpp> - -# include <boost/python/cast.hpp> -# include <boost/python/errors.hpp> -# include <boost/python/borrowed.hpp> -# include <boost/python/handle_fwd.hpp> -# include <boost/python/refcount.hpp> -# include <boost/python/tag.hpp> -# include <boost/python/detail/raw_pyobject.hpp> - -namespace boost { namespace python { - -template <class T> struct null_ok; - -template <class T> -inline null_ok<T>* allow_null(T* p) -{ - return (null_ok<T>*)p; -} - -namespace detail -{ - template <class T> - inline T* manage_ptr(detail::borrowed<null_ok<T> >* p, int) - { - return python::xincref((T*)p); - } - - template <class T> - inline T* manage_ptr(null_ok<detail::borrowed<T> >* p, int) - { - return python::xincref((T*)p); - } - - template <class T> - inline T* manage_ptr(detail::borrowed<T>* p, long) - { - return python::incref(expect_non_null((T*)p)); - } - - template <class T> - inline T* manage_ptr(null_ok<T>* p, long) - { - return (T*)p; - } - - template <class T> - inline T* manage_ptr(T* p, ...) - { - return expect_non_null(p); - } -} - -template <class T> -class handle -{ - typedef T* (handle::* bool_type )() const; - - public: // types - typedef T element_type; - - public: // member functions - handle(); - ~handle(); - - template <class Y> - explicit handle(Y* p) - : m_p( - python::upcast<T>( - detail::manage_ptr(p, 0) - ) - ) - { - } - - handle& operator=(handle const& r) - { - python::xdecref(m_p); - m_p = python::xincref(r.m_p); - return *this; - } - - template<typename Y> - handle& operator=(handle<Y> const & r) // never throws - { - python::xdecref(m_p); - m_p = python::xincref(python::upcast<T>(r.get())); - return *this; - } - - template <typename Y> - handle(handle<Y> const& r) - : m_p(python::xincref(python::upcast<T>(r.get()))) - { - } - - handle(handle const& r) - : m_p(python::xincref(r.m_p)) - { - } - - T* operator-> () const; - T& operator* () const; - T* get() const; - T* release(); - void reset(); - - operator bool_type() const // never throws - { - return m_p ? &handle<T>::get : 0; - } - bool operator! () const; // never throws - - public: // implementation details -- do not touch - // Defining this in the class body suppresses a VC7 link failure - inline handle(detail::borrowed_reference x) - : m_p( - python::incref( - downcast<T>((PyObject*)x) - )) - { - } - - private: // data members - T* m_p; -}; - -#ifdef BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP -} // namespace python -#endif - -template<class T> inline T * get_pointer(python::handle<T> const & p) -{ - return p.get(); -} - -#ifdef BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP -namespace python { -#else - -// We don't want get_pointer above to hide the others -using boost::get_pointer; - -#endif - -typedef handle<PyTypeObject> type_handle; - -// -// Compile-time introspection -// -template<typename T> -class is_handle -{ - public: - BOOST_STATIC_CONSTANT(bool, value = false); -}; - -template<typename T> -class is_handle<handle<T> > -{ - public: - BOOST_STATIC_CONSTANT(bool, value = true); -}; - -// -// implementations -// -template <class T> -inline handle<T>::handle() - : m_p(0) -{ -} - -template <class T> -inline handle<T>::~handle() -{ - python::xdecref(m_p); -} - -template <class T> -inline T* handle<T>::operator->() const -{ - return m_p; -} - -template <class T> -inline T& handle<T>::operator*() const -{ - return *m_p; -} - -template <class T> -inline T* handle<T>::get() const -{ - return m_p; -} - -template <class T> -inline bool handle<T>::operator!() const -{ - return m_p == 0; -} - -template <class T> -inline T* handle<T>::release() -{ - T* result = m_p; - m_p = 0; - return result; -} - -template <class T> -inline void handle<T>::reset() -{ - python::xdecref(m_p); - m_p = 0; -} - -// Because get_managed_object must return a non-null PyObject*, we -// return Py_None if the handle is null. -template <class T> -inline PyObject* get_managed_object(handle<T> const& h, tag_t) -{ - return h.get() ? python::upcast<PyObject>(h.get()) : Py_None; -} - -}} // namespace boost::python - - -#endif // HANDLE_DWA200269_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/handle_fwd.hpp b/contrib/restricted/boost/python/include/boost/python/handle_fwd.hpp deleted file mode 100644 index 5987ec4fdb..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/handle_fwd.hpp +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef HANDLE_FWD_DWA2002615_HPP -# define HANDLE_FWD_DWA2002615_HPP - -# include <boost/python/detail/prefix.hpp> - -namespace boost { namespace python { - -template <class T = PyObject> class handle; - -}} // namespace boost::python - -#endif // HANDLE_FWD_DWA2002615_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/import.hpp b/contrib/restricted/boost/python/include/boost/python/import.hpp deleted file mode 100644 index 45c02a9366..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/import.hpp +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright Stefan Seefeld 2005. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef IMPORT_SS20050624_HPP -# define IMPORT_SS20050624_HPP - -# include <boost/python/object.hpp> -# include <boost/python/str.hpp> - -namespace boost -{ -namespace python -{ - -// Import the named module and return a reference to it. -object BOOST_PYTHON_DECL import(str name); - -} -} - -#endif diff --git a/contrib/restricted/boost/python/include/boost/python/instance_holder.hpp b/contrib/restricted/boost/python/include/boost/python/instance_holder.hpp deleted file mode 100644 index 3113bd93c7..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/instance_holder.hpp +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef INSTANCE_HOLDER_DWA2002517_HPP -# define INSTANCE_HOLDER_DWA2002517_HPP - -# include <boost/python/detail/prefix.hpp> - -# include <boost/noncopyable.hpp> -# include <boost/python/type_id.hpp> -# include <cstddef> - -namespace boost { namespace python { - -// Base class for all holders -struct BOOST_PYTHON_DECL instance_holder : private noncopyable -{ - public: - instance_holder(); - virtual ~instance_holder(); - - // return the next holder in a chain - instance_holder* next() const; - - // When the derived holder actually holds by [smart] pointer and - // null_ptr_only is set, only report that the type is held when - // the pointer is null. This is needed for proper shared_ptr - // support, to prevent holding shared_ptrs from being found when - // converting from python so that we can use the conversion method - // that always holds the Python object. - virtual void* holds(type_info, bool null_ptr_only) = 0; - - void install(PyObject* inst) noexcept; - - // These functions should probably be located elsewhere. - - // Allocate storage for an object of the given size at the given - // offset in the Python instance<> object if bytes are available - // there. Otherwise allocate size bytes of heap memory. - static void* allocate(PyObject*, std::size_t offset, std::size_t size, std::size_t alignment = 1); - - // Deallocate storage from the heap if it was not carved out of - // the given Python object by allocate(), above. - static void deallocate(PyObject*, void* storage) noexcept; - private: - instance_holder* m_next; -}; - -// This macro is needed for implementation of derived holders -# define BOOST_PYTHON_UNFORWARD(N,ignored) (typename unforward<A##N>::type)(a##N) - -// -// implementation -// -inline instance_holder* instance_holder::next() const -{ - return m_next; -} - -}} // namespace boost::python - -#endif // INSTANCE_HOLDER_DWA2002517_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/list.hpp b/contrib/restricted/boost/python/include/boost/python/list.hpp deleted file mode 100644 index 0d5e2c8fd9..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/list.hpp +++ /dev/null @@ -1,148 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef LIST_DWA2002627_HPP -# define LIST_DWA2002627_HPP - -# include <boost/python/detail/prefix.hpp> - -# include <boost/python/object.hpp> -# include <boost/python/converter/pytype_object_mgr_traits.hpp> -# include <boost/python/ssize_t.hpp> - -namespace boost { namespace python { - -namespace detail -{ - struct BOOST_PYTHON_DECL list_base : object - { - void append(object_cref); // append object to end - - ssize_t count(object_cref value) const; // return number of occurrences of value - - void extend(object_cref sequence); // extend list by appending sequence elements - - long index(object_cref value) const; // return index of first occurrence of value - - void insert(ssize_t index, object_cref); // insert object before index - void insert(object const& index, object_cref); - - object pop(); // remove and return item at index (default last) - object pop(ssize_t index); - object pop(object const& index); - - void remove(object_cref value); // remove first occurrence of value - - void reverse(); // reverse *IN PLACE* - - void sort(); // sort *IN PLACE*; if given, cmpfunc(x, y) -> -1, 0, 1 -#if PY_VERSION_HEX >= 0x03000000 - void sort(args_proxy const &args, - kwds_proxy const &kwds); -#else - void sort(object_cref cmpfunc); -#endif - - protected: - list_base(); // new list - explicit list_base(object_cref sequence); // new list initialized from sequence's items - - BOOST_PYTHON_FORWARD_OBJECT_CONSTRUCTORS(list_base, object) - private: - static detail::new_non_null_reference call(object const&); - }; -} - -class list : public detail::list_base -{ - typedef detail::list_base base; - public: - list() {} // new list - - template <class T> - explicit list(T const& sequence) - : base(object(sequence)) - { - } - - template <class T> - void append(T const& x) - { - base::append(object(x)); - } - - template <class T> - ssize_t count(T const& value) const - { - return base::count(object(value)); - } - - template <class T> - void extend(T const& x) - { - base::extend(object(x)); - } - - template <class T> - long index(T const& x) const - { - return base::index(object(x)); - } - - template <class T> - void insert(ssize_t index, T const& x) // insert object before index - { - base::insert(index, object(x)); - } - - template <class T> - void insert(object const& index, T const& x) // insert object before index - { - base::insert(index, object(x)); - } - - object pop() { return base::pop(); } - object pop(ssize_t index) { return base::pop(index); } - - template <class T> - object pop(T const& index) - { - return base::pop(object(index)); - } - - template <class T> - void remove(T const& value) - { - base::remove(object(value)); - } - -#if PY_VERSION_HEX <= 0x03000000 - void sort() { base::sort(); } - - template <class T> - void sort(T const& value) - { - base::sort(object(value)); - } -#endif - - public: // implementation detail -- for internal use only - BOOST_PYTHON_FORWARD_OBJECT_CONSTRUCTORS(list, base) -}; - -// -// Converter Specializations -// -namespace converter -{ - template <> - struct object_manager_traits<list> - : pytype_object_manager_traits<&PyList_Type,list> - { - }; -} - -}} // namespace boost::python - -#endif // LIST_DWA2002627_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/long.hpp b/contrib/restricted/boost/python/include/boost/python/long.hpp deleted file mode 100644 index c15604c91c..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/long.hpp +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef LONG_DWA2002627_HPP -# define LONG_DWA2002627_HPP - -# include <boost/python/detail/prefix.hpp> - -# include <boost/python/object.hpp> -# include <boost/python/converter/pytype_object_mgr_traits.hpp> - -namespace boost { namespace python { - -namespace detail -{ - struct BOOST_PYTHON_DECL long_base : object - { - protected: - long_base(); // new long_ - explicit long_base(object_cref rhs); - explicit long_base(object_cref rhs, object_cref base); - - BOOST_PYTHON_FORWARD_OBJECT_CONSTRUCTORS(long_base, object) - - private: - static detail::new_reference call(object const&); - static detail::new_reference call(object const&, object const&); - }; -} - -class long_ : public detail::long_base -{ - typedef detail::long_base base; - public: - long_() {} // new long_ - - template <class T> - explicit long_(T const& rhs) - : detail::long_base(object(rhs)) - { - } - - template <class T, class U> - explicit long_(T const& rhs, U const& base) - : detail::long_base(object(rhs), object(base)) - { - } - - public: // implementation detail -- for internal use only - BOOST_PYTHON_FORWARD_OBJECT_CONSTRUCTORS(long_, base) -}; - -// -// Converter Specializations -// -namespace converter -{ - template <> - struct object_manager_traits<long_> - : pytype_object_manager_traits<&PyLong_Type,long_> - { - }; -} - -}} // namespace boost::python - -#endif // LONG_DWA2002627_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/make_function.hpp b/contrib/restricted/boost/python/include/boost/python/make_function.hpp deleted file mode 100644 index 7dd7c316b3..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/make_function.hpp +++ /dev/null @@ -1,153 +0,0 @@ -// Copyright David Abrahams 2001. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef MAKE_FUNCTION_DWA20011221_HPP -# define MAKE_FUNCTION_DWA20011221_HPP - -# include <boost/python/detail/prefix.hpp> - -# include <boost/python/default_call_policies.hpp> -# include <boost/python/args.hpp> -# include <boost/python/detail/caller.hpp> - -# include <boost/python/object/function_object.hpp> - -# include <boost/mpl/size.hpp> -# include <boost/mpl/int.hpp> - -namespace boost { namespace python { - -namespace detail -{ - // make_function_aux -- - // - // These helper functions for make_function (below) do the raw work - // of constructing a Python object from some invokable entity. See - // <boost/python/detail/caller.hpp> for more information about how - // the Sig arguments is used. - template <class F, class CallPolicies, class Sig> - object make_function_aux( - F f // An object that can be invoked by detail::invoke() - , CallPolicies const& p // CallPolicies to use in the invocation - , Sig const& // An MPL sequence of argument types expected by F - ) - { - return objects::function_object( - detail::caller<F,CallPolicies,Sig>(f, p) - ); - } - - // As above, except that it accepts argument keywords. NumKeywords - // is used only for a compile-time assertion to make sure the user - // doesn't pass more keywords than the function can accept. To - // disable all checking, pass mpl::int_<0> for NumKeywords. - template <class F, class CallPolicies, class Sig, class NumKeywords> - object make_function_aux( - F f - , CallPolicies const& p - , Sig const& - , detail::keyword_range const& kw // a [begin,end) pair of iterators over keyword names - , NumKeywords // An MPL integral type wrapper: the size of kw - ) - { - enum { arity = mpl::size<Sig>::value - 1 }; - - typedef typename detail::error::more_keywords_than_function_arguments< - NumKeywords::value, arity - >::too_many_keywords assertion BOOST_ATTRIBUTE_UNUSED; - - return objects::function_object( - detail::caller<F,CallPolicies,Sig>(f, p) - , kw); - } - - // Helpers for make_function when called with 3 arguments. These - // dispatch functions are used to discriminate between the cases - // when the 3rd argument is keywords or when it is a signature. - // - // @group { - template <class F, class CallPolicies, class Keywords> - object make_function_dispatch(F f, CallPolicies const& policies, Keywords const& kw, mpl::true_) - { - return detail::make_function_aux( - f - , policies - , detail::get_signature(f) - , kw.range() - , mpl::int_<Keywords::size>() - ); - } - - template <class F, class CallPolicies, class Signature> - object make_function_dispatch(F f, CallPolicies const& policies, Signature const& sig, mpl::false_) - { - return detail::make_function_aux( - f - , policies - , sig - ); - } - // } - - } - -// These overloaded functions wrap a function or member function -// pointer as a Python object, using optional CallPolicies, -// Keywords, and/or Signature. -// -// @group { -template <class F> -object make_function(F f) -{ - return detail::make_function_aux( - f,default_call_policies(), detail::get_signature(f)); -} - -template <class F, class CallPolicies> -object make_function(F f, CallPolicies const& policies) -{ - return detail::make_function_aux( - f, policies, detail::get_signature(f)); -} - -template <class F, class CallPolicies, class KeywordsOrSignature> -object make_function( - F f - , CallPolicies const& policies - , KeywordsOrSignature const& keywords_or_signature) -{ - typedef typename - detail::is_reference_to_keywords<KeywordsOrSignature&>::type - is_kw; - - return detail::make_function_dispatch( - f - , policies - , keywords_or_signature - , is_kw() - ); -} - -template <class F, class CallPolicies, class Keywords, class Signature> -object make_function( - F f - , CallPolicies const& policies - , Keywords const& kw - , Signature const& sig - ) -{ - return detail::make_function_aux( - f - , policies - , sig - , kw.range() - , mpl::int_<Keywords::size>() - ); -} -// } - -}} - - -#endif // MAKE_FUNCTION_DWA20011221_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/object.hpp b/contrib/restricted/boost/python/include/boost/python/object.hpp deleted file mode 100644 index 9adec90f64..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/object.hpp +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef OBJECT_DWA2002612_HPP -# define OBJECT_DWA2002612_HPP - -# include <boost/python/ssize_t.hpp> -# include <boost/python/object_core.hpp> -# include <boost/python/object_attributes.hpp> -# include <boost/python/object_items.hpp> -# include <boost/python/object_slices.hpp> -# include <boost/python/object_operators.hpp> -# include <boost/python/converter/arg_to_python.hpp> - -namespace boost { namespace python { - - inline ssize_t len(object const& obj) - { - ssize_t result = PyObject_Length(obj.ptr()); - if (PyErr_Occurred()) throw_error_already_set(); - return result; - } - -}} // namespace boost::python - -#endif // OBJECT_DWA2002612_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/object/add_to_namespace.hpp b/contrib/restricted/boost/python/include/boost/python/object/add_to_namespace.hpp deleted file mode 100644 index 9f4167d6d2..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/object/add_to_namespace.hpp +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef ADD_TO_NAMESPACE_DWA200286_HPP -# define ADD_TO_NAMESPACE_DWA200286_HPP - -# include <boost/python/object_fwd.hpp> - -namespace boost { namespace python { namespace objects { - -// -// A setattr that's "smart" about function overloading (and docstrings). -// -BOOST_PYTHON_DECL void add_to_namespace( - object const& name_space, char const* name, object const& attribute); - -BOOST_PYTHON_DECL void add_to_namespace( - object const& name_space, char const* name, object const& attribute, char const* doc); - -}}} // namespace boost::python::objects - -#endif // ADD_TO_NAMESPACE_DWA200286_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/object/class.hpp b/contrib/restricted/boost/python/include/boost/python/object/class.hpp deleted file mode 100644 index f57ceda7bd..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/object/class.hpp +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright David Abrahams 2001. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef CLASS_DWA20011214_HPP -# define CLASS_DWA20011214_HPP - -# include <boost/python/detail/prefix.hpp> -# include <boost/python/object_core.hpp> -# include <boost/python/type_id.hpp> -# include <cstddef> - -namespace boost { namespace python { - -namespace objects { - -struct BOOST_PYTHON_DECL class_base : python::api::object -{ - // constructor - class_base( - char const* name // The name of the class - - , std::size_t num_types // A list of class_ids. The first is the type - , type_info const*const types // this is wrapping. The rest are the types of - // any bases. - - , char const* doc = 0 // Docstring, if any. - ); - - - // Implementation detail. Hiding this in the private section would - // require use of template friend declarations. - void enable_pickling_(bool getstate_manages_dict); - - protected: - void add_property( - char const* name, object const& fget, char const* docstr); - void add_property(char const* name, - object const& fget, object const& fset, char const* docstr); - - void add_static_property(char const* name, object const& fget); - void add_static_property(char const* name, object const& fget, object const& fset); - - // Retrieve the underlying object - void setattr(char const* name, object const&); - - // Set a special attribute in the class which tells Boost.Python - // to allocate extra bytes for embedded C++ objects in Python - // instances. - void set_instance_size(std::size_t bytes); - - // Set an __init__ function which throws an appropriate exception - // for abstract classes. - void def_no_init(); - - // Effects: - // setattr(self, staticmethod(getattr(self, method_name))) - void make_method_static(const char *method_name); -}; - -}}} // namespace boost::python::objects - -#endif // CLASS_DWA20011214_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/object/class_detail.hpp b/contrib/restricted/boost/python/include/boost/python/object/class_detail.hpp deleted file mode 100644 index a17a4f4330..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/object/class_detail.hpp +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef CLASS_DETAIL_DWA200295_HPP -# define CLASS_DETAIL_DWA200295_HPP - -# include <boost/python/handle.hpp> -# include <boost/python/type_id.hpp> - -namespace boost { namespace python { namespace objects { - -BOOST_PYTHON_DECL type_handle registered_class_object(type_info id); -BOOST_PYTHON_DECL type_handle class_metatype(); -BOOST_PYTHON_DECL type_handle class_type(); - -}}} // namespace boost::python::object - -#endif // CLASS_DETAIL_DWA200295_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/object/enum_base.hpp b/contrib/restricted/boost/python/include/boost/python/object/enum_base.hpp deleted file mode 100644 index be34274226..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/object/enum_base.hpp +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef ENUM_BASE_DWA200298_HPP -# define ENUM_BASE_DWA200298_HPP - -# include <boost/python/object_core.hpp> -# include <boost/python/type_id.hpp> -# include <boost/python/converter/to_python_function_type.hpp> -# include <boost/python/converter/convertible_function.hpp> -# include <boost/python/converter/constructor_function.hpp> - -namespace boost { namespace python { namespace objects { - -struct BOOST_PYTHON_DECL enum_base : python::api::object -{ - protected: - enum_base( - char const* name - , converter::to_python_function_t - , converter::convertible_function - , converter::constructor_function - , type_info - , const char *doc = 0 - ); - - void add_value(char const* name, long value); - void export_values(); - - static PyObject* to_python(PyTypeObject* type, long x); -}; - -}}} // namespace boost::python::object - -#endif // ENUM_BASE_DWA200298_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/object/find_instance.hpp b/contrib/restricted/boost/python/include/boost/python/object/find_instance.hpp deleted file mode 100644 index 3202c1cd15..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/object/find_instance.hpp +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef FIND_INSTANCE_DWA2002312_HPP -# define FIND_INSTANCE_DWA2002312_HPP - -# include <boost/python/type_id.hpp> - -namespace boost { namespace python { namespace objects { - -// Given a type_id, find the instance data which corresponds to it, or -// return 0 in case no such type is held. If null_shared_ptr_only is -// true and the type being sought is a shared_ptr, only find an -// instance if it turns out to be NULL. Needed for shared_ptr rvalue -// from_python support. -BOOST_PYTHON_DECL void* find_instance_impl(PyObject*, type_info, bool null_shared_ptr_only = false); - -}}} // namespace boost::python::objects - -#endif // FIND_INSTANCE_DWA2002312_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/object/forward.hpp b/contrib/restricted/boost/python/include/boost/python/object/forward.hpp deleted file mode 100644 index c6515bb55b..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/object/forward.hpp +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright David Abrahams 2001. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef FORWARD_DWA20011215_HPP -# define FORWARD_DWA20011215_HPP - -# include <boost/mpl/if.hpp> -# include <boost/ref.hpp> -# include <boost/python/detail/value_arg.hpp> -# include <boost/python/detail/type_traits.hpp> -# include <boost/python/detail/copy_ctor_mutates_rhs.hpp> -# include <boost/mpl/or.hpp> - -namespace boost { namespace python { namespace objects { - -// Very much like boost::reference_wrapper<T>, except that in this -// case T can be a reference already without causing a -// reference-to-reference error. -template <class T> -struct reference_to_value -{ - typedef typename boost::python::detail::add_lvalue_reference<typename - boost::python::detail::add_const<T>::type>::type reference; - - reference_to_value(reference x) : m_value(x) {} - reference get() const { return m_value; } - private: - reference m_value; -}; - -// A little metaprogram which selects the type to pass through an -// intermediate forwarding function when the destination argument type -// is T. -template <class T> -struct forward - : mpl::if_< - mpl::or_<python::detail::copy_ctor_mutates_rhs<T>, boost::python::detail::is_scalar<T> > - , T - , reference_to_value<T> - > -{ -}; - -template<typename T> -struct unforward -{ - typedef typename unwrap_reference<T>::type& type; -}; - -template<typename T> -struct unforward<reference_to_value<T> > -{ - typedef T type; -}; - -template <typename T> -struct unforward_cref - : python::detail::value_arg< - typename unwrap_reference<T>::type - > -{ -}; - -template<typename T> -struct unforward_cref<reference_to_value<T> > - : boost::python::detail::add_lvalue_reference<typename boost::python::detail::add_const<T>::type> -{ -}; - - -template <class T> -typename reference_to_value<T>::reference -do_unforward(reference_to_value<T> const& x, int) -{ - return x.get(); -} - -template <class T> -typename reference_wrapper<T>::type& -do_unforward(reference_wrapper<T> const& x, int) -{ - return x.get(); -} - -template <class T> -T const& do_unforward(T const& x, ...) -{ - return x; -} - -}}} // namespace boost::python::objects - -#endif // FORWARD_DWA20011215_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/object/function.hpp b/contrib/restricted/boost/python/include/boost/python/object/function.hpp deleted file mode 100644 index f29d344820..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/object/function.hpp +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright David Abrahams 2001. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef FUNCTION_DWA20011214_HPP -# define FUNCTION_DWA20011214_HPP - -# include <boost/python/detail/prefix.hpp> -# include <boost/python/args_fwd.hpp> -# include <boost/python/handle.hpp> -# include <boost/function/function2.hpp> -# include <boost/python/object_core.hpp> -# include <boost/python/object/py_function.hpp> - -namespace boost { namespace python { namespace objects { - - -struct BOOST_PYTHON_DECL function : PyObject -{ - function( - py_function const& - , python::detail::keyword const* names_and_defaults - , unsigned num_keywords); - - ~function(); - - PyObject* call(PyObject*, PyObject*) const; - - // Add an attribute to the name_space with the given name. If it is - // a function object (this class), and an existing function is - // already there, add it as an overload. - static void add_to_namespace( - object const& name_space, char const* name, object const& attribute); - - static void add_to_namespace( - object const& name_space, char const* name, object const& attribute, char const* doc); - - object const& doc() const; - void doc(object const& x); - - object const& name() const; - - object const& get_namespace() const { return m_namespace; } - - private: // helper functions - object signature(bool show_return_type=false) const; - object signatures(bool show_return_type=false) const; - void argument_error(PyObject* args, PyObject* keywords) const; - void add_overload(handle<function> const&); - - private: // data members - py_function m_fn; - handle<function> m_overloads; - object m_name; - object m_namespace; - object m_doc; - object m_arg_names; - unsigned m_nkeyword_values; - friend class function_doc_signature_generator; -}; - -// -// implementations -// -inline object const& function::doc() const -{ - return this->m_doc; -} - -inline void function::doc(object const& x) -{ - this->m_doc = x; -} - -inline object const& function::name() const -{ - return this->m_name; -} - -}}} // namespace boost::python::objects - -#endif // FUNCTION_DWA20011214_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/object/function_doc_signature.hpp b/contrib/restricted/boost/python/include/boost/python/object/function_doc_signature.hpp deleted file mode 100644 index 4f00cb385a..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/object/function_doc_signature.hpp +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright Nikolay Mladenov 2007. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef FUNCTION_SIGNATURE_20070531_HPP -# define FUNCTION_SIGNATURE_20070531_HPP - -#include <boost/python/object/function.hpp> -#include <boost/python/converter/registrations.hpp> -#include <boost/python/str.hpp> -#include <boost/python/tuple.hpp> - -#include <boost/python/detail/signature.hpp> - - -#include <vector> - -namespace boost { namespace python { namespace objects { - -class function_doc_signature_generator{ - static const char * py_type_str(const python::detail::signature_element &s); - static bool arity_cmp( function const *f1, function const *f2 ); - static bool are_seq_overloads( function const *f1, function const *f2 , bool check_docs); - static std::vector<function const*> flatten(function const *f); - static std::vector<function const*> split_seq_overloads( const std::vector<function const *> &funcs, bool split_on_doc_change); - static str raw_function_pretty_signature(function const *f, size_t n_overloads, bool cpp_types = false); - static str parameter_string(py_function const &f, size_t n, object arg_names, bool cpp_types); - static str pretty_signature(function const *f, size_t n_overloads, bool cpp_types = false); - -public: - static list function_doc_signatures( function const * f); -}; - -}}}//end of namespace boost::python::objects - -#endif //FUNCTION_SIGNATURE_20070531_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/object/function_handle.hpp b/contrib/restricted/boost/python/include/boost/python/object/function_handle.hpp deleted file mode 100644 index 7edaf2ce3a..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/object/function_handle.hpp +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef FUNCTION_HANDLE_DWA2002725_HPP -# define FUNCTION_HANDLE_DWA2002725_HPP -# include <boost/python/handle.hpp> -# include <boost/python/detail/caller.hpp> -# include <boost/python/default_call_policies.hpp> -# include <boost/python/object/py_function.hpp> -# include <boost/python/signature.hpp> - -namespace boost { namespace python { namespace objects { - -BOOST_PYTHON_DECL handle<> function_handle_impl(py_function const& f); - -// Just like function_object, but returns a handle<> instead. Using -// this for arg_to_python<> allows us to break a circular dependency -// between object and arg_to_python. -template <class F, class Signature> -inline handle<> function_handle(F const& f, Signature) -{ - enum { n_arguments = mpl::size<Signature>::value - 1 }; - - return objects::function_handle_impl( - python::detail::caller< - F,default_call_policies,Signature - >( - f, default_call_policies() - ) - ); -} - -// Just like make_function, but returns a handle<> intead. Same -// reasoning as above. -template <class F> -handle<> make_function_handle(F f) -{ - return objects::function_handle(f, python::detail::get_signature(f)); -} - -}}} // namespace boost::python::objects - -#endif // FUNCTION_HANDLE_DWA2002725_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/object/function_object.hpp b/contrib/restricted/boost/python/include/boost/python/object/function_object.hpp deleted file mode 100644 index eaa079fbe0..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/object/function_object.hpp +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef FUNCTION_OBJECT_DWA2002725_HPP -# define FUNCTION_OBJECT_DWA2002725_HPP -# include <boost/python/detail/prefix.hpp> -# include <boost/function/function2.hpp> -# include <boost/python/object_core.hpp> -# include <boost/python/args_fwd.hpp> -# include <boost/python/object/py_function.hpp> - -namespace boost { namespace python { - -namespace objects -{ - BOOST_PYTHON_DECL api::object function_object( - py_function const& f - , python::detail::keyword_range const&); - - BOOST_PYTHON_DECL api::object function_object( - py_function const& f - , python::detail::keyword_range const&); - - BOOST_PYTHON_DECL api::object function_object(py_function const& f); - - // Add an attribute to the name_space with the given name. If it is - // a Boost.Python function object - // (boost/python/object/function.hpp), and an existing function is - // already there, add it as an overload. - BOOST_PYTHON_DECL void add_to_namespace( - object const& name_space, char const* name, object const& attribute); - - BOOST_PYTHON_DECL void add_to_namespace( - object const& name_space, char const* name, object const& attribute, char const* doc); -} - -}} // namespace boost::python::objects - -#endif // FUNCTION_OBJECT_DWA2002725_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/object/inheritance.hpp b/contrib/restricted/boost/python/include/boost/python/object/inheritance.hpp deleted file mode 100644 index 90e56f0c1d..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/object/inheritance.hpp +++ /dev/null @@ -1,131 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef INHERITANCE_DWA200216_HPP -# define INHERITANCE_DWA200216_HPP - -# include <boost/python/type_id.hpp> -# include <boost/shared_ptr.hpp> -# include <boost/mpl/if.hpp> -# include <boost/detail/workaround.hpp> -# include <boost/python/detail/type_traits.hpp> - -namespace boost { namespace python { namespace objects { - -typedef type_info class_id; -using python::type_id; - -// Types used to get address and id of most derived type -typedef std::pair<void*,class_id> dynamic_id_t; -typedef dynamic_id_t (*dynamic_id_function)(void*); - -BOOST_PYTHON_DECL void register_dynamic_id_aux( - class_id static_id, dynamic_id_function get_dynamic_id); - -BOOST_PYTHON_DECL void add_cast( - class_id src_t, class_id dst_t, void* (*cast)(void*), bool is_downcast); - -// -// a generator with an execute() function which, given a source type -// and a pointer to an object of that type, returns its most-derived -// /reachable/ type identifier and object pointer. -// - -// first, the case where T has virtual functions -template <class T> -struct polymorphic_id_generator -{ - static dynamic_id_t execute(void* p_) - { - T* p = static_cast<T*>(p_); - return std::make_pair(dynamic_cast<void*>(p), class_id(typeid(*p))); - } -}; - -// now, the non-polymorphic case. -template <class T> -struct non_polymorphic_id_generator -{ - static dynamic_id_t execute(void* p_) - { - return std::make_pair(p_, python::type_id<T>()); - } -}; - -// Now the generalized selector -template <class T> -struct dynamic_id_generator - : mpl::if_< - boost::python::detail::is_polymorphic<T> - , boost::python::objects::polymorphic_id_generator<T> - , boost::python::objects::non_polymorphic_id_generator<T> - > -{}; - -// Register the dynamic id function for T with the type-conversion -// system. -template <class T> -void register_dynamic_id(T* = 0) -{ - typedef typename dynamic_id_generator<T>::type generator; - register_dynamic_id_aux( - python::type_id<T>(), &generator::execute); -} - -// -// a generator with an execute() function which, given a void* -// pointing to an object of type Source will attempt to convert it to -// an object of type Target. -// - -template <class Source, class Target> -struct dynamic_cast_generator -{ - static void* execute(void* source) - { - return dynamic_cast<Target*>( - static_cast<Source*>(source)); - } - -}; - -template <class Source, class Target> -struct implicit_cast_generator -{ - static void* execute(void* source) - { - Target* result = static_cast<Source*>(source); - return result; - } -}; - -template <class Source, class Target> -struct cast_generator - : mpl::if_< - boost::python::detail::is_base_and_derived<Target,Source> - , implicit_cast_generator<Source,Target> - , dynamic_cast_generator<Source,Target> - > -{ -}; - -template <class Source, class Target> -inline void register_conversion( - bool is_downcast = ::boost::is_base_and_derived<Source,Target>::value - // These parameters shouldn't be used; they're an MSVC bug workaround - , Source* = 0, Target* = 0) -{ - typedef typename cast_generator<Source,Target>::type generator; - - add_cast( - python::type_id<Source>() - , python::type_id<Target>() - , &generator::execute - , is_downcast - ); -} - -}}} // namespace boost::python::object - -#endif // INHERITANCE_DWA200216_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/object/inheritance_query.hpp b/contrib/restricted/boost/python/include/boost/python/object/inheritance_query.hpp deleted file mode 100644 index 916e161f29..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/object/inheritance_query.hpp +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright David Abrahams 2003. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef INHERITANCE_QUERY_DWA2003520_HPP -# define INHERITANCE_QUERY_DWA2003520_HPP - -# include <boost/python/type_id.hpp> - -namespace boost { namespace python { namespace objects { - -BOOST_PYTHON_DECL void* find_static_type(void* p, type_info src, type_info dst); -BOOST_PYTHON_DECL void* find_dynamic_type(void* p, type_info src, type_info dst); - -}}} // namespace boost::python::object - -#endif // INHERITANCE_QUERY_DWA2003520_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/object/instance.hpp b/contrib/restricted/boost/python/include/boost/python/object/instance.hpp deleted file mode 100644 index ee4a6c5822..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/object/instance.hpp +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef INSTANCE_DWA200295_HPP -# define INSTANCE_DWA200295_HPP - -# include <boost/python/detail/prefix.hpp> -# include <boost/python/detail/type_traits.hpp> -# include <cstddef> - -namespace boost { namespace python -{ - struct instance_holder; -}} // namespace boost::python - -namespace boost { namespace python { namespace objects { - -// Each extension instance will be one of these -template <class Data = char> -struct instance -{ - PyObject_VAR_HEAD - PyObject* dict; - PyObject* weakrefs; - instance_holder* objects; - - typedef typename boost::python::detail::type_with_alignment< - boost::python::detail::alignment_of<Data>::value - >::type align_t; - - union - { - align_t align; - char bytes[sizeof(Data)]; - } storage; -}; - -template <class Data> -struct additional_instance_size -{ - typedef instance<Data> instance_data; - typedef instance<char> instance_char; - BOOST_STATIC_CONSTANT(std::size_t, - value = sizeof(instance_data) - - BOOST_PYTHON_OFFSETOF(instance_char,storage) + - boost::python::detail::alignment_of<Data>::value); -}; - -}}} // namespace boost::python::object - -#endif // INSTANCE_DWA200295_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/object/iterator_core.hpp b/contrib/restricted/boost/python/include/boost/python/object/iterator_core.hpp deleted file mode 100644 index 064accc5a8..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/object/iterator_core.hpp +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef ITERATOR_CORE_DWA2002512_HPP -# define ITERATOR_CORE_DWA2002512_HPP - -# include <boost/python/object_fwd.hpp> - -namespace boost { namespace python { namespace objects { - -BOOST_PYTHON_DECL object const& identity_function(); -BOOST_PYTHON_DECL void stop_iteration_error(); - -}}} // namespace boost::python::object - -#endif // ITERATOR_CORE_DWA2002512_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/object/life_support.hpp b/contrib/restricted/boost/python/include/boost/python/object/life_support.hpp deleted file mode 100644 index 9a1b16b689..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/object/life_support.hpp +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef LIFE_SUPPORT_DWA200222_HPP -# define LIFE_SUPPORT_DWA200222_HPP -# include <boost/python/detail/prefix.hpp> - -namespace boost { namespace python { namespace objects { - -BOOST_PYTHON_DECL PyObject* make_nurse_and_patient(PyObject* nurse, PyObject* patient); - -}}} // namespace boost::python::object - -#endif // LIFE_SUPPORT_DWA200222_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/object/make_instance.hpp b/contrib/restricted/boost/python/include/boost/python/object/make_instance.hpp deleted file mode 100644 index 713fdc5ecd..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/object/make_instance.hpp +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef MAKE_INSTANCE_DWA200296_HPP -# define MAKE_INSTANCE_DWA200296_HPP - -# include <boost/python/detail/prefix.hpp> -# include <boost/python/object/instance.hpp> -# include <boost/python/converter/registered.hpp> -# include <boost/python/detail/decref_guard.hpp> -# include <boost/python/detail/type_traits.hpp> -# include <boost/python/detail/none.hpp> -# include <boost/mpl/assert.hpp> -# include <boost/mpl/or.hpp> - -namespace boost { namespace python { namespace objects { - -template <class T, class Holder, class Derived> -struct make_instance_impl -{ - typedef objects::instance<Holder> instance_t; - - template <class Arg> - static inline PyObject* execute(Arg& x) - { - BOOST_MPL_ASSERT((mpl::or_<boost::python::detail::is_class<T>, - boost::python::detail::is_union<T> >)); - - PyTypeObject* type = Derived::get_class_object(x); - - if (type == 0) - return python::detail::none(); - - PyObject* raw_result = type->tp_alloc( - type, objects::additional_instance_size<Holder>::value); - - if (raw_result != 0) - { - python::detail::decref_guard protect(raw_result); - - instance_t* instance = (instance_t*)raw_result; - - // construct the new C++ object and install the pointer - // in the Python object. - Holder *holder =Derived::construct(instance->storage.bytes, (PyObject*)instance, x); - holder->install(raw_result); - - // Note the position of the internally-stored Holder, - // for the sake of destruction - const size_t offset = reinterpret_cast<size_t>(holder) - - reinterpret_cast<size_t>(instance->storage.bytes) + offsetof(instance_t, storage); - Py_SET_SIZE(instance, offset); - - // Release ownership of the python object - protect.cancel(); - } - return raw_result; - } -}; - - -template <class T, class Holder> -struct make_instance - : make_instance_impl<T, Holder, make_instance<T,Holder> > -{ - template <class U> - static inline PyTypeObject* get_class_object(U&) - { - return converter::registered<T>::converters.get_class_object(); - } - - static inline Holder* construct(void* storage, PyObject* instance, reference_wrapper<T const> x) - { - size_t allocated = objects::additional_instance_size<Holder>::value; - void* aligned_storage = ::boost::alignment::align(boost::python::detail::alignment_of<Holder>::value, - sizeof(Holder), storage, allocated); - return new (aligned_storage) Holder(instance, x); - } -}; - - -}}} // namespace boost::python::object - -#endif // MAKE_INSTANCE_DWA200296_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/object/make_ptr_instance.hpp b/contrib/restricted/boost/python/include/boost/python/object/make_ptr_instance.hpp deleted file mode 100644 index 92412b31fe..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/object/make_ptr_instance.hpp +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef MAKE_PTR_INSTANCE_DWA200296_HPP -# define MAKE_PTR_INSTANCE_DWA200296_HPP - -# include <boost/python/object/make_instance.hpp> -# include <boost/python/converter/registry.hpp> -# include <boost/python/detail/type_traits.hpp> -# include <boost/get_pointer.hpp> -# include <boost/detail/workaround.hpp> -# include <typeinfo> - -namespace boost { namespace python { namespace objects { - -template <class T, class Holder> -struct make_ptr_instance - : make_instance_impl<T, Holder, make_ptr_instance<T,Holder> > -{ - template <class Arg> - static inline Holder* construct(void* storage, PyObject*, Arg& x) - { -#if defined(BOOST_NO_CXX11_SMART_PTR) - return new (storage) Holder(x); -#else - return new (storage) Holder(std::move(x)); -#endif - } - - template <class Ptr> - static inline PyTypeObject* get_class_object(Ptr const& x) - { - return get_class_object_impl(get_pointer(x)); - } -#ifndef BOOST_PYTHON_NO_PY_SIGNATURES - static inline PyTypeObject const* get_pytype() - { - return converter::registered<T>::converters.get_class_object(); - } -#endif - private: - template <class U> - static inline PyTypeObject* get_class_object_impl(U const volatile* p) - { - if (p == 0) - return 0; // means "return None". - - PyTypeObject* derived = get_derived_class_object( - BOOST_DEDUCED_TYPENAME boost::python::detail::is_polymorphic<U>::type(), p); - - if (derived) - return derived; - return converter::registered<T>::converters.get_class_object(); - } - - template <class U> - static inline PyTypeObject* get_derived_class_object(boost::python::detail::true_, U const volatile* x) - { - converter::registration const* r = converter::registry::query( - type_info(typeid(*x)) - ); - return r ? r->m_class_object : 0; - } - - template <class U> - static inline PyTypeObject* get_derived_class_object(boost::python::detail::false_, U*) - { - return 0; - } -}; - - -}}} // namespace boost::python::object - -#endif // MAKE_PTR_INSTANCE_DWA200296_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/object/pickle_support.hpp b/contrib/restricted/boost/python/include/boost/python/object/pickle_support.hpp deleted file mode 100644 index aa96d655ee..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/object/pickle_support.hpp +++ /dev/null @@ -1,124 +0,0 @@ -// (C) Copyright R.W. Grosse-Kunstleve 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_PYTHON_OBJECT_PICKLE_SUPPORT_RWGK20020603_HPP -# define BOOST_PYTHON_OBJECT_PICKLE_SUPPORT_RWGK20020603_HPP - -# include <boost/python/detail/prefix.hpp> - -namespace boost { namespace python { - -namespace api -{ - class object; -} -using api::object; -class tuple; - -BOOST_PYTHON_DECL object const& make_instance_reduce_function(); - -struct pickle_suite; - -namespace error_messages { - - template <class T> - struct missing_pickle_suite_function_or_incorrect_signature {}; - - inline void must_be_derived_from_pickle_suite(pickle_suite const&) {} -} - -namespace detail { struct pickle_suite_registration; } - -struct pickle_suite -{ - private: - struct inaccessible {}; - friend struct detail::pickle_suite_registration; - public: - static inaccessible* getinitargs() { return 0; } - static inaccessible* getstate() { return 0; } - static inaccessible* setstate() { return 0; } - static bool getstate_manages_dict() { return false; } -}; - -namespace detail { - - struct pickle_suite_registration - { - typedef pickle_suite::inaccessible inaccessible; - - template <class Class_, class Tgetinitargs> - static - void - register_( - Class_& cl, - tuple (*getinitargs_fn)(Tgetinitargs), - inaccessible* (* /*getstate_fn*/)(), - inaccessible* (* /*setstate_fn*/)(), - bool) - { - cl.enable_pickling_(false); - cl.def("__getinitargs__", getinitargs_fn); - } - - template <class Class_, - class Rgetstate, class Tgetstate, - class Tsetstate, class Ttuple> - static - void - register_( - Class_& cl, - inaccessible* (* /*getinitargs_fn*/)(), - Rgetstate (*getstate_fn)(Tgetstate), - void (*setstate_fn)(Tsetstate, Ttuple), - bool getstate_manages_dict) - { - cl.enable_pickling_(getstate_manages_dict); - cl.def("__getstate__", getstate_fn); - cl.def("__setstate__", setstate_fn); - } - - template <class Class_, - class Tgetinitargs, - class Rgetstate, class Tgetstate, - class Tsetstate, class Ttuple> - static - void - register_( - Class_& cl, - tuple (*getinitargs_fn)(Tgetinitargs), - Rgetstate (*getstate_fn)(Tgetstate), - void (*setstate_fn)(Tsetstate, Ttuple), - bool getstate_manages_dict) - { - cl.enable_pickling_(getstate_manages_dict); - cl.def("__getinitargs__", getinitargs_fn); - cl.def("__getstate__", getstate_fn); - cl.def("__setstate__", setstate_fn); - } - - template <class Class_> - static - void - register_( - Class_&, - ...) - { - typedef typename - error_messages::missing_pickle_suite_function_or_incorrect_signature< - Class_>::error_type error_type BOOST_ATTRIBUTE_UNUSED; - } - }; - - template <typename PickleSuiteType> - struct pickle_suite_finalize - : PickleSuiteType, - pickle_suite_registration - {}; - -} // namespace detail - -}} // namespace boost::python - -#endif // BOOST_PYTHON_OBJECT_PICKLE_SUPPORT_RWGK20020603_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/object/pointer_holder.hpp b/contrib/restricted/boost/python/include/boost/python/object/pointer_holder.hpp deleted file mode 100644 index c3b57e833a..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/object/pointer_holder.hpp +++ /dev/null @@ -1,227 +0,0 @@ -#if !defined(BOOST_PP_IS_ITERATING) - -// Copyright David Abrahams 2001. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -# ifndef POINTER_HOLDER_DWA20011215_HPP -# define POINTER_HOLDER_DWA20011215_HPP - -# include <boost/get_pointer.hpp> -# include <boost/type.hpp> - -# include <boost/python/instance_holder.hpp> -# include <boost/python/object/inheritance_query.hpp> -# include <boost/python/object/forward.hpp> - -# include <boost/python/pointee.hpp> -# include <boost/python/type_id.hpp> - -# include <boost/python/detail/wrapper_base.hpp> -# include <boost/python/detail/force_instantiate.hpp> -# include <boost/python/detail/preprocessor.hpp> -# include <boost/python/detail/type_traits.hpp> - - -# include <boost/mpl/if.hpp> -# include <boost/mpl/apply.hpp> - -# include <boost/preprocessor/comma_if.hpp> -# include <boost/preprocessor/iterate.hpp> -# include <boost/preprocessor/repeat.hpp> -# include <boost/preprocessor/debug/line.hpp> -# include <boost/preprocessor/enum_params.hpp> -# include <boost/preprocessor/repetition/enum_binary_params.hpp> - -# include <boost/detail/workaround.hpp> - -namespace boost { namespace python { - -template <class T> class wrapper; - -}} - - -namespace boost { namespace python { namespace objects { - -#define BOOST_PYTHON_UNFORWARD_LOCAL(z, n, _) BOOST_PP_COMMA_IF(n) objects::do_unforward(a##n,0) - -template <class Pointer, class Value> -struct pointer_holder : instance_holder -{ - typedef Value value_type; - - pointer_holder(Pointer); - - // Forward construction to the held object - -# define BOOST_PP_ITERATION_PARAMS_1 (4, (0, BOOST_PYTHON_MAX_ARITY, <boost/python/object/pointer_holder.hpp>, 1)) -# include BOOST_PP_ITERATE() - - private: // types - - private: // required holder implementation - void* holds(type_info, bool null_ptr_only); - - template <class T> - inline void* holds_wrapped(type_info dst_t, wrapper<T>*,T* p) - { - return python::type_id<T>() == dst_t ? p : 0; - } - - inline void* holds_wrapped(type_info, ...) - { - return 0; - } - - private: // data members - Pointer m_p; -}; - -template <class Pointer, class Value> -struct pointer_holder_back_reference : instance_holder -{ - private: - typedef typename python::pointee<Pointer>::type held_type; - public: - typedef Value value_type; - - // Not sure about this one -- can it work? The source object - // undoubtedly does not carry the correct back reference pointer. - pointer_holder_back_reference(Pointer); - - // Forward construction to the held object -# define BOOST_PP_ITERATION_PARAMS_1 (4, (0, BOOST_PYTHON_MAX_ARITY, <boost/python/object/pointer_holder.hpp>, 2)) -# include BOOST_PP_ITERATE() - - private: // required holder implementation - void* holds(type_info, bool null_ptr_only); - - private: // data members - Pointer m_p; -}; - -# undef BOOST_PYTHON_UNFORWARD_LOCAL - -template <class Pointer, class Value> -inline pointer_holder<Pointer,Value>::pointer_holder(Pointer p) -#if defined(BOOST_NO_CXX11_SMART_PTR) - : m_p(p) -#else - : m_p(std::move(p)) -#endif -{ -} - -template <class Pointer, class Value> -inline pointer_holder_back_reference<Pointer,Value>::pointer_holder_back_reference(Pointer p) -#if defined(BOOST_NO_CXX11_SMART_PTR) - : m_p(p) -#else - : m_p(std::move(p)) -#endif -{ -} - -template <class Pointer, class Value> -void* pointer_holder<Pointer, Value>::holds(type_info dst_t, bool null_ptr_only) -{ - typedef typename boost::python::detail::remove_const< Value >::type non_const_value; - - if (dst_t == python::type_id<Pointer>() - && !(null_ptr_only && get_pointer(this->m_p)) - ) - return &this->m_p; - - Value* p0 -# if BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x590)) - = static_cast<Value*>( get_pointer(this->m_p) ) -# else - = get_pointer(this->m_p) -# endif - ; - non_const_value* p = const_cast<non_const_value*>( p0 ); - - if (p == 0) - return 0; - - if (void* wrapped = holds_wrapped(dst_t, p, p)) - return wrapped; - - type_info src_t = python::type_id<non_const_value>(); - return src_t == dst_t ? p : find_dynamic_type(p, src_t, dst_t); -} - -template <class Pointer, class Value> -void* pointer_holder_back_reference<Pointer, Value>::holds(type_info dst_t, bool null_ptr_only) -{ - if (dst_t == python::type_id<Pointer>() - && !(null_ptr_only && get_pointer(this->m_p)) - ) - return &this->m_p; - - if (!get_pointer(this->m_p)) - return 0; - - Value* p = get_pointer(m_p); - - if (dst_t == python::type_id<held_type>()) - return p; - - type_info src_t = python::type_id<Value>(); - return src_t == dst_t ? p : find_dynamic_type(p, src_t, dst_t); -} - -}}} // namespace boost::python::objects - -# endif // POINTER_HOLDER_DWA20011215_HPP - -/* --------------- pointer_holder --------------- */ -// For gcc 4.4 compatability, we must include the -// BOOST_PP_ITERATION_DEPTH test inside an #else clause. -#else // BOOST_PP_IS_ITERATING -#if BOOST_PP_ITERATION_DEPTH() == 1 && BOOST_PP_ITERATION_FLAGS() == 1 -# if !(BOOST_WORKAROUND(__MWERKS__, > 0x3100) \ - && BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3201))) -# line BOOST_PP_LINE(__LINE__, pointer_holder.hpp) -# endif - -# define N BOOST_PP_ITERATION() - -# if (N != 0) - template< BOOST_PP_ENUM_PARAMS_Z(1, N, class A) > -# endif - pointer_holder(PyObject* self BOOST_PP_COMMA_IF(N) BOOST_PP_ENUM_BINARY_PARAMS_Z(1, N, A, a)) - : m_p(new Value( - BOOST_PP_REPEAT_1ST(N, BOOST_PYTHON_UNFORWARD_LOCAL, nil) - )) - { - python::detail::initialize_wrapper(self, get_pointer(this->m_p)); - } - -# undef N - -/* --------------- pointer_holder_back_reference --------------- */ -#elif BOOST_PP_ITERATION_DEPTH() == 1 && BOOST_PP_ITERATION_FLAGS() == 2 -# if !(BOOST_WORKAROUND(__MWERKS__, > 0x3100) \ - && BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3201))) -# line BOOST_PP_LINE(__LINE__, pointer_holder.hpp(pointer_holder_back_reference)) -# endif - -# define N BOOST_PP_ITERATION() - -# if (N != 0) - template < BOOST_PP_ENUM_PARAMS_Z(1, N, class A) > -# endif - pointer_holder_back_reference( - PyObject* p BOOST_PP_COMMA_IF(N) BOOST_PP_ENUM_BINARY_PARAMS_Z(1, N, A, a)) - : m_p(new held_type( - p BOOST_PP_COMMA_IF(N) BOOST_PP_REPEAT_1ST(N, BOOST_PYTHON_UNFORWARD_LOCAL, nil) - )) - {} - -# undef N - -#endif // BOOST_PP_ITERATION_DEPTH() -#endif diff --git a/contrib/restricted/boost/python/include/boost/python/object/py_function.hpp b/contrib/restricted/boost/python/include/boost/python/object/py_function.hpp deleted file mode 100644 index df2fb44a4f..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/object/py_function.hpp +++ /dev/null @@ -1,180 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef PY_FUNCTION_DWA200286_HPP -# define PY_FUNCTION_DWA200286_HPP - -# include <boost/python/detail/signature.hpp> -# include <boost/detail/workaround.hpp> -# include <boost/mpl/size.hpp> -# include <memory> - -namespace boost { namespace python { namespace objects { - -// This type is used as a "generalized Python callback", wrapping the -// function signature: -// -// PyObject* (PyObject* args, PyObject* keywords) - -struct BOOST_PYTHON_DECL py_function_impl_base -{ - virtual ~py_function_impl_base(); - virtual PyObject* operator()(PyObject*, PyObject*) = 0; - virtual unsigned min_arity() const = 0; - virtual unsigned max_arity() const; - virtual python::detail::py_func_sig_info signature() const = 0; -}; - -template <class Caller> -struct caller_py_function_impl : py_function_impl_base -{ - caller_py_function_impl(Caller const& caller) - : m_caller(caller) - {} - - PyObject* operator()(PyObject* args, PyObject* kw) - { - return m_caller(args, kw); - } - - virtual unsigned min_arity() const - { - return m_caller.min_arity(); - } - - virtual python::detail::py_func_sig_info signature() const - { - return m_caller.signature(); - } - - private: - Caller m_caller; -}; - -template <class Caller, class Sig> -struct signature_py_function_impl : py_function_impl_base -{ - signature_py_function_impl(Caller const& caller) - : m_caller(caller) - {} - - PyObject* operator()(PyObject* args, PyObject* kw) - { - return m_caller(args, kw); - } - - virtual unsigned min_arity() const - { - return mpl::size<Sig>::value - 1; - } - - virtual python::detail::py_func_sig_info signature() const - { - python::detail::signature_element const* sig = python::detail::signature<Sig>::elements(); - python::detail::py_func_sig_info res = {sig, sig}; - return res; - } - - private: - Caller m_caller; -}; - -template <class Caller, class Sig> -struct full_py_function_impl : py_function_impl_base -{ - full_py_function_impl(Caller const& caller, unsigned min_arity, unsigned max_arity) - : m_caller(caller) - , m_min_arity(min_arity) - , m_max_arity(max_arity > min_arity ? max_arity : min_arity) - {} - - PyObject* operator()(PyObject* args, PyObject* kw) - { - return m_caller(args, kw); - } - - virtual unsigned min_arity() const - { - return m_min_arity; - } - - virtual unsigned max_arity() const - { - return m_max_arity; - } - - virtual python::detail::py_func_sig_info signature() const - { - python::detail::signature_element const* sig = python::detail::signature<Sig>::elements(); - python::detail::py_func_sig_info res = {sig, sig}; - return res; - } - - private: - Caller m_caller; - unsigned m_min_arity; - unsigned m_max_arity; -}; - -struct py_function -{ - template <class Caller> - py_function(Caller const& caller) - : m_impl(new caller_py_function_impl<Caller>(caller)) - {} - - template <class Caller, class Sig> - py_function(Caller const& caller, Sig) - : m_impl(new signature_py_function_impl<Caller, Sig>(caller)) - {} - - template <class Caller, class Sig> - py_function(Caller const& caller, Sig, int min_arity, int max_arity = 0) - : m_impl(new full_py_function_impl<Caller, Sig>(caller, min_arity, max_arity)) - {} - - py_function(py_function const& rhs) -#if defined(BOOST_NO_CXX11_SMART_PTR) - : m_impl(rhs.m_impl) -#else - : m_impl(std::move(rhs.m_impl)) -#endif - {} - - PyObject* operator()(PyObject* args, PyObject* kw) const - { - return (*m_impl)(args, kw); - } - - unsigned min_arity() const - { - return m_impl->min_arity(); - } - - unsigned max_arity() const - { - return m_impl->max_arity(); - } - - python::detail::signature_element const* signature() const - { - return m_impl->signature().signature; - } - - python::detail::signature_element const& get_return_type() const - { - return *m_impl->signature().ret; - } - - private: -#if defined(BOOST_NO_CXX11_SMART_PTR) - mutable std::auto_ptr<py_function_impl_base> m_impl; -#else - mutable std::unique_ptr<py_function_impl_base> m_impl; -#endif -}; - -}}} // namespace boost::python::objects - -#endif // PY_FUNCTION_DWA200286_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/object/stl_iterator_core.hpp b/contrib/restricted/boost/python/include/boost/python/object/stl_iterator_core.hpp deleted file mode 100644 index 68e0c2441b..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/object/stl_iterator_core.hpp +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright Eric Niebler 2005. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef STL_ITERATOR_CORE_EAN20051028_HPP -# define STL_ITERATOR_CORE_EAN20051028_HPP - -# include <boost/python/object_fwd.hpp> -# include <boost/python/handle_fwd.hpp> - -namespace boost { namespace python { namespace objects { - -struct BOOST_PYTHON_DECL stl_input_iterator_impl -{ - stl_input_iterator_impl(); - stl_input_iterator_impl(boost::python::object const &ob); - void increment(); - bool equal(stl_input_iterator_impl const &that) const; - boost::python::handle<> const ¤t() const; -private: - boost::python::object it_; - boost::python::handle<> ob_; -}; - -}}} // namespace boost::python::object - -#endif // STL_ITERATOR_CORE_EAN20051028_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/object_attributes.hpp b/contrib/restricted/boost/python/include/boost/python/object_attributes.hpp deleted file mode 100644 index 26d599113f..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/object_attributes.hpp +++ /dev/null @@ -1,116 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef OBJECT_ATTRIBUTES_DWA2002615_HPP -# define OBJECT_ATTRIBUTES_DWA2002615_HPP - -# include <boost/python/detail/prefix.hpp> - -# include <boost/python/proxy.hpp> -# include <boost/python/object_core.hpp> -# include <boost/python/object_protocol.hpp> - -namespace boost { namespace python { namespace api { - -struct const_attribute_policies -{ - typedef char const* key_type; - static object get(object const& target, char const* key); - static object get(object const& target, object const& key); -}; - -struct attribute_policies : const_attribute_policies -{ - static object const& set(object const& target, char const* key, object const& value); - static void del(object const&target, char const* key); -}; - -struct const_objattribute_policies -{ - typedef object const key_type; - static object get(object const& target, object const& key); -}; - -struct objattribute_policies : const_objattribute_policies -{ - static object const& set(object const& target, object const& key, object const& value); - static void del(object const&target, object const& key); -}; - -// -// implementation -// -template <class U> -inline object_attribute object_operators<U>::attr(char const* name) -{ - object_cref2 x = *static_cast<U*>(this); - return object_attribute(x, name); -} - -template <class U> -inline const_object_attribute object_operators<U>::attr(char const* name) const -{ - object_cref2 x = *static_cast<U const*>(this); - return const_object_attribute(x, name); -} - -template <class U> -inline object_objattribute object_operators<U>::attr(object const& name) -{ - object_cref2 x = *static_cast<U*>(this); - return object_objattribute(x, name); -} - -template <class U> -inline const_object_objattribute object_operators<U>::attr(object const& name) const -{ - object_cref2 x = *static_cast<U const*>(this); - return const_object_objattribute(x, name); -} - -inline object const_attribute_policies::get(object const& target, char const* key) -{ - return python::getattr(target, key); -} - -inline object const_objattribute_policies::get(object const& target, object const& key) -{ - return python::getattr(target, key); -} - -inline object const& attribute_policies::set( - object const& target - , char const* key - , object const& value) -{ - python::setattr(target, key, value); - return value; -} - -inline object const& objattribute_policies::set( - object const& target - , object const& key - , object const& value) -{ - python::setattr(target, key, value); - return value; -} - -inline void attribute_policies::del( - object const& target - , char const* key) -{ - python::delattr(target, key); -} - -inline void objattribute_policies::del( - object const& target - , object const& key) -{ - python::delattr(target, key); -} - -}}} // namespace boost::python::api - -#endif // OBJECT_ATTRIBUTES_DWA2002615_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/object_core.hpp b/contrib/restricted/boost/python/include/boost/python/object_core.hpp deleted file mode 100644 index 16480d0d89..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/object_core.hpp +++ /dev/null @@ -1,480 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef OBJECT_CORE_DWA2002615_HPP -# define OBJECT_CORE_DWA2002615_HPP - -# define BOOST_PYTHON_OBJECT_HAS_IS_NONE // added 2010-03-15 by rwgk - -# include <boost/python/detail/prefix.hpp> - -# include <boost/type.hpp> - -# include <boost/python/call.hpp> -# include <boost/python/handle_fwd.hpp> -# include <boost/python/errors.hpp> -# include <boost/python/refcount.hpp> -# include <boost/python/detail/preprocessor.hpp> -# include <boost/python/tag.hpp> -# include <boost/python/def_visitor.hpp> - -# include <boost/python/detail/raw_pyobject.hpp> -# include <boost/python/detail/dependent.hpp> - -# include <boost/python/object/forward.hpp> -# include <boost/python/object/add_to_namespace.hpp> - -# include <boost/preprocessor/iterate.hpp> -# include <boost/preprocessor/debug/line.hpp> - -# include <boost/python/detail/is_xxx.hpp> -# include <boost/python/detail/string_literal.hpp> -# include <boost/python/detail/def_helper_fwd.hpp> -# include <boost/python/detail/type_traits.hpp> - -namespace boost { namespace python { - -namespace detail -{ - class kwds_proxy; - class args_proxy; -} - -namespace converter -{ - template <class T> struct arg_to_python; -} - -// Put this in an inner namespace so that the generalized operators won't take over -namespace api -{ - -// This file contains the definition of the object class and enough to -// construct/copy it, but not enough to do operations like -// attribute/item access or addition. - - template <class Policies> class proxy; - - struct const_attribute_policies; - struct attribute_policies; - struct const_objattribute_policies; - struct objattribute_policies; - struct const_item_policies; - struct item_policies; - struct const_slice_policies; - struct slice_policies; - class slice_nil; - - typedef proxy<const_attribute_policies> const_object_attribute; - typedef proxy<attribute_policies> object_attribute; - typedef proxy<const_objattribute_policies> const_object_objattribute; - typedef proxy<objattribute_policies> object_objattribute; - typedef proxy<const_item_policies> const_object_item; - typedef proxy<item_policies> object_item; - typedef proxy<const_slice_policies> const_object_slice; - typedef proxy<slice_policies> object_slice; - - // - // is_proxy -- proxy type detection - // - BOOST_PYTHON_IS_XXX_DEF(proxy, boost::python::api::proxy, 1) - - template <class T> struct object_initializer; - - class object; - typedef PyObject* (object::*bool_type)() const; - - template <class U> - class object_operators : public def_visitor<U> - { - protected: - typedef object const& object_cref; - public: - // function call - // - object operator()() const; - -# define BOOST_PP_ITERATION_PARAMS_1 (3, (1, BOOST_PYTHON_MAX_ARITY, <boost/python/object_call.hpp>)) -# include BOOST_PP_ITERATE() - - detail::args_proxy operator* () const; - object operator()(detail::args_proxy const &args) const; - object operator()(detail::args_proxy const &args, - detail::kwds_proxy const &kwds) const; - - // truth value testing - // - operator bool_type() const; - bool operator!() const; // needed for vc6 - - // Attribute access - // - const_object_attribute attr(char const*) const; - object_attribute attr(char const*); - const_object_objattribute attr(object const&) const; - object_objattribute attr(object const&); - - // Wrap 'in' operator (aka. __contains__) - template <class T> - object contains(T const& key) const; - - // item access - // - const_object_item operator[](object_cref) const; - object_item operator[](object_cref); - - template <class T> - const_object_item - operator[](T const& key) const; - - template <class T> - object_item - operator[](T const& key); - - // slicing - // - const_object_slice slice(object_cref, object_cref) const; - object_slice slice(object_cref, object_cref); - - const_object_slice slice(slice_nil, object_cref) const; - object_slice slice(slice_nil, object_cref); - - const_object_slice slice(object_cref, slice_nil) const; - object_slice slice(object_cref, slice_nil); - - const_object_slice slice(slice_nil, slice_nil) const; - object_slice slice(slice_nil, slice_nil); - - template <class T, class V> - const_object_slice - slice(T const& start, V const& end) const; - - template <class T, class V> - object_slice - slice(T const& start, V const& end); - - private: // def visitation for adding callable objects as class methods - - template <class ClassT, class DocStringT> - void visit(ClassT& cl, char const* name, python::detail::def_helper<DocStringT> const& helper) const - { - // It's too late to specify anything other than docstrings if - // the callable object is already wrapped. - BOOST_STATIC_ASSERT( - (detail::is_same<char const*,DocStringT>::value - || detail::is_string_literal<DocStringT const>::value)); - - objects::add_to_namespace(cl, name, this->derived_visitor(), helper.doc()); - } - - friend class python::def_visitor_access; - - private: - // there is a confirmed CWPro8 codegen bug here. We prevent the - // early destruction of a temporary by binding a named object - // instead. -# if __MWERKS__ < 0x3000 || __MWERKS__ > 0x3003 - typedef object const& object_cref2; -# else - typedef object const object_cref2; -# endif - }; - - - // VC6 and VC7 require this base class in order to generate the - // correct copy constructor for object. We can't define it there - // explicitly or it will complain of ambiguity. - struct object_base : object_operators<object> - { - // copy constructor without NULL checking, for efficiency. - inline object_base(object_base const&); - inline object_base(PyObject* ptr); - - inline object_base& operator=(object_base const& rhs); - inline ~object_base(); - - // Underlying object access -- returns a borrowed reference - inline PyObject* ptr() const; - - inline bool is_none() const; - - private: - PyObject* m_ptr; - }; - - template <class T, class U> - struct is_derived - : boost::python::detail::is_convertible< - typename detail::remove_reference<T>::type* - , U const* - > - {}; - - template <class T> - typename objects::unforward_cref<T>::type do_unforward_cref(T const& x) - { - return x; - } - - class object; - - template <class T> - PyObject* object_base_initializer(T const& x) - { - typedef typename is_derived< - BOOST_DEDUCED_TYPENAME objects::unforward_cref<T>::type - , object - >::type is_obj; - - return object_initializer< - BOOST_DEDUCED_TYPENAME unwrap_reference<T>::type - >::get( - x - , is_obj() - ); - } - - class object : public object_base - { - public: - // default constructor creates a None object - object(); - - // explicit conversion from any C++ object to Python - template <class T> - explicit object(T const& x) - : object_base(object_base_initializer(x)) - { - } - - // Throw error_already_set() if the handle is null. - BOOST_PYTHON_DECL explicit object(handle<> const&); - private: - - public: // implementation detail -- for internal use only - explicit object(detail::borrowed_reference); - explicit object(detail::new_reference); - explicit object(detail::new_non_null_reference); - }; - - // Macros for forwarding constructors in classes derived from - // object. Derived classes will usually want these as an - // implementation detail -# define BOOST_PYTHON_FORWARD_OBJECT_CONSTRUCTORS(derived, base) \ - inline explicit derived(::boost::python::detail::borrowed_reference p) \ - : base(p) {} \ - inline explicit derived(::boost::python::detail::new_reference p) \ - : base(p) {} \ - inline explicit derived(::boost::python::detail::new_non_null_reference p) \ - : base(p) {} - - // - // object_initializer -- get the handle to construct the object with, - // based on whether T is a proxy or derived from object - // - template <bool is_proxy = false, bool is_object_manager = false> - struct object_initializer_impl - { - static PyObject* - get(object const& x, detail::true_) - { - return python::incref(x.ptr()); - } - - template <class T> - static PyObject* - get(T const& x, detail::false_) - { - return python::incref(converter::arg_to_python<T>(x).get()); - } - }; - - template <> - struct object_initializer_impl<true, false> - { - template <class Policies> - static PyObject* - get(proxy<Policies> const& x, detail::false_) - { - return python::incref(x.operator object().ptr()); - } - }; - - template <> - struct object_initializer_impl<false, true> - { - template <class T, class U> - static PyObject* - get(T const& x, U) - { - return python::incref(get_managed_object(x, boost::python::tag)); - } - }; - - template <> - struct object_initializer_impl<true, true> - {}; // empty implementation should cause an error - - template <class T> - struct object_initializer : object_initializer_impl< - is_proxy<T>::value - , converter::is_object_manager<T>::value - > - {}; - -} -using api::object; -template <class T> struct extract; - -// -// implementation -// - -namespace detail -{ - -class call_proxy -{ -public: - call_proxy(object target) : m_target(target) {} - operator object() const { return m_target;} - - private: - object m_target; -}; - -class kwds_proxy : public call_proxy -{ -public: - kwds_proxy(object o = object()) : call_proxy(o) {} -}; -class args_proxy : public call_proxy -{ -public: - args_proxy(object o) : call_proxy(o) {} - kwds_proxy operator* () const { return kwds_proxy(*this);} -}; -} - -template <typename U> -detail::args_proxy api::object_operators<U>::operator* () const -{ - object_cref2 x = *static_cast<U const*>(this); - return boost::python::detail::args_proxy(x); -} - -template <typename U> -object api::object_operators<U>::operator()(detail::args_proxy const &args) const -{ - U const& self = *static_cast<U const*>(this); - PyObject *result = PyObject_Call(get_managed_object(self, boost::python::tag), - args.operator object().ptr(), - 0); - return object(boost::python::detail::new_reference(result)); - -} - -template <typename U> -object api::object_operators<U>::operator()(detail::args_proxy const &args, - detail::kwds_proxy const &kwds) const -{ - U const& self = *static_cast<U const*>(this); - PyObject *result = PyObject_Call(get_managed_object(self, boost::python::tag), - args.operator object().ptr(), - kwds.operator object().ptr()); - return object(boost::python::detail::new_reference(result)); - -} - - -template <typename U> -template <class T> -object api::object_operators<U>::contains(T const& key) const -{ - return this->attr("__contains__")(object(key)); -} - - -inline object::object() - : object_base(python::incref(Py_None)) -{} - -// copy constructor without NULL checking, for efficiency -inline api::object_base::object_base(object_base const& rhs) - : m_ptr(python::incref(rhs.m_ptr)) -{} - -inline api::object_base::object_base(PyObject* p) - : m_ptr(p) -{} - -inline api::object_base& api::object_base::operator=(api::object_base const& rhs) -{ - Py_INCREF(rhs.m_ptr); - Py_DECREF(this->m_ptr); - this->m_ptr = rhs.m_ptr; - return *this; -} - -inline api::object_base::~object_base() -{ - assert( Py_REFCNT(m_ptr) > 0 ); - Py_DECREF(m_ptr); -} - -inline object::object(detail::borrowed_reference p) - : object_base(python::incref((PyObject*)p)) -{} - -inline object::object(detail::new_reference p) - : object_base(expect_non_null((PyObject*)p)) -{} - -inline object::object(detail::new_non_null_reference p) - : object_base((PyObject*)p) -{} - -inline PyObject* api::object_base::ptr() const -{ - return m_ptr; -} - -inline bool api::object_base::is_none() const -{ - return (m_ptr == Py_None); -} - -// -// Converter specialization implementations -// -namespace converter -{ - template <class T> struct object_manager_traits; - - template <> - struct object_manager_traits<object> - { - BOOST_STATIC_CONSTANT(bool, is_specialized = true); - static bool check(PyObject*) { return true; } - - static python::detail::new_non_null_reference adopt(PyObject* x) - { - return python::detail::new_non_null_reference(x); - } -#ifndef BOOST_PYTHON_NO_PY_SIGNATURES - static PyTypeObject const *get_pytype() {return 0;} -#endif - }; -} - -inline PyObject* get_managed_object(object const& x, tag_t) -{ - return x.ptr(); -} - -}} // namespace boost::python - -# include <boost/python/slice_nil.hpp> - -#endif // OBJECT_CORE_DWA2002615_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/object_fwd.hpp b/contrib/restricted/boost/python/include/boost/python/object_fwd.hpp deleted file mode 100644 index 11efcc7075..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/object_fwd.hpp +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef OBJECT_FWD_DWA2002724_HPP -# define OBJECT_FWD_DWA2002724_HPP - -# include <boost/python/detail/prefix.hpp> - -namespace boost { namespace python { -namespace api -{ - class object; -} -using api::object; -}} // namespace boost::python - -#endif // OBJECT_FWD_DWA2002724_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/object_items.hpp b/contrib/restricted/boost/python/include/boost/python/object_items.hpp deleted file mode 100644 index b048689a7c..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/object_items.hpp +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef OBJECT_ITEMS_DWA2002615_HPP -# define OBJECT_ITEMS_DWA2002615_HPP - -# include <boost/python/detail/prefix.hpp> - -# include <boost/python/proxy.hpp> -# include <boost/python/object_core.hpp> -# include <boost/python/object_protocol.hpp> - -namespace boost { namespace python { namespace api { - -struct const_item_policies -{ - typedef object key_type; - static object get(object const& target, object const& key); -}; - -struct item_policies : const_item_policies -{ - static object const& set(object const& target, object const& key, object const& value); - static void del(object const& target, object const& key); -}; - -// -// implementation -// -template <class U> -inline object_item -object_operators<U>::operator[](object_cref key) -{ - object_cref2 x = *static_cast<U*>(this); - return object_item(x, key); -} - -template <class U> -inline const_object_item -object_operators<U>::operator[](object_cref key) const -{ - object_cref2 x = *static_cast<U const*>(this); - return const_object_item(x, key); -} - -template <class U> -template <class T> -inline const_object_item -object_operators<U>::operator[](T const& key) const -{ - return (*this)[object(key)]; -} - -template <class U> -template <class T> -inline object_item -object_operators<U>::operator[](T const& key) -{ - return (*this)[object(key)]; -} - -inline object const_item_policies::get(object const& target, object const& key) -{ - return getitem(target, key); -} - -inline object const& item_policies::set( - object const& target - , object const& key - , object const& value) -{ - setitem(target, key, value); - return value; -} - -inline void item_policies::del( - object const& target - , object const& key) -{ - delitem(target, key); -} - -}}} // namespace boost::python::api - -#endif // OBJECT_ITEMS_DWA2002615_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/object_operators.hpp b/contrib/restricted/boost/python/include/boost/python/object_operators.hpp deleted file mode 100644 index d436bb0144..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/object_operators.hpp +++ /dev/null @@ -1,136 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef OBJECT_OPERATORS_DWA2002617_HPP -# define OBJECT_OPERATORS_DWA2002617_HPP - -# include <boost/python/detail/prefix.hpp> - -# include <boost/python/object_core.hpp> -# include <boost/python/call.hpp> -# include <boost/iterator/detail/enable_if.hpp> -# include <boost/mpl/bool.hpp> - -# include <boost/iterator/detail/config_def.hpp> - -namespace boost { namespace python { namespace api { - -template <class X> -char is_object_operators_helper(object_operators<X> const*); - -typedef char (&no_type)[2]; -no_type is_object_operators_helper(...); - -template <class X> X* make_ptr(); - -template <class L, class R = L> -struct is_object_operators -{ - enum { - value - = (sizeof(api::is_object_operators_helper(api::make_ptr<L>())) - + sizeof(api::is_object_operators_helper(api::make_ptr<R>())) - < 4 - ) - }; - typedef mpl::bool_<value> type; -}; - -# if !defined(BOOST_NO_SFINAE) && !defined(BOOST_NO_IS_CONVERTIBLE) -template <class L, class R, class T> -struct enable_binary - : boost::iterators::enable_if<is_object_operators<L,R>, T> -{}; -# define BOOST_PYTHON_BINARY_RETURN(T) typename enable_binary<L,R,T>::type -# else -# define BOOST_PYTHON_BINARY_RETURN(T) T -# endif - -template <class U> -object object_operators<U>::operator()() const -{ - object_cref2 f = *static_cast<U const*>(this); - return call<object>(f.ptr()); -} - - -template <class U> -inline -object_operators<U>::operator bool_type() const -{ - object_cref2 x = *static_cast<U const*>(this); - int is_true = PyObject_IsTrue(x.ptr()); - if (is_true < 0) throw_error_already_set(); - return is_true ? &object::ptr : 0; -} - -template <class U> -inline bool -object_operators<U>::operator!() const -{ - object_cref2 x = *static_cast<U const*>(this); - int is_true = PyObject_IsTrue(x.ptr()); - if (is_true < 0) throw_error_already_set(); - return !is_true; -} - -# define BOOST_PYTHON_COMPARE_OP(op, opid) \ -template <class L, class R> \ -BOOST_PYTHON_BINARY_RETURN(object) operator op(L const& l, R const& r) \ -{ \ - return PyObject_RichCompare( \ - object(l).ptr(), object(r).ptr(), opid); \ -} -# undef BOOST_PYTHON_COMPARE_OP - -# define BOOST_PYTHON_BINARY_OPERATOR(op) \ -BOOST_PYTHON_DECL object operator op(object const& l, object const& r); \ -template <class L, class R> \ -BOOST_PYTHON_BINARY_RETURN(object) operator op(L const& l, R const& r) \ -{ \ - return object(l) op object(r); \ -} -BOOST_PYTHON_BINARY_OPERATOR(>) -BOOST_PYTHON_BINARY_OPERATOR(>=) -BOOST_PYTHON_BINARY_OPERATOR(<) -BOOST_PYTHON_BINARY_OPERATOR(<=) -BOOST_PYTHON_BINARY_OPERATOR(==) -BOOST_PYTHON_BINARY_OPERATOR(!=) -BOOST_PYTHON_BINARY_OPERATOR(+) -BOOST_PYTHON_BINARY_OPERATOR(-) -BOOST_PYTHON_BINARY_OPERATOR(*) -BOOST_PYTHON_BINARY_OPERATOR(/) -BOOST_PYTHON_BINARY_OPERATOR(%) -BOOST_PYTHON_BINARY_OPERATOR(<<) -BOOST_PYTHON_BINARY_OPERATOR(>>) -BOOST_PYTHON_BINARY_OPERATOR(&) -BOOST_PYTHON_BINARY_OPERATOR(^) -BOOST_PYTHON_BINARY_OPERATOR(|) -# undef BOOST_PYTHON_BINARY_OPERATOR - - -# define BOOST_PYTHON_INPLACE_OPERATOR(op) \ -BOOST_PYTHON_DECL object& operator op(object& l, object const& r); \ -template <class R> \ -object& operator op(object& l, R const& r) \ -{ \ - return l op object(r); \ -} -BOOST_PYTHON_INPLACE_OPERATOR(+=) -BOOST_PYTHON_INPLACE_OPERATOR(-=) -BOOST_PYTHON_INPLACE_OPERATOR(*=) -BOOST_PYTHON_INPLACE_OPERATOR(/=) -BOOST_PYTHON_INPLACE_OPERATOR(%=) -BOOST_PYTHON_INPLACE_OPERATOR(<<=) -BOOST_PYTHON_INPLACE_OPERATOR(>>=) -BOOST_PYTHON_INPLACE_OPERATOR(&=) -BOOST_PYTHON_INPLACE_OPERATOR(^=) -BOOST_PYTHON_INPLACE_OPERATOR(|=) -# undef BOOST_PYTHON_INPLACE_OPERATOR - -}}} // namespace boost::python - -#include <boost/iterator/detail/config_undef.hpp> - -#endif // OBJECT_OPERATORS_DWA2002617_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/object_protocol.hpp b/contrib/restricted/boost/python/include/boost/python/object_protocol.hpp deleted file mode 100644 index 7c1c02830e..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/object_protocol.hpp +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef OBJECT_PROTOCOL_DWA2002615_HPP -# define OBJECT_PROTOCOL_DWA2002615_HPP - -# include <boost/python/detail/prefix.hpp> - -# include <boost/python/object_protocol_core.hpp> -# include <boost/python/object_core.hpp> - -# include <boost/detail/workaround.hpp> - -namespace boost { namespace python { namespace api { - -# if BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x590)) -// attempt to use SFINAE to prevent functions accepting T const& from -// coming up as ambiguous with the one taking a char const* when a -// string literal is passed -# define BOOST_PYTHON_NO_ARRAY_ARG(T) , T (*)() = 0 -# else -# define BOOST_PYTHON_NO_ARRAY_ARG(T) -# endif - -template <class Target, class Key> -object getattr(Target const& target, Key const& key BOOST_PYTHON_NO_ARRAY_ARG(Key)) -{ - return getattr(object(target), object(key)); -} - -template <class Target, class Key, class Default> -object getattr(Target const& target, Key const& key, Default const& default_ BOOST_PYTHON_NO_ARRAY_ARG(Key)) -{ - return getattr(object(target), object(key), object(default_)); -} - - -template <class Key, class Value> -void setattr(object const& target, Key const& key, Value const& value BOOST_PYTHON_NO_ARRAY_ARG(Key)) -{ - setattr(target, object(key), object(value)); -} - -template <class Key> -void delattr(object const& target, Key const& key BOOST_PYTHON_NO_ARRAY_ARG(Key)) -{ - delattr(target, object(key)); -} - -template <class Target, class Key> -object getitem(Target const& target, Key const& key BOOST_PYTHON_NO_ARRAY_ARG(Key)) -{ - return getitem(object(target), object(key)); -} - - -template <class Key, class Value> -void setitem(object const& target, Key const& key, Value const& value BOOST_PYTHON_NO_ARRAY_ARG(Key)) -{ - setitem(target, object(key), object(value)); -} - -template <class Key> -void delitem(object const& target, Key const& key BOOST_PYTHON_NO_ARRAY_ARG(Key)) -{ - delitem(target, object(key)); -} - -template <class Target, class Begin, class End> -object getslice(Target const& target, Begin const& begin, End const& end) -{ - return getslice(object(target), object(begin), object(end)); -} - -template <class Begin, class End, class Value> -void setslice(object const& target, Begin const& begin, End const& end, Value const& value) -{ - setslice(target, object(begin), object(end), object(value)); -} - -template <class Begin, class End> -void delslice(object const& target, Begin const& begin, End const& end) -{ - delslice(target, object(begin), object(end)); -} - -}}} // namespace boost::python::api - -#endif // OBJECT_PROTOCOL_DWA2002615_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/object_protocol_core.hpp b/contrib/restricted/boost/python/include/boost/python/object_protocol_core.hpp deleted file mode 100644 index a5bd9afcb4..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/object_protocol_core.hpp +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef OBJECT_PROTOCOL_CORE_DWA2002615_HPP -# define OBJECT_PROTOCOL_CORE_DWA2002615_HPP - -# include <boost/python/detail/prefix.hpp> - -# include <boost/python/handle_fwd.hpp> - -namespace boost { namespace python { - -namespace api -{ - class object; - - BOOST_PYTHON_DECL object getattr(object const& target, object const& key); - BOOST_PYTHON_DECL object getattr(object const& target, object const& key, object const& default_); - BOOST_PYTHON_DECL void setattr(object const& target, object const& key, object const& value); - BOOST_PYTHON_DECL void delattr(object const& target, object const& key); - - // These are defined for efficiency, since attributes are commonly - // accessed through literal strings. - BOOST_PYTHON_DECL object getattr(object const& target, char const* key); - BOOST_PYTHON_DECL object getattr(object const& target, char const* key, object const& default_); - BOOST_PYTHON_DECL void setattr(object const& target, char const* key, object const& value); - BOOST_PYTHON_DECL void delattr(object const& target, char const* key); - - BOOST_PYTHON_DECL object getitem(object const& target, object const& key); - BOOST_PYTHON_DECL void setitem(object const& target, object const& key, object const& value); - BOOST_PYTHON_DECL void delitem(object const& target, object const& key); - - BOOST_PYTHON_DECL object getslice(object const& target, handle<> const& begin, handle<> const& end); - BOOST_PYTHON_DECL void setslice(object const& target, handle<> const& begin, handle<> const& end, object const& value); - BOOST_PYTHON_DECL void delslice(object const& target, handle<> const& begin, handle<> const& end); -} - -using api::getattr; -using api::setattr; -using api::delattr; - -using api::getitem; -using api::setitem; -using api::delitem; - -using api::getslice; -using api::setslice; -using api::delslice; - -}} // namespace boost::python - -#endif // OBJECT_PROTOCOL_CORE_DWA2002615_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/object_slices.hpp b/contrib/restricted/boost/python/include/boost/python/object_slices.hpp deleted file mode 100644 index 6cd3dc2974..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/object_slices.hpp +++ /dev/null @@ -1,146 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef OBJECT_SLICES_DWA2002615_HPP -# define OBJECT_SLICES_DWA2002615_HPP - -# include <boost/python/detail/prefix.hpp> - -# include <boost/python/proxy.hpp> -# include <boost/python/object_core.hpp> -# include <boost/python/object_protocol.hpp> -# include <boost/python/handle.hpp> -# include <utility> - -namespace boost { namespace python { namespace api { - -struct const_slice_policies -{ - typedef std::pair<handle<>, handle<> > key_type; - static object get(object const& target, key_type const& key); -}; - -struct slice_policies : const_slice_policies -{ - static object const& set(object const& target, key_type const& key, object const& value); - static void del(object const& target, key_type const& key); -}; - -template <class T, class U> -inline slice_policies::key_type slice_key(T x, U y) -{ - return slice_policies::key_type(handle<>(x), handle<>(y)); -} - -// -// implementation -// -template <class U> -object_slice -object_operators<U>::slice(object_cref start, object_cref finish) -{ - object_cref2 x = *static_cast<U*>(this); - return object_slice(x, api::slice_key(borrowed(start.ptr()), borrowed(finish.ptr()))); -} - -template <class U> -const_object_slice -object_operators<U>::slice(object_cref start, object_cref finish) const -{ - object_cref2 x = *static_cast<U const*>(this); - return const_object_slice(x, api::slice_key(borrowed(start.ptr()), borrowed(finish.ptr()))); -} - -template <class U> -object_slice -object_operators<U>::slice(slice_nil, object_cref finish) -{ - object_cref2 x = *static_cast<U*>(this); - return object_slice(x, api::slice_key(allow_null((PyObject*)0), borrowed(finish.ptr()))); -} - -template <class U> -const_object_slice -object_operators<U>::slice(slice_nil, object_cref finish) const -{ - object_cref2 x = *static_cast<U const*>(this); - return const_object_slice(x, api::slice_key(allow_null((PyObject*)0), borrowed(finish.ptr()))); -} - -template <class U> -object_slice -object_operators<U>::slice(slice_nil, slice_nil) -{ - object_cref2 x = *static_cast<U*>(this); - return object_slice(x, api::slice_key(allow_null((PyObject*)0), allow_null((PyObject*)0))); -} - -template <class U> -const_object_slice -object_operators<U>::slice(slice_nil, slice_nil) const -{ - object_cref2 x = *static_cast<U const*>(this); - return const_object_slice(x, api::slice_key(allow_null((PyObject*)0), allow_null((PyObject*)0))); -} - -template <class U> -object_slice -object_operators<U>::slice(object_cref start, slice_nil) -{ - object_cref2 x = *static_cast<U*>(this); - return object_slice(x, api::slice_key(borrowed(start.ptr()), allow_null((PyObject*)0))); -} - -template <class U> -const_object_slice -object_operators<U>::slice(object_cref start, slice_nil) const -{ - object_cref2 x = *static_cast<U const*>(this); - return const_object_slice(x, api::slice_key(borrowed(start.ptr()), allow_null((PyObject*)0))); -} - -template <class U> -template <class T, class V> -inline const_object_slice -object_operators<U>::slice(T const& start, V const& end) const -{ - return this->slice( - typename slice_bound<T>::type(start) - , typename slice_bound<V>::type(end)); -} - -template <class U> -template <class T, class V> -inline object_slice -object_operators<U>::slice(T const& start, V const& end) -{ - return this->slice( - typename slice_bound<T>::type(start) - , typename slice_bound<V>::type(end)); -} - -inline object const_slice_policies::get(object const& target, key_type const& key) -{ - return getslice(target, key.first, key.second); -} - -inline object const& slice_policies::set( - object const& target - , key_type const& key - , object const& value) -{ - setslice(target, key.first, key.second, value); - return value; -} - -inline void slice_policies::del( - object const& target - , key_type const& key) -{ - delslice(target, key.first, key.second); -} - -}}} // namespace boost::python::api - -#endif // OBJECT_SLICES_DWA2002615_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/override.hpp b/contrib/restricted/boost/python/include/boost/python/override.hpp deleted file mode 100644 index b631226fd6..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/override.hpp +++ /dev/null @@ -1,144 +0,0 @@ -#if !defined(BOOST_PP_IS_ITERATING) - -// Copyright David Abrahams 2004. Distributed under the Boost -// Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -#ifndef OVERRIDE_DWA2004721_HPP -# define OVERRIDE_DWA2004721_HPP - -# include <boost/python/detail/prefix.hpp> - -# include <boost/python/converter/return_from_python.hpp> - -# include <boost/python/extract.hpp> -# include <boost/python/handle.hpp> - -# include <boost/preprocessor/iterate.hpp> -# include <boost/preprocessor/repeat.hpp> -# include <boost/preprocessor/debug/line.hpp> -# include <boost/preprocessor/repetition/enum_params.hpp> -# include <boost/preprocessor/repetition/enum_binary_params.hpp> - -# include <boost/type.hpp> - -namespace boost { namespace python { - -class override; - -namespace detail -{ - class wrapper_base; - - // The result of calling a method. - class method_result - { - private: - friend class boost::python::override; - explicit method_result(PyObject* x) - : m_obj(x) - {} - - public: - template <class T> - operator T() - { - converter::return_from_python<T> converter; - return converter(m_obj.release()); - } - -# if BOOST_WORKAROUND(_MSC_FULL_VER, BOOST_TESTED_AT(140050215)) - template <class T> - operator T*() - { - converter::return_from_python<T*> converter; - return converter(m_obj.release()); - } -# endif - -# if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1400)) || BOOST_WORKAROUND(BOOST_INTEL_WIN, >= 900) - // No operator T& -# else - - template <class T> - operator T&() const - { - converter::return_from_python<T&> converter; - return converter(const_cast<handle<>&>(m_obj).release()); - } -# endif - - template <class T> - T as(type<T>* = 0) - { - converter::return_from_python<T> converter; - return converter(m_obj.release()); - } - - template <class T> - T unchecked(type<T>* = 0) - { - return extract<T>(m_obj.get())(); - } - private: - mutable handle<> m_obj; - }; -} - -class override : public object -{ - private: - friend class detail::wrapper_base; - override(handle<> x) - : object(x) - {} - - public: - detail::method_result - operator()() const - { - detail::method_result x( - PyObject_CallFunction( - this->ptr() - , const_cast<char*>("()") - )); - return x; - } - -# define BOOST_PYTHON_fast_arg_to_python_get(z, n, _) \ - , converter::arg_to_python<A##n>(a##n).get() - -# define BOOST_PP_ITERATION_PARAMS_1 (3, (1, BOOST_PYTHON_MAX_ARITY, <boost/python/override.hpp>)) -# include BOOST_PP_ITERATE() - -# undef BOOST_PYTHON_fast_arg_to_python_get -}; - -}} // namespace boost::python - -#endif // OVERRIDE_DWA2004721_HPP - -#else -# if !(BOOST_WORKAROUND(__MWERKS__, > 0x3100) \ - && BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3201))) -# line BOOST_PP_LINE(__LINE__, override.hpp) -# endif - -# define N BOOST_PP_ITERATION() - -template < - BOOST_PP_ENUM_PARAMS_Z(1, N, class A) - > -detail::method_result -operator()( BOOST_PP_ENUM_BINARY_PARAMS_Z(1, N, A, const& a) ) const -{ - detail::method_result x( - PyObject_CallFunction( - this->ptr() - , const_cast<char*>("(" BOOST_PP_REPEAT_1ST(N, BOOST_PYTHON_FIXED, "O") ")") - BOOST_PP_REPEAT_1ST(N, BOOST_PYTHON_fast_arg_to_python_get, nil) - )); - return x; -} - -# undef N -#endif diff --git a/contrib/restricted/boost/python/include/boost/python/pointee.hpp b/contrib/restricted/boost/python/include/boost/python/pointee.hpp deleted file mode 100644 index 7ec01e0824..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/pointee.hpp +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef POINTEE_DWA2002323_HPP -# define POINTEE_DWA2002323_HPP - -# include <boost/python/detail/prefix.hpp> -# include <boost/python/detail/type_traits.hpp> - -namespace boost { namespace python { - -namespace detail -{ - template <bool is_ptr = true> - struct pointee_impl - { - template <class T> struct apply : detail::remove_pointer<T> {}; - }; - - template <> - struct pointee_impl<false> - { - template <class T> struct apply - { - typedef typename T::element_type type; - }; - }; -} - -template <class T> -struct pointee - : detail::pointee_impl< - detail::is_pointer<T>::value - >::template apply<T> -{ -}; - -}} // namespace boost::python - -#endif // POINTEE_DWA2002323_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/proxy.hpp b/contrib/restricted/boost/python/include/boost/python/proxy.hpp deleted file mode 100644 index d3331d5676..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/proxy.hpp +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef PROXY_DWA2002615_HPP -# define PROXY_DWA2002615_HPP -# include <boost/python/detail/prefix.hpp> -# include <boost/python/object_core.hpp> -# include <boost/python/object_operators.hpp> - -namespace boost { namespace python { namespace api { - -template <class Policies> -class proxy : public object_operators<proxy<Policies> > -{ - typedef typename Policies::key_type key_type; - - typedef proxy const& assignment_self; - public: - proxy(object const& target, key_type const& key); - operator object() const; - - // to support a[b] = c[d] - proxy const& operator=(assignment_self) const; - - template <class T> - inline proxy const& operator=(T const& rhs) const - { - Policies::set(m_target, m_key, object(rhs)); - return *this; - } - - public: // implementation detail - void del() const; - - private: - object m_target; - key_type m_key; -}; - - -template <class T> -inline void del(proxy<T> const& x) -{ - x.del(); -} - -// -// implementation -// - -template <class Policies> -inline proxy<Policies>::proxy(object const& target, key_type const& key) - : m_target(target), m_key(key) -{} - -template <class Policies> -inline proxy<Policies>::operator object() const -{ - return Policies::get(m_target, m_key); -} - -// to support a[b] = c[d] -template <class Policies> -inline proxy<Policies> const& proxy<Policies>::operator=(typename proxy::assignment_self rhs) const -{ - return *this = python::object(rhs); -} - -# define BOOST_PYTHON_PROXY_INPLACE(op) \ -template <class Policies, class R> \ -proxy<Policies> const& operator op(proxy<Policies> const& lhs, R const& rhs) \ -{ \ - object old(lhs); \ - return lhs = (old op rhs); \ -} -BOOST_PYTHON_PROXY_INPLACE(+=) -BOOST_PYTHON_PROXY_INPLACE(-=) -BOOST_PYTHON_PROXY_INPLACE(*=) -BOOST_PYTHON_PROXY_INPLACE(/=) -BOOST_PYTHON_PROXY_INPLACE(%=) -BOOST_PYTHON_PROXY_INPLACE(<<=) -BOOST_PYTHON_PROXY_INPLACE(>>=) -BOOST_PYTHON_PROXY_INPLACE(&=) -BOOST_PYTHON_PROXY_INPLACE(^=) -BOOST_PYTHON_PROXY_INPLACE(|=) -# undef BOOST_PYTHON_PROXY_INPLACE - -template <class Policies> -inline void proxy<Policies>::del() const -{ - Policies::del(m_target, m_key); -} - -}}} // namespace boost::python::api - -#endif // PROXY_DWA2002615_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/ptr.hpp b/contrib/restricted/boost/python/include/boost/python/ptr.hpp deleted file mode 100644 index 8e97aa4064..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/ptr.hpp +++ /dev/null @@ -1,65 +0,0 @@ -#ifndef BOOST_PYTHON_PTR_HPP -# define BOOST_PYTHON_PTR_HPP - -# include <boost/python/detail/prefix.hpp> -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// Based on boost/ref.hpp, thus: -// Copyright (C) 1999, 2000 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi) -// Copyright (C) 2001 Peter Dimov - -# include <boost/config.hpp> -# include <boost/mpl/bool.hpp> - -namespace boost { namespace python { - -template<class Ptr> class pointer_wrapper -{ - public: - typedef Ptr type; - - explicit pointer_wrapper(Ptr x): p_(x) {} - operator Ptr() const { return p_; } - Ptr get() const { return p_; } - private: - Ptr p_; -}; - -template<class T> -inline pointer_wrapper<T> ptr(T t) -{ - return pointer_wrapper<T>(t); -} - -template<typename T> -class is_pointer_wrapper - : public mpl::false_ -{ -}; - -template<typename T> -class is_pointer_wrapper<pointer_wrapper<T> > - : public mpl::true_ -{ -}; - -template<typename T> -class unwrap_pointer -{ - public: - typedef T type; -}; - -template<typename T> -class unwrap_pointer<pointer_wrapper<T> > -{ - public: - typedef T type; -}; - -}} // namespace boost::python - -#endif diff --git a/contrib/restricted/boost/python/include/boost/python/refcount.hpp b/contrib/restricted/boost/python/include/boost/python/refcount.hpp deleted file mode 100644 index aa6aa5dbb6..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/refcount.hpp +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef REFCOUNT_DWA2002615_HPP -# define REFCOUNT_DWA2002615_HPP - -# include <boost/python/detail/prefix.hpp> -# include <boost/python/cast.hpp> - -namespace boost { namespace python { - -template <class T> -inline T* incref(T* p) -{ - Py_INCREF(python::upcast<PyObject>(p)); - return p; -} - -template <class T> -inline T* xincref(T* p) -{ - Py_XINCREF(python::upcast<PyObject>(p)); - return p; -} - -template <class T> -inline void decref(T* p) -{ - assert( Py_REFCNT(python::upcast<PyObject>(p)) > 0 ); - Py_DECREF(python::upcast<PyObject>(p)); -} - -template <class T> -inline void xdecref(T* p) -{ - assert( !p || Py_REFCNT(python::upcast<PyObject>(p)) > 0 ); - Py_XDECREF(python::upcast<PyObject>(p)); -} - -}} // namespace boost::python - -#endif // REFCOUNT_DWA2002615_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/scope.hpp b/contrib/restricted/boost/python/include/boost/python/scope.hpp deleted file mode 100644 index 8be3e054e0..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/scope.hpp +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef SCOPE_DWA2002724_HPP -# define SCOPE_DWA2002724_HPP - -# include <boost/python/detail/prefix.hpp> -# include <boost/python/object.hpp> -# include <boost/python/refcount.hpp> - -namespace boost { namespace python { - -namespace detail -{ - // Making this a namespace-scope variable to avoid Cygwin issues. - // Use a PyObject* to avoid problems with static destruction after Py_Finalize - extern BOOST_PYTHON_DECL PyObject* current_scope; -} - -class scope - : public object -{ - public: - inline scope(scope const&); - inline scope(object const&); - inline scope(); - inline ~scope(); - - private: // data members - PyObject* m_previous_scope; - - private: // unimplemented functions - void operator=(scope const&); -}; - -inline scope::scope(object const& new_scope) - : object(new_scope) - , m_previous_scope(detail::current_scope) -{ - detail::current_scope = python::incref(new_scope.ptr()); -} - -inline scope::scope() - : object(detail::borrowed_reference( - detail::current_scope ? detail::current_scope : Py_None - )) - , m_previous_scope(python::xincref(detail::current_scope)) -{ -} - -inline scope::~scope() -{ - python::xdecref(detail::current_scope); - detail::current_scope = m_previous_scope; -} - -namespace converter -{ - template <> - struct object_manager_traits<scope> - : object_manager_traits<object> - { - }; -} - -// Placing this after the specialization above suppresses a CWPro8.3 bug -inline scope::scope(scope const& new_scope) - : object(new_scope) - , m_previous_scope(detail::current_scope) -{ - detail::current_scope = python::incref(new_scope.ptr()); -} - -}} // namespace boost::python - -#endif // SCOPE_DWA2002724_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/self.hpp b/contrib/restricted/boost/python/include/boost/python/self.hpp deleted file mode 100644 index 99ec5b8fbe..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/self.hpp +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef SELF_DWA2002531_HPP -# define SELF_DWA2002531_HPP - -# include <boost/python/detail/prefix.hpp> - -namespace boost { namespace python { - -#define BOOST_PYTHON_SELF_IS_CLASS - -// Sink self_t into its own namespace so that we have a safe place to -// put the completely general operator templates which operate on -// it. It is possible to avoid this, but it turns out to be much more -// complicated and finally GCC 2.95.2 chokes on it. -namespace self_ns -{ -# ifndef BOOST_PYTHON_SELF_IS_CLASS - enum self_t { self }; -# else - struct self_t {}; - extern BOOST_PYTHON_DECL self_t self; -# endif -} - -using self_ns::self_t; -using self_ns::self; - -}} // namespace boost::python - -#endif // SELF_DWA2002531_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/signature.hpp b/contrib/restricted/boost/python/include/boost/python/signature.hpp deleted file mode 100644 index ab4bca390a..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/signature.hpp +++ /dev/null @@ -1,252 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// Copyright David Abrahams 2002, Joel de Guzman, 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -/////////////////////////////////////////////////////////////////////////////// -#if !defined(BOOST_PP_IS_ITERATING) - -# ifndef SIGNATURE_JDG20020813_HPP -# define SIGNATURE_JDG20020813_HPP - -# include <boost/python/detail/prefix.hpp> - -# include <boost/mpl/if.hpp> - -# include <boost/python/detail/preprocessor.hpp> -# include <boost/python/detail/type_traits.hpp> -# include <boost/preprocessor/repeat.hpp> -# include <boost/preprocessor/enum.hpp> -# include <boost/preprocessor/enum_params.hpp> -# include <boost/preprocessor/empty.hpp> -# include <boost/preprocessor/arithmetic/sub.hpp> -# include <boost/preprocessor/iterate.hpp> -# include <boost/python/detail/type_list.hpp> - -# include <boost/preprocessor/debug/line.hpp> -# include <boost/preprocessor/arithmetic/sub.hpp> -# include <boost/preprocessor/arithmetic/inc.hpp> -# include <boost/preprocessor/repetition/enum_trailing_params.hpp> - -# define BOOST_PYTHON_LIST_INC(n) \ - BOOST_PP_CAT(mpl::vector, BOOST_PP_INC(n)) - -/////////////////////////////////////////////////////////////////////////////// -namespace boost { namespace python { namespace detail { - -// A metafunction returning C1 if C1 is derived from C2, and C2 -// otherwise -template <class C1, class C2> -struct most_derived -{ - typedef typename mpl::if_< - detail::is_convertible<C1*,C2*> - , C1 - , C2 - >::type type; -}; - -// The following macros generate expansions for:: -// -// template <class RT, class T0... class TN> -// inline mpl::vector<RT, T0...TN> -// get_signature(RT(BOOST_PYTHON_FN_CC *)(T0...TN), void* = 0) -// { -// return mpl::list<RT, T0...TN>(); -// } -// -// where BOOST_PYTHON_FN_CC is a calling convention keyword, can be -// -// empty, for default calling convention -// __cdecl (if BOOST_PYTHON_ENABLE_CDECL is defined) -// __stdcall (if BOOST_PYTHON_ENABLE_STDCALL is defined) -// __fastcall (if BOOST_PYTHON_ENABLE_FASTCALL is defined) -// -// And, for an appropriate assortment of cv-qualifications:: -// -// template <class RT, class ClassT, class T0... class TN> -// inline mpl::vector<RT, ClassT&, T0...TN> -// get_signature(RT(BOOST_PYTHON_FN_CC ClassT::*)(T0...TN) cv)) -// { -// return mpl::list<RT, ClassT&, T0...TN>(); -// } -// -// template <class Target, class RT, class ClassT, class T0... class TN> -// inline mpl::vector< -// RT -// , typename most_derived<Target, ClassT>::type& -// , T0...TN -// > -// get_signature(RT(BOOST_PYTHON_FN_CC ClassT::*)(T0...TN) cv), Target*) -// { -// return mpl::list<RT, ClassT&, T0...TN>(); -// } -// -// There are two forms for invoking get_signature:: -// -// get_signature(f) -// -// and :: -// -// get_signature(f,(Target*)0) -// -// These functions extract the return type, class (for member -// functions) and arguments of the input signature and stuff them in -// an mpl type sequence (the calling convention is dropped). -// Note that cv-qualification is dropped from -// the "hidden this" argument of member functions; that is a -// necessary sacrifice to ensure that an lvalue from_python converter -// is used. A pointer is not used so that None will be rejected for -// overload resolution. -// -// The second form of get_signature essentially downcasts the "hidden -// this" argument of member functions to Target, because the function -// may actually be a member of a base class which is not wrapped, and -// in that case conversion from python would fail. -// -// @group { - -// 'default' calling convention - -# define BOOST_PYTHON_FN_CC - -# define BOOST_PP_ITERATION_PARAMS_1 \ - (3, (0, BOOST_PYTHON_MAX_ARITY, <boost/python/signature.hpp>)) - -# include BOOST_PP_ITERATE() - -# undef BOOST_PYTHON_FN_CC - -// __cdecl calling convention - -# if defined(BOOST_PYTHON_ENABLE_CDECL) - -# define BOOST_PYTHON_FN_CC __cdecl -# define BOOST_PYTHON_FN_CC_IS_CDECL - -# define BOOST_PP_ITERATION_PARAMS_1 \ - (3, (0, BOOST_PYTHON_MAX_ARITY, <boost/python/signature.hpp>)) - -# include BOOST_PP_ITERATE() - -# undef BOOST_PYTHON_FN_CC -# undef BOOST_PYTHON_FN_CC_IS_CDECL - -# endif // defined(BOOST_PYTHON_ENABLE_CDECL) - -// __stdcall calling convention - -# if defined(BOOST_PYTHON_ENABLE_STDCALL) - -# define BOOST_PYTHON_FN_CC __stdcall - -# define BOOST_PP_ITERATION_PARAMS_1 \ - (3, (0, BOOST_PYTHON_MAX_ARITY, <boost/python/signature.hpp>)) - -# include BOOST_PP_ITERATE() - -# undef BOOST_PYTHON_FN_CC - -# endif // defined(BOOST_PYTHON_ENABLE_STDCALL) - -// __fastcall calling convention - -# if defined(BOOST_PYTHON_ENABLE_FASTCALL) - -# define BOOST_PYTHON_FN_CC __fastcall - -# define BOOST_PP_ITERATION_PARAMS_1 \ - (3, (0, BOOST_PYTHON_MAX_ARITY, <boost/python/signature.hpp>)) - -# include BOOST_PP_ITERATE() - -# undef BOOST_PYTHON_FN_CC - -# endif // defined(BOOST_PYTHON_ENABLE_FASTCALL) - -# undef BOOST_PYTHON_LIST_INC - -// } - -}}} // namespace boost::python::detail - - -# endif // SIGNATURE_JDG20020813_HPP - -// For gcc 4.4 compatability, we must include the -// BOOST_PP_ITERATION_DEPTH test inside an #else clause. -#else // BOOST_PP_IS_ITERATING -#if BOOST_PP_ITERATION_DEPTH() == 1 // defined(BOOST_PP_IS_ITERATING) - -# define N BOOST_PP_ITERATION() - - // as 'get_signature(RT(*)(T0...TN), void* = 0)' is the same - // function as 'get_signature(RT(__cdecl *)(T0...TN), void* = 0)', - // we don't define it twice -# if !defined(BOOST_PYTHON_FN_CC_IS_CDECL) - -template < - class RT BOOST_PP_ENUM_TRAILING_PARAMS_Z(1, N, class T)> -inline BOOST_PYTHON_LIST_INC(N)< - RT BOOST_PP_ENUM_TRAILING_PARAMS_Z(1, N, T)> -get_signature(RT(BOOST_PYTHON_FN_CC *)(BOOST_PP_ENUM_PARAMS_Z(1, N, T)), void* = 0) -{ - return BOOST_PYTHON_LIST_INC(N)< - RT BOOST_PP_ENUM_TRAILING_PARAMS_Z(1, N, T) - >(); -} - -# endif // !defined(BOOST_PYTHON_FN_CC_IS_CDECL) - -# undef N - -# define BOOST_PP_ITERATION_PARAMS_2 \ - (3, (0, 3, <boost/python/signature.hpp>)) -# include BOOST_PP_ITERATE() - -#else - -# define N BOOST_PP_RELATIVE_ITERATION(1) -# define Q BOOST_PYTHON_CV_QUALIFIER(BOOST_PP_ITERATION()) - -template < - class RT, class ClassT BOOST_PP_ENUM_TRAILING_PARAMS_Z(1, N, class T)> -inline BOOST_PYTHON_LIST_INC(BOOST_PP_INC(N))< - RT, ClassT& BOOST_PP_ENUM_TRAILING_PARAMS_Z(1, N, T)> -get_signature(RT(BOOST_PYTHON_FN_CC ClassT::*)(BOOST_PP_ENUM_PARAMS_Z(1, N, T)) Q) -{ - return BOOST_PYTHON_LIST_INC(BOOST_PP_INC(N))< - RT, ClassT& BOOST_PP_ENUM_TRAILING_PARAMS_Z(1, N, T) - >(); -} - -template < - class Target - , class RT - , class ClassT - BOOST_PP_ENUM_TRAILING_PARAMS_Z(1, N, class T) -> -inline BOOST_PYTHON_LIST_INC(BOOST_PP_INC(N))< - RT - , typename most_derived<Target, ClassT>::type& - BOOST_PP_ENUM_TRAILING_PARAMS_Z(1, N, T) -> -get_signature( - RT(BOOST_PYTHON_FN_CC ClassT::*)(BOOST_PP_ENUM_PARAMS_Z(1, N, T)) Q - , Target* -) -{ - return BOOST_PYTHON_LIST_INC(BOOST_PP_INC(N))< - RT - , BOOST_DEDUCED_TYPENAME most_derived<Target, ClassT>::type& - BOOST_PP_ENUM_TRAILING_PARAMS_Z(1, N, T) - >(); -} - -# undef Q -# undef N - -#endif // BOOST_PP_ITERATION_DEPTH() -#endif // !defined(BOOST_PP_IS_ITERATING) diff --git a/contrib/restricted/boost/python/include/boost/python/slice.hpp b/contrib/restricted/boost/python/include/boost/python/slice.hpp deleted file mode 100644 index 80660fab77..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/slice.hpp +++ /dev/null @@ -1,276 +0,0 @@ -#ifndef BOOST_PYTHON_SLICE_JDB20040105_HPP -#define BOOST_PYTHON_SLICE_JDB20040105_HPP - -// Copyright (c) 2004 Jonathan Brandmeyer -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - -#include <boost/python/detail/prefix.hpp> -#include <boost/config.hpp> -#include <boost/python/object.hpp> -#include <boost/python/extract.hpp> -#include <boost/python/converter/pytype_object_mgr_traits.hpp> - -#include <boost/iterator/iterator_traits.hpp> - -#include <iterator> -#include <algorithm> - -namespace boost { namespace python { - -namespace detail -{ - class BOOST_PYTHON_DECL slice_base : public object - { - public: - // Get the Python objects associated with the slice. In principle, these - // may be any arbitrary Python type, but in practice they are usually - // integers. If one or more parameter is ommited in the Python expression - // that created this slice, than that parameter is None here, and compares - // equal to a default-constructed boost::python::object. - // If a user-defined type wishes to support slicing, then support for the - // special meaning associated with negative indices is up to the user. - object start() const; - object stop() const; - object step() const; - - protected: - explicit slice_base(PyObject*, PyObject*, PyObject*); - - BOOST_PYTHON_FORWARD_OBJECT_CONSTRUCTORS(slice_base, object) - }; -} - -class slice : public detail::slice_base -{ - typedef detail::slice_base base; - public: - // Equivalent to slice(::) - slice() : base(0,0,0) {} - - // Each argument must be slice_nil, or implicitly convertable to object. - // They should normally be integers. - template<typename Integer1, typename Integer2> - slice( Integer1 start, Integer2 stop) - : base( object(start).ptr(), object(stop).ptr(), 0 ) - {} - - template<typename Integer1, typename Integer2, typename Integer3> - slice( Integer1 start, Integer2 stop, Integer3 stride) - : base( object(start).ptr(), object(stop).ptr(), object(stride).ptr() ) - {} - - // The following algorithm is intended to automate the process of - // determining a slice range when you want to fully support negative - // indices and non-singular step sizes. Its functionallity is simmilar to - // PySlice_GetIndicesEx() in the Python/C API, but tailored for C++ users. - // This template returns a slice::range struct that, when used in the - // following iterative loop, will traverse a slice of the function's - // arguments. - // while (start != end) { - // do_foo(...); - // std::advance( start, step); - // } - // do_foo(...); // repeat exactly once more. - - // Arguments: a [begin, end) pair of STL-conforming random-access iterators. - - // Return: slice::range, where start and stop define a _closed_ interval - // that covers at most [begin, end-1] of the provided arguments, and a step - // that is non-zero. - - // Throws: error_already_set() if any of the indices are neither None nor - // integers, or the slice has a step value of zero. - // std::invalid_argument if the resulting range would be empty. Normally, - // you should catch this exception and return an empty sequence of the - // appropriate type. - - // Performance: constant time for random-access iterators. - - // Rationale: - // closed-interval: If an open interval were used, then for a non-singular - // value for step, the required state for the end iterator could be - // beyond the one-past-the-end postion of the specified range. While - // probably harmless, the behavior of STL-conforming iterators is - // undefined in this case. - // exceptions on zero-length range: It is impossible to define a closed - // interval over an empty range, so some other form of error checking - // would have to be used by the user to prevent undefined behavior. In - // the case where the user fails to catch the exception, it will simply - // be translated to Python by the default exception handling mechanisms. - - template<typename RandomAccessIterator> - struct range - { - RandomAccessIterator start; - RandomAccessIterator stop; - typename iterator_difference<RandomAccessIterator>::type step; - }; - - template<typename RandomAccessIterator> - slice::range<RandomAccessIterator> - get_indices( const RandomAccessIterator& begin, - const RandomAccessIterator& end) const - { - // This is based loosely on PySlice_GetIndicesEx(), but it has been - // carefully crafted to ensure that these iterators never fall out of - // the range of the container. - slice::range<RandomAccessIterator> ret; - - typedef typename iterator_difference<RandomAccessIterator>::type difference_type; - difference_type max_dist = std::distance(begin, end); - - object slice_start = this->start(); - object slice_stop = this->stop(); - object slice_step = this->step(); - - // Extract the step. - if (slice_step == object()) { - ret.step = 1; - } - else { - ret.step = extract<long>( slice_step); - if (ret.step == 0) { - PyErr_SetString( PyExc_IndexError, "step size cannot be zero."); - throw_error_already_set(); - } - } - - // Setup the start iterator. - if (slice_start == object()) { - if (ret.step < 0) { - ret.start = end; - --ret.start; - } - else - ret.start = begin; - } - else { - difference_type i = extract<long>( slice_start); - if (i >= max_dist && ret.step > 0) - throw std::invalid_argument( "Zero-length slice"); - if (i >= 0) { - ret.start = begin; - BOOST_USING_STD_MIN(); - std::advance( ret.start, min BOOST_PREVENT_MACRO_SUBSTITUTION(i, max_dist-1)); - } - else { - if (i < -max_dist && ret.step < 0) - throw std::invalid_argument( "Zero-length slice"); - ret.start = end; - // Advance start (towards begin) not farther than begin. - std::advance( ret.start, (-i < max_dist) ? i : -max_dist ); - } - } - - // Set up the stop iterator. This one is a little trickier since slices - // define a [) range, and we are returning a [] range. - if (slice_stop == object()) { - if (ret.step < 0) { - ret.stop = begin; - } - else { - ret.stop = end; - std::advance( ret.stop, -1); - } - } - else { - difference_type i = extract<long>(slice_stop); - // First, branch on which direction we are going with this. - if (ret.step < 0) { - if (i+1 >= max_dist || i == -1) - throw std::invalid_argument( "Zero-length slice"); - - if (i >= 0) { - ret.stop = begin; - std::advance( ret.stop, i+1); - } - else { // i is negative, but more negative than -1. - ret.stop = end; - std::advance( ret.stop, (-i < max_dist) ? i : -max_dist); - } - } - else { // stepping forward - if (i == 0 || -i >= max_dist) - throw std::invalid_argument( "Zero-length slice"); - - if (i > 0) { - ret.stop = begin; - std::advance( ret.stop, (std::min)( i-1, max_dist-1)); - } - else { // i is negative, but not more negative than -max_dist - ret.stop = end; - std::advance( ret.stop, i-1); - } - } - } - - // Now the fun part, handling the possibilites surrounding step. - // At this point, step has been initialized, ret.stop, and ret.step - // represent the widest possible range that could be traveled - // (inclusive), and final_dist is the maximum distance covered by the - // slice. - typename iterator_difference<RandomAccessIterator>::type final_dist = - std::distance( ret.start, ret.stop); - - // First case, if both ret.start and ret.stop are equal, then step - // is irrelevant and we can return here. - if (final_dist == 0) - return ret; - - // Second, if there is a sign mismatch, than the resulting range and - // step size conflict: std::advance( ret.start, ret.step) goes away from - // ret.stop. - if ((final_dist > 0) != (ret.step > 0)) - throw std::invalid_argument( "Zero-length slice."); - - // Finally, if the last step puts us past the end, we move ret.stop - // towards ret.start in the amount of the remainder. - // I don't remember all of the oolies surrounding negative modulii, - // so I am handling each of these cases separately. - if (final_dist < 0) { - difference_type remainder = -final_dist % -ret.step; - std::advance( ret.stop, remainder); - } - else { - difference_type remainder = final_dist % ret.step; - std::advance( ret.stop, -remainder); - } - - return ret; - } - - // Incorrect spelling. DO NOT USE. Only here for backward compatibility. - // Corrected 2011-06-14. - template<typename RandomAccessIterator> - slice::range<RandomAccessIterator> - get_indicies( const RandomAccessIterator& begin, - const RandomAccessIterator& end) const - { - return get_indices(begin, end); - } - - public: - // This declaration, in conjunction with the specialization of - // object_manager_traits<> below, allows C++ functions accepting slice - // arguments to be called from from Python. These constructors should never - // be used in client code. - BOOST_PYTHON_FORWARD_OBJECT_CONSTRUCTORS(slice, detail::slice_base) -}; - - -namespace converter { - -template<> -struct object_manager_traits<slice> - : pytype_object_manager_traits<&PySlice_Type, slice> -{ -}; - -} // !namesapce converter - -} } // !namespace ::boost::python - - -#endif // !defined BOOST_PYTHON_SLICE_JDB20040105_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/slice_nil.hpp b/contrib/restricted/boost/python/include/boost/python/slice_nil.hpp deleted file mode 100644 index e911f06801..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/slice_nil.hpp +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef SLICE_NIL_DWA2002620_HPP -# define SLICE_NIL_DWA2002620_HPP - -# include <boost/python/detail/prefix.hpp> -# include <boost/python/object_core.hpp> - -namespace boost { namespace python { namespace api { - -class slice_nil : public object -{ - public: - slice_nil() : object() {} -}; - -# ifndef _ // Watch out for GNU gettext users, who #define _(x) -static const slice_nil _ = slice_nil(); -# endif - -template <class T> -struct slice_bound -{ - typedef object type; -}; - -template <> -struct slice_bound<slice_nil> -{ - typedef slice_nil type; -}; - -} - -using api::slice_nil; -# ifndef _ // Watch out for GNU gettext users, who #define _(x) -using api::_; -# endif - -}} // namespace boost::python - -#endif // SLICE_NIL_DWA2002620_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/ssize_t.hpp b/contrib/restricted/boost/python/include/boost/python/ssize_t.hpp deleted file mode 100644 index e8a2d92f63..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/ssize_t.hpp +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright Ralf W. Grosse-Kunstleve & David Abrahams 2006. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_PYTHON_SSIZE_T_RWGK20060924_HPP -# define BOOST_PYTHON_SSIZE_T_RWGK20060924_HPP - -# include <boost/python/detail/prefix.hpp> - -namespace boost { namespace python { - -#if PY_VERSION_HEX >= 0x02050000 - -typedef Py_ssize_t ssize_t; -ssize_t const ssize_t_max = PY_SSIZE_T_MAX; -ssize_t const ssize_t_min = PY_SSIZE_T_MIN; - -#else - -typedef int ssize_t; -ssize_t const ssize_t_max = INT_MAX; -ssize_t const ssize_t_min = INT_MIN; - -#endif - -}} // namespace boost::python - -#endif // BOOST_PYTHON_SSIZE_T_RWGK20060924_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/str.hpp b/contrib/restricted/boost/python/include/boost/python/str.hpp deleted file mode 100644 index 434c8c986c..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/str.hpp +++ /dev/null @@ -1,422 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef STR_20020703_HPP -#define STR_20020703_HPP - -# include <boost/python/detail/prefix.hpp> - -#include <boost/python/object.hpp> -#include <boost/python/list.hpp> -#include <boost/python/converter/pytype_object_mgr_traits.hpp> - -// disable defines in <cctype> provided by some system libraries -#undef isspace -#undef islower -#undef isalpha -#undef isdigit -#undef isalnum -#undef isupper - -namespace boost { namespace python { - -class str; - -namespace detail -{ - struct BOOST_PYTHON_DECL str_base : object - { - str capitalize() const; - - str center(object_cref width) const; - - long count(object_cref sub) const; - - long count(object_cref sub, object_cref start) const; - - long count(object_cref sub, object_cref start, object_cref end) const; - -#if PY_VERSION_HEX < 0x03000000 - object decode() const; - object decode(object_cref encoding) const; - - object decode(object_cref encoding, object_cref errors) const; -#endif - - object encode() const; - object encode(object_cref encoding) const; - object encode(object_cref encoding, object_cref errors) const; - - bool endswith(object_cref suffix) const; - - bool endswith(object_cref suffix, object_cref start) const; - bool endswith(object_cref suffix, object_cref start, object_cref end) const; - - str expandtabs() const; - str expandtabs(object_cref tabsize) const; - - long find(object_cref sub) const; - long find(object_cref sub, object_cref start) const; - - long find(object_cref sub, object_cref start, object_cref end) const; - - long index(object_cref sub) const; - - long index(object_cref sub, object_cref start) const; - long index(object_cref sub, object_cref start, object_cref end) const; - - bool isalnum() const; - bool isalpha() const; - bool isdigit() const; - bool islower() const; - bool isspace() const; - bool istitle() const; - bool isupper() const; - - str join(object_cref sequence) const; - - str ljust(object_cref width) const; - str lower() const; - str lstrip() const; - - str replace(object_cref old, object_cref new_) const; - str replace(object_cref old, object_cref new_, object_cref maxsplit) const; - long rfind(object_cref sub) const; - - long rfind(object_cref sub, object_cref start) const; - - long rfind(object_cref sub, object_cref start, object_cref end) const; - long rindex(object_cref sub) const; - long rindex(object_cref sub, object_cref start) const; - - - long rindex(object_cref sub, object_cref start, object_cref end) const; - - str rjust(object_cref width) const; - - str rstrip() const; - - list split() const; - list split(object_cref sep) const; - - list split(object_cref sep, object_cref maxsplit) const; - - - list splitlines() const; - list splitlines(object_cref keepends) const; - - bool startswith(object_cref prefix) const; - - - bool startswith(object_cref prefix, object_cref start) const; - bool startswith(object_cref prefix, object_cref start, object_cref end) const; - - str strip() const; - str swapcase() const; - str title() const; - - str translate(object_cref table) const; - - str translate(object_cref table, object_cref deletechars) const; - - - str upper() const; - - protected: - str_base(); // new str - - str_base(const char* s); // new str - - str_base(char const* start, char const* finish); - - str_base(char const* start, std::size_t length); - - explicit str_base(object_cref other); - - BOOST_PYTHON_FORWARD_OBJECT_CONSTRUCTORS(str_base, object) - private: - static new_reference call(object const&); - }; -} - - -class str : public detail::str_base -{ - typedef detail::str_base base; - public: - str() {} // new str - - str(const char* s) : base(s) {} // new str - - str(char const* start, char const* finish) // new str - : base(start, finish) - {} - - str(char const* start, std::size_t length) // new str - : base(start, length) - {} - - template <class T> - explicit str(T const& other) - : base(object(other)) - { - } - - template <class T> - str center(T const& width) const - { - return base::center(object(width)); - } - - template<class T> - long count(T const& sub) const - { - return base::count(object(sub)); - } - - template<class T1, class T2> - long count(T1 const& sub,T2 const& start) const - { - return base::count(object(sub), object(start)); - } - - template<class T1, class T2, class T3> - long count(T1 const& sub,T2 const& start, T3 const& end) const - { - return base::count(object(sub), object(start), object(end)); - } - -#if PY_VERSION_HEX < 0x03000000 - object decode() const { return base::decode(); } - - template<class T> - object decode(T const& encoding) const - { - return base::decode(object(encoding)); - } - - template<class T1, class T2> - object decode(T1 const& encoding, T2 const& errors) const - { - return base::decode(object(encoding),object(errors)); - } -#endif - - object encode() const { return base::encode(); } - - template <class T> - object encode(T const& encoding) const - { - return base::encode(object(encoding)); - } - - template <class T1, class T2> - object encode(T1 const& encoding, T2 const& errors) const - { - return base::encode(object(encoding),object(errors)); - } - - template <class T> - bool endswith(T const& suffix) const - { - return base::endswith(object(suffix)); - } - - template <class T1, class T2> - bool endswith(T1 const& suffix, T2 const& start) const - { - return base::endswith(object(suffix), object(start)); - } - - template <class T1, class T2, class T3> - bool endswith(T1 const& suffix, T2 const& start, T3 const& end) const - { - return base::endswith(object(suffix), object(start), object(end)); - } - - str expandtabs() const { return base::expandtabs(); } - - template <class T> - str expandtabs(T const& tabsize) const - { - return base::expandtabs(object(tabsize)); - } - - template <class T> - long find(T const& sub) const - { - return base::find(object(sub)); - } - - template <class T1, class T2> - long find(T1 const& sub, T2 const& start) const - { - return base::find(object(sub), object(start)); - } - - template <class T1, class T2, class T3> - long find(T1 const& sub, T2 const& start, T3 const& end) const - { - return base::find(object(sub), object(start), object(end)); - } - - template <class T> - long index(T const& sub) const - { - return base::index(object(sub)); - } - - template <class T1, class T2> - long index(T1 const& sub, T2 const& start) const - { - return base::index(object(sub), object(start)); - } - - template <class T1, class T2, class T3> - long index(T1 const& sub, T2 const& start, T3 const& end) const - { - return base::index(object(sub), object(start), object(end)); - } - - template <class T> - str join(T const& sequence) const - { - return base::join(object(sequence)); - } - - template <class T> - str ljust(T const& width) const - { - return base::ljust(object(width)); - } - - template <class T1, class T2> - str replace(T1 const& old, T2 const& new_) const - { - return base::replace(object(old),object(new_)); - } - - template <class T1, class T2, class T3> - str replace(T1 const& old, T2 const& new_, T3 const& maxsplit) const - { - return base::replace(object(old),object(new_), object(maxsplit)); - } - - template <class T> - long rfind(T const& sub) const - { - return base::rfind(object(sub)); - } - - template <class T1, class T2> - long rfind(T1 const& sub, T2 const& start) const - { - return base::rfind(object(sub), object(start)); - } - - template <class T1, class T2, class T3> - long rfind(T1 const& sub, T2 const& start, T3 const& end) const - { - return base::rfind(object(sub), object(start), object(end)); - } - - template <class T> - long rindex(T const& sub) const - { - return base::rindex(object(sub)); - } - - template <class T1, class T2> - long rindex(T1 const& sub, T2 const& start) const - { - return base::rindex(object(sub), object(start)); - } - - template <class T1, class T2, class T3> - long rindex(T1 const& sub, T2 const& start, T3 const& end) const - { - return base::rindex(object(sub), object(start), object(end)); - } - - template <class T> - str rjust(T const& width) const - { - return base::rjust(object(width)); - } - - list split() const { return base::split(); } - - template <class T> - list split(T const& sep) const - { - return base::split(object(sep)); - } - - template <class T1, class T2> - list split(T1 const& sep, T2 const& maxsplit) const - { - return base::split(object(sep), object(maxsplit)); - } - - list splitlines() const { return base::splitlines(); } - - template <class T> - list splitlines(T const& keepends) const - { - return base::splitlines(object(keepends)); - } - - template <class T> - bool startswith(T const& prefix) const - { - return base::startswith(object(prefix)); - } - - template <class T1, class T2> - bool startswith(T1 const& prefix, T2 const& start) const - { - return base::startswith(object(prefix), object(start)); - } - - template <class T1, class T2, class T3> - bool startswith(T1 const& prefix, T2 const& start, T3 const& end) const - { - return base::startswith(object(prefix), object(start), object(end)); - } - - template <class T> - str translate(T const& table) const - { - return base::translate(object(table)); - } - - template <class T1, class T2> - str translate(T1 const& table, T2 const& deletechars) const - { - return base::translate(object(table), object(deletechars)); - } - - public: // implementation detail -- for internal use only - BOOST_PYTHON_FORWARD_OBJECT_CONSTRUCTORS(str, base) -}; - -// -// Converter Specializations -// -namespace converter -{ - template <> - struct object_manager_traits<str> -#if PY_VERSION_HEX >= 0x03000000 - : pytype_object_manager_traits<&PyUnicode_Type,str> -#else - : pytype_object_manager_traits<&PyString_Type,str> -#endif - { - }; -} - -}} // namespace boost::python - -#endif // STR_20020703_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/tag.hpp b/contrib/restricted/boost/python/include/boost/python/tag.hpp deleted file mode 100644 index ccff9f1a17..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/tag.hpp +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef TAG_DWA2002720_HPP -# define TAG_DWA2002720_HPP - -# include <boost/python/detail/prefix.hpp> - -namespace boost { namespace python { - -// used only to prevent argument-dependent lookup from finding the -// wrong function in some cases. Cheaper than qualification. -enum tag_t { tag }; - -}} // namespace boost::python - -#endif // TAG_DWA2002720_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/to_python_indirect.hpp b/contrib/restricted/boost/python/include/boost/python/to_python_indirect.hpp deleted file mode 100644 index 0a19aca5ff..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/to_python_indirect.hpp +++ /dev/null @@ -1,112 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef TO_PYTHON_INDIRECT_DWA200221_HPP -# define TO_PYTHON_INDIRECT_DWA200221_HPP - -# include <boost/python/detail/prefix.hpp> - -# include <boost/python/object/pointer_holder.hpp> -# include <boost/python/object/make_ptr_instance.hpp> - -# include <boost/python/detail/none.hpp> - -#ifndef BOOST_PYTHON_NO_PY_SIGNATURES -# include <boost/python/converter/pytype_function.hpp> -#endif - -# include <boost/python/refcount.hpp> - -# include <boost/python/detail/type_traits.hpp> - -# if defined(__ICL) && __ICL < 600 -# include <boost/shared_ptr.hpp> -# else -# include <memory> -# endif - -namespace boost { namespace python { - -template <class T, class MakeHolder> -struct to_python_indirect -{ - template <class U> - inline PyObject* - operator()(U const& ref) const - { - return this->execute(const_cast<U&>(ref), detail::is_pointer<U>()); - } -#ifndef BOOST_PYTHON_NO_PY_SIGNATURES - inline PyTypeObject const* - get_pytype()const - { - return converter::registered_pytype<T>::get_pytype(); - } -#endif - private: - template <class U> - inline PyObject* execute(U* ptr, detail::true_) const - { - // No special NULL treatment for references - if (ptr == 0) - return python::detail::none(); - else - return this->execute(*ptr, detail::false_()); - } - - template <class U> - inline PyObject* execute(U const& x, detail::false_) const - { - U* const p = &const_cast<U&>(x); - if (detail::is_polymorphic<U>::value) - { - if (PyObject* o = detail::wrapper_base_::owner(p)) - return incref(o); - } - return MakeHolder::execute(p); - } -}; - -// -// implementations -// -namespace detail -{ - struct make_owning_holder - { - template <class T> - static PyObject* execute(T* p) - { - // can't use auto_ptr with Intel 5 and VC6 Dinkum library - // for some reason. We get link errors against the auto_ptr - // copy constructor. -# if defined(__ICL) && __ICL < 600 - typedef boost::shared_ptr<T> smart_pointer; -# elif defined(BOOST_NO_CXX11_SMART_PTR) - typedef std::auto_ptr<T> smart_pointer; -# else - typedef std::unique_ptr<T> smart_pointer; -# endif - typedef objects::pointer_holder<smart_pointer, T> holder_t; - - smart_pointer ptr(const_cast<T*>(p)); - return objects::make_ptr_instance<T, holder_t>::execute(ptr); - } - }; - - struct make_reference_holder - { - template <class T> - static PyObject* execute(T* p) - { - typedef objects::pointer_holder<T*, T> holder_t; - T* q = const_cast<T*>(p); - return objects::make_ptr_instance<T, holder_t>::execute(q); - } - }; -} - -}} // namespace boost::python - -#endif // TO_PYTHON_INDIRECT_DWA200221_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/to_python_value.hpp b/contrib/restricted/boost/python/include/boost/python/to_python_value.hpp deleted file mode 100644 index b6ec0135ba..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/to_python_value.hpp +++ /dev/null @@ -1,177 +0,0 @@ -// Copyright David Abrahams 2002. -// Copyright Stefan Seefeld 2016. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef boost_python_to_python_value_hpp_ -#define boost_python_to_python_value_hpp_ - -#include <boost/python/detail/prefix.hpp> - -#include <boost/python/refcount.hpp> -#include <boost/python/tag.hpp> -#include <boost/python/handle.hpp> - -#include <boost/python/converter/registry.hpp> -#include <boost/python/converter/registered.hpp> -#include <boost/python/converter/builtin_converters.hpp> -#include <boost/python/converter/object_manager.hpp> -#include <boost/python/converter/shared_ptr_to_python.hpp> - -#include <boost/python/detail/type_traits.hpp> -#include <boost/python/detail/value_is_shared_ptr.hpp> -#include <boost/python/detail/value_arg.hpp> - -#include <boost/mpl/if.hpp> -#include <boost/mpl/or.hpp> - -namespace boost { namespace python { - -namespace detail -{ -#ifndef BOOST_PYTHON_NO_PY_SIGNATURES - -template <bool is_const_ref> -struct object_manager_get_pytype -{ - template <class U> - static PyTypeObject const* get( U& (*)() =0) - { - return converter::object_manager_traits<U>::get_pytype(); - } -}; - -template <> -struct object_manager_get_pytype<true> -{ - template <class U> - static PyTypeObject const* get( U const& (*)() =0) - { - return converter::object_manager_traits<U>::get_pytype(); - } -}; - -#endif - - template <class T> - struct object_manager_to_python_value - { - typedef typename value_arg<T>::type argument_type; - - PyObject* operator()(argument_type) const; -#ifndef BOOST_PYTHON_NO_PY_SIGNATURES - typedef boost::mpl::bool_<is_handle<T>::value> is_t_handle; - typedef boost::detail::indirect_traits::is_reference_to_const<T> is_t_const; - PyTypeObject const* get_pytype() const { - return get_pytype_aux((is_t_handle*)0); - } - - inline static PyTypeObject const* get_pytype_aux(mpl::true_*) {return converter::object_manager_traits<T>::get_pytype();} - - inline static PyTypeObject const* get_pytype_aux(mpl::false_* ) - { - return object_manager_get_pytype<is_t_const::value>::get((T(*)())0); - } - -#endif - - // This information helps make_getter() decide whether to try to - // return an internal reference or not. I don't like it much, - // but it will have to serve for now. - BOOST_STATIC_CONSTANT(bool, uses_registry = false); - }; - - - template <class T> - struct registry_to_python_value - { - typedef typename value_arg<T>::type argument_type; - - PyObject* operator()(argument_type) const; -#ifndef BOOST_PYTHON_NO_PY_SIGNATURES - PyTypeObject const* get_pytype() const {return converter::registered<T>::converters.to_python_target_type();} -#endif - - // This information helps make_getter() decide whether to try to - // return an internal reference or not. I don't like it much, - // but it will have to serve for now. - BOOST_STATIC_CONSTANT(bool, uses_registry = true); - }; - - template <class T> - struct shared_ptr_to_python_value - { - typedef typename value_arg<T>::type argument_type; - - PyObject* operator()(argument_type) const; -#ifndef BOOST_PYTHON_NO_PY_SIGNATURES - PyTypeObject const* get_pytype() const {return get_pytype((boost::type<argument_type>*)0);} -#endif - // This information helps make_getter() decide whether to try to - // return an internal reference or not. I don't like it much, - // but it will have to serve for now. - BOOST_STATIC_CONSTANT(bool, uses_registry = false); - private: -#ifndef BOOST_PYTHON_NO_PY_SIGNATURES - template <class U> - PyTypeObject const* get_pytype(boost::type<shared_ptr<U> &> *) const {return converter::registered<U>::converters.to_python_target_type();} - template <class U> - PyTypeObject const* get_pytype(boost::type<const shared_ptr<U> &> *) const {return converter::registered<U>::converters.to_python_target_type();} -# if !defined(BOOST_NO_CXX11_SMART_PTR) - template <class U> - PyTypeObject const* get_pytype(boost::type<std::shared_ptr<U> &> *) const {return converter::registered<U>::converters.to_python_target_type();} - template <class U> - PyTypeObject const* get_pytype(boost::type<const std::shared_ptr<U> &> *) const {return converter::registered<U>::converters.to_python_target_type();} -# endif -#endif - }; -} - -template <class T> -struct to_python_value - : mpl::if_< - detail::value_is_shared_ptr<T> - , detail::shared_ptr_to_python_value<T> - , typename mpl::if_< - mpl::or_< - converter::is_object_manager<T> - , converter::is_reference_to_object_manager<T> - > - , detail::object_manager_to_python_value<T> - , detail::registry_to_python_value<T> - >::type - >::type -{ -}; - -// -// implementation -// -namespace detail -{ - template <class T> - inline PyObject* registry_to_python_value<T>::operator()(argument_type x) const - { - return converter::registered<argument_type>::converters.to_python(&x); - } - - template <class T> - inline PyObject* object_manager_to_python_value<T>::operator()(argument_type x) const - { - return python::upcast<PyObject>( - python::xincref( - get_managed_object(x, tag)) - ); - } - - template <class T> - inline PyObject* shared_ptr_to_python_value<T>::operator()(argument_type x) const - { - return converter::shared_ptr_to_python(x); - } -} - -}} // namespace boost::python - -#endif diff --git a/contrib/restricted/boost/python/include/boost/python/tuple.hpp b/contrib/restricted/boost/python/include/boost/python/tuple.hpp deleted file mode 100644 index babfb63f1e..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/tuple.hpp +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef TUPLE_20020706_HPP -#define TUPLE_20020706_HPP - -# include <boost/python/detail/prefix.hpp> - -#include <boost/python/object.hpp> -#include <boost/python/converter/pytype_object_mgr_traits.hpp> -#include <boost/preprocessor/enum_params.hpp> -#include <boost/preprocessor/repetition/enum_binary_params.hpp> - -namespace boost { namespace python { - -namespace detail -{ - struct BOOST_PYTHON_DECL tuple_base : object - { - protected: - tuple_base(); - tuple_base(object_cref sequence); - - BOOST_PYTHON_FORWARD_OBJECT_CONSTRUCTORS(tuple_base, object) - - private: - static detail::new_reference call(object const&); - }; -} - -class tuple : public detail::tuple_base -{ - typedef detail::tuple_base base; - public: - tuple() {} - - template <class T> - explicit tuple(T const& sequence) - : base(object(sequence)) - { - } - - public: // implementation detail -- for internal use only - BOOST_PYTHON_FORWARD_OBJECT_CONSTRUCTORS(tuple, base) -}; - -// -// Converter Specializations // $$$ JDG $$$ moved here to prevent -// // G++ bug complaining specialization - // provided after instantiation -namespace converter -{ - template <> - struct object_manager_traits<tuple> - : pytype_object_manager_traits<&PyTuple_Type,tuple> - { - }; -} - -// for completeness -inline tuple make_tuple() { return tuple(); } - -# define BOOST_PP_ITERATION_PARAMS_1 (3, (1, BOOST_PYTHON_MAX_ARITY, <boost/python/detail/make_tuple.hpp>)) -# include BOOST_PP_ITERATE() - -}} // namespace boost::python - -#endif - diff --git a/contrib/restricted/boost/python/include/boost/python/type_id.hpp b/contrib/restricted/boost/python/include/boost/python/type_id.hpp deleted file mode 100644 index 601601c311..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/type_id.hpp +++ /dev/null @@ -1,184 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef TYPE_ID_DWA2002517_HPP -# define TYPE_ID_DWA2002517_HPP - -# include <boost/python/detail/prefix.hpp> - -# include <boost/python/detail/msvc_typeinfo.hpp> -# include <boost/operators.hpp> -# include <typeinfo> -# include <cstring> -# include <ostream> -# include <boost/static_assert.hpp> -# include <boost/detail/workaround.hpp> -# include <boost/python/detail/type_traits.hpp> - -# ifndef BOOST_PYTHON_HAVE_GCC_CP_DEMANGLE -# if defined(__GNUC__) \ - && !defined(__EDG_VERSION__) -# define BOOST_PYTHON_HAVE_GCC_CP_DEMANGLE -# endif -# endif - -namespace boost { namespace python { - -// for this compiler at least, cross-shared-library type_info -// comparisons don't work, so use typeid(x).name() instead. It's not -// yet clear what the best default strategy is. -# if defined(__GNUC__) \ - || defined(_AIX) \ - || ( defined(__sgi) && defined(__host_mips)) \ - || (defined(__hpux) && defined(__HP_aCC)) \ - || (defined(linux) && defined(__INTEL_COMPILER) && defined(__ICC)) -# define BOOST_PYTHON_TYPE_ID_NAME -# endif - -#ifdef BOOST_PYTHON_HAVE_GCC_CP_DEMANGLE -// Runtime detection of broken cxxabi::__cxa_demangle versions, -// to avoid #ifdef clutter. -bool cxxabi_cxa_demangle_is_broken(); -#define BOOST_PYTHON_HAVE_CXXABI_CXA_DEMANGLE_IS_BROKEN -#endif - -// type ids which represent the same information as std::type_info -// (i.e. the top-level reference and cv-qualifiers are stripped), but -// which works across shared libraries. -struct type_info : private totally_ordered<type_info> -{ - inline type_info(std::type_info const& = typeid(void)); - - inline bool operator<(type_info const& rhs) const; - inline bool operator==(type_info const& rhs) const; - - char const* name() const; - friend BOOST_PYTHON_DECL std::ostream& operator<<( - std::ostream&, type_info const&); - - private: // data members -# ifdef BOOST_PYTHON_TYPE_ID_NAME - typedef char const* base_id_t; -# else - typedef std::type_info const* base_id_t; -# endif - - base_id_t m_base_type; -}; - - -// This macro is obsolete. Port away and remove. -# define BOOST_PYTHON_EXPLICIT_TT_DEF(T) - -template <class T> -inline type_info type_id() -{ - return type_info( -# if !defined(_MSC_VER) \ - || !BOOST_WORKAROUND(BOOST_INTEL_CXX_VERSION, <= 700) - typeid(T) -# else // strip the decoration which Intel mistakenly leaves in - python::detail::msvc_typeid((boost::type<T>*)0) -# endif - ); -} - -# if (defined(__EDG_VERSION__) && __EDG_VERSION__ < 245) \ - || (defined(__sgi) && defined(_COMPILER_VERSION) && _COMPILER_VERSION <= 744) -// Older EDG-based compilers seems to mistakenly distinguish "int" from -// "signed int", etc., but only in typeid() expressions. However -// though int == signed int, the "signed" decoration is propagated -// down into template instantiations. Explicit specialization stops -// that from taking hold. - -# define BOOST_PYTHON_SIGNED_INTEGRAL_TYPE_ID(T) \ -template <> \ -inline type_info type_id<T>() \ -{ \ - return type_info(typeid(T)); \ -} - -BOOST_PYTHON_SIGNED_INTEGRAL_TYPE_ID(short) -BOOST_PYTHON_SIGNED_INTEGRAL_TYPE_ID(int) -BOOST_PYTHON_SIGNED_INTEGRAL_TYPE_ID(long) -// using Python's macro instead of Boost's - we don't seem to get the -// config right all the time. -# ifdef HAVE_LONG_LONG -BOOST_PYTHON_SIGNED_INTEGRAL_TYPE_ID(long long) -# endif -# undef BOOST_PYTHON_SIGNED_INTEGRAL_TYPE_ID -# endif - -// -inline type_info::type_info(std::type_info const& id) - : m_base_type( -# ifdef BOOST_PYTHON_TYPE_ID_NAME - id.name() -# else - &id -# endif - ) -{ -} - -inline bool type_info::operator<(type_info const& rhs) const -{ -# ifdef BOOST_PYTHON_TYPE_ID_NAME - return std::strcmp(m_base_type, rhs.m_base_type) < 0; -# else - return m_base_type->before(*rhs.m_base_type); -# endif -} - -inline bool type_info::operator==(type_info const& rhs) const -{ -# ifdef BOOST_PYTHON_TYPE_ID_NAME - return !std::strcmp(m_base_type, rhs.m_base_type); -# else - return *m_base_type == *rhs.m_base_type; -# endif -} - -# ifdef BOOST_PYTHON_HAVE_GCC_CP_DEMANGLE -namespace detail -{ - BOOST_PYTHON_DECL char const* gcc_demangle(char const*); -} -# endif - -inline char const* type_info::name() const -{ - char const* raw_name - = m_base_type -# ifndef BOOST_PYTHON_TYPE_ID_NAME - ->name() -# endif - ; - -# ifdef BOOST_PYTHON_HAVE_GCC_CP_DEMANGLE - return detail::gcc_demangle(raw_name); -# else - return raw_name; -# endif -} - - -BOOST_PYTHON_DECL std::ostream& operator<<(std::ostream&, type_info const&); - -template<> -inline type_info type_id<void>() -{ - return type_info (typeid (void *)); -} -# ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS -template<> -inline type_info type_id<const volatile void>() -{ - return type_info (typeid (void *)); -} -# endif - -}} // namespace boost::python - -#endif // TYPE_ID_DWA2002517_HPP diff --git a/contrib/restricted/boost/python/include/boost/python/wrapper.hpp b/contrib/restricted/boost/python/include/boost/python/wrapper.hpp deleted file mode 100644 index 166c8e2327..0000000000 --- a/contrib/restricted/boost/python/include/boost/python/wrapper.hpp +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright David Abrahams 2004. Distributed under the Boost -// Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -#ifndef WRAPPER_DWA2004720_HPP -# define WRAPPER_DWA2004720_HPP - -# include <boost/python/detail/wrapper_base.hpp> -# include <boost/python/override.hpp> -# include <boost/python/converter/registered.hpp> -# include <boost/python/detail/sfinae.hpp> - -namespace boost { namespace python { - -template <class T> -class wrapper : public detail::wrapper_base -{ - public: - // Do not touch this implementation detail! - typedef T _wrapper_wrapped_type_; - - protected: - override get_override(char const* name) const - { - typedef detail::wrapper_base base; - converter::registration const& r - = converter::registered<T>::converters; - PyTypeObject* type = r.get_class_object(); - - return this->base::get_override(name, type); - } -}; - -}} // namespace boost::python - -#endif // WRAPPER_DWA2004720_HPP diff --git a/contrib/restricted/boost/python/src/converter/arg_to_python_base.cpp b/contrib/restricted/boost/python/src/converter/arg_to_python_base.cpp deleted file mode 100644 index d872314a74..0000000000 --- a/contrib/restricted/boost/python/src/converter/arg_to_python_base.cpp +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#include <boost/python/converter/arg_to_python_base.hpp> -#include <boost/python/errors.hpp> -#include <boost/python/converter/registrations.hpp> -#include <boost/python/handle.hpp> -#include <boost/python/refcount.hpp> - -namespace boost { namespace python { namespace converter { - -namespace detail -{ - arg_to_python_base::arg_to_python_base( - void const volatile* source, registration const& converters) -# if !defined(BOOST_MSVC) || BOOST_MSVC <= 1300 || _MSC_FULL_VER > 13102179 - : handle<> -# else - : m_ptr -# endif - (converters.to_python(source)) - { - } -} - -}}} // namespace boost::python::converter diff --git a/contrib/restricted/boost/python/src/converter/builtin_converters.cpp b/contrib/restricted/boost/python/src/converter/builtin_converters.cpp deleted file mode 100644 index ee2d5b4794..0000000000 --- a/contrib/restricted/boost/python/src/converter/builtin_converters.cpp +++ /dev/null @@ -1,592 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#include <boost/python/handle.hpp> -#include <boost/python/type_id.hpp> -#include <boost/python/errors.hpp> -#include <boost/python/refcount.hpp> - -#include <boost/python/detail/config.hpp> -#include <boost/python/detail/wrap_python.hpp> - -#include <boost/python/converter/builtin_converters.hpp> -#include <boost/python/converter/rvalue_from_python_data.hpp> -#include <boost/python/converter/registry.hpp> -#include <boost/python/converter/registrations.hpp> -#include <boost/python/converter/shared_ptr_deleter.hpp> -#include <boost/python/converter/pytype_function.hpp> - -#include <boost/cast.hpp> -#include <string> -#include <complex> - -namespace boost { namespace python { namespace converter { - -shared_ptr_deleter::shared_ptr_deleter(handle<> owner) - : owner(owner) -{} - -shared_ptr_deleter::~shared_ptr_deleter() {} - -void shared_ptr_deleter::operator()(void const*) -{ - owner.reset(); -} - -namespace -{ - - // An lvalue conversion function which extracts a char const* from a - // Python String. -#if PY_VERSION_HEX < 0x03000000 - void* convert_to_cstring(PyObject* obj) - { - return PyString_Check(obj) ? PyString_AsString(obj) : 0; - } -#elif PY_VERSION_HEX < 0x03070000 - void* convert_to_cstring(PyObject* obj) - { - return PyUnicode_Check(obj) ? _PyUnicode_AsString(obj) : 0; - } -#else - void* convert_to_cstring(PyObject* obj) - { - return PyUnicode_Check(obj) ? const_cast<void*>(reinterpret_cast<const void*>(_PyUnicode_AsString(obj))) : 0; - } -#endif - - // Given a target type and a SlotPolicy describing how to perform a - // given conversion, registers from_python converters which use the - // SlotPolicy to extract the type. - template <class T, class SlotPolicy> - struct slot_rvalue_from_python - { - public: - slot_rvalue_from_python() - { - registry::insert( - &slot_rvalue_from_python<T,SlotPolicy>::convertible - , &slot_rvalue_from_python<T,SlotPolicy>::construct - , type_id<T>() - , &SlotPolicy::get_pytype - ); - } - - private: - static void* convertible(PyObject* obj) - { - unaryfunc* slot = SlotPolicy::get_slot(obj); - return slot && *slot ? slot : 0; - } - - static void construct(PyObject* obj, rvalue_from_python_stage1_data* data) - { - // Get the (intermediate) source object - unaryfunc creator = *static_cast<unaryfunc*>(data->convertible); - handle<> intermediate(creator(obj)); - - // Get the location in which to construct - void* storage = ((rvalue_from_python_storage<T>*)data)->storage.bytes; -# ifdef _MSC_VER -# pragma warning(push) -# pragma warning(disable:4244) -# endif - new (storage) T( SlotPolicy::extract(intermediate.get()) ); - -# ifdef _MSC_VER -# pragma warning(pop) -# endif - // record successful construction - data->convertible = storage; - } - }; - - // identity_unaryfunc/py_object_identity -- manufacture a unaryfunc - // "slot" which just returns its argument. - extern "C" PyObject* identity_unaryfunc(PyObject* x) - { - Py_INCREF(x); - return x; - } - unaryfunc py_object_identity = identity_unaryfunc; - -#if PY_VERSION_HEX >= 0x03000000 - // As in Python 3 there is only one integer type, we can have much - // simplified logic. - // XXX(bhy) maybe the code will work with 2.6 or even 2.5? - struct int_rvalue_from_python_base - { - static unaryfunc* get_slot(PyObject* obj) - { - return PyLong_Check(obj) ? &py_object_identity : 0; - } - static PyTypeObject const* get_pytype() {return &PyLong_Type;} - }; - - template <class T> - struct signed_int_rvalue_from_python : int_rvalue_from_python_base - { - static T extract(PyObject* intermediate) - { - long x = PyLong_AsLong(intermediate); - if (PyErr_Occurred()) - throw_error_already_set(); - return numeric_cast<T>(x); - } - }; - - template <class T> - struct unsigned_int_rvalue_from_python : int_rvalue_from_python_base - { - static T extract(PyObject* intermediate) - { - unsigned long x = PyLong_AsUnsignedLong(intermediate); - if (PyErr_Occurred()) - throw_error_already_set(); - return numeric_cast<T>(x); - } - }; -#else // PY_VERSION_HEX >= 0x03000000 - // A SlotPolicy for extracting signed integer types from Python objects - struct signed_int_rvalue_from_python_base - { - static unaryfunc* get_slot(PyObject* obj) - { - PyNumberMethods* number_methods = obj->ob_type->tp_as_number; - if (number_methods == 0) - return 0; - - return ( -#if PY_VERSION_HEX >= 0x02040000 && defined(BOOST_PYTHON_BOOL_INT_STRICT) - !PyBool_Check(obj) && -#endif - (PyInt_Check(obj) || PyLong_Check(obj))) - - ? &number_methods->nb_int : 0; - } - static PyTypeObject const* get_pytype() { return &PyInt_Type;} - }; - - template <class T> - struct signed_int_rvalue_from_python : signed_int_rvalue_from_python_base - { - static T extract(PyObject* intermediate) - { - long x = PyInt_AsLong(intermediate); - if (PyErr_Occurred()) - throw_error_already_set(); - return numeric_cast<T>(x); - } - }; - - // A SlotPolicy for extracting unsigned integer types from Python objects - struct unsigned_int_rvalue_from_python_base - { - static unaryfunc* get_slot(PyObject* obj) - { - PyNumberMethods* number_methods = obj->ob_type->tp_as_number; - if (number_methods == 0) - return 0; - - return ( -#if PY_VERSION_HEX >= 0x02040000 && defined(BOOST_PYTHON_BOOL_INT_STRICT) - !PyBool_Check(obj) && -#endif - (PyInt_Check(obj) || PyLong_Check(obj))) - ? &py_object_identity : 0; - } - static PyTypeObject const* get_pytype() { return &PyInt_Type;} - }; - - template <class T> - struct unsigned_int_rvalue_from_python : unsigned_int_rvalue_from_python_base - { - static T extract(PyObject* intermediate) - { - if (PyLong_Check(intermediate)) { - // PyLong_AsUnsignedLong() checks for negative overflow, so no - // need to check it here. - unsigned long result = PyLong_AsUnsignedLong(intermediate); - if (PyErr_Occurred()) - throw_error_already_set(); - return numeric_cast<T>(result); - } else { - // None of PyInt_AsUnsigned*() functions check for negative - // overflow, so use PyInt_AS_LONG instead and check if number is - // negative, issuing the exception appropriately. - long result = PyInt_AS_LONG(intermediate); - if (PyErr_Occurred()) - throw_error_already_set(); - if (result < 0) { - PyErr_SetString(PyExc_OverflowError, "can't convert negative" - " value to unsigned"); - throw_error_already_set(); - } - return numeric_cast<T>(result); - } - } - }; -#endif // PY_VERSION_HEX >= 0x03000000 - -// Checking Python's macro instead of Boost's - we don't seem to get -// the config right all the time. Furthermore, Python's is defined -// when long long is absent but __int64 is present. - -#ifdef HAVE_LONG_LONG - // A SlotPolicy for extracting long long types from Python objects - - struct long_long_rvalue_from_python_base - { - static unaryfunc* get_slot(PyObject* obj) - { -#if PY_VERSION_HEX >= 0x03000000 - return PyLong_Check(obj) ? &py_object_identity : 0; -#else - PyNumberMethods* number_methods = obj->ob_type->tp_as_number; - if (number_methods == 0) - return 0; - - // Return the identity conversion slot to avoid creating a - // new object. We'll handle that in the extract function - if (PyInt_Check(obj)) - return &number_methods->nb_int; - else if (PyLong_Check(obj)) - return &number_methods->nb_long; - else - return 0; -#endif - } - static PyTypeObject const* get_pytype() { return &PyLong_Type;} - }; - - struct long_long_rvalue_from_python : long_long_rvalue_from_python_base - { - static BOOST_PYTHON_LONG_LONG extract(PyObject* intermediate) - { -#if PY_VERSION_HEX < 0x03000000 - if (PyInt_Check(intermediate)) - { - return PyInt_AS_LONG(intermediate); - } - else -#endif - { - BOOST_PYTHON_LONG_LONG result = PyLong_AsLongLong(intermediate); - - if (PyErr_Occurred()) - throw_error_already_set(); - - return result; - } - } - }; - - struct unsigned_long_long_rvalue_from_python : long_long_rvalue_from_python_base - { - static unsigned BOOST_PYTHON_LONG_LONG extract(PyObject* intermediate) - { -#if PY_VERSION_HEX < 0x03000000 - if (PyInt_Check(intermediate)) - { - return numeric_cast<unsigned BOOST_PYTHON_LONG_LONG>(PyInt_AS_LONG(intermediate)); - } - else -#endif - { - unsigned BOOST_PYTHON_LONG_LONG result = PyLong_AsUnsignedLongLong(intermediate); - - if (PyErr_Occurred()) - throw_error_already_set(); - - return result; - } - } - }; -#endif - - // A SlotPolicy for extracting bool from a Python object - struct bool_rvalue_from_python - { - static unaryfunc* get_slot(PyObject* obj) - { -#if PY_VERSION_HEX >= 0x03000000 - return obj == Py_None || PyLong_Check(obj) ? &py_object_identity : 0; -#elif PY_VERSION_HEX >= 0x02040000 && defined(BOOST_PYTHON_BOOL_INT_STRICT) - return obj == Py_None || PyBool_Check(obj) ? &py_object_identity : 0; -#else - return obj == Py_None || PyInt_Check(obj) ? &py_object_identity : 0; -#endif - } - - static bool extract(PyObject* intermediate) - { - return PyObject_IsTrue(intermediate); - } - - static PyTypeObject const* get_pytype() - { -#if PY_VERSION_HEX >= 0x02030000 - return &PyBool_Type; -#else - return &PyInt_Type; -#endif - } - }; - - // A SlotPolicy for extracting floating types from Python objects. - struct float_rvalue_from_python - { - static unaryfunc* get_slot(PyObject* obj) - { - PyNumberMethods* number_methods = obj->ob_type->tp_as_number; - if (number_methods == 0) - return 0; - - // For integer types, return the tp_int conversion slot to avoid - // creating a new object. We'll handle that below -#if PY_VERSION_HEX < 0x03000000 - if (PyInt_Check(obj)) - return &number_methods->nb_int; -#endif - - return (PyLong_Check(obj) || PyFloat_Check(obj)) - ? &number_methods->nb_float : 0; - } - - static double extract(PyObject* intermediate) - { -#if PY_VERSION_HEX < 0x03000000 - if (PyInt_Check(intermediate)) - { - return PyInt_AS_LONG(intermediate); - } - else -#endif - { - return PyFloat_AS_DOUBLE(intermediate); - } - } - static PyTypeObject const* get_pytype() { return &PyFloat_Type;} - }; - -#if PY_VERSION_HEX >= 0x03000000 - unaryfunc py_unicode_as_string_unaryfunc = PyUnicode_AsUTF8String; -#endif - - // A SlotPolicy for extracting C++ strings from Python objects. - struct string_rvalue_from_python - { - // If the underlying object is "string-able" this will succeed - static unaryfunc* get_slot(PyObject* obj) - { -#if PY_VERSION_HEX >= 0x03000000 - return (PyUnicode_Check(obj)) ? &py_unicode_as_string_unaryfunc : - PyBytes_Check(obj) ? &py_object_identity : 0; -#else - return (PyString_Check(obj)) ? &obj->ob_type->tp_str : 0; - -#endif - }; - - // Remember that this will be used to construct the result object -#if PY_VERSION_HEX >= 0x03000000 - static std::string extract(PyObject* intermediate) - { - return std::string(PyBytes_AsString(intermediate),PyBytes_Size(intermediate)); - } - static PyTypeObject const* get_pytype() { return &PyUnicode_Type;} -#else - static std::string extract(PyObject* intermediate) - { - return std::string(PyString_AsString(intermediate),PyString_Size(intermediate)); - } - static PyTypeObject const* get_pytype() { return &PyString_Type;} -#endif - }; - -#if defined(Py_USING_UNICODE) && !defined(BOOST_NO_STD_WSTRING) - // encode_string_unaryfunc/py_encode_string -- manufacture a unaryfunc - // "slot" which encodes a Python string using the default encoding - extern "C" PyObject* encode_string_unaryfunc(PyObject* x) - { - return PyUnicode_FromEncodedObject( x, 0, 0 ); - } - unaryfunc py_encode_string = encode_string_unaryfunc; - - // A SlotPolicy for extracting C++ strings from Python objects. - struct wstring_rvalue_from_python - { - // If the underlying object is "string-able" this will succeed - static unaryfunc* get_slot(PyObject* obj) - { - return PyUnicode_Check(obj) - ? &py_object_identity -#if PY_VERSION_HEX >= 0x03000000 - : PyBytes_Check(obj) -#else - : PyString_Check(obj) -#endif - ? &py_encode_string - : 0; - }; - - // Remember that this will be used to construct the result object - static std::wstring extract(PyObject* intermediate) - { - // On Windows, with Python >= 3.3, PyObject_Length cannot be used to get - // the size of the wchar_t string, because it will count the number of - // *code points*, but some characters not on the BMP will use two UTF-16 - // *code units* (surrogate pairs). - // This is not a problem on Unix, since wchar_t is 32-bit. -#if defined(_WIN32) && PY_VERSION_HEX >= 0x03030000 - BOOST_STATIC_ASSERT(sizeof(wchar_t) == 2); - - Py_ssize_t size = 0; - wchar_t *buf = PyUnicode_AsWideCharString(intermediate, &size); - if (buf == NULL) { - boost::python::throw_error_already_set(); - } - std::wstring result(buf, size); - PyMem_Free(buf); -#else - std::wstring result(::PyObject_Length(intermediate), L' '); - if (!result.empty()) - { - int err = PyUnicode_AsWideChar( -#if PY_VERSION_HEX < 0x03020000 - (PyUnicodeObject *) -#endif - intermediate - , &result[0] - , result.size()); - - if (err == -1) - throw_error_already_set(); - } -#endif - return result; - } - static PyTypeObject const* get_pytype() { return &PyUnicode_Type;} - }; -#endif - - struct complex_rvalue_from_python - { - static unaryfunc* get_slot(PyObject* obj) - { - if (PyComplex_Check(obj)) - return &py_object_identity; - else - return float_rvalue_from_python::get_slot(obj); - } - - static std::complex<double> extract(PyObject* intermediate) - { - if (PyComplex_Check(intermediate)) - { - return std::complex<double>( - PyComplex_RealAsDouble(intermediate) - , PyComplex_ImagAsDouble(intermediate)); - } -#if PY_VERSION_HEX < 0x03000000 - else if (PyInt_Check(intermediate)) - { - return PyInt_AS_LONG(intermediate); - } -#endif - else - { - return PyFloat_AS_DOUBLE(intermediate); - } - } - static PyTypeObject const* get_pytype() { return &PyComplex_Type;} - }; -} - -BOOST_PYTHON_DECL PyObject* do_return_to_python(char x) -{ -#if PY_VERSION_HEX >= 0x03000000 - return PyUnicode_FromStringAndSize(&x, 1); -#else - return PyString_FromStringAndSize(&x, 1); -#endif -} - -BOOST_PYTHON_DECL PyObject* do_return_to_python(char const* x) -{ -#if PY_VERSION_HEX >= 0x03000000 - return x ? PyUnicode_FromString(x) : boost::python::detail::none(); -#else - return x ? PyString_FromString(x) : boost::python::detail::none(); -#endif -} - -BOOST_PYTHON_DECL PyObject* do_return_to_python(PyObject* x) -{ - return x ? x : boost::python::detail::none(); -} - -BOOST_PYTHON_DECL PyObject* do_arg_to_python(PyObject* x) -{ - if (x == 0) - return boost::python::detail::none(); - - Py_INCREF(x); - return x; -} - -#define REGISTER_INT_CONVERTERS(signedness, U) \ - slot_rvalue_from_python< \ - signedness U \ - ,signedness##_int_rvalue_from_python<signedness U> \ - >() - -#define REGISTER_INT_CONVERTERS2(U) \ - REGISTER_INT_CONVERTERS(signed, U); \ - REGISTER_INT_CONVERTERS(unsigned, U) - -void initialize_builtin_converters() -{ - // booleans - slot_rvalue_from_python<bool,bool_rvalue_from_python>(); - - // integer types - REGISTER_INT_CONVERTERS2(char); - REGISTER_INT_CONVERTERS2(short); - REGISTER_INT_CONVERTERS2(int); - REGISTER_INT_CONVERTERS2(long); - -// using Python's macro instead of Boost's - we don't seem to get the -// config right all the time. -# ifdef HAVE_LONG_LONG - slot_rvalue_from_python<signed BOOST_PYTHON_LONG_LONG,long_long_rvalue_from_python>(); - slot_rvalue_from_python<unsigned BOOST_PYTHON_LONG_LONG,unsigned_long_long_rvalue_from_python>(); -# endif - - // floating types - slot_rvalue_from_python<float,float_rvalue_from_python>(); - slot_rvalue_from_python<double,float_rvalue_from_python>(); - slot_rvalue_from_python<long double,float_rvalue_from_python>(); - - slot_rvalue_from_python<std::complex<float>,complex_rvalue_from_python>(); - slot_rvalue_from_python<std::complex<double>,complex_rvalue_from_python>(); - slot_rvalue_from_python<std::complex<long double>,complex_rvalue_from_python>(); - - // Add an lvalue converter for char which gets us char const* -#if PY_VERSION_HEX < 0x03000000 - registry::insert(convert_to_cstring,type_id<char>(),&converter::wrap_pytype<&PyString_Type>::get_pytype); -#else - registry::insert(convert_to_cstring,type_id<char>(),&converter::wrap_pytype<&PyUnicode_Type>::get_pytype); -#endif - - // Register by-value converters to std::string, std::wstring -#if defined(Py_USING_UNICODE) && !defined(BOOST_NO_STD_WSTRING) - slot_rvalue_from_python<std::wstring, wstring_rvalue_from_python>(); -# endif - slot_rvalue_from_python<std::string, string_rvalue_from_python>(); - -} - -}}} // namespace boost::python::converter diff --git a/contrib/restricted/boost/python/src/converter/from_python.cpp b/contrib/restricted/boost/python/src/converter/from_python.cpp deleted file mode 100644 index 9678be1cb6..0000000000 --- a/contrib/restricted/boost/python/src/converter/from_python.cpp +++ /dev/null @@ -1,303 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#include <boost/python/converter/from_python.hpp> -#include <boost/python/converter/registrations.hpp> -#include <boost/python/converter/rvalue_from_python_data.hpp> - -#include <boost/python/object/find_instance.hpp> - -#include <boost/python/handle.hpp> -#include <boost/python/detail/raw_pyobject.hpp> -#include <boost/python/cast.hpp> - -#include <vector> -#include <algorithm> - -namespace boost { namespace python { namespace converter { - -// rvalue_from_python_stage1 -- do the first stage of a conversion -// from a Python object to a C++ rvalue. -// -// source - the Python object to be converted -// converters - the registry entry for the target type T -// -// Postcondition: where x is the result, one of: -// -// 1. x.convertible == 0, indicating failure -// -// 2. x.construct == 0, x.convertible is the address of an object of -// type T. Indicates a successful lvalue conversion -// -// 3. where y is of type rvalue_from_python_data<T>, -// x.construct(source, y) constructs an object of type T -// in y.storage.bytes and then sets y.convertible == y.storage.bytes, -// or else throws an exception and has no effect. -BOOST_PYTHON_DECL rvalue_from_python_stage1_data rvalue_from_python_stage1( - PyObject* source - , registration const& converters) -{ - rvalue_from_python_stage1_data data; - - // First check to see if it's embedded in an extension class - // instance, as a special case. - data.convertible = objects::find_instance_impl(source, converters.target_type, converters.is_shared_ptr); - data.construct = 0; - if (!data.convertible) - { - for (rvalue_from_python_chain const* chain = converters.rvalue_chain; - chain != 0; - chain = chain->next) - { - void* r = chain->convertible(source); - if (r != 0) - { - data.convertible = r; - data.construct = chain->construct; - break; - } - } - } - return data; -} - -// rvalue_result_from_python -- return the address of a C++ object which -// can be used as the result of calling a Python function. -// -// src - the Python object to be converted -// -// data - a reference to the base part of a -// rvalue_from_python_data<T> object, where T is the -// target type of the conversion. -// -// Requires: data.convertible == ®istered<T>::converters -// -BOOST_PYTHON_DECL void* rvalue_result_from_python( - PyObject* src, rvalue_from_python_stage1_data& data) -{ - // Retrieve the registration - // Cast in two steps for less-capable compilers - void const* converters_ = data.convertible; - registration const& converters = *static_cast<registration const*>(converters_); - - // Look for an eligible converter - data = rvalue_from_python_stage1(src, converters); - return rvalue_from_python_stage2(src, data, converters); -} - -BOOST_PYTHON_DECL void* rvalue_from_python_stage2( - PyObject* source, rvalue_from_python_stage1_data& data, registration const& converters) -{ - if (!data.convertible) - { - handle<> msg( -#if PY_VERSION_HEX >= 0x03000000 - ::PyUnicode_FromFormat -#else - ::PyString_FromFormat -#endif - ( - "No registered converter was able to produce a C++ rvalue of type %s from this Python object of type %s" - , converters.target_type.name() - , source->ob_type->tp_name - )); - - PyErr_SetObject(PyExc_TypeError, msg.get()); - throw_error_already_set(); - } - - // If a construct function was registered (i.e. we found an - // rvalue conversion), call it now. - if (data.construct != 0) - data.construct(source, &data); - - // Return the address of the resulting C++ object - return data.convertible; -} - -BOOST_PYTHON_DECL void* get_lvalue_from_python( - PyObject* source - , registration const& converters) -{ - // Check to see if it's embedded in a class instance - void* x = objects::find_instance_impl(source, converters.target_type); - if (x) - return x; - - lvalue_from_python_chain const* chain = converters.lvalue_chain; - for (;chain != 0; chain = chain->next) - { - void* r = chain->convert(source); - if (r != 0) - return r; - } - return 0; -} - -namespace -{ - // Prevent looping in implicit conversions. This could/should be - // much more efficient, but will work for now. - typedef std::vector<rvalue_from_python_chain const*> visited_t; - static visited_t visited; - - inline bool visit(rvalue_from_python_chain const* chain) - { - visited_t::iterator const p = std::lower_bound(visited.begin(), visited.end(), chain); - if (p != visited.end() && *p == chain) - return false; - visited.insert(p, chain); - return true; - } - - // RAII class for managing global visited marks. - struct unvisit - { - unvisit(rvalue_from_python_chain const* chain) - : chain(chain) {} - - ~unvisit() - { - visited_t::iterator const p = std::lower_bound(visited.begin(), visited.end(), chain); - assert(p != visited.end()); - visited.erase(p); - } - private: - rvalue_from_python_chain const* chain; - }; -} - - -BOOST_PYTHON_DECL bool implicit_rvalue_convertible_from_python( - PyObject* source - , registration const& converters) -{ - if (objects::find_instance_impl(source, converters.target_type)) - return true; - - rvalue_from_python_chain const* chain = converters.rvalue_chain; - - if (!visit(chain)) - return false; - - unvisit protect(chain); - - for (;chain != 0; chain = chain->next) - { - if (chain->convertible(source)) - return true; - } - - return false; -} - -namespace -{ - void throw_no_lvalue_from_python(PyObject* source, registration const& converters, char const* ref_type) - { - handle<> msg( -#if PY_VERSION_HEX >= 0x03000000 - ::PyUnicode_FromFormat -#else - ::PyString_FromFormat -#endif - ( - "No registered converter was able to extract a C++ %s to type %s" - " from this Python object of type %s" - , ref_type - , converters.target_type.name() - , source->ob_type->tp_name - )); - - PyErr_SetObject(PyExc_TypeError, msg.get()); - - throw_error_already_set(); - } - - void* lvalue_result_from_python( - PyObject* source - , registration const& converters - , char const* ref_type) - { - handle<> holder(source); - if (source->ob_refcnt <= 1) - { - handle<> msg( -#if PY_VERSION_HEX >= 0x3000000 - ::PyUnicode_FromFormat -#else - ::PyString_FromFormat -#endif - ( - "Attempt to return dangling %s to object of type: %s" - , ref_type - , converters.target_type.name())); - - PyErr_SetObject(PyExc_ReferenceError, msg.get()); - - throw_error_already_set(); - } - - void* result = get_lvalue_from_python(source, converters); - if (!result) - (throw_no_lvalue_from_python)(source, converters, ref_type); - return result; - } - -} - -BOOST_PYTHON_DECL void throw_no_pointer_from_python(PyObject* source, registration const& converters) -{ - (throw_no_lvalue_from_python)(source, converters, "pointer"); -} - -BOOST_PYTHON_DECL void throw_no_reference_from_python(PyObject* source, registration const& converters) -{ - (throw_no_lvalue_from_python)(source, converters, "reference"); -} - -BOOST_PYTHON_DECL void* reference_result_from_python( - PyObject* source - , registration const& converters) -{ - return (lvalue_result_from_python)(source, converters, "reference"); -} - -BOOST_PYTHON_DECL void* pointer_result_from_python( - PyObject* source - , registration const& converters) -{ - if (source == Py_None) - { - Py_DECREF(source); - return 0; - } - return (lvalue_result_from_python)(source, converters, "pointer"); -} - -BOOST_PYTHON_DECL void void_result_from_python(PyObject* o) -{ - Py_DECREF(expect_non_null(o)); -} - -} // namespace boost::python::converter - -BOOST_PYTHON_DECL PyObject* -pytype_check(PyTypeObject* type_, PyObject* source) -{ - if (!PyObject_IsInstance(source, python::upcast<PyObject>(type_))) - { - ::PyErr_Format( - PyExc_TypeError - , "Expecting an object of type %s; got an object of type %s instead" - , type_->tp_name - , source->ob_type->tp_name - ); - throw_error_already_set(); - } - return source; -} - -}} // namespace boost::python diff --git a/contrib/restricted/boost/python/src/converter/registry.cpp b/contrib/restricted/boost/python/src/converter/registry.cpp deleted file mode 100644 index aa20c3f685..0000000000 --- a/contrib/restricted/boost/python/src/converter/registry.cpp +++ /dev/null @@ -1,306 +0,0 @@ -// Copyright David Abrahams 2001. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#include <boost/python/converter/registry.hpp> -#include <boost/python/converter/registrations.hpp> -#include <boost/python/converter/builtin_converters.hpp> - -#include <set> -#include <stdexcept> - -#if defined(__APPLE__) && defined(__MACH__) && defined(__GNUC__) \ - && __GNUC__ == 3 && __GNUC_MINOR__ <= 4 && !defined(__APPLE_CC__) -# define BOOST_PYTHON_CONVERTER_REGISTRY_APPLE_MACH_WORKAROUND -#endif - -#if defined(BOOST_PYTHON_TRACE_REGISTRY) \ - || defined(BOOST_PYTHON_CONVERTER_REGISTRY_APPLE_MACH_WORKAROUND) -# include <iostream> -#endif - -namespace boost { namespace python { namespace converter { -BOOST_PYTHON_DECL PyTypeObject const* registration::expected_from_python_type() const -{ - if (this->m_class_object != 0) - return this->m_class_object; - - std::set<PyTypeObject const*> pool; - - for(rvalue_from_python_chain* r = rvalue_chain; r ; r=r->next) - if(r->expected_pytype) - pool.insert(r->expected_pytype()); - - //for now I skip the search for common base - if (pool.size()==1) - return *pool.begin(); - - return 0; - -} - -BOOST_PYTHON_DECL PyTypeObject const* registration::to_python_target_type() const -{ - if (this->m_class_object != 0) - return this->m_class_object; - - if (this->m_to_python_target_type != 0) - return this->m_to_python_target_type(); - - return 0; -} - -BOOST_PYTHON_DECL PyTypeObject* registration::get_class_object() const -{ - if (this->m_class_object == 0) - { - ::PyErr_Format( - PyExc_TypeError - , const_cast<char*>("No Python class registered for C++ class %s") - , this->target_type.name()); - - throw_error_already_set(); - } - - return this->m_class_object; -} - -BOOST_PYTHON_DECL PyObject* registration::to_python(void const volatile* source) const -{ - if (this->m_to_python == 0) - { - handle<> msg( -#if PY_VERSION_HEX >= 0x3000000 - ::PyUnicode_FromFormat -#else - ::PyString_FromFormat -#endif - ( - "No to_python (by-value) converter found for C++ type: %s" - , this->target_type.name() - ) - ); - - PyErr_SetObject(PyExc_TypeError, msg.get()); - - throw_error_already_set(); - } - - return source == 0 - ? incref(Py_None) - : this->m_to_python(const_cast<void*>(source)); -} - -namespace -{ - template< typename T > - void delete_node( T* node ) - { - if( !!node && !!node->next ) - delete_node( node->next ); - delete node; - } -} - -registration::~registration() -{ - delete_node(lvalue_chain); - delete_node(rvalue_chain); -} - - -namespace // <unnamed> -{ - typedef registration entry; - - typedef std::set<entry> registry_t; - -#ifndef BOOST_PYTHON_CONVERTER_REGISTRY_APPLE_MACH_WORKAROUND - registry_t& entries() - { - static registry_t registry; - -# ifndef BOOST_PYTHON_SUPPRESS_REGISTRY_INITIALIZATION - static bool builtin_converters_initialized = false; - if (!builtin_converters_initialized) - { - // Make this true early because registering the builtin - // converters will cause recursion. - builtin_converters_initialized = true; - - initialize_builtin_converters(); - } -# ifdef BOOST_PYTHON_TRACE_REGISTRY - std::cout << "registry: "; - for (registry_t::iterator p = registry.begin(); p != registry.end(); ++p) - { - std::cout << p->target_type << "; "; - } - std::cout << '\n'; -# endif -# endif - return registry; - } -#else - registry_t& static_registry() - { - static registry_t result; - return result; - } - - bool static_builtin_converters_initialized() - { - static bool result = false; - if (result == false) { - result = true; - std::cout << std::flush; - return false; - } - return true; - } - - registry_t& entries() - { -# ifndef BOOST_PYTHON_SUPPRESS_REGISTRY_INITIALIZATION - if (!static_builtin_converters_initialized()) - { - initialize_builtin_converters(); - } -# ifdef BOOST_PYTHON_TRACE_REGISTRY - std::cout << "registry: "; - for (registry_t::iterator p = static_registry().begin(); p != static_registry().end(); ++p) - { - std::cout << p->target_type << "; "; - } - std::cout << '\n'; -# endif -# endif - return static_registry(); - } -#endif // BOOST_PYTHON_CONVERTER_REGISTRY_APPLE_MACH_WORKAROUND - - entry* get(type_info type, bool is_shared_ptr = false) - { -# ifdef BOOST_PYTHON_TRACE_REGISTRY - registry_t::iterator p = entries().find(entry(type)); - - std::cout << "looking up " << type << ": " - << (p == entries().end() || p->target_type != type - ? "...NOT found\n" : "...found\n"); -# endif - std::pair<registry_t::const_iterator,bool> pos_ins - = entries().insert(entry(type,is_shared_ptr)); - -# if __MWERKS__ >= 0x3000 - // do a little invariant checking if a change was made - if ( pos_ins.second ) - assert(entries().invariants()); -# endif - return const_cast<entry*>(&*pos_ins.first); - } -} // namespace <unnamed> - -namespace registry -{ - void insert(to_python_function_t f, type_info source_t, PyTypeObject const* (*to_python_target_type)()) - { -# ifdef BOOST_PYTHON_TRACE_REGISTRY - std::cout << "inserting to_python " << source_t << "\n"; -# endif - entry* slot = get(source_t); - - assert(slot->m_to_python == 0); // we have a problem otherwise - if (slot->m_to_python != 0) - { - std::string msg = ( - std::string("to-Python converter for ") - + source_t.name() - + " already registered; second conversion method ignored." - ); - - if ( ::PyErr_Warn( NULL, const_cast<char*>(msg.c_str()) ) ) - { - throw_error_already_set(); - } - } - slot->m_to_python = f; - slot->m_to_python_target_type = to_python_target_type; - } - - // Insert an lvalue from_python converter - void insert(convertible_function convert, type_info key, PyTypeObject const* (*exp_pytype)()) - { -# ifdef BOOST_PYTHON_TRACE_REGISTRY - std::cout << "inserting lvalue from_python " << key << "\n"; -# endif - entry* found = get(key); - lvalue_from_python_chain *registration = new lvalue_from_python_chain; - registration->convert = convert; - registration->next = found->lvalue_chain; - found->lvalue_chain = registration; - - insert(convert, 0, key,exp_pytype); - } - - // Insert an rvalue from_python converter - void insert(convertible_function convertible - , constructor_function construct - , type_info key - , PyTypeObject const* (*exp_pytype)()) - { -# ifdef BOOST_PYTHON_TRACE_REGISTRY - std::cout << "inserting rvalue from_python " << key << "\n"; -# endif - entry* found = get(key); - rvalue_from_python_chain *registration = new rvalue_from_python_chain; - registration->convertible = convertible; - registration->construct = construct; - registration->expected_pytype = exp_pytype; - registration->next = found->rvalue_chain; - found->rvalue_chain = registration; - } - - // Insert an rvalue from_python converter - void push_back(convertible_function convertible - , constructor_function construct - , type_info key - , PyTypeObject const* (*exp_pytype)()) - { -# ifdef BOOST_PYTHON_TRACE_REGISTRY - std::cout << "push_back rvalue from_python " << key << "\n"; -# endif - rvalue_from_python_chain** found = &get(key)->rvalue_chain; - while (*found != 0) - found = &(*found)->next; - - rvalue_from_python_chain *registration = new rvalue_from_python_chain; - registration->convertible = convertible; - registration->construct = construct; - registration->expected_pytype = exp_pytype; - registration->next = 0; - *found = registration; - } - - registration const& lookup(type_info key) - { - return *get(key); - } - - registration const& lookup_shared_ptr(type_info key) - { - return *get(key, true); - } - - registration const* query(type_info type) - { - registry_t::iterator p = entries().find(entry(type)); -# ifdef BOOST_PYTHON_TRACE_REGISTRY - std::cout << "querying " << type - << (p == entries().end() || p->target_type != type - ? "...NOT found\n" : "...found\n"); -# endif - return (p == entries().end() || p->target_type != type) ? 0 : &*p; - } -} // namespace registry - -}}} // namespace boost::python::converter diff --git a/contrib/restricted/boost/python/src/converter/type_id.cpp b/contrib/restricted/boost/python/src/converter/type_id.cpp deleted file mode 100644 index c6a8bf7a04..0000000000 --- a/contrib/restricted/boost/python/src/converter/type_id.cpp +++ /dev/null @@ -1,212 +0,0 @@ -// Copyright David Abrahams 2001. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#include <boost/python/type_id.hpp> -#include <boost/python/detail/decorated_type_id.hpp> -#include <utility> -#include <vector> -#include <algorithm> -#include <memory> -#include <cstdlib> -#include <cstring> - -#if defined(__QNXNTO__) -# include <ostream> -#else /* defined(__QNXNTO__) */ - -#if !defined(__GNUC__) || __GNUC__ >= 3 || __SGI_STL_PORT || __EDG_VERSION__ -# include <ostream> -#else -# include <ostream.h> -#endif - -# ifdef BOOST_PYTHON_HAVE_GCC_CP_DEMANGLE -# if defined(__GNUC__) && __GNUC__ >= 3 - -// http://lists.debian.org/debian-gcc/2003/09/msg00055.html notes -// that, in cxxabi.h of gcc-3.x for x < 4, this type is used before it -// is declared. -# if __GNUC__ == 3 && __GNUC_MINOR__ < 4 -class __class_type_info; -# endif - -# include <cxxabi.h> -# endif -# endif -#endif /* defined(__QNXNTO__) */ - -namespace boost { namespace python { - -# ifdef BOOST_PYTHON_HAVE_GCC_CP_DEMANGLE - -# if defined(__QNXNTO__) -namespace cxxabi { -extern "C" char* __cxa_demangle(char const*, char*, std::size_t*, int*); -} -# else /* defined(__QNXNTO__) */ - -# ifdef __GNUC__ -# if __GNUC__ < 3 - -namespace cxxabi = :: ; -extern "C" char* __cxa_demangle(char const*, char*, std::size_t*, int*); -# else - -namespace cxxabi = ::abi; // GCC 3.1 and later - -# if __GNUC__ == 3 && __GNUC_MINOR__ == 0 -namespace abi -{ - extern "C" char* __cxa_demangle(char const*, char*, std::size_t*, int*); -} -# endif /* __GNUC__ == 3 && __GNUC_MINOR__ == 0 */ -# endif /* __GNUC__ < 3 */ -# endif /* __GNUC__ */ -# endif /* defined(__QNXNTO__) */ - -namespace -{ - struct compare_first_cstring - { - template <class T> - bool operator()(T const& x, T const& y) - { - return std::strcmp(x.first,y.first) < 0; - } - }; - - struct free_mem - { - free_mem(char*p) - : p(p) {} - - ~free_mem() - { - std::free(p); - } - char* p; - }; -} - -bool cxxabi_cxa_demangle_is_broken() -{ - static bool was_tested = false; - static bool is_broken = false; - if (!was_tested) { - int status; - free_mem keeper(cxxabi::__cxa_demangle("b", 0, 0, &status)); - was_tested = true; - if (status == -2 || strcmp(keeper.p, "bool") != 0) { - is_broken = true; - } - } - return is_broken; -} - -namespace detail -{ - BOOST_PYTHON_DECL char const* gcc_demangle(char const* mangled) - { - typedef std::vector< - std::pair<char const*, char const*> - > mangling_map; - - static mangling_map demangler; - mangling_map::iterator p - = std::lower_bound( - demangler.begin(), demangler.end() - , std::make_pair(mangled, (char const*)0) - , compare_first_cstring()); - - if (p == demangler.end() || strcmp(p->first, mangled)) - { - int status; - free_mem keeper( - cxxabi::__cxa_demangle(mangled, 0, 0, &status) - ); - - assert(status != -3); // invalid argument error - - if (status == -1) - { - throw std::bad_alloc(); - } - else - { - char const* demangled - = status == -2 - // Invalid mangled name. Best we can do is to - // return it intact. - ? mangled - : keeper.p; - - // Ult Mundane, 2005 Aug 17 - // Contributed under the Boost Software License, Version 1.0. - // (See accompanying file LICENSE_1_0.txt or copy at - // http://www.boost.org/LICENSE_1_0.txt) - // The __cxa_demangle function is supposed to translate - // builtin types from their one-character mangled names, - // but it doesn't in gcc 3.3.5 and gcc 3.4.x. - if (cxxabi_cxa_demangle_is_broken() - && status == -2 && strlen(mangled) == 1) - { - // list from - // http://www.codesourcery.com/cxx-abi/abi.html - switch (mangled[0]) - { - case 'v': demangled = "void"; break; - case 'w': demangled = "wchar_t"; break; - case 'b': demangled = "bool"; break; - case 'c': demangled = "char"; break; - case 'a': demangled = "signed char"; break; - case 'h': demangled = "unsigned char"; break; - case 's': demangled = "short"; break; - case 't': demangled = "unsigned short"; break; - case 'i': demangled = "int"; break; - case 'j': demangled = "unsigned int"; break; - case 'l': demangled = "long"; break; - case 'm': demangled = "unsigned long"; break; - case 'x': demangled = "long long"; break; - case 'y': demangled = "unsigned long long"; break; - case 'n': demangled = "__int128"; break; - case 'o': demangled = "unsigned __int128"; break; - case 'f': demangled = "float"; break; - case 'd': demangled = "double"; break; - case 'e': demangled = "long double"; break; - case 'g': demangled = "__float128"; break; - case 'z': demangled = "..."; break; - } - } - - p = demangler.insert(p, std::make_pair(mangled, demangled)); - keeper.p = 0; - } - } - - return p->second; - } -} -# endif - -BOOST_PYTHON_DECL std::ostream& operator<<(std::ostream& os, type_info const& x) -{ - return os << x.name(); -} - -namespace detail -{ - BOOST_PYTHON_DECL std::ostream& operator<<(std::ostream& os, detail::decorated_type_info const& x) - { - os << x.m_base_type; - if (x.m_decoration & decorated_type_info::const_) - os << " const"; - if (x.m_decoration & decorated_type_info::volatile_) - os << " volatile"; - if (x.m_decoration & decorated_type_info::reference) - os << "&"; - return os; - } -} -}} // namespace boost::python::converter diff --git a/contrib/restricted/boost/python/src/dict.cpp b/contrib/restricted/boost/python/src/dict.cpp deleted file mode 100644 index 77d840d455..0000000000 --- a/contrib/restricted/boost/python/src/dict.cpp +++ /dev/null @@ -1,184 +0,0 @@ -// Copyright David Abrahams 2004. Distributed under the Boost -// Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -#include <boost/python/dict.hpp> -#include <boost/python/extract.hpp> - -namespace boost { namespace python { namespace detail { -namespace -{ - // When returning list objects from methods, it may turn out that the - // derived class is returning something else, perhaps something not - // even derived from list. Since it is generally harmless for a - // Boost.Python wrapper object to hold an object of a different - // type, and because calling list() with an object may in fact - // perform a conversion, the least-bad alternative is to assume that - // we have a Python list object and stuff it into the list result. - list assume_list(object const& o) - { - return list(detail::borrowed_reference(o.ptr())); - } - - // No PyDict_CheckExact; roll our own. - inline bool check_exact(dict_base const* p) - { - return p->ptr()->ob_type == &PyDict_Type; - } -} - -detail::new_reference dict_base::call(object const& arg_) -{ - return (detail::new_reference)PyObject_CallFunction( - (PyObject*)&PyDict_Type, const_cast<char*>("(O)"), - arg_.ptr()); -} - -dict_base::dict_base() - : object(detail::new_reference(PyDict_New())) -{} - -dict_base::dict_base(object_cref data) - : object(call(data)) -{} - -void dict_base::clear() -{ - if (check_exact(this)) - PyDict_Clear(this->ptr()); - else - this->attr("clear")(); -} - -dict dict_base::copy() -{ - if (check_exact(this)) - { - return dict(detail::new_reference( - PyDict_Copy(this->ptr()))); - } - else - { - return dict(detail::borrowed_reference( - this->attr("copy")().ptr() - )); - } -} - -object dict_base::get(object_cref k) const -{ - if (check_exact(this)) - { - PyObject* result = PyDict_GetItem(this->ptr(),k.ptr()); - return object(detail::borrowed_reference(result ? result : Py_None)); - } - else - { - return this->attr("get")(k); - } -} - -object dict_base::get(object_cref k, object_cref d) const -{ - return this->attr("get")(k,d); -} - -bool dict_base::has_key(object_cref k) const -{ - return extract<bool>(this->contains(k)); -} - -list dict_base::items() const -{ - if (check_exact(this)) - { - return list(detail::new_reference( - PyDict_Items(this->ptr()))); - } - else - { - return assume_list(this->attr("items")()); - } -} - -object dict_base::iteritems() const -{ - return this->attr("iteritems")(); -} - -object dict_base::iterkeys() const -{ - return this->attr("iterkeys")(); -} - -object dict_base::itervalues() const -{ - return this->attr("itervalues")(); -} - -list dict_base::keys() const -{ - if (check_exact(this)) - { - return list(detail::new_reference( - PyDict_Keys(this->ptr()))); - } - else - { - return assume_list(this->attr("keys")()); - } -} - -tuple dict_base::popitem() -{ - return tuple(detail::borrowed_reference( - this->attr("popitem")().ptr() - )); -} - -object dict_base::setdefault(object_cref k) -{ - return this->attr("setdefault")(k); -} - -object dict_base::setdefault(object_cref k, object_cref d) -{ - return this->attr("setdefault")(k,d); -} - -void dict_base::update(object_cref other) -{ - if (check_exact(this)) - { - if (PyDict_Update(this->ptr(),other.ptr()) == -1) - throw_error_already_set(); - } - else - { - this->attr("update")(other); - } -} - -list dict_base::values() const -{ - if (check_exact(this)) - { - return list(detail::new_reference( - PyDict_Values(this->ptr()))); - } - else - { - return assume_list(this->attr("values")()); - } -} - -static struct register_dict_pytype_ptr -{ - register_dict_pytype_ptr() - { - const_cast<converter::registration &>( - converter::registry::lookup(boost::python::type_id<boost::python::dict>()) - ).m_class_object = &PyDict_Type; - } -}register_dict_pytype_ptr_; - -}}} // namespace boost::python diff --git a/contrib/restricted/boost/python/src/errors.cpp b/contrib/restricted/boost/python/src/errors.cpp deleted file mode 100644 index 34ea22f43e..0000000000 --- a/contrib/restricted/boost/python/src/errors.cpp +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright David Abrahams 2001. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_PYTHON_SOURCE -# define BOOST_PYTHON_SOURCE -#endif - -#include <boost/python/errors.hpp> -#include <boost/cast.hpp> -#include <boost/python/detail/exception_handler.hpp> - -namespace boost { namespace python { - -error_already_set::~error_already_set() {} - -// IMPORTANT: this function may only be called from within a catch block! -BOOST_PYTHON_DECL bool handle_exception_impl(function0<void> f) -{ - try - { - if (detail::exception_handler::chain) - return detail::exception_handler::chain->handle(f); - f(); - return false; - } - catch(const boost::python::error_already_set&) - { - // The python error reporting has already been handled. - } - catch(const std::bad_alloc&) - { - PyErr_NoMemory(); - } - catch(const bad_numeric_cast& x) - { - PyErr_SetString(PyExc_OverflowError, x.what()); - } - catch(const std::out_of_range& x) - { - PyErr_SetString(PyExc_IndexError, x.what()); - } - catch(const std::invalid_argument& x) - { - PyErr_SetString(PyExc_ValueError, x.what()); - } - catch(const std::exception& x) - { - PyErr_SetString(PyExc_RuntimeError, x.what()); - } - catch(...) - { - PyErr_SetString(PyExc_RuntimeError, "unidentifiable C++ exception"); - } - return true; -} - -void BOOST_PYTHON_DECL throw_error_already_set() -{ - throw error_already_set(); -} - -namespace detail { - -bool exception_handler::operator()(function0<void> const& f) const -{ - if (m_next) - { - return m_next->handle(f); - } - else - { - f(); - return false; - } -} - -exception_handler::exception_handler(handler_function const& impl) - : m_impl(impl) - , m_next(0) -{ - if (chain != 0) - tail->m_next = this; - else - chain = this; - tail = this; -} - -exception_handler* exception_handler::chain; -exception_handler* exception_handler::tail; - -BOOST_PYTHON_DECL void register_exception_handler(handler_function const& f) -{ - // the constructor links the new object into a handler chain, so - // this object isn't actaully leaked (until, of course, the - // interpreter exits). - new exception_handler(f); -} - -} // namespace boost::python::detail - -}} // namespace boost::python - - diff --git a/contrib/restricted/boost/python/src/exec.cpp b/contrib/restricted/boost/python/src/exec.cpp deleted file mode 100644 index 7488da1f6d..0000000000 --- a/contrib/restricted/boost/python/src/exec.cpp +++ /dev/null @@ -1,138 +0,0 @@ -// Copyright Stefan Seefeld 2005. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#include <boost/python/exec.hpp> -#include <boost/python/borrowed.hpp> -#include <boost/python/dict.hpp> -#include <boost/python/extract.hpp> -#include <boost/python/handle.hpp> - -namespace boost -{ -namespace python -{ - -object BOOST_PYTHON_DECL eval(str string, object global, object local) -{ - return eval(python::extract<char const *>(string), global, local); -} - -object BOOST_PYTHON_DECL eval(char const *string, object global, object local) -{ - // Set suitable default values for global and local dicts. - if (global.is_none()) - { - if (PyObject *g = PyEval_GetGlobals()) - global = object(detail::borrowed_reference(g)); - else - global = dict(); - } - if (local.is_none()) local = global; - // should be 'char const *' but older python versions don't use 'const' yet. - char *s = const_cast<char *>(string); - PyObject* result = PyRun_String(s, Py_eval_input, global.ptr(), local.ptr()); - if (!result) throw_error_already_set(); - return object(detail::new_reference(result)); -} - -object BOOST_PYTHON_DECL exec(str string, object global, object local) -{ - return exec(python::extract<char const *>(string), global, local); -} - -object BOOST_PYTHON_DECL exec(char const *string, object global, object local) -{ - // Set suitable default values for global and local dicts. - if (global.is_none()) - { - if (PyObject *g = PyEval_GetGlobals()) - global = object(detail::borrowed_reference(g)); - else - global = dict(); - } - if (local.is_none()) local = global; - // should be 'char const *' but older python versions don't use 'const' yet. - char *s = const_cast<char *>(string); - PyObject* result = PyRun_String(s, Py_file_input, global.ptr(), local.ptr()); - if (!result) throw_error_already_set(); - return object(detail::new_reference(result)); -} - -object BOOST_PYTHON_DECL exec_statement(str string, object global, object local) -{ - return exec_statement(python::extract<char const *>(string), global, local); -} - -object BOOST_PYTHON_DECL exec_statement(char const *string, object global, object local) -{ - // Set suitable default values for global and local dicts. - if (global.is_none()) - { - if (PyObject *g = PyEval_GetGlobals()) - global = object(detail::borrowed_reference(g)); - else - global = dict(); - } - if (local.is_none()) local = global; - // should be 'char const *' but older python versions don't use 'const' yet. - char *s = const_cast<char *>(string); - PyObject* result = PyRun_String(s, Py_single_input, global.ptr(), local.ptr()); - if (!result) throw_error_already_set(); - return object(detail::new_reference(result)); -} - -// Execute python source code from file filename. -// global and local are the global and local scopes respectively, -// used during execution. -object BOOST_PYTHON_DECL exec_file(str filename, object global, object local) -{ - return exec_file(python::extract<char const *>(filename), global, local); -} - -object BOOST_PYTHON_DECL exec_file(char const *filename, object global, object local) -{ - // Set suitable default values for global and local dicts. - if (global.is_none()) - { - if (PyObject *g = PyEval_GetGlobals()) - global = object(detail::borrowed_reference(g)); - else - global = dict(); - } - if (local.is_none()) local = global; - // should be 'char const *' but older python versions don't use 'const' yet. - char *f = const_cast<char *>(filename); -#if PY_VERSION_HEX >= 0x03010000 - // Let python manage any UTF bits to avoid potential incompatibilities. - PyObject *fo = Py_BuildValue("s", f); - PyObject *fb = Py_None; - PyUnicode_FSConverter(fo, &fb); - char *f_as_uft = PyBytes_AsString(fb); - FILE *fs = fopen(f_as_uft, "r"); - Py_DECREF(fo); - Py_DECREF(fb); -#elif PY_VERSION_HEX >= 0x03000000 - // Let python open the file to avoid potential binary incompatibilities. - PyObject *fo = Py_BuildValue("s", f); - FILE *fs = fopen(fo, "r"); - Py_DECREF(fo); -#else - // Let python open the file to avoid potential binary incompatibilities. - PyObject *pyfile = PyFile_FromString(f, const_cast<char*>("r")); - if (!pyfile) throw std::invalid_argument(std::string(f) + " : no such file"); - python::handle<> file(pyfile); - FILE *fs = PyFile_AsFile(file.get()); -#endif - PyObject* result = PyRun_File(fs, - f, - Py_file_input, - global.ptr(), local.ptr()); - fclose(fs); - if (!result) throw_error_already_set(); - return object(detail::new_reference(result)); -} - -} // namespace boost::python -} // namespace boost diff --git a/contrib/restricted/boost/python/src/import.cpp b/contrib/restricted/boost/python/src/import.cpp deleted file mode 100644 index 0add79eea2..0000000000 --- a/contrib/restricted/boost/python/src/import.cpp +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright Stefan Seefeld 2005. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#include <boost/python/import.hpp> -#include <boost/python/borrowed.hpp> -#include <boost/python/extract.hpp> -#include <boost/python/handle.hpp> - -namespace boost -{ -namespace python -{ - -object BOOST_PYTHON_DECL import(str name) -{ - // should be 'char const *' but older python versions don't use 'const' yet. - char *n = python::extract<char *>(name); - python::handle<> module(PyImport_ImportModule(n)); - return python::object(module); -} - -} // namespace boost::python -} // namespace boost diff --git a/contrib/restricted/boost/python/src/list.cpp b/contrib/restricted/boost/python/src/list.cpp deleted file mode 100644 index 77e616881a..0000000000 --- a/contrib/restricted/boost/python/src/list.cpp +++ /dev/null @@ -1,170 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#include <boost/python/list.hpp> -#include <boost/python/ssize_t.hpp> - -namespace boost { namespace python { namespace detail { - - -detail::new_non_null_reference list_base::call(object const& arg_) -{ - return (detail::new_non_null_reference) - (expect_non_null)( - PyObject_CallFunction( - (PyObject*)&PyList_Type, const_cast<char*>("(O)"), - arg_.ptr())); -} - -list_base::list_base() - : object(detail::new_reference(PyList_New(0))) -{} - -list_base::list_base(object_cref sequence) - : object(list_base::call(sequence)) -{} - -void list_base::append(object_cref x) -{ - if (PyList_CheckExact(this->ptr())) - { - if (PyList_Append(this->ptr(), x.ptr()) == -1) - throw_error_already_set(); - } - else - { - this->attr("append")(x); - } -} - -//long list_base::count(object_cref value) const; - -void list_base::extend(object_cref sequence) -{ - this->attr("extend")(sequence); -} - -long list_base::index(object_cref value) const -{ - object result_obj(this->attr("index")(value)); -#if PY_VERSION_HEX >= 0x03000000 - ssize_t result = PyLong_AsSsize_t(result_obj.ptr()); -#else - long result = PyInt_AsLong(result_obj.ptr()); -#endif - if (result == -1) - throw_error_already_set(); - return result; -} - -void list_base::insert(ssize_t index, object_cref item) -{ - if (PyList_CheckExact(this->ptr())) - { - if (PyList_Insert(this->ptr(), index, item.ptr()) == -1) - throw_error_already_set(); - } - else - { - this->attr("insert")(index, item); - } -} - -void list_base::insert(object const& index, object_cref x) -{ -#if PY_VERSION_HEX >= 0x03000000 - ssize_t index_ = PyLong_AsSsize_t(index.ptr()); -#else - long index_ = PyInt_AsLong(index.ptr()); -#endif - if (index_ == -1 && PyErr_Occurred()) - throw_error_already_set(); - this->insert(index_, x); -} - -object list_base::pop() -{ - return this->attr("pop")(); -} - -object list_base::pop(ssize_t index) -{ - return this->pop(object(index)); -} - -object list_base::pop(object const& index) -{ - return this->attr("pop")(index); -} - -void list_base::remove(object_cref value) -{ - this->attr("remove")(value); -} - -void list_base::reverse() -{ - if (PyList_CheckExact(this->ptr())) - { - if (PyList_Reverse(this->ptr()) == -1) - throw_error_already_set(); - } - else - { - this->attr("reverse")(); - } -} - -void list_base::sort() -{ - if (PyList_CheckExact(this->ptr())) - { - if (PyList_Sort(this->ptr()) == -1) - throw_error_already_set(); - } - else - { - this->attr("sort")(); - } -} - -#if PY_VERSION_HEX >= 0x03000000 -void list_base::sort(args_proxy const &args, - kwds_proxy const &kwds) -{ - this->attr("sort")(args, kwds); -} -#else -void list_base::sort(object_cref cmpfunc) -{ - this->attr("sort")(cmpfunc); -} -#endif - -// For some reason, moving this to the end of the TU suppresses an ICE -// with vc6. -ssize_t list_base::count(object_cref value) const -{ - object result_obj(this->attr("count")(value)); -#if PY_VERSION_HEX >= 0x03000000 - ssize_t result = PyLong_AsSsize_t(result_obj.ptr()); -#else - long result = PyInt_AsLong(result_obj.ptr()); -#endif - if (result == -1) - throw_error_already_set(); - return result; -} - -static struct register_list_pytype_ptr -{ - register_list_pytype_ptr() - { - const_cast<converter::registration &>( - converter::registry::lookup(boost::python::type_id<boost::python::list>()) - ).m_class_object = &PyList_Type; - } -}register_list_pytype_ptr_; - -}}} // namespace boost::python diff --git a/contrib/restricted/boost/python/src/long.cpp b/contrib/restricted/boost/python/src/long.cpp deleted file mode 100644 index 6aa2965e83..0000000000 --- a/contrib/restricted/boost/python/src/long.cpp +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#include <boost/python/long.hpp> - -namespace boost { namespace python { namespace detail { - -new_reference long_base::call(object const& arg_) -{ - return (detail::new_reference)PyObject_CallFunction( - (PyObject*)&PyLong_Type, const_cast<char*>("(O)"), - arg_.ptr()); -} - -new_reference long_base::call(object const& arg_, object const& base) -{ - return (detail::new_reference)PyObject_CallFunction( - (PyObject*)&PyLong_Type, const_cast<char*>("(OO)"), - arg_.ptr(), base.ptr()); -} - -long_base::long_base() - : object( - detail::new_reference( - PyObject_CallFunction((PyObject*)&PyLong_Type, const_cast<char*>("()"))) - ) -{} - -long_base::long_base(object_cref arg) - : object(long_base::call(arg)) -{} - -long_base::long_base(object_cref arg, object_cref base) - : object(long_base::call(arg, base)) -{} - - -}}} // namespace boost::python diff --git a/contrib/restricted/boost/python/src/module.cpp b/contrib/restricted/boost/python/src/module.cpp deleted file mode 100644 index 57675fa2df..0000000000 --- a/contrib/restricted/boost/python/src/module.cpp +++ /dev/null @@ -1,73 +0,0 @@ -// (C) Copyright David Abrahams 2000. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// The author gratefully acknowleges the support of Dragon Systems, Inc., in -// producing this work. - -#include <boost/python/scope.hpp> -#include <boost/python/object/add_to_namespace.hpp> - -namespace boost { namespace python { namespace detail { - -namespace -{ - PyObject* init_module_in_scope(PyObject* m, void(*init_function)()) - { - if (m != 0) - { - // Create the current module scope - object m_obj(((borrowed_reference_t*)m)); - scope current_module(m_obj); - - if (handle_exception(init_function)) return NULL; - } - - return m; - } -} - -BOOST_PYTHON_DECL void scope_setattr_doc(char const* name, object const& x, char const* doc) -{ - // Use function::add_to_namespace to achieve overloading if - // appropriate. - scope current; - objects::add_to_namespace(current, name, x, doc); -} - -#if PY_VERSION_HEX >= 0x03000000 - -BOOST_PYTHON_DECL PyObject* init_module(PyModuleDef& moduledef, void(*init_function)()) -{ - return init_module_in_scope( - PyModule_Create(&moduledef), - init_function); -} - -#else - -namespace -{ - PyMethodDef initial_methods[] = { { 0, 0, 0, 0 } }; -} - -BOOST_PYTHON_DECL PyObject* init_module(char const* name, void(*init_function)()) -{ - return init_module_in_scope( - Py_InitModule(const_cast<char*>(name), initial_methods), - init_function); -} - -#endif - -}}} // namespace boost::python::detail - -namespace boost { namespace python { - -namespace detail -{ - BOOST_PYTHON_DECL PyObject* current_scope = 0; -} - -}} diff --git a/contrib/restricted/boost/python/src/object/class.cpp b/contrib/restricted/boost/python/src/object/class.cpp deleted file mode 100644 index c3afd1127f..0000000000 --- a/contrib/restricted/boost/python/src/object/class.cpp +++ /dev/null @@ -1,781 +0,0 @@ -// Copyright David Abrahams 2001. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#include <boost/python/detail/prefix.hpp> -#include <boost/mpl/lambda.hpp> // #including this first is an intel6 workaround -#include <boost/cstdint.hpp> - -#include <boost/python/object/class.hpp> -#include <boost/python/object/instance.hpp> -#include <boost/python/object/class_detail.hpp> -#include <boost/python/scope.hpp> -#include <boost/python/converter/registry.hpp> -#include <boost/python/object/find_instance.hpp> -#include <boost/python/object/pickle_support.hpp> -#include <boost/python/detail/map_entry.hpp> -#include <boost/python/object.hpp> -#include <boost/python/object_protocol.hpp> -#include <boost/detail/binary_search.hpp> -#include <boost/python/self.hpp> -#include <boost/python/dict.hpp> -#include <boost/python/str.hpp> -#include <boost/python/ssize_t.hpp> -#include <functional> -#include <vector> -#include <cstddef> -#include <new> -#include <structmember.h> - -namespace boost { namespace python { - -# ifdef BOOST_PYTHON_SELF_IS_CLASS -namespace self_ns -{ - self_t self; -} -# endif - -instance_holder::instance_holder() - : m_next(0) -{ -} - -instance_holder::~instance_holder() -{ -} - -extern "C" -{ - // This is copied from typeobject.c in the Python sources. Even though - // class_metatype_object doesn't set Py_TPFLAGS_HAVE_GC, that bit gets - // filled in by the base class initialization process in - // PyType_Ready(). However, tp_is_gc is *not* copied from the base - // type, making it assume that classes are GC-able even if (like - // class_type_object) they're statically allocated. - static int - type_is_gc(PyTypeObject *python_type) - { - return python_type->tp_flags & Py_TPFLAGS_HEAPTYPE; - } - - // This is also copied from the Python sources. We can't implement - // static_data as a subclass property effectively without it. - typedef struct { - PyObject_HEAD - PyObject *prop_get; - PyObject *prop_set; - PyObject *prop_del; - PyObject *prop_doc; - int getter_doc; - } propertyobject; - - // Copied from Python source and removed the part for setting docstring, - // since we don't have a setter for __doc__ and trying to set it will - // cause the init fail. - static int property_init(PyObject *self, PyObject *args, PyObject *kwds) - { - PyObject *get = NULL, *set = NULL, *del = NULL, *doc = NULL; - static const char *kwlist[] = {"fget", "fset", "fdel", "doc", 0}; - propertyobject *prop = (propertyobject *)self; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "|OOOO:property", - const_cast<char **>(kwlist), &get, &set, &del, &doc)) - return -1; - - if (get == Py_None) - get = NULL; - if (set == Py_None) - set = NULL; - if (del == Py_None) - del = NULL; - - Py_XINCREF(get); - Py_XINCREF(set); - Py_XINCREF(del); - Py_XINCREF(doc); - - prop->prop_get = get; - prop->prop_set = set; - prop->prop_del = del; - prop->prop_doc = doc; - prop->getter_doc = 0; - - return 0; - } - - - static PyObject * - static_data_descr_get(PyObject *self, PyObject * /*obj*/, PyObject * /*type*/) - { - propertyobject *gs = (propertyobject *)self; - - return PyObject_CallFunction(gs->prop_get, const_cast<char*>("()")); - } - - static int - static_data_descr_set(PyObject *self, PyObject * /*obj*/, PyObject *value) - { - propertyobject *gs = (propertyobject *)self; - PyObject *func, *res; - - if (value == NULL) - func = gs->prop_del; - else - func = gs->prop_set; - if (func == NULL) { - PyErr_SetString(PyExc_AttributeError, - value == NULL ? - "can't delete attribute" : - "can't set attribute"); - return -1; - } - if (value == NULL) - res = PyObject_CallFunction(func, const_cast<char*>("()")); - else - res = PyObject_CallFunction(func, const_cast<char*>("(O)"), value); - if (res == NULL) - return -1; - Py_DECREF(res); - return 0; - } -} - -static PyTypeObject static_data_object = { - PyVarObject_HEAD_INIT(NULL, 0) - const_cast<char*>("Boost.Python.StaticProperty"), - sizeof(propertyobject), - 0, - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT // | Py_TPFLAGS_HAVE_GC - | Py_TPFLAGS_BASETYPE, /* tp_flags */ - 0, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, //&PyProperty_Type, /* tp_base */ - 0, /* tp_dict */ - static_data_descr_get, /* tp_descr_get */ - static_data_descr_set, /* tp_descr_set */ - 0, /* tp_dictoffset */ - property_init, /* tp_init */ - 0, /* tp_alloc */ - 0, // filled in with type_new /* tp_new */ - 0, // filled in with __PyObject_GC_Del /* tp_free */ - 0, /* tp_is_gc */ - 0, /* tp_bases */ - 0, /* tp_mro */ - 0, /* tp_cache */ - 0, /* tp_subclasses */ - 0, /* tp_weaklist */ -#if PYTHON_API_VERSION >= 1012 - 0 /* tp_del */ -#endif -}; - -namespace objects -{ -#if PY_VERSION_HEX < 0x03000000 - // XXX Not sure why this run into compiling error in Python 3 - extern "C" - { - // This declaration needed due to broken Python 2.2 headers - extern DL_IMPORT(PyTypeObject) PyProperty_Type; - } -#endif - - BOOST_PYTHON_DECL PyObject* static_data() - { - if (static_data_object.tp_dict == 0) - { - Py_SET_TYPE(&static_data_object, &PyType_Type); - static_data_object.tp_base = &PyProperty_Type; - if (PyType_Ready(&static_data_object)) - return 0; - } - return upcast<PyObject>(&static_data_object); - } -} - -extern "C" -{ - // Ordinarily, descriptors have a certain assymetry: you can use - // them to read attributes off the class object they adorn, but - // writing the same attribute on the class object always replaces - // the descriptor in the class __dict__. In order to properly - // represent C++ static data members, we need to allow them to be - // written through the class instance. This function of the - // metaclass makes it possible. - static int - class_setattro(PyObject *obj, PyObject *name, PyObject* value) - { - // Must use "private" Python implementation detail - // _PyType_Lookup instead of PyObject_GetAttr because the - // latter will always end up calling the descr_get function on - // any descriptor it finds; we need the unadulterated - // descriptor here. - PyObject* a = _PyType_Lookup(downcast<PyTypeObject>(obj), name); - - // a is a borrowed reference or 0 - - // If we found a static data descriptor, call it directly to - // force it to set the static data member - if (a != 0 && PyObject_IsInstance(a, objects::static_data())) - return Py_TYPE(a)->tp_descr_set(a, obj, value); - else - return PyType_Type.tp_setattro(obj, name, value); - } -} - -static PyTypeObject class_metatype_object = { - PyVarObject_HEAD_INIT(NULL, 0) - const_cast<char*>("Boost.Python.class"), - PyType_Type.tp_basicsize, - 0, - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - class_setattro, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT // | Py_TPFLAGS_HAVE_GC - | Py_TPFLAGS_BASETYPE, /* tp_flags */ - 0, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, //&PyType_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - 0, // filled in with type_new /* tp_new */ - 0, // filled in with __PyObject_GC_Del /* tp_free */ - (inquiry)type_is_gc, /* tp_is_gc */ - 0, /* tp_bases */ - 0, /* tp_mro */ - 0, /* tp_cache */ - 0, /* tp_subclasses */ - 0, /* tp_weaklist */ -#if PYTHON_API_VERSION >= 1012 - 0 /* tp_del */ -#endif -}; - -// Install the instance data for a C++ object into a Python instance -// object. -void instance_holder::install(PyObject* self) noexcept -{ - assert(PyType_IsSubtype(Py_TYPE(Py_TYPE(self)), &class_metatype_object)); - m_next = ((objects::instance<>*)self)->objects; - ((objects::instance<>*)self)->objects = this; -} - - -namespace objects -{ -// Get the metatype object for all extension classes. - BOOST_PYTHON_DECL type_handle class_metatype() - { - if (class_metatype_object.tp_dict == 0) - { - Py_SET_TYPE(&class_metatype_object, &PyType_Type); - class_metatype_object.tp_base = &PyType_Type; - if (PyType_Ready(&class_metatype_object)) - return type_handle(); - } - return type_handle(borrowed(&class_metatype_object)); - } - extern "C" - { - static void instance_dealloc(PyObject* inst) - { - instance<>* kill_me = (instance<>*)inst; - - for (instance_holder* p = kill_me->objects, *next; p != 0; p = next) - { - next = p->next(); - p->~instance_holder(); - instance_holder::deallocate(inst, dynamic_cast<void*>(p)); - } - - // Python 2.2.1 won't add weak references automatically when - // tp_itemsize > 0, so we need to manage that - // ourselves. Accordingly, we also have to clean up the - // weakrefs ourselves. - if (kill_me->weakrefs != NULL) - PyObject_ClearWeakRefs(inst); - - Py_XDECREF(kill_me->dict); - - Py_TYPE(inst)->tp_free(inst); - } - - static PyObject * - instance_new(PyTypeObject* type_, PyObject* /*args*/, PyObject* /*kw*/) - { - // Attempt to find the __instance_size__ attribute. If not present, no problem. - PyObject* d = type_->tp_dict; - PyObject* instance_size_obj = PyObject_GetAttrString(d, const_cast<char*>("__instance_size__")); - - ssize_t instance_size = instance_size_obj ? -#if PY_VERSION_HEX >= 0x03000000 - PyLong_AsSsize_t(instance_size_obj) : 0; -#else - PyInt_AsLong(instance_size_obj) : 0; -#endif - - if (instance_size < 0) - instance_size = 0; - - PyErr_Clear(); // Clear any errors that may have occurred. - - instance<>* result = (instance<>*)type_->tp_alloc(type_, instance_size); - if (result) - { - // Guido says we can use ob_size for any purpose we - // like, so we'll store the total size of the object - // there. A negative number indicates that the extra - // instance memory is not yet allocated to any holders. - Py_SET_SIZE(result,-static_cast<int>(offsetof(instance<>,storage) + instance_size)); - } - return (PyObject*)result; - } - - static PyObject* instance_get_dict(PyObject* op, void*) - { - instance<>* inst = downcast<instance<> >(op); - if (inst->dict == 0) - inst->dict = PyDict_New(); - return python::xincref(inst->dict); - } - - static int instance_set_dict(PyObject* op, PyObject* dict, void*) - { - instance<>* inst = downcast<instance<> >(op); - python::xdecref(inst->dict); - inst->dict = python::incref(dict); - return 0; - } - - } - - - static PyGetSetDef instance_getsets[] = { - {const_cast<char*>("__dict__"), instance_get_dict, instance_set_dict, NULL, 0}, - {0, 0, 0, 0, 0} - }; - - - static PyMemberDef instance_members[] = { - {const_cast<char*>("__weakref__"), T_OBJECT, offsetof(instance<>, weakrefs), 0, 0}, - {0, 0, 0, 0, 0} - }; - - static PyTypeObject class_type_object = { - PyVarObject_HEAD_INIT(NULL, 0) - const_cast<char*>("Boost.Python.instance"), - offsetof(instance<>,storage), /* tp_basicsize */ - 1, /* tp_itemsize */ - instance_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT // | Py_TPFLAGS_HAVE_GC - | Py_TPFLAGS_BASETYPE, /* tp_flags */ - 0, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - offsetof(instance<>,weakrefs), /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - instance_members, /* tp_members */ - instance_getsets, /* tp_getset */ - 0, //&PyBaseObject_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - offsetof(instance<>,dict), /* tp_dictoffset */ - 0, /* tp_init */ - PyType_GenericAlloc, /* tp_alloc */ - instance_new, /* tp_new */ - 0, /* tp_free */ - 0, /* tp_is_gc */ - 0, /* tp_bases */ - 0, /* tp_mro */ - 0, /* tp_cache */ - 0, /* tp_subclasses */ - 0, /* tp_weaklist */ -#if PYTHON_API_VERSION >= 1012 - 0 /* tp_del */ -#endif - }; - - BOOST_PYTHON_DECL type_handle class_type() - { - if (class_type_object.tp_dict == 0) - { - Py_SET_TYPE(&class_type_object, incref(class_metatype().get())); - class_type_object.tp_base = &PyBaseObject_Type; - if (PyType_Ready(&class_type_object)) - return type_handle(); -// class_type_object.tp_setattro = class_setattro; - } - return type_handle(borrowed(&class_type_object)); - } - - BOOST_PYTHON_DECL void* - find_instance_impl(PyObject* inst, type_info type, bool null_shared_ptr_only) - { - if (!Py_TYPE(Py_TYPE(inst)) || - !PyType_IsSubtype(Py_TYPE(Py_TYPE(inst)), &class_metatype_object)) - return 0; - - instance<>* self = reinterpret_cast<instance<>*>(inst); - - for (instance_holder* match = self->objects; match != 0; match = match->next()) - { - void* const found = match->holds(type, null_shared_ptr_only); - if (found) - return found; - } - return 0; - } - - object module_prefix() - { - return object( - PyObject_IsInstance(scope().ptr(), upcast<PyObject>(&PyModule_Type)) - ? object(scope().attr("__name__")) - : api::getattr(scope(), "__module__", str()) - ); - } - - namespace - { - // Find a registered class object corresponding to id. Return a - // null handle if no such class is registered. - inline type_handle query_class(type_info id) - { - converter::registration const* p = converter::registry::query(id); - return type_handle( - python::borrowed( - python::allow_null(p ? p->m_class_object : 0)) - ); - } - - // Find a registered class corresponding to id. If not found, - // throw an appropriate exception. - type_handle get_class(type_info id) - { - type_handle result(query_class(id)); - - if (result.get() == 0) - { - object report("extension class wrapper for base class "); - report = report + id.name() + " has not been created yet"; - PyErr_SetObject(PyExc_RuntimeError, report.ptr()); - throw_error_already_set(); - } - return result; - } - - // class_base constructor - // - // name - the name of the new Python class - // - // num_types - one more than the number of declared bases - // - // types - array of python::type_info, the first item - // corresponding to the class being created, and the - // rest corresponding to its declared bases. - // - inline object - new_class(char const* name, std::size_t num_types, type_info const* const types, char const* doc) - { - assert(num_types >= 1); - - // Build a tuple of the base Python type objects. If no bases - // were declared, we'll use our class_type() as the single base - // class. - ssize_t const num_bases = (std::max)(num_types - 1, static_cast<std::size_t>(1)); - handle<> bases(PyTuple_New(num_bases)); - - for (ssize_t i = 1; i <= num_bases; ++i) - { - type_handle c = (i >= static_cast<ssize_t>(num_types)) ? class_type() : get_class(types[i]); - // PyTuple_SET_ITEM steals this reference - PyTuple_SET_ITEM(bases.get(), static_cast<ssize_t>(i - 1), upcast<PyObject>(c.release())); - } - - // Call the class metatype to create a new class - dict d; - - object m = module_prefix(); - if (m) d["__module__"] = m; - - if (doc != 0) - d["__doc__"] = doc; - - object result = object(class_metatype())(name, bases, d); - assert(PyType_IsSubtype(Py_TYPE(result.ptr()), &PyType_Type)); - - if (scope().ptr() != Py_None) - scope().attr(name) = result; - - // For pickle. Will lead to informative error messages if pickling - // is not enabled. - result.attr("__reduce__") = object(make_instance_reduce_function()); - - return result; - } - } - - class_base::class_base( - char const* name, std::size_t num_types, type_info const* const types, char const* doc) - : object(new_class(name, num_types, types, doc)) - { - // Insert the new class object in the registry - converter::registration& converters = const_cast<converter::registration&>( - converter::registry::lookup(types[0])); - - // Class object is leaked, for now - converters.m_class_object = (PyTypeObject*)incref(this->ptr()); - } - - BOOST_PYTHON_DECL void copy_class_object(type_info const& src, type_info const& dst) - { - converter::registration& dst_converters - = const_cast<converter::registration&>(converter::registry::lookup(dst)); - - converter::registration const& src_converters = converter::registry::lookup(src); - - dst_converters.m_class_object = src_converters.m_class_object; - } - - void class_base::set_instance_size(std::size_t instance_size) - { - this->attr("__instance_size__") = instance_size; - } - - void class_base::add_property( - char const* name, object const& fget, char const* docstr) - { - object property( - (python::detail::new_reference) - PyObject_CallFunction((PyObject*)&PyProperty_Type, const_cast<char*>("Osss"), fget.ptr(), (char*)NULL, (char*)NULL, docstr)); - - this->setattr(name, property); - } - - void class_base::add_property( - char const* name, object const& fget, object const& fset, char const* docstr) - { - object property( - (python::detail::new_reference) - PyObject_CallFunction((PyObject*)&PyProperty_Type, const_cast<char*>("OOss"), fget.ptr(), fset.ptr(), (char*)NULL, docstr)); - - this->setattr(name, property); - } - - void class_base::add_static_property(char const* name, object const& fget) - { - object property( - (python::detail::new_reference) - PyObject_CallFunction(static_data(), const_cast<char*>("O"), fget.ptr()) - ); - - this->setattr(name, property); - } - - void class_base::add_static_property(char const* name, object const& fget, object const& fset) - { - object property( - (python::detail::new_reference) - PyObject_CallFunction(static_data(), const_cast<char*>("OO"), fget.ptr(), fset.ptr())); - - this->setattr(name, property); - } - - void class_base::setattr(char const* name, object const& x) - { - if (PyObject_SetAttrString(this->ptr(), const_cast<char*>(name), x.ptr()) < 0) - throw_error_already_set(); - } - - namespace - { - extern "C" PyObject* no_init(PyObject*, PyObject*) - { - ::PyErr_SetString(::PyExc_RuntimeError, const_cast<char*>("This class cannot be instantiated from Python")); - return NULL; - } - static ::PyMethodDef no_init_def = { - const_cast<char*>("__init__"), no_init, METH_VARARGS, - const_cast<char*>("Raises an exception\n" - "This class cannot be instantiated from Python\n") - }; - } - - void class_base::def_no_init() - { - handle<> f(::PyCFunction_New(&no_init_def, 0)); - this->setattr("__init__", object(f)); - } - - void class_base::enable_pickling_(bool getstate_manages_dict) - { - setattr("__safe_for_unpickling__", object(true)); - - if (getstate_manages_dict) - { - setattr("__getstate_manages_dict__", object(true)); - } - } - - namespace - { - PyObject* callable_check(PyObject* callable) - { - if (PyCallable_Check(expect_non_null(callable))) - return callable; - - ::PyErr_Format( - PyExc_TypeError - , const_cast<char*>("staticmethod expects callable object; got an object of type %s, which is not callable") - , Py_TYPE(callable)->tp_name - ); - - throw_error_already_set(); - return 0; - } - } - - void class_base::make_method_static(const char * method_name) - { - PyTypeObject* self = downcast<PyTypeObject>(this->ptr()); - dict d((handle<>(borrowed(self->tp_dict)))); - - object method(d[method_name]); - - this->attr(method_name) = object( - handle<>( - PyStaticMethod_New((callable_check)(method.ptr()) ) - )); - } - - BOOST_PYTHON_DECL type_handle registered_class_object(type_info id) - { - return query_class(id); - } -} // namespace objects - - -typedef unsigned int alignment_marker_t; - -void* instance_holder::allocate(PyObject* self_, std::size_t holder_offset, std::size_t holder_size, std::size_t alignment) -{ - assert(PyType_IsSubtype(Py_TYPE(Py_TYPE(self_)), &class_metatype_object)); - objects::instance<>* self = (objects::instance<>*)self_; - - int total_size_needed = holder_offset + holder_size + alignment - 1; - - if (-Py_SIZE(self) >= total_size_needed) - { - // holder_offset should at least point into the variable-sized part - assert(holder_offset >= offsetof(objects::instance<>,storage)); - - size_t allocated = holder_size + alignment; - void* storage = (char*)self + holder_offset; - void* aligned_storage = ::boost::alignment::align(alignment, holder_size, storage, allocated); - - // Record the fact that the storage is occupied, noting where it starts - const size_t offset = reinterpret_cast<uintptr_t>(aligned_storage) - reinterpret_cast<uintptr_t>(storage) + holder_offset; - Py_SET_SIZE(self, offset); - return (char*)self + offset; - } - else - { - const size_t base_allocation = sizeof(alignment_marker_t) + holder_size + alignment - 1; - void* const base_storage = PyMem_Malloc(base_allocation); - if (base_storage == 0) - throw std::bad_alloc(); - - const uintptr_t x = reinterpret_cast<uintptr_t>(base_storage) + sizeof(alignment_marker_t); - //this has problems for x -> max(void *) - //const size_t padding = alignment - ((x + sizeof(alignment_marker_t)) % alignment); - //only works for alignments with alignments of powers of 2, but no edge conditions - const uintptr_t padding = alignment == 1 ? 0 : ( alignment - (x & (alignment - 1)) ); - const size_t aligned_offset = sizeof(alignment_marker_t) + padding; - void* const aligned_storage = (char *)base_storage + aligned_offset; - BOOST_ASSERT((char *) aligned_storage + holder_size <= (char *)base_storage + base_allocation); - alignment_marker_t* const marker_storage = reinterpret_cast<alignment_marker_t *>((char *)aligned_storage - sizeof(alignment_marker_t)); - *marker_storage = static_cast<alignment_marker_t>(padding); - return aligned_storage; - } -} - -void instance_holder::deallocate(PyObject* self_, void* storage) noexcept -{ - assert(PyType_IsSubtype(Py_TYPE(Py_TYPE(self_)), &class_metatype_object)); - objects::instance<>* self = (objects::instance<>*)self_; - if (storage != (char*)self + Py_SIZE(self)) - { - alignment_marker_t* marker_storage = reinterpret_cast<alignment_marker_t *>((char *)storage - sizeof(alignment_marker_t)); - void *malloced_storage = (char *) storage - sizeof(alignment_marker_t) - (*marker_storage); - PyMem_Free(malloced_storage); - } -} - -}} // namespace boost::python diff --git a/contrib/restricted/boost/python/src/object/enum.cpp b/contrib/restricted/boost/python/src/object/enum.cpp deleted file mode 100644 index 5753b32e07..0000000000 --- a/contrib/restricted/boost/python/src/object/enum.cpp +++ /dev/null @@ -1,251 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#include <boost/python/object/enum_base.hpp> -#include <boost/python/cast.hpp> -#include <boost/python/scope.hpp> -#include <boost/python/object.hpp> -#include <boost/python/tuple.hpp> -#include <boost/python/dict.hpp> -#include <boost/python/str.hpp> -#include <boost/python/extract.hpp> -#include <boost/python/object_protocol.hpp> -#include <structmember.h> - -namespace boost { namespace python { namespace objects { - -struct enum_object -{ -#if PY_VERSION_HEX >= 0x03000000 - PyLongObject base_object; -#else - PyIntObject base_object; -#endif - PyObject* name; -}; - -static PyMemberDef enum_members[] = { - {const_cast<char*>("name"), T_OBJECT_EX, offsetof(enum_object,name),READONLY, 0}, - {0, 0, 0, 0, 0} -}; - - -extern "C" -{ - static void - enum_dealloc(enum_object* self) - { - Py_XDECREF(self->name); - Py_TYPE(self)->tp_free((PyObject*)self); - } - - static PyObject* enum_repr(PyObject* self_) - { - PyObject *mod = PyObject_GetAttrString( self_, "__module__"); - object auto_free = object(handle<>(mod)); - enum_object* self = downcast<enum_object>(self_); - if (!self->name) - { - return -#if PY_VERSION_HEX >= 0x03000000 - PyUnicode_FromFormat("%S.%s(%ld)", mod, self_->ob_type->tp_name, PyLong_AsLong(self_)); -#else - PyString_FromFormat("%s.%s(%ld)", PyString_AsString(mod), self_->ob_type->tp_name, PyInt_AS_LONG(self_)); -#endif - } - else - { - PyObject* name = self->name; - if (name == 0) - return 0; - - return -#if PY_VERSION_HEX >= 0x03000000 - PyUnicode_FromFormat("%S.%s.%S", mod, self_->ob_type->tp_name, name); -#else - PyString_FromFormat("%s.%s.%s", - PyString_AsString(mod), self_->ob_type->tp_name, PyString_AsString(name)); -#endif - } - } - - static PyObject* enum_str(PyObject* self_) - { - enum_object* self = downcast<enum_object>(self_); - if (!self->name) - { -#if PY_VERSION_HEX >= 0x03000000 - return PyLong_Type.tp_str(self_); -#else - return PyInt_Type.tp_str(self_); -#endif - } - else - { - return incref(self->name); - } - } -} - -static PyTypeObject enum_type_object = { - PyVarObject_HEAD_INIT(NULL, 0) // &PyType_Type - const_cast<char*>("Boost.Python.enum"), - sizeof(enum_object), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor) enum_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - enum_repr, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - enum_str, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT -#if PY_VERSION_HEX < 0x03000000 - | Py_TPFLAGS_CHECKTYPES -#endif - | Py_TPFLAGS_BASETYPE, /* tp_flags */ - 0, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - enum_members, /* tp_members */ - 0, /* tp_getset */ - 0, //&PyInt_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ - 0, /* tp_free */ - 0, /* tp_is_gc */ - 0, /* tp_bases */ - 0, /* tp_mro */ - 0, /* tp_cache */ - 0, /* tp_subclasses */ - 0, /* tp_weaklist */ -#if PYTHON_API_VERSION >= 1012 - 0 /* tp_del */ -#endif -}; - -object module_prefix(); - -namespace -{ - object new_enum_type(char const* name, char const *doc) - { - if (enum_type_object.tp_dict == 0) - { - Py_SET_TYPE(&enum_type_object, incref(&PyType_Type)); -#if PY_VERSION_HEX >= 0x03000000 - enum_type_object.tp_base = &PyLong_Type; -#else - enum_type_object.tp_base = &PyInt_Type; -#endif - if (PyType_Ready(&enum_type_object)) - throw_error_already_set(); - } - - type_handle metatype(borrowed(&PyType_Type)); - type_handle base(borrowed(&enum_type_object)); - - // suppress the instance __dict__ in these enum objects. There - // may be a slicker way, but this'll do for now. - dict d; - d["__slots__"] = tuple(); - d["values"] = dict(); - d["names"] = dict(); - - object module_name = module_prefix(); - if (module_name) - d["__module__"] = module_name; - if (doc) - d["__doc__"] = doc; - - object result = (object(metatype))(name, make_tuple(base), d); - - scope().attr(name) = result; - - return result; - } -} - -enum_base::enum_base( - char const* name - , converter::to_python_function_t to_python - , converter::convertible_function convertible - , converter::constructor_function construct - , type_info id - , char const *doc - ) - : object(new_enum_type(name, doc)) -{ - converter::registration& converters - = const_cast<converter::registration&>( - converter::registry::lookup(id)); - - converters.m_class_object = downcast<PyTypeObject>(this->ptr()); - converter::registry::insert(to_python, id); - converter::registry::insert(convertible, construct, id); -} - -void enum_base::add_value(char const* name_, long value) -{ - // Convert name to Python string - object name(name_); - - // Create a new enum instance by calling the class with a value - object x = (*this)(value); - - // Store the object in the enum class - (*this).attr(name_) = x; - - dict d = extract<dict>(this->attr("values"))(); - d[value] = x; - - // Set the name field in the new enum instanec - enum_object* p = downcast<enum_object>(x.ptr()); - Py_XDECREF(p->name); - p->name = incref(name.ptr()); - - dict names_dict = extract<dict>(this->attr("names"))(); - names_dict[x.attr("name")] = x; -} - -void enum_base::export_values() -{ - dict d = extract<dict>(this->attr("names"))(); - list items = d.items(); - scope current; - - for (unsigned i = 0, max = len(items); i < max; ++i) - api::setattr(current, items[i][0], items[i][1]); - } - -PyObject* enum_base::to_python(PyTypeObject* type_, long x) -{ - object type((type_handle(borrowed(type_)))); - - dict d = extract<dict>(type.attr("values"))(); - object v = d.get(x, object()); - return incref( - (v == object() ? type(x) : v).ptr()); -} - -}}} // namespace boost::python::object diff --git a/contrib/restricted/boost/python/src/object/function.cpp b/contrib/restricted/boost/python/src/object/function.cpp deleted file mode 100644 index 4adb49453c..0000000000 --- a/contrib/restricted/boost/python/src/object/function.cpp +++ /dev/null @@ -1,789 +0,0 @@ -// Copyright David Abrahams 2001. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#include <boost/python/docstring_options.hpp> -#include <boost/python/object/function_object.hpp> -#include <boost/python/object/function_handle.hpp> -#include <boost/python/object/function_doc_signature.hpp> -#include <boost/python/errors.hpp> -#include <boost/python/str.hpp> -#include <boost/python/object_attributes.hpp> -#include <boost/python/args.hpp> -#include <boost/python/refcount.hpp> -#include <boost/python/extract.hpp> -#include <boost/python/tuple.hpp> -#include <boost/python/list.hpp> -#include <boost/python/ssize_t.hpp> - -#include <boost/python/detail/signature.hpp> -#include <boost/python/detail/none.hpp> -#include <boost/mpl/vector/vector10.hpp> - -#include <boost/bind/bind.hpp> - -#include <algorithm> -#include <cstring> - -#if BOOST_PYTHON_DEBUG_ERROR_MESSAGES -# include <cstdio> -#endif - -namespace boost { namespace python { - volatile bool docstring_options::show_user_defined_ = true; - volatile bool docstring_options::show_cpp_signatures_ = true; -#ifndef BOOST_PYTHON_NO_PY_SIGNATURES - volatile bool docstring_options::show_py_signatures_ = true; -#else - volatile bool docstring_options::show_py_signatures_ = false; -#endif -}} - -namespace boost { namespace python { namespace objects { - -py_function_impl_base::~py_function_impl_base() -{ -} - -unsigned py_function_impl_base::max_arity() const -{ - return this->min_arity(); -} - -extern PyTypeObject function_type; - -function::function( - py_function const& implementation -#if BOOST_WORKAROUND(__EDG_VERSION__, == 245) - , python::detail::keyword const* names_and_defaults -#else - , python::detail::keyword const* const names_and_defaults -#endif - , unsigned num_keywords - ) - : m_fn(implementation) - , m_nkeyword_values(0) -{ - if (names_and_defaults != 0) - { - unsigned int max_arity = m_fn.max_arity(); - unsigned int keyword_offset - = max_arity > num_keywords ? max_arity - num_keywords : 0; - - - ssize_t tuple_size = num_keywords ? max_arity : 0; - m_arg_names = object(handle<>(PyTuple_New(tuple_size))); - - if (num_keywords != 0) - { - for (unsigned j = 0; j < keyword_offset; ++j) - PyTuple_SET_ITEM(m_arg_names.ptr(), j, incref(Py_None)); - } - - for (unsigned i = 0; i < num_keywords; ++i) - { - tuple kv; - - python::detail::keyword const* const p = names_and_defaults + i; - if (p->default_value) - { - kv = make_tuple(p->name, p->default_value); - ++m_nkeyword_values; - } - else - { - kv = make_tuple(p->name); - } - - PyTuple_SET_ITEM( - m_arg_names.ptr() - , i + keyword_offset - , incref(kv.ptr()) - ); - } - } - - PyObject* p = this; - if (Py_TYPE(&function_type) == 0) - { - Py_SET_TYPE(&function_type, &PyType_Type); - ::PyType_Ready(&function_type); - } - - (void)( // warning suppression for GCC - PyObject_INIT(p, &function_type) - ); -} - -function::~function() -{ -} - -PyObject* function::call(PyObject* args, PyObject* keywords) const -{ - std::size_t n_unnamed_actual = PyTuple_GET_SIZE(args); - std::size_t n_keyword_actual = keywords ? PyDict_Size(keywords) : 0; - std::size_t n_actual = n_unnamed_actual + n_keyword_actual; - - function const* f = this; - - // Try overloads looking for a match - do - { - // Check for a plausible number of arguments - unsigned min_arity = f->m_fn.min_arity(); - unsigned max_arity = f->m_fn.max_arity(); - - if (n_actual + f->m_nkeyword_values >= min_arity - && n_actual <= max_arity) - { - // This will be the args that actually get passed - handle<>inner_args(allow_null(borrowed(args))); - - if (n_keyword_actual > 0 // Keyword arguments were supplied - || n_actual < min_arity) // or default keyword values are needed - { - if (f->m_arg_names.is_none()) - { - // this overload doesn't accept keywords - inner_args = handle<>(); - } - else - { - // "all keywords are none" is a special case - // indicating we will accept any number of keyword - // arguments - if (PyTuple_Size(f->m_arg_names.ptr()) == 0) - { - // no argument preprocessing - } - else - { - // build a new arg tuple, will adjust its size later - assert(max_arity <= static_cast<std::size_t>(ssize_t_max)); - inner_args = handle<>( - PyTuple_New(static_cast<ssize_t>(max_arity))); - - // Fill in the positional arguments - for (std::size_t i = 0; i < n_unnamed_actual; ++i) - PyTuple_SET_ITEM(inner_args.get(), i, incref(PyTuple_GET_ITEM(args, i))); - - // Grab remaining arguments by name from the keyword dictionary - std::size_t n_actual_processed = n_unnamed_actual; - - for (std::size_t arg_pos = n_unnamed_actual; arg_pos < max_arity ; ++arg_pos) - { - // Get the keyword[, value pair] corresponding - PyObject* kv = PyTuple_GET_ITEM(f->m_arg_names.ptr(), arg_pos); - - // If there were any keyword arguments, - // look up the one we need for this - // argument position - PyObject* value = n_keyword_actual - ? PyDict_GetItem(keywords, PyTuple_GET_ITEM(kv, 0)) - : 0; - - if (!value) - { - // Not found; check if there's a default value - if (PyTuple_GET_SIZE(kv) > 1) - value = PyTuple_GET_ITEM(kv, 1); - - if (!value) - { - // still not found; matching fails - PyErr_Clear(); - inner_args = handle<>(); - break; - } - } - else - { - ++n_actual_processed; - } - - PyTuple_SET_ITEM(inner_args.get(), arg_pos, incref(value)); - } - - if (inner_args.get()) - { - //check if we proccessed all the arguments - if(n_actual_processed < n_actual) - inner_args = handle<>(); - } - } - } - } - - // Call the function. Pass keywords in case it's a - // function accepting any number of keywords - PyObject* result = inner_args ? f->m_fn(inner_args.get(), keywords) : 0; - - // If the result is NULL but no error was set, m_fn failed - // the argument-matching test. - - // This assumes that all other error-reporters are - // well-behaved and never return NULL to python without - // setting an error. - if (result != 0 || PyErr_Occurred()) - return result; - } - f = f->m_overloads.get(); - } - while (f); - // None of the overloads matched; time to generate the error message - argument_error(args, keywords); - return 0; -} - -object function::signature(bool show_return_type) const -{ - py_function const& impl = m_fn; - - python::detail::signature_element const* return_type = impl.signature(); - python::detail::signature_element const* s = return_type + 1; - - list formal_params; - if (impl.max_arity() == 0) - formal_params.append("void"); - - for (unsigned n = 0; n < impl.max_arity(); ++n) - { - if (s[n].basename == 0) - { - formal_params.append("..."); - break; - } - - str param(s[n].basename); - if (s[n].lvalue) - param += " {lvalue}"; - - if (m_arg_names) // None or empty tuple will test false - { - object kv(m_arg_names[n]); - if (kv) - { - char const* const fmt = len(kv) > 1 ? " %s=%r" : " %s"; - param += fmt % kv; - } - } - - formal_params.append(param); - } - - if (show_return_type) - return "%s(%s) -> %s" % make_tuple( - m_name, str(", ").join(formal_params), return_type->basename); - return "%s(%s)" % make_tuple( - m_name, str(", ").join(formal_params)); -} - -object function::signatures(bool show_return_type) const -{ - list result; - for (function const* f = this; f; f = f->m_overloads.get()) { - result.append(f->signature(show_return_type)); - } - return result; -} - -void function::argument_error(PyObject* args, PyObject* /*keywords*/) const -{ - static handle<> exception( - PyErr_NewException(const_cast<char*>("Boost.Python.ArgumentError"), PyExc_TypeError, 0)); - - object message = "Python argument types in\n %s.%s(" - % make_tuple(this->m_namespace, this->m_name); - - list actual_args; - for (ssize_t i = 0; i < PyTuple_Size(args); ++i) - { - char const* name = PyTuple_GetItem(args, i)->ob_type->tp_name; - actual_args.append(str(name)); - } - message += str(", ").join(actual_args); - message += ")\ndid not match C++ signature:\n "; - message += str("\n ").join(signatures()); - -#if BOOST_PYTHON_DEBUG_ERROR_MESSAGES - std::printf("\n--------\n%s\n--------\n", extract<const char*>(message)()); -#endif - PyErr_SetObject(exception.get(), message.ptr()); - throw_error_already_set(); -} - -void function::add_overload(handle<function> const& overload_) -{ - function* parent = this; - - while (parent->m_overloads) - parent = parent->m_overloads.get(); - - parent->m_overloads = overload_; - - // If we have no documentation, get the docs from the overload - if (!m_doc) - m_doc = overload_->m_doc; -} - -namespace -{ - char const* const binary_operator_names[] = - { - "add__", - "and__", - "div__", - "divmod__", - "eq__", - "floordiv__", - "ge__", - "gt__", - "le__", - "lshift__", - "lt__", - "mod__", - "mul__", - "ne__", - "or__", - "pow__", - "radd__", - "rand__", - "rdiv__", - "rdivmod__", - "rfloordiv__", - "rlshift__", - "rmod__", - "rmul__", - "ror__", - "rpow__", - "rrshift__", - "rshift__", - "rsub__", - "rtruediv__", - "rxor__", - "sub__", - "truediv__", - "xor__" - }; - - struct less_cstring - { - bool operator()(char const* x, char const* y) const - { - return BOOST_CSTD_::strcmp(x,y) < 0; - } - }; - - inline bool is_binary_operator(char const* name) - { - return name[0] == '_' - && name[1] == '_' - && std::binary_search( - &binary_operator_names[0] - , binary_operator_names + sizeof(binary_operator_names)/sizeof(*binary_operator_names) - , name + 2 - , less_cstring() - ); - } - - // Something for the end of the chain of binary operators - PyObject* not_implemented(PyObject*, PyObject*) - { - Py_INCREF(Py_NotImplemented); - return Py_NotImplemented; - } - - handle<function> not_implemented_function() - { - - static object keeper( - function_object( - py_function(¬_implemented, mpl::vector1<void>(), 2) - , python::detail::keyword_range()) - ); - return handle<function>(borrowed(downcast<function>(keeper.ptr()))); - } -} - -void function::add_to_namespace( - object const& name_space, char const* name_, object const& attribute) -{ - add_to_namespace(name_space, name_, attribute, 0); -} - -namespace detail -{ - extern char py_signature_tag[]; - extern char cpp_signature_tag[]; -} - -void function::add_to_namespace( - object const& name_space, char const* name_, object const& attribute, char const* doc) -{ - str const name(name_); - PyObject* const ns = name_space.ptr(); - - if (attribute.ptr()->ob_type == &function_type) - { - function* new_func = downcast<function>(attribute.ptr()); - handle<> dict; - -#if PY_VERSION_HEX < 0x03000000 - // Old-style class gone in Python 3 - if (PyClass_Check(ns)) - dict = handle<>(borrowed(((PyClassObject*)ns)->cl_dict)); - else -#endif - if (PyType_Check(ns)) - dict = handle<>(borrowed(((PyTypeObject*)ns)->tp_dict)); - else - dict = handle<>(PyObject_GetAttrString(ns, const_cast<char*>("__dict__"))); - - if (dict == 0) - throw_error_already_set(); - - assert(!PyErr_Occurred()); - handle<> existing(allow_null(::PyObject_GetItem(dict.get(), name.ptr()))); - PyErr_Clear(); - - if (existing) - { - if (existing->ob_type == &function_type) - { - new_func->add_overload( - handle<function>( - borrowed( - downcast<function>(existing.get()) - ) - ) - ); - } - else if (existing->ob_type == &PyStaticMethod_Type) - { - char const* name_space_name = extract<char const*>(name_space.attr("__name__")); - - ::PyErr_Format( - PyExc_RuntimeError - , "Boost.Python - All overloads must be exported " - "before calling \'class_<...>(\"%s\").staticmethod(\"%s\")\'" - , name_space_name - , name_ - ); - throw_error_already_set(); - } - } - else if (is_binary_operator(name_)) - { - // Binary operators need an additional overload which - // returns NotImplemented, so that Python will try the - // __rxxx__ functions on the other operand. We add this - // when no overloads for the operator already exist. - new_func->add_overload(not_implemented_function()); - } - - // A function is named the first time it is added to a namespace. - if (new_func->name().is_none()) - new_func->m_name = name; - - assert(!PyErr_Occurred()); - handle<> name_space_name( - allow_null(::PyObject_GetAttrString(name_space.ptr(), const_cast<char*>("__name__")))); - PyErr_Clear(); - - if (name_space_name) - new_func->m_namespace = object(name_space_name); - } - - if (PyObject_SetAttr(ns, name.ptr(), attribute.ptr()) < 0) - throw_error_already_set(); - - object mutable_attribute(attribute); -/* - if (doc != 0 && docstring_options::show_user_defined_) - { - // Accumulate documentation - - if ( - PyObject_HasAttrString(mutable_attribute.ptr(), "__doc__") - && mutable_attribute.attr("__doc__")) - { - mutable_attribute.attr("__doc__") += "\n\n"; - mutable_attribute.attr("__doc__") += doc; - } - else { - mutable_attribute.attr("__doc__") = doc; - } - } - - if (docstring_options::show_signatures_) - { - if ( PyObject_HasAttrString(mutable_attribute.ptr(), "__doc__") - && mutable_attribute.attr("__doc__")) { - mutable_attribute.attr("__doc__") += ( - mutable_attribute.attr("__doc__")[-1] != "\n" ? "\n\n" : "\n"); - } - else { - mutable_attribute.attr("__doc__") = ""; - } - function* f = downcast<function>(attribute.ptr()); - mutable_attribute.attr("__doc__") += str("\n ").join(make_tuple( - "C++ signature:", f->signature(true))); - } - */ - str _doc; - - if (docstring_options::show_py_signatures_) - { - _doc += str(const_cast<const char*>(detail::py_signature_tag)); - } - if (doc != 0 && docstring_options::show_user_defined_) - _doc += doc; - - if (docstring_options::show_cpp_signatures_) - { - _doc += str(const_cast<const char*>(detail::cpp_signature_tag)); - } - if(_doc) - { - object mutable_attribute(attribute); - mutable_attribute.attr("__doc__")= _doc; - } -} - -BOOST_PYTHON_DECL void add_to_namespace( - object const& name_space, char const* name, object const& attribute) -{ - function::add_to_namespace(name_space, name, attribute, 0); -} - -BOOST_PYTHON_DECL void add_to_namespace( - object const& name_space, char const* name, object const& attribute, char const* doc) -{ - function::add_to_namespace(name_space, name, attribute, doc); -} - - -namespace -{ - struct bind_return - { - bind_return(PyObject*& result, function const* f, PyObject* args, PyObject* keywords) - : m_result(result) - , m_f(f) - , m_args(args) - , m_keywords(keywords) - {} - - void operator()() const - { - m_result = m_f->call(m_args, m_keywords); - } - - private: - PyObject*& m_result; - function const* m_f; - PyObject* m_args; - PyObject* m_keywords; - }; -} - -extern "C" -{ - // Stolen from Python's funcobject.c - static PyObject * - function_descr_get(PyObject *func, PyObject *obj, PyObject *type_) - { -#if PY_VERSION_HEX >= 0x03000000 - // The implement is different in Python 3 because of the removal of unbound method - if (obj == Py_None || obj == NULL) { - Py_INCREF(func); - return func; - } - return PyMethod_New(func, obj); -#else - if (obj == Py_None) - obj = NULL; - return PyMethod_New(func, obj, type_); -#endif - } - - static void - function_dealloc(PyObject* p) - { - delete static_cast<function*>(p); - } - - static PyObject * - function_call(PyObject *func, PyObject *args, PyObject *kw) - { - PyObject* result = 0; - handle_exception(bind_return(result, static_cast<function*>(func), args, kw)); - return result; - } - - // - // Here we're using the function's tp_getset rather than its - // tp_members to set up __doc__ and __name__, because tp_members - // really depends on having a POD object type (it relies on - // offsets). It might make sense to reformulate function as a POD - // at some point, but this is much more expedient. - // - static PyObject* function_get_doc(PyObject* op, void*) - { - function* f = downcast<function>(op); - list signatures = function_doc_signature_generator::function_doc_signatures(f); - if(!signatures) return python::detail::none(); - signatures.reverse(); - return python::incref( str("\n").join(signatures).ptr()); - } - - static int function_set_doc(PyObject* op, PyObject* doc, void*) - { - function* f = downcast<function>(op); - f->doc(doc ? object(python::detail::borrowed_reference(doc)) : object()); - return 0; - } - - static PyObject* function_get_name(PyObject* op, void*) - { - function* f = downcast<function>(op); - if (f->name().is_none()) -#if PY_VERSION_HEX >= 0x03000000 - return PyUnicode_InternFromString("<unnamed Boost.Python function>"); -#else - return PyString_InternFromString("<unnamed Boost.Python function>"); -#endif - else - return python::incref(f->name().ptr()); - } - - // We add a dummy __class__ attribute in order to fool PyDoc into - // treating these as built-in functions and scanning their - // documentation - static PyObject* function_get_class(PyObject* /*op*/, void*) - { - return python::incref(upcast<PyObject>(&PyCFunction_Type)); - } - - static PyObject* function_get_module(PyObject* op, void*) - { - function* f = downcast<function>(op); - object const& ns = f->get_namespace(); - if (!ns.is_none()) { - return python::incref(ns.ptr()); - } - PyErr_SetString( - PyExc_AttributeError, const_cast<char*>( - "Boost.Python function __module__ unknown.")); - return 0; - } -} - -static PyGetSetDef function_getsetlist[] = { - {const_cast<char*>("__name__"), (getter)function_get_name, 0, 0, 0 }, - {const_cast<char*>("func_name"), (getter)function_get_name, 0, 0, 0 }, - {const_cast<char*>("__module__"), (getter)function_get_module, 0, 0, 0 }, - {const_cast<char*>("func_module"), (getter)function_get_module, 0, 0, 0 }, - {const_cast<char*>("__class__"), (getter)function_get_class, 0, 0, 0 }, // see note above - {const_cast<char*>("__doc__"), (getter)function_get_doc, (setter)function_set_doc, 0, 0}, - {const_cast<char*>("func_doc"), (getter)function_get_doc, (setter)function_set_doc, 0, 0}, - {NULL, 0, 0, 0, 0} /* Sentinel */ -}; - -PyTypeObject function_type = { - PyVarObject_HEAD_INIT(NULL, 0) - const_cast<char*>("Boost.Python.function"), - sizeof(function), - 0, - (destructor)function_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - 0, //(reprfunc)func_repr, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - function_call, /* tp_call */ - 0, /* tp_str */ - 0, // PyObject_GenericGetAttr, /* tp_getattro */ - 0, // PyObject_GenericSetAttr, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT /* | Py_TPFLAGS_HAVE_GC */,/* tp_flags */ - 0, /* tp_doc */ - 0, // (traverseproc)func_traverse, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, //offsetof(PyFunctionObject, func_weakreflist), /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, // func_memberlist, /* tp_members */ - function_getsetlist, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - function_descr_get, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, //offsetof(PyFunctionObject, func_dict), /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ - 0, /* tp_free */ - 0, /* tp_is_gc */ - 0, /* tp_bases */ - 0, /* tp_mro */ - 0, /* tp_cache */ - 0, /* tp_subclasses */ - 0, /* tp_weaklist */ -#if PYTHON_API_VERSION >= 1012 - 0 /* tp_del */ -#endif -}; - -object function_object( - py_function const& f - , python::detail::keyword_range const& keywords) -{ - return python::object( - python::detail::new_non_null_reference( - new function( - f, keywords.first, keywords.second - keywords.first))); -} - -object function_object(py_function const& f) -{ - return function_object(f, python::detail::keyword_range()); -} - - -handle<> function_handle_impl(py_function const& f) -{ - return python::handle<>( - allow_null( - new function(f, 0, 0))); -} - -} // namespace objects - -namespace detail -{ - object BOOST_PYTHON_DECL make_raw_function(objects::py_function f) - { - static keyword k; - - return objects::function_object( - f - , keyword_range(&k,&k)); - } - void BOOST_PYTHON_DECL pure_virtual_called() - { - PyErr_SetString( - PyExc_RuntimeError, const_cast<char*>("Pure virtual function called")); - throw_error_already_set(); - } -} - -}} // namespace boost::python diff --git a/contrib/restricted/boost/python/src/object/function_doc_signature.cpp b/contrib/restricted/boost/python/src/object/function_doc_signature.cpp deleted file mode 100644 index 41695285ac..0000000000 --- a/contrib/restricted/boost/python/src/object/function_doc_signature.cpp +++ /dev/null @@ -1,344 +0,0 @@ -// Copyright Nikolay Mladenov 2007. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// boost::python::make_tuple below are for gcc 4.4 -std=c++0x compatibility -// (Intel C++ 10 and 11 with -std=c++0x don't need the full qualification). - -#include <boost/python/converter/registrations.hpp> -#include <boost/python/object/function_doc_signature.hpp> -#include <boost/python/errors.hpp> -#include <boost/python/str.hpp> -#include <boost/python/args.hpp> -#include <boost/python/tuple.hpp> - -#include <boost/python/detail/signature.hpp> - -#include <vector> - -namespace boost { namespace python { namespace objects { - - bool function_doc_signature_generator::arity_cmp( function const *f1, function const *f2 ) - { - return f1->m_fn.max_arity() < f2->m_fn.max_arity(); - } - - bool function_doc_signature_generator::are_seq_overloads( function const *f1, function const *f2 , bool check_docs) - { - py_function const & impl1 = f1->m_fn; - py_function const & impl2 = f2->m_fn; - - //the number of parameters differs by 1 - if (impl2.max_arity()-impl1.max_arity() != 1) - return false; - - // if check docs then f1 shold not have docstring or have the same docstring as f2 - if (check_docs && f2->doc() != f1->doc() && f1->doc()) - return false; - - python::detail::signature_element const* s1 = impl1.signature(); - python::detail::signature_element const* s2 = impl2.signature(); - - unsigned size = impl1.max_arity()+1; - - for (unsigned i = 0; i != size; ++i) - { - //check if the argument types are the same - if (s1[i].basename != s2[i].basename) - return false; - - //return type - if (!i) continue; - - //check if the argument default values are the same - bool f1_has_names = bool(f1->m_arg_names); - bool f2_has_names = bool(f2->m_arg_names); - if ( (f1_has_names && f2_has_names && f2->m_arg_names[i-1]!=f1->m_arg_names[i-1]) - || (f1_has_names && !f2_has_names) - || (!f1_has_names && f2_has_names && f2->m_arg_names[i-1]!=python::object()) - ) - return false; - } - return true; - } - - std::vector<function const*> function_doc_signature_generator::flatten(function const *f) - { - object name = f->name(); - - std::vector<function const*> res; - - while (f) { - - //this if takes out the not_implemented_function - if (f->name() == name) - res.push_back(f); - - f=f->m_overloads.get(); - } - - //std::sort(res.begin(),res.end(), &arity_cmp); - - return res; - } - std::vector<function const*> function_doc_signature_generator::split_seq_overloads( const std::vector<function const *> &funcs, bool split_on_doc_change) - { - std::vector<function const*> res; - - std::vector<function const*>::const_iterator fi = funcs.begin(); - - function const * last = *fi; - - while (++fi != funcs.end()){ - - //check if fi starts a new chain of overloads - if (!are_seq_overloads( last, *fi, split_on_doc_change )) - res.push_back(last); - - last = *fi; - } - - if (last) - res.push_back(last); - - return res; - } - - str function_doc_signature_generator::raw_function_pretty_signature(function const *f, size_t n_overloads, bool cpp_types ) - { - str res("object"); - - res = str("%s %s(%s)" % make_tuple( res, f->m_name, str("tuple args, dict kwds")) ); - - return res; - } - - const char * function_doc_signature_generator::py_type_str(const python::detail::signature_element &s) - { - if (s.basename==std::string("void")){ - static const char * none = "None"; - return none; - } - - PyTypeObject const * py_type = s.pytype_f?s.pytype_f():0; - if ( py_type ) - return py_type->tp_name; - else{ - static const char * object = "object"; - return object; - } - } - - str function_doc_signature_generator::parameter_string(py_function const &f, size_t n, object arg_names, bool cpp_types) - { - str param; - - python::detail::signature_element const * s = f.signature(); - if (cpp_types) - { - if(!n) - s = &f.get_return_type(); - if (s[n].basename == 0) - { - return str("..."); - } - - param = str(s[n].basename); - - if (s[n].lvalue) - param += " {lvalue}"; - - } - else - { - if (n) //we are processing an argument and trying to come up with a name for it - { - object kv; - if ( arg_names && (kv = arg_names[n-1]) ) - param = str( " (%s)%s" % make_tuple(py_type_str(s[n]),kv[0]) ); - else - param = str(" (%s)%s%d" % make_tuple(py_type_str(s[n]),"arg", n) ); - } - else //we are processing the return type - param = py_type_str(f.get_return_type()); - } - - //an argument - check for default value and append it - if(n && arg_names) - { - object kv(arg_names[n-1]); - if (kv && len(kv) == 2) - { - param = str("%s=%r" % make_tuple(param, kv[1])); - } - } - return param; - } - - str function_doc_signature_generator::pretty_signature(function const *f, size_t n_overloads, bool cpp_types ) - { - py_function - const& impl = f->m_fn; - ; - - - unsigned arity = impl.max_arity(); - - if(arity == unsigned(-1))// is this the proper raw function test? - { - return raw_function_pretty_signature(f,n_overloads,cpp_types); - } - - list formal_params; - - size_t n_extra_default_args=0; - - for (unsigned n = 0; n <= arity; ++n) - { - str param; - - formal_params.append( - parameter_string(impl, n, f->m_arg_names, cpp_types) - ); - - // find all the arguments with default values preceeding the arity-n_overloads - if (n && f->m_arg_names) - { - object kv(f->m_arg_names[n-1]); - - if (kv && len(kv) == 2) - { - //default argument preceeding the arity-n_overloads - if( n <= arity-n_overloads) - ++n_extra_default_args; - } - else - //argument without default, preceeding the arity-n_overloads - if( n <= arity-n_overloads) - n_extra_default_args = 0; - } - } - - n_overloads+=n_extra_default_args; - - if (!arity && cpp_types) - formal_params.append("void"); - - str ret_type (formal_params.pop(0)); - if (cpp_types ) - { - return str( - "%s %s(%s%s%s%s)" - % boost::python::make_tuple // workaround, see top - ( ret_type - , f->m_name - , str(",").join(formal_params.slice(0,arity-n_overloads)) - , n_overloads ? (n_overloads!=arity?str(" [,"):str("[ ")) : str() - , str(" [,").join(formal_params.slice(arity-n_overloads,arity)) - , std::string(n_overloads,']') - )); - }else{ - return str( - "%s(%s%s%s%s) -> %s" - % boost::python::make_tuple // workaround, see top - ( f->m_name - , str(",").join(formal_params.slice(0,arity-n_overloads)) - , n_overloads ? (n_overloads!=arity?str(" [,"):str("[ ")) : str() - , str(" [,").join(formal_params.slice(arity-n_overloads,arity)) - , std::string(n_overloads,']') - , ret_type - )); - } - - return str( - "%s %s(%s%s%s%s) %s" - % boost::python::make_tuple // workaround, see top - ( cpp_types?ret_type:str("") - , f->m_name - , str(",").join(formal_params.slice(0,arity-n_overloads)) - , n_overloads ? (n_overloads!=arity?str(" [,"):str("[ ")) : str() - , str(" [,").join(formal_params.slice(arity-n_overloads,arity)) - , std::string(n_overloads,']') - , cpp_types?str(""):ret_type - )); - - } - - namespace detail { - char py_signature_tag[] = "PY signature :"; - char cpp_signature_tag[] = "C++ signature :"; - } - - list function_doc_signature_generator::function_doc_signatures( function const * f) - { - list signatures; - std::vector<function const*> funcs = flatten( f); - std::vector<function const*> split_funcs = split_seq_overloads( funcs, true); - std::vector<function const*>::const_iterator sfi=split_funcs.begin(), fi; - size_t n_overloads=0; - for (fi=funcs.begin(); fi!=funcs.end(); ++fi) - { - if(*sfi == *fi){ - if((*fi)->doc()) - { - str func_doc = str((*fi)->doc()); - - int doc_len = len(func_doc); - - bool show_py_signature = doc_len >= int(sizeof(detail::py_signature_tag)/sizeof(char)-1) - && str(detail::py_signature_tag) == func_doc.slice(0, int(sizeof(detail::py_signature_tag)/sizeof(char))-1); - if(show_py_signature) - { - func_doc = str(func_doc.slice(int(sizeof(detail::py_signature_tag)/sizeof(char))-1, _)); - doc_len = len(func_doc); - } - - bool show_cpp_signature = doc_len >= int(sizeof(detail::cpp_signature_tag)/sizeof(char)-1) - && str(detail::cpp_signature_tag) == func_doc.slice( 1-int(sizeof(detail::cpp_signature_tag)/sizeof(char)), _); - - if(show_cpp_signature) - { - func_doc = str(func_doc.slice(_, 1-int(sizeof(detail::cpp_signature_tag)/sizeof(char)))); - doc_len = len(func_doc); - } - - str res="\n"; - str pad = "\n"; - - if(show_py_signature) - { - str sig = pretty_signature(*fi, n_overloads,false); - res+=sig; - if(doc_len || show_cpp_signature )res+=" :"; - pad+= str(" "); - } - - if(doc_len) - { - if(show_py_signature) - res+=pad; - res+= pad.join(func_doc.split("\n")); - } - - if( show_cpp_signature) - { - if(len(res)>1) - res+="\n"+pad; - res+=detail::cpp_signature_tag+pad+" "+pretty_signature(*fi, n_overloads,true); - } - - signatures.append(res); - } - ++sfi; - n_overloads = 0; - }else - ++n_overloads ; - } - - return signatures; - } - - -}}} - diff --git a/contrib/restricted/boost/python/src/object/inheritance.cpp b/contrib/restricted/boost/python/src/object/inheritance.cpp deleted file mode 100644 index a7b3156e41..0000000000 --- a/contrib/restricted/boost/python/src/object/inheritance.cpp +++ /dev/null @@ -1,496 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#include <boost/python/object/inheritance.hpp> -#include <boost/python/type_id.hpp> -#include <boost/graph/breadth_first_search.hpp> -#if _MSC_FULL_VER >= 13102171 && _MSC_FULL_VER <= 13102179 -# include <boost/graph/reverse_graph.hpp> -#endif -#include <boost/graph/adjacency_list.hpp> -#include <boost/graph/reverse_graph.hpp> -#include <boost/property_map/property_map.hpp> -#include <boost/bind/bind.hpp> -#include <boost/integer_traits.hpp> -#include <boost/tuple/tuple.hpp> -#include <boost/tuple/tuple_comparison.hpp> -#include <queue> -#include <vector> -#include <functional> - -// -// Procedure: -// -// The search is a BFS over the space of (type,address) pairs -// guided by the edges of the casting graph whose nodes -// correspond to classes, and whose edges are traversed by -// applying associated cast functions to an address. We use -// vertex distance to the goal node in the cast_graph to rate the -// paths. The vertex distance to any goal node is calculated on -// demand and outdated by the addition of edges to the graph. - -namespace boost { -namespace -{ - enum edge_cast_t { edge_cast = 8010 }; - template <class T> inline void unused_variable(const T&) { } -} - -// Install properties -BOOST_INSTALL_PROPERTY(edge, cast); - -namespace -{ - typedef void*(*cast_function)(void*); - - // - // Here we put together the low-level data structures of the - // casting graph representation. - // - typedef python::type_info class_id; - - // represents a graph of available casts - -#if 0 - struct cast_graph - : -#else - typedef -#endif - adjacency_list<vecS,vecS, bidirectionalS, no_property - - // edge index property allows us to look up edges in the connectivity matrix - , property<edge_index_t,std::size_t - - // The function which casts a void* from the edge's source type - // to its destination type. - , property<edge_cast_t,cast_function> > > -#if 0 - {}; -#else - cast_graph; -#endif - - typedef cast_graph::vertex_descriptor vertex_t; - typedef cast_graph::edge_descriptor edge_t; - - struct smart_graph - { - typedef std::vector<std::size_t>::const_iterator node_distance_map; - - typedef std::pair<cast_graph::out_edge_iterator - , cast_graph::out_edge_iterator> out_edges_t; - - // Return a map of the distances from any node to the given - // target node - node_distance_map distances_to(vertex_t target) const - { - std::size_t n = num_vertices(m_topology); - if (m_distances.size() != n * n) - { - m_distances.clear(); - m_distances.resize(n * n, (std::numeric_limits<std::size_t>::max)()); - m_known_vertices = n; - } - - std::vector<std::size_t>::iterator to_target = m_distances.begin() + n * target; - - // this node hasn't been used as a target yet - if (to_target[target] != 0) - { - typedef reverse_graph<cast_graph> reverse_cast_graph; - reverse_cast_graph reverse_topology(m_topology); - - to_target[target] = 0; - - breadth_first_search( - reverse_topology, target - , visitor( - make_bfs_visitor( - record_distances( - make_iterator_property_map( - to_target - , get(vertex_index, reverse_topology) -# ifdef BOOST_NO_STD_ITERATOR_TRAITS - , *to_target -# endif - ) - , on_tree_edge() - )))); - } - - return to_target; - } - - cast_graph& topology() { return m_topology; } - cast_graph const& topology() const { return m_topology; } - - smart_graph() - : m_known_vertices(0) - {} - - private: - cast_graph m_topology; - mutable std::vector<std::size_t> m_distances; - mutable std::size_t m_known_vertices; - }; - - smart_graph& full_graph() - { - static smart_graph x; - return x; - } - - smart_graph& up_graph() - { - static smart_graph x; - return x; - } - - // - // Our index of class types - // - using boost::python::objects::dynamic_id_function; - typedef tuples::tuple< - class_id // static type - , vertex_t // corresponding vertex - , dynamic_id_function // dynamic_id if polymorphic, or 0 - > - index_entry_interface; - typedef index_entry_interface::inherited index_entry; - enum { ksrc_static_t, kvertex, kdynamic_id }; - - typedef std::vector<index_entry> type_index_t; - - - type_index_t& type_index() - { - static type_index_t x; - return x; - } - - template <class Tuple> - struct select1st - { - typedef typename tuples::element<0, Tuple>::type result_type; - - result_type const& operator()(Tuple const& x) const - { - return tuples::get<0>(x); - } - }; - - // map a type to a position in the index - inline type_index_t::iterator type_position(class_id type) - { - using namespace boost::placeholders; - typedef index_entry entry; - - return std::lower_bound( - type_index().begin(), type_index().end() - , boost::make_tuple(type, vertex_t(), dynamic_id_function(0)) - , boost::bind<bool>(std::less<class_id>() - , boost::bind<class_id>(select1st<entry>(), _1) - , boost::bind<class_id>(select1st<entry>(), _2))); - } - - inline index_entry* seek_type(class_id type) - { - type_index_t::iterator p = type_position(type); - if (p == type_index().end() || tuples::get<ksrc_static_t>(*p) != type) - return 0; - else - return &*p; - } - - // Get the entry for a type, inserting if necessary - inline type_index_t::iterator demand_type(class_id type) - { - type_index_t::iterator p = type_position(type); - - if (p != type_index().end() && tuples::get<ksrc_static_t>(*p) == type) - return p; - - vertex_t v = add_vertex(full_graph().topology()); - vertex_t v2 = add_vertex(up_graph().topology()); - unused_variable(v2); - assert(v == v2); - return type_index().insert(p, boost::make_tuple(type, v, dynamic_id_function(0))); - } - - // Map a two types to a vertex in the graph, inserting if necessary - typedef std::pair<type_index_t::iterator, type_index_t::iterator> - type_index_iterator_pair; - - inline type_index_iterator_pair - demand_types(class_id t1, class_id t2) - { - // be sure there will be no reallocation - type_index().reserve(type_index().size() + 2); - type_index_t::iterator first = demand_type(t1); - type_index_t::iterator second = demand_type(t2); - if (first == second) - ++first; - return std::make_pair(first, second); - } - - struct q_elt - { - q_elt(std::size_t distance - , void* src_address - , vertex_t target - , cast_function cast - ) - : distance(distance) - , src_address(src_address) - , target(target) - , cast(cast) - {} - - std::size_t distance; - void* src_address; - vertex_t target; - cast_function cast; - - bool operator<(q_elt const& rhs) const - { - return distance < rhs.distance; - } - }; - - // Optimization: - // - // Given p, src_t, dst_t - // - // Get a pointer pd to the most-derived object - // if it's polymorphic, dynamic_cast to void* - // otherwise pd = p - // - // Get the most-derived typeid src_td - // - // ptrdiff_t offset = p - pd - // - // Now we can keep a cache, for [src_t, offset, src_td, dst_t] of - // the cast transformation function to use on p and the next src_t - // in the chain. src_td, dst_t don't change throughout this - // process. In order to represent unreachability, when a pair is - // found to be unreachable, we stick a 0-returning "dead-cast" - // function in the cache. - - // This is needed in a few places below - inline void* identity_cast(void* p) - { - return p; - } - - void* search(smart_graph const& g, void* p, vertex_t src, vertex_t dst) - { - // I think this test was thoroughly bogus -- dwa - // If we know there's no path; bail now. - // if (src > g.known_vertices() || dst > g.known_vertices()) - // return 0; - - smart_graph::node_distance_map d(g.distances_to(dst)); - - if (d[src] == (std::numeric_limits<std::size_t>::max)()) - return 0; - - typedef property_map<cast_graph,edge_cast_t>::const_type cast_map; - cast_map casts = get(edge_cast, g.topology()); - - typedef std::pair<vertex_t,void*> search_state; - typedef std::vector<search_state> visited_t; - visited_t visited; - std::priority_queue<q_elt> q; - - q.push(q_elt(d[src], p, src, identity_cast)); - while (!q.empty()) - { - q_elt top = q.top(); - q.pop(); - - // Check to see if we have a real state - void* dst_address = top.cast(top.src_address); - if (dst_address == 0) - continue; - - if (top.target == dst) - return dst_address; - - search_state s(top.target,dst_address); - - visited_t::iterator pos = std::lower_bound( - visited.begin(), visited.end(), s); - - // If already visited, continue - if (pos != visited.end() && *pos == s) - continue; - - visited.insert(pos, s); // mark it - - // expand it: - smart_graph::out_edges_t edges = out_edges(s.first, g.topology()); - for (cast_graph::out_edge_iterator p = edges.first - , finish = edges.second - ; p != finish - ; ++p - ) - { - edge_t e = *p; - q.push(q_elt( - d[target(e, g.topology())] - , dst_address - , target(e, g.topology()) - , boost::get(casts, e))); - } - } - return 0; - } - - struct cache_element - { - typedef tuples::tuple< - class_id // source static type - , class_id // target type - , std::ptrdiff_t // offset within source object - , class_id // source dynamic type - >::inherited key_type; - - cache_element(key_type const& k) - : key(k) - , offset(0) - {} - - key_type key; - std::ptrdiff_t offset; - - BOOST_STATIC_CONSTANT( - std::ptrdiff_t, not_found = integer_traits<std::ptrdiff_t>::const_min); - - bool operator<(cache_element const& rhs) const - { - return this->key < rhs.key; - } - - bool unreachable() const - { - return offset == not_found; - } - }; - - enum { kdst_t = ksrc_static_t + 1, koffset, ksrc_dynamic_t }; - typedef std::vector<cache_element> cache_t; - - cache_t& cache() - { - static cache_t x; - return x; - } - - inline void* convert_type(void* const p, class_id src_t, class_id dst_t, bool polymorphic) - { - // Quickly rule out unregistered types - index_entry* src_p = seek_type(src_t); - if (src_p == 0) - return 0; - - index_entry* dst_p = seek_type(dst_t); - if (dst_p == 0) - return 0; - - // Look up the dynamic_id function and call it to get the dynamic - // info - boost::python::objects::dynamic_id_t dynamic_id = polymorphic - ? tuples::get<kdynamic_id>(*src_p)(p) - : std::make_pair(p, src_t); - - // Look in the cache first for a quickie address translation - std::ptrdiff_t offset = (char*)p - (char*)dynamic_id.first; - - cache_element seek(boost::make_tuple(src_t, dst_t, offset, dynamic_id.second)); - cache_t& c = cache(); - cache_t::iterator const cache_pos - = std::lower_bound(c.begin(), c.end(), seek); - - - // if found in the cache, we're done - if (cache_pos != c.end() && cache_pos->key == seek.key) - { - return cache_pos->offset == cache_element::not_found - ? 0 : (char*)p + cache_pos->offset; - } - - // If we are starting at the most-derived type, only look in the up graph - smart_graph const& g = polymorphic && dynamic_id.second != src_t - ? full_graph() : up_graph(); - - void* result = search( - g, p, tuples::get<kvertex>(*src_p) - , tuples::get<kvertex>(*dst_p)); - - // update the cache - c.insert(cache_pos, seek)->offset - = (result == 0) ? cache_element::not_found : (char*)result - (char*)p; - - return result; - } -} - -namespace python { namespace objects { - -BOOST_PYTHON_DECL void* find_dynamic_type(void* p, class_id src_t, class_id dst_t) -{ - return convert_type(p, src_t, dst_t, true); -} - -BOOST_PYTHON_DECL void* find_static_type(void* p, class_id src_t, class_id dst_t) -{ - return convert_type(p, src_t, dst_t, false); -} - -BOOST_PYTHON_DECL void add_cast( - class_id src_t, class_id dst_t, cast_function cast, bool is_downcast) -{ - // adding an edge will invalidate any record of unreachability in - // the cache. - static std::size_t expected_cache_len = 0; - cache_t& c = cache(); - if (c.size() > expected_cache_len) - { - c.erase(std::remove_if( - c.begin(), c.end(), - mem_fn(&cache_element::unreachable)) - , c.end()); - - // If any new cache entries get added, we'll have to do this - // again when the next edge is added - expected_cache_len = c.size(); - } - - type_index_iterator_pair types = demand_types(src_t, dst_t); - vertex_t src = tuples::get<kvertex>(*types.first); - vertex_t dst = tuples::get<kvertex>(*types.second); - - cast_graph* const g[2] = { &up_graph().topology(), &full_graph().topology() }; - - for (cast_graph*const* p = g + (is_downcast ? 1 : 0); p < g + 2; ++p) - { - edge_t e; - bool added; - - tie(e, added) = add_edge(src, dst, **p); - assert(added); - - put(get(edge_cast, **p), e, cast); - put(get(edge_index, **p), e, num_edges(full_graph().topology()) - 1); - } -} - -BOOST_PYTHON_DECL void register_dynamic_id_aux( - class_id static_id, dynamic_id_function get_dynamic_id) -{ - tuples::get<kdynamic_id>(*demand_type(static_id)) = get_dynamic_id; -} - -}}} // namespace boost::python::objects diff --git a/contrib/restricted/boost/python/src/object/iterator.cpp b/contrib/restricted/boost/python/src/object/iterator.cpp deleted file mode 100644 index 6b885a982c..0000000000 --- a/contrib/restricted/boost/python/src/object/iterator.cpp +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#include <boost/python/object/iterator_core.hpp> -#include <boost/python/object/function_object.hpp> -#include <boost/bind/bind.hpp> -#include <boost/mpl/vector/vector10.hpp> - -namespace boost { namespace python { namespace objects { - -namespace -{ - PyObject* identity(PyObject* args_, PyObject*) - { - PyObject* x = PyTuple_GET_ITEM(args_,0); - Py_INCREF(x); - return x; - } -} - -BOOST_PYTHON_DECL object const& identity_function() -{ - static object result( - function_object( - py_function(&identity, mpl::vector2<PyObject*,PyObject*>()) - ) - ); - return result; -} - -void stop_iteration_error() -{ - PyErr_SetObject(PyExc_StopIteration, Py_None); - throw_error_already_set(); -} - -}}} // namespace boost::python::objects diff --git a/contrib/restricted/boost/python/src/object/life_support.cpp b/contrib/restricted/boost/python/src/object/life_support.cpp deleted file mode 100644 index 281c3bffc5..0000000000 --- a/contrib/restricted/boost/python/src/object/life_support.cpp +++ /dev/null @@ -1,121 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#include <boost/python/object/life_support.hpp> -#include <boost/python/detail/none.hpp> -#include <boost/python/refcount.hpp> - -namespace boost { namespace python { namespace objects { - -struct life_support -{ - PyObject_HEAD - PyObject* patient; -}; - -extern "C" -{ - static void - life_support_dealloc(PyObject* self) - { - Py_XDECREF(((life_support*)self)->patient); - self->ob_type->tp_free(self); - } - - static PyObject * - life_support_call(PyObject *self, PyObject *arg, PyObject * /*kw*/) - { - // Let the patient die now - Py_XDECREF(((life_support*)self)->patient); - ((life_support*)self)->patient = 0; - // Let the weak reference die. This probably kills us. - Py_XDECREF(PyTuple_GET_ITEM(arg, 0)); - return ::boost::python::detail::none(); - } -} - -PyTypeObject life_support_type = { - PyVarObject_HEAD_INIT(NULL, 0)//(&PyType_Type) - const_cast<char*>("Boost.Python.life_support"), - sizeof(life_support), - 0, - life_support_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - 0, //(reprfunc)func_repr, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - life_support_call, /* tp_call */ - 0, /* tp_str */ - 0, // PyObject_GenericGetAttr, /* tp_getattro */ - 0, // PyObject_GenericSetAttr, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT /* | Py_TPFLAGS_HAVE_GC */,/* tp_flags */ - 0, /* tp_doc */ - 0, // (traverseproc)func_traverse, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, //offsetof(PyLife_SupportObject, func_weakreflist), /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, // func_memberlist, /* tp_members */ - 0, //func_getsetlist, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, //offsetof(PyLife_SupportObject, func_dict), /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ - 0, /* tp_free */ - 0, /* tp_is_gc */ - 0, /* tp_bases */ - 0, /* tp_mro */ - 0, /* tp_cache */ - 0, /* tp_subclasses */ - 0, /* tp_weaklist */ -#if PYTHON_API_VERSION >= 1012 - 0 /* tp_del */ -#endif -}; - -PyObject* make_nurse_and_patient(PyObject* nurse, PyObject* patient) -{ - if (nurse == Py_None || nurse == patient) - return nurse; - - if (Py_TYPE(&life_support_type) == 0) - { - Py_SET_TYPE(&life_support_type, &PyType_Type); - PyType_Ready(&life_support_type); - } - - life_support* system = PyObject_New(life_support, &life_support_type); - if (!system) - return 0; - - system->patient = 0; - - // We're going to leak this reference, but don't worry; the - // life_support system decrements it when the nurse dies. - PyObject* weakref = PyWeakref_NewRef(nurse, (PyObject*)system); - - // weakref has either taken ownership, or we have to release it - // anyway - Py_DECREF(system); - if (!weakref) - return 0; - - system->patient = patient; - Py_XINCREF(patient); // hang on to the patient until death - return weakref; -} - -}}} // namespace boost::python::objects diff --git a/contrib/restricted/boost/python/src/object/pickle_support.cpp b/contrib/restricted/boost/python/src/object/pickle_support.cpp deleted file mode 100644 index 428c07b6ca..0000000000 --- a/contrib/restricted/boost/python/src/object/pickle_support.cpp +++ /dev/null @@ -1,78 +0,0 @@ -// (C) Copyright R.W. Grosse-Kunstleve 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#include <boost/python/make_function.hpp> -#include <boost/python/object/class.hpp> -#include <boost/python/tuple.hpp> -#include <boost/python/list.hpp> -#include <boost/python/dict.hpp> -#include <boost/python/str.hpp> - -namespace boost { namespace python { - -namespace { - - tuple instance_reduce(object instance_obj) - { - list result; - object instance_class(instance_obj.attr("__class__")); - result.append(instance_class); - object none; - if (!getattr(instance_obj, "__safe_for_unpickling__", none)) - { - str type_name(getattr(instance_class, "__name__")); - str module_name(getattr(instance_class, "__module__", object(""))); - if (module_name) - module_name += "."; - - PyErr_SetObject( - PyExc_RuntimeError, - ( "Pickling of \"%s\" instances is not enabled" - " (http://www.boost.org/libs/python/doc/v2/pickle.html)" - % (module_name+type_name)).ptr() - ); - - throw_error_already_set(); - } - object getinitargs = getattr(instance_obj, "__getinitargs__", none); - tuple initargs; - if (!getinitargs.is_none()) { - initargs = tuple(getinitargs()); - } - result.append(initargs); - object getstate = getattr(instance_obj, "__getstate__", none); - object instance_dict = getattr(instance_obj, "__dict__", none); - long len_instance_dict = 0; - if (!instance_dict.is_none()) { - len_instance_dict = len(instance_dict); - } - if (!getstate.is_none()) { - if (len_instance_dict > 0) { - object getstate_manages_dict = getattr( - instance_obj, "__getstate_manages_dict__", none); - if (getstate_manages_dict.is_none()) { - PyErr_SetString(PyExc_RuntimeError, - "Incomplete pickle support" - " (__getstate_manages_dict__ not set)"); - throw_error_already_set(); - } - } - result.append(getstate()); - } - else if (len_instance_dict > 0) { - result.append(instance_dict); - } - return tuple(result); - } - -} // namespace - -object const& make_instance_reduce_function() -{ - static object result(&instance_reduce); - return result; -} - -}} // namespace boost::python diff --git a/contrib/restricted/boost/python/src/object/stl_iterator.cpp b/contrib/restricted/boost/python/src/object/stl_iterator.cpp deleted file mode 100644 index e32d321452..0000000000 --- a/contrib/restricted/boost/python/src/object/stl_iterator.cpp +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright Eric Niebler 2005. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// Credits: -// Andreas Kl\:ockner for fixing increment() to handle -// error conditions. - -#include <boost/python/object.hpp> -#include <boost/python/handle.hpp> -#include <boost/python/object/stl_iterator_core.hpp> - -namespace boost { namespace python { namespace objects -{ - -stl_input_iterator_impl::stl_input_iterator_impl() - : it_() - , ob_() -{ -} - -stl_input_iterator_impl::stl_input_iterator_impl(boost::python::object const &ob) - : it_(ob.attr("__iter__")()) - , ob_() -{ - this->increment(); -} - -void stl_input_iterator_impl::increment() -{ - this->ob_ = boost::python::handle<>( - boost::python::allow_null(PyIter_Next(this->it_.ptr()))); - if (PyErr_Occurred()) - throw boost::python::error_already_set(); -} - -bool stl_input_iterator_impl::equal(stl_input_iterator_impl const &that) const -{ - return !this->ob_ == !that.ob_; -} - -boost::python::handle<> const &stl_input_iterator_impl::current() const -{ - return this->ob_; -} - -}}} // namespace boost::python::objects diff --git a/contrib/restricted/boost/python/src/object_operators.cpp b/contrib/restricted/boost/python/src/object_operators.cpp deleted file mode 100644 index b993245fe9..0000000000 --- a/contrib/restricted/boost/python/src/object_operators.cpp +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#include <boost/python/object_operators.hpp> -#include <boost/python/detail/raw_pyobject.hpp> - -namespace boost { namespace python { namespace api { - -# define BOOST_PYTHON_COMPARE_OP(op, opid) \ -BOOST_PYTHON_DECL object operator op(object const& l, object const& r) \ -{ \ - return object( \ - detail::new_reference( \ - PyObject_RichCompare( \ - l.ptr(), r.ptr(), opid)) \ - ); \ -} -BOOST_PYTHON_COMPARE_OP(>, Py_GT) -BOOST_PYTHON_COMPARE_OP(>=, Py_GE) -BOOST_PYTHON_COMPARE_OP(<, Py_LT) -BOOST_PYTHON_COMPARE_OP(<=, Py_LE) -BOOST_PYTHON_COMPARE_OP(==, Py_EQ) -BOOST_PYTHON_COMPARE_OP(!=, Py_NE) -# undef BOOST_PYTHON_COMPARE_OP - - -#define BOOST_PYTHON_BINARY_OPERATOR(op, name) \ -BOOST_PYTHON_DECL object operator op(object const& l, object const& r) \ -{ \ - return object( \ - detail::new_reference( \ - PyNumber_##name(l.ptr(), r.ptr())) \ - ); \ -} - -BOOST_PYTHON_BINARY_OPERATOR(+, Add) -BOOST_PYTHON_BINARY_OPERATOR(-, Subtract) -BOOST_PYTHON_BINARY_OPERATOR(*, Multiply) -#if PY_VERSION_HEX >= 0x03000000 -// We choose FloorDivide instead of TrueDivide to keep the semantic -// conform with C/C++'s '/' operator -BOOST_PYTHON_BINARY_OPERATOR(/, FloorDivide) -#else -BOOST_PYTHON_BINARY_OPERATOR(/, Divide) -#endif -BOOST_PYTHON_BINARY_OPERATOR(%, Remainder) -BOOST_PYTHON_BINARY_OPERATOR(<<, Lshift) -BOOST_PYTHON_BINARY_OPERATOR(>>, Rshift) -BOOST_PYTHON_BINARY_OPERATOR(&, And) -BOOST_PYTHON_BINARY_OPERATOR(^, Xor) -BOOST_PYTHON_BINARY_OPERATOR(|, Or) -#undef BOOST_PYTHON_BINARY_OPERATOR - -#define BOOST_PYTHON_INPLACE_OPERATOR(op, name) \ -BOOST_PYTHON_DECL object& operator op##=(object& l, object const& r) \ -{ \ - return l = object( \ - (detail::new_reference) \ - PyNumber_InPlace##name(l.ptr(), r.ptr())); \ -} - -BOOST_PYTHON_INPLACE_OPERATOR(+, Add) -BOOST_PYTHON_INPLACE_OPERATOR(-, Subtract) -BOOST_PYTHON_INPLACE_OPERATOR(*, Multiply) -#if PY_VERSION_HEX >= 0x03000000 -// Same reason as above for choosing FloorDivide instead of TrueDivide -BOOST_PYTHON_INPLACE_OPERATOR(/, FloorDivide) -#else -BOOST_PYTHON_INPLACE_OPERATOR(/, Divide) -#endif -BOOST_PYTHON_INPLACE_OPERATOR(%, Remainder) -BOOST_PYTHON_INPLACE_OPERATOR(<<, Lshift) -BOOST_PYTHON_INPLACE_OPERATOR(>>, Rshift) -BOOST_PYTHON_INPLACE_OPERATOR(&, And) -BOOST_PYTHON_INPLACE_OPERATOR(^, Xor) -BOOST_PYTHON_INPLACE_OPERATOR(|, Or) -#undef BOOST_PYTHON_INPLACE_OPERATOR - -object::object(handle<> const& x) - : object_base(python::incref(python::expect_non_null(x.get()))) -{} - -}}} // namespace boost::python diff --git a/contrib/restricted/boost/python/src/object_protocol.cpp b/contrib/restricted/boost/python/src/object_protocol.cpp deleted file mode 100644 index 95c8c73ee6..0000000000 --- a/contrib/restricted/boost/python/src/object_protocol.cpp +++ /dev/null @@ -1,197 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#include <boost/python/object_protocol.hpp> -#include <boost/python/errors.hpp> -#include <boost/python/object.hpp> -#include <boost/python/ssize_t.hpp> - -namespace boost { namespace python { namespace api { - -BOOST_PYTHON_DECL object getattr(object const& target, object const& key) -{ - return object(detail::new_reference(PyObject_GetAttr(target.ptr(), key.ptr()))); -} - -BOOST_PYTHON_DECL object getattr(object const& target, object const& key, object const& default_) -{ - PyObject* result = PyObject_GetAttr(target.ptr(), key.ptr()); - if (result == NULL && PyErr_ExceptionMatches(PyExc_AttributeError)) - { - PyErr_Clear(); - return default_; - } - return object(detail::new_reference(result)); -} - -BOOST_PYTHON_DECL void setattr(object const& target, object const& key, object const& value) -{ - if (PyObject_SetAttr(target.ptr(), key.ptr(), value.ptr()) == -1) - throw_error_already_set(); -} - -BOOST_PYTHON_DECL void delattr(object const& target, object const& key) -{ - if (PyObject_DelAttr(target.ptr(), key.ptr()) == -1) - throw_error_already_set(); -} - -BOOST_PYTHON_DECL object getattr(object const& target, char const* key) -{ - return object( - detail::new_reference( - PyObject_GetAttrString(target.ptr(), const_cast<char*>(key)) - )); -} - -BOOST_PYTHON_DECL object getattr(object const& target, char const* key, object const& default_) -{ - PyObject* result = PyObject_GetAttrString(target.ptr(), const_cast<char*>(key)); - if (result == NULL && PyErr_ExceptionMatches(PyExc_AttributeError)) - { - PyErr_Clear(); - return default_; - } - return object(detail::new_reference(result)); - -} -BOOST_PYTHON_DECL void setattr(object const& target, char const* key, object const& value) -{ - if (PyObject_SetAttrString( - target.ptr(), const_cast<char*>(key), value.ptr()) == -1 - ) - { - throw_error_already_set(); - } -} - -BOOST_PYTHON_DECL void delattr(object const& target, char const* key) -{ - if (PyObject_DelAttrString( - target.ptr(), const_cast<char*>(key)) == -1 - ) - { - throw_error_already_set(); - } -} - -BOOST_PYTHON_DECL object getitem(object const& target, object const& key) -{ - return object(detail::new_reference( - PyObject_GetItem(target.ptr(), key.ptr()))); -} - -BOOST_PYTHON_DECL void setitem(object const& target, object const& key, object const& value) -{ - if (PyObject_SetItem(target.ptr(), key.ptr(), value.ptr()) == -1) - throw_error_already_set(); -} - -BOOST_PYTHON_DECL void delitem(object const& target, object const& key) -{ - if (PyObject_DelItem(target.ptr(), key.ptr()) == -1) - throw_error_already_set(); -} - -namespace // slicing code copied directly out of the Python implementation -{ - #undef ISINT - #define ISINT(x) ((x) == NULL || PyInt_Check(x) || PyLong_Check(x)) - - static PyObject * - apply_slice(PyObject *u, PyObject *v, PyObject *w) /* return u[v:w] */ - { -#if PY_VERSION_HEX < 0x03000000 - PyTypeObject *tp = u->ob_type; - PySequenceMethods *sq = tp->tp_as_sequence; - - if (sq && sq->sq_slice && ISINT(v) && ISINT(w)) { - ssize_t ilow = 0, ihigh = ssize_t_max; - if (!_PyEval_SliceIndex(v, &ilow)) - return NULL; - if (!_PyEval_SliceIndex(w, &ihigh)) - return NULL; - return PySequence_GetSlice(u, ilow, ihigh); - } - else -#endif - { - PyObject *slice = PySlice_New(v, w, NULL); - if (slice != NULL) { - PyObject *res = PyObject_GetItem(u, slice); - Py_DECREF(slice); - return res; - } - else - return NULL; - } - } - - static int - assign_slice(PyObject *u, PyObject *v, PyObject *w, PyObject *x) - /* u[v:w] = x */ - { -#if PY_VERSION_HEX < 0x03000000 - PyTypeObject *tp = u->ob_type; - PySequenceMethods *sq = tp->tp_as_sequence; - - if (sq && sq->sq_slice && ISINT(v) && ISINT(w)) { - ssize_t ilow = 0, ihigh = ssize_t_max; - if (!_PyEval_SliceIndex(v, &ilow)) - return -1; - if (!_PyEval_SliceIndex(w, &ihigh)) - return -1; - if (x == NULL) - return PySequence_DelSlice(u, ilow, ihigh); - else - return PySequence_SetSlice(u, ilow, ihigh, x); - } - else -#endif - { - PyObject *slice = PySlice_New(v, w, NULL); - if (slice != NULL) { - int res; - if (x != NULL) - res = PyObject_SetItem(u, slice, x); - else - res = PyObject_DelItem(u, slice); - Py_DECREF(slice); - return res; - } - else - return -1; - } - } -} - -BOOST_PYTHON_DECL object getslice(object const& target, handle<> const& begin, handle<> const& end) -{ - return object( - detail::new_reference( - apply_slice(target.ptr(), begin.get(), end.get()))); -} - -BOOST_PYTHON_DECL void setslice(object const& target, handle<> const& begin, handle<> const& end, object const& value) -{ - if (assign_slice( - target.ptr(), begin.get(), end.get(), value.ptr()) == -1 - ) - { - throw_error_already_set(); - } -} - -BOOST_PYTHON_DECL void delslice(object const& target, handle<> const& begin, handle<> const& end) -{ - if (assign_slice( - target.ptr(), begin.get(), end.get(), 0) == -1 - ) - { - throw_error_already_set(); - } -} - -}}} // namespace boost::python::api diff --git a/contrib/restricted/boost/python/src/slice.cpp b/contrib/restricted/boost/python/src/slice.cpp deleted file mode 100644 index ee55f94846..0000000000 --- a/contrib/restricted/boost/python/src/slice.cpp +++ /dev/null @@ -1,37 +0,0 @@ -#include "boost/python/slice.hpp" - -// Copyright (c) 2004 Jonathan Brandmeyer -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - - -namespace boost { namespace python { namespace detail { - -slice_base::slice_base(PyObject* start, PyObject* stop, PyObject* step) - : object(detail::new_reference( PySlice_New(start, stop, step))) -{ -} - -object -slice_base::start() const -{ - return object( detail::borrowed_reference( - ((PySliceObject*)this->ptr())->start)); -} - -object -slice_base::stop() const -{ - return object( detail::borrowed_reference( - ((PySliceObject*)this->ptr())->stop)); -} - -object -slice_base::step() const -{ - return object( detail::borrowed_reference( - ((PySliceObject*)this->ptr())->step)); -} - -} } } // !namespace boost::python::detail diff --git a/contrib/restricted/boost/python/src/str.cpp b/contrib/restricted/boost/python/src/str.cpp deleted file mode 100644 index 5122f7f57f..0000000000 --- a/contrib/restricted/boost/python/src/str.cpp +++ /dev/null @@ -1,419 +0,0 @@ -// Copyright David Abrahams 2004. Distributed under the Boost -// Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -#include <boost/python/str.hpp> -#include <boost/python/extract.hpp> -#include <boost/python/ssize_t.hpp> - -namespace boost { namespace python { namespace detail { - -detail::new_reference str_base::call(object const& arg_) -{ - return (detail::new_reference)PyObject_CallFunction( -#if PY_VERSION_HEX >= 0x03000000 - (PyObject*)&PyUnicode_Type, -#else - (PyObject*)&PyString_Type, -#endif - const_cast<char*>("(O)"), - arg_.ptr()); -} - -str_base::str_base() - : object(detail::new_reference( -#if PY_VERSION_HEX >= 0x03000000 - ::PyUnicode_FromString("") -#else - ::PyString_FromString("") -#endif - )) -{} - -str_base::str_base(const char* s) - : object(detail::new_reference( -#if PY_VERSION_HEX >= 0x03000000 - ::PyUnicode_FromString(s) -#else - ::PyString_FromString(s) -#endif - )) -{} - -namespace { - - ssize_t str_size_as_py_ssize_t(std::size_t n) - { - if (n > static_cast<std::size_t>(ssize_t_max)) - { - throw std::range_error("str size > ssize_t_max"); - } - return static_cast<ssize_t>(n); - } - -} // namespace <anonymous> - -str_base::str_base(char const* start, char const* finish) - : object( - detail::new_reference( -#if PY_VERSION_HEX >= 0x03000000 - ::PyUnicode_FromStringAndSize -#else - ::PyString_FromStringAndSize -#endif - (start, str_size_as_py_ssize_t(finish - start)) - ) - ) -{} - -str_base::str_base(char const* start, std::size_t length) // new str - : object( - detail::new_reference( -#if PY_VERSION_HEX >= 0x03000000 - ::PyUnicode_FromStringAndSize -#else - ::PyString_FromStringAndSize -#endif - ( start, str_size_as_py_ssize_t(length) ) - ) - ) -{} - -str_base::str_base(object_cref other) - : object(str_base::call(other)) -{} - -#define BOOST_PYTHON_FORMAT_OBJECT(z, n, data) "O" -#define BOOST_PYTHON_OBJECT_PTR(z, n, data) , x##n .ptr() - -#define BOOST_PYTHON_DEFINE_STR_METHOD(name, arity) \ -str str_base:: name ( BOOST_PP_ENUM_PARAMS(arity, object_cref x) ) const \ -{ \ - return str(new_reference( \ - expect_non_null( \ - PyObject_CallMethod( \ - this->ptr(), const_cast<char*>( #name ), \ - const_cast<char*>( \ - "(" BOOST_PP_REPEAT(arity, BOOST_PYTHON_FORMAT_OBJECT, _) ")") \ - BOOST_PP_REPEAT_1(arity, BOOST_PYTHON_OBJECT_PTR, _))))); \ -} - -BOOST_PYTHON_DEFINE_STR_METHOD(capitalize, 0) -BOOST_PYTHON_DEFINE_STR_METHOD(center, 1) - -long str_base::count(object_cref sub) const -{ - return extract<long>(this->attr("count")(sub)); -} - -long str_base::count(object_cref sub, object_cref start) const -{ - return extract<long>(this->attr("count")(sub,start)); -} - -long str_base::count(object_cref sub, object_cref start, object_cref end) const -{ - return extract<long>(this->attr("count")(sub,start,end)); -} - -#if PY_VERSION_HEX < 0x03000000 -object str_base::decode() const -{ - return this->attr("decode")(); -} - -object str_base::decode(object_cref encoding) const -{ - return this->attr("decode")(encoding); -} - -object str_base::decode(object_cref encoding, object_cref errors) const -{ - return this->attr("decode")(encoding,errors); -} -#endif - -object str_base::encode() const -{ - return this->attr("encode")(); -} - -object str_base::encode(object_cref encoding) const -{ - return this->attr("encode")(encoding); -} - -object str_base::encode(object_cref encoding, object_cref errors) const -{ - return this->attr("encode")(encoding,errors); -} - - -#if PY_VERSION_HEX >= 0x03000000 - #define _BOOST_PYTHON_ASLONG PyLong_AsLong -#else - #define _BOOST_PYTHON_ASLONG PyInt_AsLong -#endif - -bool str_base::endswith(object_cref suffix) const -{ - bool result = _BOOST_PYTHON_ASLONG(this->attr("endswith")(suffix).ptr()); - if (PyErr_Occurred()) - throw_error_already_set(); - return result; -} - -bool str_base::endswith(object_cref suffix, object_cref start) const -{ - bool result = _BOOST_PYTHON_ASLONG(this->attr("endswith")(suffix,start).ptr()); - if (PyErr_Occurred()) - throw_error_already_set(); - return result; -} - -bool str_base::endswith(object_cref suffix, object_cref start, object_cref end) const -{ - bool result = _BOOST_PYTHON_ASLONG(this->attr("endswith")(suffix,start,end).ptr()); - if (PyErr_Occurred()) - throw_error_already_set(); - return result; -} - -BOOST_PYTHON_DEFINE_STR_METHOD(expandtabs, 0) -BOOST_PYTHON_DEFINE_STR_METHOD(expandtabs, 1) - -long str_base::find(object_cref sub) const -{ - long result = _BOOST_PYTHON_ASLONG(this->attr("find")(sub).ptr()); - if (PyErr_Occurred()) - throw_error_already_set(); - return result; -} - -long str_base::find(object_cref sub, object_cref start) const -{ - long result = _BOOST_PYTHON_ASLONG(this->attr("find")(sub,start).ptr()); - if (PyErr_Occurred()) - throw_error_already_set(); - return result; -} - -long str_base::find(object_cref sub, object_cref start, object_cref end) const -{ - long result = _BOOST_PYTHON_ASLONG(this->attr("find")(sub,start,end).ptr()); - if (PyErr_Occurred()) - throw_error_already_set(); - return result; -} - -long str_base::index(object_cref sub) const -{ - long result = _BOOST_PYTHON_ASLONG(this->attr("index")(sub).ptr()); - if (PyErr_Occurred()) - throw_error_already_set(); - return result; -} - -long str_base::index(object_cref sub, object_cref start) const -{ - long result = _BOOST_PYTHON_ASLONG(this->attr("index")(sub,start).ptr()); - if (PyErr_Occurred()) - throw_error_already_set(); - return result; -} - -long str_base::index(object_cref sub, object_cref start, object_cref end) const -{ - long result = _BOOST_PYTHON_ASLONG(this->attr("index")(sub,start,end).ptr()); - if (PyErr_Occurred()) - throw_error_already_set(); - return result; -} - -bool str_base::isalnum() const -{ - bool result = _BOOST_PYTHON_ASLONG(this->attr("isalnum")().ptr()); - if (PyErr_Occurred()) - throw_error_already_set(); - return result; -} - -bool str_base::isalpha() const -{ - bool result = _BOOST_PYTHON_ASLONG(this->attr("isalpha")().ptr()); - if (PyErr_Occurred()) - throw_error_already_set(); - return result; -} - -bool str_base::isdigit() const -{ - bool result = _BOOST_PYTHON_ASLONG(this->attr("isdigit")().ptr()); - if (PyErr_Occurred()) - throw_error_already_set(); - return result; -} - -bool str_base::islower() const -{ - bool result = _BOOST_PYTHON_ASLONG(this->attr("islower")().ptr()); - if (PyErr_Occurred()) - throw_error_already_set(); - return result; -} - -bool str_base::isspace() const -{ - bool result = _BOOST_PYTHON_ASLONG(this->attr("isspace")().ptr()); - if (PyErr_Occurred()) - throw_error_already_set(); - return result; -} - -bool str_base::istitle() const -{ - bool result = _BOOST_PYTHON_ASLONG(this->attr("istitle")().ptr()); - if (PyErr_Occurred()) - throw_error_already_set(); - return result; -} - -bool str_base::isupper() const -{ - bool result = _BOOST_PYTHON_ASLONG(this->attr("isupper")().ptr()); - if (PyErr_Occurred()) - throw_error_already_set(); - return result; -} - -BOOST_PYTHON_DEFINE_STR_METHOD(join, 1) -BOOST_PYTHON_DEFINE_STR_METHOD(ljust, 1) -BOOST_PYTHON_DEFINE_STR_METHOD(lower, 0) -BOOST_PYTHON_DEFINE_STR_METHOD(lstrip, 0) -BOOST_PYTHON_DEFINE_STR_METHOD(replace, 2) -BOOST_PYTHON_DEFINE_STR_METHOD(replace, 3) - -long str_base::rfind(object_cref sub) const -{ - long result = _BOOST_PYTHON_ASLONG(this->attr("rfind")(sub).ptr()); - if (PyErr_Occurred()) - throw_error_already_set(); - return result; -} - -long str_base::rfind(object_cref sub, object_cref start) const -{ - long result = _BOOST_PYTHON_ASLONG(this->attr("rfind")(sub,start).ptr()); - if (PyErr_Occurred()) - throw_error_already_set(); - return result; -} - -long str_base::rfind(object_cref sub, object_cref start, object_cref end) const -{ - long result = _BOOST_PYTHON_ASLONG(this->attr("rfind")(sub,start,end).ptr()); - if (PyErr_Occurred()) - throw_error_already_set(); - return result; -} - -long str_base::rindex(object_cref sub) const -{ - long result = _BOOST_PYTHON_ASLONG(this->attr("rindex")(sub).ptr()); - if (PyErr_Occurred()) - throw_error_already_set(); - return result; -} - -long str_base::rindex(object_cref sub, object_cref start) const -{ - long result = _BOOST_PYTHON_ASLONG(this->attr("rindex")(sub,start).ptr()); - if (PyErr_Occurred()) - throw_error_already_set(); - return result; -} - -long str_base::rindex(object_cref sub, object_cref start, object_cref end) const -{ - long result = _BOOST_PYTHON_ASLONG(this->attr("rindex")(sub,start,end).ptr()); - if (PyErr_Occurred()) - throw_error_already_set(); - return result; -} - -BOOST_PYTHON_DEFINE_STR_METHOD(rjust, 1) -BOOST_PYTHON_DEFINE_STR_METHOD(rstrip, 0) - -list str_base::split() const -{ - return list(this->attr("split")()); -} - -list str_base::split(object_cref sep) const -{ - return list(this->attr("split")(sep)); -} - -list str_base::split(object_cref sep, object_cref maxsplit) const -{ - return list(this->attr("split")(sep,maxsplit)); -} - -list str_base::splitlines() const -{ - return list(this->attr("splitlines")()); -} - -list str_base::splitlines(object_cref keepends) const -{ - return list(this->attr("splitlines")(keepends)); -} - -bool str_base::startswith(object_cref prefix) const -{ - bool result = _BOOST_PYTHON_ASLONG(this->attr("startswith")(prefix).ptr()); - if (PyErr_Occurred()) - throw_error_already_set(); - return result; -} - -bool str_base::startswith(object_cref prefix, object_cref start) const -{ - bool result = _BOOST_PYTHON_ASLONG(this->attr("startswith")(prefix,start).ptr()); - if (PyErr_Occurred()) - throw_error_already_set(); - return result; -} - -bool str_base::startswith(object_cref prefix, object_cref start, object_cref end) const -{ - bool result = _BOOST_PYTHON_ASLONG(this->attr("startswith")(prefix,start,end).ptr()); - if (PyErr_Occurred()) - throw_error_already_set(); - return result; -} - -#undef _BOOST_PYTHON_ASLONG - -BOOST_PYTHON_DEFINE_STR_METHOD(strip, 0) -BOOST_PYTHON_DEFINE_STR_METHOD(swapcase, 0) -BOOST_PYTHON_DEFINE_STR_METHOD(title, 0) -BOOST_PYTHON_DEFINE_STR_METHOD(translate, 1) -BOOST_PYTHON_DEFINE_STR_METHOD(translate, 2) -BOOST_PYTHON_DEFINE_STR_METHOD(upper, 0) - -static struct register_str_pytype_ptr -{ - register_str_pytype_ptr() - { - const_cast<converter::registration &>( - converter::registry::lookup(boost::python::type_id<boost::python::str>()) - ) -#if PY_VERSION_HEX >= 0x03000000 - .m_class_object = &PyUnicode_Type; -#else - .m_class_object = &PyString_Type; -#endif - } -}register_str_pytype_ptr_; - -}}} // namespace boost::python diff --git a/contrib/restricted/boost/python/src/tuple.cpp b/contrib/restricted/boost/python/src/tuple.cpp deleted file mode 100644 index 6719713b73..0000000000 --- a/contrib/restricted/boost/python/src/tuple.cpp +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright David Abrahams 2004. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#include <boost/python/tuple.hpp> - -namespace boost { namespace python { namespace detail { - -detail::new_reference tuple_base::call(object const& arg_) -{ - return (detail::new_reference)PyObject_CallFunction( - (PyObject*)&PyTuple_Type, const_cast<char*>("(O)"), - arg_.ptr()); -} - -tuple_base::tuple_base() - : object(detail::new_reference(PyTuple_New(0))) -{} - -tuple_base::tuple_base(object_cref sequence) - : object(call(sequence)) -{} - -static struct register_tuple_pytype_ptr -{ - register_tuple_pytype_ptr() - { - const_cast<converter::registration &>( - converter::registry::lookup(boost::python::type_id<boost::python::tuple>()) - ).m_class_object = &PyTuple_Type; - } -}register_tuple_pytype_ptr_; - - -}}} // namespace boost::python diff --git a/contrib/restricted/boost/python/src/wrapper.cpp b/contrib/restricted/boost/python/src/wrapper.cpp deleted file mode 100644 index 8b1b884769..0000000000 --- a/contrib/restricted/boost/python/src/wrapper.cpp +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright David Abrahams 2004. Distributed under the Boost -// Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - -#include <boost/python/wrapper.hpp> - -namespace boost { namespace python { - -namespace detail -{ - override wrapper_base::get_override( - char const* name - , PyTypeObject* class_object - ) const - { - if (this->m_self) - { - if (handle<> m = handle<>( - python::allow_null( - ::PyObject_GetAttrString( - this->m_self, const_cast<char*>(name)))) - ) - { - PyObject* borrowed_f = 0; - - if ( - PyMethod_Check(m.get()) - && PyMethod_GET_SELF(m.get()) == this->m_self - && class_object->tp_dict != 0 - ) - { - borrowed_f = ::PyDict_GetItemString( - class_object->tp_dict, const_cast<char*>(name)); - - - } - if (borrowed_f != PyMethod_GET_FUNCTION(m.get())) - return override(m); - } - } - return override(handle<>(detail::none())); - } -} - -#if 0 -namespace converter -{ - PyObject* BOOST_PYTHON_DECL do_polymorphic_ref_to_python( - python::detail::wrapper_base const volatile* x, type_info src - ) - { - if (x == 0) - { - ::PyErr_Format( - PyExc_TypeError - , "Attempting to returning pointer or reference to instance of %s\n" - "for which no corresponding Python object exists. Wrap this function" - "with a return return value policy" - ) - } - } - -} -#endif - -}} // namespace boost::python::detail diff --git a/contrib/restricted/boost/qvm/LICENSE_1_0.txt b/contrib/restricted/boost/qvm/LICENSE_1_0.txt deleted file mode 100644 index 36b7cd93cd..0000000000 --- a/contrib/restricted/boost/qvm/LICENSE_1_0.txt +++ /dev/null @@ -1,23 +0,0 @@ -Boost Software License - Version 1.0 - August 17th, 2003 - -Permission is hereby granted, free of charge, to any person or organization -obtaining a copy of the software and accompanying documentation covered by -this license (the "Software") to use, reproduce, display, distribute, -execute, and transmit the Software, and to prepare derivative works of the -Software, and to permit third-parties to whom the Software is furnished to -do so, all subject to the following: - -The copyright notices in the Software and this entire statement, including -the above license grant, this restriction and the following disclaimer, -must be included in all copies of the Software, in whole or in part, and -all derivative works of the Software, unless such copies or derivative -works are solely in the form of machine-executable object code generated by -a source language processor. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT -SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE -FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. diff --git a/contrib/restricted/boost/qvm/README.md b/contrib/restricted/boost/qvm/README.md deleted file mode 100644 index 0205b27c7d..0000000000 --- a/contrib/restricted/boost/qvm/README.md +++ /dev/null @@ -1,33 +0,0 @@ -# QVM - -> A generic C++ library for working with `Q`uaternions, `V`ectors and `M`atrices. - -## Documentation - -https://boostorg.github.io/qvm/ - -## Features - -* Emphasis on 2, 3 and 4-dimensional operations needed in graphics, video games and simulation applications. -* Free function templates operate on any compatible user-defined Quaternion, Vector or Matrix type. -* Enables Quaternion, Vector and Matrix types from different libraries to be safely mixed in the same expression. -* Type-safe mapping between compatible lvalue types with no temporary objects; f.ex. transpose remaps the access to the elements, rather than transforming the matrix. -* Requires only {CPP}03. -* Zero dependencies. - -## Support - -* [cpplang on Slack](https://Cpplang.slack.com) (use the `#boost` channel) -* [Boost Users Mailing List](https://lists.boost.org/mailman/listinfo.cgi/boost-users) -* [Boost Developers Mailing List](https://lists.boost.org/mailman/listinfo.cgi/boost) - -## Distribution - -Besides GitHub, there are two other distribution channels: - -* QVM is included in official [Boost](https://www.boost.org/) releases. -* For maximum portability, the library is also available in single-header format, in two variants (direct download links): - * [qvm.hpp](https://boostorg.github.io/qvm/qvm.hpp): single header containing the complete QVM source, including the complete set of swizzling overloads. - * [qvm_lite.hpp](https://boostorg.github.io/qvm/qvm_lite.hpp): single header containing everything except for the swizzling overloads. - -Copyright 2008-2022 Emil Dotchevski and Reverge Studios, Inc. Distributed under the [Boost Software License, Version 1.0](http://www.boost.org/LICENSE_1_0.txt). diff --git a/contrib/restricted/boost/signals2/LICENSE b/contrib/restricted/boost/signals2/LICENSE deleted file mode 100644 index 36b7cd93cd..0000000000 --- a/contrib/restricted/boost/signals2/LICENSE +++ /dev/null @@ -1,23 +0,0 @@ -Boost Software License - Version 1.0 - August 17th, 2003 - -Permission is hereby granted, free of charge, to any person or organization -obtaining a copy of the software and accompanying documentation covered by -this license (the "Software") to use, reproduce, display, distribute, -execute, and transmit the Software, and to prepare derivative works of the -Software, and to permit third-parties to whom the Software is furnished to -do so, all subject to the following: - -The copyright notices in the Software and this entire statement, including -the above license grant, this restriction and the following disclaimer, -must be included in all copies of the Software, in whole or in part, and -all derivative works of the Software, unless such copies or derivative -works are solely in the form of machine-executable object code generated by -a source language processor. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT -SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE -FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. diff --git a/contrib/restricted/boost/signals2/README.md b/contrib/restricted/boost/signals2/README.md deleted file mode 100644 index 9c5621ba05..0000000000 --- a/contrib/restricted/boost/signals2/README.md +++ /dev/null @@ -1,35 +0,0 @@ -Signals2, part of collection of the [Boost C++ Libraries](http://github.com/boostorg), is an implementation of a managed signals and slots system. - -### License - -Distributed under the [Boost Software License, Version 1.0](http://www.boost.org/LICENSE_1_0.txt). - -### Properties - -* C++03 -* Header-Only - -### Build Status - -Branch | Travis | Appveyor | Coverity Scan | codecov.io | Deps | Docs | Tests | -:-------------: | ------ | -------- | ------------- | ---------- | ---- | ---- | ----- | -[`master`](https://github.com/boostorg/signals2/tree/master) | [![Build Status](https://travis-ci.org/boostorg/signals2.svg?branch=master)](https://travis-ci.org/boostorg/signals2) | [![Build status](https://ci.appveyor.com/api/projects/status/vjbstowu1s13x4l5/branch/master?svg=true)](https://ci.appveyor.com/project/jeking3/signals2-db91c/branch/master) | [![Coverity Scan Build Status](https://scan.coverity.com/projects/15884/badge.svg)](https://scan.coverity.com/projects/boostorg-signals2) | [![codecov](https://codecov.io/gh/boostorg/signals2/branch/master/graph/badge.svg)](https://codecov.io/gh/boostorg/signals2/branch/master)| [![Deps](https://img.shields.io/badge/deps-master-brightgreen.svg)](https://pdimov.github.io/boostdep-report/master/signals2.html) | [![Documentation](https://img.shields.io/badge/docs-master-brightgreen.svg)](http://www.boost.org/doc/libs/master/doc/html/signals2.html) | [![Enter the Matrix](https://img.shields.io/badge/matrix-master-brightgreen.svg)](http://www.boost.org/development/tests/master/developer/signals2.html) -[`develop`](https://github.com/boostorg/signals2/tree/develop) | [![Build Status](https://travis-ci.org/boostorg/signals2.svg?branch=develop)](https://travis-ci.org/boostorg/signals2) | [![Build status](https://ci.appveyor.com/api/projects/status/vjbstowu1s13x4l5/branch/develop?svg=true)](https://ci.appveyor.com/project/jeking3/signals2-db91c/branch/develop) | [![Coverity Scan Build Status](https://scan.coverity.com/projects/15884/badge.svg)](https://scan.coverity.com/projects/boostorg-signals2) | [![codecov](https://codecov.io/gh/boostorg/signals2/branch/develop/graph/badge.svg)](https://codecov.io/gh/boostorg/signals2/branch/develop) | [![Deps](https://img.shields.io/badge/deps-develop-brightgreen.svg)](https://pdimov.github.io/boostdep-report/develop/signals2.html) | [![Documentation](https://img.shields.io/badge/docs-develop-brightgreen.svg)](http://www.boost.org/doc/libs/develop/doc/html/signals2.html) | [![Enter the Matrix](https://img.shields.io/badge/matrix-develop-brightgreen.svg)](http://www.boost.org/development/tests/develop/developer/signals2.html) - -### Directories - -| Name | Purpose | -| ----------- | ------------------------------ | -| `ci` | continuous integration scripts | -| `doc` | documentation | -| `example` | examples | -| `include` | headers | -| `test` | unit tests | - -### More information - -* [Ask questions](http://stackoverflow.com/questions/ask?tags=c%2B%2B,boost,boost-signals2) -* [Report bugs](https://github.com/boostorg/signals2/issues): Be sure to mention Boost version, platform and compiler you're using. A small compilable code sample to reproduce the problem is always good as well. -* Submit your patches as pull requests against **develop** branch. Note that by submitting patches you agree to license your modifications under the [Boost Software License, Version 1.0](http://www.boost.org/LICENSE_1_0.txt). -* Discussions about the library are held on the [Boost developers mailing list](http://www.boost.org/community/groups.html#main). Be sure to read the [discussion policy](http://www.boost.org/community/policy.html) before posting and add the `[signals2]` tag at the beginning of the subject line. - diff --git a/contrib/restricted/boost/stacktrace/README.md b/contrib/restricted/boost/stacktrace/README.md deleted file mode 100644 index d129e8467e..0000000000 --- a/contrib/restricted/boost/stacktrace/README.md +++ /dev/null @@ -1,17 +0,0 @@ -# [Boost.Stacktrace](https://boost.org/libs/stacktrace) - -Library for storing and printing backtraces. - -Boost.Stacktrace is a part of the [Boost C++ Libraries](https://github.com/boostorg). - - -### Test results -@ | Build | Tests coverage | More info -----------------|-------------- | -------------- |----------- -Develop branch: | [![CI](https://github.com/boostorg/stacktrace/actions/workflows/ci.yml/badge.svg?branch=develop)](https://github.com/boostorg/stacktrace/actions/workflows/ci.yml) [![Build status](https://ci.appveyor.com/api/projects/status/l3aak4j8k39rx08t/branch/develop?svg=true)](https://ci.appveyor.com/project/apolukhin/stacktrace/branch/develop) | [![Coverage Status](https://coveralls.io/repos/github/boostorg/stacktrace/badge.svg?branch=develop)](https://coveralls.io/github/boostorg/stacktrace?branch=develop) | [details...](https://www.boost.org/development/tests/develop/developer/stacktrace.html) -Master branch: | [![CI](https://github.com/boostorg/stacktrace/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/boostorg/stacktrace/actions/workflows/ci.yml) [![Build status](https://ci.appveyor.com/api/projects/status/l3aak4j8k39rx08t/branch/master?svg=true)](https://ci.appveyor.com/project/apolukhin/stacktrace/branch/master) | [![Coverage Status](https://coveralls.io/repos/github/boostorg/stacktrace/badge.svg?branch=master)](https://coveralls.io/github/boostorg/stacktrace?branch=master) | [details...](https://www.boost.org/development/tests/master/developer/stacktrace.html) - -[Latest developer documentation](https://www.boost.org/doc/libs/develop/doc/html/stacktrace.html) - -### License -Distributed under the [Boost Software License, Version 1.0](https://boost.org/LICENSE_1_0.txt). diff --git a/contrib/restricted/boost/stacktrace/include/boost/stacktrace/detail/collect_msvc.ipp b/contrib/restricted/boost/stacktrace/include/boost/stacktrace/detail/collect_msvc.ipp deleted file mode 100644 index 0a1e94bf48..0000000000 --- a/contrib/restricted/boost/stacktrace/include/boost/stacktrace/detail/collect_msvc.ipp +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright Antony Polukhin, 2016-2022. -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_STACKTRACE_DETAIL_COLLECT_MSVC_IPP -#define BOOST_STACKTRACE_DETAIL_COLLECT_MSVC_IPP - -#include <boost/config.hpp> -#ifdef BOOST_HAS_PRAGMA_ONCE -# pragma once -#endif - -#include <boost/stacktrace/safe_dump_to.hpp> - -#include <boost/winapi/stack_backtrace.hpp> - -namespace boost { namespace stacktrace { namespace detail { - -std::size_t this_thread_frames::collect(native_frame_ptr_t* out_frames, std::size_t max_frames_count, std::size_t skip) BOOST_NOEXCEPT { - return boost::winapi::RtlCaptureStackBackTrace( - static_cast<boost::winapi::ULONG_>(skip), - static_cast<boost::winapi::ULONG_>(max_frames_count), - const_cast<boost::winapi::PVOID_*>(out_frames), - 0 - ); -} - - -}}} // namespace boost::stacktrace - -#endif // BOOST_STACKTRACE_DETAIL_COLLECT_MSVC_IPP diff --git a/contrib/restricted/boost/stacktrace/include/boost/stacktrace/detail/collect_unwind.ipp b/contrib/restricted/boost/stacktrace/include/boost/stacktrace/detail/collect_unwind.ipp deleted file mode 100644 index 496ab036ac..0000000000 --- a/contrib/restricted/boost/stacktrace/include/boost/stacktrace/detail/collect_unwind.ipp +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright Antony Polukhin, 2016-2022. -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_STACKTRACE_DETAIL_COLLECT_UNWIND_IPP -#define BOOST_STACKTRACE_DETAIL_COLLECT_UNWIND_IPP - -#include <boost/config.hpp> -#ifdef BOOST_HAS_PRAGMA_ONCE -# pragma once -#endif - -#include <boost/stacktrace/safe_dump_to.hpp> - -// On iOS 32-bit ARM architecture _Unwind_Backtrace function doesn't exist, symbol is undefined. -// Forcing libc backtrace() function usage. -#include <boost/predef.h> -#if defined(BOOST_OS_IOS_AVAILABLE) && defined(BOOST_ARCH_ARM_AVAILABLE) && BOOST_VERSION_NUMBER_MAJOR(BOOST_ARCH_ARM) < 8 -#define BOOST_STACKTRACE_USE_LIBC_BACKTRACE_FUNCTION -#endif - -#if defined(BOOST_STACKTRACE_USE_LIBC_BACKTRACE_FUNCTION) -#include <execinfo.h> -#include <algorithm> -#else -#include <unwind.h> -#endif -#include <cstdio> - -#if !defined(_GNU_SOURCE) && !defined(BOOST_STACKTRACE_GNU_SOURCE_NOT_REQUIRED) && !defined(BOOST_WINDOWS) -#error "Boost.Stacktrace requires `_Unwind_Backtrace` function. Define `_GNU_SOURCE` macro or `BOOST_STACKTRACE_GNU_SOURCE_NOT_REQUIRED` if _Unwind_Backtrace is available without `_GNU_SOURCE`." -#endif - -namespace boost { namespace stacktrace { namespace detail { - -#if !defined(BOOST_STACKTRACE_USE_LIBC_BACKTRACE_FUNCTION) -struct unwind_state { - std::size_t frames_to_skip; - native_frame_ptr_t* current; - native_frame_ptr_t* end; -}; - -inline _Unwind_Reason_Code unwind_callback(::_Unwind_Context* context, void* arg) { - // Note: do not write `::_Unwind_GetIP` because it is a macro on some platforms. - // Use `_Unwind_GetIP` instead! - unwind_state* const state = static_cast<unwind_state*>(arg); - if (state->frames_to_skip) { - --state->frames_to_skip; - return _Unwind_GetIP(context) ? ::_URC_NO_REASON : ::_URC_END_OF_STACK; - } - - *state->current = reinterpret_cast<native_frame_ptr_t>( - _Unwind_GetIP(context) - ); - - ++state->current; - if (!*(state->current - 1) || state->current == state->end) { - return ::_URC_END_OF_STACK; - } - return ::_URC_NO_REASON; -} -#endif //!defined(BOOST_STACKTRACE_USE_LIBC_BACKTRACE_FUNCTION) - -std::size_t this_thread_frames::collect(native_frame_ptr_t* out_frames, std::size_t max_frames_count, std::size_t skip) BOOST_NOEXCEPT { - std::size_t frames_count = 0; - if (!max_frames_count) { - return frames_count; - } - skip += 1; - -#if defined(BOOST_STACKTRACE_USE_LIBC_BACKTRACE_FUNCTION) - // According to https://opensource.apple.com/source/Libc/Libc-1272.200.26/gen/backtrace.c.auto.html - // it looks like the `::backtrace` is async signal safe. - frames_count = static_cast<size_t>(::backtrace(const_cast<void **>(out_frames), static_cast<int>(max_frames_count))); - - // NOTE: There is no way to pass "skip" count to backtrace function so we need to perform left shift operation. - // If number of elements in result backtrace is >= max_frames_count then "skip" elements are wasted. - if (frames_count && skip) { - if (skip >= frames_count) { - frames_count = 0; - } else { - std::copy(out_frames + skip, out_frames + frames_count, out_frames); - frames_count -= skip; - } - } -#else - boost::stacktrace::detail::unwind_state state = { skip, out_frames, out_frames + max_frames_count }; - ::_Unwind_Backtrace(&boost::stacktrace::detail::unwind_callback, &state); - frames_count = state.current - out_frames; -#endif //defined(BOOST_STACKTRACE_USE_LIBC_BACKTRACE_FUNCTION) - - if (frames_count && out_frames[frames_count - 1] == 0) { - -- frames_count; - } - - return frames_count; -} - - -}}} // namespace boost::stacktrace::detail - -#undef BOOST_STACKTRACE_USE_LIBC_BACKTRACE_FUNCTION - -#endif // BOOST_STACKTRACE_DETAIL_COLLECT_UNWIND_IPP diff --git a/contrib/restricted/boost/stacktrace/include/boost/stacktrace/detail/frame_decl.hpp b/contrib/restricted/boost/stacktrace/include/boost/stacktrace/detail/frame_decl.hpp deleted file mode 100644 index 4fea8c743c..0000000000 --- a/contrib/restricted/boost/stacktrace/include/boost/stacktrace/detail/frame_decl.hpp +++ /dev/null @@ -1,159 +0,0 @@ -// Copyright Antony Polukhin, 2016-2022. -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_STACKTRACE_DETAIL_FRAME_DECL_HPP -#define BOOST_STACKTRACE_DETAIL_FRAME_DECL_HPP - -#include <boost/config.hpp> -#ifdef BOOST_HAS_PRAGMA_ONCE -# pragma once -#endif - -#include <iosfwd> -#include <string> - -#include <boost/core/explicit_operator_bool.hpp> - -#include <boost/stacktrace/safe_dump_to.hpp> // boost::stacktrace::detail::native_frame_ptr_t -#include <boost/stacktrace/detail/void_ptr_cast.hpp> - -#include <boost/stacktrace/detail/push_options.h> - -/// @file boost/stacktrace/detail/frame_decl.hpp -/// Use <boost/stacktrace/frame.hpp> header instead of this one! - -namespace boost { namespace stacktrace { - -/// @class boost::stacktrace::frame boost/stacktrace/detail/frame_decl.hpp <boost/stacktrace/frame.hpp> -/// @brief Class that stores frame/function address and can get information about it at runtime. -class frame { -public: - typedef boost::stacktrace::detail::native_frame_ptr_t native_frame_ptr_t; - -private: - /// @cond - native_frame_ptr_t addr_; - /// @endcond - -public: - /// @brief Constructs frame that references NULL address. - /// Calls to source_file() and source_line() will return empty string. - /// Calls to source_line() will return 0. - /// - /// @b Complexity: O(1). - /// - /// @b Async-Handler-Safety: Safe. - /// @throws Nothing. - BOOST_CONSTEXPR frame() BOOST_NOEXCEPT - : addr_(0) - {} - -#ifdef BOOST_STACKTRACE_DOXYGEN_INVOKED - /// @brief Copy constructs frame. - /// - /// @b Complexity: O(1). - /// - /// @b Async-Handler-Safety: Safe. - /// @throws Nothing. - constexpr frame(const frame&) = default; - - /// @brief Copy assigns frame. - /// - /// @b Complexity: O(1). - /// - /// @b Async-Handler-Safety: Safe. - /// @throws Nothing. - constexpr frame& operator=(const frame&) = default; -#endif - - /// @brief Constructs frame that references addr and could later generate information about that address using platform specific features. - /// - /// @b Complexity: O(1). - /// - /// @b Async-Handler-Safety: Safe. - /// @throws Nothing. - BOOST_CONSTEXPR explicit frame(native_frame_ptr_t addr) BOOST_NOEXCEPT - : addr_(addr) - {} - - /// @brief Constructs frame that references function_addr and could later generate information about that function using platform specific features. - /// - /// @b Complexity: O(1). - /// - /// @b Async-Handler-Safety: Safe. - /// @throws Nothing. - template <class T> - explicit frame(T* function_addr) BOOST_NOEXCEPT - : addr_(boost::stacktrace::detail::void_ptr_cast<native_frame_ptr_t>(function_addr)) - {} - - /// @returns Name of the frame (function name in a human readable form). - /// - /// @b Complexity: unknown (lots of platform specific work). - /// - /// @b Async-Handler-Safety: Unsafe. - /// @throws std::bad_alloc if not enough memory to construct resulting string. - BOOST_STACKTRACE_FUNCTION std::string name() const; - - /// @returns Address of the frame function. - /// - /// @b Complexity: O(1). - /// - /// @b Async-Handler-Safety: Safe. - /// @throws Nothing. - BOOST_CONSTEXPR native_frame_ptr_t address() const BOOST_NOEXCEPT { - return addr_; - } - - /// @returns Path to the source file, were the function of the frame is defined. Returns empty string - /// if this->source_line() == 0. - /// @throws std::bad_alloc if not enough memory to construct resulting string. - /// - /// @b Complexity: unknown (lots of platform specific work). - /// - /// @b Async-Handler-Safety: Unsafe. - BOOST_STACKTRACE_FUNCTION std::string source_file() const; - - /// @returns Code line in the source file, were the function of the frame is defined. - /// @throws std::bad_alloc if not enough memory to construct string for internal needs. - /// - /// @b Complexity: unknown (lots of platform specific work). - /// - /// @b Async-Handler-Safety: Unsafe. - BOOST_STACKTRACE_FUNCTION std::size_t source_line() const; - - /// @brief Checks that frame is not references NULL address. - /// @returns `true` if `this->address() != 0` - /// - /// @b Complexity: O(1) - /// - /// @b Async-Handler-Safety: Safe. - BOOST_EXPLICIT_OPERATOR_BOOL() - - /// @brief Checks that frame references NULL address. - /// @returns `true` if `this->address() == 0` - /// - /// @b Complexity: O(1) - /// - /// @b Async-Handler-Safety: Safe. - BOOST_CONSTEXPR bool empty() const BOOST_NOEXCEPT { return !address(); } - - /// @cond - BOOST_CONSTEXPR bool operator!() const BOOST_NOEXCEPT { return !address(); } - /// @endcond -}; - - -namespace detail { - BOOST_STACKTRACE_FUNCTION std::string to_string(const frame* frames, std::size_t size); -} // namespace detail - -}} // namespace boost::stacktrace - - -#include <boost/stacktrace/detail/pop_options.h> - -#endif // BOOST_STACKTRACE_DETAIL_FRAME_DECL_HPP diff --git a/contrib/restricted/boost/stacktrace/include/boost/stacktrace/detail/frame_msvc.ipp b/contrib/restricted/boost/stacktrace/include/boost/stacktrace/detail/frame_msvc.ipp deleted file mode 100644 index 6f2b61552a..0000000000 --- a/contrib/restricted/boost/stacktrace/include/boost/stacktrace/detail/frame_msvc.ipp +++ /dev/null @@ -1,377 +0,0 @@ -// Copyright Antony Polukhin, 2016-2022. -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_STACKTRACE_DETAIL_FRAME_MSVC_IPP -#define BOOST_STACKTRACE_DETAIL_FRAME_MSVC_IPP - -#include <boost/config.hpp> -#ifdef BOOST_HAS_PRAGMA_ONCE -# pragma once -#endif - -#include <boost/stacktrace/frame.hpp> - -#include <boost/core/demangle.hpp> -#include <boost/core/noncopyable.hpp> -#include <boost/stacktrace/detail/to_dec_array.hpp> -#include <boost/stacktrace/detail/to_hex_array.hpp> -#include <windows.h> -#include "dbgeng.h" - -#ifdef BOOST_MSVC -# pragma comment(lib, "ole32.lib") -# pragma comment(lib, "Dbgeng.lib") -#endif - - -#ifdef __CRT_UUID_DECL // for __MINGW32__ - __CRT_UUID_DECL(IDebugClient,0x27fe5639,0x8407,0x4f47,0x83,0x64,0xee,0x11,0x8f,0xb0,0x8a,0xc8) - __CRT_UUID_DECL(IDebugControl,0x5182e668,0x105e,0x416e,0xad,0x92,0x24,0xef,0x80,0x04,0x24,0xba) - __CRT_UUID_DECL(IDebugSymbols,0x8c31e98c,0x983a,0x48a5,0x90,0x16,0x6f,0xe5,0xd6,0x67,0xa9,0x50) -#elif defined(DEFINE_GUID) && !defined(BOOST_MSVC) - DEFINE_GUID(IID_IDebugClient,0x27fe5639,0x8407,0x4f47,0x83,0x64,0xee,0x11,0x8f,0xb0,0x8a,0xc8); - DEFINE_GUID(IID_IDebugControl,0x5182e668,0x105e,0x416e,0xad,0x92,0x24,0xef,0x80,0x04,0x24,0xba); - DEFINE_GUID(IID_IDebugSymbols,0x8c31e98c,0x983a,0x48a5,0x90,0x16,0x6f,0xe5,0xd6,0x67,0xa9,0x50); -#endif - - - -// Testing. Remove later -//# define __uuidof(x) ::IID_ ## x - -namespace boost { namespace stacktrace { namespace detail { - -template <class T> -class com_holder: boost::noncopyable { - T* holder_; - -public: - com_holder() BOOST_NOEXCEPT - : holder_(0) - {} - - T* operator->() const BOOST_NOEXCEPT { - return holder_; - } - - void** to_void_ptr_ptr() BOOST_NOEXCEPT { - return reinterpret_cast<void**>(&holder_); - } - - bool is_inited() const BOOST_NOEXCEPT { - return !!holder_; - } - - ~com_holder() BOOST_NOEXCEPT { - if (holder_) { - holder_->Release(); - } - } -}; - - -inline std::string mingw_demangling_workaround(const std::string& s) { -#ifdef BOOST_GCC - if (s.empty()) { - return s; - } - - if (s[0] != '_') { - return boost::core::demangle(('_' + s).c_str()); - } - - return boost::core::demangle(s.c_str()); -#else - return s; -#endif -} - -inline void trim_right_zeroes(std::string& s) { - // MSVC-9 does not have back() and pop_back() functions in std::string - while (!s.empty()) { - const std::size_t last = static_cast<std::size_t>(s.size() - 1); - if (s[last] != '\0') { - break; - } - s.resize(last); - } -} - -class debugging_symbols: boost::noncopyable { - static void try_init_com(com_holder< ::IDebugSymbols>& idebug) BOOST_NOEXCEPT { - com_holder< ::IDebugClient> iclient; - if (S_OK != ::DebugCreate(__uuidof(IDebugClient), iclient.to_void_ptr_ptr())) { - return; - } - - com_holder< ::IDebugControl> icontrol; - const bool res0 = (S_OK == iclient->QueryInterface( - __uuidof(IDebugControl), - icontrol.to_void_ptr_ptr() - )); - if (!res0) { - return; - } - - const bool res1 = (S_OK == iclient->AttachProcess( - 0, - ::GetCurrentProcessId(), - DEBUG_ATTACH_NONINVASIVE | DEBUG_ATTACH_NONINVASIVE_NO_SUSPEND - )); - if (!res1) { - return; - } - - if (S_OK != icontrol->WaitForEvent(DEBUG_WAIT_DEFAULT, INFINITE)) { - return; - } - - // No cheking: QueryInterface sets the output parameter to NULL in case of error. - iclient->QueryInterface(__uuidof(IDebugSymbols), idebug.to_void_ptr_ptr()); - } - -#ifndef BOOST_STACKTRACE_USE_WINDBG_CACHED - - com_holder< ::IDebugSymbols> idebug_; -public: - debugging_symbols() BOOST_NOEXCEPT - { - try_init_com(idebug_); - } - -#else - -#ifdef BOOST_NO_CXX11_THREAD_LOCAL -# error Your compiler does not support C++11 thread_local storage. It`s impossible to build with BOOST_STACKTRACE_USE_WINDBG_CACHED. -#endif - - static com_holder< ::IDebugSymbols>& get_thread_local_debug_inst() BOOST_NOEXCEPT { - // [class.mfct]: A static local variable or local type in a member function always refers to the same entity, whether - // or not the member function is inline. - static thread_local com_holder< ::IDebugSymbols> idebug; - - if (!idebug.is_inited()) { - try_init_com(idebug); - } - - return idebug; - } - - com_holder< ::IDebugSymbols>& idebug_; -public: - debugging_symbols() BOOST_NOEXCEPT - : idebug_( get_thread_local_debug_inst() ) - {} - -#endif // #ifndef BOOST_STACKTRACE_USE_WINDBG_CACHED - - bool is_inited() const BOOST_NOEXCEPT { - return idebug_.is_inited(); - } - - std::string get_name_impl(const void* addr, std::string* module_name = 0) const { - std::string result; - if (!is_inited()) { - return result; - } - const ULONG64 offset = reinterpret_cast<ULONG64>(addr); - - char name[256]; - name[0] = '\0'; - ULONG size = 0; - bool res = (S_OK == idebug_->GetNameByOffset( - offset, - name, - sizeof(name), - &size, - 0 - )); - - if (!res && size != 0) { - result.resize(size); - res = (S_OK == idebug_->GetNameByOffset( - offset, - &result[0], - static_cast<ULONG>(result.size()), - &size, - 0 - )); - - // According to https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/dbgeng/nf-dbgeng-idebugsymbols-getnamebyoffset - // "This size includes the space for the '\0' terminating character." - result.resize(size - 1); - } else if (res) { - result.assign(name, size - 1); - } - - if (!res) { - result.clear(); - return result; - } - - const std::size_t delimiter = result.find_first_of('!'); - if (module_name) { - *module_name = result.substr(0, delimiter); - } - - if (delimiter == std::string::npos) { - // If 'delimiter' is equal to 'std::string::npos' then we have only module name. - result.clear(); - return result; - } - - result = mingw_demangling_workaround( - result.substr(delimiter + 1) - ); - - return result; - } - - std::size_t get_line_impl(const void* addr) const BOOST_NOEXCEPT { - ULONG result = 0; - if (!is_inited()) { - return result; - } - - const bool is_ok = (S_OK == idebug_->GetLineByOffset( - reinterpret_cast<ULONG64>(addr), - &result, - 0, - 0, - 0, - 0 - )); - - return (is_ok ? result : 0); - } - - std::pair<std::string, std::size_t> get_source_file_line_impl(const void* addr) const { - std::pair<std::string, std::size_t> result; - if (!is_inited()) { - return result; - } - const ULONG64 offset = reinterpret_cast<ULONG64>(addr); - - char name[256]; - name[0] = 0; - ULONG size = 0; - ULONG line_num = 0; - bool res = (S_OK == idebug_->GetLineByOffset( - offset, - &line_num, - name, - sizeof(name), - &size, - 0 - )); - - if (res) { - result.first = name; - result.second = line_num; - return result; - } - - if (!res && size == 0) { - return result; - } - - result.first.resize(size); - res = (S_OK == idebug_->GetLineByOffset( - offset, - &line_num, - &result.first[0], - static_cast<ULONG>(result.first.size()), - &size, - 0 - )); - trim_right_zeroes(result.first); - result.second = line_num; - - if (!res) { - result.first.clear(); - result.second = 0; - } - - return result; - } - - void to_string_impl(const void* addr, std::string& res) const { - if (!is_inited()) { - return; - } - - std::string module_name; - std::string name = this->get_name_impl(addr, &module_name); - if (!name.empty()) { - res += name; - } else { - res += to_hex_array(addr).data(); - } - - std::pair<std::string, std::size_t> source_line = this->get_source_file_line_impl(addr); - if (!source_line.first.empty() && source_line.second) { - res += " at "; - res += source_line.first; - res += ':'; - res += boost::stacktrace::detail::to_dec_array(source_line.second).data(); - } else if (!module_name.empty()) { - res += " in "; - res += module_name; - } - } -}; - -std::string to_string(const frame* frames, std::size_t size) { - boost::stacktrace::detail::debugging_symbols idebug; - if (!idebug.is_inited()) { - return std::string(); - } - - std::string res; - res.reserve(64 * size); - for (std::size_t i = 0; i < size; ++i) { - if (i < 10) { - res += ' '; - } - res += boost::stacktrace::detail::to_dec_array(i).data(); - res += '#'; - res += ' '; - idebug.to_string_impl(frames[i].address(), res); - res += '\n'; - } - - return res; -} - -} // namespace detail - -std::string frame::name() const { - boost::stacktrace::detail::debugging_symbols idebug; - return idebug.get_name_impl(addr_); -} - - -std::string frame::source_file() const { - boost::stacktrace::detail::debugging_symbols idebug; - return idebug.get_source_file_line_impl(addr_).first; -} - -std::size_t frame::source_line() const { - boost::stacktrace::detail::debugging_symbols idebug; - return idebug.get_line_impl(addr_); -} - -std::string to_string(const frame& f) { - std::string res; - - boost::stacktrace::detail::debugging_symbols idebug; - idebug.to_string_impl(f.address(), res); - return res; -} - -}} // namespace boost::stacktrace - -#endif // BOOST_STACKTRACE_DETAIL_FRAME_MSVC_IPP diff --git a/contrib/restricted/boost/stacktrace/include/boost/stacktrace/detail/frame_unwind.ipp b/contrib/restricted/boost/stacktrace/include/boost/stacktrace/detail/frame_unwind.ipp deleted file mode 100644 index f08a78cd20..0000000000 --- a/contrib/restricted/boost/stacktrace/include/boost/stacktrace/detail/frame_unwind.ipp +++ /dev/null @@ -1,114 +0,0 @@ -// Copyright Antony Polukhin, 2016-2022. -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_STACKTRACE_DETAIL_FRAME_UNWIND_IPP -#define BOOST_STACKTRACE_DETAIL_FRAME_UNWIND_IPP - -#include <boost/config.hpp> -#ifdef BOOST_HAS_PRAGMA_ONCE -# pragma once -#endif - -#include <boost/stacktrace/frame.hpp> - -#include <boost/stacktrace/detail/to_hex_array.hpp> -#include <boost/stacktrace/detail/location_from_symbol.hpp> -#include <boost/stacktrace/detail/to_dec_array.hpp> -#include <boost/core/demangle.hpp> - -#include <cstdio> - -#ifdef BOOST_STACKTRACE_USE_BACKTRACE -# include <boost/stacktrace/detail/libbacktrace_impls.hpp> -#elif defined(BOOST_STACKTRACE_USE_ADDR2LINE) -# error #include <boost/stacktrace/detail/addr2line_impls.hpp> -#else -# include <boost/stacktrace/detail/unwind_base_impls.hpp> -#endif - -namespace boost { namespace stacktrace { namespace detail { - -template <class Base> -class to_string_impl_base: private Base { -public: - std::string operator()(boost::stacktrace::detail::native_frame_ptr_t addr) { - Base::res.clear(); - Base::prepare_function_name(addr); - if (!Base::res.empty()) { - Base::res = boost::core::demangle(Base::res.c_str()); - } else { - Base::res = to_hex_array(addr).data(); - } - - if (Base::prepare_source_location(addr)) { - return Base::res; - } - - boost::stacktrace::detail::location_from_symbol loc(addr); - if (!loc.empty()) { - Base::res += " in "; - Base::res += loc.name(); - } - - return Base::res; - } -}; - -std::string to_string(const frame* frames, std::size_t size) { - std::string res; - if (size == 0) { - return res; - } - res.reserve(64 * size); - - to_string_impl impl; - - for (std::size_t i = 0; i < size; ++i) { - if (i < 10) { - res += ' '; - } - res += boost::stacktrace::detail::to_dec_array(i).data(); - res += '#'; - res += ' '; - res += impl(frames[i].address()); - res += '\n'; - } - - return res; -} - - -} // namespace detail - - -std::string frame::name() const { - if (!addr_) { - return std::string(); - } - -#if !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) - ::Dl_info dli; - const bool dl_ok = !!::dladdr(const_cast<void*>(addr_), &dli); // `dladdr` on Solaris accepts nonconst addresses - if (dl_ok && dli.dli_sname) { - return boost::core::demangle(dli.dli_sname); - } -#endif - return boost::stacktrace::detail::name_impl(addr_); -} - -std::string to_string(const frame& f) { - if (!f) { - return std::string(); - } - - boost::stacktrace::detail::to_string_impl impl; - return impl(f.address()); -} - - -}} // namespace boost::stacktrace - -#endif // BOOST_STACKTRACE_DETAIL_FRAME_UNWIND_IPP diff --git a/contrib/restricted/boost/stacktrace/include/boost/stacktrace/detail/libbacktrace_impls.hpp b/contrib/restricted/boost/stacktrace/include/boost/stacktrace/detail/libbacktrace_impls.hpp deleted file mode 100644 index bd31c51bf7..0000000000 --- a/contrib/restricted/boost/stacktrace/include/boost/stacktrace/detail/libbacktrace_impls.hpp +++ /dev/null @@ -1,247 +0,0 @@ -// Copyright Antony Polukhin, 2016-2022. -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_STACKTRACE_DETAIL_LIBBACKTRACE_IMPLS_HPP -#define BOOST_STACKTRACE_DETAIL_LIBBACKTRACE_IMPLS_HPP - -#include <boost/config.hpp> -#ifdef BOOST_HAS_PRAGMA_ONCE -# pragma once -#endif - -#include <boost/stacktrace/detail/to_hex_array.hpp> -#include <boost/stacktrace/detail/to_dec_array.hpp> -#include <boost/stacktrace/detail/location_from_symbol.hpp> -#include <boost/core/demangle.hpp> - -#ifdef BOOST_STACKTRACE_BACKTRACE_INCLUDE_FILE -# include BOOST_STACKTRACE_BACKTRACE_INCLUDE_FILE -#else -# include <backtrace.h> -#endif - -namespace boost { namespace stacktrace { namespace detail { - - -struct pc_data { - std::string* function; - std::string* filename; - std::size_t line; -}; - -inline void libbacktrace_syminfo_callback(void *data, uintptr_t /*pc*/, const char *symname, uintptr_t /*symval*/, uintptr_t /*symsize*/) { - pc_data& d = *static_cast<pc_data*>(data); - if (d.function && symname) { - *d.function = symname; - } -} - -// Old versions of libbacktrace have different signature for the callback -inline void libbacktrace_syminfo_callback(void *data, uintptr_t pc, const char *symname, uintptr_t symval) { - boost::stacktrace::detail::libbacktrace_syminfo_callback(data, pc, symname, symval, 0); -} - -inline int libbacktrace_full_callback(void *data, uintptr_t /*pc*/, const char *filename, int lineno, const char *function) { - pc_data& d = *static_cast<pc_data*>(data); - if (d.filename && filename) { - *d.filename = filename; - } - if (d.function && function) { - *d.function = function; - } - d.line = lineno; - return 0; -} - -inline void libbacktrace_error_callback(void* /*data*/, const char* /*msg*/, int /*errnum*/) BOOST_NOEXCEPT { - // Do nothing, just return. -} - -// Not async-signal-safe, so this method is not called from async-safe functions. -// -// This function is not async signal safe because: -// * Dynamic initialization of a block-scope variable with static storage duration could lock a mutex -// * No guarantees on `backtrace_create_state` function. -// -// Currently `backtrace_create_state` can not detect file name on Windows https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82543 -// That's why we provide a `prog_location` here. -BOOST_SYMBOL_VISIBLE inline ::backtrace_state* construct_state(const program_location& prog_location) BOOST_NOEXCEPT { - // [dcl.inline]: A static local variable in an inline function with external linkage always refers to the same object. - - // TODO: The most obvious solution: - // - static ::backtrace_state* state = ::backtrace_create_state( - prog_location.name(), - 1, // allow safe concurrent usage of the same state - boost::stacktrace::detail::libbacktrace_error_callback, - 0 // pointer to data that will be passed to callback - ); - // - // - // Unfortunately, that solution segfaults when `construct_state()` function is in .so file - // and multiple threads concurrently work with state. I failed to localize the root cause: - // https://gcc.gnu.org/bugzilla//show_bug.cgi?id=87653 - - -#if 0 -#if !defined(BOOST_HAS_THREADS) || defined(BOOST_STACKTRACE_BACKTRACE_FORCE_STATIC) - static -#else - - // Result of `construct_state()` invocation is not stored by the callers, so `thread_local` - // gives a single `state` per thread and that state is not shared between threads in any way. - -# ifndef BOOST_NO_CXX11_THREAD_LOCAL - thread_local -# elif defined(__GNUC__) && !defined(__clang__) - static __thread -# else - /* just a local variable */ -# endif - -#endif - ::backtrace_state* state = ::backtrace_create_state( - prog_location.name(), - 0, - boost::stacktrace::detail::libbacktrace_error_callback, - 0 - ); -#endif - return state; -} - -struct to_string_using_backtrace { - std::string res; - boost::stacktrace::detail::program_location prog_location; - ::backtrace_state* state; - std::string filename; - std::size_t line; - - void prepare_function_name(const void* addr) { - boost::stacktrace::detail::pc_data data = {&res, &filename, 0}; - if (state) { - ::backtrace_pcinfo( - state, - reinterpret_cast<uintptr_t>(addr), - boost::stacktrace::detail::libbacktrace_full_callback, - boost::stacktrace::detail::libbacktrace_error_callback, - &data - ) - || - ::backtrace_syminfo( - state, - reinterpret_cast<uintptr_t>(addr), - boost::stacktrace::detail::libbacktrace_syminfo_callback, - boost::stacktrace::detail::libbacktrace_error_callback, - &data - ); - } - line = data.line; - } - - bool prepare_source_location(const void* /*addr*/) { - if (filename.empty() || !line) { - return false; - } - - res += " at "; - res += filename; - res += ':'; - res += boost::stacktrace::detail::to_dec_array(line).data(); - return true; - } - - to_string_using_backtrace() BOOST_NOEXCEPT { - state = boost::stacktrace::detail::construct_state(prog_location); - } -}; - -template <class Base> class to_string_impl_base; -typedef to_string_impl_base<to_string_using_backtrace> to_string_impl; - -inline std::string name_impl(const void* addr) { - std::string res; - - boost::stacktrace::detail::program_location prog_location; - ::backtrace_state* state = boost::stacktrace::detail::construct_state(prog_location); - - boost::stacktrace::detail::pc_data data = {&res, 0, 0}; - if (state) { - ::backtrace_pcinfo( - state, - reinterpret_cast<uintptr_t>(addr), - boost::stacktrace::detail::libbacktrace_full_callback, - boost::stacktrace::detail::libbacktrace_error_callback, - &data - ) - || - ::backtrace_syminfo( - state, - reinterpret_cast<uintptr_t>(addr), - boost::stacktrace::detail::libbacktrace_syminfo_callback, - boost::stacktrace::detail::libbacktrace_error_callback, - &data - ); - } - if (!res.empty()) { - res = boost::core::demangle(res.c_str()); - } - - return res; -} - -} // namespace detail - -std::string frame::source_file() const { - std::string res; - - if (!addr_) { - return res; - } - - boost::stacktrace::detail::program_location prog_location; - ::backtrace_state* state = boost::stacktrace::detail::construct_state(prog_location); - - boost::stacktrace::detail::pc_data data = {0, &res, 0}; - if (state) { - ::backtrace_pcinfo( - state, - reinterpret_cast<uintptr_t>(addr_), - boost::stacktrace::detail::libbacktrace_full_callback, - boost::stacktrace::detail::libbacktrace_error_callback, - &data - ); - } - - return res; -} - -std::size_t frame::source_line() const { - if (!addr_) { - return 0; - } - - boost::stacktrace::detail::program_location prog_location; - ::backtrace_state* state = boost::stacktrace::detail::construct_state(prog_location); - - boost::stacktrace::detail::pc_data data = {0, 0, 0}; - if (state) { - ::backtrace_pcinfo( - state, - reinterpret_cast<uintptr_t>(addr_), - boost::stacktrace::detail::libbacktrace_full_callback, - boost::stacktrace::detail::libbacktrace_error_callback, - &data - ); - } - - return data.line; -} - - -}} // namespace boost::stacktrace - -#endif // BOOST_STACKTRACE_DETAIL_LIBBACKTRACE_IMPLS_HPP diff --git a/contrib/restricted/boost/stacktrace/include/boost/stacktrace/detail/location_from_symbol.hpp b/contrib/restricted/boost/stacktrace/include/boost/stacktrace/detail/location_from_symbol.hpp deleted file mode 100644 index e8017b1f20..0000000000 --- a/contrib/restricted/boost/stacktrace/include/boost/stacktrace/detail/location_from_symbol.hpp +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright Antony Polukhin, 2016-2022. -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_STACKTRACE_DETAIL_LOCATION_FROM_SYMBOL_HPP -#define BOOST_STACKTRACE_DETAIL_LOCATION_FROM_SYMBOL_HPP - -#include <boost/config.hpp> -#ifdef BOOST_HAS_PRAGMA_ONCE -# pragma once -#endif - -#if !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) -# include <dlfcn.h> -#else -# include <boost/winapi/dll.hpp> -#endif - -namespace boost { namespace stacktrace { namespace detail { - -#if !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) -class location_from_symbol { - ::Dl_info dli_; - -public: - explicit location_from_symbol(const void* addr) BOOST_NOEXCEPT - : dli_() - { - if (!::dladdr(const_cast<void*>(addr), &dli_)) { // `dladdr` on Solaris accepts nonconst addresses - dli_.dli_fname = 0; - } - } - - bool empty() const BOOST_NOEXCEPT { - return !dli_.dli_fname; - } - - const char* name() const BOOST_NOEXCEPT { - return dli_.dli_fname; - } -}; - -class program_location { -public: - const char* name() const BOOST_NOEXCEPT { - return 0; - } -}; - -#else - -class location_from_symbol { - BOOST_STATIC_CONSTEXPR boost::winapi::DWORD_ DEFAULT_PATH_SIZE_ = 260; - char file_name_[DEFAULT_PATH_SIZE_]; - -public: - explicit location_from_symbol(const void* addr) BOOST_NOEXCEPT { - file_name_[0] = '\0'; - - boost::winapi::MEMORY_BASIC_INFORMATION_ mbi; - if (!boost::winapi::VirtualQuery(addr, &mbi, sizeof(mbi))) { - return; - } - - boost::winapi::HMODULE_ handle = reinterpret_cast<boost::winapi::HMODULE_>(mbi.AllocationBase); - if (!boost::winapi::GetModuleFileNameA(handle, file_name_, DEFAULT_PATH_SIZE_)) { - file_name_[0] = '\0'; - return; - } - } - - bool empty() const BOOST_NOEXCEPT { - return file_name_[0] == '\0'; - } - - const char* name() const BOOST_NOEXCEPT { - return file_name_; - } -}; - -class program_location { - BOOST_STATIC_CONSTEXPR boost::winapi::DWORD_ DEFAULT_PATH_SIZE_ = 260; - char file_name_[DEFAULT_PATH_SIZE_]; - -public: - program_location() BOOST_NOEXCEPT { - file_name_[0] = '\0'; - - const boost::winapi::HMODULE_ handle = 0; - if (!boost::winapi::GetModuleFileNameA(handle, file_name_, DEFAULT_PATH_SIZE_)) { - file_name_[0] = '\0'; - } - } - - const char* name() const BOOST_NOEXCEPT { - return file_name_[0] ? file_name_ : 0; - } -}; -#endif - -}}} // namespace boost::stacktrace::detail - -#endif // BOOST_STACKTRACE_DETAIL_LOCATION_FROM_SYMBOL_HPP diff --git a/contrib/restricted/boost/stacktrace/include/boost/stacktrace/detail/pop_options.h b/contrib/restricted/boost/stacktrace/include/boost/stacktrace/detail/pop_options.h deleted file mode 100644 index f8502af3e6..0000000000 --- a/contrib/restricted/boost/stacktrace/include/boost/stacktrace/detail/pop_options.h +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright Antony Polukhin, 2016-2022. -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// No include guards! Intentionally. - -#ifdef BOOST_STACKTRACE_FUNCTION -# undef BOOST_STACKTRACE_FUNCTION -#endif - diff --git a/contrib/restricted/boost/stacktrace/include/boost/stacktrace/detail/push_options.h b/contrib/restricted/boost/stacktrace/include/boost/stacktrace/detail/push_options.h deleted file mode 100644 index 5881993465..0000000000 --- a/contrib/restricted/boost/stacktrace/include/boost/stacktrace/detail/push_options.h +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright Antony Polukhin, 2016-2022. -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// No include guards! Intentionally. - -// Link or header only -#if !defined(BOOST_STACKTRACE_LINK) && defined(BOOST_STACKTRACE_DYN_LINK) -# define BOOST_STACKTRACE_LINK -#endif - -#if defined(BOOST_STACKTRACE_LINK) && !defined(BOOST_STACKTRACE_DYN_LINK) && defined(BOOST_ALL_DYN_LINK) -# define BOOST_STACKTRACE_DYN_LINK -#endif - -#ifdef BOOST_STACKTRACE_LINK -# if defined(BOOST_STACKTRACE_DYN_LINK) -# ifdef BOOST_STACKTRACE_INTERNAL_BUILD_LIBS -# define BOOST_STACKTRACE_FUNCTION BOOST_SYMBOL_EXPORT -# else -# define BOOST_STACKTRACE_FUNCTION BOOST_SYMBOL_IMPORT -# endif -# else -# define BOOST_STACKTRACE_FUNCTION -# endif -#elif !defined(BOOST_STACKTRACE_DOXYGEN_INVOKED) -# define BOOST_STACKTRACE_FUNCTION inline -#endif - diff --git a/contrib/restricted/boost/stacktrace/include/boost/stacktrace/detail/safe_dump_posix.ipp b/contrib/restricted/boost/stacktrace/include/boost/stacktrace/detail/safe_dump_posix.ipp deleted file mode 100644 index bafd2950ba..0000000000 --- a/contrib/restricted/boost/stacktrace/include/boost/stacktrace/detail/safe_dump_posix.ipp +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright Antony Polukhin, 2016-2022. -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_STACKTRACE_DETAIL_SAFE_DUMP_POSIX_IPP -#define BOOST_STACKTRACE_DETAIL_SAFE_DUMP_POSIX_IPP - -#include <boost/config.hpp> -#ifdef BOOST_HAS_PRAGMA_ONCE -# pragma once -#endif - -#include <boost/stacktrace/safe_dump_to.hpp> - -#include <unistd.h> // ::write -#include <fcntl.h> // ::open -#include <sys/stat.h> // S_IWUSR and friends - - -namespace boost { namespace stacktrace { namespace detail { - -std::size_t dump(int fd, const native_frame_ptr_t* frames, std::size_t frames_count) BOOST_NOEXCEPT { - // We do not retry, because this function must be typically called from signal handler so it's: - // * to scary to continue in case of EINTR - // * EAGAIN or EWOULDBLOCK may occur only in case of O_NONBLOCK is set for fd, - // so it seems that user does not want to block - if (::write(fd, frames, sizeof(native_frame_ptr_t) * frames_count) == -1) { - return 0; - } - - return frames_count; -} - -std::size_t dump(const char* file, const native_frame_ptr_t* frames, std::size_t frames_count) BOOST_NOEXCEPT { - const int fd = ::open( - file, - O_CREAT | O_WRONLY | O_TRUNC, -#if defined(S_IWUSR) && defined(S_IRUSR) // Workarounds for some Android OSes - S_IWUSR | S_IRUSR -#elif defined(S_IWRITE) && defined(S_IREAD) - S_IWRITE | S_IREAD -#else - 0 -#endif - ); - if (fd == -1) { - return 0; - } - - const std::size_t size = boost::stacktrace::detail::dump(fd, frames, frames_count); - ::close(fd); - return size; -} - -}}} // namespace boost::stacktrace::detail - -#endif // BOOST_STACKTRACE_DETAIL_SAFE_DUMP_POSIX_IPP diff --git a/contrib/restricted/boost/stacktrace/include/boost/stacktrace/detail/safe_dump_win.ipp b/contrib/restricted/boost/stacktrace/include/boost/stacktrace/detail/safe_dump_win.ipp deleted file mode 100644 index b020639933..0000000000 --- a/contrib/restricted/boost/stacktrace/include/boost/stacktrace/detail/safe_dump_win.ipp +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright Antony Polukhin, 2016-2022. -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_STACKTRACE_DETAIL_SAFE_DUMP_WIN_IPP -#define BOOST_STACKTRACE_DETAIL_SAFE_DUMP_WIN_IPP - -#include <boost/config.hpp> -#ifdef BOOST_HAS_PRAGMA_ONCE -# pragma once -#endif - -#include <boost/stacktrace/safe_dump_to.hpp> - -#include <boost/core/noncopyable.hpp> - -#include <boost/winapi/get_current_process.hpp> -#include <boost/winapi/file_management.hpp> -#include <boost/winapi/handles.hpp> -#include <boost/winapi/access_rights.hpp> - -namespace boost { namespace stacktrace { namespace detail { - -std::size_t dump(void* /*fd*/, const native_frame_ptr_t* /*frames*/, std::size_t /*frames_count*/) BOOST_NOEXCEPT { -#if 0 // This code potentially could cause deadlocks (according to the MSDN). Disabled - boost::winapi::DWORD_ written; - const boost::winapi::DWORD_ bytes_to_write = static_cast<boost::winapi::DWORD_>( - sizeof(native_frame_ptr_t) * frames_count - ); - if (!boost::winapi::WriteFile(fd, frames, bytes_to_write, &written, 0)) { - return 0; - } - - return frames_count; -#endif - return 0; -} - -std::size_t dump(const char* /*file*/, const native_frame_ptr_t* /*frames*/, std::size_t /*frames_count*/) BOOST_NOEXCEPT { -#if 0 // This code causing deadlocks on some platforms. Disabled - void* const fd = boost::winapi::CreateFileA( - file, - boost::winapi::GENERIC_WRITE_, - 0, - 0, - boost::winapi::CREATE_ALWAYS_, - boost::winapi::FILE_ATTRIBUTE_NORMAL_, - 0 - ); - - if (fd == boost::winapi::invalid_handle_value) { - return 0; - } - - const std::size_t size = boost::stacktrace::detail::dump(fd, frames, frames_count); - boost::winapi::CloseHandle(fd); - return size; -#endif - return 0; -} - -}}} // namespace boost::stacktrace::detail - -#endif // BOOST_STACKTRACE_DETAIL_SAFE_DUMP_WIN_IPP diff --git a/contrib/restricted/boost/stacktrace/include/boost/stacktrace/detail/to_dec_array.hpp b/contrib/restricted/boost/stacktrace/include/boost/stacktrace/detail/to_dec_array.hpp deleted file mode 100644 index ba63afeb40..0000000000 --- a/contrib/restricted/boost/stacktrace/include/boost/stacktrace/detail/to_dec_array.hpp +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright Antony Polukhin, 2016-2022. -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_STACKTRACE_DETAIL_TO_DEC_ARRAY_HPP -#define BOOST_STACKTRACE_DETAIL_TO_DEC_ARRAY_HPP - -#include <boost/config.hpp> -#ifdef BOOST_HAS_PRAGMA_ONCE -# pragma once -#endif - -#include <boost/array.hpp> - -namespace boost { namespace stacktrace { namespace detail { - -// We do not use boost::lexical_cast in this function to reduce module dependencies -inline boost::array<char, 40> to_dec_array(std::size_t value) BOOST_NOEXCEPT { - boost::array<char, 40> ret; - if (!value) { - ret[0] = '0'; - ret[1] = '\0'; - return ret; - } - - std::size_t digits = 0; - for (std::size_t value_copy = value; value_copy; value_copy /= 10) { - ++ digits; - } - - for (std::size_t i = 1; i <= digits; ++i) { - ret[digits - i] = static_cast<char>('0' + (value % 10)); - value /= 10; - } - - ret[digits] = '\0'; - - return ret; -} - - -}}} // namespace boost::stacktrace::detail - -#endif // BOOST_STACKTRACE_DETAIL_TO_DEC_ARRAY_HPP diff --git a/contrib/restricted/boost/stacktrace/include/boost/stacktrace/detail/to_hex_array.hpp b/contrib/restricted/boost/stacktrace/include/boost/stacktrace/detail/to_hex_array.hpp deleted file mode 100644 index 131a7581dc..0000000000 --- a/contrib/restricted/boost/stacktrace/include/boost/stacktrace/detail/to_hex_array.hpp +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright Antony Polukhin, 2016-2022. -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_STACKTRACE_DETAIL_TO_HEX_ARRAY_HPP -#define BOOST_STACKTRACE_DETAIL_TO_HEX_ARRAY_HPP - -#include <boost/config.hpp> -#ifdef BOOST_HAS_PRAGMA_ONCE -# pragma once -#endif - -#include <boost/array.hpp> -#include <boost/static_assert.hpp> -#include <boost/type_traits/is_pointer.hpp> -#include <boost/type_traits/make_unsigned.hpp> - -namespace boost { namespace stacktrace { namespace detail { - -BOOST_STATIC_CONSTEXPR char to_hex_array_bytes[] = "0123456789ABCDEF"; - -template <class T> -inline boost::array<char, 2 + sizeof(void*) * 2 + 1> to_hex_array(T addr) BOOST_NOEXCEPT { - boost::array<char, 2 + sizeof(void*) * 2 + 1> ret = {"0x"}; - ret.back() = '\0'; - BOOST_STATIC_ASSERT_MSG(!boost::is_pointer<T>::value, ""); - - const std::size_t s = sizeof(T); - - char* out = ret.data() + s * 2 + 1; - - for (std::size_t i = 0; i < s; ++i) { - const unsigned char tmp_addr = (addr & 0xFFu); - *out = to_hex_array_bytes[tmp_addr & 0xF]; - -- out; - *out = to_hex_array_bytes[tmp_addr >> 4]; - -- out; - addr >>= 8; - } - - return ret; -} - -inline boost::array<char, 2 + sizeof(void*) * 2 + 1> to_hex_array(const void* addr) BOOST_NOEXCEPT { - return to_hex_array( - reinterpret_cast< boost::make_unsigned<std::ptrdiff_t>::type >(addr) - ); -} - -}}} // namespace boost::stacktrace::detail - -#endif // BOOST_STACKTRACE_DETAIL_TO_HEX_ARRAY_HPP diff --git a/contrib/restricted/boost/stacktrace/include/boost/stacktrace/detail/unwind_base_impls.hpp b/contrib/restricted/boost/stacktrace/include/boost/stacktrace/detail/unwind_base_impls.hpp deleted file mode 100644 index 14971a293a..0000000000 --- a/contrib/restricted/boost/stacktrace/include/boost/stacktrace/detail/unwind_base_impls.hpp +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright Antony Polukhin, 2016-2022. -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_STACKTRACE_DETAIL_UNWIND_BASE_IMPLS_HPP -#define BOOST_STACKTRACE_DETAIL_UNWIND_BASE_IMPLS_HPP - -#include <boost/config.hpp> -#ifdef BOOST_HAS_PRAGMA_ONCE -# pragma once -#endif - -#include <boost/stacktrace/frame.hpp> - -namespace boost { namespace stacktrace { namespace detail { - -struct to_string_using_nothing { - std::string res; - - void prepare_function_name(const void* addr) { - res = boost::stacktrace::frame(addr).name(); - } - - bool prepare_source_location(const void* /*addr*/) const BOOST_NOEXCEPT { - return false; - } -}; - -template <class Base> class to_string_impl_base; -typedef to_string_impl_base<to_string_using_nothing> to_string_impl; - -inline std::string name_impl(const void* /*addr*/) { - return std::string(); -} - -} // namespace detail - -std::string frame::source_file() const { - return std::string(); -} - -std::size_t frame::source_line() const { - return 0; -} - -}} // namespace boost::stacktrace - -#endif // BOOST_STACKTRACE_DETAIL_UNWIND_BASE_IMPLS_HPP diff --git a/contrib/restricted/boost/stacktrace/include/boost/stacktrace/detail/void_ptr_cast.hpp b/contrib/restricted/boost/stacktrace/include/boost/stacktrace/detail/void_ptr_cast.hpp deleted file mode 100644 index 7cf05be2d5..0000000000 --- a/contrib/restricted/boost/stacktrace/include/boost/stacktrace/detail/void_ptr_cast.hpp +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2014 Renato Tegon Forti, Antony Polukhin. -// Copyright Antony Polukhin, 2015-2022. -// -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt -// or copy at http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_STACKTRACE_DETAIL_VOID_PTR_CAST_HPP -#define BOOST_STACKTRACE_DETAIL_VOID_PTR_CAST_HPP - -#include <boost/config.hpp> -#ifdef BOOST_HAS_PRAGMA_ONCE -# pragma once -#endif - -#include <boost/static_assert.hpp> -#include <boost/type_traits/is_pointer.hpp> - -#if defined(__GNUC__) && defined(__GNUC_MINOR__) && (__GNUC__ * 100 + __GNUC_MINOR__ > 301) -# pragma GCC system_header -#endif - -namespace boost { namespace stacktrace { namespace detail { - -// GCC warns when reinterpret_cast between function pointer and object pointer occur. -// This functionsuppress the warnings and ensures that such casts are safe. -template <class To, class From> -To void_ptr_cast(From* v) BOOST_NOEXCEPT { - BOOST_STATIC_ASSERT_MSG( - boost::is_pointer<To>::value, - "`void_ptr_cast` function must be used only for casting to or from void pointers." - ); - - BOOST_STATIC_ASSERT_MSG( - sizeof(From*) == sizeof(To), - "Pointer to function and pointer to object differ in size on your platform." - ); - - return reinterpret_cast<To>(v); -} - - -}}} // boost::stacktrace::detail - -#endif // BOOST_STACKTRACE_DETAIL_VOID_PTR_CAST_HPP - diff --git a/contrib/restricted/boost/stacktrace/include/boost/stacktrace/frame.hpp b/contrib/restricted/boost/stacktrace/include/boost/stacktrace/frame.hpp deleted file mode 100644 index d5eaa76cef..0000000000 --- a/contrib/restricted/boost/stacktrace/include/boost/stacktrace/frame.hpp +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright Antony Polukhin, 2016-2022. -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_STACKTRACE_FRAME_HPP -#define BOOST_STACKTRACE_FRAME_HPP - -#include <boost/config.hpp> -#ifdef BOOST_HAS_PRAGMA_ONCE -# pragma once -#endif - -#include <iosfwd> -#include <string> - -#include <boost/core/explicit_operator_bool.hpp> - -#include <boost/stacktrace/safe_dump_to.hpp> // boost::stacktrace::detail::native_frame_ptr_t - -#include <boost/stacktrace/detail/frame_decl.hpp> -#include <boost/stacktrace/detail/push_options.h> - -namespace boost { namespace stacktrace { - -/// Comparison operators that provide platform dependant ordering and have O(1) complexity; are Async-Handler-Safe. -BOOST_CONSTEXPR inline bool operator< (const frame& lhs, const frame& rhs) BOOST_NOEXCEPT { return lhs.address() < rhs.address(); } -BOOST_CONSTEXPR inline bool operator> (const frame& lhs, const frame& rhs) BOOST_NOEXCEPT { return rhs < lhs; } -BOOST_CONSTEXPR inline bool operator<=(const frame& lhs, const frame& rhs) BOOST_NOEXCEPT { return !(lhs > rhs); } -BOOST_CONSTEXPR inline bool operator>=(const frame& lhs, const frame& rhs) BOOST_NOEXCEPT { return !(lhs < rhs); } -BOOST_CONSTEXPR inline bool operator==(const frame& lhs, const frame& rhs) BOOST_NOEXCEPT { return lhs.address() == rhs.address(); } -BOOST_CONSTEXPR inline bool operator!=(const frame& lhs, const frame& rhs) BOOST_NOEXCEPT { return !(lhs == rhs); } - -/// Fast hashing support, O(1) complexity; Async-Handler-Safe. -inline std::size_t hash_value(const frame& f) BOOST_NOEXCEPT { - return reinterpret_cast<std::size_t>(f.address()); -} - -/// Outputs stacktrace::frame in a human readable format to string; unsafe to use in async handlers. -BOOST_STACKTRACE_FUNCTION std::string to_string(const frame& f); - -/// Outputs stacktrace::frame in a human readable format to output stream; unsafe to use in async handlers. -template <class CharT, class TraitsT> -std::basic_ostream<CharT, TraitsT>& operator<<(std::basic_ostream<CharT, TraitsT>& os, const frame& f) { - return os << boost::stacktrace::to_string(f); -} - -}} // namespace boost::stacktrace - -/// @cond - -#include <boost/stacktrace/detail/pop_options.h> - -#ifndef BOOST_STACKTRACE_LINK -# if defined(BOOST_STACKTRACE_USE_NOOP) -# error #include <boost/stacktrace/detail/frame_noop.ipp> -# elif defined(BOOST_MSVC) || defined(BOOST_STACKTRACE_USE_WINDBG) || defined(BOOST_STACKTRACE_USE_WINDBG_CACHED) -# include <boost/stacktrace/detail/frame_msvc.ipp> -# else -# include <boost/stacktrace/detail/frame_unwind.ipp> -# endif -#endif -/// @endcond - - -#endif // BOOST_STACKTRACE_FRAME_HPP diff --git a/contrib/restricted/boost/stacktrace/include/boost/stacktrace/safe_dump_to.hpp b/contrib/restricted/boost/stacktrace/include/boost/stacktrace/safe_dump_to.hpp deleted file mode 100644 index 0898c31ef7..0000000000 --- a/contrib/restricted/boost/stacktrace/include/boost/stacktrace/safe_dump_to.hpp +++ /dev/null @@ -1,222 +0,0 @@ -// Copyright Antony Polukhin, 2016-2022. -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_STACKTRACE_SAFE_DUMP_TO_HPP -#define BOOST_STACKTRACE_SAFE_DUMP_TO_HPP - -#include <boost/config.hpp> -#ifdef BOOST_HAS_PRAGMA_ONCE -# pragma once -#endif - -#if defined(BOOST_WINDOWS) -#include <boost/winapi/config.hpp> -#endif - -#include <boost/stacktrace/detail/push_options.h> - -#ifdef BOOST_INTEL -# pragma warning(push) -# pragma warning(disable:2196) // warning #2196: routine is both "inline" and "noinline" -#endif - -/// @file safe_dump_to.hpp This header contains low-level async-signal-safe functions for dumping call stacks. Dumps are binary serialized arrays of `void*`, -/// so you could read them by using 'od -tx8 -An stacktrace_dump_failename' Linux command or using boost::stacktrace::stacktrace::from_dump functions. - -namespace boost { namespace stacktrace { - -/// @cond -namespace detail { - - typedef const void* native_frame_ptr_t; // TODO: change to `typedef void(*native_frame_ptr_t)();` - enum helper{ max_frames_dump = 128 }; - - BOOST_STACKTRACE_FUNCTION std::size_t from_dump(const char* filename, native_frame_ptr_t* out_frames); - BOOST_STACKTRACE_FUNCTION std::size_t dump(const char* file, const native_frame_ptr_t* frames, std::size_t frames_count) BOOST_NOEXCEPT; -#if defined(BOOST_WINDOWS) - BOOST_STACKTRACE_FUNCTION std::size_t dump(void* fd, const native_frame_ptr_t* frames, std::size_t frames_count) BOOST_NOEXCEPT; -#else - // POSIX - BOOST_STACKTRACE_FUNCTION std::size_t dump(int fd, const native_frame_ptr_t* frames, std::size_t frames_count) BOOST_NOEXCEPT; -#endif - - -struct this_thread_frames { // struct is required to avoid warning about usage of inline+BOOST_NOINLINE - BOOST_NOINLINE BOOST_STACKTRACE_FUNCTION static std::size_t collect(native_frame_ptr_t* out_frames, std::size_t max_frames_count, std::size_t skip) BOOST_NOEXCEPT; - - BOOST_NOINLINE static std::size_t safe_dump_to_impl(void* memory, std::size_t size, std::size_t skip) BOOST_NOEXCEPT { - typedef boost::stacktrace::detail::native_frame_ptr_t native_frame_ptr_t; - - if (size < sizeof(native_frame_ptr_t)) { - return 0; - } - - native_frame_ptr_t* mem = static_cast<native_frame_ptr_t*>(memory); - const std::size_t frames_count = boost::stacktrace::detail::this_thread_frames::collect(mem, size / sizeof(native_frame_ptr_t) - 1, skip + 1); - mem[frames_count] = 0; - return frames_count + 1; - } - - template <class T> - BOOST_NOINLINE static std::size_t safe_dump_to_impl(T file, std::size_t skip, std::size_t max_depth) BOOST_NOEXCEPT { - typedef boost::stacktrace::detail::native_frame_ptr_t native_frame_ptr_t; - - native_frame_ptr_t buffer[boost::stacktrace::detail::max_frames_dump + 1]; - if (max_depth > boost::stacktrace::detail::max_frames_dump) { - max_depth = boost::stacktrace::detail::max_frames_dump; - } - - const std::size_t frames_count = boost::stacktrace::detail::this_thread_frames::collect(buffer, max_depth, skip + 1); - buffer[frames_count] = 0; - return boost::stacktrace::detail::dump(file, buffer, frames_count + 1); - } -}; - -} // namespace detail -/// @endcond - -/// @brief Stores current function call sequence into the memory. -/// -/// @b Complexity: O(N) where N is call sequence length, O(1) if BOOST_STACKTRACE_USE_NOOP is defined. -/// -/// @b Async-Handler-Safety: Safe. -/// -/// @returns Stored call sequence depth including terminating zero frame. To get the actually consumed bytes multiply this value by the sizeof(boost::stacktrace::frame::native_frame_ptr_t) -/// -/// @param memory Preallocated buffer to store current function call sequence into. -/// -/// @param size Size of the preallocated buffer. -BOOST_FORCEINLINE std::size_t safe_dump_to(void* memory, std::size_t size) BOOST_NOEXCEPT { - return boost::stacktrace::detail::this_thread_frames::safe_dump_to_impl(memory, size, 0); -} - -/// @brief Stores current function call sequence into the memory. -/// -/// @b Complexity: O(N) where N is call sequence length, O(1) if BOOST_STACKTRACE_USE_NOOP is defined. -/// -/// @b Async-Handler-Safety: Safe. -/// -/// @returns Stored call sequence depth including terminating zero frame. To get the actually consumed bytes multiply this value by the sizeof(boost::stacktrace::frame::native_frame_ptr_t) -/// -/// @param skip How many top calls to skip and do not store. -/// -/// @param memory Preallocated buffer to store current function call sequence into. -/// -/// @param size Size of the preallocated buffer. -BOOST_FORCEINLINE std::size_t safe_dump_to(std::size_t skip, void* memory, std::size_t size) BOOST_NOEXCEPT { - return boost::stacktrace::detail::this_thread_frames::safe_dump_to_impl(memory, size, skip); -} - - -/// @brief Opens a file and rewrites its content with current function call sequence if such operations are async signal safe. -/// -/// @b Complexity: O(N) where N is call sequence length, O(1) if BOOST_STACKTRACE_USE_NOOP is defined. -/// -/// @b Async-Handler-Safety: Safe. -/// -/// @returns Stored call sequence depth including terminating zero frame. -/// -/// @param file File to store current function call sequence. -BOOST_FORCEINLINE std::size_t safe_dump_to(const char* file) BOOST_NOEXCEPT { - return boost::stacktrace::detail::this_thread_frames::safe_dump_to_impl(file, 0, boost::stacktrace::detail::max_frames_dump); -} - -/// @brief Opens a file and rewrites its content with current function call sequence if such operations are async signal safe. -/// -/// @b Complexity: O(N) where N is call sequence length, O(1) if BOOST_STACKTRACE_USE_NOOP is defined. -/// -/// @b Async-Handler-Safety: Safe. -/// -/// @returns Stored call sequence depth including terminating zero frame. -/// -/// @param skip How many top calls to skip and do not store. -/// -/// @param max_depth Max call sequence depth to collect. -/// -/// @param file File to store current function call sequence. -BOOST_FORCEINLINE std::size_t safe_dump_to(std::size_t skip, std::size_t max_depth, const char* file) BOOST_NOEXCEPT { - return boost::stacktrace::detail::this_thread_frames::safe_dump_to_impl(file, skip, max_depth); -} - -#ifdef BOOST_STACKTRACE_DOXYGEN_INVOKED - -/// @brief Writes into the provided file descriptor the current function call sequence if such operation is async signal safe. -/// -/// @b Complexity: O(N) where N is call sequence length, O(1) if BOOST_STACKTRACE_USE_NOOP is defined. -/// -/// @b Async-Handler-Safety: Safe. -/// -/// @returns Stored call sequence depth including terminating zero frame. -/// -/// @param file File to store current function call sequence. -BOOST_FORCEINLINE std::size_t safe_dump_to(platform_specific_descriptor fd) BOOST_NOEXCEPT; - -/// @brief Writes into the provided file descriptor the current function call sequence if such operation is async signal safe. -/// -/// @b Complexity: O(N) where N is call sequence length, O(1) if BOOST_STACKTRACE_USE_NOOP is defined. -/// -/// @b Async-Handler-Safety: Safe. -/// -/// @returns Stored call sequence depth including terminating zero frame. -/// -/// @param skip How many top calls to skip and do not store. -/// -/// @param max_depth Max call sequence depth to collect. -/// -/// @param file File to store current function call sequence. -BOOST_FORCEINLINE std::size_t safe_dump_to(std::size_t skip, std::size_t max_depth, platform_specific_descriptor fd) BOOST_NOEXCEPT; - -#elif defined(BOOST_WINDOWS) - -BOOST_FORCEINLINE std::size_t safe_dump_to(void* fd) BOOST_NOEXCEPT { - return boost::stacktrace::detail::this_thread_frames::safe_dump_to_impl(fd, 0, boost::stacktrace::detail::max_frames_dump); -} - -BOOST_FORCEINLINE std::size_t safe_dump_to(std::size_t skip, std::size_t max_depth, void* fd) BOOST_NOEXCEPT { - return boost::stacktrace::detail::this_thread_frames::safe_dump_to_impl(fd, skip, max_depth); -} - -#else - -// POSIX -BOOST_FORCEINLINE std::size_t safe_dump_to(int fd) BOOST_NOEXCEPT { - return boost::stacktrace::detail::this_thread_frames::safe_dump_to_impl(fd, 0, boost::stacktrace::detail::max_frames_dump); -} - -BOOST_FORCEINLINE std::size_t safe_dump_to(std::size_t skip, std::size_t max_depth, int fd) BOOST_NOEXCEPT { - return boost::stacktrace::detail::this_thread_frames::safe_dump_to_impl(fd, skip, max_depth); -} - -#endif - - -}} // namespace boost::stacktrace - -#ifdef BOOST_INTEL -# pragma warning(pop) -#endif - -#include <boost/stacktrace/detail/pop_options.h> - -#if !defined(BOOST_STACKTRACE_LINK) || defined(BOOST_STACKTRACE_INTERNAL_BUILD_LIBS) -# if defined(BOOST_STACKTRACE_USE_NOOP) -# error #include <boost/stacktrace/detail/safe_dump_noop.ipp> -# error #include <boost/stacktrace/detail/collect_noop.ipp> -# else -# if defined(BOOST_WINDOWS) -# include <boost/stacktrace/detail/safe_dump_win.ipp> -# else -# include <boost/stacktrace/detail/safe_dump_posix.ipp> -# endif -# if defined(BOOST_WINDOWS) && !defined(BOOST_WINAPI_IS_MINGW) // MinGW does not provide RtlCaptureStackBackTrace. MinGW-w64 does. -# include <boost/stacktrace/detail/collect_msvc.ipp> -# else -# include <boost/stacktrace/detail/collect_unwind.ipp> -# endif -# endif -#endif - -#endif // BOOST_STACKTRACE_SAFE_DUMP_TO_HPP diff --git a/contrib/restricted/boost/stacktrace/src/backtrace.cpp b/contrib/restricted/boost/stacktrace/src/backtrace.cpp deleted file mode 100644 index 00d440ff68..0000000000 --- a/contrib/restricted/boost/stacktrace/src/backtrace.cpp +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright Antony Polukhin, 2016-2020. -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#define BOOST_STACKTRACE_INTERNAL_BUILD_LIBS -#define BOOST_STACKTRACE_USE_BACKTRACE - -#ifndef BOOST_STACKTRACE_LINK -#error BOOST_STACKTRACE_LINK must be defined -#endif - -#ifndef _GNU_SOURCE -# define _GNU_SOURCE -#endif - -#include <boost/stacktrace/detail/frame_unwind.ipp> -#include <boost/stacktrace/safe_dump_to.hpp> diff --git a/contrib/restricted/boost/stacktrace/src/basic.cpp b/contrib/restricted/boost/stacktrace/src/basic.cpp deleted file mode 100644 index f21cc4fca9..0000000000 --- a/contrib/restricted/boost/stacktrace/src/basic.cpp +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright Antony Polukhin, 2016-2020. -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#define BOOST_STACKTRACE_INTERNAL_BUILD_LIBS - -#ifndef BOOST_STACKTRACE_LINK -#error BOOST_STACKTRACE_LINK must be defined -#endif - -#ifndef _GNU_SOURCE -# define _GNU_SOURCE -#endif - -#include <boost/stacktrace/detail/frame_unwind.ipp> -#include <boost/stacktrace/safe_dump_to.hpp> diff --git a/contrib/restricted/boost/stacktrace/src/windbg.cpp b/contrib/restricted/boost/stacktrace/src/windbg.cpp deleted file mode 100644 index 0db6daa1b3..0000000000 --- a/contrib/restricted/boost/stacktrace/src/windbg.cpp +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright Antony Polukhin, 2016-2020. -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#define BOOST_STACKTRACE_INTERNAL_BUILD_LIBS - -#ifndef BOOST_STACKTRACE_LINK -#error BOOST_STACKTRACE_LINK must be defined -#endif - -#include <boost/stacktrace/detail/frame_msvc.ipp> -#include <boost/stacktrace/safe_dump_to.hpp> diff --git a/contrib/restricted/boost/system/include/boost/cerrno.hpp b/contrib/restricted/boost/system/include/boost/cerrno.hpp deleted file mode 100644 index 25323100f9..0000000000 --- a/contrib/restricted/boost/system/include/boost/cerrno.hpp +++ /dev/null @@ -1,15 +0,0 @@ -// Boost cerrno.hpp header -------------------------------------------------// - -// Copyright Beman Dawes 2005. -// Use, modification, and distribution is subject to the Boost Software -// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See library home page at http://www.boost.org/libs/system - -#ifndef BOOST_CERRNO_HPP_INCLUDED -#define BOOST_CERRNO_HPP_INCLUDED - -#include <boost/system/detail/cerrno.hpp> - -#endif // #ifndef BOOST_CERRNO_HPP_INCLUDED diff --git a/contrib/restricted/boost/test/CONTRIBUTE.md b/contrib/restricted/boost/test/CONTRIBUTE.md deleted file mode 100644 index c67b112d52..0000000000 --- a/contrib/restricted/boost/test/CONTRIBUTE.md +++ /dev/null @@ -1,26 +0,0 @@ -# How to contribute to Boost.Test - -## Ticket -We like having a ticket stating the bug you are experiencing or the feature you want to implement. -We use the [GitHub issues](https://github.com/boostorg/test/issues) for raising bugs and feature requests, -while older tickets may be found in our former bug tracking system at https://svn.boost.org/ -(`test` component). - -## Pull requests -We welcome any contribution in the form of a pull request. Each PR is never integrated exactly as submitted, -we first run our internal unit tests on several platforms, and work the PR if needed. - -To ease the work of the maintainer and make the integration of your changes faster, please - -- base all your PR on the latest develop, rebase if develop changed since you forked the library -- ensure that your changes are not creating any regression in the current test bed (see below on how to run - the unit tests) -- provide a test case that reproduces the problem you encountered -- integrate your unit test into the `Jamfile.v2` of the test folder - -# Running the unit tests -Please make sure that the current set of tests pass for the changes that you submit. -To run the tests, see [this document](test/README.md). - -# Compile the documentation -The instructions for compiling the documentation are provided in [this document](doc/README.md). diff --git a/contrib/restricted/boost/test/LICENSE b/contrib/restricted/boost/test/LICENSE deleted file mode 100644 index 36b7cd93cd..0000000000 --- a/contrib/restricted/boost/test/LICENSE +++ /dev/null @@ -1,23 +0,0 @@ -Boost Software License - Version 1.0 - August 17th, 2003 - -Permission is hereby granted, free of charge, to any person or organization -obtaining a copy of the software and accompanying documentation covered by -this license (the "Software") to use, reproduce, display, distribute, -execute, and transmit the Software, and to prepare derivative works of the -Software, and to permit third-parties to whom the Software is furnished to -do so, all subject to the following: - -The copyright notices in the Software and this entire statement, including -the above license grant, this restriction and the following disclaimer, -must be included in all copies of the Software, in whole or in part, and -all derivative works of the Software, unless such copies or derivative -works are solely in the form of machine-executable object code generated by -a source language processor. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT -SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE -FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. diff --git a/contrib/restricted/boost/test/README.md b/contrib/restricted/boost/test/README.md deleted file mode 100644 index cabe8ff780..0000000000 --- a/contrib/restricted/boost/test/README.md +++ /dev/null @@ -1,57 +0,0 @@ -![boosttest logo](doc/html/images/boost.test.logo.png) - -# What is Boost.Test? -Boost.Test is a C++03/11/14/17 unit testing library, available on a wide range of platforms and compilers. - -The library is part of [Boost](http://www.boost.org). The latest release -of the library is available from the boost web site. - -Full instructions for use of this library can be accessed from -http://www.boost.org/doc/libs/release/libs/test/ - -# Key features - -* Easy to get started with: - 1. download and deflate the latest boost archive - 1. create a test module with this (header version): - ``` - #define BOOST_TEST_MODULE your_test_module - #include <boost/test/included/unit_test.hpp> - ``` - 1. Write your first test case: - ``` - BOOST_AUTO_TEST_CASE( your_test_case ) { - std::vector<int> a{1, 2}; - std::vector<int> b{1, 2}; - BOOST_TEST( a == b ); - } - ``` - 1. build and run - 1. done -* powerful and unique test assertion macro [`BOOST_TEST`](http://www.boost.org/doc/libs/release/libs/test/doc/html/boost_test/testing_tools/boost_test_universal_macro.html), that understands floating points, collections, strings... and uses appropriate comparison paradigm -* self-registering test cases, organize cases in test suites, apply fixtures on test cases, suites or globally -* provide assertion [context](http://www.boost.org/doc/libs/release/libs/test/doc/html/boost_test/test_output/test_tools_support_for_logging/contexts.html) for advanced diagnostic on failure -* powerful and extensible [dataset](http://www.boost.org/doc/libs/release/libs/test/doc/html/boost_test/tests_organization/test_cases/test_case_generation.html) tests -* add [decoration](http://www.boost.org/doc/libs/release/libs/test/doc/html/boost_test/tests_organization/decorators.html) to test cases and suites for [advanced description](http://www.boost.org/doc/libs/release/libs/test/doc/html/boost_test/tests_organization/semantic.html), [group/label](http://www.boost.org/doc/libs/release/libs/test/doc/html/boost_test/tests_organization/tests_grouping.html), and [dependencies](http://www.boost.org/doc/libs/release/libs/test/doc/html/boost_test/tests_organization/tests_dependencies.html) -* powerful command line options and test case filters -* extensible logging, XML and JUNIT outputs for third-party tools (eg. cont. integration) -* various usage (shared/static library/header only) for faster integration and/or compilation/build cycles, smaller binaries - -# Copyright and license -Copyright 2001-2014, Gennadiy Rozental.<br/> -Copyright 2013-2020, Boost.Test team. - -Distributed under the Boost Software License, Version 1.0.<br/> -(Get a copy at www.boost.org/LICENSE_1_0.txt) - -# Contribute -Please read [this document](CONTRIBUTE.md) to get started. - -# Build Status - -Boost.Test uses mostly the facility provided by our wonderful Boost testers (column `Tests` below). - -Branch | Deps | Docs | Tests | -:-------------: | ---- | ---- | ----- | -[`master`](https://github.com/boostorg/test/tree/master) | [![Deps](https://img.shields.io/badge/deps-master-brightgreen.svg)](https://pdimov.github.io/boostdep-report/master/test.html) | [![Documentation](https://img.shields.io/badge/docs-master-brightgreen.svg)](http://www.boost.org/doc/libs/master/doc/html/test.html) | [![Enter the Matrix](https://img.shields.io/badge/matrix-master-brightgreen.svg)](http://www.boost.org/development/tests/master/developer/test.html) -[`develop`](https://github.com/boostorg/test/tree/develop) | [![Deps](https://img.shields.io/badge/deps-develop-brightgreen.svg)](https://pdimov.github.io/boostdep-report/develop/test.html) | [![Documentation](https://img.shields.io/badge/docs-develop-brightgreen.svg)](http://www.boost.org/doc/libs/develop/doc/html/test.html) | [![Enter the Matrix](https://img.shields.io/badge/matrix-develop-brightgreen.svg)](http://www.boost.org/development/tests/develop/developer/test.html) diff --git a/contrib/restricted/boost/test/include/boost/test/debug.hpp b/contrib/restricted/boost/test/include/boost/test/debug.hpp deleted file mode 100644 index a8ccae0b97..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/debug.hpp +++ /dev/null @@ -1,138 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -//! @file -//! @brief defines portable debug interfaces -//! -//! Intended to standardize interface of programs with debuggers -// *************************************************************************** - -#ifndef BOOST_TEST_DEBUG_API_HPP_112006GER -#define BOOST_TEST_DEBUG_API_HPP_112006GER - -// Boost.Test -#include <boost/test/detail/config.hpp> -#include <boost/test/utils/basic_cstring/basic_cstring.hpp> - -// Boost -#include <boost/function/function1.hpp> - -// STL -#include <string> - -#include <boost/test/detail/suppress_warnings.hpp> - -//____________________________________________________________________________// - -namespace boost { -/// Contains debugger and debug C Runtime interfaces -namespace debug { - -/// @defgroup DebuggerInterface Debugger and debug C Runtime portable interfaces -/// @{ -/// These interfaces are intended to be used by application to: -/// - check if we are running under debugger -/// - attach the debugger to itself -/// -/// Unfortunately these actions differ widely between different debuggers available in a field. These interface present generalized standard form of -/// performing these actions. Implementation depends a lot on the environment application is running in and thus there are several custom implementations -/// supported by the Boost.Test -/// -/// In addition here you find interfaces for memory leaks detection and reporting. -/// -/// All these interfaces are defined in namespace boost::debug - -// ************************************************************************** // -/// Checks if programs runs under debugger - -/// @returns true if current process is under debugger. False otherwise -// ************************************************************************** // -bool BOOST_TEST_DECL under_debugger(); - -// ************************************************************************** // -/// Cause program to break execution in debugger at call point -// ************************************************************************** // - -void BOOST_TEST_DECL debugger_break(); - -// ************************************************************************** // -/// Collection of data, which is used by debugger starter routine -// ************************************************************************** // - -struct dbg_startup_info { - long pid; ///< pid of a program to attach to - bool break_or_continue; ///< what to do after debugger is attached - unit_test::const_string binary_path; ///< path to executable for current process - unit_test::const_string display; ///< if debugger has a GUI, which display to use (on UNIX) - unit_test::const_string init_done_lock; ///< path to a uniquely named lock file, which is used to pause current application while debugger is being initialized -}; - -/// Signature of debugger starter routine. Takes an instance of dbg_startup_into as only argument -typedef boost::function<void (dbg_startup_info const&)> dbg_starter; - -// ************************************************************************** // -/// Specifies which debugger to use when attaching and optionally what routine to use to start that debugger - -/// There are many different debuggers available for different platforms. Some of them also can be used in a different setups/configuratins. -/// For example, gdb can be used in plain text mode, inside ddd, inside (x)emacs or in a separate xterm window. -/// Boost.Test identifies each configuration with unique string. -/// Also different debuggers configurations require different routines which is specifically tailored to start that debugger configuration. -/// Boost.Test comes with set of predefined configuration names and corresponding routines for these configurations: -/// - TODO -/// -/// You can use this routine to select which one of the predefined debugger configurations to use in which case you do not need to provide starter -/// routine (the one provided by Boost.Test will be used). You can also use this routine to select your own debugger by providing unique configuration -/// id and starter routine for this configuration. -/// -/// @param[in] dbg_id Unique id for debugger configuration (for example, gdb) -/// @param[in] s Optional starter routine for selected configuration (use only you want to define your own configuration) -/// @returns Id of previously selected debugger configuration -std::string BOOST_TEST_DECL set_debugger( unit_test::const_string dbg_id, dbg_starter s = dbg_starter() ); - -// ************************************************************************** // -/// Attaches debugger to the current process - -/// Using currently selected debugger, this routine attempts to attach the debugger to this process. -/// @param[in] break_or_continue tells what we wan to do after the debugger is attached. If true - process execution breaks -/// in the point in invocation of this function. Otherwise execution continues, but now it is -/// under the debugger -/// @returns true if debugger successfully attached. False otherwise -// ************************************************************************** // - -bool BOOST_TEST_DECL attach_debugger( bool break_or_continue = true ); - -// ************************************************************************** // -/// Switches on/off memory leaks detection - -/// On platforms where memory leak detection is possible inside of running application (at the moment this is only Windows family) you can -/// switch this feature on and off using this interface. In addition you can specify the name of the file to write a report into. Otherwise -/// the report is going to be generated in standard error stream. -/// @param[in] on_off boolean switch -/// @param[in] report_file file, where the report should be directed to -// ************************************************************************** // - -void BOOST_TEST_DECL detect_memory_leaks( bool on_off, unit_test::const_string report_file = unit_test::const_string() ); - -// ************************************************************************** // -/// Causes program to break execution in debugger at specific allocation point - -/// On some platforms/memory managers (at the moment only on Windows/Visual Studio) one can tell a C Runtime to break -/// on specific memory allocation. This can be used in combination with memory leak detection (which reports leaked memory -/// allocation number) to locate the place where leak initiated. -/// @param[in] mem_alloc_order_num Specific memory allocation number -// ************************************************************************** // - -void BOOST_TEST_DECL break_memory_alloc( long mem_alloc_order_num ); - -} // namespace debug -/// @} - -} // namespace boost - -#include <boost/test/detail/enable_warnings.hpp> - -#endif diff --git a/contrib/restricted/boost/test/include/boost/test/debug_config.hpp b/contrib/restricted/boost/test/include/boost/test/debug_config.hpp deleted file mode 100644 index 894d78e65a..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/debug_config.hpp +++ /dev/null @@ -1,24 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -//! @file -//! @brief user's config for Boost.Test debugging support -//! -//! This file is intended to be edited by end user to specify varios macros, which configure debugger interface -//! Alterntively you can set these parameters in your own sources/makefiles -// *************************************************************************** - -#ifndef BOOST_TEST_DEBUG_CONFIG_HPP_112006GER -#define BOOST_TEST_DEBUG_CONFIG_HPP_112006GER - -// ';' separated list of supported debuggers -// #define BOOST_TEST_DBG_LIST gdb;dbx - -// maximum size of /proc/pid/stat file -// #define BOOST_TEST_STAT_LINE_MAX - -#endif diff --git a/contrib/restricted/boost/test/include/boost/test/detail/config.hpp b/contrib/restricted/boost/test/include/boost/test/detail/config.hpp deleted file mode 100644 index 343a8667e4..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/detail/config.hpp +++ /dev/null @@ -1,170 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -//!@file -//!@brief a central place for global configuration switches -// *************************************************************************** - -#ifndef BOOST_TEST_CONFIG_HPP_071894GER -#define BOOST_TEST_CONFIG_HPP_071894GER - -// Boost -#include <boost/config.hpp> // compilers workarounds -#include <boost/detail/workaround.hpp> - -#if defined(_WIN32) && !defined(BOOST_DISABLE_WIN32) && \ - (!defined(__COMO__) && !defined(__MWERKS__) && \ - !defined(__GNUC__) && !defined(BOOST_EMBTC) || \ - BOOST_WORKAROUND(__MWERKS__, >= 0x3000)) -# define BOOST_SEH_BASED_SIGNAL_HANDLING -#endif - -#if defined(__COMO__) && defined(_MSC_VER) -// eh.h uses type_info without declaring it. -class type_info; -# define BOOST_SEH_BASED_SIGNAL_HANDLING -#endif - -//____________________________________________________________________________// - -#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x570)) || \ - BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600)) || \ - (defined __sgi && BOOST_WORKAROUND(_COMPILER_VERSION, BOOST_TESTED_AT(730))) -# define BOOST_TEST_SHIFTED_LINE -#endif - -//____________________________________________________________________________// - -#if defined(BOOST_MSVC) || (defined(__BORLANDC__) && !defined(BOOST_DISABLE_WIN32)) -# define BOOST_TEST_CALL_DECL __cdecl -#else -# define BOOST_TEST_CALL_DECL /**/ -#endif - -//____________________________________________________________________________// - -#if !defined(BOOST_NO_STD_LOCALE) && !defined(__MWERKS__) -# define BOOST_TEST_USE_STD_LOCALE 1 -#endif - -//____________________________________________________________________________// - -#if BOOST_WORKAROUND(BOOST_BORLANDC, <= 0x570) || \ - BOOST_WORKAROUND( __COMO__, <= 0x433 ) || \ - BOOST_WORKAROUND( __INTEL_COMPILER, <= 800 ) || \ - defined(__sgi) && _COMPILER_VERSION <= 730 || \ - BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600)) || \ - defined(__DECCXX) || \ - defined(__DMC__) -# define BOOST_TEST_NO_PROTECTED_USING -#endif - -//____________________________________________________________________________// - -#if BOOST_WORKAROUND(BOOST_MSVC, < 1400) -#define BOOST_TEST_PROTECTED_VIRTUAL -#else -#define BOOST_TEST_PROTECTED_VIRTUAL virtual -#endif - -//____________________________________________________________________________// - -#if !defined(BOOST_BORLANDC) && !BOOST_WORKAROUND( __SUNPRO_CC, < 0x5100 ) -#define BOOST_TEST_SUPPORT_TOKEN_ITERATOR 1 -#endif - -//____________________________________________________________________________// - -// Sun compiler does not support visibility on enums -#if defined(__SUNPRO_CC) -#define BOOST_TEST_ENUM_SYMBOL_VISIBLE -#else -#define BOOST_TEST_ENUM_SYMBOL_VISIBLE BOOST_SYMBOL_VISIBLE -#endif - -//____________________________________________________________________________// - -#if defined(BOOST_ALL_DYN_LINK) && !defined(BOOST_TEST_DYN_LINK) -# define BOOST_TEST_DYN_LINK -#endif - -// in case any of the define from cmake/b2 is set -#if !defined(BOOST_TEST_DYN_LINK) \ - && (defined(BOOST_UNIT_TEST_FRAMEWORK_DYN_LINK) \ - || defined(BOOST_TEST_EXEC_MONITOR_DYN_LINK) \ - || defined(BOOST_PRG_EXEC_MONITOR_DYN_LINK) ) -# define BOOST_TEST_DYN_LINK -#endif - -#if defined(BOOST_TEST_INCLUDED) -# undef BOOST_TEST_DYN_LINK -#endif - -#if defined(BOOST_TEST_DYN_LINK) -# define BOOST_TEST_ALTERNATIVE_INIT_API - -# ifdef BOOST_TEST_SOURCE -# define BOOST_TEST_DECL BOOST_SYMBOL_EXPORT BOOST_SYMBOL_VISIBLE -# else -# define BOOST_TEST_DECL BOOST_SYMBOL_IMPORT BOOST_SYMBOL_VISIBLE -# endif // BOOST_TEST_SOURCE -#else -# if defined(BOOST_TEST_INCLUDED) -# define BOOST_TEST_DECL -# else -# define BOOST_TEST_DECL BOOST_SYMBOL_VISIBLE -# endif -#endif - -#if !defined(BOOST_TEST_MAIN) && defined(BOOST_AUTO_TEST_MAIN) -#define BOOST_TEST_MAIN BOOST_AUTO_TEST_MAIN -#endif - -#if !defined(BOOST_TEST_MAIN) && defined(BOOST_TEST_MODULE) -#define BOOST_TEST_MAIN BOOST_TEST_MODULE -#endif - - - -#ifndef BOOST_PP_VARIADICS /* we can change this only if not already defined */ - -#ifdef __PGI -#define BOOST_PP_VARIADICS 1 -#endif - -#if BOOST_CLANG -#define BOOST_PP_VARIADICS 1 -#endif - -#if defined(BOOST_GCC) && (BOOST_GCC >= 4 * 10000 + 8 * 100) -#define BOOST_PP_VARIADICS 1 -#endif - -#if defined(__NVCC__) -#define BOOST_PP_VARIADICS 1 -#endif - -#endif /* ifndef BOOST_PP_VARIADICS */ - -// some versions of VC exibit a manifest error with this BOOST_UNREACHABLE_RETURN -#if BOOST_WORKAROUND(BOOST_MSVC, < 1910) -# define BOOST_TEST_UNREACHABLE_RETURN(x) return x -#else -# define BOOST_TEST_UNREACHABLE_RETURN(x) BOOST_UNREACHABLE_RETURN(x) -#endif - -//____________________________________________________________________________// -// string_view support -//____________________________________________________________________________// -// note the code should always be compatible with compiled version of boost.test -// using a pre-c++17 compiler - -#ifndef BOOST_NO_CXX17_HDR_STRING_VIEW -#define BOOST_TEST_STRING_VIEW -#endif - -#endif // BOOST_TEST_CONFIG_HPP_071894GER diff --git a/contrib/restricted/boost/test/include/boost/test/detail/enable_warnings.hpp b/contrib/restricted/boost/test/include/boost/test/detail/enable_warnings.hpp deleted file mode 100644 index d61c7dc592..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/detail/enable_warnings.hpp +++ /dev/null @@ -1,36 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -//!@file -//!@brief enable previously suppressed warnings -// *************************************************************************** - -#ifdef BOOST_MSVC -# pragma warning(default: 4511) // copy constructor can't not be generated -# pragma warning(default: 4512) // assignment operator can't not be generated -# pragma warning(default: 4100) // unreferenced formal parameter -# pragma warning(default: 4996) // <symbol> was declared deprecated -# pragma warning(default: 4355) // 'this' : used in base member initializer list -# pragma warning(default: 4706) // assignment within conditional expression -# pragma warning(default: 4251) // class 'A<T>' needs to have dll-interface to be used by clients of class 'B' -# pragma warning(default: 4127) // conditional expression is constant -# pragma warning(default: 4290) // C++ exception specification ignored except to ... -# pragma warning(default: 4180) // qualifier applied to function type has no meaning; ignored -# pragma warning(default: 4275) // non dll-interface class ... used as base for dll-interface class ... -# pragma warning(default: 4267) // 'var' : conversion from 'size_t' to 'type', possible loss of data -# pragma warning(default: 4511) // 'class' : copy constructor could not be generated -# pragma warning(pop) -#endif - -#if defined(BOOST_CLANG) && (BOOST_CLANG == 1) -#pragma clang diagnostic pop -#endif - -#if defined(BOOST_GCC) && (BOOST_GCC >= 4 * 10000 + 6 * 100) -# pragma GCC diagnostic pop -#endif - diff --git a/contrib/restricted/boost/test/include/boost/test/detail/fwd_decl.hpp b/contrib/restricted/boost/test/include/boost/test/detail/fwd_decl.hpp deleted file mode 100644 index 3d6b55a139..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/detail/fwd_decl.hpp +++ /dev/null @@ -1,47 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -//!@file -//!@brief contains forward eclarations for Boost.Test data types -// *************************************************************************** - -#ifndef BOOST_TEST_FWD_DECL_HPP_011605GER -#define BOOST_TEST_FWD_DECL_HPP_011605GER - -namespace boost { - -class execution_monitor; -class execution_exception; - -namespace unit_test { - -class test_unit; -class test_case; -class test_suite; -class master_test_suite_t; - -class test_tree_visitor; -class test_observer; -class test_unit_fixture; -class global_fixture; - -// singletons -class unit_test_monitor_t; -class unit_test_log_t; - -class unit_test_log_formatter; -struct log_entry_data; -struct log_checkpoint_data; - -class lazy_ostream; - -} // namespace unit_test - -} // namespace boost - -#endif // BOOST_TEST_FWD_DECL_HPP_011605GER - diff --git a/contrib/restricted/boost/test/include/boost/test/detail/global_typedef.hpp b/contrib/restricted/boost/test/include/boost/test/detail/global_typedef.hpp deleted file mode 100644 index 5e6f960737..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/detail/global_typedef.hpp +++ /dev/null @@ -1,149 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -//!@file -//!@brief some trivial global typedefs -// *************************************************************************** - -#ifndef BOOST_TEST_GLOBAL_TYPEDEF_HPP_021005GER -#define BOOST_TEST_GLOBAL_TYPEDEF_HPP_021005GER - -#include <boost/test/utils/basic_cstring/basic_cstring.hpp> - -#define BOOST_TEST_L( s ) ::boost::unit_test::const_string( s, sizeof( s ) - 1 ) -#define BOOST_TEST_STRINGIZE( s ) BOOST_TEST_L( BOOST_STRINGIZE( s ) ) -#define BOOST_TEST_EMPTY_STRING BOOST_TEST_L( "" ) - -#include <boost/test/detail/suppress_warnings.hpp> - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { - -typedef unsigned long counter_t; - -//____________________________________________________________________________// - -enum report_level { INV_REPORT_LEVEL, CONFIRMATION_REPORT, SHORT_REPORT, DETAILED_REPORT, NO_REPORT }; - -//____________________________________________________________________________// - -//! Indicates the output format for the loggers or the test tree printing -enum output_format { OF_INVALID, - OF_CLF, ///< compiler log format - OF_XML, ///< XML format for report and log, - OF_JUNIT, ///< JUNIT format for report and log, - OF_CUSTOM_LOGGER, ///< User specified logger. - OF_DOT ///< dot format for output content -}; - -//____________________________________________________________________________// - -enum test_unit_type { TUT_CASE = 0x01, TUT_SUITE = 0x10, TUT_ANY = 0x11 }; - -//____________________________________________________________________________// - -enum assertion_result { AR_FAILED, AR_PASSED, AR_TRIGGERED }; - -//____________________________________________________________________________// - -typedef unsigned long test_unit_id; - -const test_unit_id INV_TEST_UNIT_ID = 0xFFFFFFFF; -const test_unit_id MAX_TEST_CASE_ID = 0xFFFFFFFE; -const test_unit_id MIN_TEST_CASE_ID = 0x00010000; -const test_unit_id MAX_TEST_SUITE_ID = 0x0000FF00; -const test_unit_id MIN_TEST_SUITE_ID = 0x00000001; - -//____________________________________________________________________________// - -namespace ut_detail { - -inline test_unit_type -test_id_2_unit_type( test_unit_id id ) -{ - return (id & 0xFFFF0000) != 0 ? TUT_CASE : TUT_SUITE; -} - -//! Helper class for restoring the current test unit ID in a RAII manner -struct test_unit_id_restore { - test_unit_id_restore(test_unit_id& to_restore_, test_unit_id new_value) - : to_restore(to_restore_) - , bkup(to_restore_) { - to_restore = new_value; - } - ~test_unit_id_restore() { - to_restore = bkup; - } -private: - test_unit_id& to_restore; - test_unit_id bkup; -}; - -//____________________________________________________________________________// - -} // namespace ut_detail - -// helper templates to prevent ODR violations -template<class T> -struct static_constant { - static T value; -}; - -template<class T> -T static_constant<T>::value; - -//____________________________________________________________________________// - -// helper defines for singletons. -// BOOST_TEST_SINGLETON_CONS should appear in the class body, -// BOOST_TEST_SINGLETON_CONS_IMPL should be in only one translation unit. The -// global instance should be declared by BOOST_TEST_SINGLETON_INST. - -#define BOOST_TEST_SINGLETON_CONS_NO_CTOR( type ) \ -public: \ - static type& instance(); \ -private: \ - BOOST_DELETED_FUNCTION(type(type const&)) \ - BOOST_DELETED_FUNCTION(type& operator=(type const&)) \ - BOOST_DEFAULTED_FUNCTION(~type(), {}) \ -/**/ - -#define BOOST_TEST_SINGLETON_CONS( type ) \ - BOOST_TEST_SINGLETON_CONS_NO_CTOR(type) \ -private: \ - BOOST_DEFAULTED_FUNCTION(type(), {}) \ -/**/ - -#define BOOST_TEST_SINGLETON_CONS_IMPL( type ) \ - type& type::instance() { \ - static type the_inst; return the_inst; \ - } \ -/**/ - -//____________________________________________________________________________// - -#if defined(__APPLE_CC__) && defined(__GNUC__) && __GNUC__ < 4 -#define BOOST_TEST_SINGLETON_INST( inst ) \ -static BOOST_JOIN( inst, _t)& inst BOOST_ATTRIBUTE_UNUSED = BOOST_JOIN (inst, _t)::instance(); - -#else - -#define BOOST_TEST_SINGLETON_INST( inst ) \ -namespace { BOOST_JOIN( inst, _t)& inst BOOST_ATTRIBUTE_UNUSED = BOOST_JOIN( inst, _t)::instance(); } - -#endif - -} // namespace unit_test -} // namespace boost - -//____________________________________________________________________________// - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_GLOBAL_TYPEDEF_HPP_021005GER diff --git a/contrib/restricted/boost/test/include/boost/test/detail/log_level.hpp b/contrib/restricted/boost/test/include/boost/test/detail/log_level.hpp deleted file mode 100644 index d391e103d1..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/detail/log_level.hpp +++ /dev/null @@ -1,42 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -//!@file -//!@brief shared definition for unit test log levels -// *************************************************************************** - -#ifndef BOOST_TEST_LOG_LEVEL_HPP_011605GER -#define BOOST_TEST_LOG_LEVEL_HPP_011605GER - -#include <boost/test/detail/config.hpp> - -namespace boost { -namespace unit_test { - -// ************************************************************************** // -// ************** log levels ************** // -// ************************************************************************** // - -// each log level includes all subsequent higher loging levels -enum BOOST_TEST_ENUM_SYMBOL_VISIBLE log_level { - invalid_log_level = -1, - log_successful_tests = 0, - log_test_units = 1, - log_messages = 2, - log_warnings = 3, - log_all_errors = 4, // reported by unit test macros - log_cpp_exception_errors = 5, // uncaught C++ exceptions - log_system_errors = 6, // including timeouts, signals, traps - log_fatal_errors = 7, // including unit test macros or - // fatal system errors - log_nothing = 8 -}; - -} // namespace unit_test -} // namespace boost - -#endif // BOOST_TEST_LOG_LEVEL_HPP_011605GER diff --git a/contrib/restricted/boost/test/include/boost/test/detail/pp_variadic.hpp b/contrib/restricted/boost/test/include/boost/test/detail/pp_variadic.hpp deleted file mode 100644 index a443744daa..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/detail/pp_variadic.hpp +++ /dev/null @@ -1,49 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -//!@file -//!@brief few helpers for working with variadic macros -// *************************************************************************** - -#ifndef BOOST_TEST_PP_VARIADIC_HPP_021515GER -#define BOOST_TEST_PP_VARIADIC_HPP_021515GER - -// Boost -#include <boost/preprocessor/control/iif.hpp> -#include <boost/preprocessor/comparison/equal.hpp> -#include <boost/preprocessor/variadic/size.hpp> - -//____________________________________________________________________________// - -#if BOOST_PP_VARIADICS - -#if BOOST_PP_VARIADICS_MSVC -# define BOOST_TEST_INVOKE_VARIADIC( tool, ... ) BOOST_PP_CAT( tool (__VA_ARGS__), ) -#else -# define BOOST_TEST_INVOKE_VARIADIC( tool, ... ) tool (__VA_ARGS__) -#endif - -//____________________________________________________________________________// - -/// if sizeof(__VA_ARGS__) == N: F1(__VA_ARGS__) -/// else: F2(__VA_ARGS__) -#define BOOST_TEST_INVOKE_IF_N_ARGS( N, F1, F2, ... ) \ - BOOST_TEST_INVOKE_VARIADIC( \ - BOOST_PP_IIF( \ - BOOST_PP_EQUAL(BOOST_PP_VARIADIC_SIZE(__VA_ARGS__), N), \ - F1, \ - F2), \ - __VA_ARGS__ ) \ -/**/ - -//____________________________________________________________________________// - -#endif /* BOOST_PP_VARIADICS */ - -#endif // BOOST_TEST_PP_VARIADIC_HPP_021515GER - -// EOF diff --git a/contrib/restricted/boost/test/include/boost/test/detail/suppress_warnings.hpp b/contrib/restricted/boost/test/include/boost/test/detail/suppress_warnings.hpp deleted file mode 100644 index 2145da5f91..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/detail/suppress_warnings.hpp +++ /dev/null @@ -1,41 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -//!@file -//!@brief suppress some warnings -// *************************************************************************** - -#ifdef BOOST_MSVC -# pragma warning(push) -# pragma warning(disable: 4511) // copy constructor can't not be generated -# pragma warning(disable: 4512) // assignment operator can't not be generated -# pragma warning(disable: 4100) // unreferenced formal parameter -# pragma warning(disable: 4996) // <symbol> was declared deprecated -# pragma warning(disable: 4355) // 'this' : used in base member initializer list -# pragma warning(disable: 4706) // assignment within conditional expression -# pragma warning(disable: 4251) // class 'A<T>' needs to have dll-interface to be used by clients of class 'B' -# pragma warning(disable: 4127) // conditional expression is constant -# pragma warning(disable: 4290) // C++ exception specification ignored except to ... -# pragma warning(disable: 4180) // qualifier applied to function type has no meaning; ignored -# pragma warning(disable: 4275) // non dll-interface class ... used as base for dll-interface class ... -# pragma warning(disable: 4267) // 'var' : conversion from 'size_t' to 'type', possible loss of data -# pragma warning(disable: 4511) // 'class' : copy constructor could not be generated -#endif - -#if defined(BOOST_CLANG) && (BOOST_CLANG == 1) -# pragma clang diagnostic push -# pragma clang diagnostic ignored "-Wvariadic-macros" -# pragma clang diagnostic ignored "-Wmissing-declarations" -#endif - -#if defined(BOOST_GCC) && (BOOST_GCC >= 4 * 10000 + 6 * 100) -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wvariadic-macros" -# pragma GCC diagnostic ignored "-Wmissing-declarations" -// # pragma GCC diagnostic ignored "-Wattributes" -#endif - diff --git a/contrib/restricted/boost/test/include/boost/test/detail/throw_exception.hpp b/contrib/restricted/boost/test/include/boost/test/detail/throw_exception.hpp deleted file mode 100644 index 19b50ba49c..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/detail/throw_exception.hpp +++ /dev/null @@ -1,71 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -//!@file -//!@brief contains wrappers, which allows to build Boost.Test with no exception -// *************************************************************************** - -#ifndef BOOST_TEST_DETAIL_THROW_EXCEPTION_HPP -#define BOOST_TEST_DETAIL_THROW_EXCEPTION_HPP - -// Boost -#include <boost/config.hpp> // BOOST_NO_EXCEPTIONS - -#ifdef BOOST_NO_EXCEPTIONS -// C RUNTIME -#include <stdlib.h> - -#endif - -#include <boost/test/detail/suppress_warnings.hpp> - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { -namespace ut_detail { - -#ifdef BOOST_NO_EXCEPTIONS - -template<typename E> -BOOST_NORETURN inline void -throw_exception(E const& /*e*/) { abort(); } - -#define BOOST_TEST_I_TRY -#define BOOST_TEST_I_CATCH( T, var ) for(T const& var = *(T*)0; false;) -#define BOOST_TEST_I_CATCH0( T ) if(0) -#define BOOST_TEST_I_CATCHALL() if(0) -#define BOOST_TEST_I_RETHROW - -#else - -template<typename E> -BOOST_NORETURN inline void -throw_exception(E const& e) { throw e; } - -#define BOOST_TEST_I_TRY try -#define BOOST_TEST_I_CATCH( T, var ) catch( T const& var ) -#define BOOST_TEST_I_CATCH0( T ) catch( T const& ) -#define BOOST_TEST_I_CATCHALL() catch(...) -#define BOOST_TEST_I_RETHROW throw -#endif - -//____________________________________________________________________________// - -#define BOOST_TEST_I_THROW( E ) unit_test::ut_detail::throw_exception( E ) -#define BOOST_TEST_I_ASSRT( cond, ex ) if( cond ) {} else BOOST_TEST_I_THROW( ex ) - - -} // namespace ut_detail -} // namespace unit_test -} // namespace boost - -//____________________________________________________________________________// - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_DETAIL_THROW_EXCEPTION_HPP diff --git a/contrib/restricted/boost/test/include/boost/test/execution_monitor.hpp b/contrib/restricted/boost/test/include/boost/test/execution_monitor.hpp deleted file mode 100644 index 6f1893bcd6..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/execution_monitor.hpp +++ /dev/null @@ -1,584 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// (C) Copyright Beman Dawes 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -//!@file -//!@brief Defines public interface of the Execution Monitor and related classes -// *************************************************************************** - -#ifndef BOOST_TEST_EXECUTION_MONITOR_HPP_071894GER -#define BOOST_TEST_EXECUTION_MONITOR_HPP_071894GER - -// Boost.Test -#include <boost/test/detail/global_typedef.hpp> -#include <boost/test/detail/fwd_decl.hpp> -#include <boost/test/detail/throw_exception.hpp> - -#include <boost/test/utils/class_properties.hpp> - -// Boost -#include <boost/shared_ptr.hpp> -#include <boost/scoped_array.hpp> -#include <boost/type.hpp> -#include <boost/cstdlib.hpp> -#include <boost/function/function0.hpp> - -#include <boost/test/detail/suppress_warnings.hpp> - -#ifdef BOOST_SEH_BASED_SIGNAL_HANDLING - -// for the FP constants and control routines -#include <float.h> - -#ifndef EM_INVALID -#define EM_INVALID _EM_INVALID -#endif - -#ifndef EM_DENORMAL -#define EM_DENORMAL _EM_DENORMAL -#endif - -#ifndef EM_ZERODIVIDE -#define EM_ZERODIVIDE _EM_ZERODIVIDE -#endif - -#ifndef EM_OVERFLOW -#define EM_OVERFLOW _EM_OVERFLOW -#endif - -#ifndef EM_UNDERFLOW -#define EM_UNDERFLOW _EM_UNDERFLOW -#endif - -#ifndef MCW_EM -#define MCW_EM _MCW_EM -#endif - -#else // based on ISO C standard - -#if !defined(BOOST_NO_FENV_H) - #include <boost/detail/fenv.hpp> -#endif - -#endif - -#if defined(BOOST_SEH_BASED_SIGNAL_HANDLING) && !defined(UNDER_CE) - //! Indicates tha the floating point exception handling is supported - //! through SEH - #define BOOST_TEST_FPE_SUPPORT_WITH_SEH__ -#elif !defined(BOOST_SEH_BASED_SIGNAL_HANDLING) && !defined(UNDER_CE) - #if !defined(BOOST_NO_FENV_H) && !defined(BOOST_CLANG) && \ - defined(__GLIBC__) && defined(__USE_GNU) && \ - !(defined(__UCLIBC__) || defined(__nios2__) || defined(__microblaze__)) - //! Indicates that floating point exception handling is supported for the - //! non SEH version of it, for the GLIBC extensions only - // see discussions on the related topic: https://svn.boost.org/trac/boost/ticket/11756 - #define BOOST_TEST_FPE_SUPPORT_WITH_GLIBC_EXTENSIONS__ - #endif -#endif - - -// Additional macro documentations not being generated without this hack -#ifdef BOOST_TEST_DOXYGEN_DOC__ - -//! Disables the support of the alternative stack -//! during the compilation of the Boost.test framework. This is especially useful -//! in case it is not possible to detect the lack of alternative stack support for -//! your compiler (for instance, ESXi). -#define BOOST_TEST_DISABLE_ALT_STACK - -#endif - -//____________________________________________________________________________// - -namespace boost { - -/// @defgroup ExecutionMonitor Function Execution Monitor -/// @{ -/// @section Intro Introduction -/// Sometimes we need to call a function and make sure that no user or system originated exceptions are being thrown by it. Uniform exception reporting -/// is also may be convenient. That's the purpose of the Boost.Test's Execution Monitor. -/// -/// The Execution Monitor is a lower-level component of the Boost Test Library. It is the base for implementing all other Boost.Test components, but also -/// can be used standalone to get controlled execution of error-prone functions with a uniform error notification. The Execution Monitor calls a user-supplied -/// function in a controlled environment, relieving users from messy error detection. -/// -/// The Execution Monitor usage is demonstrated in the example exec_mon_example. -/// -/// @section DesignRationale Design Rationale -/// -/// The Execution Monitor design assumes that it can be used when no (or almost no) memory available. Also the Execution Monitor -/// is intended to be portable to as many platforms as possible. -/// -/// @section UserGuide User's guide -/// The Execution Monitor is designed to solve the problem of executing potentially dangerous function that may result in any number of error conditions, -/// in monitored environment that should prevent any undesirable exceptions to propagate out of function call and produce consistent result report for all outcomes. -/// The Execution Monitor is able to produce informative report for all standard C++ exceptions and intrinsic types. All other exceptions are reported as unknown. -/// If you prefer different message for your exception type or need to perform any action, the Execution Monitor supports custom exception translators. -/// There are several other parameters of the monitored environment can be configured by setting appropriate properties of the Execution Monitor. -/// -/// All symbols in the Execution Monitor implementation are located in the namespace boost. To use the Execution Monitor you need to: -/// -# include @c boost/test/execution_monitor.hpp -/// -# Make an instance of execution_monitor. -/// -# Optionally register custom exception translators for exception classes which require special processing. -/// -/// @subsection FuncExec Monitored function execution -/// -/// The class execution_monitor can monitor functions with the following signatures: -/// - int () -/// - void () -/// -/// This function is expected to be self sufficient part of your application. You can't pass any arguments to this function directly. Instead you -/// should bind them into executable nullary function using bind function (either standard or boost variant). Neither you can return any other value, -/// but an integer result code. If necessary you can bind output parameters by reference or use some other more complicated nullary functor, which -/// maintains state. This includes class methods, static class methods etc. -/// -/// To start the monitored function, invoke the method execution_monitor::execute and pass the monitored function as an argument. If the call succeeds, -/// the method returns the result code produced by the monitored function. If any of the following conditions occur: -/// - Uncaught C++ exception -/// - Hardware or software signal, trap, or other exception -/// - Timeout reached -/// - Debug assert event occurred (under Microsoft Visual C++ or compatible compiler) -/// -/// then the method throws the execution_exception. The exception contains unique error_code value identifying the error condition and the detailed message -/// that can be used to report the error. -/// -/// @subsection Reporting Errors reporting and translation -/// -/// If you need to report an error inside monitored function execution you have to throw an exception. Do not use the execution_exception - it's not intended -/// to be used for this purpose. The simplest choice is to use one of the following C++ types as an exception: -/// - C string -/// - std:string -/// - any exception class in std::exception hierarchy -/// - boost::exception -/// -/// execution_monitor will catch and report these types of exceptions. If exception is thrown which is unknown to execution_monitor, it can only -/// report the fact of the exception. So in case if you prefer to use your own exception types or can't govern what exceptions are generated by monitored -/// function and would like to see proper error message in a report, execution_monitor can be configured with custom "translator" routine, which will have -/// a chance to either record the fact of the exception itself or translate it into one of standard exceptions and rethrow (or both). The translator routine -/// is registered per exception type and is invoked when exception of this class (or one inherited from it) is thrown inside monitored routine. You can -/// register as many independent translators as you like. See execution_monitor::register_exception_translator specification for requirements on translator -/// function. -/// -/// Finally, if you need to abort the monitored function execution without reporting any errors, you can throw an exception execution_aborted. As a result -/// the execution is aborted and zero result code is produced by the method execution_monitor::execute. -/// -/// @subsection Parameters Supported parameters -/// -/// The Execution Monitor behavior is configurable through the set of parameters (properties) associated with the instance of the monitor. See execution_monitor -/// specification for a list of supported parameters and their semantic. - -// ************************************************************************** // -// ************** detail::translator_holder_base ************** // -// ************************************************************************** // - -namespace detail { - -class translator_holder_base; -typedef boost::shared_ptr<translator_holder_base> translator_holder_base_ptr; - -class BOOST_TEST_DECL translator_holder_base { -protected: - typedef boost::unit_test::const_string const_string; -public: - // Constructor - translator_holder_base( translator_holder_base_ptr next, const_string tag ) - : m_next( next ) - , m_tag( std::string() + tag ) - { - } - - // Destructor - virtual ~translator_holder_base() {} - - // translator holder interface - // invokes the function F inside the try/catch guarding against specific exception - virtual int operator()( boost::function<int ()> const& F ) = 0; - - // erases specific translator holder from the chain - translator_holder_base_ptr erase( translator_holder_base_ptr this_, const_string tag ) - { - if( m_next ) - m_next = m_next->erase( m_next, tag ); - - return m_tag == tag ? m_next : this_; - } -#ifndef BOOST_NO_RTTI - virtual translator_holder_base_ptr erase( translator_holder_base_ptr this_, std::type_info const& ) = 0; - template<typename ExceptionType> - translator_holder_base_ptr erase( translator_holder_base_ptr this_, boost::type<ExceptionType>* = 0 ) - { - if( m_next ) - m_next = m_next->erase<ExceptionType>( m_next ); - - return erase( this_, typeid(ExceptionType) ); - } -#endif - -protected: - // Data members - translator_holder_base_ptr m_next; - std::string m_tag; -}; - -} // namespace detail - -// ************************************************************************** // -/// @class execution_exception -/// @brief This class is used to report any kind of an failure during execution of a monitored function inside of execution_monitor -/// -/// The instance of this class is thrown out of execution_monitor::execute invocation when failure is detected. Regardless of a kind of failure occurred -/// the instance will provide a uniform way to catch and report it. -/// -/// One important design rationale for this class is that we should be ready to work after fatal memory corruptions or out of memory conditions. To facilitate -/// this class never allocates any memory and assumes that strings it refers to are either some constants or live in a some kind of persistent (preallocated) memory. -// ************************************************************************** // - -class BOOST_SYMBOL_VISIBLE execution_exception { - typedef boost::unit_test::const_string const_string; -public: - /// These values are sometimes used as program return codes. - /// The particular values have been chosen to avoid conflicts with - /// commonly used program return codes: values < 100 are often user - /// assigned, values > 255 are sometimes used to report system errors. - /// Gaps in values allow for orderly expansion. - /// - /// @note(1) Only uncaught C++ exceptions are treated as errors. - /// If a function catches a C++ exception, it never reaches - /// the execution_monitor. - /// - /// The implementation decides what is a system_fatal_error and what is - /// just a system_exception. Fatal errors are so likely to have corrupted - /// machine state (like a stack overflow or addressing exception) that it - /// is unreasonable to continue execution. - /// - /// @note(2) These errors include Unix signals and Windows structured - /// exceptions. They are often initiated by hardware traps. - enum error_code { - no_error = 0, ///< for completeness only; never returned - user_error = 200, ///< user reported non-fatal error - cpp_exception_error = 205, ///< see note (1) above - system_error = 210, ///< see note (2) above - timeout_error = 215, ///< only detectable on certain platforms - user_fatal_error = 220, ///< user reported fatal error - system_fatal_error = 225 ///< see note (2) above - }; - - /// Simple model for the location of failure in a source code - struct BOOST_TEST_DECL location { - explicit location( char const* file_name = 0, size_t line_num = 0, char const* func = 0 ); - explicit location( const_string file_name, size_t line_num = 0, char const* func = 0 ); - - const_string m_file_name; ///< File name - size_t m_line_num; ///< Line number - const_string m_function; ///< Function name - }; - - /// @name Constructors - - /// Constructs instance based on message, location and error code - - /// @param[in] ec error code - /// @param[in] what_msg error message - /// @param[in] location error location - execution_exception( error_code ec, const_string what_msg, location const& location ); - - /// @name Access methods - - /// Exception error code - error_code code() const { return m_error_code; } - /// Exception message - const_string what() const { return m_what; } - /// Exception location - location const& where() const { return m_location; } - ///@} - -private: - // Data members - error_code m_error_code; - const_string m_what; - location m_location; -}; // execution_exception - -// ************************************************************************** // -/// @brief Function execution monitor - -/// This class is used to uniformly detect and report an occurrence of several types of signals and exceptions, reducing various -/// errors to a uniform execution_exception that is returned to a caller. -/// -/// The execution_monitor behavior can be customized through a set of public parameters (properties) associated with the execution_monitor instance. -/// All parameters are implemented as public unit_test::readwrite_property data members of the class execution_monitor. -// ************************************************************************** // - -class BOOST_TEST_DECL execution_monitor { - typedef boost::unit_test::const_string const_string; -public: - - /// Default constructor initializes all execution monitor properties - execution_monitor(); - - /// Should monitor catch system errors. - /// - /// The @em p_catch_system_errors property is a boolean flag (default value is true) specifying whether or not execution_monitor should trap system - /// errors/system level exceptions/signals, which would cause program to crash in a regular case (without execution_monitor). - /// Set this property to false, for example, if you wish to force coredump file creation. The Unit Test Framework provides a - /// runtime parameter @c \-\-catch_system_errors=yes to alter the behavior in monitored test cases. - unit_test::readwrite_property<bool> p_catch_system_errors; - - /// Should monitor try to attach debugger in case of caught system error. - /// - /// The @em p_auto_start_dbg property is a boolean flag (default value is false) specifying whether or not execution_monitor should try to attach debugger - /// in case system error is caught. - unit_test::readwrite_property<bool> p_auto_start_dbg; - - - /// Specifies the seconds that elapse before a timer_error occurs. - /// - /// The @em p_timeout property is an integer timeout (in microseconds) for monitored function execution. Use this parameter to monitor code with possible deadlocks - /// or infinite loops. This feature is only available for some operating systems (not yet Microsoft Windows). - unit_test::readwrite_property<unsigned long int> p_timeout; - - /// Should monitor use alternative stack for the signal catching. - /// - /// The @em p_use_alt_stack property is a boolean flag (default value is false) specifying whether or not execution_monitor should use an alternative stack - /// for the sigaction based signal catching. When enabled the signals are delivered to the execution_monitor on a stack different from current execution - /// stack, which is safer in case if it is corrupted by monitored function. For more details on alternative stack handling see appropriate manuals. - unit_test::readwrite_property<bool> p_use_alt_stack; - - /// Should monitor try to detect hardware floating point exceptions (!= 0), and which specific exception to catch. - /// - /// The @em p_detect_fp_exceptions property is a boolean flag (default value is false) specifying whether or not execution_monitor should install hardware - /// traps for the floating point exception on platforms where it's supported. - unit_test::readwrite_property<unsigned> p_detect_fp_exceptions; - - - // @name Monitoring entry points - - /// @brief Execution monitor entry point for functions returning integer value - /// - /// This method executes supplied function F inside a try/catch block and also may include other unspecified platform dependent error detection code. - /// - /// This method throws an execution_exception on an uncaught C++ exception, a hardware or software signal, trap, or other user exception. - /// - /// @note execute() doesn't consider it an error for F to return a non-zero value. - /// @param[in] F Function to monitor - /// @returns value returned by function call F(). - /// @see vexecute - int execute( boost::function<int ()> const& F ); - - /// @brief Execution monitor entry point for functions returning void - /// - /// This method is semantically identical to execution_monitor::execute, but doesn't produce any result code. - /// @param[in] F Function to monitor - /// @see execute - void vexecute( boost::function<void ()> const& F ); - // @} - - // @name Exception translator registration - - /// @brief Registers custom (user supplied) exception translator - - /// This method template registers a translator for an exception type specified as a first template argument. For example - /// @code - /// void myExceptTr( MyException const& ex ) { /*do something with the exception here*/} - /// em.register_exception_translator<MyException>( myExceptTr ); - /// @endcode - /// The translator should be any unary function/functor object which accepts MyException const&. This can be free standing function - /// or bound class method. The second argument is an optional string tag you can associate with this translator routine. The only reason - /// to specify the tag is if you plan to erase the translator eventually. This can be useful in scenario when you reuse the same - /// execution_monitor instance to monitor different routines and need to register a translator specific to the routine being monitored. - /// While it is possible to erase the translator based on an exception type it was registered for, tag string provides simpler way of doing this. - /// @tparam ExceptionType type of the exception we register a translator for - /// @tparam ExceptionTranslator type of the translator we register for this exception - /// @param[in] tr translator function object with the signature <em> void (ExceptionType const&)</em> - /// @param[in] tag tag associated with this translator - template<typename ExceptionType, typename ExceptionTranslator> - void register_exception_translator( ExceptionTranslator const& tr, const_string tag = const_string(), boost::type<ExceptionType>* = 0 ); - - /// @brief Erases custom exception translator based on a tag - - /// Use the same tag as the one used during translator registration - /// @param[in] tag tag associated with translator you wants to erase - void erase_exception_translator( const_string tag ) - { - m_custom_translators = m_custom_translators->erase( m_custom_translators, tag ); - } -#ifndef BOOST_NO_RTTI - /// @brief Erases custom exception translator based on an exception type - /// - /// tparam ExceptionType Exception type for which you want to erase the translator - template<typename ExceptionType> - void erase_exception_translator( boost::type<ExceptionType>* = 0 ) - { - m_custom_translators = m_custom_translators->erase<ExceptionType>( m_custom_translators ); - } - //@} -#endif - -private: - // implementation helpers - int catch_signals( boost::function<int ()> const& F ); - - // Data members - detail::translator_holder_base_ptr m_custom_translators; - boost::scoped_array<char> m_alt_stack; -}; // execution_monitor - -// ************************************************************************** // -// ************** detail::translator_holder ************** // -// ************************************************************************** // - -namespace detail { - -template<typename ExceptionType, typename ExceptionTranslator> -class translator_holder : public translator_holder_base -{ -public: - explicit translator_holder( ExceptionTranslator const& tr, translator_holder_base_ptr& next, const_string tag = const_string() ) - : translator_holder_base( next, tag ), m_translator( tr ) {} - - // translator holder interface - int operator()( boost::function<int ()> const& F ) BOOST_OVERRIDE - { - BOOST_TEST_I_TRY { - return m_next ? (*m_next)( F ) : F(); - } - BOOST_TEST_I_CATCH( ExceptionType, e ) { - m_translator( e ); - return boost::exit_exception_failure; - } - } -#ifndef BOOST_NO_RTTI - translator_holder_base_ptr erase( translator_holder_base_ptr this_, std::type_info const& ti ) BOOST_OVERRIDE - { - return ti == typeid(ExceptionType) ? m_next : this_; - } -#endif - -private: - // Data members - ExceptionTranslator m_translator; -}; - -} // namespace detail - -template<typename ExceptionType, typename ExceptionTranslator> -void -execution_monitor::register_exception_translator( ExceptionTranslator const& tr, const_string tag, boost::type<ExceptionType>* ) -{ - m_custom_translators.reset( - new detail::translator_holder<ExceptionType,ExceptionTranslator>( tr, m_custom_translators, tag ) ); -} - -// ************************************************************************** // -/// @class execution_aborted -/// @brief This is a trivial default constructible class. Use it to report graceful abortion of a monitored function execution. -// ************************************************************************** // - -struct BOOST_SYMBOL_VISIBLE execution_aborted {}; - -// ************************************************************************** // -// ************** system_error ************** // -// ************************************************************************** // - -class system_error { -public: - // Constructor - explicit system_error( char const* exp ); - - long const p_errno; - char const* const p_failed_exp; -}; - -//!@internal -#define BOOST_TEST_SYS_ASSERT( cond ) BOOST_TEST_I_ASSRT( cond, ::boost::system_error( BOOST_STRINGIZE( exp ) ) ) - -// ************************************************************************** // -// **************Floating point exception management interface ************** // -// ************************************************************************** // - -namespace fpe { - -enum masks { - BOOST_FPE_OFF = 0, - -#if defined(BOOST_TEST_FPE_SUPPORT_WITH_SEH__) /* *** */ - BOOST_FPE_DIVBYZERO = EM_ZERODIVIDE, - BOOST_FPE_INEXACT = EM_INEXACT, - BOOST_FPE_INVALID = EM_INVALID, - BOOST_FPE_OVERFLOW = EM_OVERFLOW, - BOOST_FPE_UNDERFLOW = EM_UNDERFLOW|EM_DENORMAL, - - BOOST_FPE_ALL = MCW_EM, - -#elif !defined(BOOST_TEST_FPE_SUPPORT_WITH_GLIBC_EXTENSIONS__)/* *** */ - BOOST_FPE_DIVBYZERO = BOOST_FPE_OFF, - BOOST_FPE_INEXACT = BOOST_FPE_OFF, - BOOST_FPE_INVALID = BOOST_FPE_OFF, - BOOST_FPE_OVERFLOW = BOOST_FPE_OFF, - BOOST_FPE_UNDERFLOW = BOOST_FPE_OFF, - BOOST_FPE_ALL = BOOST_FPE_OFF, -#else /* *** */ - -#if defined(FE_DIVBYZERO) - BOOST_FPE_DIVBYZERO = FE_DIVBYZERO, -#else - BOOST_FPE_DIVBYZERO = BOOST_FPE_OFF, -#endif - -#if defined(FE_INEXACT) - BOOST_FPE_INEXACT = FE_INEXACT, -#else - BOOST_FPE_INEXACT = BOOST_FPE_OFF, -#endif - -#if defined(FE_INVALID) - BOOST_FPE_INVALID = FE_INVALID, -#else - BOOST_FPE_INVALID = BOOST_FPE_OFF, -#endif - -#if defined(FE_OVERFLOW) - BOOST_FPE_OVERFLOW = FE_OVERFLOW, -#else - BOOST_FPE_OVERFLOW = BOOST_FPE_OFF, -#endif - -#if defined(FE_UNDERFLOW) - BOOST_FPE_UNDERFLOW = FE_UNDERFLOW, -#else - BOOST_FPE_UNDERFLOW = BOOST_FPE_OFF, -#endif - -#if defined(FE_ALL_EXCEPT) - BOOST_FPE_ALL = FE_ALL_EXCEPT, -#else - BOOST_FPE_ALL = BOOST_FPE_OFF, -#endif - -#endif /* *** */ - BOOST_FPE_INV = BOOST_FPE_ALL+1 -}; - -//____________________________________________________________________________// - -// return the previous set of enabled exceptions when successful, and BOOST_FPE_INV otherwise -unsigned BOOST_TEST_DECL enable( unsigned mask ); -unsigned BOOST_TEST_DECL disable( unsigned mask ); - -//____________________________________________________________________________// - -} // namespace fpe - -///@} - -} // namespace boost - - -#include <boost/test/detail/enable_warnings.hpp> - -#endif diff --git a/contrib/restricted/boost/test/include/boost/test/framework.hpp b/contrib/restricted/boost/test/include/boost/test/framework.hpp deleted file mode 100644 index 1a139e099c..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/framework.hpp +++ /dev/null @@ -1,307 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -//!@file -//!@brief Defines Unit Test Framework mono-state interfaces. -//! The framework interfaces are based on Monostate design pattern. -// *************************************************************************** - -#ifndef BOOST_TEST_FRAMEWORK_HPP_020805GER -#define BOOST_TEST_FRAMEWORK_HPP_020805GER - -// Boost.Test -#include <boost/test/detail/global_typedef.hpp> -#include <boost/test/detail/fwd_decl.hpp> -#include <boost/test/detail/throw_exception.hpp> - -#include <boost/test/detail/suppress_warnings.hpp> - -// STL -#include <stdexcept> - -//____________________________________________________________________________// - -namespace boost { - -/// Main namespace for the Unit Test Framework interfaces and implementation -namespace unit_test { - -// ************************************************************************** // -// ************** init_unit_test_func ************** // -// ************************************************************************** // - -/// Test module initialization routine signature - -/// Different depending on whether BOOST_TEST_ALTERNATIVE_INIT_API is defined or not -#ifdef BOOST_TEST_ALTERNATIVE_INIT_API -typedef bool (*init_unit_test_func)(); -#else -typedef test_suite* (*init_unit_test_func)( int, char* [] ); -#endif - -// ************************************************************************** // -// ************** framework ************** // -// ************************************************************************** // - -/// Namespace of the Unit Test Framework mono-state -namespace framework { - -/// @name Unit Test Framework initialization and shutdown -/// @{ - -/// @brief This function performs initialization of the framework mono-state. -/// -/// It needs to be called every time before the test is started. -/// @param[in] init_func test module initialization routine -/// @param[in] argc command line arguments collection -/// @param[in] argv command line arguments collection -BOOST_TEST_DECL void init( init_unit_test_func init_func, int argc, char* argv[] ); - -/// This function applies all the decorators and figures out default run status. This argument facilitates an -/// ability of the test cases to prepare some other test units (primarily used internally for self testing). -/// @param[in] tu Optional id of the test unit representing root of test tree. If absent, master test suite is used -BOOST_TEST_DECL void finalize_setup_phase( test_unit_id tu = INV_TEST_UNIT_ID); - -/// This function returns true when testing is in progress (setup is finished). -BOOST_TEST_DECL bool test_in_progress(); - -/// This function shuts down the framework and clears up its mono-state. -/// -/// It needs to be at the very end of test module execution -BOOST_TEST_DECL void shutdown(); -/// @} - -/// @name Test unit registration -/// @{ - -/// Provides both read and write access to current "leaf" auto test suite during the test unit registration phase. -/// -/// During auto-registration phase the framework maintain a FIFO queue of test units being registered. New test units become children -/// of the current "leaf" test suite and if this is test suite it is pushed back into queue and becomes a new leaf. -/// When test suite registration is completed, a test suite is popped from the back of the queue. Only automatically registered test suites -/// should be added to this queue. Master test suite is always a zero element in this queue, so if no other test suites are registered -/// all test cases are added to master test suite. - -/// This function facilitates all three possible actions: -/// - if no argument are provided it returns the current queue leaf test suite -/// - if test suite is provided and no second argument are set, test suite is added to the queue -/// - if no test suite are provided and last argument is false, the semantic of this function is similar to queue pop: last element is popped from the queue -/// @param[in] ts test suite to push back to the queue -/// @param[in] push_or_pop should we push ts to the queue or pop leaf test suite instead -/// @returns a reference to the currently active/"leaf" test suite -BOOST_TEST_DECL test_suite& current_auto_test_suite( test_suite* ts = 0, bool push_or_pop = true ); - -/// This function add new test case into the global collection of test units the framework aware of. - -/// This function also assignes unique test unit id for every test case. Later on one can use this id to locate -/// the test case if necessary. This is the way for the framework to maintain weak references between test units. -/// @param[in] tc test case to register -BOOST_TEST_DECL void register_test_unit( test_case* tc ); - -/// This function add new test suite into the global collection of test units the framework aware of. - -/// This function also assignes unique test unit id for every test suite. Later on one can use this id to locate -/// the test case if necessary. This is the way for the framework to maintain weak references between test units. -/// @param[in] ts test suite to register -BOOST_TEST_DECL void register_test_unit( test_suite* ts ); - -/// This function removes the test unit from the collection of known test units and destroys the test unit object. - -/// This function also assigns unique test unit id for every test case. Later on one can use this id to located -/// the test case if necessary. This is the way for the framework to maintain weak references between test units. -/// @param[in] tu test unit to deregister -BOOST_TEST_DECL void deregister_test_unit( test_unit* tu ); - -// This function clears up the framework mono-state. - -/// After this call the framework can be reinitialized to perform a second test run during the same program lifetime. -BOOST_TEST_DECL void clear(); -/// @} - -/// @name Test observer registration -/// @{ -/// Adds new test execution observer object into the framework's list of test observers. - -/// Observer lifetime should exceed the the testing execution timeframe -/// @param[in] to test observer object to add -BOOST_TEST_DECL void register_observer( test_observer& to ); - -/// Excludes the observer object form the framework's list of test observers -/// @param[in] to test observer object to exclude -BOOST_TEST_DECL void deregister_observer( test_observer& to ); - -/// @} - -/// @name Global fixtures registration -/// @{ - -/// Adds a new global fixture to be setup before any other tests starts and tore down after -/// any other tests finished. -/// Test unit fixture lifetime should exceed the testing execution timeframe -/// @param[in] tuf fixture to add -BOOST_TEST_DECL void register_global_fixture( global_fixture& tuf ); - -/// Removes a test global fixture from the framework -/// -/// Test unit fixture lifetime should exceed the testing execution timeframe -/// @param[in] tuf fixture to remove -BOOST_TEST_DECL void deregister_global_fixture( global_fixture& tuf ); -/// @} - -/// @name Assertion/uncaught exception context support -/// @{ -/// Context accessor -struct BOOST_TEST_DECL context_generator { - context_generator() : m_curr_frame( 0 ) {} - - /// Is there any context? - bool is_empty() const; - - /// Give me next frame; empty - last frame - const_string next() const; - -private: - // Data members - mutable unsigned m_curr_frame; -}; - -/// Records context frame message. - -/// Some context frames are sticky - they can only explicitly cleared by specifying context id. Other (non sticky) context frames cleared after every assertion. -/// @param[in] context_descr context frame message -/// @param[in] sticky is this sticky frame or not -/// @returns id of the newly created frame -BOOST_TEST_DECL int add_context( lazy_ostream const& context_descr, bool sticky ); -/// Erases context frame (when test exits context scope) - -/// If context_id is passed clears that specific context frame identified by this id, otherwise clears all non sticky contexts. -BOOST_TEST_DECL void clear_context( int context_id = -1 ); -/// Produces an instance of small "delegate" object, which facilitates access to collected context. -BOOST_TEST_DECL context_generator get_context(); -/// @} - -/// @name Access to registered test units. -/// @{ -/// This function provides access to the master test suite. - -/// There is only only master test suite per test module. -/// @returns a reference the master test suite instance -BOOST_TEST_DECL master_test_suite_t& master_test_suite(); - -/// This function provides an access to the test unit currently being executed. - -/// The difference with current_test_case is about the time between a test-suite -/// is being set up or torn down (fixtures) and when the test-cases of that suite start. - -/// This function is only valid during test execution phase. -/// @see current_test_case_id, current_test_case -BOOST_TEST_DECL test_unit const& current_test_unit(); - -/// This function provides an access to the test case currently being executed. - -/// This function is only valid during test execution phase. -/// @see current_test_case_id -BOOST_TEST_DECL test_case const& current_test_case(); - -/// This function provides an access to an id of the test case currently being executed. - -/// This function safer than current_test_case, cause if wont throw if no test case is being executed. -/// @see current_test_case -BOOST_TEST_DECL test_unit_id current_test_case_id(); /* safe version of above */ - -/// This function provides access to a test unit by id and type combination. It will throw if no test unit located. -/// @param[in] tu_id id of a test unit to locate -/// @param[in] tu_type type of a test unit to locate -/// @returns located test unit -BOOST_TEST_DECL test_unit& get( test_unit_id tu_id, test_unit_type tu_type ); - -/// This function template provides access to a typed test unit by id - -/// It will throw if you specify incorrect test unit type -/// @tparam UnitType compile time type of test unit to get (test_suite or test_case) -/// @param id id of test unit to get -template<typename UnitType> -inline UnitType& get( test_unit_id id ) -{ - return static_cast<UnitType&>( get( id, static_cast<test_unit_type>(UnitType::type) ) ); -} -///@} - -/// @name Test initiation interface -/// @{ - -/// Initiates test execution - -/// This function is used to start the test execution from a specific "root" test unit. -/// If no root provided, test is started from master test suite. This second argument facilitates an ability of the test cases to -/// start some other test units (primarily used internally for self testing). -/// @param[in] tu Optional id of the test unit or test unit itself from which the test is started. If absent, master test suite is used -/// @param[in] continue_test true == continue test if it was already started, false == restart the test from scratch regardless -BOOST_TEST_DECL void run( test_unit_id tu = INV_TEST_UNIT_ID, bool continue_test = true ); -/// Initiates test execution. Same as other overload -BOOST_TEST_DECL void run( test_unit const* tu, bool continue_test = true ); -/// @} - -/// @name Test events dispatchers -/// @{ -/// Reports results of assertion to all test observers -BOOST_TEST_DECL void assertion_result( unit_test::assertion_result ar ); -/// Reports uncaught exception to all test observers -BOOST_TEST_DECL void exception_caught( execution_exception const& ); -/// Reports aborted test unit to all test observers -BOOST_TEST_DECL void test_unit_aborted( test_unit const& ); -/// Reports aborted test module to all test observers -BOOST_TEST_DECL void test_aborted( ); -/// @} - -namespace impl { -// exclusively for self test -BOOST_TEST_DECL void setup_for_execution( test_unit const& ); -BOOST_TEST_DECL void setup_loggers( ); - -// Helper for setting the name of the master test suite globally -struct BOOST_TEST_DECL master_test_suite_name_setter { - master_test_suite_name_setter( const_string name ); -}; - -} // namespace impl - -// ************************************************************************** // -// ************** framework errors ************** // -// ************************************************************************** // - -/// This exception type is used to report internal Boost.Test framework errors. -struct BOOST_TEST_DECL internal_error : public std::runtime_error { - internal_error( const_string m ) : std::runtime_error( std::string( m.begin(), m.size() ) ) {} -}; - -//____________________________________________________________________________// - -/// This exception type is used to report test module setup errors. -struct BOOST_TEST_DECL setup_error : public std::runtime_error { - setup_error( const_string m ) : std::runtime_error( std::string( m.begin(), m.size() ) ) {} -}; - -#define BOOST_TEST_SETUP_ASSERT( cond, msg ) BOOST_TEST_I_ASSRT( cond, unit_test::framework::setup_error( msg ) ) - -//____________________________________________________________________________// - -struct nothing_to_test { - explicit nothing_to_test( int rc ) : m_result_code( rc ) {} - - int m_result_code; -}; - -//____________________________________________________________________________// - -} // namespace framework -} // unit_test -} // namespace boost - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_FRAMEWORK_HPP_020805GER diff --git a/contrib/restricted/boost/test/include/boost/test/impl/compiler_log_formatter.ipp b/contrib/restricted/boost/test/include/boost/test/impl/compiler_log_formatter.ipp deleted file mode 100644 index 4c99a9338d..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/impl/compiler_log_formatter.ipp +++ /dev/null @@ -1,293 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : implements compiler like Log formatter -// *************************************************************************** - -#ifndef BOOST_TEST_COMPILER_LOG_FORMATTER_IPP_020105GER -#define BOOST_TEST_COMPILER_LOG_FORMATTER_IPP_020105GER - -// Boost.Test -#include <boost/test/output/compiler_log_formatter.hpp> - -#include <boost/test/framework.hpp> -#include <boost/test/execution_monitor.hpp> -#include <boost/test/unit_test_parameters.hpp> - -#include <boost/test/tree/test_unit.hpp> - -#include <boost/test/utils/basic_cstring/io.hpp> -#include <boost/test/utils/lazy_ostream.hpp> - -// Boost -#include <boost/version.hpp> - -// STL -#include <iostream> - -#include <boost/test/detail/suppress_warnings.hpp> - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { -namespace output { - -// ************************************************************************** // -// ************** compiler_log_formatter ************** // -// ************************************************************************** // - -namespace { - -std::string -test_phase_identifier() -{ - return framework::test_in_progress() ? framework::current_test_unit().full_name() : std::string( "Test setup" ); -} - -} // local namespace - -//____________________________________________________________________________// - -void -compiler_log_formatter::log_start( std::ostream& output, counter_t test_cases_amount ) -{ - m_color_output = runtime_config::get<bool>( runtime_config::btrt_color_output ); - - if( test_cases_amount > 0 ) - output << "Running " << test_cases_amount << " test " - << (test_cases_amount > 1 ? "cases" : "case") << "...\n"; -} - -//____________________________________________________________________________// - -void -compiler_log_formatter::log_finish( std::ostream& ostr ) -{ - ostr.flush(); -} - -//____________________________________________________________________________// - -void -compiler_log_formatter::log_build_info( std::ostream& output, bool log_build_info ) -{ - if(log_build_info) { - output << "Platform: " << BOOST_PLATFORM << '\n' - << "Compiler: " << BOOST_COMPILER << '\n' - << "STL : " << BOOST_STDLIB << '\n' - << "Boost : " << BOOST_VERSION/100000 << "." - << BOOST_VERSION/100 % 1000 << "." - << BOOST_VERSION % 100 << std::endl; - } -} - -//____________________________________________________________________________// - -void -compiler_log_formatter::test_unit_start( std::ostream& output, test_unit const& tu ) -{ - BOOST_TEST_SCOPE_SETCOLOR( m_color_output, output, term_attr::BRIGHT, term_color::BLUE ); - - print_prefix( output, tu.p_file_name, tu.p_line_num ); - - output << "Entering test " << tu.p_type_name << " \"" << tu.p_name << "\"" << std::endl; -} - -//____________________________________________________________________________// - -void -compiler_log_formatter::test_unit_finish( std::ostream& output, test_unit const& tu, unsigned long elapsed ) -{ - BOOST_TEST_SCOPE_SETCOLOR( m_color_output, output, term_attr::BRIGHT, term_color::BLUE ); - - print_prefix( output, tu.p_file_name, tu.p_line_num ); - - output << "Leaving test " << tu.p_type_name << " \"" << tu.p_name << "\""; - - if( elapsed > 0 ) { - output << "; testing time: "; - if( elapsed % 1000 == 0 ) - output << elapsed/1000 << "ms"; - else - output << elapsed << "us"; - } - - output << std::endl; -} - -//____________________________________________________________________________// - -void -compiler_log_formatter::test_unit_skipped( std::ostream& output, test_unit const& tu, const_string reason ) -{ - BOOST_TEST_SCOPE_SETCOLOR( m_color_output, output, term_attr::BRIGHT, term_color::YELLOW ); - - print_prefix( output, tu.p_file_name, tu.p_line_num ); - - output << "Test " << tu.p_type_name << " \"" << tu.full_name() << "\"" << " is skipped because " << reason << std::endl; -} - -//____________________________________________________________________________// - -void -compiler_log_formatter::log_exception_start( std::ostream& output, log_checkpoint_data const& checkpoint_data, execution_exception const& ex ) -{ - execution_exception::location const& loc = ex.where(); - - print_prefix( output, loc.m_file_name, loc.m_line_num ); - - { - BOOST_TEST_SCOPE_SETCOLOR( m_color_output, output, term_attr::UNDERLINE, term_color::RED ); - - output << "fatal error: in \"" << (loc.m_function.is_empty() ? test_phase_identifier() : loc.m_function ) << "\": " - << ex.what(); - } - - if( !checkpoint_data.m_file_name.is_empty() ) { - output << '\n'; - print_prefix( output, checkpoint_data.m_file_name, checkpoint_data.m_line_num ); - - BOOST_TEST_SCOPE_SETCOLOR( m_color_output, output, term_attr::BRIGHT, term_color::CYAN ); - - output << "last checkpoint"; - if( !checkpoint_data.m_message.empty() ) - output << ": " << checkpoint_data.m_message; - } -} - -//____________________________________________________________________________// - -void -compiler_log_formatter::log_exception_finish( std::ostream& output ) -{ - output << std::endl; -} - -//____________________________________________________________________________// - -void -compiler_log_formatter::log_entry_start( std::ostream& output, log_entry_data const& entry_data, log_entry_types let ) -{ - using namespace utils; - - switch( let ) { - case BOOST_UTL_ET_INFO: - print_prefix( output, entry_data.m_file_name, entry_data.m_line_num ); - output << setcolor( m_color_output, term_attr::BRIGHT, term_color::GREEN, term_color::ORIGINAL, &m_color_state); - output << "info: "; - break; - case BOOST_UTL_ET_MESSAGE: - output << setcolor( m_color_output, term_attr::BRIGHT, term_color::CYAN, term_color::ORIGINAL, &m_color_state); - break; - case BOOST_UTL_ET_WARNING: - print_prefix( output, entry_data.m_file_name, entry_data.m_line_num ); - output << setcolor( m_color_output, term_attr::BRIGHT, term_color::YELLOW, term_color::ORIGINAL, &m_color_state); - output << "warning: in \"" << test_phase_identifier() << "\": "; - break; - case BOOST_UTL_ET_ERROR: - print_prefix( output, entry_data.m_file_name, entry_data.m_line_num ); - output << setcolor( m_color_output, term_attr::BRIGHT, term_color::RED, term_color::ORIGINAL, &m_color_state); - output << "error: in \"" << test_phase_identifier() << "\": "; - break; - case BOOST_UTL_ET_FATAL_ERROR: - print_prefix( output, entry_data.m_file_name, entry_data.m_line_num ); - output << setcolor( m_color_output, term_attr::UNDERLINE, term_color::RED, term_color::ORIGINAL, &m_color_state); - output << "fatal error: in \"" << test_phase_identifier() << "\": "; - break; - } -} - -//____________________________________________________________________________// - -void -compiler_log_formatter::log_entry_value( std::ostream& output, const_string value ) -{ - output << value; -} - -//____________________________________________________________________________// - -void -compiler_log_formatter::log_entry_value( std::ostream& output, lazy_ostream const& value ) -{ - output << value; -} - -//____________________________________________________________________________// - -void -compiler_log_formatter::log_entry_finish( std::ostream& output ) -{ - if( m_color_output ) - output << utils::setcolor(m_color_output, &m_color_state); - - output << std::endl; -} - - -//____________________________________________________________________________// - -void -compiler_log_formatter::print_prefix( std::ostream& output, const_string file_name, std::size_t line_num ) -{ - if( !file_name.empty() ) { -#ifdef __APPLE_CC__ - // Xcode-compatible logging format, idea by Richard Dingwall at - // <http://richarddingwall.name/2008/06/01/using-the-boost-unit-test-framework-with-xcode-3/>. - output << file_name << ':' << line_num << ": "; -#else - output << file_name << '(' << line_num << "): "; -#endif - } -} - -//____________________________________________________________________________// - -void -compiler_log_formatter::entry_context_start( std::ostream& output, log_level l ) -{ - if( l == log_messages ) { - output << "\n[context:"; - } - else { - output << (l == log_successful_tests ? "\nAssertion" : "\nFailure" ) << " occurred in a following context:"; - } -} - -//____________________________________________________________________________// - -void -compiler_log_formatter::entry_context_finish( std::ostream& output, log_level l ) -{ - if( l == log_messages ) { - output << "]"; - } - output.flush(); -} - -//____________________________________________________________________________// - -void -compiler_log_formatter::log_entry_context( std::ostream& output, log_level /*l*/, const_string context_descr ) -{ - output << "\n " << context_descr; -} - -//____________________________________________________________________________// - -} // namespace output -} // namespace unit_test -} // namespace boost - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_COMPILER_LOG_FORMATTER_IPP_020105GER diff --git a/contrib/restricted/boost/test/include/boost/test/impl/debug.ipp b/contrib/restricted/boost/test/include/boost/test/impl/debug.ipp deleted file mode 100644 index a2725d8e82..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/impl/debug.ipp +++ /dev/null @@ -1,1051 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Use, modification, and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : debug interfaces implementation -// *************************************************************************** - -#ifndef BOOST_TEST_DEBUG_API_IPP_112006GER -#define BOOST_TEST_DEBUG_API_IPP_112006GER - -// Boost.Test -#include <boost/test/detail/config.hpp> -#include <boost/test/detail/global_typedef.hpp> - -#include <boost/test/debug.hpp> -#include <boost/test/debug_config.hpp> - -#include <boost/core/ignore_unused.hpp> - -// Implementation on Windows -#if defined(_WIN32) && !defined(UNDER_CE) && !defined(BOOST_DISABLE_WIN32) // ******* WIN32 - -# define BOOST_WIN32_BASED_DEBUG - -// SYSTEM API -# include <windows.h> -# include <winreg.h> -# include <cstdio> -# include <cstring> - -# if !defined(NDEBUG) && defined(_MSC_VER) -# define BOOST_MS_CRT_BASED_DEBUG -# include <crtdbg.h> -# endif - - -# ifdef BOOST_NO_STDC_NAMESPACE -namespace std { using ::memset; using ::sprintf; } -# endif - -#elif defined(unix) || defined(__unix) // ********************* UNIX - -# define BOOST_UNIX_BASED_DEBUG - -// Boost.Test -#include <boost/test/utils/class_properties.hpp> -#include <boost/test/utils/algorithm.hpp> - -// STL -#include <cstring> // std::memcpy -#include <map> -#include <cstdio> -#include <stdarg.h> // !! ?? cstdarg - -// SYSTEM API -# include <unistd.h> -# include <signal.h> -# include <fcntl.h> - -# include <sys/types.h> -# include <sys/stat.h> -# include <sys/wait.h> -# include <sys/time.h> -# include <stdio.h> -# include <stdlib.h> - -# if defined(sun) || defined(__sun) - -# define BOOST_SUN_BASED_DEBUG - -# ifndef BOOST_TEST_DBG_LIST -# define BOOST_TEST_DBG_LIST dbx;gdb -# endif - -# define BOOST_TEST_CNL_DBG dbx -# define BOOST_TEST_GUI_DBG dbx-ddd - -# include <procfs.h> - -# elif defined(linux) || defined(__linux__) - -# define BOOST_LINUX_BASED_DEBUG - -# include <sys/ptrace.h> - -# ifndef BOOST_TEST_STAT_LINE_MAX -# define BOOST_TEST_STAT_LINE_MAX 500 -# endif - -# ifndef BOOST_TEST_DBG_LIST -# define BOOST_TEST_DBG_LIST gdb;lldb -# endif - -# define BOOST_TEST_CNL_DBG gdb -# define BOOST_TEST_GUI_DBG gdb-xterm - -# endif - -#elif defined(__APPLE__) // ********************* APPLE - -# define BOOST_APPLE_BASED_DEBUG - -# include <assert.h> -# include <sys/types.h> -# include <unistd.h> -# include <sys/sysctl.h> - -#endif - -#include <boost/test/detail/suppress_warnings.hpp> - -//____________________________________________________________________________// - -namespace boost { -namespace debug { - -using unit_test::const_string; - -// ************************************************************************** // -// ************** debug::info_t ************** // -// ************************************************************************** // - -namespace { - -#if defined(BOOST_WIN32_BASED_DEBUG) // *********************** WIN32 - -template<typename T> -inline void -dyn_symbol( T& res, char const* module_name, char const* symbol_name ) -{ - HMODULE m = ::GetModuleHandleA( module_name ); - - if( !m ) - m = ::LoadLibraryA( module_name ); - - res = reinterpret_cast<T>( ::GetProcAddress( m, symbol_name ) ); -} - -//____________________________________________________________________________// - -static struct info_t { - typedef BOOL (WINAPI* IsDebuggerPresentT)(); - typedef LONG (WINAPI* RegQueryValueExT)( HKEY, char const* /*LPTSTR*/, LPDWORD, LPDWORD, LPBYTE, LPDWORD ); - typedef LONG (WINAPI* RegOpenKeyT)( HKEY, char const* /*LPCTSTR*/, PHKEY ); - typedef LONG (WINAPI* RegCloseKeyT)( HKEY ); - - info_t(); - - IsDebuggerPresentT m_is_debugger_present; - RegOpenKeyT m_reg_open_key; - RegQueryValueExT m_reg_query_value; - RegCloseKeyT m_reg_close_key; - -} s_info; - -//____________________________________________________________________________// - -info_t::info_t() -{ - dyn_symbol( m_is_debugger_present, "kernel32", "IsDebuggerPresent" ); - dyn_symbol( m_reg_open_key, "advapi32", "RegOpenKeyA" ); - dyn_symbol( m_reg_query_value, "advapi32", "RegQueryValueExA" ); - dyn_symbol( m_reg_close_key, "advapi32", "RegCloseKey" ); -} - -//____________________________________________________________________________// - -#elif defined(BOOST_UNIX_BASED_DEBUG) - -// ************************************************************************** // -// ************** fd_holder ************** // -// ************************************************************************** // - -struct fd_holder { - explicit fd_holder( int fd ) : m_fd( fd ) {} - ~fd_holder() - { - if( m_fd != -1 ) - ::close( m_fd ); - } - - operator int() { return m_fd; } - -private: - // Data members - int m_fd; -}; - - -// ************************************************************************** // -// ************** process_info ************** // -// ************************************************************************** // - -struct process_info { - // Constructor - explicit process_info( int pid ); - - // access methods - int parent_pid() const { return m_parent_pid; } - const_string binary_name() const { return m_binary_name; } - const_string binary_path() const { return m_binary_path; } - -private: - // Data members - int m_parent_pid; - const_string m_binary_name; - const_string m_binary_path; - -#if defined(BOOST_SUN_BASED_DEBUG) - struct psinfo m_psi; - char m_binary_path_buff[500+1]; // !! ?? -#elif defined(BOOST_LINUX_BASED_DEBUG) - char m_stat_line[BOOST_TEST_STAT_LINE_MAX+1]; - char m_binary_path_buff[500+1]; // !! ?? -#endif -}; - -//____________________________________________________________________________// - -process_info::process_info( int pid ) -: m_parent_pid( 0 ) -{ -#if defined(BOOST_SUN_BASED_DEBUG) - char fname_buff[30]; - - ::snprintf( fname_buff, sizeof(fname_buff), "/proc/%d/psinfo", pid ); - - fd_holder psinfo_fd( ::open( fname_buff, O_RDONLY ) ); - - if( psinfo_fd == -1 ) - return; - - if( ::read( psinfo_fd, &m_psi, sizeof(m_psi) ) == -1 ) - return; - - m_parent_pid = m_psi.pr_ppid; - - m_binary_name.assign( m_psi.pr_fname ); - - //-------------------------- // - - ::snprintf( fname_buff, sizeof(fname_buff), "/proc/%d/as", pid ); - - fd_holder as_fd( ::open( fname_buff, O_RDONLY ) ); - uintptr_t binary_name_pos; - - // !! ?? could we avoid reading whole m_binary_path_buff? - if( as_fd == -1 || - ::lseek( as_fd, m_psi.pr_argv, SEEK_SET ) == -1 || - ::read ( as_fd, &binary_name_pos, sizeof(binary_name_pos) ) == -1 || - ::lseek( as_fd, binary_name_pos, SEEK_SET ) == -1 || - ::read ( as_fd, m_binary_path_buff, sizeof(m_binary_path_buff) ) == -1 ) - return; - - m_binary_path.assign( m_binary_path_buff ); - -#elif defined(BOOST_LINUX_BASED_DEBUG) - char fname_buff[30]; - - ::snprintf( fname_buff, sizeof(fname_buff), "/proc/%d/stat", pid ); - - fd_holder psinfo_fd( ::open( fname_buff, O_RDONLY ) ); - - if( psinfo_fd == -1 ) - return; - - ssize_t num_read = ::read( psinfo_fd, m_stat_line, sizeof(m_stat_line)-1 ); - if( num_read == -1 ) - return; - - m_stat_line[num_read] = 0; - - char const* name_beg = m_stat_line; - while( *name_beg && *name_beg != '(' ) - ++name_beg; - - char const* name_end = name_beg+1; - while( *name_end && *name_end != ')' ) - ++name_end; - - std::sscanf( name_end+1, "%*s%d", &m_parent_pid ); - - m_binary_name.assign( name_beg+1, name_end ); - - ::snprintf( fname_buff, sizeof(fname_buff), "/proc/%d/exe", pid ); - num_read = ::readlink( fname_buff, m_binary_path_buff, sizeof(m_binary_path_buff)-1 ); - - if( num_read == -1 ) - return; - - m_binary_path_buff[num_read] = 0; - m_binary_path.assign( m_binary_path_buff, num_read ); -#else - (void) pid; // silence 'unused variable' warning -#endif -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** prepare_window_title ************** // -// ************************************************************************** // - -static char* -prepare_window_title( dbg_startup_info const& dsi ) -{ - typedef unit_test::const_string str_t; - - static char title_str[50]; - - str_t path_sep( "\\/" ); - - str_t::iterator it = unit_test::utils::find_last_of( dsi.binary_path.begin(), dsi.binary_path.end(), - path_sep.begin(), path_sep.end() ); - - if( it == dsi.binary_path.end() ) - it = dsi.binary_path.begin(); - else - ++it; - - ::snprintf( title_str, sizeof(title_str), "%*s %ld", (int)(dsi.binary_path.end()-it), it, dsi.pid ); - - return title_str; -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** save_execlp ************** // -// ************************************************************************** // - -typedef unit_test::basic_cstring<char> mbuffer; - -inline char* -copy_arg( mbuffer& dest, const_string arg ) -{ - if( dest.size() < arg.size()+1 ) - return 0; - - char* res = dest.begin(); - - std::memcpy( res, arg.begin(), arg.size()+1 ); - - dest.trim_left( arg.size()+1 ); - - return res; -} - -//____________________________________________________________________________// - -bool -safe_execlp( char const* file, ... ) -{ - static char* argv_buff[200]; - - va_list args; - char const* arg; - - // first calculate actual number of arguments - int num_args = 2; // file name and 0 at least - - va_start( args, file ); - while( !!(arg = va_arg( args, char const* )) ) - num_args++; - va_end( args ); - - // reserve space for the argument pointers array - char** argv_it = argv_buff; - mbuffer work_buff( reinterpret_cast<char*>(argv_buff), sizeof(argv_buff) ); - work_buff.trim_left( num_args * sizeof(char*) ); - - // copy all the argument values into local storage - if( !(*argv_it++ = copy_arg( work_buff, file )) ) - return false; - - printf( "!! %s\n", file ); - - va_start( args, file ); - while( !!(arg = va_arg( args, char const* )) ) { - printf( "!! %s\n", arg ); - if( !(*argv_it++ = copy_arg( work_buff, arg )) ) { - va_end( args ); - return false; - } - } - va_end( args ); - - *argv_it = 0; - - return ::execvp( file, argv_buff ) != -1; -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** start_debugger_in_emacs ************** // -// ************************************************************************** // - -static void -start_debugger_in_emacs( dbg_startup_info const& dsi, char const* emacs_name, char const* dbg_command ) -{ - char const* title = prepare_window_title( dsi ); - - if( !title ) - return; - - dsi.display.is_empty() - ? safe_execlp( emacs_name, "-title", title, "--eval", dbg_command, 0 ) - : safe_execlp( emacs_name, "-title", title, "-display", dsi.display.begin(), "--eval", dbg_command, 0 ); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** gdb starters ************** // -// ************************************************************************** // - -static char const* -prepare_gdb_cmnd_file( dbg_startup_info const& dsi ) -{ - // prepare pid value - char pid_buff[16]; - ::snprintf( pid_buff, sizeof(pid_buff), "%ld", dsi.pid ); - unit_test::const_string pid_str( pid_buff ); - - static char cmd_file_name[] = "/tmp/btl_gdb_cmd_XXXXXX"; // !! ?? - - // prepare commands - const mode_t cur_umask = ::umask( S_IRWXO | S_IRWXG ); - fd_holder cmd_fd( ::mkstemp( cmd_file_name ) ); - ::umask( cur_umask ); - - if( cmd_fd == -1 ) - return 0; - -#define WRITE_STR( str ) if( ::write( cmd_fd, str.begin(), str.size() ) == -1 ) return 0; -#define WRITE_CSTR( str ) if( ::write( cmd_fd, str, sizeof( str )-1 ) == -1 ) return 0; - - WRITE_CSTR( "file " ); - WRITE_STR( dsi.binary_path ); - WRITE_CSTR( "\nattach " ); - WRITE_STR( pid_str ); - WRITE_CSTR( "\nshell unlink " ); - WRITE_STR( dsi.init_done_lock ); - WRITE_CSTR( "\ncont" ); - if( dsi.break_or_continue ) - WRITE_CSTR( "\nup 4" ); - - WRITE_CSTR( "\necho \\n" ); // !! ?? - WRITE_CSTR( "\nlist -" ); - WRITE_CSTR( "\nlist" ); - WRITE_CSTR( "\nshell unlink " ); - WRITE_CSTR( cmd_file_name ); - - return cmd_file_name; -} - -//____________________________________________________________________________// - -static void -start_gdb_in_console( dbg_startup_info const& dsi ) -{ - char const* cmnd_file_name = prepare_gdb_cmnd_file( dsi ); - - if( !cmnd_file_name ) - return; - - safe_execlp( "gdb", "-q", "-x", cmnd_file_name, 0 ); -} - -//____________________________________________________________________________// - -static void -start_gdb_in_xterm( dbg_startup_info const& dsi ) -{ - char const* title = prepare_window_title( dsi ); - char const* cmnd_file_name = prepare_gdb_cmnd_file( dsi ); - - if( !title || !cmnd_file_name ) - return; - - safe_execlp( "xterm", "-T", title, "-display", dsi.display.begin(), - "-bg", "black", "-fg", "white", "-geometry", "88x30+10+10", "-fn", "9x15", "-e", - "gdb", "-q", "-x", cmnd_file_name, 0 ); -} - -//____________________________________________________________________________// - -static void -start_gdb_in_emacs( dbg_startup_info const& dsi ) -{ - char const* cmnd_file_name = prepare_gdb_cmnd_file( dsi ); - if( !cmnd_file_name ) - return; - - char dbg_cmd_buff[500]; // !! ?? - ::snprintf( dbg_cmd_buff, sizeof(dbg_cmd_buff), "(progn (gdb \"gdb -q -x %s\"))", cmnd_file_name ); - - start_debugger_in_emacs( dsi, "emacs", dbg_cmd_buff ); -} - -//____________________________________________________________________________// - -static void -start_gdb_in_xemacs( dbg_startup_info const& ) -{ - // !! ?? -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** dbx starters ************** // -// ************************************************************************** // - -static char const* -prepare_dbx_cmd_line( dbg_startup_info const& dsi, bool list_source = true ) -{ - static char cmd_line_buff[500]; // !! ?? - - ::snprintf( cmd_line_buff, sizeof(cmd_line_buff), "unlink %s;cont;%s%s", - dsi.init_done_lock.begin(), - dsi.break_or_continue ? "up 2;": "", - list_source ? "echo \" \";list -w3;" : "" ); - - return cmd_line_buff; -} - -//____________________________________________________________________________// - -static void -start_dbx_in_console( dbg_startup_info const& dsi ) -{ - char pid_buff[16]; - ::snprintf( pid_buff, sizeof(pid_buff), "%ld", dsi.pid ); - - safe_execlp( "dbx", "-q", "-c", prepare_dbx_cmd_line( dsi ), dsi.binary_path.begin(), pid_buff, 0 ); -} - -//____________________________________________________________________________// - -static void -start_dbx_in_xterm( dbg_startup_info const& dsi ) -{ - char const* title = prepare_window_title( dsi ); - if( !title ) - return; - - char pid_buff[16]; // !! ?? - ::snprintf( pid_buff, sizeof(pid_buff), "%ld", dsi.pid ); - - safe_execlp( "xterm", "-T", title, "-display", dsi.display.begin(), - "-bg", "black", "-fg", "white", "-geometry", "88x30+10+10", "-fn", "9x15", "-e", - "dbx", "-q", "-c", prepare_dbx_cmd_line( dsi ), dsi.binary_path.begin(), pid_buff, 0 ); -} - -//____________________________________________________________________________// - -static void -start_dbx_in_emacs( dbg_startup_info const& /*dsi*/ ) -{ -// char dbg_cmd_buff[500]; // !! ?? -// -// ::snprintf( dbg_cmd_buff, sizeof(dbg_cmd_buff), "(progn (dbx \"dbx -q -c cont %s %ld\"))", dsi.binary_path.begin(), dsi.pid ); - -// start_debugger_in_emacs( dsi, "emacs", dbg_cmd_buff ); -} - -//____________________________________________________________________________// - -static void -start_dbx_in_xemacs( dbg_startup_info const& ) -{ - // !! ?? -} - -//____________________________________________________________________________// - -static void -start_dbx_in_ddd( dbg_startup_info const& dsi ) -{ - char const* title = prepare_window_title( dsi ); - if( !title ) - return; - - char pid_buff[16]; // !! ?? - ::snprintf( pid_buff, sizeof(pid_buff), "%ld", dsi.pid ); - - safe_execlp( "ddd", "-display", dsi.display.begin(), - "--dbx", "-q", "-c", prepare_dbx_cmd_line( dsi, false ), dsi.binary_path.begin(), pid_buff, 0 ); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** debug::info_t ************** // -// ************************************************************************** // - -static struct info_t { - // Constructor - info_t(); - - // Public properties - unit_test::readwrite_property<std::string> p_dbg; - - // Data members - std::map<std::string,dbg_starter> m_dbg_starter_reg; -} s_info; - -//____________________________________________________________________________// - -info_t::info_t() -{ - p_dbg.value = ::getenv( "DISPLAY" ) - ? std::string( BOOST_STRINGIZE( BOOST_TEST_GUI_DBG ) ) - : std::string( BOOST_STRINGIZE( BOOST_TEST_CNL_DBG ) ); - - m_dbg_starter_reg[std::string("gdb")] = &start_gdb_in_console; - m_dbg_starter_reg[std::string("gdb-emacs")] = &start_gdb_in_emacs; - m_dbg_starter_reg[std::string("gdb-xterm")] = &start_gdb_in_xterm; - m_dbg_starter_reg[std::string("gdb-xemacs")] = &start_gdb_in_xemacs; - - m_dbg_starter_reg[std::string("dbx")] = &start_dbx_in_console; - m_dbg_starter_reg[std::string("dbx-emacs")] = &start_dbx_in_emacs; - m_dbg_starter_reg[std::string("dbx-xterm")] = &start_dbx_in_xterm; - m_dbg_starter_reg[std::string("dbx-xemacs")] = &start_dbx_in_xemacs; - m_dbg_starter_reg[std::string("dbx-ddd")] = &start_dbx_in_ddd; -} - -//____________________________________________________________________________// - -#endif - -} // local namespace - -// ************************************************************************** // -// ************** check if program is running under debugger ************** // -// ************************************************************************** // - -bool -under_debugger() -{ -#if defined(BOOST_WIN32_BASED_DEBUG) // *********************** WIN32 - - return !!s_info.m_is_debugger_present && s_info.m_is_debugger_present(); - -#elif defined(BOOST_UNIX_BASED_DEBUG) // ********************** UNIX - - // !! ?? could/should we cache the result somehow? - const_string dbg_list = BOOST_TEST_STRINGIZE( BOOST_TEST_DBG_LIST ); - - pid_t pid = ::getpid(); - - while( pid != 0 ) { - process_info pi( pid ); - - // !! ?? should we use tokenizer here instead? - if( dbg_list.find( pi.binary_name() ) != const_string::npos ) - return true; - - pid = (pi.parent_pid() == pid ? 0 : pi.parent_pid()); - } - - return false; - -#elif defined(BOOST_APPLE_BASED_DEBUG) // ********************** APPLE - - // See https://developer.apple.com/library/mac/qa/qa1361/_index.html - int junk; - int mib[4]; - struct kinfo_proc info; - size_t size; - - // Initialize the flags so that, if sysctl fails for some bizarre - // reason, we get a predictable result. - info.kp_proc.p_flag = 0; - - // Initialize mib, which tells sysctl the info we want, in this case - // we're looking for information about a specific process ID. - mib[0] = CTL_KERN; - mib[1] = KERN_PROC; - mib[2] = KERN_PROC_PID; - mib[3] = getpid(); - - // Call sysctl. - size = sizeof(info); - junk = sysctl(mib, sizeof(mib) / sizeof(*mib), &info, &size, NULL, 0); - assert(junk == 0); - - // We're being debugged if the P_TRACED flag is set. - return ( (info.kp_proc.p_flag & P_TRACED) != 0 ); - -#else // ****************************************************** default - - return false; - -#endif -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** cause program to break execution ************** // -// ************** in debugger at call point ************** // -// ************************************************************************** // - -void -debugger_break() -{ - // !! ?? auto-start debugger? - -#if defined(BOOST_WIN32_BASED_DEBUG) // *********************** WIN32 - -#if defined(__GNUC__) && !defined(__MINGW32__) || \ - defined(__INTEL_COMPILER) || defined(BOOST_EMBTC) -# define BOOST_DEBUG_BREAK __debugbreak -#else -# define BOOST_DEBUG_BREAK DebugBreak -#endif - -#ifndef __MINGW32__ - if( !under_debugger() ) { - __try { - __try { - BOOST_DEBUG_BREAK(); - } - __except( UnhandledExceptionFilter(GetExceptionInformation()) ) - { - // User opted to ignore the breakpoint - return; - } - } - __except (EXCEPTION_EXECUTE_HANDLER) - { - // If we got here, the user has pushed Debug. Debugger is already attached to our process and we - // continue to let the another BOOST_DEBUG_BREAK to be called. - } - } -#endif - - BOOST_DEBUG_BREAK(); - -#elif defined(BOOST_UNIX_BASED_DEBUG) // ********************** UNIX - - ::kill( ::getpid(), SIGTRAP ); - -#else // ****************************************************** default - -#endif -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** console debugger setup ************** // -// ************************************************************************** // - -#if defined(BOOST_UNIX_BASED_DEBUG) // ************************ UNIX - -std::string -set_debugger( unit_test::const_string dbg_id, dbg_starter s ) -{ - std::string old = s_info.p_dbg; - - assign_op( s_info.p_dbg.value, dbg_id, 0 ); - - if( !!s ) - s_info.m_dbg_starter_reg[s_info.p_dbg.get()] = s; - - return old; -} - -#else // ***************************************************** default - -std::string -set_debugger( unit_test::const_string, dbg_starter ) -{ - return std::string(); -} - -#endif - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** attach debugger to the current process ************** // -// ************************************************************************** // - -#if defined(BOOST_WIN32_BASED_DEBUG) - -struct safe_handle_helper -{ - HANDLE& handle; - safe_handle_helper(HANDLE &handle_) : handle(handle_) {} - - void close_handle() - { - if( handle != INVALID_HANDLE_VALUE ) - { - ::CloseHandle( handle ); - handle = INVALID_HANDLE_VALUE; - } - } - - ~safe_handle_helper() - { - close_handle(); - } -}; -#endif - -bool -attach_debugger( bool break_or_continue ) -{ - if( under_debugger() ) - return false; - -#if defined(BOOST_WIN32_BASED_DEBUG) // *********************** WIN32 - - const int MAX_CMD_LINE = 200; - - // *************************************************** // - // Debugger "ready" event - - SECURITY_ATTRIBUTES attr; - attr.nLength = sizeof(attr); - attr.lpSecurityDescriptor = NULL; - attr.bInheritHandle = true; - - // manual resettable, initially non signaled, unnamed event, - // that will signal me that debugger initialization is done - HANDLE dbg_init_done_ev = ::CreateEvent( - &attr, // pointer to security attributes - true, // flag for manual-reset event - false, // flag for initial state - NULL // pointer to event-object name - ); - - if( !dbg_init_done_ev ) - return false; - - safe_handle_helper safe_handle_obj( dbg_init_done_ev ); - - // *************************************************** // - // Debugger command line format - - HKEY reg_key; - - if( !s_info.m_reg_open_key || (*s_info.m_reg_open_key)( - HKEY_LOCAL_MACHINE, // handle of open key - "Software\\Microsoft\\Windows NT\\CurrentVersion\\AeDebug", // name of subkey to open - ®_key ) != ERROR_SUCCESS ) // address of handle of open key - return false; - - char format[MAX_CMD_LINE]; - DWORD format_size = MAX_CMD_LINE; - DWORD type = REG_SZ; - - bool b_read_key = s_info.m_reg_query_value && - ((*s_info.m_reg_query_value)( - reg_key, // handle of open key - "Debugger", // name of subkey to query - 0, // reserved - &type, // value type - (LPBYTE)format, // buffer for returned string - &format_size ) == ERROR_SUCCESS ); // in: buffer size; out: actual size of returned string - - if( !s_info.m_reg_close_key || (*s_info.m_reg_close_key)( reg_key ) != ERROR_SUCCESS ) - return false; - - if( !b_read_key ) - return false; - - // *************************************************** // - // Debugger command line - - char cmd_line[MAX_CMD_LINE]; - std::sprintf( cmd_line, format, ::GetCurrentProcessId(), dbg_init_done_ev ); - - // *************************************************** // - // Debugger window parameters - - STARTUPINFOA startup_info; - std::memset( &startup_info, 0, sizeof(startup_info) ); - - startup_info.cb = sizeof(startup_info); - startup_info.dwFlags = STARTF_USESHOWWINDOW; - startup_info.wShowWindow = SW_SHOWNORMAL; - - // debugger process s_info - PROCESS_INFORMATION debugger_info; - - bool created = !!::CreateProcessA( - NULL, // pointer to name of executable module; NULL - use the one in command line - cmd_line, // pointer to command line string - NULL, // pointer to process security attributes; NULL - debugger's handle can't be inherited - NULL, // pointer to thread security attributes; NULL - debugger's handle can't be inherited - true, // debugger inherit opened handles - 0, // priority flags; 0 - normal priority - NULL, // pointer to new environment block; NULL - use this process environment - NULL, // pointer to current directory name; NULL - use this process correct directory - &startup_info, // pointer to STARTUPINFO that specifies main window appearance - &debugger_info // pointer to PROCESS_INFORMATION that will contain the new process identification - ); - - bool debugger_run_ok = false; - if( created ) - { - DWORD ret_code = ::WaitForSingleObject( dbg_init_done_ev, INFINITE ); - debugger_run_ok = ( ret_code == WAIT_OBJECT_0 ); - } - - safe_handle_obj.close_handle(); - - if( !created || !debugger_run_ok ) - return false; - - if( break_or_continue ) - debugger_break(); - - return true; - -#elif defined(BOOST_UNIX_BASED_DEBUG) // ********************** UNIX - - char init_done_lock_fn[] = "/tmp/btl_dbg_init_done_XXXXXX"; - const mode_t cur_umask = ::umask( S_IRWXO | S_IRWXG ); - fd_holder init_done_lock_fd( ::mkstemp( init_done_lock_fn ) ); - ::umask( cur_umask ); - - if( init_done_lock_fd == -1 ) - return false; - - pid_t child_pid = fork(); - - if( child_pid == -1 ) - return false; - - if( child_pid != 0 ) { // parent process - here we will start the debugger - dbg_startup_info dsi; - - process_info pi( child_pid ); - if( pi.binary_path().is_empty() ) - ::exit( -1 ); - - dsi.pid = child_pid; - dsi.break_or_continue = break_or_continue; - dsi.binary_path = pi.binary_path(); - dsi.display = ::getenv( "DISPLAY" ); - dsi.init_done_lock = init_done_lock_fn; - - dbg_starter starter = s_info.m_dbg_starter_reg[s_info.p_dbg]; - if( !!starter ) - starter( dsi ); - - ::perror( "Boost.Test execution monitor failed to start a debugger:" ); - - ::exit( -1 ); - } - - // child process - here we will continue our test module execution ; // !! ?? should it be vice versa - - while( ::access( init_done_lock_fn, F_OK ) == 0 ) { - struct timeval to = { 0, 100 }; - - ::select( 0, 0, 0, 0, &to ); - } - -// char dummy; -// while( ::read( init_done_lock_fd, &dummy, sizeof(char) ) == 0 ); - - if( break_or_continue ) - debugger_break(); - - return true; - -#else // ****************************************************** default - (void) break_or_continue; // silence 'unused variable' warning - return false; - -#endif -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** switch on/off detect memory leaks feature ************** // -// ************************************************************************** // - -void -detect_memory_leaks( bool on_off, unit_test::const_string report_file ) -{ - boost::ignore_unused( on_off ); - -#ifdef BOOST_MS_CRT_BASED_DEBUG - int flags = _CrtSetDbgFlag( _CRTDBG_REPORT_FLAG ); - - if( !on_off ) - flags &= ~_CRTDBG_LEAK_CHECK_DF; - else { - flags |= _CRTDBG_LEAK_CHECK_DF; - _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE); - - if( report_file.is_empty() ) - _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR); - else { - HANDLE hreport_f = ::CreateFileA( report_file.begin(), - GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); - _CrtSetReportFile(_CRT_WARN, hreport_f ); - } - } - - _CrtSetDbgFlag ( flags ); -#else - boost::ignore_unused( report_file ); -#endif // BOOST_MS_CRT_BASED_DEBUG -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** cause program to break execution in ************** // -// ************** debugger at specific allocation point ************** // -// ************************************************************************** // - -void -break_memory_alloc( long mem_alloc_order_num ) -{ - boost::ignore_unused( mem_alloc_order_num ); - -#ifdef BOOST_MS_CRT_BASED_DEBUG - // only set the value if one was supplied (do not use default used by UTF just as a indicator to enable leak detection) - if( mem_alloc_order_num > 1 ) - _CrtSetBreakAlloc( mem_alloc_order_num ); -#endif // BOOST_MS_CRT_BASED_DEBUG -} - -//____________________________________________________________________________// - -} // namespace debug -} // namespace boost - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_DEBUG_API_IPP_112006GER diff --git a/contrib/restricted/boost/test/include/boost/test/impl/decorator.ipp b/contrib/restricted/boost/test/include/boost/test/impl/decorator.ipp deleted file mode 100644 index 3a0ebb7061..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/impl/decorator.ipp +++ /dev/null @@ -1,244 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// Description : unit test decorators implementation -// *************************************************************************** - -#ifndef BOOST_TEST_TREE_DECORATOR_IPP_091911GER -#define BOOST_TEST_TREE_DECORATOR_IPP_091911GER - -// Boost.Test -#include <boost/test/tree/decorator.hpp> -#include <boost/test/tree/test_unit.hpp> - -#include <boost/test/framework.hpp> -#if BOOST_TEST_SUPPORT_TOKEN_ITERATOR -#include <boost/test/utils/iterator/token_iterator.hpp> -#endif - -#include <boost/test/detail/throw_exception.hpp> - -#include <boost/test/detail/suppress_warnings.hpp> - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { -namespace decorator { - -// ************************************************************************** // -// ************** decorator::collector_t ************** // -// ************************************************************************** // - -// singleton pattern -BOOST_TEST_SINGLETON_CONS_IMPL(collector_t) - - -collector_t& -collector_t::operator*( base const& d ) -{ - m_tu_decorators_stack.begin()->push_back( d.clone() ); - - return *this; -} - -//____________________________________________________________________________// - -void -collector_t::store_in( test_unit& tu ) -{ - tu.p_decorators.value.insert( - tu.p_decorators.value.end(), - m_tu_decorators_stack.begin()->begin(), - m_tu_decorators_stack.begin()->end() ); -} - -//____________________________________________________________________________// - -void -collector_t::reset() -{ - if(m_tu_decorators_stack.size() > 1) { - m_tu_decorators_stack.erase(m_tu_decorators_stack.begin()); - } - else { - assert(m_tu_decorators_stack.size() == 1); - m_tu_decorators_stack.begin()->clear(); - } -} - -void -collector_t::stack() -{ - assert(m_tu_decorators_stack.size() >= 1); - m_tu_decorators_stack.insert(m_tu_decorators_stack.begin(), std::vector<base_ptr>()); -} - -//____________________________________________________________________________// - -std::vector<base_ptr> -collector_t::get_lazy_decorators() const -{ - return *m_tu_decorators_stack.begin(); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** decorator::base ************** // -// ************************************************************************** // - -collector_t& -base::operator*() const -{ - return collector_t::instance() * *this; -} - -// ************************************************************************** // -// ************** decorator::stack_decorator ************** // -// ************************************************************************** // - -collector_t& -stack_decorator::operator*() const -{ - collector_t& instance = collector_t::instance(); - instance.stack(); - return instance * *this; -} - -void -stack_decorator::apply( test_unit& /*tu*/ ) -{ - // does nothing by definition -} - -// ************************************************************************** // -// ************** decorator::label ************** // -// ************************************************************************** // - -void -label::apply( test_unit& tu ) -{ - tu.add_label( m_label ); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** decorator::expected_failures ************** // -// ************************************************************************** // - -void -expected_failures::apply( test_unit& tu ) -{ - tu.increase_exp_fail( m_exp_fail ); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** decorator::timeout ************** // -// ************************************************************************** // - -void -timeout::apply( test_unit& tu ) -{ - tu.p_timeout.value = m_timeout; -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** decorator::description ************** // -// ************************************************************************** // - -void -description::apply( test_unit& tu ) -{ - tu.p_description.value += m_description; -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** decorator::depends_on ************** // -// ************************************************************************** // - -void -depends_on::apply( test_unit& tu ) -{ -#if !BOOST_TEST_SUPPORT_TOKEN_ITERATOR - BOOST_TEST_SETUP_ASSERT( false, "depends_on decorator is not supported on this platform" ); -#else - utils::string_token_iterator tit( m_dependency, (utils::dropped_delimeters = "/", utils::kept_delimeters = utils::dt_none) ); - - test_unit* dep = &framework::master_test_suite(); - while( tit != utils::string_token_iterator() ) { - BOOST_TEST_SETUP_ASSERT( dep->p_type == TUT_SUITE, std::string( "incorrect dependency specification " ) + m_dependency ); - - test_unit_id next_id = static_cast<test_suite*>(dep)->get( *tit ); - - BOOST_TEST_SETUP_ASSERT( next_id != INV_TEST_UNIT_ID, - std::string( "incorrect dependency specification " ) + m_dependency ); - - dep = &framework::get( next_id, TUT_ANY ); - ++tit; - } - - tu.depends_on( dep ); -#endif -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** decorator::enable_if/enabled/disabled ************** // -// ************************************************************************** // - -void -enable_if_impl::apply_impl( test_unit& tu, bool condition ) -{ - BOOST_TEST_SETUP_ASSERT(tu.p_default_status == test_unit::RS_INHERIT, - "Can't apply multiple enabled/disabled decorators " - "to the same test unit " + tu.full_name()); - - tu.p_default_status.value = condition ? test_unit::RS_ENABLED : test_unit::RS_DISABLED; -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** decorator::fixture ************** // -// ************************************************************************** // - -void -fixture_t::apply( test_unit& tu ) -{ - tu.p_fixtures.value.push_back( m_impl ); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** decorator::depends_on ************** // -// ************************************************************************** // - -void -precondition::apply( test_unit& tu ) -{ - tu.add_precondition( m_precondition ); -} - -//____________________________________________________________________________// - -} // namespace decorator -} // namespace unit_test -} // namespace boost - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_TREE_DECORATOR_IPP_091911GER diff --git a/contrib/restricted/boost/test/include/boost/test/impl/execution_monitor.ipp b/contrib/restricted/boost/test/include/boost/test/impl/execution_monitor.ipp deleted file mode 100644 index 0635db5807..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/impl/execution_monitor.ipp +++ /dev/null @@ -1,1526 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// (C) Copyright Beman Dawes and Ullrich Koethe 1995-2001. -// Use, modification, and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -/// @file -/// Provides execution monitor implementation for all supported -/// configurations, including Microsoft structured exception based, unix signals -/// based and special workarounds for borland -/// -/// Note that when testing requirements or user wishes preclude use of this -/// file as a separate compilation unit, it may be included as a header file. -/// -/// Header dependencies are deliberately restricted to reduce coupling to other -/// boost libraries. -// *************************************************************************** - -#ifndef BOOST_TEST_EXECUTION_MONITOR_IPP_012205GER -#define BOOST_TEST_EXECUTION_MONITOR_IPP_012205GER - -// Boost.Test -#include <boost/test/detail/config.hpp> -#include <boost/test/detail/throw_exception.hpp> -#include <boost/test/execution_monitor.hpp> -#include <boost/test/debug.hpp> - -// Boost -#include <boost/cstdlib.hpp> // for exit codes -#include <boost/config.hpp> // for workarounds -#include <boost/core/ignore_unused.hpp> // for ignore_unused -#ifndef BOOST_NO_EXCEPTIONS -#include <boost/exception/get_error_info.hpp> // for get_error_info -#include <boost/exception/current_exception_cast.hpp> // for current_exception_cast -#include <boost/exception/diagnostic_information.hpp> -#endif - -// STL -#include <string> // for std::string -#include <new> // for std::bad_alloc -#include <typeinfo> // for std::bad_cast, std::bad_typeid -#include <exception> // for std::exception, std::bad_exception -#include <stdexcept> // for std exception hierarchy -#include <cstring> // for C string API -#include <cassert> // for assert -#include <cstddef> // for NULL -#include <cstdio> // for vsnprintf -#include <stdio.h> -#include <cstdarg> // for varargs -#include <stdarg.h> -#include <cmath> // for ceil - -#include <iostream> // for varargs - -#ifdef BOOST_NO_STDC_NAMESPACE -namespace std { using ::strerror; using ::strlen; using ::strncat; using ::ceil; } -#endif - -// to use vsnprintf -#if defined(__SUNPRO_CC) || defined(__SunOS) || defined(__QNXNTO__) || defined(__VXWORKS__) -using std::va_list; -#endif - -#if defined(__VXWORKS__) -# define BOOST_TEST_LIMITED_SIGNAL_DETAILS -#endif - -#ifdef BOOST_SEH_BASED_SIGNAL_HANDLING - -# if !defined(_WIN32_WINNT) // WinXP -# define _WIN32_WINNT 0x0501 -# endif - -# include <windows.h> - -# if defined(__MWERKS__) || (defined(_MSC_VER) && !defined(UNDER_CE)) -# include <eh.h> -# endif - -# if defined(BOOST_BORLANDC) && BOOST_BORLANDC >= 0x560 || defined(__MWERKS__) -# include <stdint.h> -# endif - -# if defined(BOOST_BORLANDC) && BOOST_BORLANDC < 0x560 - typedef unsigned uintptr_t; -# endif - -# if defined(UNDER_CE) && BOOST_WORKAROUND(_MSC_VER, < 1500 ) - typedef void* uintptr_t; -# elif defined(UNDER_CE) -# include <crtdefs.h> -# endif - -# if !defined(NDEBUG) && defined(_MSC_VER) && !defined(UNDER_CE) -# include <crtdbg.h> -# define BOOST_TEST_CRT_HOOK_TYPE _CRT_REPORT_HOOK -# define BOOST_TEST_CRT_ASSERT _CRT_ASSERT -# define BOOST_TEST_CRT_ERROR _CRT_ERROR -# define BOOST_TEST_CRT_SET_HOOK(H) _CrtSetReportHook(H) -# else -# define BOOST_TEST_CRT_HOOK_TYPE void* -# define BOOST_TEST_CRT_ASSERT 2 -# define BOOST_TEST_CRT_ERROR 1 -# define BOOST_TEST_CRT_SET_HOOK(H) (void*)(H) -# endif - -# if defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0501) /* WinXP */ -# define BOOST_TEST_WIN32_WAITABLE_TIMERS -# endif - -# if (!BOOST_WORKAROUND(_MSC_VER, >= 1400 ) && \ - !defined(BOOST_COMO)) || defined(UNDER_CE) - -typedef void* _invalid_parameter_handler; - -inline _invalid_parameter_handler -_set_invalid_parameter_handler( _invalid_parameter_handler arg ) -{ - return arg; -} - -# endif - -# if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x0564)) || defined(UNDER_CE) - -namespace { void _set_se_translator( void* ) {} } - -# endif - -#elif defined(BOOST_HAS_SIGACTION) - -# define BOOST_SIGACTION_BASED_SIGNAL_HANDLING - -# include <unistd.h> -# include <signal.h> -# include <setjmp.h> - -# if defined(__FreeBSD__) - -# include <osreldate.h> - -# ifndef SIGPOLL -# define SIGPOLL SIGIO -# endif - -# if (__FreeBSD_version < 70100) - -# define ILL_ILLADR 0 // ILL_RESAD_FAULT -# define ILL_PRVOPC ILL_PRIVIN_FAULT -# define ILL_ILLOPN 2 // ILL_RESOP_FAULT -# define ILL_COPROC ILL_FPOP_FAULT - -# define BOOST_TEST_LIMITED_SIGNAL_DETAILS - -# endif -# endif - -# if defined(__ANDROID__) -# include <android/api-level.h> -# endif - -// documentation of BOOST_TEST_DISABLE_ALT_STACK in execution_monitor.hpp -# if !defined(__CYGWIN__) && !defined(__QNXNTO__) && !defined(__bgq__) && \ - (!defined(__ANDROID__) || __ANDROID_API__ >= 8) && !defined(__wasm__) && \ - !defined(BOOST_TEST_DISABLE_ALT_STACK) -# define BOOST_TEST_USE_ALT_STACK -# endif - -# if defined(SIGPOLL) && !defined(__CYGWIN__) && \ - !(defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)) && \ - !defined(__NetBSD__) && \ - !defined(__QNXNTO__) -# define BOOST_TEST_CATCH_SIGPOLL -# endif - -# ifdef BOOST_TEST_USE_ALT_STACK -# define BOOST_TEST_ALT_STACK_SIZE SIGSTKSZ -# endif - - -#else - -# define BOOST_NO_SIGNAL_HANDLING - -#endif - -#ifndef UNDER_CE -#include <errno.h> -#endif - -#if !defined(BOOST_NO_TYPEID) && !defined(BOOST_NO_RTTI) -# include <boost/core/demangle.hpp> -#endif - -#include <boost/test/detail/suppress_warnings.hpp> - -//____________________________________________________________________________// - -namespace boost { - -// ************************************************************************** // -// ************** throw_exception ************** // -// ************************************************************************** // - -#ifdef BOOST_NO_EXCEPTIONS -void throw_exception( std::exception const & e ) { abort(); } -#endif - -// ************************************************************************** // -// ************** report_error ************** // -// ************************************************************************** // - -namespace detail { - -#ifdef BOOST_BORLANDC -# define BOOST_TEST_VSNPRINTF( a1, a2, a3, a4 ) std::vsnprintf( (a1), (a2), (a3), (a4) ) -#elif BOOST_WORKAROUND(_MSC_VER, <= 1310) || \ - BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3000)) || \ - defined(UNDER_CE) || \ - (defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR)) -# define BOOST_TEST_VSNPRINTF( a1, a2, a3, a4 ) _vsnprintf( (a1), (a2), (a3), (a4) ) -#else -# define BOOST_TEST_VSNPRINTF( a1, a2, a3, a4 ) vsnprintf( (a1), (a2), (a3), (a4) ) -#endif - - -/* checks the printf formatting by adding a decorator to the function */ -#if __GNUC__ >= 3 || defined(BOOST_EMBTC) -#define BOOST_TEST_PRINTF_ATTRIBUTE_CHECK(x, y) __attribute__((__format__ (__printf__, x, y))) -#else -#define BOOST_TEST_PRINTF_ATTRIBUTE_CHECK(x, y) -#endif - -#ifndef BOOST_NO_EXCEPTIONS - -template <typename ErrorInfo> -typename ErrorInfo::value_type -extract( boost::exception const* ex ) -{ - if( !ex ) - return 0; - - typename ErrorInfo::value_type const * val = boost::get_error_info<ErrorInfo>( *ex ); - - return val ? *val : 0; -} - -//____________________________________________________________________________// - -static void -BOOST_TEST_PRINTF_ATTRIBUTE_CHECK(3, 0) -report_error( execution_exception::error_code ec, boost::exception const* be, char const* format, va_list* args ) -{ - static const int REPORT_ERROR_BUFFER_SIZE = 4096; - static char buf[REPORT_ERROR_BUFFER_SIZE]; - - BOOST_TEST_VSNPRINTF( buf, sizeof(buf)-1, format, *args ); - buf[sizeof(buf)-1] = 0; - - va_end( *args ); - - BOOST_TEST_I_THROW(execution_exception( ec, buf, execution_exception::location( extract<throw_file>( be ), - (size_t)extract<throw_line>( be ), - extract<throw_function>( be ) ) )); -} - -//____________________________________________________________________________// - -static void -BOOST_TEST_PRINTF_ATTRIBUTE_CHECK(3, 4) -report_error( execution_exception::error_code ec, boost::exception const* be, char const* format, ... ) -{ - va_list args; - va_start( args, format ); - - report_error( ec, be, format, &args ); -} - -#endif - -//____________________________________________________________________________// - -static void -BOOST_TEST_PRINTF_ATTRIBUTE_CHECK(2, 3) -report_error( execution_exception::error_code ec, char const* format, ... ) -{ - va_list args; - va_start( args, format ); - - report_error( ec, 0, format, &args ); -} - -//____________________________________________________________________________// - -template<typename Tr,typename Functor> -inline int -do_invoke( Tr const& tr, Functor const& F ) -{ - return tr ? (*tr)( F ) : F(); -} - -//____________________________________________________________________________// - -struct fpe_except_guard { - explicit fpe_except_guard( unsigned detect_fpe ) - : m_detect_fpe( detect_fpe ) - { - // prepare fp exceptions control - m_previously_enabled = fpe::disable( fpe::BOOST_FPE_ALL ); - if( m_previously_enabled != fpe::BOOST_FPE_INV && detect_fpe != fpe::BOOST_FPE_OFF ) - fpe::enable( detect_fpe ); - } - ~fpe_except_guard() - { - if( m_detect_fpe != fpe::BOOST_FPE_OFF ) - fpe::disable( m_detect_fpe ); - if( m_previously_enabled != fpe::BOOST_FPE_INV ) - fpe::enable( m_previously_enabled ); - } - - unsigned m_detect_fpe; - unsigned m_previously_enabled; -}; - - -// ************************************************************************** // -// ************** typeid_name ************** // -// ************************************************************************** // - -#if !defined(BOOST_NO_TYPEID) && !defined(BOOST_NO_RTTI) -template<typename T> -std::string -typeid_name( T const& t ) -{ - return boost::core::demangle(typeid(t).name()); -} -#endif - -} // namespace detail - -#if defined(BOOST_SIGACTION_BASED_SIGNAL_HANDLING) - -// ************************************************************************** // -// ************** Sigaction based signal handling ************** // -// ************************************************************************** // - -namespace detail { - -// ************************************************************************** // -// ************** boost::detail::system_signal_exception ************** // -// ************************************************************************** // - -class system_signal_exception { -public: - // Constructor - system_signal_exception() - : m_sig_info( 0 ) - , m_context( 0 ) - {} - - // Access methods - void operator()( siginfo_t* i, void* c ) - { - m_sig_info = i; - m_context = c; - } - void report() const; - -private: - // Data members - siginfo_t* m_sig_info; // system signal detailed info - void* m_context; // signal context -}; - -//____________________________________________________________________________// - -void -system_signal_exception::report() const -{ - if( !m_sig_info ) - return; // no error actually occur? - - switch( m_sig_info->si_code ) { -#ifdef __VXWORKS__ -// a bit of a hack to adapt code to small m_sig_info VxWorks uses -#define si_addr si_value.sival_int -#define si_band si_value.sival_int -#else - case SI_USER: - report_error( execution_exception::system_error, - "signal: generated by kill() (or family); uid=%d; pid=%d", - (int)m_sig_info->si_uid, (int)m_sig_info->si_pid ); - break; -#endif - case SI_QUEUE: - report_error( execution_exception::system_error, - "signal: sent by sigqueue()" ); - break; - case SI_TIMER: - report_error( execution_exception::system_error, - "signal: the expiration of a timer set by timer_settimer()" ); - break; -// OpenBSD was missing SI_ASYNCIO and SI_MESGQ -#ifdef SI_ASYNCIO - case SI_ASYNCIO: - report_error( execution_exception::system_error, - "signal: generated by the completion of an asynchronous I/O request" ); - break; -#endif -#ifdef SI_MESGQ - case SI_MESGQ: - report_error( execution_exception::system_error, - "signal: generated by the the arrival of a message on an empty message queue" ); - break; -#endif - default: - break; - } - - switch( m_sig_info->si_signo ) { - case SIGILL: - switch( m_sig_info->si_code ) { -#ifndef BOOST_TEST_LIMITED_SIGNAL_DETAILS - case ILL_ILLOPC: - report_error( execution_exception::system_fatal_error, - "signal: illegal opcode; address of failing instruction: 0x%08lx", - (unsigned long) m_sig_info->si_addr ); - break; - case ILL_ILLTRP: - report_error( execution_exception::system_fatal_error, - "signal: illegal trap; address of failing instruction: 0x%08lx", - (unsigned long) m_sig_info->si_addr ); - break; - case ILL_PRVREG: - report_error( execution_exception::system_fatal_error, - "signal: privileged register; address of failing instruction: 0x%08lx", - (unsigned long) m_sig_info->si_addr ); - break; - case ILL_BADSTK: - report_error( execution_exception::system_fatal_error, - "signal: internal stack error; address of failing instruction: 0x%08lx", - (unsigned long) m_sig_info->si_addr ); - break; -#endif - case ILL_ILLOPN: - report_error( execution_exception::system_fatal_error, - "signal: illegal operand; address of failing instruction: 0x%08lx", - (unsigned long) m_sig_info->si_addr ); - break; - case ILL_ILLADR: - report_error( execution_exception::system_fatal_error, - "signal: illegal addressing mode; address of failing instruction: 0x%08lx", - (unsigned long) m_sig_info->si_addr ); - break; - case ILL_PRVOPC: - report_error( execution_exception::system_fatal_error, - "signal: privileged opcode; address of failing instruction: 0x%08lx", - (unsigned long) m_sig_info->si_addr ); - break; - case ILL_COPROC: - report_error( execution_exception::system_fatal_error, - "signal: co-processor error; address of failing instruction: 0x%08lx", - (unsigned long) m_sig_info->si_addr ); - break; - default: - report_error( execution_exception::system_fatal_error, - "signal: SIGILL, si_code: %d (illegal instruction; address of failing instruction: 0x%08lx)", - m_sig_info->si_code, (unsigned long) m_sig_info->si_addr ); - break; - } - break; - - case SIGFPE: - switch( m_sig_info->si_code ) { - case FPE_INTDIV: - report_error( execution_exception::system_error, - "signal: integer divide by zero; address of failing instruction: 0x%08lx", - (unsigned long) m_sig_info->si_addr ); - break; - case FPE_INTOVF: - report_error( execution_exception::system_error, - "signal: integer overflow; address of failing instruction: 0x%08lx", - (unsigned long) m_sig_info->si_addr ); - break; - case FPE_FLTDIV: - report_error( execution_exception::system_error, - "signal: floating point divide by zero; address of failing instruction: 0x%08lx", - (unsigned long) m_sig_info->si_addr ); - break; - case FPE_FLTOVF: - report_error( execution_exception::system_error, - "signal: floating point overflow; address of failing instruction: 0x%08lx", - (unsigned long) m_sig_info->si_addr ); - break; - case FPE_FLTUND: - report_error( execution_exception::system_error, - "signal: floating point underflow; address of failing instruction: 0x%08lx", - (unsigned long) m_sig_info->si_addr ); - break; - case FPE_FLTRES: - report_error( execution_exception::system_error, - "signal: floating point inexact result; address of failing instruction: 0x%08lx", - (unsigned long) m_sig_info->si_addr ); - break; - case FPE_FLTINV: - report_error( execution_exception::system_error, - "signal: invalid floating point operation; address of failing instruction: 0x%08lx", - (unsigned long) m_sig_info->si_addr ); - break; - case FPE_FLTSUB: - report_error( execution_exception::system_error, - "signal: subscript out of range; address of failing instruction: 0x%08lx", - (unsigned long) m_sig_info->si_addr ); - break; - default: - report_error( execution_exception::system_error, - "signal: SIGFPE, si_code: %d (errnoneous arithmetic operations; address of failing instruction: 0x%08lx)", - m_sig_info->si_code, (unsigned long) m_sig_info->si_addr ); - break; - } - break; - - case SIGSEGV: - switch( m_sig_info->si_code ) { -#ifndef BOOST_TEST_LIMITED_SIGNAL_DETAILS - case SEGV_MAPERR: - report_error( execution_exception::system_fatal_error, - "memory access violation at address: 0x%08lx: no mapping at fault address", - (unsigned long) m_sig_info->si_addr ); - break; - case SEGV_ACCERR: - report_error( execution_exception::system_fatal_error, - "memory access violation at address: 0x%08lx: invalid permissions", - (unsigned long) m_sig_info->si_addr ); - break; -#endif - default: - report_error( execution_exception::system_fatal_error, - "signal: SIGSEGV, si_code: %d (memory access violation at address: 0x%08lx)", - m_sig_info->si_code, (unsigned long) m_sig_info->si_addr ); - break; - } - break; - - case SIGBUS: - switch( m_sig_info->si_code ) { -#ifndef BOOST_TEST_LIMITED_SIGNAL_DETAILS - case BUS_ADRALN: - report_error( execution_exception::system_fatal_error, - "memory access violation at address: 0x%08lx: invalid address alignment", - (unsigned long) m_sig_info->si_addr ); - break; - case BUS_ADRERR: - report_error( execution_exception::system_fatal_error, - "memory access violation at address: 0x%08lx: non-existent physical address", - (unsigned long) m_sig_info->si_addr ); - break; - case BUS_OBJERR: - report_error( execution_exception::system_fatal_error, - "memory access violation at address: 0x%08lx: object specific hardware error", - (unsigned long) m_sig_info->si_addr ); - break; -#endif - default: - report_error( execution_exception::system_fatal_error, - "signal: SIGSEGV, si_code: %d (memory access violation at address: 0x%08lx)", - m_sig_info->si_code, (unsigned long) m_sig_info->si_addr ); - break; - } - break; - -#if defined(BOOST_TEST_CATCH_SIGPOLL) - - case SIGPOLL: - switch( m_sig_info->si_code ) { -#ifndef BOOST_TEST_LIMITED_SIGNAL_DETAILS - case POLL_IN: - report_error( execution_exception::system_error, - "data input available; band event %d", - (int)m_sig_info->si_band ); - break; - case POLL_OUT: - report_error( execution_exception::system_error, - "output buffers available; band event %d", - (int)m_sig_info->si_band ); - break; - case POLL_MSG: - report_error( execution_exception::system_error, - "input message available; band event %d", - (int)m_sig_info->si_band ); - break; - case POLL_ERR: - report_error( execution_exception::system_error, - "i/o error; band event %d", - (int)m_sig_info->si_band ); - break; - case POLL_PRI: - report_error( execution_exception::system_error, - "high priority input available; band event %d", - (int)m_sig_info->si_band ); - break; -#if defined(POLL_ERR) && defined(POLL_HUP) && (POLL_ERR - POLL_HUP) - case POLL_HUP: - report_error( execution_exception::system_error, - "device disconnected; band event %d", - (int)m_sig_info->si_band ); - break; -#endif -#endif - default: - report_error( execution_exception::system_error, - "signal: SIGPOLL, si_code: %d (asynchronous I/O event occurred; band event %d)", - m_sig_info->si_code, (int)m_sig_info->si_band ); - break; - } - break; - -#endif - - case SIGABRT: - report_error( execution_exception::system_error, - "signal: SIGABRT (application abort requested)" ); - break; - - case SIGALRM: - report_error( execution_exception::timeout_error, - "signal: SIGALRM (timeout while executing function)" ); - break; - - default: - report_error( execution_exception::system_error, - "unrecognized signal %d", m_sig_info->si_signo ); - } -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** boost::detail::signal_action ************** // -// ************************************************************************** // - -// Forward declaration -extern "C" { -static void boost_execution_monitor_jumping_signal_handler( int sig, siginfo_t* info, void* context ); -static void boost_execution_monitor_attaching_signal_handler( int sig, siginfo_t* info, void* context ); -} - -class signal_action { - typedef struct sigaction* sigaction_ptr; -public: - //Constructor - signal_action(); - signal_action( int sig, bool install, bool attach_dbg, char* alt_stack ); - ~signal_action(); - -private: - // Data members - int m_sig; - bool m_installed; - struct sigaction m_new_action; - struct sigaction m_old_action; -}; - -//____________________________________________________________________________// - -signal_action::signal_action() -: m_installed( false ) -{} - -//____________________________________________________________________________// - -signal_action::signal_action( int sig, bool install, bool attach_dbg, char* alt_stack ) -: m_sig( sig ) -, m_installed( install ) -{ - if( !install ) - return; - - std::memset( &m_new_action, 0, sizeof(struct sigaction) ); - - BOOST_TEST_SYS_ASSERT( ::sigaction( m_sig , sigaction_ptr(), &m_new_action ) != -1 ); - - if( m_new_action.sa_sigaction || m_new_action.sa_handler ) { - m_installed = false; - return; - } - - m_new_action.sa_flags |= SA_SIGINFO; - m_new_action.sa_sigaction = attach_dbg ? &boost_execution_monitor_attaching_signal_handler - : &boost_execution_monitor_jumping_signal_handler; - BOOST_TEST_SYS_ASSERT( sigemptyset( &m_new_action.sa_mask ) != -1 ); - -#ifdef BOOST_TEST_USE_ALT_STACK - if( alt_stack ) - m_new_action.sa_flags |= SA_ONSTACK; -#endif - - BOOST_TEST_SYS_ASSERT( ::sigaction( m_sig, &m_new_action, &m_old_action ) != -1 ); -} - -//____________________________________________________________________________// - -signal_action::~signal_action() -{ - if( m_installed ) - ::sigaction( m_sig, &m_old_action , sigaction_ptr() ); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** boost::detail::signal_handler ************** // -// ************************************************************************** // - -class signal_handler { -public: - // Constructor - explicit signal_handler( bool catch_system_errors, - bool detect_fpe, - unsigned long int timeout_microseconds, - bool attach_dbg, - char* alt_stack ); - - // Destructor - ~signal_handler(); - - // access methods - static sigjmp_buf& jump_buffer() - { - assert( !!s_active_handler ); - - return s_active_handler->m_sigjmp_buf; - } - - static system_signal_exception& sys_sig() - { - assert( !!s_active_handler ); - - return s_active_handler->m_sys_sig; - } - -private: - // Data members - signal_handler* m_prev_handler; - unsigned long int m_timeout_microseconds; - - // Note: We intentionality do not catch SIGCHLD. Users have to deal with it themselves - signal_action m_ILL_action; - signal_action m_FPE_action; - signal_action m_SEGV_action; - signal_action m_BUS_action; - signal_action m_CHLD_action; - signal_action m_POLL_action; - signal_action m_ABRT_action; - signal_action m_ALRM_action; - - sigjmp_buf m_sigjmp_buf; - system_signal_exception m_sys_sig; - - static signal_handler* s_active_handler; -}; - -// !! need to be placed in thread specific storage -typedef signal_handler* signal_handler_ptr; -signal_handler* signal_handler::s_active_handler = signal_handler_ptr(); - -//____________________________________________________________________________// - -signal_handler::signal_handler( bool catch_system_errors, - bool detect_fpe, - unsigned long int timeout_microseconds, - bool attach_dbg, - char* alt_stack ) -: m_prev_handler( s_active_handler ) -, m_timeout_microseconds( timeout_microseconds ) -, m_ILL_action ( SIGILL , catch_system_errors, attach_dbg, alt_stack ) -, m_FPE_action ( SIGFPE , detect_fpe , attach_dbg, alt_stack ) -, m_SEGV_action( SIGSEGV, catch_system_errors, attach_dbg, alt_stack ) -, m_BUS_action ( SIGBUS , catch_system_errors, attach_dbg, alt_stack ) -#ifdef BOOST_TEST_CATCH_SIGPOLL -, m_POLL_action( SIGPOLL, catch_system_errors, attach_dbg, alt_stack ) -#endif -, m_ABRT_action( SIGABRT, catch_system_errors, attach_dbg, alt_stack ) -, m_ALRM_action( SIGALRM, timeout_microseconds > 0, attach_dbg, alt_stack ) -{ - s_active_handler = this; - - if( m_timeout_microseconds > 0 ) { - ::alarm( 0 ); - ::alarm( static_cast<unsigned int>(std::ceil(timeout_microseconds / 1E6) )); // alarm has a precision to the seconds - } - -#ifdef BOOST_TEST_USE_ALT_STACK - if( alt_stack ) { - stack_t sigstk; - std::memset( &sigstk, 0, sizeof(stack_t) ); - - BOOST_TEST_SYS_ASSERT( ::sigaltstack( 0, &sigstk ) != -1 ); - - if( sigstk.ss_flags & SS_DISABLE ) { - sigstk.ss_sp = alt_stack; - sigstk.ss_size = BOOST_TEST_ALT_STACK_SIZE; - sigstk.ss_flags = 0; - BOOST_TEST_SYS_ASSERT( ::sigaltstack( &sigstk, 0 ) != -1 ); - } - } -#endif -} - -//____________________________________________________________________________// - -signal_handler::~signal_handler() -{ - assert( s_active_handler == this ); - - if( m_timeout_microseconds > 0 ) - ::alarm( 0 ); - -#ifdef BOOST_TEST_USE_ALT_STACK -#ifdef __GNUC__ - // We shouldn't need to explicitly initialize all the members here, - // but gcc warns if we don't, so add initializers for each of the - // members specified in the POSIX std: - stack_t sigstk = { 0, 0, 0 }; -#else - stack_t sigstk = { }; -#endif - - sigstk.ss_size = MINSIGSTKSZ; - sigstk.ss_flags = SS_DISABLE; - if( ::sigaltstack( &sigstk, 0 ) == -1 ) { - int error_n = errno; - std::cerr << "******** errors disabling the alternate stack:" << std::endl - << "\t#error:" << error_n << std::endl - << "\t" << std::strerror( error_n ) << std::endl; - } -#endif - - s_active_handler = m_prev_handler; -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** execution_monitor_signal_handler ************** // -// ************************************************************************** // - -extern "C" { - -static void boost_execution_monitor_jumping_signal_handler( int sig, siginfo_t* info, void* context ) -{ - signal_handler::sys_sig()( info, context ); - - siglongjmp( signal_handler::jump_buffer(), sig ); -} - -//____________________________________________________________________________// - -static void boost_execution_monitor_attaching_signal_handler( int sig, siginfo_t* info, void* context ) -{ - if( !debug::attach_debugger( false ) ) - boost_execution_monitor_jumping_signal_handler( sig, info, context ); - - // debugger attached; it will handle the signal - BOOST_TEST_SYS_ASSERT( ::signal( sig, SIG_DFL ) != SIG_ERR ); -} - -//____________________________________________________________________________// - -} - -} // namespace detail - -// ************************************************************************** // -// ************** execution_monitor::catch_signals ************** // -// ************************************************************************** // - -int -execution_monitor::catch_signals( boost::function<int ()> const& F ) -{ - using namespace detail; - -#if defined(__CYGWIN__) - p_catch_system_errors.value = false; -#endif - -#ifdef BOOST_TEST_USE_ALT_STACK - if( !!p_use_alt_stack && !m_alt_stack ) - m_alt_stack.reset( new char[BOOST_TEST_ALT_STACK_SIZE] ); -#else - p_use_alt_stack.value = false; -#endif - - signal_handler local_signal_handler( p_catch_system_errors, - p_catch_system_errors || (p_detect_fp_exceptions != fpe::BOOST_FPE_OFF), - p_timeout, - p_auto_start_dbg, - !p_use_alt_stack ? 0 : m_alt_stack.get() ); - - if( !sigsetjmp( signal_handler::jump_buffer(), 1 ) ) - return detail::do_invoke( m_custom_translators , F ); - else - BOOST_TEST_I_THROW( local_signal_handler.sys_sig() ); -} - -//____________________________________________________________________________// - -#elif defined(BOOST_SEH_BASED_SIGNAL_HANDLING) - -// ************************************************************************** // -// ************** Microsoft structured exception handling ************** // -// ************************************************************************** // - -#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x0564)) -namespace { void _set_se_translator( void* ) {} } -#endif - -namespace detail { - -// ************************************************************************** // -// ************** boost::detail::system_signal_exception ************** // -// ************************************************************************** // - -class system_signal_exception { -public: - // Constructor - explicit system_signal_exception( execution_monitor* em ) - : m_em( em ) - , m_se_id( 0 ) - , m_fault_address( 0 ) - , m_dir( false ) - , m_timeout( false ) - {} - - void set_timed_out(); - void report() const; - int operator()( unsigned id, _EXCEPTION_POINTERS* exps ); - -private: - // Data members - execution_monitor* m_em; - - unsigned m_se_id; - void* m_fault_address; - bool m_dir; - bool m_timeout; -}; - -//____________________________________________________________________________// - -#if BOOST_WORKAROUND( BOOST_MSVC, <= 1310) -static void -seh_catch_preventer( unsigned /* id */, _EXCEPTION_POINTERS* /* exps */ ) -{ - throw; -} -#endif - -//____________________________________________________________________________// - -void -system_signal_exception::set_timed_out() -{ - m_timeout = true; -} - -//____________________________________________________________________________// - -int -system_signal_exception::operator()( unsigned id, _EXCEPTION_POINTERS* exps ) -{ - const unsigned MSFT_CPP_EXCEPT = 0xE06d7363; // EMSC - - // C++ exception - allow to go through - if( id == MSFT_CPP_EXCEPT ) - return EXCEPTION_CONTINUE_SEARCH; - - // FPE detection is enabled, while system exception detection is not - check if this is actually FPE - if( !m_em->p_catch_system_errors ) { - if( !m_em->p_detect_fp_exceptions ) - return EXCEPTION_CONTINUE_SEARCH; - - switch( id ) { - case EXCEPTION_FLT_DIVIDE_BY_ZERO: - case EXCEPTION_FLT_STACK_CHECK: - case EXCEPTION_FLT_DENORMAL_OPERAND: - case EXCEPTION_FLT_INEXACT_RESULT: - case EXCEPTION_FLT_OVERFLOW: - case EXCEPTION_FLT_UNDERFLOW: - case EXCEPTION_FLT_INVALID_OPERATION: - case STATUS_FLOAT_MULTIPLE_FAULTS: - case STATUS_FLOAT_MULTIPLE_TRAPS: - break; - default: - return EXCEPTION_CONTINUE_SEARCH; - } - } - - if( !!m_em->p_auto_start_dbg && debug::attach_debugger( false ) ) { - m_em->p_catch_system_errors.value = false; -#if BOOST_WORKAROUND( BOOST_MSVC, <= 1310) - _set_se_translator( &seh_catch_preventer ); -#endif - return EXCEPTION_CONTINUE_EXECUTION; - } - - m_se_id = id; - if( m_se_id == EXCEPTION_ACCESS_VIOLATION && exps->ExceptionRecord->NumberParameters == 2 ) { - m_fault_address = (void*)exps->ExceptionRecord->ExceptionInformation[1]; - m_dir = exps->ExceptionRecord->ExceptionInformation[0] == 0; - } - - return EXCEPTION_EXECUTE_HANDLER; -} - -//____________________________________________________________________________// - -void -system_signal_exception::report() const -{ - switch( m_se_id ) { - // cases classified as system_fatal_error - case EXCEPTION_ACCESS_VIOLATION: { - if( !m_fault_address ) - detail::report_error( execution_exception::system_fatal_error, "memory access violation" ); - else - detail::report_error( - execution_exception::system_fatal_error, - "memory access violation occurred at address 0x%08lx, while attempting to %s", - m_fault_address, - m_dir ? " read inaccessible data" - : " write to an inaccessible (or protected) address" - ); - break; - } - - case EXCEPTION_ILLEGAL_INSTRUCTION: - detail::report_error( execution_exception::system_fatal_error, "illegal instruction" ); - break; - - case EXCEPTION_PRIV_INSTRUCTION: - detail::report_error( execution_exception::system_fatal_error, "tried to execute an instruction whose operation is not allowed in the current machine mode" ); - break; - - case EXCEPTION_IN_PAGE_ERROR: - detail::report_error( execution_exception::system_fatal_error, "access to a memory page that is not present" ); - break; - - case EXCEPTION_STACK_OVERFLOW: - detail::report_error( execution_exception::system_fatal_error, "stack overflow" ); - break; - - case EXCEPTION_NONCONTINUABLE_EXCEPTION: - detail::report_error( execution_exception::system_fatal_error, "tried to continue execution after a non continuable exception occurred" ); - break; - - // cases classified as (non-fatal) system_trap - case EXCEPTION_DATATYPE_MISALIGNMENT: - detail::report_error( execution_exception::system_error, "data misalignment" ); - break; - - case EXCEPTION_INT_DIVIDE_BY_ZERO: - detail::report_error( execution_exception::system_error, "integer divide by zero" ); - break; - - case EXCEPTION_INT_OVERFLOW: - detail::report_error( execution_exception::system_error, "integer overflow" ); - break; - - case EXCEPTION_ARRAY_BOUNDS_EXCEEDED: - detail::report_error( execution_exception::system_error, "array bounds exceeded" ); - break; - - case EXCEPTION_FLT_DIVIDE_BY_ZERO: - detail::report_error( execution_exception::system_error, "floating point divide by zero" ); - break; - - case EXCEPTION_FLT_STACK_CHECK: - detail::report_error( execution_exception::system_error, - "stack overflowed or underflowed as the result of a floating-point operation" ); - break; - - case EXCEPTION_FLT_DENORMAL_OPERAND: - detail::report_error( execution_exception::system_error, - "operand of floating point operation is denormal" ); - break; - - case EXCEPTION_FLT_INEXACT_RESULT: - detail::report_error( execution_exception::system_error, - "result of a floating-point operation cannot be represented exactly" ); - break; - - case EXCEPTION_FLT_OVERFLOW: - detail::report_error( execution_exception::system_error, - "exponent of a floating-point operation is greater than the magnitude allowed by the corresponding type" ); - break; - - case EXCEPTION_FLT_UNDERFLOW: - detail::report_error( execution_exception::system_error, - "exponent of a floating-point operation is less than the magnitude allowed by the corresponding type" ); - break; - - case EXCEPTION_FLT_INVALID_OPERATION: - detail::report_error( execution_exception::system_error, "floating point error" ); - break; - - case STATUS_FLOAT_MULTIPLE_FAULTS: - detail::report_error( execution_exception::system_error, "multiple floating point errors" ); - break; - - case STATUS_FLOAT_MULTIPLE_TRAPS: - detail::report_error( execution_exception::system_error, "multiple floating point errors" ); - break; - - case EXCEPTION_BREAKPOINT: - detail::report_error( execution_exception::system_error, "breakpoint encountered" ); - break; - - default: - if( m_timeout ) { - detail::report_error(execution_exception::timeout_error, "timeout while executing function"); - } - else { - detail::report_error( execution_exception::system_error, "unrecognized exception. Id: 0x%08lx", m_se_id ); - } - break; - } -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** assert_reporting_function ************** // -// ************************************************************************** // - -int BOOST_TEST_CALL_DECL -assert_reporting_function( int reportType, char* userMessage, int* ) -{ - // write this way instead of switch to avoid unreachable statements - if( reportType == BOOST_TEST_CRT_ASSERT || reportType == BOOST_TEST_CRT_ERROR ) - detail::report_error( reportType == BOOST_TEST_CRT_ASSERT ? execution_exception::user_error : execution_exception::system_error, userMessage ); - - return 0; -} // assert_reporting_function - -//____________________________________________________________________________// - -void BOOST_TEST_CALL_DECL -invalid_param_handler( wchar_t const* /* expr */, - wchar_t const* /* func */, - wchar_t const* /* file */, - unsigned /* line */, - uintptr_t /* reserved */) -{ - detail::report_error( execution_exception::user_error, - "Invalid parameter detected by C runtime library" ); -} - -//____________________________________________________________________________// - -} // namespace detail - -// ************************************************************************** // -// ************** execution_monitor::catch_signals ************** // -// ************************************************************************** // - -int -execution_monitor::catch_signals( boost::function<int ()> const& F ) -{ - _invalid_parameter_handler old_iph = _invalid_parameter_handler(); - BOOST_TEST_CRT_HOOK_TYPE old_crt_hook = 0; - - if( p_catch_system_errors ) { - old_crt_hook = BOOST_TEST_CRT_SET_HOOK( &detail::assert_reporting_function ); - - old_iph = _set_invalid_parameter_handler( - reinterpret_cast<_invalid_parameter_handler>( &detail::invalid_param_handler ) ); - } else if( !p_detect_fp_exceptions ) { -#if BOOST_WORKAROUND( BOOST_MSVC, <= 1310) - _set_se_translator( &detail::seh_catch_preventer ); -#endif - } - -#if defined(BOOST_TEST_WIN32_WAITABLE_TIMERS) - HANDLE htimer = INVALID_HANDLE_VALUE; - BOOL bTimerSuccess = FALSE; - - if( p_timeout ) { - htimer = ::CreateWaitableTimer( - NULL, - TRUE, - NULL); // naming the timer might create collisions - - if( htimer != INVALID_HANDLE_VALUE ) { - LARGE_INTEGER liDueTime; - liDueTime.QuadPart = - static_cast<LONGLONG>(p_timeout) * 10ll; // resolution of 100 ns - - bTimerSuccess = ::SetWaitableTimer( - htimer, - &liDueTime, - 0, - 0, - 0, - FALSE); // Do not restore a suspended system - } - } -#endif - - detail::system_signal_exception SSE( this ); - - int ret_val = 0; - // clang windows workaround: this not available in __finally scope - bool l_catch_system_errors = p_catch_system_errors; - - __try { - __try { - ret_val = detail::do_invoke( m_custom_translators, F ); - } - __except( SSE( GetExceptionCode(), GetExceptionInformation() ) ) { - throw SSE; - } - - // we check for time outs: we do not have any signaling facility on Win32 - // however, we signal a timeout as a hard error as for the other operating systems - // and throw the signal error handler - if( bTimerSuccess && htimer != INVALID_HANDLE_VALUE) { - if (::WaitForSingleObject(htimer, 0) == WAIT_OBJECT_0) { - SSE.set_timed_out(); - throw SSE; - } - } - - } - __finally { - -#if defined(BOOST_TEST_WIN32_WAITABLE_TIMERS) - if( htimer != INVALID_HANDLE_VALUE ) { - ::CloseHandle(htimer); - } -#endif - - if( l_catch_system_errors ) { - BOOST_TEST_CRT_SET_HOOK( old_crt_hook ); - - _set_invalid_parameter_handler( old_iph ); - } - } - - return ret_val; -} - -//____________________________________________________________________________// - -#else // default signal handler - -namespace detail { - -class system_signal_exception { -public: - void report() const {} -}; - -} // namespace detail - -int -execution_monitor::catch_signals( boost::function<int ()> const& F ) -{ - return detail::do_invoke( m_custom_translators , F ); -} - -//____________________________________________________________________________// - -#endif // choose signal handler - -// ************************************************************************** // -// ************** execution_monitor ************** // -// ************************************************************************** // - -execution_monitor::execution_monitor() -: p_catch_system_errors( true ) -, p_auto_start_dbg( false ) -, p_timeout( 0 ) -, p_use_alt_stack( true ) -, p_detect_fp_exceptions( fpe::BOOST_FPE_OFF ) -{} - -//____________________________________________________________________________// - -int -execution_monitor::execute( boost::function<int ()> const& F ) -{ - if( debug::under_debugger() ) - p_catch_system_errors.value = false; - - BOOST_TEST_I_TRY { - detail::fpe_except_guard G( p_detect_fp_exceptions ); - boost::ignore_unused( G ); - - return catch_signals( F ); - } - -#ifndef BOOST_NO_EXCEPTIONS - - // Catch-clause reference arguments are a bit different from function - // arguments (ISO 15.3 paragraphs 18 & 19). Apparently const isn't - // required. Programmers ask for const anyhow, so we supply it. That's - // easier than answering questions about non-const usage. - - catch( char const* ex ) - { detail::report_error( execution_exception::cpp_exception_error, - "C string: %s", ex ); } - catch( std::string const& ex ) - { detail::report_error( execution_exception::cpp_exception_error, - "std::string: %s", ex.c_str() ); } - - // boost::exception (before std::exception, with extended diagnostic) - catch( boost::exception const& ex ) - { detail::report_error( execution_exception::cpp_exception_error, - &ex, - "%s", boost::diagnostic_information(ex).c_str() ); } - - // std:: exceptions -#if defined(BOOST_NO_TYPEID) || defined(BOOST_NO_RTTI) -#define CATCH_AND_REPORT_STD_EXCEPTION( ex_name ) \ - catch( ex_name const& ex ) \ - { detail::report_error( execution_exception::cpp_exception_error, \ - current_exception_cast<boost::exception const>(), \ - #ex_name ": %s", ex.what() ); } \ -/**/ -#else -#define CATCH_AND_REPORT_STD_EXCEPTION( ex_name ) \ - catch( ex_name const& ex ) \ - { detail::report_error( execution_exception::cpp_exception_error, \ - current_exception_cast<boost::exception const>(), \ - "%s: %s", detail::typeid_name(ex).c_str(), ex.what() ); } \ -/**/ -#endif - - CATCH_AND_REPORT_STD_EXCEPTION( std::bad_alloc ) - CATCH_AND_REPORT_STD_EXCEPTION( std::bad_cast ) - CATCH_AND_REPORT_STD_EXCEPTION( std::bad_typeid ) - CATCH_AND_REPORT_STD_EXCEPTION( std::bad_exception ) - CATCH_AND_REPORT_STD_EXCEPTION( std::domain_error ) - CATCH_AND_REPORT_STD_EXCEPTION( std::invalid_argument ) - CATCH_AND_REPORT_STD_EXCEPTION( std::length_error ) - CATCH_AND_REPORT_STD_EXCEPTION( std::out_of_range ) - CATCH_AND_REPORT_STD_EXCEPTION( std::range_error ) - CATCH_AND_REPORT_STD_EXCEPTION( std::overflow_error ) - CATCH_AND_REPORT_STD_EXCEPTION( std::underflow_error ) - CATCH_AND_REPORT_STD_EXCEPTION( std::logic_error ) - CATCH_AND_REPORT_STD_EXCEPTION( std::runtime_error ) - CATCH_AND_REPORT_STD_EXCEPTION( std::exception ) -#undef CATCH_AND_REPORT_STD_EXCEPTION - - // system errors - catch( system_error const& ex ) - { detail::report_error( execution_exception::cpp_exception_error, - "system_error produced by: %s: %s", ex.p_failed_exp, std::strerror( ex.p_errno ) ); } - catch( detail::system_signal_exception const& ex ) - { ex.report(); } - - // not an error - catch( execution_aborted const& ) - { return 0; } - - // just forward - catch( execution_exception const& ) - { throw; } - - // unknown error - catch( ... ) - { detail::report_error( execution_exception::cpp_exception_error, "unknown type" ); } - -#endif // !BOOST_NO_EXCEPTIONS - - BOOST_TEST_UNREACHABLE_RETURN(0); // never reached; supplied to quiet compiler warnings -} // execute - -//____________________________________________________________________________// - -namespace detail { - -struct forward { - explicit forward( boost::function<void ()> const& F ) : m_F( F ) {} - - int operator()() { m_F(); return 0; } - - boost::function<void ()> const& m_F; -}; - -} // namespace detail -void -execution_monitor::vexecute( boost::function<void ()> const& F ) -{ - execute( detail::forward( F ) ); -} - -// ************************************************************************** // -// ************** system_error ************** // -// ************************************************************************** // - -system_error::system_error( char const* exp ) -#ifdef UNDER_CE -: p_errno( GetLastError() ) -#else -: p_errno( errno ) -#endif -, p_failed_exp( exp ) -{} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** execution_exception ************** // -// ************************************************************************** // - -execution_exception::execution_exception( error_code ec_, const_string what_msg_, location const& location_ ) -: m_error_code( ec_ ) -, m_what( what_msg_.empty() ? BOOST_TEST_L( "uncaught exception, system error or abort requested" ) : what_msg_ ) -, m_location( location_ ) -{} - -//____________________________________________________________________________// - -execution_exception::location::location( char const* file_name, size_t line_num, char const* func ) -: m_file_name( file_name ? file_name : "unknown location" ) -, m_line_num( line_num ) -, m_function( func ) -{} - -execution_exception::location::location(const_string file_name, size_t line_num, char const* func ) -: m_file_name( file_name ) -, m_line_num( line_num ) -, m_function( func ) -{} - -//____________________________________________________________________________// - -// ************************************************************************** // -// **************Floating point exception management interface ************** // -// ************************************************************************** // - -namespace fpe { - -unsigned -enable( unsigned mask ) -{ - boost::ignore_unused(mask); -#if defined(BOOST_TEST_FPE_SUPPORT_WITH_SEH__) - _clearfp(); - -#if BOOST_WORKAROUND( BOOST_MSVC, <= 1310) - unsigned old_cw = ::_controlfp( 0, 0 ); - ::_controlfp( old_cw & ~mask, BOOST_FPE_ALL ); -#else - unsigned old_cw; - if( ::_controlfp_s( &old_cw, 0, 0 ) != 0 ) - return BOOST_FPE_INV; - - // Set the control word - if( ::_controlfp_s( 0, old_cw & ~mask, BOOST_FPE_ALL ) != 0 ) - return BOOST_FPE_INV; -#endif - return ~old_cw & BOOST_FPE_ALL; - -#elif defined(BOOST_TEST_FPE_SUPPORT_WITH_GLIBC_EXTENSIONS__) - // same macro definition as in execution_monitor.hpp - if (BOOST_FPE_ALL == BOOST_FPE_OFF) - /* Not Implemented */ - return BOOST_FPE_OFF; - feclearexcept(BOOST_FPE_ALL); - int res = feenableexcept( mask ); - return res == -1 ? (unsigned)BOOST_FPE_INV : (unsigned)res; -#else - /* Not Implemented */ - return BOOST_FPE_OFF; -#endif -} - -//____________________________________________________________________________// - -unsigned -disable( unsigned mask ) -{ - boost::ignore_unused(mask); - -#if defined(BOOST_TEST_FPE_SUPPORT_WITH_SEH__) - _clearfp(); -#if BOOST_WORKAROUND( BOOST_MSVC, <= 1310) - unsigned old_cw = ::_controlfp( 0, 0 ); - ::_controlfp( old_cw | mask, BOOST_FPE_ALL ); -#else - unsigned old_cw; - if( ::_controlfp_s( &old_cw, 0, 0 ) != 0 ) - return BOOST_FPE_INV; - - // Set the control word - if( ::_controlfp_s( 0, old_cw | mask, BOOST_FPE_ALL ) != 0 ) - return BOOST_FPE_INV; -#endif - return ~old_cw & BOOST_FPE_ALL; - -#elif defined(BOOST_TEST_FPE_SUPPORT_WITH_GLIBC_EXTENSIONS__) - if (BOOST_FPE_ALL == BOOST_FPE_OFF) - /* Not Implemented */ - return BOOST_FPE_INV; - feclearexcept(BOOST_FPE_ALL); - int res = fedisableexcept( mask ); - return res == -1 ? (unsigned)BOOST_FPE_INV : (unsigned)res; -#else - /* Not Implemented */ - return BOOST_FPE_INV; -#endif -} - -//____________________________________________________________________________// - -} // namespace fpe - -} // namespace boost - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_EXECUTION_MONITOR_IPP_012205GER diff --git a/contrib/restricted/boost/test/include/boost/test/impl/framework.ipp b/contrib/restricted/boost/test/include/boost/test/impl/framework.ipp deleted file mode 100644 index c4bfd6ac4d..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/impl/framework.ipp +++ /dev/null @@ -1,1819 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : implements framework API - main driver for the test -// *************************************************************************** - -#ifndef BOOST_TEST_FRAMEWORK_IPP_021005GER -#define BOOST_TEST_FRAMEWORK_IPP_021005GER - -// Boost.Test -#include <boost/test/framework.hpp> -#include <boost/test/execution_monitor.hpp> -#include <boost/test/debug.hpp> -#include <boost/test/unit_test_parameters.hpp> - -#include <boost/test/unit_test_log.hpp> -#include <boost/test/unit_test_log_formatter.hpp> -#include <boost/test/unit_test_monitor.hpp> -#include <boost/test/results_collector.hpp> -#include <boost/test/progress_monitor.hpp> -#include <boost/test/results_reporter.hpp> -#include <boost/test/test_framework_init_observer.hpp> - -#include <boost/test/tree/observer.hpp> -#include <boost/test/tree/test_unit.hpp> -#include <boost/test/tree/visitor.hpp> -#include <boost/test/tree/traverse.hpp> -#include <boost/test/tree/test_case_counter.hpp> -#include <boost/test/tree/global_fixture.hpp> - -#if BOOST_TEST_SUPPORT_TOKEN_ITERATOR -#include <boost/test/utils/iterator/token_iterator.hpp> -#endif - -#include <boost/test/utils/foreach.hpp> -#include <boost/test/utils/basic_cstring/io.hpp> -#include <boost/test/utils/basic_cstring/compare.hpp> - -#include <boost/test/detail/global_typedef.hpp> -#include <boost/test/detail/throw_exception.hpp> - -// Boost -#include <boost/test/utils/timer.hpp> -#include <boost/bind/bind.hpp> - -// STL -#include <limits> -#include <map> -#include <set> -#include <cstdlib> -#include <ctime> -#include <numeric> -#include <cmath> -#include <iterator> - -#ifdef BOOST_NO_STDC_NAMESPACE -namespace std { using ::time; using ::srand; } -#endif - -#include <boost/test/detail/suppress_warnings.hpp> - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { -namespace framework { - -namespace impl { - -// ************************************************************************** // -// ************** order detection helpers ************** // -// ************************************************************************** // - -struct order_info { - order_info() : depth(-1) {} - - int depth; - std::vector<test_unit_id> dependant_siblings; -}; - -typedef std::set<test_unit_id> tu_id_set; -typedef std::map<test_unit_id,order_info> order_info_per_tu; // !! ?? unordered map - -//____________________________________________________________________________// - -static test_unit_id -get_tu_parent( test_unit_id tu_id ) -{ - return framework::get( tu_id, TUT_ANY ).p_parent_id; -} - -//____________________________________________________________________________// - -static int -tu_depth( test_unit_id tu_id, test_unit_id master_tu_id, order_info_per_tu& tuoi ) -{ - if( tu_id == master_tu_id ) - return 0; - - order_info& info = tuoi[tu_id]; - - if( info.depth == -1 ) - info.depth = tu_depth( get_tu_parent( tu_id ), master_tu_id, tuoi ) + 1; - - return info.depth; -} - -//____________________________________________________________________________// - -static void -collect_dependant_siblings( test_unit_id from, test_unit_id to, test_unit_id master_tu_id, order_info_per_tu& tuoi ) -{ - int from_depth = tu_depth( from, master_tu_id, tuoi ); - int to_depth = tu_depth( to, master_tu_id, tuoi ); - - while(from_depth > to_depth) { - from = get_tu_parent( from ); - --from_depth; - } - - while(from_depth < to_depth) { - to = get_tu_parent( to ); - --to_depth; - } - - while(true) { - test_unit_id from_parent = get_tu_parent( from ); - test_unit_id to_parent = get_tu_parent( to ); - if( from_parent == to_parent ) - break; - from = from_parent; - to = to_parent; - } - - tuoi[from].dependant_siblings.push_back( to ); -} - -//____________________________________________________________________________// - -static counter_t -assign_sibling_rank( test_unit_id tu_id, order_info_per_tu& tuoi ) -{ - test_unit& tu = framework::get( tu_id, TUT_ANY ); - - BOOST_TEST_SETUP_ASSERT( tu.p_sibling_rank != (std::numeric_limits<counter_t>::max)(), - "Cyclic dependency detected involving test unit \"" + tu.full_name() + "\"" ); - - if( tu.p_sibling_rank != 0 ) - return tu.p_sibling_rank; - - order_info const& info = tuoi[tu_id]; - - // indicate in progress - tu.p_sibling_rank.value = (std::numeric_limits<counter_t>::max)(); - - counter_t new_rank = 1; - BOOST_TEST_FOREACH( test_unit_id, sibling_id, info.dependant_siblings ) - new_rank = (std::max)(new_rank, assign_sibling_rank( sibling_id, tuoi ) + 1); - - return tu.p_sibling_rank.value = new_rank; -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** test_init call wrapper ************** // -// ************************************************************************** // - -static void -invoke_init_func( init_unit_test_func init_func ) -{ -#ifdef BOOST_TEST_ALTERNATIVE_INIT_API - BOOST_TEST_I_ASSRT( (*init_func)(), std::runtime_error( "test module initialization failed" ) ); -#else - test_suite* manual_test_units = (*init_func)( framework::master_test_suite().argc, framework::master_test_suite().argv ); - - if( manual_test_units ) - framework::master_test_suite().add( manual_test_units ); -#endif -} - -// ************************************************************************** // -// ************** name_filter ************** // -// ************************************************************************** // - -class name_filter : public test_tree_visitor { - struct component { - component( const_string name ) // has to be implicit - { - if( name == "*" ) - m_kind = SFK_ALL; - else if( first_char( name ) == '*' && last_char( name ) == '*' ) { - m_kind = SFK_SUBSTR; - m_name = name.substr( 1, name.size()-1 ); - } - else if( first_char( name ) == '*' ) { - m_kind = SFK_TRAILING; - m_name = name.substr( 1 ); - } - else if( last_char( name ) == '*' ) { - m_kind = SFK_LEADING; - m_name = name.substr( 0, name.size()-1 ); - } - else { - m_kind = SFK_MATCH; - m_name = name; - } - } - - bool pass( test_unit const& tu ) const - { - const_string name( tu.p_name ); - - switch( m_kind ) { - default: - case SFK_ALL: - return true; - case SFK_LEADING: - return name.substr( 0, m_name.size() ) == m_name; - case SFK_TRAILING: - return name.size() >= m_name.size() && name.substr( name.size() - m_name.size() ) == m_name; - case SFK_SUBSTR: - return name.find( m_name ) != const_string::npos; - case SFK_MATCH: - return m_name == tu.p_name.get(); - } - } - enum kind { SFK_ALL, SFK_LEADING, SFK_TRAILING, SFK_SUBSTR, SFK_MATCH }; - - kind m_kind; - const_string m_name; - }; - -public: - // Constructor - name_filter( test_unit_id_list& targ_list, const_string filter_expr ) : m_targ_list( targ_list ), m_depth( 0 ) - { -#ifdef BOOST_TEST_SUPPORT_TOKEN_ITERATOR - utils::string_token_iterator tit( filter_expr, (utils::dropped_delimeters = "/", - utils::kept_delimeters = utils::dt_none) ); - - while( tit != utils::string_token_iterator() ) { - m_components.push_back( - std::vector<component>( utils::string_token_iterator( *tit, (utils::dropped_delimeters = ",", - utils::kept_delimeters = utils::dt_none) ), - utils::string_token_iterator() ) ); - - ++tit; - } -#endif - } - -private: - bool filter_unit( test_unit const& tu ) - { - // skip master test suite - if( m_depth == 0 ) - return true; - - // corresponding name filters are at level m_depth-1 - std::vector<component> const& filters = m_components[m_depth-1]; - - // look for match - using namespace boost::placeholders; - return std::find_if( filters.begin(), filters.end(), bind( &component::pass, _1, boost::ref(tu) ) ) != filters.end(); - } - - // test_tree_visitor interface - void visit( test_case const& tc ) BOOST_OVERRIDE - { - // make sure we only accept test cases if we match last component of the filter - if( m_depth == m_components.size() && filter_unit( tc ) ) - m_targ_list.push_back( tc.p_id ); // found a test case - } - bool test_suite_start( test_suite const& ts ) BOOST_OVERRIDE - { - if( !filter_unit( ts ) ) - return false; - - if( m_depth < m_components.size() ) { - ++m_depth; - return true; - } - - m_targ_list.push_back( ts.p_id ); // found a test suite - - return false; - } - void test_suite_finish( test_suite const& /*ts*/ ) BOOST_OVERRIDE - { - --m_depth; - } - - // Data members - typedef std::vector<std::vector<component> > components_per_level; - - components_per_level m_components; - test_unit_id_list& m_targ_list; - unsigned m_depth; -}; - -// ************************************************************************** // -// ************** label_filter ************** // -// ************************************************************************** // - -class label_filter : public test_tree_visitor { -public: - label_filter( test_unit_id_list& targ_list, const_string label ) - : m_targ_list( targ_list ) - , m_label( label ) - {} - -private: - // test_tree_visitor interface - bool visit( test_unit const& tu ) BOOST_OVERRIDE - { - if( tu.has_label( m_label ) ) { - // found a test unit; add it to list of tu to enable with children and stop recursion in case of suites - m_targ_list.push_back( tu.p_id ); - return false; - } - - return true; - } - - // Data members - test_unit_id_list& m_targ_list; - const_string m_label; -}; - -// ************************************************************************** // -// ************** set_run_status ************** // -// ************************************************************************** // - -class set_run_status : public test_tree_visitor { -public: - explicit set_run_status( test_unit::run_status rs, test_unit_id_list* dep_collector = 0 ) - : m_new_status( rs ) - , m_dep_collector( dep_collector ) - {} - - // test_tree_visitor interface - bool visit( test_unit const& tu ) BOOST_OVERRIDE - { - const_cast<test_unit&>(tu).p_run_status.value = m_new_status == test_unit::RS_INVALID ? tu.p_default_status : m_new_status; - if( m_dep_collector ) { - BOOST_TEST_FOREACH( test_unit_id, dep_id, tu.p_dependencies.get() ) { - test_unit const& dep = framework::get( dep_id, TUT_ANY ); - - if( dep.p_run_status == tu.p_run_status ) - continue; - - BOOST_TEST_FRAMEWORK_MESSAGE( "Including test " << dep.p_type_name << ' ' << dep.full_name() << - " as a dependency of test " << tu.p_type_name << ' ' << tu.full_name() ); - - m_dep_collector->push_back( dep_id ); - } - } - return true; - } - -private: - // Data members - test_unit::run_status m_new_status; - test_unit_id_list* m_dep_collector; -}; - -// ************************************************************************** // -// ************** parse_filters ************** // -// ************************************************************************** // - -static void -add_filtered_test_units( test_unit_id master_tu_id, const_string filter, test_unit_id_list& targ ) -{ - // Choose between two kinds of filters - if( filter[0] == '@' ) { - filter.trim_left( 1 ); - label_filter lf( targ, filter ); - traverse_test_tree( master_tu_id, lf, true ); - } - else { - name_filter nf( targ, filter ); - traverse_test_tree( master_tu_id, nf, true ); - } -} - -//____________________________________________________________________________// - -static bool -parse_filters( test_unit_id master_tu_id, test_unit_id_list& tu_to_enable, test_unit_id_list& tu_to_disable ) -{ - // 10. collect tu to enable and disable based on filters - bool had_selector_filter = false; - - std::vector<std::string> const& filters = runtime_config::get<std::vector<std::string> >( runtime_config::btrt_run_filters ); - - BOOST_TEST_FOREACH( const_string, filter, filters ) { - BOOST_TEST_SETUP_ASSERT( !filter.is_empty(), "Invalid filter specification" ); - - // each --run_test command may also be separated by a ':' (environment variable) - utils::string_token_iterator t_filter_it( filter, (utils::dropped_delimeters = ":", - utils::kept_delimeters = utils::dt_none) ); - - while( t_filter_it != utils::string_token_iterator() ) { - const_string filter_token = *t_filter_it; - - enum { SELECTOR, ENABLER, DISABLER } filter_type = SELECTOR; - - // 11. Deduce filter type - if( filter_token[0] == '!' || filter_token[0] == '+' ) { - filter_type = filter_token[0] == '+' ? ENABLER : DISABLER; - filter_token.trim_left( 1 ); - BOOST_TEST_SETUP_ASSERT( !filter_token.is_empty(), "Invalid filter specification" ); - } - - had_selector_filter |= filter_type == SELECTOR; - - // 12. Add test units to corresponding list - switch( filter_type ) { - case SELECTOR: - case ENABLER: add_filtered_test_units( master_tu_id, filter_token, tu_to_enable ); break; - case DISABLER: add_filtered_test_units( master_tu_id, filter_token, tu_to_disable ); break; - } - - ++t_filter_it; - } - } - - return had_selector_filter; -} - -//____________________________________________________________________________// - -// a poor man's implementation of random_shuffle, deprecated in C++11 -template< class RandomIt, class RandomFunc > -void random_shuffle( RandomIt first, RandomIt last, RandomFunc &r ) -{ - typedef typename std::iterator_traits<RandomIt>::difference_type difference_type; - difference_type n = last - first; - for (difference_type i = n-1; i > 0; --i) { - difference_type j = r(i+1); - if (j != i) { - using std::swap; - swap(first[i], first[j]); - } - } -} - -// A simple handle for registering the global fixtures to the master test suite -// without deleting an existing static object (the global fixture itself) when the program -// terminates (shared_ptr). -class global_fixture_handle : public test_unit_fixture { -public: - global_fixture_handle(test_unit_fixture* fixture) : m_global_fixture(fixture) {} - ~global_fixture_handle() BOOST_OVERRIDE {} - - void setup() BOOST_OVERRIDE { - m_global_fixture->setup(); - } - void teardown() BOOST_OVERRIDE { - m_global_fixture->teardown(); - } - -private: - test_unit_fixture* m_global_fixture; -}; - - -} // namespace impl - -// ************************************************************************** // -// ************** framework::state ************** // -// ************************************************************************** // - -unsigned long int const TIMEOUT_EXCEEDED = static_cast<unsigned long int>( -1 ); - -class state { -public: - state() - : m_master_test_suite( 0 ) - , m_curr_test_unit( INV_TEST_UNIT_ID ) - , m_next_test_case_id( MIN_TEST_CASE_ID ) - , m_next_test_suite_id( MIN_TEST_SUITE_ID ) - , m_test_in_progress( false ) - , m_context_idx( 0 ) - , m_log_sinks( ) - , m_report_sink( std::cerr ) - { - } - - ~state() { clear(); } - - void clear() - { - while( !m_test_units.empty() ) { - test_unit_store::value_type const& tu = *m_test_units.begin(); - test_unit const* tu_ptr = tu.second; - - // the delete will erase this element from map - if( ut_detail::test_id_2_unit_type( tu.second->p_id ) == TUT_SUITE ) - delete static_cast<test_suite const*>(tu_ptr); - else - delete static_cast<test_case const*>(tu_ptr); - } - } - - void set_tu_id( test_unit& tu, test_unit_id id ) { tu.p_id.value = id; } - - ////////////////////////////////////////////////////////////////// - - // Validates the dependency graph and deduces the sibling dependency rank for each child - void deduce_siblings_order( test_unit_id tu_id, test_unit_id master_tu_id, impl::order_info_per_tu& tuoi ) - { - test_unit& tu = framework::get( tu_id, TUT_ANY ); - - // collect all sibling dependencies from tu own list - BOOST_TEST_FOREACH( test_unit_id, dep_id, tu.p_dependencies.get() ) - collect_dependant_siblings( tu_id, dep_id, master_tu_id, tuoi ); - - if( tu.p_type != TUT_SUITE ) - return; - - test_suite& ts = static_cast<test_suite&>(tu); - - // recursive call to children first - BOOST_TEST_FOREACH( test_unit_id, chld_id, ts.m_children ) - deduce_siblings_order( chld_id, master_tu_id, tuoi ); - - ts.m_ranked_children.clear(); - BOOST_TEST_FOREACH( test_unit_id, chld_id, ts.m_children ) { - counter_t rank = assign_sibling_rank( chld_id, tuoi ); - ts.m_ranked_children.insert( std::make_pair( rank, chld_id ) ); - } - } - - ////////////////////////////////////////////////////////////////// - - // Finalize default run status: - // 1) inherit run status from parent where applicable - // 2) if any of test units in test suite enabled enable it as well - bool finalize_default_run_status( test_unit_id tu_id, test_unit::run_status parent_status ) - { - test_unit& tu = framework::get( tu_id, TUT_ANY ); - - if( tu.p_default_status == test_suite::RS_INHERIT ) - tu.p_default_status.value = parent_status; - - // go through list of children - if( tu.p_type == TUT_SUITE ) { - bool has_enabled_child = false; - BOOST_TEST_FOREACH( test_unit_id, chld_id, static_cast<test_suite const&>(tu).m_children ) - has_enabled_child |= finalize_default_run_status( chld_id, tu.p_default_status ); - - tu.p_default_status.value = has_enabled_child ? test_suite::RS_ENABLED : test_suite::RS_DISABLED; - } - - return tu.p_default_status == test_suite::RS_ENABLED; - } - - ////////////////////////////////////////////////////////////////// - - bool finalize_run_status( test_unit_id tu_id ) - { - test_unit& tu = framework::get( tu_id, TUT_ANY ); - - // go through list of children - if( tu.p_type == TUT_SUITE ) { - bool has_enabled_child = false; - BOOST_TEST_FOREACH( test_unit_id, chld_id, static_cast<test_suite const&>(tu).m_children) - has_enabled_child |= finalize_run_status( chld_id ); - - tu.p_run_status.value = has_enabled_child ? test_suite::RS_ENABLED : test_suite::RS_DISABLED; - } - - return tu.is_enabled(); - } - - ////////////////////////////////////////////////////////////////// - - void deduce_run_status( test_unit_id master_tu_id ) - { - using namespace framework::impl; - test_unit_id_list tu_to_enable; - test_unit_id_list tu_to_disable; - - // 10. If there are any filters supplied, figure out lists of test units to enable/disable - bool had_selector_filter = !runtime_config::get<std::vector<std::string> >( runtime_config::btrt_run_filters ).empty() && - parse_filters( master_tu_id, tu_to_enable, tu_to_disable ); - - // 20. Set the stage: either use default run status or disable all test units - set_run_status initial_setter( had_selector_filter ? test_unit::RS_DISABLED : test_unit::RS_INVALID ); - traverse_test_tree( master_tu_id, initial_setter, true ); - - // 30. Apply all selectors and enablers. - while( !tu_to_enable.empty() ) { - test_unit& tu = framework::get( tu_to_enable.back(), TUT_ANY ); - - tu_to_enable.pop_back(); - - // 35. Ignore test units which are already enabled - if( tu.is_enabled() ) - continue; - - // set new status and add all dependencies into tu_to_enable - set_run_status enabler( test_unit::RS_ENABLED, &tu_to_enable ); - traverse_test_tree( tu.p_id, enabler, true ); - - // Add the dependencies of the parent suites, see trac #13149 - test_unit_id parent_id = tu.p_parent_id; - while( parent_id != INV_TEST_UNIT_ID - && parent_id != master_tu_id ) - { - // we do not use the traverse_test_tree as otherwise it would enable the siblings and subtree - // of the test case we want to enable (we need to enable the parent suites and their dependencies only) - // the parent_id needs to be enabled in order to be properly parsed by finalize_run_status, the visit - // does the job - test_unit& tu_parent = framework::get( parent_id, TUT_ANY ); - enabler.visit( tu_parent ); - parent_id = tu_parent.p_parent_id; - } - } - - // 40. Apply all disablers - while( !tu_to_disable.empty() ) { - test_unit const& tu = framework::get( tu_to_disable.back(), TUT_ANY ); - - tu_to_disable.pop_back(); - - // 35. Ignore test units which already disabled - if( !tu.is_enabled() ) - continue; - - set_run_status disabler( test_unit::RS_DISABLED ); - traverse_test_tree( tu.p_id, disabler, true ); - } - - // 50. Make sure parents of enabled test units are also enabled - finalize_run_status( master_tu_id ); - } - - ////////////////////////////////////////////////////////////////// - - typedef unit_test_monitor_t::error_level execution_result; - - // Random generator using the std::rand function (seeded prior to the call) - struct random_generator_helper { - size_t operator()(size_t i) const { - return std::rand() % i; - } - }; - - // Executes the test tree with the root at specified test unit - execution_result execute_test_tree( test_unit_id tu_id, - unsigned long int timeout_microseconds = 0, - random_generator_helper const * const p_random_generator = 0) - { - test_unit const& tu = framework::get( tu_id, TUT_ANY ); - - execution_result result = unit_test_monitor_t::test_ok; - - if( !tu.is_enabled() ) { - BOOST_TEST_FOREACH( test_observer*, to, m_observers ) - to->test_unit_skipped( tu, "disabled" ); - return result; - } - - // 10. Check preconditions, including zero time left for execution and - // successful execution of all dependencies - if( timeout_microseconds == TIMEOUT_EXCEEDED ) { - // notify all observers about skipped test unit - BOOST_TEST_FOREACH( test_observer*, to, m_observers ) - to->test_unit_skipped( tu, "timeout for the test unit is exceeded" ); - - return unit_test_monitor_t::os_timeout; - } - else if( timeout_microseconds == 0 || (tu.p_timeout > 0 && timeout_microseconds > (tu.p_timeout * 1000000) ) ) // deduce timeout for this test unit - timeout_microseconds = tu.p_timeout * 1000000; - - - test_tools::assertion_result const precondition_res = tu.check_preconditions(); - if( !precondition_res ) { - // notify all observers about skipped test unit - BOOST_TEST_FOREACH( test_observer*, to, m_observers ) - to->test_unit_skipped( tu, precondition_res.message() ); - - // It is not an error to skip the test if any of the parent tests - // have failed. This one should be reported as skipped as if it was - // disabled - return unit_test_monitor_t::test_ok; - } - - // 20. Notify all observers about the start of the test unit - BOOST_TEST_FOREACH( test_observer*, to, m_observers ) - to->test_unit_start( tu ); - - // 30. Execute setup fixtures if any; any failure here leads to test unit abortion - BOOST_TEST_FOREACH( test_unit_fixture_ptr, F, tu.p_fixtures.get() ) { - ut_detail::test_unit_id_restore restore_current_test_unit(m_curr_test_unit, tu.p_id); - result = unit_test_monitor.execute_and_translate( boost::bind( &test_unit_fixture::setup, F ) ); - if( result != unit_test_monitor_t::test_ok ) - break; - test_results const& test_rslt = unit_test::results_collector.results( m_curr_test_unit ); - if( test_rslt.aborted() ) { - result = unit_test_monitor_t::test_setup_failure; - break; - } - } - - // This is the time we are going to spend executing the test unit (in microseconds - // as expected by test_observer::test_unit_finish) - unsigned long elapsed_microseconds = 0; - - if( result == unit_test_monitor_t::test_ok ) { - // 40. We are going to time the execution - boost::unit_test::timer::timer tu_timer; - - // we pass the random generator - const random_generator_helper& rand_gen = p_random_generator ? *p_random_generator : random_generator_helper(); - - if( tu.p_type == TUT_SUITE ) { - test_suite const& ts = static_cast<test_suite const&>( tu ); - - if( runtime_config::get<unsigned>( runtime_config::btrt_random_seed ) == 0 ) { - typedef std::pair<counter_t,test_unit_id> value_type; - - BOOST_TEST_FOREACH( value_type, chld, ts.m_ranked_children ) { - // tu_timer.elapsed() returns nanosec, timeout and child_timeout in microsec - unsigned long int chld_timeout = child_timeout( - timeout_microseconds, - static_cast<unsigned long int>( microsecond_wall_time(tu_timer.elapsed()) )); - - result = (std::min)( result, execute_test_tree( chld.second, chld_timeout, &rand_gen ) ); - - if( unit_test_monitor.is_critical_error( result ) ) - break; - - // we check for the time elapsed. If this is too high, we fail the current suite and return from here - elapsed_microseconds = static_cast<unsigned long int>( microsecond_wall_time(tu_timer.elapsed()) ); - - if( (timeout_microseconds > 0) && (elapsed_microseconds > timeout_microseconds) && (timeout_microseconds != TIMEOUT_EXCEEDED ) ) { - BOOST_TEST_FOREACH( test_observer*, to, m_observers ) { - to->test_unit_timed_out(tu); - } - result = (std::min)( result, unit_test_monitor_t::os_timeout ); - timeout_microseconds = TIMEOUT_EXCEEDED; - //break; - // we continue to explore the children, such that we can at least update their - // status to skipped - } - } - } - else { - // Go through ranges of children with the same dependency rank and shuffle them - // independently. Execute each subtree in this order - test_unit_id_list children_with_the_same_rank; - - typedef test_suite::children_per_rank::const_iterator it_type; - it_type it = ts.m_ranked_children.begin(); - while( it != ts.m_ranked_children.end() ) { - children_with_the_same_rank.clear(); - - std::pair<it_type,it_type> range = ts.m_ranked_children.equal_range( it->first ); - it = range.first; - while( it != range.second ) { - children_with_the_same_rank.push_back( it->second ); - it++; - } - - impl::random_shuffle( children_with_the_same_rank.begin(), children_with_the_same_rank.end(), rand_gen ); - - BOOST_TEST_FOREACH( test_unit_id, chld, children_with_the_same_rank ) { - unsigned long int chld_timeout = child_timeout( - timeout_microseconds, - static_cast<unsigned long int>(microsecond_wall_time(tu_timer.elapsed())) ); - - result = (std::min)( result, execute_test_tree( chld, chld_timeout, &rand_gen ) ); - - if( unit_test_monitor.is_critical_error( result ) ) - break; - - // we check for the time elapsed. If this is too high, we fail the current suite and return from here - elapsed_microseconds = static_cast<unsigned long int>( microsecond_wall_time(tu_timer.elapsed()) ); - if( (timeout_microseconds > 0) && (elapsed_microseconds > timeout_microseconds) && (timeout_microseconds != TIMEOUT_EXCEEDED ) ) { - BOOST_TEST_FOREACH( test_observer*, to, m_observers ) { - to->test_unit_timed_out(tu); - } - result = (std::min)( result, unit_test_monitor_t::os_timeout ); - timeout_microseconds = TIMEOUT_EXCEEDED; - //break; - // we continue to explore the children, such that we can at least update their - // status to skipped - } - } - } - } - } - else { // TUT_CASE - test_case const& tc = static_cast<test_case const&>( tu ); - - // setup contexts - m_context_idx = 0; - - // setup current test case - ut_detail::test_unit_id_restore restore_current_test_unit(m_curr_test_unit, tc.p_id); - - // execute the test case body, transforms the time out to seconds - result = unit_test_monitor.execute_and_translate( tc.p_test_func, timeout_microseconds ); - elapsed_microseconds = static_cast<unsigned long int>( microsecond_wall_time(tu_timer.elapsed()) ); - - // cleanup leftover context - m_context.clear(); - - // restore state (scope exit) and abort if necessary - } - } - - // if run error is critical skip teardown, who knows what the state of the program at this point - if( !unit_test_monitor.is_critical_error( result ) ) { - // execute teardown fixtures if any in reverse order - BOOST_TEST_REVERSE_FOREACH( test_unit_fixture_ptr, F, tu.p_fixtures.get() ) { - ut_detail::test_unit_id_restore restore_current_test_unit(m_curr_test_unit, tu.p_id); - result = (std::min)( result, unit_test_monitor.execute_and_translate( boost::bind( &test_unit_fixture::teardown, F ), 0 ) ); - - if( unit_test_monitor.is_critical_error( result ) ) - break; - } - } - - // notify all observers about abortion - if( unit_test_monitor.is_critical_error( result ) ) { - BOOST_TEST_FOREACH( test_observer*, to, m_observers ) - to->test_aborted(); - } - - // notify all observers about completion - BOOST_TEST_REVERSE_FOREACH( test_observer*, to, m_observers ) - to->test_unit_finish( tu, elapsed_microseconds ); - - return result; - } - - ////////////////////////////////////////////////////////////////// - - unsigned long int child_timeout( unsigned long tu_timeout_microseconds, unsigned long elpsed_microsec ) - { - if( tu_timeout_microseconds == 0UL || tu_timeout_microseconds == TIMEOUT_EXCEEDED) - return tu_timeout_microseconds; - - return tu_timeout_microseconds > elpsed_microsec ? - tu_timeout_microseconds - elpsed_microsec - : TIMEOUT_EXCEEDED; - } - - struct priority_order { - bool operator()( test_observer* lhs, test_observer* rhs ) const - { - return (lhs->priority() < rhs->priority()) || - ((lhs->priority() == rhs->priority()) && std::less<test_observer*>()(lhs, rhs)); - } - }; - - // Data members - typedef std::map<test_unit_id,test_unit*> test_unit_store; - typedef std::set<test_observer*,priority_order> observer_store; - struct context_frame { - context_frame( std::string const& d, int id, bool sticky ) - : descr( d ) - , frame_id( id ) - , is_sticky( sticky ) - {} - - std::string descr; - int frame_id; - bool is_sticky; - }; - typedef std::vector<context_frame> context_data; - - master_test_suite_t* m_master_test_suite; - std::vector<test_suite*> m_auto_test_suites; - - test_unit_id m_curr_test_unit; - test_unit_store m_test_units; - - test_unit_id m_next_test_case_id; - test_unit_id m_next_test_suite_id; - - bool m_test_in_progress; - - observer_store m_observers; - context_data m_context; - int m_context_idx; - - std::set<global_fixture*> m_global_fixtures; - - boost::execution_monitor m_aux_em; - - std::map<output_format, runtime_config::stream_holder> m_log_sinks; - runtime_config::stream_holder m_report_sink; -}; - -//____________________________________________________________________________// - -namespace impl { -namespace { - -#if defined(__CYGWIN__) -framework::state& s_frk_state() { static framework::state* the_inst = 0; if(!the_inst) the_inst = new framework::state; return *the_inst; } -#else -framework::state& s_frk_state() { static framework::state the_inst; return the_inst; } -#endif - -} // local namespace - -void -setup_for_execution( test_unit const& tu ) -{ - s_frk_state().deduce_run_status( tu.p_id ); -} - -struct sum_to_first_only { - sum_to_first_only() : is_first(true) {} - template <class T, class U> - T operator()(T const& l_, U const& r_) { - if(is_first) { - is_first = false; - return l_ + r_.first; - } - return l_ + ", " + r_.first; - } - - bool is_first; -}; - -void -shutdown_loggers_and_reports() -{ - s_frk_state().m_log_sinks.clear(); - s_frk_state().m_report_sink.setup( "stderr" ); -} - -void -unregister_global_fixture_and_configuration() -{ - // we make a copy as the set will change in the iteration - std::set<global_fixture*> gfixture_copy(s_frk_state().m_global_fixtures); - BOOST_TEST_FOREACH( global_fixture*, tuf, gfixture_copy ) { - tuf->unregister_from_framework(); - } - s_frk_state().m_global_fixtures.clear(); - - state::observer_store gobserver_copy(s_frk_state().m_observers); - BOOST_TEST_FOREACH( test_observer*, to, gobserver_copy ) { - framework::deregister_observer( *to ); - } - s_frk_state().m_observers.clear(); -} - -void -setup_loggers() -{ - - BOOST_TEST_I_TRY { - -#ifdef BOOST_TEST_SUPPORT_TOKEN_ITERATOR - bool has_combined_logger = runtime_config::has( runtime_config::btrt_combined_logger ) - && !runtime_config::get< std::vector<std::string> >( runtime_config::btrt_combined_logger ).empty(); -#else - bool has_combined_logger = false; -#endif - - if( !has_combined_logger ) { - unit_test_log.set_threshold_level( runtime_config::get<log_level>( runtime_config::btrt_log_level ) ); - const output_format format = runtime_config::get<output_format>( runtime_config::btrt_log_format ); - unit_test_log.set_format( format ); - - runtime_config::stream_holder& stream_logger = s_frk_state().m_log_sinks[format]; - if( runtime_config::has( runtime_config::btrt_log_sink ) ) { - // we remove all streams in this case, so we do not specify the format - boost::function< void () > log_cleaner = boost::bind( &unit_test_log_t::set_stream, - &unit_test_log, - boost::ref(std::cout) - ); - stream_logger.setup( runtime_config::get<std::string>( runtime_config::btrt_log_sink ), - log_cleaner ); - } - unit_test_log.set_stream( stream_logger.ref() ); - unit_test_log.configure(); - } - else - { - - const std::vector<std::string>& v_output_format = runtime_config::get< std::vector<std::string> >( runtime_config::btrt_combined_logger ) ; - - static const std::pair<const char*, log_level> all_log_levels[] = { - std::make_pair( "all" , log_successful_tests ), - std::make_pair( "success" , log_successful_tests ), - std::make_pair( "test_suite" , log_test_units ), - std::make_pair( "unit_scope" , log_test_units ), - std::make_pair( "message" , log_messages ), - std::make_pair( "warning" , log_warnings ), - std::make_pair( "error" , log_all_errors ), - std::make_pair( "cpp_exception" , log_cpp_exception_errors ), - std::make_pair( "system_error" , log_system_errors ), - std::make_pair( "fatal_error" , log_fatal_errors ), - std::make_pair( "nothing" , log_nothing ) - }; - - static const std::pair<const char*, output_format> all_formats[] = { - std::make_pair( "HRF" , OF_CLF ), - std::make_pair( "CLF" , OF_CLF ), - std::make_pair( "XML" , OF_XML ), - std::make_pair( "JUNIT", OF_JUNIT ) - }; - - - bool is_first = true; - - BOOST_TEST_FOREACH( const_string, current_multi_config, v_output_format ) { - - #ifdef BOOST_TEST_SUPPORT_TOKEN_ITERATOR - - // ':' may be used for file names: C:/tmp/mylogsink.xml - // we merge the tokens that start with / or \ with the previous one. - std::vector<std::string> v_processed_tokens; - - { - utils::string_token_iterator current_config( current_multi_config, (utils::dropped_delimeters = ":", - utils::kept_delimeters = utils::dt_none) ); - - for( ; current_config != utils::string_token_iterator() ; ++current_config) { - std::string str_copy(current_config->begin(), current_config->end()); - if( ( str_copy[0] == '\\' || str_copy[0] == '/' ) - && v_processed_tokens.size() > 0) { - v_processed_tokens.back() += ":" + str_copy; // ':' has been eaten up - } - else { - v_processed_tokens.push_back(str_copy); - } - } - } - - BOOST_TEST_FOREACH( std::string const&, current_config, v_processed_tokens ) { - - utils::string_token_iterator current_format_specs( current_config, (utils::keep_empty_tokens, - utils::dropped_delimeters = ",", - utils::kept_delimeters = utils::dt_none) ); - - output_format format = OF_INVALID ; // default - if( current_format_specs != utils::string_token_iterator() && - current_format_specs->size() ) { - - for(size_t elem=0; elem < sizeof(all_formats)/sizeof(all_formats[0]); elem++) { - if(const_string(all_formats[elem].first) == *current_format_specs) { - format = all_formats[elem].second; - break; - } - } - } - - BOOST_TEST_I_ASSRT( format != OF_INVALID, - boost::runtime::access_to_missing_argument() - << "Unable to determine the logger type from '" - << current_config - << "'. Possible choices are: " - << std::accumulate(all_formats, - all_formats + sizeof(all_formats)/sizeof(all_formats[0]), - std::string(""), - sum_to_first_only()) - ); - - // activates this format - if( is_first ) { - unit_test_log.set_format( format ); - } - else { - unit_test_log.add_format( format ); - } - is_first = false; - - unit_test_log_formatter * const formatter = unit_test_log.get_formatter(format); - BOOST_TEST_SETUP_ASSERT( formatter, "Logger setup error" ); - - log_level formatter_log_level = invalid_log_level; - ++current_format_specs ; - if( !current_format_specs->size() ) { - formatter_log_level = formatter->get_log_level(); // default log level given by the formatter - } - else if( current_format_specs != utils::string_token_iterator() ) { - - for(size_t elem=0; elem < sizeof(all_log_levels)/sizeof(all_log_levels[0]); elem++) { - if(const_string(all_log_levels[elem].first) == *current_format_specs) { - formatter_log_level = all_log_levels[elem].second; - break; - } - } - } - - BOOST_TEST_I_ASSRT( formatter_log_level != invalid_log_level, - boost::runtime::access_to_missing_argument() - << "Unable to determine the log level from '" - << current_config - << "'. Possible choices are: " - << std::accumulate(all_log_levels, - all_log_levels + sizeof(all_log_levels)/sizeof(all_log_levels[0]), - std::string(""), - sum_to_first_only()) - ); - - unit_test_log.set_threshold_level( format, formatter_log_level ); - - runtime_config::stream_holder& stream_logger = s_frk_state().m_log_sinks[format]; - boost::function< void () > log_cleaner = boost::bind( &unit_test_log_t::set_stream, - &unit_test_log, - format, - boost::ref(std::cout) ); - if( ++current_format_specs != utils::string_token_iterator() && - current_format_specs->size() ) { - stream_logger.setup( *current_format_specs, - log_cleaner ); - } - else { - stream_logger.setup( formatter->get_default_stream_description(), - log_cleaner ); - } - unit_test_log.set_stream( format, stream_logger.ref() ); - } - #endif - } // for each logger - - } // if/else new logger API - } // BOOST_TEST_I_TRY - BOOST_TEST_I_CATCH( boost::runtime::init_error, ex ) { - BOOST_TEST_SETUP_ASSERT( false, ex.msg ); - } - BOOST_TEST_I_CATCH( boost::runtime::input_error, ex ) { - std::cerr << ex.msg << "\n\n"; - - BOOST_TEST_I_THROW( framework::nothing_to_test( boost::exit_exception_failure ) ); - } - - -} - -//____________________________________________________________________________// - -} // namespace impl - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** framework::init ************** // -// ************************************************************************** // - -void -init( init_unit_test_func init_func, int argc, char* argv[] ) -{ - using namespace impl; - - // 10. Set up runtime parameters - runtime_config::init( argc, argv ); - - // 20. Set the desired log level, format and sink - impl::setup_loggers(); - - // 30. Set the desired report level, format and sink - results_reporter::set_level( runtime_config::get<report_level>( runtime_config::btrt_report_level ) ); - results_reporter::set_format( runtime_config::get<output_format>( runtime_config::btrt_report_format ) ); - - if( runtime_config::has( runtime_config::btrt_report_sink ) ) { - boost::function< void () > report_cleaner = boost::bind( &results_reporter::set_stream, - boost::ref(std::cerr) - ); - s_frk_state().m_report_sink.setup( runtime_config::get<std::string>( runtime_config::btrt_report_sink ), - report_cleaner ); - } - - results_reporter::set_stream( s_frk_state().m_report_sink.ref() ); - - // 40. Register default test observers - register_observer( results_collector ); - register_observer( unit_test_log ); - - if( runtime_config::get<bool>( runtime_config::btrt_show_progress ) ) { - progress_monitor.set_stream( std::cout ); // defaults to stdout - register_observer( progress_monitor ); - } - - // 50. Set up memory leak detection - unsigned long detect_mem_leak = runtime_config::get<unsigned long>( runtime_config::btrt_detect_mem_leaks ); - if( detect_mem_leak > 0 ) { - debug::detect_memory_leaks( true, runtime_config::get<std::string>( runtime_config::btrt_report_mem_leaks ) ); - debug::break_memory_alloc( (long)detect_mem_leak ); - } - - // 60. Initialize master unit test suite - master_test_suite().argc = argc; - master_test_suite().argv = argv; - - // 70. Invoke test module initialization routine - BOOST_TEST_I_TRY { - s_frk_state().m_aux_em.vexecute( boost::bind( &impl::invoke_init_func, init_func ) ); - } - BOOST_TEST_I_CATCH( execution_exception, ex ) { - BOOST_TEST_SETUP_ASSERT( false, ex.what() ); - } -} - -//____________________________________________________________________________// - -void -finalize_setup_phase( test_unit_id master_tu_id ) -{ - if( master_tu_id == INV_TEST_UNIT_ID ) - master_tu_id = master_test_suite().p_id; - - // 10. Apply all decorators to the auto test units - // 10. checks for consistency (duplicate names, etc) - class apply_decorators : public test_tree_visitor { - private: - // test_tree_visitor interface - - bool test_suite_start( test_suite const& ts) BOOST_OVERRIDE - { - const_cast<test_suite&>(ts).generate(); - const_cast<test_suite&>(ts).check_for_duplicate_test_cases(); - return test_tree_visitor::test_suite_start(ts); - } - - bool visit( test_unit const& tu ) BOOST_OVERRIDE - { - BOOST_TEST_FOREACH( decorator::base_ptr, d, tu.p_decorators.get() ) - d->apply( const_cast<test_unit&>(tu) ); - - return true; - } - } ad; - traverse_test_tree( master_tu_id, ad, true ); - - // 20. Finalize setup phase - impl::order_info_per_tu tuoi; - impl::s_frk_state().deduce_siblings_order( master_tu_id, master_tu_id, tuoi ); - impl::s_frk_state().finalize_default_run_status( master_tu_id, test_unit::RS_INVALID ); -} - -// ************************************************************************** // -// ************** test_in_progress ************** // -// ************************************************************************** // - -bool -test_in_progress() -{ - return impl::s_frk_state().m_test_in_progress; -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** framework::shutdown ************** // -// ************************************************************************** // - -void -shutdown() -{ - // shuts down the loggers singleton to avoid any further reference to the - // framework during the destruction of those - impl::shutdown_loggers_and_reports(); - - // unregisters any global fixture and configuration object - impl::unregister_global_fixture_and_configuration(); - - // eliminating some fake memory leak reports. See for more details: - // http://connect.microsoft.com/VisualStudio/feedback/details/106937/memory-leaks-reported-by-debug-crt-inside-typeinfo-name - -# if BOOST_WORKAROUND(BOOST_MSVC, <= 1600 ) && !defined(_DLL) && defined(_DEBUG) -# if BOOST_WORKAROUND(BOOST_MSVC, < 1600 ) -#define _Next next -#define _MemPtr memPtr -#endif - __type_info_node* pNode = __type_info_root_node._Next; - __type_info_node* tmpNode = &__type_info_root_node; - - for( ; pNode!=NULL; pNode = tmpNode ) { - tmpNode = pNode->_Next; - delete pNode->_MemPtr; - delete pNode; - } -# if BOOST_WORKAROUND(BOOST_MSVC, < 1600 ) -#undef _Next -#undef _MemPtr -#endif -# endif -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** register_test_unit ************** // -// ************************************************************************** // - -void -register_test_unit( test_case* tc ) -{ - BOOST_TEST_SETUP_ASSERT( tc->p_id == INV_TEST_UNIT_ID, BOOST_TEST_L( "test case already registered" ) ); - - test_unit_id new_id = impl::s_frk_state().m_next_test_case_id; - - BOOST_TEST_SETUP_ASSERT( new_id != MAX_TEST_CASE_ID, BOOST_TEST_L( "too many test cases" ) ); - - typedef state::test_unit_store::value_type map_value_type; - - impl::s_frk_state().m_test_units.insert( map_value_type( new_id, tc ) ); - impl::s_frk_state().m_next_test_case_id++; - - impl::s_frk_state().set_tu_id( *tc, new_id ); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** register_test_unit ************** // -// ************************************************************************** // - -void -register_test_unit( test_suite* ts ) -{ - BOOST_TEST_SETUP_ASSERT( ts->p_id == INV_TEST_UNIT_ID, BOOST_TEST_L( "test suite already registered" ) ); - - test_unit_id new_id = impl::s_frk_state().m_next_test_suite_id; - - BOOST_TEST_SETUP_ASSERT( new_id != MAX_TEST_SUITE_ID, BOOST_TEST_L( "too many test suites" ) ); - - typedef state::test_unit_store::value_type map_value_type; - - impl::s_frk_state().m_test_units.insert( map_value_type( new_id, ts ) ); - impl::s_frk_state().m_next_test_suite_id++; - - impl::s_frk_state().set_tu_id( *ts, new_id ); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** deregister_test_unit ************** // -// ************************************************************************** // - -void -deregister_test_unit( test_unit* tu ) -{ - impl::s_frk_state().m_test_units.erase( tu->p_id ); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** clear ************** // -// ************************************************************************** // - -void -clear() -{ - impl::s_frk_state().clear(); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** register_observer ************** // -// ************************************************************************** // - -void -register_observer( test_observer& to ) -{ - impl::s_frk_state().m_observers.insert( &to ); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** deregister_observer ************** // -// ************************************************************************** // - -void -deregister_observer( test_observer& to ) -{ - impl::s_frk_state().m_observers.erase( &to ); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** register_global_fixture ************** // -// ************************************************************************** // - -void -register_global_fixture( global_fixture& tuf ) -{ - impl::s_frk_state().m_global_fixtures.insert( &tuf ); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** deregister_global_fixture ************** // -// ************************************************************************** // - -void -deregister_global_fixture( global_fixture &tuf ) -{ - impl::s_frk_state().m_global_fixtures.erase( &tuf ); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** add_context ************** // -// ************************************************************************** // - -int -add_context( ::boost::unit_test::lazy_ostream const& context_descr, bool sticky ) -{ - std::stringstream buffer; - context_descr( buffer ); - int res_idx = impl::s_frk_state().m_context_idx++; - - impl::s_frk_state().m_context.push_back( state::context_frame( buffer.str(), res_idx, sticky ) ); - - return res_idx; -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** clear_context ************** // -// ************************************************************************** // - -struct frame_with_id { - explicit frame_with_id( int id ) : m_id( id ) {} - - bool operator()( state::context_frame const& f ) - { - return f.frame_id == m_id; - } - int m_id; -}; - -//____________________________________________________________________________// - -void -clear_context( int frame_id ) -{ - if( frame_id == -1 ) { // clear all non sticky frames - for( int i=static_cast<int>(impl::s_frk_state().m_context.size())-1; i>=0; i-- ) - if( !impl::s_frk_state().m_context[i].is_sticky ) - impl::s_frk_state().m_context.erase( impl::s_frk_state().m_context.begin()+i ); - } - - else { // clear specific frame - state::context_data::iterator it = - std::find_if( impl::s_frk_state().m_context.begin(), impl::s_frk_state().m_context.end(), frame_with_id( frame_id ) ); - - if( it != impl::s_frk_state().m_context.end() ) // really an internal error if this is not true - impl::s_frk_state().m_context.erase( it ); - } -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** get_context ************** // -// ************************************************************************** // - -context_generator -get_context() -{ - return context_generator(); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** context_generator ************** // -// ************************************************************************** // - -bool -context_generator::is_empty() const -{ - return impl::s_frk_state().m_context.empty(); -} - -//____________________________________________________________________________// - -const_string -context_generator::next() const -{ - return m_curr_frame < impl::s_frk_state().m_context.size() ? impl::s_frk_state().m_context[m_curr_frame++].descr : const_string(); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** master_test_suite ************** // -// ************************************************************************** // - -master_test_suite_t& -master_test_suite() -{ - if( !impl::s_frk_state().m_master_test_suite ) - impl::s_frk_state().m_master_test_suite = new master_test_suite_t; - - return *impl::s_frk_state().m_master_test_suite; -} - -namespace impl { - -master_test_suite_name_setter::master_test_suite_name_setter(const_string name) { - assign_op( master_test_suite().p_name.value, name.trim( "\"" ), 0 ); -} - -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** current_auto_test_suite ************** // -// ************************************************************************** // - -test_suite& -current_auto_test_suite( test_suite* ts, bool push_or_pop ) -{ - if( impl::s_frk_state().m_auto_test_suites.empty() ) - impl::s_frk_state().m_auto_test_suites.push_back( &framework::master_test_suite() ); - - if( !push_or_pop ) - impl::s_frk_state().m_auto_test_suites.pop_back(); - else if( ts ) - impl::s_frk_state().m_auto_test_suites.push_back( ts ); - - return *impl::s_frk_state().m_auto_test_suites.back(); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** current_test_case ************** // -// ************************************************************************** // - -test_case const& -current_test_case() -{ - return get<test_case>( impl::s_frk_state().m_curr_test_unit ); -} - - -test_unit const& -current_test_unit() -{ - return *impl::s_frk_state().m_test_units[impl::s_frk_state().m_curr_test_unit]; -} - -//____________________________________________________________________________// - -test_unit_id -current_test_case_id() -{ - return impl::s_frk_state().m_curr_test_unit; -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** framework::get ************** // -// ************************************************************************** // - -test_unit& -get( test_unit_id id, test_unit_type t ) -{ - test_unit* res = impl::s_frk_state().m_test_units[id]; - - BOOST_TEST_I_ASSRT( (res->p_type & t) != 0, internal_error( "Invalid test unit type" ) ); - - return *res; -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** framework::run ************** // -// ************************************************************************** // - -template <class Cont> -struct swap_on_delete { - swap_on_delete(Cont& c1, Cont& c2) : m_c1(c1), m_c2(c2){} - ~swap_on_delete() { - m_c1.swap(m_c2); - } - - Cont& m_c1; - Cont& m_c2; -}; - -struct register_observer_helper { - register_observer_helper(test_observer& observer) - : m_observer(observer) - { - register_obs(); - } - - ~register_observer_helper() { - if(m_registered) - deregister_observer( m_observer ); - } - - void deregister_obs() { - m_registered = false; - deregister_observer( m_observer ); - } - - void register_obs() { - m_registered = true; - register_observer( m_observer ); - } - - - test_observer& m_observer; - bool m_registered; -}; - -void -run( test_unit_id id, bool continue_test ) -{ - if( id == INV_TEST_UNIT_ID ) - id = master_test_suite().p_id; - - // Figure out run status for execution phase - impl::s_frk_state().deduce_run_status( id ); - - test_case_counter tcc; - traverse_test_tree( id, tcc ); - - BOOST_TEST_SETUP_ASSERT( tcc.p_count != 0 , runtime_config::get<std::vector<std::string> >( runtime_config::btrt_run_filters ).empty() - ? BOOST_TEST_L( "test tree is empty" ) - : BOOST_TEST_L( "no test cases matching filter or all test cases were disabled" ) ); - - bool was_in_progress = framework::test_in_progress(); - bool call_start_finish = !continue_test || !was_in_progress; - bool init_ok = true; - const_string setup_error; - - framework_init_observer_t local_init_observer; - register_observer_helper init_observer_helper( local_init_observer ); - - if( call_start_finish ) { - // indicates the framework that no test is in progress now if observers need to be notified - impl::s_frk_state().m_test_in_progress = false; - // unit_test::framework_init_observer will get cleared first - BOOST_TEST_FOREACH( test_observer*, to, impl::s_frk_state().m_observers ) { - BOOST_TEST_I_TRY { - ut_detail::test_unit_id_restore restore_current_test_unit(impl::s_frk_state().m_curr_test_unit, id); - unit_test_monitor_t::error_level result = unit_test_monitor.execute_and_translate( boost::bind( &test_observer::test_start, to, tcc.p_count, id ) ); - if( init_ok ) { - if( result != unit_test_monitor_t::test_ok ) { - init_ok = false; - } - else { - if( local_init_observer.has_failed() ) { - init_ok = false; - } - } - } - } - BOOST_TEST_I_CATCH( execution_exception, ex ) { - if( init_ok ) { - // log only the first error - init_ok = false; - setup_error = ex.what(); - } - // break; // we should continue otherwise loggers may have improper structure (XML start missing for instance) - } - } - } - - // removing this observer as it should not be of any use for the tests - init_observer_helper.deregister_obs(); - - if( init_ok ) { - - // attaching the global fixtures to the main entry point - test_unit& entry_test_unit = framework::get( id, TUT_ANY ); - std::vector<test_unit_fixture_ptr> v_saved_fixture(entry_test_unit.p_fixtures.value.begin(), - entry_test_unit.p_fixtures.value.end()); - - BOOST_TEST_FOREACH( test_unit_fixture*, tuf, impl::s_frk_state().m_global_fixtures ) { - entry_test_unit.p_fixtures.value.insert( entry_test_unit.p_fixtures.value.begin(), - test_unit_fixture_ptr(new impl::global_fixture_handle(tuf)) ); - } - - swap_on_delete< std::vector<test_unit_fixture_ptr> > raii_fixture(v_saved_fixture, entry_test_unit.p_fixtures.value); - - // now work in progress - impl::s_frk_state().m_test_in_progress = true; - unsigned seed = runtime_config::get<unsigned>( runtime_config::btrt_random_seed ); - switch( seed ) { - case 0: - break; - case 1: - seed = static_cast<unsigned>( std::rand() ^ std::time( 0 ) ); // better init using std::rand() ^ ... - BOOST_FALLTHROUGH; - default: - BOOST_TEST_FRAMEWORK_MESSAGE( "Test cases order is shuffled using seed: " << seed ); - std::srand( seed ); - } - - // executing the test tree - impl::s_frk_state().execute_test_tree( id ); - - // removing previously added global fixtures: dtor raii_fixture - } - - impl::s_frk_state().m_test_in_progress = false; - - results_reporter::make_report( INV_REPORT_LEVEL, id ); - - // reinstalling this observer - init_observer_helper.register_obs(); - - local_init_observer.clear(); - if( call_start_finish ) { - // indicates the framework that no test is in progress anymore if observers need to be notified - // and this is a teardown, so assertions should not raise any exception otherwise an exception - // might be raised in a dtor of a global fixture - impl::s_frk_state().m_test_in_progress = false; - BOOST_TEST_REVERSE_FOREACH( test_observer*, to, impl::s_frk_state().m_observers ) { - ut_detail::test_unit_id_restore restore_current_test_unit(impl::s_frk_state().m_curr_test_unit, id); - to->test_finish(); - } - } - - impl::s_frk_state().m_test_in_progress = was_in_progress; - - // propagates the init/teardown error if any - BOOST_TEST_SETUP_ASSERT( init_ok && !local_init_observer.has_failed(), setup_error ); -} - -//____________________________________________________________________________// - -void -run( test_unit const* tu, bool continue_test ) -{ - run( tu->p_id, continue_test ); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** assertion_result ************** // -// ************************************************************************** // - -void -assertion_result( unit_test::assertion_result ar ) -{ - BOOST_TEST_FOREACH( test_observer*, to, impl::s_frk_state().m_observers ) - to->assertion_result( ar ); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** exception_caught ************** // -// ************************************************************************** // - -void -exception_caught( execution_exception const& ex ) -{ - BOOST_TEST_FOREACH( test_observer*, to, impl::s_frk_state().m_observers ) - to->exception_caught( ex ); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** test_unit_aborted ************** // -// ************************************************************************** // - -void -test_unit_aborted( test_unit const& tu ) -{ - BOOST_TEST_FOREACH( test_observer*, to, impl::s_frk_state().m_observers ) - to->test_unit_aborted( tu ); -} - -// ************************************************************************** // -// ************** test_aborted ************** // -// ************************************************************************** // - -void -test_aborted( ) -{ - BOOST_TEST_FOREACH( test_observer*, to, impl::s_frk_state().m_observers ) - to->test_aborted( ); -} - - -//____________________________________________________________________________// - -} // namespace framework -} // namespace unit_test -} // namespace boost - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_FRAMEWORK_IPP_021005GER diff --git a/contrib/restricted/boost/test/include/boost/test/impl/junit_log_formatter.ipp b/contrib/restricted/boost/test/include/boost/test/impl/junit_log_formatter.ipp deleted file mode 100644 index 8a3b17dc2e..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/impl/junit_log_formatter.ipp +++ /dev/null @@ -1,878 +0,0 @@ -// (C) Copyright 2016 Raffi Enficiaud. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -///@file -///@brief Contains the implementatoin of the Junit log formatter (OF_JUNIT) -// *************************************************************************** - -#ifndef BOOST_TEST_JUNIT_LOG_FORMATTER_IPP__ -#define BOOST_TEST_JUNIT_LOG_FORMATTER_IPP__ - -// Boost.Test -#include <boost/test/output/junit_log_formatter.hpp> -#include <boost/test/execution_monitor.hpp> -#include <boost/test/framework.hpp> -#include <boost/test/tree/test_unit.hpp> -#include <boost/test/utils/basic_cstring/io.hpp> -#include <boost/test/utils/xml_printer.hpp> -#include <boost/test/utils/string_cast.hpp> -#include <boost/test/framework.hpp> - -#include <boost/test/tree/visitor.hpp> -#include <boost/test/tree/traverse.hpp> -#include <boost/test/results_collector.hpp> - -#include <boost/test/utils/algorithm.hpp> -#include <boost/test/utils/string_cast.hpp> - -//#include <boost/test/results_reporter.hpp> - - -// Boost -#include <boost/version.hpp> -#include <boost/core/ignore_unused.hpp> - -// STL -#include <iostream> -#include <fstream> -#include <set> - -#include <boost/test/detail/suppress_warnings.hpp> - - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { -namespace output { - - -struct s_replace_chars { - template <class T> - void operator()(T& to_replace) - { - if(to_replace == '/') - to_replace = '.'; - else if(to_replace == ' ') - to_replace = '_'; - } -}; - -inline std::string tu_name_normalize(std::string full_name) -{ - // maybe directly using normalize_test_case_name instead? - std::for_each(full_name.begin(), full_name.end(), s_replace_chars()); - return full_name; -} - -inline std::string tu_name_remove_newlines(std::string full_name) -{ - full_name.erase(std::remove(full_name.begin(), full_name.end(), '\n'), full_name.end()); - return full_name; -} - -const_string file_basename(const_string filename) { - - const_string path_sep( "\\/" ); - const_string::iterator it = unit_test::utils::find_last_of( filename.begin(), filename.end(), - path_sep.begin(), path_sep.end() ); - if( it != filename.end() ) - filename.trim_left( it + 1 ); - - return filename; - -} - -// ************************************************************************** // -// ************** junit_log_formatter ************** // -// ************************************************************************** // - -void -junit_log_formatter::log_start( std::ostream& /*ostr*/, counter_t /*test_cases_amount*/) -{ - map_tests.clear(); - list_path_to_root.clear(); - runner_log_entry.clear(); -} - -//____________________________________________________________________________// - -class junit_result_helper : public test_tree_visitor { -private: - typedef junit_impl::junit_log_helper::assertion_entry assertion_entry; - typedef std::vector< assertion_entry >::const_iterator vect_assertion_entry_citerator; - typedef std::list<std::string>::const_iterator list_str_citerator; - -public: - explicit junit_result_helper( - std::ostream& stream, - test_unit const& ts, - junit_log_formatter::map_trace_t const& mt, - junit_impl::junit_log_helper const& runner_log_, - bool display_build_info ) - : m_stream(stream) - , m_ts( ts ) - , m_map_test( mt ) - , runner_log( runner_log_ ) - , m_id( 0 ) - , m_display_build_info(display_build_info) - { } - - void add_log_entry(assertion_entry const& log) const - { - std::string entry_type; - if( log.log_entry == assertion_entry::log_entry_failure ) { - entry_type = "failure"; - } - else if( log.log_entry == assertion_entry::log_entry_error ) { - entry_type = "error"; - } - else { - return; - } - - m_stream - << "<" << entry_type - << " message" << utils::attr_value() << log.logentry_message - << " type" << utils::attr_value() << log.logentry_type - << ">"; - - if(!log.output.empty()) { - m_stream << utils::cdata() << "\n" + log.output; - } - - m_stream << "</" << entry_type << ">"; - } - - struct conditional_cdata_helper { - std::ostream &ostr; - std::string const field; - bool empty; - - conditional_cdata_helper(std::ostream &ostr_, std::string field_) - : ostr(ostr_) - , field(field_) - , empty(true) - {} - - ~conditional_cdata_helper() { - if(!empty) { - ostr << BOOST_TEST_L( "]]>" ) << "</" << field << '>' << std::endl; - } - } - - void operator()(const std::string& s) { - bool current_empty = s.empty(); - if(empty) { - if(!current_empty) { - empty = false; - ostr << '<' << field << '>' << BOOST_TEST_L( "<![CDATA[" ); - } - } - if(!current_empty) { - ostr << s; - } - } - }; - - std::list<std::string> build_skipping_chain(test_unit const & tu) const - { - // we enter here because we know that the tu has been skipped. - // either junit has not seen this tu, or it is indicated as disabled - assert(m_map_test.count(tu.p_id) == 0 || results_collector.results( tu.p_id ).p_skipped); - - std::list<std::string> out; - - test_unit_id id(tu.p_id); - while( id != m_ts.p_id && id != INV_TEST_UNIT_ID) { - test_unit const& tu_hierarchy = boost::unit_test::framework::get( id, TUT_ANY ); - out.push_back("- disabled test unit: '" + tu_name_remove_newlines(tu_hierarchy.full_name()) + "'\n"); - if(m_map_test.count(id) > 0) - { - // junit has seen the reason: this is enough for constructing the chain - break; - } - id = tu_hierarchy.p_parent_id; - } - junit_log_formatter::map_trace_t::const_iterator it_element_stack(m_map_test.find(id)); - if( it_element_stack != m_map_test.end() ) - { - out.push_back("- reason: '" + it_element_stack->second.skipping_reason + "'"); - out.push_front("Test case disabled because of the following chain of decision:\n"); - } - - return out; - } - - std::string get_class_name(test_unit const & tu_class) const { - std::string classname; - test_unit_id id(tu_class.p_parent_id); - while( id != m_ts.p_id && id != INV_TEST_UNIT_ID ) { - test_unit const& tu = boost::unit_test::framework::get( id, TUT_ANY ); - classname = tu_name_normalize(tu.p_name) + "." + classname; - id = tu.p_parent_id; - } - - // removes the trailing dot - if(!classname.empty() && *classname.rbegin() == '.') { - classname.erase(classname.size()-1); - } - - return classname; - } - - void write_testcase_header(test_unit const & tu, - test_results const *tr, - int nb_assertions) const - { - std::string name; - std::string classname; - - if(tu.p_id == m_ts.p_id ) { - name = "boost_test"; - } - else { - classname = get_class_name(tu); - name = tu_name_normalize(tu.p_name); - } - - if( tu.p_type == TUT_SUITE ) { - if(tr->p_timed_out) - name += "-timed-execution"; - else - name += "-setup-teardown"; - } - - m_stream << "<testcase assertions" << utils::attr_value() << nb_assertions; - if(!classname.empty()) - m_stream << " classname" << utils::attr_value() << classname; - - // test case name and time taken - m_stream - << " name" << utils::attr_value() << name - << " time" << utils::attr_value() << double(tr->p_duration_microseconds) * 1E-6 - << ">" << std::endl; - } - - void write_testcase_system_out(junit_impl::junit_log_helper const &detailed_log, - test_unit const * tu, - bool skipped) const - { - // system-out + all info/messages, the object skips the empty entries - conditional_cdata_helper system_out_helper(m_stream, "system-out"); - - // indicate why the test has been skipped first - if( skipped ) { - std::list<std::string> skipping_decision_chain = build_skipping_chain(*tu); - for(list_str_citerator it(skipping_decision_chain.begin()), ite(skipping_decision_chain.end()); - it != ite; - ++it) - { - system_out_helper(*it); - } - } - - // stdout - for(list_str_citerator it(detailed_log.system_out.begin()), ite(detailed_log.system_out.end()); - it != ite; - ++it) - { - system_out_helper(*it); - } - - // warning/info message last - for(vect_assertion_entry_citerator it(detailed_log.assertion_entries.begin()); - it != detailed_log.assertion_entries.end(); - ++it) - { - if(it->log_entry != assertion_entry::log_entry_info) - continue; - system_out_helper(it->output); - } - } - - void write_testcase_system_err(junit_impl::junit_log_helper const &detailed_log, - test_unit const * tu, - test_results const *tr) const - { - // system-err output + test case informations - bool has_failed = (tr != 0) ? !tr->p_skipped && !tr->passed() : false; - if(!detailed_log.system_err.empty() || has_failed) - { - std::ostringstream o; - if(has_failed) { - o << "Failures detected in:" << std::endl; - } - else { - o << "ERROR STREAM:" << std::endl; - } - - if(tu->p_type == TUT_SUITE) { - if( tu->p_id == m_ts.p_id ) { - o << " boost.test global setup/teardown" << std::endl; - } else { - o << "- test suite: " << tu_name_remove_newlines(tu->full_name()) << std::endl; - } - } - else { - o << "- test case: " << tu_name_remove_newlines(tu->full_name()); - if(!tu->p_description.value.empty()) - o << " '" << tu->p_description << "'"; - - o << std::endl - << "- file: " << file_basename(tu->p_file_name) << std::endl - << "- line: " << tu->p_line_num << std::endl - ; - } - - if(!detailed_log.system_err.empty()) - o << std::endl << "STDERR BEGIN: ------------" << std::endl; - - for(list_str_citerator it(detailed_log.system_err.begin()), ite(detailed_log.system_err.end()); - it != ite; - ++it) - { - o << *it; - } - - if(!detailed_log.system_err.empty()) - o << std::endl << "STDERR END ------------" << std::endl; - - conditional_cdata_helper system_err_helper(m_stream, "system-err"); - system_err_helper(o.str()); - } - } - - int get_nb_assertions(junit_impl::junit_log_helper const &detailed_log, - test_unit const & tu, - test_results const *tr) const { - int nb_assertions(-1); - if( tu.p_type == TUT_SUITE ) { - nb_assertions = 0; - for(vect_assertion_entry_citerator it(detailed_log.assertion_entries.begin()); - it != detailed_log.assertion_entries.end(); - ++it) - { - if(it->log_entry != assertion_entry::log_entry_info) - nb_assertions++; - } - } - else { - nb_assertions = static_cast<int>(tr->p_assertions_passed + tr->p_assertions_failed); - } - - return nb_assertions; - } - - void output_detailed_logs(junit_impl::junit_log_helper const &detailed_log, - test_unit const & tu, - bool skipped, - test_results const *tr) const - { - int nb_assertions = get_nb_assertions(detailed_log, tu, tr); - if(!nb_assertions && tu.p_type == TUT_SUITE) - return; - - write_testcase_header(tu, tr, nb_assertions); - - if( skipped ) { - m_stream << "<skipped/>" << std::endl; - } - else { - - for(vect_assertion_entry_citerator it(detailed_log.assertion_entries.begin()); - it != detailed_log.assertion_entries.end(); - ++it) - { - add_log_entry(*it); - } - } - - write_testcase_system_out(detailed_log, &tu, skipped); - write_testcase_system_err(detailed_log, &tu, tr); - m_stream << "</testcase>" << std::endl; - } - - void visit( test_case const& tc ) BOOST_OVERRIDE - { - - test_results const& tr = results_collector.results( tc.p_id ); - junit_log_formatter::map_trace_t::const_iterator it_find = m_map_test.find(tc.p_id); - if(it_find == m_map_test.end()) - { - // test has been skipped and not seen by the logger - output_detailed_logs(junit_impl::junit_log_helper(), tc, true, &tr); - } - else { - output_detailed_logs(it_find->second, tc, tr.p_skipped, &tr); - } - } - - bool test_suite_start( test_suite const& ts ) BOOST_OVERRIDE - { - test_results const& tr = results_collector.results( ts.p_id ); - - // unique test suite, without s, nesting not supported in CI - if( m_ts.p_id == ts.p_id ) { - m_stream << "<testsuite"; - - // think about: maybe we should add the number of fixtures of a test_suite as - // independent tests (field p_fixtures). - // same goes for the timed-execution: we can think of that as a separate test-unit - // in the suite. - // see https://llg.cubic.org/docs/junit/ and - // http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLJUnitResultFormatter.java?view=markup - m_stream - // << "disabled=\"" << tr.p_test_cases_skipped << "\" " - << " tests" << utils::attr_value() - << tr.p_test_cases_passed - + tr.p_test_cases_failed - // + tr.p_test_cases_aborted // aborted is also failed, we avoid counting it twice - << " skipped" << utils::attr_value() << tr.p_test_cases_skipped - << " errors" << utils::attr_value() << tr.p_test_cases_aborted - << " failures" << utils::attr_value() - << tr.p_test_cases_failed - + tr.p_test_suites_timed_out - + tr.p_test_cases_timed_out - - tr.p_test_cases_aborted // failed is not aborted in the Junit sense - << " id" << utils::attr_value() << m_id++ - << " name" << utils::attr_value() << tu_name_normalize(ts.p_name) - << " time" << utils::attr_value() << (tr.p_duration_microseconds * 1E-6) - << ">" << std::endl; - - if(m_display_build_info) - { - m_stream << "<properties>" << std::endl; - m_stream << "<property name=\"platform\" value" << utils::attr_value() << BOOST_PLATFORM << " />" << std::endl; - m_stream << "<property name=\"compiler\" value" << utils::attr_value() << BOOST_COMPILER << " />" << std::endl; - m_stream << "<property name=\"stl\" value" << utils::attr_value() << BOOST_STDLIB << " />" << std::endl; - - std::ostringstream o; - o << BOOST_VERSION/100000 << "." << BOOST_VERSION/100 % 1000 << "." << BOOST_VERSION % 100; - m_stream << "<property name=\"boost\" value" << utils::attr_value() << o.str() << " />" << std::endl; - m_stream << "</properties>" << std::endl; - } - } - - if( !tr.p_skipped ) { - // if we land here, then this is a chance that we are logging the fixture setup/teardown of a test-suite. - // the setup/teardown logging of a test-case is part of the test case. - // we do not care about the test-suite that were skipped (really??) - junit_log_formatter::map_trace_t::const_iterator it_find = m_map_test.find(ts.p_id); - if(it_find != m_map_test.end()) { - output_detailed_logs(it_find->second, ts, false, &tr); - } - } - - return true; // indicates that the children should also be parsed - } - - void test_suite_finish( test_suite const& ts ) BOOST_OVERRIDE - { - if( m_ts.p_id == ts.p_id ) { - write_testcase_system_out(runner_log, 0, false); - write_testcase_system_err(runner_log, 0, 0); - - m_stream << "</testsuite>"; - return; - } - } - -private: - // Data members - std::ostream& m_stream; - test_unit const& m_ts; - junit_log_formatter::map_trace_t const& m_map_test; - junit_impl::junit_log_helper const& runner_log; - size_t m_id; - bool m_display_build_info; -}; - - - -void -junit_log_formatter::log_finish( std::ostream& ostr ) -{ - ostr << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << std::endl; - - // getting the root test suite - if(!map_tests.empty()) { - test_unit* root = &boost::unit_test::framework::get( map_tests.begin()->first, TUT_ANY ); - - // looking for the root of the SUBtree (we stay in the subtree) - while(root->p_parent_id != INV_TEST_UNIT_ID && map_tests.count(root->p_parent_id) > 0) { - root = &boost::unit_test::framework::get( root->p_parent_id, TUT_ANY ); - } - junit_result_helper ch( ostr, *root, map_tests, this->runner_log_entry, m_display_build_info ); - traverse_test_tree( root->p_id, ch, true ); // last is to ignore disabled suite special handling - } - else { - ostr << "<testsuites errors=\"1\">"; - ostr << "<testsuite errors=\"1\" name=\"boost-test-framework\">"; - ostr << "<testcase assertions=\"1\" name=\"test-setup\">"; - ostr << "<system-out>Incorrect setup: no test case executed</system-out>"; - ostr << "</testcase></testsuite></testsuites>"; - } - return; -} - -//____________________________________________________________________________// - -void -junit_log_formatter::log_build_info( std::ostream& /*ostr*/, bool log_build_info ) -{ - m_display_build_info = log_build_info; -} - -//____________________________________________________________________________// - -void -junit_log_formatter::test_unit_start( std::ostream& /*ostr*/, test_unit const& tu ) -{ - list_path_to_root.push_back( tu.p_id ); - map_tests.insert(std::make_pair(tu.p_id, junit_impl::junit_log_helper())); // current_test_case_id not working here -} - - - -//____________________________________________________________________________// - - -void -junit_log_formatter::test_unit_finish( std::ostream& /*ostr*/, test_unit const& tu, unsigned long /*elapsed*/ ) -{ - // the time is already stored in the result_reporter - boost::ignore_unused( tu ); - assert( tu.p_id == list_path_to_root.back() ); - list_path_to_root.pop_back(); -} - -void -junit_log_formatter::test_unit_aborted( std::ostream& /*ostr*/, test_unit const& tu ) -{ - boost::ignore_unused( tu ); - assert( tu.p_id == list_path_to_root.back() ); - //list_path_to_root.pop_back(); -} - -//____________________________________________________________________________// - -void -junit_log_formatter::test_unit_timed_out( std::ostream& /*os*/, test_unit const& tu) -{ - if(tu.p_type == TUT_SUITE) - { - // if we reach this call, it means that the test has already started and - // test_unit_start has already been called on the tu. - junit_impl::junit_log_helper& last_entry = get_current_log_entry(); - junit_impl::junit_log_helper::assertion_entry entry; - entry.logentry_message = "test-suite time out"; - entry.logentry_type = "execution timeout"; - entry.log_entry = junit_impl::junit_log_helper::assertion_entry::log_entry_error; - entry.output = "the current suite exceeded the allocated execution time"; - last_entry.assertion_entries.push_back(entry); - } -} - -//____________________________________________________________________________// - -void -junit_log_formatter::test_unit_skipped( std::ostream& /*ostr*/, test_unit const& tu, const_string reason ) -{ - // if a test unit is skipped, then the start of this TU has not been called yet. - // we cannot use get_current_log_entry here, but the TU id should appear in the map. - // The "skip" boolean is given by the boost.test framework - junit_impl::junit_log_helper& v = map_tests[tu.p_id]; // not sure if we can use get_current_log_entry() - v.skipping_reason.assign(reason.begin(), reason.end()); -} - -//____________________________________________________________________________// - -void -junit_log_formatter::log_exception_start( std::ostream& /*ostr*/, log_checkpoint_data const& checkpoint_data, execution_exception const& ex ) -{ - std::ostringstream o; - execution_exception::location const& loc = ex.where(); - - m_is_last_assertion_or_error = false; - - junit_impl::junit_log_helper& last_entry = get_current_log_entry(); - - junit_impl::junit_log_helper::assertion_entry entry; - - entry.logentry_message = "unexpected exception"; - entry.log_entry = junit_impl::junit_log_helper::assertion_entry::log_entry_error; - - switch(ex.code()) - { - case execution_exception::cpp_exception_error: - entry.logentry_type = "uncaught exception"; - break; - case execution_exception::timeout_error: - entry.logentry_type = "execution timeout"; - break; - case execution_exception::user_error: - entry.logentry_type = "user, assert() or CRT error"; - break; - case execution_exception::user_fatal_error: - // Looks like never used - entry.logentry_type = "user fatal error"; - break; - case execution_exception::system_error: - entry.logentry_type = "system error"; - break; - case execution_exception::system_fatal_error: - entry.logentry_type = "system fatal error"; - break; - default: - entry.logentry_type = "no error"; // not sure how to handle this one - break; - } - - o << "UNCAUGHT EXCEPTION:" << std::endl; - if( !loc.m_function.is_empty() ) - o << "- function: \"" << loc.m_function << "\"" << std::endl; - - o << "- file: " << file_basename(loc.m_file_name) << std::endl - << "- line: " << loc.m_line_num << std::endl - << std::endl; - - o << "\nEXCEPTION STACK TRACE: --------------\n" << ex.what() - << "\n-------------------------------------"; - - if( !checkpoint_data.m_file_name.is_empty() ) { - o << std::endl << std::endl - << "Last checkpoint:" << std::endl - << "- message: \"" << checkpoint_data.m_message << "\"" << std::endl - << "- file: " << file_basename(checkpoint_data.m_file_name) << std::endl - << "- line: " << checkpoint_data.m_line_num << std::endl - ; - } - - entry.output = o.str(); - - last_entry.assertion_entries.push_back(entry); -} - -//____________________________________________________________________________// - -void -junit_log_formatter::log_exception_finish( std::ostream& /*ostr*/ ) -{ - // sealing the last entry - assert(!get_current_log_entry().assertion_entries.back().sealed); - get_current_log_entry().assertion_entries.back().sealed = true; -} - -//____________________________________________________________________________// - -void -junit_log_formatter::log_entry_start( std::ostream& /*ostr*/, log_entry_data const& entry_data, log_entry_types let ) -{ - junit_impl::junit_log_helper& last_entry = get_current_log_entry(); - last_entry.skipping = false; - m_is_last_assertion_or_error = true; - switch(let) - { - case unit_test_log_formatter::BOOST_UTL_ET_INFO: - { - if(m_log_level_internal > log_successful_tests) { - last_entry.skipping = true; - break; - } - BOOST_FALLTHROUGH; - } - case unit_test_log_formatter::BOOST_UTL_ET_MESSAGE: - { - if(m_log_level_internal > log_messages) { - last_entry.skipping = true; - break; - } - BOOST_FALLTHROUGH; - } - case unit_test_log_formatter::BOOST_UTL_ET_WARNING: - { - if(m_log_level_internal > log_warnings) { - last_entry.skipping = true; - break; - } - std::ostringstream o; - junit_impl::junit_log_helper::assertion_entry entry; - - entry.log_entry = junit_impl::junit_log_helper::assertion_entry::log_entry_info; - entry.logentry_message = "info"; - entry.logentry_type = "message"; - - o << (let == unit_test_log_formatter::BOOST_UTL_ET_WARNING ? - "WARNING:" : (let == unit_test_log_formatter::BOOST_UTL_ET_MESSAGE ? - "MESSAGE:" : "INFO:")) - << std::endl - << "- file : " << file_basename(entry_data.m_file_name) << std::endl - << "- line : " << entry_data.m_line_num << std::endl - << "- message: "; // no CR - - entry.output += o.str(); - last_entry.assertion_entries.push_back(entry); - break; - } - default: - case unit_test_log_formatter::BOOST_UTL_ET_ERROR: - case unit_test_log_formatter::BOOST_UTL_ET_FATAL_ERROR: - { - std::ostringstream o; - junit_impl::junit_log_helper::assertion_entry entry; - entry.log_entry = junit_impl::junit_log_helper::assertion_entry::log_entry_failure; - entry.logentry_message = "failure"; - entry.logentry_type = (let == unit_test_log_formatter::BOOST_UTL_ET_ERROR ? "assertion error" : "fatal error"); - - o << "ASSERTION FAILURE:" << std::endl - << "- file : " << file_basename(entry_data.m_file_name) << std::endl - << "- line : " << entry_data.m_line_num << std::endl - << "- message: " ; // no CR - - entry.output += o.str(); - last_entry.assertion_entries.push_back(entry); - break; - } - } -} - -//____________________________________________________________________________// - -void -junit_log_formatter::log_entry_value( std::ostream& /*ostr*/, const_string value ) -{ - junit_impl::junit_log_helper& last_entry = get_current_log_entry(); - if(last_entry.skipping) - return; - - assert(last_entry.assertion_entries.empty() || !last_entry.assertion_entries.back().sealed); - - if(!last_entry.assertion_entries.empty()) - { - junit_impl::junit_log_helper::assertion_entry& log_entry = last_entry.assertion_entries.back(); - log_entry.output += value; - } - else - { - // this may be a message coming from another observer - // the prefix is set in the log_entry_start - last_entry.system_out.push_back(std::string(value.begin(), value.end())); - } -} - -//____________________________________________________________________________// - -void -junit_log_formatter::log_entry_finish( std::ostream& /*ostr*/ ) -{ - junit_impl::junit_log_helper& last_entry = get_current_log_entry(); - if(!last_entry.skipping) - { - assert(last_entry.assertion_entries.empty() || !last_entry.assertion_entries.back().sealed); - - if(!last_entry.assertion_entries.empty()) { - junit_impl::junit_log_helper::assertion_entry& log_entry = last_entry.assertion_entries.back(); - log_entry.output += "\n\n"; // quote end, CR - log_entry.sealed = true; - } - else { - last_entry.system_out.push_back("\n\n"); // quote end, CR - } - } - - last_entry.skipping = false; -} - -//____________________________________________________________________________// - -void -junit_log_formatter::entry_context_start( std::ostream& /*ostr*/, log_level ) -{ - junit_impl::junit_log_helper& last_entry = get_current_log_entry(); - if(last_entry.skipping) - return; - - std::vector< junit_impl::junit_log_helper::assertion_entry > &v_failure_or_error = last_entry.assertion_entries; - assert(!v_failure_or_error.back().sealed); - - junit_impl::junit_log_helper::assertion_entry& last_log_entry = v_failure_or_error.back(); - if(m_is_last_assertion_or_error) - { - last_log_entry.output += "\n- context:\n"; - } - else - { - last_log_entry.output += "\n\nCONTEXT:\n"; - } -} - -//____________________________________________________________________________// - -void -junit_log_formatter::entry_context_finish( std::ostream& /*ostr*/, log_level ) -{ - // no op, may be removed - junit_impl::junit_log_helper& last_entry = get_current_log_entry(); - if(last_entry.skipping) - return; - assert(!get_current_log_entry().assertion_entries.back().sealed); -} - -//____________________________________________________________________________// - -void -junit_log_formatter::log_entry_context( std::ostream& /*ostr*/, log_level , const_string context_descr ) -{ - junit_impl::junit_log_helper& last_entry = get_current_log_entry(); - if(last_entry.skipping) - return; - - assert(!last_entry.assertion_entries.back().sealed); - junit_impl::junit_log_helper::assertion_entry& last_log_entry = get_current_log_entry().assertion_entries.back(); - - last_log_entry.output += - (m_is_last_assertion_or_error ? " - '": "- '") + std::string(context_descr.begin(), context_descr.end()) + "'\n"; // quote end -} - -//____________________________________________________________________________// - - -std::string -junit_log_formatter::get_default_stream_description() const { - std::string name = framework::master_test_suite().p_name.value; - - static const std::string to_replace[] = { " ", "\"", "/", "\\", ":"}; - static const std::string replacement[] = { "_", "_" , "_", "_" , "_"}; - - name = unit_test::utils::replace_all_occurrences_of( - name, - to_replace, to_replace + sizeof(to_replace)/sizeof(to_replace[0]), - replacement, replacement + sizeof(replacement)/sizeof(replacement[0])); - - std::ifstream check_init((name + ".xml").c_str()); - if(!check_init) - return name + ".xml"; - - int index = 0; - for(; index < 100; index++) { - std::string candidate = name + "_" + utils::string_cast(index) + ".xml"; - std::ifstream file(candidate.c_str()); - if(!file) - return candidate; - } - - return name + ".xml"; -} - -} // namespace output -} // namespace unit_test -} // namespace boost - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_junit_log_formatter_IPP_020105GER diff --git a/contrib/restricted/boost/test/include/boost/test/impl/plain_report_formatter.ipp b/contrib/restricted/boost/test/include/boost/test/impl/plain_report_formatter.ipp deleted file mode 100644 index c69b895a8f..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/impl/plain_report_formatter.ipp +++ /dev/null @@ -1,218 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : plain report formatter definition -// *************************************************************************** - -#ifndef BOOST_TEST_PLAIN_REPORT_FORMATTER_IPP_020105GER -#define BOOST_TEST_PLAIN_REPORT_FORMATTER_IPP_020105GER - -// Boost.Test -#include <boost/test/output/plain_report_formatter.hpp> -#include <boost/test/utils/custom_manip.hpp> -#include <boost/test/results_collector.hpp> -#include <boost/test/unit_test_parameters.hpp> - -#include <boost/test/tree/test_unit.hpp> - -#include <boost/test/utils/basic_cstring/io.hpp> -#include <boost/test/utils/setcolor.hpp> - -// STL -#include <iomanip> -#include <boost/config/no_tr1/cmath.hpp> -#include <iostream> - -#include <boost/test/detail/suppress_warnings.hpp> - -# ifdef BOOST_NO_STDC_NAMESPACE -namespace std { using ::log10; } -# endif - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { -namespace output { - -namespace { - -typedef utils::custom_manip<struct quote_t> quote; - -template<typename T> -inline std::ostream& -operator<<( utils::custom_printer<quote> const& p, T const& value ) -{ - *p << '"' << value << '"'; - - return *p; -} - -//____________________________________________________________________________// - -void -print_stat_value( std::ostream& ostr, counter_t v, counter_t indent, counter_t total, const_string name, const_string res ) -{ - if( v == 0 ) - return; - - if( total > 0 ) - ostr << std::setw( static_cast<int>(indent) ) << "" << v << ' ' << name << ( v != 1 ? "s" : "" ) - << " out of " << total << ' ' << res << '\n'; - else - ostr << std::setw( static_cast<int>(indent) ) << "" << v << ' ' << res << ' ' << name << ( v != 1 ? "s" : "" ) << '\n'; -} - -//____________________________________________________________________________// - -} // local namespace - -// ************************************************************************** // -// ************** plain_report_formatter ************** // -// ************************************************************************** // - -void -plain_report_formatter::results_report_start( std::ostream& ostr ) -{ - m_indent = 0; - m_color_output = runtime_config::get<bool>( runtime_config::btrt_color_output ); - ostr << '\n'; -} - -//____________________________________________________________________________// - -void -plain_report_formatter::results_report_finish( std::ostream& ostr ) -{ - ostr.flush(); -} - -//____________________________________________________________________________// - -void -plain_report_formatter::test_unit_report_start( test_unit const& tu, std::ostream& ostr ) -{ - test_results const& tr = results_collector.results( tu.p_id ); - - const_string descr; - - if( tr.passed() ) - descr = "has passed"; - else if( tr.p_skipped ) - descr = "was skipped"; - else if( tr.p_timed_out ) - descr = "has timed out"; - else if( tr.p_aborted ) - descr = "was aborted"; - else - descr = "has failed"; - - ostr << std::setw( static_cast<int>(m_indent) ) << "" - << "Test " << tu.p_type_name << ' ' << quote() << tu.full_name() << ' ' << descr; - - if( tr.p_skipped ) { - ostr << "\n"; - m_indent += 2; - return; - } - - // aborted test case within failed ones, timed-out TC exclusive with failed/aborted - counter_t total_assertions = tr.p_assertions_passed + tr.p_assertions_failed; - counter_t total_tc = tr.p_test_cases_passed + tr.p_test_cases_warned + tr.p_test_cases_failed + tr.p_test_cases_skipped + tr.p_test_cases_timed_out; - - if( total_assertions > 0 || total_tc > 0 || tr.p_warnings_failed > 0) - ostr << " with:"; - - ostr << '\n'; - m_indent += 2; - - print_stat_value( ostr, tr.p_test_cases_passed , m_indent, total_tc , "test case", "passed" ); - print_stat_value( ostr, tr.p_test_cases_warned , m_indent, total_tc , "test case", "passed with warnings" ); - print_stat_value( ostr, tr.p_test_cases_failed , m_indent, total_tc , "test case", "failed" ); - print_stat_value( ostr, tr.p_test_cases_timed_out, m_indent, total_tc , "test case", "timed-out" ); - print_stat_value( ostr, tr.p_test_suites_timed_out, m_indent, tr.p_test_suites, "test suite", "timed-out" ); - print_stat_value( ostr, tr.p_test_cases_skipped, m_indent, total_tc , "test case", "skipped" ); - print_stat_value( ostr, tr.p_test_cases_aborted, m_indent, total_tc , "test case", "aborted" ); - print_stat_value( ostr, tr.p_assertions_passed , m_indent, total_assertions, "assertion", "passed" ); - print_stat_value( ostr, tr.p_assertions_failed , m_indent, total_assertions, "assertion", "failed" ); - print_stat_value( ostr, tr.p_warnings_failed , m_indent, 0 , "warning" , "failed" ); - print_stat_value( ostr, tr.p_expected_failures , m_indent, 0 , "failure" , "expected" ); - - ostr << '\n'; -} - -//____________________________________________________________________________// - -void -plain_report_formatter::test_unit_report_finish( test_unit const&, std::ostream& ) -{ - m_indent -= 2; -} - -//____________________________________________________________________________// - -void -plain_report_formatter::do_confirmation_report( test_unit const& tu, std::ostream& ostr ) -{ - test_results const& tr = results_collector.results( tu.p_id ); - - if( tr.passed() ) { - BOOST_TEST_SCOPE_SETCOLOR( m_color_output, ostr, term_attr::BRIGHT, term_color::GREEN ); - - ostr << "*** No errors detected\n"; - return; - } - - BOOST_TEST_SCOPE_SETCOLOR( m_color_output, ostr, term_attr::BRIGHT, term_color::RED ); - - if( tr.p_skipped ) { - ostr << "*** The test " << tu.p_type_name << ' ' << quote() << tu.full_name() << " was skipped" - << "; see standard output for details\n"; - return; - } - - if( tr.p_timed_out ) { - ostr << "*** The test " << tu.p_type_name << ' ' << quote() << tu.full_name() << " has timed out" - << "; see standard output for details\n"; - return; - } - - if( tr.p_aborted ) { - ostr << "*** The test " << tu.p_type_name << ' ' << quote() << tu.full_name() << " was aborted" - << "; see standard output for details\n"; - } - - if( tr.p_assertions_failed == 0 ) { - if( !tr.p_aborted ) - ostr << "*** Errors were detected in the test " << tu.p_type_name << ' ' << quote() << tu.full_name() - << "; see standard output for details\n"; - return; - } - - counter_t num_failures = tr.p_assertions_failed; - - ostr << "*** " << num_failures << " failure" << ( num_failures != 1 ? "s are" : " is" ) << " detected"; - - if( tr.p_expected_failures > 0 ) - ostr << " (" << tr.p_expected_failures << " failure" << ( tr.p_expected_failures != 1 ? "s are" : " is" ) << " expected)"; - - ostr << " in the test " << tu.p_type_name << " " << quote() << tu.full_name() << "\n"; -} - -//____________________________________________________________________________// - -} // namespace output -} // namespace unit_test -} // namespace boost - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_PLAIN_REPORT_FORMATTER_IPP_020105GER diff --git a/contrib/restricted/boost/test/include/boost/test/impl/progress_monitor.ipp b/contrib/restricted/boost/test/include/boost/test/impl/progress_monitor.ipp deleted file mode 100644 index 4aacb357a4..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/impl/progress_monitor.ipp +++ /dev/null @@ -1,189 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : implements simple text based progress monitor -// *************************************************************************** - -#ifndef BOOST_TEST_PROGRESS_MONITOR_IPP_020105GER -#define BOOST_TEST_PROGRESS_MONITOR_IPP_020105GER - -// Boost.Test -#include <boost/test/progress_monitor.hpp> -#include <boost/test/unit_test_parameters.hpp> - -#include <boost/test/utils/setcolor.hpp> - -#include <boost/test/tree/test_unit.hpp> -#include <boost/test/tree/test_case_counter.hpp> -#include <boost/test/tree/traverse.hpp> - -// Boost -#include <boost/scoped_ptr.hpp> - -#include <boost/test/detail/suppress_warnings.hpp> - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { - -// ************************************************************************** // -// ************** progress_monitor ************** // -// ************************************************************************** // - -struct progress_display { - progress_display( counter_t expected_count, std::ostream& os ) - : m_os(os) - , m_count( 0 ) - , m_expected_count( expected_count ) - , m_next_tic_count( 0 ) - , m_tic( 0 ) - { - - m_os << "\n0% 10 20 30 40 50 60 70 80 90 100%" - << "\n|----|----|----|----|----|----|----|----|----|----|" - << std::endl; - - if( !m_expected_count ) - m_expected_count = 1; // prevent divide by zero - } - - unsigned long operator+=( unsigned long increment ) - { - if( (m_count += increment) < m_next_tic_count ) - return m_count; - - // use of floating point ensures that both large and small counts - // work correctly. static_cast<>() is also used several places - // to suppress spurious compiler warnings. - unsigned int tics_needed = static_cast<unsigned int>( - (static_cast<double>(m_count)/m_expected_count)*50.0 ); - - do { - m_os << '*' << std::flush; - } while( ++m_tic < tics_needed ); - - m_next_tic_count = static_cast<unsigned long>((m_tic/50.0) * m_expected_count); - - if( m_count == m_expected_count ) { - if( m_tic < 51 ) - m_os << '*'; - - m_os << std::endl; - } - - return m_count; - } - unsigned long operator++() { return operator+=( 1 ); } - unsigned long count() const { return m_count; } - -private: - BOOST_DELETED_FUNCTION(progress_display(progress_display const&)) - BOOST_DELETED_FUNCTION(progress_display& operator=(progress_display const&)) - - std::ostream& m_os; // may not be present in all imps - - unsigned long m_count; - unsigned long m_expected_count; - unsigned long m_next_tic_count; - unsigned int m_tic; -}; - -namespace { - -struct progress_monitor_impl { - // Constructor - progress_monitor_impl() - : m_stream( &std::cout ) - , m_color_output( false ) - { - } - - std::ostream* m_stream; - scoped_ptr<progress_display> m_progress_display; - bool m_color_output; -}; - -progress_monitor_impl& s_pm_impl() { static progress_monitor_impl the_inst; return the_inst; } - -#define PM_SCOPED_COLOR() \ - BOOST_TEST_SCOPE_SETCOLOR( s_pm_impl().m_color_output, *s_pm_impl().m_stream, term_attr::BRIGHT, term_color::MAGENTA ) - -} // local namespace - -//____________________________________________________________________________// - -BOOST_TEST_SINGLETON_CONS_IMPL(progress_monitor_t) - -//____________________________________________________________________________// - -void -progress_monitor_t::test_start( counter_t test_cases_amount, test_unit_id ) -{ - s_pm_impl().m_color_output = runtime_config::get<bool>( runtime_config::btrt_color_output ); - - PM_SCOPED_COLOR(); - - s_pm_impl().m_progress_display.reset( new progress_display( test_cases_amount, *s_pm_impl().m_stream ) ); -} - -//____________________________________________________________________________// - -void -progress_monitor_t::test_aborted() -{ - PM_SCOPED_COLOR(); - - (*s_pm_impl().m_progress_display) += s_pm_impl().m_progress_display->count(); -} - -//____________________________________________________________________________// - -void -progress_monitor_t::test_unit_finish( test_unit const& tu, unsigned long ) -{ - PM_SCOPED_COLOR(); - - if( tu.p_type == TUT_CASE ) - ++(*s_pm_impl().m_progress_display); -} - -//____________________________________________________________________________// - -void -progress_monitor_t::test_unit_skipped( test_unit const& tu, const_string /*reason*/ ) -{ - PM_SCOPED_COLOR(); - - test_case_counter tcc; - traverse_test_tree( tu, tcc ); - - (*s_pm_impl().m_progress_display) += tcc.p_count; -} - -//____________________________________________________________________________// - -void -progress_monitor_t::set_stream( std::ostream& ostr ) -{ - s_pm_impl().m_stream = &ostr; -} - -//____________________________________________________________________________// - -#undef PM_SCOPED_COLOR - -} // namespace unit_test -} // namespace boost - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_PROGRESS_MONITOR_IPP_020105GER diff --git a/contrib/restricted/boost/test/include/boost/test/impl/results_collector.ipp b/contrib/restricted/boost/test/include/boost/test/impl/results_collector.ipp deleted file mode 100644 index dfcd55fb24..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/impl/results_collector.ipp +++ /dev/null @@ -1,349 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -/// @file -/// Test results collecting facility. -/// -// *************************************************************************** - -#ifndef BOOST_TEST_RESULTS_COLLECTOR_IPP_021105GER -#define BOOST_TEST_RESULTS_COLLECTOR_IPP_021105GER - -// Boost.Test -#include <boost/test/unit_test_log.hpp> -#include <boost/test/results_collector.hpp> -#include <boost/test/framework.hpp> -#include <boost/test/execution_monitor.hpp> - -#include <boost/test/tree/test_unit.hpp> -#include <boost/test/tree/visitor.hpp> -#include <boost/test/tree/test_case_counter.hpp> -#include <boost/test/tree/traverse.hpp> - -// Boost -#include <boost/cstdlib.hpp> - -// STL -#include <map> - -#include <boost/test/detail/suppress_warnings.hpp> - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { - -// ************************************************************************** // -// ************** test_results ************** // -// ************************************************************************** // - -test_results::test_results() -{ - clear(); -} - -//____________________________________________________________________________// - -bool -test_results::passed() const -{ - // if it is skipped, it is not passed. However, if any children is not failed/aborted - // then their skipped status is not taken into account. - return !p_skipped && - p_test_cases_failed == 0 && - p_assertions_failed <= p_expected_failures && - // p_test_cases_skipped == 0 && - !p_timed_out && - p_test_cases_timed_out == 0 && - !aborted(); -} - -//____________________________________________________________________________// - -bool -test_results::aborted() const -{ - return p_aborted; -} - -//____________________________________________________________________________// - -bool -test_results::skipped() const -{ - return p_skipped; -} - -//____________________________________________________________________________// - -int -test_results::result_code() const -{ - return passed() ? exit_success - : ( (p_assertions_failed > p_expected_failures || p_skipped || p_timed_out || p_test_cases_timed_out ) - ? exit_test_failure - : exit_exception_failure ); -} - -//____________________________________________________________________________// - -void -test_results::operator+=( test_results const& tr ) -{ - p_test_suites.value += tr.p_test_suites; - p_assertions_passed.value += tr.p_assertions_passed; - p_assertions_failed.value += tr.p_assertions_failed; - p_warnings_failed.value += tr.p_warnings_failed; - p_test_cases_passed.value += tr.p_test_cases_passed; - p_test_cases_warned.value += tr.p_test_cases_warned; - p_test_cases_failed.value += tr.p_test_cases_failed; - p_test_cases_skipped.value += tr.p_test_cases_skipped; - p_test_cases_aborted.value += tr.p_test_cases_aborted; - p_test_cases_timed_out.value += tr.p_test_cases_timed_out; - p_test_suites_timed_out.value += tr.p_test_suites_timed_out; - p_duration_microseconds.value += tr.p_duration_microseconds; -} - -//____________________________________________________________________________// - -void -test_results::clear() -{ - p_test_suites.value = 0; - p_assertions_passed.value = 0; - p_assertions_failed.value = 0; - p_warnings_failed.value = 0; - p_expected_failures.value = 0; - p_test_cases_passed.value = 0; - p_test_cases_warned.value = 0; - p_test_cases_failed.value = 0; - p_test_cases_skipped.value = 0; - p_test_cases_aborted.value = 0; - p_test_cases_timed_out.value = 0; - p_test_suites_timed_out.value = 0; - p_duration_microseconds.value= 0; - p_aborted.value = false; - p_skipped.value = false; - p_timed_out.value = false; -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** results_collector ************** // -// ************************************************************************** // - -namespace { - -struct results_collector_impl { - std::map<test_unit_id,test_results> m_results_store; -}; - -results_collector_impl& s_rc_impl() { static results_collector_impl the_inst; return the_inst; } - -// deletes the entries of results_collector_impl -class clear_subtree_result : public test_tree_visitor { -public: - clear_subtree_result(results_collector_impl& store) - : m_store( store ) - {} - -private: - bool visit( test_unit const& tu) BOOST_OVERRIDE - { - typedef std::map<test_unit_id,test_results>::iterator iterator; - iterator found = m_store.m_results_store.find(tu.p_id); - if(found != m_store.m_results_store.end()) { - m_store.m_results_store.erase( found ); - } - return true; - } - - results_collector_impl& m_store; -}; - -} // local namespace - -//____________________________________________________________________________// - -BOOST_TEST_SINGLETON_CONS_IMPL( results_collector_t ) - -//____________________________________________________________________________// - -void -results_collector_t::test_start( counter_t, test_unit_id id ) -{ - // deletes the results under id only - clear_subtree_result tree_clear(s_rc_impl()); - traverse_test_tree( id, tree_clear ); -} - -//____________________________________________________________________________// - -void -results_collector_t::test_unit_start( test_unit const& tu ) -{ - // init test_results entry - test_results& tr = s_rc_impl().m_results_store[tu.p_id]; - - tr.clear(); - - tr.p_expected_failures.value = tu.p_expected_failures; -} - -//____________________________________________________________________________// - -class results_collect_helper : public test_tree_visitor { -public: - explicit results_collect_helper( test_results& tr, test_unit const& ts ) : m_tr( tr ), m_ts( ts ) {} - - void visit( test_case const& tc ) BOOST_OVERRIDE - { - test_results const& tr = results_collector.results( tc.p_id ); - m_tr += tr; - - if( tr.passed() ) { - if( tr.p_warnings_failed ) - m_tr.p_test_cases_warned.value++; - else - m_tr.p_test_cases_passed.value++; - } - else if( tr.p_timed_out ) { - m_tr.p_test_cases_timed_out.value++; - } - else if( tr.p_skipped || !tc.is_enabled() ) { - m_tr.p_test_cases_skipped.value++; - } - else { - if( tr.p_aborted ) - m_tr.p_test_cases_aborted.value++; - - m_tr.p_test_cases_failed.value++; - } - } - bool test_suite_start( test_suite const& ts ) BOOST_OVERRIDE - { - if( m_ts.p_id == ts.p_id ) - return true; - - m_tr += results_collector.results( ts.p_id ); - m_tr.p_test_suites.value++; - - if( results_collector.results( ts.p_id ).p_timed_out ) - m_tr.p_test_suites_timed_out.value++; - return false; - } - -private: - // Data members - test_results& m_tr; - test_unit const& m_ts; -}; - -//____________________________________________________________________________// - -void -results_collector_t::test_unit_finish( test_unit const& tu, unsigned long elapsed_in_microseconds ) -{ - test_results & tr = s_rc_impl().m_results_store[tu.p_id]; - if( tu.p_type == TUT_SUITE ) { - results_collect_helper ch( tr, tu ); - traverse_test_tree( tu, ch, true ); // true to ignore the status: we need to count the skipped/disabled tests - } - else { - bool num_failures_match = tr.p_aborted || tr.p_assertions_failed >= tr.p_expected_failures; - if( !num_failures_match ) - BOOST_TEST_FRAMEWORK_MESSAGE( "Test case " << tu.full_name() << " has fewer failures than expected" ); - - bool check_any_assertions = tr.p_aborted || (tr.p_assertions_failed != 0) || (tr.p_assertions_passed != 0); - if( !check_any_assertions ) - BOOST_TEST_FRAMEWORK_MESSAGE( "Test case " << tu.full_name() << " did not check any assertions" ); - } - tr.p_duration_microseconds.value = elapsed_in_microseconds; -} - -//____________________________________________________________________________// - -void -results_collector_t::test_unit_skipped( test_unit const& tu, const_string /*reason*/ ) -{ - test_results& tr = s_rc_impl().m_results_store[tu.p_id]; - tr.clear(); - - tr.p_skipped.value = true; - - if( tu.p_type == TUT_SUITE ) { - test_case_counter tcc(true); - traverse_test_tree( tu, tcc, true ); // true because need to count the disabled tests/units - - tr.p_test_cases_skipped.value = tcc.p_count; - } -} - -//____________________________________________________________________________// - -void -results_collector_t::test_unit_timed_out(test_unit const& tu) -{ - test_results& tr = s_rc_impl().m_results_store[tu.p_id]; - tr.p_timed_out.value = true; -} - -//____________________________________________________________________________// - -void -results_collector_t::assertion_result( unit_test::assertion_result ar ) -{ - test_results& tr = s_rc_impl().m_results_store[framework::current_test_case_id()]; - - switch( ar ) { - case AR_PASSED: tr.p_assertions_passed.value++; break; - case AR_FAILED: tr.p_assertions_failed.value++; break; - case AR_TRIGGERED: tr.p_warnings_failed.value++; break; - } - - if( tr.p_assertions_failed == 1 ) - first_failed_assertion(); -} - -//____________________________________________________________________________// - -void -results_collector_t::exception_caught( execution_exception const& ex) -{ - test_results& tr = s_rc_impl().m_results_store[framework::current_test_case_id()]; - - tr.p_assertions_failed.value++; - if( ex.code() == execution_exception::timeout_error ) { - tr.p_timed_out.value = true; - } -} - -//____________________________________________________________________________// - -void -results_collector_t::test_unit_aborted( test_unit const& tu ) -{ - s_rc_impl().m_results_store[tu.p_id].p_aborted.value = true; -} - -//____________________________________________________________________________// - -test_results const& -results_collector_t::results( test_unit_id id ) const -{ - return s_rc_impl().m_results_store[id]; -} - -//____________________________________________________________________________// - -} // namespace unit_test -} // namespace boost - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_RESULTS_COLLECTOR_IPP_021105GER diff --git a/contrib/restricted/boost/test/include/boost/test/impl/results_reporter.ipp b/contrib/restricted/boost/test/include/boost/test/impl/results_reporter.ipp deleted file mode 100644 index 90dc80ab51..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/impl/results_reporter.ipp +++ /dev/null @@ -1,197 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : result reporting facilities -// *************************************************************************** - -#ifndef BOOST_TEST_RESULTS_REPORTER_IPP_020105GER -#define BOOST_TEST_RESULTS_REPORTER_IPP_020105GER - -// Boost.Test -#include <boost/test/results_reporter.hpp> -#include <boost/test/results_collector.hpp> -#include <boost/test/framework.hpp> - -#include <boost/test/output/plain_report_formatter.hpp> -#include <boost/test/output/xml_report_formatter.hpp> - -#include <boost/test/tree/visitor.hpp> -#include <boost/test/tree/test_unit.hpp> -#include <boost/test/tree/traverse.hpp> - -// Boost -#include <boost/scoped_ptr.hpp> -#include <boost/io/ios_state.hpp> -typedef ::boost::io::ios_base_all_saver io_saver_type; - -// STL -#include <iostream> - -#include <boost/test/detail/suppress_warnings.hpp> - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { -namespace results_reporter { - -// ************************************************************************** // -// ************** result reporter implementation ************** // -// ************************************************************************** // - -namespace { - -struct results_reporter_impl : test_tree_visitor { - // Constructor - results_reporter_impl() - : m_stream( &std::cerr ) - , m_stream_state_saver( new io_saver_type( std::cerr ) ) - , m_report_level( CONFIRMATION_REPORT ) - , m_formatter( new output::plain_report_formatter ) - {} - - // test tree visitor interface implementation - void visit( test_case const& tc ) BOOST_OVERRIDE - { - m_formatter->test_unit_report_start( tc, *m_stream ); - m_formatter->test_unit_report_finish( tc, *m_stream ); - } - bool test_suite_start( test_suite const& ts ) BOOST_OVERRIDE - { - m_formatter->test_unit_report_start( ts, *m_stream ); - - if( m_report_level == DETAILED_REPORT && !results_collector.results( ts.p_id ).p_skipped ) - return true; - - m_formatter->test_unit_report_finish( ts, *m_stream ); - return false; - } - void test_suite_finish( test_suite const& ts ) BOOST_OVERRIDE - { - m_formatter->test_unit_report_finish( ts, *m_stream ); - } - - typedef scoped_ptr<io_saver_type> saver_ptr; - - // Data members - std::ostream* m_stream; - saver_ptr m_stream_state_saver; - report_level m_report_level; - scoped_ptr<format> m_formatter; -}; - -results_reporter_impl& s_rr_impl() { static results_reporter_impl the_inst; return the_inst; } - -} // local namespace - -// ************************************************************************** // -// ************** report configuration ************** // -// ************************************************************************** // - -void -set_level( report_level l ) -{ - if( l != INV_REPORT_LEVEL ) - s_rr_impl().m_report_level = l; -} - -//____________________________________________________________________________// - -void -set_stream( std::ostream& ostr ) -{ - s_rr_impl().m_stream = &ostr; - s_rr_impl().m_stream_state_saver.reset( new io_saver_type( ostr ) ); -} - -//____________________________________________________________________________// - -std::ostream& -get_stream() -{ - return *s_rr_impl().m_stream; -} - -//____________________________________________________________________________// - -void -set_format( output_format rf ) -{ - switch( rf ) { - default: - case OF_CLF: - set_format( new output::plain_report_formatter ); - break; - case OF_XML: - set_format( new output::xml_report_formatter ); - break; - } -} - -//____________________________________________________________________________// - -void -set_format( results_reporter::format* f ) -{ - if( f ) - s_rr_impl().m_formatter.reset( f ); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** report initiation ************** // -// ************************************************************************** // - -void -make_report( report_level l, test_unit_id id ) -{ - if( l == INV_REPORT_LEVEL ) - l = s_rr_impl().m_report_level; - - if( l == NO_REPORT ) - return; - - if( id == INV_TEST_UNIT_ID ) - id = framework::master_test_suite().p_id; - - s_rr_impl().m_stream_state_saver->restore(); - - report_level bkup = s_rr_impl().m_report_level; - s_rr_impl().m_report_level = l; - - s_rr_impl().m_formatter->results_report_start( *s_rr_impl().m_stream ); - - switch( l ) { - case CONFIRMATION_REPORT: - s_rr_impl().m_formatter->do_confirmation_report( framework::get<test_unit>( id ), *s_rr_impl().m_stream ); - break; - case SHORT_REPORT: - case DETAILED_REPORT: - traverse_test_tree( id, s_rr_impl() ); - break; - default: - break; - } - - s_rr_impl().m_formatter->results_report_finish( *s_rr_impl().m_stream ); - s_rr_impl().m_report_level = bkup; -} - -//____________________________________________________________________________// - -} // namespace results_reporter -} // namespace unit_test -} // namespace boost - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_RESULTS_REPORTER_IPP_020105GER diff --git a/contrib/restricted/boost/test/include/boost/test/impl/test_framework_init_observer.ipp b/contrib/restricted/boost/test/include/boost/test/impl/test_framework_init_observer.ipp deleted file mode 100644 index 4e9f49f700..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/impl/test_framework_init_observer.ipp +++ /dev/null @@ -1,88 +0,0 @@ -// (c) Copyright Raffi Enficiaud 2017. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -//! @file -//! An observer for monitoring the success/failure of the other observers -// *************************************************************************** - -#ifndef BOOST_TEST_FRAMEWORK_INIT_OBSERVER_IPP_021105GER -#define BOOST_TEST_FRAMEWORK_INIT_OBSERVER_IPP_021105GER - -// Boost.Test -#include <boost/test/test_framework_init_observer.hpp> -#include <boost/test/framework.hpp> -#include <boost/test/detail/suppress_warnings.hpp> - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { - - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** framework_init_observer_t ************** // -// ************************************************************************** // - -void -framework_init_observer_t::clear() -{ - m_has_failure = false; -} - -//____________________________________________________________________________// - -void -framework_init_observer_t::test_start( counter_t, test_unit_id ) -{ - clear(); -} - -//____________________________________________________________________________// - -void -framework_init_observer_t::assertion_result( unit_test::assertion_result ar ) -{ - switch( ar ) { - case AR_FAILED: m_has_failure = true; break; - default: - break; - } -} - -//____________________________________________________________________________// - -void -framework_init_observer_t::exception_caught( execution_exception const& ) -{ - m_has_failure = true; -} - -void -framework_init_observer_t::test_aborted() -{ - m_has_failure = true; -} - - -//____________________________________________________________________________// - -bool -framework_init_observer_t::has_failed() const -{ - return m_has_failure; -} - -//____________________________________________________________________________// - -} // namespace unit_test -} // namespace boost - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_FRAMEWORK_INIT_OBSERVER_IPP_021105GER diff --git a/contrib/restricted/boost/test/include/boost/test/impl/test_tools.ipp b/contrib/restricted/boost/test/include/boost/test/impl/test_tools.ipp deleted file mode 100644 index 03b631ebba..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/impl/test_tools.ipp +++ /dev/null @@ -1,854 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : supplies offline implementation for the Test Tools -// *************************************************************************** - -#ifndef BOOST_TEST_TEST_TOOLS_IPP_012205GER -#define BOOST_TEST_TEST_TOOLS_IPP_012205GER - -// Boost.Test -#include <boost/test/test_tools.hpp> -#include <boost/test/unit_test_log.hpp> -#include <boost/test/tools/context.hpp> -#include <boost/test/tools/output_test_stream.hpp> - -#include <boost/test/tools/detail/fwd.hpp> -#include <boost/test/tools/detail/print_helper.hpp> - -#include <boost/test/framework.hpp> -#include <boost/test/tree/test_unit.hpp> -#include <boost/test/execution_monitor.hpp> // execution_aborted - -#include <boost/test/detail/throw_exception.hpp> - -#include <boost/test/utils/algorithm.hpp> - -// Boost -#include <boost/config.hpp> - -// STL -#include <fstream> -#include <string> -#include <cstring> -#include <cctype> -#include <cwchar> -#include <stdexcept> -#include <vector> -#include <utility> -#include <ios> - -// !! should we use #include <cstdarg> -#include <stdarg.h> - -#include <boost/test/detail/suppress_warnings.hpp> - -//____________________________________________________________________________// - -# ifdef BOOST_NO_STDC_NAMESPACE -namespace std { using ::strcmp; using ::strlen; using ::isprint; } -#if !defined( BOOST_NO_CWCHAR ) -namespace std { using ::wcscmp; } -#endif -# endif - - -namespace boost { -namespace unit_test { - // local static variable, needed here for visibility reasons - lazy_ostream lazy_ostream::inst = lazy_ostream(); -}} - -namespace boost { -namespace test_tools { -namespace tt_detail { - -// ************************************************************************** // -// ************** print_log_value ************** // -// ************************************************************************** // - -void -print_log_value<bool>::operator()( std::ostream& ostr, bool t ) -{ - ostr << std::boolalpha << t; -} - -void -print_log_value<char>::operator()( std::ostream& ostr, char t ) -{ - if( (std::isprint)( static_cast<unsigned char>(t) ) ) - ostr << '\'' << t << '\''; - else - ostr << std::hex -#if BOOST_TEST_USE_STD_LOCALE - << std::showbase -#else - << "0x" -#endif - << static_cast<int>(t); -} - -//____________________________________________________________________________// - -void -print_log_value<unsigned char>::operator()( std::ostream& ostr, unsigned char t ) -{ - ostr << std::hex - // showbase is only available for new style streams: -#if BOOST_TEST_USE_STD_LOCALE - << std::showbase -#else - << "0x" -#endif - << static_cast<int>(t); -} - -//____________________________________________________________________________// - -void -print_log_value<wchar_t>::operator()( std::ostream& ostr, wchar_t r ) -{ - std::mbstate_t state; - std::string mb(MB_CUR_MAX, '\0'); - std::size_t ret = std::wcrtomb(&mb[0], r, &state); - if( ret > 0) { - ostr << mb; - } - else { - ostr << "(wchar_t unable to convert)"; - } -} - -//____________________________________________________________________________// - -void -print_log_value<char const*>::operator()( std::ostream& ostr, char const* t ) -{ - ostr << ( t ? t : "null string" ); -} - -//____________________________________________________________________________// - -void -print_log_value<wchar_t const*>::operator()( std::ostream& ostr, wchar_t const* t ) -{ - if(t) { - ostr << static_cast<const void*>(t); - } - else { - ostr << "null w-string"; - } -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** TOOL BOX Implementation ************** // -// ************************************************************************** // - -using ::boost::unit_test::lazy_ostream; - -static char const* check_str [] = { " == ", " != ", " < " , " <= ", " > " , " >= " }; -static char const* rever_str [] = { " != ", " == ", " >= ", " > " , " <= ", " < " }; - -template<typename OutStream> -void -format_report( OutStream& os, assertion_result const& pr, unit_test::lazy_ostream const& assertion_descr, - tool_level tl, check_type ct, - std::size_t num_args, va_list args, - char const* prefix, char const* suffix ) -{ - using namespace unit_test; - - switch( ct ) { - case CHECK_PRED: - os << prefix << assertion_descr << suffix; - - if( !pr.has_empty_message() ) - os << ". " << pr.message(); - break; - - case CHECK_BUILT_ASSERTION: { - os << prefix << assertion_descr << suffix; - - if( tl != PASS ) { - const_string details_message = pr.message(); - - if( !details_message.is_empty() ) { - os << details_message; - } - } - break; - } - - case CHECK_MSG: - if( tl == PASS ) - os << prefix << "'" << assertion_descr << "'" << suffix; - else - os << assertion_descr; - - if( !pr.has_empty_message() ) - os << ". " << pr.message(); - break; - - case CHECK_EQUAL: - case CHECK_NE: - case CHECK_LT: - case CHECK_LE: - case CHECK_GT: - case CHECK_GE: { - char const* arg1_descr = va_arg( args, char const* ); - lazy_ostream const* arg1_val = va_arg( args, lazy_ostream const* ); - char const* arg2_descr = va_arg( args, char const* ); - lazy_ostream const* arg2_val = va_arg( args, lazy_ostream const* ); - - os << prefix << arg1_descr << check_str[ct-CHECK_EQUAL] << arg2_descr << suffix; - - if( tl != PASS ) - os << " [" << *arg1_val << rever_str[ct-CHECK_EQUAL] << *arg2_val << "]" ; - - if( !pr.has_empty_message() ) - os << ". " << pr.message(); - break; - } - - case CHECK_CLOSE: - case CHECK_CLOSE_FRACTION: { - char const* arg1_descr = va_arg( args, char const* ); - lazy_ostream const* arg1_val = va_arg( args, lazy_ostream const* ); - char const* arg2_descr = va_arg( args, char const* ); - lazy_ostream const* arg2_val = va_arg( args, lazy_ostream const* ); - /* toler_descr = */ va_arg( args, char const* ); - lazy_ostream const* toler_val = va_arg( args, lazy_ostream const* ); - - os << "difference{" << pr.message() - << "} between " << arg1_descr << "{" << *arg1_val - << "} and " << arg2_descr << "{" << *arg2_val - << ( tl == PASS ? "} doesn't exceed " : "} exceeds " ) - << *toler_val; - if( ct == CHECK_CLOSE ) - os << "%"; - break; - } - case CHECK_SMALL: { - char const* arg1_descr = va_arg( args, char const* ); - lazy_ostream const* arg1_val = va_arg( args, lazy_ostream const* ); - /* toler_descr = */ va_arg( args, char const* ); - lazy_ostream const* toler_val = va_arg( args, lazy_ostream const* ); - - os << "absolute value of " << arg1_descr << "{" << *arg1_val << "}" - << ( tl == PASS ? " doesn't exceed " : " exceeds " ) - << *toler_val; - - if( !pr.has_empty_message() ) - os << ". " << pr.message(); - break; - } - - case CHECK_PRED_WITH_ARGS: { - std::vector< std::pair<char const*, lazy_ostream const*> > args_copy; - args_copy.reserve( num_args ); - for( std::size_t i = 0; i < num_args; ++i ) { - char const* desc = va_arg( args, char const* ); - lazy_ostream const* value = va_arg( args, lazy_ostream const* ); - args_copy.push_back( std::make_pair( desc, value ) ); - } - - os << prefix << assertion_descr; - - // print predicate call description - os << "( "; - for( std::size_t i = 0; i < num_args; ++i ) { - os << args_copy[i].first; - - if( i != num_args-1 ) - os << ", "; - } - os << " )" << suffix; - - if( tl != PASS ) { - os << " for ( "; - for( std::size_t i = 0; i < num_args; ++i ) { - os << *args_copy[i].second; - - if( i != num_args-1 ) - os << ", "; - } - os << " )"; - } - - if( !pr.has_empty_message() ) - os << ". " << pr.message(); - break; - } - - case CHECK_EQUAL_COLL: { - char const* left_begin_descr = va_arg( args, char const* ); - char const* left_end_descr = va_arg( args, char const* ); - char const* right_begin_descr = va_arg( args, char const* ); - char const* right_end_descr = va_arg( args, char const* ); - - os << prefix << "{ " << left_begin_descr << ", " << left_end_descr << " } == { " - << right_begin_descr << ", " << right_end_descr << " }" - << suffix; - - if( !pr.has_empty_message() ) - os << ". " << pr.message(); - break; - } - - case CHECK_BITWISE_EQUAL: { - char const* left_descr = va_arg( args, char const* ); - char const* right_descr = va_arg( args, char const* ); - - os << prefix << left_descr << " =.= " << right_descr << suffix; - - if( !pr.has_empty_message() ) - os << ". " << pr.message(); - break; - } - } -} - -//____________________________________________________________________________// - -bool -report_assertion( assertion_result const& ar, - lazy_ostream const& assertion_descr, - const_string file_name, - std::size_t line_num, - tool_level tl, - check_type ct, - std::size_t num_args, ... ) -{ - using namespace unit_test; - - if( !framework::test_in_progress() ) { - // in case no test is in progress, we do not throw anything: - // raising an exception here may result in raising an exception in a destructor of a global fixture - // which will abort the process - // We flag this as aborted instead - - //BOOST_TEST_I_ASSRT( framework::current_test_case_id() != INV_TEST_UNIT_ID, - // std::runtime_error( "Can't use testing tools outside of test case implementation." ) ); - - framework::test_aborted(); - return false; - } - - - if( !!ar ) - tl = PASS; - - log_level ll; - char const* prefix; - char const* suffix; - - switch( tl ) { - case PASS: - ll = log_successful_tests; - prefix = "check "; - suffix = " has passed"; - break; - case WARN: - ll = log_warnings; - prefix = "condition "; - suffix = " is not satisfied"; - break; - case CHECK: - ll = log_all_errors; - prefix = "check "; - suffix = " has failed"; - break; - case REQUIRE: - ll = log_fatal_errors; - prefix = "critical check "; - suffix = " has failed"; - break; - default: - return true; - } - - unit_test_log << unit_test::log::begin( file_name, line_num ) << ll; - va_list args; - va_start( args, num_args ); - - format_report( unit_test_log, ar, assertion_descr, tl, ct, num_args, args, prefix, suffix ); - - va_end( args ); - unit_test_log << unit_test::log::end(); - - switch( tl ) { - case PASS: - framework::assertion_result( AR_PASSED ); - return true; - - case WARN: - framework::assertion_result( AR_TRIGGERED ); - return false; - - case CHECK: - framework::assertion_result( AR_FAILED ); - return false; - - case REQUIRE: - framework::assertion_result( AR_FAILED ); - framework::test_unit_aborted( framework::current_test_unit() ); - BOOST_TEST_I_THROW( execution_aborted() ); - // the previous line either throws or aborts and the return below is not reached - // return false; - BOOST_TEST_UNREACHABLE_RETURN(false); - } - - return true; -} - -//____________________________________________________________________________// - -assertion_result -format_assertion_result( const_string expr_val, const_string details ) -{ - assertion_result res(false); - - bool starts_new_line = first_char( expr_val ) == '\n'; - - if( !starts_new_line && !expr_val.is_empty() ) - res.message().stream() << " [" << expr_val << "]"; - - if( !details.is_empty() ) { - if( first_char(details) != '[' ) - res.message().stream() << ": "; - else - res.message().stream() << " "; - - res.message().stream() << details; - } - - if( starts_new_line ) - res.message().stream() << "." << expr_val; - - return res; -} - -//____________________________________________________________________________// - -BOOST_TEST_DECL std::string -prod_report_format( assertion_result const& ar, unit_test::lazy_ostream const& assertion_descr, check_type ct, std::size_t num_args, ... ) -{ - std::ostringstream msg_buff; - - va_list args; - va_start( args, num_args ); - - format_report( msg_buff, ar, assertion_descr, CHECK, ct, num_args, args, "assertion ", " failed" ); - - va_end( args ); - - return msg_buff.str(); -} - -//____________________________________________________________________________// - -assertion_result -equal_impl( char const* left, char const* right ) -{ - return (left && right) ? std::strcmp( left, right ) == 0 : (left == right); -} - -//____________________________________________________________________________// - -#if !defined( BOOST_NO_CWCHAR ) - -assertion_result -equal_impl( wchar_t const* left, wchar_t const* right ) -{ - return (left && right) ? std::wcscmp( left, right ) == 0 : (left == right); -} - -#endif // !defined( BOOST_NO_CWCHAR ) - -//____________________________________________________________________________// - -bool -is_defined_impl( const_string symbol_name, const_string symbol_value ) -{ - symbol_value.trim_left( 2 ); - return symbol_name != symbol_value; -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** context_frame ************** // -// ************************************************************************** // - -context_frame::context_frame( ::boost::unit_test::lazy_ostream const& context_descr ) -: m_frame_id( unit_test::framework::add_context( context_descr, true ) ) -{ -} - -//____________________________________________________________________________// - -context_frame::~context_frame() -{ - unit_test::framework::clear_context( m_frame_id ); -} - -//____________________________________________________________________________// - -context_frame::operator bool() -{ - return true; -} - -//____________________________________________________________________________// - -} // namespace tt_detail - -// ************************************************************************** // -// ************** output_test_stream ************** // -// ************************************************************************** // - -struct output_test_stream::Impl -{ - std::fstream m_pattern; - bool m_match_or_save; - bool m_text_or_binary; - std::string m_synced_string; - - char get_char() - { - char res = 0; - do { - m_pattern.get( res ); - } while( m_text_or_binary && res == '\r' && !m_pattern.fail() && !m_pattern.eof() ); - - return res; - } - - void check_and_fill( assertion_result& res ) - { - if( !res.p_predicate_value ) - res.message() << "Output content: \"" << m_synced_string << '\"'; - } -}; - -//____________________________________________________________________________// - -output_test_stream::output_test_stream( const_string pattern_file_name, bool match_or_save, bool text_or_binary ) -: m_pimpl( new Impl ) -{ - if( !pattern_file_name.is_empty() ) { - std::ios::openmode m = match_or_save ? std::ios::in : std::ios::out; - if( !text_or_binary ) - m |= std::ios::binary; - - m_pimpl->m_pattern.open( pattern_file_name.begin(), m ); - - if( !m_pimpl->m_pattern.is_open() ) - BOOST_TEST_FRAMEWORK_MESSAGE( "Can't open pattern file " << pattern_file_name << " for " << (match_or_save ? "reading" : "writing") ); - } - - m_pimpl->m_match_or_save = match_or_save; - m_pimpl->m_text_or_binary = text_or_binary; -} - -//____________________________________________________________________________// - -output_test_stream::~output_test_stream() -{ - delete m_pimpl; -} - -//____________________________________________________________________________// - -assertion_result -output_test_stream::is_empty( bool flush_stream ) -{ - sync(); - - assertion_result res( m_pimpl->m_synced_string.empty() ); - - m_pimpl->check_and_fill( res ); - - if( flush_stream ) - flush(); - - return res; -} - -//____________________________________________________________________________// - -assertion_result -output_test_stream::check_length( std::size_t length_, bool flush_stream ) -{ - sync(); - - assertion_result res( m_pimpl->m_synced_string.length() == length_ ); - - m_pimpl->check_and_fill( res ); - - if( flush_stream ) - flush(); - - return res; -} - -//____________________________________________________________________________// - -assertion_result -output_test_stream::is_equal( const_string arg, bool flush_stream ) -{ - sync(); - - assertion_result res( const_string( m_pimpl->m_synced_string ) == arg ); - - m_pimpl->check_and_fill( res ); - - if( flush_stream ) - flush(); - - return res; -} - -//____________________________________________________________________________// - -std::string pretty_print_log(std::string str) { - - static const std::string to_replace[] = { "\r", "\n" }; - static const std::string replacement[] = { "\\r", "\\n" }; - - return unit_test::utils::replace_all_occurrences_of( - str, - to_replace, to_replace + sizeof(to_replace)/sizeof(to_replace[0]), - replacement, replacement + sizeof(replacement)/sizeof(replacement[0])); -} - -assertion_result -output_test_stream::match_pattern( bool flush_stream ) -{ - const std::string::size_type n_chars_presuffix = 10; - sync(); - - assertion_result result( true ); - - const std::string stream_string_repr = get_stream_string_representation(); - - if( !m_pimpl->m_pattern.is_open() ) { - result = false; - result.message() << "Pattern file can't be opened!"; - } - else { - if( m_pimpl->m_match_or_save ) { - - int offset = 0; - std::vector<char> last_elements; - for ( std::string::size_type i = 0; static_cast<int>(i + offset) < static_cast<int>(stream_string_repr.length()); ++i ) { - - char c = m_pimpl->get_char(); - - if( last_elements.size() <= n_chars_presuffix ) { - last_elements.push_back( c ); - } - else { - last_elements[ i % last_elements.size() ] = c; - } - - bool is_same = !m_pimpl->m_pattern.fail() && - !m_pimpl->m_pattern.eof() && - (stream_string_repr[i+offset] == c); - - if( !is_same ) { - - result = false; - - std::string::size_type prefix_size = (std::min)( i + offset, n_chars_presuffix ); - - std::string::size_type suffix_size = (std::min)( stream_string_repr.length() - i - offset, - n_chars_presuffix ); - - // try to log area around the mismatch - std::string substr = stream_string_repr.substr(0, i+offset); - std::size_t line = std::count(substr.begin(), substr.end(), '\n'); - std::size_t column = i + offset - substr.rfind('\n'); - - result.message() - << "Mismatch at position " << i - << " (line " << line - << ", column " << column - << "): '" << pretty_print_log(std::string(1, stream_string_repr[i+offset])) << "' != '" << pretty_print_log(std::string(1, c)) << "' :\n"; - - // we already escape this substring because we need its actual size for the pretty print - // of the difference location. - std::string sub_str_prefix(pretty_print_log(stream_string_repr.substr( i + offset - prefix_size, prefix_size ))); - - // we need this substring as is because we compute the best matching substrings on it. - std::string sub_str_suffix(stream_string_repr.substr( i + offset, suffix_size)); - result.message() << "... " << sub_str_prefix + pretty_print_log(sub_str_suffix) << " ..." << '\n'; - - result.message() << "... "; - for( std::size_t j = 0; j < last_elements.size() ; j++ ) - result.message() << pretty_print_log(std::string(1, last_elements[(i + j + 1) % last_elements.size()])); - - std::vector<char> last_elements_ordered; - last_elements_ordered.push_back(c); - for( std::string::size_type counter = 0; counter < suffix_size - 1 ; counter++ ) { - char c2 = m_pimpl->get_char(); - - if( m_pimpl->m_pattern.fail() || m_pimpl->m_pattern.eof() ) - break; - - result.message() << pretty_print_log(std::string(1, c2)); - - last_elements_ordered.push_back(c2); - } - - // tries to find the best substring matching in the remainder of the - // two strings - std::size_t max_nb_char_in_common = 0; - std::size_t best_pattern_start_index = 0; - std::size_t best_stream_start_index = 0; - for( std::size_t pattern_start_index = best_pattern_start_index; - pattern_start_index < last_elements_ordered.size(); - pattern_start_index++ ) { - for( std::size_t stream_start_index = best_stream_start_index; - stream_start_index < sub_str_suffix.size(); - stream_start_index++ ) { - - std::size_t max_size = (std::min)( last_elements_ordered.size() - pattern_start_index, sub_str_suffix.size() - stream_start_index ); - if( max_nb_char_in_common > max_size ) - break; // safely break to go to the outer loop - - std::size_t nb_char_in_common = 0; - for( std::size_t k = 0; k < max_size; k++) { - if( last_elements_ordered[pattern_start_index + k] == sub_str_suffix[stream_start_index + k] ) - nb_char_in_common ++; - else - break; // we take fully matching substring only - } - - if( nb_char_in_common > max_nb_char_in_common ) { - max_nb_char_in_common = nb_char_in_common; - best_pattern_start_index = pattern_start_index; - best_stream_start_index = stream_start_index; - } - } - } - - // indicates with more precision the location of the mismatchs in "ascii arts" ... - result.message() << " ...\n... "; - for( std::string::size_type j = 0; j < sub_str_prefix.size(); j++) { - result.message() << ' '; - } - - result.message() << '~'; // places the first tilde at the current char that mismatches - - for( std::size_t k = 1; k < (std::max)(best_pattern_start_index, best_stream_start_index); k++ ) { // 1 is for the current char c - std::string s1(pretty_print_log(std::string(1, last_elements_ordered[(std::min)(k, best_pattern_start_index)]))); - std::string s2(pretty_print_log(std::string(1, sub_str_suffix[(std::min)(k, best_stream_start_index)]))); - for( int h = static_cast<int>((std::max)(s1.size(), s2.size())); h > 0; h--) - result.message() << "~"; - } - - if( m_pimpl->m_pattern.eof() ) { - result.message() << " (reference string shorter than current stream)"; - } - - result.message() << "\n"; - - // no need to continue if the EOF is reached - if( m_pimpl->m_pattern.eof() ) { - break; - } - - // first char is a replicat of c, so we do not copy it. - for(std::string::size_type counter = 0; counter < last_elements_ordered.size() - 1 ; counter++) - last_elements[ (i + 1 + counter) % last_elements.size() ] = last_elements_ordered[counter + 1]; - - i += last_elements_ordered.size()-1; - offset += best_stream_start_index - best_pattern_start_index; - - } - - } - - // not needed anymore - /* - if(offset > 0 && false) { - m_pimpl->m_pattern.ignore( - static_cast<std::streamsize>( offset )); - } - */ - } - else { - m_pimpl->m_pattern.write( stream_string_repr.c_str(), - static_cast<std::streamsize>( stream_string_repr.length() ) ); - m_pimpl->m_pattern.flush(); - } - } - - if( flush_stream ) - flush(); - - return result; -} - -//____________________________________________________________________________// - -void -output_test_stream::flush() -{ - m_pimpl->m_synced_string.erase(); - -#ifndef BOOST_NO_STRINGSTREAM - str( std::string() ); -#else - seekp( 0, std::ios::beg ); -#endif -} - - -std::string -output_test_stream::get_stream_string_representation() const { - return m_pimpl->m_synced_string; -} - -//____________________________________________________________________________// - -std::size_t -output_test_stream::length() -{ - sync(); - - return m_pimpl->m_synced_string.length(); -} - -//____________________________________________________________________________// - -void -output_test_stream::sync() -{ -#ifdef BOOST_NO_STRINGSTREAM - m_pimpl->m_synced_string.assign( str(), pcount() ); - freeze( false ); -#else - m_pimpl->m_synced_string = str(); -#endif -} - -//____________________________________________________________________________// - -} // namespace test_tools -} // namespace boost - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_TEST_TOOLS_IPP_012205GER diff --git a/contrib/restricted/boost/test/include/boost/test/impl/test_tree.ipp b/contrib/restricted/boost/test/include/boost/test/impl/test_tree.ipp deleted file mode 100644 index 0872682ea6..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/impl/test_tree.ipp +++ /dev/null @@ -1,584 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -/// @file -/// Provides core implementation for Unit Test Framework. -/// Extensions can be provided in separate files -// *************************************************************************** - -#ifndef BOOST_TEST_UNIT_TEST_SUITE_IPP_012205GER -#define BOOST_TEST_UNIT_TEST_SUITE_IPP_012205GER - -// Boost.Test -#include <boost/detail/workaround.hpp> - -#include <boost/test/framework.hpp> -#include <boost/test/results_collector.hpp> - -#include <boost/test/tree/test_unit.hpp> -#include <boost/test/tree/visitor.hpp> -#include <boost/test/tree/traverse.hpp> -#include <boost/test/tree/auto_registration.hpp> -#include <boost/test/tree/global_fixture.hpp> - -#include <boost/test/utils/foreach.hpp> -#include <boost/test/utils/basic_cstring/io.hpp> - -#include <boost/test/unit_test_parameters.hpp> - -// STL -#include <algorithm> -#include <vector> -#include <set> - -#include <boost/test/detail/suppress_warnings.hpp> - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { - -// ************************************************************************** // -// ************** test_unit ************** // -// ************************************************************************** // - -test_unit::test_unit( const_string name, const_string file_name, std::size_t line_num, test_unit_type t ) -: p_type( t ) -, p_type_name( t == TUT_CASE ? "case" : "suite" ) -, p_file_name( file_name ) -, p_line_num( line_num ) -, p_id( INV_TEST_UNIT_ID ) -, p_parent_id( INV_TEST_UNIT_ID ) -, p_name( std::string( name.begin(), name.size() ) ) -, p_timeout( 0 ) -, p_expected_failures( 0 ) -, p_default_status( RS_INHERIT ) -, p_run_status( RS_INVALID ) -, p_sibling_rank(0) -{ -} - -//____________________________________________________________________________// - -test_unit::test_unit( const_string module_name ) -: p_type( TUT_SUITE ) -, p_type_name( "module" ) -, p_line_num( 0 ) -, p_id( INV_TEST_UNIT_ID ) -, p_parent_id( INV_TEST_UNIT_ID ) -, p_name( std::string( module_name.begin(), module_name.size() ) ) -, p_timeout( 0 ) -, p_expected_failures( 0 ) -, p_default_status( RS_INHERIT ) -, p_run_status( RS_INVALID ) -, p_sibling_rank(0) -{ -} - -//____________________________________________________________________________// - -test_unit::~test_unit() -{ - framework::deregister_test_unit( this ); -} - -//____________________________________________________________________________// - -void -test_unit::depends_on( test_unit* tu ) -{ - BOOST_TEST_SETUP_ASSERT( p_id != framework::master_test_suite().p_id, - "Can't add dependency to the master test suite" ); - - p_dependencies.value.push_back( tu->p_id ); -} - -//____________________________________________________________________________// - -void -test_unit::add_precondition( precondition_t const& pc ) -{ - p_preconditions.value.push_back( pc ); -} - -//____________________________________________________________________________// - -test_tools::assertion_result -test_unit::check_preconditions() const -{ - BOOST_TEST_FOREACH( test_unit_id, dep_id, p_dependencies.get() ) { - test_unit const& dep = framework::get( dep_id, TUT_ANY ); - - if( !dep.is_enabled() ) { - test_tools::assertion_result res(false); - res.message() << "dependency test " << dep.p_type_name << " \"" << dep.full_name() << "\" is disabled"; - return res; - } - - test_results const& test_rslt = unit_test::results_collector.results( dep_id ); - if( !test_rslt.passed() ) { - test_tools::assertion_result res(false); - res.message() << "dependency test " << dep.p_type_name << " \"" << dep.full_name() << (test_rslt.skipped() ? "\" was skipped":"\" has failed"); - return res; - } - - if( test_rslt.p_test_cases_skipped > 0 ) { - test_tools::assertion_result res(false); - res.message() << "dependency test " << dep.p_type_name << " \"" << dep.full_name() << "\" has skipped test cases"; - return res; - } - } - - BOOST_TEST_FOREACH( precondition_t, precondition, p_preconditions.get() ) { - test_tools::assertion_result res = precondition( p_id ); - if( !res ) { - test_tools::assertion_result res_out(false); - res_out.message() << "precondition failed"; - if( !res.has_empty_message() ) - res_out.message() << ": " << res.message(); - return res_out; - } - } - - return true; -} - -//____________________________________________________________________________// - -void -test_unit::increase_exp_fail( counter_t num ) -{ - p_expected_failures.value += num; - - if( p_parent_id != INV_TEST_UNIT_ID ) - framework::get<test_suite>( p_parent_id ).increase_exp_fail( num ); -} - -//____________________________________________________________________________// - -std::string -test_unit::full_name() const -{ - if( p_parent_id == INV_TEST_UNIT_ID || p_parent_id == framework::master_test_suite().p_id ) - return p_name; - - std::string res = framework::get<test_suite>( p_parent_id ).full_name(); - res.append("/"); - - res.append( p_name ); - - return res; -} - -//____________________________________________________________________________// - -void -test_unit::add_label( const_string l ) -{ - p_labels.value.push_back( std::string() + l ); -} - -//____________________________________________________________________________// - -bool -test_unit::has_label( const_string l ) const -{ - return std::find( p_labels->begin(), p_labels->end(), l ) != p_labels->end(); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** test_case ************** // -// ************************************************************************** // - -test_case::test_case( const_string name, boost::function<void ()> const& test_func ) -: test_unit( name, "", 0, static_cast<test_unit_type>(type) ) -, p_test_func( test_func ) -{ - framework::register_test_unit( this ); -} - -//____________________________________________________________________________// - -test_case::test_case( const_string name, const_string file_name, std::size_t line_num, boost::function<void ()> const& test_func ) -: test_unit( name, file_name, line_num, static_cast<test_unit_type>(type) ) -, p_test_func( test_func ) -{ - framework::register_test_unit( this ); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** test_suite ************** // -// ************************************************************************** // - -//____________________________________________________________________________// - -test_suite::test_suite( const_string name, const_string file_name, std::size_t line_num ) -: test_unit( ut_detail::normalize_test_case_name( name ), file_name, line_num, static_cast<test_unit_type>(type) ) -{ - framework::register_test_unit( this ); -} - -//____________________________________________________________________________// - -test_suite::test_suite( const_string module_name ) -: test_unit( module_name ) -{ - framework::register_test_unit( this ); -} - -//____________________________________________________________________________// - -void -test_suite::add( test_unit* tu, counter_t expected_failures, unsigned timeout ) -{ - tu->p_timeout.value = timeout; - - m_children.push_back( tu->p_id ); - tu->p_parent_id.value = p_id; - - if( tu->p_expected_failures != 0 ) - increase_exp_fail( tu->p_expected_failures ); - - if( expected_failures ) - tu->increase_exp_fail( expected_failures ); -} - -//____________________________________________________________________________// - -void -test_suite::add( test_unit_generator const& gen, unsigned timeout ) -{ - test_unit* tu; - while((tu = gen.next()) != 0) - add( tu, 0, timeout ); -} - -//____________________________________________________________________________// - -void -test_suite::add( test_unit_generator const& gen, decorator::collector_t& decorators ) -{ - test_unit* tu; - while((tu = gen.next()) != 0) { - decorators.store_in( *tu ); - add( tu, 0 ); - } - decorators.reset(); -} - -//____________________________________________________________________________// - -void -test_suite::add( boost::shared_ptr<test_unit_generator> gen_ptr, decorator::collector_t& decorators ) -{ - std::pair<boost::shared_ptr<test_unit_generator>, std::vector<decorator::base_ptr> > tmp_p(gen_ptr, decorators.get_lazy_decorators() ); - m_generators.push_back(tmp_p); - decorators.reset(); -} - -//____________________________________________________________________________// - -void -test_suite::generate( ) -{ - typedef std::pair<boost::shared_ptr<test_unit_generator>, std::vector<decorator::base_ptr> > element_t; - - for(std::vector<element_t>::iterator it(m_generators.begin()), ite(m_generators.end()); - it < ite; - ++it) - { - test_unit* tu; - while((tu = it->first->next()) != 0) { - tu->p_decorators.value.insert( tu->p_decorators.value.end(), it->second.begin(), it->second.end() ); - //it->second.store_in( *tu ); - add( tu, 0 ); - } - - } - m_generators.clear(); - - #if 0 - test_unit* tu; - while((tu = gen.next()) != 0) { - decorators.store_in( *tu ); - add( tu, 0 ); - } - #endif -} - -//____________________________________________________________________________// - -void -test_suite::check_for_duplicate_test_cases() { - // check for clashing names #12597 - std::set<std::string> names; - for( test_unit_id_list::const_iterator it(m_children.begin()), ite(m_children.end()); - it < ite; - ++it) { - std::string name = framework::get(*it, TUT_ANY).p_name; - std::pair<std::set<std::string>::iterator, bool> ret = names.insert(name); - BOOST_TEST_SETUP_ASSERT(ret.second, - "test unit with name '" - + name - + std::string("' registered multiple times in the test suite '") - + this->p_name.value - + "'"); - } - - return; -} - -//____________________________________________________________________________// - -void -test_suite::remove( test_unit_id id ) -{ - test_unit_id_list::iterator it = std::find( m_children.begin(), m_children.end(), id ); - - if( it != m_children.end() ) - m_children.erase( it ); -} - -//____________________________________________________________________________// - -test_unit_id -test_suite::get( const_string tu_name ) const -{ - BOOST_TEST_FOREACH( test_unit_id, id, m_children ) { - if( tu_name == framework::get( id, ut_detail::test_id_2_unit_type( id ) ).p_name.get() ) - return id; - } - - return INV_TEST_UNIT_ID; -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** master_test_suite ************** // -// ************************************************************************** // - -master_test_suite_t::master_test_suite_t() -: test_suite( "Master Test Suite" ) -, argc( 0 ) -, argv( 0 ) -{ - p_default_status.value = RS_ENABLED; -} - -// ************************************************************************** // -// ************** traverse_test_tree ************** // -// ************************************************************************** // - -void -traverse_test_tree( test_case const& tc, test_tree_visitor& V, bool ignore_status ) -{ - if( tc.is_enabled() || ignore_status ) - V.visit( tc ); -} - -//____________________________________________________________________________// - -void -traverse_test_tree( test_suite const& suite, test_tree_visitor& V, bool ignore_status ) -{ - // skip disabled test suite unless we asked to ignore this condition - if( !ignore_status && !suite.is_enabled() ) - return; - - // Invoke test_suite_start callback - if( !V.test_suite_start( suite ) ) - return; - - // Recurse into children - std::size_t total_children = suite.m_children.size(); - for( std::size_t i=0; i < total_children; ) { - // this statement can remove the test unit from this list - traverse_test_tree( suite.m_children[i], V, ignore_status ); - if( total_children > suite.m_children.size() ) - total_children = suite.m_children.size(); - else - ++i; - } - - // Invoke test_suite_finish callback - V.test_suite_finish( suite ); -} - -//____________________________________________________________________________// - -void -traverse_test_tree( test_unit_id id, test_tree_visitor& V, bool ignore_status ) -{ - if( ut_detail::test_id_2_unit_type( id ) == TUT_CASE ) - traverse_test_tree( framework::get<test_case>( id ), V, ignore_status ); - else - traverse_test_tree( framework::get<test_suite>( id ), V, ignore_status ); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** object generators ************** // -// ************************************************************************** // - -namespace ut_detail { - -std::string -normalize_test_case_name( const_string name ) -{ - std::string norm_name( name.begin(), name.size() ); - - if( name[0] == '&' ) - norm_name = norm_name.substr( 1 ); - - // trim spaces - std::size_t first_not_space = norm_name.find_first_not_of(' '); - if( first_not_space ) { - norm_name.erase(0, first_not_space); - } - - std::size_t last_not_space = norm_name.find_last_not_of(' '); - if( last_not_space !=std::string::npos ) { - norm_name.erase(last_not_space + 1); - } - - // sanitize all chars that might be used in runtime filters - static const char to_replace[] = { ':', '*', '@', '+', '!', '/', ',' }; - for(std::size_t index = 0; - index < sizeof(to_replace)/sizeof(to_replace[0]); - index++) { - std::replace(norm_name.begin(), norm_name.end(), to_replace[index], '_'); - } - - return norm_name; -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** auto_test_unit_registrar ************** // -// ************************************************************************** // - -auto_test_unit_registrar::auto_test_unit_registrar( test_case* tc, decorator::collector_t& decorators, counter_t exp_fail ) -{ - framework::current_auto_test_suite().add( tc, exp_fail ); - - decorators.store_in( *tc ); - decorators.reset(); -} - -//____________________________________________________________________________// - -auto_test_unit_registrar::auto_test_unit_registrar( const_string ts_name, const_string ts_file, std::size_t ts_line, decorator::collector_t& decorators ) -{ - test_unit_id id = framework::current_auto_test_suite().get( ts_name ); - - test_suite* ts; - - if( id != INV_TEST_UNIT_ID ) { - ts = &framework::get<test_suite>( id ); - BOOST_ASSERT( ts->p_parent_id == framework::current_auto_test_suite().p_id ); - } - else { - ts = new test_suite( ts_name, ts_file, ts_line ); - framework::current_auto_test_suite().add( ts ); - } - - decorators.store_in( *ts ); - decorators.reset(); - - framework::current_auto_test_suite( ts ); -} - -//____________________________________________________________________________// - -auto_test_unit_registrar::auto_test_unit_registrar( test_unit_generator const& tc_gen, decorator::collector_t& decorators ) -{ - framework::current_auto_test_suite().add( tc_gen, decorators ); -} - -//____________________________________________________________________________// - -auto_test_unit_registrar::auto_test_unit_registrar( boost::shared_ptr<test_unit_generator> tc_gen, decorator::collector_t& decorators ) -{ - framework::current_auto_test_suite().add( tc_gen, decorators ); -} - - -//____________________________________________________________________________// - -auto_test_unit_registrar::auto_test_unit_registrar( int ) -{ - framework::current_auto_test_suite( 0, false ); -} - -//____________________________________________________________________________// - -} // namespace ut_detail - -// ************************************************************************** // -// ************** global_fixture ************** // -// ************************************************************************** // - -global_fixture::global_fixture(): registered(false) -{ - framework::register_global_fixture( *this ); - registered = true; -} - -void global_fixture::unregister_from_framework() { - // not accessing the framework singleton after deregistering -> release - // of the observer from the framework - if(registered) { - framework::deregister_global_fixture( *this ); - } - registered = false; -} - -global_fixture::~global_fixture() -{ - this->unregister_from_framework(); -} - -// ************************************************************************** // -// ************** global_configuration ************** // -// ************************************************************************** // - -global_configuration::global_configuration(): registered(false) -{ - framework::register_observer( *this ); - registered = true; -} - -void global_configuration::unregister_from_framework() -{ - // not accessing the framework singleton after deregistering -> release - // of the observer from the framework - if(registered) { - framework::deregister_observer( *this ); - } - registered = false; -} - -global_configuration::~global_configuration() -{ - this->unregister_from_framework(); -} - -//____________________________________________________________________________// - -} // namespace unit_test -} // namespace boost - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_UNIT_TEST_SUITE_IPP_012205GER diff --git a/contrib/restricted/boost/test/include/boost/test/impl/unit_test_log.ipp b/contrib/restricted/boost/test/include/boost/test/impl/unit_test_log.ipp deleted file mode 100644 index 1b1e4eea9a..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/impl/unit_test_log.ipp +++ /dev/null @@ -1,787 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : implemets Unit Test Log -// *************************************************************************** - -#ifndef BOOST_TEST_UNIT_TEST_LOG_IPP_012205GER -#define BOOST_TEST_UNIT_TEST_LOG_IPP_012205GER - -// Boost.Test -#include <boost/test/unit_test_log.hpp> -#include <boost/test/unit_test_log_formatter.hpp> -#include <boost/test/execution_monitor.hpp> -#include <boost/test/framework.hpp> -#include <boost/test/unit_test_parameters.hpp> - -#include <boost/test/utils/basic_cstring/compare.hpp> -#include <boost/test/utils/foreach.hpp> - -#include <boost/test/output/compiler_log_formatter.hpp> -#include <boost/test/output/xml_log_formatter.hpp> -#include <boost/test/output/junit_log_formatter.hpp> - -// Boost -#include <boost/shared_ptr.hpp> -#include <boost/io/ios_state.hpp> -typedef ::boost::io::ios_base_all_saver io_saver_type; - -#include <boost/test/detail/suppress_warnings.hpp> - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { - -// ************************************************************************** // -// ************** entry_value_collector ************** // -// ************************************************************************** // - -namespace ut_detail { - -entry_value_collector const& -entry_value_collector::operator<<( lazy_ostream const& v ) const -{ - unit_test_log << v; - - return *this; -} - -//____________________________________________________________________________// - -entry_value_collector const& -entry_value_collector::operator<<( const_string v ) const -{ - unit_test_log << v; - - return *this; -} - -//____________________________________________________________________________// - -entry_value_collector::~entry_value_collector() -{ - if( m_last ) - unit_test_log << log::end(); -} - -//____________________________________________________________________________// - -} // namespace ut_detail - -// ************************************************************************** // -// ************** unit_test_log ************** // -// ************************************************************************** // - -namespace { - -// log data -struct unit_test_log_data_helper_impl { - typedef boost::shared_ptr<unit_test_log_formatter> formatter_ptr; - typedef boost::shared_ptr<io_saver_type> saver_ptr; - - bool m_enabled; - output_format m_format; - std::ostream* m_stream; - saver_ptr m_stream_state_saver; - formatter_ptr m_log_formatter; - bool m_entry_in_progress; - - unit_test_log_data_helper_impl(unit_test_log_formatter* p_log_formatter, output_format format, bool enabled = false) - : m_enabled( enabled ) - , m_format( format ) - , m_stream( &std::cout ) - , m_stream_state_saver( new io_saver_type( std::cout ) ) - , m_log_formatter() - , m_entry_in_progress( false ) - { - m_log_formatter.reset(p_log_formatter); - m_log_formatter->set_log_level(log_all_errors); - } - - // helper functions - std::ostream& stream() - { - return *m_stream; - } - - log_level get_log_level() const - { - return m_log_formatter->get_log_level(); - } -}; - -struct unit_test_log_impl { - // Constructor - unit_test_log_impl() - { - m_log_formatter_data.push_back( unit_test_log_data_helper_impl(new output::compiler_log_formatter, OF_CLF, true) ); // only this one is active by default, - m_log_formatter_data.push_back( unit_test_log_data_helper_impl(new output::xml_log_formatter, OF_XML, false) ); - m_log_formatter_data.push_back( unit_test_log_data_helper_impl(new output::junit_log_formatter, OF_JUNIT, false) ); - } - - typedef std::vector<unit_test_log_data_helper_impl> v_formatter_data_t; - v_formatter_data_t m_log_formatter_data; - - typedef std::vector<unit_test_log_data_helper_impl*> vp_formatter_data_t; - vp_formatter_data_t m_active_log_formatter_data; - - // entry data - log_entry_data m_entry_data; - - bool has_entry_in_progress() const { - for( vp_formatter_data_t::const_iterator it(m_active_log_formatter_data.begin()), ite(m_active_log_formatter_data.end()); - it < ite; - ++it) - { - unit_test_log_data_helper_impl& current_logger_data = **it; - if( current_logger_data.m_entry_in_progress ) - return true; - } - return false; - } - - // check point data - log_checkpoint_data m_checkpoint_data; - - void set_checkpoint( const_string file, std::size_t line_num, const_string msg ) - { - assign_op( m_checkpoint_data.m_message, msg, 0 ); - m_checkpoint_data.m_file_name = file; - m_checkpoint_data.m_line_num = line_num; - } -}; - -unit_test_log_impl& s_log_impl() { static unit_test_log_impl the_inst; return the_inst; } - - -//____________________________________________________________________________// - -void -log_entry_context( log_level l, unit_test_log_data_helper_impl& current_logger_data) -{ - framework::context_generator const& context = framework::get_context(); - if( context.is_empty() ) - return; - - const_string frame; - current_logger_data.m_log_formatter->entry_context_start( current_logger_data.stream(), l ); - while( !(frame=context.next()).is_empty() ) - { - current_logger_data.m_log_formatter->log_entry_context( current_logger_data.stream(), l, frame ); - } - current_logger_data.m_log_formatter->entry_context_finish( current_logger_data.stream(), l ); -} - -//____________________________________________________________________________// - -void -clear_entry_context() -{ - framework::clear_context(); -} - -// convenience -typedef unit_test_log_impl::vp_formatter_data_t vp_logger_t; -typedef unit_test_log_impl::v_formatter_data_t v_logger_t; - -} // local namespace - -//____________________________________________________________________________// - -BOOST_TEST_SINGLETON_CONS_IMPL( unit_test_log_t ) - -void -unit_test_log_t::configure( ) -{ - // configure is not test_start: - // test_start pushes the necessary log information when the test module is starting, and implies configure. - // configure: should be called each time the set of loggers, stream or configuration is changed. - s_log_impl().m_active_log_formatter_data.clear(); - for( unit_test_log_impl::v_formatter_data_t::iterator it(s_log_impl().m_log_formatter_data.begin()), - ite(s_log_impl().m_log_formatter_data.end()); - it < ite; - ++it) - { - if( !it->m_enabled || it->get_log_level() == log_nothing ) - continue; - - s_log_impl().m_active_log_formatter_data.push_back(&*it); - it->m_entry_in_progress = false; - } -} - -//____________________________________________________________________________// - -void -unit_test_log_t::test_start( counter_t test_cases_amount, test_unit_id ) -{ - configure(); - vp_logger_t& vloggers = s_log_impl().m_active_log_formatter_data; - for( vp_logger_t::iterator it(vloggers.begin()), ite(vloggers.end()); it < ite; ++it) - { - unit_test_log_data_helper_impl& current_logger_data = **it; - - current_logger_data.m_log_formatter->log_start( current_logger_data.stream(), test_cases_amount ); - current_logger_data.m_log_formatter->log_build_info( - current_logger_data.stream(), - runtime_config::get<bool>( runtime_config::btrt_build_info )); - - //current_logger_data.stream().flush(); - } -} - -//____________________________________________________________________________// - -void -unit_test_log_t::test_finish() -{ - vp_logger_t& vloggers = s_log_impl().m_active_log_formatter_data; - for( vp_logger_t::iterator it(vloggers.begin()), ite(vloggers.end()); it < ite; ++it) - { - unit_test_log_data_helper_impl& current_logger_data = **it; - current_logger_data.m_log_formatter->log_finish( current_logger_data.stream() ); - current_logger_data.stream().flush(); - } -} - -//____________________________________________________________________________// - -void -unit_test_log_t::test_aborted() -{ - BOOST_TEST_LOG_ENTRY( log_messages ) << "Test is aborted"; -} - -//____________________________________________________________________________// - -void -unit_test_log_t::test_unit_start( test_unit const& tu ) -{ - if( s_log_impl().has_entry_in_progress() ) - *this << log::end(); - - vp_logger_t& vloggers = s_log_impl().m_active_log_formatter_data; - for( vp_logger_t::iterator it(vloggers.begin()), ite(vloggers.end()); it < ite; ++it) - { - unit_test_log_data_helper_impl& current_logger_data = **it; - if( current_logger_data.get_log_level() > log_test_units ) - continue; - current_logger_data.m_log_formatter->test_unit_start( current_logger_data.stream(), tu ); - } -} - -//____________________________________________________________________________// - -void -unit_test_log_t::test_unit_finish( test_unit const& tu, unsigned long elapsed ) -{ - s_log_impl().m_checkpoint_data.clear(); - - if( s_log_impl().has_entry_in_progress() ) - *this << log::end(); - - vp_logger_t& vloggers = s_log_impl().m_active_log_formatter_data; - for( vp_logger_t::iterator it(vloggers.begin()), ite(vloggers.end()); it < ite; ++it) - { - unit_test_log_data_helper_impl& current_logger_data = **it; - if( current_logger_data.get_log_level() > log_test_units ) - continue; - - current_logger_data.m_log_formatter->test_unit_finish( current_logger_data.stream(), tu, elapsed ); - } -} - -//____________________________________________________________________________// - -void -unit_test_log_t::test_unit_skipped( test_unit const& tu, const_string reason ) -{ - if( s_log_impl().has_entry_in_progress() ) - *this << log::end(); - - vp_logger_t& vloggers = s_log_impl().m_active_log_formatter_data; - for( vp_logger_t::iterator it(vloggers.begin()), ite(vloggers.end()); it < ite; ++it) - { - unit_test_log_data_helper_impl& current_logger_data = **it; - if( current_logger_data.get_log_level() > log_test_units ) - continue; - - current_logger_data.m_log_formatter->test_unit_skipped( current_logger_data.stream(), tu, reason ); - } -} - -void -unit_test_log_t::test_unit_aborted( test_unit const& tu ) -{ - if( s_log_impl().has_entry_in_progress() ) - *this << log::end(); - - vp_logger_t& vloggers = s_log_impl().m_active_log_formatter_data; - for( vp_logger_t::iterator it(vloggers.begin()), ite(vloggers.end()); it < ite; ++it) - { - unit_test_log_data_helper_impl& current_logger_data = **it; - if( current_logger_data.get_log_level() > log_test_units ) - continue; - - current_logger_data.m_log_formatter->test_unit_aborted(current_logger_data.stream(), tu ); - } -} - -void -unit_test_log_t::test_unit_timed_out( test_unit const& tu ) -{ - if( s_log_impl().has_entry_in_progress() ) - *this << log::end(); - - vp_logger_t& vloggers = s_log_impl().m_active_log_formatter_data; - for( vp_logger_t::iterator it(vloggers.begin()), ite(vloggers.end()); it < ite; ++it) - { - unit_test_log_data_helper_impl& current_logger_data = **it; - if( current_logger_data.get_log_level() > log_test_units ) - continue; - - current_logger_data.m_log_formatter->test_unit_timed_out(current_logger_data.stream(), tu ); - } -} - -//____________________________________________________________________________// - -void -unit_test_log_t::exception_caught( execution_exception const& ex ) -{ - log_level l = - ex.code() <= execution_exception::cpp_exception_error ? log_cpp_exception_errors : - (ex.code() <= execution_exception::timeout_error ? log_system_errors - : log_fatal_errors ); - - if( s_log_impl().has_entry_in_progress() ) - *this << log::end(); - - vp_logger_t& vloggers = s_log_impl().m_active_log_formatter_data; - for( vp_logger_t::iterator it(vloggers.begin()), ite(vloggers.end()); it < ite; ++it) - { - unit_test_log_data_helper_impl& current_logger_data = **it; - - if( l >= current_logger_data.get_log_level() ) { - - current_logger_data.m_log_formatter->log_exception_start( current_logger_data.stream(), s_log_impl().m_checkpoint_data, ex ); - - log_entry_context( l, current_logger_data ); - - current_logger_data.m_log_formatter->log_exception_finish( current_logger_data.stream() ); - } - } - clear_entry_context(); -} - -//____________________________________________________________________________// - -void -unit_test_log_t::set_checkpoint( const_string file, std::size_t line_num, const_string msg ) -{ - s_log_impl().set_checkpoint( file, line_num, msg ); -} - -//____________________________________________________________________________// - -char -set_unix_slash( char in ) -{ - return in == '\\' ? '/' : in; -} - -unit_test_log_t& -unit_test_log_t::operator<<( log::begin const& b ) -{ - if( s_log_impl().has_entry_in_progress() ) - *this << log::end(); - - vp_logger_t& vloggers = s_log_impl().m_active_log_formatter_data; - for( vp_logger_t::iterator it(vloggers.begin()), ite(vloggers.end()); it < ite; ++it) - { - unit_test_log_data_helper_impl& current_logger_data = **it; - current_logger_data.m_stream_state_saver->restore(); - } - - s_log_impl().m_entry_data.clear(); - - assign_op( s_log_impl().m_entry_data.m_file_name, b.m_file_name, 0 ); - - // normalize file name - std::transform( s_log_impl().m_entry_data.m_file_name.begin(), s_log_impl().m_entry_data.m_file_name.end(), - s_log_impl().m_entry_data.m_file_name.begin(), - &set_unix_slash ); - - s_log_impl().m_entry_data.m_line_num = b.m_line_num; - - return *this; -} - -//____________________________________________________________________________// - -unit_test_log_t& -unit_test_log_t::operator<<( log::end const& ) -{ - if( s_log_impl().has_entry_in_progress() ) { - vp_logger_t& vloggers = s_log_impl().m_active_log_formatter_data; - log_level l = s_log_impl().m_entry_data.m_level; - for( vp_logger_t::iterator it(vloggers.begin()), ite(vloggers.end()); it < ite; ++it) - { - unit_test_log_data_helper_impl& current_logger_data = **it; - if( current_logger_data.m_entry_in_progress ) { - if( l >= current_logger_data.get_log_level() ) { - log_entry_context( l, current_logger_data ); - } - current_logger_data.m_log_formatter->log_entry_finish( current_logger_data.stream() ); - } - current_logger_data.m_entry_in_progress = false; - } - } - - clear_entry_context(); - - return *this; -} - -//____________________________________________________________________________// - -unit_test_log_t& -unit_test_log_t::operator<<( log_level l ) -{ - s_log_impl().m_entry_data.m_level = l; - - return *this; -} - -//____________________________________________________________________________// - -ut_detail::entry_value_collector -unit_test_log_t::operator()( log_level l ) -{ - *this << l; - - return ut_detail::entry_value_collector(); -} - -//____________________________________________________________________________// - -bool -log_entry_start(unit_test_log_data_helper_impl ¤t_logger_data) -{ - if( current_logger_data.m_entry_in_progress ) - return true; - - switch( s_log_impl().m_entry_data.m_level ) { - case log_successful_tests: - current_logger_data.m_log_formatter->log_entry_start( current_logger_data.stream(), s_log_impl().m_entry_data, - unit_test_log_formatter::BOOST_UTL_ET_INFO ); - break; - case log_messages: - current_logger_data.m_log_formatter->log_entry_start( current_logger_data.stream(), s_log_impl().m_entry_data, - unit_test_log_formatter::BOOST_UTL_ET_MESSAGE ); - break; - case log_warnings: - current_logger_data.m_log_formatter->log_entry_start( current_logger_data.stream(), s_log_impl().m_entry_data, - unit_test_log_formatter::BOOST_UTL_ET_WARNING ); - break; - case log_all_errors: - case log_cpp_exception_errors: - case log_system_errors: - current_logger_data.m_log_formatter->log_entry_start( current_logger_data.stream(), s_log_impl().m_entry_data, - unit_test_log_formatter::BOOST_UTL_ET_ERROR ); - break; - case log_fatal_errors: - current_logger_data.m_log_formatter->log_entry_start( current_logger_data.stream(), s_log_impl().m_entry_data, - unit_test_log_formatter::BOOST_UTL_ET_FATAL_ERROR ); - break; - case log_nothing: - case log_test_units: - case invalid_log_level: - return false; - } - - current_logger_data.m_entry_in_progress = true; - return true; -} - -//____________________________________________________________________________// - -unit_test_log_t& -unit_test_log_t::operator<<( const_string value ) -{ - if(value.empty()) { - return *this; - } - - vp_logger_t& vloggers = s_log_impl().m_active_log_formatter_data; - for( vp_logger_t::iterator it(vloggers.begin()), ite(vloggers.end()); it < ite; ++it) - { - unit_test_log_data_helper_impl& current_logger_data = **it; - if( s_log_impl().m_entry_data.m_level >= current_logger_data.get_log_level() ) - if( log_entry_start(current_logger_data) ) { - current_logger_data.m_log_formatter->log_entry_value( current_logger_data.stream(), value ); - } - } - return *this; -} - -//____________________________________________________________________________// - -unit_test_log_t& -unit_test_log_t::operator<<( lazy_ostream const& value ) -{ - if(value.empty()) { - return *this; - } - - vp_logger_t& vloggers = s_log_impl().m_active_log_formatter_data; - for( vp_logger_t::iterator it(vloggers.begin()), ite(vloggers.end()); it < ite; ++it) - { - unit_test_log_data_helper_impl& current_logger_data = **it; - if( s_log_impl().m_entry_data.m_level >= current_logger_data.get_log_level() ) { - if( log_entry_start(current_logger_data) ) { - current_logger_data.m_log_formatter->log_entry_value( current_logger_data.stream(), value ); - } - } - } - return *this; -} - -//____________________________________________________________________________// - -void -unit_test_log_t::set_stream( std::ostream& str ) -{ - if( s_log_impl().has_entry_in_progress() ) - return; - - v_logger_t& vloggers = s_log_impl().m_log_formatter_data; - for( v_logger_t::iterator it(vloggers.begin()), ite(vloggers.end()); it < ite; ++it) - { - unit_test_log_data_helper_impl& current_logger_data = *it; - - current_logger_data.m_stream = &str; - current_logger_data.m_stream_state_saver.reset( new io_saver_type( str ) ); - } -} - -//____________________________________________________________________________// - -void -unit_test_log_t::set_stream( output_format log_format, std::ostream& str ) -{ - if( s_log_impl().has_entry_in_progress() ) - return; - - v_logger_t& vloggers = s_log_impl().m_log_formatter_data; - for( v_logger_t::iterator it(vloggers.begin()), ite(vloggers.end()); it < ite; ++it) - { - unit_test_log_data_helper_impl& current_logger_data = *it; - if( current_logger_data.m_format == log_format) { - current_logger_data.m_stream = &str; - current_logger_data.m_stream_state_saver.reset( new io_saver_type( str ) ); - break; - } - } -} - -std::ostream* -unit_test_log_t::get_stream( output_format log_format ) const -{ - v_logger_t& vloggers = s_log_impl().m_log_formatter_data; - for( v_logger_t::iterator it(vloggers.begin()), ite(vloggers.end()); it < ite; ++it) - { - unit_test_log_data_helper_impl& current_logger_data = *it; - if( current_logger_data.m_format == log_format) { - return current_logger_data.m_stream; - } - } - return 0; -} - -//____________________________________________________________________________// - -log_level -unit_test_log_t::set_threshold_level( log_level lev ) -{ - if( s_log_impl().has_entry_in_progress() || lev == invalid_log_level ) - return invalid_log_level; - - log_level ret = log_nothing; - v_logger_t& vloggers = s_log_impl().m_log_formatter_data; - for( v_logger_t::iterator it(vloggers.begin()), ite(vloggers.end()); it < ite; ++it) - { - unit_test_log_data_helper_impl& current_logger_data = *it; - ret = (std::min)(ret, current_logger_data.m_log_formatter->get_log_level()); - current_logger_data.m_log_formatter->set_log_level( lev ); - } - return ret; -} - -//____________________________________________________________________________// - -log_level -unit_test_log_t::set_threshold_level( output_format log_format, log_level lev ) -{ - if( s_log_impl().has_entry_in_progress() || lev == invalid_log_level ) - return invalid_log_level; - - log_level ret = log_nothing; - v_logger_t& vloggers = s_log_impl().m_log_formatter_data; - for( v_logger_t::iterator it(vloggers.begin()), ite(vloggers.end()); it < ite; ++it) - { - unit_test_log_data_helper_impl& current_logger_data = *it; - if( current_logger_data.m_format == log_format) { - ret = current_logger_data.m_log_formatter->get_log_level(); - current_logger_data.m_log_formatter->set_log_level( lev ); - break; - } - } - return ret; -} - -//____________________________________________________________________________// - -void -unit_test_log_t::set_format( output_format log_format ) -{ - if( s_log_impl().has_entry_in_progress() ) - return; - - v_logger_t& vloggers = s_log_impl().m_log_formatter_data; - for( v_logger_t::iterator it(vloggers.begin()), ite(vloggers.end()); it < ite; ++it) - { - unit_test_log_data_helper_impl& current_logger_data = *it; - current_logger_data.m_enabled = current_logger_data.m_format == log_format; - } -} - -//____________________________________________________________________________// - -void -unit_test_log_t::add_format( output_format log_format ) -{ - if( s_log_impl().has_entry_in_progress() ) - return; - - v_logger_t& vloggers = s_log_impl().m_log_formatter_data; - for( v_logger_t::iterator it(vloggers.begin()), ite(vloggers.end()); it < ite; ++it) - { - unit_test_log_data_helper_impl& current_logger_data = *it; - if( current_logger_data.m_format == log_format) { - current_logger_data.m_enabled = true; - break; - } - } -} - -//____________________________________________________________________________// - -unit_test_log_formatter* -unit_test_log_t::get_formatter( output_format log_format ) { - - v_logger_t& vloggers = s_log_impl().m_log_formatter_data; - for( v_logger_t::iterator it(vloggers.begin()), ite(vloggers.end()); it < ite; ++it) - { - unit_test_log_data_helper_impl& current_logger_data = *it; - if( current_logger_data.m_format == log_format) { - return current_logger_data.m_log_formatter.get(); - } - } - return 0; -} - - -void -unit_test_log_t::add_formatter( unit_test_log_formatter* the_formatter ) -{ - // remove only user defined logger - v_logger_t& vloggers = s_log_impl().m_log_formatter_data; - for(v_logger_t::iterator it(vloggers.begin()), ite(vloggers.end()); it < ite; ++it) - { - if( it->m_format == OF_CUSTOM_LOGGER) { - s_log_impl().m_log_formatter_data.erase(it); - break; - } - } - - if( the_formatter ) { - s_log_impl().m_active_log_formatter_data.clear(); // otherwise dandling references - vloggers.push_back( unit_test_log_data_helper_impl(the_formatter, OF_CUSTOM_LOGGER, true) ); - } -} - -void -unit_test_log_t::set_formatter( unit_test_log_formatter* the_formatter ) -{ - if( s_log_impl().has_entry_in_progress() ) - return; - - // remove only user defined logger - log_level current_level = invalid_log_level; - std::ostream *current_stream = 0; - output_format previous_format = OF_INVALID; - v_logger_t& vloggers = s_log_impl().m_log_formatter_data; - for(v_logger_t::iterator it(vloggers.begin()), ite(vloggers.end()); it < ite; ++it) - { - if( it->m_enabled ) { - if( current_level == invalid_log_level || it->m_format < previous_format || it->m_format == OF_CUSTOM_LOGGER) { - current_level = it->get_log_level(); - current_stream = &(it->stream()); - previous_format = it->m_format; - } - } - } - - if( the_formatter ) { - add_formatter(the_formatter); - set_format(OF_CUSTOM_LOGGER); - set_threshold_level(OF_CUSTOM_LOGGER, current_level); - set_stream(OF_CUSTOM_LOGGER, *current_stream); - } - - configure(); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** unit_test_log_formatter ************** // -// ************************************************************************** // - -void -unit_test_log_formatter::log_entry_value( std::ostream& ostr, lazy_ostream const& value ) -{ - log_entry_value( ostr, (wrap_stringstream().ref() << value).str() ); -} - -void -unit_test_log_formatter::set_log_level(log_level new_log_level) -{ - m_log_level = new_log_level; -} - -log_level -unit_test_log_formatter::get_log_level() const -{ - return m_log_level; -} - -//____________________________________________________________________________// - -} // namespace unit_test -} // namespace boost - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_UNIT_TEST_LOG_IPP_012205GER - diff --git a/contrib/restricted/boost/test/include/boost/test/impl/unit_test_main.ipp b/contrib/restricted/boost/test/include/boost/test/impl/unit_test_main.ipp deleted file mode 100644 index 2fedecea44..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/impl/unit_test_main.ipp +++ /dev/null @@ -1,315 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : main function implementation for Unit Test Framework -// *************************************************************************** - -#ifndef BOOST_TEST_UNIT_TEST_MAIN_IPP_012205GER -#define BOOST_TEST_UNIT_TEST_MAIN_IPP_012205GER - -// Boost.Test -#include <boost/test/framework.hpp> -#include <boost/test/results_collector.hpp> -#include <boost/test/results_reporter.hpp> - -#include <boost/test/tree/visitor.hpp> -#include <boost/test/tree/test_unit.hpp> -#include <boost/test/tree/traverse.hpp> - -#include <boost/test/unit_test_parameters.hpp> - -#include <boost/test/utils/foreach.hpp> -#include <boost/test/utils/basic_cstring/io.hpp> - -// Boost -#include <boost/core/ignore_unused.hpp> -#include <boost/cstdlib.hpp> - -// STL -#include <cstdio> -#include <stdexcept> -#include <iostream> -#include <iomanip> -#include <iterator> -#include <set> - -#include <boost/test/detail/suppress_warnings.hpp> - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { - -namespace ut_detail { - -// ************************************************************************** // -// ************** hrf_content_reporter ************** // -// ************************************************************************** // - -struct hrf_content_reporter : test_tree_visitor { - explicit hrf_content_reporter( std::ostream& os ) : m_os( os ), m_indent( -4 ) {} // skip master test suite - -private: - void report_test_unit( test_unit const& tu ) - { - m_os << std::setw( m_indent ) << "" << tu.p_name; - m_os << (tu.p_default_status == test_unit::RS_ENABLED ? "*" : " "); - //m_os << '[' << tu.p_sibling_rank << ']'; - if( !tu.p_description->empty() ) - m_os << ": " << tu.p_description; - - m_os << "\n"; - } - void visit( test_case const& tc ) BOOST_OVERRIDE { report_test_unit( tc ); } - bool test_suite_start( test_suite const& ts ) BOOST_OVERRIDE - { - if( m_indent >= 0 ) - report_test_unit( ts ); - m_indent += 4; - return true; - } - void test_suite_finish( test_suite const& ) BOOST_OVERRIDE - { - m_indent -= 4; - } - - // Data members - std::ostream& m_os; - int m_indent; -}; - -// ************************************************************************** // -// ************** dot_content_reporter ************** // -// ************************************************************************** // - -struct dot_content_reporter : test_tree_visitor { - explicit dot_content_reporter( std::ostream& os ) : m_os( os ) {} - -private: - void report_test_unit( test_unit const& tu ) - { - bool master_ts = tu.p_parent_id == INV_TEST_UNIT_ID; - - m_os << "tu" << tu.p_id; - - m_os << (master_ts ? "[shape=ellipse,peripheries=2" : "[shape=Mrecord" ); - - m_os << ",fontname=Helvetica"; - - m_os << (tu.p_default_status == test_unit::RS_ENABLED ? ",color=green" : ",color=yellow"); - - if( master_ts ) - m_os << ",label=\"" << tu.p_name << "\"];\n"; - else { - m_os << ",label=\"" << tu.p_name << "|" << tu.p_file_name << "(" << tu.p_line_num << ")"; - if( tu.p_timeout > 0 ) - m_os << "|timeout=" << tu.p_timeout; - if( tu.p_expected_failures != 0 ) - m_os << "|expected failures=" << tu.p_expected_failures; - if( !tu.p_labels->empty() ) { - m_os << "|labels:"; - - BOOST_TEST_FOREACH( std::string const&, l, tu.p_labels.get() ) - m_os << " @" << l; - } - m_os << "\"];\n"; - } - - if( !master_ts ) - m_os << "tu" << tu.p_parent_id << " -> " << "tu" << tu.p_id << ";\n"; - - BOOST_TEST_FOREACH( test_unit_id, dep_id, tu.p_dependencies.get() ) { - test_unit const& dep = framework::get( dep_id, TUT_ANY ); - - m_os << "tu" << tu.p_id << " -> " << "tu" << dep.p_id << "[color=red,style=dotted,constraint=false];\n"; - } - - } - void visit( test_case const& tc ) BOOST_OVERRIDE - { - report_test_unit( tc ); - } - bool test_suite_start( test_suite const& ts ) BOOST_OVERRIDE - { - if( ts.p_parent_id == INV_TEST_UNIT_ID ) - m_os << "digraph G {rankdir=LR;\n"; - - report_test_unit( ts ); - - m_os << "{\n"; - - return true; - } - void test_suite_finish( test_suite const& ts ) BOOST_OVERRIDE - { - m_os << "}\n"; - if( ts.p_parent_id == INV_TEST_UNIT_ID ) - m_os << "}\n"; - } - - std::ostream& m_os; -}; - -// ************************************************************************** // -// ************** labels_collector ************** // -// ************************************************************************** // - -struct labels_collector : test_tree_visitor { - std::set<std::string> const& labels() const { return m_labels; } - -private: - bool visit( test_unit const& tu ) BOOST_OVERRIDE - { - m_labels.insert( tu.p_labels->begin(), tu.p_labels->end() ); - return true; - } - - // Data members - std::set<std::string> m_labels; -}; - -struct framework_shutdown_helper { - ~framework_shutdown_helper() { - try { - framework::shutdown(); - } - catch(...) { - std::cerr << "Boost.Test shutdown exception caught" << std::endl; - } - } -}; - -} // namespace ut_detail - -// ************************************************************************** // -// ************** unit_test_main ************** // -// ************************************************************************** // - - - -int BOOST_TEST_DECL -unit_test_main( init_unit_test_func init_func, int argc, char* argv[] ) -{ - int result_code = 0; - - ut_detail::framework_shutdown_helper shutdown_helper; - boost::ignore_unused(shutdown_helper); - - BOOST_TEST_I_TRY { - - framework::init( init_func, argc, argv ); - - if( runtime_config::get<bool>( runtime_config::btrt_wait_for_debugger ) ) { - results_reporter::get_stream() << "Press any key to continue..." << std::endl; - - // getchar is defined as a macro in uClibc. Use parenthesis to fix - // gcc bug 58952 for gcc <= 4.8.2. - (std::getchar)(); - results_reporter::get_stream() << "Continuing..." << std::endl; - } - - framework::finalize_setup_phase(); - - output_format list_cont = runtime_config::get<output_format>( runtime_config::btrt_list_content ); - if( list_cont != unit_test::OF_INVALID ) { - if( list_cont == unit_test::OF_DOT ) { - ut_detail::dot_content_reporter reporter( results_reporter::get_stream() ); - - traverse_test_tree( framework::master_test_suite().p_id, reporter, true ); - } - else { - ut_detail::hrf_content_reporter reporter( results_reporter::get_stream() ); - - traverse_test_tree( framework::master_test_suite().p_id, reporter, true ); - } - - return boost::exit_success; - } - - if( runtime_config::get<bool>( runtime_config::btrt_list_labels ) ) { - ut_detail::labels_collector collector; - - traverse_test_tree( framework::master_test_suite().p_id, collector, true ); - - results_reporter::get_stream() << "Available labels:\n "; - std::copy( collector.labels().begin(), collector.labels().end(), - std::ostream_iterator<std::string>( results_reporter::get_stream(), "\n " ) ); - results_reporter::get_stream() << "\n"; - - return boost::exit_success; - } - - framework::run(); - - result_code = !runtime_config::get<bool>( runtime_config::btrt_result_code ) - ? boost::exit_success - : results_collector.results( framework::master_test_suite().p_id ).result_code(); - } - BOOST_TEST_I_CATCH( framework::nothing_to_test, ex ) { - result_code = ex.m_result_code; - } - BOOST_TEST_I_CATCH( framework::internal_error, ex ) { - results_reporter::get_stream() << "Boost.Test framework internal error: " << ex.what() << std::endl; - - result_code = boost::exit_exception_failure; - } - BOOST_TEST_I_CATCH( framework::setup_error, ex ) { - results_reporter::get_stream() << "Test setup error: " << ex.what() << std::endl; - - result_code = boost::exit_exception_failure; - } - BOOST_TEST_I_CATCH( std::logic_error, ex ) { - results_reporter::get_stream() << "Test setup error: " << ex.what() << std::endl; - - result_code = boost::exit_exception_failure; - } - BOOST_TEST_I_CATCHALL() { - results_reporter::get_stream() << "Boost.Test framework internal error: unknown reason" << std::endl; - - result_code = boost::exit_exception_failure; - } - - return result_code; -} - -} // namespace unit_test -} // namespace boost - -#if !defined(BOOST_TEST_DYN_LINK) && !defined(BOOST_TEST_NO_MAIN) - -// ************************************************************************** // -// ************** main function for tests using lib ************** // -// ************************************************************************** // - -int BOOST_TEST_CALL_DECL -main( int argc, char* argv[] ) -{ - // prototype for user's unit test init function -#ifdef BOOST_TEST_ALTERNATIVE_INIT_API - extern bool init_unit_test(); - - boost::unit_test::init_unit_test_func init_func = &init_unit_test; -#else - extern ::boost::unit_test::test_suite* init_unit_test_suite( int argc, char* argv[] ); - - boost::unit_test::init_unit_test_func init_func = &init_unit_test_suite; -#endif - - return ::boost::unit_test::unit_test_main( init_func, argc, argv ); -} - -#endif // !BOOST_TEST_DYN_LINK && !BOOST_TEST_NO_MAIN - -//____________________________________________________________________________// - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_UNIT_TEST_MAIN_IPP_012205GER diff --git a/contrib/restricted/boost/test/include/boost/test/impl/unit_test_monitor.ipp b/contrib/restricted/boost/test/include/boost/test/impl/unit_test_monitor.ipp deleted file mode 100644 index 63a04c8f4f..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/impl/unit_test_monitor.ipp +++ /dev/null @@ -1,78 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : implements specific subclass of Executon Monitor used by Unit -// Test Framework to monitor test cases run. -// *************************************************************************** - -#ifndef BOOST_TEST_UNIT_TEST_MONITOR_IPP_012205GER -#define BOOST_TEST_UNIT_TEST_MONITOR_IPP_012205GER - -// Boost.Test -#include <boost/test/unit_test_monitor.hpp> -#include <boost/test/framework.hpp> -#include <boost/test/tree/test_unit.hpp> -#include <boost/test/unit_test_parameters.hpp> - -#include <boost/test/detail/suppress_warnings.hpp> - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { - -// singleton pattern -BOOST_TEST_SINGLETON_CONS_IMPL(unit_test_monitor_t) - -// ************************************************************************** // -// ************** unit_test_monitor ************** // -// ************************************************************************** // - -unit_test_monitor_t::error_level -unit_test_monitor_t::execute_and_translate( boost::function<void ()> const& func, unsigned long int timeout_microseconds ) -{ - BOOST_TEST_I_TRY { - p_catch_system_errors.value = runtime_config::get<bool>( runtime_config::btrt_catch_sys_errors ); - p_timeout.value = timeout_microseconds; - p_auto_start_dbg.value = runtime_config::get<bool>( runtime_config::btrt_auto_start_dbg ); - p_use_alt_stack.value = runtime_config::get<bool>( runtime_config::btrt_use_alt_stack ); - p_detect_fp_exceptions.value = runtime_config::get<bool>( runtime_config::btrt_detect_fp_except ); - - vexecute( func ); - } - BOOST_TEST_I_CATCH( execution_exception, ex ) { - framework::exception_caught( ex ); - framework::test_unit_aborted( framework::current_test_unit() ); - - // translate execution_exception::error_code to error_level - switch( ex.code() ) { - case execution_exception::no_error: return test_ok; - case execution_exception::user_error: return unexpected_exception; - case execution_exception::cpp_exception_error: return unexpected_exception; - case execution_exception::system_error: return os_exception; - case execution_exception::timeout_error: return os_timeout; - case execution_exception::user_fatal_error: - case execution_exception::system_fatal_error: return fatal_error; - default: return unexpected_exception; - } - } - - return test_ok; -} - -//____________________________________________________________________________// - -} // namespace unit_test -} // namespace boost - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_UNIT_TEST_MONITOR_IPP_012205GER diff --git a/contrib/restricted/boost/test/include/boost/test/impl/unit_test_parameters.ipp b/contrib/restricted/boost/test/include/boost/test/impl/unit_test_parameters.ipp deleted file mode 100644 index fec7bb94ca..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/impl/unit_test_parameters.ipp +++ /dev/null @@ -1,771 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : simple implementation for Unit Test Framework parameter -// handling routines. May be rewritten in future to use some kind of -// command-line arguments parsing facility and environment variable handling -// facility -// *************************************************************************** - -#ifndef BOOST_TEST_UNIT_TEST_PARAMETERS_IPP_012205GER -#define BOOST_TEST_UNIT_TEST_PARAMETERS_IPP_012205GER - -// Boost.Test -#include <boost/test/unit_test_parameters.hpp> - -#include <boost/test/utils/basic_cstring/basic_cstring.hpp> -#include <boost/test/utils/basic_cstring/compare.hpp> -#include <boost/test/utils/basic_cstring/io.hpp> -#include <boost/test/utils/iterator/token_iterator.hpp> - -#include <boost/test/debug.hpp> -#include <boost/test/framework.hpp> - -#include <boost/test/detail/log_level.hpp> -#include <boost/test/detail/throw_exception.hpp> - -// Boost.Runtime.Param -#include <boost/test/utils/runtime/parameter.hpp> -#include <boost/test/utils/runtime/argument.hpp> -#include <boost/test/utils/runtime/finalize.hpp> -#include <boost/test/utils/runtime/cla/parser.hpp> -#include <boost/test/utils/runtime/env/fetch.hpp> - -// Boost -#include <boost/config.hpp> -#include <boost/test/detail/suppress_warnings.hpp> -#include <boost/test/detail/enable_warnings.hpp> -#include <boost/cstdlib.hpp> - -// STL -#include <cstdlib> -#include <iostream> -#include <fstream> - -#include <boost/test/detail/suppress_warnings.hpp> - -//____________________________________________________________________________// - -# ifdef BOOST_NO_STDC_NAMESPACE -namespace std { using ::getenv; using ::strncmp; using ::strcmp; } -# endif - -namespace boost { -namespace unit_test { - -namespace rt = boost::runtime; - -// ************************************************************************** // -// ************** runtime_config ************** // -// ************************************************************************** // - -namespace runtime_config { - -// UTF parameters -std::string btrt_auto_start_dbg = "auto_start_dbg"; -std::string btrt_break_exec_path = "break_exec_path"; -std::string btrt_build_info = "build_info"; -std::string btrt_catch_sys_errors = "catch_system_errors"; -std::string btrt_color_output = "color_output"; -std::string btrt_detect_fp_except = "detect_fp_exceptions"; -std::string btrt_detect_mem_leaks = "detect_memory_leaks"; -std::string btrt_list_content = "list_content"; -std::string btrt_list_labels = "list_labels"; -std::string btrt_log_format = "log_format"; -std::string btrt_log_level = "log_level"; -std::string btrt_log_sink = "log_sink"; -std::string btrt_combined_logger = "logger"; -std::string btrt_output_format = "output_format"; -std::string btrt_random_seed = "random"; -std::string btrt_report_format = "report_format"; -std::string btrt_report_level = "report_level"; -std::string btrt_report_mem_leaks = "report_memory_leaks_to"; -std::string btrt_report_sink = "report_sink"; -std::string btrt_result_code = "result_code"; -std::string btrt_run_filters = "run_test"; -std::string btrt_save_test_pattern = "save_pattern"; -std::string btrt_show_progress = "show_progress"; -std::string btrt_use_alt_stack = "use_alt_stack"; -std::string btrt_wait_for_debugger = "wait_for_debugger"; - -std::string btrt_help = "help"; -std::string btrt_usage = "usage"; -std::string btrt_version = "version"; - -//____________________________________________________________________________// - -namespace { - -void -register_parameters( rt::parameters_store& store ) -{ - rt::option auto_start_dbg( btrt_auto_start_dbg, ( - rt::description = "Automatically attaches debugger in case of system level failure (signal).", - rt::env_var = "BOOST_TEST_AUTO_START_DBG", - - rt::help = "Specifies whether Boost.Test should attempt " - "to attach a debugger when fatal system error occurs. At the moment this feature " - "is only available on a few selected platforms: Win32 and *nix. There is a " - "default debugger configured for these platforms. You can manually configure " - "different debugger. For more details on how to configure the debugger see the " - "Boost.Test debug API, specifically the function boost::debug::set_debugger." - )); - - auto_start_dbg.add_cla_id( "--", btrt_auto_start_dbg, "=" ); - auto_start_dbg.add_cla_id( "-", "d", " " ); - store.add( auto_start_dbg ); - - /////////////////////////////////////////////// - - rt::parameter<std::string> break_exec_path( btrt_break_exec_path, ( - rt::description = "For the exception safety testing allows to break at specific execution path.", - rt::env_var = "BOOST_TEST_BREAK_EXEC_PATH" -#ifndef BOOST_NO_CXX11_LAMBDAS - , - rt::callback = [](rt::cstring) { - BOOST_TEST_SETUP_ASSERT( false, "parameter break_exec_path is disabled in this release" ); - } -#endif - )); - - break_exec_path.add_cla_id( "--", btrt_break_exec_path, "=" ); - store.add( break_exec_path ); - - /////////////////////////////////////////////// - - rt::option build_info( btrt_build_info, ( - rt::description = "Displays library build information.", - rt::env_var = "BOOST_TEST_BUILD_INFO", - rt::help = "Displays library build information, including: platform, " - "compiler, STL version and Boost version." - )); - - build_info.add_cla_id( "--", btrt_build_info, "=" ); - build_info.add_cla_id( "-", "i", " " ); - store.add( build_info ); - - /////////////////////////////////////////////// - - rt::option catch_sys_errors( btrt_catch_sys_errors, ( - rt::description = "Allows to switch between catching and ignoring system errors (signals).", - rt::env_var = "BOOST_TEST_CATCH_SYSTEM_ERRORS", - rt::default_value = -#ifdef BOOST_TEST_DEFAULTS_TO_CORE_DUMP - false, -#else - true, -#endif - rt::help = "If option " + btrt_catch_sys_errors + " has value 'no' the frameworks does not attempt to catch " - "asynchronous system failure events (signals on *NIX platforms or structured exceptions on Windows). " - " Default value is " -#ifdef BOOST_TEST_DEFAULTS_TO_CORE_DUMP - "no." -#else - "true." -#endif - )); - - catch_sys_errors.add_cla_id( "--", btrt_catch_sys_errors, "=", true ); - catch_sys_errors.add_cla_id( "-", "s", " " ); - store.add( catch_sys_errors ); - - /////////////////////////////////////////////// - - rt::option color_output( btrt_color_output, ( - rt::description = "Enables color output of the framework log and report messages.", - rt::env_var = "BOOST_TEST_COLOR_OUTPUT", - rt::default_value = true, - rt::help = "Produces color output for logs, reports and help. " - "Defaults to true. " - )); - - color_output.add_cla_id( "--", btrt_color_output, "=", true ); - color_output.add_cla_id( "-", "x", " " ); - store.add( color_output ); - - /////////////////////////////////////////////// - - rt::option detect_fp_except( btrt_detect_fp_except, ( - rt::description = "Enables/disables floating point exceptions traps.", - rt::env_var = "BOOST_TEST_DETECT_FP_EXCEPTIONS", - rt::help = "Enables/disables hardware traps for the floating " - "point exceptions (if supported on your platfrom)." - )); - - detect_fp_except.add_cla_id( "--", btrt_detect_fp_except, "=", true ); - store.add( detect_fp_except ); - - /////////////////////////////////////////////// - - rt::parameter<unsigned long> detect_mem_leaks( btrt_detect_mem_leaks, ( - rt::description = "Turns on/off memory leaks detection (optionally breaking on specified alloc order number).", - rt::env_var = "BOOST_TEST_DETECT_MEMORY_LEAK", - rt::default_value = 1L, - rt::optional_value = 1L, - rt::value_hint = "<alloc order number>", - rt::help = "Enables/disables memory leaks detection. " - "This parameter has optional long integer value. The default value is 1, which " - "enables the memory leak detection. The value 0 disables memory leak detection. " - "Any value N greater than 1 is treated as leak allocation number and tells the " - "framework to setup runtime breakpoint at Nth heap allocation. If value is " - "omitted the default value is assumed." - )); - - detect_mem_leaks.add_cla_id( "--", btrt_detect_mem_leaks, "=" ); - store.add( detect_mem_leaks ); - - /////////////////////////////////////////////// - - rt::enum_parameter<unit_test::output_format> list_content( btrt_list_content, ( - rt::description = "Lists the content of test tree - names of all test suites and test cases.", - rt::env_var = "BOOST_TEST_LIST_CONTENT", - rt::default_value = OF_INVALID, - rt::optional_value = OF_CLF, - rt::enum_values<unit_test::output_format>::value = -#if defined(BOOST_TEST_CLA_NEW_API) - { - { "HRF", OF_CLF }, - { "DOT", OF_DOT } - }, -#else - rt::enum_values_list<unit_test::output_format>() - ( "HRF", OF_CLF ) - ( "DOT", OF_DOT ) - , -#endif - rt::help = "Lists the test suites and cases " - "of the test module instead of executing the test cases. The format of the " - "desired output can be passed to the command. Currently the " - "framework supports two formats: human readable format (HRF) and dot graph " - "format (DOT). If value is omitted HRF value is assumed." - )); - list_content.add_cla_id( "--", btrt_list_content, "=" ); - store.add( list_content ); - - /////////////////////////////////////////////// - - rt::option list_labels( btrt_list_labels, ( - rt::description = "Lists all available labels.", - rt::env_var = "BOOST_TEST_LIST_LABELS", - rt::help = "Option " + btrt_list_labels + " instructs the framework to list all the the labels " - "defined in the test module instead of executing the test cases." - )); - - list_labels.add_cla_id( "--", btrt_list_labels, "=" ); - store.add( list_labels ); - - /////////////////////////////////////////////// - - rt::enum_parameter<unit_test::output_format> log_format( btrt_log_format, ( - rt::description = "Specifies log format.", - rt::env_var = "BOOST_TEST_LOG_FORMAT", - rt::default_value = OF_CLF, - rt::enum_values<unit_test::output_format>::value = -#if defined(BOOST_TEST_CLA_NEW_API) - { - { "HRF", OF_CLF }, - { "CLF", OF_CLF }, - { "XML", OF_XML }, - { "JUNIT", OF_JUNIT }, - }, -#else - rt::enum_values_list<unit_test::output_format>() - ( "HRF", OF_CLF ) - ( "CLF", OF_CLF ) - ( "XML", OF_XML ) - ( "JUNIT", OF_JUNIT ) - , -#endif - rt::help = "Set the frameowrk's log format to one " - "of the formats supplied by the framework. The only acceptable values for this " - "parameter are the names of the output formats supplied by the framework. By " - "default the framework uses human readable format (HRF) for testing log. This " - "format is similar to compiler error format. Alternatively you can specify XML " - "or JUNIT as log format, which are easier to process by testing automation tools." - )); - - log_format.add_cla_id( "--", btrt_log_format, "=" ); - log_format.add_cla_id( "-", "f", " " ); - store.add( log_format ); - - /////////////////////////////////////////////// - - rt::enum_parameter<unit_test::log_level> log_level( btrt_log_level, ( - rt::description = "Specifies the logging level of the test execution.", - rt::env_var = "BOOST_TEST_LOG_LEVEL", - rt::default_value = log_all_errors, - rt::enum_values<unit_test::log_level>::value = -#if defined(BOOST_TEST_CLA_NEW_API) - { - { "all" , log_successful_tests }, - { "success" , log_successful_tests }, - { "test_suite" , log_test_units }, - { "unit_scope" , log_test_units }, - { "message" , log_messages }, - { "warning" , log_warnings }, - { "error" , log_all_errors }, - { "cpp_exception" , log_cpp_exception_errors }, - { "system_error" , log_system_errors }, - { "fatal_error" , log_fatal_errors }, - { "nothing" , log_nothing } - }, -#else - rt::enum_values_list<unit_test::log_level>() - ( "all" , log_successful_tests ) - ( "success" , log_successful_tests ) - ( "test_suite" , log_test_units ) - ( "unit_scope" , log_test_units ) - ( "message" , log_messages ) - ( "warning" , log_warnings ) - ( "error" , log_all_errors ) - ( "cpp_exception" , log_cpp_exception_errors ) - ( "system_error" , log_system_errors ) - ( "fatal_error" , log_fatal_errors ) - ( "nothing" , log_nothing ) - , -#endif - rt::help = "Set the framework's log level. " - "The log level defines the verbosity of the testing logs produced by a test " - "module. The verbosity ranges from a complete log, when all assertions " - "(both successful and failing) are reported, all notifications about " - "test units start and finish are included, to an empty log when nothing " - "is reported to a testing log stream." - )); - - log_level.add_cla_id( "--", btrt_log_level, "=" ); - log_level.add_cla_id( "-", "l", " " ); - store.add( log_level ); - - /////////////////////////////////////////////// - - rt::parameter<std::string> log_sink( btrt_log_sink, ( - rt::description = "Specifies log sink: stdout (default), stderr or file name.", - rt::env_var = "BOOST_TEST_LOG_SINK", - rt::value_hint = "<stderr|stdout|file name>", - rt::help = "Sets the log sink - the location " - "where Boost.Test writes the logs of the test execution. It allows to easily redirect the " - "test logs to file or standard streams. By default testing log is " - "directed to standard output." - )); - - log_sink.add_cla_id( "--", btrt_log_sink, "=" ); - log_sink.add_cla_id( "-", "k", " " ); - store.add( log_sink ); - - /////////////////////////////////////////////// - - rt::enum_parameter<unit_test::output_format> output_format( btrt_output_format, ( - rt::description = "Specifies output format (both log and report).", - rt::env_var = "BOOST_TEST_OUTPUT_FORMAT", - rt::enum_values<unit_test::output_format>::value = -#if defined(BOOST_TEST_CLA_NEW_API) - { - { "HRF", OF_CLF }, - { "CLF", OF_CLF }, - { "XML", OF_XML } - }, -#else - rt::enum_values_list<unit_test::output_format>() - ( "HRF", OF_CLF ) - ( "CLF", OF_CLF ) - ( "XML", OF_XML ) - , -#endif - rt::help = "Combines an effect of " + btrt_report_format + - " and " + btrt_log_format + " parameters. If this parameter is specified, " - "it overrides the value of other two parameters. This parameter does not " - "have a default value. The only acceptable values are string names of " - "output formats: HRF - human readable format and XML - XML formats for " - "automation tools processing." - )); - - output_format.add_cla_id( "--", btrt_output_format, "=" ); - output_format.add_cla_id( "-", "o", " " ); - store.add( output_format ); - - /////////////////////////////////////////////// combined logger option - - rt::parameter<std::string,rt::REPEATABLE_PARAM> combined_logger( btrt_combined_logger, ( - rt::description = "Specifies log level and sink for one or several log format", - rt::env_var = "BOOST_TEST_LOGGER", - rt::value_hint = "log_format,log_level,log_sink[:log_format,log_level,log_sink]", - rt::help = "Specify one or more logging definition, which include the logger type, level and sink. " - "The log format, level and sink follow the same format as for the argument '--" + btrt_log_format + - "', '--" + btrt_log_level + "' and '--" + btrt_log_sink + "' respetively. " - "This command can take several logging definition separated by a ':', or be repeated " - "on the command line." - )); - - combined_logger.add_cla_id( "--", btrt_combined_logger, "=" ); - store.add( combined_logger ); - - /////////////////////////////////////////////// - - rt::parameter<unsigned> random_seed( btrt_random_seed, ( - rt::description = "Allows to switch between sequential and random order of test units execution." - " Optionally allows to specify concrete seed for random number generator.", - rt::env_var = "BOOST_TEST_RANDOM", - rt::default_value = 0U, - rt::optional_value = 1U, - rt::value_hint = "<seed>", - rt::help = "Instructs the framework to execute the " - "test cases in random order. This parameter accepts an optional unsigned " - "integer argument. If parameter is specified without the argument value testing " - "order is randomized based on current time. Alternatively you can specify " - "any positive value greater than 1 and it will be used as random seed for " - "the run. " - "By default, the test cases are executed in an " - "order defined by their declaration and the optional dependencies among the test units." - )); - - random_seed.add_cla_id( "--", btrt_random_seed, "=" ); - store.add( random_seed ); - - /////////////////////////////////////////////// - - rt::enum_parameter<unit_test::output_format> report_format( btrt_report_format, ( - rt::description = "Specifies the test report format.", - rt::env_var = "BOOST_TEST_REPORT_FORMAT", - rt::default_value = OF_CLF, - rt::enum_values<unit_test::output_format>::value = -#if defined(BOOST_TEST_CLA_NEW_API) - { - { "HRF", OF_CLF }, - { "CLF", OF_CLF }, - { "XML", OF_XML } - }, -#else - rt::enum_values_list<unit_test::output_format>() - ( "HRF", OF_CLF ) - ( "CLF", OF_CLF ) - ( "XML", OF_XML ) - , -#endif - rt::help = "Set the framework's report format " - "to one of the formats supplied by the framework. The only acceptable values " - "for this parameter are the names of the output formats. By default the framework " - "uses human readable format (HRF) for results reporting. Alternatively you can " - "specify XML as report format. This format is easier to process by testing " - "automation tools." - )); - - report_format.add_cla_id( "--", btrt_report_format, "=" ); - report_format.add_cla_id( "-", "m", " " ); - store.add( report_format ); - - /////////////////////////////////////////////// - - rt::enum_parameter<unit_test::report_level> report_level( btrt_report_level, ( - rt::description = "Specifies test report level.", - rt::env_var = "BOOST_TEST_REPORT_LEVEL", - rt::default_value = CONFIRMATION_REPORT, - rt::enum_values<unit_test::report_level>::value = -#if defined(BOOST_TEST_CLA_NEW_API) - { - { "confirm", CONFIRMATION_REPORT }, - { "short", SHORT_REPORT }, - { "detailed", DETAILED_REPORT }, - { "no", NO_REPORT } - }, -#else - rt::enum_values_list<unit_test::report_level>() - ( "confirm", CONFIRMATION_REPORT ) - ( "short", SHORT_REPORT ) - ( "detailed", DETAILED_REPORT ) - ( "no", NO_REPORT ) - , -#endif - rt::help = "Set the verbosity level of the " - "result report generated by the testing framework. Use value 'no' to " - "disable the results report completely." - )); - - report_level.add_cla_id( "--", btrt_report_level, "=" ); - report_level.add_cla_id( "-", "r", " " ); - store.add( report_level ); - - /////////////////////////////////////////////// - - rt::parameter<std::string> report_mem_leaks( btrt_report_mem_leaks, ( - rt::description = "File where to report memory leaks to.", - rt::env_var = "BOOST_TEST_REPORT_MEMORY_LEAKS_TO", - rt::default_value = std::string(), - rt::value_hint = "<file name>", - rt::help = "Parameter " + btrt_report_mem_leaks + " allows to specify a file where to report " - "memory leaks to. The parameter does not have default value. If it is not specified, " - "memory leaks (if any) are reported to the standard error stream." - )); - - report_mem_leaks.add_cla_id( "--", btrt_report_mem_leaks, "=" ); - store.add( report_mem_leaks ); - - /////////////////////////////////////////////// - - rt::parameter<std::string> report_sink( btrt_report_sink, ( - rt::description = "Specifies report sink: stderr(default), stdout or file name.", - rt::env_var = "BOOST_TEST_REPORT_SINK", - rt::value_hint = "<stderr|stdout|file name>", - rt::help = "Sets the result report sink - " - "the location where the framework writes the result report to. " - "The sink may be a a file or a standard " - "stream. The default is 'stderr': the " - "standard error stream." - )); - - report_sink.add_cla_id( "--", btrt_report_sink, "=" ); - report_sink.add_cla_id( "-", "e", " " ); - store.add( report_sink ); - - /////////////////////////////////////////////// - - rt::option result_code( btrt_result_code, ( - rt::description = "Disables test modules's result code generation.", - rt::env_var = "BOOST_TEST_RESULT_CODE", - rt::default_value = true, - rt::help = "The 'no' argument value for the parameter " + btrt_result_code + " instructs the " - "framework to always return zero result code. This can be used for test programs " - "executed within IDE. By default this parameter has value 'yes'." - )); - - result_code.add_cla_id( "--", btrt_result_code, "=", true ); - result_code.add_cla_id( "-", "c", " " ); - store.add( result_code ); - - /////////////////////////////////////////////// - - rt::parameter<std::string,rt::REPEATABLE_PARAM> tests_to_run( btrt_run_filters, ( - rt::description = "Filters which tests to execute.", - rt::env_var = "BOOST_TEST_RUN_FILTERS", - rt::value_hint = "<test unit filter>", - rt::help = "Filters which test units to execute. " - "The framework supports both 'selection filters', which allow to select " - "which test units to enable from the set of available test units, and 'disabler " - "filters', which allow to disable some test units. Boost.test also supports " - "enabling/disabling test units at compile time. These settings identify the default " - "set of test units to run. Parameter " + btrt_run_filters + " is used to change this default. " - "This parameter is repeatable, so you can specify more than one filter if necessary." - )); - - tests_to_run.add_cla_id( "--", btrt_run_filters, "=" ); - tests_to_run.add_cla_id( "-", "t", " " ); - store.add( tests_to_run ); - - /////////////////////////////////////////////// - - rt::option save_test_pattern( btrt_save_test_pattern, ( - rt::description = "Allows to switch between saving or matching test pattern file.", - rt::env_var = "BOOST_TEST_SAVE_PATTERN", - rt::help = "Parameter " + btrt_save_test_pattern + " facilitates switching mode of operation for " - "testing output streams.\n\nThis parameter serves no particular purpose within the " - "framework itself. It can be used by test modules relying on output_test_stream to " - "implement testing logic. Default mode is 'match' (false)." - )); - - save_test_pattern.add_cla_id( "--", btrt_save_test_pattern, "=" ); - store.add( save_test_pattern ); - - /////////////////////////////////////////////// - - rt::option show_progress( btrt_show_progress, ( - rt::description = "Turns on progress display.", - rt::env_var = "BOOST_TEST_SHOW_PROGRESS", - rt::help = "Instructs the framework to display the progress of the tests. " - "This feature is turned off by default." - )); - - show_progress.add_cla_id( "--", btrt_show_progress, "=" ); - show_progress.add_cla_id( "-", "p", " " ); - store.add( show_progress ); - - /////////////////////////////////////////////// - - rt::option use_alt_stack( btrt_use_alt_stack, ( - rt::description = "Turns on/off usage of an alternative stack for signal handling.", - rt::env_var = "BOOST_TEST_USE_ALT_STACK", - rt::default_value = true, - rt::help = "Instructs the framework to use an alternative " - "stack for operating system's signals handling (on platforms where this is supported). " - "The feature is enabled by default, but can be disabled using this command line switch." - )); - - use_alt_stack.add_cla_id( "--", btrt_use_alt_stack, "=", true ); - store.add( use_alt_stack ); - - /////////////////////////////////////////////// - - rt::option wait_for_debugger( btrt_wait_for_debugger, ( - rt::description = "Forces test module to wait for button to be pressed before starting test run.", - rt::env_var = "BOOST_TEST_WAIT_FOR_DEBUGGER", - rt::help = "Instructs the framework to pause before starting " - "test units execution, so that you can attach a debugger to the test module process. " - "This feature is turned off by default." - )); - - wait_for_debugger.add_cla_id( "--", btrt_wait_for_debugger, "=" ); - wait_for_debugger.add_cla_id( "-", "w", " " ); - store.add( wait_for_debugger ); - - /////////////////////////////////////////////// - - rt::parameter<std::string> help( btrt_help, ( - rt::description = "Help for framework parameters.", - rt::optional_value = std::string(), - rt::value_hint = "<parameter name>", - rt::help = "Displays help on the framework's parameters. " - "The parameter accepts an optional argument value. If present, an argument value is " - "interpreted as a parameter name (name guessing works as well, so for example " - "'--help=rand' displays help on the parameter 'random'). If the parameter name is unknown " - "or ambiguous error is reported. If argument value is absent, a summary of all " - "framework's parameter is displayed." - )); - help.add_cla_id( "--", btrt_help, "=" ); - store.add( help ); - - /////////////////////////////////////////////// - - rt::option usage( btrt_usage, ( - rt::description = "Short message explaining usage of Boost.Test parameters." - )); - usage.add_cla_id( "-", "?", " " ); - store.add( usage ); - - /////////////////////////////////////////////// - - rt::option version( btrt_version, ( - rt::description = "Prints Boost.Test version and exits." - )); - version.add_cla_id( "--", btrt_version, " " ); - store.add( version ); -} - -static rt::arguments_store s_arguments_store; -static rt::parameters_store s_parameters_store; - -//____________________________________________________________________________// - -} // local namespace - -void -init( int& argc, char** argv ) -{ - shared_ptr<rt::cla::parser> parser; - - BOOST_TEST_I_TRY { - // Initialize parameters list - if( s_parameters_store.is_empty() ) - register_parameters( s_parameters_store ); - - // Clear up arguments store just in case (of multiple init invocations) - s_arguments_store.clear(); - - // Parse CLA they take precedence over environment - parser.reset( new rt::cla::parser( s_parameters_store, (rt::end_of_params = "--", rt::negation_prefix = "no_") ) ); - argc = parser->parse( argc, argv, s_arguments_store ); - - // Try to fetch missing arguments from environment - rt::env::fetch_absent( s_parameters_store, s_arguments_store ); - - // Set arguments to default values if defined and perform all the validations - rt::finalize_arguments( s_parameters_store, s_arguments_store ); - - // check if colorized output is enabled - bool use_color = true; - if( s_arguments_store.has(btrt_color_output ) ) { - use_color = runtime_config::get<bool>(runtime_config::btrt_color_output); - } - - // Report help if requested - if( runtime_config::get<bool>( btrt_version ) ) { - parser->version( std::cerr ); - BOOST_TEST_I_THROW( framework::nothing_to_test( boost::exit_success ) ); - } - else if( runtime_config::get<bool>( btrt_usage ) ) { - parser->usage( std::cerr, runtime::cstring(), use_color ); - BOOST_TEST_I_THROW( framework::nothing_to_test( boost::exit_success ) ); - } - else if( s_arguments_store.has( btrt_help ) ) { - parser->help(std::cerr, - s_parameters_store, - runtime_config::get<std::string>( btrt_help ), - use_color ); - BOOST_TEST_I_THROW( framework::nothing_to_test( boost::exit_success ) ); - } - - // A bit of business logic: output_format takes precedence over log/report formats - if( s_arguments_store.has( btrt_output_format ) ) { - unit_test::output_format of = s_arguments_store.get<unit_test::output_format>( btrt_output_format ); - s_arguments_store.set( btrt_report_format, of ); - s_arguments_store.set( btrt_log_format, of ); - } - - } - BOOST_TEST_I_CATCH( rt::init_error, ex ) { - BOOST_TEST_SETUP_ASSERT( false, ex.msg ); - } - BOOST_TEST_I_CATCH( rt::ambiguous_param, ex ) { - std::cerr << ex.msg << "\n Did you mean one of these?\n"; - - BOOST_TEST_FOREACH( rt::cstring, name, ex.m_amb_candidates ) - std::cerr << " " << name << "\n"; - - BOOST_TEST_I_THROW( framework::nothing_to_test( boost::exit_exception_failure ) ); - } - BOOST_TEST_I_CATCH( rt::unrecognized_param, ex ) { - std::cerr << ex.msg << "\n"; - - if( !ex.m_typo_candidates.empty() ) { - std::cerr << " Did you mean one of these?\n"; - - BOOST_TEST_FOREACH( rt::cstring, name, ex.m_typo_candidates ) - std::cerr << " " << name << "\n"; - } - else if( parser ) { - std::cerr << "\n"; - parser->usage( std::cerr ); - } - - BOOST_TEST_I_THROW( framework::nothing_to_test( boost::exit_exception_failure ) ); - } - BOOST_TEST_I_CATCH( rt::input_error, ex ) { - std::cerr << ex.msg << "\n\n"; - - if( parser ) - parser->usage( std::cerr, ex.param_name ); - - BOOST_TEST_I_THROW( framework::nothing_to_test( boost::exit_exception_failure ) ); - } -} - -//____________________________________________________________________________// - -rt::arguments_store const& -argument_store() -{ - return s_arguments_store; -} - -//____________________________________________________________________________// - -bool -save_pattern() -{ - return runtime_config::get<bool>( btrt_save_test_pattern ); -} - -//____________________________________________________________________________// - -} // namespace runtime_config -} // namespace unit_test -} // namespace boost - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_UNIT_TEST_PARAMETERS_IPP_012205GER diff --git a/contrib/restricted/boost/test/include/boost/test/impl/xml_log_formatter.ipp b/contrib/restricted/boost/test/include/boost/test/impl/xml_log_formatter.ipp deleted file mode 100644 index e244d4d5f0..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/impl/xml_log_formatter.ipp +++ /dev/null @@ -1,225 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : implements OF_XML Log formatter -// *************************************************************************** - -#ifndef BOOST_TEST_XML_LOG_FORMATTER_IPP_020105GER -#define BOOST_TEST_XML_LOG_FORMATTER_IPP_020105GER - -// Boost.Test -#include <boost/test/output/xml_log_formatter.hpp> -#include <boost/test/execution_monitor.hpp> -#include <boost/test/framework.hpp> -#include <boost/test/tree/test_unit.hpp> -#include <boost/test/utils/basic_cstring/io.hpp> -#include <boost/test/utils/xml_printer.hpp> - -// Boost -#include <boost/version.hpp> - -// STL -#include <iostream> - -#include <boost/test/detail/suppress_warnings.hpp> - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { -namespace output { - -static const_string tu_type_name( test_unit const& tu ) -{ - return tu.p_type == TUT_CASE ? "TestCase" : "TestSuite"; -} - -// ************************************************************************** // -// ************** xml_log_formatter ************** // -// ************************************************************************** // - -void -xml_log_formatter::log_start( std::ostream& ostr, counter_t ) -{ - ostr << "<TestLog>"; -} - -//____________________________________________________________________________// - -void -xml_log_formatter::log_finish( std::ostream& ostr ) -{ - ostr << "</TestLog>"; -} - -//____________________________________________________________________________// - -void -xml_log_formatter::log_build_info( std::ostream& ostr, bool log_build_info ) -{ - if( log_build_info ) { - ostr << "<BuildInfo" - << " platform" << utils::attr_value() << BOOST_PLATFORM - << " compiler" << utils::attr_value() << BOOST_COMPILER - << " stl" << utils::attr_value() << BOOST_STDLIB - << " boost=\"" << BOOST_VERSION/100000 << "." - << BOOST_VERSION/100 % 1000 << "." - << BOOST_VERSION % 100 << '\"' - << "/>"; - } -} - -//____________________________________________________________________________// - -void -xml_log_formatter::test_unit_start( std::ostream& ostr, test_unit const& tu ) -{ - ostr << "<" << tu_type_name( tu ) << " name" << utils::attr_value() << tu.p_name.get(); - - if( !tu.p_file_name.empty() ) - ostr << BOOST_TEST_L( " file" ) << utils::attr_value() << tu.p_file_name - << BOOST_TEST_L( " line" ) << utils::attr_value() << tu.p_line_num; - - ostr << ">"; -} - -//____________________________________________________________________________// - -void -xml_log_formatter::test_unit_finish( std::ostream& ostr, test_unit const& tu, unsigned long elapsed ) -{ - if( tu.p_type == TUT_CASE ) - ostr << "<TestingTime>" << elapsed << "</TestingTime>"; - - ostr << "</" << tu_type_name( tu ) << ">"; -} - -//____________________________________________________________________________// - -void -xml_log_formatter::test_unit_skipped( std::ostream& ostr, test_unit const& tu, const_string reason ) -{ - ostr << "<" << tu_type_name( tu ) - << " name" << utils::attr_value() << tu.p_name.get() - << " skipped" << utils::attr_value() << "yes" - << " reason" << utils::attr_value() << reason - << "/>"; -} - -//____________________________________________________________________________// - -void -xml_log_formatter::log_exception_start( std::ostream& ostr, log_checkpoint_data const& checkpoint_data, execution_exception const& ex ) -{ - execution_exception::location const& loc = ex.where(); - - ostr << "<Exception file" << utils::attr_value() << loc.m_file_name - << " line" << utils::attr_value() << loc.m_line_num; - - if( !loc.m_function.is_empty() ) - ostr << " function" << utils::attr_value() << loc.m_function; - - ostr << ">" << utils::cdata() << ex.what(); - - if( !checkpoint_data.m_file_name.is_empty() ) { - ostr << "<LastCheckpoint file" << utils::attr_value() << checkpoint_data.m_file_name - << " line" << utils::attr_value() << checkpoint_data.m_line_num - << ">" - << utils::cdata() << checkpoint_data.m_message - << "</LastCheckpoint>"; - } -} - -//____________________________________________________________________________// - -void -xml_log_formatter::log_exception_finish( std::ostream& ostr ) -{ - ostr << "</Exception>"; -} - -//____________________________________________________________________________// - -void -xml_log_formatter::log_entry_start( std::ostream& ostr, log_entry_data const& entry_data, log_entry_types let ) -{ - static literal_string xml_tags[] = { "Info", "Message", "Warning", "Error", "FatalError" }; - - m_curr_tag = xml_tags[let]; - ostr << '<' << m_curr_tag - << BOOST_TEST_L( " file" ) << utils::attr_value() << entry_data.m_file_name - << BOOST_TEST_L( " line" ) << utils::attr_value() << entry_data.m_line_num - << BOOST_TEST_L( "><![CDATA[" ); - - m_value_closed = false; -} - -//____________________________________________________________________________// - -void -xml_log_formatter::log_entry_value( std::ostream& ostr, const_string value ) -{ - utils::print_escaped_cdata( ostr, value ); -} - -//____________________________________________________________________________// - -void -xml_log_formatter::log_entry_finish( std::ostream& ostr ) -{ - if( !m_value_closed ) { - ostr << BOOST_TEST_L( "]]>" ); - m_value_closed = true; - } - - ostr << BOOST_TEST_L( "</" ) << m_curr_tag << BOOST_TEST_L( ">" ); - - m_curr_tag.clear(); -} - -//____________________________________________________________________________// - -void -xml_log_formatter::entry_context_start( std::ostream& ostr, log_level ) -{ - if( !m_value_closed ) { - ostr << BOOST_TEST_L( "]]>" ); - m_value_closed = true; - } - - ostr << BOOST_TEST_L( "<Context>" ); -} - -//____________________________________________________________________________// - -void -xml_log_formatter::entry_context_finish( std::ostream& ostr, log_level ) -{ - ostr << BOOST_TEST_L( "</Context>" ); -} - -//____________________________________________________________________________// - -void -xml_log_formatter::log_entry_context( std::ostream& ostr, log_level, const_string context_descr ) -{ - ostr << BOOST_TEST_L( "<Frame>" ) << utils::cdata() << context_descr << BOOST_TEST_L( "</Frame>" ); -} - -//____________________________________________________________________________// - -} // namespace output -} // namespace unit_test -} // namespace boost - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_XML_LOG_FORMATTER_IPP_020105GER diff --git a/contrib/restricted/boost/test/include/boost/test/impl/xml_report_formatter.ipp b/contrib/restricted/boost/test/include/boost/test/impl/xml_report_formatter.ipp deleted file mode 100644 index 2718895b80..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/impl/xml_report_formatter.ipp +++ /dev/null @@ -1,117 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : OF_XML report formatter -// *************************************************************************** - -#ifndef BOOST_TEST_XML_REPORT_FORMATTER_IPP_020105GER -#define BOOST_TEST_XML_REPORT_FORMATTER_IPP_020105GER - -// Boost.Test -#include <boost/test/results_collector.hpp> -#include <boost/test/output/xml_report_formatter.hpp> - -#include <boost/test/tree/test_unit.hpp> -#include <boost/test/utils/xml_printer.hpp> -#include <boost/test/utils/basic_cstring/io.hpp> - -#include <boost/test/detail/suppress_warnings.hpp> - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { -namespace output { - -void -xml_report_formatter::results_report_start( std::ostream& ostr ) -{ - ostr << "<TestResult>"; -} - -//____________________________________________________________________________// - -void -xml_report_formatter::results_report_finish( std::ostream& ostr ) -{ - ostr << "</TestResult>"; -} - - -//____________________________________________________________________________// - -void -xml_report_formatter::test_unit_report_start( test_unit const& tu, std::ostream& ostr ) -{ - test_results const& tr = results_collector.results( tu.p_id ); - - const_string descr; - - if( tr.passed() ) - descr = "passed"; - else if( tr.p_skipped ) - descr = "skipped"; - else if( tr.p_timed_out ) - descr = "timed-out"; - else if( tr.p_aborted ) - descr = "aborted"; - else - descr = "failed"; - - ostr << '<' << ( tu.p_type == TUT_CASE ? "TestCase" : "TestSuite" ) - << " name" << utils::attr_value() << tu.p_name.get() - << " result" << utils::attr_value() << descr - << " assertions_passed" << utils::attr_value() << tr.p_assertions_passed - << " assertions_failed" << utils::attr_value() << tr.p_assertions_failed - << " warnings_failed" << utils::attr_value() << tr.p_warnings_failed - << " expected_failures" << utils::attr_value() << tr.p_expected_failures - ; - - if( tu.p_type == TUT_SUITE ) { - ostr << " test_cases_passed" << utils::attr_value() << tr.p_test_cases_passed - << " test_cases_passed_with_warnings" << utils::attr_value() << tr.p_test_cases_warned - << " test_cases_failed" << utils::attr_value() << tr.p_test_cases_failed - << " test_cases_skipped" << utils::attr_value() << tr.p_test_cases_skipped - << " test_cases_aborted" << utils::attr_value() << tr.p_test_cases_aborted - << " test_cases_timed_out" << utils::attr_value() << tr.p_test_cases_timed_out - << " test_suites_timed_out"<< utils::attr_value() << tr.p_test_suites_timed_out - ; - } - - ostr << '>'; -} - -//____________________________________________________________________________// - -void -xml_report_formatter::test_unit_report_finish( test_unit const& tu, std::ostream& ostr ) -{ - ostr << "</" << ( tu.p_type == TUT_CASE ? "TestCase" : "TestSuite" ) << '>'; -} - -//____________________________________________________________________________// - -void -xml_report_formatter::do_confirmation_report( test_unit const& tu, std::ostream& ostr ) -{ - test_unit_report_start( tu, ostr ); - test_unit_report_finish( tu, ostr ); -} - -//____________________________________________________________________________// - -} // namespace output -} // namespace unit_test -} // namespace boost - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_XML_REPORT_FORMATTER_IPP_020105GER diff --git a/contrib/restricted/boost/test/include/boost/test/output/compiler_log_formatter.hpp b/contrib/restricted/boost/test/include/boost/test/output/compiler_log_formatter.hpp deleted file mode 100644 index ba4e1649f5..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/output/compiler_log_formatter.hpp +++ /dev/null @@ -1,73 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -/// @file -/// @brief Contains the formatter for the Human Readable Format (HRF) -// *************************************************************************** - -#ifndef BOOST_TEST_COMPILER_LOG_FORMATTER_HPP_020105GER -#define BOOST_TEST_COMPILER_LOG_FORMATTER_HPP_020105GER - -// Boost.Test -#include <boost/test/detail/global_typedef.hpp> -#include <boost/test/unit_test_log_formatter.hpp> - -#include <boost/test/utils/setcolor.hpp> - -#include <boost/test/detail/suppress_warnings.hpp> - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { -namespace output { - -// ************************************************************************** // -// ************** compiler_log_formatter ************** // -// ************************************************************************** // - -//!@brief Log formatter for the Human Readable Format (HRF) log format -class BOOST_TEST_DECL compiler_log_formatter : public unit_test_log_formatter { -public: - compiler_log_formatter() : m_color_output( false ), m_color_state() {} - - // Formatter interface - void log_start( std::ostream&, counter_t test_cases_amount ) BOOST_OVERRIDE; - void log_finish( std::ostream& ) BOOST_OVERRIDE; - void log_build_info( std::ostream&, bool ) BOOST_OVERRIDE; - - void test_unit_start( std::ostream&, test_unit const& tu ) BOOST_OVERRIDE; - void test_unit_finish( std::ostream&, test_unit const& tu, unsigned long elapsed ) BOOST_OVERRIDE; - void test_unit_skipped( std::ostream&, test_unit const& tu, const_string reason ) BOOST_OVERRIDE; - - void log_exception_start( std::ostream&, log_checkpoint_data const&, execution_exception const& ex ) BOOST_OVERRIDE; - void log_exception_finish( std::ostream& ) BOOST_OVERRIDE; - - void log_entry_start( std::ostream&, log_entry_data const&, log_entry_types let ) BOOST_OVERRIDE; - void log_entry_value( std::ostream&, const_string value ) BOOST_OVERRIDE; - void log_entry_value( std::ostream&, lazy_ostream const& value ) BOOST_OVERRIDE; - void log_entry_finish( std::ostream& ) BOOST_OVERRIDE; - - void entry_context_start( std::ostream&, log_level ) BOOST_OVERRIDE; - void log_entry_context( std::ostream&, log_level l, const_string ) BOOST_OVERRIDE; - void entry_context_finish( std::ostream&, log_level l ) BOOST_OVERRIDE; - -protected: - virtual void print_prefix( std::ostream&, const_string file, std::size_t line ); - - // Data members - bool m_color_output; - utils::setcolor::state m_color_state; -}; - -} // namespace output -} // namespace unit_test -} // namespace boost - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_COMPILER_LOG_FORMATTER_HPP_020105GER diff --git a/contrib/restricted/boost/test/include/boost/test/output/junit_log_formatter.hpp b/contrib/restricted/boost/test/include/boost/test/output/junit_log_formatter.hpp deleted file mode 100644 index 9695683572..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/output/junit_log_formatter.hpp +++ /dev/null @@ -1,168 +0,0 @@ -// (C) Copyright 2016 Raffi Enficiaud. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -///@file -///@brief Contains the definition of the Junit log formatter (OF_JUNIT) -// *************************************************************************** - -#ifndef BOOST_TEST_JUNIT_LOG_FORMATTER__ -#define BOOST_TEST_JUNIT_LOG_FORMATTER__ - -// Boost.Test -#include <boost/test/detail/global_typedef.hpp> -#include <boost/test/unit_test_log_formatter.hpp> -#include <boost/test/tree/test_unit.hpp> - -//#include <boost/test/results_collector.hpp> - -// STL -#include <cstddef> // std::size_t -#include <map> -#include <list> - -#include <boost/test/detail/suppress_warnings.hpp> - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { -namespace output { - - - namespace junit_impl { - - // helper for the JUnit logger - struct junit_log_helper - { - struct assertion_entry { - - enum log_entry_t { - log_entry_info, - log_entry_error, - log_entry_failure - }; - - assertion_entry() : sealed(false) - {} - - std::string logentry_message; // the message associated to the JUnit error/entry - std::string logentry_type; // the one that will get expanded in the final junit (failure, error) - std::string output; // additional information/message generated by the assertion - - log_entry_t log_entry; // the type associated to the assertion (or error) - - bool sealed; // indicates if the entry can accept additional information - }; - - std::list<std::string> system_out; // sysout: additional information - std::list<std::string> system_err; // syserr: additional information - std::string skipping_reason; - - // list of failure, errors and messages (assertions message and the full log) - std::vector< assertion_entry > assertion_entries; - - bool skipping; - - junit_log_helper(): skipping(false) - {} - - void clear() { - assertion_entries.clear(); - system_out.clear(); - system_err.clear(); - skipping_reason.clear(); - skipping = false; - } - - }; - } - -// ************************************************************************** // -// ************** junit_log_formatter ************** // -// ************************************************************************** // - -/// JUnit logger class -class junit_log_formatter : public unit_test_log_formatter { -public: - - junit_log_formatter() : m_display_build_info(false) - { - // we log everything from the logger singleton point of view - // because we need to know about all the messages/commands going to the logger - // we decide what we put inside the logs internally - this->m_log_level = log_successful_tests; - m_log_level_internal = log_messages; - } - - // Formatter interface - void log_start( std::ostream&, counter_t test_cases_amount ) BOOST_OVERRIDE; - void log_finish( std::ostream& ) BOOST_OVERRIDE; - void log_build_info( std::ostream&, bool ) BOOST_OVERRIDE; - - void test_unit_start( std::ostream&, test_unit const& tu ) BOOST_OVERRIDE; - void test_unit_finish( std::ostream&, test_unit const& tu, unsigned long elapsed ) BOOST_OVERRIDE; - void test_unit_skipped( std::ostream&, test_unit const& tu, const_string reason ) BOOST_OVERRIDE; - void test_unit_aborted( std::ostream& os, test_unit const& tu ) BOOST_OVERRIDE; - void test_unit_timed_out( std::ostream& os, test_unit const& tu) BOOST_OVERRIDE; - - void log_exception_start( std::ostream&, log_checkpoint_data const&, execution_exception const& ex ) BOOST_OVERRIDE; - void log_exception_finish( std::ostream& ) BOOST_OVERRIDE; - - void log_entry_start( std::ostream&, log_entry_data const&, log_entry_types let ) BOOST_OVERRIDE; - - using unit_test_log_formatter::log_entry_value; // bring base class functions into overload set - void log_entry_value( std::ostream&, const_string value ) BOOST_OVERRIDE; - void log_entry_finish( std::ostream& ) BOOST_OVERRIDE; - - void entry_context_start( std::ostream&, log_level ) BOOST_OVERRIDE; - void log_entry_context( std::ostream&, log_level, const_string ) BOOST_OVERRIDE; - void entry_context_finish( std::ostream&, log_level ) BOOST_OVERRIDE; - - //! Discards changes in the log level - void set_log_level(log_level ll) BOOST_OVERRIDE - { - if(ll > log_successful_tests && ll < log_messages) - ll = log_successful_tests; - else if (ll > log_all_errors) - ll = log_all_errors; - - this->m_log_level_internal = ll; - } - - //! Instead of a regular stream, returns a file name corresponding to - //! the current master test suite. If the file already exists, adds an index - //! to it. - std::string get_default_stream_description() const BOOST_OVERRIDE; - - -private: - typedef std::map<test_unit_id, junit_impl::junit_log_helper> map_trace_t; - map_trace_t map_tests; - junit_impl::junit_log_helper runner_log_entry; - - junit_impl::junit_log_helper& get_current_log_entry() { - if(list_path_to_root.empty()) - return runner_log_entry; - map_trace_t::iterator it = map_tests.find(list_path_to_root.back()); - return (it == map_tests.end() ? runner_log_entry : it->second); - } - - std::list<test_unit_id> list_path_to_root; - bool m_display_build_info; - bool m_is_last_assertion_or_error; // true if failure, false if error - - log_level m_log_level_internal; - friend class junit_result_helper; -}; - -} // namespace output -} // namespace unit_test -} // namespace boost - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_JUNIT_LOG_FORMATTER__ diff --git a/contrib/restricted/boost/test/include/boost/test/output/plain_report_formatter.hpp b/contrib/restricted/boost/test/include/boost/test/output/plain_report_formatter.hpp deleted file mode 100644 index 82041cec68..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/output/plain_report_formatter.hpp +++ /dev/null @@ -1,59 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : plain report formatter implementation -// *************************************************************************** - -#ifndef BOOST_TEST_PLAIN_REPORT_FORMATTER_HPP_020105GER -#define BOOST_TEST_PLAIN_REPORT_FORMATTER_HPP_020105GER - -// Boost.Test -#include <boost/test/detail/global_typedef.hpp> -#include <boost/test/results_reporter.hpp> - -#include <boost/test/detail/suppress_warnings.hpp> - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { -namespace output { - -// ************************************************************************** // -// ************** plain_report_formatter ************** // -// ************************************************************************** // - -class plain_report_formatter : public results_reporter::format { -public: - plain_report_formatter() : m_indent( 0 ), m_color_output( false ) {} - - // Formatter interface - void results_report_start( std::ostream& ostr ) BOOST_OVERRIDE; - void results_report_finish( std::ostream& ostr ) BOOST_OVERRIDE; - - void test_unit_report_start( test_unit const&, std::ostream& ostr ) BOOST_OVERRIDE; - void test_unit_report_finish( test_unit const&, std::ostream& ostr ) BOOST_OVERRIDE; - - void do_confirmation_report( test_unit const&, std::ostream& ostr ) BOOST_OVERRIDE; - -private: - // Data members - counter_t m_indent; - bool m_color_output; -}; - -} // namespace output -} // namespace unit_test -} // namespace boost - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_PLAIN_REPORT_FORMATTER_HPP_020105GER diff --git a/contrib/restricted/boost/test/include/boost/test/output/xml_log_formatter.hpp b/contrib/restricted/boost/test/include/boost/test/output/xml_log_formatter.hpp deleted file mode 100644 index cbea180bde..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/output/xml_log_formatter.hpp +++ /dev/null @@ -1,72 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : contains OF_XML Log formatter definition -// *************************************************************************** - -#ifndef BOOST_TEST_XML_LOG_FORMATTER_020105GER -#define BOOST_TEST_XML_LOG_FORMATTER_020105GER - -// Boost.Test -#include <boost/test/detail/global_typedef.hpp> -#include <boost/test/unit_test_log_formatter.hpp> - -// STL -#include <cstddef> // std::size_t - -#include <boost/test/detail/suppress_warnings.hpp> - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { -namespace output { - -// ************************************************************************** // -// ************** xml_log_formatter ************** // -// ************************************************************************** // - -class xml_log_formatter : public unit_test_log_formatter { -public: - // Formatter interface - void log_start( std::ostream&, counter_t test_cases_amount ) BOOST_OVERRIDE; - void log_finish( std::ostream& ) BOOST_OVERRIDE; - void log_build_info( std::ostream&, bool ) BOOST_OVERRIDE; - - void test_unit_start( std::ostream&, test_unit const& tu ) BOOST_OVERRIDE; - void test_unit_finish( std::ostream&, test_unit const& tu, unsigned long elapsed ) BOOST_OVERRIDE; - void test_unit_skipped( std::ostream&, test_unit const& tu, const_string reason ) BOOST_OVERRIDE; - - void log_exception_start( std::ostream&, log_checkpoint_data const&, execution_exception const& ex ) BOOST_OVERRIDE; - void log_exception_finish( std::ostream& ) BOOST_OVERRIDE; - - void log_entry_start( std::ostream&, log_entry_data const&, log_entry_types let ) BOOST_OVERRIDE; - using unit_test_log_formatter::log_entry_value; // bring base class functions into overload set - void log_entry_value( std::ostream&, const_string value ) BOOST_OVERRIDE; - void log_entry_finish( std::ostream& ) BOOST_OVERRIDE; - - void entry_context_start( std::ostream&, log_level ) BOOST_OVERRIDE; - void log_entry_context( std::ostream&, log_level, const_string ) BOOST_OVERRIDE; - void entry_context_finish( std::ostream&, log_level ) BOOST_OVERRIDE; - -private: - // Data members - const_string m_curr_tag; - bool m_value_closed; -}; - -} // namespace output -} // namespace unit_test -} // namespace boost - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_XML_LOG_FORMATTER_020105GER diff --git a/contrib/restricted/boost/test/include/boost/test/output/xml_report_formatter.hpp b/contrib/restricted/boost/test/include/boost/test/output/xml_report_formatter.hpp deleted file mode 100644 index 555377f470..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/output/xml_report_formatter.hpp +++ /dev/null @@ -1,52 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : OF_XML report formatter implementation -// *************************************************************************** - -#ifndef BOOST_TEST_XML_REPORT_FORMATTER_HPP_020105GER -#define BOOST_TEST_XML_REPORT_FORMATTER_HPP_020105GER - -// Boost.Test -#include <boost/test/detail/global_typedef.hpp> -#include <boost/test/results_reporter.hpp> - -#include <boost/test/detail/suppress_warnings.hpp> - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { -namespace output { - -// ************************************************************************** // -// ************** xml_report_formatter ************** // -// ************************************************************************** // - -class xml_report_formatter : public results_reporter::format { -public: - // Formatter interface - void results_report_start( std::ostream& ostr ) BOOST_OVERRIDE; - void results_report_finish( std::ostream& ostr ) BOOST_OVERRIDE; - - void test_unit_report_start( test_unit const&, std::ostream& ostr ) BOOST_OVERRIDE; - void test_unit_report_finish( test_unit const&, std::ostream& ostr ) BOOST_OVERRIDE; - - void do_confirmation_report( test_unit const&, std::ostream& ostr ) BOOST_OVERRIDE; -}; - -} // namespace output -} // namespace unit_test -} // namespace boost - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_XML_REPORT_FORMATTER_HPP_020105GER diff --git a/contrib/restricted/boost/test/include/boost/test/progress_monitor.hpp b/contrib/restricted/boost/test/include/boost/test/progress_monitor.hpp deleted file mode 100644 index cc188d6372..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/progress_monitor.hpp +++ /dev/null @@ -1,65 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -/// @file -/// @brief defines simple text based progress monitor -// *************************************************************************** - -#ifndef BOOST_TEST_PROGRESS_MONITOR_HPP_020105GER -#define BOOST_TEST_PROGRESS_MONITOR_HPP_020105GER - -// Boost.Test -#include <boost/test/tree/observer.hpp> - -// STL -#include <iosfwd> // for std::ostream& - -#include <boost/test/detail/suppress_warnings.hpp> - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { - -// ************************************************************************** // -// ************** progress_monitor ************** // -// ************************************************************************** // - -/// This class implements test observer interface and updates test progress as test units finish or get aborted -class BOOST_TEST_DECL progress_monitor_t : public test_observer { -public: - /// @name Test observer interface - /// @{ - void test_start( counter_t test_cases_amount, test_unit_id ) BOOST_OVERRIDE; - void test_aborted() BOOST_OVERRIDE; - - void test_unit_finish( test_unit const&, unsigned long ) BOOST_OVERRIDE; - void test_unit_skipped( test_unit const&, const_string ) BOOST_OVERRIDE; - - int priority() BOOST_OVERRIDE { return 4; } - /// @} - - /// @name Configuration - /// @{ - void set_stream( std::ostream& ); - /// @} - - /// Singleton pattern - BOOST_TEST_SINGLETON_CONS( progress_monitor_t ) -}; // progress_monitor_t - -BOOST_TEST_SINGLETON_INST( progress_monitor ) - -} // namespace unit_test -} // namespace boost - -//____________________________________________________________________________// - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_PROGRESS_MONITOR_HPP_020105GER - diff --git a/contrib/restricted/boost/test/include/boost/test/results_collector.hpp b/contrib/restricted/boost/test/include/boost/test/results_collector.hpp deleted file mode 100644 index b8edfffdb4..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/results_collector.hpp +++ /dev/null @@ -1,153 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -/// @file -/// @brief Defines testing result collector components -/// -/// Defines classes for keeping track (@ref test_results) and collecting -/// (@ref results_collector_t) the states of the test units. -// *************************************************************************** - -#ifndef BOOST_TEST_RESULTS_COLLECTOR_HPP_071894GER -#define BOOST_TEST_RESULTS_COLLECTOR_HPP_071894GER - -// Boost.Test -#include <boost/test/tree/observer.hpp> - -#include <boost/test/detail/global_typedef.hpp> -#include <boost/test/detail/fwd_decl.hpp> - -#include <boost/test/utils/class_properties.hpp> - -#include <boost/test/detail/suppress_warnings.hpp> - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { - -namespace { - -// ************************************************************************** // -/// First failed assertion debugger hook -/// -/// This function is a placeholder where user can set a breakpoint in debugger to catch the -/// very first assertion failure in each test case -// ************************************************************************** // -inline void first_failed_assertion() {} -} - -// ************************************************************************** // -/// @brief Collection of attributes constituting test unit results -/// -/// This class is a collection of attributes describing a test result. -/// -/// The attributes presented as public properties on -/// an instance of the class. In addition summary conclusion methods are presented to generate simple answer to pass/fail question - -class BOOST_TEST_DECL test_results { -public: - test_results(); - - /// Type representing counter like public property - typedef BOOST_READONLY_PROPERTY( counter_t, (results_collector_t) - (test_results) - (results_collect_helper) ) counter_prop; - /// Type representing boolean like public property - typedef BOOST_READONLY_PROPERTY( bool, (results_collector_t) - (test_results) - (results_collect_helper) ) bool_prop; - - counter_prop p_test_suites; //!< Number of test suites - counter_prop p_assertions_passed; //!< Number of successful assertions - counter_prop p_assertions_failed; //!< Number of failing assertions - counter_prop p_warnings_failed; //!< Number of warnings - counter_prop p_expected_failures; - counter_prop p_test_cases_passed; //!< Number of successfull test cases - counter_prop p_test_cases_warned; //!< Number of warnings in test cases - counter_prop p_test_cases_failed; //!< Number of failing test cases - counter_prop p_test_cases_skipped; //!< Number of skipped test cases - counter_prop p_test_cases_aborted; //!< Number of aborted test cases - counter_prop p_test_cases_timed_out; //!< Number of timed out test cases - counter_prop p_test_suites_timed_out; //!< Number of timed out test suites - counter_prop p_duration_microseconds; //!< Duration of the test in microseconds - bool_prop p_aborted; //!< Indicates that the test unit execution has been aborted - bool_prop p_skipped; //!< Indicates that the test unit execution has been skipped - bool_prop p_timed_out; //!< Indicates that the test unit has timed out - - /// Returns true if test unit passed - bool passed() const; - - /// Returns true if test unit skipped - /// - /// For test suites, this indicates if the test suite itself has been marked as - /// skipped, and not if the test suite contains any skipped test. - bool skipped() const; - - /// Returns true if the test unit was aborted (hard failure) - bool aborted() const; - - /// Produces result code for the test unit execution - /// - /// This methhod return one of the result codes defined in @c boost/cstdlib.hpp - /// @returns - /// - @c boost::exit_success on success, - /// - @c boost::exit_exception_failure in case test unit - /// was aborted for any reason (including uncaught exception) - /// - and @c boost::exit_test_failure otherwise - int result_code() const; - - //! Combines the results of the current instance with another - //! - //! Only the counters are updated and the @c p_aborted and @c p_skipped are left unchanged. - void operator+=( test_results const& ); - - //! Resets the current state of the result - void clear(); -}; - -// ************************************************************************** // -/// @brief Collects and combines the test results -/// -/// This class collects and combines the results of the test unit during the execution of the -/// test tree. The results_collector_t::results() function combines the test results on a subtree -/// of the test tree. -/// -/// @see boost::unit_test::test_observer -class BOOST_TEST_DECL results_collector_t : public test_observer { -public: - - void test_start( counter_t, test_unit_id ) BOOST_OVERRIDE; - - void test_unit_start( test_unit const& ) BOOST_OVERRIDE; - void test_unit_finish( test_unit const&, unsigned long ) BOOST_OVERRIDE; - void test_unit_skipped( test_unit const&, const_string ) BOOST_OVERRIDE; - void test_unit_aborted( test_unit const& ) BOOST_OVERRIDE; - void test_unit_timed_out( test_unit const& ) BOOST_OVERRIDE; - - void assertion_result( unit_test::assertion_result ) BOOST_OVERRIDE; - void exception_caught( execution_exception const& ) BOOST_OVERRIDE; - - int priority() BOOST_OVERRIDE { return 3; } - - /// Results access per test unit - /// - /// @param[in] tu_id id of a test unit - test_results const& results( test_unit_id tu_id ) const; - - /// Singleton pattern - BOOST_TEST_SINGLETON_CONS( results_collector_t ) -}; - -BOOST_TEST_SINGLETON_INST( results_collector ) - -} // namespace unit_test -} // namespace boost - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_RESULTS_COLLECTOR_HPP_071894GER diff --git a/contrib/restricted/boost/test/include/boost/test/results_reporter.hpp b/contrib/restricted/boost/test/include/boost/test/results_reporter.hpp deleted file mode 100644 index 6f8d8f1105..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/results_reporter.hpp +++ /dev/null @@ -1,122 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -/// @file -/// @brief defines testing result reporter interfaces -/// -/// This file defines interfaces that are responsible for results reporting. Interface is presented in a form of -/// free standing function implemented in namespace result_reporter -// *************************************************************************** - -#ifndef BOOST_TEST_RESULTS_REPORTER_HPP_021205GER -#define BOOST_TEST_RESULTS_REPORTER_HPP_021205GER - -// Boost.Test -#include <boost/test/detail/global_typedef.hpp> -#include <boost/test/detail/fwd_decl.hpp> - -// STL -#include <iosfwd> // for std::ostream& - -#include <boost/test/detail/suppress_warnings.hpp> - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { - -/// Namespace for results reporter interfaces -namespace results_reporter { - -// ************************************************************************** // -/// @brief Results report formatter interface -/// -/// This is abstract interface for the report formatter used by results reporter routines. -/// You can define a custom formatter by implementing this interface and setting the formatter using set_format function. -/// This is usually done during test module initialization -// ************************************************************************** // - -class BOOST_TEST_DECL format { -public: - // Destructor - virtual ~format() {} - - virtual void results_report_start( std::ostream& ostr ) = 0; - virtual void results_report_finish( std::ostream& ostr ) = 0; - - virtual void test_unit_report_start( test_unit const&, std::ostream& ostr ) = 0; - virtual void test_unit_report_finish( test_unit const&, std::ostream& ostr ) = 0; - - virtual void do_confirmation_report( test_unit const&, std::ostream& ostr ) = 0; -}; - -// ************************************************************************** // -/// @name report configuration -// ************************************************************************** // - -/// Sets reporting level - -/// There are only four possible levels for results report: -/// - confirmation report (boost::unit_test::CONFIRMATION_REPORT). This report level only produces short confirmation -/// message about test module pass/fail status -/// - short report (boost::unit_test::SHORT_REPORT). This report level produces short summary report for failed/passed -/// assertions and test units. -/// - detailed report (boost::unit_test::DETAILED_REPORT). This report level produces detailed report per test unit for -/// passed/failed assertions and uncaught exceptions -/// - no report (boost::unit_test::NO_REPORT). This report level produces no results report. This is used for test modules -/// running as part of some kind of continues integration framework -/// @param[in] l report level -BOOST_TEST_DECL void set_level( report_level l ); - -/// Sets output stream for results reporting - -/// By default std::cerr is used. Use this function to set a different stream. The framework -/// refers to the stream by reference, so you need to make sure the stream object lifetime exceeds the testing main scope. -BOOST_TEST_DECL void set_stream( std::ostream& ); - -/// Sets one of the predefined formats - -/// The framework implements two results report formats: -/// - plain human readable format (boost::unit_test::OF_CLF) -/// - XML format (boost::unit_test::OF_XML) -/// @param[in] of one of the presefined enumeration values for output formats -BOOST_TEST_DECL void set_format( output_format of ); - -/// Sets custom report formatter - -/// The framework takes ownership of the pointer passed as an argument. So this should be a pointer to -/// a heap allocated object -/// @param[in] f pointer to heap allocated instance of custom report formatter class -BOOST_TEST_DECL void set_format( results_reporter::format* f ); - -/// @brief Access to configured results reporter stream -/// -/// Use this stream to report additional information abut test module execution -BOOST_TEST_DECL std::ostream& get_stream(); - -/// @} - -// ************************************************************************** // -// ************** report initiation ************** // -// ************************************************************************** // - -BOOST_TEST_DECL void make_report( report_level l = INV_REPORT_LEVEL, test_unit_id = INV_TEST_UNIT_ID ); -inline void confirmation_report( test_unit_id id = INV_TEST_UNIT_ID ) -{ make_report( CONFIRMATION_REPORT, id ); } -inline void short_report( test_unit_id id = INV_TEST_UNIT_ID ) -{ make_report( SHORT_REPORT, id ); } -inline void detailed_report( test_unit_id id = INV_TEST_UNIT_ID ) -{ make_report( DETAILED_REPORT, id ); } - -} // namespace results_reporter -} // namespace unit_test -} // namespace boost - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_RESULTS_REPORTER_HPP_021205GER - diff --git a/contrib/restricted/boost/test/include/boost/test/test_framework_init_observer.hpp b/contrib/restricted/boost/test/include/boost/test/test_framework_init_observer.hpp deleted file mode 100644 index 16ee989106..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/test_framework_init_observer.hpp +++ /dev/null @@ -1,61 +0,0 @@ -// (c) Copyright Raffi Enficiaud 2017. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -/// @file -/// @brief Defines an observer that monitors the init of the unit test framework -// *************************************************************************** - -#ifndef BOOST_TEST_FRAMEWORK_INIT_OBSERVER_HPP_071894GER -#define BOOST_TEST_FRAMEWORK_INIT_OBSERVER_HPP_071894GER - -// Boost.Test -#include <boost/test/tree/observer.hpp> - -#include <boost/test/detail/global_typedef.hpp> -#include <boost/test/detail/fwd_decl.hpp> - -#include <boost/test/detail/suppress_warnings.hpp> - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { - -// ************************************************************************** // -/// @brief Monitors the init of the framework -/// -/// This class collects the state of the init/termination of the unit test framework. -/// -/// @see boost::unit_test::test_observer -class BOOST_TEST_DECL framework_init_observer_t : public test_observer { -public: - - framework_init_observer_t(): m_has_failure( false ) {} - - void test_start( counter_t, test_unit_id ) BOOST_OVERRIDE; - - void assertion_result( unit_test::assertion_result ) BOOST_OVERRIDE; - void exception_caught( execution_exception const& ) BOOST_OVERRIDE; - void test_aborted() BOOST_OVERRIDE; - - int priority() BOOST_OVERRIDE { return 0; } - - void clear(); - - /// Indicates if a failure has been recorded so far - bool has_failed( ) const; - -private: - bool m_has_failure; -}; - -} // namespace unit_test -} // namespace boost - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_FRAMEWORK_INIT_OBSERVER_HPP_071894GER diff --git a/contrib/restricted/boost/test/include/boost/test/test_tools.hpp b/contrib/restricted/boost/test/include/boost/test/test_tools.hpp deleted file mode 100644 index a542d5fcde..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/test_tools.hpp +++ /dev/null @@ -1,68 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -/// @file -/// @brief test tools compatibility header -/// -/// This file is used to select the test tools implementation and includes all the necessary headers -// *************************************************************************** - -#ifndef BOOST_TEST_TOOLS_HPP_111812GER -#define BOOST_TEST_TOOLS_HPP_111812GER - -#include <boost/config.hpp> - -// brings some compiler configuration like BOOST_PP_VARIADICS -#include <boost/test/detail/config.hpp> - -#include <boost/preprocessor/config/config.hpp> - -#if defined(BOOST_NO_CXX11_VARIADIC_MACROS) \ - || defined(BOOST_NO_CXX11_AUTO_DECLARATIONS) \ - || defined(BOOST_NO_CXX11_DECLTYPE) -# define BOOST_TEST_MACRO_LIMITED_SUPPORT -#endif - -// Boost.Test -// #define BOOST_TEST_NO_OLD_TOOLS - -#if defined(BOOST_TEST_MACRO_LIMITED_SUPPORT) \ - && ( !BOOST_PP_VARIADICS \ - || !(__cplusplus >= 201103L) && defined(BOOST_NO_CXX11_VARIADIC_MACROS)) -# define BOOST_TEST_NO_NEW_TOOLS -#endif - -// #define BOOST_TEST_TOOLS_UNDER_DEBUGGER -// #define BOOST_TEST_TOOLS_DEBUGGABLE - -#include <boost/test/tools/context.hpp> - -#ifndef BOOST_TEST_NO_OLD_TOOLS -# include <boost/test/tools/old/interface.hpp> -# include <boost/test/tools/old/impl.hpp> - -# include <boost/test/tools/detail/print_helper.hpp> -#endif - -#ifndef BOOST_TEST_NO_NEW_TOOLS -# include <boost/test/tools/interface.hpp> -# include <boost/test/tools/assertion.hpp> -# include <boost/test/tools/fpc_op.hpp> -# include <boost/test/tools/collection_comparison_op.hpp> -# include <boost/test/tools/cstring_comparison_op.hpp> - -# include <boost/test/tools/detail/fwd.hpp> -# include <boost/test/tools/detail/print_helper.hpp> -# include <boost/test/tools/detail/it_pair.hpp> - -# include <boost/test/tools/detail/bitwise_manip.hpp> -# include <boost/test/tools/detail/tolerance_manip.hpp> -# include <boost/test/tools/detail/per_element_manip.hpp> -# include <boost/test/tools/detail/lexicographic_manip.hpp> -#endif - -#endif // BOOST_TEST_TOOLS_HPP_111812GER diff --git a/contrib/restricted/boost/test/include/boost/test/tools/assertion.hpp b/contrib/restricted/boost/test/include/boost/test/tools/assertion.hpp deleted file mode 100644 index 39eab3b03b..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/tools/assertion.hpp +++ /dev/null @@ -1,424 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -//!@file -//!@brief Defines framework for automated assertion construction -// *************************************************************************** - -#ifndef BOOST_TEST_TOOLS_ASSERTION_HPP_100911GER -#define BOOST_TEST_TOOLS_ASSERTION_HPP_100911GER - -// Boost.Test -#include <boost/test/tools/assertion_result.hpp> -#include <boost/test/tools/detail/print_helper.hpp> -#include <boost/test/tools/detail/fwd.hpp> - -// Boost -#include <boost/type.hpp> -#include <boost/type_traits/decay.hpp> -#include <boost/mpl/assert.hpp> -#include <boost/utility/declval.hpp> -#include <boost/type_traits/remove_reference.hpp> -#include <boost/type_traits/remove_const.hpp> - -// STL -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES -#include <utility> -#endif - -#include <boost/test/detail/suppress_warnings.hpp> - -//____________________________________________________________________________// - -namespace boost { -namespace test_tools { -namespace assertion { - -// ************************************************************************** // -// ************** assertion::operators ************** // -// ************************************************************************** // -// precedence 4: ->*, .* -// precedence 5: *, /, % -// precedence 6: +, - -// precedence 7: << , >> -// precedence 8: <, <=, > and >= -// precedence 9: == and != -// precedence 10: bitwise AND -// precedence 11: bitwise XOR -// precedence 12: bitwise OR -// precedence 13: logical AND -// disabled -// precedence 14: logical OR -// disabled -// precedence 15: ternary conditional -// disabled -// precedence 16: = and OP= operators -// precedence 17: throw operator -// not supported -// precedence 18: comma -// not supported - -namespace op { - -#define BOOST_TEST_FOR_EACH_COMP_OP(action) \ - action( < , LT, >=, GE ) \ - action( <=, LE, > , GT ) \ - action( > , GT, <=, LE ) \ - action( >=, GE, < , LT ) \ - action( ==, EQ, !=, NE ) \ - action( !=, NE, ==, EQ ) \ -/**/ - -//____________________________________________________________________________// - -#ifndef BOOST_NO_CXX11_DECLTYPE - -#define BOOST_TEST_FOR_EACH_CONST_OP(action)\ - action(->*, MEMP, ->*, MEMP ) \ - \ - action( * , MUL , * , MUL ) \ - action( / , DIV , / , DIV ) \ - action( % , MOD , % , MOD ) \ - \ - action( + , ADD , + , ADD ) \ - action( - , SUB , - , SUB ) \ - \ - action( <<, LSH , << , LSH ) \ - action( >>, RSH , >> , RSH ) \ - \ - BOOST_TEST_FOR_EACH_COMP_OP(action) \ - \ - action( & , BAND, & , BAND ) \ - action( ^ , XOR , ^ , XOR ) \ - action( | , BOR , | , BOR ) \ -/**/ - -#else - -#define BOOST_TEST_FOR_EACH_CONST_OP(action)\ - BOOST_TEST_FOR_EACH_COMP_OP(action) \ -/**/ - -#endif - -//____________________________________________________________________________// - -#define BOOST_TEST_FOR_EACH_MUT_OP(action) \ - action( = , SET , = , SET ) \ - action( +=, IADD, += , IADD ) \ - action( -=, ISUB, -= , ISUB ) \ - action( *=, IMUL, *= , IMUL ) \ - action( /=, IDIV, /= , IDIV ) \ - action( %=, IMOD, %= , IMOD ) \ - action(<<=, ILSH, <<=, ILSH ) \ - action(>>=, IRSH, >>=, IRSH ) \ - action( &=, IAND, &= , IAND ) \ - action( ^=, IXOR, ^= , IXOR ) \ - action( |=, IOR , |= , IOR ) \ -/**/ - -//____________________________________________________________________________// - -#ifndef BOOST_NO_CXX11_DECLTYPE -# define DEDUCE_RESULT_TYPE( oper ) \ - decltype(boost::declval<Lhs>() oper boost::declval<Rhs>() ) optype; \ - typedef typename boost::remove_reference<optype>::type \ -/**/ -#else -# define DEDUCE_RESULT_TYPE( oper ) bool -#endif - -#define DEFINE_CONST_OPER_FWD_DECL( oper, name, rev, name_inverse ) \ -template<typename Lhs, typename Rhs, \ - typename Enabler=void> \ -struct name; \ -/**/ - -BOOST_TEST_FOR_EACH_CONST_OP( DEFINE_CONST_OPER_FWD_DECL ) - -#define DEFINE_CONST_OPER( oper, name, rev, name_inverse ) \ -template<typename Lhs, typename Rhs, \ - typename Enabler> \ -struct name { \ - typedef DEDUCE_RESULT_TYPE( oper ) result_type; \ - typedef name_inverse<Lhs, Rhs> inverse; \ - \ - static result_type \ - eval( Lhs const& lhs, Rhs const& rhs ) \ - { \ - return lhs oper rhs; \ - } \ - \ - template<typename PrevExprType> \ - static void \ - report( std::ostream& ostr, \ - PrevExprType const& lhs, \ - Rhs const& rhs) \ - { \ - lhs.report( ostr ); \ - ostr << revert() \ - << tt_detail::print_helper( rhs ); \ - } \ - \ - static char const* forward() \ - { return " " #oper " "; } \ - static char const* revert() \ - { return " " #rev " "; } \ -}; \ -/**/ - -BOOST_TEST_FOR_EACH_CONST_OP( DEFINE_CONST_OPER ) - -#undef DEDUCE_RESULT_TYPE -#undef DEFINE_CONST_OPER - -//____________________________________________________________________________// - -} // namespace op - -// ************************************************************************** // -// ************** assertion::expression_base ************** // -// ************************************************************************** // -// Defines expression operators - -template<typename Lhs, typename Rhs, typename OP> class binary_expr; - -template<typename ExprType,typename ValType> -class expression_base { -public: - -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES - template<typename T> - struct RhsT : remove_const<typename remove_reference<T>::type> {}; - -#define ADD_OP_SUPPORT( oper, name, _, _i ) \ - template<typename T> \ - binary_expr<ExprType,T, \ - op::name<ValType,typename RhsT<T>::type> > \ - operator oper( T&& rhs ) \ - { \ - return binary_expr<ExprType,T, \ - op::name<ValType,typename RhsT<T>::type> > \ - ( std::forward<ExprType>( \ - *static_cast<ExprType*>(this) ), \ - std::forward<T>(rhs) ); \ - } \ -/**/ -#else - -#define ADD_OP_SUPPORT( oper, name, _, _i ) \ - template<typename T> \ - binary_expr<ExprType,typename boost::decay<T const>::type, \ - op::name<ValType,typename boost::decay<T const>::type> >\ - operator oper( T const& rhs ) const \ - { \ - typedef typename boost::decay<T const>::type Rhs; \ - return binary_expr<ExprType,Rhs,op::name<ValType,Rhs> > \ - ( *static_cast<ExprType const*>(this), \ - rhs ); \ - } \ -/**/ -#endif - - BOOST_TEST_FOR_EACH_CONST_OP( ADD_OP_SUPPORT ) - #undef ADD_OP_SUPPORT - -#ifndef BOOST_NO_CXX11_AUTO_DECLARATIONS - // Disabled operators - template<typename T> - ExprType& - operator ||( T const& /*rhs*/ ) - { - BOOST_MPL_ASSERT_MSG(false, CANT_USE_LOGICAL_OPERATOR_OR_WITHIN_THIS_TESTING_TOOL, () ); - - return *static_cast<ExprType*>(this); - } - - template<typename T> - ExprType& - operator &&( T const& /*rhs*/ ) - { - BOOST_MPL_ASSERT_MSG(false, CANT_USE_LOGICAL_OPERATOR_AND_WITHIN_THIS_TESTING_TOOL, () ); - - return *static_cast<ExprType*>(this); - } - - operator bool() - { - BOOST_MPL_ASSERT_MSG(false, CANT_USE_TERNARY_OPERATOR_WITHIN_THIS_TESTING_TOOL, () ); - - return false; - } -#endif -}; - -// ************************************************************************** // -// ************** assertion::value_expr ************** // -// ************************************************************************** // -// simple value expression - -template<typename T> -class value_expr : public expression_base<value_expr<T>,typename remove_const<typename remove_reference<T>::type>::type> { -public: - // Public types - typedef T result_type; - - // Constructor -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES - value_expr( value_expr&& ve ) - : m_value( std::forward<T>(ve.m_value) ) - {} - explicit value_expr( T&& val ) - : m_value( std::forward<T>(val) ) - {} -#else - explicit value_expr( T const& val ) - : m_value( val ) - {} -#endif - - // Specific expression interface - T const& value() const - { - return m_value; - } - void report( std::ostream& ostr ) const - { - ostr << tt_detail::print_helper( value() ); - } - - // Mutating operators -#define ADD_OP_SUPPORT( OPER, ID, _, _i)\ - template<typename U> \ - value_expr<T>& \ - operator OPER( U const& rhs ) \ - { \ - m_value OPER rhs; \ - \ - return *this; \ - } \ -/**/ - - BOOST_TEST_FOR_EACH_MUT_OP( ADD_OP_SUPPORT ) -#undef ADD_OP_SUPPORT - - // expression interface - assertion_result evaluate( bool no_message = false ) const - { - assertion_result res( value() ); - if( no_message || res ) - return res; - - format_message( res.message(), value() ); - - return tt_detail::format_assertion_result( "", res.message().str() ); - } - -private: - template<typename U> - static void format_message( wrap_stringstream& ostr, U const& v ) - { - ostr << "['" << tt_detail::print_helper(v) << "' evaluates to false]"; - } - static void format_message( wrap_stringstream& /*ostr*/, bool /*v*/ ) {} - static void format_message( wrap_stringstream& /*ostr*/, assertion_result const& /*v*/ ) {} - - // Data members - T m_value; -}; - -// ************************************************************************** // -// ************** assertion::binary_expr ************** // -// ************************************************************************** // -// binary expression - -template<typename LExpr, typename Rhs, typename OP> -class binary_expr : public expression_base<binary_expr<LExpr,Rhs,OP>,typename OP::result_type> { -public: - // Public types - typedef typename OP::result_type result_type; - - // Constructor -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES - binary_expr( binary_expr&& be ) - : m_lhs( std::forward<LExpr>(be.m_lhs) ) - , m_rhs( std::forward<Rhs>(be.m_rhs) ) - {} - binary_expr( LExpr&& lhs, Rhs&& rhs ) - : m_lhs( std::forward<LExpr>(lhs) ) - , m_rhs( std::forward<Rhs>(rhs) ) - {} -#else - binary_expr( LExpr const& lhs, Rhs const& rhs ) - : m_lhs( lhs ) - , m_rhs( rhs ) - {} -#endif - - // Specific expression interface - result_type value() const - { - return OP::eval( m_lhs.value(), m_rhs ); - } - void report( std::ostream& ostr ) const - { - return OP::report( ostr, m_lhs, m_rhs ); - } - - assertion_result evaluate( bool no_message = false ) const - { - assertion_result const expr_res( value() ); - if( no_message || expr_res ) - return expr_res; - - wrap_stringstream buff; - report( buff.stream() ); - - return tt_detail::format_assertion_result( buff.stream().str(), expr_res.message() ); - } - - // To support custom manipulators - LExpr const& lhs() const { return m_lhs; } - Rhs const& rhs() const { return m_rhs; } -private: - // Data members - LExpr m_lhs; - Rhs m_rhs; -}; - -// ************************************************************************** // -// ************** assertion::seed ************** // -// ************************************************************************** // -// seed added ot the input expression to form an assertion expression - -class seed { -public: - // ->* is highest precedence left to right operator - template<typename T> - value_expr<T> -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES - operator->*( T&& v ) const - { - return value_expr<T>( std::forward<T>( v ) ); - } -#else - operator->*( T const& v ) const - { - return value_expr<T>( v ); - } -#endif -}; - -#undef BOOST_TEST_FOR_EACH_CONST_OP - -} // namespace assertion -} // namespace test_tools -} // namespace boost - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_TOOLS_ASSERTION_HPP_100911GER diff --git a/contrib/restricted/boost/test/include/boost/test/tools/assertion_result.hpp b/contrib/restricted/boost/test/include/boost/test/tools/assertion_result.hpp deleted file mode 100644 index 85eea741f7..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/tools/assertion_result.hpp +++ /dev/null @@ -1,90 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -/// @file -/// Enhanced result for test predicate that include message explaining failure -// *************************************************************************** - -#ifndef BOOST_TEST_PREDICATE_RESULT_HPP_012705GER -#define BOOST_TEST_PREDICATE_RESULT_HPP_012705GER - -// Boost.Test -#include <boost/test/utils/class_properties.hpp> -#include <boost/test/utils/wrap_stringstream.hpp> -#include <boost/test/utils/basic_cstring/basic_cstring.hpp> - -// Boost -#include <boost/shared_ptr.hpp> -#include <boost/detail/workaround.hpp> - -// STL -#include <cstddef> // for std::size_t - -#include <boost/test/detail/suppress_warnings.hpp> - -//____________________________________________________________________________// - -namespace boost { -namespace test_tools { - -// ************************************************************************** // -// ************** assertion_result ************** // -// ************************************************************************** // - -//!@brief Type used for storing the result of an assertion. -class BOOST_TEST_DECL assertion_result { - - //!@internal - typedef unit_test::const_string const_string; - - //!@internal - struct dummy { void nonnull() {} }; - - //!@internal - typedef void (dummy::*safe_bool)(); - -public: - // Constructor - assertion_result( bool pv_ ) - : p_predicate_value( pv_ ) - {} - - template<typename BoolConvertable> - assertion_result( BoolConvertable const& pv_ ) : p_predicate_value( !!pv_ ) {} - - // Access methods - bool operator!() const { return !p_predicate_value; } - void operator=( bool pv_ ) { p_predicate_value.value = pv_; } - operator safe_bool() const { return !!p_predicate_value ? &dummy::nonnull : 0; } - - // Public properties - BOOST_READONLY_PROPERTY( bool, (assertion_result) ) p_predicate_value; - - // Access methods - bool has_empty_message() const { return !m_message; } - wrap_stringstream& message() - { - if( !m_message ) - m_message.reset( new wrap_stringstream ); - - return *m_message; - } - const_string message() const { return !m_message ? const_string() : const_string( m_message->str() ); } - -private: - // Data members - shared_ptr<wrap_stringstream> m_message; -}; - -typedef assertion_result predicate_result; - -} // namespace test_tools -} // namespace boost - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_PREDICATE_RESULT_HPP_012705GER diff --git a/contrib/restricted/boost/test/include/boost/test/tools/collection_comparison_op.hpp b/contrib/restricted/boost/test/include/boost/test/tools/collection_comparison_op.hpp deleted file mode 100644 index 55d63301b3..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/tools/collection_comparison_op.hpp +++ /dev/null @@ -1,458 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -//!@file -//!@brief Collection comparison with enhanced reporting -// *************************************************************************** - -#ifndef BOOST_TEST_TOOLS_COLLECTION_COMPARISON_OP_HPP_050815GER -#define BOOST_TEST_TOOLS_COLLECTION_COMPARISON_OP_HPP_050815GER - -// Boost.Test -#include <boost/test/tools/assertion.hpp> - -#include <boost/test/utils/is_forward_iterable.hpp> -#include <boost/test/utils/is_cstring.hpp> - -// Boost -#include <boost/mpl/bool.hpp> -#include <boost/mpl/if.hpp> -#include <boost/utility/enable_if.hpp> -#include <boost/type_traits/decay.hpp> - -#include <boost/test/detail/suppress_warnings.hpp> - -//____________________________________________________________________________// - -namespace boost { -namespace test_tools { -namespace assertion { - -// ************************************************************************** // -// ************* selectors for specialized comparizon routines ************** // -// ************************************************************************** // - -template<typename T> -struct specialized_compare : public mpl::false_ {}; - -template <typename T> -struct is_c_array : public mpl::false_ {}; - -template<typename T, std::size_t N> -struct is_c_array<T [N]> : public mpl::true_ {}; - -template<typename T, std::size_t N> -struct is_c_array<T (&)[N]> : public mpl::true_ {}; - -#define BOOST_TEST_SPECIALIZED_COLLECTION_COMPARE(Col) \ -namespace boost { namespace test_tools { namespace assertion { \ -template<> \ -struct specialized_compare<Col> : public mpl::true_ {}; \ -}}} \ -/**/ - -// ************************************************************************** // -// ************** lexicographic_compare ************** // -// ************************************************************************** // - -namespace op { - -template <typename OP, bool can_be_equal, bool prefer_shorter, - typename Lhs, typename Rhs> -inline -typename boost::enable_if_c< - unit_test::is_forward_iterable<Lhs>::value && !unit_test::is_cstring<Lhs>::value - && unit_test::is_forward_iterable<Rhs>::value && !unit_test::is_cstring<Rhs>::value, - assertion_result>::type -lexicographic_compare( Lhs const& lhs, Rhs const& rhs ) -{ - assertion_result ar( true ); - - typedef unit_test::bt_iterator_traits<Lhs> t_Lhs_iterator; - typedef unit_test::bt_iterator_traits<Rhs> t_Rhs_iterator; - - typename t_Lhs_iterator::const_iterator first1 = t_Lhs_iterator::begin(lhs); - typename t_Rhs_iterator::const_iterator first2 = t_Rhs_iterator::begin(rhs); - typename t_Lhs_iterator::const_iterator last1 = t_Lhs_iterator::end(lhs); - typename t_Rhs_iterator::const_iterator last2 = t_Rhs_iterator::end(rhs); - std::size_t pos = 0; - - for( ; (first1 != last1) && (first2 != last2); ++first1, ++first2, ++pos ) { - assertion_result const& element_ar = OP::eval(*first1, *first2); - if( !can_be_equal && element_ar ) - return ar; // a < b - - assertion_result const& reverse_ar = OP::eval(*first2, *first1); - if( element_ar && !reverse_ar ) - return ar; // a<=b and !(b<=a) => a < b => return true - - if( element_ar || !reverse_ar ) { - continue; // (a<=b and b<=a) or (!(a<b) and !(b<a)) => a == b => keep looking - } - - // !(a<=b) and b<=a => b < a => return false - ar = false; - ar.message() << "\nFailure at position " << pos << ":"; - ar.message() << "\n - condition [" << tt_detail::print_helper(*first1) << OP::forward() << tt_detail::print_helper(*first2) << "] is false"; - if(!element_ar.has_empty_message()) - ar.message() << ": " << element_ar.message(); - ar.message() << "\n - inverse condition [" << tt_detail::print_helper(*first2) << OP::forward() << tt_detail::print_helper(*first1) << "] is true"; - if(!reverse_ar.has_empty_message()) - ar.message() << ": " << reverse_ar.message(); - return ar; - } - - if( first1 != last1 ) { - if( prefer_shorter ) { - ar = false; - ar.message() << "\nFirst collection has extra trailing elements."; - } - } - else if( first2 != last2 ) { - if( !prefer_shorter ) { - ar = false; - ar.message() << "\nSecond collection has extra trailing elements."; - } - } - else if( !can_be_equal ) { - ar = false; - ar.message() << "\nCollections appear to be equal."; - } - - return ar; -} - -template <typename OP, bool can_be_equal, bool prefer_shorter, - typename Lhs, typename Rhs> -inline -typename boost::enable_if_c< - (unit_test::is_cstring<Lhs>::value || unit_test::is_cstring<Rhs>::value), - assertion_result>::type -lexicographic_compare( Lhs const& lhs, Rhs const& rhs ) -{ - typedef typename unit_test::deduce_cstring_transform<Lhs>::type lhs_char_type; - typedef typename unit_test::deduce_cstring_transform<Rhs>::type rhs_char_type; - - return lexicographic_compare<OP, can_be_equal, prefer_shorter>( - lhs_char_type(lhs), - rhs_char_type(rhs)); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** equality_compare ************** // -// ************************************************************************** // - -template <typename OP, typename Lhs, typename Rhs> -inline -typename boost::enable_if_c< - unit_test::is_forward_iterable<Lhs>::value && !unit_test::is_cstring<Lhs>::value - && unit_test::is_forward_iterable<Rhs>::value && !unit_test::is_cstring<Rhs>::value, - assertion_result>::type -element_compare( Lhs const& lhs, Rhs const& rhs ) -{ - typedef unit_test::bt_iterator_traits<Lhs> t_Lhs_iterator; - typedef unit_test::bt_iterator_traits<Rhs> t_Rhs_iterator; - - assertion_result ar( true ); - - if( t_Lhs_iterator::size(lhs) != t_Rhs_iterator::size(rhs) ) { - ar = false; - ar.message() << "\nCollections size mismatch: " << t_Lhs_iterator::size(lhs) << " != " << t_Rhs_iterator::size(rhs); - return ar; - } - - typename t_Lhs_iterator::const_iterator left = t_Lhs_iterator::begin(lhs); - typename t_Rhs_iterator::const_iterator right = t_Rhs_iterator::begin(rhs); - std::size_t pos = 0; - - for( ; pos < t_Lhs_iterator::size(lhs); ++left, ++right, ++pos ) { - assertion_result const element_ar = OP::eval( *left, *right ); - if( element_ar ) - continue; - - ar = false; - ar.message() << "\n - mismatch at position " << pos << ": [" - << tt_detail::print_helper(*left) - << OP::forward() - << tt_detail::print_helper(*right) - << "] is false"; - if(!element_ar.has_empty_message()) - ar.message() << ": " << element_ar.message(); - } - - return ar; -} - -// In case string comparison is branching here -template <typename OP, typename Lhs, typename Rhs> -inline -typename boost::enable_if_c< - (unit_test::is_cstring<Lhs>::value || unit_test::is_cstring<Rhs>::value), - assertion_result>::type -element_compare( Lhs const& lhs, Rhs const& rhs ) -{ - typedef typename unit_test::deduce_cstring_transform<Lhs>::type lhs_char_type; - typedef typename unit_test::deduce_cstring_transform<Rhs>::type rhs_char_type; - - return element_compare<OP>(lhs_char_type(lhs), - rhs_char_type(rhs)); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** non_equality_compare ************** // -// ************************************************************************** // - -template <typename OP, typename Lhs, typename Rhs> -inline assertion_result -non_equality_compare( Lhs const& lhs, Rhs const& rhs ) -{ - typedef unit_test::bt_iterator_traits<Lhs> t_Lhs_iterator; - typedef unit_test::bt_iterator_traits<Rhs> t_Rhs_iterator; - - assertion_result ar( true ); - - if( t_Lhs_iterator::size(lhs) != t_Rhs_iterator::size(rhs) ) - return ar; - - typename t_Lhs_iterator::const_iterator left = t_Lhs_iterator::begin(lhs); - typename t_Rhs_iterator::const_iterator right = t_Rhs_iterator::begin(rhs); - typename t_Lhs_iterator::const_iterator end = t_Lhs_iterator::end(lhs); - - for( ; left != end; ++left, ++right ) { - if( OP::eval( *left, *right ) ) - return ar; - } - - ar = false; - ar.message() << "\nCollections appear to be equal"; - - return ar; -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** cctraits ************** // -// ************************************************************************** // -// set of collection comparison traits per comparison OP - -template<typename OP> -struct cctraits; - -template<typename Lhs, typename Rhs> -struct cctraits<op::EQ<Lhs, Rhs> > { - typedef specialized_compare<Lhs> is_specialized; -}; - -template<typename Lhs, typename Rhs> -struct cctraits<op::NE<Lhs, Rhs> > { - typedef specialized_compare<Lhs> is_specialized; -}; - -template<typename Lhs, typename Rhs> -struct cctraits<op::LT<Lhs, Rhs> > { - static const bool can_be_equal = false; - static const bool prefer_short = true; - - typedef specialized_compare<Lhs> is_specialized; -}; - -template<typename Lhs, typename Rhs> -struct cctraits<op::LE<Lhs, Rhs> > { - static const bool can_be_equal = true; - static const bool prefer_short = true; - - typedef specialized_compare<Lhs> is_specialized; -}; - -template<typename Lhs, typename Rhs> -struct cctraits<op::GT<Lhs, Rhs> > { - static const bool can_be_equal = false; - static const bool prefer_short = false; - - typedef specialized_compare<Lhs> is_specialized; -}; - -template<typename Lhs, typename Rhs> -struct cctraits<op::GE<Lhs, Rhs> > { - static const bool can_be_equal = true; - static const bool prefer_short = false; - - typedef specialized_compare<Lhs> is_specialized; -}; - -// ************************************************************************** // -// ************** compare_collections ************** // -// ************************************************************************** // -// Overloaded set of functions dispatching to specific implementation of comparison - -template <typename Lhs, typename Rhs, typename L, typename R> -inline assertion_result -compare_collections( Lhs const& lhs, Rhs const& rhs, boost::type<op::EQ<L, R> >*, mpl::true_ ) -{ - return assertion::op::element_compare<op::EQ<L, R> >( lhs, rhs ); -} - -//____________________________________________________________________________// - -template <typename Lhs, typename Rhs, typename L, typename R> -inline assertion_result -compare_collections( Lhs const& lhs, Rhs const& rhs, boost::type<op::EQ<L, R> >*, mpl::false_ ) -{ - return lhs == rhs; -} - -//____________________________________________________________________________// - -template <typename Lhs, typename Rhs, typename L, typename R> -inline assertion_result -compare_collections( Lhs const& lhs, Rhs const& rhs, boost::type<op::NE<L, R> >*, mpl::true_ ) -{ - return assertion::op::non_equality_compare<op::NE<L, R> >( lhs, rhs ); -} - -//____________________________________________________________________________// - -template <typename Lhs, typename Rhs, typename L, typename R> -inline assertion_result -compare_collections( Lhs const& lhs, Rhs const& rhs, boost::type<op::NE<L, R> >*, mpl::false_ ) -{ - return lhs != rhs; -} - -//____________________________________________________________________________// - -template <typename OP, typename Lhs, typename Rhs> -inline assertion_result -lexicographic_compare( Lhs const& lhs, Rhs const& rhs ) -{ - return assertion::op::lexicographic_compare<OP, cctraits<OP>::can_be_equal, cctraits<OP>::prefer_short>( lhs, rhs ); -} - -//____________________________________________________________________________// - -template <typename Lhs, typename Rhs, typename OP> -inline assertion_result -compare_collections( Lhs const& lhs, Rhs const& rhs, boost::type<OP>*, mpl::true_ ) -{ - return lexicographic_compare<OP>( lhs, rhs ); -} - -//____________________________________________________________________________// - -template <typename Lhs, typename Rhs, typename L, typename R> -inline assertion_result -compare_collections( Lhs const& lhs, Rhs const& rhs, boost::type<op::LT<L, R> >*, mpl::false_ ) -{ - return lhs < rhs; -} - -//____________________________________________________________________________// - -template <typename Lhs, typename Rhs, typename L, typename R> -inline assertion_result -compare_collections( Lhs const& lhs, Rhs const& rhs, boost::type<op::LE<L, R> >*, mpl::false_ ) -{ - return lhs <= rhs; -} - -//____________________________________________________________________________// - -template <typename Lhs, typename Rhs, typename L, typename R> -inline assertion_result -compare_collections( Lhs const& lhs, Rhs const& rhs, boost::type<op::GT<L, R> >*, mpl::false_ ) -{ - return lhs > rhs; -} - -//____________________________________________________________________________// - -template <typename Lhs, typename Rhs, typename L, typename R> -inline assertion_result -compare_collections( Lhs const& lhs, Rhs const& rhs, boost::type<op::GE<L, R> >*, mpl::false_ ) -{ - return lhs >= rhs; -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ********* specialization of comparison operators for collections ********* // -// ************************************************************************** // - -#define DEFINE_COLLECTION_COMPARISON( oper, name, rev, name_inverse ) \ -template<typename Lhs,typename Rhs> \ -struct name<Lhs,Rhs,typename boost::enable_if_c< \ - unit_test::is_forward_iterable<Lhs>::value \ - && !unit_test::is_cstring_comparable<Lhs>::value \ - && unit_test::is_forward_iterable<Rhs>::value \ - && !unit_test::is_cstring_comparable<Rhs>::value>::type> { \ -public: \ - typedef assertion_result result_type; \ - typedef name_inverse<Lhs, Rhs> inverse; \ - typedef unit_test::bt_iterator_traits<Lhs> t_Lhs_iterator_helper; \ - typedef unit_test::bt_iterator_traits<Rhs> t_Rhs_iterator_helper; \ - \ - typedef name<Lhs, Rhs> OP; \ - \ - typedef typename \ - mpl::if_c< \ - mpl::or_< \ - typename is_c_array<Lhs>::type, \ - typename is_c_array<Rhs>::type \ - >::value, \ - mpl::true_, \ - typename \ - mpl::if_c<is_same<typename decay<Lhs>::type, \ - typename decay<Rhs>::type>::value, \ - typename cctraits<OP>::is_specialized, \ - mpl::false_>::type \ - >::type is_specialized; \ - \ - typedef name<typename t_Lhs_iterator_helper::value_type, \ - typename t_Rhs_iterator_helper::value_type \ - > elem_op; \ - \ - static assertion_result \ - eval( Lhs const& lhs, Rhs const& rhs) \ - { \ - return assertion::op::compare_collections( lhs, rhs, \ - (boost::type<elem_op>*)0, \ - is_specialized() ); \ - } \ - \ - template<typename PrevExprType> \ - static void \ - report( std::ostream&, \ - PrevExprType const&, \ - Rhs const& ) {} \ - \ - static char const* forward() \ - { return " " #oper " "; } \ - static char const* revert() \ - { return " " #rev " "; } \ - \ -}; \ -/**/ - -BOOST_TEST_FOR_EACH_COMP_OP( DEFINE_COLLECTION_COMPARISON ) -#undef DEFINE_COLLECTION_COMPARISON - -//____________________________________________________________________________// - -} // namespace op -} // namespace assertion -} // namespace test_tools -} // namespace boost - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_TOOLS_COLLECTION_COMPARISON_OP_HPP_050815GER diff --git a/contrib/restricted/boost/test/include/boost/test/tools/context.hpp b/contrib/restricted/boost/test/include/boost/test/tools/context.hpp deleted file mode 100644 index e5d6625e12..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/tools/context.hpp +++ /dev/null @@ -1,96 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision: 74248 $ -// -// Description : test tools context interfaces -// *************************************************************************** - -#ifndef BOOST_TEST_TOOLS_CONTEXT_HPP_111712GER -#define BOOST_TEST_TOOLS_CONTEXT_HPP_111712GER - -// Boost.Test -#include <boost/test/utils/lazy_ostream.hpp> -#include <boost/test/detail/pp_variadic.hpp> - -#include <boost/preprocessor/repetition/enum_params.hpp> -#include <boost/preprocessor/repetition/enum_binary_params.hpp> -#include <boost/preprocessor/repetition/repeat_from_to.hpp> - -#include <boost/preprocessor/variadic/to_seq.hpp> -#include <boost/preprocessor/variadic/size.hpp> -#include <boost/preprocessor/cat.hpp> -#include <boost/preprocessor/seq/for_each_i.hpp> -#include <boost/preprocessor/seq/for_each.hpp> -#include <boost/preprocessor/seq/enum.hpp> -#include <boost/preprocessor/control/iif.hpp> -#include <boost/preprocessor/comparison/equal.hpp> - -#include <boost/test/detail/suppress_warnings.hpp> - -//____________________________________________________________________________// - -namespace boost { -namespace test_tools { -namespace tt_detail { - -// ************************************************************************** // -// ************** context_frame ************** // -// ************************************************************************** // - -struct BOOST_TEST_DECL context_frame { - explicit context_frame( ::boost::unit_test::lazy_ostream const& context_descr ); - ~context_frame(); - - operator bool(); - -private: - // Data members - int m_frame_id; -}; - -//____________________________________________________________________________// - -#define BOOST_TEST_INFO( context_descr ) \ - ::boost::unit_test::framework::add_context( BOOST_TEST_LAZY_MSG( context_descr ) , false ) \ -/**/ - -#define BOOST_TEST_INFO_SCOPE( context_descr ) \ - ::boost::test_tools::tt_detail::context_frame BOOST_JOIN( context_frame_, __LINE__ ) = \ - ::boost::test_tools::tt_detail::context_frame(BOOST_TEST_LAZY_MSG( context_descr ) ) \ -/**/ - -//____________________________________________________________________________// - - -#define BOOST_CONTEXT_PARAM(r, ctx, i, context_descr) \ - if( ::boost::test_tools::tt_detail::context_frame BOOST_PP_CAT(ctx, i) = \ - ::boost::test_tools::tt_detail::context_frame(BOOST_TEST_LAZY_MSG( context_descr ) ) ) \ -/**/ - -#define BOOST_CONTEXT_PARAMS( params ) \ - BOOST_PP_SEQ_FOR_EACH_I(BOOST_CONTEXT_PARAM, \ - BOOST_JOIN( context_frame_, __LINE__ ), \ - params) \ -/**/ - -#define BOOST_TEST_CONTEXT( ... ) \ - BOOST_CONTEXT_PARAMS( BOOST_PP_VARIADIC_TO_SEQ(__VA_ARGS__) ) \ -/**/ - - -//____________________________________________________________________________// - -} // namespace tt_detail -} // namespace test_tools -} // namespace boost - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_TOOLS_CONTEXT_HPP_111712GER diff --git a/contrib/restricted/boost/test/include/boost/test/tools/cstring_comparison_op.hpp b/contrib/restricted/boost/test/include/boost/test/tools/cstring_comparison_op.hpp deleted file mode 100644 index 04b38561ee..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/tools/cstring_comparison_op.hpp +++ /dev/null @@ -1,91 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -//!@file -//!@brief C string comparison with enhanced reporting -// *************************************************************************** - -#ifndef BOOST_TEST_TOOLS_CSTRING_COMPARISON_OP_HPP_050815GER -#define BOOST_TEST_TOOLS_CSTRING_COMPARISON_OP_HPP_050815GER - -// Boost.Test -#include <boost/test/tools/assertion.hpp> - -#include <boost/test/utils/is_cstring.hpp> -#include <boost/test/utils/basic_cstring/compare.hpp> - -// Boost -#include <boost/utility/enable_if.hpp> - -#include <boost/test/detail/suppress_warnings.hpp> - -//____________________________________________________________________________// - -namespace boost { -namespace test_tools { -namespace assertion { -namespace op { - -// ************************************************************************** // -// ************** string_compare ************** // -// ************************************************************************** // - -#define DEFINE_CSTRING_COMPARISON( oper, name, rev, name_inverse ) \ -template<typename Lhs,typename Rhs> \ -struct name<Lhs,Rhs,typename boost::enable_if_c< \ - ( unit_test::is_cstring_comparable<Lhs>::value \ - && unit_test::is_cstring_comparable<Rhs>::value) \ - >::type > \ -{ \ - typedef typename unit_test::deduce_cstring_transform<Lhs>::type lhs_char_type; \ - typedef typename unit_test::deduce_cstring_transform<Rhs>::type rhs_char_type; \ -public: \ - typedef assertion_result result_type; \ - typedef name_inverse<Lhs, Rhs> inverse; \ - \ - typedef name< \ - typename lhs_char_type::value_type, \ - typename rhs_char_type::value_type> elem_op; \ - \ - static bool \ - eval( Lhs const& lhs, Rhs const& rhs) \ - { \ - return lhs_char_type(lhs) oper rhs_char_type(rhs); \ - } \ - \ - template<typename PrevExprType> \ - static void \ - report( std::ostream& ostr, \ - PrevExprType const& lhs, \ - Rhs const& rhs) \ - { \ - lhs.report( ostr ); \ - ostr << revert() \ - << tt_detail::print_helper( rhs ); \ - } \ - \ - static char const* forward() \ - { return " " #oper " "; } \ - static char const* revert() \ - { return " " #rev " "; } \ -}; \ -/**/ - -BOOST_TEST_FOR_EACH_COMP_OP( DEFINE_CSTRING_COMPARISON ) -#undef DEFINE_CSTRING_COMPARISON - -//____________________________________________________________________________// - -} // namespace op -} // namespace assertion -} // namespace test_tools -} // namespace boost - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_TOOLS_CSTRING_COMPARISON_OP_HPP_050815GER - diff --git a/contrib/restricted/boost/test/include/boost/test/tools/detail/bitwise_manip.hpp b/contrib/restricted/boost/test/include/boost/test/tools/detail/bitwise_manip.hpp deleted file mode 100644 index 329a893a9a..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/tools/detail/bitwise_manip.hpp +++ /dev/null @@ -1,129 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -//! @file -//! Bitwise comparison manipulator implementation -// *************************************************************************** - -#ifndef BOOST_TEST_TOOLS_DETAIL_BITWISE_MANIP_HPP_012705GER -#define BOOST_TEST_TOOLS_DETAIL_BITWISE_MANIP_HPP_012705GER - -// Boost Test -#include <boost/test/tools/detail/fwd.hpp> -#include <boost/test/tools/detail/indirections.hpp> - -#include <boost/test/tools/assertion_result.hpp> -#include <boost/test/tools/assertion.hpp> - -// STL -#include <climits> // for CHAR_BIT - -#include <boost/test/detail/suppress_warnings.hpp> - -//____________________________________________________________________________// - -namespace boost { -namespace test_tools { - -// ************************************************************************** // -// ************** bitwise comparison manipulator ************** // -// ************************************************************************** // - -//! Bitwise comparison manipulator -//! This is a terminal for the expression -struct bitwise {}; - -//____________________________________________________________________________// - -inline unit_test::lazy_ostream & -operator<<( unit_test::lazy_ostream &o, bitwise ) { return o; } - -// needed for the lazy evaluation in lazy_ostream as bitwise is a terminal -inline std::ostream& -operator<<( std::ostream& o, bitwise ) { return o; } - - -//____________________________________________________________________________// - -namespace tt_detail { - -/*!@brief Bitwise comparison of two operands - * - * This class constructs an @ref assertion_result that contains precise bit comparison information. - * In particular the location of the mismatches (if any) are printed in the assertion result. - */ -template<typename Lhs, typename Rhs, typename E> -inline assertion_result -bitwise_compare(Lhs const& lhs, Rhs const& rhs, E const& expr ) -{ - assertion_result pr( true ); - - std::size_t left_bit_size = sizeof(Lhs)*CHAR_BIT; - std::size_t right_bit_size = sizeof(Rhs)*CHAR_BIT; - - static Lhs const leftOne( 1 ); - static Rhs const rightOne( 1 ); - - std::size_t total_bits = left_bit_size < right_bit_size ? left_bit_size : right_bit_size; - - for( std::size_t counter = 0; counter < total_bits; ++counter ) { - if( (lhs & ( leftOne << counter )) != (rhs & (rightOne << counter)) ) { - if( pr ) { - pr.message() << " ["; - expr.report( pr.message().stream() ); - pr.message() << "]. Bitwise comparison failed"; - pr = false; - } - pr.message() << "\nMismatch at position " << counter; - } - } - - if( left_bit_size != right_bit_size ) { - if( pr ) { - pr.message() << " ["; - expr.report( pr.message().stream() ); - pr.message() << "]. Bitwise comparison failed"; - pr = false; - } - pr.message() << "\nOperands bit sizes mismatch: " << left_bit_size << " != " << right_bit_size; - } - - return pr; -} - -//____________________________________________________________________________// - -//! Returns an assertion_result using the bitwise comparison out of an expression -//! -//! This is used as a modifer of the normal operator<< on expressions to use the -//! bitwise comparison. -//! -//! @note Available only for compilers supporting the @c auto declaration. -template<typename T1, typename T2, typename T3, typename T4> -inline assertion_result -operator<<(assertion_evaluate_t<assertion::binary_expr<T1,T2,assertion::op::EQ<T3,T4> > > const& ae, bitwise ) -{ - return bitwise_compare( ae.m_e.lhs().value(), ae.m_e.rhs(), ae.m_e ); -} - -//____________________________________________________________________________// - -inline assertion_type -operator<<( assertion_type const& , bitwise ) -{ - return assertion_type(CHECK_BUILT_ASSERTION); -} - -//____________________________________________________________________________// - -} // namespace tt_detail -} // namespace test_tools -} // namespace boost - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_TOOLS_DETAIL_BITWISE_MANIP_HPP_012705GER diff --git a/contrib/restricted/boost/test/include/boost/test/tools/detail/fwd.hpp b/contrib/restricted/boost/test/include/boost/test/tools/detail/fwd.hpp deleted file mode 100644 index 339ab39eda..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/tools/detail/fwd.hpp +++ /dev/null @@ -1,121 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision: 74248 $ -// -// Description : toolbox implementation types and forward declarations -// *************************************************************************** - -#ifndef BOOST_TEST_TOOLS_DETAIL_FWD_HPP_012705GER -#define BOOST_TEST_TOOLS_DETAIL_FWD_HPP_012705GER - -// Boost.Test -#include <boost/test/detail/config.hpp> -#include <boost/test/utils/basic_cstring/io.hpp> - -// STL -#include <cstddef> // for std::size_t - -#include <boost/test/detail/suppress_warnings.hpp> - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { - -class lazy_ostream; - -} // namespace unit_test - -namespace test_tools { - -using unit_test::const_string; -class assertion_result; - -//____________________________________________________________________________// - -namespace tt_detail { - -inline bool dummy_cond() { return false; } - -// ************************************************************************** // -// ************** types of supported assertions ************** // -// ************************************************************************** // - -//____________________________________________________________________________// - -enum check_type { - CHECK_PRED, - CHECK_MSG, - CHECK_EQUAL, - CHECK_NE, - CHECK_LT, - CHECK_LE, - CHECK_GT, - CHECK_GE, - CHECK_CLOSE, - CHECK_CLOSE_FRACTION, - CHECK_SMALL, - CHECK_BITWISE_EQUAL, - CHECK_PRED_WITH_ARGS, - CHECK_EQUAL_COLL, - CHECK_BUILT_ASSERTION -}; - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** levels of supported assertions ************** // -// ************************************************************************** // - -enum tool_level { - WARN, CHECK, REQUIRE, PASS -}; - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** Tools offline implementation ************** // -// ************************************************************************** // - -BOOST_TEST_DECL bool -report_assertion( assertion_result const& pr, unit_test::lazy_ostream const& assertion_descr, - const_string file_name, std::size_t line_num, - tool_level tl, check_type ct, - std::size_t num_args, ... ); - -//____________________________________________________________________________// - -BOOST_TEST_DECL assertion_result -format_assertion_result( const_string expr_val, const_string details ); - -//____________________________________________________________________________// - -BOOST_TEST_DECL assertion_result -format_fpc_report( const_string expr_val, const_string details ); - -//____________________________________________________________________________// - -BOOST_TEST_DECL bool -is_defined_impl( const_string symbol_name, const_string symbol_value ); - -//____________________________________________________________________________// - -BOOST_TEST_DECL assertion_result -equal_impl( char const* left, char const* right ); - -//____________________________________________________________________________// - -} // namespace tt_detail -} // namespace test_tools -} // namespace boost - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_TOOLS_DETAIL_FWD_HPP_012705GER diff --git a/contrib/restricted/boost/test/include/boost/test/tools/detail/indirections.hpp b/contrib/restricted/boost/test/include/boost/test/tools/detail/indirections.hpp deleted file mode 100644 index 2622f2a653..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/tools/detail/indirections.hpp +++ /dev/null @@ -1,125 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision: 74248 $ -// -// Description : inidiration interfaces to support manipulators and message output -// *************************************************************************** - -#ifndef BOOST_TEST_TOOLS_DETAIL_INDIRECTIONS_HPP_112812GER -#define BOOST_TEST_TOOLS_DETAIL_INDIRECTIONS_HPP_112812GER - -// Boost.Test -#include <boost/test/tools/detail/fwd.hpp> - -#include <boost/test/tools/assertion_result.hpp> -#include <boost/test/utils/lazy_ostream.hpp> - -#include <boost/shared_ptr.hpp> -#include <list> - -#include <boost/test/detail/suppress_warnings.hpp> - -//____________________________________________________________________________// - -namespace boost { -namespace test_tools { -namespace tt_detail { - -struct assertion_evaluation_context -{ - assertion_evaluation_context(bool has_report = false) - : m_has_report(has_report) - {} - - bool m_has_report; -}; - -// ************************************************************************** // -// ************** assertion_evaluate indirection ************** // -// ************************************************************************** // - -template<typename E> -struct assertion_evaluate_t { - - typedef shared_ptr<assertion_evaluation_context> context_holder; - - assertion_evaluate_t( E const& e ) : m_e( e ), m_evaluate( true ) - {} - - operator assertion_result() { return m_e.evaluate( m_evaluate ); } - - assertion_evaluate_t<E> - stack_context(context_holder context) const { - assertion_evaluate_t<E> added_context(*this); - - added_context.m_context_holder.push_back(context); - added_context.m_evaluate = !context->m_has_report; - return added_context; - } - - E const& m_e; - std::list< context_holder > m_context_holder; - bool m_evaluate; -}; - -//____________________________________________________________________________// - -template<typename E> -inline assertion_evaluate_t<E> -assertion_evaluate( E const& e ) { return assertion_evaluate_t<E>( e ); } - -//____________________________________________________________________________// - -template<typename E, typename T> -inline assertion_evaluate_t<E> -operator<<( assertion_evaluate_t<E> const& ae, T const& ) { return ae; } - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** assertion_text indirection ************** // -// ************************************************************************** // - -inline unit_test::lazy_ostream const& -assertion_text( unit_test::lazy_ostream const& et, unit_test::lazy_ostream const& s) { - if(!s.empty()) - return s; - return et; -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** assertion_evaluate indirection ************** // -// ************************************************************************** // - -struct assertion_type { - assertion_type(check_type ct = CHECK_MSG) : m_check_type(ct) - {} - - operator check_type() { return m_check_type; } - check_type m_check_type; -}; - -//____________________________________________________________________________// - -template<typename T> -inline assertion_type -operator<<( assertion_type const& at, T const& ) { return at; } - -//____________________________________________________________________________// - -} // namespace tt_detail -} // namespace test_tools -} // namespace boost - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_TOOLS_DETAIL_INDIRECTIONS_HPP_112812GER diff --git a/contrib/restricted/boost/test/include/boost/test/tools/detail/it_pair.hpp b/contrib/restricted/boost/test/include/boost/test/tools/detail/it_pair.hpp deleted file mode 100644 index 4352fd464f..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/tools/detail/it_pair.hpp +++ /dev/null @@ -1,74 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision: 74248 $ -// -// Description : support for backward compatible collection comparison interface -// *************************************************************************** - -#ifndef BOOST_TEST_TOOLS_DETAIL_IT_PAIR_HPP_112812GER -#define BOOST_TEST_TOOLS_DETAIL_IT_PAIR_HPP_112812GER - -#ifdef BOOST_TEST_NO_OLD_TOOLS - -#include <boost/test/detail/suppress_warnings.hpp> - -//____________________________________________________________________________// - -namespace boost { -namespace test_tools { -namespace tt_detail { - -// ************************************************************************** // -// ************** backward compatibility support ************** // -// ************************************************************************** // - -template<typename It> -struct it_pair { - typedef It const_iterator; - typedef typename std::iterator_traits<It>::value_type value_type; - - it_pair( It const& b, It const& e ) : m_begin( b ), m_size( 0 ) - { - It tmp = b; - while( tmp != e ) { ++m_size; ++tmp; } - } - - It begin() const { return m_begin; } - It end() const { return m_begin + m_size; } - size_t size() const { return m_size; } - -private: - It m_begin; - size_t m_size; -}; - -//____________________________________________________________________________// - -template<typename It> -it_pair<It> -make_it_pair( It const& b, It const& e ) { return it_pair<It>( b, e ); } - -//____________________________________________________________________________// - -template<typename T> -it_pair<T const*> -make_it_pair( T const* b, T const* e ) { return it_pair<T const*>( b, e ); } - -//____________________________________________________________________________// - -} // namespace tt_detail -} // namespace test_tools -} // namespace boost - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_NO_OLD_TOOLS - -#endif // BOOST_TEST_TOOLS_DETAIL_IT_PAIR_HPP_112812GER diff --git a/contrib/restricted/boost/test/include/boost/test/tools/detail/lexicographic_manip.hpp b/contrib/restricted/boost/test/include/boost/test/tools/detail/lexicographic_manip.hpp deleted file mode 100644 index 30a49c0927..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/tools/detail/lexicographic_manip.hpp +++ /dev/null @@ -1,77 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -//! @file -//! Lexicographic comparison manipulator implementation -// *************************************************************************** - -#ifndef BOOST_TEST_TOOLS_DETAIL_LEXICOGRAPHIC_MANIP_HPP_050815GER -#define BOOST_TEST_TOOLS_DETAIL_LEXICOGRAPHIC_MANIP_HPP_050815GER - -// Boost Test -#include <boost/test/tools/detail/fwd.hpp> -#include <boost/test/tools/detail/indirections.hpp> - -#include <boost/test/tools/assertion.hpp> -#include <boost/test/utils/lazy_ostream.hpp> -#include <boost/test/tools/collection_comparison_op.hpp> - -#include <ostream> - -#include <boost/test/detail/suppress_warnings.hpp> - -//____________________________________________________________________________// - -namespace boost { -namespace test_tools { - -// ************************************************************************** // -// ************** per element comparison manipulator ************** // -// ************************************************************************** // - -//! Lexicographic comparison manipulator, for containers -//! This is a terminal that involves evaluation of the expression -struct lexicographic {}; - -//____________________________________________________________________________// - -inline unit_test::lazy_ostream& -operator<<( unit_test::lazy_ostream & o, lexicographic ) { return o; } - -// needed for the lazy evaluation in lazy_ostream as lexicographic is a terminal -inline std::ostream& -operator<<( std::ostream& o, lexicographic ) { return o; } - -//____________________________________________________________________________// - -namespace tt_detail { - -template<typename T1, typename T2, typename OP> -inline assertion_result -operator<<(assertion_evaluate_t<assertion::binary_expr<T1,T2,OP> > const& ae, lexicographic ) -{ - typedef typename OP::elem_op elem_op; - return assertion::op::lexicographic_compare<elem_op>( ae.m_e.lhs().value(), ae.m_e.rhs() ); -} - -//____________________________________________________________________________// - -inline assertion_type -operator<<( assertion_type const&, lexicographic ) -{ - return assertion_type(CHECK_BUILT_ASSERTION); -} - -//____________________________________________________________________________// - -} // namespace tt_detail -} // namespace test_tools -} // namespace boost - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_TOOLS_DETAIL_LEXICOGRAPHIC_MANIP_HPP_050815GER diff --git a/contrib/restricted/boost/test/include/boost/test/tools/detail/per_element_manip.hpp b/contrib/restricted/boost/test/include/boost/test/tools/detail/per_element_manip.hpp deleted file mode 100644 index 98b5703685..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/tools/detail/per_element_manip.hpp +++ /dev/null @@ -1,77 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -//! @file -//! Per element comparison manipulator implementation -// *************************************************************************** - -#ifndef BOOST_TEST_TOOLS_DETAIL_PER_ELEMENT_MANIP_HPP_050815GER -#define BOOST_TEST_TOOLS_DETAIL_PER_ELEMENT_MANIP_HPP_050815GER - -// Boost Test -#include <boost/test/tools/detail/fwd.hpp> -#include <boost/test/tools/detail/indirections.hpp> - -#include <boost/test/utils/lazy_ostream.hpp> -#include <boost/test/tools/assertion.hpp> -#include <boost/test/tools/collection_comparison_op.hpp> - -#include <ostream> - -#include <boost/test/detail/suppress_warnings.hpp> - -//____________________________________________________________________________// - -namespace boost { -namespace test_tools { - -// ************************************************************************** // -// ************** per element comparison manipulator ************** // -// ************************************************************************** // - -//! Per element comparison manipulator, for containers -//! This is a terminal that involves evaluation of the expression -struct per_element {}; - -//____________________________________________________________________________// - -inline unit_test::lazy_ostream& -operator<<( unit_test::lazy_ostream &o, per_element ) { return o; } - -// needed for the lazy evaluation in lazy_ostream as per_element is a terminal -inline std::ostream& -operator<<( std::ostream& o, per_element ) { return o; } - -//____________________________________________________________________________// - -namespace tt_detail { - -template<typename T1, typename T2, typename OP> -inline assertion_result -operator<<(assertion_evaluate_t<assertion::binary_expr<T1,T2,OP> > const& ae, per_element ) -{ - typedef typename OP::elem_op elem_op; - return assertion::op::element_compare<elem_op>( ae.m_e.lhs().value(), ae.m_e.rhs() ); -} - -//____________________________________________________________________________// - -inline assertion_type -operator<<( assertion_type const&, per_element ) -{ - return assertion_type(CHECK_BUILT_ASSERTION); -} - -//____________________________________________________________________________// - -} // namespace tt_detail -} // namespace test_tools -} // namespace boost - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_TOOLS_DETAIL_PER_ELEMENT_MANIP_HPP_050815GER diff --git a/contrib/restricted/boost/test/include/boost/test/tools/detail/print_helper.hpp b/contrib/restricted/boost/test/include/boost/test/tools/detail/print_helper.hpp deleted file mode 100644 index dafa2bd48b..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/tools/detail/print_helper.hpp +++ /dev/null @@ -1,254 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision: 74248 $ -// -// Description : defines level of indiration facilitating workarounds for non printable types -// *************************************************************************** - -#ifndef BOOST_TEST_TOOLS_IMPL_COMMON_HPP_012705GER -#define BOOST_TEST_TOOLS_IMPL_COMMON_HPP_012705GER - -// Boost.Test -#include <boost/test/detail/config.hpp> -#include <boost/test/detail/global_typedef.hpp> - -// Boost -#include <boost/mpl/or.hpp> -#include <boost/static_assert.hpp> -#include <boost/type_traits/is_array.hpp> -#include <boost/type_traits/is_function.hpp> -#include <boost/type_traits/is_abstract.hpp> -#include <boost/type_traits/has_left_shift.hpp> - -#include <ios> -#include <iostream> -#include <limits> - -#if !defined(BOOST_NO_CXX11_NULLPTR) -#include <cstddef> -#endif - -#include <boost/test/detail/suppress_warnings.hpp> - -//____________________________________________________________________________// - -namespace boost { -namespace test_tools { -namespace tt_detail { - -// ************************************************************************** // -// ************** boost_test_print_type ************** // -// ************************************************************************** // - - namespace impl { - template <class T> - std::ostream& boost_test_print_type(std::ostream& ostr, T const& t) { - BOOST_STATIC_ASSERT_MSG( (boost::has_left_shift<std::ostream,T>::value), - "Type has to implement operator<< to be printable"); - ostr << t; - return ostr; - } - - struct boost_test_print_type_impl { - template <class R> - std::ostream& operator()(std::ostream& ostr, R const& r) const { - return boost_test_print_type(ostr, r); - } - }; - } - - // To avoid ODR violations, see N4381 - template <class T> struct static_const { static const T value; }; - template <class T> const T static_const<T>::value = T(); - - namespace { - static const impl::boost_test_print_type_impl& boost_test_print_type = - static_const<impl::boost_test_print_type_impl>::value; - } - - -// ************************************************************************** // -// ************** print_log_value ************** // -// ************************************************************************** // - -template<typename T> -struct print_log_value { - void operator()( std::ostream& ostr, T const& t ) - { - typedef typename mpl::or_<is_array<T>,is_function<T>,is_abstract<T> >::type cant_use_nl; - - std::streamsize old_precision = set_precision( ostr, cant_use_nl() ); - - //ostr << t; - using boost::test_tools::tt_detail::boost_test_print_type; - boost_test_print_type(ostr, t); - - if( old_precision != (std::streamsize)-1 ) - ostr.precision( old_precision ); - } - - std::streamsize set_precision( std::ostream& ostr, mpl::false_ ) - { - if( std::numeric_limits<T>::is_specialized && std::numeric_limits<T>::radix == 2 ) - return ostr.precision( 2 + std::numeric_limits<T>::digits * 301/1000 ); - else if ( std::numeric_limits<T>::is_specialized && std::numeric_limits<T>::radix == 10 ) { -#ifdef BOOST_NO_CXX11_NUMERIC_LIMITS - // (was BOOST_NO_NUMERIC_LIMITS_LOWEST but now deprecated). - // No support for std::numeric_limits<double>::max_digits10, - // so guess that a couple of guard digits more than digits10 will display any difference. - return ostr.precision( 2 + std::numeric_limits<T>::digits10 ); -#else - // std::numeric_limits<double>::max_digits10; IS supported. - // Any noisy or guard digits needed to display any difference are included in max_digits10. - return ostr.precision( std::numeric_limits<T>::max_digits10 ); -#endif - } - // else if T is not specialized for std::numeric_limits<>, - // then will just get the default precision of 6 digits. - return (std::streamsize)-1; - } - - std::streamsize set_precision( std::ostream&, mpl::true_ ) { return (std::streamsize)-1; } -}; - -//____________________________________________________________________________// - -#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564)) -template<typename T, std::size_t N > -struct print_log_value< T[N] > { - void operator()( std::ostream& ostr, T const* t ) - { - ostr << t; - } -}; -#endif - -//____________________________________________________________________________// - -template<> -struct BOOST_TEST_DECL print_log_value<bool> { - void operator()( std::ostream& ostr, bool t ); -}; - -//____________________________________________________________________________// - -template<> -struct BOOST_TEST_DECL print_log_value<char> { - void operator()( std::ostream& ostr, char t ); -}; - -//____________________________________________________________________________// - -template<> -struct BOOST_TEST_DECL print_log_value<unsigned char> { - void operator()( std::ostream& ostr, unsigned char t ); -}; - -//____________________________________________________________________________// - -template<> -struct BOOST_TEST_DECL print_log_value<wchar_t> { - void operator()( std::ostream& ostr, wchar_t t ); -}; - -//____________________________________________________________________________// - -template<> -struct BOOST_TEST_DECL print_log_value<char const*> { - void operator()( std::ostream& ostr, char const* t ); -}; - -//____________________________________________________________________________// - -template<> -struct BOOST_TEST_DECL print_log_value<wchar_t const*> { - void operator()( std::ostream& ostr, wchar_t const* t ); -}; - -#if !defined(BOOST_NO_CXX11_NULLPTR) -template<> -struct print_log_value<std::nullptr_t> { - // declaration and definition is here because of #12969 https://svn.boost.org/trac10/ticket/12969 - void operator()( std::ostream& ostr, std::nullptr_t /*t*/ ) { - ostr << "nullptr"; - } -}; -#endif - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** print_helper ************** // -// ************************************************************************** // -// Adds level of indirection to the output operation, allowing us to customize -// it for types that do not support operator << directly or for any other reason - -template<typename T> -struct print_helper_t { - explicit print_helper_t( T const& t ) : m_t( t ) {} - - T const& m_t; -}; - -//____________________________________________________________________________// - -#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564)) -// Borland suffers premature pointer decay passing arrays by reference -template<typename T, std::size_t N > -struct print_helper_t< T[N] > { - explicit print_helper_t( T const * t ) : m_t( t ) {} - - T const * m_t; -}; -#endif - -//____________________________________________________________________________// - -template<typename T> -inline print_helper_t<T> -print_helper( T const& t ) -{ - return print_helper_t<T>( t ); -} - -//____________________________________________________________________________// - -template<typename T> -inline std::ostream& -operator<<( std::ostream& ostr, print_helper_t<T> const& ph ) -{ - print_log_value<T>()( ostr, ph.m_t ); - - return ostr; -} - -//____________________________________________________________________________// - -} // namespace tt_detail - -// ************************************************************************** // -// ************** BOOST_TEST_DONT_PRINT_LOG_VALUE ************** // -// ************************************************************************** // - -#define BOOST_TEST_DONT_PRINT_LOG_VALUE( the_type ) \ -namespace boost{ namespace test_tools{ namespace tt_detail{ \ -template<> \ -struct print_log_value<the_type > { \ - void operator()( std::ostream&, the_type const& ) {} \ -}; \ -}}} \ -/**/ - -} // namespace test_tools -} // namespace boost - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_TOOLS_IMPL_COMMON_HPP_012705GER diff --git a/contrib/restricted/boost/test/include/boost/test/tools/detail/tolerance_manip.hpp b/contrib/restricted/boost/test/include/boost/test/tools/detail/tolerance_manip.hpp deleted file mode 100644 index af945cf704..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/tools/detail/tolerance_manip.hpp +++ /dev/null @@ -1,154 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -//! @file -//! @brief Floating point comparison tolerance manipulators -//! -//! This file defines several manipulators for floating point comparison. These -//! manipulators are intended to be used with BOOST_TEST. -// *************************************************************************** - -#ifndef BOOST_TEST_TOOLS_DETAIL_TOLERANCE_MANIP_HPP_012705GER -#define BOOST_TEST_TOOLS_DETAIL_TOLERANCE_MANIP_HPP_012705GER - -// Boost Test -#include <boost/test/tools/detail/fwd.hpp> -#include <boost/test/tools/detail/indirections.hpp> - -#include <boost/test/utils/lazy_ostream.hpp> -#include <boost/test/tools/fpc_tolerance.hpp> -#include <boost/test/tools/floating_point_comparison.hpp> - -#include <ostream> - -#include <boost/test/detail/suppress_warnings.hpp> - -//____________________________________________________________________________// - -namespace boost { -namespace test_tools { -namespace tt_detail { - -// ************************************************************************** // -// ************** fpc tolerance manipulator ************** // -// ************************************************************************** // - -//! Tolerance manipulator, not to be used directly -//! This is not a terminal of the expression -template<typename FPT> -struct tolerance_manip { - explicit tolerance_manip( FPT const & tol ) : m_value( tol ) {} - - FPT m_value; -}; - -//____________________________________________________________________________// - -struct tolerance_manip_delay {}; - -template<typename FPT> -inline tolerance_manip<FPT> -operator%( FPT v, tolerance_manip_delay const& ) -{ - BOOST_STATIC_ASSERT_MSG( (fpc::tolerance_based<FPT>::value), - "tolerance should be specified using a floating points type" ); - - return tolerance_manip<FPT>( FPT(v / 100) ); -} - -template <typename FPT> -struct tolerance_evaluation_context: assertion_evaluation_context { - tolerance_evaluation_context(FPT tol) - : assertion_evaluation_context( true ) // has report - , m_tolerance_context(tol) - {} - - local_fpc_tolerance<FPT> m_tolerance_context; -}; - -//____________________________________________________________________________// - -template<typename E, typename FPT> -inline assertion_evaluate_t<E> -operator<<(assertion_evaluate_t<E> const& ae, tolerance_manip<FPT> const& tol) -{ - return ae.stack_context( - typename assertion_evaluate_t<E>::context_holder( - new tolerance_evaluation_context<FPT>( tol.m_value )) - ); -} - -//____________________________________________________________________________// - -template<typename FPT> -unit_test::lazy_ostream & -operator<<( unit_test::lazy_ostream &o, tolerance_manip<FPT> const& ) { return o; } - -// needed for the lazy evaluation in lazy_ostream as for commutativity with other arguments -template<typename FPT> -std::ostream& -operator<<( std::ostream& o, tolerance_manip<FPT> const& ) { return o; } - - -//____________________________________________________________________________// - -template<typename FPT> -inline assertion_type -operator<<( assertion_type const& /*at*/, tolerance_manip<FPT> const& ) { - return assertion_type(CHECK_BUILT_ASSERTION); -} - -//____________________________________________________________________________// - -} // namespace tt_detail - - -/*! Tolerance manipulator - * - * These functions return a manipulator that can be used in conjunction with BOOST_TEST - * in order to specify the tolerance with which floating point comparisons are made. - */ -template<typename FPT> -inline tt_detail::tolerance_manip<FPT> -tolerance( FPT v ) -{ - BOOST_STATIC_ASSERT_MSG( (fpc::tolerance_based<FPT>::value), - "tolerance only for floating points" ); - - return tt_detail::tolerance_manip<FPT>( v ); -} - -//____________________________________________________________________________// - -//! @overload tolerance( FPT v ) -template<typename FPT> -inline tt_detail::tolerance_manip<FPT> -tolerance( fpc::percent_tolerance_t<FPT> v ) -{ - BOOST_STATIC_ASSERT_MSG( (fpc::tolerance_based<FPT>::value), - "tolerance only for floating points" ); - - return tt_detail::tolerance_manip<FPT>( static_cast<FPT>(v.m_value / 100) ); -} - -//____________________________________________________________________________// - -//! @overload tolerance( FPT v ) -inline tt_detail::tolerance_manip_delay -tolerance() -{ - return tt_detail::tolerance_manip_delay(); -} - -//____________________________________________________________________________// - -} // namespace test_tools -} // namespace boost - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_TOOLS_DETAIL_TOLERANCE_MANIP_HPP_012705GER diff --git a/contrib/restricted/boost/test/include/boost/test/tools/floating_point_comparison.hpp b/contrib/restricted/boost/test/include/boost/test/tools/floating_point_comparison.hpp deleted file mode 100644 index 1364fde8b8..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/tools/floating_point_comparison.hpp +++ /dev/null @@ -1,336 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -//!@file -//!@brief algorithms for comparing floating point values -// *************************************************************************** - -#ifndef BOOST_TEST_FLOATING_POINT_COMPARISON_HPP_071894GER -#define BOOST_TEST_FLOATING_POINT_COMPARISON_HPP_071894GER - -// Boost.Test -#include <boost/test/detail/global_typedef.hpp> -#include <boost/test/tools/assertion_result.hpp> - -// Boost -#include <boost/limits.hpp> // for std::numeric_limits -#include <boost/static_assert.hpp> -#include <boost/assert.hpp> -#include <boost/mpl/bool.hpp> -#include <boost/type_traits/is_floating_point.hpp> -#include <boost/type_traits/is_array.hpp> -#include <boost/type_traits/is_reference.hpp> -#include <boost/type_traits/is_void.hpp> -#include <boost/type_traits/conditional.hpp> -#include <boost/utility/enable_if.hpp> - -// STL -#include <iosfwd> - -#include <boost/test/detail/suppress_warnings.hpp> - -//____________________________________________________________________________// - -namespace boost { -namespace math { -namespace fpc { - -// ************************************************************************** // -// ************** fpc::tolerance_based ************** // -// ************************************************************************** // - - -//! @internal -//! Protects the instanciation of std::numeric_limits from non-supported types (eg. T=array) -template <typename T, bool enabled> -struct tolerance_based_delegate; - -template <typename T> -struct tolerance_based_delegate<T, false> : mpl::false_ {}; - -// from https://stackoverflow.com/a/16509511/1617295 -template<typename T> -class is_abstract_class_or_function -{ - typedef char (&Two)[2]; - template<typename U> static char test(U(*)[1]); - template<typename U> static Two test(...); - -public: - static const bool value = - !is_reference<T>::value - && !is_void<T>::value - && (sizeof(test<T>(0)) == sizeof(Two)); -}; - -// warning: we cannot instanciate std::numeric_limits for incomplete types, we use is_abstract_class_or_function -// prior to the specialization below -template <typename T> -struct tolerance_based_delegate<T, true> -: mpl::bool_< - is_floating_point<T>::value || - (!std::numeric_limits<T>::is_integer && std::numeric_limits<T>::is_specialized && !std::numeric_limits<T>::is_exact)> -{}; - - -/*!@brief Indicates if a type can be compared using a tolerance scheme - * - * This is a metafunction that should evaluate to @c mpl::true_ if the type - * @c T can be compared using a tolerance based method, typically for floating point - * types. - * - * This metafunction can be specialized further to declare user types that are - * floating point (eg. boost.multiprecision). - */ -template <typename T> -struct tolerance_based : tolerance_based_delegate<T, !is_array<T>::value && !is_abstract_class_or_function<T>::value>::type {}; - -// ************************************************************************** // -// ************** fpc::strength ************** // -// ************************************************************************** // - -//! Method for comparing floating point numbers -enum strength { - FPC_STRONG, //!< "Very close" - equation 2' in docs, the default - FPC_WEAK //!< "Close enough" - equation 3' in docs. -}; - - -// ************************************************************************** // -// ************** tolerance presentation types ************** // -// ************************************************************************** // - -template<typename FPT> -struct percent_tolerance_t { - explicit percent_tolerance_t( FPT v ) : m_value( v ) {} - - FPT m_value; -}; - -//____________________________________________________________________________// - -template<typename FPT> -inline std::ostream& operator<<( std::ostream& out, percent_tolerance_t<FPT> t ) -{ - return out << t.m_value; -} - -//____________________________________________________________________________// - -template<typename FPT> -inline percent_tolerance_t<FPT> -percent_tolerance( FPT v ) -{ - return percent_tolerance_t<FPT>( v ); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** details ************** // -// ************************************************************************** // - -namespace fpc_detail { - -// FPT is Floating-Point Type: float, double, long double or User-Defined. -template<typename FPT> -inline FPT -fpt_abs( FPT fpv ) -{ - return fpv < static_cast<FPT>(0) ? -fpv : fpv; -} - -//____________________________________________________________________________// - -template<typename FPT> -struct fpt_specialized_limits -{ - static FPT min_value() { return (std::numeric_limits<FPT>::min)(); } - static FPT max_value() { return (std::numeric_limits<FPT>::max)(); } -}; - -template<typename FPT> -struct fpt_non_specialized_limits -{ - static FPT min_value() { return static_cast<FPT>(0); } - static FPT max_value() { return static_cast<FPT>(1000000); } // for our purposes it doesn't really matter what value is returned here -}; - -template<typename FPT> -struct fpt_limits : boost::conditional<std::numeric_limits<FPT>::is_specialized, - fpt_specialized_limits<FPT>, - fpt_non_specialized_limits<FPT> - >::type -{}; - -//____________________________________________________________________________// - -// both f1 and f2 are unsigned here -template<typename FPT> -inline FPT -safe_fpt_division( FPT f1, FPT f2 ) -{ - // Avoid overflow. - if( (f2 < static_cast<FPT>(1)) && (f1 > f2*fpt_limits<FPT>::max_value()) ) - return fpt_limits<FPT>::max_value(); - - // Avoid underflow. - if( (fpt_abs(f1) <= fpt_limits<FPT>::min_value()) || - ((f2 > static_cast<FPT>(1)) && (f1 < f2*fpt_limits<FPT>::min_value())) ) - return static_cast<FPT>(0); - - return f1/f2; -} - -//____________________________________________________________________________// - -template<typename FPT, typename ToleranceType> -inline FPT -fraction_tolerance( ToleranceType tolerance ) -{ - return static_cast<FPT>(tolerance); -} - -//____________________________________________________________________________// - -template<typename FPT2, typename FPT> -inline FPT2 -fraction_tolerance( percent_tolerance_t<FPT> tolerance ) -{ - return FPT2(tolerance.m_value)*FPT2(0.01); -} - -//____________________________________________________________________________// - -} // namespace fpc_detail - -// ************************************************************************** // -// ************** close_at_tolerance ************** // -// ************************************************************************** // - - -/*!@brief Predicate for comparing floating point numbers - * - * This predicate is used to compare floating point numbers. In addition the comparison produces maximum - * related difference, which can be used to generate detailed error message - * The methods for comparing floating points are detailed in the documentation. The method is chosen - * by the @ref boost::math::fpc::strength given at construction. - * - * This predicate is not suitable for comparing to 0 or to infinity. - */ -template<typename FPT> -class close_at_tolerance { -public: - // Public typedefs - typedef bool result_type; - - // Constructor - template<typename ToleranceType> - explicit close_at_tolerance( ToleranceType tolerance, fpc::strength fpc_strength = FPC_STRONG ) - : m_fraction_tolerance( fpc_detail::fraction_tolerance<FPT>( tolerance ) ) - , m_strength( fpc_strength ) - , m_tested_rel_diff( 0 ) - { - BOOST_ASSERT_MSG( m_fraction_tolerance >= FPT(0), "tolerance must not be negative!" ); // no reason for tolerance to be negative - } - - // Access methods - //! Returns the tolerance - FPT fraction_tolerance() const { return m_fraction_tolerance; } - - //! Returns the comparison method - fpc::strength strength() const { return m_strength; } - - //! Returns the failing fraction - FPT tested_rel_diff() const { return m_tested_rel_diff; } - - /*! Compares two floating point numbers a and b such that their "left" relative difference |a-b|/a and/or - * "right" relative difference |a-b|/b does not exceed specified relative (fraction) tolerance. - * - * @param[in] left first floating point number to be compared - * @param[in] right second floating point number to be compared - * - * What is reported by @c tested_rel_diff in case of failure depends on the comparison method: - * - for @c FPC_STRONG: the max of the two fractions - * - for @c FPC_WEAK: the min of the two fractions - * The rationale behind is to report the tolerance to set in order to make a test pass. - */ - bool operator()( FPT left, FPT right ) const - { - FPT diff = fpc_detail::fpt_abs<FPT>( left - right ); - FPT fraction_of_right = fpc_detail::safe_fpt_division( diff, fpc_detail::fpt_abs( right ) ); - FPT fraction_of_left = fpc_detail::safe_fpt_division( diff, fpc_detail::fpt_abs( left ) ); - - FPT max_rel_diff = (std::max)( fraction_of_left, fraction_of_right ); - FPT min_rel_diff = (std::min)( fraction_of_left, fraction_of_right ); - - m_tested_rel_diff = m_strength == FPC_STRONG ? max_rel_diff : min_rel_diff; - - return m_tested_rel_diff <= m_fraction_tolerance; - } - -private: - // Data members - FPT m_fraction_tolerance; - fpc::strength m_strength; - mutable FPT m_tested_rel_diff; -}; - -// ************************************************************************** // -// ************** small_with_tolerance ************** // -// ************************************************************************** // - - -/*!@brief Predicate for comparing floating point numbers against 0 - * - * Serves the same purpose as boost::math::fpc::close_at_tolerance, but used when one - * of the operand is null. - */ -template<typename FPT> -class small_with_tolerance { -public: - // Public typedefs - typedef bool result_type; - - // Constructor - explicit small_with_tolerance( FPT tolerance ) // <= absolute tolerance - : m_tolerance( tolerance ) - { - BOOST_ASSERT( m_tolerance >= FPT(0) ); // no reason for the tolerance to be negative - } - - // Action method - bool operator()( FPT fpv ) const - { - return fpc::fpc_detail::fpt_abs( fpv ) <= m_tolerance; - } - -private: - // Data members - FPT m_tolerance; -}; - -// ************************************************************************** // -// ************** is_small ************** // -// ************************************************************************** // - -template<typename FPT> -inline bool -is_small( FPT fpv, FPT tolerance ) -{ - return small_with_tolerance<FPT>( tolerance )( fpv ); -} - -//____________________________________________________________________________// - -} // namespace fpc -} // namespace math -} // namespace boost - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_FLOATING_POINT_COMAPARISON_HPP_071894GER diff --git a/contrib/restricted/boost/test/include/boost/test/tools/fpc_op.hpp b/contrib/restricted/boost/test/include/boost/test/tools/fpc_op.hpp deleted file mode 100644 index 22bfeaa31d..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/tools/fpc_op.hpp +++ /dev/null @@ -1,244 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -//!@file -//!@brief Floating point comparison with enhanced reporting -// *************************************************************************** - -#ifndef BOOST_TEST_TOOLS_FPC_OP_HPP_050915GER -#define BOOST_TEST_TOOLS_FPC_OP_HPP_050915GER - -// Boost.Test -#include <boost/test/tools/assertion.hpp> - -#include <boost/test/tools/floating_point_comparison.hpp> -#include <boost/test/tools/fpc_tolerance.hpp> - -// Boost -#include <boost/type_traits/common_type.hpp> -#include <boost/type_traits/is_arithmetic.hpp> -#include <boost/utility/enable_if.hpp> - -#include <boost/test/detail/suppress_warnings.hpp> - -//____________________________________________________________________________// - -namespace boost { -namespace test_tools { -namespace assertion { -namespace op { - -// ************************************************************************** // -// ************** fpctraits ************** // -// ************************************************************************** // -// set of floating point comparison traits per comparison OP - -template<typename OP> -struct fpctraits { - // indicate if we should perform the operation with a "logical OR" - // with the "equality under tolerance". - static const bool equality_logical_disjunction = true; -}; - -template <typename Lhs, typename Rhs> -struct fpctraits<op::LT<Lhs,Rhs> > { - static const bool equality_logical_disjunction = false; -}; - -template <typename Lhs, typename Rhs> -struct fpctraits<op::GT<Lhs,Rhs> > { - static const bool equality_logical_disjunction = false; -}; - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** set of overloads to select correct fpc algo ************** // -// ************************************************************************** // -// we really only care about EQ vs NE. All other comparisons use direct first -// and then need EQ. For example a <= b (tolerance t) IFF a <= b OR a == b (tolerance t) - -template <typename FPT, typename Lhs, typename Rhs, typename OP> -inline assertion_result -compare_fpv( Lhs const& lhs, Rhs const& rhs, OP* cmp_operator) -{ - assertion_result result_direct_compare = cmp_operator->eval_direct(lhs, rhs); - if(fpctraits<OP>::equality_logical_disjunction) { - // this look like this can be simplified, but combining result && compare_fpv - // looses the message in the return value of compare_fpv - if( result_direct_compare ) { - result_direct_compare.message() << "operation" << OP::forward() << "on arguments yields 'true'."; - return result_direct_compare; - } - // result || compare_fpv(EQ) - assertion_result result_eq = compare_fpv<FPT>(lhs, rhs, (op::EQ<Lhs, Rhs>*)0); - result_direct_compare = result_direct_compare || result_eq; - if( !result_eq ) { - result_direct_compare.message() << "operation" << op::EQ<Lhs, Rhs>::forward() << "on arguments yields 'false': " << result_eq.message() << "."; - } - return result_direct_compare; - } - if( !result_direct_compare ) { - result_direct_compare.message() << "operation" << OP::forward() << " on arguments yields 'false'."; - return result_direct_compare; - } - // result && compare_fpv(NE) - assertion_result result_neq = compare_fpv<FPT>(lhs, rhs, (op::NE<Lhs, Rhs>*)0); - result_direct_compare = result_direct_compare && result_neq; - if( !result_neq ) { - result_direct_compare.message() << "operation" << op::NE<Lhs, Rhs>::forward() << "on arguments yields 'false': " << result_neq.message() << "."; - } - return result_direct_compare; -} - -//____________________________________________________________________________// - -template <typename FPT, typename Lhs, typename Rhs> -inline assertion_result -compare_fpv_near_zero( FPT const& fpv, op::EQ<Lhs,Rhs>* ) -{ - fpc::small_with_tolerance<FPT> P( fpc_tolerance<FPT>() ); - - assertion_result ar( P( fpv ) ); - if( !ar ) - ar.message() << "absolute value exceeds tolerance [|" << fpv << "| > "<< fpc_tolerance<FPT>() << ']'; - - return ar; -} - -//____________________________________________________________________________// - -template <typename FPT, typename Lhs, typename Rhs> -inline assertion_result -compare_fpv_near_zero( FPT const& fpv, op::NE<Lhs,Rhs>* ) -{ - fpc::small_with_tolerance<FPT> P( fpc_tolerance<FPT>() ); - - assertion_result ar( !P( fpv ) ); - if( !ar ) - ar.message() << "absolute value is within tolerance [|" << fpv << "| < "<< fpc_tolerance<FPT>() << ']'; - return ar; -} - -//____________________________________________________________________________// - -template <typename FPT, typename Lhs, typename Rhs> -inline assertion_result -compare_fpv( Lhs const& lhs, Rhs const& rhs, op::EQ<Lhs,Rhs>* ) -{ - if( lhs == 0 ) { - return compare_fpv_near_zero<FPT>( rhs, (op::EQ<Lhs,Rhs>*)0 ); - } - else if( rhs == 0) { - return compare_fpv_near_zero<FPT>( lhs, (op::EQ<Lhs,Rhs>*)0 ); - } - else { - fpc::close_at_tolerance<FPT> P( fpc_tolerance<FPT>(), fpc::FPC_STRONG ); - - assertion_result ar( P( lhs, rhs ) ); - if( !ar ) - ar.message() << "relative difference exceeds tolerance [" - << P.tested_rel_diff() << " > " << P.fraction_tolerance() << ']'; - return ar; - } -} - -//____________________________________________________________________________// - -template <typename FPT, typename Lhs, typename Rhs> -inline assertion_result -compare_fpv( Lhs const& lhs, Rhs const& rhs, op::NE<Lhs,Rhs>* ) -{ - if( lhs == 0 ) { - return compare_fpv_near_zero<FPT>( rhs, (op::NE<Lhs,Rhs>*)0 ); - } - else if( rhs == 0 ) { - return compare_fpv_near_zero<FPT>( lhs, (op::NE<Lhs,Rhs>*)0 ); - } - else { - fpc::close_at_tolerance<FPT> P( fpc_tolerance<FPT>(), fpc::FPC_WEAK ); - - assertion_result ar( !P( lhs, rhs ) ); - if( !ar ) - ar.message() << "relative difference is within tolerance [" - << P.tested_rel_diff() << " < " << fpc_tolerance<FPT>() << ']'; - - return ar; - } -} - -//____________________________________________________________________________// - -#define DEFINE_FPV_COMPARISON( oper, name, rev, name_inverse ) \ -template<typename Lhs,typename Rhs> \ -struct name<Lhs,Rhs,typename boost::enable_if_c< \ - (fpc::tolerance_based<Lhs>::value && \ - fpc::tolerance_based<Rhs>::value) || \ - (fpc::tolerance_based<Lhs>::value && \ - boost::is_arithmetic<Rhs>::value) || \ - (boost::is_arithmetic<Lhs>::value && \ - fpc::tolerance_based<Rhs>::value) \ - >::type> { \ -public: \ - typedef typename common_type<Lhs,Rhs>::type FPT; \ - typedef name<Lhs,Rhs> OP; \ - typedef name_inverse<Lhs, Rhs> inverse; \ - \ - typedef assertion_result result_type; \ - \ - static bool \ - eval_direct( Lhs const& lhs, Rhs const& rhs ) \ - { \ - return lhs oper rhs; \ - } \ - \ - static assertion_result \ - eval( Lhs const& lhs, Rhs const& rhs ) \ - { \ - if( fpc_tolerance<FPT>() == FPT(0) \ - || (std::numeric_limits<Lhs>::has_infinity \ - && (lhs == std::numeric_limits<Lhs>::infinity())) \ - || (std::numeric_limits<Rhs>::has_infinity \ - && (rhs == std::numeric_limits<Rhs>::infinity()))) \ - { \ - return eval_direct( lhs, rhs ); \ - } \ - \ - return compare_fpv<FPT>( lhs, rhs, (OP*)0 ); \ - } \ - \ - template<typename PrevExprType> \ - static void \ - report( std::ostream& ostr, \ - PrevExprType const& lhs, \ - Rhs const& rhs ) \ - { \ - lhs.report( ostr ); \ - ostr << revert() \ - << tt_detail::print_helper( rhs ); \ - } \ - \ - static char const* forward() \ - { return " " #oper " "; } \ - static char const* revert() \ - { return " " #rev " "; } \ -}; \ -/**/ - -BOOST_TEST_FOR_EACH_COMP_OP( DEFINE_FPV_COMPARISON ) -#undef DEFINE_FPV_COMPARISON - -//____________________________________________________________________________// - -} // namespace op -} // namespace assertion -} // namespace test_tools -} // namespace boost - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_TOOLS_FPC_OP_HPP_050915GER diff --git a/contrib/restricted/boost/test/include/boost/test/tools/fpc_tolerance.hpp b/contrib/restricted/boost/test/include/boost/test/tools/fpc_tolerance.hpp deleted file mode 100644 index c862a17e75..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/tools/fpc_tolerance.hpp +++ /dev/null @@ -1,103 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision: 74248 $ -// -// Description : FPC tools tolerance holder -// *************************************************************************** - -#ifndef BOOST_TEST_TOOLS_FPC_TOLERANCE_HPP_121612GER -#define BOOST_TEST_TOOLS_FPC_TOLERANCE_HPP_121612GER - -// Boost Test -#include <boost/test/tree/decorator.hpp> -#include <boost/test/tools/floating_point_comparison.hpp> - -#include <boost/test/detail/suppress_warnings.hpp> - -//____________________________________________________________________________// - -namespace boost { -namespace test_tools { - -namespace fpc = math::fpc; - -// ************************************************************************** // -// ************** floating point comparison tolerance ************** // -// ************************************************************************** // - -template<typename FPT> -inline FPT& -fpc_tolerance() -{ - static FPT s_value = 0; - return s_value; -} - -//____________________________________________________________________________// - -template<typename FPT> -struct local_fpc_tolerance { - local_fpc_tolerance( FPT fraction_tolerance ) : m_old_tolerance( fpc_tolerance<FPT>() ) - { - fpc_tolerance<FPT>() = fraction_tolerance; - } - - ~local_fpc_tolerance() - { - if( m_old_tolerance != (FPT)-1 ) - fpc_tolerance<FPT>() = m_old_tolerance; - } - -private: - // Data members - FPT m_old_tolerance; -}; - -//____________________________________________________________________________// - -} // namespace test_tools - -// ************************************************************************** // -// ************** decorator::tolerance ************** // -// ************************************************************************** // - -namespace unit_test { -namespace decorator { - -template<typename FPT> -inline fixture_t -tolerance( FPT v ) -{ - return fixture_t( test_unit_fixture_ptr( - new unit_test::class_based_fixture<test_tools::local_fpc_tolerance<FPT>,FPT>( v ) ) ); -} - -//____________________________________________________________________________// - -template<typename FPT> -inline fixture_t -tolerance( test_tools::fpc::percent_tolerance_t<FPT> v ) -{ - return fixture_t( test_unit_fixture_ptr( - new unit_test::class_based_fixture<test_tools::local_fpc_tolerance<FPT>,FPT>( boost::math::fpc::fpc_detail::fraction_tolerance<FPT>( v ) ) ) ); -} - -//____________________________________________________________________________// - -} // namespace decorator - -using decorator::tolerance; - -} // namespace unit_test -} // namespace boost - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_TOOLS_FPC_TOLERANCE_HPP_121612GER diff --git a/contrib/restricted/boost/test/include/boost/test/tools/interface.hpp b/contrib/restricted/boost/test/include/boost/test/tools/interface.hpp deleted file mode 100644 index e62ae946c0..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/tools/interface.hpp +++ /dev/null @@ -1,366 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision: 81247 $ -// -// Description : contains definition for all test tools in test toolbox -// *************************************************************************** - -#ifndef BOOST_TEST_TOOLS_INTERFACE_HPP_111712GER -#define BOOST_TEST_TOOLS_INTERFACE_HPP_111712GER - -// Boost.Test -#include <boost/test/unit_test_log.hpp> -#ifdef BOOST_TEST_TOOLS_DEBUGGABLE -#include <boost/test/debug.hpp> -#endif - -#include <boost/test/detail/pp_variadic.hpp> - -#ifdef BOOST_TEST_NO_OLD_TOOLS -#include <boost/preprocessor/seq/to_tuple.hpp> - -#include <iterator> -#endif // BOOST_TEST_NO_OLD_TOOLS - -#include <boost/test/detail/suppress_warnings.hpp> - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** BOOST_TEST_<level> ************** // -// ************************************************************************** // - -#define BOOST_TEST_BUILD_ASSERTION( P ) \ - (::boost::test_tools::assertion::seed()->*P) \ -/**/ - -//____________________________________________________________________________// - -// Implementation based on direct predicate evaluation -#define BOOST_TEST_TOOL_DIRECT_IMPL( P, level, M ) \ -do { \ - ::boost::test_tools::assertion_result res = (P); \ - report_assertion( \ - res, \ - BOOST_TEST_LAZY_MSG( M ), \ - BOOST_TEST_L(__FILE__), \ - static_cast<std::size_t>(__LINE__), \ - ::boost::test_tools::tt_detail::level, \ - ::boost::test_tools::tt_detail::CHECK_MSG, \ - 0 ); \ -} while( ::boost::test_tools::tt_detail::dummy_cond() ) \ -/**/ - -//____________________________________________________________________________// - -// Implementation based on expression template construction -#define BOOST_TEST_TOOL_ET_IMPL( P, level ) \ -do { \ - BOOST_TEST_PASSPOINT(); \ - \ - ::boost::test_tools::tt_detail:: \ - report_assertion( \ - BOOST_TEST_BUILD_ASSERTION( P ).evaluate(), \ - BOOST_TEST_LAZY_MSG( BOOST_TEST_STRINGIZE( P ) ), \ - BOOST_TEST_L(__FILE__), \ - static_cast<std::size_t>(__LINE__), \ - ::boost::test_tools::tt_detail::level, \ - ::boost::test_tools::tt_detail::CHECK_BUILT_ASSERTION, \ - 0 ); \ -} while( ::boost::test_tools::tt_detail::dummy_cond() ) \ -/**/ - -//____________________________________________________________________________// - -// Implementation based on expression template construction with extra tool arguments -#define BOOST_TEST_TOOL_ET_IMPL_EX( P, level, arg ) \ -do { \ - BOOST_TEST_PASSPOINT(); \ - \ - ::boost::test_tools::tt_detail:: \ - report_assertion( \ - ::boost::test_tools::tt_detail::assertion_evaluate( \ - BOOST_TEST_BUILD_ASSERTION( P ) ) \ - << arg, \ - ::boost::test_tools::tt_detail::assertion_text( \ - BOOST_TEST_LAZY_MSG( BOOST_TEST_STRINGIZE(P) ), \ - BOOST_TEST_LAZY_MSG( arg ) ), \ - BOOST_TEST_L(__FILE__), \ - static_cast<std::size_t>(__LINE__), \ - ::boost::test_tools::tt_detail::level, \ - ::boost::test_tools::tt_detail::assertion_type() \ - << arg, \ - 0 ); \ -} while( ::boost::test_tools::tt_detail::dummy_cond() ) \ -/**/ - -//____________________________________________________________________________// - -#ifdef BOOST_TEST_TOOLS_UNDER_DEBUGGER - -#define BOOST_TEST_TOOL_UNIV( level, P ) \ - BOOST_TEST_TOOL_DIRECT_IMPL( P, level, BOOST_TEST_STRINGIZE( P ) ) \ -/**/ - -#define BOOST_TEST_TOOL_UNIV_EX( level, P, ... ) \ - BOOST_TEST_TOOL_UNIV( level, P ) \ -/**/ - -#elif defined(BOOST_TEST_TOOLS_DEBUGGABLE) - -#define BOOST_TEST_TOOL_UNIV( level, P ) \ -do { \ - if( ::boost::debug::under_debugger() ) \ - BOOST_TEST_TOOL_DIRECT_IMPL( P, level, BOOST_TEST_STRINGIZE( P ) ); \ - else \ - BOOST_TEST_TOOL_ET_IMPL( P, level ); \ -} while( ::boost::test_tools::tt_detail::dummy_cond() ) \ -/**/ - -#define BOOST_TEST_TOOL_UNIV_EX( level, P, ... ) \ - BOOST_TEST_TOOL_UNIV( level, P ) \ -/**/ - -#else - -#define BOOST_TEST_TOOL_UNIV( level, P ) \ - BOOST_TEST_TOOL_ET_IMPL( P, level ) \ -/**/ - -#define BOOST_TEST_TOOL_UNIV_EX( level, P, ... ) \ - BOOST_TEST_TOOL_ET_IMPL_EX( P, level, __VA_ARGS__ ) \ -/**/ - -#endif - -//____________________________________________________________________________// - -#define BOOST_TEST_WARN( ... ) BOOST_TEST_INVOKE_IF_N_ARGS( \ - 2, BOOST_TEST_TOOL_UNIV, BOOST_TEST_TOOL_UNIV_EX, WARN, __VA_ARGS__ ) \ -/**/ -#define BOOST_TEST_CHECK( ... ) BOOST_TEST_INVOKE_IF_N_ARGS( \ - 2, BOOST_TEST_TOOL_UNIV, BOOST_TEST_TOOL_UNIV_EX, CHECK, __VA_ARGS__ ) \ -/**/ -#define BOOST_TEST_REQUIRE( ... ) BOOST_TEST_INVOKE_IF_N_ARGS( \ - 2, BOOST_TEST_TOOL_UNIV, BOOST_TEST_TOOL_UNIV_EX, REQUIRE, __VA_ARGS__ )\ -/**/ - -#define BOOST_TEST( ... ) BOOST_TEST_INVOKE_IF_N_ARGS( \ - 2, BOOST_TEST_TOOL_UNIV, BOOST_TEST_TOOL_UNIV_EX, CHECK, __VA_ARGS__ ) \ -/**/ - -//____________________________________________________________________________// - -#define BOOST_TEST_ERROR( M ) BOOST_CHECK_MESSAGE( false, M ) -#define BOOST_TEST_FAIL( M ) BOOST_REQUIRE_MESSAGE( false, M ) - -//____________________________________________________________________________// - -#define BOOST_TEST_IS_DEFINED( symb ) ::boost::test_tools::tt_detail::is_defined_impl( symb, BOOST_STRINGIZE(= symb) ) - -//____________________________________________________________________________// - -#ifdef BOOST_TEST_NO_OLD_TOOLS - -#ifdef BOOST_TEST_TOOLS_UNDER_DEBUGGER - -#define BOOST_CHECK_THROW_IMPL(S, E, TL, Ppassed, Mpassed, Pcaught, Mcaught)\ -do { try { \ - S; \ - BOOST_TEST_TOOL_DIRECT_IMPL( Ppassed, TL, Mpassed ); \ -} catch( E ) { \ - BOOST_TEST_TOOL_DIRECT_IMPL( Pcaught, TL, Mcaught ); \ -}} while( ::boost::test_tools::tt_detail::dummy_cond() ) \ -/**/ - -#elif defined(BOOST_TEST_TOOLS_DEBUGGABLE) - -#define BOOST_CHECK_THROW_IMPL(S, E, TL, Ppassed, Mpassed, Pcaught, Mcaught)\ -do { try { \ - if( ::boost::debug::under_debugger() ) \ - BOOST_TEST_PASSPOINT(); \ - S; \ - BOOST_TEST_TOOL_DIRECT_IMPL( Ppassed, TL, Mpassed ); \ -} catch( E ) { \ - BOOST_TEST_TOOL_DIRECT_IMPL( Pcaught, TL, Mcaught ); \ -}} while( ::boost::test_tools::tt_detail::dummy_cond() ) \ -/**/ - -#else - -#define BOOST_CHECK_THROW_IMPL(S, E, TL, Ppassed, Mpassed, Pcaught, Mcaught)\ -do { try { \ - BOOST_TEST_PASSPOINT(); \ - S; \ - BOOST_TEST_TOOL_DIRECT_IMPL( Ppassed, TL, Mpassed ); \ -} catch( E ) { \ - BOOST_TEST_TOOL_DIRECT_IMPL( Pcaught, TL, Mcaught ); \ -}} while( ::boost::test_tools::tt_detail::dummy_cond() ) \ -/**/ - -#endif - -//____________________________________________________________________________// - -#define BOOST_WARN_THROW( S, E ) \ - BOOST_CHECK_THROW_IMPL(S, E const&, WARN, \ - false, "exception " BOOST_STRINGIZE(E) " is expected", \ - true , "exception " BOOST_STRINGIZE(E) " is caught" ) \ -/**/ -#define BOOST_CHECK_THROW( S, E ) \ - BOOST_CHECK_THROW_IMPL(S, E const&, CHECK, \ - false, "exception " BOOST_STRINGIZE(E) " is expected", \ - true , "exception " BOOST_STRINGIZE(E) " is caught" ) \ -/**/ -#define BOOST_REQUIRE_THROW( S, E ) \ - BOOST_CHECK_THROW_IMPL(S, E const&, REQUIRE, \ - false, "exception " BOOST_STRINGIZE(E) " is expected", \ - true , "exception " BOOST_STRINGIZE(E) " is caught" ) \ -/**/ - -//____________________________________________________________________________// - -#define BOOST_WARN_EXCEPTION( S, E, P ) \ - BOOST_CHECK_THROW_IMPL(S, E const& ex, WARN, \ - false, "exception " BOOST_STRINGIZE(E) " is expected", \ - P(ex), "incorrect exception " BOOST_STRINGIZE(E) " is caught" ) \ -/**/ -#define BOOST_CHECK_EXCEPTION( S, E, P ) \ - BOOST_CHECK_THROW_IMPL(S, E const& ex, CHECK, \ - false, "exception " BOOST_STRINGIZE(E) " is expected", \ - P(ex), "incorrect exception " BOOST_STRINGIZE(E) " is caught" ) \ -/**/ -#define BOOST_REQUIRE_EXCEPTION( S, E, P ) \ - BOOST_CHECK_THROW_IMPL(S, E const& ex, REQUIRE, \ - false, "exception " BOOST_STRINGIZE(E) " is expected", \ - P(ex), "incorrect exception " BOOST_STRINGIZE(E) " is caught" ) \ -/**/ - -//____________________________________________________________________________// - -#define BOOST_WARN_NO_THROW( S ) \ - BOOST_CHECK_THROW_IMPL(S, ..., WARN, \ - true , "no exceptions thrown by " BOOST_STRINGIZE( S ), \ - false, "exception thrown by " BOOST_STRINGIZE( S ) ) \ -/**/ -#define BOOST_CHECK_NO_THROW( S ) \ - BOOST_CHECK_THROW_IMPL(S, ..., CHECK, \ - true , "no exceptions thrown by " BOOST_STRINGIZE( S ), \ - false, "exception thrown by " BOOST_STRINGIZE( S ) ) \ -/**/ -#define BOOST_REQUIRE_NO_THROW( S ) \ - BOOST_CHECK_THROW_IMPL(S, ..., REQUIRE, \ - true , "no exceptions thrown by " BOOST_STRINGIZE( S ), \ - false, "exception thrown by " BOOST_STRINGIZE( S ) ) \ -/**/ - -//____________________________________________________________________________// - -#define BOOST_WARN_MESSAGE( P, M ) BOOST_TEST_TOOL_DIRECT_IMPL( P, WARN, M ) -#define BOOST_CHECK_MESSAGE( P, M ) BOOST_TEST_TOOL_DIRECT_IMPL( P, CHECK, M ) -#define BOOST_REQUIRE_MESSAGE( P, M ) BOOST_TEST_TOOL_DIRECT_IMPL( P, REQUIRE, M ) - -//____________________________________________________________________________// - -//////////////////////////////////////////////////////////////////////////////// -///////////////////////////// DEPRECATED TOOLS ///////////////////////////// - -#define BOOST_WARN( P ) BOOST_TEST_WARN( P ) -#define BOOST_CHECK( P ) BOOST_TEST_CHECK( P ) -#define BOOST_REQUIRE( P ) BOOST_TEST_REQUIRE( P ) - -//____________________________________________________________________________// - -#define BOOST_ERROR( M ) BOOST_TEST_ERROR( M ) -#define BOOST_FAIL( M ) BOOST_TEST_FAIL( M ) - -//____________________________________________________________________________// - -#define BOOST_WARN_EQUAL( L, R ) BOOST_TEST_WARN( L == R ) -#define BOOST_CHECK_EQUAL( L, R ) BOOST_TEST_CHECK( L == R ) -#define BOOST_REQUIRE_EQUAL( L, R ) BOOST_TEST_REQUIRE( L == R ) - -#define BOOST_WARN_NE( L, R ) BOOST_TEST_WARN( L != R ) -#define BOOST_CHECK_NE( L, R ) BOOST_TEST_CHECK( L != R ) -#define BOOST_REQUIRE_NE( L, R ) BOOST_TEST_REQUIRE( L != R ) - -#define BOOST_WARN_LT( L, R ) BOOST_TEST_WARN( L < R ) -#define BOOST_CHECK_LT( L, R ) BOOST_TEST_CHECK( L < R ) -#define BOOST_REQUIRE_LT( L, R ) BOOST_TEST_REQUIRE( L < R ) - -#define BOOST_WARN_LE( L, R ) BOOST_TEST_WARN( L <= R ) -#define BOOST_CHECK_LE( L, R ) BOOST_TEST_CHECK( L <= R ) -#define BOOST_REQUIRE_LE( L, R ) BOOST_TEST_REQUIRE( L <= R ) - -#define BOOST_WARN_GT( L, R ) BOOST_TEST_WARN( L > R ) -#define BOOST_CHECK_GT( L, R ) BOOST_TEST_CHECK( L > R ) -#define BOOST_REQUIRE_GT( L, R ) BOOST_TEST_REQUIRE( L > R ) - -#define BOOST_WARN_GE( L, R ) BOOST_TEST_WARN( L >= R ) -#define BOOST_CHECK_GE( L, R ) BOOST_TEST_CHECK( L >= R ) -#define BOOST_REQUIRE_GE( L, R ) BOOST_TEST_REQUIRE( L >= R ) - -//____________________________________________________________________________// - -#define BOOST_WARN_CLOSE( L, R, T ) BOOST_TEST_WARN( L == R, T % ::boost::test_tools::tolerance() ) -#define BOOST_CHECK_CLOSE( L, R, T ) BOOST_TEST_CHECK( L == R, T % ::boost::test_tools::tolerance() ) -#define BOOST_REQUIRE_CLOSE( L, R, T ) BOOST_TEST_REQUIRE( L == R, T % ::boost::test_tools::tolerance() ) - -#define BOOST_WARN_CLOSE_FRACTION(L, R, T) BOOST_TEST_WARN( L == R, ::boost::test_tools::tolerance( T ) ) -#define BOOST_CHECK_CLOSE_FRACTION(L, R, T) BOOST_TEST_CHECK( L == R, ::boost::test_tools::tolerance( T ) ) -#define BOOST_REQUIRE_CLOSE_FRACTION(L,R,T) BOOST_TEST_REQUIRE( L == R, ::boost::test_tools::tolerance( T ) ) - -#define BOOST_WARN_SMALL( FPV, T ) BOOST_TEST_WARN( FPV == 0., ::boost::test_tools::tolerance( T ) ) -#define BOOST_CHECK_SMALL( FPV, T ) BOOST_TEST_CHECK( FPV == 0., ::boost::test_tools::tolerance( T ) ) -#define BOOST_REQUIRE_SMALL( FPV, T ) BOOST_TEST_REQUIRE( FPV == 0., ::boost::test_tools::tolerance( T ) ) - -//____________________________________________________________________________// - -#define BOOST_WARN_EQUAL_COLLECTIONS( L_begin, L_end, R_begin, R_end ) \ - BOOST_TEST_WARN( ::boost::test_tools::tt_detail::make_it_pair(L_begin, L_end) ==\ - ::boost::test_tools::tt_detail::make_it_pair(R_begin, R_end), \ - ::boost::test_tools::per_element() ) \ -/**/ - -#define BOOST_CHECK_EQUAL_COLLECTIONS( L_begin, L_end, R_begin, R_end ) \ - BOOST_TEST_CHECK( ::boost::test_tools::tt_detail::make_it_pair(L_begin, L_end) ==\ - ::boost::test_tools::tt_detail::make_it_pair(R_begin, R_end), \ - ::boost::test_tools::per_element() ) \ -/**/ - -#define BOOST_REQUIRE_EQUAL_COLLECTIONS( L_begin, L_end, R_begin, R_end ) \ - BOOST_TEST_REQUIRE( ::boost::test_tools::tt_detail::make_it_pair(L_begin, L_end) ==\ - ::boost::test_tools::tt_detail::make_it_pair(R_begin, R_end), \ - ::boost::test_tools::per_element() ) \ -/**/ - -//____________________________________________________________________________// - -#define BOOST_WARN_BITWISE_EQUAL( L, R ) BOOST_TEST_WARN( L == R, ::boost::test_tools::bitwise() ) -#define BOOST_CHECK_BITWISE_EQUAL( L, R ) BOOST_TEST_CHECK( L == R, ::boost::test_tools::bitwise() ) -#define BOOST_REQUIRE_BITWISE_EQUAL( L, R ) BOOST_TEST_REQUIRE( L == R, ::boost::test_tools::bitwise() ) - -//____________________________________________________________________________// - -#define BOOST_WARN_PREDICATE( P, ARGS ) BOOST_TEST_WARN( P BOOST_PP_SEQ_TO_TUPLE(ARGS) ) -#define BOOST_CHECK_PREDICATE( P, ARGS ) BOOST_TEST_CHECK( P BOOST_PP_SEQ_TO_TUPLE(ARGS) ) -#define BOOST_REQUIRE_PREDICATE( P, ARGS ) BOOST_TEST_REQUIRE( P BOOST_PP_SEQ_TO_TUPLE(ARGS) ) - -//____________________________________________________________________________// - -#define BOOST_IS_DEFINED( symb ) ::boost::test_tools::tt_detail::is_defined_impl( #symb, BOOST_STRINGIZE(= symb) ) - -//____________________________________________________________________________// - -#endif // BOOST_TEST_NO_OLD_TOOLS - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_TOOLS_INTERFACE_HPP_111712GER diff --git a/contrib/restricted/boost/test/include/boost/test/tools/old/impl.hpp b/contrib/restricted/boost/test/include/boost/test/tools/old/impl.hpp deleted file mode 100644 index 0b8f888cbe..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/tools/old/impl.hpp +++ /dev/null @@ -1,358 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision: 74248 $ -// -// Description : implementation details for old toolbox -// *************************************************************************** - -#ifndef BOOST_TEST_TOOLS_OLD_IMPL_HPP_012705GER -#define BOOST_TEST_TOOLS_OLD_IMPL_HPP_012705GER - -// Boost.Test -#include <boost/test/unit_test_log.hpp> -#include <boost/test/tools/assertion_result.hpp> -#include <boost/test/tools/floating_point_comparison.hpp> - -#include <boost/test/tools/detail/fwd.hpp> -#include <boost/test/tools/detail/print_helper.hpp> - -// Boost -#include <boost/limits.hpp> -#include <boost/numeric/conversion/conversion_traits.hpp> // for numeric::conversion_traits -#include <boost/type_traits/is_array.hpp> - -#include <boost/preprocessor/repetition/repeat.hpp> -#include <boost/preprocessor/arithmetic/add.hpp> - -// STL -#include <cstddef> // for std::size_t -#include <climits> // for CHAR_BIT - -#include <boost/test/detail/suppress_warnings.hpp> - -//____________________________________________________________________________// - -namespace boost { -namespace test_tools { -namespace tt_detail { - -// ************************************************************************** // -// ************** old TOOLBOX Implementation ************** // -// ************************************************************************** // - -// This function adds level of indirection, but it makes sure we evaluate predicate -// arguments only once - -#ifndef BOOST_TEST_PROD -#define TEMPL_PARAMS( z, m, dummy ) , typename BOOST_JOIN( Arg, m ) - -#define FUNC_PARAMS( z, m, dummy ) \ - , BOOST_JOIN( Arg, m ) const& BOOST_JOIN( arg, m ) \ - , char const* BOOST_JOIN( BOOST_JOIN( arg, m ), _descr ) \ -/**/ - -#define PRED_PARAMS( z, m, dummy ) BOOST_PP_COMMA_IF( m ) BOOST_JOIN( arg, m ) - -#define ARG_INFO( z, m, dummy ) \ - , BOOST_JOIN( BOOST_JOIN( arg, m ), _descr ) \ - , &static_cast<const unit_test::lazy_ostream&>(unit_test::lazy_ostream::instance() \ - << ::boost::test_tools::tt_detail::print_helper( BOOST_JOIN( arg, m ) )) \ -/**/ - -#define IMPL_FRWD( z, n, dummy ) \ -template<typename Pred \ - BOOST_PP_REPEAT_ ## z( BOOST_PP_ADD( n, 1 ), TEMPL_PARAMS, _ )> \ -inline bool \ -check_frwd( Pred P, unit_test::lazy_ostream const& assertion_descr, \ - const_string file_name, std::size_t line_num, \ - tool_level tl, check_type ct \ - BOOST_PP_REPEAT_ ## z( BOOST_PP_ADD( n, 1 ), FUNC_PARAMS, _ ) \ -) \ -{ \ - return \ - report_assertion( P( BOOST_PP_REPEAT_ ## z(BOOST_PP_ADD(n, 1), PRED_PARAMS,_) ),\ - assertion_descr, file_name, line_num, tl, ct, \ - BOOST_PP_ADD( n, 1 ) \ - BOOST_PP_REPEAT_ ## z( BOOST_PP_ADD( n, 1 ), ARG_INFO, _ ) \ - ); \ -} \ -/**/ - -#ifndef BOOST_TEST_MAX_PREDICATE_ARITY -#define BOOST_TEST_MAX_PREDICATE_ARITY 5 -#endif - -BOOST_PP_REPEAT( BOOST_TEST_MAX_PREDICATE_ARITY, IMPL_FRWD, _ ) - -#undef TEMPL_PARAMS -#undef FUNC_PARAMS -#undef PRED_INFO -#undef ARG_INFO -#undef IMPL_FRWD - -#endif - -//____________________________________________________________________________// - -template <class Left, class Right> -inline assertion_result equal_impl( Left const& left, Right const& right ) -{ - return left == right; -} - -//____________________________________________________________________________// - -inline assertion_result equal_impl( char* left, char const* right ) { return equal_impl( static_cast<char const*>(left), static_cast<char const*>(right) ); } -inline assertion_result equal_impl( char const* left, char* right ) { return equal_impl( static_cast<char const*>(left), static_cast<char const*>(right) ); } -inline assertion_result equal_impl( char* left, char* right ) { return equal_impl( static_cast<char const*>(left), static_cast<char const*>(right) ); } - -#if !defined( BOOST_NO_CWCHAR ) -BOOST_TEST_DECL assertion_result equal_impl( wchar_t const* left, wchar_t const* right ); -inline assertion_result equal_impl( wchar_t* left, wchar_t const* right ) { return equal_impl( static_cast<wchar_t const*>(left), static_cast<wchar_t const*>(right) ); } -inline assertion_result equal_impl( wchar_t const* left, wchar_t* right ) { return equal_impl( static_cast<wchar_t const*>(left), static_cast<wchar_t const*>(right) ); } -inline assertion_result equal_impl( wchar_t* left, wchar_t* right ) { return equal_impl( static_cast<wchar_t const*>(left), static_cast<wchar_t const*>(right) ); } -#endif - -//____________________________________________________________________________// - -struct equal_impl_frwd { - template <typename Left, typename Right> - inline assertion_result - call_impl( Left const& left, Right const& right, mpl::false_ ) const - { - return equal_impl( left, right ); - } - - template <typename Left, typename Right> - inline assertion_result - call_impl( Left const& left, Right const& right, mpl::true_ ) const - { - return (*this)( right, &left[0] ); - } - - template <typename Left, typename Right> - inline assertion_result - operator()( Left const& left, Right const& right ) const - { - typedef typename is_array<Left>::type left_is_array; - return call_impl( left, right, left_is_array() ); - } -}; - -//____________________________________________________________________________// - -struct ne_impl { - template <class Left, class Right> - assertion_result operator()( Left const& left, Right const& right ) - { - return !equal_impl_frwd()( left, right ); - } -}; - -//____________________________________________________________________________// - -struct lt_impl { - template <class Left, class Right> - assertion_result operator()( Left const& left, Right const& right ) - { - return left < right; - } -}; - -//____________________________________________________________________________// - -struct le_impl { - template <class Left, class Right> - assertion_result operator()( Left const& left, Right const& right ) - { - return left <= right; - } -}; - -//____________________________________________________________________________// - -struct gt_impl { - template <class Left, class Right> - assertion_result operator()( Left const& left, Right const& right ) - { - return left > right; - } -}; - -//____________________________________________________________________________// - -struct ge_impl { - template <class Left, class Right> - assertion_result operator()( Left const& left, Right const& right ) - { - return left >= right; - } -}; - -//____________________________________________________________________________// - -struct equal_coll_impl { - template <typename Left, typename Right> - assertion_result operator()( Left left_begin, Left left_end, Right right_begin, Right right_end ) - { - assertion_result pr( true ); - std::size_t pos = 0; - - for( ; left_begin != left_end && right_begin != right_end; ++left_begin, ++right_begin, ++pos ) { - if( *left_begin != *right_begin ) { - pr = false; - pr.message() << "\nMismatch at position " << pos << ": " - << ::boost::test_tools::tt_detail::print_helper(*left_begin) - << " != " - << ::boost::test_tools::tt_detail::print_helper(*right_begin); - } - } - - if( left_begin != left_end ) { - std::size_t r_size = pos; - while( left_begin != left_end ) { - ++pos; - ++left_begin; - } - - pr = false; - pr.message() << "\nCollections size mismatch: " << pos << " != " << r_size; - } - - if( right_begin != right_end ) { - std::size_t l_size = pos; - while( right_begin != right_end ) { - ++pos; - ++right_begin; - } - - pr = false; - pr.message() << "\nCollections size mismatch: " << l_size << " != " << pos; - } - - return pr; - } -}; - -//____________________________________________________________________________// - -struct bitwise_equal_impl { - template <class Left, class Right> - assertion_result operator()( Left const& left, Right const& right ) - { - assertion_result pr( true ); - - std::size_t left_bit_size = sizeof(Left)*CHAR_BIT; - std::size_t right_bit_size = sizeof(Right)*CHAR_BIT; - - static Left const leftOne( 1 ); - static Right const rightOne( 1 ); - - std::size_t total_bits = left_bit_size < right_bit_size ? left_bit_size : right_bit_size; - - for( std::size_t counter = 0; counter < total_bits; ++counter ) { - if( ( left & ( leftOne << counter ) ) != ( right & ( rightOne << counter ) ) ) { - pr = false; - pr.message() << "\nMismatch at position " << counter; - } - } - - if( left_bit_size != right_bit_size ) { - pr = false; - pr.message() << "\nOperands bit sizes mismatch: " << left_bit_size << " != " << right_bit_size; - } - - return pr; - } -}; - -//____________________________________________________________________________// - -template<typename FPT1, typename FPT2> -struct comp_supertype { - // deduce "better" type from types of arguments being compared - // if one type is floating and the second integral we use floating type and - // value of integral type is promoted to the floating. The same for float and double - // But we don't want to compare two values of integral types using this tool. - typedef typename numeric::conversion_traits<FPT1,FPT2>::supertype type; - BOOST_STATIC_ASSERT_MSG( !is_integral<type>::value, "Only floating-point types can be compared!"); -}; - -} // namespace tt_detail - -namespace fpc = math::fpc; - -// ************************************************************************** // -// ************** check_is_close ************** // -// ************************************************************************** // - -struct BOOST_TEST_DECL check_is_close_t { - // Public typedefs - typedef assertion_result result_type; - - template<typename FPT1, typename FPT2, typename ToleranceType> - assertion_result - operator()( FPT1 left, FPT2 right, ToleranceType tolerance ) const - { - fpc::close_at_tolerance<typename tt_detail::comp_supertype<FPT1,FPT2>::type> pred( tolerance, fpc::FPC_STRONG ); - - assertion_result ar( pred( left, right ) ); - - if( !ar ) - ar.message() << pred.tested_rel_diff(); - - return ar; - } -}; - -//____________________________________________________________________________// - -template<typename FPT1, typename FPT2, typename ToleranceType> -inline assertion_result -check_is_close( FPT1 left, FPT2 right, ToleranceType tolerance ) -{ - return check_is_close_t()( left, right, tolerance ); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** check_is_small ************** // -// ************************************************************************** // - -struct BOOST_TEST_DECL check_is_small_t { - // Public typedefs - typedef bool result_type; - - template<typename FPT> - bool - operator()( FPT fpv, FPT tolerance ) const - { - return fpc::is_small( fpv, tolerance ); - } -}; - -//____________________________________________________________________________// - -template<typename FPT> -inline bool -check_is_small( FPT fpv, FPT tolerance ) -{ - return fpc::is_small( fpv, tolerance ); -} - -//____________________________________________________________________________// - -} // namespace test_tools -} // namespace boost - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_TOOLS_OLD_IMPL_HPP_012705GER diff --git a/contrib/restricted/boost/test/include/boost/test/tools/old/interface.hpp b/contrib/restricted/boost/test/include/boost/test/tools/old/interface.hpp deleted file mode 100644 index 1b23c291a3..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/tools/old/interface.hpp +++ /dev/null @@ -1,284 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision: 81247 $ -// -// Description : contains definition for all test tools in old test toolbox -// *************************************************************************** - -#ifndef BOOST_TEST_TOOLS_OLD_INTERFACE_HPP_111712GER -#define BOOST_TEST_TOOLS_OLD_INTERFACE_HPP_111712GER - -// Boost -#include <boost/preprocessor/seq/for_each.hpp> -#include <boost/preprocessor/seq/size.hpp> -#include <boost/preprocessor/seq/to_tuple.hpp> - -#include <boost/core/ignore_unused.hpp> - -#include <boost/test/detail/suppress_warnings.hpp> - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** TOOL BOX ************** // -// ************************************************************************** // - -// In macros below following argument abbreviations are used: -// P - predicate -// M - message -// S - statement -// E - exception -// L - left argument -// R - right argument -// TL - tool level -// CT - check type -// ARGS - arguments list (as PP sequence) - -// frwd_type: -// 0 - args exists and need to be forwarded; call check_frwd -// 1 - args exists, but do not need to be forwarded; call report_assertion directly -// 2 - no arguments; call report_assertion directly - -#define BOOST_TEST_TOOL_PASS_PRED0( P, ARGS ) P -#define BOOST_TEST_TOOL_PASS_PRED1( P, ARGS ) P BOOST_PP_SEQ_TO_TUPLE(ARGS) -#define BOOST_TEST_TOOL_PASS_PRED2( P, ARGS ) P - -#define BOOST_TEST_TOOL_PASS_ARG( r, _, arg ) , arg, BOOST_STRINGIZE( arg ) -#define BOOST_TEST_TOOL_PASS_ARG_DSCR( r, _, arg ) , BOOST_STRINGIZE( arg ) - -#define BOOST_TEST_TOOL_PASS_ARGS0( ARGS ) \ - BOOST_PP_SEQ_FOR_EACH( BOOST_TEST_TOOL_PASS_ARG, _, ARGS ) -#define BOOST_TEST_TOOL_PASS_ARGS1( ARGS ) \ - , BOOST_PP_SEQ_SIZE(ARGS) BOOST_PP_SEQ_FOR_EACH( BOOST_TEST_TOOL_PASS_ARG_DSCR, _, ARGS ) -#define BOOST_TEST_TOOL_PASS_ARGS2( ARGS ) \ - , 0 - -#define BOOST_TEST_TOOL_IMPL( frwd_type, P, assertion_descr, TL, CT, ARGS ) \ -do { \ - BOOST_TEST_PASSPOINT(); \ - ::boost::test_tools::tt_detail:: \ - BOOST_PP_IF( frwd_type, report_assertion, check_frwd ) ( \ - BOOST_JOIN( BOOST_TEST_TOOL_PASS_PRED, frwd_type )( P, ARGS ), \ - BOOST_TEST_LAZY_MSG( assertion_descr ), \ - BOOST_TEST_L(__FILE__), \ - static_cast<std::size_t>(__LINE__), \ - ::boost::test_tools::tt_detail::TL, \ - ::boost::test_tools::tt_detail::CT \ - BOOST_JOIN( BOOST_TEST_TOOL_PASS_ARGS, frwd_type )( ARGS ) ); \ -} while( ::boost::test_tools::tt_detail::dummy_cond() ) \ -/**/ - -//____________________________________________________________________________// - -#define BOOST_WARN( P ) BOOST_TEST_TOOL_IMPL( 2, \ - (P), BOOST_TEST_STRINGIZE( P ), WARN, CHECK_PRED, _ ) -#define BOOST_CHECK( P ) BOOST_TEST_TOOL_IMPL( 2, \ - (P), BOOST_TEST_STRINGIZE( P ), CHECK, CHECK_PRED, _ ) -#define BOOST_REQUIRE( P ) BOOST_TEST_TOOL_IMPL( 2, \ - (P), BOOST_TEST_STRINGIZE( P ), REQUIRE, CHECK_PRED, _ ) - -//____________________________________________________________________________// - -#define BOOST_WARN_MESSAGE( P, M ) BOOST_TEST_TOOL_IMPL( 2, (P), M, WARN, CHECK_MSG, _ ) -#define BOOST_CHECK_MESSAGE( P, M ) BOOST_TEST_TOOL_IMPL( 2, (P), M, CHECK, CHECK_MSG, _ ) -#define BOOST_REQUIRE_MESSAGE( P, M ) BOOST_TEST_TOOL_IMPL( 2, (P), M, REQUIRE, CHECK_MSG, _ ) - -//____________________________________________________________________________// - -#define BOOST_ERROR( M ) BOOST_CHECK_MESSAGE( false, M ) -#define BOOST_FAIL( M ) BOOST_REQUIRE_MESSAGE( false, M ) - -//____________________________________________________________________________// - -#define BOOST_CHECK_THROW_IMPL( S, E, P, postfix, TL ) \ -do { \ - try { \ - BOOST_TEST_PASSPOINT(); \ - S; \ - BOOST_TEST_TOOL_IMPL( 2, false, "exception " BOOST_STRINGIZE(E) " expected but not raised", \ - TL, CHECK_MSG, _ ); \ - } catch( E const& ex ) { \ - boost::ignore_unused( ex ); \ - BOOST_TEST_TOOL_IMPL( 2, P, \ - "exception \"" BOOST_STRINGIZE( E )"\" raised as expected" postfix, \ - TL, CHECK_MSG, _ ); \ - } \ -} while( ::boost::test_tools::tt_detail::dummy_cond() ) \ -/**/ - -//____________________________________________________________________________// - -#define BOOST_WARN_THROW( S, E ) BOOST_CHECK_THROW_IMPL( S, E, true, "", WARN ) -#define BOOST_CHECK_THROW( S, E ) BOOST_CHECK_THROW_IMPL( S, E, true, "", CHECK ) -#define BOOST_REQUIRE_THROW( S, E ) BOOST_CHECK_THROW_IMPL( S, E, true, "", REQUIRE ) - -//____________________________________________________________________________// - -#define BOOST_WARN_EXCEPTION( S, E, P ) BOOST_CHECK_THROW_IMPL( S, E, P( ex ), \ - ": validation on the raised exception through predicate \"" BOOST_STRINGIZE(P) "\"", WARN ) -#define BOOST_CHECK_EXCEPTION( S, E, P ) BOOST_CHECK_THROW_IMPL( S, E, P( ex ), \ - ": validation on the raised exception through predicate \"" BOOST_STRINGIZE(P) "\"", CHECK ) -#define BOOST_REQUIRE_EXCEPTION( S, E, P ) BOOST_CHECK_THROW_IMPL( S, E, P( ex ), \ - ": validation on the raised exception through predicate \"" BOOST_STRINGIZE(P) "\"", REQUIRE ) - -//____________________________________________________________________________// - -#define BOOST_CHECK_NO_THROW_IMPL( S, TL ) \ -do { \ - try { \ - S; \ - BOOST_TEST_TOOL_IMPL( 2, true, "no exceptions thrown by " BOOST_STRINGIZE( S ), \ - TL, CHECK_MSG, _ ); \ - } catch( ... ) { \ - BOOST_TEST_TOOL_IMPL( 2, false, "unexpected exception thrown by " BOOST_STRINGIZE( S ), \ - TL, CHECK_MSG, _ ); \ - } \ -} while( ::boost::test_tools::tt_detail::dummy_cond() ) \ -/**/ - -#define BOOST_WARN_NO_THROW( S ) BOOST_CHECK_NO_THROW_IMPL( S, WARN ) -#define BOOST_CHECK_NO_THROW( S ) BOOST_CHECK_NO_THROW_IMPL( S, CHECK ) -#define BOOST_REQUIRE_NO_THROW( S ) BOOST_CHECK_NO_THROW_IMPL( S, REQUIRE ) - -//____________________________________________________________________________// - -#define BOOST_WARN_EQUAL( L, R ) BOOST_TEST_TOOL_IMPL( 0, \ - ::boost::test_tools::tt_detail::equal_impl_frwd(), "", WARN, CHECK_EQUAL, (L)(R) ) -#define BOOST_CHECK_EQUAL( L, R ) BOOST_TEST_TOOL_IMPL( 0, \ - ::boost::test_tools::tt_detail::equal_impl_frwd(), "", CHECK, CHECK_EQUAL, (L)(R) ) -#define BOOST_REQUIRE_EQUAL( L, R ) BOOST_TEST_TOOL_IMPL( 0, \ - ::boost::test_tools::tt_detail::equal_impl_frwd(), "", REQUIRE, CHECK_EQUAL, (L)(R) ) - -//____________________________________________________________________________// - -#define BOOST_WARN_NE( L, R ) BOOST_TEST_TOOL_IMPL( 0, \ - ::boost::test_tools::tt_detail::ne_impl(), "", WARN, CHECK_NE, (L)(R) ) -#define BOOST_CHECK_NE( L, R ) BOOST_TEST_TOOL_IMPL( 0, \ - ::boost::test_tools::tt_detail::ne_impl(), "", CHECK, CHECK_NE, (L)(R) ) -#define BOOST_REQUIRE_NE( L, R ) BOOST_TEST_TOOL_IMPL( 0, \ - ::boost::test_tools::tt_detail::ne_impl(), "", REQUIRE, CHECK_NE, (L)(R) ) - -//____________________________________________________________________________// - -#define BOOST_WARN_LT( L, R ) BOOST_TEST_TOOL_IMPL( 0, \ - ::boost::test_tools::tt_detail::lt_impl(), "", WARN, CHECK_LT, (L)(R) ) -#define BOOST_CHECK_LT( L, R ) BOOST_TEST_TOOL_IMPL( 0, \ - ::boost::test_tools::tt_detail::lt_impl(), "", CHECK, CHECK_LT, (L)(R) ) -#define BOOST_REQUIRE_LT( L, R ) BOOST_TEST_TOOL_IMPL( 0, \ - ::boost::test_tools::tt_detail::lt_impl(), "", REQUIRE, CHECK_LT, (L)(R) ) - -//____________________________________________________________________________// - -#define BOOST_WARN_LE( L, R ) BOOST_TEST_TOOL_IMPL( 0, \ - ::boost::test_tools::tt_detail::le_impl(), "", WARN, CHECK_LE, (L)(R) ) -#define BOOST_CHECK_LE( L, R ) BOOST_TEST_TOOL_IMPL( 0, \ - ::boost::test_tools::tt_detail::le_impl(), "", CHECK, CHECK_LE, (L)(R) ) -#define BOOST_REQUIRE_LE( L, R ) BOOST_TEST_TOOL_IMPL( 0, \ - ::boost::test_tools::tt_detail::le_impl(), "", REQUIRE, CHECK_LE, (L)(R) ) - -//____________________________________________________________________________// - -#define BOOST_WARN_GT( L, R ) BOOST_TEST_TOOL_IMPL( 0, \ - ::boost::test_tools::tt_detail::gt_impl(), "", WARN, CHECK_GT, (L)(R) ) -#define BOOST_CHECK_GT( L, R ) BOOST_TEST_TOOL_IMPL( 0, \ - ::boost::test_tools::tt_detail::gt_impl(), "", CHECK, CHECK_GT, (L)(R) ) -#define BOOST_REQUIRE_GT( L, R ) BOOST_TEST_TOOL_IMPL( 0, \ - ::boost::test_tools::tt_detail::gt_impl(), "", REQUIRE, CHECK_GT, (L)(R) ) - -//____________________________________________________________________________// - -#define BOOST_WARN_GE( L, R ) BOOST_TEST_TOOL_IMPL( 0, \ - ::boost::test_tools::tt_detail::ge_impl(), "", WARN, CHECK_GE, (L)(R) ) -#define BOOST_CHECK_GE( L, R ) BOOST_TEST_TOOL_IMPL( 0, \ - ::boost::test_tools::tt_detail::ge_impl(), "", CHECK, CHECK_GE, (L)(R) ) -#define BOOST_REQUIRE_GE( L, R ) BOOST_TEST_TOOL_IMPL( 0, \ - ::boost::test_tools::tt_detail::ge_impl(), "", REQUIRE, CHECK_GE, (L)(R) ) - -//____________________________________________________________________________// - -#define BOOST_WARN_CLOSE( L, R, T ) BOOST_TEST_TOOL_IMPL( 0, \ - ::boost::test_tools::check_is_close_t(), "", WARN, CHECK_CLOSE, (L)(R)(::boost::math::fpc::percent_tolerance(T)) ) -#define BOOST_CHECK_CLOSE( L, R, T ) BOOST_TEST_TOOL_IMPL( 0, \ - ::boost::test_tools::check_is_close_t(), "", CHECK, CHECK_CLOSE, (L)(R)(::boost::math::fpc::percent_tolerance(T)) ) -#define BOOST_REQUIRE_CLOSE( L, R, T ) BOOST_TEST_TOOL_IMPL( 0, \ - ::boost::test_tools::check_is_close_t(), "", REQUIRE, CHECK_CLOSE, (L)(R)(::boost::math::fpc::percent_tolerance(T)) ) - -//____________________________________________________________________________// - -#define BOOST_WARN_CLOSE_FRACTION(L, R, T) BOOST_TEST_TOOL_IMPL( 0, \ - ::boost::test_tools::check_is_close_t(), "", WARN, CHECK_CLOSE_FRACTION, (L)(R)(T) ) -#define BOOST_CHECK_CLOSE_FRACTION(L, R, T) BOOST_TEST_TOOL_IMPL( 0, \ - ::boost::test_tools::check_is_close_t(), "", CHECK, CHECK_CLOSE_FRACTION, (L)(R)(T) ) -#define BOOST_REQUIRE_CLOSE_FRACTION(L,R,T) BOOST_TEST_TOOL_IMPL( 0, \ - ::boost::test_tools::check_is_close_t(), "", REQUIRE, CHECK_CLOSE_FRACTION, (L)(R)(T) ) - -//____________________________________________________________________________// - -#define BOOST_WARN_SMALL( FPV, T ) BOOST_TEST_TOOL_IMPL( 0, \ - ::boost::test_tools::check_is_small_t(), "", WARN, CHECK_SMALL, (FPV)(T) ) -#define BOOST_CHECK_SMALL( FPV, T ) BOOST_TEST_TOOL_IMPL( 0, \ - ::boost::test_tools::check_is_small_t(), "", CHECK, CHECK_SMALL, (FPV)(T) ) -#define BOOST_REQUIRE_SMALL( FPV, T ) BOOST_TEST_TOOL_IMPL( 0, \ - ::boost::test_tools::check_is_small_t(), "", REQUIRE, CHECK_SMALL, (FPV)(T) ) - -//____________________________________________________________________________// - -#define BOOST_WARN_PREDICATE( P, ARGS ) BOOST_TEST_TOOL_IMPL( 0, \ - P, BOOST_TEST_STRINGIZE( P ), WARN, CHECK_PRED_WITH_ARGS, ARGS ) -#define BOOST_CHECK_PREDICATE( P, ARGS ) BOOST_TEST_TOOL_IMPL( 0, \ - P, BOOST_TEST_STRINGIZE( P ), CHECK, CHECK_PRED_WITH_ARGS, ARGS ) -#define BOOST_REQUIRE_PREDICATE( P, ARGS ) BOOST_TEST_TOOL_IMPL( 0, \ - P, BOOST_TEST_STRINGIZE( P ), REQUIRE, CHECK_PRED_WITH_ARGS, ARGS ) - -//____________________________________________________________________________// - -#define BOOST_WARN_EQUAL_COLLECTIONS( L_begin, L_end, R_begin, R_end ) \ - BOOST_TEST_TOOL_IMPL( 1, ::boost::test_tools::tt_detail::equal_coll_impl(), \ - "", WARN, CHECK_EQUAL_COLL, (L_begin)(L_end)(R_begin)(R_end) ) \ -/**/ -#define BOOST_CHECK_EQUAL_COLLECTIONS( L_begin, L_end, R_begin, R_end ) \ - BOOST_TEST_TOOL_IMPL( 1, ::boost::test_tools::tt_detail::equal_coll_impl(), \ - "", CHECK, CHECK_EQUAL_COLL, (L_begin)(L_end)(R_begin)(R_end) ) \ -/**/ -#define BOOST_REQUIRE_EQUAL_COLLECTIONS( L_begin, L_end, R_begin, R_end ) \ - BOOST_TEST_TOOL_IMPL( 1, ::boost::test_tools::tt_detail::equal_coll_impl(), \ - "", REQUIRE, CHECK_EQUAL_COLL, (L_begin)(L_end)(R_begin)(R_end) ) \ -/**/ - -//____________________________________________________________________________// - -#define BOOST_WARN_BITWISE_EQUAL( L, R ) BOOST_TEST_TOOL_IMPL( 1, \ - ::boost::test_tools::tt_detail::bitwise_equal_impl(), "", WARN, CHECK_BITWISE_EQUAL, (L)(R) ) -#define BOOST_CHECK_BITWISE_EQUAL( L, R ) BOOST_TEST_TOOL_IMPL( 1, \ - ::boost::test_tools::tt_detail::bitwise_equal_impl(), "", CHECK, CHECK_BITWISE_EQUAL, (L)(R) ) -#define BOOST_REQUIRE_BITWISE_EQUAL( L, R ) BOOST_TEST_TOOL_IMPL( 1, \ - ::boost::test_tools::tt_detail::bitwise_equal_impl(), "", REQUIRE, CHECK_BITWISE_EQUAL, (L)(R) ) - -//____________________________________________________________________________// - -#define BOOST_IS_DEFINED( symb ) ::boost::test_tools::tt_detail::is_defined_impl( #symb, BOOST_STRINGIZE(= symb) ) - -//____________________________________________________________________________// - -#ifdef BOOST_TEST_NO_NEW_TOOLS - -#define BOOST_TEST_WARN( P ) BOOST_WARN( P ) -#define BOOST_TEST_CHECK( P ) BOOST_CHECK( P ) -#define BOOST_TEST_REQUIRE( P ) BOOST_REQUIRE( P ) - -#define BOOST_TEST( P ) BOOST_CHECK( P ) - -#endif - -//____________________________________________________________________________// - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_TOOLS_OLD_INTERFACE_HPP_111712GER diff --git a/contrib/restricted/boost/test/include/boost/test/tools/output_test_stream.hpp b/contrib/restricted/boost/test/include/boost/test/tools/output_test_stream.hpp deleted file mode 100644 index a6f71a8f55..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/tools/output_test_stream.hpp +++ /dev/null @@ -1,107 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -/// @file -/// @brief output_test_stream class definition -// *************************************************************************** - -#ifndef BOOST_TEST_OUTPUT_TEST_STREAM_HPP_012705GER -#define BOOST_TEST_OUTPUT_TEST_STREAM_HPP_012705GER - -// Boost.Test -#include <boost/test/detail/global_typedef.hpp> -#include <boost/test/utils/wrap_stringstream.hpp> -#include <boost/test/tools/assertion_result.hpp> - -// STL -#include <cstddef> // for std::size_t - -#include <boost/test/detail/suppress_warnings.hpp> - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** output_test_stream ************** // -// ************************************************************************** // - - - -namespace boost { -namespace test_tools { - -//! Class to be used to simplify testing of ostream-based output operations -class BOOST_TEST_DECL output_test_stream : public wrap_stringstream::wrapped_stream { - typedef unit_test::const_string const_string; -public: - //! Constructor - //! - //!@param[in] pattern_file_name indicates the name of the file for matching. If the - //! string is empty, the standard input or output streams are used instead - //! (depending on match_or_save) - //!@param[in] match_or_save if true, the pattern file will be read, otherwise it will be - //! written - //!@param[in] text_or_binary if false, opens the stream in binary mode. Otherwise the stream - //! is opened with default flags and the carriage returns are ignored. - explicit output_test_stream( const_string pattern_file_name = const_string(), - bool match_or_save = true, - bool text_or_binary = true ); - - // Destructor - ~output_test_stream() BOOST_OVERRIDE; - - //! Checks if the stream is empty - //! - //!@param[in] flush_stream if true, flushes the stream after the call - virtual assertion_result is_empty( bool flush_stream = true ); - - //! Checks the length of the stream - //! - //!@param[in] length target length - //!@param[in] flush_stream if true, flushes the stream after the call. Set to false to call - //! additional checks on the same content. - virtual assertion_result check_length( std::size_t length, bool flush_stream = true ); - - //! Checks the content of the stream against a string - //! - //!@param[in] arg_ the target stream - //!@param[in] flush_stream if true, flushes the stream after the call. - virtual assertion_result is_equal( const_string arg_, bool flush_stream = true ); - - //! Checks the content of the stream against a pattern file - //! - //!@param[in] flush_stream if true, flushes/resets the stream after the call. - virtual assertion_result match_pattern( bool flush_stream = true ); - - //! Flushes the stream - void flush(); - -protected: - - //! Returns the string representation of the stream - //! - //! May be overriden in order to mutate the string before the matching operations. - virtual std::string get_stream_string_representation() const; - -private: - // helper functions - - //! Length of the stream - std::size_t length(); - - //! Synching the stream into an internal string representation - virtual void sync(); - - struct Impl; - Impl* m_pimpl; -}; - -} // namespace test_tools -} // namespace boost - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_OUTPUT_TEST_STREAM_HPP_012705GER diff --git a/contrib/restricted/boost/test/include/boost/test/tree/auto_registration.hpp b/contrib/restricted/boost/test/include/boost/test/tree/auto_registration.hpp deleted file mode 100644 index e9510be292..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/tree/auto_registration.hpp +++ /dev/null @@ -1,54 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision: 74640 $ -// -// Description : defines auto_test_unit_registrar -// *************************************************************************** - -#ifndef BOOST_TEST_TREE_AUTO_REGISTRATION_HPP_100211GER -#define BOOST_TEST_TREE_AUTO_REGISTRATION_HPP_100211GER - -// Boost.Test -#include <boost/test/detail/config.hpp> -#include <boost/test/tree/decorator.hpp> -#include <boost/test/tree/test_unit.hpp> - -// STL -#include <list> - -#include <boost/test/detail/suppress_warnings.hpp> - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { -namespace ut_detail { - -// ************************************************************************** // -// ************** auto_test_unit_registrar ************** // -// ************************************************************************** // - -struct BOOST_TEST_DECL auto_test_unit_registrar { - // Constructors - auto_test_unit_registrar( test_case* tc, decorator::collector_t& decorators, counter_t exp_fail = 0 ); - explicit auto_test_unit_registrar( const_string ts_name, const_string ts_file, std::size_t ts_line, decorator::collector_t& decorators ); - explicit auto_test_unit_registrar( test_unit_generator const& tc_gen, decorator::collector_t& decorators ); - explicit auto_test_unit_registrar( boost::shared_ptr<test_unit_generator> tc_gen, decorator::collector_t& decorators ); - explicit auto_test_unit_registrar( int ); -}; - -} // namespace ut_detail -} // namespace unit_test -} // namespace boost - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_TREE_AUTO_REGISTRATION_HPP_100211GER - diff --git a/contrib/restricted/boost/test/include/boost/test/tree/decorator.hpp b/contrib/restricted/boost/test/include/boost/test/tree/decorator.hpp deleted file mode 100644 index 7381593c7a..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/tree/decorator.hpp +++ /dev/null @@ -1,309 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision: 62016 $ -// -// Description : defines decorators to be using with auto registered test units -// *************************************************************************** - -#ifndef BOOST_TEST_TREE_DECORATOR_HPP_091911GER -#define BOOST_TEST_TREE_DECORATOR_HPP_091911GER - -// Boost.Test -#include <boost/test/detail/config.hpp> -#include <boost/test/detail/global_typedef.hpp> - -#include <boost/test/tree/fixture.hpp> - -#include <boost/test/tools/assertion_result.hpp> -#include <boost/test/utils/basic_cstring/basic_cstring.hpp> - -// Boost -#include <boost/shared_ptr.hpp> -#include <boost/function/function0.hpp> -#include <boost/function/function1.hpp> - -#include <boost/test/detail/suppress_warnings.hpp> - -// STL -#include <vector> - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { - -class test_unit; - -namespace decorator { - -// ************************************************************************** // -// ************** decorator::collector_t ************** // -// ************************************************************************** // - -class base; -typedef boost::shared_ptr<base> base_ptr; - -class BOOST_TEST_DECL collector_t { - -public: - collector_t& operator*( base const& d ); - - void store_in( test_unit& tu ); - - void reset(); - - void stack(); - - std::vector<base_ptr> get_lazy_decorators() const; - - // singleton pattern without ctor - BOOST_TEST_SINGLETON_CONS_NO_CTOR( collector_t ) - -private: - // Class invariant: minimal size is 1. - collector_t() : m_tu_decorators_stack(1) {} - - // Data members - std::vector< std::vector<base_ptr> > m_tu_decorators_stack; -}; - - -// ************************************************************************** // -// ************** decorator::base ************** // -// ************************************************************************** // - -class BOOST_TEST_DECL base { -public: - // composition interface - virtual collector_t& operator*() const; - - // application interface - virtual void apply( test_unit& tu ) = 0; - - // deep cloning interface - virtual base_ptr clone() const = 0; - -protected: - virtual ~base() {} -}; - -// ************************************************************************** // -// ************** decorator::stack_decorator ************** // -// ************************************************************************** // - -//!@ A decorator that creates a new stack in the collector -//! -//! This decorator may be used in places where the currently accumulated decorators -//! in the collector should be applied to lower levels of the hierarchy rather -//! than the current one. This is for instance for dataset test cases, where the -//! macro does not let the user specify decorators for the underlying generated tests -//! (but rather on the main generator function), applying the stack_decorator at the -//! parent level lets us consume the decorator at the underlying test cases level. -class BOOST_TEST_DECL stack_decorator : public decorator::base { -public: - explicit stack_decorator() {} - - collector_t& operator*() const BOOST_OVERRIDE; - -private: - // decorator::base interface - void apply( test_unit& tu ) BOOST_OVERRIDE; - base_ptr clone() const BOOST_OVERRIDE { return base_ptr(new stack_decorator()); } -}; - -// ************************************************************************** // -// ************** decorator::label ************** // -// ************************************************************************** // - -class BOOST_TEST_DECL label : public decorator::base { -public: - explicit label( const_string l ) : m_label( l ) {} - -private: - // decorator::base interface - void apply( test_unit& tu ) BOOST_OVERRIDE; - base_ptr clone() const BOOST_OVERRIDE { return base_ptr(new label( m_label )); } - - // Data members - const_string m_label; -}; - -// ************************************************************************** // -// ************** decorator::expected_failures ************** // -// ************************************************************************** // - -class BOOST_TEST_DECL expected_failures : public decorator::base { -public: - explicit expected_failures( counter_t ef ) : m_exp_fail( ef ) {} - -private: - // decorator::base interface - void apply( test_unit& tu ) BOOST_OVERRIDE; - base_ptr clone() const BOOST_OVERRIDE { return base_ptr(new expected_failures( m_exp_fail )); } - - // Data members - counter_t m_exp_fail; -}; - -// ************************************************************************** // -// ************** decorator::timeout ************** // -// ************************************************************************** // - -class BOOST_TEST_DECL timeout : public decorator::base { -public: - explicit timeout( unsigned t ) : m_timeout( t ) {} - -private: - // decorator::base interface - void apply( test_unit& tu ) BOOST_OVERRIDE; - base_ptr clone() const BOOST_OVERRIDE { return base_ptr(new timeout( m_timeout )); } - - // Data members - unsigned m_timeout; -}; - -// ************************************************************************** // -// ************** decorator::description ************** // -// ************************************************************************** // - -class BOOST_TEST_DECL description : public decorator::base { -public: - explicit description( const_string descr ) : m_description( descr ) {} - -private: - // decorator::base interface - void apply( test_unit& tu ) BOOST_OVERRIDE; - base_ptr clone() const BOOST_OVERRIDE { return base_ptr(new description( m_description )); } - - // Data members - const_string m_description; -}; - -// ************************************************************************** // -// ************** decorator::depends_on ************** // -// ************************************************************************** // - -class BOOST_TEST_DECL depends_on : public decorator::base { -public: - explicit depends_on( const_string dependency ) : m_dependency( dependency ) {} - -private: - // decorator::base interface - void apply( test_unit& tu ) BOOST_OVERRIDE; - base_ptr clone() const BOOST_OVERRIDE { return base_ptr(new depends_on( m_dependency )); } - - // Data members - const_string m_dependency; -}; - -// ************************************************************************** // -// ************** decorator::enable_if/enabled/disabled ************** // -// ************************************************************************** // - -class BOOST_TEST_DECL enable_if_impl : public decorator::base { -protected: - void apply_impl( test_unit& tu, bool condition ); -}; - -template<bool condition> -class enable_if : public enable_if_impl { -private: - // decorator::base interface - void apply( test_unit& tu ) BOOST_OVERRIDE { this->apply_impl( tu, condition ); } - base_ptr clone() const BOOST_OVERRIDE { return base_ptr(new enable_if<condition>()); } -}; - -typedef enable_if<true> enabled; -typedef enable_if<false> disabled; - -// ************************************************************************** // -// ************** decorator::fixture ************** // -// ************************************************************************** // - -class BOOST_TEST_DECL fixture_t : public decorator::base { -public: - // Constructor - explicit fixture_t( test_unit_fixture_ptr impl ) : m_impl( impl ) {} - -private: - // decorator::base interface - void apply( test_unit& tu ) BOOST_OVERRIDE; - base_ptr clone() const BOOST_OVERRIDE { return base_ptr(new fixture_t( m_impl )); } - - // Data members - test_unit_fixture_ptr m_impl; -}; - -//____________________________________________________________________________// - -template<typename F> -inline fixture_t -fixture() -{ - return fixture_t( test_unit_fixture_ptr( new unit_test::class_based_fixture<F>() ) ); -} - -//____________________________________________________________________________// - -template<typename F, typename Arg> -inline fixture_t -fixture( Arg const& arg ) -{ - return fixture_t( test_unit_fixture_ptr( new unit_test::class_based_fixture<F,Arg>( arg ) ) ); -} - -//____________________________________________________________________________// - -inline fixture_t -fixture( boost::function<void()> const& setup, boost::function<void()> const& teardown = boost::function<void()>() ) -{ - return fixture_t( test_unit_fixture_ptr( new unit_test::function_based_fixture( setup, teardown ) ) ); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** decorator::depends_on ************** // -// ************************************************************************** // - -class BOOST_TEST_DECL precondition : public decorator::base { -public: - typedef boost::function<test_tools::assertion_result (test_unit_id)> predicate_t; - - explicit precondition( predicate_t p ) : m_precondition( p ) {} - -private: - // decorator::base interface - void apply( test_unit& tu ) BOOST_OVERRIDE; - base_ptr clone() const BOOST_OVERRIDE { return base_ptr(new precondition( m_precondition )); } - - // Data members - predicate_t m_precondition; -}; - -} // namespace decorator - -using decorator::label; -using decorator::expected_failures; -using decorator::timeout; -using decorator::description; -using decorator::depends_on; -using decorator::enable_if; -using decorator::enabled; -using decorator::disabled; -using decorator::fixture; -using decorator::precondition; - -} // namespace unit_test -} // namespace boost - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_TREE_DECORATOR_HPP_091911GER diff --git a/contrib/restricted/boost/test/include/boost/test/tree/fixture.hpp b/contrib/restricted/boost/test/include/boost/test/tree/fixture.hpp deleted file mode 100644 index a297ad9e9b..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/tree/fixture.hpp +++ /dev/null @@ -1,191 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -/// @file -/// Defines fixture interface and object makers -// *************************************************************************** - -#ifndef BOOST_TEST_TREE_FIXTURE_HPP_100311GER -#define BOOST_TEST_TREE_FIXTURE_HPP_100311GER - -// Boost.Test -#include <boost/test/detail/config.hpp> - -// Boost -#include <boost/shared_ptr.hpp> -#include <boost/scoped_ptr.hpp> -#include <boost/function/function0.hpp> -#include <boost/utility/declval.hpp> - -#include <boost/test/detail/suppress_warnings.hpp> - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { - -// ************************************************************************** // -// ************** test_unit_fixture ************** // -// ************************************************************************** // - -class BOOST_TEST_DECL test_unit_fixture { -public: - virtual ~test_unit_fixture() {} - - // Fixture interface - virtual void setup() = 0; - virtual void teardown() = 0; -}; - -typedef shared_ptr<test_unit_fixture> test_unit_fixture_ptr; - -// ************************************************************************** // -// ************** fixture helper functions ************** // -// ************************************************************************** // - -namespace impl_fixture { - -#if defined(BOOST_NO_CXX11_DECLTYPE) || defined(BOOST_NO_CXX11_TRAILING_RESULT_TYPES) - - template<typename U, void (U::*)()> struct fixture_detect {}; - - template<typename T> - struct has_setup { - private: - template<typename U> static char Test(fixture_detect<U, &U::setup>*); - template<typename U> static int Test(...); - public: - static const bool value = sizeof(Test<T>(0)) == sizeof(char); - }; - - template<typename T> - struct has_teardown { - private: - template<typename U> static char Test(fixture_detect<U, &U::teardown>*); - template<typename U> static int Test(...); - public: - static const bool value = sizeof(Test<T>(0)) == sizeof(char); - }; - -#else - - template<typename U> struct fixture_detect { typedef char type; }; - template<typename T> - struct has_setup { - private: - template<typename U> static auto Test(U*) -> typename fixture_detect<decltype(boost::declval<U>().setup())>::type; - template<typename U> static int Test(...); - public: - static const bool value = sizeof(Test<T>(0)) == sizeof(char); - }; - - template<typename T> - struct has_teardown { - private: - template<typename U> static auto Test(U*) -> typename fixture_detect<decltype(boost::declval<U>().teardown())>::type; - template<typename U> static int Test(...); - public: - static const bool value = sizeof(Test<T>(0)) == sizeof(char); - }; - -#endif - - template <bool has_setup = false> - struct call_setup { template <class U> void operator()(U& ) { } }; - - template <> - struct call_setup<true> { template <class U> void operator()(U& u) { u.setup(); } }; - - template <bool has_teardown = false> - struct call_teardown { template <class U> void operator()(U& ) { } }; - - template <> - struct call_teardown<true> { template <class U> void operator()(U& u) { u.teardown(); } }; -} - -//! Calls the fixture "setup" if detected by the compiler, otherwise does nothing. -template <class U> -void setup_conditional(U& u) { - return impl_fixture::call_setup<impl_fixture::has_setup<U>::value>()(u); -} - -//! Calls the fixture "teardown" if detected by the compiler, otherwise does nothing. -template <class U> -void teardown_conditional(U& u) { - return impl_fixture::call_teardown<impl_fixture::has_teardown<U>::value>()(u); -} - - -// ************************************************************************** // -// ************** class_based_fixture ************** // -// ************************************************************************** // - -template<typename F, typename Arg=void> -class class_based_fixture : public test_unit_fixture { -public: - // Constructor - explicit class_based_fixture( Arg const& arg ) : m_inst(), m_arg( arg ) {} - -private: - // Fixture interface - void setup() BOOST_OVERRIDE { m_inst.reset( new F( m_arg ) ); setup_conditional(*m_inst); } - void teardown() BOOST_OVERRIDE { teardown_conditional(*m_inst); m_inst.reset(); } - - // Data members - scoped_ptr<F> m_inst; - Arg m_arg; -}; - -//____________________________________________________________________________// - -template<typename F> -class class_based_fixture<F,void> : public test_unit_fixture { -public: - // Constructor - class_based_fixture() : m_inst( 0 ) {} - -private: - // Fixture interface - void setup() BOOST_OVERRIDE { m_inst.reset( new F ); setup_conditional(*m_inst); } - void teardown() BOOST_OVERRIDE { teardown_conditional(*m_inst); m_inst.reset(); } - - // Data members - scoped_ptr<F> m_inst; -}; - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** function_based_fixture ************** // -// ************************************************************************** // - -class function_based_fixture : public test_unit_fixture { -public: - // Constructor - function_based_fixture( boost::function<void ()> const& setup_, boost::function<void ()> const& teardown_ ) - : m_setup( setup_ ) - , m_teardown( teardown_ ) - { - } - -private: - // Fixture interface - void setup() BOOST_OVERRIDE { if( m_setup ) m_setup(); } - void teardown() BOOST_OVERRIDE { if( m_teardown ) m_teardown(); } - - // Data members - boost::function<void ()> m_setup; - boost::function<void ()> m_teardown; -}; - -} // namespace unit_test -} // namespace boost - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_TREE_FIXTURE_HPP_100311GER - diff --git a/contrib/restricted/boost/test/include/boost/test/tree/global_fixture.hpp b/contrib/restricted/boost/test/include/boost/test/tree/global_fixture.hpp deleted file mode 100644 index 54397d3cf1..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/tree/global_fixture.hpp +++ /dev/null @@ -1,139 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -/// @file -/// Defines global_fixture -// *************************************************************************** - -#ifndef BOOST_TEST_TREE_GLOBAL_FIXTURE_HPP_091911GER -#define BOOST_TEST_TREE_GLOBAL_FIXTURE_HPP_091911GER - -// Boost.Test -#include <boost/test/detail/config.hpp> -#include <boost/test/detail/global_typedef.hpp> - -#include <boost/test/tree/observer.hpp> -#include <boost/test/tree/fixture.hpp> - -#include <boost/test/detail/suppress_warnings.hpp> - - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { - -// ************************************************************************** // -// ************** global_configuration ************** // -// ************************************************************************** // - -class BOOST_TEST_DECL global_configuration : public test_observer { - -public: - // Constructor - global_configuration(); - - /// Unregisters the global fixture from the framework - /// - /// This is called by the framework at shutdown time - void unregister_from_framework(); - - // Dtor - ~global_configuration() BOOST_OVERRIDE; - - // Happens after the framework global observer init has been done - int priority() BOOST_OVERRIDE { return 1; } - -private: - bool registered; -}; - - - -// ************************************************************************** // -// ************** global_fixture ************** // -// ************************************************************************** // - -class BOOST_TEST_DECL global_fixture : public test_unit_fixture { - -public: - // Constructor - global_fixture(); - - /// Unregisters the global fixture from the framework - /// - /// This is called by the framework at shutdown time - void unregister_from_framework(); - - // Dtor - ~global_fixture() BOOST_OVERRIDE; - -private: - bool registered; -}; - -//____________________________________________________________________________// - -namespace ut_detail { - -template<typename F> -struct global_configuration_impl : public global_configuration { - // Constructor - global_configuration_impl() : m_configuration_observer( 0 ) { - } - - // test observer interface - void test_start( counter_t, test_unit_id ) BOOST_OVERRIDE { - m_configuration_observer = new F; - } - - // test observer interface - void test_finish() BOOST_OVERRIDE { - if(m_configuration_observer) { - delete m_configuration_observer; - m_configuration_observer = 0; - } - } -private: - // Data members - F* m_configuration_observer; -}; - -template<typename F> -struct global_fixture_impl : public global_fixture { - // Constructor - global_fixture_impl() : m_fixture( 0 ) { - } - - // test fixture interface - void setup() BOOST_OVERRIDE { - m_fixture = new F; - setup_conditional(*m_fixture); - } - - // test fixture interface - void teardown() BOOST_OVERRIDE { - if(m_fixture) { - teardown_conditional(*m_fixture); - } - delete m_fixture; - m_fixture = 0; - } - -private: - // Data members - F* m_fixture; -}; - -} // namespace ut_detail -} // namespace unit_test -} // namespace boost - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_TREE_GLOBAL_FIXTURE_HPP_091911GER - diff --git a/contrib/restricted/boost/test/include/boost/test/tree/observer.hpp b/contrib/restricted/boost/test/include/boost/test/tree/observer.hpp deleted file mode 100644 index 0c0a4013af..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/tree/observer.hpp +++ /dev/null @@ -1,115 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -//!@file -//!@brief defines abstract interface for test observer -// *************************************************************************** - -#ifndef BOOST_TEST_TEST_OBSERVER_HPP_021005GER -#define BOOST_TEST_TEST_OBSERVER_HPP_021005GER - -// Boost.Test -#include <boost/test/detail/fwd_decl.hpp> -#include <boost/test/detail/global_typedef.hpp> -#include <boost/test/detail/config.hpp> - -#include <boost/test/detail/suppress_warnings.hpp> - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { - -// ************************************************************************** // -// ************** test_observer ************** // -// ************************************************************************** // - -/// @brief Generic test observer interface -/// -/// This interface is used by observers in order to receive notifications from the -/// Boost.Test framework on the current execution state. -/// -/// Several observers can be running at the same time, and it is not unusual to -/// have interactions among them. The @ref test_observer::priority member function allows the specification -/// of a particular order among them (lowest priority executed first, except specified otherwise). -/// -class BOOST_TEST_DECL test_observer { -public: - - //! Called before the framework starts executing the test cases - //! - //! @param[in] number_of_test_cases indicates the number of test cases. Only active - //! test cases are taken into account. - //! @param[in] root_test_unit_id the ID root of the test tree currently being tested - virtual void test_start( counter_t /* number_of_test_cases */, test_unit_id /* root_test_unit_id */ ) {} - - //! Called after the framework ends executing the test cases - //! - //! @note The call is made with a reversed priority order. - virtual void test_finish() {} - - //! Called when a critical error is detected - //! - //! The critical errors are mainly the signals sent by the system and caught by the Boost.Test framework. - //! Since the running binary may be in incoherent/instable state, the test execution is aborted and all remaining - //! tests are discarded. - //! - //! @note may be called before test_observer::test_unit_finish() - virtual void test_aborted() {} - - //! Called before the framework starts executing a test unit - //! - //! @param[in] test_unit the test being executed - virtual void test_unit_start( test_unit const& /* test */) {} - - //! Called at each end of a test unit. - //! - //! @param elapsed duration of the test unit in microseconds. - virtual void test_unit_finish( test_unit const& /* test */, unsigned long /* elapsed */ ) {} - virtual void test_unit_skipped( test_unit const& tu, const_string ) { test_unit_skipped( tu ); } - virtual void test_unit_skipped( test_unit const& ) {} ///< backward compatibility - - //! Called when the test timed out - //! - //! This function is called to signal that a test unit (case or suite) timed out. - //! A valid test unit is available through boost::unit_test::framework::current_test_unit - virtual void test_unit_timed_out( test_unit const& ) {} - - //! Called when a test unit indicates a fatal error. - //! - //! A fatal error happens when - //! - a strong assertion (with @c REQUIRE) fails, which indicates that the test case cannot continue - //! - an unexpected exception is caught by the Boost.Test framework - virtual void test_unit_aborted( test_unit const& ) {} - - virtual void assertion_result( unit_test::assertion_result /* ar */ ) - { - } - - //! Called when an exception is intercepted - //! - //! In case an exception is intercepted, this call happens before the call - //! to @ref test_unit_aborted in order to log - //! additional data about the exception. - virtual void exception_caught( execution_exception const& ) {} - - //! The priority indicates the order at which this observer is initialized - //! and tore down in the UTF framework. The order is lowest to highest priority. - virtual int priority() { return 0; } - -protected: - - BOOST_TEST_PROTECTED_VIRTUAL ~test_observer() {} -}; - -} // namespace unit_test -} // namespace boost - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_TEST_OBSERVER_HPP_021005GER - diff --git a/contrib/restricted/boost/test/include/boost/test/tree/test_case_counter.hpp b/contrib/restricted/boost/test/include/boost/test/tree/test_case_counter.hpp deleted file mode 100644 index 375288a06b..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/tree/test_case_counter.hpp +++ /dev/null @@ -1,58 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -/// @file -/// Defines @ref test_case_counter -// *************************************************************************** - -#ifndef BOOST_TEST_TREE_TEST_CASE_COUNTER_HPP_100211GER -#define BOOST_TEST_TREE_TEST_CASE_COUNTER_HPP_100211GER - -// Boost.Test -#include <boost/test/detail/config.hpp> -#include <boost/test/utils/class_properties.hpp> - -#include <boost/test/tree/test_unit.hpp> -#include <boost/test/tree/visitor.hpp> - -#include <boost/test/detail/suppress_warnings.hpp> - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { - -// ************************************************************************** // -// ************** test_case_counter ************** // -// ************************************************************************** // - -///! Counts the number of enabled test cases -class test_case_counter : public test_tree_visitor { -public: - // Constructor - // @param ignore_disabled ignore the status when counting - test_case_counter(bool ignore_status = false) - : p_count( 0 ) - , m_ignore_status(ignore_status) - {} - - BOOST_READONLY_PROPERTY( counter_t, (test_case_counter)) p_count; -private: - // test tree visitor interface - void visit( test_case const& tc ) BOOST_OVERRIDE { if( m_ignore_status || tc.is_enabled() ) ++p_count.value; } - bool test_suite_start( test_suite const& ts ) BOOST_OVERRIDE { return m_ignore_status || ts.is_enabled(); } - - bool m_ignore_status; -}; - -} // namespace unit_test -} // namespace boost - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_TREE_TEST_CASE_COUNTER_HPP_100211GER - diff --git a/contrib/restricted/boost/test/include/boost/test/tree/test_unit.hpp b/contrib/restricted/boost/test/include/boost/test/tree/test_unit.hpp deleted file mode 100644 index 0eab1d9941..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/tree/test_unit.hpp +++ /dev/null @@ -1,291 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -/// @file -/// Defines @ref boost::unit_test::test_unit "test_unit", @ref boost::unit_test::test_case "test_case", -/// @ref boost::unit_test::test_suite "test_suite" and @ref boost::unit_test::master_test_suite_t "master_test_suite_t" -// *************************************************************************** - -#ifndef BOOST_TEST_TREE_TEST_UNIT_HPP_100211GER -#define BOOST_TEST_TREE_TEST_UNIT_HPP_100211GER - -// Boost.Test -#include <boost/test/detail/config.hpp> -#include <boost/test/detail/global_typedef.hpp> -#include <boost/test/detail/fwd_decl.hpp> - -#include <boost/test/tree/decorator.hpp> -#include <boost/test/tree/fixture.hpp> -#include <boost/test/framework.hpp> - -#include <boost/test/tools/assertion_result.hpp> - -#include <boost/test/utils/class_properties.hpp> - -// Boost -#include <boost/function/function0.hpp> -#include <boost/function/function1.hpp> - -// STL -#include <vector> -#include <string> -#include <map> - -#include <boost/test/detail/suppress_warnings.hpp> - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { - -namespace framework { - class state; -} - -// ************************************************************************** // -// ************** test_unit ************** // -// ************************************************************************** // - -typedef std::vector<test_unit_id> test_unit_id_list; - -class BOOST_TEST_DECL test_unit { -public: - enum { type = TUT_ANY }; - enum run_status { RS_DISABLED, RS_ENABLED, RS_INHERIT, RS_INVALID }; - - typedef std::vector<test_unit_id> id_list; - typedef std::vector<test_unit_fixture_ptr> fixture_list_t; - typedef BOOST_READONLY_PROPERTY(test_unit_id,(framework::state)) id_t; - typedef BOOST_READONLY_PROPERTY(test_unit_id,(test_suite)) parent_id_t; - typedef BOOST_READONLY_PROPERTY(id_list,(test_unit)) id_list_t; - typedef std::vector<decorator::base_ptr> decor_list_t; - typedef BOOST_READONLY_PROPERTY(std::vector<std::string>,(test_unit)) label_list_t; - - typedef boost::function<test_tools::assertion_result (test_unit_id)> precondition_t; - typedef BOOST_READONLY_PROPERTY(std::vector<precondition_t>,(test_unit)) precond_list_t; - - // preconditions management - void depends_on( test_unit* tu ); - void add_precondition( precondition_t const& ); - test_tools::assertion_result check_preconditions() const; - - // labels management - void add_label( const_string l ); - bool has_label( const_string l ) const; - - // helper access methods - void increase_exp_fail( counter_t num ); - bool is_enabled() const { return p_run_status == RS_ENABLED; } - std::string full_name() const; - - // Public r/o properties - test_unit_type const p_type; ///< type for this test unit - const_string const p_type_name; ///< "case"/"suite"/"module" - const_string const p_file_name; - std::size_t const p_line_num; - id_t p_id; ///< unique id for this test unit - parent_id_t p_parent_id; ///< parent test suite id - label_list_t p_labels; ///< list of labels associated with this test unit - - id_list_t p_dependencies; ///< list of test units this one depends on - precond_list_t p_preconditions; ///< user supplied preconditions for this test unit; - - // Public r/w properties - readwrite_property<std::string> p_name; ///< name for this test unit - readwrite_property<std::string> p_description; ///< description for this test unit - readwrite_property<unsigned> p_timeout; ///< timeout for the test unit execution in seconds - readwrite_property<counter_t> p_expected_failures; ///< number of expected failures in this test unit - - readwrite_property<run_status> p_default_status; ///< run status obtained by this unit during setup phase - readwrite_property<run_status> p_run_status; ///< run status assigned to this unit before execution phase after applying all filters - - readwrite_property<counter_t> p_sibling_rank; ///< rank of this test unit amoung siblings of the same parent - - readwrite_property<decor_list_t> p_decorators; ///< automatically assigned decorators; execution is delayed till framework::finalize_setup_phase function - readwrite_property<fixture_list_t> p_fixtures; ///< fixtures associated with this test unit - -protected: - ~test_unit(); - // Constructor - test_unit( const_string tu_name, const_string tc_file, std::size_t tc_line, test_unit_type t ); - // Master test suite constructor - explicit test_unit( const_string module_name ); -}; - -// ************************************************************************** // -// ************** test_unit_generator ************** // -// ************************************************************************** // - -class BOOST_TEST_DECL test_unit_generator { -public: - virtual test_unit* next() const = 0; - -protected: - BOOST_TEST_PROTECTED_VIRTUAL ~test_unit_generator() {} -}; - -// ************************************************************************** // -// ************** test_case ************** // -// ************************************************************************** // - -class BOOST_TEST_DECL test_case : public test_unit { -public: - enum { type = TUT_CASE }; - - // Constructor - test_case( const_string tc_name, boost::function<void ()> const& test_func ); - test_case( const_string tc_name, const_string tc_file, std::size_t tc_line, boost::function<void ()> const& test_func ); - - // Public property - typedef BOOST_READONLY_PROPERTY(boost::function<void ()>,(test_case)) test_func; - - test_func p_test_func; - -private: - friend class framework::state; - ~test_case() {} -}; - -// ************************************************************************** // -// ************** test_suite ************** // -// ************************************************************************** // - -//! Class representing test suites -class BOOST_TEST_DECL test_suite : public test_unit { -public: - enum { type = TUT_SUITE }; - - // Constructor - explicit test_suite( const_string ts_name, const_string ts_file, std::size_t ts_line ); - - // test unit list management - - /*!@brief Adds a test unit to a test suite. - * - * It is possible to specify the timeout and the expected failures. - */ - void add( test_unit* tu, counter_t expected_failures = 0, unsigned timeout = 0 ); - - /// @overload - void add( test_unit_generator const& gen, unsigned timeout = 0 ); - - /// @overload - void add( test_unit_generator const& gen, decorator::collector_t& decorators ); - - /// @overload - void add( boost::shared_ptr<test_unit_generator> gen_ptr, decorator::collector_t& decorators ); - - //! Removes a test from the test suite. - void remove( test_unit_id id ); - - //! Generates all the delayed test_units from the generators - void generate( ); - - //! Check for duplicates name in test cases - //! - //! Raises a setup_error if there are duplicates - void check_for_duplicate_test_cases(); - - // access methods - test_unit_id get( const_string tu_name ) const; - std::size_t size() const { return m_children.size(); } - -protected: - // Master test suite constructor - explicit test_suite( const_string module_name ); - - friend BOOST_TEST_DECL - void traverse_test_tree( test_suite const&, test_tree_visitor&, bool ); - friend class framework::state; - virtual ~test_suite() {} - - typedef std::multimap<counter_t,test_unit_id> children_per_rank; - // Data members - - test_unit_id_list m_children; - children_per_rank m_ranked_children; ///< maps child sibling rank to list of children with that rank - - std::vector< std::pair<boost::shared_ptr<test_unit_generator>, std::vector<decorator::base_ptr> > > m_generators; /// lazy evaluation -}; - -// ************************************************************************** // -// ************** master_test_suite ************** // -// ************************************************************************** // - -class BOOST_TEST_DECL master_test_suite_t : public test_suite { -private: - master_test_suite_t(); - master_test_suite_t(const master_test_suite_t&); // undefined - master_test_suite_t& operator=(master_test_suite_t const &); // undefined - -public: - // Data members - int argc; - char** argv; - - friend BOOST_TEST_DECL master_test_suite_t& boost::unit_test::framework::master_test_suite(); -}; - -// ************************************************************************** // -// ************** user_tc_method_invoker ************** // -// ************************************************************************** // - -namespace ut_detail { - -BOOST_TEST_DECL std::string normalize_test_case_name( const_string tu_name ); - -//____________________________________________________________________________// - -template<typename InstanceType,typename UserTestCase> -struct user_tc_method_invoker { - typedef void (UserTestCase::*TestMethod )(); - - user_tc_method_invoker( shared_ptr<InstanceType> inst, TestMethod test_method ) - : m_inst( inst ), m_test_method( test_method ) {} - - void operator()() { ((*m_inst).*m_test_method)(); } - - shared_ptr<InstanceType> m_inst; - TestMethod m_test_method; -}; - -} // namespace ut_detail - -// ************************************************************************** // -// ************** make_test_case ************** // -// ************************************************************************** // - -inline test_case* -make_test_case( boost::function<void ()> const& test_func, const_string tc_name, const_string tc_file, std::size_t tc_line ) -{ - return new test_case( ut_detail::normalize_test_case_name( tc_name ), tc_file, tc_line, test_func ); -} - -//____________________________________________________________________________// - -template<typename UserTestCase, typename InstanceType> -inline test_case* -make_test_case( void (UserTestCase::* test_method )(), - const_string tc_name, - const_string tc_file, - std::size_t tc_line, - boost::shared_ptr<InstanceType> user_test_case ) -{ - return new test_case( ut_detail::normalize_test_case_name( tc_name ), - tc_file, - tc_line, - ut_detail::user_tc_method_invoker<InstanceType,UserTestCase>( user_test_case, test_method ) ); -} - -//____________________________________________________________________________// - -} // namespace unit_test -} // namespace boost - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_TREE_TEST_UNIT_HPP_100211GER diff --git a/contrib/restricted/boost/test/include/boost/test/tree/traverse.hpp b/contrib/restricted/boost/test/include/boost/test/tree/traverse.hpp deleted file mode 100644 index d27917cace..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/tree/traverse.hpp +++ /dev/null @@ -1,58 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision: -1 $ -// -// Description : defines traverse_test_tree algorithm -// *************************************************************************** - -#ifndef BOOST_TEST_TREE_TRAVERSE_HPP_100211GER -#define BOOST_TEST_TREE_TRAVERSE_HPP_100211GER - -// Boost.Test -#include <boost/test/detail/config.hpp> - -#include <boost/test/tree/test_unit.hpp> -#include <boost/test/tree/visitor.hpp> - -#include <boost/test/detail/suppress_warnings.hpp> - - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { - -// ************************************************************************** // -// ************** traverse_test_tree ************** // -// ************************************************************************** // - -BOOST_TEST_DECL void traverse_test_tree( test_case const&, test_tree_visitor&, bool ignore_status = false ); -BOOST_TEST_DECL void traverse_test_tree( test_suite const&, test_tree_visitor&, bool ignore_status = false ); -BOOST_TEST_DECL void traverse_test_tree( test_unit_id , test_tree_visitor&, bool ignore_status = false ); - -//____________________________________________________________________________// - -inline void -traverse_test_tree( test_unit const& tu, test_tree_visitor& V, bool ignore_status = false ) -{ - if( tu.p_type == TUT_CASE ) - traverse_test_tree( static_cast<test_case const&>( tu ), V, ignore_status ); - else - traverse_test_tree( static_cast<test_suite const&>( tu ), V, ignore_status ); -} - -//____________________________________________________________________________// - -} // namespace unit_test -} // namespace boost - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_TREE_TRAVERSE_HPP_100211GER diff --git a/contrib/restricted/boost/test/include/boost/test/tree/visitor.hpp b/contrib/restricted/boost/test/include/boost/test/tree/visitor.hpp deleted file mode 100644 index 8f1bae5c92..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/tree/visitor.hpp +++ /dev/null @@ -1,52 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision: -1 $ -// -// Description : defines test_tree_visitor -// *************************************************************************** - -#ifndef BOOST_TEST_TREE_VISITOR_HPP_100211GER -#define BOOST_TEST_TREE_VISITOR_HPP_100211GER - -// Boost.Test -#include <boost/test/detail/config.hpp> - -#include <boost/test/tree/test_unit.hpp> - -#include <boost/test/detail/suppress_warnings.hpp> - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { - -// ************************************************************************** // -// ************** test_tree_visitor ************** // -// ************************************************************************** // - -class BOOST_TEST_DECL test_tree_visitor { -public: - // test tree visitor interface - virtual bool visit( test_unit const& ) { return true; } - virtual void visit( test_case const& tc ) { visit( (test_unit const&)tc ); } - virtual bool test_suite_start( test_suite const& ts ){ return visit( (test_unit const&)ts ); } - virtual void test_suite_finish( test_suite const& ) {} - -protected: - BOOST_TEST_PROTECTED_VIRTUAL ~test_tree_visitor() {} -}; - -} // namespace unit_test -} // namespace boost - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_TREE_VISITOR_HPP_100211GER - diff --git a/contrib/restricted/boost/test/include/boost/test/unit_test_log.hpp b/contrib/restricted/boost/test/include/boost/test/unit_test_log.hpp deleted file mode 100644 index 27a1072701..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/unit_test_log.hpp +++ /dev/null @@ -1,280 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -/// @file -/// @brief defines singleton class unit_test_log and all manipulators. -/// unit_test_log has output stream like interface. It's implementation is -/// completely hidden with pimple idiom -// *************************************************************************** - -#ifndef BOOST_TEST_UNIT_TEST_LOG_HPP_071894GER -#define BOOST_TEST_UNIT_TEST_LOG_HPP_071894GER - -// Boost.Test -#include <boost/test/tree/observer.hpp> - -#include <boost/test/detail/global_typedef.hpp> -#include <boost/test/detail/log_level.hpp> -#include <boost/test/detail/fwd_decl.hpp> - -#include <boost/test/utils/wrap_stringstream.hpp> -#include <boost/test/utils/lazy_ostream.hpp> - -// Boost - -// STL -#include <iosfwd> // for std::ostream& - -#include <boost/test/detail/suppress_warnings.hpp> - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { - -// ************************************************************************** // -// ************** log manipulators ************** // -// ************************************************************************** // - -namespace log { - -struct BOOST_TEST_DECL begin { - begin( const_string fn, std::size_t ln ) - : m_file_name( fn ) - , m_line_num( ln ) - {} - - const_string m_file_name; - std::size_t m_line_num; -}; - -struct end {}; - -} // namespace log - -// ************************************************************************** // -// ************** entry_value_collector ************** // -// ************************************************************************** // - -namespace ut_detail { - -class BOOST_TEST_DECL entry_value_collector { -public: - // Constructors - entry_value_collector() : m_last( true ) {} - entry_value_collector( entry_value_collector const& rhs ) : m_last( true ) { rhs.m_last = false; } - ~entry_value_collector(); - - // collection interface - entry_value_collector const& operator<<( lazy_ostream const& ) const; - entry_value_collector const& operator<<( const_string ) const; - -private: - // Data members - mutable bool m_last; -}; - -} // namespace ut_detail - -// ************************************************************************** // -// ************** unit_test_log ************** // -// ************************************************************************** // - -/// @brief Manages the sets of loggers, their streams and log levels -/// -/// The Boost.Test framework allows for having several formatters/loggers at the same time, each of which -/// having their own log level and output stream. -/// -/// This class serves the purpose of -/// - exposing an interface to the test framework (as a boost::unit_test::test_observer) -/// - exposing an interface to the testing tools -/// - managing several loggers -/// -/// @note Accesses to the functions exposed by this class are made through the singleton -/// @c boost::unit_test::unit_test_log. -/// -/// Users/developers willing to implement their own formatter need to: -/// - implement a boost::unit_test::unit_test_log_formatter that will output the desired format -/// - register the formatter during a eg. global fixture using the method @c set_formatter (though the framework singleton). -/// -/// @warning this observer has a higher priority than the @ref boost::unit_test::results_collector_t. This means -/// that the various @ref boost::unit_test::test_results associated to each test unit may not be available at the time -/// the @c test_unit_start, @c test_unit_finish ... are called. -/// -/// @see -/// - boost::unit_test::test_observer -/// - boost::unit_test::unit_test_log_formatter -class BOOST_TEST_DECL unit_test_log_t : public test_observer { -public: - // test_observer interface implementation - void test_start( counter_t test_cases_amount, test_unit_id ) BOOST_OVERRIDE; - void test_finish() BOOST_OVERRIDE; - void test_aborted() BOOST_OVERRIDE; - - void test_unit_start( test_unit const& ) BOOST_OVERRIDE; - void test_unit_finish( test_unit const&, unsigned long elapsed ) BOOST_OVERRIDE; - void test_unit_skipped( test_unit const&, const_string ) BOOST_OVERRIDE; - void test_unit_aborted( test_unit const& ) BOOST_OVERRIDE; - void test_unit_timed_out( test_unit const& ) BOOST_OVERRIDE; - - void exception_caught( execution_exception const& ex ) BOOST_OVERRIDE; - - int priority() BOOST_OVERRIDE { return 2; } - - // log configuration methods - //! Sets the stream for all loggers - //! - //! This will override the log sink/stream of all loggers, whether enabled or not. - void set_stream( std::ostream& ); - - //! Sets the stream for specific logger - //! - //! @note Has no effect if the specified format is not found - //! @par Since Boost 1.62 - void set_stream( output_format, std::ostream& ); - - //! Returns a pointer to the stream associated to specific logger - //! - //! @note Returns a null pointer if the format is not found - //! @par Since Boost 1.67 - std::ostream* get_stream( output_format ) const; - - - //! Sets the threshold level for all loggers/formatters. - //! - //! This will override the log level of all loggers, whether enabled or not. - //! @return the minimum of the previous log level of all formatters (new in Boost 1.73) - log_level set_threshold_level( log_level ); - - //! Sets the threshold/log level of a specific format - //! - //! @note Has no effect if the specified format is not found - //! @par Since Boost 1.62 - //! @return the previous log level of the corresponding formatter (new in Boost 1.73) - log_level set_threshold_level( output_format, log_level ); - - //! Add a format to the set of loggers - //! - //! Adding a logger means that the specified logger is enabled. The log level is managed by the formatter itself - //! and specifies what events are forwarded to the underlying formatter. - //! @par Since Boost 1.62 - void add_format( output_format ); - - //! Sets the format of the logger - //! - //! This will become the only active format of the logs. - void set_format( output_format ); - - //! Returns the logger instance for a specific format. - //! - //! @returns the logger/formatter instance, or @c (unit_test_log_formatter*)0 if the format is not found. - //! @par Since Boost 1.62 - unit_test_log_formatter* get_formatter( output_format ); - - //! Sets the logger instance - //! - //! The specified logger becomes the unique active one. The custom log formatter has the - //! format @c OF_CUSTOM_LOGGER. If such a format exists already, its formatter gets replaced by the one - //! given in argument. - //! - //! The log level and output stream of the new formatter are taken from the currently active logger. In case - //! several loggers are active, the order of priority is CUSTOM, HRF, XML, and JUNIT. - //! If (unit_test_log_formatter*)0 is given as argument, the custom logger (if any) is removed. - //! - //! @note The ownership of the pointer is transferred to the Boost.Test framework. This call is equivalent to - //! - a call to @c add_formatter - //! - a call to @c set_format(OF_CUSTOM_LOGGER) - //! - a configuration of the newly added logger with a previously configured stream and log level. - void set_formatter( unit_test_log_formatter* ); - - //! Adds a custom log formatter to the set of formatters - //! - //! The specified logger is added with the format @c OF_CUSTOM_LOGGER, such that it can - //! be futher selected or its stream/log level can be specified. - //! If there is already a custom logger (with @c OF_CUSTOM_LOGGER), then - //! the existing one gets replaced by the one given in argument. - //! The provided logger is added with an enabled state. - //! If (unit_test_log_formatter*)0 is given as argument, the custom logger (if any) is removed and - //! no other action is performed. - //! - //! @note The ownership of the pointer is transferred to the Boost.Test framework. - //! @par Since Boost 1.62 - void add_formatter( unit_test_log_formatter* the_formatter ); - - // test progress logging - void set_checkpoint( const_string file, std::size_t line_num, const_string msg = const_string() ); - - // entry logging - unit_test_log_t& operator<<( log::begin const& ); // begin entry - unit_test_log_t& operator<<( log::end const& ); // end entry - unit_test_log_t& operator<<( log_level ); // set entry level - unit_test_log_t& operator<<( const_string ); // log entry value - unit_test_log_t& operator<<( lazy_ostream const& ); // log entry value - - ut_detail::entry_value_collector operator()( log_level ); // initiate entry collection - - //! Prepares internal states after log levels, streams and format has been set up - void configure(); -private: - // Singleton - BOOST_TEST_SINGLETON_CONS( unit_test_log_t ) -}; // unit_test_log_t - -BOOST_TEST_SINGLETON_INST( unit_test_log ) - -// helper macros -#define BOOST_TEST_LOG_ENTRY( ll ) \ - (::boost::unit_test::unit_test_log \ - << ::boost::unit_test::log::begin( BOOST_TEST_L(__FILE__), __LINE__ ))(ll) \ -/**/ - -} // namespace unit_test -} // namespace boost - -// ************************************************************************** // -// ************** Unit test log interface helpers ************** // -// ************************************************************************** // - -// messages sent by the framework -#define BOOST_TEST_FRAMEWORK_MESSAGE( M ) \ - (::boost::unit_test::unit_test_log \ - << ::boost::unit_test::log::begin( \ - "boost.test framework", \ - 0 )) \ - ( ::boost::unit_test::log_messages ) \ - << BOOST_TEST_LAZY_MSG( M ) \ -/**/ - - -#define BOOST_TEST_MESSAGE( M ) \ - BOOST_TEST_LOG_ENTRY( ::boost::unit_test::log_messages ) \ - << BOOST_TEST_LAZY_MSG( M ) \ -/**/ - -//____________________________________________________________________________// - -#define BOOST_TEST_PASSPOINT() \ - ::boost::unit_test::unit_test_log.set_checkpoint( \ - BOOST_TEST_L(__FILE__), \ - static_cast<std::size_t>(__LINE__) ) \ -/**/ - -//____________________________________________________________________________// - -#define BOOST_TEST_CHECKPOINT( M ) \ - ::boost::unit_test::unit_test_log.set_checkpoint( \ - BOOST_TEST_L(__FILE__), \ - static_cast<std::size_t>(__LINE__), \ - (::boost::wrap_stringstream().ref() << M).str() ) \ -/**/ - -//____________________________________________________________________________// - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_UNIT_TEST_LOG_HPP_071894GER - diff --git a/contrib/restricted/boost/test/include/boost/test/unit_test_log_formatter.hpp b/contrib/restricted/boost/test/include/boost/test/unit_test_log_formatter.hpp deleted file mode 100644 index 6ec72cafa7..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/unit_test_log_formatter.hpp +++ /dev/null @@ -1,327 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -/// @file -/// @brief Defines unit test log formatter interface -/// -/// You can define a class with implements this interface and use an instance of it -/// as a Unit Test Framework log formatter -// *************************************************************************** - -#ifndef BOOST_TEST_UNIT_TEST_LOG_FORMATTER_HPP_071894GER -#define BOOST_TEST_UNIT_TEST_LOG_FORMATTER_HPP_071894GER - -// Boost.Test -#include <boost/test/detail/global_typedef.hpp> -#include <boost/test/detail/log_level.hpp> -#include <boost/test/detail/fwd_decl.hpp> - -// STL -#include <iosfwd> -#include <string> // for std::string -#include <iostream> - -#include <boost/test/detail/suppress_warnings.hpp> - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { - -// ************************************************************************** // -/// Collection of log entry attributes -// ************************************************************************** // - -struct BOOST_TEST_DECL log_entry_data { - log_entry_data() - { - m_file_name.reserve( 200 ); - } - - std::string m_file_name; ///< log entry file name - std::size_t m_line_num; ///< log entry line number - log_level m_level; ///< log entry level - - void clear() - { - m_file_name.erase(); - m_line_num = 0; - m_level = log_nothing; - } -}; - -// ************************************************************************** // -/// Collection of log checkpoint attributes -// ************************************************************************** // - -struct BOOST_TEST_DECL log_checkpoint_data -{ - const_string m_file_name; ///< log checkpoint file name - std::size_t m_line_num; ///< log checkpoint file name - std::string m_message; ///< log checkpoint message - - void clear() - { - m_file_name.clear(); - m_line_num = 0; - m_message = std::string(); - } -}; - -// ************************************************************************** // -/// @brief Abstract Unit Test Framework log formatter interface -/// -/// During the test module execution Unit Test Framework can report messages about success -/// or failure of assertions, which test suites are being run and more (specifically which -/// messages are reported depends on log level threshold selected by the user). -/// -/// All these messages constitute Unit Test Framework log. There are many ways (formats) to present -/// these messages to the user. -/// -/// Boost.Test comes with three formats: -/// - Compiler-like log format: intended for human consumption/diagnostic -/// - XML based log format: intended for processing by automated regression test systems. -/// - JUNIT based log format: intended for processing by automated regression test systems. -/// -/// If you want to produce some other format you need to implement class with specific interface and use -/// method @c unit_test_log_t::set_formatter during a test module initialization to set an active formatter. -/// The class unit_test_log_formatter defines this interface. -/// -/// This interface requires you to format all possible messages being produced in the log. -/// These includes error messages about failed assertions, messages about caught exceptions and -/// information messages about test units being started/ended. All the methods in this interface takes -/// a reference to standard stream as a first argument. This is where final messages needs to be directed -/// to. Also you are given all the information necessary to produce a message. -/// -/// @par Since Boost 1.62: -/// - Each formatter may indicate the default output stream. This is convenient for instance for streams intended -/// for automated processing that indicate a file. See @c get_default_stream_description for more details. -/// - Each formatter may manage its own log level through the getter/setter @c get_log_level and @c set_log_level . -/// -/// @see -/// - boost::unit_test::test_observer for an indication of the calls of the test observer interface -class BOOST_TEST_DECL unit_test_log_formatter { -public: - /// Types of log entries (messages written into a log) - enum log_entry_types { BOOST_UTL_ET_INFO, ///< Information message from the framework - BOOST_UTL_ET_MESSAGE, ///< Information message from the user - BOOST_UTL_ET_WARNING, ///< Warning (non error) condition notification message - BOOST_UTL_ET_ERROR, ///< Non fatal error notification message - BOOST_UTL_ET_FATAL_ERROR ///< Fatal error notification message - }; - - //! Constructor - unit_test_log_formatter() - : m_log_level(log_all_errors) - {} - - // Destructor - virtual ~unit_test_log_formatter() {} - - // @name Test start/finish - - /// Invoked at the beginning of test module execution - /// - /// @param[in] os output stream to write a messages to - /// @param[in] test_cases_amount total test case amount to be run - /// @see log_finish - virtual void log_start( std::ostream& os, counter_t test_cases_amount ) = 0; - - /// Invoked at the end of test module execution - /// - /// @param[in] os output stream to write a messages into - /// @see log_start - virtual void log_finish( std::ostream& os ) = 0; - - /// Invoked when Unit Test Framework build information is requested - /// - /// @param[in] os output stream to write a messages into - /// @param[in] log_build_info indicates if build info should be logged or not - virtual void log_build_info( std::ostream& os, bool log_build_info = true ) = 0; - // @} - - // @name Test unit start/finish - - /// Invoked when test unit starts (either test suite or test case) - /// - /// @param[in] os output stream to write a messages into - /// @param[in] tu test unit being started - /// @see test_unit_finish - virtual void test_unit_start( std::ostream& os, test_unit const& tu ) = 0; - - /// Invoked when test unit finishes - /// - /// @param[in] os output stream to write a messages into - /// @param[in] tu test unit being finished - /// @param[in] elapsed time in microseconds spend executing this test unit - /// @see test_unit_start - virtual void test_unit_finish( std::ostream& os, test_unit const& tu, unsigned long elapsed ) = 0; - - /// Invoked if test unit skipped for any reason - /// - /// @param[in] os output stream to write a messages into - /// @param[in] tu skipped test unit - /// @param[in] reason explanation why was it skipped - virtual void test_unit_skipped( std::ostream& os, test_unit const& tu, const_string /* reason */) - { - test_unit_skipped( os, tu ); - } - - /// Deprecated version of this interface - /// @deprecated - virtual void test_unit_skipped( std::ostream& /* os */, test_unit const& /* tu */) {} - - /// Invoked when a test unit is aborted - virtual void test_unit_aborted( std::ostream& /* os */, test_unit const& /* tu */) {} - - /// Invoked when a test unit times-out - virtual void test_unit_timed_out( std::ostream& /* os */, test_unit const& /* tu */) {} - - - // @} - - // @name Uncaught exception report - - /// Invoked when Unit Test Framework detects uncaught exception - /// - /// The framwork calls this function when an uncaught exception it detected. - /// This call is followed by context information: - /// - one call to @c entry_context_start, - /// - as many calls to @c log_entry_context as there are context entries - /// - one call to @c entry_context_finish - /// - /// The logging of the exception information is finilized by a call to @c log_exception_finish. - /// - /// @param[in] os output stream to write a messages into - /// @param[in] lcd information about the last checkpoint before the exception was triggered - /// @param[in] ex information about the caught exception - /// @see log_exception_finish - virtual void log_exception_start( std::ostream& os, log_checkpoint_data const& lcd, execution_exception const& ex ) = 0; - - /// Invoked when Unit Test Framework detects uncaught exception - /// - /// Call to this function finishes uncaught exception report. - /// @param[in] os output stream to write a messages into - /// @see log_exception_start - virtual void log_exception_finish( std::ostream& os ) = 0; - // @} - - // @name Regular log entry - - /// Invoked by Unit Test Framework to start new log entry - - /// Call to this function starts new log entry. It is followed by series of log_entry_value calls and finally call to log_entry_finish. - /// A log entry may consist of one or more values being reported. Some of these values will be plain strings, while others can be complicated - /// expressions in a form of "lazy" expression template lazy_ostream. - /// @param[in] os output stream to write a messages into - /// @param[in] led log entry attributes - /// @param[in] let log entry type log_entry_finish - /// @see log_entry_value, log_entry_finish - /// - /// @note call to this function may happen before any call to test_unit_start or all calls to test_unit_finish as the - /// framework might log errors raised during global initialization/shutdown. - virtual void log_entry_start( std::ostream& os, log_entry_data const& led, log_entry_types let ) = 0; - - /// Invoked by Unit Test Framework to report a log entry content - /// - /// This is one of two overloaded methods to report log entry content. This one is used to report plain string value. - /// @param[in] os output stream to write a messages into. - /// @param[in] value log entry string value - /// @see log_entry_start, log_entry_finish - virtual void log_entry_value( std::ostream& os, const_string value ) = 0; - - /// Invoked by Unit Test Framework to report a log entry content - - /// This is one of two overloaded methods to report log entry content. This one is used to report some complicated expression passed as - /// an expression template lazy_ostream. In most cases default implementation provided by the framework should work as is (it just converts - /// the lazy expression into a string. - /// @param[in] os output stream to write a messages into - /// @param[in] value log entry "lazy" value - /// @see log_entry_start, log_entry_finish - virtual void log_entry_value( std::ostream& os, lazy_ostream const& value ); // there is a default impl - - /// Invoked by Unit Test Framework to finish a log entry report - - /// @param[in] os output stream to write a messages into - /// @see log_entry_start, log_entry_start - virtual void log_entry_finish( std::ostream& os ) = 0; - // @} - - // @name Log entry context report - - /// Invoked by Unit Test Framework to start log entry context report - // - /// Unit Test Framework logs for failed assertions and uncaught exceptions context if one was defined by a test module. - /// Context consists of multiple "scopes" identified by description messages assigned by the test module using - /// BOOST_TEST_INFO/BOOST_TEST_CONTEXT statements. - /// @param[in] os output stream to write a messages into - /// @param[in] l entry log_level, to be used to fine tune the message - /// @see log_entry_context, entry_context_finish - virtual void entry_context_start( std::ostream& os, log_level l ) = 0; - - /// Invoked by Unit Test Framework to report log entry context "scope" description - // - /// Each "scope" description is reported by separate call to log_entry_context. - /// @param[in] os output stream to write a messages into - /// @param[in] l entry log_level, to be used to fine tune the message - /// @param[in] value context "scope" description - /// @see log_entry_start, entry_context_finish - virtual void log_entry_context( std::ostream& os, log_level l, const_string value ) = 0; - - /// Invoked by Unit Test Framework to finish log entry context report - /// - /// @param[in] os output stream to write a messages into - /// @param[in] l entry log_level, to be used to fine tune the message - /// @see log_entry_start, entry_context_context - virtual void entry_context_finish( std::ostream& os, log_level l ) = 0; - // @} - - // @name Log level management - - /// Sets the log level of the logger/formatter - /// - /// Some loggers need to manage the log level by their own. This - /// member function let the implementation decide of that. - /// @par Since Boost 1.62 - virtual void set_log_level(log_level new_log_level); - - /// Returns the log level of the logger/formatter - /// @par Since Boost 1.62 - virtual log_level get_log_level() const; - // @} - - - // @name Stream management - - /// Returns a default stream for this logger. - /// - /// The returned string describes the stream as if it was passed from - /// the command line @c "--log_sink" parameter. With that regards, @b stdout and @b stderr - /// have special meaning indicating the standard output or error stream respectively. - /// - /// @par Since Boost 1.62 - virtual std::string get_default_stream_description() const - { - return "stdout"; - } - - // @} - - -protected: - log_level m_log_level; - -}; - -} // namespace unit_test -} // namespace boost - -//____________________________________________________________________________// - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_UNIT_TEST_LOG_FORMATTER_HPP_071894GER diff --git a/contrib/restricted/boost/test/include/boost/test/unit_test_monitor.hpp b/contrib/restricted/boost/test/include/boost/test/unit_test_monitor.hpp deleted file mode 100644 index 3e7919a5aa..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/unit_test_monitor.hpp +++ /dev/null @@ -1,62 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -/// @file -/// @brief defines specific version of execution monitor used to managed run unit of test cases -/// -/// Translates execution exception into error level -// *************************************************************************** - -#ifndef BOOST_TEST_UNIT_TEST_MONITOR_HPP_020905GER -#define BOOST_TEST_UNIT_TEST_MONITOR_HPP_020905GER - -// Boost.Test -#include <boost/test/execution_monitor.hpp> -#include <boost/test/detail/fwd_decl.hpp> - -#include <boost/test/detail/suppress_warnings.hpp> - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { - -// ************************************************************************** // -// ************** unit_test_monitor ************** // -// ************************************************************************** // - -class BOOST_TEST_DECL unit_test_monitor_t :public execution_monitor { -public: - enum error_level { - test_ok = 0, - /// Indicates a failure to prepare the unit test (eg. fixture). Does not - /// account for tests skipped because of parent tests failed/skipped. - test_setup_failure = -1, - unexpected_exception = -2, - os_exception = -3, - os_timeout = -4, - fatal_error = -5 // includes both system and user - }; - - static bool is_critical_error( error_level e ) { return e <= fatal_error; } - - // monitor method - // timeout is expressed in seconds - error_level execute_and_translate( boost::function<void ()> const& func, unsigned long int timeout_microseconds = 0 ); - - // singleton pattern - BOOST_TEST_SINGLETON_CONS( unit_test_monitor_t ) -}; - -BOOST_TEST_SINGLETON_INST( unit_test_monitor ) - -} // namespace unit_test -} // namespace boost - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_UNIT_TEST_MONITOR_HPP_020905GER diff --git a/contrib/restricted/boost/test/include/boost/test/unit_test_parameters.hpp b/contrib/restricted/boost/test/include/boost/test/unit_test_parameters.hpp deleted file mode 100644 index e7e60d344f..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/unit_test_parameters.hpp +++ /dev/null @@ -1,168 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -/// @file -/// @brief Provides access to various Unit Test Framework runtime parameters -/// -/// Primarily for use by the framework itself -// *************************************************************************** - -#ifndef BOOST_TEST_UNIT_TEST_PARAMETERS_HPP_071894GER -#define BOOST_TEST_UNIT_TEST_PARAMETERS_HPP_071894GER - -// Boost.Test -#include <boost/test/detail/global_typedef.hpp> -#include <boost/test/utils/runtime/argument.hpp> -#include <boost/make_shared.hpp> - -// Boost -#include <boost/function/function0.hpp> - -// STL -#include <iostream> -#include <fstream> - -#include <boost/test/detail/suppress_warnings.hpp> - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { -namespace runtime_config { - -// ************************************************************************** // -// ************** runtime_config ************** // -// ************************************************************************** // - -// UTF parameters -BOOST_TEST_DECL extern std::string btrt_auto_start_dbg; -BOOST_TEST_DECL extern std::string btrt_break_exec_path; -BOOST_TEST_DECL extern std::string btrt_build_info; -BOOST_TEST_DECL extern std::string btrt_catch_sys_errors; -BOOST_TEST_DECL extern std::string btrt_color_output; -BOOST_TEST_DECL extern std::string btrt_detect_fp_except; -BOOST_TEST_DECL extern std::string btrt_detect_mem_leaks; -BOOST_TEST_DECL extern std::string btrt_list_content; -BOOST_TEST_DECL extern std::string btrt_list_labels; -BOOST_TEST_DECL extern std::string btrt_log_format; -BOOST_TEST_DECL extern std::string btrt_log_level; -BOOST_TEST_DECL extern std::string btrt_log_sink; -BOOST_TEST_DECL extern std::string btrt_combined_logger; -BOOST_TEST_DECL extern std::string btrt_output_format; -BOOST_TEST_DECL extern std::string btrt_random_seed; -BOOST_TEST_DECL extern std::string btrt_report_format; -BOOST_TEST_DECL extern std::string btrt_report_level; -BOOST_TEST_DECL extern std::string btrt_report_mem_leaks; -BOOST_TEST_DECL extern std::string btrt_report_sink; -BOOST_TEST_DECL extern std::string btrt_result_code; -BOOST_TEST_DECL extern std::string btrt_run_filters; -BOOST_TEST_DECL extern std::string btrt_save_test_pattern; -BOOST_TEST_DECL extern std::string btrt_show_progress; -BOOST_TEST_DECL extern std::string btrt_use_alt_stack; -BOOST_TEST_DECL extern std::string btrt_wait_for_debugger; -BOOST_TEST_DECL extern std::string btrt_help; -BOOST_TEST_DECL extern std::string btrt_usage; -BOOST_TEST_DECL extern std::string btrt_version; - -BOOST_TEST_DECL void init( int& argc, char** argv ); - -// ************************************************************************** // -// ************** runtime_param::get ************** // -// ************************************************************************** // - -/// Access to arguments -BOOST_TEST_DECL runtime::arguments_store const& argument_store(); - -template<typename T> -inline T const& -get( runtime::cstring parameter_name ) -{ - return argument_store().get<T>( parameter_name ); -} - -inline bool has( runtime::cstring parameter_name ) -{ - return argument_store().has( parameter_name ); -} - -/// For public access -BOOST_TEST_DECL bool save_pattern(); - -// ************************************************************************** // -// ************** stream_holder ************** // -// ************************************************************************** // - -class stream_holder { -public: - // Constructor - explicit stream_holder( std::ostream& default_stream = std::cout ) - : m_stream( &default_stream ) - { - } - - void setup( const const_string& stream_name, - boost::function<void ()> const &cleaner_callback = boost::function<void ()>() ) - { - if(stream_name.empty()) - return; - - if( stream_name == "stderr" ) { - m_stream = &std::cerr; - if(cleaner_callback) { - m_cleaner = boost::make_shared<callback_cleaner>(cleaner_callback); - } - else { - m_cleaner.reset(); - } - } - else if( stream_name == "stdout" ) { - m_stream = &std::cout; - if (cleaner_callback) { - m_cleaner = boost::make_shared<callback_cleaner>(cleaner_callback); - } - else { - m_cleaner.reset(); - } - } - else { - m_cleaner = boost::make_shared<callback_cleaner>(cleaner_callback); - m_cleaner->m_file.open( std::string(stream_name.begin(), stream_name.end()).c_str() ); - m_stream = &m_cleaner->m_file; - } - } - - // Access methods - std::ostream& ref() const { return *m_stream; } - -private: - struct callback_cleaner { - callback_cleaner(boost::function<void ()> cleaner_callback) - : m_cleaner_callback(cleaner_callback) - , m_file() { - } - ~callback_cleaner() { - if( m_cleaner_callback ) - m_cleaner_callback(); - } - boost::function<void ()> m_cleaner_callback; - std::ofstream m_file; - }; - - // Data members - boost::shared_ptr<callback_cleaner> m_cleaner; - std::ostream* m_stream; -}; - -} // namespace runtime_config -} // namespace unit_test -} // namespace boost - -//____________________________________________________________________________// - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_UNIT_TEST_PARAMETERS_HPP_071894GER diff --git a/contrib/restricted/boost/test/include/boost/test/utils/algorithm.hpp b/contrib/restricted/boost/test/include/boost/test/utils/algorithm.hpp deleted file mode 100644 index d4be8565d4..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/utils/algorithm.hpp +++ /dev/null @@ -1,328 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -/// @file -/// Addition to STL algorithms -// *************************************************************************** - -#ifndef BOOST_TEST_UTILS_ALGORITHM_HPP -#define BOOST_TEST_UTILS_ALGORITHM_HPP - -#include <boost/test/detail/config.hpp> - -// STL -#include <utility> -#include <algorithm> // std::find -#include <functional> // std::bind1st or std::bind - -#include <boost/test/detail/suppress_warnings.hpp> - -#ifdef BOOST_NO_CXX98_BINDERS -#define BOOST_TEST_BIND1ST(F,A) std::bind( (F), (A), std::placeholders::_1 ) -#else -#define BOOST_TEST_BIND1ST(F,A) std::bind1st( (F), (A) ) -#endif - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { -namespace utils { - -/// @brief this algorithm search through two collections for first mismatch position that get returned as a pair -/// of iterators, first pointing to the mismatch position in first collection, second iterator in second one -/// -/// @param first1 - first collection begin iterator -/// @param last1 - first collection end iterator -/// @param first2 - second collection begin iterator -/// @param last2 - second collection end iterator -template <class InputIter1, class InputIter2> -inline std::pair<InputIter1, InputIter2> -mismatch( InputIter1 first1, InputIter1 last1, - InputIter2 first2, InputIter2 last2 ) -{ - while( first1 != last1 && first2 != last2 && *first1 == *first2 ) { - ++first1; - ++first2; - } - - return std::pair<InputIter1, InputIter2>(first1, first2); -} - -//____________________________________________________________________________// - -/// @brief this algorithm search through two collections for first mismatch position that get returned as a pair -/// of iterators, first pointing to the mismatch position in first collection, second iterator in second one. This algorithms -/// uses supplied predicate for collection elements comparison -/// -/// @param first1 - first collection begin iterator -/// @param last1 - first collection end iterator -/// @param first2 - second collection begin iterator -/// @param last2 - second collection end iterator -/// @param pred - predicate to be used for search -template <class InputIter1, class InputIter2, class Predicate> -inline std::pair<InputIter1, InputIter2> -mismatch( InputIter1 first1, InputIter1 last1, - InputIter2 first2, InputIter2 last2, - Predicate pred ) -{ - while( first1 != last1 && first2 != last2 && pred( *first1, *first2 ) ) { - ++first1; - ++first2; - } - - return std::pair<InputIter1, InputIter2>(first1, first2); -} - -//____________________________________________________________________________// - -/// @brief this algorithm search through first collection for first element that does not belong a second one -/// -/// @param first1 - first collection begin iterator -/// @param last1 - first collection end iterator -/// @param first2 - second collection begin iterator -/// @param last2 - second collection end iterator -template<class ForwardIterator1, class ForwardIterator2> -inline ForwardIterator1 -find_first_not_of( ForwardIterator1 first1, ForwardIterator1 last1, - ForwardIterator2 first2, ForwardIterator2 last2 ) -{ - while( first1 != last1 ) { - if( std::find( first2, last2, *first1 ) == last2 ) - break; - ++first1; - } - - return first1; -} - -//____________________________________________________________________________// - -/// @brief this algorithm search through first collection for first element that does not satisfy binary -/// predicate in conjunction will any element in second collection -/// -/// @param first1 - first collection begin iterator -/// @param last1 - first collection end iterator -/// @param first2 - second collection begin iterator -/// @param last2 - second collection end iterator -/// @param pred - predicate to be used for search -template<class ForwardIterator1, class ForwardIterator2, class Predicate> -inline ForwardIterator1 -find_first_not_of( ForwardIterator1 first1, ForwardIterator1 last1, - ForwardIterator2 first2, ForwardIterator2 last2, - Predicate pred ) -{ - while( first1 != last1 ) { - if( std::find_if( first2, last2, BOOST_TEST_BIND1ST( pred, *first1 ) ) == last2 ) - break; - ++first1; - } - - return first1; -} - -//____________________________________________________________________________// - -/// @brief this algorithm search through first collection for last element that belongs to a second one -/// -/// @param first1 - first collection begin iterator -/// @param last1 - first collection end iterator -/// @param first2 - second collection begin iterator -/// @param last2 - second collection end iterator -template<class BidirectionalIterator1, class ForwardIterator2> -inline BidirectionalIterator1 -find_last_of( BidirectionalIterator1 first1, BidirectionalIterator1 last1, - ForwardIterator2 first2, ForwardIterator2 last2 ) -{ - if( first1 == last1 || first2 == last2 ) - return last1; - - BidirectionalIterator1 it1 = last1; - while( --it1 != first1 && std::find( first2, last2, *it1 ) == last2 ) {} - - return it1 == first1 && std::find( first2, last2, *it1 ) == last2 ? last1 : it1; -} - -//____________________________________________________________________________// - -/// @brief this algorithm search through first collection for last element that satisfy binary -/// predicate in conjunction will at least one element in second collection -/// -/// @param first1 - first collection begin iterator -/// @param last1 - first collection end iterator -/// @param first2 - second collection begin iterator -/// @param last2 - second collection end iterator -/// @param pred - predicate to be used for search -template<class BidirectionalIterator1, class ForwardIterator2, class Predicate> -inline BidirectionalIterator1 -find_last_of( BidirectionalIterator1 first1, BidirectionalIterator1 last1, - ForwardIterator2 first2, ForwardIterator2 last2, - Predicate pred ) -{ - if( first1 == last1 || first2 == last2 ) - return last1; - - BidirectionalIterator1 it1 = last1; - while( --it1 != first1 && std::find_if( first2, last2, BOOST_TEST_BIND1ST( pred, *it1 ) ) == last2 ) {} - - return it1 == first1 && std::find_if( first2, last2, BOOST_TEST_BIND1ST( pred, *it1 ) ) == last2 ? last1 : it1; -} - -//____________________________________________________________________________// - -/// @brief this algorithm search through first collection for last element that does not belong to a second one -/// -/// @param first1 - first collection begin iterator -/// @param last1 - first collection end iterator -/// @param first2 - second collection begin iterator -/// @param last2 - second collection end iterator -template<class BidirectionalIterator1, class ForwardIterator2> -inline BidirectionalIterator1 -find_last_not_of( BidirectionalIterator1 first1, BidirectionalIterator1 last1, - ForwardIterator2 first2, ForwardIterator2 last2 ) -{ - if( first1 == last1 || first2 == last2 ) - return last1; - - BidirectionalIterator1 it1 = last1; - while( --it1 != first1 && std::find( first2, last2, *it1 ) != last2 ) {} - - return it1 == first1 && std::find( first2, last2, *it1 ) != last2 ? last1 : it1; -} - -//____________________________________________________________________________// - -/// @brief this algorithm search through first collection for last element that does not satisfy binary -/// predicate in conjunction will any element in second collection -/// -/// @param first1 - first collection begin iterator -/// @param last1 - first collection end iterator -/// @param first2 - second collection begin iterator -/// @param last2 - second collection end iterator -/// @param pred - predicate to be used for search -template<class BidirectionalIterator1, class ForwardIterator2, class Predicate> -inline BidirectionalIterator1 -find_last_not_of( BidirectionalIterator1 first1, BidirectionalIterator1 last1, - ForwardIterator2 first2, ForwardIterator2 last2, - Predicate pred ) -{ - if( first1 == last1 || first2 == last2 ) - return last1; - - BidirectionalIterator1 it1 = last1; - while( --it1 != first1 && std::find_if( first2, last2, BOOST_TEST_BIND1ST( pred, *it1 ) ) != last2 ) {} - - return it1 == first1 && std::find_if( first2, last2, BOOST_TEST_BIND1ST( pred, *it1 ) ) == last2 ? last1 : it1; -} - -//____________________________________________________________________________// - - -/// @brief This algorithm replaces all occurrences of a set of substrings by another substrings -/// -/// @param str - string of operation -/// @param first1 - iterator to the beginning of the substrings to replace -/// @param last1 - iterator to the end of the substrings to replace -/// @param first2 - iterator to the beginning of the substrings to replace with -/// @param last2 - iterator to the end of the substrings to replace with -template<class StringClass, class ForwardIterator> -inline StringClass -replace_all_occurrences_of( StringClass str, - ForwardIterator first1, ForwardIterator last1, - ForwardIterator first2, ForwardIterator last2) -{ - for(; first1 != last1 && first2 != last2; ++first1, ++first2) { - std::size_t found = str.find( *first1 ); - while( found != StringClass::npos ) { - str.replace(found, first1->size(), *first2 ); - found = str.find( *first1, found + first2->size() ); - } - } - - return str; -} - -/// @brief This algorithm replaces all occurrences of a string with basic wildcards -/// with another (optionally containing wildcards as well). -/// -/// @param str - string to transform -/// @param it_string_to_find - iterator to the beginning of the substrings to replace -/// @param it_string_to_find_end - iterator to the end of the substrings to replace -/// @param it_string_to_replace - iterator to the beginning of the substrings to replace with -/// @param it_string_to_replace_end - iterator to the end of the substrings to replace with -/// -/// The wildcard is the symbol '*'. Only a unique wildcard per string is supported. The replacement -/// string may also contain a wildcard, in which case it is considered as a placeholder to the content -/// of the wildcard in the source string. -/// Example: -/// - In order to replace the occurrences of @c 'time=\"some-variable-value\"' to a constant string, -/// one may use @c 'time=\"*\"' as the string to search for, and 'time=\"0.0\"' as the replacement string. -/// - In order to replace the occurrences of 'file.cpp(XX)' per 'file.cpp:XX', where XX is a variable to keep, -/// on may use @c 'file.cpp(*)' as the string to search for, and 'file.cpp:*' as the replacement string. -template<class StringClass, class ForwardIterator> -inline StringClass -replace_all_occurrences_with_wildcards( - StringClass str, - ForwardIterator it_string_to_find, ForwardIterator it_string_to_find_end, - ForwardIterator it_string_to_replace, ForwardIterator it_string_to_replace_end) -{ - for(; it_string_to_find != it_string_to_find_end && it_string_to_replace != it_string_to_replace_end; - ++it_string_to_find, ++ it_string_to_replace) { - - std::size_t wildcard_pos = it_string_to_find->find("*"); - if(wildcard_pos == StringClass::npos) { - ForwardIterator it_to_find_current_end(it_string_to_find); - ForwardIterator it_to_replace_current_end(it_string_to_replace); - str = replace_all_occurrences_of( - str, - it_string_to_find, ++it_to_find_current_end, - it_string_to_replace, ++it_to_replace_current_end); - continue; - } - - std::size_t wildcard_pos_replace = it_string_to_replace->find("*"); - - std::size_t found_begin = str.find( it_string_to_find->substr(0, wildcard_pos) ); - while( found_begin != StringClass::npos ) { - std::size_t found_end = str.find(it_string_to_find->substr(wildcard_pos+1), found_begin + wildcard_pos + 1); // to simplify - if( found_end != StringClass::npos ) { - - if( wildcard_pos_replace == StringClass::npos ) { - StringClass replace_content = *it_string_to_replace; - str.replace( - found_begin, - found_end + (it_string_to_find->size() - wildcard_pos - 1 ) - found_begin, - replace_content); - } else { - StringClass replace_content = - it_string_to_replace->substr(0, wildcard_pos_replace) - + str.substr(found_begin + wildcard_pos, - found_end - found_begin - wildcard_pos) - + it_string_to_replace->substr(wildcard_pos_replace+1) ; - str.replace( - found_begin, - found_end + (it_string_to_find->size() - wildcard_pos - 1 ) - found_begin, - replace_content); - - } - } - - // may adapt the restart to the replacement and be more efficient - found_begin = str.find( it_string_to_find->substr(0, wildcard_pos), found_begin + 1 ); - } - } - - return str; -} - -} // namespace utils -} // namespace unit_test -} // namespace boost - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_UTILS_ALGORITHM_HPP diff --git a/contrib/restricted/boost/test/include/boost/test/utils/assign_op.hpp b/contrib/restricted/boost/test/include/boost/test/utils/assign_op.hpp deleted file mode 100644 index 89d8bfa956..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/utils/assign_op.hpp +++ /dev/null @@ -1,39 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : overloadable assignment -// *************************************************************************** - -#ifndef BOOST_TEST_UTILS_ASSIGN_OP_HPP -#define BOOST_TEST_UTILS_ASSIGN_OP_HPP - -namespace boost { -namespace unit_test { - -// ************************************************************************** // -// ************** generic assign operator ************** // -// ************************************************************************** // - -// generic -template<typename T,typename S> -inline void -assign_op( T& t, S const& s, long ) -{ - t = s; -} - -//____________________________________________________________________________// - -} // namespace unit_test -} // namespace boost - -#endif // BOOST_TEST_UTILS_ASSIGN_OP_HPP - diff --git a/contrib/restricted/boost/test/include/boost/test/utils/basic_cstring/basic_cstring.hpp b/contrib/restricted/boost/test/include/boost/test/utils/basic_cstring/basic_cstring.hpp deleted file mode 100644 index 158bfb20d1..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/utils/basic_cstring/basic_cstring.hpp +++ /dev/null @@ -1,787 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : class basic_cstring wraps C string and provide std_string like -// interface -// *************************************************************************** - -#ifndef BOOST_TEST_UTILS_BASIC_CSTRING_HPP -#define BOOST_TEST_UTILS_BASIC_CSTRING_HPP - -// Boost.Test -#include <boost/test/utils/basic_cstring/basic_cstring_fwd.hpp> -#include <boost/test/utils/basic_cstring/bcs_char_traits.hpp> - -// Boost -#include <boost/type_traits/remove_cv.hpp> - -// STL -#include <string> - -#if defined(BOOST_TEST_STRING_VIEW) -#include <string_view> -#endif - -#include <boost/test/detail/suppress_warnings.hpp> - -//____________________________________________________________________________// - -namespace boost { - -namespace unit_test { - -// ************************************************************************** // -// ************** basic_cstring ************** // -// ************************************************************************** // - -template<typename CharT> -class BOOST_SYMBOL_VISIBLE basic_cstring { - typedef basic_cstring<CharT> self_type; -public: - // Subtypes - typedef ut_detail::bcs_char_traits<CharT> traits_type; - typedef typename traits_type::std_string std_string; - - typedef CharT value_type; - typedef typename remove_cv<value_type>::type value_ret_type; - typedef value_type* pointer; - typedef value_type const* const_pointer; - typedef value_type& reference; - typedef const value_type& const_reference; - typedef std::size_t size_type; - typedef std::ptrdiff_t difference_type; - - typedef value_type const* const_iterator; - typedef value_type* iterator; - - // !! should also present reverse_iterator, const_reverse_iterator - -#if !BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600)) && !defined(__DCC__) - BOOST_STATIC_CONSTANT(size_type, npos = static_cast<size_type>(-1)); -#else - // IBM/VisualAge version 6 is not able to handle enums larger than 4 bytes. - // But size_type is 8 bytes in 64bit mode. - static const size_type npos = -1 ; -#endif - - static pointer null_str(); - - // Constructors; default copy constructor is generated by compiler - basic_cstring(); - basic_cstring( basic_cstring const & ); - basic_cstring( std_string const& s ); - basic_cstring( pointer s ); - template<typename LenType> - basic_cstring( pointer s, LenType len ) : m_begin( s ), m_end( m_begin + len ) {} - basic_cstring( pointer first, pointer last ); - - // data access methods - value_ret_type operator[]( size_type index ) const; - value_ret_type at( size_type index ) const; - - // size operators - size_type size() const; - bool is_empty() const; - void clear(); - void resize( size_type new_len ); - - // !! only for STL container conformance use is_empty instead - bool empty() const; - - // Trimming - self_type& trim_right( size_type trim_size ); - self_type& trim_left( size_type trim_size ); - self_type& trim_right( iterator it ); - self_type& trim_left( iterator it ); -#if !BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(800)) - self_type& trim_left( self_type exclusions = self_type() ) ; - self_type& trim_right( self_type exclusions = self_type() ) ; - self_type& trim( self_type exclusions = self_type() ) ; -#else - // VA C++/XL C++ v6 and v8 has in this case a problem with the default arguments. - self_type& trim_left( self_type exclusions ); - self_type& trim_right( self_type exclusions ); - self_type& trim( self_type exclusions ); - self_type& trim_left() { return trim_left( self_type() ); } - self_type& trim_right() { return trim_right( self_type() ); } - self_type& trim() { return trim( self_type() ); } -#endif - - // Assignment operators - basic_cstring& operator=( self_type const& s ); - basic_cstring& operator=( std_string const& s ); - basic_cstring& operator=( pointer s ); - - template<typename CharT2> - basic_cstring& assign( basic_cstring<CharT2> const& s ) - { - return *this = basic_cstring<CharT>( s.begin(), s.end() ); - } - template<typename PosType, typename LenType> - basic_cstring& assign( self_type const& s, PosType pos, LenType len ) - { - return *this = self_type( s.m_begin + pos, len ); - } - - basic_cstring& assign( std_string const& s ); - template<typename PosType, typename LenType> - basic_cstring& assign( std_string const& s, PosType pos, LenType len ) - { - return *this = self_type( s.c_str() + pos, len ); - } - basic_cstring& assign( pointer s ); - template<typename LenType> - basic_cstring& assign( pointer s, LenType len ) - { - return *this = self_type( s, len ); - } - basic_cstring& assign( pointer f, pointer l ); - - // swapping - void swap( self_type& s ); - - // Iterators - iterator begin(); - const_iterator begin() const; - iterator end(); - const_iterator end() const; - - // !! should have rbegin, rend - - // substring search operation - size_type find( basic_cstring ) const; - size_type rfind( basic_cstring ) const; - self_type substr( size_type beg_index, size_type end_index = npos ) const; - -private: - static self_type default_trim_ex(); - - // Data members - iterator m_begin; - iterator m_end; - static CharT null; -}; - -// ************************************************************************** // -// ************** cstring_string_view_helper ************** // -// ************************************************************************** // - - -#if defined(BOOST_TEST_STRING_VIEW) -// Helper for instanciating a subclass of cstring using a string_view. We do not -// change the API of cstring using BOOST_TEST_STRING_VIEW as the code should remain -// compatible between boost.test and test module using different compiler options. -//! @internal -template <class CharT, class string_view_t = std::basic_string_view<CharT>> -class BOOST_SYMBOL_VISIBLE stringview_cstring_helper : public basic_cstring<CharT> { -public: - stringview_cstring_helper(string_view_t const& sv) - : basic_cstring<CharT>(const_cast<CharT*>(sv.data()), sv.size()) - {} -}; -#endif - - -// ************************************************************************** // -// ************** basic_cstring::impl ************** // -// ************************************************************************** // - -//____________________________________________________________________________// - -template<typename CharT> -CharT basic_cstring<CharT>::null = 0; - -//____________________________________________________________________________// - -template<typename CharT> -inline typename basic_cstring<CharT>::pointer -basic_cstring<CharT>::null_str() -{ - return &null; -} - -//____________________________________________________________________________// - -template<typename CharT> -inline -basic_cstring<CharT>::basic_cstring() -: m_begin( null_str() ) -, m_end( m_begin ) -{ -} - -//____________________________________________________________________________// - -template<typename CharT> -inline -basic_cstring<CharT>::basic_cstring(basic_cstring const & s) -: m_begin( s.m_begin ) -, m_end( s.m_end ) -{ -} - -//____________________________________________________________________________// - -template<typename CharT> -inline -basic_cstring<CharT>::basic_cstring( std_string const& s ) -: m_begin( s.c_str() ) -, m_end( m_begin + s.size() ) -{ -} - -//____________________________________________________________________________// - -template<typename CharT> -inline -basic_cstring<CharT>::basic_cstring( pointer s ) -: m_begin( s ? s : null_str() ) -, m_end ( m_begin + (s ? traits_type::length( s ) : 0 ) ) -{ -} - -//____________________________________________________________________________// - -template<typename CharT> -inline -basic_cstring<CharT>::basic_cstring( pointer first, pointer last ) -: m_begin( first ) -, m_end( last ) -{ -} - -//____________________________________________________________________________// - -template<typename CharT> -inline typename basic_cstring<CharT>::value_ret_type -basic_cstring<CharT>::operator[]( size_type index ) const -{ - return m_begin[index]; -} - -//____________________________________________________________________________// - -template<typename CharT> -inline typename basic_cstring<CharT>::value_ret_type -basic_cstring<CharT>::at( size_type index ) const -{ - if( m_begin + index >= m_end ) - return static_cast<value_type>(0); - - return m_begin[index]; -} - -//____________________________________________________________________________// - -template<typename CharT> -inline typename basic_cstring<CharT>::size_type -basic_cstring<CharT>::size() const -{ - return static_cast<size_type>(m_end - m_begin); -} - -//____________________________________________________________________________// - -template<typename CharT> -inline bool -basic_cstring<CharT>::is_empty() const -{ - return m_end == m_begin; -} - -//____________________________________________________________________________// - -template<typename CharT> -inline bool -basic_cstring<CharT>::empty() const -{ - return is_empty(); -} - -//____________________________________________________________________________// - -template<typename CharT> -inline void -basic_cstring<CharT>::clear() -{ - m_begin = m_end; -} - -//____________________________________________________________________________// - -template<typename CharT> -inline void -basic_cstring<CharT>::resize( size_type new_len ) -{ - if( m_begin + new_len < m_end ) - m_end = m_begin + new_len; -} - -//____________________________________________________________________________// - -template<typename CharT> -inline basic_cstring<CharT>& -basic_cstring<CharT>::trim_left( size_type trim_size ) -{ - m_begin += trim_size; - if( m_end <= m_begin ) - clear(); - - return *this; -} - -//____________________________________________________________________________// - -template<typename CharT> -inline basic_cstring<CharT>& -basic_cstring<CharT>::trim_left( iterator it ) -{ - m_begin = it; - if( m_end <= m_begin ) - clear(); - - return *this; -} - -//____________________________________________________________________________// - -template<typename CharT> -inline basic_cstring<CharT>& -basic_cstring<CharT>::trim_left( basic_cstring exclusions ) -{ - if( exclusions.is_empty() ) - exclusions = default_trim_ex(); - - iterator it; - for( it = begin(); it != end(); ++it ) { - if( traits_type::find( exclusions.begin(), exclusions.size(), *it ) == reinterpret_cast<pointer>(0) ) - break; - } - - return trim_left( it ); -} - -//____________________________________________________________________________// - -template<typename CharT> -inline basic_cstring<CharT>& -basic_cstring<CharT>::trim_right( size_type trim_size ) -{ - m_end -= trim_size; - if( m_end <= m_begin ) - clear(); - - return *this; -} - -//____________________________________________________________________________// - -template<typename CharT> -inline basic_cstring<CharT>& -basic_cstring<CharT>::trim_right( iterator it ) -{ - m_end = it; - if( m_end <= m_begin ) - clear(); - - return *this; -} - -//____________________________________________________________________________// - -template<typename CharT> -inline basic_cstring<CharT>& -basic_cstring<CharT>::trim_right( basic_cstring exclusions ) -{ - if(!size()) { - return *this; - } - - if( exclusions.is_empty() ) - exclusions = default_trim_ex(); - - iterator it = end(); - - do { - --it; - if( self_type::traits_type::find( exclusions.begin(), exclusions.size(), *it ) == reinterpret_cast<pointer>(0) ) - break; - } while(it != begin()); - - return trim_right( it + 1 ); -} - -//____________________________________________________________________________// - -template<typename CharT> -inline basic_cstring<CharT>& -basic_cstring<CharT>::trim( basic_cstring exclusions ) -{ - trim_left( exclusions ); - trim_right( exclusions ); - - return *this; -} - -//____________________________________________________________________________// - -template<typename CharT> -inline basic_cstring<CharT>& -basic_cstring<CharT>::operator=( basic_cstring<CharT> const& s ) -{ - m_begin = s.m_begin; - m_end = s.m_end; - - return *this; -} - -//____________________________________________________________________________// - -template<typename CharT> -inline basic_cstring<CharT>& -basic_cstring<CharT>::operator=( std_string const& s ) -{ - return *this = self_type( s ); -} - -//____________________________________________________________________________// - -template<typename CharT> -inline basic_cstring<CharT>& -basic_cstring<CharT>::operator=( pointer s ) -{ - return *this = self_type( s ); -} - -//____________________________________________________________________________// - -template<typename CharT> -inline basic_cstring<CharT>& -basic_cstring<CharT>::assign( std_string const& s ) -{ - return *this = self_type( s ); -} - -//____________________________________________________________________________// - -template<typename CharT> -inline basic_cstring<CharT>& -basic_cstring<CharT>::assign( pointer s ) -{ - return *this = self_type( s ); -} - -//____________________________________________________________________________// - -template<typename CharT> -inline basic_cstring<CharT>& -basic_cstring<CharT>::assign( pointer f, pointer l ) -{ - return *this = self_type( f, l ); -} - -//____________________________________________________________________________// - -template<typename CharT> -inline void -basic_cstring<CharT>::swap( basic_cstring<CharT>& s ) -{ - // do not want to include alogrithm - pointer tmp1 = m_begin; - pointer tmp2 = m_end; - - m_begin = s.m_begin; - m_end = s.m_end; - - s.m_begin = tmp1; - s.m_end = tmp2; -} - -//____________________________________________________________________________// - -template<typename CharT> -inline typename basic_cstring<CharT>::iterator -basic_cstring<CharT>::begin() -{ - return m_begin; -} - -//____________________________________________________________________________// - -template<typename CharT> -inline typename basic_cstring<CharT>::const_iterator -basic_cstring<CharT>::begin() const -{ - return m_begin; -} - -//____________________________________________________________________________// - -template<typename CharT> -inline typename basic_cstring<CharT>::iterator -basic_cstring<CharT>::end() -{ - return m_end; -} - -//____________________________________________________________________________// - -template<typename CharT> -inline typename basic_cstring<CharT>::const_iterator -basic_cstring<CharT>::end() const -{ - return m_end; -} - -//____________________________________________________________________________// - -template<typename CharT> -inline typename basic_cstring<CharT>::size_type -basic_cstring<CharT>::find( basic_cstring<CharT> str ) const -{ - if( str.is_empty() || str.size() > size() ) - return static_cast<size_type>(npos); - - const_iterator it = begin(); - const_iterator last = end() - str.size() + 1; - - while( it != last ) { - if( traits_type::compare( it, str.begin(), str.size() ) == 0 ) - break; - - ++it; - } - - return it == last ? npos : static_cast<size_type>(it - begin()); -} - -//____________________________________________________________________________// - -template<typename CharT> -inline typename basic_cstring<CharT>::size_type -basic_cstring<CharT>::rfind( basic_cstring<CharT> str ) const -{ - if( str.is_empty() || str.size() > size() ) - return static_cast<size_type>(npos); - - const_iterator it = end() - str.size(); - const_iterator last = begin()-1; - - while( it != last ) { - if( traits_type::compare( it, str.begin(), str.size() ) == 0 ) - break; - - --it; - } - - return it == last ? static_cast<size_type>(npos) : static_cast<size_type>(it - begin()); -} - -//____________________________________________________________________________// - -template<typename CharT> -inline basic_cstring<CharT> -basic_cstring<CharT>::substr( size_type beg_index, size_type end_index ) const -{ - return beg_index > size() - ? self_type() - : end_index > size() - ? self_type( m_begin + beg_index, m_end ) - : self_type( m_begin + beg_index, m_begin + end_index ); -} - -//____________________________________________________________________________// - -template<typename CharT> -inline basic_cstring<CharT> -basic_cstring<CharT>::default_trim_ex() -{ - static CharT ws[3] = { CharT(' '), CharT('\t'), CharT('\n') }; // !! wide case - - return self_type( ws, 3 ); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** comparison operators ************** // -// ************************************************************************** // - -template<typename CharT1,typename CharT2> -inline bool -operator==( basic_cstring<CharT1> const& s1, basic_cstring<CharT2> const& s2 ) -{ - typedef typename basic_cstring<CharT1>::traits_type traits_type; - return s1.size() == s2.size() && - traits_type::compare( s1.begin(), s2.begin(), s1.size() ) == 0; -} - -//____________________________________________________________________________// - -template<typename CharT1,typename CharT2> -inline bool -operator==( basic_cstring<CharT1> const& s1, CharT2* s2 ) -{ -#if !defined(__DMC__) - return s1 == basic_cstring<CharT2>( s2 ); -#else - return s1 == basic_cstring<CharT2 const>( s2 ); -#endif -} - -//____________________________________________________________________________// - -template<typename CharT> -inline bool -operator==( basic_cstring<CharT> const& s1, typename basic_cstring<CharT>::std_string const& s2 ) -{ - return s1 == basic_cstring<CharT>( s2 ); -} - -//____________________________________________________________________________// - -template<typename CharT1,typename CharT2> -inline bool -operator==( CharT1* s2, basic_cstring<CharT2> const& s1 ) -{ - return s1 == s2; -} - -//____________________________________________________________________________// - -template<typename CharT> -inline bool -operator==( typename basic_cstring<CharT>::std_string const& s2, basic_cstring<CharT> const& s1 ) -{ - return s1 == s2; -} - -//____________________________________________________________________________// - -template<typename CharT> -inline bool -operator!=( basic_cstring<CharT> const& s1, CharT* s2 ) -{ - return !(s1 == s2); -} - -//____________________________________________________________________________// - -template<typename CharT> -inline bool -operator!=( CharT* s2, basic_cstring<CharT> const& s1 ) -{ - return !(s1 == s2); -} - -//____________________________________________________________________________// - -template<typename CharT> -inline bool -operator!=( basic_cstring<CharT> const& s1, basic_cstring<CharT> const& s2 ) -{ - return !(s1 == s2); -} - -//____________________________________________________________________________// - -template<typename CharT> -inline bool -operator!=( basic_cstring<CharT> const& s1, typename basic_cstring<CharT>::std_string const& s2 ) -{ - return !(s1 == s2); -} - -//____________________________________________________________________________// - -template<typename CharT> -inline bool -operator!=( typename basic_cstring<CharT>::std_string const& s2, basic_cstring<CharT> const& s1 ) -{ - return !(s1 == s2); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** first_char ************** // -// ************************************************************************** // - -template<typename CharT> -inline typename basic_cstring<CharT>::value_ret_type -first_char( basic_cstring<CharT> source ) -{ - typedef typename basic_cstring<CharT>::value_ret_type res_type; - - return source.is_empty() ? static_cast<res_type>(0) : *source.begin(); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** last_char ************** // -// ************************************************************************** // - -template<typename CharT> -inline typename basic_cstring<CharT>::value_ret_type -last_char( basic_cstring<CharT> source ) -{ - typedef typename basic_cstring<CharT>::value_ret_type res_type; - - return source.is_empty() ? static_cast<res_type>(0) : *(source.end()-1); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** assign_op ************** // -// ************************************************************************** // - -template<typename CharT1, typename CharT2> -inline void -assign_op( std::basic_string<CharT1>& target, basic_cstring<CharT2> src, int ) -{ - target.assign( src.begin(), src.size() ); -} - -//____________________________________________________________________________// - -template<typename CharT1, typename CharT2> -inline std::basic_string<CharT1>& -operator+=( std::basic_string<CharT1>& target, basic_cstring<CharT2> const& str ) -{ - target.append( str.begin(), str.end() ); - return target; -} - -//____________________________________________________________________________// - -template<typename CharT1, typename CharT2> -inline std::basic_string<CharT1> -operator+( std::basic_string<CharT1> const& lhs, basic_cstring<CharT2> const& rhs ) -{ - std::basic_string<CharT1> res( lhs ); - - res.append( rhs.begin(), rhs.end() ); - return res; -} - -//____________________________________________________________________________// - -} // namespace unit_test - -} // namespace boost - -//____________________________________________________________________________// - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_UTILS_BASIC_CSTRING_HPP diff --git a/contrib/restricted/boost/test/include/boost/test/utils/basic_cstring/basic_cstring_fwd.hpp b/contrib/restricted/boost/test/include/boost/test/utils/basic_cstring/basic_cstring_fwd.hpp deleted file mode 100644 index 0401e83215..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/utils/basic_cstring/basic_cstring_fwd.hpp +++ /dev/null @@ -1,46 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : basic_cstring class wrap C string and provide std_string like -// interface -// *************************************************************************** - -#ifndef BOOST_TEST_UTILS_BASIC_CSTRING_FWD_HPP -#define BOOST_TEST_UTILS_BASIC_CSTRING_FWD_HPP - -#include <boost/test/detail/config.hpp> - - -namespace boost { - -namespace unit_test { - -template<typename CharT> class BOOST_SYMBOL_VISIBLE basic_cstring; -typedef basic_cstring<char const> const_string; -#if BOOST_WORKAROUND(__DECCXX_VER, BOOST_TESTED_AT(60590041)) -typedef const_string literal_string; -#else -typedef const_string const literal_string; -#endif - -typedef char const* const c_literal_string; - -#if defined(BOOST_TEST_STRING_VIEW) -template <class CharT, class string_view_t> -class BOOST_SYMBOL_VISIBLE stringview_cstring_helper; -#endif - - -} // namespace unit_test - -} // namespace boost - -#endif // BOOST_TEST_UTILS_BASIC_CSTRING_FWD_HPP diff --git a/contrib/restricted/boost/test/include/boost/test/utils/basic_cstring/bcs_char_traits.hpp b/contrib/restricted/boost/test/include/boost/test/utils/basic_cstring/bcs_char_traits.hpp deleted file mode 100644 index 05b6ffa6be..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/utils/basic_cstring/bcs_char_traits.hpp +++ /dev/null @@ -1,150 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : generic char traits class; wraps std::char_traits -// *************************************************************************** - -#ifndef BOOST_TEST_UTILS_BCS_CHAR_TRAITS_HPP -#define BOOST_TEST_UTILS_BCS_CHAR_TRAITS_HPP - -// Boost -#include <boost/config.hpp> -#include <boost/detail/workaround.hpp> -#include <boost/test/detail/config.hpp> -#include <boost/type_traits/add_const.hpp> - -// STL -#include <string> // std::char_traits -#include <cstddef> // std::size_t - -#include <boost/test/detail/suppress_warnings.hpp> - -//____________________________________________________________________________// - -namespace boost { - -namespace unit_test { - -namespace ut_detail { - -template<typename CharT> struct bcs_base_char { typedef CharT type; }; - -template<> struct bcs_base_char<char const> { typedef char type; }; -template<> struct bcs_base_char<unsigned char> { typedef char type; }; -#if !BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x551)) -template<> struct bcs_base_char<unsigned char const> { typedef char type; }; -#endif - -template<> struct bcs_base_char<wchar_t const> { typedef wchar_t type; }; - -// ************************************************************************** // -// ************** bcs_char_traits ************** // -// ************************************************************************** // - -template<typename CharT> -struct bcs_char_traits_impl -{ -#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564)) - typedef CharT const const_char; -#else - typedef typename boost::add_const<CharT>::type const_char; -#endif - static bool eq( CharT c1, CharT c2 ) - { - return c1 == c2; - } - static bool lt( CharT c1, CharT c2 ) - { - return c1 < c2; - } - - static int compare( const_char* cstr1, const_char* cstr2, std::size_t n ) - { - while( n > 0 ) { - if( !eq( *cstr1, *cstr2 ) ) - return lt( *cstr1, *cstr2 ) ? -1 : 1; - ++cstr1; - ++cstr2; - --n; - } - - return 0; - } - - static std::size_t length( const_char* cstr ) - { - const_char null_char = CharT(); - - const_char* ptr = cstr; - while( !eq( *ptr, null_char ) ) - ++ptr; - - return ptr - cstr; - } - - static const_char* find( const_char* s, std::size_t n, CharT c ) - { - while( n > 0 ) { - if( eq( *s, c ) ) - return s; - - ++s; - --n; - } - return 0; - } -}; - -#ifdef BOOST_CLASSIC_IOSTREAMS -template<typename CharT> -struct char_traits_with_find : std::string_char_traits<CharT> { - static CharT const* find( CharT const* s, std::size_t n, CharT c ) - { - while( n > 0 ) { - if( eq( *s, c ) ) - return s; - - ++s; - --n; - } - return 0; - } -}; - -template<> struct bcs_char_traits_impl<char> : public char_traits_with_find<char> {}; -template<> struct bcs_char_traits_impl<wchar_t> : public char_traits_with_find<wchar_t> {}; -#else -template<> struct bcs_char_traits_impl<char> : public std::char_traits<char> {}; -template<> struct bcs_char_traits_impl<wchar_t> : public std::char_traits<wchar_t> {}; -#endif - -template<typename CharT> -class bcs_char_traits : public bcs_char_traits_impl<CharT> { - typedef typename ut_detail::bcs_base_char<CharT>::type the_base_char; -public: -#ifdef BOOST_CLASSIC_IOSTREAMS - typedef std::basic_string<the_base_char, std::string_char_traits<the_base_char> > std_string; -#else - typedef std::basic_string<the_base_char, std::char_traits<the_base_char> > std_string; -#endif -}; - -} // namespace ut_detail - -} // namespace unit_test - -} // namespace boost - -//____________________________________________________________________________// - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_UTILS_BCS_CHAR_TRAITS_HPP diff --git a/contrib/restricted/boost/test/include/boost/test/utils/basic_cstring/compare.hpp b/contrib/restricted/boost/test/include/boost/test/utils/basic_cstring/compare.hpp deleted file mode 100644 index 0f728e6f4c..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/utils/basic_cstring/compare.hpp +++ /dev/null @@ -1,151 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : class basic_cstring comparisons implementation -// *************************************************************************** - -#ifndef BOOST_TEST_UTILS_BASIC_CSTRING_COMPARE_HPP -#define BOOST_TEST_UTILS_BASIC_CSTRING_COMPARE_HPP - -// Boost.Test -#include <boost/test/utils/basic_cstring/basic_cstring.hpp> - -// STL -#include <functional> -#include <cctype> - -#include <boost/test/detail/suppress_warnings.hpp> - -//____________________________________________________________________________// - -# if defined(BOOST_NO_STDC_NAMESPACE) && !BOOST_WORKAROUND(BOOST_BORLANDC, <= 0x570) -namespace std { using ::toupper; } -# endif - -namespace boost { - -namespace unit_test { - -// ************************************************************************** // -// ************** case_ins_compare ************** // -// ************************************************************************** // - -namespace ut_detail { - -template<class CharT> -struct case_ins -{ - static bool eq( CharT c1, CharT c2 ) { return (std::toupper)( c1 ) == (std::toupper)( c2 ); } - static bool lt( CharT c1, CharT c2 ) { return (std::toupper)( c1 ) < (std::toupper)( c2 ); } - - static int compare( CharT const* s1, CharT const* s2, std::size_t n ) - { - for( std::size_t i = 0; i < n; ++i ) { - if( !eq( s1[i], s2[i] ) ) - return lt( s1[i], s2[i] ) ? -1 : 1; - } - return 0; - } -}; - -} // namespace ut_detail - -// ************************************************************************** // -// ************** case_ins_eq ************** // -// ************************************************************************** // - -template<class CharT> -inline bool -case_ins_eq( basic_cstring<CharT> x, basic_cstring<CharT> y ) -{ - return x.size() == y.size() && ut_detail::case_ins<CharT>::compare( x.begin(), y.begin(), x.size() ) == 0; -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** case_ins_less ************** // -// ************************************************************************** // - -template<class CharT> -class case_ins_less -{ -public: - typedef bool result_type; - typedef basic_cstring<CharT> first_argument_type; - typedef basic_cstring<CharT> second_argument_type; - - bool operator()( basic_cstring<CharT> x, basic_cstring<CharT> y ) const - { - return x.size() != y.size() - ? x.size() < y.size() - : ut_detail::case_ins<CharT>::compare( x.begin(), y.begin(), x.size() ) < 0; - } -}; - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** operators <,> ************** // -// ************************************************************************** // - -template<class CharT> -inline bool -operator <( boost::unit_test::basic_cstring<CharT> const& x, - boost::unit_test::basic_cstring<CharT> const& y ) -{ - typedef typename boost::unit_test::basic_cstring<CharT>::traits_type traits_type; - return x.size() != y.size() - ? x.size() < y.size() - : traits_type::compare( x.begin(), y.begin(), x.size() ) < 0; -} - -//____________________________________________________________________________// - -template<class CharT> -inline bool -operator <=( boost::unit_test::basic_cstring<CharT> const& x, - boost::unit_test::basic_cstring<CharT> const& y ) -{ - return !(y < x); -} - -//____________________________________________________________________________// - -template<class CharT> -inline bool -operator >( boost::unit_test::basic_cstring<CharT> const& x, - boost::unit_test::basic_cstring<CharT> const& y ) -{ - return y < x; -} - -//____________________________________________________________________________// - -template<class CharT> -inline bool -operator >=( boost::unit_test::basic_cstring<CharT> const& x, - boost::unit_test::basic_cstring<CharT> const& y ) -{ - return !(x < y); -} - -//____________________________________________________________________________// - -} // namespace unit_test - -} // namespace boost - -//____________________________________________________________________________// - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_BASIC_CSTRING_COMPARE_HPP_071894GER diff --git a/contrib/restricted/boost/test/include/boost/test/utils/basic_cstring/io.hpp b/contrib/restricted/boost/test/include/boost/test/utils/basic_cstring/io.hpp deleted file mode 100644 index 02ccb126f8..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/utils/basic_cstring/io.hpp +++ /dev/null @@ -1,73 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : basic_cstring i/o implementation -// *************************************************************************** - -#ifndef BOOST_TEST_UTILS_BASIC_CSTRING_IO_HPP -#define BOOST_TEST_UTILS_BASIC_CSTRING_IO_HPP - -// Boost.Test -#include <boost/test/utils/basic_cstring/basic_cstring.hpp> - -// STL -#include <iosfwd> -#include <string> - -#include <boost/test/detail/suppress_warnings.hpp> - -//____________________________________________________________________________// - -namespace boost { - -namespace unit_test { - -#ifdef BOOST_CLASSIC_IOSTREAMS - -template<typename CharT> -inline std::ostream& -operator<<( std::ostream& os, basic_cstring<CharT> const& str ) -{ - typedef typename ut_detail::bcs_base_char<CharT>::type char_type; - char_type const* const beg = reinterpret_cast<char_type const* const>( str.begin() ); - char_type const* const end = reinterpret_cast<char_type const* const>( str.end() ); - os << std::basic_string<char_type>( beg, end - beg ); - - return os; -} - -#else - -template<typename CharT1, typename Tr,typename CharT2> -inline std::basic_ostream<CharT1,Tr>& -operator<<( std::basic_ostream<CharT1,Tr>& os, basic_cstring<CharT2> const& str ) -{ - CharT1 const* const beg = reinterpret_cast<CharT1 const*>( str.begin() ); // !! - CharT1 const* const end = reinterpret_cast<CharT1 const*>( str.end() ); - os << std::basic_string<CharT1,Tr>( beg, end - beg ); - - return os; -} - -#endif - -//____________________________________________________________________________// - - -} // namespace unit_test - -} // namespace boost - -//____________________________________________________________________________// - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_BASIC_CSTRING_IO_HPP_071894GER diff --git a/contrib/restricted/boost/test/include/boost/test/utils/class_properties.hpp b/contrib/restricted/boost/test/include/boost/test/utils/class_properties.hpp deleted file mode 100644 index d4f3db3f2d..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/utils/class_properties.hpp +++ /dev/null @@ -1,195 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : simple facility that mimmic notion of read-only read-write -// properties in C++ classes. Original idea by Henrik Ravn. -// *************************************************************************** - -#ifndef BOOST_TEST_UTILS_CLASS_PROPERTIES_HPP -#define BOOST_TEST_UTILS_CLASS_PROPERTIES_HPP - -// Boost.Test -#include <boost/test/detail/config.hpp> - -// Boost -#if !BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600)) -#include <boost/preprocessor/seq/for_each.hpp> -#endif -#include <boost/call_traits.hpp> -#include <boost/type_traits/add_pointer.hpp> -#include <boost/type_traits/add_const.hpp> -#include <boost/utility/addressof.hpp> - -// STL -#include <iosfwd> - -#include <boost/test/detail/suppress_warnings.hpp> - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { - -// ************************************************************************** // -// ************** class_property ************** // -// ************************************************************************** // - -template<class PropertyType> -class class_property { -protected: - typedef typename call_traits<PropertyType>::const_reference read_access_t; - typedef typename call_traits<PropertyType>::param_type write_param_t; - typedef typename add_pointer<typename add_const<PropertyType>::type>::type address_res_t; -public: - // Constructor - class_property() : value( PropertyType() ) {} - explicit class_property( write_param_t init_value ) - : value( init_value ) {} - - // Access methods - operator read_access_t() const { return value; } - read_access_t get() const { return value; } - bool operator!() const { return !value; } - address_res_t operator&() const { return &value; } - - // Data members -#ifndef BOOST_TEST_NO_PROTECTED_USING -protected: -#endif - PropertyType value; -}; - -//____________________________________________________________________________// - -#ifdef BOOST_CLASSIC_IOSTREAMS - -template<class PropertyType> -inline std::ostream& -operator<<( std::ostream& os, class_property<PropertyType> const& p ) - -#else - -template<typename CharT1, typename Tr,class PropertyType> -inline std::basic_ostream<CharT1,Tr>& -operator<<( std::basic_ostream<CharT1,Tr>& os, class_property<PropertyType> const& p ) - -#endif -{ - return os << p.get(); -} - -//____________________________________________________________________________// - -#define DEFINE_PROPERTY_FREE_BINARY_OPERATOR( op ) \ -template<class PropertyType> \ -inline bool \ -operator op( PropertyType const& lhs, class_property<PropertyType> const& rhs ) \ -{ \ - return lhs op rhs.get(); \ -} \ -template<class PropertyType> \ -inline bool \ -operator op( class_property<PropertyType> const& lhs, PropertyType const& rhs ) \ -{ \ - return lhs.get() op rhs; \ -} \ -template<class PropertyType> \ -inline bool \ -operator op( class_property<PropertyType> const& lhs, \ - class_property<PropertyType> const& rhs ) \ -{ \ - return lhs.get() op rhs.get(); \ -} \ -/**/ - -DEFINE_PROPERTY_FREE_BINARY_OPERATOR( == ) -DEFINE_PROPERTY_FREE_BINARY_OPERATOR( != ) - -#undef DEFINE_PROPERTY_FREE_BINARY_OPERATOR - -// ************************************************************************** // -// ************** readonly_property ************** // -// ************************************************************************** // - -template<class PropertyType> -class readonly_property : public class_property<PropertyType> { - typedef class_property<PropertyType> base_prop; - typedef typename base_prop::address_res_t arrow_res_t; -protected: - typedef typename base_prop::write_param_t write_param_t; -public: - // Constructor - readonly_property() {} - explicit readonly_property( write_param_t init_value ) : base_prop( init_value ) {} - - // access methods - arrow_res_t operator->() const { return boost::addressof( base_prop::value ); } -}; - -//____________________________________________________________________________// - -#if BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600)) - -#define BOOST_READONLY_PROPERTY( property_type, friends ) boost::unit_test::readwrite_property<property_type > - -#else - -#define BOOST_READONLY_PROPERTY_DECLARE_FRIEND(r, data, elem) friend class elem; - -#define BOOST_READONLY_PROPERTY( property_type, friends ) \ -class BOOST_JOIN( readonly_property, __LINE__ ) \ -: public boost::unit_test::readonly_property<property_type > { \ - typedef boost::unit_test::readonly_property<property_type > base_prop; \ - BOOST_PP_SEQ_FOR_EACH( BOOST_READONLY_PROPERTY_DECLARE_FRIEND, ' ', friends ) \ - typedef base_prop::write_param_t write_param_t; \ -public: \ - BOOST_JOIN( readonly_property, __LINE__ )() {} \ - explicit BOOST_JOIN( readonly_property, __LINE__ )( write_param_t init_v ) \ - : base_prop( init_v ) {} \ -} \ -/**/ - -#endif - -// ************************************************************************** // -// ************** readwrite_property ************** // -// ************************************************************************** // - -template<class PropertyType> -class readwrite_property : public class_property<PropertyType> { - typedef class_property<PropertyType> base_prop; - typedef typename add_pointer<PropertyType>::type arrow_res_t; - typedef typename base_prop::address_res_t const_arrow_res_t; - typedef typename base_prop::write_param_t write_param_t; -public: - readwrite_property() : base_prop() {} - explicit readwrite_property( write_param_t init_value ) : base_prop( init_value ) {} - - // access methods - void set( write_param_t v ) { base_prop::value = v; } - arrow_res_t operator->() { return boost::addressof( base_prop::value ); } - const_arrow_res_t operator->() const { return boost::addressof( base_prop::value ); } - -#ifndef BOOST_TEST_NO_PROTECTED_USING - using base_prop::value; -#endif -}; - -//____________________________________________________________________________// - -} // unit_test -} // namespace boost - -#include <boost/test/detail/enable_warnings.hpp> - -#undef BOOST_TEST_NO_PROTECTED_USING - -#endif // BOOST_TEST_UTILS_CLASS_PROPERTIES_HPP diff --git a/contrib/restricted/boost/test/include/boost/test/utils/custom_manip.hpp b/contrib/restricted/boost/test/include/boost/test/utils/custom_manip.hpp deleted file mode 100644 index d5ddaf5c07..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/utils/custom_manip.hpp +++ /dev/null @@ -1,61 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : simple helpers for creating cusom output manipulators -// *************************************************************************** - -#ifndef BOOST_TEST_UTILS_CUSTOM_MANIP_HPP -#define BOOST_TEST_UTILS_CUSTOM_MANIP_HPP - -// STL -#include <iosfwd> - -#include <boost/test/detail/suppress_warnings.hpp> - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { -namespace utils { - -// ************************************************************************** // -// ************** custom manipulators helpers ************** // -// ************************************************************************** // - -template<typename Manip> -struct custom_printer { - explicit custom_printer( std::ostream& ostr ) : m_ostr( &ostr ) {} - - std::ostream& operator*() const { return *m_ostr; } - -private: - std::ostream* const m_ostr; -}; - -//____________________________________________________________________________// - -template<typename Uniq> struct custom_manip {}; - -//____________________________________________________________________________// - -template<typename Uniq> -inline custom_printer<custom_manip<Uniq> > -operator<<( std::ostream& ostr, custom_manip<Uniq> const& ) { return custom_printer<custom_manip<Uniq> >( ostr ); } - -//____________________________________________________________________________// - -} // namespace utils -} // namespace unit_test -} // namespace boost - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_UTILS_CUSTOM_MANIP_HPP diff --git a/contrib/restricted/boost/test/include/boost/test/utils/foreach.hpp b/contrib/restricted/boost/test/include/boost/test/utils/foreach.hpp deleted file mode 100644 index ea1adc58cc..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/utils/foreach.hpp +++ /dev/null @@ -1,315 +0,0 @@ -// (C) Copyright Eric Niebler 2004-2005 -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : this is an abridged version of an excelent BOOST_FOREACH facility -// presented by Eric Niebler. I am so fond of it so I can't wait till it -// going to be accepted into Boost. Also I need version with less number of dependencies -// and more portable. This version doesn't support rvalues and will reeveluate it's -// parameters, but should be good enough for my purposes. -// *************************************************************************** - -#ifndef BOOST_TEST_UTILS_FOREACH_HPP -#define BOOST_TEST_UTILS_FOREACH_HPP - -// Boost.Test -#include <boost/test/detail/config.hpp> - -// Boost -#include <boost/type.hpp> -#include <boost/mpl/bool.hpp> - -#include <boost/type_traits/is_const.hpp> - -#include <boost/test/detail/suppress_warnings.hpp> - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { -namespace for_each { - -// ************************************************************************** // -// ************** static_any ************** // -// ************************************************************************** // - -struct static_any_base -{ - operator bool() const { return false; } -}; - -//____________________________________________________________________________// - -template<typename Iter> -struct static_any : static_any_base -{ - static_any( Iter const& t ) : m_it( t ) {} - - mutable Iter m_it; -}; - -//____________________________________________________________________________// - -typedef static_any_base const& static_any_t; - -//____________________________________________________________________________// - -template<typename Iter> -inline Iter& -static_any_cast( static_any_t a, Iter* = 0 ) -{ - return static_cast<Iter&>( static_cast<static_any<Iter> const&>( a ).m_it ); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** is_const ************** // -// ************************************************************************** // - -template<typename C> -inline is_const<C> -is_const_coll( C& ) -{ - return is_const<C>(); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** begin ************** // -// ************************************************************************** // - -template<typename C> -inline static_any<BOOST_DEDUCED_TYPENAME C::iterator> -begin( C& t, mpl::false_ ) -{ - return static_any<BOOST_DEDUCED_TYPENAME C::iterator>( t.begin() ); -} - -//____________________________________________________________________________// - -template<typename C> -inline static_any<BOOST_DEDUCED_TYPENAME C::const_iterator> -begin( C const& t, mpl::true_ ) -{ - return static_any<BOOST_DEDUCED_TYPENAME C::const_iterator>( t.begin() ); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** end ************** // -// ************************************************************************** // - -template<typename C> -inline static_any<BOOST_DEDUCED_TYPENAME C::iterator> -end( C& t, mpl::false_ ) -{ - return static_any<BOOST_DEDUCED_TYPENAME C::iterator>( t.end() ); -} - -//____________________________________________________________________________// - -template<typename C> -inline static_any<BOOST_DEDUCED_TYPENAME C::const_iterator> -end( C const& t, mpl::true_ ) -{ - return static_any<BOOST_DEDUCED_TYPENAME C::const_iterator>( t.end() ); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** done ************** // -// ************************************************************************** // - -template<typename C> -inline bool -done( static_any_t cur, static_any_t end, C&, mpl::false_ ) -{ - return static_any_cast<BOOST_DEDUCED_TYPENAME C::iterator>( cur ) == - static_any_cast<BOOST_DEDUCED_TYPENAME C::iterator>( end ); -} - -//____________________________________________________________________________// - -template<typename C> -inline bool -done( static_any_t cur, static_any_t end, C const&, mpl::true_ ) -{ - return static_any_cast<BOOST_DEDUCED_TYPENAME C::const_iterator>( cur ) == - static_any_cast<BOOST_DEDUCED_TYPENAME C::const_iterator>( end ); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** next ************** // -// ************************************************************************** // - -template<typename C> -inline void -next( static_any_t cur, C&, mpl::false_ ) -{ - ++static_any_cast<BOOST_DEDUCED_TYPENAME C::iterator>( cur ); -} - -//____________________________________________________________________________// - -template<typename C> -inline void -next( static_any_t cur, C const&, mpl::true_ ) -{ - ++static_any_cast<BOOST_DEDUCED_TYPENAME C::const_iterator>( cur ); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** prev ************** // -// ************************************************************************** // - -template<typename C> -inline void -prev( static_any_t cur, C&, mpl::false_ ) -{ - --static_any_cast<BOOST_DEDUCED_TYPENAME C::iterator>( cur ); -} - -//____________________________________________________________________________// - -template<typename C> -inline void -prev( static_any_t cur, C const&, mpl::true_ ) -{ - --static_any_cast<BOOST_DEDUCED_TYPENAME C::const_iterator>( cur ); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** deref ************** // -// ************************************************************************** // - -template<class RefType,typename C> -inline RefType -deref( static_any_t cur, C&, ::boost::type<RefType>, mpl::false_ ) -{ - return *static_any_cast<BOOST_DEDUCED_TYPENAME C::iterator>( cur ); -} - -//____________________________________________________________________________// - -template<class RefType,typename C> -inline RefType -deref( static_any_t cur, C const&, ::boost::type<RefType>, mpl::true_ ) -{ - return *static_any_cast<BOOST_DEDUCED_TYPENAME C::const_iterator>( cur ); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** BOOST_TEST_FOREACH ************** // -// ************************************************************************** // - -#define BOOST_TEST_FE_ANY ::boost::unit_test::for_each::static_any_t -#define BOOST_TEST_FE_IS_CONST( COL ) ::boost::unit_test::for_each::is_const_coll( COL ) - -#define BOOST_TEST_FE_BEG( COL ) \ - ::boost::unit_test::for_each::begin( \ - COL, \ - BOOST_TEST_FE_IS_CONST( COL ) ) \ -/**/ - -#define BOOST_TEST_FE_END( COL ) \ - ::boost::unit_test::for_each::end( \ - COL, \ - BOOST_TEST_FE_IS_CONST( COL ) ) \ -/**/ - -#define BOOST_TEST_FE_DONE( COL ) \ - ::boost::unit_test::for_each::done( \ - BOOST_TEST_FE_CUR_VAR, \ - BOOST_TEST_FE_END_VAR, \ - COL, \ - BOOST_TEST_FE_IS_CONST( COL ) ) \ -/**/ - -#define BOOST_TEST_FE_NEXT( COL ) \ - ::boost::unit_test::for_each::next( \ - BOOST_TEST_FE_CUR_VAR, \ - COL, \ - BOOST_TEST_FE_IS_CONST( COL ) ) \ -/**/ - -#define BOOST_TEST_FE_PREV( COL ) \ - ::boost::unit_test::for_each::prev( \ - BOOST_TEST_FE_CUR_VAR, \ - COL, \ - BOOST_TEST_FE_IS_CONST( COL ) ) \ -/**/ - -#define BOOST_FOREACH_NOOP(COL) \ - ((void)&(COL)) - -#define BOOST_TEST_FE_DEREF( COL, RefType ) \ - ::boost::unit_test::for_each::deref( \ - BOOST_TEST_FE_CUR_VAR, \ - COL, \ - ::boost::type<RefType >(), \ - BOOST_TEST_FE_IS_CONST( COL ) ) \ -/**/ - -#if BOOST_WORKAROUND( BOOST_MSVC, == 1310 ) -#define BOOST_TEST_LINE_NUM -#else -#define BOOST_TEST_LINE_NUM __LINE__ -#endif - -#define BOOST_TEST_FE_CUR_VAR BOOST_JOIN( _fe_cur_, BOOST_TEST_LINE_NUM ) -#define BOOST_TEST_FE_END_VAR BOOST_JOIN( _fe_end_, BOOST_TEST_LINE_NUM ) -#define BOOST_TEST_FE_CON_VAR BOOST_JOIN( _fe_con_, BOOST_TEST_LINE_NUM ) - -#define BOOST_TEST_FOREACH( RefType, var, COL ) \ -if( BOOST_TEST_FE_ANY BOOST_TEST_FE_CUR_VAR = BOOST_TEST_FE_BEG( COL ) ) {} else \ -if( BOOST_TEST_FE_ANY BOOST_TEST_FE_END_VAR = BOOST_TEST_FE_END( COL ) ) {} else \ -for( bool BOOST_TEST_FE_CON_VAR = true; \ - BOOST_TEST_FE_CON_VAR && !BOOST_TEST_FE_DONE( COL ); \ - BOOST_TEST_FE_CON_VAR ? BOOST_TEST_FE_NEXT( COL ) : BOOST_FOREACH_NOOP( COL )) \ - \ - if( (BOOST_TEST_FE_CON_VAR = false, false) ) {} else \ - for( RefType var = BOOST_TEST_FE_DEREF( COL, RefType ); \ - !BOOST_TEST_FE_CON_VAR; BOOST_TEST_FE_CON_VAR = true ) \ -/**/ - -#define BOOST_TEST_REVERSE_FOREACH( RefType, var, COL ) \ -if( BOOST_TEST_FE_ANY BOOST_TEST_FE_CUR_VAR = BOOST_TEST_FE_END( COL ) ) {} else \ -if( BOOST_TEST_FE_ANY BOOST_TEST_FE_END_VAR = BOOST_TEST_FE_BEG( COL ) ) {} else \ -for( bool BOOST_TEST_FE_CON_VAR = true; \ - BOOST_TEST_FE_CON_VAR && !BOOST_TEST_FE_DONE( COL ); ) \ - \ - if( (BOOST_TEST_FE_CON_VAR = false, false) ) {} else \ - if( (BOOST_TEST_FE_PREV( COL ), false) ) {} else \ - for( RefType var = BOOST_TEST_FE_DEREF( COL, RefType ); \ - !BOOST_TEST_FE_CON_VAR; BOOST_TEST_FE_CON_VAR = true ) \ -/**/ - -//____________________________________________________________________________// - -} // namespace for_each -} // namespace unit_test -} // namespace boost - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_UTILS_FOREACH_HPP diff --git a/contrib/restricted/boost/test/include/boost/test/utils/is_cstring.hpp b/contrib/restricted/boost/test/include/boost/test/utils/is_cstring.hpp deleted file mode 100644 index ffec3657ac..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/utils/is_cstring.hpp +++ /dev/null @@ -1,133 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -//! @file -//! Defines the is_cstring type trait -// *************************************************************************** - -#ifndef BOOST_TEST_UTILS_IS_CSTRING_HPP -#define BOOST_TEST_UTILS_IS_CSTRING_HPP - -// Boost -#include <boost/mpl/bool.hpp> -#include <boost/type_traits/is_same.hpp> -#include <boost/type_traits/decay.hpp> -#include <boost/type_traits/remove_pointer.hpp> -#include <boost/type_traits/remove_const.hpp> -#include <boost/type_traits/add_const.hpp> - -#include <boost/test/utils/basic_cstring/basic_cstring_fwd.hpp> -#include <string> - -#if defined(BOOST_TEST_STRING_VIEW) -#include <string_view> -#endif - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { - -// ************************************************************************** // -// ************** is_cstring ************** // -// ************************************************************************** // - -namespace ut_detail { - -template<typename T> -struct is_cstring_impl : public mpl::false_ {}; - -template<typename T> -struct is_cstring_impl<T const*> : public is_cstring_impl<T*> {}; - -template<typename T> -struct is_cstring_impl<T const* const> : public is_cstring_impl<T*> {}; - -template<> -struct is_cstring_impl<char*> : public mpl::true_ {}; - -template<> -struct is_cstring_impl<wchar_t*> : public mpl::true_ {}; - -template <typename T, bool is_cstring = is_cstring_impl<typename boost::decay<T>::type>::value > -struct deduce_cstring_transform_impl; - -template <typename T, bool is_cstring > -struct deduce_cstring_transform_impl<T&, is_cstring> : public deduce_cstring_transform_impl<T, is_cstring>{}; - -template <typename T, bool is_cstring > -struct deduce_cstring_transform_impl<T const, is_cstring> : public deduce_cstring_transform_impl<T, is_cstring>{}; - -template <typename T> -struct deduce_cstring_transform_impl<T, true> { - typedef typename boost::add_const< - typename boost::remove_pointer< - typename boost::decay<T>::type - >::type - >::type U; - typedef boost::unit_test::basic_cstring<U> type; -}; - -template <typename T> -struct deduce_cstring_transform_impl< T, false > { - typedef typename - boost::remove_const< - typename boost::remove_reference<T>::type - >::type type; -}; - -template <typename T> -struct deduce_cstring_transform_impl< std::basic_string<T, std::char_traits<T> >, false > { - typedef boost::unit_test::basic_cstring<typename boost::add_const<T>::type> type; -}; - -#if defined(BOOST_TEST_STRING_VIEW) -template <typename T> -struct deduce_cstring_transform_impl< std::basic_string_view<T, std::char_traits<T> >, false > { -private: - using sv_t = std::basic_string_view<T, std::char_traits<T> > ; - -public: - using type = stringview_cstring_helper<typename boost::add_const<T>::type, sv_t>; -}; -#endif - -} // namespace ut_detail - -template<typename T> -struct is_cstring : public ut_detail::is_cstring_impl<typename decay<T>::type> {}; - -template<typename T, bool is_cstring = is_cstring<typename boost::decay<T>::type>::value > -struct is_cstring_comparable: public mpl::false_ {}; - -template<typename T> -struct is_cstring_comparable< T, true > : public mpl::true_ {}; - -template<typename T> -struct is_cstring_comparable< std::basic_string<T, std::char_traits<T> >, false > : public mpl::true_ {}; - -#if defined(BOOST_TEST_STRING_VIEW) -template<typename T> -struct is_cstring_comparable< std::basic_string_view<T, std::char_traits<T> >, false > : public mpl::true_ {}; -#endif - -template<typename T> -struct is_cstring_comparable< boost::unit_test::basic_cstring<T>, false > : public mpl::true_ {}; - -template <class T> -struct deduce_cstring_transform { - typedef typename - boost::remove_const< - typename boost::remove_reference<T>::type - >::type U; - typedef typename ut_detail::deduce_cstring_transform_impl<typename boost::decay<U>::type>::type type; -}; - -} // namespace unit_test -} // namespace boost - -#endif // BOOST_TEST_UTILS_IS_CSTRING_HPP diff --git a/contrib/restricted/boost/test/include/boost/test/utils/is_forward_iterable.hpp b/contrib/restricted/boost/test/include/boost/test/utils/is_forward_iterable.hpp deleted file mode 100644 index d6d8dd8a85..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/utils/is_forward_iterable.hpp +++ /dev/null @@ -1,267 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -//! @file -//! Defines the is_forward_iterable collection type trait -// *************************************************************************** - -#ifndef BOOST_TEST_UTILS_IS_FORWARD_ITERABLE_HPP -#define BOOST_TEST_UTILS_IS_FORWARD_ITERABLE_HPP - -#if defined(BOOST_NO_CXX11_DECLTYPE) || \ - defined(BOOST_NO_CXX11_NULLPTR) || \ - defined(BOOST_NO_CXX11_TRAILING_RESULT_TYPES) - - // this feature works with VC2012 upd 5 while BOOST_NO_CXX11_TRAILING_RESULT_TYPES is defined - #if !defined(BOOST_MSVC) || BOOST_MSVC_FULL_VER < 170061232 /* VC2012 upd 5 */ - #define BOOST_TEST_FWD_ITERABLE_CXX03 - #endif -#endif - -#if defined(BOOST_TEST_FWD_ITERABLE_CXX03) -// Boost -#include <boost/mpl/bool.hpp> - -// STL -#include <list> -#include <vector> -#include <map> -#include <set> - -#else - -// Boost -#include <boost/static_assert.hpp> -#include <boost/utility/declval.hpp> -#include <boost/type_traits/is_same.hpp> -#include <boost/type_traits/remove_reference.hpp> -#include <boost/type_traits/remove_cv.hpp> -#include <boost/test/utils/is_cstring.hpp> - -// STL -#include <utility> -#include <type_traits> - -#endif -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { - -template<typename T> -struct is_forward_iterable; - -// ************************************************************************** // -// ************** is_forward_iterable ************** // -// ************************************************************************** // - -#if defined(BOOST_TEST_FWD_ITERABLE_CXX03) && !defined(BOOST_TEST_DOXYGEN_DOC__) -template<typename T> -struct is_forward_iterable : public mpl::false_ {}; - -template<typename T> -struct is_forward_iterable<T const> : public is_forward_iterable<T> {}; - -template<typename T> -struct is_forward_iterable<T&> : public is_forward_iterable<T> {}; - -template<typename T, std::size_t N> -struct is_forward_iterable< T [N] > : public mpl::true_ {}; - -template<typename T, typename A> -struct is_forward_iterable< std::vector<T, A> > : public mpl::true_ {}; - -template<typename T, typename A> -struct is_forward_iterable< std::list<T, A> > : public mpl::true_ {}; - -template<typename K, typename V, typename C, typename A> -struct is_forward_iterable< std::map<K, V, C, A> > : public mpl::true_ {}; - -template<typename K, typename C, typename A> -struct is_forward_iterable< std::set<K, C, A> > : public mpl::true_ {}; - -// string is also forward iterable, even if sometimes we want to treat the -// assertions differently. -template<> -struct is_forward_iterable< std::string > : public mpl::true_ {}; - -#else - -namespace ut_detail { - -// SFINAE helper -template<typename T> -struct is_present : public mpl::true_ {}; - -//____________________________________________________________________________// - -// some compiler do not implement properly decltype non expression involving members (eg. VS2013) -// a workaround is to use -> decltype syntax. -template <class T> -struct has_member_size { -private: - struct nil_t {}; - template<typename U> static auto test( U* ) -> decltype(boost::declval<U>().size()); - template<typename> static nil_t test( ... ); - -public: - static bool const value = !std::is_same< decltype(test<T>( nullptr )), nil_t>::value; -}; - -//____________________________________________________________________________// - -template <class T> -struct has_member_begin { -private: - struct nil_t {}; - template<typename U> static auto test( U* ) -> decltype(std::begin(boost::declval<U&>())); // does not work with boost::begin - template<typename> static nil_t test( ... ); -public: - static bool const value = !std::is_same< decltype(test<T>( nullptr )), nil_t>::value; -}; - -//____________________________________________________________________________// - -template <class T> -struct has_member_end { -private: - struct nil_t {}; - template<typename U> static auto test( U* ) -> decltype(std::end(boost::declval<U&>())); // does not work with boost::end - template<typename> static nil_t test( ... ); -public: - static bool const value = !std::is_same< decltype(test<T>( nullptr )), nil_t>::value; -}; - -//____________________________________________________________________________// - -template <class T, class enabled = void> -struct is_forward_iterable_impl : std::false_type { -}; - -template <class T> -struct is_forward_iterable_impl< - T, - typename std::enable_if< - has_member_begin<T>::value && - has_member_end<T>::value - >::type -> : std::true_type -{}; - -//____________________________________________________________________________// - -template <class T, class enabled = void> -struct is_container_forward_iterable_impl : std::false_type { -}; - -template <class T> -struct is_container_forward_iterable_impl< - T, - typename std::enable_if< - is_present<typename T::const_iterator>::value && - is_present<typename T::value_type>::value && - has_member_size<T>::value && - is_forward_iterable_impl<T>::value - >::type -> : is_forward_iterable_impl<T> -{}; - -//____________________________________________________________________________// - -} // namespace ut_detail - -/*! Indicates that a specific type implements the forward iterable concept. */ -template<typename T> -struct is_forward_iterable { - typedef typename std::remove_reference<T>::type T_ref; - typedef ut_detail::is_forward_iterable_impl<T_ref> is_fwd_it_t; - typedef mpl::bool_<is_fwd_it_t::value> type; - enum { value = is_fwd_it_t::value }; -}; - -/*! Indicates that a specific type implements the forward iterable concept. */ -template<typename T> -struct is_container_forward_iterable { - typedef typename std::remove_reference<T>::type T_ref; - typedef ut_detail::is_container_forward_iterable_impl<T_ref> is_fwd_it_t; - typedef mpl::bool_<is_fwd_it_t::value> type; - enum { value = is_fwd_it_t::value }; -}; - -#endif /* defined(BOOST_TEST_FWD_ITERABLE_CXX03) */ - - -//! Helper structure for accessing the content of a container or an array -template <typename T, bool is_forward_iterable = is_forward_iterable<T>::value > -struct bt_iterator_traits; - -template <typename T> -struct bt_iterator_traits< T, true >{ - BOOST_STATIC_ASSERT((is_forward_iterable<T>::value)); - -#if defined(BOOST_TEST_FWD_ITERABLE_CXX03) || \ - (defined(BOOST_MSVC) && (BOOST_MSVC_FULL_VER <= 170061232)) - typedef typename T::const_iterator const_iterator; - typedef typename std::iterator_traits<const_iterator>::value_type value_type; -#else - typedef decltype(boost::declval< - typename boost::add_const< - typename boost::remove_reference<T>::type - >::type>().begin()) const_iterator; - - typedef typename std::iterator_traits<const_iterator>::value_type value_type; -#endif /* BOOST_TEST_FWD_ITERABLE_CXX03 */ - - static const_iterator begin(T const& container) { - return container.begin(); - } - static const_iterator end(T const& container) { - return container.end(); - } - -#if defined(BOOST_TEST_FWD_ITERABLE_CXX03) || \ - (defined(BOOST_MSVC) && (BOOST_MSVC_FULL_VER <= 170061232)) - static std::size_t - size(T const& container) { - return container.size(); - } -#else - static std::size_t - size(T const& container) { - return size(container, - std::integral_constant<bool, ut_detail::has_member_size<T>::value>()); - } -private: - static std::size_t - size(T const& container, std::true_type) { return container.size(); } - - static std::size_t - size(T const& container, std::false_type) { return std::distance(begin(container), end(container)); } -#endif /* BOOST_TEST_FWD_ITERABLE_CXX03 */ -}; - -template <typename T, std::size_t N> -struct bt_iterator_traits< T [N], true > { - typedef typename boost::add_const<T>::type T_const; - typedef typename boost::add_pointer<T_const>::type const_iterator; - typedef T value_type; - - static const_iterator begin(T_const (&array)[N]) { - return &array[0]; - } - static const_iterator end(T_const (&array)[N]) { - return &array[N]; - } - static std::size_t size(T_const (&)[N]) { - return N; - } -}; - -} // namespace unit_test -} // namespace boost - -#endif // BOOST_TEST_UTILS_IS_FORWARD_ITERABLE_HPP diff --git a/contrib/restricted/boost/test/include/boost/test/utils/iterator/input_iterator_facade.hpp b/contrib/restricted/boost/test/include/boost/test/utils/iterator/input_iterator_facade.hpp deleted file mode 100644 index 2658283e4e..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/utils/iterator/input_iterator_facade.hpp +++ /dev/null @@ -1,105 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -//!@file -//! Input iterator facade -// *************************************************************************** - -#ifndef BOOST_TEST_UTILS_INPUT_ITERATOR_FACADE_HPP -#define BOOST_TEST_UTILS_INPUT_ITERATOR_FACADE_HPP - -// Boost -#include <boost/iterator/iterator_facade.hpp> - -#include <boost/test/detail/suppress_warnings.hpp> - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { -namespace utils { - -// ************************************************************************** // -// ************** input_iterator_core_access ************** // -// ************************************************************************** // - -class input_iterator_core_access -{ -#if defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS) || BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x551)) -public: -#else - template <class I, class V, class R, class TC> friend class input_iterator_facade; -#endif - - template <class Facade> - static bool get( Facade& f ) - { - return f.get(); - } - -private: - // objects of this class are useless - input_iterator_core_access(); //undefined -}; - -// ************************************************************************** // -// ************** input_iterator_facade ************** // -// ************************************************************************** // - -template<typename Derived, - typename ValueType, - typename Reference = ValueType const&, - typename Traversal = single_pass_traversal_tag> -class input_iterator_facade : public iterator_facade<Derived,ValueType,Traversal,Reference> -{ -public: - // Constructor - input_iterator_facade() : m_valid( false ), m_value() {} - -protected: // provide access to the Derived - void init() - { - m_valid = true; - increment(); - } - - // Data members - mutable bool m_valid; - ValueType m_value; - -private: - friend class boost::iterator_core_access; - - // iterator facade interface implementation - void increment() - { - // we make post-end incrementation indefinetly safe - if( m_valid ) - m_valid = input_iterator_core_access::get( *static_cast<Derived*>(this) ); - } - Reference dereference() const - { - return m_value; - } - - // iterator facade interface implementation - bool equal( input_iterator_facade const& rhs ) const - { - // two invalid iterator equals, inequal otherwise - return !m_valid && !rhs.m_valid; - } -}; - -} // namespace utils -} // namespace unit_test -} // namespace boost - -//____________________________________________________________________________// - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_UTILS_INPUT_ITERATOR_FACADE_HPP diff --git a/contrib/restricted/boost/test/include/boost/test/utils/iterator/token_iterator.hpp b/contrib/restricted/boost/test/include/boost/test/utils/iterator/token_iterator.hpp deleted file mode 100644 index e3a923a2ee..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/utils/iterator/token_iterator.hpp +++ /dev/null @@ -1,421 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : token iterator for string and range tokenization -// *************************************************************************** - -#ifndef BOOST_TEST_UTILS_TOKEN_ITERATOR_HPP -#define BOOST_TEST_UTILS_TOKEN_ITERATOR_HPP - -// Boost -#include <boost/config.hpp> -#include <boost/detail/workaround.hpp> - -#include <boost/iterator/iterator_categories.hpp> -#include <boost/iterator/iterator_traits.hpp> - -#include <boost/test/utils/iterator/input_iterator_facade.hpp> -#include <boost/test/utils/basic_cstring/basic_cstring.hpp> -#include <boost/test/utils/named_params.hpp> -#include <boost/test/utils/foreach.hpp> - -// STL -#include <iosfwd> -#include <cctype> - -#include <boost/test/detail/suppress_warnings.hpp> - -//____________________________________________________________________________// - -#ifdef BOOST_NO_STDC_NAMESPACE -namespace std{ using ::ispunct; using ::isspace; } -#endif - -namespace boost { -namespace unit_test { -namespace utils { - -// ************************************************************************** // -// ************** ti_delimeter_type ************** // -// ************************************************************************** // - -enum ti_delimeter_type { - dt_char, // character is delimeter if it among explicit list of some characters - dt_ispunct, // character is delimeter if it satisfies ispunct functor - dt_isspace, // character is delimeter if it satisfies isspace functor - dt_none // no character is delimeter -}; - -namespace ut_detail { - -// ************************************************************************** // -// ************** default_char_compare ************** // -// ************************************************************************** // - -template<typename CharT> -class default_char_compare { -public: - bool operator()( CharT c1, CharT c2 ) - { -#ifdef BOOST_CLASSIC_IOSTREAMS - return std::string_char_traits<CharT>::eq( c1, c2 ); -#else - return std::char_traits<CharT>::eq( c1, c2 ); -#endif - } -}; - -// ************************************************************************** // -// ************** delim_policy ************** // -// ************************************************************************** // - -template<typename CharT,typename CharCompare> -class delim_policy { - typedef basic_cstring<CharT const> cstring; -public: - // Constructor - explicit delim_policy( ti_delimeter_type type_ = dt_char, cstring delimeters_ = cstring() ) - : m_type( type_ ) - { - set_delimeters( delimeters_ ); - } - - void set_delimeters( ti_delimeter_type type_ ) { m_type = type_; } - void set_delimeters( cstring delimeters_ ) - { - m_delimeters = delimeters_; - - if( !m_delimeters.is_empty() ) - m_type = dt_char; - } - void set_delimeters( nfp::nil ) {} - bool operator()( CharT c ) - { - switch( m_type ) { - case dt_char: { - BOOST_TEST_FOREACH( CharT, delim, m_delimeters ) - if( CharCompare()( delim, c ) ) - return true; - - return false; - } - case dt_ispunct: - return (std::ispunct)( c ) != 0; - case dt_isspace: - return (std::isspace)( c ) != 0; - case dt_none: - return false; - } - - return false; - } - -private: - // Data members - cstring m_delimeters; - ti_delimeter_type m_type; -}; - -// ************************************************************************** // -// ************** token_assigner ************** // -// ************************************************************************** // - -template<typename TraversalTag> -struct token_assigner { -#if BOOST_WORKAROUND( BOOST_DINKUMWARE_STDLIB, < 306 ) - template<typename Iterator, typename C, typename T> - static void assign( Iterator b, Iterator e, std::basic_string<C,T>& t ) - { for( ; b != e; ++b ) t += *b; } - - template<typename Iterator, typename C> - static void assign( Iterator b, Iterator e, basic_cstring<C>& t ) { t.assign( b, e ); } -#else - template<typename Iterator, typename Token> - static void assign( Iterator b, Iterator e, Token& t ) { t.assign( b, e ); } -#endif - template<typename Iterator, typename Token> - static void append_move( Iterator& b, Token& ) { ++b; } -}; - -//____________________________________________________________________________// - -template<> -struct token_assigner<single_pass_traversal_tag> { - template<typename Iterator, typename Token> - static void assign( Iterator /*b*/, Iterator /*e*/, Token& /*t*/ ) {} - - template<typename Iterator, typename Token> - static void append_move( Iterator& b, Token& t ) { t += *b; ++b; } -}; - -} // namespace ut_detail - -// ************************************************************************** // -// ************** modifiers ************** // -// ************************************************************************** // - -namespace { -nfp::keyword<struct dropped_delimeters_t > dropped_delimeters; -nfp::keyword<struct kept_delimeters_t > kept_delimeters; -nfp::typed_keyword<bool,struct keep_empty_tokens_t > keep_empty_tokens; -nfp::typed_keyword<std::size_t,struct max_tokens_t > max_tokens; -} - -// ************************************************************************** // -// ************** token_iterator_base ************** // -// ************************************************************************** // - -template<typename Derived, - typename CharT, - typename CharCompare = ut_detail::default_char_compare<CharT>, - typename ValueType = basic_cstring<CharT const>, - typename Reference = basic_cstring<CharT const>, - typename Traversal = forward_traversal_tag> -class token_iterator_base -: public input_iterator_facade<Derived,ValueType,Reference,Traversal> { - typedef basic_cstring<CharT const> cstring; - typedef ut_detail::delim_policy<CharT,CharCompare> delim_policy; - typedef input_iterator_facade<Derived,ValueType,Reference,Traversal> base; - -protected: - // Constructor - explicit token_iterator_base() - : m_is_dropped( dt_isspace ) - , m_is_kept( dt_ispunct ) - , m_keep_empty_tokens( false ) - , m_tokens_left( static_cast<std::size_t>(-1) ) - , m_token_produced( false ) - { - } - - template<typename Modifier> - void - apply_modifier( Modifier const& m ) - { - if( m.has( dropped_delimeters ) ) - m_is_dropped.set_delimeters( m[dropped_delimeters] ); - - if( m.has( kept_delimeters ) ) - m_is_kept.set_delimeters( m[kept_delimeters] ); - - if( m.has( keep_empty_tokens ) ) - m_keep_empty_tokens = true; - - nfp::opt_assign( m_tokens_left, m, max_tokens ); - } - - template<typename Iter> - bool get( Iter& begin, Iter end ) - { - typedef ut_detail::token_assigner<BOOST_DEDUCED_TYPENAME iterator_traversal<Iter>::type> Assigner; - Iter check_point; - - this->m_value.clear(); - - if( !m_keep_empty_tokens ) { - while( begin != end && m_is_dropped( *begin ) ) - ++begin; - - if( begin == end ) - return false; - - check_point = begin; - - if( m_tokens_left == 1 ) - while( begin != end ) - Assigner::append_move( begin, this->m_value ); - else if( m_is_kept( *begin ) ) - Assigner::append_move( begin, this->m_value ); - else - while( begin != end && !m_is_dropped( *begin ) && !m_is_kept( *begin ) ) - Assigner::append_move( begin, this->m_value ); - - --m_tokens_left; - } - else { // m_keep_empty_tokens is true - check_point = begin; - - if( begin == end ) { - if( m_token_produced ) - return false; - - m_token_produced = true; - } - if( m_is_kept( *begin ) ) { - if( m_token_produced ) - Assigner::append_move( begin, this->m_value ); - - m_token_produced = !m_token_produced; - } - else if( !m_token_produced && m_is_dropped( *begin ) ) - m_token_produced = true; - else { - if( m_is_dropped( *begin ) ) - check_point = ++begin; - - while( begin != end && !m_is_dropped( *begin ) && !m_is_kept( *begin ) ) - Assigner::append_move( begin, this->m_value ); - - m_token_produced = true; - } - } - - Assigner::assign( check_point, begin, this->m_value ); - - return true; - } - -private: - // Data members - delim_policy m_is_dropped; - delim_policy m_is_kept; - bool m_keep_empty_tokens; - std::size_t m_tokens_left; - bool m_token_produced; -}; - -// ************************************************************************** // -// ************** basic_string_token_iterator ************** // -// ************************************************************************** // - -template<typename CharT, - typename CharCompare = ut_detail::default_char_compare<CharT> > -class basic_string_token_iterator -: public token_iterator_base<basic_string_token_iterator<CharT,CharCompare>,CharT,CharCompare> { - typedef basic_cstring<CharT const> cstring; - typedef token_iterator_base<basic_string_token_iterator<CharT,CharCompare>,CharT,CharCompare> base; -public: - explicit basic_string_token_iterator() {} - explicit basic_string_token_iterator( cstring src ) - : m_src( src ) - { - this->init(); - } - - // warning: making the constructor accept anything else than a cstring should - // ensure that no temporary object is created during string creation (previous - // definition was "template<typename Src, typename Modifier> basic_string_token_iterator( Src src ..." - // which may create a temporary string copy when called with an std::string. - template<typename Modifier> - basic_string_token_iterator( cstring src, Modifier const& m ) - : m_src( src ) - { - this->apply_modifier( m ); - - this->init(); - } - -private: - friend class input_iterator_core_access; - - // input iterator implementation - bool get() - { - typename cstring::iterator begin = m_src.begin(); - bool res = base::get( begin, m_src.end() ); - - m_src.assign( begin, m_src.end() ); - - return res; - } - - // Data members - cstring m_src; -}; - -typedef basic_string_token_iterator<char> string_token_iterator; -typedef basic_string_token_iterator<wchar_t> wstring_token_iterator; - -// ************************************************************************** // -// ************** range_token_iterator ************** // -// ************************************************************************** // - -template<typename Iter, - typename CharCompare = ut_detail::default_char_compare<BOOST_DEDUCED_TYPENAME iterator_value<Iter>::type>, - typename ValueType = std::basic_string<BOOST_DEDUCED_TYPENAME iterator_value<Iter>::type>, - typename Reference = ValueType const&> -class range_token_iterator -: public token_iterator_base<range_token_iterator<Iter,CharCompare,ValueType,Reference>, - typename iterator_value<Iter>::type,CharCompare,ValueType,Reference> { - typedef basic_cstring<typename ValueType::value_type> cstring; - typedef token_iterator_base<range_token_iterator<Iter,CharCompare,ValueType,Reference>, - typename iterator_value<Iter>::type,CharCompare,ValueType,Reference> base; -public: - explicit range_token_iterator() {} - explicit range_token_iterator( Iter begin, Iter end = Iter() ) - : m_begin( begin ), m_end( end ) - { - this->init(); - } - range_token_iterator( range_token_iterator const& rhs ) - : base( rhs ) - { - if( this->m_valid ) { - m_begin = rhs.m_begin; - m_end = rhs.m_end; - } - } - - template<typename Modifier> - range_token_iterator( Iter begin, Iter end, Modifier const& m ) - : m_begin( begin ), m_end( end ) - { - this->apply_modifier( m ); - - this->init(); - } - -private: - friend class input_iterator_core_access; - - // input iterator implementation - bool get() - { - return base::get( m_begin, m_end ); - } - - // Data members - Iter m_begin; - Iter m_end; -}; - -// ************************************************************************** // -// ************** make_range_token_iterator ************** // -// ************************************************************************** // - -template<typename Iter> -inline range_token_iterator<Iter> -make_range_token_iterator( Iter begin, Iter end = Iter() ) -{ - return range_token_iterator<Iter>( begin, end ); -} - -//____________________________________________________________________________// - -template<typename Iter,typename Modifier> -inline range_token_iterator<Iter> -make_range_token_iterator( Iter begin, Iter end, Modifier const& m ) -{ - return range_token_iterator<Iter>( begin, end, m ); -} - -//____________________________________________________________________________// - -} // namespace utils -} // namespace unit_test -} // namespace boost - -//____________________________________________________________________________// - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_UTILS_TOKEN_ITERATOR_HPP - diff --git a/contrib/restricted/boost/test/include/boost/test/utils/lazy_ostream.hpp b/contrib/restricted/boost/test/include/boost/test/utils/lazy_ostream.hpp deleted file mode 100644 index 2d1edbed8e..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/utils/lazy_ostream.hpp +++ /dev/null @@ -1,144 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// Description : contains definition for all test tools in test toolbox -// *************************************************************************** - -#ifndef BOOST_TEST_UTILS_LAZY_OSTREAM_HPP -#define BOOST_TEST_UTILS_LAZY_OSTREAM_HPP - -// Boost.Test -#include <boost/test/detail/config.hpp> -#include <boost/test/tools/detail/print_helper.hpp> - -// STL -#include <iosfwd> - -#include <boost/test/detail/suppress_warnings.hpp> - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** lazy_ostream ************** // -// ************************************************************************** // - -namespace boost { -namespace unit_test { - -class BOOST_TEST_DECL lazy_ostream { -public: - virtual ~lazy_ostream() {} - - static lazy_ostream& instance() { return inst; } - - #if !defined(BOOST_EMBTC) - - friend std::ostream& operator<<( std::ostream& ostr, lazy_ostream const& o ) { return o( ostr ); } - - #else - - friend std::ostream& operator<<( std::ostream& ostr, lazy_ostream const& o ); - - #endif - - // access method - bool empty() const { return m_empty; } - - // actual printing interface; to be accessed only by this class and children - virtual std::ostream& operator()( std::ostream& ostr ) const { return ostr; } -protected: - explicit lazy_ostream( bool p_empty = true ) : m_empty( p_empty ) {} - -private: - // Data members - bool m_empty; - static lazy_ostream inst; -}; - -#if defined(BOOST_EMBTC) - - inline std::ostream& operator<<( std::ostream& ostr, lazy_ostream const& o ) { return o( ostr ); } - -#endif - -//____________________________________________________________________________// - -template<typename PrevType, typename T, typename StorageT=T const&> -class lazy_ostream_impl : public lazy_ostream { -public: - lazy_ostream_impl( PrevType const& prev, T const& value ) - : lazy_ostream( false ) - , m_prev( prev ) - , m_value( value ) - { - } - - std::ostream& operator()( std::ostream& ostr ) const BOOST_OVERRIDE - { - return m_prev(ostr) << test_tools::tt_detail::print_helper(m_value); - } -private: - // Data members - PrevType const& m_prev; - StorageT m_value; -}; - -//____________________________________________________________________________// - -template<typename T> -inline lazy_ostream_impl<lazy_ostream,T> -operator<<( lazy_ostream const& prev, T const& v ) -{ - return lazy_ostream_impl<lazy_ostream,T>( prev, v ); -} - -//____________________________________________________________________________// - -template<typename PrevPrevType, typename TPrev, typename T> -inline lazy_ostream_impl<lazy_ostream_impl<PrevPrevType,TPrev>,T> -operator<<( lazy_ostream_impl<PrevPrevType,TPrev> const& prev, T const& v ) -{ - typedef lazy_ostream_impl<PrevPrevType,TPrev> PrevType; - return lazy_ostream_impl<PrevType,T>( prev, v ); -} - -//____________________________________________________________________________// - -#if BOOST_TEST_USE_STD_LOCALE - -template<typename R,typename S> -inline lazy_ostream_impl<lazy_ostream,R& (BOOST_TEST_CALL_DECL *)(S&),R& (BOOST_TEST_CALL_DECL *)(S&)> -operator<<( lazy_ostream const& prev, R& (BOOST_TEST_CALL_DECL *man)(S&) ) -{ - typedef R& (BOOST_TEST_CALL_DECL * ManipType)(S&); - - return lazy_ostream_impl<lazy_ostream,ManipType,ManipType>( prev, man ); -} - -//____________________________________________________________________________// - -template<typename PrevPrevType, typename TPrev,typename R,typename S> -inline lazy_ostream_impl<lazy_ostream_impl<PrevPrevType,TPrev>,R& (BOOST_TEST_CALL_DECL *)(S&),R& (BOOST_TEST_CALL_DECL *)(S&)> -operator<<( lazy_ostream_impl<PrevPrevType,TPrev> const& prev, R& (BOOST_TEST_CALL_DECL *man)(S&) ) -{ - typedef R& (BOOST_TEST_CALL_DECL * ManipType)(S&); - - return lazy_ostream_impl<lazy_ostream_impl<PrevPrevType,TPrev>,ManipType,ManipType>( prev, man ); -} - -//____________________________________________________________________________// - -#endif - -#define BOOST_TEST_LAZY_MSG( M ) (::boost::unit_test::lazy_ostream::instance() << M) - -} // namespace unit_test -} // namespace boost - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_UTILS_LAZY_OSTREAM_HPP diff --git a/contrib/restricted/boost/test/include/boost/test/utils/named_params.hpp b/contrib/restricted/boost/test/include/boost/test/utils/named_params.hpp deleted file mode 100644 index 26dac798fc..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/utils/named_params.hpp +++ /dev/null @@ -1,388 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : named function parameters library -// *************************************************************************** - -#ifndef BOOST_TEST_UTILS_NAMED_PARAM -#define BOOST_TEST_UTILS_NAMED_PARAM - -// Boost -#include <boost/config.hpp> -#include <boost/detail/workaround.hpp> - -// Boost.Test -#include <boost/test/utils/rtti.hpp> -#include <boost/test/utils/assign_op.hpp> - -#include <boost/type_traits/remove_reference.hpp> -#include <boost/type_traits/remove_cv.hpp> - -#include <boost/test/detail/throw_exception.hpp> - -// Boost -#include <boost/mpl/if.hpp> -#include <boost/mpl/or.hpp> -#include <boost/type_traits/is_same.hpp> -#include <boost/type_traits/remove_cv.hpp> -#include <boost/utility/enable_if.hpp> -#include <boost/mpl/bool.hpp> - -#include <boost/test/detail/suppress_warnings.hpp> - -//____________________________________________________________________________// - -namespace boost { -namespace nfp { // named function parameters - -// ************************************************************************** // -// ************** forward declarations ************** // -// ************************************************************************** // - -template<typename unique_id, bool required> struct keyword; -template<typename T, typename unique_id, bool required = false> struct typed_keyword; - -template<typename T, typename unique_id, typename RefType=T&> struct named_parameter; -template<typename NP1,typename NP2> struct named_parameter_combine; - -// ************************************************************************** // -// ************** is_named_param_pack ************** // -// ************************************************************************** // - -/// is_named_param_pack<T>::value is true if T is parameters pack - -template<typename T> -struct is_named_param_pack : public mpl::false_ {}; - -template<typename T, typename unique_id, typename RefType> -struct is_named_param_pack<named_parameter<T,unique_id,RefType> > : public mpl::true_ {}; - -template<typename NP, typename Rest> -struct is_named_param_pack<named_parameter_combine<NP,Rest> > : public mpl::true_ {}; - -// ************************************************************************** // -// ************** param_type ************** // -// ************************************************************************** // - -/// param_type<Params,Keyword,Default>::type is the type of the parameter -/// corresponding to the Keyword (if parameter is present) or Default - -template<typename NP, typename Keyword, typename DefaultType=void> -struct param_type -: mpl::if_<typename is_same<typename NP::id,typename Keyword::id>::type, - typename remove_cv<typename NP::data_type>::type, - DefaultType> {}; - -template<typename NP, typename Rest, typename Keyword, typename DefaultType> -struct param_type<named_parameter_combine<NP,Rest>,Keyword,DefaultType> -: mpl::if_<typename is_same<typename NP::id,typename Keyword::id>::type, - typename remove_cv<typename NP::data_type>::type, - typename param_type<Rest,Keyword,DefaultType>::type> {}; - -// ************************************************************************** // -// ************** has_param ************** // -// ************************************************************************** // - -/// has_param<Params,Keyword>::value is true if Params has parameter corresponding -/// to the Keyword - -template<typename NP, typename Keyword> -struct has_param : is_same<typename NP::id,typename Keyword::id> {}; - -template<typename NP, typename Rest, typename Keyword> -struct has_param<named_parameter_combine<NP,Rest>,Keyword> -: mpl::or_<typename is_same<typename NP::id,typename Keyword::id>::type, - typename has_param<Rest,Keyword>::type> {}; - -// ************************************************************************** // -// ************** access_to_invalid_parameter ************** // -// ************************************************************************** // - -namespace nfp_detail { - -struct access_to_invalid_parameter {}; - -//____________________________________________________________________________// - -inline void -report_access_to_invalid_parameter( bool v ) -{ - BOOST_TEST_I_ASSRT( !v, access_to_invalid_parameter() ); -} - -} // namespace nfp_detail - -// ************************************************************************** // -// ************** nil ************** // -// ************************************************************************** // - -struct nil { - template<typename T> -#if defined(__GNUC__) || defined(__HP_aCC) || defined(__EDG__) || defined(__SUNPRO_CC) || defined(BOOST_EMBTC) - operator T() const -#else - operator T const&() const -#endif - { nfp_detail::report_access_to_invalid_parameter(true); static T* v = 0; return *v; } - - template<typename T> - T any_cast() const - { nfp_detail::report_access_to_invalid_parameter(true); static typename remove_reference<T>::type* v = 0; return *v; } - - template<typename Arg1> - nil operator()( Arg1 const& ) - { nfp_detail::report_access_to_invalid_parameter(true); return nil(); } - - template<typename Arg1,typename Arg2> - nil operator()( Arg1 const&, Arg2 const& ) - { nfp_detail::report_access_to_invalid_parameter(true); return nil(); } - - template<typename Arg1,typename Arg2,typename Arg3> - nil operator()( Arg1 const&, Arg2 const&, Arg3 const& ) - { nfp_detail::report_access_to_invalid_parameter(true); return nil(); } - - // Visitation support - template<typename Visitor> - void apply_to( Visitor& /*v*/ ) const {} - - static nil& inst() { static nil s_inst; return s_inst; } -private: - nil() {} -}; - -// ************************************************************************** // -// ************** named_parameter_base ************** // -// ************************************************************************** // - -namespace nfp_detail { - -template<typename Derived> -struct named_parameter_base { - template<typename NP> - named_parameter_combine<NP,Derived> - operator,( NP const& np ) const { return named_parameter_combine<NP,Derived>( np, *static_cast<Derived const*>(this) ); } -}; - -} // namespace nfp_detail - -// ************************************************************************** // -// ************** named_parameter_combine ************** // -// ************************************************************************** // - -template<typename NP, typename Rest = nil> -struct named_parameter_combine -: Rest -, nfp_detail::named_parameter_base<named_parameter_combine<NP,Rest> > { - typedef typename NP::ref_type res_type; - typedef named_parameter_combine<NP,Rest> self_type; - - // Constructor - named_parameter_combine( NP const& np, Rest const& r ) - : Rest( r ) - , m_param( np ) - { - } - - // Access methods - res_type operator[]( keyword<typename NP::id,true> kw ) const { return m_param[kw]; } - res_type operator[]( keyword<typename NP::id,false> kw ) const { return m_param[kw]; } - using Rest::operator[]; - - bool has( keyword<typename NP::id,false> kw ) const { return m_param.has( kw ); } - using Rest::has; - - void erase( keyword<typename NP::id,false> kw ) const { m_param.erase( kw ); } - using Rest::erase; - - using nfp_detail::named_parameter_base<named_parameter_combine<NP,Rest> >::operator,; - - // Visitation support - template<typename Visitor> - void apply_to( Visitor& V ) const - { - m_param.apply_to( V ); - - Rest::apply_to( V ); - } -private: - // Data members - NP m_param; -}; - -// ************************************************************************** // -// ************** named_parameter ************** // -// ************************************************************************** // - -template<typename T, typename unique_id, typename RefType> -struct named_parameter -: nfp_detail::named_parameter_base<named_parameter<T,unique_id,RefType> > -{ - typedef T data_type; - typedef RefType ref_type; - typedef unique_id id; - - // Constructor - explicit named_parameter( ref_type v ) - : m_value( v ) - , m_erased( false ) - {} - named_parameter( named_parameter const& np ) - : m_value( np.m_value ) - , m_erased( np.m_erased ) - {} - - // Access methods - ref_type operator[]( keyword<unique_id,true> ) const { return m_erased ? nil::inst().template any_cast<ref_type>() : m_value; } - ref_type operator[]( keyword<unique_id,false> ) const { return m_erased ? nil::inst().template any_cast<ref_type>() : m_value; } - template<typename UnknownId> - nil operator[]( keyword<UnknownId,false> ) const { return nil::inst(); } - - bool has( keyword<unique_id,false> ) const { return !m_erased; } - template<typename UnknownId> - bool has( keyword<UnknownId,false> ) const { return false; } - - void erase( keyword<unique_id,false> ) const { m_erased = true; } - template<typename UnknownId> - void erase( keyword<UnknownId,false> ) const {} - - // Visitation support - template<typename Visitor> - void apply_to( Visitor& V ) const - { - V.set_parameter( rtti::type_id<unique_id>(), m_value ); - } - -private: - // Data members - ref_type m_value; - mutable bool m_erased; -}; - -// ************************************************************************** // -// ************** no_params ************** // -// ************************************************************************** // - -typedef named_parameter<char, struct no_params_type_t,char> no_params_type; - -namespace { -no_params_type no_params( '\0' ); -} // local namespace - -// ************************************************************************** // -// ************** keyword ************** // -// ************************************************************************** // - -template<typename unique_id, bool required = false> -struct keyword { - typedef unique_id id; - - template<typename T> - named_parameter<T const,unique_id> - operator=( T const& t ) const { return named_parameter<T const,unique_id>( t ); } - - template<typename T> - named_parameter<T,unique_id> - operator=( T& t ) const { return named_parameter<T,unique_id>( t ); } - - named_parameter<char const*,unique_id,char const*> - operator=( char const* t ) const { return named_parameter<char const*,unique_id,char const*>( t ); } -}; - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** typed_keyword ************** // -// ************************************************************************** // - -template<typename T, typename unique_id, bool required> -struct typed_keyword : keyword<unique_id,required> { - named_parameter<T const,unique_id> - operator=( T const& t ) const { return named_parameter<T const,unique_id>( t ); } - - named_parameter<T,unique_id> - operator=( T& t ) const { return named_parameter<T,unique_id>( t ); } -}; - -//____________________________________________________________________________// - -template<typename unique_id, bool required> -struct typed_keyword<bool,unique_id,required> -: keyword<unique_id,required> -, named_parameter<bool,unique_id,bool> { - typedef unique_id id; - - typed_keyword() : named_parameter<bool,unique_id,bool>( true ) {} - - named_parameter<bool,unique_id,bool> - operator!() const { return named_parameter<bool,unique_id,bool>( false ); } -}; - -// ************************************************************************** // -// ************** opt_assign ************** // -// ************************************************************************** // - -template<typename T, typename Params, typename Keyword> -inline typename enable_if_c<!has_param<Params,Keyword>::value,void>::type -opt_assign( T& /*target*/, Params const& /*p*/, Keyword /*k*/ ) -{ -} - -//____________________________________________________________________________// - -template<typename T, typename Params, typename Keyword> -inline typename enable_if_c<has_param<Params,Keyword>::value,void>::type -opt_assign( T& target, Params const& p, Keyword k ) -{ - using namespace unit_test; - - assign_op( target, p[k], static_cast<int>(0) ); -} - -// ************************************************************************** // -// ************** opt_get ************** // -// ************************************************************************** // - -template<typename T, typename Params, typename Keyword> -inline T -opt_get( Params const& p, Keyword k, T default_val ) -{ - opt_assign( default_val, p, k ); - - return default_val; -} - -// ************************************************************************** // -// ************** opt_get ************** // -// ************************************************************************** // - -template<typename Params, typename NP> -inline typename enable_if_c<!has_param<Params,keyword<typename NP::id> >::value, -named_parameter_combine<NP,Params> >::type -opt_append( Params const& params, NP const& np ) -{ - return (params,np); -} - -//____________________________________________________________________________// - -template<typename Params, typename NP> -inline typename enable_if_c<has_param<Params,keyword<typename NP::id> >::value,Params>::type -opt_append( Params const& params, NP const& ) -{ - return params; -} - -} // namespace nfp -} // namespace boost - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_UTILS_NAMED_PARAM diff --git a/contrib/restricted/boost/test/include/boost/test/utils/rtti.hpp b/contrib/restricted/boost/test/include/boost/test/utils/rtti.hpp deleted file mode 100644 index 84225b0921..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/utils/rtti.hpp +++ /dev/null @@ -1,64 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : simple facilities for accessing type information at runtime -// *************************************************************************** - -#ifndef BOOST_TEST_UTILS_RTTI_HPP -#define BOOST_TEST_UTILS_RTTI_HPP - -// C Runtime -#include <cstddef> -#include <boost/test/detail/config.hpp> - -namespace boost { -namespace rtti { - -// ************************************************************************** // -// ************** rtti::type_id ************** // -// ************************************************************************** // - -typedef std::ptrdiff_t id_t; - -namespace rtti_detail { - -template<typename T> -struct BOOST_TEST_DECL rttid_holder { - static id_t id() { return reinterpret_cast<id_t>( &inst() ); } - -private: - struct rttid {}; - - static rttid const& inst() { static rttid s_inst; return s_inst; } -}; - -} // namespace rtti_detail - -//____________________________________________________________________________// - -template<typename T> -BOOST_TEST_DECL inline id_t -type_id() -{ - return rtti_detail::rttid_holder<T>::id(); -} - -//____________________________________________________________________________// - -#define BOOST_RTTI_SWITCH( type_id_ ) if( ::boost::rtti::id_t switch_by_id = type_id_ ) -#define BOOST_RTTI_CASE( type ) if( switch_by_id == ::boost::rtti::type_id<type>() ) - -//____________________________________________________________________________// - -} // namespace rtti -} // namespace boost - -#endif // BOOST_TEST_UTILS_RTTI_HPP diff --git a/contrib/restricted/boost/test/include/boost/test/utils/runtime/argument.hpp b/contrib/restricted/boost/test/include/boost/test/utils/runtime/argument.hpp deleted file mode 100644 index 879ee96f9f..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/utils/runtime/argument.hpp +++ /dev/null @@ -1,131 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : model of actual argument (both typed and abstract interface) -// *************************************************************************** - -#ifndef BOOST_TEST_UTILS_RUNTIME_ARGUMENT_HPP -#define BOOST_TEST_UTILS_RUNTIME_ARGUMENT_HPP - -// Boost.Test Runtime parameters -#include <boost/test/utils/runtime/fwd.hpp> -#include <boost/test/utils/runtime/errors.hpp> - -// Boost.Test -#include <boost/test/utils/class_properties.hpp> -#include <boost/test/utils/rtti.hpp> -#include <boost/test/utils/basic_cstring/compare.hpp> -#include <boost/test/detail/throw_exception.hpp> - -// STL -#include <cassert> - -#include <boost/test/detail/suppress_warnings.hpp> - -namespace boost { -namespace runtime { - -// ************************************************************************** // -// ************** runtime::argument ************** // -// ************************************************************************** // - -class argument { -public: - // Constructor - argument( rtti::id_t value_type ) - : p_value_type( value_type ) - {} - - // Destructor - virtual ~argument() {} - - // Public properties - rtti::id_t const p_value_type; -}; - -// ************************************************************************** // -// ************** runtime::typed_argument ************** // -// ************************************************************************** // - -template<typename T> -class typed_argument : public argument { -public: - // Constructor - explicit typed_argument( T const& v ) - : argument( rtti::type_id<T>() ) - , p_value( v ) - {} - - unit_test::readwrite_property<T> p_value; -}; - -// ************************************************************************** // -// ************** runtime::arguments_store ************** // -// ************************************************************************** // - -class arguments_store { -public: - typedef std::map<cstring, argument_ptr> storage_type; - - /// Returns number of arguments in the store; mostly used for testing - std::size_t size() const { return m_arguments.size(); } - - /// Clears the store for reuse - void clear() { m_arguments.clear(); } - - /// Returns true if there is an argument corresponding to the specified parameter name - bool has( cstring parameter_name ) const - { - return m_arguments.find( parameter_name ) != m_arguments.end(); - } - - /// Provides types access to argument value by parameter name - template<typename T> - T const& get( cstring parameter_name ) const { - return const_cast<arguments_store*>(this)->get<T>( parameter_name ); - } - - template<typename T> - T& get( cstring parameter_name ) { - storage_type::const_iterator found = m_arguments.find( parameter_name ); - BOOST_TEST_I_ASSRT( found != m_arguments.end(), - access_to_missing_argument() - << "There is no argument provided for parameter " - << parameter_name ); - - argument_ptr arg = found->second; - - BOOST_TEST_I_ASSRT( arg->p_value_type == rtti::type_id<T>(), - arg_type_mismatch() - << "Access with invalid type for argument corresponding to parameter " - << parameter_name ); - - return static_cast<typed_argument<T>&>( *arg ).p_value.value; - } - - /// Set's the argument value for specified parameter name - template<typename T> - void set( cstring parameter_name, T const& value ) - { - m_arguments[parameter_name] = argument_ptr( new typed_argument<T>( value ) ); - } - -private: - // Data members - storage_type m_arguments; -}; - -} // namespace runtime -} // namespace boost - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_UTILS_RUNTIME_ARGUMENT_HPP diff --git a/contrib/restricted/boost/test/include/boost/test/utils/runtime/argument_factory.hpp b/contrib/restricted/boost/test/include/boost/test/utils/runtime/argument_factory.hpp deleted file mode 100644 index e281cf93f7..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/utils/runtime/argument_factory.hpp +++ /dev/null @@ -1,243 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : argument factories for different kinds of parameters -// *************************************************************************** - -#ifndef BOOST_TEST_UTILS_RUNTIME_ARGUMENT_FACTORY_HPP -#define BOOST_TEST_UTILS_RUNTIME_ARGUMENT_FACTORY_HPP - -// Boost.Test Runtime parameters -#include <boost/test/utils/runtime/errors.hpp> -#include <boost/test/utils/runtime/argument.hpp> -#include <boost/test/utils/runtime/modifier.hpp> - -// Boost.Test -#include <boost/test/utils/basic_cstring/io.hpp> -#include <boost/test/utils/basic_cstring/compare.hpp> -#include <boost/test/utils/string_cast.hpp> - -// Boost -#include <boost/function/function2.hpp> - -// STL -#include <vector> - -#include <boost/test/detail/suppress_warnings.hpp> - -namespace boost { -namespace runtime { - -// ************************************************************************** // -// ************** runtime::value_interpreter ************** // -// ************************************************************************** // - -template<typename ValueType, bool is_enum> -struct value_interpreter; - -//____________________________________________________________________________// - -template<typename ValueType> -struct value_interpreter<ValueType, false> { - template<typename Modifiers> - explicit value_interpreter( Modifiers const& ) {} - - ValueType interpret( cstring param_name, cstring source ) const - { - ValueType res; - if( !unit_test::utils::string_as<ValueType>( source, res ) ) - BOOST_TEST_I_THROW( format_error( param_name ) << source << - " can't be interpreted as value of parameter " << param_name << "." ); - return res; - } -}; - -//____________________________________________________________________________// - -template<> -struct value_interpreter<std::string, false> { - template<typename Modifiers> - explicit value_interpreter( Modifiers const& ) {} - - std::string interpret( cstring, cstring source ) const - { - return std::string( source.begin(), source.size() ); - } -}; - -//____________________________________________________________________________// - -template<> -struct value_interpreter<cstring, false> { - template<typename Modifiers> - explicit value_interpreter( Modifiers const& ) {} - - cstring interpret( cstring, cstring source ) const - { - return source; - } -}; - -//____________________________________________________________________________// - -template<> -struct value_interpreter<bool, false> { - template<typename Modifiers> - explicit value_interpreter( Modifiers const& ) {} - - bool interpret( cstring param_name, cstring source ) const - { - static cstring const s_YES( "YES" ); - static cstring const s_Y( "Y" ); - static cstring const s_NO( "NO" ); - static cstring const s_N( "N" ); - static cstring const s_TRUE( "TRUE" ); - static cstring const s_FALSE( "FALSE" ); - static cstring const s_one( "1" ); - static cstring const s_zero( "0" ); - - source.trim(); - - if( source.is_empty() || - case_ins_eq( source, s_YES ) || - case_ins_eq( source, s_Y ) || - case_ins_eq( source, s_one ) || - case_ins_eq( source, s_TRUE ) ) - return true; - - if( case_ins_eq( source, s_NO ) || - case_ins_eq( source, s_N ) || - case_ins_eq( source, s_zero ) || - case_ins_eq( source, s_FALSE ) ) - return false; - - BOOST_TEST_I_THROW( format_error( param_name ) << source << " can't be interpreted as bool value." ); - } -}; - -//____________________________________________________________________________// - -template<typename EnumType> -struct value_interpreter<EnumType, true> { - template<typename Modifiers> - explicit value_interpreter( Modifiers const& m ) -#if defined(BOOST_TEST_CLA_NEW_API) - : m_name_to_value( m[enum_values<EnumType>::value] ) - { - } -#else - { - std::vector<std::pair<cstring,EnumType> > const& values = m[enum_values<EnumType>::value]; - - m_name_to_value.insert( values.begin(), values.end() ); - } -#endif - - EnumType interpret( cstring param_name, cstring source ) const - { - typename std::map<cstring,EnumType>::const_iterator found = m_name_to_value.find( source ); - - BOOST_TEST_I_ASSRT( found != m_name_to_value.end(), - format_error( param_name ) << source << - " is not a valid enumeration value name for parameter " << param_name << "." ); - - return found->second; - } - -private: - // Data members - std::map<cstring,EnumType> m_name_to_value; -}; - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** runtime::argument_factory ************** // -// ************************************************************************** // - -template<typename ValueType, bool is_enum, bool repeatable> -class argument_factory; - -//____________________________________________________________________________// - -template<typename ValueType, bool is_enum> -class argument_factory<ValueType, is_enum, false> { -public: - template<typename Modifiers> - explicit argument_factory( Modifiers const& m ) - : m_interpreter( m ) - , m_optional_value( nfp::opt_get( m, optional_value, ValueType() ) ) - , m_default_value( nfp::opt_get( m, default_value, ValueType() ) ) - { - } - - void produce_argument( cstring source, cstring param_name, arguments_store& store ) const - { - store.set( param_name, source.empty() ? m_optional_value : m_interpreter.interpret( param_name, source ) ); - } - - void produce_default( cstring param_name, arguments_store& store ) const - { - store.set( param_name, m_default_value ); - } - -private: - // Data members - typedef value_interpreter<ValueType, is_enum> interp_t; - interp_t m_interpreter; - ValueType m_optional_value; - ValueType m_default_value; -}; - -//____________________________________________________________________________// - -template<typename ValueType, bool is_enum> -class argument_factory<ValueType, is_enum, true> { -public: - template<typename Modifiers> - explicit argument_factory( Modifiers const& m ) - : m_interpreter( m ) - { - } - - void produce_argument( cstring source, cstring param_name, arguments_store& store ) const - { - ValueType value = m_interpreter.interpret( param_name, source ); - - if( store.has( param_name ) ) { - std::vector<ValueType>& values = store.get<std::vector<ValueType> >( param_name ); - values.push_back( value ); - } - else { - std::vector<ValueType> values( 1, value ); - - store.set( param_name, values ); - } - - } - void produce_default( cstring param_name, arguments_store& store ) const - { - store.set( param_name, std::vector<ValueType>() ); - } - -private: - // Data members - value_interpreter<ValueType, is_enum> m_interpreter; -}; - -//____________________________________________________________________________// - -} // namespace runtime -} // namespace boost - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_UTILS_RUNTIME_ARGUMENT_FACTORY_HPP diff --git a/contrib/restricted/boost/test/include/boost/test/utils/runtime/cla/argv_traverser.hpp b/contrib/restricted/boost/test/include/boost/test/utils/runtime/cla/argv_traverser.hpp deleted file mode 100644 index 476eaae2a0..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/utils/runtime/cla/argv_traverser.hpp +++ /dev/null @@ -1,106 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Use, modification, and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : defines facility to hide input traversing details -// *************************************************************************** - -#ifndef BOOST_TEST_UTILS_RUNTIME_CLA_ARGV_TRAVERSER_HPP -#define BOOST_TEST_UTILS_RUNTIME_CLA_ARGV_TRAVERSER_HPP - -// Boost.Test Runtime parameters -#include <boost/test/utils/runtime/fwd.hpp> -#include <cstring> - -#include <boost/test/detail/suppress_warnings.hpp> - -namespace boost { -namespace runtime { -namespace cla { - -// ************************************************************************** // -// ************** runtime::cla::argv_traverser ************** // -// ************************************************************************** // - -class argv_traverser { - typedef char const** argv_type; -public: - /// Constructs traverser based on argc/argv pair - /// argv is taken "by reference" and later can be - /// updated in remainder method - argv_traverser( int argc, argv_type argv ) - : m_argc( argc ) - , m_curr_token( 0 ) - , m_token_size( 0 ) - , m_argv( argv ) - { - // save program name - save_token(); - } - - /// Returns new argc - int remainder() - { - return static_cast<int>(m_argc); - } - - /// Returns true, if we reached end on input - bool eoi() const - { - return m_curr_token == m_argc; - } - - /// Returns current token in the input - cstring current_token() - { - if( eoi() ) - return cstring(); - - return cstring( m_argv[m_curr_token], m_token_size ); - } - - /// Saves current token for remainder - void save_token() - { - ++m_curr_token; - - if( !eoi() ) - m_token_size = ::strlen( m_argv[m_curr_token] ); - } - - /// Commit current token and iterate to next one - void next_token() - { - if( !eoi() ) { - for( std::size_t i = m_curr_token; i < m_argc-1; ++i ) - m_argv[i] = m_argv[i + 1]; - - --m_argc; - - m_token_size = ::strlen( m_argv[m_curr_token] ); - } - } - -private: - - // Data members - std::size_t m_argc; // total number of arguments - std::size_t m_curr_token; // current token index in argv - std::size_t m_token_size; // current token size - argv_type m_argv; // all arguments -}; - -} // namespace cla -} // namespace runtime -} // namespace boost - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_UTILS_RUNTIME_CLA_ARGV_TRAVERSER_HPP diff --git a/contrib/restricted/boost/test/include/boost/test/utils/runtime/cla/parser.hpp b/contrib/restricted/boost/test/include/boost/test/utils/runtime/cla/parser.hpp deleted file mode 100644 index 9e8601f517..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/utils/runtime/cla/parser.hpp +++ /dev/null @@ -1,625 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Use, modification, and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -//!@file -//!@brief CLA parser -// *************************************************************************** - -#ifndef BOOST_TEST_UTILS_RUNTIME_CLA_PARSER_HPP -#define BOOST_TEST_UTILS_RUNTIME_CLA_PARSER_HPP - -// Boost.Test Runtime parameters -#include <boost/test/utils/runtime/argument.hpp> -#include <boost/test/utils/runtime/modifier.hpp> -#include <boost/test/utils/runtime/parameter.hpp> - -#include <boost/test/utils/runtime/cla/argv_traverser.hpp> - -// Boost.Test -#include <boost/test/utils/foreach.hpp> -#include <boost/test/utils/algorithm.hpp> -#include <boost/test/detail/throw_exception.hpp> -#include <boost/test/detail/global_typedef.hpp> - -#include <boost/algorithm/cxx11/all_of.hpp> // !! ?? unnecessary after cxx11 - -// STL -// !! ?? #include <unordered_set> -#include <set> -#include <iostream> - -#include <boost/test/detail/suppress_warnings.hpp> - -namespace boost { -namespace runtime { -namespace cla { - -// ************************************************************************** // -// ************** runtime::cla::parameter_trie ************** // -// ************************************************************************** // - -namespace rt_cla_detail { - -struct parameter_trie; -typedef shared_ptr<parameter_trie> parameter_trie_ptr; -typedef std::map<char,parameter_trie_ptr> trie_per_char; -typedef std::vector<boost::reference_wrapper<parameter_cla_id const> > param_cla_id_list; - -struct parameter_trie { - parameter_trie() : m_has_final_candidate( false ) {} - - /// If subtrie corresponding to the char c exists returns it otherwise creates new - parameter_trie_ptr make_subtrie( char c ) - { - trie_per_char::const_iterator it = m_subtrie.find( c ); - - if( it == m_subtrie.end() ) - it = m_subtrie.insert( std::make_pair( c, parameter_trie_ptr( new parameter_trie ) ) ).first; - - return it->second; - } - - /// Creates series of sub-tries per characters in a string - parameter_trie_ptr make_subtrie( cstring s ) - { - parameter_trie_ptr res; - - BOOST_TEST_FOREACH( char, c, s ) - res = (res ? res->make_subtrie( c ) : make_subtrie( c )); - - return res; - } - - /// Registers candidate parameter for this subtrie. If final, it needs to be unique - void add_candidate_id( parameter_cla_id const& param_id, basic_param_ptr param_candidate, bool final ) - { - BOOST_TEST_I_ASSRT( !m_has_final_candidate && (!final || m_id_candidates.empty()), - conflicting_param() << "Parameter cla id " << param_id.m_tag << " conflicts with the " - << "parameter cla id " << m_id_candidates.back().get().m_tag ); - - m_has_final_candidate = final; - m_id_candidates.push_back( ref(param_id) ); - - if( m_id_candidates.size() == 1 ) - m_param_candidate = param_candidate; - else - m_param_candidate.reset(); - } - - /// Gets subtrie for specified char if present or nullptr otherwise - parameter_trie_ptr get_subtrie( char c ) const - { - trie_per_char::const_iterator it = m_subtrie.find( c ); - - return it != m_subtrie.end() ? it->second : parameter_trie_ptr(); - } - - // Data members - trie_per_char m_subtrie; - param_cla_id_list m_id_candidates; - basic_param_ptr m_param_candidate; - bool m_has_final_candidate; -}; - -// ************************************************************************** // -// ************** runtime::cla::report_foreing_token ************** // -// ************************************************************************** // - -static void -report_foreing_token( cstring program_name, cstring token ) -{ - std::cerr << "Boost.Test WARNING: token \"" << token << "\" does not correspond to the Boost.Test argument \n" - << " and should be placed after all Boost.Test arguments and the -- separator.\n" - << " For example: " << program_name << " --random -- " << token << "\n"; -} - -} // namespace rt_cla_detail - -// ************************************************************************** // -// ************** runtime::cla::parser ************** // -// ************************************************************************** // - -class parser { -public: - /// Initializes a parser and builds internal trie representation used for - /// parsing based on the supplied parameters -#ifndef BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS - template<typename Modifiers=nfp::no_params_type> - parser( parameters_store const& parameters, Modifiers const& m = nfp::no_params ) -#else - template<typename Modifiers> - parser( parameters_store const& parameters, Modifiers const& m ) -#endif - { - nfp::opt_assign( m_end_of_param_indicator, m, end_of_params ); - nfp::opt_assign( m_negation_prefix, m, negation_prefix ); - - BOOST_TEST_I_ASSRT( algorithm::all_of( m_end_of_param_indicator.begin(), - m_end_of_param_indicator.end(), - parameter_cla_id::valid_prefix_char ), - invalid_cla_id() << "End of parameters indicator can only consist of prefix characters." ); - - BOOST_TEST_I_ASSRT( algorithm::all_of( m_negation_prefix.begin(), - m_negation_prefix.end(), - parameter_cla_id::valid_name_char ), - invalid_cla_id() << "Negation prefix can only consist of prefix characters." ); - - build_trie( parameters ); - } - - // input processing method - int - parse( int argc, char** argv, runtime::arguments_store& res ) - { - // save program name for help message - m_program_name = argv[0]; - cstring path_sep( "\\/" ); - - cstring::iterator it = unit_test::utils::find_last_of( m_program_name.begin(), m_program_name.end(), - path_sep.begin(), path_sep.end() ); - if( it != m_program_name.end() ) - m_program_name.trim_left( it + 1 ); - - // Set up the traverser - argv_traverser tr( argc, (char const**)argv ); - - // Loop till we reach end of input - while( !tr.eoi() ) { - cstring curr_token = tr.current_token(); - - cstring prefix; - cstring name; - cstring value_separator; - bool negative_form = false; - - // Perform format validations and split the argument into prefix, name and separator - // False return value indicates end of params indicator is met - if( !validate_token_format( curr_token, prefix, name, value_separator, negative_form ) ) { - // get rid of "end of params" token - tr.next_token(); - break; - } - - // Locate trie corresponding to found prefix and skip it in the input - trie_ptr curr_trie = m_param_trie[prefix]; - - if( !curr_trie ) { - // format_error() << "Unrecognized parameter prefix in the argument " << tr.current_token() - rt_cla_detail::report_foreing_token( m_program_name, curr_token ); - tr.save_token(); - continue; - } - - curr_token.trim_left( prefix.size() ); - - // Locate parameter based on a name and skip it in the input - locate_result locate_res = locate_parameter( curr_trie, name, curr_token ); - parameter_cla_id const& found_id = locate_res.first; - basic_param_ptr found_param = locate_res.second; - - if( negative_form ) { - BOOST_TEST_I_ASSRT( found_id.m_negatable, - format_error( found_param->p_name ) - << "Parameter tag " << found_id.m_tag << " is not negatable." ); - - curr_token.trim_left( m_negation_prefix.size() ); - } - - curr_token.trim_left( name.size() ); - - bool should_go_to_next = true; - cstring value; - - - // Skip validations if parameter has optional value and we are at the end of token - if( !value_separator.is_empty() || !found_param->p_has_optional_value ) { - - // we are given a separator or there is no optional value - - // Validate and skip value separator in the input - BOOST_TEST_I_ASSRT( found_id.m_value_separator == value_separator, - format_error( found_param->p_name ) - << "Invalid separator for the parameter " - << found_param->p_name - << " in the argument " << tr.current_token() ); - - curr_token.trim_left( value_separator.size() ); - - // Deduce value source - value = curr_token; - if( value.is_empty() ) { - tr.next_token(); - value = tr.current_token(); - } - - BOOST_TEST_I_ASSRT( !value.is_empty(), - format_error( found_param->p_name ) - << "Missing an argument value for the parameter " - << found_param->p_name - << " in the argument " << tr.current_token() ); - } - else if( (value_separator.is_empty() && found_id.m_value_separator.empty()) ) { - // Deduce value source - value = curr_token; - if( value.is_empty() ) { - tr.next_token(); // tokenization broke the value, we check the next one - - if(!found_param->p_has_optional_value) { - // there is no separator and there is no optional value - // we look for the value on the next token - // example "-t XXXX" (no default) - // and we commit this value as being the passed value - value = tr.current_token(); - } - else { - // there is no separator and the value is optional - // we check the next token - // example "-c" (defaults to true) - // and commit this as the value if this is not a token - cstring value_check = tr.current_token(); - - cstring prefix_test, name_test, value_separator_test; - bool negative_form_test; - if( validate_token_format( value_check, prefix_test, name_test, value_separator_test, negative_form_test ) - && m_param_trie[prefix_test]) { - // this is a token, we consume what we have - should_go_to_next = false; - } - else { - // this is a value, we commit it - value = value_check; - } - } - } - } - - // Validate against argument duplication - BOOST_TEST_I_ASSRT( !res.has( found_param->p_name ) || found_param->p_repeatable, - duplicate_arg( found_param->p_name ) - << "Duplicate argument value for the parameter " - << found_param->p_name - << " in the argument " << tr.current_token() ); - - // Produce argument value - found_param->produce_argument( value, negative_form, res ); - - if(should_go_to_next) { - tr.next_token(); - } - } - - // generate the remainder and return it's size - return tr.remainder(); - } - - // help/usage/version - void - version( std::ostream& ostr ) - { - ostr << "Boost.Test module "; - -#if defined(BOOST_TEST_MODULE) - // we do not want to refer to the master test suite there - ostr << '\'' << BOOST_TEST_STRINGIZE( BOOST_TEST_MODULE ).trim( "\"" ) << "' "; -#endif - - ostr << "in executable '" << m_program_name << "'\n"; - ostr << "Compiled from Boost version " - << BOOST_VERSION/100000 << "." - << BOOST_VERSION/100 % 1000 << "." - << BOOST_VERSION % 100 ; - ostr << " with "; -#if defined(BOOST_TEST_INCLUDED) - ostr << "header-only inclusion of"; -#elif defined(BOOST_TEST_DYN_LINK) - ostr << "dynamic linking to"; -#else - ostr << "static linking to"; -#endif - ostr << " Boost.Test\n"; - ostr << "- Compiler: " << BOOST_COMPILER << '\n' - << "- Platform: " << BOOST_PLATFORM << '\n' - << "- STL : " << BOOST_STDLIB; - ostr << std::endl; - } - - void - usage(std::ostream& ostr, - cstring param_name = cstring(), - bool use_color = true) - { - namespace utils = unit_test::utils; - namespace ut_detail = unit_test::ut_detail; - - if( !param_name.is_empty() ) { - basic_param_ptr param = locate_parameter( m_param_trie[help_prefix], param_name, "" ).second; - param->usage( ostr, m_negation_prefix ); - } - else { - ostr << "\n The program '" << m_program_name << "' is a Boost.Test module containing unit tests."; - - { - BOOST_TEST_SCOPE_SETCOLOR( use_color, ostr, term_attr::BRIGHT, term_color::ORIGINAL ); - ostr << "\n\n Usage\n "; - } - - { - BOOST_TEST_SCOPE_SETCOLOR( use_color, ostr, term_attr::BRIGHT, term_color::GREEN ); - ostr << m_program_name << " [Boost.Test argument]... "; - } - if( !m_end_of_param_indicator.empty() ) { - BOOST_TEST_SCOPE_SETCOLOR( use_color, ostr, term_attr::BRIGHT, term_color::YELLOW ); - ostr << '[' << m_end_of_param_indicator << " [custom test module argument]...]"; - } - } - - ostr << "\n\n Use\n "; - { - - BOOST_TEST_SCOPE_SETCOLOR( use_color, ostr, term_attr::BRIGHT, term_color::GREEN ); - ostr << m_program_name << " --help"; - } - ostr << "\n or "; - { - BOOST_TEST_SCOPE_SETCOLOR( use_color, ostr, term_attr::BRIGHT, term_color::GREEN ); - ostr << m_program_name << " --help=<parameter name>"; - } - ostr << "\n for detailed help on Boost.Test parameters.\n"; - } - - void - help(std::ostream& ostr, - parameters_store const& parameters, - cstring param_name, - bool use_color = true) - { - namespace utils = unit_test::utils; - namespace ut_detail = unit_test::ut_detail; - - if( !param_name.is_empty() ) { - basic_param_ptr param = locate_parameter( m_param_trie[help_prefix], param_name, "" ).second; - param->help( ostr, m_negation_prefix, use_color); - return; - } - - usage(ostr, cstring(), use_color); - - ostr << "\n\n"; - { - BOOST_TEST_SCOPE_SETCOLOR( use_color, ostr, term_attr::BRIGHT, term_color::ORIGINAL ); - ostr << " Command line flags:\n"; - } - runtime::commandline_pretty_print( - ostr, - " ", - "The command line flags of Boost.Test are listed below. " - "All parameters are optional. You can specify parameter value either " - "as a command line argument or as a value of its corresponding environment " - "variable. If a flag is specified as a command line argument and an environment variable " - "at the same time, the command line takes precedence. " - "The command line argument " - "support name guessing, and works with shorter names as long as those are not ambiguous." - ); - - if( !m_end_of_param_indicator.empty() ) { - ostr << "\n\n All the arguments after the '"; - { - BOOST_TEST_SCOPE_SETCOLOR( use_color, ostr, term_attr::BRIGHT, term_color::YELLOW ); - ostr << m_end_of_param_indicator; - } - ostr << "' are ignored by Boost.Test."; - } - - - { - BOOST_TEST_SCOPE_SETCOLOR( use_color, ostr, term_attr::BRIGHT, term_color::ORIGINAL ); - ostr << "\n\n Environment variables:\n"; - } - runtime::commandline_pretty_print( - ostr, - " ", - "Every argument listed below may also be set by a corresponding environment" - "variable. For an argument '--argument_x=<value>', the corresponding " - "environment variable is 'BOOST_TEST_ARGUMENT_X=value" - ); - - - - ostr << "\n\n The following parameters are supported:\n"; - - BOOST_TEST_FOREACH( - parameters_store::storage_type::value_type const&, - v, - parameters.all() ) - { - basic_param_ptr param = v.second; - ostr << "\n"; - param->usage( ostr, m_negation_prefix, use_color); - } - - } - -private: - typedef rt_cla_detail::parameter_trie_ptr trie_ptr; - typedef rt_cla_detail::trie_per_char trie_per_char; - typedef std::map<cstring,trie_ptr> str_to_trie; - - void - build_trie( parameters_store const& parameters ) - { - // Iterate over all parameters - BOOST_TEST_FOREACH( parameters_store::storage_type::value_type const&, v, parameters.all() ) { - basic_param_ptr param = v.second; - - // Register all parameter's ids in trie. - BOOST_TEST_FOREACH( parameter_cla_id const&, id, param->cla_ids() ) { - // This is the trie corresponding to the prefix. - trie_ptr next_trie = m_param_trie[id.m_prefix]; - if( !next_trie ) - next_trie = m_param_trie[id.m_prefix] = trie_ptr( new rt_cla_detail::parameter_trie ); - - // Build the trie, by following name's characters - // and register this parameter as candidate on each level - for( size_t index = 0; index < id.m_tag.size(); ++index ) { - next_trie = next_trie->make_subtrie( id.m_tag[index] ); - - next_trie->add_candidate_id( id, param, index == (id.m_tag.size() - 1) ); - } - } - } - } - - bool - validate_token_format( cstring token, cstring& prefix, cstring& name, cstring& separator, bool& negative_form ) - { - // Match prefix - cstring::iterator it = token.begin(); - while( it != token.end() && parameter_cla_id::valid_prefix_char( *it ) ) - ++it; - - prefix.assign( token.begin(), it ); - - if( prefix.empty() ) - return true; - - // Match name - while( it != token.end() && parameter_cla_id::valid_name_char( *it ) ) - ++it; - - name.assign( prefix.end(), it ); - - if( name.empty() ) { - if( prefix == m_end_of_param_indicator ) - return false; - - BOOST_TEST_I_THROW( format_error() << "Invalid format for an actual argument " << token ); - } - - // Match value separator - while( it != token.end() && parameter_cla_id::valid_separator_char( *it ) ) - ++it; - - separator.assign( name.end(), it ); - - // Match negation prefix - negative_form = !m_negation_prefix.empty() && ( name.substr( 0, m_negation_prefix.size() ) == m_negation_prefix ); - if( negative_form ) - name.trim_left( m_negation_prefix.size() ); - - return true; - } - - // C++03: cannot have references as types - typedef std::pair<parameter_cla_id, basic_param_ptr> locate_result; - - locate_result - locate_parameter( trie_ptr curr_trie, cstring name, cstring token ) - { - std::vector<trie_ptr> typo_candidates; - std::vector<trie_ptr> next_typo_candidates; - trie_ptr next_trie; - - BOOST_TEST_FOREACH( char, c, name ) { - if( curr_trie ) { - // locate next subtrie corresponding to the char - next_trie = curr_trie->get_subtrie( c ); - - if( next_trie ) - curr_trie = next_trie; - else { - // Initiate search for typo candicates. We will account for 'wrong char' typo - // 'missing char' typo and 'extra char' typo - BOOST_TEST_FOREACH( trie_per_char::value_type const&, typo_cand, curr_trie->m_subtrie ) { - // 'wrong char' typo - typo_candidates.push_back( typo_cand.second ); - - // 'missing char' typo - if( (next_trie = typo_cand.second->get_subtrie( c )) ) - typo_candidates.push_back( next_trie ); - } - - // 'extra char' typo - typo_candidates.push_back( curr_trie ); - - curr_trie.reset(); - } - } - else { - // go over existing typo candidates and see if they are still viable - BOOST_TEST_FOREACH( trie_ptr, typo_cand, typo_candidates ) { - trie_ptr next_typo_cand = typo_cand->get_subtrie( c ); - - if( next_typo_cand ) - next_typo_candidates.push_back( next_typo_cand ); - } - - next_typo_candidates.swap( typo_candidates ); - next_typo_candidates.clear(); - } - } - - if( !curr_trie ) { - std::vector<cstring> typo_candidate_names; - std::set<parameter_cla_id const*> unique_typo_candidate; // !! ?? unordered_set - typo_candidate_names.reserve( typo_candidates.size() ); -// !! ?? unique_typo_candidate.reserve( typo_candidates.size() ); - - BOOST_TEST_FOREACH( trie_ptr, trie_cand, typo_candidates ) { - // avoid ambiguos candidate trie - if( trie_cand->m_id_candidates.size() > 1 ) - continue; - - BOOST_TEST_FOREACH( parameter_cla_id const&, param_cand, trie_cand->m_id_candidates ) { - if( !unique_typo_candidate.insert( ¶m_cand ).second ) - continue; - - typo_candidate_names.push_back( param_cand.m_tag ); - } - } - -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES - BOOST_TEST_I_THROW( unrecognized_param( std::move(typo_candidate_names) ) - << "An unrecognized parameter in the argument " - << token ); -#else - BOOST_TEST_I_THROW( unrecognized_param( typo_candidate_names ) - << "An unrecognized parameter in the argument " - << token ); -#endif - } - - if( curr_trie->m_id_candidates.size() > 1 ) { - std::vector<cstring> amb_names; - BOOST_TEST_FOREACH( parameter_cla_id const&, param_id, curr_trie->m_id_candidates ) - amb_names.push_back( param_id.m_tag ); - -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES - BOOST_TEST_I_THROW( ambiguous_param( std::move( amb_names ) ) - << "An ambiguous parameter name in the argument " << token ); -#else - BOOST_TEST_I_THROW( ambiguous_param( amb_names ) - << "An ambiguous parameter name in the argument " << token ); -#endif - } - - return locate_result( curr_trie->m_id_candidates.back().get(), curr_trie->m_param_candidate ); - } - - // Data members - cstring m_program_name; - std::string m_end_of_param_indicator; - std::string m_negation_prefix; - str_to_trie m_param_trie; -}; - -} // namespace cla -} // namespace runtime -} // namespace boost - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_UTILS_RUNTIME_CLA_PARSER_HPP diff --git a/contrib/restricted/boost/test/include/boost/test/utils/runtime/env/fetch.hpp b/contrib/restricted/boost/test/include/boost/test/utils/runtime/env/fetch.hpp deleted file mode 100644 index 97d54d4905..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/utils/runtime/env/fetch.hpp +++ /dev/null @@ -1,108 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : implements fetching absent parameter athuments from environment -// *************************************************************************** - -#ifndef BOOST_TEST_UTILS_RUNTIME_ENV_FETCH_HPP -#define BOOST_TEST_UTILS_RUNTIME_ENV_FETCH_HPP - -// Boost.Test Runtime parameters -#include <boost/test/utils/runtime/parameter.hpp> -#include <boost/test/utils/runtime/argument.hpp> - -#include <boost/test/detail/suppress_warnings.hpp> - -// C Runtime -#include <stdlib.h> - -namespace boost { -namespace runtime { -namespace env { - -namespace env_detail { - -#ifndef UNDER_CE - -#ifdef BOOST_MSVC -#pragma warning(push) -#pragma warning(disable:4996) // getenv -#endif - -inline std::pair<cstring,bool> -sys_read_var( cstring var_name ) -{ - using namespace std; - char const* res = getenv( var_name.begin() ); - - return std::make_pair( cstring(res), res != NULL ); -} - -#ifdef BOOST_MSVC -#pragma warning(pop) -#endif - -#else - -inline std::pair<cstring,bool> -sys_read_var( cstring var_name ) -{ - return std::make_pair( cstring(), false ); -} - -#endif - -//____________________________________________________________________________// - -template<typename ReadFunc> -inline void -fetch_absent( parameters_store const& params, runtime::arguments_store& args, ReadFunc read_func ) -{ - BOOST_TEST_FOREACH( parameters_store::storage_type::value_type const&, v, params.all() ) { - basic_param_ptr param = v.second; - - if( args.has( param->p_name ) || param->p_env_var.empty() ) - continue; - - std::pair<cstring,bool> value = read_func( param->p_env_var ); - - if( !value.second ) - continue; - - // Validate against unexpected empty value - BOOST_TEST_I_ASSRT( !value.first.is_empty() || param->p_has_optional_value, - format_error( param->p_name ) - << "Missing an argument value for the parameter " << param->p_name - << " in the environment." ); - - // Produce argument value - param->produce_argument( value.first, false, args ); - - } -} - -//____________________________________________________________________________// - -} // namespace env_detail - -inline void -fetch_absent( parameters_store const& params, runtime::arguments_store& args ) -{ - env_detail::fetch_absent( params, args, &env_detail::sys_read_var ); -} - -} // namespace env -} // namespace runtime -} // namespace boost - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_UTILS_RUNTIME_ENV_FETCH_HPP diff --git a/contrib/restricted/boost/test/include/boost/test/utils/runtime/errors.hpp b/contrib/restricted/boost/test/include/boost/test/utils/runtime/errors.hpp deleted file mode 100644 index a33af62648..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/utils/runtime/errors.hpp +++ /dev/null @@ -1,195 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : defines runtime parameters setup error -// *************************************************************************** - -#ifndef BOOST_TEST_UTILS_RUNTIME_INIT_ERROR_HPP -#define BOOST_TEST_UTILS_RUNTIME_INIT_ERROR_HPP - -// Boost.Test Runtime parameters -#include <boost/test/utils/runtime/fwd.hpp> - -// Boost.Test -#include <boost/test/utils/string_cast.hpp> - -// Boost.Test -#include <boost/config.hpp> - -// STL -#include <exception> -#include <vector> - -#include <boost/test/detail/suppress_warnings.hpp> - -namespace boost { -namespace runtime { - -// ************************************************************************** // -// ************** runtime::param_error ************** // -// ************************************************************************** // - -class BOOST_SYMBOL_VISIBLE param_error : public std::exception { -public: - ~param_error() BOOST_NOEXCEPT_OR_NOTHROW BOOST_OVERRIDE {} - - const char * what() const BOOST_NOEXCEPT_OR_NOTHROW BOOST_OVERRIDE - { - return msg.c_str(); - } - - cstring param_name; - std::string msg; - -protected: - explicit param_error( cstring param_name_ ) : param_name( param_name_) {} -}; - -//____________________________________________________________________________// - -class BOOST_SYMBOL_VISIBLE init_error : public param_error { -protected: - explicit init_error( cstring param_name ) : param_error( param_name ) {} - ~init_error() BOOST_NOEXCEPT_OR_NOTHROW BOOST_OVERRIDE {} -}; - -class BOOST_SYMBOL_VISIBLE input_error : public param_error { -protected: - explicit input_error( cstring param_name ) : param_error( param_name ) {} - ~input_error() BOOST_NOEXCEPT_OR_NOTHROW BOOST_OVERRIDE {} -}; - -//____________________________________________________________________________// - -template<typename Derived, typename Base> -class BOOST_SYMBOL_VISIBLE specific_param_error : public Base { -protected: - explicit specific_param_error( cstring param_name ) : Base( param_name ) {} - ~specific_param_error() BOOST_NOEXCEPT_OR_NOTHROW BOOST_OVERRIDE {} - -public: - -//____________________________________________________________________________// - -#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && \ - !defined(BOOST_NO_CXX11_REF_QUALIFIERS) - - Derived operator<<(char const* val) && - { - this->msg.append( val ); - - return static_cast<Derived&&>(*this); - } - - //____________________________________________________________________________// - - template<typename T> - Derived operator<<(T const& val) && - { - this->msg.append( unit_test::utils::string_cast( val ) ); - - return static_cast<Derived&&>(*this); - } - - //____________________________________________________________________________// - -#else - - Derived const& operator<<(char const* val) const - { - const_cast<specific_param_error<Derived, Base>&>(*this).msg.append( val ); - - return static_cast<Derived const&>(*this); - } - - //____________________________________________________________________________// - - template<typename T> - Derived const& operator<<(T const& val) const - { - const_cast<specific_param_error<Derived, Base>&>(*this).msg.append( unit_test::utils::string_cast( val ) ); - - return static_cast<Derived const&>(*this); - } - - //____________________________________________________________________________// - -#endif - -}; - - - -// ************************************************************************** // -// ************** specific exception types ************** // -// ************************************************************************** // - -#define SPECIFIC_EX_TYPE( type, base ) \ -class BOOST_SYMBOL_VISIBLE type : public specific_param_error<type,base> { \ -public: \ - explicit type( cstring param_name = cstring() ) \ - : specific_param_error<type,base>( param_name ) \ - {} \ -} \ -/**/ - -SPECIFIC_EX_TYPE( invalid_cla_id, init_error ); -SPECIFIC_EX_TYPE( duplicate_param, init_error ); -SPECIFIC_EX_TYPE( conflicting_param, init_error ); -SPECIFIC_EX_TYPE( unknown_param, init_error ); -SPECIFIC_EX_TYPE( access_to_missing_argument, init_error ); -SPECIFIC_EX_TYPE( arg_type_mismatch, init_error ); -SPECIFIC_EX_TYPE( invalid_param_spec, init_error ); - -SPECIFIC_EX_TYPE( format_error, input_error ); -SPECIFIC_EX_TYPE( duplicate_arg, input_error ); -SPECIFIC_EX_TYPE( missing_req_arg, input_error ); - -#undef SPECIFIC_EX_TYPE - -class BOOST_SYMBOL_VISIBLE ambiguous_param : public specific_param_error<ambiguous_param, input_error> { -public: -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES - explicit ambiguous_param( std::vector<cstring>&& amb_candidates ) - : specific_param_error<ambiguous_param,input_error>( "" ) - , m_amb_candidates( std::move( amb_candidates ) ) {} -#else - explicit ambiguous_param( std::vector<cstring> const& amb_candidates ) - : specific_param_error<ambiguous_param,input_error>( "" ) - , m_amb_candidates( amb_candidates ) {} -#endif - ~ambiguous_param() BOOST_NOEXCEPT_OR_NOTHROW BOOST_OVERRIDE {} - - std::vector<cstring> m_amb_candidates; -}; - -class BOOST_SYMBOL_VISIBLE unrecognized_param : public specific_param_error<unrecognized_param, input_error> { -public: -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES - explicit unrecognized_param( std::vector<cstring>&& type_candidates ) - : specific_param_error<unrecognized_param,input_error>( "" ) - , m_typo_candidates( std::move( type_candidates ) ) {} -#else - explicit unrecognized_param( std::vector<cstring> const& type_candidates ) - : specific_param_error<unrecognized_param,input_error>( "" ) - , m_typo_candidates( type_candidates ) {} -#endif - ~unrecognized_param() BOOST_NOEXCEPT_OR_NOTHROW BOOST_OVERRIDE {} - - std::vector<cstring> m_typo_candidates; -}; - -} // namespace runtime -} // namespace boost - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_UTILS_RUNTIME_INIT_ERROR_HPP diff --git a/contrib/restricted/boost/test/include/boost/test/utils/runtime/finalize.hpp b/contrib/restricted/boost/test/include/boost/test/utils/runtime/finalize.hpp deleted file mode 100644 index 181428550c..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/utils/runtime/finalize.hpp +++ /dev/null @@ -1,56 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : runtime parameters initialization final step -// *************************************************************************** - -#ifndef BOOST_TEST_UTILS_RUNTIME_FINALIZE_HPP -#define BOOST_TEST_UTILS_RUNTIME_FINALIZE_HPP - -// Boost.Test Runtime parameters -#include <boost/test/utils/runtime/parameter.hpp> -#include <boost/test/utils/runtime/argument.hpp> - -// Boost.Test -#include <boost/test/utils/foreach.hpp> - -#include <boost/test/detail/suppress_warnings.hpp> - -namespace boost { -namespace runtime { - -inline void -finalize_arguments( parameters_store const& params, runtime::arguments_store& args ) -{ - BOOST_TEST_FOREACH( parameters_store::storage_type::value_type const&, v, params.all() ) { - basic_param_ptr param = v.second; - - if( !args.has( param->p_name ) ) { - if( param->p_has_default_value ) - param->produce_default( args ); - - if( !args.has( param->p_name ) ) { - BOOST_TEST_I_ASSRT( param->p_optional, - missing_req_arg( param->p_name ) << "Missing argument for required parameter " << param->p_name << "." ); - } - } - - if( args.has( param->p_name ) && !!param->p_callback ) - param->p_callback( param->p_name ); - } -} - -} // namespace runtime -} // namespace boost - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_UTILS_RUNTIME_FINALIZE_HPP diff --git a/contrib/restricted/boost/test/include/boost/test/utils/runtime/fwd.hpp b/contrib/restricted/boost/test/include/boost/test/utils/runtime/fwd.hpp deleted file mode 100644 index 17ae881222..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/utils/runtime/fwd.hpp +++ /dev/null @@ -1,45 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : runtime parameters forward declaration -// *************************************************************************** - -#ifndef BOOST_TEST_UTILS_RUNTIME_FWD_HPP -#define BOOST_TEST_UTILS_RUNTIME_FWD_HPP - -// Boost.Test -#include <boost/test/detail/config.hpp> -#include <boost/test/utils/basic_cstring/basic_cstring.hpp> -#include <boost/test/utils/basic_cstring/io.hpp> // operator<<(boost::runtime::cstring) - -// Boost -#include <boost/shared_ptr.hpp> - -// STL -#include <map> - -namespace boost { -namespace runtime { - -typedef unit_test::const_string cstring; - -class argument; -typedef shared_ptr<argument> argument_ptr; - -template<typename T> class typed_argument; - -class basic_param; -typedef shared_ptr<basic_param> basic_param_ptr; - -} // namespace runtime -} // namespace boost - -#endif // BOOST_TEST_UTILS_RUNTIME_FWD_HPP diff --git a/contrib/restricted/boost/test/include/boost/test/utils/runtime/modifier.hpp b/contrib/restricted/boost/test/include/boost/test/utils/runtime/modifier.hpp deleted file mode 100644 index 78c8817e7c..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/utils/runtime/modifier.hpp +++ /dev/null @@ -1,107 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Use, modification, and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : parameter modifiers -// *************************************************************************** - -#ifndef BOOST_TEST_UTILS_RUNTIME_MODIFIER_HPP -#define BOOST_TEST_UTILS_RUNTIME_MODIFIER_HPP - -// Boost.Test Runtime parameters -#include <boost/test/utils/runtime/fwd.hpp> - -// Boost.Test -#include <boost/test/utils/named_params.hpp> -#include <boost/test/detail/global_typedef.hpp> - -#include <boost/test/detail/suppress_warnings.hpp> - - -// New CLA API available only for some C++11 compilers -#if !defined(BOOST_NO_CXX11_AUTO_DECLARATIONS) \ - && !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) \ - && !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) \ - && !defined(BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX) -#define BOOST_TEST_CLA_NEW_API -#endif - -namespace boost { -namespace runtime { - -// ************************************************************************** // -// ************** environment variable modifiers ************** // -// ************************************************************************** // - -namespace { - -#ifdef BOOST_TEST_CLA_NEW_API -auto const& description = unit_test::static_constant<nfp::typed_keyword<cstring,struct description_t>>::value; -auto const& help = unit_test::static_constant<nfp::typed_keyword<cstring,struct help_t>>::value; -auto const& env_var = unit_test::static_constant<nfp::typed_keyword<cstring,struct env_var_t>>::value; -auto const& end_of_params = unit_test::static_constant<nfp::typed_keyword<cstring,struct end_of_params_t>>::value; -auto const& negation_prefix = unit_test::static_constant<nfp::typed_keyword<cstring,struct neg_prefix_t>>::value; -auto const& value_hint = unit_test::static_constant<nfp::typed_keyword<cstring,struct value_hint_t>>::value; -auto const& optional_value = unit_test::static_constant<nfp::keyword<struct optional_value_t>>::value; -auto const& default_value = unit_test::static_constant<nfp::keyword<struct default_value_t>>::value; -auto const& callback = unit_test::static_constant<nfp::keyword<struct callback_t>>::value; - -template<typename EnumType> -using enum_values = unit_test::static_constant< - nfp::typed_keyword<std::initializer_list<std::pair<const cstring,EnumType>>, struct enum_values_t> ->; - -#else - -nfp::typed_keyword<cstring,struct description_t> description; -nfp::typed_keyword<cstring,struct help_t> help; -nfp::typed_keyword<cstring,struct env_var_t> env_var; -nfp::typed_keyword<cstring,struct end_of_params_t> end_of_params; -nfp::typed_keyword<cstring,struct neg_prefix_t> negation_prefix; -nfp::typed_keyword<cstring,struct value_hint_t> value_hint; -nfp::keyword<struct optional_value_t> optional_value; -nfp::keyword<struct default_value_t> default_value; -nfp::keyword<struct callback_t> callback; - -template<typename EnumType> -struct enum_values_list { - typedef std::pair<cstring,EnumType> ElemT; - typedef std::vector<ElemT> ValuesT; - - enum_values_list const& - operator()( cstring k, EnumType v ) const - { - const_cast<enum_values_list*>(this)->m_values.push_back( ElemT( k, v ) ); - - return *this; - } - - operator ValuesT const&() const { return m_values; } - -private: - ValuesT m_values; -}; - -template<typename EnumType> -struct enum_values : unit_test::static_constant< - nfp::typed_keyword<enum_values_list<EnumType>, struct enum_values_t> > -{ -}; - -#endif - -} // local namespace - -} // namespace runtime -} // namespace boost - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_UTILS_RUNTIME_MODIFIER_HPP diff --git a/contrib/restricted/boost/test/include/boost/test/utils/runtime/parameter.hpp b/contrib/restricted/boost/test/include/boost/test/utils/runtime/parameter.hpp deleted file mode 100644 index 4509107653..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/utils/runtime/parameter.hpp +++ /dev/null @@ -1,526 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : formal parameter definition -// *************************************************************************** - -#ifndef BOOST_TEST_UTILS_RUNTIME_PARAMETER_HPP -#define BOOST_TEST_UTILS_RUNTIME_PARAMETER_HPP - -// Boost.Test Runtime parameters -#include <boost/test/utils/runtime/fwd.hpp> -#include <boost/test/utils/runtime/modifier.hpp> -#include <boost/test/utils/runtime/argument.hpp> -#include <boost/test/utils/runtime/argument_factory.hpp> - -// Boost.Test -#include <boost/test/utils/class_properties.hpp> -#include <boost/test/utils/foreach.hpp> -#include <boost/test/utils/setcolor.hpp> - -// Boost -#include <boost/function.hpp> -#include <boost/algorithm/cxx11/all_of.hpp> - -// STL -#include <algorithm> - -#include <boost/test/detail/suppress_warnings.hpp> - -namespace boost { -namespace runtime { - -inline -std::ostream& commandline_pretty_print( - std::ostream& ostr, - std::string const& prefix, - std::string const& to_print) { - - const int split_at = 80; - - std::string::size_type current = 0; - - while(current < to_print.size()) { - - // discards spaces at the beginning - std::string::size_type startpos = to_print.find_first_not_of(" \t\n", current); - current += startpos - current; - - bool has_more_lines = (current + split_at) < to_print.size(); - - if(has_more_lines) { - std::string::size_type endpos = to_print.find_last_of(" \t\n", current + split_at); - std::string sub(to_print.substr(current, endpos - current)); - ostr << prefix << sub; - ostr << "\n"; - current += endpos - current; - } - else - { - ostr << prefix << to_print.substr(current, split_at); - current += split_at; - } - } - return ostr; -} - -// ************************************************************************** // -// ************** runtime::parameter_cla_id ************** // -// ************************************************************************** // -// set of attributes identifying the parameter in the command line - -struct parameter_cla_id { - parameter_cla_id( cstring prefix, cstring tag, cstring value_separator, bool negatable ) - : m_prefix( prefix.begin(), prefix.size() ) - , m_tag( tag.begin(), tag.size() ) - , m_value_separator( value_separator.begin(), value_separator.size() ) - , m_negatable( negatable ) - { - - BOOST_TEST_I_ASSRT( algorithm::all_of( m_prefix.begin(), m_prefix.end(), valid_prefix_char ), - invalid_cla_id() << "Parameter " << m_tag - << " has invalid characters in prefix." ); - - BOOST_TEST_I_ASSRT( algorithm::all_of( m_tag.begin(), m_tag.end(), valid_name_char ), - invalid_cla_id() << "Parameter " << m_tag - << " has invalid characters in name." ); - - BOOST_TEST_I_ASSRT( algorithm::all_of( m_value_separator.begin(), m_value_separator.end(), valid_separator_char ), - invalid_cla_id() << "Parameter " << m_tag - << " has invalid characters in value separator." ); - } - - static bool valid_prefix_char( char c ) - { - return c == '-' || c == '/' ; - } - static bool valid_separator_char( char c ) - { - return c == '=' || c == ':' || c == ' ' || c == '\0'; - } - static bool valid_name_char( char c ) - { - return std::isalnum( c ) || c == '+' || c == '_' || c == '?'; - } - - std::string m_prefix; - std::string m_tag; - std::string m_value_separator; - bool m_negatable; -}; - -typedef std::vector<parameter_cla_id> param_cla_ids; - -// ************************************************************************** // -// ************** runtime::basic_param ************** // -// ************************************************************************** // - -cstring const help_prefix("////"); - -class basic_param { - typedef function<void (cstring)> callback_type; - typedef unit_test::readwrite_property<bool> bool_property; - -protected: - /// Constructor with modifiers - template<typename Modifiers> - basic_param( cstring name, bool is_optional, bool is_repeatable, Modifiers const& m ) - : p_name( name.begin(), name.end() ) - , p_description( nfp::opt_get( m, description, std::string() ) ) - , p_help( nfp::opt_get( m, runtime::help, std::string() ) ) - , p_env_var( nfp::opt_get( m, env_var, std::string() ) ) - , p_value_hint( nfp::opt_get( m, value_hint, std::string() ) ) - , p_optional( is_optional ) - , p_repeatable( is_repeatable ) - , p_has_optional_value( m.has( optional_value ) ) - , p_has_default_value( m.has( default_value ) || is_repeatable ) - , p_callback( nfp::opt_get( m, callback, callback_type() ) ) - { - add_cla_id( help_prefix, name, ":" ); - } - -public: - virtual ~basic_param() {} - - // Pubic properties - std::string const p_name; - std::string const p_description; - std::string const p_help; - std::string const p_env_var; - std::string const p_value_hint; - bool const p_optional; - bool const p_repeatable; - bool_property p_has_optional_value; - bool_property p_has_default_value; - callback_type const p_callback; - - /// interface for cloning typed parameters - virtual basic_param_ptr clone() const = 0; - - /// Access methods - param_cla_ids const& cla_ids() const { return m_cla_ids; } - void add_cla_id( cstring prefix, cstring tag, cstring value_separator ) - { - add_cla_id_impl( prefix, tag, value_separator, false, true ); - } - - /// interface for producing argument values for this parameter - virtual void produce_argument( cstring token, bool negative_form, arguments_store& store ) const = 0; - virtual void produce_default( arguments_store& store ) const = 0; - - /// interfaces for help message reporting - virtual void usage( std::ostream& ostr, cstring negation_prefix_, bool use_color = true ) - { - namespace utils = unit_test::utils; - namespace ut_detail = unit_test::ut_detail; - - // - ostr << " "; - { - - BOOST_TEST_SCOPE_SETCOLOR( use_color, ostr, term_attr::BRIGHT, term_color::GREEN ); - ostr << p_name; - } - - ostr << '\n'; - - if( !p_description.empty() ) { - commandline_pretty_print(ostr, " ", p_description) << '\n'; - } - - BOOST_TEST_FOREACH( parameter_cla_id const&, id, cla_ids() ) { - if( id.m_prefix == help_prefix ) - continue; - - ostr << " " << id.m_prefix; - - if( id.m_negatable ) - cla_name_help( ostr, id.m_tag, negation_prefix_, use_color ); - else - cla_name_help( ostr, id.m_tag, "", use_color ); - - BOOST_TEST_SCOPE_SETCOLOR( use_color, ostr, term_attr::BRIGHT, term_color::YELLOW ); - bool optional_value_ = false; - - if( p_has_optional_value ) { - optional_value_ = true; - ostr << '['; - } - - - if( id.m_value_separator.empty() ) - ostr << ' '; - else { - ostr << id.m_value_separator; - } - - value_help( ostr ); - - if( optional_value_ ) - ostr << ']'; - - ostr << '\n'; - } - } - - virtual void help( std::ostream& ostr, cstring negation_prefix_, bool use_color = true ) - { - usage( ostr, negation_prefix_, use_color ); - - if( !p_help.empty() ) { - ostr << '\n'; - commandline_pretty_print(ostr, " ", p_help); - } - } - -protected: - void add_cla_id_impl( cstring prefix, - cstring tag, - cstring value_separator, - bool negatable, - bool validate_value_separator ) - { - BOOST_TEST_I_ASSRT( !tag.is_empty(), - invalid_cla_id() << "Parameter can't have an empty name." ); - - BOOST_TEST_I_ASSRT( !prefix.is_empty(), - invalid_cla_id() << "Parameter " << tag - << " can't have an empty prefix." ); - - BOOST_TEST_I_ASSRT( !value_separator.is_empty(), - invalid_cla_id() << "Parameter " << tag - << " can't have an empty value separator." ); - - // We trim value separator from all the spaces, so token end will indicate separator - value_separator.trim(); - BOOST_TEST_I_ASSRT( !validate_value_separator || !value_separator.is_empty() || !p_has_optional_value, - invalid_cla_id() << "Parameter " << tag - << " with optional value attribute can't use space as value separator." ); - - m_cla_ids.push_back( parameter_cla_id( prefix, tag, value_separator, negatable ) ); - } - -private: - /// interface for usage/help customization - virtual void cla_name_help( std::ostream& ostr, cstring cla_tag, cstring /*negation_prefix_*/, bool /*use_color*/ = true) const - { - ostr << cla_tag; - } - virtual void value_help( std::ostream& ostr ) const - { - if( p_value_hint.empty() ) - ostr << "<value>"; - else - ostr << p_value_hint; - } - - // Data members - param_cla_ids m_cla_ids; -}; - -// ************************************************************************** // -// ************** runtime::parameter ************** // -// ************************************************************************** // - -enum args_amount { - OPTIONAL_PARAM, // 0-1 - REQUIRED_PARAM, // exactly 1 - REPEATABLE_PARAM // 0-N -}; - -//____________________________________________________________________________// - -template<typename ValueType, args_amount a = runtime::OPTIONAL_PARAM, bool is_enum = false> -class parameter : public basic_param { -public: - /// Constructor with modifiers -#ifndef BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS - template<typename Modifiers=nfp::no_params_type> - parameter( cstring name, Modifiers const& m = nfp::no_params ) -#else - template<typename Modifiers> - parameter( cstring name, Modifiers const& m ) -#endif - : basic_param( name, a != runtime::REQUIRED_PARAM, a == runtime::REPEATABLE_PARAM, m ) - , m_arg_factory( m ) - { - BOOST_TEST_I_ASSRT( !m.has( default_value ) || a == runtime::OPTIONAL_PARAM, - invalid_param_spec() << "Parameter " << name - << " is not optional and can't have default_value." ); - - BOOST_TEST_I_ASSRT( !m.has( optional_value ) || !this->p_repeatable, - invalid_param_spec() << "Parameter " << name - << " is repeatable and can't have optional_value." ); - } - -private: - basic_param_ptr clone() const BOOST_OVERRIDE - { - return basic_param_ptr( new parameter( *this ) ); - } - void produce_argument( cstring token, bool , arguments_store& store ) const BOOST_OVERRIDE - { - m_arg_factory.produce_argument( token, this->p_name, store ); - } - void produce_default( arguments_store& store ) const BOOST_OVERRIDE - { - if( !this->p_has_default_value ) - return; - - m_arg_factory.produce_default( this->p_name, store ); - } - - // Data members - typedef argument_factory<ValueType, is_enum, a == runtime::REPEATABLE_PARAM> factory_t; - factory_t m_arg_factory; -}; - -//____________________________________________________________________________// - -class option : public basic_param { -public: - /// Constructor with modifiers -#ifndef BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS - template<typename Modifiers=nfp::no_params_type> - option( cstring name, Modifiers const& m = nfp::no_params ) -#else - template<typename Modifiers> - option( cstring name, Modifiers const& m ) -#endif - : basic_param( name, true, false, nfp::opt_append( nfp::opt_append( m, optional_value = true), default_value = false) ) - , m_arg_factory( nfp::opt_append( nfp::opt_append( m, optional_value = true), default_value = false) ) - { - } - - void add_cla_id( cstring prefix, cstring tag, cstring value_separator, bool negatable = false ) - { - add_cla_id_impl( prefix, tag, value_separator, negatable, false ); - } - -private: - basic_param_ptr clone() const BOOST_OVERRIDE - { - return basic_param_ptr( new option( *this ) ); - } - - void produce_argument( cstring token, bool negative_form, arguments_store& store ) const BOOST_OVERRIDE - { - if( token.empty() ) - store.set( p_name, !negative_form ); - else { - BOOST_TEST_I_ASSRT( !negative_form, - format_error( p_name ) << "Can't set value to negative form of the argument." ); - - m_arg_factory.produce_argument( token, p_name, store ); - } - } - - void produce_default( arguments_store& store ) const BOOST_OVERRIDE - { - m_arg_factory.produce_default( p_name, store ); - } - void cla_name_help( std::ostream& ostr, cstring cla_tag, cstring negation_prefix_, bool use_color = true ) const BOOST_OVERRIDE - { - namespace utils = unit_test::utils; - namespace ut_detail = unit_test::ut_detail; - - if( !negation_prefix_.is_empty() ) { - BOOST_TEST_SCOPE_SETCOLOR( use_color, ostr, term_attr::BRIGHT, term_color::YELLOW ); - ostr << '[' << negation_prefix_ << ']'; - } - ostr << cla_tag; - } - void value_help( std::ostream& ostr ) const BOOST_OVERRIDE - { - if( p_value_hint.empty() ) - ostr << "<boolean value>"; - else - ostr << p_value_hint; - } - - // Data members - typedef argument_factory<bool, false, false> factory_t; - factory_t m_arg_factory; -}; - -//____________________________________________________________________________// - -template<typename EnumType, args_amount a = runtime::OPTIONAL_PARAM> -class enum_parameter : public parameter<EnumType, a, true> { - typedef parameter<EnumType, a, true> base; -public: - /// Constructor with modifiers -#ifndef BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS - template<typename Modifiers=nfp::no_params_type> - enum_parameter( cstring name, Modifiers const& m = nfp::no_params ) -#else - template<typename Modifiers> - enum_parameter( cstring name, Modifiers const& m ) -#endif - : base( name, m ) - { -#ifdef BOOST_TEST_CLA_NEW_API - auto const& values = m[enum_values<EnumType>::value]; - auto it = values.begin(); -#else - std::vector<std::pair<cstring, EnumType> > const& values = m[enum_values<EnumType>::value]; - typename std::vector<std::pair<cstring, EnumType> >::const_iterator it = values.begin(); -#endif - while( it != values.end() ) { - m_valid_names.push_back( it->first ); - ++it; - } - } - -private: - basic_param_ptr clone() const BOOST_OVERRIDE - { - return basic_param_ptr( new enum_parameter( *this ) ); - } - - void value_help( std::ostream& ostr ) const BOOST_OVERRIDE - { - if( this->p_value_hint.empty() ) { - ostr << "<"; - bool first = true; - BOOST_TEST_FOREACH( cstring, name, m_valid_names ) { - if( first ) - first = false; - else - ostr << '|'; - ostr << name; - } - ostr << ">"; - } - else - ostr << this->p_value_hint; - } - - // Data members - std::vector<cstring> m_valid_names; -}; - - -// ************************************************************************** // -// ************** runtime::parameters_store ************** // -// ************************************************************************** // - -class parameters_store { - struct lg_compare { - bool operator()( cstring lh, cstring rh ) const - { - return std::lexicographical_compare(lh.begin(), lh.end(), - rh.begin(), rh.end()); - } - }; -public: - - typedef std::map<cstring, basic_param_ptr, lg_compare> storage_type; - - /// Adds parameter into the persistent store - void add( basic_param const& in ) - { - basic_param_ptr p = in.clone(); - - BOOST_TEST_I_ASSRT( m_parameters.insert( std::make_pair( cstring(p->p_name), p ) ).second, - duplicate_param() << "Parameter " << p->p_name << " is duplicate." ); - } - - /// Returns true if there is no parameters registered - bool is_empty() const { return m_parameters.empty(); } - /// Returns map of all the registered parameter - storage_type const& all() const { return m_parameters; } - /// Returns true if parameter with specified name is registered - bool has( cstring name ) const - { - return m_parameters.find( name ) != m_parameters.end(); - } - /// Returns map of all the registered parameter - basic_param_ptr get( cstring name ) const - { - storage_type::const_iterator const& found = m_parameters.find( name ); - BOOST_TEST_I_ASSRT( found != m_parameters.end(), - unknown_param() << "Parameter " << name << " is unknown." ); - - return found->second; - } - -private: - // Data members - storage_type m_parameters; -}; - -} // namespace runtime -} // namespace boost - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_UTILS_RUNTIME_PARAMETER_HPP diff --git a/contrib/restricted/boost/test/include/boost/test/utils/setcolor.hpp b/contrib/restricted/boost/test/include/boost/test/utils/setcolor.hpp deleted file mode 100644 index c09e188f7c..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/utils/setcolor.hpp +++ /dev/null @@ -1,351 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : contains definition for setcolor iostream manipulator -// *************************************************************************** - -#ifndef BOOST_TEST_UTILS_SETCOLOR_HPP -#define BOOST_TEST_UTILS_SETCOLOR_HPP - -// Boost.Test -#include <boost/test/detail/config.hpp> - -#include <boost/core/ignore_unused.hpp> - -// STL -#include <iostream> -#include <cstdio> -#include <cassert> - -#include <boost/test/detail/suppress_warnings.hpp> - -#ifdef _WIN32 - #include <windows.h> - - #if defined(__MINGW32__) && !defined(COMMON_LVB_UNDERSCORE) - // mingw badly mimicking windows.h - #define COMMON_LVB_UNDERSCORE 0x8000 - #endif -#endif - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { -namespace utils { - -// ************************************************************************** // -// ************** term_attr ************** // -// ************************************************************************** // - -struct term_attr { enum _ { - NORMAL = 0, - BRIGHT = 1, - DIM = 2, - UNDERLINE = 4, - BLINK = 5, - REVERSE = 7, - CROSSOUT = 9 -}; }; - -// ************************************************************************** // -// ************** term_color ************** // -// ************************************************************************** // - -struct term_color { enum _ { - BLACK = 0, - RED = 1, - GREEN = 2, - YELLOW = 3, - BLUE = 4, - MAGENTA = 5, - CYAN = 6, - WHITE = 7, - ORIGINAL = 9 -}; }; - -// ************************************************************************** // -// ************** setcolor ************** // -// ************************************************************************** // - -#ifndef _WIN32 -class setcolor { -public: - typedef int state; - - // Constructor - explicit setcolor( bool is_color_output = false, - term_attr::_ attr = term_attr::NORMAL, - term_color::_ fg = term_color::ORIGINAL, - term_color::_ bg = term_color::ORIGINAL, - state* /* unused */= NULL) - : m_is_color_output(is_color_output) - { - m_command_size = std::sprintf( m_control_command, "%c[%c;3%c;4%cm", - 0x1B, - static_cast<char>(attr + '0'), - static_cast<char>(fg + '0'), - static_cast<char>(bg + '0')); - } - - explicit setcolor(bool is_color_output, - state* /* unused */) - : m_is_color_output(is_color_output) - { - m_command_size = std::sprintf(m_control_command, "%c[%c;3%c;4%cm", - 0x1B, - static_cast<char>(term_attr::NORMAL + '0'), - static_cast<char>(term_color::ORIGINAL + '0'), - static_cast<char>(term_color::ORIGINAL + '0')); - } - - friend std::ostream& - operator<<( std::ostream& os, setcolor const& sc ) - { - if (sc.m_is_color_output && (&os == &std::cout || &os == &std::cerr)) { - return os.write( sc.m_control_command, sc.m_command_size ); - } - return os; - } - -private: - // Data members - bool m_is_color_output; - char m_control_command[13]; - int m_command_size; -}; - -#else - -class setcolor { - -protected: - void set_console_color(std::ostream& os, WORD *attributes = NULL) const { - if (!m_is_color_output || m_state_saved) { - return; - } - DWORD console_type; - if (&os == &std::cout) { - console_type = STD_OUTPUT_HANDLE; - } - else if (&os == &std::cerr) { - console_type = STD_ERROR_HANDLE; - } - else { - return; - } - HANDLE hConsole = GetStdHandle(console_type); - - if(hConsole == INVALID_HANDLE_VALUE || hConsole == NULL ) - return; - - state console_attributes; - if(attributes != NULL || (m_restore_state && m_s)) { - if (attributes != NULL) { - console_attributes = *attributes; - } - else { - console_attributes = *m_s; - *m_s = state(); - } - SetConsoleTextAttribute(hConsole, console_attributes); - return; - } - - CONSOLE_SCREEN_BUFFER_INFO consoleInfo; - GetConsoleScreenBufferInfo(hConsole, &consoleInfo); - console_attributes = consoleInfo.wAttributes; - - if (!m_state_saved && m_s) { - assert(!m_restore_state); - // we can save the state only the first time this object is used - // for modifying the console. - *m_s = console_attributes; - m_state_saved = true; - } - - WORD fg_attr = 0; - switch(m_fg) - { - case term_color::WHITE: - fg_attr = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE; - break; - case term_color::BLACK: - fg_attr = 0; - break; - case term_color::RED: - fg_attr = FOREGROUND_RED; - break; - case term_color::GREEN: - fg_attr = FOREGROUND_GREEN; - break; - case term_color::CYAN: - fg_attr = FOREGROUND_GREEN | FOREGROUND_BLUE; - break; - case term_color::MAGENTA: - fg_attr = FOREGROUND_RED | FOREGROUND_BLUE; - break; - case term_color::BLUE: - fg_attr = FOREGROUND_BLUE; - break; - case term_color::YELLOW: - fg_attr = FOREGROUND_RED | FOREGROUND_GREEN; - break; - case term_color::ORIGINAL: - default: - fg_attr = console_attributes & (FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE); - break; - } - - WORD bg_attr = 0; - switch(m_bg) - { - case term_color::BLACK: - bg_attr = 0; - break; - case term_color::WHITE: - bg_attr = BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE; - break; - case term_color::RED: - bg_attr = BACKGROUND_RED; - break; - case term_color::GREEN: - bg_attr = BACKGROUND_GREEN; - break; - case term_color::BLUE: - bg_attr = BACKGROUND_BLUE; - break; - case term_color::ORIGINAL: - default: - bg_attr = console_attributes & (BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE); - break; - } - - WORD text_attr = 0; - switch(m_attr) - { - case term_attr::BRIGHT: - text_attr = FOREGROUND_INTENSITY; - break; - case term_attr::UNDERLINE: - text_attr = COMMON_LVB_UNDERSCORE; - break; - default: - break; - } - - SetConsoleTextAttribute(hConsole, fg_attr | bg_attr | text_attr); - return; - } - -public: - typedef WORD state; - - // Constructor - explicit setcolor( - bool is_color_output = false, - term_attr::_ attr = term_attr::NORMAL, - term_color::_ fg = term_color::ORIGINAL, - term_color::_ bg = term_color::ORIGINAL, - state* s = NULL) - : m_is_color_output(is_color_output) - , m_attr(attr) - , m_fg(fg) - , m_bg(bg) - , m_s(s) - , m_restore_state(false) - , m_state_saved(false) - {} - - explicit setcolor( - bool is_color_output, - state* s) - : m_is_color_output(is_color_output) - , m_attr(term_attr::NORMAL) - , m_fg(term_color::ORIGINAL) - , m_bg(term_color::ORIGINAL) - , m_s(s) - , m_restore_state(true) - , m_state_saved(false) - {} - - friend std::ostream& - operator<<( std::ostream& os, setcolor const& sc ) - { - sc.set_console_color(os); - return os; - } - -private: - bool m_is_color_output; - term_attr::_ m_attr; - term_color::_ m_fg; - term_color::_ m_bg; - state* m_s; - // indicates that the instance has been initialized to restore a previously - // stored state - bool m_restore_state; - // indicates the first time we pull and set the console information. - mutable bool m_state_saved; -}; - -#endif -// ************************************************************************** // -// ************** scope_setcolor ************** // -// ************************************************************************** // - -struct scope_setcolor { - scope_setcolor() - : m_os( 0 ) - , m_state() - , m_is_color_output(false) - {} - - explicit scope_setcolor( - bool is_color_output, - std::ostream& os, - term_attr::_ attr = term_attr::NORMAL, - term_color::_ fg = term_color::ORIGINAL, - term_color::_ bg = term_color::ORIGINAL ) - : m_os( &os ) - , m_is_color_output(is_color_output) - { - os << setcolor(is_color_output, attr, fg, bg, &m_state); - } - - ~scope_setcolor() - { - if (m_os) { - *m_os << setcolor(m_is_color_output, &m_state); - } - } -private: - scope_setcolor(const scope_setcolor& r); - scope_setcolor& operator=(const scope_setcolor& r); - // Data members - std::ostream* m_os; - setcolor::state m_state; - bool m_is_color_output; -}; - - -#define BOOST_TEST_SCOPE_SETCOLOR( is_color_output, os, attr, color ) \ - utils::scope_setcolor const sc(is_color_output, os, utils::attr, utils::color); \ - boost::ignore_unused( sc ) \ -/**/ - -} // namespace utils -} // namespace unit_test -} // namespace boost - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_UTILS_SETCOLOR_HPP diff --git a/contrib/restricted/boost/test/include/boost/test/utils/string_cast.hpp b/contrib/restricted/boost/test/include/boost/test/utils/string_cast.hpp deleted file mode 100644 index 3c069a8403..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/utils/string_cast.hpp +++ /dev/null @@ -1,69 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : trivial utility to cast to/from strings -// *************************************************************************** - -#ifndef BOOST_TEST_UTILS_STRING_CAST_HPP -#define BOOST_TEST_UTILS_STRING_CAST_HPP - -// Boost.Test -#include <boost/test/utils/basic_cstring/basic_cstring.hpp> - -// STL -#include <sstream> - -#include <boost/test/detail/suppress_warnings.hpp> - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { -namespace utils { - -// ************************************************************************** // -// ************** string_cast ************** // -// ************************************************************************** // - -template<typename T> -inline std::string -string_cast( T const& t ) -{ - std::ostringstream buff; - buff << t; - return buff.str(); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** string_as ************** // -// ************************************************************************** // - -template<typename T> -inline bool -string_as( const_string str, T& res ) -{ - std::istringstream buff( std::string( str.begin(), str.end() ) ); - buff >> res; - - return !buff.fail() && buff.eof(); -} - -//____________________________________________________________________________// - -} // namespace utils -} // namespace unit_test -} // namespace boost - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_UTILS_STRING_CAST_HPP diff --git a/contrib/restricted/boost/test/include/boost/test/utils/timer.hpp b/contrib/restricted/boost/test/include/boost/test/utils/timer.hpp deleted file mode 100644 index 78dfa70828..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/utils/timer.hpp +++ /dev/null @@ -1,165 +0,0 @@ -// (C) Copyright Raffi Enficiaud 2019. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// Description : timer and elapsed types -// *************************************************************************** - -#ifndef BOOST_TEST_UTILS_TIMER_HPP -#define BOOST_TEST_UTILS_TIMER_HPP - -#include <boost/config.hpp> -#include <boost/cstdint.hpp> -#include <utility> -#include <ctime> - -# if defined(_WIN32) || defined(__CYGWIN__) -# define BOOST_TEST_TIMER_WINDOWS_API -# elif defined(__MACH__) && defined(__APPLE__)// && !defined(CLOCK_MONOTONIC) -# // we compile for all macs the same, CLOCK_MONOTONIC introduced in 10.12 -# define BOOST_TEST_TIMER_MACH_API -# else -# define BOOST_TEST_TIMER_POSIX_API -# if !defined(CLOCK_MONOTONIC) -# error "CLOCK_MONOTONIC not defined" -# endif -# endif - -# if defined(BOOST_TEST_TIMER_WINDOWS_API) -# include <windows.h> -# elif defined(BOOST_TEST_TIMER_MACH_API) -# include <mach/mach_time.h> -//# include <mach/mach.h> /* host_get_clock_service, mach_... */ -# else -# include <sys/time.h> -# endif - -# ifdef BOOST_NO_STDC_NAMESPACE - namespace std { using ::clock_t; using ::clock; } -# endif - -namespace boost { -namespace unit_test { -namespace timer { - - struct elapsed_time - { - typedef boost::int_least64_t nanosecond_type; - - nanosecond_type wall; - nanosecond_type system; - void clear() { - wall = 0; - system = 0; - } - }; - - inline double - microsecond_wall_time( elapsed_time const& elapsed ) - { - return elapsed.wall / 1E3; - } - - inline double - second_wall_time( elapsed_time const& elapsed ) - { - return elapsed.wall / 1E9; - } - - namespace details { - #if defined(BOOST_TEST_TIMER_WINDOWS_API) - elapsed_time::nanosecond_type get_tick_freq() { - LARGE_INTEGER freq; - ::QueryPerformanceFrequency( &freq ); - return static_cast<elapsed_time::nanosecond_type>(freq.QuadPart); - } - #elif defined(BOOST_TEST_TIMER_MACH_API) - std::pair<elapsed_time::nanosecond_type, elapsed_time::nanosecond_type> get_time_base() { - mach_timebase_info_data_t timebase; - if(mach_timebase_info(&timebase) == 0) - return std::pair<elapsed_time::nanosecond_type, elapsed_time::nanosecond_type>(timebase.numer, timebase.denom); - return std::pair<elapsed_time::nanosecond_type, elapsed_time::nanosecond_type>(0, 1); - } - #endif - } - - //! Simple timing class - //! - //! This class measures the wall clock time. - class timer - { - public: - timer() - { - restart(); - } - void restart() - { - _start_time_clock = std::clock(); - #if defined(BOOST_TEST_TIMER_WINDOWS_API) - ::QueryPerformanceCounter(&_start_time_wall); - #elif defined(BOOST_TEST_TIMER_MACH_API) - _start_time_wall = mach_absolute_time(); - #else - if( ::clock_gettime( CLOCK_MONOTONIC, &_start_time_wall ) != 0 ) - { - _start_time_wall.tv_nsec = -1; - _start_time_wall.tv_sec = -1; - } - #endif - } - - // return elapsed time in seconds - elapsed_time elapsed() const - { - typedef elapsed_time::nanosecond_type nanosecond_type; - static const double clock_to_nano_seconds = 1E9 / CLOCKS_PER_SEC; - elapsed_time return_value; - - // processor / system time - return_value.system = static_cast<nanosecond_type>(double(std::clock() - _start_time_clock) * clock_to_nano_seconds); - -#if defined(BOOST_TEST_TIMER_WINDOWS_API) - static const nanosecond_type tick_per_sec = details::get_tick_freq(); - LARGE_INTEGER end_time; - ::QueryPerformanceCounter(&end_time); - return_value.wall = static_cast<nanosecond_type>(((end_time.QuadPart - _start_time_wall.QuadPart) * 1E9) / tick_per_sec); -#elif defined(BOOST_TEST_TIMER_MACH_API) - static std::pair<nanosecond_type, nanosecond_type> timebase = details::get_time_base(); - nanosecond_type clock = mach_absolute_time() - _start_time_wall; - return_value.wall = static_cast<nanosecond_type>((clock * timebase.first) / timebase.second); -#else - struct timespec end_time; - return_value.wall = 0; - if( ::clock_gettime( CLOCK_MONOTONIC, &end_time ) == 0 ) - { - return_value.wall = static_cast<nanosecond_type>((end_time.tv_sec - _start_time_wall.tv_sec) * 1E9 + (end_time.tv_nsec - _start_time_wall.tv_nsec)); - } -#endif - - return return_value; - } - - private: - std::clock_t _start_time_clock; - #if defined(BOOST_TEST_TIMER_WINDOWS_API) - LARGE_INTEGER _start_time_wall; - #elif defined(BOOST_TEST_TIMER_MACH_API) - elapsed_time::nanosecond_type _start_time_wall; - #else - struct timespec _start_time_wall; - #endif - }; - - -//____________________________________________________________________________// - -} // namespace timer -} // namespace unit_test -} // namespace boost - -#endif // BOOST_TEST_UTILS_TIMER_HPP - diff --git a/contrib/restricted/boost/test/include/boost/test/utils/wrap_stringstream.hpp b/contrib/restricted/boost/test/include/boost/test/utils/wrap_stringstream.hpp deleted file mode 100644 index 425d7ed75b..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/utils/wrap_stringstream.hpp +++ /dev/null @@ -1,162 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : wraps strstream and stringstream (depends with one is present) -// to provide the unified interface -// *************************************************************************** - -#ifndef BOOST_TEST_UTILS_WRAP_STRINGSTREAM_HPP -#define BOOST_TEST_UTILS_WRAP_STRINGSTREAM_HPP - -// Boost.Test -#include <boost/test/detail/config.hpp> - -// STL -#ifdef BOOST_NO_STRINGSTREAM -#include <strstream> // for std::ostrstream -#else -#include <sstream> // for std::ostringstream -#endif // BOOST_NO_STRINGSTREAM - -#include <boost/test/detail/suppress_warnings.hpp> - -//____________________________________________________________________________// - -namespace boost { - -// ************************************************************************** // -// ************** basic_wrap_stringstream ************** // -// ************************************************************************** // - -template<typename CharT> -class basic_wrap_stringstream { -public: -#if defined(BOOST_CLASSIC_IOSTREAMS) - typedef std::ostringstream wrapped_stream; -#elif defined(BOOST_NO_STRINGSTREAM) - typedef std::basic_ostrstream<CharT> wrapped_stream; -#else - typedef std::basic_ostringstream<CharT> wrapped_stream; -#endif // BOOST_NO_STRINGSTREAM - // Access methods - basic_wrap_stringstream& ref(); - wrapped_stream& stream(); - std::basic_string<CharT> const& str(); - -private: - // Data members - wrapped_stream m_stream; - std::basic_string<CharT> m_str; -}; - -//____________________________________________________________________________// - -template <typename CharT, typename T> -inline basic_wrap_stringstream<CharT>& -operator<<( basic_wrap_stringstream<CharT>& targ, T const& t ) -{ - targ.stream() << t; - return targ; -} - -//____________________________________________________________________________// - -template <typename CharT> -inline typename basic_wrap_stringstream<CharT>::wrapped_stream& -basic_wrap_stringstream<CharT>::stream() -{ - return m_stream; -} - -//____________________________________________________________________________// - -template <typename CharT> -inline basic_wrap_stringstream<CharT>& -basic_wrap_stringstream<CharT>::ref() -{ - return *this; -} - -//____________________________________________________________________________// - -template <typename CharT> -inline std::basic_string<CharT> const& -basic_wrap_stringstream<CharT>::str() -{ - -#ifdef BOOST_NO_STRINGSTREAM - m_str.assign( m_stream.str(), m_stream.pcount() ); - m_stream.freeze( false ); -#else - m_str = m_stream.str(); -#endif - - return m_str; -} - -//____________________________________________________________________________// - -template <typename CharT> -inline basic_wrap_stringstream<CharT>& -operator<<( basic_wrap_stringstream<CharT>& targ, basic_wrap_stringstream<CharT>& src ) -{ - targ << src.str(); - return targ; -} - -//____________________________________________________________________________// - -#if BOOST_TEST_USE_STD_LOCALE - -template <typename CharT> -inline basic_wrap_stringstream<CharT>& -operator<<( basic_wrap_stringstream<CharT>& targ, std::ios_base& (BOOST_TEST_CALL_DECL *man)(std::ios_base&) ) -{ - targ.stream() << man; - return targ; -} - -//____________________________________________________________________________// - -template<typename CharT,typename Elem,typename Tr> -inline basic_wrap_stringstream<CharT>& -operator<<( basic_wrap_stringstream<CharT>& targ, std::basic_ostream<Elem,Tr>& (BOOST_TEST_CALL_DECL *man)(std::basic_ostream<Elem, Tr>&) ) -{ - targ.stream() << man; - return targ; -} - -//____________________________________________________________________________// - -template<typename CharT,typename Elem,typename Tr> -inline basic_wrap_stringstream<CharT>& -operator<<( basic_wrap_stringstream<CharT>& targ, std::basic_ios<Elem, Tr>& (BOOST_TEST_CALL_DECL *man)(std::basic_ios<Elem, Tr>&) ) -{ - targ.stream() << man; - return targ; -} - -//____________________________________________________________________________// - -#endif - -// ************************************************************************** // -// ************** wrap_stringstream ************** // -// ************************************************************************** // - -typedef basic_wrap_stringstream<char> wrap_stringstream; -typedef basic_wrap_stringstream<wchar_t> wrap_wstringstream; - -} // namespace boost - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_UTILS_WRAP_STRINGSTREAM_HPP diff --git a/contrib/restricted/boost/test/include/boost/test/utils/xml_printer.hpp b/contrib/restricted/boost/test/include/boost/test/utils/xml_printer.hpp deleted file mode 100644 index 7892f9c4ce..0000000000 --- a/contrib/restricted/boost/test/include/boost/test/utils/xml_printer.hpp +++ /dev/null @@ -1,145 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : common code used by any agent serving as OF_XML printer -// *************************************************************************** - -#ifndef BOOST_TEST_UTILS_XML_PRINTER_HPP -#define BOOST_TEST_UTILS_XML_PRINTER_HPP - -// Boost.Test -#include <boost/test/detail/global_typedef.hpp> -#include <boost/test/utils/basic_cstring/basic_cstring.hpp> -#include <boost/test/utils/custom_manip.hpp> -#include <boost/test/utils/foreach.hpp> -#include <boost/test/utils/basic_cstring/io.hpp> - -// Boost -#include <boost/config.hpp> - -// STL -#include <iostream> -#include <map> - -#include <boost/test/detail/suppress_warnings.hpp> - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { -namespace utils { - -// ************************************************************************** // -// ************** xml print helpers ************** // -// ************************************************************************** // - -inline void -print_escaped( std::ostream& where_to, const_string value ) -{ -#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) && !defined(BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX) - static std::map<char,char const*> const char_type{{ - {'<' , "lt"}, - {'>' , "gt"}, - {'&' , "amp"}, - {'\'', "apos"}, - {'"' , "quot"} - }}; -#else - static std::map<char,char const*> char_type; - - if( char_type.empty() ) { - char_type['<'] = "lt"; - char_type['>'] = "gt"; - char_type['&'] = "amp"; - char_type['\'']= "apos"; - char_type['"'] = "quot"; - } -#endif - - BOOST_TEST_FOREACH( char, c, value ) { - std::map<char,char const*>::const_iterator found_ref = char_type.find( c ); - - if( found_ref != char_type.end() ) - where_to << '&' << found_ref->second << ';'; - else - where_to << c; - } -} - -//____________________________________________________________________________// - -inline void -print_escaped( std::ostream& where_to, std::string const& value ) -{ - print_escaped( where_to, const_string( value ) ); -} - -//____________________________________________________________________________// - -template<typename T> -inline void -print_escaped( std::ostream& where_to, T const& value ) -{ - where_to << value; -} - -//____________________________________________________________________________// - -inline void -print_escaped_cdata( std::ostream& where_to, const_string value ) -{ - static const_string cdata_end( "]]>" ); - - const_string::size_type pos = value.find( cdata_end ); - if( pos == const_string::npos ) - where_to << value; - else { - where_to << value.substr( 0, pos+2 ) << cdata_end - << BOOST_TEST_L( "<![CDATA[" ) << value.substr( pos+2 ); - } -} - -//____________________________________________________________________________// - -typedef custom_manip<struct attr_value_t> attr_value; - -template<typename T> -inline std::ostream& -operator<<( custom_printer<attr_value> const& p, T const& value ) -{ - *p << "=\""; - print_escaped( *p, value ); - *p << '"'; - - return *p; -} - -//____________________________________________________________________________// - -typedef custom_manip<struct cdata_t> cdata; - -inline std::ostream& -operator<<( custom_printer<cdata> const& p, const_string value ) -{ - *p << BOOST_TEST_L( "<![CDATA[" ); - print_escaped_cdata( *p, value ); - return *p << BOOST_TEST_L( "]]>" ); -} - -//____________________________________________________________________________// - -} // namespace utils -} // namespace unit_test -} // namespace boost - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_UTILS_XML_PRINTER_HPP diff --git a/contrib/restricted/boost/test/src/compiler_log_formatter.cpp b/contrib/restricted/boost/test/src/compiler_log_formatter.cpp deleted file mode 100644 index e1508c2f1e..0000000000 --- a/contrib/restricted/boost/test/src/compiler_log_formatter.cpp +++ /dev/null @@ -1,18 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2005-2010. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : forwarding source -// *************************************************************************** - -#define BOOST_TEST_SOURCE -#include <boost/test/impl/compiler_log_formatter.ipp> - -// EOF diff --git a/contrib/restricted/boost/test/src/debug.cpp b/contrib/restricted/boost/test/src/debug.cpp deleted file mode 100644 index 04c6e0a10d..0000000000 --- a/contrib/restricted/boost/test/src/debug.cpp +++ /dev/null @@ -1,24 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2006-2010. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : forwarding source -// *************************************************************************** - -#define BOOST_TEST_SOURCE -#include <boost/test/impl/debug.ipp> - -// *************************************************************************** -// Revision History : -// -// $Log$ -// *************************************************************************** - -// EOF diff --git a/contrib/restricted/boost/test/src/decorator.cpp b/contrib/restricted/boost/test/src/decorator.cpp deleted file mode 100644 index 3972407d66..0000000000 --- a/contrib/restricted/boost/test/src/decorator.cpp +++ /dev/null @@ -1,18 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2011. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : forwarding source -// *************************************************************************** - -#define BOOST_TEST_SOURCE -#include <boost/test/impl/decorator.ipp> - -// EOF diff --git a/contrib/restricted/boost/test/src/execution_monitor.cpp b/contrib/restricted/boost/test/src/execution_monitor.cpp deleted file mode 100644 index e7fdfb9139..0000000000 --- a/contrib/restricted/boost/test/src/execution_monitor.cpp +++ /dev/null @@ -1,18 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2005-2010. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : forwarding source -// *************************************************************************** - -#define BOOST_TEST_SOURCE -#include <boost/test/impl/execution_monitor.ipp> - -// EOF diff --git a/contrib/restricted/boost/test/src/framework.cpp b/contrib/restricted/boost/test/src/framework.cpp deleted file mode 100644 index 52e7614835..0000000000 --- a/contrib/restricted/boost/test/src/framework.cpp +++ /dev/null @@ -1,18 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2005-2010. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : forwarding source -// *************************************************************************** - -#define BOOST_TEST_SOURCE -#include <boost/test/impl/framework.ipp> - -// EOF diff --git a/contrib/restricted/boost/test/src/junit_log_formatter.cpp b/contrib/restricted/boost/test/src/junit_log_formatter.cpp deleted file mode 100644 index 0cac80465b..0000000000 --- a/contrib/restricted/boost/test/src/junit_log_formatter.cpp +++ /dev/null @@ -1,13 +0,0 @@ -// (C) Copyright 2016 Raffi Enficiaud. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// forward to impl - -#define BOOST_TEST_SOURCE -#include <boost/test/impl/junit_log_formatter.ipp> - -// EOF diff --git a/contrib/restricted/boost/test/src/plain_report_formatter.cpp b/contrib/restricted/boost/test/src/plain_report_formatter.cpp deleted file mode 100644 index 95cf64fd63..0000000000 --- a/contrib/restricted/boost/test/src/plain_report_formatter.cpp +++ /dev/null @@ -1,18 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2005-2010. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : forwarding source -// *************************************************************************** - -#define BOOST_TEST_SOURCE -#include <boost/test/impl/plain_report_formatter.ipp> - -// EOF diff --git a/contrib/restricted/boost/test/src/progress_monitor.cpp b/contrib/restricted/boost/test/src/progress_monitor.cpp deleted file mode 100644 index 1d4afc7a5a..0000000000 --- a/contrib/restricted/boost/test/src/progress_monitor.cpp +++ /dev/null @@ -1,18 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2005-2010. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : forwarding source -// *************************************************************************** - -#define BOOST_TEST_SOURCE -#include <boost/test/impl/progress_monitor.ipp> - -// EOF diff --git a/contrib/restricted/boost/test/src/results_collector.cpp b/contrib/restricted/boost/test/src/results_collector.cpp deleted file mode 100644 index 5d8e0b7dd2..0000000000 --- a/contrib/restricted/boost/test/src/results_collector.cpp +++ /dev/null @@ -1,18 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2005-2010. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : forwarding source -// *************************************************************************** - -#define BOOST_TEST_SOURCE -#include <boost/test/impl/results_collector.ipp> - -// EOF diff --git a/contrib/restricted/boost/test/src/results_reporter.cpp b/contrib/restricted/boost/test/src/results_reporter.cpp deleted file mode 100644 index 205cba5f83..0000000000 --- a/contrib/restricted/boost/test/src/results_reporter.cpp +++ /dev/null @@ -1,18 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2005-2010. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : forwarding source -// *************************************************************************** - -#define BOOST_TEST_SOURCE -#include <boost/test/impl/results_reporter.ipp> - -// EOF diff --git a/contrib/restricted/boost/test/src/test_framework_init_observer.cpp b/contrib/restricted/boost/test/src/test_framework_init_observer.cpp deleted file mode 100644 index 140329ddff..0000000000 --- a/contrib/restricted/boost/test/src/test_framework_init_observer.cpp +++ /dev/null @@ -1,15 +0,0 @@ -// (C) Copyright Raffi Enficiaud 2017. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -//! @file -//! Forwarding source -// ************************************************************************** - -#define BOOST_TEST_SOURCE -#include <boost/test/impl/test_framework_init_observer.ipp> - -// EOF diff --git a/contrib/restricted/boost/test/src/test_tools.cpp b/contrib/restricted/boost/test/src/test_tools.cpp deleted file mode 100644 index d9d2960373..0000000000 --- a/contrib/restricted/boost/test/src/test_tools.cpp +++ /dev/null @@ -1,18 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2005-2010. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : forwarding source -// *************************************************************************** - -#define BOOST_TEST_SOURCE -#include <boost/test/impl/test_tools.ipp> - -// EOF diff --git a/contrib/restricted/boost/test/src/test_tree.cpp b/contrib/restricted/boost/test/src/test_tree.cpp deleted file mode 100644 index bc273ed965..0000000000 --- a/contrib/restricted/boost/test/src/test_tree.cpp +++ /dev/null @@ -1,18 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2005-2010. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : forwarding source -// *************************************************************************** - -#define BOOST_TEST_SOURCE -#include <boost/test/impl/test_tree.ipp> - -// EOF diff --git a/contrib/restricted/boost/test/src/unit_test_log.cpp b/contrib/restricted/boost/test/src/unit_test_log.cpp deleted file mode 100644 index c09437cbd9..0000000000 --- a/contrib/restricted/boost/test/src/unit_test_log.cpp +++ /dev/null @@ -1,18 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2005-2010. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : forwarding source -// *************************************************************************** - -#define BOOST_TEST_SOURCE -#include <boost/test/impl/unit_test_log.ipp> - -// EOF diff --git a/contrib/restricted/boost/test/src/unit_test_main.cpp b/contrib/restricted/boost/test/src/unit_test_main.cpp deleted file mode 100644 index 74b0b84c63..0000000000 --- a/contrib/restricted/boost/test/src/unit_test_main.cpp +++ /dev/null @@ -1,18 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2005-2010. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : forwarding source -// *************************************************************************** - -#define BOOST_TEST_SOURCE -#include <boost/test/impl/unit_test_main.ipp> - -// EOF diff --git a/contrib/restricted/boost/test/src/unit_test_monitor.cpp b/contrib/restricted/boost/test/src/unit_test_monitor.cpp deleted file mode 100644 index ffc646195d..0000000000 --- a/contrib/restricted/boost/test/src/unit_test_monitor.cpp +++ /dev/null @@ -1,18 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2005-2010. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : forwarding source -// *************************************************************************** - -#define BOOST_TEST_SOURCE -#include <boost/test/impl/unit_test_monitor.ipp> - -// EOF diff --git a/contrib/restricted/boost/test/src/unit_test_parameters.cpp b/contrib/restricted/boost/test/src/unit_test_parameters.cpp deleted file mode 100644 index e82694e34b..0000000000 --- a/contrib/restricted/boost/test/src/unit_test_parameters.cpp +++ /dev/null @@ -1,18 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2005-2010. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : forwarding source -// *************************************************************************** - -#define BOOST_TEST_SOURCE -#include <boost/test/impl/unit_test_parameters.ipp> - -// EOF diff --git a/contrib/restricted/boost/test/src/xml_log_formatter.cpp b/contrib/restricted/boost/test/src/xml_log_formatter.cpp deleted file mode 100644 index ca497a9f39..0000000000 --- a/contrib/restricted/boost/test/src/xml_log_formatter.cpp +++ /dev/null @@ -1,18 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2005-2010. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : forwarding source -// *************************************************************************** - -#define BOOST_TEST_SOURCE -#include <boost/test/impl/xml_log_formatter.ipp> - -// EOF diff --git a/contrib/restricted/boost/test/src/xml_report_formatter.cpp b/contrib/restricted/boost/test/src/xml_report_formatter.cpp deleted file mode 100644 index 18ff1d8657..0000000000 --- a/contrib/restricted/boost/test/src/xml_report_formatter.cpp +++ /dev/null @@ -1,18 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2005-2010. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : forwarding source -// *************************************************************************** - -#define BOOST_TEST_SOURCE -#include <boost/test/impl/xml_report_formatter.ipp> - -// EOF diff --git a/contrib/restricted/boost/timer/include/boost/timer/config.hpp b/contrib/restricted/boost/timer/include/boost/timer/config.hpp deleted file mode 100644 index a7c3d9d20e..0000000000 --- a/contrib/restricted/boost/timer/include/boost/timer/config.hpp +++ /dev/null @@ -1,69 +0,0 @@ -// boost/timer/config.hpp -----------------------------------------------------------// - -// Copyright Beman Dawes 2003, 2006, 2011 - -// Distributed under the Boost Software License, Version 1.0. -// See http://www.boost.org/LICENSE_1_0.txt - -// See http://www.boost.org/libs/timer for documentation. - -#ifndef BOOST_TIMER_CONFIG_HPP -#define BOOST_TIMER_CONFIG_HPP - -#include <boost/config.hpp> - -#include <boost/system/api_config.hpp> - -// This header implements separate compilation features as described in -// http://www.boost.org/more/separate_compilation.html - -// enable dynamic or static linking as requested --------------------------------------// - -#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_TIMER_DYN_LINK) -# if defined(BOOST_TIMER_SOURCE) -# define BOOST_TIMER_DECL BOOST_SYMBOL_EXPORT -# else -# define BOOST_TIMER_DECL BOOST_SYMBOL_IMPORT -# endif -#else -# define BOOST_TIMER_DECL -#endif - -// enable automatic library variant selection ----------------------------------------// - -#if !defined(BOOST_TIMER_SOURCE) && !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_TIMER_NO_LIB) -// -// Set the name of our library, this will get undef'ed by auto_link.hpp -// once it's done with it: -// -#define BOOST_LIB_NAME boost_timer -// -// If we're importing code from a dll, then tell auto_link.hpp about it: -// -#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_TIMER_DYN_LINK) -# define BOOST_DYN_LINK -#endif -// -// And include the header that does the work: -// -#include <boost/config/auto_link.hpp> - -// We also need to autolink to the Chrono library; even though -// it's not used in the interface, and no Chrono header is included, -// it's used in the implementation and is necessary in order to link - -#if !defined(BOOST_CHRONO_NO_LIB) - -#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_CHRONO_DYN_LINK) -# define BOOST_DYN_LINK -#endif - -#define BOOST_LIB_NAME boost_chrono - -#include <boost/config/auto_link.hpp> - -#endif // !defined(BOOST_CHRONO_NO_LIB) - -#endif // auto-linking disabled - -#endif // BOOST_TIMER_CONFIG_HPP diff --git a/contrib/restricted/boost/timer/include/boost/timer/timer.hpp b/contrib/restricted/boost/timer/include/boost/timer/timer.hpp deleted file mode 100644 index 8bf996081d..0000000000 --- a/contrib/restricted/boost/timer/include/boost/timer/timer.hpp +++ /dev/null @@ -1,129 +0,0 @@ -// boost/timer/timer.hpp -------------------------------------------------------------// - -// Copyright Beman Dawes 1994-2007, 2011 - -// Distributed under the Boost Software License, Version 1.0. -// See http://www.boost.org/LICENSE_1_0.txt - -#ifndef BOOST_TIMER_TIMER_HPP -#define BOOST_TIMER_TIMER_HPP - -#include <boost/timer/config.hpp> -#include <boost/cstdint.hpp> -#include <string> -#include <cstring> -#include <ostream> - -#include <boost/config/abi_prefix.hpp> // must be the last #include - -# if defined(_MSC_VER) -# pragma warning(push) // Save warning settings -# pragma warning(disable : 4251) // disable warning: class 'std::basic_string<_Elem,_Traits,_Ax>' -# endif // needs to have dll-interface... - -//--------------------------------------------------------------------------------------// - -namespace boost -{ -namespace timer -{ - class cpu_timer; - class auto_cpu_timer; - - typedef boost::int_least64_t nanosecond_type; - - struct cpu_times - { - nanosecond_type wall; - nanosecond_type user; - nanosecond_type system; - - void clear() { wall = user = system = 0; } - }; - - const short default_places = 6; - - BOOST_TIMER_DECL - std::string format(const cpu_times& times, short places, const std::string& format); - - BOOST_TIMER_DECL - std::string format(const cpu_times& times, short places = default_places); - -// cpu_timer -------------------------------------------------------------------------// - - class BOOST_TIMER_DECL cpu_timer - { - public: - - // constructor - cpu_timer() BOOST_NOEXCEPT { start(); } - - // observers - bool is_stopped() const BOOST_NOEXCEPT { return m_is_stopped; } - cpu_times elapsed() const BOOST_NOEXCEPT; // does not stop() - std::string format(short places, const std::string& format) const - { return ::boost::timer::format(elapsed(), places, format); } - std::string format(short places = default_places) const - { return ::boost::timer::format(elapsed(), places); } - // actions - void start() BOOST_NOEXCEPT; - void stop() BOOST_NOEXCEPT; - void resume() BOOST_NOEXCEPT; - - private: - cpu_times m_times; - bool m_is_stopped; - }; - -// auto_cpu_timer --------------------------------------------------------------------// - - class BOOST_TIMER_DECL auto_cpu_timer : public cpu_timer - { - public: - - // Explicit defaults for os are not provided to avoid including <iostream>, which has - // high costs even when the standard streams are not actually used. Explicit defaults - // for format are not provided to avoid order-of-dynamic-initialization issues with a - // std::string. - - explicit auto_cpu_timer(short places = default_places); // #1 - auto_cpu_timer(short places, const std::string& format); // #2 - explicit auto_cpu_timer(const std::string& format); // #3 - auto_cpu_timer(std::ostream& os, short places, - const std::string& format) // #4 - : m_places(places), m_os(&os), m_format(format) - { start(); } - explicit auto_cpu_timer(std::ostream& os, short places = default_places); // #5 - auto_cpu_timer(std::ostream& os, const std::string& format) // #6 - : m_places(default_places), m_os(&os), m_format(format) - { start(); } - - ~auto_cpu_timer(); - - // observers - // not particularly useful to users, but allow testing of constructor - // postconditions and ease specification of other functionality without resorting - // to "for exposition only" private members. - std::ostream& ostream() const { return *m_os; } - short places() const { return m_places; } - const std::string& format_string() const { return m_format; } - - // actions - void report(); - - private: - short m_places; - std::ostream* m_os; // stored as ptr so compiler can generate operator= - std::string m_format; - }; - -} // namespace timer -} // namespace boost - -# if defined(_MSC_VER) -# pragma warning(pop) // restore warning settings. -# endif - -#include <boost/config/abi_suffix.hpp> // pops abi_prefix.hpp pragmas - -#endif // BOOST_TIMER_TIMER_HPP diff --git a/contrib/restricted/boost/timer/src/auto_timers_construction.cpp b/contrib/restricted/boost/timer/src/auto_timers_construction.cpp deleted file mode 100644 index b23b54674f..0000000000 --- a/contrib/restricted/boost/timer/src/auto_timers_construction.cpp +++ /dev/null @@ -1,46 +0,0 @@ -// boost auto_timers_construction.cpp ------------------------------------------------// - -// Copyright Beman Dawes 2007, 2011 - -// Distributed under the Boost Software License, Version 1.0. -// See http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/timer for documentation. - -//--------------------------------------------------------------------------------------// - -// These constructors are in a separate file so that this translation unit will -// not be linked in except when one of the constructors is actually used. This -// is important since header <iostream> is required, and it incurs the cost of -// the standard stream objects even if they are not used. - -//--------------------------------------------------------------------------------------// - -// define BOOST_TIMER_SOURCE so that <boost/timer/config.hpp> knows -// the library is being built (possibly exporting rather than importing code) -#define BOOST_TIMER_SOURCE - -#include <boost/timer/timer.hpp> -#include <iostream> - -namespace -{ - // CAUTION: must be identical to same constant in cpu_timer.cpp - const std::string default_fmt(" %ws wall, %us user + %ss system = %ts CPU (%p%)\n"); -} - -namespace boost -{ - namespace timer - { - auto_cpu_timer::auto_cpu_timer(short places) // #1 - : m_places(places), m_os(&std::cout), m_format(default_fmt) { start(); } - - auto_cpu_timer::auto_cpu_timer(short places, const std::string& format) // #2 - : m_places(places), m_os(&std::cout), m_format(format) { start(); } - - auto_cpu_timer::auto_cpu_timer(const std::string& format) // #3 - : m_places(default_places), m_os(&std::cout), m_format(format) { start(); } - - } // namespace timer -} // namespace boost diff --git a/contrib/restricted/boost/timer/src/cpu_timer.cpp b/contrib/restricted/boost/timer/src/cpu_timer.cpp deleted file mode 100644 index 36b2ac4072..0000000000 --- a/contrib/restricted/boost/timer/src/cpu_timer.cpp +++ /dev/null @@ -1,268 +0,0 @@ -// boost cpu_timer.cpp ---------------------------------------------------------------// - -// Copyright Beman Dawes 1994-2006, 2011 - -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/timer for documentation. - -//--------------------------------------------------------------------------------------// - -// define BOOST_TIMER_SOURCE so that <boost/timer/config.hpp> knows -// the library is being built (possibly exporting rather than importing code) -#define BOOST_TIMER_SOURCE - -#include <boost/timer/timer.hpp> -#include <boost/chrono/chrono.hpp> -#include <boost/io/ios_state.hpp> -#include <boost/throw_exception.hpp> -#include <boost/cerrno.hpp> -#include <boost/predef.h> -#include <cstring> -#include <sstream> -#include <cassert> - -# if defined(BOOST_WINDOWS_API) -# include <windows.h> -# elif defined(BOOST_POSIX_API) -# include <unistd.h> -# include <sys/times.h> -# else -# error unknown API -# endif - -using boost::timer::nanosecond_type; -using boost::timer::cpu_times; - -namespace -{ - - void show_time(const cpu_times& times, - std::ostream& os, const std::string& fmt, short places) - // NOTE WELL: Will truncate least-significant digits to LDBL_DIG, which may - // be as low as 10, although will be 15 for many common platforms. - { - if (places > 9) - places = 9; - else if (places < 0) - places = boost::timer::default_places; - - boost::io::ios_flags_saver ifs(os); - boost::io::ios_precision_saver ips(os); - os.setf(std::ios_base::fixed, std::ios_base::floatfield); - os.precision(places); - - const double sec = 1000000000.0L; - nanosecond_type total = times.system + times.user; - double wall_sec = static_cast<double>(times.wall) / sec; - double total_sec = static_cast<double>(total) / sec; - - for (const char* format = fmt.c_str(); *format; ++format) - { - if (*format != '%' || !*(format+1) || !std::strchr("wustp", *(format+1))) - os << *format; // anything except % followed by a valid format character - // gets sent to the output stream - else - { - ++format; - switch (*format) - { - case 'w': - os << wall_sec; - break; - case 'u': - os << static_cast<double>(times.user) / sec; - break; - case 's': - os << static_cast<double>(times.system) / sec; - break; - case 't': - os << total_sec; - break; - case 'p': - os.precision(1); - if (wall_sec > 0.001L && total_sec > 0.001L) - os << (total_sec/wall_sec) * 100.0; - else - os << "n/a"; - os.precision(places); - break; - } - } - } - } - -# if defined(BOOST_POSIX_API) - - boost::int_least64_t tick_factor_() - { - boost::int_least64_t tf = ::sysconf( _SC_CLK_TCK ); - if( tf <= 0 ) return -1; - - tf = INT64_C(1000000000) / tf; // compute factor - if( tf == 0 ) tf = -1; - - return tf; - } - - boost::int_least64_t tick_factor() // multiplier to convert ticks - // to nanoseconds; -1 if unknown - { - static boost::int_least64_t tf = tick_factor_(); - return tf; - } - -# endif - - void get_cpu_times(boost::timer::cpu_times& current) - { - boost::chrono::duration<boost::int64_t, boost::nano> - x (boost::chrono::high_resolution_clock::now().time_since_epoch()); - current.wall = x.count(); - -# if defined(BOOST_WINDOWS_API) - -# if BOOST_PLAT_WINDOWS_DESKTOP || defined(__CYGWIN__) - FILETIME creation, exit; - if (::GetProcessTimes(::GetCurrentProcess(), &creation, &exit, - (LPFILETIME)¤t.system, (LPFILETIME)¤t.user)) - { - current.user *= 100; // Windows uses 100 nanosecond ticks - current.system *= 100; - } - else -# endif - { - current.system = current.user = boost::timer::nanosecond_type(-1); - } -# else - tms tm; - clock_t c = ::times(&tm); - if (c == static_cast<clock_t>(-1)) // error - { - current.system = current.user = boost::timer::nanosecond_type(-1); - } - else - { - current.system = boost::timer::nanosecond_type(tm.tms_stime + tm.tms_cstime); - current.user = boost::timer::nanosecond_type(tm.tms_utime + tm.tms_cutime); - boost::int_least64_t factor; - if ((factor = tick_factor()) != -1) - { - current.user *= factor; - current.system *= factor; - } - else - { - current.user = current.system = boost::timer::nanosecond_type(-1); - } - } -# endif - } - - // CAUTION: must be identical to same constant in auto_timers_construction.cpp - const std::string default_fmt(" %ws wall, %us user + %ss system = %ts CPU (%p%)\n"); - -} // unnamed namespace - -namespace boost -{ - namespace timer - { - // format ------------------------------------------------------------------------// - - BOOST_TIMER_DECL - std::string format(const cpu_times& times, short places, const std::string& fmt) - { - std::stringstream ss; - ss.exceptions(std::ios_base::badbit | std::ios_base::failbit); - show_time(times, ss, fmt, places); - return ss.str(); - } - - BOOST_TIMER_DECL - std::string format(const cpu_times& times, short places) - { - return format(times, places, default_fmt); - } - - // cpu_timer ---------------------------------------------------------------------// - - void cpu_timer::start() BOOST_NOEXCEPT - { - m_is_stopped = false; - get_cpu_times(m_times); - } - - void cpu_timer::stop() BOOST_NOEXCEPT - { - if (is_stopped()) - return; - m_is_stopped = true; - - cpu_times current; - get_cpu_times(current); - m_times.wall = (current.wall - m_times.wall); - m_times.user = (current.user - m_times.user); - m_times.system = (current.system - m_times.system); - } - - cpu_times cpu_timer::elapsed() const BOOST_NOEXCEPT - { - if (is_stopped()) - return m_times; - cpu_times current; - get_cpu_times(current); - current.wall -= m_times.wall; - current.user -= m_times.user; - current.system -= m_times.system; - return current; - } - - void cpu_timer::resume() BOOST_NOEXCEPT - { - if (is_stopped()) - { - cpu_times current (m_times); - start(); - m_times.wall -= current.wall; - m_times.user -= current.user; - m_times.system -= current.system; - } - } - - // auto_cpu_timer ----------------------------------------------------------------// - - auto_cpu_timer::auto_cpu_timer(std::ostream& os, short places) // #5 - : m_places(places), m_os(&os), m_format(default_fmt) - { - start(); - } - - void auto_cpu_timer::report() - { - show_time(elapsed(), ostream(), format_string(), places()); - } - - auto_cpu_timer::~auto_cpu_timer() - { - if (!is_stopped()) - { - stop(); // the sooner we stop(), the better -#ifndef BOOST_NO_EXCEPTIONS - try - { -#endif - report(); -#ifndef BOOST_NO_EXCEPTIONS - } - catch (...) // eat any exceptions - { - } -#endif - } - } - - } // namespace timer -} // namespace boost diff --git a/contrib/restricted/boost/tuple/include/boost/tuple/tuple_comparison.hpp b/contrib/restricted/boost/tuple/include/boost/tuple/tuple_comparison.hpp deleted file mode 100644 index 0a61952a78..0000000000 --- a/contrib/restricted/boost/tuple/include/boost/tuple/tuple_comparison.hpp +++ /dev/null @@ -1,175 +0,0 @@ -// tuple_comparison.hpp ----------------------------------------------------- -// -// Copyright (C) 2001 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi) -// Copyright (C) 2001 Gary Powell (gary.powell@sierra.com) -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// For more information, see http://www.boost.org -// -// (The idea and first impl. of comparison operators was from Doug Gregor) - -// ----------------------------------------------------------------- - -#ifndef BOOST_TUPLE_COMPARISON_HPP -#define BOOST_TUPLE_COMPARISON_HPP - -#include <boost/tuple/tuple.hpp> - -// ------------------------------------------------------------- -// equality and comparison operators -// -// == and != compare tuples elementwise -// <, >, <= and >= use lexicographical ordering -// -// Any operator between tuples of different length fails at compile time -// No dependencies between operators are assumed -// (i.e. !(a<b) does not imply a>=b, a!=b does not imply a==b etc. -// so any weirdnesses of elementary operators are respected). -// -// ------------------------------------------------------------- - - -namespace boost { -namespace tuples { - -inline bool operator==(const null_type&, const null_type&) { return true; } -inline bool operator>=(const null_type&, const null_type&) { return true; } -inline bool operator<=(const null_type&, const null_type&) { return true; } -inline bool operator!=(const null_type&, const null_type&) { return false; } -inline bool operator<(const null_type&, const null_type&) { return false; } -inline bool operator>(const null_type&, const null_type&) { return false; } - - -namespace detail { - // comparison operators check statically the length of its operands and - // delegate the comparing task to the following functions. Hence - // the static check is only made once (should help the compiler). - // These functions assume tuples to be of the same length. - - -template<class T1, class T2> -inline bool eq(const T1& lhs, const T2& rhs) { - return lhs.get_head() == rhs.get_head() && - eq(lhs.get_tail(), rhs.get_tail()); -} -template<> -inline bool eq<null_type,null_type>(const null_type&, const null_type&) { return true; } - -template<class T1, class T2> -inline bool neq(const T1& lhs, const T2& rhs) { - return lhs.get_head() != rhs.get_head() || - neq(lhs.get_tail(), rhs.get_tail()); -} -template<> -inline bool neq<null_type,null_type>(const null_type&, const null_type&) { return false; } - -template<class T1, class T2> -inline bool lt(const T1& lhs, const T2& rhs) { - return lhs.get_head() < rhs.get_head() || - ( !(rhs.get_head() < lhs.get_head()) && - lt(lhs.get_tail(), rhs.get_tail())); -} -template<> -inline bool lt<null_type,null_type>(const null_type&, const null_type&) { return false; } - -template<class T1, class T2> -inline bool gt(const T1& lhs, const T2& rhs) { - return lhs.get_head() > rhs.get_head() || - ( !(rhs.get_head() > lhs.get_head()) && - gt(lhs.get_tail(), rhs.get_tail())); -} -template<> -inline bool gt<null_type,null_type>(const null_type&, const null_type&) { return false; } - -template<class T1, class T2> -inline bool lte(const T1& lhs, const T2& rhs) { - return lhs.get_head() <= rhs.get_head() && - ( !(rhs.get_head() <= lhs.get_head()) || - lte(lhs.get_tail(), rhs.get_tail())); -} -template<> -inline bool lte<null_type,null_type>(const null_type&, const null_type&) { return true; } - -template<class T1, class T2> -inline bool gte(const T1& lhs, const T2& rhs) { - return lhs.get_head() >= rhs.get_head() && - ( !(rhs.get_head() >= lhs.get_head()) || - gte(lhs.get_tail(), rhs.get_tail())); -} -template<> -inline bool gte<null_type,null_type>(const null_type&, const null_type&) { return true; } - -} // end of namespace detail - - -// equal ---- - -template<class T1, class T2, class S1, class S2> -inline bool operator==(const cons<T1, T2>& lhs, const cons<S1, S2>& rhs) -{ - // check that tuple lengths are equal - BOOST_STATIC_ASSERT(length<T2>::value == length<S2>::value); - - return detail::eq(lhs, rhs); -} - -// not equal ----- - -template<class T1, class T2, class S1, class S2> -inline bool operator!=(const cons<T1, T2>& lhs, const cons<S1, S2>& rhs) -{ - - // check that tuple lengths are equal - BOOST_STATIC_ASSERT(length<T2>::value == length<S2>::value); - - return detail::neq(lhs, rhs); -} - -// < -template<class T1, class T2, class S1, class S2> -inline bool operator<(const cons<T1, T2>& lhs, const cons<S1, S2>& rhs) -{ - // check that tuple lengths are equal - BOOST_STATIC_ASSERT(length<T2>::value == length<S2>::value); - - return detail::lt(lhs, rhs); -} - -// > -template<class T1, class T2, class S1, class S2> -inline bool operator>(const cons<T1, T2>& lhs, const cons<S1, S2>& rhs) -{ - // check that tuple lengths are equal - BOOST_STATIC_ASSERT(length<T2>::value == length<S2>::value); - - return detail::gt(lhs, rhs); -} - -// <= -template<class T1, class T2, class S1, class S2> -inline bool operator<=(const cons<T1, T2>& lhs, const cons<S1, S2>& rhs) -{ - // check that tuple lengths are equal - BOOST_STATIC_ASSERT(length<T2>::value == length<S2>::value); - - return detail::lte(lhs, rhs); -} - -// >= -template<class T1, class T2, class S1, class S2> -inline bool operator>=(const cons<T1, T2>& lhs, const cons<S1, S2>& rhs) -{ - // check that tuple lengths are equal - BOOST_STATIC_ASSERT(length<T2>::value == length<S2>::value); - - return detail::gte(lhs, rhs); -} - -} // end of namespace tuples -} // end of namespace boost - - -#endif // BOOST_TUPLE_COMPARISON_HPP diff --git a/contrib/restricted/boost/type_erasure/include/boost/type_erasure/builtin.hpp b/contrib/restricted/boost/type_erasure/include/boost/type_erasure/builtin.hpp deleted file mode 100644 index 7af5d84b23..0000000000 --- a/contrib/restricted/boost/type_erasure/include/boost/type_erasure/builtin.hpp +++ /dev/null @@ -1,180 +0,0 @@ -// Boost.TypeErasure library -// -// Copyright 2011 Steven Watanabe -// -// Distributed under the Boost Software License Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// $Id$ - -#ifndef BOOST_TYPE_ERASURE_BUILTIN_HPP_INCLUDED -#define BOOST_TYPE_ERASURE_BUILTIN_HPP_INCLUDED - -#include <boost/mpl/vector.hpp> -#include <boost/utility/enable_if.hpp> -#include <boost/type_traits/is_reference.hpp> -#include <boost/type_erasure/detail/storage.hpp> -#include <boost/type_erasure/placeholder.hpp> -#include <boost/type_erasure/constructible.hpp> -#include <boost/type_erasure/rebind_any.hpp> -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES -# include <utility> // std::move -#endif -#include <typeinfo> - -namespace boost { -namespace type_erasure { - -/** - * The @ref destructible concept enables forwarding to - * the destructor of the contained type. This is required - * whenever an @ref any is created by value. - * - * \note The @ref destructible concept rarely needs to - * be specified explicitly, because it is included in - * the @ref copy_constructible concept. - * - * \note @ref destructible may not be specialized and - * may not be passed to \call as it depends on the - * implementation details of @ref any. - */ -template<class T = _self> -struct destructible -{ - /** INTERNAL ONLY */ - typedef void (*type)(detail::storage&); - /** INTERNAL ONLY */ - static void value(detail::storage& arg) - { - delete static_cast<T*>(arg.data); - } - /** INTERNAL ONLY */ - static void apply(detail::storage& arg) - { - delete static_cast<T*>(arg.data); - } -}; - -/** - * The @ref copy_constructible concept allows objects to - * be copied and destroyed. - * - * \note This concept is defined to match C++ 2003, - * [lib.copyconstructible]. It is not equivalent to - * the concept of the same name in C++11. - */ -template<class T = _self> -struct copy_constructible : - ::boost::mpl::vector<constructible<T(const T&)>, destructible<T> > -{}; - -#ifdef BOOST_TYPE_ERASURE_DOXYGEN - -/** - * Enables assignment of @ref any types. - */ -template<class T = _self, class U = const T&> -struct assignable -{ - static void apply(T& dst, U src); -}; - -#else - -/** - * Enables assignment of @ref any types. - */ -template<class T = _self, class U = const T&> -struct assignable : - ::boost::mpl::vector<assignable<T, const U&> > -{}; - -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES - -/** INTERNAL ONLY */ -template<class T, class U> -struct assignable<T, U&&> -{ - static void apply(T& dst, U&& src) { dst = std::forward<U>(src); } -}; - -#endif - -/** INTERNAL ONLY */ -template<class T, class U> -struct assignable<T, U&> -{ - static void apply(T& dst, U& src) { dst = src; } -}; - -/** INTERNAL ONLY */ -template<class T, class U, class Base> -struct concept_interface<assignable<T, U>, Base, T, - typename ::boost::enable_if_c< ::boost::is_reference<U>::value>::type> : Base -{ - using Base::_boost_type_erasure_deduce_assign; - assignable<T, U>* _boost_type_erasure_deduce_assign( - typename ::boost::type_erasure::as_param<Base, U>::type) - { - return 0; - } -}; - -#endif - -/** - * Enables runtime type information. This is required - * if you want to use \any_cast or \typeid_of. - * - * \note @ref typeid_ cannot be specialized because several - * library components including \any_cast would not work - * correctly if its behavior changed. There is no need - * to specialize it anyway, since it works for all types. - * @ref typeid_ also cannot be passed to \call. To access it, - * use \typeid_of. - */ -template<class T = _self> -struct typeid_ -{ - /** INTERNAL ONLY */ - typedef const std::type_info& (*type)(); - /** INTERNAL ONLY */ - static const std::type_info& value() - { - return typeid(T); - } - /** INTERNAL ONLY */ - static const std::type_info& apply() - { - return typeid(T); - } -}; - -namespace detail { - -template<class C> -struct get_null_vtable_entry; - -template<class T> -struct get_null_vtable_entry< ::boost::type_erasure::typeid_<T> > -{ - typedef typeid_<void> type; -}; - -struct null_destroy { - static void value(::boost::type_erasure::detail::storage&) {} -}; - -template<class T> -struct get_null_vtable_entry< ::boost::type_erasure::destructible<T> > -{ - typedef ::boost::type_erasure::detail::null_destroy type; -}; - -} - -} -} - -#endif diff --git a/contrib/restricted/boost/type_erasure/include/boost/type_erasure/call.hpp b/contrib/restricted/boost/type_erasure/include/boost/type_erasure/call.hpp deleted file mode 100644 index 8234862cae..0000000000 --- a/contrib/restricted/boost/type_erasure/include/boost/type_erasure/call.hpp +++ /dev/null @@ -1,753 +0,0 @@ -// Boost.TypeErasure library -// -// Copyright 2011 Steven Watanabe -// -// Distributed under the Boost Software License Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// $Id$ - -#if !defined(BOOST_PP_IS_ITERATING) - -#ifndef BOOST_TYPE_ERASURE_CALL_HPP_INCLUDED -#define BOOST_TYPE_ERASURE_CALL_HPP_INCLUDED - -#include <boost/assert.hpp> -#include <boost/mpl/bool.hpp> -#include <boost/mpl/eval_if.hpp> -#include <boost/mpl/identity.hpp> -#include <boost/type_traits/remove_cv.hpp> -#include <boost/type_traits/remove_reference.hpp> -#include <boost/preprocessor/cat.hpp> -#include <boost/preprocessor/inc.hpp> -#include <boost/preprocessor/iteration/iterate.hpp> -#include <boost/preprocessor/repetition/repeat.hpp> -#include <boost/preprocessor/repetition/enum.hpp> -#include <boost/preprocessor/repetition/enum_trailing.hpp> -#include <boost/preprocessor/repetition/enum_params.hpp> -#include <boost/preprocessor/repetition/enum_binary_params.hpp> -#include <boost/preprocessor/repetition/enum_trailing_params.hpp> -#include <boost/preprocessor/repetition/enum_trailing_binary_params.hpp> -#include <boost/type_erasure/detail/access.hpp> -#include <boost/type_erasure/detail/adapt_to_vtable.hpp> -#include <boost/type_erasure/detail/extract_concept.hpp> -#include <boost/type_erasure/detail/get_signature.hpp> -#include <boost/type_erasure/detail/check_call.hpp> -#include <boost/type_erasure/is_placeholder.hpp> -#include <boost/type_erasure/concept_of.hpp> -#include <boost/type_erasure/config.hpp> -#include <boost/type_erasure/require_match.hpp> - -namespace boost { -namespace type_erasure { - -#ifndef BOOST_TYPE_ERASURE_DOXYGEN - -template<class Concept, class Placeholder> -class any; - -template<class Concept> -class binding; - -#endif - -namespace detail { - -template<class T> -struct is_placeholder_arg : - ::boost::type_erasure::is_placeholder< - typename ::boost::remove_cv< - typename ::boost::remove_reference<T>::type - >::type - > -{}; - -template<class T, class Table> -int maybe_get_table(const T& arg, const Table*& table, boost::mpl::true_) -{ - if(table == 0) { - table = &::boost::type_erasure::detail::access::table(arg); - } - return 0; -} - -template<class T, class Table> -int maybe_get_table(const T&, const Table*&, boost::mpl::false_) { return 0; } - -template<class T> -::boost::type_erasure::detail::storage& convert_arg(any_base<T>& arg, boost::mpl::true_) -{ - return ::boost::type_erasure::detail::access::data(arg); -} - -template<class Concept, class T> -const ::boost::type_erasure::detail::storage& -convert_arg(any_base<any<Concept, const T&> >& arg, boost::mpl::true_) -{ - return ::boost::type_erasure::detail::access::data(arg); -} - -template<class T> -const ::boost::type_erasure::detail::storage& -convert_arg(const any_base<T>& arg, boost::mpl::true_) -{ - return ::boost::type_erasure::detail::access::data(arg); -} - -template<class Concept, class T> -::boost::type_erasure::detail::storage& -convert_arg(const any_base<any<Concept, T&> >& arg, boost::mpl::true_) -{ - return ::boost::type_erasure::detail::access::data(arg); -} - -template<class Concept, class T> -const ::boost::type_erasure::detail::storage& -convert_arg(const any_base<any<Concept, const T&> >& arg, boost::mpl::true_) -{ - return ::boost::type_erasure::detail::access::data(arg); -} - -template<class Concept, class T> -::boost::type_erasure::detail::storage& -convert_arg(param<Concept, T>& arg, boost::mpl::true_) -{ - return ::boost::type_erasure::detail::access::data(arg); -} - -template<class Concept, class T> -const ::boost::type_erasure::detail::storage& -convert_arg(param<Concept, const T&>& arg, boost::mpl::true_) -{ - return ::boost::type_erasure::detail::access::data(arg); -} - -template<class Concept, class T> -const ::boost::type_erasure::detail::storage& -convert_arg(const param<Concept, T>& arg, boost::mpl::true_) -{ - return ::boost::type_erasure::detail::access::data(arg); -} - -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES - -template<class Concept, class T> -const ::boost::type_erasure::detail::storage& -convert_arg(any_base<any<Concept, const T&> >&& arg, boost::mpl::true_) -{ - return ::boost::type_erasure::detail::access::data(arg); -} - -template<class Concept, class T> -::boost::type_erasure::detail::storage& -convert_arg(any_base<any<Concept, T&> >&& arg, boost::mpl::true_) -{ - return ::boost::type_erasure::detail::access::data(arg); -} - -template<class Concept, class T> -::boost::type_erasure::detail::storage&& -convert_arg(any_base<any<Concept, T> >&& arg, boost::mpl::true_) -{ - return ::boost::type_erasure::detail::access::data(std::move(arg)); -} - -template<class Concept, class T> -::boost::type_erasure::detail::storage&& -convert_arg(any_base<any<Concept, T&&> >& arg, boost::mpl::true_) -{ - return ::boost::type_erasure::detail::access::data(arg); -} - -template<class Concept, class T> -::boost::type_erasure::detail::storage&& -convert_arg(const any_base<any<Concept, T&&> >& arg, boost::mpl::true_) -{ - return ::boost::type_erasure::detail::access::data(arg); -} - -template<class Concept, class T> -const ::boost::type_erasure::detail::storage& -convert_arg(param<Concept, const T&>&& arg, boost::mpl::true_) -{ - return ::boost::type_erasure::detail::access::data(arg); -} - -template<class Concept, class T> -::boost::type_erasure::detail::storage& -convert_arg(param<Concept, T&>&& arg, boost::mpl::true_) -{ - return ::boost::type_erasure::detail::access::data(arg); -} - -template<class Concept, class T> -::boost::type_erasure::detail::storage&& -convert_arg(param<Concept, T>&& arg, boost::mpl::true_) -{ - return ::boost::type_erasure::detail::access::data(std::move(arg)); -} - -template<class Concept, class T> -::boost::type_erasure::detail::storage&& -convert_arg(param<Concept, T&&>& arg, boost::mpl::true_) -{ - return ::boost::type_erasure::detail::access::data(arg); -} - -template<class Concept, class T> -::boost::type_erasure::detail::storage&& -convert_arg(const param<Concept, T&&>& arg, boost::mpl::true_) -{ - return ::boost::type_erasure::detail::access::data(arg); -} - -template<class T> -T&& convert_arg(T&& arg, boost::mpl::false_) { return std::forward<T>(arg); } - -#else - -template<class T> -T& convert_arg(T& arg, boost::mpl::false_) { return arg; } - -#endif - -} - -#ifdef BOOST_TYPE_ERASURE_DOXYGEN - -/** - * Dispatches a type erased function. - * - * @c Op must be a primitive concept which is present in - * @c Concept. Its signature determines how the arguments of - * \call are handled. If the argument is a @ref placeholder, - * \call expects an @ref any using that @ref placeholder. - * This @ref any is unwrapped by \call. The type that - * it stores must be the same type specified by @c binding. - * Any arguments that are not placeholders in the signature - * of @c Op are passed through unchanged. - * - * If @c binding is not specified, it will be deduced from - * the arguments. Naturally this requires at least one - * argument to be an @ref any. In this case, all @ref any - * arguments must have the same @ref binding. - * - * \return The result of the operation. If the result type - * of the signature of @c Op is a placeholder, the - * result will be converted to the appropriate @ref - * any type. - * - * \throws bad_function_call if @ref relaxed is - * in @c Concept and there is a type mismatch. - * - * Example: - * - * @code - * typedef mpl::vector< - * copy_constructible<_b>, - * addable<_a, int, _b> > concept; - * any<concept, _a> a = ...; - * any<concept, _b> b(call(addable<_a, int, _b>(), a, 10)); - * @endcode - * - * The signature of @ref addable is <code>_b(const _a&, const int&)</code> - */ -template<class Concept, class Op, class... U> -typename ::boost::type_erasure::detail::call_impl<Sig, U..., Concept>::type -call(const binding<Concept>& binding_arg, const Op&, U&&... args); - -/** - * \overload - */ -template<class Op, class... U> -typename ::boost::type_erasure::detail::call_impl<Sig, U...>::type -call(const Op&, U&&... args); - -#else - -namespace detail { - -template<class Sig, class Args, class Concept = void, - bool Check = ::boost::type_erasure::detail::check_call<Sig, Args>::type::value> -struct call_impl {}; - -template<class Op, class Args, class Concept = void> -struct call_result : - call_impl< - typename ::boost::type_erasure::detail::get_signature<Op>::type, - Args, - Concept> -{}; - -template<class C1, class Args, class Concept> -struct call_result< - ::boost::type_erasure::binding<C1>, - Args, - Concept -> -{}; - -} - -#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) - -namespace detail { - -template<class... T> -void ignore(const T&...) {} - -#ifndef BOOST_TYPE_ERASURE_USE_MP11 - -template<class R, class... T, class... U> -const ::boost::type_erasure::binding< - typename ::boost::type_erasure::detail::extract_concept<void(T...), U...>::type>* -extract_table(R(*)(T...), const U&... arg) -{ - const ::boost::type_erasure::binding< - typename ::boost::type_erasure::detail::extract_concept< - void(T...), U...>::type>* result = 0; - - // the order that we run maybe_get_table in doesn't matter - ignore(::boost::type_erasure::detail::maybe_get_table( - arg, - result, - ::boost::type_erasure::detail::is_placeholder_arg<T>())...); - - BOOST_ASSERT(result != 0); - return result; -} - -#else - -template<class R, class... T, class... U> -const ::boost::type_erasure::binding< - ::boost::type_erasure::detail::extract_concept_t< ::boost::mp11::mp_list<T...>, ::boost::mp11::mp_list<U...> > >* -extract_table(R(*)(T...), const U&... arg) -{ - const ::boost::type_erasure::binding< - ::boost::type_erasure::detail::extract_concept_t< - ::boost::mp11::mp_list<T...>, ::boost::mp11::mp_list<U...> > >* result = 0; - - // the order that we run maybe_get_table in doesn't matter - ignore(::boost::type_erasure::detail::maybe_get_table( - arg, - result, - ::boost::type_erasure::detail::is_placeholder_arg<T>())...); - - BOOST_ASSERT(result != 0); - return result; -} - -#endif - -template<class Sig, class Args, class Concept, bool ReturnsAny> -struct call_impl_dispatch; - -template<class R, class... T, class... U, class Concept> -struct call_impl_dispatch<R(T...), void(U...), Concept, false> -{ - typedef R type; - template<class F> - static R apply(const ::boost::type_erasure::binding<Concept>* table, U... arg) - { - return table->template find<F>()( - ::boost::type_erasure::detail::convert_arg( - ::std::forward<U>(arg), - ::boost::type_erasure::detail::is_placeholder_arg<T>())...); - } -}; - -template<class R, class... T, class... U, class Concept> -struct call_impl_dispatch<R(T...), void(U...), Concept, true> -{ - typedef ::boost::type_erasure::any<Concept, R> type; - template<class F> - static type apply(const ::boost::type_erasure::binding<Concept>* table, U... arg) - { - return type(table->template find<F>()( - ::boost::type_erasure::detail::convert_arg( - ::std::forward<U>(arg), - ::boost::type_erasure::detail::is_placeholder_arg<T>())...), *table); - } -}; - -template<class R, class... T, class... U, class Concept> -struct call_impl<R(T...), void(U...), Concept, true> : - ::boost::type_erasure::detail::call_impl_dispatch< - R(T...), - void(U...), - Concept, - ::boost::type_erasure::detail::is_placeholder_arg<R>::value - > -{ -}; - -#ifndef BOOST_TYPE_ERASURE_USE_MP11 - -template<class R, class... T, class... U> -struct call_impl<R(T...), void(U...), void, true> : - ::boost::type_erasure::detail::call_impl_dispatch< - R(T...), - void(U...), - typename ::boost::type_erasure::detail::extract_concept< - void(T...), - typename ::boost::remove_reference<U>::type... - >::type, - ::boost::type_erasure::detail::is_placeholder_arg<R>::value - > -{ -}; - -#else - -template<class R, class... T, class... U> -struct call_impl<R(T...), void(U...), void, true> : - ::boost::type_erasure::detail::call_impl_dispatch< - R(T...), - void(U...), - ::boost::type_erasure::detail::extract_concept_t< - ::boost::mp11::mp_list<T...>, - ::boost::mp11::mp_list< ::boost::remove_reference_t<U>...> - >, - ::boost::type_erasure::detail::is_placeholder_arg<R>::value - > -{ -}; - -#endif - -} - -template< - class Concept, - class Op, - class... U -> -typename ::boost::type_erasure::detail::call_result< - Op, - void(U&&...), - Concept ->::type -unchecked_call( - const ::boost::type_erasure::binding<Concept>& table, - const Op&, - U&&... arg) -{ - return ::boost::type_erasure::detail::call_impl< - typename ::boost::type_erasure::detail::get_signature<Op>::type, - void(U&&...), - Concept - >::template apply< - typename ::boost::type_erasure::detail::adapt_to_vtable<Op>::type - >(&table, std::forward<U>(arg)...); -} - -template<class Concept, class Op, class... U> -typename ::boost::type_erasure::detail::call_result< - Op, - void(U&&...), - Concept ->::type -call( - const ::boost::type_erasure::binding<Concept>& table, - const Op& f, - U&&... arg) -{ - ::boost::type_erasure::require_match(table, f, std::forward<U>(arg)...); - return ::boost::type_erasure::unchecked_call(table, f, std::forward<U>(arg)...); -} - -template<class Op, class... U> -typename ::boost::type_erasure::detail::call_result< - Op, - void(U&&...) ->::type -unchecked_call( - const Op&, - U&&... arg) -{ - return ::boost::type_erasure::detail::call_impl< - typename ::boost::type_erasure::detail::get_signature<Op>::type, - void(U&&...) - >::template apply< - typename ::boost::type_erasure::detail::adapt_to_vtable<Op>::type - >(::boost::type_erasure::detail::extract_table( - static_cast<typename ::boost::type_erasure::detail::get_signature<Op>::type*>(0), arg...), - std::forward<U>(arg)...); -} - -template<class Op, class... U> -typename ::boost::type_erasure::detail::call_result< - Op, - void(U&&...) ->::type -call( - const Op& f, - U&&... arg) -{ - ::boost::type_erasure::require_match(f, std::forward<U>(arg)...); - return ::boost::type_erasure::unchecked_call(f, std::forward<U>(arg)...); -} - - -#else - -#define BOOST_PP_FILENAME_1 <boost/type_erasure/call.hpp> -#define BOOST_PP_ITERATION_LIMITS (0, BOOST_TYPE_ERASURE_MAX_ARITY) -#include BOOST_PP_ITERATE() - -#endif - -#endif - -} -} - -#endif - -#else - -#define N BOOST_PP_ITERATION() - -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES - -#define BOOST_TYPE_ERASURE_CONVERT_ARG(z, n, data) \ - ::boost::type_erasure::detail::convert_arg( \ - std::forward<BOOST_PP_CAT(U, n)>(BOOST_PP_CAT(arg, n)), \ - ::boost::type_erasure::detail::is_placeholder_arg<BOOST_PP_CAT(T, n)>()) - -#else - -#define BOOST_TYPE_ERASURE_CONVERT_ARG(z, n, data) \ - ::boost::type_erasure::detail::convert_arg( \ - BOOST_PP_CAT(arg, n), \ - ::boost::type_erasure::detail::is_placeholder_arg<BOOST_PP_CAT(T, n)>()) - -#endif - -#define BOOST_TYPE_ERASURE_GET_TABLE(z, n, data) \ - ::boost::type_erasure::detail::maybe_get_table( \ - BOOST_PP_CAT(arg, n), \ - result, \ - ::boost::type_erasure::detail::is_placeholder_arg<BOOST_PP_CAT(T, n)>()); - -namespace detail { - -#if N != 0 - -template< - class R, - BOOST_PP_ENUM_PARAMS(N, class T), - BOOST_PP_ENUM_PARAMS(N, class U)> -const ::boost::type_erasure::binding< - typename ::boost::type_erasure::detail::BOOST_PP_CAT(extract_concept, N)< - BOOST_PP_ENUM_PARAMS(N, T), - BOOST_PP_ENUM_PARAMS(N, U)>::type>* -BOOST_PP_CAT(extract_table, N)(R(*)(BOOST_PP_ENUM_PARAMS(N, T)), BOOST_PP_ENUM_BINARY_PARAMS(N, const U, &arg)) -{ - const ::boost::type_erasure::binding< - typename ::boost::type_erasure::detail::BOOST_PP_CAT(extract_concept, N)< - BOOST_PP_ENUM_PARAMS(N, T), - BOOST_PP_ENUM_PARAMS(N, U)>::type>* result = 0; - BOOST_PP_REPEAT(N, BOOST_TYPE_ERASURE_GET_TABLE, ~) - BOOST_ASSERT(result != 0); - return result; -} - -#endif - -template< - class R - BOOST_PP_ENUM_TRAILING_PARAMS(N, class T) - BOOST_PP_ENUM_TRAILING_PARAMS(N, class U), - class Concept -#if N != 0 - = typename ::boost::type_erasure::detail::BOOST_PP_CAT(extract_concept, N)< - BOOST_PP_ENUM_PARAMS(N, T), - BOOST_PP_ENUM_PARAMS(N, U) - >::type -#endif - , - bool ReturnsAny = ::boost::type_erasure::detail::is_placeholder_arg<R>::value> -struct BOOST_PP_CAT(call_impl, N); - -template< - class R - BOOST_PP_ENUM_TRAILING_PARAMS(N, class T) - BOOST_PP_ENUM_TRAILING_PARAMS(N, class U), - class Concept -> -struct BOOST_PP_CAT(call_impl, N)< - R - BOOST_PP_ENUM_TRAILING_PARAMS(N, T) - BOOST_PP_ENUM_TRAILING_PARAMS(N, U), - Concept, - false -> -{ - typedef R type; - template<class F> - static R apply(const ::boost::type_erasure::binding<Concept>* table - BOOST_PP_ENUM_TRAILING_BINARY_PARAMS(N, U, arg)) - { - return table->template find<F>()( - BOOST_PP_ENUM(N, BOOST_TYPE_ERASURE_CONVERT_ARG, ~)); - } -}; - -template< - class R - BOOST_PP_ENUM_TRAILING_PARAMS(N, class T) - BOOST_PP_ENUM_TRAILING_PARAMS(N, class U), - class Concept -> -struct BOOST_PP_CAT(call_impl, N)< - R - BOOST_PP_ENUM_TRAILING_PARAMS(N, T) - BOOST_PP_ENUM_TRAILING_PARAMS(N, U), - Concept, - true -> -{ - typedef ::boost::type_erasure::any<Concept, R> type; - template<class F> - static type apply(const ::boost::type_erasure::binding<Concept>* table - BOOST_PP_ENUM_TRAILING_BINARY_PARAMS(N, U, arg)) - { - return type(table->template find<F>()( - BOOST_PP_ENUM(N, BOOST_TYPE_ERASURE_CONVERT_ARG, ~)), *table); - } -}; - -template< - class R - BOOST_PP_ENUM_TRAILING_PARAMS(N, class T) - BOOST_PP_ENUM_TRAILING_PARAMS(N, class U), - class Concept -> -struct call_impl<R(BOOST_PP_ENUM_PARAMS(N, T)), void(BOOST_PP_ENUM_BINARY_PARAMS(N, U, u)), Concept, true> - : BOOST_PP_CAT(call_impl, N)<R BOOST_PP_ENUM_TRAILING_PARAMS(N, T) BOOST_PP_ENUM_TRAILING_PARAMS(N, U), Concept> -{}; - -#if N != 0 - -template< - class R - BOOST_PP_ENUM_TRAILING_PARAMS(N, class T) - BOOST_PP_ENUM_TRAILING_PARAMS(N, class U) -> -struct call_impl<R(BOOST_PP_ENUM_PARAMS(N, T)), void(BOOST_PP_ENUM_BINARY_PARAMS(N, U, u)), void, true> - : BOOST_PP_CAT(call_impl, N)<R BOOST_PP_ENUM_TRAILING_PARAMS(N, T) BOOST_PP_ENUM_TRAILING_PARAMS(N, U)> -{}; - -#endif - -} - -#ifdef BOOST_NO_CXX11_RVALUE_REFERENCES -#define RREF & -#define BOOST_TYPE_ERASURE_FORWARD_ARGS(N, X, x) BOOST_PP_ENUM_TRAILING_PARAMS(N, x) -#else -#define RREF && -#define BOOST_TYPE_ERASURE_FORWARD_ARGS_I(z, n, data) std::forward<BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM(2, 0, data), n)>(BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM(2, 1, data), n)) -#define BOOST_TYPE_ERASURE_FORWARD_ARGS(N, X, x) BOOST_PP_ENUM_TRAILING(N, BOOST_TYPE_ERASURE_FORWARD_ARGS_I, (X, x)) -#endif - -template< - class Concept, - class Op - BOOST_PP_ENUM_TRAILING_PARAMS(N, class U) -> -typename ::boost::type_erasure::detail::call_result< - Op, - void(BOOST_PP_ENUM_BINARY_PARAMS(N, U, RREF u)), - Concept ->::type -unchecked_call( - const ::boost::type_erasure::binding<Concept>& table, - const Op& - BOOST_PP_ENUM_TRAILING_BINARY_PARAMS(N, U, RREF arg)) -{ - return ::boost::type_erasure::detail::call_impl< - typename ::boost::type_erasure::detail::get_signature<Op>::type, - void(BOOST_PP_ENUM_BINARY_PARAMS(N, U, RREF u)), - Concept - >::template apply< - typename ::boost::type_erasure::detail::adapt_to_vtable<Op>::type - >(&table BOOST_TYPE_ERASURE_FORWARD_ARGS(N, U, arg)); -} - -template< - class Concept, - class Op - BOOST_PP_ENUM_TRAILING_PARAMS(N, class U) -> -typename ::boost::type_erasure::detail::call_result< - Op, - void(BOOST_PP_ENUM_BINARY_PARAMS(N, U, RREF u)), - Concept ->::type -call( - const ::boost::type_erasure::binding<Concept>& table, - const Op& f - BOOST_PP_ENUM_TRAILING_BINARY_PARAMS(N, U, RREF arg)) -{ - ::boost::type_erasure::require_match(table, f BOOST_TYPE_ERASURE_FORWARD_ARGS(N, U, arg)); - return ::boost::type_erasure::unchecked_call(table, f BOOST_TYPE_ERASURE_FORWARD_ARGS(N, U, arg)); -} - -#if N != 0 - -template< - class Op - BOOST_PP_ENUM_TRAILING_PARAMS(N, class U) -> -typename ::boost::type_erasure::detail::call_result< - Op, - void(BOOST_PP_ENUM_BINARY_PARAMS(N, U, RREF u)) ->::type -unchecked_call( - const Op& - BOOST_PP_ENUM_TRAILING_BINARY_PARAMS(N, U, RREF arg)) -{ - return ::boost::type_erasure::detail::call_impl< - typename ::boost::type_erasure::detail::get_signature<Op>::type, - void(BOOST_PP_ENUM_BINARY_PARAMS(N, U, RREF u)) - >::template apply< - typename ::boost::type_erasure::detail::adapt_to_vtable<Op>::type - >( - ::boost::type_erasure::detail::BOOST_PP_CAT(extract_table, N)( - (typename ::boost::type_erasure::detail::get_signature<Op>::type*)0, - BOOST_PP_ENUM_PARAMS(N, arg)) - BOOST_TYPE_ERASURE_FORWARD_ARGS(N, U, arg) - ); -} - -template< - class Op - BOOST_PP_ENUM_TRAILING_PARAMS(N, class U) -> -typename ::boost::type_erasure::detail::call_result< - Op, - void(BOOST_PP_ENUM_BINARY_PARAMS(N, U, RREF u)) ->::type -call( - const Op& f - BOOST_PP_ENUM_TRAILING_BINARY_PARAMS(N, U, RREF arg)) -{ - ::boost::type_erasure::require_match(f BOOST_TYPE_ERASURE_FORWARD_ARGS(N, U, arg)); - return ::boost::type_erasure::unchecked_call(f BOOST_TYPE_ERASURE_FORWARD_ARGS(N, U, arg)); -} - -#endif - -#undef RREF -#undef BOOST_TYPE_ERASURE_FORWARD_ARGS -#undef BOOST_TYPE_ERASURE_FORWARD_ARGS_I - -#undef BOOST_TYPE_ERASURE_GET_TABLE -#undef BOOST_TYPE_ERASURE_CONVERT_ARG -#undef N - -#endif diff --git a/contrib/restricted/boost/type_erasure/include/boost/type_erasure/check_match.hpp b/contrib/restricted/boost/type_erasure/include/boost/type_erasure/check_match.hpp deleted file mode 100644 index 3066a6fcac..0000000000 --- a/contrib/restricted/boost/type_erasure/include/boost/type_erasure/check_match.hpp +++ /dev/null @@ -1,315 +0,0 @@ -// Boost.TypeErasure library -// -// Copyright 2011 Steven Watanabe -// -// Distributed under the Boost Software License Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// $Id$ - -#if !defined(BOOST_PP_IS_ITERATING) - -#ifndef BOOST_TYPE_ERASURE_CHECK_MATCH_HPP_INCLUDED -#define BOOST_TYPE_ERASURE_CHECK_MATCH_HPP_INCLUDED - -#include <boost/mpl/vector.hpp> -#include <boost/mpl/bool.hpp> -#include <boost/mpl/is_sequence.hpp> -#include <boost/mpl/find_if.hpp> -#include <boost/mpl/not.hpp> -#include <boost/mpl/end.hpp> -#include <boost/type_traits/is_same.hpp> -#include <boost/preprocessor/cat.hpp> -#include <boost/preprocessor/iteration/iterate.hpp> -#include <boost/preprocessor/repetition/repeat.hpp> -#include <boost/preprocessor/repetition/enum_params.hpp> -#include <boost/preprocessor/repetition/enum_trailing_params.hpp> -#include <boost/preprocessor/repetition/enum_trailing_binary_params.hpp> -#include <boost/type_erasure/detail/extract_concept.hpp> -#include <boost/type_erasure/relaxed.hpp> -#include <boost/type_erasure/detail/access.hpp> - -namespace boost { -namespace type_erasure { - -#ifndef BOOST_TYPE_ERASURE_DOXYGEN - -template<class T> -struct typeid_; - -template<class Concept> -class binding; - -#endif - -namespace detail { - -template<class P, class T, class Table> -bool maybe_check_table(const T& arg, const Table*& table, boost::mpl::true_) -{ - if(table == 0) { - table = &::boost::type_erasure::detail::access::table(arg); - return true; - } else { - return table->template find< ::boost::type_erasure::typeid_<P> >()() == - ::boost::type_erasure::detail::access::table(arg). - template find< ::boost::type_erasure::typeid_<P> >()(); - } -} - -template<class P, class T, class Table> -bool maybe_check_table(const T&, const Table*&, boost::mpl::false_) -{ - return true; -} - -template<class Concept, class T> -struct should_check : - boost::mpl::and_< - ::boost::type_erasure::is_placeholder<T>, - ::boost::type_erasure::is_relaxed<Concept> - > -{}; - -} - -#ifdef BOOST_TYPE_ERASURE_DOXYGEN - -/** - * If @ref relaxed is in @c Concept, checks whether the - * arguments to @c f match the types specified by - * @c binding. If @ref relaxed is not in @c Concept, - * returns true. If @c binding is not specified, it will - * be deduced from the arguments. - */ -template<class Concept, class Op, class... U> -bool check_match(const binding<Concept>& binding_arg, const Op& f, U&&... args); - -/** - * \overload - */ -template<class Op, class... U> -bool check_match(const Op& f, U&&... args); - -#else - -#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) - -namespace detail { - -template<class Concept, class R> -bool check_table(const ::boost::type_erasure::binding<Concept>* /*t*/, R(*)()) -{ - return true; -} - -template<class Concept, class R, class T0, class... T, class U0, class... U> -bool check_table( - const ::boost::type_erasure::binding<Concept>* t, - R(*)(T0, T...), - const U0& arg0, - const U&... arg) -{ - typedef typename ::boost::remove_cv< - typename ::boost::remove_reference<T0>::type - >::type t0; - if(!::boost::type_erasure::detail::maybe_check_table<t0>( - arg0, - t, - ::boost::type_erasure::detail::should_check<Concept, t0>())) - return false; - - return check_table(t, static_cast<void(*)(T...)>(0), arg...); -} - -} - -template<class Concept, class Op, class... U> -bool check_match( - const ::boost::type_erasure::binding<Concept>& table, - const Op&, - U&&... arg) -{ - - return ::boost::type_erasure::detail::check_table( - &table, - static_cast<typename ::boost::type_erasure::detail::get_signature<Op>::type*>(0), - arg...); -} - -#ifndef BOOST_TYPE_ERASURE_USE_MP11 - -template< - class Op, - class... U -> -bool check_match( - const Op&, - U&&... arg) -{ - const ::boost::type_erasure::binding< - typename ::boost::type_erasure::detail::extract_concept< - typename ::boost::type_erasure::detail::get_signature<Op>::type, U...>::type>* p = 0; - - return ::boost::type_erasure::detail::check_table( - p, static_cast<typename ::boost::type_erasure::detail::get_signature<Op>::type*>(0), arg...); -} - -#else - -namespace detail { - -template<class T> -struct get_args; - -template<class R, class ... T> -struct get_args<R(T...)> { typedef ::boost::mp11::mp_list<T...> type; }; - -template<class Sig> -using get_args_t = typename get_args<Sig>::type; - -} - -template< - class Op, - class... U -> -bool check_match( - const Op&, - U&&... arg) -{ - const ::boost::type_erasure::binding< - ::boost::type_erasure::detail::extract_concept_t< - ::boost::type_erasure::detail::get_args_t< - typename ::boost::type_erasure::detail::get_signature<Op>::type - >, - ::boost::mp11::mp_list< ::boost::remove_reference_t<U>...> > >* p = 0; - - return ::boost::type_erasure::detail::check_table( - p, static_cast<typename ::boost::type_erasure::detail::get_signature<Op>::type*>(0), arg...); -} - -#endif - -#else - -#define BOOST_PP_FILENAME_1 <boost/type_erasure/check_match.hpp> -#define BOOST_PP_ITERATION_LIMITS (0, BOOST_TYPE_ERASURE_MAX_ARITY) -#include BOOST_PP_ITERATE() - -#endif - -#endif - -} -} - -#endif - -#else - -namespace detail { - -#define N BOOST_PP_ITERATION() - -#define BOOST_TYPE_ERASURE_CHECK_TABLE(z, n, data) \ - typedef typename ::boost::remove_cv< \ - typename ::boost::remove_reference<BOOST_PP_CAT(T, n)>::type \ - >::type BOOST_PP_CAT(t, n); \ - if(!::boost::type_erasure::detail::maybe_check_table<BOOST_PP_CAT(t, n)>( \ - BOOST_PP_CAT(arg, n), \ - t, \ - ::boost::type_erasure::detail::should_check<Concept, BOOST_PP_CAT(t, n)>())) \ - return false; - -template< - class Concept, - class R - BOOST_PP_ENUM_TRAILING_PARAMS(N, class T) - BOOST_PP_ENUM_TRAILING_PARAMS(N, class U)> -bool -BOOST_PP_CAT(check_table, N)( - const ::boost::type_erasure::binding<Concept>* t, - R (*)(BOOST_PP_ENUM_PARAMS(N, T)) - BOOST_PP_ENUM_TRAILING_BINARY_PARAMS(N, const U, &arg)) -{ - (void)t; - BOOST_PP_REPEAT(N, BOOST_TYPE_ERASURE_CHECK_TABLE, ~) - return true; -} - -#if N != 0 - -template<class Sig BOOST_PP_ENUM_TRAILING_PARAMS(N, class U)> -struct BOOST_PP_CAT(do_extract_concept, N); - -template< - class R - BOOST_PP_ENUM_TRAILING_PARAMS(N, class T) - BOOST_PP_ENUM_TRAILING_PARAMS(N, class U) -> -struct BOOST_PP_CAT(do_extract_concept, N)< - R(BOOST_PP_ENUM_PARAMS(N, T)) - BOOST_PP_ENUM_TRAILING_PARAMS(N, U) -> - : ::boost::type_erasure::detail::BOOST_PP_CAT(extract_concept, N)< - BOOST_PP_ENUM_PARAMS(N, T) - BOOST_PP_ENUM_TRAILING_PARAMS(N, U)> -{}; - -#endif - -} - -#ifdef BOOST_NO_CXX11_RVALUE_REFERENCES -#define RREF & -#else -#define RREF && -#endif - -template< - class Concept, - class Op - BOOST_PP_ENUM_TRAILING_PARAMS(N, class U) -> -bool check_match( - const ::boost::type_erasure::binding<Concept>& table, - const Op& - BOOST_PP_ENUM_TRAILING_BINARY_PARAMS(N, U, RREF arg)) -{ - - return ::boost::type_erasure::detail::BOOST_PP_CAT(check_table, N)( - &table, - (typename ::boost::type_erasure::detail::get_signature<Op>::type*)0 - BOOST_PP_ENUM_TRAILING_PARAMS(N, arg)); -} - -#if N != 0 - -template< - class Op - BOOST_PP_ENUM_TRAILING_PARAMS(N, class U) -> -bool check_match( - const Op& - BOOST_PP_ENUM_TRAILING_BINARY_PARAMS(N, U, RREF arg)) -{ - const ::boost::type_erasure::binding< - typename ::boost::type_erasure::detail::BOOST_PP_CAT(do_extract_concept, N)< - typename ::boost::type_erasure::detail::get_signature<Op>::type, - BOOST_PP_ENUM_PARAMS(N, U)>::type>* p = 0; - - return ::boost::type_erasure::detail::BOOST_PP_CAT(check_table, N)( - p, - (typename ::boost::type_erasure::detail::get_signature<Op>::type*)0 - BOOST_PP_ENUM_TRAILING_PARAMS(N, arg)); -} - -#undef RREF -#undef BOOST_TYPE_ERASURE_CHECK_TABLE -#undef N - -#endif - -#endif diff --git a/contrib/restricted/boost/type_erasure/include/boost/type_erasure/concept_interface.hpp b/contrib/restricted/boost/type_erasure/include/boost/type_erasure/concept_interface.hpp deleted file mode 100644 index ec054cd423..0000000000 --- a/contrib/restricted/boost/type_erasure/include/boost/type_erasure/concept_interface.hpp +++ /dev/null @@ -1,53 +0,0 @@ -// Boost.TypeErasure library -// -// Copyright 2011 Steven Watanabe -// -// Distributed under the Boost Software License Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// $Id$ - -#ifndef BOOST_TYPE_ERASURE_CONCEPT_INTERFACE_HPP_INCLUDED -#define BOOST_TYPE_ERASURE_CONCEPT_INTERFACE_HPP_INCLUDED - -namespace boost { -namespace type_erasure { - -/** - * The @ref concept_interface class can be specialized to - * add behavior to an @ref any. An @ref any inherits from - * all the relevant specializations of @ref concept_interface. - * - * @ref concept_interface can be specialized for either - * primitive or composite concepts. If a concept @c C1 - * contains another concept @c C2, then the library guarantees - * that the specialization of @ref concept_interface for - * @c C2 is a base class of the specialization for @c C1. - * This means that @c C1 can safely override members of @c C2. - * - * @ref concept_interface may only be specialized for user-defined - * concepts. The library owns the specializations of its own - * built in concepts. - * - * \tparam Concept The concept that we're specializing - * @ref concept_interface for. One of its - * placeholders should be @c ID. - * \tparam Base The base of this class. Specializations of @ref - * concept_interface must inherit publicly from this type. - * \tparam ID The placeholder representing this type. - * \tparam Enable A dummy parameter that can be used for SFINAE. - * - * The metafunctions @ref derived, @ref rebind_any, and @ref as_param - * (which can be applied to @c Base) are useful for determining the - * argument and return types of functions defined in @ref concept_interface. - * - * For dispatching the function use \call. - */ -template<class Concept, class Base, class ID, class Enable = void> -struct concept_interface : Base {}; - -} -} - -#endif diff --git a/contrib/restricted/boost/type_erasure/include/boost/type_erasure/concept_of.hpp b/contrib/restricted/boost/type_erasure/include/boost/type_erasure/concept_of.hpp deleted file mode 100644 index f4b12dc743..0000000000 --- a/contrib/restricted/boost/type_erasure/include/boost/type_erasure/concept_of.hpp +++ /dev/null @@ -1,71 +0,0 @@ -// Boost.TypeErasure library -// -// Copyright 2011 Steven Watanabe -// -// Distributed under the Boost Software License Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// $Id$ - -#ifndef BOOST_TYPE_ERASURE_CONCEPT_OF_HPP_INCLUDED -#define BOOST_TYPE_ERASURE_CONCEPT_OF_HPP_INCLUDED - -#include <boost/config.hpp> - -namespace boost { -namespace type_erasure { - -#ifndef BOOST_TYPE_ERASURE_DOXYGEN - -template<class Concept, class T> -class any; - -template<class Concept, class T> -class param; - -#endif - -/** - * A metafunction returning the concept corresponding - * to an @ref any. It will also work for all bases - * of @ref any, so it can be applied to the @c Base - * parameter of @ref concept_interface. - */ -template<class T> -struct concept_of -{ -#ifdef BOOST_TYPE_ERASURE_DOXYGEN - typedef detail::unspecified type; -#else - typedef typename ::boost::type_erasure::concept_of< - typename T::_boost_type_erasure_derived_type - >::type type; -#endif -}; - -/** INTERNAL ONLY */ -template<class Concept, class T> -struct concept_of< ::boost::type_erasure::any<Concept, T> > -{ - typedef Concept type; -}; - -/** INTERNAL ONLY */ -template<class Concept, class T> -struct concept_of< ::boost::type_erasure::param<Concept, T> > -{ - typedef Concept type; -}; - -#ifndef BOOST_NO_CXX11_TEMPLATE_ALIASES - -template<class T> -using concept_of_t = typename ::boost::type_erasure::concept_of<T>::type; - -#endif - -} -} - -#endif diff --git a/contrib/restricted/boost/type_erasure/include/boost/type_erasure/config.hpp b/contrib/restricted/boost/type_erasure/include/boost/type_erasure/config.hpp deleted file mode 100644 index 65cf127570..0000000000 --- a/contrib/restricted/boost/type_erasure/include/boost/type_erasure/config.hpp +++ /dev/null @@ -1,27 +0,0 @@ -// Boost.TypeErasure library -// -// Copyright 2011 Steven Watanabe -// -// Distributed under the Boost Software License Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// $Id$ - -#ifndef BOOST_TYPE_ERASURE_CONFIG_HPP_INCLUDED -#define BOOST_TYPE_ERASURE_CONFIG_HPP_INCLUDED - -#ifndef BOOST_TYPE_ERASURE_MAX_FUNCTIONS -/** The maximum number of functions that an @ref boost::type_erasure::any "any" can have. */ -#define BOOST_TYPE_ERASURE_MAX_FUNCTIONS 50 -#endif -#ifndef BOOST_TYPE_ERASURE_MAX_ARITY -/** The maximum number of arguments that functions in the library support. */ -#define BOOST_TYPE_ERASURE_MAX_ARITY 5 -#endif -#ifndef BOOST_TYPE_ERASURE_MAX_TUPLE_SIZE -/** The maximum number of elements in a @ref boost::type_erasure::tuple "tuple". */ -#define BOOST_TYPE_ERASURE_MAX_TUPLE_SIZE 5 -#endif - -#endif diff --git a/contrib/restricted/boost/type_erasure/include/boost/type_erasure/constructible.hpp b/contrib/restricted/boost/type_erasure/include/boost/type_erasure/constructible.hpp deleted file mode 100644 index dd3c0f0004..0000000000 --- a/contrib/restricted/boost/type_erasure/include/boost/type_erasure/constructible.hpp +++ /dev/null @@ -1,205 +0,0 @@ -// Boost.TypeErasure library -// -// Copyright 2011 Steven Watanabe -// -// Distributed under the Boost Software License Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// $Id$ - -#if !defined(BOOST_PP_IS_ITERATING) - -#ifndef BOOST_TYPE_ERASURE_CONSTRUCTIBLE_HPP_INCLUDED -#define BOOST_TYPE_ERASURE_CONSTRUCTIBLE_HPP_INCLUDED - -#include <boost/detail/workaround.hpp> -#include <boost/preprocessor/iteration/iterate.hpp> -#include <boost/preprocessor/repetition/enum_params.hpp> -#include <boost/preprocessor/repetition/enum_binary_params.hpp> -#include <boost/preprocessor/repetition/enum_trailing_params.hpp> -#include <boost/type_erasure/detail/storage.hpp> -#include <boost/type_erasure/call.hpp> -#include <boost/type_erasure/concept_interface.hpp> -#include <boost/type_erasure/config.hpp> -#include <boost/type_erasure/param.hpp> - -namespace boost { -namespace type_erasure { - -template<class Sig> -struct constructible; - -namespace detail { - -template<class Sig> -struct null_construct; - -template<class C> -struct get_null_vtable_entry; - -template<class C, class Sig> -struct vtable_adapter; - -} - -#ifdef BOOST_TYPE_ERASURE_DOXYGEN - -/** - * The @ref constructible concept enables calling the - * constructor of a type contained by an @ref any. - * @c Sig should be a function signature. The return - * type is the placeholder specifying the type to - * be constructed. The arguments are the argument - * types of the constructor. The arguments of - * @c Sig may be placeholders. - * - * \note @ref constructible may not be specialized and - * may not be passed to \call as it depends on the - * implementation details of @ref any. - */ -template<class Sig> -struct constructible {}; - -#elif !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && \ - !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && \ - !BOOST_WORKAROUND(BOOST_MSVC, == 1800) - -template<class R, class... T> -struct constructible<R(T...)> -{ - static ::boost::type_erasure::detail::storage - apply(T... arg) - { - ::boost::type_erasure::detail::storage result; - result.data = new R(::std::forward<T>(arg)...); - return result; - } -}; - -/// INTERNAL ONLY -template<class Base, class Tag, class... T> -struct concept_interface< - ::boost::type_erasure::constructible<Tag(T...)>, - Base, - Tag -> : Base -{ - using Base::_boost_type_erasure_deduce_constructor; - ::boost::type_erasure::constructible<Tag(T...)>* - _boost_type_erasure_deduce_constructor( - typename ::boost::type_erasure::as_param<Base, T>::type...) const - { - return 0; - } -}; - -namespace detail { - -template<class... T> -struct null_construct<void(T...)> -{ - static ::boost::type_erasure::detail::storage - value(T...) - { - ::boost::type_erasure::detail::storage result; - result.data = 0; - return result; - } -}; - -template<class T, class R, class... U> -struct get_null_vtable_entry<vtable_adapter<constructible<T(const T&)>, R(U...)> > -{ - typedef null_construct<void(U...)> type; -}; - -} - -#else - -#define BOOST_PP_FILENAME_1 <boost/type_erasure/constructible.hpp> -#define BOOST_PP_ITERATION_LIMITS (0, BOOST_TYPE_ERASURE_MAX_ARITY) -#include BOOST_PP_ITERATE() - -#endif - -} -} - -#endif - -#else - -#define N BOOST_PP_ITERATION() - -#define BOOST_TYPE_ERASURE_ARG_DECL(z, n, data) \ - typename ::boost::type_erasure::as_param< \ - Base, \ - BOOST_PP_CAT(T, n) \ - >::type - -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES -#define BOOST_TYPE_ERASURE_FORWARD_I(z, n, data) ::std::forward<BOOST_PP_CAT(T, n)>(BOOST_PP_CAT(arg, n)) -#define BOOST_TYPE_ERASURE_FORWARD(n) BOOST_PP_ENUM(n, BOOST_TYPE_ERASURE_FORWARD_I, ~) -#else -#define BOOST_TYPE_ERASURE_FORWARD(n) BOOST_PP_ENUM_PARAMS(n, arg) -#endif - -template<class R BOOST_PP_ENUM_TRAILING_PARAMS(N, class T)> -struct constructible<R(BOOST_PP_ENUM_PARAMS(N, T))> -{ - static ::boost::type_erasure::detail::storage - apply(BOOST_PP_ENUM_BINARY_PARAMS(N, T, arg)) - { - ::boost::type_erasure::detail::storage result; - result.data = new R(BOOST_TYPE_ERASURE_FORWARD(N)); - return result; - } -}; - -template<class Base BOOST_PP_ENUM_TRAILING_PARAMS(N, class T), class Tag> -struct concept_interface< - ::boost::type_erasure::constructible<Tag(BOOST_PP_ENUM_PARAMS(N, T))>, - Base, - Tag -> : Base -{ - using Base::_boost_type_erasure_deduce_constructor; - ::boost::type_erasure::constructible<Tag(BOOST_PP_ENUM_PARAMS(N, T))>* - _boost_type_erasure_deduce_constructor( - BOOST_PP_ENUM(N, BOOST_TYPE_ERASURE_ARG_DECL, ~)) const - { - return 0; - } -}; - -namespace detail { - -template<BOOST_PP_ENUM_PARAMS(N, class T)> -struct null_construct<void(BOOST_PP_ENUM_PARAMS(N, T))> -{ - static ::boost::type_erasure::detail::storage - value(BOOST_PP_ENUM_PARAMS(N, T)) - { - ::boost::type_erasure::detail::storage result; - result.data = 0; - return result; - } -}; - -template<class T, class R BOOST_PP_ENUM_TRAILING_PARAMS(N, class T)> -struct get_null_vtable_entry<vtable_adapter<constructible<T(const T&)>, R(BOOST_PP_ENUM_PARAMS(N, T))> > -{ - typedef null_construct<void(BOOST_PP_ENUM_PARAMS(N, T))> type; -}; - -} - -#undef BOOST_TYPE_ERASURE_FORWARD -#undef BOOST_TYPE_ERASURE_FORWARD_I - -#undef BOOST_TYPE_ERASURE_ARG_DECL -#undef N - -#endif diff --git a/contrib/restricted/boost/type_erasure/include/boost/type_erasure/deduced.hpp b/contrib/restricted/boost/type_erasure/include/boost/type_erasure/deduced.hpp deleted file mode 100644 index 966c29bfc0..0000000000 --- a/contrib/restricted/boost/type_erasure/include/boost/type_erasure/deduced.hpp +++ /dev/null @@ -1,57 +0,0 @@ -// Boost.TypeErasure library -// -// Copyright 2011 Steven Watanabe -// -// Distributed under the Boost Software License Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// $Id$ - -#ifndef BOOST_TYPE_ERASURE_DEDUCED_HPP_INCLUDED -#define BOOST_TYPE_ERASURE_DEDUCED_HPP_INCLUDED - -#include <boost/mpl/eval_if.hpp> -#include <boost/mpl/identity.hpp> -#include <boost/mpl/set.hpp> -#include <boost/mpl/empty.hpp> -#include <boost/type_erasure/detail/get_placeholders.hpp> -#include <boost/type_erasure/placeholder.hpp> - -namespace boost { -namespace type_erasure { - -/** - * A placeholder for an associated type. The type corresponding - * to this placeholder is deduced by substituting placeholders - * in the arguments of the metafunction and then evaluating it. - * - * When using @ref deduced in a template context, if it is possible for - * Metafunction to contain no placeholders at all, use the nested type, - * to automatically evaluate it early as needed. - */ -template<class Metafunction> -struct deduced : ::boost::type_erasure::placeholder -{ - typedef typename ::boost::mpl::eval_if< - ::boost::mpl::empty< - typename ::boost::type_erasure::detail::get_placeholders< - Metafunction, -#ifndef BOOST_TYPE_ERASURE_USE_MP11 - ::boost::mpl::set0<> -#else - ::boost::mp11::mp_list<> -#endif - >::type - >, - Metafunction, - ::boost::mpl::identity< - ::boost::type_erasure::deduced<Metafunction> - > - >::type type; -}; - -} -} - -#endif diff --git a/contrib/restricted/boost/type_erasure/include/boost/type_erasure/detail/access.hpp b/contrib/restricted/boost/type_erasure/include/boost/type_erasure/detail/access.hpp deleted file mode 100644 index 84c61931bb..0000000000 --- a/contrib/restricted/boost/type_erasure/include/boost/type_erasure/detail/access.hpp +++ /dev/null @@ -1,242 +0,0 @@ -// Boost.TypeErasure library -// -// Copyright 2011 Steven Watanabe -// -// Distributed under the Boost Software License Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// $Id$ - -#ifndef BOOST_TYPE_ERASURE_DETAIL_ACCESS_HPP_INCLUDED -#define BOOST_TYPE_ERASURE_DETAIL_ACCESS_HPP_INCLUDED - -#include <boost/type_erasure/detail/storage.hpp> -#include <boost/type_erasure/detail/any_base.hpp> - -#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && \ - !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && \ - !defined(BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS) && \ - !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) && \ - !BOOST_WORKAROUND(BOOST_MSVC, == 1800) && \ - !BOOST_WORKAROUND(BOOST_GCC, < 40800) && /* Inherited constructors */ \ - !(defined(__clang_major__) && __clang_major__ == 3 && __clang__minor__ <= 2) /* Inherited constructors */ -#define BOOST_TYPE_ERASURE_SFINAE_FRIENDLY_CONSTRUCTORS -#include <boost/type_traits/is_reference.hpp> -#include <boost/utility/enable_if.hpp> -#endif - -namespace boost { -namespace type_erasure { - -template<class Concept, class T> -class any; - -template<class Concept, class T> -class param; - -template<class Concept> -class binding; - -namespace detail { - -struct access -{ - template<class Derived> - static const typename Derived::table_type& - table(const ::boost::type_erasure::any_base<Derived>& arg) - { - return static_cast<const Derived&>(arg).table; - } - template<class Concept, class T> - static const ::boost::type_erasure::binding<Concept>& - table(const ::boost::type_erasure::param<Concept, T>& arg) - { - return table(arg._impl); - } - template<class Concept, class T> - static const ::boost::type_erasure::binding<Concept>& - table(const ::boost::type_erasure::param<Concept, T&>& arg) - { - return arg._impl.table; - } -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES - template<class Concept, class T> - static const ::boost::type_erasure::binding<Concept>& - table(const ::boost::type_erasure::param<Concept, T&&>& arg) - { - return arg._impl.table; - } -#endif -#ifdef BOOST_TYPE_ERASURE_SFINAE_FRIENDLY_CONSTRUCTORS - template<class Concept, class T, class = typename ::boost::enable_if_c<!::boost::is_reference<T>::value>::type> - static const typename any<Concept, T>::table_type& - table(const ::boost::type_erasure::any_base< ::boost::type_erasure::any<Concept, T> >& arg) - { - return static_cast<const ::boost::type_erasure::any<Concept, T>&>(arg)._boost_type_erasure_table; - } - template<class Concept, class T> - static ::boost::type_erasure::detail::storage& - data(::boost::type_erasure::any_base< ::boost::type_erasure::any<Concept, T> >& arg) - { - return static_cast< ::boost::type_erasure::any<Concept, T>&>(arg)._boost_type_erasure_data; - } - template<class Concept, class T> - static const ::boost::type_erasure::detail::storage& - data(const ::boost::type_erasure::any_base< ::boost::type_erasure::any<Concept, T> >& arg) - { - return static_cast<const ::boost::type_erasure::any<Concept, T>&>(arg)._boost_type_erasure_data; - } - template<class Concept, class T> - static ::boost::type_erasure::detail::storage&& - data(::boost::type_erasure::any_base< ::boost::type_erasure::any<Concept, T> >&& arg) - { - return std::move(static_cast< ::boost::type_erasure::any<Concept, T>&&>(arg)._boost_type_erasure_data); - } -#endif - template<class Derived> - static ::boost::type_erasure::detail::storage& - data(::boost::type_erasure::any_base<Derived>& arg) - { - return static_cast<Derived&>(arg).data; - } - template<class Concept, class T> - static const ::boost::type_erasure::detail::storage& - data(::boost::type_erasure::any_base< ::boost::type_erasure::any<Concept, const T&> >& arg) - { - return static_cast< ::boost::type_erasure::any<Concept, const T&>&>(arg).data; - } - template<class Derived> - static const ::boost::type_erasure::detail::storage& - data(const ::boost::type_erasure::any_base<Derived>& arg) - { - return static_cast<const Derived&>(arg).data; - } - template<class Concept, class T> - static ::boost::type_erasure::detail::storage& - data(::boost::type_erasure::any_base< ::boost::type_erasure::any<Concept, T&> >& arg) - { - return const_cast< ::boost::type_erasure::detail::storage&>(static_cast< ::boost::type_erasure::any<Concept, T&>&>(arg).data); - } - template<class Concept, class T> - static ::boost::type_erasure::detail::storage& - data(const ::boost::type_erasure::any_base< ::boost::type_erasure::any<Concept, T&> >& arg) - { - return const_cast< ::boost::type_erasure::detail::storage&>(static_cast< const ::boost::type_erasure::any<Concept, T&>&>(arg).data); - } - template<class Concept, class T> - static const ::boost::type_erasure::detail::storage& - data(const ::boost::type_erasure::any_base< ::boost::type_erasure::any<Concept, const T&> >& arg) - { - return static_cast<const ::boost::type_erasure::any<Concept, const T&>&>(arg).data; - } - template<class Concept, class T> - static ::boost::type_erasure::detail::storage& - data(::boost::type_erasure::param<Concept, T>& arg) - { - return data(arg._impl); - } - template<class Concept, class T> - static ::boost::type_erasure::detail::storage& - data(::boost::type_erasure::param<Concept, T&>& arg) - { - return arg._impl.data; - } - template<class Concept, class T> - static const ::boost::type_erasure::detail::storage& - data(::boost::type_erasure::param<Concept, const T&>& arg) - { - return arg._impl.data; - } - template<class Concept, class T> - static const ::boost::type_erasure::detail::storage& - data(const ::boost::type_erasure::param<Concept, T>& arg) - { - return data(arg._impl); - } - template<class Concept, class T> - static const ::boost::type_erasure::detail::storage& - data(const ::boost::type_erasure::param<Concept, T&>& arg) - { - return arg._impl.data; - } - -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES - - template<class Derived> - static ::boost::type_erasure::detail::storage&& - data(::boost::type_erasure::any_base<Derived>&& arg) - { - return std::move(static_cast<Derived&>(arg).data); - } - template<class Concept, class T> - static ::boost::type_erasure::detail::storage&& - data(::boost::type_erasure::any_base< ::boost::type_erasure::any<Concept, T&&> >& arg) - { - return std::move(static_cast< ::boost::type_erasure::any<Concept, T&&>&>(arg).data); - } - template<class Concept, class T> - static ::boost::type_erasure::detail::storage&& - data(::boost::type_erasure::any_base< ::boost::type_erasure::any<Concept, T&&> >&& arg) - { - return std::move(static_cast< ::boost::type_erasure::any<Concept, T&&>&>(arg).data); - } - template<class Concept, class T> - static ::boost::type_erasure::detail::storage&& - data(const ::boost::type_erasure::any_base< ::boost::type_erasure::any<Concept, T&&> >& arg) - { - return std::move(const_cast< ::boost::type_erasure::detail::storage&>(static_cast< const ::boost::type_erasure::any<Concept, T&&>&>(arg).data)); - } - template<class Concept, class T> - static ::boost::type_erasure::detail::storage& - data(::boost::type_erasure::any_base< ::boost::type_erasure::any<Concept, T&> >&& arg) - { - return std::move(static_cast< ::boost::type_erasure::any<Concept, T&>&>(arg).data); - } - - template<class Concept, class T> - static ::boost::type_erasure::detail::storage&& - data(::boost::type_erasure::param<Concept, T>&& arg) - { - return std::move(data(arg._impl)); - } - template<class Concept, class T> - static ::boost::type_erasure::detail::storage&& - data(::boost::type_erasure::param<Concept, T&&>&& arg) - { - return std::move(arg._impl.data); - } - template<class Concept, class T> - static ::boost::type_erasure::detail::storage& - data(::boost::type_erasure::param<Concept, T&>&& arg) - { - return arg._impl.data; - } - template<class Concept, class T> - static const ::boost::type_erasure::detail::storage& - data(::boost::type_erasure::param<Concept, const T&>&& arg) - { - return arg._impl.data; - } - template<class Concept, class T> - static ::boost::type_erasure::detail::storage&& - data(::boost::type_erasure::param<Concept, T&&>& arg) - { - return std::move(arg._impl.data); - } - template<class Concept, class T> - static ::boost::type_erasure::detail::storage&& - data(const ::boost::type_erasure::param<Concept, T&&>& arg) - { - return std::move(const_cast< ::boost::type_erasure::detail::storage&>(arg._impl.data)); - } - -#endif - -}; - -} -} -} - -#endif diff --git a/contrib/restricted/boost/type_erasure/include/boost/type_erasure/detail/adapt_to_vtable.hpp b/contrib/restricted/boost/type_erasure/include/boost/type_erasure/detail/adapt_to_vtable.hpp deleted file mode 100644 index f842dc3985..0000000000 --- a/contrib/restricted/boost/type_erasure/include/boost/type_erasure/detail/adapt_to_vtable.hpp +++ /dev/null @@ -1,387 +0,0 @@ -// Boost.TypeErasure library -// -// Copyright 2011 Steven Watanabe -// -// Distributed under the Boost Software License Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// $Id$ - -#if !defined(BOOST_PP_IS_ITERATING) - -#ifndef BOOST_TYPE_ERASURE_DETAIL_ADAPT_TO_VTABLE_HPP_INCLUDED -#define BOOST_TYPE_ERASURE_DETAIL_ADAPT_TO_VTABLE_HPP_INCLUDED - -#include <boost/detail/workaround.hpp> -#include <boost/utility/addressof.hpp> -#include <boost/mpl/if.hpp> -#include <boost/mpl/eval_if.hpp> -#include <boost/mpl/has_xxx.hpp> -#include <boost/type_traits/function_traits.hpp> -#include <boost/type_traits/remove_cv.hpp> -#include <boost/preprocessor/cat.hpp> -#include <boost/preprocessor/iteration/iterate.hpp> -#include <boost/preprocessor/repetition/enum.hpp> -#include <boost/preprocessor/repetition/enum_params.hpp> -#include <boost/preprocessor/repetition/enum_trailing_params.hpp> -#include <boost/preprocessor/repetition/enum_binary_params.hpp> -#include <boost/type_erasure/detail/get_signature.hpp> -#include <boost/type_erasure/detail/storage.hpp> -#include <boost/type_erasure/is_placeholder.hpp> -#include <boost/type_erasure/config.hpp> - -namespace boost { -namespace type_erasure { - -namespace detail { - -template<class T, class Out> -struct get_placeholders; - -template<class PrimitiveConcept, class Sig> -struct vtable_adapter; - -template<class PrimitiveConcept, class Sig, class Out> -struct get_placeholders<vtable_adapter<PrimitiveConcept, Sig>, Out> -{ - typedef typename get_placeholders<PrimitiveConcept, Out>::type type; -}; - -template<class T> -struct replace_param_for_vtable -{ - typedef typename ::boost::mpl::if_< - ::boost::type_erasure::is_placeholder<typename ::boost::remove_cv<T>::type>, - const ::boost::type_erasure::detail::storage&, - T - >::type type; -}; - -template<class T> -struct replace_param_for_vtable<T&> -{ - typedef typename ::boost::mpl::if_< - ::boost::type_erasure::is_placeholder<typename ::boost::remove_cv<T>::type>, - ::boost::type_erasure::detail::storage&, - T& - >::type type; -}; - -template<class T> -struct replace_param_for_vtable<const T&> -{ - typedef typename ::boost::mpl::if_< - ::boost::type_erasure::is_placeholder<typename ::boost::remove_cv<T>::type>, - const ::boost::type_erasure::detail::storage&, - const T& - >::type type; -}; - -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES - -template<class T> -struct replace_param_for_vtable<T&&> -{ - typedef typename ::boost::mpl::if_< - ::boost::type_erasure::is_placeholder<typename ::boost::remove_cv<T>::type>, - ::boost::type_erasure::detail::storage&&, - T&& - >::type type; -}; - -#endif - -template<class T> -struct replace_result_for_vtable -{ - typedef typename ::boost::mpl::if_< - ::boost::type_erasure::is_placeholder<typename ::boost::remove_cv<T>::type>, - ::boost::type_erasure::detail::storage, - T - >::type type; -}; - -template<class T> -struct replace_result_for_vtable<T&> -{ - typedef typename ::boost::mpl::if_< - ::boost::type_erasure::is_placeholder<typename ::boost::remove_cv<T>::type>, - ::boost::type_erasure::detail::storage&, - T& - >::type type; -}; - -template<class T> -struct replace_result_for_vtable<const T&> -{ - typedef typename ::boost::mpl::if_< - ::boost::type_erasure::is_placeholder<typename ::boost::remove_cv<T>::type>, - ::boost::type_erasure::detail::storage&, - const T& - >::type type; -}; - -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES - -template<class T> -struct replace_result_for_vtable<T&&> -{ - typedef typename ::boost::mpl::if_< - ::boost::type_erasure::is_placeholder<typename ::boost::remove_cv<T>::type>, - ::boost::type_erasure::detail::storage&&, - T&& - >::type type; -}; - -#endif - -template<class Sig> -struct get_vtable_signature; - -BOOST_MPL_HAS_XXX_TRAIT_DEF(type) - -template<class T> -struct is_internal_concept : - ::boost::type_erasure::detail::has_type<T> -{}; - -template<class PrimitiveConcept> -struct adapt_to_vtable -{ - typedef ::boost::type_erasure::detail::vtable_adapter< - PrimitiveConcept, - typename ::boost::type_erasure::detail::get_vtable_signature< - typename ::boost::type_erasure::detail::get_signature< - PrimitiveConcept - >::type - >::type - > type; -}; - -template<class Concept> -struct maybe_adapt_to_vtable -{ - typedef typename ::boost::mpl::eval_if< - ::boost::type_erasure::detail::is_internal_concept<Concept>, - ::boost::mpl::identity<Concept>, - ::boost::type_erasure::detail::adapt_to_vtable<Concept> - >::type type; -}; - -#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && \ - !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && \ - !BOOST_WORKAROUND(BOOST_MSVC, == 1800) - -template<class PrimitiveConcept, class Sig, class ConceptSig> -struct vtable_adapter_impl; - -template<class PrimitiveConcept, class R, class... T, class R2, class... U> -struct vtable_adapter_impl<PrimitiveConcept, R(T...), R2(U...)> -{ - typedef R (*type)(T...); - static R value(T... arg) - { - return PrimitiveConcept::apply( - ::boost::type_erasure::detail::extract<U>(std::forward<T>(arg))...); - } -}; - -template<class PrimitiveConcept, class... T, class R2, class... U> -struct vtable_adapter_impl<PrimitiveConcept, ::boost::type_erasure::detail::storage(T...), R2(U...)> -{ - typedef ::boost::type_erasure::detail::storage (*type)(T...); - static ::boost::type_erasure::detail::storage value(T... arg) - { - return ::boost::type_erasure::detail::storage( - PrimitiveConcept::apply(::boost::type_erasure::detail::extract<U>(std::forward<T>(arg))...)); - } -}; - -template<class PrimitiveConcept, class... T, class R2, class... U> -struct vtable_adapter_impl<PrimitiveConcept, ::boost::type_erasure::detail::storage&(T...), R2(U...)> -{ - typedef ::boost::type_erasure::detail::storage (*type)(T...); - static ::boost::type_erasure::detail::storage value(T... arg) - { - ::boost::type_erasure::detail::storage result; - typename ::boost::remove_reference<R2>::type* p = - ::boost::addressof( - PrimitiveConcept::apply(::boost::type_erasure::detail::extract<U>(std::forward<T>(arg))...)); - result.data = const_cast<void*>(static_cast<const void*>(p)); - return result; - } -}; - -template<class PrimitiveConcept, class... T, class R2, class... U> -struct vtable_adapter_impl<PrimitiveConcept, ::boost::type_erasure::detail::storage&&(T...), R2(U...)> -{ - typedef ::boost::type_erasure::detail::storage (*type)(T...); - static ::boost::type_erasure::detail::storage value(T... arg) - { - ::boost::type_erasure::detail::storage result; - R2 tmp = PrimitiveConcept::apply(::boost::type_erasure::detail::extract<U>(std::forward<T>(arg))...); - typename ::boost::remove_reference<R2>::type* p = ::boost::addressof(tmp); - result.data = const_cast<void*>(static_cast<const void*>(p)); - return result; - } -}; - -template<class PrimitiveConcept, class Sig> -struct vtable_adapter - : vtable_adapter_impl< - PrimitiveConcept, - Sig, - typename ::boost::type_erasure::detail::get_signature< - PrimitiveConcept - >::type - > -{}; - -template<class R, class... T> -struct get_vtable_signature<R(T...)> -{ - typedef typename ::boost::type_erasure::detail::replace_result_for_vtable< - R - >::type type(typename ::boost::type_erasure::detail::replace_param_for_vtable<T>::type...); -}; - -#else - -#define BOOST_PP_FILENAME_1 <boost/type_erasure/detail/adapt_to_vtable.hpp> -#define BOOST_PP_ITERATION_LIMITS (0, BOOST_TYPE_ERASURE_MAX_ARITY) -#include BOOST_PP_ITERATE() - -#endif - -} -} -} - -#endif - -#else - -#define N BOOST_PP_ITERATION() - -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES - -#define BOOST_TYPE_ERASURE_EXTRACT(z, n, data) \ - ::boost::type_erasure::detail::extract< \ - typename traits:: \ - BOOST_PP_CAT(BOOST_PP_CAT(arg, BOOST_PP_INC(n)), _type) \ - >(std::forward<BOOST_PP_CAT(T, n)>(BOOST_PP_CAT(arg, n))) - -#else - -#define BOOST_TYPE_ERASURE_EXTRACT(z, n, data) \ - ::boost::type_erasure::detail::extract< \ - typename traits:: \ - BOOST_PP_CAT(BOOST_PP_CAT(arg, BOOST_PP_INC(n)), _type) \ - >(BOOST_PP_CAT(arg, n)) - -#endif - -#define BOOST_TYPE_ERASURE_REPLACE_PARAM(z, n, data) \ - typename ::boost::type_erasure::detail::replace_param_for_vtable< \ - BOOST_PP_CAT(T, n)>::type - -template<class PrimitiveConcept, class R - BOOST_PP_ENUM_TRAILING_PARAMS(N, class T)> -struct vtable_adapter<PrimitiveConcept, R(BOOST_PP_ENUM_PARAMS(N, T))> -{ - typedef R (*type)(BOOST_PP_ENUM_PARAMS(N, T)); - static R value(BOOST_PP_ENUM_BINARY_PARAMS(N, T, arg)) - { -#if N > 0 - typedef typename ::boost::function_traits< - typename ::boost::type_erasure::detail::get_signature< - PrimitiveConcept - >::type - > traits; -#endif - return PrimitiveConcept::apply( - BOOST_PP_ENUM(N, BOOST_TYPE_ERASURE_EXTRACT, ~)); - } -}; - -template<class PrimitiveConcept - BOOST_PP_ENUM_TRAILING_PARAMS(N, class T)> -struct vtable_adapter<PrimitiveConcept, ::boost::type_erasure::detail::storage(BOOST_PP_ENUM_PARAMS(N, T))> -{ - typedef ::boost::type_erasure::detail::storage (*type)(BOOST_PP_ENUM_PARAMS(N, T)); - static ::boost::type_erasure::detail::storage value(BOOST_PP_ENUM_BINARY_PARAMS(N, T, arg)) - { -#if N > 0 - typedef typename ::boost::function_traits< - typename ::boost::type_erasure::detail::get_signature< - PrimitiveConcept - >::type - > traits; -#endif - return ::boost::type_erasure::detail::storage( - PrimitiveConcept::apply( - BOOST_PP_ENUM(N, BOOST_TYPE_ERASURE_EXTRACT, ~))); - } -}; - -template<class PrimitiveConcept - BOOST_PP_ENUM_TRAILING_PARAMS(N, class T)> -struct vtable_adapter<PrimitiveConcept, ::boost::type_erasure::detail::storage&(BOOST_PP_ENUM_PARAMS(N, T))> -{ - typedef ::boost::type_erasure::detail::storage (*type)(BOOST_PP_ENUM_PARAMS(N, T)); - static ::boost::type_erasure::detail::storage value(BOOST_PP_ENUM_BINARY_PARAMS(N, T, arg)) - { - typedef typename ::boost::function_traits< - typename ::boost::type_erasure::detail::get_signature< - PrimitiveConcept - >::type - > traits; - ::boost::type_erasure::detail::storage result; - typename ::boost::remove_reference<typename traits::result_type>::type* p = - ::boost::addressof( - PrimitiveConcept::apply(BOOST_PP_ENUM(N, BOOST_TYPE_ERASURE_EXTRACT, ~))); - result.data = const_cast<void*>(static_cast<const void*>(p)); - return result; - } -}; - -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES - -template<class PrimitiveConcept - BOOST_PP_ENUM_TRAILING_PARAMS(N, class T)> -struct vtable_adapter<PrimitiveConcept, ::boost::type_erasure::detail::storage&&(BOOST_PP_ENUM_PARAMS(N, T))> -{ - typedef ::boost::type_erasure::detail::storage (*type)(BOOST_PP_ENUM_PARAMS(N, T)); - static ::boost::type_erasure::detail::storage value(BOOST_PP_ENUM_BINARY_PARAMS(N, T, arg)) - { - typedef typename ::boost::function_traits< - typename ::boost::type_erasure::detail::get_signature< - PrimitiveConcept - >::type - > traits; - ::boost::type_erasure::detail::storage result; - typename traits::result_type tmp = - PrimitiveConcept::apply(BOOST_PP_ENUM(N, BOOST_TYPE_ERASURE_EXTRACT, ~)); - typename ::boost::remove_reference<typename traits::result_type>::type* p = - ::boost::addressof(tmp); - result.data = const_cast<void*>(static_cast<const void*>(p)); - return result; - } -}; - -#endif - -template<class R BOOST_PP_ENUM_TRAILING_PARAMS(N, class T)> -struct get_vtable_signature<R(BOOST_PP_ENUM_PARAMS(N, T))> -{ - typedef typename ::boost::type_erasure::detail::replace_result_for_vtable< - R - >::type type(BOOST_PP_ENUM(N, BOOST_TYPE_ERASURE_REPLACE_PARAM, ~)); -}; - -#undef BOOST_TYPE_ERASURE_REPLACE_PARAM -#undef BOOST_TYPE_ERASURE_EXTRACT -#undef N - -#endif diff --git a/contrib/restricted/boost/type_erasure/include/boost/type_erasure/detail/any_base.hpp b/contrib/restricted/boost/type_erasure/include/boost/type_erasure/detail/any_base.hpp deleted file mode 100644 index b7c4f8c050..0000000000 --- a/contrib/restricted/boost/type_erasure/include/boost/type_erasure/detail/any_base.hpp +++ /dev/null @@ -1,31 +0,0 @@ -// Boost.TypeErasure library -// -// Copyright 2011 Steven Watanabe -// -// Distributed under the Boost Software License Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// $Id$ - -#ifndef BOOST_TYPE_ERASURE_DETAIL_ANY_BASE_HPP_INCLUDED -#define BOOST_TYPE_ERASURE_DETAIL_ANY_BASE_HPP_INCLUDED - -namespace boost { -namespace type_erasure { - -template<class Derived> -struct any_base -{ - typedef void _boost_type_erasure_is_any; - typedef Derived _boost_type_erasure_derived_type; - // volatile makes this a worse match than the default constructor - // for msvc-14.1, which can get confused otherwise. - void* _boost_type_erasure_deduce_constructor(...) const volatile { return 0; } - void* _boost_type_erasure_deduce_assign(...) { return 0; } -}; - -} -} - -#endif diff --git a/contrib/restricted/boost/type_erasure/include/boost/type_erasure/detail/auto_link.hpp b/contrib/restricted/boost/type_erasure/include/boost/type_erasure/detail/auto_link.hpp deleted file mode 100644 index 4f4392044b..0000000000 --- a/contrib/restricted/boost/type_erasure/include/boost/type_erasure/detail/auto_link.hpp +++ /dev/null @@ -1,38 +0,0 @@ -// Boost.TypeErasure library -// -// Copyright 2015 Steven Watanabe -// -// Distributed under the Boost Software License Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// $Id$ - -#ifndef BOOST_TYPE_ERASURE_DETAIL_AUTO_LINK_HPP_INCLUDED -#define BOOST_TYPE_ERASURE_DETAIL_AUTO_LINK_HPP_INCLUDED - -#include <boost/config.hpp> - -#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_TYPE_ERASURE_DYN_LINK) - #ifdef BOOST_TYPE_ERASURE_SOURCE - #define BOOST_TYPE_ERASURE_DECL BOOST_SYMBOL_EXPORT - #else - #define BOOST_TYPE_ERASURE_DECL BOOST_SYMBOL_IMPORT - #endif -#else - #define BOOST_TYPE_ERASURE_DECL -#endif - -#if !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_TYPE_ERASURE_NO_LIB) && !defined(BOOST_TYPE_ERASURE_SOURCE) - - #define BOOST_LIB_NAME boost_type_erasure - - #if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_TYPE_ERASURE_DYN_LINK) - #define BOOST_DYN_LINK - #endif - - #include <boost/config/auto_link.hpp> - -#endif - -#endif diff --git a/contrib/restricted/boost/type_erasure/include/boost/type_erasure/detail/check_call.hpp b/contrib/restricted/boost/type_erasure/include/boost/type_erasure/detail/check_call.hpp deleted file mode 100644 index daa9931146..0000000000 --- a/contrib/restricted/boost/type_erasure/include/boost/type_erasure/detail/check_call.hpp +++ /dev/null @@ -1,245 +0,0 @@ -// Boost.TypeErasure library -// -// Copyright 2012 Steven Watanabe -// -// Distributed under the Boost Software License Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// $Id$ - -#if !defined(BOOST_PP_IS_ITERATING) - -#ifndef BOOST_TYPE_ERASURE_DETAIL_CHECK_CALL_HPP_INCLUDED -#define BOOST_TYPE_ERASURE_DETAIL_CHECK_CALL_HPP_INCLUDED - -#include <boost/mpl/eval_if.hpp> -#include <boost/mpl/bool.hpp> -#include <boost/mpl/and.hpp> -#include <boost/type_traits/is_convertible.hpp> -#include <boost/type_traits/remove_reference.hpp> -#include <boost/type_traits/remove_cv.hpp> -#include <boost/type_traits/is_reference.hpp> -#include <boost/type_traits/is_const.hpp> -#include <boost/type_traits/function_traits.hpp> -#include <boost/preprocessor/iteration/iterate.hpp> -#include <boost/preprocessor/repetition/enum_params.hpp> -#include <boost/preprocessor/repetition/enum_trailing_params.hpp> -#include <boost/preprocessor/repetition/repeat.hpp> -#include <boost/preprocessor/cat.hpp> -#include <boost/type_erasure/placeholder_of.hpp> - -namespace boost { -namespace type_erasure { -namespace detail { - -template<class Sig, class Args> -struct check_call : ::boost::mpl::false_ {}; - -template<class T, class Enable = void> -struct qualified_placeholder -{ - typedef void type; -}; - -template<class T> -struct qualified_placeholder<T&, typename T::_boost_type_erasure_is_any> -{ - typedef typename ::boost::type_erasure::placeholder_of<T>::type placeholder; - typedef typename ::boost::remove_reference<placeholder>::type unref; - typedef typename ::boost::mpl::if_< ::boost::is_const<T>, - const unref, - unref - >::type add_const; - typedef typename ::boost::mpl::if_< ::boost::is_reference<placeholder>, - placeholder, - add_const& - >::type type; -}; - -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES - -template<class T> -struct qualified_placeholder<T&&, typename T::_boost_type_erasure_is_any> -{ - typedef typename ::boost::type_erasure::placeholder_of<T>::type placeholder; - typedef placeholder&& type; -}; - -#endif - -template<class P, class A> -struct check_placeholder_arg_impl : ::boost::mpl::false_ {}; - -template<class P> -struct check_placeholder_arg_impl<P, P&> : ::boost::mpl::true_ {}; - -template<class P> -struct check_placeholder_arg_impl<P, const P&> : ::boost::mpl::true_ {}; - -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES - -template<class P> -struct check_placeholder_arg_impl<P, P&&> : ::boost::mpl::true_ {}; - -#endif - -template<class P> -struct check_placeholder_arg_impl<P&, P&> : ::boost::mpl::true_ {}; - -template<class P> -struct check_placeholder_arg_impl<const P&, P&> : ::boost::mpl::true_ {}; - -template<class P> -struct check_placeholder_arg_impl<const P&, const P&> : ::boost::mpl::true_ {}; - -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES - -template<class P> -struct check_placeholder_arg_impl<const P&, P&&> : ::boost::mpl::true_ {}; - -template<class P> -struct check_placeholder_arg_impl<P&&, P&&> : ::boost::mpl::true_ {}; - -#endif - -template<class P, class Arg> -struct check_placeholder_arg : - check_placeholder_arg_impl< - P, - typename ::boost::type_erasure::detail::qualified_placeholder<Arg>::type - >::type -{}; - -#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && \ - ((defined(__GNUC__) && !(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 6))) || \ - defined(__MINGW32__) || defined(__MINGW64__) || \ - BOOST_WORKAROUND(BOOST_MSVC, <= 1700)) -#define BOOST_TYPE_ERASURE_BROKEN_RVALUE_IS_CONVERTIBLE -#endif - -#ifdef BOOST_TYPE_ERASURE_USE_MP11 - -template<class P, class Arg> -using check_placeholder_arg_t = - typename ::boost::type_erasure::detail::check_placeholder_arg_impl< - P, - typename ::boost::type_erasure::detail::qualified_placeholder<Arg>::type - >::type; - -template<class T, class Arg> -using check_nonplaceholder_arg_t = typename ::boost::is_convertible<Arg, T>::type; - -template<class FormalArg, class ActualArg> -using check_arg_t = - ::boost::type_erasure::detail::eval_if< - ::boost::type_erasure::is_placeholder< - ::boost::remove_cv_t< - ::boost::remove_reference_t<FormalArg> - > - >::value, - ::boost::type_erasure::detail::check_placeholder_arg_t, - ::boost::type_erasure::detail::check_nonplaceholder_arg_t, - FormalArg, - ActualArg - >; - -// MSVC 14.1 ICE's if we use check_arg_t directly. -template<class FormalArg, class ActualArg> -struct check_arg -{ - typedef ::boost::type_erasure::detail::check_arg_t<FormalArg, ActualArg> type; -}; - -template<class R, class... T, class... U> -struct check_call<R(T...), void(U...)> { - typedef ::boost::mp11::mp_all< - typename ::boost::type_erasure::detail::check_arg<T, U>::type... - > type; -}; - -#else - -template<class FormalArg, class ActualArg> -struct check_arg -{ - typedef typename ::boost::mpl::eval_if< - is_placeholder< - typename ::boost::remove_cv< - typename ::boost::remove_reference<FormalArg>::type - >::type - >, - ::boost::type_erasure::detail::check_placeholder_arg<FormalArg, ActualArg>, -#ifdef BOOST_TYPE_ERASURE_BROKEN_RVALUE_IS_CONVERTIBLE - ::boost::mpl::true_ -#else - ::boost::is_convertible<ActualArg, FormalArg> -#endif - >::type type; -}; - -#ifdef BOOST_NO_CXX11_VARIADIC_TEMPLATES - -#define BOOST_PP_FILENAME_1 <boost/type_erasure/detail/check_call.hpp> -#define BOOST_PP_ITERATION_LIMITS (0, BOOST_TYPE_ERASURE_MAX_ARITY) -#include BOOST_PP_ITERATE() - -#else - -template<class... B> -struct and_; - -template<class T1, class... T> -struct and_<T1, T...> : boost::mpl::eval_if_c<T1::type::value, and_<T...>, boost::mpl::false_>::type {}; - -template<class T1> -struct and_<T1> : T1::type {}; - -template<> -struct and_<> : boost::mpl::true_ {}; - -template<class R, class... T, class... U> -struct check_call<R(T...), void(U...)> { - typedef typename ::boost::type_erasure::detail::and_< - ::boost::type_erasure::detail::check_arg<T, U>... - >::type type; -}; - -#endif - -#endif - -} -} -} - -#endif - -#else - -#define N BOOST_PP_ITERATION() - -#define BOOST_TYPE_ERASURE_CHECK_ARG(z, n, data) \ - typedef typename ::boost::type_erasure::detail::check_arg< \ - BOOST_PP_CAT(T, n), \ - BOOST_PP_CAT(U, n) \ - >::type BOOST_PP_CAT(check, n); \ - typedef typename ::boost::mpl::and_< \ - BOOST_PP_CAT(type, n), \ - BOOST_PP_CAT(check, n) \ - >::type BOOST_PP_CAT(type, BOOST_PP_INC(n)); - -template< - class R - BOOST_PP_ENUM_TRAILING_PARAMS(N, class T) - BOOST_PP_ENUM_TRAILING_PARAMS(N, class U) -> -struct check_call<R(BOOST_PP_ENUM_PARAMS(N, T)), void(BOOST_PP_ENUM_BINARY_PARAMS(N, U, u))> { - typedef ::boost::mpl::true_ type0; - BOOST_PP_REPEAT(N, BOOST_TYPE_ERASURE_CHECK_ARG, ~) - typedef BOOST_PP_CAT(type, N) type; -}; - -#undef N - -#endif diff --git a/contrib/restricted/boost/type_erasure/include/boost/type_erasure/detail/check_map.hpp b/contrib/restricted/boost/type_erasure/include/boost/type_erasure/detail/check_map.hpp deleted file mode 100644 index d39b61fba2..0000000000 --- a/contrib/restricted/boost/type_erasure/include/boost/type_erasure/detail/check_map.hpp +++ /dev/null @@ -1,117 +0,0 @@ -// Boost.TypeErasure library -// -// Copyright 2012 Steven Watanabe -// -// Distributed under the Boost Software License Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// $Id$ - -#ifndef BOOST_TYPE_ERASURE_DETAIL_CHECK_MAP_HPP_INCLUDED -#define BOOST_TYPE_ERASURE_DETAIL_CHECK_MAP_HPP_INCLUDED - -#include <boost/mpl/not.hpp> -#include <boost/mpl/or.hpp> -#include <boost/mpl/bool.hpp> -#include <boost/mpl/set.hpp> -#include <boost/mpl/has_key.hpp> -#include <boost/mpl/find_if.hpp> -#include <boost/mpl/fold.hpp> -#include <boost/mpl/end.hpp> -#include <boost/type_traits/is_same.hpp> -#include <boost/type_erasure/detail/get_placeholders.hpp> -#include <boost/type_erasure/detail/normalize.hpp> -#include <boost/type_erasure/deduced.hpp> -#include <boost/type_erasure/static_binding.hpp> - -namespace boost { -namespace type_erasure { -namespace detail { - -template<class T> -struct is_deduced : boost::mpl::false_ {}; -template<class T> -struct is_deduced< ::boost::type_erasure::deduced<T> > : boost::mpl::true_ {}; - -// returns true if Map has a key for every non-deduced placeholder in Concept -template<class Concept, class Map> -struct check_map { -#ifndef BOOST_TYPE_ERASURE_USE_MP11 - typedef typename normalize_concept<Concept>::basic basic_components; - - typedef typename ::boost::mpl::fold< - basic_components, - ::boost::mpl::set0<>, - ::boost::type_erasure::detail::get_placeholders< - ::boost::mpl::_2, - ::boost::mpl::_1 - > - >::type placeholders; - - // Every non-deduced placeholder referenced in this - // map is indirectly deduced. - typedef typename ::boost::type_erasure::detail::get_placeholder_normalization_map< - Concept>::type placeholder_subs; - typedef typename ::boost::mpl::fold< - placeholder_subs, - ::boost::mpl::set0<>, - ::boost::mpl::insert< - ::boost::mpl::_1, - ::boost::mpl::second< ::boost::mpl::_2> - > - >::type indirect_deduced_placeholders; - typedef typename ::boost::is_same< - typename ::boost::mpl::find_if< - placeholders, - ::boost::mpl::not_< - ::boost::mpl::or_< - ::boost::type_erasure::detail::is_deduced< ::boost::mpl::_1>, - ::boost::mpl::has_key<Map, ::boost::mpl::_1>, - ::boost::mpl::has_key<indirect_deduced_placeholders, ::boost::mpl::_1> - > - > - >::type, - typename ::boost::mpl::end<placeholders>::type - >::type type; - -#else - typedef ::boost::type_erasure::detail::get_all_placeholders< - ::boost::type_erasure::detail::normalize_concept_t<Concept> - > placeholders; - - // Every non-deduced placeholder referenced in this - // map is indirectly deduced. - typedef typename ::boost::type_erasure::detail::get_placeholder_normalization_map< - Concept>::type placeholder_subs; - typedef ::boost::mp11::mp_unique< - ::boost::mp11::mp_append< - ::boost::mp11::mp_transform< - ::boost::mp11::mp_first, - ::boost::type_erasure::detail::make_mp_list<Map> - >, - ::boost::mp11::mp_transform< - ::boost::mp11::mp_second, - ::boost::type_erasure::detail::make_mp_list<placeholder_subs> - > - > - > okay_placeholders; - template<class P> - using check_placeholder = ::boost::mpl::or_< - ::boost::type_erasure::detail::is_deduced<P>, - ::boost::mp11::mp_set_contains<okay_placeholders, P> - >; - typedef ::boost::mp11::mp_all_of<placeholders, check_placeholder> type; -#endif -}; - -template<class Concept, class Map> -struct check_map<Concept, ::boost::type_erasure::static_binding<Map> > : - check_map<Concept, Map> -{}; - -} -} -} - -#endif diff --git a/contrib/restricted/boost/type_erasure/include/boost/type_erasure/detail/extract_concept.hpp b/contrib/restricted/boost/type_erasure/include/boost/type_erasure/detail/extract_concept.hpp deleted file mode 100644 index 0b1ce5d2fa..0000000000 --- a/contrib/restricted/boost/type_erasure/include/boost/type_erasure/detail/extract_concept.hpp +++ /dev/null @@ -1,154 +0,0 @@ -// Boost.TypeErasure library -// -// Copyright 2011 Steven Watanabe -// -// Distributed under the Boost Software License Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// $Id$ - -#if !defined(BOOST_PP_IS_ITERATING) - -#ifndef BOOST_TYPE_ERASURE_DETAIL_EXTRACT_CONCEPT_HPP_INCLUDED -#define BOOST_TYPE_ERASURE_DETAIL_EXTRACT_CONCEPT_HPP_INCLUDED - -#include <boost/mpl/eval_if.hpp> -#include <boost/mpl/identity.hpp> -#include <boost/type_traits/remove_cv.hpp> -#include <boost/type_traits/remove_reference.hpp> -#include <boost/preprocessor/cat.hpp> -#include <boost/preprocessor/inc.hpp> -#include <boost/preprocessor/iteration/iterate.hpp> -#include <boost/preprocessor/repetition/repeat.hpp> -#include <boost/preprocessor/repetition/enum_params.hpp> -#include <boost/type_erasure/is_placeholder.hpp> -#include <boost/type_erasure/concept_of.hpp> -#include <boost/type_erasure/config.hpp> - -namespace boost { -namespace type_erasure { -namespace detail { - -template<class T, class U> -struct combine_concepts; - -template<class T> -struct combine_concepts<T, T> { typedef T type; }; -template<class T> -struct combine_concepts<T, void> { typedef T type; }; -template<class T> -struct combine_concepts<void, T> { typedef T type; }; -template<> -struct combine_concepts<void, void> { typedef void type; }; - -#ifdef BOOST_TYPE_ERASURE_USE_MP11 - -template<class T, class U> -using combine_concepts_t = typename ::boost::type_erasure::detail::combine_concepts<T, U>::type; - -template<class T, class U> -using extract_concept_or_void = - ::boost::mp11::mp_eval_if_c< - !::boost::type_erasure::is_placeholder< - ::boost::remove_cv_t< - ::boost::remove_reference_t<T> - > - >::value, - void, - ::boost::type_erasure::concept_of_t, U - >; - -template<class L1, class L2> -using extract_concept_t = - ::boost::mp11::mp_fold< - ::boost::mp11::mp_transform< ::boost::type_erasure::detail::extract_concept_or_void, L1, L2>, - void, - ::boost::type_erasure::detail::combine_concepts_t - >; - -#else - -template<class T, class U> -struct maybe_extract_concept -{ - typedef typename ::boost::mpl::eval_if< - ::boost::type_erasure::is_placeholder< - typename ::boost::remove_cv< - typename ::boost::remove_reference<T>::type - >::type - >, - ::boost::type_erasure::concept_of<typename ::boost::remove_reference<U>::type>, - ::boost::mpl::identity<void> - >::type type; -}; - -#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) - -template<class Args, class... U> -struct extract_concept; - -template<class R, class T0, class... T, class U0, class... U> -struct extract_concept<R(T0, T...), U0, U...> -{ - typedef typename ::boost::type_erasure::detail::combine_concepts< - typename ::boost::type_erasure::detail::maybe_extract_concept< - T0, U0 - >::type, - typename ::boost::type_erasure::detail::extract_concept< - void(T...), - U... - >::type - >::type type; -}; - -template<> -struct extract_concept<void()> -{ - typedef void type; -}; - -#else - -#define BOOST_PP_FILENAME_1 <boost/type_erasure/detail/extract_concept.hpp> -#define BOOST_PP_ITERATION_LIMITS (1, BOOST_TYPE_ERASURE_MAX_ARITY) -#include BOOST_PP_ITERATE() - -#endif - -#endif - -} -} -} - -#endif - -#else - -#define N BOOST_PP_ITERATION() - -#define BOOST_TYPE_ERASURE_EXTRACT_CONCEPT(z, n, data) \ - typedef typename ::boost::type_erasure::detail::combine_concepts< \ - typename ::boost::type_erasure::detail::maybe_extract_concept< \ - BOOST_PP_CAT(T, n), BOOST_PP_CAT(U, n) \ - >::type, \ - BOOST_PP_CAT(concept, n) \ - >::type BOOST_PP_CAT(concept, BOOST_PP_INC(n)); - -template< - BOOST_PP_ENUM_PARAMS(N, class T), - BOOST_PP_ENUM_PARAMS(N, class U)> -struct BOOST_PP_CAT(extract_concept, N) -{ - typedef void concept0; - - BOOST_PP_REPEAT(N, BOOST_TYPE_ERASURE_EXTRACT_CONCEPT, ~) - - typedef BOOST_PP_CAT(concept, N) type; -}; - -#undef BOOST_TYPE_ERASURE_EXTRACT_CONCEPT -#undef N - -#endif diff --git a/contrib/restricted/boost/type_erasure/include/boost/type_erasure/detail/get_placeholders.hpp b/contrib/restricted/boost/type_erasure/include/boost/type_erasure/detail/get_placeholders.hpp deleted file mode 100644 index a17d2d445c..0000000000 --- a/contrib/restricted/boost/type_erasure/include/boost/type_erasure/detail/get_placeholders.hpp +++ /dev/null @@ -1,240 +0,0 @@ -// Boost.TypeErasure library -// -// Copyright 2011 Steven Watanabe -// -// Distributed under the Boost Software License Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// $Id$ - -#if !defined(BOOST_PP_IS_ITERATING) - -#ifndef BOOST_TYPE_ERASURE_DETAIL_GET_PLACEHOLDERS_HPP_INCLUDED -#define BOOST_TYPE_ERASURE_DETAIL_GET_PLACEHOLDERS_HPP_INCLUDED - -#include <boost/mpl/eval_if.hpp> -#include <boost/mpl/identity.hpp> -#include <boost/mpl/insert.hpp> -#include <boost/preprocessor/cat.hpp> -#include <boost/preprocessor/iteration/iterate.hpp> -#include <boost/preprocessor/repetition/enum.hpp> -#include <boost/preprocessor/repetition/enum_params.hpp> -#include <boost/preprocessor/repetition/enum_trailing_params.hpp> -#include <boost/type_erasure/detail/meta.hpp> -#include <boost/type_erasure/config.hpp> -#include <boost/type_erasure/is_placeholder.hpp> - -namespace boost { -namespace type_erasure { -namespace detail { - -#ifdef BOOST_TYPE_ERASURE_USE_MP11 - -template<class T> -struct get_placeholders_in_argument_impl -{ - template<class Out> - using apply = ::boost::type_erasure::detail::eval_if< - ::boost::type_erasure::is_placeholder<T>::value, - ::boost::mp11::mp_set_push_back, - ::boost::type_erasure::detail::first, - Out, T - >; -}; - -template<class T> -struct get_placeholders_in_argument_impl<T&> -{ - template<class Out> - using apply = typename ::boost::type_erasure::detail::get_placeholders_in_argument_impl<T>::template apply<Out>; -}; - -template<class T> -struct get_placeholders_in_argument_impl<T&&> -{ - template<class Out> - using apply = typename ::boost::type_erasure::detail::get_placeholders_in_argument_impl<T>::template apply<Out>; -}; - -template<class T> -struct get_placeholders_in_argument_impl<const T> -{ - template<class Out> - using apply = typename ::boost::type_erasure::detail::get_placeholders_in_argument_impl<T>::template apply<Out>; -}; - -template<class Out, class T> -using get_placeholders_f = typename get_placeholders_in_argument_impl<T>::template apply<Out>; - -template<class Out, class... T> -using get_placeholders_impl = - ::boost::mp11::mp_fold< - ::boost::mp11::mp_list<T...>, - Out, - ::boost::type_erasure::detail::get_placeholders_f - >; - -template<class R, class... T> -struct get_placeholders_in_argument_impl<R(T...)> -{ - template<class Out> - using apply = ::boost::type_erasure::detail::get_placeholders_impl<Out, R, T...>; -}; - -template<class R, class C, class... T> -struct get_placeholders_in_argument_impl<R (C::*)(T...)> -{ - template<class Out> - using apply = ::boost::type_erasure::detail::get_placeholders_impl<Out, R, C, T...>; -}; - -template<class R, class C, class... T> -struct get_placeholders_in_argument_impl<R (C::*)(T...) const> -{ - template<class Out> - using apply = ::boost::type_erasure::detail::get_placeholders_impl<Out, R, C, T...>; -}; - -template<class T, class Out> -struct get_placeholders; - -template<template<class...> class F, class... T, class Out> -struct get_placeholders<F<T...>, Out> -{ - using type = ::boost::type_erasure::detail::get_placeholders_impl<Out, T...>; -}; - -template<class T, class Out> -using get_placeholders_t = typename ::boost::type_erasure::detail::get_placeholders<T, Out>::type; - -#else - -template<class T, class Out> -struct get_placeholders_in_argument -{ - typedef typename ::boost::mpl::eval_if< - ::boost::type_erasure::is_placeholder<T>, - ::boost::mpl::insert<Out, T>, - ::boost::mpl::identity<Out> - >::type type; -}; - -template<class T, class Out> -struct get_placeholders; - -template<class T, class Out> -struct get_placeholders_in_argument<T&, Out> -{ - typedef typename ::boost::type_erasure::detail::get_placeholders_in_argument< - T, - Out - >::type type; -}; - -template<class T, class Out> -struct get_placeholders_in_argument<const T, Out> -{ - typedef typename ::boost::type_erasure::detail::get_placeholders_in_argument< - T, - Out - >::type type; -}; - -#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) - -template<class Out, class... T> -struct get_placeholders_impl; - -template<class Out, class T0, class... T> -struct get_placeholders_impl<Out, T0, T...> -{ - typedef typename ::boost::type_erasure::detail::get_placeholders_in_argument< - T0, - typename get_placeholders_impl<Out, T...>::type - >::type type; -}; - -template<class Out> -struct get_placeholders_impl<Out> -{ - typedef Out type; -}; - -template<template<class...> class T, class... U, class Out> -struct get_placeholders<T<U...>, Out> -{ - typedef typename get_placeholders_impl<Out, U...>::type type; -}; - -template<class R, class... T, class Out> -struct get_placeholders_in_argument<R(T...), Out> -{ - typedef typename get_placeholders_impl<Out, R, T...>::type type; -}; - -template<class R, class C, class... T, class Out> -struct get_placeholders_in_argument<R (C::*)(T...), Out> -{ - typedef typename get_placeholders_impl<Out, R, C, T...>::type type; -}; - -template<class R, class C, class... T, class Out> -struct get_placeholders_in_argument<R (C::*)(T...) const, Out> -{ - typedef typename get_placeholders_impl<Out, R, C, T...>::type type; -}; - -#else - -#define BOOST_PP_FILENAME_1 <boost/type_erasure/detail/get_placeholders.hpp> -#define BOOST_PP_ITERATION_LIMITS (0, BOOST_TYPE_ERASURE_MAX_ARITY) -#include BOOST_PP_ITERATE() - -#endif - -#endif - -} -} -} - -#endif - -#else - -#define N BOOST_PP_ITERATION() -#define BOOST_TYPE_ERASURE_GET_PLACEHOLDER(z, n, data) \ - typedef typename ::boost::type_erasure::detail::get_placeholders_in_argument< \ - BOOST_PP_CAT(data, n), BOOST_PP_CAT(type, n)>::type \ - BOOST_PP_CAT(type, BOOST_PP_INC(n)); - -#if N != 0 - -template<template<BOOST_PP_ENUM_PARAMS(N, class T)> class T, - BOOST_PP_ENUM_PARAMS(N, class T), class Out> -struct get_placeholders<T<BOOST_PP_ENUM_PARAMS(N, T)>, Out> -{ - typedef Out type0; - BOOST_PP_REPEAT(N, BOOST_TYPE_ERASURE_GET_PLACEHOLDER, T) - typedef BOOST_PP_CAT(type, N) type; -}; - -#endif - -template<class R - BOOST_PP_ENUM_TRAILING_PARAMS(N, class T), class Out> -struct get_placeholders_in_argument<R(BOOST_PP_ENUM_PARAMS(N, T)), Out> -{ - typedef typename ::boost::type_erasure::detail::get_placeholders_in_argument< - R, - Out - >::type type0; - BOOST_PP_REPEAT(N, BOOST_TYPE_ERASURE_GET_PLACEHOLDER, T) - typedef BOOST_PP_CAT(type, N) type; -}; - -#undef BOOST_TYPE_ERASURE_GET_PLACEHOLDER -#undef N - -#endif diff --git a/contrib/restricted/boost/type_erasure/include/boost/type_erasure/detail/get_signature.hpp b/contrib/restricted/boost/type_erasure/include/boost/type_erasure/detail/get_signature.hpp deleted file mode 100644 index 066638b3fa..0000000000 --- a/contrib/restricted/boost/type_erasure/include/boost/type_erasure/detail/get_signature.hpp +++ /dev/null @@ -1,33 +0,0 @@ -// Boost.TypeErasure library -// -// Copyright 2012 Steven Watanabe -// -// Distributed under the Boost Software License Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// $Id$ - -#ifndef BOOST_TYPE_ERASURE_DETAIL_GET_SIGNATURE_HPP_INCLUDED -#define BOOST_TYPE_ERASURE_DETAIL_GET_SIGNATURE_HPP_INCLUDED - -#include <boost/typeof/typeof.hpp> -#include <boost/type_traits/remove_pointer.hpp> - -namespace boost { -namespace type_erasure { -namespace detail { - -template<class Concept> -struct get_signature { - BOOST_TYPEOF_NESTED_TYPEDEF_TPL(nested, &Concept::apply) - typedef typename boost::remove_pointer< - typename nested::type - >::type type; -}; - -} -} -} - -#endif diff --git a/contrib/restricted/boost/type_erasure/include/boost/type_erasure/detail/meta.hpp b/contrib/restricted/boost/type_erasure/include/boost/type_erasure/detail/meta.hpp deleted file mode 100644 index 04db6d3526..0000000000 --- a/contrib/restricted/boost/type_erasure/include/boost/type_erasure/detail/meta.hpp +++ /dev/null @@ -1,94 +0,0 @@ -// Boost.TypeErasure library -// -// Copyright 2018 Steven Watanabe -// -// Distributed under the Boost Software License Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// $Id$ - -#ifndef BOOST_TYPE_ERASURE_DETAIL_META_HPP_INCLUDED -#define BOOST_TYPE_ERASURE_DETAIL_META_HPP_INCLUDED - -#include <boost/config.hpp> - - -#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && \ - !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) && \ - /* MSVC 14.0 breaks down in the template alias quagmire. */ \ - !BOOST_WORKAROUND(BOOST_MSVC, <= 1900) - -#define BOOST_TYPE_ERASURE_USE_MP11 - -#include <boost/mp11/list.hpp> -#include <boost/mp11/map.hpp> -#include <boost/mp11/set.hpp> -#include <boost/mp11/algorithm.hpp> -#include <boost/mp11/function.hpp> - -#ifdef YA_BOOST_TYPE_ERASURE_FUSION_COMPAT -#include <boost/mp11/mpl_list.hpp> -#else -#include <boost/mp11/mpl.hpp> -#endif - -namespace boost { -namespace type_erasure { -namespace detail { - -struct mp11_list_inserter -{ - template<class L, class T> - using apply = ::boost::mpl::identity< ::boost::mp11::mp_push_back<L, T> >; -}; - -template<class T> -struct make_mp_list_impl -{ - typedef typename ::boost::mpl::fold< - T, - ::boost::mp11::mp_list<>, - ::boost::type_erasure::detail::mp11_list_inserter - >::type type; -}; - -template<class... T> -struct make_mp_list_impl< ::boost::mp11::mp_list<T...> > -{ - typedef ::boost::mp11::mp_list<T...> type; -}; - -template<class T> -using make_mp_list = typename make_mp_list_impl<T>::type; - -template<bool> -struct eval_if_impl; - -template<> -struct eval_if_impl<true> -{ - template<template<class...> class T, template<class...> class F, class... A> - using apply = T<A...>; -}; - -template<> -struct eval_if_impl<false> -{ - template<template<class...> class T, template<class...> class F, class... A> - using apply = F<A...>; -}; - -template<bool B, template<class...> class T, template<class...> class F, class... A> -using eval_if = typename ::boost::type_erasure::detail::eval_if_impl<B>::template apply<T, F, A...>; - -template<class T0, class...> -using first = T0; - -} -} -} - -#endif - -#endif diff --git a/contrib/restricted/boost/type_erasure/include/boost/type_erasure/detail/normalize.hpp b/contrib/restricted/boost/type_erasure/include/boost/type_erasure/detail/normalize.hpp deleted file mode 100644 index 02c232a612..0000000000 --- a/contrib/restricted/boost/type_erasure/include/boost/type_erasure/detail/normalize.hpp +++ /dev/null @@ -1,802 +0,0 @@ -// Boost.TypeErasure library -// -// Copyright 2011 Steven Watanabe -// -// Distributed under the Boost Software License Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// $Id$ - -#ifndef BOOST_TYPE_ERASURE_DETAIL_NORMALIZE_HPP_INCLUDED -#define BOOST_TYPE_ERASURE_DETAIL_NORMALIZE_HPP_INCLUDED - -#include <boost/mpl/assert.hpp> -#include <boost/mpl/eval_if.hpp> -#include <boost/mpl/identity.hpp> -#include <boost/mpl/is_sequence.hpp> -#include <boost/mpl/set.hpp> -#include <boost/mpl/map.hpp> -#include <boost/mpl/has_key.hpp> -#include <boost/mpl/insert.hpp> -#include <boost/mpl/vector.hpp> -#include <boost/mpl/back_inserter.hpp> -#include <boost/mpl/inserter.hpp> -#include <boost/mpl/fold.hpp> -#include <boost/mpl/transform.hpp> -#include <boost/mpl/copy.hpp> -#include <boost/mpl/at.hpp> -#include <boost/type_traits/is_same.hpp> -#include <boost/type_erasure/detail/get_placeholders.hpp> -#include <boost/type_erasure/detail/rebind_placeholders.hpp> -#include <boost/type_erasure/detail/normalize_deduced.hpp> -#include <boost/type_erasure/detail/meta.hpp> -#include <boost/type_erasure/relaxed.hpp> -#include <boost/type_erasure/builtin.hpp> - -namespace boost { -namespace type_erasure { - -template<class F> -struct deduced; - -template<class T, class U> -struct same_type; - -namespace detail { -struct substitution_map_tag {}; - -// a wrapper around an mpl::map that -// defaults to the identity map. -template<class M> -struct substitution_map -{ - typedef substitution_map_tag tag; - typedef M map_type; -}; - -} -} - -namespace mpl { - -template<> -struct at_impl< ::boost::type_erasure::detail::substitution_map_tag> -{ - template<class Seq, class Key> - struct apply - { - typedef typename ::boost::mpl::eval_if< - ::boost::mpl::has_key<typename Seq::map_type, Key>, - ::boost::mpl::at<typename Seq::map_type, Key>, - ::boost::mpl::identity<Key> - >::type type; - }; -}; - -template<> -struct has_key_impl< ::boost::type_erasure::detail::substitution_map_tag> -{ - template<class Seq, class Key> - struct apply : boost::mpl::true_ - {}; -}; - -} - -namespace type_erasure { -namespace detail { - -// Given the arguments to same_type, determines -// which should be the key and which should be -// the value in the substitution map. -template<class T, class U> -struct select_pair -{ - BOOST_MPL_ASSERT((::boost::is_same<T, U>)); - typedef void type; -}; - -template<class T, class U> -struct select_pair<T, ::boost::type_erasure::deduced<U> > -{ - typedef ::boost::mpl::pair< ::boost::type_erasure::deduced<U>, T> type; -}; - -template<class T, class U> -struct select_pair< ::boost::type_erasure::deduced<T>, U> -{ - typedef ::boost::mpl::pair< ::boost::type_erasure::deduced<T>, U> type; -}; - -template<class T, class U> -struct select_pair< - ::boost::type_erasure::deduced<T>, - ::boost::type_erasure::deduced<U> -> -{ - typedef ::boost::mpl::pair< - ::boost::type_erasure::deduced<T>, - ::boost::type_erasure::deduced<U> - > type; -}; - -#ifndef BOOST_TYPE_ERASURE_USE_MP11 - -// given a partial substitution map from same_type, -// resolves a placeholder as far as possible. -template<class M, class T> -struct resolve_same_type -{ - typedef typename ::boost::mpl::eval_if< ::boost::mpl::has_key<M, T>, - ::boost::type_erasure::detail::resolve_same_type< - M, - typename ::boost::mpl::at<M, T>::type - >, - ::boost::mpl::identity<T> - >::type type; -}; - -// M is a map of placeholder substitutions -template<class M, class T> -struct normalize_placeholder -{ - typedef typename ::boost::mpl::eval_if< ::boost::mpl::has_key<M, T>, - ::boost::type_erasure::detail::normalize_placeholder< - M, - typename ::boost::mpl::at<M, T>::type - >, - ::boost::mpl::identity<T> - >::type type; -}; - -template<class M, class T> -struct normalize_placeholder<M, ::boost::type_erasure::deduced<T> > -{ - typedef typename ::boost::mpl::eval_if< ::boost::mpl::has_key<M, T>, - ::boost::type_erasure::detail::normalize_placeholder< - M, - typename ::boost::mpl::at<M, T>::type - >, - ::boost::type_erasure::detail::normalize_deduced< - M, - T - > - >::type type; -}; - -// Takes a mpl::map of placeholder substitutions and -// fully resolves it. i.e. a -> b, b -> c, becomes -// a -> c, b -> c. Also resolves deduced placeholders -// whose arguments are all resolved. -template<class M> -struct create_placeholder_map -{ - typedef typename ::boost::mpl::fold< - M, - ::boost::mpl::map0<>, - ::boost::mpl::insert< - ::boost::mpl::_1, - ::boost::mpl::pair< - ::boost::mpl::first< ::boost::mpl::_2>, - ::boost::type_erasure::detail::normalize_placeholder<M, ::boost::mpl::second< ::boost::mpl::_2> > - > - > - >::type type; -}; - -template<class Bindings, class P, class Out, class Sub> -struct convert_deduced -{ - typedef typename ::boost::type_erasure::detail::rebind_placeholders_in_argument< - typename P::first, - Bindings - >::type result1; - typedef typename ::boost::mpl::at<Sub, result1>::type result; - typedef typename ::boost::mpl::eval_if< - ::boost::mpl::has_key<Out, typename P::second>, - ::boost::mpl::identity<Out>, - ::boost::mpl::insert<Out, ::boost::mpl::pair<typename P::second, result> > - >::type type; - BOOST_MPL_ASSERT((boost::is_same<typename ::boost::mpl::at<type, typename P::second>::type, result>)); -}; - -template<class Bindings, class M, class Sub> -struct convert_deductions -{ - typedef typename ::boost::mpl::fold< - M, - Bindings, - ::boost::type_erasure::detail::convert_deduced< - Bindings, ::boost::mpl::_2, ::boost::mpl::_1, Sub - > - >::type type; -}; - -template<class Bindings, class P, class Out> -struct add_deduced -{ - typedef typename ::boost::type_erasure::detail::rebind_placeholders_in_argument< - typename P::first, - Bindings - >::type result; - typedef typename ::boost::mpl::eval_if< - ::boost::mpl::has_key<Out, typename P::second>, - ::boost::mpl::identity<Out>, - ::boost::mpl::insert<Out, ::boost::mpl::pair<typename P::second, result> > - >::type type; - BOOST_MPL_ASSERT((boost::is_same<typename ::boost::mpl::at<type, typename P::second>::type, result>)); -}; - -template<class Bindings, class M> -struct add_deductions -{ - typedef typename ::boost::mpl::fold< - M, - Bindings, - ::boost::type_erasure::detail::add_deduced< - Bindings, ::boost::mpl::_2, ::boost::mpl::_1 - > - >::type type; -}; - -// Fold Op for normalize_concept_impl -template<class Out, class T> -struct insert_concept -{ - typedef ::boost::mpl::pair< - typename ::boost::mpl::insert<typename Out::first, T>::type, - typename Out::second - > type; -}; - -template<class Out, class T, class U> -struct insert_concept<Out, ::boost::type_erasure::same_type<T, U> > -{ - typedef typename ::boost::type_erasure::detail::resolve_same_type< - typename Out::second, - T - >::type t1; - typedef typename ::boost::type_erasure::detail::resolve_same_type< - typename Out::second, - U - >::type t2; - typedef ::boost::mpl::pair< - typename Out::first, - typename ::boost::mpl::eval_if< - ::boost::is_same<t1, t2>, - ::boost::mpl::identity<typename Out::second>, - ::boost::mpl::insert< - typename Out::second, - typename ::boost::type_erasure::detail::select_pair< - t1, - t2 - >::type - > - >::type - > type; -}; - -// flattens a concept returning an mpl::pair -// - first is an MPL sequence containing the leaf concepts -// - second is an MPL map of the placeholder substitutions -// used to resolve same_type. -template<class Concept, class Out = ::boost::mpl::pair< ::boost::mpl::set0<>, ::boost::mpl::map0<> > > -struct normalize_concept_impl -{ - typedef typename ::boost::mpl::eval_if< ::boost::mpl::is_sequence<Concept>, - ::boost::mpl::fold<Concept, Out, normalize_concept_impl< ::boost::mpl::_2, ::boost::mpl::_1> >, - ::boost::type_erasure::detail::insert_concept<Out, Concept> - >::type type; -}; - -struct append_typeinfo -{ - template<class Set, class T> - struct apply - { - typedef typename ::boost::mpl::insert< - Set, - ::boost::type_erasure::typeid_<T> - >::type type; - }; -}; - -// Seq should be a flattened MPL sequence of leaf concepts. -// adds typeid_<P> for every placeholder used. -template<class Seq> -struct add_typeinfo -{ - typedef typename ::boost::mpl::fold< - Seq, - ::boost::mpl::set0<>, - ::boost::type_erasure::detail::get_placeholders< - ::boost::mpl::_2, - ::boost::mpl::_1 - > - >::type placeholders; - typedef typename ::boost::mpl::fold< - placeholders, - Seq, - ::boost::type_erasure::detail::append_typeinfo - >::type type; -}; - -template<class Concept> -struct get_placeholder_normalization_map -{ - typedef typename ::boost::type_erasure::detail::create_placeholder_map< - typename normalize_concept_impl<Concept>::type::second - >::type type; -}; - -// Flattens a Concept to an mpl::vector of primitive -// concepts. Resolves same_type and deduced placeholders. -template<class Concept> -struct normalize_concept -{ - typedef typename normalize_concept_impl<Concept>::type impl; - typedef typename ::boost::type_erasure::detail::create_placeholder_map< - typename impl::second - >::type substitutions; - typedef typename ::boost::mpl::fold< - typename impl::first, - ::boost::mpl::set0<>, - ::boost::mpl::insert< - ::boost::mpl::_1, - ::boost::type_erasure::detail::rebind_placeholders< - ::boost::mpl::_2, - ::boost::type_erasure::detail::substitution_map<substitutions> - > - > - >::type basic; - typedef typename ::boost::mpl::eval_if< - ::boost::type_erasure::is_relaxed<Concept>, - ::boost::type_erasure::detail::add_typeinfo<basic>, - ::boost::mpl::identity<basic> - >::type concept_set; - typedef typename ::boost::mpl::copy< - concept_set, - ::boost::mpl::back_inserter< ::boost::mpl::vector0<> > - >::type type; -}; - -// Returns an MPL sequence containing all the concepts -// in Concept. If Concept is considered as a DAG, -// the result will be sorted topologically. -template< - class Concept, - class Map = typename ::boost::type_erasure::detail::create_placeholder_map< - typename ::boost::type_erasure::detail::normalize_concept_impl< - Concept - >::type::second - >::type, - class Out = ::boost::mpl::set0<> -> -struct collect_concepts -{ - typedef typename ::boost::type_erasure::detail::rebind_placeholders< - Concept, - ::boost::type_erasure::detail::substitution_map<Map> - >::type transformed; - typedef typename ::boost::mpl::eval_if< ::boost::mpl::is_sequence<Concept>, - ::boost::mpl::fold<Concept, Out, collect_concepts< ::boost::mpl::_2, Map, ::boost::mpl::_1> >, - ::boost::mpl::identity<Out> - >::type type1; - typedef typename ::boost::mpl::eval_if< - ::boost::is_same<transformed, void>, - ::boost::mpl::identity<type1>, - ::boost::mpl::insert< - type1, - transformed - > - >::type type; -}; - -#else - -template<bool> -struct resolve_same_type_impl; - -template<class M, class T> -using resolve_same_type_t = - typename ::boost::type_erasure::detail::resolve_same_type_impl< - (::boost::mp11::mp_map_contains<M, T>::value) - >::template apply<M, T>; - -template<> -struct resolve_same_type_impl<true> -{ - template<class M, class T> - using apply = ::boost::type_erasure::detail::resolve_same_type_t< - M, - ::boost::mp11::mp_second< ::boost::mp11::mp_map_find<M, T> > - >; -}; - -template<> -struct resolve_same_type_impl<false> -{ - template<class M, class T> - using apply = T; -}; - -// given a partial substitution map from same_type, -// resolves a placeholder as far as possible. -template<class M, class T> -using resolve_same_type = ::boost::mpl::identity< ::boost::type_erasure::detail::resolve_same_type_t<M, T> >; - - -// M is a map of placeholder substitutions - -template<bool> -struct normalize_placeholder_impl; - -template<class M, class T> -using normalize_placeholder_t = - typename ::boost::type_erasure::detail::normalize_placeholder_impl< - ::boost::mp11::mp_map_contains<M, T>::value - >::template apply<M, T>; - -template<> -struct normalize_placeholder_impl<true> -{ - template<class M, class T> - using apply = ::boost::type_erasure::detail::normalize_placeholder_t< - M, - typename ::boost::mp11::mp_second< ::boost::mp11::mp_map_find<M, T> > - >; -}; - -template<class T> -struct normalize_deduced_impl -{ - template<class Map> - using apply = T; -}; - -template<template<class...> class F, class... T> -struct normalize_deduced_impl< ::boost::type_erasure::deduced<F<T...> > > -{ - template<class Map> - using apply = typename ::boost::type_erasure::deduced<F<normalize_placeholder_t<Map, T>...> >::type; -}; - -template<> -struct normalize_placeholder_impl<false> -{ - template<class M, class T> - using apply = typename ::boost::type_erasure::detail::normalize_deduced_impl<T>::template apply<M>; -}; - -template<class Map, class T> -using normalize_placeholder = ::boost::mpl::identity< ::boost::type_erasure::detail::normalize_placeholder_t<Map, T> >; - -// Takes a mpl::map of placeholder substitutions and -// fully resolves it. i.e. a -> b, b -> c, becomes -// a -> c, b -> c. Also resolves deduced placeholders -// whose arguments are all resolved. -template<class M> -struct create_placeholder_map -{ - template<class P> - using transform_one = ::boost::mpl::pair< - typename ::boost::mpl::first<P>::type, - ::boost::type_erasure::detail::normalize_placeholder_t< - M, - typename ::boost::mpl::second<P>::type - > - >; - typedef ::boost::mp11::mp_transform< - transform_one, - M - > type; -}; - -template<class M> -using create_placeholder_map_t = typename ::boost::type_erasure::detail::create_placeholder_map<M>::type; - -template<class Bindings, class P, class Out, class Sub> -struct convert_deduced -{ - typedef ::boost::type_erasure::detail::rebind_placeholders_in_argument_t< - typename P::first, - Bindings - > result1; - typedef ::boost::mp11::mp_second< ::boost::mp11::mp_map_find<Sub, result1> > result; - typedef ::boost::mp11::mp_map_insert<Out, ::boost::mpl::pair<typename P::second, result> > type; - BOOST_MPL_ASSERT((boost::is_same< ::boost::mp11::mp_second< ::boost::mp11::mp_map_find<type, typename P::second> >, result>)); -}; - -template<class Bindings, class Sub> -struct convert_deduced_f -{ - template<class Out, class P> - using apply = typename ::boost::type_erasure::detail::convert_deduced<Bindings, P, Out, Sub>::type; -}; - -template<class Bindings, class M, class Sub> -using convert_deductions_t = - ::boost::mp11::mp_fold< - M, - ::boost::type_erasure::detail::make_mp_list<Bindings>, - ::boost::type_erasure::detail::convert_deduced_f<Bindings, Sub>::template apply - >; - -template<class Bindings, class M, class Sub> -using convert_deductions = ::boost::mpl::identity< ::boost::type_erasure::detail::convert_deductions_t<Bindings, M, Sub> >; - -template<class Bindings, class P, class Out> -struct add_deduced -{ - typedef typename ::boost::type_erasure::detail::rebind_placeholders_in_argument< - typename P::first, - Bindings - >::type result; - typedef ::boost::mp11::mp_map_insert<Out, ::boost::mpl::pair<typename P::second, result> > type; - BOOST_MPL_ASSERT((boost::is_same< ::boost::mp11::mp_second< ::boost::mp11::mp_map_find<type, typename P::second> >, result>)); -}; - -template<class Bindings> -struct add_deduced_f -{ - template<class Out, class P> - using apply = typename ::boost::type_erasure::detail::add_deduced<Bindings, P, Out>::type; -}; - -template<class Bindings, class M> -using add_deductions_t = - ::boost::mp11::mp_fold< - M, - ::boost::type_erasure::detail::make_mp_list<Bindings>, - ::boost::type_erasure::detail::add_deduced_f< - ::boost::type_erasure::detail::make_mp_list<Bindings> - >::template apply - >; - -template<class Bindings, class M> -using add_deductions = ::boost::mpl::identity< ::boost::type_erasure::detail::add_deductions_t<Bindings, M> >; - -// Fold Op for normalize_concept_impl -template<class T> -struct insert_concept_impl -{ - template<class Out> - using apply = - ::boost::mpl::pair< - ::boost::mp11::mp_set_push_back<typename Out::first, T>, - typename Out::second - >; -}; - -template<class Map, class T> -using mpl_insert = typename ::boost::mpl::insert<Map, T>::type; - -template<class T1, class T2, class Out> -using insert_concept_same_type = - ::boost::mpl::pair< - typename Out::first, - typename ::boost::type_erasure::detail::eval_if< - ::boost::is_same<T1, T2>::value, - ::boost::type_erasure::detail::first, - ::boost::mp11::mp_map_insert, // FIXME: is this supposed to be a replace? - typename Out::second, - typename ::boost::type_erasure::detail::select_pair< - T1, - T2 - >::type - > - >; - -template<class T, class U> -struct insert_concept_impl< ::boost::type_erasure::same_type<T, U> > -{ - template<class Out> - using apply = ::boost::type_erasure::detail::insert_concept_same_type< - ::boost::type_erasure::detail::resolve_same_type_t< - typename Out::second, - T - >, - ::boost::type_erasure::detail::resolve_same_type_t< - typename Out::second, - U - >, - Out - >; -}; - -template<bool> -struct normalize_concept_impl_test; - -template<class Out, class Concept> -using normalize_concept_impl_f = - typename ::boost::type_erasure::detail::normalize_concept_impl_test< - ::boost::mpl::is_sequence<Concept>::value - >::template apply<Out, Concept>; - -template<> -struct normalize_concept_impl_test<true> -{ - template<class Out, class Concept> - using apply = - ::boost::mp11::mp_fold< - ::boost::type_erasure::detail::make_mp_list<Concept>, - Out, - ::boost::type_erasure::detail::normalize_concept_impl_f - >; -}; - -template<> -struct normalize_concept_impl_test<false> -{ - template<class Out, class Concept> - using apply = typename ::boost::type_erasure::detail::insert_concept_impl<Concept>::template apply<Out>; -}; - -template<class Concept> -using normalize_concept_impl_t = - ::boost::type_erasure::detail::normalize_concept_impl_f< - ::boost::mpl::pair< ::boost::mp11::mp_list<>, ::boost::mp11::mp_list<> >, - Concept - >; - -template<class Concept> -using normalize_concept_impl = ::boost::mpl::identity< ::boost::type_erasure::detail::normalize_concept_impl_t<Concept> >; - -template<class S, class T> -using get_all_placeholders_impl = typename ::boost::type_erasure::detail::get_placeholders<T, S>::type; - -template<class Seq> -using get_all_placeholders = - ::boost::mp11::mp_fold< - Seq, - ::boost::mp11::mp_list<>, - ::boost::type_erasure::detail::get_all_placeholders_impl - >; - -template<class T> -using make_identity_pair = ::boost::mpl::pair<T, T>; - -template<class Concept> -using make_identity_placeholder_map = - ::boost::mp11::mp_transform< - ::boost::type_erasure::detail::make_identity_pair, - ::boost::type_erasure::detail::get_all_placeholders< - typename normalize_concept_impl_t<Concept>::first - > - >; - -template<class S, class T> -using append_type_info = ::boost::mp11::mp_set_push_back< - S, - ::boost::type_erasure::typeid_<T> ->; - -template<class Seq> -using add_typeinfo_t = - ::boost::mp11::mp_fold< - get_all_placeholders<Seq>, - Seq, - ::boost::type_erasure::detail::append_type_info - >; - -// Seq should be a flattened mp_list sequence of leaf concepts. -// adds typeid_<P> for every placeholder used. -template<class Seq> -using add_typeinfo = ::boost::mpl::identity<add_typeinfo_t<Seq> >; - -template<class Substitutions> -struct normalize_concept_substitute_f -{ - template<class Set, class Concept> - using apply = ::boost::mp11::mp_set_push_back<Set, - typename ::boost::type_erasure::detail::rebind_placeholders< - Concept, - Substitutions - >::type - >; -}; - -template<class Concept, class Pair> -using normalize_concept_adjustments = - ::boost::type_erasure::detail::eval_if< - ::boost::type_erasure::is_relaxed<Concept>::value, - ::boost::type_erasure::detail::add_typeinfo_t, - ::boost::type_erasure::detail::first, - ::boost::mp11::mp_fold< - typename Pair::first, - ::boost::mp11::mp_list<>, - ::boost::type_erasure::detail::normalize_concept_substitute_f< - ::boost::type_erasure::detail::create_placeholder_map_t< - typename Pair::second - > - >::template apply - > - >; - -template<class Concept> -using get_placeholder_normalization_map_t = - ::boost::type_erasure::detail::create_placeholder_map_t< - typename normalize_concept_impl_t<Concept>::second - >; - -template<class Concept> -using get_placeholder_normalization_map = - ::boost::type_erasure::detail::create_placeholder_map< - typename normalize_concept_impl_t<Concept>::second - >; - -// Flattens a Concept to an mpl::vector of primitive -// concepts. Resolves same_type and deduced placeholders. -template<class Concept> -using normalize_concept_t = - ::boost::type_erasure::detail::normalize_concept_adjustments< - Concept, - boost::type_erasure::detail::normalize_concept_impl_t<Concept> - >; - -template<class Concept> -using normalize_concept = ::boost::mpl::identity< ::boost::type_erasure::detail::normalize_concept_t<Concept> >; - -template<class Map> -struct collect_concepts_f; - -template<class Out, class Concept, class Map> -using collect_concepts_recursive = ::boost::mp11::mp_fold< - ::boost::type_erasure::detail::make_mp_list<Concept>, - Out, - ::boost::type_erasure::detail::collect_concepts_f<Map>::template apply ->; - -template<class Concept, class Map, class Out, class Transformed> -using collect_concepts_impl = - ::boost::type_erasure::detail::eval_if< ::boost::is_same<Transformed, void>::value, - ::boost::type_erasure::detail::first, - ::boost::mp11::mp_set_push_front, - ::boost::type_erasure::detail::eval_if< ::boost::mpl::is_sequence<Concept>::value, - ::boost::type_erasure::detail::collect_concepts_recursive, - ::boost::type_erasure::detail::first, - Out, - Concept, - Map - >, - Transformed - >; - -template<class Concept, - class Map = ::boost::type_erasure::detail::create_placeholder_map_t< - typename ::boost::type_erasure::detail::normalize_concept_impl_t< - Concept - >::second - >, - class Out = ::boost::mp11::mp_list<> -> -using collect_concepts_t = - collect_concepts_impl<Concept, Map, Out, - typename ::boost::type_erasure::detail::rebind_placeholders< - Concept, - Map - >::type - >; - -template<class Map> -struct collect_concepts_f -{ - template<class Out, class Concept> - using apply = ::boost::type_erasure::detail::collect_concepts_t<Concept, Map, Out>; -}; - -// Returns an MPL sequence containing all the concepts -// in Concept. If Concept is considered as a DAG, -// the result will be sorted topologically. -template<class Concept> -using collect_concepts = ::boost::mpl::identity< - ::boost::type_erasure::detail::collect_concepts_t<Concept> >; - -#endif - -} -} -} - -#endif diff --git a/contrib/restricted/boost/type_erasure/include/boost/type_erasure/detail/normalize_deduced.hpp b/contrib/restricted/boost/type_erasure/include/boost/type_erasure/detail/normalize_deduced.hpp deleted file mode 100644 index dcf3fd3625..0000000000 --- a/contrib/restricted/boost/type_erasure/include/boost/type_erasure/detail/normalize_deduced.hpp +++ /dev/null @@ -1,66 +0,0 @@ -// Boost.TypeErasure library -// -// Copyright 2011 Steven Watanabe -// -// Distributed under the Boost Software License Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// $Id$ - -#if !defined(BOOST_PP_IS_ITERATING) - -#ifndef BOOST_TYPE_ERASURE_DETAIL_NORMALIZE_DEDUCED_HPP_INCLUDED -#define BOOST_TYPE_ERASURE_DETAIL_NORMALIZE_DEDUCED_HPP_INCLUDED - -#include <boost/preprocessor/iteration/iterate.hpp> -#include <boost/preprocessor/repetition/enum.hpp> -#include <boost/preprocessor/repetition/enum_params.hpp> -#include <boost/type_erasure/detail/meta.hpp> - -#ifndef BOOST_TYPE_ERASURE_USE_MP11 - -namespace boost { -namespace type_erasure { -namespace detail { - -template<class M, class T> -struct normalize_deduced; -template<class M, class T> -struct normalize_placeholder; - -#define BOOST_PP_FILENAME_1 <boost/type_erasure/detail/normalize_deduced.hpp> -#define BOOST_PP_ITERATION_LIMITS (1, BOOST_TYPE_ERASURE_MAX_ARITY) -#include BOOST_PP_ITERATE() - -} -} -} - -#endif - -#endif - -#else - -#define N BOOST_PP_ITERATION() - -#define BOOST_TYPE_ERASURE_NORMALIZE_PLACEHOLDER(z, n, data) \ - typename ::boost::type_erasure::detail::normalize_placeholder< \ - M, \ - BOOST_PP_CAT(U, n) \ - >::type - -template<class M, template<BOOST_PP_ENUM_PARAMS(N, class T)> class T, BOOST_PP_ENUM_PARAMS(N, class U)> -struct normalize_deduced<M, T<BOOST_PP_ENUM_PARAMS(N, U)> > -{ - typedef typename ::boost::type_erasure::deduced< - T<BOOST_PP_ENUM(N, BOOST_TYPE_ERASURE_NORMALIZE_PLACEHOLDER, ~)> - >::type type; -}; - -#undef BOOST_TYPE_ERASURE_NORMALIZE_PLACEHOLDER - -#undef N - -#endif diff --git a/contrib/restricted/boost/type_erasure/include/boost/type_erasure/detail/rebind_placeholders.hpp b/contrib/restricted/boost/type_erasure/include/boost/type_erasure/detail/rebind_placeholders.hpp deleted file mode 100644 index 0d0ef7c8e4..0000000000 --- a/contrib/restricted/boost/type_erasure/include/boost/type_erasure/detail/rebind_placeholders.hpp +++ /dev/null @@ -1,339 +0,0 @@ -// Boost.TypeErasure library -// -// Copyright 2011 Steven Watanabe -// -// Distributed under the Boost Software License Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// $Id$ - -#if !defined(BOOST_PP_IS_ITERATING) - -#ifndef BOOST_TYPE_ERASURE_DETAIL_REBIND_PLACEHOLDERS_HPP_INCLUDED -#define BOOST_TYPE_ERASURE_DETAIL_REBIND_PLACEHOLDERS_HPP_INCLUDED - -#include <boost/mpl/eval_if.hpp> -#include <boost/mpl/identity.hpp> -#include <boost/mpl/at.hpp> -#include <boost/mpl/has_key.hpp> -#include <boost/mpl/not.hpp> -#include <boost/mpl/or.hpp> -#include <boost/mpl/assert.hpp> -#include <boost/preprocessor/cat.hpp> -#include <boost/preprocessor/iteration/iterate.hpp> -#include <boost/preprocessor/repetition/enum.hpp> -#include <boost/preprocessor/repetition/enum_params.hpp> -#include <boost/preprocessor/repetition/enum_trailing_params.hpp> -#include <boost/type_erasure/config.hpp> -#include <boost/type_erasure/detail/meta.hpp> -#include <boost/type_erasure/is_placeholder.hpp> - -namespace boost { -namespace type_erasure { - -template<class F> -struct deduced; - -namespace detail { - -template<class T, class Bindings> -struct rebind_placeholders -{ - typedef void type; -}; - -template<class T> -struct identity -{ - typedef T type; -}; - -template<class PrimitiveConcept, class Sig> -struct vtable_adapter; - -#ifdef BOOST_TYPE_ERASURE_USE_MP11 - -template<class T, class Bindings> -using rebind_placeholders_t = typename rebind_placeholders<T, Bindings>::type; - -template<class T, class Bindings> -using rebind_one_placeholder = ::boost::mp11::mp_second< ::boost::mp11::mp_map_find<Bindings, T> >; - -template<class T> -struct rebind_placeholders_in_argument_impl -{ - template<class Bindings> - using apply = ::boost::type_erasure::detail::eval_if< - ::boost::mp11::mp_map_contains<Bindings, T>::value, - ::boost::type_erasure::detail::rebind_one_placeholder, - ::boost::type_erasure::detail::first, - T, - Bindings - >; -}; - -template<class T, class Bindings> -using rebind_placeholders_in_argument_t = typename ::boost::type_erasure::detail::rebind_placeholders_in_argument_impl<T>::template apply<Bindings>; - -template<class T, class Bindings> -using rebind_placeholders_in_argument = ::boost::mpl::identity< ::boost::type_erasure::detail::rebind_placeholders_in_argument_t<T, Bindings> >; - -template<class T> -struct rebind_placeholders_in_argument_impl<T&> -{ - template<class Bindings> - using apply = rebind_placeholders_in_argument_t<T, Bindings>&; -}; - -template<class T> -struct rebind_placeholders_in_argument_impl<T&&> -{ - template<class Bindings> - using apply = rebind_placeholders_in_argument_t<T, Bindings>&&; -}; - -template<class T> -struct rebind_placeholders_in_argument_impl<const T> -{ - template<class Bindings> - using apply = rebind_placeholders_in_argument_t<T, Bindings> const; -}; - -template<class F, class Bindings> -using rebind_placeholders_in_deduced = - typename ::boost::type_erasure::deduced< - ::boost::type_erasure::detail::rebind_placeholders_t<F, Bindings> - >::type; - -template<class F, class Bindings> -using rebind_deduced_placeholder = - ::boost::mp11::mp_second< - ::boost::mp11::mp_map_find<Bindings, ::boost::type_erasure::deduced<F> > - >; - -template<class F> -struct rebind_placeholders_in_argument_impl< - ::boost::type_erasure::deduced<F> -> -{ - template<class Bindings> - using apply = ::boost::type_erasure::detail::eval_if< - ::boost::mp11::mp_map_contains<Bindings, ::boost::type_erasure::deduced<F> >::value, - ::boost::type_erasure::detail::rebind_deduced_placeholder, - ::boost::type_erasure::detail::rebind_placeholders_in_deduced, - F, - Bindings - >; -}; - -template<class R, class... T> -struct rebind_placeholders_in_argument_impl<R(T...)> -{ - template<class Bindings> - using apply = - rebind_placeholders_in_argument_t<R, Bindings> - (rebind_placeholders_in_argument_t<T, Bindings>...); -}; - -template<class R, class C, class... T> -struct rebind_placeholders_in_argument_impl<R (C::*)(T...)> -{ - template<class Bindings> - using apply = - rebind_placeholders_in_argument_t<R, Bindings> - (rebind_placeholders_in_argument_t<C, Bindings>::*) - (rebind_placeholders_in_argument_t<T, Bindings>...); -}; - -template<class R, class C, class... T> -struct rebind_placeholders_in_argument_impl<R (C::*)(T...) const> -{ - template<class Bindings> - using apply = - rebind_placeholders_in_argument_t<R, Bindings> - (rebind_placeholders_in_argument_t<C, Bindings>::*) - (rebind_placeholders_in_argument_t<T, Bindings>...) const; -}; - -template<template<class...> class T, class... U, class Bindings> -struct rebind_placeholders<T<U...>, Bindings> -{ - typedef ::boost::type_erasure::detail::make_mp_list<Bindings> xBindings; - typedef T<rebind_placeholders_in_argument_t<U, xBindings>...> type; -}; - -template<class PrimitiveConcept, class Sig, class Bindings> -struct rebind_placeholders<vtable_adapter<PrimitiveConcept, Sig>, Bindings> -{ - typedef ::boost::type_erasure::detail::make_mp_list<Bindings> xBindings; - typedef vtable_adapter< - rebind_placeholders_t<PrimitiveConcept, xBindings>, - rebind_placeholders_in_argument_t<Sig, xBindings> - > type; -}; - -#else - -template<class T, class Bindings> -struct rebind_placeholders_in_argument -{ - BOOST_MPL_ASSERT((boost::mpl::or_< - ::boost::mpl::not_< ::boost::type_erasure::is_placeholder<T> >, - ::boost::mpl::has_key<Bindings, T> - >)); - typedef typename ::boost::mpl::eval_if< - ::boost::type_erasure::is_placeholder<T>, - ::boost::mpl::at<Bindings, T>, - ::boost::type_erasure::detail::identity<T> - >::type type; -}; - -template<class PrimitiveConcept, class Sig, class Bindings> -struct rebind_placeholders<vtable_adapter<PrimitiveConcept, Sig>, Bindings> -{ - typedef vtable_adapter< - typename rebind_placeholders<PrimitiveConcept, Bindings>::type, - typename rebind_placeholders_in_argument<Sig, Bindings>::type - > type; -}; - -template<class T, class Bindings> -struct rebind_placeholders_in_argument<T&, Bindings> -{ - typedef typename ::boost::type_erasure::detail::rebind_placeholders_in_argument< - T, - Bindings - >::type& type; -}; - -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES - -template<class T, class Bindings> -struct rebind_placeholders_in_argument<T&&, Bindings> -{ - typedef typename ::boost::type_erasure::detail::rebind_placeholders_in_argument< - T, - Bindings - >::type&& type; -}; - -#endif - -template<class T, class Bindings> -struct rebind_placeholders_in_argument<const T, Bindings> -{ - typedef const typename ::boost::type_erasure::detail::rebind_placeholders_in_argument< - T, - Bindings - >::type type; -}; - -template<class F, class Bindings> -struct rebind_placeholders_in_deduced -{ - typedef typename ::boost::type_erasure::deduced< - typename ::boost::type_erasure::detail::rebind_placeholders<F, Bindings>::type - >::type type; -}; - -template<class F, class Bindings> -struct rebind_placeholders_in_argument< - ::boost::type_erasure::deduced<F>, - Bindings -> -{ - typedef typename ::boost::mpl::eval_if< - ::boost::mpl::has_key<Bindings, ::boost::type_erasure::deduced<F> >, - ::boost::mpl::at<Bindings, ::boost::type_erasure::deduced<F> >, - ::boost::type_erasure::detail::rebind_placeholders_in_deduced< - F, - Bindings - > - >::type type; -}; - -#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) - -template<template<class...> class T, class... U, class Bindings> -struct rebind_placeholders<T<U...>, Bindings> -{ - typedef T<typename rebind_placeholders_in_argument<U, Bindings>::type...> type; -}; - -template<class R, class... T, class Bindings> -struct rebind_placeholders_in_argument<R(T...), Bindings> -{ - typedef typename ::boost::type_erasure::detail::rebind_placeholders_in_argument< - R, - Bindings - >::type type(typename rebind_placeholders_in_argument<T, Bindings>::type...); -}; - -template<class R, class C, class... T, class Bindings> -struct rebind_placeholders_in_argument<R (C::*)(T...), Bindings> -{ - typedef typename ::boost::type_erasure::detail::rebind_placeholders_in_argument< - R, - Bindings - >::type (rebind_placeholders_in_argument<C, Bindings>::type::*type) - (typename rebind_placeholders_in_argument<T, Bindings>::type...); -}; - -template<class R, class C, class... T, class Bindings> -struct rebind_placeholders_in_argument<R (C::*)(T...) const, Bindings> -{ - typedef typename ::boost::type_erasure::detail::rebind_placeholders_in_argument< - R, - Bindings - >::type (rebind_placeholders_in_argument<C, Bindings>::type::*type) - (typename rebind_placeholders_in_argument<T, Bindings>::type...) const; -}; - -#else - -#define BOOST_PP_FILENAME_1 <boost/type_erasure/detail/rebind_placeholders.hpp> -#define BOOST_PP_ITERATION_LIMITS (0, BOOST_TYPE_ERASURE_MAX_ARITY) -#include BOOST_PP_ITERATE() - -#endif - -#endif - -} -} -} - -#endif - -#else - -#define N BOOST_PP_ITERATION() -#define BOOST_TYPE_ERASURE_REBIND(z, n, data) \ - typename rebind_placeholders_in_argument<BOOST_PP_CAT(data, n), Bindings>::type - -#if N != 0 - -template<template<BOOST_PP_ENUM_PARAMS(N, class T)> class T, - BOOST_PP_ENUM_PARAMS(N, class T), class Bindings> -struct rebind_placeholders<T<BOOST_PP_ENUM_PARAMS(N, T)>, Bindings> -{ - typedef T<BOOST_PP_ENUM(N, BOOST_TYPE_ERASURE_REBIND, T)> type; -}; - -#endif - -template<class R - BOOST_PP_ENUM_TRAILING_PARAMS(N, class T), class Bindings> -struct rebind_placeholders_in_argument<R(BOOST_PP_ENUM_PARAMS(N, T)), Bindings> -{ - typedef typename ::boost::type_erasure::detail::rebind_placeholders_in_argument< - R, - Bindings - >::type type(BOOST_PP_ENUM(N, BOOST_TYPE_ERASURE_REBIND, T)); -}; - -#undef BOOST_TYPE_ERASURE_REBIND -#undef N - -#endif diff --git a/contrib/restricted/boost/type_erasure/include/boost/type_erasure/detail/storage.hpp b/contrib/restricted/boost/type_erasure/include/boost/type_erasure/detail/storage.hpp deleted file mode 100644 index 8e572871f3..0000000000 --- a/contrib/restricted/boost/type_erasure/include/boost/type_erasure/detail/storage.hpp +++ /dev/null @@ -1,91 +0,0 @@ -// Boost.TypeErasure library -// -// Copyright 2011 Steven Watanabe -// -// Distributed under the Boost Software License Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// $Id$ - -#ifndef BOOST_TYPE_ERASURE_DETAIL_STORAGE_HPP_INCLUDED -#define BOOST_TYPE_ERASURE_DETAIL_STORAGE_HPP_INCLUDED - -#include <boost/config.hpp> -#include <boost/type_traits/remove_reference.hpp> -#include <boost/type_traits/decay.hpp> - -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES -# include <utility> // for std::forward, std::move -#endif - -#ifdef BOOST_MSVC -#pragma warning(push) -#pragma warning(disable:4521) -#endif - -namespace boost { -namespace type_erasure { -namespace detail { - -struct storage -{ - storage() {} -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES - storage(storage& other) : data(other.data) {} - storage(const storage& other) : data(other.data) {} - storage(storage&& other) : data(other.data) {} - storage& operator=(const storage& other) { data = other.data; return *this; } - template<class T> - explicit storage(T&& arg) : data(new typename boost::decay<T>::type(std::forward<T>(arg))) {} -#else - template<class T> - explicit storage(const T& arg) : data(new typename boost::decay<T>::type(arg)) {} -#endif - void* data; -}; - - -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES - -template<class T> -T extract(T arg) { return std::forward<T>(arg); } - -#else - -template<class T> -T extract(T arg) { return arg; } - -#endif - -template<class T> -T extract(storage& arg) -{ - return *static_cast<typename ::boost::remove_reference<T>::type*>(arg.data); -} - -template<class T> -T extract(const storage& arg) -{ - return *static_cast<const typename ::boost::remove_reference<T>::type*>(arg.data); -} - -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES - -template<class T> -T extract(storage&& arg) -{ - return std::move(*static_cast<typename ::boost::remove_reference<T>::type*>(arg.data)); -} - -#endif - -} -} -} - -#ifdef BOOST_MSVC -#pragma warning(pop) -#endif - -#endif diff --git a/contrib/restricted/boost/type_erasure/include/boost/type_erasure/exception.hpp b/contrib/restricted/boost/type_erasure/include/boost/type_erasure/exception.hpp deleted file mode 100644 index 68fb23e12a..0000000000 --- a/contrib/restricted/boost/type_erasure/include/boost/type_erasure/exception.hpp +++ /dev/null @@ -1,41 +0,0 @@ -// Boost.TypeErasure library -// -// Copyright 2011-2012 Steven Watanabe -// -// Distributed under the Boost Software License Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// $Id$ - -#ifndef BOOST_TYPE_ERASURE_EXCEPTION_HPP_INCLUDED -#define BOOST_TYPE_ERASURE_EXCEPTION_HPP_INCLUDED - -#include <stdexcept> -#include <typeinfo> -#include <string> - -namespace boost { -namespace type_erasure { - -/** - * Exception thrown when the arguments to a primitive concept - * are incorrect. - * - * \see \call, \require_match - */ -class bad_function_call : public ::std::invalid_argument -{ -public: - bad_function_call() : ::std::invalid_argument("bad_function_call") {} -}; - -/** - * Exception thrown when an \any_cast to a reference or value fails. - */ -class bad_any_cast : public std::bad_cast {}; - -} -} - -#endif diff --git a/contrib/restricted/boost/type_erasure/include/boost/type_erasure/is_placeholder.hpp b/contrib/restricted/boost/type_erasure/include/boost/type_erasure/is_placeholder.hpp deleted file mode 100644 index a1e67fc165..0000000000 --- a/contrib/restricted/boost/type_erasure/include/boost/type_erasure/is_placeholder.hpp +++ /dev/null @@ -1,40 +0,0 @@ -// Boost.TypeErasure library -// -// Copyright 2011 Steven Watanabe -// -// Distributed under the Boost Software License Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// $Id$ - -#ifndef BOOST_TYPE_ERASURE_DETAIL_IS_PLACEHOLDER_HPP_INCLUDED -#define BOOST_TYPE_ERASURE_DETAIL_IS_PLACEHOLDER_HPP_INCLUDED - -#include <boost/mpl/bool.hpp> - -namespace boost { - -namespace type_erasure { - -#ifdef BOOST_TYPE_ERASURE_DOXYGEN - -/** A metafunction that indicates whether a type is a @ref placeholder. */ -template<class T> -struct is_placeholder {}; - -#else - -template<class T, class Enable = void> -struct is_placeholder : ::boost::mpl::false_ {}; - -template<class T> -struct is_placeholder<T, typename T::_boost_type_erasure_is_placeholder> : - ::boost::mpl::true_ {}; - -#endif - -} -} - -#endif diff --git a/contrib/restricted/boost/type_erasure/include/boost/type_erasure/param.hpp b/contrib/restricted/boost/type_erasure/include/boost/type_erasure/param.hpp deleted file mode 100644 index 7aca5e3c6b..0000000000 --- a/contrib/restricted/boost/type_erasure/include/boost/type_erasure/param.hpp +++ /dev/null @@ -1,307 +0,0 @@ -// Boost.TypeErasure library -// -// Copyright 2011 Steven Watanabe -// -// Distributed under the Boost Software License Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// $Id$ - -#ifndef BOOST_TYPE_ERASURE_PARAM_HPP_INCLUDED -#define BOOST_TYPE_ERASURE_PARAM_HPP_INCLUDED - -#include <boost/config.hpp> -#include <boost/utility/enable_if.hpp> -#include <boost/type_traits/is_same.hpp> -#include <boost/type_traits/add_const.hpp> -#include <boost/type_traits/remove_cv.hpp> -#include <boost/type_traits/remove_reference.hpp> -#include <boost/mpl/bool.hpp> -#include <boost/mpl/if.hpp> -#include <boost/type_erasure/detail/access.hpp> -#include <boost/type_erasure/detail/storage.hpp> -#include <boost/type_erasure/is_placeholder.hpp> -#include <boost/type_erasure/concept_of.hpp> - -namespace boost { -namespace type_erasure { - -#ifndef BOOST_TYPE_ERASURE_DOXYGEN - -template<class Concept, class T> -class any; - -template<class Concept> -class binding; - -#endif - -namespace detail { - -struct access; - -} - -namespace detail { - -template<class From, class To> -struct placeholder_conversion : boost::mpl::false_ {}; -template<class T> -struct placeholder_conversion<T, T> : boost::mpl::true_ {}; -template<class T> -struct placeholder_conversion<T, T&> : boost::mpl::true_ {}; -template<class T> -struct placeholder_conversion<T, const T&> : boost::mpl::true_ {}; -template<class T> -struct placeholder_conversion<const T, T> : boost::mpl::true_ {}; -template<class T> -struct placeholder_conversion<const T, const T&> : boost::mpl::true_ {}; -template<class T> -struct placeholder_conversion<T&, T> : boost::mpl::true_ {}; -template<class T> -struct placeholder_conversion<T&, T&> : boost::mpl::true_ {}; -template<class T> -struct placeholder_conversion<T&, const T&> : boost::mpl::true_ {}; -template<class T> -struct placeholder_conversion<const T&, T> : boost::mpl::true_ {}; -template<class T> -struct placeholder_conversion<const T&, const T&> : boost::mpl::true_ {}; - -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES -template<class T> -struct placeholder_conversion<T&&, T> : boost::mpl::true_ {}; -template<class T> -struct placeholder_conversion<T&&, const T&> : boost::mpl::true_ {}; -template<class T> -struct placeholder_conversion<T&&, T&&> : boost::mpl::true_ {}; -#endif - -} - -/** - * \brief A wrapper to help with overload resolution for functions - * operating on an @ref any. - * - * The template arguments are interpreted in - * the same way as @ref any. - * - * A parameter of type @ref param can be initialized - * with an @ref any that has the same @c Concept - * and base placeholder when there exists a corresponding - * standard conversion for the placeholder. - * A conversion sequence from @ref any "any<C, P>" to @ref param "param<C, P1>" is - * a better conversion sequence than @ref any "any<C, P>" to @ref param "param<C, P2>" - * iff the corresponding placeholder standard conversion - * sequence from P to P1 is a better conversion sequence than - * P to P2. - * - * \note Overloading based on cv-qualifiers and rvalue-ness is - * only supported in C++11. In C++03, all conversion sequences - * from @ref any to @ref param have the same rank. - * - * Example: - * - * \code - * void f(param<C, _a&>); - * void f(param<C, const _a&>); - * void g(param<C, const _a&>); - * void g(param<C, _a&&>); - * - * any<C, _a> a; - * f(any<C, _a>()); // calls void f(param<C, const _a&>); - * f(a); // calls void f(param<C, _a&>); (ambiguous in C++03) - * g(any<C, _a>()); // calls void g(param<C, _a&&>); (ambiguous in C++03) - * g(a); // calls void g(param<C, const _a&>); - * \endcode - * - */ -template<class Concept, class T> -class param { -public: - - friend struct boost::type_erasure::detail::access; - - /** INTERNAL ONLY */ - typedef void _boost_type_erasure_is_any; - /** INTERNAL ONLY */ - typedef param _boost_type_erasure_derived_type; - - template<class U> - param(any<Concept, U>& a -#ifndef BOOST_TYPE_ERASURE_DOXYGEN - , typename boost::enable_if< - ::boost::type_erasure::detail::placeholder_conversion<U, T> - >::type* = 0 -#endif - ) - : _impl(a) - {} - template<class U> - param(const any<Concept, U>& a -#ifndef BOOST_TYPE_ERASURE_DOXYGEN - , typename boost::enable_if< - ::boost::type_erasure::detail::placeholder_conversion< - typename ::boost::add_const<U>::type, - T - > - >::type* = 0 -#endif - ) - : _impl(a) - {} -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES - template<class U> - param(any<Concept, U>&& a -#ifndef BOOST_TYPE_ERASURE_DOXYGEN - , typename boost::enable_if< - ::boost::type_erasure::detail::placeholder_conversion< - U&&, - T - > - >::type* = 0 -#endif - ) - : _impl(std::move(a)) - {} -#endif - - /** INTERNAL ONLY */ - param(const ::boost::type_erasure::detail::storage& data, - const ::boost::type_erasure::binding<Concept>& table) - : _impl(data, table) - {} - - /** Returns the stored @ref any. */ - any<Concept, T> get() const { return _impl; } -private: - any<Concept, T> _impl; -}; - -#if !defined(BOOST_NO_CXX11_REF_QUALIFIERS) && !defined(BOOST_TYPE_ERASURE_DOXYGEN) - -template<class Concept, class T> -class param<Concept, const T&> { -public: - - friend struct boost::type_erasure::detail::access; - - /** INTERNAL ONLY */ - typedef void _boost_type_erasure_is_any; - /** INTERNAL ONLY */ - typedef param _boost_type_erasure_derived_type; - - param(const ::boost::type_erasure::detail::storage& data, - const ::boost::type_erasure::binding<Concept>& table) - : _impl(data, table) - {} - template<class U> - param(U& u, typename boost::enable_if< ::boost::is_same<U, const any<Concept, T> > >::type* = 0) : _impl(u) {} - any<Concept, const T&> get() const { return _impl; } -protected: - struct _impl_t { - _impl_t(const ::boost::type_erasure::detail::storage& data_, - const ::boost::type_erasure::binding<Concept>& table_) - : table(table_), data(data_) - {} - _impl_t(const any<Concept, T>& u) - : table(::boost::type_erasure::detail::access::table(u)), - data(::boost::type_erasure::detail::access::data(u)) - {} - // It's safe to capture the table by reference, because - // the user's argument should out-live us. storage is - // just a void*, so we don't need to add indirection. - const ::boost::type_erasure::binding<Concept>& table; - ::boost::type_erasure::detail::storage data; - } _impl; -}; - -template<class Concept, class T> -class param<Concept, T&> : public param<Concept, const T&> { -public: - - friend struct boost::type_erasure::detail::access; - - /** INTERNAL ONLY */ - typedef void _boost_type_erasure_is_any; - /** INTERNAL ONLY */ - typedef param _boost_type_erasure_derived_type; - - param(const ::boost::type_erasure::detail::storage& data, - const ::boost::type_erasure::binding<Concept>& table) - : param<Concept, const T&>(data, table) - {} - any<Concept, T&> get() const - { - return any<Concept, T&>( - ::boost::type_erasure::detail::access::data(this->_impl), - ::boost::type_erasure::detail::access::table(this->_impl)); - } -}; - -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES - -template<class Concept, class T> -class param<Concept, T&&> : public param<Concept, const T&> { -public: - - friend struct boost::type_erasure::detail::access; - - /** INTERNAL ONLY */ - typedef void _boost_type_erasure_is_any; - /** INTERNAL ONLY */ - typedef param _boost_type_erasure_derived_type; - - param(const ::boost::type_erasure::detail::storage& data, - const ::boost::type_erasure::binding<Concept>& table) - : param<Concept, const T&>(data, table) - {} - any<Concept, T&&> get() const - { - return any<Concept, T&&>( - ::boost::type_erasure::detail::access::data(this->_impl), - ::boost::type_erasure::detail::access::table(this->_impl)); - } -}; - -#endif - -#endif - -/** - * \brief Metafunction that creates a @ref param. - * - * If @c T is a (cv/reference qualified) placeholder, - * returns @ref param<@ref concept_of "concept_of<Any>::type", T>, - * otherwise, returns T. This metafunction is intended - * to be used for function arguments in specializations of - * @ref concept_interface. - * - * \see derived, rebind_any - */ -template<class Any, class T> -struct as_param { -#ifdef BOOST_TYPE_ERASURE_DOXYGEN - typedef detail::unspecified type; -#else - typedef typename ::boost::mpl::if_< - ::boost::type_erasure::is_placeholder< - typename ::boost::remove_cv< - typename ::boost::remove_reference<T>::type>::type>, - param<typename ::boost::type_erasure::concept_of<Any>::type, T>, - T - >::type type; -#endif -}; - -#ifndef BOOST_NO_CXX11_TEMPLATE_ALIASES - -template<class Any, class T> -using as_param_t = typename ::boost::type_erasure::as_param<Any, T>::type; - -#endif - -} -} - -#endif diff --git a/contrib/restricted/boost/type_erasure/include/boost/type_erasure/placeholder.hpp b/contrib/restricted/boost/type_erasure/include/boost/type_erasure/placeholder.hpp deleted file mode 100644 index 1311f03bae..0000000000 --- a/contrib/restricted/boost/type_erasure/include/boost/type_erasure/placeholder.hpp +++ /dev/null @@ -1,75 +0,0 @@ -// Boost.TypeErasure library -// -// Copyright 2011 Steven Watanabe -// -// Distributed under the Boost Software License Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// $Id$ - -#ifndef BOOST_TYPE_ERASURE_PLACEHOLDERS_HPP_INCLUDED -#define BOOST_TYPE_ERASURE_PLACEHOLDERS_HPP_INCLUDED - -namespace boost { -namespace type_erasure { - -/** - * Placeholders are used heavily throughout the library. - * Every placeholder must derive from @ref placeholder. - * The library provides a number of placeholders, - * out of the box, but you are welcome to define your own, - * if you want more descriptive names. The placeholder - * @ref _self is special in that it is used as the default - * wherever possible. - * - * What exactly is a placeholder? Placeholders act as - * a substitute for template parameters in concepts. - * The library automatically replaces all the placeholders - * used in a concept with the actual types involved when - * it stores an object in an @ref any. - * - * For example, in the following, - * - * @code - * any<copy_constructible<_a>, _a> x(1); - * @endcode - * - * The library sees that we're constructing an @ref any - * that uses the @ref _a placeholder with an @c int. - * Thus it binds @ref _a to int and instantiates - * @ref copy_constructible "copy_constructible<int>". - * - * When there are multiple placeholders involved, you - * will have to use @ref tuple, or pass the bindings - * explicitly, but the substitution still works the - * same way. - */ -struct placeholder { - /// INTERNAL ONLY - typedef void _boost_type_erasure_is_placeholder; -}; - -struct _a : placeholder {}; -struct _b : placeholder {}; -struct _c : placeholder {}; -struct _d : placeholder {}; -struct _e : placeholder {}; -struct _f : placeholder {}; -struct _g : placeholder {}; - -/** - * \brief The default placeholder - * - * @ref _self is the default @ref placeholder used - * by @ref any. It should be used as a default - * by most concepts, so using concepts with no - * explicit arguments will "just work" as much as - * possible. - */ -struct _self : placeholder {}; - -} -} - -#endif diff --git a/contrib/restricted/boost/type_erasure/include/boost/type_erasure/placeholder_of.hpp b/contrib/restricted/boost/type_erasure/include/boost/type_erasure/placeholder_of.hpp deleted file mode 100644 index 4a42b5744d..0000000000 --- a/contrib/restricted/boost/type_erasure/include/boost/type_erasure/placeholder_of.hpp +++ /dev/null @@ -1,69 +0,0 @@ -// Boost.TypeErasure library -// -// Copyright 2011 Steven Watanabe -// -// Distributed under the Boost Software License Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// $Id$ - -#ifndef BOOST_TYPE_ERASURE_PLACEHOLDER_OF_HPP_INCLUDED -#define BOOST_TYPE_ERASURE_PLACEHOLDER_OF_HPP_INCLUDED - -namespace boost { -namespace type_erasure { - -#ifndef BOOST_TYPE_ERASURE_DOXYGEN - -template<class Concept, class T> -class any; - -template<class Concept, class T> -class param; - -#endif - -/** - * A metafunction returning the (const/reference qualified) placeholder - * corresponding to an @ref any. It will also work for all bases - * of @ref any, so it can be applied to the @c Base - * parameter of @ref concept_interface. - */ -template<class T> -struct placeholder_of -{ -#ifdef BOOST_TYPE_ERASURE_DOXYGEN - typedef detail::unspecified type; -#else - typedef typename ::boost::type_erasure::placeholder_of< - typename T::_boost_type_erasure_derived_type - >::type type; -#endif -}; - -/** INTERNAL ONLY */ -template<class Concept, class T> -struct placeholder_of< ::boost::type_erasure::any<Concept, T> > -{ - typedef T type; -}; - -/** INTERNAL ONLY */ -template<class Concept, class T> -struct placeholder_of< ::boost::type_erasure::param<Concept, T> > -{ - typedef T type; -}; - -#ifndef BOOST_NO_CXX11_TEMPLATE_ALIASES - -template<class T> -using placeholder_of_t = typename ::boost::type_erasure::placeholder_of<T>::type; - -#endif - -} -} - -#endif diff --git a/contrib/restricted/boost/type_erasure/include/boost/type_erasure/rebind_any.hpp b/contrib/restricted/boost/type_erasure/include/boost/type_erasure/rebind_any.hpp deleted file mode 100644 index be62cff723..0000000000 --- a/contrib/restricted/boost/type_erasure/include/boost/type_erasure/rebind_any.hpp +++ /dev/null @@ -1,78 +0,0 @@ -// Boost.TypeErasure library -// -// Copyright 2011 Steven Watanabe -// -// Distributed under the Boost Software License Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// $Id$ - -#ifndef BOOST_TYPE_ERASURE_REBIND_ANY_HPP_INCLUDED -#define BOOST_TYPE_ERASURE_REBIND_ANY_HPP_INCLUDED - -#include <boost/mpl/if.hpp> -#include <boost/type_traits/remove_cv.hpp> -#include <boost/type_traits/remove_reference.hpp> -#include <boost/type_erasure/is_placeholder.hpp> -#include <boost/type_erasure/concept_of.hpp> - -namespace boost { -namespace type_erasure { - -#ifndef BOOST_TYPE_ERASURE_DOXYGEN -template<class Concept, class T> -class any; -#endif - -/** - * A metafunction that changes the @ref placeholder of - * an @ref any. If @c T is not a placeholder, - * returns @c T unchanged. This class is intended - * to be used in @ref concept_interface to deduce - * the argument types from the arguments of the concept. - * - * @pre Any must be a specialization of @ref any or a base - * class of such a specialization. - * - * \code - * rebind_any<any<Concept>, _a>::type -> any<Concept, _a> - * rebind_any<any<Concept>, _b&>::type -> any<Concept, _b&> - * rebind_any<any<Concept>, _c&&>::type -> any<Concept, _c&&> - * rebind_any<any<Concept>, int>::type -> int - * \endcode - * - * @see derived, as_param - */ -template<class Any, class T> -struct rebind_any -{ -#ifdef BOOST_TYPE_ERASURE_DOXYGEN - typedef detail::unspecified type; -#else - typedef typename ::boost::mpl::if_< - ::boost::type_erasure::is_placeholder< - typename ::boost::remove_cv< - typename ::boost::remove_reference<T>::type - >::type - >, - ::boost::type_erasure::any< - typename ::boost::type_erasure::concept_of<Any>::type, - T - >, - T - >::type type; -#endif -}; - -#ifndef BOOST_NO_CXX11_TEMPLATE_ALIASES - -template<class Any, class T> -using rebind_any_t = typename ::boost::type_erasure::rebind_any<Any, T>::type; - -#endif - -} -} - -#endif diff --git a/contrib/restricted/boost/type_erasure/include/boost/type_erasure/register_binding.hpp b/contrib/restricted/boost/type_erasure/include/boost/type_erasure/register_binding.hpp deleted file mode 100644 index b0489b3ef0..0000000000 --- a/contrib/restricted/boost/type_erasure/include/boost/type_erasure/register_binding.hpp +++ /dev/null @@ -1,181 +0,0 @@ -// Boost.TypeErasure library -// -// Copyright 2015 Steven Watanabe -// -// Distributed under the Boost Software License Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// $Id$ - -#ifndef BOOST_TYPE_ERASURE_REGISTER_BINDING_HPP_INCLUDED -#define BOOST_TYPE_ERASURE_REGISTER_BINDING_HPP_INCLUDED - -#include <boost/type_erasure/detail/check_map.hpp> -#include <boost/type_erasure/detail/get_placeholders.hpp> -#include <boost/type_erasure/detail/rebind_placeholders.hpp> -#include <boost/type_erasure/detail/normalize.hpp> -#include <boost/type_erasure/detail/adapt_to_vtable.hpp> -#include <boost/type_erasure/detail/auto_link.hpp> -#include <boost/type_erasure/static_binding.hpp> -#include <boost/mpl/transform.hpp> -#include <boost/mpl/remove_if.hpp> -#include <boost/mpl/fold.hpp> -#include <boost/mpl/at.hpp> -#include <boost/mpl/has_key.hpp> -#include <boost/mpl/insert.hpp> -#include <boost/mpl/front.hpp> -#include <boost/mpl/size.hpp> -#include <boost/mpl/equal_to.hpp> -#include <boost/mpl/or.hpp> -#include <boost/mpl/set.hpp> -#include <boost/mpl/map.hpp> -#include <boost/mpl/vector.hpp> -#include <boost/mpl/int.hpp> -#include <boost/mpl/bool.hpp> -#include <boost/mpl/pair.hpp> -#include <boost/mpl/back_inserter.hpp> -#include <boost/mpl/for_each.hpp> -#include <vector> -#include <typeinfo> - -namespace boost { -namespace type_erasure { -namespace detail { - -typedef std::vector<const std::type_info*> key_type; -typedef void (*value_type)(); -BOOST_TYPE_ERASURE_DECL void register_function_impl(const key_type& key, value_type fn); -BOOST_TYPE_ERASURE_DECL value_type lookup_function_impl(const key_type& key); - -template<class Map> -struct append_to_key_static { - append_to_key_static(key_type* k) : key(k) {} - template<class P> - void operator()(P) { -#ifndef BOOST_TYPE_ERASURE_USE_MP11 - key->push_back(&typeid(typename ::boost::mpl::at<Map, P>::type)); -#else - key->push_back(&typeid(::boost::mp11::mp_second< ::boost::mp11::mp_map_find<Map, P> >)); -#endif - } - key_type* key; -}; - -// This placeholder exists solely to create a normalized -// representation of a primitive concept. For the moment -// I'm going to be conservative and require a bijection -// between the original placeholders and the normalized -// placeholders. It should be safe to map everything -// to a single placeholder, though, as long as the -// key includes every instance of each placeholder -// as a separate element. i.e. we should be able to -// turn addable<_a, _b> into addable<_, _> and -// addable<_a, _a> into addable<_, _> as well if we always -// add typeids for both arguments to the search key. -template<int N> -struct _ : ::boost::type_erasure::placeholder {}; - -struct counting_map_appender -{ - template<class State, class Key> - struct apply - { - typedef typename ::boost::mpl::insert< - State, - ::boost::mpl::pair< - Key, - ::boost::type_erasure::detail::_< - ::boost::mpl::size<State>::value - > - > - >::type type; - }; -}; - -template<class Map> -struct register_function { - template<class F> - void operator()(F) { - key_type key; -#ifndef BOOST_TYPE_ERASURE_USE_MP11 - typedef typename ::boost::type_erasure::detail::get_placeholders<F, ::boost::mpl::set0<> >::type placeholders; -#else - typedef typename ::boost::type_erasure::detail::get_placeholders<F, ::boost::mp11::mp_list<> >::type placeholders; -#endif - typedef typename ::boost::mpl::fold< - placeholders, - ::boost::mpl::map0<>, - ::boost::type_erasure::detail::counting_map_appender - >::type placeholder_map; - key.push_back(&typeid(typename ::boost::type_erasure::detail::rebind_placeholders<F, placeholder_map>::type)); - ::boost::mpl::for_each<placeholders>(append_to_key_static<Map>(&key)); - value_type fn = reinterpret_cast<value_type>(&::boost::type_erasure::detail::rebind_placeholders<F, Map>::type::value); - ::boost::type_erasure::detail::register_function_impl(key, fn); - } -}; - -} - -/** - * Registers a model of a concept to allow downcasting @ref any - * via \dynamic_any_cast. - */ -template<class Concept, class Map> -void register_binding(const static_binding<Map>&) -{ - typedef typename ::boost::type_erasure::detail::normalize_concept< - Concept - >::type normalized; - typedef typename ::boost::mpl::transform<normalized, - ::boost::type_erasure::detail::maybe_adapt_to_vtable< ::boost::mpl::_1> - >::type actual_concept; - typedef typename ::boost::type_erasure::detail::get_placeholder_normalization_map< - Concept - >::type placeholder_subs; - typedef typename ::boost::type_erasure::detail::add_deductions<Map, placeholder_subs>::type actual_map; - ::boost::mpl::for_each<actual_concept>(::boost::type_erasure::detail::register_function<actual_map>()); -} - -/** - * \overload - */ -template<class Concept, class T> -void register_binding() -{ - // Find all placeholders - typedef typename ::boost::type_erasure::detail::normalize_concept_impl<Concept>::type normalized; - typedef typename normalized::first basic; - typedef typename ::boost::mpl::fold< - basic, -#ifndef BOOST_TYPE_ERASURE_USE_MP11 - ::boost::mpl::set0<>, -#else - ::boost::mp11::mp_list<>, -#endif - ::boost::type_erasure::detail::get_placeholders< ::boost::mpl::_2, ::boost::mpl::_1> - >::type all_placeholders; - // remove deduced placeholders - typedef typename ::boost::mpl::fold< - typename normalized::second, - ::boost::mpl::set0<>, - ::boost::mpl::insert< ::boost::mpl::_1, ::boost::mpl::second< ::boost::mpl::_2> > - >::type xtra_deduced; - typedef typename ::boost::mpl::remove_if< - all_placeholders, - ::boost::mpl::or_< - ::boost::type_erasure::detail::is_deduced< ::boost::mpl::_1>, - ::boost::mpl::has_key<xtra_deduced, ::boost::mpl::_1> - >, - ::boost::mpl::back_inserter< ::boost::mpl::vector0<> > - >::type unknown_placeholders; - // Bind the single remaining placeholder to T - BOOST_MPL_ASSERT((boost::mpl::equal_to<boost::mpl::size<unknown_placeholders>, boost::mpl::int_<1> >)); - register_binding<Concept>(::boost::type_erasure::make_binding< - ::boost::mpl::map< ::boost::mpl::pair<typename ::boost::mpl::front<unknown_placeholders>::type, T> > >()); -} - -} -} - -#endif diff --git a/contrib/restricted/boost/type_erasure/include/boost/type_erasure/relaxed.hpp b/contrib/restricted/boost/type_erasure/include/boost/type_erasure/relaxed.hpp deleted file mode 100644 index a9ada91df6..0000000000 --- a/contrib/restricted/boost/type_erasure/include/boost/type_erasure/relaxed.hpp +++ /dev/null @@ -1,91 +0,0 @@ -// Boost.TypeErasure library -// -// Copyright 2011 Steven Watanabe -// -// Distributed under the Boost Software License Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// $Id$ - -#ifndef BOOST_TYPE_ERASURE_RELAXED_HPP_INCLUDED -#define BOOST_TYPE_ERASURE_RELAXED_HPP_INCLUDED - -#include <boost/mpl/vector.hpp> -#include <boost/mpl/bool.hpp> -#include <boost/mpl/is_sequence.hpp> -#include <boost/mpl/find_if.hpp> -#include <boost/mpl/not.hpp> -#include <boost/mpl/end.hpp> -#include <boost/type_traits/is_same.hpp> - -namespace boost { -namespace type_erasure { - -template<class T> -struct is_relaxed; - -namespace detail { - -template<class T> -struct is_relaxed_impl : - ::boost::mpl::not_< - typename ::boost::is_same< - typename ::boost::mpl::find_if< - T, - ::boost::type_erasure::is_relaxed< ::boost::mpl::_1> - >::type, - typename ::boost::mpl::end<T>::type - >::type - >::type -{}; - -} - -/** - * This special concept enables various useful default behavior that - * makes @ref any act like an ordinary object. By default @ref any - * forwards all operations to the underlying type, and provides only - * the operations that are specified in its @c Concept. - * - * In detail, @ref relaxed enables the following: - * - A raw value can be assigned to an @ref any. This will replace - * the value stored by the @ref any. (But note that if @ref assignable - * is present, it takes priority.) - * - assignment of @ref any uses the constructor if it can't - * use @ref assignable (either because @ref assignable is missing, - * or because the stored types do not match). - * - default construction of @ref any is allowed and creates a null any. - * - @ref equality_comparable "equality_comparable": If the types do not - * match, it will return false. - * - @ref less_than_comparable "less_than_comparable": If the types do not - * match, the ordering will be according to - * @c std::type_info::before. - * - if the arguments to any other function do not match, it will throw - * a @ref bad_function_call exception instead of having undefined - * behavior. - */ -struct relaxed : ::boost::mpl::vector0<> {}; - -/** - * A metafunction indicating whether @c Concept - * includes @ref relaxed. - */ -template<class Concept> -struct is_relaxed : - ::boost::mpl::eval_if< ::boost::mpl::is_sequence<Concept>, - ::boost::type_erasure::detail::is_relaxed_impl<Concept>, - ::boost::mpl::false_ - >::type -{}; - -/** INTERNAL ONLY */ -template<> -struct is_relaxed< ::boost::type_erasure::relaxed> : - ::boost::mpl::true_ -{}; - -} -} - -#endif diff --git a/contrib/restricted/boost/type_erasure/include/boost/type_erasure/require_match.hpp b/contrib/restricted/boost/type_erasure/include/boost/type_erasure/require_match.hpp deleted file mode 100644 index 8da4c6b827..0000000000 --- a/contrib/restricted/boost/type_erasure/include/boost/type_erasure/require_match.hpp +++ /dev/null @@ -1,284 +0,0 @@ -// Boost.TypeErasure library -// -// Copyright 2011-2012 Steven Watanabe -// -// Distributed under the Boost Software License Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// $Id$ - -#if !defined(BOOST_PP_IS_ITERATING) - -#ifndef BOOST_TYPE_ERASURE_REQUIRE_MATCH_HPP_INCLUDED -#define BOOST_TYPE_ERASURE_REQUIRE_MATCH_HPP_INCLUDED - -#include <boost/throw_exception.hpp> -#include <boost/mpl/bool.hpp> -#include <boost/mpl/and.hpp> -#include <boost/type_traits/is_same.hpp> -#include <boost/preprocessor/cat.hpp> -#include <boost/preprocessor/facilities/intercept.hpp> -#include <boost/preprocessor/iteration/iterate.hpp> -#include <boost/preprocessor/repetition/repeat.hpp> -#include <boost/preprocessor/repetition/enum_params.hpp> -#include <boost/preprocessor/repetition/enum_trailing_params.hpp> -#include <boost/preprocessor/repetition/enum_trailing_binary_params.hpp> -#include <boost/type_erasure/detail/extract_concept.hpp> -#include <boost/type_erasure/relaxed.hpp> -#include <boost/type_erasure/check_match.hpp> -#include <boost/type_erasure/exception.hpp> - -namespace boost { -namespace type_erasure { - -#ifndef BOOST_TYPE_ERASURE_DOXYGEN -template<class Concept> -class binding; -#endif - -#ifdef BOOST_TYPE_ERASURE_DOXYGEN - -/** - * Checks that the actual types stored in all the @ref any - * arguments match the types specified by @c binding. If - * they do not match then, - * - If @ref relaxed is in @c Concept, throws @ref bad_function_call. - * - Otherwise the behavior is undefined. - * - * If @c binding is not specified, it will be deduced from - * the arguments. - * - * \post \call<code>(binding, f, args...)</code> is valid. - */ -template<class Concept, class Op, class... U> -void require_match(const binding<Concept>& binding_arg, const Op& f, U&&... args); - -/** - * \overload - */ -template<class Op, class... U> -void require_match(const Op& f, U&&... args); - -#else - -#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) - -namespace detail { - -template<class Concept, class Op, class... U> -void require_match_impl( - ::boost::mpl::true_, - const ::boost::type_erasure::binding<Concept>& table, - const Op& op, - U&&... arg) -{ - if(!::boost::type_erasure::check_match(table, op, std::forward<U>(arg)...)) { - BOOST_THROW_EXCEPTION(::boost::type_erasure::bad_function_call()); - } -} - -template<class Concept, class Op, class... U> -void require_match_impl( - ::boost::mpl::false_, - const ::boost::type_erasure::binding<Concept>&, - const Op&, - U&&...) -{} - -template<class Op, class... U> -void require_match_impl( - ::boost::mpl::true_, - const Op& op, - U&&... arg) -{ - if(!::boost::type_erasure::check_match(op, ::std::forward<U>(arg)...)) { - BOOST_THROW_EXCEPTION(::boost::type_erasure::bad_function_call()); - } -} - -template<class Op, class... U> -void require_match_impl( - ::boost::mpl::false_, - const Op&, - U&&...) -{} - -} - -template<class Concept, class Op, class... U> -void require_match( - const ::boost::type_erasure::binding<Concept>& table, - const Op& op, - U&&... arg) -{ - ::boost::type_erasure::is_relaxed<Concept> cond; - ::boost::type_erasure::detail::require_match_impl(cond, table, op, ::std::forward<U>(arg)...); -} - -#ifndef BOOST_TYPE_ERASURE_USE_MP11 - -template<class Op, class... U> -void require_match( - const Op& op, - U&&... arg) -{ - ::boost::type_erasure::is_relaxed< - typename ::boost::type_erasure::detail::extract_concept< - typename ::boost::type_erasure::detail::get_signature<Op>::type, - U...>::type - > cond; - ::boost::type_erasure::detail::require_match_impl(cond, op, ::std::forward<U>(arg)...); -} - -#else - -template<class Op, class... U> -void require_match( - const Op& op, - U&&... arg) -{ - ::boost::type_erasure::is_relaxed< - ::boost::type_erasure::detail::extract_concept_t< - ::boost::type_erasure::detail::get_args_t< - typename ::boost::type_erasure::detail::get_signature<Op>::type - >, - ::boost::mp11::mp_list< ::boost::remove_reference_t<U>...> > - > cond; - ::boost::type_erasure::detail::require_match_impl(cond, op, ::std::forward<U>(arg)...); -} - -#endif - -#else - -#define BOOST_PP_FILENAME_1 <boost/type_erasure/require_match.hpp> -#define BOOST_PP_ITERATION_LIMITS (0, BOOST_TYPE_ERASURE_MAX_ARITY) -#include BOOST_PP_ITERATE() - -#endif - -#endif - -} -} - -#endif - -#else - -#define N BOOST_PP_ITERATION() - -#ifdef BOOST_NO_CXX11_RVALUE_REFERENCES -#define RREF & -#define BOOST_TYPE_ERASURE_FORWARD_ARGS(N, X, x) BOOST_PP_ENUM_TRAILING_PARAMS(N, x) -#else -#define RREF && -#define BOOST_TYPE_ERASURE_FORWARD_ARGS_I(z, n, data) std::forward<BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM(2, 0, data), n)>(BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM(2, 1, data), n)) -#define BOOST_TYPE_ERASURE_FORWARD_ARGS(N, X, x) BOOST_PP_ENUM_TRAILING(N, BOOST_TYPE_ERASURE_FORWARD_ARGS_I, (X, x)) -#endif - -namespace detail { - -template< - class Concept, - class Op - BOOST_PP_ENUM_TRAILING_PARAMS(N, class U) -> -void require_match_impl( - ::boost::mpl::true_, - const ::boost::type_erasure::binding<Concept>& table, - const Op& op - BOOST_PP_ENUM_TRAILING_BINARY_PARAMS(N, U, RREF arg)) -{ - if(!::boost::type_erasure::check_match - (table, op BOOST_TYPE_ERASURE_FORWARD_ARGS(N, U, arg))) { - BOOST_THROW_EXCEPTION(::boost::type_erasure::bad_function_call()); - } -} - -template< - class Concept, - class Op - BOOST_PP_ENUM_TRAILING_PARAMS(N, class U) -> -void require_match_impl( - ::boost::mpl::false_, - const ::boost::type_erasure::binding<Concept>&, - const Op& - BOOST_PP_ENUM_TRAILING_BINARY_PARAMS(N, U, RREF BOOST_PP_INTERCEPT)) -{} - -#if N != 0 - -template< - class Op - BOOST_PP_ENUM_TRAILING_PARAMS(N, class U) -> -void require_match_impl( - ::boost::mpl::true_, - const Op& op - BOOST_PP_ENUM_TRAILING_BINARY_PARAMS(N, U, RREF arg)) -{ - if(!::boost::type_erasure::check_match - (op BOOST_TYPE_ERASURE_FORWARD_ARGS(N, U, arg))) { - BOOST_THROW_EXCEPTION(::boost::type_erasure::bad_function_call()); - } -} - -template< - class Op - BOOST_PP_ENUM_TRAILING_PARAMS(N, class U) -> -void require_match_impl( - ::boost::mpl::false_, - const Op& - BOOST_PP_ENUM_TRAILING_BINARY_PARAMS(N, U, RREF BOOST_PP_INTERCEPT)) -{} - -#endif - -} - -template< - class Concept, - class Op - BOOST_PP_ENUM_TRAILING_PARAMS(N, class U) -> -void require_match( - const ::boost::type_erasure::binding<Concept>& table, - const Op& op - BOOST_PP_ENUM_TRAILING_BINARY_PARAMS(N, U, RREF arg)) -{ - ::boost::type_erasure::is_relaxed<Concept> cond; - ::boost::type_erasure::detail::require_match_impl - (cond, table, op BOOST_TYPE_ERASURE_FORWARD_ARGS(N, U, arg)); -} - -#if N != 0 - -template< - class Op - BOOST_PP_ENUM_TRAILING_PARAMS(N, class U) -> -void require_match( - const Op& op - BOOST_PP_ENUM_TRAILING_BINARY_PARAMS(N, U, RREF arg)) -{ - ::boost::type_erasure::is_relaxed< - typename ::boost::type_erasure::detail::BOOST_PP_CAT(do_extract_concept, N)< - typename ::boost::type_erasure::detail::get_signature<Op>::type, - BOOST_PP_ENUM_PARAMS(N, U)>::type - > cond; - ::boost::type_erasure::detail::require_match_impl - (cond, op BOOST_TYPE_ERASURE_FORWARD_ARGS(N, U, arg)); -} - -#endif - -#undef RREF -#undef BOOST_TYPE_ERASURE_FORWARD_ARGS -#undef BOOST_TYPE_ERASURE_FORWARD_ARGS_I -#undef N - -#endif diff --git a/contrib/restricted/boost/type_erasure/include/boost/type_erasure/static_binding.hpp b/contrib/restricted/boost/type_erasure/include/boost/type_erasure/static_binding.hpp deleted file mode 100644 index 371ac62e4c..0000000000 --- a/contrib/restricted/boost/type_erasure/include/boost/type_erasure/static_binding.hpp +++ /dev/null @@ -1,36 +0,0 @@ -// Boost.TypeErasure library -// -// Copyright 2011 Steven Watanabe -// -// Distributed under the Boost Software License Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// $Id$ - -#ifndef BOOST_TYPE_ERASURE_STATIC_BINDING_HPP_INCLUDED -#define BOOST_TYPE_ERASURE_STATIC_BINDING_HPP_INCLUDED - -namespace boost { -namespace type_erasure { - -/** - * Represents a mapping from placeholders to the actual types - * that they bind to. - * - * \pre @c Map must be an MPL map whose keys are placeholders. - */ -template<class Map> -struct static_binding { typedef Map map_type; }; - -/** - * A convenience function to prevent constructor calls - * from being parsed as function declarations. - */ -template<class Map> -static_binding<Map> make_binding() { return static_binding<Map>(); } - -} -} - -#endif diff --git a/contrib/restricted/boost/type_erasure/src/dynamic_binding.cpp b/contrib/restricted/boost/type_erasure/src/dynamic_binding.cpp deleted file mode 100644 index 77c5909358..0000000000 --- a/contrib/restricted/boost/type_erasure/src/dynamic_binding.cpp +++ /dev/null @@ -1,57 +0,0 @@ -// Boost.TypeErasure library -// -// Copyright 2015 Steven Watanabe -// -// Distributed under the Boost Software License Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// $Id$ - -#define BOOST_TYPE_ERASURE_SOURCE - -#include <boost/type_erasure/register_binding.hpp> -#include <boost/thread/shared_mutex.hpp> -#include <boost/thread/lock_types.hpp> -#include <map> -#include <utility> - -namespace { - -using ::boost::type_erasure::detail::key_type; -using ::boost::type_erasure::detail::value_type; - -typedef ::std::map<key_type, void(*)()> map_type; -typedef ::boost::shared_mutex mutex_type; - -// std::pair can have problems on older implementations -// when it tries to use the copy constructor of the mutex. -struct data_type -{ - map_type first; - mutex_type second; -}; - -data_type * get_data() { - static data_type result; - return &result; -} - -} - -BOOST_TYPE_ERASURE_DECL void boost::type_erasure::detail::register_function_impl(const key_type& key, value_type fn) { - ::data_type * data = ::get_data(); - ::boost::unique_lock<mutex_type> lock(data->second); - data->first.insert(std::make_pair(key, fn)); -} - -BOOST_TYPE_ERASURE_DECL value_type boost::type_erasure::detail::lookup_function_impl(const key_type& key) { - ::data_type * data = ::get_data(); - ::boost::shared_lock<mutex_type> lock(data->second); - ::map_type::const_iterator pos = data->first.find(key); - if(pos != data->first.end()) { - return pos->second; - } else { - throw bad_any_cast(); - } -} diff --git a/contrib/restricted/boost/type_traits/include/boost/type_traits/alignment_traits.hpp b/contrib/restricted/boost/type_traits/include/boost/type_traits/alignment_traits.hpp deleted file mode 100644 index 2ed6934dad..0000000000 --- a/contrib/restricted/boost/type_traits/include/boost/type_traits/alignment_traits.hpp +++ /dev/null @@ -1,15 +0,0 @@ - -// (C) Copyright John Maddock 2000. -// Use, modification and distribution are subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt). -// -// See http://www.boost.org/libs/type_traits for most recent version including documentation. - -#ifndef BOOST_TT_ALIGNMENT_TRAITS_HPP_INCLUDED -#define BOOST_TT_ALIGNMENT_TRAITS_HPP_INCLUDED - -#include <boost/type_traits/alignment_of.hpp> -#include <boost/type_traits/type_with_alignment.hpp> - -#endif // BOOST_TT_ALIGNMENT_TRAITS_HPP_INCLUDED diff --git a/contrib/restricted/boost/type_traits/include/boost/type_traits/object_traits.hpp b/contrib/restricted/boost/type_traits/include/boost/type_traits/object_traits.hpp deleted file mode 100644 index c812a62e25..0000000000 --- a/contrib/restricted/boost/type_traits/include/boost/type_traits/object_traits.hpp +++ /dev/null @@ -1,33 +0,0 @@ -// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000. -// Use, modification and distribution are subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt). -// -// See http://www.boost.org/libs/type_traits for most recent version including documentation. -// -// defines object traits classes: -// is_object, is_scalar, is_class, is_compound, is_pod, -// has_trivial_constructor, has_trivial_copy, has_trivial_assign, -// has_trivial_destructor, is_empty. -// - -#ifndef BOOST_TT_OBJECT_TRAITS_HPP_INLCUDED -#define BOOST_TT_OBJECT_TRAITS_HPP_INLCUDED - -#include <boost/type_traits/has_trivial_assign.hpp> -#include <boost/type_traits/has_trivial_constructor.hpp> -#include <boost/type_traits/has_trivial_copy.hpp> -#include <boost/type_traits/has_trivial_destructor.hpp> -#include <boost/type_traits/has_nothrow_constructor.hpp> -#include <boost/type_traits/has_nothrow_copy.hpp> -#include <boost/type_traits/has_nothrow_assign.hpp> -#include <boost/type_traits/is_base_and_derived.hpp> -#include <boost/type_traits/is_class.hpp> -#include <boost/type_traits/is_compound.hpp> -#include <boost/type_traits/is_empty.hpp> -#include <boost/type_traits/is_object.hpp> -#include <boost/type_traits/is_pod.hpp> -#include <boost/type_traits/is_scalar.hpp> -#include <boost/type_traits/is_stateless.hpp> - -#endif // BOOST_TT_OBJECT_TRAITS_HPP_INLCUDED diff --git a/contrib/restricted/boost/type_traits/include/boost/type_traits/transform_traits.hpp b/contrib/restricted/boost/type_traits/include/boost/type_traits/transform_traits.hpp deleted file mode 100644 index 7a82f1ca91..0000000000 --- a/contrib/restricted/boost/type_traits/include/boost/type_traits/transform_traits.hpp +++ /dev/null @@ -1,21 +0,0 @@ -// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000. -// Use, modification and distribution are subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt). -// -// See http://www.boost.org/libs/type_traits for most recent version including documentation. -// -// defines traits classes for transforming one type to another: -// remove_reference, add_reference, remove_bounds, remove_pointer. -// - -#ifndef BOOST_TT_TRANSFORM_TRAITS_HPP_INCLUDED -#define BOOST_TT_TRANSFORM_TRAITS_HPP_INCLUDED - -#include <boost/type_traits/add_pointer.hpp> -#include <boost/type_traits/add_reference.hpp> -#include <boost/type_traits/remove_bounds.hpp> -#include <boost/type_traits/remove_pointer.hpp> -#include <boost/type_traits/remove_reference.hpp> - -#endif // BOOST_TT_TRANSFORM_TRAITS_HPP_INCLUDED diff --git a/contrib/restricted/boost/ublas/README.md b/contrib/restricted/boost/ublas/README.md deleted file mode 100644 index 66e2b271f2..0000000000 --- a/contrib/restricted/boost/ublas/README.md +++ /dev/null @@ -1,46 +0,0 @@ -Boost.uBLAS Linear Algebra Library -===== -Boost.uBLAS is part of the [Boost C++ Libraries](http://github.com/boostorg). It is directed towards scientific computing on the level of basic linear algebra constructions with matrices and vectors and their corresponding abstract operations. - - -## Documentation -uBLAS is documented at [boost.org](https://www.boost.org/doc/libs/1_69_0/libs/numeric/ublas/doc/index.html). -The development has a [wiki page](https://github.com/uBLAS/ublas/wiki). -The tensor extension has a separate [wiki page](https://github.com/BoostGSoC18/tensor/wiki). - -## License -Distributed under the [Boost Software License, Version 1.0](http://www.boost.org/LICENSE_1_0.txt). - -## Properties -* Header-only -* Tensor extension requires C++17 compatible compiler, compiles with - * gcc 7.3.0 - * clang 6.0 - * msvc 14.1 -* Unit-tests require Boost.Test - -## Build Status - -Branch | Travis | Appveyor | codecov.io | Docs | -:-------------: | ------ | -------- | ---------- | ---- | -[`master`](https://github.com/boostorg/ublas/tree/master) | [![Build Status](https://travis-ci.org/boostorg/ublas.svg?branch=master)](https://travis-ci.org/boostorg/ublas) | [![Build status](https://ci.appveyor.com/api/projects/status/ctu3wnfowa627ful/branch/master?svg=true)](https://ci.appveyor.com/project/stefanseefeld/ublas/branch/master) | [![codecov](https://codecov.io/gh/boostorg/ublas/branch/master/graph/badge.svg)](https://codecov.io/gh/boostorg/ublas/branch/master) | [![Documentation](https://img.shields.io/badge/docs-develop-brightgreen.svg)](http://www.boost.org/doc/libs/release/libs/numeric) -[`develop`](https://github.com/boostorg/ublas/tree/develop) | [![Build Status](https://travis-ci.org/boostorg/ublas.svg?branch=develop)](https://travis-ci.org/boostorg/ublas) | [![Build status](https://ci.appveyor.com/api/projects/status/ctu3wnfowa627ful/branch/develop?svg=true)](https://ci.appveyor.com/project/stefanseefeld/ublas/branch/develop) | [![codecov](https://codecov.io/gh/boostorg/ublas/branch/develop/graph/badge.svg)](https://codecov.io/gh/boostorg/ublas/branch/develop) | [![Documentation](https://img.shields.io/badge/docs-develop-brightgreen.svg)](http://www.boost.org/doc/libs/release/libs/numeric) - - -## Directories - -| Name | Purpose | -| ----------- | ------------------------------ | -| `doc` | documentation | -| `examples` | example files | -| `include` | headers | -| `test` | unit tests | -| `benchmarks`| timing and benchmarking | - -## More information - -* Ask questions in [stackoverflow](http://stackoverflow.com/questions/ask?tags=c%2B%2B,boost,boost-ublas) with `boost-ublas` or `ublas` tags. -* Report [bugs](https://github.com/boostorg/ublas/issues) and be sure to mention Boost version, platform and compiler you're using. A small compilable code sample to reproduce the problem is always good as well. -* Submit your patches as pull requests against **develop** branch. Note that by submitting patches you agree to license your modifications under the [Boost Software License, Version 1.0](http://www.boost.org/LICENSE_1_0.txt). -* Developer discussions about the library are held on the [Boost developers mailing list](https://lists.boost.org/mailman/listinfo.cgi/ublas). Be sure to read the [discussion policy](http://www.boost.org/community/policy.html) before posting and add the `[ublas]` tag at the beginning of the subject line -* For any other questions, you can contact David, Stefan or Cem: david.bellot-AT-gmail-DOT-com, cem.bassoy-AT-gmail-DOT-com stefan-AT-seefeld-DOT-name diff --git a/contrib/restricted/boost/units/README.md b/contrib/restricted/boost/units/README.md deleted file mode 100644 index 685cb464aa..0000000000 --- a/contrib/restricted/boost/units/README.md +++ /dev/null @@ -1,38 +0,0 @@ -Boost.Units -=========== - -Boost.Units, part of collection of the [Boost C++ Libraries](http://github.com/boostorg), -implements dimensional analysis in a general and extensible manner, -treating it as a generic compile-time metaprogramming problem. -With appropriate compiler optimization, no runtime execution cost is introduced, -facilitating the use of this library to provide dimension checking in performance-critical code. - -### Directories - -* **doc** - QuickBook documentation sources -* **example** - examples -* **images** - images for documention -* **include** - Interface headers -* **test** - unit tests -* **test_headers** - unit tests for self containment of headers -* **tutorial** - tutorial - -### Test results - -@ | Travis | AppVeyor ---------|-------------|--------- -master | [![Build Status](https://travis-ci.org/boostorg/units.svg?branch=master)](https://travis-ci.org/boostorg/units) | [![Build Status](https://ci.appveyor.com/api/projects/status/github/boostorg/units?branch=master&svg=true)](https://ci.appveyor.com/project/boostorg/units) -develop | [![Build Status](https://travis-ci.org/boostorg/units.svg)](https://travis-ci.org/boostorg/units) | [![Build Status](https://ci.appveyor.com/api/projects/status/github/boostorg/units?svg=true)](https://ci.appveyor.com/project/boostorg/units) - -<a href="https://scan.coverity.com/projects/boostorg-units"> - <img alt="Coverity Scan Build Status" - src="https://img.shields.io/coverity/scan/14037.svg"/> -</a> - -### More information - -* [Documentation](http://boost.org/libs/units) - -### License - -Distributed under the [Boost Software License, Version 1.0](http://www.boost.org/LICENSE_1_0.txt). diff --git a/contrib/restricted/boost/uuid/LICENSE b/contrib/restricted/boost/uuid/LICENSE deleted file mode 100644 index 36b7cd93cd..0000000000 --- a/contrib/restricted/boost/uuid/LICENSE +++ /dev/null @@ -1,23 +0,0 @@ -Boost Software License - Version 1.0 - August 17th, 2003 - -Permission is hereby granted, free of charge, to any person or organization -obtaining a copy of the software and accompanying documentation covered by -this license (the "Software") to use, reproduce, display, distribute, -execute, and transmit the Software, and to prepare derivative works of the -Software, and to permit third-parties to whom the Software is furnished to -do so, all subject to the following: - -The copyright notices in the Software and this entire statement, including -the above license grant, this restriction and the following disclaimer, -must be included in all copies of the Software, in whole or in part, and -all derivative works of the Software, unless such copies or derivative -works are solely in the form of machine-executable object code generated by -a source language processor. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT -SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE -FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. diff --git a/contrib/restricted/boost/uuid/README.md b/contrib/restricted/boost/uuid/README.md deleted file mode 100644 index e706fee38e..0000000000 --- a/contrib/restricted/boost/uuid/README.md +++ /dev/null @@ -1,61 +0,0 @@ -Uuid, part of collection of the [Boost C++ Libraries](http://github.com/boostorg), provides a C++ wrapper around [RFC-4122](http://www.ietf.org/rfc/rfc4122.txt) UUIDs. - -### License - -Distributed under the [Boost Software License, Version 1.0](https://www.boost.org/LICENSE_1_0.txt). - -### Properties - -* C++03 -* Header-only - -### Build Status - -Branch | GHA CI | Appveyor CI | Coverity Scan | codecov.io | Deps | Docs | Tests | -:-------------: | ------ | ----------- | ------------- | ---------- | ---- | ---- | ----- | -[`master`](https://github.com/boostorg/uuid/tree/master) | [![Build Status](https://github.com/boostorg/uuid/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/boostorg/uuid/actions?query=branch:master) | [![Build status](https://ci.appveyor.com/api/projects/status/nuihr6s92fjb9gwy/branch/master?svg=true)](https://ci.appveyor.com/project/jeking3/uuid-gaamf/branch/master) | [![Coverity Scan Build Status](https://scan.coverity.com/projects/13982/badge.svg)](https://scan.coverity.com/projects/boostorg-uuid) | [![codecov](https://codecov.io/gh/boostorg/uuid/branch/master/graph/badge.svg)](https://codecov.io/gh/boostorg/uuid/branch/master)| [![Deps](https://img.shields.io/badge/deps-master-brightgreen.svg)](https://pdimov.github.io/boostdep-report/master/uuid.html) | [![Documentation](https://img.shields.io/badge/docs-master-brightgreen.svg)](http://www.boost.org/doc/libs/master/doc/html/uuid.html) | [![Enter the Matrix](https://img.shields.io/badge/matrix-master-brightgreen.svg)](http://www.boost.org/development/tests/master/developer/uuid.html) -[`develop`](https://github.com/boostorg/uuid/tree/develop) | [![Build Status](https://github.com/boostorg/uuid/actions/workflows/ci.yml/badge.svg?branch=develop)](https://github.com/boostorg/uuid/actions?query=branch:develop) | [![Build status](https://ci.appveyor.com/api/projects/status/nuihr6s92fjb9gwy/branch/develop?svg=true)](https://ci.appveyor.com/project/jeking3/uuid-gaamf/branch/develop) | [![Coverity Scan Build Status](https://scan.coverity.com/projects/13982/badge.svg)](https://scan.coverity.com/projects/boostorg-uuid) | [![codecov](https://codecov.io/gh/boostorg/uuid/branch/develop/graph/badge.svg)](https://codecov.io/gh/boostorg/uuid/branch/develop) | [![Deps](https://img.shields.io/badge/deps-develop-brightgreen.svg)](https://pdimov.github.io/boostdep-report/develop/uuid.html) | [![Documentation](https://img.shields.io/badge/docs-develop-brightgreen.svg)](http://www.boost.org/doc/libs/develop/doc/html/uuid.html) | [![Enter the Matrix](https://img.shields.io/badge/matrix-develop-brightgreen.svg)](http://www.boost.org/development/tests/develop/developer/uuid.html) - -### Directories - -| Name | Purpose | -| ----------- | ------------------------------ | -| `doc` | documentation | -| `include` | headers | -| `test` | unit tests | - -### More information - -* [Ask questions](http://stackoverflow.com/questions/ask?tags=c%2B%2B,boost,boost-uuid) -* [Report bugs](https://github.com/boostorg/uuid/issues): Be sure to mention Boost version, platform and compiler you're using. A small compilable code sample to reproduce the problem is always good as well. -* Submit your patches as pull requests against **develop** branch. Note that by submitting patches you agree to license your modifications under the [Boost Software License, Version 1.0](https://www.boost.org/LICENSE_1_0.txt). -* Discussions about the library are held on the [Boost developers mailing list](http://www.boost.org/community/groups.html#main). Be sure to read the [discussion policy](http://www.boost.org/community/policy.html) before posting and add the `[uuid]` tag at the beginning of the subject line. - -### Code Example - UUID Generation - - // Copyright 2017 James E. King III - // Distributed under the Boost Software License, Version 1.0. - // (See https://www.boost.org/LICENSE_1_0.txt) - // mkuuid.cpp example - - #include <boost/lexical_cast.hpp> - #include <boost/uuid/random_generator.hpp> - #include <boost/uuid/uuid_io.hpp> - #include <iostream> - - int main(void) - { - boost::uuids::random_generator gen; - std::cout << boost::lexical_cast<std::string>(gen()) << std::endl; - return 0; - } - - ---- - - $ clang++ -ansi -Wall -Wextra -std=c++03 -O3 mkuuid.cpp -o mkuuid - $ ./mkuuid - 2c186eb0-89cf-4a3c-9b97-86db1670d5f4 - $ ./mkuuid - a9d3fbb9-0383-4389-a8a8-61f6629f90b6 - - diff --git a/contrib/restricted/boost/winapi/include/boost/winapi/file_management.hpp b/contrib/restricted/boost/winapi/include/boost/winapi/file_management.hpp deleted file mode 100644 index b4da8f8b7c..0000000000 --- a/contrib/restricted/boost/winapi/include/boost/winapi/file_management.hpp +++ /dev/null @@ -1,597 +0,0 @@ -/* - * Copyright 2010 Vicente J. Botet Escriba - * Copyright 2015 Andrey Semashev - * Copyright 2016 Jorge Lodos - * Copyright 2017 James E. King, III - * - * Distributed under the Boost Software License, Version 1.0. - * See http://www.boost.org/LICENSE_1_0.txt - */ - -#ifndef BOOST_WINAPI_FILE_MANAGEMENT_HPP_INCLUDED_ -#define BOOST_WINAPI_FILE_MANAGEMENT_HPP_INCLUDED_ - -#include <boost/winapi/basic_types.hpp> -#include <boost/winapi/limits.hpp> -#include <boost/winapi/time.hpp> -#include <boost/winapi/overlapped.hpp> -#include <boost/winapi/detail/header.hpp> - -#ifdef BOOST_HAS_PRAGMA_ONCE -#pragma once -#endif - -/* - * UWP: - * API SDK 8 SDK 10 _WIN32_WINNT - * AreFileApisANSI DESKTOP - DESKTOP | SYSTEM - * CreateFile DESKTOP - DESKTOP | SYSTEM - * DeleteFile APP - APP | SYSTEM - * FindClose APP - APP | SYSTEM - * FindFirstFile DESKTOP > APP | SYSTEM - * FindNextFile DESKTOP > APP | SYSTEM - * GetFileAttributes DESKTOP > APP | SYSTEM - * GetFileInformationByHandle DESKTOP - DESKTOP | SYSTEM - * GetFileSizeEx DESKTOP > APP | SYSTEM - * LockFile DESKTOP - DESKTOP | SYSTEM - * MoveFileEx APP - APP | SYSTEM - * ReadFile APP - APP | SYSTEM - * SetEndOfFile APP - APP | SYSTEM - * SetFilePointer DESKTOP > APP | SYSTEM - * SetFileValidData DESKTOP - DESKTOP | SYSTEM >= 0x0501 - * UnlockFile DESKTOP - DESKTOP | SYSTEM - * WriteFile APP - APP | SYSTEM - */ - -#if !defined( BOOST_USE_WINDOWS_H ) -extern "C" { - -#if BOOST_WINAPI_PARTITION_DESKTOP || BOOST_WINAPI_PARTITION_SYSTEM -#if !defined( BOOST_NO_ANSI_APIS ) -BOOST_WINAPI_IMPORT boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC -AreFileApisANSI(BOOST_WINAPI_DETAIL_VOID); - -BOOST_WINAPI_IMPORT boost::winapi::HANDLE_ BOOST_WINAPI_WINAPI_CC -CreateFileA( - boost::winapi::LPCSTR_ lpFileName, - boost::winapi::DWORD_ dwDesiredAccess, - boost::winapi::DWORD_ dwShareMode, - ::_SECURITY_ATTRIBUTES* lpSecurityAttributes, - boost::winapi::DWORD_ dwCreationDisposition, - boost::winapi::DWORD_ dwFlagsAndAttributes, - boost::winapi::HANDLE_ hTemplateFile); - -struct _WIN32_FIND_DATAA; -BOOST_WINAPI_IMPORT boost::winapi::HANDLE_ BOOST_WINAPI_WINAPI_CC -FindFirstFileA(boost::winapi::LPCSTR_ lpFileName, ::_WIN32_FIND_DATAA* lpFindFileData); - -BOOST_WINAPI_IMPORT boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC -FindNextFileA(boost::winapi::HANDLE_ hFindFile, ::_WIN32_FIND_DATAA* lpFindFileData); -#endif - -BOOST_WINAPI_IMPORT_EXCEPT_WM boost::winapi::HANDLE_ BOOST_WINAPI_WINAPI_CC -CreateFileW( - boost::winapi::LPCWSTR_ lpFileName, - boost::winapi::DWORD_ dwDesiredAccess, - boost::winapi::DWORD_ dwShareMode, - ::_SECURITY_ATTRIBUTES* lpSecurityAttributes, - boost::winapi::DWORD_ dwCreationDisposition, - boost::winapi::DWORD_ dwFlagsAndAttributes, - boost::winapi::HANDLE_ hTemplateFile); - -struct _WIN32_FIND_DATAW; -BOOST_WINAPI_IMPORT_EXCEPT_WM boost::winapi::HANDLE_ BOOST_WINAPI_WINAPI_CC -FindFirstFileW(boost::winapi::LPCWSTR_ lpFileName, ::_WIN32_FIND_DATAW* lpFindFileData); - -BOOST_WINAPI_IMPORT_EXCEPT_WM boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC -FindNextFileW(boost::winapi::HANDLE_ hFindFile, ::_WIN32_FIND_DATAW* lpFindFileData); - -struct _BY_HANDLE_FILE_INFORMATION; -BOOST_WINAPI_IMPORT_EXCEPT_WM boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC -GetFileInformationByHandle( - boost::winapi::HANDLE_ hFile, - ::_BY_HANDLE_FILE_INFORMATION* lpFileInformation); - -BOOST_WINAPI_IMPORT boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC -LockFile( - boost::winapi::HANDLE_ hFile, - boost::winapi::DWORD_ dwFileOffsetLow, - boost::winapi::DWORD_ dwFileOffsetHigh, - boost::winapi::DWORD_ nNumberOfBytesToLockLow, - boost::winapi::DWORD_ nNumberOfBytesToLockHigh); - -BOOST_WINAPI_IMPORT_EXCEPT_WM boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC -LockFileEx( - boost::winapi::HANDLE_ hFile, - boost::winapi::DWORD_ dwFlags, - boost::winapi::DWORD_ dwReserved, - boost::winapi::DWORD_ nNumberOfBytesToLockLow, - boost::winapi::DWORD_ nNumberOfBytesToLockHigh, - ::_OVERLAPPED* lpOverlapped); - -#if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WINXP -BOOST_WINAPI_IMPORT boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC -SetFileValidData( - boost::winapi::HANDLE_ hFile, - boost::winapi::LONGLONG_ ValidDataLength); -#endif - -BOOST_WINAPI_IMPORT boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC -UnlockFile( - boost::winapi::HANDLE_ hFile, - boost::winapi::DWORD_ dwFileOffsetLow, - boost::winapi::DWORD_ dwFileOffsetHigh, - boost::winapi::DWORD_ nNumberOfBytesToUnlockLow, - boost::winapi::DWORD_ nNumberOfBytesToUnlockHigh); - -BOOST_WINAPI_IMPORT_EXCEPT_WM boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC -UnlockFileEx( - boost::winapi::HANDLE_ hFile, - boost::winapi::DWORD_ dwReserved, - boost::winapi::DWORD_ nNumberOfBytesToUnlockLow, - boost::winapi::DWORD_ nNumberOfBytesToUnlockHigh, - ::_OVERLAPPED* lpOverlapped); -#endif - -#if BOOST_WINAPI_PARTITION_APP || BOOST_WINAPI_PARTITION_SYSTEM -#if !defined( BOOST_NO_ANSI_APIS ) -BOOST_WINAPI_IMPORT boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC -DeleteFileA(boost::winapi::LPCSTR_ lpFileName); - -BOOST_WINAPI_IMPORT boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC -MoveFileExA( - boost::winapi::LPCSTR_ lpExistingFileName, - boost::winapi::LPCSTR_ lpNewFileName, - boost::winapi::DWORD_ dwFlags); -#endif - -BOOST_WINAPI_IMPORT_EXCEPT_WM boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC -DeleteFileW(boost::winapi::LPCWSTR_ lpFileName); - -BOOST_WINAPI_IMPORT_EXCEPT_WM boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC -FindClose(boost::winapi::HANDLE_ hFindFile); - -BOOST_WINAPI_IMPORT boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC -MoveFileExW( - boost::winapi::LPCWSTR_ lpExistingFileName, - boost::winapi::LPCWSTR_ lpNewFileName, - boost::winapi::DWORD_ dwFlags); - -BOOST_WINAPI_IMPORT_EXCEPT_WM boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC -ReadFile( - boost::winapi::HANDLE_ hFile, - boost::winapi::LPVOID_ lpBuffer, - boost::winapi::DWORD_ nNumberOfBytesToRead, - boost::winapi::LPDWORD_ lpNumberOfBytesRead, - ::_OVERLAPPED* lpOverlapped); - -BOOST_WINAPI_IMPORT_EXCEPT_WM boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC -SetEndOfFile(boost::winapi::HANDLE_ hFile); - -BOOST_WINAPI_IMPORT_EXCEPT_WM boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC -WriteFile( - boost::winapi::HANDLE_ hFile, - boost::winapi::LPCVOID_ lpBuffer, - boost::winapi::DWORD_ nNumberOfBytesToWrite, - boost::winapi::LPDWORD_ lpNumberOfBytesWritten, - ::_OVERLAPPED* lpOverlapped); -#endif // BOOST_WINAPI_PARTITION_APP || BOOST_WINAPI_PARTITION_SYSTEM - -#if BOOST_WINAPI_PARTITION_APP_SYSTEM -#if !defined( BOOST_NO_ANSI_APIS ) -BOOST_WINAPI_IMPORT boost::winapi::DWORD_ BOOST_WINAPI_WINAPI_CC -GetFileAttributesA(boost::winapi::LPCSTR_ lpFileName); -#endif - -BOOST_WINAPI_IMPORT_EXCEPT_WM boost::winapi::DWORD_ BOOST_WINAPI_WINAPI_CC -GetFileAttributesW(boost::winapi::LPCWSTR_ lpFileName); - -BOOST_WINAPI_IMPORT boost::winapi::BOOL_ BOOST_WINAPI_WINAPI_CC -GetFileSizeEx(boost::winapi::HANDLE_ hFile, ::_LARGE_INTEGER* lpFileSize); - -BOOST_WINAPI_IMPORT_EXCEPT_WM boost::winapi::DWORD_ BOOST_WINAPI_WINAPI_CC -SetFilePointer( - boost::winapi::HANDLE_ hFile, - boost::winapi::LONG_ lpDistanceToMove, - boost::winapi::PLONG_ lpDistanceToMoveHigh, - boost::winapi::DWORD_ dwMoveMethod); -#endif // BOOST_WINAPI_PARTITION_APP_SYSTEM - -} // extern "C" -#endif // !defined(BOOST_USE_WINDOWS_H) - -namespace boost { -namespace winapi { - -#if defined( BOOST_USE_WINDOWS_H ) - -BOOST_CONSTEXPR_OR_CONST DWORD_ INVALID_FILE_SIZE_ = INVALID_FILE_SIZE; -BOOST_CONSTEXPR_OR_CONST DWORD_ INVALID_SET_FILE_POINTER_ = INVALID_SET_FILE_POINTER; -BOOST_CONSTEXPR_OR_CONST DWORD_ INVALID_FILE_ATTRIBUTES_ = INVALID_FILE_ATTRIBUTES; - -BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_ATTRIBUTE_READONLY_ = FILE_ATTRIBUTE_READONLY; -BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_ATTRIBUTE_HIDDEN_ = FILE_ATTRIBUTE_HIDDEN; -BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_ATTRIBUTE_SYSTEM_ = FILE_ATTRIBUTE_SYSTEM; -BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_ATTRIBUTE_DIRECTORY_ = FILE_ATTRIBUTE_DIRECTORY; -BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_ATTRIBUTE_ARCHIVE_ = FILE_ATTRIBUTE_ARCHIVE; -BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_ATTRIBUTE_DEVICE_ = FILE_ATTRIBUTE_DEVICE; -BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_ATTRIBUTE_NORMAL_ = FILE_ATTRIBUTE_NORMAL; -BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_ATTRIBUTE_TEMPORARY_ = FILE_ATTRIBUTE_TEMPORARY; -BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_ATTRIBUTE_SPARSE_FILE_ = FILE_ATTRIBUTE_SPARSE_FILE; -BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_ATTRIBUTE_REPARSE_POINT_ = FILE_ATTRIBUTE_REPARSE_POINT; -BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_ATTRIBUTE_COMPRESSED_ = FILE_ATTRIBUTE_COMPRESSED; -BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_ATTRIBUTE_OFFLINE_ = FILE_ATTRIBUTE_OFFLINE; -BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_ATTRIBUTE_NOT_CONTENT_INDEXED_ = FILE_ATTRIBUTE_NOT_CONTENT_INDEXED; -BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_ATTRIBUTE_ENCRYPTED_ = FILE_ATTRIBUTE_ENCRYPTED; - -BOOST_CONSTEXPR_OR_CONST DWORD_ CREATE_NEW_ = CREATE_NEW; -BOOST_CONSTEXPR_OR_CONST DWORD_ CREATE_ALWAYS_ = CREATE_ALWAYS; -BOOST_CONSTEXPR_OR_CONST DWORD_ OPEN_EXISTING_ = OPEN_EXISTING; -BOOST_CONSTEXPR_OR_CONST DWORD_ OPEN_ALWAYS_ = OPEN_ALWAYS; -BOOST_CONSTEXPR_OR_CONST DWORD_ TRUNCATE_EXISTING_ = TRUNCATE_EXISTING; - -BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_SHARE_READ_ = FILE_SHARE_READ; -BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_SHARE_WRITE_ = FILE_SHARE_WRITE; -BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_SHARE_DELETE_ = FILE_SHARE_DELETE; - -BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_BEGIN_ = FILE_BEGIN; -BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_CURRENT_ = FILE_CURRENT; -BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_END_ = FILE_END; - -#else // defined( BOOST_USE_WINDOWS_H ) - -BOOST_CONSTEXPR_OR_CONST DWORD_ INVALID_FILE_SIZE_ = ((DWORD_)0xFFFFFFFF); -BOOST_CONSTEXPR_OR_CONST DWORD_ INVALID_SET_FILE_POINTER_ = ((DWORD_)-1); -BOOST_CONSTEXPR_OR_CONST DWORD_ INVALID_FILE_ATTRIBUTES_ = ((DWORD_)-1); - -BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_ATTRIBUTE_READONLY_ = 0x00000001; -BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_ATTRIBUTE_HIDDEN_ = 0x00000002; -BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_ATTRIBUTE_SYSTEM_ = 0x00000004; -BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_ATTRIBUTE_DIRECTORY_ = 0x00000010; -BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_ATTRIBUTE_ARCHIVE_ = 0x00000020; -BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_ATTRIBUTE_DEVICE_ = 0x00000040; -BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_ATTRIBUTE_NORMAL_ = 0x00000080; -BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_ATTRIBUTE_TEMPORARY_ = 0x00000100; -BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_ATTRIBUTE_SPARSE_FILE_ = 0x00000200; -BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_ATTRIBUTE_REPARSE_POINT_ = 0x00000400; -BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_ATTRIBUTE_COMPRESSED_ = 0x00000800; -BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_ATTRIBUTE_OFFLINE_ = 0x00001000; -BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_ATTRIBUTE_NOT_CONTENT_INDEXED_ = 0x00002000; -BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_ATTRIBUTE_ENCRYPTED_ = 0x00004000; - -BOOST_CONSTEXPR_OR_CONST DWORD_ CREATE_NEW_ = 1; -BOOST_CONSTEXPR_OR_CONST DWORD_ CREATE_ALWAYS_ = 2; -BOOST_CONSTEXPR_OR_CONST DWORD_ OPEN_EXISTING_ = 3; -BOOST_CONSTEXPR_OR_CONST DWORD_ OPEN_ALWAYS_ = 4; -BOOST_CONSTEXPR_OR_CONST DWORD_ TRUNCATE_EXISTING_ = 5; - -BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_SHARE_READ_ = 0x00000001; -BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_SHARE_WRITE_ = 0x00000002; -BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_SHARE_DELETE_ = 0x00000004; - -BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_BEGIN_ = 0; -BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_CURRENT_ = 1; -BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_END_ = 2; - -#endif // defined( BOOST_USE_WINDOWS_H ) - -// Some of these constants are not defined by Windows SDK in MinGW or older MSVC -BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_FLAG_WRITE_THROUGH_ = 0x80000000; -BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_FLAG_OVERLAPPED_ = 0x40000000; -BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_FLAG_NO_BUFFERING_ = 0x20000000; -BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_FLAG_RANDOM_ACCESS_ = 0x10000000; -BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_FLAG_SEQUENTIAL_SCAN_ = 0x08000000; -BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_FLAG_DELETE_ON_CLOSE_ = 0x04000000; -BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_FLAG_BACKUP_SEMANTICS_ = 0x02000000; -BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_FLAG_POSIX_SEMANTICS_ = 0x01000000; -BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_FLAG_SESSION_AWARE_ = 0x00800000; -BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_FLAG_OPEN_REPARSE_POINT_ = 0x00200000; -BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_FLAG_OPEN_NO_RECALL_ = 0x00100000; -BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_FLAG_FIRST_PIPE_INSTANCE_ = 0x00080000; - -#if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN8 -BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_FLAG_OPEN_REQUIRING_OPLOCK_ = 0x00040000; -#endif - -// This constant is not defined in Windows SDK up until 6.0A -BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_ATTRIBUTE_VIRTUAL_ = 0x00010000; - -// These constants are not defined in Windows SDK up until 8.0 and MinGW/MinGW-w64 (as of 2016-02-14). -// They are documented to be supported only since Windows 8/Windows Server 2012 -// but defined unconditionally. -BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_ATTRIBUTE_INTEGRITY_STREAM_ = 0x00008000; -BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_ATTRIBUTE_NO_SCRUB_DATA_ = 0x00020000; -// Undocumented -BOOST_CONSTEXPR_OR_CONST DWORD_ FILE_ATTRIBUTE_EA_ = 0x00040000; - -#if BOOST_WINAPI_PARTITION_DESKTOP || BOOST_WINAPI_PARTITION_SYSTEM -#if !defined( BOOST_NO_ANSI_APIS ) -using ::AreFileApisANSI; - -BOOST_FORCEINLINE HANDLE_ CreateFileA( - LPCSTR_ lpFileName, - DWORD_ dwDesiredAccess, - DWORD_ dwShareMode, - SECURITY_ATTRIBUTES_* lpSecurityAttributes, - DWORD_ dwCreationDisposition, - DWORD_ dwFlagsAndAttributes, - HANDLE_ hTemplateFile) -{ - return ::CreateFileA( - lpFileName, - dwDesiredAccess, - dwShareMode, - reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(lpSecurityAttributes), - dwCreationDisposition, - dwFlagsAndAttributes, - hTemplateFile); -} - -BOOST_FORCEINLINE HANDLE_ create_file( - LPCSTR_ lpFileName, - DWORD_ dwDesiredAccess, - DWORD_ dwShareMode, - SECURITY_ATTRIBUTES_* lpSecurityAttributes, - DWORD_ dwCreationDisposition, - DWORD_ dwFlagsAndAttributes, - HANDLE_ hTemplateFile) -{ - return ::CreateFileA( - lpFileName, - dwDesiredAccess, - dwShareMode, - reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(lpSecurityAttributes), - dwCreationDisposition, - dwFlagsAndAttributes, - hTemplateFile); -} - -typedef struct BOOST_MAY_ALIAS _WIN32_FIND_DATAA { - DWORD_ dwFileAttributes; - FILETIME_ ftCreationTime; - FILETIME_ ftLastAccessTime; - FILETIME_ ftLastWriteTime; - DWORD_ nFileSizeHigh; - DWORD_ nFileSizeLow; - DWORD_ dwReserved0; - DWORD_ dwReserved1; - CHAR_ cFileName[MAX_PATH_]; - CHAR_ cAlternateFileName[14]; -#ifdef _MAC - DWORD_ dwFileType; - DWORD_ dwCreatorType; - WORD_ wFinderFlags; -#endif -} WIN32_FIND_DATAA_, *PWIN32_FIND_DATAA_, *LPWIN32_FIND_DATAA_; - -BOOST_FORCEINLINE HANDLE_ FindFirstFileA(LPCSTR_ lpFileName, WIN32_FIND_DATAA_* lpFindFileData) -{ - return ::FindFirstFileA(lpFileName, reinterpret_cast< ::_WIN32_FIND_DATAA* >(lpFindFileData)); -} - -BOOST_FORCEINLINE HANDLE_ find_first_file(LPCSTR_ lpFileName, WIN32_FIND_DATAA_* lpFindFileData) -{ - return ::FindFirstFileA(lpFileName, reinterpret_cast< ::_WIN32_FIND_DATAA* >(lpFindFileData)); -} - -BOOST_FORCEINLINE BOOL_ FindNextFileA(HANDLE_ hFindFile, WIN32_FIND_DATAA_* lpFindFileData) -{ - return ::FindNextFileA(hFindFile, reinterpret_cast< ::_WIN32_FIND_DATAA* >(lpFindFileData)); -} - -BOOST_FORCEINLINE BOOL_ find_next_file(HANDLE_ hFindFile, WIN32_FIND_DATAA_* lpFindFileData) -{ - return ::FindNextFileA(hFindFile, reinterpret_cast< ::_WIN32_FIND_DATAA* >(lpFindFileData)); -} - -#endif // !defined( BOOST_NO_ANSI_APIS ) - -BOOST_FORCEINLINE HANDLE_ CreateFileW( - LPCWSTR_ lpFileName, - DWORD_ dwDesiredAccess, - DWORD_ dwShareMode, - SECURITY_ATTRIBUTES_* lpSecurityAttributes, - DWORD_ dwCreationDisposition, - DWORD_ dwFlagsAndAttributes, - HANDLE_ hTemplateFile) -{ - return ::CreateFileW( - lpFileName, - dwDesiredAccess, - dwShareMode, - reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(lpSecurityAttributes), - dwCreationDisposition, - dwFlagsAndAttributes, - hTemplateFile); -} - -BOOST_FORCEINLINE HANDLE_ create_file( - LPCWSTR_ lpFileName, - DWORD_ dwDesiredAccess, - DWORD_ dwShareMode, - SECURITY_ATTRIBUTES_* lpSecurityAttributes, - DWORD_ dwCreationDisposition, - DWORD_ dwFlagsAndAttributes, - HANDLE_ hTemplateFile) -{ - return ::CreateFileW( - lpFileName, - dwDesiredAccess, - dwShareMode, - reinterpret_cast< ::_SECURITY_ATTRIBUTES* >(lpSecurityAttributes), - dwCreationDisposition, - dwFlagsAndAttributes, - hTemplateFile); -} - -typedef struct BOOST_MAY_ALIAS _WIN32_FIND_DATAW { - DWORD_ dwFileAttributes; - FILETIME_ ftCreationTime; - FILETIME_ ftLastAccessTime; - FILETIME_ ftLastWriteTime; - DWORD_ nFileSizeHigh; - DWORD_ nFileSizeLow; - DWORD_ dwReserved0; - DWORD_ dwReserved1; - WCHAR_ cFileName[MAX_PATH_]; - WCHAR_ cAlternateFileName[14]; -#ifdef _MAC - DWORD_ dwFileType; - DWORD_ dwCreatorType; - WORD_ wFinderFlags; -#endif -} WIN32_FIND_DATAW_, *PWIN32_FIND_DATAW_, *LPWIN32_FIND_DATAW_; - -typedef struct BOOST_MAY_ALIAS _BY_HANDLE_FILE_INFORMATION { - DWORD_ dwFileAttributes; - FILETIME_ ftCreationTime; - FILETIME_ ftLastAccessTime; - FILETIME_ ftLastWriteTime; - DWORD_ dwVolumeSerialNumber; - DWORD_ nFileSizeHigh; - DWORD_ nFileSizeLow; - DWORD_ nNumberOfLinks; - DWORD_ nFileIndexHigh; - DWORD_ nFileIndexLow; -} BY_HANDLE_FILE_INFORMATION_, *PBY_HANDLE_FILE_INFORMATION_, *LPBY_HANDLE_FILE_INFORMATION_; - -BOOST_FORCEINLINE HANDLE_ FindFirstFileW(LPCWSTR_ lpFileName, WIN32_FIND_DATAW_* lpFindFileData) -{ - return ::FindFirstFileW(lpFileName, reinterpret_cast< ::_WIN32_FIND_DATAW* >(lpFindFileData)); -} - -BOOST_FORCEINLINE HANDLE_ find_first_file(LPCWSTR_ lpFileName, WIN32_FIND_DATAW_* lpFindFileData) -{ - return ::FindFirstFileW(lpFileName, reinterpret_cast< ::_WIN32_FIND_DATAW* >(lpFindFileData)); -} - -BOOST_FORCEINLINE BOOL_ FindNextFileW(HANDLE_ hFindFile, WIN32_FIND_DATAW_* lpFindFileData) -{ - return ::FindNextFileW(hFindFile, reinterpret_cast< ::_WIN32_FIND_DATAW* >(lpFindFileData)); -} - -BOOST_FORCEINLINE BOOL_ find_next_file(HANDLE_ hFindFile, WIN32_FIND_DATAW_* lpFindFileData) -{ - return ::FindNextFileW(hFindFile, reinterpret_cast< ::_WIN32_FIND_DATAW* >(lpFindFileData)); -} - -BOOST_FORCEINLINE BOOL_ GetFileInformationByHandle(HANDLE_ h, BY_HANDLE_FILE_INFORMATION_* info) -{ - return ::GetFileInformationByHandle(h, reinterpret_cast< ::_BY_HANDLE_FILE_INFORMATION* >(info)); -} - -using ::LockFile; - -BOOST_FORCEINLINE BOOL_ LockFileEx( - HANDLE_ hFile, - DWORD_ dwFlags, - DWORD_ dwReserved, - DWORD_ nNumberOfBytesToLockLow, - DWORD_ nNumberOfBytesToLockHigh, - OVERLAPPED_* lpOverlapped) -{ - return ::LockFileEx(hFile, dwFlags, dwReserved, nNumberOfBytesToLockLow, nNumberOfBytesToLockHigh, reinterpret_cast< ::_OVERLAPPED* >(lpOverlapped)); -} - -#if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WINXP -using ::SetFileValidData; -#endif - -using ::UnlockFile; - -BOOST_FORCEINLINE BOOL_ UnlockFileEx( - HANDLE_ hFile, - DWORD_ dwReserved, - DWORD_ nNumberOfBytesToUnlockLow, - DWORD_ nNumberOfBytesToUnlockHigh, - OVERLAPPED_* lpOverlapped) -{ - return ::UnlockFileEx(hFile, dwReserved, nNumberOfBytesToUnlockLow, nNumberOfBytesToUnlockHigh, reinterpret_cast< ::_OVERLAPPED* >(lpOverlapped)); -} -#endif // BOOST_WINAPI_PARTITION_DESKTOP || BOOST_WINAPI_PARTITION_SYSTEM - -#if BOOST_WINAPI_PARTITION_APP || BOOST_WINAPI_PARTITION_SYSTEM -#if !defined( BOOST_NO_ANSI_APIS ) -using ::DeleteFileA; - -BOOST_FORCEINLINE BOOL_ delete_file(LPCSTR_ lpFileName) -{ - return ::DeleteFileA(lpFileName); -} - -using ::MoveFileExA; - -BOOST_FORCEINLINE BOOL_ move_file(LPCSTR_ lpExistingFileName, LPCSTR_ lpNewFileName, DWORD_ dwFlags) -{ - return ::MoveFileExA(lpExistingFileName, lpNewFileName, dwFlags); -} - -#endif -using ::DeleteFileW; - -BOOST_FORCEINLINE BOOL_ delete_file(LPCWSTR_ lpFileName) -{ - return ::DeleteFileW(lpFileName); -} - -using ::FindClose; -using ::MoveFileExW; - -BOOST_FORCEINLINE BOOL_ move_file(LPCWSTR_ lpExistingFileName, LPCWSTR_ lpNewFileName, DWORD_ dwFlags) -{ - return ::MoveFileExW(lpExistingFileName, lpNewFileName, dwFlags); -} - -BOOST_FORCEINLINE BOOL_ ReadFile( - HANDLE_ hFile, - LPVOID_ lpBuffer, - DWORD_ nNumberOfBytesToWrite, - LPDWORD_ lpNumberOfBytesWritten, - OVERLAPPED_* lpOverlapped) -{ - return ::ReadFile(hFile, lpBuffer, nNumberOfBytesToWrite, lpNumberOfBytesWritten, reinterpret_cast< ::_OVERLAPPED* >(lpOverlapped)); -} - -using ::SetEndOfFile; - -BOOST_FORCEINLINE BOOL_ WriteFile( - HANDLE_ hFile, - LPCVOID_ lpBuffer, - DWORD_ nNumberOfBytesToWrite, - LPDWORD_ lpNumberOfBytesWritten, - OVERLAPPED_* lpOverlapped) -{ - return ::WriteFile(hFile, lpBuffer, nNumberOfBytesToWrite, lpNumberOfBytesWritten, reinterpret_cast< ::_OVERLAPPED* >(lpOverlapped)); -} -#endif // BOOST_WINAPI_PARTITION_APP || BOOST_WINAPI_PARTITION_SYSTEM - -#if BOOST_WINAPI_PARTITION_APP_SYSTEM -#if !defined( BOOST_NO_ANSI_APIS ) -using ::GetFileAttributesA; - -BOOST_FORCEINLINE DWORD_ get_file_attributes(LPCSTR_ lpFileName) -{ - return ::GetFileAttributesA(lpFileName); -} -#endif -using ::GetFileAttributesW; - -BOOST_FORCEINLINE DWORD_ get_file_attributes(LPCWSTR_ lpFileName) -{ - return ::GetFileAttributesW(lpFileName); -} - -BOOST_FORCEINLINE BOOL_ GetFileSizeEx(HANDLE_ hFile, LARGE_INTEGER_* lpFileSize) -{ - return ::GetFileSizeEx(hFile, reinterpret_cast< ::_LARGE_INTEGER* >(lpFileSize)); -} - -using ::SetFilePointer; -#endif // BOOST_WINAPI_PARTITION_APP_SYSTEM - -} -} - -#include <boost/winapi/detail/footer.hpp> - -#endif // BOOST_WINAPI_FILE_MANAGEMENT_HPP_INCLUDED_ diff --git a/contrib/restricted/boost/winapi/include/boost/winapi/limits.hpp b/contrib/restricted/boost/winapi/include/boost/winapi/limits.hpp deleted file mode 100644 index 0a628d705f..0000000000 --- a/contrib/restricted/boost/winapi/include/boost/winapi/limits.hpp +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright 2016 Andrey Semashev - * - * Distributed under the Boost Software License, Version 1.0. - * See http://www.boost.org/LICENSE_1_0.txt - */ - -#ifndef BOOST_WINAPI_LIMITS_HPP_INCLUDED_ -#define BOOST_WINAPI_LIMITS_HPP_INCLUDED_ - -#include <boost/winapi/basic_types.hpp> -#include <boost/winapi/detail/header.hpp> - -#ifdef BOOST_HAS_PRAGMA_ONCE -#pragma once -#endif - -namespace boost { -namespace winapi { - -#if defined( BOOST_USE_WINDOWS_H ) - -BOOST_CONSTEXPR_OR_CONST DWORD_ MAX_PATH_ = MAX_PATH; - -#else - -BOOST_CONSTEXPR_OR_CONST DWORD_ MAX_PATH_ = 260; - -#endif - -#if defined( BOOST_USE_WINDOWS_H ) && !defined( BOOST_WINAPI_IS_MINGW ) - -BOOST_CONSTEXPR_OR_CONST DWORD_ UNICODE_STRING_MAX_BYTES_ = UNICODE_STRING_MAX_BYTES; -BOOST_CONSTEXPR_OR_CONST DWORD_ UNICODE_STRING_MAX_CHARS_ = UNICODE_STRING_MAX_CHARS; - -#else - -BOOST_CONSTEXPR_OR_CONST DWORD_ UNICODE_STRING_MAX_BYTES_ = 65534; -BOOST_CONSTEXPR_OR_CONST DWORD_ UNICODE_STRING_MAX_CHARS_ = 32767; - -#endif - -BOOST_CONSTEXPR_OR_CONST DWORD_ max_path = MAX_PATH_; -BOOST_CONSTEXPR_OR_CONST DWORD_ unicode_string_max_bytes = UNICODE_STRING_MAX_BYTES_; -BOOST_CONSTEXPR_OR_CONST DWORD_ unicode_string_max_chars = UNICODE_STRING_MAX_CHARS_; - -} -} - -#include <boost/winapi/detail/footer.hpp> - -#endif // BOOST_WINAPI_LIMITS_HPP_INCLUDED_ diff --git a/contrib/restricted/boost/winapi/include/boost/winapi/overlapped.hpp b/contrib/restricted/boost/winapi/include/boost/winapi/overlapped.hpp deleted file mode 100644 index 8027b356d4..0000000000 --- a/contrib/restricted/boost/winapi/include/boost/winapi/overlapped.hpp +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2016 Klemens D. Morgenstern - * - * Distributed under the Boost Software License, Version 1.0. - * See http://www.boost.org/LICENSE_1_0.txt - */ - -#ifndef BOOST_WINAPI_OVERLAPPED_HPP_INCLUDED_ -#define BOOST_WINAPI_OVERLAPPED_HPP_INCLUDED_ - -#include <boost/winapi/basic_types.hpp> -#include <boost/winapi/detail/header.hpp> - -#ifdef BOOST_HAS_PRAGMA_ONCE -#pragma once -#endif - -#if !defined( BOOST_USE_WINDOWS_H ) -extern "C" { -struct _OVERLAPPED; -} -#endif - -namespace boost { -namespace winapi { - -typedef struct BOOST_MAY_ALIAS _OVERLAPPED { - ULONG_PTR_ Internal; - ULONG_PTR_ InternalHigh; - union { - BOOST_WINAPI_DETAIL_EXTENSION struct { - DWORD_ Offset; - DWORD_ OffsetHigh; - }; - PVOID_ Pointer; - }; - HANDLE_ hEvent; -} OVERLAPPED_, *LPOVERLAPPED_; - -} // namespace winapi -} // namespace boost - -#include <boost/winapi/detail/footer.hpp> - -#endif // BOOST_WINAPI_OVERLAPPED_HPP_INCLUDED_ diff --git a/contrib/restricted/boost/winapi/include/boost/winapi/stack_backtrace.hpp b/contrib/restricted/boost/winapi/include/boost/winapi/stack_backtrace.hpp deleted file mode 100644 index e5e295a922..0000000000 --- a/contrib/restricted/boost/winapi/include/boost/winapi/stack_backtrace.hpp +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2017 Andrey Semashev - * - * Distributed under the Boost Software License, Version 1.0. - * See http://www.boost.org/LICENSE_1_0.txt - */ - -#ifndef BOOST_WINAPI_STACK_BACKTRACE_HPP_INCLUDED_ -#define BOOST_WINAPI_STACK_BACKTRACE_HPP_INCLUDED_ - -#include <boost/winapi/basic_types.hpp> -#include <boost/winapi/config.hpp> - -#ifdef BOOST_HAS_PRAGMA_ONCE -#pragma once -#endif - -// MinGW does not provide RtlCaptureStackBackTrace -#if !defined( BOOST_WINAPI_IS_MINGW ) - -// Note: RtlCaptureStackBackTrace is available in WinXP SP1 and later -#if (BOOST_USE_NTDDI_VERSION > BOOST_WINAPI_NTDDI_WINXP) - -#if BOOST_WINAPI_PARTITION_APP_SYSTEM - -#include <boost/winapi/detail/header.hpp> - -// Windows SDK shipped with MSVC 7.1 and 8 does not declare RtlCaptureStackBackTrace in headers but allows to link with it -#if !defined( BOOST_USE_WINDOWS_H ) || (defined(_MSC_VER) && (_MSC_VER+0) < 1500) -extern "C" { - -BOOST_WINAPI_IMPORT boost::winapi::WORD_ -BOOST_WINAPI_NTAPI_CC RtlCaptureStackBackTrace( - boost::winapi::DWORD_ FramesToSkip, - boost::winapi::DWORD_ FramesToCapture, - boost::winapi::PVOID_* BackTrace, - boost::winapi::PDWORD_ BackTraceHash); - -} // extern "C" -#endif - -namespace boost { -namespace winapi { - -using ::RtlCaptureStackBackTrace; - -} -} - -#include <boost/winapi/detail/footer.hpp> - -#endif // BOOST_WINAPI_PARTITION_APP_SYSTEM -#endif // (BOOST_USE_NTDDI_VERSION > BOOST_WINAPI_NTDDI_WINXP) -#endif // !defined( BOOST_WINAPI_IS_MINGW ) -#endif // BOOST_WINAPI_STACK_BACKTRACE_HPP_INCLUDED_ diff --git a/ydb/library/yql/udfs/common/clickhouse/client/CMakeLists.darwin.txt b/ydb/library/yql/udfs/common/clickhouse/client/CMakeLists.darwin.txt index 14c55c740c..c5cd106b65 100644 --- a/ydb/library/yql/udfs/common/clickhouse/client/CMakeLists.darwin.txt +++ b/ydb/library/yql/udfs/common/clickhouse/client/CMakeLists.darwin.txt @@ -20,7 +20,6 @@ target_link_libraries(clickhouse_client_udf INTERFACE yql-public-udf public-udf-support contrib-libs-cctz - contrib-restricted-boost restricted-boost-multi_index restricted-boost-program_options contrib-restricted-cityhash-1.0.2 @@ -80,7 +79,6 @@ target_link_libraries(clickhouse_client_udf.global PUBLIC yql-public-udf public-udf-support contrib-libs-cctz - contrib-restricted-boost restricted-boost-multi_index restricted-boost-program_options contrib-restricted-cityhash-1.0.2 diff --git a/ydb/library/yql/udfs/common/clickhouse/client/CMakeLists.linux-aarch64.txt b/ydb/library/yql/udfs/common/clickhouse/client/CMakeLists.linux-aarch64.txt index d37bd28ea7..32da8e4f54 100644 --- a/ydb/library/yql/udfs/common/clickhouse/client/CMakeLists.linux-aarch64.txt +++ b/ydb/library/yql/udfs/common/clickhouse/client/CMakeLists.linux-aarch64.txt @@ -21,7 +21,6 @@ target_link_libraries(clickhouse_client_udf INTERFACE yql-public-udf public-udf-support contrib-libs-cctz - contrib-restricted-boost restricted-boost-multi_index restricted-boost-program_options contrib-restricted-cityhash-1.0.2 @@ -82,7 +81,6 @@ target_link_libraries(clickhouse_client_udf.global PUBLIC yql-public-udf public-udf-support contrib-libs-cctz - contrib-restricted-boost restricted-boost-multi_index restricted-boost-program_options contrib-restricted-cityhash-1.0.2 diff --git a/ydb/library/yql/udfs/common/clickhouse/client/CMakeLists.linux.txt b/ydb/library/yql/udfs/common/clickhouse/client/CMakeLists.linux.txt index d37bd28ea7..32da8e4f54 100644 --- a/ydb/library/yql/udfs/common/clickhouse/client/CMakeLists.linux.txt +++ b/ydb/library/yql/udfs/common/clickhouse/client/CMakeLists.linux.txt @@ -21,7 +21,6 @@ target_link_libraries(clickhouse_client_udf INTERFACE yql-public-udf public-udf-support contrib-libs-cctz - contrib-restricted-boost restricted-boost-multi_index restricted-boost-program_options contrib-restricted-cityhash-1.0.2 @@ -82,7 +81,6 @@ target_link_libraries(clickhouse_client_udf.global PUBLIC yql-public-udf public-udf-support contrib-libs-cctz - contrib-restricted-boost restricted-boost-multi_index restricted-boost-program_options contrib-restricted-cityhash-1.0.2 |