Mercurial > hgrepos > FreeBSD > ports > sysutils > local-bsdtools
changeset 609:398656a28909
farray.sh: docs
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Thu, 19 Sep 2024 13:28:01 +0200 |
| parents | cd9d5127ade2 |
| children | a84ba696ffd8 |
| files | share/local-bsdtools/farray.sh |
| diffstat | 1 files changed, 21 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/share/local-bsdtools/farray.sh Thu Sep 19 13:13:23 2024 +0200 +++ b/share/local-bsdtools/farray.sh Thu Sep 19 13:28:01 2024 +0200 @@ -63,6 +63,20 @@ #: ``_farr_V_<TOKEN>_<INDEX>`` is unexpectedly unset. #: Exceptions to this rule are documented. #: +#: Hints and rules for indexes: +#: +#: For all functions these facts hold: +#: +#: - Every object (array, alist) has a current length LEN. +#: - Indexes range from 1 <= INDEX <= LEN. +#: - Indexes 0, -1, -2 are evaluated to LEN + given index. +#: So `0` indexes the last item, `-1` the second last and `-LEN+1` the +#: first item. +#: - All index (and length) values must be given as decimal numbers. +#: +#: `null` (aka empty) and/or missing indexes are handled differently in +#: the function context. +#: #: Important: #: All names that start with ``_farr_`` or ``__farr_`` are reserved #: for private use in this module. @@ -644,8 +658,7 @@ #: desired: nothing will be done with the deleted elements. #: $2 (str): The name of the array that is to be spliced #: $3 (int, null): Index, where to remove and/or insert elements. -#: - `null` is len+1. -#: - 0, -1, -2, ... -(len-1) are len + given index. +#: A `null` index value is evaluated to `len + 1`. #: $4 (int, null): The length -- the number of elements to delete at given #: index. #: If `null` then the length from index to the end of the @@ -1251,12 +1264,12 @@ #: $1 (str): The name of the alist. #: #: Output (Globals): -#: __farr_name (str): -#: __farr_token (str): -#: __farr_objname (str): -#: __farr_keyname (str): -#: __farr_valname (str): -#: __farr_len (int): The length of the array +#: __farr_name (str): The name of the alist. +#: __farr_token (str): The token that is the value of the name. +#: __farr_objname (str): The variable prefix for the length ("object"). +#: __farr_keyname (str): The variable prefix for all item keys. +#: __farr_valname (str): The variable prefix for all item values. +#: __farr_len (int): The length of the alist. #: #: Exit: #: Iff the array does not exist in some fashion (token and/or storage).
