added the E notation support to some string-to-integer functions

This commit is contained in:
hyung-hwan 2021-07-12 14:40:51 +00:00
parent 802b8038bd
commit f1b9fcfdd0
21 changed files with 1484 additions and 91 deletions

View File

@ -3,7 +3,7 @@ ACLOCAL_AMFLAGS = -I m4
EXTRA_DIST =
SUBDIRS = lib bin
SUBDIRS = lib bin t
DIST_SUBDIRS = $(SUBDIRS)
distclean-local:

View File

@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.16.1 from Makefile.am.
# Makefile.in generated by automake 1.16.2 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2018 Free Software Foundation, Inc.
# Copyright (C) 1994-2020 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -338,7 +338,6 @@ pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
@ -350,7 +349,7 @@ top_srcdir = @top_srcdir@
AUTOMAKE_OPTION = foreign
ACLOCAL_AMFLAGS = -I m4
EXTRA_DIST =
SUBDIRS = lib bin
SUBDIRS = lib bin t
DIST_SUBDIRS = $(SUBDIRS)
all: all-recursive
@ -587,6 +586,10 @@ dist-xz: distdir
tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
$(am__post_remove_distdir)
dist-zstd: distdir
tardir=$(distdir) && $(am__tar) | zstd -c $${ZSTD_CLEVEL-$${ZSTD_OPT--19}} >$(distdir).tar.zst
$(am__post_remove_distdir)
dist-tarZ: distdir
@echo WARNING: "Support for distribution archives compressed with" \
"legacy program 'compress' is deprecated." >&2
@ -629,6 +632,8 @@ distcheck: dist
eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\
*.zip*) \
unzip $(distdir).zip ;;\
*.tar.zst*) \
zstd -dc $(distdir).tar.zst | $(am__untar) ;;\
esac
chmod -R a-w $(distdir)
chmod u+w $(distdir)
@ -806,18 +811,18 @@ uninstall-am:
am--refresh check check-am clean clean-cscope clean-generic \
clean-libtool cscope cscopelist-am ctags ctags-am dist \
dist-all dist-bzip2 dist-gzip dist-lzip dist-shar dist-tarZ \
dist-xz dist-zip distcheck distclean distclean-generic \
distclean-libtool distclean-local distclean-tags \
distcleancheck distdir distuninstallcheck dvi dvi-am html \
html-am info info-am install install-am install-data \
install-data-am install-dvi install-dvi-am install-exec \
install-exec-am install-html install-html-am install-info \
install-info-am install-man install-pdf install-pdf-am \
install-ps install-ps-am install-strip installcheck \
installcheck-am installdirs installdirs-am maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-generic \
mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \
uninstall-am
dist-xz dist-zip dist-zstd distcheck distclean \
distclean-generic distclean-libtool distclean-local \
distclean-tags distcleancheck distdir distuninstallcheck dvi \
dvi-am html html-am info info-am install install-am \
install-data install-data-am install-dvi install-dvi-am \
install-exec install-exec-am install-html install-html-am \
install-info install-info-am install-man install-pdf \
install-pdf-am install-ps install-ps-am install-strip \
installcheck installcheck-am installdirs installdirs-am \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags tags-am uninstall uninstall-am
.PRECIOUS: Makefile

17
mio/ac/ar-lib generated
View File

@ -2,9 +2,9 @@
# Wrapper for Microsoft lib.exe
me=ar-lib
scriptversion=2012-03-01.08; # UTC
scriptversion=2019-07-04.01; # UTC
# Copyright (C) 2010-2018 Free Software Foundation, Inc.
# Copyright (C) 2010-2020 Free Software Foundation, Inc.
# Written by Peter Rosin <peda@lysator.liu.se>.
#
# This program is free software; you can redistribute it and/or modify
@ -53,7 +53,7 @@ func_file_conv ()
MINGW*)
file_conv=mingw
;;
CYGWIN*)
CYGWIN* | MSYS*)
file_conv=cygwin
;;
*)
@ -65,7 +65,7 @@ func_file_conv ()
mingw)
file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
;;
cygwin)
cygwin | msys)
file=`cygpath -m "$file" || echo "$file"`
;;
wine)
@ -224,10 +224,11 @@ elif test -n "$extract"; then
esac
done
else
$AR -NOLOGO -LIST "$archive" | sed -e 's/\\/\\\\/g' | while read member
do
$AR -NOLOGO -EXTRACT:"$member" "$archive" || exit $?
done
$AR -NOLOGO -LIST "$archive" | tr -d '\r' | sed -e 's/\\/\\\\/g' \
| while read member
do
$AR -NOLOGO -EXTRACT:"$member" "$archive" || exit $?
done
fi
elif test -n "$quick$replace"; then

6
mio/ac/compile generated
View File

@ -3,7 +3,7 @@
scriptversion=2018-03-07.03; # UTC
# Copyright (C) 1999-2018 Free Software Foundation, Inc.
# Copyright (C) 1999-2020 Free Software Foundation, Inc.
# Written by Tom Tromey <tromey@cygnus.com>.
#
# This program is free software; you can redistribute it and/or modify
@ -53,7 +53,7 @@ func_file_conv ()
MINGW*)
file_conv=mingw
;;
CYGWIN*)
CYGWIN* | MSYS*)
file_conv=cygwin
;;
*)
@ -67,7 +67,7 @@ func_file_conv ()
mingw/*)
file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
;;
cygwin/*)
cygwin/* | msys/*)
file=`cygpath -m "$file" || echo "$file"`
;;
wine/*)

2
mio/ac/depcomp generated
View File

@ -3,7 +3,7 @@
scriptversion=2018-03-07.03; # UTC
# Copyright (C) 1999-2018 Free Software Foundation, Inc.
# Copyright (C) 1999-2020 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

13
mio/ac/install-sh generated
View File

@ -451,7 +451,18 @@ do
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
# Copy the file name to the temp name.
(umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
(umask $cp_umask &&
{ test -z "$stripcmd" || {
# Create $dsttmp read-write so that cp doesn't create it read-only,
# which would cause strip to fail.
if test -z "$doit"; then
: >"$dsttmp" # No need to fork-exec 'touch'.
else
$doit touch "$dsttmp"
fi
}
} &&
$doit_exec $cpprog "$src" "$dsttmp") &&
# and set any options; do chmod last to preserve setuid bits.
#

2
mio/ac/missing generated
View File

@ -3,7 +3,7 @@
scriptversion=2018-03-07.03; # UTC
# Copyright (C) 1996-2018 Free Software Foundation, Inc.
# Copyright (C) 1996-2020 Free Software Foundation, Inc.
# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
# This program is free software; you can redistribute it and/or modify

50
mio/aclocal.m4 vendored
View File

@ -1,6 +1,6 @@
# generated automatically by aclocal 1.16.1 -*- Autoconf -*-
# generated automatically by aclocal 1.16.2 -*- Autoconf -*-
# Copyright (C) 1996-2018 Free Software Foundation, Inc.
# Copyright (C) 1996-2020 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -20,7 +20,7 @@ You have another version of autoconf. It may work, but is not guaranteed to.
If you have problems, you may need to regenerate the build system entirely.
To do so, use the procedure documented by the package, typically 'autoreconf'.])])
# Copyright (C) 2002-2018 Free Software Foundation, Inc.
# Copyright (C) 2002-2020 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -35,7 +35,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION],
[am__api_version='1.16'
dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
dnl require some minimum version. Point them to the right macro.
m4_if([$1], [1.16.1], [],
m4_if([$1], [1.16.2], [],
[AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
])
@ -51,12 +51,12 @@ m4_define([_AM_AUTOCONF_VERSION], [])
# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
[AM_AUTOMAKE_VERSION([1.16.1])dnl
[AM_AUTOMAKE_VERSION([1.16.2])dnl
m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
# Copyright (C) 2011-2018 Free Software Foundation, Inc.
# Copyright (C) 2011-2020 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -118,7 +118,7 @@ AC_SUBST([AR])dnl
# AM_AUX_DIR_EXPAND -*- Autoconf -*-
# Copyright (C) 2001-2018 Free Software Foundation, Inc.
# Copyright (C) 2001-2020 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -170,7 +170,7 @@ am_aux_dir=`cd "$ac_aux_dir" && pwd`
# AM_CONDITIONAL -*- Autoconf -*-
# Copyright (C) 1997-2018 Free Software Foundation, Inc.
# Copyright (C) 1997-2020 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -201,7 +201,7 @@ AC_CONFIG_COMMANDS_PRE(
Usually this means the macro was only invoked conditionally.]])
fi])])
# Copyright (C) 1999-2018 Free Software Foundation, Inc.
# Copyright (C) 1999-2020 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -392,7 +392,7 @@ _AM_SUBST_NOTMAKE([am__nodep])dnl
# Generate code to set up dependency tracking. -*- Autoconf -*-
# Copyright (C) 1999-2018 Free Software Foundation, Inc.
# Copyright (C) 1999-2020 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -431,7 +431,9 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
done
if test $am_rc -ne 0; then
AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
for automatic dependency tracking. Try re-running configure with the
for automatic dependency tracking. If GNU make was not used, consider
re-running the configure script with MAKE="gmake" (or whatever is
necessary). You can also try re-running configure with the
'--disable-dependency-tracking' option to at least be able to build
the package (albeit without support for automatic dependency tracking).])
fi
@ -458,7 +460,7 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
# Do all the work for Automake. -*- Autoconf -*-
# Copyright (C) 1996-2018 Free Software Foundation, Inc.
# Copyright (C) 1996-2020 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -655,7 +657,7 @@ for _am_header in $config_headers :; do
done
echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
# Copyright (C) 2001-2018 Free Software Foundation, Inc.
# Copyright (C) 2001-2020 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -676,7 +678,7 @@ if test x"${install_sh+set}" != xset; then
fi
AC_SUBST([install_sh])])
# Copyright (C) 2003-2018 Free Software Foundation, Inc.
# Copyright (C) 2003-2020 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -697,7 +699,7 @@ AC_SUBST([am__leading_dot])])
# Check to see how 'make' treats includes. -*- Autoconf -*-
# Copyright (C) 2001-2018 Free Software Foundation, Inc.
# Copyright (C) 2001-2020 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -740,7 +742,7 @@ AC_SUBST([am__quote])])
# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
# Copyright (C) 1997-2018 Free Software Foundation, Inc.
# Copyright (C) 1997-2020 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -779,7 +781,7 @@ fi
# Helper functions for option handling. -*- Autoconf -*-
# Copyright (C) 2001-2018 Free Software Foundation, Inc.
# Copyright (C) 2001-2020 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -808,7 +810,7 @@ AC_DEFUN([_AM_SET_OPTIONS],
AC_DEFUN([_AM_IF_OPTION],
[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
# Copyright (C) 1999-2018 Free Software Foundation, Inc.
# Copyright (C) 1999-2020 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -855,7 +857,7 @@ AC_LANG_POP([C])])
# For backward compatibility.
AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
# Copyright (C) 2001-2018 Free Software Foundation, Inc.
# Copyright (C) 2001-2020 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -874,7 +876,7 @@ AC_DEFUN([AM_RUN_LOG],
# Check to make sure that the build environment is sane. -*- Autoconf -*-
# Copyright (C) 1996-2018 Free Software Foundation, Inc.
# Copyright (C) 1996-2020 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -955,7 +957,7 @@ AC_CONFIG_COMMANDS_PRE(
rm -f conftest.file
])
# Copyright (C) 2009-2018 Free Software Foundation, Inc.
# Copyright (C) 2009-2020 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -1015,7 +1017,7 @@ AC_SUBST([AM_BACKSLASH])dnl
_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
])
# Copyright (C) 2001-2018 Free Software Foundation, Inc.
# Copyright (C) 2001-2020 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -1043,7 +1045,7 @@ fi
INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
AC_SUBST([INSTALL_STRIP_PROGRAM])])
# Copyright (C) 2006-2018 Free Software Foundation, Inc.
# Copyright (C) 2006-2020 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -1062,7 +1064,7 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
# Check how to create a tarball. -*- Autoconf -*-
# Copyright (C) 2004-2018 Free Software Foundation, Inc.
# Copyright (C) 2004-2020 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,

View File

@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.16.1 from Makefile.am.
# Makefile.in generated by automake 1.16.2 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2018 Free Software Foundation, Inc.
# Copyright (C) 1994-2020 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -354,7 +354,6 @@ pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@

31
mio/configure vendored
View File

@ -761,7 +761,6 @@ infodir
docdir
oldincludedir
includedir
runstatedir
localstatedir
sharedstatedir
sysconfdir
@ -852,7 +851,6 @@ datadir='${datarootdir}'
sysconfdir='${prefix}/etc'
sharedstatedir='${prefix}/com'
localstatedir='${prefix}/var'
runstatedir='${localstatedir}/run'
includedir='${prefix}/include'
oldincludedir='/usr/include'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
@ -1105,15 +1103,6 @@ do
| -silent | --silent | --silen | --sile | --sil)
silent=yes ;;
-runstatedir | --runstatedir | --runstatedi | --runstated \
| --runstate | --runstat | --runsta | --runst | --runs \
| --run | --ru | --r)
ac_prev=runstatedir ;;
-runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
| --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
| --run=* | --ru=* | --r=*)
runstatedir=$ac_optarg ;;
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
ac_prev=sbindir ;;
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@ -1251,7 +1240,7 @@ fi
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
datadir sysconfdir sharedstatedir localstatedir includedir \
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
libdir localedir mandir runstatedir
libdir localedir mandir
do
eval ac_val=\$$ac_var
# Remove trailing slashes.
@ -1404,7 +1393,6 @@ Fine tuning of the installation directories:
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
--runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
--libdir=DIR object code libraries [EPREFIX/lib]
--includedir=DIR C header files [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc [/usr/include]
@ -13356,7 +13344,7 @@ else
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
@ -13402,7 +13390,7 @@ else
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
@ -13426,7 +13414,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
@ -13471,7 +13459,7 @@ else
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
@ -13495,7 +13483,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
@ -18985,7 +18973,7 @@ MIO_PROJECT_AUTHOR="${PACKAGE_BUGREPORT}"
MIO_PROJECT_URL="${PACKAGE_URL}"
ac_config_files="$ac_config_files Makefile lib/Makefile bin/Makefile"
ac_config_files="$ac_config_files Makefile lib/Makefile bin/Makefile t/Makefile"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
@ -20027,6 +20015,7 @@ do
"Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
"lib/Makefile") CONFIG_FILES="$CONFIG_FILES lib/Makefile" ;;
"bin/Makefile") CONFIG_FILES="$CONFIG_FILES bin/Makefile" ;;
"t/Makefile") CONFIG_FILES="$CONFIG_FILES t/Makefile" ;;
*) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
esac
@ -20704,7 +20693,9 @@ $as_echo X/"$am_mf" |
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "Something went wrong bootstrapping makefile fragments
for automatic dependency tracking. Try re-running configure with the
for automatic dependency tracking. If GNU make was not used, consider
re-running the configure script with MAKE=\"gmake\" (or whatever is
necessary). You can also try re-running configure with the
'--disable-dependency-tracking' option to at least be able to build
the package (albeit without support for automatic dependency tracking).
See \`config.log' for more details" "$LINENO" 5; }

View File

@ -815,6 +815,7 @@ AC_CONFIG_FILES([
Makefile
lib/Makefile
bin/Makefile
t/Makefile
])
AC_OUTPUT

View File

@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.16.1 from Makefile.am.
# Makefile.in generated by automake 1.16.2 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2018 Free Software Foundation, Inc.
# Copyright (C) 1994-2020 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -250,8 +250,8 @@ am__include_HEADERS_DIST = mio-cfg.h mio-chr.h mio-cmn.h mio-dns.h \
mio-pro.h mio-sck.h mio-skad.h mio-thr.h mio-upac.h mio-utl.h \
mio.h mio-mar.h
HEADERS = $(include_HEADERS)
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \
$(LISP)mio-cfg.h.in
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) \
mio-cfg.h.in
# Read a list of newline-separated strings from the standard input,
# and print each of them once, without duplicates. Input order is
# *not* preserved.
@ -403,7 +403,6 @@ pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@

View File

@ -468,7 +468,7 @@ static int cgi_peer_htrd_peek (mio_htrd_t* htrd, mio_htre_t* req)
const mio_bch_t* endptr;
mio_intmax_t v;
v = mio_bchars_to_intmax(req->attr.status, mio_count_bcstr(req->attr.status), MIO_BCHARS_TO_INTMAX_MAKE_OPTION(0,0,10), &endptr, &is_sober);
v = mio_bchars_to_intmax(req->attr.status, mio_count_bcstr(req->attr.status), MIO_BCHARS_TO_INTMAX_MAKE_OPTION(0,0,0,10), &endptr, &is_sober);
if (*endptr == '\0' && is_sober && v > 0 && v <= MIO_TYPE_MAX(int)) status_code = v;
}

View File

@ -468,7 +468,7 @@ static int thr_peer_htrd_peek (mio_htrd_t* htrd, mio_htre_t* req)
const mio_bch_t* endptr;
mio_intmax_t v;
v = mio_bchars_to_intmax(req->attr.status, mio_count_bcstr(req->attr.status), MIO_BCHARS_TO_INTMAX_MAKE_OPTION(0,0,10), &endptr, &is_sober);
v = mio_bchars_to_intmax(req->attr.status, mio_count_bcstr(req->attr.status), MIO_BCHARS_TO_INTMAX_MAKE_OPTION(0,0,0,10), &endptr, &is_sober);
if (*endptr == '\0' && is_sober && v > 0 && v <= MIO_TYPE_MAX(int)) status_code = v;
}

View File

@ -548,32 +548,38 @@ MIO_EXPORT mio_oow_t mio_byte_to_bcstr (
);
/* ------------------------------------------------------------------------- */
#define MIO_OOCHARS_TO_INTMAX_MAKE_OPTION(ltrim,rtrim,base) (((!!(ltrim)) << 2) | ((!!(rtrim)) << 4) | ((base) << 8))
#define MIO_OOCHARS_TO_INTMAX_MAKE_OPTION(e,ltrim,rtrim,base) (((!!(e)) << 0) | ((!!(ltrim)) << 2) | ((!!(rtrim)) << 3) | ((base) << 8))
#define MIO_OOCHARS_TO_INTMAX_GET_OPTION_E(option) ((option) & 1)
#define MIO_OOCHARS_TO_INTMAX_GET_OPTION_LTRIM(option) ((option) & 4)
#define MIO_OOCHARS_TO_INTMAX_GET_OPTION_RTRIM(option) ((option) & 8)
#define MIO_OOCHARS_TO_INTMAX_GET_OPTION_BASE(option) ((option) >> 8)
#define MIO_OOCHARS_TO_UINTMAX_MAKE_OPTION(ltrim,rtrim,base) (((!!(ltrim)) << 2) | ((!!(rtrim)) << 4) | ((base) << 8))
#define MIO_OOCHARS_TO_UINTMAX_MAKE_OPTION(e,ltrim,rtrim,base) (((!!(e)) << 0) | ((!!(ltrim)) << 2) | ((!!(rtrim)) << 3) | ((base) << 8))
#define MIO_OOCHARS_TO_UINTMAX_GET_OPTION_E(option) ((option) & 1)
#define MIO_OOCHARS_TO_UINTMAX_GET_OPTION_LTRIM(option) ((option) & 4)
#define MIO_OOCHARS_TO_UINTMAX_GET_OPTION_RTRIM(option) ((option) & 8)
#define MIO_OOCHARS_TO_UINTMAX_GET_OPTION_BASE(option) ((option) >> 8)
#define MIO_UCHARS_TO_INTMAX_MAKE_OPTION(ltrim,rtrim,base) MIO_OOCHARS_TO_INTMAX_MAKE_OPTION(ltrim,rtrim,base)
#define MIO_UCHARS_TO_INTMAX_MAKE_OPTION(e,ltrim,rtrim,base) MIO_OOCHARS_TO_INTMAX_MAKE_OPTION(e,ltrim,rtrim,base)
#define MIO_UCHARS_TO_INTMAX_GET_OPTION_E(option) MIO_OOCHARS_TO_INTMAX_GET_OPTION_E(option)
#define MIO_UCHARS_TO_INTMAX_GET_OPTION_LTRIM(option) MIO_OOCHARS_TO_INTMAX_GET_OPTION_LTRIM(option)
#define MIO_UCHARS_TO_INTMAX_GET_OPTION_RTRIM(option) MIO_OOCHARS_TO_INTMAX_GET_OPTION_RTRIM(option)
#define MIO_UCHARS_TO_INTMAX_GET_OPTION_BASE(option) MIO_OOCHARS_TO_INTMAX_GET_OPTION_BASE(option)
#define MIO_BCHARS_TO_INTMAX_MAKE_OPTION(ltrim,rtrim,base) MIO_OOCHARS_TO_INTMAX_MAKE_OPTION(ltrim,rtrim,base)
#define MIO_BCHARS_TO_INTMAX_MAKE_OPTION(e,ltrim,rtrim,base) MIO_OOCHARS_TO_INTMAX_MAKE_OPTION(e,ltrim,rtrim,base)
#define MIO_BCHARS_TO_INTMAX_GET_OPTION_E(option) MIO_OOCHARS_TO_INTMAX_GET_OPTION_E(option)
#define MIO_BCHARS_TO_INTMAX_GET_OPTION_LTRIM(option) MIO_OOCHARS_TO_INTMAX_GET_OPTION_LTRIM(option)
#define MIO_BCHARS_TO_INTMAX_GET_OPTION_RTRIM(option) MIO_OOCHARS_TO_INTMAX_GET_OPTION_RTRIM(option)
#define MIO_BCHARS_TO_INTMAX_GET_OPTION_BASE(option) MIO_OOCHARS_TO_INTMAX_GET_OPTION_BASE(option)
#define MIO_UCHARS_TO_UINTMAX_MAKE_OPTION(ltrim,rtrim,base) MIO_OOCHARS_TO_UINTMAX_MAKE_OPTION(ltrim,rtrim,base)
#define MIO_UCHARS_TO_UINTMAX_MAKE_OPTION(e,ltrim,rtrim,base) MIO_OOCHARS_TO_UINTMAX_MAKE_OPTION(e,ltrim,rtrim,base)
#define MIO_UCHARS_TO_UINTMAX_GET_OPTION_E(option) MIO_OOCHARS_TO_UINTMAX_GET_OPTION_E(option)
#define MIO_UCHARS_TO_UINTMAX_GET_OPTION_LTRIM(option) MIO_OOCHARS_TO_UINTMAX_GET_OPTION_LTRIM(option)
#define MIO_UCHARS_TO_UINTMAX_GET_OPTION_RTRIM(option) MIO_OOCHARS_TO_UINTMAX_GET_OPTION_RTRIM(option)
#define MIO_UCHARS_TO_UINTMAX_GET_OPTION_BASE(option) MIO_OOCHARS_TO_UINTMAX_GET_OPTION_BASE(option)
#define MIO_BCHARS_TO_UINTMAX_MAKE_OPTION(ltrim,rtrim,base) MIO_OOCHARS_TO_UINTMAX_MAKE_OPTION(ltrim,rtrim,base)
#define MIO_BCHARS_TO_UINTMAX_MAKE_OPTION(e,ltrim,rtrim,base) MIO_OOCHARS_TO_UINTMAX_MAKE_OPTION(e,ltrim,rtrim,base)
#define MIO_BCHARS_TO_UINTMAX_GET_OPTION_E(option) MIO_OOCHARS_TO_UINTMAX_GET_OPTION_E(option)
#define MIO_BCHARS_TO_UINTMAX_GET_OPTION_LTRIM(option) MIO_OOCHARS_TO_UINTMAX_GET_OPTION_LTRIM(option)
#define MIO_BCHARS_TO_UINTMAX_GET_OPTION_RTRIM(option) MIO_OOCHARS_TO_UINTMAX_GET_OPTION_RTRIM(option)
#define MIO_BCHARS_TO_UINTMAX_GET_OPTION_BASE(option) MIO_OOCHARS_TO_UINTMAX_GET_OPTION_BASE(option)

View File

@ -1155,6 +1155,33 @@ mio_oow_t mio_byte_to_bcstr (mio_uint8_t byte, mio_bch_t* buf, mio_oow_t size, i
/* ========================================================================= */
#define HANDLE_E() \
if (*p == 'E') \
{ \
mio_uintmax_t e = 0, i; \
int e_neg = 0; \
p++; \
if (*p == '+') \
{ \
p++; \
} \
else if (*p == '-') \
{ \
p++; e_neg = 1; \
} \
while (p < end) \
{ \
digit = MIO_ZDIGIT_TO_NUM(*p, base); \
if (digit >= base) break; \
e = e * base + digit; \
p++; \
} \
if (e_neg) \
for (i = 0; i < e; i++) n /= 10; \
else \
for (i = 0; i < e; i++) n *= 10; \
}
mio_intmax_t mio_uchars_to_intmax (const mio_uch_t* str, mio_oow_t len, int option, const mio_uch_t** endptr, int* is_sober)
{
mio_intmax_t n = 0;
@ -1227,6 +1254,11 @@ mio_intmax_t mio_uchars_to_intmax (const mio_uch_t* str, mio_oow_t len, int opti
p++;
}
if (MIO_UCHARS_TO_INTMAX_GET_OPTION_E(option))
{
HANDLE_E();
}
/* base 8: at least a zero digit has been seen.
* other case: p > pp to be able to have at least 1 meaningful digit. */
if (is_sober) *is_sober = (base == 8 || p > pp);
@ -1313,6 +1345,11 @@ mio_intmax_t mio_bchars_to_intmax (const mio_bch_t* str, mio_oow_t len, int opti
p++;
}
if (MIO_BCHARS_TO_INTMAX_GET_OPTION_E(option))
{
HANDLE_E();
}
/* base 8: at least a zero digit has been seen.
* other case: p > pp to be able to have at least 1 meaningful digit. */
if (is_sober) *is_sober = (base == 8 || p > pp);
@ -1395,6 +1432,11 @@ mio_uintmax_t mio_uchars_to_uintmax (const mio_uch_t* str, mio_oow_t len, int op
p++;
}
if (MIO_UCHARS_TO_UINTMAX_GET_OPTION_E(option))
{
HANDLE_E();
}
/* base 8: at least a zero digit has been seen.
* other case: p > pp to be able to have at least 1 meaningful digit. */
if (is_sober) *is_sober = (base == 8 || p > pp);
@ -1476,6 +1518,11 @@ mio_uintmax_t mio_bchars_to_uintmax (const mio_bch_t* str, mio_oow_t len, int op
p++;
}
if (MIO_BCHARS_TO_UINTMAX_GET_OPTION_E(option))
{
HANDLE_E();
}
/* base 8: at least a zero digit has been seen.
* other case: p > pp to be able to have at least 1 meaningful digit. */
if (is_sober) *is_sober = (base == 8 || p > pp);

36
mio/t/Makefile.am Normal file
View File

@ -0,0 +1,36 @@
AUTOMAKE_OPTIONS = nostdinc
CPPFLAGS_COMMON = \
-I$(abs_builddir) \
-I$(abs_builddir)/../lib \
-I$(abs_srcdir) \
-I$(abs_srcdir)/../lib \
-I$(includedir)
CFLAGS_COMMON =
LDFLAGS_COMMON=-L$(abs_builddir)/../lib -L$(libdir)
## place $(LIBM) here as all programs below are C only programs linked
## against the C/C++ hybrid library. Read comments in ../bin/Makefile.am
## for more information.
LIBADD_COMMON = ../lib/libmio.la $(LIBM)
check_SCRIPTS =
##noinst_SCRIPTS = $(check_SCRIPTS)
EXTRA_DIST = $(check_SCRIPTS)
check_PROGRAMS = t-001 t-002
t_001_SOURCES = t-001.c t.h
t_001_CPPFLAGS = $(CPPFLAGS_COMMON)
t_001_CFLAGS = $(CFLAGS_COMMON)
t_001_LDFLAGS = $(LDFLAGS_COMMON)
t_001_LDADD = $(LIBADD_COMMON)
t_002_SOURCES = t-002.c t.h
t_002_CPPFLAGS = $(CPPFLAGS_COMMON)
t_002_CFLAGS = $(CFLAGS_COMMON)
t_002_LDFLAGS = $(LDFLAGS_COMMON)
t_002_LDADD = $(LIBADD_COMMON)
TESTS = $(check_PROGRAMS) $(check_SCRIPTS)

1068
mio/t/Makefile.in Normal file

File diff suppressed because it is too large Load Diff

149
mio/t/t-001.c Normal file
View File

@ -0,0 +1,149 @@
/* test endian conversion macros */
#include <mio-utl.h>
#include <stdio.h>
#include "t.h"
int main ()
{
{
union {
mio_uint16_t u16;
mio_uint8_t arr[2];
} x;
x.arr[0] = 0x11;
x.arr[1] = 0x22;
printf("x.u16 = 0x%04x\n", x.u16);
printf("htole16(x.u16) = 0x%04x\n", mio_htole16(x.u16));
printf("htobe16(x.u16) = 0x%04x\n", mio_htobe16(x.u16));
T_ASSERT1 (x.u16 != mio_htole16(x.u16) || x.u16 != mio_htobe16(x.u16), "u16 endian conversion #0");
T_ASSERT1 (x.u16 == mio_le16toh(mio_htole16(x.u16)), "u16 endian conversion #1");
T_ASSERT1 (x.u16 == mio_be16toh(mio_htobe16(x.u16)), "u16 endian conversion #2");
T_ASSERT1 (x.u16 == mio_ntoh16(mio_hton16(x.u16)), "u16 endian conversion #3");
#define X_CONST (0x1122)
T_ASSERT1 (X_CONST != MIO_CONST_HTOLE16(X_CONST) || X_CONST != MIO_CONST_HTOBE16(X_CONST), "u16 constant endian conversion #0");
T_ASSERT1 (X_CONST == MIO_CONST_LE16TOH(MIO_CONST_HTOLE16(X_CONST)), "u16 constant endian conversion #1");
T_ASSERT1 (X_CONST == MIO_CONST_BE16TOH(MIO_CONST_HTOBE16(X_CONST)), "u16 constant endian conversion #2");
T_ASSERT1 (X_CONST == MIO_CONST_NTOH16(MIO_CONST_HTON16(X_CONST)), "u16 constant endian conversion #3");
#undef X_CONST
}
{
union {
mio_uint32_t u32;
mio_uint8_t arr[4];
} x;
x.arr[0] = 0x11;
x.arr[1] = 0x22;
x.arr[2] = 0x33;
x.arr[3] = 0x44;
printf("x.u32 = 0x%08x\n", (unsigned int)x.u32);
printf("htole32(x.u32) = 0x%08x\n", (unsigned int)mio_htole32(x.u32));
printf("htobe32(x.u32) = 0x%08x\n", (unsigned int)mio_htobe32(x.u32));
T_ASSERT1 (x.u32 != mio_htole32(x.u32) || x.u32 != mio_htobe32(x.u32), "u32 endian conversion #0");
T_ASSERT1 (x.u32 == mio_le32toh(mio_htole32(x.u32)), "u32 endian conversion #1");
T_ASSERT1 (x.u32 == mio_be32toh(mio_htobe32(x.u32)), "u32 endian conversion #2");
T_ASSERT1 (x.u32 == mio_ntoh32(mio_hton32(x.u32)), "u32 endian conversion #3");
#define X_CONST (0x11223344)
T_ASSERT1 (X_CONST != MIO_CONST_HTOLE32(X_CONST) || X_CONST != MIO_CONST_HTOBE32(X_CONST), "u32 constant endian conversion #0");
T_ASSERT1 (X_CONST == MIO_CONST_LE32TOH(MIO_CONST_HTOLE32(X_CONST)), "u32 constant endian conversion #1");
T_ASSERT1 (X_CONST == MIO_CONST_BE32TOH(MIO_CONST_HTOBE32(X_CONST)), "u32 constant endian conversion #2");
T_ASSERT1 (X_CONST == MIO_CONST_NTOH32(MIO_CONST_HTON32(X_CONST)), "u32 constant endian conversion #3");
#undef X_CONST
}
#if defined(MIO_HAVE_UINT64_T)
{
union {
mio_uint64_t u64;
mio_uint8_t arr[8];
} x;
x.arr[0] = 0x11;
x.arr[1] = 0x22;
x.arr[2] = 0x33;
x.arr[3] = 0x44;
x.arr[4] = 0x55;
x.arr[5] = 0x66;
x.arr[6] = 0x77;
x.arr[7] = 0x88;
printf("x.u64 = 0x%016llx\n", (unsigned long long)x.u64);
printf("htole64(x.u64) = 0x%016llx\n", (unsigned long long)mio_htole64(x.u64));
printf("htobe64(x.u64) = 0x%016llx\n", (unsigned long long)mio_htobe64(x.u64));
T_ASSERT1 (x.u64 != mio_htole64(x.u64) || x.u64 != mio_htobe64(x.u64), "u64 endian conversion #0");
T_ASSERT1 (x.u64 == mio_le64toh(mio_htole64(x.u64)), "u64 endian conversion #1");
T_ASSERT1 (x.u64 == mio_be64toh(mio_htobe64(x.u64)), "u64 endian conversion #2");
T_ASSERT1 (x.u64 == mio_ntoh64(mio_hton64(x.u64)), "u64 endian conversion #3");
#define X_CONST (((mio_uint64_t)0x11223344 << 32) | (mio_uint64_t)0x55667788)
T_ASSERT1 (X_CONST != MIO_CONST_HTOLE64(X_CONST) || X_CONST != MIO_CONST_HTOBE64(X_CONST), "u64 constant endian conversion #0");
T_ASSERT1 (X_CONST == MIO_CONST_LE64TOH(MIO_CONST_HTOLE64(X_CONST)), "u64 constant endian conversion #1");
T_ASSERT1 (X_CONST == MIO_CONST_BE64TOH(MIO_CONST_HTOBE64(X_CONST)), "u64 constant endian conversion #2");
T_ASSERT1 (X_CONST == MIO_CONST_NTOH64(MIO_CONST_HTON64(X_CONST)), "u64 constant endian conversion #3");
#undef X_CONST
}
#endif
#if defined(MIO_HAVE_UINT128_T)
{
union {
mio_uint128_t u128;
mio_uint8_t arr[16];
} x;
mio_uint128_t tmp;
x.arr[0] = 0x11;
x.arr[1] = 0x22;
x.arr[2] = 0x33;
x.arr[3] = 0x44;
x.arr[4] = 0x55;
x.arr[5] = 0x66;
x.arr[6] = 0x77;
x.arr[7] = 0x88;
x.arr[8] = 0x99;
x.arr[9] = 0xaa;
x.arr[10] = 0xbb;
x.arr[11] = 0xcc;
x.arr[12] = 0xdd;
x.arr[13] = 0xee;
x.arr[14] = 0xff;
x.arr[15] = 0xfa;
printf("x.u128 = 0x%016llx%016llx\n", (unsigned long long)(mio_uint64_t)(x.u128 >> 64), (unsigned long long)(mio_uint64_t)(x.u128 >> 0));
tmp = mio_htole128(x.u128);
printf("htole128(tmp) = 0x%016llx%016llx\n", (unsigned long long)(mio_uint64_t)(tmp >> 64), (unsigned long long)(mio_uint64_t)(tmp >> 0));
tmp = mio_htobe128(x.u128);
printf("htobe128(tmp) = 0x%016llx%016llx\n", (unsigned long long)(mio_uint64_t)(tmp >> 64), (unsigned long long)(mio_uint64_t)(tmp >> 0));
T_ASSERT1 (x.u128 != mio_htole128(x.u128) || x.u128 != mio_htobe128(x.u128), "u128 endian conversion #0");
T_ASSERT1 (x.u128 == mio_le128toh(mio_htole128(x.u128)), "u128 endian conversion #1");
T_ASSERT1 (x.u128 == mio_be128toh(mio_htobe128(x.u128)), "u128 endian conversion #2");
T_ASSERT1 (x.u128 == mio_ntoh128(mio_hton128(x.u128)), "u128 endian conversion #3");
#define X_CONST (((mio_uint128_t)0x11223344 << 96) | ((mio_uint128_t)0x55667788 << 64) | ((mio_uint128_t)0x99aabbcc << 32) | ((mio_uint128_t)0xddeefffa))
T_ASSERT1 (X_CONST != MIO_CONST_HTOLE128(X_CONST) || X_CONST != MIO_CONST_HTOBE128(X_CONST), "u128 constant endian conversion #0");
T_ASSERT1 (X_CONST == MIO_CONST_LE128TOH(MIO_CONST_HTOLE128(X_CONST)), "u128 constant endian conversion #1");
T_ASSERT1 (X_CONST == MIO_CONST_BE128TOH(MIO_CONST_HTOBE128(X_CONST)), "u128 constant endian conversion #2");
T_ASSERT1 (X_CONST == MIO_CONST_NTOH128(MIO_CONST_HTON128(X_CONST)), "u128 constant endian conversion #3");
#undef X_CONST
}
#endif
return 0;
oops:
return -1;
}

57
mio/t/t-002.c Normal file
View File

@ -0,0 +1,57 @@
#include <mio-utl.h>
#include <stdio.h>
#include "t.h"
int main ()
{
{
int is_sober;
const mio_bch_t* endptr;
mio_intmax_t v;
v = mio_bchars_to_intmax("10 ", 3, MIO_BCHARS_TO_INTMAX_MAKE_OPTION(0,0,0,10), &endptr, &is_sober);
T_ASSERT1 (v == 10 && *endptr == ' ' && is_sober == 1, "space after digits without rtrim");
v = mio_bchars_to_intmax("10 ", 3, MIO_BCHARS_TO_INTMAX_MAKE_OPTION(0,0,1,10), &endptr, &is_sober);
T_ASSERT1 (v == 10 && *endptr == '\0' && is_sober == 1, "space after digits with rtrim");
v = mio_bchars_to_intmax("10E", 3, MIO_BCHARS_TO_INTMAX_MAKE_OPTION(0,0,1,10), &endptr, &is_sober);
T_ASSERT1 (v == 10 && *endptr == 'E' && is_sober == 1, "number ending with E without the E option ");
v = mio_bchars_to_intmax("10E", 3, MIO_BCHARS_TO_INTMAX_MAKE_OPTION(1,0,1,10), &endptr, &is_sober);
T_ASSERT1 (v == 10 && *endptr == '\0' && is_sober == 1, "integer in E notation");
v = mio_bchars_to_intmax("10E+0", 5, MIO_BCHARS_TO_INTMAX_MAKE_OPTION(1,0,1,10), &endptr, &is_sober);
T_ASSERT1 (v == 10 && *endptr == '\0' && is_sober == 1, "integer in E notation");
v = mio_bchars_to_intmax("10E+1", 5, MIO_BCHARS_TO_INTMAX_MAKE_OPTION(1,0,1,10), &endptr, &is_sober);
T_ASSERT1 (v == 100 && *endptr == '\0' && is_sober == 1, "integer in E notation");
v = mio_bchars_to_intmax("10E+2", 5, MIO_BCHARS_TO_INTMAX_MAKE_OPTION(1,0,1,10), &endptr, &is_sober);
T_ASSERT1 (v == 1000 && *endptr == '\0' && is_sober == 1, "integer in E notation");
v = mio_bchars_to_intmax("10E3", 4, MIO_BCHARS_TO_INTMAX_MAKE_OPTION(1,0,1,10), &endptr, &is_sober);
T_ASSERT1 (v == 10000 && *endptr == '\0' && is_sober == 1, "integer in E notation");
v = mio_bchars_to_intmax("10E-", 4, MIO_BCHARS_TO_INTMAX_MAKE_OPTION(1,0,1,10), &endptr, &is_sober);
T_ASSERT1 (v == 10 && *endptr == '\0' && is_sober == 1, "integer in E notation");
v = mio_bchars_to_intmax("10E-0", 5, MIO_BCHARS_TO_INTMAX_MAKE_OPTION(1,0,1,10), &endptr, &is_sober);
T_ASSERT1 (v == 10 && *endptr == '\0' && is_sober == 1, "integer in E notation");
v = mio_bchars_to_intmax("10E-1", 5, MIO_BCHARS_TO_INTMAX_MAKE_OPTION(1,0,1,10), &endptr, &is_sober);
T_ASSERT1 (v == 1 && *endptr == '\0' && is_sober == 1, "integer in E notation");
v = mio_bchars_to_intmax("10E-2", 5, MIO_BCHARS_TO_INTMAX_MAKE_OPTION(1,0,1,10), &endptr, &is_sober);
T_ASSERT1 (v == 0 && *endptr == '\0' && is_sober == 1, "integer in E notation");
}
return 0;
oops:
return -1;
}

21
mio/t/t.h Normal file
View File

@ -0,0 +1,21 @@
#ifndef _HAWK_T_T_H_
#define _HAWK_T_T_H_
#include <stdio.h>
#if defined(__STDC_VERSION__) && (__STDC_VERSION__>=199901L)
# define T_ASSERT_FAIL0() printf("FAILURE in %s:%s[%d]\n", __FILE__, __func__, (int)__LINE__)
# define T_ASSERT_FAIL1(msg1) printf("FAILURE in %s:%s[%d] - %s\n", __FILE__, __func__, (int)__LINE__, msg1)
# define T_ASSERT_FAIL2(msg1,msg2) printf("FAILURE in %s:%s[%d] - %s - %s\n", __FILE__, __func__, (int)__LINE__, msg1, msg2)
#else
# define T_ASSERT_FAIL0() printf("FAILURE in %s[%d]\n", __FILE__, (int)__LINE__)
# define T_ASSERT_FAIL1(msg1) printf("FAILURE in %s[%d] - %s\n", __FILE__, (int)__LINE__, msg1)
# define T_ASSERT_FAIL2(msg1,msg2) printf("FAILURE in %s[%d] - %s - %s\n", __FILE__, (int)__LINE__, msg1, msg2)
#endif
#define T_ASSERT0(test) do { if (!(test)) { T_ASSERT_FAIL0(); goto oops; } } while(0)
#define T_ASSERT1(test,msg1) do { if (!(test)) { T_ASSERT_FAIL1(msg1); goto oops; } } while(0)
#define T_ASSERT2(test,msg1,msg2) do { if (!(test)) { T_ASSERT_FAIL2(msg1,msg2); goto oops; } } while(0)
#endif