fribidi-common.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. /* FriBidi
  2. * fribidi-common.h - common include for library headers
  3. *
  4. * Author:
  5. * Behdad Esfahbod, 2004
  6. *
  7. * Copyright (C) 2004 Sharif FarsiWeb, Inc.
  8. *
  9. * This library is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU Lesser General Public
  11. * License as published by the Free Software Foundation; either
  12. * version 2.1 of the License, or (at your option) any later version.
  13. *
  14. * This library is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * Lesser General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Lesser General Public License
  20. * along with this library, in a file named COPYING; if not, write to the
  21. * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  22. * Boston, MA 02110-1301, USA
  23. *
  24. * For licensing issues, contact <fribidi.license@gmail.com>.
  25. */
  26. #ifndef _FRIBIDI_COMMON_H
  27. #define _FRIBIDI_COMMON_H
  28. #ifdef DONT_HAVE_FRIBIDI_CONFIG_H
  29. # define FRIBIDI "fribidi"
  30. # define FRIBIDI_NAME "fribidi"
  31. # define FRIBIDI_VERSION "unknown"
  32. # define FRIBIDI_BUGREPORT "unknown"
  33. # define FRIBIDI_INTERFACE_VERSION_STRING "unknown"
  34. #else /* !DONT_HAVE_FRIBIDI_CONFIG_H */
  35. # include "fribidi-config.h"
  36. #endif /* !DONT_HAVE_FRIBIDI_CONFIG_H */
  37. #ifdef HAVE_FRIBIDI_CUSTOM_H
  38. # include <fribidi-custom.h>
  39. #endif /* HAVE_FRIBIDI_CUSTOM_H */
  40. /* FRIBIDI_ENTRY is a macro used to declare library entry points. */
  41. #ifndef FRIBIDI_ENTRY
  42. # if (defined(_MSC_VER) || defined(FRIBIDI_BUILT_WITH_MSVC)) && !defined(FRIBIDI_STATIC)
  43. /* if we're building fribidi itself with MSVC, FRIBIDI_ENTRY will be defined,
  44. * so if we're here then this is an external user including fribidi headers.
  45. * The dllimport is needed here mostly for the fribidi_version_info variable,
  46. * for functions it's not required. Probably needs more fine-tuning if
  47. * someone starts building fribidi as static library with MSVC. We'll cross
  48. * that bridge when we get there. */
  49. # define FRIBIDI_ENTRY __declspec(dllimport) extern
  50. # else
  51. # define FRIBIDI_ENTRY extern
  52. # endif
  53. #endif /* !FRIBIDI_ENTRY */
  54. #ifdef __ICC
  55. #define FRIBIDI_BEGIN_IGNORE_DEPRECATIONS \
  56. _Pragma ("warning (push)") \
  57. _Pragma ("warning (disable:1478)")
  58. #define FRIBIDI_END_IGNORE_DEPRECATIONS \
  59. _Pragma ("warning (pop)")
  60. #elif __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
  61. #define FRIBIDI_BEGIN_IGNORE_DEPRECATIONS \
  62. _Pragma ("GCC diagnostic push") \
  63. _Pragma ("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
  64. #define FRIBIDI_END_IGNORE_DEPRECATIONS \
  65. _Pragma ("GCC diagnostic pop")
  66. #elif defined (_MSC_VER) && (_MSC_VER >= 1500)
  67. #define FRIBIDI_BEGIN_IGNORE_DEPRECATIONS \
  68. __pragma (warning (push)) \
  69. __pragma (warning (disable : 4996))
  70. #define FRIBIDI_END_IGNORE_DEPRECATIONS \
  71. __pragma (warning (pop))
  72. #elif defined (__clang__)
  73. #define FRIBIDI_BEGIN_IGNORE_DEPRECATIONS \
  74. _Pragma("clang diagnostic push") \
  75. _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"")
  76. #define FRIBIDI_END_IGNORE_DEPRECATIONS \
  77. _Pragma("clang diagnostic pop")
  78. #else
  79. #define FRIBIDI_BEGIN_IGNORE_DEPRECATIONS
  80. #define FRIBIDI_END_IGNORE_DEPRECATIONS
  81. #endif
  82. #if defined(__GNUC__) && (__GNUC__ > 2)
  83. # define FRIBIDI_GNUC_WARN_UNUSED __attribute__((__warn_unused_result__))
  84. # define FRIBIDI_GNUC_MALLOC __attribute__((__malloc__))
  85. # define FRIBIDI_GNUC_HIDDEN __attribute__((__visibility__ ("hidden")))
  86. # define FRIBIDI_GNUC_CONST __attribute__((__const__))
  87. # define FRIBIDI_GNUC_DEPRECATED __attribute__((__unused__))
  88. #else /* __GNUC__ */
  89. # define FRIBIDI_GNUC_WARN_UNUSED
  90. # define FRIBIDI_GNUC_MALLOC
  91. # define FRIBIDI_GNUC_HIDDEN
  92. # define FRIBIDI_GNUC_CONST
  93. # define FRIBIDI_GNUC_DEPRECATED
  94. #endif /* __GNUC__ */
  95. /* FRIBIDI_BEGIN_DECLS should be used at the beginning of your declarations,
  96. * so that C++ compilers don't mangle their names. Use FRIBIDI_END_DECLS at
  97. * the end of C declarations. */
  98. #ifndef FRIBIDI_BEGIN_DECLS
  99. # ifdef __cplusplus
  100. # define FRIBIDI_BEGIN_DECLS extern "C" {
  101. # define FRIBIDI_END_DECLS }
  102. # else /* !__cplusplus */
  103. # define FRIBIDI_BEGIN_DECLS /* empty */
  104. # define FRIBIDI_END_DECLS /* empty */
  105. # endif /* !__cplusplus */
  106. #endif /* !FRIBIDI_BEGIN_DECLS */
  107. /* fribidi_debug_status - get current debug state
  108. *
  109. */
  110. FRIBIDI_ENTRY int fribidi_debug_status (
  111. void
  112. );
  113. /* fribidi_set_debug - set debug state
  114. *
  115. */
  116. FRIBIDI_ENTRY int
  117. fribidi_set_debug (
  118. int state /* new state to set */
  119. );
  120. #endif /* !_FRIBIDI_COMMON_H */
  121. /* Editor directions:
  122. * vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent
  123. */