YGMacros.h 979 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /**
  2. * Copyright (c) 2014-present, Facebook, Inc.
  3. *
  4. * This source code is licensed under the MIT license found in the
  5. * LICENSE file in the root directory of this source tree.
  6. */
  7. #pragma once
  8. #ifdef __cplusplus
  9. #define YG_EXTERN_C_BEGIN extern "C" {
  10. #define YG_EXTERN_C_END }
  11. #else
  12. #define YG_EXTERN_C_BEGIN
  13. #define YG_EXTERN_C_END
  14. #endif
  15. #ifdef _WINDLL
  16. #define WIN_EXPORT __declspec(dllexport)
  17. #else
  18. #define WIN_EXPORT
  19. #endif
  20. #ifdef WINARMDLL
  21. #define WIN_STRUCT(type) type *
  22. #define WIN_STRUCT_REF(value) &value
  23. #else
  24. #define WIN_STRUCT(type) type
  25. #define WIN_STRUCT_REF(value) value
  26. #endif
  27. #ifdef NS_ENUM
  28. // Cannot use NSInteger as NSInteger has a different size than int (which is the default type of a
  29. // enum).
  30. // Therefor when linking the Yoga C library into obj-c the header is a missmatch for the Yoga ABI.
  31. #define YG_ENUM_BEGIN(name) NS_ENUM(int, name)
  32. #define YG_ENUM_END(name)
  33. #else
  34. #define YG_ENUM_BEGIN(name) enum name
  35. #define YG_ENUM_END(name) name
  36. #endif