diff --git a/Makefile.in b/Makefile.in index cb92f876..44a7272d 100644 --- a/Makefile.in +++ b/Makefile.in @@ -93,7 +93,7 @@ subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_sign.m4 \ $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \ - $(top_srcdir)/m4/ax_cxx_namespace.m4 \ + $(top_srcdir)/m4/ax_cxx_namespaces.m4 \ $(top_srcdir)/m4/ax_lib_mysql.m4 $(top_srcdir)/m4/ax_numval.m4 \ $(top_srcdir)/m4/ax_pthread.m4 \ $(top_srcdir)/m4/hawk_try_cflags.m4 \ @@ -168,7 +168,7 @@ am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/ac/ar-lib \ $(top_srcdir)/ac/ltmain.sh $(top_srcdir)/ac/missing \ $(top_srcdir)/ac/tap-driver.sh $(top_srcdir)/pkgs/hawk.spec.in \ README.md ac/ar-lib ac/compile ac/config.guess ac/config.sub \ - ac/depcomp ac/install-sh ac/ltmain.sh ac/missing + ac/install-sh ac/ltmain.sh ac/missing DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) diff --git a/aclocal.m4 b/aclocal.m4 index 8cb6e58c..714d971d 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1210,7 +1210,7 @@ AC_SUBST([am__untar]) m4_include([m4/ax_check_sign.m4]) m4_include([m4/ax_cxx_compile_stdcxx.m4]) -m4_include([m4/ax_cxx_namespace.m4]) +m4_include([m4/ax_cxx_namespaces.m4]) m4_include([m4/ax_lib_mysql.m4]) m4_include([m4/ax_numval.m4]) m4_include([m4/ax_pthread.m4]) diff --git a/bin/Makefile.in b/bin/Makefile.in index 37fb7b80..9473479f 100644 --- a/bin/Makefile.in +++ b/bin/Makefile.in @@ -93,7 +93,7 @@ subdir = bin ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_sign.m4 \ $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \ - $(top_srcdir)/m4/ax_cxx_namespace.m4 \ + $(top_srcdir)/m4/ax_cxx_namespaces.m4 \ $(top_srcdir)/m4/ax_lib_mysql.m4 $(top_srcdir)/m4/ax_numval.m4 \ $(top_srcdir)/m4/ax_pthread.m4 \ $(top_srcdir)/m4/hawk_try_cflags.m4 \ diff --git a/configure b/configure index ee8c828e..2bcd588c 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.71 for hawk 0.9.6. +# Generated by GNU Autoconf 2.71 for hawk 0.9.7. # # Report bugs to . # @@ -621,8 +621,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='hawk' PACKAGE_TARNAME='hawk' -PACKAGE_VERSION='0.9.6' -PACKAGE_STRING='hawk 0.9.6' +PACKAGE_VERSION='0.9.7' +PACKAGE_STRING='hawk 0.9.7' PACKAGE_BUGREPORT='Chung, Hyung-Hwan (hyunghwan.chung@gmail.com)' PACKAGE_URL='https://code.miflux.net/hyung-hwan/hawk' @@ -1431,7 +1431,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures hawk 0.9.6 to adapt to many kinds of systems. +\`configure' configures hawk 0.9.7 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1502,7 +1502,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of hawk 0.9.6:";; + short | recursive ) echo "Configuration of hawk 0.9.7:";; esac cat <<\_ACEOF @@ -1641,7 +1641,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -hawk configure 0.9.6 +hawk configure 0.9.7 generated by GNU Autoconf 2.71 Copyright (C) 2021 Free Software Foundation, Inc. @@ -2370,7 +2370,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by hawk $as_me 0.9.6, which was +It was created by hawk $as_me 0.9.7, which was generated by GNU Autoconf 2.71. Invocation command line was $ $0$ac_configure_args_raw @@ -3868,7 +3868,7 @@ fi # Define the identity of the package. PACKAGE='hawk' - VERSION='0.9.6' + VERSION='0.9.7' printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h @@ -25790,7 +25790,7 @@ else $as_nop fi test "${HAVE_CXX}" = "yes" || enable_cxx_is="no" -test "${ax_cv_cxx_have_std_namespace}" = "yes" || enable_cxx_is="no" +test "${ax_cv_cxx_namespaces}" = "yes" || enable_cxx_is="no" if test "${enable_cxx_is}" = "yes" ; then ENABLE_CXX_TRUE= @@ -25966,7 +25966,7 @@ fi if test "x${enable_mod_mysql_is}" = "xauto" || test "x${enable_mod_mysql_is}" = "xyes" then - if ! test ${with_mysql+y} + if test ${with_mysql+y} then ## as if --with-mysql is specified for AX_LIB_MYSQL below with_mysql=yes @@ -26939,7 +26939,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by hawk $as_me 0.9.6, which was +This file was extended by hawk $as_me 0.9.7, which was generated by GNU Autoconf 2.71. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -27008,7 +27008,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config='$ac_cs_config_escaped' ac_cs_version="\\ -hawk config.status 0.9.6 +hawk config.status 0.9.7 configured by $0, generated by GNU Autoconf 2.71, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index 0a99cdb5..78eeddec 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,6 @@ dnl AC_PREREQ([2.71]) -AC_INIT([hawk],[0.9.6],[Chung, Hyung-Hwan (hyunghwan.chung@gmail.com)],[],[https://code.miflux.net/hyung-hwan/hawk]) +AC_INIT([hawk],[0.9.7],[Chung, Hyung-Hwan (hyunghwan.chung@gmail.com)],[],[https://code.miflux.net/hyung-hwan/hawk]) AC_CONFIG_HEADERS([lib/hawk-cfg.h]) AC_CONFIG_AUX_DIR([ac]) @@ -889,7 +889,7 @@ AC_ARG_ENABLE([cxx], dnl disable c++ if no c++ compiler was found test "${HAVE_CXX}" = "yes" || enable_cxx_is="no" dnl disable c++ if the compiler is too old. -test "${ax_cv_cxx_have_std_namespace}" = "yes" || enable_cxx_is="no" +test "${ax_cv_cxx_namespaces}" = "yes" || enable_cxx_is="no" AM_CONDITIONAL(ENABLE_CXX, test "${enable_cxx_is}" = "yes" ) diff --git a/lib/Hawk.hpp b/lib/Hawk.hpp index 4b67219d..e078d520 100644 --- a/lib/Hawk.hpp +++ b/lib/Hawk.hpp @@ -1046,6 +1046,7 @@ public: } int getType () const { return hawk_get_val_type(this->val); } + const hawk_ooch_t* getTypeName () const { return hawk_get_val_type_name(this->val); } int getInt (hawk_int_t* v) const; int getFlt (hawk_flt_t* v) const; diff --git a/lib/Makefile.in b/lib/Makefile.in index ccdf6ddb..fabed46a 100644 --- a/lib/Makefile.in +++ b/lib/Makefile.in @@ -120,7 +120,7 @@ subdir = lib ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_sign.m4 \ $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \ - $(top_srcdir)/m4/ax_cxx_namespace.m4 \ + $(top_srcdir)/m4/ax_cxx_namespaces.m4 \ $(top_srcdir)/m4/ax_lib_mysql.m4 $(top_srcdir)/m4/ax_numval.m4 \ $(top_srcdir)/m4/ax_pthread.m4 \ $(top_srcdir)/m4/hawk_try_cflags.m4 \ diff --git a/lib/hawk.h b/lib/hawk.h index 02e50b5e..c44b27ef 100644 --- a/lib/hawk.h +++ b/lib/hawk.h @@ -3663,6 +3663,10 @@ HAWK_EXPORT int hawk_get_val_type ( hawk_val_t* val ); +HAWK_EXPORT const hawk_ooch_t* hawk_get_val_type_name ( + hawk_val_t* val +); + #if defined(__cplusplus) } #endif diff --git a/lib/val.c b/lib/val.c index 7a11dd9a..3893d5df 100644 --- a/lib/val.c +++ b/lib/val.c @@ -27,13 +27,32 @@ #define CHUNKSIZE HAWK_VAL_CHUNK_SIZE static hawk_val_nil_t hawk_nil = { HAWK_VAL_NIL, 0, 1, 0, 0 }; +/* zero-length string */ static hawk_val_str_t hawk_zls = { HAWK_VAL_STR, 0, 1, 0, 0, { HAWK_T(""), 0 } }; +/* zero-length byte string */ static hawk_val_mbs_t hawk_zlbs = { HAWK_VAL_MBS, 0, 1, 0, 0, { HAWK_BT(""), 0 } }; hawk_val_t* hawk_val_nil = (hawk_val_t*)&hawk_nil; hawk_val_t* hawk_val_zls = (hawk_val_t*)&hawk_zls; hawk_val_t* hawk_val_zlbs = (hawk_val_t*)&hawk_zlbs; +static const hawk_ooch_t* val_type_name[] = +{ + /* synchronize this table with enum hawk_val_type_t in hawk.h */ + HAWK_T("nil"), + HAWK_T("char"), + HAWK_T("bchar"), + HAWK_T("int"), + HAWK_T("flt"), + HAWK_T("str"), + HAWK_T("mbs"), + HAWK_T("fun"), + HAWK_T("map"), + HAWK_T("array"), + + HAWK_T("rex"), + HAWK_T("ref") +}; /* --------------------------------------------------------------------- */ @@ -472,6 +491,11 @@ int hawk_get_val_type (hawk_val_t* val) return HAWK_GET_VAL_TYPE(val); } +const hawk_ooch_t* hawk_get_val_type_name (hawk_val_t* val) +{ + return val_type_name[HAWK_GET_VAL_TYPE(val)]; +} + hawk_val_t* hawk_get_nil_val (void) { return (hawk_val_t*)&hawk_nil; @@ -1431,25 +1455,7 @@ int hawk_rtx_getvaltype (hawk_rtx_t* rtx, const hawk_val_t* val) const hawk_ooch_t* hawk_rtx_getvaltypename(hawk_rtx_t* rtx, const hawk_val_t* val) { - static const hawk_ooch_t* __val_type_name[] = - { - /* synchronize this table with enum hawk_val_type_t in hawk.h */ - HAWK_T("nil"), - HAWK_T("char"), - HAWK_T("bchar"), - HAWK_T("int"), - HAWK_T("flt"), - HAWK_T("str"), - HAWK_T("mbs"), - HAWK_T("fun"), - HAWK_T("map"), - HAWK_T("array"), - - HAWK_T("rex"), - HAWK_T("ref") - }; - - return __val_type_name[HAWK_RTX_GETVALTYPE(rtx, val)]; + return val_type_name[HAWK_RTX_GETVALTYPE(rtx, val)]; } int hawk_rtx_getintfromval (hawk_rtx_t* rtx, const hawk_val_t* val) diff --git a/m4/ax_cxx_namespace.m4 b/m4/ax_cxx_namespaces.m4 similarity index 100% rename from m4/ax_cxx_namespace.m4 rename to m4/ax_cxx_namespaces.m4 diff --git a/mod/Makefile.in b/mod/Makefile.in index d3b2db3a..ca9c11ae 100644 --- a/mod/Makefile.in +++ b/mod/Makefile.in @@ -100,7 +100,7 @@ subdir = mod ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_sign.m4 \ $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \ - $(top_srcdir)/m4/ax_cxx_namespace.m4 \ + $(top_srcdir)/m4/ax_cxx_namespaces.m4 \ $(top_srcdir)/m4/ax_lib_mysql.m4 $(top_srcdir)/m4/ax_numval.m4 \ $(top_srcdir)/m4/ax_pthread.m4 \ $(top_srcdir)/m4/hawk_try_cflags.m4 \ diff --git a/samples/Makefile.in b/samples/Makefile.in index ed481e56..ae419ed8 100644 --- a/samples/Makefile.in +++ b/samples/Makefile.in @@ -94,7 +94,7 @@ subdir = samples ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_sign.m4 \ $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \ - $(top_srcdir)/m4/ax_cxx_namespace.m4 \ + $(top_srcdir)/m4/ax_cxx_namespaces.m4 \ $(top_srcdir)/m4/ax_lib_mysql.m4 $(top_srcdir)/m4/ax_numval.m4 \ $(top_srcdir)/m4/ax_pthread.m4 \ $(top_srcdir)/m4/hawk_try_cflags.m4 \ diff --git a/t/Makefile.in b/t/Makefile.in index 667f64ad..9f7c7d0c 100644 --- a/t/Makefile.in +++ b/t/Makefile.in @@ -93,7 +93,7 @@ subdir = t ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_sign.m4 \ $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \ - $(top_srcdir)/m4/ax_cxx_namespace.m4 \ + $(top_srcdir)/m4/ax_cxx_namespaces.m4 \ $(top_srcdir)/m4/ax_lib_mysql.m4 $(top_srcdir)/m4/ax_numval.m4 \ $(top_srcdir)/m4/ax_pthread.m4 \ $(top_srcdir)/m4/hawk_try_cflags.m4 \ diff --git a/tools/Makefile.in b/tools/Makefile.in index 0935fce7..886fc493 100644 --- a/tools/Makefile.in +++ b/tools/Makefile.in @@ -93,7 +93,7 @@ subdir = tools ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_sign.m4 \ $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \ - $(top_srcdir)/m4/ax_cxx_namespace.m4 \ + $(top_srcdir)/m4/ax_cxx_namespaces.m4 \ $(top_srcdir)/m4/ax_lib_mysql.m4 $(top_srcdir)/m4/ax_numval.m4 \ $(top_srcdir)/m4/ax_pthread.m4 \ $(top_srcdir)/m4/hawk_try_cflags.m4 \