diff options
| author | Charles Forsyth <charles.forsyth@gmail.com> | 2024-04-22 07:10:23 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-04-22 07:10:23 +0100 |
| commit | aea6a5537d424a269675969ba3653d291121984e (patch) | |
| tree | 6d8f7ede33f403786bdfa91973676c1bf833f0f7 /include/freetype/config/ftstdlib.h | |
| parent | 73b5cba380d148e77d696880027a416cda50f756 (diff) | |
| parent | 3df3f6f7d81cd03b0f10ef557e0c96ab0f6cd702 (diff) | |
Merge pull request #12 from dboddie/update-freetype
Update FreeType to the latest code
Diffstat (limited to 'include/freetype/config/ftstdlib.h')
| -rw-r--r-- | include/freetype/config/ftstdlib.h | 276 |
1 files changed, 156 insertions, 120 deletions
diff --git a/include/freetype/config/ftstdlib.h b/include/freetype/config/ftstdlib.h index bdf43d58..e17aa7b8 100644 --- a/include/freetype/config/ftstdlib.h +++ b/include/freetype/config/ftstdlib.h @@ -1,149 +1,185 @@ -/***************************************************************************/ -/* */ -/* ftstdlib.h */ -/* */ -/* ANSI-specific library and header configuration file (specification */ -/* only). */ -/* */ -/* Copyright 2002 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - - /*************************************************************************/ - /* */ - /* This file is used to group all #includes to the ANSI C library that */ - /* FreeType normally requires. It also defines macros to rename the */ - /* standard functions within the FreeType source code. */ - /* */ - /* Load a file which defines __FTSTDLIB_H__ before this one to override */ - /* it. */ - /* */ - /*************************************************************************/ - - -#ifndef __FTSTDLIB_H__ -#define __FTSTDLIB_H__ - - - /**********************************************************************/ - /* */ - /* integer limits */ - /* */ - /* UINT_MAX and ULONG_MAX are used to automatically compute the size */ - /* of `int' and `long' in bytes at compile-time. So far, this works */ - /* for all platforms the library has been tested on. */ - /* */ - /* Note that on the extremely rare platforms that do not provide */ - /* integer types that are _exactly_ 16 and 32 bits wide (e.g. some */ - /* old Crays where `int' is 36 bits), we do not make any guarantee */ - /* about the correct behaviour of FT2 with all fonts. */ - /* */ - /* In these case, "ftconfig.h" will refuse to compile anyway with a */ - /* message like "couldn't find 32-bit type" or something similar. */ - /* */ - /* IMPORTANT NOTE: We do not define aliases for heap management and */ - /* i/o routines (i.e. malloc/free/fopen/fread/...) */ - /* since these functions should all be encapsulated */ - /* by platform-specific implementations of */ - /* "ftsystem.c". */ - /* */ - /**********************************************************************/ - - -#include <lib9.h> -#define UINT_MAX 0xffffffffU -#define ULONG_MAX 0xffffffffUL -/*#include <limits.h>*/ - -#define FT_UINT_MAX UINT_MAX -#define FT_ULONG_MAX ULONG_MAX - - - /**********************************************************************/ - /* */ - /* character and string processing */ - /* */ - /**********************************************************************/ - - -#include <ctype.h> - -#define ft_isalnum isalnum -#define ft_isupper isupper -#define ft_islower islower -#define ft_xdigit isxdigit - - -/*#include <string.h>*/ - -#define ft_strlen strlen -#define ft_strcmp strcmp -#define ft_strncmp strncmp +/**************************************************************************** + * + * ftstdlib.h + * + * ANSI-specific library and header configuration file (specification + * only). + * + * Copyright (C) 2002-2024 by + * David Turner, Robert Wilhelm, and Werner Lemberg. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ + + + /************************************************************************** + * + * This file is used to group all `#includes` to the ANSI~C library that + * FreeType normally requires. It also defines macros to rename the + * standard functions within the FreeType source code. + * + * Load a file which defines `FTSTDLIB_H_` before this one to override it. + * + */ + + +#ifndef FTSTDLIB_H_ +#define FTSTDLIB_H_ + + +#include <stddef.h> + +#define ft_ptrdiff_t ptrdiff_t + + + /************************************************************************** + * + * integer limits + * + * `UINT_MAX` and `ULONG_MAX` are used to automatically compute the size of + * `int` and `long` in bytes at compile-time. So far, this works for all + * platforms the library has been tested on. We also check `ULLONG_MAX` + * to see whether we can use 64-bit `long long` later on. + * + * Note that on the extremely rare platforms that do not provide integer + * types that are _exactly_ 16 and 32~bits wide (e.g., some old Crays where + * `int` is 36~bits), we do not make any guarantee about the correct + * behaviour of FreeType~2 with all fonts. + * + * In these cases, `ftconfig.h` will refuse to compile anyway with a + * message like 'couldn't find 32-bit type' or something similar. + * + */ + + +#include <limits.h> + +#define FT_CHAR_BIT CHAR_BIT +#define FT_USHORT_MAX USHRT_MAX +#define FT_INT_MAX INT_MAX +#define FT_INT_MIN INT_MIN +#define FT_UINT_MAX UINT_MAX +#define FT_LONG_MIN LONG_MIN +#define FT_LONG_MAX LONG_MAX +#define FT_ULONG_MAX ULONG_MAX +#ifdef LLONG_MAX +#define FT_LLONG_MAX LLONG_MAX +#endif +#ifdef LLONG_MIN +#define FT_LLONG_MIN LLONG_MIN +#endif +#ifdef ULLONG_MAX +#define FT_ULLONG_MAX ULLONG_MAX +#endif + + + /************************************************************************** + * + * character and string processing + * + */ + + +#include <string.h> + +#define ft_memchr memchr +#define ft_memcmp memcmp #define ft_memcpy memcpy +#define ft_memmove memmove +#define ft_memset memset +#define ft_strcat strcat +#define ft_strcmp strcmp #define ft_strcpy strcpy +#define ft_strlen strlen +#define ft_strncmp strncmp #define ft_strncpy strncpy -#define ft_memset memset -#define ft_memmove memmove -#define ft_memcmp memcmp +#define ft_strrchr strrchr +#define ft_strstr strstr -#include <stdio.h> -#define ft_sprintf sprintf + /************************************************************************** + * + * file handling + * + */ + +#include <stdio.h> + +#define FT_FILE FILE +#define ft_fclose fclose +#define ft_fopen fopen +#define ft_fread fread +#define ft_fseek fseek +#define ft_ftell ftell +#define ft_snprintf snprintf - /**********************************************************************/ - /* */ - /* sorting */ - /* */ - /**********************************************************************/ + /************************************************************************** + * + * sorting + * + */ -/*#include <stdlib.h>*/ +#include <stdlib.h> #define ft_qsort qsort -/*#define ft_exit exit /* only used to exit from unhandled exceptions */ -#define ft_exit(a) exits("") /* only used to exit from unhandled exceptions */ + /************************************************************************** + * + * memory allocation + * + */ + + +#define ft_scalloc calloc +#define ft_sfree free +#define ft_smalloc malloc +#define ft_srealloc realloc + + + /************************************************************************** + * + * miscellaneous + * + */ + + +#define ft_strtol strtol +#define ft_getenv getenv -#define ft_atoi atoi + /************************************************************************** + * + * execution control + * + */ - /**********************************************************************/ - /* */ - /* execution control */ - /* */ - /**********************************************************************/ +#include <setjmp.h> -/*#include <setjmp.h>*/ +#define ft_jmp_buf jmp_buf /* note: this cannot be a typedef since */ + /* `jmp_buf` is defined as a macro */ + /* on certain platforms */ -#define ft_jmp_buf jmp_buf /* note: this cannot be a typedef since */ - /* jmp_buf is defined as a macro */ - /* on certain platforms */ +#define ft_longjmp longjmp +#define ft_setjmp( b ) setjmp( *(ft_jmp_buf*) &(b) ) /* same thing here */ -#define ft_setjmp setjmp /* same thing here */ -#define ft_longjmp longjmp /* " */ + /* The following is only used for debugging purposes, i.e., if */ + /* `FT_DEBUG_LEVEL_ERROR` or `FT_DEBUG_LEVEL_TRACE` are defined. */ - /* the following is only used for debugging purposes, i.e. when */ - /* FT_DEBUG_LEVEL_ERROR or FT_DEBUG_LEVEL_TRACE are defined */ - /* */ -/* #include <stdarg.h> -*/ -#endif /* __FTSTDLIB_H__ */ +#endif /* FTSTDLIB_H_ */ /* END */ |
