Debian Codegraph @

melder/melder_warning.h

raw symbols SCIP
1 #cxx . . $ `<file>/melder/melder_warning.h`/ifndef _melder_warning_h_
2 #define _melder_warning_h_cxx . . $ `melder/melder_warning.h:2:9`!
3 /* melder_warning.h
4 *
5 * Copyright (C) 1992-2018,2025 Paul Boersma
6 *
7 * This code is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3 of the License, or (at
10 * your option) any later version.
11 *
12 * This code is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15 * See the GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this work. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21 /*
22 SYNOPSIS (2018-08-08)
23
24 Melder_warning (args...);
25
26 Gives a warning to stderr (batch) or to a "Warning" dialog.
27 Use sparingly, because it interrupts the user's workflow.
28 */
29
30 namespace MelderWarningcxx . . $ MelderWarning/ {
31 extern int _depthcxx . . $ MelderWarning/_depth.;
32 extern MelderStringcxx . . $ MelderString# _buffercxx . . $ MelderWarning/_buffer.;
33 using Proccxx . . $ MelderWarning/Proc# = void (*) (conststring32cxx . . $ conststring32# message);
34 void _defaultProccxx . . $ MelderWarning/_defaultProc(ff00d524ab0355ec). (conststring32cxx . . $ conststring32# message);
35 extern Proccxx . . $ MelderWarning/Proc# _p_currentProccxx . . $ MelderWarning/_p_currentProc.;
36 }
37
38 template <typename... Arg>
39 void Melder_warningcxx . . $ Melder_warning(6298c93241566110). (const Arg... arg) {
40 if (MelderWarningcxx . . $ MelderWarning/::_depthcxx . . $ MelderWarning/_depth. < 0)
41 return;
42 MelderString_copycxx . . $ MelderString_copy(65be51a793e0ff96). (& MelderWarningcxx . . $ MelderWarning/::_buffercxx . . $ MelderWarning/_buffer., arg...);
43 (*MelderWarningcxx . . $ MelderWarning/::_p_currentProccxx . . $ MelderWarning/_p_currentProc.) (MelderWarningcxx . . $ MelderWarning/::_buffercxx . . $ MelderWarning/_buffer..stringcxx . . $ MelderString#string.);
44 }
45
46 void Melder_warningOffcxx . . $ Melder_warningOff(49f6e7a06ebc5aa8). ();
47 void Melder_warningOncxx . . $ Melder_warningOn(49f6e7a06ebc5aa8). ();
48
49 class autoMelderWarningOffcxx . . $ autoMelderWarningOff# {
50 public:
51 autoMelderWarningOffcxx . . $ autoMelderWarningOff#autoMelderWarningOff(49f6e7a06ebc5aa8). () { Melder_warningOffcxx . . $ Melder_warningOff(49f6e7a06ebc5aa8). (); }
52 ~cxx . . $ autoMelderWarningOff#`~autoMelderWarningOff`(ced63f7c635d850d).autoMelderWarningOffcxx . . $ autoMelderWarningOff# () { Melder_warningOncxx . . $ Melder_warningOn(49f6e7a06ebc5aa8). (); }
53 };
54
55 void Melder_setWarningProccxx . . $ Melder_setWarningProc(f441b548652834d9). (MelderWarningcxx . . $ MelderWarning/::Proccxx . . $ MelderWarning/Proc# p_proc);
56
57 //#define Melder_warning_once(...) \
58 // do { static bool hasWarned = false; if (! hasWarned) { Melder_warning (__VA_ARGS__); hasWarned = true; } } while (0)
59
60 template <int invocationSite>
61 struct MelderWarningOncecxx . . $ MelderWarningOnce# {
62 inline static stdcxx . . $ std/::once_flagcxx . . $ std/once_flag# flagcxx . . $ MelderWarningOnce#flag.;
63 };
64
65 template <int invocationSite, typename... Args>
66 inline void Melder_warning_once_templatecxx . . $ Melder_warning_once_template(80dead36bb31466). (Args&&... args)
67 {
68 stdcxx . . $ std/::call_oncecxx . . $ std/call_once(831c9dbddcef942f). (MelderWarningOncecxx . . $ MelderWarningOnce# <invocationSite> :: flag, [&] {
69 Melder_warningcxx . . $ Melder_warning(6298c93241566110). (stdcxx . . $ std/::forwardcxx . . $ std/forward(f56228ea88711827). <Args> (args)...);
70 });
71 }
72
73 #define Melder_warning_oncecxx . . $ `melder/melder_warning.h:73:9`!(...) Melder_warning_once_template <__COUNTER__> (__VA_ARGS__)
74
75 #endif // !_melder_warning_h_