| 1 | /* melder_progress.cpp |
| 2 | * |
| 3 | * Copyright (C) 1992-2018,2020,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 | static void defaultProgresscxx . . $ defaultProgress(cd1f800970345287). (double /*progress*/, conststring32cxx . . $ conststring32# /*message*/) { |
| 22 | } |
| 23 | |
| 24 | static void * defaultMonitorcxx . . $ defaultMonitor(7223d092b5bdba8d). (double /*progress*/, conststring32cxx . . $ conststring32# /*message*/) { |
| 25 | return nullptr; |
| 26 | } |
| 27 | |
| 28 | int MelderProgresscxx . . $ MelderProgress/::_depthcxx . . $ MelderProgress/_depth. = 0; |
| 29 | |
| 30 | MelderProgresscxx . . $ MelderProgress/::ProgressProccxx . . $ MelderProgress/ProgressProc# MelderProgresscxx . . $ MelderProgress/::_p_progressProccxx . . $ MelderProgress/_p_progressProc. = & defaultProgresscxx . . $ defaultProgress(cd1f800970345287).; |
| 31 | MelderProgresscxx . . $ MelderProgress/::MonitorProccxx . . $ MelderProgress/MonitorProc# MelderProgresscxx . . $ MelderProgress/::_p_monitorProccxx . . $ MelderProgress/_p_monitorProc. = & defaultMonitorcxx . . $ defaultMonitor(7223d092b5bdba8d).; |
| 32 | |
| 33 | void Melder_progressOffcxx . . $ Melder_progressOff(49f6e7a06ebc5aa8). () { MelderProgresscxx . . $ MelderProgress/::_depthcxx . . $ MelderProgress/_depth. --; } |
| 34 | void Melder_progressOncxx . . $ Melder_progressOn(49f6e7a06ebc5aa8). () { MelderProgresscxx . . $ MelderProgress/::_depthcxx . . $ MelderProgress/_depth. ++; } |
| 35 | |
| 36 | void MelderProgresscxx . . $ MelderProgress/::_doProgresscxx . . $ MelderProgress/_doProgress(cd1f800970345287). (double progress, conststring32cxx . . $ conststring32# message) { |
| 37 | if (! Melder_batchcxx . . $ Melder_batch. && MelderProgresscxx . . $ MelderProgress/::_depthcxx . . $ MelderProgress/_depth. >= 0 && ! (Melder_debugcxx . . $ Melder_debug. == 14)) |
| 38 | MelderProgresscxx . . $ MelderProgress/::_p_progressProccxx . . $ MelderProgress/_p_progressProc. (progress, message); |
| 39 | } |
| 40 | |
| 41 | MelderStringcxx . . $ MelderString# MelderProgresscxx . . $ MelderProgress/::_buffercxx . . $ MelderProgress/_buffer.; |
| 42 | |
| 43 | void * MelderProgresscxx . . $ MelderProgress/::_doMonitorcxx . . $ MelderProgress/_doMonitor(7223d092b5bdba8d). (double progress, conststring32cxx . . $ conststring32# message) { |
| 44 | if (! Melder_batchcxx . . $ Melder_batch. && MelderProgresscxx . . $ MelderProgress/::_depthcxx . . $ MelderProgress/_depth. >= 0) { |
| 45 | void *result = MelderProgresscxx . . $ MelderProgress/::_p_monitorProccxx . . $ MelderProgress/_p_monitorProc. (progress, message); |
| 46 | if (result) |
| 47 | return result; |
| 48 | } |
| 49 | return progress <= 0.0 ? nullptr /* no Graphics */ : (void *) -1 /* any non-null pointer */; |
| 50 | } |
| 51 | |
| 52 | void Melder_setProgressProccxx . . $ Melder_setProgressProc(9bcb6c487d44e509). (MelderProgresscxx . . $ MelderProgress/::ProgressProccxx . . $ MelderProgress/ProgressProc# proc) { |
| 53 | MelderProgresscxx . . $ MelderProgress/::_p_progressProccxx . . $ MelderProgress/_p_progressProc. = ( proc ? proc : & defaultProgresscxx . . $ defaultProgress(cd1f800970345287). ); |
| 54 | } |
| 55 | |
| 56 | void Melder_setMonitorProccxx . . $ Melder_setMonitorProc(1e842e40862c4d17). (MelderProgresscxx . . $ MelderProgress/::MonitorProccxx . . $ MelderProgress/MonitorProc# proc) { |
| 57 | MelderProgresscxx . . $ MelderProgress/::_p_monitorProccxx . . $ MelderProgress/_p_monitorProc. = ( proc ? proc : & defaultMonitorcxx . . $ defaultMonitor(7223d092b5bdba8d). ); |
| 58 | } |
| 59 | |
| 60 | /* End of file melder_progress.cpp */ |