Get rid of Sun, KSR, Delta, Paragon, and SP definitions.

--- src/config/makefile.h
+++ src/config/makefile.h
@@ -1,5 +1,5 @@
 #
-# $Id: makefile.h,v 1.341 2000-11-04 02:55:17 edo Exp $
+# $Id: makefile.h,v 1.342 2000-11-08 00:25:07 windus Exp $
 #

 # Common definitions for all makefiles ... these can be overridden
@@ -42,23 +42,17 @@
 #                  CRAY-T3E
 #                  CYGNUS       (Windows under Cygwin tools)
 #                  DECOSF
-#                  DELTA
 #                  IBM
-#                  KSR
 #                  LINUX        NWCHEM_TARGET_CPU :
 #                                                  nothing for X86 (e.g. do not set this)
 #                                                  ALPHA for AlphaLinux (broke)
 #                                                  POWERPC for MkLinux
-#                  PARAGON
 #                  SGI
 #                  SGI_N32      NWCHEM_TARGET_CPU : R8000 or R10000
 #                  SGITFP       NWCHEM_TARGET_CPU : R8000 or R10000
 #                  SOLARIS      NWCHEM_TARGET_CPU : not defined or ULTRA
-#                  SP           NWCHEM_TARGET_CPU : P2SC
-#                      (uses non-thread safe libraries and MPL)
-#                  LAPI      NWCHEM_TARGET_CPU : P2SC
+#                  LAPI         NWCHEM_TARGET_CPU : P2SC
 #                      (uses thread safe libraries and LAPI)
-#                  SUN
 #
 # Note that the preprocessor flags for CRAY-T3D and CRAY-T3E are CRAY_T3D and CRAY_T3E respectively
 #
@@ -67,14 +61,10 @@
 error2:
 	@echo You must define NWCHEM_TARGET in your environment to be the name
 	@echo of the machine you wish to build for ... for example
-	@echo     setenv NWCHEM_TARGET SUN
-	@echo Known targets are SUN, DELTA, ...
+	@echo     setenv NWCHEM_TARGET SOLARIS
+	@echo Known targets are SOLARIS, SGI_N32, ...
+	@echo See the INSTALL instructions for a complete list
 	@exit 1
-endif
-
-#JN SP1 name is obsolete
-ifeq ($(NWCHEM_TARGET),SP1)
-    NWCHEM_TARGET = SP
 endif

      TARGET := $(NWCHEM_TARGET)
@@ -160,8 +150,6 @@
 # a new machine or changing compiler options             #
 #                                                        #
 ##########################################################
-
-# Only the SUN, SGI, KSR, PARAGON, DELTA and IBM versions are up to date

 # Each machine dependent section should define the following as necessary.
 # (defaults if any in parentheses)
@@ -234,7 +222,6 @@
 # platforms:
 #
 #        NWCHEM_TARGET                NWCHEM_TARGET_CPU
-#           SP                           P2SC
 #           LAPI                         P2SC
 #           SGITFP                       R10000/R8000
 #           SGI_N32                      R10000/R8000
@@ -262,30 +249,6 @@
 #
 # Machine specific stuff
 #
-
-ifeq ($(TARGET),SUN)
-#
-# Sun running SunOS
-#
-
-       NICE = nice
-      SHELL := $(NICE) /bin/sh
-    CORE_SUBDIRS_EXTRA = blas lapack
-         CC = gcc
-     RANLIB = ranlib
-  MAKEFLAGS = -j 1 --no-print-directory
-    INSTALL = @echo $@ is built
-
-   FOPTIONS = -Nl199 -fast -dalign
-   COPTIONS = -Wall
-# -O4 breaks at least inp_* and seems no faster than -O3
-  FOPTIMIZE = -O3
-  COPTIMIZE = -g -O2
-
-    DEFINES = -DSUN
-
-    CORE_LIBS +=   -llapack $(BLASOPT) -lblas
-endif

 ifeq ($(TARGET),SOLARIS)
       SHELL := $(NICE) /bin/sh
@@ -327,7 +290,7 @@
   LDOPTIONS = -xildoff
   LINK.f = $(FC) $(LDFLAGS) $(FOPTIONS)
   CORE_LIBS +=  -xlic_lib=sunperf -lmvec
-#-llapack -lblas
+#-llapack -$(BLASOPT) -lblas

       EXTRA_LIBS = -ldl

@@ -525,100 +488,6 @@
       EXPLICITF     = TRUE
 endif

-ifeq ($(TARGET),KSR)
-#
-# KSR running OSF
-#
-# JN 96/10/02:
-# Replaced -DLongInteger with -DEXT_INT for consistency with GA, DRA, PEIGS ...
-
-	CPP = /usr/lib/cpp -P -C
-    CORE_SUBDIRS_EXTRA = blas
-     RANLIB = echo
-  MAKEFLAGS = -j 10 --no-print-directory
-    INSTALL = @echo $@ is built
-
-   FOPTIONS = -r8
-   COPTIONS =
-  FOPTIMIZE = -xfpu3 -O1
-  COPTIMIZE = -xfpu3 -O1
-
-    DEFINES = -DKSR -DPARALLEL_DIAG -DEXT_INT
-
-#       LIBPATH += -L/home/d3g681/TCGMSG_DISTRIB
-        LIBPATH += -L/home2/d3g270/peigs1.1.1 -L/home/d3g681/TCGMSG_DISTRIB
-       CORE_LIBS += -lksrlapk -lksrblas -llapack2 -lblas2
-      EXTRA_LIBS = -para -lrpc
-endif
-
-ifeq ($(TARGET),PARAGON)
-#
-# Intel Paragon running OSF
-# (native build, or cross-compiled -- the latter is faster in most cases)
-#
-    CORE_SUBDIRS_EXTRA = lapack
-
-         FC = if77
-         CC = icc
-         AR = ar860
-     RANLIB = echo
-	CPP = /usr/lib/cpp -P -C
-
-  MAKEFLAGS = -j 4  --no-print-directory
-    INSTALL = @echo $@ is built
-
-  FOPTIONS = -Knoieee
-  COPTIONS = -Knoieee
- FOPTIMIZE = -O2 -Minline=1000
-FVECTORIZE = -O2 -Minline=1000 # -Mvect
- COPTIMIZE = -O2
-
-#
-# __PARAGON__ is defined by the PGI cpp, but NOT when it is invoked by
-# the f77 comiler!!!
-#
-# Do NOT define -DNX or -DIPSC for paragon -- they get into some code for
-# real iPSC and Delta that is not applicable to the paragon, which is more
-# unixy since it runs OSF/1.
-#
-    DEFINES = -D__PARAGON__ -DPARALLEL_DIAG
-    ARFLAGS = ru
-
-# CAUTION: PGI's linker thinks of -L as adding to the _beginning_ of the
-# search path -- contrary to usual unix usage!!!!!
-       LIBPATH  += -L/home/delilah11/gifann/lib
-       CORE_LIBS +=  -llapack $(LIBDIR)/liblapack.a -lkmath
-      EXTRA_LIBS = -nx
-endif
-
-ifeq ($(TARGET),DELTA)
-#
-# DELTA/IPSC running NX
-#
-    CORE_SUBDIRS_EXTRA = lapack blas # -lkamth not reliable
-# blas
-        FC = if77
-        CC = icc
-       CPP = /usr/lib/cpp
-        AR = ar860
-    RANLIB = echo
-
-   INSTALL = "strip860 $(BINDIR)/nwchem; rcp $(BINDIR)/nwchem delta1:"
- MAKEFLAGS = -j 2  --no-print-directory
-
-  FOPTIONS = -Knoieee
-  COPTIONS = -Knoieee
- FOPTIMIZE = -O2 		# -Minline=1000 ## Inlining bombs for dtrtri.f
-FVECTORIZE = -O4 		# -Mvect corrupts lapack for large vectors
- COPTIMIZE = -O2
-
-   DEFINES = -DNX -DDELTA -DIPSC -DNO_BCOPY  -D__IPSC__ -DPARALLEL_DIAG
-        LIBPATH += -L/home/delilah11/gifann/lib
-       CORE_LIBS += $(LIBDIR)/liblapack.a -llapack -lblas
-      EXTRA_LIBS = -node
-endif
-
-
 ifeq ($(TARGET),SGITFP)
 #
 # SGI power challenge
@@ -852,6 +721,7 @@
  DEFINES = -DHPUX -DEXTNAME -DPARALLEL_DIAG

 endif
+
 ifeq ($(TARGET),HPUX64)
 #
 # HPUX 11.0
@@ -1002,6 +872,7 @@
   FCONVERT = $(CPP) $(CPPFLAGS) $< > $*.f
 #
 endif
+
 ifeq ($(TARGET),IBM64)
 #
 # IBM AIX 64-bit
@@ -1033,115 +904,6 @@
   FCONVERT = $(CPP) $(CPPFLAGS) $< > $*.f
 #
 endif
-
-
-ifeq ($(TARGET),SP)
-#
-     OLD_GA = y
-    CORE_SUBDIRS_EXTRA = lapack blas
-         FC = mpxlf -qnohpf
-# -F/u/d3g681/xlhpf.cfg:rjhxlf
-         CC = mpcc
-    ARFLAGS = urs
-     RANLIB = echo
-  MAKEFLAGS = -j 1 --no-print-directory
-    INSTALL = @echo $@ is built
-        CPP = /usr/lib/cpp -P
-
-LARGE_FILES = YES
-
-  LDOPTIONS = -lc -lm -qEXTNAME -qnosave -g -bmaxdata:0x20000000 -bloadmap:nwchem_map
-ifeq ($(NWCHEM_TARGET_CPU),604)
-  LDOPTIONS = -lxlf90 -lm -qEXTNAME -qnosave -g -bmaxdata:0x20000000 -bloadmap:nwchem_map
-endif
-
-   LINK.f   = mpxlf -qnohpf $(LDFLAGS)
-   FOPTIONS = -qEXTNAME -qnosave -qalign=4k
-# -qinitauto=7F # note that grad_force breaks with this option
-   COPTIONS =
-  FOPTIMIZE = -O3 -qstrict -qfloat=rsqrt:fltint -NQ40000 -NT80000
-  COPTIMIZE = -O
-ifeq ($(NWCHEM_TARGET_CPU),604)
-  FOPTIMIZE += -qarch=604
-  COPTIMIZE += -qarch=ppc
-endif
-
-ifeq ($(NWCHEM_TARGET_CPU),P2SC)
-# These from George from Kent Winchell
-  FOPTIMIZE += -qcache=type=d:level=1:size=128:line=256:assoc=4:cost=14 \
-        -qcache=type=i:level=1:size=32:line=128
-  COPTIMIZE += -qcache=type=d:level=1:size=128:line=256:assoc=4:cost=14 \
-        -qcache=type=i:level=1:size=32:line=128
-endif
-
-    DEFINES = -DSP1 -DAIX -DEXTNAME -DPARALLEL_DIAG
-#
-# Prefix LIBPATH with -L/usr/lib for AIX 3.2.x
-#
-#  LIBPATH += -L/sphome/harrison/peigs2.0
-
-  CORE_LIBS += -llapack $(BLASOPT) -lblas
-
-
-#   USE_ESSL = YES
-#   USE_BLAS = YES
-ifdef USE_ESSL
-   DEFINES += -DESSL
-# renames not needed for 4.1.  Still are for 3.2.
-ifeq ($(NWCHEM_TARGET_CPU),P2SC)
- CORE_LIBS += -lesslp2 -lpesslp2 -lblacsp2
-else
-CORE_LIBS += -lessl -lpessl -lblacs
-endif
-
-#	      -brename:.daxpy_,.daxpy \
-#	      -brename:.dgesv_,.dgesv \
-#	      -brename:.dcopy_,.dcopy \
-#	      -brename:.ddot_,.ddot \
-#	      -brename:.dgemm_,.dgemm \
-#	      -brename:.dgemv_,.dgemv \
-#	      -brename:.dgetrf_,.dgetrf \
-#	      -brename:.dgetrs_,.dgetrs \
-#	      -brename:.dscal_,.dscal \
-#	      -brename:.dspsvx_,.dspsvx \
-#	      -brename:.dpotrf_,.dpotrf \
-#	      -brename:.dpotri_,.dpotri \
-#	      -brename:.idamax_,.idamax
-ifdef USE_BLAS
- CORE_LIBS += -lblas -brename:.xerbla_,.xerbla -brename:.lsame_,.lsame
-endif
-
-else
-    CORE_SUBDIRS_EXTRA += blas
-             CORE_LIBS += -lblas
-endif
-
-
-# IMPORTANT:  These renames are necessary if you try to link against
-# a copy of PeIGS built for MPI instead of TCGMSG. (Not recommended,
-# see INSTALL...this is because of possible incompatibilities of C and fortran
-# underscore symbols and seems to be a problem with older peigs versions... )
-# mpipriv is a common block used in MPICH's implementation of MPI.  It
-# is critical that this common block is renamed correctly because
-# the linker will not detect any problems (there will be separate
-# common blocks labeled mpipriv_ and mpipriv) but the program will not
-# operate correctly.
-#ifdef USE_MPI
-#   CORE_LIBS += -brename:.mpi_recv_,.mpi_recv \
-#		-brename:.mpi_initialized_,.mpi_initialized \
-#		-brename:.mpi_init_,.mpi_init \
-#		-brename:.mpi_comm_rank_,.mpi_comm_rank \
-#		-brename:.mpi_comm_size_,.mpi_comm_size \
-#		-brename:.mpi_finalize_,.mpi_finalize \
-#		-brename:.mpi_send_,.mpi_send \
-#		-brename:mpipriv_,mpipriv
-#endif
-
- EXPLICITF = TRUE
-  FCONVERT = $(CPP) $(CPPFLAGS) $< > $*.f
-#
-endif
-

 ifeq ($(TARGET),LAPI)
 #
@@ -1395,6 +1157,7 @@
   FVECTORIZE = -fast -O5 -tune host -arch host
   CORE_LIBS = -llapack $(BLASOPT) -lblas
 endif
+
 ifeq ($(TARGET),FUJITSU_VPP)
 #
 # FUJITSU VX/VPP


Remove outdated Itanium1 flag

Remove outdated Itanium1 flag

--- src/config/makefile.h
+++ src/config/makefile.h
@@ -1,5 +1,5 @@

-# $Id: makefile.h,v 1.544 2007-05-23 16:50:55 d3p307 Exp $
+# $Id: makefile.h,v 1.545 2007-08-17 22:33:59 d3p852 Exp $
 #

 # Common definitions for all makefiles ... these can be overridden
@@ -1597,7 +1597,7 @@
          FOPTIONS+= -align
        endif
         DEFINES  +=   -DIFCLINUX
-        FVECTORIZE =  -noalign -O3 -pad  -mP2OPT_hlo_level=2  -tpp1
+        FVECTORIZE =  -noalign -O3 -pad  -mP2OPT_hlo_level=2
         FOPTIMIZE =  -O3 -pad -mP2OPT_hlo_level=2  #-mP2OPT_align_array_to_cache_line=TRUE
        ifeq ($(_IFCV81),Y)
 #         FOPTIMIZE+= -IPF_fp_relaxed # breaks nwdft/xc/xc_pw91lda


got rid of maxdata in LAPI64

got rid of maxdata in LAPI64

--- src/config/makefile.h
+++ src/config/makefile.h
@@ -1,5 +1,5 @@
 #
-# $Id: makefile.h,v 1.412 2003-05-14 17:24:37 edo Exp $
+# $Id: makefile.h,v 1.413 2003-05-15 02:00:04 edo Exp $
 #

 # Common definitions for all makefiles ... these can be overridden
@@ -1070,8 +1070,7 @@
      MPILIB =
 LARGE_FILES = YES

-#  LDOPTIONS = -lc_r -lxlf90_r -lm_r -qEXTNAME -qnosave -q64 -g -bmaxdata:0x60000000 -bloadmap:nwchem.lapi64_map
-  LDOPTIONS = -lc_r -lxlf90_r -lm_r -qEXTNAME -qnosave -q64 -bmaxdata:0x60000000 -bloadmap:nwchem.lapi64_map $(LAPI64LIBS)
+  LDOPTIONS = -lc_r -lxlf90_r -lm_r -qEXTNAME -qnosave -q64  -bloadmap:nwchem.lapi64_map $(LAPI64LIBS)
    LINK.f   = mpcc_r   $(LDFLAGS)

    FOPTIONS = -qEXTNAME -qnosave -q64 -qalign=4k


[core] save pcre result state in config_pcre_match

rename data_config_pcre_exec() to config_pcre_match()
  and move logic saving pcre result state from
  config_check_cond_nocache()

split config_check_cond_nocache() into two funcs
  config_check_cond_nocache() participates in recursion
  config_check_cond_nocache_eval() evaluates the condition

--- src/configfile-glue.c
+++ src/configfile-glue.c
@@ -393,7 +393,9 @@
     return config_check_cond_nocache_calc(r, dc, debug_cond, cache);
 }

-static int data_config_pcre_exec(const data_config *dc, cond_cache_t *cache, const buffer *b, cond_match_t *cond_match);
+static int config_pcre_match(request_st *r, const data_config *dc, const buffer *b);
+
+static cond_result_t config_check_cond_nocache_eval(request_st * const r, const data_config * const dc, const int debug_cond, cond_cache_t * const cache);

 static cond_result_t config_check_cond_nocache(request_st * const r, const data_config * const dc, const int debug_cond, cond_cache_t * const cache) {
 	/* check parent first */
@@ -467,6 +469,10 @@
 		return (cache->local_result = COND_RESULT_TRUE);
 		/* remember result of local condition for a partial reset */

+	return config_check_cond_nocache_eval(r, dc, debug_cond, cache);
+}
+
+static cond_result_t config_check_cond_nocache_eval(request_st * const r, const data_config * const dc, const int debug_cond, cond_cache_t * const cache) {
 	/* pass the rules */

 	static struct const_char_buffer {
@@ -549,15 +555,13 @@
 		match ^= (buffer_is_equal(l, &dc->string));
 		break;
 	case CONFIG_COND_NOMATCH:
-	case CONFIG_COND_MATCH: {
-		cond_match_t * const cond_match =
-			r->cond_match[dc->capture_idx] = r->cond_match_data+dc->capture_idx;
+	case CONFIG_COND_MATCH:
 		match = (dc->cond == CONFIG_COND_MATCH);
-		match ^= (data_config_pcre_exec(dc, cache, l, cond_match) > 0);
-		break;
-	}
+		match ^= (config_pcre_match(r, dc, l) > 0);
+		break;
 	default:
 		match = 1; /* return (cache->local_result = COND_RESULT_FALSE); below */
+		break;
 	}
 	/* remember result of local condition for a partial reset */
 	cache->local_result = match ? COND_RESULT_FALSE : COND_RESULT_TRUE;
@@ -636,22 +640,25 @@
 #include <pcre.h>
 #endif

-static int data_config_pcre_exec(const data_config *dc, cond_cache_t *cache, const buffer *b, cond_match_t *cond_match) {
+static int config_pcre_match(request_st * const r, const data_config * const dc, const buffer * const b) {
 #ifdef HAVE_PCRE_H
     #ifndef elementsof
     #define elementsof(x) (sizeof(x) / sizeof(x[0]))
     #endif
+    cond_match_t * const cond_match =
+      r->cond_match[dc->capture_idx] = r->cond_match_data + dc->capture_idx;
+    cond_match->comp_value = b; /*holds pointer to b (!) for pattern subst*/
+    /* Note: patterncount is in cond_cache_t instead of cond_match_t only
+     * so that both structures are sized power-2 for efficient array access */
+    cond_cache_t * const cache = &r->cond_cache[dc->context_ndx];
     cache->patterncount =
       pcre_exec(dc->regex, dc->regex_study, BUF_PTR_LEN(b), 0, 0,
                 cond_match->matches, elementsof(cond_match->matches));
-    if (cache->patterncount > 0)
-        cond_match->comp_value = b; /*holds pointer to b (!) for pattern subst*/
     return cache->patterncount;
 #else
+    UNUSED(r);
     UNUSED(dc);
-    UNUSED(cache);
     UNUSED(b);
-    UNUSED(cond_match);
     return 0;
 #endif
 }


ipaccess: fix leak of IPA control messages in the BTS side

--- src/input/ipaccess.c
+++ src/input/ipaccess.c
@@ -855,6 +855,7 @@
 			}
 			msgb_free(rmsg);
 		}
+		msgb_free(msg);
 		return ret;
 	} else if (link->port == IPA_TCP_PORT_OML)
 		e1i_ts = &link->line->ts[0];


Further refactoring of MatrixFunction<MatrixType, 1> * move some data to member variables * split and/or rename member functions * document all members

--- unsupported/Eigen/src/MatrixFunctions/MatrixFunction.h
+++ unsupported/Eigen/src/MatrixFunctions/MatrixFunction.h
@@ -116,8 +116,7 @@

 /** \ingroup MatrixFunctions_Module
-  * \brief Partial specialization of MatrixFunction for real matrices.
-  * \internal
+  * \brief Partial specialization of MatrixFunction for real matrices \internal
   */
 template <typename MatrixType>
 class MatrixFunction<MatrixType, 0>
@@ -159,8 +158,7 @@

 /** \ingroup MatrixFunctions_Module
-  * \brief Partial specialization of MatrixFunction for complex matrices
-  * \internal
+  * \brief Partial specialization of MatrixFunction for complex matrices \internal
   */
 template <typename MatrixType>
 class MatrixFunction<MatrixType, 1>
@@ -176,8 +174,8 @@
     typedef typename ei_stem_function<Scalar>::type StemFunction;
     typedef Matrix<Scalar, Traits::RowsAtCompileTime, 1> VectorType;
     typedef Matrix<int, Traits::RowsAtCompileTime, 1> IntVectorType;
-    typedef std::list<Scalar> listOfScalars;
-    typedef std::list<listOfScalars> listOfLists;
+    typedef std::list<Scalar> Cluster;
+    typedef std::list<Cluster> ListOfClusters;
     typedef Matrix<Scalar, Dynamic, Dynamic, Options, RowsAtCompileTime, ColsAtCompileTime> DynMatrixType;

   public:
@@ -192,59 +190,173 @@

   private:

-    // Prevent copying
-    MatrixFunction(const MatrixFunction&);
-    MatrixFunction& operator=(const MatrixFunction&);
-
-    void separateBlocksInSchur(MatrixType& T, MatrixType& U, VectorXi& blockSize);
-    void permuteSchur(const IntVectorType& permutation, MatrixType& T, MatrixType& U);
-    void swapEntriesInSchur(int index, MatrixType& T, MatrixType& U);
-    void computeTriangular(const MatrixType& T, MatrixType& result, const VectorXi& blockSize);
-    void computeBlockAtomic(const MatrixType& T, MatrixType& result, const VectorXi& blockSize);
+    void computeSchurDecomposition(const MatrixType& A);
+    void partitionEigenvalues();
+    typename ListOfClusters::iterator findCluster(Scalar key);
+    void computeClusterSize();
+    void computeBlockStart();
+    void constructPermutation();
+    void permuteSchur();
+    void swapEntriesInSchur(int index);
+    void computeBlockAtomic();
+    Block<MatrixType> block(const MatrixType& A, int i, int j);
+    void computeOffDiagonal();
     DynMatrixType solveTriangularSylvester(const DynMatrixType& A, const DynMatrixType& B, const DynMatrixType& C);
-    void divideInBlocks(const VectorType& v, listOfLists* result);
-    void constructPermutation(const VectorType& diag, const listOfLists& blocks,
-			      VectorXi& blockSize, IntVectorType& permutation);
-
+
+    StemFunction *m_f; /**< \brief Stem function for matrix function under consideration */
+    MatrixType m_T; /**< \brief Triangular part of Schur decomposition */
+    MatrixType m_U; /**< \brief Unitary part of Schur decomposition */
+    MatrixType m_fT; /**< \brief %Matrix function applied to #m_T */
+    ListOfClusters m_clusters; /**< \brief Partition of eigenvalues into clusters of ei'vals "close" to each other */
+    VectorXi m_eivalToCluster; /**< \brief m_eivalToCluster[i] = j means i-th ei'val is in j-th cluster */
+    VectorXi m_clusterSize; /**< \brief Number of eigenvalues in each clusters  */
+    VectorXi m_blockStart; /**< \brief Row index at which block corresponding to i-th cluster starts */
+    IntVectorType m_permutation; /**< \brief Permutation which groups ei'vals in the same cluster together */
+
+    /** \brief Maximum distance allowed between eigenvalues to be considered "close".
+      *
+      * This is morally a \c static \c const \c Scalar, but only
+      * integers can be static constant class members in C++. The
+      * separation constant is set to 0.01, a value taken from the
+      * paper by Davies and Higham. */
     static const RealScalar separation() { return static_cast<RealScalar>(0.01); }
-    StemFunction *m_f;
 };

 template <typename MatrixType>
 MatrixFunction<MatrixType,1>::MatrixFunction(const MatrixType& A, StemFunction f, MatrixType* result) :
   m_f(f)
 {
-  if (A.rows() == 1) {
-    result->resize(1,1);
-    (*result)(0,0) = f(A(0,0), 0);
-  } else {
-    const ComplexSchur<MatrixType> schurOfA(A);
-    MatrixType T = schurOfA.matrixT();
-    MatrixType U = schurOfA.matrixU();
-    VectorXi blockSize;
-    separateBlocksInSchur(T, U, blockSize);
-    MatrixType fT;
-    computeTriangular(T, fT, blockSize);
-    *result = U * fT * U.adjoint();
-  }
-}
-
-template <typename MatrixType>
-void MatrixFunction<MatrixType,1>::separateBlocksInSchur(MatrixType& T, MatrixType& U, VectorXi& blockSize)
-{
-  const VectorType d = T.diagonal();
-  listOfLists blocks;
-  divideInBlocks(d, &blocks);
-
-  IntVectorType permutation;
-  constructPermutation(d, blocks, blockSize, permutation);
-  permuteSchur(permutation, T, U);
-}
-
-template <typename MatrixType>
-void MatrixFunction<MatrixType,1>::permuteSchur(const IntVectorType& permutation, MatrixType& T, MatrixType& U)
-{
-  IntVectorType p = permutation;
+  computeSchurDecomposition(A);
+  partitionEigenvalues();
+  computeClusterSize();
+  computeBlockStart();
+  constructPermutation();
+  permuteSchur();
+  computeBlockAtomic();
+  computeOffDiagonal();
+  *result = m_U * m_fT * m_U.adjoint();
+}
+
+/** \brief Store the Schur decomposition of \p A in #m_T and #m_U */
+template <typename MatrixType>
+void MatrixFunction<MatrixType,1>::computeSchurDecomposition(const MatrixType& A)
+{
+  const ComplexSchur<MatrixType> schurOfA(A);
+  m_T = schurOfA.matrixT();
+  m_U = schurOfA.matrixU();
+}
+
+/** \brief Partition eigenvalues in clusters of ei'vals close to each other
+  *
+  * This function computes #m_clusters. This is a partition of the
+  * eigenvalues of #m_T in clusters, such that
+  * # Any eigenvalue in a certain cluster is at most separation() away
+  *   from another eigenvalue in the same cluster.
+  * # The distance between two eigenvalues in different clusters is
+  *   more than separation().
+  * The implementation follows Algorithm 4.1 in the paper of Davies
+  * and Higham.
+  */
+template <typename MatrixType>
+void MatrixFunction<MatrixType,1>::partitionEigenvalues()
+{
+  const int rows = m_T.rows();
+  VectorType diag = m_T.diagonal(); // contains eigenvalues of A
+
+  for (int i=0; i<rows; ++i) {
+    // Find set containing diag(i), adding a new set if necessary
+    typename ListOfClusters::iterator qi = findCluster(diag(i));
+    if (qi == m_clusters.end()) {
+      Cluster l;
+      l.push_back(diag(i));
+      m_clusters.push_back(l);
+      qi = m_clusters.end();
+      --qi;
+    }
+
+    // Look for other element to add to the set
+    for (int j=i+1; j<rows; ++j) {
+      if (ei_abs(diag(j) - diag(i)) <= separation() && std::find(qi->begin(), qi->end(), diag(j)) == qi->end()) {
+	typename ListOfClusters::iterator qj = findCluster(diag(j));
+	if (qj == m_clusters.end()) {
+	  qi->push_back(diag(j));
+	} else {
+	  qi->insert(qi->end(), qj->begin(), qj->end());
+	  m_clusters.erase(qj);
+	}
+      }
+    }
+  }
+}
+
+/** \brief Find cluster in #m_clusters containing some value
+  * \param[in] key Value to find
+  * \returns Iterator to cluster containing \c key, or
+  * \c m_clusters.end() if no cluster in m_clusters contains \c key.
+  */
+template <typename MatrixType>
+typename MatrixFunction<MatrixType,1>::ListOfClusters::iterator MatrixFunction<MatrixType,1>::findCluster(Scalar key)
+{
+  typename Cluster::iterator j;
+  for (typename ListOfClusters::iterator i = m_clusters.begin(); i != m_clusters.end(); ++i) {
+    j = std::find(i->begin(), i->end(), key);
+    if (j != i->end())
+      return i;
+  }
+  return m_clusters.end();
+}
+
+/** \brief Compute #m_clusterSize and #m_eivalToCluster using #m_clusters */
+template <typename MatrixType>
+void MatrixFunction<MatrixType,1>::computeClusterSize()
+{
+  const int rows = m_T.rows();
+  VectorType diag = m_T.diagonal();
+  const int numClusters = m_clusters.size();
+
+  m_clusterSize.setZero(numClusters);
+  m_eivalToCluster.resize(rows);
+  int clusterIndex = 0;
+  for (typename ListOfClusters::const_iterator cluster = m_clusters.begin(); cluster != m_clusters.end(); ++cluster) {
+    for (int i = 0; i < diag.rows(); ++i) {
+      if (std::find(cluster->begin(), cluster->end(), diag(i)) != cluster->end()) {
+	++m_clusterSize[clusterIndex];
+	m_eivalToCluster[i] = clusterIndex;
+      }
+    }
+    ++clusterIndex;
+  }
+}
+
+/** \brief Compute #m_blockStart using #m_clusterSize */
+template <typename MatrixType>
+void MatrixFunction<MatrixType,1>::computeBlockStart()
+{
+  m_blockStart.resize(m_clusterSize.rows());
+  m_blockStart(0) = 0;
+  for (int i = 1; i < m_clusterSize.rows(); i++) {
+    m_blockStart(i) = m_blockStart(i-1) + m_clusterSize(i-1);
+  }
+}
+
+/** \brief Compute #m_permutation using #m_eivalToCluster and #m_blockStart */
+template <typename MatrixType>
+void MatrixFunction<MatrixType,1>::constructPermutation()
+{
+  VectorXi indexNextEntry = m_blockStart;
+  m_permutation.resize(m_T.rows());
+  for (int i = 0; i < m_T.rows(); i++) {
+    int cluster = m_eivalToCluster[i];
+    m_permutation[i] = indexNextEntry[cluster];
+    ++indexNextEntry[cluster];
+  }
+}
+
+/** \brief Permute Schur decomposition in #m_U and #m_T according to #m_permutation */
+template <typename MatrixType>
+void MatrixFunction<MatrixType,1>::permuteSchur()
+{
+  IntVectorType p = m_permutation;
   for (int i = 0; i < p.rows() - 1; i++) {
     int j;
     for (j = i; j < p.rows(); j++) {
@@ -252,46 +364,70 @@
     }
     ei_assert(p(j) == i);
     for (int k = j-1; k >= i; k--) {
-      swapEntriesInSchur(k, T, U);
+      swapEntriesInSchur(k);
       std::swap(p.coeffRef(k), p.coeffRef(k+1));
     }
   }
 }

-// swap T(index, index) and T(index+1, index+1)
-template <typename MatrixType>
-void MatrixFunction<MatrixType,1>::swapEntriesInSchur(int index, MatrixType& T, MatrixType& U)
+/** \brief Swap rows \a index and \a index+1 in Schur decomposition in #m_U and #m_T */
+template <typename MatrixType>
+void MatrixFunction<MatrixType,1>::swapEntriesInSchur(int index)
 {
   PlanarRotation<Scalar> rotation;
-  rotation.makeGivens(T(index, index+1), T(index+1, index+1) - T(index, index));
-  T.applyOnTheLeft(index, index+1, rotation.adjoint());
-  T.applyOnTheRight(index, index+1, rotation);
-  U.applyOnTheRight(index, index+1, rotation);
+  rotation.makeGivens(m_T(index, index+1), m_T(index+1, index+1) - m_T(index, index));
+  m_T.applyOnTheLeft(index, index+1, rotation.adjoint());
+  m_T.applyOnTheRight(index, index+1, rotation);
+  m_U.applyOnTheRight(index, index+1, rotation);
 }

-template <typename MatrixType>
-void MatrixFunction<MatrixType,1>::computeTriangular(const MatrixType& T, MatrixType& result, const VectorXi& blockSize)
+/** \brief Compute block diagonal part of #m_fT.
+  *
+  * This routine computes the matrix function #m_f applied to the block
+  * diagonal part of #m_T, with the blocking given by #m_blockStart. The
+  * result is stored in #m_fT. The off-diagonal parts of #m_fT are set
+  * to zero.
+  */
+template <typename MatrixType>
+void MatrixFunction<MatrixType,1>::computeBlockAtomic()
 {
-  MatrixType expT;
-  ei_matrix_exponential(T, &expT);
-  computeBlockAtomic(T, result, blockSize);
-  VectorXi blockStart(blockSize.rows());
-  blockStart(0) = 0;
-  for (int i = 1; i < blockSize.rows(); i++) {
-    blockStart(i) = blockStart(i-1) + blockSize(i-1);
-  }
-  for (int diagIndex = 1; diagIndex < blockSize.rows(); diagIndex++) {
-    for (int blockIndex = 0; blockIndex < blockSize.rows() - diagIndex; blockIndex++) {
+  m_fT.resize(m_T.rows(), m_T.cols());
+  m_fT.setZero();
+  MatrixFunctionAtomic<DynMatrixType> mfa(m_f);
+  for (int i = 0; i < m_clusterSize.rows(); ++i) {
+    block(m_fT, i, i) = mfa.compute(block(m_T, i, i));
+  }
+}
+
+/** \brief Return block of matrix according to blocking given by #m_blockStart */
+template <typename MatrixType>
+Block<MatrixType> MatrixFunction<MatrixType,1>::block(const MatrixType& A, int i, int j)
+{
+  return A.block(m_blockStart(i), m_blockStart(j), m_clusterSize(i), m_clusterSize(j));
+}
+
+/** \brief Compute part of #m_fT above block diagonal.
+  *
+  * This routine assumes that the block diagonal part of #m_fT (which
+  * equals #m_f applied to #m_T) has already been computed and computes
+  * the part above the block diagonal. The part below the diagonal is
+  * zero, because #m_T is upper triangular.
+  */
+template <typename MatrixType>
+void MatrixFunction<MatrixType,1>::computeOffDiagonal()
+{
+  for (int diagIndex = 1; diagIndex < m_clusterSize.rows(); diagIndex++) {
+    for (int blockIndex = 0; blockIndex < m_clusterSize.rows() - diagIndex; blockIndex++) {
       // compute (blockIndex, blockIndex+diagIndex) block
-      DynMatrixType A = T.block(blockStart(blockIndex), blockStart(blockIndex), blockSize(blockIndex), blockSize(blockIndex));
-      DynMatrixType B = -T.block(blockStart(blockIndex+diagIndex), blockStart(blockIndex+diagIndex), blockSize(blockIndex+diagIndex), blockSize(blockIndex+diagIndex));
-      DynMatrixType C = result.block(blockStart(blockIndex), blockStart(blockIndex), blockSize(blockIndex), blockSize(blockIndex)) * T.block(blockStart(blockIndex), blockStart(blockIndex+diagIndex), blockSize(blockIndex), blockSize(blockIndex+diagIndex));
-      C -= T.block(blockStart(blockIndex), blockStart(blockIndex+diagIndex), blockSize(blockIndex), blockSize(blockIndex+diagIndex)) * result.block(blockStart(blockIndex+diagIndex), blockStart(blockIndex+diagIndex), blockSize(blockIndex+diagIndex), blockSize(blockIndex+diagIndex));
+      DynMatrixType A = block(m_T, blockIndex, blockIndex);
+      DynMatrixType B = -block(m_T, blockIndex+diagIndex, blockIndex+diagIndex);
+      DynMatrixType C = block(m_fT, blockIndex, blockIndex) * block(m_T, blockIndex, blockIndex+diagIndex);
+      C -= block(m_T, blockIndex, blockIndex+diagIndex) * block(m_fT, blockIndex+diagIndex, blockIndex+diagIndex);
       for (int k = blockIndex + 1; k < blockIndex + diagIndex; k++) {
-	C += result.block(blockStart(blockIndex), blockStart(k), blockSize(blockIndex), blockSize(k)) * T.block(blockStart(k), blockStart(blockIndex+diagIndex), blockSize(k), blockSize(blockIndex+diagIndex));
-	C -= T.block(blockStart(blockIndex), blockStart(k), blockSize(blockIndex), blockSize(k)) * result.block(blockStart(k), blockStart(blockIndex+diagIndex), blockSize(k), blockSize(blockIndex+diagIndex));
+	C += block(m_fT, blockIndex, k) * block(m_T, k, blockIndex+diagIndex);
+	C -= block(m_T, blockIndex, k) * block(m_fT, k, blockIndex+diagIndex);
       }
-      result.block(blockStart(blockIndex), blockStart(blockIndex+diagIndex), blockSize(blockIndex), blockSize(blockIndex+diagIndex)) = solveTriangularSylvester(A, B, C);
+      block(m_fT, blockIndex, blockIndex+diagIndex) = solveTriangularSylvester(A, B, C);
     }
   }
 }
@@ -364,110 +500,14 @@
 }

-// does not touch irrelevant parts of T
-template <typename MatrixType>
-void MatrixFunction<MatrixType,1>::computeBlockAtomic(const MatrixType& T, MatrixType& result, const VectorXi& blockSize)
-{
-  int blockStart = 0;
-  result.resize(T.rows(), T.cols());
-  result.setZero();
-  MatrixFunctionAtomic<DynMatrixType> mfa(m_f);
-  for (int i = 0; i < blockSize.rows(); i++) {
-    result.block(blockStart, blockStart, blockSize(i), blockSize(i))
-      = mfa.compute(T.block(blockStart, blockStart, blockSize(i), blockSize(i)));
-    blockStart += blockSize(i);
-  }
-}
-
-template <typename Scalar>
-typename std::list<std::list<Scalar> >::iterator ei_find_in_list_of_lists(typename std::list<std::list<Scalar> >& ll, Scalar x)
-{
-  typename std::list<Scalar>::iterator j;
-  for (typename std::list<std::list<Scalar> >::iterator i = ll.begin(); i != ll.end(); i++) {
-    j = std::find(i->begin(), i->end(), x);
-    if (j != i->end())
-      return i;
-  }
-  return ll.end();
-}
-
-// Alg 4.1
-template <typename MatrixType>
-void MatrixFunction<MatrixType,1>::divideInBlocks(const VectorType& v, listOfLists* result)
-{
-  const int n = v.rows();
-  for (int i=0; i<n; i++) {
-    // Find set containing v(i), adding a new set if necessary
-    typename listOfLists::iterator qi = ei_find_in_list_of_lists(*result, v(i));
-    if (qi == result->end()) {
-      listOfScalars l;
-      l.push_back(v(i));
-      result->push_back(l);
-      qi = result->end();
-      qi--;
-    }
-    // Look for other element to add to the set
-    for (int j=i+1; j<n; j++) {
-      if (ei_abs(v(j) - v(i)) <= separation() && std::find(qi->begin(), qi->end(), v(j)) == qi->end()) {
-	typename listOfLists::iterator qj = ei_find_in_list_of_lists(*result, v(j));
-	if (qj == result->end()) {
-	  qi->push_back(v(j));
-	} else {
-	  qi->insert(qi->end(), qj->begin(), qj->end());
-	  result->erase(qj);
-	}
-      }
-    }
-  }
-}
-
-// Construct permutation P, such that P(D) has eigenvalues clustered together
-template <typename MatrixType>
-void MatrixFunction<MatrixType,1>::constructPermutation(const VectorType& diag, const listOfLists& blocks,
-							VectorXi& blockSize, IntVectorType& permutation)
-{
-  const int n = diag.rows();
-  const int numBlocks = blocks.size();
-
-  // For every block in blocks, mark and count the entries in diag that
-  // appear in that block
-  blockSize.setZero(numBlocks);
-  IntVectorType entryToBlock(n);
-  int blockIndex = 0;
-  for (typename listOfLists::const_iterator block = blocks.begin(); block != blocks.end(); block++) {
-    for (int i = 0; i < diag.rows(); i++) {
-      if (std::find(block->begin(), block->end(), diag(i)) != block->end()) {
-	blockSize[blockIndex]++;
-	entryToBlock[i] = blockIndex;
-      }
-    }
-    blockIndex++;
-  }
-
-  // Compute index of first entry in every block as the sum of sizes
-  // of all the preceding blocks
-  VectorXi indexNextEntry(numBlocks);
-  indexNextEntry[0] = 0;
-  for (blockIndex = 1; blockIndex < numBlocks; blockIndex++) {
-    indexNextEntry[blockIndex] = indexNextEntry[blockIndex-1] + blockSize[blockIndex-1];
-  }
-
-  // Construct permutation
-  permutation.resize(n);
-  for (int i = 0; i < n; i++) {
-    int block = entryToBlock[i];
-    permutation[i] = indexNextEntry[block];
-    indexNextEntry[block]++;
-  }
-}
-
 template <typename Derived>
 EIGEN_STRONG_INLINE void ei_matrix_function(const MatrixBase<Derived>& M,
 					    typename ei_stem_function<typename ei_traits<Derived>::Scalar>::type f,
 					    typename MatrixBase<Derived>::PlainMatrixType* result)
 {
   ei_assert(M.rows() == M.cols());
-  MatrixFunction<typename MatrixBase<Derived>::PlainMatrixType>(M, f, result);
+  typedef typename MatrixBase<Derived>::PlainMatrixType PlainMatrixType;
+  MatrixFunction<PlainMatrixType>(M, f, result);
 }

 #endif // EIGEN_MATRIX_FUNCTION


ipaccess: rename ipaccess_bts_cb() to ipaccess_bts_read_cb()

this is consistent with ipaccess_bts_write_cb().

--- src/input/ipaccess.c
+++ src/input/ipaccess.c
@@ -800,7 +800,7 @@
 	return nmsg2;
 }

-static int ipaccess_bts_cb(struct ipa_client_conn *link, struct msgb *msg)
+static int ipaccess_bts_read_cb(struct ipa_client_conn *link, struct msgb *msg)
 {
 	struct ipaccess_head *hh = (struct ipaccess_head *) msg->data;
 	struct e1inp_ts *e1i_ts = NULL;
@@ -974,7 +974,7 @@
 					      line->ops->cfg.ipa.addr,
 					      IPA_TCP_PORT_OML,
 					      NULL,
-					      ipaccess_bts_cb,
+					      ipaccess_bts_read_cb,
 					      ipaccess_bts_write_cb,
 					      line);
 		if (link == NULL) {
@@ -1008,7 +1008,7 @@
 					  E1INP_SIGN_RSL,
 					  rem_addr, rem_port,
 					  NULL,
-					  ipaccess_bts_cb,
+					  ipaccess_bts_read_cb,
 					  ipaccess_bts_write_cb,
 					  line);
 	if (rsl_link == NULL) {


Create logClose.c

Create logClose.c

error: pathspec 'ActionLog/scripts/log/logClose.c' did not match any file(s) known to git

--- ActionLog/scripts/log/logClose.c
+++ ActionLog/scripts/log/logClose.c
@@ -0,0 +1,8 @@
+log: logClose
+Go to Layout [ $$loglayout ]
+Set Variable [ $$loglayout ]
+Go to Record/Request/Page
+[ First ]
+Scroll Window
+[ Home ]
+January 5, 平成26 19:31:29 ActionLog.fp7 - logClose -1-


add support for single-buffered windows

add support for single-buffered windows

--- spu/vnc/vncspu.c
+++ spu/vnc/vncspu.c
@@ -238,8 +238,22 @@
  * Then, update the dirty rectangle info.
  */
 static void
-DoReadback(int scrx, int scry, int winWidth, int winHeight)
-{
+DoReadback(WindowInfo *window)
+{
+	int size[2], pos[2];
+	int scrx, scry, winWidth, winHeight;
+
+	/* get window size and position (in screen coords) */
+	vnc_spu.super.GetChromiumParametervCR(GL_WINDOW_SIZE_CR,
+																				window->id, GL_INT, 2, size);
+	vnc_spu.super.GetChromiumParametervCR(GL_WINDOW_POSITION_CR,
+																				window->id, GL_INT, 2, pos);
+
+	scrx = pos[0];
+	scry = pos[1];
+	winWidth = size[0];
+	winHeight = size[1];
+
 	/* check/alloc the screen buffer now */
 	if (!vnc_spu.screen_buffer) {
 		vnc_spu.screen_buffer = (GLubyte *)
@@ -310,19 +324,6 @@
 }

-static void VNCSPU_APIENTRY
-vncspuSwapBuffers(GLint win, GLint flags)
-{
-	int size[2], pos[2];
-	vnc_spu.super.GetChromiumParametervCR(GL_WINDOW_SIZE_CR,
-																				win, GL_INT, 2, size);
-	vnc_spu.super.GetChromiumParametervCR(GL_WINDOW_POSITION_CR,
-																				win, GL_INT, 2, pos);
-	DoReadback(pos[0], pos[1], size[0], size[1]);
-	vnc_spu.super.SwapBuffers(win, flags);
-}
-
-
 /**
  * Given an integer window ID, return the WindowInfo.  Create a new
  * WindowInfo for new ID.
@@ -336,6 +337,7 @@
 		/* create new */
 		window = (WindowInfo *) crCalloc(sizeof(WindowInfo));
 		crHashtableAdd(vnc_spu.windowTable, win, window);
+		window->id = win;
 	}

 	if (window->nativeWindow != nativeWindow && nativeWindow != 0) {
@@ -344,6 +346,39 @@
 	}

 	return window;
+}
+
+
+static void VNCSPU_APIENTRY
+vncspuSwapBuffers(GLint win, GLint flags)
+{
+	WindowInfo *window = LookupWindow(win, 0);
+	if (window) {
+		DoReadback(window);
+	}
+	else {
+		crWarning("VNC SPU: SwapBuffers called for invalid window id");
+	}
+	vnc_spu.super.SwapBuffers(win, flags);
+}
+
+
+/**
+ * For both glFlush and glFinish.
+ * Update VNC data if single-buffered.
+ */
+static void VNCSPU_APIENTRY
+vncspuFinish(void)
+{
+	GLboolean db;
+	vnc_spu.self.GetBooleanv(GL_DOUBLEBUFFER, &db);
+	if (!db) {
+		/* single buffered: update VNC info */
+		WindowInfo *window = vnc_spu.currentWindow;
+		if (window) {
+			DoReadback(window);
+		}
+	}
 }

@@ -368,5 +403,7 @@
 SPUNamedFunctionTable _cr_vnc_table[] = {
 	{"SwapBuffers", (SPUGenericFunction) vncspuSwapBuffers},
 	{"MakeCurrent", (SPUGenericFunction) vncspuMakeCurrent},
+	{"Finish", (SPUGenericFunction) vncspuFinish},
+	{"Flush", (SPUGenericFunction) vncspuFinish},
 	{ NULL, NULL }
 };


Automated master header file repair.

Automated master header file repair.

git-svn-id: 28d9401aa571d5108e51b194aae6f24ca5964c06@19174 8cc4aa7f-3514-0410-904f-f2cc9021211c


Improve limits.h with comments

Improve limits.h with comments


-- Introduced new proxy phase:
   The new phase takes the both inputs of a join and nests them. The rewrite
   thus causes the left branch to be evaluated in dependence of the right one.

   This 'optimization' obviously seems to be a drawback. It however allows
   subsequent proxy detection to generate two proxies (instead of one) that
   hopefully can be pushed down a cross product that lies in wait underneath.

--- pathfinder/compiler/algebra/map/intro_proxy.c
+++ pathfinder/compiler/algebra/map/intro_proxy.c
@@ -803,6 +803,368 @@
     *(PFla_op_t **) PFarray_add (checked_nodes) = R(L(new_number));
     *(PFla_op_t **) PFarray_add (checked_nodes) = L(L(R(R(L(new_number)))));

+    return true;
+}
+
+
+
+
+/**
+ *
+ * Functions specific to joins that are unnested
+ * (independent expressions on the left and the right side).
+ *
+ */
+
+/**
+ * proxy_nest_entry checks if a node is a equi-join on domains
+ * that only have a common super domain but the domains are
+ * no subdomain of each other.
+ */
+static bool
+proxy_nest_entry (PFla_op_t *p)
+{
+    if (p->kind != la_eqjoin)
+        return false;
+
+    if (PFprop_key_left (p->prop, p->sem.eqjoin.att1) &&
+        PFprop_subdom (p->prop,
+                       PFprop_dom_right (p->prop,
+                                         p->sem.eqjoin.att2),
+                       PFprop_dom_left (p->prop,
+                                        p->sem.eqjoin.att1)))
+        return false;
+
+    if (PFprop_key_right (p->prop, p->sem.eqjoin.att2) &&
+        PFprop_subdom (p->prop,
+                       PFprop_dom_left (p->prop,
+                                        p->sem.eqjoin.att1),
+                       PFprop_dom_right (p->prop,
+                                         p->sem.eqjoin.att2)))
+        return false;
+
+    return true;
+}
+
+/**
+ * proxy_nest_exit looks for the number operator that generated
+ * the joins columns.
+ */
+static bool
+proxy_nest_exit (PFla_op_t *p, PFla_op_t *entry)
+{
+    PFla_op_t *cur;
+    dom_t att1_dom, att2_dom, super_dom;
+
+    if (p->kind != la_number)
+        return false;
+
+    /* only unnest if the rewrite seems promising -- if a cross product
+       lies in wait for further optimization */
+    cur = p;
+    while (cur->kind == la_project ||
+           cur->kind == la_number)
+        cur = L(cur);
+    if (cur->kind != la_cross)
+        return false;
+
+    /* only allow key columns */
+    if (p->sem.number.part) return false;
+
+    /* look up the newly generated domain and the join domains */
+    super_dom = PFprop_dom (p->prop, p->sem.number.attname);
+    att1_dom = PFprop_dom_left (entry->prop, entry->sem.eqjoin.att1);
+    att2_dom = PFprop_dom_right (entry->prop, entry->sem.eqjoin.att2);
+
+    /* compare the equi-join and number domains on subdomain relationship */
+    return PFprop_subdom (p->prop, att1_dom, super_dom) &&
+           PFprop_subdom (p->prop, att2_dom, super_dom);
+}
+
+/**
+ * The following 3 declarations and functions are used to ensure
+ * in function nest_proxy() that the two branches do not reference
+ * each other.
+ */
+/* forward declaration */
+static PFla_op_t *
+find_proxy_exit (PFla_op_t *p,
+                 PFla_op_t *entry,
+                 PFla_op_t *exit,
+                 PFarray_t *exit_refs,
+                 bool (* check_exit) (PFla_op_t *, PFla_op_t *));
+/* function used as function pointer argument */
+static bool
+proxy_nest_helper_exit (PFla_op_t *p, PFla_op_t *exit)
+{
+    return p == exit;
+}
+/* forward declaration */
+static void
+find_conflicts (PFla_op_t *p, PFarray_t *conflict_list);
+
+/**
+ * We rewrite a DAG of the form shown in (1) into an equivalent one
+ * (shown in (2)). This allows to directly following proxy detection
+ * to generate separate proxies for the two join branches.
+ *
+ * This rewrite is applied if both left and right branch are referenced
+ * only via the eqjoin operator (no references between left and right
+ * are allowed either).
+ *
+ * We replace the left branch by a projection (pi_(lower_left)) that
+ * maps all columns available in the original number operator # through
+ * the new join into the new right branch of the upper join. Another
+ * projection (pi_(upper_right)) retrieves the original names except for
+ * the number column -- the column generated by the new upper number
+ * operator is used here -- and replaces the references to the original
+ * number operator # in the original left branch.
+ *
+ * The projection pi_(upper_left) transports the results of the original
+ * right branch to the top of the plan where the projection pi_(top)
+ * adjusts the schema to the required format.
+ *
+ *                      |                             |
+ *                     |X|                            pi_(top)
+ *                   __/ \__                          |
+ *                  /       \                        |X|
+ *                 /         ^                    ___/ \___
+ *                /\        / \                  /         \
+ *               /  \      /   \                 |         /\
+ *              /left\    /right\                |        /  \
+ *             /______\  /_______\               |       /left\
+ *                |          |                   |      /______\
+ *                \____  ____/                   |          |
+ *                     \/                        |     pi_(upper_right)
+ *                     #                         |          |
+ *                     |                   pi_(upper_left)  |
+ *              (     ... *                      \___   ____/
+ *                     |                             \ /
+ *                     X                              #
+ *                    / \                             |
+ *                  ... ...    )                     |X|
+ *                                                ___/ \___
+ *                                               /         \
+ *                   ( 1 )                 pi_(lower_left)  ^
+ *                                               |         / \
+ *                                               |        /   \
+ *  (*) ... represents an arbitrary number       |       /right\
+ *      of the following operators:              |      /_______\
+ *      - project                                |          |
+ *      - attach                                 \___   ____/
+ *                                                   \ /
+ *                                                    #
+ *                                                    |
+ *                                             (     ... *
+ *                                                    |
+ *                                                    X
+ *                                                   / \
+ *                                                 ... ...    )
+ *
+ *
+ *                                                  ( 2 )
+ */
+static bool
+nest_proxy (PFla_op_t *root,
+            PFla_op_t *proxy_entry,
+            PFla_op_t *proxy_exit,
+            PFarray_t *conflict_list,
+            PFarray_t *exit_refs,
+            PFarray_t *checked_nodes)
+{
+    PFla_op_t    *node,
+                 *new_num,
+                 *pi_upper_right,
+                 *res;
+    PFalg_att_t   new_num_col,
+                  used_cols,
+                  cur_col,
+                  new_col;
+    unsigned int  i,
+                  last;
+    PFalg_proj_t *top_proj,
+                 *upper_left_proj,
+                 *upper_right_proj,
+                 *lower_left_proj;
+    PFarray_t    *left_exit_refs;
+
+    (void) root;
+
+    /* remove entry and exit references */
+    last = PFarray_last (conflict_list);
+    while (last) {
+        node = *(PFla_op_t **) PFarray_top (conflict_list);
+        if (proxy_exit == node || proxy_entry == node) {
+            PFarray_del (conflict_list);
+            last--;
+        } else
+            return false;
+    }
+
+    /* In the following we assure that no node of the
+       left branch references a node of the right branch
+       and vice versa.
+       A side-effect is the list of exit references
+       of the left branch. It will be later used to replace
+       the number operator. (We thus do not need the
+       list of exit references for both branches.) */
+    left_exit_refs = PFarray (sizeof (PFla_op_t *));
+    (void) exit_refs;
+
+    /* mark nodes in the left branch as INside and
+       collect the references to the exit node */
+    find_proxy_exit (L(proxy_entry),
+                     proxy_exit,
+                     proxy_exit,
+                     left_exit_refs,
+                     proxy_nest_helper_exit);
+    /* mark nodes in the right branch as OUTside and
+       collect the conflicts */
+    find_conflicts (R(proxy_entry), conflict_list);
+
+    PFla_in_out_reset (proxy_entry);
+    PFla_dag_reset (proxy_entry);
+
+    /* remove exit references --
+       if some other nodes are referenced
+       on both sides then bail out */
+    last = PFarray_last (conflict_list);
+    while (last) {
+        node = *(PFla_op_t **) PFarray_top (conflict_list);
+        if (proxy_exit == node) {
+            PFarray_del (conflict_list);
+            last--;
+        } else
+            return false;
+    }
+
+    /* prepare the projection lists */
+    top_proj         = PFmalloc (proxy_entry->schema.count *
+                                sizeof (PFalg_proj_t));
+    upper_left_proj  = PFmalloc ((R(proxy_entry)->schema.count + 1) *
+                                 sizeof (PFalg_proj_t));
+    upper_right_proj = PFmalloc (proxy_exit->schema.count *
+                                 sizeof (PFalg_proj_t));
+    lower_left_proj  = PFmalloc (proxy_exit->schema.count *
+                                 sizeof (PFalg_proj_t));
+
+    /* Generate the upper left projection and create a list
+       of used variables. This list is then used to avoid
+       naming conflicts at the lower join and the above number
+       operator. */
+    used_cols = proxy_entry->sem.eqjoin.att1;
+
+    for (i = 0; i < L(proxy_entry)->schema.count; i++)
+        used_cols = used_cols | L(proxy_entry)->schema.items[i].name;
+
+    for (i = 0; i < R(proxy_entry)->schema.count; i++) {
+        used_cols = used_cols | R(proxy_entry)->schema.items[i].name;
+        upper_left_proj[i] = PFalg_proj (
+                                 R(proxy_entry)->schema.items[i].name,
+                                 R(proxy_entry)->schema.items[i].name);
+    }
+
+    /* Generate a new column name that will hold the values of the
+       new upper number operator... */
+    new_num_col = PFalg_ori_name (
+                      PFalg_unq_name (proxy_exit->sem.number.attname, 0),
+                      ~used_cols);
+    used_cols = used_cols | new_num_col;
+
+    /* add the column to the projection list of the left branch
+       of the upper join thus adjusting the cardinality of
+       the right output */
+    upper_left_proj[R(proxy_entry)->schema.count] = PFalg_proj (new_num_col,
+                                                                new_num_col);
+
+    /* generate the top projection. It prunes the number columns
+       of the upper join and adds a new column holding the content
+       of the original number column. */
+    for (i = 0; i < proxy_entry->schema.count; i++)
+        if (proxy_entry->sem.eqjoin.att1 !=
+            proxy_entry->schema.items[i].name)
+            top_proj[i] = PFalg_proj (
+                              proxy_entry->schema.items[i].name,
+                              proxy_entry->schema.items[i].name);
+        else
+            top_proj[i] = PFalg_proj (
+                              proxy_entry->sem.eqjoin.att1,
+                              proxy_entry->sem.eqjoin.att2);
+
+    /* generate the two projection lists that map the input to
+       the originally left (now upper) branch without name
+       conflicts */
+    for (i = 0; i < proxy_exit->schema.count; i++) {
+        cur_col = proxy_exit->schema.items[i].name;
+
+        if (cur_col != proxy_exit->sem.number.attname) {
+            new_col = PFalg_ori_name (PFalg_unq_name (cur_col, 0), ~used_cols);
+            used_cols = used_cols | new_col;
+
+            lower_left_proj[i] = PFalg_proj (new_col, cur_col);
+            upper_right_proj[i] = PFalg_proj (cur_col, new_col);
+        }
+        else {
+            lower_left_proj[i] = PFalg_proj (proxy_entry->sem.eqjoin.att1,
+                                             cur_col);
+            upper_right_proj[i] = PFalg_proj (cur_col, new_num_col);
+        }
+    }
+
+    /* create the new lower join containing only
+       the originally right branch */
+    new_num = PFla_number (
+                  PFla_eqjoin (
+                      PFla_project_ (
+                          proxy_exit,
+                          proxy_exit->schema.count,
+                          lower_left_proj),
+                      R(proxy_entry),
+                      proxy_entry->sem.eqjoin.att1,
+                      proxy_entry->sem.eqjoin.att2),
+                  new_num_col,
+                  att_NULL);
+
+    /* create the projection that builds the input
+       to the originally left branch */
+    pi_upper_right = PFla_project_ (
+                         new_num,
+                         proxy_exit->schema.count,
+                         upper_right_proj);
+
+    /* bind all references inside the left branch to the
+       mapping projection pi_upper_right */
+    for (i = 0; i < PFarray_last (left_exit_refs); i++) {
+        node = *(PFla_op_t **) PFarray_at (left_exit_refs, i);
+        if (L(node) == proxy_exit)
+            L(node) = pi_upper_right;
+        if (R(node) == proxy_exit)
+            R(node) = pi_upper_right;
+    }
+
+    /* Create the upper join containing the originally left branch
+       and the results of the originally right branch ... */
+    res = PFla_project_ (
+              PFla_eqjoin (
+                  PFla_project_ (
+                      new_num,
+                      R(proxy_entry)->schema.count + 1,
+                      upper_left_proj),
+                  L(proxy_entry),
+                  new_num_col,
+                  proxy_entry->sem.eqjoin.att1),
+              proxy_entry->schema.count,
+              top_proj);
+
+    /* ... and replace the old proxy entry operator with the two
+       nested joins. */
+    *proxy_entry = *res;
+
+    /* make sure the new created joins are not checked in the next
+       traversal */
+    *(PFla_op_t **) PFarray_add (checked_nodes) = L(res);
+    *(PFla_op_t **) PFarray_add (checked_nodes) = L(new_num);
+
     return true;
 }

@@ -2146,6 +2508,21 @@
        the list of checked nodes */
     PFarray_last (checked_nodes) = 0;

+    /* rewrite joins that are unnested (independent expressions
+       on the left and the right side) into a nested variant
+       such that the following proxy introduction and rewrites
+       using these proxies may benefit from it. */
+    intro_proxy_kind (root,
+                      join_prepare,
+                      proxy_nest_entry,
+                      proxy_nest_exit,
+                      nest_proxy,
+                      checked_nodes);
+
+    /* As we match the same nodes (equi-joins) again we need to reset
+       the list of checked nodes */
+    PFarray_last (checked_nodes) = 0;
+
     /* generate proxies consisting of equi-join - number/rownum pairs */
     if (!intro_proxy_kind (root,
                            join_prepare,


Fix for issue #14

Fix for issue #14

--- example/example_gl3.c
+++ example/example_gl3.c
@@ -99,6 +99,8 @@
 		printf("Could not init glew.\n");
 		return -1;
 	}
+	// GLEW generates GL error because it calls glGetString(GL_EXTENSIONS), we'll consume it here.
+	glGetError();
 #endif

 #ifdef DEMO_MSAA


fixed wrong log message

fixed wrong log message

--- src/isomedia/track.c
+++ src/isomedia/track.c
@@ -451,7 +451,7 @@
 	if (!DescIndex) {
 		GF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, ("[iso file] default sample description set to 0, likely broken ! Fixing to 1\n" ));
 		DescIndex = 1;
-	} else if (DescIndex >= gf_list_count(trak->Media->information->sampleTable->SampleDescription->other_boxes)) {
+	} else if (DescIndex > gf_list_count(trak->Media->information->sampleTable->SampleDescription->other_boxes)) {
 		GF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, ("[iso file] default sample description set to %d but only %d sample description(s), likely broken ! Fixing to 1\n", DescIndex, gf_list_count(trak->Media->information->sampleTable->SampleDescription->other_boxes)));
 		DescIndex = 1;
 	}


Don't send a content-modify message if the content hasn't been sent yet.

This fixes a crash if you SetSending before session-initiate is sent.

--- src/jingle-content.c
+++ src/jingle-content.c
@@ -978,10 +978,13 @@
       return FALSE;
     }

-  msg = gabble_jingle_session_new_message (c->session,
-      JINGLE_ACTION_CONTENT_MODIFY, &sess_node);
-  gabble_jingle_content_produce_node (c, sess_node, FALSE, FALSE, NULL);
-  gabble_jingle_session_send (c->session, msg, NULL, NULL);
+  if (priv->state >= JINGLE_CONTENT_STATE_SENT)
+    {
+      msg = gabble_jingle_session_new_message (c->session,
+          JINGLE_ACTION_CONTENT_MODIFY, &sess_node);
+      gabble_jingle_content_produce_node (c, sess_node, FALSE, FALSE, NULL);
+      gabble_jingle_session_send (c->session, msg, NULL, NULL);
+    }

   /* FIXME: actually check whether remote end accepts our content-modify */
   return TRUE;


Actual debugging drawing

Actual debugging drawing

--- DrawingManager.h
+++ DrawingManager.h
@@ -8,7 +8,7 @@
 namespace Neolib {

 	struct DrawerSettings {
-#ifdef DEBUG
+#ifdef _DEBUG
 		bool enableTopInfo = true;
 		bool enableResourceOverlay = true;
 		bool enableBWEMOverlay = false;


Updated AliEMCAL::Digits2Raw, reads first provisional RCU mapping files to make Raw data with new AliCaloAltroMapping and AliCaloRawStream

--- EMCAL/AliEMCAL.h
+++ EMCAL/AliEMCAL.h
@@ -4,7 +4,11 @@
  * See cxx source for full Copyright notice     */

 /* $Id$ */
-
+/* History of cvs commits:
+ *
+ * $Log$
+ *
+ */
 //_________________________________________________________________________
 //  Base Class for EMCAL
 //  holds all geant information of
@@ -69,7 +73,7 @@
   Double_t GetRawFormatTimePeak() const { return fgTimePeak ; }
   Double_t GetRawFormatTimeTrigger() const { return fgTimeTrigger ; }
   Int_t GetRawFormatThreshold() const { return fgThreshold ; }
-  Int_t GetRawFormatChannelsPerDDL() const { return fgChannelsPerDDL ; }
+  Int_t GetRawFormatDDLPerSuperModule() const { return fgDDLPerSuperModule ; }
   static Double_t RawResponseFunctionMax(Double_t charge, Double_t gain) ;
   Bool_t   RawSampledResponse(Double_t dtime, Double_t damp, Int_t * adcH, Int_t * adcL) const ;
   //
@@ -98,9 +102,9 @@
   static Double_t fgTimePeak ;          // peaking time of the raw RO signal
   static Double_t fgTimeTrigger ;       // time of the trigger for the RO signal
   static Int_t fgThreshold;             // threshold
-  static Int_t fgChannelsPerDDL;        // number of channels per DDL
-
- private:
+  static Int_t fgDDLPerSuperModule;        // number of DDL per SuperModule
+
+private:
   AliEMCAL(const AliEMCAL& emcal);
   AliEMCAL & operator = (const AliEMCAL & /*rvalue*/);


fixed bug in example

fixed bug in example

--- examples/ReadInterp.c
+++ examples/ReadInterp.c
@@ -122,7 +122,7 @@
       ovkSetGridParamComm(GridParams, InputGrid->comm);
       ovkSetGridParamSize(GridParams, InputGrid->global_size);
       ovkSetGridParamPeriodic(GridParams, InputGrid->periodic);
-      ovkSetGridParamPeriodicStorage(GridParams, OVK_NO_OVERLAP_PERIODIC);
+      ovkSetGridParamPeriodicStorage(GridParams, OVK_PERIODIC_STORAGE_UNIQUE);
       ovkSetGridParamPeriodicLength(GridParams, InputGrid->periodic_length);
       ovk_range LocalRange;
       ovkSetRange(&LocalRange, 2, InputGrid->is, InputGrid->ie);


remote-info: Remove unused variables

remote-info: Remove unused variables

Closes: #2573
Approved by: mwleeds

--- app/flatpak-builtins-remote-info.c
+++ app/flatpak-builtins-remote-info.c
@@ -95,8 +95,6 @@
   g_autoptr(GVariant) sparse = NULL;
   const char *eol = NULL;
   const char *eol_rebase = NULL;
-  const char *on = "";
-  const char *off = "";
   gboolean friendly = TRUE;
   const char *xa_metadata = NULL;
   const char *collection_id = NULL;
@@ -154,12 +152,6 @@
     {
       g_variant_lookup (sparse, "eol", "&s", &eol);
       g_variant_lookup (sparse, "eolr", "&s", &eol_rebase);
-    }
-
-  if (flatpak_fancy_output ())
-    {
-      on = FLATPAK_ANSI_BOLD_ON;
-      off = FLATPAK_ANSI_BOLD_OFF; /* bold off */
     }

   if (opt_show_ref || opt_show_commit || opt_show_parent || opt_show_metadata || opt_show_runtime || opt_show_sdk)


remove unused variable

remove unused variable

--- lib/handler/mruby.c
+++ lib/handler/mruby.c
@@ -67,7 +67,6 @@

     sprintf(buf, "module Kernel\n"
                  "  def %s(*args)\n"
-                 "    f = Fiber.current\n"
                  "    ret = Fiber.yield([\n"
                  "      %d,\n"
                  "      _h2o_create_resumer(),\n"


Set a default hostname in viewer demo program

* examples/gvncviewer.c: Set a default hostname of 127.0.0.1
  if only a port number is given

--- examples/gvncviewer.c
+++ examples/gvncviewer.c
@@ -34,10 +34,10 @@
 static gchar **args = NULL;
 static const GOptionEntry options [] =
 {
-  {
-    G_OPTION_REMAINING, '\0', 0, G_OPTION_ARG_STRING_ARRAY, &args,
-    NULL, "hostname[:display]" },
-  { NULL, 0, 0, G_OPTION_ARG_NONE, NULL, NULL, 0 }
+	{
+		G_OPTION_REMAINING, '\0', 0, G_OPTION_ARG_STRING_ARRAY, &args,
+		NULL, "[hostname][:display]" },
+	{ NULL, 0, 0, G_OPTION_ARG_NONE, NULL, NULL, 0 }
 };

@@ -377,7 +377,7 @@
 		return 1;
 	}
 	if (!args || (g_strv_length(args) != 1)) {
-		fprintf(stderr, "Usage: gvncviewer hostname[:display]\n%s\n", help_msg);
+		fprintf(stderr, "Usage: gvncviewer [hostname][:display]\n%s\n", help_msg);
 		return 1;
 	}

@@ -455,6 +455,8 @@
 	} else
 		snprintf(port, sizeof(port), "%d", 5900);

+	if (!*hostname)
+		snprintf(hostname, sizeof(hostname), "%s", "127.0.0.1");
 	vnc_display_open_host(VNC_DISPLAY(vnc), hostname, port);
 	vnc_display_set_keyboard_grab(VNC_DISPLAY(vnc), TRUE);
 	vnc_display_set_pointer_grab(VNC_DISPLAY(vnc), TRUE);


performance/stat-prefetch: lookup path in create if it is not already looked up.

Signed-off-by: Anand V. Avati <avati@dev.gluster.com>

BUG: 221 (stat prefetch implementation)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=221

--- xlators/performance/stat-prefetch/src/stat-prefetch.c
+++ xlators/performance/stat-prefetch/src/stat-prefetch.c
@@ -1093,32 +1093,76 @@

 int32_t
+sp_create_helper (call_frame_t *frame,	xlator_t *this,	loc_t *loc,
+                  int32_t flags, mode_t mode, fd_t *fd)
+{
+        uint64_t        value     = 0;
+        sp_inode_ctx_t *inode_ctx = NULL;
+        int32_t         ret       = 0, op_ret = -1, op_errno = -1;
+
+        ret = inode_ctx_get (loc->inode, this, &value);
+        if (ret == -1) {
+                gf_log (this->name, GF_LOG_DEBUG, "context not set in inode "
+                        "(%p)", loc->inode);
+                op_errno = EINVAL;
+                goto unwind;
+        }
+
+        inode_ctx = (sp_inode_ctx_t *)(long) value;
+        GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, inode_ctx, unwind, op_errno,
+                                        EINVAL);
+
+        LOCK (&inode_ctx->lock);
+        {
+                op_ret = inode_ctx->op_ret;
+                op_errno = inode_ctx->op_errno;
+        }
+        UNLOCK (&inode_ctx->lock);
+
+        if ((op_ret == -1) && (op_errno != ENOENT)) {
+                goto unwind;
+        }
+
+        STACK_WIND (frame, sp_create_cbk, FIRST_CHILD(this),
+                    FIRST_CHILD(this)->fops->create, loc, flags, mode, fd);
+
+        return 0;
+
+unwind:
+        SP_STACK_UNWIND (frame, -1, op_errno, NULL, NULL, NULL, NULL);
+        return 0;
+}
+
+
+int32_t
 sp_create (call_frame_t *frame,	xlator_t *this,	loc_t *loc, int32_t flags,
            mode_t mode, fd_t *fd)
 {
-        sp_local_t *local     = NULL;
-        int32_t     ret       = -1, op_errno = EINVAL;
-
-        GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc, unwind, op_errno,
-                                        EINVAL);
-        GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc->parent, unwind,
-                                        op_errno, EINVAL);
-        GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc->path, unwind, op_errno,
-                                        EINVAL);
-        GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc->name, unwind, op_errno,
-                                        EINVAL);
-        GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc->inode, unwind,
+        sp_local_t     *local        = NULL;
+        int32_t         op_errno     = -1, ret = -1;
+        call_stub_t    *stub         = NULL;
+        char            can_wind     = 0, need_lookup = 0, need_unwind = 1;
+
+        GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc, out, op_errno,
+                                        EINVAL);
+        GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc->parent, out,
+                                        op_errno, EINVAL);
+        GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc->path, out, op_errno,
+                                        EINVAL);
+        GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc->name, out, op_errno,
+                                        EINVAL);
+        GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, loc->inode, out,
                                         op_errno, EINVAL);

         ret = sp_cache_remove_parent_entry (frame, this, (char *)loc->path);
         if (ret == -1) {
                 op_errno = ENOMEM;
                 gf_log (this->name, GF_LOG_ERROR, "out of memory");
-                goto unwind;
+                goto out;
         }

         local = CALLOC (1, sizeof (*local));
-        GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, local, unwind, op_errno,
+        GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, local, out, op_errno,
                                         ENOMEM);

         frame->local = local;
@@ -1126,16 +1170,45 @@
         ret = loc_copy (&local->loc, loc);
         if (ret == -1) {
                 op_errno = errno;
-                goto unwind;
-        }
-
-	STACK_WIND (frame, sp_create_cbk, FIRST_CHILD(this),
-                    FIRST_CHILD(this)->fops->create, loc, flags, mode, fd);
-
-        return 0;
-
-unwind:
-        SP_STACK_UNWIND (frame, -1, op_errno, fd);
+                goto out;
+        }
+
+        stub = fop_create_stub (frame, sp_create_helper, loc, flags, mode, fd);
+        if (stub == NULL) {
+                op_errno = ENOMEM;
+                gf_log (this->name, GF_LOG_ERROR, "out of memory");
+                goto out;
+        }
+
+        sp_process_inode_ctx (frame, this, loc, stub, &need_unwind,
+                              &need_lookup, &can_wind, &op_errno);
+out:
+        if (need_unwind) {
+                SP_STACK_UNWIND (frame, -1, op_errno, NULL);
+        } else if (need_lookup) {
+                STACK_WIND (frame, sp_lookup_cbk, FIRST_CHILD(this),
+                            FIRST_CHILD(this)->fops->lookup, loc, NULL);
+        } else if (can_wind) {
+                if (frame->local == NULL) {
+                        need_unwind = 1;
+                        local = CALLOC (1, sizeof (*local));
+                        GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, local,
+                                                        out, op_errno,
+                                                        ENOMEM);
+                        frame->local = local;
+                        ret = loc_copy (&local->loc, loc);
+                        if (ret == -1) {
+                                op_errno = errno;
+                                gf_log (this->name, GF_LOG_ERROR, "%s",
+                                        strerror (op_errno));
+                                goto out;
+                        }
+                }
+
+                STACK_WIND (frame, sp_create_cbk, FIRST_CHILD(this),
+                            FIRST_CHILD(this)->fops->create, loc, flags,
+                            mode, fd);
+        }
         return 0;
 }


Core: allow access to core part data during its initialisation

--- src/core/core_parts.c
+++ src/core/core_parts.c
@@ -73,6 +73,9 @@
      if (core_part->size_shared)
           shared = SHCALLOC( pool, 1, core_part->size_shared );

+     core_part->data_local  = local;
+     core_part->data_shared = shared;
+
      ret = core_part->Initialize( core, local, shared );
      if (ret) {
           D_ERROR( "DirectFB/Core: Could not initialize '%s' core!\n"
@@ -85,11 +88,53 @@
           if (local)
                D_FREE( local );

+          core_part->data_local  = NULL;
+          core_part->data_shared = NULL;
+
           return ret;
      }

      if (shared)
           core_arena_add_shared_field( core, core_part->name, shared );
+
+     core_part->initialized = true;
+
+     return DFB_OK;
+}
+
+DFBResult
+dfb_core_part_join( CoreDFB  *core,
+                    CorePart *core_part )
+{
+     DFBResult  ret;
+     void      *local  = NULL;
+     void      *shared = NULL;
+
+     if (core_part->initialized) {
+          D_BUG( "%s already joined", core_part->name );
+          return DFB_BUG;
+     }
+
+     D_DEBUG_AT( Core_Parts, "Going to join '%s' core...\n", core_part->name );
+
+     if (core_part->size_shared &&
+         core_arena_get_shared_field( core, core_part->name, &shared ))
+          return DFB_FUSION;
+
+     if (core_part->size_local)
+          local = D_CALLOC( 1, core_part->size_local );
+
+     ret = core_part->Join( core, local, shared );
+     if (ret) {
+          D_ERROR( "DirectFB/Core: Could not join '%s' core!\n"
+                    "    --> %s\n", core_part->name,
+                    DirectFBErrorString( ret ) );
+
+          if (local)
+               D_FREE( local );
+
+          return ret;
+     }

      core_part->data_local  = local;
      core_part->data_shared = shared;
@@ -99,47 +144,6 @@
 }

 DFBResult
-dfb_core_part_join( CoreDFB  *core,
-                    CorePart *core_part )
-{
-     DFBResult  ret;
-     void      *local  = NULL;
-     void      *shared = NULL;
-
-     if (core_part->initialized) {
-          D_BUG( "%s already joined", core_part->name );
-          return DFB_BUG;
-     }
-
-     D_DEBUG_AT( Core_Parts, "Going to join '%s' core...\n", core_part->name );
-
-     if (core_part->size_shared &&
-         core_arena_get_shared_field( core, core_part->name, &shared ))
-          return DFB_FUSION;
-
-     if (core_part->size_local)
-          local = D_CALLOC( 1, core_part->size_local );
-
-     ret = core_part->Join( core, local, shared );
-     if (ret) {
-          D_ERROR( "DirectFB/Core: Could not join '%s' core!\n"
-                    "    --> %s\n", core_part->name,
-                    DirectFBErrorString( ret ) );
-
-          if (local)
-               D_FREE( local );
-
-          return ret;
-     }
-
-     core_part->data_local  = local;
-     core_part->data_shared = shared;
-     core_part->initialized = true;
-
-     return DFB_OK;
-}
-
-DFBResult
 dfb_core_part_shutdown( CoreDFB  *core,
                         CorePart *core_part,
                         bool      emergency )


Removed redundant locks in fs_core_add_playback()/remove_playback().

--- src/core/core_sound.c
+++ src/core/core_sound.c
@@ -392,14 +392,11 @@
           return DFB_FUSION;
      }

-     /* Add it to the playback list. */
-     fusion_skirmish_prevail( &shared->playlist.lock );
-
+     /* Add it to the playback list. */
      direct_list_prepend( &shared->playlist.entries, &entry->link );

+     /* Notify new playlist entry to the sound thread. */
      fusion_skirmish_notify( &shared->playlist.lock );
-
-     fusion_skirmish_dismiss( &shared->playlist.lock );

      return DFB_OK;
 }
@@ -419,9 +416,7 @@

      shared = core->shared;

-     /* Lookup playback in the list. */
-     fusion_skirmish_prevail( &shared->playlist.lock );
-
+     /* Lookup playback in the list. */
      direct_list_foreach_safe (l, next, shared->playlist.entries) {
           CorePlaylistEntry *entry = (CorePlaylistEntry*) l;

@@ -434,8 +429,6 @@
                SHFREE( shared->shmpool, entry );
           }
      }
-
-     fusion_skirmish_dismiss( &shared->playlist.lock );

      return DFB_OK;
 }


Avoid add_track() while loading the list

It's better to grab the mutex the whole time.

Signed-off-by: Felipe Contreras <de77a8b9cd239b204c19c52ed62e48ab47243362@gmail.com>

--- scrobble.c
+++ scrobble.c
@@ -159,6 +159,7 @@
 sr_session_load_list(sr_session_t *s,
 		     const char *file)
 {
+	struct sr_session_priv *priv = s->priv;
 	FILE *f;
 	char c, *p;
 	char k, v[255];
@@ -168,18 +169,20 @@
 	f = fopen(file, "r");
 	if (!f)
 		return 1;
+
+	g_mutex_lock(priv->queue_mutex);
 	t = sr_track_new();
 	while (true) {
 		c = getc(f);
 		if (stage == 1) {
 			if (c == '\n') {
-				sr_session_add_track(s, t);
+				g_queue_push_tail(priv->queue, t);
 				t = sr_track_new();
 				continue;
 			}
 			if (c == (char) EOF) {
 				if (track_is_valid(t))
-					sr_session_add_track(s, t);
+					g_queue_push_tail(priv->queue, t);
 				break;
 			}
 			k = c;
@@ -197,6 +200,8 @@
 			p++;
 		}
 	}
+	g_mutex_unlock(priv->queue_mutex);
+
 	fclose(f);
 	return 0;
 }


William Baxter's mods for MSVC incorporated (rolling back earlier changes).

--- src/CDataModel.h
+++ src/CDataModel.h
@@ -35,71 +35,7 @@
 #endif

 };
-
-/// This should form the base class for kernel models.
-class CKernelModel : public CDataModel
-{
- public:
-  // The number of processes associated with the kernel.
-  virtual int getNumProcesses() const=0;
-  // the number of points used for computing core kernel.
-  virtual int getNumActiveData() const=0;
-  // The value of the inverse `jitter' for that point
-  virtual double getBetaVal(const int i, const int j) const=0;
-
-  // Update the stored kernel matrix.
-  void updateK() const
-    {
-      double kVal=0.0;
-      for(int i=0; i<getNumActiveData(); i++)
-	{
-	  K.setVal(kern.diagComputeElement(activeX, i), i, i);
-	  for(int j=0; j<i; j++)
-	    {
-	      kVal=kern.computeElement(activeX, i, activeX, j);
-	      K.setVal(kVal, i, j);
-	      K.setVal(kVal, j, i);
-	    }
-	}
-      K.setSymmetric(true);
-    }
-
-  // Update the stored inverse kernel matrix.
-  void updateInvK(const int dim) const
-    {
-      invK.deepCopy(K);
-      for(int i=0; i<getNumActiveData(); i++)
-	invK.setVal(invK.getVal(i, i) + 1/getBetaVal(i, dim), i, i);
-      invK.setSymmetric(true);
-      CMatrix U(chol(invK));
-      logDetK = invK.logDet(U);
-      invK.pdinv(U);
-
-    }
-
-  CKern& kern;
-  CMatrix activeX;
-
-  mutable CMatrix K;
-  mutable CMatrix invK;
-  mutable double logDetK;
-};
 class COptimisableModel : public CDataModel, public COptimisable
-{
- public:
-  virtual inline void setVerbosity(const int val) const
-    {
-      verbosity = val;
-    }
-  virtual inline int getVerbosity() const
-    {
-      return verbosity;
-    }
- private:
-  mutable int verbosity;
-
-};
-class COptimisableKernelModel : public CKernelModel, public COptimisable
 {
  public:
   virtual inline void setVerbosity(const int val) const


This is v0.21.2-pre2

This is v0.21.2-pre2

--- src/CatenaBase.h
+++ src/CatenaBase.h
@@ -57,7 +57,7 @@
         (((major) << 24u) | ((minor) << 16u) | ((patch) << 8u) | (local))

 #define CATENA_ARDUINO_PLATFORM_VERSION \
-        CATENA_ARDUINO_PLATFORM_VERSION_CALC(0, 21, 2, 1) /* v0.21.2-pre1 */
+        CATENA_ARDUINO_PLATFORM_VERSION_CALC(0, 21, 2, 2) /* v0.21.2-pre2 */

 #define CATENA_ARDUINO_PLATFORM_VERSION_GET_MAJOR(v)    \
         (((v) >> 24u) & 0xFFu)


Fix return code of open which was always 1.

--- src/csync_propagate.c
+++ src/csync_propagate.c
@@ -114,7 +114,6 @@
       rc = 1;
     }
     CSYNC_LOG(CSYNC_LOG_PRIORITY_ERROR, "file: %s, command: open, error: %s", suri, strerror(errno));
-    rc = 1;
     goto out;
   }


Input device data source change

Input device data source change

--- src/cubeb_audiounit.c
+++ src/cubeb_audiounit.c
@@ -515,6 +515,26 @@
   }

   if (stm->input_unit) {
+    /* This event will notify us when the data source on the input device changes. */
+    AudioDeviceID input_dev_id;
+    if (audiounit_get_input_device_id(&input_dev_id) != noErr) {
+      return CUBEB_ERROR;
+    }
+
+    AudioObjectPropertyAddress source_address = {
+        kAudioDevicePropertyDataSource,
+        kAudioObjectPropertyScopeInput,
+        kAudioObjectPropertyElementMaster
+    };
+
+    r = AudioObjectAddPropertyListener(input_dev_id,
+        &source_address,
+        &audiounit_property_listener_callback,
+        stm);
+    if (r != noErr) {
+      return CUBEB_ERROR;
+    }
+
     /* This event will notify us when the default input device changes. */
     AudioObjectPropertyAddress default_input_device_address = {
         kAudioHardwarePropertyDefaultInputDevice,


cleaner

cleaner

--- src/daemon/response.c
+++ src/daemon/response.c
@@ -270,7 +270,7 @@
   if (response == NULL)
     return;
   pthread_mutex_lock (&response->mutex);
-  if (0 != --response->reference_count)
+  if (0 != --(response->reference_count))
     {
       pthread_mutex_unlock (&response->mutex);
       return;
@@ -295,7 +295,7 @@
 MHD_increment_response_rc (struct MHD_Response *response)
 {
   pthread_mutex_lock (&response->mutex);
-  response->reference_count++;
+  (response->reference_count)++;
   pthread_mutex_unlock (&response->mutex);
 }


close reading before writting and check fstype

Signed-off-by: Lehner Florian <34c6fceca75e456f25e7e99531e2425c6c1de443@der-flo.net>

--- sequitur.c
+++ sequitur.c
@@ -7,6 +7,9 @@
 #include <errno.h>
 #include <string.h>
 #include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+

 #define	SEQUITUR_VERSION	"0.1"

@@ -15,6 +18,16 @@
 	int				num;
 	int				pipeline[2];
 };
+
+static mode_t fstype(int fd) {
+	struct stat		s;
+
+	if(fstat(fd, &s) == -1){
+		exit(EXIT_FAILURE);
+	}
+
+	return s.st_mode;
+}

 static void usage(const char *prog){
 	fprintf(stderr, "%s [OPTIONS] module [module [module]]\n", prog);
@@ -78,6 +91,7 @@
 			fprintf(stderr, "%s\n", strerror(errno));
 			continue;
 		}
+		close(thread[i].pipeline[0]);

 		handle = dlopen(argv[i], RTLD_NOW);


Buffer overflow.  Similar, but different, to the fix that Julian A submitted
in PR 2580.

Obtained from: BSDi by way of Keith Bostic

Should be in 2.2 and 2.1.x.  I'll merge into 2.2.

--- lib/libc/gen/glob.c
+++ lib/libc/gen/glob.c
@@ -142,7 +142,7 @@
 static int	 glob2 __P((Char *, Char *, Char *, glob_t *));
 static int	 glob3 __P((Char *, Char *, Char *, Char *, glob_t *));
 static int	 globextend __P((const Char *, glob_t *));
-static const Char *	 globtilde __P((const Char *, Char *, glob_t *));
+static const Char *	 globtilde __P((const Char *, Char *, size_t, glob_t *));
 static int	 globexp1 __P((const Char *, glob_t *));
 static int	 globexp2 __P((const Char *, const Char *, glob_t *, int *));
 static int	 match __P((Char *, Char *, Char *));
@@ -332,22 +332,26 @@
  * expand tilde from the passwd file.
  */
 static const Char *
-globtilde(pattern, patbuf, pglob)
+globtilde(pattern, patbuf, patbuf_len, pglob)
 	const Char *pattern;
 	Char *patbuf;
+	size_t patbuf_len;
 	glob_t *pglob;
 {
 	struct passwd *pwd;
 	char *h;
 	const Char *p;
-	Char *b;
+	Char *b, *eb;

 	if (*pattern != TILDE || !(pglob->gl_flags & GLOB_TILDE))
 		return pattern;

-	/* Copy up to the end of the string or / */
-	for (p = pattern + 1, h = (char *) patbuf; *p && *p != SLASH;
-	     *h++ = *p++)
+	/*
+	 * Copy up to the end of the string or /
+	 */
+	eb = &patbuf[patbuf_len - 1];
+	for (p = pattern + 1, h = (char *) patbuf;
+	    h < (char *)eb && *p && *p != SLASH; *h++ = *p++)
 		continue;

 	*h = EOS;
@@ -375,12 +379,13 @@
 	}

 	/* Copy the home directory */
-	for (b = patbuf; *h; *b++ = *h++)
+	for (b = patbuf; b < eb && *h; *b++ = *h++)
 		continue;

 	/* Append the rest of the pattern */
-	while ((*b++ = *p++) != EOS)
+	while (b < eb && (*b++ = *p++) != EOS)
 		continue;
+	*b = EOS;

 	return patbuf;
 }
@@ -402,7 +407,8 @@
 	int c, err, oldpathc;
 	Char *bufnext, patbuf[MAXPATHLEN+1];

-	qpatnext = globtilde(pattern, patbuf, pglob);
+	qpatnext = globtilde(pattern, patbuf, sizeof(patbuf) / sizeof(Char),
+	    pglob);
 	oldpathc = pglob->gl_pathc;
 	bufnext = patbuf;


64bit portability fixes.

64bit portability fixes.

Submitted by: Andrew Gallatin <gallatin@cs.duke.edu>

--- lib/libc/net/rcmd.c
+++ lib/libc/net/rcmd.c
@@ -61,8 +61,8 @@

 #define max(a, b)	((a > b) ? a : b)

-int	__ivaliduser __P((FILE *, u_long, const char *, const char *));
-static int __icheckhost __P((u_long, char *));
+int	__ivaliduser __P((FILE *, u_int32_t, const char *, const char *));
+static int __icheckhost __P((u_int32_t, char *));

 int
 rcmd(ahost, rport, locuser, remuser, cmd, fd2p)
@@ -271,7 +271,7 @@
 	int superuser;
 {
 	struct hostent *hp;
-	u_long addr;
+	u_int32_t addr;
 	char **ap;

 	if ((hp = gethostbyname(rhost)) == NULL)
@@ -295,7 +295,7 @@
  */
 int
 iruserok(raddr, superuser, ruser, luser)
-	u_long raddr;
+	unsigned long raddr;
 	int superuser;
 	const char *ruser, *luser;
 {
@@ -311,7 +311,7 @@
 	hostf = superuser ? NULL : fopen(_PATH_HEQUIV, "r");
 again:
 	if (hostf) {
-		if (__ivaliduser(hostf, raddr, luser, ruser) == 0) {
+		if (__ivaliduser(hostf, (u_int32_t)raddr, luser, ruser) == 0) {
 			(void)fclose(hostf);
 			return (0);
 		}
@@ -371,7 +371,7 @@
 int
 __ivaliduser(hostf, raddr, luser, ruser)
 	FILE *hostf;
-	u_long raddr;
+	u_int32_t raddr;
 	const char *luser, *ruser;
 {
 	register char *user, *p;
@@ -390,7 +390,7 @@
 #define	ypdomain NULL
 #endif
 	/* We need to get the damn hostname back for netgroup matching. */
-	if ((hp = gethostbyaddr((char *)&raddr, sizeof(u_long),
+	if ((hp = gethostbyaddr((char *)&raddr, sizeof(u_int32_t),
 							AF_INET)) == NULL)
 		return (-1);
 	strncpy(hname, hp->h_name, sizeof(hname));
@@ -493,15 +493,15 @@
  */
 static int
 __icheckhost(raddr, lhost)
-	u_long raddr;
+	u_int32_t raddr;
 	register char *lhost;
 {
 	register struct hostent *hp;
-	register u_long laddr;
+	register u_int32_t laddr;
 	register char **pp;

 	/* Try for raw ip address first. */
-	if (isdigit(*lhost) && (long)(laddr = inet_addr(lhost)) != -1)
+	if (isdigit(*lhost) && (u_int32_t)(laddr = inet_addr(lhost)) != -1)
 		return (raddr == laddr);

 	/* Better be a hostname. */
@@ -510,7 +510,7 @@

 	/* Spin through ip addresses. */
 	for (pp = hp->h_addr_list; *pp; ++pp)
-		if (!bcmp(&raddr, *pp, sizeof(u_long)))
+		if (!bcmp(&raddr, *pp, sizeof(u_int32_t)))
 			return (1);

 	/* No match. */


assign NULL by default

assign NULL by default

--- src/kernel/syscall.c
+++ src/kernel/syscall.c
@@ -296,11 +296,15 @@
         goto fail;
       }
       break;
+
     case TIOCGWINSZ:
       if (!check_address_range(argp, sizeof(struct winsize))) {
         goto fail;
       }
       break;
+
+    default:
+      argp = NULL;
   }

   args[0] = process_ioctl(fd, request, argp);


Fix sh coredump in vi mode with empty colon command

--- lib/libedit/parse.c
+++ lib/libedit/parse.c
@@ -97,6 +97,9 @@
     char *ptr;
     int i;

+    if (argc < 1)
+	return argc;
+
     for (ptr = argv[0]; *ptr && *ptr != ':'; ptr++)
 	continue;


agnosticbin: Use query_caps to get allowed caps

This makes target caps more accurate because queries all elements

Change-Id: I8c09761a92c59491887b9d143613a73ccfceba59

--- src/kmsagnosticbin.c
+++ src/kmsagnosticbin.c
@@ -434,7 +434,7 @@
     return;
   }

-  allowed_caps = gst_pad_get_allowed_caps (srcpad);
+  allowed_caps = gst_pad_query_caps (peer, NULL);
   if (allowed_caps == NULL) {
     GST_DEBUG ("Allowed caps for %P are NULL. "
         "The pad is not linked, disconnecting", srcpad);


client error on timeout before connection

Signed-off-by: Andy Green <b471f5a494de34531c9e5a6e15abda71edd49104@linaro.org>

--- lib/libwebsockets.c
+++ lib/libwebsockets.c
@@ -256,8 +256,14 @@
 		lwsl_debug("calling back CLOSED_HTTP\n");
 		context->protocols[0].callback(context, wsi,
 			LWS_CALLBACK_CLOSED_HTTP, wsi->user_space, NULL, 0 );
+	} else if (wsi->mode == LWS_CONNMODE_WS_CLIENT_WAITING_SERVER_REPLY) {
+		lwsl_debug("Connection closed before server reply\n");
+		context->protocols[0].callback(context, wsi,
+				LWS_CALLBACK_CLIENT_CONNECTION_ERROR,
+				wsi->user_space, NULL, 0 );
 	} else
-		lwsl_debug("not calling back closed\n");
+		lwsl_debug("not calling back closed mode=%d state=%d\n",
+			   wsi->mode, old_state);

 	/* deallocate any active extension contexts */


Add volatile method to indicate if time valid.

--- src/GNSS_Clock.h
+++ src/GNSS_Clock.h
@@ -23,6 +23,10 @@
     return _nmea.process(c);
   }

+  bool isValid(void) const volatile {
+    return _isValid;
+  }
+
   bool readClock(RTCx::time_t *t) const;

   inline bool readClock(RTCx::time_t &t) const {


Check that opened shapefiles are of a supported basic type

--- shapetcl.c
+++ shapetcl.c
@@ -790,6 +790,7 @@
 	int readonly = 0; /* readwrite access by default */
 	SHPHandle shp;
 	DBFHandle dbf;
+	int shpType;

 	if (objc < 2 || objc > 4) {
 		Tcl_SetResult(interp, "shapetcl path [rb|rb+]|type fields", TCL_STATIC);
@@ -817,7 +818,6 @@
 		/* create a new file; access is readwrite. */

 		const char *shpTypeName = Tcl_GetString(objv[2]);
-		int shpType;
 		int fieldSpecCount;
 		Tcl_Obj **fieldSpec;
 		int fieldi;
@@ -941,6 +941,15 @@
 			DBFClose(dbf);
 			return TCL_ERROR;
 		}
+
+		SHPGetInfo(shp, NULL, &shpType, NULL, NULL);
+		if (shpType != SHPT_POINT && shpType != SHPT_ARC &&
+				shpType != SHPT_POLYGON && shpType != SHPT_MULTIPOINT) {
+			Tcl_SetResult(interp, "unsupported shapefile geometry type", TCL_STATIC);
+			DBFClose(dbf);
+			SHPClose(shp);
+			return TCL_ERROR;
+		}
 	}

 	shapefile = (ShapefilePtr)ckalloc(sizeof(shapetcl_shapefile));


attr write RECORD FIELD VALUE now does validation. attrValidate factored out into attrValidateField, like attrWriteField and attrReadField.

--- shapetcl.c
+++ shapetcl.c
@@ -884,18 +884,76 @@
 	return TCL_OK;
 }

-/* given a list of attributes, check whether they conform to the shapefile's
-   field specification (parseable by type and not truncated). If not, return
-   TCL_ERROR with reason in result. If so, return TCL_OK with attribute list. */
-int shapefile_util_attrValidate(Tcl_Interp *interp, ShapefilePtr shapefile, Tcl_Obj *attrList) {
-	int fieldi, fieldCount, attrCount;
-	DBFFieldType fieldType;
-	int width, precision;
-	Tcl_Obj *attr;
-	char numericStringValue[64];
+
+int shapefile_util_attrValidateField(Tcl_Interp *interp, ShapefilePtr shapefile, int fieldId, Tcl_Obj *attrValue) {
+	int fieldCount, width, precision, fieldType;
 	int intValue;
 	double doubleValue;
 	const char *stringValue;
+	char numericStringValue[64];
+
+	fieldCount = DBFGetFieldCount(shapefile->dbf);
+	if (fieldId < 0 || fieldId >= fieldCount) {
+		Tcl_SetObjResult(interp, Tcl_ObjPrintf("invalid field index %d", fieldId));
+		return TCL_ERROR;
+	}
+
+	/* null fields are ok; validation doesn't need to set any result if OK */
+	if (attrValue == NULL || (Tcl_GetCharLength(attrValue) == 0)) {
+		return TCL_OK;
+	}
+
+	fieldType = (int)DBFGetFieldInfo(shapefile->dbf, fieldId, NULL, &width, &precision);
+	switch (fieldType) {
+		case FTInteger:
+			/* can this value be parsed as an integer? */
+			if (Tcl_GetIntFromObj(interp, attrValue, &intValue) != TCL_OK) {
+				return TCL_ERROR;
+			}
+			/* does this integer fit within the field width? */
+			sprintf(numericStringValue, "%d", intValue);
+			if (strlen(numericStringValue) > width) {
+				Tcl_SetObjResult(interp, Tcl_ObjPrintf("integer value (%s) would be truncated to field width (%d)", numericStringValue, width));
+				return TCL_ERROR;
+			}
+			break;
+		case FTDouble:
+			/* can this value be parsed as a double? */
+			if (Tcl_GetDoubleFromObj(interp, attrValue, &doubleValue) != TCL_OK) {
+				return TCL_ERROR;
+			}
+			/* does this double fit within the field width? */
+			sprintf(numericStringValue, "%.*lf", precision, doubleValue);
+			if (strlen(numericStringValue) > width) {
+				Tcl_SetObjResult(interp, Tcl_ObjPrintf("double value (%s) would be truncated to field width (%d)", numericStringValue, width));
+				return TCL_ERROR;
+			}
+			break;
+		case FTString:
+			/* can this value be parsed as a string? */
+			if ((stringValue = Tcl_GetString(attrValue)) == NULL) {
+				return TCL_ERROR;
+			}
+
+			/* does this string fit within the field width? */
+			if (strlen(stringValue) > width) {
+				Tcl_SetObjResult(interp, Tcl_ObjPrintf("string value (%s) would be truncated to field width (%d)", stringValue, width));
+				return TCL_ERROR;
+			}
+			break;
+		default:
+			break;
+	}
+
+	return TCL_OK;
+}
+
+/* given a list of attributes, check whether they conform to the shapefile's
+   field specification (parseable by type and not truncated). If not, return
+   TCL_ERROR with reason in result. If so, return TCL_OK with no result. */
+int shapefile_util_attrValidate(Tcl_Interp *interp, ShapefilePtr shapefile, Tcl_Obj *attrList) {
+	int fieldi, fieldCount, attrCount;
+	Tcl_Obj *attr;

 	fieldCount = DBFGetFieldCount(shapefile->dbf);
 	if (Tcl_ListObjLength(interp, attrList, &attrCount) != TCL_OK) {
@@ -905,9 +963,7 @@
 		Tcl_SetObjResult(interp, Tcl_ObjPrintf("attribute count (%d) does not match field count (%d)", attrCount, fieldCount));
 		return TCL_ERROR;
 	}
-
-	/* validation pass - confirm field values can be parsed as field type
-	   (and perhaps check for obvious cases of truncation) before output */
+
 	for (fieldi = 0; fieldi < fieldCount; fieldi++) {

 		/* grab the attr provided for this field */
@@ -915,68 +971,16 @@
 			return TCL_ERROR;
 		}

-		fieldType = DBFGetFieldInfo(shapefile->dbf, fieldi, NULL, &width, &precision);
-
-		/* if it is an empty string {}, we'll write it as a NULL value
-		   regardless of field type */
-		if (Tcl_GetCharLength(attr) == 0) {
-			continue;
-		}
-
-		switch (fieldType) {
-			case FTInteger:
-
-				/* can this value be parsed as an integer? */
-				if (Tcl_GetIntFromObj(interp, attr, &intValue) != TCL_OK) {
-					return TCL_ERROR;
-				}
-
-				/* does this integer fit within the field width? */
-				sprintf(numericStringValue, "%d", intValue);
-				if (strlen(numericStringValue) > width) {
-					Tcl_SetObjResult(interp, Tcl_ObjPrintf("integer value (%s) would be truncated to field width (%d)", numericStringValue, width));
-					return TCL_ERROR;
-				}
-				break;
-			case FTDouble:
-
-				/* can this value be parsed as a double? */
-				if (Tcl_GetDoubleFromObj(interp, attr, &doubleValue) != TCL_OK) {
-					return TCL_ERROR;
-				}
-
-				/* does this double fit within the field width? */
-				sprintf(numericStringValue, "%.*lf", precision, doubleValue);
-				if (strlen(numericStringValue) > width) {
-					Tcl_SetObjResult(interp, Tcl_ObjPrintf("double value (%s) would be truncated to field width (%d)", numericStringValue, width));
-					return TCL_ERROR;
-				}
-				break;
-			case FTString:
-
-				/* can this value be parsed as a string? */
-				if ((stringValue = Tcl_GetString(attr)) == NULL) {
-					return TCL_ERROR;
-				}
-
-				/* does this string fit within the field width? */
-				if (strlen(stringValue) > width) {
-					Tcl_SetObjResult(interp, Tcl_ObjPrintf("string value (%s) would be truncated to field width (%d)", stringValue, width));
-					return TCL_ERROR;
-				}
-				break;
-			default:
-				/* NULL values will be written for unsupported field types */
-				continue;
-				break;
-		}
-	}
-
-	Tcl_SetObjResult(interp, attrList);
+		/* validate this field */
+		if (shapefile_util_attrValidateField(interp, shapefile, fieldi, attr) != TCL_OK) {
+			return TCL_ERROR;
+		}
+	}
+
 	return TCL_OK;
 }

-int shapefile_util_attrWriteField(Tcl_Interp *interp, ShapefilePtr shapefile, int recordId, int fieldId, Tcl_Obj *attrValue) {
+int shapefile_util_attrWriteField(Tcl_Interp *interp, ShapefilePtr shapefile, int recordId, int fieldId, int validate, Tcl_Obj *attrValue) {

 	int dbfCount, fieldCount;

@@ -1002,6 +1006,10 @@
 	fieldCount = DBFGetFieldCount(shapefile->dbf);
 	if (fieldId < 0 || fieldId >= fieldCount) {
 		Tcl_SetObjResult(interp, Tcl_ObjPrintf("invalid field index %d", fieldId));
+		return TCL_ERROR;
+	}
+
+	if (validate && (shapefile_util_attrValidateField(interp, shapefile, fieldId, attrValue) != TCL_OK)) {
 		return TCL_ERROR;
 	}

@@ -1066,13 +1074,6 @@
 		recordId = dbfCount;
 	}

-	/* now recordId is either the id of an existing record to overwrite,
-	   or the id-elect of a new record we will create. Unlike shape output,
-	   we use predicted id instead of -1 because each field value must be
-	   written by a separate DBF*Writer function call, and we don't want
-	   to write each value to a different new record! */
-
-	/* verify the provided attribute value list matches field count */
 	fieldCount = DBFGetFieldCount(shapefile->dbf);

 	/* as a special case, simply write null values for all fields if attrList is NULL */
@@ -1087,6 +1088,7 @@
 		return TCL_OK;
 	}

+	/* verify the provided attribute value list matches field count */
 	if (Tcl_ListObjLength(interp, attrList, &attrCount) != TCL_OK) {
 		return TCL_ERROR;
 	}
@@ -1111,7 +1113,7 @@
 		}

 		/* writes value attr to field fieldi of record recordId; sets interp result to recordId */
-		if (shapefile_util_attrWriteField(interp, shapefile, recordId, fieldi, attr) != TCL_OK) {
+		if (shapefile_util_attrWriteField(interp, shapefile, recordId, fieldi, 0 /* no validation */, attr) != TCL_OK) {
 			return TCL_ERROR;
 		}
 	}
@@ -1119,7 +1121,6 @@
 	Tcl_SetObjResult(interp, Tcl_NewIntObj(recordId));
 	return TCL_OK;
 }
-

 int shapefile_util_attrReadField(Tcl_Interp *interp, ShapefilePtr shapefile, int recordId, int fieldId) {
 	int dbfCount, fieldCount;
@@ -1317,7 +1318,7 @@
 				return TCL_ERROR;
 			}

-			if (shapefile_util_attrWriteField(interp, shapefile, recordId, fieldId, objv[5]) != TCL_OK) {
+			if (shapefile_util_attrWriteField(interp, shapefile, recordId, fieldId, 1 /* validate */, objv[5]) != TCL_OK) {
 				return TCL_ERROR;
 			}
 		} else {


replace gru compute with details

replace gru compute with details

--- paddle/fluid/operators/gru_op.h
+++ paddle/fluid/operators/gru_op.h
@@ -16,7 +16,10 @@
 #include <string>
 #include "paddle/fluid/framework/eigen.h"
 #include "paddle/fluid/framework/op_registry.h"
+#include "paddle/fluid/operators/math/blas.h"
 #include "paddle/fluid/operators/math/detail/activation_functions.h"
+#include "paddle/fluid/operators/math/detail/gru_cpu_kernel.h"
+#include "paddle/fluid/operators/math/detail/gru_kernel.h"
 #include "paddle/fluid/operators/math/gru_compute.h"
 #include "paddle/fluid/operators/math/math_function.h"
 #include "paddle/fluid/operators/math/sequence2batch.h"
@@ -94,6 +97,7 @@
         context.Attr<std::string>("activation"));
     auto active_gate = math::detail::GetActivationType(
         context.Attr<std::string>("gate_activation"));
+    auto blas = math::GetBlas<DeviceContext, T>(dev_ctx);
     for (size_t n = 0; n < num_batch; n++) {
       int bstart = static_cast<int>(batch_starts[n]);
       int bend = static_cast<int>(batch_starts[n + 1]);
@@ -105,9 +109,27 @@
       gru_value.output_value = hidden_t.data<T>();
       gru_value.gate_value = gate_t.data<T>();
       gru_value.reset_output_value = reset_hidden_prev_t.data<T>();
-      math::GRUUnitFunctor<DeviceContext, T>::compute(
-          dev_ctx, gru_value, frame_size, cur_batch_size, active_node,
-          active_gate);
+      if (gru_value.prev_out_value) {
+        blas.GEMM(false, false, cur_batch_size, frame_size * 2, frame_size, 1,
+                  gru_value.prev_out_value, frame_size, gru_value.gate_weight,
+                  frame_size * 2, 1, gru_value.gate_value, frame_size * 3);
+      }
+
+      math::detail::forward_reset_output(
+          math::detail::forward::gru_resetOutput<T>(), gru_value, frame_size,
+          cur_batch_size, active_gate);
+
+      if (gru_value.prev_out_value) {
+        blas.GEMM(false, false, cur_batch_size, frame_size, frame_size, 1,
+                  gru_value.reset_output_value, frame_size,
+                  gru_value.state_weight, frame_size, 1,
+                  gru_value.gate_value + frame_size * 2, frame_size * 3);
+      }
+
+      math::detail::forward_final_output(
+          math::detail::forward::gru_finalOutput<T>(), gru_value, frame_size,
+          cur_batch_size, active_node);
+
       gru_value.prev_out_value = gru_value.output_value;
     }


Draft: attributes getter command

Draft: attributes getter command

--- shapetcl.c
+++ shapetcl.c
@@ -217,6 +217,57 @@
 	return TCL_OK;
 }

+int shapefile_cmd_attributes(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
+	ShapefilePtr shapefile = (ShapefilePtr)clientData;
+	int recordId, dbfCount;
+	int fieldCount, fieldi;
+	DBFFieldType fieldType;
+	Tcl_Obj *attributes;
+
+	if (objc != 3) {
+		Tcl_WrongNumArgs(interp, 2, objv, "ID");
+		return TCL_ERROR;
+	}
+
+	if (Tcl_GetIntFromObj(interp, objv[2], &recordId) != TCL_OK)
+		return TCL_ERROR;
+
+	dbfCount = DBFGetRecordCount(shapefile->dbf);
+	if (recordId < 0 || recordId >= dbfCount) {
+		Tcl_SetResult(interp, "invalid record id", TCL_STATIC);
+		return TCL_ERROR;
+	}
+
+	attributes = Tcl_NewListObj(0, NULL);
+
+	/* should check DBFIsAttributeNULL first */
+	fieldCount = DBFGetFieldCount(shapefile->dbf);
+	for (fieldi = 0; fieldi < fieldCount; fieldi++) {
+		fieldType = DBFGetFieldInfo(shapefile->dbf, fieldi, NULL, NULL, NULL);
+		switch (fieldType) {
+			case FTInteger:
+				if (Tcl_ListObjAppendElement(interp, attributes,
+						Tcl_NewIntObj(DBFReadIntegerAttribute(shapefile->dbf, recordId, fieldi))) != TCL_OK)
+					return TCL_ERROR;
+				break;
+			case FTDouble:
+				if (Tcl_ListObjAppendElement(interp, attributes,
+						Tcl_NewDoubleObj(DBFReadDoubleAttribute(shapefile->dbf, recordId, fieldi))) != TCL_OK)
+					return TCL_ERROR;
+				break;
+			case FTString:
+			default:
+				/* for now, just return the string value of any other field types */
+				if (Tcl_ListObjAppendElement(interp, attributes,
+						Tcl_NewStringObj(DBFReadStringAttribute(shapefile->dbf, recordId, fieldi), -1)) != TCL_OK)
+					return TCL_ERROR;
+				break;
+		}
+	}
+
+	Tcl_SetObjResult(interp, attributes);
+	return TCL_OK;
+}

 /* dispatches subcommands */
 int shapefile_commands(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
@@ -241,6 +292,8 @@
 		return shapefile_cmd_mode(clientData, interp, objc, objv);
 	else if (strcmp(subcommand, "fields") == 0)
 		return shapefile_cmd_fields(clientData, interp, objc, objv);
+	else if (strcmp(subcommand, "attributes") == 0)
+		return shapefile_cmd_attributes(clientData, interp, objc, objv);

 	Tcl_SetResult(interp, "unrecognized subcommand", TCL_STATIC);
 	return TCL_ERROR;


Sync Copy

Sync Copy

--- paddle/fluid/pybind/tensor_py.h
+++ paddle/fluid/pybind/tensor_py.h
@@ -190,6 +190,7 @@
       static_cast<const platform::CUDADeviceContext *>(pool.Get(place));
   paddle::platform::GpuMemcpyAsync(dst, array.data(), sizeof(T) * array.size(),
                                    cudaMemcpyHostToDevice, dev_ctx->stream());
+  dev_ctx->Wait();
 }

 template <>


mDNS: trivial, removed TODO from code for something that was implemented

--- lib/mdns/src/mdns.c
+++ lib/mdns/src/mdns.c
@@ -383,7 +383,7 @@
 }

 int
-isInFilteredList(union olsr_ip_addr *src){//TODO: implement here check if IP is in filtered list
+isInFilteredList(union olsr_ip_addr *src){

   struct FilteredHost *tmp, *iterator;


Defined ARRAY_TYPE(uint).

Defined ARRAY_TYPE(uint).

--- src/lib/array-decl.h
+++ src/lib/array-decl.h
@@ -17,6 +17,7 @@
 ARRAY_DEFINE_TYPE(string, char *);
 ARRAY_DEFINE_TYPE(const_string, const char *);
 ARRAY_DEFINE_TYPE(uint32_t, uint32_t);
+ARRAY_DEFINE_TYPE(uint, unsigned int);
 ARRAY_DEFINE_TYPE(void_array, void *);

 #endif