pike.git
/
src
/
builtin.cmod
version
»
Context lines:
10
20
40
80
file
none
3
pike.git/src/builtin.cmod:1004:
/*! @decl int inherits(program|object child, program parent) *! @belongs Program *! *! Returns 1 if @[child] has inherited @[parent]. */ PMOD_EXPORT PIKEFUN int program_inherits(program|object child, program parent) errname Program.inherits; optflags OPT_TRY_OPTIMIZE; {
-
if
(TYPEOF(
*
child)
=
=
PIKE
_
T
_
PROGRAM)
-
RETURN low_get_storage
(child
->u.program, parent
)
!= -1
;
-
else if (TYPEOF(*child) == PIKE_T_OBJECT) {
-
struct program *p = child->u.object->prog;
+
struct
program
*
p
=
program
_
from
_
svalue
(child);
-
if (!p)
RETURN 0;
-
if (SUBTYPEOF(*child)) {
-
p = (p->inherits + SUBTYPEOF(*child))->prog;
-
if (p->flags & PROGRAM
_
USES
_
PARENT)
-
RETURN 0;
-
} else if ((p->flags & PROGRAM
_
USES_PARENT)
-
&& PARENT_INFO
(
child->u
.
object)->parent
-
&& PARENT_INFO(child->u.
object)
->parent->prog)
-
RETURN 0
;
+
if (!p)
+
SIMPLE
_
ARG
_
TYPE
_
ERROR
(
"Program
.
inherits",
1,
"program|
object
"
);
RETURN low_get_storage(p, parent) != -1; }
-
SIMPLE_ARG_TYPE_ERROR("Program.inherits", 1, "program|object");
-
}
-
+
/*! @decl string defined(program p) *! @belongs Program *! *! Returns a string with filename and linenumber describing where *! the program @[p] was defined. *! *! The returned string is of the format @expr{"filename:linenumber"@}. *! *! If it cannot be determined where the program was defined, @expr{0@} *! (zero) will be returned.