Lumiera 0.pre.04
»edit your freedom«
Loading...
Searching...
No Matches
test-errorstate.c
Go to the documentation of this file.
1/*
2 TEST-ERRORSTATE - test handling of error flags
3
4 Copyright (C)
5 2008, Christian Thaeter <ct@pipapo.org>
6
7  **Lumiera** is free software; you can redistribute it and/or modify it
8  under the terms of the GNU General Public License as published by the
9  Free Software Foundation; either version 2 of the License, or (at your
10  option) any later version. See the file COPYING for further details.
11
12* *****************************************************************/
13
21#include <stdio.h>
22#include <string.h>
23
24#include "lib/error.h"
25
26
28
29int
30main (int argc, char** argv)
31{
32 if (argc == 1)
33 return 0;
34
35 if (!strcmp(argv[1], "set"))
36 {
37 lumiera_error_set (LUMIERA_ERROR_TEST, NULL);
38 }
39
40 if (!strcmp(argv[1], "get_no"))
41 {
42 const char* err;
43 err = lumiera_error ();
44 printf ("%p\n", err);
45 }
46
47 if (!strcmp(argv[1], "get"))
48 {
49 lumiera_error_set (LUMIERA_ERROR_TEST, NULL);
50 const char* err;
51 err = lumiera_error ();
52 printf ("%s\n", err);
53 }
54
55 if (!strcmp(argv[1], "get2"))
56 {
57 lumiera_error_set (LUMIERA_ERROR_TEST, NULL);
58 const char* err;
59 err = lumiera_error ();
60 printf ("%s\n", err);
61 err = lumiera_error ();
62 printf ("%p\n", err);
63 }
64
65 return 0;
66}
lumiera_err lumiera_error(void)
Get and clear current error state.
lumiera_err lumiera_error_set(lumiera_err nerr, const char *extra)
Set error state for the current thread.
Definition error-state.c:96
Lumiera error handling (C interface).
#define LUMIERA_ERROR_DEFINE(err, msg)
Definition and initialisation of an error constant.
Definition error.h:71
return NULL
Definition llist.h:586
int main()
Definition main.c:37
#define TEST(name)
Definition test.h:45