aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/ode-0.9/ode/src/error.cpp
diff options
context:
space:
mode:
authordan miller2007-10-19 05:20:07 +0000
committerdan miller2007-10-19 05:20:07 +0000
commitfca74b0bf0a0833f5701e9c0de7b3bc15b2233dd (patch)
tree51bcae7a1b8381a6bf6fd8025a7de1e30fe0045d /libraries/ode-0.9/ode/src/error.cpp
parentresubmitting ode (diff)
downloadopensim-SC-fca74b0bf0a0833f5701e9c0de7b3bc15b2233dd.zip
opensim-SC-fca74b0bf0a0833f5701e9c0de7b3bc15b2233dd.tar.gz
opensim-SC-fca74b0bf0a0833f5701e9c0de7b3bc15b2233dd.tar.bz2
opensim-SC-fca74b0bf0a0833f5701e9c0de7b3bc15b2233dd.tar.xz
dont ask
Diffstat (limited to 'libraries/ode-0.9/ode/src/error.cpp')
-rw-r--r--libraries/ode-0.9/ode/src/error.cpp172
1 files changed, 0 insertions, 172 deletions
diff --git a/libraries/ode-0.9/ode/src/error.cpp b/libraries/ode-0.9/ode/src/error.cpp
deleted file mode 100644
index 9b33db5..0000000
--- a/libraries/ode-0.9/ode/src/error.cpp
+++ /dev/null
@@ -1,172 +0,0 @@
1/*************************************************************************
2 * *
3 * Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. *
4 * All rights reserved. Email: russ@q12.org Web: www.q12.org *
5 * *
6 * This library is free software; you can redistribute it and/or *
7 * modify it under the terms of EITHER: *
8 * (1) The GNU Lesser General Public License as published by the Free *
9 * Software Foundation; either version 2.1 of the License, or (at *
10 * your option) any later version. The text of the GNU Lesser *
11 * General Public License is included with this library in the *
12 * file LICENSE.TXT. *
13 * (2) The BSD-style license that is included with this library in *
14 * the file LICENSE-BSD.TXT. *
15 * *
16 * This library is distributed in the hope that it will be useful, *
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
19 * LICENSE.TXT and LICENSE-BSD.TXT for more details. *
20 * *
21 *************************************************************************/
22
23#include <ode/config.h>
24#include <ode/error.h>
25
26
27static dMessageFunction *error_function = 0;
28static dMessageFunction *debug_function = 0;
29static dMessageFunction *message_function = 0;
30
31
32extern "C" void dSetErrorHandler (dMessageFunction *fn)
33{
34 error_function = fn;
35}
36
37
38extern "C" void dSetDebugHandler (dMessageFunction *fn)
39{
40 debug_function = fn;
41}
42
43
44extern "C" void dSetMessageHandler (dMessageFunction *fn)
45{
46 message_function = fn;
47}
48
49
50extern "C" dMessageFunction *dGetErrorHandler()
51{
52 return error_function;
53}
54
55
56extern "C" dMessageFunction *dGetDebugHandler()
57{
58 return debug_function;
59}
60
61
62extern "C" dMessageFunction *dGetMessageHandler()
63{
64 return message_function;
65}
66
67
68static void printMessage (int num, const char *msg1, const char *msg2,
69 va_list ap)
70{
71 fflush (stderr);
72 fflush (stdout);
73 if (num) fprintf (stderr,"\n%s %d: ",msg1,num);
74 else fprintf (stderr,"\n%s: ",msg1);
75 vfprintf (stderr,msg2,ap);
76 fprintf (stderr,"\n");
77 fflush (stderr);
78}
79
80//****************************************************************************
81// unix
82
83#ifndef WIN32
84
85extern "C" void dError (int num, const char *msg, ...)
86{
87 va_list ap;
88 va_start (ap,msg);
89 if (error_function) error_function (num,msg,ap);
90 else printMessage (num,"ODE Error",msg,ap);
91 exit (1);
92}
93
94
95extern "C" void dDebug (int num, const char *msg, ...)
96{
97 va_list ap;
98 va_start (ap,msg);
99 if (debug_function) debug_function (num,msg,ap);
100 else printMessage (num,"ODE INTERNAL ERROR",msg,ap);
101 // *((char *)0) = 0; ... commit SEGVicide
102 abort();
103}
104
105
106extern "C" void dMessage (int num, const char *msg, ...)
107{
108 va_list ap;
109 va_start (ap,msg);
110 if (message_function) message_function (num,msg,ap);
111 else printMessage (num,"ODE Message",msg,ap);
112}
113
114#endif
115
116//****************************************************************************
117// windows
118
119#ifdef WIN32
120
121// isn't cygwin annoying!
122#ifdef CYGWIN
123#define _snprintf snprintf
124#define _vsnprintf vsnprintf
125#endif
126
127
128#include "windows.h"
129
130
131extern "C" void dError (int num, const char *msg, ...)
132{
133 va_list ap;
134 va_start (ap,msg);
135 if (error_function) error_function (num,msg,ap);
136 else {
137 char s[1000],title[100];
138 _snprintf (title,sizeof(title),"ODE Error %d",num);
139 _vsnprintf (s,sizeof(s),msg,ap);
140 s[sizeof(s)-1] = 0;
141 MessageBox(0,s,title,MB_OK | MB_ICONWARNING);
142 }
143 exit (1);
144}
145
146
147extern "C" void dDebug (int num, const char *msg, ...)
148{
149 va_list ap;
150 va_start (ap,msg);
151 if (debug_function) debug_function (num,msg,ap);
152 else {
153 char s[1000],title[100];
154 _snprintf (title,sizeof(title),"ODE INTERNAL ERROR %d",num);
155 _vsnprintf (s,sizeof(s),msg,ap);
156 s[sizeof(s)-1] = 0;
157 MessageBox(0,s,title,MB_OK | MB_ICONSTOP);
158 }
159 abort();
160}
161
162
163extern "C" void dMessage (int num, const char *msg, ...)
164{
165 va_list ap;
166 va_start (ap,msg);
167 if (message_function) message_function (num,msg,ap);
168 else printMessage (num,"ODE Message",msg,ap);
169}
170
171
172#endif