Start adding stuff to the reconstruction class.

--- src/libmv/multiview/reconstruction.h
+++ src/libmv/multiview/reconstruction.h
@@ -83,21 +83,35 @@
 //     Need fast "Image has Camera?" query.
 //

+// Possible signatures:
+//
+//   ReconstructFromTwoViews(Matches, ID, ID, Matches *, Reconstruction *);
+//   ReconstructFromThreeViews(Matches, ID, ID, ID, Matches *, Reconstruction *);
+//   CameraResection(Matches, ID, Matches *, Reconstruction *);
+//   MergeReconstructions(Matches, Reconstruction &, Reconstruction &, Matches *, Reconstruction *);
+//   BundleAdjust(Matches, Reconstruction *);
+
+// The reconstruction takes ownership of camera and structure.
 class Reconstruction {
-  typedef BipartiteGraph<const Camera *, const Feature *, const Structure *>
-          Graph;
-
  public:
-  void Insert(const Camera *camera,
-              const Structure *structure,
-              const Feature *feature) {
-    graph_.Insert(image, feature, track);
+  void Insert(FrameID id, const Camera *camera) {
+    map<FrameID, Camera *>::iterator it = cameras.find(id);
+    if (it != cameras.end()) {
+      delete it->second;
+    }
+    it->second = camera;
+  }
+  void Insert(TrackID id, const Structure *structure) {
+    map<FrameID, Structure *>::iterator it = structure.find(id);
+    if (it != structure.end()) {
+      delete it->second;
+    }
+    it->second = structure;
   }

-  // Finish me!
-
  private:
-  Graph graph_;
+  map<FrameID, Camera *> cameras;
+  map<TrackID, Structure *> structure;
 };

 }  // namespace libmv


director: Make sure ring syncing doesn't get lost when directors get disconnected.

--- src/director/director-connection.c
+++ src/director/director-connection.c
@@ -675,40 +675,25 @@
 	return FALSE;
 }

-static bool director_connection_sync(struct director_connection *conn,
-				     const char *const *args, const char *line)
+static void
+director_connection_sync_host(struct director_connection *conn,
+			      struct director_host *host,
+			      uint32_t seq, const char *line)
 {
 	struct director *dir = conn->dir;
-	struct director_host *host;
-	struct ip_addr ip;
-	unsigned int port, seq;
-
-	if (str_array_length(args) != 3 ||
-	    !director_args_parse_ip_port(conn, args, &ip, &port) ||
-	    str_to_uint(args[2], &seq) < 0) {
-		i_error("director(%s): Invalid SYNC args", conn->name);
-		return FALSE;
-	}
-
-	/* find the originating director. if we don't see it, it was already
-	   removed and we can ignore this sync. */
-	host = director_host_lookup(dir, &ip, port);
-	if (host == NULL)
-		return TRUE;

 	if (host->self) {
 		if (dir->sync_seq != seq) {
 			/* stale SYNC event */
-			return TRUE;
+			return;
 		}

 		if (!dir->ring_handshaked) {
 			/* the ring is handshaked */
 			director_set_ring_handshaked(dir);
 		} else if (dir->ring_synced) {
-			i_error("Received SYNC from %s (seq=%u) "
-				"while already synced", conn->name, seq);
-			return TRUE;
+			/* duplicate SYNC (which was sent just in case the
+			   previous one got lost) */
 		} else {
 			if (dir->debug) {
 				i_debug("Ring is synced (%s sent seq=%u)",
@@ -716,13 +701,43 @@
 			}
 			director_set_ring_synced(dir);
 		}
-		return TRUE;
-	}
-
-	/* forward it to the connection on right */
-	if (dir->right != NULL) {
+	} else {
+		/* forward it to the connection on right */
+		if (dir->right != NULL) {
+			director_connection_send(dir->right,
+				t_strconcat(line, "\n", NULL));
+		}
+	}
+}
+
+static bool director_connection_sync(struct director_connection *conn,
+				     const char *const *args, const char *line)
+{
+	struct director *dir = conn->dir;
+	struct director_host *host;
+	struct ip_addr ip;
+	unsigned int port, seq;
+
+	if (str_array_length(args) != 3 ||
+	    !director_args_parse_ip_port(conn, args, &ip, &port) ||
+	    str_to_uint(args[2], &seq) < 0) {
+		i_error("director(%s): Invalid SYNC args", conn->name);
+		return FALSE;
+	}
+
+	/* find the originating director. if we don't see it, it was already
+	   removed and we can ignore this sync. */
+	host = director_host_lookup(dir, &ip, port);
+	if (host != NULL)
+		director_connection_sync_host(conn, host, seq, line);
+
+	if (!dir->ring_synced && dir->left != NULL && dir->right != NULL &&
+	    (host == NULL || !host->self)) {
+		/* send a new SYNC in case the previous one got dropped */
 		director_connection_send(dir->right,
-					 t_strconcat(line, "\n", NULL));
+			t_strdup_printf("SYNC\t%s\t%u\t%u\n",
+					net_ip2addr(&dir->self_ip),
+					dir->self_port, dir->sync_seq));
 	}
 	return TRUE;
 }


Break up overly long statements.

Break up overly long statements.

	A monster function declaration and if condition.

--- mi/match.c
+++ mi/match.c
@@ -39,7 +39,10 @@
 };

 Dtree *gendtree(Node *m, Node *val, Node **lbl, size_t nlbl);
-static int addpat(Node *pat, Node *val, Dtree *start, Dtree *accept, Node ***cap, size_t *ncap, Dtree ***end, size_t *nend);
+static int addpat(Node *pat, Node *val,
+		Dtree *start, Dtree *accept,
+		Node ***cap, size_t *ncap,
+		Dtree ***end, size_t *nend);
 void dtreedump(FILE *fd, Dtree *dt);

@@ -248,9 +251,13 @@

 static int isnonrecursive(Dtree *dt, Type *ty)
 {
-	return istyprimitive(ty) || ty->type == Tyvoid || ty->type == Tyfunc ||
-	ty->type == Typtr || (ty->type == Tystruct && ty->nmemb == 0) ||
-	(ty->type == Tyarray && fold(ty->asize, 1)->expr.args[0]->lit.intval == 0);
+	if (istyprimitive(ty) || ty->type == Tyvoid || ty->type == Tyfunc || ty->type == Typtr)
+		return 1;
+	if (ty->type == Tystruct)
+		return ty->nmemb == 0;
+	if (ty->type == Tyarray)
+		return fold(ty->asize, 1)->expr.args[0]->lit.intval == 0;
+	return 0;
 }

 static int ismatchable(Type *ty)


fix MIC::double_m::isFull - sadly ICC generates very inefficient code

--- mic/mask.h
+++ mic/mask.h
@@ -31,7 +31,11 @@
 template<unsigned int VectorSize> struct MaskHelper;
 template<> struct MaskHelper<8> {
     typedef __mmask8  Type;
-    static inline bool isFull (Type k) { k = _mm512_kmovlhb(k, k); return _mm512_kortestc(k, k); }
+    static inline bool isFull (Type k) {
+        //__mmask16 kk; asm("kmerge2l1l %[in],%[out]" : [out]"=k"(kk) : [in]"k"(k));
+        __mmask16 kk = _mm512_kmovlhb(k, k);
+        return _mm512_kortestc(kk, kk);
+    }
     static inline bool isEmpty(Type k) { return _mm512_kortestz(k, k); }
     static inline bool isNotEmpty(Type k) { return !isEmpty(k); }
     static inline bool isMix  (Type k) { return !isFull(k) && !isEmpty(k); }


libtracker-extract: XMP: Protect against division by zero

--- src/libtracker-extract/tracker-xmp.c
+++ src/libtracker-extract/tracker-xmp.c
@@ -163,7 +163,10 @@
 		cpy [ptr - value] = '\0';
 		a = atoi (cpy);
 		b = atoi (cpy + (ptr - value) + 1);
-		ret = g_strdup_printf ("%G", ((gdouble)((gdouble) a / (gdouble) b)));
+		if (b != 0)
+			ret = g_strdup_printf ("%G", ((gdouble)((gdouble) a / (gdouble) b)));
+		else
+			ret = NULL;
 		g_free (cpy);
 	} else {
 		ret = g_strdup (value);


Write CXXFlags to Rakefile

Write CXXFlags to Rakefile

--- tools/corto/src/cortotool_build.c
+++ tools/corto/src/cortotool_build.c
@@ -97,6 +97,9 @@
     }
     if (corto_ll_size(package->cflags)) {
         cortotool_printCortoListAsRubyArray(rakefile, "CFLAGS", package->cflags);
+    }
+    if (corto_ll_size(package->cxxflags)) {
+        cortotool_printCortoListAsRubyArray(rakefile, "CXXFLAGS", package->cxxflags);
     }
     if (!package->managed) {
         fprintf((FILE*)rakefile, "NOCORTO = true\n");
@@ -395,7 +398,7 @@
             verbose ? "verbose=true" : "verbose=false",
             NULL
           }, silent != NULL, mute != NULL);
-
+
         /* Reset to previous CWD if there is more than one project to build */
         corto_chdir(cwd);


Fixed entity component enable/disable

Fixed entity component enable/disable

--- src/dreemchest/Ecs/Entity/Entity.h
+++ src/dreemchest/Ecs/Entity/Entity.h
@@ -78,9 +78,13 @@
 		template<typename TComponent>
 		void					disable( void );

+		//! Enables of disables the component of specified type.
+		template<typename TComponent>
+		void					setComponentEnabled( bool value );
+
 		//! Returns true if the component of specified type is enabled.
 		template<typename TComponent>
-		void					isEnabled( void ) const;
+		bool					isEnabled( void ) const;

 		//! Attaches the created component to an entity.
 		template<typename TComponent>
@@ -169,25 +173,30 @@
 	template<typename TComponent>
 	void Entity::enable( void )
 	{
+		setComponentEnabled<TComponent>( true );
+	}
+
+	// ** Entity::disable
+	template<typename TComponent>
+	void Entity::disable( void )
+	{
+		setComponentEnabled<TComponent>( false );
+	}
+
+	// ** Entity::setComponentEnabled
+	template<typename TComponent>
+	void Entity::setComponentEnabled( bool value )
+	{
 		TComponent* component = get<TComponent>();
-		component->setEnabled( true );
-		updateComponentBit( component->typeIndex(), true );
-	}
-
-	// ** Entity::disable
-	template<typename TComponent>
-	void Entity::disable( void )
-	{
-		TComponent* component = get<TComponent>();
-		component->setEnabled( true );
-		updateComponentBit( component->typeIndex(), false );
+		component->setEnabled( value );
+		updateComponentBit( component->typeIndex(), value );
 	}

 	// ** Entity::isEnabled
 	template<typename TComponent>
-	void Entity::isEnabled( void ) const
-	{
-		return get<TComponent>->isEnabled();
+	bool Entity::isEnabled( void ) const
+	{
+		return get<TComponent>()->isEnabled();
 	}

 	// ** Entity::attach


login proxy: Set notify fd nonblocking.

login proxy: Set notify fd nonblocking.

--- src/login-common/login-proxy-state.c
+++ src/login-common/login-proxy-state.c
@@ -4,6 +4,7 @@
 #include "network.h"
 #include "hash.h"
 #include "strescape.h"
+#include "fd-set-nonblock.h"
 #include "login-proxy-state.h"

 #include <unistd.h>
@@ -96,6 +97,7 @@
 		state->notify_fd_broken = TRUE;
 		return -1;
 	}
+	fd_set_nonblock(state->notify_fd, TRUE);
 	return 0;
 }


Refcounting fixes. Unexpectedly destroyed SSL connection could have left looping for a long time.

--- src/login-common/ssl-proxy-openssl.c
+++ src/login-common/ssl-proxy-openssl.c
@@ -368,6 +368,8 @@

 void ssl_proxy_free(struct ssl_proxy *proxy)
 {
+	if (!proxy->destroyed)
+		ssl_proxy_destroy(proxy);
 	ssl_proxy_unref(proxy);
 }

@@ -376,6 +378,19 @@
 	if (--proxy->refcount > 0)
 		return TRUE;
 	i_assert(proxy->refcount == 0);
+
+	SSL_free(proxy->ssl);
+	i_free(proxy);
+
+	main_unref();
+	return FALSE;
+}
+
+static void ssl_proxy_destroy(struct ssl_proxy *proxy)
+{
+	if (proxy->destroyed)
+		return;
+	proxy->destroyed = TRUE;

 	hash_remove(ssl_proxies, proxy);

@@ -391,19 +406,7 @@
 	if (proxy->io_plain_write != NULL)
 		io_remove(proxy->io_plain_write);

-	SSL_free(proxy->ssl);
-	i_free(proxy);
-
-	main_unref();
-	return FALSE;
-}
-
-static void ssl_proxy_destroy(struct ssl_proxy *proxy)
-{
-	if (!proxy->destroyed) {
-		proxy->destroyed = TRUE;
-		ssl_proxy_unref(proxy);
-	}
+	ssl_proxy_unref(proxy);
 }

 static RSA *ssl_gen_rsa_key(SSL *ssl __attr_unused__,


perf annotate browser: Count the numbers of jump sources to a target

Instead of simply marking an offset as a jump target. So that we can
implement a new feature: showing "jumpy" targets, I.e. addresses that
lots of places jump to.

Cc: David Ahern <b80c1600f604d3b0d768f26f90a76757e76005dd@gmail.com>
Cc: Frederic Weisbecker <e8a1bf9163cb25e93cfd6540f223b3872ea7ee55@gmail.com>
Cc: Mike Galbraith <3cfa3897b7f55b5396b7a47c83b66325184bc9b4@gmx.de>
Cc: Namhyung Kim <5c915a589b3ddf58cebf14bec41bcc143b37ac3c@gmail.com>
Cc: Paul Mackerras <19a0ba370c443ba08d20b5061586430ab449ee8c@samba.org>
Cc: Peter Zijlstra <3fddac958924aef220f202ca567388ddab3f14a8@infradead.org>
Cc: Stephane Eranian <f199ae9781930a5b94b284ca2f471140752002a7@google.com>
Link: e4360376b37bc8fb2f660f2d710d6ba45a6bb757@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <293abb6b76d7791c0732cc517d38c4b5c734b87f@redhat.com>

--- tools/perf/ui/browsers/annotate.c
+++ tools/perf/ui/browsers/annotate.c
@@ -16,7 +16,7 @@
 	double		percent;
 	u32		idx;
 	int		idx_asm;
-	bool		jump_target;
+	int		jump_sources;
 };

 struct annotate_browser {
@@ -98,7 +98,7 @@
 		if (!ab->use_offset) {
 			printed = scnprintf(bf, sizeof(bf), "%" PRIx64 ": ", addr);
 		} else {
-			if (bdl->jump_target) {
+			if (bdl->jump_sources) {
 				printed = scnprintf(bf, sizeof(bf), "%*" PRIx64 ": ",
 						    ab->addr_width, addr);
 			} else {
@@ -707,7 +707,7 @@
 			continue;

 		bdlt = disasm_line__browser(dlt);
-		bdlt->jump_target = true;
+		++bdlt->jump_sources;
 	}

 }


Record some thoughts

Record some thoughts

--- HgScene.h
+++ HgScene.h
@@ -1,6 +1,13 @@
 #pragma once

 #include <HgElement.h>
+
+/* HgScene could be reworked into a linked list (or array of pointers to list items) with each
+list item containing 512 elements and a used map. We could still index into the linked list
+by using the first 9 least significant bits to represent 512 elements. The last 7 MSB could
+index into the array of list items. This would allow both indexing and valid HgElement
+pointers for the duration of program execution.
+*/

 typedef struct HgScene {
 	HgElement* elements;


Create History.h

Create History.h

History implementation

error: pathspec 'History.h' did not match any file(s) known to git

--- History.h
+++ History.h
@@ -0,0 +1,27 @@
+//
+//  History.h
+//  Project_One
+//
+//  Created by Anirudh Dayal on 1/10/15.
+//  Copyright (c) 2015 CS 31. All rights reserved.
+//
+
+#ifndef __Project_One__History__
+#define __Project_One__History__
+
+#include <stdio.h>
+#include "globals.h"
+
+class History
+{
+public:
+    History(int nRows, int nCols);
+    bool record(int r, int c);
+    void display() const;
+private:
+    int m_r;
+    int m_c;
+    char grid[MAXROWS][MAXCOLS];//[MAXROWS][MAXCOLS] ;
+};
+
+#endif /* defined(__Project_One__History__) */


Generate offsets properly for multithreads in IOR.

--- IOR/IOR.c
+++ IOR/IOR.c
@@ -2504,18 +2504,18 @@

 IOR_offset_t *
-GetOffsetArrayRandom(IOR_param_t *test, int pretendRank, int access)
-{
-    int seed;
+GetOffsetArrayRandom(IOR_param_t *test, int pretendRank, int access, long seed)
+{
     IOR_offset_t i, value, tmp;
     IOR_offset_t offsets = 0, offsetCnt = 0;
     IOR_offset_t fileSize;
     IOR_offset_t *offsetArray;
-	printf("there are %d tasks, pretend rank: %d\n", test->numTasks, pretendRank);
+	printf("there are %d tasks %d threads per task, pretend rank: %d\n",
+			test->numTasks, test->numThreads, pretendRank);

     /* set up seed for random() */
     if (access == WRITE || access == READ) {
-        test->randomSeed = seed = random();
+        test->randomSeed = seed;
     } else {
         seed = test->randomSeed;
     }
@@ -2528,15 +2528,15 @@
 	printf("file size: %lld\n", fileSize);

     /* count needed offsets (pass 1) */
-    for (i = 0; i < fileSize; i += test->transferSize) {
-        if (test->filePerProc == FALSE) {
-            if ((random() % test->numTasks) == pretendRank) {
-                offsets++;
-            }
-        } else {
-            offsets++;
-        }
-    }
+	if (test->filePerProc == FALSE) {
+		for (i = 0; i < fileSize; i += test->transferSize) {
+			if ((random() % (test->numTasks * test->numThreads)) == pretendRank) {
+				offsets++;
+			}
+		}
+	} else {
+		offsets = fileSize / test->transferSize / test->numThreads;
+	}
 	printf("There are %lld offsets\n", offsets);

     /* setup empty array */
@@ -2553,7 +2553,7 @@
         /* fill with offsets (pass 2) */
         srandom(seed); /* need same seed */
         for (i = 0; i < fileSize; i += test->transferSize) {
-            if ((random() % test->numTasks) == pretendRank) {
+            if ((random() % (test->numTasks * test->numThreads)) == pretendRank) {
                 offsetArray[offsetCnt] = i;
                 offsetCnt++;
             }
@@ -2580,8 +2580,6 @@
 	int access;
 	int pretendRank;
 	IOR_offset_t *offsetArray;
-	IOR_offset_t arrStart;
-	IOR_offset_t arrEnd;

 	// output data
 	volatile IOR_offset_t   dataMoved;
@@ -2617,23 +2615,30 @@
     int            errors = 0;
 	volatile int   numCompletes = 0;
 	void *fd;
+	double         startForStonewall;
+	int            hitStonewall;

 	IOR_param_t *test = data->test;
 	int access = data->access;
 	int pretendRank = data->pretendRank;
 	IOR_offset_t *offsetArray = data->offsetArray;
-	IOR_offset_t arrStart = data->arrStart;
-	IOR_offset_t arrEnd = data->arrEnd;
-	IOR_offset_t arrPos = arrStart;
+	IOR_offset_t pairCnt = 0;

 	GetTestFileName(testFileName, test);
 	fd = IOR_Open(testFileName, test);
+
+    /* check for stonewall */
+    startForStonewall = GetTimeStamp();
+    hitStonewall = ((test->deadlineForStonewalling != 0)
+                    && ((GetTimeStamp() - startForStonewall)
+                        > test->deadlineForStonewalling));

 	assert(IOR_AsyncXfer);
 	assert(IOR_SetAsyncCallback);
 	IOR_SetAsyncCallback(fd, XferComplete);
-	while (arrPos < arrEnd) {
-		IOR_offset_t offset = offsetArray[arrPos];
+    /* loop over offsets to access */
+    while ((offsetArray[pairCnt] != -1) && !hitStonewall) {
+		IOR_offset_t offset = offsetArray[pairCnt];
 		struct AsyncData *asyncData = (struct AsyncData *) malloc(sizeof(*asyncData));
 		memset(asyncData, 0, sizeof(*asyncData));
 		SetupXferBuffers(&asyncData->buffer, &asyncData->checkBuffer,
@@ -2670,10 +2675,14 @@
                       &transferCount, access, &errors);
 #endif
         }
-		arrPos++;
+        hitStonewall = ((test->deadlineForStonewalling != 0)
+                        && ((GetTimeStamp() - startForStonewall)
+                            > test->deadlineForStonewalling));
+		pairCnt++;
 	}
 	IOR_Close(fd, test);
-	printf("%lld accesses, %d completes\n", arrEnd - arrStart, numCompletes);
+	printf("access: %d, %lld accesses, %d completes\n",
+			access, pairCnt, numCompletes);

 	data->dataMoved = dataMoved;
 	data->errors = errors;
@@ -2695,22 +2704,29 @@
     IOR_offset_t   dataMoved = 0;             /* for data rate calculation */
     int            errors = 0;
 	void *fd;
+	double         startForStonewall;
+	int            hitStonewall;

 	IOR_param_t *test = data->test;
 	int access = data->access;
 	int pretendRank = data->pretendRank;
 	IOR_offset_t *offsetArray = data->offsetArray;
-	IOR_offset_t arrStart = data->arrStart;
-	IOR_offset_t arrEnd = data->arrEnd;
-	IOR_offset_t arrPos = arrStart;
+	IOR_offset_t pairCnt = 0;

 	GetTestFileName(testFileName, test);
 	fd = IOR_Open(testFileName, test);

+    /* check for stonewall */
+    startForStonewall = GetTimeStamp();
+    hitStonewall = ((test->deadlineForStonewalling != 0)
+                    && ((GetTimeStamp() - startForStonewall)
+                        > test->deadlineForStonewalling));
+
     SetupXferBuffers(&buffer, &checkBuffer, &readCheckBuffer,
                      test, pretendRank, access);
-	while (arrPos < arrEnd) {
-        IOR_offset_t offset = offsetArray[arrPos];
+    /* loop over offsets to access */
+    while ((offsetArray[pairCnt] != -1) && !hitStonewall) {
+        IOR_offset_t offset = offsetArray[pairCnt];
         /*
          * fills each transfer with a unique pattern
          * containing the offset into the file
@@ -2739,11 +2755,15 @@
                       &transferCount, access, &errors);
         }
         dataMoved += amtXferred;
-		arrPos++;
+        hitStonewall = ((test->deadlineForStonewalling != 0)
+                        && ((GetTimeStamp() - startForStonewall)
+                            > test->deadlineForStonewalling));
+		pairCnt++;
 	}
 	data->dataMoved = dataMoved;
 	data->errors = errors;
 	IOR_Close(fd, test);
+	printf("access: %d, pairCnt: %lld\n", access, pairCnt);

     FreeBuffers(access, checkBuffer, readCheckBuffer, buffer, NULL);
 	return NULL;
@@ -2761,8 +2781,7 @@
             int           access)
 {
     int            errors = 0;
-    IOR_offset_t   pairCnt = 0,
-                 * offsetArray;
+    IOR_offset_t * offsetArray;
     int            pretendRank;
     IOR_offset_t   dataMoved = 0;             /* for data rate calculation */
     double         startForStonewall;
@@ -2773,37 +2792,19 @@
     /* initialize values */
     pretendRank = (rank + rankOffset) % test->numTasks;

-    if (test->randomOffset) {
-        offsetArray = GetOffsetArrayRandom(test, pretendRank, access);
-    } else {
-        offsetArray = GetOffsetArraySequential(test, pretendRank);
-    }
-
-    /* check for stonewall */
-//    startForStonewall = GetTimeStamp();
-//    hitStonewall = ((test->deadlineForStonewalling != 0)
-//                    && ((GetTimeStamp() - startForStonewall)
-//                        > test->deadlineForStonewalling));
-
-    /* loop over offsets to access */
-    while ((offsetArray[pairCnt] != -1)) {
-		pairCnt++;
-
-//        hitStonewall = ((test->deadlineForStonewalling != 0)
-//                        && ((GetTimeStamp() - startForStonewall)
-//                            > test->deadlineForStonewalling));
-    }
-	printf("access: %d, pairCnt: %lld\n", access, pairCnt);
 	int numThreads = test->numThreads;
 	struct ThreadData data[numThreads];
-	IOR_offset_t numOffsetsPerThread = pairCnt / numThreads;
+	long seed = random();
 	for (i = 0; i < numThreads; i++) {
 		data[i].test = test;
 		data[i].access = access;
-		data[i].pretendRank = pretendRank;
-		data[i].offsetArray = offsetArray;
-		data[i].arrStart = i * numOffsetsPerThread;
-		data[i].arrEnd = (i + 1) * numOffsetsPerThread;
+		data[i].pretendRank = i;
+		assert(test->randomOffset);
+		if (test->randomOffset) {
+			data[i].offsetArray = GetOffsetArrayRandom(test, i, access, seed);
+		} else {
+			data[i].offsetArray = GetOffsetArraySequential(test, i);
+		}
 		int ret;
 		if (test->useAsync)
 			ret = pthread_create(&data[i].tid, NULL, AsyncThreadWriteOrRead, (void *) &data[i]);
@@ -2818,8 +2819,8 @@
 		pthread_join(data[i].tid, NULL);
 		dataMoved += data[i].dataMoved;
 		errors += data[i].errors;
+		free(offsetArray);
 	}
-	free(offsetArray);

     totalErrorCount += CountErrors(test, access, errors);


demo_client: just waiting, no more checking of data.

--- src/main/c/demo_client/demo_client.c
+++ src/main/c/demo_client/demo_client.c
@@ -77,18 +77,18 @@
 	}

 	CHK_NZPI(init_context(rctx, ucfg), "failed to initialize my RDMA context!");
-	n0 = *((int *)(rctx->buf));
+//	n0 = *((int *)(rctx->buf));
 //	n0 = *((int *)(rctx->buf + rctx->size - sizeof n0));
-	printf("N0: %d\n", n0);
+//	printf("N0: %d\n", n0);
 	CHK_NZPI(connect_to_peer(rctx, ucfg), "failed to connect to peer server!");

 	while(1) {
-		printf("%d", n1 = *((int *)(rctx->buf)));
+//		printf("%d", n1 = *((int *)(rctx->buf)));
 //		printf("%d", n1 = *((int *)(rctx->buf + rctx->size - sizeof n1)));
-		if (n0 != n1) {
-			printf("\nDATA (maybe) WRITTEN!\n");
-			break;
-		}
+//		if (n0 != n1) {
+//			printf("\nDATA (maybe) WRITTEN!\n");
+//			break;
+//		}
 	}

 	destroy_context(rctx);


MOD: Fixing docu for ColourPicker Slider mode

--HG--
branch : v0-8

--- cegui/include/CEGUI/CommonDialogs/ColourPicker/Types.h
+++ cegui/include/CEGUI/CommonDialogs/ColourPicker/Types.h
@@ -41,7 +41,13 @@
 namespace CEGUI
 {

-//! DEPRECATED
+/*!
+\brief
+    Enum defining the ColourPicker Slider mode
+
+\deprecated
+    This enum is deprecated and has been marked for removal.
+*/
 enum ColourPickerSliderMode
 {
     ColourPickerSliderMode_L,


Fix the remaining 'seperated' typos.

Fix the remaining 'seperated' typos.

I forgot to look at the header file when doing
https://github.com/google/bazel/commit/a0592a13c8801f395a17641579f16a3c3bc4587e.

Now I ran the following command line to make sure I didn't miss any:

$ git grep seperated

--
Change-Id: Id834f87667135e91bd0c3024e0a99e52954a7038
MOS_MIGRATED_REVID=93120398

--- src/main/cpp/blaze_startup_options.h
+++ src/main/cpp/blaze_startup_options.h
@@ -55,10 +55,10 @@
   // rcfile should be an empty string if the option being parsed does not come
   // from a blazerc.
   //
-  // Sets "is_space_seperated" true if arg is unary and uses the "--foo bar"
+  // Sets "is_space_separated" true if arg is unary and uses the "--foo bar"
   // style, so its value is in next_arg.
   //
-  // Sets "is_space_seperated" false if arg is either nullary
+  // Sets "is_space_separated" false if arg is either nullary
   // (e.g. "--[no]batch") or is unary but uses the "--foo=bar" style.
   //
   // Returns the exit code after processing the argument. "error" will contain
@@ -66,7 +66,7 @@
   // blaze_exit_code::SUCCESS.
   blaze_exit_code::ExitCode ProcessArg(
       const string &arg, const string &next_arg, const string &rcfile,
-      bool *is_space_seperated, string *error);
+      bool *is_space_separated, string *error);

   // Adds any other options needed to result.
   void AddExtraOptions(std::vector<string> *result) const;


FIX: Correct initialisation values for RGB_Colour

--HG--
branch : v0

--- cegui/include/CEGUI/CommonDialogs/ColourPicker/Types.h
+++ cegui/include/CEGUI/CommonDialogs/ColourPicker/Types.h
@@ -62,7 +62,7 @@
     {}

     RGB_Colour() :
-        r(0.0f), g(0.0f), b(0.0f)
+        r(0), g(0), b(0)
     {}

     RGB_Colour(const Lab_Colour& colour);


this version has all the functions and; theoretically all the variables exported

--- mlp_impl.c
+++ mlp_impl.c
@@ -2,9 +2,12 @@
 // Experimental code of the CARP Project
 // Copyright (c) RealEyes, 2013

+#include <stdlib.h>
 #include <stdint.h>

 const int MAX_INT = 1 << sizeof(int) - 1;
+const int false = (1!=1);
+// const int NULL=0;

 typedef struct {
     int rows;
@@ -25,6 +28,14 @@
     int y;
 } Point2i;

+typedef enum { none, maxAbs, meanStd } NormalizationMethod;
+
+
+MatFloat transposeFloat( MatFloat input )
+{
+
+}
+
 MatChar GetBlockChar( MatChar self, int row_from, int row_to, int col_from, int col_to )
 {

@@ -47,15 +58,122 @@

 }

-MatFloat evaluateSamples()
-{
-
-}
-
-void update( int mapSize )
-{
-
-}
+MatFloat evaluateSamples(
+    MatFloat m_wIn_gemm,
+    MatFloat m_all_patches,
+    MatFloat m_all_bIns,
+    MatFloat m_wOut_gemm,
+    MatFloat m_all_bOuts
+    )
+{
+    // PCA
+    MatFloat xOut;
+    gemmFloat( m_wIn_gemm, m_all_patches, -1., m_all_bIns, -1., xOut ); // cv::gemm
+
+    // input activator
+    MatFloat e;
+    expFloat( xOut, e ); // cv::exp
+    addFloat( e, 1.0, xOut );
+    divideFloat( 2.0, xOut, e );
+    subtractFloat( e, 1.0, xOut );
+
+    // MLP
+    MatFloat dot;
+    gemmFloat( m_wOut_gemm, xOut, -1., m_all_bOuts, -1., dot ); // cv::gemm
+
+    // output activator
+    MatFloat result;
+    expFloat( dot, result ); // expFloat
+    addFloat( result, 1.0, dot ); // addFloat
+    divideFloat( 1.0, dot, result );
+
+    return result;
+} // evaluateSamples
+
+float GetValueFloat( MatFloat self, int x, int y )
+{
+
+}
+
+void SetValueFloat( MatFloat self, int x, int y, float value )
+{
+
+}
+
+
+MatFloat CreateMatFloat( int rows, int cols )
+{
+
+}
+
+void update(
+    int mapSize,
+    NormalizationMethod postSVDNormalizationMethod,
+    MatFloat m_wIn,
+    MatFloat m_U,
+    MatFloat m_wOut,
+    int m_patchSize,
+
+    // results
+    MatFloat * m_wIn_gemm,
+    MatFloat * m_all_bIns,
+    MatFloat * m_all_bOuts,
+    MatFloat * m_all_patches,
+    MatFloat * m_wOut_gemm
+    )
+{
+    MatFloat target;
+
+    int m_currentMapSize = mapSize;
+
+
+    // extract to the creation
+    switch (postSVDNormalizationMethod)
+    {
+    case none:
+
+    {
+	// m_wIn_gemm = m_wIn.colRange( -MAX_INT, MAX_INT, 0, m_wIn.cols - 1 ) *m_U.t();
+	MatFloat littleIn;
+	littleIn = GetBlockFloat( m_wIn, -MAX_INT, MAX_INT, 0, m_wIn.cols - 1 );
+	MatFloat transpU = transposeFloat(m_U);
+	gemmFloat( littleIn, transpU, 1., NULL, 1., *m_wIn_gemm );
+    }
+    break;
+    case maxAbs:
+    case meanStd:
+	// m_wIn_gemm = m_wIn.colRange(0,m_wIn.cols-1);
+	*m_wIn_gemm = GetBlockFloat( m_wIn, -MAX_INT, MAX_INT, 0, m_wIn.cols - 1 );
+	break;
+    default:
+	assert(false);
+    } // postSVDNormalizationMethod
+
+    // MatFloat bIn = m_wIn.col( m_wIn.cols - 1 );
+    MatFloat bIn = GetBlockFloat( m_wIn, -MAX_INT, MAX_INT, m_wIn.cols - 1, m_wIn.cols);
+
+    *m_wOut_gemm = GetBlockFloat( m_wOut, -MAX_INT, MAX_INT, 0, m_wOut.cols - 1 ); ///!!!!!!!!!! NO MORE TRANSPOSE .t();
+
+    float bOut = GetValue(m_wOut, 0, m_wOut.cols - 1);
+
+    int m_number_of_patches_per_line = 2 * m_currentMapSize + 1;
+    // here we assume that the patches are always square-like
+    int number_of_all_patches  = m_number_of_patches_per_line * m_number_of_patches_per_line;
+    int m_patch_line_size = 2 * m_patchSize + 1;
+    int patch_size = m_patch_line_size * m_patch_line_size;
+
+    *m_all_bIns = CreateMatFloat( bIn.rows, number_of_all_patches );
+    *m_all_bOuts = CreateMatFloat( 1, number_of_all_patches );
+    *m_all_patches = CreateMatFloat( m_wIn_gemm->cols, number_of_all_patches );
+
+    int q;
+    for ( q=0; q < number_of_all_patches; q++)
+    {
+	target = GetBlockFloat( *m_all_bIns, -MAX_INT, MAX_INT, q, q+1 );
+	copyTo(bIn, target); // bIn.copyTo(target);
+	SetValueFloat( *m_all_bOuts, 0, q, bOut);
+    }
+} // update

 void copyToFloat( MatFloat src, MatFloat dst )
 {
@@ -69,13 +187,37 @@
     int mapSize,
     int m_patchSize,
     int m_patch_line_size,
-    MatFloat m_all_patches,
-    int m_number_of_patches_per_line
+    int m_number_of_patches_per_line,
+    NormalizationMethod postSVDNormalizationMethod,
+    MatFloat m_wIn,
+    MatFloat m_U,
+    MatFloat m_wOut
     )
 {
+
+    MatFloat m_wIn_gemm;
+    MatFloat m_all_bIns;
+    MatFloat m_all_bOuts;
+    MatFloat m_all_patches;
+    MatFloat m_wOut_gemm;
+
     // make sure that we have the necessary matrices
     // calculated (this is a method; it is NOT thread safe!), but it is called for each classifier once
-    update(mapSize);
+    update(
+	// parameters
+	mapSize,
+	postSVDNormalizationMethod,
+	m_wIn,
+	m_U,
+	m_wOut,
+	m_patchSize,
+	// results
+	&m_wIn_gemm,
+	&m_all_bIns,
+	&m_all_bOuts,
+	&m_all_patches,
+	&m_wOut_gemm
+	);

     int ncy, cy;
     for ( ncy = 0, cy = center.y - mapSize; cy < center.y + mapSize + 1; ++ncy, ++cy ) {
@@ -86,7 +228,13 @@
         copyToFloat( pack_patches, target );
     }

-    MatFloat result = evaluateSamples();
+    MatFloat result = evaluateSamples(
+	m_wIn_gemm,
+	m_all_patches,
+	m_all_bIns,
+	m_wOut_gemm,
+	m_all_bOuts
+	);

     return reshape( result, 0, m_number_of_patches_per_line );


detour_next(): Store the original function pointer at the end of the chain.

--- thcrap/src/mempatch.c
+++ thcrap/src/mempatch.c
@@ -243,8 +243,8 @@

 size_t detour_next(const char *dll_name, const char *func_name, void *caller, size_t arg_count, ...)
 {
-	json_t *funcs = json_object_get(detours, dll_name);
-	json_t *ptrs = json_object_get(funcs, func_name);
+	json_t *funcs = json_object_get_create(detours, dll_name, JSON_OBJECT);
+	json_t *ptrs = json_object_get_create(funcs, func_name, JSON_ARRAY);
 	json_t *ptr = NULL;
 	FARPROC next = NULL;
 	size_t i;
@@ -269,6 +269,9 @@
 	if(!next) {
 		HMODULE hDll = GetModuleHandleA(dll_name);
 		next = GetProcAddress(hDll, func_name);
+		// Storing the original pointers at the end of the chain
+		// yields a 5x performance increase!
+		json_array_append_new(ptrs, json_integer((size_t)next));
 	}
 	if(!next) {
 		log_printf(


INTEGRATION: CWS sdk02 (1.1.2); FILE ADDED 2003/05/09 11:51:28 jsc 1.1.2.1: #109045# insert new and remove example zip file

error: pathspec 'odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/nativelib/unix/nativeview.c' did not match any file(s) known to git

--- odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/nativelib/unix/nativeview.c
+++ odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/nativelib/unix/nativeview.c
@@ -0,0 +1,138 @@
+/*************************************************************************
+ *
+ *  $RCSfile: nativeview.c,v $
+ *
+ *  $Revision: 1.2 $
+ *
+ *  last change: $Author: vg $ $Date: 2003-06-10 10:32:03 $
+ *
+ *  The Contents of this file are made available subject to the terms of
+ *  either of the following licenses
+ *
+ *         - GNU Lesser General Public License Version 2.1
+ *         - Sun Industry Standards Source License Version 1.1
+ *
+ *  Sun Microsystems Inc., October, 2000
+ *
+ *  GNU Lesser General Public License Version 2.1
+ *  =============================================
+ *  Copyright 2000 by Sun Microsystems, Inc.
+ *  901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License version 2.1, as published by the Free Software Foundation.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this library; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ *  MA  02111-1307  USA
+ *
+ *
+ *  Sun Industry Standards Source License Version 1.1
+ *  =================================================
+ *  The contents of this file are subject to the Sun Industry Standards
+ *  Source License Version 1.1 (the "License"); You may not use this file
+ *  except in compliance with the License. You may obtain a copy of the
+ *  License at http://www.openoffice.org/license.html.
+ *
+ *  Software provided under this License is provided on an "AS IS" basis,
+ *  WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ *  WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ *  MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ *  See the License for the specific provisions governing your rights and
+ *  obligations concerning the Software.
+ *
+ *  The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ *  Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ *  All Rights Reserved.
+ *
+ *  Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include <X11/Intrinsic.h>
+
+#include "jawt.h"
+#include "jawt_md.h"
+#include "nativeview.h"
+
+#define MY_ASSERT(X,S) if (!X) { fprintf(stderr,S); return 0L;}
+
+#define SYSTEM_WIN32   1
+#define SYSTEM_WIN16   2
+#define SYSTEM_JAVA    3
+#define SYSTEM_OS2     4
+#define SYSTEM_MAC     5
+#define SYSTEM_XWINDOW 6
+
+/*****************************************************************************/
+/*
+ * Class:     NativeView
+ * Method:    getNativeWindowSystemType
+ * Signature: ()I
+ */
+JNIEXPORT jint JNICALL Java_OfficeDev_samples_DesktopEnvironment_NativeView_getNativeWindowSystemType
+  (JNIEnv * env, jobject obj_this)
+{
+    return (SYSTEM_XWINDOW);
+}
+
+/*****************************************************************************/
+/*
+ * Class:     NativeView
+ * Method:    getNativeWindow
+ * Signature: ()J
+ */
+JNIEXPORT jlong JNICALL Java_OfficeDev_samples_DesktopEnvironment_NativeView_getNativeWindow
+  (JNIEnv * env, jobject obj_this)
+{
+    jboolean                    result  ;
+    jint                        lock    ;
+    JAWT                        awt     ;
+    JAWT_DrawingSurface*        ds      ;
+    JAWT_DrawingSurfaceInfo*    dsi     ;
+    JAWT_X11DrawingSurfaceInfo* dsi_x11 ;
+    Drawable                    drawable;
+    Display*                    display ;
+
+    /* Get the AWT */
+    awt.version = JAWT_VERSION_1_3;
+    result      = JAWT_GetAWT(env, &awt);
+    MY_ASSERT(result != JNI_FALSE,"wrong jawt version");
+
+    /* Get the drawing surface */
+    if ((ds = awt.GetDrawingSurface(env, obj_this)) == NULL)
+        return 0L;
+
+    /* Lock the drawing surface */
+    lock = ds->Lock(ds);
+    MY_ASSERT((lock & JAWT_LOCK_ERROR)==0,"can't lock the drawing surface");
+
+    /* Get the drawing surface info */
+    dsi = ds->GetDrawingSurfaceInfo(ds);
+
+    /* Get the platform-specific drawing info */
+    dsi_x11  = (JAWT_X11DrawingSurfaceInfo*)dsi->platformInfo;
+    drawable = dsi_x11->drawable;
+    display  = dsi_x11->display;
+
+    /* Free the drawing surface info */
+    ds->FreeDrawingSurfaceInfo(dsi);
+    /* Unlock the drawing surface */
+    ds->Unlock(ds);
+    /* Free the drawing surface */
+    awt.FreeDrawingSurface(ds);
+
+    return ((jlong)drawable);
+}


deleted unnecessary subaru safety init and using nooutput_init instead

--- board/safety/safety_subaru.h
+++ board/safety/safety_subaru.h
@@ -14,8 +14,6 @@
 uint32_t subaru_ts_last = 0;
 struct sample_t subaru_torque_driver;         // last few driver torques measured

-static void subaru_init(int16_t param) {
-}

 static void subaru_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) {
   int bus_number = (to_push->RDTR >> 4) & 0xFF;
@@ -133,7 +131,7 @@
 }

 const safety_hooks subaru_hooks = {
-  .init = subaru_init,
+  .init = nooutput_init,
   .rx = subaru_rx_hook,
   .tx = subaru_tx_hook,
   .tx_lin = nooutput_tx_lin_hook,


add glut common typedef

add glut common typedef

--- Parallel_RVD/Common.h
+++ Parallel_RVD/Common.h
@@ -12,6 +12,11 @@
 	typedef unsigned int t_index;

 	typedef int signed_t_index;
+
+	/*
+		for glut
+	*/
+	typedef unsigned int uint;

 	/*
 		find the min value


Remove branch designation from version string.

--- mod_wsgi.c
+++ mod_wsgi.c
@@ -387,7 +387,7 @@

 #define MOD_WSGI_MAJORVERSION_NUMBER 3
 #define MOD_WSGI_MINORVERSION_NUMBER 5
-#define MOD_WSGI_VERSION_STRING "3.5-BRANCH"
+#define MOD_WSGI_VERSION_STRING "3.5"

 #if AP_SERVER_MAJORVERSION_NUMBER < 2
 module MODULE_VAR_EXPORT wsgi_module;


made PointerSignalFilter filter Pen and Finger signals

--- PointerSignalFilter.h
+++ PointerSignalFilter.h
@@ -15,7 +15,13 @@
 				pipeline::FilterSignal<MouseUp,
 				pipeline::FilterSignal<MouseDown,
 				pipeline::FilterSignal<MouseMove,
-				pipeline::FilterSignalsAs<PointerSignal> > > > > {};
+				pipeline::FilterSignal<FingerUp,
+				pipeline::FilterSignal<FingerDown,
+				pipeline::FilterSignal<FingerMove,
+				pipeline::FilterSignal<PenUp,
+				pipeline::FilterSignal<PenDown,
+				pipeline::FilterSignal<PenMove,
+				pipeline::FilterSignalsAs<PointerSignal> > > > > > > > > > > {};

 } // namespace gui


Add a comment to reflect API reality in RenderWidgetHostView.
See also http://codereview.chromium.org/113204 .

TBR=sky

Review URL: http://codereview.chromium.org/113224

git-svn-id: http://src.chromium.org/svn/trunk/src@15785 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

Former-commit-id: 0a346bd07dfc18d8b4b4044a4f902c6726f97f9d

--- chrome/browser/renderer_host/render_widget_host_view.h
+++ chrome/browser/renderer_host/render_widget_host_view.h
@@ -78,7 +78,8 @@
   // Returns true if the View currently has the focus.
   virtual bool HasFocus() = 0;

-  // Shows/hides the view.
+  // Shows/hides the view.  These must always be called together in pairs.
+  // It is not legal to call Hide() multiple times in a row.
   virtual void Show() = 0;
   virtual void Hide() = 0;


Workaround mbed OS function pointer design issues.

--- source/EventQueue/EventQueueMinar.h
+++ source/EventQueue/EventQueueMinar.h
@@ -42,7 +42,7 @@

         // convert thunk to minar FunctionPointerBind
         mbed::util::Event func(
-            mbed::util::FunctionPointer1<void, const function_t&>(
+            mbed::util::FunctionPointer1<void, function_t>(
                 free_func_thunk_call
             ).bind(fn)
         );
@@ -58,7 +58,9 @@
         }
 	}

-    static void free_func_thunk_call(const function_t& fn) {
+	// due to design limitations in function pointer classes, it is not possible
+	// to use reference here ...
+    static void free_func_thunk_call(function_t fn) {
         fn();
     }
 };


The first line of each paragraph isn't included in the reformatted input text. (dm)

git-svn-id: 30a5f035a20f1bc647618dbad7eea2a951b61b7c@6350 91a5dbb7-01b9-0310-9b5f-b28072856b6e

--- Programs/brltty-ctb.c
+++ Programs/brltty-ctb.c
@@ -216,8 +216,12 @@

 static int
 processCharacters (const wchar_t *characters, size_t count, wchar_t end, void *data) {
-  if (opt_reformatText) {
-    if (count && !iswspace(characters[0])) {
+  if (opt_reformatText && count) {
+    if (iswspace(characters[0]))
+      if (!flushCharacters('\n', data))
+        return 0;
+
+    {
       unsigned int spaces = !inputLength? 0: 1;
       size_t newLength = inputLength + spaces + count;

@@ -244,19 +248,18 @@

       wmemcpy(&inputBuffer[inputLength], characters, count);
       inputLength += count;
-
-      if (end != '\n') {
-        if (!flushCharacters(0, data)) return 0;
-        if (!putCharacter(end, data)) return 0;
-      }
-
-      return 1;
-    }
-  }
-
-  if (!flushCharacters('\n', data)) return 0;
-  if (!writeCharacters(characters, count, data)) return 0;
-  if (!putCharacter(end, data)) return 0;
+    }
+
+    if (end != '\n') {
+      if (!flushCharacters(0, data)) return 0;
+      if (!putCharacter(end, data)) return 0;
+    }
+  } else {
+    if (!flushCharacters('\n', data)) return 0;
+    if (!writeCharacters(characters, count, data)) return 0;
+    if (!putCharacter(end, data)) return 0;
+  }
+
   return 1;
 }


update docs for function registration

update docs for function registration

--- packages/Interface/src/DTK_C_API.h
+++ packages/Interface/src/DTK_C_API.h
@@ -186,8 +186,9 @@
  *  The user application handle represents an instance of the data access
  *  interface to a user application with user implementations of DTK call back
  *  functions are associated with each individual handle. As many handles may
- *  be created as desired with each representing its own unique instance. Note
- *  the use of this handle in many interface functions below - all DTK
+ *  be created as desired with each representing its own unique instance.
+ *
+ *  \note the use of this handle in many interface functions below - all DTK
  *  functions needed access to user inputs and outputs will have user
  *  application handles as arguments.
  */
@@ -203,7 +204,7 @@
  *  DTK_destroyUserApplication when the handle's lifetime in the program is
  *  complete.
  *
- *  Note: User application handles must be valid on all ranks of the
+ *  \note User application handles must be valid on all ranks of the
  *  communicator over which transfer operators are generated. In other words,
  *  this function must be called collectively on every rank in that
  *  communicator. In the case where the user's actual application does not
@@ -356,9 +357,9 @@
  *  implement their field function call backs to handle multiple fields,
  *  thereby allowing the same map instance to transfer many different fields.
  *
- *  Note: This function call is a collective over the Map's communicator.
- *
- *  Note: The source and target user application handles associated with the
+ *  \note This function call is a collective over the Map's communicator.
+ *
+ *  \note The source and target user application handles associated with the
  *  given map instance must still be valid - they cannot have been destroyed
  *  before this function is called.
  *
@@ -388,18 +389,23 @@

 /**@}*/

+/**
+ * \defgroup c_callback_functions User application data interface functions.
+ * @{
+ */
+
 // clang-format off
 // COMMENT: disabling clang-format because it keeps trying to put the comma on a
 // separate new line.

-/** \brief Passed as the \p type argument to DTK_setUserFunction() in order to
- *  indicate what callback function is being registered with the user application.
+/** \brief Enumeration passed as the \p type argument to DTK_setUserFunction()
+ *  in order to indicate what callback function is being registered with the
+ *  user application.
  *
  *  \note Callback functions are passed as pointers to functions that take no
  *  arguments and return nothing (void(*)()) so the value of the
- *  DTK_FunctionType enum is necessary to indicate what is being registered with
- *  the user application and how to cast the function pointer back to the
- *  appropriate signature.
+ *  DTK_FunctionType enum is necessary to indicate which user function
+ *  implementation is being registered with the user application interface.
  */
 typedef enum {
     DTK_NODE_LIST_SIZE_FUNCTION /** See DTK_NodeListSizeFunction() */,
@@ -427,11 +433,30 @@

 /** \brief Register a function as a callback.
  *
- *  This registers a custom function as a callback for DTK to communicate with
- *  the user application.
- *
- *  \param[in,out] handle User application handle.
- *  \param[in] type Type of callback function.
+ *  This registers a custom user-implemented function as a callback for DTK to
+ *  communicate with the user application. The registered function implements
+ *  the interface specified by the function prototype (see prototypes below)
+ *  associated with the given function type enumeration. When a function is
+ *  registered, a user has an opportunity to also assign user data to that
+ *  instance of the function via a void*. When the register user
+ *  function is called, the pointer to user data is passed back to the
+ *  function, allowing the user to use additional data as needed in the
+ *  implementation or to customize the implementation for specific instances
+ *  of their application.
+ *
+ *  \note Use the \p user_data pointer to your advantage when implementing
+ *  user functions. Anything can be assigned to this pointer: a pointer
+ *  directly to an instance of the actual user data, special data and
+ *  functions written specifically for coupling, or other auxiliary data
+ *  structures of the user's construction. Whatever you decide to put here
+ *  will be passed back to you when the function is called - DTK will not
+ *  modify this data whatsoever.
+ *
+ *  \param[in,out] handle User application handle. The function implementation
+ *  will be registered with this particular instance.
+ *  \param[in] type Type of callback function. The interface of the user
+ *  function should correspond to the function prototype associated with this
+ *  enumeration.
  *  \param[in] f Pointer to user defined callback function.
  *  \param[in] user_data Pointer to the user data that will be passed to the
  *             callback function when executing it.
@@ -439,12 +464,6 @@
 extern void DTK_setUserFunction( DTK_UserApplicationHandle handle,
                                  DTK_FunctionType type, void ( *f )(),
                                  void *user_data );
-
-/**
- * \defgroup c_interface_callbacks Prototype declaration of the callback
- * functions.
- * @{
- */

 /** \brief Prototype function to get the size parameters for building a node
  *         list.
@@ -717,9 +736,6 @@
  *  \param[in] user_data Custom user data.
  *  \param[in] field_name Name of the field to pull.
  *  \param[out] field_dofs Degrees of freedom for that field.
- *
  */
 typedef void ( *DTK_PullFieldDataFunction )( void *user_data,
                                              const char *field_name,
@@ -733,9 +749,6 @@
  *  \param[in] user_data Custom user data.
  *  \param[in] field_name Name of the field to push.
  *  \param[out] field_dofs Degrees of freedom for that field.
- *
  */
 typedef void ( *DTK_PushFieldDataFunction )( void *user_data,
                                              const char *field_name,
@@ -754,9 +767,6 @@
  *  \param[in] objects_ids ID of the cell/face with repect of which the
  *             coordinates are expressed.
  *  \param[out] values Field values.
- *
  */
 typedef void ( *DTK_EvaluateFieldFunction )(
     void *user_data, const char *field_name,


Fix word wrapping when using contracted braille. (dm)

--- Programs/ctb_native.c
+++ Programs/ctb_native.c
@@ -67,7 +67,7 @@
    * 9  digits
    */

-  while (lbo->index < end) {
+  while (lbo->index <= end) {
     unsigned char *opportunity = &opportunities[lbo->index];

     lbo->previous = lbo->before;
@@ -456,7 +456,7 @@
   unsigned char *opportunities,
   const wchar_t *characters, unsigned int end
 ) {
-  while (lbo->index < end) {
+  while (lbo->index <= end) {
     int isSpace = testCharacter(bcd, characters[lbo->index], CTC_Space);
     opportunities[lbo->index] = lbo->wasSpace && !isSpace;

@@ -986,7 +986,7 @@
   BYTE *destjoin = NULL;
   BYTE *destlast = NULL;

-  unsigned char lineBreakOpportunities[getInputCount(bcd)];
+  unsigned char lineBreakOpportunities[getInputCount(bcd) + 1];
   LineBreakOpportunitiesState lbo;
   prepareLineBreakOpportunitiesState(&lbo);


doc updates to user application handle section

--- packages/Interface/src/DTK_C_API.h
+++ packages/Interface/src/DTK_C_API.h
@@ -137,7 +137,7 @@
  *  memory. Memory allocated in this space is not directly accessible on the
  *  GPU. If DTK maps are created for and executed on the GPU or other
  *  accelerators this memory will be explicitly copied to and from a memory
- *  space accessible by the GPU.
+ *  space accessible by the GPU for computation.
  *
  *  DTK_CUDAUVM_SPACE: Memory will be allocated via CUDA unified virtual
  *  memory (UVM). This memory is automatically paged between host and device
@@ -153,21 +153,23 @@
 /**
  *  \brief Execution space (where DTK functions execute)
  *
- *  An execution space defines where DTK mapping computations will
- *  occur. Interpolation, projection, and other mathematical operations on
- *  user fields will execute using the programming model/runtime associated
+ *  An execution space defines where DTK mapping computations will occur on a
+ *  compute node. Interpolation, projection, and other mathematical operations
+ *  on user fields will execute using the programming model/runtime associated
  *  with the execution space parameter. The following are valid values for the
  *  execution space enumeration:
  *
  *  DTK_SERIAL: DTK kernels will execute in serial on a single CPU thread.
  *
- *  DTK_OPENMP: DTK kernels will execute on a number of OpenMP threads
- *  specified either via the environment variable OMP_NUM_THREADS or via
- *  specification to the Kokkos runtime in initialization via
- *  --kokkos-threads.
- *
- *  DTK_CUDA: DTK kernels will execute on an NVIDIA GPU using the CUDA
- *  runtime.
+ *  DTK_OPENMP: DTK kernels will execute in parallel on a number of OpenMP
+ *  threads specified either via the environment variable OMP_NUM_THREADS or
+ *  via specification to the Kokkos runtime in initialization via
+ *  --kokkos-threads. If kokkos-specific runtime variables are used to
+ *  specify thread counts, these should be passed at the time on DTK
+ *  initialization using DTK_initializeCmd().
+ *
+ *  DTK_CUDA: DTK kernels will execute in parallel on an NVIDIA GPU using the
+ *  CUDA runtime.
 */
 typedef enum { DTK_SERIAL, DTK_OPENMP, DTK_CUDA } DTK_ExecutionSpace;

@@ -182,25 +184,39 @@
  *  \brief DTK user application handle.
  *
  *  The user application handle represents an instance of the data access
- *  interface to a user application. User implementations of DTK call back
- *  functions are associated with each individual handle.
+ *  interface to a user application with user implementations of DTK call back
+ *  functions are associated with each individual handle. As many handles may
+ *  be created as desired with each representing its own unique instance. Note
+ *  the use of this handle in many interface functions below - all DTK
+ *  functions needed access to user inputs and outputs will have user
+ *  application handles as arguments.
  */
 typedef struct _DTK_UserApplicationHandle *DTK_UserApplicationHandle;

-/** \brief Create a DTK handle to a user application.
+/** \brief Create a DTK handle to a user application in a given memory space.
+ *
+ *  As many handles may be created as desired with each call to this function
+ *  giving a new and unique handle. All data for user inputs and outputs
+ *  accessed through function call backs registered with a given handle will
+ *  be allocated in the memory space assocated with that handle. A call to
+ *  this function should be associated with an equivalent call to
+ *  DTK_destroyUserApplication when the handle's lifetime in the program is
+ *  complete.
  *
  *  \param space Execution space for the callback functions that are to be
  *  registered using DTK_setUserFunction().
  *
- *  \return DTK_create returns a handle for the user application.
+ *  \return DTK_create returns a handle for the user application. All user
+ *  inputs and outputs accessed through function call backs associated with
+ *  this handle will be allocated in the given memory space.
  */
 extern DTK_UserApplicationHandle
 DTK_createUserApplication( DTK_MemorySpace space );

 /** \brief Indicates whether a DTK handle to a user application is valid.
  *
- *  A handle is valid if it was created by DTK_create() and has not yet been
- *  deleted by DTK_destroyUserApplication().
+ *  A handle is valid if it was created by DTK_createUserApplication() and has
+ *  not yet been deleted by DTK_destroyUserApplication().
  *
  *  \param[in] handle The DTK user application handle to check.
  *
@@ -211,7 +227,9 @@

 /** \brief Destroy a DTK handle to a user application.
  *
- *  \param[in,out] handle User application handle.
+ *  \param[in,out] handle User application handle. If this handle has already
+ *  been destroyed or was not created with a call to
+ *  DTK_createUserApplication() then this function does nothing.
  */
 extern void DTK_destroyUserApplication( DTK_UserApplicationHandle handle );


A syntax error for a note should refer to the note with the problem. (dm)

--- Programs/tune_build.c
+++ Programs/tune_build.c
@@ -170,15 +170,13 @@
 parseDuration (TuneBuilder *tune, const char **operand, int *duration) {
   if (**operand == '@') {
     *operand += 1;
+
     TuneParameter parameter = tune->duration;
-
-    if (!parseRequiredParameter(tune, &parameter, operand)) {
-      return 0;
-    }
-
+    if (!parseRequiredParameter(tune, &parameter, operand)) return 0;
     *duration = parameter.current;
   } else {
-    const char *originalOperand = *operand;
+    const char *durationOperand = *operand;
+
     TuneNumber multiplier;
     TuneNumber divisor;

@@ -202,7 +200,7 @@
       divisor = 1;
     }

-    if (*operand != originalOperand) setCurrentDuration(tune, multiplier, divisor);
+    if (*operand != durationOperand) setCurrentDuration(tune, multiplier, divisor);
     *duration = tune->duration.current;
   }

@@ -359,24 +357,20 @@
     if (**operand == 'n') {
       *operand += 1;
       TuneParameter parameter = tune->note;
-
-      if (!parseRequiredParameter(tune, &parameter, operand)) {
-        return 0;
-      }
-
+      if (!parseRequiredParameter(tune, &parameter, operand)) return 0;
       noteNumber = parameter.current;
     } else {
       unsigned char noteIndex;
       if (!parseNoteLetter(&noteIndex, operand)) return 0;

-      const char *originalOperand = *operand;
+      const char *octaveOperand = *operand;
       TuneParameter octave = tune->octave;
       if (!parseOptionalParameter(tune, &octave, operand)) return 0;

       noteNumber = (octave.current * NOTES_PER_OCTAVE) + noteOffsets[noteIndex];
       defaultAccidentals = tune->accidentals[noteIndex];

-      if (*operand == originalOperand) {
+      if (*operand == octaveOperand) {
         int adjustOctave = 0;
         TuneNumber previousNote = tune->note.current;
         TuneNumber currentNote = noteNumber;
@@ -452,11 +446,12 @@
 static int
 parseTone (TuneBuilder *tune, const char **operand) {
   while (1) {
+    tune->source.text = *operand;
     unsigned char note;

     {
-      const char *originalOperand = *operand;
-      if (!parseNote(tune, operand, &note)) return *operand == originalOperand;
+      const char *noteOperand = *operand;
+      if (!parseNote(tune, operand, &note)) return *operand == noteOperand;
     }

     int duration;


Rename setErrno() to setUnixError() in usb_darwin.c to avoid a conflict with misc.h. (dm)

git-svn-id: 30a5f035a20f1bc647618dbad7eea2a951b61b7c@2222 91a5dbb7-01b9-0310-9b5f-b28072856b6e

--- Programs/usb_darwin.c
+++ Programs/usb_darwin.c
@@ -64,7 +64,7 @@
 } UsbEndpointExtension;

 static void
-setErrno (long int result, const char *action) {
+setUnixError (long int result, const char *action) {
 #define SET(to) errno = (to); break;
 #define MAP(from,to) case (from): SET(to)
   switch (result) {
@@ -222,12 +222,12 @@

     result = (*devx->device)->USBDeviceOpen(devx->device);
     if (result != kIOReturnSuccess) {
-      setErrno(result, "USB device open");
+      setUnixError(result, "USB device open");
       if ((result != kIOReturnExclusiveAccess) || !seize) return 0;

       result = (*devx->device)->USBDeviceOpenSeize(devx->device);
       if (result != kIOReturnSuccess) {
-        setErrno(result, "USB device seize");
+        setUnixError(result, "USB device seize");
         return 0;
       }

@@ -258,7 +258,7 @@
           for (pipe=1; pipe<=devx->pipeCount; ++pipe) {
             result = (*devx->interface)->AbortPipe(devx->interface, pipe);
             if (result != kIOReturnSuccess) {
-              setErrno(result, "USB pipe abort");
+              setUnixError(result, "USB pipe abort");
             }
           }
         }
@@ -271,7 +271,7 @@

       result = (*devx->interface)->USBInterfaceClose(devx->interface);
       if (result != kIOReturnSuccess) {
-        setErrno(result, "USB interface close");
+        setUnixError(result, "USB interface close");
         ok = 0;
       }
       devx->interfaceOpened = 0;
@@ -291,7 +291,7 @@

   result = (*interface)->GetInterfaceNumber(interface, &num);
   if (result != kIOReturnSuccess) {
-    setErrno(result, "USB interface number query");
+    setUnixError(result, "USB interface number query");
   } else if (num == number) {
     return 1;
   }
@@ -355,10 +355,10 @@
           (*interface)->Release(interface);
           interface = NULL;
         } else {
-          setErrno(result, "USB interface interface create");
+          setUnixError(result, "USB interface interface create");
         }
       } else {
-        setErrno(result, "USB interface service plugin create");
+        setUnixError(result, "USB interface service plugin create");
       }
     }
     if (!found) LogPrint(LOG_ERR, "USB interface not found: %d", number);
@@ -366,7 +366,7 @@
     IOObjectRelease(iterator);
     iterator = NULL;
   } else {
-    setErrno(result, "USB interface iterator create");
+    setUnixError(result, "USB interface iterator create");
   }

   return found;
@@ -393,7 +393,7 @@
   IOReturn result = (*devx->device)->ResetDevice(devx->device);
   if (result == kIOReturnSuccess) return 1;

-  setErrno(result, "USB device reset");
+  setUnixError(result, "USB device reset");
   return 0;
 }

@@ -408,7 +408,7 @@
     UInt8 arg = configuration;
     IOReturn result = (*devx->device)->SetConfiguration(devx->device, arg);
     if (result == kIOReturnSuccess) return 1;
-    setErrno(result, "USB configuration set");
+    setUnixError(result, "USB configuration set");
   }

   return 0;
@@ -432,12 +432,12 @@
         devx->interfaceOpened = 1;
         return 1;
       } else {
-        setErrno(result, "USB pipe count query");
+        setUnixError(result, "USB pipe count query");
       }

       (*devx->interface)->USBInterfaceClose(devx->interface);
     } else {
-      setErrno(result, "USB interface open");
+      setUnixError(result, "USB interface open");
     }
   }

@@ -464,7 +464,7 @@
     UInt8 arg = alternative;
     IOReturn result = (*devx->interface)->SetAlternateInterface(devx->interface, arg);
     if (result == kIOReturnSuccess) return 1;
-    setErrno(result, "USB alternative set");
+    setUnixError(result, "USB alternative set");
   }

   return 0;
@@ -484,7 +484,7 @@

     result = (*devx->interface)->ClearPipeStallBothEnds(devx->interface, eptx->pipeNumber);
     if (result == kIOReturnSuccess) return 1;
-    setErrno(result, "USB endpoint reset");
+    setUnixError(result, "USB endpoint reset");
   }

   return 0;
@@ -504,7 +504,7 @@

     result = (*devx->interface)->ClearPipeStall(devx->interface, eptx->pipeNumber);
     if (result == kIOReturnSuccess) return 1;
-    setErrno(result, "USB endpoint clear");
+    setUnixError(result, "USB endpoint clear");
   }

   return 0;
@@ -539,7 +539,7 @@

   result = (*devx->device)->DeviceRequestTO(devx->device, &arg);
   if (result == kIOReturnSuccess) return arg.wLenDone;
-  setErrno(result, "USB control transfer");
+  setUnixError(result, "USB control transfer");
   return -1;
 }

@@ -571,7 +571,7 @@
       result = (*devx->interface)->CreateInterfaceAsyncEventSource(devx->interface,
                                                                    &devx->runloopSource);
       if (result != kIOReturnSuccess) {
-        setErrno(result, "USB interface event source create");
+        setUnixError(result, "USB interface event source create");
         return NULL;
       }
       CFRunLoopAddSource(devx->runloopReference,
@@ -590,7 +590,7 @@
                                                      request->buffer, request->length,
                                                      usbAsynchronousRequestCallback, request);
           if (result == kIOReturnSuccess) return request;
-          setErrno(result, "USB endpoint asynchronous read");
+          setUnixError(result, "USB endpoint asynchronous read");
           break;

         case kUSBOut:
@@ -599,7 +599,7 @@
                                                       request->buffer, request->length,
                                                       usbAsynchronousRequestCallback, request);
           if (result == kIOReturnSuccess) return request;
-          setErrno(result, "USB endpoint asynchronous write");
+          setUnixError(result, "USB endpoint asynchronous write");
           break;

         default:
@@ -669,7 +669,7 @@
         response->count = -1;
       }
     } else {
-      setErrno(request->result, "USB asynchronous response");
+      setUnixError(request->result, "USB asynchronous response");
       response->error = errno;
       response->count = -1;
     }
@@ -723,12 +723,12 @@
             goto read;
           }

-          setErrno(result, "USB stall clear");
+          setUnixError(result, "USB stall clear");
           break;
         }

       default:
-        setErrno(result, "USB endpoint read");
+        setUnixError(result, "USB endpoint read");
         break;
     }
   }
@@ -755,7 +755,7 @@
                                              (void *)buffer, length,
                                              timeout, timeout);
     if (result == kIOReturnSuccess) return length;
-    setErrno(result, "USB endpoint write");
+    setUnixError(result, "USB endpoint write");
   }

   return -1;
@@ -797,7 +797,7 @@
   return 1;

 error:
-  setErrno(result, "USB device descriptor read");
+  setUnixError(result, "USB device descriptor read");
   return 0;
 }

@@ -830,7 +830,7 @@
             return 1;
           }
         } else {
-          setErrno(result, "USB pipe properties query");
+          setUnixError(result, "USB pipe properties query");
         }
       }

@@ -872,7 +872,7 @@

   if (devx->deviceOpened) {
     result = (*devx->device)->USBDeviceClose(devx->device);
-    if (result != kIOReturnSuccess) setErrno(result, "USB device close");
+    if (result != kIOReturnSuccess) setUnixError(result, "USB device close");
     devx->deviceOpened = 0;
   }

@@ -946,17 +946,17 @@
               (*interface)->Release(interface);
               interface = NULL;
             } else {
-              setErrno(ioResult, "USB device interface create");
+              setUnixError(ioResult, "USB device interface create");
             }
           } else {
-            setErrno(ioResult, "USB device service plugin create");
+            setUnixError(ioResult, "USB device service plugin create");
           }
         }

         IOObjectRelease(iterator);
         iterator = NULL;
       } else {
-        setErrno(kernelResult, "USB device iterator create");
+        setUnixError(kernelResult, "USB device iterator create");
       }
     } else {
       LogPrint(LOG_ERR, "USB device matching dictionary create error.");
@@ -964,7 +964,7 @@

     mach_port_deallocate(mach_task_self(), port);
   } else {
-    setErrno(kernelResult, "Darwin master port create");
+    setUnixError(kernelResult, "Darwin master port create");
   }

   return device;


Reconnect handling.

Reconnect handling.

--- LDAPCnx.h
+++ LDAPCnx.h
@@ -8,13 +8,16 @@
  public:
   static void Init(v8::Local<v8::Object> exports);
   Nan::Callback * callback;
-
+  static void Event(uv_poll_t* handle, int status, int events);
+  uv_poll_t * handle = NULL;
+
  private:
   explicit LDAPCnx();
   ~LDAPCnx();

   static void New(const Nan::FunctionCallbackInfo<v8::Value>& info);
   static void Initialize(const Nan::FunctionCallbackInfo<v8::Value>& info);
+  static void Restart(LDAP *ld, Sockbuf *sb, LDAPURLDesc *srv, struct sockaddr *addr, struct ldap_conncb *ctx);
   static void Search(const Nan::FunctionCallbackInfo<v8::Value>& info);
   static void Delete(const Nan::FunctionCallbackInfo<v8::Value>& info);
   static void Bind(const Nan::FunctionCallbackInfo<v8::Value>& info);
@@ -22,7 +25,8 @@
   static void Modify(const Nan::FunctionCallbackInfo<v8::Value>& info);
   static void Rename(const Nan::FunctionCallbackInfo<v8::Value>& info);
   static void GetErr(const Nan::FunctionCallbackInfo<v8::Value>& info);
-  static void Event(uv_poll_t* handle, int status, int events);
+  static void GetErrNo(const Nan::FunctionCallbackInfo<v8::Value>& info);
+  static void GetFD(const Nan::FunctionCallbackInfo<v8::Value>& info);
   static Nan::Persistent<v8::Function> constructor;
   LDAP * ld;
 };