[Turn on line numbering]arg header, info, args; var ref, str_ref, name, obj, code, def, out, line, linenumbers, user, strings, flags, trace, anc, current, m, options; ref = (| args["target"] |); linenumbers = (| args["linenumbers"] |); if (!("linenumbers" in args['arg_list])) { if ($security_lib.check_userdb_with_optional(header['interface])) { user = header['interface].get_info('run_as); linenumbers = (| user.get_setting("www-show-line-num", $www_preferences) |) || 0; } } catch any { name = (> tosym(ref[4]) <); obj = ref[3]; def = obj.find_method(name); if ('native in def.method_flags(name)) code = ["This method is implemented natively within the driver."]; else code = def.list_method(name).mmap('html_escape); options = "linenumbers" in args['arg_list] && linenumbers ? [["linenumbers", "yes"]] : []; code = $code_lib.code_to_html(code, obj, options); if (linenumbers) code = code.numbered_text(); str_ref = obj + "." + name + "()"; out = .build_header(header, info, args, #[['title, str_ref]]) + ["<h1>Method code for " + ._make_string_to_display_href(obj, "&methods=yes") + (def != obj ? "<" + ._make_string_to_display_href(def, "&methods=yes") + ">" : "") + "." + name + "()" + "</h1>", "<blockquote>"]; strings = linenumbers ? ["no", "off"] : ["yes", "on"]; out += [strfmt("[<A HREF=\"/bin/method?target=%s&linenumbers=%s\">Turn %s line numbering</A>]", str_ref, @strings)]; out += ["<hr size=1 noshade width=\"50%\" align=left><pre>"]; out += code + ["</pre><hr size=1 noshade width=\"50%\" align=left>"]; line = "// " + def.credit().join("<br>// "); out += ["<font color=\"#a0a0a0\">" + line + "</font>"]; out += ["</blockquote>"]; strings = (trace = []); current = def; while (current) { trace += [current]; current = (| def.find_next_method(name, current) |); } if (trace.length() > 1) { out += ["<h2>Method Ancestry Override:</h2>"]; out += ["<blockquote><pre>"]; for anc in (trace) { m = anc.method_info(name); out += [strfmt("%5l %4r " + ._make_string_to_display_href(anc) + ._make_method_href([anc, name, m[1]], @options), $object_lib.parse_method_flags(m[6]), m[4])]; } out += ["</pre></blockquote>"]; } } with { switch (error()) { case ~type: return [header['interface].response(400, "Invalid method reference " + obj + "." + name + "()")]; case ~methodnf: line = obj + "." + name + "()"; return [header['interface].response(400, line + " not found.")]; default: return [header['interface].response(400, traceback()[1][2])]; } } return [out + .build_footer(header, info, args)];
// Brad Roberts
// Bruce Mitchener, Jr.
// Created 16-May-1997 as a part of ColdCore, see: @help Credit