33// DDG Library
44//
55// Created by Andrew Donoho on 2009/05/23.
6- // Copyright 2009-2012 Donoho Design Group, L.L.C. All rights reserved.
6+ // Copyright 2009-2014 Donoho Design Group, L.L.C. All rights reserved.
77//
88
99/*
1212 personalizations.
1313 <http://www.opensource.org/licenses/bsd-license.php>
1414
15- Copyright (C) 2009-2012 Donoho Design Group, LLC. All Rights Reserved.
15+ Copyright (C) 2009-2014 Donoho Design Group, LLC. All Rights Reserved.
1616
1717 Redistribution and use in source and binary forms, with or without
1818 modification, are permitted provided that the following conditions are
4343
4444 */
4545
46- #import < Foundation/Foundation.h>
47-
4846#import " DDGMacros.h"
4947
5048#ifdef TESTFLIGHT
6765NSString *const kFalse = @" false" ;
6866const NSTimeInterval kDefaultDuration = 0.25 ;
6967
68+ @implementation DDGMacros
69+
70+ #define kLog (@selector (log: ))
71+ + (void ) log : (NSNotification *) notification {
72+
73+ NSLog (@" Notification Name: %@ ;\n\t Object: %@ ;\n\t UserInfo: %@ ." ,
74+ notification.name , notification.object , notification.userInfo );
75+
76+ } // +log:
77+
78+
79+ + (void ) logAllNotifications {
80+
81+ NSNotificationCenter *nc = NSNotificationCenter .defaultCenter ;
82+
83+ [nc removeObserver: self ];
84+
85+ [nc addObserver: self selector: kLog name: nil object: nil ];
86+
87+ } // +logAllNotifications
88+
89+ @end
90+
91+
7092void _DDGTrace (const char *name, int line) {
7193
7294 NSLog (@" %s (%d )" , name, line);
@@ -80,10 +102,7 @@ void _DDGDesc(const char *name, int line, id object) {
80102
81103 NSLog (@" %s (%d )\n Description: %@ " , name, line, object);
82104 }
83- else {
84-
85- NSLog (@" %s (%d )" , name, line);
86- }
105+ else { NSLog (@" %s (%d )" , name, line); }
87106
88107} // _DDGDesc()
89108
@@ -117,68 +136,6 @@ void _DDGLog(const char *name, int line, NSString *format, ...) {
117136} // _DDGLog()
118137
119138
120- void _logViews (UIView *parent);
121- void _logViews (UIView *parent) {
122-
123- NSLog (@" \n\t Parent Class: %@ ; Subviews: %d \n ---------" ,
124- NSStringFromClass (parent.class ), parent.subviews .count );
125-
126- for (UIView *v in parent.subviews ) {
127-
128- NSLog (@" \n\t Class: %@ \n\t Frame: %@ \n\t Bounds: %@ " ,
129- NSStringFromClass ( v.class ),
130- NSStringFromCGRect (v.frame),
131- NSStringFromCGRect(v.bounds));
132-
133- _logViews (v); // Print the subviews.
134- }
135-
136- } // _logViews()
137-
138-
139- void _logSubviews (const char *name, int line, UIView *parent) {
140-
141- NSLog (@" %s (%d )\n " , name, line);
142- if (parent) {
143-
144- _logViews (parent);
145- }
146-
147- } // _logSubviews()
148-
149-
150- NSUInteger _countViews (UIView *parent);
151- NSUInteger _countViews (UIView *parent) {
152-
153- if (parent.subviews .count ) {
154-
155- NSUInteger count = 0 ;
156-
157- for (UIView *v in parent.subviews ) {
158-
159- count += _countViews (v);
160- }
161- return count;
162- }
163- else {
164-
165- return 1 ;
166- }
167-
168- } // countViews_()
169-
170-
171- NSUInteger _countSubviews (const char *name, int line, UIView *parent) {
172-
173- if (parent) {
174-
175- return _countViews (parent);
176- }
177- return 0 ;
178-
179- } // _countSubviews()
180-
181-
182139void _DDGDebugger (const char *name, int line) {
183140
184141 NSLog (@" %s (%d )" , name, line);
@@ -190,28 +147,28 @@ uint8_t htoc(char h) {
190147
191148 switch (h) {
192149
193- case ' 0' : return 0x0 ; break ;
194- case ' 1' : return 0x1 ; break ;
195- case ' 2' : return 0x2 ; break ;
196- case ' 3' : return 0x3 ; break ;
197- case ' 4' : return 0x4 ; break ;
198- case ' 5' : return 0x5 ; break ;
199- case ' 6' : return 0x6 ; break ;
200- case ' 7' : return 0x7 ; break ;
201- case ' 8' : return 0x8 ; break ;
202- case ' 9' : return 0x9 ; break ;
203- case ' a' : return 0xa ; break ;
204- case ' b' : return 0xb ; break ;
205- case ' c' : return 0xc ; break ;
206- case ' d' : return 0xd ; break ;
207- case ' e' : return 0xe ; break ;
208- case ' f' : return 0xf ; break ;
209- case ' A' : return 0xa ; break ;
210- case ' B' : return 0xb ; break ;
211- case ' C' : return 0xc ; break ;
212- case ' D' : return 0xd ; break ;
213- case ' E' : return 0xe ; break ;
214- case ' F' : return 0xf ; break ;
150+ case ' 0' : return 0x0 ;
151+ case ' 1' : return 0x1 ;
152+ case ' 2' : return 0x2 ;
153+ case ' 3' : return 0x3 ;
154+ case ' 4' : return 0x4 ;
155+ case ' 5' : return 0x5 ;
156+ case ' 6' : return 0x6 ;
157+ case ' 7' : return 0x7 ;
158+ case ' 8' : return 0x8 ;
159+ case ' 9' : return 0x9 ;
160+ case ' a' : return 0xa ;
161+ case ' b' : return 0xb ;
162+ case ' c' : return 0xc ;
163+ case ' d' : return 0xd ;
164+ case ' e' : return 0xe ;
165+ case ' f' : return 0xf ;
166+ case ' A' : return 0xa ;
167+ case ' B' : return 0xb ;
168+ case ' C' : return 0xc ;
169+ case ' D' : return 0xd ;
170+ case ' E' : return 0xe ;
171+ case ' F' : return 0xf ;
215172 default : return 0xff ;
216173 }
217174
@@ -222,22 +179,22 @@ char ctoh(uint8_t c) {
222179
223180 switch (c) {
224181
225- case 0x0 : return ' 0' ; break ;
226- case 0x1 : return ' 1' ; break ;
227- case 0x2 : return ' 2' ; break ;
228- case 0x3 : return ' 3' ; break ;
229- case 0x4 : return ' 4' ; break ;
230- case 0x5 : return ' 5' ; break ;
231- case 0x6 : return ' 6' ; break ;
232- case 0x7 : return ' 7' ; break ;
233- case 0x8 : return ' 8' ; break ;
234- case 0x9 : return ' 9' ; break ;
235- case 0xa : return ' a' ; break ;
236- case 0xb : return ' b' ; break ;
237- case 0xc : return ' c' ; break ;
238- case 0xd : return ' d' ; break ;
239- case 0xe : return ' e' ; break ;
240- case 0xf : return ' f' ; break ;
182+ case 0x0 : return ' 0' ;
183+ case 0x1 : return ' 1' ;
184+ case 0x2 : return ' 2' ;
185+ case 0x3 : return ' 3' ;
186+ case 0x4 : return ' 4' ;
187+ case 0x5 : return ' 5' ;
188+ case 0x6 : return ' 6' ;
189+ case 0x7 : return ' 7' ;
190+ case 0x8 : return ' 8' ;
191+ case 0x9 : return ' 9' ;
192+ case 0xa : return ' a' ;
193+ case 0xb : return ' b' ;
194+ case 0xc : return ' c' ;
195+ case 0xd : return ' d' ;
196+ case 0xe : return ' e' ;
197+ case 0xf : return ' f' ;
241198 default : return 0xff ;
242199 }
243200
0 commit comments