| 1 | /* Elementary types and macros for the GNU UniString library. |
| 2 | Copyright (C) 2002, 2005-2006, 2009-2024 Free Software Foundation, Inc. |
| 3 | |
| 4 | This file is free software: you can redistribute it and/or modify |
| 5 | it under the terms of the GNU Lesser General Public License as |
| 6 | published by the Free Software Foundation; either version 2.1 of the |
| 7 | License, or (at your option) any later version. |
| 8 | |
| 9 | This file is distributed in the hope that it will be useful, |
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | GNU Lesser General Public License for more details. |
| 13 | |
| 14 | You should have received a copy of the GNU Lesser General Public License |
| 15 | along with this program. If not, see <https://www.gnu.org/licenses/>. */ |
| 16 | |
| 17 | #ifndef _UNITYPES_H |
| 18 | #define _UNITYPES_H |
| 19 | |
| 20 | /* Get uint8_t, uint16_t, uint32_t. */ |
| 21 | #include <stdint.h> |
| 22 | |
| 23 | #ifdef __cplusplus |
| 24 | extern "C" { |
| 25 | #endif |
| 26 | |
| 27 | |
| 28 | /* Type representing a Unicode character. */ |
| 29 | typedef uint32_t ucs4_t; |
| 30 | |
| 31 | /* Attribute of a function whose result depends only on the arguments |
| 32 | (not pointers!) and which has no side effects. */ |
| 33 | #ifndef _UC_ATTRIBUTE_CONST |
| 34 | # if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) || defined __clang__ |
| 35 | # define _UC_ATTRIBUTE_CONST __attribute__ ((__const__)) |
| 36 | # else |
| 37 | # define _UC_ATTRIBUTE_CONST |
| 38 | # endif |
| 39 | #endif |
| 40 | |
| 41 | /* Attribute of a function whose result depends only on the arguments |
| 42 | (possibly pointers) and global memory, and which has no side effects. */ |
| 43 | #ifndef _UC_ATTRIBUTE_PURE |
| 44 | # if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || defined __clang__ |
| 45 | # define _UC_ATTRIBUTE_PURE __attribute__ ((__pure__)) |
| 46 | # else |
| 47 | # define _UC_ATTRIBUTE_PURE |
| 48 | # endif |
| 49 | #endif |
| 50 | |
| 51 | /* Qualifier in a function declaration, that asserts that the caller must |
| 52 | pass a pointer to a different object in the specified pointer argument |
| 53 | than in the other pointer arguments. */ |
| 54 | #ifndef _UC_RESTRICT |
| 55 | # if defined __restrict \ |
| 56 | || 2 < __GNUC__ + (95 <= __GNUC_MINOR__) \ |
| 57 | || __clang_major__ >= 3 |
| 58 | # define _UC_RESTRICT __restrict |
| 59 | # elif 199901L <= __STDC_VERSION__ || defined restrict |
| 60 | # define _UC_RESTRICT restrict |
| 61 | # else |
| 62 | # define _UC_RESTRICT |
| 63 | # endif |
| 64 | #endif |
| 65 | |
| 66 | |
| 67 | #ifdef __cplusplus |
| 68 | } |
| 69 | #endif |
| 70 | |
| 71 | #endif /* _UNITYPES_H */ |