[GRASS-SVN] r48708 - in grass-addons/raster/r.pi: . r.pi.corearea r.pi.csr.mw r.pi.energy r.pi.energy.iter r.pi.export r.pi.graph.dec r.pi.graph.iter r.pi.graph.red r.pi.library r.pi.odc r.pi.prob.mw r.pi.searchtime r.pi.searchtime.iter r.pi.searchtime.mw

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Oct 10 15:31:28 EDT 2011


Author: neteler
Date: 2011-10-10 12:31:28 -0700 (Mon, 10 Oct 2011)
New Revision: 48708

Added:
   grass-addons/raster/r.pi/r.pi.library/
   grass-addons/raster/r.pi/r.pi.library/Makefile
   grass-addons/raster/r.pi/r.pi.library/draw.c
   grass-addons/raster/r.pi/r.pi.library/local_proto.h
   grass-addons/raster/r.pi/r.pi.library/stat_method.c
Removed:
   grass-addons/raster/r.pi/r.pi.corearea/stat_method.c
   grass-addons/raster/r.pi/r.pi.csr.mw/stat_method.c
   grass-addons/raster/r.pi/r.pi.energy.iter/stat_method.c
   grass-addons/raster/r.pi/r.pi.energy/helpers.c
   grass-addons/raster/r.pi/r.pi.energy/stat_method.c
   grass-addons/raster/r.pi/r.pi.export/stat_method.c
   grass-addons/raster/r.pi/r.pi.graph.dec/draw.c
   grass-addons/raster/r.pi/r.pi.graph.iter/draw.c
   grass-addons/raster/r.pi/r.pi.graph.red/draw.c
   grass-addons/raster/r.pi/r.pi.graph.red/stat_method.c
   grass-addons/raster/r.pi/r.pi.odc/stat_method.c
   grass-addons/raster/r.pi/r.pi.prob.mw/helpers.c
   grass-addons/raster/r.pi/r.pi.prob.mw/stat_method.c
   grass-addons/raster/r.pi/r.pi.searchtime.iter/helpers.c
   grass-addons/raster/r.pi/r.pi.searchtime.iter/stat_method.c
   grass-addons/raster/r.pi/r.pi.searchtime.mw/helpers.c
   grass-addons/raster/r.pi/r.pi.searchtime.mw/stat_method.c
   grass-addons/raster/r.pi/r.pi.searchtime/helpers.c
   grass-addons/raster/r.pi/r.pi.searchtime/stat_method.c
Modified:
   grass-addons/raster/r.pi/Makefile
   grass-addons/raster/r.pi/r.pi.corearea/Makefile
   grass-addons/raster/r.pi/r.pi.csr.mw/Makefile
   grass-addons/raster/r.pi/r.pi.energy.iter/Makefile
   grass-addons/raster/r.pi/r.pi.energy/Makefile
   grass-addons/raster/r.pi/r.pi.export/Makefile
   grass-addons/raster/r.pi/r.pi.graph.dec/Makefile
   grass-addons/raster/r.pi/r.pi.graph.iter/Makefile
   grass-addons/raster/r.pi/r.pi.graph.red/Makefile
   grass-addons/raster/r.pi/r.pi.odc/Makefile
   grass-addons/raster/r.pi/r.pi.prob.mw/Makefile
   grass-addons/raster/r.pi/r.pi.searchtime.iter/Makefile
   grass-addons/raster/r.pi/r.pi.searchtime.mw/Makefile
   grass-addons/raster/r.pi/r.pi.searchtime/Makefile
Log:
new local pi library; started clone removal

Modified: grass-addons/raster/r.pi/Makefile
===================================================================
--- grass-addons/raster/r.pi/Makefile	2011-10-10 18:57:21 UTC (rev 48707)
+++ grass-addons/raster/r.pi/Makefile	2011-10-10 19:31:28 UTC (rev 48708)
@@ -3,6 +3,7 @@
 PGM = r.pi
 
 SUBDIRS = \
+	r.pi.library \
 	r.pi.corearea \
 	r.pi.corrwin \
 	r.pi.corrwindow \

Modified: grass-addons/raster/r.pi/r.pi.corearea/Makefile
===================================================================
--- grass-addons/raster/r.pi/r.pi.corearea/Makefile	2011-10-10 18:57:21 UTC (rev 48707)
+++ grass-addons/raster/r.pi/r.pi.corearea/Makefile	2011-10-10 19:31:28 UTC (rev 48708)
@@ -2,7 +2,10 @@
 
 PGM = r.pi.corearea
 
-LIBES = $(STATSLIB) $(GISLIB)
+LIB_NAME = grass_rpi
+RPI_LIB  = -l$(LIB_NAME)
+
+LIBES = $(STATSLIB) $(GISLIB) $(RPI_LIB)
 DEPENDENCIES = $(STATSDEP) $(GISDEP)
 
 include $(MODULE_TOPDIR)/include/Make/Module.make

Deleted: grass-addons/raster/r.pi/r.pi.corearea/stat_method.c
===================================================================
--- grass-addons/raster/r.pi/r.pi.corearea/stat_method.c	2011-10-10 18:57:21 UTC (rev 48707)
+++ grass-addons/raster/r.pi/r.pi.corearea/stat_method.c	2011-10-10 19:31:28 UTC (rev 48708)
@@ -1,115 +0,0 @@
-#include "local_proto.h"
-
-DCELL average(DCELL * vals, int count)
-{
-    int i;
-    DCELL res = 0;
-
-    if (count <= 0)
-	return 0;
-
-    for (i = 0; i < count; i++)
-	res += vals[i];
-
-    return res / count;
-}
-
-DCELL variance(DCELL * vals, int count)
-{
-    int i;
-    DCELL mean;
-    DCELL s = 0;
-    DCELL ss = 0;
-
-    if (count <= 0)
-	return 0;
-
-    for (i = 0; i < count; i++) {
-	DCELL val = vals[i];
-
-	s += val;
-	ss += val * val;
-    }
-
-    mean = s / (DCELL) count;
-    return ss / count - mean * mean;
-}
-
-DCELL std_deviat(DCELL * vals, int count)
-{
-    if (count <= 0)
-	return 0;
-
-    return sqrt(variance(vals, count));
-}
-
-DCELL median(DCELL * vals, int count)
-{
-    int k = (count - 1) / 2;
-    int l = 0;
-    int h = count - 1;
-    DCELL pivot, tmp;
-    int i, j, z;
-
-    if (count <= 0)
-	return 0;
-
-    while (l < h) {
-	pivot = vals[k];
-	i = l;
-	j = h;
-
-	do {
-	    while (vals[i] < pivot)
-		i++;
-	    while (vals[j] > pivot)
-		j--;
-	    if (i <= j) {
-		tmp = vals[i];
-		vals[i] = vals[j];
-		vals[j] = tmp;
-		i++;
-		j--;
-	    }
-	} while (i <= j);
-
-	if (j < k)
-	    l = i;
-	if (i > k)
-	    h = j;
-    }
-
-    return vals[k];
-}
-
-DCELL min(DCELL * vals, int count)
-{
-    int i;
-    DCELL res = 0;
-
-    if (count <= 0)
-	return 0;
-
-    res = vals[0];
-    for (i = 0; i < count; i++)
-	if (vals[i] < res)
-	    res = vals[i];
-
-    return res;
-}
-
-DCELL max(DCELL * vals, int count)
-{
-    int i;
-    DCELL res = 0;
-
-    if (count <= 0)
-	return 0;
-
-    res = vals[0];
-    for (i = 0; i < count; i++)
-	if (vals[i] > res)
-	    res = vals[i];
-
-    return res;
-}

Modified: grass-addons/raster/r.pi/r.pi.csr.mw/Makefile
===================================================================
--- grass-addons/raster/r.pi/r.pi.csr.mw/Makefile	2011-10-10 18:57:21 UTC (rev 48707)
+++ grass-addons/raster/r.pi/r.pi.csr.mw/Makefile	2011-10-10 19:31:28 UTC (rev 48708)
@@ -2,7 +2,10 @@
 
 PGM = r.pi.csr.mw
 
-LIBES = $(STATSLIB) $(GISLIB)
+LIB_NAME = grass_rpi
+RPI_LIB  = -l$(LIB_NAME)
+
+LIBES = $(STATSLIB) $(GISLIB) $(RPI_LIB)
 DEPENDENCIES = $(STATSDEP) $(GISDEP)
 
 include $(MODULE_TOPDIR)/include/Make/Module.make

Deleted: grass-addons/raster/r.pi/r.pi.csr.mw/stat_method.c
===================================================================
--- grass-addons/raster/r.pi/r.pi.csr.mw/stat_method.c	2011-10-10 18:57:21 UTC (rev 48707)
+++ grass-addons/raster/r.pi/r.pi.csr.mw/stat_method.c	2011-10-10 19:31:28 UTC (rev 48708)
@@ -1,115 +0,0 @@
-#include "local_proto.h"
-
-DCELL average(DCELL * vals, int count)
-{
-    int i;
-    DCELL res = 0;
-
-    if (count <= 0)
-	return 0;
-
-    for (i = 0; i < count; i++)
-	res += vals[i];
-
-    return res / count;
-}
-
-DCELL variance(DCELL * vals, int count)
-{
-    int i;
-    DCELL mean;
-    DCELL s = 0;
-    DCELL ss = 0;
-
-    if (count <= 0)
-	return 0;
-
-    for (i = 0; i < count; i++) {
-	DCELL val = vals[i];
-
-	s += val;
-	ss += val * val;
-    }
-
-    mean = s / (DCELL) count;
-    return ss / count - mean * mean;
-}
-
-DCELL std_deviat(DCELL * vals, int count)
-{
-    if (count <= 0)
-	return 0;
-
-    return sqrt(variance(vals, count));
-}
-
-DCELL median(DCELL * vals, int count)
-{
-    int k = (count - 1) / 2;
-    int l = 0;
-    int h = count - 1;
-    DCELL pivot, tmp;
-    int i, j, z;
-
-    if (count <= 0)
-	return 0;
-
-    while (l < h) {
-	pivot = vals[k];
-	i = l;
-	j = h;
-
-	do {
-	    while (vals[i] < pivot)
-		i++;
-	    while (vals[j] > pivot)
-		j--;
-	    if (i <= j) {
-		tmp = vals[i];
-		vals[i] = vals[j];
-		vals[j] = tmp;
-		i++;
-		j--;
-	    }
-	} while (i <= j);
-
-	if (j < k)
-	    l = i;
-	if (i > k)
-	    h = j;
-    }
-
-    return vals[k];
-}
-
-DCELL min(DCELL * vals, int count)
-{
-    int i;
-    DCELL res = 0;
-
-    if (count <= 0)
-	return 0;
-
-    res = vals[0];
-    for (i = 0; i < count; i++)
-	if (vals[i] < res)
-	    res = vals[i];
-
-    return res;
-}
-
-DCELL max(DCELL * vals, int count)
-{
-    int i;
-    DCELL res = 0;
-
-    if (count <= 0)
-	return 0;
-
-    res = vals[0];
-    for (i = 0; i < count; i++)
-	if (vals[i] > res)
-	    res = vals[i];
-
-    return res;
-}

Modified: grass-addons/raster/r.pi/r.pi.energy/Makefile
===================================================================
--- grass-addons/raster/r.pi/r.pi.energy/Makefile	2011-10-10 18:57:21 UTC (rev 48707)
+++ grass-addons/raster/r.pi/r.pi.energy/Makefile	2011-10-10 19:31:28 UTC (rev 48708)
@@ -2,7 +2,10 @@
 
 PGM = r.pi.energy
 
-LIBES = $(STATSLIB) $(GISLIB)
+LIB_NAME = grass_rpi
+RPI_LIB  = -l$(LIB_NAME)
+
+LIBES = $(STATSLIB) $(GISLIB) $(RPI_LIB)
 DEPENDENCIES = $(STATSDEP) $(GISDEP)
 
 include $(MODULE_TOPDIR)/include/Make/Module.make

Deleted: grass-addons/raster/r.pi/r.pi.energy/helpers.c
===================================================================
--- grass-addons/raster/r.pi/r.pi.energy/helpers.c	2011-10-10 18:57:21 UTC (rev 48707)
+++ grass-addons/raster/r.pi/r.pi.energy/helpers.c	2011-10-10 19:31:28 UTC (rev 48708)
@@ -1,93 +0,0 @@
-#include "local_proto.h"
-
-int Round(double d)
-{
-    return d < 0 ? d - 0.5 : d + 0.5;
-}
-
-int Random(int max)
-{
-    return max <=
-	RAND_MAX ? rand() % max : floor((double)rand() /
-					(double)(RAND_MAX + 1) * max);
-}
-
-double Randomf()
-{
-    return ((double)rand()) / ((double)RAND_MAX);
-}
-
-void print_buffer(int *buffer, int sx, int sy)
-{
-    int x, y;
-
-    fprintf(stderr, "buffer:\n");
-    for (y = 0; y < sy; y++) {
-	for (x = 0; x < sx; x++) {
-	    switch (buffer[x + y * sx]) {
-	    case TYPE_NOTHING:
-		fprintf(stderr, "*");
-		break;
-	    default:
-		if (buffer[x + y * sx] < 0) {
-		    fprintf(stderr, "%d", buffer[x + y * sx]);
-		}
-		else {
-		    fprintf(stderr, "%d", buffer[x + y * sx]);
-		}
-		break;
-	    }
-	}
-	fprintf(stderr, "\n");
-    }
-}
-
-void print_d_buffer(DCELL * buffer, int sx, int sy)
-{
-    int x, y;
-
-    fprintf(stderr, "buffer:\n");
-    for (y = 0; y < sy; y++) {
-	for (x = 0; x < sx; x++) {
-	    fprintf(stderr, "%0.2f ", buffer[y * sx + x]);
-	}
-	fprintf(stderr, "\n");
-    }
-}
-
-void print_array(DCELL * buffer, int size)
-{
-    int i;
-
-    for (i = 0; i < size; i++) {
-	fprintf(stderr, "%0.2f ", buffer[i]);
-    }
-    fprintf(stderr, "\n");
-}
-
-void print_fragments()
-{
-    int f;
-    Coords *p;
-
-    for (f = 0; f < fragcount; f++) {
-	fprintf(stderr, "frag%d: ", f);
-	for (p = fragments[f]; p < fragments[f + 1]; p++) {
-	    fprintf(stderr, "(%d,%d), n=%d ", p->x, p->y, p->neighbors);
-	}
-	fprintf(stderr, "\n");
-    }
-}
-
-void print_map(double *map, int size)
-{
-    int x, y;
-
-    fprintf(stderr, "map:\n");
-    for (y = 0; y < size; y++) {
-	for (x = 0; x < size; x++) {
-	    fprintf(stderr, "%0.0f ", map[x + y * size]);
-	}
-	fprintf(stderr, "\n");
-    }
-}

Deleted: grass-addons/raster/r.pi/r.pi.energy/stat_method.c
===================================================================
--- grass-addons/raster/r.pi/r.pi.energy/stat_method.c	2011-10-10 18:57:21 UTC (rev 48707)
+++ grass-addons/raster/r.pi/r.pi.energy/stat_method.c	2011-10-10 19:31:28 UTC (rev 48708)
@@ -1,115 +0,0 @@
-#include "local_proto.h"
-
-DCELL average(DCELL * vals, int count)
-{
-    int i;
-    DCELL res = 0;
-
-    if (count <= 0)
-	return 0;
-
-    for (i = 0; i < count; i++)
-	res += vals[i];
-
-    return res / count;
-}
-
-DCELL variance(DCELL * vals, int count)
-{
-    int i;
-    DCELL mean;
-    DCELL s = 0;
-    DCELL ss = 0;
-
-    if (count <= 0)
-	return 0;
-
-    for (i = 0; i < count; i++) {
-	DCELL val = vals[i];
-
-	s += val;
-	ss += val * val;
-    }
-
-    mean = s / (DCELL) count;
-    return ss / count - mean * mean;
-}
-
-DCELL std_deviat(DCELL * vals, int count)
-{
-    if (count <= 0)
-	return 0;
-
-    return sqrt(variance(vals, count));
-}
-
-DCELL median(DCELL * vals, int count)
-{
-    int k = (count - 1) / 2;
-    int l = 0;
-    int h = count - 1;
-    DCELL pivot, tmp;
-    int i, j, z;
-
-    if (count <= 0)
-	return 0;
-
-    while (l < h) {
-	pivot = vals[k];
-	i = l;
-	j = h;
-
-	do {
-	    while (vals[i] < pivot)
-		i++;
-	    while (vals[j] > pivot)
-		j--;
-	    if (i <= j) {
-		tmp = vals[i];
-		vals[i] = vals[j];
-		vals[j] = tmp;
-		i++;
-		j--;
-	    }
-	} while (i <= j);
-
-	if (j < k)
-	    l = i;
-	if (i > k)
-	    h = j;
-    }
-
-    return vals[k];
-}
-
-DCELL min(DCELL * vals, int count)
-{
-    int i;
-    DCELL res = 0;
-
-    if (count <= 0)
-	return 0;
-
-    res = vals[0];
-    for (i = 0; i < count; i++)
-	if (vals[i] < res)
-	    res = vals[i];
-
-    return res;
-}
-
-DCELL max(DCELL * vals, int count)
-{
-    int i;
-    DCELL res = 0;
-
-    if (count <= 0)
-	return 0;
-
-    res = vals[0];
-    for (i = 0; i < count; i++)
-	if (vals[i] > res)
-	    res = vals[i];
-
-    return res;
-}

Modified: grass-addons/raster/r.pi/r.pi.energy.iter/Makefile
===================================================================
--- grass-addons/raster/r.pi/r.pi.energy.iter/Makefile	2011-10-10 18:57:21 UTC (rev 48707)
+++ grass-addons/raster/r.pi/r.pi.energy.iter/Makefile	2011-10-10 19:31:28 UTC (rev 48708)
@@ -2,7 +2,10 @@
 
 PGM = r.pi.energy.iter
 
-LIBES = $(STATSLIB) $(GISLIB)
+LIB_NAME = grass_rpi
+RPI_LIB  = -l$(LIB_NAME)
+
+LIBES = $(STATSLIB) $(GISLIB) $(RPI_LIB)
 DEPENDENCIES = $(STATSDEP) $(GISDEP)
 
 include $(MODULE_TOPDIR)/include/Make/Module.make

Deleted: grass-addons/raster/r.pi/r.pi.energy.iter/stat_method.c
===================================================================
--- grass-addons/raster/r.pi/r.pi.energy.iter/stat_method.c	2011-10-10 18:57:21 UTC (rev 48707)
+++ grass-addons/raster/r.pi/r.pi.energy.iter/stat_method.c	2011-10-10 19:31:28 UTC (rev 48708)
@@ -1,115 +0,0 @@
-#include "local_proto.h"
-
-DCELL average(DCELL * vals, int count)
-{
-    int i;
-    DCELL res = 0;
-
-    if (count <= 0)
-	return 0;
-
-    for (i = 0; i < count; i++)
-	res += vals[i];
-
-    return res / count;
-}
-
-DCELL variance(DCELL * vals, int count)
-{
-    int i;
-    DCELL mean;
-    DCELL s = 0;
-    DCELL ss = 0;
-
-    if (count <= 0)
-	return 0;
-
-    for (i = 0; i < count; i++) {
-	DCELL val = vals[i];
-
-	s += val;
-	ss += val * val;
-    }
-
-    mean = s / (DCELL) count;
-    return ss / count - mean * mean;
-}
-
-DCELL std_deviat(DCELL * vals, int count)
-{
-    if (count <= 0)
-	return 0;
-
-    return sqrt(variance(vals, count));
-}
-
-DCELL median(DCELL * vals, int count)
-{
-    int k = (count - 1) / 2;
-    int l = 0;
-    int h = count - 1;
-    DCELL pivot, tmp;
-    int i, j, z;
-
-    if (count <= 0)
-	return 0;
-
-    while (l < h) {
-	pivot = vals[k];
-	i = l;
-	j = h;
-
-	do {
-	    while (vals[i] < pivot)
-		i++;
-	    while (vals[j] > pivot)
-		j--;
-	    if (i <= j) {
-		tmp = vals[i];
-		vals[i] = vals[j];
-		vals[j] = tmp;
-		i++;
-		j--;
-	    }
-	} while (i <= j);
-
-	if (j < k)
-	    l = i;
-	if (i > k)
-	    h = j;
-    }
-
-    return vals[k];
-}
-
-DCELL min(DCELL * vals, int count)
-{
-    int i;
-    DCELL res = 0;
-
-    if (count <= 0)
-	return 0;
-
-    res = vals[0];
-    for (i = 0; i < count; i++)
-	if (vals[i] < res)
-	    res = vals[i];
-
-    return res;
-}
-
-DCELL max(DCELL * vals, int count)
-{
-    int i;
-    DCELL res = 0;
-
-    if (count <= 0)
-	return 0;
-
-    res = vals[0];
-    for (i = 0; i < count; i++)
-	if (vals[i] > res)
-	    res = vals[i];
-
-    return res;
-}

Modified: grass-addons/raster/r.pi/r.pi.export/Makefile
===================================================================
--- grass-addons/raster/r.pi/r.pi.export/Makefile	2011-10-10 18:57:21 UTC (rev 48707)
+++ grass-addons/raster/r.pi/r.pi.export/Makefile	2011-10-10 19:31:28 UTC (rev 48708)
@@ -2,7 +2,10 @@
 
 PGM = r.pi.export
 
-LIBES = $(STATSLIB) $(GISLIB)
+LIB_NAME = grass_rpi
+RPI_LIB  = -l$(LIB_NAME)
+
+LIBES = $(STATSLIB) $(GISLIB) $(RPI_LIB)
 DEPENDENCIES = $(STATSDEP) $(GISDEP)
 
 include $(MODULE_TOPDIR)/include/Make/Module.make

Deleted: grass-addons/raster/r.pi/r.pi.export/stat_method.c
===================================================================
--- grass-addons/raster/r.pi/r.pi.export/stat_method.c	2011-10-10 18:57:21 UTC (rev 48707)
+++ grass-addons/raster/r.pi/r.pi.export/stat_method.c	2011-10-10 19:31:28 UTC (rev 48708)
@@ -1,115 +0,0 @@
-#include "local_proto.h"
-
-DCELL average(DCELL * vals, int count)
-{
-    int i;
-    DCELL res = 0;
-
-    if (count <= 0)
-	return 0;
-
-    for (i = 0; i < count; i++)
-	res += vals[i];
-
-    return res / count;
-}
-
-DCELL variance(DCELL * vals, int count)
-{
-    int i;
-    DCELL mean;
-    DCELL s = 0;
-    DCELL ss = 0;
-
-    if (count <= 0)
-	return 0;
-
-    for (i = 0; i < count; i++) {
-	DCELL val = vals[i];
-
-	s += val;
-	ss += val * val;
-    }
-
-    mean = s / (DCELL) count;
-    return ss / count - mean * mean;
-}
-
-DCELL std_deviat(DCELL * vals, int count)
-{
-    if (count <= 0)
-	return 0;
-
-    return sqrt(variance(vals, count));
-}
-
-DCELL median(DCELL * vals, int count)
-{
-    int k = (count - 1) / 2;
-    int l = 0;
-    int h = count - 1;
-    DCELL pivot, tmp;
-    int i, j, z;
-
-    if (count <= 0)
-	return 0;
-
-    while (l < h) {
-	pivot = vals[k];
-	i = l;
-	j = h;
-
-	do {
-	    while (vals[i] < pivot)
-		i++;
-	    while (vals[j] > pivot)
-		j--;
-	    if (i <= j) {
-		tmp = vals[i];
-		vals[i] = vals[j];
-		vals[j] = tmp;
-		i++;
-		j--;
-	    }
-	} while (i <= j);
-
-	if (j < k)
-	    l = i;
-	if (i > k)
-	    h = j;
-    }
-
-    return vals[k];
-}
-
-DCELL min(DCELL * vals, int count)
-{
-    int i;
-    DCELL res = 0;
-
-    if (count <= 0)
-	return 0;
-
-    res = vals[0];
-    for (i = 0; i < count; i++)
-	if (vals[i] < res)
-	    res = vals[i];
-
-    return res;
-}
-
-DCELL max(DCELL * vals, int count)
-{
-    int i;
-    DCELL res = 0;
-
-    if (count <= 0)
-	return 0;
-
-    res = vals[0];
-    for (i = 0; i < count; i++)
-	if (vals[i] > res)
-	    res = vals[i];
-
-    return res;
-}

Modified: grass-addons/raster/r.pi/r.pi.graph.dec/Makefile
===================================================================
--- grass-addons/raster/r.pi/r.pi.graph.dec/Makefile	2011-10-10 18:57:21 UTC (rev 48707)
+++ grass-addons/raster/r.pi/r.pi.graph.dec/Makefile	2011-10-10 19:31:28 UTC (rev 48708)
@@ -2,7 +2,10 @@
 
 PGM = r.pi.graph.dec
 
-LIBES = $(STATSLIB) $(GISLIB)
+LIB_NAME = grass_rpi
+RPI_LIB  = -l$(LIB_NAME)
+
+LIBES = $(STATSLIB) $(GISLIB) $(RPI_LIB)
 DEPENDENCIES = $(STATSDEP) $(GISDEP)
 
 include $(MODULE_TOPDIR)/include/Make/Module.make

Deleted: grass-addons/raster/r.pi/r.pi.graph.dec/draw.c
===================================================================
--- grass-addons/raster/r.pi/r.pi.graph.dec/draw.c	2011-10-10 18:57:21 UTC (rev 48707)
+++ grass-addons/raster/r.pi/r.pi.graph.dec/draw.c	2011-10-10 19:31:28 UTC (rev 48708)
@@ -1,60 +0,0 @@
-#include "local_proto.h"
-
-inline void swap(int *a, int *b)
-{
-    int zw = *a;
-
-    *a = *b;
-    *b = zw;
-}
-
-void draw_point(int *map, int val, int x, int y, int sx, int sy, int width)
-{
-    if (width <= 0) {
-	return;
-    }
-
-    if (width == 1) {
-	map[y * sx + x] = val;
-    }
-    else {
-    }
-}
-
-void draw_line(int *map, int val, int x1, int y1, int x2, int y2, int sx,
-	       int sy, int width)
-{
-    int steep = abs(y2 - y1) > abs(x2 - x1);
-
-    if (steep) {
-	swap(&x1, &y1);
-	swap(&x2, &y2);
-    }
-
-    if (x1 > x2) {
-	swap(&x1, &x2);
-	swap(&y1, &y2);
-    }
-
-    int deltax = x2 - x1;
-    int deltay = abs(y2 - y1);
-    int error = deltax / 2;
-    int ystep = y1 < y2 ? 1 : -1;
-    int x;
-    int y = y1;
-
-    for (x = x1; x <= x2; x++) {
-	if (steep) {
-	    draw_point(map, val, y, x, sx, sy, width);
-	}
-	else {
-	    draw_point(map, val, x, y, sx, sy, width);
-	}
-
-	error -= deltay;
-	if (error < 0) {
-	    y += ystep;
-	    error += deltax;
-	}
-    }
-}

Modified: grass-addons/raster/r.pi/r.pi.graph.iter/Makefile
===================================================================
--- grass-addons/raster/r.pi/r.pi.graph.iter/Makefile	2011-10-10 18:57:21 UTC (rev 48707)
+++ grass-addons/raster/r.pi/r.pi.graph.iter/Makefile	2011-10-10 19:31:28 UTC (rev 48708)
@@ -2,7 +2,10 @@
 
 PGM = r.pi.graph.iter
 
-LIBES = $(STATSLIB) $(GISLIB)
+LIB_NAME = grass_rpi
+RPI_LIB  = -l$(LIB_NAME)
+
+LIBES = $(STATSLIB) $(GISLIB) $(RPI_LIB)
 DEPENDENCIES = $(STATSDEP) $(GISDEP)
 
 include $(MODULE_TOPDIR)/include/Make/Module.make

Deleted: grass-addons/raster/r.pi/r.pi.graph.iter/draw.c
===================================================================
--- grass-addons/raster/r.pi/r.pi.graph.iter/draw.c	2011-10-10 18:57:21 UTC (rev 48707)
+++ grass-addons/raster/r.pi/r.pi.graph.iter/draw.c	2011-10-10 19:31:28 UTC (rev 48708)
@@ -1,60 +0,0 @@
-#include "local_proto.h"
-
-inline void swap(int *a, int *b)
-{
-    int zw = *a;
-
-    *a = *b;
-    *b = zw;
-}
-
-void draw_point(int *map, int val, int x, int y, int sx, int sy, int width)
-{
-    if (width <= 0) {
-	return;
-    }
-
-    if (width == 1) {
-	map[y * sx + x] = val;
-    }
-    else {
-    }
-}
-
-void draw_line(int *map, int val, int x1, int y1, int x2, int y2, int sx,
-	       int sy, int width)
-{
-    int steep = abs(y2 - y1) > abs(x2 - x1);
-
-    if (steep) {
-	swap(&x1, &y1);
-	swap(&x2, &y2);
-    }
-
-    if (x1 > x2) {
-	swap(&x1, &x2);
-	swap(&y1, &y2);
-    }
-
-    int deltax = x2 - x1;
-    int deltay = abs(y2 - y1);
-    int error = deltax / 2;
-    int ystep = y1 < y2 ? 1 : -1;
-    int x;
-    int y = y1;
-
-    for (x = x1; x <= x2; x++) {
-	if (steep) {
-	    draw_point(map, val, y, x, sx, sy, width);
-	}
-	else {
-	    draw_point(map, val, x, y, sx, sy, width);
-	}
-
-	error -= deltay;
-	if (error < 0) {
-	    y += ystep;
-	    error += deltax;
-	}
-    }
-}

Modified: grass-addons/raster/r.pi/r.pi.graph.red/Makefile
===================================================================
--- grass-addons/raster/r.pi/r.pi.graph.red/Makefile	2011-10-10 18:57:21 UTC (rev 48707)
+++ grass-addons/raster/r.pi/r.pi.graph.red/Makefile	2011-10-10 19:31:28 UTC (rev 48708)
@@ -2,7 +2,10 @@
 
 PGM = r.pi.graph.red
 
-LIBES = $(STATSLIB) $(GISLIB)
+LIB_NAME = grass_rpi
+RPI_LIB  = -l$(LIB_NAME)
+
+LIBES = $(STATSLIB) $(GISLIB) $(RPI_LIB)
 DEPENDENCIES = $(STATSDEP) $(GISDEP)
 
 include $(MODULE_TOPDIR)/include/Make/Module.make

Deleted: grass-addons/raster/r.pi/r.pi.graph.red/draw.c
===================================================================
--- grass-addons/raster/r.pi/r.pi.graph.red/draw.c	2011-10-10 18:57:21 UTC (rev 48707)
+++ grass-addons/raster/r.pi/r.pi.graph.red/draw.c	2011-10-10 19:31:28 UTC (rev 48708)
@@ -1,60 +0,0 @@
-#include "local_proto.h"
-
-inline void swap(int *a, int *b)
-{
-    int zw = *a;
-
-    *a = *b;
-    *b = zw;
-}
-
-void draw_point(int *map, int val, int x, int y, int sx, int sy, int width)
-{
-    if (width <= 0) {
-	return;
-    }
-
-    if (width == 1) {
-	map[y * sx + x] = val;
-    }
-    else {
-    }
-}
-
-void draw_line(int *map, int val, int x1, int y1, int x2, int y2, int sx,
-	       int sy, int width)
-{
-    int steep = abs(y2 - y1) > abs(x2 - x1);
-
-    if (steep) {
-	swap(&x1, &y1);
-	swap(&x2, &y2);
-    }
-
-    if (x1 > x2) {
-	swap(&x1, &x2);
-	swap(&y1, &y2);
-    }
-
-    int deltax = x2 - x1;
-    int deltay = abs(y2 - y1);
-    int error = deltax / 2;
-    int ystep = y1 < y2 ? 1 : -1;
-    int x;
-    int y = y1;
-
-    for (x = x1; x <= x2; x++) {
-	if (steep) {
-	    draw_point(map, val, y, x, sx, sy, width);
-	}
-	else {
-	    draw_point(map, val, x, y, sx, sy, width);
-	}
-
-	error -= deltay;
-	if (error < 0) {
-	    y += ystep;
-	    error += deltax;
-	}
-    }
-}

Deleted: grass-addons/raster/r.pi/r.pi.graph.red/stat_method.c
===================================================================
--- grass-addons/raster/r.pi/r.pi.graph.red/stat_method.c	2011-10-10 18:57:21 UTC (rev 48707)
+++ grass-addons/raster/r.pi/r.pi.graph.red/stat_method.c	2011-10-10 19:31:28 UTC (rev 48708)
@@ -1,115 +0,0 @@
-#include "local_proto.h"
-
-DCELL average(DCELL * vals, int count)
-{
-    int i;
-    DCELL res = 0;
-
-    if (count <= 0)
-	return 0;
-
-    for (i = 0; i < count; i++)
-	res += vals[i];
-
-    return res / count;
-}
-
-DCELL variance(DCELL * vals, int count)
-{
-    int i;
-    DCELL mean;
-    DCELL s = 0;
-    DCELL ss = 0;
-
-    if (count <= 0)
-	return 0;
-
-    for (i = 0; i < count; i++) {
-	DCELL val = vals[i];
-
-	s += val;
-	ss += val * val;
-    }
-
-    mean = s / (DCELL) count;
-    return ss / count - mean * mean;
-}
-
-DCELL std_deviat(DCELL * vals, int count)
-{
-    if (count <= 0)
-	return 0;
-
-    return sqrt(variance(vals, count));
-}
-
-DCELL median(DCELL * vals, int count)
-{
-    int k = (count - 1) / 2;
-    int l = 0;
-    int h = count - 1;
-    DCELL pivot, tmp;
-    int i, j, z;
-
-    if (count <= 0)
-	return 0;
-
-    while (l < h) {
-	pivot = vals[k];
-	i = l;
-	j = h;
-
-	do {
-	    while (vals[i] < pivot)
-		i++;
-	    while (vals[j] > pivot)
-		j--;
-	    if (i <= j) {
-		tmp = vals[i];
-		vals[i] = vals[j];
-		vals[j] = tmp;
-		i++;
-		j--;
-	    }
-	} while (i <= j);
-
-	if (j < k)
-	    l = i;
-	if (i > k)
-	    h = j;
-    }
-
-    return vals[k];
-}
-
-DCELL min(DCELL * vals, int count)
-{
-    int i;
-    DCELL res = 0;
-
-    if (count <= 0)
-	return 0;
-
-    res = vals[0];
-    for (i = 0; i < count; i++)
-	if (vals[i] < res)
-	    res = vals[i];
-
-    return res;
-}
-
-DCELL max(DCELL * vals, int count)
-{
-    int i;
-    DCELL res = 0;
-
-    if (count <= 0)
-	return 0;
-
-    res = vals[0];
-    for (i = 0; i < count; i++)
-	if (vals[i] > res)
-	    res = vals[i];
-
-    return res;
-}

Added: grass-addons/raster/r.pi/r.pi.library/Makefile
===================================================================
--- grass-addons/raster/r.pi/r.pi.library/Makefile	                        (rev 0)
+++ grass-addons/raster/r.pi/r.pi.library/Makefile	2011-10-10 19:31:28 UTC (rev 48708)
@@ -0,0 +1,14 @@
+MODULE_TOPDIR = ../../..
+
+EXTRA_LIBS=$(GISLIB) $(MATHLIB)
+
+LIB_NAME = grass_rpi.$(GRASS_VERSION_NUMBER)
+
+LIB_OBJS = 
+
+DEPENDENCIES = $(GISDEP) 
+
+include $(MODULE_TOPDIR)/include/Make/Lib.make
+
+default: lib
+#	$(INSTALL_DATA) description.html $(GISBASE)/docs/html/r.pi.library.html


Property changes on: grass-addons/raster/r.pi/r.pi.library/Makefile
___________________________________________________________________
Added: svn:eol-style
   + native

Copied: grass-addons/raster/r.pi/r.pi.library/draw.c (from rev 48674, grass-addons/raster/r.pi/r.pi.graph.dec/draw.c)
===================================================================
--- grass-addons/raster/r.pi/r.pi.library/draw.c	                        (rev 0)
+++ grass-addons/raster/r.pi/r.pi.library/draw.c	2011-10-10 19:31:28 UTC (rev 48708)
@@ -0,0 +1,60 @@
+#include "local_proto.h"
+
+inline void swap(int *a, int *b)
+{
+    int zw = *a;
+
+    *a = *b;
+    *b = zw;
+}
+
+void draw_point(int *map, int val, int x, int y, int sx, int sy, int width)
+{
+    if (width <= 0) {
+	return;
+    }
+
+    if (width == 1) {
+	map[y * sx + x] = val;
+    }
+    else {
+    }
+}
+
+void draw_line(int *map, int val, int x1, int y1, int x2, int y2, int sx,
+	       int sy, int width)
+{
+    int steep = abs(y2 - y1) > abs(x2 - x1);
+
+    if (steep) {
+	swap(&x1, &y1);
+	swap(&x2, &y2);
+    }
+
+    if (x1 > x2) {
+	swap(&x1, &x2);
+	swap(&y1, &y2);
+    }
+
+    int deltax = x2 - x1;
+    int deltay = abs(y2 - y1);
+    int error = deltax / 2;
+    int ystep = y1 < y2 ? 1 : -1;
+    int x;
+    int y = y1;
+
+    for (x = x1; x <= x2; x++) {
+	if (steep) {
+	    draw_point(map, val, y, x, sx, sy, width);
+	}
+	else {
+	    draw_point(map, val, x, y, sx, sy, width);
+	}
+
+	error -= deltay;
+	if (error < 0) {
+	    y += ystep;
+	    error += deltax;
+	}
+    }
+}

Added: grass-addons/raster/r.pi/r.pi.library/local_proto.h
===================================================================
--- grass-addons/raster/r.pi/r.pi.library/local_proto.h	                        (rev 0)
+++ grass-addons/raster/r.pi/r.pi.library/local_proto.h	2011-10-10 19:31:28 UTC (rev 48708)
@@ -0,0 +1,49 @@
+#ifndef LOCAL_PROTO_H
+#define LOCAL_PROTO_H
+
+#include <string.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <math.h>
+#include <grass/gis.h>
+#include <grass/glocale.h>
+#include <grass/stats.h>
+
+#ifdef MAIN
+#define GLOBAL
+#else
+#define GLOBAL extern
+#endif
+
+#define TYPE_NOTHING -1
+
+typedef struct
+{
+    int x, y;
+    int neighbors;
+} Coords;
+
+/* draw.c */
+void draw_line(int *map, int val, int x1, int y1, int x2, int y2, int sx,
+	       int sy, int width);
+
+/* helpers.c */
+int Round(double d);
+int Random(int max);
+double Randomf();
+void print_buffer(int *buffer, int sx, int sy);
+void print_d_buffer(DCELL * buffer, int sx, int sy);
+void print_map(double *map, int size);
+void print_array(DCELL * buffer, int size);
+void print_fragments();
+
+/* stat_method.c */
+DCELL average(DCELL * vals, int count);
+DCELL variance(DCELL * vals, int count);
+DCELL std_deviat(DCELL * vals, int count);
+DCELL median(DCELL * vals, int count);
+DCELL min(DCELL * vals, int count);
+DCELL max(DCELL * vals, int count);
+
+#endif /* LOCAL_PROTO_H */
+


Property changes on: grass-addons/raster/r.pi/r.pi.library/local_proto.h
___________________________________________________________________
Added: svn:eol-style
   + native

Copied: grass-addons/raster/r.pi/r.pi.library/stat_method.c (from rev 48674, grass-addons/raster/r.pi/r.pi.corearea/stat_method.c)
===================================================================
--- grass-addons/raster/r.pi/r.pi.library/stat_method.c	                        (rev 0)
+++ grass-addons/raster/r.pi/r.pi.library/stat_method.c	2011-10-10 19:31:28 UTC (rev 48708)
@@ -0,0 +1,115 @@
+#include "local_proto.h"
+
+DCELL average(DCELL * vals, int count)
+{
+    int i;
+    DCELL res = 0;
+
+    if (count <= 0)
+	return 0;
+
+    for (i = 0; i < count; i++)
+	res += vals[i];
+
+    return res / count;
+}
+
+DCELL variance(DCELL * vals, int count)
+{
+    int i;
+    DCELL mean;
+    DCELL s = 0;
+    DCELL ss = 0;
+
+    if (count <= 0)
+	return 0;
+
+    for (i = 0; i < count; i++) {
+	DCELL val = vals[i];
+
+	s += val;
+	ss += val * val;
+    }
+
+    mean = s / (DCELL) count;
+    return ss / count - mean * mean;
+}
+
+DCELL std_deviat(DCELL * vals, int count)
+{
+    if (count <= 0)
+	return 0;
+
+    return sqrt(variance(vals, count));
+}
+
+DCELL median(DCELL * vals, int count)
+{
+    int k = (count - 1) / 2;
+    int l = 0;
+    int h = count - 1;
+    DCELL pivot, tmp;
+    int i, j;
+
+    if (count <= 0)
+	return 0;
+
+    while (l < h) {
+	pivot = vals[k];
+	i = l;
+	j = h;
+
+	do {
+	    while (vals[i] < pivot)
+		i++;
+	    while (vals[j] > pivot)
+		j--;
+	    if (i <= j) {
+		tmp = vals[i];
+		vals[i] = vals[j];
+		vals[j] = tmp;
+		i++;
+		j--;
+	    }
+	} while (i <= j);
+
+	if (j < k)
+	    l = i;
+	if (i > k)
+	    h = j;
+    }
+
+    return vals[k];
+}
+
+DCELL min(DCELL * vals, int count)
+{
+    int i;
+    DCELL res = 0;
+
+    if (count <= 0)
+	return 0;
+
+    res = vals[0];
+    for (i = 0; i < count; i++)
+	if (vals[i] < res)
+	    res = vals[i];
+
+    return res;
+}
+
+DCELL max(DCELL * vals, int count)
+{
+    int i;
+    DCELL res = 0;
+
+    if (count <= 0)
+	return 0;
+
+    res = vals[0];
+    for (i = 0; i < count; i++)
+	if (vals[i] > res)
+	    res = vals[i];
+
+    return res;
+}

Modified: grass-addons/raster/r.pi/r.pi.odc/Makefile
===================================================================
--- grass-addons/raster/r.pi/r.pi.odc/Makefile	2011-10-10 18:57:21 UTC (rev 48707)
+++ grass-addons/raster/r.pi/r.pi.odc/Makefile	2011-10-10 19:31:28 UTC (rev 48708)
@@ -2,7 +2,10 @@
 
 PGM = r.pi.odc
 
-LIBES = $(STATSLIB) $(GISLIB)
+LIB_NAME = grass_rpi
+RPI_LIB  = -l$(LIB_NAME)
+
+LIBES = $(STATSLIB) $(GISLIB) $(RPI_LIB)
 DEPENDENCIES = $(STATSDEP) $(GISDEP)
 
 include $(MODULE_TOPDIR)/include/Make/Module.make

Deleted: grass-addons/raster/r.pi/r.pi.odc/stat_method.c
===================================================================
--- grass-addons/raster/r.pi/r.pi.odc/stat_method.c	2011-10-10 18:57:21 UTC (rev 48707)
+++ grass-addons/raster/r.pi/r.pi.odc/stat_method.c	2011-10-10 19:31:28 UTC (rev 48708)
@@ -1,83 +0,0 @@
-#include "local_proto.h"
-
-DCELL average(DCELL * vals, int count)
-{
-    int i;
-    DCELL res = 0;
-
-    if (count <= 0)
-	return 0;
-
-    for (i = 0; i < count; i++)
-	res += vals[i];
-
-    return res / count;
-}
-
-DCELL variance(DCELL * vals, int count)
-{
-    int i;
-    DCELL mean;
-    DCELL s = 0;
-    DCELL ss = 0;
-
-    if (count <= 0)
-	return 0;
-
-    for (i = 0; i < count; i++) {
-	DCELL val = vals[i];
-
-	s += val;
-	ss += val * val;
-    }
-
-    mean = s / (DCELL) count;
-    return ss / count - mean * mean;
-}
-
-DCELL std_deviat(DCELL * vals, int count)
-{
-    if (count <= 0)
-	return 0;
-
-    return sqrt(variance(vals, count));
-}
-
-DCELL median(DCELL * vals, int count)
-{
-    int k = (count - 1) / 2;
-    int l = 0;
-    int h = count - 1;
-    DCELL pivot, tmp;
-    int i, j, z;
-
-    if (count <= 0)
-	return 0;
-
-    while (l < h) {
-	pivot = vals[k];
-	i = l;
-	j = h;
-
-	do {
-	    while (vals[i] < pivot)
-		i++;
-	    while (vals[j] > pivot)
-		j--;
-	    if (i <= j) {
-		tmp = vals[i];
-		vals[i] = vals[j];
-		vals[j] = tmp;
-		i++;
-		j--;
-	    }
-	} while (i <= j);
-
-	if (j < k)
-	    l = i;
-	if (i > k)
-	    h = j;
-    }
-
-    return vals[k];
-}

Modified: grass-addons/raster/r.pi/r.pi.prob.mw/Makefile
===================================================================
--- grass-addons/raster/r.pi/r.pi.prob.mw/Makefile	2011-10-10 18:57:21 UTC (rev 48707)
+++ grass-addons/raster/r.pi/r.pi.prob.mw/Makefile	2011-10-10 19:31:28 UTC (rev 48708)
@@ -2,7 +2,10 @@
 
 PGM = r.pi.prob.mw
 
-LIBES = $(STATSLIB) $(GISLIB)
+LIB_NAME = grass_rpi
+RPI_LIB  = -l$(LIB_NAME)
+
+LIBES = $(STATSLIB) $(GISLIB) $(RPI_LIB)
 DEPENDENCIES = $(STATSDEP) $(GISDEP)
 
 include $(MODULE_TOPDIR)/include/Make/Module.make

Deleted: grass-addons/raster/r.pi/r.pi.prob.mw/helpers.c
===================================================================
--- grass-addons/raster/r.pi/r.pi.prob.mw/helpers.c	2011-10-10 18:57:21 UTC (rev 48707)
+++ grass-addons/raster/r.pi/r.pi.prob.mw/helpers.c	2011-10-10 19:31:28 UTC (rev 48708)
@@ -1,93 +0,0 @@
-#include "local_proto.h"
-
-int Round(double d)
-{
-    return d < 0 ? d - 0.5 : d + 0.5;
-}
-
-int Random(int max)
-{
-    return max <=
-	RAND_MAX ? rand() % max : floor((double)rand() /
-					(double)(RAND_MAX + 1) * max);
-}
-
-double Randomf()
-{
-    return ((double)rand()) / ((double)RAND_MAX);
-}
-
-void print_buffer(int *buffer, int sx, int sy)
-{
-    int x, y;
-
-    fprintf(stderr, "buffer:\n");
-    for (y = 0; y < sy; y++) {
-	for (x = 0; x < sx; x++) {
-	    switch (buffer[x + y * sx]) {
-	    case TYPE_NOTHING:
-		fprintf(stderr, "*");
-		break;
-	    default:
-		if (buffer[x + y * sx] < 0) {
-		    fprintf(stderr, "%d", buffer[x + y * sx]);
-		}
-		else {
-		    fprintf(stderr, "%d", buffer[x + y * sx]);
-		}
-		break;
-	    }
-	}
-	fprintf(stderr, "\n");
-    }
-}
-
-void print_d_buffer(DCELL * buffer, int sx, int sy)
-{
-    int x, y;
-
-    fprintf(stderr, "buffer:\n");
-    for (y = 0; y < sy; y++) {
-	for (x = 0; x < sx; x++) {
-	    fprintf(stderr, "%0.2f ", buffer[y * sx + x]);
-	}
-	fprintf(stderr, "\n");
-    }
-}
-
-void print_array(DCELL * buffer, int size)
-{
-    int i;
-
-    for (i = 0; i < size; i++) {
-	fprintf(stderr, "%0.2f ", buffer[i]);
-    }
-    fprintf(stderr, "\n");
-}
-
-void print_fragments()
-{
-    int f;
-    Coords *p;
-
-    for (f = 0; f < fragcount; f++) {
-	fprintf(stderr, "frag%d: ", f);
-	for (p = fragments[f]; p < fragments[f + 1]; p++) {
-	    fprintf(stderr, "(%d,%d), n=%d ", p->x, p->y, p->neighbors);
-	}
-	fprintf(stderr, "\n");
-    }
-}
-
-void print_map(double *map, int size)
-{
-    int x, y;
-
-    fprintf(stderr, "map:\n");
-    for (y = 0; y < size; y++) {
-	for (x = 0; x < size; x++) {
-	    fprintf(stderr, "%0.0f ", map[x + y * size]);
-	}
-	fprintf(stderr, "\n");
-    }
-}

Deleted: grass-addons/raster/r.pi/r.pi.prob.mw/stat_method.c
===================================================================
--- grass-addons/raster/r.pi/r.pi.prob.mw/stat_method.c	2011-10-10 18:57:21 UTC (rev 48707)
+++ grass-addons/raster/r.pi/r.pi.prob.mw/stat_method.c	2011-10-10 19:31:28 UTC (rev 48708)
@@ -1,115 +0,0 @@
-#include "local_proto.h"
-
-DCELL average(DCELL * vals, int count)
-{
-    int i;
-    DCELL res = 0;
-
-    if (count <= 0)
-	return 0;
-
-    for (i = 0; i < count; i++)
-	res += vals[i];
-
-    return res / count;
-}
-
-DCELL variance(DCELL * vals, int count)
-{
-    int i;
-    DCELL mean;
-    DCELL s = 0;
-    DCELL ss = 0;
-
-    if (count <= 0)
-	return 0;
-
-    for (i = 0; i < count; i++) {
-	DCELL val = vals[i];
-
-	s += val;
-	ss += val * val;
-    }
-
-    mean = s / (DCELL) count;
-    return ss / count - mean * mean;
-}
-
-DCELL std_deviat(DCELL * vals, int count)
-{
-    if (count <= 0)
-	return 0;
-
-    return sqrt(variance(vals, count));
-}
-
-DCELL median(DCELL * vals, int count)
-{
-    int k = (count - 1) / 2;
-    int l = 0;
-    int h = count - 1;
-    DCELL pivot, tmp;
-    int i, j, z;
-
-    if (count <= 0)
-	return 0;
-
-    while (l < h) {
-	pivot = vals[k];
-	i = l;
-	j = h;
-
-	do {
-	    while (vals[i] < pivot)
-		i++;
-	    while (vals[j] > pivot)
-		j--;
-	    if (i <= j) {
-		tmp = vals[i];
-		vals[i] = vals[j];
-		vals[j] = tmp;
-		i++;
-		j--;
-	    }
-	} while (i <= j);
-
-	if (j < k)
-	    l = i;
-	if (i > k)
-	    h = j;
-    }
-
-    return vals[k];
-}
-
-DCELL min(DCELL * vals, int count)
-{
-    int i;
-    DCELL res = 0;
-
-    if (count <= 0)
-	return 0;
-
-    res = vals[0];
-    for (i = 0; i < count; i++)
-	if (vals[i] < res)
-	    res = vals[i];
-
-    return res;
-}
-
-DCELL max(DCELL * vals, int count)
-{
-    int i;
-    DCELL res = 0;
-
-    if (count <= 0)
-	return 0;
-
-    res = vals[0];
-    for (i = 0; i < count; i++)
-	if (vals[i] > res)
-	    res = vals[i];
-
-    return res;
-}

Modified: grass-addons/raster/r.pi/r.pi.searchtime/Makefile
===================================================================
--- grass-addons/raster/r.pi/r.pi.searchtime/Makefile	2011-10-10 18:57:21 UTC (rev 48707)
+++ grass-addons/raster/r.pi/r.pi.searchtime/Makefile	2011-10-10 19:31:28 UTC (rev 48708)
@@ -2,7 +2,10 @@
 
 PGM = r.pi.searchtime
 
-LIBES = $(STATSLIB) $(GISLIB)
+LIB_NAME = grass_rpi
+RPI_LIB  = -l$(LIB_NAME)
+
+LIBES = $(STATSLIB) $(GISLIB) $(RPI_LIB)
 DEPENDENCIES = $(STATSDEP) $(GISDEP)
 
 include $(MODULE_TOPDIR)/include/Make/Module.make

Deleted: grass-addons/raster/r.pi/r.pi.searchtime/helpers.c
===================================================================
--- grass-addons/raster/r.pi/r.pi.searchtime/helpers.c	2011-10-10 18:57:21 UTC (rev 48707)
+++ grass-addons/raster/r.pi/r.pi.searchtime/helpers.c	2011-10-10 19:31:28 UTC (rev 48708)
@@ -1,93 +0,0 @@
-#include "local_proto.h"
-
-int Round(double d)
-{
-    return d < 0 ? d - 0.5 : d + 0.5;
-}
-
-int Random(int max)
-{
-    return max <=
-	RAND_MAX ? rand() % max : floor((double)rand() /
-					(double)(RAND_MAX + 1) * max);
-}
-
-double Randomf()
-{
-    return ((double)rand()) / ((double)RAND_MAX);
-}
-
-void print_buffer(int *buffer, int sx, int sy)
-{
-    int x, y;
-
-    fprintf(stderr, "buffer:\n");
-    for (y = 0; y < sy; y++) {
-	for (x = 0; x < sx; x++) {
-	    switch (buffer[x + y * sx]) {
-	    case TYPE_NOTHING:
-		fprintf(stderr, "*");
-		break;
-	    default:
-		if (buffer[x + y * sx] < 0) {
-		    fprintf(stderr, "%d", buffer[x + y * sx]);
-		}
-		else {
-		    fprintf(stderr, "%d", buffer[x + y * sx]);
-		}
-		break;
-	    }
-	}
-	fprintf(stderr, "\n");
-    }
-}
-
-void print_d_buffer(DCELL * buffer, int sx, int sy)
-{
-    int x, y;
-
-    fprintf(stderr, "buffer:\n");
-    for (y = 0; y < sy; y++) {
-	for (x = 0; x < sx; x++) {
-	    fprintf(stderr, "%0.2f ", buffer[y * sx + x]);
-	}
-	fprintf(stderr, "\n");
-    }
-}
-
-void print_array(DCELL * buffer, int size)
-{
-    int i;
-
-    for (i = 0; i < size; i++) {
-	fprintf(stderr, "%0.2f ", buffer[i]);
-    }
-    fprintf(stderr, "\n");
-}
-
-void print_fragments()
-{
-    int f;
-    Coords *p;
-
-    for (f = 0; f < fragcount; f++) {
-	fprintf(stderr, "frag%d: ", f);
-	for (p = fragments[f]; p < fragments[f + 1]; p++) {
-	    fprintf(stderr, "(%d,%d), n=%d ", p->x, p->y, p->neighbors);
-	}
-	fprintf(stderr, "\n");
-    }
-}
-
-void print_map(double *map, int size)
-{
-    int x, y;
-
-    fprintf(stderr, "map:\n");
-    for (y = 0; y < size; y++) {
-	for (x = 0; x < size; x++) {
-	    fprintf(stderr, "%0.0f ", map[x + y * size]);
-	}
-	fprintf(stderr, "\n");
-    }
-}

Deleted: grass-addons/raster/r.pi/r.pi.searchtime/stat_method.c
===================================================================
--- grass-addons/raster/r.pi/r.pi.searchtime/stat_method.c	2011-10-10 18:57:21 UTC (rev 48707)
+++ grass-addons/raster/r.pi/r.pi.searchtime/stat_method.c	2011-10-10 19:31:28 UTC (rev 48708)
@@ -1,115 +0,0 @@
-#include "local_proto.h"
-
-DCELL average(DCELL * vals, int count)
-{
-    int i;
-    DCELL res = 0;
-
-    if (count <= 0)
-	return 0;
-
-    for (i = 0; i < count; i++)
-	res += vals[i];
-
-    return res / count;
-}
-
-DCELL variance(DCELL * vals, int count)
-{
-    int i;
-    DCELL mean;
-    DCELL s = 0;
-    DCELL ss = 0;
-
-    if (count <= 0)
-	return 0;
-
-    for (i = 0; i < count; i++) {
-	DCELL val = vals[i];
-
-	s += val;
-	ss += val * val;
-    }
-
-    mean = s / (DCELL) count;
-    return ss / count - mean * mean;
-}
-
-DCELL std_deviat(DCELL * vals, int count)
-{
-    if (count <= 0)
-	return 0;
-
-    return sqrt(variance(vals, count));
-}
-
-DCELL median(DCELL * vals, int count)
-{
-    int k = (count - 1) / 2;
-    int l = 0;
-    int h = count - 1;
-    DCELL pivot, tmp;
-    int i, j, z;
-
-    if (count <= 0)
-	return 0;
-
-    while (l < h) {
-	pivot = vals[k];
-	i = l;
-	j = h;
-
-	do {
-	    while (vals[i] < pivot)
-		i++;
-	    while (vals[j] > pivot)
-		j--;
-	    if (i <= j) {
-		tmp = vals[i];
-		vals[i] = vals[j];
-		vals[j] = tmp;
-		i++;
-		j--;
-	    }
-	} while (i <= j);
-
-	if (j < k)
-	    l = i;
-	if (i > k)
-	    h = j;
-    }
-
-    return vals[k];
-}
-
-DCELL min(DCELL * vals, int count)
-{
-    int i;
-    DCELL res = 0;
-
-    if (count <= 0)
-	return 0;
-
-    res = vals[0];
-    for (i = 0; i < count; i++)
-	if (vals[i] < res)
-	    res = vals[i];
-
-    return res;
-}
-
-DCELL max(DCELL * vals, int count)
-{
-    int i;
-    DCELL res = 0;
-
-    if (count <= 0)
-	return 0;
-
-    res = vals[0];
-    for (i = 0; i < count; i++)
-	if (vals[i] > res)
-	    res = vals[i];
-
-    return res;
-}

Modified: grass-addons/raster/r.pi/r.pi.searchtime.iter/Makefile
===================================================================
--- grass-addons/raster/r.pi/r.pi.searchtime.iter/Makefile	2011-10-10 18:57:21 UTC (rev 48707)
+++ grass-addons/raster/r.pi/r.pi.searchtime.iter/Makefile	2011-10-10 19:31:28 UTC (rev 48708)
@@ -2,7 +2,10 @@
 
 PGM = r.pi.searchtime.iter
 
-LIBES = $(STATSLIB) $(GISLIB)
+LIB_NAME = grass_rpi
+RPI_LIB  = -l$(LIB_NAME)
+
+LIBES = $(STATSLIB) $(GISLIB) $(RPI_LIB)
 DEPENDENCIES = $(STATSDEP) $(GISDEP)
 
 include $(MODULE_TOPDIR)/include/Make/Module.make

Deleted: grass-addons/raster/r.pi/r.pi.searchtime.iter/helpers.c
===================================================================
--- grass-addons/raster/r.pi/r.pi.searchtime.iter/helpers.c	2011-10-10 18:57:21 UTC (rev 48707)
+++ grass-addons/raster/r.pi/r.pi.searchtime.iter/helpers.c	2011-10-10 19:31:28 UTC (rev 48708)
@@ -1,93 +0,0 @@
-#include "local_proto.h"
-
-int Round(double d)
-{
-    return d < 0 ? d - 0.5 : d + 0.5;
-}
-
-int Random(int max)
-{
-    return max <=
-	RAND_MAX ? rand() % max : floor((double)rand() /
-					(double)(RAND_MAX + 1) * max);
-}
-
-double Randomf()
-{
-    return ((double)rand()) / ((double)RAND_MAX);
-}
-
-void print_buffer(int *buffer, int sx, int sy)
-{
-    int x, y;
-
-    fprintf(stderr, "buffer:\n");
-    for (y = 0; y < sy; y++) {
-	for (x = 0; x < sx; x++) {
-	    switch (buffer[x + y * sx]) {
-	    case TYPE_NOTHING:
-		fprintf(stderr, "*");
-		break;
-	    default:
-		if (buffer[x + y * sx] < 0) {
-		    fprintf(stderr, "%d", buffer[x + y * sx]);
-		}
-		else {
-		    fprintf(stderr, "%d", buffer[x + y * sx]);
-		}
-		break;
-	    }
-	}
-	fprintf(stderr, "\n");
-    }
-}
-
-void print_d_buffer(DCELL * buffer, int sx, int sy)
-{
-    int x, y;
-
-    fprintf(stderr, "buffer:\n");
-    for (y = 0; y < sy; y++) {
-	for (x = 0; x < sx; x++) {
-	    fprintf(stderr, "%0.2f ", buffer[y * sx + x]);
-	}
-	fprintf(stderr, "\n");
-    }
-}
-
-void print_array(DCELL * buffer, int size)
-{
-    int i;
-
-    for (i = 0; i < size; i++) {
-	fprintf(stderr, "%0.2f ", buffer[i]);
-    }
-    fprintf(stderr, "\n");
-}
-
-void print_fragments()
-{
-    int f;
-    Coords *p;
-
-    for (f = 0; f < fragcount; f++) {
-	fprintf(stderr, "frag%d: ", f);
-	for (p = fragments[f]; p < fragments[f + 1]; p++) {
-	    fprintf(stderr, "(%d,%d), n=%d ", p->x, p->y, p->neighbors);
-	}
-	fprintf(stderr, "\n");
-    }
-}
-
-void print_map(double *map, int size)
-{
-    int x, y;
-
-    fprintf(stderr, "map:\n");
-    for (y = 0; y < size; y++) {
-	for (x = 0; x < size; x++) {
-	    fprintf(stderr, "%0.0f ", map[x + y * size]);
-	}
-	fprintf(stderr, "\n");
-    }
-}

Deleted: grass-addons/raster/r.pi/r.pi.searchtime.iter/stat_method.c
===================================================================
--- grass-addons/raster/r.pi/r.pi.searchtime.iter/stat_method.c	2011-10-10 18:57:21 UTC (rev 48707)
+++ grass-addons/raster/r.pi/r.pi.searchtime.iter/stat_method.c	2011-10-10 19:31:28 UTC (rev 48708)
@@ -1,115 +0,0 @@
-#include "local_proto.h"
-
-DCELL average(DCELL * vals, int count)
-{
-    int i;
-    DCELL res = 0;
-
-    if (count <= 0)
-	return 0;
-
-    for (i = 0; i < count; i++)
-	res += vals[i];
-
-    return res / count;
-}
-
-DCELL variance(DCELL * vals, int count)
-{
-    int i;
-    DCELL mean;
-    DCELL s = 0;
-    DCELL ss = 0;
-
-    if (count <= 0)
-	return 0;
-
-    for (i = 0; i < count; i++) {
-	DCELL val = vals[i];
-
-	s += val;
-	ss += val * val;
-    }
-
-    mean = s / (DCELL) count;
-    return ss / count - mean * mean;
-}
-
-DCELL std_deviat(DCELL * vals, int count)
-{
-    if (count <= 0)
-	return 0;
-
-    return sqrt(variance(vals, count));
-}
-
-DCELL median(DCELL * vals, int count)
-{
-    int k = (count - 1) / 2;
-    int l = 0;
-    int h = count - 1;
-    DCELL pivot, tmp;
-    int i, j, z;
-
-    if (count <= 0)
-	return 0;
-
-    while (l < h) {
-	pivot = vals[k];
-	i = l;
-	j = h;
-
-	do {
-	    while (vals[i] < pivot)
-		i++;
-	    while (vals[j] > pivot)
-		j--;
-	    if (i <= j) {
-		tmp = vals[i];
-		vals[i] = vals[j];
-		vals[j] = tmp;
-		i++;
-		j--;
-	    }
-	} while (i <= j);
-
-	if (j < k)
-	    l = i;
-	if (i > k)
-	    h = j;
-    }
-
-    return vals[k];
-}
-
-DCELL min(DCELL * vals, int count)
-{
-    int i;
-    DCELL res = 0;
-
-    if (count <= 0)
-	return 0;
-
-    res = vals[0];
-    for (i = 0; i < count; i++)
-	if (vals[i] < res)
-	    res = vals[i];
-
-    return res;
-}
-
-DCELL max(DCELL * vals, int count)
-{
-    int i;
-    DCELL res = 0;
-
-    if (count <= 0)
-	return 0;
-
-    res = vals[0];
-    for (i = 0; i < count; i++)
-	if (vals[i] > res)
-	    res = vals[i];
-
-    return res;
-}

Modified: grass-addons/raster/r.pi/r.pi.searchtime.mw/Makefile
===================================================================
--- grass-addons/raster/r.pi/r.pi.searchtime.mw/Makefile	2011-10-10 18:57:21 UTC (rev 48707)
+++ grass-addons/raster/r.pi/r.pi.searchtime.mw/Makefile	2011-10-10 19:31:28 UTC (rev 48708)
@@ -2,7 +2,10 @@
 
 PGM = r.pi.searchtime.mw
 
-LIBES = $(STATSLIB) $(GISLIB)
+LIB_NAME = grass_rpi
+RPI_LIB  = -l$(LIB_NAME)
+
+LIBES = $(STATSLIB) $(GISLIB) $(RPI_LIB)
 DEPENDENCIES = $(STATSDEP) $(GISDEP)
 
 include $(MODULE_TOPDIR)/include/Make/Module.make

Deleted: grass-addons/raster/r.pi/r.pi.searchtime.mw/helpers.c
===================================================================
--- grass-addons/raster/r.pi/r.pi.searchtime.mw/helpers.c	2011-10-10 18:57:21 UTC (rev 48707)
+++ grass-addons/raster/r.pi/r.pi.searchtime.mw/helpers.c	2011-10-10 19:31:28 UTC (rev 48708)
@@ -1,93 +0,0 @@
-#include "local_proto.h"
-
-int Round(double d)
-{
-    return d < 0 ? d - 0.5 : d + 0.5;
-}
-
-int Random(int max)
-{
-    return max <=
-	RAND_MAX ? rand() % max : floor((double)rand() /
-					(double)(RAND_MAX + 1) * max);
-}
-
-double Randomf()
-{
-    return ((double)rand()) / ((double)RAND_MAX);
-}
-
-void print_buffer(int *buffer, int sx, int sy)
-{
-    int x, y;
-
-    fprintf(stderr, "buffer:\n");
-    for (y = 0; y < sy; y++) {
-	for (x = 0; x < sx; x++) {
-	    switch (buffer[x + y * sx]) {
-	    case TYPE_NOTHING:
-		fprintf(stderr, "*");
-		break;
-	    default:
-		if (buffer[x + y * sx] < 0) {
-		    fprintf(stderr, "%d", buffer[x + y * sx]);
-		}
-		else {
-		    fprintf(stderr, "%d", buffer[x + y * sx]);
-		}
-		break;
-	    }
-	}
-	fprintf(stderr, "\n");
-    }
-}
-
-void print_d_buffer(DCELL * buffer, int sx, int sy)
-{
-    int x, y;
-
-    fprintf(stderr, "buffer:\n");
-    for (y = 0; y < sy; y++) {
-	for (x = 0; x < sx; x++) {
-	    fprintf(stderr, "%0.2f ", buffer[y * sx + x]);
-	}
-	fprintf(stderr, "\n");
-    }
-}
-
-void print_array(DCELL * buffer, int size)
-{
-    int i;
-
-    for (i = 0; i < size; i++) {
-	fprintf(stderr, "%0.2f ", buffer[i]);
-    }
-    fprintf(stderr, "\n");
-}
-
-void print_fragments()
-{
-    int f;
-    Coords *p;
-
-    for (f = 0; f < fragcount; f++) {
-	fprintf(stderr, "frag%d: ", f);
-	for (p = fragments[f]; p < fragments[f + 1]; p++) {
-	    fprintf(stderr, "(%d,%d), n=%d ", p->x, p->y, p->neighbors);
-	}
-	fprintf(stderr, "\n");
-    }
-}
-
-void print_map(double *map, int size)
-{
-    int x, y;
-
-    fprintf(stderr, "map:\n");
-    for (y = 0; y < size; y++) {
-	for (x = 0; x < size; x++) {
-	    fprintf(stderr, "%0.0f ", map[x + y * size]);
-	}
-	fprintf(stderr, "\n");
-    }
-}

Deleted: grass-addons/raster/r.pi/r.pi.searchtime.mw/stat_method.c
===================================================================
--- grass-addons/raster/r.pi/r.pi.searchtime.mw/stat_method.c	2011-10-10 18:57:21 UTC (rev 48707)
+++ grass-addons/raster/r.pi/r.pi.searchtime.mw/stat_method.c	2011-10-10 19:31:28 UTC (rev 48708)
@@ -1,115 +0,0 @@
-#include "local_proto.h"
-
-DCELL average(DCELL * vals, int count)
-{
-    int i;
-    DCELL res = 0;
-
-    if (count <= 0)
-	return 0;
-
-    for (i = 0; i < count; i++)
-	res += vals[i];
-
-    return res / count;
-}
-
-DCELL variance(DCELL * vals, int count)
-{
-    int i;
-    DCELL mean;
-    DCELL s = 0;
-    DCELL ss = 0;
-
-    if (count <= 0)
-	return 0;
-
-    for (i = 0; i < count; i++) {
-	DCELL val = vals[i];
-
-	s += val;
-	ss += val * val;
-    }
-
-    mean = s / (DCELL) count;
-    return ss / count - mean * mean;
-}
-
-DCELL std_deviat(DCELL * vals, int count)
-{
-    if (count <= 0)
-	return 0;
-
-    return sqrt(variance(vals, count));
-}
-
-DCELL median(DCELL * vals, int count)
-{
-    int k = (count - 1) / 2;
-    int l = 0;
-    int h = count - 1;
-    DCELL pivot, tmp;
-    int i, j, z;
-
-    if (count <= 0)
-	return 0;
-
-    while (l < h) {
-	pivot = vals[k];
-	i = l;
-	j = h;
-
-	do {
-	    while (vals[i] < pivot)
-		i++;
-	    while (vals[j] > pivot)
-		j--;
-	    if (i <= j) {
-		tmp = vals[i];
-		vals[i] = vals[j];
-		vals[j] = tmp;
-		i++;
-		j--;
-	    }
-	} while (i <= j);
-
-	if (j < k)
-	    l = i;
-	if (i > k)
-	    h = j;
-    }
-
-    return vals[k];
-}
-
-DCELL min(DCELL * vals, int count)
-{
-    int i;
-    DCELL res = 0;
-
-    if (count <= 0)
-	return 0;
-
-    res = vals[0];
-    for (i = 0; i < count; i++)
-	if (vals[i] < res)
-	    res = vals[i];
-
-    return res;
-}
-
-DCELL max(DCELL * vals, int count)
-{
-    int i;
-    DCELL res = 0;
-
-    if (count <= 0)
-	return 0;
-
-    res = vals[0];
-    for (i = 0; i < count; i++)
-	if (vals[i] > res)
-	    res = vals[i];
-
-    return res;
-}



More information about the grass-commit mailing list