00001 /***************************************************************************/ 00002 /* */ 00003 /* ftstdlib.h */ 00004 /* */ 00005 /* ANSI-specific library and header configuration file (specification */ 00006 /* only). */ 00007 /* */ 00008 /* Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2009 by */ 00009 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 00010 /* */ 00011 /* This file is part of the FreeType project, and may only be used, */ 00012 /* modified, and distributed under the terms of the FreeType project */ 00013 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 00014 /* this file you indicate that you have read the license and */ 00015 /* understand and accept it fully. */ 00016 /* */ 00017 /***************************************************************************/ 00018 00019 00020 /*************************************************************************/ 00021 /* */ 00022 /* This file is used to group all #includes to the ANSI C library that */ 00023 /* FreeType normally requires. It also defines macros to rename the */ 00024 /* standard functions within the FreeType source code. */ 00025 /* */ 00026 /* Load a file which defines __FTSTDLIB_H__ before this one to override */ 00027 /* it. */ 00028 /* */ 00029 /*************************************************************************/ 00030 00031 00032 #ifndef __FTSTDLIB_H__ 00033 #define __FTSTDLIB_H__ 00034 00035 00036 #include <stddef.h> 00037 00038 #define ft_ptrdiff_t ptrdiff_t 00039 00040 00041 /**********************************************************************/ 00042 /* */ 00043 /* integer limits */ 00044 /* */ 00045 /* UINT_MAX and ULONG_MAX are used to automatically compute the size */ 00046 /* of `int' and `long' in bytes at compile-time. So far, this works */ 00047 /* for all platforms the library has been tested on. */ 00048 /* */ 00049 /* Note that on the extremely rare platforms that do not provide */ 00050 /* integer types that are _exactly_ 16 and 32 bits wide (e.g. some */ 00051 /* old Crays where `int' is 36 bits), we do not make any guarantee */ 00052 /* about the correct behaviour of FT2 with all fonts. */ 00053 /* */ 00054 /* In these case, `ftconfig.h' will refuse to compile anyway with a */ 00055 /* message like `couldn't find 32-bit type' or something similar. */ 00056 /* */ 00057 /**********************************************************************/ 00058 00059 00060 #include <limits.h> 00061 00062 #define FT_CHAR_BIT CHAR_BIT 00063 #define FT_INT_MAX INT_MAX 00064 #define FT_INT_MIN INT_MIN 00065 #define FT_UINT_MAX UINT_MAX 00066 #define FT_ULONG_MAX ULONG_MAX 00067 00068 00069 /**********************************************************************/ 00070 /* */ 00071 /* character and string processing */ 00072 /* */ 00073 /**********************************************************************/ 00074 00075 00076 #include <string.h> 00077 00078 #define ft_memchr memchr 00079 #define ft_memcmp memcmp 00080 #define ft_memcpy memcpy 00081 #define ft_memmove memmove 00082 #define ft_memset memset 00083 #define ft_strcat strcat 00084 #define ft_strcmp strcmp 00085 #define ft_strcpy strcpy 00086 #define ft_strlen strlen 00087 #define ft_strncmp strncmp 00088 #define ft_strncpy strncpy 00089 #define ft_strrchr strrchr 00090 #define ft_strstr strstr 00091 00092 00093 /**********************************************************************/ 00094 /* */ 00095 /* file handling */ 00096 /* */ 00097 /**********************************************************************/ 00098 00099 00100 #include <stdio.h> 00101 00102 #define FT_FILE FILE 00103 #define ft_fclose fclose 00104 #define ft_fopen fopen 00105 #define ft_fread fread 00106 #define ft_fseek fseek 00107 #define ft_ftell ftell 00108 #define ft_sprintf sprintf 00109 00110 00111 /**********************************************************************/ 00112 /* */ 00113 /* sorting */ 00114 /* */ 00115 /**********************************************************************/ 00116 00117 00118 #include <stdlib.h> 00119 00120 #define ft_qsort qsort 00121 00122 00123 /**********************************************************************/ 00124 /* */ 00125 /* memory allocation */ 00126 /* */ 00127 /**********************************************************************/ 00128 00129 00130 #define ft_scalloc calloc 00131 #define ft_sfree free 00132 #define ft_smalloc malloc 00133 #define ft_srealloc realloc 00134 00135 00136 /**********************************************************************/ 00137 /* */ 00138 /* miscellaneous */ 00139 /* */ 00140 /**********************************************************************/ 00141 00142 00143 #define ft_atol atol 00144 #define ft_labs labs 00145 00146 00147 /**********************************************************************/ 00148 /* */ 00149 /* execution control */ 00150 /* */ 00151 /**********************************************************************/ 00152 00153 00154 #include <setjmp.h> 00155 00156 #define ft_jmp_buf jmp_buf /* note: this cannot be a typedef since */ 00157 /* jmp_buf is defined as a macro */ 00158 /* on certain platforms */ 00159 00160 #define ft_longjmp longjmp 00161 #define ft_setjmp( b ) setjmp( *(jmp_buf*) &(b) ) /* same thing here */ 00162 00163 00164 /* the following is only used for debugging purposes, i.e., if */ 00165 /* FT_DEBUG_LEVEL_ERROR or FT_DEBUG_LEVEL_TRACE are defined */ 00166 00167 #include <stdarg.h> 00168 00169 00170 #endif /* __FTSTDLIB_H__ */ 00171 00172 00173 /* END */