ftstdlib.h 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. /***************************************************************************/
  2. /* */
  3. /* ftstdlib.h */
  4. /* */
  5. /* ANSI-specific library and header configuration file (specification */
  6. /* only). */
  7. /* */
  8. /* Copyright 2002-2007, 2009, 2011-2012 by */
  9. /* David Turner, Robert Wilhelm, and Werner Lemberg. */
  10. /* */
  11. /* This file is part of the FreeType project, and may only be used, */
  12. /* modified, and distributed under the terms of the FreeType project */
  13. /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
  14. /* this file you indicate that you have read the license and */
  15. /* understand and accept it fully. */
  16. /* */
  17. /***************************************************************************/
  18. /*************************************************************************/
  19. /* */
  20. /* This file is used to group all #includes to the ANSI C library that */
  21. /* FreeType normally requires. It also defines macros to rename the */
  22. /* standard functions within the FreeType source code. */
  23. /* */
  24. /* Load a file which defines __FTSTDLIB_H__ before this one to override */
  25. /* it. */
  26. /* */
  27. /*************************************************************************/
  28. #ifndef __FTSTDLIB_H__
  29. #define __FTSTDLIB_H__
  30. #include <stddef.h>
  31. #define ft_ptrdiff_t ptrdiff_t
  32. /**********************************************************************/
  33. /* */
  34. /* integer limits */
  35. /* */
  36. /* UINT_MAX and ULONG_MAX are used to automatically compute the size */
  37. /* of `int' and `long' in bytes at compile-time. So far, this works */
  38. /* for all platforms the library has been tested on. */
  39. /* */
  40. /* Note that on the extremely rare platforms that do not provide */
  41. /* integer types that are _exactly_ 16 and 32 bits wide (e.g. some */
  42. /* old Crays where `int' is 36 bits), we do not make any guarantee */
  43. /* about the correct behaviour of FT2 with all fonts. */
  44. /* */
  45. /* In these case, `ftconfig.h' will refuse to compile anyway with a */
  46. /* message like `couldn't find 32-bit type' or something similar. */
  47. /* */
  48. /**********************************************************************/
  49. #include <limits.h>
  50. #define FT_CHAR_BIT CHAR_BIT
  51. #define FT_USHORT_MAX USHRT_MAX
  52. #define FT_INT_MAX INT_MAX
  53. #define FT_INT_MIN INT_MIN
  54. #define FT_UINT_MAX UINT_MAX
  55. #define FT_ULONG_MAX ULONG_MAX
  56. /**********************************************************************/
  57. /* */
  58. /* character and string processing */
  59. /* */
  60. /**********************************************************************/
  61. #include <string.h>
  62. #define ft_memchr memchr
  63. #define ft_memcmp memcmp
  64. #define ft_memcpy memcpy
  65. #define ft_memmove memmove
  66. #define ft_memset memset
  67. #define ft_strcat strcat
  68. #define ft_strcmp strcmp
  69. #define ft_strcpy strcpy
  70. #define ft_strlen strlen
  71. #define ft_strncmp strncmp
  72. #define ft_strncpy strncpy
  73. #define ft_strrchr strrchr
  74. #define ft_strstr strstr
  75. /**********************************************************************/
  76. /* */
  77. /* file handling */
  78. /* */
  79. /**********************************************************************/
  80. #include <stdio.h>
  81. #define FT_FILE FILE
  82. #define ft_fclose fclose
  83. #define ft_fopen fopen
  84. #define ft_fread fread
  85. #define ft_fseek fseek
  86. #define ft_ftell ftell
  87. #define ft_sprintf sprintf
  88. /**********************************************************************/
  89. /* */
  90. /* sorting */
  91. /* */
  92. /**********************************************************************/
  93. #include <stdlib.h>
  94. #define ft_qsort qsort
  95. /**********************************************************************/
  96. /* */
  97. /* memory allocation */
  98. /* */
  99. /**********************************************************************/
  100. #define ft_scalloc calloc
  101. #define ft_sfree free
  102. #define ft_smalloc malloc
  103. #define ft_srealloc realloc
  104. /**********************************************************************/
  105. /* */
  106. /* miscellaneous */
  107. /* */
  108. /**********************************************************************/
  109. #define ft_atol atol
  110. #define ft_labs labs
  111. /**********************************************************************/
  112. /* */
  113. /* execution control */
  114. /* */
  115. /**********************************************************************/
  116. #include <setjmp.h>
  117. #define ft_jmp_buf jmp_buf /* note: this cannot be a typedef since */
  118. /* jmp_buf is defined as a macro */
  119. /* on certain platforms */
  120. #define ft_longjmp longjmp
  121. #define ft_setjmp( b ) setjmp( *(ft_jmp_buf*) &(b) ) /* same thing here */
  122. /* the following is only used for debugging purposes, i.e., if */
  123. /* FT_DEBUG_LEVEL_ERROR or FT_DEBUG_LEVEL_TRACE are defined */
  124. #include <stdarg.h>
  125. #endif /* __FTSTDLIB_H__ */
  126. /* END */