GIRAFFE Pipeline Reference Manual

gierror.c
1/*
2 * This file is part of the GIRAFFE Pipeline
3 * Copyright (C) 2002-2019 European Southern Observatory
4 *
5 * This program 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
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * 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 program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
20#ifdef HAVE_CONFIG_H
21# include <config.h>
22#endif
23
24#include <cxmemory.h>
25#include <cxstring.h>
26#include <cxstrutils.h>
27
28#include <cpl_error.h>
29#include <cpl_errorstate.h>
30
31#include "gierror.h"
32
33
34struct GiError {
35 cpl_errorstate state;
36};
37
38typedef struct GiError GiError;
39
40
41static GiError _error ;
42
43static cxbool _error_init = FALSE;
44static cxbool _error_saved = FALSE;
45
46
55void
56giraffe_error_init(void)
57{
58
59 _error_init = TRUE;
60 return;
61
62}
63
64
65void
66giraffe_error_clear(void)
67{
68
69 if (_error_init == TRUE) {
70 _error_init = FALSE;
71 }
72
73 return;
74
75}
76
77
78void
79giraffe_error_push(void)
80{
81
82 cx_assert(_error_init == TRUE);
83
84 _error.state = cpl_errorstate_get();
85 _error_saved = TRUE;
86
87 cpl_error_reset();
88
89 return;
90
91}
92
93
94void
95giraffe_error_pop(void)
96{
97
98 cx_assert(_error_init == TRUE);
99
100 if (_error_saved == TRUE) {
101
102 cpl_errorstate_set(_error.state);
103 _error_saved = FALSE;
104
105 }
106
107 return;
108
109}

This file is part of the GIRAFFE Pipeline Reference Manual 2.17.1.
Documentation copyright © 2002-2006 European Southern Observatory.
Generated on Fri Feb 21 2025 02:35:06 by doxygen 1.9.6 written by Dimitri van Heesch, © 1997-2004