| 1 | /* main_Praat.cpp |
| 2 | * |
| 3 | * Copyright (C) 1992-2008,2010-2021,2023-2026 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 3 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 "../sys/praat.h" |
| 20 | #include "main_Praat.h" |
| 21 | |
| 22 | static void logo (Graphics graphics) { |
| 23 | Graphics_setWindow (graphics, 0.0, 1.0, 0.0, 1.0); |
| 24 | Graphics_setGrey (graphics, 0.95); |
| 25 | Graphics_fillRectangle (graphics, 0.0, 1.0, 0.0, 1.0); |
| 26 | Graphics_setTextAlignment (graphics, Graphics_CENTRE, Graphics_HALF); |
| 27 | Graphics_setFont (graphics, kGraphics_font::TIMES); |
| 28 | Graphics_setFontSize (graphics, 45.0); |
| 29 | Graphics_setColour (graphics, Melder_MAROON); |
| 30 | Graphics_text (graphics, 0.385, 0.89, U"P"); |
| 31 | Graphics_text (graphics, 0.448, 0.89, U"\\s{R}"); |
| 32 | Graphics_text (graphics, 0.510, 0.89, U"\\s{A}"); |
| 33 | Graphics_text (graphics, 0.575, 0.89, U"\\s{A}"); |
| 34 | Graphics_text (graphics, 0.628, 0.89, U"\\s{T}"); |
| 35 | Graphics_setFontSize (graphics, 18.0); |
| 36 | Graphics_text (graphics, 0.5, 0.77, U"%%doing phonetics by computer"); |
| 37 | Graphics_setFontSize (graphics, 14.0); |
| 38 | Graphics_text (graphics, 0.5, 0.62, Melder_cat (U"version ", Melder_appVersionSTR(), |
| 39 | U" (", Melder_appDay(), U" ", Melder_appMonthSTR(), U" ", Melder_appYear(), U")")); |
| 40 | Graphics_setFontSize (graphics, 12.0); |
| 41 | [[maybe_unused]] constexpr bool isArm64 = |
| 42 | #if defined (__aarch64__) || defined (_M_ARM64_) |
| 43 | true; |
| 44 | #else |
| 45 | false; |
| 46 | #endif |
| 47 | [[maybe_unused]] constexpr int x64_version = |
| 48 | #if defined (__AVX2__) && defined (__FMA__) && defined (__F16C__) |
| 49 | 3; |
| 50 | #else |
| 51 | 1; |
| 52 | #endif |
| 53 | const conststring32 builtFor = |
| 54 | #if defined (macintosh) |
| 55 | isArm64 ? U"ARM64 macOS" : U"Intel64 macOS"; |
| 56 | #elif defined (_WIN32) |
| 57 | isArm64 ? U"ARM64 Windows" : |
| 58 | sizeof (void *) == 4 ? U"Intel32 Windows" : |
| 59 | x64_version == 3 ? U"x64(v3) Windows" : |
| 60 | U"x64(v1) Windows"; |
| 61 | #elif defined (__s390x__) |
| 62 | U"s390x Linux"; |
| 63 | #elif defined (raspberrypi) |
| 64 | U"ARMV7 Raspberry Pi"; |
| 65 | #elif defined (chrome) |
| 66 | isArm64 ? U"ARM64 Chromebook" : |
| 67 | x64_version == 3 ? U"x64(v3) Chromebook" : |
| 68 | U"x64(v1) Chromebook"; |
| 69 | #elif defined (linux) |
| 70 | isArm64 ? U"ARM64 Linux" : |
| 71 | x64_version == 3 ? U"x64(v3) Linux" : |
| 72 | U"x64(v1) Linux"; |
| 73 | #else |
| 74 | U""; |
| 75 | #error Unknown OS type. |
| 76 | #endif |
| 77 | Graphics_text (graphics, 0.5, 0.54, Melder_cat (U"built for ", builtFor)); |
| 78 | Graphics_setColour (graphics, Melder_BLACK); |
| 79 | Graphics_setFont (graphics, kGraphics_font::HELVETICA); |
| 80 | Graphics_setFontSize (graphics, 10.0); |
| 81 | Graphics_text (graphics, 0.5, 0.37, Melder_cat (U"Copyright © 1992–", Melder_appYear(), U" Paul Boersma, David Weenink, Anastasia Shchupak")); |
| 82 | Graphics_setFontSize (graphics, 10.0); |
| 83 | Graphics_setTextAlignment (graphics, Graphics_RIGHT, Graphics_HALF); |
| 84 | Graphics_text (graphics, 0.34, 0.28, U"Download sites:"); |
| 85 | Graphics_text (graphics, 0.27, 0.14, U"Source code:"); |
| 86 | Graphics_text (graphics, 0.32, 0.065, U"Praat Users List:"); |
| 87 | Graphics_setTextAlignment (graphics, Graphics_LEFT, Graphics_HALF); |
| 88 | Graphics_setFont (graphics, kGraphics_font::COURIER); |
| 89 | Graphics_text (graphics, 0.36, 0.28, U"https://praat.org"); |
| 90 | Graphics_text (graphics, 0.36, 0.22, U"https://www.fon.hum.uva.nl/praat"); |
| 91 | Graphics_text (graphics, 0.28, 0.14, U"https://github.com/praat/praat.github.io"); |
| 92 | Graphics_text (graphics, 0.33, 0.065, U"https://groups.io/g/Praat-Users-List"); |
| 93 | } |
| 94 | |
| 95 | int main (int argc, char *argv []) { |
| 96 | try { |
| 97 | //TRACE |
| 98 | praat_setLogo (130.0, 100.0, logo); |
| 99 | MelderStopwatch stopwatch; |
| 100 | praat_init (U"" stringize (PRAAT_NAME), |
| 101 | U"" stringize (PRAAT_VERSION_STR), PRAAT_VERSION_NUM, |
| 102 | PRAAT_YEAR, PRAAT_MONTH, PRAAT_DAY, |
| 103 | U"paul.boersma", U"uva.nl", |
| 104 | argc, argv |
| 105 | ); |
| 106 | trace (stopwatch()); |
| 107 | INCLUDE_LIBRARY (praat_uvafon_init) |
| 108 | trace (stopwatch()); |
| 109 | praat_run (); |
| 110 | trace (stopwatch()); |
| 111 | } catch (MelderError) { |
| 112 | Melder_flushError ( |
| 113 | U"This error message percolated all the way to the top.\n" |
| 114 | U"Praat will now quit; contact the authors if this is unexpected." |
| 115 | ); // an attempt to catch Apache errors |
| 116 | } |
| 117 | return 0; // obligatory (because on Windows `main` is just a normal function called from our WinMain) |
| 118 | } |
| 119 | |
| 120 | /* End of file main_Praat.cpp */ |