    Allow min() and max() macro built-in functions to accept a single array

    If an array is passed instead of a list of arguments, each entry of the
    array is examined, and must be a numeric value. (The keys are ignored.)
    No other arguments are allowed.

diff -U5 -r nedit_official nedit_mod
diff -U5 -r nedit_official/doc/help.etx nedit_mod/doc/help.etx
--- nedit_official/doc/help.etx	2006-08-13 20:41:54.000000000 +0200
+++ nedit_mod/doc/help.etx	2006-09-21 22:06:26.031250000 +0200
@@ -2594,14 +2594,22 @@
   first button is number 1), in $list_dialog_button. If the user closes the
   dialog via the window close box, the function returns the empty string, and
   $list_dialog_button returns 0.
 
 **max( n1, n2, ... )**
-  Returns the maximum value of all of its arguments
+**max( array )**
+  Returns the maximum value of all of its arguments. In the first form, at
+  least one argument is required, and all must hold numeric values. In the
+  second form, a single array argument will be scanned: this array must only
+  contain numeric values, and must contain at least one element.
 
 **min( n1, n2, ... )**
-  Returns the minimum value of all of its arguments
+**min( array )**
+  Returns the minimum value of all of its arguments. In the first form, at
+  least one argument is required, and all must hold numeric values. In the
+  second form, a single array argument will be scanned: this array must only
+  contain numeric values, and must contain at least one element.
 
 **read_file( filename )**  
   Reads the contents of a text file into a string. On success, returns 1 in
   $read_status, and the contents of the file as a string in the subroutine
   return value. On failure, returns the empty string "" and an 0 $read_status.
diff -U5 -r nedit_official/source/macro.c nedit_mod/source/macro.c
--- nedit_official/source/macro.c	2006-05-31 18:39:23.000000000 +0200
+++ nedit_mod/source/macro.c	2006-09-21 21:57:56.921875000 +0200
@@ -1815,36 +1815,68 @@
 static int minMS(WindowInfo *window, DataValue *argList, int nArgs,
     	DataValue *result, char **errMsg)
 {
     int minVal, value, i;
     
-    if (nArgs == 1)
+    if (nArgs < 1)
     	return tooFewArgsErr(errMsg);
-    if (!readIntArg(argList[0], &minVal, errMsg))
-    	return False;
-    for (i=0; i<nArgs; i++) {
-	if (!readIntArg(argList[i], &value, errMsg))
-    	    return False;
-    	minVal = value < minVal ? value : minVal;
+    if (nArgs == 1 && argList[0].tag == ARRAY_TAG) {
+        SparseArrayEntry *iter = arrayIterateFirst(&argList[0]);
+        if (!iter) {
+            *errMsg = "Empty array passed to function %s";
+            return False;
+        }
+        if (!readIntArg(iter->value, &minVal, errMsg))
+            return False;
+        while ((iter = arrayIterateNext(iter))) {
+            if (!readIntArg(iter->value, &value, errMsg))
+                return False;
+            minVal = value < minVal ? value : minVal;
+        }
+    }
+    else {
+        if (!readIntArg(argList[0], &minVal, errMsg))
+            return False;
+        for (i=1; i<nArgs; i++) {
+           if (!readIntArg(argList[i], &value, errMsg))
+                return False;
+            minVal = value < minVal ? value : minVal;
+        }
     }
     result->tag = INT_TAG;
     result->val.n = minVal;
     return True;
 }
 static int maxMS(WindowInfo *window, DataValue *argList, int nArgs,
     	DataValue *result, char **errMsg)
 {
     int maxVal, value, i;
     
-    if (nArgs == 1)
+    if (nArgs < 1)
     	return tooFewArgsErr(errMsg);
-    if (!readIntArg(argList[0], &maxVal, errMsg))
-    	return False;
-    for (i=0; i<nArgs; i++) {
-	if (!readIntArg(argList[i], &value, errMsg))
-    	    return False;
-    	maxVal = value > maxVal ? value : maxVal;
+    if (nArgs == 1 && argList[0].tag == ARRAY_TAG) {
+        SparseArrayEntry *iter = arrayIterateFirst(&argList[0]);
+        if (!iter) {
+            *errMsg = "Empty array passed to function %s";
+            return False;
+        }
+        if (!readIntArg(iter->value, &maxVal, errMsg))
+            return False;
+        while ((iter = arrayIterateNext(iter))) {
+            if (!readIntArg(iter->value, &value, errMsg))
+                return False;
+            maxVal = value > maxVal ? value : maxVal;
+        }
+    }
+    else {
+        if (!readIntArg(argList[0], &maxVal, errMsg))
+            return False;
+        for (i=1; i<nArgs; i++) {
+           if (!readIntArg(argList[i], &value, errMsg))
+                return False;
+            maxVal = value > maxVal ? value : maxVal;
+        }
     }
     result->tag = INT_TAG;
     result->val.n = maxVal;
     return True;
 }
