universe@483: /* universe@483: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. universe@483: * universe@483: * Copyright 2021 Mike Becker, Olaf Wintermann All rights reserved. universe@483: * universe@483: * Redistribution and use in source and binary forms, with or without universe@483: * modification, are permitted provided that the following conditions are met: universe@483: * universe@483: * 1. Redistributions of source code must retain the above copyright universe@483: * notice, this list of conditions and the following disclaimer. universe@483: * universe@483: * 2. Redistributions in binary form must reproduce the above copyright universe@483: * notice, this list of conditions and the following disclaimer in the universe@483: * documentation and/or other materials provided with the distribution. universe@483: * universe@483: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" universe@483: * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE universe@483: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE universe@483: * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE universe@483: * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR universe@483: * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF universe@483: * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS universe@483: * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN universe@483: * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) universe@483: * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE universe@483: * POSSIBILITY OF SUCH DAMAGE. universe@483: */ universe@483: universe@483: /** universe@483: * \file common.h universe@483: * universe@483: * \brief Common definitions and feature checks. universe@483: * universe@483: * \author Mike Becker universe@483: * \author Olaf Wintermann universe@483: * \copyright 2-Clause BSD License universe@485: * universe@485: * \mainpage UAP Common Extensions universe@485: * Library with common and useful functions, macros and data structures. universe@485: *

universe@485: * Latest available source:
universe@485: * https://sourceforge.net/projects/ucx/files/ universe@485: *

universe@485: * universe@485: *

universe@485: * Repositories:
universe@485: * https://sourceforge.net/p/ucx/code universe@485: * - or - universe@485: * https://develop.uap-core.de/hg/ucx universe@485: *

universe@485: * universe@485: *

LICENCE

universe@485: * universe@485: * Copyright 2021 Mike Becker, Olaf Wintermann All rights reserved. universe@485: * universe@485: * Redistribution and use in source and binary forms, with or without universe@485: * modification, are permitted provided that the following conditions are met: universe@485: * universe@485: * 1. Redistributions of source code must retain the above copyright universe@485: * notice, this list of conditions and the following disclaimer. universe@485: * universe@485: * 2. Redistributions in binary form must reproduce the above copyright universe@485: * notice, this list of conditions and the following disclaimer in the universe@485: * documentation and/or other materials provided with the distribution. universe@485: * universe@485: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" universe@485: * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE universe@485: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE universe@485: * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE universe@485: * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR universe@485: * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF universe@485: * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS universe@485: * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN universe@485: * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) universe@485: * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE universe@485: * POSSIBILITY OF SUCH DAMAGE. universe@483: */ universe@483: universe@483: #ifndef UCX_COMMON_H universe@483: #define UCX_COMMON_H universe@483: universe@483: /** Major UCX version as integer constant. */ universe@483: #define UCX_VERSION_MAJOR 3 universe@483: universe@483: /** Minor UCX version as integer constant. */ universe@759: #define UCX_VERSION_MINOR 1 universe@483: universe@483: /** Version constant which ensures to increase monotonically. */ universe@483: #define UCX_VERSION (((UCX_VERSION_MAJOR)<<16)|UCX_VERSION_MINOR) universe@483: universe@682: // Common Includes universe@682: universe@484: #include universe@484: #include universe@487: #include universe@650: #include universe@682: #include universe@483: universe@766: #ifndef UCX_TEST_H universe@545: /** universe@545: * Function pointer compatible with fwrite-like functions. universe@545: */ universe@545: typedef size_t (*cx_write_func)( universe@545: void const *, universe@545: size_t, universe@545: size_t, universe@545: void * universe@545: ); universe@766: #endif // UCX_TEST_H universe@545: universe@674: /** universe@674: * Function pointer compatible with fread-like functions. universe@674: */ universe@674: typedef size_t (*cx_read_func)( universe@674: void *, universe@674: size_t, universe@674: size_t, universe@674: void * universe@674: ); universe@674: universe@651: universe@682: // Compiler specific stuff universe@483: universe@493: #ifndef __GNUC__ universe@503: /** universe@503: * Removes GNU C attributes where they are not supported. universe@503: */ universe@493: #define __attribute__(x) universe@493: #endif universe@493: universe@682: #ifdef _MSC_VER universe@682: universe@682: // fix missing ssize_t definition universe@682: #include universe@682: typedef SSIZE_T ssize_t; universe@682: universe@682: // fix missing _Thread_local support universe@682: #define _Thread_local __declspec(thread) universe@682: universe@682: #endif universe@682: universe@628: #endif // UCX_COMMON_H