2015-04-21 12:26:51 +00:00
|
|
|
/**
|
2018-09-11 22:27:47 +00:00
|
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
2015-04-21 12:26:51 +00:00
|
|
|
*
|
2018-02-17 02:24:55 +00:00
|
|
|
* This source code is licensed under the MIT license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree.
|
2015-04-21 12:26:51 +00:00
|
|
|
*/
|
|
|
|
|
2015-10-20 11:11:38 +00:00
|
|
|
#if __OBJC__
|
|
|
|
# import <Foundation/Foundation.h>
|
|
|
|
#endif
|
2015-04-21 12:26:51 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Make global functions usable in C++
|
|
|
|
*/
|
|
|
|
#if defined(__cplusplus)
|
|
|
|
#define RCT_EXTERN extern "C" __attribute__((visibility("default")))
|
2017-07-24 13:46:01 +00:00
|
|
|
#define RCT_EXTERN_C_BEGIN extern "C" {
|
|
|
|
#define RCT_EXTERN_C_END }
|
2015-04-21 12:26:51 +00:00
|
|
|
#else
|
|
|
|
#define RCT_EXTERN extern __attribute__((visibility("default")))
|
2017-07-24 13:46:01 +00:00
|
|
|
#define RCT_EXTERN_C_BEGIN
|
|
|
|
#define RCT_EXTERN_C_END
|
2015-04-21 12:26:51 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The RCT_DEBUG macro can be used to exclude error checking and logging code
|
|
|
|
* from release builds to improve performance and reduce binary size.
|
|
|
|
*/
|
|
|
|
#ifndef RCT_DEBUG
|
|
|
|
#if DEBUG
|
|
|
|
#define RCT_DEBUG 1
|
|
|
|
#else
|
|
|
|
#define RCT_DEBUG 0
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The RCT_DEV macro can be used to enable or disable development tools
|
|
|
|
* such as the debug executors, dev menu, red box, etc.
|
|
|
|
*/
|
|
|
|
#ifndef RCT_DEV
|
|
|
|
#if DEBUG
|
|
|
|
#define RCT_DEV 1
|
|
|
|
#else
|
|
|
|
#define RCT_DEV 0
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2017-08-24 17:39:13 +00:00
|
|
|
#ifndef RCT_ENABLE_INSPECTOR
|
|
|
|
#if RCT_DEV && __has_include(<React/RCTInspectorDevServerHelper.h>)
|
|
|
|
#define RCT_ENABLE_INSPECTOR 1
|
|
|
|
#else
|
|
|
|
#define RCT_ENABLE_INSPECTOR 0
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2017-10-05 02:06:22 +00:00
|
|
|
#ifndef ENABLE_PACKAGER_CONNECTION
|
|
|
|
#if RCT_DEV && __has_include(<React/RCTPackagerConnection.h>)
|
|
|
|
#define ENABLE_PACKAGER_CONNECTION 1
|
|
|
|
#else
|
|
|
|
#define ENABLE_PACKAGER_CONNECTION 0
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2015-06-03 12:38:21 +00:00
|
|
|
#if RCT_DEV
|
|
|
|
#define RCT_IF_DEV(...) __VA_ARGS__
|
|
|
|
#else
|
|
|
|
#define RCT_IF_DEV(...)
|
|
|
|
#endif
|
|
|
|
|
2016-06-13 11:16:19 +00:00
|
|
|
#ifndef RCT_PROFILE
|
|
|
|
#define RCT_PROFILE RCT_DEV
|
|
|
|
#endif
|
|
|
|
|
2018-01-05 04:02:37 +00:00
|
|
|
/**
|
|
|
|
* Add the default Metro packager port number
|
|
|
|
*/
|
|
|
|
#ifndef RCT_METRO_PORT
|
|
|
|
#define RCT_METRO_PORT 8081
|
|
|
|
#else
|
|
|
|
// test if RCT_METRO_PORT is empty
|
|
|
|
#define RCT_METRO_PORT_DO_EXPAND(VAL) VAL ## 1
|
|
|
|
#define RCT_METRO_PORT_EXPAND(VAL) RCT_METRO_PORT_DO_EXPAND(VAL)
|
|
|
|
#if !defined(RCT_METRO_PORT) || (RCT_METRO_PORT_EXPAND(RCT_METRO_PORT) == 1)
|
|
|
|
// Only here if RCT_METRO_PORT is not defined
|
|
|
|
// OR RCT_METRO_PORT is the empty string
|
|
|
|
#undef RCT_METRO_PORT
|
|
|
|
#define RCT_METRO_PORT 8081
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2015-04-21 12:26:51 +00:00
|
|
|
/**
|
|
|
|
* By default, only raise an NSAssertion in debug mode
|
|
|
|
* (custom assert functions will still be called).
|
|
|
|
*/
|
|
|
|
#ifndef RCT_NSASSERT
|
2016-06-13 11:16:19 +00:00
|
|
|
#define RCT_NSASSERT RCT_DEBUG
|
2015-04-21 12:26:51 +00:00
|
|
|
#endif
|
2015-06-10 10:43:55 +00:00
|
|
|
|
|
|
|
/**
|
2015-06-15 14:53:45 +00:00
|
|
|
* Concat two literals. Supports macro expansions,
|
|
|
|
* e.g. RCT_CONCAT(foo, __FILE__).
|
2015-06-10 10:43:55 +00:00
|
|
|
*/
|
|
|
|
#define RCT_CONCAT2(A, B) A ## B
|
|
|
|
#define RCT_CONCAT(A, B) RCT_CONCAT2(A, B)
|
2015-06-15 14:53:45 +00:00
|
|
|
|
2018-02-26 20:22:30 +00:00
|
|
|
/**
|
|
|
|
* This attribute is used for static analysis.
|
|
|
|
*/
|
|
|
|
#if !defined RCT_DYNAMIC
|
|
|
|
#if __has_attribute(objc_dynamic)
|
|
|
|
#define RCT_DYNAMIC __attribute__((objc_dynamic))
|
|
|
|
#else
|
|
|
|
#define RCT_DYNAMIC
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2015-06-15 14:53:45 +00:00
|
|
|
/**
|
|
|
|
* Throw an assertion for unimplemented methods.
|
|
|
|
*/
|
|
|
|
#define RCT_NOT_IMPLEMENTED(method) \
|
|
|
|
_Pragma("clang diagnostic push") \
|
|
|
|
_Pragma("clang diagnostic ignored \"-Wmissing-method-return-type\"") \
|
|
|
|
_Pragma("clang diagnostic ignored \"-Wunused-parameter\"") \
|
|
|
|
RCT_EXTERN NSException *_RCTNotImplementedException(SEL, Class); \
|
|
|
|
method NS_UNAVAILABLE { @throw _RCTNotImplementedException(_cmd, [self class]); } \
|
|
|
|
_Pragma("clang diagnostic pop")
|
2018-08-16 20:34:35 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Check if WebKit iOS 10.0 APIs are available.
|
|
|
|
*/
|
|
|
|
#define WEBKIT_IOS_10_APIS_AVAILABLE __has_include(<WebKit/WKAudiovisualMediaTypes.h>)
|