summaryrefslogtreecommitdiffstats
path: root/macosx/tkMacOSXInt.h
diff options
context:
space:
mode:
authordas <das>2007-06-06 21:23:56 (GMT)
committerdas <das>2007-06-06 21:23:56 (GMT)
commitcc607d87ed119887d845f3efd3f2e5357aa6fda6 (patch)
treec2314ee9ee30baf49f9a1f81868c3393efa0cd1a /macosx/tkMacOSXInt.h
parentce5acb5ed756f94b279f428e363bb885ab971d01 (diff)
downloadtk-cc607d87ed119887d845f3efd3f2e5357aa6fda6.zip
tk-cc607d87ed119887d845f3efd3f2e5357aa6fda6.tar.gz
tk-cc607d87ed119887d845f3efd3f2e5357aa6fda6.tar.bz2
* macosx/tkMacOSXInt.h: use native debug message API when available.
Diffstat (limited to 'macosx/tkMacOSXInt.h')
-rw-r--r--macosx/tkMacOSXInt.h20
1 files changed, 18 insertions, 2 deletions
diff --git a/macosx/tkMacOSXInt.h b/macosx/tkMacOSXInt.h
index 30cb431..1cadc52 100644
--- a/macosx/tkMacOSXInt.h
+++ b/macosx/tkMacOSXInt.h
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMacOSXInt.h,v 1.3.2.18 2007/06/06 09:56:54 das Exp $
+ * RCS: @(#) $Id: tkMacOSXInt.h,v 1.3.2.19 2007/06/06 21:23:57 das Exp $
*/
#ifndef _TKMACINT
@@ -20,6 +20,8 @@
#include "tkInt.h"
#endif
+#define kComponentSignatureString "TkMacOSX"
+#define COMPONENT_SIGNATURE 'Tk '
#define TextStyle MacTextStyle
#include <Carbon/Carbon.h>
#undef TextStyle
@@ -269,13 +271,26 @@ typedef struct TkMacOSXDrawingContext {
__LINE__, __func__, ##__VA_ARGS__); \
} while (0)
/*
+ * Macro to do debug API failure message output.
+ */
+#if !defined(DEBUGLEVEL) || !DEBUGLEVEL
+#define TkMacOSXDbgOSErr(f, err) do { \
+ TkMacOSXDbgMsg("%s failed: %ld", #f, err); \
+ } while (0)
+#else
+#define TkMacOSXDbgOSErr(f, err) do { \
+ DEBUG_ASSERT_MESSAGE(kComponentSignatureString, #f " failed:", \
+ __func__, 0, strrchr(__FILE__, '/')+1, __LINE__, err); \
+ } while (0)
+#endif
+/*
* Macro to do very common check for noErr return from given API and output
* debug message in case of failure.
*/
#define ChkErr(f, ...) ({ \
OSStatus err = f(__VA_ARGS__); \
if (err != noErr) { \
- TkMacOSXDbgMsg("%s failed: %ld", #f, err); \
+ TkMacOSXDbgOSErr(f, err); \
} \
err;})
/*
@@ -288,6 +303,7 @@ typedef struct TkMacOSXDrawingContext {
} while(0)
#else /* TK_MAC_DEBUG */
#define TkMacOSXDbgMsg(m, ...)
+#define TkMacOSXDbgOSErr(f, err)
#define ChkErr(f, ...) ({f(__VA_ARGS__);})
#define TkMacOSXCheckTmpRgnEmpty(r)
#endif /* TK_MAC_DEBUG */