pike.git
/
src
/
program.c
version
»
Context lines:
10
20
40
80
file
none
3
pike.git/src/program.c:1:
/* || This file is part of Pike. For copyright information see COPYRIGHT. || Pike is distributed under GPL, LGPL and MPL. See the file COPYING || for more information.
-
|| $Id: program.c,v 1.
585
2005/
01
/
20
00
:
27
:
17
nilsson
Exp $
+
|| $Id: program.c,v 1.
586
2005/
02
/
09
16
:
35
:
50
mast
Exp $
*/ #include "global.h" #include "program.h" #include "object.h" #include "dynamic_buffer.h" #include "pike_types.h" #include "stralloc.h" #include "las.h" #include "lex.h"
pike.git/src/program.c:156:
struct pike_string *lfun_strings[NELEM(lfun_names)]; static struct mapping *lfun_ids; /* mapping(string:type) */ static struct mapping *lfun_types; static const char *const raw_lfun_types[] = { tFuncV(tNone,tVoid,tVoid), /* "__INIT", */ tFuncV(tNone,tZero,tVoid), /* "create", */
-
tFuncV(
tNone
,tVoid,tVoid),
/* "destroy", */
+
tFuncV(
tOr(tVoid
,
tInt),
tVoid,tVoid), /* "destroy", */
tFuncV(tZero,tZero,tMix), /* "`+", */ tFunc(tOr(tVoid,tZero),tMix), /* "`-", */ tFuncV(tNone,tZero,tMix), /* "`&", */ tFuncV(tNone,tZero,tMix), /* "`|", */ tFuncV(tNone,tZero,tMix), /* "`^", */ tFuncV(tZero,tVoid,tMix), /* "`<<", */ tFuncV(tZero,tVoid,tMix), /* "`>>", */ tFuncV(tNone,tZero,tMix), /* "`*", */ tFuncV(tNone,tZero,tMix), /* "`/", */ tFuncV(tNone,tZero,tMix), /* "`%", */
pike.git/src/program.c:322:
*! { *! local::foo = foo; *! } *! } *! @endcode *! *! @seealso *! @[lfun::__INIT()], @[lfun::destroy()] */
-
/*! @decl void lfun::destroy()
+
/*! @decl void lfun::destroy
(
void|int reason
)
*! *! Object destruction callback. *!
-
*! This function is called
by
@[predef::destruct()]
right
before
it
-
*!
zeroes
all
the
object
variables
and
destroys
the
object
.
+
*! This function is called
right
before the object is destructed.
+
*! That can happen either through a call to
@[predef::destruct()]
,
+
*!
when there are no more references to the object, or when the
+
*!
garbage
collector
discovers
that
it's
part
of
a
cyclic data
+
*! structure that has become garbage
.
*!
-
*!
@note
-
*! Note that it's also called on implicit destruct, i.e. when there
-
*!
are
no
more
references
to
the object
,
or
when the garbage
-
*! collector decides to destruct it.
+
*!
@param
reason
+
*!
A
flag
that
tells
why
the object
is
destructed:
*!
-
+
*! @int
+
*! @value Object.DESTRUCT_EXPLICIT
+
*! Destructed explicitly by @[predef::destruct].
+
*! @value Object.DESTRUCT_NO_REFS
+
*! Destructed due to running out of references.
+
*! @value Object.DESTRUCT_GC
+
*! Destructed by the garbage collector.
+
*! @value Object.DESTRUCT_CLEANUP
+
*! Destructed as part of the cleanup when the pike program
+
*! exits. Note that Pike normally doesn't do any cleanup before
+
*! exit - it must be compiled with the configure option
+
*! @tt{--with-cleanup-on-exit@} to enable that. So this value
+
*! normally doesn't occur.
+
*! @endint
+
*!
*! @note *! Regarding destruction order during garbage collection: *! *! If an object is destructed by the garbage collector, it's part of *! a reference cycle with other things but with no external *! references. If there are other objects with @expr{destroy@} *! functions in the same cycle, it becomes a problem which to call *! first. *! *! E.g. if this object has a variable with another object which
pike.git/src/program.c:402:
*! The garbage collector ensures that these objects are destructed in *! an order so that @expr{werror@} in @expr{Super@} is called and not *! @expr{error@} in @expr{Sub@}. *! *! @note *! When the garbage collector calls @[lfun::destroy], all accessible *! non-objects and objects without @expr{destroy@} functions are *! still intact. They are not freed if the @expr{destroy@} function *! adds external references to them. However, all objects with *! @[lfun::destroy] in the cycle are already scheduled for
-
*! destruction and
are
thus
be destroyed even if external
references
-
*! are added to them.
+
*! destruction and
will
therefore
be destroyed even if external
+
*!
references
are added to them.
*! *! @note *! The garbage collector had completely random destruct order in *! versions prior to 7.2. *! *! @seealso *! @[lfun::create()], @[predef::destruct()] */ /*! @decl mixed lfun::`+(zero arg, zero ... rest)
pike.git/src/program.c:462:
*! *! @seealso *! @[lfun::`+()], @[predef::`+()] */ /*! @decl mixed lfun::``+(zero arg, zero ... rest) *! *! Right side addition/concatenation callback. *! *! This is used by @[predef::`+]. It's called with any arguments
-
*! that
precedes
this object in the argument list of the call to
+
*! that
precede
this object in the argument list of the call to
*! @[predef::`+]. The returned value should be a new instance that *! represents the addition/concatenation between the arguments in *! the order they are given and this object. *! *! @note *! It's assumed that this function is side-effect free. *! *! @seealso *! @[lfun::`+()], @[predef::`+()] */