error.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /*************************************************************************
  2. * *
  3. * Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. *
  4. * All rights reserved. Email: [email protected] 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. /* this comes from the `reuse' library. copy any changes back to the source */
  23. #ifndef _ODE_ERROR_H_
  24. #define _ODE_ERROR_H_
  25. #include <ode/odeconfig.h>
  26. #ifdef __cplusplus
  27. extern "C" {
  28. #endif
  29. /* all user defined error functions have this type. error and debug functions
  30. * should not return.
  31. */
  32. typedef void dMessageFunction (int errnum, const char *msg, va_list ap);
  33. /* set a new error, debug or warning handler. if fn is 0, the default handlers
  34. * are used.
  35. */
  36. ODE_API void dSetErrorHandler (dMessageFunction *fn);
  37. ODE_API void dSetDebugHandler (dMessageFunction *fn);
  38. ODE_API void dSetMessageHandler (dMessageFunction *fn);
  39. /* return the current error, debug or warning handler. if the return value is
  40. * 0, the default handlers are in place.
  41. */
  42. ODE_API dMessageFunction *dGetErrorHandler(void);
  43. ODE_API dMessageFunction *dGetDebugHandler(void);
  44. ODE_API dMessageFunction *dGetMessageHandler(void);
  45. /* generate a fatal error, debug trap or a message. */
  46. ODE_API void dError (int num, const char *msg, ...);
  47. ODE_API void dDebug (int num, const char *msg, ...);
  48. ODE_API void dMessage (int num, const char *msg, ...);
  49. #ifdef __cplusplus
  50. }
  51. #endif
  52. #endif