Add API: set-wrappid-path.
[wrappi.git] / APIs / error.api
1 (* wrappi -*- tuareg -*-
2  * Copyright (C) 2011-2012 Red Hat Inc.
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17  *)
18
19 entry_point local
20 bool error ()
21 <<
22   return w->internal.error != NULL;
23 >>
24
25 entry_point local
26 void clear_error ()
27 <<
28   free (w->internal.error);
29   w->internal.error = NULL;
30   w->internal.errnum = 0;
31   w->internal.error_func = NULL;
32 >>
33
34 entry_point local
35 static_string get_error ()
36 <<
37   if (!w->internal.error) {
38     set_error ("no error on handle: do not call this function unless 'wrap_error' returns true");
39     return NULL;
40   }
41   return w->internal.error;
42 >>
43
44 entry_point local
45 int get_errno ()
46 <<
47   if (!w->internal.error) {
48     set_error ("no error on handle: do not call this function unless 'wrap_error' returns true");
49     return -1;
50   }
51   return w->internal.errnum;
52 >>
53
54 entry_point local
55 static_string get_error_func ()
56 <<
57   if (!w->internal.error) {
58     set_error ("no error on handle: do not call this function unless 'wrap_error' returns true");
59     return NULL;
60   }
61   return w->internal.error_func;
62 >>
63
64 (*
65 event error ???
66 *)