Index: /main/trunk/greenstone2/common-src/indexers/mg/lib/perf_hash.c
===================================================================
--- /main/trunk/greenstone2/common-src/indexers/mg/lib/perf_hash.c	(revision 37350)
+++ /main/trunk/greenstone2/common-src/indexers/mg/lib/perf_hash.c	(revision 37351)
@@ -28,4 +28,6 @@
 #define STRUCT
 
+#include <time.h>
+
 #include "sysfuncs.h"
 
@@ -34,4 +36,5 @@
 #include "messages.h"
 #include "perf_hash.h"
+#include "random.h"
 #include "netorder.h"  /* [RPAP - Jan 97: Endian Ordering] */
 
@@ -43,5 +46,5 @@
 /* Random Number stuff */
 static mg_s_long seed[] = {0, 0};
-#define RANDOM() irandm(seed)
+#define RANDOM() mgirandm(seed)
 #define SEED_RANDOM(the_seed) do{ seed[0] = the_seed; }while(0)
 
@@ -62,5 +65,5 @@
 
 /* An arbitrary amount to add to both MAX_N and n for building tree/acyclic
-   graph -- John McPherson - jrm21 (22-02-2001) */
+graph -- John McPherson - jrm21 (22-02-2001) */
 #define MAX_N_HEADROOM  100
 
@@ -96,8 +99,8 @@
 /* test, used in the assignment step               */
 static struct
-  {
-    int sp;
-    int *st;
-  }
+{
+int sp;
+int *st;
+}
 S;
 #define push(s, e) s.st[s.sp++] = (e)
@@ -114,5 +117,5 @@
 unique (int v)
 {				/* checks if vertex v belongs to only one edge */
-  return (FIRST[v] != 0 && NEXT[FIRST[v]] == 0) ? FIRST[v] : 0;
+return (FIRST[v] != 0 && NEXT[FIRST[v]] == 0) ? FIRST[v] : 0;
 }				/*unique */
 
@@ -128,18 +131,18 @@
 {				/* deletes edge e from list of v */
 
-  int b, norm_b;
-  b = FIRST[v];
+int b, norm_b;
+b = FIRST[v];
+assert (norm (b) != 0);
+if (norm (b) == e)
+FIRST[v] = NEXT[FIRST[v]];
+else
+{
+while (norm (NEXT[b]) != e)
+{
+  b = NEXT[b];
   assert (norm (b) != 0);
-  if (norm (b) == e)
-    FIRST[v] = NEXT[FIRST[v]];
-  else
-    {
-      while (norm (NEXT[b]) != e)
-	{
-	  b = NEXT[b];
-	  assert (norm (b) != 0);
-	}
-      NEXT[b] = NEXT[NEXT[b]];
-    }
+}
+NEXT[b] = NEXT[NEXT[b]];
+}
 }				/*delete */
 
@@ -155,21 +158,21 @@
 ph_remove (int e, int v)
 {
-  int b;
-  mk[e] = ERASED;
-  push (S, e);
-
-  if (NODEa[e] != v)
-    delete (NODEa[e], e);
-  if (NODEb[e] != v)
-    delete (NODEb[e], e);
-  if (NODEc[e] != v)
-    delete (NODEc[e], e);
-
-  if (NODEa[e] != v && mk[b = norm (unique (NODEa[e]))] == MEMBER)
-    ph_remove (b, NODEa[e]);
-  if (NODEb[e] != v && mk[b = norm (unique (NODEb[e]))] == MEMBER)
-    ph_remove (b, NODEb[e]);
-  if (NODEc[e] != v && mk[b = norm (unique (NODEc[e]))] == MEMBER)
-    ph_remove (b, NODEc[e]);
+int b;
+mk[e] = ERASED;
+push (S, e);
+
+if (NODEa[e] != v)
+delete (NODEa[e], e);
+if (NODEb[e] != v)
+delete (NODEb[e], e);
+if (NODEc[e] != v)
+delete (NODEc[e], e);
+
+if (NODEa[e] != v && mk[b = norm (unique (NODEa[e]))] == MEMBER)
+ph_remove (b, NODEa[e]);
+if (NODEb[e] != v && mk[b = norm (unique (NODEb[e]))] == MEMBER)
+ph_remove (b, NODEb[e]);
+if (NODEc[e] != v && mk[b = norm (unique (NODEc[e]))] == MEMBER)
+ph_remove (b, NODEc[e]);
 }
 #else
@@ -178,21 +181,21 @@
 static int StackPos, StackMax;
 static struct Stack
-  {
-    int e, v, m;
-  }
- *Stack = NULL;
+{
+int e, v, m;
+}
+*Stack = NULL;
 
 #define StackAdd(_e, _v, _m)						\
-  do {									\
-    if (StackPos == StackMax)						\
-      {									\
-        StackMax <<= 1;							\
-	if (!(Stack = Xrealloc(Stack, sizeof(*Stack) * StackMax)))	\
-	  return(-1);							\
-      }									\
-    Stack[StackPos].e = (_e);						\
-    Stack[StackPos].v = (_v);						\
-    Stack[StackPos++].m = (_m);						\
-  } while(0)
+do {									\
+if (StackPos == StackMax)						\
+{									\
+StackMax <<= 1;							\
+if (!(Stack = Xrealloc(Stack, sizeof(*Stack) * StackMax)))	\
+  return(-1);							\
+}									\
+Stack[StackPos].e = (_e);						\
+Stack[StackPos].v = (_v);						\
+Stack[StackPos++].m = (_m);						\
+} while(0)
 
 
@@ -200,60 +203,60 @@
 ph_remove (int e, int v)
 {
-  if (!Stack)
-    {
-      StackMax = 256;
-      if (!(Stack = Xmalloc (sizeof (*Stack) * StackMax)))
-	return (-1);
-      StackPos = 0;
-    }
-  Stack[StackPos].e = e;
-  Stack[StackPos].v = v;
-  Stack[StackPos].m = 0;
-  StackPos++;
-  while (StackPos)
-    {
-      int m, b;
-      StackPos--;
-      e = Stack[StackPos].e;
-      v = Stack[StackPos].v;
-      m = Stack[StackPos].m;
-
-
-      switch (m)
-	{
-	case 0:
-	  {
-	    mk[e] = ERASED;
-	    push (S, e);
-
-	    if (NODEa[e] != v)
-	      delete (NODEa[e], e);
-	    if (NODEb[e] != v)
-	      delete (NODEb[e], e);
-	    if (NODEc[e] != v)
-	      delete (NODEc[e], e);
-
-	    if (NODEa[e] != v && mk[b = norm (unique (NODEa[e]))] == MEMBER)
-	      {
-		Stack[StackPos++].m = 1;
-		StackAdd (b, NODEa[e], 0);
-		break;
-	      }
-	  }
-	case 1:
-	  {
-	    if (NODEb[e] != v && mk[b = norm (unique (NODEb[e]))] == MEMBER)
-	      {
-		Stack[StackPos++].m = 2;
-		StackAdd (b, NODEb[e], 0);
-		break;
-	      }
-	  }
-	case 2:
-	  if (NODEc[e] != v && mk[b = norm (unique (NODEc[e]))] == MEMBER)
-	    StackAdd (b, NODEc[e], 0);
-	}
-    }
-  return (0);
+if (!Stack)
+{
+StackMax = 256;
+if (!(Stack = Xmalloc (sizeof (*Stack) * StackMax)))
+return (-1);
+StackPos = 0;
+}
+Stack[StackPos].e = e;
+Stack[StackPos].v = v;
+Stack[StackPos].m = 0;
+StackPos++;
+while (StackPos)
+{
+int m, b;
+StackPos--;
+e = Stack[StackPos].e;
+v = Stack[StackPos].v;
+m = Stack[StackPos].m;
+
+
+switch (m)
+{
+case 0:
+  {
+    mk[e] = ERASED;
+    push (S, e);
+
+    if (NODEa[e] != v)
+      delete (NODEa[e], e);
+    if (NODEb[e] != v)
+      delete (NODEb[e], e);
+    if (NODEc[e] != v)
+      delete (NODEc[e], e);
+
+    if (NODEa[e] != v && mk[b = norm (unique (NODEa[e]))] == MEMBER)
+      {
+	Stack[StackPos++].m = 1;
+	StackAdd (b, NODEa[e], 0);
+	break;
+      }
+  }
+case 1:
+  {
+    if (NODEb[e] != v && mk[b = norm (unique (NODEb[e]))] == MEMBER)
+      {
+	Stack[StackPos++].m = 2;
+	StackAdd (b, NODEb[e], 0);
+	break;
+      }
+  }
+case 2:
+  if (NODEc[e] != v && mk[b = norm (unique (NODEc[e]))] == MEMBER)
+    StackAdd (b, NODEc[e], 0);
+}
+}
+return (0);
 }
 #endif
@@ -271,31 +274,31 @@
 {
 
-  int v, e;
-  /* build list of edges for each node */
-  for (v = 1; v <= n; FIRST[v++] = 0);
-  for (e = 1; e <= m; e++)
-    {
-      NEXT[A + e] = FIRST[NODEa[e]];
-      FIRST[NODEa[e]] = A + e;
-      NEXT[B + e] = FIRST[NODEb[e]];
-      FIRST[NODEb[e]] = B + e;
-      NEXT[C + e] = FIRST[NODEc[e]];
-      FIRST[NODEc[e]] = C + e;
-
-      /* mark edge e as belonging to the hypergraph */
-      mk[e] = MEMBER;
-    }
-
-
-  S.sp = 0;			/* empty the stack */
-  mk[0] = ERASED;		/* a sentinel for the test below */
-  for (v = 1; v <= n; v++)
-    {
-      if (mk[e = norm (unique (v))] == MEMBER)
-	ph_remove (e, v);
-    }
-
-  /* check if any edges were left in the graph */
-  return S.sp == m;
+int v, e;
+/* build list of edges for each node */
+for (v = 1; v <= n; FIRST[v++] = 0);
+for (e = 1; e <= m; e++)
+{
+NEXT[A + e] = FIRST[NODEa[e]];
+FIRST[NODEa[e]] = A + e;
+NEXT[B + e] = FIRST[NODEb[e]];
+FIRST[NODEb[e]] = B + e;
+NEXT[C + e] = FIRST[NODEc[e]];
+FIRST[NODEc[e]] = C + e;
+
+/* mark edge e as belonging to the hypergraph */
+mk[e] = MEMBER;
+}
+
+
+S.sp = 0;			/* empty the stack */
+mk[0] = ERASED;		/* a sentinel for the test below */
+for (v = 1; v <= n; v++)
+{
+if (mk[e = norm (unique (v))] == MEMBER)
+ph_remove (e, v);
+}
+
+/* check if any edges were left in the graph */
+return S.sp == m;
 }				/*acyclic */
 
@@ -313,21 +316,21 @@
 {
 
-  int e, k = 0;
-  int i, j;
-  u_char *w;
-
-  do
-    {
-      /* Added variable - need to increase MAX_N on allocate as well */
-      *n = (int) (num * c + MAX_N_HEADROOM); /* john mcpherson 22-02-2001 */
-
-      /* initialize tables of random integers */
-      for (i = 0; i < MAX_CH; i++)
-	for (j = 0; j < MAX_L; j++)
-	  {
+int e, k = 0;
+int i, j;
+u_char *w;
+
+do
+{
+/* Added variable - need to increase MAX_N on allocate as well */
+*n = (int) (num * c + MAX_N_HEADROOM); /* john mcpherson 22-02-2001 */
+
+/* initialize tables of random integers */
+for (i = 0; i < MAX_CH; i++)
+for (j = 0; j < MAX_L; j++)
+  {
 #ifndef STRUCT
-	    tb0[i][j] = RANDOM () % *n;
-	    tb1[i][j] = RANDOM () % *n;
-	    tb2[i][j] = RANDOM () % *n;
+    tb0[i][j] = RANDOM () % *n;
+    tb1[i][j] = RANDOM () % *n;
+    tb2[i][j] = RANDOM () % *n;
 #else
 	    struct tb_entry *tbp = &tb[i][j];
Index: /main/trunk/greenstone2/common-src/indexers/mg/lib/random.c
===================================================================
--- /main/trunk/greenstone2/common-src/indexers/mg/lib/random.c	(revision 37350)
+++ /main/trunk/greenstone2/common-src/indexers/mg/lib/random.c	(revision 37351)
@@ -22,5 +22,5 @@
 /*
  *	A random number generator called as a function by
- *	random (iseed)	or	irandm (iseed)
+ *	mgrandom (iseed)	or	mgirandm (iseed)
  *	The parameter should be a pointer to a 2-element long vector.
  *	The first function returns a double uniform in 0 .. 1.
@@ -173,5 +173,5 @@
 
 double 
-random (mg_s_long is [2])
+mgrandom (mg_s_long is [2])
 {
 	mg_s_long it, leh, nit;
@@ -194,5 +194,5 @@
 
 mg_s_long 
-irandm (mg_s_long is [2])
+mgirandm (mg_s_long is [2])
 {
 	mg_s_long it, leh, nit;
Index: /main/trunk/greenstone2/common-src/indexers/mg/lib/random.h
===================================================================
--- /main/trunk/greenstone2/common-src/indexers/mg/lib/random.h	(revision 37350)
+++ /main/trunk/greenstone2/common-src/indexers/mg/lib/random.h	(revision 37351)
@@ -38,6 +38,6 @@
 #include "mglong.h"
 
-double random (mg_s_long is [2]);
-mg_s_long irandm (mg_s_long is [2]);
+double mgrandom (mg_s_long is [2]);
+mg_s_long mgirandm (mg_s_long is [2]);
 
 #endif
Index: /main/trunk/greenstone2/common-src/indexers/mg/lib/simplefrenchstem.c
===================================================================
--- /main/trunk/greenstone2/common-src/indexers/mg/lib/simplefrenchstem.c	(revision 37350)
+++ /main/trunk/greenstone2/common-src/indexers/mg/lib/simplefrenchstem.c	(revision 37351)
@@ -19,4 +19,5 @@
  **************************************************************************/
 
+#include "unitool.h"
 #include "simplefrenchstem.h"
 
