[Turn on line numbering]var ancestors, pos, len, method, a, def, str, tb; // called by $sys.create() to create a new object. if (caller() != $sys && sender() != this()) throw(~perm, "Caller is not $sys and sender is not this."); if (inited) throw(~perm, "Already initialized."); ancestors = ancestors().reverse(); for a in (ancestors) { refresh(); if (!(method = (| tosym("init_" + tostr(a.objname())) |))) continue; if ((def = (| find_method(method) |))) { if (def != a) { (| def.manager().tell("Initialization method for " + a + " in wrong place (" + find_method(method) + ")") |); } else { catch any { .(method)(); } with { // try and let somebody know they made a boo-boo somewhere str = "UNINIT ERROR " + this() + "<" + def + ">:"; tb = traceback().fmt_tb(); if (def) { (| def.manager().tell(str) |); (| def.manager().tell(tb) |); } if (.manager() != sender()) { (| sender().tell(str) |); (| sender().tell(tb) |); } (| sender().tell("Continuing init..") |); (| $sys.log_traceback(tb, "** " + str) |); } } } } inited = 1;
// Created as a part of ColdCore, see: @help Credit