| 5. LFUN |
| Module lfun:: |
void lfun::__INIT()
Global variable initialization.
This function is called just before lfun::create when an object is instanciated.
This function is generated automatically by the compiler, and can not be overloaded.
lfun::create
void lfun::create(object(zero) ... args)
Object creation callback.
This function is called right after lfun::__INIT.
args will be the arguments passed when the program was called.
In Pike 7.2 and later this function can be created implicitly
by the compiler using the new syntax:
In the above case an implicit lfun::create will be created,
and it will be equvivalent to:
class Foo(int foo) {
int bar;
}
class Foo {
int foo;
int bar;
static void create(int foo)
{
local::foo = foo;
}
}
lfun::__INIT, lfun::destroy
void lfun::destroy()
Object destruction callback.
This function is called by destruct right before it will zero all the object variables, and destroy the object.
Note that it will also be called on implicit destruct, eg when there are no more references to the object, or when the garbage-collector decides to destruct the object.
lfun::create, destruct
mixed lfun::`+(object(zero) ... args)
Left associative addition operator callback.
lfun::``+, lfun::.`+
mixed lfun::`-(object(zero) ... args)
Left associative subtraction operator callback.
lfun::``-, lfun::.`-
mixed lfun::`&(object(zero) ... args)
Left associative and operator callback.
lfun::``&, lfun::.`&
mixed lfun::`|(object(zero) ... args)
Left associative or operator callback.
lfun::``|, lfun::.`|
mixed lfun::`^(object(zero) ... args)
Left associative exclusive or operator callback.
lfun::``^, lfun::.`^
mixed lfun::`<<(object(zero) arg)
Left associative left shift operator callback.
lfun::``<<, lfun::.`<<
mixed lfun::`>>(object(zero) arg)
Left associative right shift operator callback.
lfun::``>>, lfun::.`>>
mixed lfun::`*(object(zero) ... args)
Left associative multiplication operator callback.
lfun::``*, lfun::.`*
mixed lfun::`/(object(zero) ... args)
Left associative division operator callback.
lfun::``/, lfun::.`/
mixed lfun::`%(object(zero) ... args)
Left associative modulo operator callback.
lfun::``%, lfun::.`%
mixed lfun::`~()
Inversion operator callback.
lfun::.`~
int(0..1) lfun::`==(mixed arg)
Equality operator callback.
lfun::.`==
int(0..1) lfun::`<(mixed arg)
Less than operator callback.
lfun::.`<
int(0..1) lfun::`>(mixed arg)
Greater than operator callback.
lfun::.`>
int lfun::__hash()
Hashing callback.
This function gets called by various mapping operations when the object is used as index in a mapping.
mixed lfun::cast(string requested_type)
Cast operator callback.
Type to cast to.
Expected to return the object value-casted (converted) to the type described by requested_type.
The argument is currently a string with the name of the type, but might in the future be a value of the type type.
Currently casting between object types is a noop.
If the returned value is not deemed to be of the requested type a runtime error may be thrown.
int lfun::`!()
Not operator callback.
Returns non-zero if the object should be evaluated as false, and 0 (zero) otherwise.
lfun::.`!
mixed lfun::`[](object(zero) arg1, object(zero)|void arg2)
Index/range operator callback.
lfun::.`[]
mixed lfun::`[]=(object(zero) arg1, object(zero) arg2)
Index assignment operator callback.
lfun::.`[]=, lfun::`->=
mixed lfun::`->(string arg)
Arrow index operator callback.
lfun::.`->
mixed lfun::`->=(string arg1, object(zero) arg2)
Arrow index assign operator callback.
lfun::.`->=, lfun::`[]=
int lfun::_sizeof()
Sizeof operator callback.
Called by sizeof to determine the number of elements in an object. If this function is not present, the number of public symbols in the object will be returned.
Expected to return the number of valid indices in the object.
sizeof
array lfun::_indices()
Indices operator callback.
Expected to return an array with the valid indices in the object.
indices, lfun::_values
array lfun::_values()
Values operator callback.
Expected to return an array with the values corresponding to the indices returned by lfun::_indices.
values, lfun::_indices
mixed lfun::`()(object(zero) ... args)
Function call operator callback.
lfun::.`()
mixed lfun::``+(object(zero) ... args)
Right associative addition operator callback.
lfun::`+, lfun::.`+
mixed lfun::``-(object(zero) ... args)
Right associative subtraction operator callback.
lfun::`-, lfun::.`-
mixed lfun::``&(object(zero) ... args)
Right associative and operator callback.
lfun::`&, lfun::.`&
mixed lfun::``|(object(zero) ... args)
Right associative or operator callback.
lfun::`|, lfun::.`|
mixed lfun::``^(object(zero) ... args)
Right associative exclusive or operator callback.
lfun::`^, lfun::.`^
mixed lfun::``<<(object(zero) arg)
Right associative left shift operator callback.
lfun::`<<, lfun::.`<<
mixed lfun::``>>(object(zero) arg)
Right associative right shift operator callback.
lfun::`>>, lfun::.`>>
mixed lfun::``*(object(zero) ... args)
Right associative multiplication operator callback.
lfun::`*, lfun::.`*
mixed lfun::``/(object(zero) ... args)
Right associative division operator callback.
lfun::`/, lfun::.`/
mixed lfun::``%(object(zero) ... args)
Right associative modulo operator callback.
lfun::`%, lfun::.`%
mixed lfun::`+=(object(zero) arg)
Self increment operator callback.
lfun::.`+, lfun::`+
int(0..1) lfun::_is_type(string basic_type)
Type comparison callback.
Called by the cast operator to determine if an object simulates a basic type.
One of:
|
The following five shouldn't occurr, but are here for completeness:
|
Expected to return 1 if the object is to be regarded as a simulation of the type specified by basic_type.
The argument is currently a string with the name of the type, but might in the future be a value of the type type.
string lfun::_sprintf(int conversion_type, mapping(string:int)|void params)
Sprintf callback.
This method is called by sprintf to print objects. If it is not present, printing of the object will not be supported for any conversion-type except for the %O-conversion-type, which will output "object".
One of:
|
Conversion parameters. The following parameters may be supplied:
|
Is expected to return a string describing the object formatted according to conversion_type.
lfun::._sprintf is currently not called for the following conversion-types:
|
sprintf
int lfun::_equal(mixed arg)
Equal callback.
equal, lfun::`==
mixed lfun::_m_delete(mixed arg)
Mapping delete callback.
m_delete
object lfun::_get_iterator()
Iterator creation callback.
Should return an object that implements the iterator API:
lfun::`! should return 0 (zero) when not at end of stream, and 1 at end of stream.
lfun::`+= should advance the specified number of steps.
index should return the current index.
value should return the current value.
Iterator, foreach
| Module :: |
mixed ::`->(string index)
Builtin arrow operator.
This function indexes the current object with the string index. This is useful when the arrow operator has been overloaded.
::`->=
void ::`->=(string index, mixed value)
Builtin arrow set operator.
This function indexes the current object with the string index, and sets it to value. This is useful when the arrow set operator has been overloaded.
::`->
mixed ::_indices()
Builtin function to list the identifiers of an object. This is useful when lfun::_indices has been overloaded.
::_values
mixed ::_values()
Builtin function to list the values of the identifiers of an object. This is useful when lfun::_values has been overloaded.
::_indices