- BugFix: removed missing debugging artefact, causing partitions with
  constant type place on the workqueue again (fix ack/test2.c)
- Add debug output when a partition is placed on the workqueue

[r22349]

--- ir/opt/combo.c
+++ ir/opt/combo.c
@@ -500,6 +500,7 @@
  */
 static INLINE void add_to_worklist(partition_t *X, environment_t *env) {
 	assert(X->on_worklist == 0);
+	DB((dbg, LEVEL_2, "Adding part%d to worklist\n", X->nr));
 	X->wl_next     = env->worklist;
 	X->on_worklist = 1;
 	env->worklist  = X;
@@ -2552,9 +2553,6 @@
 		if (old_type_was_T_or_C) {
 			node_t *y, *tmp;

-			if (Y->on_worklist == 0)
-				add_to_worklist(Y, env);
-
 			/* check if some nodes will make the leader -> follower transition */
 			list_for_each_entry_safe(node_t, y, tmp, &Y->Leader, node_list) {
 				if (y->type.tv != tarval_top && ! is_con(y->type)) {
@@ -3000,7 +2998,6 @@
 	assure_irg_outs(irg);
 	assure_cf_loop(irg);

-
 	/* we have our own value_of function */
 	set_value_of_func(get_node_tarval);


iropt: Remove redundant test.

iropt: Remove redundant test.

The surrounding 'if' checks the same.

--- ir/opt/iropt.c
+++ ir/opt/iropt.c
@@ -2822,7 +2822,7 @@
 				}
 			}

-			if (is_Minus(a) && get_mode_arithmetic(mode) == irma_twos_complement) {
+			if (is_Minus(a)) {
 				ir_tarval *tv   = get_Const_tarval(b);
 				int        bits = (int)get_mode_size_bits(mode);
 				if (get_tarval_popcount(tarval_shl_unsigned(tv, 1)) == bits - 1) {


ANSCI bracket style

ANSCI bracket style

--- src/winsock/common/avl.c
+++ src/winsock/common/avl.c
@@ -3,7 +3,7 @@
 #include <assert.h>

 /* tree node */
-struct avl_node
+struct avl_node
 {
     avl_key_t   key;            /* node data */
     void*       data;           /* associate data */
@@ -28,7 +28,8 @@
 static avl_node_t*  avl_new_node(avl_key_t key, void* data)
 {
     avl_node_t* node = (avl_node_t*)malloc(sizeof(avl_node_t));
-    if (node) {
+    if (node)
+    {
         node->key = key;
         node->data = data;
         node->height = 0;   // leaf node default
@@ -41,7 +42,8 @@
 /* free new allocated node */
 static void avl_free_node(avl_node_t* node)
 {
-    if (node) {
+    if (node)
+    {
         free(node);
     }
 }
@@ -50,13 +52,14 @@
 {
     if (node == NULL)
         return 0;
-    else
+    else
         return HEIGHT(node->left) - HEIGHT(node->right);
 }

 static avl_node_t*  avl_node_min(avl_node_t* node)
 {
-    if (node != NULL) {
+    if (node != NULL)
+    {
         while (node->left != NULL)
             node = node->left;
     }
@@ -65,7 +68,8 @@

 static avl_node_t* avl_node_max(avl_node_t* node)
 {
-    if (node != NULL) {
+    if (node != NULL)
+    {
         while (node->right != NULL)
             node = node->right;
     }
@@ -147,7 +151,7 @@
 static avl_node_t* avl_node_lr_rot(avl_node_t* A)
 {
     assert(A && A->left);
-    A->left = avl_node_rr_rot(A->left);;
+    A->left = avl_node_rr_rot(A->left);
     return avl_node_ll_rot(A);
 }

@@ -174,9 +178,11 @@
 {
     if (node == NULL)
         return NULL;
-
-    if (factor > 1) { /* left subtree */
-        switch(rotate) {
+
+    if (factor > 1) /* left subtree */
+    {
+        switch(rotate)
+        {
         case ROT_LEFT: /* left-left case */
             return avl_node_ll_rot(node);
         case ROT_RIGHT: /* left-right case */
@@ -185,8 +191,10 @@
             assert(!"invalid rorotate direction");
         }
     }
-    else if (factor < -1) { /* right subtree */
-        switch(rotate) {
+    else if (factor < -1)  /* right subtree */
+    {
+        switch(rotate)
+        {
         case ROT_LEFT: /* right-left case */
             return avl_node_rl_rot(node);
         case ROT_RIGHT: /* right-right case */
@@ -202,14 +210,17 @@
 static avl_node_t* avl_insert_node(avl_node_t* root, avl_key_t key, void* data)
 {
     int rotate = 0;
-    if (root == NULL) {
+    if (root == NULL)
+    {
         return avl_new_node(key, data);
     }
-    if (key < root->key) {
+    if (key < root->key)
+    {
         rotate = ROT_LEFT;
         root->left = avl_insert_node(root->left, key, data);
     }
-    else if (key > root->key) {
+    else if (key > root->key)
+    {
         rotate = ROT_RIGHT;
         root->right = avl_insert_node(root->right, key, data);
     }
@@ -228,25 +239,32 @@
     int rotate = 0;
     if (root == NULL)
         return NULL;
-    if (key < root->key) {
+    if (key < root->key)
+    {
         root->left = avl_remove_node(root->left, key);
     }
-    else if (key > root->key) {
+    else if (key > root->key)
+    {
         root->right = avl_remove_node(root->right, key);
     }
-    else  { /* this is the node to be deleted */
-        if ((root->left == NULL) || (root->right == NULL)) {
+    else   /* this is the node to be deleted */
+    {
+        if ((root->left == NULL) || (root->right == NULL))
+        {
             avl_node_t* node = (root->left ? root->left : root->right);
-            if (node != NULL) { /* one child case */
+            if (node != NULL)  /* one child case */
+            {
                 *root = *node;
             }
-            else { /* no child case */
+            else  /* no child case */
+            {
                 node = root;
                 root = NULL;
             }
             avl_free_node(node);
         }
-        else { /* node with two children */
+        else  /* node with two children */
+        {
             avl_node_t* node = avl_node_min(root->right);
             root->key = node->key;
             root->data = node->data;
@@ -258,11 +276,13 @@
         return NULL;
     root->height = MAX(HEIGHT(root->left), HEIGHT(root->right)) + 1;
     factor = avl_get_balance(root);
-    if (factor > 1) {
+    if (factor > 1)
+    {
         int left_balance = avl_get_balance(root->left);
         rotate = (left_balance >= 0 ? ROT_LEFT : ROT_RIGHT);
-    }
-    else if (factor < -1) {
+    }
+    else if (factor < -1)
+    {
         int right_balance = avl_get_balance(root->right);
         rotate = (right_balance <= 0 ? ROT_RIGHT : ROT_LEFT);
     }
@@ -276,7 +296,8 @@
         return avl_destroy_node(root->left) + 1;
     else if (root->right != NULL)
         return avl_destroy_node(root->right) + 1;
-    else {
+    else
+    {
         avl_free_node(root);
         return 1;
     }
@@ -285,10 +306,11 @@
 /* post-order traversal */
 static int avl_postorder(avl_node_t* root, avl_key_t array[], int index)
 {
-    if (root != NULL) {
+    if (root != NULL)
+    {
         index = avl_postorder(root->left, array, index);
         array[index++] = root->key;
-        index = avl_postorder(root->right, array, index);
+        index = avl_postorder(root->right, array, index);
     }
     return index;
 }
@@ -297,7 +319,8 @@
 avl_tree_t* avl_create_tree()
 {
     avl_tree_t* tree = (avl_tree_t*)malloc(sizeof(avl_tree_t));
-    if (tree) {
+    if (tree)
+    {
         tree->root = NULL;
         tree->size = 0;
     }
@@ -308,7 +331,8 @@
 int avl_destroy_tree(avl_tree_t* tree)
 {
     int r = 0;
-    if (tree && tree->root) {
+    if (tree && tree->root)
+    {
         r = avl_destroy_node(tree->root);
         free(tree);
     }
@@ -339,7 +363,8 @@
 /* insert data to tree */
 int avl_insert(avl_tree_t* tree, avl_key_t key, void* data)
 {
-    if (tree) {
+    if (tree)
+    {
         tree->root = avl_insert_node(tree->root, key, data);
         tree->size++;
         return 1;
@@ -350,7 +375,8 @@
 /* delete data from tree */
 int avl_delete(avl_tree_t* tree, avl_key_t key)
 {
-    if (tree && avl_node_find(tree->root, key)) {
+    if (tree && avl_node_find(tree->root, key))
+    {
         tree->root = avl_remove_node(tree->root, key);
         tree->size--;
         return 1;
@@ -368,7 +394,8 @@
 int avl_serialize(avl_tree_t* tree, avl_key_t array[], size_t len)
 {
     assert(tree && array);
-    if (tree->size > len) {
+    if (tree->size > len)
+    {
         return 0;
     }
     return avl_postorder(tree->root, array, 0);


reordered initalisation order at src/Generating/Cave.h line 73

--- src/Generating/Caves.h
+++ src/Generating/Caves.h
@@ -70,8 +70,8 @@
 	cStructGenWormNestCaves(int a_Seed, int a_Size = 64, int a_Grid = 96, int a_MaxOffset = 128) :
 		m_Noise(a_Seed),
 		m_Size(a_Size),
-		m_Grid(a_Grid),
-		m_MaxOffset(a_MaxOffset)
+		m_MaxOffset(a_MaxOffset),
+		m_Grid(a_Grid)
 	{
 	}


Fix an overly asserted assertion during previous checkin for bug #54330.

--- storage/innodb_plugin/row/row0merge.c
+++ storage/innodb_plugin/row/row0merge.c
@@ -1666,7 +1666,7 @@
 		return(DB_CORRUPTION);
 	}

-	ut_ad(n_run < *num_run);
+	ut_ad(n_run <= *num_run);

 	*num_run = n_run;

@@ -1713,6 +1713,11 @@

 	/* Record the number of merge runs we need to perform */
 	num_runs = file->offset;
+
+	/* If num_runs are less than 1, nothing to merge */
+	if (num_runs <= 1) {
+		return(error);
+	}

 	/* "run_offset" records each run's first offset number */
 	run_offset = (ulint*) mem_alloc(file->offset * sizeof(ulint));


implement get_loop_header

implement get_loop_header

--- ir/opt/loop2.c
+++ ir/opt/loop2.c
@@ -2,6 +2,79 @@
 #include "irtools.h"
 #include "xmalloc.h"
 #include <assert.h>
+
+static void walk_loop(ir_loop *const loop, irg_walk_func *const func, void *const env)
+{
+	size_t const n_elements = get_loop_n_elements(loop);
+	for (size_t i = 0; i < n_elements; ++i) {
+		loop_element const element = get_loop_element(loop, i);
+		if (*element.kind == k_ir_node) {
+			func(element.node, env);
+		} else if (*element.kind == k_ir_loop) {
+			walk_loop(element.son, func, env);
+		}
+	}
+}
+
+static bool is_inner_loop(ir_loop *const outer_loop, ir_loop *inner_loop)
+{
+	ir_loop *old_inner_loop;
+	do {
+		old_inner_loop = inner_loop;
+		inner_loop = get_loop_outer_loop(inner_loop);
+	} while (inner_loop != old_inner_loop && inner_loop != outer_loop);
+	return inner_loop != old_inner_loop;
+}
+
+static bool block_is_inside_loop(ir_node *const block, ir_loop *const loop)
+{
+	ir_loop *const block_loop = get_irn_loop(block);
+	if (block_loop == NULL)
+		return false;
+	return block_loop == loop || is_inner_loop(loop, block_loop);
+}
+
+static bool block_dominates_loop(ir_node *const block, ir_loop *const loop)
+{
+	size_t const n_elements = get_loop_n_elements(loop);
+	for (size_t i = 0; i < n_elements; ++i) {
+		loop_element const element = get_loop_element(loop, i);
+		if (*element.kind == k_ir_node) {
+			assert(is_Block(element.node));
+			if (!block_dominates(block, element.node))
+				return false;
+		} else if (*element.kind == k_ir_loop) {
+			if (!block_dominates_loop(block, element.son))
+				return false;
+		}
+	}
+	return true;
+}
+
+// returns the block that dominates all blocks in the loop or NULL
+static ir_node *get_loop_header(ir_loop *const loop)
+{
+	// pick a random block
+	ir_node *header = NULL;
+	size_t const n_elements = get_loop_n_elements(loop);
+	for (size_t i = 0; i < n_elements; ++i) {
+		loop_element const element = get_loop_element(loop, i);
+		if (*element.kind == k_ir_node) {
+			header = element.node;
+			break;
+		}
+	}
+	assert(header && is_Block(header));
+
+	// walk up the dominance tree
+	ir_node *idom = get_Block_idom(header);
+	while (block_is_inside_loop(idom, loop)) {
+		header = idom;
+		idom = get_Block_idom(header);
+	}
+
+	return block_dominates_loop(header, loop) ? header : NULL;
+}

 static void duplicate_node(ir_node *const node, ir_node *const new_block)
 {


[docs] Fix GtkPlug::embedded signal documentation

See bug #609650.

--- gtk/gtkplug.c
+++ gtk/gtkplug.c
@@ -171,8 +171,7 @@
    * GtkPlug::embedded:
    * @plug: the object on which the signal was emitted
    *
-   * Gets emitted when the plug becomes embedded in a socket
-   * and when the embedding ends.
+   * Gets emitted when the plug becomes embedded in a socket.
    */
   plug_signals[EMBEDDED] =
     g_signal_new (I_("embedded"),


integrated GBA POC

integrated GBA POC

--- other/gba/main.c
+++ other/gba/main.c
@@ -1,8 +1,33 @@
+/* *** directivas del compilador y otras definiciones *** */
 #include <tonc.h>
 #include <string.h>
 #include "background.gfx.h"
 #include "sprites.gfx.h"

+// píxeles por unidad de mapa
+#define	PASO	4
+// anchura del sprite en unidades de mapa (actualmente 8 pixels) *** NO USADO?
+#define	ANCHO	2
+// umbral de redondeo para detectar colisiones
+#define	CERCA	PASO/2
+// número de fantasmas, aunque muy determinado
+#define FANTS	2
+// numero de direcciones disponibles, por evitar constantes
+#define DIRS	4
+// códigos de dirección (mejor que no sea un enum)
+#define	MOVER	0
+#define	MOVED	1
+#define	MOVEL	2
+#define	MOVEU	3
+
+/* *** declaración de tipos de datos y estructuras *** */
+struct sprite_s {
+	int			x, y;	// posición en píxeles
+	int			dir;	// 0=dcha, 1=abajo, 2=izq, 3=arriba
+	OBJ_ATTR*	obp;	// añadir puntero al array de objetos
+}
+
+// ...del tutorial
 // Definir estructura para guardar los datos del juego
 struct game_s {
     // Buffer con los metadatos de los sprites
@@ -11,16 +36,178 @@
     int obj_buffer_size;
     // Contador de frames
     u32 frame;
-
-    /* LOGICA DE JUEGO */
-    int vx;
-    int posx;
-    int posy;
-
+    /* LOGICA DE JUEGO instanciada en cada sprite */
 };
+
+/* *** variables y datos globales *** */
+// ...del tutorial
 // Instanciar en memoria la estructura con los datos del juego
 struct game_s game;

+// ...del propio juego
+struct sprite_s pac, gh[FANTS];	// un pacman y dos fantasmas
+
+// laberinto original, celdas de 4x4 píxeles, 0=ocupada, 1=libre, inicializar por columnas!!!
+const unsigned short mapa[29][32] = {
+	{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},	// x=0
+	{0,1,1,1,1,1,1,1,1,1,0,0,0,0,1,1,0,0,0,0,1,1,1,1,1,0,1,1,1,1,1,0},	// 1
+	{0,1,1,1,1,1,1,1,1,1,0,0,0,0,1,1,0,0,0,0,1,1,1,1,1,0,1,1,1,1,1,0},	// 2 = 1
+	{0,1,1,0,0,1,1,0,1,1,0,0,0,0,1,1,0,0,0,0,1,1,0,1,1,1,1,1,0,1,1,0},	// 3
+	{0,1,1,0,0,1,1,0,1,1,0,0,0,0,1,1,0,0,0,0,1,1,0,1,1,1,1,1,0,1,1,0},	// 4 = 3
+	{0,1,1,0,0,1,1,0,1,1,0,0,0,0,1,1,0,0,0,0,1,1,0,0,0,0,1,1,0,1,1,0},	// 5
+	{0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,0},	// 6
+	{0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,0},	// 7 = 6
+	{0,1,1,0,0,1,1,0,0,0,0,0,0,0,1,1,0,0,0,0,1,1,0,1,1,0,0,0,0,1,1,0},	// 8
+	{0,1,1,0,0,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,0,1,1,0},	// 9
+	{0,1,1,0,0,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,0,1,1,0},	// 10 = 9
+	{0,1,1,0,0,1,1,0,1,1,0,1,1,0,0,0,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0},	// 11
+	{0,1,1,1,1,1,1,0,1,1,1,1,1,0,0,0,0,1,1,0,1,1,1,1,1,0,1,1,1,1,1,0},	// 12
+	{0,1,1,1,1,1,1,0,1,1,1,1,1,0,0,0,0,1,1,0,1,1,1,1,1,0,1,1,1,1,1,0},	// 13 = 12
+	{0,0,0,0,0,1,1,0,0,0,0,1,1,0,0,0,0,1,1,0,0,0,0,1,1,0,0,0,0,1,1,0},	// 14 (centro)
+	{0,1,1,1,1,1,1,0,1,1,1,1,1,0,0,0,0,1,1,0,1,1,1,1,1,0,1,1,1,1,1,0},	// 15 = 13 = 12
+	{0,1,1,1,1,1,1,0,1,1,1,1,1,0,0,0,0,1,1,0,1,1,1,1,1,0,1,1,1,1,1,0},	// 16 = 12
+	{0,1,1,0,0,1,1,0,1,1,0,1,1,0,0,0,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0},	// 17 = 11
+	{0,1,1,0,0,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,0,1,1,0},	// 18 = 10 = 9
+	{0,1,1,0,0,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,0,1,1,0},	// 19 = 9
+	{0,1,1,0,0,1,1,0,0,0,0,0,0,0,1,1,0,0,0,0,1,1,0,1,1,0,0,0,0,1,1,0},	// 20 = 8
+	{0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,0},	// 21 = 7 = 6
+	{0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,0},	// 22 = 6
+	{0,1,1,0,0,1,1,0,1,1,0,0,0,0,1,1,0,0,0,0,1,1,0,0,0,0,1,1,0,1,1,0},	// 23 = 5
+	{0,1,1,0,0,1,1,0,1,1,0,0,0,0,1,1,0,0,0,0,1,1,0,1,1,1,1,1,0,1,1,0},	// 24 = 4 = 3
+	{0,1,1,0,0,1,1,0,1,1,0,0,0,0,1,1,0,0,0,0,1,1,0,1,1,1,1,1,0,1,1,0},	// 25 = 3
+	{0,1,1,1,1,1,1,1,1,1,0,0,0,0,1,1,0,0,0,0,1,1,1,1,1,0,1,1,1,1,1,0},	// 26 = 2 = 1
+	{0,1,1,1,1,1,1,1,1,1,0,0,0,0,1,1,0,0,0,0,1,1,1,1,1,0,1,1,1,1,1,0},	// 27 = 1
+	{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}	// 28 = 0
+}
+
+// valor a cambiar cada coordenada según dirección
+const int dx[DIRS] = {1, 0, -1,  0};
+const int dy[DIRS] = {0, 1,  0, -1};
+// factores para determinar casilla adyacente del mapa (son de 4x4 mientras que los sprites son de 8x8)
+const int fx[DIRS] = {2, 0, -1,  0};
+const int fy[DIRS] = {0, 2,  0, -1};
+// la otra casilla que hay que comprobar... lo mismo pero cambiando los 0 por 1
+const int ax[DIRS] = {2, 1, -1,  1};
+const int ay[DIRS] = {1, 2,  1, -1};
+
+/* *** funciones *** */
+/* determinar si el movimiento previsto en esas coordenadas cae en casilla ocupada (0) o libre (1) */
+int posible(int x, int y, int dir) {
+	int resul;
+
+	resul = mapa[x/PASO+fx[dir]][y/PASO+fy[dir]];	// caso general, +2/-1
+	resul &= mapa[x/PASO+ax[dir]][y/PASO+ay[dir]];	// la otra casilla
+
+	return resul;
+}
+
+/* leer teclas de dirección, devuelve el valor 0...3 */
+int direccion(void) {
+	key_poll();
+	if (key_hit(KEY_RIGHT))		return MOVER;		// ¿...o debería usar key_is_down()?
+	if (key_hit(KEY_DOWN))		return MOVED;
+	if (key_hit(KEY_LEFT))		return MOVEL;
+	if (key_hit(KEY_UP))		return MOVEU;
+}
+
+/* movimiento comecocos */
+void mover_come() {
+// pac.x, pac.y		coordenadas pacman (añadir [56,16] al mostrar, para que coincida con mapa)
+// pac.dir			dirección pacman
+	int pm;			// dirección DESEADA pacman
+
+	if (pac.x%PASO || pac.y%PASO) {
+		// fuera de intersecciones, mover comecocos según dirección actual
+		// *** PROBLEMA: el comecocos no reacciona hasta el cambio de tile, pero en la arcade puede cambiar de sentido SIEMPRE ***
+		pac.x += dx[pac.dir];
+		pac.y += dy[pac.dir];
+	}
+	else {
+		// ver teclas y, si es factible, cambiar dirección
+		pm = direccion();
+		if (posible(pac.x, pac.y, pm)) {	// casilla libre
+			pac.dir = pm;	// se acepta el movimiento
+			// *** debería seleccionar sprite y ajustar 'espejado' *** tal vez según pac.dir, al mostrarlo
+		}
+		// ver si puede seguir moviéndose, de lo contrario se queda en el sitio
+		// *** quizá sacar este if del anterior, dejando sólo el else (como el de los fantasmas) ***
+		if (posible(pac.x, pac.y, pac.dir)) {
+			pac.x += dx[pac.dir];
+			pac.y += dy[pac.dir];
+		}
+	}
+}
+
+/* movimiento fantasmas, devuelve 1  si detecta colisión */
+int mover_fant() {
+// gh[].x, gh[].y	coordenadas fantasmaS (añadir [56,16] al mostrar)
+// gh[].dir;		dirección actual fantasmaS
+	int dd;			// dirección DESEADA fantasma
+	int opu;		// dirección OPUESTA a la actual, normalmente no se usa, pero...
+	int lim;		// por seguridad, no puede explorar más de cuatro direcciones...
+
+	// en este caso, el sprite es igual en todas direcciones
+	for (int i=0; i<FANTS; i++) {
+		if (!(gh[i].x%PASO || gh[i].y%PASO)) {
+			opu = (gh[i].dir+DIRS/2)%DIRS;		// necesita saber la dirección opuesta a la actual, por si tiene que evitarla
+			lim = DIRS;		// inicialmente 4
+			// decidir movimiento aleatorio y, si es factible, cambiar dirección
+			dd = rand()%DIRS;	// aleatorio 0...3, válidos como direcciones
+			while (((!posible(gh[i].x, gh[i].y, dd)) || (dd == opu)) && lim--) {	// no es posible girar 180º
+				dd++;		// si la dirección sugerida está ocupada (o es la opuesta a la actual), probar otra
+				dd %= DIRS;	// sólo índices válidos
+			}
+			// PROBLEMA: si entra en un callejón sin salida, no puede invertir
+			if (!lim) {
+				dd = opu;	// forzamos la inversión sólo en este caso
+			}
+			gh[i].dir = dd;	// esta dirección es siempre válida
+		}
+		gh[i].x += dx[gh[i].dir];	// en todo caso, mover fantasma
+		gh[i].y += dy[gh[i].dir];
+		// control de colisiones, ver si ese fantasma está lo bastante cerca del comecocos
+		if (((gh[i].x+CERCA)/PASO == (pac.x+CERCA)/PASO) && ((gh[i].y+CERCA)/PASO == (pac.y+CERCA)/PASO)) {
+			return 1;		// palmatoria, ni me molesto en mover el otro fantasma
+		}
+	}
+
+	return	0;				// si llega aquí, no se ha detectado colisión
+}
+
+/* Inicializar posiciones de los sprites */
+void partida(void) {
+	pac.x = 110;		// centrado, para un sprite de 8x8
+	pac.y = 108;
+	pac.dir = MOVEL;	// como en la arcade, el pacman comienza mirando a la izquierda
+
+	for (int i=0; i<FANTS; i++) {
+		gh[i].x = 120 - (i%2)*20;				// el primero (par) más a la derecha, el otro (impar) más a la izquierda
+		gh[i].y = 60;							// pasillo sobre la 'casa'
+		gh[i].dir = MOVER+(MOVEL-MOVER)*(i%2);	// el primero (par) mira a la derecha, el otro (impar) a la izquierda
+    }
+}
+
+void palmatoria(void) {
+	int i;				// retardos varios
+
+	for (i=0;i<60;i++) {	// un segundo
+		VBlankIntrWait();
+	}
+// ¿deshabilito fantasmas?
+// *** animación muerte pacman
+	for (int j=0;j<5;j++) {	// 5 fotogramas
+		// *** mostrar frame correspondiente {row2}
+		for (i=0;i<12;i++) {	// tasa de 5 fotogramas/segundo
+			VBlankIntrWait();
+		}
+	}
+	for (i=0;i<60;i++) {	// un segundo
+		VBlankIntrWait();
+	}
+// ¿habilito fantasmas de nuevo?
+}
+
+// ...del tutorial
 // Inicializar datos juego
 void init_game() {
 	// Inicializar buffer sprites
@@ -29,12 +216,8 @@
     game.obj_buffer_size=0;
     // Inicializar contador de frames
     game.frame=0;
-
-    /* Inicializar logica de juego */
-    game.vx=0;
-    game.posx=96;
-    game.posy=100;
-
+
+	partida();		// inicializar datos de los sprites
 }

 // Cargar fondo
@@ -51,61 +234,48 @@
 void load_sprites() {
     memcpy(pal_obj_mem, sprites_gfxPal, sprites_gfxPalLen);
 	memcpy(&tile_mem[4][0], sprites_gfxTiles, sprites_gfxTilesLen);
-	obj_set_attr(&game.obj_buffer[game.obj_buffer_size++], ATTR0_SQUARE, ATTR1_SIZE_32x32,  ATTR2_PALBANK(0)|ATTR2_PRIO(0)|0);
-}
-
-// Actualizar y mostar sprites en pantalla
+	// .obp habrá que asignarle algún &game.obj_buffer[ ...
+	// *** *** NI IDEA DE LO QUE ESTOY HACIENDO *** ***
+	pac.obp = &game.obj_buffer[game.obj_buffer_size++];	// espero que ése esté bien
+	obj_set_attr(pac.obp, ATTR0_SQUARE, ATTR1_SIZE_32x32,  ATTR2_PALBANK(0)|ATTR2_PRIO(2)|0);	// ¿PRIO(2) = pacman debajo?
+	for (int i=0; i<FANTS; i++) {
+		gh[i].obp = &game.obj_buffer[game.obj_buffer_size++];	// ** NI IDEA **
+		obj_set_attr(gh[i].obp, ATTR0_SQUARE, ATTR1_SIZE_32x32,  ATTR2_PALBANK(0)|ATTR2_PRIO(1-i)|0);	// distinta prioridad
+	}
+}
+
+/* a la hora de mostrar los sprites:
+ * hflip: ...attr1 |= (dir==MOVEL)?ATTR1_HFLIP:0;
+ * vflip: ...attr1 |= (dir==MOVEU)?ATTR1_VFLIP:0;
+ * selección sprite PacMan: (dir & MOVED)?{row0}:{row1}	// detecta dirección horiz/vert
+ * */
+
+// Actualizar y mostar sprites en pantalla ***
 void update_sprites() {
-    obj_set_pos(&game.obj_buffer[0], game.posx, game.posy);
-    if(game.vx==0) {
-		game.obj_buffer[0].attr2=ATTR2_BUILD(16*5, 0, 0);
-	}
-	else {
-		game.obj_buffer[0].attr2=ATTR2_BUILD((game.frame%5+5) * 16, 0, 0);
-	}
-	if (game.vx<0) {
-		game.obj_buffer[0].attr1 |= ATTR1_HFLIP;
-	}
-	else if(game.vx>0) {
-		game.obj_buffer[0].attr1 &= ~ATTR1_HFLIP;
-	}
+	obj_set_pos(pac.obp, pac.x, pac.y);	// ¿en vez de &game.obj_buffer[0]? ** NO TENGO NI IDEA **
+	pac.obp->attr2 = ATTR2_BUILD((game.frame%5+((dir & MOVED)?0:5))*16, 0, 0); // ** NI IDEA **
+	pac.obp->attr1 &= (~ATTR1_HFLIP & ~ATTR1_VFLIP);	// apago las inversiones un momento
+	pac.obp->attr1 |= (dir==MOVEL)?ATTR1_HFLIP:0;		// a la izquierda, inversión horizontal
+	pac.obp->attr1 |= (dir==MOVEU)?ATTR1_VFLIP:0;		// hacia arriba, inversión vertical
+	// ¿...y los fantasmas?
+	for (int i=0; i<FANTS; i++) {
+		obj_set_pos(gh[i].obp, gh[i].x, gh[i].y);		// ** Dios me proteja...
+		gh[i].obp->attr2 = ATTR2_BUILD((game.frame%5+(i%2*5))*16, 0, 0); // debería funcionar...
+		// ¿necesitaré ajustar algo en ATTR1? Nunca se invierte
     // Copiar buffer to sprites memory
-    oam_copy(oam_mem, game.obj_buffer, game.obj_buffer_size);
+    oam_copy(oam_mem, game.obj_buffer, game.obj_buffer_size);	// ¿habrá que cambiar algo?
 }

 // Actualizar datos juego
 void update_game() {
-/*    game.posx += 2*key_tri_horz();
-    game.posy += 2*key_tri_vert();
-    if(key_hit(KEY_A)) {
-		game.posx -= 10;
-	}
-	if(key_hit(KEY_B)) {
-		game.posx += 10;
-	}*/
-	game.vx = 2*key_tri_horz();
-	game.posx += game.vx;
+	mover_come();		// mueve el pacman, cambiando de dirección si procede
+	if (mover_fant()) {	// mueve los fantasmas, comprobando posible colisión
+		palmatoria();	// animación muerte pacman y ¿vuelta a empezar?
+		partida();
+	}
 }

 // Inicializar sistema grafico
-/*void init_display() {
-    /***** CODIGO DEMO JAQUERIA. ELIMINAR AL INICIO DEL TALLER*********/
-/*    REG_DISPCNT= DCNT_MODE0 | DCNT_BG2;
-    const unsigned short backgroundz_gfxTiles[1424] __attribute__((aligned(4))) ={0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFAF,0xFFFF,0xC10F,0xFFFF,0x000E,0xFFC1,0x000D,0xB300,0x000B,0x0000,0x000A,0x0000,0x0009,0x0000,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFC3,0xFFFF,0xE300,0xFFFF,0x0000,0xFFE3,0x0007,0x0000,0x0006,0x0000,0x0004,0x0000,0x0004,0x0000,0x0001,0x0000,0x0001,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xD500,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xFFFF,0xFFFF,0xFFE6,0xFFFF,0xFA00,0xFFFF,0xF800,0xFFFF,0xF700,0xFFFF,0xF700,0xFFFF,0xF500,0xFFFF,0xF400,0xFFFF,0xFFFF,0xBFFF,0xFFFF,0xCFFF,0xFFFF,0x8FFF,0xFFFF,0x7FFF,0xFFFF,0x3FFF,0xFFFF,0x4FFF,0xFFFF,0x1FFF,0xFFFF,0x1FFF,0xF400,0xFFFF,0xF300,0xFFFF,0xF100,0xFFFF,0xF100,0xFFFF,0xF000,0xFFFF,0xF000,0xFFFF,0xF000,0xFFFF,0xF000,0xFFFF,0xFFFF,0x1FFF,0xFFFF,0x0FFF,0xFFFF,0x0FFF,0xFFFF,0x0EFF,0xFFFF,0x0DFF,0xFFFF,0x0BFF,0xFFFF,0x09FF,0xFFFF,0x06FF,0xF000,0xFFFF,0xD000,0xFFFF,0xC000,0xFFFF,0xC000,0xFFFF,0xB000,0xFFFF,0x9000,0xFFFF,0x9000,0xFFFF,0x8000,0xFFFF,0xFFFF,0x04FF,0xFFFF,0x01FF,0xFFFF,0x00FF,0xFFFF,0x00EF,0xFFFF,0x00EF,0xFFFF,0x00DF,0xFFFF,0x00DF,0xFFFF,0x00BF,0x7000,0xFFFF,0x5000,0xFFFF,0x5000,0xFFFF,0x4000,0xFFFF,0x3000,0xFFFF,0x3000,0xFFFF,0x3000,0xFFFF,0x3000,0xFFFF,0xFFFF,0x00BF,0xFFFF,0x009F,0xFFFF,0x009F,0xFFFF,0x005F,0xFFFF,0x004F,0xFFFF,0x001F,0xFFFF,0x001F,0xFFFF,0x000F,0x1000,0xFFFF,0x1000,0xFFFF,0x1000,0xFFFF,0x0000,0xFFFF,0x0000,0xFFFF,0x0000,0xFFFF,0x0000,0xFFFF,0x0000,0xFFFE,0xFFFF,0x000F,0xFFFF,0x000D,0xFFFF,0x000B,0xFFFF,0x0009,0xFFFF,0x0008,0xFFFF,0x0006,0xFFFF,0x0004,0xFFFF,0x0004,0x0000,0xFFFE,0x0000,0xFFFD,0x0000,0xFFFC,0x0000,0xFFF9,0x0000,0xFFF9,0x0000,0xFFF9,0x0000,0xFFF6,0x0000,0xFFF4,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xEFFF,0xFFFF,0x4FFF,0xFFFF,0x3FFF,0xFFFF,0x2FFF,0xFFFF,0x1FFF,0xFFFF,0x0FFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xBBBC,0xBBBB,0x0000,0x0000,0x0000,0x0000,0x0000,0x4555,0x0000,0xDCC9,0x0000,0xCCC0,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xABBB,0x8888,0x0000,0x0000,0x0000,0x0000,0x7754,0x6665,0xCCCC,0xCCCC,0xCCCC,0xCCCC,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0x8888,0xFA88,0x0000,0xC000,0x0000,0x0000,0x9877,0x004A,0xCCCC,0x03CC,0xCCCC,0x0CCC,0xFFFF,0x0002,0xFFFF,0x0002,0xFFFF,0x0000,0xFFFF,0x0000,0xEFFE,0x0000,0xEFF1,0x0000,0xAF40,0x0000,0xA600,0x0000,0x0000,0xFFF4,0x0000,0xFFF4,0x0000,0xFFF1,0x0000,0xFFF0,0x0000,0xFFF0,0x0000,0xFFF0,0x0000,0xFFF0,0x0000,0xFFE0,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xBFFF,0xFFFF,0x4FFF,0xFFFF,0x0FFF,0xFFFF,0x49FF,0xFFFF,0xA1FF,0xFFFF,0xD0EF,0xFFFF,0xFFFF,0xFFFD,0xFFFF,0xFF40,0xFFFF,0xA057,0xFFFF,0x1CDD,0xFFE2,0xDDDE,0xFF70,0x1BDD,0xFFF7,0xA0BD,0xFFFF,0xFFFF,0x0FFF,0xFFFF,0x0FFF,0xFFFF,0x0CFF,0xFFFF,0x0BFF,0xFFFF,0x08FF,0xFFFF,0x07FF,0xFFFF,0x04FF,0xFFFF,0x02FF,0x0000,0xCC30,0x0000,0xCA00,0x0000,0xC000,0x0000,0x4000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xCCCC,0xCCCC,0xCCCC,0xCCCC,0xCCCC,0xCCCC,0xCCCC,0xCCCC,0xCCC8,0xCCCC,0xCCC0,0xCCCC,0xCC20,0xCCCC,0xC800,0xCCCC,0xCCCC,0xCCCC,0xCCCC,0xCCCC,0xCCCC,0xCCCC,0xCCCC,0xCCCC,0xCCCC,0xCCCC,0xCCCC,0xCCCC,0xCCCC,0xCCCC,0xCCCC,0xCCCC,0x2000,0x0000,0x000A,0x0000,0x008C,0x0000,0x06CC,0x0000,0x7CCC,0x0000,0xCCCC,0x0003,0xCCCC,0x002D,0xCCCC,0x01CC,0x0000,0xFFE0,0x0000,0xFFE0,0x0000,0xFFE0,0x0000,0xFFE0,0x0000,0xFFD0,0x0000,0xFFD0,0x0000,0xFFC0,0x0000,0xFFC0,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0x7778,0xEFFF,0x4430,0xCFFF,0xDD90,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFF87,0xFFFF,0xFF04,0x5FFF,0xFB0D,0x04FF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0x88AD,0xFFFB,0x0300,0xFC00,0x2D00,0xD000,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0x89AF,0x8888,0x200E,0x4444,0x600E,0xDDDD,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xF988,0x888D,0xC014,0x0005,0xC02D,0x0005,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0x8888,0x8CF8,0x0000,0x05C0,0x0000,0x05C0,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0x8888,0xFFB9,0x0000,0xD100,0x7771,0x0028,0xFFFF,0xE76F,0xFFFF,0x6D0F,0xFFFF,0x240B,0xFFFF,0xF47F,0xFFFF,0xFFFF,0x9EFF,0xD999,0x07FF,0x6000,0x08FE,0x6000,0xFD09,0xFFFF,0xFFD1,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xEFFF,0x7777,0x9FFF,0x4440,0x7FFF,0xDDD0,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFF87,0xFFFF,0xFF04,0xFFFF,0xFD0B,0xFFFF,0xFFFF,0x01FF,0xFFFF,0x00FF,0xFFFF,0x00FF,0xFFFF,0x00EF,0xFFFF,0x00EF,0xFFFF,0x00EF,0xFFFF,0x00DF,0xFFFF,0x00CF,0xA000,0xCCCC,0x1000,0xCCCD,0x0000,0xCCC5,0x0000,0xCC90,0x0000,0xCB00,0x0000,0xD200,0x0000,0x4000,0x0000,0x0000,0xCCCC,0xCCCC,0xCCCC,0xCCCC,0xCCCC,0xCCCC,0xCCCC,0xCCCC,0xCCCC,0xCCCC,0xCCCC,0xCCCC,0xCCCC,0xCCCC,0xCCCA,0xCCCC,0xCCCC,0x0CCC,0xCCCC,0xACCC,0xCCCC,0xCCCC,0xCCCC,0xCCCC,0xCCCC,0xCCCC,0xCCCC,0xCCCC,0xCCCC,0xCCCC,0xCCCC,0xCCCC,0x0000,0x0000,0x0000,0x0000,0x000B,0x0000,0x00BC,0x0000,0x0BCC,0x0000,0x9CCC,0x0000,0xCCCC,0x0009,0xCCCC,0x00AC,0x0000,0xFFB0,0x0000,0xFFA0,0x0000,0xFF90,0x0000,0xFF90,0x0000,0xFF60,0x0000,0xFF50,0x0000,0xFF40,0x0000,0xFF30,0x8FFF,0xDD70,0x3FFF,0xDE40,0x0FFF,0xDE20,0x0EFF,0xDE00,0x0DFF,0xDD00,0x0BFF,0xDA00,0x09FF,0xC700,0x06FF,0x9500,0xF80A,0x00EF,0xF406,0x00DF,0xF103,0x00DF,0xF102,0x00DF,0xF001,0x00DF,0xD000,0x00DF,0xA000,0x00DF,0x6000,0x00DF,0x4D00,0x9000,0x7D10,0x6000,0xAD20,0x6000,0xDD30,0x6000,0xED50,0x6000,0xED80,0x6002,0xEDB0,0x6005,0xDDD0,0x6007,0x400E,0xDDDE,0x200F,0xDDDE,0x000F,0xDDDE,0x000F,0xDDDD,0x000F,0xEDDB,0x000F,0xEDD9,0x000F,0xDDD6,0x000F,0xBDD3,0xC00D,0x0006,0xC00D,0x0006,0xD00C,0x0005,0xC009,0x0005,0xD005,0x0005,0xC000,0x0005,0xC000,0x0005,0xC000,0x0005,0x0000,0x05D0,0xDE70,0x05FE,0xFF70,0x05FF,0xFF80,0x05FF,0xBC60,0x05FE,0x0000,0x05F0,0x0000,0x05F0,0x0000,0x05F0,0xDDE0,0x001E,0xDDB0,0x000D,0xDD80,0x0009,0xDD40,0x0005,0xDE10,0x0003,0xEC00,0x0001,0xD700,0xD000,0x8200,0x0000,0x08FA,0x6000,0x08F8,0x6000,0x08F8,0x6000,0x08F8,0x6000,0x08FA,0x6000,0x08FF,0x6000,0x08FF,0x6000,0x08FE,0x6000,0x5FFF,0xDDD0,0x2FFF,0xEDB0,0x0FFF,0xDD90,0x0EFF,0xCD60,0x0BFF,0xAE30,0x07FF,0x8E00,0x03FF,0x5D00,0x01FF,0x1D00,0xFB07,0xFFFF,0xF902,0xFFFF,0xF600,0xFFFF,0xF300,0xFFFF,0xF100,0xFFFF,0xE000,0xFFFF,0xB000,0xFFFF,0x8000,0xFFFF,0xFFFF,0x00AF,0xFFFF,0x008F,0xFFFF,0x006F,0xFFFF,0x004F,0xFFFF,0x002F,0xFFFF,0x000F,0xFFFF,0x000F,0xFFFF,0x000E,0xCCB0,0xCCCC,0xCC10,0xCCCC,0xC300,0xCCCC,0x5000,0xCCCC,0x0000,0xCCC9,0x0000,0xCCB0,0x0000,0xCD10,0x0000,0xC300,0xCCCC,0x09CC,0xCCCC,0xACCC,0xCCCC,0xCCCC,0xCCCC,0xCCCC,0xCCCC,0xCCCC,0xCCCC,0xCCCC,0xCCCC,0xCCCC,0xCCCC,0xCCCC,0x0000,0x0000,0x0000,0x0000,0x000A,0x0000,0x00AC,0x0000,0x0BCC,0x0000,0xACCC,0x0000,0xCCCC,0x000A,0xCCCC,0x00AC,0x0000,0xFF10,0x0000,0xFF00,0x0000,0xFF00,0x0000,0xFF00,0x0000,0xFF00,0x0000,0xFF00,0x0000,0xFF00,0x0000,0xFD00,0x03FF,0x6300,0x00FF,0x2200,0x00EF,0x0000,0x00BF,0x0000,0x008F,0x4500,0x005F,0x8800,0x004F,0xBB00,0x003F,0xEE00,0x2000,0x00DF,0x0000,0x00DF,0x0000,0x00DE,0x0000,0x00DC,0x0000,0x00DB,0x0000,0x00E8,0x0000,0x02F5,0x0000,0x3FF1,0xDDE0,0x6009,0xDDE2,0x600B,0xDDE5,0x600D,0xDDD7,0x600E,0xDDD9,0x603E,0xDDDA,0x806D,0x0000,0xD000,0x0000,0xC300,0x000F,0x9DD2,0x000F,0x7DD1,0x000F,0x4ED0,0x000F,0x0ED0,0x000F,0x0DC0,0x000F,0x0AA0,0x002F,0x0670,0x00EF,0x0330,0xC000,0x0005,0xC000,0x0005,0xC000,0x0005,0xC000,0x0005,0xC000,0x0005,0xD000,0x0005,0xF000,0x0005,0xFB00,0x0005,0xBC60,0x05FD,0xFF80,0x05FF,0xFF80,0x05FF,0xFF80,0x05FF,0xFF80,0x05FF,0x2210,0x05E2,0x0000,0x05C0,0x0000,0x05C0,0x1000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x4000,0x0000,0x08F9,0x6000,0x08F8,0x6000,0x08F9,0x6000,0x08F9,0x6000,0x08F9,0x6000,0x08F8,0x6000,0x08F6,0x6000,0x08F3,0x6000,0x01FF,0x0B00,0x00FF,0x0800,0x00DF,0x0100,0x00AF,0x0000,0x005F,0x3B00,0x000F,0x6C00,0x000F,0x8E00,0x000E,0xAE00,0x5000,0xFFFF,0x3000,0xFFFF,0x1000,0xFFFF,0x0000,0xFFFF,0x0000,0xFFFE,0x0000,0xFFFA,0x0000,0xFFF6,0x0000,0xFFF1,0xFFFF,0x000E,0xFFFF,0x000C,0xFFFF,0x000B,0xFFFF,0x0009,0xFFFF,0x111A,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x1111,0x1111,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0x0000,0x7003,0x0000,0x004E,0x0000,0x03FF,0x1000,0x1EFF,0x3211,0xEFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xCCCC,0xCCCC,0xCCC9,0xCCCC,0x2110,0x1111,0x0000,0x0000,0x2323,0x2223,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xCCCC,0xCCCC,0xCCCC,0xCCCC,0x1011,0x1111,0x0000,0x0000,0x2123,0x3334,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xCCCC,0x0BCC,0xCCCC,0x9CCC,0x0000,0x0000,0x0100,0x0000,0x3333,0x4223,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0x0000,0xFC00,0x0000,0xFC00,0x0000,0xFB00,0x0000,0xFA00,0x7777,0xFC67,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0x113F,0xFF11,0xFFFF,0xFFFF,0xFFFE,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0x1111,0xFFF1,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0x158D,0x8000,0xFFFF,0xFEEF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0x6FFF,0x1112,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFE4,0x1119,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0x1111,0x17D1,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xB111,0x0001,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0x19F0,0x8111,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0x111D,0xCF21,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0x1111,0xFFF2,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF};
-	const unsigned short backgroundz_gfxMap[1024] __attribute__((aligned(4))) ={0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0000,0x0000,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0000,0x0000,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0000,0x0000,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0000,0x0000,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0002,0x0003,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0000,0x0000,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0004,0x0005,0x0006,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0000,0x0000,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0007,0x0000,0x0000,0x0008,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0000,0x0000,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0009,0x0000,0x0000,0x000A,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0000,0x0000,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x000B,0x0000,0x0000,0x000C,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0000,0x0000,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x000D,0x0000,0x0000,0x000E,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0000,0x0000,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x000F,0x0000,0x0000,0x0010,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0000,0x0000,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0011,0x0012,0x0013,0x0014,0x0015,0x0000,0x0000,0x0016,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0017,0x0018,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0000,0x0000,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0019,0x001A,0x001B,0x001C,0x001D,0x0000,0x0000,0x001E,0x001F,0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027,0x0028,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0000,0x0000,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0029,0x0000,0x002A,0x002B,0x002C,0x002D,0x0000,0x002E,0x002F,0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037,0x0038,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0000,0x0000,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0039,0x0000,0x0000,0x003A,0x001C,0x003B,0x003C,0x003D,0x003E,0x003F,0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0000,0x0000,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0048,0x0049,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F,0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057,0x0058,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0000,0x0000,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0000,0x0000,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0000,0x0000,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0000,0x0000,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000};
-	const unsigned short backgroundz_gfxPal[16] __attribute__((aligned(4))) ={0x0000,0x0C63,0x10A4,0x18C6,0x2108,0x294A,0x318C,0x39CE,0x4210,0x4A52,0x5294,0x5AD6,0x6739,0x6F7A,0x73BC,0x7FFF};
-	#define backgroundz_gfxTilesLen 2848
-	#define backgroundz_gfxMapLen 2048
-	#define backgroundz_gfxPalLen 32
-	memcpy(pal_bg_mem, backgroundz_gfxPal, backgroundz_gfxPalLen);
-	memcpy(&tile_mem[0][0], backgroundz_gfxTiles, backgroundz_gfxTilesLen);
-	memcpy(&se_mem[16][0], backgroundz_gfxMap, backgroundz_gfxMapLen);
-	REG_BG2CNT= BG_CBB(0) | BG_SBB(16) | BG_4BPP | BG_REG_64x32 | BG_PRIO(1) | BG_MOSAIC;
-	REG_BG2VOFS= 0;
-	REG_BG2HOFS=240;
-    u32 i=0; while(1){VBlankIntrWait(); REG_BG2HOFS=i++/2+240;}
-	/***************** FIN DEMO ***************************************/
-/*}*/
 void init_display() {
 	REG_DISPCNT = DCNT_MODE0 | DCNT_BG0 | DCNT_OBJ | DCNT_OBJ_1D;
 }
@@ -127,17 +297,22 @@
 	load_sprites();
     // Inicializar video
     init_display();
-
+	// un segundo de retardo antes de empezar
+	for (int i=0;i<60;i++) {
+		VBlankIntrWait();
+	}
+
 	// Bucle infinito. No tenemos sistema operativo al que volver
 	while(1)
 	{
 		// Sincronizar con VBlank mediante interrupcion.
 		// Esto se hace para evitar modificar la memoria a mitad de un refresco de pantalla.
+		// *** si va muy rápido, poner 3 seguidos, por ejemplo
         VBlankIntrWait();
         // Actualizar contador de frames
 		game.frame++;
-        // Leer botones
-		key_poll();
+        // Leer botones ya lo hace la función direccion()
+//		key_poll();
         // Actualizar datos juego
 		update_game();
         // Actualizar sprites


ws: Remove non-working l10n translations.

Which is all of them. :-(

Closes #1255
Reviewed-by: Stef Walter <8a7fbf0f15d3ad982af54ef28f5c117d2494b76c@redhat.com>

--- src/ws/cockpithandlers.c
+++ src/ws/cockpithandlers.c
@@ -142,9 +142,7 @@
     const gchar *name;
     const gchar *code;
   } supported_languages[] = {
-    { NC_("display-language", "English"), "" },
-    { NC_("display-language", "Danish"),  "da" },
-    { NC_("display-language", "German"),  "de" },
+    { NC_("display-language", "English"), "" }
   };

   env = json_object_new ();


make a statuscode comparison unambiguous

--- src/server/ua_subscription.c
+++ src/server/ua_subscription.c
@@ -296,7 +296,7 @@
     // Practically enough, the client sends a uint32 in ms, which we store as datetime, which here is required in as uint32 in ms as the interval
     UA_StatusCode retval = UA_Server_addRepeatedJob(server, *sub->timedUpdateJob, sub->publishingInterval,
                                                     &sub->timedUpdateJobGuid);
-    if(!retval)
+    if(retval == UA_STATUSCODE_GOOD)
         sub->timedUpdateIsRegistered = UA_TRUE;
     return retval;
 }


Fixes to safe reads, closes #422

Fixes to safe reads, closes #422

--- Core/memory.c
+++ Core/memory.c
@@ -434,7 +434,9 @@

     if (addr < 0xFF00) {
         if (gb->oam_write_blocked && !GB_is_cgb(gb)) {
-            GB_trigger_oam_bug_read(gb, addr);
+            if (!gb->disable_oam_corruption) {
+                GB_trigger_oam_bug_read(gb, addr);
+            }
             return 0xff;
         }

@@ -705,6 +707,9 @@

 uint8_t GB_safe_read_memory(GB_gameboy_t *gb, uint16_t addr)
 {
+    if (unlikely(addr == 0xFF00 + GB_IO_JOYP)) {
+        return gb->io_registers[GB_IO_JOYP];
+    }
     gb->disable_oam_corruption = true;
     uint8_t data = read_map[addr >> 12](gb, addr);
     gb->disable_oam_corruption = false;


rdpdr/irp_queue: fix a compile warning

rdpdr/irp_queue: fix a compile warning

--- channels/rdpdr/irp_queue.c
+++ channels/rdpdr/irp_queue.c
@@ -131,10 +131,9 @@
 irp_queue_next(IRPQueue * queue, IRP * irp)
 {
 	struct irp_queue_node *walker = NULL;
-	struct irp_queue_node *prev = NULL;

 	if (irp_queue_empty(queue))
-		return;
+		return NULL;

 	for (walker = queue->head; walker; walker = walker->next)
 		if (walker->irp == irp)


created version of make_index_tuple that works with linux

--- Deserialize.h
+++ Deserialize.h
@@ -40,35 +40,33 @@
       return t;
     }
   };
-
-  struct _;

-
   /// <summary>
   /// Utility type which enables the composition of a sequence [0, sizeof...(Ts))
   /// </summary>
-  template<unsigned... Indices>
-  struct index_tuple
-  {
+  template<unsigned ...Indicies>
+  struct index_tuple {
+
     /// Generate an index_tuple with an additional element.
     template<unsigned N>
     struct append {
-      typedef index_tuple<Indices..., N> type;
+      typedef index_tuple<Indicies..., N> type;
     };
   };

+  template<typename ...Members>
+  struct make_index_tuple; //So linux doesn't bitch
+
   /// Unary metafunction that generates an index_tuple containing [0, Size)
-  template<class Head = _, class... Tail>
-  struct make_index_tuple
-  {
+  template<typename Head, typename ...Tail>
+  struct make_index_tuple<Head, Tail...>{
     typedef typename make_index_tuple<Tail...>::type::template append<sizeof...(Tail)>::type type;
   };

   // Terminal case of the recursive metafunction.
   template<>
-  struct make_index_tuple<_>
-  {
+  struct make_index_tuple<>{
     typedef index_tuple<> type;
   };


Minor change: fixing copyright comment block in header file.

--- FileMD5Hash.h
+++ FileMD5Hash.h
@@ -1,4 +1,4 @@
- /*
+/*
  *  FileMD5Hash.h
  *  Compute MD5 hash of large file efficiently on iOS and Mac OS X
  *  http://www.joel.lopes-da-silva.com/2010/09/07/compute-md5-or-sha-hash-of-large-file-efficiently-on-ios-and-mac-os-x/
@@ -26,4 +26,4 @@
 #define FileHashDefaultChunkSizeForReadingData 4096

 CFStringRef FileMD5HashCreateWithPath(CFStringRef filePath,
-                                      size_t chunkSizeForReadingData);+                                      size_t chunkSizeForReadingData);


Working on algo header

Working on algo header

--- src/Core/Algorithms/Legacy/Fields/FieldData/SetFieldDataToConstantValue.h
+++ src/Core/Algorithms/Legacy/Fields/FieldData/SetFieldDataToConstantValue.h
@@ -30,21 +30,15 @@
 #ifndef CORE_ALGORITHMS_FIELDS_FIELDDATA_SetFieldDataToConstantValue_H
 #define CORE_ALGORITHMS_FIELDS_FIELDDATA_SetFieldDataToConstantValue_H 1

-//! Datatypes that the algorithm uses
-#include <Core/Datatypes/Mesh.h>
-#include <Core/Datatypes/Field.h>
-#include <Core/Datatypes/Matrix.h>
-#include <Core/Datatypes/NrrdData.h>
+#include <Core/Datatypes/DatatypeFwd.h>
+#include <Core/Algorithms/Base/AlgorithmBase.h>

-//! Base class for algorithm
-#include <Core/Algorithms/Util/AlgoBase.h>
+#include <Core/Algorithms/Legacy/Fields/share.h>

-//! for Windows support
-#include <Core/Algorithms/Fields/share.h>
-
-namespace SCIRunAlgo {
-
-using namespace SCIRun;
+namespace SCIRun {
+  namespace Core {
+    namespace Algorithms {
+      namespace Fields {

 class SCISHARE SetFieldDataToConstantValueAlgo : public AlgoBase
 {
@@ -61,7 +55,7 @@
     bool run(FieldHandle input, FieldHandle& output);
 };

-} // end namespace SCIRunAlgo
+}}}}

 #endif


[Modify] doc for size calculator

[Modify] doc for size calculator

--- LYCategory/Classes/_Foundation/_File/NSFileManager+Size.h
+++ LYCategory/Classes/_Foundation/_File/NSFileManager+Size.h
@@ -31,6 +31,12 @@

 @interface NSFileManager (Size)

+/**
+ GET FILE SIZE IN MEGABYTE AT PATH
+
+ @param filepath filepath
+ @return size(MB)
+ */
 + (float)fileSizeAtPath:(NSString *)filepath;

 @end


* subversion/libsvn_client/changelist.c   (set_entry_changelist): More svn_path_* deprecated API removal.

--- subversion/libsvn_client/changelist.c
+++ subversion/libsvn_client/changelist.c
@@ -26,6 +26,7 @@
 #include "svn_client.h"
 #include "svn_wc.h"
 #include "svn_pools.h"
+#include "svn_dirent_uri.h"
 #include "svn_path.h"
 #include "svn_hash.h"

@@ -79,7 +80,7 @@
   /* Get the ADM_ACCESS for our file's parent directory,
      specifically. */
   SVN_ERR(svn_wc_adm_retrieve(&adm_access, b->adm_access,
-                              svn_path_dirname(path, pool), pool));
+                              svn_dirent_dirname(path, pool), pool));
   return svn_wc_set_changelist(path, b->changelist, adm_access,
                                b->ctx->cancel_func, b->ctx->cancel_baton,
                                b->ctx->notify_func2, b->ctx->notify_baton2,


On the fsfs-improvements branch:  refactor some ID allocation code
into shared functions.

* subversion/libsvn_fs_fs/transaction.c
  (set_uniquifier): new utility function
  (svn_fs_fs__set_entry,
   rep_write_contents_close): use it
  (get_final_id): new utility function
  (validate_root_noderev,
   write_final_rev): use it

git-svn-id: 2c7ed5bc06a69ba39b874304b5a8005b1c01e2e4@1506344 13f79535-47bb-0310-9956-ffa450edef68

--- subversion/libsvn_fs_fs/transaction.c
+++ subversion/libsvn_fs_fs/transaction.c
@@ -1385,6 +1385,22 @@
   return SVN_NO_ERROR;
 }

+/* Assign the UNIQUIFIER member of REP based on the current state of TXN_ID
+ * in FS.  Allocate the uniquifier in POOL.
+ */
+static svn_error_t *
+set_uniquifier(svn_fs_t *fs,
+               representation_t *rep,
+               apr_pool_t *pool)
+{
+  const char *unique_suffix;
+
+  SVN_ERR(get_new_txn_node_id(&unique_suffix, fs, rep->txn_id, pool));
+  rep->uniquifier = apr_psprintf(pool, "%s/%s", rep->txn_id, unique_suffix);
+
+  return SVN_NO_ERROR;
+}
+
 /* Return TRUE if the TXN_ID member of REP is in use.
  */
 static svn_boolean_t
@@ -1420,7 +1436,6 @@

   if (!rep || !is_txn_rep(rep))
     {
-      const char *unique_suffix;
       apr_hash_t *entries;

       /* Before we can modify the directory, we need to dump its old
@@ -1440,8 +1455,7 @@
       rep = apr_pcalloc(pool, sizeof(*rep));
       rep->revision = SVN_INVALID_REVNUM;
       rep->txn_id = txn_id;
-      SVN_ERR(get_new_txn_node_id(&unique_suffix, fs, txn_id, pool));
-      rep->uniquifier = apr_psprintf(pool, "%s/%s", txn_id, unique_suffix);
+      SVN_ERR(set_uniquifier(fs, rep, pool));
       parent_noderev->data_rep = rep;
       SVN_ERR(svn_fs_fs__put_node_revision(fs, parent_noderev->id,
                                            parent_noderev, FALSE, pool));
@@ -1927,7 +1941,6 @@
 rep_write_contents_close(void *baton)
 {
   struct rep_write_baton *b = baton;
-  const char *unique_suffix;
   representation_t *rep;
   representation_t *old_rep;
   apr_off_t offset;
@@ -1947,9 +1960,7 @@
   /* Fill in the rest of the representation field. */
   rep->expanded_size = b->rep_size;
   rep->txn_id = svn_fs_fs__id_txn_id(b->noderev->id);
-  SVN_ERR(get_new_txn_node_id(&unique_suffix, b->fs, rep->txn_id, b->pool));
-  rep->uniquifier = apr_psprintf(b->parent_pool, "%s/%s", rep->txn_id,
-                                 unique_suffix);
+  SVN_ERR(set_uniquifier(b->fs, rep, b->pool));
   rep->revision = SVN_INVALID_REVNUM;

   /* Finalize the checksum. */
@@ -2400,6 +2411,30 @@
     }

   return SVN_NO_ERROR;
+}
+
+/* Given the potentially txn-local id PART, update that to a permanent ID
+ * based on the REVISION currently being written and the START_ID for that
+ * revision.  Use the repo FORMAT to decide which implementation to use.
+ */
+static void
+get_final_id(const char **part,
+             svn_revnum_t revision,
+             const char *start_id,
+             int format,
+             apr_pool_t *pool)
+{
+  if (**part == '_')
+    {
+      if (format >= SVN_FS_FS__MIN_NO_GLOBAL_IDS_FORMAT)
+        *part = apr_psprintf(pool, "%s-%ld", *part + 1, revision);
+      else
+        {
+          char buf[MAX_KEY_SIZE + 2];
+          svn_fs_fs__add_keys(start_id, *part + 1, buf);
+          *part = apr_pstrdup(pool, buf);
+        }
+    }
 }

 /* Copy a node-revision specified by id ID in fileystem FS from a
@@ -2445,10 +2480,8 @@
 {
   node_revision_t *noderev;
   apr_off_t my_offset;
-  char my_node_id_buf[MAX_KEY_SIZE + 2];
-  char my_copy_id_buf[MAX_KEY_SIZE + 2];
   const svn_fs_id_t *new_id;
-  const char *node_id, *copy_id, *my_node_id, *my_copy_id;
+  const char *node_id, *copy_id;
   fs_fs_data_t *ffd = fs->fsap_data;
   *new_id_p = NULL;

@@ -2550,38 +2583,14 @@
   SVN_ERR(svn_fs_fs__get_file_offset(&my_offset, file, pool));

   node_id = svn_fs_fs__id_node_id(noderev->id);
-  if (*node_id == '_')
-    {
-      if (ffd->format >= SVN_FS_FS__MIN_NO_GLOBAL_IDS_FORMAT)
-        my_node_id = apr_psprintf(pool, "%s-%ld", node_id + 1, rev);
-      else
-        {
-          svn_fs_fs__add_keys(start_node_id, node_id + 1, my_node_id_buf);
-          my_node_id = my_node_id_buf;
-        }
-    }
-  else
-    my_node_id = node_id;
-
+  get_final_id(&node_id, rev, start_node_id, ffd->format, pool);
   copy_id = svn_fs_fs__id_copy_id(noderev->id);
-  if (*copy_id == '_')
-    {
-      if (ffd->format >= SVN_FS_FS__MIN_NO_GLOBAL_IDS_FORMAT)
-        my_copy_id = apr_psprintf(pool, "%s-%ld", copy_id + 1, rev);
-      else
-        {
-          svn_fs_fs__add_keys(start_copy_id, copy_id + 1, my_copy_id_buf);
-          my_copy_id = my_copy_id_buf;
-        }
-    }
-  else
-    my_copy_id = copy_id;
+  get_final_id(&copy_id, rev, start_copy_id, ffd->format, pool);

   if (noderev->copyroot_rev == SVN_INVALID_REVNUM)
     noderev->copyroot_rev = rev;

-  new_id = svn_fs_fs__id_rev_create(my_node_id, my_copy_id, rev, my_offset,
-                                    pool);
+  new_id = svn_fs_fs__id_rev_create(node_id, copy_id, rev, my_offset, pool);

   noderev->id = new_id;


Added a file missing from the previous checkin.

error: pathspec 'src/vw/Cartography/tests/TestPointImageManipulation.h' did not match any file(s) known to git

--- src/vw/Cartography/tests/TestPointImageManipulation.h
+++ src/vw/Cartography/tests/TestPointImageManipulation.h
@@ -0,0 +1,59 @@
+// __BEGIN_LICENSE__
+//
+// Copyright (C) 2006 United States Government as represented by the
+// Administrator of the National Aeronautics and Space Administration
+// (NASA).  All Rights Reserved.
+//
+// Copyright 2006 Carnegie Mellon University. All rights reserved.
+//
+// This software is distributed under the NASA Open Source Agreement
+// (NOSA), version 1.3.  The NOSA has been approved by the Open Source
+// Initiative.  See the file COPYING at the top of the distribution
+// directory tree for the complete NOSA document.
+//
+// THE SUBJECT SOFTWARE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY OF ANY
+// KIND, EITHER EXPRESSED, IMPLIED, OR STATUTORY, INCLUDING, BUT NOT
+// LIMITED TO, ANY WARRANTY THAT THE SUBJECT SOFTWARE WILL CONFORM TO
+// SPECIFICATIONS, ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR
+// A PARTICULAR PURPOSE, OR FREEDOM FROM INFRINGEMENT, ANY WARRANTY THAT
+// THE SUBJECT SOFTWARE WILL BE ERROR FREE, OR ANY WARRANTY THAT
+// DOCUMENTATION, IF PROVIDED, WILL CONFORM TO THE SUBJECT SOFTWARE.
+//
+// __END_LICENSE__
+
+// TestGeoReference.h
+#include <cxxtest/TestSuite.h>
+
+#include <vw/Cartography/PointImageManipulation.h>
+
+using namespace std;
+using namespace vw;
+using namespace vw::cartography;
+
+class TestPointImageManipulation : public CxxTest::TestSuite
+{
+public:
+
+  void test_xyz_to_lon_lat_conversions()
+  {
+    // Test a full forward and reverse transformation
+    Vector3 xyz(-2197110.000000, 1741355.875000, 1898886.875000);
+    Vector3 lon_lat_alt = xyz_to_lon_lat_radius(xyz);
+    Vector3 xyz2 = lon_lat_radius_to_xyz(lon_lat_alt);
+
+    TS_ASSERT_DELTA(xyz(0), xyz2(0), 1e-2);
+    TS_ASSERT_DELTA(xyz(1), xyz2(1), 1e-2);
+    TS_ASSERT_DELTA(xyz(2), xyz2(2), 1e-2);
+
+    // Test to see if things still work for West positive coordinate
+    // systems.
+    lon_lat_alt = xyz_to_lon_lat_radius(xyz,false);
+    xyz2 = lon_lat_radius_to_xyz(lon_lat_alt,false);
+
+    TS_ASSERT_DELTA(xyz(0), xyz2(0), 1e-2);
+    TS_ASSERT_DELTA(xyz(1), xyz2(1), 1e-2);
+    TS_ASSERT_DELTA(xyz(2), xyz2(2), 1e-2);
+  }
+
+};
+


* subversion/libsvn_wc/wc_db_pristine.c   (svn_wc__db_pristine_read): Convert another assert into an svn_error_t    to give better errors for NULL checksums after a dodgy upgrade.

--- subversion/libsvn_wc/wc_db_pristine.c
+++ subversion/libsvn_wc/wc_db_pristine.c
@@ -225,7 +225,15 @@

   SVN_ERR_ASSERT(contents != NULL);
   SVN_ERR_ASSERT(svn_dirent_is_absolute(wri_abspath));
-  SVN_ERR_ASSERT(sha1_checksum != NULL);
+
+  /* Some 1.6-to-1.7 wc upgrades created rows without checksums and
+     updating such a row passes NULL here. */
+  if (!sha1_checksum)
+    return svn_error_createf(SVN_ERR_WC_CORRUPT, NULL,
+                             _("Can't read '%s' from pristine store "
+                               "because no checksum supplied"),
+                             svn_dirent_local_style(wri_abspath, scratch_pool));
+
   SVN_ERR_ASSERT(sha1_checksum->kind == svn_checksum_sha1);

   SVN_ERR(svn_wc__db_wcroot_parse_local_abspath(&wcroot, &local_relpath, db,


Comments

Comments

--- Library/Sources/Stroika/Foundation/Streams/OutputStream.h
+++ Library/Sources/Stroika/Foundation/Streams/OutputStream.h
@@ -48,6 +48,11 @@
  *      @todo   Consider/document approaches to timeouts. We COULD have a stream class where
  *              it was a PROPERTY OF THE CLASS (or alternate API) where writes timeout after
  *              a certain point.
+ *
+ *      @todo   Add abiiliy to SetEOF (); You can SEEK, but if you seek backwards, and start writing - that doesnt change EOF. EOF
+ *              remains fixed as max written to. DODUCMNET THIS (for text and binary) - and provide a SetEOF() method
+ *              (maybe just for seekable streams)? Maybe add rule that SetEOF () can only go backwards (shorten). Then call
+ *              PullBackEOF() or RestrictEOF() or RemovePast(); OR ResetEOFToCurrentPosiiton(). Later maybe best API.
  */


Extended the export macro definition to also account for gcc

--- svclib/include/svclib/build_options.h
+++ svclib/include/svclib/build_options.h
@@ -1,58 +1,71 @@
-#pragma once
-
-//   This file is part of the svclib library, licensed under the terms of the MIT License.
-//
-//   The MIT License
-//   Copyright (C) 2015  Augustin Preda (thegusty999@gmail.com)
-//
-//   Permission is hereby granted, free of charge, to any person obtaining a copy
-//   of this software and associated documentation files (the "Software"), to deal
-//   in the Software without restriction, including without limitation the rights
-//   to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-//   copies of the Software, and to permit persons to whom the Software is
-//   furnished to do so, subject to the following conditions:
-//
-//   The above copyright notice and this permission notice shall be included in
-//   all copies or substantial portions of the Software.
-//
-//   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-//   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-//   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-//   AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-//   LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-//   OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-//   THE SOFTWARE.
-//
-//   Build options.
-//
-
-
-//
-// Includes
-//
-
-//
-// This project's headers
-//
-
-// Add platform specific definitions.
-#include "svclib/platform.h"
-// Version info
-#include "svclib/version.hpp"
-
-//
-// Macro definitions for import / export.
-//
-#ifdef SVCLIB_EXP
-# define SVCLIB_EXPORT_SYMBOL __declspec (dllexport)
-# define SVCLIB_EXPIMP_TEMPLATE
-#elif SVCLIB_STATIC
-# define SVCLIB_EXPORT_SYMBOL
-# define SVCLIB_EXPIMP_TEMPLATE
-#else
-# define SVCLIB_EXPORT_SYMBOL __declspec (dllimport)
-# define SVCLIB_EXPIMP_TEMPLATE extern
-#endif  //  SVCLIB_EXP
-
-
-
+#pragma once
+
+//   This file is part of the svclib library, licensed under the terms of the MIT License.
+//
+//   The MIT License
+//   Copyright (C) 2015  Augustin Preda (thegusty999@gmail.com)
+//
+//   Permission is hereby granted, free of charge, to any person obtaining a copy
+//   of this software and associated documentation files (the "Software"), to deal
+//   in the Software without restriction, including without limitation the rights
+//   to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+//   copies of the Software, and to permit persons to whom the Software is
+//   furnished to do so, subject to the following conditions:
+//
+//   The above copyright notice and this permission notice shall be included in
+//   all copies or substantial portions of the Software.
+//
+//   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+//   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+//   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+//   AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+//   LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+//   OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+//   THE SOFTWARE.
+//
+//   Build options.
+//
+
+
+//
+// Includes
+//
+
+//
+// This project's headers
+//
+
+// Add platform specific definitions.
+#include "svclib/platform.h"
+// Version info
+#include "svclib/version.hpp"
+
+//
+// Macro definitions for import / export.
+//
+#if defined(_MSC_VER)
+# ifdef SVCLIB_EXP
+#  define SVCLIB_EXPORT_SYMBOL __declspec (dllexport)
+#  define SVCLIB_EXPIMP_TEMPLATE
+# elif SVCLIB_STATIC
+#  define SVCLIB_EXPORT_SYMBOL
+#  define SVCLIB_EXPIMP_TEMPLATE
+# else
+#  define SVCLIB_EXPORT_SYMBOL __declspec (dllimport)
+#  define SVCLIB_EXPIMP_TEMPLATE extern
+# endif  //  SVCLIB_EXP
+#elif defined(_GCC)
+# ifdef SVCLIB_EXP
+#  define SVCLIB_EXPORT_SYMBOL __attribute__((visibility("default")))
+#  define SVCLIB_EXPIMP_TEMPLATE
+# elif SVCLIB_STATIC
+#  define SVCLIB_EXPORT_SYMBOL
+#  define SVCLIB_EXPIMP_TEMPLATE
+# else
+#  define SVCLIB_EXPORT_SYMBOL
+#  define SVCLIB_EXPIMP_TEMPLATE extern
+# endif  //  SVCLIB_EXP
+#else
+#  define SVCLIB_EXPORT_SYMBOL
+#  define SVCLIB_EXPIMP_TEMPLATE
+#endif


combine-diff: calculate mode_differs earlier

One loop combined both the patch generation and checking
whether there was any mode change to report. Let's factor
that into two separate loops, as we may care about the mode
change even if we are not generating patches (e.g., because
we are showing a binary diff, which will come in a future
patch).

Signed-off-by: Jeff King <696e3fbcf235d40b6ea1ebd61c87cbea79d444e7@peff.net>
Signed-off-by: Junio C Hamano <a6723cc3f76163bf7adb636a73ac3b0ceb3e6b9b@pobox.com>

--- combine-diff.c
+++ combine-diff.c
@@ -845,6 +845,13 @@
 			close(fd);
 	}

+	for (i = 0; i < num_parent; i++) {
+		if (elem->parent[i].mode != elem->mode) {
+			mode_differs = 1;
+			break;
+		}
+	}
+
 	for (cnt = 0, cp = result; cp < result + result_size; cp++) {
 		if (*cp == '\n')
 			cnt++;
@@ -893,8 +900,6 @@
 				     elem->parent[i].mode,
 				     &result_file, sline,
 				     cnt, i, num_parent, result_deleted);
-		if (elem->parent[i].mode != elem->mode)
-			mode_differs = 1;
 	}

 	show_hunks = make_hunks(sline, cnt, num_parent, dense);


Use module-correct APIs to get the GSource from the sofia root

--- src/sip-connection-manager.c
+++ src/sip-connection-manager.c
@@ -68,7 +68,7 @@

   priv->sofia_root = su_glib_root_create(obj);
   su_root_threading(priv->sofia_root, 0);
-  source = su_root_gsource(priv->sofia_root);
+  source = su_glib_root_gsource(priv->sofia_root);
   g_source_attach(source, NULL);

   priv->debug_sender = tp_debug_sender_dup ();
@@ -120,7 +120,7 @@
   RakiaConnectionManagerPrivate *priv = TPSIP_CONNECTION_MANAGER_GET_PRIVATE (self);
   GSource *source;

-  source = su_root_gsource(priv->sofia_root);
+  source = su_glib_root_gsource(priv->sofia_root);
   g_source_destroy(source);
   su_root_destroy(priv->sofia_root);


Re-factor matrix exponential. Put all routines in a class. I think this is a cleaner design.

--- unsupported/Eigen/src/MatrixFunctions/MatrixExponential.h
+++ unsupported/Eigen/src/MatrixFunctions/MatrixExponential.h
@@ -24,6 +24,10 @@

 #ifndef EIGEN_MATRIX_EXPONENTIAL
 #define EIGEN_MATRIX_EXPONENTIAL
+
+#ifdef _MSC_VER
+  template <typename Scalar> Scalar log2(Scalar v) { return std::log(v)/std::log(Scalar(2)); }
+#endif

 /** \brief Compute the matrix exponential.
  *
@@ -61,260 +65,243 @@
 EIGEN_STRONG_INLINE void ei_matrix_exponential(const MatrixBase<Derived> &M,
 					       typename MatrixBase<Derived>::PlainMatrixType* result);

-
-/** \internal \brief Internal helper functions for computing the
- *  matrix exponential.
- */
-namespace MatrixExponentialInternal {
-
-#ifdef _MSC_VER
-  template <typename Scalar> Scalar log2(Scalar v) { return std::log(v)/std::log(Scalar(2)); }
-#endif
-
-  /** \internal \brief Compute the (3,3)-Padé approximant to
-   *  the exponential.
-   *
-   *  After exit, \f$ (V+U)(V-U)^{-1} \f$ is the Padé
-   *  approximant of \f$ \exp(M) \f$ around \f$ M = 0 \f$.
-   *
-   *  \param M   Argument of matrix exponential
-   *  \param Id  Identity matrix of same size as M
-   *  \param tmp Temporary storage, to be provided by the caller
-   *  \param M2  Temporary storage, to be provided by the caller
-   *  \param U   Even-degree terms in numerator of Padé approximant
-   *  \param V   Odd-degree terms in numerator of Padé approximant
-   */
-  template <typename MatrixType>
-  EIGEN_STRONG_INLINE void pade3(const MatrixType &M, const MatrixType& Id, MatrixType& tmp,
-				 MatrixType& M2, MatrixType& U, MatrixType& V)
-  {
+/** \brief Class for computing the matrix exponential.*/
+template <typename MatrixType>
+class MatrixExponential {
+
+  public:
+
+    /** \brief Compute the matrix exponential.
+     *
+     * \param M      matrix whose exponential is to be computed.
+     * \param result pointer to the matrix in which to store the result.
+     */
+    MatrixExponential(const MatrixType &M, MatrixType *result);
+
+  private:
+
+    // Prevent copying
+    MatrixExponential(const MatrixExponential&);
+    MatrixExponential& operator=(const MatrixExponential&);
+
+    /** \brief Compute the (3,3)-Padé approximant to the exponential.
+     *
+     *  After exit, \f$ (V+U)(V-U)^{-1} \f$ is the Padé
+     *  approximant of \f$ \exp(A) \f$ around \f$ A = 0 \f$.
+     *
+     *  \param A   Argument of matrix exponential
+     */
+    void pade3(const MatrixType &A);
+
+    /** \brief Compute the (5,5)-Padé approximant to the exponential.
+     *
+     *  After exit, \f$ (V+U)(V-U)^{-1} \f$ is the Padé
+     *  approximant of \f$ \exp(A) \f$ around \f$ A = 0 \f$.
+     *
+     *  \param A   Argument of matrix exponential
+     */
+    void pade5(const MatrixType &A);
+
+    /** \brief Compute the (7,7)-Padé approximant to the exponential.
+     *
+     *  After exit, \f$ (V+U)(V-U)^{-1} \f$ is the Padé
+     *  approximant of \f$ \exp(A) \f$ around \f$ A = 0 \f$.
+     *
+     *  \param A   Argument of matrix exponential
+     */
+    void pade7(const MatrixType &A);
+
+    /** \brief Compute the (9,9)-Padé approximant to the exponential.
+     *
+     *  After exit, \f$ (V+U)(V-U)^{-1} \f$ is the Padé
+     *  approximant of \f$ \exp(A) \f$ around \f$ A = 0 \f$.
+     *
+     *  \param A   Argument of matrix exponential
+     */
+    void pade9(const MatrixType &A);
+
+    /** \brief Compute the (13,13)-Padé approximant to the exponential.
+     *
+     *  After exit, \f$ (V+U)(V-U)^{-1} \f$ is the Padé
+     *  approximant of \f$ \exp(A) \f$ around \f$ A = 0 \f$.
+     *
+     *  \param A   Argument of matrix exponential
+     */
+    void pade13(const MatrixType &A);
+
+    /** \brief Compute Padé approximant to the exponential.
+     *
+     * Computes \c m_U, \c m_V and \c m_squarings such that
+     * \f$ (V+U)(V-U)^{-1} \f$ is a Padé of
+     * \f$ \exp(2^{-\mbox{squarings}}M) \f$ around \f$ M = 0 \f$. The
+     * degree of the Padé approximant and the value of
+     * squarings are chosen such that the approximation error is no
+     * more than the round-off error.
+     *
+     * The argument of this function should correspond with the (real
+     * part of) the entries of \c m_M.  It is used to select the
+     * correct implementation using overloading.
+     */
+    void computeUV(double);
+
+    /** \brief Compute Padé approximant to the exponential.
+     *
+     *  \sa computeUV(double);
+     */
+    void computeUV(float);
+
     typedef typename ei_traits<MatrixType>::Scalar Scalar;
-    const Scalar b[] = {120., 60., 12., 1.};
-    M2.noalias() = M * M;
-    tmp = b[3]*M2 + b[1]*Id;
-    U.noalias() = M * tmp;
-    V = b[2]*M2 + b[0]*Id;
-  }
-
-  /** \internal \brief Compute the (5,5)-Padé approximant to
-   *  the exponential.
-   *
-   *  After exit, \f$ (V+U)(V-U)^{-1} \f$ is the Padé
-   *  approximant of \f$ \exp(M) \f$ around \f$ M = 0 \f$.
-   *
-   *  \param M   Argument of matrix exponential
-   *  \param Id  Identity matrix of same size as M
-   *  \param tmp Temporary storage, to be provided by the caller
-   *  \param M2  Temporary storage, to be provided by the caller
-   *  \param U   Even-degree terms in numerator of Padé approximant
-   *  \param V   Odd-degree terms in numerator of Padé approximant
-   */
-  template <typename MatrixType>
-  EIGEN_STRONG_INLINE void pade5(const MatrixType &M, const MatrixType& Id, MatrixType& tmp,
-				 MatrixType& M2, MatrixType& U, MatrixType& V)
-  {
-    typedef typename ei_traits<MatrixType>::Scalar Scalar;
-    const Scalar b[] = {30240., 15120., 3360., 420., 30., 1.};
-    M2.noalias() = M * M;
-    MatrixType M4 = M2 * M2;
-    tmp = b[5]*M4 + b[3]*M2 + b[1]*Id;
-    U.noalias() = M * tmp;
-    V = b[4]*M4 + b[2]*M2 + b[0]*Id;
-  }
-
-  /** \internal \brief Compute the (7,7)-Padé approximant to
-   *  the exponential.
-   *
-   *  After exit, \f$ (V+U)(V-U)^{-1} \f$ is the Padé
-   *  approximant of \f$ \exp(M) \f$ around \f$ M = 0 \f$.
-   *
-   *  \param M   Argument of matrix exponential
-   *  \param Id  Identity matrix of same size as M
-   *  \param tmp Temporary storage, to be provided by the caller
-   *  \param M2  Temporary storage, to be provided by the caller
-   *  \param U   Even-degree terms in numerator of Padé approximant
-   *  \param V   Odd-degree terms in numerator of Padé approximant
-   */
-  template <typename MatrixType>
-  EIGEN_STRONG_INLINE void pade7(const MatrixType &M, const MatrixType& Id, MatrixType& tmp,
-				 MatrixType& M2, MatrixType& U, MatrixType& V)
-  {
-    typedef typename ei_traits<MatrixType>::Scalar Scalar;
-    const Scalar b[] = {17297280., 8648640., 1995840., 277200., 25200., 1512., 56., 1.};
-    M2.noalias() = M * M;
-    MatrixType M4 = M2 * M2;
-    MatrixType M6 = M4 * M2;
-    tmp = b[7]*M6 + b[5]*M4 + b[3]*M2 + b[1]*Id;
-    U.noalias() = M * tmp;
-    V = b[6]*M6 + b[4]*M4 + b[2]*M2 + b[0]*Id;
-  }
-
-  /** \internal \brief Compute the (9,9)-Padé approximant to
-   *  the exponential.
-   *
-   *  After exit, \f$ (V+U)(V-U)^{-1} \f$ is the Padé
-   *  approximant of \f$ \exp(M) \f$ around \f$ M = 0 \f$.
-   *
-   *  \param M   Argument of matrix exponential
-   *  \param Id  Identity matrix of same size as M
-   *  \param tmp Temporary storage, to be provided by the caller
-   *  \param M2  Temporary storage, to be provided by the caller
-   *  \param U   Even-degree terms in numerator of Padé approximant
-   *  \param V   Odd-degree terms in numerator of Padé approximant
-   */
-  template <typename MatrixType>
-  EIGEN_STRONG_INLINE void pade9(const MatrixType &M, const MatrixType& Id, MatrixType& tmp,
-				 MatrixType& M2, MatrixType& U, MatrixType& V)
-  {
-    typedef typename ei_traits<MatrixType>::Scalar Scalar;
-    const Scalar b[] = {17643225600., 8821612800., 2075673600., 302702400., 30270240.,
+    typedef typename NumTraits<typename ei_traits<MatrixType>::Scalar>::Real RealScalar;
+
+    /** \brief Pointer to matrix whose exponential is to be computed. */
+    const MatrixType* m_M;
+
+    /** \brief Even-degree terms in numerator of Padé approximant. */
+    MatrixType m_U;
+
+    /** \brief Odd-degree terms in numerator of Padé approximant. */
+    MatrixType m_V;
+
+    /** \brief Used for temporary storage. */
+    MatrixType m_tmp1;
+
+    /** \brief Used for temporary storage. */
+    MatrixType m_tmp2;
+
+    /** \brief Identity matrix of the same size as \c m_M. */
+    MatrixType m_Id;
+
+    /** \brief Number of squarings required in the last step. */
+    int m_squarings;
+
+    /** \brief L1 norm of m_M. */
+    float m_l1norm;
+};
+
+template <typename MatrixType>
+MatrixExponential<MatrixType>::MatrixExponential(const MatrixType &M, MatrixType *result) :
+  m_M(&M),
+  m_U(M.rows(),M.cols()),
+  m_V(M.rows(),M.cols()),
+  m_tmp1(M.rows(),M.cols()),
+  m_tmp2(M.rows(),M.cols()),
+  m_Id(MatrixType::Identity(M.rows(), M.cols())),
+  m_squarings(0),
+  m_l1norm(static_cast<float>(M.cwise().abs().colwise().sum().maxCoeff()))
+{
+  computeUV(RealScalar());
+  m_tmp1 = m_U + m_V;	// numerator of Pade approximant
+  m_tmp2 = -m_U + m_V;	// denominator of Pade approximant
+  m_tmp2.partialLu().solve(m_tmp1, result);
+  for (int i=0; i<m_squarings; i++)
+    *result *= *result;		// undo scaling by repeated squaring
+}
+
+template <typename MatrixType>
+EIGEN_STRONG_INLINE void MatrixExponential<MatrixType>::pade3(const MatrixType &A)
+{
+  const Scalar b[] = {120., 60., 12., 1.};
+  m_tmp1.noalias() = A * A;
+  m_tmp2 = b[3]*m_tmp1 + b[1]*m_Id;
+  m_U.noalias() = A * m_tmp2;
+  m_V = b[2]*m_tmp1 + b[0]*m_Id;
+}
+
+template <typename MatrixType>
+EIGEN_STRONG_INLINE void MatrixExponential<MatrixType>::pade5(const MatrixType &A)
+{
+  const Scalar b[] = {30240., 15120., 3360., 420., 30., 1.};
+  MatrixType A2 = A * A;
+  m_tmp1.noalias() = A2 * A2;
+  m_tmp2 = b[5]*m_tmp1 + b[3]*A2 + b[1]*m_Id;
+  m_U.noalias() = A * m_tmp2;
+  m_V = b[4]*m_tmp1 + b[2]*A2 + b[0]*m_Id;
+}
+
+template <typename MatrixType>
+EIGEN_STRONG_INLINE void MatrixExponential<MatrixType>::pade7(const MatrixType &A)
+{
+  const Scalar b[] = {17297280., 8648640., 1995840., 277200., 25200., 1512., 56., 1.};
+  MatrixType A2 = A * A;
+  MatrixType A4 = A2 * A2;
+  m_tmp1.noalias() = A4 * A2;
+  m_tmp2 = b[7]*m_tmp1 + b[5]*A4 + b[3]*A2 + b[1]*m_Id;
+  m_U.noalias() = A * m_tmp2;
+  m_V = b[6]*m_tmp1 + b[4]*A4 + b[2]*A2 + b[0]*m_Id;
+}
+
+template <typename MatrixType>
+EIGEN_STRONG_INLINE void MatrixExponential<MatrixType>::pade9(const MatrixType &A)
+{
+  const Scalar b[] = {17643225600., 8821612800., 2075673600., 302702400., 30270240.,
   		      2162160., 110880., 3960., 90., 1.};
-    M2.noalias() = M * M;
-    MatrixType M4 = M2 * M2;
-    MatrixType M6 = M4 * M2;
-    MatrixType M8 = M6 * M2;
-    tmp = b[9]*M8 + b[7]*M6 + b[5]*M4 + b[3]*M2 + b[1]*Id;
-    U.noalias() = M * tmp;
-    V = b[8]*M8 + b[6]*M6 + b[4]*M4 + b[2]*M2 + b[0]*Id;
-  }
-
-  /** \internal \brief Compute the (13,13)-Padé approximant to
-   *  the exponential.
-   *
-   *  After exit, \f$ (V+U)(V-U)^{-1} \f$ is the Padé
-   *  approximant of \f$ \exp(M) \f$ around \f$ M = 0 \f$.
-   *
-   *  \param M   Argument of matrix exponential
-   *  \param Id  Identity matrix of same size as M
-   *  \param tmp Temporary storage, to be provided by the caller
-   *  \param M2  Temporary storage, to be provided by the caller
-   *  \param U   Even-degree terms in numerator of Padé approximant
-   *  \param V   Odd-degree terms in numerator of Padé approximant
-   */
-  template <typename MatrixType>
-  EIGEN_STRONG_INLINE void pade13(const MatrixType &M, const MatrixType& Id, MatrixType& tmp,
-				  MatrixType& M2, MatrixType& U, MatrixType& V)
-  {
-    typedef typename ei_traits<MatrixType>::Scalar Scalar;
-    const Scalar b[] = {64764752532480000., 32382376266240000., 7771770303897600.,
+  MatrixType A2 = A * A;
+  MatrixType A4 = A2 * A2;
+  MatrixType A6 = A4 * A2;
+  m_tmp1.noalias() = A6 * A2;
+  m_tmp2 = b[9]*m_tmp1 + b[7]*A6 + b[5]*A4 + b[3]*A2 + b[1]*m_Id;
+  m_U.noalias() = A * m_tmp2;
+  m_V = b[8]*m_tmp1 + b[6]*A6 + b[4]*A4 + b[2]*A2 + b[0]*m_Id;
+}
+
+template <typename MatrixType>
+EIGEN_STRONG_INLINE void MatrixExponential<MatrixType>::pade13(const MatrixType &A)
+{
+  const Scalar b[] = {64764752532480000., 32382376266240000., 7771770303897600.,
   		      1187353796428800., 129060195264000., 10559470521600., 670442572800.,
   		      33522128640., 1323241920., 40840800., 960960., 16380., 182., 1.};
-    M2.noalias() = M * M;
-    MatrixType M4 = M2 * M2;
-    MatrixType M6 = M4 * M2;
-    V = b[13]*M6 + b[11]*M4 + b[9]*M2;
-    tmp.noalias() = M6 * V;
-    tmp += b[7]*M6 + b[5]*M4 + b[3]*M2 + b[1]*Id;
-    U.noalias() = M * tmp;
-    tmp = b[12]*M6 + b[10]*M4 + b[8]*M2;
-    V.noalias() = M6 * tmp;
-    V += b[6]*M6 + b[4]*M4 + b[2]*M2 + b[0]*Id;
+  MatrixType A2 = A * A;
+  MatrixType A4 = A2 * A2;
+  m_tmp1.noalias() = A4 * A2;
+  m_V = b[13]*m_tmp1 + b[11]*A4 + b[9]*A2; // used for temporary storage
+  m_tmp2.noalias() = m_tmp1 * m_V;
+  m_tmp2 += b[7]*m_tmp1 + b[5]*A4 + b[3]*A2 + b[1]*m_Id;
+  m_U.noalias() = A * m_tmp2;
+  m_tmp2 = b[12]*m_tmp1 + b[10]*A4 + b[8]*A2;
+  m_V.noalias() = m_tmp1 * m_tmp2;
+  m_V += b[6]*m_tmp1 + b[4]*A4 + b[2]*A2 + b[0]*m_Id;
+}
+
+template <typename MatrixType>
+void MatrixExponential<MatrixType>::computeUV(float)
+{
+  if (m_l1norm < 4.258730016922831e-001) {
+    pade3(*m_M);
+  } else if (m_l1norm < 1.880152677804762e+000) {
+    pade5(*m_M);
+  } else {
+    const float maxnorm = 3.925724783138660f;
+    m_squarings = std::max(0, (int)ceil(log2(m_l1norm / maxnorm)));
+    MatrixType A = *m_M / std::pow(Scalar(2), m_squarings);
+    pade7(A);
   }
-
-  /** \internal \brief Helper class for computing Padé
-   *  approximants to the exponential.
-   */
-  template <typename MatrixType, typename RealScalar = typename NumTraits<typename ei_traits<MatrixType>::Scalar>::Real>
-  struct computeUV_selector
-  {
-    /** \internal \brief Compute Padé approximant to the exponential.
-     *
-     *  Computes \p U, \p V and \p squarings such that \f$ (V+U)(V-U)^{-1} \f$
-     *  is a Padé of \f$ \exp(2^{-\mbox{squarings}}M) \f$
-     *  around \f$ M = 0 \f$. The degree of the Padé
-     *  approximant and the value of squarings are chosen such that
-     *  the approximation error is no more than the round-off error.
-     *
-     *  \param M         Argument of matrix exponential
-     *  \param Id        Identity matrix of same size as M
-     *  \param tmp1      Temporary storage, to be provided by the caller
-     *  \param tmp2      Temporary storage, to be provided by the caller
-     *  \param U         Even-degree terms in numerator of Padé approximant
-     *  \param V         Odd-degree terms in numerator of Padé approximant
-     *  \param l1norm    L1 norm of M
-     *  \param squarings Pointer to integer containing number of times
-     *                   that the result needs to be squared to find the
-     *                   matrix exponential
-     */
-    static void run(const MatrixType &M, const MatrixType& Id, MatrixType& tmp1, MatrixType& tmp2,
-		    MatrixType& U, MatrixType& V, float l1norm, int* squarings);
-  };
-
-  template <typename MatrixType>
-  struct computeUV_selector<MatrixType, float>
-  {
-    static void run(const MatrixType &M, const MatrixType& Id, MatrixType& tmp1, MatrixType& tmp2,
-		    MatrixType& U, MatrixType& V, float l1norm, int* squarings)
-    {
-      *squarings = 0;
-      if (l1norm < 4.258730016922831e-001) {
-        pade3(M, Id, tmp1, tmp2, U, V);
-      } else if (l1norm < 1.880152677804762e+000) {
-        pade5(M, Id, tmp1, tmp2, U, V);
-      } else {
-        const float maxnorm = 3.925724783138660f;
-        *squarings = std::max(0, (int)ceil(log2(l1norm / maxnorm)));
-        MatrixType A = M / std::pow(typename ei_traits<MatrixType>::Scalar(2), *squarings);
-        pade7(A, Id, tmp1, tmp2, U, V);
-      }
-    }
-  };
-
-  template <typename MatrixType>
-  struct computeUV_selector<MatrixType, double>
-  {
-    static void run(const MatrixType &M, const MatrixType& Id, MatrixType& tmp1, MatrixType& tmp2,
-		    MatrixType& U, MatrixType& V, float l1norm, int* squarings)
-    {
-      *squarings = 0;
-      if (l1norm < 1.495585217958292e-002) {
-        pade3(M, Id, tmp1, tmp2, U, V);
-      } else if (l1norm < 2.539398330063230e-001) {
-        pade5(M, Id, tmp1, tmp2, U, V);
-      } else if (l1norm < 9.504178996162932e-001) {
-        pade7(M, Id, tmp1, tmp2, U, V);
-      } else if (l1norm < 2.097847961257068e+000) {
-        pade9(M, Id, tmp1, tmp2, U, V);
-      } else {
-        const double maxnorm = 5.371920351148152;
-        *squarings = std::max(0, (int)ceil(log2(l1norm / maxnorm)));
-        MatrixType A = M / std::pow(typename ei_traits<MatrixType>::Scalar(2), *squarings);
-        pade13(A, Id, tmp1, tmp2, U, V);
-      }
-    }
-  };
-
-  /** \internal \brief Compute the matrix exponential.
-   *
-   * \param M      matrix whose exponential is to be computed.
-   * \param result pointer to the matrix in which to store the result.
-   */
-  template <typename MatrixType>
-  void compute(const MatrixType &M, MatrixType* result)
-  {
-    MatrixType num(M.rows(), M.cols());
-    MatrixType den(M.rows(), M.cols());
-    MatrixType U(M.rows(), M.cols());
-    MatrixType V(M.rows(), M.cols());
-    MatrixType Id = MatrixType::Identity(M.rows(), M.cols());
-    float l1norm = static_cast<float>(M.cwise().abs().colwise().sum().maxCoeff());
-    int squarings;
-    computeUV_selector<MatrixType>::run(M, Id, num, den, U, V, l1norm, &squarings);
-    num = U + V;			// numerator of Pade approximant
-    den = -U + V;			// denominator of Pade approximant
-    den.partialLu().solve(num, result);
-    for (int i=0; i<squarings; i++)
-      *result *= *result;		// undo scaling by repeated squaring
+}
+
+template <typename MatrixType>
+void MatrixExponential<MatrixType>::computeUV(double)
+{
+  if (m_l1norm < 1.495585217958292e-002) {
+    pade3(*m_M);
+  } else if (m_l1norm < 2.539398330063230e-001) {
+    pade5(*m_M);
+  } else if (m_l1norm < 9.504178996162932e-001) {
+    pade7(*m_M);
+  } else if (m_l1norm < 2.097847961257068e+000) {
+    pade9(*m_M);
+  } else {
+    const double maxnorm = 5.371920351148152;
+    m_squarings = std::max(0, (int)ceil(log2(m_l1norm / maxnorm)));
+    MatrixType A = *m_M / std::pow(Scalar(2), m_squarings);
+    pade13(A);
   }
-
-} // end of namespace MatrixExponentialInternal
+}

 template <typename Derived>
 EIGEN_STRONG_INLINE void ei_matrix_exponential(const MatrixBase<Derived> &M,
 					       typename MatrixBase<Derived>::PlainMatrixType* result)
 {
   ei_assert(M.rows() == M.cols());
-  MatrixExponentialInternal::compute(M.eval(), result);
+  MatrixExponential<typename MatrixBase<Derived>::PlainMatrixType>(M, result);
 }

 #endif // EIGEN_MATRIX_EXPONENTIAL


Add part missing in bf8227a721e5f7bd1e354ca4533aed4cafe23c80.

--- src/plugins/qt4projectmanager/qt-maemo/maemoruncontrol.h
+++ src/plugins/qt4projectmanager/qt-maemo/maemoruncontrol.h
@@ -67,9 +67,13 @@
     virtual ~AbstractMaemoRunControl();

 protected:
+    virtual bool isRunning() const;
+
     void startDeployment(bool forDebugging);
     void deploy();
     void stopDeployment();
+    void stopRunning(bool forDebugging);
+    void run(const QString &remoteCall);
     void handleError(const QString &errString);
     bool isDeploying() const;
     const QString executableOnHost() const;
@@ -89,9 +93,13 @@

 private:
     virtual void handleDeploymentFinished(bool success)=0;
+    virtual void handleExecutionAboutToStart(const MaemoSshRunner *runner)=0;
+    void kill(const QStringList &apps);

     QFutureInterface<void> m_progress;
     QScopedPointer<MaemoSshDeployer> sshDeployer;
+    QScopedPointer<MaemoSshRunner> sshRunner;
+    QScopedPointer<MaemoSshRunner> sshStopper;

     struct Deployable
     {
@@ -113,7 +121,6 @@
     ~MaemoRunControl();
     void start();
     void stop();
-    bool isRunning() const;

 private slots:
     void executionFinished();
@@ -121,10 +128,9 @@

 private:
     virtual void handleDeploymentFinished(bool success);
+    virtual void handleExecutionAboutToStart(const MaemoSshRunner *runner);
     void startExecution();

-    QScopedPointer<MaemoSshRunner> sshRunner;
-    QScopedPointer<MaemoSshRunner> sshStopper;
     bool stoppedByUser;
 };

@@ -148,14 +154,13 @@

 private:
     virtual void handleDeploymentFinished(bool success);
+    virtual void handleExecutionAboutToStart(const MaemoSshRunner *runner);

     QString gdbServerPort() const;
     void startGdbServer();
     void gdbServerStartFailed(const QString &reason);
     void startDebugging();

-    QScopedPointer<MaemoSshRunner> sshRunner;
-    QScopedPointer<MaemoSshRunner> sshStopper;
     Debugger::DebuggerManager *debuggerManager;
     QSharedPointer<Debugger::DebuggerStartParameters> startParams;
     int inferiorPid;


Minor code clean-up in hierarchy computation

--- src/hierarchy/hierarchy.c
+++ src/hierarchy/hierarchy.c
@@ -36,19 +36,13 @@
 	SetIterator direct_subsumers_iterator;
 	SetIterator subsumers_iterator;

-	// Add the top class to the subsumers of every atomic concept and to the subsumers of every generated nominal (they are generated from ABox individuals)
+	// Add the top class to the subsumers of every atomic concept.
 	// Whether top is a direct subsumer or not will be computed below
 	MAP_ITERATOR_INIT(&map_it, &(kb->tbox->classes));
 	void* atomic_concept = MAP_ITERATOR_NEXT(&map_it);
 	while (atomic_concept) {
 		SET_ADD(kb->tbox->top_concept, &(((ClassExpression*) atomic_concept)->subsumers));
 		atomic_concept = MAP_ITERATOR_NEXT(&map_it);
-	}
-	MAP_ITERATOR_INIT(&map_it, &(kb->generated_nominals));
-	ClassExpression* nominal = (ClassExpression*) MAP_ITERATOR_NEXT(&map_it);
-	while (nominal) {
-		SET_ADD(kb->tbox->top_concept, &(((ClassExpression*) nominal)->subsumers));
-		nominal = (ClassExpression*) MAP_ITERATOR_NEXT(&map_it);
 	}

 	MAP_ITERATOR_INIT(&map_it, &(kb->tbox->classes));