annotate libvisual/lv_error.c @ 27:d160ae2251e9 trunk

[svn] Update SIGSEGV message, contained the BMP mailing information.
author nenolod
date Tue, 25 Oct 2005 21:26:50 -0700
parents 0db4a1dc75c4
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
23
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
1 /* Libvisual - The audio visualisation framework.
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
2 *
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
3 * Copyright (C) 2004, 2005 Dennis Smit <ds@nerds-incorporated.org>
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
4 *
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
5 * Authors: Dennis Smit <ds@nerds-incorporated.org>
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
6 *
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
7 * $Id:
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
8 *
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
9 * This program is free software; you can redistribute it and/or modify
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
10 * it under the terms of the GNU Lesser General Public License as
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
11 * published by the Free Software Foundation; either version 2.1
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
12 * of the License, or (at your option) any later version.
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
13 *
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
14 * This program is distributed in the hope that it will be useful,
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
17 * GNU Lesser General Public License for more details.
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
18 *
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
19 * You should have received a copy of the GNU Lesser General Public License
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
20 * along with this program; if not, write to the Free Software
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
22 */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
23
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
24 #include <stdlib.h>
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
25 #include <stdio.h>
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
26 #include <unistd.h>
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
27 #include <string.h>
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
28 #include <assert.h>
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
29 #include <signal.h>
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
30
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
31 #include "lv_log.h"
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
32 #include "lv_error.h"
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
33
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
34 static const char *__lv_error_human_readable[] = {
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
35 "There was no error", /* VISUAL_OK */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
36
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
37 "General error occurred", /* VISUAL_ERROR_GENERAL */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
38 "General NULL pointer error", /* VISUAL_ERROR_NULL */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
39 "An impossible event occurred", /* VISUAL_ERROR_IMPOSSIBLE */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
40
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
41 "VisActor is NULL", /* VISUAL_ERROR_ACTOR_NULL */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
42 "VisActor it's video is NULL", /* VISUAL_ERROR_ACTOR_VIDEO_NULL */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
43 "VisActor it's plugin is NULL", /* VISUAL_ERROR_ACTOR_PLUGIN_NULL */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
44 "VisActor failed while trying to forcefully negotiate a GL surface", /* VISUAL_ERROR_ACTOR_GL_NEGOTIATE */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
45
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
46 "VisAudio is NULL", /* VISUAL_ERROR_AUDIO_NULL */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
47
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
48 "Bitmap is not a bitmap file", /* VISUAL_ERROR_BMP_NO_BMP */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
49 "Bitmap can not be found", /* VISUAL_ERROR_BMP_NOT_FOUND */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
50 "Bitmap is not supported", /* VISUAL_ERROR_BMP_NOT_SUPPORTED */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
51 "Bitmap is corrupted", /* VISUAL_ERROR_BMP_CORRUPTED */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
52
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
53 "VisColor is NULL", /* VISUAL_ERROR_COLOR_NULL */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
54
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
55 "The code can not run on this architecture", /* VISUAL_ERROR_CPU_INVALID_CODE */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
56
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
57 "Global error handler is NULL", /* VISUAL_ERROR_ERROR_HANDLER_NULL */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
58
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
59 "VisEvent is NULL", /* VISUAL_ERROR_EVENT_NULL */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
60 "VisEventQueue is NULL", /* VISUAL_ERROR_EVENT_QUEUE_NULL */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
61
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
62 "VisInput is NULL", /* VISUAL_ERROR_INPUT_NULL */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
63 "VisInput it's plugin is NULL", /* VISUAL_ERROR_INPUT_PLUGIN_NULL */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
64
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
65 "No paths were given to seek for plugins", /* VISUAL_ERROR_LIBVISUAL_NO_PATHS */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
66 "Libvisual is already initialized", /* VISUAL_ERROR_LIBVISUAL_ALREADY_INITIALIZED */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
67 "Libvisual is not initialized", /* VISUAL_ERROR_LIBVISUAL_NOT_INITIALIZED */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
68 "Libvisual has not build a plugin registry", /* VISUAL_ERROR_LIBVISUAL_NO_REGISTRY */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
69
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
70 "VisList is NULL", /* VISUAL_ERROR_LIST_NULL */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
71 "VisListEntry is NULL", /* VISUAL_ERROR_LIST_ENTRY_NULL */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
72 "VisListEntry is invalid", /* VISUAL_ERROR_LIST_ENTRY_INVALID */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
73
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
74 "Given memory pointer is NULL", /* VISUAL_ERROR_MEM_NULL */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
75
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
76 "VisMorph is NULL", /* VISUAL_ERROR_MORPH_NULL */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
77 "VisMorph it's plugin is NULL", /* VISUAL_ERROR_MORPH_PLUGIN_NULL */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
78
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
79 "VisPalette is NULL", /* VISUAL_ERROR_PALETTE_NULL */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
80 "VisPalette it's size conflicts", /* VISUAL_ERROR_PALETTE_SIZE */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
81
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
82 "VisParamEntry is NULL", /* VISUAL_ERROR_PARAM_NULL */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
83 "VisParamContainer is NULL", /* VISUAL_ERROR_PARAM_CONTAINER_NULL */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
84 "VisParamEntry not found in VisParamContainer", /* VISUAL_ERROR_PARAM_NOT_FOUND */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
85 "VisParamEntry it's change notify callback is NULL", /* VISUAL_ERROR_PARAM_CALLBACK_NULL */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
86 "VisParamEntry contains too many change notify callbacks", /* VISUAL_ERROR_PARAM_CALLBACK_TOO_MANY */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
87 "VisParamEntry is of invalid type", /* VISUAL_ERROR_PARAM_INVALID_TYPE */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
88
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
89 "VisPluginData is NULL", /* VISUAL_ERROR_PLUGIN_NULL */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
90 "VisPluginInfo is NULL", /* VISUAL_ERROR_PLUGIN_INFO_NULL */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
91 "VisPluginRef is NULL", /* VISUAL_ERROR_PLUGIN_REF_NULL */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
92 "VisPluginEnvironElement is NULL", /* VISUAL_ERROR_PLUGIN_ENVIRON_NULL */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
93 "Plugin does not have an event handler", /* VISUAL_ERROR_PLUGIN_NO_EVENT_HANDLER */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
94 "Plugin handle is NULL", /* VISUAL_ERROR_PLUGIN_HANDLE_NULL */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
95 "Plugin is already realized", /* VISUAL_ERROR_PLUGIN_ALREADY_REALIZED */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
96
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
97 "VisRandomContext is NULL", /* VISUAL_ERROR_RANDOM_CONTEXT_NULL */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
98
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
99 "VisSongInfo is NULL", /* VISUAL_ERROR_SONGINFO_NULL */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
100
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
101 "VisThread is NULL", /* VISUAL_ERROR_THREAD_NULL */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
102 "Threading is disabled or not supported", /* VISUAL_ERROR_THREAD_NO_THREADING */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
103 "VisMutex is NULL", /* VISUAL_ERROR_MUTEX_NULL */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
104 "VisMutex lock failed", /* VISUAL_ERROR_MUTEX_LOCK_FAILURE */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
105 "VisMutex trylock failed", /* VISUAL_ERROR_MUTEX_TRYLOCK_FAILURE */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
106 "VisMutex unlock failed", /* VISUAL_ERROR_MUTEX_UNLOCK_FAILURE */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
107
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
108 "VisTransform is NULL", /* VISUAL_ERROR_TRANSFORM_NULL */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
109 "The VisTransform negotiate with the target VisVideo failed", /* VISUAL_ERROR_TRANSFORM_NEGOTIATE */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
110 "The VisTransform it's plugin is NULL", /* VISUAL_ERROR_TRANSFORM_PLUGIN_NULL */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
111 "The VisTransform it's video is NULL", /* VISUAL_ERROR_TRANSFORM_VIDEO_NULL */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
112 "The VisTransform it's palette is NULL", /* VISUAL_ERROR_TRANSFORM_PALETTE_NULL */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
113
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
114 "VisObject destruction failed", /* VISUAL_ERROR_OBJECT_DTOR_FAILED */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
115 "VisObject is NULL", /* VISUAL_ERROR_OBJECT_NULL */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
116 "VisObject is not allocated", /* VISUAL_ERROR_OBJECT_NOT_ALLOCATED */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
117
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
118 "VisTime is NULL", /* VISUAL_ERROR_TIME_NULL */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
119 "visual_time_usleep() is not supported", /* VISUAL_ERROR_TIME_NO_USLEEP */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
120 "VisTimer is NULL", /* VISUAL_ERROR_TIMER_NULL */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
121
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
122 "VisUIWidget is NULL", /* VISUAL_ERROR_UI_WIDGET_NULL */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
123 "VisUIContainer is NULL", /* VISUAL_ERROR_UI_CONTAINER_NULL */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
124 "VisUIBox is NULL", /* VISUAL_ERROR_UI_BOX_NULL */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
125 "VisUITable is NULL", /* VISUAL_ERROR_UI_TABLE_NULL */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
126 "VisUIFrame is NULL", /* VISUAL_ERROR_UI_FRAME_NULL */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
127 "VisUILabel is NULL", /* VISUAL_ERROR_UI_LABEL_NULL */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
128 "VisUIImage is NULL", /* VISUAL_ERROR_UI_IMAGE_NULL */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
129 "VisUISeparator is NULL", /* VISUAL_ERROR_UI_SEPARATOR_NULL */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
130 "VisUIMutator is NULL", /* VISUAL_ERROR_UI_MUTATOR_NULL */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
131 "VisUIRange is NULL", /* VISUAL_ERROR_UI_RANGE_NULL */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
132 "VisUIEntry is NULL", /* VISUAL_ERROR_UI_ENTRY_NULL */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
133 "VisUISlider is NULL", /* VISUAL_ERROR_UI_SLIDER_NULL */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
134 "VisUINumeric is NULL", /* VISUAL_ERROR_UI_NUMERIC_NULL */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
135 "VisUIColor is NULL", /* VISUAL_ERROR_UI_COLOR_NULL */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
136 "VisUIChoice is NULL", /* VISUAL_ERROR_UI_CHOICE_NULL */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
137 "VisUIPopup is NULL", /* VISUAL_ERROR_UI_POPUP_NULL */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
138 "VisUIList is NULL", /* VISUAL_ERROR_UI_LIST_NULL */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
139 "VisUIRadio is NULL", /* VISUAL_ERROR_UI_RADIO_NULL */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
140 "VisUICheckbox is NULL", /* VISUAL_ERROR_UI_CHECKBOX_NULL */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
141 "VisUIChoiceEntry is NULL", /* VISUAL_ERROR_UI_CHOICE_ENTRY_NULL */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
142 "No choice in VisUIChoice is activated", /* VISUAL_ERROR_UI_CHOICE_NONE_ACTIVE */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
143
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
144 "VisVideo is NULL", /* VISUAL_ERROR_VIDEO_NULL */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
145 "VisVideo has allocated pixel buffer", /* VISUAL_ERROR_VIDEO_HAS_ALLOCATED */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
146 "VisVideo it's pixel buffer is NULL", /* VISUAL_ERROR_VIDEO_PIXELS_NULL */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
147 "VisVideo it's pixel buffer is not allocated", /* VISUAL_ERROR_VIDEO_NO_ALLOCATED */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
148 "VisVideo has pixel buffer", /* VISUAL_ERROR_VIDEO_HAS_PIXELS */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
149 "VisVideo is of invalid bytes per pixel", /* VISUAL_ERROR_VIDEO_INVALID_BPP */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
150 "VisVideo is of invalid depth", /* VISUAL_ERROR_VIDEO_INVALID_DEPTH */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
151 "Invalid scale method given", /* VISUAL_ERROR_VIDEO_INVALID_SCALE_METHOD */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
152 "Given coordinates are out of bounds", /* VISUAL_ERROR_VIDEO_OUT_OF_BOUNDS */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
153 "Given VisVideos are not indentical", /* VISUAL_ERROR_VIDEO_NOT_INDENTICAL */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
154 "VisVideo is not depth transformed as requested" /* VISUAL_ERROR_VIDEO_NOT_TRANSFORMED */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
155 };
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
156
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
157 static VisErrorHandlerFunc error_handler = NULL;
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
158 static void *error_handler_priv = NULL;
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
159
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
160 /**
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
161 * @defgroup VisError VisError
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
162 * @{
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
163 */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
164
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
165 /**
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
166 * Raise a libvisual error. With the standard error handler this will
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
167 * do a raise(SIGTRAP). You can set your own error handler function using the
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
168 * visual_error_set_handler.
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
169 *
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
170 * @see visual_error_set_handler
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
171 *
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
172 * @return Returns the return value from the handler that is set.
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
173 */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
174 int visual_error_raise ()
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
175 {
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
176 if (error_handler == NULL) {
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
177 raise (SIGTRAP);
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
178 exit (1);
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
179 }
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
180
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
181 return error_handler (error_handler_priv);
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
182 }
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
183
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
184 /**
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
185 * Sets the error handler callback. By using this function you
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
186 * can override libvisual it's default error handler.
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
187 *
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
188 * @param handler The error handler which you want to use
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
189 * to handle libvisual errors.
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
190 * @param priv Optional private data which could be needed in the
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
191 * error handler that has been set.
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
192 *
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
193 * @return VISUAL_OK on succes, -VISUAL_ERROR_ERROR_HANDLER_NULL on failure.
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
194 */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
195 int visual_error_set_handler (VisErrorHandlerFunc handler, void *priv)
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
196 {
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
197 visual_log_return_val_if_fail (handler != NULL, -VISUAL_ERROR_ERROR_HANDLER_NULL);
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
198
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
199 error_handler = handler;
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
200 error_handler_priv = priv;
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
201
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
202 return VISUAL_OK;
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
203 }
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
204
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
205 /**
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
206 * Translates an error into a human readable string, the returned string should not be freed.
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
207 *
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
208 * @param err Numeric error value.
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
209 *
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
210 * @return Human readable string, or NULL on failure.
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
211 */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
212 const char *visual_error_to_string (int err)
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
213 {
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
214 if (abs (err) >= VISUAL_ERROR_LIST_END)
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
215 return "The error value given to visual_error_to_string() is invalid";
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
216
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
217 return __lv_error_human_readable[abs (err)];
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
218 }
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
219
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
220 /**
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
221 * @}
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
222 */
0db4a1dc75c4 [svn] libvisual.
nenolod
parents:
diff changeset
223