Update doc/efun/ aus Driversourcen.
Manpages der efuns aktualisiert, neue Manpages hinzugefuegt.
Change-Id: I7cc91684269ff56d1aef47d5c5e7c87f7fd531dc
diff --git a/doc/efun/sort_array b/doc/efun/sort_array
index 3316a0c..65c861e 100644
--- a/doc/efun/sort_array
+++ b/doc/efun/sort_array
@@ -1,74 +1,71 @@
SYNOPSIS
mixed * sort_array(mixed *arr, string wrong_order)
mixed * sort_array(mixed *arr, string wrong_order, object|string ob)
- mixed * sort_array(mixed *arr, string wrong_order, object|string ob,
- mixed extra...)
+ mixed * sort_array(mixed *arr, string wrong_order, object|string ob
+ , mixed extra...)
mixed * sort_array(mixed *arr, closure cl)
mixed * sort_array(mixed *arr, closure cl, mixed extra...)
-BESCHREIBUNG
- Sortiert das Array <arr> entweder nach der Ordnungsfunktion
- <ob->wrong_order(a, b)> oder nach der Closure cl.
+DESCRIPTION
+ Sort the copy either by the ordering function ob->wrong_order(a, b),
+ or by the closure expression <cl>.
- Normalerweise wird zuerst eine flache Kopie des Arrays <arr> erstellt
- und die sortierte Kopie als Ergebnis zurueckgeliefert. Wird <arr>
- jedoch als Referenz uebergeben, wird keine implizite Kopie erstellt
- und das Originalarray sortiert.
+ Usually a shallow copy of <arr> is made first and the sorted copy is
+ returned as result. However, if <arr> is given as a reference, no copy
+ will be made and <arr> will be sorted in-place.
- Wenn das Argument <arr> 0 ist, ist das Resultat der Funktion auch 0.
+ If the <arr> argument equals 0, the result is also 0.
- <ob> ist das Objekt, in dem die Ordnungsfunktion <wrong_order()>
- aufgerufen wird. <ob> kann das Objekt als solches enthalten, oder
- einen String mit dem Objektnamen. Wird <ob> nicht angegeben, oder
- enthaelt es weder einen String noch ein Objekt, wird stattdessen
- this_object() verwendet.
+ <ob> is the object in which the ordering function is called
+ and may be given as object or by its filename. If <ob> is omitted
+ or neither a string nor an object, it defaults to this_object().
- Die Elemente von <arr> werden paarweise an die Ordnungsfunktion
- <wrong_order()> als Argumente uebergeben, gefolgt von den <extra>
- Argumenten, falls vorhanden. Die Ordnungsfunktion <wrong_order> sollte
- eine positve Zahl liefern, wenn die paarweisen Elemente in der
- falschen Reihenfolge waren, 0 oder eine negative Zahl sonst.
+ The elements from the array to be sorted are passed in pairs to
+ the function <wrong_order> as arguments, followed by the <extra>
+ arguments if any.
-BEISPIELE
- Um folgendes Array in aufsteigender Reihenfolge zu ordnen:
+ The function should return a positive number if the elements
+ are in the wrong order. It should return 0 or a negative
+ number if the elements are in the correct order.
- arr = ({ 3, 8, 1, 3 })
+EXAMPLES
+ To sort an array
- wird als Ordnungsfunktion ist_groesser() verwendet:
+ arr = ({ 3, 8, 1, 3 })
- int ist_groesser(int a, int b) {
- return a > b;
- }
+ in ascending order with the help of the ordering function
- Folgende Aufrufe von sort_array() sind alle aequivalent:
+ int is_greater (int a, int b) {
+ return a > b;
+ }
- arr = sort_array(arr, "ist_groesser", this_object())
- arr = sort_array(arr, "ist_groesser")
- arr = sort_array(arr, #'ist_groesser)
- arr = sort_array(arr, #'>) //dies ist die bevorzugte Variante :-)
- arr = sort_array(arr, lambda(({'a, 'b}), ({#'>, 'a, 'b})))
+ the following uses of sort_array() are equivalent:
- Soll direkt das Original <arr> statt einer impliziten Kopie sortiert
- werden:
+ arr = sort_array(arr, "is_greater", this_object())
+ arr = sort_array(arr, "is_greater")
+ arr = sort_array(arr, #'is_greater)
+ arr = sort_array(arr, #'>) (this is the preferred variant :-)
+ arr = sort_array(arr, lambda(({'a, 'b}), ({#'>, 'a, 'b})))
- sort_array(&arr, #'>)
+ If no implicit shallow copy of <arr> should be made, pass <arr> as
+ reference:
- Etwas komplizierter ist es, folgendes Array aufsteigend nach dem
- zweiten Argument jedes Teilarrays zu ordnen:
+ sort_array(&arr, #'>)
- arr = ({ ({ "foo", 3 }), ({ "quux", 1 }), ... })
+ A more complicated example is to sort the array
- Dafuer muss die Ordnungsfunktion folgende Form annehmen:
+ arr = ({ ({ "foo", 3 }), ({ "quux", 1 }), ... })
- int ist_groesser(mixed *a, mixed *b) {
- return a[1] > b[1];
- }
+ in ascending order by the second element of each subarray.
+ For this, the ordering function should be like
-GESCHICHTE
- LDMud 3.2.8 fuehrte die Moeglichkeit ein, zusaetzliche Argumente
- <extra> zu uebergeben.
- LDMud 3.3.720 unterstuetzt die Uebergabe von <arr> als Referenz und
- sortiert das Original statt einer impliziten flachen Kopie.
+ int is_greater (mixed *a, mixed *b) {
+ return a[1] > b[1];
+ }
-SIEHE AUCH
+HISTORY
+ LDMud 3.2.8 added the support of extra arguments.
+ LDMud 3.3.720 added the support of references to sort in-place.
+
+SEE ALSO
transpose_array(E), filter(E), map(E), alists(LPC)