added the sed module to hawk.

raised the version to 0.9.6
This commit is contained in:
hyung-hwan 2022-04-05 14:26:21 +00:00
parent 42129f7d77
commit 3add2cc2d2
20 changed files with 543 additions and 82 deletions

View File

@ -18,7 +18,7 @@ bin_PROGRAMS = hawk hsed
##################################################
# hawk
##################################################
hawk_SOURCES = main-hawk.c
hawk_SOURCES = bin-hawk.c
hawk_CPPFLAGS = $(CPPFLAGS_COMMON)
hawk_CFLAGS = $(CFLAGS_COMMON)
hawk_LDFLAGS = $(LDFLAGS_COMMON)
@ -38,7 +38,7 @@ hawk_LDFLAGS = $(LDFLAGS_COMMON)
##
hawk_LDADD = $(LIBADD_COMMON) $(LIBM)
hsed_SOURCES = main-hsed.c
hsed_SOURCES = bin-hsed.c
hsed_CPPFLAGS = $(CPPFLAGS_COMMON)
hsed_CFLAGS = $(CFLAGS_COMMON)
hsed_LDFLAGS = $(LDFLAGS_COMMON)

View File

@ -109,7 +109,7 @@ CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
am__installdirs = "$(DESTDIR)$(bindir)"
PROGRAMS = $(bin_PROGRAMS)
am_hawk_OBJECTS = hawk-main-hawk.$(OBJEXT)
am_hawk_OBJECTS = hawk-bin-hawk.$(OBJEXT)
hawk_OBJECTS = $(am_hawk_OBJECTS)
am__DEPENDENCIES_1 =
hawk_DEPENDENCIES = $(LIBADD_COMMON) $(am__DEPENDENCIES_1)
@ -120,7 +120,7 @@ am__v_lt_1 =
hawk_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(hawk_CFLAGS) $(CFLAGS) \
$(hawk_LDFLAGS) $(LDFLAGS) -o $@
am_hsed_OBJECTS = hsed-main-hsed.$(OBJEXT)
am_hsed_OBJECTS = hsed-bin-hsed.$(OBJEXT)
hsed_OBJECTS = $(am_hsed_OBJECTS)
hsed_DEPENDENCIES = $(LIBADD_COMMON) $(am__DEPENDENCIES_1)
hsed_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
@ -141,8 +141,8 @@ am__v_at_1 =
DEFAULT_INCLUDES =
depcomp = $(SHELL) $(top_srcdir)/ac/depcomp
am__maybe_remake_depfiles = depfiles
am__depfiles_remade = ./$(DEPDIR)/hawk-main-hawk.Po \
./$(DEPDIR)/hsed-main-hsed.Po
am__depfiles_remade = ./$(DEPDIR)/hawk-bin-hawk.Po \
./$(DEPDIR)/hsed-bin-hsed.Po
am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
@ -353,12 +353,12 @@ LIBADD_COMMON = ../lib/libhawk.la
##################################################
# hawk
##################################################
hawk_SOURCES = main-hawk.c
hawk_SOURCES = bin-hawk.c
hawk_CPPFLAGS = $(CPPFLAGS_COMMON)
hawk_CFLAGS = $(CFLAGS_COMMON)
hawk_LDFLAGS = $(LDFLAGS_COMMON)
hawk_LDADD = $(LIBADD_COMMON) $(LIBM)
hsed_SOURCES = main-hsed.c
hsed_SOURCES = bin-hsed.c
hsed_CPPFLAGS = $(CPPFLAGS_COMMON)
hsed_CFLAGS = $(CFLAGS_COMMON)
hsed_LDFLAGS = $(LDFLAGS_COMMON)
@ -460,8 +460,8 @@ mostlyclean-compile:
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hawk-main-hawk.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hsed-main-hsed.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hawk-bin-hawk.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hsed-bin-hsed.Po@am__quote@ # am--include-marker
$(am__depfiles_remade):
@$(MKDIR_P) $(@D)
@ -493,33 +493,33 @@ am--depfiles: $(am__depfiles_remade)
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
hawk-main-hawk.o: main-hawk.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(hawk_CPPFLAGS) $(CPPFLAGS) $(hawk_CFLAGS) $(CFLAGS) -MT hawk-main-hawk.o -MD -MP -MF $(DEPDIR)/hawk-main-hawk.Tpo -c -o hawk-main-hawk.o `test -f 'main-hawk.c' || echo '$(srcdir)/'`main-hawk.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/hawk-main-hawk.Tpo $(DEPDIR)/hawk-main-hawk.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='main-hawk.c' object='hawk-main-hawk.o' libtool=no @AMDEPBACKSLASH@
hawk-bin-hawk.o: bin-hawk.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(hawk_CPPFLAGS) $(CPPFLAGS) $(hawk_CFLAGS) $(CFLAGS) -MT hawk-bin-hawk.o -MD -MP -MF $(DEPDIR)/hawk-bin-hawk.Tpo -c -o hawk-bin-hawk.o `test -f 'bin-hawk.c' || echo '$(srcdir)/'`bin-hawk.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/hawk-bin-hawk.Tpo $(DEPDIR)/hawk-bin-hawk.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='bin-hawk.c' object='hawk-bin-hawk.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(hawk_CPPFLAGS) $(CPPFLAGS) $(hawk_CFLAGS) $(CFLAGS) -c -o hawk-main-hawk.o `test -f 'main-hawk.c' || echo '$(srcdir)/'`main-hawk.c
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(hawk_CPPFLAGS) $(CPPFLAGS) $(hawk_CFLAGS) $(CFLAGS) -c -o hawk-bin-hawk.o `test -f 'bin-hawk.c' || echo '$(srcdir)/'`bin-hawk.c
hawk-main-hawk.obj: main-hawk.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(hawk_CPPFLAGS) $(CPPFLAGS) $(hawk_CFLAGS) $(CFLAGS) -MT hawk-main-hawk.obj -MD -MP -MF $(DEPDIR)/hawk-main-hawk.Tpo -c -o hawk-main-hawk.obj `if test -f 'main-hawk.c'; then $(CYGPATH_W) 'main-hawk.c'; else $(CYGPATH_W) '$(srcdir)/main-hawk.c'; fi`
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/hawk-main-hawk.Tpo $(DEPDIR)/hawk-main-hawk.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='main-hawk.c' object='hawk-main-hawk.obj' libtool=no @AMDEPBACKSLASH@
hawk-bin-hawk.obj: bin-hawk.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(hawk_CPPFLAGS) $(CPPFLAGS) $(hawk_CFLAGS) $(CFLAGS) -MT hawk-bin-hawk.obj -MD -MP -MF $(DEPDIR)/hawk-bin-hawk.Tpo -c -o hawk-bin-hawk.obj `if test -f 'bin-hawk.c'; then $(CYGPATH_W) 'bin-hawk.c'; else $(CYGPATH_W) '$(srcdir)/bin-hawk.c'; fi`
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/hawk-bin-hawk.Tpo $(DEPDIR)/hawk-bin-hawk.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='bin-hawk.c' object='hawk-bin-hawk.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(hawk_CPPFLAGS) $(CPPFLAGS) $(hawk_CFLAGS) $(CFLAGS) -c -o hawk-main-hawk.obj `if test -f 'main-hawk.c'; then $(CYGPATH_W) 'main-hawk.c'; else $(CYGPATH_W) '$(srcdir)/main-hawk.c'; fi`
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(hawk_CPPFLAGS) $(CPPFLAGS) $(hawk_CFLAGS) $(CFLAGS) -c -o hawk-bin-hawk.obj `if test -f 'bin-hawk.c'; then $(CYGPATH_W) 'bin-hawk.c'; else $(CYGPATH_W) '$(srcdir)/bin-hawk.c'; fi`
hsed-main-hsed.o: main-hsed.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(hsed_CPPFLAGS) $(CPPFLAGS) $(hsed_CFLAGS) $(CFLAGS) -MT hsed-main-hsed.o -MD -MP -MF $(DEPDIR)/hsed-main-hsed.Tpo -c -o hsed-main-hsed.o `test -f 'main-hsed.c' || echo '$(srcdir)/'`main-hsed.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/hsed-main-hsed.Tpo $(DEPDIR)/hsed-main-hsed.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='main-hsed.c' object='hsed-main-hsed.o' libtool=no @AMDEPBACKSLASH@
hsed-bin-hsed.o: bin-hsed.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(hsed_CPPFLAGS) $(CPPFLAGS) $(hsed_CFLAGS) $(CFLAGS) -MT hsed-bin-hsed.o -MD -MP -MF $(DEPDIR)/hsed-bin-hsed.Tpo -c -o hsed-bin-hsed.o `test -f 'bin-hsed.c' || echo '$(srcdir)/'`bin-hsed.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/hsed-bin-hsed.Tpo $(DEPDIR)/hsed-bin-hsed.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='bin-hsed.c' object='hsed-bin-hsed.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(hsed_CPPFLAGS) $(CPPFLAGS) $(hsed_CFLAGS) $(CFLAGS) -c -o hsed-main-hsed.o `test -f 'main-hsed.c' || echo '$(srcdir)/'`main-hsed.c
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(hsed_CPPFLAGS) $(CPPFLAGS) $(hsed_CFLAGS) $(CFLAGS) -c -o hsed-bin-hsed.o `test -f 'bin-hsed.c' || echo '$(srcdir)/'`bin-hsed.c
hsed-main-hsed.obj: main-hsed.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(hsed_CPPFLAGS) $(CPPFLAGS) $(hsed_CFLAGS) $(CFLAGS) -MT hsed-main-hsed.obj -MD -MP -MF $(DEPDIR)/hsed-main-hsed.Tpo -c -o hsed-main-hsed.obj `if test -f 'main-hsed.c'; then $(CYGPATH_W) 'main-hsed.c'; else $(CYGPATH_W) '$(srcdir)/main-hsed.c'; fi`
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/hsed-main-hsed.Tpo $(DEPDIR)/hsed-main-hsed.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='main-hsed.c' object='hsed-main-hsed.obj' libtool=no @AMDEPBACKSLASH@
hsed-bin-hsed.obj: bin-hsed.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(hsed_CPPFLAGS) $(CPPFLAGS) $(hsed_CFLAGS) $(CFLAGS) -MT hsed-bin-hsed.obj -MD -MP -MF $(DEPDIR)/hsed-bin-hsed.Tpo -c -o hsed-bin-hsed.obj `if test -f 'bin-hsed.c'; then $(CYGPATH_W) 'bin-hsed.c'; else $(CYGPATH_W) '$(srcdir)/bin-hsed.c'; fi`
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/hsed-bin-hsed.Tpo $(DEPDIR)/hsed-bin-hsed.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='bin-hsed.c' object='hsed-bin-hsed.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(hsed_CPPFLAGS) $(CPPFLAGS) $(hsed_CFLAGS) $(CFLAGS) -c -o hsed-main-hsed.obj `if test -f 'main-hsed.c'; then $(CYGPATH_W) 'main-hsed.c'; else $(CYGPATH_W) '$(srcdir)/main-hsed.c'; fi`
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(hsed_CPPFLAGS) $(CPPFLAGS) $(hsed_CFLAGS) $(CFLAGS) -c -o hsed-bin-hsed.obj `if test -f 'bin-hsed.c'; then $(CYGPATH_W) 'bin-hsed.c'; else $(CYGPATH_W) '$(srcdir)/bin-hsed.c'; fi`
mostlyclean-libtool:
-rm -f *.lo
@ -654,8 +654,8 @@ clean: clean-am
clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
distclean: distclean-am
-rm -f ./$(DEPDIR)/hawk-main-hawk.Po
-rm -f ./$(DEPDIR)/hsed-main-hsed.Po
-rm -f ./$(DEPDIR)/hawk-bin-hawk.Po
-rm -f ./$(DEPDIR)/hsed-bin-hsed.Po
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
@ -701,8 +701,8 @@ install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f ./$(DEPDIR)/hawk-main-hawk.Po
-rm -f ./$(DEPDIR)/hsed-main-hsed.Po
-rm -f ./$(DEPDIR)/hawk-bin-hawk.Po
-rm -f ./$(DEPDIR)/hsed-bin-hsed.Po
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic

View File

@ -890,7 +890,7 @@ static HAWK_INLINE int execute_hawk_sed (int argc, hawk_bch_t* argv[])
out_file.u.sio = hawk_sio_open(
hawk_sed_getgem(sed),
0,
arg.output_file, /* ignore the type mistch error here */
(const hawk_ooch_t*)arg.output_file, /* fake type casting - note HAWK_SIO_BCSTRPATH below */
HAWK_SIO_WRITE |
HAWK_SIO_CREATE |
HAWK_SIO_TRUNCATE |
@ -946,7 +946,7 @@ static HAWK_INLINE int execute_hawk_sed (int argc, hawk_bch_t* argv[])
out_inplace.u.sio = hawk_sio_open(
hawk_sed_getgem(sed),
0,
tmpl_tmpfile, /* expect a type mismatch warning here and note HAWK_SIO_BCSTR_PATH below */
(const hawk_ooch_t*)tmpl_tmpfile, /* fake type casting - note HAWK_SIO_BCSTRPATH below */
HAWK_SIO_WRITE |
HAWK_SIO_CREATE |
HAWK_SIO_IGNOREECERR |

51
hawk/configure vendored
View File

@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for hawk 0.9.5.
# Generated by GNU Autoconf 2.69 for hawk 0.9.6.
#
# Report bugs to <Chung, Hyung-Hwan (hyunghwan.chung@gmail.com)>.
#
@ -590,8 +590,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='hawk'
PACKAGE_TARNAME='hawk'
PACKAGE_VERSION='0.9.5'
PACKAGE_STRING='hawk 0.9.5'
PACKAGE_VERSION='0.9.6'
PACKAGE_STRING='hawk 0.9.6'
PACKAGE_BUGREPORT='Chung, Hyung-Hwan (hyunghwan.chung@gmail.com)'
PACKAGE_URL='https://code.miflux.net/@hawk'
@ -639,6 +639,8 @@ HAWK_PROJECT_URL
HAWK_PROJECT_AUTHOR
ENABLE_MOD_UCI_FALSE
ENABLE_MOD_UCI_TRUE
ENABLE_MOD_SED_FALSE
ENABLE_MOD_SED_TRUE
ENABLE_MOD_MYSQL_FALSE
ENABLE_MOD_MYSQL_TRUE
ENABLE_MOD_FFI_FALSE
@ -831,6 +833,7 @@ enable_libltdl
enable_libunwind
enable_mod_ffi
enable_mod_mysql
enable_mod_sed
enable_mod_uci
enable_pthread_flags
'
@ -1398,7 +1401,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.5 to adapt to many kinds of systems.
\`configure' configures hawk 0.9.6 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@ -1469,7 +1472,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of hawk 0.9.5:";;
short | recursive ) echo "Configuration of hawk 0.9.6:";;
esac
cat <<\_ACEOF
@ -1505,6 +1508,7 @@ Optional Features:
--enable-libunwind use libunwind(default. no)
--enable-mod-ffi enable mod/ffi (default. yes)
--enable-mod-mysql enable mod/mysql (default. yes)
--enable-mod-sed enable mod/sed (default. yes)
--enable-mod-uci enable mod/uci (default. no)
--enable-pthread-flags add thread flags to CFLAGS, CXXFLAGS, LIBS(default.
yes)
@ -1605,7 +1609,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
hawk configure 0.9.5
hawk configure 0.9.6
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@ -2389,7 +2393,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.5, which was
It was created by hawk $as_me 0.9.6, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@ -3264,7 +3268,7 @@ fi
# Define the identity of the package.
PACKAGE='hawk'
VERSION='0.9.5'
VERSION='0.9.6'
cat >>confdefs.h <<_ACEOF
@ -24192,6 +24196,29 @@ else
fi
# Check whether --enable-mod-sed was given.
if test "${enable_mod_sed+set}" = set; then :
enableval=$enable_mod_sed; enable_mod_sed_is=$enableval
else
enable_mod_sed_is=yes
fi
if test "${enable_mod_sed_is}" = "yes"
then
$as_echo "#define HAWK_ENABLE_MOD_SED 1" >>confdefs.h
fi
if test "${enable_mod_sed_is}" = "yes"; then
ENABLE_MOD_SED_TRUE=
ENABLE_MOD_SED_FALSE='#'
else
ENABLE_MOD_SED_TRUE='#'
ENABLE_MOD_SED_FALSE=
fi
# Check whether --enable-mod-uci was given.
if test "${enable_mod_uci+set}" = set; then :
enableval=$enable_mod_uci; enable_mod_uci_is=$enableval
@ -24419,6 +24446,10 @@ if test -z "${ENABLE_MOD_MYSQL_TRUE}" && test -z "${ENABLE_MOD_MYSQL_FALSE}"; th
as_fn_error $? "conditional \"ENABLE_MOD_MYSQL\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${ENABLE_MOD_SED_TRUE}" && test -z "${ENABLE_MOD_SED_FALSE}"; then
as_fn_error $? "conditional \"ENABLE_MOD_SED\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${ENABLE_MOD_UCI_TRUE}" && test -z "${ENABLE_MOD_UCI_FALSE}"; then
as_fn_error $? "conditional \"ENABLE_MOD_UCI\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
@ -24820,7 +24851,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.5, which was
This file was extended by hawk $as_me 0.9.6, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@ -24887,7 +24918,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
hawk config.status 0.9.5
hawk config.status 0.9.6
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"

View File

@ -1,6 +1,6 @@
dnl AC_PREREQ([2.67])
AC_INIT([hawk],[0.9.5],[Chung, Hyung-Hwan (hyunghwan.chung@gmail.com)],[],[https://code.miflux.net/@hawk])
AC_INIT([hawk],[0.9.6],[Chung, Hyung-Hwan (hyunghwan.chung@gmail.com)],[],[https://code.miflux.net/@hawk])
AC_CONFIG_HEADER([lib/hawk-cfg.h])
AC_CONFIG_AUX_DIR([ac])
@ -1027,6 +1027,18 @@ then
fi
AM_CONDITIONAL(ENABLE_MOD_MYSQL, test "${enable_mod_mysql_is}" = "yes")
dnl ===== enable-mod-sed =====
AC_ARG_ENABLE([mod-sed],
[AS_HELP_STRING([--enable-mod-sed],[enable mod/sed (default. yes)])],
enable_mod_sed_is=$enableval,
enable_mod_sed_is=yes
)
if test "${enable_mod_sed_is}" = "yes"
then
AC_DEFINE([HAWK_ENABLE_MOD_SED],[1],[build mod/sed])
fi
AM_CONDITIONAL(ENABLE_MOD_SED, test "${enable_mod_sed_is}" = "yes")
dnl ===== enable-mod-uci =====
AC_ARG_ENABLE([mod-uci],
[AS_HELP_STRING([--enable-mod-uci],[enable mod/uci (default. no)])],

View File

@ -212,6 +212,10 @@ if ENABLE_MOD_MYSQL
libhawk_la_LIBADD += ../mod/libhawk-mysql.la
endif
if ENABLE_MOD_SED
libhawk_la_LIBADD += ../mod/libhawk-sed.la
endif
if ENABLE_MOD_UCI
libhawk_la_LIBADD += ../mod/libhawk-uci.la
endif

View File

@ -108,11 +108,12 @@ host_triplet = @host@
@ENABLE_STATIC_MODULE_TRUE@am__append_10 = $(SOCKET_LIBS)
@ENABLE_MOD_FFI_TRUE@@ENABLE_STATIC_MODULE_TRUE@am__append_11 = ../mod/libhawk-ffi.la
@ENABLE_MOD_MYSQL_TRUE@@ENABLE_STATIC_MODULE_TRUE@am__append_12 = ../mod/libhawk-mysql.la
@ENABLE_MOD_UCI_TRUE@@ENABLE_STATIC_MODULE_TRUE@am__append_13 = ../mod/libhawk-uci.la
@ENABLE_MOD_SED_TRUE@@ENABLE_STATIC_MODULE_TRUE@am__append_13 = ../mod/libhawk-sed.la
@ENABLE_MOD_UCI_TRUE@@ENABLE_STATIC_MODULE_TRUE@am__append_14 = ../mod/libhawk-uci.la
#pkglibdir = $(libdir)
#pkglib_LTLIBRARIES =
@ENABLE_STATIC_MODULE_FALSE@am__append_14 = libhawk-hawk.la \
@ENABLE_STATIC_MODULE_FALSE@am__append_15 = libhawk-hawk.la \
@ENABLE_STATIC_MODULE_FALSE@ libhawk-math.la libhawk-str.la \
@ENABLE_STATIC_MODULE_FALSE@ libhawk-sys.la
subdir = lib
@ -226,7 +227,7 @@ libhawk_sys_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
libhawk_la_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
$(am__DEPENDENCIES_2) $(am__DEPENDENCIES_3) \
$(am__DEPENDENCIES_4) $(am__DEPENDENCIES_5) $(am__append_11) \
$(am__append_12) $(am__append_13)
$(am__append_12) $(am__append_13) $(am__append_14)
am__libhawk_la_SOURCES_DIST = hawk.h hawk-arr.h hawk-chr.h hawk-cmn.h \
hawk-dir.h hawk-ecs.h hawk-fmt.h hawk-gem.h hawk-htb.h \
hawk-map.h hawk-rbt.h hawk-pack1.h hawk-skad.h hawk-utl.h \
@ -603,7 +604,7 @@ pkginclude_HEADERS = hawk.h hawk-arr.h hawk-chr.h hawk-cmn.h \
hawk-map.h hawk-rbt.h hawk-pack1.h hawk-skad.h hawk-utl.h \
hawk-sed.h hawk-std.h hawk-tre.h hawk-unpack.h hawk-xma.h \
$(am__append_7)
pkglib_LTLIBRARIES = libhawk.la $(am__append_14)
pkglib_LTLIBRARIES = libhawk.la $(am__append_15)
libhawk_la_SOURCES = $(pkginclude_HEADERS) arr.c chr.c dir.c ecs-imp.h \
ecs.c err-prv.h err.c err-sys.c fmt-imp.h fmt.c fnc-prv.h \
fnc.c htb.c gem.c gem-nwif.c gem-nwif2.c hawk-prv.h hawk.c \
@ -625,7 +626,8 @@ libhawk_la_CXXFLAGS = $(CXXFLAGS_ALL_COMMON)
libhawk_la_LDFLAGS = $(LDFLAGS_ALL_COMMON) -version-info 1:0:0 ## -no-undefined
libhawk_la_LIBADD = $(LIBM) $(SOCKET_LIBS) $(am__append_4) \
$(am__append_5) $(am__append_6) $(am__append_10) \
$(am__append_11) $(am__append_12) $(am__append_13)
$(am__append_11) $(am__append_12) $(am__append_13) \
$(am__append_14)
@ENABLE_CXX_FALSE@libhawk_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
@ENABLE_CXX_FALSE@ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) \
@ENABLE_CXX_FALSE@ $(CFLAGS) $(libhawk_la_LDFLAGS) $(LDFLAGS) -o $@

View File

@ -702,6 +702,9 @@
/* build mod/mysql */
#undef HAWK_ENABLE_MOD_MYSQL
/* build mod/sed */
#undef HAWK_ENABLE_MOD_SED
/* build mod/uci */
#undef HAWK_ENABLE_MOD_UCI

View File

@ -7336,6 +7336,10 @@ int hawk_putsrcoochars (hawk_t* hawk, const hawk_ooch_t* str, hawk_oow_t len)
#include "../mod/mod-mysql.h"
#endif
#if defined(HAWK_ENABLE_MOD_SED)
#include "../mod/mod-sed.h"
#endif
#if defined(HAWK_ENABLE_MOD_UCI)
#include "../mod/mod-uci.h"
#endif
@ -7359,6 +7363,9 @@ static struct
{ HAWK_T("math"), hawk_mod_math },
#if defined(HAWK_ENABLE_MOD_MYSQL)
{ HAWK_T("mysql"), hawk_mod_mysql },
#endif
#if defined(HAWK_ENABLE_MOD_SED)
{ HAWK_T("sed"), hawk_mod_sed },
#endif
{ HAWK_T("str"), hawk_mod_str },
{ HAWK_T("sys"), hawk_mod_sys },

View File

@ -639,7 +639,7 @@ static int pickup_rex (
{
if (cmd)
{
SETERR1 (sed, HAWK_SED_ECMDIC, &cmd->type, 1, &sed->src.loc);
SETERR1 (sed, HAWK_SED_ECMDIC, (hawk_ooch_t*)&cmd->type, 1, &sed->src.loc);
}
else
{
@ -659,7 +659,7 @@ static int pickup_rex (
{
if (cmd)
{
SETERR1 (sed, HAWK_SED_ECMDIC, &cmd->type, 1, &sed->src.loc);
SETERR1 (sed, HAWK_SED_ECMDIC, (hawk_ooch_t*)&cmd->type, 1, &sed->src.loc);
}
else
{
@ -2347,7 +2347,7 @@ static int write_str_to_file (
* it is also an error as it can't write any more */
sed->e.out.fun (sed, HAWK_SED_IO_CLOSE, ap, HAWK_NULL, 0);
ap->handle = HAWK_NULL;
SETERR1 (sed, HAWK_SED_EIOFIL, path, plen, &cmd->loc);
SETERR1 (sed, HAWK_SED_EIOFIL, (hawk_ooch_t*)path, plen, &cmd->loc);
return -1;
}

View File

@ -764,21 +764,23 @@ static hawk_ooi_t x_in (hawk_sed_t* sed, hawk_sed_io_cmd_t cmd, hawk_sed_io_arg_
{
if (arg->path == HAWK_NULL)
{
/* no file specified. console stream */
/* main data stream */
if (xtn->e.in.ptr == HAWK_NULL)
{
/* HAWK_NULL passed into hawk_sed_exec() for input */
/* HAWK_NULL passed into hawk_sed_exec() for input. open stdin */
sio = open_sio_std(sed, HAWK_SIO_STDIN, HAWK_SIO_READ | HAWK_SIO_IGNOREECERR);
if (sio == HAWK_NULL) return -1;
arg->handle = sio;
}
else
{
/* use the input stream handlers passed to hawk_sed_exec() */
if (open_input_stream(sed, arg, xtn->e.in.cur, &xtn->e.in) <= -1) return -1;
}
}
else
{
/* sub-stream */
sio = open_sio_file(sed, arg->path, HAWK_SIO_READ | HAWK_SIO_IGNOREECERR);
if (sio == HAWK_NULL) return -1;
arg->handle = sio;
@ -814,22 +816,26 @@ static hawk_ooi_t x_in (hawk_sed_t* sed, hawk_sed_io_cmd_t cmd, hawk_sed_io_arg_
{
hawk_ooi_t n;
n = hawk_sio_getoochars(arg->handle, buf, len);
if (n <= -1) hawk_sed_seterror (sed, HAWK_NULL, HAWK_SED_EIOFIL, &sio_std_names[HAWK_SIO_STDIN]);
if (n <= -1)
{
const hawk_ooch_t* bem = hawk_sed_backuperrmsg(sed);
hawk_sed_seterrbfmt (sed, HAWK_NULL, HAWK_SED_EIOFIL, "unable to read '%js' - %js", &sio_std_names[HAWK_SIO_STDIN], bem);
}
return n;
}
else
{
return read_input_stream(sed, arg, buf, len, &xtn->e.in);
}
}
else
{
hawk_ooi_t n;
n = hawk_sio_getoochars(arg->handle, buf, len);
if (n <= -1)
{
hawk_oocs_t ea;
ea.ptr = arg->path;
ea.len = hawk_count_oocstr(arg->path);
hawk_sed_seterror (sed, HAWK_NULL, HAWK_SED_EIOFIL, &ea);
const hawk_ooch_t* bem = hawk_sed_backuperrmsg(sed);
hawk_sed_seterrbfmt (sed, HAWK_NULL, HAWK_SED_EIOFIL, "unable to read '%js' - %js", arg->path, bem);
}
return n;
}
@ -966,10 +972,8 @@ static hawk_ooi_t x_out (
n = hawk_sio_putoochars(arg->handle, dat, len);
if (n <= -1)
{
hawk_oocs_t ea;
ea.ptr = arg->path;
ea.len = hawk_count_oocstr(arg->path);
hawk_sed_seterror (sed, HAWK_NULL, HAWK_SED_EIOFIL, &ea);
const hawk_ooch_t* bem = hawk_sed_backuperrmsg(sed);
hawk_sed_seterrbfmt (sed, HAWK_NULL, HAWK_SED_EIOFIL, "unable to write '%js' - %js", arg->path, bem);
}
return n;
}

View File

@ -1591,6 +1591,9 @@ static hawk_ooi_t sf_out (hawk_t* hawk, hawk_sio_cmd_t cmd, hawk_sio_arg_t* arg,
xtn->s.out.u.ucs.buf = hawk_uecs_open(hawk_getgem(hawk), 0, 512);
if (xtn->s.out.u.ucs.buf == HAWK_NULL) return -1;
return 1;
default:
goto internal_error;
}
break;
@ -1613,6 +1616,9 @@ static hawk_ooi_t sf_out (hawk_t* hawk, hawk_sio_cmd_t cmd, hawk_sio_arg_t* arg,
/* i don't close xtn->s.out.u.oocs.buf intentionally here.
* it will be closed at the end of hawk_parsestd() */
return 0;
default:
goto internal_error;
}
break;
@ -1691,6 +1697,9 @@ static hawk_ooi_t sf_out (hawk_t* hawk, hawk_sio_cmd_t cmd, hawk_sio_arg_t* arg,
#else
goto parsestd_str;
#endif
default:
goto internal_error;
}
break;
@ -1701,6 +1710,7 @@ static hawk_ooi_t sf_out (hawk_t* hawk, hawk_sio_cmd_t cmd, hawk_sio_arg_t* arg,
break;
}
internal_error:
hawk_seterrnum (hawk, HAWK_NULL, HAWK_EINTERN);
return -1;
}
@ -1776,6 +1786,10 @@ int hawk_parsestd (hawk_t* hawk, hawk_parsestd_t in[], hawk_parsestd_t* out)
}
if (xtn->s.out.u.ucs.buf) hawk_uecs_close (xtn->s.out.u.ucs.buf);
break;
default:
/* do nothing */
break;
}
}

View File

@ -29,6 +29,10 @@ if ENABLE_MOD_MYSQL
noinst_LTLIBRARIES += libhawk-mysql.la
endif
if ENABLE_MOD_SED
noinst_LTLIBRARIES += libhawk-sed.la
endif
if ENABLE_MOD_UCI
noinst_LTLIBRARIES += libhawk-uci.la
endif
@ -54,6 +58,10 @@ if ENABLE_MOD_MYSQL
pkgmodexec_LTLIBRARIES += libhawk-mysql.la
endif
if ENABLE_MOD_SED
pkgmodexec_LTLIBRARIES += libhawk-sed.la
endif
if ENABLE_MOD_UCI
pkgmodexec_LTLIBRARIES += libhawk-uci.la
endif
@ -82,6 +90,14 @@ libhawk_mysql_la_LDFLAGS = $(LDFLAGS_COMMON) $(MYSQL_LDFLAGS)
libhawk_mysql_la_LIBADD = $(LIBADD_COMMON) $(MYSQL_LIBS)
endif
if ENABLE_MOD_SED
libhawk_sed_la_SOURCES = mod-sed.c mod-sed.h
libhawk_sed_la_CPPFLAGS = $(CPPFLAGS_COMMON)
libhawk_sed_la_CFLAGS = $(CFLAGS_COMMON)
libhawk_sed_la_LDFLAGS = $(LDFLAGS_COMMON)
libhawk_sed_la_LIBADD = $(LIBADD_COMMON)
endif
if ENABLE_MOD_UCI
libhawk_uci_la_SOURCES = mod-uci.c mod-uci.h
libhawk_uci_la_CPPFLAGS = $(CPPFLAGS_COMMON)

View File

@ -90,10 +90,12 @@ build_triplet = @build@
host_triplet = @host@
@ENABLE_MOD_FFI_TRUE@@ENABLE_STATIC_MODULE_TRUE@am__append_1 = libhawk-ffi.la
@ENABLE_MOD_MYSQL_TRUE@@ENABLE_STATIC_MODULE_TRUE@am__append_2 = libhawk-mysql.la
@ENABLE_MOD_UCI_TRUE@@ENABLE_STATIC_MODULE_TRUE@am__append_3 = libhawk-uci.la
@ENABLE_MOD_FFI_TRUE@@ENABLE_STATIC_MODULE_FALSE@am__append_4 = libhawk-ffi.la
@ENABLE_MOD_MYSQL_TRUE@@ENABLE_STATIC_MODULE_FALSE@am__append_5 = libhawk-mysql.la
@ENABLE_MOD_UCI_TRUE@@ENABLE_STATIC_MODULE_FALSE@am__append_6 = libhawk-uci.la
@ENABLE_MOD_SED_TRUE@@ENABLE_STATIC_MODULE_TRUE@am__append_3 = libhawk-sed.la
@ENABLE_MOD_UCI_TRUE@@ENABLE_STATIC_MODULE_TRUE@am__append_4 = libhawk-uci.la
@ENABLE_MOD_FFI_TRUE@@ENABLE_STATIC_MODULE_FALSE@am__append_5 = libhawk-ffi.la
@ENABLE_MOD_MYSQL_TRUE@@ENABLE_STATIC_MODULE_FALSE@am__append_6 = libhawk-mysql.la
@ENABLE_MOD_SED_TRUE@@ENABLE_STATIC_MODULE_FALSE@am__append_7 = libhawk-sed.la
@ENABLE_MOD_UCI_TRUE@@ENABLE_STATIC_MODULE_FALSE@am__append_8 = libhawk-uci.la
subdir = mod
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_sign.m4 \
@ -176,6 +178,20 @@ libhawk_mysql_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
@ENABLE_MOD_MYSQL_TRUE@@ENABLE_STATIC_MODULE_FALSE@ -rpath \
@ENABLE_MOD_MYSQL_TRUE@@ENABLE_STATIC_MODULE_FALSE@ $(pkgmodexecdir)
@ENABLE_MOD_MYSQL_TRUE@@ENABLE_STATIC_MODULE_TRUE@am_libhawk_mysql_la_rpath =
@ENABLE_MOD_SED_TRUE@libhawk_sed_la_DEPENDENCIES = \
@ENABLE_MOD_SED_TRUE@ $(am__DEPENDENCIES_1)
am__libhawk_sed_la_SOURCES_DIST = mod-sed.c mod-sed.h
@ENABLE_MOD_SED_TRUE@am_libhawk_sed_la_OBJECTS = \
@ENABLE_MOD_SED_TRUE@ libhawk_sed_la-mod-sed.lo
libhawk_sed_la_OBJECTS = $(am_libhawk_sed_la_OBJECTS)
libhawk_sed_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
$(libhawk_sed_la_CFLAGS) $(CFLAGS) $(libhawk_sed_la_LDFLAGS) \
$(LDFLAGS) -o $@
@ENABLE_MOD_SED_TRUE@@ENABLE_STATIC_MODULE_FALSE@am_libhawk_sed_la_rpath = \
@ENABLE_MOD_SED_TRUE@@ENABLE_STATIC_MODULE_FALSE@ -rpath \
@ENABLE_MOD_SED_TRUE@@ENABLE_STATIC_MODULE_FALSE@ $(pkgmodexecdir)
@ENABLE_MOD_SED_TRUE@@ENABLE_STATIC_MODULE_TRUE@am_libhawk_sed_la_rpath =
@ENABLE_MOD_UCI_TRUE@libhawk_uci_la_DEPENDENCIES = \
@ENABLE_MOD_UCI_TRUE@ $(am__DEPENDENCIES_1) \
@ENABLE_MOD_UCI_TRUE@ $(am__DEPENDENCIES_1)
@ -208,6 +224,7 @@ depcomp = $(SHELL) $(top_srcdir)/ac/depcomp
am__maybe_remake_depfiles = depfiles
am__depfiles_remade = ./$(DEPDIR)/libhawk_ffi_la-mod-ffi.Plo \
./$(DEPDIR)/libhawk_mysql_la-mod-mysql.Plo \
./$(DEPDIR)/libhawk_sed_la-mod-sed.Plo \
./$(DEPDIR)/libhawk_uci_la-mod-uci.Plo
am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
@ -229,9 +246,10 @@ am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
am__v_CCLD_0 = @echo " CCLD " $@;
am__v_CCLD_1 =
SOURCES = $(libhawk_ffi_la_SOURCES) $(libhawk_mysql_la_SOURCES) \
$(libhawk_uci_la_SOURCES)
$(libhawk_sed_la_SOURCES) $(libhawk_uci_la_SOURCES)
DIST_SOURCES = $(am__libhawk_ffi_la_SOURCES_DIST) \
$(am__libhawk_mysql_la_SOURCES_DIST) \
$(am__libhawk_sed_la_SOURCES_DIST) \
$(am__libhawk_uci_la_SOURCES_DIST)
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
@ -435,10 +453,12 @@ CFLAGS_COMMON =
@ENABLE_STATIC_MODULE_FALSE@LIBADD_COMMON = -lhawk
@ENABLE_STATIC_MODULE_TRUE@LIBADD_COMMON =
@ENABLE_STATIC_MODULE_TRUE@noinst_LTLIBRARIES = $(am__append_1) \
@ENABLE_STATIC_MODULE_TRUE@ $(am__append_2) $(am__append_3)
@ENABLE_STATIC_MODULE_TRUE@ $(am__append_2) $(am__append_3) \
@ENABLE_STATIC_MODULE_TRUE@ $(am__append_4)
@ENABLE_STATIC_MODULE_FALSE@pkgmodexecdir = $(libdir)
@ENABLE_STATIC_MODULE_FALSE@pkgmodexec_LTLIBRARIES = $(am__append_4) \
@ENABLE_STATIC_MODULE_FALSE@ $(am__append_5) $(am__append_6)
@ENABLE_STATIC_MODULE_FALSE@pkgmodexec_LTLIBRARIES = $(am__append_5) \
@ENABLE_STATIC_MODULE_FALSE@ $(am__append_6) $(am__append_7) \
@ENABLE_STATIC_MODULE_FALSE@ $(am__append_8)
##################################################
##################################################
@ -456,6 +476,11 @@ CFLAGS_COMMON =
@ENABLE_MOD_MYSQL_TRUE@libhawk_mysql_la_CFLAGS = $(CFLAGS_COMMON)
@ENABLE_MOD_MYSQL_TRUE@libhawk_mysql_la_LDFLAGS = $(LDFLAGS_COMMON) $(MYSQL_LDFLAGS)
@ENABLE_MOD_MYSQL_TRUE@libhawk_mysql_la_LIBADD = $(LIBADD_COMMON) $(MYSQL_LIBS)
@ENABLE_MOD_SED_TRUE@libhawk_sed_la_SOURCES = mod-sed.c mod-sed.h
@ENABLE_MOD_SED_TRUE@libhawk_sed_la_CPPFLAGS = $(CPPFLAGS_COMMON)
@ENABLE_MOD_SED_TRUE@libhawk_sed_la_CFLAGS = $(CFLAGS_COMMON)
@ENABLE_MOD_SED_TRUE@libhawk_sed_la_LDFLAGS = $(LDFLAGS_COMMON)
@ENABLE_MOD_SED_TRUE@libhawk_sed_la_LIBADD = $(LIBADD_COMMON)
@ENABLE_MOD_UCI_TRUE@libhawk_uci_la_SOURCES = mod-uci.c mod-uci.h
@ENABLE_MOD_UCI_TRUE@libhawk_uci_la_CPPFLAGS = $(CPPFLAGS_COMMON)
@ENABLE_MOD_UCI_TRUE@libhawk_uci_la_CFLAGS = $(CFLAGS_COMMON)
@ -547,6 +572,9 @@ libhawk-ffi.la: $(libhawk_ffi_la_OBJECTS) $(libhawk_ffi_la_DEPENDENCIES) $(EXTRA
libhawk-mysql.la: $(libhawk_mysql_la_OBJECTS) $(libhawk_mysql_la_DEPENDENCIES) $(EXTRA_libhawk_mysql_la_DEPENDENCIES)
$(AM_V_CCLD)$(libhawk_mysql_la_LINK) $(am_libhawk_mysql_la_rpath) $(libhawk_mysql_la_OBJECTS) $(libhawk_mysql_la_LIBADD) $(LIBS)
libhawk-sed.la: $(libhawk_sed_la_OBJECTS) $(libhawk_sed_la_DEPENDENCIES) $(EXTRA_libhawk_sed_la_DEPENDENCIES)
$(AM_V_CCLD)$(libhawk_sed_la_LINK) $(am_libhawk_sed_la_rpath) $(libhawk_sed_la_OBJECTS) $(libhawk_sed_la_LIBADD) $(LIBS)
libhawk-uci.la: $(libhawk_uci_la_OBJECTS) $(libhawk_uci_la_DEPENDENCIES) $(EXTRA_libhawk_uci_la_DEPENDENCIES)
$(AM_V_CCLD)$(libhawk_uci_la_LINK) $(am_libhawk_uci_la_rpath) $(libhawk_uci_la_OBJECTS) $(libhawk_uci_la_LIBADD) $(LIBS)
@ -558,6 +586,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhawk_ffi_la-mod-ffi.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhawk_mysql_la-mod-mysql.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhawk_sed_la-mod-sed.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhawk_uci_la-mod-uci.Plo@am__quote@ # am--include-marker
$(am__depfiles_remade):
@ -604,6 +633,13 @@ libhawk_mysql_la-mod-mysql.lo: mod-mysql.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libhawk_mysql_la_CPPFLAGS) $(CPPFLAGS) $(libhawk_mysql_la_CFLAGS) $(CFLAGS) -c -o libhawk_mysql_la-mod-mysql.lo `test -f 'mod-mysql.c' || echo '$(srcdir)/'`mod-mysql.c
libhawk_sed_la-mod-sed.lo: mod-sed.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libhawk_sed_la_CPPFLAGS) $(CPPFLAGS) $(libhawk_sed_la_CFLAGS) $(CFLAGS) -MT libhawk_sed_la-mod-sed.lo -MD -MP -MF $(DEPDIR)/libhawk_sed_la-mod-sed.Tpo -c -o libhawk_sed_la-mod-sed.lo `test -f 'mod-sed.c' || echo '$(srcdir)/'`mod-sed.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libhawk_sed_la-mod-sed.Tpo $(DEPDIR)/libhawk_sed_la-mod-sed.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mod-sed.c' object='libhawk_sed_la-mod-sed.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libhawk_sed_la_CPPFLAGS) $(CPPFLAGS) $(libhawk_sed_la_CFLAGS) $(CFLAGS) -c -o libhawk_sed_la-mod-sed.lo `test -f 'mod-sed.c' || echo '$(srcdir)/'`mod-sed.c
libhawk_uci_la-mod-uci.lo: mod-uci.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libhawk_uci_la_CPPFLAGS) $(CPPFLAGS) $(libhawk_uci_la_CFLAGS) $(CFLAGS) -MT libhawk_uci_la-mod-uci.lo -MD -MP -MF $(DEPDIR)/libhawk_uci_la-mod-uci.Tpo -c -o libhawk_uci_la-mod-uci.lo `test -f 'mod-uci.c' || echo '$(srcdir)/'`mod-uci.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libhawk_uci_la-mod-uci.Tpo $(DEPDIR)/libhawk_uci_la-mod-uci.Plo
@ -747,6 +783,7 @@ clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
distclean: distclean-am
-rm -f ./$(DEPDIR)/libhawk_ffi_la-mod-ffi.Plo
-rm -f ./$(DEPDIR)/libhawk_mysql_la-mod-mysql.Plo
-rm -f ./$(DEPDIR)/libhawk_sed_la-mod-sed.Plo
-rm -f ./$(DEPDIR)/libhawk_uci_la-mod-uci.Plo
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
@ -795,6 +832,7 @@ installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f ./$(DEPDIR)/libhawk_ffi_la-mod-ffi.Plo
-rm -f ./$(DEPDIR)/libhawk_mysql_la-mod-mysql.Plo
-rm -f ./$(DEPDIR)/libhawk_sed_la-mod-sed.Plo
-rm -f ./$(DEPDIR)/libhawk_uci_la-mod-uci.Plo
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic

268
hawk/mod/mod-sed.c Normal file
View File

@ -0,0 +1,268 @@
/*
* $Id$
*
Copyright (c) 2006-2020 Chung, Hyung-Hwan. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "mod-sed.h"
#include "../lib/sed-prv.h"
#if 0
static int fnc_errno (hawk_rtx_t* rtx, const hawk_fnc_info_t* fi)
{
uctx_list_t* list;
hawk_val_t* retv;
list = rtx_to_list (rtx, fi);
retv = hawk_rtx_makeintval (rtx, list->errnum);
if (retv == HAWK_NULL) return -1;
hawk_rtx_setretval (rtx, retv);
return 0;
}
static hawk_ooch_t* errmsg[] =
{
HAWK_T("no error"),
HAWK_T("out of memory"),
HAWK_T("invalid data"),
HAWK_T("not found"),
HAWK_T("I/O error"),
HAWK_T("parse error"),
HAWK_T("duplicate data"),
HAWK_T("unknown error")
};
static int fnc_errstr (hawk_rtx_t* rtx, const hawk_fnc_info_t* fi)
{
hawk_val_t* retv;
hawk_int_t errnum;
/*
list = rtx_to_list (rtx, fi);
if (hawk_rtx_getnargs (rtx) <= 0 ||
hawk_rtx_valtoint (rtx, hawk_rtx_getarg (rtx, 0), &errnum) <= -1)
{
errnum = list->errnum;
}
*/
ret = hawk_rtx_valtoint (rtx, hawk_rtx_getarg (rtx, 0), &id);
if (ret <= -1) errnum = -1;
if (errnum < 0 || errnum >= HAWK_COUNTOF(errmsg)) errnum = HAWK_COUNTOF(errmsg) - 1;
retv = hawk_rtx_makestrvalwithstr (rtx, errmsg[errnum]);
if (retv == HAWK_NULL) return -1;
hawk_rtx_setretval (rtx, retv);
return 0;
}
#endif
static int fnc_file_to_file (hawk_rtx_t* rtx, const hawk_fnc_info_t* fi)
{
hawk_sed_t* sed = HAWK_NULL;
hawk_val_t* retv;
hawk_val_t* a[3];
hawk_oocs_t xstr[3];
int i = 0, ret = 0;
/* result = sed::file_to_file ("s/ABC/123/g", input_file, output_file [, option_string]) */
sed = hawk_sed_openstdwithmmgr(hawk_rtx_getgem(rtx), 0, hawk_rtx_getcmgr(rtx), HAWK_NULL);
if (sed == HAWK_NULL)
{
ret = -2;
goto oops;
}
/* TODO hawk_set_opt (TRAIT) using the optional parameter */
for (i = 0; i < 3; i++)
{
a[i] = hawk_rtx_getarg(rtx, i);
xstr[i].ptr = hawk_rtx_getvaloocstr(rtx, a[i], &xstr[i].len);
if (xstr[i].ptr == HAWK_NULL)
{
ret = -2;
goto oops;
}
}
if (hawk_sed_compstdoocs(sed, &xstr[0]) <= -1)
{
ret = -3; /* compile error */
goto oops;
}
if (hawk_sed_execstdfile(sed, xstr[1].ptr, xstr[2].ptr, HAWK_NULL) <= -1)
{
ret = -4;
goto oops;
}
oops:
retv = hawk_rtx_makeintval(rtx, ret);
if (retv == HAWK_NULL) retv = hawk_rtx_makeintval(rtx, -1);
while (i > 0)
{
--i;
hawk_rtx_freevaloocstr (rtx, a[i], xstr[i].ptr);
}
if (sed) hawk_sed_close (sed);
hawk_rtx_setretval (rtx, retv);
return 0;
}
static int fnc_str_to_str (hawk_rtx_t* rtx, const hawk_fnc_info_t* fi)
{
hawk_sed_t* sed = HAWK_NULL;
hawk_val_t* retv;
hawk_val_t* a[2], * tmp;
hawk_oocs_t xstr[2];
hawk_oocs_t outstr;
int i = 0, ret = 0, n;
sed = hawk_sed_openstdwithmmgr (hawk_rtx_getmmgr(rtx), 0, hawk_rtx_getcmgr(rtx), HAWK_NULL);
if (sed == HAWK_NULL)
{
ret = -2;
goto oops;
}
/* TODO hawk_set_opt (TRAIT) using the optional parameter */
for (i = 0; i < 2; i++)
{
a[i] = hawk_rtx_getarg(rtx, i);
xstr[i].ptr = hawk_rtx_getvaloocstr(rtx, a[i], &xstr[i].len);
if (xstr[i].ptr == HAWK_NULL)
{
ret = -2;
goto oops;
}
}
if (hawk_sed_compstdoocs(sed, &xstr[0]) <= -1)
{
ret = -3; /* compile error */
goto oops;
}
if (hawk_sed_execstdxstr (sed, &xstr[1], &outstr, HAWK_NULL) <= -1)
{
ret = -4;
goto oops;
}
tmp = hawk_rtx_makestrvalwithoocs(rtx, &outstr);
hawk_sed_freemem (sed, outstr.ptr);
if (!tmp)
{
ret = -1;
goto oops;
}
hawk_rtx_refupval (rtx, tmp);
n = hawk_rtx_setrefval(rtx, (hawk_val_ref_t*)hawk_rtx_getarg (rtx, 2), tmp);
hawk_rtx_refdownval (rtx, tmp);
if (n <= -1)
{
ret = -5;
goto oops;
}
oops:
retv = hawk_rtx_makeintval(rtx, ret);
if (retv == HAWK_NULL) retv = hawk_rtx_makeintval(rtx, -1);
while (i > 0)
{
--i;
hawk_rtx_freevaloocstr (rtx, a[i], xstr[i].ptr);
}
if (sed) hawk_sed_close (sed);
hawk_rtx_setretval (rtx, retv);
return 0;
}
typedef struct fnctab_t fnctab_t;
struct fnctab_t
{
const hawk_ooch_t* name;
hawk_mod_sym_fnc_t info;
};
static fnctab_t fnctab[] =
{
/* keep this table sorted for binary search in query(). */
{ HAWK_T("file_to_file"), { { 3, 3, HAWK_NULL }, fnc_file_to_file, 0 } },
{ HAWK_T("str_to_str"), { { 3, 3, HAWK_T("vvr")}, fnc_str_to_str, 0 } }
};
/* ------------------------------------------------------------------------ */
static int query (hawk_mod_t* mod, hawk_t* hawk, const hawk_ooch_t* name, hawk_mod_sym_t* sym)
{
return hawk_findmodsymfnc(hawk, fnctab, HAWK_COUNTOF(fnctab), name, sym);
}
/* TODO: proper resource management */
static int init (hawk_mod_t* mod, hawk_rtx_t* rtx)
{
return 0;
}
static void fini (hawk_mod_t* mod, hawk_rtx_t* rtx)
{
/* TODO: anything? */
}
static void unload (hawk_mod_t* mod, hawk_t* hawk)
{
/* TODO: anything? */
}
int hawk_mod_sed (hawk_mod_t* mod, hawk_t* hawk)
{
hawk_ntime_t tv;
mod->query = query;
mod->unload = unload;
mod->init = init;
mod->fini = fini;
mod->ctx = HAWK_NULL;
return 0;
}

43
hawk/mod/mod-sed.h Normal file
View File

@ -0,0 +1,43 @@
/*
* $Id$
*
Copyright (c) 2006-2020 Chung, Hyung-Hwan. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _HAWK_MOD_SED_H_
#define _HAWK_MOD_SED_H_
#include <hawk.h>
#if defined(__cplusplus)
extern "C" {
#endif
HAWK_EXPORT int hawk_mod_sed (hawk_mod_t* mod, hawk_t* hawk);
#if defined(__cplusplus)
}
#endif
#endif

View File

@ -13,7 +13,7 @@ LDFLAGS_COMMON=-L$(abs_builddir)/../lib -L$(libdir)
## for more information.
LIBADD_COMMON = ../lib/libhawk.la $(LIBM)
check_SCRIPTS = h-001.hawk h-002.hawk h-003.hawk
check_SCRIPTS = h-001.hawk h-002.hawk h-003.hawk h-009.hawk
##noinst_SCRIPTS = $(check_SCRIPTS)
EXTRA_DIST = $(check_SCRIPTS) ensure.inc \
journal-toc.hawk journal-toc.in journal-toc.out journal-toc-html.out \

View File

@ -577,7 +577,7 @@ CPPFLAGS_COMMON = \
CFLAGS_COMMON =
LDFLAGS_COMMON = -L$(abs_builddir)/../lib -L$(libdir)
LIBADD_COMMON = ../lib/libhawk.la $(LIBM)
check_SCRIPTS = h-001.hawk h-002.hawk h-003.hawk
check_SCRIPTS = h-001.hawk h-002.hawk h-003.hawk h-009.hawk
EXTRA_DIST = $(check_SCRIPTS) ensure.inc \
journal-toc.hawk journal-toc.in journal-toc.out journal-toc-html.out \
bibtex-to-html.hawk bibtex-to-html.out

19
hawk/t/h-009.hawk Normal file
View File

@ -0,0 +1,19 @@
@pragma entry main
@pragma implicit off
@include "ensure.inc";
function run_test_001 ()
{
@local tmp, out;
tmp = sed::str_to_str("s/a/j/g", "aaabbbaaacccaaaddd", out);
ensure (out === "jjjbbbjjjcccjjjddd", 1, @SCRIPTNAME, @SCRIPTLINE);
}
function main()
{
run_test_001 ();
print "SUCCESS";
}