under dramatic changes...

This commit is contained in:
2014-07-02 14:29:01 +00:00
parent 45db0d7198
commit 69558e9e45
90 changed files with 129552 additions and 166 deletions

15
include/h2/cmn/str-priv.h Normal file
View File

@ -0,0 +1,15 @@
/* This is a private header. */
#ifdef __cplusplus
extern "C" {
#endif
int H2_XFUN(strcmp) (const h2_xchar_t* str1, const h2_xchar_t* str2);
h2_size_t H2_XFUN(strcpy) (h2_xchar_t* dst, const h2_xchar_t* src);
h2_size_t H2_XFUN(strfmc) (h2_xchar_t* buf, const h2_xchar_t* fmt, const h2_xchar_t* str[]);
h2_size_t H2_XFUN(strlen) (const h2_xchar_t* str);
#ifdef __cplusplus
}
#endif

36
include/h2/cmn/str.h Normal file
View File

@ -0,0 +1,36 @@
#ifndef _H2_STR_H_
#define _H2_STR_H_
#include <h2/types.h>
#include <h2/macros.h>
#if defined(H2_ENABLE_MCHAR)
# define h2_xchar_t h2_mchar_t
# define H2_XFUN(x) H2_FUN_M(x)
# include "str-priv.h"
# undef h2_xchar_t
# undef H2_XFUN
#endif
#if defined(H2_ENABLE_WCHAR)
# define h2_xchar_t h2_wchar_t
# define H2_XFUN(x) H2_FUN_W(x)
# include "str-priv.h"
# undef h2_xchar_t
# undef H2_XFUN
#endif
#if defined(H2_ENABLE_WWCHAR)
# define h2_xchar_t h2_wwchar_t
# define H2_XFUN(x) H2_FUN_WW(x)
# include "str-priv.h"
# undef h2_xchar_t
# undef H2_XFUN
#endif
#define h2_strcmp H2_FUN(strcmp)
#define h2_strcpy H2_FUN(strcpy)
#define h2_strfmc H2_FUN(strfmc)
#define h2_strlen H2_FUN(strlen)
#endif

109
include/h2/cmn/utf8.h Normal file
View File

@ -0,0 +1,109 @@
/*
* $Id$
*
Copyright 2006-2014 Chung, Hyung-Hwan.
This file is part of H2.
H2 is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation, either version 3 of
the License, or (at your option) any later version.
H2 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with H2. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _H2_CMN_UTF8_H_
#define _H2_CMN_UTF8_H_
#include <h2/types.h>
#include <h2/macros.h>
/** \file
* This file provides functions, types, macros for utf8 conversion.
*/
/**
* The H2_UTF8LEN_MAX macro defines the maximum number of bytes
* needed to form a single unicode character.
*/
#if H2_SIZEOF_WXCHAR_T == 2
# define H2_UTF8LEN_MAX 3
#elif H2_SIZEOF_WXCHAR_T == 4
# define H2_UTF8LEN_MAX 6
#else
# error Unsupported wide character size
#endif
#ifdef __cplusplus
extern "C" {
#endif
/**
* The h2_uctoutf8() function converts a unicode character to a utf8 sequence.
* \return
* - 0 is returned if \a uc is invalid.
* - An integer greater than \a size is returned if the \a utf8 sequence buffer
* is not #H2_NULL and not large enough. This integer is actually the number
* of bytes needed.
* - If \a utf8 is #H2_NULL, the number of bytes that would have been stored
* into \a utf8 if it had not been #H2_NULL is returned.
* - An integer between 1 and size inclusive is returned in all other cases.
* \note
* This function doesn't check invalid unicode code points and performs
* conversion compuationally.
*/
h2_size_t h2_uctoutf8 (
h2_wxchar_t uc,
h2_mchar_t* utf8,
h2_size_t size
);
/**
* The h2_utf8touc() function converts a utf8 sequence to a unicode character.
* \return
* - 0 is returned if the \a utf8 sequence is invalid.
* - An integer greater than \a size is returned if the \a utf8 sequence is
* not complete.
* - An integer between 1 and size inclusive is returned in all other cases.
*/
h2_size_t h2_utf8touc (
const h2_mchar_t* utf8,
h2_size_t size,
h2_wxchar_t* uc
);
/**
* The h2_utf8len() function scans at most \a size bytes from the \a utf8
* sequence and returns the number of bytes needed to form a single unicode
* character.
* \return
* - 0 is returned if the \a utf8 sequence is invalid.
* - An integer greater than \a size is returned if the \a utf8 sequence is
* not complete.
* - An integer between 1 and size inclusive is returned in all other cases.
*/
h2_size_t h2_utf8len (
const h2_mchar_t* utf8,
h2_size_t size
);
/**
* The h2_utf8lenmax() function returns the maximum number of bytes needed
* to form a single unicode character. Use #H2_UTF8LEN_MAX if you need a
* compile-time constant.
*/
h2_size_t h2_utf8lenmax (
void
);
#ifdef __cplusplus
}
#endif
#endif

947
include/h2/config.h.in Normal file
View File

@ -0,0 +1,947 @@
/* include/h2/config.h.in. Generated from configure.ac by autoheader. */
/* Define if building universal (internal helper macro) */
#undef AC_APPLE_UNIVERSAL_BUILD
/* Define h2_char_t to h2_mchar_t */
#undef H2_CHAR_IS_MCHAR
/* Define h2_char_t to h2_wchar_t */
#undef H2_CHAR_IS_WCHAR
/* Define h2_char_t to h2_wwchar_t */
#undef H2_CHAR_IS_WWCHAR
/* use the bundled unicode routines */
#undef H2_ENABLE_BUNDLED_UNICODE
/* Enable qse_mchar_t */
#undef H2_ENABLE_MCHAR
/* enable h2_sed_setexectracer() */
#undef H2_ENABLE_SED_TRACER
/* link modules statically into the main library */
#undef H2_ENABLE_STATIC_MODULE
/* Enable qse_wchar_t */
#undef H2_ENABLE_WCHAR
/* Enable qse_wwchar_t */
#undef H2_ENABLE_WWCHAR
/* include more built-in cmgrs like cp949 and cp950 */
#undef H2_ENABLE_XCMGRS
/* Big Endian */
#undef H2_ENDIAN_BIG
/* Little Endian */
#undef H2_ENDIAN_LITTLE
/* Unknown Endian */
#undef H2_ENDIAN_UNKNOWN
/* MB_LEN_MAX */
#undef H2_MBLEN_MAX
/* Author */
#undef H2_PACKAGE_AUTHOR
/* package name */
#undef H2_PACKAGE_NAME
/* Project URL */
#undef H2_PACKAGE_URL
/* Package version */
#undef H2_PACKAGE_VERSION
/* Major version number */
#undef H2_PACKAGE_VERSION_MAJOR
/* Minor version number */
#undef H2_PACKAGE_VERSION_MINOR
/* Patch level */
#undef H2_PACKAGE_VERSION_PATCH
/* sizeof(char) */
#undef H2_SIZEOF_CHAR
/* sizeof(double) */
#undef H2_SIZEOF_DOUBLE
/* sizeof(float) */
#undef H2_SIZEOF_FLOAT
/* sizeof(int) */
#undef H2_SIZEOF_INT
/* sizeof(long) */
#undef H2_SIZEOF_LONG
/* sizeof(long double) */
#undef H2_SIZEOF_LONG_DOUBLE
/* sizeof(long long) */
#undef H2_SIZEOF_LONG_LONG
/* sizeof(mbstate_t) */
#undef H2_SIZEOF_MBSTATE_T
/* sizeof(off64_t) */
#undef H2_SIZEOF_OFF64_T
/* sizeof(off_t) */
#undef H2_SIZEOF_OFF_T
/* sizeof(short) */
#undef H2_SIZEOF_SHORT
/* sizeof(struct sockaddr_in) */
#undef H2_SIZEOF_STRUCT_SOCKADDR_IN
/* sizeof(struct sockaddr_in6) */
#undef H2_SIZEOF_STRUCT_SOCKADDR_IN6
/* sizeof(void*) */
#undef H2_SIZEOF_VOID_P
/* sizeof(wchar_t) */
#undef H2_SIZEOF_WCHAR_T
/* sizeof(__float128) */
#undef H2_SIZEOF___FLOAT128
/* sizeof(__int128) */
#undef H2_SIZEOF___INT128
/* sizeof(__int128_t) */
#undef H2_SIZEOF___INT128_T
/* sizeof(__int16) */
#undef H2_SIZEOF___INT16
/* sizeof(__int32) */
#undef H2_SIZEOF___INT32
/* sizeof(__int64) */
#undef H2_SIZEOF___INT64
/* sizeof(__int8) */
#undef H2_SIZEOF___INT8
/* use h2_fltmax_t for floating-point numbers in AWK */
#undef H2_USE_AWK_FLTMAX
/* use h2_intmax_t for integers in AWK */
#undef H2_USE_AWK_INTMAX
/* use the syscall() function to invoke a system call */
#undef H2_USE_SYSCALL
/* Define to 1 if you have the `argz_add' function. */
#undef HAVE_ARGZ_ADD
/* Define to 1 if you have the `argz_append' function. */
#undef HAVE_ARGZ_APPEND
/* Define to 1 if you have the `argz_count' function. */
#undef HAVE_ARGZ_COUNT
/* Define to 1 if you have the `argz_create_sep' function. */
#undef HAVE_ARGZ_CREATE_SEP
/* Define to 1 if you have the <argz.h> header file. */
#undef HAVE_ARGZ_H
/* Define to 1 if you have the `argz_insert' function. */
#undef HAVE_ARGZ_INSERT
/* Define to 1 if you have the `argz_next' function. */
#undef HAVE_ARGZ_NEXT
/* Define to 1 if you have the `argz_stringify' function. */
#undef HAVE_ARGZ_STRINGIFY
/* Define to 1 if you have the `atan' function. */
#undef HAVE_ATAN
/* Define to 1 if you have the `atan2' function. */
#undef HAVE_ATAN2
/* Define to 1 if you have the `atan2f' function. */
#undef HAVE_ATAN2F
/* Define to 1 if you have the `atan2l' function. */
#undef HAVE_ATAN2L
/* Define to 1 if you have the `atan2q' function. */
#undef HAVE_ATAN2Q
/* Define to 1 if you have the `atanf' function. */
#undef HAVE_ATANF
/* Define to 1 if you have the `atanl' function. */
#undef HAVE_ATANL
/* Define to 1 if you have the `atanq' function. */
#undef HAVE_ATANQ
/* Define to 1 if you have the `backtrace' function. */
#undef HAVE_BACKTRACE
/* Define to 1 if you have the `backtrace_symbols' function. */
#undef HAVE_BACKTRACE_SYMBOLS
/* Define to 1 if you have the `ceil' function. */
#undef HAVE_CEIL
/* Define to 1 if you have the `ceilf' function. */
#undef HAVE_CEILF
/* Define to 1 if you have the `ceill' function. */
#undef HAVE_CEILL
/* Define to 1 if you have the `ceilq' function. */
#undef HAVE_CEILQ
/* Define to 1 if you have the `closedir' function. */
#undef HAVE_CLOSEDIR
/* Define to 1 if you have the `connect' function. */
#undef HAVE_CONNECT
/* Define to 1 if you have the `cos' function. */
#undef HAVE_COS
/* Define to 1 if you have the `cosf' function. */
#undef HAVE_COSF
/* Define to 1 if you have the `cosl' function. */
#undef HAVE_COSL
/* Define to 1 if you have the `cosq' function. */
#undef HAVE_COSQ
/* Define to 1 if you have the <crt_externs.h> header file. */
#undef HAVE_CRT_EXTERNS_H
/* Define if c++ supports namespace std. */
#undef HAVE_CXX_NAMESPACE_STD
/* Define to 1 if you have the declaration of `cygwin_conv_path', and to 0 if
you don't. */
#undef HAVE_DECL_CYGWIN_CONV_PATH
/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
*/
#undef HAVE_DIRENT_H
/* Define if you have the GNU dld library. */
#undef HAVE_DLD
/* Define to 1 if you have the <dld.h> header file. */
#undef HAVE_DLD_H
/* Define to 1 if you have the `dlerror' function. */
#undef HAVE_DLERROR
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
/* Define to 1 if you have the <dl.h> header file. */
#undef HAVE_DL_H
/* Define if you have the _dyld_func_lookup function. */
#undef HAVE_DYLD
/* epoll support */
#undef HAVE_EPOLL
/* Define to 1 if you have the `epoll_create' function. */
#undef HAVE_EPOLL_CREATE
/* Define to 1 if you have the `epoll_create1' function. */
#undef HAVE_EPOLL_CREATE1
/* Define to 1 if you have the <errno.h> header file. */
#undef HAVE_ERRNO_H
/* Define to 1 if the system has the type `error_t'. */
#undef HAVE_ERROR_T
/* Define to 1 if you have the <execinfo.h> header file. */
#undef HAVE_EXECINFO_H
/* Define to 1 if you have the `exp' function. */
#undef HAVE_EXP
/* Define to 1 if you have the `expf' function. */
#undef HAVE_EXPF
/* Define to 1 if you have the `expl' function. */
#undef HAVE_EXPL
/* Define to 1 if you have the `expq' function. */
#undef HAVE_EXPQ
/* Define to 1 if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H
/* Define to 1 if you have the `fdopendir' function. */
#undef HAVE_FDOPENDIR
/* Define to 1 if you have the `floor' function. */
#undef HAVE_FLOOR
/* Define to 1 if you have the `floorf' function. */
#undef HAVE_FLOORF
/* Define to 1 if you have the `floorl' function. */
#undef HAVE_FLOORL
/* Define to 1 if you have the `floorq' function. */
#undef HAVE_FLOORQ
/* Define to 1 if you have the `fmod' function. */
#undef HAVE_FMOD
/* Define to 1 if you have the `fmodf' function. */
#undef HAVE_FMODF
/* Define to 1 if you have the `fmodl' function. */
#undef HAVE_FMODL
/* Define to 1 if you have the `fmodq' function. */
#undef HAVE_FMODQ
/* Define to 1 if you have the `fork' function. */
#undef HAVE_FORK
/* Define to 1 if you have the `fstat64' function. */
#undef HAVE_FSTAT64
/* Define to 1 if you have the `ftruncate64' function. */
#undef HAVE_FTRUNCATE64
/* Define to 1 if you have the `getcontext' function. */
#undef HAVE_GETCONTEXT
/* Define to 1 if you have the `gethostbyname' function. */
#undef HAVE_GETHOSTBYNAME
/* Define to 1 if you have the `getifaddrs' function. */
#undef HAVE_GETIFADDRS
/* Define to 1 if you have the `getrlimit' function. */
#undef HAVE_GETRLIMIT
/* Define to 1 if you have the `gettid' function. */
#undef HAVE_GETTID
/* Define to 1 if you have the <ifaddrs.h> header file. */
#undef HAVE_IFADDRS_H
/* Define to 1 if you have the `if_indextoname' function. */
#undef HAVE_IF_INDEXTONAME
/* Define to 1 if you have the `if_nametoindex' function. */
#undef HAVE_IF_NAMETOINDEX
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the `isblank' function. */
#undef HAVE_ISBLANK
/* Define to 1 if you have the `iswblank' function. */
#undef HAVE_ISWBLANK
/* Define to 1 if you have the `iswctype' function. */
#undef HAVE_ISWCTYPE
/* Define to 1 if you have the `kevent' function. */
#undef HAVE_KEVENT
/* Define to 1 if you have the `kqueue' function. */
#undef HAVE_KQUEUE
/* Define to 1 if you have the `kqueue1' function. */
#undef HAVE_KQUEUE1
/* Define if you have the libdl library or equivalent. */
#undef HAVE_LIBDL
/* Define if libdlloader will be built on this platform */
#undef HAVE_LIBDLLOADER
/* Define to 1 if you have the `ltdl' library (-lltdl). */
#undef HAVE_LIBLTDL
/* Define to 1 if you have the <linux/ethtool.h> header file. */
#undef HAVE_LINUX_ETHTOOL_H
/* Define to 1 if you have the <linux/netfilter_ipv4.h> header file. */
#undef HAVE_LINUX_NETFILTER_IPV4_H
/* Define to 1 if you have the <linux/sockios.h> header file. */
#undef HAVE_LINUX_SOCKIOS_H
/* Define to 1 if you have the `log' function. */
#undef HAVE_LOG
/* Define to 1 if you have the `log10' function. */
#undef HAVE_LOG10
/* Define to 1 if you have the `log10f' function. */
#undef HAVE_LOG10F
/* Define to 1 if you have the `log10l' function. */
#undef HAVE_LOG10L
/* Define to 1 if you have the `log10q' function. */
#undef HAVE_LOG10Q
/* Define to 1 if you have the `logf' function. */
#undef HAVE_LOGF
/* Define to 1 if you have the `logl' function. */
#undef HAVE_LOGL
/* Define to 1 if you have the `logq' function. */
#undef HAVE_LOGQ
/* Define to 1 if you have the `lseek64' function. */
#undef HAVE_LSEEK64
/* Define to 1 if you have the `lstat64' function. */
#undef HAVE_LSTAT64
/* Define this if a modern libltdl is already installed */
#undef HAVE_LTDL
/* Define to 1 if you have the <mach-o/dyld.h> header file. */
#undef HAVE_MACH_O_DYLD_H
/* Define to 1 if you have the `makecontext' function. */
#undef HAVE_MAKECONTEXT
/* Define to 1 if you have the `mbrlen' function. */
#undef HAVE_MBRLEN
/* Define to 1 if you have the `mbrtowc' function. */
#undef HAVE_MBRTOWC
/* Define to 1 if you have the `mbsnrtowcs' function. */
#undef HAVE_MBSNRTOWCS
/* Define to 1 if you have the `mbsrtowcs' function. */
#undef HAVE_MBSRTOWCS
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have MPI libs and headers. */
#undef HAVE_MPI
/* Define to 1 if you have the `nanosleep' function. */
#undef HAVE_NANOSLEEP
/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
#undef HAVE_NDIR_H
/* Define to 1 if you have the <net/if_dl.h> header file. */
#undef HAVE_NET_IF_DL_H
/* Define to 1 if you have the <net/if.h> header file. */
#undef HAVE_NET_IF_H
/* Define to 1 if you have the `opendir' function. */
#undef HAVE_OPENDIR
/* Define to 1 if you have the `posix_spawn' function. */
#undef HAVE_POSIX_SPAWN
/* Define to 1 if you have the `pow' function. */
#undef HAVE_POW
/* Define to 1 if you have the `powf' function. */
#undef HAVE_POWF
/* Define to 1 if you have the `powl' function. */
#undef HAVE_POWL
/* Define to 1 if you have the `powq' function. */
#undef HAVE_POWQ
/* Define to 1 if you have the `prctl' function. */
#undef HAVE_PRCTL
/* Define if libtool can extract symbol lists from object files. */
#undef HAVE_PRELOADED_SYMBOLS
/* Define if you have POSIX threads libraries and header files. */
#undef HAVE_PTHREAD
/* Have PTHREAD_PRIO_INHERIT. */
#undef HAVE_PTHREAD_PRIO_INHERIT
/* Define to 1 if you have the <quadmath.h> header file. */
#undef HAVE_QUADMATH_H
/* Define to 1 if you have the `quadmath_snprintf' function. */
#undef HAVE_QUADMATH_SNPRINTF
/* Define to 1 if you have the `readdir' function. */
#undef HAVE_READDIR
/* Define to 1 if you have the `readdir64' function. */
#undef HAVE_READDIR64
/* Define to 1 if you have the `round' function. */
#undef HAVE_ROUND
/* Define to 1 if you have the `roundf' function. */
#undef HAVE_ROUNDF
/* Define to 1 if you have the `roundl' function. */
#undef HAVE_ROUNDL
/* Define to 1 if you have the `roundq' function. */
#undef HAVE_ROUNDQ
/* Define to 1 if you have the `select' function. */
#undef HAVE_SELECT
/* Define to 1 if you have the `sendfile' function. */
#undef HAVE_SENDFILE
/* Define to 1 if you have the `sendfile64' function. */
#undef HAVE_SENDFILE64
/* Define to 1 if you have the `sendfilev' function. */
#undef HAVE_SENDFILEV
/* Define to 1 if you have the `sendfilev64' function. */
#undef HAVE_SENDFILEV64
/* Define to 1 if you have the `setcontext' function. */
#undef HAVE_SETCONTEXT
/* Define to 1 if you have the `setrlimit' function. */
#undef HAVE_SETRLIMIT
/* Define if you have the shl_load function. */
#undef HAVE_SHL_LOAD
/* Define to 1 if you have the <signal.h> header file. */
#undef HAVE_SIGNAL_H
/* Define to 1 if you have the `sin' function. */
#undef HAVE_SIN
/* Define to 1 if you have the `sinf' function. */
#undef HAVE_SINF
/* Define to 1 if you have the `sinl' function. */
#undef HAVE_SINL
/* Define to 1 if you have the `sinq' function. */
#undef HAVE_SINQ
/* Define it socklen_t typedef is in sys/socket.h. */
#undef HAVE_SOCKLEN_T
/* Define to 1 if you have the <spawn.h> header file. */
#undef HAVE_SPAWN_H
/* Define to 1 if you have the `sqrt' function. */
#undef HAVE_SQRT
/* Define to 1 if you have the `sqrtf' function. */
#undef HAVE_SQRTF
/* Define to 1 if you have the `sqrtl' function. */
#undef HAVE_SQRTL
/* Define to 1 if you have the `sqrtq' function. */
#undef HAVE_SQRTQ
/* ssl support */
#undef HAVE_SSL
/* Define to 1 if you have the `SSL_library_init' function. */
#undef HAVE_SSL_LIBRARY_INIT
/* Define to 1 if you have the `stat64' function. */
#undef HAVE_STAT64
/* Define to 1 if you have the <stddef.h> header file. */
#undef HAVE_STDDEF_H
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the `strlcat' function. */
#undef HAVE_STRLCAT
/* Define to 1 if you have the `strlcpy' function. */
#undef HAVE_STRLCPY
/* Define to 1 if you have the `strtoflt128' function. */
#undef HAVE_STRTOFLT128
/* Define to 1 if `d_type' is a member of `struct dirent'. */
#undef HAVE_STRUCT_DIRENT_D_TYPE
/* Define to 1 if `ifr_ifindex' is a member of `struct ifreq'. */
#undef HAVE_STRUCT_IFREQ_IFR_IFINDEX
/* Define to 1 if `ifr_mtu' is a member of `struct ifreq'. */
#undef HAVE_STRUCT_IFREQ_IFR_MTU
/* Define to 1 if the system has the type `struct if_laddrreq'. */
#undef HAVE_STRUCT_IF_LADDRREQ
/* Define to 1 if the system has the type `struct lifconf'. */
#undef HAVE_STRUCT_LIFCONF
/* Define to 1 if the system has the type `struct lifreq'. */
#undef HAVE_STRUCT_LIFREQ
/* Define to 1 if `sin6_scope_id' is a member of `struct sockaddr_in6'. */
#undef HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID
/* Define to 1 if `st_birthtime' is a member of `struct stat'. */
#undef HAVE_STRUCT_STAT_ST_BIRTHTIME
/* Define to 1 if `st_birthtimespec.tv_nsec' is a member of `struct stat'. */
#undef HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC
/* Define to 1 if `st_birthtim.tv_nsec' is a member of `struct stat'. */
#undef HAVE_STRUCT_STAT_ST_BIRTHTIM_TV_NSEC
/* Define to 1 if `st_mtimespec.tv_nsec' is a member of `struct stat'. */
#undef HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC
/* Define to 1 if `st_mtim.tv_nsec' is a member of `struct stat'. */
#undef HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC
/* Define to 1 if you have the `swapcontext' function. */
#undef HAVE_SWAPCONTEXT
/* Define to 1 if you have the `sysconf' function. */
#undef HAVE_SYSCONF
/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
*/
#undef HAVE_SYS_DIR_H
/* Define to 1 if you have the <sys/dl.h> header file. */
#undef HAVE_SYS_DL_H
/* Define to 1 if you have the <sys/epoll.h> header file. */
#undef HAVE_SYS_EPOLL_H
/* Define to 1 if you have the <sys/event.h> header file. */
#undef HAVE_SYS_EVENT_H
/* Define to 1 if you have the <sys/ioctl.h> header file. */
#undef HAVE_SYS_IOCTL_H
/* Define to 1 if you have the <sys/macstat.h> header file. */
#undef HAVE_SYS_MACSTAT_H
/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
*/
#undef HAVE_SYS_NDIR_H
/* Define to 1 if you have the <sys/prctl.h> header file. */
#undef HAVE_SYS_PRCTL_H
/* Define to 1 if you have the <sys/resource.h> header file. */
#undef HAVE_SYS_RESOURCE_H
/* Define to 1 if you have the <sys/sendfile.h> header file. */
#undef HAVE_SYS_SENDFILE_H
/* Define to 1 if you have the <sys/socket.h> header file. */
#undef HAVE_SYS_SOCKET_H
/* Define to 1 if you have the <sys/sockio.h> header file. */
#undef HAVE_SYS_SOCKIO_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/stropts.h> header file. */
#undef HAVE_SYS_STROPTS_H
/* Define to 1 if you have the <sys/syscall.h> header file. */
#undef HAVE_SYS_SYSCALL_H
/* Define to 1 if you have the <sys/sysctl.h> header file. */
#undef HAVE_SYS_SYSCTL_H
/* Define to 1 if you have the <sys/time.h> header file. */
#undef HAVE_SYS_TIME_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if you have the <sys/wait.h> header file. */
#undef HAVE_SYS_WAIT_H
/* Define to 1 if you have the `tan' function. */
#undef HAVE_TAN
/* Define to 1 if you have the `tanf' function. */
#undef HAVE_TANF
/* Define to 1 if you have the `tanl' function. */
#undef HAVE_TANL
/* Define to 1 if you have the `tanq' function. */
#undef HAVE_TANQ
/* Define to 1 if you have the `timegm' function. */
#undef HAVE_TIMEGM
/* Define to 1 if you have the `timelocal' function. */
#undef HAVE_TIMELOCAL
/* Define to 1 if you have the <time.h> header file. */
#undef HAVE_TIME_H
/* Define to 1 if you have the `towctrans' function. */
#undef HAVE_TOWCTRANS
/* Define to 1 if you have the <uci.h> header file. */
#undef HAVE_UCI_H
/* Define to 1 if you have the <ucontext.h> header file. */
#undef HAVE_UCONTEXT_H
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define to 1 if you have the `uselocale' function. */
#undef HAVE_USELOCALE
/* Define to 1 if you have the `utime' function. */
#undef HAVE_UTIME
/* Define to 1 if you have the `utimes' function. */
#undef HAVE_UTIMES
/* Define to 1 if you have the <utime.h> header file. */
#undef HAVE_UTIME_H
/* va_copy is available */
#undef HAVE_VA_COPY
/* Define to 1 if you have the `vfork' function. */
#undef HAVE_VFORK
/* Define to 1 if you have the <wchar.h> header file. */
#undef HAVE_WCHAR_H
/* Define to 1 if you have the `wcrtomb' function. */
#undef HAVE_WCRTOMB
/* Define to 1 if you have the `wcsnrtombs' function. */
#undef HAVE_WCSNRTOMBS
/* Define to 1 if you have the `wcsrtombs' function. */
#undef HAVE_WCSRTOMBS
/* Define to 1 if you have the `wctrans' function. */
#undef HAVE_WCTRANS
/* Define to 1 if you have the `wctype' function. */
#undef HAVE_WCTYPE
/* Define to 1 if you have the <wctype.h> header file. */
#undef HAVE_WCTYPE_H
/* This value is set to 1 to indicate that the system argz facility works */
#undef HAVE_WORKING_ARGZ
/* Define to 1 if you have the `_vsnprintf' function. */
#undef HAVE__VSNPRINTF
/* Define to 1 if you have the `_vsnwprintf' function. */
#undef HAVE__VSNWPRINTF
/* __va_copy is available */
#undef HAVE___VA_COPY
/* Define if the OS needs help to load dependent libraries for dlopen(). */
#undef LTDL_DLOPEN_DEPLIBS
/* Define to the system default library search path. */
#undef LT_DLSEARCH_PATH
/* The archive extension */
#undef LT_LIBEXT
/* The archive prefix */
#undef LT_LIBPREFIX
/* Define to the extension used for runtime loadable modules, say, ".so". */
#undef LT_MODULE_EXT
/* Define to the name of the environment variable that determines the run-time
module search path. */
#undef LT_MODULE_PATH_VAR
/* Define to the sub-directory in which libtool stores uninstalled libraries.
*/
#undef LT_OBJDIR
/* Define to the shared library suffix, say, ".dylib". */
#undef LT_SHARED_EXT
/* Define if dlsym() requires a leading underscore in symbol names. */
#undef NEED_USCORE
/* The size of `MB_LEN_MAX', as computed by valueof. */
#undef NUMVALOF_MB_LEN_MAX
/* Name of package */
#undef PACKAGE
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the home page for this package. */
#undef PACKAGE_URL
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* Define to necessary symbol if this constant uses a non-standard name on
your system. */
#undef PTHREAD_CREATE_JOINABLE
/* The size of `char', as computed by sizeof. */
#undef SIZEOF_CHAR
/* The size of `double', as computed by sizeof. */
#undef SIZEOF_DOUBLE
/* The size of `float', as computed by sizeof. */
#undef SIZEOF_FLOAT
/* The size of `int', as computed by sizeof. */
#undef SIZEOF_INT
/* The size of `long', as computed by sizeof. */
#undef SIZEOF_LONG
/* The size of `long double', as computed by sizeof. */
#undef SIZEOF_LONG_DOUBLE
/* The size of `long long', as computed by sizeof. */
#undef SIZEOF_LONG_LONG
/* The size of `mbstate_t', as computed by sizeof. */
#undef SIZEOF_MBSTATE_T
/* The size of `off64_t', as computed by sizeof. */
#undef SIZEOF_OFF64_T
/* The size of `off_t', as computed by sizeof. */
#undef SIZEOF_OFF_T
/* The size of `short', as computed by sizeof. */
#undef SIZEOF_SHORT
/* The size of `struct sockaddr_in', as computed by sizeof. */
#undef SIZEOF_STRUCT_SOCKADDR_IN
/* The size of `struct sockaddr_in6', as computed by sizeof. */
#undef SIZEOF_STRUCT_SOCKADDR_IN6
/* The size of `void *', as computed by sizeof. */
#undef SIZEOF_VOID_P
/* The size of `wchar_t', as computed by sizeof. */
#undef SIZEOF_WCHAR_T
/* The size of `__float128', as computed by sizeof. */
#undef SIZEOF___FLOAT128
/* The size of `__int128', as computed by sizeof. */
#undef SIZEOF___INT128
/* The size of `__int128_t', as computed by sizeof. */
#undef SIZEOF___INT128_T
/* The size of `__int16', as computed by sizeof. */
#undef SIZEOF___INT16
/* The size of `__int16_t', as computed by sizeof. */
#undef SIZEOF___INT16_T
/* The size of `__int32', as computed by sizeof. */
#undef SIZEOF___INT32
/* The size of `__int32_t', as computed by sizeof. */
#undef SIZEOF___INT32_T
/* The size of `__int64', as computed by sizeof. */
#undef SIZEOF___INT64
/* The size of `__int64_t', as computed by sizeof. */
#undef SIZEOF___INT64_T
/* The size of `__int8', as computed by sizeof. */
#undef SIZEOF___INT8
/* The size of `__int8_t', as computed by sizeof. */
#undef SIZEOF___INT8_T
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Version number of package */
#undef VERSION
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
significant byte first (like Motorola and SPARC, unlike Intel). */
#if defined AC_APPLE_UNIVERSAL_BUILD
# if defined __BIG_ENDIAN__
# define WORDS_BIGENDIAN 1
# endif
#else
# ifndef WORDS_BIGENDIAN
# undef WORDS_BIGENDIAN
# endif
#endif
/* Define so that glibc/gnulib argp.h does not typedef error_t. */
#undef __error_t_defined
/* Define to a type to use for `error_t' if it is not otherwise available. */
#undef error_t

90
include/h2/macros.h Normal file
View File

@ -0,0 +1,90 @@
#ifndef _H2_MACROS_H_
#define _H2_MACROS_H_
#include <h2/types.h>
#define H2_MCHAR(x) ((h2_mchar_t)(x))
#define H2_WCHAR(x) ((h2_wchar_t)(x))
#define H2_WWCHAR(x) ((h2_wwchar_t)(x))
#define H2_FUN_M(x) h2_ ## x ## _m
#define H2_FUN_W(x) h2_ ## x ## _w
#define H2_FUN_WW(x) h2_ ## x ## _ww
#if defined(H2_CHAR_IS_MCHAR)
# define H2_CHAR(x) H2_MCHAR(x)
# define H2_FUN(x) H2_FUN_M(x)
#elif defined(H2_CHAR_IS_WCHAR)
# define H2_CHAR(x) H2_WCHAR(x)
# define H2_FUN(x) H2_FUN_W(x)
#elif defined(H2_CHAR_IS_WWCHAR)
# define H2_CHAR(x) H2_WWCHAR(x)
# define H2_FUN(x) H2_FUN_WW(x)
#else
# error Unknown default character type
#endif
/* Basic character codes... */
#define H2_CHAR_NUL 0
#define H2_CHAR_SPC 32
/**
* The H2_SIZEOF() macro gets data size in bytes. It is equivalent to the
* sizeof operator. The following code snippet should print sizeof(int)*128.
* @code
* int x[128];
* printf ("%d\n", (int)H2_SIZEOF(x));
* @endcode
*/
#define H2_SIZEOF(n) (sizeof(n))
/**
* The H2_COUNTOF() macro returns the number elements in an array.
* The following code snippet should print 128.
* @code
* int x[128];
* printf ("%d\n", (int)H2_COUNTOF(x));
* @endcode
*/
#define H2_COUNTOF(n) (sizeof(n)/sizeof(n[0]))
/**
* The #H2_NULL macro defines a special pointer value to indicate an error or
* that it does not point to anything.
*/
#ifdef __cplusplus
# if H2_SIZEOF_VOID_P == H2_SIZEOF_INT
# define H2_NULL (0)
# elif H2_SIZEOF_VOID_P == H2_SIZEOF_LONG
# define H2_NULL (0l)
# elif H2_SIZEOF_VOID_P == H2_SIZEOF_LONG_LONG
# define H2_NULL (0ll)
# else
# define H2_NULL (0)
# endif
#else
# define H2_NULL ((void*)0)
#endif
/* TODO: define these properly */
#define H2_ASSERT(expr) ((void)0)
#define H2_ASSERTX(expr,desc) ((void)0)
#if defined(__STDC_VERSION__) && (__STDC_VERSION__>=199901L)
# define H2_INLINE inline
# define H2_HAVE_INLINE
#elif defined(__GNUC__) && defined(__GNUC_GNU_INLINE__)
# define H2_INLINE /*extern*/ inline
# define H2_HAVE_INLINE
#else
# define H2_INLINE
# undef H2_HAVE_INLINE
#endif
#endif

571
include/h2/types.h Normal file
View File

@ -0,0 +1,571 @@
#ifndef _H2_TYPES_H_
#define _H2_TYPES_H_
/* WARNING: NEVER CHANGE/DELETE THE FOLLOWING H2_HAVE_CONFIG_H DEFINITION.
* IT IS USED FOR DEPLOYMENT BY MAKEFILE.AM */
/*#define H2_HAVE_CONFIG_H*/
#if defined(H2_HAVE_CONFIG_H)
# include <h2/config.h>
#elif defined(_WIN32)
# include <h2/conf-msw.h>
#elif defined(__OS2__)
# include <h2/conf-os2.h>
#elif defined(__DOS__)
# include <h2/conf-dos.h>
#elif defined(vms) || defined(__vms)
# include <h2/conf-vms.h>
#elif defined(macintosh)
# include <:h2:conf-mac.h> /* class mac os */
#else
# error Unsupported operating system
#endif
/** \typedef h2_int_t
* The h2_int_t type defines a signed integer type as large as a pointer.
*/
/** \typedef h2_uint_t
* The h2_uint_t type defines an unsigned integer type as large as a pointer.
*/
#if (defined(hpux) || defined(__hpux) || defined(__hpux__) || \
(defined(__APPLE__) && defined(__MACH__))) && \
(H2_SIZEOF_VOID_P == H2_SIZEOF_LONG)
typedef signed long h2_int_t;
typedef unsigned long h2_uint_t;
#define H2_SIZEOF_INT_T H2_SIZEOF_LONG
#define H2_SIZEOF_UINT_T H2_SIZEOF_LONG
#elif defined(__SPU__) && (H2_SIZEOF_VOID_P == H2_SIZEOF_LONG)
typedef signed long h2_int_t;
typedef unsigned long h2_uint_t;
#define H2_SIZEOF_INT_T H2_SIZEOF_LONG
#define H2_SIZEOF_UINT_T H2_SIZEOF_LONG
#elif H2_SIZEOF_VOID_P == H2_SIZEOF_INT
typedef signed int h2_int_t;
typedef unsigned int h2_uint_t;
#define H2_SIZEOF_INT_T H2_SIZEOF_INT
#define H2_SIZEOF_UINT_T H2_SIZEOF_INT
#elif H2_SIZEOF_VOID_P == H2_SIZEOF_LONG
typedef signed long h2_int_t;
typedef unsigned long h2_uint_t;
#define H2_SIZEOF_INT_T H2_SIZEOF_LONG
#define H2_SIZEOF_UINT_T H2_SIZEOF_LONG
#elif H2_SIZEOF_VOID_P == H2_SIZEOF_LONG_LONG
typedef signed long long h2_int_t;
typedef unsigned long long h2_uint_t;
#define H2_SIZEOF_INT_T H2_SIZEOF_LONG_LONG
#define H2_SIZEOF_UINT_T H2_SIZEOF_LONG_LONG
#elif H2_SIZEOF_VOID_P == H2_SIZEOF___INT32
typedef signed __int32 h2_int_t;
typedef unsigned __int32 h2_uint_t;
#define H2_SIZEOF_INT_T H2_SIZEOF___INT32
#define H2_SIZEOF_UINT_T H2_SIZEOF___INT32
#elif H2_SIZEOF_VOID_P == H2_SIZEOF___INT32_T
typedef __int32_t h2_int_t;
typedef __uint32_t h2_uint_t;
#define H2_SIZEOF_INT_T H2_SIZEOF___INT32_T
#define H2_SIZEOF_UINT_T H2_SIZEOF___INT32_T
#elif H2_SIZEOF_VOID_P == H2_SIZEOF___INT64
typedef signed __int64 h2_int_t;
typedef unsigned __int64 h2_uint_t;
#define H2_SIZEOF_INT_T H2_SIZEOF___INT64
#define H2_SIZEOF_UINT_T H2_SIZEOF___INT64
#elif H2_SIZEOF_VOID_P == H2_SIZEOF___INT64_T
typedef __int64_t h2_int_t;
typedef __uint64_t h2_uint_t;
#define H2_SIZEOF_INT_T H2_SIZEOF___INT64_T
#define H2_SIZEOF_UINT_T H2_SIZEOF___INT64_T
#elif H2_SIZEOF_VOID_P == H2_SIZEOF___INT128
typedef signed __int128 h2_int_t;
typedef unsigned __int128 h2_uint_t;
#define H2_SIZEOF_INT_T H2_SIZEOF___INT128
#define H2_SIZEOF_UINT_T H2_SIZEOF___INT128
#elif H2_SIZEOF_VOID_P == H2_SIZEOF___INT128_T
typedef __int128_t h2_int_t;
typedef __uint128_t h2_uint_t;
#define H2_SIZEOF_INT_T H2_SIZEOF___INT128_T
#define H2_SIZEOF_UINT_T H2_SIZEOF___INT128_T
#else
# error unsupported pointer size
#endif
/** \typedef h2_long_t
* The h2_long_t type defines the largest signed integer type that supported.
*/
/** \typedef h2_ulong_t
* The h2_ulong_t type defines the largest unsigned integer type supported.
*/
#if H2_SIZEOF_LONG >= H2_SIZEOF_LONG_LONG
typedef signed long h2_long_t;
typedef unsigned long h2_ulong_t;
#define H2_SIZEOF_LONG_T H2_SIZEOF_LONG
#define H2_SIZEOF_ULONG_T H2_SIZEOF_LONG
#elif H2_SIZEOF_LONG_LONG > 0
typedef signed long long h2_long_t;
typedef unsigned long long h2_ulong_t;
#define H2_SIZEOF_LONG_T H2_SIZEOF_LONG_LONG
#define H2_SIZEOF_ULONG_T H2_SIZEOF_LONG_LONG
#elif H2_SIZEOF___INT64 > 0
typedef signed __int64 h2_long_t;
typedef unsigned __int64 h2_ulong_t;
#define H2_SIZEOF_LONG_T H2_SIZEOF___INT64
#define H2_SIZEOF_ULONG_T H2_SIZEOF___INT64
#elif H2_SIZEOF___INT64_T > 0
typedef __int64_t h2_long_t;
typedef __uint64_t h2_ulong_t;
#define H2_SIZEOF_LONG_T H2_SIZEOF___INT64_T
#define H2_SIZEOF_ULONG_T H2_SIZEOF___INT64_T
#else
typedef signed long h2_long_t;
typedef unsigned long h2_ulong_t;
#define H2_SIZEOF_LONG_T H2_SIZEOF_LONG
#define H2_SIZEOF_ULONG_T H2_SIZEOF_LONG
#endif
/* these two items are revised whenever the size of a
* fixed-size integer is determined */
#define H2_SIZEOF_INTMAX_T 0
#define H2_SIZEOF_UINTMAX_T 0
/** \typedef h2_int8_t
* The h2_int8_t defines an 8-bit signed integer type.
*/
/** \typedef h2_uint8_t
* The h2_uint8_t type defines an 8-bit unsigned integer type.
*/
#if H2_SIZEOF_CHAR == 1
# define H2_HAVE_INT8_T
# define H2_HAVE_UINT8_T
typedef signed char h2_int8_t;
typedef unsigned char h2_uint8_t;
#elif H2_SIZEOF___INT8 == 1
# define H2_HAVE_INT8_T
# define H2_HAVE_UINT8_T
typedef signed __int8 h2_int8_t;
typedef unsigned __int8 h2_uint8_t;
#elif H2_SIZEOF___INT8_T == 1
# define H2_HAVE_INT8_T
# define H2_HAVE_UINT8_T
typedef __int8_t h2_int8_t;
typedef __uint8_t h2_uint8_t;
#endif
#ifdef H2_HAVE_INT8_T
# define H2_SIZEOF_INT8_T 1
# define H2_SIZEOF_UINT8_T 1
# undef H2_SIZEOF_INTMAX_T
# undef H2_SIZEOF_UINTMAX_T
# define H2_SIZEOF_INTMAX_T 1
# define H2_SIZEOF_UINTMAX_T 1
#else
# define H2_SIZEOF_INT8_T 0
# define H2_SIZEOF_UINT8_T 0
#endif
/** \typedef h2_int16_t
* The h2_int16_t defines an 16-bit signed integer type.
*/
/** \typedef h2_uint16_t
* The h2_uint16_t type defines an 16-bit unsigned integer type.
*/
#if H2_SIZEOF_SHORT == 2
# define H2_HAVE_INT16_T
# define H2_HAVE_UINT16_T
typedef signed short h2_int16_t;
typedef unsigned short h2_uint16_t;
#elif H2_SIZEOF___INT16 == 2
# define H2_HAVE_INT16_T
# define H2_HAVE_UINT16_T
typedef signed __int16 h2_int16_t;
typedef unsigned __int16 h2_uint16_t;
#elif H2_SIZEOF___INT16_T == 2
# define H2_HAVE_INT16_T
# define H2_HAVE_UINT16_T
typedef __int16_t h2_int16_t;
typedef __uint16_t h2_uint16_t;
#endif
#ifdef H2_HAVE_INT16_T
# define H2_SIZEOF_INT16_T 2
# define H2_SIZEOF_UINT16_T 2
# undef H2_SIZEOF_INTMAX_T
# undef H2_SIZEOF_UINTMAX_T
# define H2_SIZEOF_INTMAX_T 2
# define H2_SIZEOF_UINTMAX_T 2
#else
# define H2_SIZEOF_INT16_T 0
# define H2_SIZEOF_UINT16_T 0
#endif
/** \typedef h2_int32_t
* The h2_int32_t defines an 32-bit signed integer type.
*/
/** \typedef h2_uint32_t
* The h2_uint32_t type defines an 32-bit unsigned integer type.
*/
#if H2_SIZEOF_INT == 4
# define H2_HAVE_INT32_T
# define H2_HAVE_UINT32_T
typedef signed int h2_int32_t;
typedef unsigned int h2_uint32_t;
#elif H2_SIZEOF_LONG == 4
# define H2_HAVE_INT32_T
# define H2_HAVE_UINT32_T
typedef signed long h2_int32_t;
typedef unsigned long h2_uint32_t;
#elif H2_SIZEOF___INT32 == 4
# define H2_HAVE_INT32_T
# define H2_HAVE_UINT32_T
typedef signed __int32 h2_int32_t;
typedef unsigned __int32 h2_uint32_t;
#elif H2_SIZEOF___INT32_T == 4
# define H2_HAVE_INT32_T
# define H2_HAVE_UINT32_T
typedef __int32_t h2_int32_t;
typedef __uint32_t h2_uint32_t;
#endif
#ifdef H2_HAVE_INT32_T
# define H2_SIZEOF_INT32_T 4
# define H2_SIZEOF_UINT32_T 4
# undef H2_SIZEOF_INTMAX_T
# undef H2_SIZEOF_UINTMAX_T
# define H2_SIZEOF_INTMAX_T 4
# define H2_SIZEOF_UINTMAX_T 4
#else
# define H2_SIZEOF_INT32_T 0
# define H2_SIZEOF_UINT32_T 0
#endif
/** \typedef h2_int64_t
* The h2_int64_t defines an 64-bit signed integer type.
*/
/** \typedef h2_uint64_t
* The h2_uint64_t type defines an 64-bit unsigned integer type.
*/
#if H2_SIZEOF_INT == 8
# define H2_HAVE_INT64_T
# define H2_HAVE_UINT64_T
typedef signed int h2_int64_t;
typedef unsigned int h2_uint64_t;
#elif H2_SIZEOF_LONG == 8
# define H2_HAVE_INT64_T
# define H2_HAVE_UINT64_T
typedef signed long h2_int64_t;
typedef unsigned long h2_uint64_t;
#elif H2_SIZEOF_LONG_LONG == 8
# define H2_HAVE_INT64_T
# define H2_HAVE_UINT64_T
typedef signed long long h2_int64_t;
typedef unsigned long long h2_uint64_t;
#elif H2_SIZEOF___INT64 == 8
# define H2_HAVE_INT64_T
# define H2_HAVE_UINT64_T
typedef signed __int64 h2_int64_t;
typedef unsigned __int64 h2_uint64_t;
#elif H2_SIZEOF___INT64_T == 8
# define H2_HAVE_INT64_T
# define H2_HAVE_UINT64_T
typedef __int64_t h2_int64_t;
typedef __uint64_t h2_uint64_t;
#endif
#ifdef H2_HAVE_INT64_T
# define H2_SIZEOF_INT64_T 8
# define H2_SIZEOF_UINT64_T 8
# undef H2_SIZEOF_INTMAX_T
# undef H2_SIZEOF_UINTMAX_T
# define H2_SIZEOF_INTMAX_T 8
# define H2_SIZEOF_UINTMAX_T 8
#else
# define H2_SIZEOF_INT64_T 0
# define H2_SIZEOF_UINT64_T 0
#endif
#if H2_SIZEOF_INT == 16
# define H2_HAVE_INT128_T
# define H2_HAVE_UINT128_T
typedef signed int h2_int128_t;
typedef unsigned int h2_uint128_t;
#elif H2_SIZEOF_LONG == 16
# define H2_HAVE_INT128_T
# define H2_HAVE_UINT128_T
typedef signed long h2_int128_t;
typedef unsigned long h2_uint128_t;
#elif H2_SIZEOF_LONG_LONG == 16
# define H2_HAVE_INT128_T
# define H2_HAVE_UINT128_T
typedef signed long long h2_int128_t;
typedef unsigned long long h2_uint128_t;
#elif H2_SIZEOF___INT128 == 16
# define H2_HAVE_INT128_T
# define H2_HAVE_UINT128_T
typedef signed __int128 h2_int128_t;
typedef unsigned __int128 h2_uint128_t;
#elif (H2_SIZEOF___INT128_T == 16)
# define H2_HAVE_INT128_T
# define H2_HAVE_UINT128_T
typedef __int128_t h2_int128_t;
typedef __uint128_t h2_uint128_t;
#endif
#ifdef H2_HAVE_INT128_T
# define H2_SIZEOF_INT128_T 16
# define H2_SIZEOF_UINT128_T 16
# undef H2_SIZEOF_INTMAX_T
# undef H2_SIZEOF_UINTMAX_T
# define H2_SIZEOF_INTMAX_T 16
# define H2_SIZEOF_UINTMAX_T 16
#else
# define H2_SIZEOF_INT128_T 0
# define H2_SIZEOF_UINT128_T 0
#endif
/**
* The h2_byte_t defines a byte type.
*/
typedef h2_uint8_t h2_byte_t;
#define H2_SIZEOF_BYTE_T H2_SIZEOF_UINT8_T
/**
* The h2_size_t type defines an unsigned integer type that is as large as
* to hold a pointer value.
*/
#if defined(__SIZE_TYPE__) && defined(__SIZEOF_SIZE_T__)
typedef __SIZE_TYPE__ h2_size_t;
# define H2_SIZEOF_SIZE_T __SIZEOF_SIZE_T__
#else
typedef h2_uint_t h2_size_t;
# define H2_SIZEOF_SIZE_T H2_SIZEOF_UINT_T
#endif
/**
* The h2_ssize_t type defines a signed integer type that is as large as
* to hold a pointer value.
*/
typedef h2_int_t h2_ssize_t;
#define H2_SIZEOF_SSIZE_T H2_SIZEOF_INT_T
/**
* The h2_word_t type redefines h2_uint_t.
*/
typedef h2_uint_t h2_word_t;
#define H2_SIZEOF_WORD_T H2_SIZEOF_UINT_T
/**
* The h2_uintptr_t redefines h2_uint_t to indicate that you are dealing
* with a pointer.
*/
typedef h2_uint_t h2_uintptr_t;
#define H2_SIZEOF_UINTPTR_T H2_SIZEOF_UINT_T
/**
* The h2_untptr_t redefines h2_int_t to indicate that you are dealing
* with a pointer.
*/
typedef h2_int_t h2_intptr_t;
#define H2_SIZEOF_INTPTR_T H2_SIZEOF_INT_T
/** \typedef h2_intmax_t
* The h2_llong_t type defines the largest signed integer type supported.
*/
/** \typedef h2_uintmax_t
* The h2_ullong_t type defines the largest unsigned integer type supported.
*/
#if (H2_SIZEOF_LONG >= H2_SIZEOF_LONG_LONG) && \
(H2_SIZEOF_LONG >= H2_SIZEOF_INTMAX_T)
typedef long h2_intmax_t;
typedef unsigned long h2_uintmax_t;
#undef H2_SIZEOF_INTMAX_T
#undef H2_SIZEOF_UINTMAX_T
#define H2_SIZEOF_INTMAX_T H2_SIZEOF_LONG
#define H2_SIZEOF_UINTMAX_T H2_SIZEOF_LONG
#elif (H2_SIZEOF_LONG_LONG >= H2_SIZEOF_INTMAX_T)
typedef long long h2_intmax_t;
typedef unsigned long long h2_uintmax_t;
#undef H2_SIZEOF_INTMAX_T
#undef H2_SIZEOF_UINTMAX_T
#define H2_SIZEOF_INTMAX_T H2_SIZEOF_LONG_LONG
#define H2_SIZEOF_UINTMAX_T H2_SIZEOF_LONG_LONG
#elif (H2_SIZEOF_INTMAX_T == H2_SIZEOF_INT128_T)
typedef h2_int128_t h2_intmax_t;
typedef h2_uint128_t h2_uintmax_t;
/* H2_SIZEOF_INTMAX_T and H2_SIZEOF_UINTMAX_T are
* defined when h2_int128_t is defined */
#elif (H2_SIZEOF_INTMAX_T == H2_SIZEOF_INT64_T)
typedef h2_int64_t h2_intmax_t;
typedef h2_uint64_t h2_uintmax_t;
/* H2_SIZEOF_INTMAX_T and H2_SIZEOF_UINTMAX_T are
* defined when h2_int64_t is defined */
#elif (H2_SIZEOF_INTMAX_T == H2_SIZEOF_INT32_T)
typedef h2_int32_t h2_intmax_t;
typedef h2_uint32_t h2_uintmax_t;
/* H2_SIZEOF_INTMAX_T and H2_SIZEOF_UINTMAX_T are
* defined when h2_int32_t is defined */
#elif (H2_SIZEOF_INTMAX_T == H2_SIZEOF_INT16_T)
typedef h2_int16_t h2_intmax_t;
typedef h2_uint16_t h2_uintmax_t;
/* H2_SIZEOF_INTMAX_T and H2_SIZEOF_UINTMAX_T are
* defined when h2_int16_t is defined */
#elif (H2_SIZEOF_INTMAX_T == H2_SIZEOF_INT8_T)
typedef h2_int8_t h2_intmax_t;
typedef h2_uint8_t h2_uintmax_t;
/* H2_SIZEOF_INTMAX_T and H2_SIZEOF_UINTMAX_T are
* defined when h2_int8_t is defined */
#else
# error FATAL. THIS MUST NOT HAPPEN
#endif
/** \typedef h2_flt_t
* The h2_flt_t type defines the largest floating-pointer number type
* naturally supported.
*/
#if defined(__FreeBSD__) || defined(__MINGW32__)
/* TODO: check if the support for long double is complete.
* if so, use long double for h2_flt_t */
typedef double h2_flt_t;
# define H2_SIZEOF_FLT_T H2_SIZEOF_DOUBLE
#elif H2_SIZEOF_LONG_DOUBLE > H2_SIZEOF_DOUBLE
typedef long double h2_flt_t;
# define H2_SIZEOF_FLT_T H2_SIZEOF_LONG_DOUBLE
#else
typedef double h2_flt_t;
# define H2_SIZEOF_FLT_T H2_SIZEOF_DOUBLE
#endif
/** \typedef h2_fltmax_t
* The h2_fltmax_t type defines the largest floating-pointer number type
* ever supported.
*/
#if H2_SIZEOF___FLOAT128 >= H2_SIZEOF_FLT_T
/* the size of long double may be equal to the size of __float128
* for alignment on some platforms */
typedef __float128 h2_fltmax_t;
# define H2_SIZEOF_FLTMAX_T H2_SIZEOF___FLOAT128
#else
typedef h2_flt_t h2_fltmax_t;
# define H2_SIZEOF_FLTMAX_T H2_SIZEOF_FLT_T
#endif
/** \typedef h2_ptrdiff_t
*/
typedef h2_ssize_t h2_ptrdiff_t;
#define H2_SIZEOF_PTRDIFF_T H2_SIZEOF_SSIZE_T
/** \typdef h2_mchar_t
* The h2_mchar_t type is an alias to the char type.
*/
typedef char h2_mchar_t;
typedef int h2_mcint_t;
#define H2_SIZEOF_MCHAR_T H2_SIZEOF_CHAR
#define H2_SIZEOF_MCINT_T H2_SIZEOF_INT_T
/** \typedef h2_wchar_t
* The h2_wchar_t type defines a 16-bit wide character type.
*/
typedef h2_uint16_t h2_wchar_t;
typedef h2_uint32_t h2_wcint_t;
#define H2_SIZEOF_WCHAR_T H2_SIZEOF_UINT16_T
#define H2_SIZEOF_WCINT_T H2_SIZEOF_UINT32_T
/** typedef h2_wwchar_t
* The h2_wwchar_t type defines a 32-bit wide character type.
*/
typedef h2_uint32_t h2_wwchar_t;
typedef h2_uint32_t h2_wwcint_t;
#define H2_SIZEOF_WWCHAR_T H2_SIZEOF_UINT32_T
#define H2_SIZEOF_WWCINT_T H2_SIZEOF_UINT32_T
#if defined(H2_CHAR_IS_MCHAR)
typedef h2_mchar_t h2_char_t;
typedef h2_mcint_t h2_cint_t;
#elif defined(H2_CHAR_IS_WCHAR)
typedef h2_wchar_t h2_char_t;
typedef h2_wcint_t h2_cint_t;
#elif defined(H2_CHAR_IS_WWCHAR)
typedef h2_wwchar_t h2_char_t;
typedef h2_wwcint_t h2_cint_t;
#else
# error Unknown default character type
#endif
/** typedef h2_wxchar_t
* The h2_wxchar_t type defines the widest character type supported.
*/
typedef h2_wwchar_t h2_wxchar_t;
typedef h2_wwcint_t h2_wxcint_t;
#define H2_SIZEOF_WXCHAR_T H2_SIZEOF_WWCHAR_T
#define H2_SIZEOF_WXCINT_T H2_SIZEOF_WWCINT_T
#if defined(_WIN32) && defined(H2_ENABLE_WCHAR)
# define H2_OSCHAR_IS_WCHAR 1
#elif defined(H2_ENABLE_MCHAR)
# define H2_OSCHAR_IS_MCHAR 1
#else
# error Required OS character type is not enabled.
#endif
/** typedef h2_oschar_t
* The h2_oschar_t type defines the character type the operating system
* calls use. */
#if defined(H2_OSCHAR_IS_MCHAR)
typedef h2_mchar_t h2_oschar_t;
typedef h2_mcint_t h2_oscint_t;
# define H2_SIZEOF_OSCHAR_T H2_SIZEOF_MCHAR_T
# define H2_SIZEOF_OSCINT_T H2_SIZEOF_MCINT_T
#elif defined(H2_OSCHAR_IS_WCHAR)
typedef h2_wchar_t h2_oschar_t;
typedef h2_wcint_t h2_oscint_t;
# define H2_SIZEOF_OSCHAR_T H2_SIZEOF_WCHAR_T
# define H2_SIZEOF_OSCINT_T H2_SIZEOF_WCINT_T
#elif defined(H2_OSCHAR_IS_WWCHAR)
typedef h2_wwchar_t h2_oschar_t;
typedef h2_wwcint_t h2_oscint_t;
# define H2_SIZEOF_OSCHAR_T H2_SIZEOF_WWCHAR_T
# define H2_SIZEOF_OSCINT_T H2_SIZEOF_WWCINT_T
#else
# error Unknown OS character type
#endif
enum h2_char_type_t
{
H2_MCHAR_T = 0,
H2_WCHAR_T = 1,
H2_WWCHAR_T = 2,
#if defined(H2_CHAR_IS_MCHAR)
H2_CHAR_T = H2_MCHAR_T,
#elif defined(H2_CHAR_IS_WCHAR)
H2_CHAR_T = H2_WCHAR_T,
#elif defined(H2_CHAR_IS_WWCHAR)
H2_CHAR_T = H2_WWCHAR_T,
#else
# error Unknown default character type
#endif
#if defined(H2_OSCHAR_IS_MCHAR)
H2_OSCHAR_T = H2_MCHAR_T,
#elif defined(H2_OSCHAR_IS_WCHAR)
H2_OSCHAR_T = H2_WCHAR_T,
#elif defined(H2_OSCHAR_IS_WWCHAR)
H2_OSCHAR_T = H2_WWCHAR_T,
#else
# error Unknown OS character type
#endif
};
/* Special definiton to use Unicode APIs on Windows */
#if defined(_WIN32)
# if !defined(UNICODE)
# define UNICODE
# endif
# if !defined(_UNICODE)
# define _UNICODE
# endif
#endif
#endif