Debian Codegraph @

melder/melder_debug.h

raw symbols SCIP
1 #cxx . . $ `<file>/melder/melder_debug.h`/ifndef _melder_debug_h_
2 #define _melder_debug_h_cxx . . $ `melder/melder_debug.h:2:9`!
3 /* melder_debug.h
4 *
5 * Copyright (C) 1992-2018,2020,2021,2024 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 2 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 inline integercxx . . $ integer# Melder_debugcxx . . $ Melder_debug. = 0;
22
23 void Melder_tracingToFilecxx . . $ Melder_tracingToFile(1145552d769d7b5d). (MelderFilecxx . . $ MelderFile# file);
24 void Melder_setTracingcxx . . $ Melder_setTracing(b45ddcbc8423892c). (bool tracing);
25 inline bool Melder_isTracingGloballycxx . . $ Melder_isTracingGlobally. = false;
26 inline bool Melder_isTracingLocallycxx . . $ Melder_isTracingLocally. = false;
27
28 namespace MelderTracecxx . . $ MelderTrace/ {
29 inline structMelderFilecxx . . $ structMelderFile# _filecxx . . $ MelderTrace/_file. { };
30 FILE * _opencxx . . $ MelderTrace/_open(e3ed0bbe2bd3b468). (conststring8cxx . . $ conststring8# sourceCodeFileName, int lineNumber, conststring8cxx . . $ conststring8# functionName);
31 void _closecxx . . $ MelderTrace/_close(8d4262d45fc644ab). (FILE *f);
32 conststring8cxx . . $ conststring8# _peek32to8cxx . . $ MelderTrace/_peek32to8(c6a971952cbb8e31). (conststring32cxx . . $ conststring32# string);
33 conststring16cxx . . $ conststring16# _peek32to16cxx . . $ MelderTrace/_peek32to16(879c53a1c5a150c1). (conststring32cxx . . $ conststring32# string);
34 conststring32cxx . . $ conststring32# _peek8to32cxx . . $ MelderTrace/_peek8to32(4cad97a093ddcc1d). (conststring8cxx . . $ conststring8# string8); // used in the `trace` macro
35
36 inline void _appendOneMessageElementcxx . . $ MelderTrace/_appendOneMessageElement(6e3c8643bca295e0). (FILE *f, conststring32cxx . . $ conststring32# string) {
37 if (string)
38 fprintf (f, "%s", _peek32to8cxx . . $ MelderTrace/_peek32to8(c6a971952cbb8e31). (string));
39 }
40 }
41
42 extern stdcxx . . $ std/::mutexcxx . . $ std/mutex# theMelder_trace_mutexcxx . . $ theMelder_trace_mutex.;
43
44 template <typename... Arg>
45 void Melder_tracecxx . . $ Melder_trace(80c6c96be3f0fb5a). (conststring8cxx . . $ conststring8# sourceCodeFileName, int lineNumber, conststring8cxx . . $ conststring8# functionName, const Arg... arg) {
46 stdcxx . . $ std/::lock_guard lockcxx . . $ std/lock_guard#lock_guard(8e935d9c2e576e3a). (theMelder_trace_mutexcxx . . $ theMelder_trace_mutex.);
47 if (MelderFile_isNullcxx . . $ MelderFile_isNull(8f92cdf95b27d908). (& MelderTracecxx . . $ MelderTrace/::_filecxx . . $ MelderTrace/_file.))
48 return;
49 FILE *f = MelderTracecxx . . $ MelderTrace/::_opencxx . . $ MelderTrace/_open(e3ed0bbe2bd3b468). (sourceCodeFileName, lineNumber, functionName);
50 ( MelderTracecxx . . $ MelderTrace/::_appendOneMessageElementcxx . . $ MelderTrace/_appendOneMessageElement(6e3c8643bca295e0). (f, MelderArgcxx . . $ MelderArg# { arg }. _argcxx . . $ MelderArg#_arg.), ... );
51 MelderTracecxx . . $ MelderTrace/::_closecxx . . $ MelderTrace/_close(8d4262d45fc644ab). (f);
52 }
53
54 #define TRACEcxx . . $ `melder/melder_debug.h:54:9`! constexpr bool Melder_isTracingLocally = true; // intentionally shadow a global variable; meant for temporary tracing of a function (to stderr)
55 #define TRACEFcxx . . $ `melder/melder_debug.h:55:9`! constexpr bool Melder_isTracingGlobally = true; // for temporary tracing of a function (to the tracing file, even if global tracing is off)
56
57 #ifdef NDEBUG
58 #define trace(...) ((void) 0)
59 #else
60 #define tracecxx . . $ `melder/melder_debug.h:60:10`!(...) ( \
61 Melder_isTracingGlobally ? Melder_trace (__FILE__, __LINE__, __FUNCTION__, __VA_ARGS__) : \
62 Melder_isTracingLocally ? Melder_casual (U"" __FILE__ " ", __LINE__, U" ", MelderTrace::_peek8to32 (__FUNCTION__), U": ", __VA_ARGS__) : \
63 (void) 0 \
64 )
65 #endif
66
67 /* End of file melder_debug.h */
68 #endif