Skip to content

Commit 72408c1

Browse files
Added a debug log macro.
1 parent f662aed commit 72408c1

3 files changed

Lines changed: 44 additions & 0 deletions

File tree

Classes/GADebugMacros.h

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
Copyright (c) 2011 Andrew Goodale. All rights reserved.
3+
4+
Redistribution and use in source and binary forms, with or without modification, are
5+
permitted provided that the following conditions are met:
6+
7+
1. Redistributions of source code must retain the above copyright notice, this list of
8+
conditions and the following disclaimer.
9+
10+
2. Redistributions in binary form must reproduce the above copyright notice, this list
11+
of conditions and the following disclaimer in the documentation and/or other materials
12+
provided with the distribution.
13+
14+
THIS SOFTWARE IS PROVIDED BY ANDREW GOODALE "AS IS" AND ANY EXPRESS OR IMPLIED
15+
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
16+
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> OR
17+
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18+
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
19+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
20+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
21+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
22+
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23+
24+
The views and conclusions contained in the software and documentation are those of the
25+
authors and should not be interpreted as representing official policies, either expressed
26+
or implied, of Andrew Goodale.
27+
*/
28+
29+
#if DEBUG
30+
31+
#define GADebugStr(format, ...) CFShow([NSString stringWithFormat:format, ## __VA_ARGS__])
32+
33+
#else
34+
35+
#define GADebugStr(format, ...)
36+
37+
#endif

GAJavaScript.xcodeproj/project.pbxproj

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
2D8500AE1381647F00758EA2 /* GAScriptEngine.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D8500AC1381647F00758EA2 /* GAScriptEngine.h */; settings = {ATTRIBUTES = (Public, ); }; };
1515
2D8500AF1381647F00758EA2 /* GAScriptEngine.m in Sources */ = {isa = PBXBuildFile; fileRef = 2D8500AD1381647F00758EA2 /* GAScriptEngine.m */; };
1616
2D8500B213816B2100758EA2 /* TestWebViewContent.html in Resources */ = {isa = PBXBuildFile; fileRef = 2D8500B113816B2100758EA2 /* TestWebViewContent.html */; };
17+
2D9106E41427E5F0002062A1 /* GADebugMacros.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D9106E31427E5F0002062A1 /* GADebugMacros.h */; settings = {ATTRIBUTES = (Public, ); }; };
1718
2DBE365513BDF04200E9AA11 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2DBE365413BDF04200E9AA11 /* QuartzCore.framework */; };
1819
2DBE365B13BDFC1A00E9AA11 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2DBE365413BDF04200E9AA11 /* QuartzCore.framework */; };
1920
2DBE365F13BDFCA700E9AA11 /* TViewStyling.m in Sources */ = {isa = PBXBuildFile; fileRef = 2DBE365E13BDFCA700E9AA11 /* TViewStyling.m */; };
@@ -63,6 +64,7 @@
6364
2D8500AC1381647F00758EA2 /* GAScriptEngine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GAScriptEngine.h; path = Classes/GAScriptEngine.h; sourceTree = "<group>"; };
6465
2D8500AD1381647F00758EA2 /* GAScriptEngine.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = GAScriptEngine.m; path = Classes/GAScriptEngine.m; sourceTree = "<group>"; };
6566
2D8500B113816B2100758EA2 /* TestWebViewContent.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = TestWebViewContent.html; path = Tests/TestWebViewContent.html; sourceTree = "<group>"; };
67+
2D9106E31427E5F0002062A1 /* GADebugMacros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GADebugMacros.h; path = Classes/GADebugMacros.h; sourceTree = "<group>"; };
6668
2DBE365413BDF04200E9AA11 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
6769
2DBE365D13BDFCA700E9AA11 /* TViewStyling.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TViewStyling.h; path = Tests/TViewStyling.h; sourceTree = "<group>"; };
6870
2DBE365E13BDFCA700E9AA11 /* TViewStyling.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TViewStyling.m; path = Tests/TViewStyling.m; sourceTree = "<group>"; };
@@ -161,6 +163,7 @@
161163
08FB77AEFE84172EC02AAC07 /* Classes */ = {
162164
isa = PBXGroup;
163165
children = (
166+
2D9106E31427E5F0002062A1 /* GADebugMacros.h */,
164167
2D8500AC1381647F00758EA2 /* GAScriptEngine.h */,
165168
2D8500AD1381647F00758EA2 /* GAScriptEngine.m */,
166169
49F1DBDA12A3F64A004C8736 /* GAScriptObject.h */,
@@ -246,6 +249,7 @@
246249
2DC139F013B3CF4A0026D4D5 /* UIView+GAViewStyling.h in Headers */,
247250
2D44767713BB3F8B00A2E101 /* GAViewStyling.h in Headers */,
248251
49F0724F1405AC0D006E7A51 /* UIControl+GAViewStyling.h in Headers */,
252+
2D9106E41427E5F0002062A1 /* GADebugMacros.h in Headers */,
249253
);
250254
runOnlyForDeploymentPostprocessing = 0;
251255
};
@@ -379,6 +383,7 @@
379383
GCC_OPTIMIZATION_LEVEL = 0;
380384
GCC_PRECOMPILE_PREFIX_HEADER = YES;
381385
GCC_PREFIX_HEADER = GAJavaScript_Prefix.pch;
386+
GCC_PREPROCESSOR_DEFINITIONS = DEBUG;
382387
INSTALL_PATH = "$(BUILT_PRODUCTS_DIR)";
383388
PRODUCT_NAME = GAJavaScript;
384389
PUBLIC_HEADERS_FOLDER_PATH = GAJavaScript;

GAJavaScript_Prefix.pch

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@
77
#import <QuartzCore/QuartzCore.h>
88
#import <UIKit/UIKit.h>
99
#endif
10+
11+
#include "GADebugMacros.h"

0 commit comments

Comments
 (0)