mask mousewheel segv bug, mask opengl sw fallback read to ram, fix tiff config withou...
[goodguy/cinelerra.git] / cinelerra-5.1 / guicast / bcsignals.h
1 /*
2  * CINELERRA
3  * Copyright (C) 1997-2014 Adam Williams <broadcast at earthling dot net>
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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18  *
19  */
20
21
22 // debugging functions go here
23
24 #ifndef BCSIGNALS_H
25 #define BCSIGNALS_H
26
27 #include "arraylist.h"
28 #include "linklist.h"
29 #include "bcsignals.inc"
30 #include "bctrace.h"
31 #include <stdio.h>
32 #include <pthread.h>
33 #include <signal.h>
34 #include <X11/Xlib.h>
35
36 // BC_Signals must be initialized at the start of every program using
37 // debugging.
38
39 class BC_Signals : public BC_Trace
40 {
41         int (*old_err_handler)(Display *, XErrorEvent *);
42         static int x_error_handler(Display *display, XErrorEvent *event);
43 public:
44         BC_Signals();
45         ~BC_Signals();
46         void initialize(const char *trap_path=0);
47         void initialize2();
48         void terminate();
49
50         virtual void signal_handler(int signum);
51         static void dump_stack(FILE *fp=stdout);
52         static void signal_dump(int signum);
53         static void kill_subs();
54         static void set_sighup_exit(int enable);
55
56         static void set_trap_path(const char *path);
57         static void set_trap_hook(void (*hook)(FILE *fp, void *data), void *data);
58         static void set_catch_segv(bool v);
59         static void set_catch_intr(bool v);
60
61 // Convert signum to text
62         static const char* sig_to_str(int number);
63
64         static BC_Signals *global_signals;
65         static const char *trap_path;
66         static void *trap_data;
67         static void (*trap_hook)(FILE *fp, void *vp);
68         static bool trap_sigsegv, trap_sigintr;
69 };
70
71 #endif