pike.git / src / builtin.cmod

version» Context lines:

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.