1 /**********************************************************
2  * Version $Id$
3  *********************************************************/
4 
5 ///////////////////////////////////////////////////////////
6 //                                                       //
7 //                         SAGA                          //
8 //                                                       //
9 //      System for Automated Geoscientific Analyses      //
10 //                                                       //
11 //                     Tool Library                      //
12 //              Grid_Filter / Grid_Calculus              //
13 //                                                       //
14 //-------------------------------------------------------//
15 //                                                       //
16 //                       errfunc.h                       //
17 //                                                       //
18 //                 Copyright (C) 2013 by                 //
19 //                     HfT Stuttgart                     //
20 //                                                       //
21 //-------------------------------------------------------//
22 //                                                       //
23 // This file is part of 'SAGA - System for Automated     //
24 // Geoscientific Analyses'. SAGA is free software; you   //
25 // can redistribute it and/or modify it under the terms  //
26 // of the GNU General Public License as published by the //
27 // Free Software Foundation, either version 2 of the     //
28 // License, or (at your option) any later version.       //
29 //                                                       //
30 // SAGA is distributed in the hope that it will be       //
31 // useful, but WITHOUT ANY WARRANTY; without even the    //
32 // implied warranty of MERCHANTABILITY or FITNESS FOR A  //
33 // PARTICULAR PURPOSE. See the GNU General Public        //
34 // License for more details.                             //
35 //                                                       //
36 // You should have received a copy of the GNU General    //
37 // Public License along with this program; if not, see   //
38 // <http://www.gnu.org/licenses/>.                       //
39 //                                                       //
40 //-------------------------------------------------------//
41 //                                                       //
42 //    e-mail:     johannes.engels@hft-stuttgart.de       //
43 //                                                       //
44 //    contact:    Johannes Engels                        //
45 //                Hochschule fuer Technik Stuttgart      //
46 //                Schellingstr. 24                       //
47 //                70174 Stuttgart                        //
48 //                Germany                                //
49 //                                                       //
50 ///////////////////////////////////////////////////////////
51 
52 //---------------------------------------------------------
53 
54 
55 ///////////////////////////////////////////////////////////
56 //														 //
57 //                                                       //
58 //														 //
59 ///////////////////////////////////////////////////////////
60 
61 //---------------------------------------------------------
62 typedef struct fehlerinfo
63 {
64    int fnr;
65    char art;
66    char *message;
67 }
68 fehlerinfo;
69 
70 void fehler (int zeile,
71              int fnr,
72              char *filename,
73              char *funk_name,
74              FILE *protfile,
75              fehlerinfo *finf,
76              void *info1,
77              void *info2,
78              void *info3,
79              void *info4,
80              void *info5,
81              void *info6,
82              void *info7);
83 
84 
85 void error_message (int zeile,
86                     int fnr,
87                     char *filename,
88                     char *funk_name,
89                     char **error_list,
90                     fehlerinfo *finf,
91                     void *info1,
92                     void *info2,
93                     void *info3,
94                     void *info4,
95                     void *info5,
96                     void *info6,
97                     void *info7);
98 
99 void fehler2 (int zeile,
100               int fnr,
101               char *filename,
102               char *funk_name,
103               FILE *protfile,
104               fehlerinfo *finf,
105               ...);
106 
107 void fehler3 (int zeile,
108               int fnr,
109               char *filename,
110               char *funk_name,
111               char **error_list,
112               fehlerinfo *finf,
113               ...);
114 
115 
116 #define ERR_MESS_0(fnr)   error_message (__LINE__, (fnr), __FILE__, \
117                                          funk_name, &error_liste,   \
118                                          finfo, NULL, NULL, NULL,   \
119                                          NULL, NULL, NULL,          \
120                                          NULL)
121 
122 #define ERR_MESS_1(fnr,y)   error_message (__LINE__, (fnr), __FILE__, \
123                                            funk_name, &error_liste,   \
124                                            finfo, (y), NULL, NULL,    \
125                                            NULL, NULL, NULL,          \
126                                            NULL)
127 
128 
129 #define ERRCHECK2_RC(fnr,finfo,x1,x2)                            \
130                                                                  \
131 if (rc != 0)                                                     \
132 {                                                                \
133    error_message (__LINE__,(fnr),__FILE__,funk_name,error_liste, \
134                   finfo,x1,x2,NULL,NULL,NULL,NULL,NULL);         \
135    return 8;                                                     \
136 }
137 
138 #define ERRCHECK2_NULL(y,fnr,finfo,x1,x2)                        \
139                                                                  \
140 if (y == NULL)                                                   \
141 {                                                                \
142    error_message (__LINE__,(fnr),__FILE__,funk_name,error_liste, \
143                   finfo,x1,x2,NULL,NULL,NULL,NULL,NULL);         \
144 }
145 
146 #define ERRCHECK2_RC_R(fnr,finfo,x1,x2)                          \
147                                                                  \
148 if (rc != 0)                                                     \
149 {                                                                \
150    error_message (__LINE__,(fnr),__FILE__,funk_name,error_liste, \
151                   finfo,x1,x2,NULL,NULL,NULL,NULL,NULL);         \
152    return rc;                                                    \
153 }
154 
155 
156 #define ERRCHECK2_NULL_R(y,fnr,finfo,x1,x2)                      \
157                                                                  \
158 if (y == NULL)                                                   \
159 {                                                                \
160    error_message (__LINE__,(fnr),__FILE__,funk_name,error_liste, \
161                   finfo,x1,x2,NULL,NULL,NULL,NULL,NULL);         \
162    return;                                                       \
163 }
164 
165 
166 #if 0
167 
168 #define ERRCHECK7_RC(fnr,finfo,x1,x2,x3,x4,x5,x6,x7)             \
169                                                                  \
170 if (rc != 0)                                                     \
171 {                                                                \
172    fehler2 (__LINE__,(fnr),__FILE__,funk_name,stdout,finfo,      \
173             x1,x2,x3,x4,x5,x6,x7);                               \
174 }
175 
176 
177 
178 #define ERRCHECK7_NULL(y,fnr,finfo,x1,x2,x3,x4,x5,x6,x7)         \
179                                                                  \
180 if (y == NULL)                                                   \
181 {                                                                \
182    fehler2 (__LINE__,(fnr),__FILE__,funk_name,stdout,finfo,      \
183             x1,x2,x3,x4,x5,x6,x7);                               \
184 }
185 
186 
187 #define ERRCHECK7_RC_R(fnr,finfo,x1,x2,x3,x4,x5,x6,x7)           \
188                                                                  \
189 if (rc != 0)                                                     \
190 {                                                                \
191    fehler2 (__LINE__,(fnr),__FILE__,funk_name,stdout,finfo,      \
192             x1,x2,x3,x4,x5,x6,x7);                               \
193    return rc;                                                    \
194 }
195 
196 
197 #define ERRCHECK7_NULL_R(y,fnr,finfo,x1,x2,x3,x4,x5,x6,x7)       \
198                                                                  \
199 if (y == NULL)                                                   \
200 {                                                                \
201    fehler2 (__LINE__,(fnr),__FILE__,funk_name,stdout,finfo,      \
202             x1,x2,x3,x4,x5,x6,x7);                               \
203    return;                                                       \
204 }
205 
206 
207 #endif
208 
209 
210 
211