| 1 | /* melder.cpp |
| 2 | * |
| 3 | * Copyright (C) 1992-2018,2020,2021,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 | #include "melder.h"cxx . . $ `<file>/melder/melder.h`/ |
| 20 | |
| 21 | #include "enums_getText.h"cxx . . $ `<file>/melder/enums_getText.h`/ |
| 22 | #include "melder_enums.h"cxx . . $ `<file>/melder/melder_enums.h`/ |
| 23 | #include "enums_getValue.h"cxx . . $ `<file>/melder/enums_getValue.h`/ |
| 24 | #include "melder_enums.h"cxx . . $ `<file>/melder/melder_enums.h`/ |
| 25 | |
| 26 | #include "../dwsys/NUMmachar.h"cxx . . $ `<file>/dwsys/NUMmachar.h`/ |
| 27 | #include "../external/gsl/gsl_errno.h"cxx . . $ `<file>/external/gsl/gsl_errno.h`/ |
| 28 | #ifdef macintosh |
| 29 | #include <Carbon/Carbon.h> // Gestalt |
| 30 | #endif |
| 31 | |
| 32 | void Melder_initcxx . . $ Melder_init(49f6e7a06ebc5aa8). () { |
| 33 | NUMmacharcxx . . $ NUMmachar(49f6e7a06ebc5aa8). (); |
| 34 | gsl_set_error_handler_off (); |
| 35 | NUMrandom_initializeSafelyAndUnpredictablycxx . . $ NUMrandom_initializeSafelyAndUnpredictably(49f6e7a06ebc5aa8). (); |
| 36 | Melder_alloc_initcxx . . $ Melder_alloc_init(49f6e7a06ebc5aa8). (); |
| 37 | Melder_audiofiles_initcxx . . $ Melder_audiofiles_init(49f6e7a06ebc5aa8). (); |
| 38 | #ifdef macintosh |
| 39 | NSOperatingSystemVersion version = [[NSProcessInfo processInfo] operatingSystemVersion]; |
| 40 | Melder_systemVersion = version. majorVersion * 10000 + version. minorVersion * 100 + version. patchVersion; |
| 41 | #endif |
| 42 | #ifdef linuxcxx . . $ `<built-in>:480:9`! |
| 43 | const char *gdkBackend = getenvcxx . . $ getenv(c63359b659779399). ("GDK_BACKEND"); // this setting rules all the others; GDK typically supports wayland, x11, and broadway |
| 44 | if (gdkBackend) { |
| 45 | if (strequcxx . . $ `melder/melder_string32.h:69:9`! (gdkBackend, "wayland")) |
| 46 | Melder_systemVersioncxx . . $ Melder_systemVersion. = 'w'; |
| 47 | else |
| 48 | Melder_systemVersioncxx . . $ Melder_systemVersion. = 0; |
| 49 | } else { |
| 50 | const char *waylandDisplay = getenvcxx . . $ getenv(c63359b659779399). ("WAYLAND_DISPLAY"); |
| 51 | const char *gdkSessionType = getenvcxx . . $ getenv(c63359b659779399). ("XDG_SESSION_TYPE"); // not set on Chrome (2021-11-12); typical values are wayland, x11 and tty |
| 52 | if (waylandDisplay || gdkSessionType && strstr (gdkSessionType, "wayland")) |
| 53 | Melder_systemVersioncxx . . $ Melder_systemVersion. = 'w'; |
| 54 | else |
| 55 | Melder_systemVersioncxx . . $ Melder_systemVersion. = 0; |
| 56 | } |
| 57 | #endif |
| 58 | } |
| 59 | |
| 60 | /* End of file melder.cpp */ |