diff --git a/qse/cmd/awk/Makefile.am b/qse/cmd/awk/Makefile.am index 3bd8ddfb..13cbef48 100644 --- a/qse/cmd/awk/Makefile.am +++ b/qse/cmd/awk/Makefile.am @@ -4,7 +4,7 @@ AM_CPPFLAGS = \ -I$(top_builddir)/include \ -I$(top_srcdir)/include \ -I$(includedir) \ - -DDEFAULT_MODDIR=\"$(libdir)/qse\" + -DDEFAULT_MODDIR=\"$(libdir)/qse\" $(LTDLINCL) #####################################################################3 @@ -12,7 +12,7 @@ bin_PROGRAMS = qseawk qseawk_SOURCES = awk.c qseawk_LDFLAGS = -L../../lib/awk -L../../lib/cmn -L$(libdir) -qseawk_LDADD = -lqseawk -lqsecmn $(LIBM) +qseawk_LDADD = -lqseawk -lqsecmn $(LIBM) $(LIBLTDL) if WIN32 if WCHAR diff --git a/qse/cmd/awk/Makefile.in b/qse/cmd/awk/Makefile.in index fc195425..66af63e8 100644 --- a/qse/cmd/awk/Makefile.in +++ b/qse/cmd/awk/Makefile.in @@ -57,7 +57,8 @@ am_qseawk_OBJECTS = awk.$(OBJEXT) qseawk_OBJECTS = $(am_qseawk_OBJECTS) am__DEPENDENCIES_1 = @WCHAR_TRUE@@WIN32_TRUE@am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1) -qseawk_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) +qseawk_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_2) qseawk_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(qseawk_LDFLAGS) \ $(LDFLAGS) -o $@ @@ -255,11 +256,11 @@ AM_CPPFLAGS = \ -I$(top_builddir)/include \ -I$(top_srcdir)/include \ -I$(includedir) \ - -DDEFAULT_MODDIR=\"$(libdir)/qse\" + -DDEFAULT_MODDIR=\"$(libdir)/qse\" $(LTDLINCL) qseawk_SOURCES = awk.c qseawk_LDFLAGS = -L../../lib/awk -L../../lib/cmn -L$(libdir) -qseawk_LDADD = -lqseawk -lqsecmn $(LIBM) $(am__append_1) +qseawk_LDADD = -lqseawk -lqsecmn $(LIBM) $(LIBLTDL) $(am__append_1) all: all-am .SUFFIXES: diff --git a/qse/lib/awk/Makefile.am b/qse/lib/awk/Makefile.am index 27d71df2..ab3b9aaf 100644 --- a/qse/lib/awk/Makefile.am +++ b/qse/lib/awk/Makefile.am @@ -15,13 +15,6 @@ if ENABLE_CXX lib_LTLIBRARIES += libqseawkxx.la libqseawkxx_la_SOURCES = Awk.cpp StdAwk.cpp libqseawkxx_la_LDFLAGS = -L. -L../cmn -L$(libdir) -version-info 1:0:0 -no-undefined -libqseawkxx_la_LIBADD = -lqseawk -lqsecmn $(LIBM) +libqseawkxx_la_LIBADD = -lqseawk -lqsecmn $(LIBM) $(LIBLTDL) endif -if HAVE_C_MPI -lib_LTLIBRARIES += libqseawkmp.la -libqseawkmp_la_CPPFLAGS = $(AM_CPPFLAGS) $(MPI_CFLAGS) -libqseawkmp_la_SOURCES = mpi.c -libqseawkmp_la_LDFLAGS = -L. -L../cmn -L$(libdir) -version-info 1:0:0 -no-undefined $(MPI_CLDFLAGS) -libqseawkmp_la_LIBADD = -lqseawk -lqsecmn $(LIBM) -endif diff --git a/qse/lib/awk/Makefile.in b/qse/lib/awk/Makefile.in index 35ce66a8..338cec33 100644 --- a/qse/lib/awk/Makefile.in +++ b/qse/lib/awk/Makefile.in @@ -35,7 +35,6 @@ POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ @ENABLE_CXX_TRUE@am__append_1 = libqseawkxx.la -@HAVE_C_MPI_TRUE@am__append_2 = libqseawkmp.la subdir = lib/awk DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 @@ -89,15 +88,8 @@ libqseawk_la_OBJECTS = $(am_libqseawk_la_OBJECTS) libqseawk_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(libqseawk_la_LDFLAGS) $(LDFLAGS) -o $@ -@HAVE_C_MPI_TRUE@libqseawkmp_la_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__libqseawkmp_la_SOURCES_DIST = mpi.c -@HAVE_C_MPI_TRUE@am_libqseawkmp_la_OBJECTS = libqseawkmp_la-mpi.lo -libqseawkmp_la_OBJECTS = $(am_libqseawkmp_la_OBJECTS) -libqseawkmp_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(libqseawkmp_la_LDFLAGS) $(LDFLAGS) -o $@ -@HAVE_C_MPI_TRUE@am_libqseawkmp_la_rpath = -rpath $(libdir) -@ENABLE_CXX_TRUE@libqseawkxx_la_DEPENDENCIES = $(am__DEPENDENCIES_1) +@ENABLE_CXX_TRUE@libqseawkxx_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ +@ENABLE_CXX_TRUE@ $(am__DEPENDENCIES_1) am__libqseawkxx_la_SOURCES_DIST = Awk.cpp StdAwk.cpp @ENABLE_CXX_TRUE@am_libqseawkxx_la_OBJECTS = Awk.lo StdAwk.lo libqseawkxx_la_OBJECTS = $(am_libqseawkxx_la_OBJECTS) @@ -127,10 +119,8 @@ CXXLD = $(CXX) CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ -SOURCES = $(libqseawk_la_SOURCES) $(libqseawkmp_la_SOURCES) \ - $(libqseawkxx_la_SOURCES) +SOURCES = $(libqseawk_la_SOURCES) $(libqseawkxx_la_SOURCES) DIST_SOURCES = $(libqseawk_la_SOURCES) \ - $(am__libqseawkmp_la_SOURCES_DIST) \ $(am__libqseawkxx_la_SOURCES_DIST) ETAGS = etags CTAGS = ctags @@ -313,17 +303,13 @@ AM_CPPFLAGS = \ -I$(includedir) \ -DDEFAULT_MODDIR=\"$(libdir)/qse\" $(LTDLINCL) -lib_LTLIBRARIES = libqseawk.la $(am__append_1) $(am__append_2) +lib_LTLIBRARIES = libqseawk.la $(am__append_1) libqseawk_la_SOURCES = awk.c err.c tree.c parse.c run.c rec.c val.c fnc.c misc.c rio.c std.c awk.h err.h rio.h val.h fnc.h misc.h parse.h run.h tree.h libqseawk_la_LDFLAGS = -L../cmn -L$(libdir) -version-info 1:0:0 -no-undefined libqseawk_la_LIBADD = -lqsecmn $(LIBM) $(LIBLTDL) @ENABLE_CXX_TRUE@libqseawkxx_la_SOURCES = Awk.cpp StdAwk.cpp @ENABLE_CXX_TRUE@libqseawkxx_la_LDFLAGS = -L. -L../cmn -L$(libdir) -version-info 1:0:0 -no-undefined -@ENABLE_CXX_TRUE@libqseawkxx_la_LIBADD = -lqseawk -lqsecmn $(LIBM) -@HAVE_C_MPI_TRUE@libqseawkmp_la_CPPFLAGS = $(AM_CPPFLAGS) $(MPI_CFLAGS) -@HAVE_C_MPI_TRUE@libqseawkmp_la_SOURCES = mpi.c -@HAVE_C_MPI_TRUE@libqseawkmp_la_LDFLAGS = -L. -L../cmn -L$(libdir) -version-info 1:0:0 -no-undefined $(MPI_CLDFLAGS) -@HAVE_C_MPI_TRUE@libqseawkmp_la_LIBADD = -lqseawk -lqsecmn $(LIBM) +@ENABLE_CXX_TRUE@libqseawkxx_la_LIBADD = -lqseawk -lqsecmn $(LIBM) $(LIBLTDL) all: all-am .SUFFIXES: @@ -391,8 +377,6 @@ clean-libLTLIBRARIES: done libqseawk.la: $(libqseawk_la_OBJECTS) $(libqseawk_la_DEPENDENCIES) $(EXTRA_libqseawk_la_DEPENDENCIES) $(libqseawk_la_LINK) -rpath $(libdir) $(libqseawk_la_OBJECTS) $(libqseawk_la_LIBADD) $(LIBS) -libqseawkmp.la: $(libqseawkmp_la_OBJECTS) $(libqseawkmp_la_DEPENDENCIES) $(EXTRA_libqseawkmp_la_DEPENDENCIES) - $(libqseawkmp_la_LINK) $(am_libqseawkmp_la_rpath) $(libqseawkmp_la_OBJECTS) $(libqseawkmp_la_LIBADD) $(LIBS) libqseawkxx.la: $(libqseawkxx_la_OBJECTS) $(libqseawkxx_la_DEPENDENCIES) $(EXTRA_libqseawkxx_la_DEPENDENCIES) $(libqseawkxx_la_LINK) $(am_libqseawkxx_la_rpath) $(libqseawkxx_la_OBJECTS) $(libqseawkxx_la_LIBADD) $(LIBS) @@ -407,7 +391,6 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/awk.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/err.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fnc.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libqseawkmp_la-mpi.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/misc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parse.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rec.Plo@am__quote@ @@ -438,13 +421,6 @@ distclean-compile: @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< -libqseawkmp_la-mpi.lo: mpi.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libqseawkmp_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libqseawkmp_la-mpi.lo -MD -MP -MF $(DEPDIR)/libqseawkmp_la-mpi.Tpo -c -o libqseawkmp_la-mpi.lo `test -f 'mpi.c' || echo '$(srcdir)/'`mpi.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libqseawkmp_la-mpi.Tpo $(DEPDIR)/libqseawkmp_la-mpi.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mpi.c' object='libqseawkmp_la-mpi.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libqseawkmp_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libqseawkmp_la-mpi.lo `test -f 'mpi.c' || echo '$(srcdir)/'`mpi.c - .cpp.o: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po diff --git a/qse/lib/awk/mpi.c b/qse/lib/awk/mpi.c deleted file mode 100644 index 3009dd4a..00000000 --- a/qse/lib/awk/mpi.c +++ /dev/null @@ -1,337 +0,0 @@ -/* - * $Id$ - * - Copyright 2006-2012 Chung, Hyung-Hwan. - This file is part of QSE. - - QSE is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as - published by the Free Software Foundation, either version 3 of - the License, or (at your option) any later version. - - QSE is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with QSE. If not, see . - */ - -#include -#include -#include "../cmn/mem.h" - -#include - -typedef struct xtn_t xtn_t; - -struct xtn_t -{ - int gbl_mpi[9]; -}; - -typedef struct rxtn_t rxtn_t; -struct rxtn_t -{ - MPI_Comm comm; - int size; - int rank; -}; - -qse_awk_t* qse_awk_openmpi (qse_size_t xtnsize) -{ - return qse_awk_openmpiwithmmgr (QSE_MMGR_GETDFL(), xtnsize); -} - -static int add_functions (qse_awk_t* awk); - -qse_awk_t* qse_awk_openmpiwithmmgr (qse_mmgr_t* mmgr, qse_size_t xtnsize) -{ - qse_awk_t* awk; - - awk = qse_awk_openstdwithmmgr ( - QSE_MMGR_GETDFL(), QSE_SIZEOF(xtn_t) + xtnsize); - - if (awk) - { - xtn_t* xtn; - qse_size_t i; - - xtn = (xtn_t*) qse_awk_getxtnstd (awk); - QSE_MEMSET (xtn, 0, QSE_SIZEOF(*xtn)); - - xtn->gbl_mpi[0] = qse_awk_addgbl (awk, QSE_T("MPI_HOST"), 8); - xtn->gbl_mpi[1] = qse_awk_addgbl (awk, QSE_T("MPI_SIZE"), 8); - xtn->gbl_mpi[2] = qse_awk_addgbl (awk, QSE_T("MPI_RANK"), 8); - - xtn->gbl_mpi[3] = qse_awk_addgbl (awk, QSE_T("MPI_REDUCE_MIN"), 14); - xtn->gbl_mpi[4] = qse_awk_addgbl (awk, QSE_T("MPI_REDUCE_MAX"), 14); - xtn->gbl_mpi[5] = qse_awk_addgbl (awk, QSE_T("MPI_REDUCE_SUM"), 14); - xtn->gbl_mpi[6] = qse_awk_addgbl (awk, QSE_T("MPI_REDUCE_PROD"), 15); - xtn->gbl_mpi[7] = qse_awk_addgbl (awk, QSE_T("MPI_REDUCE_LAND"), 15); - xtn->gbl_mpi[8] = qse_awk_addgbl (awk, QSE_T("MPI_REDUCE_LOR"), 14); - - for (i = 0; i < QSE_COUNTOF(xtn->gbl_mpi); i++) - { - if (xtn->gbl_mpi[i] <= -1) - { - qse_awk_close (awk); - return QSE_NULL; - } - } - - if (add_functions (awk) <= -1) - { - qse_awk_close (awk); - return QSE_NULL; - } - } - - return awk; -} - -void* qse_awk_getxtnmpi (qse_awk_t* awk) -{ - return (void*)((xtn_t*)qse_awk_getxtnstd(awk) + 1); -} - -int qse_awk_parsempi ( - qse_awk_t* awk, qse_awk_parsempi_t* in, qse_awk_parsempi_t* out) -{ - return qse_awk_parsestd (awk, in, out); -} - -qse_awk_rtx_t* qse_awk_rtx_openmpi ( - qse_awk_t* awk, - qse_size_t xtnsize, - const qse_char_t* id, - const qse_char_t*const icf[], - const qse_char_t*const ocf[], - qse_cmgr_t* cmgr) -{ - qse_awk_rtx_t* rtx; - - rtx = qse_awk_rtx_openstd ( - awk, QSE_SIZEOF(rxtn_t) + xtnsize, id, icf, ocf, cmgr); - if (rtx) - { - xtn_t* xtn; - rxtn_t* rxtn; - qse_size_t i; - - xtn = (xtn_t*) qse_awk_getxtnstd (awk); - rxtn = (rxtn_t*) qse_awk_rtx_getxtnstd (rtx); - - QSE_MEMSET (rxtn, 0, QSE_SIZEOF(*rxtn)); - rxtn->comm = MPI_COMM_WORLD; - - /* set the value of some MPI constants */ - for (i = 0; i < QSE_COUNTOF(xtn->gbl_mpi); i++) - { - int iv; - qse_awk_val_t* v_tmp; - - switch (i) - { - case 0: /* MPI_HOST */ - { - char buf[MPI_MAX_PROCESSOR_NAME]; - qse_mcstr_t mcstr; - - if (MPI_Get_processor_name(buf, &mcstr.len) != MPI_SUCCESS) - { - qse_awk_rtx_close (rtx); - qse_awk_seterrnum (awk, QSE_AWK_ESYSERR, QSE_NULL); - return QSE_NULL; - } - - mcstr.ptr = buf; - v_tmp = qse_awk_rtx_makestrvalwithmcstr (rtx, &mcstr); - break; - } - - case 1: /* MPI_SIZE */ - if (MPI_Comm_size (rxtn->comm, &rxtn->size) != MPI_SUCCESS) - { - qse_awk_rtx_close (rtx); - qse_awk_seterrnum (awk, QSE_AWK_ESYSERR, QSE_NULL); - return QSE_NULL; - } - v_tmp = qse_awk_rtx_makeintval (rtx, rxtn->size); - break; - - case 2: /* MPI_RANK */ - if (MPI_Comm_rank (rxtn->comm, &rxtn->rank) != MPI_SUCCESS) - { - qse_awk_rtx_close (rtx); - qse_awk_seterrnum (awk, QSE_AWK_ESYSERR, QSE_NULL); - return QSE_NULL; - } - v_tmp = qse_awk_rtx_makeintval (rtx, rxtn->rank); - break; - - default: /* MPI_REDUCE_XXXX */ - v_tmp = qse_awk_rtx_makeintval (rtx, i - 3); - break; - } - - if (v_tmp == QSE_NULL) - { - qse_awk_rtx_close (rtx); - return QSE_NULL; - } - - qse_awk_rtx_refupval (rtx, v_tmp); - qse_awk_rtx_setgbl (rtx, xtn->gbl_mpi[i], v_tmp); - qse_awk_rtx_refdownval (rtx, v_tmp); - } - } - - return rtx; -} - -void* qse_awk_rtx_getxtnmpi (qse_awk_rtx_t* rtx) -{ - return (void*)((rxtn_t*)qse_awk_rtx_getxtnstd(rtx) + 1); -} - -qse_cmgr_t* qse_awk_rtx_getcmgrmpi ( - qse_awk_rtx_t* rtx, const qse_char_t* ioname) -{ - return qse_awk_rtx_getcmgrstd (rtx, ioname); -} - -static int fnc_hash (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi) -{ - qse_size_t nargs; - qse_awk_val_t* tmp, * a0; - qse_long_t hv; - - nargs = qse_awk_rtx_getnargs (rtx); - QSE_ASSERT (nargs == 1); - - a0 = qse_awk_rtx_getarg (rtx, 0); - - hv = qse_awk_rtx_hashval (rtx, a0); - - tmp = qse_awk_rtx_makeintval (rtx, hv); - - if (tmp == QSE_NULL) return -1; - qse_awk_rtx_setretval (rtx, tmp); - - return 0; -} - -static int fnc_assign (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi) -{ - qse_size_t nargs; - qse_awk_val_t* tmp, * a0; - qse_long_t lv; - rxtn_t* rxtn; - qse_awk_nrflt_t nrflt; - - rxtn = (rxtn_t*) qse_awk_rtx_getxtnstd (rtx); - - nargs = qse_awk_rtx_getnargs (rtx); - QSE_ASSERT (nargs == 1); - - a0 = qse_awk_rtx_getarg (rtx, 0); - - if (qse_awk_rtx_valtolong (rtx, a0, &lv) <= -1) return -1; - - tmp = qse_awk_rtx_makeintval (rtx, lv); - - nrflt.limit = lv; - nrflt.size = rxtn->size; - nrflt.rank = rxtn->rank; - qse_awk_rtx_setnrflt (rtx, &nrflt); - - if (tmp == QSE_NULL) return -1; - qse_awk_rtx_setretval (rtx, tmp); - - return 0; -} - -static int fnc_reduce (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi) -{ - qse_size_t nargs; - qse_awk_val_t* tmp, * a0, * a1; - qse_long_t opidx, lv; - qse_flt_t rv; - int n; - rxtn_t* rxtn; - - static MPI_Op optab[] = - { - MPI_MIN, - MPI_MAX, - MPI_SUM, - MPI_PROD, - MPI_LAND, - MPI_LOR - }; - - rxtn = (rxtn_t*) qse_awk_rtx_getxtnstd (rtx); - - nargs = qse_awk_rtx_getnargs (rtx); - QSE_ASSERT (nargs == 2); - - a0 = qse_awk_rtx_getarg (rtx, 0); - a1 = qse_awk_rtx_getarg (rtx, 1); - - if (qse_awk_rtx_valtolong (rtx, a1, &opidx) <= -1) return -1; - if (opidx < 0 || opidx >= QSE_COUNTOF(optab)) goto softfail; - if ((n = qse_awk_rtx_valtonum (rtx, a0, &lv, &rv)) <= -1) return -1; - -/* TODO: determine it to be MPI_LONG or MPI_INT, OR MPI_LONG_LONG_INT depending on the size of qse_long_t */ -/* TODO: how to tell normal -1 from the soft failure??? */ - if (n == 0) - { - qse_long_t lout; - if (MPI_Allreduce (&lv, &lout, 1, MPI_LONG_LONG_INT, optab[opidx], rxtn->comm) != MPI_SUCCESS) goto softfail; - tmp = qse_awk_rtx_makeintval (rtx, lout); - } - else - { - qse_flt_t fout; - if (MPI_Allreduce (&rv, &fout, 1, MPI_LONG_DOUBLE, optab[opidx], rxtn->comm) != MPI_SUCCESS) goto softfail; - tmp = qse_awk_rtx_makefltval (rtx, fout); - } - - if (tmp == QSE_NULL) return -1; - qse_awk_rtx_setretval (rtx, tmp); - - return 0; - -softfail: - tmp = qse_awk_rtx_makeintval (rtx, (qse_long_t)-1); - if (tmp == QSE_NULL) return -1; - qse_awk_rtx_setretval (rtx, tmp); - return 0; -} - -static int fnc_barrier (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi) -{ - int x; - qse_awk_val_t* tmp; - rxtn_t* rxtn; - - rxtn = (rxtn_t*) qse_awk_rtx_getxtnstd (rtx); - - x = (MPI_Barrier (rxtn->comm) == MPI_SUCCESS)? 0: -1; - - tmp = qse_awk_rtx_makeintval (rtx, x); - if (tmp == QSE_NULL) return -1; - qse_awk_rtx_setretval (rtx, tmp); - return 0; -} - -static int add_functions (qse_awk_t* awk) -{ - if (qse_awk_addfnc (awk, QSE_T("mpi_hash"), 8, 0, 1, 1, QSE_NULL, fnc_hash) == QSE_NULL) return -1; - if (qse_awk_addfnc (awk, QSE_T("mpi_assign"), 10, 0, 1, 1, QSE_NULL, fnc_assign) == QSE_NULL) return -1; - if (qse_awk_addfnc (awk, QSE_T("mpi_reduce"), 10, 0, 2, 2, QSE_NULL, fnc_reduce) == QSE_NULL) return -1; - if (qse_awk_addfnc (awk, QSE_T("mpi_barrier"), 11, 0, 0, 0, QSE_NULL, fnc_barrier) == QSE_NULL) return -1; - return 0; -} diff --git a/qse/lib/net/httpd-cgi.c b/qse/lib/net/httpd-cgi.c index dda168fb..4b90fb52 100644 --- a/qse/lib/net/httpd-cgi.c +++ b/qse/lib/net/httpd-cgi.c @@ -443,7 +443,12 @@ static int cgi_add_env ( qse_env_insertmbs (env, QSE_MT("DOCUMENT_ROOT"), docroot); if (suffix && suffix[0] != QSE_MT('\0')) { - const qse_mchar_t* tmp[3] = { docroot, suffix, QSE_NULL}; + const qse_mchar_t* tmp[3]; + + tmp[0] = docroot; + tmp[1] = suffix; + tmp[2] = QSE_NULL; + qse_env_insertmbs (env, QSE_MT("PATH_INFO"), suffix); qse_env_insertmbsa (env, QSE_MT("PATH_TRANSLATED"), tmp); } diff --git a/qse/lib/net/httpd-std.c b/qse/lib/net/httpd-std.c index 20f16525..120a6f97 100644 --- a/qse/lib/net/httpd-std.c +++ b/qse/lib/net/httpd-std.c @@ -591,11 +591,13 @@ IP_TRANSPRENT is needed for: len = qse_nwifindextombs (server->nwif, tmp, QSE_COUNTOF(tmp)); +#if defined(SO_BINDTODEVICE) if (len <= 0 || setsockopt (fd, SOL_SOCKET, SO_BINDTODEVICE, tmp, len) <= -1) { /* TODO: logging ... */ goto oops; } +#endif } /* Solaris 8 returns EINVAL if QSE_SIZEOF(addr) is passed in as the diff --git a/qse/lib/net/httpd.h b/qse/lib/net/httpd.h index ff1d41de..b2089158 100644 --- a/qse/lib/net/httpd.h +++ b/qse/lib/net/httpd.h @@ -142,7 +142,7 @@ qse_httpd_task_t* qse_httpd_entask_text ( qse_httpd_client_t* client, qse_httpd_task_t* pred, const qse_mchar_t* ptr, - qse_size_t len; + qse_size_t len ); #ifdef __cplusplus