GIRAFFE Pipeline Reference Manual

gierror.c
1 /* $Id$
2  *
3  * This file is part of the GIRAFFE Pipeline
4  * Copyright (C) 2002-2006 European Southern Observatory
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 /*
22  * $Author$
23  * $Date$
24  * $Revision$
25  * $Name$
26  */
27 
28 #ifdef HAVE_CONFIG_H
29 # include <config.h>
30 #endif
31 
32 #include <cxmemory.h>
33 #include <cxstring.h>
34 #include <cxstrutils.h>
35 
36 #include <cpl_error.h>
37 #include <cpl_errorstate.h>
38 
39 #include "gierror.h"
40 
41 
42 struct GiError {
43  cpl_errorstate state;
44 };
45 
46 typedef struct GiError GiError;
47 
48 
49 static GiError _error ;
50 
51 static cxbool _error_init = FALSE;
52 static cxbool _error_saved = FALSE;
53 
54 
63 void
64 giraffe_error_init(void)
65 {
66 
67  _error_init = TRUE;
68  return;
69 
70 }
71 
72 
73 void
74 giraffe_error_clear(void)
75 {
76 
77  if (_error_init == TRUE) {
78  _error_init = FALSE;
79  }
80 
81  return;
82 
83 }
84 
85 
86 void
87 giraffe_error_push(void)
88 {
89 
90  cx_assert(_error_init == TRUE);
91 
92  _error.state = cpl_errorstate_get();
93  _error_saved = TRUE;
94 
95  cpl_error_reset();
96 
97  return;
98 
99 }
100 
101 
102 void
103 giraffe_error_pop(void)
104 {
105 
106  cx_assert(_error_init == TRUE);
107 
108  if (_error_saved == TRUE) {
109 
110  cpl_errorstate_set(_error.state);
111  _error_saved = FALSE;
112 
113  }
114 
115  return;
116 
117 }

This file is part of the GIRAFFE Pipeline Reference Manual 2.14.
Documentation copyright © 2002-2006 European Southern Observatory.
Generated on Wed Mar 11 2015 13:19:41 by doxygen 1.8.9.1 written by Dimitri van Heesch, © 1997-2004