| 1 | /* wctype_portable.h |
| 2 | * |
| 3 | * Copyright (C) 2024 Paul Boersma |
| 4 | * |
| 5 | * This code is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation; either version 2 of the License, or (at |
| 8 | * your option) any later version. |
| 9 | * |
| 10 | * This code is distributed in the hope that it will be useful, but |
| 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 13 | * See the GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this work. If not, see <http://www.gnu.org/licenses/>. |
| 17 | */ |
| 18 | |
| 19 | /* |
| 20 | The behaviour of several functions in `wctype.h` is locale-dependent. |
| 21 | Praat is international software in the sense that it should be able |
| 22 | to be used for exchange between researchers internationally. |
| 23 | This means that its behaviour should not depend on localized settings. |
| 24 | We therefore replace the `wctype.h` functions by fixed international ones, |
| 25 | making use of the Unicode Character Database, |
| 26 | with a fixed interpretation of the semantics of Unicode and scripts. |
| 27 | Any divergences will have to be expressed explicitly. |
| 28 | */ |
| 29 | |
| 30 | #include <wchar.h> |
| 31 | |
| 32 | #ifdef __cplusplus |
| 33 | extern "C" |
| 34 | { |
| 35 | #endif |
| 36 | |
| 37 | int iswalpha_portable (wint_t wc); // implemented by Melder_isLetter() |
| 38 | int iswalnum_portable (wint_t wc); // implemented by Melder_isAlphanumeric() |
| 39 | int iswpunct_portable (wint_t wc); // implemented by Melder_isPunctuationOrSymbol() |
| 40 | int iswdigit_portable (wint_t wc); // implemented by Melder_isDecimalNumber() |
| 41 | int iswspace_portable (wint_t wc); // implemented by Melder_isHorizontalOrVerticalSpace() |
| 42 | int iswlower_portable (wint_t wc); // implemented by Melder_isLowerCaseLetter() |
| 43 | int iswupper_portable (wint_t wc); // implemented by Melder_isUpperCaseLetter() |
| 44 | |
| 45 | #ifndef linux |
| 46 | // on Linux this is unfortunately not possible, because of "::iswalpha" |
| 47 | #define iswalpha DONT_USE_ISWALPHA |
| 48 | #define iswalnum DONT_USE_ISWALNUM |
| 49 | #define iswpunct DONT_USE_ISWPUNCT |
| 50 | #define iswdigit DONT_USE_ISWDIGIT |
| 51 | #define iswspace DONT_USE_ISWSPACE |
| 52 | #define iswlower DONT_USE_ISWLOWER |
| 53 | #define iswupper DONT_USE_ISWUPPER |
| 54 | #endif |
| 55 | |
| 56 | #ifdef __cplusplus |
| 57 | } |
| 58 | #endif |
| 59 | |
| 60 | /* End of file wctype_portable.h */ |