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 <cxmessages.h>
26#include <cxstring.h>
27#include <cxstrutils.h>
28
29#include <cpl_error.h>
30#include <cpl_errorstate.h>
31
32#include "gierror.h"
33
34
35struct GiError {
36 cpl_errorstate state;
37};
38
39typedef struct GiError GiError;
40
41
42static GiError _error ;
43
44static cxbool _error_init = FALSE;
45static cxbool _error_saved = FALSE;
46
47
56void
57giraffe_error_init(void)
58{
59
60 _error_init = TRUE;
61 return;
62
63}
64
65
66void
67giraffe_error_clear(void)
68{
69
70 if (_error_init == TRUE) {
71 _error_init = FALSE;
72 }
73
74 return;
75
76}
77
78
79void
80giraffe_error_push(void)
81{
82
83 cx_assert(_error_init == TRUE);
84
85 _error.state = cpl_errorstate_get();
86 _error_saved = TRUE;
87
88 cpl_error_reset();
89
90 return;
91
92}
93
94
95void
96giraffe_error_pop(void)
97{
98
99 cx_assert(_error_init == TRUE);
100
101 if (_error_saved == TRUE) {
102
103 cpl_errorstate_set(_error.state);
104 _error_saved = FALSE;
105
106 }
107
108 return;
109
110}

This file is part of the GIRAFFE Pipeline Reference Manual 2.19.4.
Documentation copyright © 2002-2006 European Southern Observatory.
Generated on Fri Feb 6 2026 11:30:08 by doxygen 1.9.6 written by Dimitri van Heesch, © 1997-2004