Debian Codegraph @

melder/melder_trust.cpp

raw symbols SCIP
1 /* melder_trust.cpp
2 *
3 * Copyright (C) 2024,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 "Interpreter.h"cxx . . $ `<file>/sys/Interpreter.h`/
20 #include "Script.h"cxx . . $ `<file>/sys/Script.h`/
21 #include "Notebook.h"cxx . . $ `<file>/sys/Notebook.h`/
22
23 void MelderTrustcxx . . $ MelderTrust/::_defaultProccxx . . $ MelderTrust/_defaultProc(d5a4f5531b36fe83). (void *void_interpreter, conststring32cxx . . $ conststring32# message) {
24 Interpretercxx . . $ Interpreter# interpreter = (Interpretercxx . . $ Interpreter#) void_interpreter;
25 if (interpreter) {
26 Scriptcxx . . $ Script# script = interpreter -> scriptReferencecxx . . $ structInterpreter#scriptReference.;
27 Notebookcxx . . $ Notebook# notebook = interpreter -> notebookReferencecxx . . $ structInterpreter#notebookReference.;
28 if (Melder_appVersioncxx . . $ Melder_appVersion(da6335ded91d79c2).() < 7000)
29 return; // no trust checking before Praat 7.0
30 if (script && ! script -> trustedcxx . . $ structScript#trusted.)
31 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (U"The following potentially dangerous action was requested by the script “", script -> string.get(),
32 U"” but is not allowed without --FULL-TRUST:\n\n", message,
33 U"\n\nUse --FULL-TRUST to prevent this message, but of course only if you indeed trust"
34 " the intentions and skills of the authors of the script and of the scripts or notebooks it calls."
35 );
36 if (notebook && ! notebook -> trustedcxx . . $ structNotebook#trusted.)
37 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (U"The following potentially dangerous action was requested by the notebook “", notebook -> string.get(),
38 U"” but is not allowed without --FULL-TRUST:\n\n", message,
39 U"\n\nUse --FULL-TRUST to prevent this message, but of course only if you indeed trust"
40 " the intentions and skills of the authors of the notebook and of the scripts or notebooks it calls."
41 );
42 if (! script && ! notebook)
43 Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (U"The following potentially dangerous action was requested"
44 " but is not allowed without --FULL-TRUST:\n\n", message,
45 U"\n\nUse --FULL-TRUST to prevent this message, but of course only if you indeed trust"
46 " the intentions and skills of the authors of the script or notebook and of the scripts or notebooks it calls."
47 );
48 }
49 }
50
51 MelderTrustcxx . . $ MelderTrust/::Proccxx . . $ MelderTrust/Proc# MelderTrustcxx . . $ MelderTrust/::_p_currentProccxx . . $ MelderTrust/_p_currentProc. = & MelderTrustcxx . . $ MelderTrust/::_defaultProccxx . . $ MelderTrust/_defaultProc(d5a4f5531b36fe83).;
52
53 MelderStringcxx . . $ MelderString# MelderTrustcxx . . $ MelderTrust/::_buffercxx . . $ MelderTrust/_buffer.;
54
55 void Melder_setTrustProccxx . . $ Melder_setTrustProc(4ba6d3c60ee7960a). (MelderTrustcxx . . $ MelderTrust/::Proccxx . . $ MelderTrust/Proc# p_proc) {
56 MelderTrustcxx . . $ MelderTrust/::_p_currentProccxx . . $ MelderTrust/_p_currentProc. = ( p_proc ? p_proc : & MelderTrustcxx . . $ MelderTrust/::_defaultProccxx . . $ MelderTrust/_defaultProc(d5a4f5531b36fe83). );
57 }
58
59 /* End of file melder_trust.cpp */