Debian Codegraph @

architecture/AU/PublicUtility/CALogMacros.h

raw symbols SCIP
1 /*
2 File: CALogMacros.h
3 Abstract: Part of CoreAudio Utility Classes
4 Version: 1.01
5
6 Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
7 Inc. ("Apple") in consideration of your agreement to the following
8 terms, and your use, installation, modification or redistribution of
9 this Apple software constitutes acceptance of these terms. If you do
10 not agree with these terms, please do not use, install, modify or
11 redistribute this Apple software.
12
13 In consideration of your agreement to abide by the following terms, and
14 subject to these terms, Apple grants you a personal, non-exclusive
15 license, under Apple's copyrights in this original Apple software (the
16 "Apple Software"), to use, reproduce, modify and redistribute the Apple
17 Software, with or without modifications, in source and/or binary forms;
18 provided that if you redistribute the Apple Software in its entirety and
19 without modifications, you must retain this notice and the following
20 text and disclaimers in all such redistributions of the Apple Software.
21 Neither the name, trademarks, service marks or logos of Apple Inc. may
22 be used to endorse or promote products derived from the Apple Software
23 without specific prior written permission from Apple. Except as
24 expressly stated in this notice, no other rights or licenses, express or
25 implied, are granted by Apple herein, including but not limited to any
26 patent rights that may be infringed by your derivative works or by other
27 works in which the Apple Software may be incorporated.
28
29 The Apple Software is provided by Apple on an "AS IS" basis. APPLE
30 MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
31 THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
32 FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
33 OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
34
35 IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
36 OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
37 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
38 INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,
39 MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED
40 AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
41 STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
42 POSSIBILITY OF SUCH DAMAGE.
43
44 Copyright (C) 2012 Apple Inc. All Rights Reserved.
45
46 */
47 #if !defined(__CALogMacros_h__)
48 #define __CALogMacros_h__
49
50 //=============================================================================
51 // Log Macros
52 //=============================================================================
53
54 #if CoreAudio_Debug
55
56 #include "CADebugMacros.h"
57 #include "CADebugPrintf.h"
58 #include <stdio.h>
59 #include <string.h>
60
61 #define PrintLine(msg) DebugPrintfRtn(DebugPrintfFileComma "%s\n", (msg))
62
63 #define PrintBool(msg, b) DebugPrintfRtn(DebugPrintfFileComma "%s%s\n", (msg), (b) ? "true" : "false")
64 #define PrintIndexedBool(msg, i, b) DebugPrintfRtn(DebugPrintfFileComma " %s %ld: %s\n", (msg), (long)(i), (b) ? "true" : "false")
65
66 #define PrintToggle(msg, b) DebugPrintfRtn(DebugPrintfFileComma "%s%s\n", (msg), (b) ? "on" : "off")
67 #define PrintIndexedToggle(msg, i, b) DebugPrintfRtn(DebugPrintfFileComma " %s %ld: %s\n", (msg), (long)(i), (b) ? "on" : "off")
68
69 #define PrintInt(msg, n) DebugPrintfRtn(DebugPrintfFileComma "%s%ld\n", (msg), (long)(n))
70 #define PrintIndexedInt(msg, i, n) DebugPrintfRtn(DebugPrintfFileComma " %s %ld: %ld\n", (msg), (long)(i), (long)(n))
71
72 #define PrintHex(msg, n) DebugPrintfRtn(DebugPrintfFileComma "%s0x%lX\n", (msg), (unsigned long)(n))
73 #define PrintIndexedHex(msg, i, n) DebugPrintfRtn(DebugPrintfFileComma " %s %ld: 0x%lX\n", (msg), (long)(i), (unsigned long)(n))
74
75 #define PrintFloat(msg, f) DebugPrintfRtn(DebugPrintfFileComma "%s%.6f\n", (msg), (f))
76 #define PrintIndexedFloat(msg, i, f) DebugPrintfRtn(DebugPrintfFileComma " %s %ld: %.6f\n", (msg), (long)(i), (f))
77 #define PrintFloatIndexedFloat(msg, i, f) DebugPrintfRtn(DebugPrintfFileComma " %s %.6f: %.6f\n", (msg), (i), (f))
78
79 #define PrintString(msg, s) DebugPrintfRtn(DebugPrintfFileComma "%s%s\n", (msg), (s))
80 #define PrintIndexedString(msg, i, s) DebugPrintfRtn(DebugPrintfFileComma " %s %ld: %s\n", (msg), (long)(i), (s))
81
82 #define PrintPointer(msg, p) DebugPrintfRtn(DebugPrintfFileComma "%s%p\n", (msg), (p))
83 #define PrintIndexedPointer(msg, i, p) DebugPrintfRtn(DebugPrintfFileComma " %s %ld: %p\n", (msg), (long)(i), (p))
84
85 #define Print4CharCode(msg, c) { \
86 UInt32 __4CC_number = (c); \
87 char __4CC_string[5] = CA4CCToCString(__4CC_number); \
88 DebugPrintfRtn(DebugPrintfFileComma "%s'%s'\n", (msg), __4CC_string); \
89 }
90 #define PrintIndexed4CharCode(msg, i, c) { \
91 UInt32 __4CC_number = (c); \
92 char __4CC_string[5] = CA4CCToCString(__4CC_number); \
93 DebugPrintfRtn(DebugPrintfFileComma " %s %ld: '%s'\n", (msg), (long)(i), __4CC_string); \
94 }
95
96 #define ErrorLine(s) DebugPrintfRtn(DebugPrintfFileComma "%s\n", (s))
97 #define OSErrorLine(s, e) { \
98 OSStatus __err_number = (e); \
99 char __err_string[5] = CA4CCToCString(__err_number); \
100 DebugPrintfRtn(DebugPrintfFileComma "%s, OSStatus code: %s\n", (s), __err_string); \
101 }
102
103 #define MessageIfOSError(e, s) if((e) != 0) { OSErrorLine(s, e); }
104 #define MessageIfNULL(p, s) if((p) == 0) { ErrorLine(s); }
105
106 #else
107
108 #define PrintLine(msg)
109
110 #define PrintBool(msg, b) (b)
111 #define PrintIndexedBool(msg, i, b) (b)
112
113 #define PrintInt(msg, n) (n)
114 #define PrintIndexedInt(msg, i, n) (n)
115
116 #define PrintHex(msg, n) (n)
117 #define PrintIndexedHex(msg, i, n) (n)
118
119 #define PrintFloat(msg, f) (f)
120 #define PrintIndexedFloat(msg, i, f) (f)
121 #define PrintFloatIndexedFloat(msg, i, f) (f)
122
123 #define PrintString(msg, s) (s)
124 #define PrintIndexedString(msg, i, s) (s)
125
126 #define PrintPointer(msg, p) (p)
127 #define PrintIndexedPointer(msg, i, p) (p)
128
129 #define Print4CharCode(msg, c) (c)
130 #define PrintIndexed4CharCode(msg, i, c) (c)
131
132 #define ErrorLine(s) (s)
133 #define OSErrorLine(s, e) (e)
134
135 #define MessageIfOSError(e, s) (e)
136 #define MessageIfNULL(p, s) (p)
137
138 #endif // CoreAudio_Debug
139
140 #endif