QCAD
Open Source 2D CAD
Loading...
Searching...
No Matches
opennurbs_error.h
Go to the documentation of this file.
1/* $NoKeywords: $ */
2/*
3//
4// Copyright (c) 1993-2007 Robert McNeel & Associates. All rights reserved.
5// Rhinoceros is a registered trademark of Robert McNeel & Assoicates.
6//
7// THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8// ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9// MERCHANTABILITY ARE HEREBY DISCLAIMED.
10//
11// For complete openNURBS copyright information see <http://www.opennurbs.org>.
12//
14*/
15
16#if !defined(OPENNURBS_ERROR_INC_)
17#define OPENNURBS_ERROR_INC_
18
19/*
20// Macros used to log errors and warnings. The ON_Warning() and ON_Error()
21// functions are defined in opennurbs_error.cpp.
22*/
23
24#define ON_ERROR(msg) ON_Error(__FILE__,__LINE__,msg)
25#define ON_WARNING(msg) ON_Warning(__FILE__,__LINE__,msg)
26
27// 15 May 2008 Dale Lear
28// Never, ever, make system error handling macros that work
29// differently in release and debug builds.
30//#if defined(ON_DEBUG)
31#define ON_ASSERT(cond) ON_Assert(cond,__FILE__,__LINE__, #cond " is false")
32#define ON_ASSERT_OR_RETURN(cond,returncode) do{if (!(cond)) {ON_Assert(false,__FILE__,__LINE__, #cond " is false");return(returncode);}}while(0)
33//#else
34//#define ON_ASSERT(cond)
35//#define ON_ASSERT_OR_RETURN(cond,returncode) do{if (!(cond)) return(returncode);}while(0)
36//#endif
37
39
40/*
41// All error/warning messages are sent to ON_ErrorMessage(). Replace the
42// default handler (defined in opennurbs_error_message.cpp) with something
43// that is appropriate for debugging your application.
44*/
46void ON_ErrorMessage(
47 int, /* 0 = warning message, 1 = serious error message, 2 = assert failure */
48 const char*
49 );
50
51/*
52Returns:
53 Number of opennurbs errors since program started.
54*/
56int ON_GetErrorCount(void);
57
58/*
59Returns:
60 Number of opennurbs warnings since program started.
61*/
63int ON_GetWarningCount(void);
64
65/*
66Returns:
67 Number of math library or floating point errors that have
68 been handled since program started.
69*/
71int ON_GetMathErrorCount(void);
72
74int ON_GetDebugBreak(void);
76void ON_EnableDebugBreak( int bEnableDebugBreak );
77
81void ON_EnableDebugBreakOnFirstError( int bEnableDebugBreak );
82
86void ON_EnableDebugErrorMessage( int bEnableDebugErrorMessage );
87
89void ON_Error( const char*, /* sFileName: __FILE__ will do fine */
90 int, /* line number: __LINE__ will do fine */
91 const char*, /* printf() style format string */
92 ... /* printf() style ags */
93 );
95void ON_Warning( const char*, /* sFileName: __FILE__ will do fine */
96 int, /* line number: __LINE__ will do fine */
97 const char*, /* printf() style format string */
98 ... /* printf() style ags */
99 );
101void ON_Assert( int, /* if false, execution is halted in debugged code */
102 const char*, /* sFileName: __FILE__ will do fine */
103 int, /* line number: __LINE__ will do fine */
104 const char*, /* printf() style format string */
105 ... /* printf() style ags */
106 );
108void ON_MathError(
109 const char*, /* sModuleName */
110 const char*, /* sErrorType */
111 const char* /* sFunctionName */
112 );
113
115
116#endif
#define ON_BEGIN_EXTERNC
Definition opennurbs_defines.h:40
#define ON_DECL
Definition opennurbs_defines.h:92
#define ON_END_EXTERNC
Definition opennurbs_defines.h:41
ON_DECL void ON_EnableDebugBreakOnFirstError(int bEnableDebugBreak)
Definition opennurbs_error.cpp:88
ON_DECL void ON_MathError(const char *, const char *, const char *)
Definition opennurbs_error.cpp:112
ON_BEGIN_EXTERNC ON_DECL void ON_ErrorMessage(int, const char *)
Definition opennurbs_error_message.cpp:19
ON_DECL void ON_EnableDebugErrorMessage(int bEnableDebugErrorMessage)
Definition opennurbs_error.cpp:99
ON_DECL void ON_Warning(const char *, int, const char *,...)
Definition opennurbs_error.cpp:173
ON_DECL int ON_GetDebugBreakOnFirstError(void)
Definition opennurbs_error.cpp:83
ON_DECL int ON_GetMathErrorCount(void)
Definition opennurbs_error.cpp:67
ON_DECL int ON_GetDebugErrorMessage(void)
Definition opennurbs_error.cpp:93
ON_DECL int ON_GetErrorCount(void)
Definition opennurbs_error.cpp:56
ON_DECL void ON_Error(const char *, int, const char *,...)
Definition opennurbs_error.cpp:136
ON_DECL int ON_GetWarningCount(void)
Definition opennurbs_error.cpp:62
ON_DECL int ON_GetDebugBreak(void)
Definition opennurbs_error.cpp:72
ON_DECL void ON_EnableDebugBreak(int bEnableDebugBreak)
Definition opennurbs_error.cpp:78
ON_DECL void ON_Assert(int, const char *, int, const char *,...)
Definition opennurbs_error.cpp:211