Update doc/efun/ aus Driversourcen.
Manpages der efuns aktualisiert, neue Manpages hinzugefuegt.
Change-Id: I7cc91684269ff56d1aef47d5c5e7c87f7fd531dc
diff --git "a/doc/efun/\133\135" "b/doc/efun/\133\135"
index afbc0fe..357092f 100644
--- "a/doc/efun/\133\135"
+++ "b/doc/efun/\133\135"
@@ -1,66 +1,97 @@
SYNOPSIS
- mixed arr[index];
- int str[index];
+ mixed arr[index]
+ int str[index]
- mixed * arr[from..to];
- string str[from..to];
+ mixed * arr[from .. to]
+ string str[from .. to]
+ mixed m[key, from .. to]
-BESCHREIBUNG
- Liefert ein Element aus einem Array oder String (erste Form), oder
- eine Teilmenge (zweite Form).
+DESCRIPTION
+ Return one element from a string/array (first form), or a slice
+ (substring resp. subarray) of a string/array/mapping (second form).
- Die Indizes <index>, <from> und <to> sind durchnummeriert von 0 bis
- strlen(<str>)-1 bzw. sizeof(<arr>)-1. Wenn ein <index> als '<wert'
- geschrieben wird, wird der Wert vom Ende des Stings / Arrays her
- gezaehlt. Dabei wird nummeriert von 1 bis strlen(<str>) bzw.
- sizeof(<arr>). Wird <from> weggelassen, beginnt die Teilmenge mit
- dem ersten Element. Wird <to> weggelassen, endet die Teilmenge mit
- dem letzten Element.
+ The indexes <index>, <from> and <to> are numbered 0 to
+ strlen(str)-1, sizeof(arr)-1 resp. widthof(m)-1.
- In der ersten Form muss <index> innerhalb der Grenzen des Strings /
- Arrays sein, sonst wird ein Laufzeitfehler (RTE) verursacht. In der
- zweiten Form werden die Indizes an die Groesse des Strings / Arrays
- angepasst. Wenn <from> groesser ist als <to> oder beide ausserhalb
- der Groesse des Strings / Arrays liegen, wird ein leerer String ""
- bzw. ein leeres Array ({}) zurueck geliefert.
+ If an index is written '<value', the value is counted from the
+ end of the string/array/mapping and is numbered 1 to strlen(str),
+ sizeof(arr) resp. widthof(m).
- Die Notation als Closure ist entsprechend:
+ If an index is written '>value', the value is counted from the
+ end of the string/array/mapping if it is negative (starting with
+ -1 for the last element), and from the beginning if it is positive
+ (starting with 0 for the first element).
- [index] -> ({'#[, arr, index })
- [<index] -> ({'#[<, arr, index })
- [from..to] -> ({'#[..], arr, from, to })
- [<from..to] -> ({'#[<..], arr, from, to })
- [from..<to] -> ({'#[..<], arr, from, to })
- [<from..<to] -> ({'#[<..<], arr, from, to })
+ If <from> is omitted, it defaults to the beginning of the
+ string/array/mapping.
+ If <to> is omitted, it defaults to the beginning of the
+ string/array/mapping.
-BEISPIELE
+ In the first form, the <index> must be within the bounds of
+ the string/array, or a runtime error occurs.
+ In the second form, the indexes will be fitted to the bounds of
+ the string/array/mapping. If <from> is greater than <to>, or both
+ outside the bounds, an empty string/array ("" resp. ({})) will
+ be returned.
+
+ The closure notation is straightforward:
+
+ [index] -> ({'#[, arr, index })
+ [<index] -> ({'#[<, arr, index })
+ [>index] -> ({'#[>, arr, index })
+ [from..to] -> ({'#[..], arr, from, to })
+ [<from..to] -> ({'#[<..], arr, from, to })
+ [from..<to] -> ({'#[..<], arr, from, to })
+ [<from..<to] -> ({'#[<..<], arr, from, to })
+ [>from..to] -> ({'#[>..], arr, from, to })
+ [from..>to] -> ({'#[..>], arr, from, to })
+ [>from..<to] -> ({'#[>..<], arr, from, to })
+ [<from..>to] -> ({'#[<..>], arr, from, to })
+ [>from..>to] -> ({'#[>..>], arr, from, to })
+ [key,index] -> ({'#[,], m, index })
+ [key,<index] -> ({'#[,<], m, index })
+ [key,>index] -> ({'#[,>], m, index })
+ [key,from..to] -> ({'#[,..], m, from, to })
+ [key,<from..to] -> ({'#[,<..], m, from, to })
+ [key,from..<to] -> ({'#[,..<], m, from, to })
+ [key,<from..<to] -> ({'#[,<..<], m, from, to })
+ [key,>from..to] -> ({'#[,>..], m, from, to })
+ [key,from..>to] -> ({'#[,..>], m, from, to })
+ [key,>from..<to] -> ({'#[,>..<], m, from, to })
+ [key,<from..>to] -> ({'#[,<..>], m, from, to })
+ [key,>from..>to] -> ({'#[,>..>], m, from, to })
+
+EXAMPLES
foo = ({ 1, 2, 3, 4 }); str = "test";
foo[1] -> 1 str[1] -> 'e' == 101
foo[1..2] -> ({ 2, 3 }) str[1..2] -> "es"
foo[2..1] -> ({ }) str[2..1] -> ""
foo[0..<2] -> ({ 1, 2 }) str[0..<2] -> "tes"
-
foo[..<2] -> ({ 1, 2 }) str[..<2] -> "tes"
foo[<3..] -> ({ 2, 3, 4 }) str[<3..] -> "est"
- foo[1] = 5 -> foo == ({ 1, 5, 3, 4 })
- foo[1..2] = ({ 5, 6, 7 }) -> foo == ({ 1, 5, 6, 7, 4 })
- foo[1..2] = ({ }) -> foo == ({ 1, 4 })
+ foo[1] = 5 -> foo == ({ 1, 5, 3, 4 })
+ foo[1..2] = ({ 5, 6, 7 }) -> foo == ({ 1, 5, 6, 7, 4 })
+ foo[1..2] = ({ }) -> foo == ({ 1, 4 })
- str[1] = 'a' -> str == "tast"
- str[1..2] = "bar" -> str == "tbart"
- str[1..2] = "" -> str == "tt"
+ str[1] = 'a' -> str == "tast"
+ str[1..2] = "bar" -> str == "tbart"
+ str[1..2] = "" -> str == "tt"
-GESCHICHTE
- slice_array() ist die alte Form der []-Operatoren fuer Arrays,
- extract() ist die alte Form der []-Operatoren fuer Strings.
- BEIDE VARIANTEN SIND VERALTET, WERDEN NICHT MEHR UNTERSTUETZT UND
- SOLLTEN DESHALB NICHT MEHR VERWENDET WERDEN.
+HISTORY
+ slice_array() is the old form of the [] operator on arrays.
+ extract() is the old form of the [] operator on strings.
+ Both ARE NO LONGER SUPPORTED and should not be used anymore!
- Die Syntax fuer 'rueckwaerts zaehlen vom letzten Element' hat sich von
- Version 3.1.J zu 3.1.K geaendert von '-1' zu '<1'. Auch ist seit dann
- foo[0..-1] ein leeres Array bzw. ein leerer String.
+ The syntax for ``counting from last element'' has changed
+ between versions 3.1.J and 3.1.K from ``-1'' to ``<1''.
+ foo[0..-1] is now an empty string resp. array.
-SIEHE AUCH
- member(E), sizeof(E), slice_array(E)
+ LDMud 3.3 introduced the '>' indexing method.
+
+ LDMud 3.6.6 introduced range indexing for mappings.
+
+SEE ALSO
+ member(E), sizeof(E)
+