108 lines
4.9 KiB
Plaintext
108 lines
4.9 KiB
Plaintext
//
|
|
// Prefix header for all source files of the 'MasterPassword' target in the 'MasterPassword' project
|
|
//
|
|
|
|
#import <Availability.h>
|
|
#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_8
|
|
#warning "This project uses features only available in Mac OS X 10.8 and later."
|
|
#endif
|
|
|
|
#import "Pearl-Prefix.pch"
|
|
|
|
#ifdef __OBJC__
|
|
|
|
#import <Cocoa/Cocoa.h>
|
|
#import <Foundation/Foundation.h>
|
|
#import <CoreData/CoreData.h>
|
|
|
|
#ifdef CRASHLYTICS
|
|
#import <Crashlytics/Crashlytics.h>
|
|
#endif
|
|
|
|
#import "MPTypes.h"
|
|
#import "MPMacConfig.h"
|
|
|
|
#else
|
|
|
|
#import <libgen.h>
|
|
#import <CoreFoundation/CFString.h>
|
|
#import <objc/runtime.h>
|
|
#import <objc/message.h>
|
|
#import <objc/NSObjCRuntime.h>
|
|
#import <stdlib.h>
|
|
|
|
#define trc(format, ...) \
|
|
do { \
|
|
char *_msg = NULL; \
|
|
asprintf( &_msg, format, ##__VA_ARGS__ ); \
|
|
void (*_sendMsg)(id, SEL, CFStringRef, NSInteger, CFStringRef, NSUInteger, CFStringRef) = (void *)objc_msgSend; \
|
|
_sendMsg( objc_msgSend( (id)objc_getClass( "PearlLogger" ), sel_getUid( "get" ) ), \
|
|
sel_getUid( "inFile:atLine:fromFunction:withLevel:text:" ), \
|
|
CFStringCreateWithCString( NULL, basename( (char *)__FILE__ ), kCFStringEncodingUTF8 ), __LINE__, \
|
|
CFStringCreateWithCString( NULL, __FUNCTION__, kCFStringEncodingUTF8 ), 0, \
|
|
CFStringCreateWithCString( NULL, _msg, kCFStringEncodingUTF8 ) ); \
|
|
} while (0)
|
|
|
|
#define dbg(format, ...) \
|
|
do { \
|
|
char *_msg = NULL; \
|
|
asprintf( &_msg, format, ##__VA_ARGS__ ); \
|
|
void (*_sendMsg)(id, SEL, CFStringRef, NSInteger, CFStringRef, NSUInteger, CFStringRef) = (void *)objc_msgSend; \
|
|
_sendMsg( objc_msgSend( (id)objc_getClass( "PearlLogger" ), sel_getUid( "get" ) ), \
|
|
sel_getUid( "inFile:atLine:fromFunction:withLevel:text:" ), \
|
|
CFStringCreateWithCString( NULL, basename( (char *)__FILE__ ), kCFStringEncodingUTF8 ), __LINE__, \
|
|
CFStringCreateWithCString( NULL, __FUNCTION__, kCFStringEncodingUTF8 ), 1, \
|
|
CFStringCreateWithCString( NULL, _msg, kCFStringEncodingUTF8 ) ); \
|
|
} while (0)
|
|
|
|
#define inf(format, ...) \
|
|
do { \
|
|
char *_msg = NULL; \
|
|
asprintf( &_msg, format, ##__VA_ARGS__ ); \
|
|
void (*_sendMsg)(id, SEL, CFStringRef, NSInteger, CFStringRef, NSUInteger, CFStringRef) = (void *)objc_msgSend; \
|
|
_sendMsg( objc_msgSend( (id)objc_getClass( "PearlLogger" ), sel_getUid( "get" ) ), \
|
|
sel_getUid( "inFile:atLine:fromFunction:withLevel:text:" ), \
|
|
CFStringCreateWithCString( NULL, basename( (char *)__FILE__ ), kCFStringEncodingUTF8 ), __LINE__, \
|
|
CFStringCreateWithCString( NULL, __FUNCTION__, kCFStringEncodingUTF8 ), 2, \
|
|
CFStringCreateWithCString( NULL, _msg, kCFStringEncodingUTF8 ) ); \
|
|
} while (0)
|
|
|
|
#define wrn(format, ...) \
|
|
do { \
|
|
char *_msg = NULL; \
|
|
asprintf( &_msg, format, ##__VA_ARGS__ ); \
|
|
void (*_sendMsg)(id, SEL, CFStringRef, NSInteger, CFStringRef, NSUInteger, CFStringRef) = (void *)objc_msgSend; \
|
|
_sendMsg( objc_msgSend( (id)objc_getClass( "PearlLogger" ), sel_getUid( "get" ) ), \
|
|
sel_getUid( "inFile:atLine:fromFunction:withLevel:text:" ), \
|
|
CFStringCreateWithCString( NULL, basename( (char *)__FILE__ ), kCFStringEncodingUTF8 ), __LINE__, \
|
|
CFStringCreateWithCString( NULL, __FUNCTION__, kCFStringEncodingUTF8 ), 3, \
|
|
CFStringCreateWithCString( NULL, _msg, kCFStringEncodingUTF8 ) ); \
|
|
} while (0)
|
|
|
|
#define err(format, ...) \
|
|
do { \
|
|
char *_msg = NULL; \
|
|
asprintf( &_msg, format, ##__VA_ARGS__ ); \
|
|
void (*_sendMsg)(id, SEL, CFStringRef, NSInteger, CFStringRef, NSUInteger, CFStringRef) = (void *)objc_msgSend; \
|
|
_sendMsg( objc_msgSend( (id)objc_getClass( "PearlLogger" ), sel_getUid( "get" ) ), \
|
|
sel_getUid( "inFile:atLine:fromFunction:withLevel:text:" ), \
|
|
CFStringCreateWithCString( NULL, basename( (char *)__FILE__ ), kCFStringEncodingUTF8 ), __LINE__, \
|
|
CFStringCreateWithCString( NULL, __FUNCTION__, kCFStringEncodingUTF8 ), 4, \
|
|
CFStringCreateWithCString( NULL, _msg, kCFStringEncodingUTF8 ) ); \
|
|
} while (0)
|
|
|
|
#define ftl(format, ...) \
|
|
do { \
|
|
char *_msg = NULL; \
|
|
asprintf( &_msg, format, ##__VA_ARGS__ ); \
|
|
void (*_sendMsg)(id, SEL, CFStringRef, NSInteger, CFStringRef, NSUInteger, CFStringRef) = (void *)objc_msgSend; \
|
|
_sendMsg( objc_msgSend( (id)objc_getClass( "PearlLogger" ), sel_getUid( "get" ) ), \
|
|
sel_getUid( "inFile:atLine:fromFunction:withLevel:text:" ), \
|
|
CFStringCreateWithCString( NULL, basename( (char *)__FILE__ ), kCFStringEncodingUTF8 ), __LINE__, \
|
|
CFStringCreateWithCString( NULL, __FUNCTION__, kCFStringEncodingUTF8 ), 5, \
|
|
CFStringCreateWithCString( NULL, _msg, kCFStringEncodingUTF8 ) ); \
|
|
abort(); \
|
|
} while (0)
|
|
|
|
#endif
|