![]() |
|
|||
File indexing completed on 2025-02-22 10:35:44
0001 /**************************************************************************** 0002 * 0003 * ftstdlib.h 0004 * 0005 * ANSI-specific library and header configuration file (specification 0006 * only). 0007 * 0008 * Copyright (C) 2002-2023 by 0009 * David Turner, Robert Wilhelm, and Werner Lemberg. 0010 * 0011 * This file is part of the FreeType project, and may only be used, 0012 * modified, and distributed under the terms of the FreeType project 0013 * license, LICENSE.TXT. By continuing to use, modify, or distribute 0014 * this file you indicate that you have read the license and 0015 * understand and accept it fully. 0016 * 0017 */ 0018 0019 0020 /************************************************************************** 0021 * 0022 * This file is used to group all `#includes` to the ANSI~C library that 0023 * FreeType normally requires. It also defines macros to rename the 0024 * standard functions within the FreeType source code. 0025 * 0026 * Load a file which defines `FTSTDLIB_H_` before this one to override it. 0027 * 0028 */ 0029 0030 0031 #ifndef FTSTDLIB_H_ 0032 #define FTSTDLIB_H_ 0033 0034 0035 #include <stddef.h> 0036 0037 #define ft_ptrdiff_t ptrdiff_t 0038 0039 0040 /************************************************************************** 0041 * 0042 * integer limits 0043 * 0044 * `UINT_MAX` and `ULONG_MAX` are used to automatically compute the size of 0045 * `int` and `long` in bytes at compile-time. So far, this works for all 0046 * platforms the library has been tested on. We also check `ULLONG_MAX` 0047 * to see whether we can use 64-bit `long long` later on. 0048 * 0049 * Note that on the extremely rare platforms that do not provide integer 0050 * types that are _exactly_ 16 and 32~bits wide (e.g., some old Crays where 0051 * `int` is 36~bits), we do not make any guarantee about the correct 0052 * behaviour of FreeType~2 with all fonts. 0053 * 0054 * In these cases, `ftconfig.h` will refuse to compile anyway with a 0055 * message like 'couldn't find 32-bit type' or something similar. 0056 * 0057 */ 0058 0059 0060 #include <limits.h> 0061 0062 #define FT_CHAR_BIT CHAR_BIT 0063 #define FT_USHORT_MAX USHRT_MAX 0064 #define FT_INT_MAX INT_MAX 0065 #define FT_INT_MIN INT_MIN 0066 #define FT_UINT_MAX UINT_MAX 0067 #define FT_LONG_MIN LONG_MIN 0068 #define FT_LONG_MAX LONG_MAX 0069 #define FT_ULONG_MAX ULONG_MAX 0070 #ifdef LLONG_MAX 0071 #define FT_LLONG_MAX LLONG_MAX 0072 #endif 0073 #ifdef LLONG_MIN 0074 #define FT_LLONG_MIN LLONG_MIN 0075 #endif 0076 #ifdef ULLONG_MAX 0077 #define FT_ULLONG_MAX ULLONG_MAX 0078 #endif 0079 0080 0081 /************************************************************************** 0082 * 0083 * character and string processing 0084 * 0085 */ 0086 0087 0088 #include <string.h> 0089 0090 #define ft_memchr memchr 0091 #define ft_memcmp memcmp 0092 #define ft_memcpy memcpy 0093 #define ft_memmove memmove 0094 #define ft_memset memset 0095 #define ft_strcat strcat 0096 #define ft_strcmp strcmp 0097 #define ft_strcpy strcpy 0098 #define ft_strlen strlen 0099 #define ft_strncmp strncmp 0100 #define ft_strncpy strncpy 0101 #define ft_strrchr strrchr 0102 #define ft_strstr strstr 0103 0104 0105 /************************************************************************** 0106 * 0107 * file handling 0108 * 0109 */ 0110 0111 0112 #include <stdio.h> 0113 0114 #define FT_FILE FILE 0115 #define ft_fclose fclose 0116 #define ft_fopen fopen 0117 #define ft_fread fread 0118 #define ft_fseek fseek 0119 #define ft_ftell ftell 0120 #define ft_snprintf snprintf 0121 0122 0123 /************************************************************************** 0124 * 0125 * sorting 0126 * 0127 */ 0128 0129 0130 #include <stdlib.h> 0131 0132 #define ft_qsort qsort 0133 0134 0135 /************************************************************************** 0136 * 0137 * memory allocation 0138 * 0139 */ 0140 0141 0142 #define ft_scalloc calloc 0143 #define ft_sfree free 0144 #define ft_smalloc malloc 0145 #define ft_srealloc realloc 0146 0147 0148 /************************************************************************** 0149 * 0150 * miscellaneous 0151 * 0152 */ 0153 0154 0155 #define ft_strtol strtol 0156 #define ft_getenv getenv 0157 0158 0159 /************************************************************************** 0160 * 0161 * execution control 0162 * 0163 */ 0164 0165 0166 #include <setjmp.h> 0167 0168 #define ft_jmp_buf jmp_buf /* note: this cannot be a typedef since */ 0169 /* `jmp_buf` is defined as a macro */ 0170 /* on certain platforms */ 0171 0172 #define ft_longjmp longjmp 0173 #define ft_setjmp( b ) setjmp( *(ft_jmp_buf*) &(b) ) /* same thing here */ 0174 0175 0176 /* The following is only used for debugging purposes, i.e., if */ 0177 /* `FT_DEBUG_LEVEL_ERROR` or `FT_DEBUG_LEVEL_TRACE` are defined. */ 0178 0179 #include <stdarg.h> 0180 0181 0182 #endif /* FTSTDLIB_H_ */ 0183 0184 0185 /* END */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |