Documentation update from Driver sources
Change-Id: Ide409fb7a65ec5fefaccdcc821705d80af10e343
diff --git a/doc/LPC/closure_guide b/doc/LPC/closure_guide
index b2538fe..1f23acb 100644
--- a/doc/LPC/closure_guide
+++ b/doc/LPC/closure_guide
@@ -519,10 +519,6 @@
'publish and 'reserve may be given as additional arguments to
modify the behaviour of the catch.
- #'sscanf acts similar to how a funcall would, but passes the third
- and following arguments as lvalues, that is, values which can
- be assigned to.
-
#'= and the #'<op>= variants are also special because the first
argument has to be an lvalue.
@@ -651,7 +647,6 @@
#'do
#'foreach
#'return
- #'sscanf
#'switch
#'while
#'({
diff --git a/doc/LPC/closures b/doc/LPC/closures
index ba5d804..0672154 100644
--- a/doc/LPC/closures
+++ b/doc/LPC/closures
@@ -34,6 +34,17 @@
this_player(). Of course, this is only a rather simple
application.
+ Closure literals can have prefixes to specify which type
+ of closure shall be created:
+
+ #'efun::function_name: closure to an efun
+ #'sefun::function_name: closure to a simul-efun
+ #'lfun::function_name: closure to an lfun
+ #'var::variable_name: closure to a global variable
+
+ Inherited programs can be given as prefixes, too. But they
+ can not be combined with the prefixes above.
+
Inline closures are a variant of lfun closures, the difference
being that the function text is written right where the
closure is used. Since they are pretty powerful by
diff --git a/doc/LPC/functions b/doc/LPC/functions
index 50c39a0..06949ea 100644
--- a/doc/LPC/functions
+++ b/doc/LPC/functions
@@ -33,11 +33,19 @@
- name is the name of the function, e.g. "short", or "Nice_Try",
under which it is made known.
- <arguments> is a list of variable definitions in the
- normal '<type> <name>' style, separated by comma.
+ normal '<type> <name> = <default value>' style, separated
+ by comma.
Examples: () : no argument taken
(int a) : takes on integer argument
(mixed a, object *b): takes two arguments, one
arbitrary type, one array of objects.
+ (int a = 42) : takes zero or one integer argument.
+ if none is given, 42 is used instead.
+ If default values are given, they must be given for all
+ following arguments except a varargs argument. If a function
+ has a prototype, the default values should be specified
+ there instead of the definition (otherwise it might not
+ be known that these arguments are optional).
- { statements... } defines the code for this function. This
is a normal block (see block(LPC)) and as such can define
its own local variables.
@@ -169,6 +177,9 @@
function inherited at all, the statement will just return
an empty array.
+HISTORY
+ LDMud 3.6.4 introduced default values for function arguments.
+
SEE ALSO
types(LPC), modifiers(LPC), varargs(LPC), references(LPC),
call_other(E), simul_efun(C), call_out(E)
diff --git a/doc/LPC/lfuns b/doc/LPC/lfuns
index a9c559d..e8f3f8f 100644
--- a/doc/LPC/lfuns
+++ b/doc/LPC/lfuns
@@ -13,16 +13,27 @@
An example looks like this:
- call_other(drink, "QueryShort");
+ call_other(drink, "QueryShort");
This call may also be written as
- drink->QueryShort();
+ drink->QueryShort();
This means call_other(object, "function", args...) can also be
written as object->function(args...). The second form is
preferred as it is easier to read.
+ call_other() will return 0, if the function does not exist
+ or is not accessible. As an alternative there is call_strict()
+ which will result in an error in such a case. The call is
+ similar:
+
+ call_strict(drink, "QueryShort")
+
+ And can be written as
+
+ drink.QueryShort();
+
Some lfuns have a special meaning for the LPC driver, because
they are applied by the interpreter instead from an LPC object.
To distinguish those, they are called ``applied lfuns''.
diff --git a/doc/LPC/operators b/doc/LPC/operators
index 24b3618..bd092dc 100644
--- a/doc/LPC/operators
+++ b/doc/LPC/operators
@@ -80,14 +80,19 @@
expr1 == expr2 Compare values. Valid for strings, numbers,
objects and closures.
- expr1 != expr1 Compare values. Valid for strings, numbers,
+ expr1 != expr2 Compare values. Valid for strings, numbers,
objects and closures.
- expr1 > expr2 Valid for strings and numbers.
+ expr1 in expr2 Check whether 'expr1' is contained in 'expr2':
+ a value in an array, a key in a mapping,
+ a character or substring in a string, or a
+ a byte or byte sequence in a byte sequence.
+
+ expr1 > expr2 Valid for strings and numbers.
expr1 >= expr2 Valid for strings and numbers.
- expr1 < expr2 Valid for strings and numbers.
+ expr1 < expr2 Valid for strings and numbers.
expr1 <= expr2 Valid for strings and numbers.
@@ -201,7 +206,7 @@
'ident' may be given as string containing the
full pathname, or as identifier containing the
pure basename.
- If 'ident' is omitted, the last inherited
+ If 'ident' is omitted, the first inherited
function of this 'name' is called.
({ }) Array constructor.
@@ -215,6 +220,7 @@
LDMud 3.2.10 extended '&' to mappings.
LDMud 3.3 extended '|' and '^' to arrays.
LDMud 3.6.2 added '.'.
+ LDMud 3.6.5 added 'in'.
SEE ALSO
arrays(LPC), alists(LPC), mappings(LPC), closures(LPC)
diff --git a/doc/LPC/pragma b/doc/LPC/pragma
index a1cfa99..d005ce3 100644
--- a/doc/LPC/pragma
+++ b/doc/LPC/pragma
@@ -83,6 +83,12 @@
type other than 'void'.
no_warn_missing_return: Turn off warn_missing_return.
+ warn_dead_code: Warn about dead code. Code is considered dead if
+ it can never be executed. The driver has only limited
+ analysis capabilities and cannot detect all instances
+ of dead code.
+ no_warn_dead_code: Turn off warn_dead_code (the default).
+
warn_function_inconsistent: If an inherited function is
overloaded with inconsistent return types or arguments,
a warning is generated; or if pragma_pedantic is in effect,
@@ -95,6 +101,11 @@
mudlib code - in general one should fix the warnings,
not turn them off.
+ warn_applied_functions: If a function is known to be an applied
+ lfun, warn if its declaration differs from the specification.
+ no_warn_applied_functions: Turn of warn_applied_functions
+ (the default).
+
warn_unused_variables: Warn about variables that are not used.
If will warn about variables never written to, variables
never read from or variables never used at all.