fribidi-common.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  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(__GNUC__) && __GNUC__ >= 4) || defined(__ICC)
  43. # define FRIBIDI_ENTRY __attribute__ ((visibility("default")))
  44. # elif (defined(__SUNPRO_C) || defined(__SUNPRO_CC))
  45. # define FRIBIDI_ENTRY __global
  46. /* Windows is special and you cannot just define entry points unconditionally. */
  47. # elif defined(_WIN32) && ! defined(FRIBIDI_LIB_STATIC)
  48. # ifdef FRIBIDI_BUILD
  49. # define FRIBIDI_ENTRY __declspec(dllexport)
  50. # else
  51. # define FRIBIDI_ENTRY __declspec(dllimport)
  52. # endif
  53. # else
  54. /* nothing else worked, give up and do nothing */
  55. # define FRIBIDI_ENTRY
  56. # endif
  57. #endif
  58. #define FRIBIDI_EXTERN extern
  59. #ifdef __ICC
  60. #define FRIBIDI_BEGIN_IGNORE_DEPRECATIONS \
  61. _Pragma ("warning (push)") \
  62. _Pragma ("warning (disable:1478)")
  63. #define FRIBIDI_END_IGNORE_DEPRECATIONS \
  64. _Pragma ("warning (pop)")
  65. #elif __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
  66. #define FRIBIDI_BEGIN_IGNORE_DEPRECATIONS \
  67. _Pragma ("GCC diagnostic push") \
  68. _Pragma ("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
  69. #define FRIBIDI_END_IGNORE_DEPRECATIONS \
  70. _Pragma ("GCC diagnostic pop")
  71. #elif defined (_MSC_VER) && (_MSC_VER >= 1500)
  72. #define FRIBIDI_BEGIN_IGNORE_DEPRECATIONS \
  73. __pragma (warning (push)) \
  74. __pragma (warning (disable : 4996))
  75. #define FRIBIDI_END_IGNORE_DEPRECATIONS \
  76. __pragma (warning (pop))
  77. #elif defined (__clang__)
  78. #define FRIBIDI_BEGIN_IGNORE_DEPRECATIONS \
  79. _Pragma("clang diagnostic push") \
  80. _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"")
  81. #define FRIBIDI_END_IGNORE_DEPRECATIONS \
  82. _Pragma("clang diagnostic pop")
  83. #else
  84. #define FRIBIDI_BEGIN_IGNORE_DEPRECATIONS
  85. #define FRIBIDI_END_IGNORE_DEPRECATIONS
  86. #endif
  87. #if (defined(__GNUC__) && (__GNUC__ > 2)) && ! defined(_WIN32)
  88. # define FRIBIDI_GNUC_WARN_UNUSED __attribute__((__warn_unused_result__))
  89. # define FRIBIDI_GNUC_MALLOC __attribute__((__malloc__))
  90. # define FRIBIDI_GNUC_HIDDEN __attribute__((__visibility__ ("hidden")))
  91. # define FRIBIDI_GNUC_CONST __attribute__((__const__))
  92. # define FRIBIDI_GNUC_DEPRECATED __attribute__((__unused__))
  93. #else /* __GNUC__ */
  94. # define FRIBIDI_GNUC_WARN_UNUSED
  95. # define FRIBIDI_GNUC_MALLOC
  96. # define FRIBIDI_GNUC_HIDDEN
  97. # define FRIBIDI_GNUC_CONST
  98. # define FRIBIDI_GNUC_DEPRECATED
  99. #endif /* __GNUC__ */
  100. /* FRIBIDI_BEGIN_DECLS should be used at the beginning of your declarations,
  101. * so that C++ compilers don't mangle their names. Use FRIBIDI_END_DECLS at
  102. * the end of C declarations. */
  103. #ifndef FRIBIDI_BEGIN_DECLS
  104. # ifdef __cplusplus
  105. # define FRIBIDI_BEGIN_DECLS extern "C" {
  106. # define FRIBIDI_END_DECLS }
  107. # else /* !__cplusplus */
  108. # define FRIBIDI_BEGIN_DECLS /* empty */
  109. # define FRIBIDI_END_DECLS /* empty */
  110. # endif /* !__cplusplus */
  111. #endif /* !FRIBIDI_BEGIN_DECLS */
  112. /* fribidi_debug_status - get current debug state
  113. *
  114. */
  115. FRIBIDI_ENTRY int fribidi_debug_status (
  116. void
  117. );
  118. /* fribidi_set_debug - set debug state
  119. *
  120. */
  121. FRIBIDI_ENTRY int
  122. fribidi_set_debug (
  123. int state /* new state to set */
  124. );
  125. #endif /* !_FRIBIDI_COMMON_H */
  126. /* Editor directions:
  127. * vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent
  128. */