ftstdlib.h 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. /***************************************************************************/
  2. /* */
  3. /* ftstdlib.h */
  4. /* */
  5. /* ANSI-specific library and header configuration file (specification */
  6. /* only). */
  7. /* */
  8. /* Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2009 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_INT_MAX INT_MAX
  52. #define FT_INT_MIN INT_MIN
  53. #define FT_UINT_MAX UINT_MAX
  54. #define FT_ULONG_MAX ULONG_MAX
  55. /**********************************************************************/
  56. /* */
  57. /* character and string processing */
  58. /* */
  59. /**********************************************************************/
  60. #include <string.h>
  61. #define ft_memchr memchr
  62. #define ft_memcmp memcmp
  63. #define ft_memcpy memcpy
  64. #define ft_memmove memmove
  65. #define ft_memset memset
  66. #define ft_strcat strcat
  67. #define ft_strcmp strcmp
  68. #define ft_strcpy strcpy
  69. #define ft_strlen strlen
  70. #define ft_strncmp strncmp
  71. #define ft_strncpy strncpy
  72. #define ft_strrchr strrchr
  73. #define ft_strstr strstr
  74. /**********************************************************************/
  75. /* */
  76. /* file handling */
  77. /* */
  78. /**********************************************************************/
  79. #include <stdio.h>
  80. #define FT_FILE FILE
  81. #define ft_fclose fclose
  82. #define ft_fopen fopen
  83. #define ft_fread fread
  84. #define ft_fseek fseek
  85. #define ft_ftell ftell
  86. #define ft_sprintf sprintf
  87. /**********************************************************************/
  88. /* */
  89. /* sorting */
  90. /* */
  91. /**********************************************************************/
  92. #include <stdlib.h>
  93. #define ft_qsort qsort
  94. /**********************************************************************/
  95. /* */
  96. /* memory allocation */
  97. /* */
  98. /**********************************************************************/
  99. #define ft_scalloc calloc
  100. #define ft_sfree free
  101. #define ft_smalloc malloc
  102. #define ft_srealloc realloc
  103. /**********************************************************************/
  104. /* */
  105. /* miscellaneous */
  106. /* */
  107. /**********************************************************************/
  108. #define ft_atol atol
  109. #define ft_labs labs
  110. /**********************************************************************/
  111. /* */
  112. /* execution control */
  113. /* */
  114. /**********************************************************************/
  115. #include <setjmp.h>
  116. #define ft_jmp_buf jmp_buf /* note: this cannot be a typedef since */
  117. /* jmp_buf is defined as a macro */
  118. /* on certain platforms */
  119. #define ft_longjmp longjmp
  120. #define ft_setjmp( b ) setjmp( *(jmp_buf*) &(b) ) /* same thing here */
  121. /* the following is only used for debugging purposes, i.e., if */
  122. /* FT_DEBUG_LEVEL_ERROR or FT_DEBUG_LEVEL_TRACE are defined */
  123. #include <stdarg.h>
  124. #endif /* __FTSTDLIB_H__ */
  125. /* END */