Update Doku aus Driversourcen
Change-Id: I455f0813b970151089b3dc1b8d9407eea323cdd1
diff --git a/doc/LPC/arrays b/doc/LPC/arrays
index 883dddb..6dc4905 100644
--- a/doc/LPC/arrays
+++ b/doc/LPC/arrays
@@ -2,9 +2,14 @@
arrays
DESCRIPTION
- There is support for arrays. The arrays can't be declared, but
- should be allocated dynamically with the function 'allocate()'
- (see efun/allocate).
+ There is support for arrays. Arrays can be declared with the
+ type of its members appended by a star (e.g. string* for an
+ array with string elements). But this declaration is not
+ sufficient to actually create an array at runtime, as all
+ variables (even arrays) are initialized with 0 which is not
+ a valid array. Arrays must either be allocated dynamically
+ with the function 'allocate()' (see efun/allocate), or
+ created with the ({}) array constructor.
Arrays are stored by reference, so all assignments of whole
arrays will just copy the address. The array will be
diff --git a/doc/LPC/closure_guide b/doc/LPC/closure_guide
index 438ba46..b2538fe 100644
--- a/doc/LPC/closure_guide
+++ b/doc/LPC/closure_guide
@@ -390,7 +390,7 @@
// with 0 now.
({ (#'do),
({ (#'write),'i }), // give out i
- ({ (#'+=),'i,1 }) // increase i
+ ({ (#'+=),'i,1 }), // increase i
({ (#'<),'i,10 }), // condition: i < 10
42 // result is not interesting
})
@@ -427,7 +427,7 @@
lambda(0,({ (#'while),// loop
1, // condition is 1 ==> endles loop
42, // return value (which will never be used)
- ({ (#'write),"grin" })
+ ({ (#'write),"grin" }),
({ (#'?!), // ifnot
({ (#'random),10 }), // (random(10))
({ (#'return),100 }) // return 100;
diff --git a/doc/LPC/closures-example b/doc/LPC/closures-example
index f50fd35..fcc4e6d 100644
--- a/doc/LPC/closures-example
+++ b/doc/LPC/closures-example
@@ -102,7 +102,7 @@
map( filter(all_inventory(room), #'living)
, lambda( ({ 'liv })
- , ({'#, , ({#'=, 'hp, ({#'call_other, 'liv, "QueryHP" }) })
+ , ({#', , ({#'=, 'hp, ({#'call_other, 'liv, "QueryHP" }) })
, ({#'?, ({#'>, 'hp, 10 })
, ({#'call_other, 'liv, "SetHP"
, ({#'-, 'hp, 10 })
diff --git a/doc/LPC/ed2 b/doc/LPC/ed2
index 85d520e..22277b8 100644
--- a/doc/LPC/ed2
+++ b/doc/LPC/ed2
@@ -15,7 +15,7 @@
Any character can used instead of '/':
s!apa!bepa!g
- The 'g' specifies that all occurences of apa on this line are
+ The 'g' specifies that all occurrences of apa on this line are
changed to bepa.
The pattern that are supposed to be replaced, can be a regular
diff --git a/doc/LPC/escape b/doc/LPC/escape
index 8518749..ee99efa 100644
--- a/doc/LPC/escape
+++ b/doc/LPC/escape
@@ -35,21 +35,23 @@
The numeric escapes could be used to express a character directly
by its code in binary, octal, decimal or hexadecimal notation.
- \0b Beginning of binary notation
- \0o Beginning of octal notation
- \0x Beginning of hexadecimal notation
- \x Beginning of hexadecimal notation
+ \0b Beginning of binary notation
+ \0o Beginning of octal notation
+ \0x Beginning of hexadecimal notation
+ \x Beginning of hexadecimal notation
+ \u, \U Beginning of extended hexadecimal notation
A backslash followed by a digit ([0-9]) which does not map to one
of the above starts an escape in decimal notation.
A numeric escape terminates when N digits have been used up or
when the first character that is not a valid digit in that
- notation is encountered. N is 2 for hexadeximals, 3 for
- decimals and octals and 8 for binarys.
+ notation is encountered. N is 2 for hexadeximals with \0x and \x,
+ 3 for decimals and octals, 4 for hexadecimals with \u,
+ 8 for binarys and for hexadecimals with \U.
If the specified code is greater than 255 a warning is issued and
- the value modulo 256 is used.
+ the value modulo 256 is used (except for \u and \U).
EXAMPLES
Put a newline at the end of user output
diff --git a/doc/LPC/foreach b/doc/LPC/foreach
index 7e6060b..9e4df32 100644
--- a/doc/LPC/foreach
+++ b/doc/LPC/foreach
@@ -80,7 +80,7 @@
a = ({1, 2, 3})
foreach(x : a) { a[1..2] = ({4, 5}); write(x+" "); }
will write ("1 4 5 ").
- - operations which implicitely copy the array or struct (this
+ - operations which implicitly copy the array or struct (this
includes range assignments which change the size) don't
have an effect on the loop.
diff --git a/doc/LPC/inline-closures b/doc/LPC/inline-closures
index 3a2ecdd..ee7d0a1 100644
--- a/doc/LPC/inline-closures
+++ b/doc/LPC/inline-closures
@@ -43,7 +43,7 @@
But changes of the closure context will not reflect on the
local variable it was copied from and vice versa.
- In addition to the implicite context inherited from the
+ In addition to the implicit context inherited from the
defining function, additional context variables can be defined
in the closure:
@@ -64,7 +64,7 @@
{ return val * x; };
}
- These explicite context variables are useful when the closures
+ These explicit context variables are useful when the closures
needs to keep a state, or to improve performance:
mapping m = ...;
diff --git a/doc/LPC/modifiers b/doc/LPC/modifiers
index 0268105..7639741 100644
--- a/doc/LPC/modifiers
+++ b/doc/LPC/modifiers
@@ -172,7 +172,7 @@
(and 'static' for functions only) are allowed here.
The default visibility thus set affects only variables/functions with
- no explicite visibility:
+ no explicit visibility:
default private;
diff --git a/doc/LPC/operators b/doc/LPC/operators
index 18406a3..911007b 100644
--- a/doc/LPC/operators
+++ b/doc/LPC/operators
@@ -116,7 +116,7 @@
expr1 - expr2 Subtract 'expr2' from 'expr1'. Valid for
numbers, strings, arrays, mappings.
- For arrays and strings, all occurences of the
+ For arrays and strings, all occurrences of the
elements resp. characters in 'expr2' are removed
from 'expr1', and the result is returned.
For mapping, all occurances of elemens in 'expr1'
diff --git a/doc/LPC/pragma b/doc/LPC/pragma
index d26f326..21d4881 100644
--- a/doc/LPC/pragma
+++ b/doc/LPC/pragma
@@ -24,19 +24,32 @@
save_types: the declaration data is kept after compilation and
checked at runtime. This is important for type-safe
inheritance.
+ no_bytes_type: removes the keyword 'bytes', also 'string' then
+ denotes the type <string|bytes>.
+ bytes_type: reactivates the keyword 'bytes' and distinguishes
+ between the 'bytes' and 'string' type.
rtt_checks: runtime checks during execution of this program will be
- enabled. The interpreter will check for correct datatypes of
- arguments on function calls. (Later it will include checks
- upon assignments.)
+ enabled. The interpreter will check for correct datatypes in
+ the following circumstances:
+ - arguments on function calls,
+ - return values of functions,
+ - assignment to variables,
+ - restoration of values to variables or struct members.
Don't confuse this with strong/strict_types, they only
check at compile time.
strong_types/strict_types is seriously recommended.
This pragma implicitly enables save_types as well.
+ warn_rtt_checks: runtime checks are enabled, just like rtt_checks,
+ but errors will be shown as warnings only.
no_rtt_checks: disable runtime type checks for this program (default).
pedantic: Certain warnings are treated as errors:
- - failure to pass enough arguments to simul efuns
+ - failure to pass enough arguments to simul efuns
+ - type casts with no effect
+ - inconsistent declarations
+ - inconsistent overloads
+ - double inherits
sloppy: Turns off pedantic (the default).
range_check: Use of questionable ranges (ranges of negative sizes,
@@ -49,8 +62,8 @@
no_warn_deprecated: Turns off warn_deprecated.
warn_empty_casts: A cast of a value to its own type generates
- a warning (the default). Exception are casts to type
- 'mixed'.
+ a warning. Also casting a value of mixed/unknown type or
+ casting to mixed will generate a warning (the default).
no_warn_empty_casts: Turns off warn_empty_casts.
warn_missing_return: Warn if a value-returning function is missing
diff --git a/doc/LPC/structs b/doc/LPC/structs
index 217b0a6..0774e18 100644
--- a/doc/LPC/structs
+++ b/doc/LPC/structs
@@ -151,7 +151,7 @@
struct passed as first argument. The content of the template
struct is irrelevant, so an empty struct suffices. For
example, to create an instance of struct Foo:
-
+
({ #'(<, (<Foo>), 1, ({ 2 }), (<Bar>) })
The order of the member values is the order in which they
@@ -174,15 +174,14 @@
Support for structs is signaled by the macro __LPC_STRUCTS__.
- Since structs are tied to the program they are defined in,
- re-compiling a program creates new struct types which are
- in principle incompatible to the old ones. However, the LPC
- compiler checks if the newly compiled structs have the same
- structure as their older counterparts of the same name
- (and defining program). If the structures conform, the existing
- older struct types are used instead of the new ones. This way
- an accidental of for example /std/types.c doesn't break
- the whole mud.
+ Though structs are tied to the program the are defined in,
+ re-compiling a program doesn't make the struct types
+ incompatible. Even if the newly compiled struct has a
+ different structure it will be accepted by routines that
+ expect the old struct definition. When members disappeared
+ in the new struct definition, read access to those members
+ will return 0, write access to vanished members however
+ will result in a runtime error.
EXAMPLES
diff --git a/doc/LPC/types b/doc/LPC/types
index 903a1be..e104951 100644
--- a/doc/LPC/types
+++ b/doc/LPC/types
@@ -11,9 +11,9 @@
macros __INT_MIN__ and __INT_MAX__.
Integer values can be specified in decimal, in
- sedecimal when preceeded by '0x' (e.g. 0x11), binary
+ sedecimal when preceded by '0x' (e.g. 0x11), binary
when preceeded by '0b' (e.g. 0b00010001), octal when
- preceeded by '0o' (e.g. 0o21) and as character
+ preceded by '0o' (e.g. 0o21) and as character
yielding the charset value for the character as the number
to use (e.g. '0' yields 48 on ASCII machines).
@@ -60,19 +60,21 @@
\<LF> : ignored
\<LF><CR> : ignored
- \N : the character code N in decimal
- \0xN : the character code N in sedecimal
- \xN : the character code N in sedecimal
- \0oN : the character code N in octal
- \0bN : the character code N in binary
- \a : BEL (0x07)
- \b : Backspace (0x08)
- \t : Tab (0x09)
- \e : Escape (0x1b)
- \n : Newline (0x0a)
- \f : Formfeed (0x0c)
- \r : Carriage Return (0x0d)
- \" : The double quote (")
+ \N : the character code N in decimal
+ \0xN : the character code N in sedecimal
+ \xN : the character code N in sedecimal
+ \0oN : the character code N in octal
+ \0bN : the character code N in binary
+ \uNNNN : Unicode character N in sedicimal
+ \UNNNNNNNN: Unicode character N in sedicimal
+ \a : BEL (0x07)
+ \b : Backspace (0x08)
+ \t : Tab (0x09)
+ \e : Escape (0x1b)
+ \n : Newline (0x0a)
+ \f : Formfeed (0x0c)
+ \r : Carriage Return (0x0d)
+ \" : The double quote (")
\<other character>: the given character
Adjacent string literals are automatically
@@ -80,6 +82,18 @@
compiled. String literals joined with '+' are
concatenated by the LPC compiler as well.
+ o bytes Byte sequences are similar to strings. They offer
+ the same operations, but cannot be mixed with strings.
+
+ Byte sequence literals are written between double-quotes
+ prefixed with a 'b' (e.g. b""). Adjacent byte sequence
+ literals are automatically concatenated.
+
+ The text is allowed to consist of ASCII characters
+ (equivalent to bytes 0-127) and escape-sequences
+ just like strings, with the exception of the \u and \U
+ unicode escape sequences.
+
o object Pointer to an object. Objects are always passed by
reference.