object $root; var $root manager = $root; var $root trusted = []; var $root child_index = 15; var $root fertile = 1; var $root inited = 0; var $root quota = 75000; var $root managed = 0; var $root writers = [$root]; var $root created_on = 0; var $root flags = ['methods, 'code, 'fertile, 'core, 'variables]; var $root quota_exempt = 0; var $root writes = 0; var $root trusted_by = 0; var $root help_node = 0; root method .init_root(): nooverride { .change_manager(this()); flags = ['variables, 'methods, 'code]; created_on = time(); }; root method .uninit_root(): nooverride { var obj; (| manager.del_managed_obj() |); catch any { for obj in (.managed()) obj.change_manager($reaper); } catch any { for obj in (.writers('literal)) .del_writer(obj); } catch any { for obj in (.writes()) obj.del_writer(this()); } catch any { for obj in (.trusted('literal)) .del_trusted(obj); } catch any { for obj in (.trusted_by()) obj.del_trusted(this()); } // tell $sys we are going away $sys.sender_going_away(); }; public method .initialize(): nooverride { var ancestors, ancestor, pos, len; if ((caller() != $sys) && (sender() != this())) throw(~perm, "Caller is not $sys and sender is not this."); if (inited) throw(~perm, "Already initialized."); ancestors = ancestors(); len = ancestors.length(); for pos in [0 .. len - 1] { (> ._initialize_ancestor(ancestors[len - pos]) <); // pause(); } inited = 1; }; public method .uninitialize(): nooverride { var ancestor, errors, p; (> .perms(caller(), $root, $sys) <); errors = []; for ancestor in (ancestors()) { catch any ._uninitialize_ancestor(ancestor); with errors += [traceback()]; } for p in (.variables()) .del_var(p); return errors; }; public method .perms(): nooverride { arg what, [args]; var flag; if (!args) args = ['writer]; if (type(args[1]) == 'symbol) { switch (args[1]) { case 'system: if (!($sys.is_system(what))) throw(~perm, ("Permission Denied: " + what) + " is not of the system.", what); case 'manager: if (((.manager()) != what) && (!($sys.is_system(what)))) throw(~perm, ("Permission Denied: " + what) + " is not the manager.", what); case 'trusts: if (!(.trusts(what))) throw(~perm, ("Permission Denied: " + what) + " is not a trustee.", what); default: if (!(.is_writable_by(what))) throw(~perm, ("Permission Denied: " + what) + " is not a writer.", what); } } else if (type(what) == 'objnum) { if (!(what in args)) throw(~perm, (what + " is not one of: ") + ((args.mmap('namef, 'ref)).to_english()), what); } }; root method ._change_parents(): nooverride { arg parents; var old_a, old_p, p, o, a, new_a; if (!parents) throw(~noparents, "Objects must have at least 1 parent"); // remember the old ancestors and parents old_a = ancestors(); old_p = .parents(); // build the new ancestors list by hand, so we can uninit befor changing new_a = [this(), @parents]; for p in (parents) new_a = new_a.union(p.ancestors()); // uninit it for a in (old_a.set_difference(new_a)) (| ._uninitialize_ancestor(a) |); // do the change (> chparents(parents) <); // init new for a in (ancestors().set_difference(old_a)) (| ._initialize_ancestor(a) |); }; public method .chparents() { arg [parents]; var parent, cur; if (!(| .perms(sender(), 'manager) |)) (> .perms(caller(), $root, $sys) <); if (!parents) throw(~noparents, "There must be at least 1 parent for each object."); // Notify new parents of impending change. cur = parents(); for parent in (parents) { if (!(parent in cur)) (> parent.will_inherit(sender()) <); } // Everything's okay, go ahead and try it. ._change_parents(parents); }; public method .will_inherit(): nooverride { arg who; if (this() in (sender().parents())) throw(~perm, ((sender() + " already has ") + this()) + " as a parent."); if ((!(.has_flag('fertile, sender()))) && (!(.trusts(who)))) throw(~perm, ((this() + " refuses to be parent of ") + sender()) + "."); }; public method .manager(): nooverride { return manager || $reaper; }; public method .writers(): nooverride { arg [literal]; if (literal) return writers || []; // for speed, just add rather than setadd, use .compress() later if necessary return (writers || []) + [.manager(), this()]; }; public method .trusted(): nooverride { arg [literal]; if (literal) return trusted || []; return (trusted || []) + (.writers()); }; public method .is_writable_by(): nooverride { arg obj; return (| obj in (.writers()) |) || ($sys.is_system(obj)); }; public method .trusts(): nooverride { arg obj; return (| obj in (.trusted()) |) || ((obj == $scheduler) || ($sys.is_system(obj))); }; public method .change_manager(): nooverride { arg new; var old; if ((caller() != definer()) && (!($sys.is_system(sender())))) throw(~perm, "You must have system priveleges to change the manager."); if (type(new) != 'objnum) throw(~invarg, "Managers must be given as a single dbref."); old = .manager(); manager = new; old.del_managed_obj(); new.add_managed_obj(); }; public method .add_writer(): nooverride { arg obj; (> .perms(sender(), 'manager) <); writers = (writers || []).setadd(obj); obj.add_writable_obj(); }; public method .del_writer(): nooverride { arg obj; (caller() == definer()) || (> .perms(sender(), 'manager) <); writers = (writers || []).setremove(obj); if (!writers) (| clear_var('writers) |); obj.del_writable_obj(); }; public method .add_trusted(): nooverride { arg obj; (caller() == definer()) || (> .perms(sender(), 'manager) <); trusted = (trusted || []).setadd(obj); obj.add_trusted_obj(); }; public method .del_trusted(): nooverride { arg obj; (> .perms(sender(), 'manager) <); trusted = (trusted || []).setremove(obj); if (!trusted) clear_var('trusted); obj.del_trusted_obj(); }; public method .as_this_run() { arg obj, method, args; if (caller() != $scheduler) throw(~perm, "Sender not allowed to gain access to object perms."); return (> obj.(method)(@args) <); }; public method .add_parent() { arg parent; (> .perms(sender(), 'manager) <); (> parent.will_inherit(sender()) <); if (.has_ancestor(parent)) throw(~perm, ((sender() + " already has ") + this()) + " as an ancestor."); ._change_parents(parents() + [parent]); }; public method .del_parent() { arg parent; var parents; (> .perms(sender(), 'manager) <); if (!valid(parent)) throw(~type, "Not a valid parent, must send a valid object."); parents = .parents(); if (!(parent in parents)) throw(~parentnf, ((parent + " is not a parent of ") + this()) + "."); parents = parents.setremove(parent); (> ._change_parents(parents) <); }; public method .spawn(): nooverride { arg [suffix]; var obj, tmp, objname, mngr, na; (> .will_spawn(sender()) <); suffix = (> .get_obj_suffix(@suffix) <); return $sys.spawn_sender(suffix, sender()); }; public method .destroy(): nooverride { // This doesn't actually destroy us immediately, but we will go away when // nothing is holding onto us any more. (> .perms(sender(), 'manager) <); if (.has_flag('core)) throw(~perm, "This object is a core object, and cannot be destroyed!"); (> .uninitialize() <); destroy(); }; public method .add_var() { arg name, [args]; var tmp, kid; (> .perms(sender()) <); if (!(tostr(name).valid_ident())) throw(~invident, name + " is not a valid ident."); (> add_var(name) <); // The following code is a kludge as we can't send a default value to the // primitive. if (args) { tmp = tosym((("__set_" + tostr(name)) + "_") + time()); catch any { add_method([((tostr(name) + " = ") + toliteral(args[1])) + ";"], tmp); .(tmp)(); if (((args.length()) > 1) && ((args[2]) == 'inherit)) { for kid in (.descendants()) kid.(tmp)(); } del_method(tmp); } with { del_method(tmp); rethrow(error()); } } }; public method .variables(): nooverride { return variables(); }; public method .del_var(): nooverride { arg name; var n, obj; (caller() == definer()) || (> .perms(sender()) <); // try and clear the variable on all of the descendants, before deleting // the variable... (> .clear_variable(name) <); // now delete the variable (> del_var(name) <); }; public method .del_method() { arg name; (> .perms(sender()) <); (> del_method(name) <); }; public method .methods(): nooverride { if (!(.has_flag('methods, sender()))) throw(~perm, (sender() + " doesn't have permission to find methods on ") + this()); return methods(); }; public method .parents(): nooverride { return parents(); }; public method .children(): nooverride { return children(); }; public method .ancestors(): nooverride { return ancestors(); }; public method .find_method(): nooverride { arg name; if (!(.has_flag('methods, sender()))) throw(~perm, (sender() + " doesn't have permission to find methods on ") + this()); return (> find_method(name) <); }; public method .find_next_method(): nooverride { arg name, after; if (!(.has_flag('methods, sender()))) throw(~perm, (sender() + " doesn't have permission to find methods on ") + this()); return (> find_next_method(name, after) <); }; private method .corify_descendants_of(): nooverride { arg obj; var d, name, l; name = (| tosym("core_" + (obj.objname())) |); catch ~methodnf { if ((> obj.find_method(name) <) != obj) { dblog(((("** Coremethod for " + obj) + " in wrong place (on ") + (obj.find_method(name))) + ") **"); return; } } with { return; } (| obj.(name)() |); for d in (obj.descendants()) { catch any { (> d.(name)() <); } with { dblog(((("ERROR encountered in " + d) + ".") + name) + "():"); for l in ($parse_lib.traceback()) dblog(l); } refresh(); } }; public method .add_method() { arg code, name; var l, m, line; (> .perms(sender()) <); (| $sys.touch() |); // check for a few things only admins can do if (!(sender().is($admin))) { for l in [1 .. listlen(code)] { line = code[l]; if ((m = line.match_regexp("[^a-z0-9_.]anticipate_assignment\("))) { (> sender().tell($code_lib.point_to_line("ERROR: call to anticipate_assignment()", ((m[1])[1]) + 2, ((m[1])[2]) - 2, l, line)) <); throw(~perm, "anticipate_assignment() may only be used by an administrator."); } } } return (> add_method(code, name) <); }; public method .has_ancestor(): nooverride { arg obj; return (> has_ancestor(obj) <); }; public method .eval(): nooverride { arg code, [dest]; var errors, result, method; dest = dest ? dest[1] : this(); if (!(sender() in [$scheduler, $root])) (> .perms(sender()) <); // Compile the code. method = tosym("tmp_eval_" + tostr(time())); errors = .add_method(code, method); if (errors) return ['errors, errors, 0, 0]; // Evaluate the expression. Be sure to remove it afterwards, so that no // one else can call it. catch any { result = (> dest.(method)() <); } with { (| del_method(method) |); rethrow(error()); } (| del_method(method) |); return ['result, result]; }; public method .method_info(): nooverride { arg [args]; return (> method_info(@args) <); }; public method .data(): nooverride { arg [parent]; var par, data, out; if (!(.has_flag('variables, sender()))) throw(~perm, ((sender().namef('ref)) + " is not allowed to read variables on ") + (.namef('ref))); if (parent) { if (type(parent[1]) != 'objnum) throw(~type, (parent[1]) + " is not an object."); return (> data(parent[1]) <); } else { data = (> data() <); out = #[]; for par in (data) { // if the parent doesn't exist anymore, just let them see the data. if ((!valid(par[1])) || ((par[1]).has_flag('variables, sender()))) out = out.add(par[1], par[2]); else out = out.add(par[1], ["*** Permission Denied ***"]); } return out; } }; public method .size(): nooverride { arg [args]; [(args ?= 'int)] = args; switch (args) { case 'string: return tostr(size()); case 'english: return size().to_english(); default: return size(); } }; public method .descendants(): nooverride { var kids, i, c, child, d; d = #[]; for child in (children()) d = dict_add(d, child, 1); while ((| (c = dict_keys(d)[++i]) |)) { for child in (c.children()) d = dict_add(d, child, 1); pause(); } return dict_keys(d); }; public method .get_quota(): nooverride { return quota; }; public method .quota_valid(): nooverride { if (quota_exempt) return 1; if (!(.is($user))) return 0; return (.quota_byte_usage()) < (.quota()); }; public method .match_children() { arg string; var children, child_names, c; children = .children(); child_names = children.mmap('name); // direct matches first. for c in (child_names) { if (c == string) return children[c in child_names]; } // ok, try partial matches for c in (child_names) { if ($string.match_begin(c, string)) return children[c in child_names]; } return 0; }; public method .del_flag(): nooverride { arg flag; (> .perms(sender(), 'manager) <); // let them add any flag they want flags = (flags || []).setremove(flag); }; public method ._display_descendants() { arg space, checked, levels, maxlev; var c, anc, list, id, perms; id = ((space + this()) + " ") + ($object_lib.see_perms(this())); for anc in (dict_keys(checked)) { if (.has_ancestor(anc)) return []; // [id + " (above)"]; } if (((.parents()).length()) > 1) id += " (MI)"; list = [id]; space += " "; levels++; // check children if ((!maxlev) || (maxlev != levels)) { for c in (.children()) { list += c._display_descendants(space, checked, levels, maxlev); checked = dict_add(checked, c, 1); pause(); } } return list; }; public method ._get_method_info(): nooverride { arg anc, method; var code, lines, dis_flag, meth_args, flags, first_comment; code = anc.list_method(method); lines = code.length(); if (lines > 5) code = code.subrange(1, 5); flags = anc.method_flags(method); if (code) { meth_args = regexp(code[1], "arg ([^;]);"); if (meth_args) { meth_args = meth_args[1]; code = code.delete(1); } else { meth_args = ""; } if (code && ((!(code[1])) || (((code[1])[1]) == "v"))) code = code.delete(1); if (code && ((!(code[1])) || (((code[1])[1]) == "v"))) code = code.delete(1); first_comment = code ? (code[1]) + " " : " "; first_comment = (((first_comment[1]) == "/") || ((first_comment[1]) == "r")) ? first_comment : ""; } else { meth_args = ""; first_comment = ""; } return [anc, method, meth_args, flags, lines, first_comment]; }; public method .namef() { arg type; return tostr(this()); // $# Edited 28 Oct 1995 21:06 Lynx ($lynx) }; public method .match_descendants() { arg string; var match, child; match = .match_children(string); if (match) return match; for child in (.children()) { match = child.match_descendants(string); if (match) return match; } return 0; }; public method .debug() { arg [stuff]; var x, line, mngr, meth; meth = (| (stack()[2])[3] |); if (meth) line = ((("DEBUG " + sender()) + ".") + meth) + "(): "; else line = ("DEBUG " + sender()) + ": "; for x in (stuff) line = (line + " ") + toliteral(x); (| (.manager()).tell(line) |); }; public method .set_quota(): nooverride { arg value; (> .perms(caller(), $user, @$sys.system(), $root) <); quota = value; }; public method .name() { arg [args]; return tostr(this()); }; public method .quota(): nooverride { return quota; }; public method .quota_byte_usage(): nooverride { var total, obj; for obj in (.managed()) { if (!valid(obj)) continue; total += obj.size(); } return total; }; public method .corify(): nooverride { var d; if (sender() != $sys) throw(~sysonly, "This should only be called by $sys.make_core()."); // reverse engineer it--if coreify_<object> exists, // call it on this object and all of its descendants. for d in (.descendants()) { .corify_descendants_of(d); refresh(); } }; root method ._initialize_ancestor(): nooverride { arg ancestor; var method; if (!(method = (| tosym("init_" + tostr(ancestor.objname())) |))) return; catch ~methodnf { if (find_method(method) != ancestor) throw(~perm, ((("Initialization method for " + ancestor) + " in wrong place (") + find_method(method)) + ")"); .(method)(); } }; root method ._uninitialize_ancestor(): nooverride { arg ancestor; var method, found; if (!(method = tosym("uninit_" + tostr(ancestor.objname())))) return; catch ~methodnf { if ((.find_method(method)) == ancestor) { found = 1; .(method)(); } (| $root.clear_def_vars(ancestor) |); if (!found) throw(~perm, ((("UnInitialization method for " + ancestor) + " in wrong place (") + (.find_method(method))) + ")"); } }; public method .objname(): nooverride { return (> objname() <); }; public method .set_objname() { arg objname; (> .perms(sender()) <); // Make sure first argument is a symbol. if (type(objname) != 'symbol) throw(~type, "New objname is not a symbol."); // Make sure everything is lowercase. objname = tosym(tostr(objname).lowercase()); // Do nothing if objname isn't different. if (objname == (| objname() |)) return; return (> set_objname(objname) <); }; public method .created_on(): nooverride { return created_on; }; public method .is_of(): nooverride { arg obj; return obj in ancestors(); }; public method .is(): nooverride { arg [args]; if (!args) throw(~invarg, "Must have one argument."); if (type(args[1]) == 'dictionary) return has_ancestor(args[2]); return has_ancestor(args[1]); }; public method .hname() { arg [args]; return ((("<a href=\"/bin/display?" + this()) + "\">") + this()) + "</a>"; }; public method .add_flag(): nooverride { arg flag; (> .perms(sender(), 'manager) <); if ((flag == 'core) && (!($sys.is_system(sender())))) throw(~perm, "Only system objects can set the 'core flag."); (flag == 'fertile) && (> .perms(sender(), 'manager) <); // let them add any flag they want flags = (flags || []).setadd(flag); }; public method .build_name() { arg [args]; var output, type, part, rval; output = ""; for part in (args) { type = type(part); if (type == 'list) output += (| .(part[1])(@part.subrange(2)) |) || ""; else if (type == 'string) output += part; } return output; }; public method .clear_variable(): nooverride { arg name; var n, obj; (> .perms(sender()) <); n = tosym("_clear_var_" + tostr(time())); catch any { .add_method([("clear_var(" + toliteral(name)) + ");"], n); for obj in (.descendants()) { (| obj.(n)() |); pause(); } (| del_method(n) |); } with { (| del_method(n) |); } }; public method .ancestors_to(): nooverride { arg obj; var a, out; out = [this()]; for a in (.ancestors()) { if (a.has_ancestor(obj)) out = out.setadd(a); } return out; }; public method .descendants_to(): nooverride { arg checked, levels, maxlev; var c, list; list = [this()]; levels++; // check parents if ((!maxlev) || (maxlev != levels)) { for c in (.children()) { list += [c.descendants_to(checked, levels, maxlev)]; checked = checked.setadd(c); } } return list; }; public method .ancestry(): nooverride { arg gen; var i, out; out = []; if (type(gen) == 'objnum) { for i in (.ancestors()) { if (i.has_ancestor(gen)) out += [i]; } return out; } if (gen != 0) { for i in (.parents()) out = out.union(i.ancestry(gen - 1)); } return out; }; public method .generations(): nooverride { arg gen; var p, out; out = [this()]; if (gen != 0) { for p in (.parents()) out = out.union(p.generations(gen - 1)); } return out; }; public method .variable_info() { arg gen, def, fltr, match; var ancs, data, pp, p; if (!(.has_flag('variables, sender()))) throw(~perm, (sender() + " cannot read variables on ") + this()); if (def) ancs = [def]; else ancs = .(gen[1])(gen[2]) || [this()]; data = []; for pp in ((data().to_list()).reverse()) { if (valid(pp[1]) && ((pp[1]) in ancs)) { for p in (pp[2]) { if (tostr(p[1]).(match)(fltr) != 0) data += [[pp[1], @p]]; } } } return data; }; public method .method_flags(): nooverride { arg method; if (!(.has_flag('methods, sender()))) throw(~perm, (sender() + " doesn't have permission to find methods on ") + this()); return (> method_flags(method) <); }; public method .method_access(): nooverride { arg method; if (!(.has_flag('methods, sender()))) throw(~perm, (sender() + " doesn't have permission to find methods on ") + this()); return (> method_access(method) <); }; public method .set_method_flags(): nooverride { arg method, flags; if (!(.is_writable_by(sender()))) throw(~perm, (sender() + " cannot write to ") + this()); if (('locked in flags) && (!($sys.is_system(sender())))) throw(~perm, "Only administrators can set the locked method flag."); return (> set_method_flags(method, flags) <); }; public method .set_method_access(): nooverride { arg method, state; if (!(.is_writable_by(sender()))) throw(~perm, (sender() + " cannot write to ") + this()); return (> set_method_access(method, state) <); }; public method .set_flags(): nooverride { arg new_flags; (> .perms(sender(), 'manager) <); if (type(new_flags) != 'list) throw(~invflags, "Flags must be submitted as a list of symbols."); if ((!new_flags) && flags) return clear_var('flags); if (('core in new_flags) && (!($sys.is_system(sender())))) throw(~perm, "Only system objects can set the 'core flag."); ('fertile in new_flags) && (> .perms(sender(), 'manager) <); flags = new_flags; }; public method .managed(): nooverride { return managed || []; }; root method .add_managed_obj(): nooverride { managed = (managed || []).setadd(sender()); }; root method .del_managed_obj(): nooverride { managed = (managed || []).setremove(sender()); if (!managed) clear_var('managed); }; public method .writes(): nooverride { (> .perms(sender(), 'trusts) <); return writes || []; }; root method .add_writable_obj(): nooverride { writes = (writes || []).setadd(sender()); }; root method .del_writable_obj(): nooverride { writes = (writes || []).setremove(sender()); if (!writes) clear_var('writes); }; public method .trusted_by(): nooverride { return trusted_by || []; }; root method .add_trusted_obj(): nooverride { trusted_by = (trusted_by || []).setadd(sender()); }; root method .del_trusted_obj(): nooverride { trusted_by = (trusted_by || []).setremove(sender()); if (!trusted_by) clear_var('trusted_by); }; public method .has_flag(): nooverride { arg flag, [sender]; [(sender ?= sender())] = sender; if (flag == 'core) return flag in (.flags()); return (flag in (.flags())) || (.trusts(sender)); }; public method .flags(): nooverride { return flags || []; }; public method .quota_exempt(): nooverride { return quota_exempt; }; public method .clean_root() { var obj; // Called by $sys.clean_database() (> .perms(caller(), $sys) <); (| ._clean_root('trusted, 'trusted_by) |); (| ._clean_root('trusted_by, 'trusted) |); (| ._clean_root('writers, 'writes) |); (| ._clean_root('writes, 'writers) |); if (!manager) { manager = this(); .change_manager($reaper); } if (managed) { managed = managed.valid_objects(); for obj in (managed) { refresh(); if ((obj.manager()) != this()) managed = setremove(managed, obj); } if (!managed) clear_var('managed); } }; public method .objnum(): nooverride { return objnum(); }; root method .clear_def_vars(): nooverride { arg definer; var code, v, a, meth, errs; code = []; for v in (definer.variables()) code += [("clear_var(" + v) + ");"]; meth = tosym("_root_tmp_" + time()); if (!(definer.add_method(code, meth))) { (| sender().(meth)() |); (| definer.del_method(meth) |); } }; public method .list_methods() { arg gen, def, fltr, match; var ancs, a, m, i, methods; if (!(.has_flag('methods, sender()))) throw(~perm, (sender() + " cannot view methods on ") + this()); if (def) ancs = [def]; else ancs = .(gen[1])(gen[2]) || [this()]; methods = #[]; for a in (ancs) { for m in (a.methods()) { if (tostr(m).(match)(fltr) != 0) { i = a.method_info(m); methods = methods.add_elem(i[5], [a, m, @i]); } } } return methods; }; public method .method_bytecode() { arg method; return (> method_bytecode(method) <); }; public method .rename_method() { arg now, new; (> .perms(sender()) <); (| $sys.touch() |); return (> rename_method(now, new) <); }; public method .examine() { return []; }; public method .new_descendants() { var kid, kids; kids = #[]; for kid in (children()) { kids = kids.add(kid, 1); kids = kids.union(kid.new_descendants()); pause(); } return kids.keys(); }; private method ._clean_root() { arg v, m; var obj, value; if ((value = get_var(v))) { value = value.valid_objects(); for obj in (value) { if (!(this() in obj.(m)())) value = value.setremove(obj); refresh(); } if (value) set_var(v, value); else clear_var(v); } }; private method .set_quota_exempt(): nooverride { arg bool; if (bool) quota_exempt = 1; else (| clear_var('quota_exempt) |); }; public method .help_node() { return help_node; }; public method .set_hnode() { arg node; (> .perms(sender(), 'manager) <); help_node = node; }; public method .list_method() { arg [args]; if (!(.has_flag('code, sender()))) throw(~perm, (("Method code on " + (.namef('ref))) + " is not readable by ") + (sender().namef('ref))); return (> list_method(@args) <); }; public method .new() { arg [suffix]; var obj, tmp, objname, mngr, na; // this difference between this and .spawn() is that you // can override this method to return a frob instead. (> .will_spawn(sender()) <); suffix = (> .get_obj_suffix(@suffix) <); return $sys.spawn_sender(suffix, sender()); }; public method .will_spawn(): nooverride { arg who; if (!(.has_flag('fertile, who))) throw(~perm, "Not fertile or readable."); // available quota? if (!(who.quota_valid())) throw(~quota, "Sender does not have the available quota"); }; public method .get_obj_suffix() { arg [suffix]; var objname, tmp; // Figure out the suffix from the arguments and child index. [(suffix ?= 0)] = suffix; if (suffix) { // so they dont confuse child_index: if (suffix.is_numeric()) throw(~perm, "You cannot specify a numeric suffix."); // so we get correct symbols & it is always lowercase: suffix = lowercase(strsed(suffix, "[^a-z0-9_]+", "", "g")); } else { // get the next valid objname objname = tostr((| .objname() |) || "unknown"); tmp = tosym(objname); while ((| lookup(tmp) |)) { child_index++; tmp = tosym((objname + "_") + tostr(child_index)); } suffix = tostr(child_index); } return suffix; }; object $sys: $root; var $sys admins = []; var $sys agents = [$root, $daemon]; var $sys startup = #[['time, 851214747], ['objects, [$login_daemon, $lag_watcher, $http_daemon, $smtp_daemon, $world]], ['heartbeat_interval, 5]]; var $sys starting = #[['quota, 75000], ['new_user_class, $admin], ['anonymous_user_class, $guest]]; var $sys server_address = ["129.123.4.76", "ice.cold.org"]; var $sys system_email_addresses = #[['default, "nobody@need.to.set.this.address"]]; var $sys core_version = "3.0a6"; var $sys validate_email_addresses = 1; var $sys backup = #[['interval, 3600], ['last, 851213220], ['next, 851218347], ['started, 851213221]]; var $sys system = [$sys, $root]; var $sys touched = 851214764; var $sys loggers = [$http_interface, $daemon, $user, $connection]; var $root created_on = 796268969; var $root inited = 1; var $root flags = ['methods, 'code, 'core, 'variables]; var $root quota_exempt = 1; var $root manager = $sys; var $sys bindings = #[['atomic, $sys], ['create, $sys], ['backup, $sys], ['shutdown, $sys], ['set_heartbeat, $sys], ['cancel, $scheduler], ['task_info, $scheduler], ['execute, $sys], ['bind_function, $sys], ['unbind_function, $sys], ['bind_port, $daemon], ['unbind_port, $daemon], ['open_connection, $connection], ['reassign_connection, $daemon], ['fopen, $file], ['fstat, $file], ['fchmod, $file], ['fmkdir, $file], ['frmdir, $file], ['files, $file], ['fremove, $file], ['frename, $file], ['fclose, $file], ['fseek, $file], ['feof, $file], ['fwrite, $file], ['fread, $file], ['fflush, $file], ['chparents, $root], ['destroy, $root], ['dblog, $sys], ['add_var, $root], ['del_var, $root], ['variables, $root], ['list_method, $root], ['add_method, $root], ['del_method, $root], ['method_bytecode, $root], ['methods, $root], ['rename_method, $root], ['set_method_access, $root], ['set_method_flags, $root], ['data, $root], ['del_objname, $root], ['set_objname, $root], ['suspend, $scheduler], ['resume, $scheduler], ['set_user, $user], ['config, $sys]]; var $sys blacklist = []; var $root managed = [$sys]; var $root owned = [$sys]; public method .next_objnum(): native; public method .version(): native; driver method .startup() { arg args; var opt, str, obj, f; if (args && ("-clean" in args)) { catch any (> .clean_database() <); with .log($parse_lib.traceback(traceback())); shutdown(); return; } catch any { // Bind functions for security for f in (bindings) { catch any bind_function(@f); with dblog((("** Unable to bind function " + (f[1])) + "() to ") + (f[2])); } // Set up five-second heartbeat. set_heartbeat(startup['heartbeat_interval]); // set the startup time, reset backup time. startup = startup.add('time, time()); backup = backup.add('next, time() + (backup['interval])); // tell objects who should know, that we are up. if (type(args) != 'list) args = []; for obj in (startup['objects]) { .log(("Calling " + obj) + ".startup()"); catch any (> obj.startup(@args) <); with .log($parse_lib.traceback(traceback())); } } with { .log(("Startup ERROR at " + ctime()) + ":"); .log(toliteral(traceback())); .log($parse_lib.traceback(traceback(), -1, "")); } }; public method .server_info() { arg what, [long]; var tmp; switch (what) { case 'up_time: return time() - (startup['time]); case 'startup_time: return startup['time]; case 'server_hostname: return $network.hostname(); case 'server_ip: return $network.ip(); case 'last_backup: return backup['last]; case 'driver_version: tmp = .version(); return (((((long ? "Cold Genesis " : "") + (tmp[1])) + ".") + (tmp[2])) + "p") + (tmp[3]); case 'core_version: return (long ? "ColdCore " : "") + core_version; default: throw(~unknown, "Unknown flag."); } }; public method .create_user() { arg name, password, email, [type]; var user; if ((!(| .perms(caller(), $login_interface) |)) && (!(| .perms(sender(), 'system) |))) throw(~perm, "Caller and Sender are not allowed to call this method."); [(type ?= 'new_user_class)] = type; catch any { user = (starting[type]).spawn(name); user.set_name(name); if (type == 'new_user_class) user.set_password(password); user.change_manager(user); user.set_user_info($user_info, "email", email); } with { // Failed to initialize the child; destroy it. if (!(| user.destroy() |)) { (| user.uninitialize() |); (| user.destroy() |); } rethrow(error()); } return user; }; public method .admins() { return admins; }; public method .is_admin() { arg obj; return (obj == $sys) || (obj in admins); }; public method .shutdown() { var opt, str, obj; (> .perms(sender(), $sys) <); // tell startup objects that we are closing shop for obj in (startup['objects]) { .log(("Calling " + obj) + ".shutdown()"); catch any (> obj.shutdown() <); with .log($parse_lib.traceback(traceback())); } return shutdown(); }; public method .spawn_sender() { arg suffix, manager; var namestr; (> .perms(caller(), $root, $sys) <); namestr = (tostr(sender().objname()) + "_") + suffix; return .create([sender()], tosym(namestr), manager); }; public method .is_system() { arg obj; return obj in system; }; public method .log() { arg text; var l; if ((!sender()) in loggers) { if ((!(| .perms(sender(), 'system) |)) && (!(| .perms(caller(), 'system) |))) throw(~perm, "Only system objects can log."); } if (type(text) == 'list) { for l in (text) .log(l); } else { dblog((("[" + ($time.format("%d %h %y %H:%M"))) + "] ") + text); } }; driver method .heartbeat() { if (sender() != 0) throw(~perm, "Sender is not the server."); (| $scheduler.pulse() |); if (time() > (backup['next])) .do_backup(this(), 'interval); }; public method .do_backup() { arg [args]; var line, who, how, name, dirty; (> .perms(sender(), 'system) <); dirty = .dirty(); [(who ?= sender()), (how ?= 'request)] = args; if (!valid(who)) who = sender(); backup = backup.add('next, time() + (backup['interval])); backup = backup.add('last, time()); if ((how == 'interval) && (!dirty)) return; catch any { name = who.namef('ref); .log(("BACKUP (" + name) + ") "); line = (("Backup started at " + ($time.format("%r"))) + " by ") + name; $channel_ui._broadcast('System, line); } // double pause will hopefully let people know about it before it happens pause(); pause(); backup = backup.add('started, time()); (> backup() <); }; public method .set_startup() { arg what, value; var valid; (> .perms(sender(), 'system) <); valid = startup.keys(); if ((!what) in valid) throw(~type, "Key must be one of " + toliteral(valid)); startup = startup.add(what, value); }; public method .get_system_email() { arg what; var email; // email directory for system services, such as arch admins. email = (| system_email_addresses[what] |) || ((| system_email_addresses['default] |) || "<no email set>"); return email; }; public method .new_admin() { if (caller() != $admin) throw(~perm, "Caller is not $admin."); admins = setadd(admins, sender()); }; public method .agents() { return agents; }; public method .get_startup() { arg what; return startup[what]; }; public method .set_starting() { arg what, value; var valid; (> .perms(sender(), 'system) <); valid = starting.keys(); if ((!what) in valid) throw(~type, "Key must be one of " + toliteral(valid)); starting = starting.add(what, value); }; public method .execute() { arg script, args, [background]; (> .perms(sender(), 'system) <); (> execute(script, args, @background) <); }; public method .get_starting() { arg what; return starting[what]; }; private method .create() { arg parents, name, manager; var new; new = create(parents); catch any { new.set_objname(name); new.initialize(); new.change_manager(manager); } with { // Failed to initialize the child; destroy it. if (!(| new.destroy() |)) { (| new.uninitialize() |); (| new.destroy() |); } rethrow(error()); } return new; }; public method .system() { return system; }; public method .del_system_email() { arg key; (> .perms(sender(), 'manager) <); system_email_addresses = system_email_addresses.del(key); }; public method .add_system_email() { arg key, email; (> .perms(sender(), 'manager) <); if (type(key) != 'symbol) throw(~type, "Key is not a symbol."); if (type(email) != 'string) throw(~type, "Email address is not a string."); system_email_addresses = system_email_addresses.add(key, email); }; public method .add_method() { arg code, name; var line; (> .perms(sender()) <); line = ("SYSTEM: ." + tostr(name)) + "() MODIFIED"; line = (line + " by ") + (sender().namef('ref)); .log(line); return (> pass(code, name) <); }; public method .atomic() { arg [args]; (> .perms(sender(), 'system) <); return (> atomic(@args) <); }; public method .add_to_blacklist() { arg domain, duration; (> .perms(sender(), 'system) <); blacklist = blacklist.setadd(domain); if (duration > 0) $scheduler.add_task(duration, 'del_from_blacklist, domain); }; public method .del_from_blacklist() { arg domain; (> .perms(sender(), 'system) <); blacklist = blacklist.setremove(domain); }; public method .validate_email_addresses() { return validate_email_addresses; }; public method .blacklist() { return blacklist; }; driver method .signal() { arg signal; var line; // the driver will send the following signals: // HUP -- driver will drop out of atomic mode and will flush i/o // USR2 -- driver does nothing // USR1 -- driver aborts all currently executing tasks, not suggested // QUIT -- For both of these the driver will shutdown after current // INT tasks finish their current execution frame. Note: do not // preempt tasks at this point as they will not resume. line = ("** Received Signal: " + signal) + " **"; (| $channel_ui._broadcast('System, line) |); if (sig in ['QUIT, 'INT]) { (| $channel_ui._broadcast('all, "******************************") |); (| $channel_ui._broadcast('all, "** IMMINENT SERVER SHUTDOWN **") |); (| $channel_ui._broadcast('all, "******************************") |); } }; root method .sender_going_away() { admins = admins.setremove(sender()); agents = agents.setremove(sender()); system = system.setremove(sender()); }; public method ._status(): native; bind_native .status() ._status(); public method .status() { return (> ._status() <) + [backup['interval], backup['last], backup['next]]; }; private method ._loop_for_core() { arg code; var obj; $root.add_method(code, '___coretmp); for obj in ($root.descendants()) { obj.___coretmp(); pause(); } $root.del_method('___coretmp); }; private method .initialize_core() { var obj; (| .clean_database() |); // reset child indices ._loop_for_core(["child_index = 0;"]); }; public method .clean_database() { var obj, p, c, cmd; (> .perms(caller()) <); // cleanup some of $root's messiness for obj in ($root.descendants()) { (| obj.clean_root() |); refresh(); } // rehash all command caches for obj in ($has_commands.descendants()) { if ((| obj.is_command_cache() |)) (| obj.purge_caches() |); refresh(); } // incase people are logged in, give back their caches :) // this does not update their local caches, that is only // done when they login. for obj in ((| $user_db.connected() |) || []) { for p in ((| obj.parents() |) || []) (| p.cache_init() |); refresh(); } // check user info (move'em home etc) for obj in ($user.descendants()) { if ((| (obj.home()) != (obj.location()) |)) (| obj.move_to(obj.home()) |); refresh(); } // validate all locations and location content's for obj in ($physical.descendants()) { (| obj.validate_contents() |); if (obj.has_ancestor($located)) { if ((!valid(obj.location())) || (!(obj in ((obj.location()).contents())))) obj.move_to((| obj.home() |) || $lost_and_found); } refresh(); } }; public method .blacklisted() { arg remote; var t; for t in (blacklist) { if (match_pattern(remote, t)) return 1; } return 0; }; public method .add_to_system() { arg obj; if (!(.is_admin(sender()))) throw(~perm, "Sender is not an admin."); if (!((obj in admins) || (obj in agents))) throw(~perm, "Object is not an agent or admin."); system = system.union([obj]); }; public method .del_from_system() { arg obj; if (!(.is_admin(sender()))) throw(~perm, "Sender is not an admin."); if (!((obj in admins) || (obj in agents))) throw(~perm, "Object is not an agent or admin."); system = system.setremove(obj); }; public method .touch() { touched = time(); }; public method .touched() { return touched; }; public method .backup() { return backup; }; public method .dirty() { return touched > (backup['last]); }; public method .do_shutdown() { arg [args]; var why, time, increments, line, name, mins; if ((!($sys.is_admin(sender()))) || (definer() != this())) throw(~perm, "Sender is not an admin."); [(time ?= 0), (why ?= "")] = args; increments = [600, 300, 180, 60]; while (increments && (time < (increments[1]))) increments = increments.delete(1); name = sender().namef('xref); .log(("*** SHUTDOWN called by " + name) + " ***"); if (why) { why = ("*** " + why) + " ***"; .log(why); } while (1) { if (!increments) { $channel_ui._broadcast('all, "*** SYSTEM SHUTDOWN ***"); break; } line = "*** SYSTEM SHUTDOWN IN "; mins = (increments[1]) / 60; line = ((line + tostr(mins)) + " MINUTE") + ((mins == 1) ? "" : "S"); line = ((line + " CALLED BY ") + name) + " ***"; $channel_ui._broadcast('all, line); if (why) $channel_ui._broadcast('all, why); $scheduler.sleep(increments[1]); increments = increments.delete(1); } return .shutdown(); }; public method .loggers() { return loggers; }; root method .core_sys(): nooverride { starting = dict_add(starting, 'new_user_class, $admin); system_email_addresses = #[['default, "nobody@need.to.set.this.address"]]; }; driver method .backup_done() { catch any { $channel_ui._broadcast('System, "Backup completed, executing filesystem cleanup..."); pause(); pause(); .execute("backup", []); } catch any $channel_ui._broadcast('System, "Backup completed, elapsed time " + ($time.elapsed(time() - (backup['started]), 'long))); backup = backup.del('started); }; private method .make_core() { arg ver; var obj, d, o, top, x, admin, tmp, name; // core rooms should be +core, and cant be destroyed // traverse the list inverseley, less unseen heirarchial shuffling d = $root.descendants(); top = listlen(d); core_version = ver; dblog(("** " + top) + " objects, destroying all non-core objects..."); catch any { for x in [1 .. top] { obj = d[(top - x) + 1]; (| obj.destroy() |); if (valid(obj)) { obj.change_manager(obj); for o in (obj.writers('literal)) { obj.del_writer(o); refresh(); } } refresh(); } // shutdown this task so that references can have // a chance to clear out, on destroyed objects. dblog("** done, suspending for new task **"); // do this the hard way, to be secure .add_var('TMP_HEARTBEAT_CODE, .list_method('heartbeat)); .add_method([".finish_core();"], 'heartbeat); } with { dblog("traceback: " + traceback()); } }; public method .task_info() { arg [args]; (> .perms(sender(), 'system) <); return (> task_info(@args) <); }; public method .destroy_sender() { // potential problem spot, but sometimes its needed // add core definer items to the list, if you want them to call it (> .perms(caller(), $exit, $connection, $connection_interface) <); (> sender().destroy() <); }; private method .finish_core() { // cleanup heartbeat .add_method(TMP_HEARTBEAT_CODE, 'heartbeat); .del_var('TMP_HEARTBEAT_CODE); // ok, finish up catch any { dblog("** corifying remaining objects"); $root.corify(); dblog("** cleaning database.."); .clean_database(); dblog("** shutting down.."); shutdown(); } with { dblog("traceback: " + traceback()); } }; public method .old_admin() { if (caller() != $admin) throw(~perm, "Caller is not $admin."); admins = setremove(admins, sender()); system = setremove(system, sender()); }; new object $foundation: $root; var $root child_index = 7; var $root fertile = 1; var $root trusted = []; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'fertile, 'core, 'variables]; var $root manager = $foundation; var $root managed = [$foundation]; var $root owned = [$foundation]; var $foundation edit_types = 0; public method .configure() { arg set; // This is for post-creation configuration of a VR object. It is used // to interactively configure the VR aspects and behaviour of an object. // It should be optional, any command hooking into confingure should check // for a -conf?igure option first (which would imply skipping configuration). // // Overriding methods should pass() first, giving priority to their // ancestors. The argument 'set' is a dictionary with symbol keys // defining what has been set. Use the definer's name + "_" + setting // as the name of the key ("name" on $has_name would be 'has_name_name). // If something is already in the set dictionary, do not re-set it // again (for instance, if the command hooking into configure accepted // the name of the object on it's command line it would put // 'has_name_name in the dictionary and $has_name.configure() would not // prompt for the name). // // "@skip" should always skip the setting, and not alter it. // if .prompt() returns 'aborted, throw ~abort. // (> .perms(sender()) <); return set; }; public method .environment() { return []; }; public method .match_environment() { arg str; var obj, env, found, match, target; if (!str) throw(~objnf, "No object specified.", str); str = str.strip_article(); // Handle special cases. if (str in ["me", "my"]) return this(); else if (((str[1]) == "$") || ((str[1]) == "#")) return (> $object_lib.to_dbref(str) <); else if (str in ["it", "him", "her"]) return (| .match_context(str) |) || throw(~context, ("I don't see " + str) + " here, do you?"); // Start matching found = []; env = .environment(); // special case ordinal references if ((match = $parse_lib.ordinal_reference(str))) return env.match_nth(@match); if ((match = $parse_lib.possessive_reference(str))) { if ((match[1]) == "me") obj = this(); else obj = (> env.match_object(match[1]) <); catch ~objnf, ~ambig { env = (| obj.contents() |) || []; if ((found = $parse_lib.ordinal_reference(match[2]))) return (> env.match_nth(@found) <); else return (> env.match_object(match[2]) <); } with { if (error() == ~objnf) throw(~objnf, (((obj.name()) + " does not have ") + ((match[2]).add_indefinite())) + "."); throw(~ambig, ((("\"" + str) + "\" can match ") + ((((traceback()[1])[3]).mmap('namef, 'ref)).to_english("", " or "))) + "."); } } else { catch ~objnf, ~ambig { return (> env.match_object(str) <); } with { if (error() == ~objnf) throw(~objnf, ("You do not see " + (str.add_indefinite())) + " anywhere."); throw(~ambig, ((("\"" + str) + "\" can match ") + ((((traceback()[1])[3]).mmap('namef, 'ref)).to_english("", " or "))) + "."); } } }; public method .local_to_environment() { arg obj; return obj in (.environment()); }; public method .get_edit_types() { return edit_types || []; }; public method .set_edit_types(): nooverride { arg t; (> .perms(sender()) <); if (t) edit_types = t; }; public method .all_edit_types(): nooverride { var i, l, t; l = []; for i in (.ancestors()) { if (type((| (t = i.get_edit_types()) |)) == 'list) l = l.union(i.get_edit_types()); } return l; }; new object $has_settings: $foundation; var $root child_index = 2; var $root fertile = 1; var $root manager = $has_settings; var $root inited = 1; var $root flags = ['methods, 'code, 'fertile, 'core, 'variables]; var $root created_on = 796268969; var $has_settings settings = #[]; var $has_settings defined_settings = #[]; var $has_settings local_settings = []; var $root managed = [$has_settings]; var $root owned = [$has_settings]; root method .uninit_has_settings() { settings = 0; defined_settings = 0; local_settings = 0; }; public method ._find_definers() { arg name, count, [begin]; var a, matches; // Find a definer for <name> // <count> is a number // 1 finds the first possible definer // 0 finds all // If <begin> is given cound a match_begin as a match matches = []; for a in (ancestors()) { if (a.has_ancestor($has_settings)) { if (a.defines_setting(name, begin)) { switch (count) { case 0: matches += [a]; case 1: return matches + [a]; default: matches += [a]; count = count - 1; } } } } return matches; }; public method .set_setting() { arg definer, name, value; var options; (> .perms(sender(), 'writers) <); if (type(name) != 'string) throw(~type, "name must be a string"); if (!definer) definer = ._find_setting_definer(name); options = definer.configure_setting(name); value = (> .((| options['check] |) || 'is_any)(definer, value, @(| options['check_args] |) || []) <); (> .((| options['set] |) || 'set_local_setting)(definer, name, value, sender(), @(| options['set_args] |) || []) <); if (!local_settings) local_settings = []; local_settings = local_settings.union([name]); }; public method .add_setting() { arg name, [options]; (> .perms(sender(), 'writers) <); if (type(name) != 'string) throw(~type, "name must be a string"); [(options ?= #[])] = options; if (!defined_settings) defined_settings = #[]; if (defined_settings.contains(name)) throw(~error, (this() + " already has a setting named ") + name); defined_settings = defined_settings.add(name, ._default_options()); .configure_setting(name, options); }; public method .defines_setting() { arg name; if (name in (defined_settings.keys())) return 1; return 0; }; public method .del_setting() { arg name; var k, m; (> .perms(sender(), 'writers) <); if (!(name in (defined_settings.keys()))) throw(~namenf, (name + " not defined on ") + this()); m = (defined_settings[name])['del]; defined_settings = defined_settings.del(name); for k in (.children()) (| k.m(this(), name) |); }; public method .is_boolean() { arg definer, value, [args]; if ((!value) || (value in ["y", "yes", "true", "t", "1", "on"])) return 1; return 0; }; public method .get_inherited_setting() { arg name, definer, [args]; var sets, a; for a in (.ancestors()) { if ((a.has_ancestor(definer)) && (a.local_settings(definer))) return a.get_local_setting(definer, name); } return 0; }; public method .get_indirect_setting() { arg name, definer, args; var fname, val; fname = ._to_fullname(name, definer); if (fname in (setting_data.keys())) { val = setting_data[fname]; if (type(val) == 'objnum) return (> (setting_data[fname]).get_setting(spec, definer, args) <); else return setting_data[fname]; } else { return (definer.setting_data())[fname]; } }; public method .setting() { arg name, [definer]; var sets, options; [(definer ?= 0)] = definer; if (type(name) != 'string) throw(~type, "name must be a string"); if ((type(definer) != 'objnum) && (definer != 0)) throw(~type, "definer must be zero or a dbref"); if ((!name) && (!definer)) throw(~huh, "definer must be non-zero or name must be given"); if (!definer) { definer = ._find_setting_definer(name); if (!definer) throw(~definernf, "No definer could be found for " + name); } else if (!name) { sets = #[]; for name in (definer.defined_settings()) { options = definer.configure_setting(name); sets = sets.add(name, .((| options['get] |) || 'get_local_method)(name, definer, @(| options['get_args] |) || [])); } return sets; } options = definer.configure_setting(name); catch ~keynf (> .(options['access_check])(name, sender()) <); return (> .((| options['get] |) || 'get_local_setting)(name, definer, @(| options['get_args] |) || []) <); }; public method .default_setting_info() { return #[['type, "string"], ['check, 'is_anything], ['get, 'get_direct_setting], ['set, 'set_direct_setting], ['del, 'del_direct_setting], ['set_args, ['name, 'definer, 'value, 'style]], ['get_args, ['name, 'definer]]]; }; public method ._find_setting_definer() { arg name; var a; for a in (.ancestors()) { if ((a.has_ancestor(definer())) && (name in (a.defined_settings()))) return a; } throw(~definernf, ((("Unable to find setting " + toliteral(name)) + " on ") + (.name())) + "."); }; public method ._default_options() { return #[['get, 'get_local_setting], ['set, 'set_local_setting], ['check, 'is_any], ['del, 'delete_local_setting], ['check_args, []], ['get_args, []], ['set_args, []]]; }; public method .configure_setting() { arg name, [options]; var o, new; if (type(name) != 'string) throw(~type, "name must be a string."); if (options) { options = options[1]; if (type(options) != 'dictionary) throw(~type, "options must be a dictionary."); } else { options = #[]; } if (!dict_contains(defined_settings, name)) throw(~namenf, (("Setting " + name) + " is not defined on ") + this()); if (!options) return defined_settings[name]; // Iterate through the options and make changes. (> .perms(sender(), 'writers) <); new = defined_settings[name]; for o in (options.keys()) new = new.add(o, options[o]); defined_settings = defined_settings.add(name, new); }; public method .defined_settings() { return (| defined_settings.keys() |) || []; }; public method .delete_local_setting() { arg definer, name; var sets; (> .perms(sender(), this()) <); sets = (| defined_settings[definer] |) || #[]; sets = (| sets.del(name) |) || sets; defined_settings = sets; }; public method .is_any() { arg definer, value, [args]; return value; }; protected method .set_local_setting() { arg definer, name, value, [args]; var sets; if (!settings) settings = #[]; sets = (| settings[definer] |) || #[]; sets = sets.add(name, value); settings = settings.add(definer, sets); }; public method .get_local_setting(): nooverride { arg name, definer, [args]; return (| (settings[definer])[name] |) || throw(~setting, ("Setting \"" + name) + "\" has not been defined."); }; root method .init_has_settings() { defined_settings = #[]; local_settings = #[]; settings = #[]; }; public method .settings() { var a, out, s; //returns all settings available on this object out = #[]; for a in (.ancestors()) { if (a == definer()) break; s = (| a.defined_settings() |) || []; if (s) out = out.add(a, s); } return out; }; public method .is_list_of() { arg definer, value, type; var out, element; switch (type(value)) { case 'string: if (((value[1]) != "[") || ((value.last()) != "]")) throw(~type, "value is not parsable as a list."); value = (value.subrange(2, (value.length()) - 2)).explode(","); .debug(value); out = []; for element in (value) out += [.is_type(definer, element.strip(" "), type)]; return out; case 'list: out = []; for element in (value) out += [.is_type(definer, element, type)]; return out; default: throw(~type, "value is not parsable as list."); } }; public method .is_type() { arg definer, value, type; if (type(value) == type) return value; switch (type) { case 'string: return toliteral(value); case 'integer: if (value.is_numeric()) return toint(value); else throw(~type, "Value is unparseable as integer."); case 'objnum: return $object_lib.to_dbref(value); default: return value; } }; public method .local_setting() { arg [definer]; [(definer ?= 0)] = definer; if (definer) return (| local_settings[definer] |) || []; return local_settings; }; public method .local_settings() { arg [definer]; [(definer ?= 0)] = definer; if (definer) return (| local_settings[definer] |) || []; return local_settings; }; public method .display_setting() { arg name, [definer]; var sets, options, s; (> .perms(sender(), 'trusts) <); [(definer ?= 0)] = definer; if (type(name) != 'string) throw(~type, "name must be a string"); if ((type(definer) != 'objnum) && (definer != 0)) throw(~type, "definer must be zero or a dbref"); if ((!name) && (!definer)) throw(~huh, "definer must be non-zero or name must be given"); if (!definer) { definer = ._find_setting_definer(name); if (!definer) throw(~definernf, "No definer could be found for " + name); } else if (!name) { sets = #[]; for name in (definer.defined_settings()) { options = definer.configure_setting(name); catch ~keynf .(options['access_check])(sender()); s = .((| options['get] |) || 'get_local_method)(name, definer, @(| options['get_args] |) || []); sets = sets.add(name, (| .(options['display])(s) |) || s); } return sets; } options = definer.configure_setting(name); s = (> .((| options['get] |) || 'get_local_setting)(name, definer, @(| options['get_args] |) || []) <); catch any { return (> .(options['display])(s) <); } with { if (type(s) == 'objnum) return s.namef('ref); else return toliteral(s); } }; public method .display_boolean_yes_no() { arg value; if (value) return "yes"; else return "no"; }; public method .display_boolean_on_off() { arg value; if (value) return "on"; else return "off"; }; public method .get_local_setting_boolean() { arg name, definer, [args]; return (| (settings[definer])[name] |) || 0; }; public method .get_defined_settings() { return defined_settings; }; new object $has_name: $has_settings; var $root child_index = 11; var $root fertile = 1; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'fertile, 'core, 'variables]; var $has_name name = ['normal, "named object", "a named object"]; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $root manager = $has_name; var $has_name templates = 0; var $root owned = [$has_name]; var $root managed = [$has_name]; public method .set_name() { arg new_name, [args]; var type; (> .perms(sender()) <); if (new_name && ((new_name[1]) in ["$", "#"])) throw(~invname, "Names cannot begin with \"$\" or \"#\"."); if (type(new_name) != 'string) throw(~type, "New name must be given as a string."); // this will not catch them all, but we can try. if (new_name.match_regexp("^(a|an|the) +")) throw(~bad_name, "Do not include articles in name, use +u +n or +pinstead."); [(type ?= 'normal)] = args; if (!(type in ['prop, 'normal, 'uniq])) throw(~invarg, "Type must be one of: 'prop, 'normal or 'uniq"); switch (type) { case 'prop: new_name = [new_name, new_name]; case 'uniq: new_name = [new_name, "the " + new_name]; case 'normal: new_name = [new_name, new_name.add_indefinite()]; } name = [type, @new_name]; }; public method .match_name() { arg str; var m, t; if ((m = match_begin(name[2], str))) return m; for t in (templates || []) { if ((m = match_template(str, t))) return m; } return 0; }; public method .name() { arg [args]; if (!name) return tostr(this()); if (!args) return name[3]; switch (args[1]) { case 'type: return name[1]; case 'noarticle: return name[2]; default: return name; } }; public method .name_templates() { return templates || []; }; public method .namef() { arg type; switch (type) { case 'ref: return (((.name()) + " (") + this()) + ")"; case 'xref: return ((this() + " (") + (.name())) + ")"; case 'name: return .name(); default: return (> pass(type) <); } // $# Edited 28 Oct 1995 21:06 Lynx ($lynx) }; public method .hname() { arg [args]; return ((("<a href=\"/bin/describe?target=" + (.objname())) + "\">") + (.name())) + "</a>"; }; public method .add_name_template() { arg template; (> .perms(sender()) <); templates = setadd(templates || [], template); }; public method .del_name_template() { arg template; (> .perms(sender()) <); templates = setremove(templates || [], template); if (!templates) (| clear_var('templates) |); }; public method .init_has_name() { var objname; objname = tostr(.objname()); name = ['prop, tostr(objname), tostr(objname)]; }; new object $has_commands: $foundation; var $root fertile = 1; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'fertile, 'core, 'variables]; var $root child_index = 4; var $has_commands shortcuts = #[]; var $has_commands local = 0; var $has_commands remote = 0; var $root manager = $has_commands; var $root managed = [$has_commands]; var $root owned = [$has_commands]; public method .add_command() { arg template, method, [type]; var cmd, types, count, x; (> .perms(sender()) <); [(type ?= 'local)] = type; if ("*" in template) throw(~invcmd, "Invalid command, command templates cannot contain \"*\"!."); cmd = (> $command_lib.validate_command_template(template) <); if (!(type in ['local, 'remote])) throw(~type, "Command types can be either 'local or 'remote"); if ('this in (((cmd[2]).values()).slice(1))) type = 'remote; if (type == 'remote) { for x in (((cmd[2]).values()).slice(1)) { if (x == 'this) count++; } if (!count) throw(~add_command, "Command type defined as remote with no <this> argument."); else if (count > 1) throw(~add_command, "More than one <this> argument specified in template."); } if (!get_var(type)) set_var(type, #[]); set_var(type, get_var(type).setadd_elem((cmd[1])[1], [@cmd[1], template, method, cmd[2]])); }; public method .all_local_commands() { var cmds, a, acmds; cmds = #[]; for a in (ancestors()) { if (a == definer()) break; if ((acmds = (| a.local_commands() |))) cmds = cmds.add(a, acmds); } return cmds; }; public method .local_commands() { return local || #[]; }; public method .get_command_info() { arg type, cmd; var info, a, ainfo; info = []; for a in (ancestors()) { if (a == definer()) break; if ((ainfo = (| a.command_info(type, cmd) |))) info = info.union(ainfo); } return info; }; public method .del_command() { arg template, method; var cmd, c, d, info, type; (> .perms(sender()) <); cmd = template.explode(); if (!cmd) throw(~type, "Invalid template."); cmd = cmd[1]; info = #[['local, .get_command_info('local, cmd)]]; info = info.add('remote, .get_command_info('remote, cmd)); for type in (info) { for c in (type[2]) { if (((c[3]) == template) && ((c[4]) == method)) { set_var(type[1], get_var(type[1]).del_elem(cmd, c)); d++; } } } return d; }; public method .remote_commands() { return remote || #[]; }; root method .init_has_commands() { local = (remote = (shortcuts = #[])); }; root method .uninit_has_commands() { .clear_variables(@.variables()); }; public method .add_shortcut() { arg shortcut, template, method; var relation; (> .perms(sender()) <); if ((type(shortcut) != 'string) || (type(template) != 'string)) throw(~type, "Both shortcut and template must be strings."); if (type(method) != 'symbol) throw(~type, "Method must be submitted as a symbol."); relation = (> $command_lib.parse_relation(shortcut, template) <); shortcut = (relation[1])[1]; relation = (relation[2])[2]; if (!shortcuts) shortcuts = #[]; shortcuts = shortcuts.add(shortcut, [method, relation]); }; public method .del_shortcut() { arg shortcut; var value; (> .perms(sender()) <); value = (| shortcuts.del(shortcut) |); if (type(value) != 'dictionary) throw(~shortcutnf, ("Shortcut \"" + shortcut) + "\" is not defined on this object."); shortcuts = value; }; public method .all_shortcuts() { var s, a, as; s = []; for a in (ancestors()) { if (a == definer()) break; if ((as = (| a.shortcuts() |))) s += as.to_list(); } return s; }; public method .get_shortcut_info() { arg shortcut; return (| shortcuts[shortcut] |) || throw(~shortcutnf, ("Shortcut \"" + shortcut) + "\" is not defined on this object.", shortcut); }; public method .shortcuts() { return shortcuts || #[]; }; public method .command_info() { arg type, cmd; return (| get_var(type)[cmd] |) || throw(~cmdnf, ("Command \"" + cmd) + "\" is not defined on this object.", cmd); }; public method .all_remote_commands() { var cmds, a, acmds; cmds = #[]; for a in (ancestors()) { if (a == definer()) break; if ((acmds = (| a.remote_commands() |))) cmds = cmds.add(a, acmds); } return cmds; }; new object $described: $has_name, $has_commands; var $described prose = []; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'variables, 'core]; var $has_name name = ['uniq, "Generic Described Object", "the Generic Described Object"]; var $has_commands shortcuts = #[]; var $has_commands remote = #[]; var $root manager = $described; var $root owned = [$described]; var $foundation edit_types = ["prose"]; var $root managed = [$described]; root method .init_described() { prose = []; }; protected method .description() { arg flags; var out, name; out = (<$ctext_frob, [[(<$format, ["subj", [], [.name()], 'do_subj]>)], #[]]>); if ((| flags['prose] |)) return [out, .prose()]; return [out]; }; public method .prose() { arg [no_default]; return prose || (no_default ? 0 : "You see nothing special"); }; public method .set_prose() { arg new; (> .perms(sender()) <); switch (type(new)) { case 'string, 'list: new = (> $compiler.compile_cml(new) <); case 'frob: // we'll let this pass by unharmed default: throw(~invalid, "Prose can be submitted as CML or Ctext"); } prose = new; }; root method .uninit_described() { prose = 0; }; public method .get_description(): nooverride { arg [dflags]; var flags, f; flags = #[['prose, 1], ['actor, sender()]]; if (dflags && (type(dflags[1]) == 'dictionary)) { dflags = dflags[1]; for f in (dflags.keys()) flags = dict_add(flags, f, dflags[f]); } return .description(flags); }; public method .edit_prose() { var p; (> .perms(sender()) <); p = .prose(); if (type(p) == 'frob) p = p.uncompile(); (> sender().invoke_editor(this(), '_edit_prose_callback, p, []) <); }; public method ._edit_prose_callback() { arg text, client_data; (> .perms(sender()) <); .set_prose(text); return "Description set."; }; public method .configure() { arg set; var p, end, ctext, s, still, type; set = (> pass(set) <); s = sender(); still = ("Do you still want to describe " + (.name())) + "? [no] "; if (!(set.contains('described_prose))) { while (!end) { if (.is($exit)) type = "exit "; else if (.is($place)) type = "place "; else type = ""; p = s.read((("Describe " + type) + (.name())) + ", Enter \".\" to finish or \"@abort\" to abort description."); if (p == 'aborted) { end = !(s.prompt_yesno(still, 0)); } else { catch any { ctext = (> $compiler.compile_cml(p) <); s.tell(["You submitted the following description:", ""]); s.tell(ctext); s.tell(""); if (!(end = s.prompt_yesno("Keep this description? [yes] "))) ctext = 0; } with { s.tell(["The following CML compiler error occurred:", " ", (traceback()[1])[2]]); end = !(s.prompt_yesno(still, 0)); } } } if (ctext) .set_prose(ctext); set = set.add('described_prose, 1); } return set; }; public method .get_detail() { arg name; var details, d, matches; details = (| (.prose()).get_var('details) |); if (!details) throw(~nodetail, ("No \"" + name) + "\" in your environment."); matches = []; for d in (details.keys()) { if (match_begin(d, name)) matches += [d]; } if (!matches) throw(~nodetail, ("No \"" + name) + "\" in your environment."); if (listlen(matches) != 1) throw(~ambig, (("\"" + name) + "\" can match ") + (matches.to_english())); return (<$ctext_frob, [details[matches[1]], #[['this, this()]]]>); }; new object $has_gender: $has_name; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'variables, 'core]; var $has_gender gender = 0; var $has_name name = ['uniq, "The Generic Gendered Object", "the The Generic Gendered Object"]; var $has_settings defined_settings = #[["gender", #[['get, 'gender], ['set, 'set_gender], ['check, 'check_gender], ['del, 'delete_local_setting], ['check_args, []], ['get_args, []], ['set_args, []]]]]; var $root manager = $has_gender; var $root managed = [$has_gender]; var $root owned = [$has_gender]; public method .gender_context() { return gender.pronoun('po); }; root method .init_has_gender() { gender = $gender_neuter; }; public method .set_gender() { arg definer, name, value, [args]; (sender() != this()) && (> .perms(sender(), 'manager) <); gender = value; }; public method .gender() { arg [args]; return gender; }; new object $has_messages: $foundation; var $root fertile = 1; var $root manager = $has_messages; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'fertile, 'core, 'variables]; var $has_messages messages = 0; var $has_messages message_info = 0; var $root managed = [$has_messages]; var $root owned = [$has_messages]; var $foundation edit_types = ["messages"]; public method .add_message() { arg name; (> .perms(sender(), 'writer) <); if (type(name) != 'string) throw(~type, "Name must be a string"); if (!messages) messages = #[]; if (!message_info) message_info = #[]; message_info = message_info.add(name, #[]); }; public method .message_info() { arg name, field; var m; ((| (m = message_info[name]) |) != ~keynf) || throw(~messagenf, ("Message " + name) + " is not defined here."); switch (field) { case 'evaluator: return (| m['evaluator] |) || $bs_eval; case 'compiler: return (| m['compiler] |) || $compiler; case 'uncompiler: return (| m['uncompiler] |) || $uncompiler; default: throw(~fieldnf, "Invalid field."); } }; public method .set_message_info() { arg name, field, value; var m; ((| (m = message_info[name]) |) != ~keynf) || throw(~messagenf, ("Message " + name) + " is not defined here."); m = m.add(field, value); message_info = message_info.add(name, m); }; public method .message_parts() { arg name; return (| (message_info[name])[4] |) || []; }; public method .evalutor() { arg name; return (defined_messages[name])[1]; }; public method .set_evaluator() { arg name, evaluator; var current; .perms(sender(), 'writer); current = defined_messages[name]; current = current.replace(1, evaluator); .set_message_info(name, current); }; public method .defines_message() { arg name; var n; // returns 1 if the message <name> is defined here. if (message_info) return ((| message_info[name] |) != ~keynf) ? 1 : 0; return 0; }; public method .del_message() { arg name; var mess, kids; (> .perms(sender(), 'writer) <); message_info = message_info.del(name); }; public method .local_messages() { return messages || #[]; }; public method .messages() { var all_messages, a, a_messages, d_messages, d, m, my_d; // return all messages set on this() or parents // a : on eancestor // all_messages: the sum total of message // a_messages: messages from ancestor a // d: the definer of a message // d_messages: messages from ancestor a, defined on d // m: a specific message // my_d: messags from definer d that have already been found. all_messages = #[]; for a in (.ancestors()) { if (a == definer()) break; if (a.has_ancestor(definer())) { a_messages = a.local_messages(); for d in (a_messages.keys()) { d_messages = a_messages[d]; my_d = (| all_messages[d] |) || #[]; for m in (d_messages.keys()) { if ((| my_d[m] |) == ~keynf) my_d = my_d.add(m, d_messages[m]); } all_messages = all_messages.add(d, my_d); } } } return all_messages; }; public method .local_message() { arg name, [definer]; var d; if (messages) { if (!definer) { for d in (messages.keys()) { catch ~keynf return (messages[d])[name]; } } else { catch ~keynf return (messages[definer[1]])[name]; } } throw(~messagenf, "Message was not found."); }; public method .prep_evaluator() { arg name; .perms(sender(), 'writers); return (.messaage_info(name))[2]; // 9-26-95/19:57 Jeff ($jeff), moved from $has_messages.prep_evalutor }; public method .message() { arg name, [definer]; var a, message, mes, m; //retrieve the specified message as ctext if (definer) definer = definer[1]; else definer = (._find_message_definer(name))[2]; message = $message_frob.new(); for a in (.ancestors()) { catch ~methodnf, ~messagenf return a.local_message(name, definer); } throw(~messagenf, "No matching message."); }; public method .set_message() { arg name, message, [definer]; var mes, partial, compiler; (> .perms(sender(), 'writer) <); [(definer ?= ._find_message_definer(name))] = definer; [partial, definer] = definer; if (!messages) messages = #[]; mes = (| messages[definer] |) || #[]; compiler = definer.message_info(partial, 'compiler); message = compiler.compile_cml(message); messages = messages.add(definer, mes.add(name, message)); }; public method .local_matching_messages() { arg name, [definer]; var n, matches, d; matches = []; if (definer) { for n in ((messages[definer]).keys()) { if ($string.match_begin(n, name)) matches += [n]; } } else { for d in (messages.keys()) { for n in ((messages[d]).keys()) { if ($string.match_begin(n, name)) matches += [n]; } } } return matches; }; public method .matching_messages() { arg name, definer; var mes, a, m, len, messages, found, anc, mname; mes = $message_frob.new(); found = #[]; //if (messages) // return mes; mname = name + "."; len = mname.length(); anc = .ancestors(); a = $has_messages in anc; anc = anc.subrange(1, a - 1); for a in (anc) { messages = (| (a.local_messages())[definer] |) || #[]; for m in (messages.keys()) { if ((m == name) && ((| found[m] |) == ~keynf)) mes = mes.add_entry("general", messages[m]); else if (($string.match_begin(m, mname)) && ((| found[m] |) == ~keynf)) mes = mes.add_entry(m.subrange(len + 1), messages[m]); found = found.add(m, 1); } } return mes; }; public method ._del_message() { arg name; var mess; mess = messages[sender()]; mess = mess.del(name); messages = messages.add(sender(), mess); }; public method ._find_message_definer() { arg name; var a, pos, name2; pos = name.rindex("."); if (pos) name2 = name.subrange(1, pos - 1); for a in (.ancestors()) { catch ~methodnf { if (a.defines_message(name)) return [name, a]; else if (a.defines_message(name2)) return [name2, a]; } } throw(~definernf, ("Could not find definer for " + name) + "."); }; public method .eval_message() { arg name, vars, [definer]; var message, partial; if (!definer) { [partial, definer] = ._find_message_definer(name); } else { partial = name; definer = definer[1]; } vars = vars.add('evaluator, definer.message_info(partial, 'evaluator)); message = .matching_messages(partial, definer); if (message == (<$message_frob, #[]>)) message = $message_frob.new_with(#[["general", .message(partial, definer)]]); message = message.set_vars(vars); return message.eval_ctext(vars.add('time, 'pre)); }; root method .uninit_has_messages() { messages = 0; defined_messages = 0; }; public method ._del_message_part() { arg name, part; var m, mess; .debug(sender(), name, part); if (messages && (sender() in (messages.keys()))) { mess = messages[sender()]; .debug(mess); if (name in (mess.keys())) { m = mess[name]; .debug(m); m = m.del_entry(part); .debug(m); mess = mess.add(name, m); messages = messages.add(sender(), mess); } } }; public method .unset_message() { arg message, definer; var mes; mes = (| messages[definer] |) || #[]; (> (mes = mes.del(message)) <); messages = messages.add(definer, mes); }; public method .set_var() { arg this, name, value; var vars; vars = this[2]; vars = vars.add(name, value); return (<this(), [this[1], vars]>); }; public method .set_vars() { arg this, new; var vars, key; vars = this[2]; for key in (new) vars = vars.add(key, new[key]); return (<this(), [this[1], vars]>); }; public method .edit_messages() { var msg, s; (> .perms((s = sender())) <); msg = (s.display_messages("", this())).flatten(); (> s.invoke_editor(this(), '_edit_messages_callback, msg, []) <); }; public method ._edit_messages_callback() { arg text, client_data; var errors, i, m, def; (> .perms(sender()) <); for i in (text) { if (i.trim()) { if ((m = i.match_pattern("$* (*):"))) { sender().tell("Compiling messages defined for $%s (%s).".format(m[1], m[2])); def = $object_lib.to_dbref(m[1]); } else if ((m = i.match_pattern("$*:"))) { sender().tell("Compiling messages defined for $%s.".format(m[1])); def = $object_lib.to_dbref(m[1]); } else if ((m = i.match_pattern("*=*"))) { sender().set_message((m[1]).trim(), (m[2]).trim(), def); } else { sender().tell("Could not parse `%s`.".format(i)); } } } }; new object $event_handler: $foundation; var $root manager = $event_handler; var $root managed = [$event_handler]; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 850790316; var $root inited = 1; var $event_handler hooks = 0; var $event_handler hooked = 0; var $event_handler events = 0; root method .uninit_event_handler() { var e, o; for e in ((hooks || #[]).keys()) (| o.event_hook_removed(e) |); (| (.location()).unhook_from_all() |); }; public method .clear_event_hook() { arg event; var o; (> .perms(sender(), 'writer) <); if ((!hooks) || (!(hooks.contains(event)))) return; for o in (hooks[event]) (| o.event_hook_removed(event) |); hooks = dict_del(hooks, event); if (!hooks) { (| clear_var('hooks) |); (| clear_var('hooked) |); } }; public method .event_hooks() { if (hooks) return dict_keys(hooks); return []; }; public method .hook_into_event() { arg event; if (!hooks) hooks = #[]; (> .will_hook(event, sender()) <); hooks = dict_add(hooks, event, setadd((| hooks[event] |) || [], sender())); hooked = (hooked || #[]).setadd_elem(sender(), event); (| .did_hook(event, sender()) |); }; public method .unhook_from_event() { arg event; if (!hooks) return; hooks = dict_add(hooks, event, setremove(hooks[event], sender())); hooked = hooked.del_elem(sender(), event); }; public method .unhook_from_all() { var e; if ((!hooked) || (!(hooked.contains(sender())))) return; for e in (hooked[sender()]) hooks = dict_add(hooks, e, setremove(hooks[e], sender())); hooked = dict_del(hooked, sender()); }; protected method .will_hook() { arg event, obj; }; protected method .did_hook() { arg event, obj; }; public method .send_event() { arg event, [args]; var o; // some sort of perms checking.. if ((!hooks) || (!(hooks.contains(event)))) return; for o in (hooks[event]) { if (!valid(o)) { hooks = dict_add(hooks, event, setremove(hooks[event], o)); hooked = hooked.del_elem(o, event); } (| o.event_notify(event, sender(), @args) |); } }; public method .event_notify() { arg event, origin, [args]; if (caller() != $event_handler) throw(~perm, caller() + " is not $event_handler."); }; public method .event_hook_removed() { arg event; (> .perms(caller(), $event_handler) <); }; public method .deregister_event() { arg event, update_on; var value; (> .perms(sender()) <); if ((events.contains(update_on)) && ((events[update_on]).contains(event))) { value = (events[update_on]).del(event); if (value) events = events.add(update_on, value); else events = events.del(update_on); if (!events) clear_var('events); } }; public method .hook_events() { arg type; var status, source, event, l, all; if (events && (events.contains(type))) { all = events[type]; events = events.del(type); l = .location(); for event in (all) { [event, [status, source]] = event; switch (source) { case 'location: l.hook_into_event(event); case 'this: .hook_into_event(event); default: source.hook_into_event(event); } all = all.add(event, [1, source]); } events = events.add(type, all); } }; public method .register_event() { arg event, update_on, src; var value, all; (> .perms(sender()) <); if (!events) events = #[]; if ((update_on != 'move) && (update_on != 'startup)) throw(~type, "Update on must be either 'move or 'startup"); if (type(src) == 'symbol) { if ((src != 'location) && (src != 'this)) throw(~type, "Source types must be either 'location or 'this."); } else if (type(src) != 'object) { throw(~type, "Source type must be either a symbol or object."); } else if (!(src.is($event_handler))) { throw(~type, ("Source " + (src.namef('ref))) + " is not an event handler."); } if (events.contains(update_on)) { all = events[update_on]; if ((events[update_on]).contains(event)) { value = replace(all[event], 2, src); events = events.add(update_on, all.add(event, value)); } else { events = events.add(update_on, all.add(event, [0, src])); } } else { events = events.add(update_on, #[[event, [0, src]]]); } }; public method .unhook_events() { arg type, [loc]; var all, event, status, source; if (events && (events.contains(type))) { all = events[type]; events = events.del(type); loc ? loc[1] : (.location()); for event in (all) { [event, [status, source]] = event; switch (source) { case 'location: loc.unhook_from_event(event); case 'this: .unhook_from_event(event); default: source.hook_into_event(event); } all = all.add(event, [0, source]); } events = events.add(type, all); } }; new object $physical: $described, $has_gender, $has_messages, $event_handler; var $root trusted = []; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'variables, 'core]; var $described prose = []; var $has_gender gender = $gender_neuter; var $physical visibility = 0; var $has_name name = ['uniq, "Generic Physical Object", "the Generic Physical Object"]; var $has_settings defined_settings = #[["visibility", #[['get, 'visibility], ['set, 'set_visibility], ['check, 'is_type], ['del, 'delete_local_setting], ['check_args, ['integer]], ['get_args, []], ['set_args, []]]]]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $root manager = $physical; var $root owned = [$physical]; var $root managed = [$physical]; public method .set_visibility() { arg definer, name, value, [args]; (> .perms(sender()) <); visibility = value; }; public method .visibility() { arg [args]; return visibility; }; public method .is_visible_to() { arg whom; return (.visibility()) >= ((whom.location()).darkness()); }; public method .set_darkness() { arg definer, name, value, [args]; (> .perms(sender()) <); darkness = value; }; public method .vr_examine(); new object $located: $physical; var $located inited = 0; var $located location = $lost_and_found; var $located obvious = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'variables, 'core]; var $has_gender gender = $gender_neuter; var $described prose = []; var $has_name name = ['uniq, "Generic Located Object", "the Generic Located Object"]; var $root manager = $located; var $root child_index = 1; var $root managed = [$located]; var $root owned = [$located]; root method .init_located() { location = $void; location.add_sender_to_contents(); obvious = 1; }; public method .uninit() { if (caller() != $root) throw(~perm, "Caller is not root."); location.del_sender_from_contents(); location = 0; }; public method .environment() { return [this()] + ((location.environment()).setremove(this())); }; public method .match_environment() { arg str; var thing, matches; if (str == "here") return location; return (> pass(str) <); }; public method .location() { return location || $void; }; public method .will_move() { arg mover, place; }; protected method .did_move() { arg mover, old_place; // cleanup events .unhook_events('move, old_place); location.send_event('movement, 'arrive); .hook_events('move); }; public method .realm() { return realm; }; root method .uninit_located() { (.location()).del_sender_from_contents(); }; public method .move_to() { arg place; var old; // Don't do anything if we're already here. if (place == location) return; if (!(place.has_ancestor($location))) throw(~type, "Argument is not a location."); // Notify involved parties of impending move, allowing them to throw // errors. if (!valid(location)) location = $nowhere; (> .will_move(sender(), place) <); (> location.will_leave(place) <); (> place.will_arrive(location) <); // Set location. old = location; location = place; old.del_sender_from_contents(); place.add_sender_to_contents(); // Notify involved parties of completed move, in reverse order. place.did_arrive(old); old.did_leave(place); .did_move(sender(), old); }; public method .match_environment_all() { arg s; if (s == "here") return [location, @(> pass(@args) <)]; else return (> pass(s) <); }; public method .obvious() { return obvious; }; public method .set_obvious() { arg obv; .perms(sender()); obvious = obv; }; public method .realm_name() { arg [args]; return (.location()).realm_name(@args); }; public method .is_obvious_to() { arg whom; // will later do something creative here return 1; }; new object $thing: $located; var $root child_index = 169; var $root fertile = 1; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'fertile, 'variables, 'core]; var $located location = $void; var $located obvious = 1; var $has_gender gender = $gender_neuter; var $described prose = []; var $has_name name = ['normal, "thing", "a thing"]; var $has_commands shortcuts = #[]; var $has_commands remote = #[["@lock", [["@lock", "* with|to *", "@lock <this> with|to <any>", 'lock_with_cmd, #[[1, ['this, []]], [3, ['any, []]]]], ["@lock", "*", "@lock <this>", 'lock_cmd, #[[1, ['this, []]]]]]], ["@unlock", [["@unlock", "*", "@unlock <this>", 'unlock_cmd, #[[1, ['this, []]]]]]], ["@boot", [["@boot", "*", "@boot <this>", 'boot_cmd, #[[1, ['this, []]]]]]]]; var $has_commands local = #[]; var $thing lock = <$true_lock_frob, []>; var $has_settings defined_settings = #[["home", #[['get, 'home], ['set, 'set_local_setting], ['check, 'check_home], ['del, 'delete_local_setting], ['check_args, []], ['get_args, []], ['set_args, []]]]]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $root manager = $thing; var $root owned = [$thing]; var $root managed = [$thing]; public method .boot_cmd() { arg cmdstr, cmd, this; var loc, dest, exit; loc = .location(); if (!(| .perms(sender(), 'manager) |)) { .tell((((sender().name()) + " tried to boot you from ") + (loc.name())) + "!"); loc.announce((((((sender().name()) + " tried to boot ") + (.name())) + " from ") + (loc.name())) + "!", sender(), this()); return ((("Only " + ((loc.manager()).name())) + " can boot people from ") + (loc.name())) + "!"; } dest = .home(); catch any { sender().tell(("You boot " + (.name())) + "."); loc.announce((((((sender().name()) + " boots ") + (.name())) + " from ") + ((.location()).name())) + ".", this(), sender()); if ((sender().location()) != loc) (sender().location()).announce((((((sender().name()) + " boots ") + (.name())) + " from ") + ((.location()).name())) + ".", this(), sender()); (> .move_to(dest) <); } with { return (traceback()[1])[2]; } // $# Edited 05 Nov 1995 14:10 Lynx ($lynx) }; public method .lock() { return lock; }; public method .lock_cmd() { arg cmdstr, cmd, this; if (!(| .perms(sender()) |)) return ((("Only " + ((.manager()).name())) + " can lock ") + (.name())) + "!"; lock = $false_lock_frob.new(); return "You lock " + (.name()); }; public method .lock_with_cmd() { arg cmdstr, cmd, this, prep, str; if (!(| .perms(sender()) |)) return ((("Only " + ((.manager()).name())) + " can lock ") + (.name())) + "!"; catch ~objnf, ~parse { lock = $lock_parser.parse(str, sender()); return ((((("You lock " + (.name())) + " ") + prep) + " ") + (lock.lock_name('thing))) + "."; } with { switch (error()) { case ~objnf: return "Object not found in lock string."; case ~parse: return "Invalid lock string."; } } }; public method .unlock_cmd() { arg cmdstr, cmd, this; if (!(| .perms(sender()) |)) return ((("Only " + ((.manager()).name())) + " can lock ") + (.name())) + "!"; lock = $true_lock_frob.new(); return "You unlock " + (.name()); }; public method .will_move() { arg mover, place; (> pass(mover, place) <); if (mover.is($housekeeper)) return; if (lock && ((mover != $exit) && (!(lock.try(mover))))) throw(~locked, ((((.name()).capitalize()) + " is locked to ") + (lock.lock_name('thing))) + "."); else if (!(.is_writable_by(sender()))) throw(~move, "You cannot move " + this()); }; public method .home() { arg [args]; var home; home = (| .get_local_setting("home", $thing) |); if (home) return home; if ((.manager()).is($user)) return .manager(); return $lost_and_found; }; public method .check_home() { arg definer, value, [args]; var home; home = (> .match_environment(value) <); if ((!(| home.trusts(sender()) |)) && (!(| home.setting("public-home") |))) throw(~perm, ("You do not have permission to make " + (home.name())) + " your home."); return home; // $# Edited 16 Oct 1995 18:04 Lynx ($lynx) }; public method .check_gender() { arg definer, value, [args]; var g, gs; gs = [$gender_female, $gender_male, $gender_neuter]; g = value in (gs.mmap('name)); if (!g) throw(~set, "Gender must be one of: " + ((gs.mmap('name)).to_english("", " or "))); return gs[g]; }; public method .check_match_with() { arg definer, value, [args]; var matching; if (value in ["regexp", "pattern", "begin"]) return tosym("match_" + (value.lowercase())); throw(~perm, "You can match with: regexp, pattern, begin."); }; new object $command_cache: $has_commands; var $root child_index = 3; var $root fertile = 1; var $root manager = $command_cache; var $root created_on = 796605573; var $root inited = 1; var $root flags = ['methods, 'code, 'fertile, 'variables, 'core]; var $command_cache shortcut_cache = 0; var $command_cache remote_cache = 0; var $command_cache local_cache = 0; var $has_commands shortcuts = #[]; var $root managed = [$command_cache]; var $root owned = [$command_cache]; var $command_cache interfaces = 0; root method .uninit_command_cache() { var i; (| .purge_caches() |); for i in (interfaces || []) i.interface_unlink(); }; public method .rehash_caches() { var cmd, obj, part, element; (> .perms(sender()) <); (| .purge_caches() |); if (!(.is_command_cache())) { // if we are not an official 'cache', just cache commands defined on us for cmd in (.local_commands()) { for part in (cmd[2]) .add_to_local_cache(part[1]); } shortcut_cache = (.shortcuts()).to_list(); } else { // otherwise cache all defined commands (> .add_object_to_local_cache(this()) <); shortcut_cache = .all_shortcuts(); } // remote caches are different, and HAVE to be specific to the user if (.is($location)) { for obj in ([this()] + (.contents())) (> .add_object_to_remote_cache(obj) <); } }; public method .add_object_to_remote_cache() { arg obj; var info, thing, element, part; info = (| obj.all_remote_commands() |); if (info) { for element in (info) { for part in (element[2]) .add_to_remote_cache(part[1], element[1]); } } }; public method .purge_caches() { (> .perms(sender()) <); (| clear_var('shortcut_cache) |); (| clear_var('remote_cache) |); (| clear_var('local_cache) |); }; private method .add_object_to_local_cache() { arg obj; var info, thing, element, part; info = (| obj.all_local_commands() |); if (info) { for element in (info) { for part in (element[2]) .add_to_local_cache(part[1]); } } }; protected method .add_to_remote_cache() { arg command, definer; var part, cmd, value, cmds, defs, refs; if (type(remote_cache) != 'dictionary) remote_cache = #[]; // if this dies, it will also fail on explode_template_word cmd = (| (command.explode())[1] |); for part in (command.explode_template_word()) { if ((value = (| remote_cache[part] |))) { cmds = (value[1]).setadd(cmd); refs = ((| (value[2])[definer] |) || 0) + 1; defs = (value[2]).add(definer, refs); remote_cache = remote_cache.add(part, [cmds, defs]); } else { remote_cache = remote_cache.add(part, [[cmd], #[[definer, 1]]]); } } }; protected method .add_to_local_cache() { arg command; var part, cmd; if (type(local_cache) != 'dictionary) local_cache = #[]; // if this dies, it will also fail on explode_template_word cmd = (| (command.explode())[1] |); for part in (command.explode_template_word()) local_cache = local_cache.setadd_elem(part, cmd); }; public method .match_in_shortcut_cache() { arg str, cmd, args; var shortcut, match, obj, shorts; for obj in ([this()] + parents()) { if ((shorts = obj.shortcut_cache())) { for shortcut in (shorts) { if ((match = str.match_pattern(shortcut[1]))) return ['shortcut, [(shortcut[2])[1], [str, @$command_lib.handle_shortcut_fields((shortcut[2])[2], match)]]]; } } } return 0; }; public method .shortcut_cache() { return shortcut_cache; }; public method .remote_cache() { return remote_cache; }; public method .local_cache() { return local_cache; }; public method .match_in_remote_cache() { arg str, cmd, args; var cache, definer, command, info, cdef, match, matched, templates; cache = (| .find_in_remote_caches(cmd) |); templates = []; matched = []; for command in (cache[1]) { for definer in ((cache[2]).keys()) { info = definer.get_command_info('remote, command); if (!info) continue; for cdef in (info) { match = args.match_template(cdef[2]); if (match != 0) matched += [[match.length(), definer, [str, cmd, @match], @cdef.subrange(3)]]; } templates = templates.union(info.slice(3)); } } if (matched) { info = [matched[1]]; matched = matched.delete(1); for match in (matched) { if ((match[1]) > ((info[1])[1])) info = [match]; else if ((match[1]) == ((info[1])[1])) info += [match]; } return ['remote, info]; } return ['partial, templates]; }; public method .match_in_local_cache() { arg str, cmd, args; var command, match, matched, templates, info, cdef, def; templates = (matched = []); for command in (.find_in_local_caches(cmd)) { info = .get_command_info('local, command); if (!info) continue; for cdef in (info) { match = match_template(args, cdef[2]); if (match != 0) matched += [[match.length(), [str, cmd, @match], @cdef.subrange(3)]]; } templates = templates.union(info.slice(3)); } if (matched) { info = [matched[1]]; matched = matched.delete(1); for match in (matched) { if ((match[1]) > ((info[1])[1])) info = [match]; else if ((match[1]) == ((info[1])[1])) info += [match]; } return ['local, info]; } if (!templates) return 0; return ['partial, templates]; }; public method .find_in_local_cache() { arg cmd; return (> local_cache[cmd] <); }; public method .cache_init() { if (!(sender().has_ancestor(definer()))) throw(~nochild, ((sender() + " is not a descendant of ") + definer()) + "."); if (.is_command_cache()) { if ((!local_cache) || (!remote_cache)) .rehash_caches(); } }; public method .is_command_cache() { return 'command_cache in (.flags()); }; public method .set_as_command_cache() { arg makecache; (> .perms(sender(), 'manager) <); if (makecache) (> .add_flag('command_cache) <); else (> .del_flag('command_cache) <); }; protected method .find_in_command_cache() { arg cmd_word, cache; var matches, match, obj, objs; matches = #[]; for obj in ([this()] + parents()) { match = (| obj.(cache)()[cmd_word] |); if (match) matches = matches.union(match); } return matches; }; public method .find_in_remote_cache() { arg cmd; return (> remote_cache[cmd] <); }; protected method .find_in_local_caches() { arg cmd_word; var matches, match, obj, objs; matches = []; for obj in (([this()] + parents()) + (interfaces || [])) { if ((match = (| obj.find_in_local_cache(cmd_word) |))) matches = matches.union(match); } return matches; }; public method .find_in_remote_caches() { arg cmd_word; var matches, match, obj, objs; matches = []; for obj in ([this()] + parents()) { if ((match = (| obj.find_in_remote_cache(cmd_word) |))) matches = matches.union(match); } return matches; }; public method .cache_uninit() { var user; // if (!.is($user)) // throw(~notuser, this() + " is not a user object."); if (!(sender().has_ancestor(this()))) throw(~nochild, ((sender() + " is not a descendant of ") + this) + ".\n"); if (.is_command_cache()) { // see if anybody still needs us, otherwise purge the caches for user in ($user_db.connected()) { if (user.has_ancestor(this())) return; } .purge_caches(); } }; protected method .del_from_remote_cache() { arg command, definer; var part, cmd, value, cmds, defs, refs; if (type(remote_cache) != 'dictionary) return; // if this dies, it will also fail on explode_template_word cmd = (| (command.explode())[1] |); for part in (command.explode_template_word()) { if ((value = (| remote_cache[part] |))) { refs = ((| (value[2])[definer] |) || 1) - 1; if (!refs) { remote_cache = remote_cache.del(part); if (!remote_cache) (| clear_var('remote_cache) |); } else { [cmds, defs] = value; defs = defs.add(definer, refs); remote_cache = remote_cache.add(part, [cmds, defs]); } } } }; public method .del_object_from_remote_cache() { arg obj; var info, thing, element, part; info = (| obj.all_remote_commands() |); if (info) { for element in (info) { for part in (element[2]) .del_from_remote_cache(part[1], element[1]); } } }; public method .interfaces() { return interfaces || []; }; public method .add_command_interface() { arg interface; if (!(interface.has_flag('command_cache))) throw(~perm, ("Command interface " + interface) + " is not setup as a cache."); interfaces = setadd(interfaces || [], interface); interface.interface_link(); }; public method .del_command_interface() { arg interface; if (!(interface.has_flag('command_cache))) throw(~perm, ("Command interface " + interface) + " is not setup as a cache."); interfaces = setremove(interfaces || [], interface); interface.interface_unlink(); }; new object $user_interfaces: $command_cache; var $root child_index = 12; var $root fertile = 1; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'fertile, 'variables, 'core]; var $has_commands shortcuts = #[]; var $command_cache shortcut_cache = 0; var $command_cache local_cache = 0; var $root manager = $user_interfaces; var $root managed = [$user_interfaces]; var $root owned = [$user_interfaces]; var $user_interfaces links = 0; public method .interface_link() { (> .perms(caller(), $command_cache) <); links++; if ((!(.local_cache())) || (!(.remote_cache()))) .rehash_caches(); }; public method .interface_unlink() { (> .perms(caller(), $command_cache) <); links--; if (links < 1) { .purge_caches(); (| clear_var('links) |); } }; new object $core: $root; var $root child_index = 4; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'core, 'variables]; var $root managed = [$core]; var $root owned = [$core]; var $root manager = $core; new object $libraries: $core; var $root child_index = 16; var $root fertile = 1; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'fertile, 'core, 'variables]; var $root manager = $libraries; var $root managed = [$libraries]; var $root owned = [$libraries]; new object $dictionary: $libraries; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'variables, 'core]; var $root manager = $dictionary; var $root owned = [$dictionary]; var $root managed = [$dictionary]; public method .to_list() { arg dict; var x; // merges into an associated list. return map x in (dict) to (x); }; public method .nunion() { arg dict1, dict2; var key; // like union() but for dictionaries. adds any keys from dict2 that don't // already exist in dict1 to dict1 and returns the result. Order of keys in // result is not guaranteed. if (((dict1.keys()).length()) < ((dict2.keys()).length())) { for key in (dict1) dict2 = dict_add(dict2, @key); return dict2; } else { for key in (dict2) dict1 = dict_add(dict1, @key); return dict1; } }; public method .values(): native; public method .replace() { arg dict, key, value; // GOING AWAY! anticipate_assignment(); return dict_add(dict, key, value); }; public method .apply() { arg tdict, list; var x; // Apply a translation-dict to a list for x in [1 .. list.length()] { catch ~keynf list = list.replace(x, tdict[list[x]]); } return list; }; public method .apply_to_keys() { arg tdict, dict; var x, newdict; // Apply a t-dict to the keys of a dict newdict = #[]; for x in (dict) { catch ~keynf x = x.replace(1, tdict[x[1]]); newdict = newdict.add(@x); } return newdict; }; public method .apply_to_values() { arg tdict, dict; var x, newdict; // Apply a t-dict to the values of a dict newdict = #[]; for x in (dict) { catch ~keynf x = x.replace(2, tdict[x[2]]); newdict = newdict.add(@x); } return newdict; }; public method .invert() { arg dict; var x; // Invert a dict keys and values return hash x in (dict) to ([x[2], x[1]]); }; public method .add_elem() { arg dict, key, elem; var value; // Add an element to the list value of a dictionary key value = (| dict[key] |); if ((type(value) != 'list) && (type(value) != 'error)) throw(~type, ((("Value for key " + key) + " (") + value) + ") is not a list."); anticipate_assignment(); if (value) { // reduce references to 'value' dict = dict_add(dict, key, 0); value += [elem]; } else { value = [elem]; } return dict_add(dict, key, value); }; public method .del_elem() { arg dict, key, elem; var value; value = (| dict[key] |); if ((type(value) != 'list) && (type(value) != 'error)) throw(~type, ((("Value for key " + key) + " (") + value) + ") is not a list."); anticipate_assignment(); dict = dict_add(dict, key, 0); value = setremove(value, elem); if (!value) return dict_del(dict, key); return dict_add(dict, key, value); }; public method .add(): native; public method .del(): native; public method .keys(): native; public method .contains(): native; public method .to_trie() { arg dict; var i, trie; trie = $trie.new(); for i in (dict) { trie = trie.add(i[1], i[2]); refresh(); } return trie; }; public method .union(): native; public method .setadd_elem() { arg dict, key, elem; var value; value = (| dict[key] |); if ((type(value) != 'list) && (type(value) != 'error)) throw(~type, ((("Value for key " + key) + " (") + value) + ") is not a list."); anticipate_assignment(); if (value) { dict = dict_add(dict, key, 0); value = setadd(value, elem); } else { value = [elem]; } return dict_add(dict, key, value); }; new object $buffer: $libraries; var $root trusted = []; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'variables, 'core]; var $root manager = $buffer; var $root owned = [$buffer]; var $root managed = [$buffer]; public method .to_list() { arg buf; var i, list; return map i in [1 .. buflen(buf)] to (buf[i]); }; public method .from_list() { arg list; var buf, i; // this differs from $list.to_buffer() buf = `[]; for i in (list) buf += `[i]; return buf; }; public method .length(): native; public method .to_string(): native; public method .to_strings(): native; public method .from_string(): native; public method .from_strings(): native; public method .replace(): native; public method .subrange(): native; private method .to_veil_pkts(): native; private method .from_veil_pkts(): native; public method .break_lines() { arg buf; var i, sub, out; // break a buffer by \r or \n but keep its sub contents as buffers out = []; while ((i = 10 in buf)) { sub = subbuf(buf, 1, i - 1); buf = subbuf(buf, i + 1); while ((i = 13 in sub)) { if (buflen(sub) == i) sub = subbuf(sub, 1, i - 1); else sub = subbuf(sub, 1, i - 1) + subbuf(sub, i + 1); } out += [sub]; } if (buf) { while ((i = 13 in buf)) { if (buflen(buf) == i) buf = subbuf(buf, 1, i - 1); else buf = subbuf(buf, 1, i - 1) + subbuf(buf, i + 1); } if (buf) out += [buf]; } return out; }; new object $string: $libraries; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'variables, 'core]; var $string alphabet = "abcdefghijklmnopqrstuvwxyz"; var $string numbers = "0123456789"; var $string non_alphanumeric = "!@#$%^&*()_+-=~`'{}[]|/?\",.<>;: "; var $root manager = $string; var $root owned = [$string]; var $string number_names = ["one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten"]; var $root managed = [$string]; public method .left() { arg str, width, [fchar]; // will not chop off 'str' if it is longer than width, use pad() for that. [(fchar ?= " ")] = fchar; if (strlen(str) < width) return str + pad("", width - (str.length()), fchar); return str; }; public method .center() { arg text, width, [args]; var fill, sides; // args[1] <op> == what to fill the left|right side with. // args[2] <op> == if exists also fill the right side. [(fill ?= " "), (sides ?= 'left)] = args; if (sides == 'both) return strfmt(("%*{" + fill) + "}c", width, text); else return pad("", (width - strlen(text)) / 2, fill) + text; }; public method .trim(): native; public method .right() { arg str, width, [fchar]; // will not chop off 'str' if it is longer than width (unlike pad()) [(fchar ?= " ")] = fchar; if (strlen(str) < width) return pad(str, -width, fchar); return str; }; public method .alphabet() { return alphabet; }; public method .numbers() { return numbers; }; public method .capitalize(): native; public method .is_numeric() { arg string; return toint(string) || (string == "0"); }; public method .a_or_an() { arg string; return $english_lib.indef_article(string); if ((string[1]) in "aeiou") return "an"; return "a"; }; public method .strip() { arg string, [strip]; anticipate_assignment(); if (!strip) return strsed(string, "[][!@#$%^&*()_+=~`'{}|/?\"\,.<>;: -]", "", "g"); else return strsed(string, ("[" + (strip[1])) + "]", "", "g"); }; public method .non_alphanumeric() { return non_alphanumeric; }; public method .chop() { arg str, len, [end]; // chops string off end.length() characters before len and appends len [(end ?= "...")] = end; anticipate_assignment(); if ((str.length()) < len) return str; if ((str.length()) < (end.length())) return str; return pad(str, len - (end.length())) + end; }; public method .replace(): native; public method .explode_english_list() { arg line, [opts]; var x, output, tmp; if (!line) return []; // explodes an english list ("foo, bar and zoo"). line = line.explode(","); output = []; for x in (line) { x = .trim(x); if ((| x.subrange(1, 4) |) == "and ") output += [.trim(x.subrange(4))]; else output += [x]; } // check the last element, if they didn't specify 'noand if (!('noand in opts)) { line = (output[output.length()]).explode(); tmp = ""; for x in [1 .. line.length()] { if ((line[x]) == "and") { output = output.delete(output.length()); if (tmp) output += [tmp]; tmp = (line.subrange(x + 1)).join(); if (tmp) output += [tmp]; // only bother with the first "and" break; } tmp = (tmp + (tmp ? " " : "")) + (line[x]); } } return output; }; public method .explode_delimited() { arg str, left, right; var pattern, parsed, matched, match_num, match_result; // parse str looking for anything surrounded by left and right // ;$string.explode_delimited("foo<bar>baz", "<", ">") // => [["foo", 1, "baz"], ["bar"]] pattern = ((("*" + left) + "*") + right) + "*"; parsed = []; matched = []; match_num = 0; anticipate_assignment(); while (str) { match_result = match_pattern(str, pattern); if (match_result) { match_num++; parsed += [match_result[1], match_num]; matched += [match_result[2]]; str = match_result[3]; } else { parsed += [str]; str = ""; } } return [parsed, matched]; }; public method .wrap_line() { arg string, length, [stuff]; var output, cutoff, firstline, prefix; // takes string and wraps it by words, compared to length, breaks with \n [(prefix ?= ""), (firstline ?= 0)] = stuff; output = ""; if (firstline) string = prefix + string; while ((string.length()) > length) { cutoff = .rindex(string.subrange(1, length), " "); if (cutoff <= (prefix.length())) { output += "\n" + (string.subrange(1, length)); string = prefix + (string.subrange(length + 1)); } else { output += "\n" + (string.subrange(1, cutoff - 1)); string = prefix + (string.subrange(cutoff + 1)); } } return (output ? (output.subrange(3)) + "\n" : "") + string; }; public method .rindex() { arg string, index; return stridx(string, index, -1); }; public method .is_boolean() { arg str; if (match_regexp(str, "^(yes|y|true|t|1)$")) return 1; if (match_regexp(str, "^(no|n|false|f|0)$")) return 0; return -1; }; public method .explode(): native; public method .match_template(): native; public method .explode_template_word() { arg template; var t, x, idx, out, new; // this only explodes single word templates template = template.explode("|"); out = []; for t in (template) { idx = "?" in t; if (idx) { t = t.strip("?"); new = t.subrange(1, idx - 1); out += [new]; for x in [idx .. t.length()] { new += t[x]; out += [new]; } } else { out += [t]; } } return out; }; public method .match_pattern(): native; public method .match_regexp(): native; public method .to_number() { arg str; if (str.is_numeric()) return toint(str); throw(~nonum, ("\"" + str) + "\" is not a number."); }; public method .last() { arg str; return str[str.length()]; }; public method .explode_list() { arg str; if (("," in str) || (" and " in str)) return str.explode_english_list(); else return str.explode(); }; public method .find_escaped() { arg str, char; var good, start, pos, p; good = 0; start = 0; while ((!good) && (start < (str.length()))) { pos = (char in (str.subrange(start + 1))) + start; good = 1; if (pos > start) { p = pos - 1; while ((p > 0) && ((str[p]) == "\\")) { good = good ? 0 : 1; p = p - 1; } } if (good) return pos; else start = pos; } }; public method .explode_quoted() { arg str; var out, result, x, qstr; out = []; // HACK: we need to make this a native--its horribly inefficient qstr = ("#$#QUOTE-" + time()) + "#$#"; str = strsub(str, "\\\"", qstr); while (str) { result = match_pattern(str, "*\"*\"*"); if (result) { out += ((result[1]).explode()) + [(result[2]).trim()]; str = result[3]; } else { out += str.explode(); str = ""; } } for x in [1 .. listlen(out)] out = replace(out, x, strsub(out[x], qstr, "\"")); return out; }; public method .strip_article() { arg str; return strsed(str, "^(an|a|the) *", "", "g"); }; public method .unquote() { arg str; if (str && (((str[1]) == "\"") && ((str[str.length()]) == "\""))) return str.subrange(2, (str.length()) - 2); return str; }; public method .to_buffer() { arg string; return (> str_to_buf(string) <); }; public method .pad(): native; public method .wrap_lines() { arg string, length, [stuff]; var output, cutoff, firstline, prefix; // takes string and wraps it by words, compared to length, returns a list. [(prefix ?= ""), (firstline ?= 0)] = stuff; output = []; if (firstline) string = prefix + string; while ((string.length()) > length) { cutoff = .rindex(string.subrange(1, length), " "); if (cutoff <= (prefix.length())) { output += [string.subrange(1, length)]; string = prefix + (string.subrange(length + 1)); } else { output += [string.subrange(1, cutoff - 1)]; string = prefix + (string.subrange(cutoff + 1)); } } return output + [string]; }; public method .length(): native; public method .subrange(): native; public method .match_begin(): native; public method .crypt(): native; public method .uppercase(): native; public method .lowercase(): native; public method .compare(): native; public method .format(): native; public method .to_symbol() { arg str; str = lowercase(strsed(str, "[^a-zA-Z0-9_]+", "", "g")); return (> tosym(str) <); }; public method .valid_ident() { arg str; return strsed(str, "[^a-z0-9_]+", "", "g") == str; }; public method .regexp(): native; public method .sed(): native; public method .split(): native; public method .word(): native; public method .dbquote_explode(): native; public method .to_html() { arg line; anticipate_assignment(); line = strsub(line, "&", "&"); line = strsub(line, "<", "<"); line = strsub(line, ">", ">"); return line; }; public method .explode_url() { arg line; var out, args, i; i = "?" in line; if (i) { args = substr(line, i + 1); line = substr(line, 1, i - 1); } if (args) out = #[['path, explode(line, "/")], ['args, .explode_http_encoding(args)]]; else out = #[['path, explode(line, "/")], ['args, #[]]]; return out; }; public method .explode_http_encoding() { arg args; var fields, field, values; fields = #[]; for field in (args.explode("&")) { field = field.explode("="); if (listlen(field) == 1) field = [field[1], ""]; fields = fields.add(@field); } return fields; }; public method .add_indefinite() { arg str; anticipate_assignment(); return ((str.a_or_an()) + " ") + str; }; public method .rangeset() { arg string, start, len, new; anticipate_assignment(); return ((string.subrange(1, start - 1)) + new) + (string.subrange(start + len)); }; public method .decode64() { arg enc_chars; var i, j, k, ints, out_buf, len; i = 1; out_buf = `[]; len = enc_chars.length(); while (i < len) { refresh(); ints = []; for j in [1 .. 4] { for k in [1 .. 65] { if (strcmp(enc_chars[i], base64str[k]) == 0) { ints = [@ints, (k - 1) % 64]; break; } } i++; } out_buf = out_buf + `[(((ints[1]).shleft(2)) % 256) + ((ints[2]).shright(4)), (((ints[2]).shleft(4)) % 256) + ((ints[3]).shright(2)), (((ints[3]).shleft(6)) % 256) + (ints[4])]; } return out_buf.to_string(); }; new object $command_lib: $libraries; var $root manager = $command_lib; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'variables, 'core]; var $command_lib arg_types = ["this", "any", "any:*", "object", "object:*", "user", "user:*", "descendant of *", "descendant of *:*", "number", "number:*", "objref", "objref:*"]; var $root owned = [$command_lib]; var $root managed = [$command_lib]; public method .get_argument_type() { arg type; var a, m, opts, o, result, is_list; o = $object_lib; is_list = 0; if ((m = type.match_template("list *"))) { type = m[2]; is_list = 1; } for a in (arg_types) { m = match_pattern(type, a); if (type(m) == 'list) { switch (a) { case "descendant of *": result = ['descendant, [(> o.to_dbref(m[1]) <)]]; case "descendant of *:*": opts = ._parse_option_templates(m[2]); result = ['descendant, [(> o.to_dbref(m[1]) <)] + opts]; case "number:*", "objref:*", "any:*", "object:*", "user:*": opts = ._parse_option_templates(m[1]); result = [tosym(((a.explode(":"))[1]) + "_opt"), opts]; default: result = [tosym(a), []]; } return is_list ? ['list, result] : result; } } throw(~command, ("Invalid argument type \"" + type) + "\""); }; public method .handle_shortcut_fields() { arg subs, fields; var subbed_list, elem; subbed_list = []; for elem in (subs) { if (type(elem) == 'string) subbed_list += [elem]; else if (type(elem) == 'integer) subbed_list += [(> fields[elem] <)]; else throw(~type, "Substitution element is of wrong type."); } return subbed_list; }; public method .validate_command_template() { arg str; var cmd, tmp, loc, types, part, relations; [tmp, types] = str.explode_delimited("<", ">"); loc = []; cmd = []; relations = #[]; for part in (tmp) { if (type(part) == 'string) cmd += part.explode(); else cmd += [part]; } // clean for part in [1 .. cmd.length()] { if (type(cmd[part]) == 'string) { cmd = cmd.replace(part, (cmd[part]).trim()); } else { relations = relations.add(part - 1, (> .get_argument_type(types[cmd[part]]) <)); cmd = cmd.replace(part, "*"); } } cmd = [cmd[1], (cmd.subrange(2)).join()]; return [cmd, relations]; }; public method .parse_relation() { arg left, right; var x, str, out; left = .break_cards(left); right = .break_cards(right); if ((((left[2]).length()) != ((right[2]).length())) || (!((left[2]).set_equal(right[2])))) throw(~invrel, "Left side cards are not equal to the right side."); str = ""; for x in (left[1]) { if (type(x) == 'string) str += x; else if (str && ((str[strlen(str)]) == "*")) str += " *"; else str += "*"; } out = [str, @left]; str = ""; for x in (right[1]) { if (type(x) == 'string) str += x; else str += "*"; } return [out, [str, @right]]; }; public method .unparse_shortcut() { arg s; var part, line, short, method, args; line = ""; [short, [method, args]] = s; for part in (args) { if (type(part) == 'string) line += part; else line += "%" + part; } return ((((("\"" + (s[1])) + "\"").left(10)) + " => \"") + line) + "\""; }; public method .format_commands_long() { arg cmds, type, clen; var def, name, c, cdef, line, o, cs, dname; o = []; for def in (cmds.keys()) { o += [((type + " commands on ") + (def.name())) + ":"]; for cdef in (cmds[def]) { for c in (cdef[2]) o += [(((" " + (toliteral(c[3]).left(clen))) + ".") + tostr(c[4])) + "()"]; } } return o; }; public method .format_commands_short() { arg cmds, type, len; var def, name, c, cdef, line, o, cs, dname; o = []; for def in (cmds.keys()) { o += [((type + " commands on ") + (def.name())) + ":"]; cs = []; for cdef in (cmds[def]) { for c in (cdef[2]) cs += [("\"" + (c[3])) + "\""]; } o += ((cs.sort()).lcolumnize(len - 2, " ")).prefix(" "); } return o; }; public method .break_cards() { arg str; var card, reg, i, x, cards, out, s; out = (cards = []); while ((reg = match_regexp(str, "(%[0-9]+)"))) { if (((reg[2])[1]) != 1) out += [@.break_wildcards(str.subrange(1, ((reg[2])[1]) - 1))]; card = substr(str, @reg[2]); str = substr(str, (reg[2]).sum()); if (!((card[2]).is_numeric())) throw(~invcard, "Argument cards must be numeric."); card = toint(substr(card, 2)); cards += [card]; out += [card]; } if (str) out += [str]; return [out, cards]; }; public method .format_relation() { arg relation; var x, str; str = ""; for x in (relation) { if (type(x) == 'integer) str = (str + "%") + tostr(x); else str += x; } return str; }; public method .break_wildcards() { arg str; var out, i, s; out = []; while ((i = "*" in str)) { out += [substr(str, 1, i - 1), ""]; str = str.subrange(i + 1); } if (str) out += [str]; return out; }; public method ._parse_option_templates() { arg opt; var reg, out; out = []; opt = strsed(opt, "^ *", ""); while (opt) { if ((reg = regexp(opt, "^[\+-]([^= ]*)=([^ ]+) *(.*)"))) { opt = reg[3]; out += [delete(reg, 3)]; } else if ((reg = regexp(opt, "^[\+-]([^ ]+) *(.*)"))) { opt = reg[2]; out += [[reg[1]]]; } else { throw(~invopt, "Option templates must begin with '+' or '-'"); } opt = strsed(opt, "^ *", ""); } return out; }; public method .arg_types() { return arg_types; }; public method .unparse_shortcut_full() { arg s; var part, out, short, method, args; [short, [method, args]] = s; out = ""; for part in (args) { if (type(part) == 'string) out += ((out ? ", \"" : "\"") + part) + "\""; else out += ((out ? ", " : "") + "%") + part; } out = ((("." + method) + "(") + out) + ")"; return (((("\"" + short) + "\"").left(10)) + " => ") + out; }; new object $http: $libraries; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'variables, 'core]; var $http errors = #[[400, ["<head><title>400 Bad Request</title></head>", "<body>", "<center><h1>400 Bad Request</h1></center>", "%s", "</body>"]], [403, ["<head><title>403 Permission Denied</title></head>", "<body>", "<center><h1>403 Permission Denied</h1></center>", "%s", "</body>"]], [404, ["<head><title>404 Not Found</title></head>", "<center><h1>404 Not Found</h1></center>", "%s", "</body>"]]]; var $http gateways = #[["describe", "describe?target=the_pit"], ["see", "see?target=the_pit"], ["who", "who"], ["display", "display?target=$http"], ["list_method", "list_method?target=$http.list_method"], ["help", "help?node=help_core"], ["object", "object?target=http"]]; var $http http_methods = ["GET"]; var $http codes = #[[200, "Ok"], [201, "Created"], [202, "Accepted"], [203, "Provisional Information"], [204, "No Content"], [300, "Multiple Choices"], [301, "Moved Permanently"], [302, "Moved Temporarily"], [303, "Method"], [304, "Not Modified"], [400, "Bad Request"], [401, "Unauthorized"], [402, "Payment Required"], [403, "Forbidden"], [404, "Not Found"], [405, "Method Not Allowed"], [406, "None Acceptable"], [407, "Proxy Authentication Required"], [408, "Request Timeout"], [409, "Conflict"], [410, "Gone"], [500, "Internal Server Error"], [501, "Not Implemented"], [502, "Bad Gateway"], [503, "Service Unavailable"], [504, "Gateway Timeout"]]; var $http html_version = "text/html"; var $root manager = $http; var $http page_head = []; var $root owned = [$http]; var $http page_body = "<body bgcolor=\"#ffffff\" text=\"#000000\" link=\"#130191\" vlink=\"#100040\" alink=\"#4000bf\">"; var $root managed = [$http]; public method .make_obj_show_href() { arg obj, [name]; var line, oname; name = name ? name : (("<code>" + obj) + "</code>"); return ((("<a href=\"/bin/show?target=" + (obj.objname())) + "\">") + name) + "</a>"; }; public method .make_method_href() { arg m; return ((((((("<a href=\"/bin/list_method?target=" + (m[1])) + ".") + (m[2])) + "()\">.") + (m[2])) + "(") + (m[3])) + ")</a>"; }; public method .make_object_href() { arg obj; return ((("<code><a href=\"/bin/object?target=" + (obj.objname())) + "\">") + (obj.namef('xref))) + "</a></code>"; }; public method .bin_list_method() { arg path, info, header; var ref, str_ref, name, obj, code, anc, out, line, x; ref = (| (info['args])["target"] |); if (!ref) return [400, .response(400, "Must specify a target method reference")]; catch any { ref = $parse_lib.ref(ref, $foundation); name = (> tosym(ref[4]) <); obj = ref[3]; anc = obj.find_method(name); code = anc.list_method(name); for x in [1 .. code.length()] line = " " + ((code[x]).to_html()); str_ref = ((obj + ".") + name) + "()"; out = [("<head><title>" + str_ref) + "</title></head>", page_body, ("<center><h1>" + str_ref) + "</h1></center>", "<hr><pre>", @code, "</pre>"]; } with { switch (error()) { case ~type: return [400, ((("Invalid method reference " + obj) + ".") + name) + "()"]; case ~methodnf: line = ((obj + ".") + name) + "()"; return [400, .response(400, line + " not found.")]; default: return [400, .response(400, (traceback()[1])[2])]; } } return [200, out]; }; public method .bin_who() { arg [args]; var who, namel, names, times, idle, realm, x, cols, out, output, line; out = [("<head><title>Connected users to " + ($motd.server_name())) + "</title></head>", page_body, ("<center><h2>Connected users to <i>" + ($motd.server_name())) + "</i></h2></center></head><body><pre>"]; who = $user_db.connected(); names = who.mmap('hname); namel = []; for x in (who.mmap('name)) namel += [x.length()]; cols = (namel.max()) + 1; if (cols < 5) cols = 5; times = who.mmap('connected_time); cols = [cols, (times.element_maxlength()) + 1]; if ((cols[2]) < 7) cols = [cols[1], 7]; idle = who.mmap('idle_time); cols += [(idle.element_maxlength()) + 1]; if ((cols[3]) < 5) cols = cols.replace(3, 5); realm = who.mmap('realm_name, "text/html"); out += [((((("<hr><b>" + ("Name".pad(cols[1]))) + " ") + ("On for".pad(cols[2]))) + " ") + ("Idle".pad(cols[3]))) + " Location", ((((("----".pad(cols[1])) + " ") + ("------".pad(cols[2]))) + " ") + ("----".pad(cols[3]))) + " --------</b>"]; for x in [1 .. who.length()] { line = ((("<b>" + (names[x])) + "</b>") + ("".pad((cols[1]) - (namel[x])))) + " "; line = (((line + "<i>") + (times[x])) + ("".pad((cols[2]) - ((times[x]).length())))) + " "; line = (((line + (idle[x])) + "</i>") + ("".pad((cols[3]) - ((idle[x]).length())))) + " "; line += realm[x]; out += [line]; } return [200, out]; }; public method .page_head() { return page_head; }; public method .gateways() { return gateways; }; public method .bin_display() { arg path, info, header; var out, obj, what, args; args = info['args]; obj = (| args["target"] |); if (!obj) return [400, .response(400, "Must specify a target object")]; obj = (| $object_lib.to_dbref(obj) |); if (!obj) return [404, .response(404, ("Unable to find object \"" + (args["target"])) + "\"")]; what = []; if ((| args["vars"] |)) what = setadd(what, 'vars); if ((| args["methods"] |)) what = setadd(what, 'methods); return [200, .show_object(obj, what)]; }; public method .page_tail() { arg [args]; var tail; tail = ("<hr size=4><a href=\"/\"><b>" + ($motd.server_name())) + "</b></a>"; if (args) return str_to_buf(tail); return [tail]; }; public method .http_methods() { return http_methods; }; public method .page_body() { return page_body; }; public method .list_gateways() { var out, line, gate; out = ["<ul>"]; for gate in (gateways) { line = ((("<li><b><a href=\"/bin/" + (gate[2])) + "\">") + (gate[1])) + "</a></b>"; out += [line]; } return out + ["</ul>"]; }; public method .make_href() { arg obj, [args]; var line, oname, method, name; oname = obj.objname(); if (listlen(args)) name = args[1]; else name = ("<code>$" + oname) + "</code>"; if (listlen(args) > 1) method = args[2]; else method = "/bin/show?target=" + oname; return ((("<a href=\"" + method) + "\">") + name) + "</a>"; }; public method .process_bin_request() { arg [path]; var gate, who; if (!path) { return ["text/html", .list_gateways()]; } else { gate = path[1]; path = path.subrange(2); if ("?" in gate) { path = [gate.subrange(("?" in gate) + 1), @path]; gate = gate.subrange(1, ("?" in gate) - 1); } if (!(gate in (gateways.keys()))) return ["text/html", .get_error(400, ("Unknown gateway \"" + gate) + "\".")]; return ["text/html", .(tosym("bin_" + gate))(@path)]; } }; public method .bin_describe() { arg path, info, header; var obj, desc, flags, detail, page, body, name; obj = (| (info['args])["target"] |); if (!obj) return [400, .response(400, "Must specify a target object")]; obj = (| $object_lib.to_dbref(obj) |) || (| $user_db.search(obj) |); if (!obj) return [404, .response(404, ("Unable to find object \"" + (path[1])) + "\"")]; detail = (| (info['args])["detail"] |); if (detail) { detail = $http.decode(detail); name = ((obj.name()) + ": ") + detail; catch any body = (<$ctext_frob, [[(<$format, ["subj", [["level", "2"]], [detail.capitalize()], 'do_subj]>)], #[['this, obj]]]>).append(obj.get_detail(detail)); with body = $http.response(404, ("No such detail '" + detail) + "'"); } else { name = obj.name(); body = obj.get_description(#[['actor, $no_one]]); } return [200, .build_page(body, name)]; }; public method .bin_see() { arg [args]; return [400, .response(400, "VRML support is pending completion, sorry!")]; }; public method .bin_help() { arg path, info, header; var node, head, tail, cout, list, n, out; node = (| (info['args])["node"] |); if (!node) node = "help_core"; catch ~namenf node = (> $object_lib.to_dbref(node) <); with return [404, .response(404, "Unable to find help node: " + ((info['args])["node"]))]; head = strings_to_buf([("<head><title>Help: " + (node.node_name())) + "</title></head>", page_body, ("<h2 align=center>" + (node.html_node_name())) + "</h2><hr>"]); cout = $parse_lib.filter_ctext(node.body(), #[['formatter, $html_format], ['node, tostr(node)]]); tail = "<hr size=4><p align=center>"; if (node.group()) { out = ""; for n in (((node.parents())[1]).children()) { if (n.nolist()) continue; if (n == node) out += ((out ? "| " : "") + (n.name())) + " "; else out += (((((out ? "| " : "") + "<a href=\"/bin/help?node=") + n) + "\">") + (n.name())) + "</a> "; } if (out) tail += out; } tail = str_to_buf(tail + "</body>"); switch (type(cout)) { case 'string: cout = [cout]; case 'frob: cout = `[]; } return [200, (head + cout) + tail]; }; public method .process_text() { arg what; var out, l, b; switch (type(what)) { case 'frob: return $parse_lib.filter_ctext(what, #[['formatter, $html_format]]); case 'list: out = `[]; for l in (what) out += .process_text(l); return out; case 'string: // "<br>" == `[60, 98, 114, 62] return `[60, 98, 114, 62] + str_to_buf(what); } }; public method .response() { arg code, message; var name, x; if (!(name = (| codes[code] |))) return .response(500, "We had a booboo! Invalid code: " + tostr(code)); if (type(message) == 'string) message = [("<p align=center>" + message) + "</p>"]; return [((("<head><title>" + tostr(code)) + " ") + name) + "</title></head>", page_body, ((("<h1 align=center>" + tostr(code)) + " ") + name) + "</h1>", "<hr>", @message, @.page_tail()]; }; public method .html_version() { return html_version; }; public method .build_page() { arg what, name; var out; return (((`[60, 104, 101, 97, 100, 62, 60, 116, 105, 116, 108, 101, 62] + str_to_buf(name)) + `[60, 47, 116, 105, 116, 108, 101, 62, 60, 47, 104, 101, 97, 100, 62]) + str_to_buf(page_body)) + (.process_text(what)); }; public method .bin_object() { arg path, info, header; var out, obj, o, line, objs, m; obj = (| (info['args])["target"] |); if (!obj) return [400, .response(400, "Must specify a target object")]; obj = (| $object_lib.to_dbref(obj) |); if (!obj) return [404, .response(404, ("Unable to find object \"" + ((info['args])["target"])) + "\"")]; out = [("<head><title>" + (obj.namef('xref))) + "</title></head>", page_body, ("<h1 align=center>" + (.make_display_href(obj, "&methods"))) + "</h1>"]; line = "<p align=center><b>Parent(s)</b>: " + ((| .make_object_href((obj.parents())[1]) |) || "(none)"); for o in ((| (obj.parents()).subrange(2) |) || []) line += ", " + (.make_object_href(o)); out += [line + "</p>", "<pre>"]; objs = obj.children(); if (obj) { out += ["<p align=center><b>Children:</b></p>", "Name Perms Size Manager"]; for o in (objs) { m = o.manager(); if (!valid(o)) m = toliteral(m); else m = .make_object_href(m); out += [((((((((("<a href=\"/bin/object?target=" + (o.objname())) + "\">") + pad(o.namef('xref), 36)) + "</a>") + " ") + (($object_lib.see_perms(o, ["", ""])).pad(5))) + " ") + (((o.size()).to_english()).pad(8))) + " ") + m]; } } return [200, out + ["</pre>"]]; }; public method ._show_header_objs() { arg objs, what; var o, line; if ((objs.length()) > 1) { line = (("<b>" + what) + "s</b>: ") + (.make_object_href(objs[1])); for o in (objs.subrange(2)) line += ", " + (.make_object_href(o)); line += "<br>"; } else if (objs == 1) { line = (("<b>" + what) + "</b>: ") + (.make_object_href(objs[1])); } else { line = ("<b>" + what) + "</b>: (none)<br>"; } return line; }; public method ._show_methods() { arg obj; var methods, types, m, t, out; types = #[]; for m in (obj.methods()) types = types.add_elem(obj.method_access(m), [m] + (obj.method_info(m))); // hard-listing the types guarantee's their order out = []; for t in (['root, 'driver, 'public, 'protected, 'private]) { if (!(types.contains(t))) continue; out += [(tostr(t).capitalize()) + " methods:"]; for m in (types[t]) out += [strfmt("%5l %4r " + (.make_method_href([obj, m[1], m[2]])), $object_lib.parse_method_flags(m[7]), m[5])]; } return out; }; public method ._show_variables() { arg obj; var parent, out, v; out = []; for parent in (obj.data()) { if (valid(parent[1])) { out += [(parent[1]) + " variables:"]; if ((parent[1]).has_flag('variables, this())) { for v in (parent[2]) out += [((" " + (v[1])) + ": ") + toliteral(v[2])]; } else { out += [" ** Permission Denied **"]; } } else { out += [($object_lib.get_name(parent[1])) + " variables:"]; for v in (parent[2]) out += [((" " + (v[1])) + ": ") + toliteral(v[2])]; } refresh(); } return out; }; public method .show_object() { arg obj, what; var out; out = [("<head><title>ColdC Object Display of " + obj) + "</title></head>", page_body, ("<h1>" + obj) + "</h1>", ("<b>Perms</b>: " + (((.flags()).prefix("+")).join())) + "<br>", ("<b>Size</b>: " + ((obj.size()).to_english())) + " bytes (on disk)<br>", ("<b>Manager</b>: " + (.make_object_href(obj))) + "<br>", ._show_header_objs(obj.writers('literal), "Writer"), ._show_header_objs(obj.parents(), "Parent")]; if (obj.has_ancestor($located)) out += [("<b>Location</b>: " + (.make_object_href(obj.location()))) + "<br>"]; out += ["<p><pre>"]; if ('methods in what) { if (!(obj.has_flag('methods, this()))) out += [" ** No permission to list methods **"]; else out += ._show_methods(obj); } else { out += [(((((" <h3><a href=\"/bin/display?target=" + obj) + "&") + ((['methods] + what).join("=yes&"))) + "=yes\">Display Methods on ") + obj) + "</a></h3>"]; } if ('vars in what) { if (!(obj.has_flag('vars, this()))) out += [" ** No permission to show variables **"]; else out += ._show_variables(obj); } else { out += [(((((" <h3><a href=\"/bin/display?target=" + obj) + "&") + ((what + ['vars]).join("=yes&"))) + "=yes\">Display Variables on ") + obj) + "</a></h3>"]; } return out + ["</pre>"]; }; public method .make_display_href() { arg obj, [args]; args = args ? args : ""; return (((("<a href=\"/bin/display?target=" + (obj.objname())) + args) + "\">") + (obj.namef('xref))) + "</a>"; }; public method .decode(): native; public method .encode(): native; new object $object_lib: $libraries; var $root trusted = []; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'variables, 'core]; var $root manager = $object_lib; var $root owned = [$object_lib]; var $root managed = [$object_lib]; public method .to_dbref() { arg obj; var dbref; switch (type(obj)) { case 'string: if (!obj) throw(~invdbref, "Invalid object reference \"\"."); if ((obj[1]) == "$") { obj = obj.subrange(2); dbref = (| lookup(tosym(obj)) |); } else if ((obj[1]) == "#") { obj = substr(obj, 2); if (obj.is_numeric()) dbref = (| toobjnum(toint(obj)) |); else throw(~objnf, ("Cannot find object \"#" + obj) + "\"."); } else { dbref = toint(obj[1]); if (dbref || (obj == "0")) dbref = toobjnum(dbref); else dbref = (| lookup(obj) |); } if (!dbref) dbref = (> lookup(tosym((obj.replace(" ", "_")).lowercase())) <); return dbref; case 'objnum: return obj; default: return (> lookup(obj) <); } }; public method .get_name() { arg obj, [args]; var meth; // get_name(obj, 'method, [args]) (3rd arg must be a list) if (!valid(obj)) return tostr(obj); [(meth ?= 'name), (args ?= [])] = args; return obj.(meth)(@args); }; public method .see_perms() { arg obj, [args]; var str, flag, who, encapsulate, flags; [(encapsulate ?= ["[", "]"])] = args; str = encapsulate[1]; flags = obj.flags(); if ('core in flags) { flags = flags.setremove('core); str += "*"; } else { str += "-"; } if ('fertile in flags) { flags = flags.setremove('fertile); str += "f"; } else { str += "-"; } if ('methods in flags) { flags = flags.setremove('methods); str += "m"; } else { str += "-"; } if ('variables in flags) { flags = flags.setremove('variables); str += "p"; } else { str += "-"; } if ('code in flags) { flags = flags.setremove('code); str += "c"; } else { str += "-"; } for flag in (flags) str += (tostr(flag)[1]).uppercase(); return str + (encapsulate[2]); }; public method .str_to_objlist() { arg args; var out, x, obj; if ("," in args) args = args.explode_english_list(); else args = args.explode(); return .list_to_objlist(args); }; public method .list_to_objlist() { arg args; var out, x, obj; out = #[['valid, []], ['invalid, []]]; for x in (args) { obj = (| .to_dbref(x) |); if (obj) out = out.add_elem('valid, obj); else out = out.add_elem('invalid, x); } return out; }; public method .parse_method_flags() { arg flags; return (((" " + (('nooverride in flags) ? "!" : "-")) + (('forked in flags) ? "f" : "-")) + (('locked in flags) ? "l" : "-")) + (('native in flags) ? "n" : "-"); }; public method .format_object() { arg obj, chop; var len, line, out, c; c = obj.created_on(); out = ["Object: " + (obj.namef('xref)), "Created: " + (c ? ctime(c) : "(Before Time)"), (("Quota: " + (obj.quota())) + " bytes") + ((obj.quota_exempt()) ? " ** exempt **" : ""), "Perms: " + (((obj.flags()).prefix("+")).join()), ("Size: " + ((obj.size()).to_english())) + " bytes (on disk)", "Manager: " + (.get_name(obj.manager(), 'namef, ['xref]))]; line = obj.writers('literal); if ((line.length()) != 1) line = "Writers: " + (line.to_english("(none)")); else line = "Writer: " + ((line[1]).namef('xref)); if (chop) line = line.chop(chop); out += [line]; line = (obj.trusted('literal)) || []; if (listlen(line)) { line = "Trusts: " + (line.to_english("(none)")); if (chop) line = line.chop(chop); out += [line]; } line = obj.parents(); if ((line.length()) > 1) line = "Parents: " + ((line.mmap('namef, 'xref)).to_english()); else if (!line) line = "Parents: (none)"; else line = "Parent: " + ((line[1]).namef('xref)); if (chop) line = line.chop(chop); out += [line]; if (obj.has_ancestor($located)) out += ["Location: " + (.get_name(obj.location(), 'namef, ['xref]))]; return out; }; public method .format_method_header() { arg obj, method, opt, flags, access; var f; if (access) { // shorten it a little access = tostr(access); access = strsub(access, "protected", "prot"); access = strsub(access, "public", "pub"); opt += ((opt ? " " : "") + "+access=") + access; } f = flags.join(","); // shorten it a little f = strsub(f, "nooverride", "noover"); if (f) opt += ((opt ? " " : "") + "+flags=") + f; return (((("@program " + obj) + ".") + method) + "() ") + opt; }; new object $integer: $libraries; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'variables, 'core]; var $root manager = $integer; var $integer ones = ["one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten"]; var $integer teens = ["eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen"]; var $integer tens = ["ten", "twenty", "thirty", "fourty", "fifty", "sixty", "seventy", "eighty", "ninety"]; var $root owned = [$integer]; var $root managed = [$integer]; public method .n_to_nth() { arg number; var tens_digit_is_1, ones_digit, single_digit; if (type(number) != 'integer) throw(~type, "Must receive an integer"); ones_digit = abs(number) % 10; tens_digit_is_1 = ((abs(number) / 10) % 10) == 1; single_digit = abs(number) < 10; if ((ones_digit in [1, 2, 3]) && (!tens_digit_is_1)) { switch (ones_digit) { case 1: return tostr(number) + "st"; case 2: return tostr(number) + "nd"; case 3: return tostr(number) + "rd"; } } else { return tostr(number) + "th"; } }; public method .parse_range() { arg range; var r1, r2, reg; if ("-" in range) { reg = regexp(range, "([0-9^#\.]+) *- *([0-9\$\.]+)"); return [(> ._range_type(reg[1]) <), (> ._range_type(reg[2]) <)]; } else { return [(> ._range_type(range) <), 'none]; } // ("1-5") => (1, 5) -- 1, 5 // ("1-$") => (1, 'end) -- 1, 'end (end number) // (".-3") => ('cur, 3) -- 'cur (current number), 3 // ("^-3") => ('bgn, 3) -- 'bgn (beginning number), 3 // ("#-3") => ('bgn, 3) -- 'bgn (beginning number), 3 }; public method .to_english() { arg num; var num_str, sign; // 12500 => "12,500" // if (abs(num) < 9999) // return tostr(num); sign = num ? abs(num) / num : 1; num = abs(num); num_str = ""; while (num > 999) { num_str = ("," + (tostr(1000 + (num % 1000)).subrange(2))) + num_str; num = num / 1000; } num_str = tostr(num) + num_str; return ((sign == 1) ? "" : "-") + num_str; }; public method .range() { arg x, y; var list, element; // creates a list of every number between x and y list = []; for element in [x .. y] list += [element]; return list; }; public method .to_string() { arg [args]; return (> tostr(@args) <); }; public method ._range_type() { arg type; switch (type) { case "0" .. "9": return toint(type); case "$": return 'end; case ".": return 'cur; case "#", "^": return 'bgn; default: throw(~invrange, ("Invalid range character \"" + type) + "\".", type); } }; public method .and(): native; public method .or(): native; public method .xor(): native; public method .shleft(): native; public method .shright(): native; public method .not(): native; public method .to_english_text() { arg number; var an, isneg, temp; an = abs(number); isneg = (number < 0) ? "negative " : ""; if (!number) return "zero"; if (an < 11) return isneg + (ones[an]); if (an < 20) return isneg + (teens[an - 10]); if (an < 100) return (isneg + (tens[an / 10])) + ((temp = an % 10) ? "-" + (temp.to_english_text()) : ""); if (an < 1000) return ((isneg + (ones[an / 100])) + " hundred") + ((temp = an % 100) ? " " + (temp.to_english_text()) : ""); if (an < 1000000) return ((isneg + ((an / 1000).to_english_text())) + " thousand") + ((temp = an % 1000) ? " " + (temp.to_english_text()) : ""); if (an < 1000000000) return ((isneg + ((an / 1000000).to_english_text())) + " million") + ((temp = an % 1000000) ? " " + (temp.to_english_text()) : ""); return ((isneg + ((an / 1000000000).to_english_text())) + " billion") + ((temp = an % 1000000) ? " " + (temp.to_english_text()) : ""); // $#Written by: Kipp }; new object $parse_lib: $libraries; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'variables, 'core]; var $parse_lib boolean_strs = [["yes", "true", "1", "on"], ["no", "false", "0", "off"]]; var $root manager = $parse_lib; var $root owned = [$parse_lib]; var $parse_lib ordinal = ["first", "second", "third", "fourth", "fifth", "sixth", "seventh", "eight", "ninth", "tenth"]; var $root managed = [$parse_lib]; public method .object_match() { arg name, [who]; var msg; // .object_match("name"[, who]) // -> 0 name was the empty string // -> ~objnf nothing matched name // -> ~ambig more than one object matched name // Attempt to match an object name with who.match_environment(). If one // is found, return it. Else, print a message and return one of the above // false values. // 'who' defaults to sender(). who = who ? who[1] : sender(); if (!name) { (| who.tell("You must give the name of something.") |); return 0; } catch ~objnf, ~ambig { return who.match_environment(name); } with { switch (error()) { case ~objnf: msg = ("I don't see any \"" + name) + "\" here."; case ~ambig: msg = ("I don't know which \"" + name) + "\" you mean."; } (| who.tell(msg) |); return error(); } }; public method .traceback() { arg traceback, [args]; var line, out, pre, lines, cur, x, error; // $parse_lib.traceback(traceback(), lines, pre); // -1 lines represents the full error // pre is set to "! " unless otherwise specified. [(lines ?= -1), (pre ?= "! "), (error ?= 0)] = args; // The initial string out = [(pre + "=> ") + ((traceback[1])[2])]; pre += " "; // The primary error if (error == 0) out += [(pre + "Thrown by ") + (._traceback(@(traceback[2]).subrange(2)))]; else out += [(((pre + "Error ") + error) + " caused by ") + (._traceback(@(traceback[2]).subrange(2)))]; // The rest of it for x in [1 .. (traceback.length()) - 2] { if ((x <= lines) || (lines == (-1))) { line = ((traceback[x + 2])[1]) + ": "; line += ._traceback(@(traceback[x + 2]).subrange(2)); out += [pre + line]; } } return out; }; public method ._traceback() { arg what, [more]; var line; if (more) { if ((more[1]) == (more[2])) return ((((more[1]) + ".") + what) + "() line ") + (more[3]); else return ((((((more[2]) + ".") + what) + "() (") + (more[1])) + ") line ") + (more[3]); } else { return what; } }; public method .range() { arg str; var out; out = split(str, " *- *"); if ((out.length()) == 1) { if ("," in str) return ['specific, str]; out = [(> ._range(str) <), 'single]; } else if ((out.length()) == 2) { out = out.replace(1, (> ._range(out[1]) <)); out = out.replace(2, (> ._range(out[2]) <)); } else { throw(~range, "Invalid range reference."); } return out; }; public method ._range() { arg str; if (str.is_numeric()) { return toint(str); } else { switch (str[1]) { case "$": return 'end; case ".": return 'current; case "^": return 'start; default: throw(~range, "Invalid range reference."); } } }; public method .getopt() { arg line, [defaults]; var out, newlist, part, v, opt, t, keys, key, x; // submit: [["template", value], [...]]; // => if value is 1, it will take the next part of the string // receive: [["template", "flag", bool, value]], [...]]; line = line.explode_quoted(); out = []; newlist = []; [(defaults ?= [])] = defaults; while (line) { [x, @line] = line; if ((x[1]) in ["-", "+"]) { opt = 0; v = ""; part = x.subrange(2); if ("=" in part) { part = part.explode("=", 1); [part, v] = part; } for t in (defaults) { if (part.match_template(t[1])) { opt = [t[1], part, (x[1]) == "+"]; if ((| t[2] |) && ((!v) && line)) { [v, @line] = line; if (v == "=") [(v ?= ""), @line] = line; } opt += [v]; } } if (!opt) opt = [0, part, (x[1]) == "+", ""]; out += [opt]; } else { newlist += [x]; } } return [newlist, out]; }; public method .buildref() { arg type, obj, def, name, [ignore]; var line; line = tostr(obj); if (obj != def) line += ("<" + def) + ">"; if (type == 'object) return line; if (type == 'method) return ((line + ".") + tostr(name)) + "()"; if (type == 'variable) return (line + ",") + tostr(name); }; public method .filter_ctext() { arg what, [defaults]; var dic, output; dic = ([@defaults, #[]][1]).union(#[['receiver, sender()], ['time, 'post], ['formatter, $text_format]]); switch (class(what)) { case $ctext_frob: output = (what.set_vars(dic)).format(); case $message_frob: output = what.format(dic); default: output = what; } return output; }; public method .ref() { arg str, [args]; var def, me, obj, reg, member, match, type, second; [(me ?= sender())] = args; if ((args.length()) > 1) match = args[2]; else match = [me, 'match_environment, []]; if (str == ".") { // shortcut obj = (> (match[1]).(match[2])("", @match[3]) <); return ['object, obj, obj, 0, 0]; } if ((reg = regexp(str, "^(.*)<([^>]*)>(.*)$"))) { def = (> (match[1]).(match[2])(reg[2], @match[3]) <); str = (reg[1]) + (reg[3]); } if ((reg = regexp(str, "([^\.,]*)([\.,]+)([^\( ]*)"))) { obj = reg[1]; member = reg[3]; type = reg[2]; if (((type.length()) > 1) && (((type[1]) == ".") && (!obj))) { type = type.subrange(2); obj = (> (match[1]).(match[2])("", @match[3]) <); } else { obj = obj ? (> (match[1]).(match[2])(obj, @match[3]) <) : me; } if ("." in type) { if ("," in type) second = 'variable; type = 'method; } else { type = 'variable; } } else { obj = (> (match[1]).(match[2])(str, @match[3]) <); type = 'object; } return [type, obj, def || obj, member, second]; }; public method .parse_method_access() { arg str; var t; for t in (["pub?lic", "pro?tected", "pri?vate", "r?oot", "dr?iver", "f?rob"]) { if (match_template(str, t)) return tosym(t.strip("?")); } return 'public; }; public method .parse_method_flags() { arg flags; var t, out, flag; out = []; for flag in (flags.explode(",")) { for t in (["no?override", "l?ocked", "f?orked", "na?tive"]) { if (match_template(flag, t)) out += [tosym(t.strip("?"))]; } } return out; }; public method .html_traceback() { arg t, status; var line, out, x; out = ("<h2>" + (((t[1])[2]).to_html())) + "</h2>"; out += ("<i><b>Thrown by " + (._html_traceback(@t[2]))) + "</b></i>\n<p>"; for x in [3 .. listlen(t)] out += ((("<code><i>" + ((t[x])[1])) + "</i>: ") + (._html_traceback(@t[x]))) + "</code><br>"; return $http.response(status, out + "</p>"); }; public method ._html_traceback() { arg type, what, [more]; var line; switch (type) { case 'function: return ("function <tt>" + what) + "()</tt>"; case 'opcode: return ("operator <tt>" + what) + "</tt>"; default: line = ((("method <tt>" + (more[2])) + ".") + tostr(what)) + "()</tt>"; if ((more[1]) != (more[2])) line = ((line + " (") + (more[1])) + ")"; line = (line + " line ") + (more[3]); return line; } }; public method .ordinal_reference() { arg str; var rx, num; if (!(rx = regexp(str, "^ *(first|second|third|fourth|fifth|sixth|seventh|eighth|ninth|tenth|1st|2nd|3rd|[456789]th|10th) *(.*)$"))) return 0; num = toint(rx[1]) || ((rx[1]) in ordinal); return [rx[2], num]; // Original code from LamdaMOO, Author Unknown }; public method .possessive_reference() { arg str; var rx; if ((rx = regexp(str, "^my$|^my +(.+)?"))) return ["me", (| rx[1] |) || ""]; else if ((rx = regexp(str, "^([^ ]+s?)'s? *(.+)?"))) return rx; return 0; }; public method .ordinal() { return ordinal; }; new object $code_lib: $libraries; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'variables, 'core]; var $code_lib quotes = [["\"Abandon all hope, ye who enter here.\""], ["\"Pull out Wedge, your not doing any more good back there.\"", "", "- Luke Skywalker, StarWars"], ["\"God is in the details.\""], ["\"I don't practice what I preach,", "because I'm not the type of person I'm preaching too.\"", "", "- Bob Dobbs"], ["\"I haven't shaved for six years.", "I seem to be cursed with a thin beard.\"", "", "- Calvin, Age 6 (of Calvin & Hobbes)"], ["\"I may be a Dreamer, but I'm not the only one.\"", "", "- John Lennon"], ["\"C code. C code run. Run, Code, Run! Please!?\"", "", "- Anonymous C hacker."], ["\"They who dream by day are cognizant of many things", "which escape those who dream only by night.\"", "", "- Edgar Allan Poe"], ["\"The good die first,", "and they whose hearts are dry as a summer dust", "burn to the socket.\"", "", "- William Wordsworth"], ["\"Banning guns to prevent murder", "is like banning word processors to prevent libel.\"", "", "- Unknown"], ["\"You will not be punished for your anger,", "you will be punished by your anger.\"", "", "- Buddha"], ["What part of:", "", "main() { printf(&unix[\"021%six0120\"],(unix)[\"have\"]+\"fun\"-0x60);}", "", "do you not understand?", "", "(taken from the 1987 Obfuscated C Code Contest)"], ["\"The goal of computer science is to build something that will", "last at least until we've finished building it.\""], ["\"Give me ambiguity or give me something else.\""], ["\"We are born naked, wet and hungry. Then things get worse.\""], ["\"Make it idiot proof and someone will make a better idiot.\""], ["\"Lottery: A tax on people who are bad at math.\""], ["\"There's too much blood in my caffeine system.\""], ["\"Artificial Intelligence usually beats real stupidity.\""], ["\"Ever notice how fast MS-Windows runs? Neither did I.\""], ["\"Very funny, Scotty. Now beam down my clothes.\""], ["\"Consciousness: that annoying time between naps.\""], ["\"The gene pool could use a little chlorine.\""], ["\"When there's a will, I want to be in it.\""], ["\"Change is inevitable, except from a vending machine.\""], ["\"MS-Windows is a virus:", "it takes over your computer and makes it run bad.\""], ["\"I have not failed 10,000 times,", "I have sucessfully found 10,000 ways that do not work.\"", "- Thomas Edison"], ["\"The difference between literature and journalism is", "that journalism is unreadable and literature is not read.\"", "", "- Oscar Wilde (1854-1900)"], ["\"The man who reads nothing at all is better educated", "than the man who reads nothing but newspapers.\"", "", "- Thomas Jefferson (1743-1826)"], ["\"In the mind of the beginner, there are many possibilities.", "In the mind of the expert there are few.\"", "", "- Shunryu Suzuki"], ["\"Time is a great teacher, but unfortunately it kills all of its pupils.\"", "", "- Hector Berlioz"], ["\"After I'm dead I'd rather have people ask", "why I have no monument, than why I have one.\"", "", "- Cato the Elder (234-249 B.C.)"], ["\"I loathe people who keep dogs. They are cowards who haven't", "got the guts to bite people themselves.\"", "", "-August Strindberg"], ["\"By the time I'd grown up, I natrually supposed that I'd be grown up.\"", "", "-Eve Babitz"], ["\"Every place has a spirit:", "it may be good, it may be bad", "it can be restful as eternity.", "This place-spirit can inhabit a book, a house, a town, a valley;", "the nature of the spirits is they remain.\"", "", "- William S. Burroughs"], ["\"I have never been lost... but I will admit to being confused for several weeks.\"", "", "- Daniel Boon"], ["Time is what keeps things from happening all at once."], ["According to my calculations the problem doesn't exist."], ["Forget about World Peace ... visualize using your turn signal."], ["Ever stop to think, and forget to start again?"], ["Diplomacy is the art of saying \"nice doggie!\"...till you can find a rock."]]; var $root manager = $code_lib; var $root owned = [$code_lib]; var $root managed = [$code_lib]; public method .quotes() { return quotes; }; public method .add_random_quote() { arg quote, [from]; if (!($sys.is_admin(sender()))) throw(~perm, "Sender is not an admin"); if (type(quote) != 'string) throw(~type, "Quote must be given as a string."); quote = ("\"" + quote) + "\""; quote = $string.wrap_line(quote, 70); quote = from ? [@quote, " - " + (from[1])] : quote; quotes += [quote]; }; public method .generate_listing() { arg who, [args]; var meths, header, title, i; // called by one of the who_cmds, does all the grunge work. [(title ?= "Connected Users"), (meths ?= [['namef, 'doing], ['connected_time], ['idle_time], ['realm_name]]), (header ?= ["Name", "On for", "Idle", "Location"])] = args; header = map i in (header) to ([i, "".pad(i.length(), "-")]); // if who is empty, only print header if (!who) return [("--- " + title) + " (0) ---"]; // get values using $list.mmap and format return ["--- %l (%l) ---".format(title, who.length()), @map i in (meths) to (who.mmap(@i)).tabulate(header, 0, 1, " ", (| sender().linelen() |) || 79), "---"]; }; public method .random_quote() { var which; which = random(quotes.length()); if (which) return quotes[which]; return []; }; public method .valid_email() { arg email; var host, user, ip, tmp; email = email.explode("@"); if ((email.length()) != 2) return ['invalid, email, ""]; [user, host] = email; // if you want it to lookup the names, remove this return // when .hostname() and .ip() don't block this is a viable option return ['valid, user, host]; if (!host) return ['invhostname, user, host]; if (toint(host[1])) { tmp = $network.hostname(host); if (tmp == "-1") return ['invip, user, host]; } else { tmp = $network.ip(host); if (tmp == "-1") return ['invhostname, user, host]; } return ['valid, user, host]; }; public method .unparse_command() { arg command; var x, line; // command should be passed as a list, and can either be a command // or shortcut. This will return a string. if ((command.length()) == 2) return toliteral(command[1]); line = ""; for x in (command[3]) { if (type(x) == 'string) line = (line + (line ? " " : "")) + x; else line = ((line + (line ? " " : "")) + "%") + tostr(x); } return ((("\"" + (command[1])) + "\" => \"") + line) + "\""; }; public method .parse_name() { arg name; var article, args, flag; // used to parse $has_name names and name templates [name, flag] = $parse_lib.getopt(name, [["u?nique"], ["p?roper"], ["n?ormal"]]); name = name.join(); flag = (| flag.last() |) || ["p?roper", "p", 1, ""]; switch (flag[1]) { case "n?ormal": article = 'normal; case "u?nique": article = 'uniq; default: article = 'prop; } name = name.explode(","); return [[name[1], article], name.subrange(2)]; }; public method .random_word() { arg [args]; var x, out, min, max, con, vow, flag, lcon, lvow, extra; [(min ?= 5), (max ?= 9), (extra ?= "")] = args; x = random(max - min) + min; out = ""; con = "bcdfghjklmnpqrstvwxz" + extra; vow = "aeiouy"; lcon = con.length(); lvow = vow.length(); while ((out.length()) < x) { if (!flag) out += con[random(lcon)]; else out += vow[random(lvow)]; flag = !flag; } return out; }; public method .punctuation_type() { arg str; var end; end = str.length(); switch (str[end]) { case "!": return "exclaim"; case "?": return "ask"; case ".": return "say"; case ")": if (end > 1) { switch (str[end - 1]) { case ";": return "wink"; case ":": return "smile"; case "8": return "grin"; default: return "say"; } } case "(": if ((end > 1) && ((str[end - 1]) in [":", "8"])) return "frown"; } return "say"; }; public method .verify_code() { arg code, method, warn; var l, line, m, warns, isadmin, msg; warns = []; method = ("\." + tostr(method)) + "\("; isadmin = sender().is($admin); for l in [1 .. code.length()] { line = code[l]; // if its in a comment, ignore it if (match_begin(line, "//")) continue; // required warnings, sorry if ((m = line.match_regexp("[^._]anticipate_assignment\("))) warns += .point_to_line("WARNING: call to anticipate_assignment()", ((m[1])[1]) + 2, ((m[1])[2]) - 2, l, line); if ((m = line.match_regexp("(!)[a-z0-9_]+ in "))) { warns += ["WARNING: possible ambiguity, line " + l]; warns += .point_to_line("WARNING: parenthesis suggested around followup expression to '!'", ((m[2])[1]) + 1, (m[2])[2], l, line); } if ((m = line.match_regexp("(if *\(|&&|\|\|) *[a-z0-9_]+ *(=)[^=]"))) warns += .point_to_line("WARNING: parenthesis suggested around assignment expression", ((m[3])[1]) + 1, (m[3])[2], l, line); // optional warnings if (warn && (m = line.match_regexp(method))) warns += .point_to_line("WARNING: Possible Recursion", ((m[1])[1]) + 2, ((m[1])[2]) - 2, l, line); } return warns; }; public method .generate_object_listing() { arg objs, multi, [args]; var line, obj, col, name, fmt, out; if (!objs) { out = ["** None **"]; } else { col = ((| sender().linelen() |) || 79) / 10; fmt = ((((("%3L%" + tostr(col * 4)) + "L %") + tostr(col)) + "L %") + tostr(col)) + "R "; out = [strfmt(fmt, "#", "Name", "Perms", "Size") + "Manager"]; col = col * 4; for obj in (objs) { line = strfmt(fmt, obj.(multi)(@args).length(), obj.namef('xref), $object_lib.see_perms(obj, ["", ""]), obj.size()); name = (obj.manager()).namef('xref); if ((name.length()) > col) name = name.pad(col); out += [line + name]; } } return out; }; public method .point_to_line() { arg err, left, right, lineno, line; var out; return [((err + ", line ") + lineno) + ":", " " + line, strfmt("%*{-}l%*{^}l", left, "", right, "")]; }; public method ._debug_listing() { arg list; var indent, i, out, t, j; indent = ""; out = [" Tick# Event", " ----- -----------------------------"]; t = 0; for i in (list) { if (type(i) == 'integer) { if (indent) indent = indent.subrange(3); out += [strfmt("%6r %lreturn", i - t, indent)]; } else { if (!t) t = i[1]; j = strfmt("%6r %l%l(%l)", (i[1]) - t, indent, ._show_ref(i), (toliteral(i[5]).match_pattern("[*]"))[1]); out += [j.chop(79)]; indent += " "; } } return out; }; public method .generate_debug_listing() { arg info, mode; return .(tosym(("_" + tostr(mode)) + "_listing"))(info); }; public method ._trace_listing() { arg list; var indent, i, out, t, j; indent = ""; out = [" Tick# Event", " ----- -----------------------------"]; t = 0; for i in (list) { if (type(i) == 'integer) { if (indent) indent = indent.subrange(3); } else { if (!t) t = i[1]; j = strfmt("%6r %l%l", (i[1]) - t, indent, ._show_ref(i)); out += [j.chop(79)]; indent += " "; } } return out; }; public method ._trace_profile() { arg list; var i, out, ref, times, sums, callers, t, tic, max, start; out = ["Object<definer>.method Tics (%) Cummul. (%)"]; times = #[]; sums = #[]; callers = []; for i in (list) { refresh(); if (type(i) == 'integer) { if (callers) { [[ref, tic], @callers] = callers; times = times.add(ref, (((| times[ref] |) || 0) + (i[1])) - t); sums = sums.add(ref, (((| sums[ref] |) || 0) + (i[1])) - tic); } t = i; } else { if (callers) { ref = (callers[1])[1]; times = times.add(ref, (((| sums[ref] |) || 0) + (i[1])) - t); } ref = strfmt("%l<%l>.%l", i[2], i[3], i[4]); callers = [[ref, i[1]], @callers]; t = i[1]; } start ?= t; } max = 0.01 * (t - start); out = map i in (times.keys()) to (refresh() && [i, times[i], (times[i]) / max, sums[i], (sums[i]) / max]); out = out.sort(out.slice(2)); out = map i in (out) to (strfmt(i, "%50l%7r%7r%7r%7r")); return out; }; public method ._profile_listing() { arg list; var i, out, ref, times, sums, callers, t, tic, max, start, head; head = ["Object<definer>.method Tics (%) Total (%)", "---------------------- ---- --- ----- ---"]; times = #[]; sums = #[]; callers = []; for i in (list) { refresh(); if (type(i) == 'integer) { if (callers) { [[ref, tic], @callers] = callers; times = times.add(ref, (((| times[ref] |) || 0) + i) - t); if (!(ref in callers)) sums = sums.add(ref, (((| sums[ref] |) || 0) + i) - tic); } t = i; } else { if (callers) { ref = (callers[1])[1]; times = times.add(ref, (((| times[ref] |) || 0) + (i[1])) - t); } ref = ._show_ref(i); callers = [[ref, i[1]], @callers]; t = i[1]; } start ?= t; } max = 0.01 * (t - start); out = map i in (times.keys()) to (refresh() && [i.chop(50), times[i], (times[i]) / max, sums[i], (sums[i]) / max]); out = out.sort(map i in (out) to (-(i[2]))); out = map i in (out) to (strfmt("%50l%7r%6.1r%%%7r%6.1r%%", @i)); out = head + out; return out; }; public method ._show_ref() { arg i; return ((i[2]) != (i[3])) ? strfmt("%l<%l>.%l()", i[2], i[3], i[4]) : strfmt("%l.%l()", i[2], i[4]); }; new object $list: $libraries; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'variables, 'core]; var $root manager = $list; var $root help_node = $help_node_list; var $root owned = [$list]; var $root managed = [$list]; public method .to_english() { arg list, [options]; var empty, and, sep; [(empty ?= "nothing"), (and ?= " and "), (sep ?= ", ")] = options; switch (list.length()) { case 0: return empty; case 1: return tostr(list[1]); } return (join(list.delete(list.length()), sep) + and) + tostr(list[list.length()]); }; public method .mmap() { arg list, method, [args]; var x; // call 'method on each object, return results. return map x in (list) to (x.(method)(@args)); }; public method .mfilter() { arg list, method, [args]; var x; // similar to .mmap, but returns a list of objects which returned a // true value from 'method. return filter x in (list) where (x.(method)(@args)); }; public method .sort(): native; public method .columnize() { arg list, cols, [rest]; var width, lines, line, separator, linelength, curcol; // turn [...] into ". . ." // rest[1]==separator; rest[2]==linelength [(separator ?= " "), (linelength ?= 78)] = rest; width = (linelength / cols) - (separator.length()); lines = []; while (list) { line = (list[1]).pad(width); list = list.subrange(2); for curcol in [2 .. cols] { if (list) { line = (line + separator) + ((list[1]).pad(width)); list = list.subrange(2); } } lines += [line]; } return lines; }; public method .reverse() { arg list; var i, len; // .reverse(list) // -> list with its elements reversed len = (list.length()) + 1; return map i in [1 .. len - 1] to (list[len - i]); }; public method .compress() { arg list; var x; // [a,a,b,b,c,c,d,d] => [a,b,c,d] // removes duplicate entries in a list return hash x in (list) to ([x, 1]).keys(); }; public method .last() { arg list; return list[listlen(list)]; }; public method .count() { arg list, elem; var count, i; // count of elem in list for i in (list) { if (i == elem) count++; } return count; }; public method .element_maxlength() { arg list; var i, s, t; s = 0; for i in (list) { if ((t = strlen(tostr(i))) > s) s = t; } return s; }; public method .nth_element_maxlength() { arg lists, element; var list; // Returns longest string whose index is element in one of the lists in // lists. if (type(element) != 'integer) throw(~type, "Second argument is not an integer"); if (type(lists) != 'list) throw(~type, "First argument is not a list"); return map list in (lists) to (tostr(list[element]).length()).max(); }; public method .numbered_text() { arg text; var line; // receives a list of strings, returns that list with line numbers // prepended return map line in [1 .. text.length()] to ("%3r: %l".format(line, text[line])); }; public method .slice() { arg big_list, element; var list, i; // Return elementh' element of all lists in big_list // No type or length checking done for speed purposes. // element can be a list, in which cases, a list of list is returned if (type(element) == 'integer) return map list in (big_list) to (list[element]); else return map list in (big_list) to (map i in (element) to (list[i])); }; public method .swap() { arg list, a, b; var holder; // swap elements at indexes a and b if ((listlen(list) <= a) || ((listlen(list) <= b) || ((a < 1) || (b < 1)))) throw(~args, "Index specifiers are outside the range of the list."); anticipate_assignment(); holder = list[a]; list = replace(list, a, list[b]); list = replace(list, b, holder); return list; }; public method .max() { arg list; return (| max(@list) |) || 0; }; public method .min() { arg list; return (| min(@list) |) || 0; }; public method .lcolumnize() { arg list, [args]; var line, part, lines, max, cols, col, width, len, sep; [(len ?= (| sender().linelen() |) || 78), (sep ?= " ")] = args; lines = []; line = ""; max = (.element_maxlength(list)) + (sep.length()); cols = (len > max) ? len / max : 1; width = (len / cols) - (sep.length()); col = cols; for part in (list) { col = col - 1; if (!col) { lines = lines + [line + part]; line = ""; col = cols; continue; } line = line + (part.pad(width)); } if (line) return lines + [line]; return lines; }; public method .mmap_objects() { arg list, method, [args]; var x; return map x in (list) to ((type(x) == 'objnum) ? x.(method)(@args) : x); }; public method .map_to_english() { arg list, method, [args]; return .to_english(.mmap(list, method, @args)); }; public method .map_to_string() { arg list, method, [args]; return .join(.mmap(list, method, @args)); }; public method .flatten() { arg list; var toret, elem; // [[[x], x], x] => [x, x, x] toret = []; for elem in (list) { if (type(elem) == 'list) toret += .flatten(elem); else toret += [elem]; } return toret; }; public method .sum() { arg data; var ret, i; // returns a sum of each element in the list. [ret, @data] = data; for i in (data) ret += i; return ret; }; public method .numbers() { // returns a list of numbers return ["one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten"]; }; public method .center_lines() { arg lines, width, [args]; var line, fmt; fmt = ("%" + width) + "c"; return map line in (lines) to (strfmt(fmt, line)); }; public method .to_buffer() { arg [args]; return (> strings_to_buf(@args) <); }; public method .delete(): native; public method .replace(): native; public method .chop() { arg list, [count]; // chops the last <count> elements off the list. // return [] if count is longer then the list. count = count || 1; anticipate_assignment(); return (| sublist(list, 1, listlen(list) - count) |) || []; }; public method .join(): native; public method .lmap() { arg list, method, [args]; var x, s; // call methods for each thing in list on sender() s = sender(); return map x in (list) to (s.(method)(x, @args)); }; public method .length(): native; public method .union(): native; public method .omap() { arg list, object, method, [args]; var obj; // calls object.method(obj, @args) for each obj in list return map obj in (list) to (object.(method)(obj, @args)); }; public method .del() { arg list, element; return (> setremove(list, element) <); }; public method .add() { arg list, element; return (> setadd(list, element) <); }; public method .set_difference() { arg [args]; var set, list, element; // Usage: diff(set 1, set 2, ..., set n) // Returns all elements of set 1 that are not in sets 2..n if (!args) return []; set = args[1]; anticipate_assignment(); for list in (delete(args, 1)) { for element in (list) set = setremove(set, element); } return set; }; public method .set_contains() { arg [args]; var super, list, element; // True if the first list given is a superset of all subsequent lists. // False otherwise. [] is a superset of [] and nothing else; anything is // a superset of []. If only one list is given, return true. super = args ? args[1] : []; for list in (delete(args, 1)) { for element in (list) { if (!(element in super)) return 0; } } return 1; }; public method .set_equal() { arg set1, set2; var e, dict1, dict2; // True if the two lists given contain the same elements. // False otherwise. dict1 = hash e in (set1) to ([e, 1]); dict2 = hash e in (set2) to ([e, 1]); for e in (dict1.keys()) { if (!dict_contains(dict2, e)) return 0; } for e in (dict2.keys()) { if (!dict_contains(dict1, e)) return 0; } return 1; }; public method .fold() { arg list, object, method, [args]; var i, out; // apply object.method to a current result and the next element, return the // result switch (list.length()) { case 0: return 0; case 1: return list[1]; } out = list[1]; for i in (sublist(list, 2, listlen(list) - 1)) out = object.(method)(out, i, @args); return out; }; public method .setadd(): native; public method .set_intersection() { arg l1, l2; var i, out; // set intersection if the arguments out = []; for i in (l1) { if (i in l2) out = out.setadd(i); } return out; }; public method .setremove(): native; public method .insert(): native; public method .subrange(): native; public method .prefix() { arg list, prefix; var elem; return map elem in (list) to (prefix + elem); }; public method .valid_objects() { arg list; var obj; return filter obj in (list) where (valid(obj)); }; public method .grep() { arg lines, regexp; var line, result, out, reg; out = []; for line in [1 .. lines.length()] { if ((reg = match_regexp(lines[line], regexp))) out += [[line, reg, lines[line]]]; } return out; }; public method .vcolumnize() { arg list, cols, [rest]; var linelength, sep, width, lines, i, j, line, outlist; [(linelength ?= (| sender().linelen() |) || 78), (sep ?= " ")] = rest; lines = ((list.length()) / cols) + (((list.length()) % cols) ? 1 : 0); width = linelength / cols; return ._vcolumnize(list, lines, cols, width, sep); }; public method .make() { arg n, [elt]; var i; [(elt ?= 0)] = elt; return map i in [1 .. n] to (elt); }; public method ._vcolumnize() { arg list, lines, cols, width, [other]; var outlist, line, i, j, sep; [(sep ?= " ")] = other; width -= sep.length(); lines = (lines > (list.length())) ? list.length() : lines; outlist = []; for i in [1 .. lines] { line = (list[i]).pad(width); for j in [1 .. cols] (| (line = (line + sep) + ((list[i + (j * lines)]).pad(width))) |); outlist += [line]; } return outlist; }; public method .affix() { arg l1, l2; var last, first; // Combines l1 and l2 by appending the first element of l2 to the last // of l1. if (type(l2) != 'list) l2 = [l2]; last = (| l1.last() |) || ""; first = (| l2[1] |) || ""; l1 = [@l1.chop(), last + first]; if ((l2.length()) > 1) l1 += l2.subrange(2); return l1; }; public method .addkey() { arg l, key, val; var i; i = find i in [1 .. l.length()] where (((l[i])[1]) == key); anticipate_assignment(); return i ? replace(l, i, [key, val]) : (l + [[key, val]]); }; public method .delkey() { arg l, key; var i; i = find i in [1 .. l.length()] where (((l[i])[1]) == key); anticipate_assignment(); return i ? delete(l, i) : l; }; public method .getkey() { arg l, key; var i, x; if (!(x = find i in [1 .. l.length()] where (((l[i])[1]) == key))) throw(~keynf, "Key not found."); return (l[x])[2]; }; public method .getkey_index() { arg l, key; var i, x; if (!(x = find i in [1 .. l.length()] where (((l[i])[1]) == key))) throw(~keynf, "Key not found."); return x; }; public method .setremove_all() { arg list, remove; var part; if (type(list) != 'list) throw(~type, "First argument must be a list."); if (type(remove) != 'list) throw(~type, "Second argument must be a list."); anticipate_assignment(); for part in (remove) list = setremove(list, part); return list; }; public method .vcolumnize2() { arg list, lines, [rest]; var linelength, sep, cols, width, i, j, line, outlist; [(linelength ?= (| sender().linelen() |) || 78), (sep ?= " ")] = rest; cols = ((list.length()) / lines) + (((list.length()) % lines) ? 1 : 0); width = linelength / cols; return ._vcolumnize(list, lines, cols, width, sep); }; public method .vcolumnize3() { arg list, lines, [rest]; var linelength, cols, width, i, j, line, outlist; [(linelength ?= (| sender().linelen() |) || 78)] = rest; cols = ((list.length()) / lines) + (((list.length()) % lines) ? 1 : 0); width = linelength / cols; outlist = []; for i in [1 .. lines] { line = ""; for j in [0 .. cols] (| (line = line + ((list[i + (j * lines)]).pad(width))) |); outlist += [line]; } return outlist; }; public method .vcolumnize4() { arg list, [args]; var linelength, sep, lines, cols, width, max; [(linelength ?= (| sender().linelen() |) || 79), (sep ?= " ")] = args; max = (.element_maxlength(list)) + (sep.length()); cols = (linelength > max) ? linelength / max : 1; width = linelength / cols; lines = ((list.length()) / cols) + (((list.length()) % cols) ? 1 : 0); return ._vcolumnize(list, lines, cols, width, sep); }; public method .random() { arg list; return list[random(listlen(list))]; }; public method .to_dict() { arg list; var a; return hash a in (list) to (a); }; public method .match_nth() { arg objs, str, nth; var obj, n; n = nth; for obj in (objs) { if (obj.match_name(str)) { if (!--n) return obj; } } throw(~match, ((("There are not " + ((.numbers())[nth])) + " ") + str) + "'s available."); }; public method .match_object() { arg objs, str; var obj, found; found = []; for obj in (objs) { if (obj.match_name(str)) found += [obj]; } if (listlen(found) == 1) return found[1]; if (listlen(found) > 1) throw(~ambig, "ambiguous match", found); throw(~objnf, "Object not found."); }; public method .tabulate() { arg list, headers, [rest]; var i, j, t, t1, trim_cols, header_sep, colsizes, len; if (!list) return []; [(colsizes ?= 0), (trim_cols ?= 0), (header_sep ?= " "), (len ?= 79)] = rest; if (!headers) headers = .make(list.length(), []); if (type(headers[1]) == 'string) headers = map i in (headers) to ([i]); // Find the column sizes if (!colsizes) { if (trim_cols) { t = map i in (list) to (refresh() && ((i.element_maxlength()) + 2)); t1 = filter i in [1 .. t.length()] where ((t[i]) > 2); t = map i in (t1) to (t[i]); list = map i in (t1) to (list[i]); headers = map i in (t1) to (headers[i]); } colsizes = t ? map i in [1 .. headers.length()] to (refresh() && max(t[i], ((headers[i]).element_maxlength()) + 2)) : map i in [1 .. list.length()] to (refresh() && (max((headers[i]).element_maxlength(), (list[i]).element_maxlength()) + 2)); } t = map i in (colsizes) to (("%" + i) + "l").sum(); t1 = map i in (colsizes) to (((("%" + i) + "{") + header_sep) + "}l").sum(); // Now format the thing... return map i in (headers.transpose()) to (refresh() && ((t1.format(@i)).pad(len))) + map i in (list.transpose()) to (refresh() && ((t.format(@i)).pad(len))); }; public method .transpose() { arg list; return $math.transpose(list); }; public method .english_name_list() { arg list, [method]; var m, o, args; [(m ?= 'name)] = method; if (listlen(method) > 1) args = sublist(method, 2); else args = []; return map o in (list) to ((type(o) == 'objnum) ? o.(m)(@args) : o).to_english(); }; new object $help_lib: $libraries; var $root manager = $help_lib; var $root created_on = 805931416; var $root inited = 1; var $root flags = ['methods, 'code, 'variables, 'core]; var $help_lib default_node = $help_core; var $root managed = [$help_lib]; var $root owned = [$help_lib]; var $help_lib indices = [$help_index_core, $help_index_cmds, $help_index_driver, $help_index_subsystem, $help_index_function, $help_index_objects]; public method .default_node() { return default_node; }; public method .history_cap() { return 15; }; public method .group_nodes_in_html() { arg nodes, noemph, [args]; var name, names, n; names = []; for n in (nodes) { if (n in noemph) name = n.name(); else name = .node_name_in_html(n); names += [name]; } return names.to_english(@args); }; public method .node_name_in_html() { arg node; return ((("<a href=\"/bin/help?" + node) + "\">") + (node.name())) + "</a>"; }; public method .indices() { return indices; }; public method .set_indices() { arg [new]; var o; (> .perms(sender()) <); if (filter o in (new) where ((type(o) != 'objnum) || (!(o.is($help_index))))) throw(~type, "Arguments must be $help_index objects."); // do this all at once so you can manage the order indices = new; }; new object $misc: $core; var $root child_index = 37; var $root fertile = 1; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'fertile, 'core, 'variables]; var $root manager = $misc; var $root managed = [$misc]; var $root owned = [$misc]; new object $mail_root: $misc; var $root child_index = 2; var $root fertile = 1; var $root trusted = []; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'fertile, 'core, 'variables]; var $root manager = $mail_root; var $root owned = [$mail_root]; var $root managed = [$mail_root]; new object $mail_list: $mail_root, $has_name; var $root child_index = 2; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'core, 'variables]; var $has_name name = ['uniq, "mail_list", "the mail_list"]; var $mail_list notify = [$mail_list]; var $mail_list last_received_on = 0; var $mail_list senders = 1; var $mail_list mail = []; var $mail_list readers = 1; var $root trusted_by = [$mail_db]; var $root manager = $mail_list; var $root managed = [$mail_list]; var $root owned = [$mail_list]; public method .del_sender_from_notification() { var who; who = sender(); if (!(who.has_ancestor($user))) throw(~type, "Sender is not a user."); if (!(.has_flag('sender, who))) throw(~perm, ((who.name()) + " cannot read ") + (.mail_name())); notify = notify.setremove(who); }; public method .add_sender_to_notification() { var who; who = sender(); if (!(who.has_ancestor($user))) throw(~type, "Sender is not a user."); if (!(.has_flag('sender, who))) throw(~perm, ((who.name()) + " cannot read ") + (.mail_name())); notify += [who]; }; public method .list_is_sendable_by() { arg who; if (.is_writable_by(who)) return 1; if (type(senders) == 'list) return who in senders; return senders; }; public method .list_is_readable_by() { arg who; if (.is_writable_by(who)) return 1; if (type(readers) == 'list) return who in readers; return readers; }; public method .set_name() { arg new_name, [args]; var old_name; old_name = .name(); if (new_name && ((new_name[1]) == "*")) new_name = new_name.subrange(2); (> pass(new_name, @args) <); (| $mail_db.key_changed(old_name, new_name) |); }; public method .start() { if (!(.list_is_readable_by(sender()))) throw(~perm, ("Sender cannot read " + (.mail_name())) + "."); if (mail) return mail[1]; return 0; }; public method .last_received_on() { return last_received_on; }; public method .recent_mail() { arg [diff]; if (!(.list_is_readable_by(sender()))) throw(~perm, ("Sender cannot read " + (.mail_name())) + "."); [(diff ?= 20)] = diff; if ((mail.length()) < diff) return [0, mail]; return [((mail.length()) - diff) - 1, mail.subrange((mail.length()) - diff)]; }; public method .set_notify() { arg new_value; (> .perms(sender(), 'manager) <); if ((type(new_value) != 'integer) && (type(new_value) != 'list)) throw(~type, "new value must be submitted as a list of users or boolean integer."); notify = new_value; }; public method .set_senders() { arg new_value; (> .perms(sender(), 'manager) <); if ((type(new_value) != 'integer) && (type(new_value) != 'list)) throw(~type, "new value must be submitted as a list of users or boolean integer."); senders = new_value; }; public method .notify() { (> .perms(sender(), 'manager) <); return notify; }; public method .del_mail() { arg old_mail, [sender]; // what the hell am I thinking? [(sender ?= sender())] = sender; if (!($mail_lib.has_mail_perms(caller()))) throw(~perm, ((caller().namef('xref)) + " cannot remove ") + (old_mail.mail_name())); (| old_mail.del_recipient(this()) |); mail = mail.del(old_mail); // $# Edited 23 Oct 1995 12:12 Lynx ($lynx) }; protected method ._announce_new_mail() { arg new_mail; var line, who, n; if (!notify) return; line = ((((.mail_name()) + " has been sent new mail by ") + ((new_mail.from()).name())) + ": ") + (new_mail.subject()); for who in (notify) (| who.tell(line.chop(who.linelen())) |); // $# Edited 05 Nov 1995 14:04 Lynx ($lynx) }; public method .mail() { // if (!.list_is_sendable_by(sender())) // throw(~perm, "Sender cannot read " + .mail_name() + "."); return mail; }; public method .add_mail() { var new_mail; (> .perms(caller(), $mail_message) <); last_received_on = time(); new_mail = sender(); // make sure we do not already have it if (new_mail in mail) return; // add it mail = mail.add(new_mail); ._announce_new_mail(new_mail); }; public method .senders() { (> .perms(sender(), 'manager) <); return senders; }; public method .mail_name() { return $mail_lib.mail_name(this()); }; root method .init_mail_list() { mail = []; senders = 1; readers = [.manager()]; notify = [.manager()]; if (!(.has_ancestor($user))) { readers = 1; (| $mail_db.insert(.name(), this()) |); } else { readers = [.manager()]; } }; root method .uninit_mail_list() { var m; for m in (mail) .del_mail(let[1]); mail = []; senders = 1; readers = [.manager()]; notify = []; if (!(.has_ancestor($user))) (| $mail_db.remove(.name()) |); }; public method .mail_list_next() { arg cur; if (!(.list_is_readable_by(sender()))) throw(~perm, "Sender cannot read this list."); return mail[(cur in mail) + 1]; }; public method .mail_list_prev() { arg cur; if (!(.list_is_readable_by(sender()))) throw(~perm, "Sender cannot read this list."); return mail[(cur in mail) - 1]; }; public method .notify_bad_mail() { arg badmail; // this is a hack, we shouldn't ever get bad mail if things worked right (> .perms(caller(), $mail_ui) <); mail = setremove(mail, badmail); }; new object $mail_ui: $mail_list, $user_interfaces; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'core, 'variables]; var $mail_ui subscribed = #[]; var $mail_ui current = 0; var $mail_list letters = #[]; var $mail_list letters_index = #[]; var $mail_list senders = 1; var $mail_list readers = []; var $mail_list notify = [$mail_ui]; var $mail_list last_letter = 0; var $mail_list mail = []; var $has_commands local = #[["@sub?scribed", [["@sub?scribed", "*", "@sub?scribed <any>", 'subscribe_cmd, #[[1, ['any, []]]]]]], ["@unsub?scribed", [["@unsub?scribed", "*", "@unsub?scribed <any>", 'unsubscribe_cmd, #[[1, ['any, []]]]]]], ["@mail-list?s", [["@mail-list?s", "", "@mail-list?s", 'mail_lists_cmd, #[]]]], ["@read", [["@read", "*", "@read <any>", 'mail_read_cmd, #[[1, ['any, []]]]]]], ["@remove-m?ail|@rmm?ail", [["@remove-m?ail|@rmm?ail", "*", "@remove-m?ail|@rmm?ail <any>", 'mail_remove_cmd, #[[1, ['any, []]]]]]], ["@nn|@next-new", [["@nn|@next-new", "*", "@nn|@next-new <any>", 'next_new_cmd, #[[1, ['any, []]]]]]], ["@mail", [["@mail", "*", "@mail <any>", 'mail_on_cmd, #[[1, ['any, []]]]]]], ["@send", [["@send", "*", "@send <any>", 'send_to_cmd, #[[1, ['any, []]]]]]]]; var $has_commands shortcuts = #[]; var $has_name name = ['prop, "Mail User Interface", "Mail User Interface"]; var $root manager = $mail_ui; var $root managed = [$mail_ui]; var $root owned = [$mail_ui]; protected method .send_to_cmd() { arg cmdstr, cmd, str; var subj, lists, note, list, x, mail, text, args; (> .perms(caller(), $user) <); if ((args = match_template(str, "* to *"))) { note = args[1]; args = args[3]; } else { note = ""; args = str; } if (args) { lists = []; for list in (args.explode_english_list()) { catch ~listnf { list = (> $mail_lib.match_mail_recipient(list) <); lists += [list]; } with { .tell(("The list \"" + list) + "\" is invalid."); } } if (!lists) return "No lists specified."; } else { lists = [current['list]]; } // get the text of the message if (note) { text = (> (.match_env_nice(note)).text() <); } else { text = .read("-- Enter text for mail message, \".\" when done or \"@abort\" to abort --"); if (text == 'aborted) return; if (text == 'engaged) return "** Already reading - mail send aborted **"; } subj = .prompt("Subject: "); if (subj == "@abort") return "** Aborted mail send **"; if (subj == 'engaged) return "** Already reading - mail send aborted **"; mail = $mail_message.new_mail(); mail.set_subject(subj); mail.set_text(text); catch any mail.send(@lists); with return (traceback()[1])[2]; return "Mail sent."; }; protected method .mail_read_cmd() { arg cmdstr, cmd, str; var mail, m, args, lname, list, rng, args; (> .perms(caller(), $user) <); if ((args = match_template(str, "* on *"))) { rng = args[1]; catch ~listnf list = (> $mail_lib.match_mail_recipient(args[3]) <); with return (traceback()[1])[2]; } else { rng = str; list = current['list]; } catch ~perm (> .new_list(list) <); with return (traceback()[1])[2]; if (((list.mail()).length()) == 0) return ("There is no mail on " + (list.mail_name())) + "."; if (!rng) return ("You must specify a message to read on " + (list.mail_name())) + "."; catch ~range { if (rng == "next") { .read_mail((> list.mail_list_next((subscribed[list])[2]) <), list); } else if (rng == "prev") { .read_mail((> list.mail_list_prev((subscribed[list])[2]) <), list); } else { for m in ($mail_lib.range_to_actual($parse_lib.range(rng), current)) .read_mail(m, list); } } with { return ((("Mail message " + rng) + " does not exist on ") + (list.mail_name())) + "."; } }; protected method .mail_remove_cmd() { arg cmdstr, cmd, str; var mail, args, lmail, list, rng, m, x, name, lname, offset, ans; (> .perms(caller(), $user) <); if ((args = match_template(str, "* on|from *"))) { rng = args[1]; list = args[3]; } else if (!str) { return "You must specify a message and list."; } else { // grr, be hacky args = explode(str); if ((args.length()) > 1) { list = args.last(); if (!(| $mail_lib.match_mail_recipient(list) |)) { rng = str; list = ""; } else { rng = (args.delete(args.length())).join(); } } else { rng = str; list = ""; } } if (!rng) return ("You must specify a message to remove from " + lname) + "."; if (!list) { list = current['list]; ans = .prompt(("Remove mail from " + (list.mail_name())) + "? "); if (type(ans) == 'symbol) return; if (match_regexp(ans, "no|n")) return "Ok, aborting.."; } else { catch ~listnf list = (> $mail_lib.match_mail_recipient(list) <); with return ("The list \"" + list) + "\" is invalid."; } lname = list.mail_name(); catch any (> .new_list(list) <); with return (traceback()[1])[2]; if (rng && ((rng[1]) == "$")) { catch ~namenf mail = [(> $object_lib.to_dbref(rng) <)]; with return (traceback()[1])[2]; } else { catch ~range mail = (> $mail_lib.range_to_actual($parse_lib.range(rng), current) <); with return (traceback()[1])[2]; } lmail = list.mail(); if ((mail[1]) != (| lmail[1] |)) { offset = (mail[1]) in lmail; lmail = sublist(lmail, offset); offset--; } for m in (mail) { catch ~perm { x = (m in lmail) + offset; name = ((((("#" + x) + " \"") + (m.subject())) + "\" (") + m) + ")"; list.del_mail(m); .tell(((("Removed message " + name) + " from ") + (list.mail_name())) + "."); } with { .tell((traceback()[1])[2]); } } }; protected method .read_mail() { arg mail, list; var loc; loc = mail in (list.mail()); .tell(strfmt("Message %l (%l) on %s:", loc, mail.name(), list.mail_name())); .tell(mail.format()); mail.did_read(); subscribed = subscribed.add(list, [time(), mail]); }; protected method .subscribed() { return subscribed; }; protected method .unsubscribe_cmd() { arg cmdstr, cmd, str; var list, line, mname; (> .perms(caller(), $user) <); if (!str) return .mail_lists_cmd(); list = $mail_lib.match_mail_recipient(str); if (list == this()) return "You cannot unsubscribe yourself."; mname = list.mail_name(); if (!(list in (subscribed.keys()))) return "You are not subscribed to " + mname; .unsubscribe(list); return ("Successfully unsubscribed from " + mname) + "."; }; protected method .subscribe_cmd() { arg cmdstr, cmd, str; var list, mname, l, args, line, len, out; (> .perms(caller(), $user) <); // this is ugly bad bad args = $parse_lib.getopt(str, [["n?ew"]]); if (!(args[1])) { if ("n?ew" in ((args[2]).slice(1))) { out = []; for l in ((subscribed.keys()).setremove(this())) { if ((l.last_received_on()) > ((subscribed[l])[1])) out = (out = [" " + (l.mail_name())]); } if (out) .tell(["New mail on:"] + out); return; } .tell("Currently Subscribed Lists:"); len = (.linelen()) / 3; for l in ((subscribed.keys()).setremove(this())) { line = " " + (l.mail_name()); if ((l.last_received_on()) > ((subscribed[l])[1])) line += " (new mail)"; .tell(line); } return; } list = $mail_lib.match_mail_recipient(str); mname = $mail_lib.mail_name(list); if (list in (subscribed.keys())) return .tell(("You are already subscribed to " + mname) + "."); if (!(list.list_is_readable_by(this()))) return .tell(mname + " is not subscribeable by you."); .subscribe(list); .tell(("Successfully subscribed to " + mname) + "."); }; protected method .subscribe() { arg list; if (!subscribed) subscribed = #[]; subscribed = subscribed.add(list, [time(), 0]); (| list.add_sender_to_notification() |); }; protected method .unsubscribe() { arg list; subscribed = subscribed.del(list); (| list.del_sender_from_notification() |); }; protected method .mail_lists_cmd() { arg [args]; var l, line; (> .perms(caller(), $user) <); for l in (($mail_db.database()).values()) { line = ""; if (l.list_is_readable_by(this())) line = "[Readable]"; if (l.list_is_sendable_by(this())) line = ("[Sendable]" + (line ? " " : "")) + line; .tell((((l.mail_name()).pad(((.linelen()) - (line.length())) - 1)) + " ") + line); } }; protected method .new_list() { arg list; // check here so we can assume later that this error will not bite us if (!(subscribed.contains(list))) { if (!(list.list_is_readable_by(this()))) throw(~perm, "You cannot read mail on " + (list.mail_name())); } // set the current list if (list != (current['list])) current = current.add('list, list); }; root method .init_mail_ui() { current = #[['list, this()]]; .subscribe(this()); (| .subscribe($mail_list_news) |); .new_list(this()); }; protected method .mail_on_cmd() { arg cmdstr, cmd, str; var args, lmail, mail, rng, start, end, line, list, len, out, m, rows; (> .perms(caller(), $user) <); if ((args = match_template(str, "* on *"))) { rng = args[1]; list = args[3]; } else if (match_template(str, "* to *")) { return (> .send_to_cmd(cmdstr, cmd, str) <); } else { rng = ""; list = str; } if (!list) { list = current['list]; } else { catch ~listnf, ~perm { list = (> $mail_lib.match_mail_recipient(list) <); (> .new_list(list) <); } with { return (traceback()[1])[2]; } } if (!rng) { mail = list.mail(); end = mail.length(); // minus two for the head and tail rows = (.get_rows()) - 2; if (end > rows) { start = end - rows; mail = sublist(mail, start); } else { start = 1; } rng = (start + "-") + end; } else { catch ~range mail = $mail_lib.range_to_actual($parse_lib.range(rng), current); with return (traceback()[1])[2]; } if (!mail) return "No mail on " + (list.mail_name()); len = (.linelen()) - 33; out = [((("Mail from " + rng) + " on ") + (list.mail_name())) + ":"]; lmail = list.mail(); for m in (mail) { if (!valid(m)) list.notify_bad_mail(m); else out += [strfmt("%s%3r:%s%*L %14L%11l", (mail == (| (subscribed[list])[2] |)) ? "=>" : " ", m in lmail, (m.has_read(this())) ? " " : "!", len, m.subject(), $object_lib.get_name(m.from(), 'name), $time.format("%d-%h-%Y", m.time()))]; } .tell(out + ["------"]); }; protected method .mail_to_cmd() { arg cmdstr, cmd, str; var subj, lists, note, list, x, mail, text, args; (> .perms(caller(), $user) <); if ((args = match_template(str, "* to *"))) { note = args[1]; args = args[3]; } else if ((cmd == "@mail") && (args = match_template(str, "* on *"))) { return (> .mail_on_cmd(cmdstr, cmd, str) <); } else { note = ""; args = str; } if (args) { lists = []; for list in (args.explode_english_list()) { catch ~listnf { list = (> $mail_lib.match_mail_recipient(list) <); lists += [list]; } with { .tell(("The list \"" + list) + "\" is invalid."); } } if (!lists) return "No lists specified."; } else { lists = [current['list]]; } // get the text of the message if (note) { text = (> (.match_env_nice(note)).text() <); } else { text = .read("-- Enter text for mail message, \".\" when done or \"@abort\" to abort --"); if (text == 'aborted) return; if (text == 'engaged) return "** Already reading - mail send aborted **"; } subj = .prompt("Subject: "); if (subj == "@abort") return "** Aborted mail send **"; if (subj == 'engaged) return "** Already reading - mail send aborted **"; mail = $mail_message.new_mail(); mail.set_subject(subj); mail.set_text(text); catch any mail.send(@lists); with return (traceback()[1])[2]; return "Mail sent."; }; protected method .next_new_cmd() { arg cmdstr, cmd, str; var mail, list, keys, start; (> .perms(caller(), $user) <); if (str) { catch any list = (> $mail_lib.match_mail_recipient(str) <); with return (traceback()[1])[2]; .new_list(list); mail = (| list.mail_list_next((subscribed[list])[2]) |); while (mail && (mail.has_read(this()))) { refresh(); mail = (| list.mail_list_next(mail) |); } if (!mail) return ("No new mail on " + ($mail_lib.mail_name(list))) + "."; .read_mail(mail, list); } else { keys = dict_keys(subscribed); if (!keys) return "You are not subscribed to any lists."; start = (list = current['list]); while (1) { // anything left on this list? mail = (| list.mail_list_next((subscribed[list])[2]) |); while (mail && (mail.has_read(this()))) { refresh(); mail = (| list.mail_list_next(mail) |); } if (mail) break; // pick a new list catch any list = (> keys[(list in keys) + 1] <); with list = (| keys[1] |); // die? if ((!list) || (list == start)) return "No new mail."; } .new_list(list); .read_mail(mail, list); } }; new object $location: $physical, $command_cache; var $location contents = []; var $root fertile = 1; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'fertile, 'variables, 'core]; var $has_gender gender = $gender_neuter; var $described prose = []; var $has_name name = ['uniq, "Generic Container Object", "the Generic Container Object"]; var $command_cache shortcut_cache = 0; var $command_cache local_cache = 0; var $has_commands shortcuts = #[]; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $root manager = $location; var $root managed = [$location]; var $root owned = [$location]; root method .init_location() { contents = []; }; root method .uninit_location() { var obj; for obj in (contents) obj.move_to((| obj.setting("home", $thing) |) || $nowhere); }; public method .contents() { return contents || []; }; public method .contains() { arg obj; return (obj in (.contents())) ? 1 : 0; }; public method .find_in_contents() { arg str; var obj; for obj in (.contents()) { if (obj.match_name(str)) return; } }; public method .will_arrive() { arg old_place; if (caller() != $located) throw(~perm, "Caller is not $located."); }; public method .will_leave() { arg place; if (caller() != $located) throw(~perm, "Caller is not $located."); }; public method .did_arrive() { arg place; if (caller() != $located) throw(~perm, "Caller is not $located."); .add_object_to_remote_cache(sender()); }; public method .did_leave() { arg place; if (caller() != $located) throw(~perm, "Caller is not $located."); (| .del_object_from_remote_cache(sender()) |); }; public method .add_sender_to_contents(): nooverride { if (caller() != $located) throw(~perm, "Caller is not $located."); if ((sender().location()) != this()) throw(~location, "Sorry, but you're not here."); contents = contents.setadd(sender()); }; public method .del_sender_from_contents(): nooverride { if (caller() != $located) throw(~perm, "Caller not an agent of located protocol."); contents = contents.setremove(sender()); }; public method .validate_contents() { var obj, newcont; if (!(.is_writable_by(sender()))) throw(~perm, "Must be a writer to validate contents"); newcont = []; for obj in (contents) { if (valid(obj) && ((obj.has_ancestor($located)) && ((obj.location()) == this()))) newcont = newcont.setadd(obj); } contents = newcont; }; public method .environment() { return [this()] + contents; }; public method .add_to_contents(): nooverride { arg what; if (caller() != $located) throw(~perm, "Caller is not $located."); }; public method .contents_accept_mail() { return 1; }; public method .realm() { arg [args]; var loc; loc = ""; if ((| .location() |)) loc = (.location()).realm(); return ((loc + "[") + (.name())) + "]"; // $# Edited 05 Nov 1995 14:03 Lynx ($lynx) }; public method .realm_name() { return ""; }; public method .add_frob_to_contents() { arg frob; if (!(sender().is($thing_frob))) throw(~perm, "Caller is not $thing_frob."); if (type(frob) != 'frob) throw(~type, "Argument is not a frob."); if ((frob.location()) != this()) throw(~location, "Sorry, but you're not here."); contents = (.contents()).setadd(frob); }; public method .del_frob_from_contents() { arg frob; if ((!(sender().is($thing_frob))) && (sender() != this())) throw(~perm, "Caller is not $thing_frob."); if (type(frob) != 'frob) throw(~type, "Argument not a frob."); contents = contents.setremove(frob); }; public method .announce() { arg str, [except]; var obj, part, s; if ((type(str) == 'frob) && ((class(str) == $message_frob) && (this() in (str.parts())))) { part = str.get_part(this()); str = str.del_entry(this()); str = str.add_entry("general", part); } s = sender(); for obj in (.contents()) { if (!(obj in except)) (| obj.tell(str, s) |); } }; new object $located_location: $thing, $location; var $root child_index = 7; var $root fertile = 1; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'fertile, 'variables, 'core]; var $location contents = []; var $located location = $void; var $located obvious = 1; var $has_gender gender = $gender_neuter; var $described prose = []; var $has_name name = ['uniq, "Generic Located Location", "the Generic Located Location"]; var $command_cache remote_cache = #[["@lock", [["@lock"], #[[$thing, 1]]]], ["@unlock", [["@unlock"], #[[$thing, 1]]]], ["@boot", [["@boot"], #[[$thing, 1]]]]]; var $command_cache shortcut_cache = []; var $has_commands remote = #[]; var $root manager = $located_location; var $root managed = [$located_location]; var $root owned = [$located_location]; public method .environment() { return (.contents()) + pass(); }; public method .description() { arg flags; var desc, out, c; // type is either 'on' or 'in' if (!(flags.contains('type))) return (> pass(flags) <); out = []; for c in (.contents()) out += [c.name()]; return (> pass(flags) <) + [((((("There is " + (out.to_english())) + " ") + (flags['type])) + " ") + (.name())) + "."]; }; new object $body: $located_location; var $root child_index = 19; var $root fertile = 1; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'fertile, 'variables, 'core, 'command_cache]; var $location contents = []; var $located location = $void; var $located obvious = 1; var $body body_parts = #[]; var $body available_body_parts = 0; var $body wearing = [<$wearable_frob, #[['name, "a trenchcoat"]]>]; var $body remote_command_cache = 0; var $has_gender gender = $gender_neuter; var $described prose = []; var $has_name name = ['uniq, "Generic Body", "the Generic Body"]; var $root manager = $body; var $root managed = [$body]; var $root owned = [$body]; var $body interaction = 0; var $has_commands shortcuts = #[["|*", ['quote_cmd, ["quote ", 1]]], ["\"*", ['say_cmd, ["say ", 1]]], ["%*", ['think_cmd, ["think ", 1]]], ["!*", ['spoof_cmd, ["spoof ", 1]]], [",*,*", ['esay_cmd, ["esay ", 1, " with ", 2]]], [":*", ['emote_cmd, ["emote ", 1]]], [".*", ['pose_cmd, ["pose ", 1]]], ["''*", ['to_say_cmd, ["to ", "", " say ", 1]]], ["'* *", ['to_say_cmd, ["to ", 1, " say ", 2]]]]; var $has_commands local = #[["wh?isper", [["wh?isper", "* to *", "wh?isper <any> to <any>", 'whisper_cmd, #[[1, ['any, []]], [3, ['any, []]]]]]], ["say", [["say", "*", "say <any>", 'say_cmd, #[[1, ['any, []]]]]]], ["to", [["to", "* say *", "to <any> say <any>", 'to_say_cmd, #[[1, ['any, []]], [3, ['any, []]]]]]], ["emote", [["emote", "*", "emote <any>", 'emote_cmd, #[[1, ['any, []]]]]]], ["quote", [["quote", "*", "quote <any>", 'quote_cmd, #[[1, ['any, []]]]]]], ["spoof", [["spoof", "*", "spoof <any>", 'spoof_cmd, #[[1, ['any, []]]]]]], ["pose", [["pose", "*", "pose <any>", 'spoof_cmd, #[[1, ['any, []]]]]]], ["think", [["think", "*", "think <any>", 'think_cmd, #[[1, ['any, []]]]]]], ["wear", [["wear", "*", "wear <any>", 'wear_cmd, #[[1, ['any, []]]]]]], ["remove|shed", [["remove|shed", "*", "remove|shed <any>", 'remove_cmd, #[[1, ['any, []]]]]]]]; public method .tell() { arg [args]; }; public method .set_body_part() { arg part, frob, param; if (sender().has_ancestor($wearable_frob)) throw(~perm, "Sender must be $wearable_frob."); body_parts = body_parts.add(frob.new_with(part, param)); }; public method .wearing() { arg [args]; var x, w; w = wearing || []; if (args && ('objects in args)) { for x in [1 .. w.length()] w = w.replace(x, class(w[x])); } return w; }; public method .body_parts() { return body_parts; }; public method .namef() { arg type; var str; switch (type) { case 'doing, 'nactivity, 'activity, 'titled: return .name(); default: return (> pass(type) <); } // $# Edited 28 Oct 1995 21:08 Lynx ($lynx) }; public method .available_body_parts() { return available_body_parts || ['head, 'rleg, 'lleg, 'rarm, 'larm, 'torso]; }; public method .wear() { arg what; if (caller() != $wearable_frob) throw(~wear, "You can only wear descendants of $wearable_frob."); wearing = setadd(wearing || [], what); }; public method .shed() { arg what; if (caller() != $wearable_frob) throw(~wear, "You can only wear descendants of $wearable_frob."); wearing = setremove(wearing, what); }; public method .will_move() { arg mover, place; // exits should always be able to pull "bodies" through them // this becomes sortof a big override returning, but ... *shrug* if (mover.is($exit)) return; (> pass(mover, place) <); }; public method .description() { arg flags; var ctext, what, w; ctext = (> pass(flags) <); if ((w = .wearing())) ctext += [((((.gender()).pronoun('psc)) + " is wearing ") + ((w.mmap('name)).to_english())) + "."]; else ctext += [((.gender()).pronoun('psc)) + " is naked, baring it all to the world."]; return ctext; }; public method .environment() { return pass() + (wearing || []); }; protected method .parse_interaction_reference() { arg targets, what, [userdb]; var recip, target, msg; [(userdb ?= 0)] = userdb; targets = (targets && (targets.explode_list())) || []; if (!targets) { if (!(targets = (| interaction['objs] |))) throw(~stop, ("You must direct your " + what) + " to a target."); targets = targets[2]; } else { for recip in (targets) { if (userdb) target = (| $user_db.match_begin(recip) |); if (!target) target = (| .match_environment(recip) |); if (target) targets = targets.replace(recip in targets, target); } } return targets; }; protected method .add_interaction() { arg key, value; if (!interaction) interaction = #[]; if (type(value) != 'list) value = [value]; value = [time(), value]; interaction = interaction.add(key, value); }; protected method .whisper_cmd() { arg cmdstr, com, what, prep, who; var loc, targets, t, msg; (> .perms(caller(), $user, $body) <); targets = (> .parse_interaction_reference(who, "whisper") <); .add_interaction('objs, targets); loc = .location(); if (((targets.mmap('location)).compress()) != [loc]) { who = filter t in (targets) where ((t.location()) != loc); return ("You must be in the same place as " + (who.english_name_list())) + ", to whisper to them."; } msg = (((.name()) + " whispers, \"") + what) + "\""; for t in (targets) (| t.directed_tell(msg, 'whisper) |); loc.announce((((.name()) + " whispers to ") + (targets.english_name_list())) + ".", this(), @targets); .tell(((("You whisper, \"" + what) + "\" to ") + (targets.english_name_list())) + "."); }; protected method .think_cmd() { arg cmdstr, cmd, what; (> .perms(caller(), $user, $body) <); (.location()).announce((((.name()) + " . o O ( ") + what) + " )"); }; protected method .emote_cmd() { arg cmdstr, com, what; (> .perms(caller(), $user, $body) <); if (what && ((what[1]) == ":")) (.location()).announce((.name()) + (what.subrange(2))); else (.location()).announce(((.name()) + " ") + what); }; protected method .say_cmd() { arg cmdstr, cmd, what; var type, how, idx; (> .perms(caller(), $user, $body) <); if (what) how = $code_lib.punctuation_type(what); else how = "say"; (.location()).announce((((((.name()) + " ") + how) + "s, \"") + what) + "\""); }; protected method .esay_cmd() { arg cmdstr, cmd, how, prep, what; (> .perms(caller(), $user, $body) <); (.location()).announce((((((.name()) + " ") + (how.trim())) + ", \"") + (what.trim())) + "\""); }; protected method .spoof_cmd() { arg cmdstr, cmd, what; var name; (> .perms(caller(), $user, $body) <); name = .name(); if (!(((name + " ") in what) || ((" " + name) in what))) what = (what + " -- ") + name; (.location()).announce(what); }; protected method .to_say_cmd() { arg cmdstr, com, who, prep, message; var targets, target, line; (> .perms(caller(), $user, $body) <); targets = (> .parse_interaction_reference(who, "say") <); .add_interaction('objs, targets); line = (((.name()) + " (to ") + (targets.english_name_list())) + ") "; if (message) line += ((message[1]) == ":") ? message.subrange(2) : (((($code_lib.punctuation_type(message)) + "s, \"") + message) + "\""); else line += "says, \"\""; targets = filter target in (targets) where (valid(target)); for target in (targets) target.directed_tell(line, 'tosay); (.location()).announce(line, @targets); }; protected method .pose_cmd() { arg cmdstr, cmd, args; var action, targs, m, word, tail, i, str1, str2, str3, line, objs; (> .perms(caller(), $user, $body) <); if (!args) { (.location()).announce(.name()); return; } action = args.word(1); if (" " in args) { args = substr(args, (" " in args) + 1); if ("and" in args) { targs = args.explode_english_list(); word = targs.last(); targs = delete(targs, listlen(targs)); targs = map m in (targs) to ((| .match_environment(m) |) || m); if ((m = (| .match_environment(word) |))) { args = ""; targs += [m]; } else { args = substr(word, " " in word); m = word.word(1); targs += [(| .match_environment(m) |) || m]; } } else { m = " " + (args.word(1)); targs = [(| .match_environment(m) |) || m]; args = (| substr(args, (" " in args) + 1) |) || ""; } } else { .tell("You " + action); (.location()).announce((((.name()) + " ") + action) + "s", this()); return; } // convert to ctext some day if (args) { str1 = strsed(args, " +my($| |\.)", " your%1"); str1 = strsed(args, " +me($| |\.)", " yourself%1"); word = (" " + ((.gender()).pronoun('pp))) + "%1"; str2 = strsed(args, " +my($| |\.)", word); word = (" " + ((.gender()).pronoun('pr))) + "%1"; str2 = strsed(args, " +me($| |\.)", word); str3 = str2; } objs = map m in (targs) to (((type(m) == 'objnum) && (m.name())) || m).to_english(); .tell(((("You " + action) + " ") + objs) + args); // I'll do something better later for m in (targs) { line = (((.name()) + " ") + action) + "s "; if (type(m) == 'objnum) m.tell((line + strsub(objs, m.name(), "you")) + args); } line += objs + args; objs = filter m in (targs) where (type(m) == 'objnum) + [this()]; (.location()).announce(line, @objs); }; protected method .quote_cmd() { arg cmdstr, cmd, what; (.location()).announce(((.name()) + " | ") + what); }; public method .ptell() { arg what, flags; .tell(what); }; public method .handle_parser_result() { arg action, [more]; var r, c; switch (action) { case 'error: ._tell(more[1]); case 'match, 'command: r = (> (more[1]).(more[2])(@more.subrange(3)) <); if (type(r) in ['list, 'frob, 'string]) .ptell(r, #[['type, 'parser], ['command, more[2]]]); case 'failed: for c in (($place_lib.coordinate_shortcuts()).keys()) { if (line.match_template(c)) { .tell(("There is no exit " + line) + " here."); r = 1; } } if (!r) .tell(("I don't understand " + (line.chop((.linelen()) - 22))) + "."); case 'ok: // do nothing, probably a null command default: ._tell("Unusual response from the parser: " + toliteral(more)); } }; protected method .wear_cmd() { arg cmd, cmdstr, what; (> .perms(caller(), $user, $body) <); what = (> .match_env_nice(what) <); if (!(what.is($wearable_frob))) return ("You cannot wear " + (what.name())) + "."; what = (> what.wear() <); return "You wear " + (what.name()); }; protected method .remove_cmd() { arg cmd, cmdstr, what; (> .perms(caller(), $user, $body) <); what = (> .match_env_nice(what) <); if (!(what.is($wearable_frob))) return ("You are not wearing " + (what.name())) + "."; what = (> what.shed() <); return "You remove " + (what.name()); }; public method .directed_tell() { arg what, type; ._tell(what); .send_event('social, sender(), type, what); }; public method .tell_traceback() { arg traceback; if ((.manager()) != this()) (.manager()).tell_traceback(traceback); }; public method ._tell() { arg [args]; var m; m = .manager(); if ((m != this()) && ((m.location()) != (.location()))) (| m.tell(@args.prefix(("<" + (.name())) + "> ")) |); }; new object $command_aliases: $user_interfaces; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'variables, 'core]; var $command_aliases command_aliases = []; var $root manager = $command_aliases; var $root managed = [$command_aliases]; var $root owned = [$command_aliases]; root method .init_command_aliases() { command_aliases = []; }; root method .uninit_command_aliases() { command_aliases = []; }; public method .command_aliases() { return command_aliases; }; public method .all_command_aliases() { var user, aliases, userc; // Collect complete command alias list from ancestors. aliases = []; for user in (.ancestors()) { userc = (| user.command_aliases() |); if (userc) aliases += userc; if (user == definer()) break; } return aliases; }; public method .match_command_aliases() { arg str; var alias, argf, match, newstr; // attempts to rebuild the string for an alias. if (sender() != this()) throw(~perm, "Sender is not this."); for alias in (.all_command_aliases()) { match = str.match_pattern(alias[1]); if (match != 0) { newstr = alias[2]; for argf in [1 .. match.length()] newstr = newstr.replace("%" + tostr(argf), match[argf]); return newstr; } } return str; }; public method .add_command_alias() { arg alias, actual; var relation, a; (> .perms(sender()) <); if ((type(alias) != 'string) || (type(actual) != 'string)) throw(~type, "alias and actual are not strings."); relation = (> $command_lib.parse_relation(alias, actual) <); // have it 'replace' the old alias (if one exists) by first removing // the old one, and adding the new one later. for a in (command_aliases) { if ((a[1]) == alias) command_aliases = command_aliases.setremove(a); } command_aliases += [[(relation[1])[1], (relation[2])[2]]]; // $# Edited 18 Oct 1995 12:55 Lynx ($lynx) }; public method .del_command_alias() { arg alias; var ca, rel; (> .perms(sender()) <); if (type(alias) != 'string) throw(~type, "alias is not a string."); rel = (> $command_lib.parse_relation(alias, alias) <); rel = rel[1]; for ca in (command_aliases) { if ((ca[1]) == (rel[1])) { command_aliases = command_aliases.setremove(ca); return; } } throw(~aliasnf, ("alias `" + alias) + "' is not found"); // $# Edited 18 Oct 1995 13:19 Lynx ($lynx) }; new object $bad_commands: $user_interfaces; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'variables, 'core]; var $bad_commands non_supported_cmds = #[["quit", "@quit"], ["WHO", "@who"], ["@create", "@new"], ["@dig", "@build"], ["help", "@help"], ["news", "@news"], ["page", "@page"], ["@gender", "@set gender"], ["uptime", "@status"], ["@alias", "@add-command-alias` or `@add-name-alias"], ["@check", "@monitor"], ["@paranoid", "@monitor"], ["@version", "@status"]]; var $has_commands local = #[["@create", [["@create", "*", "@create <any>", 'old_command_cmd, #[[1, ['any, []]]]]]], ["@dig", [["@dig", "*", "@dig <any>", 'old_command_cmd, #[[1, ['any, []]]]]]], ["help", [["help", "*", "help <any>", 'old_command_cmd, #[[1, ['any, []]]]]]], ["page", [["page", "*", "page <any>", 'old_command_cmd, #[[1, ['any, []]]]]]], ["who", [["who", "*", "who <any>", 'old_command_cmd, #[[1, ['any, []]]]]]], ["quit", [["quit", "*", "quit <any>", 'old_command_cmd, #[[1, ['any, []]]]]]], ["news", [["news", "*", "news <any>", 'old_command_cmd, #[[1, ['any, []]]]]]], ["@gender", [["@gender", "*", "@gender <any>", 'old_command_cmd, #[[1, ['any, []]]]]]], ["uptime", [["uptime", "*", "uptime <any>", 'old_command_cmd, #[[1, ['any, []]]]]]], ["@alias", [["@alias", "*", "@alias <any>", 'old_command_cmd, #[[1, ['any, []]]]]]], ["@check|@paranoid", [["@check|@paranoid", "*", "@check|@paranoid <any>", 'old_command_cmd, #[[1, ['any, []]]]]]], ["@version", [["@version", "*", "@version <any>", 'old_command_cmd, #[[1, ['any, []]]]]]]]; var $root manager = $bad_commands; var $root managed = [$bad_commands]; var $root owned = [$bad_commands]; protected method .add_old_cmd_reference() { arg oldcmd, [newcmd]; (> .perms(caller(), $user) <); if (this() != $bad_commands) throw(~perm, "Only define bad commands on $bad_commands"); if (newcmd) non_supported_cmds = non_supported_cmds.add(oldcmd, newcmd[1]); .add_command(oldcmd, 'old_command_cmd); }; protected method .old_command_cmd() { arg cmdstr, com, [args]; var line, equiv, pref; (> .perms(caller(), $user) <); equiv = (| ($bad_commands.non_supported_cmds())[com] |); line = ("Oops, `" + com) + "` is not supported here."; if (equiv) line = ((line + " Try `") + equiv) + "`"; .tell(line); .tell("Use `@help commands` for an explanation on the differences in commands."); }; public method .non_supported_cmds() { return non_supported_cmds; }; new object $help_ui: $user_interfaces; var $root fertile = 1; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'fertile, 'variables, 'core]; var $has_commands local = #[["@help", [["@help", "*", "@help <any>", 'help_cmd, #[[1, ['any, []]]]]]]]; var $has_commands shortcuts = #[["?*", ['help_cmd, ["?", 1]]]]; var $help_ui current = 1; var $help_ui history = [$help_core]; var $root manager = $help_ui; var $help_ui index = 0; var $root owned = [$help_ui]; var $root managed = [$help_ui]; root method .init_help_ui() { history = [$help_lib.default_node()]; current = 1; }; public method .current_node() { return history[current]; }; protected method .help_cmd() { arg cmdstr, cmd, args; var o, opt, optval, way, node, links, i; (> .perms(caller(), $user) <); o = #[["?", ["h?istory"]], ["<", ["b?ack"]], [">", ["f?orward"]], ["!", ["fix"]], ["#", ["l?inks"]], ["^", ["u?p"]]]; args = $parse_lib.getopt(args, o.values()); opt = args[2]; args = args[1]; if (!opt) { if (!args) { if (cmd == "?") node = .current_node(); else node = $help_lib.default_node(); } else { args = args.join(); if ((args[1]) in (o.keys())) { opt = (o[args[1]])[1]; if ((args.length()) > 1) optval = args.subrange(2); } else if ((o = match_template(args, "* in *"))) { if (!(i = $help_index.match_children(o[3]))) return ("\"" + (o[3])) + "\" is not a help index."; if ((!(o[1])) || ((o[1]) == "#")) node = i; else if (!(node = (| i.match_begin(o[1]) |))) return ((("Unable to find help on \"" + (o[1])) + "\" in the ") + (i.name())) + " index."; } else { catch ~nonode, ~ambig { node = (> .parse_help_reference(args) <); } with { if (error() == ~ambig) return ([("Topic '" + args) + "' has multiple possibilities:", ""] + ((((traceback()[1])[3]).mmap('namef, 'ref)).prefix(" "))) + ["", "---"]; return (traceback()[1])[2]; } } } } else { // since all options override each other, just use the last one. optval = (opt[opt.length()])[4]; opt = (opt[opt.length()])[1]; } if (!node) { catch ~nonode { switch (opt) { case "u?p": o = ((.current_node()).parents())[1]; if ((!(o.is($help_node))) || (o.top_of_help_heirarchy())) return "You are at the top of this help node heirarchy."; node = o; case "h?istory": return ._help_node_history(); case "b?ack": if (!optval) optval = ""; node = (> ._navigate_node_history("<" + optval) <); case "f?orward": if (!optval) optval = ""; node = (> ._navigate_node_history(">" + optval) <); case "fix": .tell("Fixing your help history."); for node in (history) { if ((!valid(node)) || (!(node.has_ancestor($help_node)))) history = setremove(history, node); } current = listlen(history); return; case "l?inks": node = .current_node(); links = node.links(); if (!links) { .tell(("No links from " + (node.name())) + "."); } else { .tell(("Links from " + (node.name())) + ":"); .tell((links.keys()).prefix(" ")); } if (node.group()) { links = ((node.parents())[1]).children(); links = filter o in (links) where ((!(o.nolist())) && (o != node)); if (!links) return ("No group nodes with " + (node.name())) + "."; .tell(("Group nodes with " + (node.name())) + ":"); .tell((links.mmap('name)).prefix(" ")); } return; } } with { return (traceback()[1])[2]; } } .set_help_node(node); .tell_help_node(node); }; protected method .last_visited() { (> .perms(sender()) <); return last_visited; }; public method .help_index() { return index; }; protected method ._back_help_node() { var pos; pos = current - 1; if (pos >= 1) { current = pos; return history[current]; } throw(~nonode, "You are at the start of your help node history, use \"??\" to list the history."); }; protected method ._forward_help_node() { var pos; pos = current + 1; if ((pos <= ($help_lib.history_cap())) && (pos <= (history.length()))) { current = pos; return history[current]; } throw(~nonode, "You are at the end of your help node history, use \"??\" to list the history."); }; protected method .set_help_node() { arg node; if (node.index()) index = node.index(); if (node in history) { if ((history[current]) == node) return; current = node in history; return; } while ((history.length()) >= ($help_lib.history_cap())) { history = history.delete(1); current--; } history = (history ? sublist(history, 1, current) : []) + [node]; current = history.length(); }; protected method ._navigate_node_history() { arg str; var node, r, hist, match; while ((r = regexp(str, "^ *([<>]) *([^<>]*) *"))) { if (r[2]) { if ((r[1]) == "<") hist = (sublist(history, 1, current - 1).reverse()) + (sublist(history, current).reverse()); else hist = sublist(history, current + 1) + sublist(history, 1, current); r = r[2]; for node in (hist) { if (node.match_name(r)) { .set_help_node(node); match++; break; } } if (!match) throw(~nonode, ("There is no node \"" + r) + "\" in your history."); } else if ((r[1]) == "<") { (| .set_help_node(._back_help_node()) |); } else { (| .set_help_node(._forward_help_node()) |); } str = strsed(str, "^ *([<>]) *([^<>]*) *", ""); } return history[current]; }; protected method ._help_node_history() { var node, line; .tell("Help node history:"); for node in [1 .. history.length()] { line = " "; if (node == current) line = "=> "; catch any { .tell(line + ((history[node]).name())); } with { history = history.delete(node); .set_help_node(history[1]); .tell(line + ">> ERROR: INVALID NODE IN HISTORY <<"); } } }; protected method .tell_help_node() { arg node; var out, len, clen, line, n, name, changed; // len = .linelen() % 2 ? .linelen() - 1 : .linelen(); len = .linelen(); name = node.node_name(); while (strlen(name) >= (len - 6)) { name = substr(name, (":" in name) + 1); changed++; } if (changed) name = "..." + name; line = strfmt("%*{-}c", len, (" " + name) + " "); .tell(line); .ptell(node.body(), #[['type, 'help], ['ctype, 'ctext]]); if (node.group()) { line = ""; for n in (((node.parents())[1]).children()) { if (n.nolist()) continue; if (n == node) line += ". "; else line += ("[" + (n.name())) + "] "; } if (line) line = (" " + line).center(len, "-", 'both); else line = "-" * len; } else { line = "-" * len; } .tell(["", line]); }; root method .uninit_help_ui() { clear_var('history); clear_var('current); clear_var('index); }; protected method .help_node_history() { return history; }; protected method .parse_help_reference() { arg str; var node, cnode, current, indices, len, links, i, matches, m; if ((str[1]) == "$") { node = (| $object_lib.to_dbref(str) |); if ((!node) || ((!(node.has_ancestor($help_node))) && (!(| (node = node.help_node()).has_ancestor($help_node) |)))) throw(~nonode, ("\"" + str) + "\" is not a help node, and does not have a help node assigned to it."); return node; } if ((m = match_template(str, "*=*"))) { if (!(m[2])) throw(~nonode, ("Search in " + (m[1])) + " for nothing?"); else if (match_template(m[1], "g?roup")) return (> .find_help_in_group(m[2]) <); else if (match_template(m[1], "l?inks")) return (> .find_help_in_links(m[2]) <); else if (match_template(m[1], "i?ndex")) return (> .find_help_in_index(m[2]) <); if (!(i = $help_index.match_children(m[1]))) throw(~nonode, ("\"" + (m[1])) + "\" is not a help index."); if ((m[2]) == "#") return i; if (!(node = (| i.match_begin(m[2]) |))) throw(~nonode, ((("Unable to find help on \"" + (m[2])) + "\" in the ") + (i.name())) + " index."); return node; } return (| .find_help_in_links(str) |) || ((| .find_help_in_group(str) |) || (> .find_help_in_index(str) <)); }; public method .find_help_in_links() { arg str; var links, node, index; links = ((| .current_node() |) || ($help_lib.default_node())).links(); for node in (links.keys()) { if (match_begin(node, str)) { node = links[node]; return node; } } throw(~nonode, ("Unable to find link \"" + str) + "\"."); }; public method .find_help_in_group() { arg str; var sibling, node; node = (.current_node()) || ($help_lib.default_node()); if (node.group()) { for sibling in (((node.parents())[1]).children()) { if ((sibling == node) || (sibling.nolist())) continue; if (sibling.match_name(str)) return sibling; } } throw(~nonode, ("Unable to find group node \"" + str) + "\"."); }; public method .find_help_in_index() { arg str; var indices, i, node, index, matches, len; // get from $help_lib to keep in a consistent prioritized order indices = $help_lib.indices(); // put the 'current' node at the end, and use it first if ((i = sender().help_index())) { indices = setremove(indices, i); indices = setadd(indices, i); } // loop through the indices backwards len = listlen(indices); matches = []; for i in [1 .. len] { i = (len - i) + 1; catch any { // return the first perfect match if ((node = (> (indices[i]).match_begin(str) <))) return node; } with { if (error() == ~ambig) matches += ((traceback()[1])[3]) || []; } } if (matches) throw(~ambig, "More than one match.", matches); throw(~nonode, ("Unable to find help on \"" + str) + "\"."); }; protected method .reset_help_history() { history = [$help_core]; current = 1; }; protected method .clear_help_history() { (| clear_var('history) |); (| clear_var('current) |); }; new object $messages_ui: $user_interfaces; var $root fertile = 1; var $root manager = $messages_ui; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'fertile, 'variables, 'core]; var $has_commands local = #[["@mes?sages|@mesg|@msg", [["@mes?sages|@mesg|@msg", "*", "@mes?sages|@mesg|@msg <any>", 'messages_cmd, #[[1, ['any, []]]]]]]]; var $root managed = [$messages_ui]; var $root owned = [$messages_ui]; protected method .messages_cmd() { arg cmdstr, cmd, args; var opt, definer, t, p, name, value, object, reg, s; (> .perms(caller(), $user) <); if (!args) return .display_messages("", this()); reg = regexp(args, "(.*)<(.*)>(.*)"); if (reg) { definer = .match_env_nice(reg[2]); args = (reg[1]) + (reg[3]); } if ("=" in args) s = "="; else s = " "; if (s in args) { name = (args.subrange(1, (s in args) - 1)).trim(); args = args.subrange((s in args) + 1); } else { name = args; args = ""; } if (":" in name) { object = .match_env_nice(name.subrange(1, (":" in name) - 1)); name = name.subrange((":" in name) + 1); } else { object = this(); } if (!(object.has_ancestor($has_messages))) return (object.name()) + " cannot have any messages."; if (!name) return .display_messages("", object); value = args.unquote(); catch any { if (value) { object.set_message(name, value); .tell("Message changed to:"); return .display_messages(name, object); } else { if (!definer) definer = (._find_message_definer(name))[2]; catch ~keynf object.unset_message(name, definer); with return "No local copy of this message to clear."; return "Message removed."; } } with { return (traceback()[1])[2]; } }; public method .display_messages() { arg mask, obj; var output, definer, message, p, s, uncompiler, name, messages; output = []; messages = obj.messages(); for definer in (messages.keys()) { output += [(definer.namef('xref)) + ":"]; for message in ((messages[definer]).keys()) { name = (definer._find_message_definer(message))[1]; p = (obj.message(message)).uncompile(); if (type(p) == 'dictionary) { for s in (p.keys()) { if ($string.match_begin((message + ".") + s, mask)) output += [(((" " + message) + ".") + s) + " = "].affix(p[s]); } } else if ($string.match_begin(message, mask)) { output += [(" " + message) + " = "].affix(p); } } } return output; }; new object $settings_ui: $user_interfaces; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'variables, 'core]; var $has_commands local = #[["@set?tings", [["@set?tings", "on|from *", "@set?tings on|from <object reference>", 'settings_on_cmd, #[[2, ['objref, []]]]]]], ["@set|@setting?s", [["@set|@setting?s", "*", "@set|@setting?s <any>", 'set_cmd, #[[1, ['any, []]]]]]]]; var $root manager = $settings_ui; var $root managed = [$settings_ui]; var $root owned = [$settings_ui]; protected method .settings_cmd() { arg cmdstr, cmd, args; var flag, value, template, syn, bool, line; (> .perms(caller(), $user) <); syn = cmd + " [+|-]<flag>[=<value>]"; if (!args) { return .list_settings('local); } else if (args in ["-all", "-a"]) { return .list_settings('all); } else { bool = (args[1]) in ["-", "+"]; if (bool) args = args.subrange(2); args = args.explode("="); flag = args[1]; if ((args.length()) == 2) value = args[2]; else value = ""; template = .setting_template(flag); if (!template) return ("No setting available with the flag \"" + flag) + "\"."; switch (template[2]) { case 'boolean: if (!bool) return ("Value must be boolean (+|-" + flag) + ")."; value = bool - 1; case 'integer: if (!($string.is_numeric(value))) return ("Value must be an integer (" + flag) + "=<integer>)."; value = toint(value); case 'string: if (!value) return ("Value must be a string (" + flag) + "=<string>)."; } .set_setting(flag, value); line = ("Setting " + flag) + " set to "; switch (template[2]) { case 'boolean: line += (value == 1) ? "+" : "-"; default: line += toliteral(value); } .tell(line); } }; protected method .settings_on_cmd() { arg cmdstr, cmd, prep, ref; (> .perms(caller(), $user) <); // this is a hookneyed way to do it, and wont work out in the long run, // but until we get arguments in the parser this will work fine if ((ref[2]) == (ref[3])) return ._show_settings(ref[3]); else return ._show_settings_on(ref[3], ref[2]); }; public method ._show_setting() { arg setting, definer, object; var line; line = (" " + setting) + " = "; setting = (| object.display_setting(setting, definer) |); if (setting != ~setting) line += setting; return line; }; public method ._show_settings_on() { arg definer, object; var settings, s, setting, line, out; if (!(object.trusts(this()))) return [(definer.namef('xref)) + ":", " ** Unable to see settings **"]; settings = (| definer.defined_settings() |) || []; out = []; for s in (settings) out += [._show_setting(s, definer, object)]; if (!out) out = [" (none)"]; return [(definer.namef('xref)) + ":"] + out; }; protected method .set_cmd() { arg cmdstr, cmd, args; var opt, definer, t, p, name, value, object, reg, s; (> .perms(caller(), $user) <); if (!args) return ._show_settings(this()); if ((reg = regexp(args, "^ *(.*)<([^)]+)>(.*) *$"))) { definer = (> .match_env_nice(reg[2]) <); args = (((reg[1]).trim()) + " ") + ((reg[3]).trim()); } if ((reg = regexp(args, "^ *([^:=]+): *(.*) *$"))) { object = (> .match_env_nice(reg[1]) <); args = reg[2]; } else { object = this(); } if ((reg = regexp(args, "^ *([a-z0-9_@-]+)[ =](.*)$"))) { name = (reg[1]).trim(); args = (reg[2]).trim(); } else { name = args; args = ""; } if (!name) return [("-- Settings on " + (object.namef('ref))) + ":", ._show_settings(object), "--"]; // this should fix the quotes value = args.unquote(); // change it catch any { ._change_setting(name, value, definer, object); .tell(["-- Setting changed to:", ._show_setting(name, definer, object), "--"]); } with { return (traceback()[1])[2]; } }; public method ._show_settings() { arg object; var a, s, out; if (!(object.trusts(this()))) return (((object.namef('ref)) + " does not trust you enough to show you ") + (((| object.gender() |) || $gender_neuter).pronoun('pp))) + " settings."; out = []; for a in (object.ancestors()) { if (a == $has_settings) break; s = (| a.defined_settings() |); if (s) out += [._show_settings_on(a, object)]; } return out.reverse(); }; public method ._change_setting() { arg name, value, definer, object; var current, style, index, pos; (> .perms(sender(), 'writers) <); style = name.last(); if (style in ["+", "-"]) { name = name.subrange(1, (name.length()) - 1); if (!definer) definer = object._find_setting_definer(name); current = (object.setting(name, definer)) || []; if (style == "+") value = [@current || [], value]; else value = current.delete(toint(value)); } catch ~check, ~set (> object.set_setting(definer, name, value) <); with throw(~stop, (traceback()[1])[2]); }; new object $editor_reference: $has_commands, $has_settings; var $root manager = $editor_reference; var $root flags = ['methods, 'code, 'fertile, 'core, 'variables]; var $root created_on = 820684615; var $root inited = 1; var $editor_reference active_editor = 0; var $has_commands shortcuts = #[]; var $has_commands remote = #[]; var $has_commands local = #[["@mcp-upload-session", [["@mcp-upload-session", "*", "@mcp-upload-session <descendant of $editor_session>", 'mcp_upload_cmd, #[[1, ['descendant, [$editor_session]]]]]]], ["@cleanup-sessions|@c-s?essions", [["@cleanup-sessions|@c-s?essions", "", "@cleanup-sessions|@c-s?essions", 'cleanup_sessions, #[]]]], ["@edit", [["@edit", "*", "@edit <any>", 'edit_cmd, #[[1, ['any, []]]]]]]]; var $editor_reference bg_sessions = 0; var $has_settings defined_settings = #[["local-editor", #[['get, 'get_local_setting], ['set, 'set_local_setting], ['check, 'check_local_editor], ['del, 'delete_local_setting], ['check_args, []], ['get_args, []], ['set_args, []]]]]; var $has_settings local_settings = ["local-editor"]; var $has_settings settings = #[[$editor_reference, #[["local-editor", 'mcp]]]]; var $root managed = [$editor_reference]; var $root owned = [$editor_reference]; protected method .reinvoke_editor() { arg [session]; var i, t, name; t = ""; [(session ?= active_editor), (name ?= "")] = session; if (session == 0) return "No session to resume."; if (active_editor && ((active_editor != session) || (!(| session.is_resumable() |)))) t = (.store_editor()) + " "; if ((!valid(session)) || (!(session in (bg_sessions + [active_editor])))) { active_editor = 0; return "Invalid session - editor cleared."; } if (!(| session.is_resumable() |)) return "The session is not resumable."; active_editor = session; bg_sessions = bg_sessions.setremove(active_editor); bg_sessions = filter i in (bg_sessions) where (valid(i)); .add_parser($editor_parser); return (((t + "Resumed ") + active_editor) + (name ? " " + name : "")) + "."; }; public method .invoke_editor() { arg [args]; // finishing object, finishing method, initial text, client data; if (active_editor != 0) throw(~misc, "Editor already active"); active_editor = $editor_session.spawn(); if (active_editor.startup(@args)) .add_parser($editor_parser); }; public method .quit_editor() { if (active_editor == 0) throw(~misc, "No active editor."); .perms(sender(), active_editor); .del_parser($editor_parser); active_editor.destroy(); active_editor = 0; }; public method .store_editor() { var t; if (active_editor) { (sender() == this()) || (> .perms(sender(), active_editor) <); .del_parser($editor_parser); bg_sessions = (bg_sessions ? bg_sessions : []).setadd(active_editor); t = active_editor; active_editor = 0; return "Editor session %s saved.".format(t); } return "No active editor."; }; public method .active_editor() { return active_editor; }; public method .cleanup_sessions() { arg [who_cares]; var i, out; (sender() == $housekeeper) || (> .perms(sender(), this()) <); out = []; for i in (bg_sessions || []) { if (valid(i) && (i.mcp_cleanup_session())) i.destroy(); else out += [i]; } bg_sessions = out; return "MCP and invalid editor sessions cleared."; }; public method .edit_cmd() { arg cmdstr, com, args; var syn, num, sess, out, type, i, e, bg; (> .perms(caller(), $user) <); syn = "@edit <object reference> [+type=...]"; args = args.trim(); if (!args) { // list sessions out = []; e = .active_editor(); if (e) { if ($editor_parser in (.parsers())) out += ["** %0 " + (e.session_name())]; else out += [" %0 " + (e.session_name())]; } bg = .background_editor_sessions(); for sess in [1 .. listlen(bg)] out += [((" %" + sess) + " ") + ((bg[sess]).session_name())]; if (out) return ["Editor Sessions:"] + out; return "No editor sessions."; } else if ((args[1]) == "%") { // resume session args = substr(args, 2); if ((!args) || ((args[1]) == " ")) { num = 0; } else { catch ~nonum num = (> args.to_number() <); with return (traceback()[1])[2]; } if (!num) { if (.active_editor()) return .reinvoke_editor(.active_editor(), "%0"); else if (.background_editor_sessions()) sess = (.background_editor_sessions())[1]; else return "No sessions to resume."; } else { if ((listlen((.background_editor_sessions()) || []) < num) || (num < 0)) return ("There is not an editor session %" + num) + "."; sess = (.background_editor_sessions())[num]; } return .reinvoke_editor(sess, "%" + num); } else { args = $parse_lib.getopt(args, [["t?ype", 1]]); if ((i = "t?ype" in ((args[2]).slice(1)))) type = ((args[2])[i])[4]; type ?= "any"; catch ~objnf args = replace(args, 1, (> $parse_lib.ref((args[1]).join()) <)); with return (traceback()[1])[2]; if (.active_editor()) { .tell("Storing active editor.."); .store_editor(); } return .new_editor_session(@args, type); } }; public method .check_local_editor() { arg definer, value, [args]; var styles; value = (| (styles = #[["None", 'none], ["MCP", 'mcp]])[value] |); if (!value) throw(~wrong, "Local editor must be one of: " + ((styles.keys()).to_english("", " or "))); return value; }; public method .local_editor() { return (| .get_local_setting("local-editor", $editor_reference) |) || 'none; }; protected method .mcp_upload_cmd() { arg cmdstr, cmd, session; var text, status, tmp; (> .perms(caller(), $user) <); text = (| .read("Reading the editor session text...") |); if (type(text) != 'list) return "Upload failed."; if (!(session in bg_sessions)) return "Illegal session - upload failed."; tmp = active_editor; active_editor = session; catch any { status = session.mcp_upload(text); } with { .tell_traceback(traceback()); status = "Compilation failed."; } active_editor = tmp; return status; }; public method .edit_sessions_notify() { if (active_editor) .tell("<editor: Disconnected from an active session. Use @reedit to resume.>"); if (bg_sessions) .tell(("<editor: You can @resume the following background sessions: " + (bg_sessions.to_english())) + ".>"); }; public method .do_save() { arg [info]; // The purpose of this method is to ensure that save is ran with // this user's perms if ((!(sender().has_ancestor($editor_session))) || (!((sender().startup_sender()) == this()))) throw(~perm, "Permission denied"); return (> (info[1]).(info[2])(info[3], info[4]) <); }; public method .background_editor_sessions() { return bg_sessions; }; new object $channel_ui: $user_interfaces; var $root manager = $channel_ui; var $channel_ui active_channels = #[]; var $root flags = ['variables, 'methods, 'code, 'command_cache, 'fertile, 'core]; var $root created_on = 838251646; var $channel_ui channel_dict = #[]; var $has_commands shortcuts = #[]; var $has_commands remote = #[]; var $has_commands local = #[["@desc-c?hannel", [["@desc-c?hannel", "* as *", "@desc-c?hannel <any> as <any>", 'describe_channel_cmd, #[[1, ['any, []]], [3, ['any, []]]]]]], ["@ch?annels", [["@ch?annels", "*", "@ch?annels <any:+f?ull +d?etailed>", 'list_channels_cmd, #[[1, ['any_opt, [["f?ull"], ["d?etailed"]]]]]]]], ["@join-lock-channel|@jlc", [["@join-lock-channel|@jlc", "* with|to *", "@join-lock-channel|@jlc <any> with|to <any>", 'channel_add_lock_cmd, #[[1, ['any, []]], [3, ['any, []]]]]]], ["@leave-lock-channel|@llc", [["@leave-lock-channel|@llc", "* with|to *", "@leave-lock-channel|@llc <any> with|to <any>", 'channel_add_lock_cmd, #[[1, ['any, []]], [3, ['any, []]]]]]], ["@use-lock-channel|@ulc", [["@use-lock-channel|@ulc", "* with|to *", "@use-lock-channel|@ulc <any> with|to <any>", 'channel_add_lock_cmd, #[[1, ['any, []]], [3, ['any, []]]]]]], ["@add-channel-manager|@acm", [["@add-channel-manager|@acm", "* to *", "@add-channel-manager|@acm <user> to <any>", 'channel_add_manager, #[[1, ['user, []]], [3, ['any, []]]]]]], ["@del-channel-manager|@dcm", [["@del-channel-manager|@dcm", "* from *", "@del-channel-manager|@dcm <user> from <any>", 'channel_del_manager, #[[1, ['user, []]], [3, ['any, []]]]]]], ["@add-ch?annel|@addcom", [["@add-ch?annel|@addcom", "*", "@add-ch?annel|@addcom <any>", 'addcom_cmd, #[[1, ['any, []]]]]]], ["@del-ch?annel|@delcom", [["@del-ch?annel|@delcom", "*", "@del-ch?annel|@delcom <any>", 'delcom_cmd, #[[1, ['any, []]]]]]]]; var $root inited = 1; var $root managed = [$channel_ui]; var $root owned = [$channel_ui]; var $channel_ui channel_creation = 1; var $root trusted_by = [$channel_db]; var $channel_ui credits = ["Chuck and Brad"]; public method .broadcast() { arg channel, msg; var q, spammer_name, message; (> .perms(sender()) <); // is this really a command?. If so, do the command. switch (msg) { case "who": if ((channel in ($channel_db.system_channels())) && (!($sys.is_system(sender())))) return "Sorry, that's a listen only channel."; .channel_members(channel); return; case "off": .channel_off(channel); return; case "on": .channel_on(channel); return; } if (channel in ($channel_db.system_channels())) return "Sorry, that's a listen only channel."; if (!(active_channels.contains(channel))) .tell("You must be on a channel to send a message to it."); // check for poses, thinking, etc. spammer_name = .name(); switch (msg[1]) { case ":": message = (spammer_name + " ") + (msg.subrange(2)); case "%": message = ((spammer_name + " . o O ( ") + (msg.subrange(2))) + " )"; case "!": (> .channel_moderator_ok() <); message = msg.subrange(2); default: message = (spammer_name + ": ") + msg; } ._broadcast(channel, message); }; protected method .channel_on() { arg channel; if (!(active_channels.contains(channel))) { active_channels = active_channels.add(channel, 1); if (channel in ($channel_db.system_channels())) .tell(("<" + channel) + "> You have joined this channel"); else .broadcast(channel, ":has joined this channel."); } else { .tell("You are already on this channel."); } }; public method .channel_moderator_ok() { (> .check_mojo() <); return 1; }; protected method .channel_off() { arg channel; if (active_channels.contains(channel)) { if (channel in ($channel_db.system_channels())) .tell(("<" + channel) + "> You have left this channel."); else .broadcast(channel, ":has left this channel."); active_channels = active_channels.del(channel); } else { .tell("You are not on this channel."); } }; protected method .list_channels_cmd() { arg cmdstr, cmd, args; var opts, f, d, cur_channels, cd_keys, cd_values, i, alias, db, active, msg, match_with, match_pattern, tmp, form, add; (> .perms(caller(), $user) <); opts = (args[2]).slice(1); if ((f = (| "f?ull" in opts |))) f = ((args[2])[f])[3]; if ((d = (| "d?etailed" in opts |))) d = ((args[2])[d])[3]; cd_keys = channel_dict.keys(); cd_values = channel_dict.values(); cur_channels = f ? (($channel_db.database()).values()).slice(1) : cd_values; match_with = (| .setting("match-with") |) || 'match_pattern; match_pattern = (| (args[1])[1] |) || ((| .setting("match-default") |) || "*"); cur_channels = filter f in (cur_channels) where ((f.to_string()).(match_with)(match_pattern) != 0); if (!cur_channels) return "No channels found."; msg = []; add = []; for i in (cur_channels) { alias = (| cd_keys[i in cd_values] |) || ""; db = $channel_db.exact_match(tosym((i.to_string()).lowercase())); msg += [[(active_channels.contains(i)) ? "*" : " ", alias, tostr(db[1]), (db[7]) || "<no description>"]]; form = "%26r: %50l"; if (d) { tmp = [form.format("Number of users", tostr(db[2])), form.format("Owner", (db[5]).name()), form.format("Managers", ((db[6]).mmap('namef, 'name)).to_english())]; if (db[3]) tmp += [form.format("Join Lock", (db[3]).lock_name())]; if (db[4]) tmp += [form.format("Leave Lock", (db[4]).lock_name())]; if (db[8]) tmp += [form.format("Use Lock", (db[8]).lock_name())]; add += [tmp]; } refresh(); } msg = (msg.transpose()).tabulate([["", ""], ["Alias", "-----"], ["Channel", "-------"], ["Description", "-----------"]]); if (d) msg = [msg[1], msg[2], @map i in [3 .. msg.length()] to ([msg[i]] + (add[i - 2])).sum()]; return [@msg, " -----"]; }; public method .listen_channel() { arg channel; if (active_channels.contains(channel)) return 1; return 0; }; public method .channel_members() { arg channel; var q, members; members = []; for q in ($user_db.connected()) { if (q.listen_channel(channel)) members += [q.name()]; } .tell(("Listening to channel " + channel) + ":"); .tell(members.columnize(4)); return members; }; public method .channel_alias() { arg ch_alias; return (| channel_dict[ch_alias] |) || ""; }; public method .channel_msg() { arg channel, msg; (caller() == definer()) || (> .perms(sender(), 'system) <); if ((channel == 'all) || (active_channels.contains(channel))) .tell((("<" + channel) + "> ") + msg); }; protected method .init_channel_ui() { channel_dict = #[]; active_channels = #[]; }; protected method .addcom_cmd() { arg cmdstr, cmd, args; var elements, db, channel, lowerchannel, msg; (> .perms(caller(), $user) <); elements = args.explode("="); if ((elements.length()) != 2) { return "Syntax: @addcom <alias>=<channel_name>"; } else if (channel_dict.contains(elements[1])) { return "You are already using that alias for a channel."; } else { channel = tosym(elements[2]); lowerchannel = tosym((elements[2]).lowercase()); db = (| $channel_db.exact_match(lowerchannel) |) || 0; if (type(db) == 'list) { if ((type(db[3]) == 'frob) && ((!((db[3]).try(sender()))) && (!($sys.is_system(sender()))))) return ("Sorry, channel " + (db[1])) + " is join-locked."; msg = (("Channel " + (elements[2])) + " added with alias ") + (elements[1]); } else if (.can_create_channel()) { db = [channel, 0, 0, 0, sender(), [sender()], 0, 0]; $channel_db.insert(lowerchannel, db); msg = (("Channel " + (elements[2])) + " created with alias ") + (elements[1]); } else { return "Sorry, that channel doesn't exist, and you are not authorized to create new channels."; } } $channel_db.value_changed(lowerchannel, db.replace(2, (db[2]) + 1)); channel_dict = channel_dict.add(elements[1], db[1]); .channel_on(lowerchannel); return msg; }; protected method .delcom_cmd() { arg cmdstr, cmd, args; var db, channel, del_from_db, msg; (> .perms(caller(), $user) <); del_from_db = 1; msg = ("Channel alias " + args) + " deleted."; channel = (| tosym(((channel_dict[args]).to_string()).lowercase()) |) || 0; if (type(channel) == 'symbol) { db = (| $channel_db.exact_match(channel) |) || 0; if (type(db) == 'list) { if ((type(db[4]) == 'frob) && ((!((db[4]).try(sender()))) && (!($sys.is_system(sender()))))) return "Channel leave locked, you can't leave it!"; } else { del_from_db = 0; msg = ("That channel didn't seem to be in the channel database. Channel alias " + args) + " deleted."; } } else { return "You do not have that channel alias defined."; } if (active_channels.contains(db[1])) .channel_off(db[1]); channel_dict = channel_dict.del(args); if (del_from_db) $channel_db.value_changed(channel, db.replace(2, (db[2]) - 1)); return msg; }; public method .channel_dict() { return channel_dict; }; public method .active_channels() { return active_channels; }; public method .can_create_channel() { if ((sender().has_ancestor($user)) && (($channel_ui.channel_creation()) || ($sys.is_system(sender())))) return 1; else return 0; }; protected method .channel_add_lock_cmd() { arg cmdstr, cmd, this, prep, str; var channel, db, lock, mode, modestr; (> .perms(caller(), $user) <); if ((cmd[2]) == "j") { mode = 3; modestr = "join"; } else if ((cmd[2]) == "l") { mode = 4; modestr = "leave"; } else { mode = 8; modestr = "use"; } channel = tosym(this.lowercase()); db = (| $channel_db.exact_match(channel) |) || 0; if (type(db) == 'list) { if ((!(sender() in (db[6]))) && (!($sys.is_system()))) { return "Sorry, you're not on the manager list for that channel."; } else if ((str.length()) == 0) { $channel_db.value_changed(channel, db.replace(mode, 0)); return ((("You un-" + modestr) + "lock channel ") + (db[1])) + "."; } else { catch ~objnf, ~parse { lock = $lock_parser.parse(str, sender()); $channel_db.value_changed(channel, db.replace(mode, lock)); return ((((("You " + modestr) + "lock channel ") + (db[1])) + " with ") + (lock.lock_name('thing))) + "."; } with { switch (error()) { case ~objnf: return "Object not found in lock string."; case ~parse: return "Invalid lock string."; } } } } else { return "Channel not found, nothing locked."; } }; protected method .describe_channel_cmd() { arg cmdstr, cmd, channel, prep, desc; var db, channel; (> .perms(caller(), $user) <); channel = (| tosym(channel.lowercase()) |) || 0; if (channel == 0) return "@desc-ch?annel <channel> as <description>"; db = (| $channel_db.exact_match(channel) |) || 0; if (db == 0) return "That channel does not exist."; if ((!(sender() in (db[6]))) && (!($sys.is_system()))) return "You are not a manager for channel " + (db[1]); $channel_db.value_changed(channel, db.replace(7, desc)); return "Description updated."; }; public method ._broadcast() { arg channel, message; var q; if (!(caller() in [$channel_ui, $user, $sys])) throw(~perm, "You are not allowed to call $channel_ui._broadcast() directly"); for q in ($user_db.connected()) q.channel_msg(channel, message); }; public method .channel_add_manager() { arg cmdstr, cmd, user, prep, channel; var db, channel; channel = (| tosym(channel.lowercase()) |) || 0; if (channel == 0) return "@add-channel-manager|@acm <user> to <channel>"; db = (| $channel_db.exact_match(channel) |) || 0; if (db == 0) return "That channel does not exist."; if ((sender() != (db[5])) && (!($sys.is_system()))) return "You are not the channel owner."; if (user in (db[6])) return ((user.name()) + " is already a manager of channel ") + (db[1]); $channel_db.value_changed(channel, db.replace(6, [@db[6], user])); return "Manager added."; }; public method .channel_del_manager() { arg cmdstr, cmd, user, prep, channel; var db, channel; channel = (| tosym(channel.lowercase()) |) || 0; if (channel == 0) return "@add-channel-manager|@acm <user> from <channel>"; db = (| $channel_db.exact_match(channel) |) || 0; if (db == 0) return "That channel does not exist."; if ((sender() != (db[5])) && (!($sys.is_system()))) return "You are not the channel owner."; if (!(user in (db[6]))) return ((user.name()) + " is not a manager of channel ") + (db[1]); $channel_db.value_changed(channel, db.replace(6, (db[6]).del(user))); return "Manager deleted."; }; public method .channel_creation() { return channel_creation; }; new object $user_info: $has_settings, $user_interfaces; var $root manager = $user_info; var $has_commands remote = #[]; var $root flags = ['variables, 'methods, 'code, 'fertile, 'core]; var $root created_on = 843753238; var $has_commands shortcuts = #[]; var $has_settings defined_settings = #[["real-name", #[['get, 'get_user_info], ['set, 'set_user_info], ['check, 'is_any], ['del, 'del_user_info], ['check_args, []], ['get_args, []], ['set_args, []], ['display, 'display_user_info], ['access_check, 'public_user_info]]], ["email", #[['get, 'get_user_info], ['set, 'set_user_info], ['check, 'is_any], ['del, 'del_user_info], ['check_args, []], ['get_args, []], ['set_args, []], ['display, 'display_user_info], ['access_check, 'public_user_info]]], ["address", #[['get, 'get_user_info], ['set, 'set_user_info], ['check, 'is_any], ['del, 'del_user_info], ['check_args, []], ['get_args, []], ['set_args, []], ['display, 'display_user_info], ['access_check, 'public_user_info]]], ["affiliation", #[['get, 'get_user_info], ['set, 'set_user_info], ['check, 'is_any], ['del, 'del_user_info], ['check_args, []], ['get_args, []], ['set_args, []], ['display, 'display_user_info], ['access_check, 'public_user_info]]], ["position", #[['get, 'get_user_info], ['set, 'set_user_info], ['check, 'is_any], ['del, 'del_user_info], ['check_args, []], ['get_args, []], ['set_args, []], ['display, 'display_user_info], ['access_check, 'public_user_info]]], ["location", #[['get, 'get_user_info], ['set, 'set_user_info], ['check, 'is_any], ['del, 'del_user_info], ['check_args, []], ['get_args, []], ['set_args, []], ['display, 'display_user_info], ['access_check, 'public_user_info]]], ["interests", #[['get, 'get_user_info], ['set, 'set_user_info], ['check, 'is_any], ['del, 'del_user_info], ['check_args, []], ['get_args, []], ['set_args, []], ['display, 'display_user_info], ['access_check, 'public_user_info]]], ["plan", #[['get, 'get_user_info], ['set, 'set_user_info], ['check, 'is_any], ['del, 'del_user_info], ['check_args, []], ['get_args, []], ['set_args, []], ['display, 'display_user_info], ['access_check, 'public_user_info]]], ["projects", #[['get, 'get_user_info], ['set, 'set_user_info], ['check, 'is_any], ['del, 'del_user_info], ['check_args, []], ['get_args, []], ['set_args, []], ['display, 'display_user_info], ['access_check, 'public_user_info]]], ["home-page", #[['get, 'get_user_info], ['set, 'set_user_info], ['check, 'is_any], ['del, 'del_user_info], ['check_args, []], ['get_args, []], ['set_args, []], ['display, 'display_user_info], ['access_check, 'public_user_info]]]]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $root inited = 1; var $has_commands local = #[]; var $user_info info = 0; var $user_info info_defaults = #[["real-name", 1], ["email", 0], ["address", 0], ["affiliation", 0], ["position", 0], ["location", 0], ["interests", 0], ["plan", 0], ["projects", 0], ["home-page", 1]]; var $root managed = [$user_info]; var $root owned = [$user_info]; public method .info_defaults() { arg [name]; if (name) return (> info_defaults[name[1]] <); return info_defaults; }; protected method .get_user_info() { arg name, [args]; if ((| $user_info.info_defaults(name) |) == ~keynf) throw(~setting, ("Invalid user info setting '" + name) + "'"); return (| info[name] |) || [0, ""]; }; protected method .display_user_info() { arg value; return ((value[1]) ? "+public " : "") + toliteral(value[2]); }; protected method .del_user_info() { arg definer, name; if (info.contains(name)) info = info.del(name); }; public method .set_info_default() { arg name, def; def = def ? 1 : 0; info_defaults = dict_add(info_defaults, name, def); }; public method .set_user_info() { arg definer, name, value, [args]; var tmp, bool, public, def; def = $user_info.info_defaults(); if (!(def.contains(name))) throw(~setting, ("Invalid user info setting '" + name) + "'"); value = (value.explode_quoted()).join(" "); if (value && ((value[1]) in ["+", "-"])) { bool = (value[1]) == "+"; tmp = substr(value, 2); if ((tmp = match_template(tmp, "p?ublic *"))) { value = tmp[2]; public = bool; } else { public = def[name]; } } else { public = def[name]; } if (!info) info = #[]; info = info.add(name, [public, value]); }; public method .display_info() { arg [no_blanks]; var out, i, v, sys; out = []; sys = .is_writable_by(sender()); for i in (($user_info.info_defaults()).keys()) { v = (| info[i] |) || [0, ""]; if ((!(v[2])) && no_blanks) continue; if ((v[1]) || sys) out += [(((i.capitalize()) + ":").pad(13)) + (v[2])]; else out += [(((i.capitalize()) + ":").pad(13)) + "** PRIVATE **"]; } return out; }; public method .public_user_info() { arg name, sender; var i; i = (| info[name] |) || [0, ""]; if ((!(i[1])) && (!(.is_writable_by(sender)))) throw(~private, ("'" + name) + "' is private."); }; public method .user_info() { arg name; var i; // call this method to bypass the settings system. i = (| info[name] |) || [0, ""]; if ((!(i[1])) && (!(.is_writable_by(sender())))) throw(~private, ("'" + name) + "' is private."); return i[2]; }; new object $user: $body, $mail_ui, $command_aliases, $bad_commands, $help_ui, $messages_ui, $settings_ui, $editor_reference, $channel_ui, $user_info; var $root inited = 1; var $root created_on = 796268969; var $root owned = [$user]; var $root manager = $user; var $root flags = ['methods, 'code, 'core, 'command_cache, 'variables]; var $root managed = [$user]; var $root child_index = 4; var $location contents = []; var $located location = $body_cave; var $located obvious = 1; var $user password = "*"; var $user connected_at = 0; var $user last_command_at = 0; var $user connections = []; var $user ext_parsers = 0; var $user title = 0; var $user action = 0; var $user activity = 0; var $user parsers = [$command_parser]; var $user context = #[]; var $user remembered = 0; var $user evaluator = 0; var $user connected_seconds = 0; var $user task_connections = #[]; var $user global_tell = 0; var $user formatter = $text_format; var $user content_type = 'plain; var $command_aliases command_aliases = []; var $mail_list letters = #[]; var $mail_list letters_index = #[]; var $mail_list senders = 1; var $mail_list readers = []; var $mail_list notify = [$user]; var $mail_list last_letter = 0; var $mail_list mail = []; var $mail_ui subscribed = #[[$user, [791485891, 0]]]; var $mail_ui current = #[['location, 0], ['list, $user]]; var $has_gender gender = $gender_neuter; var $described prose = []; var $has_name name = ['prop, "Generic User Object", "Generic User Object"]; var $user registered = 0; var $has_commands local = #[["@quit", [["@quit", "", "@quit", 'quit_cmd, #[]]]], ["i?nventory", [["i?nventory", "", "i?nventory", 'inventory_cmd, #[]]]], ["@title", [["@title", "*", "@title <any>", 'title_cmd, #[[1, ['any, []]]]]]], ["@audit", [["@audit", "*", "@audit <any>", 'audit_cmd, #[[1, ['any, []]]]]]], ["@who", [["@who", "*", "@who <any>", 'who_cmd, #[[1, ['any, []]]]]]], ["@del-command-a?lias|@dca?lias", [["@del-command-a?lias|@dca?lias", "*", "@del-command-a?lias|@dca?lias <any>", 'del_command_alias_cmd, #[[1, ['any, []]]]]]], ["@command-a?liases|@ca?liases", [["@command-a?liases|@ca?liases", "*", "@command-a?liases|@ca?liases <any>", 'command_aliases_cmd, #[[1, ['any, []]]]]]], ["@add-command-a?lias|@aca?lias", [["@add-command-a?lias|@aca?lias", "*", "@add-command-a?lias|@aca?lias <any>", 'add_command_alias_cmd, #[[1, ['any, []]]]]]], ["@com?mands", [["@com?mands", "*", "@com?mands <any>", 'commands_cmd, #[[1, ['any, []]]]]]], ["@news", [["@news", "", "@news", 'news_cmd, #[]]]], ["@forget", [["@forget", "*", "@forget <any>", 'forget_cmd, #[[1, ['any, []]]]]]], ["@whereis|@where-is", [["@whereis|@where-is", "*", "@whereis|@where-is <any>", 'whereis_cmd, #[[1, ['any, []]]]]]], ["@ways", [["@ways", "", "@ways", 'ways_cmd, #[]]]], ["@password|@passwd", [["@password|@passwd", "*", "@password|@passwd <any>", 'password_cmd, #[[1, ['any, []]]]]]], ["@age", [["@age", "*", "@age <object>", 'age_cmd, #[[1, ['object, []]]]]]], ["@context", [["@context", "", "@context", 'context_cmd, #[]]]], ["get|take", [["get|take", "*", "get|take <thing>", 'get_cmd, #[[1, ['descendant, [$thing]]]]], ["get|take", "* from *", "get|take <any> from <descendant of $location>", 'get_from_cmd, #[[1, ['any, []]], [3, ['descendant, [$location]]]]]]], ["drop", [["drop", "*", "drop <thing>", 'drop_cmd, #[[1, ['descendant, [$thing]]]]]]], ["@rename", [["@rename", "*", "@rename <any>", 'rename_cmd, #[[1, ['any, []]]]]]], ["@add-writer|@aw", [["@add-writer|@aw", "*", "@add-writer|@aw <any>", 'add_writer_cmd, #[[1, ['any, []]]]]]], ["@del-writer|@dw", [["@del-writer|@dw", "*", "@del-writer|@dw <any>", 'del_writer_cmd, #[[1, ['any, []]]]]]], ["@chman?age", [["@chman?age", "*", "@chman?age <any>", 'chmanage_cmd, #[[1, ['any, []]]]]]], ["@manage?d", [["@manage?d", "*", "@manage?d <any>", 'managed_cmd, #[[1, ['any, []]]]]]], ["@remember", [["@remember", "* as *", "@remember <object> as <any>", 'remember_cmd, #[[1, ['object, []]], [3, ['any, []]]]]]], ["@remembered", [["@remembered", "*", "@remembered <any>", 'remembered_cmd, #[[1, ['any, []]]]]]], ["give|put", [["give|put", "* to|in *", "give|put <thing> to|in <thing>", 'give_to_cmd, #[[1, ['descendant, [$thing]]], [3, ['descendant, [$thing]]]]]]], ["discard", [["discard", "*", "discard <object>", 'discard_cmd, #[[1, ['object, []]]]]]], ["@writes", [["@writes", "*", "@writes <object>", 'writes_cmd, #[[1, ['object, []]]]]]], ["@trusted?-by", [["@trusted?-by", "*", "@trusted?-by <object>", 'trusted_by_cmd, #[[1, ['object, []]]]]]], ["@add-trust?ee|@at", [["@add-trust?ee|@at", "*", "@add-trust?ee|@at <object:>", 'add_trustee_cmd, #[[1, ['object_opt, []]]]]]], ["@del-trust?ee|@dt", [["@del-trust?ee|@dt", "*", "@del-trust?ee|@dt <object:>", 'del_trustee_cmd, #[[1, ['object_opt, []]]]]]], ["@monitor", [["@monitor", "*", "@monitor <any>", 'monitor_cmd, #[[1, ['any, []]]]]]], ["@ex?amine", [["@ex?amine", "*", "@ex?amine <object:+c?hop>", 'examine_cmd, #[[1, ['object_opt, [["c?hop"]]]]]]]], ["@map", [["@map", "", "@map", 'map_cmd, #[]]]], ["@finger|@ustat", [["@finger|@ustat", "*", "@finger|@ustat <user>", 'finger_cmd, #[[1, ['user, []]]]]]], ["@trusts|@trustee?s", [["@trusts|@trustee?s", "*", "@trusts|@trustee?s <object>", 'trusts_cmd, #[[1, ['object, []]]]]]], ["@writers", [["@writers", "*", "@writers <object>", 'writers_cmd, #[[1, ['object, []]]]]]], ["@manager", [["@manager", "*", "@manager <object>", 'manager_cmd, #[[1, ['object, []]]]]]], ["view", [["view", "*", "view <any>", 'view_detail_cmd, #[[1, ['any, []]]]]]], ["@desc?ribe|@prose", [["@desc?ribe|@prose", "*", "@desc?ribe|@prose <any>", 'description_cmd, #[[1, ['any, []]]]]]], ["l?ook|exam?ine", [["l?ook|exam?ine", "*", "l?ook|exam?ine <any>", 'look_cmd, #[[1, ['any, []]]]]]], ["walk|go", [["walk|go", "*", "walk|go <any>", 'go_cmd, #[[1, ['any, []]]]]]], ["@ant|@add-name-template", [["@ant|@add-name-template", "*", "@ant|@add-name-template <any>", 'add_name_template_cmd, #[[1, ['any, []]]]]]], ["@dnt|@del-name-template", [["@dnt|@del-name-template", "*", "@dnt|@del-name-template <any>", 'del_name_template_cmd, #[[1, ['any, []]]]]]], ["@name-template?s|@template?s", [["@name-template?s|@template?s", "*", "@name-template?s|@template?s <object>", 'name_templates_cmd, #[[1, ['object, []]]]]]], ["@register|@register-name", [["@register|@register-name", "*", "@register|@register-name <any>", 'register_name_cmd, #[[1, ['any, []]]]]]], ["@unregister|@unregister-name", [["@unregister|@unregister-name", "*", "@unregister|@unregister-name <any>", 'unregister_name_cmd, #[[1, ['any, []]]]]]], ["@registered", [["@registered", "", "@registered", 'registered_cmd, #[]]]], ["@page", [["@page", "* with *", "@page <any> with <any>", 'remote_cmd, #[[1, ['any, []]], [3, ['any, []]]]]]], ["@paste?-to", [["@paste?-to", "*", "@paste?-to <any>", 'paste_cmd, #[[1, ['any, []]]]]]], ["@new", [["@new", "*", "@new <any>", 'new_cmd, #[[1, ['any, []]]]]]], ["@status|@uptime", [["@status|@uptime", "*", "@status|@uptime <any>", 'status_cmd, #[[1, ['any, []]]]]]]]; var $has_commands shortcuts = #[["--*", ['remote_cmd, ["@page ", "", " with ", 1]]], ["-* *", ['remote_cmd, ["@page ", 1, " with ", 2]]]]; var $has_settings settings = #[[$user, #[["exit-style", 'none]]]]; var $has_settings setting_types = #[["terminated-tell", #[['type, "boolean"], ['check, 'is_boolean], ['get, 'get_direct_setting], ['set, 'set_direct_setting], ['del, 'del_direct_setting], ['set_args, ['name, 'definer, 'value, 'style]], ['get_args, ['name, 'definer]]]], ["content-type", #[['type, "string"], ['check, 'is_anything], ['get, 'get_direct_setting], ['set, 'set_direct_setting], ['del, 'del_direct_setting], ['set_args, ['name, 'definer, 'value, 'style]], ['get_args, ['name, 'definer]]]]]; var $has_settings setting_data = #[[$user, #[["content-type", "text/plain"]]]]; var $has_settings defined_settings = #[["content-type", #[['get, 'get_local_setting], ['set, 'set_content_type], ['check, 'check_content_type], ['del, 'delete_local_setting], ['check_args, []], ['get_args, []], ['set_args, []]]], ["experienced", #[['get, 'get_local_setting], ['set, 'set_local_setting], ['check, 'is_boolean], ['del, 'delete_local_setting], ['check_args, []], ['get_args, []], ['set_args, []], ['display, 'display_boolean_yes_no]]], ["global-tell", #[['get, 'get_global_tell], ['set, 'set_global_tell], ['check, 'is_boolean], ['del, 'delete_local_setting], ['check_args, []], ['get_args, []], ['set_args, []], ['type, "boolean"], ['display, 'display_boolean_yes_no]]], ["use-cml", #[['get, 'get_local_setting_boolean], ['set, 'set_local_setting], ['check, 'is_any], ['del, 'delete_local_setting], ['check_args, []], ['get_args, []], ['set_args, []], ['type, "boolean"], ['display, 'display_boolean_yes_no]]], ["cols", #[['get, 'get_cols], ['set, 'set_cols], ['check, 'is_type], ['del, 'delete_local_setting], ['check_args, ['integer]], ['get_args, []], ['set_args, []]]], ["rows", #[['get, 'get_rows], ['set, 'set_rows], ['check, 'is_type], ['del, 'delete_local_setting], ['check_args, ['integer]], ['get_args, []], ['set_args, []]]], ["extended-parsers", #[['get, 'get_local_setting], ['set, 'set_local_setting], ['check, 'check_ext_parsers], ['del, 'delete_local_setting], ['check_args, []], ['get_args, []], ['set_args, []], ['display, 'display_ext_parsers]]], ["prompt", #[['get, 'get_local_setting], ['set, 'set_local_setting], ['check, 'is_boolean], ['del, 'delete_local_setting], ['check_args, []], ['get_args, []], ['set_args, []], ['display, 'display_boolean_yes_no]]], ["exit-style", #[['get, 'get_local_setting], ['set, 'set_local_setting], ['check, 'check_exit_style], ['del, 'delete_local_setting], ['check_args, []], ['get_args, []], ['set_args, []], ['display, 'display_exit_style]]]]; var $has_settings local_settings = ["exit-style"]; var $user monitor = 0; var $root trusted_by = [$user_db]; var $user failed = 0; var $channel_ui channel_dict = #[]; var $channel_ui active_channels = #[]; var $user rows = 0; var $user cols = 0; var $editor_reference bg_sessions = []; root method .init_user() { password = "*"; connected_at = 0; last_command_at = 0; connections = []; parsers = [$command_parser, $channel_parser]; action = ""; context = #[]; .set_quota($sys.get_starting('quota)); $user_db.insert(.name(), this()); .set_flags([]); .move_to($body_cave); task_connections = #[]; formatter = $text_format; }; root method .uninit_user() { var conn; if (.connected()) (| (.location()).did_disconnect() |); // and incase any are lying about for conn in (connections) (| conn.interface_going_away() |); password = 0; connections = 0; (| $user_db.remove(.name()) |); }; public method .will_move() { arg mover, place; (> pass(mover, place) <); if (place.is($user)) throw(~user, "Users cannot move into other users!"); if ((mover.is($user)) && ((mover != this()) && (!($sys.is_system(mover))))) throw(~user, "Only administrators can freely move users around."); }; public method .connected_at() { return connected_at; }; public method .last_command_at() { return last_command_at; }; public method .tell() { arg what, [who]; if (!(.connected())) return; if (monitor != 0) { if (listlen(monitor) > 19) monitor = [[user(), @stack()[2], what], @delete(monitor, 10)]; else monitor = [[user(), @stack()[2], what], @monitor]; } ._tell(what); }; public method .set_password() { arg str; (> .perms(sender(), 'manager) <); if ((str.length()) < 5) throw(~badpasswd, "Passwords must be at least 5 characters long."); password = crypt(str); }; public method .check_password() { arg str, [cinfo]; var match, warn; (> .perms(caller(), definer(), $login_interface) <); // no password means always match if (!password) return 1; // "*" means never match if (password == "*") return 0; match = match_crypted(password, str); // keep track of failed attempts, if its from a connection if ((!match) && cinfo) { if (.connected()) .tell("<Login> Failed Login Attempt from " + (cinfo[1])); else failed++; } // update old DES passwords to newer SHA passwords if (match && (!match_begin(password, "$2$"))) password = crypt(str); // done return match; }; public method .did_move() { arg [args]; (| .reset_actions() |); (> pass(@args) <); .tell(.look_cmd("look", "look", "")); }; public method .parsers() { .perms(sender(), 'trusts); return parsers; }; protected method .add_parser() { arg parser, [over_pr]; var x, pr; [(pr ?= parser.priority())] = over_pr; // does it exist? If so remove it. while (parser in parsers) parsers = setremove(parsers, parser); for x in [1 .. listlen(parsers)] { if (((parsers[x]).priority()) > pr) { parsers = insert(parsers, x, parser); return; } } parsers += [parser]; }; public method .del_parser() { arg parser; var keepers; // removes a parser. Cannot remove $command_parser (put things in // front of it instead). if (parser == $command_parser) throw(~no, "You must always have the $command_parser."); parsers = parsers.setremove(parser); }; public method .parse_line() { arg line; var parse, c, r, rval; (> .perms(caller(), $connection) <); set_user(); // if we dont set it, it'll act like normal rval = this(); last_command_at = time(); catch any { task_connections = task_connections.add(task_id(), sender()); parse = parsers ? (parsers[1]).parse(this(), line, @parsers.subrange(2), $null_parser) : ['failed]; switch (parse[1]) { case 'action: r = (| (parse[2]).action(@parse[3]) |); if (type(r) in ['list, 'frob, 'string]) .ptell(r, #[['type, 'parser], ['action, parse[3]]]); else .tell(("Invalid registered action '" + (parse[3])) + "'"); case 'error: .tell(parse[2]); case 'match, 'command: r = (> (parse[2]).(parse[3])(@parse.subrange(4)) <); if (type(r) in ['list, 'frob, 'string]) .ptell(r, #[['type, 'parser], ['command, parse[3]]]); else rval = r; case 'failed: for c in (($place_lib.coordinate_shortcuts()).keys()) { if (line.match_template(c)) { .tell(("There is no exit " + line) + " here."); r = 1; } } if (!r) .tell(("I don't understand " + (line.chop((.linelen()) - 22))) + "."); case 'ok: // do nothing, probably a null command default: .tell("Unusual response from the parser: " + toliteral(parse)); } } with { if (error() == ~stop) { if ((traceback()[1])[2]) .tell((traceback()[1])[2]); } else { .tell_traceback(traceback(), line, 0, error()); } } catch any task_connections = task_connections.del(task_id()); return rval; }; public method .login() { arg connection; var loc, cmd, p, c, last; if ((sender() != this()) || (definer() != caller())) throw(~perm, "Invalid access to private method."); task_connections = #[]; (| .reset_parsers() |); for cmd in (.local_commands()) { for c in (cmd[2]) .add_to_local_cache(c[1]); } (| .reset_help_history() |); for p in (parents()) p.cache_init(); $user_db.did_connect(); last = connected_at; connected_at = time(); last_command_at = time(); loc = .location(); if (loc == $body_cave) { if ((.home()) != $body_cave) (| .move_to(.home()) |); else (| .move_to($world.starting_place()) |); } else { .tell(.look_cmd("", "", "")); } (| (.location()).did_connect() |); (| .login_notify(connection, last) |); (| .edit_sessions_notify() |); .hook_events('startup); $channel_ui._broadcast('Login, (((.namef('titled)) + " has connected (total: ") + ($user_db.total_connected())) + ")"); }; public method .login_again() { arg connection; if ((sender() != this()) || (definer() != caller())) throw(~perm, "Invalid access to private method."); last_command_at = time(); (| .tell(("<Login> " + (((.connections()).length()).n_to_nth())) + " login.") |); if (failed) { (> .tell(("<Login> ** " + failed) + " failed login attempts **") <); (| clear_var('failed) |); } }; public method .logout() { arg connection; var p; (| (.location()).did_disconnect() |); (| .reset_parsers() |); (| .reset_actions() |); (| .clear_help_history() |); (| $user_db.did_disconnect() |); // Track how long they are online (random info) -Lynx connected_seconds += time() - connected_at; // set this to -last_command so we know they aren't connected // (and using last command will be last_login) connected_at = -last_command_at; // user specific things if (!($guest in (.parents()))) { (| $housekeeper.did_disconnect() |); (| $user_db.last_log_disconnect(this()) |); } else { (| $user_db.last_log_disconnect($guest) |); } (| .purge_caches() |); for p in (parents()) p.cache_uninit(); $channel_ui._broadcast('Login, (((.namef('titled)) + " has disconnected (total: ") + ($user_db.total_connected())) + ")"); task_connections = #[]; .set_activity(""); (| clear_var('monitor) |); (| .new_list(this()) |); .unhook_events('startup); }; public method .connections() { return connections; }; public method .connected() { return connections ? 1 : 0; }; protected method .who_cmd() { arg cmdstr, com, [line]; var who, opts, opt, args, all; (> .perms(caller(), $user) <); // just the basic who listing who = []; if (!(line[1])) { args = [$user_db.connected(), "Connected Users"]; } else if (((line[1])[1]) == "@") { args = ._who_at_place((line[1]).subrange(2)); } else { args = $parse_lib.getopt(line[1], [["a?ll"], ["p?rogrammers"], ["a?dmins"], ["s?hort"]]); opts = args[2]; args = args[1]; if ((opt = "a?ll" in (opts.slice(1)))) all = (opts[opt])[3]; if ((opt = "p?rogrammers" in (opts.slice(1)))) args = ._who_programmers(args, all); else if ((opt = "a?dmins" in (opts.slice(1)))) args = ._who_admins(args, all); else if ((opt = "s?hort" in (opts.slice(1)))) return ._who_short(); else args = ._who_is(@line); } if (!args) return "Ack, nobody to list?"; .tell($code_lib.generate_listing(@args)); }; protected method .quit_cmd() { arg [args]; (> .perms(caller(), $user) <); return 'disconnect; }; protected method .inventory_cmd() { arg [args]; var i; (> .perms(caller(), $user) <); if (.contents()) { .tell("Carrying:"); for i in (.contents()) .tell(" " + (i.name())); } else { .tell("You are empty-handed."); } // $# Edited 05 Nov 1995 13:54 Lynx ($lynx) }; public method .match_env_nice() { arg name, [syntax]; var obj, args, line; // calls .match_environment() returns nice errors. as well as stopping if it // breaks. No returns neccessary [(syntax ?= "")] = syntax; catch any obj = .match_environment(name); with (> .tell_error(syntax, (traceback()[1])[2]) <); return obj; }; public method .linelen() { if (cols) return cols - 1; return 79; // backwards compatability, older tiny style systems // want linelen to actually be cols - 1 }; public method .idle_seconds() { return time() - last_command_at; }; public method .title() { return title || ""; }; public method .action() { // different from activity, returns a more accurate second to second action if (.connected()) return action || ""; else return "(asleep)"; }; protected method .title_cmd() { arg cmdstr, com, str; (> .perms(caller(), $user) <); catch any { .set_title(str); .tell(("Title Set as: \"" + str) + "\""); } with { return (traceback()[1])[2]; } }; protected method .commands_cmd() { arg cmdstr, cmd, args; var s, full, o, opt, opts, lcmds, rcmds, len, obj, shorts, m, c, local, remote, short, all; (> .perms(caller(), $user) <); s = cmd + " [options] <object>"; opts = [["f?ull"], ["a?ll"], ["l?ocal"], ["r?emote"], ["s?hortcuts"]]; args = $parse_lib.getopt(args, opts); o = args[2]; local = (remote = (short = 1)); if ((opt = "f?ull" in (o.slice(1)))) full = (o[opt])[3]; if ((opt = "a?ll" in (o.slice(1)))) all = (o[opt])[3]; if ((opt = "r?emote" in (o.slice(1)))) remote = (o[opt])[3]; if ((opt = "s?hortcuts" in (o.slice(1)))) short = (o[opt])[3]; if ((opt = "l?ocal" in (o.slice(1)))) local = (o[opt])[3]; args = (args[1]).join(); if ((!args) && (!all)) { (| .tell_error(cmd + " [options] <object>") |); return "! Defaults: -f?ull -a?ll +l?ocal +r?emote +s?hortcuts"; } else { args = args || "me"; obj = .match_env_nice(args); } lcmds = (rcmds = #[]); shorts = []; if (all) { if (local) lcmds = obj.all_local_commands(); if (remote) rcmds = obj.all_remote_commands(); if (short) shorts = obj.all_shortcuts(); } else { if (local) { c = obj.local_commands(); if (c) lcmds = #[[obj, c]]; } if (remote) { c = obj.remote_commands(); if (c) rcmds = #[[obj, c]]; } if (short) shorts = (obj.shortcuts()).to_list(); } if (full) { m = 'format_commands_long; len = ((.linelen()) / 3) * 2; } else { m = 'format_commands_short; len = .linelen(); } o = []; if (lcmds) o += $command_lib.(m)(lcmds, "Local", len); if (rcmds) o += $command_lib.(m)(rcmds, "Remote", len); if (shorts) { o += ["Shortcuts:"]; if (full) m = 'unparse_shortcut_full; else m = 'unparse_shortcut; for c in (shorts) o += [" " + $command_lib.(m)(c)]; } return o || ("No commands defined on " + (obj.namef('ref))); }; public method .display_ext_parsers() { arg value; return value.to_english(); }; public method .activity() { arg [noidle]; var idle; // different from action, returns a broader version of your doings if (!(.connected())) return "asleep"; if (activity) return activity; if (noidle) return ""; idle = .idle_seconds(); if (idle < 180) return ""; if (idle < 300) return "daydreaming"; if (idle < 900) return "zoned"; else return "long gone"; // $# Edited 28 Oct 1995 20:36 Lynx ($lynx) }; public method .home() { arg [args]; return (| .get_local_setting("home", $thing) |) || $body_cave; }; protected method .rename_cmd() { arg cmdstr, cmd, args; var obj, name, templates, article, old, oldart, oldts, new, t; (> .perms(caller(), $user) <); args = args.explode_quoted(); if ((listlen(args) > 2) && ((args[2]) == "to")) args = delete(args, 2); if (listlen(args) > 2) args = [args[1], sublist(args, 2).join()]; if ((!args) || (listlen(args) != 2)) return ("Syntax: `" + cmd) + " \"<object>\" [to] \"<newname>\" [+(proper|unique|normal)]`"; obj = (> .match_env_nice(args[1]) <); catch any { name = (> $code_lib.parse_name(sublist(args, 2).join()) <); templates = name[2]; article = (name[1])[2]; name = (name[1])[1]; if ((name[1]) == "$") { if (((obj.is($user)) || (obj.is($place))) && (!(.is($admin)))) return "User objnames can only be changed by administrators."; name = substr(name, 2); if (!(name.valid_ident())) return "Object names can only contain a-z, 0-9 and the underscore."; name = tosym(name); old = obj.namef('xref); (> obj.set_objname(name) <); return ((("Renamed " + old) + " to ") + obj) + "."; } else { if (!(obj.has_ancestor($has_name))) return ("Object \"" + obj) + "\" cannot have a regular name."; oldart = (obj.name('literal))[1]; oldts = obj.name_templates(); old = ((((" [" + article) + "] \"") + (obj.name())) + "\"") + (templates ? (" (" + (oldts.to_english())) + ")" : ""); old = ("\"" + (obj.name())) + "\""; obj = (> obj.set_name(name, article) <); new = ("\"" + (obj.name())) + "\""; if (templates) { for t in (templates) obj = (> obj.add_name_template(t) <); new += (" (" + ((obj.name_templates()).to_english())) + ")"; old += (" (" + (oldts.to_english())) + ")"; } if (oldart != ((obj.name('literal))[1])) { old = (("[" + oldart) + "] ") + old; new = (("[" + ((obj.name('literal))[1])) + "] ") + new; } return ((("Renamed " + old) + " to ") + new) + "."; } } with { return (traceback()[1])[2]; } }; protected method .audit_cmd() { arg cmdstr, cmd, args; var who, obj, col, str, out, total, line, syntax, loc, size, full, s, o; (> .perms(caller(), $user) <); o = $parse_lib.getopt(args, [["f?ull"]]); args = (o[1]).join(); full = (| "f?ull" in ((o[2]).slice(1)) |); if (full) full = ((o[2])[full])[3]; who = (| .match_environment(args) |); if (!who) { who = (| $user_db.search(args) |); if (!who) return ("Unable to find \"" + args) + "\"."; } if (!(who.managed())) return (who.name()) + " does not managed anything."; if (full) { col = (.linelen()) / 2; out = [(((("Objects managed by " + (who.namef('ref))) + ":").pad(col)) + ("bytes".pad(-10))) + " Location"]; for obj in (who.managed()) { if (!valid(obj)) { .tell((" ** invalid object (" + toliteral(obj)) + ") **"); continue; } line = (" " + (obj.namef('xref))).pad(col); s = obj.size(); size = s.to_english(); line = (line + (size.pad(-(((size.length()) > 10) ? size.length() : 10)))) + " "; loc = (obj.has_ancestor($located)) ? ("[" + ((obj.location()).name())) + "]" : ""; out += [(line + loc).pad(.linelen())]; total += s; } } else { if ((who != this()) && (!(.is($admin)))) return "Only admins can get quota usage information from other users."; out = [("Quota information on " + (who.namef('ref))) + ":"]; for obj in (who.managed()) { if (valid(obj)) total += obj.size(); } } if ((who == this()) || (.is($admin))) { out += [("Total usage: " + ($integer.to_english(total))) + " bytes"]; size = who.get_quota(); line = ("Total quota: " + ($integer.to_english(size))) + " bytes"; out += [line, ("Remaining: " + ($integer.to_english(size - total))) + " bytes"]; } if (!(who.quota_valid())) { if (who == this()) out += ["*** You are over quota! ***"]; else out += [("*** " + (who.name())) + " is over quota! ***"]; } return out; }; protected method .login_notify(): forked { arg connection, last; var l, sub, out; sub = .subscribed(); out = []; for l in ((sub.keys()).setremove(this())) { if ((l.last_received_on()) > ((sub[l])[1])) out += [l.mail_name()]; } if (out) .tell("<Mail> New mail on lists: " + (out.to_english())); if ((.last_received_on()) > (((.subscribed())[this()])[1])) .tell("<Mail> You have new mail (use `@help mail` to learn about mail)"); .tell("<Login> Last connected at " + ($time.format("%A %B %e %I:%M %p %Y", abs(last)))); if (failed) { (| .tell(("<Login> ** " + failed) + " failed login attempts **") |); (| clear_var('failed) |); } }; protected method .news_cmd() { arg [args]; var line, x, mail, m, base, length, out; (> .perms(caller(), $user) <); mail = $mail_list_news.recent_mail(); base = mail[1]; mail = mail[2]; length = mail.length(); .new_list($mail_list_news); out = [($motd.server_name()) + " news:", ""]; for x in [1 .. length] { m = mail[x]; out += [((((m.has_read(this())) ? " " : "NEW => ") + (tostr(x + base).pad(-3))) + ") ") + (m.subject())]; } return out + ["", "Use \"@read #\", where # is the news item number, such as \"@read 1\". All news items can be found on mail list *news.", "---"]; }; protected method .add_command_alias_cmd() { arg cmdstr, cmd, input; (> .perms(caller(), $user) <); input = input.explode_quoted(); if (listlen(input) == 3) input = input.delete(2); if (listlen(input) != 2) return ("Syntax: `" + cmd) + " \"<alias>\" [to] \"<actual command>\"`"; catch any (> .add_command_alias(@input) <); with return (traceback()[1])[2]; return strfmt("New command alias %d => %d added.", @input); }; protected method .del_command_alias_cmd() { arg cmdstr, com, template; (> .perms(caller(), $user) <); template = (template.explode_quoted())[1]; catch ~aliasnf (> .del_command_alias(template) <); with return ("No command alias found matching \"" + template) + "\"."; return ("Deleted command alias \"" + template) + "\"."; }; protected method .command_aliases_cmd() { arg cmdstr, com, what; var aliases, a, line, str, num, out, left, right; (> .perms(caller(), $user) <); if (!what) what = this(); else what = (> .match_env_nice(what) <); if ((what != this()) && (!(what.is_writable_by(this())))) return ("You are not allowed to read the command aliases on " + (what.namef('ref))) + "."; out = [("--- Command aliases on " + (what.namef('ref))) + ":"]; aliases = what.command_aliases(); if (aliases) { for a in (aliases) { str = a[1]; num = 0; while ("*" in str) { num++; left = str.subrange(1, ("*" in str) - 1); right = str.subrange(("*" in str) + 1); str = ((left + "%") + tostr(num)) + right; } out += [strfmt(" %30d => %d", str, $command_lib.format_relation(a[2]))]; } } else { out += [" <none>"]; } return out + ["---"]; }; protected method ._tell() { arg what, [args]; var line, conn, type, f; switch (type(what)) { case 'frob: what = $parse_lib.filter_ctext(what, #[['formatter, formatter]]); case 'string: if (content_type == 'html) what = (((what.replace("&", "&")).replace("<", "<")).replace(">", ">")) + "<br>"; // if (content_type == 'wrapped) { // what = strsub(what, "\\", "\\\\"); // what = str_to_buf(what.wrap_line(.linelen(), " ") + "\n"); // } case 'list: for line in (what) ._tell(line); return; case 'buffer: throw(~nobuf, "You are not allowed to send buffers."); } conn = (| .task_connection() |); if (conn && (!global_tell)) { conn.write(what); } else { for conn in (connections) (| conn.write(what) |); } }; private method .registered_cmd() { arg [args]; return ("Registered names: " + ((registered || []).to_english("none"))) + "."; }; private method .unregister_name_cmd() { arg cmd, cmdstr, name; catch any (> .unregister_name(name) <); with return (traceback()[1])[2]; return [("Unregistered alternate name \"" + name) + "\".", ("Registered names: " + ((registered || []).to_english("none"))) + "."]; }; public method .tell_traceback() { arg traceback, [args]; var tt, name, eargs, error, str; // tt = tell_traceback || ['verbose, 0, "! "]; [(str ?= ""), (eargs ?= 0), (error ?= 0)] = args; tt = ['verbose, -1, "! "]; traceback = $parse_lib.traceback(traceback, tt[2], tt[3], error); if (args) name = (| $list.to_english($list.mmap(args, 'namef, 'ref)) |); if (!name) name = "Object"; .tell((traceback[1]).replace("%O", name)); .tell(traceback.subrange(2)); }; public method .namef() { arg type; var str; switch (type) { case 'doing: str = .activity('noidle); if (str) return (((.name()) + " (") + str) + ")"; return .name(); case 'nactivity, 'activity: str = .activity(); if (str) return (((.name()) + " (") + str) + ")"; return .name(); case 'titled: str = .title(); if (str) return (((.name()) + " (") + str) + ")"; return .name(); default: return (> pass(type) <); } // $# Edited 28 Oct 1995 21:06 Lynx ($lynx) }; protected method .password_cmd(): nooverride { arg cmdstr, com, args; var syn, c, curr, new, verify; (> .perms(caller(), $user) <); syn = com + " [<old password> [<new password>]]"; args = explode(args); c = .task_connection(); if (!args) { c.local_echo_off(); while ((!curr) && (curr != "@abort")) curr = (.prompt("Current Password (@abort to abort): ")).trim(); c.local_echo_on(); } else { curr = args[1]; } if (!(.check_password(curr))) return "Invalid Password"; if (listlen(args) < 2) { c.local_echo_off(); while (1) { while ((!new) && (new != "@abort")) new = (.prompt("New Password (@abort to abort): ")).trim(); while ((!verify) && (verify != "@abort")) verify = (.prompt("Retype New Password (@abort to abort): ")).trim(); if (new == verify) break; .tell("Passwords do not match!"); new = (verify = 0); } c.local_echo_on(); } else if (listlen(args) == 2) { new = args[2]; } else { .tell_error(syn); } catch any .set_password(new); with .tell_error(syn, (traceback()[1])[2]); .tell("Password changed."); }; public method .set_title() { arg str; .perms(sender(), 'manager); if ((str.length()) > 30) throw(~type, "Titles must be under 30 characters."); title = str; }; public method .match_context() { arg str; return context[str]; }; public method .context() { return context; }; public method .match_environment() { arg str; var match, gend; if ((!str) && (match = (| context['last] |))) { if (!valid(match)) context = context.del('last); else return match; } if ((match = (| (.remembered())[str] |))) { if (!valid(match)) .del_remembered(str); else return match; } match = (> pass(str) <); if (match.has_ancestor($thing)) { gend = (| match.gender() |); if (gend) context = context.add(gend.pronoun('po), match); } context = context.add('last, match); return match; }; public method .non_terminated_tell() { arg text; var conn; if ((| .get_local_setting("prompt", $user) |)) { conn = (| .task_connection() |); if (conn && (!global_tell)) { conn.write(text, 'non_terminated); } else { for conn in (connections) (| conn.write(text, 'non_terminated) |); } } else { .tell(text); } }; public method .set_name() { arg new_name, [ignore]; var old_name, part, sname; (> .perms(sender(), 'manager) <); // so it doesnt bomb on .set_objname if ((> $user_db.valid_name(new_name) <)) old_name = .name(); catch any { (> pass(new_name, 'prop) <); if (new_name in (registered || [])) .unregister_name(new_name); if (!(| $user_db.key_changed(old_name, new_name) |)) $user_db.insert(new_name, this()); if (old_name != new_name) { sname = new_name.strip(); (> .set_objname(tosym("user_" + sname)) <); } } with { (| pass(old_name, 'prop) |); rethrow(error()); } }; public method .find_object_nice() { arg str, [args]; var match; catch any { match = .find_object(str, @args); } with { .tell("! " + ((traceback()[1])[2])); throw(~stop, ""); } return match; }; public method .find_object() { arg str, [args]; var trace, match; // comprehensive matching method. // args define what to match. if (!args) args = ['environment]; while (args) { switch (args[1]) { case 'environment: match = (| .match_environment(str) |); case 'user: match = (| $user_db.search(str) |); case 'grasp: match = (| $object_lib.to_dbref(str) |); } if (match) return match; args = args.delete(1); } throw(~objnf, ("No object found by the reference \"" + str) + "\"."); }; protected method .age_cmd() { arg cmdstr, com, obj; var time, gender, out; (> .perms(caller(), $user) <); time = obj.created_on(); if (obj.is($has_gender)) gender = (obj.gender()).pronoun('psc); else gender = "It"; out = [((obj.name()) + " was created on ") + ($time.format("%A %B %e %Y", time)), ((gender + " is ") + ($time.elapsed(time() - time, 'long))) + " old."]; if (obj.is($user)) out += [((gender + " has logged ") + ($time.elapsed(obj.connected_seconds(), 'long))) + " online."]; return out; }; protected method .new_cmd() { arg cmdstr, cmd, args; var match, name, parent, line, set, nprog, new, t; (> .perms(caller(), $user) <); if ((match = match_template(args, "* named *"))) { name = match[3]; args = match[1]; } else { name = ""; } catch any parent = (> .match_env_nice(args) <); with return (traceback()[1])[2]; if (!(parent.is($physical))) return ((parent.namef('ref)).capitalize()) + " is not a VR object, you can only create new objects from VR objects (try @spawn)."; if (name) { catch any name = (> $code_lib.parse_name(name) <); with return (traceback()[1])[2]; } // spawn from the first parent, add the others catch any { new = (> parent.new() <); if (new.is($located)) new = (> new.move_to(this()) <); if (name) { new = (> new.set_name(@name[1]) <); for t in (name[2]) new = (> new.add_name_template(t) <); } return (("You create \"" + (new.namef('ref))) + "\"") + ((new.name_templates()) ? (" (" + ((new.name_templates()).to_english())) + ")" : ""); } with { .tell((traceback()[1])[2]); if (valid(new)) { line = new.namef('xref); catch ~isfrob (> new.destroy() <); with (> new.discard() <); if (valid(new)) return ("Unable to destroy new object " + line) + "."; else return ("Sucessfully destroyed new object " + line) + "."; } } }; protected method .description_cmd() { arg cmdstr, cmd, str; var args, obj, desc, long; (> .perms(caller(), $user) <); if ((args = match_template(str, "* as *"))) { obj = (> .match_env_nice(args[1]) <); desc = ((args[3]).trim()).unquote(); } else { obj = (> .match_env_nice(str) <); if ((desc = .read()) == 'aborted) return; } if (!desc) return "You must specify a description."; catch any obj.set_prose(desc); with return (traceback()[1])[2]; return ("Description for " + (obj.namef('ref))) + " set."; }; protected method .status_cmd() { arg cmdstr, com, [args]; var line, s, x, out; (> .perms(caller(), $user) <); s = $sys.status(); for x in [1 .. s.length()] { if ((s[x]) < 0) s = s.replace(x, "(unknown)"); } out = [("--- " + ($motd.server_name())) + " status report ---"]; if ($sys.dirty()) out += ["System is: dirty, will do normal backup."]; else out += ["System is: clean, will skip backup."]; out += ["System lag: " + ($lag_watcher.lag()), "Next dbref: " + ($sys.next_objnum()), "Driver: " + ($sys.server_info('driver_version, 'long)), "Core: " + ($sys.server_info('core_version, 'long)), ("Started: " + ($time.to_english(time() - ($sys.server_info('startup_time))))) + " ago", ("Backup: last: " + ($time.to_english(time() - (s[21])))) + " ago", (" next: " + ($time.to_english((s[22]) - time()))) + " from now", " interval: " + ($time.to_english(s[20])), ("Page: " + tostr(s[9])) + " reclaims", (" " + tostr(s[10])) + " faults", "Signals: " + tostr(s[16]), ("Context switches: " + tostr(s[17])) + " voluntary", (" " + tostr(s[18])) + " involuntary"]; return out; }; public method .del_command_alias() { arg alias; (> .perms(sender()) <); (> pass(alias) <); if ((!(.command_aliases())) && ($command_aliases_parser in (.parsers()))) { .tell("Removing $command_aliases_parser from your list of parsers."); .del_parser($command_aliases_parser); } }; public method .add_command_alias() { arg alias, actual; (> .perms(sender()) <); (> pass(alias, actual) <); if ((.command_aliases()) && (!($command_aliases_parser in (.parsers())))) { .tell("Adding $command_aliases_parser to your list of parsers.."); .add_parser($command_aliases_parser); } }; public method .logout_connection() { arg connection; if ((sender() != this()) || (definer() != caller())) throw(~perm, "Invalid access to private method."); .tell(("<Login> " + ((((.connections()).length()) + 1).n_to_nth())) + " logout."); }; protected method .rehash_cmd() { arg cmdstr, cmd; var c, p; (> .perms(caller(), $user) <); .tell("Rehashing your command caches..."); pause(); // purge first (| .purge_caches() |); // let the parents know we are "going away" for p in (parents()) p.cache_uninit(); // now rehash, hand-pick our own commands for cmd in (.local_commands()) { for c in (cmd[2]) .add_to_local_cache(c[1]); } // let the parents know we are back for p in (parents()) p.cache_init(); }; public method .description() { arg flags; var c, contents, ctext, pronoun, lines, p, br; pronoun = (.gender()).pronoun('psc); if (connections) lines = [((pronoun + " is ") + ((.activity()) || "awake")) + "."]; else lines = [(pronoun + " is asleep, and was last connected ") + ($time.format("%d %B %y %H:%M", abs(connected_at)))]; if ((contents = .contents())) { lines += [pronoun + " is holding:"]; for c in (contents) lines += [" " + (c.name())]; } else { lines = [lines, pronoun + " is holding nothing."]; } return (> pass(flags) <) + lines; }; protected method ._who_at_place() { arg str; var place, thing, who, args; // This should actually be done with a global place dictionary and // a local place dictionary for each user. place = $place.match_descendants(str); if (!place) { .tell(("I do not know where \"" + str) + "\" is."); return 0; } who = []; for thing in (place.contents()) { if (thing.has_ancestor($user)) who += [thing]; } if (!who) { .tell(("Nobody is in " + (place.name())) + "."); return 0; } args = [who, "Users in " + (place.name())]; args = [@args, [['namef, 'titled], ['idle_time]]]; args = [@args, ["Name", "Times (idle)"], [1, 1]]; return args; }; protected method ._who_is() { arg [args]; var person, p, who; who = []; args = ($string.explode_english_list(@args)) || []; for p in (args) { catch any { person = $user_db.search(p); } with { switch (error()) { case ~ambig: .tell(((("The name \"" + p) + "\" can match any of: ") + ($list.to_english($list.mmap((traceback()[1])[3], 'namef)))) + "."); default: .tell(("I don't know who \"" + p) + "\" is."); } continue; } who += [person]; } if (!who) return 0; return [who, ((who.length()) == 1) ? "User" : "Users"]; }; protected method ._who_programmers() { arg args, all; var out, progs, p, x, t; progs = []; if (args && (!all)) { for p in (args) { x = $user_db.search(p); if (!x) .tell(("I don't know who \"" + p) + "\" is."); else progs += [x]; } t = (("Programmer" + (progs.length())) == 1) ? "" : "s"; } else if (all) { t = "All Programmers"; progs = $programmer.descendants(); progs = progs.setremove($admin); } else { t = "Connected Programmers"; for p in ($user_db.connected()) { if (p.has_ancestor($programmer)) progs += [p]; } } if (!progs) return 0; return [progs, t]; }; protected method ._who_admins() { arg args, all; var out, admins, a, x, t; admins = []; if (args && (!all)) { for a in (args) { x = $user_db.search(a); if (!x) .tell(("I don't know who \"" + a) + "\" is."); else admins += [x]; } t = (("Admin" + (admins.length())) == 1) ? "" : "s"; } else if (all) { t = "All Admins"; admins = $sys.admins(); } else { t = "Connected Admins"; for a in ($user_db.connected()) { if (a.has_ancestor($admin)) admins += [a]; } } if (!admins) return 0; return [admins, t]; }; protected method ._who_short() { var user, tmp, who, namestr, total; who = []; total = ($user_db.connected()).length(); .tell((("Currently connected users (total: " + tostr(total)) + ((total == 1) ? " person" : " people")) + "):"); for user in ($user_db.connected()) { namestr = (((((" " + (user.name())) + " (") + ($time.elapsed(user.connected_at()))) + " ") + ($time.dhms(user.idle_seconds()))) + ")"; who += [namestr]; if (tmp < ((namestr.length()) + 2)) tmp = (namestr.length()) + 2; } .tell($list.columnize(who, (.linelen()) / (tmp + 1), " ", .linelen())); // $# Edited 05 Nov 1995 13:56 Lynx ($lynx) }; protected method .remember_cmd() { arg cmdstr, cmd, what, as, str; (> .perms(caller(), $user) <); .add_remembered(what, str); return ((("Remembering " + (what.namef('xref))) + " as \"") + str) + "\"."; }; protected method .forget_place() { arg place; if (type(place) != 'objnum) throw(~type, "Place must be submitted as an object."); remembered_places = remembered_places.setremove(place); }; protected method .remembered_cmd() { arg cmdstr, cmd, args; var item, out; (> .perms(caller(), $user) <); if (!(.remembered())) return .tell("You do not remember anything."); out = []; for item in (.remembered()) out += [((" " + (item[1])) + " is ") + ((item[2]).namef('xref))]; return ["Remembered Items:"] + (out.lcolumnize()); }; protected method .forget_cmd() { arg cmdstr, cmd, str; var what; (> .perms(caller(), $user) <); what = (| remembered[str] |); if (!what) return ("You don't remember what \"" + str) + "\" is..."; .del_remembered(str); return ((("Forgetting " + (what.namef('xref))) + " as \"") + str) + "\"."; }; public method .idle_time() { arg [args]; var idle; [(args ?= 'dhms)] = args; idle = .idle_seconds(); if ((connected_at < 0) || (idle < 30)) return ""; switch (args) { case 'dhms: return $time.dhms(idle, 'long); case 'elapsed: return $time.elapsed(idle); case 'seconds: return idle; } }; public method .tell_error() { arg syntax, [problem]; var problem, line, sprefix, prefix, length; // arg 1 == syntax // arg 2 == problem lines length = .linelen(); if (syntax) .tell(("=> Syntax: `" + syntax) + "`"); if (problem) { for line in (problem) { if (type(line) == 'string) line = line.wrap_lines(length, "! ", 1); .tell(line); } } throw(~stop, ("=> Syntax: `" + syntax) + "`", 'no_traceback); }; protected method .whereis_cmd() { arg cmdstr, cmd, who; var user, u; (> .perms(caller(), $user) <); who = (who && (who.explode_english_list())) || []; if (who && ((who[1]) == "is")) who = who.delete(1); if (!who) return "You must specify somebody."; for user in [1 .. who.length()] { u = (| $user_db.search(who[user]) |); if (!u) { .tell(("I don't know who \"" + (who[user])) + "\" is."); who = who.replace(user, 0); } else { who = who.replace(user, u); } } for user in (who) { if (user) .tell(((user.namef('nactivity)) + " is in ") + ((user.location()).name())); } }; public method .connected_time() { arg [args]; [(args ?= 'dhms)] = args; if (connected_at < 0) return "Last on: " + ctime(abs(connected_at)); switch (args) { case 'dhms: return $time.dhms(time() - connected_at, 'long); case 'elapsed: return $time.elapsed(time() - connected_at); case 'seconds: return time() - connected_at; } }; protected method .name_templates_cmd() { arg cmdstr, com, obj; (> .perms(caller(), $user) <); if (!(obj.has_ancestor($has_name))) return (obj.name()) + " is not descended from $has_name!"; return (("Name templates for " + (obj.namef('ref))) + ": ") + ((obj.name_templates()).to_english("none")); }; public method .connection_going_away() { arg addr, port; var con, line; catch any { (> .perms(caller(), $connection) <); for con in (connections) { if (!valid(con)) connections = connections.setremove(con); } con = sender() in connections; connections = connections.setremove(sender()); if (!connections) .logout(sender()); else .logout_connection(sender()); line = ((((((("DISCONNECT " + tostr(con)) + " (") + ((.parents())[1])) + "): ") + this()) + " <") + addr) + ">"; (| $sys.log(line) |); } with { $sys.log($parse_lib.traceback(traceback())); } }; public method .read() { arg [args]; var text, output, head, tail; if (!(.connections())) return 'not_connected; if ((.task_connection()).is_reading_block()) return 'engaged; if (args.length()) head = args[1]; else head = "Receiving input. Enter \".\" to finish or \"@abort\" to abort."; if ((args.length()) > 1) tail = args[2]; else tail = "** Aborted **; Text thrown away."; if (head) .tell(head); output = (.task_connection()).start_reading_block('multiple); if ((output == 'aborted) && tail) .tell(tail); return output; }; public method .read_line() { arg [args]; var line, abort_msg, head, con; if (!(.connections())) return 'not_connected; con = .task_connection(); if (con.is_reading_block()) return 'engaged; [(head ?= ""), (abort_msg ?= "** Aborted **")] = args; if (head) .tell(head); line = con.start_reading_block('one); if ((line == 'aborted) && abort_msg) .tell(abort_msg); return line[1]; }; public method .prompt() { arg prompt, [abort_msg]; .non_terminated_tell(prompt); return (> .read_line("", @abort_msg) <); }; protected method .ways_cmd() { arg cmdstr, cmd; var exits, e, line, out; (> .perms(caller(), $user) <); exits = (.location()).visible_exits(); if (!exits) return "There are no visible exits from this room."; // come up with some settings to configure how to display exits // for now they can deal with the following out = [("Visible exits from " + ((.location()).name())) + ":"]; for e in (exits) out += [(((" " + (e.name())) + ((e.name_templates()) ? (" (" + ((e.name_templates()).to_english())) + ")" : "")) + " to ") + ((e.dest()).name())]; return out + ["---"]; }; public method .content_type() { return (| (settings_data[$user])["content-type"] |) || "text/plain"; }; public method .set_objname(): nooverride { arg new_objname; if ((caller() != $user) && (!(sender() in ($sys.system())))) throw(~perm, "User objnames can only be changed by $user."); (> pass(new_objname) <); }; protected method .context_cmd() { arg [args]; var out; (> .perms(caller(), $user) <); out = "Last thing: " + ((| (context['last]).name() |) || "(nothing)"); out += ["Last it: " + ((| (context["it"]).name() |) || "(nothing)")]; out += ["Last her: " + ((| (context["her"]).name() |) || "(nothing)")]; out += ["Last him: " + ((| (context["him"]).name() |) || "(nothing)")]; return out; }; private method .register_name_cmd() { arg cmd, cmdstr, name; catch any (> .register_name(name) <); with return (traceback()[1])[2]; return [("Registered alternate name \"" + name) + "\".", ("Registered names: " + (registered.to_english("none"))) + "."]; }; private method .unregister_name() { arg old; registered = setremove(registered || [], old); if (!registered) (| clear_var('registered) |); (| $user_db.remove(old) |); }; private method .register_name() { arg new; if (!(new in (registered || []))) { (> $user_db.valid_name(new) <); (> $user_db.insert(new, this()) <); if (registered) registered += [new]; else registered = [new]; } }; protected method .look_cmd() { arg cmdstr, cmd, args; var m, obj, desc, flags, loc, prep, line, exam; (> .perms(caller(), $user) <); // flags that are always the same flags = #[['actor, this()], ['examine, match_begin(cmd, "e")], ['exclude, [this()]]]; // Because we do some non-environment things, we parse look ourselves. // some times I critically catch things and sometimes I let the catch // statement catch them, this is because of how I want the errors to look. catch any { if ((m = match_template(args, "in|on *"))) { obj = (> .match_environment(m[2]) <); flags = (flags.add('type, m[1])).add_elem('exclude, obj); return obj.get_description(flags); } else { if ((m = match_template(args, "at *"))) args = m[2]; if (!args) { obj = .location(); return obj.get_description(flags.add_elem('exclude, obj)); } else if ((m = match_template(args, "* in|on *"))) { prep = m[2]; catch any loc = (> .match_environment(m[3]) <); with return (traceback()[1])[2]; obj = (| loc.match_environment(m[1]) |); if (!obj) { return (> loc.get_detail(m[1]) <); } else if ((m = match_template(args, "det?ail *"))) { desc = (| loc.get_detail(m[2]) |); if (!desc) return strfmt("No detail %d %l %l.", m[2], prep, loc.name()); return desc; } else { return obj.get_description(flags.add_elem('exclude, obj)); } } else if ((m = match_template(args, "det?ail *"))) { return (> (.location()).get_detail(m[2]) <); } else { obj = (> .match_environment(args) <); return obj.get_description(flags.add_elem('exclude, obj)); } } } with { line = (traceback()[1])[2]; if (error() in [~ambig, ~nodetail]) return line; desc = (| (.location()).get_detail(args) |); if (!desc) return line; return desc; } }; public method .walk_path() { arg [path]; var p, exit; // this needs to be fixed to SHUTOFF descriptions--do something with // exit.invoke() => $user.move_to for p in (path) { // we need to go through the command parser, because it can // see all of the exits. exit = $command_parser.parse(this(), p, $null_parser); if ((exit[1]) in ['failed, 'error]) throw(~invpath, (("No exit " + toliteral(p)) + " from ") + ((.location()).name())); (exit[2]).invoke(#[['nofork, 1], ['prose, 0], ['extra, 0]]); pause(); } }; public method .set_content_type() { arg definer, name, value, [args]; var sets; (> .set_local_setting(definer, name, value, @args) <); switch (value) { case "text/html": content_type = 'html; formatter = $html_format; case "text/wrapped": content_type = 'wrapped; formatter = $wrapped_text_format; case "text/plain": content_type = 'plain; formatter = $text_format; } }; public method .check_content_type() { arg definer, value, [args]; var type, types; types = ["plain", "html", "wrap?ped"]; for type in (types) { if (match_template(value, type) || match_template(value, "text/" + type)) return "text/" + strsed(type, "[^a-z]", "", "g"); } throw(~check, "Content-type must be one of: " + ((types.prefix("text/")).to_english("", " or "))); }; public method .evaluator() { return evaluator; }; public method .check_experienced() { arg definer, value, [args]; // called by the settings system if (value in ["", "y", "ye", "yes"]) return "yes"; else return ""; }; protected method .get_cmd() { arg cmdstr, cmd, what; var ol, l, isuser; (> .perms(caller(), $user) <); ol = what.location(); if (ol == this()) { return ("You already have " + (what.name())) + "."; } else if (what == this()) { return "Ewww, its all twisty."; } else { l = .location(); if (l != ol) { isuser = ol.is($user); if ((| ol.location() |) != l) return ("You are not in " + (what.location())) + "."; } catch any { (> what.move_to(this()) <); } with { if (error() == ~locked) { if (isuser) ol.tell((((.name()) + " tried to take ") + (what.name())) + " from you."); return (((what.name()) + " is locked to ") + ((what.lock()).lock_name('thing))) + "."; } else { return (traceback()[1])[2]; } } if (isuser) ol.tell((((.name()) + " takes ") + (what.name())) + " from you."); l.announce((((.name()) + " takes ") + (what.name())) + ".", this(), ol); if (l != ol) { if (!isuser) l.announce((((.name()) + " takes ") + (what.name())) + "."); return ((("You take " + (what.name())) + " from ") + (ol.name())) + "."; } return ("You take " + (what.name())) + "."; } }; protected method .drop_cmd() { arg cmdstr, cmd, what; (> .perms(caller(), $user) <); if (!(what in (.contents()))) { return ("You don't have " + (what.name())) + "."; } else { catch any { (> what.move_to(.location()) <); .tell(("You drop " + (what.name())) + "."); (| (.location()).announce((((.name()) + " drops ") + (what.name())) + ".", this(), what) |); } with { return (traceback()[1])[2]; } } // $# Edited 05 Nov 1995 14:10 Lynx ($lynx) }; protected method .set_cols() { arg definer, name, value, [args]; if ((value == 80) || (!value)) (| clear_var('cols) |); else cols = value; }; protected method .take_from_cmd() { arg cmdstr, cmd, what, p, loc; var c, obj, l, wl; (> .perms(caller(), $user) <); if (loc == this()) return ("You already have " + (what.name())) + "."; for c in (loc.contents()) { if (c.match_name(what)) obj = c; } if (!obj) return ((.name()) + " does not have ") + what; if ((obj == this()) || (obj == loc)) return "Ewww, its all twisty."; catch any { l = .location(); wl = loc.location(); (> obj.move_to(this()) <); if (l != wl) wl.announce(((((((((.name()) + " ") + cmd) + "s ") + (obj.name())) + " ") + p) + " ") + (loc.name()), this()); l.announce(((((((((.name()) + " ") + cmd) + "s ") + (obj.name())) + " ") + p) + " ") + (loc.name()), this()); return ((((((("You " + cmd) + " ") + (obj.name())) + " ") + loc) + " ") + (loc.name())) + "."; } with { switch (error()) { case ~locked: if (loc.is($user)) loc.tell((((.name()) + " tried to take ") + (obj.name())) + " from you."); return (((obj.name()) + " is locked to ") + ((obj.lock()).lock_name('thing))) + "."; default: return (traceback()[1])[2]; } } // $# Edited 05 Nov 1995 13:58 Lynx ($lynx) }; public method .set_activity() { arg str; (> .perms(sender()) <); activity = str; }; public method .is_tellable_by() { arg caller, sender; return (sender == this()) || (caller in [$place, $user, $programmer, $admin, $mail_ui, $help_ui, $messages_ui, $settings_ui]); }; protected method .go_cmd() { arg cmdstr, cmd, path; var m; (> .perms(caller(), $user) <); if ((m = match_template(path, "to *"))) return cmd + " to support is pending completion."; path = path.explode_quoted(); .walk_path(@path); }; public method .ptell() { arg what, flags; if (!(.is_tellable_by(caller(), sender()))) throw(~perm, "Only allowed objects may call protected tell."); // switch (flags['type]) { ._tell(what); }; public method .connection_starting() { arg addr, port; var line, c; (> .perms(caller(), $connection) <); // shutoff our connection's timeout sender().set_timeout(0); // cleanup our connections list for c in (connections) { if (!valid(c)) connections = connections.setremove(c); } connections = [sender()].union(connections); if ((connections.length()) == 1) (| .login(sender()) |); else (| .login_again(sender()) |); line = ("CONNECT " + tostr(sender() in connections)) + " ("; line = (line + ((.parents())[1])) + "): "; line = (((line + this()) + " <") + (sender().address())) + "> "; (| $sys.log(line) |); }; protected method .reset_parsers() { var p, list; parsers = []; list = (| .get_local_setting("extended-parsers", $user) |) || []; for p in ((.get_base_parsers()) + list) .add_parser(p); }; public method .connected_seconds() { return connected_seconds; }; protected method .add_trustee_cmd() { arg cmdstr, cmd, args; var syn, obj, trustee; (> .perms(caller(), $user) <); trustee = args[1]; args = args[2]; if (args && ((args[1]) == "to")) args = delete(args, 1); obj = (> .match_env_nice(args.join()) <); catch any { (> obj.add_trusted(trustee) <); return [(("Added trustee " + (trustee.namef('ref))) + " to ") + (obj.namef('ref)), (((obj.namef('ref)) + " now trusts: ") + ((((obj.trusted('literal)).compress()).mmap('namef, 'ref)).to_english("nobody"))) + "."]; } with { return (traceback()[1])[2]; } }; protected method .del_trustee_cmd() { arg cmdstr, cmd, args; var syn, obj, trustee; (> .perms(caller(), $user) <); trustee = args[1]; args = args[2]; if (args && ((args[1]) == "from")) args = delete(args, 1); obj = (> .match_env_nice(args.join()) <); catch any { (> obj.del_trusted(trustee) <); return [(("Removed trustee " + (trustee.namef('ref))) + " from ") + (obj.namef('ref)), (((obj.namef('ref)) + " now trusts: ") + ((((obj.trusted('literal)).compress()).mmap('namef, 'ref)).to_english("nobody"))) + "."]; } with { .tell((traceback()[1])[2]); } }; protected method .add_writer_cmd() { arg cmdstr, cmd, args; var syn, obj, writer; (> .perms(caller(), $user) <); args = (args.replace(" to ", " ")).explode(); if ((!args) || ((args.length()) != 2)) .tell_error(cmd + " <writer> [to] <object>"); writer = .match_env_nice(args[1]); obj = .match_env_nice(args[2]); catch any { obj.add_writer(writer); return [(("Sucessfully added writer " + (writer.namef('xref))) + " to ") + (obj.namef('xref)), ("New writers list: " + ((((obj.writers('literal)).compress()).mmap('namef, 'xref)).to_english())) + "."]; } with { .tell((traceback()[1])[2]); } }; protected method .del_writer_cmd() { arg cmdstr, cmd, args; var syn, obj, writer; (> .perms(caller(), $user) <); args = (args.replace(" from ", " ")).explode(); if ((!args) || ((args.length()) != 2)) .tell_error(cmd + " <writer> [from] <object>"); writer = .match_env_nice(args[1]); obj = .match_env_nice(args[2]); catch any { obj.del_writer(writer); return [(("Sucessfully removed writer " + (writer.namef('xref))) + " from ") + (obj.namef('xref)), ("New writers list: " + ((((obj.writers('literal)).compress()).mmap('namef, 'xref)).to_english())) + "."]; } with { .tell((traceback()[1])[2]); } }; protected method .writes_cmd() { arg cmdstr, cmd, what; (> .perms(caller(), $user) <); return [(what.namef('ref)) + " is a writer on:"] + (._list_objects(what.writes(), 'writers)); }; protected method .managed_cmd() { arg cmdstr, cmd, args; var manager, managed, obj, out, len; (> .perms(caller(), $user) <); manager = (| .match_environment(args) |); if (!manager) { manager = (| $user_db.search(args) |); if (!manager) return ("Unable to find \"" + args) + "\"."; } managed = manager.managed(); if (!managed) return (manager.namef('ref)) + " does not manage any objects."; out = [(manager.namef('ref)) + " manages:"]; len = (.linelen()) / 2; for obj in (managed) out += [((" " + ((obj.namef('xref)).pad(len))) + " ") + ($object_lib.see_perms(obj, ["", ""]))]; return out; }; protected method .add_name_template_cmd() { arg cmdstr, cmd, args; var obj, template; (> .perms(caller(), $user) <); args = args.explode_quoted(); if ((listlen(args) > 2) && ((args[2]) == "to")) args = delete(args, 2); if (listlen(args) > 2) args = [args[1], sublist(args, 2).join()]; if ((!args) || (listlen(args) != 2)) return ("Syntax: `" + cmd) + " \"<template>\" [to] \"<object>\"`"; obj = (> .match_env_nice(args[2]) <); template = args[1]; if (!(obj.has_ancestor($has_name))) return obj + " cannot have regular names."; catch any (> obj.add_name_template(template) <); with return (traceback()[1])[2]; return ((((("Added name template \"" + template) + "\" to ") + (obj.namef('ref))) + ", templates: ") + ((obj.name_templates()).to_english())) + "."; }; protected method .add_remembered() { arg what, name; remembered = (remembered || #[]).add(name, what); }; protected method .del_remembered() { arg name; remembered = (remembered || #[]).del(name); if (!remembered) clear_var('remembered); }; public method .remembered() { return remembered || #[]; }; protected method .get_from_cmd() { arg cmdstr, cmd, what, p, loc; var c, obj, l, wl, str; (> .perms(caller(), $user) <); if (loc == this()) return ("You already have " + (what.name())) + "."; for c in (loc.contents()) { if (c.match_name(what)) obj = c; } if (!obj) { if (loc.is($place)) return ("No \"" + what) + "\" in your environment."; else return ((loc.name()) + " does not have ") + what; } if ((obj == this()) || (obj == loc)) return "Ewww, its all twisty."; if (loc.is($place)) return .get_cmd(cmdstr, cmd, obj); catch any { l = .location(); (> obj.move_to(this()) <); str = (((" " + (obj.name())) + " ") + p) + " "; wl = loc.location(); .tell(((("You " + cmd) + str) + (loc.name())) + "."); (| loc.tell((((((.name()) + " ") + cmd) + "s") + str) + "you.") |); cmd += "s"; str = (str + (loc.name())) + " "; if (l != wl) wl.announce((((.name()) + " ") + cmd) + str, this(), loc); l.announce((((.name()) + " ") + cmd) + str, this(), loc); return; } with { switch (error()) { case ~locked: if (loc.is($user)) loc.tell((((((.name()) + " tried to take ") + (obj.name())) + " ") + p) + " you."); return (((obj.name()) + " is locked to ") + ((obj.lock()).lock_name('thing))) + "."; default: return (traceback()[1])[2]; } } // $# Edited 05 Nov 1995 13:58 Lynx ($lynx) }; protected method .give_to_cmd() { arg cmdstr, cmd, what, p, loc; var c, obj, l, wl, str; (> .perms(caller(), $user) <); if (!(what in (.contents()))) return ("You don't have " + (what.name())) + "."; if (what == this()) return "Give yourself away? Interesting..."; if (what == loc) return ((("Uhh, you cannot give " + ((what.gender()).pronoun('po))) + " to ") + ((what.gender()).pronoun('pr))) + "."; if (loc.is($place)) return .drop_cmd(cmdstr, cmd, what); catch any { l = .location(); wl = loc.location(); (> what.move_to(loc) <); str = (((" " + (what.name())) + " ") + p) + " "; .tell(((("You " + cmd) + str) + (loc.name())) + "."); (| loc.tell((((((.name()) + " ") + cmd) + "s") + str) + "you.") |); cmd += "s"; str = (str + (loc.name())) + " "; if (l != wl) wl.announce((((.name()) + " ") + cmd) + str, this(), loc); l.announce((((.name()) + " ") + cmd) + str, this(), loc); } with { .tell_traceback(traceback()); return (traceback()[1])[2]; } }; public method .task_connections() { return task_connections; }; public method .task_connection() { return task_connections[task_id()]; }; protected method .set_global_tell() { arg [args]; if ((args[3]) == 0) clear_var('global_tell); else global_tell = 1; // $# Edited 20 Oct 1995 13:52 Lynx ($lynx) }; public method .get_global_tell() { arg [args]; return global_tell; }; public method .match_name() { arg str; var m, n; if ((m = pass(str))) return m; for n in (registered || []) { if ((m = match_begin(str, n))) return m; } return 0; }; protected method .discard_cmd() { arg cmdstr, cmd, target; var msg, s, name; (> .perms(caller(), $user) <); if ((cmdstr.trim()) == "discard") { s = .prompt(("Are you sure you want to discard " + (target.name())) + "? "); if (!(s in ["yes", "y"])) return ("Ok, not discarding " + (target.name())) + "."; } if ((target.location()) != this()) return ("You are not holding " + (target.name())) + "."; name = target.name(); if (type(target) == 'frob) { target.discard(); } else if ((target.manager()) == this()) { target.destroy(); } else { target.move_to($trash); msg = $mail_message.new_mail(); msg.set_subject("Discarded Object"); msg.set_text([(((((((target.name()) + " has been discarded by ") + (.name())) + ". It currently exists in ") + ($trash.namef('ref))) + ", and will be destroyed in 15 days. You may retrieve it with the command `@move ") + target) + " to me`."]); (| msg.send(target.manager()) |); } return ("Discarding " + name) + "."; }; public method ._list_objects() { arg objs, multi, [args]; var line, obj, c2, name, fmt, out, c1; if (!objs) { out = ["** None **"]; } else { c2 = ((| sender().linelen() |) || 79) / 10; c1 = c2 * 4; fmt = "%3L%*L %*L %*L"; out = [strfmt(fmt, "#", c1, "Name", c2, "Flags", c2, "Size") + "Manager"]; for obj in (objs) { line = strfmt(fmt, obj.(multi)(@args).length(), c1, obj.namef('xref), c2, $object_lib.see_perms(obj, ["", ""]), c2, obj.size()); name = (obj.manager()).namef('xref); if ((name.length()) > c1) name = name.pad(c1); out += [line + name]; } } return out; }; protected method .trusted_by_cmd() { arg cmdstr, cmd, what; (> .perms(caller(), $user) <); return [(what.namef('ref)) + " is trusted by:"] + (._list_objects(what.trusted_by(), 'trusted)); }; protected method .personal_info() { return info || #[]; }; public method .personal_fields() { return #[["real-name", 1], ["email", 1], ["address", 1], ["affiliation", 1], ["position", 1], ["location", 1], ["interests", 1], ["plan", 1], ["projects", 1], ["home-page", 0]]; }; protected method .monitor_cmd() { arg cmdstr, cmd, [args]; var e, out, line, len; (> .perms(caller(), $user) <); if (!(args[1])) { if (monitor == 0) return "You are not monitoring what you hear."; out = []; len = .linelen(); for e in (monitor || []) { line = strfmt("%20S %30S ", (e[1]).namef('xref), ((((e[2]) + ".") + (e[4])) + "() line ") + (e[5])) + (e[6]); if (strlen(line) > len) line = line.chop(len); out += [line]; } return out + ["---"]; } if ("on" in args) { monitor = []; return "You are now monitoring what you hear."; } else { (| clear_var('monitor) |); return "You are no longer monitoring what you hear."; } }; protected method .monitor() { return monitor; }; protected method .examine_cmd() { arg cmdstr, cmd, args; var obj, opts, i, chop, out, m, cmds, c; (> .perms(caller(), $user) <); obj = args[1]; opts = args[3]; chop = .linelen(); c = obj.created_on(); if ((i = "ch?op" in (opts.slice(1))) && (!((opts[i])[3]))) chop = 0; out = ["Object (@rename): " + (obj.namef('ref)), "Templates (@ant): " + ((obj.name_templates()).to_english("none")), "Created: " + (c ? ctime(c) : "(Before Time)"), (("Quota: " + ((obj.quota()).to_english())) + " bytes") + ((obj.quota_exempt()) ? " ** exempt **" : ""), ("Size: " + ((obj.size()).to_english())) + " bytes (on disk)", "Perms (@chmod): " + (((.flags()).prefix("+")).join()), "Manager (@chmanage): " + ($object_lib.get_name(obj.manager(), 'namef, ['ref])), ._exam_sub("Writer", 1, "@aw/@dw", chop, obj, 'writers, 'literal), ._exam_sub("Trusted", 0, "@at/@dt", chop, obj, 'trusted, 'literal), ._exam_sub("Parent", 1, "@ap/@dp", chop, obj, 'parents)]; if (obj.has_ancestor($located)) out += ["Location (@move): " + ($object_lib.get_name(obj.location(), 'namef, ['xref]))]; out += ["Description (@describe): ", @(type(obj.prose()) == 'frob) ? (obj.prose()).uncompile() : ((type(obj.prose()) == 'list) ? obj.prose() : [obj.prose()])]; if ((cmds = obj.remote_commands())) out += $command_lib.format_commands_short(#[[obj, cmds]], "Remote", .linelen()); if ((cmds = obj.local_commands())) out += $command_lib.format_commands_short(#[[obj, cmds]], "Local", .linelen()); return out + ((| obj.examine() |) || []); }; protected method ._exam_sub() { arg name, plural, cmd, chop, obj, meth, [args]; var list, line; list = (| obj.(meth)(@args) |) || []; if (!plural) line = pad(((name + " (") + cmd) + "):", 21) + (list.to_english("(none)")); else if (listlen(list) != 1) line = pad(((name + "s (") + cmd) + "):", 21) + (list.to_english("(none)")); else line = pad(((name + " (") + cmd) + "):", 21) + ((list[1]).namef('ref)); if (chop) line = line.chop(chop); return line; }; public method .check_exit_style() { arg definer, value, [args]; var styles, s; // verify it is correct styles = ["none", "brief", "template?s", "long", "verbose"]; for s in (styles) { if (match_template(value, s)) return tosym(s.strip("?")); } throw(~wrong, "Style must be one of: " + (styles.to_english("", " or "))); }; public method .get_exit_style() { arg name, definer, [args]; return (| (settings[definer])[name] |) || ($user.get_local_setting(name, definer, @args)); }; public method .display_exit_style() { arg value; return value; }; protected method .map_cmd() { arg cmdstr, cmd; var l, obj, pos; (> .perms(caller(), $user) <); l = .location(); obj = (l.realm()).get_realm_var('map_object); pos = (l.realm()).get_realm_var('map_position); return (obj.has_ancestor($generic_map)) ? obj.view(@pos, 20, 79) : "This room doesn't have map defined for it."; }; protected method .finger_cmd() { arg cmdstr, cmd, who; var out; (> .perms(caller(), $user) <); out = ([("Information on " + (who.name())) + " (use @set to change):"] + ((who.display_info('no_blanks)).prefix(" "))) + ((.age_cmd("", "", who)).prefix(" ")); if (who.connected()) return out + [(" " + (who.name())) + " is currently connected."]; else return out + [((((" " + (who.name())) + " was last connected at ") + ($time.format("%r", abs(who.connected_at())))) + " ") + ($time.format("%A %B %e %Y", abs(who.connected_at())))]; }; public method .prompt_yesno() { arg str, [def]; var input, rx; // the second argument is an integer for the default value [(def ?= 1)] = def; input = .prompt(str); if (match_regexp(input, "^(y|ye|yes)$")) return 1; if (match_regexp(input, "^(n|no)$")) return 0; return def; }; protected method .trusts_cmd() { arg cmdstr, cmd, what; (> .perms(caller(), $user) <); return [(what.namef('ref)) + " trusts:"] + (._list_objects(what.trusted('literal), 'trusted_by)); }; protected method .del_name_template_cmd() { arg cmdstr, cmd, args; var syn, obj, template; (> .perms(caller(), $user) <); args = args.explode_quoted(); if ((listlen(args) > 2) && ((args[2]) == "from")) args = delete(args, 2); if (listlen(args) > 2) args = [args[1], sublist(args, 2).join()]; if ((!args) || (listlen(args) != 2)) return ("Syntax: `" + cmd) + " \"<template>\" [to] \"<object>\"`"; obj = (> .match_env_nice(args[2]) <); template = args[1]; if (!(obj.has_ancestor($has_name))) return obj + " cannot have regular names."; if (!(template in (.name_templates()))) return (((obj.name()) + " does not have the name template \"") + template) + "\""; catch any (> obj.del_name_template(template) <); with return (traceback()[1])[2]; return ((((("Deleted name template \"" + template) + "\" from ") + (obj.namef('ref))) + ", templates: ") + ((obj.name_templates()).to_english("none"))) + "."; }; protected method .writers_cmd() { arg cmdstr, cmd, what; (> .perms(caller(), $user) <); return [(what.namef('ref)) + " is a writer for:"] + (._list_objects(what.writers('literal), 'writes)); }; protected method .manager_cmd() { arg cmdstr, cmd, what; (> .perms(caller(), $user) <); return (((what.namef('ref)) + " is managed by ") + ((what.manager()).namef('ref))) + "."; }; protected method .view_detail_cmd() { arg cmdstr, cmd, detail; (> .perms(caller(), $user) <); if ((| (detail = (.location()).get_detail(detail)) |)) .tell(detail); else .tell("No such detail on your location."); }; public method .get_cols() { arg [args]; return cols || 80; }; public method .get_rows() { arg [args]; return rows || 19; // 19 is the number of display rows you have in tf, in // visual mode with a default display/terminal. }; protected method .set_rows() { arg definer, name, value, [args]; if ((value == 19) || (!value)) (| clear_var('rows) |); else rows = value; }; public method .check_ext_parsers() { arg definer, value, [args]; var objs, o, r; objs = []; for o in (value.explode_english_list()) { o = o.trim(); if (!(r = (| $object_lib.to_dbref(o) |))) { if (!(r = $user_parsers.match_children(o))) throw(~type, ("\"" + o) + "\" is not a child of $user_parsers."); } objs = setadd(objs, r); } // sorry buddy, no choice--these come from .get_base_parsers() for o in ((.get_base_parsers()) + [$command_aliases_parser]) objs = setremove(objs, o); return objs; }; public method .get_base_parsers() { if (.command_aliases()) return [$command_aliases_parser, $command_parser, $channel_parser]; return [$command_parser, $channel_parser]; }; public method .FOOB() { return password; }; protected method .paste_cmd() { arg cmdstr, com, who; var obj, text; (> .perms(caller(), $user) <); if (who) { who = who.explode(); if (((who.length()) > 1) && ((who[1]) == "to")) who = who.delete(1); catch ~ambig, ~namenf who = (> $user_db.search(who.join()) <); with return (traceback()[1])[2]; } text = .read(); if (text == 'aborted) return .tell("@paste aborted."); else if (!text) return .tell("@paste nothing?"); text = [((" " + (.name())) + " (@paste's) ").center(79, "-", 'both), @text, " + Finis + ".center(79, "-", 'both)]; if (who) { (| who.tell(text) |); .tell(((((text.length()) - 2) + " lines of text pasted to ") + (who.name())) + "."); } else { (.location()).announce(text); .tell(((text.length()) - 2) + " lines of text pasted"); } }; public method .remote_cmd() { arg cmdstr, com, who, prep, str; var target, line, fstr, wstr, type, bad; (> .perms(caller(), $user, $robot) <); if (str && ((str[1]) == ":")) { type = 'emote; str = str.subrange(2); } else { type = 'say; } who = (> .parse_interaction_reference(who, tostr(type), 'userdb) <); if ((bad = filter target in (who) where (type(target) != 'objnum))) return ("Unable to find " + (bad.to_english())) + "."; .add_interaction('objs, who); line = .name(); if (str && ((str[1]) == ":")) str = str.subrange(2); else line += " "; if (type == 'emote) { line += str; } else { if (str) line += $code_lib.punctuation_type(str); else line += "say"; line = ((line + "s, \"") + str) + "\""; } wstr = (who.mmap('name)).to_english(); fstr = "[from " + ((.location()).name()); if ((who.length()) > 1) fstr = (fstr + ", to ") + wstr; fstr = (fstr + "] ") + line; for target in (who) { if (!(target.connected())) .tell((target.name()) + " is not connected."); (| target.directed_tell(fstr, 'remote) |); } .tell((("[to " + wstr) + "] ") + line); }; protected method .new_editor_session() { arg ref, opts, type; var p; switch (ref[1]) { case 'object: if (!(| (p = (ref[2]).all_edit_types()) |)) return "The object is not editable."; if (type == "any") type = p[1]; if (!(| (ref[2]).(tosym("edit_" + type))() |)) return ((("Could not edit " + (ref[2])) + "'s ") + type) + "."; default: return ("You cannot edit " + (ref[1])) + "s."; } return [("Editor invoked with " + ((.active_editor()).session_name())) + ".", "Type 'help' to list available commands."]; }; new object $guest: $user; var $root child_index = 46; var $root inited = 1; var $root owned = [$guest]; var $root manager = $guest; var $root quota = 75000; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'variables, 'core, 'command_cache]; var $root managed = [$guest]; var $location contents = []; var $located location = $body_cave; var $located obvious = 1; var $user password = "*"; var $user connected_at = 0; var $user last_command_at = 0; var $user connections = []; var $user modes = #[]; var $user formatter = $mail_list; var $user parsers = [$command_parser]; var $user context = #[]; var $user task_connections = #[]; var $command_aliases command_aliases = []; var $mail_list letters = #[]; var $mail_list letters_index = #[]; var $mail_list senders = 1; var $mail_list readers = 1; var $mail_list notify = [$guest]; var $mail_list last_letter = 0; var $mail_list mail = []; var $mail_ui subscribed = #[[$guest, [791485891, 0]]]; var $mail_ui current = #[['location, 0], ['list, $guest]]; var $has_gender gender = $gender_neuter; var $described prose = []; var $has_name name = ['prop, "Generic Guest Object", "Generic Guest Object"]; var $has_commands local = #[]; var $channel_ui channel_dict = #[]; var $channel_ui active_channels = #[]; root method .init_guest() { .set_title("a guest"); }; protected method .logout() { arg connection; (| pass(connection) |); (> .destroy() <); }; protected method .title_cmd() { arg cmdstr, com, str; (> .perms(caller(), $user) <); .tell("Guests are not allowed to change their titles."); }; protected method .login_notify(): forked { arg connection, last; (| pass(connection, last) |); .tell(["**", "** Welcome to the Cold Dark.", "**", "** The Cold Dark is a development system for ColdC and the ColdCore.", "** There is no game involved in the Cold Dark, and in general the", "** discussions will range across various coding topics. Guests and", "** ColdC questions are welcome and encouraged. If you wish to access", "** the core you can do it through the web, or you can ask for programming", "** permissions.", "**"]); }; new object $reaper: $user; var $root manager = $reaper; var $root quota = 75000; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['core]; var $root managed = [$reaper]; var $has_settings local_settings = ["gender"]; var $command_aliases command_aliases = []; var $has_name name = ['prop, "Reaper", "Reaper"]; var $has_gender gender = $gender_male; var $described prose = <$ctext_frob, [["A dark billowing cape covers his luminous and forboding form."], #[['this, $lag_watcher]]]>; var $location contents = []; var $located location = $body_cave; var $located obvious = 1; var $body body_parts = #[]; var $user password = "*"; var $user connected_at = 0; var $user last_command_at = 0; var $user connections = []; var $user creation_time = 780375877; var $user parsers = [$command_parser]; var $user action = ""; var $user formatter = $mail_list; var $user context = #[]; var $user task_connections = #[]; var $mail_list mail = []; var $mail_list senders = 1; var $mail_list notify = [$reaper]; var $mail_ui subscribed = #[[$reaper, [791485891, 0]]]; var $mail_ui current = #[['location, 0], ['list, $reaper]]; var $channel_ui channel_dict = #[]; var $channel_ui active_channels = #[]; var $root owned = [$reaper]; var $command_cache shortcut_cache = []; var $command_cache remote_cache = #[["@lock", [["@lock"], #[[$thing, 3]]]], ["@unlock", [["@unlock"], #[[$thing, 3]]]], ["@boot", [["@boot"], #[[$thing, 3]]]], ["@reactions", [["@reactions"], #[[$robot, 1]]]]]; new object $no_one: $user; var $user task_connections = #[]; var $user password = "*"; var $user connected_at = 0; var $user last_command_at = 0; var $user connections = []; var $user creation_time = 759878010; var $user action = ""; var $user modes = #[]; var $user formatter = $mail_list; var $user parsers = [$command_parser]; var $user context = #[]; var $root inited = 1; var $root manager = $no_one; var $root quota = 75000; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'variables, 'core]; var $root managed = [$no_one]; var $command_aliases command_aliases = []; var $location contents = []; var $located location = $body_cave; var $located obvious = 1; var $mail_list letters = #[]; var $mail_list letters_index = #[]; var $mail_list senders = 1; var $mail_list readers = [$daemon]; var $mail_list notify = [$no_one]; var $mail_list last_letter = 0; var $mail_list mail = []; var $mail_ui subscribed = #[[$no_one, [791485891, 0]]]; var $mail_ui current = #[['location, 0], ['list, $no_one]]; var $has_gender gender = $gender_neuter; var $described prose = []; var $has_name name = ['prop, "No One", "No One"]; var $channel_ui channel_dict = #[]; var $channel_ui active_channels = #[]; var $root owned = [$no_one]; var $command_cache shortcut_cache = []; var $command_cache remote_cache = #[["@lock", [["@lock"], #[[$thing, 1]]]], ["@unlock", [["@unlock"], #[[$thing, 1]]]], ["@boot", [["@boot"], #[[$thing, 1]]]]]; new object $player: $user; var $root child_index = 2; var $root fertile = 1; var $root manager = $player; var $root created_on = 809926794; var $root inited = 1; var $root quota = 75000; var $user password = "*"; var $user connected_at = 0; var $user last_command_at = 0; var $user connections = []; var $user parsers = [$command_parser]; var $user action = ""; var $user context = #[]; var $user formatter = $mail_list; var $user task_connections = #[]; var $located location = $body_cave; var $located obvious = 1; var $has_commands shortcuts = #[]; var $has_commands remote = #[]; var $has_commands local = #[["@sheet|@score", [["@sheet|@score", "*", "@sheet|@score <any>", 'sheet_cmd, #[[1, ['any, []]]]]]]]; var $player strength = [0, 0]; var $player agility = [0, 0]; var $player appearance = [0, 0]; var $player health = [0, 0]; var $player life = [0, 0]; var $player intellect = [0, 0]; var $player knowledge = [0, 0]; var $player backbone = [0, 0]; var $player charisma = [0, 0]; var $player humanity = [0, 0]; var $player perception = [0, 0]; var $player presence = [0, 0]; var $player source = 0; var $player dead = 0; var $player weapons = 0; var $player identity = 0; var $player affiliation = 0; var $player points = 0; var $player deaths = 0; var $player encumbrance = 0; var $player fatigue = 0; var $player characteristics = 0; var $has_name name = ['proper, "player", "player"]; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $location contents = []; var $described prose = []; var $has_gender gender = $gender_neuter; var $mail_ui current = #[['location, 0], ['list, $player]]; var $mail_ui subscribed = #[[$player, [813278562, 0]], [$mail_list_news, [813278562, 0]]]; var $mail_list mail = []; var $mail_list senders = 1; var $mail_list readers = [$player]; var $mail_list notify = [$player]; var $command_aliases command_aliases = []; var $channel_ui channel_dict = #[]; var $channel_ui active_channels = #[]; var $root flags = ['core]; var $root managed = [$player]; var $root owned = [$player]; var $command_cache local_cache = #[["@sheet", ["@sheet|@score"]], ["@score", ["@sheet|@score"]]]; var $command_cache shortcut_cache = []; var $command_cache remote_cache = #[["@lock", [["@lock"], #[[$thing, 1]]]], ["@unlock", [["@unlock"], #[[$thing, 1]]]], ["@boot", [["@boot"], #[[$thing, 1]]]]]; protected method .lower_attribute() { arg attribute, difference; var new; new = (get_var(attribute)[1]) - difference; set_var(attribute, get_var(attribute).replace(1, new)); }; public method .attribute(): nooverride, synchronized { arg attribute; if (caller() != definer()) (> .perms(sender(), $storyteller) <); return get_var(attribute); }; root method .init_player(): nooverride, synchronized { strength = [0, 0]; agility = [0, 0]; appearance = [0, 0]; health = [0, 0]; life = [0, 0]; intellect = [0, 0]; knowledge = [0, 0]; backbone = [0, 0]; charisma = [0, 0]; humanity = [0, 0]; perception = [0, 0]; presence = [0, 0]; source = [0, 0]; weapons = []; }; protected method .raise_attribute() { arg attribute, difference; var new; new = (get_var(attribute)[1]) + difference; if (new > (get_var(attribute)[2])) new = get_var(attribute)[2]; set_var(attribute, get_var(attribute).replace(1, new)); // 9-01-95/00:07 Lynx ($lynx), moved from $player.raise }; public method .dead() { return dead; }; protected method .sheet_cmd() { arg cmdstr, cmd, args; var t, out, g; (> .perms(caller(), $user) <); if (args && (!(.is($storyteller)))) return "Only storytellers can see other players stats."; t = args ? .match_env_nice(args) : this(); out = [((("Strength: " + (.format_score(@t.attribute('strength)))) + "Reaction: ") + (tostr(((t.attribute('agility))[1]) / 5).pad(8))) + "Strength Damage: 0", (("Agility: " + (.format_score(@t.attribute('agility)))) + "Source: ") + (.format_score(@t.attribute('source))), ((("Appearance: " + (.format_score(@t.attribute('appearance)))) + "Learn: ") + (tostr(((t.attribute('intellect))[1]) / 3).pad(8))) + "Competancy Level: 0", (("Intellect: " + (.format_score(@t.attribute('intellect)))) + " Advancement Points: ") + tostr(t.attribute('points)), (("Knowledge: " + (.format_score(@t.attribute('intellect)))) + "Life: ") + (.format_score(@t.attribute('life))), (((("Presence: " + (.format_score(@t.attribute('presence)))) + "Health: ") + (.format_score(@t.attribute('health)))) + "Humanity: ") + (.format_score(@t.attribute('humanity))), "Backbone: " + (.format_score(@t.attribute('backbone))), (((("Charisma: " + (.format_score(@t.attribute('charisma)))) + "Deaths: ") + (tostr(t.attribute('deaths)).pad(8))) + "Encumbrance: ") + tostr(t.attribute('encumbrance)), (("Perception: " + (.format_score(@t.attribute('perception)))) + " Fatigue: ") + tostr(t.attribute('fatigue))]; return out; }; public method .set_attribute() { arg attribute, value; (> .perms(sender()) <); set_var(attribute, [value, value]); }; public method .format_score() { arg base, cur; return pad((base == cur) ? tostr(base) : ((cur + "/") + base), 8); }; new object $storyteller: $player; var $root manager = $storyteller; var $located location = $body_cave; var $root created_on = 809928922; var $root inited = 1; var $root flags = ['methods, 'code, 'variables, 'core]; var $has_commands shortcuts = #[]; var $has_commands remote = #[]; var $has_commands local = #[]; var $player strength = [0, 0]; var $player agility = [0, 0]; var $player appearance = [0, 0]; var $player health = [0, 0]; var $player life = [0, 0]; var $player intellect = [0, 0]; var $player knowledge = [0, 0]; var $player backbone = [0, 0]; var $player charisma = [0, 0]; var $player humanity = [0, 0]; var $player perception = [0, 0]; var $player presence = [0, 0]; var $player source = [0, 0]; var $player weapons = []; var $user task_connections = #[]; var $user formatter = $mail_list; var $location contents = []; var $root managed = [$storyteller]; var $root owned = [$storyteller]; var $user password = "*"; var $command_cache shortcut_cache = []; var $command_cache remote_cache = #[["@lock", [["@lock"], #[[$thing, 1]]]], ["@unlock", [["@unlock"], #[[$thing, 1]]]], ["@boot", [["@boot"], #[[$thing, 1]]]]]; new object $realm_admin_ui: $user_interfaces; var $root manager = $realm_admin_ui; var $root flags = ['variables, 'methods, 'code, 'command_cache, 'core]; var $root created_on = 839898034; var $has_commands shortcuts = #[]; var $has_commands remote = #[]; var $has_commands local = #[["@set-realm-var|@srv", [["@set-realm-var|@srv", "* to *", "@set-realm-var|@srv <any> to <any>", 'set_var_cmd, #[[1, ['any, []]], [3, ['any, []]]]]]], ["@list-r?ealm|@lrealm", [["@list-r?ealm|@lrealm", "*", "@list-r?ealm|@lrealm <object>", 'list_realm_cmd, #[[1, ['object, []]]]]]], ["@rehash-realm-links", [["@rehash-realm-links", "*", "@rehash-realm-links <descendant of $realms_frob>", 'rehash_links_cmd, #[[1, ['descendant, [$realms_frob]]]]]]]]; var $root inited = 1; var $root managed = [$realm_admin_ui]; var $root owned = [$realm_admin_ui]; protected method .set_var_cmd() { arg cmdstr, cmd, spec, onto, value; var holder, name, r; (> .perms(caller(), $user) <); if (((spec = spec.explode(":")).length()) != 2) return "Var spec should be realm|room:variable."; if (!(holder = (| .match_env_nice(spec[1]) |))) return "Invalid realm."; name = tosym(spec[2]); if (holder.has_ancestor($realms_frob)) { catch any holder.set_realm_var(name, value ? holder.parse_variable(name, value) : 'unset); with return (traceback()[1])[2]; return value ? "Variable %l set to %l.".format(name, holder.unparse_variable(0, name)) : ("Cleared %l.".format(name)); } else if (holder.has_ancestor($place)) { r = holder.realm(); catch any holder.set_realm(r.set_realm_var(name, value ? class(r).parse_variable(name, value) : 'unset)); with return (traceback()[1])[2]; return value ? "Variable %l set to %l.".format(name, (holder.realm()).unparse_variable(name)) : ("Cleared %l.".format(name)); } else { return "Illegal value holder: %l.".format(holder); } }; protected method .list_realm_cmd() { arg cmdstr, cmd, holder; var name, r; (> .perms(caller(), $user) <); if (holder.has_ancestor($realms_frob)) { catch any return holder.all_realm_vars_text(); with return (traceback()[1])[2]; } else if (holder.has_ancestor($place)) { r = holder.realm(); catch any return r.all_realm_vars_text(); with return (traceback()[1])[2]; } else { return "Illegal value holder: %l.".format(holder); } }; protected method .rehash_links_cmd() { arg cmdstr, cmd, target; target._check_links('propagate); }; new object $builder: $user, $realm_admin_ui; var $root inited = 1; var $root owned = [$builder]; var $root manager = $builder; var $root quota = 75000; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'core, 'command_cache, 'variables]; var $root managed = [$builder]; var $location contents = []; var $located location = $body_cave; var $located obvious = 1; var $user password = "*"; var $user connected_at = 0; var $user last_command_at = 0; var $user connections = []; var $user modes = #[]; var $user formatter = $mail_list; var $user parsers = [$command_parser]; var $user context = #[]; var $user task_connections = #[]; var $command_aliases command_aliases = []; var $mail_list letters = #[]; var $mail_list letters_index = #[]; var $mail_list senders = 1; var $mail_list readers = []; var $mail_list notify = [$builder]; var $mail_list last_letter = 0; var $mail_list mail = []; var $mail_ui subscribed = #[[$builder, [791485891, 0]]]; var $mail_ui current = #[['location, 0], ['list, $builder]]; var $has_gender gender = $gender_neuter; var $described prose = []; var $has_name name = ['prop, "Generic Builder", "Generic Builder"]; var $has_commands local = #[["@realm?s", [["@realm?s", "", "@realm?s", 'realms_cmd, #[]]]], ["@mv|@move", [["@mv|@move", "*", "@mv|@move <object:>", 'move_cmd, #[[1, ['object_opt, []]]]]]], ["@child?ren|@kids", [["@child?ren|@kids", "*", "@child?ren|@kids <object>", 'children_cmd, #[[1, ['object, []]]]]]], ["@par?ents", [["@par?ents", "*", "@par?ents <object>", 'parents_cmd, #[[1, ['object, []]]]]]], ["@destroy|@dest", [["@destroy|@dest", "*", "@destroy|@dest <list object>", 'destroy_cmd, #[[1, ['list, ['object, []]]]]]]], ["@build", [["@build", "*", "@build <any:-conf?igure>", 'build_cmd, #[[1, ['any_opt, [["conf?igure"]]]]]]]], ["@attach", [["@attach", "* to *", "@attach <any> to <descendant of $place>", 'attach_cmd, #[[1, ['any, []]], [3, ['descendant, [$place]]]]]]]]; var $channel_ui channel_dict = #[]; var $channel_ui active_channels = #[]; protected method .children_cmd() { arg cmdstr, cmd, what; (> .perms(caller(), $user) <); return [("Children of " + (what.namef('xref))) + ":"] + (._list_objects(what.children(), 'parents)); }; protected method .parents_cmd() { arg cmdstr, cmd, what; (> .perms(caller(), $user) <); return [((("Parent" + ((((.parents()).length()) > 1) ? "s" : "")) + " of ") + (what.namef('ref))) + ":"] + (._list_objects(what.parents(), 'children)); }; protected method .destroy_cmd() { arg cmdstr, cmd, objs; var name, yes, obj; (> .perms(caller(), $user) <); cmdstr = cmdstr.trim(); if ((cmdstr.trim()) in ["@dest", "@destroy"]) { yes = .prompt(("Destroy '" + name) + "'? "); if (!(yes in ["y", "yes"])) return "Ok, aborting.."; } for obj in (objs) { catch any { name = obj.namef('xref); (> obj.destroy() <); if (valid(obj)) .tell(("Unable to destroy " + name) + " immediately."); else .tell(("Sucessfully destroyed " + name) + "."); } with { return (traceback()[1])[2]; } } }; protected method .build_get_location() { arg name; var dest, m, realm, parent, str; (> .perms(sender()) <); .build_hint(1); if (name) { if ((m = match_template(name, "to *"))) name = m[2]; name = (| $code_lib.parse_name(name) |); } while (!name) { catch any { name = (> .build_get_name("Destination: ") <); str = (name[1])[1]; if ((m = regexp(str, "^ *\$([a-z0-9_]+) *(.*)$"))) { name = replace(name, 1, replace(name[1], 1, m[2])); catch ~namenf, ~symbol { parent = (> lookup(tosym(m[1])) <); } with { .tell((traceback()[1])[1]); continue; } if (!(parent.is($place))) { .tell(("Parent object " + (parent.namef('ref))) + " is not a place!"); continue; } else if ((!(parent.has_flag('fertile))) && (!(parent.is_writable_by(this())))) { .tell(("Parent object " + (parent.namef('ref))) + " is not fertile!"); continue; } } } with { if (error() == ~skip) { .tell("You cannot skip this step!"); continue; } rethrow(error()); } } // first try to see if it already exists--only do this if they used // the direct $dbref too many conflicts otherwise. catch any { dest = (> $object_lib.to_dbref((name[1])[1]) <); (dest.is($place)) || throw(~place, (dest.namef('ref)) + " is not a place."); return [dest, 0]; } // create it .build_hint(2); if (!parent) dest = (> ($place_lib.get_default('new_place)).spawn() <); else dest = (> parent.spawn() <); .build_set_name(dest, @name); .build_hint(4); catch any { realm = (> .build_query_realm(dest) <); } with { if (error() == ~skip) return dest; .build_cleanup([dest, 1]); rethrow(error()); } // set the realm dest.set_setting_realm($place, "realm", realm); // okee, done return [dest, 1]; }; protected method .build_cmd() { arg cmdstr, cmd, args; var dest, source, exits, set, str, i; (> .perms(caller(), $user) <); str = (args[1]).join(); source = .location(); args = args[2]; if (!(| source.will_attach('source) |)) return "This room is not publicly extendable."; // Establish the objects catch any { dest = (> .build_get_location(str) <); if (!(| (dest[1]).will_attach('dest) |)) { .tell(((dest[1]).name()) + " will not allow you to attach to it!"); .build_cleanup(dest); return "** Build Aborted **"; } exits = (> .build_get_exits(source, dest[1]) <); (> .build_attach_exit(exits[1], source, dest[1]) <); (> .build_attach_exit(exits[2], dest[1], source) <); } with { if (dest) .build_cleanup(dest); if (exits) { if (exits[1]) .build_cleanup([exits[1], 1]); if (exits[2]) .build_cleanup([exits[2], 1]); } if (error() == ~abort) return "** Build Aborted **"; return [(traceback()[1])[2], "** Build Aborted **"]; } .tell(("Completed building to " + ((dest[1]).name())) + "."); if ((i = "conf?igure" in (args.slice(1)))) { if (!((args[i])[3])) return "Skipping post-configuration."; } .tell("post-configuration.."); // Flesh them out set = #[['named_name, 1]]; if (dest[2]) (> (dest[1]).configure(set) <); if (exits[1]) (> (exits[1]).configure(set) <); if (exits[2]) (> (exits[2]).configure(set) <); return "Completed post-configuration."; }; protected method .build_hint() { arg n; (> .perms(sender()) <); if ((| .setting("experienced") |)) return; .tell($place_lib.build_hint(n)); }; protected method .attach_cmd() { arg cmdstr, cmd, source, prep, dest; var exit; (> .perms(caller(), $user) <); if (!source) { source = .location(); } else { catch any source = (> .match_environment(source_str) <); with return (traceback()[1])[2]; if (!(source.is($place))) return (source.namef('ref)) + " is not a descendant of $place."; } catch ~abort, ~skip exit = (> .build_query_exit(dest, source) <); with return "Aborted."; catch any { exit.attach(source, dest); exit.configure(#[['named_name, 1]]); } with { .tell("Ack, unable to attach exit because:"); .tell(" " + ((traceback()[1])[2])); (| exit.destroy() |); return; } return ("Successfully attached exit " + (exit.name())) + "."; }; protected method .realms_cmd() { arg cmdstr, cmd; var x, realms; (> .perms(caller(), $user) <); realms = ($place_lib.known_realms()).union($realms_frob.descendants()); .tell(["Realms:", ""] + ((realms.mmap('name)).prefix(" "))); }; protected method .move_cmd() { arg cmdstr, cmd, args; var what, dest, loc, fromto; (> .perms(caller(), $user) <); what = args[1]; args = args[2]; if (args && ((args[1]) == "to")) args = delete(args, 1); if (!args) return ("You have to move " + (what.namef('ref))) + " somewhere."; dest = (> .match_env_nice(args.join()) <); catch any { loc = what.location(); fromto = ((" from " + ((| loc.name() |) || $nowhere)) + " to ") + (dest.name()); (| what.tell(((("You are suddenly yanked" + fromto) + " by ") + (.name())) + ".") |); (> what.move_to(dest) <); // hook into messages eventually (| loc.announce((what.name()) + " suddenly disappears.") |); (| dest.announce((what.name()) + " suddenly appears.", what) |); return (("You move " + (what.name())) + fromto) + "."; } with { (| what.tell(("You feel as if " + (.name())) + " was incapable of moving you, you did not go anywhere.") |); return (traceback()[1])[2]; } }; protected method .build_cleanup() { arg [what]; var obj; (> .perms(caller(), definer()) <); for obj in (what) { if (valid(obj[1]) && (obj[2])) { .tell(("Destroying " + ((obj[1]).name())) + "..."); (| (obj[1]).destroy() |); } } }; protected method .build_query_exit() { arg source, dest, [args]; var exit, line, name, def, from, str, m, parent; from = "from " + (source.name()); line = (("Exit " + from) + " to ") + (dest.name()); if (args) { def = args[1]; line += (" [" + def) + "] "; } else { line += ": "; } while (!exit) { catch ~skip name = (> .build_get_name(line, def) <); with return 0; str = (name[1])[1]; if (str == "@none") return 0; parent = ""; if ((m = regexp(str, "^ *\$([a-z0-9_]+) *(.*)$"))) { parent = m[1]; str = m[2]; } exit = (| source.match_environment(str) |); if (exit && (exit.is($exit))) { .tell(((str + " is already an exit ") + from) + "."); exit = 0; continue; } if (parent) { catch ~namenf, ~symbol { parent = (> lookup(tosym(parent)) <); } with { .tell((traceback()[1])[1]); continue; } if (!(parent.is($exit))) { .tell(("Parent object " + (parent.namef('ref))) + " is not an exit!"); continue; } } else { parent = $place_lib.get_default('exit); } catch any { exit = (> parent.new() <); } with { .tell(["Unable to create exit!", "=> " + ((traceback()[1])[2])]); continue; } } return .build_set_name(exit, @name); }; protected method .build_set_name() { arg obj, name, templates; var t, x; catch any { obj = obj.set_name(@name); } with { .tell("Unable to set name; " + ((traceback()[1])[2])); .tell("Setting name as " + (obj.objname())); obj = obj.set_name(tostr(obj.objname())); } for t in (templates) obj = obj.add_name_template(t); return obj; }; protected method .build_prompt() { arg prompt, [def]; var name, ans; [(def ?= "")] = def; while (!ans) { ans = .prompt(prompt); if (ans == "@skip") throw(~skip, "Skipped"); if (ans == "@abort") throw(~abort, "Aborted"); if (!ans) { if (!def) continue; ans = def; } } return ans; }; protected method .build_get_name() { arg prompt, [def]; var name, out; .build_hint(3); while (!out) { name = (> .build_prompt(prompt, @def) <); if (!(out = (| $code_lib.parse_name(name) |))) .tell("Invalid name."); } return out; }; protected method .build_query_realm() { arg there; var line, realm, r, prompt; prompt = ((("What realm is " + (there.name())) + " in? [") + (((.location()).realm()).name())) + "] "; while (!realm) { line = (> .build_prompt(prompt, tostr(class((.location()).realm()))) <); if (!line) { realm = class((.location()).realm()); } else if (line == "@realms") { r = ($place_lib.known_realms()).union($realms_frob.descendants()); .tell(["Realms:", ""] + ((realms.mmap('name)).prefix(" "))); } else { realm = $place_lib.match_realm(line); if (!realm) { .tell(("Unknown realm \"" + line) + "\", try @realms."); } else if (!(realm.is($realms_frob))) { .tell((realm.namef('ref)) + " is not a realm, try @realms."); realm = 0; } } } return realm; }; protected method .build_get_exits() { arg source, dest; var eleave, earrive, opp, t; // Get the exits catch any { eleave = (> .build_query_exit(source, dest) <); if (eleave) { // try really hard to figure this out if (!(opp = $place_lib.opposite_direction(eleave.name()))) { for t in (eleave.name_templates()) { t = strsed(t, "[^a-z]+", "", "g"); if ((opp = $place_lib.opposite_direction(eleave.name()))) break; } } if (opp) { opp = strsed(explode(opp, "|")[1], "[^a-z]+", "", "g"); earrive = (> .build_query_exit(dest, source, opp) <); } else { earrive = (> .build_query_exit(dest, source) <); } } } with { if (eleave) { .build_cleanup([eleave, 1]); if (earrive) .build_cleanup([earrive, 1]); } rethrow(error()); } return [eleave, earrive]; }; protected method .build_attach_exit() { arg exit, source, dest; var line; catch any { exit.attach(source, dest); } with { .tell(("Unable to attach " + (exit.name())) + " because: "); .tell(" " + ((traceback()[1])[2])); line = .prompt("Continue building? "); if (line in ["no", "n"]) throw(~abort, "Aborted"); } }; new object $programmer: $builder; var $root inited = 1; var $root owned = [$programmer]; var $root manager = $programmer; var $root quota = 75000; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'core, 'command_cache, 'variables]; var $root managed = [$programmer]; var $location contents = []; var $located location = $body_cave; var $located obvious = 1; var $user password = "*"; var $user connected_at = 0; var $user last_command_at = 0; var $user connections = []; var $user modes = #[]; var $user formatter = $mail_list; var $user parsers = [$command_parser]; var $user context = #[]; var $user task_connections = #[]; var $programmer eval_prefix = 0; var $programmer eval_tick_offset = 0; var $programmer eval_offset = 0; var $command_aliases command_aliases = []; var $mail_list letters = #[]; var $mail_list letters_index = #[]; var $mail_list senders = 1; var $mail_list readers = []; var $mail_list notify = [$programmer]; var $mail_list last_letter = 0; var $mail_list mail = []; var $mail_ui subscribed = #[[$programmer, [791485891, 0]]]; var $mail_ui current = #[['location, 0], ['list, $programmer]]; var $has_gender gender = $gender_neuter; var $described prose = []; var $has_name name = ['prop, "Generic Programmer", "Generic Programmer"]; var $has_commands local = #[["@id", [["@id", "*", "@id <any>", 'id_cmd, #[[1, ['any, []]]]]]], ["@which", [["@which", "*", "@which <any>", 'which_cmd, #[[1, ['any, []]]]]]], ["@eval", [["@eval", "*", "@eval <any>", 'eval_cmd, #[[1, ['any, []]]]]]], ["@add-c?ommand|@ac", [["@add-c?ommand|@ac", "*", "@add-c?ommand|@ac <any>", 'add_command_cmd, #[[1, ['any, []]]]]]], ["@del-c?ommand|@dc", [["@del-c?ommand|@dc", "*", "@del-c?ommand|@dc <any>", 'del_command_cmd, #[[1, ['any, []]]]]]], ["@join", [["@join", "*", "@join <any>", 'join_cmd, #[[1, ['any, []]]]]]], ["@descend?ants", [["@descend?ants", "*", "@descend?ants <any>", 'descendants_cmd, #[[1, ['any, []]]]]]], ["@chpar?ents", [["@chpar?ents", "*", "@chpar?ents <any>", 'chparents_cmd, #[[1, ['any, []]]]]]], ["@teleport|@go", [["@teleport|@go", "*", "@teleport|@go <any>", 'teleport_cmd, #[[1, ['any, []]]]]]], ["@add-s?hortcut|@as", [["@add-s?hortcut|@as", "*", "@add-s?hortcut|@as <any>", 'add_shortcut_cmd, #[[1, ['any, []]]]]]], ["@del-m?ethod|@delm?ethod|@dm", [["@del-m?ethod|@delm?ethod|@dm", "*", "@del-m?ethod|@delm?ethod|@dm <objref>", 'del_method_cmd, #[[1, ['objref, []]]]]]], ["@rehash", [["@rehash", "", "@rehash", 'rehash_cmd, #[]]]], ["@trace-method|@trace", [["@trace-method|@trace", "*", "@trace-method|@trace <objref>", 'trace_method_cmd, #[[1, ['objref, []]]]]]], ["@ledit", [["@ledit", "*", "@ledit <objref: +e?dited>", 'local_edit_cmd, #[[1, ['objref_opt, [["e?dited"]]]]]]]], ["@d?isplay", [["@d?isplay", "*", "@d?isplay <objref: +c?hop +g?enerations=1 +d?efiners=1>", 'display_cmd, #[[1, ['objref_opt, [["c?hop"], ["g?enerations", "1"], ["d?efiners", "1"]]]]]]]], ["@program", [["@program", "*", "@program <objref: +w?arnings +e?dited=1 +a?ccess=1 +f?lags=1>", 'program_cmd, #[[1, ['objref_opt, [["w?arnings"], ["e?dited", "1"], ["a?ccess", "1"], ["f?lags", "1"]]]]]], ["@program", "* with *", "@program <objref: +w?arnings +e?dited=1 +a?ccess=1 +f?lags=1> with <any>", 'program_cmd, #[[1, ['objref_opt, [["w?arnings"], ["e?dited", "1"], ["a?ccess", "1"], ["f?lags", "1"]]]], [3, ['any, []]]]]]], ["@del-v?ariable|@dv", [["@del-v?ariable|@dv", "*", "@del-v?ariable|@dv <objref>", 'del_var_cmd, #[[1, ['objref, []]]]]]], ["@show", [["@show", "*", "@show <objref: +c?hop>", 'show_cmd, #[[1, ['objref_opt, [["c?hop"]]]]]]]], ["@mv|@move|@cp|@copy", [["@mv|@move|@cp|@copy", "*", "@mv|@move|@cp|@copy <objref:+c?omment=1>", 'move_cmd, #[[1, ['objref_opt, [["c?omment", "1"]]]]]]]], ["@del-s?hortcut|@ds", [["@del-s?hortcut|@ds", "*", "@del-s?hortcut|@ds <any>", 'del_shortcut_cmd, #[[1, ['any, []]]]]]], ["@add-p?arent|@ap", [["@add-p?arent|@ap", "*", "@add-p?arent|@ap <any>", 'add_parent_cmd, #[[1, ['any, []]]]]]], ["@del-p?arent|@dp", [["@del-p?arent|@dp", "*", "@del-p?arent|@dp <any>", 'del_parent_cmd, #[[1, ['any, []]]]]]], ["@grep", [["@grep", "*", "@grep <any:+d?escend +f?ull +l?ist +r?eplace-with=1>", 'grep_cmd, #[[1, ['any_opt, [["d?escend"], ["f?ull"], ["l?ist"], ["r?eplace-with", "1"]]]]]]]], ["@chmod|@mmod|@omod|@chflag?s", [["@chmod|@mmod|@omod|@chflag?s", "*", "@chmod|@mmod|@omod|@chflag?s <any>", 'chmod_cmd, #[[1, ['any, []]]]]]], ["@dump", [["@dump", "*", "@dump <any: +t?extdump +m?ethods +v?ariables +h?eader>", 'dump_cmd, #[[1, ['any_opt, [["t?extdump"], ["m?ethods"], ["v?ariables"], ["h?eader"]]]]]]]], ["@list", [["@list", "*", "@list <objref: +n?umbers +t?extdump>", 'list_cmd, #[[1, ['objref_opt, [["n?umbers"], ["t?extdump"]]]]]]]], ["@add-v?ariable|@av", [["@add-v?ariable|@av", "*", "@add-v?ariable|@av <any>", 'add_var_cmd, #[[1, ['any, []]]]]]], ["@hl?ist|@help-list", [["@hl?ist|@help-list", "*", "@hl?ist|@help-list <any>", 'help_list_cmd, #[[1, ['any, []]]]]]], ["@hw?rite|@help-write", [["@hw?rite|@help-write", "*", "@hw?rite|@help-write <any>", 'help_write_cmd, #[[1, ['any, []]]]]]], ["@nh?n|@new-help|@new-help-node", [["@nh?n|@new-help|@new-help-node", "*", "@nh?n|@new-help|@new-help-node <any>", 'new_help_node_cmd, #[[1, ['any, []]]]]]], ["@spawn", [["@spawn", "*", "@spawn <any>", 'spawn_cmd, #[[1, ['any, []]]]]]]]; var $has_commands shortcuts = #[[";*", ['eval_cmd, ["eval", 1]]]]; var $has_messages message_info = #[["teleport", #[]]]; var $has_messages messages = #[[$programmer, #[["teleport.actor", <$ctext_frob, [["You teleport to ", <$generator, ["dest", [], [], 'gen_dest]>, "."], #[['this, $lag_watcher]]]>], ["teleport.source", <$ctext_frob, [[<$generator, ["actor", [], [], 'gen_actor]>, " teleports to ", <$generator, ["dest", [], [], 'gen_dest]>, "."], #[['this, $lag_watcher]]]>], ["teleport.dest", <$ctext_frob, [[<$generator, ["actor", [], [], 'gen_actor]>, " teleports here from ", <$generator, ["source", [], [], 'gen_source]>, "."], #[['this, $lag_watcher]]]>]]]]; var $has_settings defined_settings = #[["@program-options", #[['get, 'get_local_setting], ['set, 'set_local_setting], ['check, 'is_any], ['del, 'delete_local_setting], ['check_args, []], ['get_args, []], ['set_args, []]]], ["@list-options", #[['get, 'get_local_setting], ['set, 'set_local_setting], ['check, 'is_any], ['del, 'delete_local_setting], ['check_args, []], ['get_args, []], ['set_args, []]]], ["match-with", #[['get, 'get_match_with], ['set, 'set_local_setting], ['check, 'check_match_with], ['del, 'delete_local_setting], ['check_args, []], ['get_args, []], ['set_args, []]]], ["match-default", #[['get, 'get_match_default], ['set, 'set_local_setting], ['check, 'is_any], ['del, 'delete_local_setting], ['check_args, []], ['get_args, []], ['set_args, []]]]]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $root child_index = 2; var $channel_ui channel_dict = #[]; var $channel_ui active_channels = #[]; protected method .eval_cmd() { arg cmdstr, com, str; var result, adjust, vars, v, evalp, times, line, reg, obj, definer, ref, debug; (> .perms(caller(), $user) <); evalp = .eval_prefix(); vars = (evalp.keys()).join(", "); v = (evalp.values()).join(); // clean it up str = strsed(str, "^;*", ""); // perform escape substitution if (str && ((str[1]) == "|")) str = substr(str, 2); else str = .eval_subs(str); // check for debug flags if ((reg = regexp(str, "^(trace|debug|profile) *;*(.*)$"))) { [debug, str] = reg; debug = #[["trace", 'trace], ["debug", 'debug], ["profile", 'profile]][debug]; } else { debug = 0; } // who are we evaluating as if ((reg = regexp(str, "^ *as +([^; ]+)"))) { ref = $parse_lib.ref(reg[1]); obj = ref[2]; definer = ref[3]; str = strsed(str, "^ *as +([^; ]+)[ ;]+", ""); if ((!(definer.is_writable_by(this()))) || (!(obj.is_writable_by(this())))) return ("You do not have permission to evaluate on " + (reg[1])) + "."; } else { obj = (definer = this()); } // are we just adjusting our offset? if (!str) { result = (> .evaluate(((("var " + vars) + ";") + v) + "return (> 1 <);", obj, definer, 'no_offset) <); result = replace(result[1], 1, ((result[1])[1]) - 1); if (eval_offset) line = strfmt("adjusted by %s ticks and %s.%6{0}r seconds.", (eval_offset[1]) - (result[1]), (eval_offset[2]) - (result[2]), abs((eval_offset[3]) - (result[3]))); else line = strfmt("set to %s ticks and %s.%6{0}r seconds.", @result); eval_offset = result; return "Eval offset " + line; } // format it, use heuristics if (match_begin(str, "var") && (reg = regexp(str, "var ([^;]+)"))) { str = strsed(str, "var ([^;]+);", ""); str = ((((("var " + vars) + ", ") + (reg.join(","))) + ";") + v) + str; } else if ("return" in str) { str = ((("var " + vars) + ";") + v) + str; } else { str = strsed(str, " *;* *$", ""); str = ((((("var " + vars) + ";") + v) + "return (> ") + str) + " <);"; } if (debug) [times, result, debug] = (> .evaluate(str, obj, definer, debug) <); else [times, result] = (> .evaluate(str, obj, definer) <); // Display the errors, or the result. if ((result[1]) == 'errors) { .tell(result[2]); } else { if (type(result[2]) == 'objnum) .tell("=> " + ((| (result[2]).namef('xref) |) || (result[2]))); else .tell("=> " + toliteral(result[2])); if (debug) .tell(debug); line = strfmt("[ seconds: %l.%6{0}r; operations: %s", times[2], times[3], times[1]); if (times[2]) line += (" (" + ((times[1]) / (times[2]))) + " ticks per second)"; return line + " ]"; } }; protected method .program_cmd() { arg cmdstr, com, args, [more]; var ref, o, i, ops, ign, ed, fl, meth, ex, acc, warn, errs, code, line, errs, code; (> .perms(caller(), $user) <); ops = args[3]; ref = args[1]; // verify what we have is correct if (!(meth = (| tosym(ref[4]) |))) { ign++; .tell(("The method name '" + (((ref[4]) == 0) ? "" : (ref[4]))) + "' is not acceptable."); } if ((!ign) && ((ref[3]) && (!((ref[3]).is_writable_by(this()))))) { ign++; .tell(("You cannot program on " + ((ref[3]).namef('ref))) + "."); } if ((!ign) && ((| (ref[3]).find_method(meth) |) == (ref[3]))) ex++; // ok, go on with options o = ops.slice(1); if ((i = "e?dited" in o)) { if (!((ops[i])[3])) { if (!($sys.is_admin(this()))) { ign++; .tell("Only admins can shut off edited comments."); } } else { ed = 1; } } else { ed = 1; } if (ed) { ed = (("// $#Edited: " + ($time.format("%d %h %y %H:%M"))) + " ") + this(); if (i && ((ops[i])[4])) ed += ": " + ((ops[i])[4]); } if ((i = "f?lags" in o)) fl = $parse_lib.parse_method_flags((ops[i])[4]); else if (ex) fl = (ref[3]).method_flags(meth); else fl = []; if ((i = "a?ccess" in o)) acc = $parse_lib.parse_method_access((ops[i])[4]); else if (ex) acc = (ref[3]).method_access(meth); else acc = 'public; if ((i = "w?arnings" in o)) warn = (ops[i])[4]; else warn = 1; // now get on with it already if (ign) line = "Ignoring input until \".\" or \"@abort\""; else if (ex) line = ((((("Reprogramming " + acc) + " method ") + (ref[3])) + ".") + meth) + "()"; else line = ((((("Programming " + acc) + " method ") + (ref[3])) + ".") + meth) + "()"; if (fl) line += (" [" + (fl.to_english())) + "]"; code = more ? more.subrange(2) : (.read(("-- " + line) + " --")); if (type(code) == 'symbol) { switch (code) { case 'aborted: return; case 'engaged: return "Sorry, you are already reading on this connection."; default: return "Unknown response from the read parser: " + code; } } if (ign) return "Finished ignoring input."; if (ed) code += [ed]; catch any { if ((errs = (ref[3]).add_method(code, meth))) return errs; (> (ref[3]).set_method_flags(meth, fl) <); (> (ref[3]).set_method_access(meth, acc) <); if ((line = (> $code_lib.verify_code(code, meth, warn) <))) .tell(line); return ((((("Method " + (ref[3])) + ".") + meth) + "() ") + (ex ? "re" : "")) + "compiled"; } with { return (traceback()[1])[2]; } }; protected method .show_cmd() { arg cmdstr, com, args; var show, match, i, chop, f, obj, out; (> .perms(caller(), $user) <); if (((args[1])[1]) == 'object) show = ['method, 'variable]; else if ((args[1])[5]) show = [(args[1])[1], (args[1])[5]]; else show = [(args[1])[1]]; if ((i = "c?hop" in ((args[3]).slice(1)))) chop = ((args[3])[i])[3]; else chop = 1; if ((args[1])[4]) f = (args[1])[4]; else f = .setting("match-default"); match = .setting("match-with"); obj = (args[1])[3]; .tell([((("Object: " + obj) + " [") + ((obj.size()).to_english())) + " bytes]", "Parents: " + ((obj.parents()).join(", "))]); if ('method in show) { if (!(obj.has_flag('methods, this()))) .tell(" ** No permission to list methods **"); else .tell(._show_methods(obj, f, match, chop)); } if ('variable in show) { if (!(obj.has_flag('variables, this()))) .tell(" ** No permission to show variables **"); else .tell(._show_variables(obj, f, match, chop)); } }; protected method ._move_method() { arg remove, fobj, fname, tobj, tname, comment; var code, line, result; if ((fobj == tobj) && remove) { if ((| tobj.find_method(tname) |) == tobj) tobj.del_method(tname); return (> fobj.rename_method(fname, tname) <); } code = (> fobj.list_method(fname) <); if (comment) { line = (((((((("// $#" + (remove ? "Moved" : "Copied")) + " ") + ($time.format("%d %h %y %H:%M"))) + " from ") + fobj) + ".") + fname) + "() by ") + this(); if (type(comment) == 'string) line += ": " + comment; code += [line]; } if ((> tobj.add_method(code, tname) <)) throw(~compile, "Error encountered upon moving method!"); if (remove) (> fobj.del_method(fname) <); }; protected method .del_method_cmd() { arg cmdstr, cmd, objref; var name, obj; (> .perms(caller(), $user) <); if (!(objref[4])) return .tell(("No method specified to delete from " + (objref[3])) + "."); if (!(| (name = tosym(objref[4])) |)) return .tell(("Invalid method name \"" + (objref[4])) + "\"."); catch any { (> (objref[3]).del_method(name) <); .tell(((("Method " + (objref[3])) + ".") + name) + "() deleted."); } with { if (error() == ~methodnf) .tell(((("Method " + (objref[3])) + ".") + name) + "() does not exist."); else .tell((traceback()[1])[2]); } }; protected method .move_cmd() { arg cmdstr, cmd, args; var src, dest, comment, i, how; (> .perms(caller(), $user) <); // is this actually @copy|@cp? how = match_begin(cmd, "@c") ? 'copy : 'move; // drop back to $builder.move_cmd if it is just an object if (((args[1])[1]) == 'object) { if (how == 'copy) return "You cannot copy objects!"; return (> pass(cmdstr, cmd, [(args[1])[2], args[2], args[3]]) <); } // options if ((i = "c?omment" in ((args[3]).slice(1)))) comment = (((args[3])[i])[4]) || (((args[3])[i])[3]); else comment = 1; // move|copy a method or var src = args[1]; args = args[2]; if ((args[1]) == "to") args = delete(args, 1); if (!args) return ((("You have to " + how) + " ") + (what.namef('ref))) + " somewhere."; catch ~objnf dest = (> $parse_lib.ref(args.join()) <); with return (traceback()[1])[2]; if ((dest[1]) == 'object) dest = [src[1], dest[2], dest[3], src[4], 0]; if ((src[1]) != (dest[1])) return ((((("You cannot " + how) + " a ") + (src[1])) + " to a ") + (dest[1])) + "."; if (!(src[4])) return ("Invalid " + (src[1])) + " reference, no name specified."; if (!(dest[4])) dest = replace(dest, 4, src[4]); if (((src[3]) == (dest[3])) && ((src[4]) == (dest[4]))) return ((("Why do you want to " + how) + " the ") + (src[1])) + " to itself?"; catch ~symbol { src = replace(src, 4, (> tosym(src[4]) <)); dest = replace(dest, 4, (> tosym(dest[4]) <)); } with { return ("You cannot specify wildcards in the " + (src[1])) + " name."; } if ((how == 'move) && (!((src[3]).is_writable_by(this())))) return ("You do not have permission to move from " + (src[3])) + "."; if (!((dest[3]).is_writable_by(this()))) return ((("You do not have permission to " + how) + " to ") + (src[3])) + "."; catch any (> .(tosym("_move_" + (src[1])))(how == 'move, src[3], src[4], dest[3], dest[4], comment) <); with return (traceback()[1])[2]; return ((((("You " + how) + " ") + ($parse_lib.buildref(@src))) + " to ") + ($parse_lib.buildref(@dest))) + "."; }; protected method .list_cmd() { arg cmdstr, cmd, args; var i, pattern, ref, methods, s, def, method, opts, str, m, d, out, type; (> .perms(caller(), $user) <); if ((opts = (| .setting("@list-options") |))) { opts = $parse_lib.getopt(opts, [["n?umbers"]]); opts = union(args[3], opts[2]); } else { opts = args[3]; } if ((i = (| "n?umbers" in (opts.slice(1)) |)) && ((opts[i])[3])) type = 'numbered; else if ((i = (| "t?extdump" in (opts.slice(1)) |)) && ((opts[i])[3])) type = 'textdump; else type = 'normal; ref = args[1]; if ((ref[1]) == 'variable) return ((("The reference " + (ref[3])) + ",") + ((ref[4]) || "")) + " is not for a method."; if ((ref[1]) == 'object) return ("The reference " + (ref[3])) + " is not for a method."; def = (| (ref[2]).find_method(tosym(ref[4])) |); if (def) { pattern = ref[4]; methods = [tosym(ref[4])]; } else { if (ref[4]) pattern = ref[4]; else pattern = .setting("match-default"); def = ref[3]; m = .setting("match-with"); methods = []; for method in (def.methods()) { if (tostr(method).(m)(pattern)) methods += [method]; } if (!methods) return .tell((("No method found matching " + def) + ".") + pattern); } cmd = (| .setting("@program-options") |) || ""; out = []; for method in (methods) out += .format_method(def, method, type, cmd); return out; }; protected method .id_cmd() { arg cmdstr, cmd, obj; (> .perms(caller(), $user) <); obj = .match_env_nice(obj); .tell((((((((obj.namef('xref)) + " ") + ($object_lib.see_perms(obj))) + " ") + toliteral(obj.parents())) + " ") + tostr(obj.size())) + " bytes"); }; protected method .dump_cmd() { arg cmdstr, cmd, args; var opts, objs, o, i, tdfmt, meths, vars, header; (> .perms(caller(), $user) <); opts = args[2]; args = args[1]; o = opts.slice(1); (i = "t?extdump" in o) && (tdfmt = (opts[i])[3]); (i = "m?ethods" in o) ? (meths = (opts[i])[3]) : (meths = 1); (i = "v?ariables" in o) ? (vars = (opts[i])[3]) : (vars = 1); (i = "h?eader" in o) ? (header = (opts[i])[3]) : (header = 1); if ((!meths) && (!vars)) return "Perhaps you will want to dump methods and/or vars next time?"; objs = []; for o in (args) { catch any objs += [(> .match_env_nice(o) <)]; with .tell((traceback()[1])[2]); } if (!objs) return "Dump nothing?"; if (tdfmt) .dump_fmt_textdump(objs, meths, vars, header); else .dump_fmt_commands(objs, meths, vars, header); }; public method ._show_methods() { arg obj, f, match, chop; var methods, types, m, t, out; types = #[]; for m in (obj.methods()) { if (tostr(m).(match)(f) != 0) types = types.add_elem(obj.method_access(m), ((("." + m) + "(") + ((obj.method_info(m))[1])) + ")"); } // hard-listing the types guarantee's their order out = []; for t in (['root, 'driver, 'public, 'protected, 'private, 'frob]) { if (!(types.contains(t))) continue; out += [(((tostr(t).capitalize()) + " methods matching \"") + f) + "\":"]; for m in (types[t]) out += [" " + m]; } return out; }; protected method .descendants_cmd() { arg cmdstr, cmd, args; var syn, obj, maxlevels, line; (> .perms(caller(), $user) <); syn = cmd + " <obj> [<levels>]"; args = args.explode(); if (!((args.length()) in [1, 2])) return ""; obj = .match_env_nice(args[1]); if ((args.length()) == 2) { if ((args[2]) == "all") maxlevels = 0; else maxlevels = abs(toint(args[2])) + 1; } else { maxlevels = 3; } line = ("Descendants of " + obj) + " ["; line = (line + (((obj.parents()).mmap('objname)).to_english())) + "], "; if (maxlevels) { line += tostr(maxlevels - 1); line = ((line + " level") + (((maxlevels - 1) > 1) ? "s" : "s")) + ":"; } else { line += "all levels:"; } .tell(line); .tell(obj._display_descendants("", #[], 0, maxlevels)); .tell("---"); }; protected method .chparents_cmd() { arg cmdstr, cmd, args; var syn, p, x, obj, parents, match; (> .perms(caller(), $user) <); syn = ("Syntax: `" + cmd) + " <child> [to] <parent>, <parent>, ...`"; if ((match = match_template(args, "* to *"))) { obj = match[1]; parents = match[3]; } else if ((args = explode(args))) { if (listlen(args) == 1) return syn; obj = args[1]; parents = sublist(args, 2).join(); } else { return syn; } obj = (> .match_env_nice(obj) <); if (("," in parents) || (" and " in parents)) parents = parents.explode_english_list(); else parents = parents.explode(); if (!parents) return "No parents to change to."; parents = map p in (parents) to ((> .match_env_nice(p) <)); catch any { obj.chparents(@parents); return ((("Changed parents for " + obj) + " to ") + (parents.to_english())) + "."; } with { return (traceback()[1])[2]; } }; protected method ._display_methods() { arg obj, info, chop, f; var type, types, line, out, m, len; len = .linelen(); out = []; for type in (info.keys()) { line = (tostr(type).capitalize()) + " Methods"; if (f) line += (" matching \"" + f) + "\""; out += [line + ":"]; for m in (info[type]) { line = strfmt("%5l %4r %l.%l(%l)", $object_lib.parse_method_flags(m[8]), m[6], ((m[1]) != obj) ? m[1] : "", m[2], m[3]); if (chop) line = line.chop(len); out += [line]; refresh(); } } return out; }; protected method .teleport_cmd() { arg cmdstr, com, dest; var loc, p; (> .perms(caller(), $user) <); if (!dest) { .tell("Specify a destination."); return; } if (dest == "home") loc = .home(); else loc = (| .match_environment(dest) |); // if we have still not found a location... if (!loc) { catch any { loc = $place_db.search(dest); } with { switch (error()) { case ~ambig: .tell("Several rooms match that name: " + ((((traceback()[1])[3]).mmap('namef)).to_english())); case ~namenf: .tell(("Unable to find place \"" + dest) + "\"."); return; default: return (traceback()[1])[2]; } } } if (!loc) { .tell(("Unable to find place \"" + dest) + "\"."); return; } if (loc == (.location())) { .tell("You are already there!"); return; } if (!(.teleport(loc))) .tell("Sorry."); }; protected method .eval_subs() { arg code; var idx, ret_code, sub; ret_code = ""; while (code) { idx = "^" in code; if (!idx) { return ret_code + code; } else if ((idx == (code.length())) || ((code.subrange(idx + 1, 1)) == "^")) { ret_code += code.subrange(1, idx); code = code.subrange(idx + 1); if (code && ((code[1]) == "^")) code = code.subrange(2); } else { if (idx > 1) { ret_code += code.subrange(1, idx - 1); code = code.subrange(idx + 1); } else { code = code.subrange(2); } idx = 1; while ((idx <= (code.length())) && (!((code[idx]) in " =.()[]=<>?|&!*+-/';\""))) idx++; sub = .match_env_nice(code.subrange(1, idx - 1)); ret_code += sub; code = code.subrange(idx); } } return ret_code; }; public method .eval_prefix() { return #[["me", ("me = " + this()) + ";"], ["here", ("here = " + (.location())) + ";"]].union(eval_prefix || #[]); }; protected method .del_command_cmd() { arg cmdstr, cmd, args; var ref, t, objref; (> .perms(caller(), $user) <); args = args.explode_quoted(); if (listlen(args) > 2) { if ((args[2]) == "from") args = delete(args, 2); t = delete(args, listlen(args)).join(); objref = args.last(); } else if (listlen(args) == 2) { t = args[1]; objref = args[2]; } else { return ("Syntax: `" + cmd) + " \"template\" [from] <objref>"; } catch any { ref = (> $parse_lib.ref(objref) <); if ((ref[1]) != 'method) return ("The reference " + objref) + " is not for a method."; if ((!(ref[4])) || (!((ref[4]).valid_ident()))) return ((("Invalid method name " + (ref[3])) + ".") + (ref[4])) + "()."; if (!(> (ref[2]).del_command(t, tosym(ref[4])) <)) return strfmt("Command %d is not defined on %s.", t, ref[2]); } with { return (traceback()[1])[2]; } return strfmt("Command %d removed from %s.%s()", t, ref[3], ref[4]); }; private method ._which_cmd() { arg partial, parent, type, more; var p, cmds, cmd, def, matches; cmds = (| parent.(type)() |) || #[]; matches = []; for def in (cmds.keys()) { for cmd in (cmds[def]) { if (partial in ((cmd[3]).strip("?"))) matches += [[more, cmd[3], cmd[4]]]; } } return matches; }; protected method .which_cmd() { arg cmdstr, command, str; var m, c, l, t, p, s, cmds, def, out, dname, line, lcache, rcache; (> .perms(caller(), $user) <); if (!str) return ("Syntax: `" + command) + " <partial or full template>`"; m = #[]; t = (str.explode())[1]; for p in (.ancestors()) { if (p == $has_commands) break; cmds = ._which_cmd(str, p, 'local_commands, " "); cmds += ._which_cmd(str, p, 'remote_commands, "*"); if (cmds) m = m.add(p, cmds); } if (!m) return ("No commands found matching the template \"" + str) + "\"."; l = (.linelen()) / 2; out = [("Commands matching the template \"" + str) + "\":"]; lcache = .local_cache(); rcache = .remote_cache(); for def in (m) { dname = (" " + (def[1])) + "."; for c in (def[2]) { line = ((((c[1]) + ((c[2]).pad(l))) + dname) + tostr(c[3])) + "()"; s = (((((c[2]).explode())[1]).strip("?")).explode("|"))[1]; if ((| lcache[s] |) || (| rcache[s] |)) line = " " + line; else line = "!" + line; out += [line]; } } return out; }; protected method .add_command_cmd() { arg cmdstr, cmd, str; var ref, t, args, objref; (> .perms(caller(), $user) <); args = str.explode_quoted(); if (listlen(args) > 2) { if ((args[2]) in ["to", "for"]) args = delete(args, 2); t = delete(args, listlen(args)).join(); objref = args.last(); } else if (listlen(args) == 2) { t = args[1]; objref = args[2]; } else { return ("Syntax: `" + cmd) + " \"template\" [to|for] <objref>"; } catch any { ref = (> $parse_lib.ref(objref) <); if ((ref[1]) != 'method) return ("The reference " + objref) + " is not for a method."; if ((!(ref[4])) || (!((ref[4]).valid_ident()))) return ((("Invalid method name " + (ref[3])) + ".") + (ref[4])) + "()."; (> (ref[2]).add_command(t, tosym(ref[4])) <); } with { return (traceback()[1])[2]; } return strfmt("Command %d added to %s.%s()", t, ref[3], ref[4]); }; protected method .teleport() { arg dest; var m, source, vars; source = .location(); if (!(| .move_to(dest) |)) return 0; vars = #[["$actor", this()], ["actor", .name()], ["$source", source], ["source", source.name()], ["$dest", dest], ["dest", dest.name()]]; m = .eval_message("teleport", vars, $programmer); dest.announce(m); source.announce(m); }; protected method .join_cmd() { arg cmdstr, cmd, who; var loc, p, user; (> .perms(caller(), $user) <); if (!who) { .tell("Specify a user to join."); return; } catch any { if ((who[1]) in "$#") { user = (> $object_lib.to_dbref(who) <); if (!(user.has_ancestor($thing))) return "You can only join things in the VR."; } else { user = (> $user_db.search(who) <); } } with { .tell((traceback()[1])[2]); return; } loc = user.location(); if (loc == (.location())) { .tell(("You are already with " + (user.name())) + "!"); return; } if (!(.teleport(loc))) .tell("Sorry."); else .tell(("You join " + (user.name())) + "."); }; protected method .local_edit_cmd() { arg cmdstr, cmd, args; var ref, edited, code, def, meth, i; (> .perms(caller(), $user) <); ref = args[1]; if ((ref[1]) == 'variable) return ((("The reference " + (ref[3])) + ",") + ((ref[4]) || "")) + " is not for a method."; if ((ref[1]) == 'object) return ("The reference " + (ref[3])) + " is not for a method."; if ((ref[3]) && (!((ref[3]).is_writable_by(this())))) return "You cannot program on that object."; if ((!(ref[4])) || (!((ref[4]).valid_ident()))) return ("The method name '" + (ref[4])) + "' is not acceptable."; meth = tosym(ref[4]); catch ~methodnf { def = (ref[3]).find_method(meth); if (!(def.is_writable_by(this()))) return ("You cannot program on " + def) + "."; } with { return ((("Method " + (ref[3])) + ".") + meth) + "() not found."; } if ((i = "e?dited" in ((args[3]).slice(1)))) { if (!(((args[3])[i])[3])) { if (!($sys.is_admin(this()))) return "Only admins can shut off edited comments."; } else { edited = 1; } } else { edited = 1; } if (edited) { edited = (("// $#Edited: " + ($time.format("%d %h %y %H:%M"))) + " ") + this(); if (i && (((args[3])[i])[4])) edited += ": " + (((args[3])[i])[4]); } catch ~perm code = def.list_method(meth); with return (traceback()[1])[2]; return ([(((("#$# edit name: " + meth) + " upload: @program ") + def) + ".") + meth] + (code.prefix(" "))) + ["."]; }; protected method .display_cmd() { arg cmdstr, cmd, args; var opts, slice, what, match, i, chop, f, gen, def, obj, out; (> .perms(caller(), $user) <); opts = args[3]; args = args[1]; chop = 1; slice = opts.slice(1); if ((i = "c?hop" in slice) && (!((opts[i])[3]))) chop = 0; else chop = .linelen(); def = args[3]; if ((i = "g?enerations" in slice)) { gen = (opts[i])[4]; if (gen.is_numeric()) gen = ['generations, toint(gen)]; else if (gen) gen = ['ancestors_to, (> .match_env_nice(gen) <)]; else gen = ['ancestors_to, def]; def = 0; } else { gen = ['generations, 1]; } what = [args[1]] + ((| args[5] |) ? [args[5]] : []); obj = args[2]; out = $object_lib.format_object(obj, chop); if (!(args[4])) f = .setting("match-default"); else f = args[4]; match = .setting("match-with"); if ('method in what) out += ._display_methods(obj, obj.list_methods(gen, def, f, match), chop, f); if ('variable in what) out += ._display_variables(obj, obj.variable_info(gen, def, f, match), chop, f); return out + ["---"]; }; protected method .eval_offset() { return eval_offset || #[['mtime, 0], ['time, 0], ['ticks, 0]]; }; protected method .del_var_cmd() { arg cmdstr, cmd, ref; (> .perms(caller(), $user) <); if (((ref[1]) != 'variable) || (!(ref[4]))) return "Invalid obj,variable reference."; catch ~symbol (ref[3]).del_var(tosym(ref[4])); with return (traceback()[1])[2]; return ((("Object variable " + (ref[3])) + ",") + (ref[4])) + " deleted."; }; protected method .add_var_cmd() { arg cmdstr, cmd, args; var ref, value; (> .perms(caller(), $user) <); if (!args) return "Invalid obj,variable reference."; ref = (> $parse_lib.ref(args.word(1)) <); if (((ref[1]) != 'variable) || (!(ref[4]))) return "Invalid obj,variable reference."; if (" " in args) { args = substr(args, (" " in args) + 1); if (args && ((args[1]) == "=")) args = substr(args, (" " in args) + 1); if (args) { value = .eval([("return " + args) + ";"]); if ((value[1]) == 'errors) return ("Unable to parse value \"" + args) + "\"."; value = value[2]; } else { value = 0; } } else { value = 0; } catch any { (> (ref[3]).add_var(tosym(ref[4]), value) <); } with { if (error() in [~varexists, ~symbol]) return (traceback()[1])[2]; rethrow(error()); } return ((((("Object variable " + (ref[3])) + ",") + (ref[4])) + " added with value ") + value) + "."; }; protected method .add_parent_cmd() { arg cmdstr, cmd, args; var syn, obj, parent; (> .perms(caller(), $user) <); args = args.explode(); if ((listlen(args) > 2) && ((args[2]) == "to")) args = delete(args, 2); if (listlen(args) != 2) return ("Syntax: `" + cmd) + " <parent> [to] <object>`"; parent = (> .match_env_nice(args[1]) <); obj = (> .match_env_nice(args[2]) <); catch any { (> obj.add_parent(parent) <); return ((("Added parent to " + (obj.namef('ref))) + ", parents: ") + ((obj.parents()).to_english())) + "."; } with { return (traceback()[1])[2]; } }; protected method .del_parent_cmd() { arg cmdstr, cmd, args; var syn, obj, parent; (> .perms(caller(), $user) <); args = args.explode(); if ((listlen(args) > 2) && ((args[2]) == "from")) args = delete(args, 2); if (listlen(args) != 2) return ("Syntax: `" + cmd) + " <parent> [from] <object>`"; if (!args) .tell_error(syn); parent = (> .match_env_nice(args[1]) <); obj = (> .match_env_nice(args[2]) <); catch any { (> obj.del_parent(parent) <); return ((("Deleted parent from " + (obj.namef('ref))) + ", parents: ") + ((obj.parents()).to_english())) + "."; } with { return (traceback()[1])[2]; } }; protected method .trace_method_cmd() { arg cmdstr, cmd, ref; var method, current, trace, syn, minfo, line, anc, len, out, m; (> .perms(caller(), $user) <); if ((ref[1]) != 'method) return toliteral(cmd) + " requires a full method reference."; catch any { method = (> tosym(ref[4]) <); current = (> (ref[2]).find_method(method) <); trace = []; while (current) { trace += [current]; current = (| (ref[2]).find_next_method(method, current) |); } } with { if (error() == ~symbol) return ("Invalid method name \"" + (ref[4])) + "\"."; return (traceback()[1])[2]; } .tell(((("Method trace of " + (ref[2])) + ".") + (ref[4])) + "():"); len = .linelen(); out = []; for anc in (trace.reverse()) { m = anc.method_info(method); out += [strfmt("%5l %4r %l.%l(%l)", $object_lib.parse_method_flags(m[6]), m[4], anc, method, m[1])]; } return out; }; public method .evaluate() { arg str, obj, definer, [mode]; var start, end, time, ticks, mtime, times, method, errs, trace; mode = mode ? mode[1] : 0; if (sender() != $eval_parser) (> .perms(caller(), $programmer) <); method = tosym("tmp_eval_" + time()); if ((errs = (> definer.add_method([str], method) <))) return [[0, 0, 0], ['errors, errs, 0, 0]]; catch any { if (mode in ['trace, 'profile]) debug_callers(1); else if (mode == 'debug) debug_callers(2); times = [tick(), time(), mtime(), (> obj.(method)() <), mtime(), time(), tick()]; trace = call_trace(); debug_callers(0); } with { debug_callers(0); (| definer.del_method(method) |); rethrow(error()); } (| definer.del_method(method) |); // figure up the actual times time = (times[6]) - (times[2]); ticks = (times[7]) - (times[1]); if ((times[5]) > (times[3])) mtime = (times[5]) - (times[3]); else if (time) mtime = ((time * 1000000) + (1000000 - (times[3]))) + (times[5]); else mtime = (1000000 - (times[5])) + (times[3]); // offset it? if (eval_offset && (mode != 'no_offset)) { ticks -= eval_offset[1]; time -= eval_offset[2]; mtime -= eval_offset[3]; } if (trace) return [[ticks, time, abs(mtime)], ['result, times[4]], $code_lib.generate_debug_listing(trace, mode)]; return [[ticks, time, abs(mtime)], ['result, times[4]]]; }; protected method ._list_method() { arg obj, method, [args]; var code, opt, flags, f; [(args ?= 0), (opt ?= "")] = args; code = obj.list_method(method); flags = obj.method_flags(method); if (args) { code = code.numbered_text(); return ([(((((("-- " + (obj.method_access(method))) + " method ") + obj) + ".") + method) + "()") + (flags ? ": " + (flags.join(", ")) : "")] + code) + ["--"]; } else { return ([$object_lib.format_method_header(obj, method, opt, flags, obj.method_access(method))] + (code.prefix(" "))) + ["."]; } }; protected method ._display_variables() { arg obj, info, chop, f; var line, i, len, out, fmt; len = .linelen(); line = "Object Variables"; if (f) line += (" matching \"" + f) + "\""; out = [line]; for i in (info.reverse()) { line = strfmt(" %s,%s: %d", ((i[1]) != obj) ? i[1] : "", i[2], i[3]); if (chop) line = line.chop(len); out += [line]; refresh(); } return out; }; public method .parse_methodcmd_options() { arg syntax, args, [more]; var o, opt, opts, out, r, l; o = ([@more, []][1]) + [["pub?lic"], ["r?oot"], ["dr?iver"], ["pri?vate"], ["pro?tected"], ["no?override"], ["s?yncronized"], ["l?ocked"], ["na?tive"]]; opts = #[['exists, 0], ['ignore, 0], ['mflags, []], ['mstate, 'public], ['error, 0]].union([@more, #[], #[]][2]); args = $parse_lib.getopt(args, o); if (!(args[1])) { out = []; for opt in (o) out += [" +|-" + (opt[1])]; (> .tell_error(syntax, ["Valid options:"] + (out.lcolumnize())) <); } r = (| $parse_lib.ref((args[1]).join()) |); if (!r) { opts = opts.add('error, "Invalid <object>.<method> reference."); opts = opts.add('ignore, 1); } if (!((r[4]).valid_ident())) { opts = opts.add('error, (((r[2]) + ".") + tostr(r[4])) + "() is not a valid method reference."); opts = opts.add('ignore, 1); } r = replace(r, 4, tosym(r[4])); if ((r[2]) && (!((r[2]).is_writable_by(this())))) { opts = opts.add('error, ("You cannot program " + (r[2])) + "."); opts = opts.add('ignore, 1); } if ((| (r[2]).find_method(r[4]) |) == (r[2])) { opts = opts.add('mflags, (r[2]).method_flags(r[4])); opts = opts.add('mstate, (r[2]).method_access(r[4])); opts = opts.add('exists, 1); } opts = opts.add('object, r[2]); opts = opts.add('method, r[4]); for opt in (args[2]) { switch (opt[1]) { case "pub?lic", "r?oot", "dr?iver", "pri?vate", "pro?tected": opts = opts.add('mstate, (opt[1]).to_symbol()); case "no?override", "s?yncronized": opts = opts.add('mflags, (opts['mflags]).setadd((opt[1]).to_symbol())); case "l?ocked": .tell("You cannot set the locked flag on a method."); case "n?ative": .tell("You cannot set the native flag on a method."); default: if (!(opt[1])) { .tell(("Unknown option: \"" + (opt[2])) + "\""); .tell("Valid options: " + ((o.slice(1)).to_english())); continue; } opts = opts.add((opt[1]).to_symbol(), [opt[3], opt[4]]); } } return opts; }; protected method .chmanage_cmd() { arg cmdstr, cmd, args; var obj, manager; (> .perms(caller(), $user) <); args = (args.replace(" to ", " ")).explode(); if ((!args) || ((args.length()) != 2)) .tell_error(cmd + " <object> [to] <user>"); obj = .match_env_nice(args[1]); manager = .match_env_nice(args[2]); if ((!(manager.is($user))) && (!(.is($admin)))) return "Sorry you can only set users as managers."; catch any (> obj.change_manager(manager) <); with return (traceback()[1])[2]; return ((("Manager on " + (obj.namef('xref))) + " changed to ") + (manager.namef('xref))) + "."; }; protected method .managed_cmd() { arg cmdstr, cmd, args; var manager, managed, obj, out, len; (> .perms(caller(), $user) <); manager = (| .match_environment(args) |); if (!manager) { manager = (| $user_db.search(args) |); if (!manager) return ("Unable to find \"" + args) + "\"."; } managed = manager.managed(); if (!managed) return (manager.namef('ref)) + " does not manage any objects."; out = [(manager.namef('ref)) + " manages:"]; len = (.linelen()) / 2; for obj in (managed) { if (!valid(obj)) { .tell((" ** invalid object (" + obj) + ") **"); continue; } out += [((" " + ((obj.namef('xref)).pad(len))) + " ") + ($object_lib.see_perms(obj, ["", ""]))]; } return out; }; public method .clear_eval() { (| clear_var('eval_offset) |); }; protected method .create_cmd() { arg cmdstr, cmd, args; var new, parents, obj; (> .perms(caller(), $user) <); args = (args.replace(" from ", " ")).explode(); if ((!args) || ((args.length()) < 2)) .tell_error(cmd + " <object> [from] <parent>[, <parent> ...]"); new = args[1]; parents = []; for obj in (args.subrange(2)) parents += [.match_env_nice(obj)]; }; protected method .add_shortcut_cmd() { arg cmdstr, cmd, args; var ref, syn; (> .perms(caller(), $user) <); args = args.explode_quoted(); syn = cmd + " \"<shortcut>\" [to] \"<command>\" [on] \"<object>\""; if ((listlen(args) == 5) && (((args[2]) == "to") && ((args[4]) == "on"))) args = [args[1], args[3], args[5]]; if (listlen(args) != 3) return ("Syntax: `" + syn) + "`"; ref = (> $parse_lib.ref(args[3]) <); if (((ref[1]) != 'method) || ((!(ref[4])) || (!(| tosym(ref[4]) |)))) return ("Invalid method reference reference \"" + (args[3])) + "\"."; catch any (> (ref[2]).add_shortcut(args[1], args[2], tosym(ref[4])) <); with return (traceback()[1])[2]; return strfmt("Added shortcut %d to command %d on %s.%s().", args[1], args[2], ref[2], ref[4]); }; protected method .new_editor_session() { arg ref, opts, type; var def, code; switch (ref[1]) { case 'variable: (> .tell_error("", "Variable editor not yet implemented.") <); case 'method: def = (| (ref[2]).find_method(tosym(ref[4])) |); if (!def) { def = ref[3]; code = []; } else { code = def.list_method(tosym(ref[4])); } (> .invoke_editor(this(), '_edit_method_callback, code, [def, tosym(ref[4])]) <); default: return (> pass(ref, opts, type) <); } return [("Editor invoked with " + ((.active_editor()).session_name())) + ".", "Type 'help' to list available commands."]; }; protected method ._edit_method_callback() { arg code, client_data; var errors; errors = (client_data[1]).add_method(code, client_data[2]); if (errors) return errors; return "Method compiled."; }; public method .get_match_default() { arg name, definer, [args]; catch ~setting return (> .get_local_setting(name, definer, @args) <); with return "*"; }; public method .get_match_with() { arg name, definer, [args]; catch ~setting return (> .get_local_setting(name, definer, @args) <); with return 'match_pattern; }; protected method .rehash_cmd() { arg cmdstr, cmd; var c, o, p; (> .perms(caller(), $user) <); .tell("Rehashing your commands..."); .purge_caches(); for p in (parents()) p.cache_uninit(); for cmd in (.local_commands()) { for c in (cmd[2]) .add_to_local_cache(c[1]); } for p in (parents()) p.cache_init(); .tell("Done."); }; public method ._show_variables() { arg obj, f, match, chop; var parent, out, v, line, len; out = []; len = .linelen(); for parent in (obj.data()) { if (valid(parent[1])) { out += [(((parent[1]) + " variables matching \"") + f) + "\":"]; if ((parent[1]).has_flag('variables, this())) { for v in (parent[2]) { if (tostr(v[1]).(match)(f) == 0) continue; line = ((" " + (v[1])) + ": ") + toliteral(v[2]); if (chop) line = line.chop(len); out += [line]; } } else { out += [" ** Permission Denied **"]; } } else { out += [($object_lib.get_name(parent[1])) + " Variables:"]; for v in (parent[2]) { if (tostr(v[1]).(match)(f) == 0) continue; line = ((" " + (v[1])) + ": ") + toliteral(v[2]); if (chop) line = line.chop(len); out += [line]; } } refresh(); } return out; }; public method ._move_variable() { arg remove, fobj, fname, tobj, tname, comment; var value, line, result, tmp; value = (> fobj.eval([("return " + fname) + ";"]) <); if ((value[1]) != 'result) throw(~eval, "An error was encountered upon evaluation."); value = value[2]; (> tobj.add_var(tname, value) <); if (remove) (> fobj.del_var(fname) <); }; protected method .del_shortcut_cmd() { arg cmdstr, cmd, args; var ref, syn; (> .perms(caller(), $user) <); args = args.explode_quoted(); if ((listlen(args) == 3) && ((args[2]) == "from")) args = delete(args, 2); if (listlen(args) != 2) return ("Syntax: `" + cmd) + " \"<shortcut>\" [from] <objref>"; ref = (> $parse_lib.ref(args[2]) <); if (((ref[1]) != 'method) || ((!(ref[4])) || (!(| tosym(ref[4]) |)))) return ("Invalid method reference reference \"" + (args[3])) + "\"."; catch any (> (ref[2]).del_shortcut(args[1]) <); with return (traceback()[1])[2]; return strfmt("Deleted shortcut %d from %s.%s().", args[1], ref[2], ref[4]); }; protected method .grep_cmd() { arg cmdstr, cmd, args; var more, regexp, from, syn, opts, d, f, l, r, rep, slice, objs, obj, out; (> .perms(caller(), $user) <); [more, opts] = args; if ((more.length()) < 2) return ("=> Syntax: `" + cmd) + " [options] <regexp> <object> <object>.."; regexp = more[1]; more = more.subrange(2); // handle the options slice = opts.slice(1); if ((r = (| "r?eplace-with" in slice |))) { rep = (opts[r])[4]; r = (opts[r])[3]; } if ((d = (| "d?escend" in ((args[2]).slice(1)) |))) d = (opts[d])[3]; if ((l = (| "l?ist" in ((args[2]).slice(1)) |))) l = (opts[l])[3]; if ((f = (| "f?ull" in ((args[2]).slice(1)) |))) f = (opts[f])[3]; // now we check for conflicting or incorrect options.. if (d && (!(.is($admin)))) return "Only administrators may use the +descend option, talk to one."; if (d && ((more.length()) > 1)) return "+descend can only be used with a single object as the target."; if (r && (f || l)) return "+replace-with option cannot be used with +full or +list."; if (f && l) return "+full cannot be used with +list."; // the pause() flushes so we can see the 'Searching for ..' // Do this now because .descendants() can lag .tell(("Searching for \"" + regexp) + "\"..."); pause(); // figure out our targets if (d) { obj = (> .match_env_nice(more[1]) <); objs = [obj, @obj.descendants()]; } else { objs = []; for obj in (more) objs += [(> .match_env_nice(obj) <)]; } // call the right grep method if (r) return (> .grep_replace(regexp, objs, rep) <); else if (l) return (> .grep_list(regexp, objs) <); else if (f) return (> .grep_full(regexp, objs) <); else return (> .grep_brief(regexp, objs) <); }; protected method .grep_replace() { arg regexp, objs, replace; var obj, method; for obj in (objs) { if (!valid(obj)) continue; if (!(obj.is_writable_by(this()))) { .tell(("You cannot write on " + obj) + ", skipping.."); continue; } for method in (obj.methods()) { (> .grep_replace_method(obj, method, regexp, replace) <); refresh(); } refresh(); } return "Done."; }; protected method .grep_list() { arg regexp, objs; var obj, code, x, l, lr, what, loop, method, opt; opt = (| .setting("@program-options") |) || ""; for obj in (objs) { if (!valid(obj)) continue; if (!(obj.has_flag('code))) { .tell(("You cannot read method code on " + obj) + ", skipping.."); continue; } for method in (obj.methods()) { code = obj.list_method(method); for l in (code) { if (match_regexp(l, regexp)) { .tell(([$object_lib.format_method_header(obj, method, opt, obj.method_flags(method), obj.method_access(method))] + (code.prefix(" "))) + ["."]); break; } refresh(); } refresh(); } refresh(); } return "---"; }; protected method .grep_full() { arg regexp, objs; var obj, method, out, x, l, code; for obj in (objs) { if (!valid(obj)) continue; if (!(obj.has_flag('code))) { .tell(("You cannot read method code on " + obj) + ", skipping.."); continue; } out = []; for method in (obj.methods()) { code = obj.list_method(method); for x in [1 .. listlen(code)] { l = code[x]; if (match_regexp(l, regexp)) out += [(((((obj + ".") + method) + "() line ") + x) + ": ") + l]; refresh(); } refresh(); } if (out) .tell(out); refresh(); } return "---"; }; protected method .grep_brief() { arg regexp, objs; var obj, method, out, x, l, line, lines, code; for obj in (objs) { if (!valid(obj)) continue; if (!(obj.has_flag('code))) { .tell(("You cannot read method code on " + obj) + ", skipping.."); continue; } out = []; for method in (obj.methods()) { code = obj.list_method(method); lines = []; for x in [1 .. listlen(code)] { l = code[x]; if (match_regexp(l, regexp)) lines += [x]; refresh(); } if (lines) out += [(((obj + ".") + method) + "(): ") + (lines.to_english())]; refresh(); } if (out) .tell(out); refresh(); } return "---"; }; protected method .grep_replace_method() { arg obj, method, regexp, replace; var code, x, l, lr, errs, what; code = obj.list_method(method); for x in [1 .. listlen(code)] { l = code[x]; if (!match_regexp(l, regexp)) continue; lr = strsed(l, regexp, replace, "g"); .tell([((((("Change " + obj) + ".") + method) + "() line ") + x) + " from:", " " + l, "to:", " " + lr]); what = .prompt("? (yes, no, abort, abort-all) [yes] "); if ((!what) || (what in ["yes", "y"])) { code = replace(code, x, lr); } else if (what == "abort") { .tell("Aborting method .."); return; } else if (what == "abort-all") { throw(~stop, "Aborting grep replace"); } else if (!(what in ["no", "n"])) { .tell(("Unknown command '" + what) + "', assuming 'no'."); } refresh(); } if ((errs = obj.add_method(code, method))) .tell(((([((("Error in compilation of updated method " + obj) + ".") + method) + "():"] + (errs.prefix(" "))) + ["-- Method code: "]) + (code.prefix(" "))) + ["--"]); }; protected method .chmod_cmd() { arg cmdstr, cmd, args; var a, ts, t, opts, b, objs, o, precedence, ref, flags, match, m; (> .perms(caller(), $user) <); args = args.explode_quoted(); ts = ["cod?e", "cor?e", "d?river", "fe?rtile", "fo?rked", "fr?ob", "l?ocked", "m?ethods", "na?tive", "no?override", "pri?vate", "pro?tected", "pu?blic", "r?oot", "v?ariables"]; if (!args) return ("=> Syntax: `" + cmd) + " <options> <object> [<object ..]`"; opts = #[]; objs = []; for a in (args) { if (a && ((a[1]) in ["+", "-"])) { b = (a[1]) == "+"; a = substr(a, 2); match = 0; for t in (ts) { if (match_template(a, t)) { opts = dict_add(opts, tosym(t.strip()), b); match++; break; } } if (!match) { catch ~symbol opts = dict_add(opts, tosym(a), b); with .tell(("Invalid option '" + a) + "' (non-alphanumeric characters)"); } } else { objs += [a]; } } if (!objs) return [("=> Syntax: `" + cmd) + " <options> <object> [<object ..]`", "No objects specified."]; if (!opts) return [("=> Syntax: `" + cmd) + " <options> <object> [<object ..]`", "No options specified."]; // ok, now handle it, keep precedence for their own sake for o in (objs) { catch any { ref = (| $parse_lib.ref(o) |); } with { .tell((traceback()[1])[2]); continue; } if (!precedence) { precedence = ref[1]; } else if ((ref[1]) != precedence) { .tell(((("Item '" + o) + "' is not a ") + precedence) + " reference."); .tell("All references must be the same type."); continue; } o = ref[3]; for a in (dict_keys(opts)) { catch any { switch (a) { case 'driver, 'private, 'protected, 'public, 'root, 'frob: if (precedence != 'method) { .tell((("Option " + ((opts[a]) ? "+" : "-")) + a) + " is only applicable to methods."); continue; } m = (> tosym(ref[4]) <); (> o.set_method_access(m, a) <); .tell(((("Set " + ($parse_lib.buildref(@ref))) + " access to ") + a) + "."); case 'nooverride, 'locked, 'native, 'forked: if (precedence != 'method) { .tell((("Option " + ((opts[a]) ? "+" : "-")) + a) + " is only applicable to methods."); continue; } m = (> tosym(ref[4]) <); if (opts[a]) { o.set_method_flags(m, setadd(o.method_flags(m), a)); .tell((((("Added Method Flag +" + a) + " to ") + ($parse_lib.buildref(@ref))) + ", flags: ") + (((o.method_flags(m)).prefix("+")).join())); } else { o.set_method_flags(m, setremove(o.method_flags(m), a)); .tell((((("Removed Method Flag +" + a) + " from ") + ($parse_lib.buildref(@ref))) + ", flags: ") + (((o.method_flags(m)).prefix("+")).join())); } default: if (precedence != 'object) { .tell((("Option " + ((opts[a]) ? "+" : "-")) + a) + " is only applicable to objects."); continue; } if (opts[a]) { o.add_flag(a); .tell((((("Added Object Flag +" + a) + " to ") + (o.namef('ref))) + ", flags: ") + (((o.flags()).prefix("+")).join())); } else { o.del_flag(a); .tell((((("Removed Object Flag +" + a) + " from ") + (o.namef('ref))) + ", flags: ") + (((o.flags()).prefix("+")).join())); } } } with { .tell((traceback()[1])[2]); } } refresh(); } }; protected method .dump_fmt_textdump() { arg objs, meths, vars, header; var data, obj, out, a, v, m; // this uses .tell() to keep its internal overhead from bloating // it could be faster by building a list and printing it all at once // but this is nicer on the server (especially when dumping large objects). for obj in (objs) { refresh(); if (header) .tell([((("object " + obj) + ": ") + ((obj.parents()).join(", "))) + ";", ""]); if (vars) { catch ~perm { data = (> obj.data() <); for a in (dict_keys(data)) { refresh(); for v in (data[a]) .tell(strfmt("var %l %l = %d;", a, @v)); } } with { .tell((traceback()[1])[2]); } } .tell(""); if (meths) { catch ~perm { for m in ((> obj.methods() <)) { refresh(); .tell([""] + (.format_method(obj, m, 'textdump))); } } with { .tell((traceback()[1])[2]); } } } }; protected method .dump_fmt_commands() { arg objs, meths, vars, header; var data, obj, out, a, v, m, line, pars, cmdopts; // this uses .tell() to keep its internal overhead from bloating // it could be faster by building a list and printing it all at once // but this is nicer on the server (especially when dumping large objects). for obj in (objs) { refresh(); if (header) { pars = obj.parents(); line = (((((((";var p, new; if(!(| valid(" + obj) + ") |)) ") + "{ new = ") + (pars[1])) + ".spawn();") + " new.set_objname('") + (obj.objname())) + ");}"; if (listlen(pars) > 1) line += (" obj.chparents(" + join(pars, ",")) + ");"; .tell(line); } if (vars) { catch ~perm { data = (> obj.data() <); for a in (dict_keys(data)) { refresh(); for v in (data[a]) { if (a == obj) .tell(strfmt("@av %l,%l = %d", obj, @v)); .tell(strfmt(";as %l<%l>;%l = %d;", obj, a, @v)); } } } with { .tell((traceback()[1])[2]); } } if (meths) { cmdopts = (| .setting("@program-options") |) || ""; catch ~perm { for m in ((> obj.methods() <)) { refresh(); .tell(.format_method(obj, m, 'normal, cmdopts)); } } with { .tell((traceback()[1])[2]); } } } }; protected method .format_method() { arg obj, method, format, [opts]; var code, opt, flags, f; // this needs to be on $programmer ot get the programmers perms [(opt ?= "")] = opts; code = obj.list_method(method); flags = obj.method_flags(method); switch (format) { case 'textdump: return ([(((((((obj.method_access(method)) + " method ") + obj) + ".") + method) + "()") + (flags ? ": " + (flags.join(", ")) : "")) + " {"] + (code.prefix(" "))) + ["};"]; case 'numbered: code = code.numbered_text(); return ([(((((("-- " + (obj.method_access(method))) + " method ") + obj) + ".") + method) + "()") + (flags ? ": " + (flags.join(", ")) : "")] + code) + ["--"]; default: return ([$object_lib.format_method_header(obj, method, opt, flags, obj.method_access(method))] + (code.prefix(" "))) + ["."]; } }; protected method .help_write_cmd() { arg cmdstr, cmd, str; var node, text, errors; (> .perms(caller(), $user) <); if (!str) node = .current_node(); else node = .parse_help_reference(str); if (!(node.is($help_node))) return (node.namef('ref)) + " is not a descendant of $help_node."; if (!(node.is_writable_by(this()))) return ("You cannot write help on " + (node.name())) + "!"; text = .read(("-- Enter CML text for " + (node.namef('ref))) + " --"); if (text == 'aborted) return; node.set_body(text); return ("New help text set for " + (node.namef('ref))) + "."; }; protected method .help_list_cmd() { arg cmdstr, cmd, str; var node, out; (> .perms(caller(), $user) <); if (!str) node = .current_node(); else node = .parse_help_reference(str); if (!(node.is($help_node))) return (node.namef('ref)) + " is not a descendant of $help_node."; return (["@hwrite " + node] + ((node.body()).uncompile())) + ["."]; }; protected method .new_help_node_cmd() { arg cmdstr, cmd, args; var new, name, p, parent, i, syn, m, index; (> .perms(caller(), $user) <); syn = ("=> Syntax: `" + cmd) + " <parent node> [named] \"<name>\" [[index] <index>]`"; if ((m = match_template(args, "* named *"))) { p = m[1]; args = m[3]; if ((m = match_template(args, "* index *"))) { name = m[1]; i = m[3]; } else { args = args.explode_quoted(); name = args[1]; if ((args.length()) > 1) i = args[2]; } } else if ((m = match_template(args, "* index *"))) { args = (m[1]).explode_quoted(); if ((args.length()) != 2) return [syn, "! If names are more than one word, quote them."]; p = args[1]; name = args[2]; i = m[3]; } else { args = args.explode_quoted(); if (((args.length()) < 2) || ((args.length()) > 3)) return [syn, "! If names are more than one word, quote them."]; p = args[1]; name = args[2]; if ((args.length()) == 3) i = args[3]; } if (!name) return "You must specify a name for the new help node."; if (i) { if ((i[1]) in ["$", "#"]) index = (| $object_lib.to_dbref(i) |); else index = $help_index.match_children(i); if (!index) return [syn, ("! Unable to find index '" + i) + "'"]; if (!(index.has_ancestor($help_index))) return [syn, ("! '" + (index.namef('ref))) + "' is not a help index."]; } else { index = $help_index; .tell("Using index " + (index.namef('ref))); } if (p) { catch any parent = (> .parse_help_reference(p) <); with return (traceback()[1])[2]; } else { parent = .current_node(); } new = (> parent.spawn() <); catch any { if ("," in name) { name = explode(name, ",").mmap('trim); for i in (sublist(name, 2)) new.add_name_template(i); name = name[1]; } new.set_name(name); new.set_index(index); } with { (| new.destroy() |); .tell_traceback(traceback()); return (traceback()[1])[2]; } return ((((("Spawned node " + (new.namef('ref))) + " from ") + (parent.namef('ref))) + " in the ") + (index.name())) + " index."; }; public method .spawn_cmd() { arg cmdstr, cmd, args; var match, name, parents, p, line, set, nprog, new, t; (> .perms(caller(), $user) <); if ((match = match_template(args, "* named *"))) { name = match[3]; args = explode(match[1]); } else { args = args.explode_quoted(); if (!args) return "Spawn from nothing?"; name = ""; } // programmers get additional privs nprog = !(.is($programmer)); parents = []; for p in (args) { catch any { p = (> .match_env_nice(p) <); } with { .tell((traceback()[1])[2]); continue; } if ((!(p.is($thing))) && nprog) { .tell((p.namef('ref)) + " is not a VR object, you may only spawn VR objects."); continue; } if (!(p.has_flag('fertile))) { .tell((p.namef('ref)) + " is not a fertile object."); continue; } parents += [p]; } parents = parents.compress(); if (!parents) return "No capable parents."; if (name) { catch any name = (> $code_lib.parse_name(name) <); with return (traceback()[1])[2]; } // spawn from the first parent, add the others catch any { new = (> (parents[1]).spawn() <); (> new.chparents(@parents) <); // let the user know whats up .tell(((("Spawned new object " + (new.namef('ref))) + " from ") + (map p in (parents) to (p.namef('ref)).to_english())) + "."); if (new.is($located)) (> new.move_to(this()) <); if (name && ((((name[1])[1])[1]) == "$")) { name = (> tosym(((name[1])[1]).subrange(2)) <); (> new.set_objname(name) <); return ("Object name changed to: " + new) + "."; } else if (name) { if (!(new.has_ancestor($has_name))) return new + " cannot be given a VR name."; (> new.set_name(@name[1]) <); for t in (name[2]) (> new.add_name_template(t) <); return (((("Renamed " + new) + " to \"") + (new.name())) + "\"") + ((new.name_templates()) ? (" (" + ((new.name_templates()).to_english())) + ")" : ""); } } with { .tell((traceback()[1])[2]); if (valid(new)) { line = new.namef('xref); new.destroy(); if (valid(new)) return ("Unable to destroy new object " + line) + "."; else return ("Sucessfully destroyed new object " + line) + "."; } } }; new object $admin: $programmer; var $root inited = 1; var $root owned = [$admin]; var $root manager = $admin; var $root quota = 75000; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'core, 'command_cache, 'variables]; var $root managed = [$admin]; var $location contents = []; var $located location = $body_cave; var $located obvious = 1; var $user password = "*"; var $user connected_at = 0; var $user last_command_at = 0; var $user connections = []; var $user modes = #[]; var $user formatter = $mail_list; var $user parsers = [$command_parser]; var $has_messages message_info = #[["mojo-on", #[]], ["mojo-off", #[]], ["mojo-look", #[]]]; var $user context = #[]; var $has_messages messages = #[[$admin, #[["mojo-on.general", <$ctext_frob, [[<$generator, ["actor", [], [], 'gen_actor]>, "'s eyes glow as Mojo courses through ", <$generator, ["actor.pp", [], [], 'gen_actorpp]>, " body."], #[['this, $admin]]]>], ["mojo-off.general", <$ctext_frob, [[<$generator, ["actor", [], [], 'gen_actor]>, "'s eyes stop glowing as the Mojo leaves ", <$generator, ["actor.pp", [], [], 'gen_actorpp]>, " body."], #[['this, $admin]]]>], ["mojo-look.general", <$ctext_frob, [[<$generator, ["actor", [], [], 'gen_actor]>, "'s eyes ", <$generator, ["mojo.what", [], [], 'gen_mojowhat]>, "glow from Mojo."], #[['this, $admin]]]>], ["mojo-on.actor", <$ctext_frob, [["Your eyes glow as Mojo courses through your body."], #[['this, $admin]]]>], ["mojo-off.actor", <$ctext_frob, [["Your eyes stop glowing as the Mojo leaves your body."], #[['this, $admin]]]>], ["mojo-look.actor", <$ctext_frob, [["Your eyes are ", <$generator, ["mojo.what", [], [], 'gen_mojowhat]>, "glow from mojo."], #[['this, $admin]]]>]]]]; var $user task_connections = #[]; var $programmer eval_prefix = #[["me", "me = this()"], ["here", "here = this().location()"]]; var $admin shutdown_started = 0; var $command_aliases command_aliases = []; var $mail_list letters = #[]; var $mail_list letters_index = #[]; var $mail_list senders = 1; var $mail_list readers = []; var $mail_list notify = [$admin]; var $mail_list last_letter = 0; var $mail_list mail = []; var $mail_ui subscribed = #[[$admin, [791485891, 0]]]; var $mail_ui current = #[['location, 0], ['list, $admin]]; var $has_gender gender = $gender_neuter; var $described prose = []; var $has_name name = ['prop, "Generic Admin", "Generic Admin"]; var $has_commands local = #[["@del-t?ask|@kill", [["@del-t?ask|@kill", "*", "@del-t?ask|@kill <any>", 'del_task_cmd, #[[1, ['any, []]]]]]], ["@backup", [["@backup", "", "@backup", 'backup_cmd, #[]]]], ["@shutdown", [["@shutdown", "*", "@shutdown <any>", 'shutdown_cmd, #[[1, ['any, []]]]]]], ["@mojo", [["@mojo", "*", "@mojo <any>", 'mojo_cmd, #[[1, ['any, []]]]]]], ["@adjust|@promote", [["@adjust|@promote", "* to *", "@adjust|@promote <user> to <any>", 'adjust_cmd, #[[1, ['user, []]], [3, ['any, []]]]]]], ["@new-password|@newpw?d", [["@new-password|@newpw?d", "*", "@new-password|@newpw?d <user>", 'new_password_cmd, #[[1, ['user, []]]]]]], ["@task?s", [["@task?s", "*", "@task?s <any>", 'tasks_cmd, #[[1, ['any, []]]]]]], ["@core", [["@core", "*", "@core <list object>", 'core_cmd, #[[1, ['list, ['object, []]]]]]]], ["@reap", [["@reap", "*", "@reap <any>", 'reap_users_cmd, #[[1, ['any, []]]]]]], ["@rehash-all", [["@rehash-all", "*", "@rehash-all <any:-p?urge>", 'rehash_all_cmd, #[[1, ['any_opt, [["p?urge"]]]]]]]]]; var $channel_ui channel_dict = #[]; var $channel_ui active_channels = #[]; root method .init_admin() { $sys.new_admin(); }; protected method .del_task_cmd() { arg cmdstr, com, args; var syn, sys, task, t; (> .perms(caller(), $user) <); (> .check_mojo() <); syn = ("Syntax: `" + com) + " [*]<task>`"; args = explode(args); if (!args) return syn; for t in (args) { if (t && ((t[1]) == "*")) { t = substr(t, 2); sys = 1; } task = toint(t); if (!task) { .tell(syn, ("Invalid task '" + t) + "'"); continue; } if (sys) { $scheduler.cancel(task); .tell(("System task " + tostr(task)) + " canceled."); } else { catch any $scheduler.del_task(task); with (> .tell_error(syn, (traceback()[1])[2]) <); .tell(("Task " + tostr(task)) + " deleted."); } } }; protected method .tasks_cmd() { arg cmdstr, cmd, args; var out, task, queue, time, args, fmt, tfmt, info, suspend, preempt, line, x; (> .perms(caller(), $user) <); (> .check_mojo() <); out = []; if (args) { for x in (explode(args)) { if ((x[1]) == "*") x = substr(x, 2); if (!(task = (| $scheduler.task_info(toint(x)) |))) { .tell(("Invalid task '" + x) + "'"); continue; } out = ["Task: " + ((task[1])[1]), "", strfmt(" %8l %15L %s", "TICKS", "USER", "METHOD")]; // add an option to not restrict this for info in (sublist(task, 3)) out += [strfmt(" %8l %15L %s.%s()", info[7], info[4], info[1], info[8])]; } return out; } queue = $scheduler.task_queue(); if (queue) { tfmt = "%d %h %y %H:%M:%S"; fmt = "%5L %20L %s"; time = $time.format(tfmt); out = [strfmt(fmt, "ID", "EXEC TIME", "TASK"), strfmt(fmt, "---", "---------", "----")]; fmt += ".%s(%s)"; for task in (queue) { args = toliteral(task[8]); out += [strfmt(fmt, task[1], $time.format(tfmt, task[2]), task[4], task[6], substr(args, 2, strlen(args) - 2))]; } if (out) out = ["-- Database Tasks --"] + out; } if ((queue = tasks())) { suspend = []; preempt = []; fmt = "%8l%8l%24L"; for task in (queue) { info = $scheduler.task_info(task); line = strfmt(fmt, (info[1])[1], (info[3])[7], ((((info[3])[1]) + ".") + ((info[3])[8])) + "()", (info[3])[4]); task = ($scheduler.suspended_task(task)).join(); if (strlen(task) > 38) task = substr(task, 1, 35) + "..."; if (info[2]) preempt += [line + task]; else suspend += [line + task]; } tfmt = strfmt(fmt, "TASK", "TICKS", "METHOD") + "RESUMABLE BY"; if (preempt) out += ["-- Preempted Tasks --", tfmt] + preempt; if (suspend) out += ["-- Suspended Tasks --", tfmt] + suspend; } return out || "-- No suspended or preempted tasks --"; }; protected method .backup_cmd() { arg cmdstr, com; (> .perms(caller(), $user) <); (> .check_mojo() <); .tell("Starting backup."); $sys.do_backup(this()); .tell("Done."); }; protected method .shutdown_cmd() { arg cmdstr, com, [args]; var time, opt, why, answer, ans; (> .perms(caller(), $user) <); (> .check_mojo() <); args = $parse_lib.getopt(args.join(), [["t?ime", 1]]); opt = "t?ime" in ((args[2]).slice(1)); if (opt && ((((args[2])[opt])[4]).is_numeric())) time = toint(((args[2])[opt])[4]); else time = 5; if (!(why = (args[1]).join())) why = "Administrator's whim."; .tell(("Server shutdown in " + tostr(time)) + " minutes"); .tell("Reason for shutdown: " + why); ans = .prompt("Is this correct? [yes]: "); if (!ans) ans = "yes"; if (!(ans in ["yes", "y"])) { .tell("I didn't think so, aborting shutdown..."); return; } .tell("Ok!"); $sys.do_shutdown(time, why); }; protected method .adjust_cmd() { arg cmdstr, cmd, who, prep, str; var i, what, p, pwd, o, email, valid; (> .perms(caller(), $user) <); (> .check_mojo() <); valid = #[["user", $user], ["builder", $builder], ["programmer", $programmer], ["admin", $admin]]; what = (str.explode()).last(); if (!(valid.contains(what))) return ("Promote to: " + ((valid.keys()).to_english())) + "."; // mail them the password--do this first incase we fail here if ($guest in (who.parents())) { who.set_title(""); pwd = $code_lib.random_word(); who.set_password(pwd); email = who.user_info("email"); if (!email) return (who.namef('ref)) + " does not have an email address!"; catch any { $smtp.sendmail(email, ("[" + ($motd.server_name())) + "] password change.", ((("The password for the user " + (who.name())) + " on ") + ($motd.server_name())) + " has been set as:", "", " " + pwd, "", "This is an automatic message sent to the supplied address. If this message is in error simply discard it.", "", "If no connections are made to this user within a week it will be purged."); } with { .tell_traceback(traceback()); return "** Unable to send mail message, no changes made **"; } } // selectively cleanup their 'new' parents list, retain special parents p = who.parents(); for o in ([$guest] + (valid.values())) p = setremove(p, o); // add the parent we care about to the front, call chparents() // we are admins, we can handle tracebacks if they occur. (> who.chparents(valid[what], @p) <); // update caches. for o in (parents()) o.cache_init(); who.rehash_caches(); // let'em know what we did what = what.add_indefinite(); who.tell((((.name()) + " has made you ") + what) + "."); // if we changed their password, let them know that too if (pwd) { who.tell(("** Your password has been emailed to " + email) + " **"); who.tell("** You can change it with the command: `@password` **"); } (.location()).announce(((("*poof* " + (who.name())) + " is now ") + what) + ".", who, this()); return ((("Ok, " + (who.name())) + " is now ") + what) + "."; }; protected method .grep_cmd() { arg [args]; (> .perms(caller(), $user) <); (> .check_mojo('benice) <); return (> pass(@args) <); }; protected method .mojo() { arg [args]; var name; if (args) name = "Your "; else name = (.name()) + "'s "; if (this() in ($sys.system())) return name + "eyes glow from Mojo."; else return name + "eyes do not glow from Mojo."; }; protected method .mojo_cmd() { arg cmdstr, cmd, str; var syn, line, vars; (> .perms(caller(), $user, $admin) <); syn = cmd + " on|off"; if ((!str) || (!(str in ["on", "up", "off", "down"]))) return .mojo(1); // this is horribly non-configurable--we need a standard set of subs. vars = #[["$actor", this()], ["actor", .name()], ["actor.pp", (.gender()).pronoun('pp)]]; switch (str) { case "on", "up": $sys.add_to_system(this()); (.location()).announce(.eval_message("mojo-on", vars, $admin)); case "off", "down": $sys.del_from_system(this()); (.location()).announce(.eval_message("mojo-off", vars, $admin)); } }; public method .description() { arg flags; var vars, m; vars = #[["$actor", this()], ["actor", .name()], ["mojo.what", ""]]; if (!(this() in ($sys.system()))) vars = vars.add("mojo.what", "do not "); m = .eval_message("mojo-look", vars, $admin); return (> pass(flags) <) + [m]; }; public method .logout() { arg [args]; (| $sys.del_from_system(this()) |); return (> pass(@args) <); }; protected method .check_mojo() { arg [benice]; var answer, wording; if (benice) wording = " may require "; else wording = " requires "; if (!(this() in ($sys.system()))) { answer = .prompt(("This command" + wording) + "Mojo, turn it on? [yes] "); if (answer in ["no", "n"]) { .tell("Ok, aborting."); if (benice) return; throw(~stop, ""); } .mojo_cmd("", "", "on"); } }; protected method .rehash_all_cmd() { arg cmdstr, cmd, args; var purge, c, p, o, d, objs, initted, user_interfaces, other; (> .perms(caller(), $user) <); (> .check_mojo() <); purge = (o = "p?urge" in ((args[2]).slice(1))) && (((args[2])[o])[3]); if (purge) { .tell("Building descendants list.."); pause(); pause(); user_interfaces = $user_interfaces.descendants(); other = (((($command_cache.children()).setremove($user_interfaces)).mmap('descendants)).flatten()).compress(); pause(); pause(); // go atomic, we do not want confused users trying to run commands that // do not exist... $sys.atomic(1); for o in (other + user_interfaces) { if (o.is_command_cache()) .tell("Purging " + (o.namef('ref))); (| o.purge_caches() |); refresh(); } // get back 'other' caches--nobody said this was going to be fast. for o in (other) { o.rehash_caches(); refresh(); } } // user caches initted = #[]; for o in ((| $user_db.connected() |) || [this()]) { for p in ((| o.parents() |) || []) { if (!(initted.contains(p))) { .tell("Initializing " + (p.namef('ref))); catch any { (> p.rehash_caches() <); } with { .tell(("--- traceback from " + p) + ".cache_init():"); .tell_traceback(traceback()); .tell("---"); } initted = initted.add(p, 1); } } refresh(); } // ok, good... $sys.atomic(0); return "Done..."; }; protected method .finger_cmd() { arg cmdstr, cmd, who; var out, tmp; out = (> pass(cmdstr, cmd, who) <); if (!($sys.is_system(this()))) return out; if (who.connected()) { out += [" Connections:"]; for tmp in (who.connections()) out += [((((" " + tmp) + ": [") + ($time.format("%v/%T", tmp.active_since()))) + "] ") + (tmp.address())]; } tmp = who.quota_byte_usage(); return (out += [" Quota:", " Total: " + ((who.quota()).to_english()), " Used: " + (tmp.to_english()), " Remaining: " + (((who.quota()) - tmp).to_english())]); }; protected method .new_password_cmd(): nooverride { arg cmdstr, cmd, user; var new, email; (> .perms(caller(), $user) <); (> .check_mojo() <); email = user.user_info("email"); if (!email) return (user.namef('ref)) + " does not have an email address!"; new = $code_lib.random_word(); catch any { $smtp.sendmail(email, ("[" + ($motd.server_name())) + "] password change.", ((("The password for the user " + (user.name())) + " on ") + ($motd.server_name())) + " has been changed to:", "", " " + new, "", "This is an automatic message sent to the supplied address. If this message is in error simply discard it."); } with { .tell_traceback(traceback()); return "** Unable to send mail message, password not changed **"; } user.set_password(new); user.tell([((("Your password has been reset by " + (.name())) + ". The new password has been emailed to ") + email) + "."]); .tell((("You reset " + (user.name())) + "'s password to: ") + new); }; protected method .core_cmd() { arg cmdstr, cmd, objs; var o, obj; (> .perms(caller(), $user) <); (> .check_mojo() <); for obj in (objs) { obj.add_flag('core); obj.change_manager(obj); for o in (obj.writers('literal)) obj.del_writer(o); refresh(); .tell(("Made " + (obj.namef('core))) + " a core object."); } }; protected method .reap_users_cmd() { arg cmdstr, cmd, args; var u, thresh, t, reap, m, last, tl, v; (> .perms(caller(), $user) <); // figure threshold if (args) { catch any thresh = $time.from_english(args); with return "You must specify the time."; } else { thresh = (86400 * 30) * 3; } t = time(); reap = []; .tell([("--- Reap Possibilities starting " + ($time.to_english(thresh))) + " ago", strfmt("%28L %4l %4l %12l %l", "User", "MNGD", "WRTS", "Last On", "Age"), strfmt("%28L %4l %4l %12l %l", "----", "----", "----", "-------", "---")]); for u in ($user.descendants()) { if ((u.connected()) || ((u.has_flag('core)) || (u.is($admin)))) continue; tl = (last = abs(u.connected_at())); if ((tl + thresh) > t) continue; m = ""; tl = t - tl; if (tl / 31449600) { v = tl / 31449600; m = (v + " year") + ((v > 1) ? "s" : ""); tl = tl % 31449600; } if (tl / 2592000) { v = tl / 2592000; m += (((m ? " " : "") + v) + " month") + ((v > 1) ? "s" : ""); tl = tl % 2592000; } if (tl / 604800) { v = tl / 604800; m += (((m ? " " : "") + v) + " week") + ((v > 1) ? "s" : ""); } if (!m) m = "newborn"; reap += [[last, strfmt("%28L %4l %4l %12l %l", u.namef('xref), listlen(u.managed()), listlen(u.writes()), $time.format("%v", last), m)]]; } .tell(((reap.sort()).slice(2)).reverse()); return "---"; }; public method .uninit_admin() { $sys.old_admin(); }; new object $robot: $body; var $root child_index = 3; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'variables, 'core, 'fertile, 'command_cache]; var $has_name name = ['uniq, "Robot", "the Robot"]; var $has_gender gender = $gender_neuter; var $described prose = <$ctext_frob, [["A generic automated robot object."], #[['this, $robot]]]>; var $located location = $lost_and_found; var $located obvious = 1; var $body body_parts = #[]; var $location contents = []; var $root manager = $robot; var $root managed = [$robot]; var $root owned = [$robot]; var $robot last_id = 0; var $robot reactions = 0; var $robot active = 0; var $robot match_types = #[["regexp", ['regexp, "rex"]], ["pattern", ['match_pattern, "pat"]], ["template", ['match_template, "tmp"]]]; var $has_commands remote = #[["@reactions", [["@reactions", "*", "@reactions <this>", 'reactions_cmd, #[[1, ['this, []]]]]]]]; var $robot active_ids = 0; public method .parse_line() { arg line; var parse; (> .perms(sender()) <); catch any { parse = $command_parser.parse(this(), line, $null_parser); (> .handle_parser_result(@parse) <); } with { if (error() == ~stop) { if ((traceback()[1])[2]) .tell((traceback()[1])[2]); } else if ((.manager()) != this()) { (.manager()).tell_traceback(traceback(), line, 0, error()); } } }; public method .react_command() { arg str, match, sender, cmd; .parse_line(cmd); }; public method .react_subcmd() { arg str, match, sender, cmd; var m; cmd = strsub(cmd, "%P", sender.name()); for m in [1 .. listlen(match)] cmd = strsub(cmd, "%" + m, match[m]); .parse_line(cmd); }; public method .tell() { arg what, [who]; var line; if (!(.active())) return; switch (type(what)) { case 'list: for line in (what) .tell(line, @who); case 'string: // drop through, this is what we want default: return; } if (who && (sender().is($place))) who = who[1]; else who = sender(); if (who == this()) return; .check_reactions('tell, what, who); }; public method .event_notify() { arg event, origin, [args]; if (caller() != $event_handler) throw(~perm, caller() + " is not $event_handler."); if (!(.active())) return; if (event == 'social) .check_reactions(args[2], args[3], args[1]); }; public method .startup() { .hook_events('startup); }; protected method .check_reactions() { arg type, str, sender; var rnum, t, id, chance, times, method, template, m, types; rnum = random(100); if (type == 'tell) types = ['tell, 'any]; else types = [type, 'notell, 'any]; for t in (types) { if (!dict_contains(active, t)) continue; for id in (dict_keys(active[t])) { [chance, times] = (active[t])[id]; if (rnum > chance) break; [method, template] = reactions[id]; if ((!template) || (m = str.(method)(template))) { if (times == 1) .remove_active(t, id); else if (times > 1) .update_active(t, id, [chance, --times]); if ((.do_reaction(str, m, id, sender)) != 'continue) return; } } } }; public method .active() { return active; }; protected method .update_active() { arg key, id, value; active = dict_add(active, key, dict_add(active[key], id, value)); }; protected method .remove_active() { arg key, id; active = dict_add(active, key, dict_del(active[key], id)); if (!(active[key])) active = dict_del(active, key); if (!active) clear_var('active); }; public method .activate_reaction() { arg id; var ra, key, e, inserted, chance, times; if ((!reactions) || (!dict_contains(reactions, id))) throw(~noreaction, ("No reaction with id '" + id) + "'."); if (!active) active = #[]; [key, chance, times] = sublist(reactions[id], 3, 3); if (dict_contains(active, key)) { ra = active[key]; if (ra.contains(id)) return .update_active(key, id, [chance, times]); active = dict_del(active, key); ra = map e in (ra) to (e); } else { ra = []; } for e in [1 .. listlen(ra)] { if ((((ra[e])[2])[1]) < chance) { ra = insert(ra, e, [id, [chance, times]]); inserted++; } } if (!inserted) ra += [[id, [chance, times]]]; active = dict_add(active, key, hash e in (ra) to (e)); active_ids = dict_add(active_ids || #[], id, key); }; protected method .do_reaction(): forked { arg str, match, id, sender; var method, args, min, max, time, range; [[method, args], min, max] = sublist(reactions[id], 6); range = max - min; if (range < 2) time = 1; else time = random(range) + min; $scheduler.sleep(time); catch any return (> .(method)(str, match, sender, @args) <); with .tell_traceback(traceback()); return 'stop; }; public method .tell_traceback() { arg [args]; }; public method .add_reaction() { arg [args]; var r, id; // make sure it doesn't already exist.. for r in (reactions || #[]) { if (((r[2])[2]) == (args[2])) { if ((r[2]) == args) return r[1]; } } (> .check_reaction_args(@args) <); reactions = dict_add(reactions || #[], ++last_id, args); }; private method .check_reaction_args() { arg method, template, type, chance, times, hook, min, max; (> .check_reaction_matchwith(method) <); (> .check_reaction_template(template) <); (> .check_reaction_type(type) <); (> .check_reaction_chance(chance) <); (> .check_reaction_times(times) <); (> .check_reaction_hook(hook) <); (> .check_reaction_hook_method(hook[1]) <); (> .check_reaction_hook_args(hook[2]) <); (> .check_reaction_min(min) <); (> .check_reaction_max(max) <); }; public method .del_reaction() { arg id; var key; (> .perms(sender()) <); if (!dict_contains(reactions, id)) return; key = (reactions[id])[3]; (| .remove_active(key, id) |); reactions = reactions.del(id); }; public method .reactions() { return reactions; }; public method .match_type() { arg type; type = strsed(tostr(type), "match_", ""); if (!dict_contains(match_types, type)) throw(~type, "Invalid type matcher: " + type); return (| match_types[type] |); }; public method .reactions_cmd() { arg cmdstr, cmd, this; var id, m, tmpl, type, chance, times, method, args, max, min, out, t, a; // [id, [match, template, type, chance, times, [method, args], max, min]] out = []; for id in (dict_keys(reactions || #[])) { [m, tmpl, type, chance, times, [method, args], min, max] = reactions[id]; t = $robot.match_type(m); a = dict_contains(active_ids, id); out += [strfmt("%l%3r %3r %4r %6l %8c %22l %l %l", a ? "*" : " ", id, chance, (times == (-1)) ? "inf" : times, type, (min == max) ? min : ((min + "~") + max), method, t[2], tmpl ? ("\"" + tmpl) + "\"" : "anything")]; } if (out) return (["-- Defined Reactions:", " ID %CH # TYPE DELAY HOOK MT TEMPLATE"] + out) + ["--"]; return "-- No Reactions Defined --"; }; private method .check_reaction_hook() { arg hook; if (type(hook) != 'list) throw(~type, "Reaction hook is not a list."); if (listlen(hook) != 2) throw(~type, "Reaction hook is not a two element list."); }; private method .check_reaction_hook_method() { arg method; if (type(method) != 'symbol) throw(~type, "Reaction hook method is not a symbol."); }; private method .check_reaction_hook_args() { arg args; if (type(args) != 'list) throw(~type, "Reaction hook arguments is not a list."); }; private method .check_reaction_min() { arg min; if (type(min) != 'integer) throw(~type, "Reaction minimum delay is not a integer."); }; private method .check_reaction_max() { arg max; if (type(max) != 'integer) throw(~type, "Reaction maximum delay is not a integer."); }; private method .check_reaction_matchwith() { arg method; if (type(method) != 'symbol) throw(~type, "Match type is not a symbol."); }; private method .check_reaction_template() { arg template; if (type(template) != 'string) throw(~type, "Match template is not a string."); }; private method .check_reaction_type() { arg type; if (type(type) != 'symbol) throw(~type, "Reaction type is not a symbol."); }; private method .check_reaction_chance() { arg chance; if (type(chance) != 'integer) throw(~type, "Reaction chance is not a integer."); }; private method .check_reaction_times() { arg times; if (type(times) != 'integer) throw(~type, "Reaction times is not a integer."); }; public method .update_reaction() { arg id, part, value; var r, chance, times, active; (> .perms(sender()) <); if (!(reactions.contains(id))) throw(~noreaction, ("No reaction with id \"" + id) + "\"."); r = reactions[id]; if ((active = dict_contains(active_ids, id))) .deactivate_reaction(id); switch (part) { case 'matchwith: (> .check_reaction_matchwith(value) <); r = replace(r, 1, value); case 'template: (> .check_reaction_template(value) <); r = replace(r, 2, value); case 'type: (> .check_reaction_type(value) <); r = replace(r, 3, value); case 'chance: (> .check_reaction_chance(value) <); r = replace(r, 4, value); case 'times: (> .check_reaction_times(value) <); r = replace(r, 5, value); case 'method, 'hook_method: (> .check_reaction_hook_method(value) <); r = replace(r, 6, replace(r[6], 1, value)); case 'args, 'hook_args: (> .check_reaction_hook_args(value) <); r = replace(r, 6, replace(r[6], 2, value)); case 'min, 'min_delay: (> .check_reaction_min(value) <); r = replace(r, 7, value); case 'max, 'max_delay: (> .check_reaction_max(value) <); r = replace(r, 8, value); default: throw(~invpart, ("Invalid part '" + part) + "."); } reactions = reactions.add(id, r); if (active) .activate_reaction(id); }; public method .deactivate_reaction() { arg id; if (active_ids && dict_contains(active_ids, id)) { .remove_active(active_ids[id], id); active_ids = dict_del(active_ids, id); if (!active_ids) clear_var('active_ids); } }; new object $on_location: $located_location; var $root manager = $on_location; var $root created_on = 809991549; var $root inited = 1; var $root flags = ['methods, 'code, 'variables, 'core]; var $has_commands shortcuts = #[]; var $has_commands remote = #[]; var $has_commands local = #[]; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "note", "note"]; var $has_gender gender = $gender_neuter; var $described prose = []; var $location contents = []; var $located location = $trash; var $located obvious = 1; var $root managed = [$on_location]; var $root owned = [$on_location]; var $command_cache shortcut_cache = []; var $command_cache remote_cache = #[["@lock", [["@lock"], #[[$thing, 1]]]], ["@unlock", [["@unlock"], #[[$thing, 1]]]], ["@boot", [["@boot"], #[[$thing, 1]]]]]; public method .description() { arg flags; var line; line = ((("You see " + ((.contents()).map_to_english('namef))) + " on ") + (.name())) + "."; return (> pass(flags) <) + [line]; }; new object $in_location: $located_location; var $root manager = $in_location; var $root created_on = 809991552; var $root inited = 1; var $root flags = ['methods, 'code, 'variables, 'core]; var $has_commands shortcuts = #[]; var $has_commands remote = #[]; var $has_commands local = #[]; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "note", "note"]; var $has_gender gender = $gender_neuter; var $described prose = []; var $location contents = []; var $located location = $trash; var $located obvious = 1; var $root managed = [$in_location]; var $root owned = [$in_location]; var $command_cache shortcut_cache = []; var $command_cache remote_cache = #[["@lock", [["@lock"], #[[$thing, 1]]]], ["@unlock", [["@unlock"], #[[$thing, 1]]]], ["@boot", [["@boot"], #[[$thing, 1]]]]]; public method .description() { arg flags; var line; line = ((("You see " + ((.contents()).map_to_english('namef))) + " in ") + (.name())) + "."; return (> pass(flags) <) + [line]; }; new object $lost_and_found: $in_location; var $root manager = $lost_and_found; var $root created_on = 806811775; var $root inited = 1; var $root flags = ['methods, 'code, 'variables, 'core]; var $has_commands shortcuts = #[]; var $has_commands remote = #[]; var $has_commands local = #[]; var $command_cache remote_cache = #[["@lock", [["@lock"], #[[$thing, 6]]]], ["@unlock", [["@unlock"], #[[$thing, 6]]]], ["@boot", [["@boot"], #[[$thing, 6]]]], ["wear", [["wear"], #[[$wearable_frob, 1]]]], ["remove", [["remove"], #[[$wearable_frob, 1]]]], ["erase", [["erase"], #[[$note, 1]]]], ["read", [["read|nread"], #[[$note, 1]]]], ["nread", [["read|nread"], #[[$note, 1]]]], ["write", [["write"], #[[$note, 1]]]], ["copy", [["copy"], #[[$note, 1]]]]]; var $command_cache shortcut_cache = []; var $has_name name = ['prop, "Lost and Found box", "Lost and Found box"]; var $has_gender gender = $gender_neuter; var $described prose = []; var $location contents = [$robot, $located, $nothing, $wearable_frob, $map_of_taobh_thiar]; var $located location = $void; var $located obvious = 1; var $thing lock = <$object_lock_frob, [$void]>; var $root managed = [$lost_and_found]; var $root owned = [$lost_and_found]; new object $trash: $located_location; var $root manager = $trash; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 830126811; var $has_commands shortcuts = #[]; var $has_commands remote = #[]; var $has_commands local = #[]; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['uniq, "System Trash Can", "the System Trash Can"]; var $has_gender gender = $gender_neuter; var $described prose = <$ctext_frob, [["When you discard something, it goes here if you do not manage it."], #[['this, $lag_watcher]]]>; var $location contents = [$on_location, $in_location]; var $located location = $void; var $located obvious = 1; var $root inited = 1; var $command_cache shortcut_cache = []; var $trash items = #[[#517, 834256605], [#502, 846963197], [$on_location, 850861287], [$in_location, 850861289], [$help_theme, 850861375], [#1307, 851121593]]; var $root managed = [$trash]; var $root owned = [$trash]; var $command_cache remote_cache = #[["@lock", [["@lock"], #[[$thing, 7]]]], ["@unlock", [["@unlock"], #[[$thing, 7]]]], ["@boot", [["@boot"], #[[$thing, 7]]]]]; public method .did_leave() { arg place; (> pass(place) <); (| (items = items.del(sender())) |); }; public method .did_arrive() { arg place; var msg; (> pass(place) <); (| (items = items.add(sender(), time())) |); }; new object $place: $location; var $root child_index = 308; var $root fertile = 1; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'fertile, 'variables, 'core]; var $has_messages messages = #[[$place, #[["housekeeper", <$ctext_frob, [["The housekeeper hauls ", <$generator, ["actor", [], [], 'gen_actor]>, " away."], #[['this, $lag_watcher]]]>], ["connect", <$ctext_frob, [[<$generator, ["actor", [], [], 'gen_actor]>, " wakes up."], #[['this, $place]]]>], ["disconnect", <$ctext_frob, [[<$generator, ["actor", [], [], 'gen_actor]>, " falls asleep."], #[['this, $place]]]>]]]]; var $has_messages message_info = #[["housekeeper", #[]], ["connect", #[]], ["disconnect", #[]]]; var $has_gender gender = $gender_neuter; var $described prose = []; var $has_name name = ['uniq, "place", "the place"]; var $place realm = <$realm_of_creation, #[['location, 'interior]]>; var $place exits = []; var $place darkness = 0; var $location contents = []; var $place entrances = 0; var $command_cache shortcut_cache = []; var $has_settings defined_settings = #[["public-home", #[['get, 'get_local_setting], ['set, 'set_local_setting], ['check, 'is_boolean], ['del, 'delete_local_setting], ['check_args, []], ['get_args, []], ['set_args, []], ['display, 'display_boolean_yes_no]]], ["realm", #[['get, 'realm], ['set, 'set_setting_realm], ['check, 'check_realm], ['del, 'del_realm], ['check_args, []], ['get_args, []], ['set_args, []], ['display, 'display_setting_realm]]], ["darkness", #[['get, 'darkness], ['set, 'set_darkness], ['check, 'is_type], ['del, 'delete_local_setting], ['check_args, ['integer]], ['get_args, []], ['set_args, []]]]]; var $root manager = $place; var $has_commands local = #[]; var $root owned = [$place]; var $root managed = [$place]; root method .init_place() { exits = (entrances = []); realm = .set_realm($realm_of_creation); }; root method .uninit_place() { var x; for x in (exits + entrances) (| x.place_destroyed(this()) |); (| realm.place_destroyed(this()) |); (| $place_db.place_destroyed(this()) |); }; public method .environment() { return pass() + exits; }; public method .description() { arg f; var e; e = .visible_exits(); return ((> pass(f) <) + (.format_contents(f))) + (.format_exits(e, f)); }; public method .exits() { if (caller() != $command_parser) (> .perms(sender()) <); return exits; }; public method .did_connect() { (> .perms(caller(), $user) <); if ((.visibility()) >= 0) .announce(.eval_message("connect", #[["$actor", sender()], ["actor", sender().name()], ["$here", this()], ["here", .name()]], $place), sender()); }; public method .did_disconnect() { (> .perms(caller(), $user) <); if ((.visibility()) >= 0) .announce(.eval_message("disconnect", #[["$actor", sender()], ["actor", sender().name()], ["$here", this()], ["here", .name()]], $place), sender()); }; public method .realm() { arg [args]; return realm; }; public method .did_housekeep() { arg who; var m, v; (> .perms(sender(), $housekeeper) <); .announce(.eval_message("housekeeper", #[["$actor", who], ["actor", who.name()], ["$here", this()], ["here", .name()]], $place)); }; public method .set_name() { arg new_name, [args]; var old_name; old_name = .name(); (> pass(new_name, @args) <); (| $place_db.room_changed_name(old_name) |); }; public method .set_realm() { arg value; (caller() == $realms_frob) || ((sender() == this()) || (> .perms(sender()) <)); realm = value.new(); }; public method .format_exits() { arg exits, flags; var output, e, exits, line, actor, how; actor = flags['actor]; how = (| (flags['actor]).get_local_setting("exit-style", $user) |) || 'none; switch (how) { case 'none: return []; case 'brief: if (!exits) return []; return ["Exits: " + ((exits.mmap('name)).to_english("none"))]; case 'templates: output = []; for e in (exits) { if (e.name_templates()) output += [(((e.name()) + " (") + ((e.name_templates()).to_english())) + ")"]; else output += [e.name()]; } return output ? ["Exits: " + (output.to_english())] : []; case 'long: output = []; for e in (exits) output += [((" " + (e.name())) + " to ") + ((e.dest()).name())]; return output ? ["Exits: "] + (output.lcolumnize(actor.linelen())) : []; case 'verbose: output = []; for e in (exits) { if (e.name_templates()) line = (((e.name()) + " (") + ((e.name_templates()).to_english("no templates"))) + ")"; else line = e.name(); output += [((" " + line) + " to ") + ((e.dest()).name())]; } return output ? ["Exits: ", @output.lcolumnize(actor.linelen())] : []; } return []; }; public method .format_contents() { arg flags; var users, br, exclude, actor, objects, output, obj, line; // called by .description users = []; objects = []; actor = flags['actor]; exclude = (| flags['exclude] |) || []; for obj in (.contents()) { if ((!(obj in exclude)) && ((obj != actor) && (| obj.is_obvious_to(actor) |))) { if (obj.has_ancestor($body)) users += [obj.namef('nactivity)]; else objects += [obj.name()]; } } output = []; br = (<$format, ["br", [], [], 'do_br]>); if (users) { line = ($list.to_english(users)) + " "; line = (line + (((users.length()) > 1) ? "are" : "is")) + " here."; //output += [br, line]; output += [line]; } if (objects) { line = "You see "; line = (line + ($list.to_english(objects))) + " here."; //output += [br, line]; output += [line]; } return output; }; public method .visible_exits() { var obv, exit; if (.is_writable_by(sender())) return exits; obv = []; for exit in (exits) { if ((exit.visibility()) >= (.visibility())) obv += [exit]; } return obv; }; public method .realm_name() { arg [ctype]; [(ctype ?= "text/plain")] = ctype; switch (ctype) { case "text/html": return (((.hname()) + " (") + ((| realm.realm_name() |) || "<unknown>")) + ")"; default: return (((.name()) + " (") + ((| realm.realm_name() |) || "<unknown>")) + ")"; } }; public method .will_attach() { arg type, [by_whom]; [(by_whom ?= sender())] = by_whom; if ((!(| .trusts(by_whom) |)) && (!(.get_local_setting("public-home", $place)))) throw(~perm, "Place is not publicly extendable."); }; public method .visible_exits_formatted() { arg actor, how; var output, ex, exits, line; exits = .visible_exits(); switch (how) { case 'none: return []; case 'brief: if (!exits) return []; return ["Exits: " + ($list.to_english($list.mmap(exits, 'name), "none"))]; case 'average: output = []; for ex in (exits) { line = (ex.name()) + " ("; line += $list.to_english(ex.name_templates(), "no, templates"); output += [line]; } return output ? ["Exits: " + ($list.to_english(output))] : []; case 'long: output = []; for ex in (exits) output += [(((" " + (ex.name())) + " (to ") + ((ex.dest()).name())) + ")"]; return output ? ["Exits: ", @$list.lcolumnize(output, actor.linelen())] : []; case 'verbose: output = []; for ex in (exits) { line = ex.prose(); if (!line) line = [ex.name()]; output += [line[1]]; } return output ? [output.join()] : []; } }; public method .place_destroyed() { arg place; var e; (> .perms(caller(), $place, $realms_frob) <); for e in (exits) { if ((e.dest()) == sender()) e.destination_destroyed(); } }; public method .set_objname(): nooverride { arg new_objname; if ((caller() != $place) && (!(sender() in ($sys.system())))) throw(~perm, "Place objname can only be changed by $place."); (> pass(new_objname) <); }; public method .attach_exit() { arg type, exit; if (!(caller().is($exit))) throw(~perm, "Caller is not an exit."); if (type == 'source) { .add_object_to_remote_cache(exit); (.realm()).add_exit_to(exit.dest()); exits = setadd(exits, exit); } else { entrances = setadd(entrances, exit.source()); } }; public method .rehash_caches() { var exit; (> pass() <); for exit in (exits) (> .add_object_to_remote_cache(exit) <); }; public method .check_realm() { arg definer, value, [args]; var realm; realm = $place_lib.match_realm(value); if (!realm) throw(~invrealm, ("Unable to find the realm " + value) + "."); else if (!(realm.is($realms_frob))) throw(~invrealm, (realm.namef('ref)) + " is not a realm."); return realm; }; public method .del_realm() { arg name, definer, [args]; (> .perms(sender()) <); realm = $realm_of_creation; }; public method .darkness() { arg [args]; return darkness; }; public method .display_setting_realm() { arg frob; return class(frob).name(); }; public method .set_setting_realm() { arg definer, name, value, [args]; (> .perms(sender()) <); .set_realm(value); }; public method .prose() { arg [no_default]; var ret; ret = pass(@no_default); if (type(ret) == 'frob) (| (ret = ret.set_vars((.realm()).ctext_variables())) |); return ret; }; public method .detach_exit() { arg type, exit; if (!(caller().is($exit))) throw(~perm, "Caller is not an exit."); if (type == 'source) { .del_object_from_remote_cache(exit); exits = setremove(exits, exit); } else { entrances = setremove(entrances, exit.dest()); } }; public method .entrances() { (| .perms(caller(), definer(), $command_parser) |) || (> .perms(sender()) <); return entrances; }; root method .core_place(): nooverride { .set_realm($realm_of_creation); }; public method .update_exit_frob() { arg this, what, new; (> .perms(caller(), $exit_frob) <); exits = setremove(exits, (<sender(), this>)); this = this.add(what, new); exits = setadd(exits, (<sender(), this.add(what, new)>)); return (<sender(), this>); }; public method .is_connected_to() { var dest, i; (> .perms(caller, $realms_frob) <); for i in (exits) { if ((| dest == (i.dest()) |)) return 1; } return 0; }; new object $nowhere: $place; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'variables, 'core]; var $location contents = []; var $has_gender gender = $gender_neuter; var $described prose = []; var $has_name name = ['prop, "Nowhere", "Nowhere"]; var $place exits = []; var $place realm = <$realm_of_creation, #[['location, 'interior]]>; var $command_cache shortcut_cache = []; var $root manager = $nowhere; var $root managed = [$nowhere]; var $root owned = [$nowhere]; var $place entrances = []; var $event_handler hooks = #[['movement, []], ['user_connect, []]]; var $event_handler hooked = #[]; public method .description() { arg flags; return []; }; public method .announce() { arg [args]; }; new object $body_cave: $place; var $root manager = $body_cave; var $root created_on = 808865147; var $root inited = 1; var $root flags = ['methods, 'code, 'variables, 'core]; var $has_settings defined_settings = #[]; var $has_settings local_settings = ["public-home"]; var $has_settings settings = #[[$place, #[["public-home", "1"]]]]; var $has_commands shortcuts = #[]; var $has_commands remote = #[]; var $has_commands local = #[]; var $command_cache remote_cache = #[["@lock", [["@lock"], #[[$thing, 55]]]], ["@unlock", [["@unlock"], #[[$thing, 55]]]], ["@boot", [["@boot"], #[[$thing, 55]]]]]; var $command_cache shortcut_cache = []; var $has_name name = ['uniq, "Body Cave", "the Body Cave"]; var $has_gender gender = $gender_neuter; var $described prose = []; var $location contents = [$reaper, $builder, $guest, $no_one, $programmer, $admin, $player, $storyteller, $user]; var $place exits = []; var $place realm = <$realm_of_creation, #[['location, 'interior]]>; var $physical visibility = -100; var $root managed = [$body_cave]; var $root owned = [$body_cave]; var $place entrances = []; var $event_handler hooks = #[['movement, []], ['user_connect, []]]; var $event_handler hooked = #[]; public method .announce() { arg [who_cares]; }; new object $void: $place; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'variables, 'core]; var $location contents = [$thing, $lost_and_found, $thing_frob, $trash, $located_location, $body, $reaper_log, $log, $http_log, $note, $slate, $login_log, $generic_map, $exit_frob]; var $has_gender gender = $gender_neuter; var $described prose = ["A place existing for the soul purpose of doing so, when it wishes be."]; var $has_name name = ['uniq, "Void", "the Void"]; var $place exits = []; var $place realm = <$realm_of_creation, #[['location, 'interior]]>; var $command_cache remote_cache = #[["read", [["read", "read|nread"], #[[$log, 4], [$note, 4]]]], ["erase", [["erase"], #[[$note, 4]]]], ["nread", [["read|nread"], #[[$note, 4]]]], ["write", [["write"], #[[$note, 4]]]], ["copy", [["copy"], #[[$note, 4]]]], ["smoke", [["smoke"], #[[#537, 1]]]]]; var $command_cache shortcut_cache = []; var $root manager = $void; var $root managed = [$void]; var $root owned = [$void]; var $place entrances = []; new object $the_pit: $place; var $has_messages messages = #[[$place, #[["housekeeper", <$ctext_frob, [["Dust bunnies rise from under the furniture to envelope ", <$generator, ["actor", [], [], 'gen_actor]>, "'s comatose form, leaving behind a small pile of musty lint."], #[['this, $lag_watcher]]]>]]]]; var $root inited = 1; var $root manager = $the_pit; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'variables, 'core]; var $location contents = []; var $has_gender gender = $gender_neuter; var $described prose = <$ctext_frob, [["A cozy atmosphere pervades this room, a small hideaway where people can come to relax and socialize. The cement walls are covered with various scribbles burn marks, and stains of unrecognizable origin."], #[['this, $the_pit]]]>; var $has_name name = ['prop, "The Pit", "The Pit"]; var $place exits = []; var $place realm = <$realm_of_creation, #[['location, 'interior]]>; var $command_cache shortcut_cache = []; var $command_cache remote_cache = #[["erase", [["erase"], #[[$note, 3]]]], ["read", [["read|nread"], #[[$note, 3]]]], ["nread", [["read|nread"], #[[$note, 3]]]], ["write", [["write"], #[[$note, 3]]]], ["copy", [["copy"], #[[$note, 3]]]], ["@boot", [["@boot"], #[[$thing, 44]]]], ["push", [["push"], #[[$help_func_method_flags, 1]]]], ["step", [["step"], #[[$user_db, 1]]]], ["beat", [["beat"], #[[$user_db, 1]]]], ["jump", [["jump"], #[[$user_db, 1]]]], ["pet", [["pet"], #[[$user_db, 1]]]], ["@reactions", [["@reactions"], #[[$robot, 1]]]], ["bounce", [["bounce"], #[[$help_driver_structure_expressions_callingfunctions, 1]]]]]; var $root managed = [$the_pit]; var $root owned = [$the_pit]; var $place entrances = [#468]; var $has_settings settings = #[[$place, #[["public-home", 0]]]]; var $has_settings local_settings = ["public-home"]; var $event_handler hooks = #[['movement, []], ['user_connect, []]]; var $event_handler hooked = #[]; root method .core_the_pit() { .set_prose("A cozy atmosphere pervades this room, a small hideaway where people can come to relax and socialize. The cement walls are covered with various scribbles burn marks, and stains of unrecognizable origin."); }; new object $mail_list_news: $mail_list; var $root fertile = 1; var $root manager = $mail_list_news; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'fertile, 'core, 'variables]; var $has_name name = ['prop, "news", "news"]; var $mail_list mail = []; var $mail_list senders = [$in_location, $daemon, #562]; var $mail_list readers = 1; var $mail_list notify = []; var $mail_list last_received_on = 846395147; var $root managed = [$mail_list_news]; var $root owned = [$mail_list_news]; new object $mail_list_bugs: $mail_list; var $root manager = $mail_list_bugs; var $root created_on = 811630223; var $root inited = 1; var $root flags = ['methods, 'code, 'variables, 'core]; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "bugs", "bugs"]; var $mail_list mail = []; var $mail_list senders = 1; var $mail_list readers = 1; var $mail_list notify = [$mail_list_bugs, $daemon, $lag_watcher, $http_daemon, $login_daemon, $http_interface, $world]; var $mail_list last_received_on = 849987874; var $root managed = [$mail_list_bugs]; new object $has_text: $foundation; var $root fertile = 1; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'fertile, 'core, 'variables]; var $has_text text = 0; var $root manager = $has_text; var $root child_index = 1; var $root managed = [$has_text]; var $root owned = [$has_text]; root method .init_has_text() { text = []; }; root method .uninit_has_text() { perm = []; }; public method .text() { // returns text if ((!(.is_writable_by(sender()))) && (sender() != this())) throw(~perm, "Permission Denied."); return text; }; public method .set_text() { arg txt; // resets ,text to the list sent if ((!(.is_writable_by(sender()))) && (sender() != this())) throw(~perm, "Permission Denied."); text = txt; }; public method .ins_line() { arg txt, [loc]; // inserts txt at loc (where loc is an integer) if ((!(.is_writable_by(sender()))) && (sender() != this())) throw(~perm, "Permission Denied."); if (!loc) text += [txt]; else text = (> text.insert(loc, txt) <); }; public method .del_text() { // deletes all text if ((!(.is_writable_by(sender()))) && (sender() != this())) throw(~perm, "Permission Denied."); text = []; }; public method .del_line() { arg linestr; // deletes "line" where line is the actual line to delete if ((!(.is_writable_by(sender()))) && (sender() != this())) throw(~perm, "Permission Denied."); text = text.setremove(line); }; public method .del_nline() { arg nline; // deletes nline where nline is an integer reference to a list location if ((!(.is_writable_by(sender()))) && (sender() != this())) throw(~perm, "Permission Denied."); text = (> text.delete(nline) <); }; public method .ins_lines() { arg lines, loc; var line; // inserts txt at loc (where loc is an integer) if ((!(.is_writable_by(sender()))) && (sender() != this())) throw(~perm, "Permission Denied."); if (type(lines) != 'list) throw(~type, "Lines should be passed as a list of strings."); for line in (lines) { text = (> text.insert(loc, line) <); ++loc; } }; public method .edit_text() { var p; (> .perms(sender()) <); p = .text(); (> sender().invoke_editor(this(), '_edit_text_callback, p, []) <); }; public method ._edit_text_callback() { arg t, client_data; (> .perms(sender()) <); .set_text(t); return "Text set."; }; new object $note: $thing, $has_text; var $root child_index = 48; var $root fertile = 1; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'fertile, 'variables, 'core]; var $has_text text = []; var $located location = $void; var $located obvious = 1; var $described prose = []; var $has_gender gender = $gender_neuter; var $has_name name = ['uniq, "Generic Note", "the Generic Note"]; var $note seperator = 0; var $foundation edit_types = ["text"]; var $has_commands remote = #[["erase", [["erase", "*", "erase <this>", 'erase_cmd, #[[1, ['this, []]]]], ["erase", "* on|from *", "erase <string> on|from <this>", 'erase_on_cmd, #[[1, ['any, []]], [3, ['this, []]]]]]], ["read|nread", [["read|nread", "*", "read|nread <this>", 'read_cmd, #[[1, ['this, []]]]]]], ["write", [["write", "on *", "write on <this>", 'write_cmd, #[[2, ['this, []]]]], ["write", "at * on *", "write at <string> on <this>", 'write_at_cmd, #[[2, ['any, []]], [4, ['this, []]]]]]], ["copy", [["copy", "from * to *", "copy from <this> to <any>", 'copy_cmd, #[[2, ['this, []]], [4, ['any, []]]]]]]]; var $root manager = $note; var $root owned = [$note]; var $has_settings defined_settings = #[["private", #[['get, 'get_local_setting], ['set, 'set_local_setting], ['check, 'is_boolean], ['del, 'delete_local_setting], ['check_args, []], ['get_args, []], ['set_args, []], ['display, 'display_boolean_yes_no]]]]; var $root managed = [$note]; protected method .add_text() { arg ntext, who, [args]; // if at they should be an int defining where to insert. if (ntext) { if (ntext == 'aborted) return; if (args) { if (!(| .ins_lines(ntext, args[1]) |)) who.tell(("There are not that many lines in " + (.name())) + "."); } else { .set_text((.text()) + ntext); } who.tell(((("Line" + (((ntext.length()) == 1) ? "" : "s")) + " added to ") + (.name())) + "."); } else { who.tell("Text not added."); } }; public method .seperator() { return (type(seperator) == 'string) ? seperator : "---"; }; root method .init_note() { .del_flag('variables); }; public method .init_for_core() { .perms(caller(), $sys); }; public method .set_seperator() { arg newsep; .perms(sender(), 'manager); seperator = newsep; }; public method .read_cmd() { arg cmdstr, cmd, [args]; var who, text, prose; who = sender(); if ((| .get_local_setting("private", $note) |) && (!(.trusts(who)))) return who.tell(("You cannot read " + (.name())) + "."); who.tell(.name()); who.tell(.prose()); who.tell(.seperator()); text = .text(); if ((cmd == "nread") && text) text = $list.numbered_text(text); who.tell(text ? text : ["", "(nothing)", ""]); who.tell(.seperator()); who.tell(("You finish reading " + (.name())) + "."); }; public method .write_cmd() { arg cmdstr, cmd, [args]; var who, line; if (!(.is_writable_by(sender()))) return ("You do not have permission to write on " + (.name())) + "."; who = sender(); // because I'm odd lets do this all 1 one command. if ((args.length()) == 2) { line = "Now writing on " + (.name()); line += ", enter \".\" to finish and \"@abort\" to abort."; // who.tell(line); .add_text(who.read(line), who); } else { args = (args[1]).explode(); who.debug(args); } }; public method .erase_on_cmd() { arg cmdstr, cmd, str, prep, this; var line, nline, who, len, oldline; (> .perms(sender()) <); who = sender(); if (!str) return who.tell("You must erase either a line, line number, or all"); catch any { if ($string.match_begin("all", str)) { .del_text(); // if cmd is null, this method was called by an editor if (cmd) who.tell(("All text cleared from " + (.name())) + "."); } else { if (((str.explode()).length()) > 1) nline = toint((str.explode())[2]); else nline = toint(str); oldline = (.text())[nline]; .del_nline(nline); line = ("Line " + tostr(nline)) + " (\""; len = (who.linelen()) - (25 + ((.name()).length())); line += $string.chop(oldline, len); line = (line + "\") erased from ") + (.name()); who.tell(line); } } with { switch (error()) { case ~range: who.tell("There are not that many lines in the text."); default: who.tell("Oops: " + ((traceback()[1])[2])); } } }; public method .erase_cmd() { arg cmdstr, cmd, this; var line, nline, len; (> .perms(sender()) <); .del_text(); // if cmd is null, this method was called by an editor originally. if (cmd) sender().tell(("All text cleared from " + (.name())) + "."); }; public method .write_str_cmd() { arg cmdstr, cmd, str, prep, this; (> .perms(sender()) <); if (!str) return ("Nothing to write on " + (.name())) + "!"; .add_text([str], sender()); }; public method .write_at_cmd() { arg cmdstr, cmd, at, str, prep, this; var who, line, lines, syn; (> .perms(sender()) <); who = sender(); syn = ((("`" + cmd) + " at [line] <line number> on ") + this) + "`"; str = str.explode(); if ((str[1]) == "line") str = str.delete(1); line = $string.is_numeric(str[1]); if (!at) $parse_lib.tell_error(("Unknown line \"" + (str[1])) + "\".", syn, who); lines = (.text()).length(); if (line > (lines + 1)) $parse_lib.tell_error(("There are only " + tostr(lines)) + " lines!", syn, who); .add_text(who.read(), who, line); }; public method .copy_cmd() { arg cmdstr, cmd, from, this, prep, dest; var obj, what; // this method is outdated, needs to be rewritten. // it probably doesn't even work. if (!(.trusts(who))) return sender().tell(("You cannot read the text on " + (.namef('ref))) + "."); dest = $parse_lib.ref(dest); obj = dest[3]; if (!(obj.is_writable_by(sender()))) return .tell(("! " + (obj.namef('ref))) + " is not writable by you."); if ((obj.has_ancestor($note)) && (!(dest[4]))) obj.add_text(text, sender()); if ((dest[1]) == 'method) { catch any { dest = (> tosym(dest[4]) <); if (what) { obj.(dest)(text, sender()); sender().tell(((("Text copied to " + obj) + ".") + dest) + "()."); } else { if (!((| tosym(dest) |) in (obj.variables()))) return .tell(("! variable '" + dest) + " not found"); obj.eval([(dest + " = ") + (.text())]); } } with { sender().tell_error((traceback()[1])[2]); } } sender().tell("Text copied from " + (.name())); }; public method .description() { arg flags; return (> pass(flags) <) + ["You see some writing on the note, and may be able to read it..."]; }; new object $log: $note; var $root child_index = 4; var $root fertile = 1; var $root trusted = []; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'fertile, 'core]; var $described prose = ["the place that Ye administrators should be logging somewhat impacting changes that others would like to know about."]; var $has_gender gender = $gender_neuter; var $located location = $void; var $located obvious = 1; var $has_name name = ['uniq, "Generic Log", "the Generic Log"]; var $has_text text = ["9-28-94/22:33:17> foo"]; var $has_commands remote = #[["read", [["read", "* on *", "read <any> on <this>", 'read_cmd, #[[1, ['any, []]], [3, ['this, []]]]]]]]; var $root manager = $log; var $root managed = [$log]; var $root owned = [$log]; public method .read_cmd() { arg [args]; var loglen, text; if (0) { // later on i'll adjust this so you can 'read from line 12 on log' return; } else { text = .text(); loglen = text.length(); sender().tell(["---", (((((.name()) + ", entries ") + tostr(loglen - 10)) + " to ") + tostr(loglen)) + " (last 10 lines).", "---"]); sender().tell(text.subrange(loglen - 10)); sender().tell("---"); } // $# Edited 05 Nov 1995 14:03 Lynx ($lynx) }; public method .log() { arg line; var l; (> .perms(caller(), 'trusts) <); if (type(line) == 'list) { for l in (line) .ins_line((($time.format("%d %h %y %H:%M")) + "> ") + l); } else { .ins_line((($time.format("%d %h %y %H:%M")) + "> ") + line); } }; new object $http_log: $log; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'core]; var $has_text text = []; var $has_name name = ['prop, "HTTP Log", "HTTP Log"]; var $has_gender gender = $gender_neuter; var $described prose = []; var $located location = $void; var $located obvious = 1; var $http_log tally = 3896; var $root manager = $http_log; var $root managed = [$http_log]; var $root owned = [$http_log]; public method .log() { arg [args]; ++tally; }; public method .tally() { return tally; }; new object $reaper_log: $log; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'core]; var $has_text text = []; var $has_name name = ['prop, "Reaper Logfile", "Reaper Logfile"]; var $has_gender gender = $gender_neuter; var $described prose = []; var $located location = $void; var $located obvious = 1; var $root manager = $reaper_log; var $root managed = [$reaper_log]; var $root owned = [$reaper_log]; new object $login_log: $log; var $root manager = $login_log; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'core]; var $has_text text = ["15 Mar 96 21:32> [~invname, \"Names must have at least 3 alpha-numeric characters in them\", 0]", "15 Mar 96 21:32> ['method, 'valid_name, $user_db, $registry, 16]", "15 Mar 96 21:32> [~invname, 'valid_name, $user_db, $user_db, 5]", "15 Mar 96 21:32> [~invname, 'set_name, #1003, $user, 7]", "15 Mar 96 21:32> [~invname, 'create_user, $sys, $sys, 9]", "15 Mar 96 21:32> [~invname, 'connect_guest_cmd, $login_interface_3113, $login_interface, 27]", "17 Mar 96 14:57> [~invname, \"Name already exists.\", 0]", "17 Mar 96 14:57> ['method, 'valid_name, $user_db, $registry, 23]", "17 Mar 96 14:57> [~invname, 'valid_name, $user_db, $user_db, 5]", "17 Mar 96 14:57> [~invname, 'set_name, #1063, $user, 7]", "17 Mar 96 14:57> [~invname, 'create_user, $sys, $sys, 9]", "17 Mar 96 14:57> [~invname, 'connect_guest_cmd, $login_interface_3132, $login_interface, 27]", "17 Mar 96 14:58> [~invname, \"Name already exists.\", 0]", "17 Mar 96 14:58> ['method, 'valid_name, $user_db, $registry, 23]", "17 Mar 96 14:58> [~invname, 'valid_name, $user_db, $user_db, 5]", "17 Mar 96 14:58> [~invname, 'set_name, #1064, $user, 7]", "17 Mar 96 14:58> [~invname, 'create_user, $sys, $sys, 9]", "17 Mar 96 14:58> [~invname, 'connect_guest_cmd, $login_interface_3132, $login_interface, 27]", "18 Mar 96 17:05> [~invname, \"Name already exists.\", 0]", "18 Mar 96 17:05> ['method, 'valid_name, $user_db, $registry, 23]", "18 Mar 96 17:05> [~invname, 'valid_name, $user_db, $user_db, 5]", "18 Mar 96 17:05> [~invname, 'set_name, #1136, $user, 7]", "18 Mar 96 17:05> [~invname, 'create_user, $sys, $sys, 9]", "18 Mar 96 17:05> [~invname, 'connect_guest_cmd, $login_interface_3165, $login_interface, 27]", "23 Mar 96 13:20> [~error, \"The name 'user_charles is already taken.\", 0]", "23 Mar 96 13:20> ['function, 'set_objname]", "23 Mar 96 13:20> [~error, 'set_objname, #1503, $root, 16]", "23 Mar 96 13:20> [~error, 'set_objname, #1503, $user, 5]", "23 Mar 96 13:20> [~error, 'set_name, #1503, $user, 15]", "23 Mar 96 13:20> [~error, 'create_user, $sys, $sys, 9]", "23 Mar 96 13:20> [~error, 'connect_guest_cmd, $login_interface_3255, $login_interface, 27]", "24 Mar 96 17:28> [~invname, \"Name already exists.\", 0]", "24 Mar 96 17:28> ['method, 'valid_name, $user_db, $registry, 23]", "24 Mar 96 17:28> [~invname, 'valid_name, $user_db, $user_db, 5]", "24 Mar 96 17:28> [~invname, 'set_name, #1570, $user, 7]", "24 Mar 96 17:28> [~invname, 'create_user, $sys, $sys, 9]", "24 Mar 96 17:28> [~invname, 'connect_guest_cmd, $login_interface_3281, $login_interface, 27]", "25 Mar 96 17:10> [~error, \"The name 'user_mikeobrien is already taken.\", 0]", "25 Mar 96 17:10> ['function, 'set_objname]", "25 Mar 96 17:10> [~error, 'set_objname, #1643, $root, 16]", "25 Mar 96 17:10> [~error, 'set_objname, #1643, $user, 5]", "25 Mar 96 17:10> [~error, 'set_name, #1643, $user, 15]", "25 Mar 96 17:10> [~error, 'create_user, $sys, $sys, 9]", "25 Mar 96 17:10> [~error, 'connect_guest_cmd, $login_interface_3300, $login_interface, 27]", "25 Mar 96 17:10> [~invname, \"Name already exists.\", 0]", "25 Mar 96 17:10> ['method, 'valid_name, $user_db, $registry, 23]", "25 Mar 96 17:10> [~invname, 'valid_name, $user_db, $user_db, 5]", "25 Mar 96 17:10> [~invname, 'set_name, #1644, $user, 7]", "25 Mar 96 17:10> [~invname, 'create_user, $sys, $sys, 9]", "25 Mar 96 17:10> [~invname, 'connect_guest_cmd, $login_interface_3300, $login_interface, 27]", "26 Mar 96 09:59> [~invname, \"Name already exists.\", 0]", "26 Mar 96 09:59> ['method, 'valid_name, $user_db, $registry, 23]", "26 Mar 96 09:59> [~invname, 'valid_name, $user_db, $user_db, 5]", "26 Mar 96 09:59> [~invname, 'set_name, #1681, $user, 7]", "26 Mar 96 09:59> [~invname, 'create_user, $sys, $sys, 9]", "26 Mar 96 09:59> [~invname, 'connect_guest_cmd, $login_interface_3310, $login_interface, 27]", "26 Mar 96 15:56> [~invname, \"Name already exists.\", 0]", "26 Mar 96 15:56> ['method, 'valid_name, $user_db, $registry, 23]", "26 Mar 96 15:56> [~invname, 'valid_name, $user_db, $user_db, 5]", "26 Mar 96 15:56> [~invname, 'set_name, #1804, $user, 7]", "26 Mar 96 15:56> [~invname, 'create_user, $sys, $sys, 9]", "26 Mar 96 15:56> [~invname, 'connect_guest_cmd, $login_interface_3316, $login_interface, 27]", "01 Apr 96 11:24> [~error, \"The name 'user_loki is already taken.\", 0]", "01 Apr 96 11:24> ['function, 'set_objname]", "01 Apr 96 11:24> [~error, 'set_objname, #2159, $root, 16]", "01 Apr 96 11:24> [~error, 'set_objname, #2159, $user, 5]", "01 Apr 96 11:24> [~error, 'set_name, #2159, $user, 15]", "01 Apr 96 11:24> [~error, 'create_user, $sys, $sys, 9]", "01 Apr 96 11:24> [~error, 'connect_guest_cmd, $login_interface_3461, $login_interface, 27]", "01 Apr 96 12:42> [~invname, \"Name already exists.\", 0]", "01 Apr 96 12:42> ['method, 'valid_name, $user_db, $registry, 23]", "01 Apr 96 12:42> [~invname, 'valid_name, $user_db, $user_db, 5]", "01 Apr 96 12:42> [~invname, 'set_name, #2163, $user, 7]", "01 Apr 96 12:42> [~invname, 'create_user, $sys, $sys, 9]", "01 Apr 96 12:42> [~invname, 'connect_guest_cmd, $login_interface_3462, $login_interface, 27]", "09 Apr 96 01:17> [~invname, \"Name already exists.\", 0]", "09 Apr 96 01:17> ['method, 'valid_name, $user_db, $registry, 23]", "09 Apr 96 01:17> [~invname, 'valid_name, $user_db, $user_db, 5]", "09 Apr 96 01:17> [~invname, 'set_name, #2421, $user, 7]", "09 Apr 96 01:17> [~invname, 'create_user, $sys, $sys, 9]", "09 Apr 96 01:17> [~invname, 'connect_guest_cmd, $login_interface_3549, $login_interface, 27]", "09 Apr 96 19:27> [~error, \"The name 'user_scooter is already taken.\", 0]", "09 Apr 96 19:27> ['function, 'set_objname]", "09 Apr 96 19:27> [~error, 'set_objname, #2464, $root, 16]", "09 Apr 96 19:27> [~error, 'set_objname, #2464, $user, 5]", "09 Apr 96 19:27> [~error, 'set_name, #2464, $user, 15]", "09 Apr 96 19:27> [~error, 'create_user, $sys, $sys, 9]", "09 Apr 96 19:27> [~error, 'connect_guest_cmd, $login_interface_3565, $login_interface, 27]", "10 Apr 96 11:16> [~error, \"The name 'user_mikeobrien is already taken.\", 0]", "10 Apr 96 11:16> ['function, 'set_objname]", "10 Apr 96 11:16> [~error, 'set_objname, #2541, $root, 16]", "10 Apr 96 11:16> [~error, 'set_objname, #2541, $user, 5]", "10 Apr 96 11:16> [~error, 'set_name, #2541, $user, 15]", "10 Apr 96 11:16> [~error, 'create_user, $sys, $sys, 9]", "10 Apr 96 11:16> [~error, 'connect_guest_cmd, $login_interface_3576, $login_interface, 27]", "10 Apr 96 11:17> [~invname, \"Name already exists.\", 0]", "10 Apr 96 11:17> ['method, 'valid_name, $user_db, $registry, 23]", "10 Apr 96 11:17> [~invname, 'valid_name, $user_db, $user_db, 5]", "10 Apr 96 11:17> [~invname, 'set_name, #2544, $user, 7]", "10 Apr 96 11:17> [~invname, 'create_user, $sys, $sys, 9]", "10 Apr 96 11:17> [~invname, 'connect_guest_cmd, $login_interface_3576, $login_interface, 27]", "13 Apr 96 23:55> [~invname, \"Names must have at least 3 alpha-numeric characters in them\", 0]", "13 Apr 96 23:55> ['method, 'valid_name, $user_db, $registry, 16]", "13 Apr 96 23:55> [~invname, 'valid_name, $user_db, $user_db, 5]", "13 Apr 96 23:55> [~invname, 'set_name, #2661, $user, 7]", "13 Apr 96 23:55> [~invname, 'create_user, $sys, $sys, 9]", "13 Apr 96 23:55> [~invname, 'connect_guest_cmd, $login_interface_3629, $login_interface, 27]", "24 Apr 96 13:53> [~invname, \"Name already exists.\", 0]", "24 Apr 96 13:53> ['method, 'valid_name, $user_db, $registry, 23]", "24 Apr 96 13:53> [~invname, 'valid_name, $user_db, $user_db, 5]", "24 Apr 96 13:53> [~invname, 'set_name, #1147, $user, 7]", "24 Apr 96 13:53> [~invname, 'create_user, $sys, $sys, 9]", "24 Apr 96 13:53> [~invname, 'connect_guest_cmd, $login_interface_3890, $login_interface, 27]", "01 May 96 21:00> [~invname, \"Names must have at least 3 alpha-numeric characters in them\", 0]", "01 May 96 21:00> ['method, 'valid_name, $user_db, $registry, 16]", "01 May 96 21:00> [~invname, 'valid_name, $user_db, $user_db, 5]", "01 May 96 21:00> [~invname, 'set_name, #1105, $user, 7]", "01 May 96 21:00> [~invname, 'create_user, $sys, $sys, 9]", "01 May 96 21:00> [~invname, 'connect_guest_cmd, $login_interface_4091, $login_interface, 27]", "09 May 96 20:23> [~perm, \"$guest_jennertest is not one of: $list\", #900]", "09 May 96 20:23> ['method, 'perms, $user_db, $root, 26]", "09 May 96 20:23> [~perm, 'insert, $user_db, $db, 5]", "09 May 96 20:23> [~methoderr, 'insert, $user_db, $registry, 7]", "09 May 96 20:23> [~methoderr, 'init_user, #900, $user, 9]", "09 May 96 20:23> [~methoderr, '_initialize_ancestor, #900, $root, 8]", "09 May 96 20:23> [~methoderr, 'initialize, #900, $root, 10]", "09 May 96 20:23> [~methoderr, 'create, $sys, $sys, 8]", "09 May 96 20:23> [~methoderr, 'spawn_sender, $sys, $sys, 8]", "09 May 96 20:23> [~methoderr, 'spawn, $guest, $root, 36]", "09 May 96 20:23> [~methoderr, 'create_user, $sys, $sys, 8]", "09 May 96 20:23> [~methoderr, 'connect_guest_cmd, $login_interface_4251, $login_interface, 27]", "09 May 96 20:25> [~perm, \"$guest_jennertest is not one of: $list\", #903]", "09 May 96 20:25> ['method, 'perms, $user_db, $root, 26]", "09 May 96 20:25> [~perm, 'insert, $user_db, $db, 5]", "09 May 96 20:25> [~methoderr, 'insert, $user_db, $registry, 7]", "09 May 96 20:25> [~methoderr, 'init_user, #903, $user, 9]", "09 May 96 20:25> [~methoderr, '_initialize_ancestor, #903, $root, 8]", "09 May 96 20:25> [~methoderr, 'initialize, #903, $root, 10]", "09 May 96 20:25> [~methoderr, 'create, $sys, $sys, 8]", "09 May 96 20:25> [~methoderr, 'spawn_sender, $sys, $sys, 8]", "09 May 96 20:25> [~methoderr, 'spawn, $guest, $root, 36]", "09 May 96 20:25> [~methoderr, 'create_user, $sys, $sys, 8]", "09 May 96 20:25> [~methoderr, 'connect_guest_cmd, $login_interface_4252, $login_interface, 27]", "09 May 96 20:28> [~perm, \"Permission Denied: $guest_miro is not a writer.\", #906]", "09 May 96 20:28> ['method, 'perms, $user_db, $root, 22]", "09 May 96 20:28> [~perm, 'insert, $user_db, $db, 5]", "09 May 96 20:28> [~methoderr, 'insert, $user_db, $registry, 7]", "09 May 96 20:28> [~methoderr, 'init_user, #906, $user, 9]", "09 May 96 20:28> [~methoderr, '_initialize_ancestor, #906, $root, 8]", "09 May 96 20:28> [~methoderr, 'initialize, #906, $root, 10]", "09 May 96 20:28> [~methoderr, 'create, $sys, $sys, 8]", "09 May 96 20:28> [~methoderr, 'spawn_sender, $sys, $sys, 8]", "09 May 96 20:28> [~methoderr, 'spawn, $guest, $root, 36]", "09 May 96 20:28> [~methoderr, 'create_user, $sys, $sys, 8]", "09 May 96 20:28> [~methoderr, 'connect_guest_cmd, $login_interface_4253, $login_interface, 27]", "19 May 96 21:17> [~invname, \"`the' is not allowed as part of a name.\", 0]", "19 May 96 21:17> ['method, 'valid_name, $user_db, $registry, 33]", "19 May 96 21:17> [~invname, 'valid_name, $user_db, $user_db, 5]", "19 May 96 21:17> [~invname, 'set_name, #1110, $user, 7]", "19 May 96 21:17> [~invname, 'create_user, $sys, $sys, 9]", "19 May 96 21:17> [~invname, 'connect_guest_cmd, $login_interface_4498, $login_interface, 27]", "26 May 96 12:49> [~invname, \"Names must have at least 3 alpha-numeric characters in them\", 0]", "26 May 96 12:49> ['method, 'valid_name, $user_db, $registry, 16]", "26 May 96 12:49> [~invname, 'valid_name, $user_db, $user_db, 5]", "26 May 96 12:49> [~invname, 'set_name, #1467, $user, 7]", "26 May 96 12:49> [~invname, 'create_user, $sys, $sys, 9]", "26 May 96 12:49> [~invname, 'connect_guest_cmd, $login_interface_4635, $login_interface, 27]", "01 Jun 96 17:07> [~error, \"The name 'user_nip is already taken.\", 0]", "01 Jun 96 17:07> ['function, 'set_objname]", "01 Jun 96 17:07> [~error, 'set_objname, #1170, $root, 16]", "01 Jun 96 17:07> [~error, 'set_objname, #1170, $user, 5]", "01 Jun 96 17:07> [~error, 'set_name, #1170, $user, 15]", "01 Jun 96 17:07> [~error, 'create_user, $sys, $sys, 9]", "01 Jun 96 17:07> [~error, 'connect_guest_cmd, $login_interface_4753, $login_interface, 27]", "03 Jun 96 16:01> [~invname, \"Name already exists.\", 0]", "03 Jun 96 16:01> ['method, 'valid_name, $user_db, $registry, 23]", "03 Jun 96 16:01> [~invname, 'valid_name, $user_db, $user_db, 5]", "03 Jun 96 16:01> [~invname, 'set_name, #1281, $user, 7]", "03 Jun 96 16:01> [~invname, 'create_user, $sys, $sys, 9]", "03 Jun 96 16:01> [~invname, 'connect_guest_cmd, $login_interface_4780, $login_interface, 27]", "03 Jun 96 16:01> [~invname, \"Names must have at least 3 alpha-numeric characters in them\", 0]", "03 Jun 96 16:01> ['method, 'valid_name, $user_db, $registry, 16]", "03 Jun 96 16:01> [~invname, 'valid_name, $user_db, $user_db, 5]", "03 Jun 96 16:01> [~invname, 'set_name, #1282, $user, 7]", "03 Jun 96 16:01> [~invname, 'create_user, $sys, $sys, 9]", "03 Jun 96 16:01> [~invname, 'connect_guest_cmd, $login_interface_4780, $login_interface, 27]", "03 Jun 96 16:02> [~perm, \"Can't specify a numeric suffix.\", 0]", "03 Jun 96 16:02> ['method, 'spawn, $guest, $root, 18]", "03 Jun 96 16:02> [~perm, 'create_user, $sys, $sys, 8]", "03 Jun 96 16:02> [~perm, 'connect_guest_cmd, $login_interface_4780, $login_interface, 27]", "06 Jun 96 15:31> [~invname, \"Name already exists.\", 0]", "06 Jun 96 15:31> ['method, 'valid_name, $user_db, $registry, 23]", "06 Jun 96 15:31> [~invname, 'valid_name, $user_db, $user_db, 5]", "06 Jun 96 15:31> [~invname, 'set_name, #1391, $user, 7]", "06 Jun 96 15:31> [~invname, 'create_user, $sys, $sys, 9]", "06 Jun 96 15:31> [~invname, 'connect_guest_cmd, $login_interface_4824, $login_interface, 27]", "06 Jun 96 15:36> [~invname, \"Name already exists.\", 0]", "06 Jun 96 15:36> ['method, 'valid_name, $user_db, $registry, 23]", "06 Jun 96 15:36> [~invname, 'valid_name, $user_db, $user_db, 5]", "06 Jun 96 15:36> [~invname, 'set_name, #1395, $user, 7]", "06 Jun 96 15:36> [~invname, 'create_user, $sys, $sys, 9]", "06 Jun 96 15:36> [~invname, 'connect_guest_cmd, $login_interface_4825, $login_interface, 27]", "07 Jun 96 09:26> [~invname, \"Name already exists.\", 0]", "07 Jun 96 09:26> ['method, 'valid_name, $user_db, $registry, 23]", "07 Jun 96 09:26> [~invname, 'valid_name, $user_db, $user_db, 5]", "07 Jun 96 09:26> [~invname, 'set_name, #1516, $user, 7]", "07 Jun 96 09:26> [~invname, 'create_user, $sys, $sys, 9]", "07 Jun 96 09:26> [~invname, 'connect_guest_cmd, $login_interface_4873, $login_interface, 28]", "07 Jun 96 09:26> [~invname, \"Name already exists.\", 0]", "07 Jun 96 09:26> ['method, 'valid_name, $user_db, $registry, 23]", "07 Jun 96 09:26> [~invname, 'valid_name, $user_db, $user_db, 5]", "07 Jun 96 09:26> [~invname, 'set_name, #1517, $user, 7]", "07 Jun 96 09:26> [~invname, 'create_user, $sys, $sys, 9]", "07 Jun 96 09:26> [~invname, 'connect_guest_cmd, $login_interface_4873, $login_interface, 28]"]; var $has_name name = ['uniq, "log_3", "the log_3"]; var $has_gender gender = $gender_neuter; var $described prose = []; var $located location = $void; var $located obvious = 1; var $root managed = [$login_log]; var $root owned = [$login_log]; new object $generic_map: $note; var $root manager = $generic_map; var $located obvious = 1; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 840768594; var $located location = $void; var $has_text text = []; var $root inited = 1; var $described prose = <$ctext_frob, [["This is generic map object - it's generic holder for area maps."], #[['this, $generic_map]]]>; var $has_commands shortcuts = #[]; var $has_commands remote = #[]; var $has_commands local = #[]; var $has_gender gender = $gender_neuter; var $has_name name = ['uniq, "Generic Map", "the Generic Map"]; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $root child_index = 1; var $root managed = [$generic_map]; var $root owned = [$generic_map]; public method .view() { arg x, y, code, height, width; var text, i, out, pos, line; text = .text(); pos = 0; out = []; for i in [y .. y + height] { line = (| ((text[i]).subrange(x + 1)).pad(width) |) || ""; pos = pos || (code in line); out += [((line.left(width)).replace(code, "**")).sed("[0-9]", " ", "g")]; } return [@out, pos ? "Your position is '**'." : "Your position is not shown on this map."]; }; new object $map_of_taobh_thiar: $generic_map; var $root manager = $map_of_taobh_thiar; var $root flags = ['methods, 'code, 'core]; var $root created_on = 841020994; var $has_text text = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", " ^", " |", " The Pit", " 00"]; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['uniq, "Map of Taobh Thiar", "the Map of Taobh Thiar"]; var $has_gender gender = $gender_neuter; var $has_commands shortcuts = #[]; var $has_commands remote = #[]; var $has_commands local = #[]; var $described prose = <$ctext_frob, [["This map shows the Taobh Thiar."], #[['this, $map_of_taobh_thiar]]]>; var $located location = $lost_and_found; var $located obvious = 1; var $root inited = 1; var $root managed = [$map_of_taobh_thiar]; var $root owned = [$map_of_taobh_thiar]; new object $mail_message: $has_text, $mail_root; var $root child_index = 480; var $root fertile = 1; var $root inited = 1; var $root created_on = 796268969; var $root owned = [$help_driver_structure_expressions_splicing, $help_objects, $help_func_dblog, $help_cmds_emote, $help_cmds_tosay, $help_func_set_heartbeat, $help_func_shutdown, $help_driver_objects_objectmethods, $filters, $wrap_filter, $lock_parser, $help_list_maps, $help_list_other, $inside_lock_frob, $indirect_lock_frob, $help_driver_structure_expressions_loopingexpressions, $help_driver_structure_statements_simplestatements, $help_driver_structure_statements_conditionalstatements, $owner_lock_frob, $symbol, $help_func_caller, $help_driver_structure_statements_loopingstatements, $help_driver_structure_statements_errorhandlingstatements, $help_coldc, $math, $help_driver_objects_objectvariables, $help_cmds_whisper, $help_func_insert, $help_func_listlen, #540, $english_lib, $help_func_listgraft, $help_func_replace, $help_func_setadd, $help_func_setremove, $help_cmds_spoof, #545, $help_func_sublist, $time, $help_func_fflush, $help_func_union, $help_driver_objects, $help_func_cwritef, $help_func_definer, $help_func_fseek, $world_time, $help_func_file, $graph, $help_node_editor_commands, $help_node_editor_programming, $help_driver_structure_types_typecomparison, $help_obj_events, $help_cmds_backup, $heap, $help_func_open_connection, $place_lib, $mail_message, $help_driver_objects_special, $help_func_reassign_connection, $help_func_method, $help_func_unbind_port, $help_func_bind_function, $help_func_pause, $help_func_ticks_left, $data_lib, $frob, $help_func_fwrite, $network, $help_func_sender, $help_func_refresh, $help_cmds_core, $help_func_crypt, $user_parsers, $help_cmds_kill, $help_cmds_mojo, $help_cmds_newpwd, $help_cmds_reap, $help_func_suspend, $help_func_stack, $help_func_task_id, $connection_interface, $login_interface, $help_node_channels, $help_list_sets, $smtp_interface, $login_connection, $help_func_files, $http_connection, $outbound_connection, $smtp, $smtp_connection, $veil_connection, $veil_daemon, $logic_frob, $xor, $and, $and_lock_frob, $help_func_tasks, $help_func_this, $help_func_tick, $lock_frob, $not, $not_lock_frob, $or, $or_lock_frob, $help_func_fmkdir, $help_func_error, $true, $false, $false_lock_frob, $climate, $exit, $coord_exit, $help_func_resume, $help_func_cancel, $help_func_explode, $help_func_lowercase, $read_parser, #531, $help_func_match_begin, $help_func_rethrow, $callback, $message_frob, $tag, $climate_frob, $rect, $rtree, $utilities, $motd, $heart, $housekeeper, $help_cmds_rehashall, $compiler, $evaluator, $bs_eval, $place_desc_evaluator, $realm_base_eval, $formatter, $help_func_traceback, $wrapped_text_format, $help_func_ctime, $help_func_match_pattern, $help_func_atomic, $help_func_localtime, $help_func_mtime, $help_func_time, $help_driver_structure_types, $html_format, $uncompiler, $help_cmds_shutdown, $help_func_add_var, $help_func_clear_var, $antisocial, $help_func_unbind_function, $help_func_frename, #532, #533, $social, #528, $help_func_class, $help_func_size, $help_func_toerr, $help_func_tofloat, $help_func_toint, #594, $help_func_del_var, $editor, $help_func_match_regexp, #497, $help_func_get_var, $help_func_toliteral, $help_func_toobjnum, $help_func_tostr, $climate_taobh_thiar, $help_func_match_template, $help_cmds_tasks, $help_cmds]; var $root flags = ['methods, 'code, 'fertile, 'core, 'variables]; var $root quota_exempt = 1; var $mail_message readers = []; var $mail_message header = #[]; var $mail_message delivered = 0; var $root manager = $mail_message; var $root managed = [$mail_message]; var $mail_message creator = 0; public method .del_recipient(): nooverride { arg whom; var rcpts; if (!($mail_lib.has_mail_perms(caller()))) (> .perms(sender()) <); rcpts = (header['rcpt]).setremove(whom); if (!rcpts) .destroy(); else header = header.add('rcpt, rcpts); }; public method .add_recipient(): nooverride { arg whom; var current; if (!($mail_lib.has_mail_perms(caller()))) (> .perms(sender()) <); current = (| header['rcpt] |) || []; if ((| whom in current |)) throw(~type, "Recipient is already in the list of recipients"); header = header.add('rcpt, current.union([whom])); }; public method .letter(): nooverride { if (!($mail_lib.has_mail_perms(caller()))) (> .perms(sender()) <); return (.header()).add('text, .text()); }; public method .readers(): nooverride { if (!($mail_lib.has_mail_perms(caller()))) (> .perms(sender()) <); return readers; }; public method .did_read(): nooverride { if (!($mail_lib.has_mail_perms(caller()))) (> .perms(sender()) <); if ($guest in (sender().parents())) return; readers += [sender()]; }; public method .set_time(): nooverride { arg time; if (!($mail_lib.has_mail_perms(caller()))) (> .perms(sender()) <); header = header.add('time, time); }; public method .set_recipients(): nooverride { arg whom; if (!($mail_lib.has_mail_perms(caller()))) (> .perms(sender()) <); header = header.add('rcpt, whom); }; public method .set_subject(): nooverride { arg what; if (!($mail_lib.has_mail_perms(caller()))) (> .perms(sender()) <); header = header.add('subj, what); }; public method .set_from(): nooverride { arg whom; if (!($mail_lib.has_mail_perms(caller()))) (> .perms(sender()) <); header = header.add('from, whom); }; public method .add_reader(): nooverride { arg who; if (!($mail_lib.has_mail_perms(caller()))) (> .perms(sender()) <); readers = readers.union([who]); }; public method .recipients(): nooverride { if (!($mail_lib.has_mail_perms(caller()))) (> .perms(sender()) <); return (| header['rcpt] |) || [$no_one]; }; public method .from(): nooverride { if (!($mail_lib.has_mail_perms(caller()))) (> .perms(sender()) <); return (| header['from] |) || $no_one; }; public method .subject(): nooverride { return (| header['subj] |) || "<none>"; }; public method .time(): nooverride { if (!($mail_lib.has_mail_perms(caller()))) (> .perms(sender()) <); return (| header['time] |) || 0; }; public method .format(): nooverride { var output, o, h; if (!($mail_lib.has_mail_perms(caller()))) (> .perms(sender()) <); h = .header(); return (["From: " + ($object_lib.get_name(h['from], 'namef, ['ref])), "To: " + (((h['rcpt]).omap($mail_lib, 'mail_name)).to_english()), "When: " + ($time.format("%I:%M %p %v", h['time])), "Subject: " + (h['subj]), "---"] + (.text())) + ["---"]; }; public method .header(): nooverride { var h, d; (> .perms(sender()) <); h = #[['from, $no_one], ['rcpt, [$no_one]], ['subj, "<none>"], ['time, 0]]; for d in (header) h = h.add(@d); return h; }; root method .uninit_mail_message() { var r; for r in (.recipients()) (| r.del_mail(this(), (| (.from()) || this() |)) |); header = #[]; readers = []; }; root method .init_mail_message() { header = #[]; readers = []; .set_flags([]); }; public method .has_read(): nooverride { arg who; return who in readers; }; public method .text() { return (> pass() <) || ["", "(no message)", ""]; }; public method .send() { arg [recips]; var r, valid, invalid; if (!($mail_lib.has_mail_perms(caller()))) (> .perms(sender()) <); if (delivered) throw(~delivered, "This mail has already been delivered."); if (!recips) recips = .recipients(); if (((recips.length()) == 1) && ((recips[1]) == $no_one)) throw(~norcpt, "No recipients specified."); valid = []; invalid = []; for r in (recips) { if (r.has_ancestor($mail_list)) valid += [r]; else invalid += [r]; } if (invalid) throw(~invrcpt, "Invalid mail recipients: " + (invalid.mmap('name)), invalid); recips = valid; invalid = []; // ok, now that we have that cleared up, lets set pertinent info... .set_time(time()); .set_from(sender()); // and now to finalize the recipients for r in (recips) { if (r.list_is_sendable_by(sender())) { r.add_mail(); .add_recipient(r); } else { invalid += [r]; } } delivered = 1; return invalid; }; public method .new_mail(): nooverride { var new; // if (!$mail_lib.has_mail_perms(caller())) // (> .perms(sender()) <); if (definer() != this()) throw(~perm, "Only spawn mail from $mail_message."); new = .spawn(); new.add_writer(sender()); // since anybody can create mail, do some tracking.. new.set_creator(user()); return new; }; public method .creator() { return creator; }; public method .set_creator() { arg who; (> .perms(caller(), definer()) <); creator = who; }; new object $itext: $has_text; var $root child_index = 2; var $root fertile = 1; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'fertile, 'variables, 'core]; var $has_text text = ["hello", "this", "world"]; var $itext all_text = #[["foo", [["hello", "world"], ""]], ["bar", [["hello", "this", "world"], ""]]]; var $itext current = "foo"; var $root manager = $itext; var $root owned = [$itext]; var $root managed = [$itext]; public method .current() { return current; }; public method .topics() { return all_text.keys(); }; public method .set_desc() { arg desc, [topic]; // set the description for a topic // The description is a short text string meant for use in an index // if <topic> is not given assume current [(topic ?= current)] = topic; if (topic in (all_text.keys())) all_text = all_text.add(topic, (all_text[topic]).replace(2, short_desc)); else throw(~topicnf, ("Topic " + topic) + " not found."); }; public method .store() { arg [topic]; [(topic ?= current)] = topic; if (!(topic in (all_text.keys()))) all_text = all_text.add(topic, [.text(), ""]); all_text = all_text.add(topic, (all_text[topic]).replace(1, .text())); }; public method .set_current() { arg topic; current = topic; if (topic in (all_text.keys())) .set_text((all_text[topic])[1]); else .set_text([]); }; public method .get_topic() { arg topic, [who]; if (topic in (all_text.keys())) return (all_text[topic])[1]; else throw(~topicnf, ("Topic " + topic) + " not found."); }; root method .init_itext() { current = ""; all_text = #[]; }; public method .get_desc() { arg topic, [who]; if (topic in (all_text.keys())) return (all_text[topic])[2]; else throw(~topicnf, ("Topic " + topic) + " not found."); }; new object $db: $misc; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'core, 'variables]; var $db database = #[]; var $root manager = $db; var $root child_index = 1; var $root owned = [$db]; var $root managed = [$db]; root method .init_db() { database = #[]; }; public method .database() { return database; }; public method .value_changed() { arg key, new_value; // change the value of a key. if ((!(sender() == this())) && (!(.trusts(caller())))) (> .perms(sender(), 'writer) <); (> .remove(key) <); (> .insert(key, new_value) <); }; public method .remove() { arg key; // remove a key/value from the database if ((!(sender() == this())) && (!(.trusts(caller())))) (> .perms(sender(), 'writer) <); database = database.del(key); }; public method .exact_match() { arg key; var match; // get an exact match of a key, return the value match = (| (type(database) == 'dictionary) ? database[key] : ((database.match_exact(key))[2]) |); if (match == ~keynf) throw(~matchnf, "No object by that key exists in the database."); return match; }; public method .match_begin() { arg key; var matches, entry; // First check if we're using $trie frob if (type(database) == 'frob) { matches = (| (database.match_begin(key))[2] |); if (matches == ~keynf) throw(~matchnf, "No entries in the database match that key."); if (matches == ~ambig) throw(~ambig, "More than one object matches that key."); return matches; } // use match_begin of the key, return the value matches = [(| .exact_match(key) |)]; if (!(matches[1])) { matches = []; for entry in (database) { if ($string.match_begin(entry[1], key)) matches += [entry[2]]; } } if (matches) { if ((matches.length()) == 1) return matches[1]; else throw(~ambig, "More than one object matches that key.", matches); } else { throw(~matchnf, "No entries in the database match that key."); } }; public method .insert() { arg key, value; // insert a key/value to the database if ((!(sender() == this())) && (!(.trusts(caller())))) (> .perms(sender(), 'writer) <); database = database.add(key, value); }; root method .uninit_db() { database = 0; }; public method .key_changed() { arg old_key, new_key; var val; // change the value of a key. if ((!(sender() == this())) && (!(.trusts(caller())))) (> .perms(sender(), 'writer) <); val = (> .exact_match(old_key) <); .remove(old_key); .insert(new_key, val); }; protected method .set_database() { arg newdb; // this should not be called often, its primarily for corification database = newdb; }; protected method .clean_database() { var elem; // clean up a "STR"=>$obj style database for elem in (database) { if (!valid(elem[2])) database = database.del(elem[1]); } }; new object $registry: $db; var $root fertile = 1; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'fertile, 'variables, 'core]; var $db database = #[]; var $registry stripped_characters = ""; var $registry min_char_len = 0; var $registry max_char_len = 0; var $registry max_word_len = 0; var $registry reserved_names = []; var $registry invalid_names = []; var $root manager = $registry; var $root managed = [$registry]; var $root owned = [$registry]; var $registry stripped = 0; public method .set_max_word_len() { arg value; (> .perms(sender(), 'manager) <); if (type(value) != 'integer) throw(~type, "Value is not an integer"); max_word_len = value; }; public method .set_max_char_len() { arg value; (> .perms(sender(), 'manager) <); if (type(value) != 'integer) throw(~type, "Value is not an integer"); max_char_len = value; }; public method .set_min_char_len() { arg value; (> .perms(sender(), 'manager) <); if (type(value) != 'integer) throw(~type, "Value is not an integer"); min_char_len = value; }; public method .insert() { arg name, obj; // registers obj with obj.name if ((!(.trusts(caller()))) && ((!sender()) == this())) throw(~perm, "Permission denied."); name = .strip_key(name); (> pass(name, obj) <); }; public method .remove() { arg name; // removes the object from the database. // THIS: is what is broken with guests, should fix it. if ((!(.trusts(caller()))) && (sender() != this())) throw(~perm, "Permission denied."); name = .strip_key(name); (> pass(name) <); }; public method .database() { if (!(.has_flag('variables, sender()))) throw(~perm, "Database is not readable by sender."); return (> pass() <); }; public method .exact_match() { arg name; // returns a direct match of the name (if there is one) if (!(.has_flag('variables, sender()))) throw(~perm, "Database is not readable by sender."); name = .strip_key(name); return (> pass(name) <); }; public method .valid_name() { arg name; var word, sname, matched_obj, m; // returns 1 if the name is valid /// if (!.has_flag('variables,sender())) // throw(~perm, "Database is not readable by sender."); (> .perms(caller(), 'trusts) <); // check name itself first sname = name; name = .strip_key(name); if (max_word_len && (listlen(name.explode()) > max_word_len)) throw(~invname, ("Names can only be " + max_word_len) + " words long."); if (min_char_len && (strlen(sname) < min_char_len)) throw(~invname, ("Names must have at least " + min_char_len) + " alpha-numeric characters in them"); if (max_char_len && ((name.length()) > max_char_len)) throw(~invname, ("Names can only be " + max_char_len) + " characters long."); // see if it already exists if ((| (matched_obj = .exact_match(name)) |)) { if (matched_obj != sender()) throw(~invname, ("The name \"" + name) + "\" is already taken."); } // check reserved and invalid names if (reserved_names && (word in reserved_names)) throw(~invname, ("`" + word) + "' is a reserved name."); if (invalid_names && (m = regexp(name, invalid_names))) throw(~invname, ("`" + (m[2])) + "' is not allowed as part of a name."); }; public method .match_begin() { arg name; var matches, obj; // returns a direct match, or partial matches name = .strip_key(name); return (> pass(name) <); }; public method .strip_key() { arg key; anticipate_assignment(); if (stripped) return key.strip(); return key; }; public method .key_changed() { arg old_name, new_name; // adjusts the database for the new name if ((!(.trusts(caller()))) && (sender() != this())) throw(~perm, "Permission denied."); old_name = .strip_key(old_name); new_name = .strip_key(new_name); (> pass(old_name, new_name) <); }; public method .search() { arg name; var tmp; name = .strip_key(name); name || throw(~namenf, "No matches found."); tmp = (| .exact_match(name) |); if (tmp) return tmp; catch any { tmp = (> .match_begin(name) <); } with { switch (error()) { case ~ambig: rethrow(error()); default: throw(~namenf, "No matches found."); } } return tmp; }; new object $mail_db: $registry, $mail_root; var $root trusted = [$mail_list]; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'core, 'variables]; var $db database = #[["chatter", $help_help_options], ["core", $help_help_navigating], ["server", $help_commands_matching], ["qooc", $help_conventions], ["news", $mail_list_news], ["bugs", $mail_list_bugs]]; var $root manager = $mail_db; var $root managed = [$mail_db]; var $root owned = [$mail_db]; public method .valid_recipient() { arg recip; if (recip.has_ancestor($mail_list)) return 1; return 0; }; public method .mail_name() { arg obj; return "*" + (obj.name()); // $# Edited 05 Nov 1995 14:04 Lynx ($lynx) }; new object $place_db: $registry; var $root trusted = 1; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'variables, 'core]; var $db database = #[["void", $void], ["nowhere", $nowhere], ["The Pit", $the_pit]]; var $registry stripped_characters = "!@#$%^&*()_+-=~`'{}[]|/?\",.<>;:"; var $root manager = $place_db; var $root managed = [$place_db]; var $root owned = [$place_db]; public method .place_destroyed() { // called in $place.uninit_place (incase the place is in the db) }; new object $user_db: $registry; var $root trusted = [$user]; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'variables, 'code, 'core]; var $db database = <$trie, [0, "GRNps", [0, "e", [0, "n", [0, "e", [0, "r", [0, "i", [0, "c", [0, "GBPAU", [["uestObject", $guest], ""], [["uilder", $builder], ""], [["rogrammer", $programmer], ""], [["dmin", $admin], ""], [["serObject", $user], ""]]]]]]]], [["eaper", $reaper], ""], [["oOne", $no_one], ""], [["layer", $player], ""], [["toryteller", $storyteller], ""]]>; var $user_db connected = []; var $user_db invalid_chars = "$#@!^&%~"; var $registry stripped_characters = "!@#$%^&*()_+-=~`'{}[]|/?\",.<>;: "; var $registry reserved_names = ["user", "builder", "programmer", "admin", "housekeeper", "Reaper", "noone", "guest", "a", "i", "an", "your", "you'r", "me", "god"]; var $registry invalid_names = "(^| )(ass|cunt|fuck|shit|damn)( |$)"; var $registry min_char_len = 3; var $registry max_char_len = 20; var $root manager = $user_db; var $root managed = [$user_db]; var $root owned = [$user_db]; var $registry stripped = 1; public method .users() { return (.database()).keys(); }; public method .connected() { var x; for x in (connected) { if ((!valid(x)) || (| !(x.connections()) |)) connected = connected.setremove(x); } return connected; }; public method .did_connect() { (> .perms(caller(), $user) <); connected = connected.setadd(sender()); }; public method .did_disconnect() { .perms(caller(), $user); connected = connected.setremove(sender()); }; public method .valid_name() { arg name; if (((name.strip(invalid_chars)).length()) < (name.length())) throw(~invname, ("Names cannot contain any of '" + invalid_chars) + "'."); return (> pass(name) <); }; public method .match() { arg name; return (> .search(name) <); }; public method .total_connected() { return (.connected()).length(); }; public method .clean_user_db() { var key, db, invalid; db = .database(); invalid = []; for key in ((.database()).keys()) { if (!valid(db[key])) { .remove(key); connected = connected.setremove(key); invalid += [key]; } } return ["Invalid $user_db entries: " + (invalid.to_english())]; }; root method .core_user_db(): nooverride { var o; .set_database($trie.new()); for o in (($user.descendants()) + [$user]) .insert(o.name(), o); }; new object $help_node: $has_name; var $root child_index = 9; var $root fertile = 1; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'fertile, 'variables, 'core]; var $has_name name = ['uniq, "help_node", "the help_node"]; var $help_node links = 0; var $help_node body = 0; var $root trusted_by = [$help_index_driver, $help_index_core, $help_index_cmds, $help_index_subsystem, $help_index_function, $help_index_objects, $help_updates]; var $root manager = $help_node; var $help_node group = 0; var $root owned = [$help_node]; var $foundation edit_types = ["help"]; var $has_settings local_settings = ["nolist"]; var $has_settings defined_settings = #[["nolist", #[['get, 'nolist], ['set, 'set_nolist], ['check, 'is_boolean], ['del, 'delete_local_setting], ['check_args, []], ['get_args, []], ['set_args, []], ['type, "boolean"], ['display, 'display_boolean_yes_no]]], ["group", #[['get, 'group], ['set, 'set_group], ['check, 'is_boolean], ['del, 'delete_local_setting], ['check_args, []], ['get_args, []], ['set_args, []], ['type, "boolean"], ['display, 'display_boolean_yes_no]]], ["index", #[['get, 'get_index_setting], ['set, 'set_index_setting], ['check, 'check_index_setting], ['del, 'delete_local_setting], ['check_args, []], ['get_args, []], ['set_args, []], ['display, 'display_index]]]]; var $help_node nolist = 1; var $help_node index = 0; var $root managed = [$help_node]; root method .init_help_node() { links = #[]; .set_body(["This node isn't written yet"]); }; root method .uninit_help_node() { var obj; (| index.node_going_away() |); links = #[]; title = ""; body = []; }; public method .index_going_away() { (> .perms(caller(), $help_index) <); (| clear_var('index) |); }; public method .set_body() { arg new_body; var new_body, anchors, key, keys, values, value; (> .perms(sender()) <); // Compile a string into help ctext new_body = $compiler.compile_cml(new_body); body = new_body; anchors = (| new_body.get_var('links) |) || #[]; body = (<$ctext_frob, [body._ctext(), (| (body.vars()).del('links) |) || (body.vars())]>); keys = anchors.keys(); values = anchors.values(); links = #[]; for key in (keys) links = links.add(key, $object_lib.to_dbref(anchors[key])); if ((!(.has_ancestor($help_index))) && (!(this() == $help_updates))) $help_updates.touched(); }; public method .body() { return body; }; public method .links() { return links || #[]; }; public method .node_going_away() { var node; (> .perms(caller(), $help_node) <); node = sender(); // do something intelligent with the text body as well links = links.del(node); }; protected method .get_index_setting() { arg [args]; return index || 0; }; protected method .check_index_setting() { arg definer, value, [args]; var i; if (value && ((value[1]) == "$")) { i = (> $object_lib.to_dbref(value) <); if (!(i.has_ancestor($help_index))) throw(~bad, ("\"" + (i.namef('ref))) + "\" is not a help index."); } else { value = strsed(value, " *index *", ""); if (!(i = $help_index.match_children(value))) throw(~bad, ("\"" + (i.namef('ref))) + "\" is not a help index."); } return i; }; protected method .set_index_setting() { arg definer, name, value, [args]; ._set_index(value); }; public method .node_name() { var name; if (this() == definer()) return ""; name = ((.parents())[1]).node_name(); if (!name) return .name(); return (name + ": ") + (.name()); }; public method .html_node_name() { var name; if (this() == definer()) return ""; name = ((.parents())[1]).html_node_name(); if (!name) return .name(); return ((((name + ": <a href=\"/bin/help?node=") + this()) + "\">") + (.name())) + "</a>"; }; public method .set_name() { arg new, [ignore]; var old; if ("=" in new) throw(~perm, "You cannot have \"=\" in a help node name."); old = .name(); (> pass(new, 'prop) <); if (index) index.node_changed_name(old); }; public method .edit_help() { var p; (> .perms(sender()) <); p = (.body()).uncompile(); (> sender().invoke_editor(this(), '_edit_help_callback, p, []) <); }; public method ._edit_help_callback() { arg text, client_data; (> .perms(sender()) <); .set_body(text); return "Help node body set."; }; public method .group() { arg [args]; return !group; }; public method .nolist() { arg [args]; return nolist; // whether or not this node should be listed as a 'descendant' node of // its parent. }; protected method .set_group() { arg definer, name, value, [args]; // invert it, more db friendly this way since 99% of the nodes want groups value = !value; if (value) group = value; else (| clear_var('group) |); }; protected method .set_nolist() { arg definer, name, value, [args]; nolist = value; }; public method .top_of_help_heirarchy() { return definer() == this(); }; public method .index() { return index; }; public method .set_index() { arg index; (> .perms(sender()) <); return (> ._set_index(index) <); }; protected method ._set_index() { arg i; if (index) (| index.del_help_node(this()) |); index = i; (> index.add_help_node(this()) <); }; protected method .display_index() { arg value; if (!value) return ""; return (((value.name()) + " INDEX (") + value) + ")"; }; new object $help_node_cml: $help_node; var $root fertile = 1; var $root manager = $help_node_cml; var $root owned = [$help_node_cml]; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'fertile, 'variables, 'core]; var $root managed = [$help_node_cml]; var $has_name name = ['prop, "Cold Markup Language (CML)", "Cold Markup Language (CML)"]; var $help_node links = #[["Generators", $help_node_generators], ["Formatters", $help_node_formatters], ["Programming", $help_node_cml_prog]]; var $help_node body = <$ctext_frob, [["Cml (Cold Markup Language) is used to generate and format text. Cml is made of tags embedded in strings. Tags come in two variaties.", <$format, ["br", [], [], 'do_br]>, <$format, ["dl", [], [<$format, ["dt", [], ["generator"], 'do_dt]>, <$format, ["dd", [], ["[<name> <options>:<arguments>]"], 'do_dd]>, <$format, ["dt", [], ["formatter"], 'do_dt]>, <$format, ["dd", [], ["{<name> <options>:<arguments>}"], 'do_dd]>], 'do_dl]>, <$format, ["subj", [["level", "2"]], ["Options"], 'do_subj]>, "The exact behaviour of a tag may be controlled using options (sometimes called flags). An option is specified in one of two ways.", <$format, ["br", [], [], 'do_br]>, <$format, ["dl", [], [<$format, ["dt", [], ["key=value"], 'do_dt]>, <$format, ["dd", [], ["sets the option named key to value"], 'do_dd]>, <$format, ["dt", [], ["key"], 'do_dt]>, <$format, ["dd", [], ["sets the option named key to true (always defaults to false)."], 'do_dd]>], 'do_dl]>, <$format, ["br", [], [], 'do_br]>, "Options may be specified in any order.", <$format, ["br", [], [], 'do_br]>, <$format, ["subj", [["level", "2"]], ["Arguments"], 'do_subj]>, "Most tags can also take a number of arguments. How arguments are handled depends on whether the tag is a generator or a formator. A generator will treat it's arguments as a space seperated list. A formator will treat it's argument as a single string.", <$format, ["br", [], [], 'do_br]>, <$format, ["br", [], [], 'do_br]>, <$format, ["link", [["node", "$help_node_2"]], ["Generators"], 'do_link]>, <$format, ["br", [], [], 'do_br]>, <$format, ["link", [["node", "$help_node_3"]], ["Formatters"], 'do_link]>, <$format, ["br", [], [], 'do_br]>, <$format, ["link", [["node", "$help_node_cml_prog"]], ["Programming"], 'do_link]>], #[['this, $help_node_cml]]]>; var $root child_index = 1; new object $help_node_cml_prog: $help_node_cml; var $root manager = $help_node_cml_prog; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 837752811; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "Cml programming", "Cml programming"]; var $help_node links = #[]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "2"]], ["Interface"], 'do_subj]>, "ctext frobs are created by calling compile_cml method off the cml compiler object. On a frob, you can do .uncompile (returns the original text), eval_ctext (evaluates the generators, but will not touch the formatters. This is used to speed up message dispatching) and format (final formatting of the ctext). You can add/modify variables on a frob by set_var(variable, value) call, or with set_vars(dict) (same, with multiple variables getting modified).", <$format, ["subj", [["level", "2"]], ["Adding new evaluators"], 'do_subj]>, "Evaluator is an object which contains methods for generation or formatting. Evaluation object descended from vanilla evaluator will try to store the evaluation results in a list, and is therefore most suitable for adding new generators. On the other hand, evaluators descended from a formatter object create string, and try to evaluate and concatenate lists until a string is obtained. Hence, you want to use them for formatting. To add a new generator or formatter, simply add a do_format or gen_generator method on the object, and make sure that the object is in the evaluation path (by explicitely adding 'evaluator, 'formatter or evan 'uncompiler field to the ctext frob.)"], #[['this, $help_node_cml_prog]]]>; var $root inited = 1; var $root managed = [$help_node_cml_prog]; var $root owned = [$help_node_cml_prog]; new object $help_core: $help_node; var $root manager = $help_core; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'variables, 'core]; var $has_name name = ['prop, "Cold Help System", "Cold Help System"]; var $help_node links = #[["Help", $help_help], ["General", $help_general], ["Building", $help_building], ["Programming", $help_prog], ["Reference", $help_reference], ["Updates", $help_updates]]; var $help_node body = <$ctext_frob, [[<$format, ["quote", [], ["\n ___ _ _ _ _ _ ___ _\n / __|___| |__| | | || |___| |_ __ / __|_ _ __| |_ ___ _ __\n | (__/ _ \ / _` | | __ / -_) | '_ \ \__ \ || (_-< _/ -_) ' \ \n \___\___/_\__,_| |_||_\___|_| .__/ |___/\_, /__/\__\___|_|_|_|\n |_| |__/\n \n"], 'do_quote]>, " Welcome to ", <$generator, ["server_name", [], [], 'gen_servername]>, ". This is a hypertext help system. If you are on an interactive login you can type ", <$format, ["tt", [], ["@help help"], 'do_tt]>, " for help on how to use this help system. Following is a list of Launch Points to the help system: ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["dl", [["columned", 1]], [<$format, ["dt", [], [" ", <$format, ["b", [], [<$format, ["link", [["node", "$help_help"]], ["Help"], 'do_link]>], 'do_b]>], 'do_dt]>, <$format, ["dd", [], [" How to use this help system"], 'do_dd]>, <$format, ["dt", [], [" ", <$format, ["b", [], [<$format, ["link", [["node", "$help_general"]], ["General"], 'do_link]>], 'do_b]>], 'do_dt]>, <$format, ["dd", [], [" General Information"], 'do_dd]>, <$format, ["dt", [], [" ", <$format, ["b", [], [<$format, ["link", [["node", "$help_building"]], ["Building"], 'do_link]>], 'do_b]>], 'do_dt]>, <$format, ["dd", [], [" Extending your Environment"], 'do_dd]>, <$format, ["dt", [], [" ", <$format, ["b", [], [<$format, ["link", [["node", "$help_prog"]], ["Programming"], 'do_link]>], 'do_b]>], 'do_dt]>, <$format, ["dd", [], [" Topics about programming"], 'do_dd]>, <$format, ["dt", [], [" ", <$format, ["b", [], [<$format, ["link", [["node", "$help_reference"]], ["Reference"], 'do_link]>], 'do_b]>], 'do_dt]>, <$format, ["dd", [], [" Core Reference Information"], 'do_dd]>, <$format, ["dt", [], [" ", <$format, ["b", [], [<$format, ["link", [["node", "$help_updates"]], ["Updates"], 'do_link]>], 'do_b]>], 'do_dt]>, <$format, ["dd", [], [" ChangeLog for this system"], 'do_dd]>], 'do_dl]>], #[['this, $help_core]]]>; var $root managed = [$help_core]; var $root owned = [$help_core]; var $help_node group = 1; var $has_settings local_settings = ["islist", "group"]; var $help_node index = $help_index_core; new object $help_help: $help_core; var $root manager = $help_help; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'variables, 'core]; var $has_name name = ['prop, "Help", "Help"]; var $help_node links = #[["Help", $help_help], ["Options", $help_help_options], ["Navigating", $help_help_navigating]]; var $help_node body = <$ctext_frob, [[<$format, ["p", [], [], 'do_p]>, "This is a hypertextual help system. Hypertext is simply a dynamic form of text, where words within a document may have special meaning, and point to other documents or portions of the document. These words are called ", <$format, ["em", [], ["hyperlinks"], 'do_em]>, ". In a windowed browser hyperlinks may be displayed differently from the regular text by colorization. Over a terminal we specify hyperlinks by enclosing them in square brackets (", <$format, ["tt", [], ["[]"], 'do_tt]>, "), such as: ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["dfn", [], [" ", <$format, ["link", [["node", "$help_help"]], ["Help"], 'do_link]>], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, "You can use the command ", <$format, ["tt", [], ["@help"], 'do_tt]>, " to navigate the ", <$generator, ["server_name", [], [], 'gen_servername]>, "'s help system, when on an interactive connection. If this command is used with a word or group of words, such as: ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["dfn", [], [" @help VR Commands"], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, "It will first attempt to find the word(s) as one of the hyperlinks from your current page. If it fails at this, it will attempt to lookup the word as a topic in the help indices. If this also fails, it will return a message explaining that it could not find help on that topic. ", <$format, ["p", [], [], 'do_p]>, "Therefore, to activate a hyperlink from a page you are reading, simply type ", <$format, ["tt", [], ["@help"], 'do_tt]>, " and the name of the hyperlink. For instance, if the hyperlink was ", <$format, ["link", [["node", "$help_help"]], ["Help"], 'do_link]>, ", typing ", <$format, ["tt", [], ["@help help"], 'do_tt]>, " would activate the link. ", <$format, ["p", [], [], 'do_p]>, "Other Help topics: ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["dl", [["columned", 1]], [<$format, ["dt", [], [" ", <$format, ["b", [], [<$format, ["link", [["node", "$help_help_options"]], ["Options"], 'do_link]>], 'do_b]>], 'do_dt]>, <$format, ["dd", [], [" Options and shortcuts to @help"], 'do_dd]>, <$format, ["dt", [], [" ", <$format, ["b", [], [<$format, ["link", [["node", "$help_help_navigating"]], ["Navigating"], 'do_link]>], 'do_b]>], 'do_dt]>, <$format, ["dd", [], [" Hints on navigating Help"], 'do_dd]>], 'do_dl]>], #[['this, $help_help]]]>; var $root managed = [$help_help]; var $root owned = [$help_help]; var $help_node index = $help_index_core; new object $help_help_options: $help_help; var $root manager = $help_help_options; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 847650584; var $has_name name = ['prop, "Help Options", "Help Options"]; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $help_node links = #[["Command Matching Conventions", $help_commands_matching]]; var $help_node body = <$ctext_frob, [[<$format, ["p", [], [], 'do_p]>, "Available options for the command ", <$format, ["tt", [], ["@help"], 'do_tt]>, " are: ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["dl", [["columned", 1]], [<$format, ["dt", [], [" ", <$format, ["b", [], ["-h?istory"], 'do_b]>], 'do_dt]>, <$format, ["dd", [], [" Display your help page history"], 'do_dd]>, <$format, ["dt", [], [" ", <$format, ["b", [], ["-b?ack"], 'do_b]>], 'do_dt]>, <$format, ["dd", [], [" Go back one page in your history"], 'do_dd]>, <$format, ["dt", [], [" ", <$format, ["b", [], ["-b?ack ", <$format, ["em", [], ["name"], 'do_em]>], 'do_b]>], 'do_dt]>, <$format, ["dd", [], [" Go back to page ", <$format, ["em", [], ["name"], 'do_em]>, " in your history"], 'do_dd]>, <$format, ["dt", [], [" ", <$format, ["b", [], ["-f?orward"], 'do_b]>], 'do_dt]>, <$format, ["dd", [], [" Go forward one page your history"], 'do_dd]>, <$format, ["dt", [], [" ", <$format, ["b", [], ["-f?orward ", <$format, ["em", [], ["name"], 'do_em]>], 'do_b]>], 'do_dt]>, <$format, ["dd", [], [" Go forward to page ", <$format, ["em", [], ["name"], 'do_em]>, " in your history"], 'do_dd]>, <$format, ["dt", [], [" ", <$format, ["b", [], ["-u?p"], 'do_b]>], 'do_dt]>, <$format, ["dd", [], [" Go up to the parent node of the current node"], 'do_dd]>, <$format, ["dt", [], [" ", <$format, ["b", [], ["-fix"], 'do_b]>], 'do_dt]>, <$format, ["dd", [], [" Fix your history, useful if it becomes corrupt"], 'do_dd]>, <$format, ["dt", [], [" ", <$format, ["b", [], ["-l?inks"], 'do_b]>], 'do_dt]>, <$format, ["dd", [], [" List all of the links off the current help page"], 'do_dd]>], 'do_dl]>, " ", <$format, ["p", [], [], 'do_p]>, "The question mark ", <$format, ["tt", [], ["?"], 'do_tt]>, " specifies that characters following it are optional, (following the standard ", <$format, ["link", [["node", "$help_commands_matching"]], ["Command Matching Conventions"], 'do_link]>, "). ", <$format, ["p", [], [], 'do_p]>, "For convenience, you can use the command shortcut ", <$format, ["tt", [], ["?"], 'do_tt]>, " instead of ", <$format, ["tt", [], ["@help"], 'do_tt]>, ". ", <$format, ["subj", [["level", "3"]], ["Option Shortcuts"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, "Options have shorthand equivalents, as follows: ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["dl", [["columned", 1]], [<$format, ["dt", [], [" ", <$format, ["b", [], ["?"], 'do_b]>], 'do_dt]>, <$format, ["dd", [], [" -history"], 'do_dd]>, <$format, ["dt", [], [" ", <$format, ["b", [], ["<"], 'do_b]>], 'do_dt]>, <$format, ["dd", [], [" -back"], 'do_dd]>, <$format, ["dt", [], [" ", <$format, ["b", [], ["<", <$format, ["em", [], ["name"], 'do_em]>], 'do_b]>], 'do_dt]>, <$format, ["dd", [], [" -back ", <$format, ["em", [], ["name"], 'do_em]>], 'do_dd]>, <$format, ["dt", [], [" ", <$format, ["b", [], [">"], 'do_b]>], 'do_dt]>, <$format, ["dd", [], [" -forward"], 'do_dd]>, <$format, ["dt", [], [" ", <$format, ["b", [], [">", <$format, ["em", [], ["name"], 'do_em]>], 'do_b]>], 'do_dt]>, <$format, ["dd", [], [" -forward ", <$format, ["em", [], ["name"], 'do_em]>], 'do_dd]>, <$format, ["dt", [], [" ", <$format, ["b", [], ["^"], 'do_b]>], 'do_dt]>, <$format, ["dd", [], [" -up"], 'do_dd]>, <$format, ["dt", [], [" ", <$format, ["b", [], ["!"], 'do_b]>], 'do_dt]>, <$format, ["dd", [], [" -fix"], 'do_dd]>, <$format, ["dt", [], [" ", <$format, ["b", [], ["#"], 'do_b]>], 'do_dt]>, <$format, ["dd", [], [" -links"], 'do_dd]>], 'do_dl]>], #[['this, $help_help_options]]]>; var $root inited = 1; var $help_node index = $help_index_core; var $root managed = [$help_help_options]; var $root owned = [$help_help_options]; new object $help_help_navigating: $help_help; var $root manager = $help_help_navigating; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 847650599; var $has_name name = ['prop, "Navigating Help", "Navigating Help"]; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $help_node links = #[]; var $help_node body = <$ctext_frob, [[<$format, ["p", [], [], 'do_p]>, "You may encounter conflicts of link and node names while navigating help. This may occur if you do not specify the entire link name. Make sure when you activate a link you include enough of the link name to get a precise match (you do not always need to specify the entire link name). If you are still getting a conflict you can narrow the search parameters. First, to better understand what happens when you activate a link keep in mind the following search order: ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["dl", [["columned", 1]], [<$format, ["dt", [], [" 1."], 'do_dt]>, <$format, ["dd", [], [" Search in current page links"], 'do_dd]>, <$format, ["dt", [], [" 2."], 'do_dt]>, <$format, ["dd", [], [" Search in current page group"], 'do_dd]>, <$format, ["dt", [], [" 3."], 'do_dt]>, <$format, ["dd", [], [" Search in current page's index"], 'do_dd]>, <$format, ["dt", [], [" 4."], 'do_dt]>, <$format, ["dd", [], [" Search in all other help indices"], 'do_dd]>], 'do_dl]>, " ", <$format, ["p", [], [], 'do_p]>, "If you are having a conflict you can prefix what you are searching for with either ", <$format, ["tt", [], ["group="], 'do_tt]>, ", ", <$format, ["tt", [], ["link="], 'do_tt]>, " or ", <$format, ["tt", [], ["index="], 'do_tt]>, " and it will search only in the respective area. For instance, if you were to type: ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["dfn", [], ["?index=narf"], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, "It would bypass any links or group nodes to ", <$format, ["tt", [], ["narf"], 'do_tt]>, ", and only search in the current index and subsequent indices. Furthermore, if you specify a word other than the above, it will attempt to match only in the relevant index. Example: ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["dfn", [], ["?core=narf"], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, "Would search only in the core index, assuming it existed. Furthermore, when searching a specific index if the search word you specify is simply a hash-mark ", <$format, ["tt", [], ["#"], 'do_tt]>, ", it will set the current index as the help node."], #[['this, $help_help_navigating]]]>; var $root inited = 1; var $help_node index = $help_index_core; var $root managed = [$help_help_navigating]; var $root owned = [$help_help_navigating]; new object $help_general: $help_core; var $root manager = $help_general; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 847218948; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "General Information", "General Information"]; var $help_node links = #[["Building and Extending", $help_building], ["@help", $help_help], ["Programming", $help_prog], ["Conventions", $help_conventions], ["Objects", $help_objects], ["Environment", $help_environment], ["Commands", $help_commands], ["Interaction", $help_interaction], ["Interface", $help_interface]]; var $help_node body = <$ctext_frob, [[<$format, ["p", [], [], 'do_p]>, "General topics are covered in this area. If you need to know about describing and extending your Virtual Environment read about ", <$format, ["link", [["node", "$help_building"]], ["Building and Extending"], 'do_link]>, ". Help on a specific object may be obtained by typing ", <$format, ["link", [["node", "$help_help"]], ["@help"], 'do_link]>, " followed by the full object name. ", <$format, ["link", [["node", "$help_prog"]], ["Programming"], 'do_link]>, " help is also available. ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["dl", [["columned", 1]], [<$format, ["dt", [], [" ", <$format, ["b", [], [<$format, ["link", [["node", "$help_conventions"]], ["Conventions"], 'do_link]>], 'do_b]>], 'do_dt]>, <$format, ["dd", [], [" Conventions used in these documents"], 'do_dd]>, <$format, ["br", [], [], 'do_br]>, <$format, ["dt", [], [" ", <$format, ["b", [], [<$format, ["link", [["node", "$help_objects"]], ["Objects"], 'do_link]>], 'do_b]>], 'do_dt]>, <$format, ["dd", [], [" Learn about Objects"], 'do_dd]>, <$format, ["dt", [], [" ", <$format, ["b", [], [<$format, ["link", [["node", "$help_environment"]], ["Environment"], 'do_link]>], 'do_b]>], 'do_dt]>, <$format, ["dd", [], [" How Objects are used in your Environment"], 'do_dd]>, <$format, ["dt", [], [" ", <$format, ["b", [], ["Security"], 'do_b]>], 'do_dt]>, <$format, ["dd", [], [" How ColdCore security works"], 'do_dd]>, <$format, ["dt", [], [" ", <$format, ["b", [], [<$format, ["link", [["node", "$help_commands"]], ["Commands"], 'do_link]>], 'do_b]>], 'do_dt]>, <$format, ["dd", [], [" Learn about commands"], 'do_dd]>, <$format, ["dt", [], [" ", <$format, ["b", [], [<$format, ["link", [["node", "$help_interaction"]], ["Interaction"], 'do_link]>], 'do_b]>], 'do_dt]>, <$format, ["dd", [], [" How to interact with others"], 'do_dd]>, <$format, ["dt", [], [" ", <$format, ["b", [], [<$format, ["link", [["node", "$help_interface"]], ["Interface"], 'do_link]>], 'do_b]>], 'do_dt]>, <$format, ["dd", [], [" How to personalize your interface"], 'do_dd]>], 'do_dl]>], #[['this, $help_general]]]>; var $root inited = 1; var $help_node index = $help_index_core; var $root managed = [$help_general]; var $root owned = [$help_general]; new object $help_conventions: $help_general; var $root manager = $help_conventions; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 847225687; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "Conventions", "Conventions"]; var $help_node links = #[]; var $help_node body = <$ctext_frob, [[<$format, ["p", [], [], 'do_p]>, "Througout these documents certain conventions are used. If a document is explaining a command to be typed, it will begin with a greater-than sign (", <$format, ["tt", [], [">"], 'do_tt]>, "), such as: ", <$format, ["p", [], [], 'do_p]>, <$format, ["dfn", [], ["> command"], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, "If a document shows the syntax for a command a few conventions are used. First, words grouped within greater-than and less-than (", <$format, ["tt", [], ["<>"], 'do_tt]>, ") signs are ", <$format, ["em", [], ["variables"], 'do_em]>, " and should be replaced with what you actually type. Second, words or ", <$format, ["em", [], ["variables"], 'do_em]>, " within square brackets (", <$format, ["tt", [], ["[]"], 'do_tt]>, ") are optional. You may also see an elipse (", <$format, ["tt", [], ["..."], 'do_tt]>, ") inside square brackets. This simply means that it will accept multiple instances of the last word or ", <$format, ["em", [], ["variable"], 'do_em]>, ". The following example shows the first ", <$format, ["em", [], ["variable"], 'do_em]>, " argument is required, and more may be added: ", <$format, ["p", [], [], 'do_p]>, <$format, ["dfn", [], ["Syntax: @command <arg1> [<arg2> ...]"], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, "If a document is explaining how ColdC code may be evaluated when interpreted, the first line is the ColdC code and the second line begins with a text arrow pointing to the right (", <$format, ["tt", [], ["=>"], 'do_tt]>, ") and is followed by a ColdC data value. This represents what the example would evaluate to and return. For instance, if you called a function ", <$format, ["tt", [], ["ctime()"], 'do_tt]>, ", and it returned the value ", <$format, ["tt", [], ["\"Sun Feb 25 17:06:38 1996\""], 'do_tt]>, ", it would be listed using this convention as: ", <$format, ["p", [], [], 'do_p]>, <$format, ["dfn", [], [<$format, ["quote", [], ["ctime()\n=> \"Sun Feb 25 17:06:38 1996\""], 'do_quote]>], 'do_dfn]>], #[['this, $help_conventions]]]>; var $root inited = 1; var $help_node index = $help_index_core; var $root managed = [$help_conventions]; var $root owned = [$help_conventions]; new object $help_objects: $help_general; var $root manager = $help_objects; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 846994462; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "Objects", "Objects"]; var $help_node links = #[["Object Oriented Programming", $help_prog_oop], ["Environment", $help_environment]]; var $help_node body = <$ctext_frob, [[<$format, ["p", [], [], 'do_p]>, "Objects are the primary element of Cold. An object is an abstract concept used to aid in program design. In simple terms an object is something which contains information (data) and instructions for manipulating this information (methods or functions). ", <$format, ["p", [], [], 'do_p]>, "If you are unfamiliar with the concepts of Objects, and Object Oriented Programming, you may want to read about ", <$format, ["link", [["node", "$help_prog_oop"]], ["Object Oriented Programming"], 'do_link]>, " in the ColdC Reference Manual. ", <$format, ["p", [], [], 'do_p]>, "Even if you do not intend to program, it is important to know about objects. If you want to specify an object that is not in your ", <$format, ["link", [["node", "$help_environment"]], ["Environment"], 'do_link]>, ", you can do it by using the object name. Object names are single words (no spaces), beginning with a dollar sign ", <$format, ["tt", [], ["$"], 'do_tt]>, ". The following are all object names: ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["dfn", [], [" $root, $sys, $user_joe"], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, "Using objects as a foundation, the Cold Core creates locations and rooms ($place), generic items which can be found in a physical environment ($thing) and more."], #[['this, $help_objects]]]>; var $root inited = 1; var $help_node index = $help_index_core; var $root managed = [$help_objects]; var $root owned = [$help_objects]; new object $help_environment: $help_general; var $root manager = $help_environment; var $root created_on = 810254707; var $root inited = 1; var $root flags = ['methods, 'code, 'variables, 'core]; var $has_name name = ['prop, "Environment", "Environment"]; var $help_node links = #[]; var $help_node body = <$ctext_frob, [[<$format, ["p", [], [], 'do_p]>, "Your environment is where the system tries to find things, when you name something. It does this by first checking everything in your contents, and everything in the location you are in. ", <$format, ["p", [], [], 'do_p]>, "The system will also check your recent context. The server records the last object you named, as well as all of the last objects you named (with a gender). You can list your recent context with the command @context, receiving a result similar to: ", <$format, ["p", [], [], 'do_p]>, <$format, ["dfn", [], [<$format, ["quote", [], ["Last thing: the Magazine Rack\nLast it: the Magazine Rack \nLast her: Squeak the lemming\nLast him: Miro"], 'do_quote]>], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, "When the system is attempting to find a named object, it first checks in your context. This allows you to name objects by their gender (if you remember it correctly). For instance: ", <$format, ["p", [], [], 'do_p]>, <$format, ["dfn", [], [<$format, ["quote", [], ["> get bottle\nYou take the bottle.\n> drop it\nYou drop the bottle."], 'do_quote]>], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, "Furthermore, if you do not name an object, it will return the last object you named: ", <$format, ["p", [], [], 'do_p]>, <$format, ["dfn", [], [<$format, ["quote", [], ["> get bottle\nYou take the bottle.\n> drop\nYou drop the bottle."], 'do_quote]>], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, "There are also to words known by the system. The first is ", <$format, ["tt", [], ["me"], 'do_tt]>, ", which is always you. The second is ", <$format, ["tt", [], ["here"], 'do_tt]>, ", which is always your location."], #[['this, $help_environment]]]>; var $root managed = [$help_environment]; var $root owned = [$help_environment]; new object $help_commands: $help_general; var $root child_index = 7; var $root fertile = 1; var $root manager = $help_commands; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'fertile, 'variables, 'core]; var $has_name name = ['prop, "Commands", "Commands"]; var $help_node links = #[["VR vs Non-VR", $help_commands_vr], ["Types", $help_commands_types], ["Matching", $help_commands_matching], ["Enhanced", $help_commands_enhanced], ["All Commands", $help_index_cmds]]; var $help_node body = <$ctext_frob, [[<$format, ["p", [], [], 'do_p]>, "This section outlines some of the basics of commands, from understanding the logic behind why they are named what they are, to using them, to programming them. (Programmer's note: Commands in the Cold Dark are handled entirely in the database, the driver is oblivious to the intent or meaning of what it is you type). ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["dl", [["columned", 1]], [<$format, ["dt", [], [" ", <$format, ["b", [], [" ", <$format, ["link", [["node", "$help_commands_vr"]], ["VR vs Non-VR"], 'do_link]>], 'do_b]>], 'do_dt]>, <$format, ["dd", [], [" The difference between the two"], 'do_dd]>, <$format, ["dt", [], [" ", <$format, ["b", [], [" ", <$format, ["link", [["node", "$help_commands_types"]], ["Types"], 'do_link]>], 'do_b]>], 'do_dt]>, <$format, ["dd", [], [" The three types of commands"], 'do_dd]>, <$format, ["dt", [], [" ", <$format, ["b", [], [" ", <$format, ["link", [["node", "$help_commands_matching"]], ["Matching"], 'do_link]>], 'do_b]>], 'do_dt]>, <$format, ["dd", [], [" Conventions used in matching commands"], 'do_dd]>, <$format, ["dt", [], [" ", <$format, ["b", [], [" ", <$format, ["link", [["node", "$help_commands_enhanced"]], ["Enhanced"], 'do_link]>], 'do_b]>], 'do_dt]>, <$format, ["dd", [], [" ColdCore's Enhanced Commands"], 'do_dd]>, <$format, ["p", [], [], 'do_p]>, <$format, ["dt", [], [" ", <$format, ["b", [], [" ", <$format, ["link", [["node", "$help_index_cmds"]], ["All Commands"], 'do_link]>], 'do_b]>], 'do_dt]>, <$format, ["dd", [], [" An index of all commands"], 'do_dd]>], 'do_dl]>], #[['this, $help_commands]]]>; var $root managed = [$help_commands]; var $root owned = [$help_commands]; var $help_node index = $help_index_core; var $has_settings local_settings = ["index"]; new object $help_commands_vr: $help_commands; var $root manager = $help_commands_vr; var $root created_on = 810075673; var $root inited = 1; var $root flags = ['methods, 'code, 'variables, 'core]; var $has_name name = ['prop, "VR vs Non-VR", "VR vs Non-VR"]; var $help_node links = #[]; var $help_node body = <$ctext_frob, [[<$format, ["p", [], [], 'do_p]>, "To help classify commands, a distinction has been made. This distinction is based upon how the command is used, and what it effects. If the command is a Non-VR command--i.e. it does not effect your Virtual Environment-- it begins with an at-sign ('@'). Otherwise, it does not. ", <$format, ["p", [], [], 'do_p]>, "The best way to decide if a command is VR or Non-VR is to ask yourself the question: ", <$format, ["i", [], ["Is it something I could do in real-life?"], 'do_i]>, ". For instance, you do not simply declare, say, ", <$format, ["i", [], ["I am wearing pink polka dotted clothes"], 'do_i]>, ", and suddenly you are. However, in the Cold Dark you have the ability to change how you look from moment to moment. Therefore this command (@describe) is a Non-VR command, and begins with an at-sign."], #[['this, $help_commands_vr]]]>; var $root managed = [$help_commands_vr]; var $root owned = [$help_commands_vr]; new object $help_commands_types: $help_commands; var $root manager = $help_commands_types; var $root created_on = 810075676; var $root inited = 1; var $root flags = ['methods, 'code, 'variables, 'core]; var $has_name name = ['prop, "Command Types", "Command Types"]; var $help_node links = #[]; var $help_node body = <$ctext_frob, [[<$format, ["p", [], [], 'do_p]>, "Each command is associated with a specific method. When a command match is found, that method is executed with arguments depending upon what you typed. ", <$format, ["p", [], [], 'do_p]>, "The Cold Dark recognizes three types of commands: ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["dl", [], [<$format, ["dt", [], [<$format, ["b", [], ["Local Commands"], 'do_b]>], 'do_dt]>, <$format, ["dd", [], [<$format, ["p", [], [], 'do_p]>, "Local commands are any non-directed command, or any command which does not require a target in the command line. Matching for local commands uses ColdC template matching.", <$format, ["p", [], [], 'do_p]>], 'do_dd]>, <$format, ["dt", [], [<$format, ["b", [], ["Remote Commands"], 'do_b]>], 'do_dt]>, <$format, ["dd", [], [<$format, ["p", [], [], 'do_p]>, "Remote commands differ from Local Commands in that they require the target of the command, in the command string. For instance, \"get button\" would be a remote command, because it requires the target of button to function correctly. Matching for Remote Commands uses ColdC template matching", <$format, ["p", [], [], 'do_p]>], 'do_dd]>, <$format, ["dt", [], [<$format, ["b", [], ["Shortcuts"], 'do_b]>], 'do_dt]>, <$format, ["dd", [], [<$format, ["p", [], [], 'do_p]>, "Shortcuts are intented as wrap-arounds for commands, using ColdC pattern matching instead of template matching."], 'do_dd]>], 'do_dl]>], #[['this, $help_commands_types]]]>; var $root managed = [$help_commands_types]; var $root owned = [$help_commands_types]; new object $help_commands_matching: $help_commands; var $root manager = $help_commands_matching; var $root created_on = 810075678; var $root inited = 1; var $root flags = ['methods, 'code, 'variables, 'core]; var $has_name name = ['prop, "Matching Conventions", "Matching Conventions"]; var $help_node links = #[]; var $help_node body = <$ctext_frob, [[<$format, ["p", [], [], 'do_p]>, "Two types of ColdC matching systems are used with Commands. The base matching system is pattern matching. Pattern matching is basically the same as wildcards on some operating systems. The asterisk character (", <$format, ["tt", [], ["*"], 'do_tt]>, ") means that when compared to a string, anything can match it. This becomes useful for matching different strings. Some examples: ", <$format, ["p", [], [], 'do_p]>, <$format, ["dfn", [], [<$format, ["quote", [], ["Pattern: \"match *\"\nString: \"match anything after this\"\nResult: \"match\", \"anything after this\"\n\nPattern: \"match * but not this\"\nString: \"match only this but not this\"\nResult: \"match\", \"only this\", \"but not this\""], 'do_quote]>], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, "Template matching expands upon the basic idea of pattern matching. Template matching specifies two more special characters. The first is a question mark (", <$format, ["tt", [], ["?"], 'do_tt]>, ") and the other is a pipe (", <$format, ["tt", [], ["|"], 'do_tt]>, "). If a question mark is placed within a word, it means that the word must match up to the point of the question mark, but everything after that point is optional. For instance, all of the following would be valid against the specified template: ", <$format, ["p", [], [], 'do_p]>, <$format, ["dfn", [], [<$format, ["quote", [], ["Template: \"temp?late\"\nString: \"temp\"\nString: \"templ\"\nString: \"templa\"\nString: \"templat\"\nString: \"template\""], 'do_quote]>], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, "The pipe character (", <$format, ["tt", [], ["|"], 'do_tt]>, ") is used to specify several different words that will match only once. For instance, the template \"this|that|there\" would match \"this\" ", <$format, ["em", [], ["OR"], 'do_em]>, " \"that\" ", <$format, ["em", [], ["OR"], 'do_em]>, " \"there\". It is easiest to logically think of the pipe character as ", <$format, ["em", [], ["OR"], 'do_em]>, ". ", <$format, ["p", [], [], 'do_p]>, "With these elements drawn together you get a simple yet dynamic matching system. ", <$format, ["p", [], [], 'do_p]>, <$format, ["dfn", [], [<$format, ["quote", [], ["\"l?ook at *\"\n\"give|put * to|in *\"\n\"@who *\"\n\"@lock * to|with *\""], 'do_quote]>], 'do_dfn]>], #[['this, $help_commands_matching]]]>; var $root managed = [$help_commands_matching]; var $root owned = [$help_commands_matching]; new object $help_commands_enhanced: $help_commands; var $root manager = $help_commands_enhanced; var $root created_on = 810075680; var $root inited = 1; var $root flags = ['methods, 'code, 'variables, 'core]; var $has_name name = ['prop, "Enhanced Command Templates", "Enhanced Command Templates"]; var $help_node links = #[["Programming Commands", $help_prog_commands]]; var $help_node body = <$ctext_frob, [[<$format, ["p", [], [], 'do_p]>, "The Cold Dark further expands upon the above matching systems, specifying certain types of arguments which can be accepted for a command, where the wildcard ('*') is located. ", <$format, ["p", [], [], 'do_p]>, "These are specified within less-than and greater-than signs (", <$format, ["tt", [], ["<"], 'do_tt]>, " and ", <$format, ["tt", [], [">"], 'do_tt]>, "). These tags simply tell the parser what type of arguments to accept in that location on the command line. An example would be: ", <$format, ["p", [], [], 'do_p]>, <$format, ["dfn", [], ["push <user>"], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, "Where <user> must be a valid user of the system, some more examples follow. ", <$format, ["p", [], [], 'do_p]>, <$format, ["dfn", [], [<$format, ["quote", [], ["\"l?ook at <thing>\"\n\"get|take <any> from <thing>\"\n\"@who <user>\"\n\"@show <object>\""], 'do_quote]>], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, "More information on Enhanced Command Templates can be found in the section ", <$format, ["link", [["node", "$help_prog_commands"]], ["Programming Commands"], 'do_link]>, "."], #[['this, $help_commands_enhanced]]]>; var $root managed = [$help_commands_enhanced]; var $root owned = [$help_commands_enhanced]; new object $help_interaction: $help_general; var $root manager = $help_interaction; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'variables, 'core]; var $has_name name = ['prop, "Interaction", "Interaction"]; var $help_node links = #[["say", $help_cmds_say], ["emote", $help_cmds_emote], ["to", $help_cmds_tosay], ["whisper", $help_cmds_whisper], ["think", $help_cmds_think], ["spoof", $help_cmds_spoof], ["@page", $help_cmds_page], ["@paste", $help_cmds_paste], ["shortcuts", $help_cmds_shortcuts]]; var $help_node body = <$ctext_frob, [[<$format, ["p", [], [], 'do_p]>, "The following common interaction commands exist: ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["dl", [["columned", 1]], [<$format, ["dt", [], [" ", <$format, ["link", [["node", "$help_cmds_say"]], ["say"], 'do_link]>], 'do_dt]>, <$format, ["dd", [], [" Speak and talk to others"], 'do_dd]>, <$format, ["dt", [], [" ", <$format, ["link", [["node", "$help_cmds_emote"]], ["emote"], 'do_link]>], 'do_dt]>, <$format, ["dd", [], [" Do free-form actions"], 'do_dd]>, <$format, ["dt", [], [" ", <$format, ["link", [["node", "$help_cmds_tosay"]], ["to"], 'do_link]>], 'do_dt]>, <$format, ["dd", [], [" Direct messages to people in the room"], 'do_dd]>, <$format, ["dt", [], [" ", <$format, ["link", [["node", "$help_cmds_whisper"]], ["whisper"], 'do_link]>], 'do_dt]>, <$format, ["dd", [], [" Privately talk to somebody"], 'do_dd]>, <$format, ["dt", [], [" ", <$format, ["link", [["node", "$help_cmds_think"]], ["think"], 'do_link]>], 'do_dt]>, <$format, ["dd", [], [" Thinks something out loud"], 'do_dd]>, <$format, ["dt", [], [" ", <$format, ["link", [["node", "$help_cmds_spoof"]], ["spoof"], 'do_link]>], 'do_dt]>, <$format, ["dd", [], [" Similar to eval, but formatted differently"], 'do_dd]>, <$format, ["dt", [], [" ", <$format, ["link", [["node", "$help_cmds_page"]], ["@page"], 'do_link]>], 'do_dt]>, <$format, ["dd", [], [" Talk to somebody not in the room"], 'do_dd]>, <$format, ["dt", [], [" ", <$format, ["link", [["node", "$help_cmds_paste"]], ["@paste"], 'do_link]>], 'do_dt]>, <$format, ["dd", [], [" Paste a block of text to people"], 'do_dd]>, <$format, ["br", [], [], 'do_br]>, <$format, ["dt", [], [" ", <$format, ["link", [["node", "$help_cmds_shortcuts"]], ["shortcuts"], 'do_link]>], 'do_dt]>, <$format, ["dd", [], [" Additional unnamed interaction shortcuts"], 'do_dd]>], 'do_dl]>], #[['this, $help_interaction]]]>; var $root managed = [$help_interaction]; var $root owned = [$help_interaction]; new object $help_interface: $help_general; var $root manager = $help_interface; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 847647924; var $has_name name = ['prop, "Interface", "Interface"]; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $help_node links = #[["Client", $help_interface_client], ["Format", $help_interface_format], ["Settings", $help_interface_settings]]; var $help_node body = <$ctext_frob, [[<$format, ["p", [], [], 'do_p]>, "You can alter your interface in many ways. ", <$format, ["p", [], [], 'do_p]>, <$format, ["dl", [["columned", 1]], [<$format, ["dt", [], [<$format, ["b", [], [<$format, ["link", [["node", "$help_interface_client"]], ["Client"], 'do_link]>], 'do_b]>], 'do_dt]>, <$format, ["dd", [], ["Using a Client"], 'do_dd]>, <$format, ["dt", [], [<$format, ["b", [], [<$format, ["link", [["node", "$help_interface_format"]], ["Format"], 'do_link]>], 'do_b]>], 'do_dt]>, <$format, ["dd", [], ["Your output format"], 'do_dd]>, <$format, ["dt", [], [<$format, ["b", [], [<$format, ["link", [["node", "$help_interface_settings"]], ["Settings"], 'do_link]>], 'do_b]>], 'do_dt]>, <$format, ["dd", [], ["Configurable Settings"], 'do_dd]>], 'do_dl]>], #[['this, $help_interface]]]>; var $root inited = 1; var $help_node index = $help_index_core; var $root managed = [$help_interface]; var $root owned = [$help_interface]; new object $help_interface_client: $help_interface; var $root manager = $help_interface_client; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 847664123; var $has_name name = ['prop, "Clients", "Clients"]; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $help_node links = #[]; var $help_node body = <$ctext_frob, [[<$format, ["p", [], [], 'do_p]>, "When you connect to a Virtual Environment System you use a ", <$format, ["em", [], ["client"], 'do_em]>, ". A client is simply a program you run from your machine. This program connects you with the server somewhere on the network. If you used ", <$format, ["tt", [], ["telnet"], 'do_tt]>, " to get here, your client is ", <$format, ["tt", [], ["telnet"], 'do_tt]>, ". ", <$format, ["p", [], [], 'do_p]>, "This system is not designed for use with ", <$format, ["tt", [], ["telnet"], 'do_tt]>, ". It has many customized aspects which telnet simply does not support. Because of this it is suggested for your own benefit and enjoyment that you get a supported client. ", <$format, ["p", [], [], 'do_p]>, "Currently supported clients are: ", <$format, ["ul", [], [<$format, ["table", [["cols", "25%,75%"]], [<$format, ["tr", [], [<$format, ["td", [], ["Tinyfugue"], 'do_td]>, <$format, ["td", [], ["ftp://tf.tcp.com/pub/tinyfugue"], 'do_td]>], 'do_tr]>, <$format, ["tr", [], [<$format, ["td", [], ["TkMOO-lite"], 'do_td]>, <$format, ["td", [], ["http://www.cm.cf.ac.uk/User/Andrew.Wilson/tkMOO-light/"], 'do_td]>], 'do_tr]>], 'do_table]>], 'do_ul]>], #[['this, $help_interface_client]]]>; var $root inited = 1; var $help_node index = $help_index_core; var $root managed = [$help_interface_client]; var $root owned = [$help_interface_client]; new object $help_interface_format: $help_interface; var $root manager = $help_interface_format; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 847664131; var $has_name name = ['prop, "Format", "Format"]; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $help_node links = #[]; var $help_node body = <$ctext_frob, [[<$format, ["p", [], [], 'do_p]>, "By default your output format is plaintext (text/plain). You can change this to other formats by setting your Content-Type. Currently supported alternate types are: ", <$format, ["ul", [], [<$format, ["li", [], ["Plain Text (text/plain)"], 'do_li]>, <$format, ["li", [], ["HTML Text (text/html)"], 'do_li]>], 'do_ul]>, " ", <$format, ["p", [], [], 'do_p]>, "These formats can easilly be extended to include others. To change your output format use the command: ", <$format, ["p", [], [], 'do_p]>, <$format, ["dfn", [], ["@set content-type=type"], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, "Where ", <$format, ["em", [], ["type"], 'do_em]>, " is one of the MIME encodings of the above types (either ", <$format, ["tt", [], ["text/plain"], 'do_tt]>, " or ", <$format, ["tt", [], ["text/html"], 'do_tt]>, ")."], #[['this, $help_interface_format]]]>; var $root inited = 1; var $help_node index = $help_index_core; var $root managed = [$help_interface_format]; var $root owned = [$help_interface_format]; new object $help_interface_settings: $help_interface; var $root manager = $help_interface_settings; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 847664220; var $has_name name = ['prop, "Settings", "Settings"]; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $help_node links = #[["@set", $help_cmds_set]]; var $help_node body = <$ctext_frob, [[<$format, ["p", [], [], 'do_p]>, "There are many configurable settings available for you to use in customizing your environment. The command ", <$format, ["tt", [], [<$format, ["link", [["node", "$help_cmds_set"]], ["@set"], 'do_link]>], 'do_tt]>, " is used to make these changes. If you type ", <$format, ["tt", [], ["@set"], 'do_tt]>, " with no arguments it will list all of your current settings. To change a setting you simply type ", <$format, ["tt", [], ["@set"], 'do_tt]>, " followed by the setting name, an equals sign and the new value. If the value does not conform to the setting requirements you will be notified appropriately. For example, the following will turn on the capability to receive variable termination on messages (i.e. you can recieve text prompts that are not terminated with newlines): ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["dfn", [], ["@set non-terminated-tell=on"], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, "There may also exist ", <$format, ["em", [], ["user-info"], 'do_em]>, " settings. These define Real-Life aspects of you. They work slightly different. By default all user-info settings are private, and may not be seen by anybody else unless you include ", <$format, ["tt", [], ["+public"], 'do_tt]>, " at the beginning of the setting, such as: ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["dfn", [], ["@set real-name=+public Brandon Gilespie"], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, "Read about the ", <$format, ["tt", [], [<$format, ["link", [["node", "$help_cmds_set"]], ["@set"], 'do_link]>], 'do_tt]>, " command for more information."], #[['this, $help_interface_settings]]]>; var $root inited = 1; var $help_node index = $help_index_core; var $root managed = [$help_interface_settings]; var $root owned = [$help_interface_settings]; new object $help_building: $help_core; var $root manager = $help_building; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 847060847; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "Building", "Building"]; var $help_node links = #[["Theme", $help_theme]]; var $help_node body = <$ctext_frob, [[<$format, ["p", [], [], 'do_p]>, "Be warned: anything from this section down is not complete. ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["dl", [["columned", 1]], [<$format, ["dt", [], [<$format, ["b", [], ["Dynamic Text"], 'do_b]>], 'do_dt]>, <$format, ["dd", [], ["The Cold text Markup Language"], 'do_dd]>, <$format, ["dt", [], [<$format, ["b", [], ["Locations"], 'do_b]>], 'do_dt]>, <$format, ["dd", [], ["How Locations work"], 'do_dd]>, <$format, ["dt", [], [<$format, ["b", [], [<$format, ["link", [["node", "$help_theme"]], ["Theme"], 'do_link]>], 'do_b]>], 'do_dt]>, <$format, ["dd", [], ["The VR Theme"], 'do_dd]>, <$format, ["dt", [], [<$format, ["b", [], ["Commands"], 'do_b]>], 'do_dt]>, <$format, ["dd", [], ["Overview of Building Commands"], 'do_dd]>], 'do_dl]>], #[['this, $help_building]]]>; var $root inited = 1; var $help_node index = $help_index_core; var $root child_index = 5; var $root managed = [$help_building]; var $root owned = [$help_building]; new object $help_theme: $help_building; var $root manager = $help_theme; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 847060976; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "Theme", "Theme"]; var $help_node links = #[]; var $help_node body = <$ctext_frob, [[<$format, ["p", [], [], 'do_p]>, "The Cold Dark has two primary realms, each with their own theme. ", <$format, ["dl", [], [<$format, ["dt", [], [<$format, ["subj", [["level", "2"]], ["Taobh Thiar"], 'do_subj]>], 'do_dt]>, <$format, ["dd", [], ["Taobh Thiar [tave theer] is Gaelic for 'Beyond'. This realm is pretty much free-form, assuming you can get permission from a local area's managers to link into it."], 'do_dd]>, <$format, ["dt", [], [<$format, ["subj", [["level", "2"]], ["En Requiem"], 'do_subj]>], 'do_dt]>, <$format, ["dd", [], ["En Requiem is a realm of Fantasy and Technology. More information on it can be found on the World Wide Web at: ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["dfn", [], ["http://www.cold.org/EnRequiem/"], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, "Contact Brandon for information on building in En Requiem."], 'do_dd]>], 'do_dl]>], #[['this, $help_theme]]]>; var $root inited = 1; var $help_node index = $help_index_core; var $root managed = [$help_theme]; var $root owned = [$help_theme]; root method .core_help_theme() { new.set_body(["This node needs to be written, use @help-list and @help-write"]); }; new object $help_building_5: $help_building; var $root manager = $help_building_5; var $root managed = [$help_building_5]; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 848082466; var $help_node index = $help_index_core; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "Dynamic Text", "Dynamic Text"]; var $help_node links = #[]; var $help_node body = <$ctext_frob, [["This node isn't written yet"], #[['this, $help_building_5]]]>; var $root inited = 1; var $root owned = [$help_building_5]; new object $help_prog: $help_core; var $root manager = $help_prog; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 846999513; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "Programming", "Programming"]; var $help_node links = #[["OOP", $help_prog_oop]]; var $help_node body = <$ctext_frob, [[<$format, ["p", [], [], 'do_p]>, "Be warned: anything from this section down is not complete. ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["dl", [["columned", 1]], [<$format, ["dt", [], [<$format, ["link", [["node", "$help_prog_oop"]], ["OOP"], 'do_link]>], 'do_dt]>, <$format, ["dd", [], ["Object Oriented Programming"], 'do_dd]>, <$format, ["dt", [], ["Programming a Method"], 'do_dt]>, <$format, ["dd", [], ["Overview on creating a method"], 'do_dd]>, <$format, ["dt", [], ["ColdC"], 'do_dt]>, <$format, ["dd", [], ["ColdC Manual"], 'do_dd]>, <$format, ["dt", [], ["Functions"], 'do_dt]>, <$format, ["dd", [], ["Function Reference"], 'do_dd]>, <$format, ["dt", [], ["Commands"], 'do_dt]>, <$format, ["dd", [], ["Overview of Programming Commands"], 'do_dd]>], 'do_dl]>], #[['this, $help_prog]]]>; var $root inited = 1; var $help_node index = $help_index_core; var $root managed = [$help_prog]; var $root owned = [$help_prog]; new object $help_prog_commands: $help_prog; var $root manager = $help_prog_commands; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 846999554; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "Programming Commands", "Programming Commands"]; var $help_node links = #[]; var $help_node body = <$ctext_frob, [["This node isn't written yet"], #[['this, $help_prog_commands]]]>; var $root inited = 1; var $help_node index = $help_index_core; var $root managed = [$help_prog_commands]; var $root owned = [$help_prog_commands]; new object $help_coldc: $help_prog; var $root manager = $help_coldc; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611027; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "driver", "driver"]; var $help_node links = #[["ColdC Objects", $help_driver_objects], ["Referencing Objects", $help_driver_objects_referencing], ["Methods", $help_driver_objects_objectmethods], ["Variables", $help_driver_objects_objectvariables], ["Special Objects", $help_driver_objects_special], ["Language Structure", $help_driver_structure], ["Tokens", $help_driver_structure_tokens], ["Data Types", $help_driver_structure_types], ["Expressions", $help_driver_structure_expressions], ["Statements", $help_driver_structure_statements], ["Errors", $help_driver_errors], ["Defining Methods", $help_driver_methodintro], ["Frames and Tasks", $help_driver_taskintro], ["Security", $help_driver_security], ["Networking", $help_driver_networking], ["ColdC Regular Expressions", $help_driver_regularexpressions], ["Files", $help_driver_fileintro], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["ul", [], [<$format, ["li", [], [<$format, ["link", [["node", "$help_driver_objects"]], ["ColdC Objects"], 'do_link]>, " ", <$format, ["ul", [], [<$format, ["li", [], [<$format, ["link", [["node", "$help_driver_objects_referencing"]], ["Referencing Objects"], 'do_link]>], 'do_li]>, <$format, ["li", [], [<$format, ["link", [["node", "$help_driver_objects_objectmethods"]], ["Methods"], 'do_link]>], 'do_li]>, <$format, ["li", [], [<$format, ["link", [["node", "$help_driver_objects_objectvariables"]], ["Variables"], 'do_link]>], 'do_li]>, <$format, ["li", [], [<$format, ["link", [["node", "$help_driver_objects_special"]], ["Special Objects"], 'do_link]>], 'do_li]>], 'do_ul]>], 'do_li]>, <$format, ["li", [], [<$format, ["link", [["node", "$help_driver_structure"]], ["Language Structure"], 'do_link]>, " ", <$format, ["ul", [], [<$format, ["li", [], [<$format, ["link", [["node", "$help_driver_structure_tokens"]], ["Tokens"], 'do_link]>], 'do_li]>, <$format, ["li", [], [<$format, ["link", [["node", "$help_driver_structure_types"]], ["Data Types"], 'do_link]>], 'do_li]>, <$format, ["li", [], [<$format, ["link", [["node", "$help_driver_structure_expressions"]], ["Expressions"], 'do_link]>], 'do_li]>, <$format, ["li", [], [<$format, ["link", [["node", "$help_driver_structure_statements"]], ["Statements"], 'do_link]>], 'do_li]>], 'do_ul]>], 'do_li]>, <$format, ["li", [], [<$format, ["link", [["node", "$help_driver_errors"]], ["Errors"], 'do_link]>], 'do_li]>, <$format, ["li", [], [<$format, ["link", [["node", "$help_driver_methodintro"]], ["Defining Methods"], 'do_link]>], 'do_li]>, <$format, ["li", [], [<$format, ["link", [["node", "$help_driver_taskintro"]], ["Frames and Tasks"], 'do_link]>], 'do_li]>, <$format, ["li", [], [<$format, ["link", [["node", "$help_driver_security"]], ["Security"], 'do_link]>], 'do_li]>, <$format, ["li", [], [<$format, ["link", [["node", "$help_driver_networking"]], ["Networking"], 'do_link]>], 'do_li]>, <$format, ["li", [], [<$format, ["link", [["node", "$help_driver_regularexpressions"]], ["ColdC Regular Expressions"], 'do_link]>], 'do_li]>, <$format, ["li", [], [<$format, ["link", [["node", "$help_driver_fileintro"]], ["Files"], 'do_link]>], 'do_li]>, <$format, ["li", [], [<$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>], 'do_li]>], 'do_ul]>], #[['this, $help_coldc]]]>; var $root inited = 1; var $root managed = [$help_coldc]; var $root owned = [$help_coldc]; new object $help_driver_convention: $help_coldc; var $root manager = $help_driver_convention; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611035; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "Conventions", "Conventions"]; var $help_node links = #[["ColdC", $help_coldc]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": A note on Conventions"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, "Througout this manual are many examples of ColdC code. When explaining how ColdC code may evaluate when interpreted, a standard convention is used. The first line is the ColdC code. The second line begins with an text arrow pointing to the right (", <$format, ["tt", [], ["=>"], 'do_tt]>, "), and is followed by a ColdC data value. This represents what the example would evaluate to when interpreted. For instance, if you called a function ", <$format, ["tt", [], ["ctime()"], 'do_tt]>, ", and it returned the value ", <$format, ["tt", [], ["\"Sun Feb 25 17:06:38 1996\""], 'do_tt]>, ", it would be listed using this convention as: ", <$format, ["p", [], [], 'do_p]>, <$format, ["dfn", [], [<$format, ["quote", [], ["ctime()\n=> \"Sun Feb 25 17:06:38 1996\""], 'do_quote]>], 'do_dfn]>], #[['this, $help_driver_convention]]]>; var $root inited = 1; var $root managed = [$help_driver_convention]; var $root owned = [$help_driver_convention]; new object $help_driver_errors: $help_coldc; var $root manager = $help_driver_errors; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611036; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "errors", "errors"]; var $help_node links = #[["ColdC", $help_coldc], ["throw()", $help_func_throw], ["Error-Handling Expressions", $help_driver_structure_expressions], ["catch statement", $help_driver_structure_statements], ["Error-Handling Statements", $help_driver_structure_statements], ["propagation expression", $help_driver_structure_expressions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": Errors"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, "When something goes wrong in a ", <$format, ["tt", [], ["ColdC"], 'do_tt]>, " method an error is thrown. The interpreter will throw errors, and methods can throw custom errors (using the ", <$format, ["link", [["node", "$help_func_throw"]], ["throw()"], 'do_link]>, " function). An error consists of an error code (the ", <$format, ["i", [], ["type"], 'do_i]>, " of error), a string describing the error, and possibly data relative to the error. ", <$format, ["p", [], [], 'do_p]>, "When the interpreter throws an error, it checks to see how the current method handles that error type. If the error occured in a critical expression (see ", <$format, ["link", [["node", "$help_driver_structure_expressions"]], ["Error-Handling Expressions"], 'do_link]>, "), then the interpreter will cease evaluating the critical expression. Processing of the method will continue as if the interpreter had completed evaluation of the critical expression. The return value of the critical expression will be the error code associated with the thrown error. In this case, the traceback is not accessible from ", <$format, ["tt", [], ["traceback()"], 'do_tt]>, "; in order to get a traceback, you must use a ", <$format, ["link", [["node", "$help_driver_structure_statements"]], ["catch statement"], 'do_link]>, ". ", <$format, ["p", [], [], 'do_p]>, "If the error did not occur in a critical expression, but occurred in a catch statement which catches the error code (either because it is a ", <$format, ["tt", [], ["catch all"], 'do_tt]>, " statement or because it lists the error code (see ", <$format, ["link", [["node", "$help_driver_structure_statements"]], ["Error-Handling Statements"], 'do_link]>, "). Then the processing of the method jumps to the error handler, if one was provided, or to the end of the catch statement if not. ", <$format, ["p", [], [], 'do_p]>, "If the error did not occur in a critical expression or in an appropriate catch statement, then the current method aborts, and the interpreter throws an error in the calling method. Normally, the error thrown in the calling routine will have the error code ", <$format, ["tt", [], ["~methoderr"], 'do_tt]>, " unless the original error occurred within a ", <$format, ["link", [["node", "$help_driver_structure_expressions"]], ["propagation expression"], 'do_link]>, ". If the error occurred within a propagation expression then the error code will be the same as it was for the original error. A propagation expression has no effect on how an error is handled except to cause the error code to propagate differently to the calling routine. ", <$format, ["p", [], [], 'do_p]>, "You can throw your own errors using the ", <$format, ["tt", [], [<$format, ["link", [["node", "$help_func_throw"]], ["throw()"], 'do_link]>], 'do_tt]>, " function. This does not throw an error in the current method; instead, it exits the current method and throws an error in the calling method. Thus a method cannot ignore an error which it threw itself using ", <$format, ["tt", [], ["throw()"], 'do_tt]>, ". ", <$format, ["p", [], [], 'do_p]>, "There is one case in which a method cannot catch an interpreter-generated error. Methods have a limited amount of time to run, measured in ", <$format, ["i", [], ["ticks"], 'do_i]>, ". A method will generally only run out of ticks if it gets stuck in an infinite loop. If a method runs out of ticks, then the interpreter will throw a ", <$format, ["tt", [], ["~ticks"], 'do_tt]>, " error, which the method cannot catch. This causes the method to abort, which in turn causes the interpreter to throw a ", <$format, ["tt", [], ["~methoderr"], 'do_tt]>, " error in the calling routine. ", <$format, ["p", [], [], 'do_p]>, "You should use critical expressions when you anticipate that you may be calling a buggy or undefined method, and you do not wish your own method to stop interpreting as a result. For instance, a method which announces a string to every object in a container should probably ignore errors in the methods for each individual object which handle receiving the string. You should be careful that your critical expressions are correct code, however, because you will not immediately notice errors which occur while the interpreter is evaluating them. ", <$format, ["p", [], [], 'do_p]>, "You should use catch statements when you wish to handle errors with any kind of sophistication. The catch statement is much more powerful than the critical expression, and is ideal for situations in which fine-grain control over error handling is required. ", <$format, ["p", [], [], 'do_p]>, "You should use propagation expressions when your method is an intermediary between an outside object and an internal feature. For instance, a method which checks permissions and calls an object function such as ", <$format, ["tt", [], ["list_method()"], 'do_tt]>, " is acting as an intermediary. In this case, the method should throw the same errors as the ", <$format, ["tt", [], ["list_method()"], 'do_tt]>, " function, so you should enclose the function call in a propagation expression."], #[['this, $help_driver_errors]]]>; var $root inited = 1; var $root managed = [$help_driver_errors]; var $root owned = [$help_driver_errors]; new object $help_driver_fileintro: $help_coldc; var $root manager = $help_driver_fileintro; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611036; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "file intro", "file intro"]; var $help_node links = #[["ColdC", $help_coldc], ["execute()", $help_func_execute], ["fchmod()", $help_func_fchmod], ["fclose()", $help_func_fclose], ["feof()", $help_func_feof], ["fflush()", $help_func_fflush], ["file()", $help_func_file], ["files()", $help_func_files], ["fmkdir()", $help_func_fmkdir], ["fopen()", $help_func_fopen], ["frmdir()", $help_func_frmdir], ["fstat()", $help_func_fstat], ["fread()", $help_func_fread], ["fremove()", $help_func_fremove], ["frename()", $help_func_frename], ["fseek()", $help_func_fseek], ["fwrite()", $help_func_fwrite]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": Files"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, "ColdC gives the ability to handle files with the following functions: ", <$format, ["dfn", [], [" ", <$format, ["link", [["node", "$help_func_execute"]], ["execute()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_fchmod"]], ["fchmod()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_fclose"]], ["fclose()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_feof"]], ["feof()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_fflush"]], ["fflush()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_file"]], ["file()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_files"]], ["files()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_fmkdir"]], ["fmkdir()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_fopen"]], ["fopen()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_frmdir"]], ["frmdir()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_fstat"]], ["fstat()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_fread"]], ["fread()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_fremove"]], ["fremove()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_frename"]], ["frename()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_fseek"]], ["fseek()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_fwrite"]], ["fwrite()"], 'do_link]>, " "], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, "When a file is opened it is associated (i.e. bound) with the current object. Therefore, most file functions assume there is a file associated with the current object when you use them (such as ", <$format, ["tt", [], ["fwrite()"], 'do_tt]>, "). If there is not a file, the error ", <$format, ["tt", [], ["~file"], 'do_tt]>, " is thrown. ", <$format, ["p", [], [], 'do_p]>, "If the driver was compiled with ", <$format, ["tt", [], ["RESTRICTIVE_FILES"], 'do_tt]>, ", the driver will restrict where on the filesystem files can be manipulated (usually the ", <$format, ["tt", [], ["./root"], 'do_tt]>, " directory, with the exception of the function ", <$format, ["tt", [], ["execute()"], 'do_tt]>, ", which will use the directory ", <$format, ["tt", [], ["./dbbin"], 'do_tt]>, ". More information on where the directories are given in the Genesis Manual. ", <$format, ["p", [], [], 'do_p]>, "A file is opened using the function ", <$format, ["tt", [], ["fopen()"], 'do_tt]>, ", and is closed using the function ", <$format, ["tt", [], ["fclose()"], 'do_tt]>, ". Reaching the end of a file will not close it. Destroying the object for a file will close the file. ", <$format, ["p", [], [], 'do_p]>, "Example of opening, writing to and closing a simple text logfile: ", <$format, ["dfn", [], [" ", <$format, ["quote", [], ["\n\nfopen(\"log\");\nfwrite(\"[\" + $time.format(\"%d %h %y %H:%M\") + \"] \" + message);\nfclose();\n"], 'do_quote]>, " "], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, "Example of reading an image file: ", <$format, ["dfn", [], [" ", <$format, ["quote", [], ["\n\nstat = fopen(\"image.gif\", \"-\");\nbuffer = fread(stat[2]);\nfclose();\n\n"], 'do_quote]>, " "], 'do_dfn]>], #[['this, $help_driver_fileintro]]]>; var $root inited = 1; var $root managed = [$help_driver_fileintro]; var $root owned = [$help_driver_fileintro]; new object $help_driver_intro: $help_coldc; var $root manager = $help_driver_intro; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611036; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "intro", "intro"]; var $help_node links = #[]; var $help_node body = <$ctext_frob, [[<$format, ["hr", [], [], 'do_hr]>, "Although throughout the manual you have explained what things are, how about a newbie section that really goes down to explaining background information like your OOP section only a bit easier. What you have is perfect for people that are familair with OOP and MUD's, but a section for the true beginners to programming would help to ease them into it. Not just an explanation of how it works but things like \"You don't have to understand what you are reading the first time you read this (most don't) just read on and eventually it will all fall into place.\" I know this stuff is very simple to you and for those like me it's fun reading but for the true newbie it would be a real struggle to grasp all these new concepts."], #[['this, $help_driver_intro]]]>; var $root inited = 1; var $root managed = [$help_driver_intro]; var $root owned = [$help_driver_intro]; new object $help_driver_methodintro: $help_coldc; var $root manager = $help_driver_methodintro; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611036; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "method intro", "method intro"]; var $help_node links = #[["ColdC", $help_coldc], ["method_flags()", $help_func_method_flags], ["set_method_flags()", $help_func_set_method_flags], ["method_access()", $help_func_method_access], ["set_method_access()", $help_func_set_method_access]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": Defining Methods"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, "When defining a method several considerations must be taken into account. What arguments will the method accept? What local variables will the method use? What sort of flags will the method have? What sort of access will other objects have to the method? ", <$format, ["subj", [["level", "2"]], ["Arguments and Variables"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, "The arguments and variables for a method are defined within the method code. The internal structure of a method is: ", <$format, ["dfn", [], [<$format, ["quote", [], ["\n\narg arg1, arg2, ..., [rest];\nvar var1, var2, ...;\n\nstatement1\nstatement2\n. \n. \n. \n\n"], 'do_quote]>], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, "The ", <$format, ["tt", [], ["arg"], 'do_tt]>, " declaration gives a list of argument variables, whose values will correspond to the arguments passed with the message. You may omit the ", <$format, ["tt", [], ["arg"], 'do_tt]>, " declaration if the method does not take any arguments. If the final argument variable is given in square brackets (that is, if you specify ", <$format, ["i", [], ["rest"], 'do_i]>, "), then the method can accept a variable number of argments; ", <$format, ["i", [], ["rest"], 'do_i]>, " will contain a list of the arguments beyond the ones corresponding to the argument variables. If you do not specify ", <$format, ["i", [], ["rest"], 'do_i]>, ", then the method can accept only the number of arguments specified by the argument variables, no more. ", <$format, ["p", [], [], 'do_p]>, "The ", <$format, ["tt", [], ["var"], 'do_tt]>, " declaration tells the compiler that the listed identifiers should refer to local variables. You may omit the ", <$format, ["tt", [], ["var"], 'do_tt]>, " declaration if you do not wish to declare any local variables. ", <$format, ["p", [], [], 'do_p]>, "The statements ", <$format, ["i", [], ["statement1"], 'do_i]>, ", ", <$format, ["i", [], ["statement2"], 'do_i]>, ", ", <$format, ["i", [], ["..."], 'do_i]>, " are the body of the method. They tell the interpreter what the method does. ", <$format, ["subj", [["level", "2"]], ["Method Flags"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, "Method flags define certain behavioral features of the method. Currently the following method flags exist: ", <$format, ["dl", [], [" ", <$format, ["dt", [], [<$format, ["tt", [], [<$format, ["b", [], ["'nooverride"], 'do_b]>], 'do_tt]>, " "], 'do_dt]>, <$format, ["dd", [], ["Methods which specify ", <$format, ["tt", [], ["'nooverride"], 'do_tt]>, " cannot be overridden by any of the defining object's descendants. "], 'do_dd]>, <$format, ["dt", [], [<$format, ["tt", [], [<$format, ["b", [], ["'lock"], 'do_b]>], 'do_tt]>, " "], 'do_dt]>, <$format, ["dd", [], [<$format, ["tt", [], ["'lock"], 'do_tt]>, " locks all aspects of a method. Locked methods cannot have their access or flags changed, nor can they be recompiled during run-time. Locked methods can be changed outside of the regular running environment (such as in a textdb, or with coldcc). "], 'do_dd]>, <$format, ["dt", [], [<$format, ["tt", [], [<$format, ["b", [], ["'fork"], 'do_b]>], 'do_tt]>, " "], 'do_dt]>, <$format, ["dd", [], [<$format, ["tt", [], ["'fork"], 'do_tt]>, " is used to specify that the method forks from the current task. The return value of a forked method is the task id of the new task (fork is currently unsupported). "], 'do_dd]>, <$format, ["dt", [], [<$format, ["tt", [], [<$format, ["b", [], ["'native"], 'do_b]>], 'do_tt]>, " "], 'do_dt]>, <$format, ["dd", [], [<$format, ["tt", [], ["'native"], 'do_tt]>, " specifies a native method. Native methods are not really methods, but are actually functions acting as a method. Because of this native methods cannot be listed or manipulated in most of the usual ways. "], 'do_dd]>], 'do_dl]>, " ", <$format, ["p", [], [], 'do_p]>, "All method flags, with the exception of ", <$format, ["tt", [], ["'native"], 'do_tt]>, ", can be manipulated using the functions ", <$format, ["tt", [], [<$format, ["link", [["node", "$help_func_method_flags"]], ["method_flags()"], 'do_link]>], 'do_tt]>, " and ", <$format, ["tt", [], [<$format, ["link", [["node", "$help_func_set_method_flags"]], ["set_method_flags()"], 'do_link]>], 'do_tt]>, ". } ", <$format, ["subj", [["level", "2"]], ["Method Access"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, "It is possible to restrict what calls a method by setting the method's access. By default all methods are ", <$format, ["i", [], ["public"], 'do_i]>, " methods. The available settings for method access are: ", <$format, ["dl", [], [" ", <$format, ["dt", [], [<$format, ["tt", [], [<$format, ["b", [], ["'public"], 'do_b]>], 'do_tt]>, " "], 'do_dt]>, <$format, ["dd", [], ["This access state is the default. A public method can be called by any object. "], 'do_dd]>, <$format, ["dt", [], [<$format, ["tt", [], [<$format, ["b", [], ["'protected"], 'do_b]>], 'do_tt]>, " "], 'do_dt]>, <$format, ["dd", [], ["Protected methods can only be called by the defining object, or descendants of the defining object (sender() must be this()). "], 'do_dd]>, <$format, ["dt", [], [<$format, ["tt", [], [<$format, ["b", [], ["'private"], 'do_b]>], 'do_tt]>, " "], 'do_dt]>, <$format, ["dd", [], ["Private methods can only be called by the object they were defined on (caller() must be this()). "], 'do_dd]>, <$format, ["dt", [], [<$format, ["tt", [], [<$format, ["b", [], ["'root"], 'do_b]>], 'do_tt]>, " "], 'do_dt]>, <$format, ["dd", [], ["Root methods can only be called by the ", <$format, ["tt", [], ["$root"], 'do_tt]>, " object (caller() must be ", <$format, ["tt", [], ["$root"], 'do_tt]>, "). "], 'do_dd]>, <$format, ["dt", [], [<$format, ["tt", [], [<$format, ["b", [], ["'driver"], 'do_b]>], 'do_tt]>, " "], 'do_dt]>, <$format, ["dd", [], ["Driver methods can only be called by the driver. "], 'do_dd]>], 'do_dl]>, " ", <$format, ["p", [], [], 'do_p]>, "Method access can be manipulated using the functions ", <$format, ["tt", [], [<$format, ["link", [["node", "$help_func_method_access"]], ["method_access()"], 'do_link]>], 'do_tt]>, " and ", <$format, ["tt", [], [<$format, ["link", [["node", "$help_func_set_method_access"]], ["set_method_access()"], 'do_link]>], 'do_tt]>, "."], #[['this, $help_driver_methodintro]]]>; var $root inited = 1; var $root managed = [$help_driver_methodintro]; var $root owned = [$help_driver_methodintro]; new object $help_driver_networking: $help_coldc; var $root manager = $help_driver_networking; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611036; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "networking", "networking"]; var $help_node links = #[["ColdC", $help_coldc], ["bind_port()", $help_func_bind_port], ["close_connection()", $help_func_close_connection], ["connection()", $help_func_connection], ["cwrite()", $help_func_cwrite], ["cwritef()", $help_func_cwritef], ["open_connection()", $help_func_open_connection], ["reassign_connection()", $help_func_reassign_connection], ["unbind_port()", $help_func_unbind_port]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": Networking"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, "ColdC gives the ability to handle network sockets with the following functions: ", <$format, ["dfn", [], [" ", <$format, ["link", [["node", "$help_func_bind_port"]], ["bind_port()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_close_connection"]], ["close_connection()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_connection"]], ["connection()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_cwrite"]], ["cwrite()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_cwritef"]], ["cwritef()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_open_connection"]], ["open_connection()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_reassign_connection"]], ["reassign_connection()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_unbind_port"]], ["unbind_port()"], 'do_link]>, " "], 'do_dfn]>, "Connections are bound to a ", <$format, ["i", [], ["connection object"], 'do_i]>, ". The driver will use the following methods on a connection object: ", <$format, ["dfn", [], [" ", <$format, ["quote", [], ["\n\n.connect()\n.disconnect()\n.failed()\n.parse()\n\n"], 'do_quote]>, " "], 'do_dfn]>, "There are two types of connections which can be created. The first is a server connection, or a passive connection. To do this the driver listens on a network port and waits for incoming connections. The second type is an client connection, or a active connection. This type of connection is established by the driver to another network host. ", <$format, ["subj", [["level", "2"]], ["Server Connection"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, "To establish a server connection first call the function ", <$format, ["tt", [], ["bind_port()"], 'do_tt]>, ". The argument to this function is the network port to listen on. Note: most operating systems will restrict low numbered ports (usually anything below 1024 is restricted, and can only be opened with special privelages). If there are no errors, the current object is listening as a server on the specified port. ", <$format, ["p", [], [], 'do_p]>, "When an external client opens a connection the driver will call the method ", <$format, ["tt", [], [".connect()"], 'do_tt]>, " with two arguments. The first argument is a STRING, specifying the remote IP address of the client. The second argument is an INTEGER, specifying the socket where the connection was established. In general this number can be ignored. ", <$format, ["p", [], [], 'do_p]>, "Data received on the connection will be sent as a buffer to the method ", <$format, ["tt", [], [".parse()"], 'do_tt]>, ", after the method ", <$format, ["tt", [], [".connect()"], 'do_tt]>, " is called. Data is sent to the connection using the functions ", <$format, ["tt", [], ["cwrite()"], 'do_tt]>, " and ", <$format, ["tt", [], ["cwritef()"], 'do_tt]>, ". ", <$format, ["p", [], [], 'do_p]>, "If the client terminates the connection, the method ", <$format, ["tt", [], [".disconnect()"], 'do_tt]>, " is called. Note: this method will not be called if you terminated the connection. ", <$format, ["subj", [["level", "3"]], ["Multiple Server Connections"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, "If multiple connections will be received on the network port, it is suggested that when a connection is started the connection object either reassigns the connection to another connection object (using the function ", <$format, ["tt", [], ["reassign_connection()"], 'do_tt]>, "), or it notifies a new connection object to re-bind the port to itself. If this is not done, new connections will preempt and close the older connection (as only one connection can be on an object at a time). ", <$format, ["subj", [["level", "2"]], ["Client Connection"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, "To establish a client connection call the function ", <$format, ["tt", [], ["open_connection()"], 'do_tt]>, " with the first argument as a STRING specifing the IP address of the host, and the second argument an INTEGER specifying the network port to connect on. This function is not a blocking function. Calling it will simply start the process of opening a connection. If there are no immediate errors the function will return normally. ", <$format, ["p", [], [], 'do_p]>, "When a connection is opened the driver will call the method ", <$format, ["tt", [], [".connect()"], 'do_tt]>, " on the current object, with the argument being an INTEGER task_id for the task which called ", <$format, ["tt", [], ["open_connection()"], 'do_tt]>, ". If you wish, you may ", <$format, ["tt", [], ["suspend()"], 'do_tt]>, " after calling ", <$format, ["tt", [], ["open_connection()"], 'do_tt]>, ", then have the method ", <$format, ["tt", [], [".connect()"], 'do_tt]>, " resume the task when it is received. ", <$format, ["p", [], [], 'do_p]>, "If the connection could not be established, the method ", <$format, ["tt", [], [".failed()"], 'do_tt]>, " is called instead. The first argument is once again the task id, the second argument is an ERROR representing why the connection could not be established. ", <$format, ["p", [], [], 'do_p]>, "Once the connection is established, input and output is handled the same as on a server connection. ", <$format, ["p", [], [], 'do_p]>], #[['this, $help_driver_networking]]]>; var $root inited = 1; var $root managed = [$help_driver_networking]; var $root owned = [$help_driver_networking]; new object $help_prog_oop: $help_coldc; var $root manager = $help_prog_oop; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611036; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "oop", "oop"]; var $help_node links = #[]; var $help_node body = <$ctext_frob, [[<$format, ["p", [], [], 'do_p]>, "Object Oriented Programming (OOP) is a style of programming which not only groups procedures and data by functionality but which also applies a few common rules to how this grouping occurs. In OOP designers group procedures and data into ", <$format, ["i", [], ["modules"], 'do_i]>, ". By doing this it helps to define the purpose of the program, and also gives the added benefit of portability (porting a modular segment of code to another program is much easier than porting an integrated segment of code). ", <$format, ["p", [], [], 'do_p]>, "These modules (or ", <$format, ["i", [], ["objects"], 'do_i]>, ") will generally follow a few guidelines: ", <$format, ["ul", [], [<$format, ["li", [], ["Abstraction and Encapsulation of Data"], 'do_li]>, <$format, ["li", [], ["Inheritance"], 'do_li]>], 'do_ul]>, " ", <$format, ["p", [], [], 'do_p]>, "Because data and procedures are grouped together, all procedures which handle the specific data should be included within the module. ", <$format, ["b", [], ["Abstraction and Encapsulation"], 'do_b]>, "} occurs when the module abstracts and controls access to the data it manipulates. The internal representation of data used by a module is most likely irrelevant to external sources (with the interface being the primary concern). ", <$format, ["p", [], [], 'do_p]>, "An example of ", <$format, ["i", [], ["Abstraction and Encapsulation"], 'do_i]>, " would be a table of people and their pets. The 'People and Pets' module has several procedures: ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["dl", [], [<$format, ["dt", [], [<$format, ["i", [], ["Add Person"], 'do_i]>, " "], 'do_dt]>, <$format, ["dd", [], ["Add a Person to the table. This procedure is passed the person, and their pet."], 'do_dd]>, <$format, ["dt", [], [<$format, ["i", [], ["Remove Person"], 'do_i]>, " "], 'do_dt]>, <$format, ["dd", [], ["Remove a Person from the table. This procedure is passed the person to be removed."], 'do_dd]>, <$format, ["dt", [], [<$format, ["i", [], ["Get Pet"], 'do_i]>, " "], 'do_dt]>, <$format, ["dd", [], ["This procedure finds the pet for a given person. It is passed the person and returns the Pet associated with that person."], 'do_dd]>], 'do_dl]>, " ", <$format, ["p", [], [], 'do_p]>, "In the People and Pets module the table can be internalized in any form. The form is irrelevant to external programs which may use it. ", <$format, ["p", [], [], 'do_p]>, <$format, ["b", [], ["Inheritance"], 'do_b]>, " is the ability of another module to take on the functionality an existing module and further expand upon it. For instance, a 'People, Pets and their Names' module could be created which takes on the functionality of 'People and Pets', but expands it to include the names of the pets. ", <$format, ["p", [], [], 'do_p]>, "Inheritance is extremely useful because code becomes reusable and extendable without having to re-create each portion or module for different functionality. ", <$format, ["p", [], [], 'do_p]>, "In inheritance a module taking on the functionality of another object is called ", <$format, ["i", [], ["deriving"], 'do_i]>, " from that object. For instance, 'People, Pets and their Names' is derived from 'People and Pets'. The module 'People, Pets and their Names' is a ", <$format, ["i", [], ["child"], 'do_i]>, " of 'People and Pets', with 'People and Pets' being the ", <$format, ["i", [], ["parent"], 'do_i]>, " of 'People, Pets and their Names'."], #[['this, $help_prog_oop]]]>; var $root inited = 1; var $root managed = [$help_prog_oop]; var $root owned = [$help_prog_oop]; new object $help_driver_regularexpressions: $help_coldc; var $root manager = $help_driver_regularexpressions; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611036; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "regular expressions", "regular expressions"]; var $help_node links = #[]; var $help_node body = <$ctext_frob, [[<$format, ["p", [], [], 'do_p]>, "ColdC Regular Expressions use Henry Spencer's Regular Expression package with further extensions similar to those Perl has implemented. ", <$format, ["subj", [["level", "2"]], ["What is a Regular Expression?"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, "A Regular Expression is an abstract way of matching text. The simplest Regular Expression is a direct match. For instance, the string \"that\" exists within the string \"this and that are here.\", therefore \"that\" is a Regular Expression. ", <$format, ["p", [], [], 'do_p]>, "However, regular expressions can be much more complex than this case, as there are many possibilities you may wish to match in strings. Wildcard matching is a common way of matching more than a simple instance of text. Wildcard matching generally matches any number of anything where a ", <$format, ["tt", [], ["`*'"], 'do_tt]>, " is found in the wildcard. Although useful it does have its restrictions. Wildcard matching is not used in Regular Expressions because of its lack of control. ", <$format, ["subj", [["level", "2"]], ["ColdC Regular Expressions Explained"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, "The first concept of Regular Expressions are ", <$format, ["i", [], ["branches"], 'do_i]>, ". There can be zero or more ", <$format, ["i", [], ["branches"], 'do_i]>, " in a Regular Expression, seperated by the pipe character (\"|\"). A Regular Expression will match anything in one of the branches. An example of this is: ", <$format, ["dfn", [], [<$format, ["quote", [], ["\nthis|that|there\n"], 'do_quote]>], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, "This Regular Expression will match \"this\" OR \"that\" OR \"there\". It is easiest to logically think of branches in this manner. ", <$format, ["p", [], [], 'do_p]>, "A branch is further defined as zero or more ", <$format, ["i", [], ["pieces"], 'do_i]>, " joined together. A ", <$format, ["i", [], ["piece"], 'do_i]>, " is an ", <$format, ["i", [], ["atom"], 'do_i]>, " possibly followed by an asterisk, a plus sign, or a question mark (\"*\", \"+\", or \"?\"). The asterisk, plus sign, or question mark defines how to match the atom. An atom followed by an asterisk matches zero or more occurances of the atom. An atom followed by a plus sign matches one or more occurances of the atom. An atom followed by a question mark matches zero or one occurance of the atom. ", <$format, ["p", [], [], 'do_p]>, "An ", <$format, ["i", [], ["atom"], 'do_i]>, " is either a Regular Expression in parentheses, a range (see below), or one of the following: a period (\".\"), a carat (\"^\"), a dollar sign (\"$\"), a back-slash (\"\") followed by a single character, or a single character with no other significance. A period matches any single character in the input text, a carat matches the beginning of the input text, a dollar-sign matches the end of the input text, and a back-slash followed by a single character either has special significance--such as matching all white space or all digits--or it removes special significance from the following character. For instance, \"$\" would match a dollar-sign in the input text, rather than matching the end of the line (which is what the dollar-sign usually does). The following characters have special meaning when matching (similar to PERL Regular Expressions): ", <$format, ["dfn", [], [<$format, ["dl", [["columned", 1]], [<$format, ["dt", [], ["\"\w\" "], 'do_dt]>, <$format, ["dd", [], ["Match a word word character (alphanumeric plus \"_\") "], 'do_dd]>, <$format, ["dt", [], ["\"\W\" "], 'do_dt]>, <$format, ["dd", [], ["Match a non-word character "], 'do_dd]>, <$format, ["dt", [], ["\"\s\" "], 'do_dt]>, <$format, ["dd", [], ["Match a whitespace character "], 'do_dd]>, <$format, ["dt", [], ["\"\S\" "], 'do_dt]>, <$format, ["dd", [], ["Match a non-whitespace character "], 'do_dd]>, <$format, ["dt", [], ["\"\d\" "], 'do_dt]>, <$format, ["dd", [], ["Match a digit character "], 'do_dd]>, <$format, ["dt", [], ["\"\D\" "], 'do_dt]>, <$format, ["dd", [], ["Match a non-digit character "], 'do_dd]>], 'do_dl]>, " "], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, <$format, ["i", [], ["Note: the above escape characters have not yet been integrated into the regular expression matcher."], 'do_i]>, " ", <$format, ["p", [], [], 'do_p]>, "A range is a sequence of characters enclosed in square brackets (", <$format, ["tt", [], ["\"[]\""], 'do_tt]>, "). It normally matches any single character contained within the range sequence. Characters which normally have special significance (such as a dollar-sign, period and a back-slash) loose that significance when enclosed in a range. However, a range has its own special characters. If the range begins with a carat (", <$format, ["tt", [], ["\"^\""], 'do_tt]>, "), it matches any single character which is ", <$format, ["em", [], ["not"], 'do_em]>, " in the sequence. If two characters in the sequence are separated by a dash (", <$format, ["tt", [], ["\"-\""], 'do_tt]>, "), the full range of ASCII characters between the two are matched, including the two. For instance, ", <$format, ["tt", [], ["\"[0-9]\""], 'do_tt]>, " matches any single decimal digit from zero to nine. To include a literal square bracket (", <$format, ["tt", [], ["\"]\""], 'do_tt]>, ") in the sequence do not use the back-slash to escape it (as the back-slash does not have special meaning when in a range), instead place it at the begining of the range (following a possible ", <$format, ["tt", [], ["\"^\""], 'do_tt]>, "). To include a literal dash (", <$format, ["tt", [], ["\"-\""], 'do_tt]>, ") place it the start or end of the range."], #[['this, $help_driver_regularexpressions]]]>; var $root inited = 1; var $root managed = [$help_driver_regularexpressions]; var $root owned = [$help_driver_regularexpressions]; new object $help_driver_security: $help_coldc; var $root manager = $help_driver_security; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611036; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "security", "security"]; var $help_node links = #[["ColdC", $help_coldc], ["bind_function()", $help_func_bind_function], ["Defining Methods", $help_driver_methodintro]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": Security"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, "As the ColdC driver does not know what sort of environment you will be executing, by default all functions are callable by any object in the database. In order to preserve integrity it is strongly suggested that you build a heirarchy of trusted objects. Bind administrative-level functions to these objects using the function ", <$format, ["tt", [], [<$format, ["link", [["node", "$help_func_bind_function"]], ["bind_function()"], 'do_link]>], 'do_tt]>, " and restrict access to them. ", <$format, ["p", [], [], 'do_p]>, "It is suggested that the following functions always be bound and secured: ", <$format, ["ul", [], [" ", <$format, ["li", [], ["atomic() "], 'do_li]>, <$format, ["li", [], ["create() "], 'do_li]>, <$format, ["li", [], ["backup() "], 'do_li]>, <$format, ["li", [], ["shutdown() "], 'do_li]>, <$format, ["li", [], ["set_heartbeat() "], 'do_li]>, <$format, ["li", [], ["cancel() "], 'do_li]>, <$format, ["li", [], ["bind_port() "], 'do_li]>, <$format, ["li", [], ["unbind_port() "], 'do_li]>, <$format, ["li", [], ["open_connection() "], 'do_li]>, <$format, ["li", [], ["fopen() "], 'do_li]>, <$format, ["li", [], ["fstat() "], 'do_li]>, <$format, ["li", [], ["fchmod() "], 'do_li]>, <$format, ["li", [], ["fmkdir() "], 'do_li]>, <$format, ["li", [], ["frmdir() "], 'do_li]>, <$format, ["li", [], ["files() "], 'do_li]>, <$format, ["li", [], ["fremove() "], 'do_li]>, <$format, ["li", [], ["frename() "], 'do_li]>, <$format, ["li", [], ["fclose() "], 'do_li]>, <$format, ["li", [], ["fseek() "], 'do_li]>, <$format, ["li", [], ["feof() "], 'do_li]>, <$format, ["li", [], ["fwrite() "], 'do_li]>, <$format, ["li", [], ["fread() "], 'do_li]>, <$format, ["li", [], ["execute() "], 'do_li]>, <$format, ["li", [], ["fflush() "], 'do_li]>, <$format, ["li", [], ["bind_function() "], 'do_li]>, <$format, ["li", [], ["unbind_function() "], 'do_li]>], 'do_ul]>, " ", <$format, ["p", [], [], 'do_p]>, "It is also suggested that any additional function which modifies an object or which alters/retrieves data on an object be bound. ", <$format, ["p", [], [], 'do_p]>, "You can further secure your database by solidifying key methods in your internal security scheme (if one exists) and locking them (by setting the ", <$format, ["tt", [], ["'lock"], 'do_tt]>, " method flag, see section ", <$format, ["link", [["node", "$help_driver_methodintro"]], ["Defining Methods"], 'do_link]>, "). ", <$format, ["p", [], [], 'do_p]>], #[['this, $help_driver_security]]]>; var $root inited = 1; var $root managed = [$help_driver_security]; var $root owned = [$help_driver_security]; new object $help_driver_taskintro: $help_coldc; var $root manager = $help_driver_taskintro; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611036; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "task intro", "task intro"]; var $help_node links = #[["ColdC", $help_coldc], ["pause()", $help_func_pause], ["ticks_left()", $help_func_ticks_left], ["refresh()", $help_func_refresh], ["suspend()", $help_func_suspend], ["resume()", $help_func_resume], ["cancel()", $help_func_cancel], ["Networking", $help_driver_networking], ["atomic()", $help_func_atomic], ["Security", $help_driver_security]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": Frames and Tasks"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, "While a method is being executed it is called a ", <$format, ["i", [], ["frame"], 'do_i]>, ". The frame is relevant only to the current method. Each frame has a limited amount of time that it can execute in, also known as ", <$format, ["i", [], ["ticks"], 'do_i]>, ". If a frame runs out of ticks before it is finished executing, the ", <$format, ["tt", [], ["~ticks"], 'do_tt]>, " error is thrown. ", <$format, ["p", [], [], 'do_p]>, "Multiple methods calling each other in succession is called a task. Tasks usually originate from either a connection, a heartbeat, or by being forked from another task. There is no restriction on how long a task can execute, other than that imposed upon each frame. ", <$format, ["p", [], [], 'do_p]>, "It is possible to pause an executing frame and refresh the ticks it has by calling the function ", <$format, ["tt", [], [<$format, ["link", [["node", "$help_func_pause"]], ["pause()"], 'do_link]>], 'do_tt]>, ". When this occurs the frame stops executing and it's task is placed behind all other current tasks. When all other current tasks are completed executing the paused task will resume with a new tick pool. This behavior is called ", <$format, ["i", [], ["preempting"], 'do_i]>, ". ", <$format, ["p", [], [], 'do_p]>, "If you are unsure about the amount of ticks left in a method, you can call the function ", <$format, ["tt", [], [<$format, ["link", [["node", "$help_func_ticks_left"]], ["ticks_left()"], 'do_link]>], 'do_tt]>, ". Or, you can call ", <$format, ["tt", [], [<$format, ["link", [["node", "$help_func_refresh"]], ["refresh()"], 'do_link]>], 'do_tt]>, " instead of ", <$format, ["tt", [], ["pause()"], 'do_tt]>, ". ", <$format, ["tt", [], ["refresh()"], 'do_tt]>, " will only preempt if the current frame is nearly out of ticks. ", <$format, ["p", [], [], 'do_p]>, "You can also suspend a task indefinitely, by using the function ", <$format, ["tt", [], [<$format, ["link", [["node", "$help_func_suspend"]], ["suspend()"], 'do_link]>], 'do_tt]>, ". The function ", <$format, ["tt", [], [<$format, ["link", [["node", "$help_func_resume"]], ["resume()"], 'do_link]>], 'do_tt]>, " will resume a suspended task. The function ", <$format, ["tt", [], [<$format, ["link", [["node", "$help_func_cancel"]], ["cancel()"], 'do_link]>], 'do_tt]>, " will cancel a suspended task. ", <$format, ["p", [], [], 'do_p]>, "An example of suspending a task is for reading an indefinite amount of input from a connection. Input arrives through the ", <$format, ["i", [], ["parse"], 'do_i]>, " method on an object (see ", <$format, ["link", [["node", "$help_driver_networking"]], ["Networking"], 'do_link]>, "), which we define as follows, assuming the object variables ", <$format, ["i", [], ["reading"], 'do_i]>, ", ", <$format, ["i", [], ["read"], 'do_i]>, ", ", <$format, ["i", [], ["buffer"], 'do_i]>, " and ", <$format, ["i", [], ["lines"], 'do_i]>, ". ", <$format, ["i", [], ["reading"], 'do_i]>, " is used to store a boolean value of true or false, depending upon if we are reading input or not. ", <$format, ["i", [], ["read"], 'do_i]>, " is used to store what we have already read from the connection. ", <$format, ["i", [], ["buffer"], 'do_i]>, " is used to store incoming information which is not yet parsable by the function ", <$format, ["i", [], ["buf_to_strings()"], 'do_i]>, " (i.e. there is no carriage return yet). ", <$format, ["i", [], ["lines"], 'do_i]>, " is used to buffer lines converted by ", <$format, ["i", [], ["buf_to_strings()"], 'do_i]>, " from the connection which we have not parsed yet. It is important to use an object variable for both ", <$format, ["i", [], ["buffer"], 'do_i]>, " and ", <$format, ["i", [], ["lines"], 'do_i]>, ", because if the task suspends all information stored in either variable would be suspended along with that instance of the task. ", <$format, ["p", [], [], 'do_p]>, <$format, ["dfn", [], [<$format, ["quote", [], ["\n\ndriver method .parse() {\n arg incoming;\n var line;\n\n lines = buf_to_strings(buffer + incoming);\n buffer = lines[listlen(lines)];\n lines = delete(lines, listlen(lines));\n\n // now parse the lines\n for line in (buf_to_strings(incoming)) {\n if (reading) {\n if (line == \".\")\n .done_reading();\n else\n read += [line];\n } else {\n .parse_line(line);\n }\n }\n}\n"], 'do_quote]>, " "], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, "We will not define the method ", <$format, ["i", [], ["parse_line"], 'do_i]>, ", just assume that it parses the line as a command. When an object wishes to start reading from the connection it calls the method ", <$format, ["i", [], [".read()"], 'do_i]>, " on the connection object: ", <$format, ["p", [], [], 'do_p]>, <$format, ["dfn", [], [<$format, ["quote", [], ["\n\npublic method .read() {\n // reading just has to be true, so lets save space and store the task\n // id there as well, instead of storing it in another variable.\n reading = task_id();\n\n // make sure this is an empty list\n read = [];\n\n // suspend the task, have our return value be the return value of suspend\n // (which is whatever resume() sends)\n return suspend();\n}\n\n"], 'do_quote]>], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, "When a period is found as the line being read, the connection is done reading (the period is insignificant, you can terminate your reading any way you desire), and the method ", <$format, ["i", [], ["done_reading"], 'do_i]>, " is called: ", <$format, ["p", [], [], 'do_p]>, <$format, ["dfn", [], [<$format, ["quote", [], ["\n\nprotected method .done_reading() {\n var info, task;\n\n // get a local copy of what we read, and the task id\n info = read;\n task = reading;\n\n // reset the object variables first\n read = [];\n reading = 0;\n\n // resume the task, send what we read as the return value for suspend()\n resume(task, info);\n}\n\n"], 'do_quote]>], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, "Now, all that has to happen to read input from a connection is to call the method ", <$format, ["i", [], [".read()"], 'do_i]>, " on the connection object, and the input read is returned from the method call. ", <$format, ["p", [], [], 'do_p]>, "It is possible to set a task as ", <$format, ["i", [], ["atomic"], 'do_i]>, ". Atomic tasks cannot be preempted or suspended. If an attempt is made to preempt or suspend an atomic task the error ", <$format, ["tt", [], ["~atomic"], 'do_tt]>, " is thrown instead. However, calling ", <$format, ["tt", [], ["refresh()"], 'do_tt]>, " while executing atomically will always refresh the current frame's ticks. A task's atomic state is toggled using the function ", <$format, ["tt", [], [<$format, ["link", [["node", "$help_func_atomic"]], ["atomic()"], 'do_link]>], 'do_tt]>, ". ", <$format, ["p", [], [], 'do_p]>, <$format, ["b", [], ["Note:"], 'do_b]>, " be very cautious when using atomic tasks. Atomic tasks can easilly disrupt the regular integrity of an online environment. See the section on ", <$format, ["link", [["node", "$help_driver_security"]], ["Security"], 'do_link]>, "."], #[['this, $help_driver_taskintro]]]>; var $root inited = 1; var $root managed = [$help_driver_taskintro]; var $root owned = [$help_driver_taskintro]; new object $help_functions: $help_coldc; var $root manager = $help_functions; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611049; var $help_node group = 1; var $has_settings defined_settings = #[]; var $has_settings local_settings = ["group"]; var $has_settings settings = #[]; var $has_name name = ['prop, "functions", "functions"]; var $help_node links = #[["ColdC", $help_coldc], ["add_var()", $help_func_add_var], ["clear_var()", $help_func_clear_var], ["del_var()", $help_func_del_var], ["get_var()", $help_func_get_var], ["set_var()", $help_func_set_var], ["variables()", $help_func_variables], ["add_method()", $help_func_add_method], ["compile()", $help_func_compile], ["list_method()", $help_func_list_method], ["del_method()", $help_func_del_method], ["find_method()", $help_func_find_method], ["find_next_method()", $help_func_find_next_method], ["method_bytecode()", $help_func_method_bytecode], ["method_access()", $help_func_method_access], ["method_info()", $help_func_method_info], ["method_flags()", $help_func_method_flags], ["methods()", $help_func_methods], ["rename_method()", $help_func_rename_method], ["set_method_access()", $help_func_set_method_access], ["set_method_flags()", $help_func_set_method_flags], ["ancestors()", $help_func_ancestors], ["chparents()", $help_func_chparents], ["create()", $help_func_create], ["data()", $help_func_data], ["del_objname()", $help_func_del_objname], ["descendants()", $help_func_descendants], ["destroy()", $help_func_destroy], ["children()", $help_func_children], ["has_ancestor()", $help_func_has_ancestor], ["lookup()", $help_func_lookup], ["objname()", $help_func_objname], ["objnum()", $help_func_objnum], ["parents()", $help_func_parents], ["set_objname()", $help_func_set_objname], ["backup()", $help_func_backup], ["dblog()", $help_func_dblog], ["set_heartbeat()", $help_func_set_heartbeat], ["shutdown()", $help_func_shutdown], ["atomic()", $help_func_atomic], ["caller()", $help_func_caller], ["cancel()", $help_func_cancel], ["definer()", $help_func_definer], ["method()", $help_func_method], ["pause()", $help_func_pause], ["refresh()", $help_func_refresh], ["resume()", $help_func_resume], ["sender()", $help_func_sender], ["stack()", $help_func_stack], ["suspend()", $help_func_suspend], ["task_id()", $help_func_task_id], ["tasks()", $help_func_tasks], ["this()", $help_func_this], ["tick()", $help_func_tick], ["ticks_left()", $help_func_ticks_left], ["error()", $help_func_error], ["rethrow()", $help_func_rethrow], ["throw()", $help_func_throw], ["traceback()", $help_func_traceback], ["bind_port()", $help_func_bind_port], ["close_connection()", $help_func_close_connection], ["connection()", $help_func_connection], ["cwrite()", $help_func_cwrite], ["cwritef()", $help_func_cwritef], ["open_connection()", $help_func_open_connection], ["reassign_connection()", $help_func_reassign_connection], ["unbind_port()", $help_func_unbind_port], ["execute()", $help_func_execute], ["fchmod()", $help_func_fchmod], ["fclose()", $help_func_fclose], ["feof()", $help_func_feof], ["fflush()", $help_func_fflush], ["file()", $help_func_file], ["files()", $help_func_files], ["fmkdir()", $help_func_fmkdir], ["fopen()", $help_func_fopen], ["frmdir()", $help_func_frmdir], ["fstat()", $help_func_fstat], ["fread()", $help_func_fread], ["fremove()", $help_func_fremove], ["frename()", $help_func_frename], ["fseek()", $help_func_fseek], ["fwrite()", $help_func_fwrite], ["bind_function()", $help_func_bind_function], ["ctime()", $help_func_ctime], ["localtime()", $help_func_localtime], ["mtime()", $help_func_mtime], ["time()", $help_func_time], ["unbind_function()", $help_func_unbind_function], ["class()", $help_func_class], ["size()", $help_func_size], ["toerr()", $help_func_toerr], ["tofloat()", $help_func_tofloat], ["toint()", $help_func_toint], ["toliteral()", $help_func_toliteral], ["toobjnum()", $help_func_toobjnum], ["tostr()", $help_func_tostr], ["tosym()", $help_func_tosym], ["type()", $help_func_type], ["valid()", $help_func_valid], ["buflen()", $help_func_buflen], ["bufgraft()", $help_func_bufgraft], ["buf_replace()", $help_func_buf_replace], ["buf_to_str()", $help_func_buf_to_str], ["buf_to_strings()", $help_func_buf_to_strings], ["str_to_buf()", $help_func_str_to_buf], ["strings_to_buf()", $help_func_strings_to_buf], ["subbuf()", $help_func_subbuf], ["dict_add()", $help_func_dict_add], ["dict_contains()", $help_func_dict_contains], ["dict_del()", $help_func_dict_del], ["dict_keys()", $help_func_dict_keys], ["abs()", $help_func_abs], ["max()", $help_func_max], ["min()", $help_func_min], ["random()", $help_func_random], ["sin()", $help_func_math], ["exp()", $help_func_math], ["log()", $help_func_math], ["cos()", $help_func_math], ["tan()", $help_func_math], ["sqrt()", $help_func_math], ["asin()", $help_func_math], ["acos()", $help_func_math], ["atan()", $help_func_math], ["pow()", $help_func_math], ["atan2()", $help_func_math], ["delete()", $help_func_delete], ["insert()", $help_func_insert], ["listlen()", $help_func_listlen], ["listgraft()", $help_func_listgraft], ["replace()", $help_func_replace], ["setadd()", $help_func_setadd], ["setremove()", $help_func_setremove], ["sublist()", $help_func_sublist], ["union()", $help_func_union], ["crypt()", $help_func_crypt], ["explode()", $help_func_explode], ["lowercase()", $help_func_lowercase], ["match_begin()", $help_func_match_begin], ["match_pattern()", $help_func_match_pattern], ["match_regexp()", $help_func_match_regexp], ["match_template()", $help_func_match_template], ["pad()", $help_func_pad], ["regexp()", $help_func_regexp], ["strcmp()", $help_func_strcmp], ["strfmt()", $help_func_strfmt], ["strgraft()", $help_func_strgraft], ["strlen()", $help_func_strlen], ["strsed()", $help_func_strsed], ["strsub()", $help_func_strsub], ["substr()", $help_func_substr], ["uppercase()", $help_func_uppercase]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": Function/Method Reference"], 'do_subj]>, " ", <$format, ["subj", [["level", "2"]], ["Object Variable functions"], 'do_subj]>, " ", <$format, ["dfn", [], [" ", <$format, ["link", [["node", "$help_func_add_var"]], ["add_var()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_clear_var"]], ["clear_var()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_del_var"]], ["del_var()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_get_var"]], ["get_var()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_set_var"]], ["set_var()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_variables"]], ["variables()"], 'do_link]>, " "], 'do_dfn]>, " ", <$format, ["subj", [["level", "2"]], ["Object Method functions"], 'do_subj]>, " ", <$format, ["dfn", [], [" ", <$format, ["link", [["node", "$help_func_add_method"]], ["add_method()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_compile"]], ["compile()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_list_method"]], ["list_method()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_del_method"]], ["del_method()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_find_method"]], ["find_method()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_find_next_method"]], ["find_next_method()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_method_bytecode"]], ["method_bytecode()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_method_access"]], ["method_access()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_method_info"]], ["method_info()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_method_flags"]], ["method_flags()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_methods"]], ["methods()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_rename_method"]], ["rename_method()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_set_method_access"]], ["set_method_access()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_set_method_flags"]], ["set_method_flags()"], 'do_link]>, " "], 'do_dfn]>, " ", <$format, ["subj", [["level", "2"]], ["Object functions"], 'do_subj]>, " ", <$format, ["dfn", [], [" ", <$format, ["link", [["node", "$help_func_ancestors"]], ["ancestors()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_chparents"]], ["chparents()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_create"]], ["create()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_data"]], ["data()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_del_objname"]], ["del_objname()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_descendants"]], ["descendants()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_destroy"]], ["destroy()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_children"]], ["children()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_has_ancestor"]], ["has_ancestor()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_lookup"]], ["lookup()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_objname"]], ["objname()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_objnum"]], ["objnum()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_parents"]], ["parents()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_set_objname"]], ["set_objname()"], 'do_link]>, " "], 'do_dfn]>, " ", <$format, ["subj", [["level", "2"]], ["System functions"], 'do_subj]>, " ", <$format, ["dfn", [], [" ", <$format, ["link", [["node", "$help_func_backup"]], ["backup()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_dblog"]], ["dblog()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_set_heartbeat"]], ["set_heartbeat()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_shutdown"]], ["shutdown()"], 'do_link]>, " "], 'do_dfn]>, " ", <$format, ["subj", [["level", "2"]], ["Task/Frame functions"], 'do_subj]>, " ", <$format, ["dfn", [], [" ", <$format, ["link", [["node", "$help_func_atomic"]], ["atomic()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_caller"]], ["caller()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_cancel"]], ["cancel()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_definer"]], ["definer()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_method"]], ["method()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_pause"]], ["pause()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_refresh"]], ["refresh()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_resume"]], ["resume()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_sender"]], ["sender()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_stack"]], ["stack()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_suspend"]], ["suspend()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_task_id"]], ["task_id()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_tasks"]], ["tasks()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_this"]], ["this()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_tick"]], ["tick()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_ticks_left"]], ["ticks_left()"], 'do_link]>, " "], 'do_dfn]>, " ", <$format, ["subj", [["level", "2"]], ["Error Handling functions"], 'do_subj]>, " ", <$format, ["dfn", [], [" ", <$format, ["link", [["node", "$help_func_error"]], ["error()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_rethrow"]], ["rethrow()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_throw"]], ["throw()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_traceback"]], ["traceback()"], 'do_link]>, " "], 'do_dfn]>, " ", <$format, ["subj", [["level", "2"]], ["Network control functions"], 'do_subj]>, " ", <$format, ["dfn", [], [" ", <$format, ["link", [["node", "$help_func_bind_port"]], ["bind_port()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_close_connection"]], ["close_connection()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_connection"]], ["connection()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_cwrite"]], ["cwrite()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_cwritef"]], ["cwritef()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_open_connection"]], ["open_connection()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_reassign_connection"]], ["reassign_connection()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_unbind_port"]], ["unbind_port()"], 'do_link]>, " "], 'do_dfn]>, " ", <$format, ["subj", [["level", "2"]], ["File control functions"], 'do_subj]>, " ", <$format, ["dfn", [], [" ", <$format, ["link", [["node", "$help_func_execute"]], ["execute()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_fchmod"]], ["fchmod()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_fclose"]], ["fclose()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_feof"]], ["feof()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_fflush"]], ["fflush()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_file"]], ["file()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_files"]], ["files()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_fmkdir"]], ["fmkdir()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_fopen"]], ["fopen()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_frmdir"]], ["frmdir()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_fstat"]], ["fstat()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_fread"]], ["fread()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_fremove"]], ["fremove()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_frename"]], ["frename()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_fseek"]], ["fseek()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_fwrite"]], ["fwrite()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_dblog"]], ["dblog()"], 'do_link]>, " "], 'do_dfn]>, " ", <$format, ["subj", [["level", "2"]], ["Misc functions"], 'do_subj]>, " ", <$format, ["dfn", [], [" ", <$format, ["link", [["node", "$help_func_bind_function"]], ["bind_function()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_ctime"]], ["ctime()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_localtime"]], ["localtime()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_mtime"]], ["mtime()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_time"]], ["time()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_unbind_function"]], ["unbind_function()"], 'do_link]>, " "], 'do_dfn]>, " ", <$format, ["subj", [["level", "2"]], ["General data functions"], 'do_subj]>, " ", <$format, ["dfn", [], [" ", <$format, ["link", [["node", "$help_func_class"]], ["class()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_size"]], ["size()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_toerr"]], ["toerr()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_tofloat"]], ["tofloat()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_toint"]], ["toint()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_toliteral"]], ["toliteral()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_toobjnum"]], ["toobjnum()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_tostr"]], ["tostr()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_tosym"]], ["tosym()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_type"]], ["type()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_valid"]], ["valid()"], 'do_link]>, " "], 'do_dfn]>, " ", <$format, ["subj", [["level", "2"]], ["Buffer functions"], 'do_subj]>, " ", <$format, ["dfn", [], [" ", <$format, ["link", [["node", "$help_func_buflen"]], ["buflen()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_bufgraft"]], ["bufgraft()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_buf_replace"]], ["buf_replace()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_buf_to_str"]], ["buf_to_str()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_buf_to_strings"]], ["buf_to_strings()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_str_to_buf"]], ["str_to_buf()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_strings_to_buf"]], ["strings_to_buf()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_subbuf"]], ["subbuf()"], 'do_link]>, " "], 'do_dfn]>, " ", <$format, ["subj", [["level", "2"]], ["Dictionary functions"], 'do_subj]>, " ", <$format, ["dfn", [], [" ", <$format, ["link", [["node", "$help_func_dict_add"]], ["dict_add()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_dict_contains"]], ["dict_contains()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_dict_del"]], ["dict_del()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_dict_keys"]], ["dict_keys()"], 'do_link]>, " "], 'do_dfn]>, " ", <$format, ["subj", [["level", "2"]], ["Integer/Float/Math functions"], 'do_subj]>, " ", <$format, ["dfn", [], [" ", <$format, ["link", [["node", "$help_func_abs"]], ["abs()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_max"]], ["max()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_min"]], ["min()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_random"]], ["random()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_math"]], ["sin()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_math"]], ["exp()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_math"]], ["log()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_math"]], ["cos()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_math"]], ["tan()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_math"]], ["sqrt()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_math"]], ["asin()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_math"]], ["acos()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_math"]], ["atan()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_math"]], ["pow()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_math"]], ["atan2()"], 'do_link]>, " "], 'do_dfn]>, " ", <$format, ["subj", [["level", "2"]], ["List functions"], 'do_subj]>, " ", <$format, ["dfn", [], [" ", <$format, ["link", [["node", "$help_func_delete"]], ["delete()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_insert"]], ["insert()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_listlen"]], ["listlen()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_listgraft"]], ["listgraft()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_replace"]], ["replace()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_setadd"]], ["setadd()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_setremove"]], ["setremove()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_sublist"]], ["sublist()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_union"]], ["union()"], 'do_link]>, " "], 'do_dfn]>, " ", <$format, ["subj", [["level", "2"]], ["String functions"], 'do_subj]>, " ", <$format, ["dfn", [], [" ", <$format, ["link", [["node", "$help_func_crypt"]], ["crypt()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_explode"]], ["explode()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_lowercase"]], ["lowercase()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_match_begin"]], ["match_begin()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_match_pattern"]], ["match_pattern()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_match_regexp"]], ["match_regexp()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_match_template"]], ["match_template()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_pad"]], ["pad()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_regexp"]], ["regexp()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_strcmp"]], ["strcmp()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_strfmt"]], ["strfmt()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_strgraft"]], ["strgraft()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_strlen"]], ["strlen()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_strsed"]], ["strsed()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_strsub"]], ["strsub()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_substr"]], ["substr()"], 'do_link]>, " ", <$format, ["link", [["node", "$help_func_uppercase"]], ["uppercase()"], 'do_link]>, " "], 'do_dfn]>], #[['this, $help_functions]]]>; var $root inited = 1; var $root managed = [$help_functions]; var $root owned = [$help_functions]; new object $help_func_abs: $help_functions; var $root manager = $help_func_abs; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611053; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "abs", "abs"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": abs()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["INTEGER|FLOAT"], 'do_i]>, " ", <$format, ["b", [], ["abs"], 'do_b]>, "(", <$format, ["i", [], ["INTEGER|FLOAT ", <$format, ["b", [], ["number"], 'do_b]>], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function returns the absolute value of ", <$format, ["i", [], ["number"], 'do_i]>, ", where ", <$format, ["i", [], ["number"], 'do_i]>, " can be either a float or an integer (and the same type of value is returned). ", <$format, ["p", [], [], 'do_p]>, " Examples: ", <$format, ["dfn", [], [" ", <$format, ["quote", [], ["\n\nabs(-6)\n=> 6\n\nabs(7)\n=> 7\n\nabs(-000.12);\n=> 0.120000\n\n"], 'do_quote]>, " "], 'do_dfn]>], #[['this, $help_func_abs]]]>; var $root inited = 1; var $root managed = [$help_func_abs]; var $root owned = [$help_func_abs]; new object $help_func_add_method: $help_functions; var $root manager = $help_func_add_method; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611080; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "add_method", "add_method"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions], ["compile()", $help_func_compile]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": add_method()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["LIST"], 'do_i]>, " ", <$format, ["b", [], ["add_method"], 'do_b]>, "(", <$format, ["i", [], ["LIST ", <$format, ["b", [], ["code"], 'do_b]>, ", SYMBOL ", <$format, ["b", [], ["name"], 'do_b]>], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function compiles ", <$format, ["i", [], ["code"], 'do_i]>, " (which should be a list of strings) and uses the result as the definition of the method named by the symbol ", <$format, ["i", [], ["name"], 'do_i]>, ". If there were errors in compiling, a list of strings describing the errors is returned, otherwise an empty list is returned. ", <$format, ["p", [], [], 'do_p]>, "In the future add_method() will accept only a pre-compiled method from ", <$format, ["tt", [], [<$format, ["link", [["node", "$help_func_compile"]], ["compile()"], 'do_link]>], 'do_tt]>, " instead of a LIST of code. ", <$format, ["p", [], [], 'do_p]>, "Examples: ", <$format, ["dfn", [], [<$format, ["quote", [], ["\n\nadd_method([\"echo(\\\"foo\\\");\"], 'foo)\n=> []\n\nadd_method([\"echo(\\\"foo\\\")\"], 'foo)\n=> [\"Line 2: parse error\"]\n\n"], 'do_quote]>], 'do_dfn]>], #[['this, $help_func_add_method]]]>; var $root inited = 1; var $root managed = [$help_func_add_method]; var $root owned = [$help_func_add_method]; new object $help_func_add_var: $help_functions; var $root manager = $help_func_add_var; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611081; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "add_var", "add_var"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": add_var()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["INTEGER"], 'do_i]>, " ", <$format, ["b", [], ["add_var"], 'do_b]>, "(", <$format, ["i", [], ["SYMBOL ", <$format, ["b", [], ["name"], 'do_b]>], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function defines an object variable on the current object. The name of the variable is defined by the symbol ", <$format, ["i", [], ["name"], 'do_i]>, ". If an object variable already exists by the desired name, the error ", <$format, ["tt", [], ["~varexists"], 'do_tt]>, " is thrown. ", <$format, ["tt", [], ["add_var()"], 'do_tt]>, " returns ", <$format, ["tt", [], ["1"], 'do_tt]>, " if it is successful."], #[['this, $help_func_add_var]]]>; var $root inited = 1; var $root managed = [$help_func_add_var]; var $root owned = [$help_func_add_var]; new object $help_func_ancestors: $help_functions; var $root manager = $help_func_ancestors; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611081; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "ancestors", "ancestors"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": ancestors()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["LIST"], 'do_i]>, " ", <$format, ["b", [], ["ancestors"], 'do_b]>, "()", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function returns a list of the objnums of the ancestors of the current object, in the order that they would normally be searched for methods. The objnums of the current object will be the first element of the list."], #[['this, $help_func_ancestors]]]>; var $root inited = 1; var $root managed = [$help_func_ancestors]; var $root owned = [$help_func_ancestors]; new object $help_func_atomic: $help_functions; var $root manager = $help_func_atomic; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611081; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "atomic", "atomic"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions], ["Frames and Tasks", $help_driver_taskintro]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": atomic()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["INTEGER"], 'do_i]>, " ", <$format, ["b", [], ["atomic"], 'do_b]>, "(", <$format, ["i", [], ["INTEGER ", <$format, ["b", [], ["goatomic"], 'do_b]>], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function is used to set the server in atomic mode. If the argument is false (zero) the server becomes non-atomic. If the argument is true (non-zero) the server becomes atomic. Note: ", <$format, ["i", [], ["read the section ", <$format, ["link", [["node", "$help_driver_taskintro"]], ["Frames and Tasks"], 'do_link]>], 'do_i]>, " before using ", <$format, ["tt", [], ["atomic()"], 'do_tt]>, "!"], #[['this, $help_func_atomic]]]>; var $root inited = 1; var $root managed = [$help_func_atomic]; var $root owned = [$help_func_atomic]; new object $help_func_backup: $help_functions; var $root manager = $help_func_backup; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611081; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "backup", "backup"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": backup()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["INTEGER"], 'do_i]>, " ", <$format, ["b", [], ["backup"], 'do_b]>, "()", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function syncronizes the running database on disk and copies a backup to ", <$format, ["i", [], ["binary"], 'do_i]>, ".bak, where ", <$format, ["i", [], ["binary"], 'do_i]>, " is the binary database directory name specified upon bootup (defaulting to ", <$format, ["tt", [], ["binary"], 'do_tt]>, "). If the backup name already exists it and any of it's sub contents are removed. ", <$format, ["p", [], [], 'do_p]>, "The return value represents the success of the backup. A value of one was a success. A value of zero means the backup failed when it tried to execute ", <$format, ["tt", [], ["rm"], 'do_tt]>, " in removing the existing ", <$format, ["i", [], ["binary"], 'do_i]>, ".bak directory. A value of negative one (-1) means the backup failed when attempting to execute ", <$format, ["tt", [], ["cp"], 'do_tt]>, " in copying the database. The error ", <$format, ["tt", [], ["~error"], 'do_tt]>, " is thrown if the backup cannot remove ", <$format, ["i", [], ["binary"], 'do_i]>, ".bak (insufficient permission). ", <$format, ["p", [], [], 'do_p]>, "Note: because of the nature of running a disk database it is not possible to fork the server for a backup. The time involved in a backup is primarily disk related (i.e. copying the binary db to another directory). If you have a fast disk, backups will be fast. In general backups will be much faster than other Virtual Environment System drivers. Because backups are atomic, other tasks will not execute while the backup is occuring."], #[['this, $help_func_backup]]]>; var $root inited = 1; var $root managed = [$help_func_backup]; var $root owned = [$help_func_backup]; new object $help_func_bind_function: $help_functions; var $root manager = $help_func_bind_function; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611081; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "bind_function", "bind_function"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": bind_function()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["INTEGER"], 'do_i]>, " ", <$format, ["b", [], ["bind_function"], 'do_b]>, "(", <$format, ["i", [], ["SYMBOL ", <$format, ["b", [], ["function"], 'do_b]>, ", OBJNUM, ", <$format, ["b", [], ["obj"], 'do_b]>], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function is used to secure other ColdC functions which may have potential security problems. It binds the function specified by the argument ", <$format, ["i", [], ["function"], 'do_i]>, " to the object specified by ", <$format, ["i", [], ["obj"], 'do_i]>, ". After a function is bound to an object, ONLY methods ", <$format, ["i", [], ["defined"], 'do_i]>, " on that object may call the function. Methods defined on descendants of the object also cannot call it (although they can call methods defined on the object, which in turn call the function)."], #[['this, $help_func_bind_function]]]>; var $root inited = 1; var $root managed = [$help_func_bind_function]; var $root owned = [$help_func_bind_function]; new object $help_func_bind_port: $help_functions; var $root manager = $help_func_bind_port; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611081; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "bind_port", "bind_port"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions], ["Networking", $help_driver_networking]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": bind_port()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["INTEGER"], 'do_i]>, " ", <$format, ["b", [], ["bind_port"], 'do_b]>, "(", <$format, ["i", [], ["INTEGER ", <$format, ["b", [], ["port"], 'do_b]>], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function binds a network port to the current object. If successful, the current object will receive connections on the port. For more information on networking see ", <$format, ["link", [["node", "$help_driver_networking"]], ["Networking"], 'do_link]>, ". If an error occurs either ", <$format, ["tt", [], ["~bind"], 'do_tt]>, " or ", <$format, ["tt", [], ["~socket"], 'do_tt]>, " will be thrown."], #[['this, $help_func_bind_port]]]>; var $root inited = 1; var $root managed = [$help_func_bind_port]; var $root owned = [$help_func_bind_port]; new object $help_func_buf_replace: $help_functions; var $root manager = $help_func_buf_replace; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611081; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "buf_replace", "buf_replace"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": buf_replace()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["BUFFER"], 'do_i]>, " ", <$format, ["b", [], ["buf_replace"], 'do_b]>, "(", <$format, ["i", [], ["BUFFER ", <$format, ["b", [], ["buf"], 'do_b]>, ", INTEGER ", <$format, ["b", [], ["pos"], 'do_b]>, ", INTEGER ", <$format, ["b", [], ["char"], 'do_b]>], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function replaces the character in the buffer at position ", <$format, ["i", [], ["pos"], 'do_i]>, " with the character specified by the integer ", <$format, ["i", [], ["char"], 'do_i]>, "."], #[['this, $help_func_buf_replace]]]>; var $root inited = 1; var $root managed = [$help_func_buf_replace]; var $root owned = [$help_func_buf_replace]; new object $help_func_buf_to_str: $help_functions; var $root manager = $help_func_buf_to_str; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611081; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "buf_to_str", "buf_to_str"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": buf_to_str()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["STRING"], 'do_i]>, " ", <$format, ["b", [], ["buf_to_str"], 'do_b]>, "(", <$format, ["i", [], ["BUFFER ", <$format, ["b", [], ["buf"], 'do_b]>], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function converts the entire buffer specified by buf to a string. Newlines are converted to \"n\". To just get the first string in the buffer you can do: ", <$format, ["dfn", [], [<$format, ["quote", [], ["\n\ni = `[10] in buffer;\nstr = buf_to_str(subbuf(buffer, 1, i - 1));\nbuffer = subbuf(buffer, i + 1);\n\n"], 'do_quote]>], 'do_dfn]>], #[['this, $help_func_buf_to_str]]]>; var $root inited = 1; var $root managed = [$help_func_buf_to_str]; var $root owned = [$help_func_buf_to_str]; new object $help_func_buf_to_strings: $help_functions; var $root manager = $help_func_buf_to_strings; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611081; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "buf_to_strings", "buf_to_strings"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": buf_to_strings()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["LIST"], 'do_i]>, " ", <$format, ["b", [], ["buf_to_strings"], 'do_b]>, "(", <$format, ["i", [], ["BUFFER ", <$format, ["b", [], ["buf"], 'do_b]>, " [,BUFFER ", <$format, ["b", [], ["sep"], 'do_b]>, "]"], 'do_i]>, "})", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function converts the buffer specified by ", <$format, ["i", [], ["buf"], 'do_i]>, " to a list of strings. Each string is a line in the buffer, terminated by a newline. It will alternatively split the strings based off the buffer ", <$format, ["i", [], ["sep"], 'do_i]>, ", if it is specified. Note: it is not necessary to specify both a carriage return and a newline as the seperator--if both exist--as the newline will be sufficient to break the string, and the carriage return will be discarded as an unprintable character in the string."], #[['this, $help_func_buf_to_strings]]]>; var $root inited = 1; var $root managed = [$help_func_buf_to_strings]; var $root owned = [$help_func_buf_to_strings]; new object $help_func_bufgraft: $help_functions; var $root manager = $help_func_bufgraft; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611081; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "bufgraft", "bufgraft"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": bufgraft()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["BUFFER"], 'do_i]>, " ", <$format, ["b", [], ["bufgraft"], 'do_b]>, "(", <$format, ["i", [], ["BUFFER ", <$format, ["b", [], ["buf"], 'do_b]>, ", INTEGER ", <$format, ["b", [], ["pos"], 'do_b]>, ", BUFFER ", <$format, ["b", [], ["what"], 'do_b]>], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function will graft ", <$format, ["i", [], ["what"], 'do_i]>, " into the buffer at ", <$format, ["i", [], ["pos"], 'do_i]>, "."], #[['this, $help_func_bufgraft]]]>; var $root inited = 1; var $root managed = [$help_func_bufgraft]; var $root owned = [$help_func_bufgraft]; new object $help_func_buflen: $help_functions; var $root manager = $help_func_buflen; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611081; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "buflen", "buflen"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": buflen()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["INTEGER"], 'do_i]>, " ", <$format, ["b", [], ["buflen"], 'do_b]>, "(", <$format, ["i", [], ["BUFFER ", <$format, ["b", [], ["buf"], 'do_b]>], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function returns the length of the buffer specified by ", <$format, ["i", [], ["buf"], 'do_i]>, "."], #[['this, $help_func_buflen]]]>; var $root inited = 1; var $root managed = [$help_func_buflen]; var $root owned = [$help_func_buflen]; new object $help_func_caller: $help_functions; var $root manager = $help_func_caller; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611081; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "caller", "caller"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": caller()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["OBJNUM"], 'do_i]>, " ", <$format, ["b", [], ["caller"], 'do_b]>, "()", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function returns the objnum of the object which defines the method which called the current method. If the current method was called by the driver zero (0) is returned instead."], #[['this, $help_func_caller]]]>; var $root inited = 1; var $root managed = [$help_func_caller]; var $root owned = [$help_func_caller]; new object $help_func_cancel: $help_functions; var $root manager = $help_func_cancel; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611081; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "cancel", "cancel"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": cancel()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["INTEGER"], 'do_i]>, " ", <$format, ["b", [], ["cancel"], 'do_b]>, "(", <$format, ["i", [], ["INTEGER ", <$format, ["b", [], ["task_id"], 'do_b]>], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function cancels the task which has the id ", <$format, ["i", [], ["task_id"], 'do_i]>, ". The task is usually suspended or preempted. If the task does not exist, ", <$format, ["tt", [], ["~type"], 'do_tt]>, " is thrown."], #[['this, $help_func_cancel]]]>; var $root inited = 1; var $root managed = [$help_func_cancel]; var $root owned = [$help_func_cancel]; new object $help_func_children: $help_functions; var $root manager = $help_func_children; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611081; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "children", "children"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": children()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["LIST"], 'do_i]>, " ", <$format, ["b", [], ["children"], 'do_b]>, "()", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function returns a list of the objnums for the children of the current object, in no particular order."], #[['this, $help_func_children]]]>; var $root inited = 1; var $root managed = [$help_func_children]; var $root owned = [$help_func_children]; new object $help_func_chparents: $help_functions; var $root manager = $help_func_chparents; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611081; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "chparents", "chparents"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": chparents()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["INTEGER"], 'do_i]>, " ", <$format, ["b", [], ["chparents"], 'do_b]>, "(", <$format, ["i", [], ["LIST ", <$format, ["b", [], ["parents"], 'do_b]>], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function changes the parents of the current object to the list of objnums in ", <$format, ["i", [], ["parents"], 'do_i]>, ". If any of the objnums in ", <$format, ["i", [], ["parents"], 'do_i]>, " do not refer to an existing object, then the error ", <$format, ["tt", [], ["~objnf"], 'do_tt]>, " is thrown. If any of the parents have the current object as an ancestor, or are the current object, then the error ", <$format, ["tt", [], ["~parent"], 'do_tt]>, " is thrown. If ", <$format, ["i", [], ["parents"], 'do_i]>, " is an empty list, then ", <$format, ["tt", [], ["~perm"], 'do_tt]>, " is thrown. Otherwise a ", <$format, ["tt", [], ["1"], 'do_tt]>, " is returned."], #[['this, $help_func_chparents]]]>; var $root inited = 1; var $root managed = [$help_func_chparents]; var $root owned = [$help_func_chparents]; new object $help_func_class: $help_functions; var $root manager = $help_func_class; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611081; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "class", "class"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions], ["Frobs", $help_driver_structure_types]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": class()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["OBJNUM"], 'do_i]>, " ", <$format, ["b", [], ["class"], 'do_b]>, "(", <$format, ["i", [], ["FROB ", <$format, ["b", [], ["frob"], 'do_b]>], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function returns the class of a frob. See ", <$format, ["link", [["node", "$help_driver_structure_types"]], ["Frobs"], 'do_link]>, " for more details."], #[['this, $help_func_class]]]>; var $root inited = 1; var $root managed = [$help_func_class]; var $root owned = [$help_func_class]; new object $help_func_clear_var: $help_functions; var $root manager = $help_func_clear_var; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611081; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "clear_var", "clear_var"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": clear_var()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["INTEGER"], 'do_i]>, " ", <$format, ["b", [], ["clear_var"], 'do_b]>, "(", <$format, ["i", [], ["SYMBOL ", <$format, ["b", [], ["name"], 'do_b]>], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, <$format, ["tt", [], ["clear_var()"], 'do_tt]>, " clears the value of a variable defined on an ancestor, from the current object. If this function is not called before an an ancestor is removed, variables defined on that ancestor and set on the current object ", <$format, ["i", [], ["will remain"], 'do_i]>, ". This function is also useful in reducing database usage, as a cleared variable takes up no space, whereas a set variable (even to a value of ", <$format, ["tt", [], ["0"], 'do_tt]>, ") does. If the object variable ", <$format, ["i", [], ["name"], 'do_i]>, " is not defined on the ancestor which defines the method calling ", <$format, ["tt", [], ["clear_var()"], 'do_tt]>, ", the error ", <$format, ["tt", [], ["~varnf"], 'do_tt]>, " is thrown. Upon successful execution ", <$format, ["tt", [], ["clear_var()"], 'do_tt]>, " returns ", <$format, ["tt", [], ["1"], 'do_tt]>, "."], #[['this, $help_func_clear_var]]]>; var $root inited = 1; var $root managed = [$help_func_clear_var]; var $root owned = [$help_func_clear_var]; new object $help_func_close_connection: $help_functions; var $root manager = $help_func_close_connection; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611081; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "close_connection", "close_connection"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": close_connection()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["INTEGER"], 'do_i]>, " ", <$format, ["b", [], ["close_connection"], 'do_b]>, "()", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function closes the connection on the current object. If there is no connection on the current object, zero is returned."], #[['this, $help_func_close_connection]]]>; var $root inited = 1; var $root managed = [$help_func_close_connection]; var $root owned = [$help_func_close_connection]; new object $help_func_coldmud: $help_functions; var $root manager = $help_func_coldmud; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611081; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "coldmud", "coldmud"]; var $help_node links = #[]; var $help_node body = <$ctext_frob, [["This node isn't written yet"], #[['this, $help_func_coldmud]]]>; var $root inited = 1; var $root managed = [$help_func_coldmud]; var $root owned = [$help_func_coldmud]; new object $help_func_coldmud_5: $help_functions; var $root manager = $help_func_coldmud_5; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611082; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "coldmud_5", "coldmud_5"]; var $help_node links = #[]; var $help_node body = <$ctext_frob, [["This node isn't written yet"], #[['this, $help_func_coldmud_5]]]>; var $root inited = 1; var $root managed = [$help_func_coldmud_5]; var $root owned = [$help_func_coldmud_5]; new object $help_func_compile: $help_functions; var $root manager = $help_func_compile; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611082; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "compile", "compile"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": compile()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["LIST"], 'do_i]>, " ", <$format, ["b", [], ["compile"], 'do_b]>, "(", <$format, ["i", [], ["LIST ", <$format, ["b", [], ["code"], 'do_b]>], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "Currently this method does nothing. When parse tree's are implemented this method will be used to compile a list of strings to an internal parse tree. It will return the compiled parse tree, or a list of errors (strings)."], #[['this, $help_func_compile]]]>; var $root inited = 1; var $root managed = [$help_func_compile]; var $root owned = [$help_func_compile]; new object $help_func_connection: $help_functions; var $root manager = $help_func_connection; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611082; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "connection", "connection"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": connection()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["LIST"], 'do_i]>, " ", <$format, ["b", [], ["connection"], 'do_b]>, "()", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function returns a list of information on the current connection. If no connection exists, ", <$format, ["tt", [], ["~net"], 'do_tt]>, " is thrown. The list is ordered as: ", <$format, ["ol", [], [" ", <$format, ["li", [], ["INTEGER boolean (true if the connection is readable) "], 'do_li]>, <$format, ["li", [], ["INTEGER boolean (true if the connection is writable) "], 'do_li]>, <$format, ["li", [], ["INTEGER boolean (true if the connection is dead) "], 'do_li]>, <$format, ["li", [], ["INTEGER file descriptor "], 'do_li]>], 'do_ol]>, " ", <$format, ["p", [], [], 'do_p]>, "Most of this information is useful only for debugging, as it can change immediately (all but the file descriptor). This function is useful for determining if the current object has a valid connection."], #[['this, $help_func_connection]]]>; var $root inited = 1; var $root managed = [$help_func_connection]; var $root owned = [$help_func_connection]; new object $help_func_create: $help_functions; var $root manager = $help_func_create; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611082; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "create", "create"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": create()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["OBJNUM"], 'do_i]>, " ", <$format, ["b", [], ["create"], 'do_b]>, "(", <$format, ["i", [], ["LIST ", <$format, ["b", [], ["parents"], 'do_b]>], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function creates and returns the objnum of an object with the parents in the list ", <$format, ["i", [], ["parents"], 'do_i]>, ", which should be a list of objnums referring to existing objects. If any of the parent objnums do not refer to existing objects, then ", <$format, ["tt", [], ["create()"], 'do_tt]>, " throws the error ", <$format, ["tt", [], ["~objnf"], 'do_tt]>, "."], #[['this, $help_func_create]]]>; var $root inited = 1; var $root managed = [$help_func_create]; var $root owned = [$help_func_create]; new object $help_func_crypt: $help_functions; var $root manager = $help_func_crypt; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611082; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "crypt", "crypt"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": crypt()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["STRING"], 'do_i]>, " ", <$format, ["b", [], ["crypt"], 'do_b]>, "(", <$format, ["i", [], ["STRING ", <$format, ["b", [], ["str"], 'do_b]>, ", STRING ", <$format, ["b", [], ["salt"], 'do_b]>], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function performs one-way encryption on ", <$format, ["i", [], ["str"], 'do_i]>, ", using the host system's ", <$format, ["tt", [], ["crypt()"], 'do_tt]>, " library routine. If ", <$format, ["i", [], ["salt"], 'do_i]>, " is specified, then it must be a two-character string; otherwise, a salt is chosen randomly. The return value of ", <$format, ["tt", [], ["crypt()"], 'do_tt]>, " is the encrypted string. ", <$format, ["p", [], [], 'do_p]>, "The encryption performed by this function has the property that it is very difficult to find a string which will produce a given result; however, a given string and a given salt will always yield the same encrypted string. ", <$format, ["p", [], [], 'do_p]>, "Examples: ", <$format, ["dfn", [], [" ", <$format, ["quote", [], ["\n\ncrypt(\"foo\", \"ab\")\n => \"abQ9KY.KfrYrc\"\n\n"], 'do_quote]>, " "], 'do_dfn]>], #[['this, $help_func_crypt]]]>; var $root inited = 1; var $root managed = [$help_func_crypt]; var $root owned = [$help_func_crypt]; new object $help_func_ctime: $help_functions; var $root manager = $help_func_ctime; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611370; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "ctime", "ctime"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": ctime()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["STRING"], 'do_i]>, " ", <$format, ["b", [], ["ctime"], 'do_b]>, "(", <$format, ["i", [], ["[INTEGER ", <$format, ["b", [], ["time"], 'do_b]>, "]"], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function converts the integer ", <$format, ["i", [], ["time"], 'do_i]>, " into a string format. If ", <$format, ["i", [], ["time"], 'do_i]>, " is not specified, then ", <$format, ["tt", [], ["ctime()"], 'do_tt]>, " uses the current time. ", <$format, ["p", [], [], 'do_p]>, " Examples: ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["dfn", [], [" ", <$format, ["quote", [], ["\n\nctime(739180536)\n=> \"Fri Jun 4 03:55:36 1993\"\n\n"], 'do_quote]>, " "], 'do_dfn]>], #[['this, $help_func_ctime]]]>; var $root inited = 1; var $root managed = [$help_func_ctime]; var $root owned = [$help_func_ctime]; new object $help_func_cwrite: $help_functions; var $root manager = $help_func_cwrite; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611378; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "cwrite", "cwrite"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": cwrite()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["INTEGER"], 'do_i]>, " ", <$format, ["b", [], ["cwrite"], 'do_b]>, "(", <$format, ["i", [], ["BUFFER ", <$format, ["b", [], ["buffer"], 'do_b]>], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function writes the buffer data in ", <$format, ["i", [], ["buffer"], 'do_i]>, " to the current connection."], #[['this, $help_func_cwrite]]]>; var $root inited = 1; var $root managed = [$help_func_cwrite]; var $root owned = [$help_func_cwrite]; new object $help_func_cwritef: $help_functions; var $root manager = $help_func_cwritef; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611379; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "cwritef", "cwritef"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": cwritef()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, <$format, ["i", [], ["INTEGER"], 'do_i]>, " ", <$format, ["b", [], ["cwritef"], 'do_b]>, "(", <$format, ["i", [], ["STRING ", <$format, ["b", [], ["file_path"], 'do_b]>, "[, INTEGER ", <$format, ["b", [], ["block"], 'do_b]>, "]"], 'do_i]>, ") ", <$format, ["p", [], [], 'do_p]>, "This function opens the file specified by ", <$format, ["i", [], ["file_path"], 'do_i]>, " and writes it's contents directly to the connection. The block size it reads and writes (defaulting to the driver defined variable in defs.h DEF_BLOCKSIZE, usually this is 512) can be changed by specifying an optional second argument. If the second is a negative one (-1) it will attempt to read the entire file at once, and write it to the connection (the old coldmud behavior). The size of the file (in bytes) is returned. If a problem arises the error ", <$format, ["tt", [], ["~file"], 'do_tt]>, " is thrown."], #[['this, $help_func_cwritef]]]>; var $root inited = 1; var $root managed = [$help_func_cwritef]; var $root owned = [$help_func_cwritef]; new object $help_func_data: $help_functions; var $root manager = $help_func_data; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611379; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "data", "data"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions], ["Dictionaries", $help_driver_structure_types], ["clear_var()", $help_func_clear_var]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": data()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["ANY"], 'do_i]>, " ", <$format, ["b", [], ["data"], 'do_b]>, "([", <$format, ["i", [], ["OBJNUM ", <$format, ["b", [], ["ancestor"], 'do_b]>], 'do_i]>, "])", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function is used to retrieve the values for object variables on the current object. If ", <$format, ["i", [], ["ancestor"], 'do_i]>, " is not defined it will return all data defined by any ancestor. If ", <$format, ["i", [], ["ancestor"], 'do_i]>, " is defined it will only return data which is defined by the specific ancestor. ", <$format, ["p", [], [], 'do_p]>, "A dictionary is generated for each ancestor which defines data (or for the specific requested ancestor). Each variable defined by the ancestor is a key in the dictionary, with he association to the key being the value of the object variable. For instance, if object $root defined the variable ", <$format, ["i", [], ["name"], 'do_i]>, " with a value of ", <$format, ["tt", [], ["\"Fred\""], 'do_tt]>, ", the association in the dictionary would be ", <$format, ["tt", [], ["['name, \"Fred\"]"], 'do_tt]>, ". Reference the section on ", <$format, ["link", [["node", "$help_driver_structure_types"]], ["Dictionaries"], 'do_link]>, " for more details on the construction of dictionaries. ", <$format, ["p", [], [], 'do_p]>, "If only one ancestor is requested with ", <$format, ["tt", [], ["data()"], 'do_tt]>, " then only the dictionary for that ancestor is returned. If no ancestor is specified then another dictionary is created, with each ancestor being a key and the association being the dictionary containing the object variables for that ancestor. ", <$format, ["p", [], [], 'do_p]>, "If an ancestor defines an object variable, but has never assigned a value to it on the current object (or the object variable has been cleared using the function ", <$format, ["link", [["node", "$help_func_clear_var"]], ["clear_var()"], 'do_link]>, "), it is not included in the dictionary. ", <$format, ["p", [], [], 'do_p]>, "The keys in a dictionary returned by ", <$format, ["tt", [], ["data()"], 'do_tt]>, " do not have any particular ordering."], #[['this, $help_func_data]]]>; var $root inited = 1; var $root managed = [$help_func_data]; var $root owned = [$help_func_data]; new object $help_func_dblog: $help_functions; var $root manager = $help_func_dblog; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611379; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "dblog", "dblog"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": log()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["INTEGER"], 'do_i]>, " ", <$format, ["b", [], ["log"], 'do_b]>, "(", <$format, ["i", [], ["STRING ", <$format, ["b", [], ["line"], 'do_b]>], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function writes ", <$format, ["i", [], ["line"], 'do_i]>, " to the database logfile (specified on startup, defaulting to ", <$format, ["tt", [], ["logs/db.log"], 'do_tt]>, ")."], #[['this, $help_func_dblog]]]>; var $root inited = 1; var $root managed = [$help_func_dblog]; var $root owned = [$help_func_dblog]; new object $help_func_list_method: $help_functions; var $root manager = $help_func_list_method; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611379; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "list_method", "list_method"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": list_method()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["LIST"], 'do_i]>, " ", <$format, ["b", [], ["list_method"], 'do_b]>, "(", <$format, ["i", [], ["SYMBOL ", <$format, ["b", [], ["name"], 'do_b]>], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function is used to list_method a method. It accepts a symbol, assuming it to be the name of a method. If the method is found on the current object it is list_methodd and returned as a list of strings. If the method is not found, the error ", <$format, ["tt", [], ["~methodnf"], 'do_tt]>, " is thrown."], #[['this, $help_func_list_method]]]>; var $root inited = 1; var $root managed = [$help_func_list_method]; var $root owned = [$help_func_list_method]; new object $help_func_definer: $help_functions; var $root manager = $help_func_definer; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611379; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "definer", "definer"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": definer()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["OBJNUM"], 'do_i]>, " ", <$format, ["b", [], ["definer"], 'do_b]>, "()", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function returns the objnum of the object which defines the current method."], #[['this, $help_func_definer]]]>; var $root inited = 1; var $root managed = [$help_func_definer]; var $root owned = [$help_func_definer]; new object $help_func_del_method: $help_functions; var $root manager = $help_func_del_method; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611379; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "del_method", "del_method"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": del_method()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["INTEGER"], 'do_i]>, " ", <$format, ["b", [], ["del_method"], 'do_b]>, "(", <$format, ["i", [], ["SYMBOL ", <$format, ["b", [], ["name"], 'do_b]>], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function removes the method named by the symbol ", <$format, ["i", [], ["name"], 'do_i]>, " from the current object. ", <$format, ["tt", [], ["del_method()"], 'do_tt]>, " returns ", <$format, ["tt", [], ["1"], 'do_tt]>, " if there was a method named ", <$format, ["i", [], ["name"], 'do_i]>, " on the current object; otherwise, a ", <$format, ["tt", [], ["~methodnf"], 'do_tt]>, " error is thrown."], #[['this, $help_func_del_method]]]>; var $root inited = 1; var $root managed = [$help_func_del_method]; var $root owned = [$help_func_del_method]; new object $help_func_del_objname: $help_functions; var $root manager = $help_func_del_objname; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611379; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "del_objname", "del_objname"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions], ["Referencing Objects", $help_driver_objects_referencing]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": del_objname()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["INTEGER"], 'do_i]>, " ", <$format, ["b", [], ["del_objname"], 'do_b]>, "()", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function deletes an objname associated with the current object. When an objname is deleted the object may only be referenced with it's objnum (for more information on objnames and objnums read ", <$format, ["link", [["node", "$help_driver_objects_referencing"]], ["Referencing Objects"], 'do_link]>, "). ", <$format, ["p", [], [], 'do_p]>, "If the current object does not have an objname, the error ", <$format, ["tt", [], ["~namenf"], 'do_tt]>, " is thrown."], #[['this, $help_func_del_objname]]]>; var $root inited = 1; var $root managed = [$help_func_del_objname]; var $root owned = [$help_func_del_objname]; new object $help_func_del_var: $help_functions; var $root manager = $help_func_del_var; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611379; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "del_var", "del_var"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": del_var()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["INTEGER"], 'do_i]>, " ", <$format, ["b", [], ["del_var"], 'do_b]>, "(", <$format, ["i", [], ["SYMBOL ", <$format, ["b", [], ["name"], 'do_b]>], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, " This function deletes the object variable pointed to by the symbol ", <$format, ["i", [], ["name"], 'do_i]>, " defined on the current object. If the object variable is not defined on the current object, the error ", <$format, ["tt", [], ["~varnf"], 'do_tt]>, " is thrown. Upon successful execution ", <$format, ["tt", [], ["del_var()"], 'do_tt]>, " returns ", <$format, ["tt", [], ["1"], 'do_tt]>, "."], #[['this, $help_func_del_var]]]>; var $root inited = 1; var $root managed = [$help_func_del_var]; var $root owned = [$help_func_del_var]; new object $help_func_delete: $help_functions; var $root manager = $help_func_delete; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611379; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "delete", "delete"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": delete()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["LIST"], 'do_i]>, " ", <$format, ["b", [], ["delete"], 'do_b]>, "(", <$format, ["i", [], ["LIST ", <$format, ["b", [], ["list"], 'do_b]>, ", INTEGER ", <$format, ["b", [], ["pos"], 'do_b]>], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function returns the result of deleting the element of ", <$format, ["i", [], ["list"], 'do_i]>, " numbered by the integer ", <$format, ["i", [], ["position"], 'do_i]>, ". If ", <$format, ["i", [], ["position"], 'do_i]>, " is less than ", <$format, ["tt", [], ["1"], 'do_tt]>, " or is greater than the length of ", <$format, ["i", [], ["list"], 'do_i]>, ", then ", <$format, ["tt", [], ["delete()"], 'do_tt]>, " throws a ", <$format, ["tt", [], ["~range"], 'do_tt]>, " error. ", <$format, ["p", [], [], 'do_p]>, "Examples: ", <$format, ["dfn", [], [" ", <$format, ["quote", [], ["\n \ndelete([2, 3, 4], 2)\n=> [2, 4]\n\n"], 'do_quote]>, " "], 'do_dfn]>], #[['this, $help_func_delete]]]>; var $root inited = 1; var $root managed = [$help_func_delete]; var $root owned = [$help_func_delete]; new object $help_func_descendants: $help_functions; var $root manager = $help_func_descendants; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611379; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "descendants", "descendants"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": descendants()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["LIST"], 'do_i]>, " ", <$format, ["b", [], ["descendants"], 'do_b]>, "()", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function returns a list of all descendants of the current object. ", <$format, ["b", [], ["Note:"], 'do_b]>, " It is possible for this function to cause extreme load on a system, be careful in it's use. It is provided primarily for administrative reference in the database and is not intended for frequent use in a regular run-time environment."], #[['this, $help_func_descendants]]]>; var $root inited = 1; var $root managed = [$help_func_descendants]; var $root owned = [$help_func_descendants]; new object $help_func_destroy: $help_functions; var $root manager = $help_func_destroy; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611379; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "destroy", "destroy"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": destroy()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["INTEGER"], 'do_i]>, " ", <$format, ["b", [], ["destroy"], 'do_b]>, "()", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function marks the current object for destruction. The object is destroyed when all methods executing on it are completed (suspended and preempted methods as well as the current task). Objects left orphaned by the destruction of their only parent are reparented to the parents of the parent which was destroyed. ", <$format, ["p", [], [], 'do_p]>, "Attempts to destroy the root or system objects will fail with the error ", <$format, ["tt", [], ["~perm"], 'do_tt]>, "."], #[['this, $help_func_destroy]]]>; var $root inited = 1; var $root managed = [$help_func_destroy]; var $root owned = [$help_func_destroy]; new object $help_func_dict_add: $help_functions; var $root manager = $help_func_dict_add; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611379; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "dict_add", "dict_add"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": dict_add()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["DICTIONARY"], 'do_i]>, " ", <$format, ["b", [], ["dict_add"], 'do_b]>, "(", <$format, ["i", [], ["DICTIONARY ", <$format, ["b", [], ["dict"], 'do_b]>, ", ANY ", <$format, ["b", [], ["key"], 'do_b]>, ", ANY ", <$format, ["b", [], ["value"], 'do_b]>], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function adds an association to the dictionary ", <$format, ["i", [], ["dict"], 'do_i]>, ". The key and value of the association are given as the ", <$format, ["i", [], ["key"], 'do_i]>, " and ", <$format, ["i", [], ["value"], 'do_i]>, " arguments. The new dictionary is returned. If ", <$format, ["i", [], ["key"], 'do_i]>, " already exists in ", <$format, ["i", [], ["dict"], 'do_i]>, ", then the value of the existing key is replaced with ", <$format, ["i", [], ["value"], 'do_i]>, ". ", <$format, ["p", [], [], 'do_p]>, "Examples: ", <$format, ["dfn", [], [" ", <$format, ["quote", [], ["\n\ndict_add(#[[\"foo\", \"bar\"]], 3, 'quux)\n=> #[[\"foo\", \"bar\"], [3, 'quux]]\n\ndict_add(#[[\"foo\", 1], [\"bar\", 2], [\"baz\", 3]], \"bar\", 4)\n=> #[[\"foo\", 1], [\"bar\", 4], [\"baz\", 3]]\n\n"], 'do_quote]>, " "], 'do_dfn]>], #[['this, $help_func_dict_add]]]>; var $root inited = 1; var $root managed = [$help_func_dict_add]; var $root owned = [$help_func_dict_add]; new object $help_func_dict_contains: $help_functions; var $root manager = $help_func_dict_contains; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611379; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "dict_contains", "dict_contains"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": dict_contains()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["INTEGER"], 'do_i]>, " ", <$format, ["b", [], ["dict_contains"], 'do_b]>, "(", <$format, ["i", [], ["DICTIONARY ", <$format, ["b", [], ["dict"], 'do_b]>, ", ANY ", <$format, ["b", [], ["key"], 'do_b]>], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function returns 1 if there is an association in ", <$format, ["i", [], ["dict"], 'do_i]>, " with the key ", <$format, ["i", [], ["key"], 'do_i]>, ", or 0 otherwise. ", <$format, ["p", [], [], 'do_p]>, "Examples: ", <$format, ["dfn", [], [" ", <$format, ["quote", [], ["\n\ndict_contains(#[[\"foo\", \"bar\"]], \"foo\")\n=> 1\n\ndict_contains(#[[\"foo\", \"bar\"]], \"bar\")\n=> 0\n\n"], 'do_quote]>, " "], 'do_dfn]>], #[['this, $help_func_dict_contains]]]>; var $root inited = 1; var $root managed = [$help_func_dict_contains]; var $root owned = [$help_func_dict_contains]; new object $help_func_dict_del: $help_functions; var $root manager = $help_func_dict_del; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611379; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "dict_del", "dict_del"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": dict_del()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["DICTIONARY"], 'do_i]>, " ", <$format, ["b", [], ["dict_del"], 'do_b]>, "(", <$format, ["i", [], ["DICTIONARY ", <$format, ["b", [], ["dict"], 'do_b]>, ", ANY ", <$format, ["b", [], ["key"], 'do_b]>], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function the ", <$format, ["i", [], ["key"], 'do_i]>, " ", <$format, ["i", [], ["value"], 'do_i]>, " association from the dictionary ", <$format, ["i", [], ["dict"], 'do_i]>, " and returns the result. If there is no association with the specified key, then the error ", <$format, ["tt", [], ["~keynf"], 'do_tt]>, " is thrown. ", <$format, ["dfn", [], [" ", <$format, ["quote", [], ["\n\ndict_del(#[[\"foo\", 1], [\"bar\", 2]], \"foo\")\n=> #[[\"bar\", 2]]\n\n"], 'do_quote]>, " "], 'do_dfn]>], #[['this, $help_func_dict_del]]]>; var $root inited = 1; var $root managed = [$help_func_dict_del]; var $root owned = [$help_func_dict_del]; new object $help_func_dict_keys: $help_functions; var $root manager = $help_func_dict_keys; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611379; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "dict_keys", "dict_keys"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": dict_keys()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["LIST"], 'do_i]>, " ", <$format, ["b", [], ["dict_keys"], 'do_b]>, "(", <$format, ["i", [], ["DICTIONARY ", <$format, ["b", [], ["dict"], 'do_b]>], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function returns a list of the keys of the associations in ", <$format, ["i", [], ["dict"], 'do_i]>, ". ", <$format, ["dfn", [], [" ", <$format, ["quote", [], ["\n\ndict_keys(#[[\"foo\", 1\"], [\"bar\", 2], ['baz, 3]])\n=> [\"foo\", \"bar\", 'baz]\n\n"], 'do_quote]>, " "], 'do_dfn]>], #[['this, $help_func_dict_keys]]]>; var $root inited = 1; var $root managed = [$help_func_dict_keys]; var $root owned = [$help_func_dict_keys]; new object $help_func_error: $help_functions; var $root manager = $help_func_error; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611379; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "error", "error"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions], ["Errors", $help_driver_errors]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": error()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["ERROR"], 'do_i]>, " ", <$format, ["b", [], ["error"], 'do_b]>, "()", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function returns the error code associated with the current error. For more information see the section on ", <$format, ["link", [["node", "$help_driver_errors"]], ["Errors"], 'do_link]>, ". This function can only be called from within an error handler."], #[['this, $help_func_error]]]>; var $root inited = 1; var $root managed = [$help_func_error]; var $root owned = [$help_func_error]; new object $help_func_execute: $help_functions; var $root manager = $help_func_execute; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611379; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "execute", "execute"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": execute()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["INTEGER"], 'do_i]>, " ", <$format, ["b", [], ["execute"], 'do_b]>, "(", <$format, ["i", [], ["STRING ", <$format, ["b", [], ["program"], 'do_b]>, ", LIST ", <$format, ["b", [], ["arguments"], 'do_b]>, "[, INTEGER ", <$format, ["b", [], ["non_blocking"], 'do_b]>, "]"], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function executes the executable program named by ", <$format, ["i", [], ["program"], 'do_i]>, " with the arguments given in the list ", <$format, ["i", [], ["arguments"], 'do_i]>, ". Each argument must be a string. By default, calling this function will block execution of genesis until the called program returns. If the optional third argument is specified as a true value, the program is forked and executed in a non-blocking manner. The return value is the return value of the program, or, in the case of a non-blocking execution it is zero. ", <$format, ["p", [], [], 'do_p]>, "This function looks for the script in the executable directory specified upon startup by the driver. This usually defaults to ", <$format, ["tt", [], ["bin"], 'do_tt]>, ". ", <$format, ["p", [], [], 'do_p]>, "In the future input and output for the program may be handled as if it were a file."], #[['this, $help_func_execute]]]>; var $root inited = 1; var $root managed = [$help_func_execute]; var $root owned = [$help_func_execute]; new object $help_func_explode: $help_functions; var $root manager = $help_func_explode; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611379; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "explode", "explode"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": explode()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["LIST"], 'do_i]>, " ", <$format, ["b", [], ["explode"], 'do_b]>, "(", <$format, ["i", [], ["STRING ", <$format, ["b", [], ["str"], 'do_b]>, "[, STRING ", <$format, ["b", [], ["sep"], 'do_b]>, "[, INTEGER ", <$format, ["b", [], ["want-blanks"], 'do_b]>, "]]"], 'do_i]>, "})", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function breaks ", <$format, ["i", [], ["string"], 'do_i]>, " into a list of strings, using the string ", <$format, ["i", [], ["sep"], 'do_i]>, " as delimiters. If ", <$format, ["i", [], ["sep"], 'do_i]>, " is unspecified it uses spaces as delimiters. If ", <$format, ["i", [], ["want-blanks"], 'do_i]>, " is specified and is true ", <$format, ["tt", [], ["explode()"], 'do_tt]>, " will include zero-length strings in the final list, otherwise it will not. ", <$format, ["p", [], [], 'do_p]>, "Examples: ", <$format, ["dfn", [], [" ", <$format, ["quote", [], ["\n\nexplode(\" foo bar baz\")\n=> [\"foo\", \"bar\", \"baz\"]\n\nexplode(\"foo:bar:baz\", \":\")\n=> [\"foo\", \"bar\", \"baz\"]\n\n"], 'do_quote]>, " "], 'do_dfn]>], #[['this, $help_func_explode]]]>; var $root inited = 1; var $root managed = [$help_func_explode]; var $root owned = [$help_func_explode]; new object $help_func_fchmod: $help_functions; var $root manager = $help_func_fchmod; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611380; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "fchmod", "fchmod"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": fchmod()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["INTEGER"], 'do_i]>, " ", <$format, ["b", [], ["fchmod"], 'do_b]>, "(", <$format, ["i", [], ["STRING ", <$format, ["b", [], ["mode"], 'do_b]>, "[, STRING ", <$format, ["b", [], ["file"], 'do_b]>, "]"], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function changes the mode of a file or directory. The mode is an octal number constructed by logically OR-ing the following values: ", <$format, ["dfn", [], [" ", <$format, ["dl", [["columned", 1]], [" "], 'do_dl]>, <$format, ["dt", [], ["4000", <$format, ["dd", [], ["set-user-ID-on-execution "], 'do_dd]>, <$format, ["dt", [], ["2000"], 'do_dt]>, <$format, ["dd", [], ["set-group-ID-on-execution "], 'do_dd]>, <$format, ["dt", [], ["1000"], 'do_dt]>, <$format, ["dd", [], ["sticky bit, see chmod(2) "], 'do_dd]>, <$format, ["dt", [], ["0400"], 'do_dt]>, <$format, ["dd", [], ["read by owner "], 'do_dd]>, <$format, ["dt", [], ["0200"], 'do_dt]>, <$format, ["dd", [], ["write by owner "], 'do_dd]>, <$format, ["dt", [], ["0100"], 'do_dt]>, <$format, ["dd", [], ["execute (or search for directories) by owner "], 'do_dd]>, <$format, ["dt", [], ["0070"], 'do_dt]>, <$format, ["dd", [], ["read, write, execute/search by group "], 'do_dd]>, <$format, ["dt", [], ["0007"], 'do_dt]>, <$format, ["dd", [], ["read, write, execute/search by others "], 'do_dd]>], 'do_dt]>, " "], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, "The read, write, and execute/search values for group and others are en- coded as described for owner. ", <$format, ["p", [], [], 'do_p]>, "If the ", <$format, ["tt", [], ["RESTRICTIVE_FILES"], 'do_tt]>, " option has been compiled into the driver, sticky and setuid/setgid bits cannot be changed."], #[['this, $help_func_fchmod]]]>; var $root inited = 1; var $root managed = [$help_func_fchmod]; var $root owned = [$help_func_fchmod]; new object $help_func_fclose: $help_functions; var $root manager = $help_func_fclose; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611380; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "fclose", "fclose"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": fclose()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["INTEGER"], 'do_i]>, " ", <$format, ["b", [], ["fclose"], 'do_b]>, "()", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function closes the file on the current object and returns one (1). If no file is open on the current object, the error ", <$format, ["tt", [], ["~file"], 'do_tt]>, " is thrown."], #[['this, $help_func_fclose]]]>; var $root inited = 1; var $root managed = [$help_func_fclose]; var $root owned = [$help_func_fclose]; new object $help_func_feof: $help_functions; var $root manager = $help_func_feof; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611380; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "feof", "feof"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": feof()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["INTEGER"], 'do_i]>, " ", <$format, ["b", [], ["feof"], 'do_b]>, "()", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function returns true (1) if the open file on the current object is at it's end, or false (0) if it is not. If the current object does not have an open file, ", <$format, ["tt", [], ["~file"], 'do_tt]>, " is thrown."], #[['this, $help_func_feof]]]>; var $root inited = 1; var $root managed = [$help_func_feof]; var $root owned = [$help_func_feof]; new object $help_func_fflush: $help_functions; var $root manager = $help_func_fflush; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611380; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "fflush", "fflush"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": fflush()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["INTEGER"], 'do_i]>, " ", <$format, ["b", [], ["fflush"], 'do_b]>, "()", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function flushes any buffered output for the open file on the current object and returns one (1). If there is no file on the current object the error ", <$format, ["tt", [], ["~file"], 'do_tt]>, " is thrown."], #[['this, $help_func_fflush]]]>; var $root inited = 1; var $root managed = [$help_func_fflush]; var $root owned = [$help_func_fflush]; new object $help_func_file: $help_functions; var $root manager = $help_func_file; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611380; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "file", "file"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": file()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["LIST"], 'do_i]>, " ", <$format, ["b", [], ["file"], 'do_b]>, "()", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function returns the following ordered list of information on the file on the current object: ", <$format, ["ol", [], [" ", <$format, ["li", [], ["BOOLEAN file is readable "], 'do_li]>, <$format, ["li", [], ["BOOLEAN file is writable "], 'do_li]>, <$format, ["li", [], ["BOOLEAN file is closed "], 'do_li]>, <$format, ["li", [], ["BOOLEAN file is binary "], 'do_li]>, <$format, ["li", [], ["STRING file path "], 'do_li]>], 'do_ol]>, " ", <$format, ["p", [], [], 'do_p]>, "If no file is bound to the current object, the error ", <$format, ["tt", [], ["~file"], 'do_tt]>, " is thrown."], #[['this, $help_func_file]]]>; var $root inited = 1; var $root managed = [$help_func_file]; var $root owned = [$help_func_file]; new object $help_func_files: $help_functions; var $root manager = $help_func_files; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611380; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "files", "files"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": files()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["LIST"], 'do_i]>, " ", <$format, ["b", [], ["files"], 'do_b]>, "(", <$format, ["i", [], ["STRING ", <$format, ["b", [], ["directory"], 'do_b]>], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function returns a lit of files in the specified directory. The current and previous directory (\".\" and \"..\") are not included in this listing. Each element in the list is a string. ", <$format, ["p", [], [], 'do_p]>, "Example: ", <$format, ["dfn", [], [<$format, ["quote", [], ["\n\nfiles(\"html/\");\n=> [\"index.html\", \"tCD.gif\", \"Intro\", \"history.html\"]\n"], 'do_quote]>, " "], 'do_dfn]>], #[['this, $help_func_files]]]>; var $root inited = 1; var $root managed = [$help_func_files]; var $root owned = [$help_func_files]; new object $help_func_find_method: $help_functions; var $root manager = $help_func_find_method; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611380; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "find_method", "find_method"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": find_method()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["OBJNUM"], 'do_i]>, " ", <$format, ["b", [], ["find_method"], 'do_b]>, "(", <$format, ["i", [], ["SYMBOL ", <$format, ["b", [], ["name"], 'do_b]>], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function searches for the first occurance of the method named by the symbol ", <$format, ["i", [], ["name"], 'do_i]>, ", on an ancestor of the current object. If a method is found, the ancestor is returned. Otherwise the error ", <$format, ["tt", [], ["~methodnf"], 'do_tt]>, " is thrown."], #[['this, $help_func_find_method]]]>; var $root inited = 1; var $root managed = [$help_func_find_method]; var $root owned = [$help_func_find_method]; new object $help_func_find_next_method: $help_functions; var $root manager = $help_func_find_next_method; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611380; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "find_next_method", "find_next_method"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": find_next_method()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["OBJNUM"], 'do_i]>, " ", <$format, ["b", [], ["find_next_method"], 'do_b]>, "(", <$format, ["i", [], ["SYMBOL ", <$format, ["b", [], ["name"], 'do_b]>, ", OBJNUM ", <$format, ["b", [], ["after"], 'do_b]>], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function searches for the occurance of the method named by the symbol ", <$format, ["i", [], ["name"], 'do_i]>, ", after the ancestor ", <$format, ["i", [], ["after"], 'do_i]>, ". If a method is found, the ancestor is returned. Otherwise the error ", <$format, ["tt", [], ["~methodnf"], 'do_tt]>, " is thrown."], #[['this, $help_func_find_next_method]]]>; var $root inited = 1; var $root managed = [$help_func_find_next_method]; var $root owned = [$help_func_find_next_method]; new object $help_func_fmkdir: $help_functions; var $root manager = $help_func_fmkdir; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611380; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "fmkdir", "fmkdir"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions], ["fchmod()", $help_func_fchmod]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": fmkdir()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["INTEGER"], 'do_i]>, " ", <$format, ["b", [], ["fmkdir"], 'do_b]>, "(", <$format, ["i", [], ["STRING ", <$format, ["b", [], ["path"], 'do_b]>], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function creates the directory specified by ", <$format, ["i", [], ["path"], 'do_i]>, ". If a file or directory already exists by that designation, the error ", <$format, ["tt", [], ["~file"], 'do_tt]>, " is thrown. Otherwise the directory is created with read, write and execute permission for the owner, and no permissions for group or others (these permissions can be changed with the function ", <$format, ["link", [["node", "$help_func_fchmod"]], ["fchmod()"], 'do_link]>, "."], #[['this, $help_func_fmkdir]]]>; var $root inited = 1; var $root managed = [$help_func_fmkdir]; var $root owned = [$help_func_fmkdir]; new object $help_func_fopen: $help_functions; var $root manager = $help_func_fopen; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611380; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "fopen", "fopen"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions], ["Files", $help_driver_fileintro], ["fstat()", $help_func_fstat]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": fopen()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["LIST"], 'do_i]>, " ", <$format, ["b", [], ["fopen"], 'do_b]>, "(", <$format, ["i", [], ["STRING ", <$format, ["b", [], ["filename"], 'do_b]>, "[, STRING ", <$format, ["b", [], ["mode"], 'do_b]>, "]"], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function is used to open a file on the current object. It is called with one or two arguments. The first argument is the name of the file to open. If the driver was compiled with the ", <$format, ["tt", [], ["RESTRICTIVE_FILES"], 'do_tt]>, " option, the filename will have restrictions (see the section on ", <$format, ["link", [["node", "$help_driver_fileintro"]], ["Files"], 'do_link]>, " for more information). If ", <$format, ["tt", [], ["RESTRICTIVE_FILES"], 'do_tt]>, " was compiled, all files will have the ", <$format, ["i", [], ["root"], 'do_i]>, " directory prepended to them (this directory is defined by a command line argument to genesis. If it was not compiled, but the file does not begin with a slash (\"/\"), the ", <$format, ["i", [], ["root"], 'do_i]>, " directory will still be prepended. ", <$format, ["p", [], [], 'do_p]>, "The second argument is the mode for the file. If the mode begins with \"<\" or nothing, the file is opened for reading. If the mode begins with \">\", the file is truncated to zero length or created for writing. If the mode begins with \">>\", the file is opend for appending. If the second argument is not specified, the mode of file defaults to \"<\". ", <$format, ["p", [], [], 'do_p]>, "You can also place a \"+\" before \">\" or \"<\" to specify read and write access to the file. Ending a mode with a \"-\" sets it as a binary file, meaning that input and output to the file is through buffers, rather than ColdC strings. ", <$format, ["p", [], [], 'do_p]>, "If successful, the return value of fopen() is stat information in the format returned by ", <$format, ["link", [["node", "$help_func_fstat"]], ["fstat()"], 'do_link]>, ". ", <$format, ["p", [], [], 'do_p]>, "Examples: ", <$format, ["dfn", [], [<$format, ["quote", [], ["\n\nstat = fopen(\"log\", \">>\");\nstat = fopen(\"/usr/home/test.info\", \"+>-\");\n\n"], 'do_quote]>], 'do_dfn]>], #[['this, $help_func_fopen]]]>; var $root inited = 1; var $root managed = [$help_func_fopen]; var $root owned = [$help_func_fopen]; new object $help_func_fread: $help_functions; var $root manager = $help_func_fread; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611380; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "fread", "fread"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": fread()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["STRING|BUFFER"], 'do_i]>, " ", <$format, ["b", [], ["fread"], 'do_b]>, "(", <$format, ["i", [], ["[INTEGER ", <$format, ["b", [], ["block"], 'do_b]>, "]"], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "Read from the existing file bound to this object. If the file is a binary file, a buffer is returned. If the file is a text file (default), a string is returned. ", <$format, ["p", [], [], 'do_p]>, "If the file is at the end, the ", <$format, ["tt", [], ["~eof"], 'do_tt]>, " error is thrown. ", <$format, ["p", [], [], 'do_p]>, "With binary files an optional block size may be specified. The default block size is 512 characters. ", <$format, ["p", [], [], 'do_p]>, "Example: ", <$format, ["dfn", [], [<$format, ["quote", [], ["\n\nwhile ((line = (| fread() |)) != ~eof)\n log(line);\n"], 'do_quote]>, " "], 'do_dfn]>], #[['this, $help_func_fread]]]>; var $root inited = 1; var $root managed = [$help_func_fread]; var $root owned = [$help_func_fread]; new object $help_func_fremove: $help_functions; var $root manager = $help_func_fremove; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611380; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "fremove", "fremove"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": fremove()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["INTEGER"], 'do_i]>, " ", <$format, ["b", [], ["fremove"], 'do_b]>, "(", <$format, ["i", [], ["[STRING ", <$format, ["b", [], ["path"], 'do_b]>, "]"], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function removes a file. If the argument ", <$format, ["i", [], ["path"], 'do_i]>, " is given, it will attempt to link that file. Otherwise it will unlink the file on the current object (rather undesirable)."], #[['this, $help_func_fremove]]]>; var $root inited = 1; var $root managed = [$help_func_fremove]; var $root owned = [$help_func_fremove]; new object $help_func_frename: $help_functions; var $root manager = $help_func_frename; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611380; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "frename", "frename"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": frename()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["INTEGER"], 'do_i]>, " ", <$format, ["b", [], ["frename"], 'do_b]>, "(", <$format, ["i", [], ["ANY ", <$format, ["b", [], ["from"], 'do_b]>, ", STRING ", <$format, ["b", [], ["to"], 'do_b]>], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function renames the file specified by ", <$format, ["i", [], ["from"], 'do_i]>, ", to the name specified by ", <$format, ["i", [], ["to"], 'do_i]>, ". If ", <$format, ["i", [], ["from"], 'do_i]>, " is not a string, the driver renames the file on the current object."], #[['this, $help_func_frename]]]>; var $root inited = 1; var $root managed = [$help_func_frename]; var $root owned = [$help_func_frename]; new object $help_func_frmdir: $help_functions; var $root manager = $help_func_frmdir; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611381; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "frmdir", "frmdir"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": frmdir()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["INTEGER"], 'do_i]>, " ", <$format, ["b", [], ["frmdir"], 'do_b]>, "(", <$format, ["i", [], ["STRING ", <$format, ["b", [], ["path"], 'do_b]>], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function removes the directory specified by ", <$format, ["i", [], ["path"], 'do_i]>, ". If an error occurs, ", <$format, ["tt", [], ["~file"], 'do_tt]>, " is thrown (the error explanation will vary depending upon what occurred)."], #[['this, $help_func_frmdir]]]>; var $root inited = 1; var $root managed = [$help_func_frmdir]; var $root owned = [$help_func_frmdir]; new object $help_func_fseek: $help_functions; var $root manager = $help_func_fseek; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611381; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "fseek", "fseek"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": fseek()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["INTEGER"], 'do_i]>, " ", <$format, ["b", [], ["fseek"], 'do_b]>, "(", <$format, ["i", [], ["INTEGER ", <$format, ["b", [], ["offset"], 'do_b]>, ", SYMBOL ", <$format, ["b", [], ["whence"], 'do_b]>], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function changes the file position to ", <$format, ["i", [], ["offset"], 'do_i]>, ". The variable ", <$format, ["i", [], ["whence"], 'do_i]>, " is either ", <$format, ["tt", [], ["'SEEK_SET"], 'do_tt]>, ", ", <$format, ["tt", [], ["'SEEK_CUR"], 'do_tt]>, ", ", <$format, ["tt", [], ["'SEEK_END"], 'do_tt]>, ". Read the unix manual page for the function ", <$format, ["tt", [], ["fseek"], 'do_tt]>, ", for more information. ", <$format, ["p", [], [], 'do_p]>, "If the file is not both readable and writable, this function cannot be used."], #[['this, $help_func_fseek]]]>; var $root inited = 1; var $root managed = [$help_func_fseek]; var $root owned = [$help_func_fseek]; new object $help_func_fstat: $help_functions; var $root manager = $help_func_fstat; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611381; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "fstat", "fstat"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions], ["fchmod()", $help_func_fchmod]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": fstat()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["LIST"], 'do_i]>, " ", <$format, ["b", [], ["fstat"], 'do_b]>, "(", <$format, ["i", [], ["[STRING ", <$format, ["b", [], ["path"], 'do_b]>, "]"], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function returns information on a file. If the file is not specified as ", <$format, ["i", [], ["path"], 'do_i]>, ", then it returns information on the open file on the current object. The information is returned as a list of integers ordered as: ", <$format, ["ol", [], [" ", <$format, ["li", [], ["file mode (see ", <$format, ["link", [["node", "$help_func_fchmod"]], ["fchmod()"], 'do_link]>, ") "], 'do_li]>, <$format, ["li", [], ["file size (in bytes) "], 'do_li]>, <$format, ["li", [], ["time when the file was last accessed "], 'do_li]>, <$format, ["li", [], ["time when the file was last modified "], 'do_li]>, <$format, ["li", [], ["time when the file was last changed "], 'do_li]>], 'do_ol]>, " ", <$format, ["p", [], [], 'do_p]>, "For more information refer to the unix manual page on ", <$format, ["tt", [], ["stat"], 'do_tt]>, "."], #[['this, $help_func_fstat]]]>; var $root inited = 1; var $root managed = [$help_func_fstat]; var $root owned = [$help_func_fstat]; new object $help_func_fwrite: $help_functions; var $root manager = $help_func_fwrite; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611381; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "fwrite", "fwrite"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": fwrite()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["INTEGER"], 'do_i]>, " ", <$format, ["b", [], ["fwrite"], 'do_b]>, "(", <$format, ["i", [], ["STRING|BUFFER ", <$format, ["b", [], ["info"], 'do_b]>], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "Write to an existing file bound to this object. The argument is either a buffer (if it is a binary file), or a string (if it is a text file). The return value is an integer representing an offset value of characters which were ", <$format, ["i", [], ["not"], 'do_i]>, " written out (due to an error). In normal operating conditions the return value will be zero. ", <$format, ["p", [], [], 'do_p]>, "Using fwrite() with strings will always terminate the string with a newline character (or, in Windows 95, a carriage return and a newline)."], #[['this, $help_func_fwrite]]]>; var $root inited = 1; var $root managed = [$help_func_fwrite]; var $root owned = [$help_func_fwrite]; new object $help_func_method_bytecode: $help_functions; var $root manager = $help_func_method_bytecode; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611381; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "method_bytecode", "method_bytecode"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": method_bytecode()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["LIST"], 'do_i]>, " ", <$format, ["b", [], ["method_bytecode"], 'do_b]>, "(", <$format, ["i", [], ["SYMBOL ", <$format, ["b", [], ["name"], 'do_b]>], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "When implemented, this function will return the parse tree for the method ", <$format, ["i", [], ["name"], 'do_i]>, "."], #[['this, $help_func_method_bytecode]]]>; var $root inited = 1; var $root managed = [$help_func_method_bytecode]; var $root owned = [$help_func_method_bytecode]; new object $help_func_get_var: $help_functions; var $root manager = $help_func_get_var; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611381; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "get_var", "get_var"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": get_var()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["ANY"], 'do_i]>, " ", <$format, ["b", [], ["get_var"], 'do_b]>, "(", <$format, ["i", [], ["SYMBOL ", <$format, ["b", [], ["name"], 'do_b]>], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function returns the current object's value of the object variable pointed to by the symbol ", <$format, ["i", [], ["name"], 'do_i]>, ". The variable must be defined on the same object which defined the method which calls ", <$format, ["tt", [], ["get_var()"], 'do_tt]>, ". If the object variable is not defined, the error ", <$format, ["tt", [], ["~varnf"], 'do_tt]>, " is thrown. Otherwise the current object's value for the variable is returned. ", <$format, ["p", [], [], 'do_p]>], #[['this, $help_func_get_var]]]>; var $root inited = 1; var $root managed = [$help_func_get_var]; var $root owned = [$help_func_get_var]; new object $help_func_has_ancestor: $help_functions; var $root manager = $help_func_has_ancestor; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611381; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "has_ancestor", "has_ancestor"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": has_ancestor()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["INTEGER"], 'do_i]>, " ", <$format, ["b", [], ["has_ancestor"], 'do_b]>, "(", <$format, ["i", [], ["OBJNUM ", <$format, ["b", [], ["ancestor"], 'do_b]>], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function returns one (1) if the current object has ", <$format, ["i", [], ["ancestor"], 'do_i]>, " as an ancestor, or zero (0) if it does not."], #[['this, $help_func_has_ancestor]]]>; var $root inited = 1; var $root managed = [$help_func_has_ancestor]; var $root owned = [$help_func_has_ancestor]; new object $help_func_insert: $help_functions; var $root manager = $help_func_insert; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611381; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "insert", "insert"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": insert()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["LIST"], 'do_i]>, " ", <$format, ["b", [], ["insert"], 'do_b]>, "(", <$format, ["i", [], ["LIST ", <$format, ["b", [], ["list"], 'do_b]>, ", INTEGER ", <$format, ["b", [], ["pos"], 'do_b]>, ", ANY ", <$format, ["b", [], ["value"], 'do_b]>], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function inserts ", <$format, ["i", [], ["value"], 'do_i]>, " into ", <$format, ["i", [], ["list"], 'do_i]>, " before the element specified by the integer ", <$format, ["i", [], ["pos"], 'do_i]>, ". If ", <$format, ["i", [], ["pos"], 'do_i]>, " is less than one or is more than one more than the length of ", <$format, ["i", [], ["list"], 'do_i]>, ", then the error ", <$format, ["tt", [], ["~range"], 'do_tt]>, " is thrown. ", <$format, ["p", [], [], 'do_p]>, "Examples: ", <$format, ["dfn", [], [" ", <$format, ["quote", [], ["\n\ninsert([2, 3, 4], 3, 'foo) \n=> [2, 3, 'foo, 4] \n\ninsert([\"foo\", 'bar, ~none], 4, 'baz)\n=> [\"foo\", 'bar, ~none, 'baz]\n\n"], 'do_quote]>, " "], 'do_dfn]>], #[['this, $help_func_insert]]]>; var $root inited = 1; var $root managed = [$help_func_insert]; var $root owned = [$help_func_insert]; new object $help_func_join: $help_functions; var $root manager = $help_func_join; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611381; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "join", "join"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions], ["Arithmetic Operators", $help_driver_structure_expressions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": join()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["LIST"], 'do_i]>, " ", <$format, ["b", [], ["join"], 'do_b]>, "(", <$format, ["i", [], ["LIST ", <$format, ["b", [], ["list"], 'do_b]>, "[, STRING ", <$format, ["b", [], ["seperator"], 'do_b]>, "]"], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function joins a list together to a string. The second argument is used to specify what seperates each element in the list. If the second argument is unspecified, this will default to a single space (\" \"). If any element in the list is not a string, it will be converted to a string in the same manner as adding a string to that data type (See: ", <$format, ["link", [["node", "$help_driver_structure_expressions"]], ["Arithmetic Operators"], 'do_link]>, "). ", <$format, ["p", [], [], 'do_p]>, "Examples: ", <$format, ["dfn", [], [<$format, ["quote", [], ["\n\njoin([\"Joe\", \"Sally\", \"Bob\", \"Sue\"])\n=> \"Joe Sally Bob Sue\"\n\njoin([\"This\", \"That\", 'there, 10], \", \")\n=> \"This, That, there, 10\"\n\n"], 'do_quote]>], 'do_dfn]>], #[['this, $help_func_join]]]>; var $root inited = 1; var $root managed = [$help_func_join]; var $root owned = [$help_func_join]; new object $help_func_listgraft: $help_functions; var $root manager = $help_func_listgraft; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611381; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "listgraft", "listgraft"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions], ["insert()", $help_func_insert]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": listgraft()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["LIST"], 'do_i]>, " ", <$format, ["b", [], ["listgraft"], 'do_b]>, "(", <$format, ["i", [], ["LIST ", <$format, ["b", [], ["list"], 'do_b]>, ", INTEGER ", <$format, ["b", [], ["pos"], 'do_b]>, ", LIST ", <$format, ["b", [], ["list2"], 'do_b]>], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function is similar to ", <$format, ["link", [["node", "$help_func_insert"]], ["insert()"], 'do_link]>, ", except it grafts a list into another list, rather than inserting an element at a point in the list. It will take the list specified by ", <$format, ["i", [], ["list2"], 'do_i]>, " and place each element in that list into ", <$format, ["i", [], ["list"], 'do_i]>, ", starting at the position specified by ", <$format, ["i", [], ["pos"], 'do_i]>, ". ", <$format, ["p", [], [], 'do_p]>, "Example: ", <$format, ["dfn", [], [<$format, ["quote", [], ["\n\nlistgraft([1, 2, 3, 4, 5], 3, [\"foo\", \"bar\", \"baz\"])\n=> [1, 2, \"foo\", \"bar\", \"baz\", 3, 4, 5]\n\n"], 'do_quote]>], 'do_dfn]>], #[['this, $help_func_listgraft]]]>; var $root inited = 1; var $root managed = [$help_func_listgraft]; var $root owned = [$help_func_listgraft]; new object $help_func_listlen: $help_functions; var $root manager = $help_func_listlen; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611381; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "listlen", "listlen"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": listlen()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["INTEGER"], 'do_i]>, " ", <$format, ["b", [], ["listlen"], 'do_b]>, "(", <$format, ["i", [], ["LIST ", <$format, ["b", [], ["list"], 'do_b]>], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function returns the length of ", <$format, ["i", [], ["list"], 'do_i]>, "."], #[['this, $help_func_listlen]]]>; var $root inited = 1; var $root managed = [$help_func_listlen]; var $root owned = [$help_func_listlen]; new object $help_func_localtime: $help_functions; var $root manager = $help_func_localtime; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611381; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "localtime", "localtime"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": localtime()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["LIST"], 'do_i]>, " ", <$format, ["b", [], ["localtime"], 'do_b]>, "(", <$format, ["i", [], ["[INTEGER ", <$format, ["b", [], ["time"], 'do_b]>, "]"], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function returns an 11 element list representing the specified by the argument ", <$format, ["i", [], ["time"], 'do_i]>, ". If no argument is given, it will use the current time instead. The elements are taken directly from ", <$format, ["tt", [], ["struct tm"], 'do_tt]>, " in C. Elements are broken down as follows: ", <$format, ["ol", [], [" ", <$format, ["li", [], ["INTEGER time (same as returned by the function ", <$format, ["tt", [], ["time()"], 'do_tt]>, ") "], 'do_li]>, <$format, ["li", [], ["INTEGER seconds (0-59) "], 'do_li]>, <$format, ["li", [], ["INTEGER minutes (0-59) "], 'do_li]>, <$format, ["li", [], ["INTEGER hours (0-23)) "], 'do_li]>, <$format, ["li", [], ["INTEGER day of month (0-31) "], 'do_li]>, <$format, ["li", [], ["INTEGER month in year (0-11) "], 'do_li]>, <$format, ["li", [], ["INTEGER year "], 'do_li]>, <$format, ["li", [], ["INTEGER week day (0-6) "], 'do_li]>, <$format, ["li", [], ["INTEGER year day (0-354*) "], 'do_li]>, <$format, ["li", [], ["INTEGER is daylight savings in effect? "], 'do_li]>, <$format, ["li", [], ["STRING time zone name "], 'do_li]>], 'do_ol]>, " ", <$format, ["p", [], [], 'do_p]>, <$format, ["dl", [["columned", 1]], [], 'do_dl]>, <$format, ["dt", [], ["*"], 'do_dt]>, <$format, ["dd", [], ["On leap years this is 0-355."], 'do_dd]>, "}"], #[['this, $help_func_localtime]]]>; var $root inited = 1; var $root managed = [$help_func_localtime]; var $root owned = [$help_func_localtime]; new object $help_func_lookup: $help_functions; var $root manager = $help_func_lookup; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611381; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "lookup", "lookup"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": lookup()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["OBJNUM"], 'do_i]>, " ", <$format, ["b", [], ["lookup"], 'do_b]>, "(", <$format, ["i", [], ["SYMBOL ", <$format, ["b", [], ["name"], 'do_b]>], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function attempts to lookup the name ", <$format, ["b", [], ["name"], 'do_b]>, " as an object name and returns the appropriate object number. Using this function object #1 ($root) could be looked up with the ColdC code ", <$format, ["tt", [], ["lookup('root)"], 'do_tt]>, "). If ", <$format, ["i", [], ["name"], 'do_i]>, " is not assigned as an object name, the error ", <$format, ["tt", [], ["~namenf"], 'do_tt]>, " is thrown."], #[['this, $help_func_lookup]]]>; var $root inited = 1; var $root managed = [$help_func_lookup]; var $root owned = [$help_func_lookup]; new object $help_func_lowercase: $help_functions; var $root manager = $help_func_lowercase; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611381; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "lowercase", "lowercase"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": lowercase()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["STRING"], 'do_i]>, " ", <$format, ["b", [], ["lowercase"], 'do_b]>, "(", <$format, ["i", [], ["STRING ", <$format, ["b", [], ["str"], 'do_b]>], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function changes each character in ", <$format, ["i", [], ["str"], 'do_i]>, " to it's lowercase value and returns the result."], #[['this, $help_func_lowercase]]]>; var $root inited = 1; var $root managed = [$help_func_lowercase]; var $root owned = [$help_func_lowercase]; new object $help_func_match_begin: $help_functions; var $root manager = $help_func_match_begin; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611382; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "match_begin", "match_begin"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": match_begin()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["INTEGER"], 'do_i]>, " ", <$format, ["b", [], ["match_begin"], 'do_b]>, "(", <$format, ["i", [], ["STRING ", <$format, ["b", [], ["str"], 'do_b]>, ", STRING ", <$format, ["b", [], ["search"], 'do_b]>, "[, STRING ", <$format, ["b", [], ["sep"], 'do_b]>, "]"], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function looks for the string ", <$format, ["i", [], ["search"], 'do_i]>, " at the beginning of each word in ", <$format, ["i", [], ["str"], 'do_i]>, ". The word separator is given by the string ", <$format, ["i", [], ["sep"], 'do_i]>, " if it is specified; otherwise, a space (", <$format, ["tt", [], ["\" \""], 'do_tt]>, ") is used. The return value of ", <$format, ["tt", [], ["match_begin()"], 'do_tt]>, " is ", <$format, ["tt", [], ["1"], 'do_tt]>, " if ", <$format, ["i", [], ["search"], 'do_i]>, " was found at the beginning of a word in ", <$format, ["i", [], ["string"], 'do_i]>, ", or ", <$format, ["tt", [], ["0"], 'do_tt]>, " if not. ", <$format, ["p", [], [], 'do_p]>, "Examples: ", <$format, ["dfn", [], [" ", <$format, ["quote", [], ["\n\nmatch_begin(\"foo:bar:baz\", \"fo\", \":\")\n=> 1\n\nmatch_begin(\"foo bar baz\", \"ar\")\n=> 0\n\n"], 'do_quote]>, " "], 'do_dfn]>], #[['this, $help_func_match_begin]]]>; var $root inited = 1; var $root managed = [$help_func_match_begin]; var $root owned = [$help_func_match_begin]; new object $help_func_match_pattern: $help_functions; var $root manager = $help_func_match_pattern; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611382; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "match_pattern", "match_pattern"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": match_pattern()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["LIST"], 'do_i]>, " ", <$format, ["b", [], ["match_pattern"], 'do_b]>, "(", <$format, ["i", [], ["STRING ", <$format, ["b", [], ["pattern"], 'do_b]>, ", STRING ", <$format, ["b", [], ["string"], 'do_b]>], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function matches the wildcard pattern ", <$format, ["i", [], ["pattern"], 'do_i]>, " against ", <$format, ["i", [], ["string"], 'do_i]>, ". A wildcard pattern is a string with asterixes (", <$format, ["tt", [], ["`*'"], 'do_tt]>, ") signifying wildcards. A regular character matches itself, while a wildcard matches any number of arbitrary characters. The return value of ", <$format, ["tt", [], ["match_pattern()"], 'do_tt]>, " is a list of the substrings of ", <$format, ["i", [], ["string"], 'do_i]>, " which matched the wildcards in ", <$format, ["i", [], ["pattern"], 'do_i]>, ", or ", <$format, ["tt", [], ["0"], 'do_tt]>, " if the match fails. ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["tt", [], ["match_pattern()"], 'do_tt]>, " allows you to do simple character-based matching. For matching against command formats, however, you should use the ", <$format, ["tt", [], ["match_template()"], 'do_tt]>, " function. ", <$format, ["p", [], [], 'do_p]>, " Examples: ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["quote", [], ["\n\nmatch_pattern(\"*\", \"foobar\")\n=> [\"foobar\"]\n\nmatch_pattern(\"foo * bar * baz\", \"foo quux bar quuux baz\")\n=> [\"quux\", \"quuux\"]\n\nmatch_pattern(\"foo * bar\", \"baz\")\n=> 0\n\n"], 'do_quote]>], #[['this, $help_func_match_pattern]]]>; var $root inited = 1; var $root managed = [$help_func_match_pattern]; var $root owned = [$help_func_match_pattern]; new object $help_func_match_regexp: $help_functions; var $root manager = $help_func_match_regexp; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611382; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "match_regexp", "match_regexp"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions], ["ColdC Regular Expressions", $help_driver_regularexpressions], ["regexp()", $help_func_regexp]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": match_regexp()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["LIST"], 'do_i]>, " ", <$format, ["b", [], ["match_regexp"], 'do_b]>, "(", <$format, ["i", [], ["STRING ", <$format, ["b", [], ["regexp"], 'do_b]>, ", STRING ", <$format, ["b", [], ["string"], 'do_b]>, "[, INTEGER ", <$format, ["b", [], ["case-matters"], 'do_b]>, "]"], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function matches the regular expression ", <$format, ["i", [], ["regexp"], 'do_i]>, ", a string, against the string ", <$format, ["i", [], ["string"], 'do_i]>, ". If ", <$format, ["i", [], ["case-matters"], 'do_i]>, " is specified and is true, the match is case-sensitive; otherwise, it is case-insensitive. If the match succeeds, ", <$format, ["tt", [], ["match_regexp()"], 'do_tt]>, " returns a ten-element list giving the substitutions for the match (see below); otherwise, ", <$format, ["tt", [], ["match_regexp()"], 'do_tt]>, " returns 0. ", <$format, ["p", [], [], 'do_p]>, " For more information on ColdC Regular Expressions see the section ", <$format, ["link", [["node", "$help_driver_regularexpressions"]], ["ColdC Regular Expressions"], 'do_link]>, ". ", <$format, ["p", [], [], 'do_p]>, " The substitutions are the text in ", <$format, ["i", [], ["string"], 'do_i]>, " which matches the parenthesized subexpressions in ", <$format, ["i", [], ["regexp"], 'do_i]>, ". The first substitution is the text in ", <$format, ["i", [], ["string"], 'do_i]>, " which matches the whole regexp. Thus, a regular expression can contain no more than nine parenthesized subexpressions. Substitutions are returned as two-element lists ", <$format, ["quote", [], ["[{i:start}, {i:len}] "], 'do_quote]>, " giving the index of the matching text in ", <$format, ["i", [], ["string"], 'do_i]>, " and the length of the text. When the substitutions are ambiguous, leftmost ", <$format, ["tt", [], ["`*'"], 'do_tt]>, " matches are always as long as possible. ", <$format, ["p", [], [], 'do_p]>, "The function ", <$format, ["link", [["node", "$help_func_regexp"]], ["regexp()"], 'do_link]>, " is similar to ", <$format, ["tt", [], ["match_regexp()"], 'do_tt]>, " except it returns the actual strings matched, rather than the index of their positions. In general, ", <$format, ["tt", [], ["match_regexp()"], 'do_tt]>, " should be used when you simply want a match, and ", <$format, ["tt", [], ["regexp()"], 'do_tt]>, " should be used when you want the exact results of the match. ", <$format, ["p", [], [], 'do_p]>, " If ", <$format, ["i", [], ["regexp"], 'do_i]>, " is not a valid regular expression, ", <$format, ["tt", [], ["match_regexp()"], 'do_tt]>, " throws a ", <$format, ["tt", [], ["~regexp"], 'do_tt]>, " error. ", <$format, ["p", [], [], 'do_p]>, "Examples: ", <$format, ["dfn", [], [" ", <$format, ["quote", [], ["\n\nmatch_regexp(\"bar\", \"fooBAR\")\n=> [[4, 3], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0]]\n\nmatch_regexp(\"^([^ ]+) says, \\\"(.*)\\\"$\", \"Greg says, \\\"Hello.\\\"\")\n=> [[1, 19], [1, 4], [13, 6], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0]]\n\nmatch_regexp(\"[0-9]+\", \" 300 100 200 \")\n=> [[2, 3], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0]]\n\nmatch_regexp(\"foo\", \"bar\")\n=> 0\n\nmatch_regexp(\"foo\", \"Foo\", 1)\n=> 0\n\n"], 'do_quote]>, " "], 'do_dfn]>], #[['this, $help_func_match_regexp]]]>; var $root inited = 1; var $root managed = [$help_func_match_regexp]; var $root owned = [$help_func_match_regexp]; new object $help_func_match_template: $help_functions; var $root manager = $help_func_match_template; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611382; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "match_template", "match_template"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": match_template()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["LIST"], 'do_i]>, " ", <$format, ["b", [], ["match_template"], 'do_b]>, "(", <$format, ["i", [], ["STRING ", <$format, ["b", [], ["template"], 'do_b]>, ", STRING ", <$format, ["b", [], ["string"], 'do_b]>], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function matches the template ", <$format, ["i", [], ["template"], 'do_i]>, " against the command ", <$format, ["i", [], ["string"], 'do_i]>, ". The return value of ", <$format, ["tt", [], ["match_template()"], 'do_tt]>, " is a list of fields resulting from the template match, or ", <$format, ["tt", [], ["0"], 'do_tt]>, " if the match fails or if ", <$format, ["i", [], ["template"], 'do_i]>, " is an invalid template. ", <$format, ["p", [], [], 'do_p]>, "A ", <$format, ["EM", [], ["template"], 'do_EM]>, " is a sequence of word-patterns and wildcards separated by spaces, with wildcards never occurring more than one at a time. A ", <$format, ["EM", [], ["word-pattern"], 'do_EM]>, " is a sequence of words separated by pipe characters (", <$format, ["tt", [], ["`|'"], 'do_tt]>, "). A word is a sequence of alphanumeric characters, with an optional question mark (", <$format, ["tt", [], ["`?'"], 'do_tt]>, ") indicating the beginning of an allowed partial match. A ", <$format, ["EM", [], ["wildcard"], 'do_EM]>, " is either a simple wildcard, represented by an asterix (", <$format, ["tt", [], ["`*'"], 'do_tt]>, ") or a ", <$format, ["EM", [], ["coupled wildcard"], 'do_EM]>, ", represented by the three-character sequence ", <$format, ["tt", [], ["`*=*'"], 'do_tt]>, ". ", <$format, ["p", [], [], 'do_p]>, " That definition of a template is confusing, so we will now go back and explain each component of a template in more detail. ", <$format, ["p", [], [], 'do_p]>, " A ", <$format, ["EM", [], ["word-pattern"], 'do_EM]>, " is a list of words separated by pipe characters. A word-pattern matches any of the words contained in it. The word-pattern ", <$format, ["tt", [], ["\"look|examine\""], 'do_tt]>, " matches either of the words ", <$format, ["tt", [], ["\"look\""], 'do_tt]>, " or ", <$format, ["tt", [], ["\"examine\""], 'do_tt]>, ". The word separator for template matching is always a space. ", <$format, ["p", [], [], 'do_p]>, " A word can include a question mark (", <$format, ["tt", [], ["`?'"], 'do_tt]>, ") to indicate that partial matches that extend at least as far as the question mark are okay. The word pattern ", <$format, ["tt", [], ["\"look|ex?amine\""], 'do_tt]>, " matches any of the words ", <$format, ["tt", [], ["\"look\""], 'do_tt]>, ", ", <$format, ["tt", [], ["\"ex\""], 'do_tt]>, ", ", <$format, ["tt", [], ["\"exa\""], 'do_tt]>, ", ", <$format, ["tt", [], ["\"exam\""], 'do_tt]>, ", ", <$format, ["tt", [], ["\"exami\""], 'do_tt]>, ", ", <$format, ["tt", [], ["\"examin\""], 'do_tt]>, ", and ", <$format, ["tt", [], ["\"examine\""], 'do_tt]>, ". ", <$format, ["p", [], [], 'do_p]>, " When a word-pattern successfully matches a word in ", <$format, ["i", [], ["string"], 'do_i]>, ", it results in a ", <$format, ["EM", [], ["field"], 'do_EM]>, ", or string in the returned list. This field contains the word which matched the word-pattern. ", <$format, ["p", [], [], 'do_p]>, " A ", <$format, ["EM", [], ["simple wildcard"], 'do_EM]>, " is represented by an asterix (", <$format, ["tt", [], ["`*'"], 'do_tt]>, "). A simple wildcard matches any number of words in ", <$format, ["EM", [], ["string"], 'do_EM]>, ". If the wildcard is followed by a word-pattern in ", <$format, ["EM", [], ["template"], 'do_EM]>, ", then it can also match a ", <$format, ["EM", [], ["quoted wildcard match"], 'do_EM]>, ". ", <$format, ["p", [], [], 'do_p]>, " A quoted wildcard match is just like a ", <$format, ["tt", [], ["C--"], 'do_tt]>, " string literal: it begins and ends with a double quote (", <$format, ["tt", [], ["`\"'"], 'do_tt]>, "), and can include a literal double quote or backslash by preceding the character with a backslash (", <$format, ["tt", [], ["`\'"], 'do_tt]>, "). If the simple wildcard is followed by a word-pattern, and the words in ", <$format, ["i", [], ["string"], 'do_i]>, " that the wildcard would match begin with a double quote, then the match must be a quoted wildcard match or the match fails, even if the match would have succeeded if the words were not treated as a quoted wildcard match. However, if the words that the wildcard would match begin with a backslash followed by a double quote, then the backslash is ignored and the double quote and the text following it are treated as regular words. ", <$format, ["p", [], [], 'do_p]>, " The template ", <$format, ["tt", [], ["\"* bar\""], 'do_tt]>, " matches any of the following strings: ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["quote", [], ["\n\nfoo bar\nfoo baz bar\n\"foo bar \\\ \\\" baz\" bar\n\\\"foo baz bar\n\n"], 'do_quote]>, " ", <$format, ["p", [], [], 'do_p]>, " Matching against a simple wildcard produces one field, the words that the simple wildcard matched. If the wildcard matches a quoted wildcard match, then the beginning and ending double quotes are stripped out of the resulting field, as well as any backslashes used to escape characters inside the double quotes. ", <$format, ["p", [], [], 'do_p]>, " A ", <$format, ["EM", [], ["coupled wildcard"], 'do_EM]>, " is represented by the three-character sequence ", <$format, ["tt", [], ["`*=*'"], 'do_tt]>, ". It matches any sequence of words containing an equal sign (", <$format, ["tt", [], ["`='"], 'do_tt]>, "), and results in two fields, the text before the equal sign and the text after it. Any spaces surrounding the equal sign are ignored and do not show up in the resulting fields. The text before the equal sign can be a quoted wildcard match (as before, if it begins with a double quote, then it must be a quoted wildcard match or the match fails, unless the initial double quote is escaped by a backslash). If the coupled wildcard is followed by a word pattern, then the text after the equal sign can also be a quoted wildcard match. ", <$format, ["p", [], [], 'do_p]>, " The coupled wildcard is a special feature intended for parsing TinyMUD command formats. If possible, its use should be avoided. ", <$format, ["p", [], [], 'do_p]>, " If ", <$format, ["i", [], ["template"], 'do_i]>, " is invalid, then the match usually fails, although this is not guaranteed. ", <$format, ["p", [], [], 'do_p]>, " Examples: ", <$format, ["dfn", [], [" ", <$format, ["quote", [], ["\n \nmatch_template(\"@desc?ribe * as *\", \"@descr me as foobar\") \n=> [\"@descr\", \"me\", \"as\", \"foobar\"]\n\nmatch_template(\"@desc?ribe * as *\", \"@desc \\\"as is\\\" as foobar\")\n=> [\"@desc\", \"as is\", \"as\", \"foobar\"] \n\nmatch_template(\"@desc?ribe * as *\", \"@desc \\\"as\\\" is as foobar\")\n=> 0\n\nmatch_template(\"@desc?ribe * as *\", \"@desc \\\\\\\"as\\\" is as foobar\")\n=> [\"@desc\", \"\\\"as\\\" is\", \"as\", \"foobar\"]\n\nmatch_template(\"@desc?ribe *=*\", \"@descr me =foobar\")\n=> [\"@descr\", \"me\", \"foobar\"]\n\nmatch_template(\"@desc?ribe *=*\", \"@desc \\\"2+2=4\\\"= an equation\")\n=> [\"@desc\", \"2+2=4\", \"an equation\"]\n\nmatch_template(\"l?ook|ex?amine *\", \"look at rose\")\n=> [\"look\", \"at rose\"]\n\n"], 'do_quote]>, " "], 'do_dfn]>], #[['this, $help_func_match_template]]]>; var $root inited = 1; var $root managed = [$help_func_match_template]; var $root owned = [$help_func_match_template]; new object $help_func_math: $help_functions; var $root manager = $help_func_math; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611382; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "math", "math"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": Math Functions"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["FLOAT"], 'do_i]>, " ", <$format, ["b", [], ["sin"], 'do_b]>, "(", <$format, ["i", [], ["FLOAT ", <$format, ["b", [], ["x"], 'do_b]>], 'do_i]>, ")", <$format, ["br", [], [], 'do_br]>, " ", <$format, ["i", [], ["FLOAT"], 'do_i]>, " ", <$format, ["b", [], ["exp"], 'do_b]>, "(", <$format, ["i", [], ["FLOAT ", <$format, ["b", [], ["x"], 'do_b]>], 'do_i]>, ")", <$format, ["br", [], [], 'do_br]>, " ", <$format, ["i", [], ["FLOAT"], 'do_i]>, " ", <$format, ["b", [], ["log"], 'do_b]>, "(", <$format, ["i", [], ["FLOAT ", <$format, ["b", [], ["x"], 'do_b]>], 'do_i]>, ")", <$format, ["br", [], [], 'do_br]>, " ", <$format, ["i", [], ["FLOAT"], 'do_i]>, " ", <$format, ["b", [], ["cos"], 'do_b]>, "(", <$format, ["i", [], ["FLOAT ", <$format, ["b", [], ["x"], 'do_b]>], 'do_i]>, ")", <$format, ["br", [], [], 'do_br]>, " ", <$format, ["i", [], ["FLOAT"], 'do_i]>, " ", <$format, ["b", [], ["tan"], 'do_b]>, "(", <$format, ["i", [], ["FLOAT ", <$format, ["b", [], ["x"], 'do_b]>], 'do_i]>, ")", <$format, ["br", [], [], 'do_br]>, " ", <$format, ["i", [], ["FLOAT"], 'do_i]>, " ", <$format, ["b", [], ["sqrt"], 'do_b]>, "(", <$format, ["i", [], ["FLOAT ", <$format, ["b", [], ["x"], 'do_b]>], 'do_i]>, ")", <$format, ["br", [], [], 'do_br]>, " ", <$format, ["i", [], ["FLOAT"], 'do_i]>, " ", <$format, ["b", [], ["asin"], 'do_b]>, "(", <$format, ["i", [], ["FLOAT ", <$format, ["b", [], ["x"], 'do_b]>], 'do_i]>, ")", <$format, ["br", [], [], 'do_br]>, " ", <$format, ["i", [], ["FLOAT"], 'do_i]>, " ", <$format, ["b", [], ["acos"], 'do_b]>, "(", <$format, ["i", [], ["FLOAT ", <$format, ["b", [], ["x"], 'do_b]>], 'do_i]>, ")", <$format, ["br", [], [], 'do_br]>, " ", <$format, ["i", [], ["FLOAT"], 'do_i]>, " ", <$format, ["b", [], ["atan"], 'do_b]>, "(", <$format, ["i", [], ["FLOAT ", <$format, ["b", [], ["x"], 'do_b]>], 'do_i]>, ")", <$format, ["br", [], [], 'do_br]>, " ", <$format, ["i", [], ["FLOAT"], 'do_i]>, " ", <$format, ["b", [], ["pow"], 'do_b]>, "(", <$format, ["i", [], ["FLOAT ", <$format, ["b", [], ["x"], 'do_b]>, ", FLOAT ", <$format, ["b", [], ["y"], 'do_b]>], 'do_i]>, ")", <$format, ["br", [], [], 'do_br]>, " ", <$format, ["i", [], ["FLOAT"], 'do_i]>, " ", <$format, ["b", [], ["atan2"], 'do_b]>, "(", <$format, ["i", [], ["FLOAT ", <$format, ["b", [], ["x"], 'do_b]>, ", FLOAT ", <$format, ["b", [], ["y"], 'do_b]>], 'do_i]>, ")", <$format, ["br", [], [], 'do_br]>, " ", <$format, ["p", [], [], 'do_p]>, "This function performs the relevant mathematic function on the argument(s) and returns the result. Further information on each function can be found in the unix man page on the same relative function, in C. The precision of the function may vary by the implementation."], #[['this, $help_func_math]]]>; var $root inited = 1; var $root managed = [$help_func_math]; var $root owned = [$help_func_math]; new object $help_func_max: $help_functions; var $root manager = $help_func_max; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611382; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "max", "max"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": max()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, <$format, ["i", [], ["ANY"], 'do_i]>, " ", <$format, ["b", [], ["max"], 'do_b]>, "(", <$format, ["i", [], ["ANY ", <$format, ["b", [], ["arg"], 'do_b]>, ", ..."], 'do_i]>, ") ", <$format, ["p", [], [], 'do_p]>, "This function returns the maximum of its arguments. All of the arguments must be of the same type, and must be integers or strings. ", <$format, ["dfn", [], [" ", <$format, ["quote", [], ["\n\nmax(3, 7, 9, 5)\n=> 9\nmax(\"Foo\", \"aardvark\", \"bar\", \"Quux\")\n=> \"Quux\"\n\n"], 'do_quote]>, " "], 'do_dfn]>], #[['this, $help_func_max]]]>; var $root inited = 1; var $root managed = [$help_func_max]; var $root owned = [$help_func_max]; new object $help_func_method: $help_functions; var $root manager = $help_func_method; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611382; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "method", "method"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": method()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, <$format, ["i", [], ["SYMBOL"], 'do_i]>, " ", <$format, ["b", [], ["method"], 'do_b]>, "() ", <$format, ["p", [], [], 'do_p]>, "This function returns the name of the current method, as a symbol."], #[['this, $help_func_method]]]>; var $root inited = 1; var $root managed = [$help_func_method]; var $root owned = [$help_func_method]; new object $help_func_method_access: $help_functions; var $root manager = $help_func_method_access; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611382; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "method_access", "method_access"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions], ["Methods", $help_driver_methodintro]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": method_access()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["SYMBOL"], 'do_i]>, " ", <$format, ["b", [], ["method_access"], 'do_b]>, "(", <$format, ["i", [], ["SYMBOL ", <$format, ["b", [], ["name"], 'do_b]>], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function returns the method access for the method ", <$format, ["i", [], ["name"], 'do_i]>, ". See ", <$format, ["link", [["node", "$help_driver_methodintro"]], ["Methods"], 'do_link]>, " for more information on method access."], #[['this, $help_func_method_access]]]>; var $root inited = 1; var $root managed = [$help_func_method_access]; var $root owned = [$help_func_method_access]; new object $help_func_method_flags: $help_functions; var $root manager = $help_func_method_flags; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611382; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "method_flags", "method_flags"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions], ["Defining Methods", $help_driver_methodintro]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": method_flags()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["LIST"], 'do_i]>, " ", <$format, ["b", [], ["method_flags"], 'do_b]>, "(", <$format, ["i", [], ["SYMBOL ", <$format, ["b", [], ["name"], 'do_b]>], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function finds the method named by ", <$format, ["i", [], ["name"], 'do_i]>, " and returns the list of flags currently set on the method. Method flags are fully explained in the section on ", <$format, ["link", [["node", "$help_driver_methodintro"]], ["Defining Methods"], 'do_link]>, ". If the method ", <$format, ["i", [], ["name"], 'do_i]>, " cannot be found, the error ", <$format, ["tt", [], ["~methodnf"], 'do_tt]>, " is thrown."], #[['this, $help_func_method_flags]]]>; var $root inited = 1; var $root managed = [$help_func_method_flags]; var $root owned = [$help_func_method_flags]; new object $help_func_method_info: $help_functions; var $root manager = $help_func_method_info; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611382; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "method_info", "method_info"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": method_info()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["LIST"], 'do_i]>, " ", <$format, ["b", [], ["method_info"], 'do_b]>, "(", <$format, ["i", [], ["SYMBOL ", <$format, ["b", [], ["name"], 'do_b]>], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function returns a list of miscellaneous information on the method named by ", <$format, ["i", [], ["name"], 'do_i]>, ". If the method is not found, the error ", <$format, ["tt", [], ["~methodnf"], 'do_tt]>, " is thrown. Otherwise a list is returned. The elements in the list are (in order): ", <$format, ["ol", [], [" ", <$format, ["li", [], ["STRING args "], 'do_li]>, <$format, ["li", [], ["INTEGER number of arguments "], 'do_li]>, <$format, ["li", [], ["INTEGER number of local variables defined "], 'do_li]>, <$format, ["li", [], ["INTEGER number of opcodes used "], 'do_li]>, <$format, ["li", [], ["SYMBOL method access "], 'do_li]>, <$format, ["li", [], ["LIST method flags "], 'do_li]>], 'do_ol]>], #[['this, $help_func_method_info]]]>; var $root inited = 1; var $root managed = [$help_func_method_info]; var $root owned = [$help_func_method_info]; new object $help_func_methods: $help_functions; var $root manager = $help_func_methods; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611382; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "methods", "methods"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": methods()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["LIST"], 'do_i]>, " ", <$format, ["b", [], ["methods"], 'do_b]>, "()", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function returns a list of symbols naming each method defined on the current object."], #[['this, $help_func_methods]]]>; var $root inited = 1; var $root managed = [$help_func_methods]; var $root owned = [$help_func_methods]; new object $help_func_min: $help_functions; var $root manager = $help_func_min; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611382; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "min", "min"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": min()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["ANY"], 'do_i]>, " ", <$format, ["b", [], ["min"], 'do_b]>, "(", <$format, ["i", [], ["ANY ", <$format, ["b", [], ["arg"], 'do_b]>, ", ..."], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function returns the minimum of its arguments. All of the arguments must be of the same type, and must be integers or strings. ", <$format, ["dfn", [], [" ", <$format, ["quote", [], ["\n\nmin(3, 7, 9, 5)\n=> 3\n\nmin(\"Foo\", \"aardvark\", \"bar\", \"Quux\")\n=> \"aardvark\"\n\n"], 'do_quote]>, " "], 'do_dfn]>], #[['this, $help_func_min]]]>; var $root inited = 1; var $root managed = [$help_func_min]; var $root owned = [$help_func_min]; new object $help_func_mtime: $help_functions; var $root manager = $help_func_mtime; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611382; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "mtime", "mtime"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": mtime()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["INTEGER"], 'do_i]>, " ", <$format, ["b", [], ["mtime"], 'do_b]>, "()", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "If your system does not have the C function ", <$format, ["tt", [], ["gettimeofday()"], 'do_tt]>, " then this function will return ", <$format, ["tt", [], ["-1"], 'do_tt]>, ". If it does, this function will return the current microseconds, from the C structure ", <$format, ["tt", [], ["struct timeval"], 'do_tt]>, ". This is useful in certain situations, but in general its granularity is too fine for most cases."], #[['this, $help_func_mtime]]]>; var $root inited = 1; var $root managed = [$help_func_mtime]; var $root owned = [$help_func_mtime]; new object $help_func_objname: $help_functions; var $root manager = $help_func_objname; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611382; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "objname", "objname"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": objname()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, <$format, ["i", [], ["SYMBOL"], 'do_i]>, " ", <$format, ["b", [], ["objname"], 'do_b]>, "() ", <$format, ["p", [], [], 'do_p]>, "This function returns the symbol representation of the current object's name. If the current object does not have an object name assigned, this function throws the error ", <$format, ["tt", [], ["~namenf"], 'do_tt]>, "."], #[['this, $help_func_objname]]]>; var $root inited = 1; var $root managed = [$help_func_objname]; var $root owned = [$help_func_objname]; new object $help_func_objnum: $help_functions; var $root manager = $help_func_objnum; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611382; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "objnum", "objnum"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": objnum()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["INTEGER"], 'do_i]>, " ", <$format, ["b", [], ["objnum"], 'do_b]>, "()", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function returns an integer representing the current object's object number."], #[['this, $help_func_objnum]]]>; var $root inited = 1; var $root managed = [$help_func_objnum]; var $root owned = [$help_func_objnum]; new object $help_func_open_connection: $help_functions; var $root manager = $help_func_open_connection; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611383; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "open_connection", "open_connection"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions], ["Networking", $help_driver_networking]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": open_connection()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["INTEGER"], 'do_i]>, " ", <$format, ["b", [], ["open_connection"], 'do_b]>, "(", <$format, ["i", [], ["STRING ", <$format, ["b", [], ["host"], 'do_b]>, ", INTEGER ", <$format, ["b", [], ["port"], 'do_b]>], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function opens a connection to ", <$format, ["i", [], ["host"], 'do_i]>, " at port ", <$format, ["i", [], ["port"], 'do_i]>, ", on the current object. If the host address ", <$format, ["i", [], ["host"], 'do_i]>, " is invalid, the error ", <$format, ["tt", [], ["~address"], 'do_tt]>, " is thrown. If the socket could not be established, ", <$format, ["tt", [], ["~socket"], 'do_tt]>, " is thrown. For more information, see the section on ", <$format, ["link", [["node", "$help_driver_networking"]], ["Networking"], 'do_link]>, "."], #[['this, $help_func_open_connection]]]>; var $root inited = 1; var $root managed = [$help_func_open_connection]; var $root owned = [$help_func_open_connection]; new object $help_func_pad: $help_functions; var $root manager = $help_func_pad; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611383; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "pad", "pad"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": pad()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["STRING"], 'do_i]>, " ", <$format, ["b", [], ["pad"], 'do_b]>, "(", <$format, ["i", [], ["STRING ", <$format, ["b", [], ["str"], 'do_b]>, ", INTEGER ", <$format, ["b", [], ["length"], 'do_b]>, "[, STRING ", <$format, ["b", [], ["filler"], 'do_b]>, <$format, ["quote", [], ["]"], 'do_quote]>], 'do_i]>, "})", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function pads or truncates ", <$format, ["i", [], ["string"], 'do_i]>, " to the length ", <$format, ["i", [], ["length"], 'do_i]>, ". If ", <$format, ["i", [], ["filler"], 'do_i]>, " is specified, then it is used to pad the string, otherwise a space is used. If ", <$format, ["i", [], ["length"], 'do_i]>, " is greater than the length of ", <$format, ["i", [], ["string"], 'do_i]>, ", then ", <$format, ["i", [], ["pad"], 'do_i]>, " adds filler characters on the right; however, you can force ", <$format, ["i", [], ["pad"], 'do_i]>, " to add filler on the left by specifying ", <$format, ["i", [], ["length"], 'do_i]>, " as a negative number. ", <$format, ["p", [], [], 'do_p]>, "Examples: ", <$format, ["dfn", [], [" ", <$format, ["quote", [], ["\n\npad(\"foo\", 6)\n=> \"foo \"\n\npad(\"foobar\", 3)\n=> \"foo\"\n\npad(tostr(29), -4, \"0\")\n=> \"0029\"\n\npad(\"what\", 20, \"!?!\")\n=> \"what!?!!?!!?!!?!!?!!\"\n\n"], 'do_quote]>, " "], 'do_dfn]>], #[['this, $help_func_pad]]]>; var $root inited = 1; var $root managed = [$help_func_pad]; var $root owned = [$help_func_pad]; new object $help_func_parents: $help_functions; var $root manager = $help_func_parents; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611383; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "parents", "parents"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": parents()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["LIST"], 'do_i]>, " ", <$format, ["b", [], ["parents"], 'do_b]>, "()", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function returns a list of the objnums for the parents of the current object."], #[['this, $help_func_parents]]]>; var $root inited = 1; var $root managed = [$help_func_parents]; var $root owned = [$help_func_parents]; new object $help_func_pause: $help_functions; var $root manager = $help_func_pause; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611383; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "pause", "pause"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions], ["Frames and Tasks", $help_driver_taskintro]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": pause()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["INTEGER"], 'do_i]>, " ", <$format, ["b", [], ["pause"], 'do_b]>, "()", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function instantly pauses the current task, letting other tasks execute before it resumes execution with a refreshed tick count. See ", <$format, ["link", [["node", "$help_driver_taskintro"]], ["Frames and Tasks"], 'do_link]>, " for more information on preempting and task control."], #[['this, $help_func_pause]]]>; var $root inited = 1; var $root managed = [$help_func_pause]; var $root owned = [$help_func_pause]; new object $help_func_random: $help_functions; var $root manager = $help_func_random; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611383; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "random", "random"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": random()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["INTEGER"], 'do_i]>, " ", <$format, ["b", [], ["random"], 'do_b]>, "(", <$format, ["i", [], ["INTEGER ", <$format, ["b", [], ["max"], 'do_b]>], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function returns a random integer between one and ", <$format, ["i", [], ["max"], 'do_i]>, ". ", <$format, ["p", [], [], 'do_p]>, "Examples: ", <$format, ["dfn", [], [<$format, ["quote", [], ["\n\nrandom(10)\n=> 3\n\n"], 'do_quote]>], 'do_dfn]>], #[['this, $help_func_random]]]>; var $root inited = 1; var $root managed = [$help_func_random]; var $root owned = [$help_func_random]; new object $help_func_reassign_connection: $help_functions; var $root manager = $help_func_reassign_connection; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611383; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "reassign_connection", "reassign_connection"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": reassign_connection()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["INTEGER"], 'do_i]>, " ", <$format, ["b", [], ["reassign_connection"], 'do_b]>, "(", <$format, ["i", [], ["OBJNUM ", <$format, ["b", [], ["new"], 'do_b]>], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function changes the controlling object for a connection from the current object to the object specified by the objnum ", <$format, ["i", [], ["new"], 'do_i]>, ". If the new object does not exist, ", <$format, ["tt", [], ["~objnf"], 'do_tt]>, " is thrown. If the new object already has a connection, the error ", <$format, ["tt", [], ["~perm"], 'do_tt]>, " is thrown."], #[['this, $help_func_reassign_connection]]]>; var $root inited = 1; var $root managed = [$help_func_reassign_connection]; var $root owned = [$help_func_reassign_connection]; new object $help_func_refresh: $help_functions; var $root manager = $help_func_refresh; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611383; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "refresh", "refresh"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions], ["pause()", $help_func_pause], ["Frames and Tasks", $help_func_tasks]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": refresh()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["INTEGER"], 'do_i]>, " ", <$format, ["b", [], ["refresh"], 'do_b]>, "()", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function checks the current frame's tick count. If it is nearly depleted it will preempt the task (similar to ", <$format, ["link", [["node", "$help_func_pause"]], ["pause()"], 'do_link]>, "), resuming it with a new tick count after all other current tasks have completed. ", <$format, ["p", [], [], 'do_p]>, "If the server is running atomically, the task will not preempt, and the tick count will automatically be refreshed. See ", <$format, ["link", [["node", "$help_func_tasks"]], ["Frames and Tasks"], 'do_link]>, " for more information."], #[['this, $help_func_refresh]]]>; var $root inited = 1; var $root managed = [$help_func_refresh]; var $root owned = [$help_func_refresh]; new object $help_func_regexp: $help_functions; var $root manager = $help_func_regexp; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611383; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "regexp", "regexp"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions], ["match_regexp()", $help_func_match_regexp], ["ColdC Regular Expressions", $help_driver_regularexpressions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": regexp()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["LIST"], 'do_i]>, " ", <$format, ["b", [], ["regexp"], 'do_b]>, "(", <$format, ["i", [], ["STRING ", <$format, ["b", [], ["regexp"], 'do_b]>, ", STRING ", <$format, ["b", [], ["string"], 'do_b]>, "[, INTEGER ", <$format, ["b", [], ["case-matters"], 'do_b]>, "]"], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function is virtually identical to ", <$format, ["link", [["node", "$help_func_match_regexp"]], ["match_regexp()"], 'do_link]>, ", except it returns the matched strings rather than their relative positions in the string. If you are simply matching the regular expression, use ", <$format, ["tt", [], ["match_regexp()"], 'do_tt]>, ", if you want the results from the match use this function instead. ", <$format, ["p", [], [], 'do_p]>, "This function matches the regular expression ", <$format, ["i", [], ["regexp"], 'do_i]>, ", a string, against the string ", <$format, ["i", [], ["string"], 'do_i]>, ". If ", <$format, ["i", [], ["case-matters"], 'do_i]>, " is specified and is true, the match is case-sensitive; otherwise, it is case-insensitive. If the match succeeds, ", <$format, ["tt", [], ["regexp()"], 'do_tt]>, " returns a list of the sub strings which were matched in ", <$format, ["i", [], ["string"], 'do_i]>, ", otherwise zero is returned. When the substitutions are ambiguous, leftmost ", <$format, ["tt", [], ["`*'"], 'do_tt]>, " matches are always as long as possible. If ", <$format, ["i", [], ["regexp"], 'do_i]>, " is not a valid regular expression the error ", <$format, ["tt", [], ["~regexp"], 'do_tt]>, " is thrown. ", <$format, ["p", [], [], 'do_p]>, "For more information on Regular Expressions see the section ", <$format, ["link", [["node", "$help_driver_regularexpressions"]], ["ColdC Regular Expressions"], 'do_link]>, ". ", <$format, ["p", [], [], 'do_p]>, "Examples: ", <$format, ["dfn", [], [" ", <$format, ["quote", [], ["\n\nregexp(\"bar\", \"fooBAR\")\n=> [\"BAR\"]\n\nregexp(\"^([^ ]+) says, \\\"(.*)\\\"$\", \"Greg says, \\\"Hello.\\\"\")\n=> [\"Greg\", \"Hello.\"]\n\nregexp(\"[0-9]+\", \" 300 100 200 \")\n=> [\"300\"]\n\nregexp(\"foo\", \"bar\")\n=> 0\n\nregexp(\"foo\", \"Foo\", 1)\n=> 0\n\n"], 'do_quote]>, " "], 'do_dfn]>], #[['this, $help_func_regexp]]]>; var $root inited = 1; var $root managed = [$help_func_regexp]; var $root owned = [$help_func_regexp]; new object $help_func_rename_method: $help_functions; var $root manager = $help_func_rename_method; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611383; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "rename_method", "rename_method"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": rename_method()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["INTEGER"], 'do_i]>, " ", <$format, ["b", [], ["rename_method"], 'do_b]>, "(", <$format, ["i", [], ["SYMBOL ", <$format, ["b", [], ["old_name"], 'do_b]>, ", SYMBOL ", <$format, ["b", [], ["new_name"], 'do_b]>], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function finds the method named by ", <$format, ["i", [], ["old_name"], 'do_i]>, " and renames it to ", <$format, ["b", [], ["new_name"], 'do_b]>, ". If the method ", <$format, ["i", [], ["old_name"], 'do_i]>, " cannot be found, the error ", <$format, ["tt", [], ["~methodnf"], 'do_tt]>, " is thrown. If the method ", <$format, ["i", [], ["new_name"], 'do_i]>, " already exists the error ", <$format, ["tt", [], ["~method"], 'do_tt]>, " is thrown."], #[['this, $help_func_rename_method]]]>; var $root inited = 1; var $root managed = [$help_func_rename_method]; var $root owned = [$help_func_rename_method]; new object $help_func_replace: $help_functions; var $root manager = $help_func_replace; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611383; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "replace", "replace"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": replace()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["LIST"], 'do_i]>, " ", <$format, ["b", [], ["replace"], 'do_b]>, "(", <$format, ["i", [], ["LIST ", <$format, ["b", [], ["list"], 'do_b]>, ", INTEGER ", <$format, ["b", [], ["pos"], 'do_b]>, ", ANY ", <$format, ["b", [], ["value"], 'do_b]>], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function replaces the element in ", <$format, ["i", [], ["list"], 'do_i]>, " specified by ", <$format, ["i", [], ["pos"], 'do_i]>, " with ", <$format, ["i", [], ["value"], 'do_i]>, ". If ", <$format, ["i", [], ["pos"], 'do_i]>, " is less than one or is greater than the length of ", <$format, ["i", [], ["list"], 'do_i]>, ", the error ", <$format, ["tt", [], ["~range"], 'do_tt]>, " is thrown. ", <$format, ["p", [], [], 'do_p]>, "Example: ", <$format, ["dfn", [], [<$format, ["quote", [], ["\n\nreplace([2, 3, 4], 2, 'foo)\n=> [2, 'foo, 4]\n\n"], 'do_quote]>], 'do_dfn]>], #[['this, $help_func_replace]]]>; var $root inited = 1; var $root managed = [$help_func_replace]; var $root owned = [$help_func_replace]; new object $help_func_resume: $help_functions; var $root manager = $help_func_resume; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611383; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "resume", "resume"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions], ["suspend()", $help_func_suspend], ["Frames and Tasks", $help_driver_taskintro]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": resume()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["INTEGER"], 'do_i]>, " ", <$format, ["b", [], ["resume"], 'do_b]>, "(", <$format, ["i", [], ["INTEGER ", <$format, ["b", [], ["task_id"], 'do_b]>, "[, ANY ", <$format, ["b", [], ["value"], 'do_b]>, "]"], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function resumes the suspended task referenced by ", <$format, ["i", [], ["task_id"], 'do_i]>, ". If no task exists with ", <$format, ["i", [], ["task_id"], 'do_i]>, " the error ", <$format, ["tt", [], ["~type"], 'do_tt]>, " is thrown. The optional second argument ", <$format, ["i", [], ["value"], 'do_i]>, " is used as the return value for the function ", <$format, ["link", [["node", "$help_func_suspend"]], ["suspend()"], 'do_link]>, ". If a second argument is not specified the return value of ", <$format, ["tt", [], ["suspend()"], 'do_tt]>, " is zero. See ", <$format, ["link", [["node", "$help_driver_taskintro"]], ["Frames and Tasks"], 'do_link]>, " for more information on preempting and task control."], #[['this, $help_func_resume]]]>; var $root inited = 1; var $root managed = [$help_func_resume]; var $root owned = [$help_func_resume]; new object $help_func_rethrow: $help_functions; var $root manager = $help_func_rethrow; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611383; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "rethrow", "rethrow"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": rethrow()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["b", [], ["rethrow"], 'do_b]>, "(", <$format, ["i", [], ["ERROR ", <$format, ["b", [], ["code"], 'do_b]>], 'do_i]>, ") ", <$format, ["p", [], [], 'do_p]>, "This function continues propagation of an error condition. The interpreter will abort the current method and throw the error specified by ", <$format, ["i", [], ["code"], 'do_i]>, " in the calling method. Calling this function outside of an error handler will result in the error ", <$format, ["tt", [], ["~error"], 'do_tt]>, "."], #[['this, $help_func_rethrow]]]>; var $root inited = 1; var $root managed = [$help_func_rethrow]; var $root owned = [$help_func_rethrow]; new object $help_func_sender: $help_functions; var $root manager = $help_func_sender; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611383; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "sender", "sender"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": sender()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["OBJNUM"], 'do_i]>, " ", <$format, ["b", [], ["sender"], 'do_b]>, "()", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function returns the objnum of the object which called the current method. If the current method was called by the driver, zero (0) is returned instead."], #[['this, $help_func_sender]]]>; var $root inited = 1; var $root managed = [$help_func_sender]; var $root owned = [$help_func_sender]; new object $help_func_set_heartbeat: $help_functions; var $root manager = $help_func_set_heartbeat; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611383; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "set_heartbeat", "set_heartbeat"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": set_heartbeat()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["INTEGER"], 'do_i]>, " ", <$format, ["b", [], ["set_heartbeat"], 'do_b]>, "(", <$format, ["i", [], ["INTEGER ", <$format, ["b", [], ["interval"], 'do_b]>], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function sets the heartbeat for the server, set to ", <$format, ["i", [], ["interval"], 'do_i]>, ", where ", <$format, ["i", [], ["interval"], 'do_i]>, " is in seconds. The heartbeat can be disabled by setting the interval to zero or a negative number. The default heartbeat interval is five seconds."], #[['this, $help_func_set_heartbeat]]]>; var $root inited = 1; var $root managed = [$help_func_set_heartbeat]; var $root owned = [$help_func_set_heartbeat]; new object $help_func_set_method_access: $help_functions; var $root manager = $help_func_set_method_access; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611383; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "set_method_access", "set_method_access"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions], ["Methods", $help_driver_methodintro]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": set_method_access()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["INTEGER"], 'do_i]>, " ", <$format, ["b", [], ["set_method_access"], 'do_b]>, "(", <$format, ["i", [], ["SYMBOL ", <$format, ["b", [], ["name"], 'do_b]>, ", SYMBOL ", <$format, ["b", [], ["access"], 'do_b]>], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function sets the method access for the method ", <$format, ["i", [], ["name"], 'do_i]>, ". See ", <$format, ["link", [["node", "$help_driver_methodintro"]], ["Methods"], 'do_link]>, " for more information on method access."], #[['this, $help_func_set_method_access]]]>; var $root inited = 1; var $root managed = [$help_func_set_method_access]; var $root owned = [$help_func_set_method_access]; new object $help_func_set_method_flags: $help_functions; var $root manager = $help_func_set_method_flags; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611383; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "set_method_flags", "set_method_flags"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": set_method_flags()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["INTEGER"], 'do_i]>, " ", <$format, ["b", [], ["set_method_flags"], 'do_b]>, "(", <$format, ["i", [], ["SYMBOL ", <$format, ["b", [], ["name"], 'do_b]>, ", LIST ", <$format, ["b", [], ["flags"], 'do_b]>], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function sets the method flags for the method ", <$format, ["i", [], ["name"], 'do_i]>, ". The flags are specified as a list of symbols in ", <$format, ["i", [], ["flags"], 'do_i]>, "."], #[['this, $help_func_set_method_flags]]]>; var $root inited = 1; var $root managed = [$help_func_set_method_flags]; var $root owned = [$help_func_set_method_flags]; new object $help_func_set_objname: $help_functions; var $root manager = $help_func_set_objname; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611384; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "set_objname", "set_objname"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": set_objname()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["INTEGER"], 'do_i]>, " ", <$format, ["b", [], ["set_objname"], 'do_b]>, "(", <$format, ["i", [], ["SYMBOL ", <$format, ["b", [], ["name"], 'do_b]>], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function sets ", <$format, ["i", [], ["name"], 'do_i]>, " as the current object's objname. If another object has already taken ", <$format, ["i", [], ["name"], 'do_i]>, ", the error ", <$format, ["tt", [], ["~error"], 'do_tt]>, " is thrown."], #[['this, $help_func_set_objname]]]>; var $root inited = 1; var $root managed = [$help_func_set_objname]; var $root owned = [$help_func_set_objname]; new object $help_func_set_var: $help_functions; var $root manager = $help_func_set_var; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611384; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "set_var", "set_var"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": set_var()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["ANY"], 'do_i]>, " ", <$format, ["b", [], ["set_var"], 'do_b]>, "(", <$format, ["i", [], ["SYMBOL ", <$format, ["b", [], ["name"], 'do_b]>, ", ANY ", <$format, ["b", [], ["value"], 'do_b]>], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function sets the value of an object variable on the current object. The variable must be defined on the object which defined the method which is calling ", <$format, ["tt", [], ["set_var()"], 'do_tt]>, ". Using this function is the same as using the assignment operator. If the object variable is not defined, the error ", <$format, ["tt", [], ["~varnf"], 'do_tt]>, " is thrown. The return value for ", <$format, ["tt", [], ["set_var()"], 'do_tt]>, " is the second argument ", <$format, ["tt", [], ["value"], 'do_tt]>, ". ", <$format, ["p", [], [], 'do_p]>], #[['this, $help_func_set_var]]]>; var $root inited = 1; var $root managed = [$help_func_set_var]; var $root owned = [$help_func_set_var]; new object $help_func_setadd: $help_functions; var $root manager = $help_func_setadd; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611384; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "setadd", "setadd"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": setadd()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["LIST"], 'do_i]>, " ", <$format, ["b", [], ["setadd"], 'do_b]>, "(", <$format, ["i", [], ["LIST ", <$format, ["b", [], ["list"], 'do_b]>, ", ANY ", <$format, ["b", [], ["value"], 'do_b]>], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function appends ", <$format, ["i", [], ["value"], 'do_i]>, " to ", <$format, ["i", [], ["list"], 'do_i]>, " if it is not already in the list, and returns the result. ", <$format, ["p", [], [], 'do_p]>, "Example: ", <$format, ["dfn", [], [<$format, ["quote", [], ["\n\nsetadd([2, 3, 4], 'foo) \n=> [2, 3, 4, 'foo]\nsetadd([2, 3, 4], 3)\n=> [2, 3, 4]\n\n"], 'do_quote]>], 'do_dfn]>], #[['this, $help_func_setadd]]]>; var $root inited = 1; var $root managed = [$help_func_setadd]; var $root owned = [$help_func_setadd]; new object $help_func_setremove: $help_functions; var $root manager = $help_func_setremove; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611384; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "setremove", "setremove"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": setremove()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["LIST"], 'do_i]>, " ", <$format, ["b", [], ["setremove"], 'do_b]>, "(", <$format, ["i", [], ["LIST ", <$format, ["b", [], ["list"], 'do_b]>, ", ANY ", <$format, ["b", [], ["value"], 'do_b]>], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function removes ", <$format, ["i", [], ["value"], 'do_i]>, " from ", <$format, ["i", [], ["list"], 'do_i]>, ", if it exists, and returns the result. ", <$format, ["p", [], [], 'do_p]>, "Examples: ", <$format, ["dfn", [], [" ", <$format, ["quote", [], ["\n \nsetremove([2, 3, 4, 'foo], 'foo)\n=> [2, 3, 4]\n\nsetremove([2, 3, 4], 5)\n=> [2, 3, 4]\n\nsetremove([2, 3, 2, 4], 2)\n=> [3, 2, 4]\n\n"], 'do_quote]>, " "], 'do_dfn]>], #[['this, $help_func_setremove]]]>; var $root inited = 1; var $root managed = [$help_func_setremove]; var $root owned = [$help_func_setremove]; new object $help_func_size: $help_functions; var $root manager = $help_func_size; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611384; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "size", "size"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": size()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["INTEGER"], 'do_i]>, " ", <$format, ["b", [], ["size"], 'do_b]>, "([", <$format, ["i", [], ["ANY ", <$format, ["b", [], ["data"], 'do_b]>], 'do_i]>, "])", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function is used for sizing data. If no arguments are specified, it will return the size of the current object, including all of the methods defined on it, and all of the object variables which are set on it. Otherwise it returns the size of the first argument. Note: specifying an objnum as the argument will return the size of the objnum, not the size of the object it represents! ", <$format, ["p", [], [], 'do_p]>, "The number returned represents the size, in bytes, ", <$format, ["i", [], ["on disk"], 'do_i]>, ". Because data is packed when written to the disk database, what is returned will not be comparable to runtime memory footprints. ", <$format, ["p", [], [], 'do_p]>, "Examples: ", <$format, ["dfn", [], [<$format, ["quote", [], ["\n\nsize(#1234)\n=> 8\n\nsize([1, 2, 3, 4])\n=> 40\n\nsize(#[['key1, 1], ['key2, \"test\"]])\n=> 276\n\nsize(<$root, #[['name, \"foo\"]]>);\n=> 263\n\nsize() {i:(the $string library on the Cold Dark)}\n=> 22553\n"], 'do_quote]>, " "], 'do_dfn]>], #[['this, $help_func_size]]]>; var $root inited = 1; var $root managed = [$help_func_size]; var $root owned = [$help_func_size]; new object $help_func_stack: $help_functions; var $root manager = $help_func_stack; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611384; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "stack", "stack"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": stack()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, <$format, ["i", [], ["LIST"], 'do_i]>, " ", <$format, ["b", [], ["stack"], 'do_b]>, "() ", <$format, ["p", [], [], 'do_p]>, "This function returns the call stack for the current task. Each element in the list is a list itself, representing a specific frame. The first element represents the first frame, and so on, up to the current frame. ", <$format, ["p", [], [], 'do_p]>, "Each frame list is ordered as follows: ", <$format, ["ol", [], [" ", <$format, ["li", [], ["OBJNUM sender "], 'do_li]>, <$format, ["li", [], ["OBJNUM caller "], 'do_li]>, <$format, ["li", [], ["SYMBOL method name "], 'do_li]>, <$format, ["li", [], ["INTEGER line number "], 'do_li]>, <$format, ["li", [], ["INTEGER current op code "], 'do_li]>], 'do_ol]>], #[['this, $help_func_stack]]]>; var $root inited = 1; var $root managed = [$help_func_stack]; var $root owned = [$help_func_stack]; new object $help_func_str_to_buf: $help_functions; var $root manager = $help_func_str_to_buf; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611384; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "str_to_buf", "str_to_buf"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": str_to_buf()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["BUFFER"], 'do_i]>, " ", <$format, ["b", [], ["str_to_buf"], 'do_b]>, "(", <$format, ["i", [], ["STRING ", <$format, ["b", [], ["str"], 'do_b]>], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function converts the string specified by the argument ", <$format, ["i", [], ["str"], 'do_i]>, " to a buffer. If the character sequence ", <$format, ["tt", [], ["\"\r\""], 'do_tt]>, " or the character sequence ", <$format, ["tt", [], ["\"\n\""], 'do_tt]>, " is encountered, a carriage return (ASCII 13) or newline (ASCII 10) will be placed in the buffer instead."], #[['this, $help_func_str_to_buf]]]>; var $root inited = 1; var $root managed = [$help_func_str_to_buf]; var $root owned = [$help_func_str_to_buf]; new object $help_func_strcmp: $help_functions; var $root manager = $help_func_strcmp; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611384; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "strcmp", "strcmp"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": strcmp()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["INTEGER"], 'do_i]>, " ", <$format, ["b", [], ["strcmp"], 'do_b]>, "(", <$format, ["i", [], ["STRING ", <$format, ["b", [], ["str1"], 'do_b]>, ", STRING ", <$format, ["b", [], ["str2"], 'do_b]>], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function compares ", <$format, ["i", [], ["str1"], 'do_i]>, " against ", <$format, ["i", [], ["str2"], 'do_i]>, " and returns zero if they are equal, greater than zero if ", <$format, ["i", [], ["string1"], 'do_i]>, " is lexically greater than ", <$format, ["i", [], ["string2"], 'do_i]>, ", and less than zero if ", <$format, ["i", [], ["string1"], 'do_i]>, " is lexically less than ", <$format, ["i", [], ["string2"], 'do_i]>, ". The comparison performed by ", <$format, ["tt", [], ["strcmp()"], 'do_tt]>, " is case-sensitive. ", <$format, ["p", [], [], 'do_p]>, "Examples: ", <$format, ["dfn", [], [" ", <$format, ["quote", [], ["\n\nstrcmp(\"Foo\", \"bar\")\n=> -28\n\nstrcmp(\"cashmir\", \"cashmiR\")\n=> 32\n\nstrcmp(\"foo\", \"foo\")\n=> 0\n\n"], 'do_quote]>, " "], 'do_dfn]>], #[['this, $help_func_strcmp]]]>; var $root inited = 1; var $root managed = [$help_func_strcmp]; var $root owned = [$help_func_strcmp]; new object $help_func_strfmt: $help_functions; var $root manager = $help_func_strfmt; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611384; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "strfmt", "strfmt"]; var $help_node links = #[["using the arithmetic operator", $help_driver_structure_expressions]]; var $help_node body = <$ctext_frob, [[<$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["STRING"], 'do_i]>, " ", <$format, ["b", [], ["strfmt"], 'do_b]>, "(", <$format, ["i", [], ["STRING ", <$format, ["b", [], ["format"], 'do_b]>, ", ANY ", <$format, ["b", [], ["arg"], 'do_b]>, "..."], 'do_i]>, ") ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function formats its arguments and returns the result. How the arguments are formatted depends upon the argument ", <$format, ["i", [], ["format"], 'do_i]>, ". The format contains two types of sequences: plain characters, which are simply copied to the new string, and format specifications, each of which causes printing of the next successive argument. ", <$format, ["p", [], [], 'do_p]>, "The format begins with a percent character (", <$format, ["tt", [], ["%"], 'do_tt]>, "), followed by: ", <$format, ["dl", [], [<$format, ["dt", [], ["Pad Length"], 'do_dt]>, <$format, ["dd", [], ["The pad length is an integer which specifies the length of characters to pad the argument in. Pad Length is optional. Specifying a zero pad length will be ignored, and is equivalent to not specifying a pad length. ", <$format, ["p", [], [], 'do_p]>], 'do_dd]>, <$format, ["dt", [], ["Precision"], 'do_dt]>, <$format, ["dd", [], ["A period (", <$format, ["tt", [], ["."], 'do_tt]>, "), followed by an integer specifies the precision, which specifies the number of digits to appear after the decimal point when printing FLOAT arguments. Precision is optional, and does not have to be specified. If it is specified it must come after the Pad Length (if specified), and before the Filler (if specified) or Format Type. ", <$format, ["p", [], [], 'do_p]>], 'do_dd]>, <$format, ["dt", [], ["Filler"], 'do_dt]>, <$format, ["dd", [], ["Filler specifies what is used when padding a string within the Pad Length. Filler is specified within curly braces (", <$format, ["tt", [], ["{"], 'do_tt]>, " and ", <$format, ["tt", [], ["}"], 'do_tt]>, "). To include a curly brace in the filler prefix it with a backslash. The Filler must come after Pad Length or Precision, if they are specified, and before Format Type. ", <$format, ["p", [], [], 'do_p]>], 'do_dd]>, <$format, ["dt", [], ["Format Type"], 'do_dt]>, <$format, ["dd", [], ["Format type must be specified last, and is not optional. Format Type specifies how the argument is to be handled. It is one of the following characters: ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["dl", [], [<$format, ["dt", [], [<$format, ["b", [], ["d"], 'do_b]>, " or ", <$format, ["b", [], ["D"], 'do_b]>], 'do_dt]>, <$format, ["dd", [], ["literal data"], 'do_dd]>, <$format, ["dt", [], [<$format, ["b", [], ["s"], 'do_b]>, " or ", <$format, ["b", [], ["S"], 'do_b]>, " or ", <$format, ["b", [], ["l"], 'do_b]>, " or ", <$format, ["b", [], ["L"], 'do_b]>], 'do_dt]>, <$format, ["dd", [], ["any data, align left"], 'do_dd]>, <$format, ["dt", [], [<$format, ["b", [], ["r"], 'do_b]>, " or ", <$format, ["b", [], ["R"], 'do_b]>], 'do_dt]>, <$format, ["dd", [], ["any data, align right "], 'do_dd]>, <$format, ["dt", [], [<$format, ["b", [], ["c"], 'do_b]>, " or ", <$format, ["b", [], ["C"], 'do_b]>], 'do_dt]>, <$format, ["dd", [], ["any data, align centered"], 'do_dd]>, <$format, ["dt", [], [<$format, ["b", [], ["e"], 'do_b]>], 'do_dt]>, <$format, ["dd", [], ["any data, align left with an elipse"], 'do_dd]>], 'do_dl]>, " ", <$format, ["p", [], [], 'do_p]>, "If the Format Type is anything but ", <$format, ["b", [], ["d"], 'do_b]>, " or ", <$format, ["b", [], ["D"], 'do_b]>, ", the data will be converted as if it were \"added\" to a string ", <$format, ["link", [["node", "$help_driver_structure_expressions"]], ["using the arithmetic operator"], 'do_link]>, ". If an uppercase character is used in the Format Type, any argument which has a length longer than the Pad Length will be truncated accordingly. Otherwise the argument will not be truncated. If an elipse is used, the argument will always be truncated three characters shorter than the Pad Length, with ", <$format, ["tt", [], ["\"...\""], 'do_tt]>, " being placed at the end."], 'do_dd]>], 'do_dl]>, " ", <$format, ["p", [], [], 'do_p]>, "Examples: ", <$format, ["dfn", [], [<$format, ["quote", [], ["\n\nstrfmt(\"%r\", \"test\")\n=> \"test\"\n\nstrfmt(\"%l\", \"test\")\n=> \"test\"\n\nstrfmt(\"%c\", \"test\")\n=> \"test\"\n\nstrfmt(\"%d\", \"test\")\n=> \"\\\"test\\\"\"\n\nstrfmt(\"%10r\", \"test\")\n=> \" test\" \n\nstrfmt(\"%10l\", \"test\")\n=> \"test \"\n\nstrfmt(\"%10c\", \"test\")\n=> \" test \" \n\nstrfmt(\"%10{|>}r\", \"test\")\n=> \"|>|>|>test\"\n\nstrfmt(\"%10{|>}l\", \"test\")\n=> \"test|>|>|>\" \n\nstrfmt(\"%10{|>}c\", \"test\")\n=> \"|>|test|>|\" \n\nstrfmt(\"%.2l\", 1.1214)\n=> \"1.12\"\n\nstrfmt(\"%10.3{0}r\", 1.1214)\n=> \"000001.121\"\n\nstrfmt(\"%10.3{0}r\", 1.1214)\n=> \"1.12100000\"\n\nstrfmt(\"%5e\", \"testing\")\n=> \"te...\"\n\nstrfmt(\"%s parents: %25e\", \"$user\", [$body, $interaction, $mail_ui,\n $command_aliases]);\n=> \"$user parents: [$body, $interaction, ...\"\n\n"], 'do_quote]>], 'do_dfn]>], #[['this, $help_func_strfmt]]]>; var $root inited = 1; var $root managed = [$help_func_strfmt]; var $root owned = [$help_func_strfmt]; new object $help_func_strgraft: $help_functions; var $root manager = $help_func_strgraft; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611384; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "strgraft", "strgraft"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": strgraft()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["STRING"], 'do_i]>, " ", <$format, ["b", [], ["strgraft"], 'do_b]>, "(", <$format, ["i", [], ["STRING ", <$format, ["b", [], ["str"], 'do_b]>, ", INTEGER ", <$format, ["b", [], ["pos"], 'do_b]>, ", STRING ", <$format, ["b", [], ["str2"], 'do_b]>], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function grafts a string into another string. It will take the string specified by ", <$format, ["i", [], ["str2"], 'do_i]>, " and insert it into ", <$format, ["i", [], ["str"], 'do_i]>, ", starting at the position specified by ", <$format, ["i", [], ["pos"], 'do_i]>, ". ", <$format, ["p", [], [], 'do_p]>, "Example: ", <$format, ["dfn", [], [<$format, ["quote", [], ["\n\nstrgraft(\"this string\", 6, \"is a \")\n=> \"this is a string\"\n\n"], 'do_quote]>], 'do_dfn]>], #[['this, $help_func_strgraft]]]>; var $root inited = 1; var $root managed = [$help_func_strgraft]; var $root owned = [$help_func_strgraft]; new object $help_func_strings_to_buf: $help_functions; var $root manager = $help_func_strings_to_buf; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611384; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "strings_to_buf", "strings_to_buf"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": strings_to_buf()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["BUFFER"], 'do_i]>, " ", <$format, ["b", [], ["strings_to_buf"], 'do_b]>, "(", <$format, ["i", [], ["LIST ", <$format, ["b", [], ["strings"], 'do_b]>, "[, BUFFER ", <$format, ["b", [], ["sep"], 'do_b]>, "]"], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function builds a buffer from the strings given in the list ", <$format, ["i", [], ["strings"], 'do_i]>, ". Each string represents a line which is terminated with a carriage return and a newline (ASCII 13 and 10, respectively). If the argument ", <$format, ["i", [], ["sep"], 'do_i]>, " is specified, each string is terminated with it instead."], #[['this, $help_func_strings_to_buf]]]>; var $root inited = 1; var $root managed = [$help_func_strings_to_buf]; var $root owned = [$help_func_strings_to_buf]; new object $help_func_strlen: $help_functions; var $root manager = $help_func_strlen; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611384; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "strlen", "strlen"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": strlen()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["INTEGER"], 'do_i]>, " ", <$format, ["b", [], ["strlen"], 'do_b]>, "(", <$format, ["i", [], ["STRING ", <$format, ["b", [], ["string"], 'do_b]>], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function returns the length of ", <$format, ["i", [], ["string"], 'do_i]>, "."], #[['this, $help_func_strlen]]]>; var $root inited = 1; var $root managed = [$help_func_strlen]; var $root owned = [$help_func_strlen]; new object $help_func_strsed: $help_functions; var $root manager = $help_func_strsed; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611384; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "strsed", "strsed"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": strsed()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, <$format, ["i", [], ["STRING"], 'do_i]>, " ", <$format, ["b", [], ["strsed"], 'do_b]>, "(", <$format, ["i", [], ["STRING ", <$format, ["b", [], ["regexp"], 'do_b]>, ", STRING ", <$format, ["b", [], ["string"], 'do_b]>, ", STRING ", <$format, ["b", [], ["replace"], 'do_b]>, "[, STRING ", <$format, ["b", [], ["flags"], 'do_b]>, "[, INTEGER ", <$format, ["b", [], ["count"], 'do_b]>, <$format, ["quote", [], ["]] "], 'do_quote]>], 'do_i]>, ") ", <$format, ["p", [], [], 'do_p]>, "This functions similar ", <$format, ["tt", [], ["sed"], 'do_tt]>, " in many unix systems. It searches for any occurances of ", <$format, ["i", [], ["regexp"], 'do_i]>, " in ", <$format, ["i", [], ["string"], 'do_i]>, " and replaces them with ", <$format, ["i", [], ["replace"], 'do_i]>, ", returning the result. The optional fourth argument is used to specify flags for sed. Flags are any of the following characters within a string: ", <$format, ["dl", [["columned", 1]], [" ", <$format, ["dt", [], [<$format, ["b", [], ["g"], 'do_b]>, " "], 'do_dt]>, <$format, ["dd", [], ["Match the regular expression globally througout the string. "], 'do_dd]>, <$format, ["dt", [], [<$format, ["b", [], ["s"], 'do_b]>, " "], 'do_dt]>, <$format, ["dd", [], ["Single match (Match the first occurance only). "], 'do_dd]>, <$format, ["dt", [], [<$format, ["b", [], ["c"], 'do_b]>, " "], 'do_dt]>, <$format, ["dd", [], ["Case matters when matching. "], 'do_dd]>, <$format, ["dt", [], [<$format, ["b", [], ["i"], 'do_b]>, " "], 'do_dt]>, <$format, ["dd", [], ["Case doesn't matter when matching. "], 'do_dd]>], 'do_dl]>, " The default flags are \"si\". Specifying an empty string for the flags will not cancel out the defaults. ", <$format, ["p", [], [], 'do_p]>, "The fifth argument ", <$format, ["i", [], ["count"], 'do_i]>, " is intended to optimize the use of this function, and is generally not used. It specifies how many occurances of the regular expression you expect to find in the string. This value is used when computing the initial size of the resulting string, to lower the amount of memory allocations which may have to be performed."], #[['this, $help_func_strsed]]]>; var $root inited = 1; var $root managed = [$help_func_strsed]; var $root owned = [$help_func_strsed]; new object $help_func_strsub: $help_functions; var $root manager = $help_func_strsub; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611384; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "strsub", "strsub"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": strsub()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["STRING"], 'do_i]>, " ", <$format, ["b", [], ["strsub"], 'do_b]>, "(", <$format, ["i", [], ["STRING ", <$format, ["b", [], ["str"], 'do_b]>, ", STRING ", <$format, ["b", [], ["search"], 'do_b]>, ", STRING ", <$format, ["b", [], ["replace"], 'do_b]>], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function replaces all occurances of the string ", <$format, ["i", [], ["search"], 'do_i]>, " with the string ", <$format, ["i", [], ["replace"], 'do_i]>, " and returns the result. Examples: ", <$format, ["dfn", [], [" ", <$format, ["quote", [], ["\n\nstrsub(\"foobar\", \"bar\", \"baz\")\n=> \"foobaz\"\n\n"], 'do_quote]>, " "], 'do_dfn]>], #[['this, $help_func_strsub]]]>; var $root inited = 1; var $root managed = [$help_func_strsub]; var $root owned = [$help_func_strsub]; new object $help_func_subbuf: $help_functions; var $root manager = $help_func_subbuf; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611385; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "subbuf", "subbuf"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": subbuf()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["BUFFER"], 'do_i]>, " ", <$format, ["b", [], ["subbuf"], 'do_b]>, "(", <$format, ["i", [], ["BUFFER ", <$format, ["b", [], ["buf"], 'do_b]>, ", INTEGER ", <$format, ["b", [], ["start"], 'do_b]>, "[, INTEGER ", <$format, ["b", [], ["length"], 'do_b]>, "]"], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function returns a subrange of the buffer specified by ", <$format, ["i", [], ["buf"], 'do_i]>, ". The subrange starts at position ", <$format, ["i", [], ["start"], 'do_i]>, ", and continues ", <$format, ["i", [], ["length"], 'do_i]>, " characters. If ", <$format, ["i", [], ["length"], 'do_i]>, " is unspecified, it will continue to the end of the buffer. If ", <$format, ["i", [], ["start"], 'do_i]>, " is outside of the range of the buffer, or ", <$format, ["i", [], ["length"], 'do_i]>, " will extend past the end of the buffer, the error ", <$format, ["tt", [], ["~range"], 'do_tt]>, " is thrown."], #[['this, $help_func_subbuf]]]>; var $root inited = 1; var $root managed = [$help_func_subbuf]; var $root owned = [$help_func_subbuf]; new object $help_func_sublist: $help_functions; var $root manager = $help_func_sublist; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611385; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "sublist", "sublist"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": sublist()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["LIST"], 'do_i]>, " ", <$format, ["b", [], ["sublist"], 'do_b]>, "(", <$format, ["i", [], ["LIST ", <$format, ["b", [], ["list"], 'do_b]>, ", INTEGER ", <$format, ["b", [], ["start"], 'do_b]>, <$format, ["quote", [], ["\["], 'do_quote]>, ", INTEGER ", <$format, ["b", [], ["length"], 'do_b]>, "]"], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function returns a subrange of the list specified by ", <$format, ["i", [], ["list"], 'do_i]>, ". The subrange starts at position ", <$format, ["i", [], ["start"], 'do_i]>, ", and continues ", <$format, ["i", [], ["length"], 'do_i]>, " elements. If ", <$format, ["i", [], ["length"], 'do_i]>, " is unspecified, it will continue to the end of the list. If ", <$format, ["i", [], ["start"], 'do_i]>, " is outside of the range of the list, or ", <$format, ["i", [], ["length"], 'do_i]>, " will extend past the end of the list, the error ", <$format, ["tt", [], ["~range"], 'do_tt]>, " is thrown. ", <$format, ["p", [], [], 'do_p]>, "Examples: ", <$format, ["dfn", [], [" ", <$format, ["quote", [], ["\n\nsublist([2, 3, 4, 5, 6, 7], 2, 3)\n=> [3, 4, 5]\n\nsublist([2, 3, 4, 5, 6, 7], 3)\n=> [4, 5, 6, 7]\n\nsublist([2, 3, 4, 5, 6, 7], 7)\n=> []\n\n"], 'do_quote]>, " "], 'do_dfn]>], #[['this, $help_func_sublist]]]>; var $root inited = 1; var $root managed = [$help_func_sublist]; var $root owned = [$help_func_sublist]; new object $help_func_substr: $help_functions; var $root manager = $help_func_substr; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611385; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "substr", "substr"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": substr()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["STRING"], 'do_i]>, " ", <$format, ["b", [], ["substr"], 'do_b]>, "(", <$format, ["i", [], ["STRING ", <$format, ["b", [], ["str"], 'do_b]>, ", INTEGER ", <$format, ["b", [], ["start"], 'do_b]>, "[, INTEGER ", <$format, ["b", [], ["length"], 'do_b]>, "]"], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function returns a subrange of ", <$format, ["i", [], ["string"], 'do_i]>, ". The subrange starts at the character specified by ", <$format, ["i", [], ["start"], 'do_i]>, " and continues ", <$format, ["i", [], ["length"], 'do_i]>, " characters. If ", <$format, ["i", [], ["length"], 'do_i]>, " is unspecified it continues to the end of the string. If ", <$format, ["i", [], ["start"], 'do_i]>, " is outside of the range of the string, or ", <$format, ["i", [], ["length"], 'do_i]>, " will extend past the end of the string, the error ", <$format, ["tt", [], ["~range"], 'do_tt]>, " is thrown. ", <$format, ["p", [], [], 'do_p]>, "Examples: ", <$format, ["dfn", [], [" ", <$format, ["quote", [], ["\n\nsubstr(\"foobar\", 2, 3)\n=> \"oob\"\n\nsubstr(\"foobar\", 3)\n=> \"obar\"\n\nsubstr(\"foobar\", 7)\n=> \"\"\n\n"], 'do_quote]>, " "], 'do_dfn]>], #[['this, $help_func_substr]]]>; var $root inited = 1; var $root managed = [$help_func_substr]; var $root owned = [$help_func_substr]; new object $help_func_suspend: $help_functions; var $root manager = $help_func_suspend; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611385; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "suspend", "suspend"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions], ["resume()", $help_func_resume], ["Frames and Tasks", $help_driver_taskintro]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": suspend()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["ANY"], 'do_i]>, " ", <$format, ["b", [], ["suspend"], 'do_b]>, "()", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function suspends the current task indefinitely. A suspended task is resumed by calling the function (in another task) ", <$format, ["link", [["node", "$help_func_resume"]], ["resume()"], 'do_link]>, ". The return value of suspend is given as the second argument to ", <$format, ["tt", [], ["resume()"], 'do_tt]>, ". If no second argument is given, the return value of ", <$format, ["tt", [], ["suspend()"], 'do_tt]>, " is zero. See ", <$format, ["link", [["node", "$help_driver_taskintro"]], ["Frames and Tasks"], 'do_link]>, " for more information on task control."], #[['this, $help_func_suspend]]]>; var $root inited = 1; var $root managed = [$help_func_suspend]; var $root owned = [$help_func_suspend]; new object $help_func_task_id: $help_functions; var $root manager = $help_func_task_id; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611385; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "task_id", "task_id"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions], ["Frames and Tasks", $help_driver_taskintro]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": task_id()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["INTEGER"], 'do_i]>, " ", <$format, ["b", [], ["task_id"], 'do_b]>, "()", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function returns the task id for the current task. See ", <$format, ["link", [["node", "$help_driver_taskintro"]], ["Frames and Tasks"], 'do_link]>, " for more information on preempting and task control."], #[['this, $help_func_task_id]]]>; var $root inited = 1; var $root managed = [$help_func_task_id]; var $root owned = [$help_func_task_id]; new object $help_func_tasks: $help_functions; var $root manager = $help_func_tasks; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611385; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "tasks", "tasks"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": tasks()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["LIST"], 'do_i]>, " ", <$format, ["b", [], ["tasks"], 'do_b]>, "()", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function returns a list of integers, where each integer is the task id for a currently suspended or preempted task."], #[['this, $help_func_tasks]]]>; var $root inited = 1; var $root managed = [$help_func_tasks]; var $root owned = [$help_func_tasks]; new object $help_func_this: $help_functions; var $root manager = $help_func_this; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611386; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "this", "this"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": this()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["OBJNUM"], 'do_i]>, " ", <$format, ["b", [], ["this"], 'do_b]>, "()", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function returns the objnum of the current object."], #[['this, $help_func_this]]]>; var $root inited = 1; var $root managed = [$help_func_this]; var $root owned = [$help_func_this]; new object $help_func_throw: $help_functions; var $root manager = $help_func_throw; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611386; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "throw", "throw"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions], ["traceback()", $help_func_traceback], ["Errors", $help_driver_errors]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": throw()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, <$format, ["b", [], ["throw"], 'do_b]>, "(", <$format, ["i", [], ["ERROR ", <$format, ["b", [], ["code"], 'do_b]>, ", STRING ", <$format, ["b", [], ["explanation"], 'do_b]>, "[, ANY ", <$format, ["b", [], ["additional"], 'do_b]>, "]"], 'do_i]>, ") ", <$format, ["p", [], [], 'do_p]>, "This function throws an error with the code ", <$format, ["i", [], ["code"], 'do_i]>, " in the calling method, not the current method. The current method does not have the ability to stop a method originating in itself. The variables ", <$format, ["i", [], ["explanation"], 'do_i]>, " and ", <$format, ["i", [], ["additional"], 'do_i]>, " appear in the traceback. For more information on error handling see ", <$format, ["link", [["node", "$help_func_traceback"]], ["traceback()"], 'do_link]>, " and ", <$format, ["link", [["node", "$help_driver_errors"]], ["Errors"], 'do_link]>, ". ", <$format, ["p", [], [], 'do_p]>, "Example using ", <$format, ["tt", [], ["throw()"], 'do_tt]>, ": ", <$format, ["dfn", [], [<$format, ["quote", [], ["\nthrow(~perm, \"Sender is not the system object.\");\n"], 'do_quote]>], 'do_dfn]>], #[['this, $help_func_throw]]]>; var $root inited = 1; var $root managed = [$help_func_throw]; var $root owned = [$help_func_throw]; new object $help_func_tick: $help_functions; var $root manager = $help_func_tick; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611386; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "tick", "tick"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": tick()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["INTEGER"], 'do_i]>, " ", <$format, ["b", [], ["tick"], 'do_b]>, "()", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function returns the current system-wide tick. It is a rather useless function."], #[['this, $help_func_tick]]]>; var $root inited = 1; var $root managed = [$help_func_tick]; var $root owned = [$help_func_tick]; new object $help_func_ticks_left: $help_functions; var $root manager = $help_func_ticks_left; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611386; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "ticks_left", "ticks_left"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions], ["Frames and Tasks", $help_driver_taskintro]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": ticks_left()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["INTEGER"], 'do_i]>, " ", <$format, ["b", [], ["ticks_left"], 'do_b]>, "()", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function returns the ticks remaining for the current frame. See ", <$format, ["link", [["node", "$help_driver_taskintro"]], ["Frames and Tasks"], 'do_link]>, " for more information on frames and ticks."], #[['this, $help_func_ticks_left]]]>; var $root inited = 1; var $root managed = [$help_func_ticks_left]; var $root owned = [$help_func_ticks_left]; new object $help_func_time: $help_functions; var $root manager = $help_func_time; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611386; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "time", "time"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": time()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["INTEGER"], 'do_i]>, " ", <$format, ["b", [], ["time"], 'do_b]>, "()", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function returns the system time in seconds since midnight GMT, January 1, 1970. You can use the functions ", <$format, ["tt", [], ["ctime()"], 'do_tt]>, " and ", <$format, ["tt", [], ["localtime()"], 'do_tt]>, " to extend the functionality of this number."], #[['this, $help_func_time]]]>; var $root inited = 1; var $root managed = [$help_func_time]; var $root owned = [$help_func_time]; new object $help_func_toerr: $help_functions; var $root manager = $help_func_toerr; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611386; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "toerr", "toerr"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": toerr()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["ERROR"], 'do_i]>, " ", <$format, ["b", [], ["toerr"], 'do_b]>, "(", <$format, ["i", [], ["STRING ", <$format, ["b", [], ["errname"], 'do_b]>], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function converts the argument specified by ", <$format, ["i", [], ["errname"], 'do_i]>, " to an error type."], #[['this, $help_func_toerr]]]>; var $root inited = 1; var $root managed = [$help_func_toerr]; var $root owned = [$help_func_toerr]; new object $help_func_tofloat: $help_functions; var $root manager = $help_func_tofloat; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611386; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "tofloat", "tofloat"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": tofloat()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["FLOAT"], 'do_i]>, " ", <$format, ["b", [], ["tofloat"], 'do_b]>, "(", <$format, ["i", [], ["ANY ", <$format, ["b", [], ["data"], 'do_b]>], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function accepts a STRING, INTEGER or OBJNUM data type and converts it to a FLOAT data type. Specifying any other data type will result in a ", <$format, ["tt", [], ["~type"], 'do_tt]>, " error."], #[['this, $help_func_tofloat]]]>; var $root inited = 1; var $root managed = [$help_func_tofloat]; var $root owned = [$help_func_tofloat]; new object $help_func_toint: $help_functions; var $root manager = $help_func_toint; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611386; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "toint", "toint"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": toint()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["INTEGER"], 'do_i]>, " ", <$format, ["b", [], ["toint"], 'do_b]>, "(", <$format, ["i", [], ["ANY ", <$format, ["b", [], ["data"], 'do_b]>], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function accepts a FLOAT, STRING or OBJNUM data type and converts it to an integer data type. Specifying any other data type will result in a ", <$format, ["tt", [], ["~type"], 'do_tt]>, " error."], #[['this, $help_func_toint]]]>; var $root inited = 1; var $root managed = [$help_func_toint]; var $root owned = [$help_func_toint]; new object $help_func_toliteral: $help_functions; var $root manager = $help_func_toliteral; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611386; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "toliteral", "toliteral"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": toliteral()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, <$format, ["i", [], ["STRING"], 'do_i]>, " ", <$format, ["b", [], ["toliteral"], 'do_b]>, "(", <$format, ["i", [], ["ANY ", <$format, ["b", [], ["data"], 'do_b]>], 'do_i]>, ") ", <$format, ["p", [], [], 'do_p]>, "This function converts any data to a literal representation of itself, which, if re-compiled, would result in the same data."], #[['this, $help_func_toliteral]]]>; var $root inited = 1; var $root managed = [$help_func_toliteral]; var $root owned = [$help_func_toliteral]; new object $help_func_toobjnum: $help_functions; var $root manager = $help_func_toobjnum; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611386; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "toobjnum", "toobjnum"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": toobjnum()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["OBJNUM"], 'do_i]>, " ", <$format, ["b", [], ["toobjnum"], 'do_b]>, "(", <$format, ["i", [], ["INTEGER ", <$format, ["b", [], ["number"], 'do_b]>], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function converts the integer data type specified by ", <$format, ["i", [], ["number"], 'do_i]>, " to an objnum data type. The returned objnum may or may not point to a valid object."], #[['this, $help_func_toobjnum]]]>; var $root inited = 1; var $root managed = [$help_func_toobjnum]; var $root owned = [$help_func_toobjnum]; new object $help_func_tostr: $help_functions; var $root manager = $help_func_tostr; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611386; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "tostr", "tostr"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions], ["toliteral()", $help_func_toliteral]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": tostr()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["STRING"], 'do_i]>, " ", <$format, ["b", [], ["tostr"], 'do_b]>, "(", <$format, ["i", [], ["ANY ", <$format, ["b", [], ["data"], 'do_b]>], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function returns a simple representation of the data specified by ", <$format, ["i", [], ["data"], 'do_i]>, ". It is not a literal representation, as ", <$format, ["link", [["node", "$help_func_toliteral"]], ["toliteral()"], 'do_link]>, " does, but instead is more succinct. For instance, with complex data types such as lists, the returned representation is simply ", <$format, ["tt", [], ["\"", <$generator, ["list", [], [], 'gen_list]>, "\""], 'do_tt]>, ". Less complex data types such as integers will still return the correct integer value."], #[['this, $help_func_tostr]]]>; var $root inited = 1; var $root managed = [$help_func_tostr]; var $root owned = [$help_func_tostr]; new object $help_func_tosym: $help_functions; var $root manager = $help_func_tosym; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611386; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "tosym", "tosym"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": tosym()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["SYMBOL"], 'do_i]>, " ", <$format, ["b", [], ["tosym"], 'do_b]>, "(", <$format, ["i", [], ["STRING ", <$format, ["b", [], ["input"], 'do_b]>], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function creates a symbol from the string ", <$format, ["i", [], ["input"], 'do_i]>, ". Symbols can only contain alphanumeric characters, and the underscore character."], #[['this, $help_func_tosym]]]>; var $root inited = 1; var $root managed = [$help_func_tosym]; var $root owned = [$help_func_tosym]; new object $help_func_traceback: $help_functions; var $root manager = $help_func_traceback; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611386; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "traceback", "traceback"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions], ["Errors", $help_driver_errors]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": traceback()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["LIST"], 'do_i]>, " ", <$format, ["b", [], ["traceback"], 'do_b]>, "()", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function returns the propogated error stack. The first element in the traceback list is the error condition, the second element is what caused the error. The subsequent errors describe the method call stack from the point of origin. ", <$format, ["p", [], [], 'do_p]>, "The error condition list is ordered as follows: ", <$format, ["ol", [], [" ", <$format, ["li", [], ["ERROR code "], 'do_li]>, <$format, ["li", [], ["STRING explanation "], 'do_li]>, <$format, ["li", [], ["ANY additional "], 'do_li]>], 'do_ol]>, " ", <$format, ["p", [], [], 'do_p]>, "An example of the error condition would be ", <$format, ["tt", [], ["[~methodnf, \"$sys.splat() not found.\", 0]"], 'do_tt]>, ". ", <$format, ["p", [], [], 'do_p]>, "The second element (what caused the error) will vary, depending upon where the error came from. If the error came from an operator, function or native method, it is a two element list: ", <$format, ["ol", [], [" ", <$format, ["li", [], ["SYMBOL which is one of ", <$format, ["tt", [], ["'opcode"], 'do_tt]>, ", ", <$format, ["tt", [], ["'function"], 'do_tt]>, " or ", <$format, ["tt", [], ["'native"], 'do_tt]>, " "], 'do_li]>, <$format, ["li", [], ["SYMBOL what operator, or the name of the function/native method. "], 'do_li]>], 'do_ol]>, " If the error originated in a method, this list is ordered as: ", <$format, ["ol", [], [" ", <$format, ["li", [], [<$format, ["tt", [], ["'method"], 'do_tt]>, " "], 'do_li]>, <$format, ["li", [], ["SYMBOL method name "], 'do_li]>, <$format, ["li", [], ["OBJNUM current object "], 'do_li]>, <$format, ["li", [], ["OBJNUM defining object "], 'do_li]>, <$format, ["li", [], ["INTEGER line in method "], 'do_li]>], 'do_ol]>, " All other elements are ordered as: ", <$format, ["ol", [], [" ", <$format, ["li", [], ["ERROR error code "], 'do_li]>, <$format, ["li", [], ["SYMBOL method name "], 'do_li]>, <$format, ["li", [], ["OBJNUM current object "], 'do_li]>, <$format, ["li", [], ["OBJNUM defining object "], 'do_li]>, <$format, ["li", [], ["INTEGER line in method "], 'do_li]>], 'do_ol]>, " Keep in mind that the error code will change to ", <$format, ["tt", [], ["~methoderr"], 'do_tt]>, " when it propogates, unless you specifically handle it. See the section ", <$format, ["link", [["node", "$help_driver_errors"]], ["Errors"], 'do_link]>, " for more information. control it"], #[['this, $help_func_traceback]]]>; var $root inited = 1; var $root managed = [$help_func_traceback]; var $root owned = [$help_func_traceback]; new object $help_func_type: $help_functions; var $root manager = $help_func_type; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611386; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "type", "type"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions], ["Data Types", $help_driver_structure_types]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": type()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["SYMBOL"], 'do_i]>, " ", <$format, ["b", [], ["type"], 'do_b]>, "(", <$format, ["i", [], ["ANY ", <$format, ["b", [], ["data"], 'do_b]>], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function returns a symbol name for the data type of ", <$format, ["i", [], ["data"], 'do_i]>, ". The following symbols represent the respective types: ", <$format, ["quote", [], ["\n\n INTEGER 'integer\n FLOAT 'float\n STRING 'string\n SYMBOL 'symbol\n LIST 'list\n OBJNUM 'objnum\n DICTIONARY 'dictionary\n ERROR 'error\n FROB 'frob\n BUFFER 'buffer\n\n"], 'do_quote]>, " ", <$format, ["p", [], [], 'do_p]>, "More information can be found in the section on ", <$format, ["link", [["node", "$help_driver_structure_types"]], ["Data Types"], 'do_link]>, "."], #[['this, $help_func_type]]]>; var $root inited = 1; var $root managed = [$help_func_type]; var $root owned = [$help_func_type]; new object $help_func_unbind_function: $help_functions; var $root manager = $help_func_unbind_function; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611387; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "unbind_function", "unbind_function"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": unbind_function()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["INTEGER"], 'do_i]>, " ", <$format, ["b", [], ["unbind_function"], 'do_b]>, "(", <$format, ["i", [], ["SYMBOL ", <$format, ["b", [], ["function"], 'do_b]>], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function unbinds a function from an object. The function is specified by the argument ", <$format, ["i", [], ["function"], 'do_i]>, "."], #[['this, $help_func_unbind_function]]]>; var $root inited = 1; var $root managed = [$help_func_unbind_function]; var $root owned = [$help_func_unbind_function]; new object $help_func_unbind_port: $help_functions; var $root manager = $help_func_unbind_port; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611387; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "unbind_port", "unbind_port"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": unbind_port()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["INTEGER"], 'do_i]>, " ", <$format, ["b", [], ["unbind_port"], 'do_b]>, "(", <$format, ["i", [], ["INTEGER ", <$format, ["b", [], ["port"], 'do_b]>], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function stops listening to the port specified by ", <$format, ["i", [], ["port"], 'do_i]>, ". If the object is not listening to the specified port, ", <$format, ["tt", [], ["~servnf"], 'do_tt]>, " is thrown."], #[['this, $help_func_unbind_port]]]>; var $root inited = 1; var $root managed = [$help_func_unbind_port]; var $root owned = [$help_func_unbind_port]; new object $help_func_union: $help_functions; var $root manager = $help_func_union; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611387; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "union", "union"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": union()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["LIST"], 'do_i]>, " ", <$format, ["b", [], ["union"], 'do_b]>, "(", <$format, ["i", [], ["LIST ", <$format, ["b", [], ["list"], 'do_b]>, ", LIST ", <$format, ["b", [], ["list2"], 'do_b]>], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function adds each element of ", <$format, ["i", [], ["list2"], 'do_i]>, " which does not already exist in ", <$format, ["i", [], ["list"], 'do_i]>, " to ", <$format, ["i", [], ["list"], 'do_i]>, " and returns the result. Elements which exist more than once in ", <$format, ["i", [], ["list2"], 'do_i]>, " will only be added to ", <$format, ["i", [], ["list"], 'do_i]>, " once, but duplicate elements in ", <$format, ["i", [], ["list1"], 'do_i]>, " will remain. ", <$format, ["p", [], [], 'do_p]>, "Examples: ", <$format, ["dfn", [], [" ", <$format, ["quote", [], ["\n\nunion([2, 3, 4], [4, 5, 4, 6])\n=> [2, 3, 4, 5, 6]\n\nunion([2, 2, 4, 5], [4, 5, 6, 6, 7])\n=> [2, 2, 4, 5, 6, 7])\n\n"], 'do_quote]>, " "], 'do_dfn]>], #[['this, $help_func_union]]]>; var $root inited = 1; var $root managed = [$help_func_union]; var $root owned = [$help_func_union]; new object $help_func_uppercase: $help_functions; var $root manager = $help_func_uppercase; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611387; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "uppercase", "uppercase"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": uppercase()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["STRING"], 'do_i]>, " ", <$format, ["b", [], ["uppercase"], 'do_b]>, "(", <$format, ["i", [], ["STRING ", <$format, ["b", [], ["str"], 'do_b]>], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function changes each character in ", <$format, ["i", [], ["str"], 'do_i]>, " to it's uppercase value and returns the result."], #[['this, $help_func_uppercase]]]>; var $root inited = 1; var $root managed = [$help_func_uppercase]; var $root owned = [$help_func_uppercase]; new object $help_func_valid: $help_functions; var $root manager = $help_func_valid; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611387; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "valid", "valid"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": valid()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["INTEGER"], 'do_i]>, " ", <$format, ["b", [], ["valid"], 'do_b]>, "(", <$format, ["i", [], ["OBJNUM ", <$format, ["b", [], ["objnum"], 'do_b]>], 'do_i]>, ")", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function returns one (true) if the object pointed to by ", <$format, ["i", [], ["objnum"], 'do_i]>, " exists, or zero (false) if it does not."], #[['this, $help_func_valid]]]>; var $root inited = 1; var $root managed = [$help_func_valid]; var $root owned = [$help_func_valid]; new object $help_func_variables: $help_functions; var $root manager = $help_func_variables; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611387; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "variables", "variables"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": variables()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["LIST"], 'do_i]>, " ", <$format, ["b", [], ["variables"], 'do_b]>, "()", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, " This function is used to determine all of the object variables defined on the current object. A list of symbols naming each variable is returned. ", <$format, ["p", [], [], 'do_p]>], #[['this, $help_func_variables]]]>; var $root inited = 1; var $root managed = [$help_func_variables]; var $root owned = [$help_func_variables]; new object $help_func_shutdown: $help_functions; var $root manager = $help_func_shutdown; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838616804; var $help_node index = $help_index_function; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "shutdown", "shutdown"]; var $help_node links = #[["ColdC", $help_coldc], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, ": shutdown()"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["i", [], ["INTEGER"], 'do_i]>, " ", <$format, ["b", [], ["shutdown"], 'do_b]>, "()", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This function completes all of the current tasks, syncronizes the database, and shuts down. All input/output is also flushed."], #[['this, $help_func_shutdown]]]>; var $root inited = 1; var $root managed = [$help_func_shutdown]; var $root owned = [$help_func_shutdown]; new object $help_driver_objects: $help_coldc; var $root manager = $help_driver_objects; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611413; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "objects", "objects"]; var $help_node links = #[["ColdC", $help_coldc], ["methods", $help_driver_objects_objectmethods], ["variables", $help_driver_objects_objectvariables], ["Referencing Objects", $help_driver_objects_referencing], ["Special Objects", $help_driver_objects_special]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": Objects"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, "An object in ColdC is an advanced data type. Objects are structured together with ", <$format, ["i", [], ["parents"], 'do_i]>, " and ", <$format, ["i", [], ["children"], 'do_i]>, " in a tree (geneology-style) hierarchy known as the ", <$format, ["i", [], ["object heirarchy"], 'do_i]>, ". An object has both ColdC procedures (", <$format, ["i", [], [<$format, ["link", [["node", "$help_driver_methods"]], ["methods"], 'do_link]>], 'do_i]>, ") and ColdC data (", <$format, ["i", [], [<$format, ["link", [["node", "$help_driver_variables"]], ["variables"], 'do_link]>], 'do_i]>, ") bound to it. The object variables are be accessed and modified by the methods defined on that object. ", <$format, ["ul", [], [<$format, ["li", [], [<$format, ["link", [["node", "$help_driver_objects_referencing"]], ["Referencing Objects"], 'do_link]>, " "], 'do_li]>, <$format, ["li", [], [<$format, ["link", [["node", "$help_driver_objects_objectmethods"]], ["Methods"], 'do_link]>, " "], 'do_li]>, <$format, ["li", [], [<$format, ["link", [["node", "$help_driver_objects_objectvariables"]], ["Variables"], 'do_link]>, " "], 'do_li]>, <$format, ["li", [], [<$format, ["link", [["node", "$help_driver_objects_special"]], ["Special Objects"], 'do_link]>, " "], 'do_li]>], 'do_ul]>], #[['this, $help_driver_objects]]]>; var $root inited = 1; var $root managed = [$help_driver_objects]; var $root owned = [$help_driver_objects]; new object $help_driver_objects_objectmethods: $help_driver_objects; var $root manager = $help_driver_objects_objectmethods; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611413; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "object methods", "object methods"]; var $help_node links = #[["ColdC", $help_coldc], ["Objects", $help_driver_objects], ["More on method structure", $help_driver_methodintro], ["descendants", $help_prog_oop], ["Defining Methods", $help_driver_methodintro]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_objects"]], ["Objects"], 'do_link]>, ": Methods"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, "A method is a series of ColdC statements which are grouped together as a procedure, to perform a task. Method's are given a name, and bound to a specific object. Methods determine the object's behavior. ", <$format, ["p", [], [], 'do_p]>, "Methods have a specific structure to them. The number of arguments they will accept is defined at the beginning of the method, followed by the definition all of the variables used within the method. Subsequent lines compose the actual method. ", <$format, ["link", [["node", "$help_driver_methodintro"]], ["More on method structure"], 'do_link]>, " is available later in this manual. ", <$format, ["p", [], [], 'do_p]>, "When ", <$format, ["i", [], [<$format, ["link", [["node", "$help_driver_oop"]], ["descendants"], 'do_link]>], 'do_i]>, " of an object wish to change their behavior, they may define their own methods, or ", <$format, ["i", [], ["override"], 'do_i]>, " a method defined on an ", <$format, ["i", [], ["ancestor"], 'do_i]>, ". A method is overriden by simply naming it the same as an existing method on an ancestor of the object. When a method is called, the interpreter looks for it first on the object, then on the object's ancestors. It is possible for a method overriding another to stop executing and pass back to the method on it's ancestor, and then resume executing when the overriden method is completed. ", <$format, ["p", [], [], 'do_p]>, "It is possible for a method to disallow descendants to override a method, See ", <$format, ["link", [["node", "$help_driver_methodintro"]], ["Defining Methods"], 'do_link]>, "."], #[['this, $help_driver_objects_objectmethods]]]>; var $root inited = 1; var $root managed = [$help_driver_objects_objectmethods]; var $root owned = [$help_driver_objects_objectmethods]; new object $help_driver_objects_referencing: $help_driver_objects; var $root manager = $help_driver_objects_referencing; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611413; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "referencing", "referencing"]; var $help_node links = #[["ColdC", $help_coldc], ["Objects", $help_driver_objects], ["set_objname()", $help_func_set_objname], ["del_objname()", $help_func_del_objname], ["objname()", $help_func_objname], ["objnum()", $help_func_objnum], ["lookup()", $help_func_lookup]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_objects"]], ["Objects"], 'do_link]>, ": Referencing Objects"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, "Each object has an ", <$format, ["i", [], ["Object Number"], 'do_i]>, " (", <$format, ["i", [], ["objnum"], 'do_i]>, "), which is a unique number assigned to that object upon its creation. ", <$format, ["I", [], ["Object numbers"], 'do_I]>, " cannot be changed after an object is created. When an object is destroyed, it's ", <$format, ["i", [], ["objnum"], 'do_i]>, " is not re-used by the driver. ", <$format, ["p", [], [], 'do_p]>, "In ColdC an object number is designated with a hash mark ('#') follwed by the object's number. For instance ", <$format, ["tt", [], ["#23"], 'do_tt]>, " refers to ", <$format, ["i", [], ["object number"], 'do_i]>, " ", <$format, ["tt", [], ["23"], 'do_tt]>, ". ", <$format, ["p", [], [], 'do_p]>, "An object can also have an ", <$format, ["i", [], ["Object Name"], 'do_i]>, " assigned to it, which can be changed througout the life of the object. Object Name's are only unique to that object, while the object has the name. Once the name is changed the old name can be taken by another object. Object Names exist for practical functionality. It is easier to remember references which consist of alphabetic and numeric characters, compared to references which are simply numeric. ", <$format, ["p", [], [], 'do_p]>, "When the driver attempts to print out a reference to an object, the Object Name will take precedence over an Object Number, because the name is generally easier to remember and comprehend. Object Name's are composed of alphabetic characters, numbers, and the underscore character ('_'). In ColdC an object number is designated with a dollar sign ('$'), followed by the name. For instance, if the object ", <$format, ["tt", [], ["#23"], 'do_tt]>, " had the name ", <$format, ["i", [], ["object_23"], 'do_i]>, " assigned to it. It would be formatted in ColdC as ", <$format, ["tt", [], ["$object_23"], 'do_tt]>, ". ", <$format, ["p", [], [], 'do_p]>, "When the interpreter encounters an object name, it looks up the number associated with that name in a table. If no object has been assigned to that name, a ", <$format, ["tt", [], ["~namenf"], 'do_tt]>, " error is thrown; otherwise the object name is equivalent to the object number. ", <$format, ["p", [], [], 'do_p]>, <$format, ["dl", [], [<$format, ["dt", [], [<$format, ["b", [], ["ColdC Functions"], 'do_b]>, " "], 'do_dt]>, <$format, ["dd", [], [<$format, ["link", [["node", "$help_func_set_objname"]], ["set_objname()"], 'do_link]>, ", ", <$format, ["link", [["node", "$help_func_del_objname"]], ["del_objname()"], 'do_link]>, ", ", <$format, ["link", [["node", "$help_func_objname"]], ["objname()"], 'do_link]>, ", ", <$format, ["link", [["node", "$help_func_objnum"]], ["objnum()"], 'do_link]>, ", ", <$format, ["link", [["node", "$help_func_lookup"]], ["lookup()"], 'do_link]>, ". "], 'do_dd]>], 'do_dl]>], #[['this, $help_driver_objects_referencing]]]>; var $root inited = 1; var $root managed = [$help_driver_objects_referencing]; var $root owned = [$help_driver_objects_referencing]; new object $help_driver_objects_special: $help_driver_objects; var $root manager = $help_driver_objects_special; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611413; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "special", "special"]; var $help_node links = #[["ColdC", $help_coldc], ["Objects", $help_driver_objects]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_objects"]], ["Objects"], 'do_link]>, ": Special Object Status"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, "There are always two objects which exists within a ColdC database. The first object is ", <$format, ["tt", [], ["$root"], 'do_tt]>, " (", <$format, ["tt", [], ["#1"], 'do_tt]>, "). The root object has no parents, and is the base for all other objects. This is a requirement in order for secure databases to be created. ", <$format, ["p", [], [], 'do_p]>, "The second object is ", <$format, ["tt", [], ["$sys"], 'do_tt]>, " (", <$format, ["tt", [], ["#0"], 'do_tt]>, "). The system object is the only object the driver communicates directly with. Certain signals are sent from the driver to database through the system object (such as startup and heartbeat calls to methods defined on the system object). ", <$format, ["p", [], [], 'do_p]>, "The root and system objects are automatically created by the database compiler, and need not be used directly."], #[['this, $help_driver_objects_special]]]>; var $root inited = 1; var $root managed = [$help_driver_objects_special]; var $root owned = [$help_driver_objects_special]; new object $help_driver_objects_objectvariables: $help_driver_objects; var $root manager = $help_driver_objects_objectvariables; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611414; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "object variables", "object variables"]; var $help_node links = #[["ColdC", $help_coldc], ["Objects", $help_driver_objects], ["encapsulation", $help_prog_oop]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_objects"]], ["Objects"], 'do_link]>, ": Variables"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, "In ColdC there are two types of variables, ", <$format, ["i", [], ["local variables"], 'do_i]>, " and ", <$format, ["i", [], ["object variables"], 'do_i]>, ". An object variable is defined on the object, and can be accessed by any method defined on the same object. Object variables exist outside of the scope of methods. Local variables are defined within a method, with their scope being limited to that method. ", <$format, ["p", [], [], 'do_p]>, "If a variable is used in a method, but it is not defined as an argument or a local variable (at the top of the method), it is assumed to be an object variable. When the method is executed the interpreter looks on the object for the variable. If the interpreter cannot find the variable on the object, the error ", <$format, ["tt", [], ["~varnf"], 'do_tt]>, " is thrown. ", <$format, ["p", [], [], 'do_p]>, "It is important to remember that variables may only be accessed by methods ", <$format, ["i", [], ["defined on the same object as the variable"], 'do_i]>, ". No other method may reference that variable. As an example let us define two objects (if this syntax is unfamiliar, see the TextDB format). ", <$format, ["dfn", [], [" ", <$format, ["quote", [], ["\n\nobject $obj_A: $root;\nvar $obj_A text;\n\npublic method $obj_A.get_text {\n return text;\n};\n\npublic method $obj_A.set_text {\n arg new_text;\n\n text = new_text;\n};\n\nobject $obj_B: $obj_A;\n\n\n"], 'do_quote]>, " "], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, "Calling ", <$format, ["tt", [], ["$obj_A.set_text(\"text\")"], 'do_tt]>, " will set ", <$format, ["tt", [], ["text"], 'do_tt]>, " on $obj_A with a value of \"text\". ", <$format, ["tt", [], ["$obj_B"], 'do_tt]>, " does inherit the ability to define and write to it's own copy of ", <$format, ["tt", [], ["text"], 'do_tt]>, " (using methods defined on ", <$format, ["tt", [], ["$obj_A"], 'do_tt]>, "), but it does not inherit values assigned to object variables on it's ancestors. I.e. calling ", <$format, ["tt", [], ["$obj_B.get_text()"], 'do_tt]>, " will return ", <$format, ["tt", [], ["0"], 'do_tt]>, " (the default unset value), as we have not yet set it to any value on ", <$format, ["tt", [], ["$obj_B"], 'do_tt]>, ", only on ", <$format, ["tt", [], ["$obj_A"], 'do_tt]>, " (this is called ", <$format, ["link", [["node", "$help_driver_oop"]], ["encapsulation"], 'do_link]>, "). ", <$format, ["p", [], [], 'do_p]>, "If we were to override the method ", <$format, ["tt", [], ["get_text"], 'do_tt]>, " defined on ", <$format, ["tt", [], ["$obj_A"], 'do_tt]>, ", on ", <$format, ["tt", [], ["$obj_B"], 'do_tt]>, ", as: ", <$format, ["dfn", [], [" ", <$format, ["quote", [], ["\n\npublic method $obj_B.get_text {\n return \"more text: \" + text;\n};\n\n"], 'do_quote]>, " "], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, "When we called it, the ", <$format, ["tt", [], ["~varnf"], 'do_tt]>, " error would be raised, because the object variable ", <$format, ["tt", [], ["text"], 'do_tt]>, " is not defined on $obj_B, where the overriding method ", <$format, ["tt", [], ["get_text"], 'do_tt]>, " is defined."], #[['this, $help_driver_objects_objectvariables]]]>; var $root inited = 1; var $root managed = [$help_driver_objects_objectvariables]; var $root owned = [$help_driver_objects_objectvariables]; new object $help_driver_structure: $help_coldc; var $root manager = $help_driver_structure; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611422; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "structure", "structure"]; var $help_node links = #[["ColdC", $help_coldc], ["Tokens", $help_driver_structure_tokens], ["Data Types", $help_driver_structure_types], ["Expressions", $help_driver_structure_expressions], ["Statements", $help_driver_structure_statements]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": Language Structure "], 'do_subj]>, "Structure topics: ", <$format, ["ul", [], [<$format, ["li", [], [<$format, ["b", [], [<$format, ["link", [["node", "$help_driver_structure_tokens"]], ["Tokens"], 'do_link]>], 'do_b]>, " "], 'do_li]>, <$format, ["li", [], [<$format, ["b", [], [<$format, ["link", [["node", "$help_driver_structure_types"]], ["Data Types"], 'do_link]>], 'do_b]>, " "], 'do_li]>, <$format, ["li", [], [<$format, ["b", [], [<$format, ["link", [["node", "$help_driver_structure_expressions"]], ["Expressions"], 'do_link]>], 'do_b]>, " "], 'do_li]>, <$format, ["li", [], [<$format, ["b", [], [<$format, ["link", [["node", "$help_driver_structure_statements"]], ["Statements"], 'do_link]>], 'do_b]>, " "], 'do_li]>], 'do_ul]>], #[['this, $help_driver_structure]]]>; var $root inited = 1; var $root managed = [$help_driver_structure]; var $root owned = [$help_driver_structure]; new object $help_driver_structure_expressions: $help_driver_structure; var $root manager = $help_driver_structure_expressions; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611423; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "expressions", "expressions"]; var $help_node links = #[["ColdC", $help_coldc], ["Language Structure", $help_driver_structure], ["tokens", $help_driver_structure_tokens], ["Errors", $help_driver_errors], ["expression", $help_driver_structure_expressions], ["Data Types", $help_driver_structure_types], ["Variables", $help_driver_structure_expressions_expressionvariables], ["Operators", $help_driver_structure_expressions_operators], ["Calling Functions", $help_driver_structure_expressions_callingfunctions], ["Calling Methods", $help_driver_structure_expressions_callingmethods], ["Error Handling", $help_driver_structure_expressions_errorhandling], ["Splicing", $help_driver_structure_expressions_splicing], ["Looping Expressions", $help_driver_structure_expressions_loopingexpressions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_structure"]], ["Language Structure"], 'do_link]>, ": Expressions"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, "Expressions are ColdC ", <$format, ["link", [["node", "$help_driver_structure_tokens"]], ["tokens"], 'do_link]>, " and operators which, when evaluated, will perform their functionality and take on a value after completion (also known as the ", <$format, ["i", [], ["return value"], 'do_i]>, "). If they evaluated without error, the return value is a standard ColdC data type. If an error occured, the return value is an error data type, and execution of the method is halted. For more information on errors see the section on ", <$format, ["link", [["node", "$help_driver_errors"]], ["Errors"], 'do_link]>, ". ", <$format, ["subj", [["level", "3"]], ["Data Types"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, "All ColdC data has a type and a logical truth value it will take on when evaluated as an ", <$format, ["link", [["node", "$help_driver_structure_expressions"]], ["expression"], 'do_link]>, ". Each data type is explained in the section ", <$format, ["link", [["node", "$help_driver_structure_types"]], ["Data Types"], 'do_link]>, ". ", <$format, ["p", [], [], 'do_p]>, <$format, ["p", [], [], 'do_p]>, "The expression topics: ", <$format, ["ul", [], [" ", <$format, ["li", [], [<$format, ["link", [["node", "$help_driver_structure_expressions_expressionvariables"]], ["Variables"], 'do_link]>], 'do_li]>, " ", <$format, ["li", [], [<$format, ["link", [["node", "$help_driver_structure_expressions_operators"]], ["Operators"], 'do_link]>], 'do_li]>, " ", <$format, ["li", [], [<$format, ["link", [["node", "$help_driver_structure_expressions_callingfunctions"]], ["Calling Functions"], 'do_link]>], 'do_li]>, " ", <$format, ["li", [], [<$format, ["link", [["node", "$help_driver_structure_expressions_callingmethods"]], ["Calling Methods"], 'do_link]>], 'do_li]>, " ", <$format, ["li", [], [<$format, ["link", [["node", "$help_driver_structure_expressions_errorhandling"]], ["Error Handling"], 'do_link]>], 'do_li]>, " ", <$format, ["li", [], [<$format, ["link", [["node", "$help_driver_structure_expressions_splicing"]], ["Splicing"], 'do_link]>], 'do_li]>, " ", <$format, ["li", [], [<$format, ["link", [["node", "$help_driver_structure_expressions_loopingexpressions"]], ["Looping Expressions"], 'do_link]>], 'do_li]>], 'do_ul]>], #[['this, $help_driver_structure_expressions]]]>; var $root inited = 1; var $root managed = [$help_driver_structure_expressions]; var $root owned = [$help_driver_structure_expressions]; new object $help_driver_structure_expressions_expressionvariables: $help_driver_structure_expressions; var $root manager = $help_driver_structure_expressions_expressionvariables; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838772261; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "expression variables", "expression variables"]; var $help_node links = #[["ColdC", $help_coldc], ["Language Structure", $help_driver_structure], [" Expressions", $help_driver_structure_expressions], ["Methods and Method Structure", $help_driver_methodintro], ["Variables", $help_driver_objects_objectvariables], ["get_var()", $help_func_get_var], ["set_var()", $help_func_set_var]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_structure"]], ["Language Structure"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_structure_expressions"]], [" Expressions"], 'do_link]>, ": Variables"], 'do_subj]>, <$format, ["tt", [], ["ColdC"], 'do_tt]>, " provides two kinds of variables, ", <$format, ["i", [], ["local variables"], 'do_i]>, " and ", <$format, ["i", [], ["object variables"], 'do_i]>, ". ", <$format, ["p", [], [], 'do_p]>, <$format, ["i", [], ["Local variables"], 'do_i]>, " are used within methods to temporarily store data. In order for a local variable to be used it must first be declared at the top of the method in a ", <$format, ["tt", [], ["var"], 'do_tt]>, " declaration (see section ", <$format, ["link", [["node", "$help_driver_methodintro"]], ["Methods and Method Structure"], 'do_link]>, "). ", <$format, ["i", [], ["Object variables"], 'do_i]>, " are defined on an object, and can be used to store data for an indefinite period of time. More information on Variables can be found in the section ", <$format, ["link", [["node", "$help_driver_objects_objectvariables"]], ["Variables"], 'do_link]>, ". ", <$format, ["p", [], [], 'do_p]>, "When a variable is evaluated as an expression, its value is that of its contents (the data stored in the variable name). Initially variables will contain the integer data value of zero (", <$format, ["tt", [], ["0"], 'do_tt]>, "). ", <$format, ["p", [], [], 'do_p]>, "To set the contents of a variable, use the ", <$format, ["i", [], ["assignment expression"], 'do_i]>, ", which has the following syntax: ", <$format, ["dfn", [], [" ", <$format, ["quote", [], ["\nvariable = value;\n"], 'do_quote]>, " "], 'do_dfn]>, "This assigns the value ", <$format, ["i", [], ["value"], 'do_i]>, " to the variable ", <$format, ["i", [], ["variable"], 'do_i]>, ". The values of a method's local variables are specific to the instant it is being processed. When the method is invoked at another time all of the local variables begin again with the value of zero (", <$format, ["tt", [], ["0"], 'do_tt]>, "). ", <$format, ["p", [], [], 'do_p]>, "Some examples of variable expressions follow: ", <$format, ["dfn", [], [<$format, ["quote", [], ["\ntotal = 3;\n"], 'do_quote]>], 'do_dfn]>, "When evaluated, this expression has the value of three (", <$format, ["tt", [], ["3"], 'do_tt]>, "). ", <$format, ["dfn", [], [<$format, ["quote", [], ["\ntotal + 3;\n"], 'do_quote]>], 'do_dfn]>, "If the variable ", <$format, ["i", [], ["total"], 'do_i]>, " was not previously assigned this expression would evaluate to three (", <$format, ["tt", [], ["3"], 'do_tt]>, "), otherwise it would be three plus the previous value of the variable ", <$format, ["i", [], ["total"], 'do_i]>, ". ", <$format, ["p", [], [], 'do_p]>, "If the variable is a local variable, it must be declared at the top of the method. If it is not declared at the top of the method, the interpreter will assume it is an object variable. In the case that both a local variable and an object variable have the same name, the local variable will take precedence and be used in the method. In order to retrieve and set data on the object variable you must use the functions ", <$format, ["link", [["node", "$help_func_get_var"]], ["get_var()"], 'do_link]>, " and ", <$format, ["link", [["node", "$help_func_set_var"]], ["set_var()"], 'do_link]>, ". These functions need only be used if there is a concern about which variable will be used. If the variable is not declared in the method, the interpreter will always try to find it as an object variable."], #[['this, $help_driver_structure_expressions_expressionvariables]]]>; var $root inited = 1; var $root managed = [$help_driver_structure_expressions_expressionvariables]; var $root owned = [$help_driver_structure_expressions_expressionvariables]; new object $help_driver_structure_expressions_operators: $help_driver_structure_expressions; var $root manager = $help_driver_structure_expressions_operators; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838772261; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "operators", "operators"]; var $help_node links = #[["ColdC", $help_coldc], ["Language Structure", $help_driver_structure], [" Expressions", $help_driver_structure_expressions], ["Data Types", $help_driver_structure_types]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_structure"]], ["Language Structure"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_structure_expressions"]], [" Expressions"], 'do_link]>, ": Operators"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, "Operators are used to perform simple operations on expression values, such as adding two values together. ", <$format, ["tt", [], ["ColdC"], 'do_tt]>, " provides a variety of operators to perform arithmetic and logical operations on data. Most of these operators fall into two syntactical categories: ", <$format, ["i", [], ["unary operators"], 'do_i]>, " and ", <$format, ["i", [], ["binary operators"], 'do_i]>, ". ", <$format, ["p", [], [], 'do_p]>, <$format, ["i", [], ["Unary operators"], 'do_i]>, " act on a single expression value. In ", <$format, ["tt", [], ["ColdC"], 'do_tt]>, ", all unary operators are single characters which precede expressions. For example, ", <$format, ["tt", [], ["!a"], 'do_tt]>, " is the logical negation of the value of the variable ", <$format, ["tt", [], ["a"], 'do_tt]>, ". ", <$format, ["p", [], [], 'do_p]>, <$format, ["i", [], ["Binary operators"], 'do_i]>, " act on two expression values. For example, ", <$format, ["tt", [], ["a + b"], 'do_tt]>, " is the sum of the values of the variables ", <$format, ["tt", [], ["a"], 'do_tt]>, " and ", <$format, ["tt", [], ["b"], 'do_tt]>, ". ", <$format, ["p", [], [], 'do_p]>, "Several operators or values are neither unary nor binary. ", <$format, ["subj", [["level", "3"]], ["Operator Precedence"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, "It is easy to write an expression whose order of evaluation is unclear. For instance, the expression ", <$format, ["tt", [], ["a - b + c"], 'do_tt]>, " could be parsed as ", <$format, ["tt", [], ["(a - b) + c"], 'do_tt]>, " or as ", <$format, ["tt", [], ["a - (b + c)"], 'do_tt]>, ". To resolve these conflicts, each operator has two properties: ", <$format, ["i", [], ["precedence"], 'do_i]>, " and ", <$format, ["i", [], ["association"], 'do_i]>, ". ", <$format, ["p", [], [], 'do_p]>, <$format, ["i", [], ["Precedence"], 'do_i]>, " determines whether an operator binds more tightly than another operator; for instance, ", <$format, ["tt", [], ["a + b * c"], 'do_tt]>, " is equivalent to ", <$format, ["tt", [], ["a + (b * c)"], 'do_tt]>, " because multiplication has higher precedence than addition. ", <$format, ["p", [], [], 'do_p]>, <$format, ["i", [], ["Association"], 'do_i]>, " determines whether operators at the same precedence level associate left to right or right to left; ", <$format, ["tt", [], ["a - b - c"], 'do_tt]>, " is equivalent to ", <$format, ["tt", [], ["(a - b) - c"], 'do_tt]>, " because subtraction associates left to right. ", <$format, ["p", [], [], 'do_p]>, "Here is a list of operators grouped by precedence, in order from highest precedence to lowest: ", <$format, ["dfn", [], [<$format, ["quote", [], ["\n\n []\n .\n -- ++\n ! and unary -\n * / %\n + -\n == != > >= < <=\n in\n &&\n ||\n ?|\n = += -= /= *=\n\n"], 'do_quote]>], 'do_dfn]>, " All operators associate from left to right except the ", <$format, ["tt", [], ["&&"], 'do_tt]>, ", ", <$format, ["tt", [], ["||"], 'do_tt]>, ", and ", <$format, ["tt", [], ["?|"], 'do_tt]>, " operators, which associate from right to left. You can always use parentheses (", <$format, ["tt", [], ["`('"], 'do_tt]>, " and ", <$format, ["tt", [], ["`)'"], 'do_tt]>, ") to specify the order of evaluation explicitly. ", <$format, ["subj", [["level", "3"]], ["Assignment Operator"], 'do_subj]>, " The assignment operator evaluates an expression and assigns the value to a variable. The syntax of the assignment expression is: ", <$format, ["dfn", [], [<$format, ["quote", [], ["\n\nvariable = expression\n\n"], 'do_quote]>], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, "The interpreter assigns the value of ", <$format, ["i", [], ["expression"], 'do_i]>, " to ", <$format, ["i", [], ["variable"], 'do_i]>, ". ", <$format, ["subj", [["level", "3"]], ["Arithmetic Operators"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, <$format, ["tt", [], ["ColdC"], 'do_tt]>, " provides seven operators for doing arithmetic, two unary operators and five binary operators. These operators apply primarily to integers and floats, but the addition operator also applies to strings. Using these operators on inappropriate data is an error of type ", <$format, ["tt", [], ["~type"], 'do_tt]>, ". ", <$format, ["p", [], [], 'do_p]>, "The unary ", <$format, ["tt", [], ["-"], 'do_tt]>, " operator takes the negative of an numeric value. The expression ", <$format, ["tt", [], ["-(3 + 4)"], 'do_tt]>, " has the value ", <$format, ["tt", [], ["-7"], 'do_tt]>, ". The unary ", <$format, ["tt", [], ["+"], 'do_tt]>, " operator has no effect on its argument, and is provided only for completeness. ", <$format, ["p", [], [], 'do_p]>, "The binary operator ", <$format, ["tt", [], ["*"], 'do_tt]>, " performs multiplication on its arguments. The expression ", <$format, ["tt", [], ["(3 * 4)"], 'do_tt]>, " has the value ", <$format, ["tt", [], ["12"], 'do_tt]>, ". The binary operators ", <$format, ["tt", [], ["/"], 'do_tt]>, " and ", <$format, ["tt", [], ["%"], 'do_tt]>, " perform division and modulus, respectively, on their arguments. The expressions ", <$format, ["tt", [], ["(13 / 5)"], 'do_tt]>, " and ", <$format, ["tt", [], ["(13 % 5)"], 'do_tt]>, " have the values ", <$format, ["tt", [], ["2"], 'do_tt]>, " and ", <$format, ["tt", [], ["3"], 'do_tt]>, " respectively. ", <$format, ["p", [], [], 'do_p]>, "The binary operators ", <$format, ["tt", [], ["+"], 'do_tt]>, " and ", <$format, ["tt", [], ["-"], 'do_tt]>, " perform addition and subtraction. The expressions ", <$format, ["tt", [], ["(3 + 4)"], 'do_tt]>, " and ", <$format, ["tt", [], ["(3 - 4)"], 'do_tt]>, " have the values ", <$format, ["tt", [], ["7"], 'do_tt]>, " and ", <$format, ["tt", [], ["-1"], 'do_tt]>, " respectively. The binary ", <$format, ["tt", [], ["+"], 'do_tt]>, " operator can also apply to strings and lists, in which case it performs concatenation; the expression ", <$format, ["tt", [], ["(\"foo\" + \"bar\")"], 'do_tt]>, " has the value ", <$format, ["tt", [], ["\"foobar\""], 'do_tt]>, ", and the expression ", <$format, ["tt", [], ["([\"foo\", \"bar\"] + [\"baz\"])"], 'do_tt]>, " has the value ", <$format, ["tt", [], ["[\"foo\", \"bar\", \"baz\"]"], 'do_tt]>, ". Furthermore, applying the binary ", <$format, ["tt", [], ["+"], 'do_tt]>, " operator with the string as one value, and any other data type as the other value will result in the literal representation of that value being concatenated with the string. For instance, ", <$format, ["tt", [], ["\"list: \" + [1, 2, 3, 4]"], 'do_tt]>, " has the value ", <$format, ["tt", [], ["\"list: [1, 2, 3, 4]\""], 'do_tt]>, ". ", <$format, ["p", [], [], 'do_p]>, "If both sides of a binary arithmetic expression are integers, the result will always be an integer, even if it could be a float. If one side of the expression is a float, the result will always be a float. For instance, ", <$format, ["tt", [], ["3 / 2"], 'do_tt]>, " (both integers) would result in ", <$format, ["tt", [], ["1"], 'do_tt]>, ", whereas ", <$format, ["tt", [], ["3 / 2.0"], 'do_tt]>, " would result in ", <$format, ["tt", [], ["1.500000"], 'do_tt]>, ". ", <$format, ["subj", [["level", "3"]], ["Logical Operators"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, <$format, ["tt", [], ["ColdC"], 'do_tt]>, " provides a number of relational and logical operators. These operators are primarily useful for expressing conditions, since they return either true or false, represented by the integers ", <$format, ["tt", [], ["1"], 'do_tt]>, " and ", <$format, ["tt", [], ["0"], 'do_tt]>, ". ", <$format, ["p", [], [], 'do_p]>, "The ", <$format, ["tt", [], ["=="], 'do_tt]>, " and ", <$format, ["tt", [], ["!="], 'do_tt]>, " operators test for equality and inequality, respectively, of their arguments. Two pieces of data are equal if they have the same type and contain the same value. Equality of strings is not case-sensitive, but equality of symbols is, so ", <$format, ["tt", [], ["(\"foo\" == \"fOo\")"], 'do_tt]>, " is true, but ", <$format, ["tt", [], ["('car == 'CAr)"], 'do_tt]>, " is false. Lists are equal if all of their elements are equal. ", <$format, ["p", [], [], 'do_p]>, "The ", <$format, ["tt", [], ["<"], 'do_tt]>, ", ", <$format, ["tt", [], ["<="], 'do_tt]>, ", ", <$format, ["tt", [], [">="], 'do_tt]>, ", and ", <$format, ["tt", [], [">"], 'do_tt]>, " operators test whether their left-hand arguments are less than, less than or equal to, greater than or equal to, or greater than their right-hand arguments, respectively. Arguments to these operators must both be of the same type, and must be of integer, string, or objnum type. String comparison is not case-sensitive, so ", <$format, ["tt", [], ["(\"fooa\" > \"fooB\")"], 'do_tt]>, " is true, even though the ASCII value of ", <$format, ["tt", [], ["`a'"], 'do_tt]>, " is greater than that of ", <$format, ["tt", [], ["`B'"], 'do_tt]>, ". ", <$format, ["p", [], [], 'do_p]>, "The unary ", <$format, ["tt", [], ["!"], 'do_tt]>, " operator tests whether its argument is false, thus acting as a logical not operation. ", <$format, ["p", [], [], 'do_p]>, "The operators ", <$format, ["tt", [], ["+="], 'do_tt]>, ", ", <$format, ["tt", [], ["-="], 'do_tt]>, ", ", <$format, ["tt", [], ["/="], 'do_tt]>, " and ", <$format, ["tt", [], ["*="], 'do_tt]>, " are a combination of the respective arithmetic operator and an assignment operator. Using these operators will first perform the arithmetic operation (such as addition)--with the left value being the variable and the right value being an expression--and will then assign the result back to the variable. The arithmetic operators will function the same as their regular counterparts. Examples (the variable ", <$format, ["i", [], ["this"], 'do_i]>, " will be assumed to start at an integer value of 10): ", <$format, ["dfn", [], [<$format, ["quote", [], ["\n\nthis += 15;\n=> 25\n\nthis += \" total\";\n=> \"10 total\"\n\nthis /= 2;\n=> 5\n\nthis *= 2;\n=> 20\n\n"], 'do_quote]>], 'do_dfn]>, " ", <$format, ["subj", [["level", "3"]], ["Conditional Operators"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, "The ", <$format, ["tt", [], ["||"], 'do_tt]>, " and ", <$format, ["tt", [], ["&&"], 'do_tt]>, " operators act as logical OR and AND operators, respectively. The expression ", <$format, ["tt", [], ["(this || that)"], 'do_tt]>, " is equivalent to ", <$format, ["i", [], ["this OR that"], 'do_i]>, ", where the return value of the expression is ", <$format, ["i", [], ["this"], 'do_i]>, " if ", <$format, ["i", [], ["this"], 'do_i]>, " is logically true. If ", <$format, ["i", [], ["this"], 'do_i]>, " is not logically true then the return value of the expression is ", <$format, ["i", [], ["that"], 'do_i]>, ". ", <$format, ["p", [], [], 'do_p]>, "The expression ", <$format, ["tt", [], ["(this && that)"], 'do_tt]>, " is equivalent to ", <$format, ["i", [], ["this AND that"], 'do_i]>, ", where the return value of the expression is logically true when both ", <$format, ["i", [], ["this"], 'do_i]>, " and ", <$format, ["i", [], ["that"], 'do_i]>, " are also logically true. If either ", <$format, ["i", [], ["this"], 'do_i]>, " or ", <$format, ["i", [], ["that"], 'do_i]>, " are not logically true then the return value is false. ", <$format, ["p", [], [], 'do_p]>, <$format, ["tt", [], ["ColdC"], 'do_tt]>, "'s conditional operators are ", <$format, ["i", [], ["short-circuit operators"], 'do_i]>, ", meaning that the right-hand argument is never evaluated if the left-hand argument is sufficient to determine the value of the expression. This is important if the right-hand argument has side-effects or could cause an error. For instance, because of this it is possible to have the following expression: ", <$format, ["dfn", [], [<$format, ["quote", [], ["\n\n(| dict[key] |) || throw(~keynf, \"Key \" + key + \" is not in the dictionary.\");\n\n"], 'do_quote]>], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, "With this expression if ", <$format, ["i", [], ["key"], 'do_i]>, " is in the dictionary ", <$format, ["i", [], ["dict"], 'do_i]>, " then the return value is the related value to ", <$format, ["i", [], ["key"], 'do_i]>, ". If it is not, the error ", <$format, ["tt", [], ["~keynf"], 'do_tt]>, " is thrown by the index operator (", <$format, ["tt", [], ["[]"], 'do_tt]>, "). However, the expression is a ", <$format, ["i", [], ["critical expression"], 'do_i]>, ". Because of this the left value becomes ", <$format, ["i", [], ["~keynf"], 'do_i]>, ", which is logically false, and the interpreter moves onto the throw function. ", <$format, ["p", [], [], 'do_p]>, "The ", <$format, ["tt", [], ["?|"], 'do_tt]>, " operator is a trinary operator, with the following syntax: ", <$format, ["dfn", [], [<$format, ["quote", [], ["\n\ncondition ? true-expr | false-expr\n\n"], 'do_quote]>], 'do_dfn]>, "The result of this expression is the result of ", <$format, ["i", [], ["true-expr"], 'do_i]>, " if ", <$format, ["i", [], ["condition"], 'do_i]>, " is true, or the result of ", <$format, ["i", [], ["false-expr"], 'do_i]>, " if ", <$format, ["i", [], ["condition"], 'do_i]>, " is false. See section ", <$format, ["link", [["node", "$help_driver_structure_types"]], ["Data Types"], 'do_link]>, " for the definition of truth for ", <$format, ["tt", [], ["ColdC"], 'do_tt]>, " data."], #[['this, $help_driver_structure_expressions_operators]]]>; var $root inited = 1; var $root managed = [$help_driver_structure_expressions_operators]; var $root owned = [$help_driver_structure_expressions_operators]; new object $help_driver_structure_expressions_callingfunctions: $help_driver_structure_expressions; var $root manager = $help_driver_structure_expressions_callingfunctions; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838772261; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "calling functions", "calling functions"]; var $help_node links = #[["ColdC", $help_coldc], ["Language Structure", $help_driver_structure], [" Expressions", $help_driver_structure_expressions], ["A Note on Conventions", $help_driver_convention], ["Function/Method Reference", $help_functions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_structure"]], ["Language Structure"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_structure_expressions"]], [" Expressions"], 'do_link]>, ": Calling functions"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, "Functions are driver-defined procedures which perform a certain action which ColdC is incapable of (such as opening a network connection), or which the driver can handle more efficiently. A function is called using the ", <$format, ["i", [], ["function call expression"], 'do_i]>, ", which has the following syntax: ", <$format, ["dfn", [], [" ", <$format, ["quote", [], ["\n\nfunction(arg1, arg2, ...)\n\n"], 'do_quote]>, " "], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, <$format, ["i", [], ["function"], 'do_i]>, " is an identifier naming the function, and ", <$format, ["i", [], ["arg1"], 'do_i]>, ", ", <$format, ["i", [], ["arg2"], 'do_i]>, ", ", <$format, ["i", [], ["..."], 'do_i]>, " are expressions. There do not have to be any arguments, but you must include the parentheses even if there are no arguments. The arguments are evaluated from left to right. ", <$format, ["p", [], [], 'do_p]>, "As an example, the ", <$format, ["tt", [], ["pad()"], 'do_tt]>, " function pads a string argument with spaces to a certain length. When evaluated with the string \"foo\" and a length of six characters: ", <$format, ["dfn", [], [<$format, ["quote", [], ["\n\npad(\"foo\", 6)\n=> \"foo \"\n\n"], 'do_quote]>], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, "Note: to better undestand the above example, read ", <$format, ["link", [["node", "$help_driver_convention"]], ["A Note on Conventions"], 'do_link]>, ". ", <$format, ["p", [], [], 'do_p]>, "There are driver functions available for a variety of tasks. A comprehensive explanation of the available functions is available in the section ", <$format, ["link", [["node", "$help_driver_functions"]], ["Function/Method Reference"], 'do_link]>, "."], #[['this, $help_driver_structure_expressions_callingfunctions]]]>; var $root inited = 1; var $root managed = [$help_driver_structure_expressions_callingfunctions]; var $root owned = [$help_driver_structure_expressions_callingfunctions]; new object $help_driver_structure_expressions_callingmethods: $help_driver_structure_expressions; var $root manager = $help_driver_structure_expressions_callingmethods; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838772261; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "calling methods", "calling methods"]; var $help_node links = #[["ColdC", $help_coldc], ["Language Structure", $help_driver_structure], [" Expressions", $help_driver_structure_expressions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_structure"]], ["Language Structure"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_structure_expressions"]], [" Expressions"], 'do_link]>, ": Calling Methods"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, "Methods defined on an object can be executed with the ", <$format, ["i", [], ["method-call expression"], 'do_i]>, ", which has the following syntax: ", <$format, ["dfn", [], [<$format, ["quote", [], ["\n\nreceiver.method(arg1, arg2, ...)\n\n"], 'do_quote]>], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, "You may omit ", <$format, ["i", [], ["receiver"], 'do_i]>, ", in which case it is assumed to be the current object. If ", <$format, ["i", [], ["receiver"], 'do_i]>, " is not an object or frob data type, the interpreter will first attempt to lookup an object name using the data type's symbol name. If an object exists with that name, the method is called on that object. If not, or if receiver is an object which does not exist in the database, the error ", <$format, ["tt", [], ["~objnf"], 'do_tt]>, " is thrown. Otherwise, if ", <$format, ["i", [], ["receiver"], 'do_i]>, " is an object, then the method is called on the object. The result is the value returned by the method. If the method does not return a value, the result is ", <$format, ["i", [], ["receiver"], 'do_i]>, ". If ", <$format, ["i", [], ["receiver"], 'do_i]>, " is a frob, then the called on the frob's class object, with the frob's representation inserted as the first argument (other arguments are placed after the representation). ", <$format, ["p", [], [], 'do_p]>, <$format, ["i", [], ["method"], 'do_i]>, " must be either the name of the method, or an expression which results in a symbol for the name of the method. If ", <$format, ["i", [], ["method"], 'do_i]>, " cannot be found on ", <$format, ["i", [], ["receiver"], 'do_i]>, " or any of ", <$format, ["i", [], ["receiver"], 'do_i]>, "'s ancestors, then the error ", <$format, ["tt", [], ["~methodnf"], 'do_tt]>, " is thrown. ", <$format, ["p", [], [], 'do_p]>, <$format, ["i", [], ["arg1"], 'do_i]>, ", ", <$format, ["i", [], ["arg2"], 'do_i]>, ", ", <$format, ["i", [], ["..."], 'do_i]>, " are the arguments for the method. Arguments are evaluated from left to right, as with function arguments. You must include the parentheses around the argument list, even if there are no arguments. ", <$format, ["p", [], [], 'do_p]>, "Here are some examples of method-call expressions: ", <$format, ["dfn", [], [<$format, ["quote", [], ["\n\n.tell(\"I don't see that here.\");\n=> $lynx\n\n$sys.admins();\n=> [$lynx, $dancer, $jenner]\n\n([1, 2, 3]).reverse()\n=> [3, 2, 1]\n\n$parser.(tosym(what + \"_mesg\"))(messages)\n=> $parser\n\n(<$thing_frob, #[['myname, \"coins\"], ['amount, 300]]>).name()\n=> \"300 coins\"\n\n"], 'do_quote]>], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, "In order to prevent incidents of infinite recursion, there is a maximum calling depth for methods. If calling a method would exceed the maximum calling depth, the error ", <$format, ["tt", [], ["~maxdepth"], 'do_tt]>, " is thrown. ", <$format, ["subj", [["level", "3"]], ["Calling an Overridden Method"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, "If a method overrides another method defined on an ancestor, the overriding method can call the overridden method using the function ", <$format, ["tt", [], ["pass()"], 'do_tt]>, ". Arguments to ", <$format, ["tt", [], ["pass()"], 'do_tt]>, " are sent to the overridden method as if the method were called normally. The return value of ", <$format, ["tt", [], ["pass()"], 'do_tt]>, " is the normal return value of the overridden method. ", <$format, ["p", [], [], 'do_p]>, "For instance, passing to an overridden method with: ", <$format, ["dfn", [], [<$format, ["quote", [], ["\n\npass(\"this arg\", 2);\n"], 'do_quote]>, " "], 'do_dfn]>, " Would be rougly equivalent to calling the same method, if it was not overridden, with: ", <$format, ["dfn", [], [<$format, ["quote", [], ["\n\nobj.method(\"this arg\", 2);\n"], 'do_quote]>, " "], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, "When executed in this manner, the overridden method sees the same object, sender, and caller as the current method."], #[['this, $help_driver_structure_expressions_callingmethods]]]>; var $root inited = 1; var $root managed = [$help_driver_structure_expressions_callingmethods]; var $root owned = [$help_driver_structure_expressions_callingmethods]; new object $help_driver_structure_expressions_errorhandling: $help_driver_structure_expressions; var $root manager = $help_driver_structure_expressions_errorhandling; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838772262; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "error handling", "error handling"]; var $help_node links = #[["ColdC", $help_coldc], ["Language Structure", $help_driver_structure], [" Expressions", $help_driver_structure_expressions], ["Errors", $help_driver_errors]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_structure"]], ["Language Structure"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_structure_expressions"]], [" Expressions"], 'do_link]>, ": Error Handling"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, "Two mechanisms exist for handling errors in expressions. These are the ", <$format, ["i", [], ["critical expression"], 'do_i]>, " and the ", <$format, ["i", [], ["propagation expression"], 'do_i]>, ". The ", <$format, ["i", [], ["critical expression"], 'do_i]>, " allows you to ignore errors which occur inside an expression. It has the following syntax: ", <$format, ["dfn", [], [<$format, ["quote", [], ["\n\n(| expression |)\n\n"], 'do_quote]>], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, "If an error occurs in ", <$format, ["i", [], ["expression"], 'do_i]>, " the interpreter will stop evaluating ", <$format, ["i", [], ["expression"], 'do_i]>, " and continue to execute the current method as if it had succeeded evaluating ", <$format, ["i", [], ["expression"], 'do_i]>, ". The value of ", <$format, ["i", [], ["expression"], 'do_i]>, " will be the error code for the error which occurred. } ", <$format, ["p", [], [], 'do_p]>, "The ", <$format, ["i", [], ["propagation expression"], 'do_i]>, " allows you to indicate that any errors which occur inside an expression are the responsibility of the calling routine. It has the following syntax: ", <$format, ["dfn", [], [<$format, ["quote", [], ["\n\n(> expression <)\n\n"], 'do_quote]>], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, "If an error occurs in ", <$format, ["i", [], ["expression"], 'do_i]>, " it will propagate to the calling method as if the error had originated in the calling method and not in the current method. Otherwise, the calling method will receive the error as ", <$format, ["tt", [], ["~methoderr"], 'do_tt]>, ". ", <$format, ["p", [], [], 'do_p]>, "Critical expressions override the behavior of catch statements so that errors which occur within critical expressions do not trigger catch error handlers. Propagation expressions do not override critical expressions or catch statements, however. They do not prevent errors from being caught; they only determine how errors propagate if they are not caught. ", <$format, ["p", [], [], 'do_p]>, "For more information on handling errors, see section ", <$format, ["link", [["node", "$help_driver_errors"]], ["Errors"], 'do_link]>, "."], #[['this, $help_driver_structure_expressions_errorhandling]]]>; var $root inited = 1; var $root managed = [$help_driver_structure_expressions_errorhandling]; var $root owned = [$help_driver_structure_expressions_errorhandling]; new object $help_driver_structure_expressions_splicing: $help_driver_structure_expressions; var $root manager = $help_driver_structure_expressions_splicing; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838772262; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "splicing", "splicing"]; var $help_node links = #[["ColdC", $help_coldc], ["Language Structure", $help_driver_structure], [" Expressions", $help_driver_structure_expressions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_structure"]], ["Language Structure"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_structure_expressions"]], [" Expressions"], 'do_link]>, ": Splicing"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, "Whenever you are writing an argument list or a list constructor expression you can splice a list value into the sequence of expressions by prepending a list expression with ", <$format, ["tt", [], ["`@'"], 'do_tt]>, ". For example: ", <$format, ["dfn", [], [<$format, ["quote", [], ["\n\n['foo, @[1, 2, 3], 'quux]\n=> ['foo, 1, 2, 3, 'quux]\n\n"], 'do_quote]>], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, "You can use the splicing operator when sending arguments: ", <$format, ["dfn", [], [<$format, ["quote", [], ["\n\n$string.do_something(this, that, @others);\n\n"], 'do_quote]>], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, "The splicing operator is not listed in the operator precedence list. This is because it is meaningless to talk about, for example, adding a spliced list to another value. Using the splicing operator never causes an ambiguity."], #[['this, $help_driver_structure_expressions_splicing]]]>; var $root inited = 1; var $root managed = [$help_driver_structure_expressions_splicing]; var $root owned = [$help_driver_structure_expressions_splicing]; new object $help_driver_structure_expressions_loopingexpressions: $help_driver_structure_expressions; var $root manager = $help_driver_structure_expressions_loopingexpressions; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838937450; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "looping expressions", "looping expressions"]; var $help_node links = #[["ColdC", $help_coldc], ["Language Structure", $help_driver_structure], [" Expressions", $help_driver_structure_expressions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_structure"]], ["Language Structure"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_structure_expressions"]], [" Expressions"], 'do_link]>, ": Looping Expressions"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, " Cold offers several expressions that enable looping through lists, dictionaries or integer ranges. Their main advantages over looping statements are brevity and preallocating of lists/dictionaries they return (for greater speed). ", <$format, ["dfn", [], [<$format, ["quote", [], ["\n\nmap var in (what) to (expression)\nmap var in [lower .. upper] to (expression)\n"], 'do_quote]>], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, <$format, ["tt", [], ["map"], 'do_tt]>, " operator loops a variable through a list or dictionary (a result from evaluation of (what)) or through the integer range, evaluating expression as it goes. Results are collected into a list that is returned. ", <$format, ["p", [], [], 'do_p]>, "Examples: ", <$format, ["dfn", [], [<$format, ["quote", [], ["\n>;var x; return map x in ([1, 2, 3]) to (tostr(x));\n=> [\"1\", \"2\", \"3\"]\n[ ticks: 55 seconds: 0.000941 ]\n>;var x; return map x in [5 .. 15] to (x);\n=> [5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]\n[ ticks: 69 seconds: 0.000894 ]\n"], 'do_quote]>], 'do_dfn]>, " ", <$format, ["dfn", [], [<$format, ["quote", [], ["\n\nhash var in (what) to (expression)\nhash var in [lower .. upper] to (expression)\n"], 'do_quote]>], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, <$format, ["tt", [], ["hash"], 'do_tt]>, " operator is similar to map, except that it returns a dictionary instead. expression must evaluate to a list of length 2 for each value of the variable. Examples: ", <$format, ["dfn", [], [<$format, ["quote", [], ["\n>;var x; return hash x in ([1, 2, 3]) to ([toobjnum(x).name(), x]);\n=> #[[\"$root\", 1], [\"Brandon\", 2], [\"Dancer\", 3]]\n[ ticks: 111 seconds: 0.001740 ]\n>;var x; return hash x in [1 .. 3] to ([toobjnum(x).name(), x]);\n=> #[[\"$root\", 1], [\"Brandon\", 2], [\"Dancer\", 3]]\n[ ticks: 107 seconds: 0.004141 ]\n"], 'do_quote]>], 'do_dfn]>, " ", <$format, ["dfn", [], [<$format, ["quote", [], ["\n\nfind var in (what) where (expression)\nfind var in [lower .. upper] where (expression)\n"], 'do_quote]>], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, <$format, ["tt", [], ["find"], 'do_tt]>, " operator returns the lowest index in (what) or the first integer from the range for which expression evaluates to true. It is useful as a shorthand for grepping or matching where logical conditions are not too complicated. To return the actual value of the variable var, you can simply use that value after find is done, or use ranged loop like in the example. Find will return 0 on failure (which can cause bugs if 0 is a valid value in the range). ", <$format, ["dfn", [], [<$format, ["quote", [], ["\n>;var x, lines; lines=[\"First line\",\"second line\",\"3rd line\"]; return find\n x in (lines) where (x.match_regexp(\"co\"));\n=> 2\n[ ticks: 55 seconds: 0.001071 ]\n>;var x, lines; lines=[\"First line\",\"second line\",\"3rd line\"]; return\n lines[find x in [1 .. lines.length()] where (lines[x].match_regexp(\"co\"))];\n=> \"second line\"\n[ ticks: 63 seconds: 0.001099 ]\n"], 'do_quote]>], 'do_dfn]>, " ", <$format, ["dfn", [], [<$format, ["quote", [], ["\n\nfilter var in (what) where (expression)\nfilter var in [lower .. upper] where (expression)\n"], 'do_quote]>], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, <$format, ["tt", [], ["filter"], 'do_tt]>, " expression returns a list of values of the variable for which expression evaluated to true. Its usage is roughly similar to grep in Perl. Example: ", <$format, ["dfn", [], [<$format, ["quote", [], ["\n>;var x, lines; lines=[\"First line\",\"second line\",\"3rd line\"]; return filter x in (lines) where (x.match_regexp(\"co\"));\n=> [\"second line\"]\n[ ticks: 61 seconds: 0.001084 ]\n>;var x, lines; lines=[\"First line\",\"second line\",\"3rd line\"]; return filter x in [1 .. lines.length()] where (lines[x].match_regexp(\"co\"));\n=> [2]\n[ ticks: 69 seconds: 0.001172 ]\n"], 'do_quote]>], 'do_dfn]>], #[['this, $help_driver_structure_expressions_loopingexpressions]]]>; var $root inited = 1; var $root managed = [$help_driver_structure_expressions_loopingexpressions]; var $root owned = [$help_driver_structure_expressions_loopingexpressions]; new object $help_driver_structure_statements: $help_driver_structure; var $root manager = $help_driver_structure_statements; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611423; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "statements", "statements"]; var $help_node links = #[["ColdC", $help_coldc], ["Language Structure", $help_driver_structure], ["Simple Statements", $help_driver_structure_statements_simplestatements], ["Conditional Statements", $help_driver_structure_statements_conditionalstatements], ["Looping statements", $help_driver_structure_statements_loopingstatements], ["Error-handling statements", $help_driver_structure_statements_errorhandlingstatements]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_structure"]], ["Language Structure"], 'do_link]>, ": Statements"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, <$format, ["em", [], ["Statements"], 'do_em]>, " are instructions to the interpreter. Statements can be simple (such as comments), or they can be complex (such as loops and conditionals). However, most statement types in ColdC have simple structures. Because statements can include other statements, you can use these simple statement types to build complex directives. ", <$format, ["p", [], [], 'do_p]>, "The following sections describe simple statements, which perform simple actions once, conditional statements, which perform different actions depending on the value of an expression, looping statements, which perform an action multiple times, and error-handling statements, which affect how the interpreter handles error conditions. ", <$format, ["subj", [["level", "3"]], ["Statement types"], 'do_subj]>, " ", <$format, ["ul", [], [" ", <$format, ["li", [], [<$format, ["link", [["node", "$help_driver_structure_statements_simplestatements"]], ["Simple Statements"], 'do_link]>], 'do_li]>, " ", <$format, ["li", [], [<$format, ["link", [["node", "$help_driver_structure_statements_conditionalstatements"]], ["Conditional Statements"], 'do_link]>], 'do_li]>, " ", <$format, ["li", [], [<$format, ["link", [["node", "$help_driver_structure_statements_loopingstatements"]], ["Looping statements"], 'do_link]>], 'do_li]>, " ", <$format, ["li", [], [<$format, ["link", [["node", "$help_driver_structure_statements_errorhandlingstatements"]], ["Error-handling statements"], 'do_link]>], 'do_li]>], 'do_ul]>], #[['this, $help_driver_structure_statements]]]>; var $root inited = 1; var $root managed = [$help_driver_structure_statements]; var $root owned = [$help_driver_structure_statements]; new object $help_driver_structure_statements_simplestatements: $help_driver_structure_statements; var $root manager = $help_driver_structure_statements_simplestatements; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838934831; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "simple statements", "simple statements"]; var $help_node links = #[["ColdC", $help_coldc], ["Language Structure", $help_driver_structure], ["Statements", $help_driver_structure_statements]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_structure"]], ["Language Structure"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_structure_statements"]], ["Statements"], 'do_link]>, ": Simple Statements"], 'do_subj]>, " ", <$format, ["subj", [["level", "3"]], [<$format, ["i", [], ["comment statement"], 'do_i]>], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, "The ", <$format, ["em", [], ["comment statement"], 'do_em]>, " does nothing at all. A comment statement is just a comment token, which is a sequence of two slashes (", <$format, ["tt", [], ["`//'"], 'do_tt]>, ") followed by any characters up to the end of the lines. For instance: ", <$format, ["dfn", [], [<$format, ["quote", [], ["\n\n// This is a comment.\n\n"], 'do_quote]>], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, "The interpreter ignores comment statements completely; they are for the benefit of human readers. Note that comments in ColdC are actual statements, unlike comments in ", <$format, ["tt", [], ["C"], 'do_tt]>, ", which are filtered out by the preprocessor. ", <$format, ["subj", [["level", "3"]], [<$format, ["i", [], ["expression statement"], 'do_i]>], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, "The ", <$format, ["em", [], ["expression statement"], 'do_em]>, " evaluates an expression and discards its value. The syntax of the expression statement is: ", <$format, ["dfn", [], [<$format, ["quote", [], ["\n\nexpression;\n\n"], 'do_quote]>], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, "The following are expression statements: ", <$format, ["dfn", [], [<$format, ["quote", [], ["\n\n3;\nsender().tell($sys.who());\n\n"], 'do_quote]>], 'do_dfn]>, " ", <$format, ["subj", [["level", "3"]], [<$format, ["i", [], ["compound statement"], 'do_i]>], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, "The ", <$format, ["em", [], ["compound statement"], 'do_em]>, " allows you to treat one or more statements as a single statement. The compound statement has the following syntax: ", <$format, ["dfn", [], [<$format, ["quote", [], ["\n\n{\n statement1\n statement2\n .\n .\n .\n}\n\n"], 'do_quote]>], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, "The interpreter executes each of ", <$format, ["i", [], ["statement1"], 'do_i]>, ", ", <$format, ["i", [], ["statement2"], 'do_i]>, ", ", <$format, ["i", [], ["..."], 'do_i]>, " in turn. ", <$format, ["subj", [["level", "3"]], [<$format, ["i", [], ["return statement"], 'do_i]>], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, "The ", <$format, ["em", [], ["return statement"], 'do_em]>, " allows a method to stop exeuting statements and to return a value other than the default return value of ", <$format, ["tt", [], ["this()"], 'do_tt]>, ". The return statement can have either of the following two forms: ", <$format, ["dfn", [], [<$format, ["quote", [], ["\n\nreturn expression;\nreturn;\n\n"], 'do_quote]>], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, "The interpreter stops executing statements in the method and returns the value of ", <$format, ["i", [], ["expression"], 'do_i]>, ", or the objnum of the current object if ", <$format, ["i", [], ["expression"], 'do_i]>, " is not given."], #[['this, $help_driver_structure_statements_simplestatements]]]>; var $root inited = 1; var $root managed = [$help_driver_structure_statements_simplestatements]; var $root owned = [$help_driver_structure_statements_simplestatements]; new object $help_driver_structure_statements_conditionalstatements: $help_driver_structure_statements; var $root manager = $help_driver_structure_statements_conditionalstatements; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838934831; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "conditional statements", "conditional statements"]; var $help_node links = #[["ColdC", $help_coldc], ["Language Structure", $help_driver_structure], ["Statements", $help_driver_structure_statements], ["Data Types", $help_driver_structure_types]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_structure"]], ["Language Structure"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_structure_statements"]], ["Statements"], 'do_link]>, ": Conditional Statements"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, "There are three types of conditional statements in ColdC. The ", <$format, ["subj", [["level", "3"]], ["if statement"], 'do_subj]>, " ", <$format, ["em", [], ["if statement"], 'do_em]>, " has the following syntax: ", <$format, ["dfn", [], [<$format, ["quote", [], ["\n\nif (expression)\n statement\n\n"], 'do_quote]>], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, "The interpreter evaluates ", <$format, ["i", [], ["expression"], 'do_i]>, ". If the value of ", <$format, ["i", [], ["expression"], 'do_i]>, " is true (see section ", <$format, ["link", [["node", "$help_driver_structure_types"]], ["Data Types"], 'do_link]>, "), then the interpreter executes ", <$format, ["i", [], ["statement"], 'do_i]>, ". ", <$format, ["subj", [["level", "3"]], [<$format, ["i", [], ["if-else statement"], 'do_i]>], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, "The ", <$format, ["em", [], ["if-else statement"], 'do_em]>, " is similar to the if statement. The if-else statement has the following syntax: ", <$format, ["dfn", [], [<$format, ["quote", [], ["\n\nif (expression)\n true-statement\nelse\n false-statement\n\n"], 'do_quote]>], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, "The interpreter evaluates ", <$format, ["i", [], ["expression"], 'do_i]>, ", as before. If the value of ", <$format, ["i", [], ["expression"], 'do_i]>, " is true, then the interpreter executes ", <$format, ["i", [], ["true-statement"], 'do_i]>, "; otherwise, it executes ", <$format, ["i", [], ["false-statement"], 'do_i]>, ". ", <$format, ["p", [], [], 'do_p]>, "Because the if statement and the if-else statement are similar, they can sometimes be ambiguous. The following code will produce unexpected results: ", <$format, ["dfn", [], [<$format, ["quote", [], ["\n\nif (a)\n if (b) c;\nelse\n d;\n\n"], 'do_quote]>], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, "The indentation suggests that the ", <$format, ["tt", [], ["else"], 'do_tt]>, " clause should apply to the first ", <$format, ["tt", [], ["if"], 'do_tt]>, " clause, but in fact it applies to the more recent one. You can avoid ambiguities like this by using braces to create compound statements out of conditional and looping statements, even if there is only one of them. In this case, you might write: ", <$format, ["dfn", [], [<$format, ["quote", [], ["\n\nif (a) {\n if (b)\n c;\n} else {\n d;\n}\n\n"], 'do_quote]>], 'do_dfn]>, " ", <$format, ["subj", [["level", "3"]], ["switch statement"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, "The third type of conditional statement is the ", <$format, ["em", [], ["switch statement"], 'do_em]>, ", which allows you to compare one value against a series of other values. The switch statement is the most complicated statement type in ColdC, and does vary from it's counterpart in C, so we'll start with an example: ", <$format, ["dfn", [], [<$format, ["quote", [], ["\n\nswitch (val) {\n case 0:\n echo(\"The value is zero.\");\n case 1 .. 10:\n echo(\"The value is between one and ten inclusive.\");\n case 11 .. a:\n echo(\"The value is between eleven and a inclusive.\");\n case \"foo\", \"bar\"..\"baz\":\n echo(\"The value is \\\"foo\\\" or between \\\"bar\\\" and \\\"baz\\\"\");\n case a .. b, c .. d, 42:\n count += 1;\n echo(\"The value is in the counted area.\");\n case ~perm:\n echo(\"Permission denied while getting the value.\");\n default:\n echo(\"Did not recognize value.\");\n}\n\n"], 'do_quote]>], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, "This example illustrates all of the capabilities of the switch statement. The expression given by ", <$format, ["tt", [], ["val"], 'do_tt]>, " in the example is the ", <$format, ["em", [], ["controlling expression"], 'do_em]>, ", and is compared against each of the cases inside the switch body. Each case has a value or list of values to compare against. The values can be of any type, and need not be constant expressions. You can also specify ranges, using two dots (", <$format, ["tt", [], ["`..'"], 'do_tt]>, ") to separate the lower and upper bounds. The keyword ", <$format, ["tt", [], ["default"], 'do_tt]>, " specifies an action to perform if no cases were matched by the controlling expression. ", <$format, ["p", [], [], 'do_p]>, "Here is a more formal description of the syntax of the switch statement: ", <$format, ["dfn", [], [<$format, ["quote", [], ["\n\nswitch (controlling-expression) {\n case expr-or-range, expr-or-range, ...:\n statements\n case expr-or-range, expr-or-range, ...:\n statements\n .\n .\n .\n default:\n default-statement\n}\n\n"], 'do_quote]>], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, "When executing a switch statement, the interpreter scans through the list of cases and compares ", <$format, ["i", [], ["controlling-expression"], 'do_i]>, " against each of the lists of values in the cases, evaluating the value lists from left to right until there is a match. The lower and upper bounds of ranges must be of the same type and must be either integers or strings, or the interpreter will throw a ", <$format, ["tt", [], ["~type"], 'do_tt]>, " error. When the interpreter finds a match, it will execute the statement for that case. The interpreter will not continue checking cases after a match. ", <$format, ["p", [], [], 'do_p]>, "If the interpreter does not find a match, it will execute ", <$format, ["i", [], ["default-statement"], 'do_i]>, ", the statement corresponding to the default case. You do not need to provide a default case if you do not wish to provide a default action. ", <$format, ["p", [], [], 'do_p]>, <$format, ["tt", [], ["C"], 'do_tt]>, " programmers should note that switch statements in ColdC differ from switch statements in ", <$format, ["tt", [], ["C"], 'do_tt]>, " in several respects. Because case values do not have to be constants, they may conflict, in which case the first match will take precedence. Also, there is no fall-through in ColdC switch statements; only the statements corresponding to the matching case will be executed. Because there is no fall-through, the ", <$format, ["tt", [], ["break"], 'do_tt]>, " statement does not apply to switch statements. Finally, the default case must be placed last in the list of cases if it is given."], #[['this, $help_driver_structure_statements_conditionalstatements]]]>; var $root inited = 1; var $root managed = [$help_driver_structure_statements_conditionalstatements]; var $root owned = [$help_driver_structure_statements_conditionalstatements]; new object $help_driver_structure_statements_loopingstatements: $help_driver_structure_statements; var $root manager = $help_driver_structure_statements_loopingstatements; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838934831; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "looping statements", "looping statements"]; var $help_node links = #[["ColdC", $help_coldc], ["Language Structure", $help_driver_structure], ["Statements", $help_driver_structure_statements], ["Data Types: Dictionaries", $help_driver_structure_types]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_structure"]], ["Language Structure"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_structure_statements"]], ["Statements"], 'do_link]>, ": Looping Statements"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, "ColdC provides three kinds of looping statements. These statements allow you to traverse a list or a range of numbers, or to execute a statement as long as a certain condition is true. ColdC also provides two kinds of jump statements which allow you to prematurely exit from a loop or continue onto the next iteration. ", <$format, ["subj", [["level", "3"]], [<$format, ["i", [], ["for-list statement"], 'do_i]>], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, "The ", <$format, ["em", [], ["for-list statement"], 'do_em]>, " allows you to traverse a list. It has the following syntax: ", <$format, ["dfn", [], [<$format, ["quote", [], ["\n\nfor variable in (what)\n statement\n\n"], 'do_quote]>], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, <$format, ["i", [], ["variable"], 'do_i]>, " must be a local variable (it cannot be an object variable), and ", <$format, ["i", [], ["what"], 'do_i]>, " must be an expression resulting in a list or dictionary type. The interpreter executes ", <$format, ["i", [], ["statement"], 'do_i]>, " once for each element in ", <$format, ["i", [], ["what"], 'do_i]>, ", assigning the value of the element to ", <$format, ["i", [], ["variable"], 'do_i]>, " during the iteration. Here is an example of using a for-list statement on a list: ", <$format, ["dfn", [], [<$format, ["quote", [], ["\n\nfor s in ([\"foo\", \"bar\", \"baz\"])\n .tell(s);\n\n"], 'do_quote]>], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, "When executed, the method ", <$format, ["i", [], ["tell"], 'do_i]>, " is called three times, the first time with an argument of ", <$format, ["tt", [], ["\"foo\""], 'do_tt]>, " (the first element in the list), the second time with ", <$format, ["tt", [], ["\"bar\""], 'do_tt]>, " (the second element in the list), and the third time with ", <$format, ["tt", [], ["\"baz\""], 'do_tt]>, " (the last element in the list). ", <$format, ["p", [], [], 'do_p]>, "When using a dictionary as ", <$format, ["i", [], ["what"], 'do_i]>, ", the interpreter assigns each association in the dictionary to ", <$format, ["i", [], ["variable"], 'do_i]>, " (see ", <$format, ["link", [["node", "$help_driver_structure_types"]], ["Data Types: Dictionaries"], 'do_link]>, "). For example, if the dictionary ", <$format, ["tt", [], ["#[['count, 21], ['name, \"foo\"]]"], 'do_tt]>, " were to be used in a for-list statement, the first iteration would set ", <$format, ["i", [], ["variable"], 'do_i]>, " to ", <$format, ["tt", [], ["['count, 21]"], 'do_tt]>, ", and the second iteration would set it to ", <$format, ["tt", [], ["['name, \"foo\"]"], 'do_tt]>, ". ", <$format, ["p", [], [], 'do_p]>, "Assigning to ", <$format, ["i", [], ["variable"], 'do_i]>, " within a for-list statement will not change the status of the loop; the interpreter remembers where it is at in ", <$format, ["i", [], ["what"], 'do_i]>, ". ", <$format, ["subj", [["level", "3"]], [<$format, ["i", [], ["for-range statement"], 'do_i]>], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, "The ", <$format, ["em", [], ["for-range statement"], 'do_em]>, " allows you to traverse a range of integers. The range is specified by seperating the lower and upper bounds of the range with the range operator (", <$format, ["tt", [], [".."], 'do_tt]>, "), contained within the left and right square brackets (", <$format, ["tt", [], ["["], 'do_tt]>, " and ", <$format, ["tt", [], ["]"], 'do_tt]>, "). A for-list statement of this nature would look like: ", <$format, ["dfn", [], [<$format, ["quote", [], ["\n\nfor variable in [lower .. upper]\n statement\n\n"], 'do_quote]>], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, <$format, ["i", [], ["lower"], 'do_i]>, " and ", <$format, ["i", [], ["upper"], 'do_i]>, " must be expressions resulting in an integer type (unlike a range in a switch). The interpreter executes ", <$format, ["i", [], ["statement"], 'do_i]>, " once for each number from ", <$format, ["i", [], ["lower"], 'do_i]>, " to ", <$format, ["i", [], ["upper"], 'do_i]>, ", with ", <$format, ["i", [], ["variable"], 'do_i]>, " being assigned the current number in the range. An example of using a range in a list follows: ", <$format, ["dfn", [], [<$format, ["quote", [], ["\n\nfor i in [1 .. 10]\n .tell(\"iteration \" + i);\n\n"], 'do_quote]>], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, "Assigning to ", <$format, ["i", [], ["variable"], 'do_i]>, " within a for-list statement will not change the status of the loop; the interpreter remembers where it is at in ", <$format, ["i", [], ["what"], 'do_i]>, ". ", <$format, ["subj", [["level", "3"]], [<$format, ["i", [], ["while statement"], 'do_i]>], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, "The ", <$format, ["em", [], ["while statement"], 'do_em]>, " allows you to execute code as long as the condition expression is true. The while statement has the following syntax: ", <$format, ["dfn", [], [<$format, ["quote", [], ["\n\nwhile (expression)\n statement\n\n"], 'do_quote]>], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, "The interpreter continually evaluates ", <$format, ["i", [], ["expression"], 'do_i]>, " and executes ", <$format, ["i", [], ["statement"], 'do_i]>, " until the return value of ", <$format, ["i", [], ["expression"], 'do_i]>, " is false. Here is an example using a while statement: ", <$format, ["dfn", [], [<$format, ["quote", [], ["\n\na = 1;\nwhile (a < 35)\n a = a * 2;\n.tell(\"total: \" + a);\n\n"], 'do_quote]>], 'do_dfn]>, " ", <$format, ["subj", [["level", "3"]], [<$format, ["i", [], ["break statement"], 'do_i]>], 'do_subj]>, " The ", <$format, ["em", [], ["break statement"], 'do_em]>, " allows you to exit a looping statement prematurely. The break statement has the following syntax: ", <$format, ["dfn", [], [<$format, ["quote", [], ["\n\nbreak;\n\n"], 'do_quote]>], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, "The interpreter jumps to the end of the ", <$format, ["em", [], ["innermost"], 'do_em]>, " for-list, for-range, or while statement. It is important to note that using the ", <$format, ["em", [], ["break statement"], 'do_em]>, " within nested looping statements only breaks out of the innermost looping statement. ", <$format, ["subj", [["level", "3"]], [<$format, ["i", [], ["continue statement"], 'do_i]>], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, "The ", <$format, ["em", [], ["continue statement"], 'do_em]>, " allows you to jump to the next iteration of a loop. The continue statement has the following syntax: ", <$format, ["dfn", [], [<$format, ["quote", [], ["\n\ncontinue;\n\n"], 'do_quote]>], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, "The interpreter skips the remainder of the loop body and begins another iteration of the innermost looping statement. As with the ", <$format, ["em", [], ["break statement"], 'do_em]>, " the ", <$format, ["em", [], ["continue statement"], 'do_em]>, " only is relevant to the innermost looping statement."], #[['this, $help_driver_structure_statements_loopingstatements]]]>; var $root inited = 1; var $root managed = [$help_driver_structure_statements_loopingstatements]; var $root owned = [$help_driver_structure_statements_loopingstatements]; new object $help_driver_structure_statements_errorhandlingstatements: $help_driver_structure_statements; var $root manager = $help_driver_structure_statements_errorhandlingstatements; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838934831; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "Error-Handling Statements", "Error-Handling Statements"]; var $help_node links = #[["ColdC", $help_coldc], ["Language Structure", $help_driver_structure], ["Statements", $help_driver_structure_statements], ["error()", $help_func_error], ["throw()", $help_func_throw], ["traceback()", $help_func_traceback], ["rethrow()", $help_func_rethrow], ["critical expressions", $help_driver_structure_expressions]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_structure"]], ["Language Structure"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_structure_statements"]], ["Statements"], 'do_link]>, ": Error-Handling Statements"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, "The ", <$format, ["em", [], ["catch statement"], 'do_em]>, " allows you to indicate how errors should be handled. This statement can be used to anticipate an error and handle it gracefully. The catch statement has the following syntax: ", <$format, ["dfn", [], [<$format, ["quote", [], ["\n\ncatch error code, error code, ...\n body-statement\nwith handler\n handler-statement\n\n"], 'do_quote]>], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, "You can substitute the keyword ", <$format, ["tt", [], ["any"], 'do_tt]>, " for the list of errors to indicate that you wish to catch all errors. You can leave out the ", <$format, ["tt", [], ["with handler"], 'do_tt]>, " and the handler statement if you do not wish to do anything in the handler. ", <$format, ["p", [], [], 'do_p]>, "If an error listed in the error list is thrown inside ", <$format, ["i", [], ["body-statement"], 'do_i]>, ", the interpreter will execute the handler rather than aborting the method. After the handler is done, control continues after the end of the catch statement, as if ", <$format, ["i", [], ["body-statement"], 'do_i]>, " had completed with no errors. ", <$format, ["p", [], [], 'do_p]>, " Inside the handler, you can use the function ", <$format, ["link", [["node", "$help_func_error"]], ["error()"], 'do_link]>, " to determine the error code which triggered the handler, the function ", <$format, ["link", [["node", "$help_func_throw"]], ["throw()"], 'do_link]>, " can be used to initiate an error, and the function ", <$format, ["link", [["node", "$help_func_traceback"]], ["traceback()"], 'do_link]>, " can be used to retrieve the propagated error stack. You can use the function ", <$format, ["link", [["node", "$help_func_rethrow"]], ["rethrow()"], 'do_link]>, " to continue propagating an error. ", <$format, ["p", [], [], 'do_p]>, "Here is an example of how you might use a catch statement to intelligently handle a ", <$format, ["tt", [], ["~methodnf"], 'do_tt]>, " error from the ", <$format, ["tt", [], ["list_method()"], 'do_tt]>, " function: ", <$format, ["dfn", [], [<$format, ["quote", [], ["\n\ncatch ~methodnf {\n code = list_method(method_name);\n} with handler {\n .tell(\"There is no method named \" + tostr(method_name) + \".\");\n}\n\n"], 'do_quote]>], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, "Note that ", <$format, ["link", [["node", "$help_driver_structure_expressions"]], ["critical expressions"], 'do_link]>, " inside ", <$format, ["i", [], ["body-statement"], 'do_i]>, " will override the behavior of the catch statement. ", <$format, ["p", [], [], 'do_p]>], #[['this, $help_driver_structure_statements_errorhandlingstatements]]]>; var $root inited = 1; var $root managed = [$help_driver_structure_statements_errorhandlingstatements]; var $root owned = [$help_driver_structure_statements_errorhandlingstatements]; new object $help_driver_structure_tokens: $help_driver_structure; var $root manager = $help_driver_structure_tokens; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611423; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "tokens", "tokens"]; var $help_node links = #[["ColdC", $help_coldc], ["Language Structure", $help_driver_structure], ["Data Types", $help_driver_structure_types]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_structure"]], ["Language Structure"], 'do_link]>, ": Tokens"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, "Tokens are the base elements of ColdC. There are many different types of tokens ranging from single characters to lines of text. The following characters and pairs of characters are tokens in ColdC: ", <$format, ["dfn", [], [" ", <$format, ["quote", [], ["\n\n{ } [ ] #[ ] `[ ] ( ) (| |) (> <)\n, ; = += -= *= /= ! - + * / % ..\n== != > >= < <= . || && ? | @ -- ++ \n\n"], 'do_quote]>, " "], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, "The above tokens are used as operators and punctuation in ColdC expressions. ", <$format, ["p", [], [], 'do_p]>, "You can use identifiers as tokens and as parts of tokens. An identifier is a sequence of alphabetic and numeric characters or underlines which does not begin with a number. Identifiers in ColdC are case-sensitive, so the identifiers ", <$format, ["tt", [], ["CAR"], 'do_tt]>, " and ", <$format, ["tt", [], ["car"], 'do_tt]>, " are not equivalent. The following are valid identifiers: ", <$format, ["dfn", [], [<$format, ["quote", [], ["\n\nwe_3_kings\nobj\na\n\n"], 'do_quote]>], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, "By themselves, identifiers usually represent variables. However, certain identifiers have special meanings to the parser. These reserved words are used in writing certain kinds of statements and expressions. They are: ", <$format, ["dfn", [], [<$format, ["quote", [], ["\n\nvar, if, else, while, for, switch, case, default, break, continue, return,\ncatch, any, with handler, pass, to, in\n\n"], 'do_quote]>], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, "There are several kinds of tokens for denoting literal expressions of various data types. These are ", <$format, ["i", [], ["integers"], 'do_i]>, ", denoted by a sequence of digits; ", <$format, ["i", [], ["strings"], 'do_i]>, ", denoted by a sequence of characters enclosed in double quotes; ", <$format, ["i", [], ["object numbers"], 'do_i]>, ", denoted by a hash mark (", <$format, ["tt", [], ["#"], 'do_tt]>, ") and a number; ", <$format, ["i", [], ["object names"], 'do_i]>, ", denoted by a dollar sign (", <$format, ["tt", [], ["$"], 'do_tt]>, ") followed by an identifier; ", <$format, ["i", [], ["symbols"], 'do_i]>, ", denoted by a single forward quote (", <$format, ["tt", [], ["'"], 'do_tt]>, ") and an identifier; and ", <$format, ["i", [], ["error codes"], 'do_i]>, ", denoted by a tilde (", <$format, ["tt", [], ["~"], 'do_tt]>, ") and an identifier. These literals are described more fully in the section ", <$format, ["link", [["node", "$help_driver_structure_types"]], ["Data Types"], 'do_link]>, "."], #[['this, $help_driver_structure_tokens]]]>; var $root inited = 1; var $root managed = [$help_driver_structure_tokens]; var $root owned = [$help_driver_structure_tokens]; new object $help_driver_structure_types: $help_driver_structure; var $root manager = $help_driver_structure_types; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838611423; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "types", "types"]; var $help_node links = #[["ColdC", $help_coldc], ["Language Structure", $help_driver_structure], ["expression", $help_driver_structure_expressions], ["type()", $help_func_type], ["Referencing Objects", $help_driver_objects_referencing], ["Errors", $help_driver_errors], ["Type comparison", $help_driver_structure_types_typecomparison]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_structure"]], ["Language Structure"], 'do_link]>, ": Data Types"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, "All ColdC data has a type and a logical truth value it will take on when evaluated as an ", <$format, ["link", [["node", "$help_driver_structure_expressions"]], ["expression"], 'do_link]>, ". The following is a list of ColdC data types along with their names and literal representation in ColdC: ", <$format, ["quote", [], ["\n\n Type Name Representation\n\n Integer 'integer 42\n Float 'float 1.0\n String 'string \"This String\"\n Symbol 'symbol 'a_symbol\n List 'list [1, 2, 3, 4]\n Object Number 'objnum #1234\n Object Name 'objname $sys\n Dictionary 'dictionary #[[\"key\", $value], [1, \"value\"]]\n Error Code 'error ~error\n Frob 'frob <object, value>\n Buffer 'buffer `[]\n\n"], 'do_quote]>, " ", <$format, ["p", [], [], 'do_p]>, "The type of data being manipulated can be determined using the ", <$format, ["link", [["node", "$help_func_type"]], ["type()"], 'do_link]>, " function. ", <$format, ["subj", [["level", "2"]], ["Integers"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, "An ", <$format, ["i", [], ["integer"], 'do_i]>, " is simply a number. Integers can reliably be from 2147483647 to -2147483648. An integer is logically true if it is not zero (negative numbers are logically true). Integers are denoted in ColdC with a series of digits, optionally preceded with a plus (", <$format, ["tt", [], ["+"], 'do_tt]>, ") or minus (", <$format, ["tt", [], ["-"], 'do_tt]>, ") sign. ", <$format, ["subj", [["level", "2"]], ["Floats"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, "A ", <$format, ["i", [], ["float"], 'do_i]>, " is simply a floating point number. A float is logically true if it is not zero. Floats are denoted in ColdC with two numbers seperated by a period and optionally preceded with a plus (", <$format, ["tt", [], ["+"], 'do_tt]>, ") or minus (", <$format, ["tt", [], ["-"], 'do_tt]>, ") sign. ", <$format, ["subj", [["level", "2"]], ["Strings"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, "A ", <$format, ["i", [], ["string"], 'do_i]>, " is a sequence of printable characters. A string is logically true if it is not empty. A string is denoted in ColdC by enclosing a sequence of printable characters within double quotes (", <$format, ["tt", [], ["\""], 'do_tt]>, "). To include a double quote inside a string precede it with a backslash. In all other instances a backslash has no special meaning. The following are some examples of strings: ", <$format, ["dfn", [], [<$format, ["quote", [], ["\n\n\"foo\"\n\"\\\"foo\\\" is a metasyntactic variable.\"\n\"The backslash (`\') is a much-abused character in many languages.\"\n\n"], 'do_quote]>], 'do_dfn]>, " ", <$format, ["subj", [["level", "2"]], ["Symbols"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, "A ", <$format, ["i", [], ["symbol"], 'do_i]>, " is a symbolic value, represented by an identifier. Symbols are denoted in ColdC by preceding the identifier with an apostrophe (", <$format, ["tt", [], ["'"], 'do_tt]>, "). When used in a lookup or matched relationship, symbols are equivalent to matching integers, whereas strings still require checking each character to verify a match. Symbols are not terminated with an apostrophe. Symbols are always logically true. ", <$format, ["subj", [["level", "2"]], ["Lists"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, "A ", <$format, ["i", [], ["list"], 'do_i]>, " is an ordered grouping of data. The data contained within a list can be of any type, and does not have to be the same througout the list. Lists are useful for manipulating several pieces of data at once. A list is logically true if it is not empty. You can construct a list value by enclosing a comma-separated series of data in square brackets; for example, ", <$format, ["tt", [], ["[1, 2, 3]"], 'do_tt]>, " and ", <$format, ["tt", [], ["[1, [\"foo\", 'bar], $sys]"], 'do_tt]>, " are valid lists. ", <$format, ["subj", [["level", "2"]], ["Object Numbers and Names"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, <$format, ["i", [], ["Object numbers"], 'do_i]>, " and ", <$format, ["i", [], ["object names"], 'do_i]>, " are explained in detail, in the section on Objects: ", <$format, ["link", [["node", "$help_driver_objects_referencing"]], ["Referencing Objects"], 'do_link]>, ". Object numbers and names are always logically true. ", <$format, ["subj", [["level", "2"]], ["Dictionaries"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, "A ", <$format, ["i", [], ["dictionary"], 'do_i]>, " is a collection of data associations, each of which has a key and a value. Dictionaries are similar to lists, however, lookup in a dictionary is with the key (returning the value), rather than with the location in the list. Dictionaries take up more space than lists, but lookup in dictionaries is generally faster than lookup in a list. ", <$format, ["p", [], [], 'do_p]>, "Dictionaries are denoted by a list of two-element lists, preceded with a hash mark (", <$format, ["tt", [], ["#"], 'do_tt]>, "). Each of the two-element lists is an association, where the first element is the key and the second element is the value. Dictionaries are logically true unless empty. The following are all valid dictionaries: ", <$format, ["dfn", [], [<$format, ["quote", [], ["\n\n#[[\"foo\", 3], ['bar, 'baz]]\n#[[\"something\", 'blue], [\"one\", 1], [\"two\", 2]]\n\n"], 'do_quote]>], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, "If you were to assign the first dictionary to a variable by the name of ", <$format, ["i", [], ["dict"], 'do_i]>, ", the expression ", <$format, ["tt", [], ["dict['bar]"], 'do_tt]>, " would return ", <$format, ["tt", [], ["'baz"], 'do_tt]>, ". ", <$format, ["subj", [["level", "2"]], ["Error Codes"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, "An ", <$format, ["i", [], ["error code"], 'do_i]>, " identifies an error. Both the ColdC interpreter and ColdC methods use error codes to identify types of errors when they occur. See section ", <$format, ["link", [["node", "$help_driver_errors"]], ["Errors"], 'do_link]>, " for information about how errors in ColdC are handled. Errors are denoted in ColdC by preceding an identifier with a tilde (", <$format, ["tt", [], ["~"], 'do_tt]>, "). Error codes are always logically false. ", <$format, ["subj", [["level", "2"]], ["Frobs"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, <$format, ["i", [], ["Frobs"], 'do_i]>, " are an advanced data type in ColdC. They consist of a ", <$format, ["i", [], ["class"], 'do_i]>, " (the controlling object) and a ", <$format, ["i", [], ["representation"], 'do_i]>, " (a list or dictionary). Frobs are intended to serve as lightweight objects. Frobs are constructed by enclosing the class and representation within a less-than sign (", <$format, ["tt", [], ["<"], 'do_tt]>, ") and a greater-than sign (", <$format, ["tt", [], [">"], 'do_tt]>, "), seperated by a comma. All of the following are valid frobs: ", <$format, ["dfn", [], [" ", <$format, ["quote", [], ["\n\n<$thing_frob, #[['desc, [\"something small\"]], ['name, \"a small thing.\"]]>\n<$coins, [923]>\n<#73, [1, 2]>\n\n"], 'do_quote]>], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, "When a frob is used in a method-calling expression, as the object, the method is called on the frob class, with the first argument being the frob representation, followed by subsequent arguments. The following are rougly equivalent: ", <$format, ["dfn", [], [" ", <$format, ["quote", [], ["\n\n(<$list, [1, 2, 3]>).reverse()\n$list.reverse([1, 3, 3])\n\n"], 'do_quote]>], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, "Frobs are always logically true. ", <$format, ["subj", [["level", "2"]], ["Buffers"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, "A ", <$format, ["i", [], ["buffer"], 'do_i]>, " is an array of unsigned eight-bit values, intended for handling character values outside of the normal printable range used by ColdC strings. You can construct a buffer by prefixing a list of integers with an accent mark (", <$format, ["tt", [], ["`"], 'do_tt]>, "). For instance, the buffer ", <$format, ["tt", [], ["`[98, 117, 102, 102, 101, 114]"], 'do_tt]>, " is equivalent to the string ", <$format, ["tt", [], ["\"buffer\""], 'do_tt]>, ". Buffers are logically true if not empty. ", <$format, ["p", [], [], 'do_p]>, "For a comarison between Cold types and datatypes in other languages, see ", <$format, ["link", [["node", "$help_driver_structure_types_typecomparison"]], ["Type comparison"], 'do_link]>, "."], #[['this, $help_driver_structure_types]]]>; var $root inited = 1; var $root managed = [$help_driver_structure_types]; var $root owned = [$help_driver_structure_types]; new object $help_driver_structure_types_typecomparison: $help_driver_structure_types; var $root manager = $help_driver_structure_types_typecomparison; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838935665; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "type comparison", "type comparison"]; var $help_node links = #[["ColdC", $help_coldc], ["Language Structure", $help_driver_structure], ["Types", $help_driver_structure_statements]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], [<$format, ["link", [["node", "$help_driver"]], ["ColdC"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_structure"]], ["Language Structure"], 'do_link]>, ": ", <$format, ["link", [["node", "$help_driver_structure_statements"]], ["Types"], 'do_link]>, ": Type Comparison"], 'do_subj]>, " ", <$format, ["p", [], [], 'do_p]>, "The following is a list of ColdC data types along with relative data types from other languages which may be more familiar. ", <$format, ["quote", [], ["\n\n ColdC ANSI C\n ----- ------\n Integer 1 Integer 1\n Float 1.0 Float 1.0\n String \"String\" String \"String\"\n Symbol 'Symbol\n List [1, 2, 3] Array {1, 2, 3}\n Object Number #1234\n Object Name $sys\n Dictionary #[[\"key\", $value]]\n Error ~error\n Frob <object, value>\n Buffer `[]\n\n ColdC MOO\n ----- ---\n Integer 1 Integer 1\n Float 1.0 Float 1.0\n String \"String\" String \"String\"\n Symbol 'Symbol\n List [1, 2, 3] List {1, 2, 3}\n Object Number #1234 Object #1234\n Object Name $sys\n Dictionary #[[\"key\", $value]]\n Error ~error Error E_...\n Frob <object, value>\n Buffer `[] Binary String \"String~XX\"\n\n ColdC Pascal\n ----- ------\n Integer 1 Integer 1\n Float 1.0 Real 1.0\n String \"String\" String 'String'\n Symbol 'Symbol\n List [1, 2, 3] Array <unexpressable>\n Object Number #1234\n Object Name $sys\n Dictionary #[[\"key\", $value]]\n Error ~error\n Frob <object, value>\n Buffer `[]\n\n ColdC Perl\n ----- ----\n Integer 1 Integer 1\n Float 1.0 Float 1.0\n String \"String\" String \"String\"\n Symbol 'Symbol\n List [1, 2, 3] List (1, 2, 3)\n Object Number #1234\n Object Name $sys\n Dictionary #[[\"key\", $value]] Hash %(1, 2)\n Error ~error\n Frob <object, value>\n Buffer `[]\n\n ColdC LISP\n ----- ----\n Integer 1 Integer 1\n Float 1.0 Float 1.0\n String \"String\" String \"String\"\n Symbol 'Symbol\n List [1, 2, 3] Vector (1 2 3)\n Object Number #1234\n Object Name $sys\n Dictionary #[[\"key\", $value]]\n Error ~error\n Frob <object, value>\n Buffer `[]\n\n"], 'do_quote]>], #[['this, $help_driver_structure_types_typecomparison]]]>; var $root inited = 1; var $root managed = [$help_driver_structure_types_typecomparison]; var $root owned = [$help_driver_structure_types_typecomparison]; new object $help_reference: $help_core; var $root manager = $help_reference; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 847916304; var $has_name name = ['prop, "Reference Library", "Reference Library"]; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $help_node links = #[["Subsystem", $help_index_subsystem], ["Object", $help_index_objects]]; var $help_node body = <$ctext_frob, [[<$format, ["p", [], [], 'do_p]>, "Nodes from this point down are for core subsystem documentation and documentation on specific objects. ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["dl", [["columned", 1]], [<$format, ["dt", [], [" ", <$format, ["b", [], [<$format, ["link", [["node", "$help_index_subsystem"]], ["Subsystem"], 'do_link]>], 'do_b]>], 'do_dt]>, <$format, ["dd", [], [" Subsystems Index"], 'do_dd]>, <$format, ["dt", [], [" ", <$format, ["b", [], [<$format, ["link", [["node", "$help_index_objects"]], ["Object"], 'do_link]>], 'do_b]>], 'do_dt]>, <$format, ["dd", [], [" Core Objects Index"], 'do_dd]>], 'do_dl]>], #[['this, $help_reference]]]>; var $root inited = 1; var $help_node index = $help_index_subsystem; var $root managed = [$help_reference]; var $root owned = [$help_reference]; new object $help_updates: $help_core; var $root manager = $help_updates; var $help_updates dirty = 2; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 848537316; var $help_node index = $help_index_subsystem; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "Updates", "Updates"]; var $help_node links = #[["Cold Help System", $help_core], ["Cml formatters", $help_node_formatters], ["Cml generators", $help_node_generators], ["regular expressions", $help_driver_regularexpressions], ["strfmt", $help_func_strfmt], ["Settings", $help_interface_settings], ["Events", $help_obj_events], ["Element", $help_list_element], ["Formatting", $help_list_formatting], ["List", $help_node_list], ["Maps", $help_list_maps], ["Other", $help_list_other], ["Sets", $help_list_sets]]; var $help_node body = <$ctext_frob, [[<$format, ["dl", [], [<$format, ["dt", [], ["11/20/96"], 'do_dt]>, <$format, ["dd", [], [<$format, ["link", [["node", "$help_core"]], ["Cold Help System"], 'do_link]>], 'do_dd]>, <$format, ["dt", [], ["11/21/96"], 'do_dt]>, <$format, ["dd", [], [<$format, ["link", [["node", "$help_node_formatters"]], ["Cml formatters"], 'do_link]>, ", ", <$format, ["link", [["node", "$help_node_generators"]], ["Cml generators"], 'do_link]>, ", ", <$format, ["link", [["node", "$help_driver_regularexpressions"]], ["regular expressions"], 'do_link]>, " and ", <$format, ["link", [["node", "$help_func_strfmt"]], ["strfmt"], 'do_link]>], 'do_dd]>, <$format, ["dt", [], ["11/25/96"], 'do_dt]>, <$format, ["dd", [], [<$format, ["link", [["node", "$help_interface_settings"]], ["Settings"], 'do_link]>], 'do_dd]>, <$format, ["dt", [], ["12/16/96"], 'do_dt]>, <$format, ["dd", [], [<$format, ["link", [["node", "$help_obj_events"]], ["Events"], 'do_link]>], 'do_dd]>, <$format, ["dt", [], ["12/17/96"], 'do_dt]>, <$format, ["dd", [], [<$format, ["link", [["node", "$help_list_element"]], ["Element"], 'do_link]>, ", ", <$format, ["link", [["node", "$help_list_formatting"]], ["Formatting"], 'do_link]>, ", ", <$format, ["link", [["node", "$help_node_list"]], ["List"], 'do_link]>, ", ", <$format, ["link", [["node", "$help_list_maps"]], ["Maps"], 'do_link]>, ", ", <$format, ["link", [["node", "$help_list_other"]], ["Other"], 'do_link]>, " and ", <$format, ["link", [["node", "$help_list_sets"]], ["Sets"], 'do_link]>], 'do_dd]>], 'do_dl]>], #[['this, $help_updates]]]>; var $root inited = 1; var $help_updates update_list = [[848905200, [$help_interface_settings]], [850719600, [$help_obj_events]], [850806000, [$help_list_element, $help_list_formatting, $help_list_maps, $help_list_sets, $help_list_other, $help_node_list]], [851151600, [$help_theme]]]; var $help_updates cleanup_time = 2592000; var $root trusted = [$help_node]; var $root managed = [$help_updates]; public method .touched() { var i, t; (> .perms(caller(), 'trusts) <); dirty++; t = localtime(); t = (((t[1]) - (t[2])) - (60 * (t[3]))) - (3600 * (t[4])); update_list = filter i in (update_list || []) where ((i[1]) > (t - cleanup_time)); if ((i = t in (update_list.slice(1)))) update_list = update_list.replace(i, [(update_list[i])[1], ((update_list[i])[2]).setadd(sender())]); else update_list += [[t, [sender()]]]; }; public method .body() { var i, j, out, body; body = pass(); if (dirty || (!body)) { if (!update_list) { out = ["There weren't any recent updates."]; } else { out = ["{dl:"]; for i in (update_list) { j = map j in (i[2]) to ([j.name(), "" + j]).sort(); out += [((("{dt:" + ($time.format("%D", i[1]))) + "}{dd:") + (map j in (j) to (strfmt("{link node=%l:%l}", j[2], j[1])).to_english())) + "}"]; } out += ["}"]; } .set_body(out); body = pass(); dirty = 0; } return body; }; new object $help_node_formatters: $help_node; var $root manager = $help_node_formatters; var $root created_on = 809737729; var $root inited = 1; var $root flags = ['methods, 'code, 'variables, 'core]; var $has_name name = ['prop, "Cml formatters", "Cml formatters"]; var $help_node links = #[]; var $help_node body = <$ctext_frob, [["The formators are very loosely based on HTML 3.0. While some names have changed, the basic facilities are available.", <$format, ["br", [], [], 'do_br]>, " ", <$format, ["dl", [], [<$format, ["dt", [], ["subj level=n"], 'do_dt]>, <$format, ["dd", [], ["Roughly equivalent to HTML's h? tags."], 'do_dd]>, <$format, ["dt", [], ["b i strong em tt"], 'do_dt]>, <$format, ["dd", [], ["Bold, italic and typewriter tags."], 'do_dd]>, <$format, ["dt", [], ["ul"], 'do_dt]>, <$format, ["dd", [], ["Unordered lists. Allows an lh as a list header. List elements are contained within li tags."], 'do_dd]>, <$format, ["dt", [], ["dl"], 'do_dt]>, <$format, ["dd", [], ["Definition lists. Allows an lh as a list header. Elements consist of dt and dd tags."], 'do_dd]>, <$format, ["dd", [], ["action command=...:<text>"], 'do_dd]>, <$format, ["dd", [], ["Creates and an action using <command> and <text>."], 'do_dd]>, <$format, ["dt", [], ["link node=object:<text>"], 'do_dt]>, <$format, ["dd", [], ["Creates a link to the help node given in <node>."], 'do_dd]>, <$format, ["dt", [], ["web src=url:<text>"], 'do_dt]>, <$format, ["dd", [], ["A link to WWW."], 'do_dd]>, <$format, ["dt", [], ["quote text"], 'do_dt]>, <$format, ["dd", [], ["Quotes the text. No ':' for the arguments, also, this formatter is spacing-sensitive."], 'do_dd]>, <$format, ["dt", [], ["table ind=margin_size cols=width,...:spec"], 'do_dt]>, <$format, ["dd", [], ["Table tag. Use tr for rows and td for columns, rows may contain only column tags. td can contain rowspan and coldspan to specify multiple cell spans. Widths may be defined in percentages, in which case marginsize is substracted from the line width."], 'do_dd]>, <$format, ["dt", [], ["dfn"], 'do_dt]>, <$format, ["dd", [], ["Definition header. Useful for porting from old ctext"], 'do_dd]>], 'do_dl]>, " ", <$format, ["dt", [], ["detail name=<name>:description"], 'do_dt]>, " ", <$format, ["dd", [], ["Generate description detail. Details may be nested as long as names are unique throughout the ctext."], 'do_dd]>, " ", <$format, ["dt", [], ["img src=URL:Name"], 'do_dt]>, " ", <$format, ["dd", [], ["Generate image. The image is visible only in HTML format."], 'do_dd]>], #[['this, $help_node_formatters]]]>; var $root managed = [$help_node_formatters]; var $root owned = [$help_node_formatters]; new object $help_node_generators: $help_node; var $root manager = $help_node_generators; var $root created_on = 809736951; var $root inited = 1; var $root flags = ['methods, 'code, 'variables, 'core]; var $has_name name = ['prop, "Cml generators", "Cml generators"]; var $help_node links = #[]; var $help_node body = <$ctext_frob, [[<$format, ["dl", [], [<$format, ["dt", [], ["name separator=...|english|none:<object> ..."], 'do_dt]>, <$format, ["dd", [], ["Generates the names of the listed objects. With separator 'none', a list is generated instead of string."], 'do_dd]>, <$format, ["dt", [], ["english sep=... empty=... and=...:<list>"], 'do_dt]>, <$format, ["dd", [], ["Generates an 'english list' of the items in <list>."], 'do_dd]>, <$format, ["dt", [], ["foreach var=... list=<list>: <body>"], 'do_dt]>, <$format, ["dd", [], ["Evaluates <body> once for each item in <list>. A will be created containing the current value. Variable defaults to iterator."], 'do_dd]>, <$format, ["dt", [], ["switch value=...: <item><result><item><result>...<else-result>"], 'do_dt]>, <$format, ["dd", [], ["Evaluate value, then compare it to each item in order. When the item matches, return the result. If there is no match, return else-result. Use join generator to group multiple strings."], 'do_dd]>, <$format, ["dt", [], ["set var=<name>:<value>"], 'do_dt]>, <$format, ["dt", [], ["def var=<name>:<value>"], 'do_dt]>, <$format, ["dd", [], ["Creates a new generator <name> that contains <value>. set will evaluate the <value> before storage, def will store the value directly. Either way the way the value may be retrieved using the generator <name>. The new generator will overwrite any previous generator by the same. Only the first item from the arguments list is evaluated, use join generator to get around this."], 'do_dd]>, <$format, ["dt", [], ["server_name, serverurl"], 'do_dt]>, <$format, ["dd", [], ["The name and base URL of the server."], 'do_dd]>, <$format, ["dt", [], ["time:<args>"], 'do_dt]>, <$format, ["dd", [], ["Calls the built-n strftime."], 'do_dd]>, <$format, ["dt", [], ["vars separator=..."], 'do_dt]>, <$format, ["dd", [], ["Returns the names of variables available. Separator is same as in name generator."], 'do_dd]>, <$format, ["dt", [], ["join separator=...|none|english:list"], 'do_dt]>, <$format, ["dd", [], ["Joins the elements of list. none means to forward it as a list to the caller."], 'do_dd]>, <$format, ["dt", [], ["pro obj=object:type"], 'do_dt]>, <$format, ["dd", [], ["Generates a pronoun. Pronoun types are as defined on $gender."], 'do_dd]>, <$format, ["dt", [], ["columnize cols=...:list"], 'do_dt]>, <$format, ["dd", [], ["Generates a list of strings, giving a columnized list."], 'do_dd]>, <$format, ["dt", [], ["Other tags"], 'do_dt]>, <$format, ["dd", [], ["Each cml processor can also create extra generators. Also, caller to the cml can create extra variables that are available for generators."], 'do_dd]>], 'do_dl]>], #[['this, $help_node_generators]]]>; var $root managed = [$help_node_generators]; var $root owned = [$help_node_generators]; new object $help_node_coredocuments: $help_node; var $root manager = $help_node_coredocuments; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838774664; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "core documents", "core documents"]; var $help_node links = #[]; var $help_node body = <$ctext_frob, [["This node isn't written yet"], #[['this, $help_node_coredocuments]]]>; var $root inited = 1; var $root managed = [$help_node_coredocuments]; var $root owned = [$help_node_coredocuments]; new object $help_node_coredocuments_trie: $help_node_coredocuments; var $root manager = $help_node_coredocuments_trie; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838774726; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "Trie", "Trie"]; var $help_node links = #[]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], ["Trie frob"], 'do_subj]>, "Trie is a datastructure that behaves like dictionary with string keys, except that it allows fast match_begin with all the keys. Also, key may be associated with a value list instead of a single value. Its memory overhead is about twice that of a dictionary, and all the operations are slower, except match_begin (which, unlike the dictionary's, does not have to loop through all the keys). Empty trie is represented as ", <$format, ["quote", [], ["<$trie,[0,\"\"]>"], 'do_quote]>, ". ", <$format, ["subj", [["level", "3"]], ["Methods"], 'do_subj]>, " ", <$format, ["dl", [], [<$format, ["dt", [], [<$format, ["quote", [], [".add(key, value[,value...])"], 'do_quote]>], 'do_dt]>, <$format, ["dd", [], ["Associate a list of values with a key."], 'do_dd]>, " ", <$format, ["dt", [], [<$format, ["quote", [], [".del(key)"], 'do_quote]>], 'do_dt]>, <$format, ["dd", [], ["Remove the key from trie."], 'do_dd]>, " ", <$format, ["dt", [], [<$format, ["quote", [], [".match_exact(key)"], 'do_quote]>], 'do_dt]>, <$format, ["dd", [], ["Find an exact match to the key."], 'do_dd]>, " ", <$format, ["dt", [], [<$format, ["quote", [], [".match_begin(key)"], 'do_quote]>], 'do_dt]>, <$format, ["dd", [], ["Find an approximate match."], 'do_dd]>, " ", <$format, ["dt", [], [<$format, ["quote", [], [".keys()"], 'do_quote]>], 'do_dt]>, <$format, ["dd", [], ["Get a list of the keys. This is very slow operation."], 'do_dd]>, " ", <$format, ["dt", [], [<$format, ["quote", [], [".to_dict(), $dictionary.to_trie(dict)"], 'do_quote]>], 'do_dt]>, <$format, ["dd", [], ["Conversions. The first one converts a trie with a single-element values into dictionary, reverse converts a dictionary with string keys to trie."], 'do_dd]>], 'do_dl]>], #[['this, $help_node_coredocuments_trie]]]>; var $root inited = 1; var $root managed = [$help_node_coredocuments_trie]; var $root owned = [$help_node_coredocuments_trie]; new object $help_node_editor: $help_node; var $root manager = $help_node_editor; var $root child_index = 1; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 840585945; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "Editor", "Editor"]; var $help_node links = #[["Invoking", $help_node_editor_invoking], ["Commands", $help_node_editor_commands], ["Programming", $help_node_editor_programming]]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], ["Editor system"], 'do_subj]>, "The ColdX editor is an integrated system, allowing you to edit methods or other data through a builtin line editor or MCP. local-editor setting on the user controls which one will be used. The editor works by spawning session objects, which keep the text and other information. Each user may have multiple sessions. Any coldcore system can create editor session for a user.", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["dl", [["columned", 1]], [<$format, ["dt", [], [<$format, ["link", [["node", "$help_node_editor_invoking"]], ["Invoking"], 'do_link]>], 'do_dt]>, <$format, ["dd", [], ["Comamnds used to invoke the editor"], 'do_dd]>, <$format, ["dt", [], [<$format, ["link", [["node", "$help_node_editor_commands"]], ["Commands"], 'do_link]>], 'do_dt]>, <$format, ["dd", [], ["Editor commands"], 'do_dd]>, <$format, ["dt", [], [<$format, ["link", [["node", "$help_node_editor_programming"]], ["Programming"], 'do_link]>], 'do_dt]>, <$format, ["dd", [], ["Editor: The Programmer's view"], 'do_dd]>], 'do_dl]>], #[['this, $help_node_editor]]]>; var $root inited = 1; var $root managed = [$help_node_editor]; var $root owned = [$help_node_editor]; new object $help_node_editor_invoking: $help_node_editor; var $root manager = $help_node_editor_invoking; var $root managed = [$help_node_editor_invoking]; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 840586820; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "invoking", "invoking"]; var $help_node links = #[]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], ["Invoking editor"], 'do_subj]>, <$format, ["dl", [], [<$format, ["dt", [], ["@edit object.method"], 'do_dt]>, <$format, ["dd", [], ["Edit a method on the object"], 'do_dd]>, <$format, ["dt", [], ["@edit object [+t?ype=method]"], 'do_dt]>, <$format, ["dd", [], ["Edit data on the object. Type specifies what data (typical values: prose, text, messages or help). Without +t, a reasonable default will be chosen."], 'do_dd]>, <$format, ["dt", [], ["@resume <session object>"], 'do_dt]>, <$format, ["dd", [], ["Resume background session."], 'do_dd]>, <$format, ["dt", [], ["@reedit"], 'do_dt]>, <$format, ["dd", [], ["Return the user into server editor or cleanup the current editor. This is a troubleshooting command."], 'do_dd]>, <$format, ["dt", [], ["@clear-sessions"], 'do_dt]>, <$format, ["dd", [], ["Repeated use of MCP leaves many session objects that will be purged with this command."], 'do_dd]>], 'do_dl]>], #[['this, $help_node_editor_invoking]]]>; var $root inited = 1; var $root owned = [$help_node_editor_invoking]; new object $help_node_editor_commands: $help_node_editor; var $root manager = $help_node_editor_commands; var $root managed = [$help_node_editor_commands]; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 840586826; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "commands", "commands"]; var $help_node links = #[]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], ["Server editor commands"], 'do_subj]>, <$format, ["dl", [], [<$format, ["dt", [], ["help"], 'do_dt]>, <$format, ["dd", [], ["Command list"], 'do_dd]>, <$format, ["dt", [], ["l [<range>]"], 'do_dt]>, <$format, ["dd", [], ["List range (default: lines around the cursor)"], 'do_dd]>, <$format, ["dt", [], [".<line>"], 'do_dt]>, <$format, ["dd", [], ["Move the cursor to line ($=last line)"], 'do_dd]>, <$format, ["dt", [], ["'text"], 'do_dt]>, <$format, ["dd", [], ["Insert line"], 'do_dd]>, <$format, ["dt", [], [",text"], 'do_dt]>, <$format, ["dd", [], ["Append the line to the previous"], 'do_dd]>, <$format, ["dt", [], ["enter"], 'do_dt]>, <$format, ["dd", [], ["Read the lines of text."], 'do_dd]>, <$format, ["dt", [], ["d [<range>]"], 'do_dt]>, <$format, ["dd", [], ["Delete the line(s)"], 'do_dd]>, <$format, ["dt", [], ["fill <range> [<linelength>]"], 'do_dt]>, <$format, ["dd", [], ["Fill (wordwrap) the lines"], 'do_dd]>, <$format, ["dt", [], ["s/old/new/rangeflags "], 'do_dt]>, <$format, ["dd", [], ["Substitute (at most once per line). Flags are: r=use regexp for matching, g=global replace, c=case-sensitive (works only with regexp)"], 'do_dd]>, <$format, ["dt", [], ["abort"], 'do_dt]>, <$format, ["dd", [], ["Abort the session"], 'do_dd]>, <$format, ["dt", [], ["save"], 'do_dt]>, <$format, ["dd", [], ["Save (Exact effect depends on the data being editted)"], 'do_dd]>, <$format, ["dt", [], ["done"], 'do_dt]>, <$format, ["dd", [], ["Finish the edit, or put the session into the background"], 'do_dd]>], 'do_dl]>], #[['this, $help_node_editor_commands]]]>; var $root inited = 1; var $root owned = [$help_node_editor_commands]; new object $help_node_editor_programming: $help_node_editor; var $root manager = $help_node_editor_programming; var $root managed = [$help_node_editor_programming]; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 840586832; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "programming", "programming"]; var $help_node links = #[]; var $help_node body = <$ctext_frob, [[<$format, ["subj", [["level", "1"]], ["Programming the editor"], 'do_subj]>, " ", <$format, ["subj", [["level", "3"]], ["Glosary"], 'do_subj]>, <$format, ["dl", [], [<$format, ["dt", [], ["Server-side edit"], 'do_dt]>, <$format, ["dd", [], ["The editor mode in which @edit command throws the user into the line editor built into the server."], 'do_dd]>, " ", <$format, ["dt", [], ["Local edit"], 'do_dt]>, <$format, ["dd", [], ["Editor mode in which @edit downloads the text to the user, returns the user to normal work, and processes the text upload as it arrives."], 'do_dd]>, <$format, ["dt", [], ["Callback"], 'do_dt]>, <$format, ["dd", [], [<$format, ["tt", [], ["save"], 'do_tt]>, " command in the server edit, or upload in the local edit, will call a function that knows how to deal with the text. The function (and its extra arguments) are passed to the editor when it's started. Callback function expects two arguments, ", <$format, ["tt", [], ["text"], 'do_tt]>, " and ", <$format, ["tt", [], ["client_data"], 'do_tt]>, ", the first is the text upload, and the other is a list passed to the editor when it was run."], 'do_dd]>], 'do_dl]>, <$format, ["subj", [["level", "3"]], ["Editor objects"], 'do_subj]>, <$format, ["dl", [], [<$format, ["dt", [], ["$editor_reference"], 'do_dt]>, <$format, ["dd", [], ["A parent to ", <$format, ["tt", [], ["$user"], 'do_tt]>, ", containing the invocation commands, a list of background editors and the foreground editor."], 'do_dd]>, <$format, ["dt", [], ["$editor_parser"], 'do_dt]>, <$format, ["dd", [], ["Editor command parser. Added to the list of $user's parsers to switch the command context for server editting."], 'do_dd]>, <$format, ["dt", [], ["$editor_session"], 'do_dt]>, <$format, ["dd", [], ["This object is spawned for each individual session. It contains all the data for the session: callback method and arguments, modification flag, cursor position and (for server edit) the text itself. It also runs the editor commands (for server edit). For the local edit, it main purpose is keeping track of the callbacks."], 'do_dd]>, <$format, ["dt", [], ["$editable"], 'do_dt]>, <$format, ["dd", [], ["This is a generic parent that keeps track of the datatype that an object may hold (with @edit object +type=<something> command)"], 'do_dd]>], 'do_dl]>, <$format, ["subj", [["level", "3"]], ["Calling the editor"], 'do_subj]>, "The editor is called by running ", <$format, ["tt", [], ["user.invoke_editor(callback_object, callback_method, initial_text, client_data)"], 'do_tt]>, ", where ", <$format, ["tt", [], ["callback_object"], 'do_tt]>, " and ", <$format, ["tt", [], ["callback_method"], 'do_tt]>, " specify the callback, ", <$format, ["tt", [], ["initial_text"], 'do_tt]>, " is the text to be edited, and ", <$format, ["tt", [], ["client_data"], 'do_tt]>, " will be passed to the callback as additional arguments.", <$format, ["subj", [["level", "3"]], ["Extending @edit types"], 'do_subj]>, "To add a new editable type to an object, first make sure that the object has $editable among its ancestors. Then do ", <$format, ["tt", [], ["object.set_edit_type([ list of types ])"], 'do_tt]>, ". For each type, define object.edit_<type> method, and the callback for the method. You're done!"], #[['this, $help_node_editor_programming]]]>; var $root inited = 1; var $root owned = [$help_node_editor_programming]; new object $help_node_channels: $help_node; var $root manager = $help_node_channels; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 840768823; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "Channels", "Channels"]; var $help_node links = #[]; var $help_node body = <$ctext_frob, [["Channels are a global way to communicate with other users. ", <$format, ["dl", [], [<$format, ["dt", [], ["Commands available for using channels:"], 'do_dt]>, <$format, ["dd", [], ["@addcom <alias>=<channel>. Adds a channel alias to a channel <channel>. Provides a shortcut way of referring to a channel. For example, typing '@addcom pub=Public' will create a shortcut called 'pub' to refer to the [Public] channel.", <$format, ["br", [], [], 'do_br]>], 'do_dd]>, " ", <$format, ["dd", [], ["<channel alias> on -- Typing '<alias> on' will turn on a given channel. When a channel is turned on, you listen and receive messages from anyone chantting on that channel.", <$format, ["br", [], [], 'do_br]>], 'do_dd]>, " ", <$format, ["dd", [], ["Speaking to a channel. If you have a channel [Public] with an alias 'pub', you can send a message to it with the command 'pub Hi!'. Similarly, emits work as well with 'pub :waves'", <$format, ["br", [], [], 'do_br]>], 'do_dd]>, " ", <$format, ["dd", [], ["Leaving a channel: Type alias <off> to leave a channel. For example, if it's too noisy on the pub channel, as created above, typing 'pub off' will turn it off."], 'do_dd]>, " ", <$format, ["dd", [], ["Determining the people listening to a given channel. Typing '<alias> who' will provide a listing of users currently listening to a channel. For example, 'pub who' will list the users chatting or idling on the public channel, from the example above."], 'do_dd]>, " ", <$format, ["dd", [], ["The '@channels' command lists all of the channel aliases and their channels that you have currently defined.'"], 'do_dd]>, " ", <$format, ["dd", [], ["@delcom <alias> deletes a channel alias and its associated channel name. This is a housekeeping command for cleaning up channel aliases that aren't used any longer"], 'do_dd]>, " "], 'do_dl]>], #[['this, $help_node_channels]]]>; var $root inited = 1; var $root managed = [$help_node_channels]; var $root owned = [$help_node_channels]; new object $help_index: $has_name, $registry, $help_node; var $root child_index = 5; var $root inited = 1; var $root trusted = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'variables, 'core]; var $has_name name = ['prop, "Index", "Index"]; var $db database = #[["List", $help_node_list], ["settings", $help_interaction], ["Cold Markup Language (CML)", $help_node_cml], ["Interface", $help_func_method], ["Summary", $help_core], ["Cml generators", $help_node_generators], ["Navigation", $help_func_substr], ["the help_node_1", #570], ["Programming", $help_node_editor_programming], ["Commands", $help_node_editor_commands], ["Interaction", $help_interaction], ["Help", $help_help], ["@show", #567], ["@display", $help_cmds_display], ["@help-link", #568], ["a Command Types", $help_commands_types], ["Cml formatters", $help_node_formatters], ["Cml programming", $help_node_cml_prog], ["@hnode", #557], ["@hwrite", #569], ["@hlist", $help_func_dict_add], ["@program", #834], ["Driver", $help_coldc], ["Functions", $help_functions], ["abs", $help_func_abs], ["strfmt", $help_func_strfmt], ["strgraft", $help_func_strgraft], ["errors", $help_driver_errors], ["file intro", $help_driver_fileintro], ["intro", $help_driver_intro], ["method intro", $help_driver_methodintro], ["networking", $help_driver_networking], ["oop", $help_prog_oop], ["regular expressions", $help_driver_regularexpressions], ["security", $help_driver_security], ["task intro", $help_driver_taskintro], ["add_method", $help_func_add_method], ["add_var", $help_func_add_var], ["ancestors", $help_func_ancestors], ["atomic", $help_func_atomic], ["backup", $help_func_backup], ["bind_function", $help_func_bind_function], ["bind_port", $help_func_bind_port], ["buf_replace", $help_func_buf_replace], ["buf_to_str", $help_func_buf_to_str], ["buf_to_strings", $help_func_buf_to_strings], ["bufgraft", $help_func_bufgraft], ["buflen", $help_func_buflen], ["caller", $help_func_caller], ["cancel", $help_func_cancel], ["children", $help_func_children], ["chparents", $help_func_chparents], ["class", $help_func_class], ["clear_var", $help_func_clear_var], ["close_connection", $help_func_close_connection], ["coldmud", $help_func_coldmud], ["coldmud_5", $help_func_coldmud_5], ["compile", $help_func_compile], ["connection", $help_func_connection], ["create", $help_func_create], ["crypt", $help_func_crypt], ["ctime", $help_func_ctime], ["cwrite", $help_func_cwrite], ["cwritef", $help_func_cwritef], ["data", $help_func_data], ["dblog", $help_func_dblog], ["list_method", $help_func_list_method], ["definer", $help_func_definer], ["del_method", $help_func_del_method], ["del_objname", $help_func_del_objname], ["del_var", $help_func_del_var], ["delete", $help_func_delete], ["descendants", $help_func_descendants], ["destroy", $help_func_destroy], ["dict_add", $help_func_dict_add], ["dict_contains", $help_func_dict_contains], ["dict_del", $help_func_dict_del], ["dict_keys", $help_func_dict_keys], ["error", $help_func_error], ["execute", $help_func_execute], ["explode", $help_func_explode], ["fchmod", $help_func_fchmod], ["fclose", $help_func_fclose], ["feof", $help_func_feof], ["fflush", $help_func_fflush], ["file", $help_func_file], ["files", $help_func_files], ["find_method", $help_func_find_method], ["find_next_method", $help_func_find_next_method], ["fmkdir", $help_func_fmkdir], ["fopen", $help_func_fopen], ["fread", $help_func_fread], ["fremove", $help_func_fremove], ["frename", $help_func_frename], ["frmdir", $help_func_frmdir], ["fseek", $help_func_fseek], ["fstat", $help_func_fstat], ["fwrite", $help_func_fwrite], ["method_bytecode", $help_func_method_bytecode], ["get_var", $help_func_get_var], ["has_ancestor", $help_func_has_ancestor], ["insert", $help_func_insert], ["join", $help_func_join], ["listgraft", $help_func_listgraft], ["listlen", $help_func_listlen], ["localtime", $help_func_localtime], ["lookup", $help_func_lookup], ["lowercase", $help_func_lowercase], ["match_begin", $help_func_match_begin], ["match_pattern", $help_func_match_pattern], ["match_regexp", $help_func_match_regexp], ["match_template", $help_func_match_template], ["math", $help_func_math], ["max", $help_func_max], ["method", $help_func_method], ["method_access", $help_func_method_access], ["method_flags", $help_func_method_flags], ["method_info", $help_func_method_info], ["methods", $help_func_methods], ["min", $help_func_min], ["mtime", $help_func_mtime], ["objname", $help_func_objname], ["objnum", $help_func_objnum], ["open_connection", $help_func_open_connection], ["pad", $help_func_pad], ["parents", $help_func_parents], ["pause", $help_func_pause], ["random", $help_func_random], ["reassign_connection", $help_func_reassign_connection], ["refresh", $help_func_refresh], ["regexp", $help_func_regexp], ["rename_method", $help_func_rename_method], ["replace", $help_func_replace], ["resume", $help_func_resume], ["rethrow", $help_func_rethrow], ["sender", $help_func_sender], ["set_heartbeat", $help_func_set_heartbeat], ["set_method_access", $help_func_set_method_access], ["set_method_flags", $help_func_set_method_flags], ["set_objname", $help_func_set_objname], ["set_var", $help_func_set_var], ["setadd", $help_func_setadd], ["setremove", $help_func_setremove], ["size", $help_func_size], ["stack", $help_func_stack], ["str_to_buf", $help_func_str_to_buf], ["strcmp", $help_func_strcmp], ["strings_to_buf", $help_func_strings_to_buf], ["strlen", $help_func_strlen], ["strsed", $help_func_strsed], ["strsub", $help_func_strsub], ["subbuf", $help_func_subbuf], ["sublist", $help_func_sublist], ["substr", $help_func_substr], ["suspend", $help_func_suspend], ["task_id", $help_func_task_id], ["tasks", $help_func_tasks], ["this", $help_func_this], ["throw", $help_func_throw], ["tick", $help_func_tick], ["ticks_left", $help_func_ticks_left], ["time", $help_func_time], ["toerr", $help_func_toerr], ["tofloat", $help_func_tofloat], ["toint", $help_func_toint], ["toliteral", $help_func_toliteral], ["toobjnum", $help_func_toobjnum], ["tostr", $help_func_tostr], ["tosym", $help_func_tosym], ["traceback", $help_func_traceback], ["type", $help_func_type], ["unbind_function", $help_func_unbind_function], ["unbind_port", $help_func_unbind_port], ["union", $help_func_union], ["uppercase", $help_func_uppercase], ["valid", $help_func_valid], ["variables", $help_func_variables], ["objects", $help_driver_objects], ["object methods", $help_driver_objects_objectmethods], ["referencing", $help_driver_objects_referencing], ["special", $help_driver_objects_special], ["object variables", $help_driver_objects_objectvariables], ["structure", $help_driver_structure], ["expressions", $help_driver_structure_expressions], ["statements", $help_driver_structure_statements], ["tokens", $help_driver_structure_tokens], ["types", $help_driver_structure_types], ["Conventions", $help_driver_convention], ["shutdown", $help_func_shutdown], ["expression variables", $help_driver_structure_expressions_expressionvariables], ["operators", $help_driver_structure_expressions_operators], ["calling functions", $help_driver_structure_expressions_callingfunctions], ["calling methods", $help_driver_structure_expressions_callingmethods], ["error handling", $help_driver_structure_expressions_errorhandling], ["splicing", $help_driver_structure_expressions_splicing], ["core documents", $help_node_coredocuments], ["Trie", $help_node_coredocuments_trie], ["simple statements", $help_driver_structure_statements_simplestatements], ["conditional statements", $help_driver_structure_statements_conditionalstatements], ["looping statements", $help_driver_structure_statements_loopingstatements], ["Error-Handling Statements", $help_driver_structure_statements_errorhandlingstatements], ["type comparison", $help_driver_structure_types_typecomparison], ["looping expressions", $help_driver_structure_expressions_loopingexpressions], ["Editor", $help_node_editor], ["invoking", $help_node_editor_invoking], ["Channels", $help_node_channels], ["Environment", $help_environment], ["VR vs Non-VR", $help_commands_vr], ["Matching Conventions", $help_commands_matching], ["Enhanced Command Templates", $help_commands_enhanced]]; var $root manager = $help_index; var $root managed = [$help_index]; var $root owned = [$help_index]; var $help_node links = #[]; var $help_node body = <$ctext_frob, [[], #[]]>; var $help_index dirty = 0; root method .init_help_index() { .set_stripped_characters("!#$%^&*()"); .add_trusted($help_node); }; root method .uninit_help_index() { var key; for key in ((.database()).keys()) (.match_exact(key)).index_going_away(); }; public method .add_help_node() { arg node; var a; if ((caller() != $help_node) && (!(.is_writable_by(caller())))) throw(~perm, "Permission denied."); .insert(node.name(), node); // come up with a system for exploding a template name nicely }; public method .del_help_node() { arg node; var a; if ((!(caller() in [$help_node, definer()])) && ((!(.is_writable_by(sender()))) && (sender() != this()))) throw(~perm, "Permission denied."); .remove(node.name()); }; public method .node_going_away() { (> .perms(caller(), $help_node) <); .del_help_node(sender()); }; public method .body() { var key, out, body, col, db; body = pass(); if (dirty || (!body)) { (| clear_var('dirty) |); db = .database(); out = ["{table cols=25%,25%,25%,25%:"]; for key in ((db.keys()).sort()) { if (!col) out += ["{tr:"]; out += [((("{td:{link node=" + (db[key])) + ":") + key) + "}}"]; if (col == 3) { out += ["}"]; col = 0; } else { col++; } } if (col != 0) out += ["}}"]; else out += ["}"]; .set_body(out); body = pass(); } return body; }; public method .node_name() { return (.name()) + " INDEX"; }; public method .html_node_name() { return .node_name(); }; public method .insert() { arg name, obj; (> pass(name, obj) <); dirty++; }; public method .remove() { arg name; (> pass(name) <); dirty++; }; public method .node_changed_name() { arg old; var node, part; (> .perms(caller(), $help_node) <); node = sender(); for part in (old.explode("|")) (| .remove(part) |); for part in ((node.name()).explode("|")) (| .insert(part, node) |); }; public method .strip_key() { arg key; anticipate_assignment(); return key.strip("!#$%^&*()"); }; new object $help_index_driver: $help_index; var $root manager = $help_index_driver; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 837910423; var $db database = #[["Conventions", $help_driver_convention], ["errors", $help_driver_errors], ["file intro", $help_driver_fileintro], ["intro", $help_driver_intro], ["method intro", $help_driver_methodintro], ["networking", $help_driver_networking], ["oop", $help_prog_oop], ["regular expressions", $help_driver_regularexpressions], ["security", $help_driver_security], ["task intro", $help_driver_taskintro], ["functions", $help_functions], ["objects", $help_driver_objects], ["structure", $help_driver_structure], ["object methods", $help_driver_objects_objectmethods], ["referencing", $help_driver_objects_referencing], ["special", $help_driver_objects_special], ["object variables", $help_driver_objects_objectvariables], ["expressions", $help_driver_structure_expressions], ["statements", $help_driver_structure_statements], ["tokens", $help_driver_structure_tokens], ["types", $help_driver_structure_types], ["expression variables", $help_driver_structure_expressions_expressionvariables], ["operators", $help_driver_structure_expressions_operators], ["calling functions", $help_driver_structure_expressions_callingfunctions], ["calling methods", $help_driver_structure_expressions_callingmethods], ["error handling", $help_driver_structure_expressions_errorhandling], ["splicing", $help_driver_structure_expressions_splicing], ["looping expressions", $help_driver_structure_expressions_loopingexpressions], ["simple statements", $help_driver_structure_statements_simplestatements], ["conditional statements", $help_driver_structure_statements_conditionalstatements], ["looping statements", $help_driver_structure_statements_loopingstatements], ["Error-Handling Statements", $help_driver_structure_statements_errorhandlingstatements], ["type comparison", $help_driver_structure_types_typecomparison]]; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "Driver", "Driver"]; var $registry stripped_characters = "!@#$%^&*()"; var $root trusted = [$help_node]; var $root inited = 1; var $root managed = [$help_index_driver]; var $root owned = [$help_index_driver]; var $help_node body = <$ctext_frob, [[<$format, ["table", [["cols", "25%,25%,25%,25%"]], [<$format, ["tr", [], [<$format, ["td", [], [<$format, ["link", [["node", "$help_driver_structure_expressions_callingfunctions"]], ["calling functions"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_driver_structure_expressions_callingmethods"]], ["calling methods"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_driver_structure_statements_conditionalstatements"]], ["conditional statements"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_driver_convention"]], ["Conventions"], 'do_link]>], 'do_td]>], 'do_tr]>, <$format, ["tr", [], [<$format, ["td", [], [<$format, ["link", [["node", "$help_driver_structure_expressions_errorhandling"]], ["error handling"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_driver_structure_statements_errorhandlingstatements"]], ["Error-Handling Statements"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_driver_errors"]], ["errors"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_driver_structure_expressions_expressionvariables"]], ["expression variables"], 'do_link]>], 'do_td]>], 'do_tr]>, <$format, ["tr", [], [<$format, ["td", [], [<$format, ["link", [["node", "$help_driver_structure_expressions"]], ["expressions"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_driver_fileintro"]], ["file intro"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_driver_functions"]], ["functions"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_driver_intro"]], ["intro"], 'do_link]>], 'do_td]>], 'do_tr]>, <$format, ["tr", [], [<$format, ["td", [], [<$format, ["link", [["node", "$help_driver_structure_expressions_loopingexpressions"]], ["looping expressions"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_driver_structure_statements_loopingstatements"]], ["looping statements"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_driver_methodintro"]], ["method intro"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_driver_networking"]], ["networking"], 'do_link]>], 'do_td]>], 'do_tr]>, <$format, ["tr", [], [<$format, ["td", [], [<$format, ["link", [["node", "$help_driver_objects_objectmethods"]], ["object methods"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_driver_objects_objectvariables"]], ["object variables"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_driver_objects"]], ["objects"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_prog_oop"]], ["oop"], 'do_link]>], 'do_td]>], 'do_tr]>, <$format, ["tr", [], [<$format, ["td", [], [<$format, ["link", [["node", "$help_driver_structure_expressions_operators"]], ["operators"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_driver_objects_referencing"]], ["referencing"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_driver_regularexpressions"]], ["regular expressions"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_driver_security"]], ["security"], 'do_link]>], 'do_td]>], 'do_tr]>, <$format, ["tr", [], [<$format, ["td", [], [<$format, ["link", [["node", "$help_driver_structure_statements_simplestatements"]], ["simple statements"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_driver_objects_special"]], ["special"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_driver_structure_expressions_splicing"]], ["splicing"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_driver_structure_statements"]], ["statements"], 'do_link]>], 'do_td]>], 'do_tr]>, <$format, ["tr", [], [<$format, ["td", [], [<$format, ["link", [["node", "$help_driver_structure"]], ["structure"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_driver_taskintro"]], ["task intro"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_driver_structure_tokens"]], ["tokens"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_driver_structure_types_typecomparison"]], ["type comparison"], 'do_link]>], 'do_td]>], 'do_tr]>, <$format, ["tr", [], [<$format, ["td", [], [<$format, ["link", [["node", "$help_driver_structure_types"]], ["types"], 'do_link]>], 'do_td]>], 'do_tr]>], 'do_table]>], #[['this, $help_index_driver]]]>; var $help_node links = #[["calling functions", $help_driver_structure_expressions_callingfunctions], ["calling methods", $help_driver_structure_expressions_callingmethods], ["conditional statements", $help_driver_structure_statements_conditionalstatements], ["Conventions", $help_driver_convention], ["error handling", $help_driver_structure_expressions_errorhandling], ["Error-Handling Statements", $help_driver_structure_statements_errorhandlingstatements], ["errors", $help_driver_errors], ["expression variables", $help_driver_structure_expressions_expressionvariables], ["expressions", $help_driver_structure_expressions], ["file intro", $help_driver_fileintro], ["functions", $help_functions], ["intro", $help_driver_intro], ["looping expressions", $help_driver_structure_expressions_loopingexpressions], ["looping statements", $help_driver_structure_statements_loopingstatements], ["method intro", $help_driver_methodintro], ["networking", $help_driver_networking], ["object methods", $help_driver_objects_objectmethods], ["object variables", $help_driver_objects_objectvariables], ["objects", $help_driver_objects], ["oop", $help_prog_oop], ["operators", $help_driver_structure_expressions_operators], ["referencing", $help_driver_objects_referencing], ["regular expressions", $help_driver_regularexpressions], ["security", $help_driver_security], ["simple statements", $help_driver_structure_statements_simplestatements], ["special", $help_driver_objects_special], ["splicing", $help_driver_structure_expressions_splicing], ["statements", $help_driver_structure_statements], ["structure", $help_driver_structure], ["task intro", $help_driver_taskintro], ["tokens", $help_driver_structure_tokens], ["type comparison", $help_driver_structure_types_typecomparison], ["types", $help_driver_structure_types]]; new object $help_index_core: $help_index; var $root manager = $help_index_core; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 837910430; var $db database = #[["Interaction", $help_interaction], ["the help_node_5", $help_commands_enhanced], ["an Overview", $help_cmds_set], ["Help", $help_help], ["show", #567], ["display", $help_cmds_display], ["help-link", #568], ["a VR", $help_commands_vr], ["a Command Types", $help_commands_types], ["a Matching Conventions", $help_commands_matching], ["an Enhanced Command Templates", $help_commands_enhanced], ["hnode", #557], ["hwrite", #569], ["hlist", $help_func_dict_add], ["program", #834], ["an Objects", $help_theme], ["an Environment", $help_environment], ["Objects", $help_objects], ["Theme", $help_theme], ["Conventions", $help_conventions], ["Interface", $help_interface], ["Navigating Help", $help_help_navigating], ["Help Options", $help_help_options], ["Format", $help_interface_format], ["Settings", $help_interface_settings], ["Building", $help_building], ["General Information", $help_general], ["Cold Help System", $help_core], ["Clients", $help_interface_client], ["Dynamic Text", $help_building_5], ["CML", $help_building_5], ["Commands", $help_commands], ["Programming Commands", $help_prog_commands], ["Formatting", $help_list_formatting], ["Maps", $help_list_maps], ["Sets", $help_list_sets], ["Other", $help_list_other], ["Element", $help_list_element]]; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "Core", "Core"]; var $registry stripped_characters = "!@#$%^&*()"; var $root trusted = [$help_node]; var $root inited = 1; var $root managed = [$help_index_core]; var $root owned = [$help_index_core]; var $help_node body = <$ctext_frob, [[<$format, ["table", [["cols", "25%,25%,25%,25%"]], [<$format, ["tr", [], [<$format, ["td", [], [<$format, ["link", [["node", "$help_commands_types"]], ["a Command Types"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_commands_matching"]], ["a Matching Conventions"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_commands_vr"]], ["a VR"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_commands_enhanced"]], ["an Enhanced Command Templates"], 'do_link]>], 'do_td]>], 'do_tr]>, <$format, ["tr", [], [<$format, ["td", [], [<$format, ["link", [["node", "$help_environment"]], ["an Environment"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_theme"]], ["an Objects"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_cmds_set"]], ["an Overview"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_building"]], ["Building"], 'do_link]>], 'do_td]>], 'do_tr]>, <$format, ["tr", [], [<$format, ["td", [], [<$format, ["link", [["node", "$help_interface_client"]], ["Clients"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_building_5"]], ["CML"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_core"]], ["Cold Help System"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_commands"]], ["Commands"], 'do_link]>], 'do_td]>], 'do_tr]>, <$format, ["tr", [], [<$format, ["td", [], [<$format, ["link", [["node", "$help_conventions"]], ["Conventions"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_cmds_display"]], ["display"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_building_5"]], ["Dynamic Text"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_list_element"]], ["Element"], 'do_link]>], 'do_td]>], 'do_tr]>, <$format, ["tr", [], [<$format, ["td", [], [<$format, ["link", [["node", "$help_interface_format"]], ["Format"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_list_formatting"]], ["Formatting"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_general"]], ["General Information"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_help"]], ["Help"], 'do_link]>], 'do_td]>], 'do_tr]>, <$format, ["tr", [], [<$format, ["td", [], [<$format, ["link", [["node", "$help_help_options"]], ["Help Options"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$place_164"]], ["help-link"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_dict_add"]], ["hlist"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$place_159"]], ["hnode"], 'do_link]>], 'do_td]>], 'do_tr]>, <$format, ["tr", [], [<$format, ["td", [], [<$format, ["link", [["node", "$place_165"]], ["hwrite"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_interaction"]], ["Interaction"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_interface"]], ["Interface"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_list_maps"]], ["Maps"], 'do_link]>], 'do_td]>], 'do_tr]>, <$format, ["tr", [], [<$format, ["td", [], [<$format, ["link", [["node", "$help_help_navigating"]], ["Navigating Help"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_objects"]], ["Objects"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_list_other"]], ["Other"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_cmds_program"]], ["program"], 'do_link]>], 'do_td]>], 'do_tr]>, <$format, ["tr", [], [<$format, ["td", [], [<$format, ["link", [["node", "$help_prog_commands"]], ["Programming Commands"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_list_sets"]], ["Sets"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_interface_settings"]], ["Settings"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$place_163_2"]], ["show"], 'do_link]>], 'do_td]>], 'do_tr]>, <$format, ["tr", [], [<$format, ["td", [], [<$format, ["link", [["node", "$help_commands_enhanced"]], ["the help_node_5"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_theme"]], ["Theme"], 'do_link]>], 'do_td]>], 'do_tr]>], 'do_table]>], #[['this, $help_index_core]]]>; var $help_node links = #[["a Command Types", $help_commands_types], ["a Matching Conventions", $help_commands_matching], ["a VR", $help_commands_vr], ["an Enhanced Command Templates", $help_commands_enhanced], ["an Environment", $help_environment], ["an Objects", $help_theme], ["an Overview", $help_cmds_set], ["Building", $help_building], ["Clients", $help_interface_client], ["CML", $help_building_5], ["Cold Help System", $help_core], ["Commands", $help_commands], ["Conventions", $help_conventions], ["display", $help_cmds_display], ["Dynamic Text", $help_building_5], ["Element", $help_list_element], ["Format", $help_interface_format], ["Formatting", $help_list_formatting], ["General Information", $help_general], ["Help", $help_help], ["Help Options", $help_help_options], ["help-link", #568], ["hlist", $help_func_dict_add], ["hnode", #557], ["hwrite", #569], ["Interaction", $help_interaction], ["Interface", $help_interface], ["Maps", $help_list_maps], ["Navigating Help", $help_help_navigating], ["Objects", $help_objects], ["Other", $help_list_other], ["program", #834], ["Programming Commands", $help_prog_commands], ["Sets", $help_list_sets], ["Settings", $help_interface_settings], ["show", #567], ["the help_node_5", $help_commands_enhanced], ["Theme", $help_theme]]; new object $help_index_cmds: $help_index; var $root manager = $help_index_cmds; var $help_node links = #[["@ac", $help_cmds_addcmd], ["@add-command", $help_cmds_addcmd], ["@add-setting", $help_cmds_addsetting], ["@adjust", $help_cmds_adjust], ["@backup", $help_cmds_backup], ["@core", $help_cmds_core], ["@display", $help_cmds_display], ["@kill", $help_cmds_kill], ["@mojo", $help_cmds_mojo], ["@new-password", $help_cmds_newpwd], ["@page", $help_cmds_page], ["@program", #834], ["@reap", $help_cmds_reap], ["@rehash-all", $help_cmds_rehashall], ["@set", $help_cmds_set], ["@shutdown", $help_cmds_shutdown], ["@tasks", $help_cmds_tasks], ["emote", $help_cmds_emote], ["paste", $help_cmds_paste], ["say", $help_cmds_say], ["spoof", $help_cmds_spoof], ["think", $help_cmds_think], ["to say", $help_cmds_tosay], ["whisper", $help_cmds_whisper]]; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 847043048; var $db database = #[["emote", $help_cmds_emote], ["to say", $help_cmds_tosay], ["whisper", $help_cmds_whisper], ["think", $help_cmds_think], ["spoof", $help_cmds_spoof], ["paste", $help_cmds_paste], ["say", $help_cmds_say], ["@display", $help_cmds_display], ["@page", $help_cmds_page], ["@set", $help_cmds_set], ["@add-setting", $help_cmds_addsetting], ["@adjust", $help_cmds_adjust], ["@mojo", $help_cmds_mojo], ["@new-password", $help_cmds_newpwd], ["@rehash-all", $help_cmds_rehashall], ["@backup", $help_cmds_backup], ["@shutdown", $help_cmds_shutdown], ["@tasks", $help_cmds_tasks], ["@kill", $help_cmds_kill], ["@reap", $help_cmds_reap], ["@core", $help_cmds_core], ["@add-command", $help_cmds_addcmd], ["@ac", $help_cmds_addcmd]]; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "Commands", "Commands"]; var $registry stripped_characters = "!#^$&*()"; var $root trusted = [$help_node]; var $root inited = 1; var $help_node body = <$ctext_frob, [[<$format, ["table", [["cols", "25%,25%,25%,25%"]], [<$format, ["tr", [], [<$format, ["td", [], [<$format, ["link", [["node", "$help_cmds_addcmd"]], ["@ac"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_cmds_addcmd"]], ["@add-command"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_cmds_addsetting"]], ["@add-setting"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_cmds_adjust"]], ["@adjust"], 'do_link]>], 'do_td]>], 'do_tr]>, <$format, ["tr", [], [<$format, ["td", [], [<$format, ["link", [["node", "$help_cmds_backup"]], ["@backup"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_cmds_core"]], ["@core"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_cmds_display"]], ["@display"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_cmds_kill"]], ["@kill"], 'do_link]>], 'do_td]>], 'do_tr]>, <$format, ["tr", [], [<$format, ["td", [], [<$format, ["link", [["node", "$help_cmds_mojo"]], ["@mojo"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_cmds_newpwd"]], ["@new-password"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_cmds_page"]], ["@page"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_cmds_program"]], ["@program"], 'do_link]>], 'do_td]>], 'do_tr]>, <$format, ["tr", [], [<$format, ["td", [], [<$format, ["link", [["node", "$help_cmds_reap"]], ["@reap"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_cmds_rehashall"]], ["@rehash-all"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_cmds_set"]], ["@set"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_cmds_shutdown"]], ["@shutdown"], 'do_link]>], 'do_td]>], 'do_tr]>, <$format, ["tr", [], [<$format, ["td", [], [<$format, ["link", [["node", "$help_cmds_tasks"]], ["@tasks"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_cmds_emote"]], ["emote"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_cmds_paste"]], ["paste"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_cmds_say"]], ["say"], 'do_link]>], 'do_td]>], 'do_tr]>, <$format, ["tr", [], [<$format, ["td", [], [<$format, ["link", [["node", "$help_cmds_spoof"]], ["spoof"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_cmds_think"]], ["think"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_cmds_tosay"]], ["to say"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_cmds_whisper"]], ["whisper"], 'do_link]>], 'do_td]>], 'do_tr]>], 'do_table]>], #[['this, $help_index_cmds]]]>; var $root managed = [$help_index_cmds]; var $root owned = [$help_index_cmds]; var $help_index dirty = 1; new object $help_index_subsystem: $help_index; var $root manager = $help_index_subsystem; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 847916269; var $has_name name = ['prop, "Subsystems", "Subsystems"]; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $help_node links = #[["Reference Library", $help_reference], ["Updates", $help_updates]]; var $help_node body = <$ctext_frob, [[<$format, ["table", [["cols", "25%,25%,25%,25%"]], [<$format, ["tr", [], [<$format, ["td", [], [<$format, ["link", [["node", "$help_reference"]], ["Reference Library"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_updates"]], ["Updates"], 'do_link]>], 'do_td]>], 'do_tr]>], 'do_table]>], #[['this, $help_index_subsystem]]]>; var $db database = #[["Reference Library", $help_reference], ["Updates", $help_updates]]; var $registry stripped_characters = "!#$%^&*()"; var $root trusted = [$help_node]; var $root inited = 1; var $root managed = [$help_index_subsystem]; var $root owned = [$help_index_subsystem]; new object $help_index_function: $help_index; var $root manager = $help_index_function; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 847916275; var $has_name name = ['prop, "Function", "Function"]; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $help_node links = #[["abs", $help_func_abs], ["add_method", $help_func_add_method], ["add_var", $help_func_add_var], ["ancestors", $help_func_ancestors], ["atomic", $help_func_atomic], ["backup", $help_func_backup], ["bind_function", $help_func_bind_function], ["bind_port", $help_func_bind_port], ["buf_replace", $help_func_buf_replace], ["buf_to_str", $help_func_buf_to_str], ["buf_to_strings", $help_func_buf_to_strings], ["bufgraft", $help_func_bufgraft], ["buflen", $help_func_buflen], ["caller", $help_func_caller], ["cancel", $help_func_cancel], ["children", $help_func_children], ["chparents", $help_func_chparents], ["class", $help_func_class], ["clear_var", $help_func_clear_var], ["close_connection", $help_func_close_connection], ["coldmud", $help_func_coldmud], ["coldmud_5", $help_func_coldmud_5], ["compile", $help_func_compile], ["connection", $help_func_connection], ["create", $help_func_create], ["crypt", $help_func_crypt], ["ctime", $help_func_ctime], ["cwrite", $help_func_cwrite], ["cwritef", $help_func_cwritef], ["data", $help_func_data], ["dblog", $help_func_dblog], ["definer", $help_func_definer], ["del_method", $help_func_del_method], ["del_objname", $help_func_del_objname], ["del_var", $help_func_del_var], ["delete", $help_func_delete], ["descendants", $help_func_descendants], ["destroy", $help_func_destroy], ["dict_add", $help_func_dict_add], ["dict_contains", $help_func_dict_contains], ["dict_del", $help_func_dict_del], ["dict_keys", $help_func_dict_keys], ["error", $help_func_error], ["execute", $help_func_execute], ["explode", $help_func_explode], ["fchmod", $help_func_fchmod], ["fclose", $help_func_fclose], ["feof", $help_func_feof], ["fflush", $help_func_fflush], ["file", $help_func_file], ["files", $help_func_files], ["find_method", $help_func_find_method], ["find_next_method", $help_func_find_next_method], ["fmkdir", $help_func_fmkdir], ["fopen", $help_func_fopen], ["fread", $help_func_fread], ["fremove", $help_func_fremove], ["frename", $help_func_frename], ["frmdir", $help_func_frmdir], ["fseek", $help_func_fseek], ["fstat", $help_func_fstat], ["fwrite", $help_func_fwrite], ["get_var", $help_func_get_var], ["has_ancestor", $help_func_has_ancestor], ["insert", $help_func_insert], ["join", $help_func_join], ["list_method", $help_func_list_method], ["listgraft", $help_func_listgraft], ["listlen", $help_func_listlen], ["localtime", $help_func_localtime], ["lookup", $help_func_lookup], ["lowercase", $help_func_lowercase], ["match_begin", $help_func_match_begin], ["match_pattern", $help_func_match_pattern], ["match_regexp", $help_func_match_regexp], ["match_template", $help_func_match_template], ["math", $help_func_math], ["max", $help_func_max], ["method", $help_func_method], ["method_access", $help_func_method_access], ["method_bytecode", $help_func_method_bytecode], ["method_flags", $help_func_method_flags], ["method_info", $help_func_method_info], ["methods", $help_func_methods], ["min", $help_func_min], ["mtime", $help_func_mtime], ["objname", $help_func_objname], ["objnum", $help_func_objnum], ["open_connection", $help_func_open_connection], ["pad", $help_func_pad], ["parents", $help_func_parents], ["pause", $help_func_pause], ["random", $help_func_random], ["reassign_connection", $help_func_reassign_connection], ["refresh", $help_func_refresh], ["regexp", $help_func_regexp], ["rename_method", $help_func_rename_method], ["replace", $help_func_replace], ["resume", $help_func_resume], ["rethrow", $help_func_rethrow], ["sender", $help_func_sender], ["set_heartbeat", $help_func_set_heartbeat], ["set_method_access", $help_func_set_method_access], ["set_method_flags", $help_func_set_method_flags], ["set_objname", $help_func_set_objname], ["set_var", $help_func_set_var], ["setadd", $help_func_setadd], ["setremove", $help_func_setremove], ["shutdown", $help_func_shutdown], ["size", $help_func_size], ["stack", $help_func_stack], ["str_to_buf", $help_func_str_to_buf], ["strcmp", $help_func_strcmp], ["strfmt", $help_func_strfmt], ["strgraft", $help_func_strgraft], ["strings_to_buf", $help_func_strings_to_buf], ["strlen", $help_func_strlen], ["strsed", $help_func_strsed], ["strsub", $help_func_strsub], ["subbuf", $help_func_subbuf], ["sublist", $help_func_sublist], ["substr", $help_func_substr], ["suspend", $help_func_suspend], ["task_id", $help_func_task_id], ["tasks", $help_func_tasks], ["this", $help_func_this], ["throw", $help_func_throw], ["tick", $help_func_tick], ["ticks_left", $help_func_ticks_left], ["time", $help_func_time], ["toerr", $help_func_toerr], ["tofloat", $help_func_tofloat], ["toint", $help_func_toint], ["toliteral", $help_func_toliteral], ["toobjnum", $help_func_toobjnum], ["tostr", $help_func_tostr], ["tosym", $help_func_tosym], ["traceback", $help_func_traceback], ["type", $help_func_type], ["unbind_function", $help_func_unbind_function], ["unbind_port", $help_func_unbind_port], ["union", $help_func_union], ["uppercase", $help_func_uppercase], ["valid", $help_func_valid], ["variables", $help_func_variables]]; var $help_node body = <$ctext_frob, [[<$format, ["table", [["cols", "25%,25%,25%,25%"]], [<$format, ["tr", [], [<$format, ["td", [], [<$format, ["link", [["node", "$help_func_abs"]], ["abs"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_add_method"]], ["add_method"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_add_var"]], ["add_var"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_ancestors"]], ["ancestors"], 'do_link]>], 'do_td]>], 'do_tr]>, <$format, ["tr", [], [<$format, ["td", [], [<$format, ["link", [["node", "$help_func_atomic"]], ["atomic"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_backup"]], ["backup"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_bind_function"]], ["bind_function"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_bind_port"]], ["bind_port"], 'do_link]>], 'do_td]>], 'do_tr]>, <$format, ["tr", [], [<$format, ["td", [], [<$format, ["link", [["node", "$help_func_buf_replace"]], ["buf_replace"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_buf_to_str"]], ["buf_to_str"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_buf_to_strings"]], ["buf_to_strings"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_bufgraft"]], ["bufgraft"], 'do_link]>], 'do_td]>], 'do_tr]>, <$format, ["tr", [], [<$format, ["td", [], [<$format, ["link", [["node", "$help_func_buflen"]], ["buflen"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_caller"]], ["caller"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_cancel"]], ["cancel"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_children"]], ["children"], 'do_link]>], 'do_td]>], 'do_tr]>, <$format, ["tr", [], [<$format, ["td", [], [<$format, ["link", [["node", "$help_func_chparents"]], ["chparents"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_class"]], ["class"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_clear_var"]], ["clear_var"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_close_connection"]], ["close_connection"], 'do_link]>], 'do_td]>], 'do_tr]>, <$format, ["tr", [], [<$format, ["td", [], [<$format, ["link", [["node", "$help_func_coldmud"]], ["coldmud"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_coldmud_5"]], ["coldmud_5"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_compile"]], ["compile"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_connection"]], ["connection"], 'do_link]>], 'do_td]>], 'do_tr]>, <$format, ["tr", [], [<$format, ["td", [], [<$format, ["link", [["node", "$help_func_create"]], ["create"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_crypt"]], ["crypt"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_ctime"]], ["ctime"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_cwrite"]], ["cwrite"], 'do_link]>], 'do_td]>], 'do_tr]>, <$format, ["tr", [], [<$format, ["td", [], [<$format, ["link", [["node", "$help_func_cwritef"]], ["cwritef"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_data"]], ["data"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_dblog"]], ["dblog"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_definer"]], ["definer"], 'do_link]>], 'do_td]>], 'do_tr]>, <$format, ["tr", [], [<$format, ["td", [], [<$format, ["link", [["node", "$help_func_del_method"]], ["del_method"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_del_objname"]], ["del_objname"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_del_var"]], ["del_var"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_delete"]], ["delete"], 'do_link]>], 'do_td]>], 'do_tr]>, <$format, ["tr", [], [<$format, ["td", [], [<$format, ["link", [["node", "$help_func_descendants"]], ["descendants"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_destroy"]], ["destroy"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_dict_add"]], ["dict_add"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_dict_contains"]], ["dict_contains"], 'do_link]>], 'do_td]>], 'do_tr]>, <$format, ["tr", [], [<$format, ["td", [], [<$format, ["link", [["node", "$help_func_dict_del"]], ["dict_del"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_dict_keys"]], ["dict_keys"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_error"]], ["error"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_execute"]], ["execute"], 'do_link]>], 'do_td]>], 'do_tr]>, <$format, ["tr", [], [<$format, ["td", [], [<$format, ["link", [["node", "$help_func_explode"]], ["explode"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_fchmod"]], ["fchmod"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_fclose"]], ["fclose"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_feof"]], ["feof"], 'do_link]>], 'do_td]>], 'do_tr]>, <$format, ["tr", [], [<$format, ["td", [], [<$format, ["link", [["node", "$help_func_fflush"]], ["fflush"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_file"]], ["file"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_files"]], ["files"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_find_method"]], ["find_method"], 'do_link]>], 'do_td]>], 'do_tr]>, <$format, ["tr", [], [<$format, ["td", [], [<$format, ["link", [["node", "$help_func_find_next_method"]], ["find_next_method"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_fmkdir"]], ["fmkdir"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_fopen"]], ["fopen"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_fread"]], ["fread"], 'do_link]>], 'do_td]>], 'do_tr]>, <$format, ["tr", [], [<$format, ["td", [], [<$format, ["link", [["node", "$help_func_fremove"]], ["fremove"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_frename"]], ["frename"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_frmdir"]], ["frmdir"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_fseek"]], ["fseek"], 'do_link]>], 'do_td]>], 'do_tr]>, <$format, ["tr", [], [<$format, ["td", [], [<$format, ["link", [["node", "$help_func_fstat"]], ["fstat"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_fwrite"]], ["fwrite"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_get_var"]], ["get_var"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_has_ancestor"]], ["has_ancestor"], 'do_link]>], 'do_td]>], 'do_tr]>, <$format, ["tr", [], [<$format, ["td", [], [<$format, ["link", [["node", "$help_func_insert"]], ["insert"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_join"]], ["join"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_list_method"]], ["list_method"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_listgraft"]], ["listgraft"], 'do_link]>], 'do_td]>], 'do_tr]>, <$format, ["tr", [], [<$format, ["td", [], [<$format, ["link", [["node", "$help_func_listlen"]], ["listlen"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_localtime"]], ["localtime"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_lookup"]], ["lookup"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_lowercase"]], ["lowercase"], 'do_link]>], 'do_td]>], 'do_tr]>, <$format, ["tr", [], [<$format, ["td", [], [<$format, ["link", [["node", "$help_func_match_begin"]], ["match_begin"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_match_pattern"]], ["match_pattern"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_match_regexp"]], ["match_regexp"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_match_template"]], ["match_template"], 'do_link]>], 'do_td]>], 'do_tr]>, <$format, ["tr", [], [<$format, ["td", [], [<$format, ["link", [["node", "$help_func_math"]], ["math"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_max"]], ["max"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_method"]], ["method"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_method_access"]], ["method_access"], 'do_link]>], 'do_td]>], 'do_tr]>, <$format, ["tr", [], [<$format, ["td", [], [<$format, ["link", [["node", "$help_func_method_bytecode"]], ["method_bytecode"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_method_flags"]], ["method_flags"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_method_info"]], ["method_info"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_methods"]], ["methods"], 'do_link]>], 'do_td]>], 'do_tr]>, <$format, ["tr", [], [<$format, ["td", [], [<$format, ["link", [["node", "$help_func_min"]], ["min"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_mtime"]], ["mtime"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_objname"]], ["objname"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_objnum"]], ["objnum"], 'do_link]>], 'do_td]>], 'do_tr]>, <$format, ["tr", [], [<$format, ["td", [], [<$format, ["link", [["node", "$help_func_open_connection"]], ["open_connection"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_pad"]], ["pad"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_parents"]], ["parents"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_pause"]], ["pause"], 'do_link]>], 'do_td]>], 'do_tr]>, <$format, ["tr", [], [<$format, ["td", [], [<$format, ["link", [["node", "$help_func_random"]], ["random"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_reassign_connection"]], ["reassign_connection"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_refresh"]], ["refresh"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_regexp"]], ["regexp"], 'do_link]>], 'do_td]>], 'do_tr]>, <$format, ["tr", [], [<$format, ["td", [], [<$format, ["link", [["node", "$help_func_rename_method"]], ["rename_method"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_replace"]], ["replace"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_resume"]], ["resume"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_rethrow"]], ["rethrow"], 'do_link]>], 'do_td]>], 'do_tr]>, <$format, ["tr", [], [<$format, ["td", [], [<$format, ["link", [["node", "$help_func_sender"]], ["sender"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_set_heartbeat"]], ["set_heartbeat"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_set_method_access"]], ["set_method_access"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_set_method_flags"]], ["set_method_flags"], 'do_link]>], 'do_td]>], 'do_tr]>, <$format, ["tr", [], [<$format, ["td", [], [<$format, ["link", [["node", "$help_func_set_objname"]], ["set_objname"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_set_var"]], ["set_var"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_setadd"]], ["setadd"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_setremove"]], ["setremove"], 'do_link]>], 'do_td]>], 'do_tr]>, <$format, ["tr", [], [<$format, ["td", [], [<$format, ["link", [["node", "$help_func_shutdown"]], ["shutdown"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_size"]], ["size"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_stack"]], ["stack"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_str_to_buf"]], ["str_to_buf"], 'do_link]>], 'do_td]>], 'do_tr]>, <$format, ["tr", [], [<$format, ["td", [], [<$format, ["link", [["node", "$help_func_strcmp"]], ["strcmp"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_strfmt"]], ["strfmt"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_strgraft"]], ["strgraft"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_strings_to_buf"]], ["strings_to_buf"], 'do_link]>], 'do_td]>], 'do_tr]>, <$format, ["tr", [], [<$format, ["td", [], [<$format, ["link", [["node", "$help_func_strlen"]], ["strlen"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_strsed"]], ["strsed"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_strsub"]], ["strsub"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_subbuf"]], ["subbuf"], 'do_link]>], 'do_td]>], 'do_tr]>, <$format, ["tr", [], [<$format, ["td", [], [<$format, ["link", [["node", "$help_func_sublist"]], ["sublist"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_substr"]], ["substr"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_suspend"]], ["suspend"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_task_id"]], ["task_id"], 'do_link]>], 'do_td]>], 'do_tr]>, <$format, ["tr", [], [<$format, ["td", [], [<$format, ["link", [["node", "$help_func_tasks"]], ["tasks"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_this"]], ["this"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_throw"]], ["throw"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_tick"]], ["tick"], 'do_link]>], 'do_td]>], 'do_tr]>, <$format, ["tr", [], [<$format, ["td", [], [<$format, ["link", [["node", "$help_func_ticks_left"]], ["ticks_left"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_time"]], ["time"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_toerr"]], ["toerr"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_tofloat"]], ["tofloat"], 'do_link]>], 'do_td]>], 'do_tr]>, <$format, ["tr", [], [<$format, ["td", [], [<$format, ["link", [["node", "$help_func_toint"]], ["toint"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_toliteral"]], ["toliteral"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_toobjnum"]], ["toobjnum"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_tostr"]], ["tostr"], 'do_link]>], 'do_td]>], 'do_tr]>, <$format, ["tr", [], [<$format, ["td", [], [<$format, ["link", [["node", "$help_func_tosym"]], ["tosym"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_traceback"]], ["traceback"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_type"]], ["type"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_unbind_function"]], ["unbind_function"], 'do_link]>], 'do_td]>], 'do_tr]>, <$format, ["tr", [], [<$format, ["td", [], [<$format, ["link", [["node", "$help_func_unbind_port"]], ["unbind_port"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_union"]], ["union"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_uppercase"]], ["uppercase"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_func_valid"]], ["valid"], 'do_link]>], 'do_td]>], 'do_tr]>, <$format, ["tr", [], [<$format, ["td", [], [<$format, ["link", [["node", "$help_func_variables"]], ["variables"], 'do_link]>], 'do_td]>], 'do_tr]>], 'do_table]>], #[['this, $help_index_function]]]>; var $db database = #[["abs", $help_func_abs], ["add_method", $help_func_add_method], ["add_var", $help_func_add_var], ["ancestors", $help_func_ancestors], ["atomic", $help_func_atomic], ["backup", $help_func_backup], ["bind_function", $help_func_bind_function], ["bind_port", $help_func_bind_port], ["buf_replace", $help_func_buf_replace], ["buf_to_str", $help_func_buf_to_str], ["buf_to_strings", $help_func_buf_to_strings], ["bufgraft", $help_func_bufgraft], ["buflen", $help_func_buflen], ["caller", $help_func_caller], ["cancel", $help_func_cancel], ["children", $help_func_children], ["chparents", $help_func_chparents], ["class", $help_func_class], ["clear_var", $help_func_clear_var], ["close_connection", $help_func_close_connection], ["coldmud", $help_func_coldmud], ["coldmud_5", $help_func_coldmud_5], ["compile", $help_func_compile], ["connection", $help_func_connection], ["create", $help_func_create], ["crypt", $help_func_crypt], ["ctime", $help_func_ctime], ["cwrite", $help_func_cwrite], ["cwritef", $help_func_cwritef], ["data", $help_func_data], ["dblog", $help_func_dblog], ["list_method", $help_func_list_method], ["definer", $help_func_definer], ["del_method", $help_func_del_method], ["del_objname", $help_func_del_objname], ["del_var", $help_func_del_var], ["delete", $help_func_delete], ["descendants", $help_func_descendants], ["destroy", $help_func_destroy], ["dict_add", $help_func_dict_add], ["dict_contains", $help_func_dict_contains], ["dict_del", $help_func_dict_del], ["dict_keys", $help_func_dict_keys], ["error", $help_func_error], ["execute", $help_func_execute], ["explode", $help_func_explode], ["fchmod", $help_func_fchmod], ["fclose", $help_func_fclose], ["feof", $help_func_feof], ["fflush", $help_func_fflush], ["file", $help_func_file], ["files", $help_func_files], ["find_method", $help_func_find_method], ["find_next_method", $help_func_find_next_method], ["fmkdir", $help_func_fmkdir], ["fopen", $help_func_fopen], ["fread", $help_func_fread], ["fremove", $help_func_fremove], ["frename", $help_func_frename], ["frmdir", $help_func_frmdir], ["fseek", $help_func_fseek], ["fstat", $help_func_fstat], ["fwrite", $help_func_fwrite], ["method_bytecode", $help_func_method_bytecode], ["get_var", $help_func_get_var], ["has_ancestor", $help_func_has_ancestor], ["insert", $help_func_insert], ["join", $help_func_join], ["listgraft", $help_func_listgraft], ["listlen", $help_func_listlen], ["localtime", $help_func_localtime], ["lookup", $help_func_lookup], ["lowercase", $help_func_lowercase], ["match_begin", $help_func_match_begin], ["match_pattern", $help_func_match_pattern], ["match_regexp", $help_func_match_regexp], ["match_template", $help_func_match_template], ["math", $help_func_math], ["max", $help_func_max], ["method", $help_func_method], ["method_access", $help_func_method_access], ["method_flags", $help_func_method_flags], ["method_info", $help_func_method_info], ["methods", $help_func_methods], ["min", $help_func_min], ["mtime", $help_func_mtime], ["objname", $help_func_objname], ["objnum", $help_func_objnum], ["open_connection", $help_func_open_connection], ["pad", $help_func_pad], ["parents", $help_func_parents], ["pause", $help_func_pause], ["random", $help_func_random], ["reassign_connection", $help_func_reassign_connection], ["refresh", $help_func_refresh], ["regexp", $help_func_regexp], ["rename_method", $help_func_rename_method], ["replace", $help_func_replace], ["resume", $help_func_resume], ["rethrow", $help_func_rethrow], ["sender", $help_func_sender], ["set_heartbeat", $help_func_set_heartbeat], ["set_method_access", $help_func_set_method_access], ["set_method_flags", $help_func_set_method_flags], ["set_objname", $help_func_set_objname], ["set_var", $help_func_set_var], ["setadd", $help_func_setadd], ["setremove", $help_func_setremove], ["size", $help_func_size], ["stack", $help_func_stack], ["str_to_buf", $help_func_str_to_buf], ["strcmp", $help_func_strcmp], ["strfmt", $help_func_strfmt], ["strgraft", $help_func_strgraft], ["strings_to_buf", $help_func_strings_to_buf], ["strlen", $help_func_strlen], ["strsed", $help_func_strsed], ["strsub", $help_func_strsub], ["subbuf", $help_func_subbuf], ["sublist", $help_func_sublist], ["substr", $help_func_substr], ["suspend", $help_func_suspend], ["task_id", $help_func_task_id], ["tasks", $help_func_tasks], ["this", $help_func_this], ["throw", $help_func_throw], ["tick", $help_func_tick], ["ticks_left", $help_func_ticks_left], ["time", $help_func_time], ["toerr", $help_func_toerr], ["tofloat", $help_func_tofloat], ["toint", $help_func_toint], ["toliteral", $help_func_toliteral], ["toobjnum", $help_func_toobjnum], ["tostr", $help_func_tostr], ["tosym", $help_func_tosym], ["traceback", $help_func_traceback], ["type", $help_func_type], ["unbind_function", $help_func_unbind_function], ["unbind_port", $help_func_unbind_port], ["union", $help_func_union], ["uppercase", $help_func_uppercase], ["valid", $help_func_valid], ["variables", $help_func_variables], ["shutdown", $help_func_shutdown]]; var $registry stripped_characters = "!#$%^&*()"; var $root trusted = [$help_node]; var $root inited = 1; var $root managed = [$help_index_function]; var $root owned = [$help_index_function]; new object $help_index_objects: $help_index; var $root manager = $help_index_objects; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 847917435; var $has_name name = ['prop, "Objects", "Objects"]; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $help_node links = #[["Events", $help_obj_events], ["List", $help_node_list]]; var $help_node body = <$ctext_frob, [[<$format, ["table", [["cols", "25%,25%,25%,25%"]], [<$format, ["tr", [], [<$format, ["td", [], [<$format, ["link", [["node", "$help_obj_events"]], ["Events"], 'do_link]>], 'do_td]>, <$format, ["td", [], [<$format, ["link", [["node", "$help_node_list"]], ["List"], 'do_link]>], 'do_td]>], 'do_tr]>], 'do_table]>], #[['this, $help_index_objects]]]>; var $db database = #[["Events", $help_obj_events], ["List", $help_node_list]]; var $registry stripped_characters = "!#$%^&*()"; var $root trusted = [$help_node]; var $root inited = 1; var $root managed = [$help_index_objects]; var $root owned = [$help_index_objects]; new object $help_cmds: $help_node; var $root manager = $help_cmds; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 847128224; var $root owned = [$help_cmds]; var $has_settings defined_settings = #[]; var $has_settings local_settings = ["group", "nolist"]; var $has_settings settings = #[]; var $has_name name = ['prop, "Commands", "Commands"]; var $root managed = [$help_cmds]; var $help_node links = #[]; var $help_node body = <$ctext_frob, [["This node is simply a place holder, and should not be linked in through an index or anything. If you see it, something has gone wrong."], #[['this, $help_cmds]]]>; var $root inited = 1; var $help_node group = 1; var $help_node nolist = 1; var $root child_index = 11; public method .nolist() { arg [args]; // all 'command' nodes are nolist return 1; }; public method .top_of_help_heirarchy() { return definer() == this(); }; new object $help_cmds_say: $help_cmds; var $root manager = $help_cmds_say; var $root owned = [$help_cmds_say]; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 847043470; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "say", "say"]; var $root managed = [$help_cmds_say]; var $help_node links = #[]; var $help_node body = <$ctext_frob, [[<$format, ["p", [], [], 'do_p]>, "The interaction command ", <$format, ["tt", [], ["say"], 'do_tt]>, " is used to speak and talk to others. For convenience, the double-quote character may also be used as a shortcut. ", <$format, ["p", [], [], 'do_p]>, "Examples: ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["dfn", [], ["> say Hi", <$format, ["br", [], [], 'do_br]>, "Brandon says, \"Hi\""], 'do_dfn]>, " ", <$format, ["dfn", [], ["> \"whats up?", <$format, ["br", [], [], 'do_br]>, "Brandon says, \"whats up?\""], 'do_dfn]>], #[['this, $help_cmds_say]]]>; var $root inited = 1; var $help_node index = $help_index_cmds; new object $help_cmds_emote: $help_cmds; var $root manager = $help_cmds_emote; var $root owned = [$help_cmds_emote]; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 847043476; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "emote", "emote"]; var $root managed = [$help_cmds_emote]; var $help_node links = #[]; var $help_node body = <$ctext_frob, [[<$format, ["p", [], [], 'do_p]>, "The interaction command ", <$format, ["tt", [], ["emote"], 'do_tt]>, " is used for free-form actions. For convenience, the colon character may also be used as a shortcut. ", <$format, ["p", [], [], 'do_p]>, "Examples: ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["dfn", [], ["> emote waves to everybody", <$format, ["br", [], [], 'do_br]>, "Brandon waves to everybody"], 'do_dfn]>, " ", <$format, ["dfn", [], ["> :jumps up and down", <$format, ["br", [], [], 'do_br]>, "Brandon jumps up and down"], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, "You can get rid of the space after your name, by doubling up the colon: ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["dfn", [], ["> ::'s head hurts", <$format, ["br", [], [], 'do_br]>, "Brandon's head hurts"], 'do_dfn]>], #[['this, $help_cmds_emote]]]>; var $root inited = 1; var $help_node index = $help_index_cmds; new object $help_cmds_tosay: $help_cmds; var $root manager = $help_cmds_tosay; var $root owned = [$help_cmds_tosay]; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 847043714; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "to say", "to say"]; var $root managed = [$help_cmds_tosay]; var $help_node links = #[]; var $help_node body = <$ctext_frob, [[<$format, ["p", [], [], 'do_p]>, "Syntax: ", <$format, ["tt", [], ["to <target> say <anything>"], 'do_tt]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "The interaction command ", <$format, ["tt", [], ["to"], 'do_tt]>, " is used to speak and talk to a specific person (<target>). For convenience, the single-quote character may be used as a shortcut. Examples: ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["dfn", [], ["> to Miro say Hi", <$format, ["br", [], [], 'do_br]>, "Brandon (to Miro) says, \"Hi\""], 'do_dfn]>, " ", <$format, ["dfn", [], ["> 'Miro whats up?", <$format, ["br", [], [], 'do_br]>, "Brandon (to Miro) says, \"whats up?\""], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, "As with any directed interaction command, you can double up the shortcut character to send to the last person you directed to. Example: ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["dfn", [], ["> 'Miro say Hi ", <$format, ["br", [], [], 'do_br]>, "Brandon (to Miro) says, \"Hi\" ", <$format, ["br", [], [], 'do_br]>, "> ''how is the weather? ", <$format, ["br", [], [], 'do_br]>, "Brandon (to Miro) asks, \"How is the weather?\""], 'do_dfn]>], #[['this, $help_cmds_tosay]]]>; var $root inited = 1; var $help_node index = $help_index_cmds; new object $help_cmds_whisper: $help_cmds; var $root manager = $help_cmds_whisper; var $root owned = [$help_cmds_whisper]; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 847043723; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "whisper", "whisper"]; var $root managed = [$help_cmds_whisper]; var $help_node links = #[]; var $help_node body = <$ctext_frob, [[<$format, ["p", [], [], 'do_p]>, "Syntax: ", <$format, ["tt", [], ["whisper <anything> to <target>"], 'do_tt]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "The interaction command ", <$format, ["tt", [], ["whisper"], 'do_tt]>, " is used to speak and talk privately to a specific person (<target>). Example: ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["dfn", [], ["> whisper the Red Man is in Tibet to Brian ", <$format, ["br", [], [], 'do_br]>, "You whisper, \"the Red Man is in Tibet\" to Brian"], 'do_dfn]>], #[['this, $help_cmds_whisper]]]>; var $root inited = 1; var $help_node index = $help_index_cmds; new object $help_cmds_page: $help_cmds; var $root manager = $help_cmds_page; var $root owned = [$help_cmds_page]; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 847043729; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "@page", "@page"]; var $root managed = [$help_cmds_page]; var $help_node links = #[["say", $help_cmds_say], ["emote", $help_cmds_emote]]; var $help_node body = <$ctext_frob, [[<$format, ["p", [], [], 'do_p]>, "Syntax: ", <$format, ["tt", [], ["@page <who>[,<who>..] with <anything>"], 'do_tt]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "The non-VR interaction command ", <$format, ["tt", [], ["@page"], 'do_tt]>, " is used to interact with one or more people not in the room. For convenience, the dash character may also be used as a shortcut. Examples: ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["dfn", [], ["> @page Amy with dinner tonight?", <$format, ["br", [], [], 'do_br]>, "[to Amy] Brandon says, \"dinner tonight?\""], 'do_dfn]>, " ", <$format, ["dfn", [], ["> -Miro Hi", <$format, ["br", [], [], 'do_br]>, "[to Miro] Brandon says, \"Hi\""], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, "The people receiving the message see your location inside the square brackets, instead of who it is being directed to, such as [from The Pit] instead of [to Amy]. ", <$format, ["p", [], [], 'do_p]>, "The default style of interaction is speach (similar to ", <$format, ["link", [["node", "$help_cmds_say"]], ["say"], 'do_link]>, "), you can also ", <$format, ["link", [["node", "$help_cmds_emote"]], ["emote"], 'do_link]>, " in page, by beginning your message with a colon: ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["dfn", [], ["> @page Brian with :waves", <$format, ["br", [], [], 'do_br]>, "[to Brian] Brandon waves"], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, "As with any directed interaction command, you can double up the shortcut character to send to the last person you directed to. Example: ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["dfn", [], ["> -Brian :waves", <$format, ["br", [], [], 'do_br]>, "[to Brian] Brandon waves ", <$format, ["br", [], [], 'do_br]>, "> --how goes it?", <$format, ["br", [], [], 'do_br]>, "[to Brian] Brandon says, \"how goes it?\""], 'do_dfn]>], #[['this, $help_cmds_page]]]>; var $root inited = 1; var $help_node index = $help_index_cmds; new object $help_cmds_think: $help_cmds; var $root manager = $help_cmds_think; var $root owned = [$help_cmds_think]; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 847043935; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "think", "think"]; var $root managed = [$help_cmds_think]; var $help_node links = #[]; var $help_node body = <$ctext_frob, [[<$format, ["p", [], [], 'do_p]>, "The interaction command ", <$format, ["tt", [], ["think"], 'do_tt]>, " is used to think something out loud. For convenience, the percent character may also be used as a shortcut. Examples: ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["dfn", [], ["> think oops", <$format, ["br", [], [], 'do_br]>, "Brandon . o O ( oops )"], 'do_dfn]>, " ", <$format, ["dfn", [], ["> %I think everybody can see my thoughts ", <$format, ["br", [], [], 'do_br]>, "Brandon . o O ( I think everybody can see my thoughts )"], 'do_dfn]>], #[['this, $help_cmds_think]]]>; var $root inited = 1; var $help_node index = $help_index_cmds; new object $help_cmds_spoof: $help_cmds; var $root manager = $help_cmds_spoof; var $root owned = [$help_cmds_spoof]; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 847043939; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "spoof", "spoof"]; var $root managed = [$help_cmds_spoof]; var $help_node links = #[["emote", $help_cmds_emote]]; var $help_node body = <$ctext_frob, [[<$format, ["p", [], [], 'do_p]>, "The interaction command ", <$format, ["tt", [], ["spoof"], 'do_tt]>, " is used similar to ", <$format, ["link", [["node", "$help_cmds_emote"]], ["emote"], 'do_link]>, ", except your name does not start the line. This is usually used to format your actions in a different way, but can be used to 'spoof' actions from other players--which can be considered rude (be careful when using it so as to not offend anybody). If your name does not appear in the line, it will be appended for attribution. For convenience, the exclaimation point may also be used as a shortcut. Examples: ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["dfn", [], ["> spoof Miro slips and falls.", <$format, ["br", [], [], 'do_br]>, "Miro slips and falls. -- Brandon"], 'do_dfn]>, " ", <$format, ["dfn", [], ["> !The big beast pounces on Brandon, pummelling him silly ", <$format, ["br", [], [], 'do_br]>, "The big beast pounces on Brandon, pummelling him silly"], 'do_dfn]>], #[['this, $help_cmds_spoof]]]>; var $root inited = 1; var $help_node index = $help_index_cmds; new object $help_cmds_paste: $help_cmds; var $root manager = $help_cmds_paste; var $root owned = [$help_cmds_paste]; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 847044098; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "@paste", "@paste"]; var $root managed = [$help_cmds_paste]; var $help_node links = #[]; var $help_node body = <$ctext_frob, [[<$format, ["p", [], [], 'do_p]>, "Syntax: ", <$format, ["tt", [], ["@paste [to <target>]"], 'do_tt]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "The non-VR interaction command ", <$format, ["tt", [], ["@paste"], 'do_tt]>, " is used to display blocks of text either to the room or to a specific person (<target>). If no target is specified, it is displayed to the room. You will be prompted for the text. When you are finished typing in the text, type a period at the beginning of a line, followed bo no other characters. Example: ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["dfn", [], [<$format, ["quote", [], ["> @paste\nReceiving input. Enter \".\" to finish or \"@abort\" to abort.\n> USER PID %CPU %MEM VSZ RSS COMMAND\n> brandon 10267 0.0 19.4 5800 5928 ./genesis\n> .\n-------------- Brandon (@paste's) ---------------\nUSER PID %CPU %MEM VSZ RSS COMMAND \nbrandon 10267 0.0 19.4 5800 5928 ./genesis \n------------------- + Finis + -------------------\n2 lines of text pasted"], 'do_quote]>], 'do_dfn]>], #[['this, $help_cmds_paste]]]>; var $root inited = 1; var $help_node index = $help_index_cmds; new object $help_cmds_shortcuts: $help_cmds; var $root manager = $help_cmds_shortcuts; var $root owned = [$help_cmds_shortcuts]; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 847044102; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "Unnamed Interaction Shortcuts", "Unnamed Interaction Shortcuts"]; var $root managed = [$help_cmds_shortcuts]; var $help_node links = #[["emote", $help_cmds_emote], ["say", $help_cmds_say]]; var $help_node body = <$ctext_frob, [[<$format, ["p", [], [], 'do_p]>, "In addition to the standard interaction commands there are also a few which do not have names: ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["table", [["cols", "10%,10%,80%"]], [<$format, ["tr", [], [<$format, ["td", [], [], 'do_td]>, <$format, ["td", [], [<$format, ["b", [], [<$format, ["tt", [], ["|"], 'do_tt]>], 'do_b]>], 'do_td]>, <$format, ["td", [], ["This is used to display one line of information, such as: ", <$format, ["p", [], [], 'do_p]>, <$format, ["dfn", [], ["> |test", <$format, ["br", [], [], 'do_br]>, "Brandon | test"], 'do_dfn]>], 'do_td]>], 'do_tr]>, <$format, ["tr", [], [<$format, ["td", [], [], 'do_td]>, <$format, ["td", [], [<$format, ["b", [], [<$format, ["tt", [], ["<"], 'do_tt]>], 'do_b]>], 'do_td]>, <$format, ["td", [], ["This is used to point at yourself, such as: ", <$format, ["p", [], [], 'do_p]>, <$format, ["dfn", [], ["> <stupid", <$format, ["br", [], [], 'do_br]>, "Brandon <- stupid"], 'do_dfn]>], 'do_td]>], 'do_tr]>, <$format, ["tr", [], [<$format, ["td", [], [], 'do_td]>, <$format, ["td", [], [<$format, ["b", [], [<$format, ["tt", [], ["]"], 'do_tt]>], 'do_b]>], 'do_td]>, <$format, ["td", [], ["Similar to ", <$format, ["link", [["node", "$help_cmds_emote"]], ["emote"], 'do_link]>, " but it encases the text in square brackets: ", <$format, ["p", [], [], 'do_p]>, <$format, ["dfn", [], ["> ]deflates", <$format, ["br", [], [], 'do_br]>, "[Brandon deflates]"], 'do_dfn]>], 'do_td]>], 'do_tr]>, <$format, ["tr", [], [<$format, ["td", [], [], 'do_td]>, <$format, ["td", [], [<$format, ["b", [], [<$format, ["tt", [], [")"], 'do_tt]>], 'do_b]>], 'do_td]>, <$format, ["td", [], ["This is the same as the above shortcut, but with parenthesis: ", <$format, ["p", [], [], 'do_p]>, <$format, ["dfn", [], ["> )deflates", <$format, ["br", [], [], 'do_br]>, "(Brandon deflates)"], 'do_dfn]>], 'do_td]>], 'do_tr]>, <$format, ["tr", [], [<$format, ["td", [], [], 'do_td]>, <$format, ["td", [], [<$format, ["b", [], [<$format, ["tt", [], [",,"], 'do_tt]>], 'do_b]>], 'do_td]>, <$format, ["td", [], ["This is like ", <$format, ["link", [["node", "$help_cmds_say"]], ["say"], 'do_link]>, ", but it lets you put your own text before what you say, such as: ", <$format, ["p", [], [], 'do_p]>, <$format, ["dfn", [], ["> ,nods, That is correct", <$format, ["br", [], [], 'do_br]>, "Brandon nods, \"That is correct\""], 'do_dfn]>], 'do_td]>], 'do_tr]>], 'do_table]>], #[['this, $help_cmds_shortcuts]]]>; var $root inited = 1; var $help_node index = $help_index_cmds; new object $help_cmds_display: $help_cmds; var $root manager = $help_cmds_display; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'variables, 'core]; var $has_name name = ['prop, "@display", "@display"]; var $help_node links = #[]; var $help_node body = <$ctext_frob, [["Need to write."], #[['this, $help_cmds_display]]]>; var $root managed = [$help_cmds_display]; var $root owned = [$help_cmds_display]; var $help_node index = $help_index_cmds; new object $help_cmds_set: $help_cmds; var $root manager = $help_cmds_set; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 847776342; var $has_name name = ['prop, "@set", "@set"]; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $help_node links = #[]; var $help_node body = <$ctext_frob, [[<$format, ["p", [], [], 'do_p]>, "Syntax: ", <$format, ["tt", [], ["@set [<definer>:][<name>[=<value>]]"], 'do_tt]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["p", [], [], 'do_p]>, "This command is used to display and change configurable settings on objects. If <definer> is left unspecified it will default to you. To view all settings on an object do not specify a setting name or value, such as either of the following two: ", <$format, ["p", [], [], 'do_p]>, <$format, ["dfn", [], ["@set", <$format, ["br", [], [], 'do_br]>, "@set here:"], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, "The first example will show all settings on you. The second example will show all settings on ", <$format, ["em", [], ["here"], 'do_em]>, ". To change a setting include the setting name after the definer followed by an equals sign and a value, such as: ", <$format, ["p", [], [], 'do_p]>, <$format, ["dfn", [], ["@set here:realm=Taobh Thiar"], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, "Note: if you do not specify the definer it will default to you."], #[['this, $help_cmds_set]]]>; var $root inited = 1; var $help_node index = $help_index_cmds; var $root managed = [$help_cmds_set]; var $root owned = [$help_cmds_set]; new object $help_cmds_addsetting: $help_cmds; var $root manager = $help_cmds_addsetting; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 847777538; var $has_name name = ['prop, "@add-setting", "@add-setting"]; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $help_node links = #[]; var $help_node body = <$ctext_frob, [[<$format, ["dl", [], [<$format, ["dt", [], [" ", <$format, ["quote", [], ["@add-setting <name> [<options>]"], 'do_quote]>], 'do_dt]>, <$format, ["dd", [], [" Adds a setting <name>. Valid Options: ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["ul", [], [<$format, ["lh", [], ["type"], 'do_lh]>, <$format, ["li", [], ["A string that describes what type this setting should make. Default: 'string'."], 'do_li]>, <$format, ["lh", [], ["check"], 'do_lh]>, <$format, ["li", [], ["Method that verifies a given value is valid. Default: 'is_anything'."], 'do_li]>, <$format, ["lh", [], ["set"], 'do_lh]>, <$format, ["li", [], ["Method that stores the value. Default: 'set_direct_setting'."], 'do_li]>, <$format, ["lh", [], ["get"], 'do_lh]>, <$format, ["li", [], ["Method to retrieve the value. Default: 'get_direct_setting'."], 'do_li]>, <$format, ["lh", [], ["del"], 'do_lh]>, <$format, ["li", [], ["Method called if the setting is deleted. Default: 'del_direct_setting'."], 'do_li]>], 'do_ul]>, " "], 'do_dd]>], 'do_dl]>, " When giving method names ", <$format, ["strong", [], ["do not"], 'do_strong]>, " use a ' or .} ", <$format, ["dl", [], [<$format, ["dt", [], [" ", <$format, ["quote", [], ["@set [<mask>] [on <object>]"], 'do_quote]>], 'do_dt]>, <$format, ["dd", [], [" If object is not given, assume this. Mask may be: ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["ul", [], [<$format, ["lh", [], ["<name>"], 'do_lh]>, <$format, ["li", [], ["Show all settings matching name"], 'do_li]>, <$format, ["lh", [], ["[+|-]<name>"], 'do_lh]>, <$format, ["li", [], ["Set or unset a boolean"], 'do_li]>, <$format, ["lh", [], ["<name>=<value>"], 'do_lh]>, <$format, ["li", [], ["Set any thing"], 'do_li]>, <$format, ["lh", [], ["<name>+=<value>"], 'do_lh]>, <$format, ["li", [], ["Delete a value from a list"], 'do_li]>, <$format, ["lh", [], ["<name>-=<value>"], 'do_lh]>, <$format, ["li", [], ["Add a value to a list"], 'do_li]>], 'do_ul]>, " "], 'do_dd]>], 'do_dl]>], #[['this, $help_cmds_addsetting]]]>; var $root inited = 1; var $help_node index = $help_index_cmds; var $root managed = [$help_cmds_addsetting]; var $root owned = [$help_cmds_addsetting]; new object $help_cmds_adjust: $help_cmds; var $root manager = $help_cmds_adjust; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 848119776; var $help_node index = $help_index_cmds; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "@adjust", "@adjust"]; var $help_node links = #[]; var $help_node body = <$ctext_frob, [[<$format, ["p", [], [], 'do_p]>, <$format, ["b", [], ["ADMIN COMMAND"], 'do_b]>, " ", <$format, ["p", [], [], 'do_p]>, <$format, ["dfn", [], ["Syntax: ", <$format, ["tt", [], ["@adjust|@promote <user> to <any>"], 'do_tt]>], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, "Used to change a user's class from/to any of the following: ", <$format, ["ul", [], [<$format, ["li", [], [" user"], 'do_li]>, <$format, ["li", [], [" builder"], 'do_li]>, <$format, ["li", [], [" programmer"], 'do_li]>, <$format, ["li", [], [" admin"], 'do_li]>], 'do_ul]>, " ", <$format, ["p", [], [], 'do_p]>, "Example: ", <$format, ["p", [], [], 'do_p]>, <$format, ["dfn", [], ["@promote Bob to a programmer"], 'do_dfn]>], #[['this, $help_cmds_adjust]]]>; var $root inited = 1; var $root managed = [$help_cmds_adjust]; new object $help_cmds_mojo: $help_cmds; var $root manager = $help_cmds_mojo; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 848119784; var $help_node index = $help_index_cmds; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "@mojo", "@mojo"]; var $help_node links = #[]; var $help_node body = <$ctext_frob, [[<$format, ["p", [], [], 'do_p]>, <$format, ["b", [], ["ADMIN COMMAND"], 'do_b]>, " ", <$format, ["p", [], [], 'do_p]>, <$format, ["dfn", [], ["Syntax: ", <$format, ["tt", [], ["@adjust|@promote <user> to <any>"], 'do_tt]>], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, "Used by an administrator to enable full system priveliges."], #[['this, $help_cmds_mojo]]]>; var $root inited = 1; var $root managed = [$help_cmds_mojo]; new object $help_cmds_newpwd: $help_cmds; var $root manager = $help_cmds_newpwd; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 848119794; var $help_node index = $help_index_cmds; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "@new-password", "@new-password"]; var $help_node links = #[]; var $help_node body = <$ctext_frob, [[<$format, ["p", [], [], 'do_p]>, <$format, ["b", [], ["ADMIN COMMAND"], 'do_b]>, " ", <$format, ["p", [], [], 'do_p]>, <$format, ["dfn", [], ["Syntax: ", <$format, ["tt", [], ["@new-password|@newpw?d <user>"], 'do_tt]>], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, "Used to generate a new random password for the specified user. The password is told to the user (if they are connected) and the administrator who ran the command. Example: ", <$format, ["p", [], [], 'do_p]>, <$format, ["dfn", [], ["@newpw Billy Bob"], 'do_dfn]>], #[['this, $help_cmds_newpwd]]]>; var $root inited = 1; var $root managed = [$help_cmds_newpwd]; new object $help_cmds_rehashall: $help_cmds; var $root manager = $help_cmds_rehashall; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 848119800; var $help_node index = $help_index_cmds; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "@rehash-all", "@rehash-all"]; var $help_node links = #[]; var $help_node body = <$ctext_frob, [[<$format, ["p", [], [], 'do_p]>, <$format, ["b", [], ["ADMIN COMMAND"], 'do_b]>, " ", <$format, ["p", [], [], 'do_p]>, <$format, ["dfn", [], ["Syntax: @rehash-all"], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, "Commands are cached for fast lookup. Because of this if a command is added to an object other than your object (such as $user), the global cache needs to be updated. This command will clear all caches and update them as needed."], #[['this, $help_cmds_rehashall]]]>; var $root inited = 1; var $root managed = [$help_cmds_rehashall]; new object $help_cmds_backup: $help_cmds; var $root manager = $help_cmds_backup; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 848119816; var $help_node index = $help_index_cmds; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "@backup", "@backup"]; var $help_node links = #[]; var $help_node body = <$ctext_frob, [[<$format, ["p", [], [], 'do_p]>, <$format, ["b", [], ["ADMIN COMMAND"], 'do_b]>, " ", <$format, ["p", [], [], 'do_p]>, <$format, ["dfn", [], ["Syntax: @backup"], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, "Start an asyncrynous backup of the binary database."], #[['this, $help_cmds_backup]]]>; var $root inited = 1; var $root managed = [$help_cmds_backup]; new object $help_cmds_shutdown: $help_cmds; var $root manager = $help_cmds_shutdown; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 848119822; var $help_node index = $help_index_cmds; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "@shutdown", "@shutdown"]; var $help_node links = #[]; var $help_node body = <$ctext_frob, [[<$format, ["p", [], [], 'do_p]>, <$format, ["b", [], ["ADMIN COMMAND"], 'do_b]>, " ", <$format, ["p", [], [], 'do_p]>, <$format, ["dfn", [], ["Syntax: ", <$format, ["tt", [], ["@shutdown [-t?ime=xx] [reason]"], 'do_tt]>], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, "Shutdown the server, the time defaults to five minutes, if left unspecified. The time specified is in minutes, so -time=10 would be ten minutes, not ten seconds. Example: ", <$format, ["p", [], [], 'do_p]>, <$format, ["dfn", [], ["@shutdown -t=0 Upgrading Driver, Should be back online soon"], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, "Would shutdown immediately (zero minutes)."], #[['this, $help_cmds_shutdown]]]>; var $root inited = 1; var $root managed = [$help_cmds_shutdown]; new object $help_cmds_tasks: $help_cmds; var $root manager = $help_cmds_tasks; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 848119825; var $help_node index = $help_index_cmds; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "@tasks", "@tasks"]; var $help_node links = #[["@kill", $help_cmds_kill]]; var $help_node body = <$ctext_frob, [[<$format, ["p", [], [], 'do_p]>, <$format, ["b", [], ["ADMIN COMMAND"], 'do_b]>, " ", <$format, ["p", [], [], 'do_p]>, <$format, ["dfn", [], ["Syntax: ", <$format, ["tt", [], ["@task?s [task [task [...]]]"], 'do_tt]>], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, "Briefly list all Database and Driver tasks, or list full details on the specified tasks (as with ", <$format, ["link", [["node", "$help_cmds_kill"]], ["@kill"], 'do_link]>, ") system tasks are directly specified by prefixing them with an asterisk). Examples: ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["dfn", [], ["@tasks"], 'do_dfn]>, " ", <$format, ["dfn", [], ["@tasks *10204"], 'do_dfn]>], #[['this, $help_cmds_tasks]]]>; var $root inited = 1; var $root managed = [$help_cmds_tasks]; new object $help_cmds_kill: $help_cmds; var $root manager = $help_cmds_kill; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 848119831; var $help_node index = $help_index_cmds; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "@kill", "@kill"]; var $help_node links = #[]; var $help_node body = <$ctext_frob, [[<$format, ["p", [], [], 'do_p]>, <$format, ["b", [], ["ADMIN COMMAND"], 'do_b]>, " ", <$format, ["p", [], [], 'do_p]>, <$format, ["dfn", [], ["Syntax: ", <$format, ["tt", [], ["@del-t?ask|@kill [task [task [...]]]"], 'do_tt]>], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, "Kill the specified task. System tasks are directly specified by prefixing them with an asterisk. In general you should kill the related database task and let it kill the system task (if applicable). ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["dfn", [], ["@kill *10204", <$format, ["br", [], [], 'do_br]>, "@kill 12 *1241"], 'do_dfn]>], #[['this, $help_cmds_kill]]]>; var $root inited = 1; var $root managed = [$help_cmds_kill]; new object $help_cmds_addcmd: $help_cmds; var $root manager = $help_cmds_addcmd; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 848119837; var $help_node index = $help_index_cmds; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "@add-command|@ac", "@add-command|@ac"]; var $help_node links = #[[" Enhanced Command Template", $help_commands_enhanced], ["Matching Conventions", $help_commands_matching]]; var $help_node body = <$ctext_frob, [[<$format, ["p", [], [], 'do_p]>, <$format, ["b", [], ["PROGRAMMER COMMAND"], 'do_b]>, " ", <$format, ["p", [], [], 'do_p]>, <$format, ["dfn", [], ["Syntax: ", <$format, ["tt", [], ["@add-c?ommand|@ac \"<Command Template>\" [to|for] <objref>"], 'do_tt]>], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, "Used to add a command. The method called if the command matches must be specified. The command template must be an ", <$format, ["link", [["node", "$help_commands_enhanced"]], [" Enhanced Command Template"], 'do_link]>, ". Arguments send to the method are always ordered the same, the first argument is always the command string, followed by subsequent arguments relative to how the command template would match using template matching (see ", <$format, ["link", [["node", "$help_commands_matching"]], ["Matching Conventions"], 'do_link]>, "). ", <$format, ["p", [], [], 'do_p]>, "For instance, the following enhanded command template: ", <$format, ["p", [], [], 'do_p]>, <$format, ["dfn", [], ["\"@get <any> from <this>\""], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, "Would evaluate to the following standard template ", <$format, ["p", [], [], 'do_p]>, <$format, ["dfn", [], ["\"@get * from *\""], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, "From this point, you can simply evaluate the template matching to see how its results would be ordered: ", <$format, ["p", [], [], 'do_p]>, <$format, ["dfn", [], [";match_template(\"@get something from nothing\", \"@get * from *\")", <$format, ["br", [], [], 'do_br]>, "=> [\"@get\", \"something\", \"from\", \"nothing\"]"], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, "Based off these results the arg definition for your method could be: ", <$format, ["p", [], [], 'do_p]>, <$format, ["dfn", [], ["arg cmdstr, cmd, arg1, prep, arg2;"], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, "When a command is added it will not immediately begin working. Command caches must be updated first. There are three different situations that will arise when adding a command: ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["dl", [], [<$format, ["dt", [], ["Adding a local command to yourself"], 'do_dt]>, <$format, ["dd", [], [<$format, ["p", [], [], 'do_p]>, "This situation is the simplest to update. If you have added a command to yourself simply type ", <$format, ["link", [["node", "$help_cmd_rehash"]], ["@rehash"], 'do_link]>, ", and your local caches will be updated.", <$format, ["p", [], [], 'do_p]>], 'do_dd]>, <$format, ["dt", [], ["Adding a remote command to an object"], 'do_dt]>, <$format, ["dd", [], [<$format, ["p", [], [], 'do_p]>, "When adding a remote command to something you can rehash the remote caches by simply dropping the item and picking it back up.", <$format, ["p", [], [], 'do_p]>], 'do_dd]>, <$format, ["dt", [], ["Adding a local command to another object"], 'do_dt]>, <$format, ["dd", [], [<$format, ["p", [], [], 'do_p]>, "If you are adding a local command to an object other than yourself, you will have to rehash the entire system's caches. This is done with the command ", <$format, ["link", [["node", "$help_cmd_rehashall"]], ["@rehash-all"], 'do_link]>, ", which is an administrative command."], 'do_dd]>], 'do_dl]>], #[['this, $help_cmds_addcmd]]]>; var $root inited = 1; var $root managed = [$help_cmds_addcmd]; new object $help_cmds_reap: $help_cmds; var $root manager = $help_cmds_reap; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 848426641; var $help_node index = $help_index_cmds; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "@reap", "@reap"]; var $help_node links = #[]; var $help_node body = <$ctext_frob, [[<$format, ["p", [], [], 'do_p]>, <$format, ["b", [], ["ADMIN COMMAND"], 'do_b]>, " ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["dfn", [], ["Syntax: ", <$format, ["tt", [], ["@reap [period]"], 'do_tt]>], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, "Build a list of possible users to reap starting at ", <$format, ["em", [], ["period"], 'do_em]>, ". Period is a number followed by months, weeks or days, such as: ", <$format, ["p", [], [], 'do_p]>, <$format, ["dfn", [], ["@reap 4 months"], 'do_dfn]>, <$format, ["p", [], [], 'do_p]>, "Will build the list starting four months ago. If unspecified the period will default to three months.", <$format, ["p", [], [], 'do_p]>, <$format, ["p", [], [], 'do_p]>, "Note: This command does NOT do the reaping, it just builds a list of possibilities."], #[['this, $help_cmds_reap]]]>; var $root inited = 1; var $root managed = [$help_cmds_reap]; new object $help_cmds_core: $help_cmds; var $root manager = $help_cmds_core; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 848468664; var $help_node index = $help_index_cmds; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "@core", "@core"]; var $help_node links = #[]; var $help_node body = <$ctext_frob, [[<$format, ["dfn", [], ["Syntax: ", <$format, ["tt", [], ["@core <object>"], 'do_tt]>], 'do_dfn]>, " ", <$format, ["p", [], [], 'do_p]>, "Setup the specified object as a core object. This is used primarily for core development. It adds the ", <$format, ["tt", [], ["'core"], 'do_tt]>, " flag to the object, sets the object as its own manager and writer and removes any additional ownership."], #[['this, $help_cmds_core]]]>; var $root inited = 1; var $root managed = [$help_cmds_core]; new object $help_obj: $help_node; var $root manager = $help_obj; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 848184185; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "Object Help", "Object Help"]; var $help_node links = #[]; var $help_node body = <$ctext_frob, [["This node isn't written yet"], #[['this, $help_obj]]]>; var $root inited = 1; var $root child_index = 1; var $root managed = [$help_obj]; new object $help_obj_events: $help_obj; var $root manager = $help_obj_events; var $help_node index = $help_index_objects; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 850790348; var $has_settings defined_settings = #[]; var $has_settings local_settings = ["group"]; var $has_settings settings = #[]; var $has_name name = ['prop, "Events", "Events"]; var $help_node links = #[]; var $help_node body = <$ctext_frob, [[<$format, ["p", [], [], 'do_p]>, "Events and Event Hooks allow objects to be notified of changes in their environment. They do this by selectively hooking into known events, such as movement and social interaction events. When the event occurs all objects which have hooked into it will be notified. ", <$format, ["p", [], [], 'do_p]>, "The following methods are defined on $event_handler. ", <$format, ["subj", [["level", "3"]], ["Event Hook Management"], 'do_subj]>, " ", <$format, ["table", [["cols", "35%,65%"]], [<$format, ["tr", [], [<$format, ["td", [], [".clear_event_hook(event)"], 'do_td]>, <$format, ["td", [], ["Unhook all objects from an event."], 'do_td]>], 'do_tr]>, <$format, ["tr", [], [<$format, ["td", [], [".event_hooks()"], 'do_td]>, <$format, ["td", [], ["Return a list of all current event hooks."], 'do_td]>], 'do_tr]>], 'do_table]>, " ", <$format, ["subj", [["level", "3"]], ["Hooking Events"], 'do_subj]>, " ", <$format, ["table", [["cols", "35%,65%"]], [<$format, ["tr", [], [<$format, ["td", [], [".hook_into_event(event)"], 'do_td]>, <$format, ["td", [], ["Hook into the specified event."], 'do_td]>], 'do_tr]>, <$format, ["tr", [], [<$format, ["td", [], [".unhook_from_event(event)"], 'do_td]>, <$format, ["td", [], ["Unhook from the specified event."], 'do_td]>], 'do_tr]>, <$format, ["tr", [], [<$format, ["td", [], [".unhook_from_all()"], 'do_td]>, <$format, ["td", [], ["Unhook from all events on the object."], 'do_td]>], 'do_tr]>, <$format, ["tr", [], [<$format, ["td", [], [".will_hook(event, object)"], 'do_td]>, <$format, ["td", [], ["Called by .hook_into_event() as a permissions check before adding an object to an event hook (pre-processing)."], 'do_td]>], 'do_tr]>, <$format, ["tr", [], [<$format, ["td", [], [".did_hook(event, object)"], 'do_td]>, <$format, ["td", [], ["Called after an object is hooked into an event (post-processing)."], 'do_td]>], 'do_tr]>], 'do_table]>, " ", <$format, ["subj", [["level", "3"]], ["Sending Events"], 'do_subj]>, " ", <$format, ["table", [["cols", "35%,65%"]], [<$format, ["tr", [], [<$format, ["td", [], [".send_event(event, [args])"], 'do_td]>, <$format, ["td", [], ["Notify all hooked objects that the event has occurred."], 'do_td]>], 'do_tr]>], 'do_table]>, " ", <$format, ["subj", [["level", "3"]], ["Receiving Events"], 'do_subj]>, " ", <$format, ["table", [["cols", "45%,55%"]], [<$format, ["tr", [], [<$format, ["td", [], [".event_notify(event, obj, [args])"], 'do_td]>, <$format, ["td", [], ["Notification of the event caused by 'obj'."], 'do_td]>], 'do_tr]>, <$format, ["tr", [], [<$format, ["td", [], [".event_hook_removed(event)"], 'do_td]>, <$format, ["td", [], ["Notification when an event hook definition is removed from an object (object is sender())."], 'do_td]>], 'do_tr]>], 'do_table]>, " ", <$format, ["subj", [["level", "3"]], ["Currently Known Events"], 'do_subj]>, " ", <$format, ["dl", [], [<$format, ["dt", [], ["$location events:"], 'do_dt]>, <$format, ["dd", [], [<$format, ["dl", [], [<$format, ["dt", [], ["'movement"], 'do_dt]>, <$format, ["dd", [], ["Occurs whenever an object moves into or from the location. Use is restricted to objects in the current environment. A single symbol is sent as an additional argument specifying 'arrive or 'leave."], 'do_dd]>, <$format, ["dt", [], ["'user_connect"], 'do_dt]>, <$format, ["dd", [], ["Occurs whenever a user logs in or out of the system and they are located in the room. Use is restricted to objects in the current environment. A single symbol is sent as an additional argument specifying 'login or 'logout."], 'do_dd]>], 'do_dl]>, " "], 'do_dd]>, <$format, ["dt", [], ["$body events:"], 'do_dt]>, <$format, ["dd", [], [<$format, ["dl", [], [<$format, ["dt", [], ["'social"], 'do_dt]>, <$format, ["dd", [], ["Occurs whenever social interaction is directed at the target body."], 'do_dd]>], 'do_dl]>, " "], 'do_dd]>], 'do_dl]>], #[['this, $help_obj_events]]]>; var $root inited = 1; var $help_node group = 1; var $root managed = [$help_obj_events]; new object $help_node_list: $help_obj; var $root manager = $help_node_list; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 837714742; var $has_settings defined_settings = #[]; var $has_settings local_settiag_ = ["index"]; var $has_settings settings = #[]; var $has_name name = ['prop, "List", "List"]; var $help_node links = #[["Elements", $help_list_element], ["Formatting", $help_list_formatting], ["Maps", $help_list_maps], ["Sets", $help_list_sets], ["Others", $help_list_other]]; var $help_node body = <$ctext_frob, [[<$format, ["dl", [["columned", 1]], [<$format, ["dt", [], [<$format, ["link", [["node", "$help_list_element"]], ["Elements"], 'do_link]>], 'do_dt]>, <$format, ["dd", [], ["Element operations"], 'do_dd]>, <$format, ["dt", [], [<$format, ["link", [["node", "$help_list_formatting"]], ["Formatting"], 'do_link]>], 'do_dt]>, <$format, ["dd", [], ["List formatting"], 'do_dd]>, <$format, ["dt", [], [<$format, ["link", [["node", "$help_list_maps"]], ["Maps"], 'do_link]>], 'do_dt]>, <$format, ["dd", [], ["Mapping and filtering"], 'do_dd]>, <$format, ["dt", [], [<$format, ["link", [["node", "$help_list_sets"]], ["Sets"], 'do_link]>], 'do_dt]>, <$format, ["dd", [], ["Set operations"], 'do_dd]>, <$format, ["dt", [], [<$format, ["link", [["node", "$help_list_other"]], ["Others"], 'do_link]>], 'do_dt]>, <$format, ["dd", [], ["Others"], 'do_dd]>], 'do_dl]>], #[['this, $help_node_list]]]>; var $root inited = 1; var $root managed = [$help_node_list]; var $root owned = [$help_node_list]; var $root child_index = 5; var $help_node index = $help_index_objects; new object $help_list_element: $help_node_list; var $root manager = $help_list_element; var $help_node index = $help_index_core; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 850833025; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "Element", "Element"]; var $help_node links = #[]; var $help_node body = <$ctext_frob, [[<$format, ["dl", [], [<$format, ["dt", [], [<$format, ["quote", [], ["length(list)"], 'do_quote]>, " ", <$format, ["em", [], ["native"], 'do_em]>], 'do_dt]>, <$format, ["dd", [], ["Length of the list."], 'do_dd]>, <$format, ["dt", [], [<$format, ["quote", [], ["replace(list, n, elt)"], 'do_quote]>, " ", <$format, ["em", [], ["native"], 'do_em]>], 'do_dt]>, <$format, ["dd", [], ["Replace nth element with elt."], 'do_dd]>, <$format, ["dt", [], [<$format, ["quote", [], ["delete(list, n)"], 'do_quote]>, " ", <$format, ["em", [], ["native"], 'do_em]>], 'do_dt]>, <$format, ["dd", [], ["Deletes nth element from the list."], 'do_dd]>, <$format, ["dt", [], [<$format, ["quote", [], ["insert(list,n,elt)"], 'do_quote]>, " ", <$format, ["em", [], ["native"], 'do_em]>], 'do_dt]>, <$format, ["dd", [], ["insert x at the nth place of the list."], 'do_dd]>, <$format, ["dt", [], [<$format, ["quote", [], ["subrange(list,n,len)"], 'do_quote]>, " ", <$format, ["em", [], ["native"], 'do_em]>], 'do_dt]>, <$format, ["dd", [], ["sublist starting at l, with len elements."], 'do_dd]>, <$format, ["dt", [], [<$format, ["quote", [], ["last(list)"], 'do_quote]>], 'do_dt]>, <$format, ["dd", [], ["Last element of the list"], 'do_dd]>, <$format, ["dt", [], [<$format, ["quote", [], ["msort(list[,keys])"], 'do_quote]>], 'do_dt]>, <$format, ["dd", [], ["Sort the list by the keys list. Keys default to the list itself."], 'do_dd]>, <$format, ["dt", [], [<$format, ["quote", [], ["chop(list[,count])"], 'do_quote]>], 'do_dt]>, <$format, ["dd", [], ["Removes count elements from the tail of the list. Default is 1 element."], 'do_dd]>, <$format, ["dt", [], [<$format, ["quote", [], ["swap(list, index1, index2)"], 'do_quote]>], 'do_dt]>, <$format, ["dd", [], ["Swaps the two elements of the list."], 'do_dd]>], 'do_dl]>], #[['this, $help_list_element]]]>; var $root inited = 1; var $root managed = [$help_list_element]; new object $help_list_formatting: $help_node_list; var $root manager = $help_list_formatting; var $help_node index = $help_index_core; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 850833050; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "Formatting", "Formatting"]; var $help_node links = #[]; var $help_node body = <$ctext_frob, [[<$format, ["dl", [], [<$format, ["dt", [], [<$format, ["quote", [], ["join(list[, separator])"], 'do_quote]>, " ", <$format, ["em", [], ["native"], 'do_em]>], 'do_dt]>, <$format, ["dd", [], ["Format the list by converting its elements to strings, and putting separator between them."], 'do_dd]>, <$format, ["dt", [], [<$format, ["quote", [], [".to_english(list[,empty[,and[,sep]]])"], 'do_quote]>], 'do_dt]>, <$format, ["dd", [], ["Convert the elements of the list to strings, put separator between them, except the last two elements, that will be separated with and. Defaults for the arguments are: empty = 'nothing', and = ' and ', sep = ', '."], 'do_dd]>, <$format, ["dt", [], [<$format, ["quote", [], ["columnize(list, cols[, separator[, linelength]])"], 'do_quote]>], 'do_dt]>, <$format, ["dd", [], ["Format the line in cols columns, adding the separators. Linelength defaults to 78."], 'do_dd]>, <$format, ["dt", [], [<$format, ["quote", [], ["lcolumnize(list, [len, [sep]])"], 'do_quote]>], 'do_dt]>, <$format, ["dd", [], ["Columnizes by detecting the maximal length of the list elements."], 'do_dd]>, <$format, ["dt", [], [<$format, ["quote", [], ["vcolumnize(list, cols[, linelen])"], 'do_quote]>], 'do_dt]>, <$format, ["dd", [], ["Columnizes in the stanard manner (consecutive elements are aligned vertically)."], 'do_dd]>, <$format, ["dt", [], [<$format, ["quote", [], ["center_lines(list,width,[args])"], 'do_quote]>], 'do_dt]>, <$format, ["dd", [], ["Calls $string.center on each line in the list, with extra args."], 'do_dd]>, <$format, ["dt", [], [<$format, ["quote", [], ["prefix(list, prefix)"], 'do_quote]>], 'do_dt]>, <$format, ["dd", [], ["Prepends a prefix to each element of the list"], 'do_dd]>, <$format, ["dt", [], [<$format, ["quote", [], ["affix(l1, l2)"], 'do_quote]>], 'do_dt]>, <$format, ["dd", [], ["Appends l2 to l1, with adding the first element of l2 to the last element of l1."], 'do_dd]>, <$format, ["dt", [], [<$format, ["quote", [], ["tabulate(list, headers, [colsizes, trim_cols, header_sep, len])"], 'do_quote]>], 'do_dt]>, <$format, ["dd", [], ["Output the list as a table, with given headers. Colsizes, if 0, are automatically calculated."], 'do_dd]>], 'do_dl]>], #[['this, $help_list_formatting]]]>; var $root inited = 1; var $root managed = [$help_list_formatting]; new object $help_list_maps: $help_node_list; var $root manager = $help_list_maps; var $help_node index = $help_index_core; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 850833055; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "Maps", "Maps"]; var $help_node links = #[]; var $help_node body = <$ctext_frob, [[<$format, ["dl", [], [<$format, ["dt", [], [<$format, ["quote", [], ["make(n[,elt])"], 'do_quote]>], 'do_dt]>, <$format, ["dd", [], ["Makes a list of n copies of elt. Elt defaults to 0."], 'do_dd]>, <$format, ["dt", [], [<$format, ["quote", [], ["mmap(list, method, args...)"], 'do_quote]>], 'do_dt]>, <$format, ["dd", [], ["Calls method on each element (with additional arguments, if specified), returns the results."], 'do_dd]>, <$format, ["dt", [], [<$format, ["quote", [], ["mfilter(list, method, args...)"], 'do_quote]>], 'do_dt]>, <$format, ["dd", [], ["Similar to mmap, but returns the list of objects for which method returned true value."], 'do_dd]>, <$format, ["dt", [], [<$format, ["quote", [], ["lmap(list, method, args...)"], 'do_quote]>], 'do_dt]>, <$format, ["dd", [], ["Calls sender().method on each element of the list, returns the results."], 'do_dd]>, <$format, ["dt", [], [<$format, ["quote", [], ["omap(list, object, method, args...)"], 'do_quote]>], 'do_dt]>, <$format, ["dd", [], ["Calls object.method on each element."], 'do_dd]>, <$format, ["dt", [], [<$format, ["quote", [], ["map_to_english(list, method, args...)"], 'do_quote]>], 'do_dt]>, <$format, ["dt", [], [<$format, ["quote", [], ["map_to_string(list, method, args...)"], 'do_quote]>], 'do_dt]>, <$format, ["dd", [], ["Shorthand for mmap followed with .to_english/.to_string."], 'do_dd]>, <$format, ["dt", [], [<$format, ["quote", [], ["element_maxlength(list)"], 'do_quote]>], 'do_dt]>, <$format, ["dd", [], ["Finds the longest element (measuring by string representation)."], 'do_dd]>, <$format, ["dt", [], [<$format, ["quote", [], ["nth_element_maxlength(list,n)"], 'do_quote]>], 'do_dt]>, <$format, ["dd", [], ["Same as list.slice(n).element_maxlength()."], 'do_dd]>, <$format, ["dt", [], [<$format, ["quote", [], ["reverse(list)"], 'do_quote]>], 'do_dt]>, <$format, ["dd", [], ["Reverse the order of the elements of the list."], 'do_dd]>, <$format, ["dt", [], [<$format, ["quote", [], ["compress(list)"], 'do_quote]>], 'do_dt]>, <$format, ["dd", [], ["Removes the repeated elements."], 'do_dd]>, <$format, ["dt", [], [<$format, ["quote", [], ["slice(list, n)"], 'do_quote]>], 'do_dt]>, <$format, ["dd", [], ["Returns the list of nth elements from a list of lists. If n is a list, it will return a list of lists."], 'do_dd]>, <$format, ["dt", [], [<$format, ["quote", [], ["numbered_text(text)"], 'do_quote]>], 'do_dt]>, <$format, ["dd", [], ["Returns the text with line numbers prepended."], 'do_dd]>, <$format, ["dt", [], [<$format, ["quote", [], ["max(list)"], 'do_quote]>], 'do_dt]>, <$format, ["dt", [], [<$format, ["quote", [], ["min(list)"], 'do_quote]>], 'do_dt]>, <$format, ["dd", [], ["Returns minimal/maximal element of the list (0 if empty)."], 'do_dd]>, <$format, ["dt", [], [<$format, ["quote", [], ["fold(list, object, method, args...)"], 'do_quote]>], 'do_dt]>, <$format, ["dd", [], ["Fold operation from the functional programming. For empty list, it returns 0, for a 1 element list, it returns the first element. Otherwise, it calls the method for the first two elements, then calls it with the result and the third element, etc. It returns the last result."], 'do_dd]>, <$format, ["dt", [], [<$format, ["quote", [], ["valid_objects(list)"], 'do_quote]>], 'do_dt]>, <$format, ["dd", [], ["Removes invalid objects from the list"], 'do_dd]>, <$format, ["dt", [], [<$format, ["quote", [], ["grep(list,regexp)"], 'do_quote]>], 'do_dt]>, <$format, ["dd", [], ["For each line that matches regexp, returns [linenumber, regexp match regions, the line text]."], 'do_dd]>, <$format, ["dt", [], [<$format, ["quote", [], ["count(list, elem)"], 'do_quote]>], 'do_dt]>, <$format, ["dd", [], ["Counts the number of occurences of element in the list."], 'do_dd]>], 'do_dl]>], #[['this, $help_list_maps]]]>; var $root inited = 1; var $root managed = [$help_list_maps]; new object $help_list_sets: $help_node_list; var $root manager = $help_list_sets; var $help_node index = $help_index_core; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 850833059; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "Sets", "Sets"]; var $help_node links = #[]; var $help_node body = <$ctext_frob, [[<$format, ["dl", [], [<$format, ["dt", [], [<$format, ["quote", [], ["setadd(list, elt)"], 'do_quote]>, " ", <$format, ["em", [], ["native"], 'do_em]>], 'do_dt]>, <$format, ["dd", [], ["Adds an element to the list unless it's already contained in the list."], 'do_dd]>, <$format, ["dt", [], [<$format, ["quote", [], ["setremove(list, elt)"], 'do_quote]>, " ", <$format, ["em", [], ["native"], 'do_em]>], 'do_dt]>, <$format, ["dd", [], ["Removes the first occurence of the element from the list."], 'do_dd]>, <$format, ["dt", [], [<$format, ["quote", [], ["union(list1,list2)"], 'do_quote]>, " ", <$format, ["em", [], ["native"], 'do_em]>], 'do_dt]>, <$format, ["dd", [], ["Union of the two lists. Use ", <$format, ["quote", [], ["big_list.fold($list,'union)"], 'do_quote]>, " to get a union of the family of lists."], 'do_dd]>, <$format, ["dt", [], [<$format, ["quote", [], ["set_difference(list, l1, ...)"], 'do_quote]>], 'do_dt]>, <$format, ["dd", [], ["Removes the elements from l1, l2 etc from the list."], 'do_dd]>, <$format, ["dt", [], [<$format, ["quote", [], ["intersection(l1, l2)"], 'do_quote]>], 'do_dt]>, <$format, ["dd", [], ["Returns the elements that occur on both lists. Use fold() for more lists."], 'do_dd]>, <$format, ["dt", [], [<$format, ["quote", [], ["set_contains(l1, l2, ...)"], 'do_quote]>], 'do_dt]>, <$format, ["dd", [], ["Returns 1 if the first argument contains all the others."], 'do_dd]>, <$format, ["dt", [], [<$format, ["quote", [], ["set_equal(l1, l2)"], 'do_quote]>], 'do_dt]>, <$format, ["dd", [], ["Returns 1 if the lists are equal as sets (that is, if l1 is contained in l2 and if l2 is contained in l1)."], 'do_dd]>], 'do_dl]>], #[['this, $help_list_sets]]]>; var $root inited = 1; var $root managed = [$help_list_sets]; new object $help_list_other: $help_node_list; var $root manager = $help_list_other; var $help_node index = $help_index_core; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 850833064; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "Other", "Other"]; var $help_node links = #[]; var $help_node body = <$ctext_frob, [[<$format, ["dl", [], [<$format, ["dt", [], [<$format, ["quote", [], ["flatten(list)"], 'do_quote]>], 'do_dt]>, <$format, ["dd", [], ["RaisE Gll the sublists to the toplevel."], 'do_dd]>, <$format, ["dt", [], [<$format, ["quote", [], ["sum(list)"], 'do_quote]>], 'do_dt]>, <$format, ["dd", [], ["Returns the sum of the elements of the list."], 'do_dd]>, <$format, ["dt", [], [<$format, ["quote", [], ["non_alphanumeric()"], 'do_quote]>], 'do_dt]>, <$format, ["dt", [], [<$format, ["quote", [], ["numbers()"], 'do_quote]>], 'do_dt]>, <$format, ["dt", [], [<$format, ["quote", [], ["alphabet"], 'do_quote]>], 'do_dt]>, <$format, ["dd", [], ["Returns the lists of characters in each class."], 'do_dd]>, <$format, ["dt", [], [<$format, ["quote", [], ["to_buffer([args])"], 'do_quote]>], 'do_dt]>, <$format, ["dd", [], ["Turns a list of strings into buffer, inserting a newlist (by default) as a separator."], 'do_dd]>], 'do_dl]>, " ", <$format, ["subj", [["level", "3"]], ["Associative lists"], 'do_subj]>, "Associative lists are lists of key/value pairs. Use them only when dealing with very few elements (fewer than 5, for instance). For larger databases, memory advantage of the associative lists ceases to matter, and they are much slower than dictionaries. ", <$format, ["p", [], [], 'do_p]>, " ", <$format, ["dl", [], [<$format, ["dt", [], [<$format, ["quote", [], ["addkey(l, key, val)"], 'do_quote]>], 'do_dt]>, <$format, ["dd", [], ["Adds a key/value pair to the list, or modifies the value associated with existing key."], 'do_dd]>, <$format, ["dt", [], [<$format, ["quote", [], ["delkey(l, key)"], 'do_quote]>], 'do_dt]>, <$format, ["dd", [], ["Removes the key/value pair if exists."], 'do_dd]>, <$format, ["dt", [], [<$format, ["quote", [], ["getkey(l, key)"], 'do_quote]>], 'do_dt]>, <$format, ["dd", [], ["Returns the value associated with the key, or throws ~keynf."], 'do_dd]>, <$format, ["dt", [], [<$format, ["quote", [], ["getkey_index(l, key)"], 'do_quote]>], 'do_dt]>, <$format, ["dd", [], ["Returns the index if the key, or throws."], 'do_dd]>], 'do_dl]>], #[['this, $help_list_other]]]>; var $root inited = 1; var $root managed = [$help_list_other]; new object $channel_db: $db; var $root manager = $channel_db; var $channel_db system_channels = ['Login, 'System]; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 845244416; var $root trusted = [$channel_ui]; var $db database = #[['battletech, ['BattleTech, 2, 0, 0, $world, [$world], "Discussion of the Cold BattleTech port.", 0]], ['public, ['Public, 8, 0, 0, $world, [$world], "Everyone can discuss anything any time, for any reason.", 0]], ['foo, ['foo, 1, 0, 0, $help_func_join, [$help_func_join], 0, 0]], ['test, ['Test, 1, 0, 0, $lag_watcher, [$lag_watcher], 0, 0]], ['woo, ['WOO, 1, 0, 0, $smtp_daemon, [$smtp_daemon], 0, 0]], ['system, ['System, 12, 0, 0, $world, [$world], "System wide messages like backup notifications.", 0]], ['trader, ['Trader, 2, 0, 0, $world, [$world], 0, 0]], ['login, ['Login, 10, 0, 0, $world, [$world], "User log in and out notifications.", 0]]]; var $root inited = 1; var $root managed = [$channel_db]; protected method .clean_db() { var x, d; d = #[]; for x in (.database()) { pause(); if ((x[2])[2]) d = d.add(@x); } .set_database(d); }; public method .system_channels() { return system_channels; }; new object $mail_lib: $libraries, $mail_root; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'core, 'variables]; var $mail_lib mail_system = [$mail_message, $mail_list, $mail_ui, $mail_lib]; var $root manager = $mail_lib; var $root owned = [$mail_lib]; var $root managed = [$mail_lib]; public method .mail_name() { arg obj; if (!(obj.has_ancestor($mail_list))) throw(~type, "Object is not a child of $mail_recipient"); if (obj.has_ancestor($user)) return (obj.name()).replace(" ", "-"); return "*" + ((obj.name()).replace(" ", "-")); }; public method .has_mail_perms() { arg [args]; var obj; for obj in (args) { if ((!(obj in mail_system)) && (!($sys.is_system(obj)))) return 0; } }; public method .match_mail_recipient() { arg name; catch ~namenf { if ((name[1]) == "*") return (> $mail_db.search(name.subrange(2)) <); if (name == "me") return sender(); return (> $user_db.search(name) <); } with { throw(~listnf, ("No mail recipient found by the name \"" + name) + "\"."); } }; public method .range_to_actual() { arg rng, current; var start, end, out, listm, m, x, list; list = current['list]; listm = list.mail(); if (type(rng[1]) == 'integer) { start = rng[1]; } else { switch (rng[1]) { case 'end: if (type(rng[2]) != 'symbol) throw(~range, "Backwards range."); start = ((current['list]).mail()).length(); case 'start: start = 1; case 'current: start = (current['location]) in listm; case 'specific: out = []; for m in ((rng[2]).explode_english_list()) { if ((!(x = toint(m))) || (x < 1)) { sender().tell(("Ignoring list range element '" + m) + "'."); } else { catch ~range out = setadd(out, (> listm[x] <)); with sender().tell(((((("List range #" + x) + " is higher than the messages in ") + (list.mail_name())) + " (") + (listm.length())) + ")"); } } return out || throw(~range, "No elements in list range."); } } if (type(rng[2]) == 'integer) { end = rng[2]; } else { switch (rng[2]) { case 'end: end = ((current['list]).mail()).length(); case 'single: end = start; case 'start: throw(~range, "Backwards range."); case 'current: end = (current['location]) in ((current['list]).mail()); } } if (start > end) throw(~range, "Backwards range."); out = []; for m in [start .. end] { catch ~range out = setadd(out, (> listm[m] <)); with sender().tell(((((("List range #" + m) + " is higher than the messages in ") + (list.mail_name())) + " (") + (listm.length())) + ")"); } return out || throw(~range, "No elements in list range."); }; new object $user_parsers: $misc; var $root child_index = 13; var $root fertile = 1; var $root trusted = []; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'fertile, 'core, 'variables]; var $root manager = $user_parsers; var $user_parsers priority = 0; var $root owned = [$user_parsers]; var $root managed = [$user_parsers]; public method .parse() { arg user, str, next_parser, [other_parsers]; // Minimum parser routine. return next_parser.parse(user, str, @other_parsers); }; public method .priority() { return priority || 1000; }; public method .set_priority() { arg new; (> .perms(sender(), 'manager) <); priority = new; }; new object $null_parser: $user_parsers; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'variables, 'core]; var $root manager = $null_parser; var $root managed = [$null_parser]; var $root owned = [$null_parser]; var $user_parsers priority = 10000; public method .parse() { arg user, str, [anything_else]; var i; for i in [1 .. str.length()] { if ((str[i]) != " ") return ['failed]; } return ['ok]; }; new object $command_aliases_parser: $user_parsers; var $root trusted = []; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'variables, 'core]; var $root manager = $command_aliases_parser; var $root managed = [$command_aliases_parser]; var $root owned = [$command_aliases_parser]; var $user_parsers priority = 750; public method .parse() { arg user, str, next_parser, [other_parsers]; var alias, match, i, result, old; for alias in (user.command_aliases()) { match = str.match_pattern(alias[1]); if (match != 0) { old = str; str = ""; for i in (alias[2]) { if (type(i) == 'integer) str += match[i]; else str += i; } } } result = next_parser.parse(user, str, @other_parsers); if (old && (result == 'failed)) return ['error, ("Command converted to \"" + str) + "\" but not understood."]; return result; }; new object $command_parser: $user_parsers; var $root manager = $command_parser; var $root created_on = 796680318; var $root inited = 1; var $root flags = ['methods, 'code, 'core, 'variables]; var $root managed = [$command_parser]; var $root owned = [$command_parser]; public method .parse() { arg u, str, next_parser, [other_parsers]; var l, cmd, c, p, obj; cmd = str.explode(); if (cmd) { cmd = [str, cmd[1], ((cmd.subrange(2)).join()) || ""]; p = []; if ((c = (| u.match_in_shortcut_cache(@cmd) |))) { if ((c[1]) == 'shortcut) return .shortcut(u, @c[2]); p = c[2]; } if ((c = (| u.match_in_local_cache(@cmd) |))) { if ((c[1]) == 'local) return .local(u, @c[2]); p += c[2]; } if ((c = (| u.match_in_remote_cache(@cmd) |))) { if ((c[1]) == 'remote) return .remote(u, @c[2]); p += c[2]; } l = u.location(); if ((c = (| l.match_in_local_cache(@cmd) |))) { if ((c[1]) == 'local) return .local(l, @c[2]); p += c[2]; } if ((c = (| l.match_in_remote_cache(@cmd) |))) { if ((c[1]) == 'remote) return .remote(u, @c[2]); p += c[2]; } if ((c = (| .grasp_for_remote_command(@cmd) |))) { if ((c[1]) == 'remote) return .remote(u, @c[2]); p += c[2]; } for obj in ((| (u.location()).exits() |) || []) { if (obj.match_name(str)) return ['command, obj, 'invoke]; } if (p) return .partial(u, cmd, p); } return next_parser.parse(u, str, @other_parsers); }; public method .partial() { arg user, args, templates; var part, line; for part in (templates) templates = templates.replace(part in templates, toliteral(part)); if ((templates.length()) == 1) line = toliteral(args[2]) + " could match "; else if ((templates.length()) == 2) line = toliteral(args[2]) + " could match either "; else line = toliteral(args[2]) + " could match any of "; return ['error, (line + (templates.to_english("", " or "))) + "."]; // $# Edited 18 Oct 1995 11:55 Lynx ($lynx) }; public method .shortcut() { arg user, method, parsed; return ['command, user, method, @parsed]; }; public method .complete() { arg cmd, user, obj, match, info; var x, method, parsed; method = info[2]; info = info[4]; parsed = info.keys(); for x in [1 .. match.length()] { if (x in parsed) match = match.replace(x, (> $command_lib.convert_arg((info[x])[1], match[x], user, ((info[x])[2]) ? (info[x])[2] : user, user) <)); } return [user, method, (cmd.explode())[1], @match]; }; public method .grasp_for_remote_command() { arg str, cmd, args; var reg, obj, cdef, match, matched, info; reg = args.match_regexp("[$#][a-z_0-9][a-z_0-9]*"); if (!reg) return 0; obj = (| $object_lib.to_dbref(args.subrange(@reg[1])) |); if (!obj) return 0; info = (| obj.get_command_info('remote, cmd) |); if (!info) return 0; matched = []; for cdef in (info) { match = args.match_template(cdef[2]); if (match != 0) matched += [[match.length(), obj, [str, cmd, @match], @cdef.subrange(3)]]; } if (matched) { matched = matched.sort(matched.slice(1)); return ['remote, matched]; } return ['partial, [[str, cmd], info.slice(3)]]; }; public method .local() { arg user, [matches]; var parsed, match; parsed = []; for match in (matches) { match = ._local(user, @match); if ((match[1]) == 'command) return match; parsed = [match[2]] + parsed; } return ['error, parsed.compress()]; }; public method .remote() { arg user, [matches]; var parsed, match; parsed = []; for match in (matches) { match = ._remote(user, @match); if ((match[1]) == 'command) return match; parsed = [match[2]] + parsed; } return ['error, parsed.compress()]; }; public method .handle_error() { arg traceback; return (traceback[1])[2]; }; public method ._remote() { arg user, nmatch, definer, match, template, method, info; var x, value, that, cmd; cmd = match[2]; catch any { for x in [1 .. nmatch] { if (dict_contains(info, x)) { if (((info[x])[1]) == 'this) { that = (> user.match_environment(match[x + 2]) <); if (!(that.is(definer))) return ['error, ((("You cannot " + (match[2])) + " ") + (that.name())) + "."]; } else { value = (> .convert_arg(cmd, (info[x])[1], match[x + 2], user, ((info[x])[2]) || [definer], user) <); } match = match.replace(x + 2, value); } } } with { if (error() == ~syntax) return ['error, (((traceback()[1])[2]) + template) + "\""]; return ['error, (traceback()[1])[2]]; } if (!that) return ['error, "An error was encountered: no target object found."]; return ['command, that, method, @match]; }; public method ._local() { arg user, nmatch, match, template, method, info; var x, cmd; cmd = match[2]; catch any { for x in [1 .. nmatch] { if (dict_contains(info, x)) match = match.replace(x + 2, (> .convert_arg(cmd, (info[x])[1], match[x + 2], user, (info[x])[2], user) <)); } } with { if (error() == ~syntax) return ['error, (((traceback()[1])[2]) + template) + "\""]; return ['error, (traceback()[1])[2]]; } return ['command, user, method, @match]; }; public method .convert_arg() { arg cmd, type, str, me, argargs, target; var obj, args, anc, out, x, y, list; switch (type) { case 'list: out = []; if (!str) return [(> .convert_arg(cmd, argargs[1], "", me, argargs[2], target) <)]; // or do the whole list if ("," in str) list = str.explode_english_list(","); else list = explode(str); for x in (list) { catch ~ambig { out = out.setadd(.convert_arg(cmd, argargs[1], x, me, argargs[2], target)); } with { if ((| (traceback()[1])[3] |) && (!((argargs[1]) in ['user, 'user_opt]))) { for y in ((traceback()[1])[3]) out = out.setadd((> .convert_arg(cmd, argargs[1], tostr(y), me, argargs[2], target) <)); } else { rethrow(error()); } } } return out; case 'any: return str; case 'any_opt: args = $parse_lib.getopt(str, argargs); return args; case 'object: return (> me.match_environment(str) <); case 'object_opt: args = $parse_lib.getopt(str, argargs); if (!(args[1])) throw(~syntax, "No reference specified for command \""); obj = (> me.match_environment((args[1])[1]) <); return [obj, delete(args[1], 1), args[2]]; case 'objref: return (> $parse_lib.ref(str, me) <); case 'objref_opt: args = $parse_lib.getopt(str, argargs); if (!(args[1])) throw(~syntax, "No reference specified for command \""); obj = (> $parse_lib.ref((args[1])[1], me) <); return [obj, delete(args[1], 1), args[2]]; case 'user: if (!str) throw(~match, "No user specified."); if (str == "me") return me; return (| $user_db.search(str) |) || throw(~match, ("Unable to find user " + str) + "."); case 'user_opt: args = $parse_lib.getopt(str, argargs); if (!(args[1])) throw(~syntax, "Nobody specified for command \""); if (str == "me") return me; return [(> $user_db.search((args[1])[1]) <), args[2]]; case 'number: return (> str.to_number() <); case 'number_opt: args = $parse_lib.getopt(str, argargs); if (!(args[1])) throw(~syntax, "No number specified for command \""); return [(> str.to_number() <), args[2]]; case 'descendant: obj = (> me.match_environment(str) <); anc = argargs ? argargs[1] : user; if (!(obj.has_ancestor(anc))) throw(~parse, strfmt("You cannot %s %s because it is not %s!", cmd, obj.name(), anc.name())); return obj; case 'descendant_opt: args = $parse_lib.getopt(str, argargs); if (!(args[1])) throw(~syntax, "No descendant specified for command \""); obj = (> me.match_environment((args[1])[1]) <); anc = argargs ? argargs[1] : user; if (!(obj.has_ancestor(anc))) throw(~parse, strfmt("You cannot %s %s because it is not %s!", cmd, obj.name(), anc.name())); return [obj, args[2]]; default: throw(~ack, ("Support for the type '" + type) + " is incomplete!"); } }; new object $editor_parser: $user_parsers; var $root manager = $editor_parser; var $root flags = ['methods, 'code, 'core, 'variables]; var $root created_on = 820684599; var $root inited = 1; var $root managed = [$editor_parser]; var $root owned = [$editor_parser]; var $user_parsers priority = 250; var $editor_parser commands = #[["ap?pend", 'append_cmd], ["a?fter", 'after_cmd], ["c?opy", 'copy_cmd], ["d?elete|e?rase", 'delete_cmd], ["done|quit", 'quit_cmd], ["f?ill|j?oin|w?rap", 'fill_cmd], ["h?elp", 'help_cmd], ["i?nsert", 'insert_cmd], ["line", 'line_cmd], ["l?ist|ls", 'list_cmd], ["m?ove|mv", 'move_cmd], ["save|comp?ile", 'save_cmd], ["store", 'store_cmd], ["sed|sub", 'subst_cmd]]; var $editor_parser command_help = #[['insert_cmd, ["Syntax: i?nsert [<text>] OR '<text>", "", "Add <text> before current line. You may also use a single-quote (') as a shortcut character. If text does not exist you will be prompted for the input."]], ['after_cmd, ["Syntax: a?fter [<text>] OR _<text>", "", "Add <text> after current line. You may also use an underscore (_) as a shortcut character. If text does not exist you will be prompted for the input."]], ['append_cmd, ["Syntax: ap?pend <text> OR ,<text>", "", "Add <text> after current line. You may also use a comma (,) as a shortcut character."]], ['delete_cmd, ["Syntax: d?elete [<range>]", "", "Delete <range> or current line."]], ['copy_cmd, ["Syntax: copy [<range>] [to] <line>", "", "Copy <range> of text or current line to <line>."]], ['quit_cmd, ["Syntax: done|quit", "", "Close editor without saving changes."]], ['fill_cmd, ["Syntax: fill <range> <line width>", "", "Fill <range> of lines to fit within <line width> appropriately (either by expanding or joining). 'join' and 'wrap' without the line width can be used as shortcuts for the respective function."]], ['help_cmd, ["Syntax: help [<command>]", "", "Basic editor help."]], ['line_cmd, ["Syntax: line <line>", "", "Change the current line to <line>. You can also use a period (.) as a shortcut character."]], ['move_cmd, ["Syntax: move [<range>] [to] <line>", "", "Move <range> or current line to <line>."]], ['list_cmd, ["Syntax: list [<range>] [-n?umbers]", "", "List <range> or all of edit buffer. The option -n?umbers may be used to not specify line numbers."]], ['subst_cmd, ["Syntax: s?ed|sub <range> \"<old>\" \"<new>\" [<options>]", "", "Search for <old> and replace it with <new> in <range>. The command 'sed' or 's' will use strsed() with regular expressions, the command 'sub' will use strsub() with literal matching. Options are only applicable to sed:", "", " g Globally match and replace (do it multiple times)", " s Single match and replace (do it only on the first occurance)", " c Case matters when matching.", " i Case doesn't matter when matching.", "", "Option defaults are: si"]], ['save_cmd, ["Syntax: save|comp?ile [as] [<ref>]", "", "Save document, if arguments are given will save alternate copy."]], ['store_cmd, ["Syntax: store", "", "Store editor--do not save changes. Editor can be resumed with @reedit."]]]; var $editor_parser shortcuts = #[["^'", 'insert_cmd], [",", 'append_cmd], ["_", 'after_cmd], [".", 'line_cmd]]; public method .parse() { arg u, str, next_parser, [other_parsers]; var word, cmd, argstr, c, m; while (str && ((str[1]) == " ")) str = str.subrange(2); if (!str) return next_parser.parse(u, str, @other_parsers); if ((str[1]) == ">") return next_parser.parse(u, str.subrange(2), @other_parsers); // special cased shortcuts for cmd in (shortcuts) { if ((str[1]) in (cmd[1])) return ['match, u.active_editor(), cmd[2], str[1], "", substr(str, 2)]; } // handle standard commands // special case 'sub|sed/...' if ((word = regexp(str, "^(sed|sub|s)[^a-z]"))) { word = word[1]; argstr = substr(str, strlen(word) + 1); return ['match, u.active_editor(), 'subst_cmd, word, "sed|sub", argstr]; } else if ((word = (| str.word(1) |))) { if (" " in str) argstr = substr(str, (" " in str) + 1); else argstr = ""; for cmd in (commands.keys()) { if ((m = match_template(word, cmd))) return ['match, u.active_editor(), commands[cmd], word, cmd, argstr]; } } // didn't match, move on return next_parser.parse(u, str, @other_parsers); }; public method .command_help() { return command_help; }; public method .commands() { return commands; }; new object $channel_parser: $user_parsers; var $root manager = $channel_parser; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 838745026; var $root inited = 1; var $root managed = [$channel_parser]; var $root owned = [$channel_parser]; var $user_parsers priority = 5000; public method .parse() { arg user, str, next_parser, [other_parsers]; var cname, first_word, parse_list; str = str.trim(); if (!str) return next_parser.parse(user, str, @other_parsers); parse_list = str.explode(); first_word = parse_list[1]; cname = user.channel_alias(first_word); if ((cname != "") && ((parse_list.length()) > 1)) return ['command, user, 'broadcast, cname, str.subrange((first_word.length()) + 2)]; return next_parser.parse(user, str, @other_parsers); }; new object $eval_parser: $user_parsers; var $root manager = $eval_parser; var $root managed = [$eval_parser]; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 847137598; var $user_parsers priority = 500; var $root inited = 1; var $root owned = [$eval_parser]; public method .parse() { arg u, str, next_parser, [other_parsers]; var out, l, eval; if (("`" in str) && (!match_begin(str, ";"))) { str = strsub(str, "\`", "<#QUOTED-TICK#>"); out = str.explode_delimited("`", "`"); eval = out[2]; str = ""; for l in (out[1]) { if (type(l) == 'integer) str += (> .evaluate(u, eval[l]) <); else str += l; } str = strsub(str, "<#QUOTED-TICK#>", "`"); } return next_parser.parse(u, str, @other_parsers); }; public method .evaluate() { arg user, str; var ep, vars, v, reg, r; ep = user.eval_prefix(); vars = (ep.keys()).join(", "); v = (ep.values()).join(); if (match_begin(str, "var") && (reg = regexp(str, "var ([^;]+)"))) { str = strsed(str, "var ([^;]+);", ""); str = ((((("var " + vars) + ", ") + (reg.join(","))) + ";") + v) + str; } else if ("return" in str) { str = ((("var " + vars) + ";") + v) + str; } else { str = strsed(str, " *;* *$", ""); str = ((((("var " + vars) + ";") + v) + "return (> ") + str) + " <);"; } r = (> user.evaluate(str, user, user) <); r = r[2]; if ((r[1]) == 'errors) throw(~evalerr, "Eval error: " + (r[2])); return r[2]; }; new object $filters: $misc; var $root child_index = 1; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'core, 'variables]; var $root manager = $filters; var $root owned = [$filters]; var $root managed = [$filters]; public method .compress() { arg input; var e, output; // only goes 1 element deep--sorry, anybody sending anything past that will // be shot. output = []; if (type(input) == 'list) { for e in (input) { if (type(e) == 'list) output += e; else output += [e]; } } else { output = [input]; } return output; }; new object $wrap_filter: $filters; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'variables, 'core]; var $root manager = $wrap_filter; var $root managed = [$wrap_filter]; var $root owned = [$wrap_filter]; public method .filter_text() { arg input; var len, output, e, line; return $string.wrap_line(input, sender().linelen()); }; new object $lock_parser: $misc; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'core, 'variables]; var $root manager = $lock_parser; var $lock_parser lock_types = [["inside", $inside_lock_frob], ["indirect", $indirect_lock_frob], ["owner", $owner_lock_frob]]; var $root owned = [$lock_parser]; var $root managed = [$lock_parser]; public method .parse() { arg s, env; var stack, lock, n, m, obj, type, i; stack = []; s = " " + s; s = strsed(s, "&([^&])", "&&%1", "g"); s = strsed(s, "\|([^\|])", "||%1", "g"); s = strsub(s, " or ", " || "); s = strsub(s, " and ", " && "); s = strsub(s, " not ", " !"); while (1) { // Look for valid prefixes. while (1) { (s = s.trim()) || throw(~parse, "String ends unexpectedly."); if ((s[1]) == "(") { stack = ['open, @stack]; s = s.subrange(2); } else if ((s[1]) == "!") { if (stack && ((stack[1]) == 'not)) stack = stack.subrange(2); else stack = ['not, @stack]; s = s.subrange(2); } else { break; } } // Look for an object name or tag m = regexp(s, "^([^)&|]+)(.*)"); if (!m) throw(~parse, "Null object obj_name."); s = m[2]; lock = (m[1]).trim(); if (!lock) throw(~parse, "Null object obj_name."); // try and match it type = $object_lock_frob; for i in (lock_types) { if (lock.match_begin((i[1]) + ":")) { type = i[2]; lock = lock.subrange(((i[1]).length()) + 2); break; } } if ((obj = (| env.match_environment(lock) |))) { lock = type.new_lock(obj); } else { switch (lock) { case "any", "true", "anybody": lock = $true_lock_frob.new(); case "none", "false", "nobody": lock = $false_lock_frob.new(); default: throw(~parse, ("Invalid lock tag \"" + lock) + "\""); } } stack = [lock, @stack]; // Loop until no more reduction to be done. while (1) { // Process negations, ands, ors. while (1) { if ((stack.length()) < 2) break; if ((stack[2]) == 'not) stack = [$not_lock_frob.new_lock(stack[1]), @stack.subrange(3)]; else if ((stack[2]) == 'and) stack = [$and_lock_frob.new_lock(stack[1], stack[3]), @stack.subrange(4)]; else if ((stack[2]) == 'or) stack = [$or_lock_frob.new_lock(stack[1], stack[3]), @stack.subrange(4)]; else break; } // Close parens, if necessary; otherwise stop. if ((!s) || ((s[1]) != ")")) break; while (s && ((s[1]) == ")")) { if (((stack.length()) < 2) || ((stack[2]) != 'open)) throw(~parse, "Misplaced right parenthesis."); stack = [stack[1], @stack.subrange(3)]; s = (s.subrange(2)).trim(); } } // Are we done? if (!s) { if ((stack.length()) > 1) throw(~parse, "Unmatched left parentheses."); return stack[1]; } // No, we're at a conjunction. if ((s[1]) == "&") { stack = ['and, @stack]; s = s.subrange(3); } else if ((s[1]) == "|") { stack = ['or, @stack]; s = s.subrange(3); } else { throw(~parse, "Illegal character following right parenthesis."); } } }; new object $editor_session: $misc; var $root manager = $editor_session; var $root flags = ['methods, 'code, 'fertile, 'core, 'variables]; var $root created_on = 820684587; var $root inited = 1; var $root child_index = 526; var $editor_session finisher = 0; var $editor_session sender = 0; var $editor_session text = 0; var $editor_session line = 0; var $editor_session modified = 0; var $editor_session client_data = 0; var $editor_session finisher_object = 0; var $root managed = [$editor_session]; var $root owned = [$editor_session]; public method .startup() { arg fin_object, finish_method, initial_text, cdata; (> .perms(sender()) <); if (type(initial_text) == 'string) initial_text = [initial_text]; sender = sender(); finisher = finish_method; finisher_object = fin_object; text = initial_text; line = 1; modified = 0; client_data = cdata; if ((| (sender().local_editor()) == 'mcp |)) { sender.tell([(("#$# edit name: " + ((.name()).strip())) + " upload: @mcp-upload-session ") + (.name()), @text, "."]); text = 'mcp; sender.store_editor(); return 0; } else { return 1; } }; public method .abort_cmd() { arg [args]; (> .perms(caller(), $user) <); sender.quit_editor(); return "Aborted. Editor cleared."; }; public method .insert_cmd() { arg cmd, tmpl, what; (> .perms(caller(), $user) <); modified = 1; if (what || match_regexp(cmd, "^[^a-z]")) { text = insert(text, line, what); line++; return ("Line " + tostr(line - 1)) + " added."; } else { return .read_text(0, sender()); } }; public method .save_cmd() { arg cmd, tmpl, args; var err, m; (> .perms(caller(), $user, this()) <); if ((m = match_template(args, "as *"))) return "Save as support is not yet completed."; if ((> (err = sender.do_save(finisher_object, finisher, text, client_data)) <) == 'clear) { sender.quit_editor(); return "Done. Editor cleared."; } if (type(err) == 'list) return .compile_errors(@err); modified = 0; return "Save completed."; }; public method .delete_cmd() { arg cmd, tmpl, what; var start, end, gone, foo, len; (> .perms(caller(), $user) <); catch any start = ._parse_range(what); with return "Illegal range, can't delete."; [start, end] = start; len = end - start; gone = sublist(text, start, (end - start) || 1); text = sublist(text, 1, start - 1) + sublist(text, end + 1); modified = 1; line = start; return ((((((("Deleted " + ((end - start) + 1)) + " line") + ((end == start) ? "" : "s")) + " (\"") + ((gone[1]).chop(20))) + "\"), current line is ") + line) + "."; }; public method .line_cmd() { arg cmd, tmpl, number; (> .perms(caller(), $user) <); number = (number == "$") ? text.length() : (number.to_number()); if ((number < 1) || (number > ((text.length()) + 1))) return "Out if range."; else line = number; return ("Current line set to " + tostr(line)) + "."; }; public method ._parse_range() { arg what, [allow]; var start, end, range; if (what == "%") what = "1-$"; what = strsub(what, "$", tostr(listlen(text))); what = strsub(what, ".", tostr(line)); what = strsub(what, ",", "-"); allow = allow ? 1 : 0; if (!what) { start = (end = line); } else { range = (> $parse_lib.range(what) <); start = range[1]; if (start == 'specific) throw(~range, "Illegal range."); end = ((range[2]) == 'single) ? start : (range[2]); } if ((start < 1) || ((end > (listlen(text) + allow)) || (end < start))) throw(~range, "Illegal range."); return [start, end]; }; public method .help_cmd() { arg cmd, tmpl, what; var parse; what = what.trim(); if (!what) return ["Editor commands (use 'help <cmd>' for detailed information):"] + (((($editor_parser.commands()).keys()).vcolumnize(3, (sender().linelen()) - 5)).prefix(" ")); parse = $editor_parser.parse(sender(), what, $null_parser); if ((parse[1]) in ['ok, 'failed]) return ("Unable to find editor command '" + what) + "'."; return ($editor_parser.command_help())[parse[3]]; }; public method .quit_cmd() { arg cmd, tmpl, [args]; var ans; (> .perms(caller(), $user) <); if (modified) { ans = sender.prompt("Discard changes? [yes] "); if (!(ans.is_boolean())) return "Ok. Editor not cleared."; } sender.quit_editor(); return "Done. Editor cleared."; }; public method .fill_cmd() { arg cmd, tmpl, what; var start, end, width; (> .perms(caller(), $user) <); what = what.explode(); catch any start = ._parse_range(what[1]); with return "Illegal range, can't fill."; end = start[2]; start = start[1]; width = ((what.length()) > 1) ? (what[2]).to_number() : 75; text = ((text.subrange(1, start - 1)) + (((text.subrange(start, (end - start) + 1)).join(" ")).wrap_lines(width))) + (text.subrange(end + 1)); modified = 1; line = start; return ("Fill completed. Current set to " + tostr(start)) + "."; }; public method .subst_cmd() { arg cmd, tmpl, args; var start, end, opts, changed, sep, h, range; (> .perms(caller(), $user) <); h = ($editor_parser.command_help())['subst_cmd]; if (!args) return h; sep = args[1]; args = substr(args, 2); args = explode(args, sep); if ((!args) || (listlen(args) < 2)) return h + ["", "! Invalid number of arguments."]; if (text == []) return h + ["", "! There is no text to search and replace in."]; if (listlen(args) > 2) { [opts, range] = (args[3]).regexp("([gsci]*)(.*)"); if ((!range) && (listlen(args) > 3)) range = args[3]; } else { opts = ""; } if (range) { catch any start = ._parse_range(range); with return h + ["", "! " + ((traceback()[1])[2])]; [start, end] = start; } else { start = line; end = line; } if (match_template(cmd, "s?ed")) changed = .sed(start, end, args[1], args[2], opts); else changed = .sub(start, end, args[1], args[2], opts); modified = changed; if (changed == 1) return changed + " line changed."; else if (changed > 1) return changed + " lines changed."; else return "No lines changed."; }; public method .session_name() { // cruft this up at a later time switch (finisher) { case '_edit_method_callback: return ((("Method " + (client_data[1])) + ".") + (client_data[2])) + "()"; case '_edit_messages_callback: return "Messages on " + (finisher_object.namef('ref)); default: return tostr(finisher); } }; public method .mcp_cleanup_session() { (> .perms(sender()) <); if (type(text) == 'symbol) return 1; return 0; }; public method .is_resumable() { return type(text) != 'symbol; }; public method .mcp_upload() { arg newtext; var err; (> .perms(sender()) <); if ((> (err = sender.do_save(finisher_object, finisher, newtext, client_data)) <) == 'clear) { sender.quit_editor(); return "Done. Editor cleared."; } if (type(err) != 'list) modified = 0; return err ? err : "Save completed."; }; public method .startup_sender(): nooverride { return sender; }; public method .compile_errors() { arg [err]; var m; if ((m = regexp(err[1], "Line ([0-9]+)"))) { line = toint(m[1]); return [.list_cmd("", "")] + err; } return err; }; public method .list_cmd() { arg cmd, tmpl, rangestr; var start, end, out, i, j, k, l, lineno; (> .perms(caller(), $user, definer()) <); if (text == []) return "There is no text."; rangestr = rangestr.trim(); if (!rangestr) { l = text.length(); start = line - 7; end = line + 7; if (start < 1) { end = (end + 1) - start; if (end > l) end = l; start = 1; } else if (end > l) { start = (start - end) + l; end = l; if (start < 1) start = 1; } start = [start, end]; } else { catch any start = ._parse_range(rangestr); with return "Illegal list range."; } end = start[2]; start = start[1]; out = []; j = start; for i in (text.subrange(start, (end - start) + 1)) { if (j == line) lineno = (("=>" + j).right(5)) + ": "; else lineno = (tostr(j).right(5)) + ": "; out += (lineno + i).wrap_lines(sender.linelen(), " "); j++; } if (listlen(text) <= end) { if ((j == line) && (j == ((text.length()) + 1))) out += ["=>[End]"]; else out += [" [End]"]; } return out; }; private method .read_text() { arg offset, sender; var newtext, start; if ((> (newtext = sender.read()) <)) { modified = 1; text = listgraft(text, line + offset, newtext); start = line + offset; line = (line + (newtext.length())) + offset; if (listlen(newtext) == 1) return ("Line " + start) + " added."; return ((("Lines " + start) + " to ") + (start + listlen(newtext))) + " added."; } else { return "Text unchanged."; } }; public method .after_cmd() { arg cmd, tmpl, what; var offset; (> .perms(caller(), $user) <); if (line > listlen(text)) offset = line - listlen(text); if (what || match_regexp(cmd, "^[^a-z]")) { modified = 1; text = insert(text, (line + 1) - offset, what); line += 2 - offset; return ("Line " + (line - 1)) + " added."; } else { return .read_text(1 - offset, sender()); } }; public method .append_cmd() { arg cmd, tmpl, what; var offset; (> .perms(caller(), $user) <); modified = 1; if (line > listlen(text)) { text += [what]; return ("Line " + listlen(text)) + " added."; } else if (line == 1) { text = [line] + text; line = 2; return "Line 1 added."; } else { text = replace(text, line, (text[line]) + what); return ("Appended to line " + tostr(line)) + "."; } }; public method .store_cmd() { arg cmd, tmpl, [args]; (> .perms(caller(), $user) <); return sender.store_editor(); }; public method .copy_cmd() { arg cmd, tmpl, args; var m, range, toline, copy, start, end; (> .perms(caller(), $user) <); if ((m = match_template(args, "* to *"))) [range, m, toline] = m; else if (listlen((m = explode(args))) > 1) [range, toline] = m; else toline = args; if (!toline) return "Copy to where?"; toline = toint(toline); if ((toline < 1) || (toline > (listlen(text) + 1))) return ((("Line " + toline) + " is outside the possible range (1 .. ") + (listlen(text) + 1)) + ")."; if (range) { if (!(range = (| ._parse_range(args, 'allow) |))) return "Illegal range, cannot copy."; } else if (line > listlen(text)) { return "Illegal range, cannot copy."; } else { range = [line, line]; } [start, end] = range; copy = sublist(text, start, (end - start) + 1); text = listgraft(text, toline, copy); line = toline + listlen(copy); if (start == end) return ((("Line " + start) + " copied to line ") + toline) + "."; return ((((("Lines " + start) + " .. ") + end) + " copied to line ") + toline) + "."; }; public method .move_cmd() { arg cmd, tmpl, args; var m, range, toline, move, start, end; (> .perms(caller(), $user) <); if ((m = match_template(args, "* to *"))) [range, m, toline] = m; else if (listlen((m = explode(args))) > 1) [range, toline] = m; else toline = args; if (!toline) return "Copy to where?"; toline = toint(toline); if ((toline < 1) || (toline > (listlen(text) + 1))) return ((("Line " + toline) + " is outside the possible range (1 .. ") + (listlen(text) + 1)) + ")."; if (range) { if (!(range = (| ._parse_range(args, 'allow) |))) return "Illegal range, cannot move."; } else if (line > listlen(text)) { return "Illegal range, cannot move."; } else { range = [line, line]; } [start, end] = range; if ((toline == start) || ((toline == end) || ((toline > start) && (toline < end)))) return "Source and destination lines conflict."; move = sublist(text, start, (end - start) + 1); if (toline > end) { text = listgraft(text, toline, move); text = sublist(text, 1, start - 1) + sublist(text, end + 1); line = toline; } else { text = sublist(text, 1, start - 1) + sublist(text, end + 1); text = listgraft(text, toline, move); line = toline + listlen(move); } if (start == end) return ((("Line " + start) + " moved to line ") + toline) + "."; return ((((("Lines " + start) + " .. ") + end) + " moved to line ") + toline) + "."; }; public method .sed() { arg start, end, search, replace, opts; var x, line, changed; for x in [start .. end] { line = strsed(text[x], search, replace, opts); if (strcmp(line, text[x])) { text = replace(text, x, line); changed++; } } return changed; }; public method .sub() { arg start, end, search, replace, opts; var x, line, changed, i; for x in [start .. end] { line = strsub(text[x], search, replace, opts); if (strcmp(line, text[x])) { text = replace(text, x, line); changed++; } } return changed; }; new object $symbol: $libraries; var $root manager = $symbol; var $root created_on = 811822782; var $root inited = 1; var $root flags = ['methods, 'code, 'variables, 'core]; var $root managed = [$symbol]; var $root owned = [$symbol]; public method .to_string() { arg sym; return tostr(sym); }; new object $math: $libraries; var $root manager = $math; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 845760297; var $root inited = 1; var $math pi = 3.14159; var $math pi2 = 6.28318; var $math origin_2d = [0.0, 0.0]; var $math origin_3d = [0.0, 0.0, 0.0]; var $math transmat_2d = [[1.0, 0.0, 0.0], [0.0, 1.0, 0.0]]; var $math transmat_3d = [[1.0, 0.0, 0.0, 0.0], [0.0, 1.0, 0.0, 0.0], [0.0, 0.0, 1.0, 0.0]]; var $root managed = [$math]; var $root owned = [$math]; public method .minor(): native; public method .major(): native; public method .add(): native; public method .sub(): native; public method .dot(): native; public method .distance(): native; public method .cross(): native; public method .scale(): native; public method .is_lower(): native; public method .transpose(): native; public method .polar_rectangular() { arg coords; return [(coords[1]) * cos(coords[2]), (coords[1]) * sin(coords[2])]; }; public method .rectangular_polar() { arg coords; var a; a = atan2(coords[2], coords[1]); if (a < 0) a += pi2; return [.distance(coords, origin_2d), a]; }; public method .pi() { return pi; }; public method .pi2() { return pi2; }; public method .deg_rad() { arg angle; return angle / 57.2958; }; public method .rad_deg() { arg angle; return angle * 57.2958; }; public method .matrix_add() { arg m1, m2; var i; return map i in [1 .. m1.length()] to (.add(m1[i], m2[i])); }; public method .matrix_sub() { arg m1, m2; var i; return map i in [1 .. m2.length()] to (.sub(m1[i], m2[i])); }; public method .matrix_mul() { arg m1, m2; var x, y; m2 = .transpose(m2); return map x in (m1) to (map y in (m2) to (.dot(x, y))); }; public method .spherical_rectangular() { arg coords; var r, phi, theta, r1; r = coords[1]; phi = coords[2]; theta = coords[3]; r1 = r * cos(theta); return [r1 * cos(phi), r1 * sin(phi), r * sin(theta)]; }; public method .rectangular_spherical() { arg coords; var a, d; a = atan2(coords[2], coords[1]); if (a < 0) a += pi2; return [(d = .distance(coords, origin_3d)), a, atan2(coords[3], .distance(coords.subrange(1, 2), origin_2d))]; }; public method .ident_mat() { arg n; var x, y; return map x in [1 .. n] to (map y in [1 .. n] to ((x == y) ? 1.0 : 0.0)); }; public method .translation_mat() { arg vector; var x, y; if ((vector.length()) == 2) return transmat_2d + [vector + [1.0]]; else return transmat_3d + [vector + [1.0]]; }; public method .rectangular_cylindrical() { arg coords; var a; a = atan2(coords[2], coords[1]); if (a < 0) a += pi2; return [.distance(coords, origin_2d), a, coords[3]]; }; public method .cylindrical_rectangular() { arg coords; return [(coords[1]) * cos(coords[2]), (coords[1]) * sin(coords[2]), coords[3]]; }; public method .matrix_scale() { arg s, m; var x; return map x in (m) to (.scale(s, x)); }; public method .tensor() { arg v1, v2; var x, y; return map x in (v1) to (map y in (v2) to (x * y)); }; public method .skew() { arg v; return [[0.0, v[3], -(v[2])], [-(v[3]), 0.0, v[1]], [v[2], -(v[1]), 0.0]]; }; public method .rotation_mat_3d() { arg axis, angle; var s, c, m, tens; s = sin(angle); c = cos(angle); if (type(axis) == 'list) { axis = .scale(1.0 / (.distance(axis, origin_3d)), axis); tens = .tensor(axis, axis); m = .matrix_add(tens, .matrix_add(.matrix_scale(s, .skew(axis)), .matrix_scale(c, .matrix_sub(.ident_mat(3), tens)))); return [[@m[1], 0.0], [@m[2], 0.0], [@m[3], 0.0], [0.0, 0.0, 0.0, 1.0]]; } else { switch (axis) { case 'z: return [[c, s, 0.0, 0.0], [-s, c, 0.0, 0.0], [0.0, 0.0, 1.0, 0.0], [0.0, 0.0, 0.0, 1.0]]; case 'y: return [[c, 0.0, -s, 0.0], [0.0, 1.0, 0.0, 0.0], [s, 0.0, c, 0.0], [0.0, 0.0, 0.0, 1.0]]; case 'x: return [[1.0, 0.0, 0.0, 0.0], [0.0, c, s, 0.0], [0.0, -s, c, 0.0], [0.0, 0.0, 0.0, 1.0]]; } } }; public method .transform_vect() { arg m, v; var x, outvect, flag; if ((m.length()) == ((v.length()) + 1)) { v += [1.0]; flag = 1; } outvect = map x in (m) to (.dot(x, v)); return flag ? outvect.subrange(1, (outvect.length()) - 1) : outvect; }; public method .rotation_mat_2d() { arg angle; var s, c; s = sin(angle); c = cos(angle); return [[c, s, 0.0], [-s, c, 0.0], [0.0, 0.0, 1.0]]; }; public method .scale_mat() { arg scale; if ((scale.length()) == 2) return [[scale[1], 0.0, 0.0], [0, scale[2], 0.0], [0.0, 0.0, 1.0]]; else return [[scale[1], 0.0, 0.0, 0.0], [0.0, scale[2], 0.0, 0.0], [0.0, 0.0, scale[3], 0.0], [0.0, 0.0, 0.0, 1]]; }; public method .runge() { arg x, y, h, f; var k1, k2, k3, k4, s; // returns the next timestep for differential equation y'=f(x,y) s = sender(); k1 = s.f(x, y); k2 = s.f(x + (0.5 * h), .add(y, .scale(0.5 * h, k1))); k3 = s.f(x + (0.5 * h), .add(y, .scale(0.5 * h, k2))); k4 = s.f(x + h, .add(y, .scale(h, k3))); return .add(y, .scale(h / 6.0, .add(.add(k1, .scale(2.0, .add(k2, k3))), k4))); }; new object $english_lib: $libraries; var $root manager = $english_lib; var $english_lib alphabet = "abcdefghijklmnopqrstuvwxyz"; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 847697242; var $english_lib capitalize_exceptions = ["the", "a", "an", "and", "for", "but", "or", "nor", "of", "with", "using", "at", "to", "in", "into", "on", "onto", "upon", "out", "from", "over", "under", "through", "underneath", "beneath", "behind", "beside", "about", "as", "off"]; var $root inited = 1; var $english_lib vowel_exceptions = "usu|uke|uvu|use|UPI|unit|univ|unic|uniq|unix|eur|uu|ubiq|union|one|once|uti|unif"; var $english_lib nonvowel_exceptions = "historic|ydu|honor|honest|habitual|heir|RPG"; var $english_lib noun_exceptions = #[["child", "children"], ["deer", "deer"], ["moose", "moose"], ["mouse", "mice"]]; var $english_lib letter_names = ["ay", "bee", "see", "dee", "ee", "eff", "jee", "aitch", "eye", "jay", "kay", "el", "em", "en", "oh", "pee", "queue", "ar", "es", "tee", "you", "vee", "double-you", "ex", "why", "zee"]; var $english_lib cardinal_directions = ["north", "northeast", "east", "southeast", "south", "southwest", "west", "northwest"]; var $english_lib verb_exceptions = #[["has", "have"], ["is", "are"], ["was", "were"], ["'s", "'ve"], ["can", "can"], ["collapses", "collapse"]]; var $english_lib cardinal_direction_opposites = ["south", "southwest", "west", "northwest", "northeast", "east", "southeast"]; var $english_lib selector_words = ["all", "everything", "everyone", "everybody"]; var $root managed = [$english_lib]; public method .titleize() { arg string; var words; words = string.explode(); if ((words.length()) < 2) { if (words) return string.capitalize(); else return string; } return [(words[1]).capitalize(), @(words.subrange(2, (words.length()) - 2)).lmap('capitalize), (words[words.length()]).capitalize()].join(); }; public method .capitalize() { arg str; var m, word; // capitalize the first character of the first alphanumeric word found, // if it is not in the exceptions list. Example: // // $english_lib.capitalize(" @foo") => " @Foo" // if (!(m = match_regexp(str, "[a-z0-9]+"))) return str; word = (regexp(str, "[a-z0-9]+")[1]).capitalize(); anticipate_assignment(); return strsed(str, "[a-z0-9]+", word); }; public method ._noun_singular() { arg string; var k; anticipate_assignment(); if ((k = string in (noun_exceptions.values()))) return (noun_exceptions.keys())[k]; return ._remove_s(string); }; public method ._noun_plural() { arg string; var k; anticipate_assignment(); string = strsed(string, "^(a|an) +", ""); if ((k = (| noun_exceptions[string] |))) return k; return ._add_s(string); }; public method .vowel_exception() { arg word; var prefix; return match_regexp(word, vowel_exceptions) ? 1 : 0; }; public method .nonvowel_exception() { arg word; var prefix; return match_regexp(word, nonvowel_exceptions) ? 1 : 0; }; public method .indef_article() { arg word; if ((((word[1]) in "aeiou") && (!(.vowel_exception(word)))) || (.nonvowel_exception(word))) return "an"; else return "a"; }; public method .get_conjugation() { arg spec, [plural]; var i, vb; i = "/" in (spec + "/"); if (plural) { if (i < (spec.length())) vb = spec.subrange(i + 1); else vb = ._verb_plural(spec); } else if (i > 1) { vb = spec.subrange(1, i - 1); } else { vb = ._verb_singular(spec.subrange(2)); } if (strcmp("a", (i == 1) ? spec[2] : spec) > 0) return vb.capitalize(); else return vb; }; public method .get_noun() { arg spec, [plural]; var i, vb; i = "/" in (spec + "/"); if (plural && (plural[1])) { if (i < (spec.length())) vb = spec.subrange(i + 1); else vb = ._noun_plural(spec); } else if (i > 1) { vb = spec.subrange(1, i - 1); } else { vb = ._noun_singular(spec.subrange(2)); } // just pass to $string.capitalize()? if (strcmp("a", (i == 1) ? spec[2] : spec) > 0) return vb.capitalize(); else return vb; }; public method ._verb_singular() { arg string; var len, a; len = string.length(); if ((len > 2) && match_regexp(string, "n't *$")) return (._verb_singular(string.subrange(1, len - 3))) + "n't"; else if ((a = string in (verb_exceptions.values()))) return (verb_excetions.keys())[a]; return ._add_s(string, len); }; public method ._verb_plural() { arg string; var len, a; len = string.length(); if ((len > 2) && match_regexp(string, "n't *$")) return (._verb_plural(string.subrange(1, len - 3))) + "n't"; else if ((a = (| verb_exceptions[string] |))) return a; return ._remove_s(string); }; public method ._add_s() { arg str; var len; len = strlen(str); if (len < 2) return str + "s"; if (((str[len]) == "y") && (!((str[len - 1]) in "aeiou"))) return substr(str, 1, len - 1) + "ies"; else if (((((str[len]) == "o") && (!((str[len - 1]) in "aeiouy"))) || ((str[len]) in "sx")) || ((len > 1) && ((substr(str, len - 1, 2) in "chsh") % 2))) return str + "es"; else return str + "s"; }; public method ._remove_s() { arg str; var len; len = strlen(str); if ((len <= 3) || ((str[len]) != "s")) return str; else if ((str[len - 1]) != "e") return substr(str, 1, len - 1); else if (((((str[len - 2]) == "h") && ((str[len - 3]) in "cs")) || ((str[len - 2]) in "ox")) || (((str[len - 2]) == "s") && (!((str[len - 3]) in "aeiouy")))) return substr(str, 1, len - 2); else if ((str[len - 2]) == "i") return substr(str, 1, len - 3) + "y"; else return substr(str, 1, len - 1); }; public method .selector_words() { return selector_words; }; public method .selector_word_default() { arg word, place; var tmp, item; if (word in ["everyone", "everybody"]) return (place.contents()).mfilter('has_ancestor, $body); else return ((word in selector_words) && [get_var(tosym(word))]) || []; }; public method .def_article() { arg string; // For completeness sake return "the"; }; public method .compress_names() { arg names, [args]; var c, x, n, ret; if (names == (c = names.compress())) return names.to_english(@args); ret = []; for x in (c) { if ((n = names.count(x)) > 1) ret += [((n.to_english_text()) + " ") + (._noun_plural(x.strip_article()))]; else ret += [x]; } return ret.to_english(@args); }; new object $time: $libraries; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'variables, 'core]; var $time months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; var $time days = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]; var $root manager = $time; var $root managed = [$time]; var $root owned = [$time]; var $time time_units = [[31536000, "year", "years", "yr", "yrs"], [2592000, "month", "months", "mo", "mos"], [604800, "week", "weeks", "wk", "wks"], [86400, "day", "days", "dy", "dys"], [3600, "hour", "hours", "hr", "hrs"], [60, "minute", "minutes", "min", "mins"], [1, "second", "seconds", "sec", "secs"]]; public method .format(): native; public method .elapsed() { arg time, [flag]; var str, t, p; // compares args[1] with time() and returns hh:mm elapsed // will eventually make flags do things like 'long etc. For now its // just your own time, rather than time(). [(flag ?= 'stopwatch)] = flag; str = ""; switch (flag) { case 'long: return .to_english(time); default: if (time > 356400) p = 3; else p = 2; return strfmt("%2{0}r:%2{0}r:%2{0}r", time / 3600, (time % 3600) / 60, time % 60); } }; public method .dhms() { arg secs, [long]; var ret_str, x; if (long) long = 1; if (secs > 86400) { x = secs / 86400; ret_str = x + (long ? " day" + ((x < 2) ? "" : "s") : "d"); } else if (secs > 3600) { x = secs / 3600; ret_str = x + (long ? " hr" + ((x < 2) ? "" : "s") : "h"); } else if (secs > 60) { x = secs / 60; ret_str = x + (long ? " min" + ((x < 2) ? "" : "s") : "m"); } else { ret_str = secs + (long ? " sec" + ((secs < 2) ? "" : "s") : "s"); } return ret_str; }; public method .from_english() { arg string; return $world_time.from_english(string, time_units); }; public method .to_english() { arg time, [reftime]; var times, words, x, ctime, mnths, month, year, days, out, lt, rrk; // most of this was stolen from MOO (und ve are evil) if (time < 1) return "0 seconds"; reftime = reftime || time(); words = ["year", "month", "day", "hour", "minute", "second"]; times = []; for x in ([60, 60, 24]) { times = [time % x, @times]; time = time / x; } mnths = 0; lt = localtime(reftime); month = lt[6]; if ((lt[7]) < 100) year = 1900 + (lt[7]); else year = lt[7]; days = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month]; while (time >= (days + ((month == 2) && (((year % 4) == 0) && (!((year % 400) in [100, 200, 300])))))) { time -= days; mnths++; month++; if (month > 12) { year++; month = 1; } } times = [mnths / 12, mnths % 12, time, @times]; out = []; for x in [1 .. 6] { if ((times[x]) > 0) out += [(((times[x]) + " ") + (words[x])) + (((times[x]) == 1) ? "" : "s")]; } return out.to_english(); }; new object $world_time: $libraries; var $root manager = $world_time; var $world_time speedup = 1; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 848446570; var $world_time time_units = [[31536000, "year", "years", "yr", "yrs"], [2592000, "month", "months", "mo", "mos"], [604800, "week", "weeks", "wk", "wks"], [86400, "day", "days", "dy", "dys"], [3600, "hour", "hours", "hr", "hrs"], [60, "minute", "minutes", "min", "mins"], [1, "second", "seconds", "sec", "secs"]]; var $root inited = 1; var $world_time zone_offset = 0; var $world_time start_time = 0; var $root managed = [$world_time]; public method .from_english() { arg string, [units]; var words, len, nsec, n, i, entry, unit, ok; [(units ?= time_units)] = units; words = string.explode(); words = words.setremove_all("and"); len = words.length(); if (len % 2) throw(~args, "Invalid time."); nsec = (n = 0); for i in [1 .. len] { if ((i % 2) == 1) { if ((words[i]).is_numeric()) n = (words[i]).to_number(); else if ((words[i]) in ["a", "an"]) n = 1; else if ((words[i]) == "no") n = 0; else throw(~invarg, "Invalid time."); } else { unit = words[i]; unit = unit.strip(","); ok = 0; for entry in (units) { if (unit in (entry.subrange(2))) { ok++; nsec += (entry[1]) * n; break; } } if (!ok) throw(~invarg, "Invalid time."); } } return nsec; }; public method .local_time() { return (time() - start_time) * speedup; }; public method .daytime() { arg zone, dayscale; var t, t1, t2; t = (((.local_time()) / 3600) + zone) % 24; t1 = 6 - dayscale; t2 = 18 + dayscale; switch (t1) { case 0 .. 2: return [t, 'night, 'night]; case 3 .. t1 - 1: return [t, 'predawn, 'night]; case t1: return [t, 'dawn, 'day]; case t1 + 1 .. 11: return [t, 'morning, 'day]; case 12: return [t, 'noon, 'day]; case 13 .. t2 - 1: return [t, 'afternoon, 'day]; case t2: return [t, 'sunset, 'day]; case t2 + 1 .. 22: return [t, 'evening, 'night]; case 23: return [t, 'night, 'night]; } }; public method .time_units() { return time_units; }; new object $graph: $libraries; var $root manager = $graph; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 848800783; var $root inited = 1; var $root managed = [$graph]; public method .breadth_search() { arg node, data, neighbors, is_dest; var d, i, j, path; d = #[[node, 'source]]; i = 1; while ((i <= ((d.keys()).length())) && (!(node = (d.keys())[i++]).(is_dest)(data))) { refresh(); for j in (node.(neighbors)()) d = d.add(j, node); } if (i <= ((d.keys()).length())) { refresh(); path = [node]; while ((node = d[node]) != 'source) path += [node]; return path; } else { return 0; } }; new object $heap: $libraries; var $root manager = $heap; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 848818545; var $root inited = 1; var $root managed = [$heap]; public method .push() { arg heap, element, priority_ind; var i, j; heap += [0]; i = listlen(heap); if (!i) { heap = [element]; return; } // We mustn't run out of tics here... while ((i > 1) && ((element[priority_ind]) < ((heap[(j = i / 2)])[priority_ind]))) heap = replace(heap, i, heap[(i = j)]); heap = heap.replace(i, element); return heap; }; public method .del() { arg heap, i, priority_ind; var j, len, min; // this must *not* throw refresh(); len = listlen(heap); while (i != len) { min = len; j = i * 2; if ((j < len) && (((heap[j])[2]) < ((heap[min])[priority_ind]))) min = j; j++; if ((j < len) && (((heap[j])[2]) < ((heap[min])[priority_ind]))) min = j; heap = replace(heap, i, heap[min]); i = min; } heap = heap.subrange(1, len - 1); return heap; }; new object $place_lib: $libraries; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'variables, 'core]; var $place_lib default_place = $nowhere; var $place_lib default_new_place = $place; var $place_lib coordinate_shortcuts = #[["n?orth", [0, 0]], ["s?outh", [180, 0]], ["e?ast", [90, 0]], ["w?est", [270, 0]], ["ne|northeast", [45, 0]], ["se|southeast", [135, 0]], ["nw|northwest", [225, 0]], ["sw|southwest", [315, 0]], ["d?own", [-1, -90]], ["u?p", [-1, 90]]]; var $place_lib known_realms = [$realm_of_creation]; var $place_lib build_hints = #[[1, <$ctext_frob, [["This is the do-it-all system for building places. At any time you can enter \"@abort\" to abort building. To turn off these hints \"@set experienced\" in your regular command environment.", <$format, ["hr", [], [], 'do_hr]>], #[['this, $place_lib]]]>], [2, <$ctext_frob, [["The specified destination does not exist, therefore a new one will be created with the name you specified.", <$format, ["hr", [], [], 'do_hr]>], #[['this, $place_lib]]]>], [3, <$ctext_frob, [["Name aliases can be specified on the same line as the name. This is done by seperating them from the name with commas. Any number of aliases can be specified in this manner (such as \"Name, alias, alias, alias\"). Names types can be defined by appending ", <$format, ["tt", [], ["+type"], 'do_tt]>, ", where ", <$format, ["tt", [], ["type"], 'do_tt]>, " is one of ", <$format, ["tt", [], ["proper"], 'do_tt]>, ", ", <$format, ["tt", [], ["unique"], 'do_tt]>, " or ", <$format, ["tt", [], ["normal"], 'do_tt]>, ". Not specifying a type defaults to ", <$format, ["tt", [], ["normal"], 'do_tt]>, ".", <$format, ["hr", [], [], 'do_hr]>], #[['this, $place_lib]]]>], [4, <$ctext_frob, [["Realms are used to keep locations in relation with each other. To get a list of commonly known realms type ", <$format, ["tt", [], ["@realms"], 'do_tt]>, ".", <$format, ["hr", [], [], 'do_hr]>], #[['this, $place_lib]]]>], [5, <$ctext_frob, [["Coordinates are used to define a basic relation between locations by pointing in the direction each place is. They use the radial/azimuth system. More help on Coordinates can be found in help under ", <$format, ["tt", [], ["places"], 'do_tt]>, ". For now it may be easier to use a coordinate shorcut (such as ", <$format, ["tt", [], ["up"], 'do_tt]>, "). To get a list of coordinate shortcuts type ", <$format, ["tt", [], ["@shortcuts"], 'do_tt]>, " now. Note: coordinates are automatically inverted for return exits (so if you specify ", <$format, ["tt", [], ["down"], 'do_tt]>, " the return exit will use the coordinates of ", <$format, ["tt", [], ["up"], 'do_tt]>, ").", <$format, ["hr", [], [], 'do_hr]>], #[['this, $place_lib]]]>]]; var $root manager = $place_lib; var $root managed = [$place_lib]; var $place_lib default_distance = 250; var $root owned = [$place_lib]; var $place_lib opposite_directions = #[["n?orth", 2], ["s?outh", 1], ["e?ast", 4], ["w?est", 3], ["northeast|ne", 7], ["southeast|se", 8], ["southwest|sw", 5], ["northwest|nw", 6], ["up", 10], ["d?own", 9]]; var $place_lib default_exit = $exit_frob; public method .is_place() { arg obj; if (!(obj.has_ancestor($place))) throw(~place, ("Object \"" + (obj.namef('ref))) + "\" is not a place."); }; public method .coordinates() { arg str; var x; for x in (coordinate_shortcuts) { if (str.match_template(x[1])) return x[2]; } throw(~coordnf, ("Unable to find coordinate shortcut for \"" + str) + "\"."); }; public method .coordinate_shortcuts() { return coordinate_shortcuts; }; public method .valid_coordinates() { arg radial, azimuth; if ((radial > 360) || (radial < (-1))) throw(~invcoord, "Radial coordinate must be from -1 to 360 degrees."); if ((azimuth > 90) || (azimuth < (-90))) throw(~invcoord, "Azimuth coordinate must be from 90 to -90 degrees."); }; public method .invert_coordinates() { arg radial, azimuth; radial += 180; if (radial > 360) radial = radial - 360; if (azimuth > 0) azimuth = -azimuth; else azimuth = abs(azimuth); return [radial, azimuth]; }; public method .known_realms() { return known_realms; }; public method .match_realm() { arg str; var r; for r in ($realms_frob.descendants()) { if (r.match_name(str)) return r; } return (| $object_lib.to_dbref(str) |) || 0; }; public method .add_known_realm() { arg obj; (> .perms(sender()) <); known_realms += [obj]; }; public method .del_known_realm() { arg obj; (> .perms(sender()) <); known_realms = known_realms.setremove(obj); }; public method .del_build_hint() { arg hint_key; (> .perms(sender()) <); build_hints = build_hints.add(hint_key); }; public method .build_hint() { arg hint; return build_hints[hint]; }; public method .build_hints() { return build_hints; }; public method .add_build_hint() { arg hint_key, hint_text; (> .perms(sender()) <); build_hints = build_hints.add(hint_key, hint_text); }; public method .opposite_direction() { arg dir; var key, od; od = opposite_directions; for key in (od.keys()) { if (match_template(dir, key)) return (od.keys())[od[key]]; } return 0; }; public method .set_default() { arg what, value; (> .perms(sender()) <); what = tosym("default_" + what); return (> get_var(what, value) <); }; public method .get_default() { arg what; what = tosym("default_" + what); return (> get_var(what) <); }; new object $data_lib: $libraries; var $root manager = $data_lib; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 849996459; var $root inited = 1; var $root managed = [$data_lib]; public method .unparse_indent() { arg value; var s, i, len; refresh(); switch (type(value)) { case 'list: if (!value) return ["[]"]; s = map i in [1 .. (len = value.length())] to ((.unparse_indent(value[i])).affix((i < len) ? "," : "")).sum(); if (((s.mmap('length)).sum()) < 60) return [("[" + (s.join())) + "]"]; else return (["[", ""].affix(s.prefix(" "))).affix("]"); case 'dictionary: s = map i in [1 .. (len = (value.keys()).length())] to ((.unparse_indent([(value.keys())[i], value[(value.keys())[i]]])).affix((i < len) ? "," : "")).sum(); if (((s.mmap('length)).sum()) < 60) return [("#[" + (s.join())) + "]"]; else return (["#[", ""].affix(s.prefix(" "))).affix(["]"]); case 'frob: return (((["<"].affix(class(value))).affix(",")).affix(.unparse_indent(value.value()))).affix(">"); default: return [toliteral(value)]; } }; public method .data_map() { arg val, method, options, [args]; var i, args, object, class; object = (| options['object] |); switch (type(val)) { case 'list: if ((| options['list] |)) return object ? object.(method)(val, @args) : val.(method)(@args); return map i in (val) to (refresh() && (.data_map(i, method, options, @args))); case 'dictionary: if ((| options['dictionary] |)) return object ? object.(method)(val, @args) : val.(method)(@args); if ((| options['keys] |)) return hash i in (val) to ([.data_map(i[1], method, options, @args), refresh() && (.data_map(i[2], method, options, @args))]); return hash i in (val) to ([i[1], refresh() && (.data_map(i[2], method, options, @args))]); case 'frob: if ((| (class = options['class]) |)) { if (class == class(val)) return object ? object.(method)(val, @args) : val.(method)(@args); else return val; } return (<class(val), .data_map(val.value(), method, options, @args)>); default: if ((| options['all] |) || (| options[type(val)] |)) return object ? object.(method)(val, @args) : val.(method)(@args); return val; } }; new object $frob: $core; var $root child_index = 11; var $root fertile = 1; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'fertile, 'core, 'variables]; var $root manager = $frob; var $root managed = [$frob]; var $root owned = [$frob]; public method .unparse() { arg rep; return ((("<" + this()) + ", ") + rep) + ">"; }; public method .new() { return (<this(), #[]>); }; public method .to_frob() { arg value; // this differs from .new in it's application return (<this(), value>); }; frob method .value(): nooverride { arg value; return value; // $#Moved 07 Dec 96 15:21 from $frob.value() by $miro // $#Moved 07 Dec 96 15:26 from $root.value() by $miro }; frob method .has_ancestor() { arg this, ancestor; (> pass(ancestor) <); }; frob method .is() { arg this, ancestor; (> pass(ancestor) <); }; public method .new_with() { arg value; return (<this(), value>); }; frob method .destroy() { arg this; throw(~perm, "You cannot destroy a frob, try 'discard'"); }; new object $network: $core; var $root child_index = 4; var $root manager = $network; var $root created_on = 809051864; var $root inited = 1; var $root flags = ['methods, 'code, 'core, 'variables]; var $root managed = [$network]; var $root owned = [$network]; public method ._ip(): native; bind_native .ip() ._ip(); public method .ip() { arg [args]; return (> ._ip(@args) <); }; public method ._hostname(): native; bind_native .hostname() ._hostname(); public method .hostname() { arg [args]; return (> ._hostname(@args) <); }; new object $connection_interface: $network, $command_cache, $frob; var $root child_index = 5; var $root manager = $connection_interface; var $root created_on = 809051864; var $root inited = 1; var $root quota_exempt = 1; var $root flags = ['methods, 'code, 'core, 'variables]; var $command_cache shortcut_cache = 0; var $command_cache local_cache = 0; var $has_commands shortcuts = #[]; var $has_commands remote = #[]; var $has_commands local = #[]; var $connection_interface connection = 0; var $root managed = [$connection_interface]; var $root owned = [$connection_interface]; public method .parse_line() { arg this, line; var cmd, c, match, parsed, i, m, a, u; catch any { while (line && ((line[1]) == " ")) line = line.subrange(2); if (!line) { return .null_cmd(this, line); } else { cmd = line.explode(); cmd = [line, cmd[1], ((cmd.subrange(2)).join()) || ""]; c = (| .match_in_local_cache(@cmd) |); if (c && ((c[1]) == 'local)) { // screw duplicates, take the first match match = (c[2])[1]; m = match[2]; i = match[5]; parsed = i.keys(); for a in [1 .. m.length()] { if (a in parsed) m = m.replace(a + 2, (> $command_lib.convert_arg((i[a])[1], m[a + 2], $no_one, ((i[a])[2]) ? ((i[a])[2])[1] : $no_one, $no_one) <)); } return (> .(match[4])(this, @m) <); } return (> .invalid_cmd(this, line) <); } } with { if (((traceback()[1])[3]) != 'no_traceback) { (this['connection]).write($parse_lib.traceback(traceback())); return 'disconnect; } } }; public method .connection_going_away() { arg [args]; (> .close() <); }; public method .linelen() { arg [args]; return 79; }; public method .send() { arg [args]; return (> .write(@args) <); }; public method .write() { arg this, what; return (> (this['connection]).write(what) <); }; public method .null_cmd() { arg [args]; return 'disconnect; }; public method .invalid_cmd() { arg [args]; return 'disconnect; }; public method .connection() { return connection; }; public method .tell() { arg [args]; (> .write(@args) <); }; public method .new() { arg c; var i; (> .perms(caller(), $connection) <); i = .spawn(); i.set_connection(c); return i; }; public method .new_connection() { arg this, host, port; }; public method .set_connection() { arg c; (> .perms(caller(), definer()) <); connection = c; }; public method .daemon_shutdown() { var i; (> .perms(caller(), $connection) <); for i in (.children()) (> i.close() <); }; public method .close() { (> .perms(sender()) <); (> $sys.destroy_sender() <); }; public method .connection_starting() { arg addr, port; }; new object $login_interface: $connection_interface; var $root child_index = 11979; var $root manager = $login_interface; var $root created_on = 809051864; var $root inited = 1; var $root quota_exempt = 1; var $root flags = ['methods, 'code, 'core, 'variables, 'command_cache]; var $has_commands local = #[["@who", [["@who", "", "@who", 'who_cmd, #[]]]], ["m?otd", [["m?otd", "", "m?otd", 'motd_cmd, #[]]]], ["h?elp", [["h?elp", "", "h?elp", 'help_cmd, #[]]]], ["guest|connect-guest", [["guest|connect-guest", "*", "guest|connect-guest <any>", 'connect_guest_cmd, #[[1, ['any, []]]]]]], ["c?onnect", [["c?onnect", "*", "c?onnect <any>", 'connect_cmd, #[[1, ['any, []]]]]]], ["@quit|QUIT", [["@quit|QUIT", "", "@quit|QUIT", 'quit_cmd, #[]]]], ["cr?eate", [["cr?eate", "*", "cr?eate <any>", 'create_cmd, #[[1, ['any, []]]]]]]]; var $root managed = [$login_interface, $login_interface_11979]; var $root owned = [$login_interface]; var $root writes = [$login_connection_13088]; var $command_cache local_cache = #[["@who", ["@who"]], ["m", ["m?otd"]], ["mo", ["m?otd"]], ["mot", ["m?otd"]], ["motd", ["m?otd"]], ["h", ["h?elp"]], ["he", ["h?elp"]], ["hel", ["h?elp"]], ["help", ["h?elp"]], ["guest", ["guest|connect-guest"]], ["connect-guest", ["guest|connect-guest"]], ["c", ["c?onnect"]], ["co", ["c?onnect"]], ["con", ["c?onnect"]], ["conn", ["c?onnect"]], ["conne", ["c?onnect"]], ["connec", ["c?onnect"]], ["connect", ["c?onnect"]], ["@quit", ["@quit|QUIT"]], ["QUIT", ["@quit|QUIT"]], ["cr", ["cr?eate"]], ["cre", ["cr?eate"]], ["crea", ["cr?eate"]], ["creat", ["cr?eate"]], ["create", ["cr?eate"]]]; var $command_cache shortcut_cache = []; protected method .connect_cmd() { arg cmdstr, cmd, args; var syn, stderr, passwd, name, user; syn = cmd + " <name> <password>"; stderr = "Either that user does not exist or has a different password."; args = args.explode(); if ((args.length()) < 2) (> .tell_error("Last word is taken as the password.", syn) <); passwd = args[args.length()]; name = (args.subrange(1, (args.length()) - 1)).join(); user = (| $user_db.search(name) |) || (> .tell_error(syn, stderr) <); catch any { if (!(user.check_password(passwd, (.connection()).address()))) (> .tell_error(syn, stderr) <); } with { (> .tell_error(syn, stderr) <); } (.connection()).change_interface(user); }; protected method .create_cmd() { arg cmdstr, cmd, args; var syn, msg, user, semail; syn = cmd + " <name> <password> <email@host>"; semail = $sys.get_system_email('login); args = args.explode_quoted(); ((args.length()) == 3) || (> .tell_error(syn) <); if ((| $user_db.search(args[1]) |)) return .tell(("The name '" + (args[1])) + "' is already taken."); catch any { user = $sys.create_user(@args); } with { if (user) (| user.destroy() |); msg = ["There was a problem creating you:"]; msg += $parse_lib.traceback(traceback()); msg += ["If there is a problem contact: " + semail]; (| $login_log.log(traceback()) |); (> .tell_error(syn, msg) <); return; } (.connection()).change_interface(user); }; protected method .quit_cmd() { arg cmdstr, cmd; .print("Goodbye."); return 'disconnect; }; protected method .connect_guest_cmd() { arg cmdstr, cmd, args; var syn, msg, c, email, name, result, semail, user; syn = cmd + " <your name> <your email>"; semail = $sys.get_system_email('login); args = args.explode(); c = .connection(); if ((args.length()) < 2) (> .tell_error(syn) <); name = (args.subrange(1, (args.length()) - 1)).join(); email = args[args.length()]; if ($sys.validate_email_addresses()) result = $code_lib.valid_email(email); if ((result[1]) != 'valid) { switch (result[1]) { case 'invalid: c.write(["", ("=> Syntax: `" + syn) + "`"]); c.write("The given email address is not a legitimate address."); c.write("Specify both username and hostname."); return; case 'invip, 'invhostname: c.write("** Your hostname seems to be invalid."); c.write("** You should set a valid email address."); } } catch any { user = (> $sys.create_user(name, 0, email, 'anonymous_user_class) <); } with { c.write(["", ("=> Syntax: `" + syn) + "`"]); c.write((traceback()[1])[2]); c.write("If there is a problem contact: " + semail); return; } c.change_interface(user); }; protected method .who_cmd() { arg cmdstr, cmd; .print($code_lib.generate_listing($user_db.connected())); }; protected method .help_cmd() { arg cmdstr, cmd; .print($motd.connect_help()); }; protected method .null_cmd() { arg [args]; return (> .invalid_cmd(@args) <); }; protected method .invalid_cmd() { arg [args]; var line; line = (((($login_interface.local_cache()).to_list()).slice(2)).slice(1)).compress(); .print("Try: " + (line.to_english("", " or "))); }; protected method .print() { arg what; (.connection()).write(what); }; protected method .motd() { var out; out = ($motd.build('default)) + ["", " ** Use 'H?elp' for a list of commands **".center(79), ""]; return out; }; protected method .motd_cmd() { arg cmdstr, cmd; .print(.motd()); }; protected method .tell_error() { arg syntax, [problem]; var problem, line, sprefix, prefix, length; length = 79; if (syntax) .print(("=> Syntax: `" + syntax) + "`"); if (problem) { for line in (problem) { if (type(line) == 'string) line = line.wrap_lines(length, "! ", 1); .print(line); } } throw(~stop, "! ** use h?elp for a list of commands and their usages **"); }; public method .connection_starting() { arg host, port; (> .perms(caller(), $connection) <); .print(.motd()); }; public method .parse_line() { arg line; var cmd, c, match, parsed, i, m, a, u; catch any { while (line && ((line[1]) == " ")) line = line.subrange(2); if (!line) { return .null_cmd(line); } else { cmd = line.explode(); cmd = [line, cmd[1], ((cmd.subrange(2)).join()) || ""]; c = (| $login_interface.match_in_local_cache(@cmd) |); if (c && ((c[1]) == 'local)) { // screw duplicates, take the first match match = (c[2])[1]; m = match[2]; i = match[5]; parsed = i.keys(); for a in [1 .. m.length()] { if (a in parsed) m = m.replace(a + 2, (> $command_parser.convert_arg(cmd[2], (i[a])[1], m[a + 2], $no_one, ((i[a])[2]) ? ((i[a])[2])[1] : $no_one, $no_one) <)); } return (> .(match[4])(@m) <); } return (> .invalid_cmd(line) <); } } with { if (error() == ~stop) { if ((traceback()[1])[2]) .print((traceback()[1])[2]); } else { .print($parse_lib.traceback(traceback())); return 'disconnect; } } }; root method .core_login_interface(): nooverride { .add_command("cr?eate <any>", 'create_cmd); .rehash_caches(); }; new object $login_interface_11979: $login_interface; var $root manager = $login_interface; var $connection_interface connection = $login_connection_13088; var $root flags = ['variables, 'methods, 'code]; var $root created_on = 851214761; var $has_commands shortcuts = #[]; var $has_commands remote = #[]; var $has_commands local = #[]; var $root inited = 1; var $root writes = [$login_connection_13088]; new object $http_interface: $connection_interface; var $root child_index = 9087; var $root manager = $http_interface; var $root owned = [$http_interface]; var $root created_on = 809075102; var $root inited = 1; var $root quota_exempt = 1; var $root flags = ['methods, 'code, 'core, 'variables]; var $root managed = [$http_interface, $http_interface_9087]; var $has_commands shortcuts = #[]; var $has_commands remote = #[]; var $has_commands local = #[]; var $http_interface keep_alive = 0; var $http_interface cache = []; var $http_interface method = "GET"; var $http_interface http = "HTTP/0.9"; var $http_interface status = 405; var $http_interface URI = "/"; var $http_interface bytes = 205; var $http_interface ctype = 0; var $http_interface cached = 0; var $http_interface full = 0; var $http_interface header = 0; var $http_interface info = 0; var $command_cache shortcut_cache = []; var $root writes = [$http_connection_9100]; root method .init_http_interface() { .reset_variables(); }; protected method .close_interface() { arg [args]; var c; if ((!args) && keep_alive) { .reset_variables(); return; } (.connection()).close(); }; protected method .send_header() { arg [lines]; if (!full) return; (.connection()).write(([(http + " ") + tostr(status), "Server: ColdWeb/2.0 (Virtual Environment)", "Content-type: " + ctype, "Content-length: " + bytes] + lines) + [""]); }; protected method .respond() { arg body; var host; if (type(body) != 'buffer) body = strings_to_buf(body); bytes = buflen(body); .send_header(); (.connection()).write(body); host = (.connection()).address(); .close_interface(); .log_request(host); }; protected method .respond_with_file() { arg fstat; var host; bytes = fstat[2]; .send_header(); (.connection()).cwritef("html" + URI); host = (.connection()).address(); .close_interface(); .log_request(host); }; protected method .find_filename() { var file, actual, stat, ifiles, i; stat = (| $file.fstat("html" + URI) |); if (!stat) { ifiles = ["home.html", "index.html", "welcome.html"]; file = URI; actual = URI; if ((file[strlen(file)]) != "/") file += "/"; while ((!stat) && ifiles) { URI = file + (ifiles[1]); stat = (| $file.fstat("html" + URI) |); ifiles = ifiles.delete(1); } if (!stat) { URI = actual; status = 404; .respond($http.response(status, ("Unable to find URL " + toliteral(URI)) + ".")); return 0; } } if ((i = URI.rindex("."))) { switch (URI.subrange(i + 1)) { case "txt": ctype = "text/plain"; case "gif": ctype = "image/gif"; } } return stat; }; protected method .http_method_POST() { var len, body, part; len = (| header["Content-Length"] |); if ((len == ~keynf) || (!len)) (> .respond($sys.response((status = 400), "No Content-Length.")) <); body = (.connection()).handle_POST_input(toint(len[1])); // handle this differently in normal situations for part in (body) info = info.add('args, (info['args]).union(part.explode_http_encoding())); .http_method_GET(); }; public method .connection_going_away() { arg [args]; (> .close() <); }; public method .parse_line() { arg line; var match; if (!method) { if (!line) return; line = explode(line); if (listlen(line) != 3) { (.connection()).write($http.response(400, "HTTP/0.9 not supported.")); .close(); return; } if ((match = regexp(line[1], "^(GET|POST|HEAD)$"))) method = match[1]; else return .die(405, ("Method: \"" + (line[1])) + "\"."); URI = line[2]; http = line[3]; } else if (line) { if ((match = regexp(line, "^([^:]+): *(.+)$"))) { if (((match[1]) == "Connection") && ((match[2]) == "Keep-Alive")) keep_alive = 1; else header = header.add_elem(@match); } } else { // parse the URI info = URI.explode_url(); URI = "/" + ((info['path]).join("/")); catch any { (> .(tosym("http_method_" + method))() <); } with { if (error() != ~stop) .respond($parse_lib.html_traceback(traceback(), (status = 500))); } } }; protected method .log_request() { arg host; var line; line = (((((((((((host + " - - [") + ($time.format("%d %h %y %H:%M"))) + "] \"") + method) + " ") + URI) + " ") + http) + "\" ") + tostr(status)) + " ") + tostr(bytes); if ((| header["User-Agent"] |)) line = (line + ";; ") + ((header["User-Agent"]).join()); $sys.log(line); }; protected method .http_method_GET() { var target, gate; if (URI == "/") { .respond($motd.build_html()); } else if (match_begin(URI, "/~")) { target = (| $user_db.search(substr((info['path])[1], 2)) |); info = (| target.user_info("home-page") |); if (info) { status = 302; .redirect(info); } else { status = 404; .respond($http.response(404, "Unable to find user " + substr((info['path])[1], 2))); } } else if (match_begin(URI, "/bin")) { target = sublist(info['path], 2); if (!target) { status = 300; return .respond($http.response(300, ["Multiple Choices: "] + ($http.list_gateways()))); } gate = target[1]; target = sublist(target, 2); if (!(($http.gateways()).contains(gate))) { status = 502; .respond($http.response(502, ("Bad gateway: \"" + gate) + "\"")); } else if (!gate) { status = 300; return .respond($http.response(300, ["Multiple Choices: "] + ($http.list_gateways()))); } else { catch any { info = (> $http.(tosym("bin_" + gate))(target, info, header) <); status = info[1]; if ((type(info[2]) == 'buffer) || (status != 200)) return .respond(info[2]); return .respond((info[2]) + ($http.page_tail())); } with { status = 500; return .respond($parse_lib.html_traceback(traceback(), 500)); } } } else if ((info = .find_filename())) { .respond_with_file(info); } }; protected method .http_method_HEAD() { var info, target, gate, head, host; head = []; status = 200; if (URI == "/") { bytes = buflen(strings_to_buf($motd.build_html())); } else if (match_begin(URI, "/~")) { target = (| $user_db.search(substr((info['path])[1], 2)) |); info = (| target.setting("home-page") |); if (info) { status = 302; bytes = buflen(strings_to_buf($http.response(302, "Relocated at: " + location))); head += ["Location: " + info]; } else { status = 404; bytes = buflen(strings_to_buf($http.response(404, "Unable to find user " + substr((info['path])[1], 2)))); } } else if (match_begin(URI, "/bin")) { target = sublist(info['path], 2); if (!target) { status = 300; bytes = buflen(strings_to_buf($http.response(300, ["Multiple Choices: "] + ($http_lib.list_gateways())))); } else { gate = target[1]; target = sublist(target, 2); if (!(($http.gateways()).contains(gate))) { status = 502; bytes = buflen(strings_to_buf($http.response(502, ("Bad gateway: \"" + gate) + "\""))); } else if (!gate) { status = 300; bytes = buflen(strings_to_buf($http.response(300, ["Multiple Choices: "] + ($http_lib.list_gateways())))); } else { catch any { info = (> $http.(tosym("bin_" + gate))(@target) <); status = info[1]; if ((type(info[2]) == 'buffer) || (status != 200)) bytes = buflen(strings_to_buf(info[2])); else bytes = buflen(strings_to_buf((info[2]) + ($http.page_tail()))); } with { status = 500; bytes = buflen(strings_to_buf($parse_lib.html_traceback(traceback(), 500))); } } } } else if ((info = .find_filename())) { bytes = fstat[2]; } .send_header(@head); host = (.connection()).address(); .close_interface(); .log_request(host); }; protected method .reset_variables() { method = ""; http = "HTTP/1.0"; status = 200; URI = ""; bytes = 0; ctype = $http.html_version(); full = 1; header = #[]; }; public method .set_status() { arg s; (> .perms(caller(), $http_connection) <); status = s; }; protected method .redirect() { arg location; var body, host; body = $buffer.from_strings($http.response(302, "Relocated at: " + location)); bytes = body.length(); host = (.connection()).address(); .send_header("Location: " + location); (.connection()).write(body); .close_interface(); .log_request(host); }; new object $http_interface_9087: $http_interface; var $root manager = $http_interface; var $connection_interface connection = $http_connection_9100; var $root flags = ['variables, 'methods, 'code]; var $root created_on = 851214747; var $has_commands shortcuts = #[]; var $has_commands remote = #[]; var $has_commands local = #[]; var $http_interface method = ""; var $http_interface http = "HTTP/1.0"; var $http_interface status = 200; var $http_interface URI = ""; var $http_interface bytes = 0; var $http_interface ctype = "text/html"; var $http_interface full = 1; var $http_interface header = #[]; var $root inited = 1; var $root writes = [$http_connection_9100]; new object $smtp_interface: $connection_interface, $has_name; var $root manager = $smtp_interface; var $root quota_exempt = 1; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 849172060; var $has_commands shortcuts = #[]; var $has_commands remote = #[]; var $has_commands local = #[]; var $root inited = 1; var $root child_index = 94; var $root managed = [$smtp_interface, $smtp_interface_94]; var $smtp_interface mail_from = 0; var $smtp_interface cmds = #[["HELP", 'help_cmd], ["QUIT", 'quit_cmd], ["VRFY", 'verify_cmd], ["EXPN", 'verify_cmd], ["HELO", 'hello_cmd], ["MAIL", 'mail_from_cmd], ["NOOP", 'noop_cmd], ["RCPT", 'recipient_cmd], ["DATA", 'data_cmd]]; var $smtp_interface cmd_help = #[["HELP", ["HELP [<topic>]", " For more help on any command type 'help <cmd>'"]], ["QUIT", ["QUIT", " Ends your mail session"]], ["EXPN", ["EXPN <recipient>", " Expand an address."]], ["VRFY", ["VRFY <recipient>", " Verify an address."]], ["HELO", ["HELO <hostname>", " Introduce yourself."]], ["MAIL", ["MAIL FROM: <sender>", " Specify sender/return path."]], ["NOOP", ["NOOP", " Do nothing"]], ["RCPT", ["RCPT TO:<recipient>", " Specifies the recipient. Can be used any number of times."]], ["DATA", ["DATA", " Following data is collected as the message", " End with a single dot"]]]; var $smtp_interface given_hostname = ""; var $smtp_interface mail_to = 0; var $smtp_interface mail_body = 0; var $smtp_interface mail_status = 0; var $has_name name = ['prop, "smtp_interface", "smtp_interface"]; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $command_cache shortcut_cache = []; var $root writes = [$smtp_connection_97]; public method .parse_line() { arg line; var method, cmd, args; $brad.debug(line); if (mail_status == 'read_body) { if (line == ".") { return .send_mail(); } else { mail_body += [line]; return; } } cmd = line.word(1); if ((line.length()) >= ((cmd.length()) + 2)) args = line.subrange((cmd.length()) + 2); else args = ""; catch ~keynf { method = definer().get_cmd(cmd); } with { (.connection()).write("500 unrecognized command"); return 'disconenct; } return .(method)(args); }; public method .connection_starting() { arg addr, port; $brad.debug("New SMTP connection"); (.connection()).write((("220 " + ($sys.server_info('server_hostname))) + " SMTP ColdMail 0.01/0.01; ") + ($time.format("%a, %e %b %Y %T %Z"))); }; public method .help_cmd() { arg rest; var i, conn; conn = .connection(); if ((rest.length()) == 0) { conn.write(["214-This is ColdMail 0.01.", "214-Valid Commands:"]); for i in (definer().get_cmds()) conn.write("214- " + i); conn.write("214 End of Help"); } else { catch ~keynf { rest = definer().get_cmd_help(rest); for i in (rest) conn.write("214-" + i); conn.write("214 End of Help"); } with { conn.write(("504 HELP topic '" + rest) + "' not found."); } } }; public method .quit_cmd() { arg rest; (.connection()).write(("221 " + ($sys.server_info('server_hostname))) + " closing connection"); return 'disconnect; }; public method .get_cmd() { arg cmd; return (> cmds[cmd] <); }; public method .get_cmd_help() { arg help; return (> cmd_help[help] <); }; public method .get_cmds() { return cmds.keys(); }; public method .verify_cmd() { arg rest; var conn, user, i, out; conn = .connection(); if ((rest.length()) == 0) { conn.write("501 Argument required"); } else { out = []; for i in (rest.explode()) { catch ~ambig, ~listnf { user = .parse_user(i); out += [user.name()]; } with { switch (error()) { case ~ambig: conn.write(("553 " + i) + "... user ambiguous"); default: conn.write(("550 " + i) + "... user unknown"); return; } } } for i in [1 .. out.length()] conn.write((((((((i == (out.length())) ? "250 " : "250-") + (out[i])) + " <") + (out[i])) + "%cold@") + ($sys.server_info('server_hostname))) + ">"); } }; public method .hello_cmd() { arg rest; var conn; conn = .connection(); if ((rest.length()) == 0) { conn.write("501 HELO requires domain address"); } else if (given_hostname == 0) { conn.write(((("250 " + ($sys.server_info('server_hostname))) + " Hello ") + (conn.address())) + ", pleased to meet you"); given_hostname = rest; } else { conn.write("503 portland.puremagic.com Duplicate HELO"); } }; public method .mail_from_cmd() { arg rest; var conn, i; conn = .connection(); if (((rest.length()) <= 5) || (((i = ":" in rest) != 5) || ((| rest.subrange(1, 5) |) != "from:"))) { conn.write(("501 Syntax error in \"" + (rest.subrange(1, (i == 0) ? rest.length() : (i - 1)))) + "\""); } else if (mail_from != "") { conn.write("503 Sender already specified"); } else { mail_from = (rest.subrange(6)).trim(); mail_to = []; mail_body = []; conn.write(("250 " + mail_from) + "... sender ok"); } }; public method .init_smtp_interface() { mail_from = ""; mail_to = []; mail_body = []; mail_status = 'idle; }; public method .uninit_smtp_interface() { mail_from = 0; mail_to = 0; mail_body = 0; mail_status = 0; }; public method .noop_cmd() { arg rest; (.connection()).write("250 Ok"); }; public method .recipient_cmd() { arg rest; var conn, i, user; conn = .connection(); if (mail_from == "") { conn.write("503 Need MAIL before RCPT"); } else if (((rest.length()) <= 3) || (((i = ":" in rest) != 3) || ((| rest.subrange(1, 3) |) != "to:"))) { conn.write(("501 Syntax error in \"" + (rest.subrange(1, (i == 0) ? rest.length() : (i - 1)))) + "\""); } else { catch ~ambig, ~listnf { user = .parse_user(rest.subrange(4)); mail_to += [user]; conn.write(("250 " + user) + "... recipient ok"); } with { if (error() == ~listnf) conn.write("550 User unknown"); else conn.write("553 User ambiguous"); } } }; public method .parse_user() { arg user; if (((user[1]) == "<") && ((user[user.length()]) == ">")) user = user.subrange(2, (user.length()) - 2); return (> $mail_lib.match_mail_recipient(user.trim()) <); }; public method .data_cmd() { arg rest; var conn; conn = .connection(); if (mail_from == "") { conn.write("503 Need MAIL command"); } else if (mail_to == []) { conn.write("503 Need RCPT command"); } else { conn.write("354 Enter mail, end with \".\" on a line by itself"); mail_status = 'read_body; } }; public method .send_mail() { var mail; .set_name(mail_from, 'prop); mail = $mail_message.new_mail(); mail.set_subject("internet mail"); mail.set_text(mail_body); catch any { mail.send(@mail_to); mail.set_from(mail_from); (.connection()).write(("250 " + ($smtp_daemon.get_msg_id())) + " Message accepted for delivery"); } with { (.connection()).write("550 Requested action not taken: Error delivering mail"); $brad.debug(traceback()); } mail_status = 'idle; mail_from = ""; mail_to = []; mail_body = []; }; new object $smtp_interface_94: $smtp_interface; var $root manager = $smtp_interface; var $connection_interface connection = $smtp_connection_97; var $root flags = ['variables, 'methods, 'code]; var $root created_on = 851214747; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "smtp_interface_94", "smtp_interface_94"]; var $has_commands shortcuts = #[]; var $has_commands remote = #[]; var $has_commands local = #[]; var $smtp_interface mail_from = ""; var $smtp_interface mail_to = []; var $smtp_interface mail_body = []; var $smtp_interface mail_status = 'idle; var $root inited = 1; var $root writes = [$smtp_connection_97]; new object $connection: $network; var $root child_index = 11; var $root manager = $connection; var $root created_on = 809051864; var $root inited = 1; var $root flags = ['methods, 'code, 'core, 'variables]; var $connection buffer = `[]; var $connection host = ""; var $connection daemon = 0; var $connection active = 0; var $connection line_buffer = 0; var $connection interface = 0; var $connection timeout = 0; var $connection read_block = []; var $connection started_at = 0; var $connection port = 0; var $connection foreign_addr = 0; var $connection local_port = 0; var $connection local_addr = 0; var $connection remote_port = 0; var $connection remote_addr = 0; var $connection remote_name = 0; var $root managed = [$connection]; var $root owned = [$connection]; var $connection tid = 0; public method .daemon_shutdown() { var c; // called by $daemon.stop_listening() (> .perms(caller(), $daemon) <); for c in (.children()) (> c.close() <); (> interface.daemon_shutdown() <); }; root method .init_connection() { buffer = `[]; local_addr = (remote_addr = ""); line_buffer = []; timeout = 300; tid = -1; // remove all flags .set_flags([]); }; root method .uninit_connection() { (| close_connection() |); active = 0; if (interface) (| interface.connection_going_away(.address(), remote_port) |); interface = 0; if (read_block) read_block = read_block.add('lines, 'disconnected); .finish_reading_block(); if (tid != (-1)) $scheduler.del_task(tid); tid = 0; }; public method .timeout() { return timeout; }; public method .address() { (> .perms(sender()) <); return remote_addr; // if you want, remove the above return and you will exec the following // note: this currently blocks everything while doing name lookups if (!remote_name) remote_name = .hostname(remote_addr); return remote_name; }; public method .set_timeout() { arg seconds; (> .perms(sender(), interface, this()) <); timeout = seconds; if (!timeout) (| clear_var('timeout) |); }; public method .change_interface() { arg new; var old; (> .perms(sender()) <); if (interface) { old = interface; old.connection_going_away(.address(), remote_port); } interface = new; (.manager()).change_connection_interface(old, new); interface.connection_starting(.address(), remote_port); }; public method .new_interface() { arg obj; (> .perms(sender()) <); interface = obj; }; public method .set_daemon() { arg obj; (> .perms(sender()) <); daemon = obj; }; public method .write() { arg what, [how]; var elem, sep; sep = ('non_terminated in how) ? `[] : `[13, 10]; switch (type(what)) { case 'string: what = $buffer.from_strings([what], sep); case 'list: what = $buffer.from_strings(what, sep); case 'buffer: default: throw(~type, "Write: strings, list of strings and buffers."); } cwrite(what); }; driver method .parse() { arg incoming; var lines, line, index; lines = (buffer + incoming).to_strings(); index = lines.length(); buffer = lines[index]; lines = lines.delete(index); line_buffer += lines; while (line_buffer) { line = line_buffer[1]; line_buffer = line_buffer.delete(1); (| .parse_line(line) |); } }; protected method .parse_line() { arg line; if (read_block) { read_block = read_block.parse(line); line = .rehash_read_status(); if ((!line) && (line != "")) return; } if ((interface.parse_line(line)) == 'disconnect) (> .close() <); }; public method .cwritef() { arg fname; (> .perms(sender()) <); (> cwritef(fname) <); }; public method .is_reading_block() { return read_block ? 1 : 0; }; public method .finish_reading_block() { var task_id, lines; (> .perms(sender()) <); task_id = read_block.task_id(); lines = read_block.lines(); read_block = 0; $scheduler.resume(task_id, lines); }; public method .abort_reading_block() { (> .perms(sender()) <); read_block = read_block.add('lines, 'aborted); .finish_reading_block(); }; public method .start_reading_block() { arg count; (> .perms(sender()) <); read_block = $read_parser.new_with(task_id(), count); (| .push_buffered() |); return (> $scheduler.suspend(this()) <); }; protected method .rehash_read_status() { switch (read_block.status()) { case 'abort: .abort_reading_block(); case 'not_done: // do nothing case 'done: .finish_reading_block(); case 'pass_command: return read_block.command(); } return 0; }; protected method .do_timeout() { $brad.debug("do_timeout"); if (!timeout) return; .write(("Timeout (" + tostr(timeout)) + ")"); .close(); }; public method .close() { (> .perms(sender()) <); (> $sys.destroy_sender() <); }; driver method .disconnect() { .close(); }; public method .set_remote_port() { arg port; (> .perms(sender()) <); remote_port = port; }; public method .new_connection() { var new, i; (> .perms(caller(), $daemon) <); new = .spawn(); i = interface.new(new); new.add_writer(sender()); new.add_writer(interface); new.add_writer((| class(i) |) || i); new.add_writer(this()); new.new_interface(i); return new; }; public method .active() { return active; }; public method .write_string() { arg string; if ((sender() != interface) && (sender() != (| class(interface) |))) throw(~perm, sender() + " cannot write this connection."); if (type(string) != 'string) throw(~type, "Argument must be a string."); cwrite($buffer.from_string(string)); }; public method .write_strings() { arg strings; if ((sender() != interface) && (sender() != (| class(interface) |))) throw(~perm, sender() + " cannot write this connection."); if (type(strings) != 'list) throw(~type, "Argument must be a list of strings."); cwrite($buffer.from_strings(string)); }; public method .write_buffer() { arg buffer; if ((sender() != interface) && (sender() != (| class(interface) |))) throw(~perm, sender() + " cannot write this connection."); if (type(buffer) != 'buffer) throw(~type, "Argument must be a buffer."); cwrite(buffer); }; public method .active_since() { return active; }; public method .start() { arg remote, local, rport, lport; // Make this method 'fork' from the regular thread stack (> .perms(caller(), $daemon) <); active = time(); remote_addr = remote; remote_port = rport; local_addr = local; local_port = lport; // $brad.debug("timeout", timeout); // if (timeout) // $scheduler.add_task(timeout, 'do_timeout); interface.connection_starting(.address(), remote_port); }; public method .interface() { (caller() == $daemon) || (> .perms(sender()) <); return interface; }; public method .interface_going_away() { if ((sender() != interface) && (sender() != (| class(interface) |))) throw(~perm, sender() + " is not the interface."); interface = 0; (> $sys.destroy_sender() <); }; protected method .open_connection() { arg host, port; (> open_connection(host, port) <); }; protected method .set_active() { arg value; active = value; }; public method .change_connection_interface() { arg old, new; var i; (> .perms(caller(), $connection) <); if (old) sender().del_writer((| class(old) |) || old); sender().add_writer((| class(new) |) || new); }; private method .push_buffered(): forked { var line; // called when a read() suspends the connection--to finish unbuffering i/o while (line_buffer) { line = line_buffer[1]; line_buffer = delete(line_buffer, 1); (| .parse_line(line) |); } }; new object $login_connection: $connection; var $root child_index = 13088; var $root manager = $login_connection; var $root created_on = 809051865; var $root inited = 1; var $root quota_exempt = 1; var $root flags = ['methods, 'code, 'core, 'variables]; var $connection interface = $login_interface; var $connection active = 0; var $connection buffer = `[]; var $connection host = ""; var $connection daemon = 0; var $connection line_buffer = []; var $connection timeout = 0; var $connection read_block = 0; var $connection started_at = 0; var $root managed = [$login_connection, $login_connection_13088]; var $root owned = [$login_connection]; var $root writes = [$login_connection_13088]; public method .local_echo_off() { (sender() == (.interface())) || (> .perms(sender()) <); cwrite(`[255, 251, 1, 0]); }; public method .local_echo_on() { (sender() == (.interface())) || (> .perms(sender()) <); cwrite(`[255, 252, 1, 0]); }; new object $login_connection_13088: $login_connection; var $root manager = $login_connection; var $root writers = [$login_daemon, $login_interface, $login_interface_11979, $login_connection]; var $root inited = 1; var $root created_on = 851214761; var $connection buffer = `[]; var $connection remote_addr = ""; var $connection local_addr = ""; var $connection line_buffer = []; var $connection timeout = 300; var $connection tid = -1; var $connection interface = $login_interface_11979; new object $http_connection: $connection; var $root child_index = 9100; var $root manager = $http_connection; var $root created_on = 809075134; var $root inited = 1; var $root quota_exempt = 1; var $root flags = ['methods, 'code, 'core, 'variables]; var $connection buffer = `[27]; var $connection host = ""; var $connection daemon = 0; var $connection active = 0; var $connection line_buffer = []; var $connection interface = $http_interface; var $connection timeout = 0; var $connection read_block = 0; var $connection started_at = 0; var $root managed = [$http_connection, $http_connection_9100]; var $root owned = [$http_connection]; var $http_connection buffer = 0; var $http_connection line_buffer = 0; var $http_connection reading = 0; var $root writes = [$http_connection_9100]; root method .init_http_connection() { buffer = `[]; line_buffer = []; }; public method .start() { arg [args]; .set_timeout(0); return (> pass(@args) <); }; public method .handle_POST_input() { arg len; var body; if (buflen(buffer) < len) { reading = 300; while ((buflen(buffer) < len) && --reading) { $scheduler.sleep(1); refresh(); } if (buflen(buffer) < len) { buffer = `[]; status = 400; throw(~timeout, "Timeout on receiving POST request"); } } body = buf_to_strings(subbuf(buffer, 1, len)); buffer = subbuf(buffer, len + 1); if ((`[13, 10] in buffer) == 1) buffer = subbuf(buffer, 3); if ((body[listlen(body)]) == `[]) body = delete(body, listlen(body)); else body = replace(body, listlen(body), buf_to_str(body[listlen(body)])); return body; }; driver method .parse() { arg incoming; var l, line, i, t, int, sub; catch any { buffer += incoming; int = .interface(); while (!reading) { if (!(i = `[13, 10] in buffer)) break; sub = subbuf(buffer, 1, i - 1); line = buf_to_str(sub); buffer = subbuf(buffer, i + 2); (> int.parse_line(line) <); } } with { int.set_status(500); int.respond($parse_lib.html_traceback(traceback(), 500)); } }; new object $http_connection_9100: $http_connection; var $root manager = $http_connection; var $root writers = [$http_daemon, $http_interface, $http_interface_9087, $http_connection]; var $http_connection buffer = `[]; var $root created_on = 851214747; var $connection buffer = `[]; var $connection remote_addr = ""; var $connection local_addr = ""; var $connection line_buffer = []; var $connection timeout = 300; var $connection tid = -1; var $http_connection line_buffer = []; var $root inited = 1; var $connection interface = $http_interface_9087; new object $outbound_connection: $connection; var $root manager = $outbound_connection; var $root quota = 100000; var $root inited = 1; var $root created_on = 844616370; var $root quota_exempt = -1; var $connection buffer = `[]; var $connection remote_addr = ""; var $connection local_addr = ""; var $connection line_buffer = []; var $connection timeout = 0; var $root child_index = 40; var $connection host = ""; var $connection daemon = 0; var $connection active = 0; var $connection interface = 0; var $connection read_block = 0; var $connection started_at = 0; var $root trusted = [$smtp]; var $root flags = ['core, 'methods, 'code, 'variables]; var $root managed = [$outbound_connection]; driver method .connect() { arg task_id; $scheduler.resume(task_id, 'success); }; driver method .failed() { arg task_id, reason; $scheduler.resume(task_id, reason); }; public method .open_connection() { arg host, port; (> .perms(sender()) <); (> pass(host, port) <); return $scheduler.suspend(this()); }; public method .new() { var child, daemon, port, i; (| .perms(sender(), 'trusts) |) || (> .perms(caller(), 'trusts) <); child = .spawn(); // do perms stuff child.add_writer(sender()); child.add_writer(this()); child.new_interface(sender()); return child; }; new object $smtp_connection: $connection; var $root manager = $smtp_connection; var $connection interface = $smtp_interface; var $root inited = 1; var $root created_on = 849170589; var $connection buffer = `[]; var $connection remote_addr = ""; var $connection local_addr = ""; var $connection line_buffer = []; var $connection timeout = 300; var $root quota_exempt = 1; var $root child_index = 97; var $root managed = [$smtp_connection, $smtp_connection_97]; var $root flags = ['core]; var $root writes = [$smtp_connection_97]; new object $smtp_connection_97: $smtp_connection; var $root manager = $smtp_connection; var $root writers = [$smtp_daemon, $smtp_interface, $smtp_interface_94, $smtp_connection]; var $root inited = 1; var $root created_on = 851214747; var $connection buffer = `[]; var $connection remote_addr = ""; var $connection local_addr = ""; var $connection line_buffer = []; var $connection timeout = 300; var $connection tid = -1; var $connection interface = $smtp_interface_94; new object $veil_connection: $network; var $root manager = $veil_connection; var $root inited = 1; var $root created_on = 814651762; var $root child_index = 2; var $veil_connection last_id = 0; var $veil_connection ch_types = 0; var $veil_connection channels = 0; var $veil_connection incomplete = 0; var $veil_connection host = 0; var $veil_connection packets = 0; var $veil_connection ch_info = 0; var $veil_connection daemon = 0; var $veil_connection active = 0; var $veil_connection timeout = 0; var $root flags = ['methods, 'code, 'variables, 'core]; var $root managed = [$veil_connection]; var $root owned = [$veil_connection]; driver method .parse() { arg incoming; var p, message, i; // p = buf_to_veil_packets(incomplete, incoming); incomplete = p.last(); i = 1; message = `[]; while (packets) { p = packets[i]; message += p[4]; if (p[1]) { packets = packets.subrange(i + 1); (| .message(p[1], p[2], message) |); message = `[]; i = 1; } ++i; } // using subscripting keeps us from copying the list of packets every // iteration of the while loop. We want to do it in the above way, // as then the packet list and current message is stored on the object, // which saves us if the current task suspends. // $# Edited 25 Oct 1995 18:41 Lynx ($lynx) }; public method .write() { arg buf, id, info, push; // cwrite(buf_from_veil_packets([[push, info, ch, buf]])); // $# Edited 25 Oct 1995 18:41 Lynx ($lynx) }; public method .next_id() { last_id += 2; return last_id; // $# Edited 25 Oct 1995 18:41 Lynx ($lynx) }; protected method .packet() { arg packet; var control; control = (| channels[packet[3]] |); if (!control) { control = .new_channel(@packet.subrange(1, 3)); // just ignore the packet if (!control) return; } control.incoming(packet); // $# Edited 25 Oct 1995 17:51 Lynx ($lynx) }; protected method .new_channel() { arg id, buf; var lines, reg, par; // parse the buffer to figure out what type of channel it is. // for now everything is 'shell; par = ((buf[1]) * 256) + (buf[2]); lines = subbuf(buf, 3).to_strings(); channels = channels.add(id, $user_rascal); ch_info = ch_info.add(id, [par, lines]); // $# Edited 25 Oct 1995 18:41 Lynx ($lynx) }; protected method .message() { arg status, id, buf; var control; control = (| channels[id] |); switch (status) { case 'abort: .close_channel(id); return; case 'close: .close_channel(id); case 'open: if (control) return; control = .new_channel(id, buf); return; } if (!control) return; // fork this control.inbound(buf); // $# Edited 25 Oct 1995 18:45 Lynx ($lynx) }; protected method .close_channel() { arg id; channels = (| channels.del(id) |); ch_info = (| ch_info.del(id) |); // $# Edited 25 Oct 1995 18:41 Lynx ($lynx) }; public method .outbound() { arg what, type, [nopush]; var id, a; id = (| ch_types[type] |); if (id == ~keynf) throw(~invch, strfmt("Invalid channel type: %d.", type)); if (!id) { id = .new_id(); ch_types = ch_types.add(type, id); a = 'open; } switch (type(what)) { case 'string: what = $buffer.from_strings([what], `[10]); case 'list: what = $buffer.from_strings(what, `[10]); case 'buffer: default: throw(~type, "Write: strings, list of strings and buffers."); } // cwrite(buf_from_veil_packets([[nopush ? 0 | 1, a, id, buf]])); // $# Edited 25 Oct 1995 18:41 Lynx ($lynx) }; public method .init_veil_connection() { incomplete = `[]; packets = []; channels = #[]; ch_types = #[]; ch_info = #[]; last_id = 1; host = ""; daemon = 0; active = 0; timeout = 0; .set_flags([]); // $# Edited 25 Oct 1995 18:41 Lynx ($lynx) }; public method .close() { arg [msg]; var c; (caller() == definer()) || (> .perms(sender()) <); msg = $buffer.from_strings([@msg, ["Goodbye"]][1]); active = 0; for c in (channels.keys()) .write(msg, ch, 'close, 1); (| close_connection() |); for c in (channels) (| (c[2]).connection_going_away() |); channels = #[]; // $# Edited 25 Oct 1995 18:41 Lynx ($lynx) }; root method .uninit_connection() { if (active) .close(["** Connection aborted due to object destruction **"]); // $# Edited 25 Oct 1995 18:41 Lynx ($lynx) }; public method .daemon_shutdown() { var c; (> .perms(caller(), $daemon) <); for c in (.children()) (> .close(["** Connection aborted due to daemon shutdown **"]) <); // $# Edited 25 Oct 1995 18:41 Lynx ($lynx) }; public method .timeout() { return timeout; // $# Edited 25 Oct 1995 18:41 Lynx ($lynx) }; public method .address() { (> .perms(sender()) <); return host; // $# Edited 25 Oct 1995 18:41 Lynx ($lynx) }; public method .set_host() { arg host; (> .perms(sender()) <); set_var('host, host); // $# Edited 25 Oct 1995 18:41 Lynx ($lynx) }; public method .set_daemon() { arg daemon; (> .perms(sender()) <); set_var('daemon, daemon); // $# Edited 25 Oct 1995 18:41 Lynx ($lynx) }; protected method .do_timeout() { arg seconds; .close([("VEIL: ** Timeout " + tostr(seconds)) + " seconds **"]); // $# Edited 25 Oct 1995 18:41 Lynx ($lynx) }; driver method .disconnect() { arg [args]; var c; // this is called by the driver, after the connection is dead, so // we have no connection already. active = 0; for c in (channels) (| (c[2]).connection_going_away() |); channels = #[]; // $# Edited 25 Oct 1995 18:41 Lynx ($lynx) }; public method .set_port() { arg port; (> .perms(sender()) <); set_var('port, port); // $# Edited 25 Oct 1995 18:41 Lynx ($lynx) }; public method .active() { return active; // $# Edited 25 Oct 1995 18:41 Lynx ($lynx) }; driver method .connect() { arg client, server, socket; host = client; daemon.new_connection(); }; public method .active_since() { return active; // $# Edited 25 Oct 1995 18:41 Lynx ($lynx) }; public method .start() { // Make this method 'fork' from the regular thread stack (> .perms(caller(), $daemon) <); active = time(); // do something // $# Edited 25 Oct 1995 18:41 Lynx ($lynx) }; new object $smtp: $network; var $root manager = $smtp; var $smtp maildrop = "127.0.0.1"; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 845213524; var $root managed = [$smtp]; var $smtp debugging = [$http_interface]; var $root inited = 1; var $smtp postmaster = 0; var $smtp valid_host_regexp = "^([-a-z0-9]+\.)+(gov|edu|com|org|int|mil|net|nato|arpa|[a-z][a-z])$"; var $smtp valid_email_regexp = "^[-a-z0-0_!.%+$'=]+[^.]$"; var $root trusted_by = [$outbound_connection]; public method .parse_address() { arg addr; return [(| addr.subrange(1, (addr.rindex("@")) - 1) |) || addr, (| addr.subrange((addr.rindex("@")) + 1) |) || ""]; }; public method .sendmail() { arg recip, subj, [lines]; var mailagent, reason; (> .perms(sender(), 'trusts) <); mailagent = ((((($motd.server_name()) + " (") + ($sys.server_info('server_hostname))) + ":") + ($login_daemon.current_port())) + ")"; if ((reason = .invalid_email_address(recip))) return reason; return .raw_sendmail(recip, "Date: " + ($time.format("%a, %e %b %Y %T %Z")), "From: " + (.return_address()), "To: " + recip, "Subject: " + subj, "Errors-to: " + (.errors_to_address()), "X-Mail-Agent: " + mailagent, @lines); }; public method .invalid_email_address() { arg address; var at, name, host; if (!address) return "no email address supplied"; if (!(at = address.rindex("@"))) return "not a valid email address"; name = address.subrange(1, at - 1); host = address.subrange(at + 1); if ((name.match_regexp("^in%")) || (name.match_regexp("^smtp%"))) return ("'" + name) + "' doesn't look like a valid username (try removing the 'in%' or 'smtp%')"; if (!(host.match_regexp(valid_host_regexp))) return ("'" + host) + "' doesn't look like a valid Internet host"; if (!(name.match_regexp(valid_email_regexp))) return ("'" + name) + "' doesn't look like a valid username for Internet mail"; return ""; }; public method .invalid_hostname() { arg hostname; return (hostname.match_regexp(valid_host_regexp)) ? "" : (("'" + hostname) + "' is not a valid internet host name"); }; public method .raw_sendmail() { arg recip, [body]; var x, blank, data, debugto, target, line, state, timeout; (sender() == this()) || (> .perms(sender(), 'system) <); if (type(debugging) == 'list) debugto = debugging; else debugto = debugging && [.manager()]; data = []; for x in (body) { refresh(); if (!(blank || (x.match_regexp("[a-z0-9-]*: ")))) { if (x) data += [""]; blank++; } data += [(x == ".") ? "." + x : x]; } pause(); target = $outbound_connection.new(); catch any { target.open_connection(.maildrop(), 25); } with { line = "Cannot open connection to maildrop: " + ((traceback()[1])[2]); (| target.close() |); return line; } timeout = $scheduler.add_task(120, 'timeout, target); state = 'connect; catch any { while (type((| (x = target.start_reading_block('one)) |)) == 'list) { x = x[1]; if (debugto) debugto.mmap('tell, "GET: " + x); if (x && (!((x[1]) in "23"))) { target.close(); (| $scheduler.del_task(timeout) |); return x; } else if (x && ((x[4]) == "-")) { continue; } switch (state) { case 'connect: ._send(target, "HELO " + ($sys.server_info('server_hostname)), debugto); state = 'from; case 'from: ._send(target, ("MAIL FROM: <" + (.postmaster())) + ">", debugto); state = 'rcpt; case 'rcpt: ._send(target, ("RCPT TO:<" + recip) + ">", debugto); state = 'data; case 'data: ._send(target, "DATA", debugto); state = 'send_data; case 'send_data: for line in (data) ._send(target, line, debugto); ._send(target, ".", debugto); state = 'quit; case 'quit: ._send(target, "QUIT", debugto); break; } } (| target.close() |); return 0; } with { (| target.close() |); (| $scheduler.del_task(timeout) |); rethrow(error()); } (| $scheduler.del_task(timeout) |); }; public method .postmaster() { return postmaster || ($sys.get_system_email('default)); }; public method .maildrop() { return maildrop || "localhost"; }; public method .return_address() { return .postmaster(); }; public method .errors_to_address() { return .postmaster(); }; public method .connection_starting() { arg addr, port; return; }; public method .connection_going_away() { arg addr, port; return; }; private method ._send() { arg conn, line, debugto; if (debugto) debugto.mmap('tell, "SEND: " + line); conn.write_string(line + "\n"); }; protected method .timeout() { arg conn; (| conn.close() |); }; new object $daemon: $network, $has_settings; var $root child_index = 6; var $root manager = $daemon; var $root created_on = 809051864; var $root inited = 1; var $root flags = ['methods, 'code, 'core, 'variables]; var $daemon default_port = 0; var $daemon connection = 0; var $daemon next_connection = 0; var $daemon current_port = 0; var $root managed = [$daemon]; var $root owned = [$daemon]; var $has_settings defined_settings = #[["default-port", #[['get, 'get_default_port], ['set, 'set_default_port], ['check, 'is_type], ['del, 'null_method], ['check_args, ['integer]], ['get_args, []], ['set_args, []]]], ["connection", #[['get, 'get_connection], ['set, 'set_connection], ['check, 'check_connection], ['del, 'null_method], ['check_args, []], ['get_args, []], ['set_args, []]]]]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; public method .get_default_port() { arg [args]; return default_port; }; protected method .set_connection() { arg definer, name, value, [args]; connection = value; }; public method .stop_listening() { arg [port]; (> .perms(sender()) <); (> connection.daemon_shutdown() <); next_connection = 0; }; public method .start_listening() { arg [port]; (> .perms(sender()) <); (| .stop_listening() |); current_port = port ? port[1] : default_port; next_connection = connection.new_connection(); bind_port(current_port); }; public method .startup() { arg [args]; var name, opt, port; (> .perms(caller(), 'system) <); catch any { name = tostr(.objname()); name = "-p" + (name.subrange(1, ("_" in name) - 1)); opt = name in args; } port = (| toint(args[opt + 1]) |) || default_port; catch any { (| .stop_listening() |); (> .start_listening(port) <); $sys.log(((("** Starting " + this()) + " on port ") + tostr(port)) + " **"); } with { switch (error()) { case ~bind: $sys.log(("** Unable to bind to port " + tostr(port)) + "! **"); default: $sys.log($parse_lib.traceback(traceback())); } } }; public method .current_port() { return current_port; }; public method .shutdown() { arg [args]; (> .perms(caller(), $sys) <); (> .stop_listening() <); }; driver method .connect() { arg remote, local, socket; var conn; if ($sys.blacklisted(remote)) { close_connection(); return; } if (!valid(next_connection)) next_connection = connection.new_connection(); conn = next_connection; reassign_connection(conn); next_connection = connection.new_connection(); conn.start(remote, local, socket, current_port); }; protected method .set_default_port() { arg definer, name, value, [args]; // MOST systems don't allow this without root access--if you can do // it go ahead and remove this code, in general its not safe. if (value < 1024) throw(~perm, "Set a port greater than 1024"); default_port = value; }; public method .check_connection() { arg definer, value, [args]; var obj; obj = (> $object_lib.to_dbref(value) <); if (!(obj.is($connection))) throw(~perm, "Connection object must be descended from $connection."); return obj; }; protected method .get_connection() { arg [args]; return connection; }; new object $http_daemon: $daemon; var $root manager = $http_daemon; var $root created_on = 809075222; var $root inited = 1; var $root flags = ['methods, 'code, 'core, 'variables]; var $daemon default_port = 1180; var $daemon connection = $http_connection; var $daemon next_connection = $http_connection_9100; var $daemon current_port = 1180; var $root managed = [$http_daemon]; var $root owned = [$http_daemon]; var $root writes = [$http_connection_9100]; new object $login_daemon: $daemon; var $root manager = $login_daemon; var $root created_on = 809051992; var $root inited = 1; var $root flags = ['methods, 'code, 'core, 'variables]; var $daemon connection = $login_connection; var $daemon default_port = 1138; var $daemon current_port = 1138; var $daemon next_connection = $login_connection_13088; var $root managed = [$login_daemon]; var $root owned = [$login_daemon]; var $has_settings local_settings = ["port"]; var $root writes = [$login_connection_13088]; new object $veil_daemon: $daemon; var $root manager = $veil_daemon; var $root flags = ['methods, 'code, 'variables, 'core]; var $root created_on = 814668214; var $root inited = 1; var $daemon default_port = 1100; var $daemon connection = $veil_connection; var $root managed = [$veil_daemon]; var $root owned = [$veil_daemon]; new object $smtp_daemon: $daemon; var $root manager = $smtp_daemon; var $daemon default_port = 1125; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 849170427; var $has_settings defined_settings = #[]; var $has_settings local_settings = ["connection"]; var $has_settings settings = #[]; var $root inited = 1; var $daemon connection = $smtp_connection; var $daemon current_port = 1125; var $root managed = [$smtp_daemon]; var $daemon next_connection = $smtp_connection_97; var $smtp_daemon msg_id = 17; var $root writes = [$smtp_connection_97]; public method .get_msg_id() { msg_id++; return msg_id; }; new object $logic_frob: $frob; var $root child_index = 6; var $root trusted = []; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'variables, 'core]; var $root manager = $logic_frob; var $root managed = [$logic_frob]; var $root owned = [$logic_frob]; var $logic_frob token = 0; public method .try() { arg [args]; return 0; }; public method .token() { return token; }; public method .set_token() { arg new; (> .perms(sender(), 'manager) <); token = new; }; new object $xor: $logic_frob; var $root trusted = []; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'variables, 'core]; var $root manager = $xor; var $root managed = [$xor]; var $root owned = [$xor]; var $logic_frob token = "^"; public method .test() { arg xorlist, [args]; var val, x; val = 0; for x in (xorlist) { catch ~type, ~methodnf val = val ? !(x.test(@args)) : (x.test(@args)); with val = val ? !x : x; } return val; }; frob method .unparse() { arg xorlist; var str, x; str = ""; for x in (xorlist) { catch any str = (str + (x.unparse())) + " ^^ "; with str = (str + tostr(x)) + " ^^ "; } return ("(" + (str && (str.subrange(1, (str.length()) - 4)))) + ")"; }; new object $and: $logic_frob; var $root trusted = []; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'variables, 'core]; var $root manager = $and; var $root managed = [$and]; var $root owned = [$and]; var $logic_frob token = "&&"; public method .test() { arg andlist, [args]; var val, x; val = 0; for x in (andlist) { catch ~type, ~methodnf val = x.test(@args); with val = x; if (!val) break; } return val; }; frob method .unparse() { arg andlist; var str, x; str = ""; for x in (andlist) { catch any str = (str + (x.unparse())) + " && "; with str = (str + tostr(x)) + " && "; } return ("(" + (str && (str.subrange(1, (str.length()) - 4)))) + ")"; }; new object $and_lock_frob: $and; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'variables, 'core]; var $root manager = $and_lock_frob; var $root managed = [$and_lock_frob]; var $root owned = [$and_lock_frob]; public method .new_lock() { arg lhs, rhs; if ((type(lhs) != 'frob) || (type(rhs) != 'frob)) throw(~perm, "Arguments are not both frobs."); return (<this(), [lhs, rhs]>); }; public method .try() { arg lock, obj; return ((lock[1]).try(obj)) && ((lock[2]).try(obj)); }; public method .lock_name() { arg lock, [type]; [(type ?= 'literal)] = type; switch (type) { case 'literal: return ((("(" + ((lock[1]).lock_name(type))) + " && ") + ((lock[2]).lock_name(type))) + ")"; default: return (((lock[1]).lock_name(type)) + " and ") + ((lock[2]).lock_name(type)); } }; new object $lock_frob: $logic_frob; var $root child_index = 5; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'variables, 'core]; var $lock_frob names = 0; var $root manager = $lock_frob; var $root managed = [$lock_frob]; var $root owned = [$lock_frob]; var $lock_frob lock_types = [["inside", $inside_lock_frob], ["indirect", $indirect_lock_frob], ["owner", $owner_lock_frob]]; public method .lock_name() { arg value, [type]; [(type ?= 'default)] = type; if (type == 'literal) type = 'default; return (| names[type] |) || (names['default]); }; public method .set_lock_name() { arg name; (> .perms(sender(), 'manager) <); lock_name = name; }; public method .add_name() { arg type, name; (> .perms(sender(), 'manager) <); if (!names) names = #[]; names = names.add(type, name); }; public method .new_with() { arg str; return (> .parse(str, sender()) <); }; public method .parse() { arg s, who; var stack, lock, n, m, obj, type, i; stack = []; s = " " + s; s = strsed(s, "&([^&])", "&&%1", "g"); s = strsed(s, "\|([^\|])", "||%1", "g"); s = strsub(s, " or ", " || "); s = strsub(s, " and ", " && "); s = strsub(s, " not ", " !"); while (1) { // Look for valid prefixes. while (1) { (s = s.trim()) || throw(~parse, "String ends unexpectedly."); if ((s[1]) == "(") { stack = ['open, @stack]; s = s.subrange(2); } else if ((s[1]) == "!") { if (stack && ((stack[1]) == 'not)) stack = stack.subrange(2); else stack = ['not, @stack]; s = s.subrange(2); } else { break; } } // Look for an object name or tag m = regexp(s, "^([^)&|]+)(.*)"); if (!m) throw(~parse, "Null object obj_name."); s = m[2]; lock = (m[1]).trim(); if (!lock) throw(~parse, "Null object obj_name."); // try and match it type = $object_lock_frob; for i in (lock_types) { if (lock.match_begin((i[1]) + ":")) { type = i[2]; lock = lock.subrange(((i[1]).length()) + 2); break; } } if ((obj = (| who.match_environment(lock) |))) { lock = type.new_lock(obj); } else { switch (lock) { case "any", "true", "anybody": lock = $true_lock_frob.new(); case "none", "false", "nobody": lock = $false_lock_frob.new(); default: throw(~parse, ("Invalid lock tag \"" + lock) + "\""); } } stack = [lock, @stack]; // Loop until no more reduction to be done. while (1) { // Process negations, ands, ors. while (1) { if ((stack.length()) < 2) break; if ((stack[2]) == 'not) stack = [$not_lock_frob.new_lock(stack[1]), @stack.subrange(3)]; else if ((stack[2]) == 'and) stack = [$and_lock_frob.new_lock(stack[1], stack[3]), @stack.subrange(4)]; else if ((stack[2]) == 'or) stack = [$or_lock_frob.new_lock(stack[1], stack[3]), @stack.subrange(4)]; else break; } // Close parens, if necessary; otherwise stop. if ((!s) || ((s[1]) != ")")) break; while (s && ((s[1]) == ")")) { if (((stack.length()) < 2) || ((stack[2]) != 'open)) throw(~parse, "Misplaced right parenthesis."); stack = [stack[1], @stack.subrange(3)]; s = (s.subrange(2)).trim(); } } // Are we done? if (!s) { if ((stack.length()) > 1) throw(~parse, "Unmatched left parentheses."); return stack[1]; } // No, we're at a conjunction. if ((s[1]) == "&") { stack = ['and, @stack]; s = s.subrange(3); } else if ((s[1]) == "|") { stack = ['or, @stack]; s = s.subrange(3); } else { throw(~parse, "Illegal character following right parenthesis."); } } }; new object $object_lock_frob: $lock_frob; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'variables, 'core]; var $root manager = $object_lock_frob; var $root owned = [$object_lock_frob]; var $root managed = [$object_lock_frob]; public method .new_lock() { arg obj; if (type(obj) != 'objnum) throw(~perm, "Argument is not a dbref."); return (<this(), [obj]>); }; public method .try() { arg lock, obj; return ((lock[1]) == obj) || ((obj == sender()) || ($sys.is_system(obj))); }; public method .lock_name() { arg value, [type]; return (value[1]).name(); }; frob method .unparse() { arg obj; return toliteral(obj[1]); }; new object $inside_lock_frob: $lock_frob; var $root trusted = []; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'variables, 'core]; var $root manager = $inside_lock_frob; var $root managed = [$inside_lock_frob]; var $root owned = [$inside_lock_frob]; public method .try() { arg lock, obj; return ((lock[1]).contains(obj)) || ($sys.is_system(obj)); }; public method .new_lock() { arg obj; if (type(obj) != 'objnum) throw(~perm, "Argument is not a dbref."); return (<this(), [obj]>); }; public method .lock_name() { arg value, [type]; return "inside:" + ((value[1]).name()); }; new object $indirect_lock_frob: $lock_frob; var $root manager = $indirect_lock_frob; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 847067040; var $root inited = 1; var $root managed = [$indirect_lock_frob]; public method .new_lock() { arg obj; if (type(obj) != 'objnum) throw(~perm, "Argument is not a dbref."); return (<this(), [obj]>); }; public method .try() { arg lock, obj; return ((lock[1]).try_indirect_lock(obj)) || ($sys.is_system(obj)); }; public method .lock_name() { arg value, [type]; return "indirect:" + ((value[1]).name()); }; new object $owner_lock_frob: $lock_frob; var $root manager = $owner_lock_frob; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 847067045; var $root inited = 1; var $root managed = [$owner_lock_frob]; public method .new_lock() { arg obj; if (type(obj) != 'objnum) throw(~perm, "Argument is not a dbref."); return (<this(), [obj]>); }; public method .try() { arg lock, obj; return ((lock[1]) in (obj.owners())) || ($sys.is_system(obj)); }; public method .lock_name() { arg value, [type]; return "owner:" + ((value[1]).name()); }; new object $not: $logic_frob; var $root trusted = []; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'variables, 'core]; var $root manager = $not; var $root managed = [$not]; var $root owned = [$not]; public method .test() { arg notlist, [args]; var val; catch ~range { catch ~type, ~methodnf return !((notlist[1]).test(@args)); with return !(notlist[1]); } with { return 1; } }; frob method .unparse() { arg notlist; catch any { catch ~type, ~methodnf return "!" + ((notlist[1]).unparse()); with return "!" + tostr(notlist[1]); } with { return "!()"; } }; new object $not_lock_frob: $not; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'variables, 'core]; var $root manager = $not_lock_frob; var $root managed = [$not_lock_frob]; var $root owned = [$not_lock_frob]; public method .new_lock() { arg lock; if (type(lock) != 'frob) throw(~perm, "Argument is not a lock."); return (<this(), [lock]>); }; public method .try() { arg lock, obj; return !((lock[1]).try(obj)); }; public method .lock_name() { arg lock, [type]; [(type ?= 'literal)] = type; switch (type) { case 'literal: return ("(!" + ((lock[1]).lock_name(type))) + ")"; default: return "not " + ((lock[1]).lock_name(type)); } }; new object $or: $logic_frob; var $root trusted = []; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'variables, 'core]; var $root manager = $or; var $root managed = [$or]; var $root owned = [$or]; public method .test() { arg orlist, [args]; var val, x; val = 0; for x in (orlist) { catch ~type, ~methodnf val = x.test(@args); with val = x; if (val) break; } return val; }; frob method .unparse() { arg orlist; var str, x; str = ""; for x in (orlist) { catch any str = (str + (x.unparse())) + " || "; with str = (str + tostr(x)) + " || "; } return ("(" + (str && (str.subrange(1, (str.length()) - 4)))) + ")"; }; new object $or_lock_frob: $or; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'variables, 'core]; var $root manager = $or_lock_frob; var $root managed = [$or_lock_frob]; var $root owned = [$or_lock_frob]; public method .new_lock() { arg lhs, rhs; if ((type(lhs) != 'frob) || (type(rhs) != 'frob)) throw(~perm, "Arguments are not both frobs."); return (<this(), [lhs, rhs]>); }; public method .try() { arg lock, obj; return ((lock[1]).try(obj)) || ((lock[2]).try(obj)); }; public method .lock_name() { arg lock, [type]; [(type ?= 'literal)] = type; switch (type) { case 'literal: return ((("(" + ((lock[1]).lock_name(type))) + " || ") + ((lock[2]).lock_name(type))) + ")"; default: return (((lock[1]).lock_name(type)) + " or ") + ((lock[2]).lock_name(type)); } }; new object $true: $logic_frob; var $root trusted = []; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'variables, 'core]; var $root manager = $true; var $root managed = [$true]; var $root owned = [$true]; frob method .unparse() { arg dummy; return "1"; }; public method .test() { arg [args]; return 1; }; new object $true_lock_frob: $true; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'variables, 'core]; var $root manager = $true_lock_frob; var $root managed = [$true_lock_frob]; var $root owned = [$true_lock_frob]; public method .new_lock() { return (<this(), []>); }; public method .try() { arg lock, obj; return 1; }; new object $false: $logic_frob; var $root trusted = []; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'variables, 'core]; var $root manager = $false; var $root managed = [$false]; var $root owned = [$false]; frob method .unparse() { arg dummy; return "0"; }; public method .test() { arg [args]; return 0; }; new object $false_lock_frob: $false; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'variables, 'core]; var $root manager = $false_lock_frob; var $root managed = [$false_lock_frob]; var $root owned = [$false_lock_frob]; public method .new_lock() { return (<this(), []>); }; public method .try() { arg lock, obj; return 0; }; new object $realms_frob: $frob, $has_name; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'variables, 'core]; var $has_name name = ['uniq, "realms_frob", "the realms_frob"]; var $realms_frob local = #[['weather, "nice"], ['weather_text, <$ctext_frob, [[], #[['this, $lag_watcher]]]>], ['map_position, [0, 0, "00"]], ['map_object, $generic_map], ['climate, $climate], ['location, 'interior], ['season, "summer"], [$place, 'interior]]; var $realms_frob types = #[['weather, 'string], ['map_position, 'map_position], ['map_object, 'object], ['climate, 'object], ['location, 'intext], ['season, 'string]]; var $root manager = $realms_frob; var $root managed = [$realms_frob]; var $root owned = [$realms_frob]; var $realms_frob links = 0; public method .new() { var value; (sender().is($place)) || throw(~place, sender() + " is not a place."); local = local.add(sender(), 'interior); return (<this(), #[['location, 'interior]]>); }; public method .destroyed() { arg frob; (sender() == (.manager())) || (> .perms(caller(), $place) <); (| (local = local.del(sender())) |); }; public method .init_realms_frob() { local = #[]; }; root method .uninit_realms_frob() { var x; for x in (local) (| (x[1]).set_realm($realm_of_creation) |); }; public method .place_destroyed() { arg place; (sender() == (.manager())) || (> .perms(caller(), $place) <); if (local.contains(place)) local = local.del(place); }; public method .local() { return local; }; frob method .name() { arg [args]; if (args && (type(args[1]) == 'dictionary)) args = sublist(args, 2); return (> pass(@args) <); }; public method .realm_name() { arg [args]; var realms; realms = .realms(); while ((realms.length()) > 2) realms = realms.delete(2); return realms.join(", "); }; public method .realms() { arg [args]; var r; if (definer() == this()) return []; return [.name()] + (((.parents())[1]).realms()); }; public method .get_realm_var() { arg data, v, [def]; var realms; if (type((| data[v] |)) != 'error) return data[v]; if (type((| local[v] |)) != 'error) return local[v]; if (definer() != this()) return (> ((.parents())[1]).get_realm_var(data, v, @def) <); if (def) return def[1]; throw(~keynf, "Realm variable not found: " + v); }; public method .all_realm_vars() { arg [data]; var k; return hash k in ((.all_realm_types()).keys()) to ([k, .get_realm_var((| data[1] |), k, ~undefined)]); }; public method .unparse_variable() { arg data, v, [def]; var value, t; value = (> .get_realm_var(data, v, @def) <); t = (> .type_of(v) <); switch (t) { case 'ctext: return value.uncompile(); case 'boolean, 'integer: return tostr(value); case 'string, 'text: return value; default: return (> .(tosym("unparse_" + t))(value) <); } }; public method .set_realm_var() { arg [args]; // GRR, hack; grammar for frobs doesnt like complex expressions as // the value (-Brandon) if ((args.length()) == 3) { if ((args[3]) == 'unset) return (<this(), dict_del(@delete(args, 3))>); else return (<this(), dict_add(@args)>); } (> .perms(sender()) <); if ((args[2]) == 'unset) local = dict_del(local, args[1]); else local = dict_add(local, @args); }; public method .type_of() { arg v; var t; if (!(| (t = types[v]) |)) return (definer() == this()) ? 0 : (((.parents())[1]).type_of(v)); return t; }; public method .parse_variable() { arg v, str; var value, t; t = (> .type_of(v) <); switch (t) { case 'ctext: return $compiler.compile_cml(str); case 'boolean: if (type(str) == 'list) str = str.join(); if (str in ["1", "t", "true", "y", "yes"]) return "yes"; if (str in ["0", "f", "false", "n", "no"]) return "no"; throw(~parse, "Illegal boolean value"); case 'string: if (type(str) == 'list) str = str.join(); return str; case 'text: if (type(str) == 'string) str = [str]; return str; default: return (> .(tosym("parse_" + t))(str) <); } }; public method .unparse_map_position() { arg value; return "%l,%l,%l".format(@value); }; public method .parse_map_position() { arg str; // The format is x,y,zz (coordinates of the window into the map, // tag to be printed) if (type(str) == 'list) str = str.join(); str = str.explode(","); return (> [toint(str[1]), toint(str[2]), str[3]] <); }; public method .unparse_object() { arg value; return tostr(value); }; public method .parse_object() { arg value; return (| lookup(tosym(value.subrange(2))) |) || (> sender().match_environment(value) <); }; public method .add_realm_variable() { arg v, type; (> .perms(sender(), 'manager) <); types = types.add(v, type); }; public method .del_realm_variable() { arg v, type; (> .perms(sender(), 'manager) <); types = types.del(v); }; public method .unparse_intext() { arg value; return #[['interior, "interior"], ['exterior, "exterior"]][value]; }; public method .parse_intext() { arg str; // either interior or exterior if (str.match_template("i?nterior")) return 'interior; else if (str.match_template("e?xterior")) return 'exterior; else throw(~parse, "This variable should be either \"i?nterior\" or \"e?xterior\""); }; public method .all_realm_types() { arg [parent_types]; var tmp; parent_types = parent_types ? parent_types[1] : #[]; if (!types) types = #[]; tmp = types.union(parent_types); return (definer() == this()) ? tmp : (((.parents())[1]).all_realm_types(tmp)); }; public method .all_realm_vars_text() { arg [data]; var k; return map k in ((.all_realm_types()).keys()) to ([("var " + tostr(k)) + " = "].affix(.unparse_variable((| data[1] |), k, ~undefined))); }; public method .ctext_variables() { arg frob; var ret, s, w; ret = (| (((w = .get_realm_var(frob, 'climate)).ctext_variables(tosym(.get_realm_var(frob, 'weather)), tosym((s = .get_realm_var(frob, 'season))))).add('time, (.get_realm_var(frob, 'timeobject)).daytime(.get_realm_var(frob, 'timezone), (| w.daylength(s) |) || 10))).add('evaluator, $realm_base_eval) |) || #[]; return ret; }; public method .add_exit_to() { arg self, dest; (> .perms(caller(), $place) <); if (class(dest.realm()) != this()) { links = links || #[]; // Do a quick sanity check before adding a new cross-realm exit .check_links(); // The format is: links, source, destination, path source->dest links = links.add_elem(class(dest.realm()), [this(), sender(), dest, []]); } }; public method ._check_links() { arg [propagate_check]; var i, j, k, d; (caller() == $realm_admin_ui) || (> .perms(caller(), $realms_frob) <); d = #[]; for i in (links || #[]) { for j in (i[2]) { // Run at low priority... refresh(); if (!(j[4])) { if ((j[2]).is_connected_to(j[3])) d = d.add_elem(i[1], j); } else if (((j[2]).is_connected_to((j[4])[1])) && ((!find k in [1 .. ((j[4]).length()) - 1] where (refresh() && (!(((j[4])[k]).is_connected_to((j[4])[k + 1]))))) && (((j[4]).last()).is_connected_to(j[3])))) { d = d.add_elem(i[1], j); } } } links = d; if (propagate_check) (| ((.parents())[1])._check_links(@propagate_check) |); }; new object $realm_of_creation: $realms_frob; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'variables, 'core]; var $has_name name = ['prop, "<Creation>", "<Creation>"]; var $realms_frob local = #[[#513, ['interior]], [#514, ['interior]], [#525, ['interior]], [#507, ['interior]], [#557, ['interior]], [$help_func_set_method_flags, ['interior]], [$robot, ['interior]], [#564, ['interior]], [#566, ['interior]], [#567, 1], [#568, 1], [#569, 1], [$help_node_editor_invoking, 1], [#573, 1], [#574, 1], [$help_cmds_display, 1], [#590, 'interior], [#592, 'interior], [#581, 'interior], [#582, 'interior], [#583, 'interior], [#493, 'interior], [#1061, 'interior], [#1062, 'interior], [#1063, 'interior], [#1064, 'interior], [#1065, 'interior], [#1068, 'interior], [#1069, 'interior], [#1070, 'interior], [#1071, 'interior], [#1072, 'interior], [#1073, 'interior], [#1074, 'interior], [#1075, 'interior], [#1263, 'interior], [#1268, 'interior], [#1269, 'interior], [#1270, 'interior], [#1271, 'interior], [#1272, 'interior], [#1275, 'interior], [#1276, 'interior], [#1277, 'interior], [#1278, 'interior], [#1281, 'interior], [#1291, 'interior], [#1292, 'interior], [#1293, 'interior], [#1294, 'interior], [#1295, 'interior], [#1296, 'interior], [#1297, 'interior], [#1302, 'interior], [#1303, 'interior], [#1314, 'interior], [#1596, 'interior], [$the_pit, 'interior], [$place, 'interior], [$nowhere, 'interior], [$body_cave, 'interior], [$void, 'interior]]; var $root manager = $realm_of_creation; var $realms_frob types = #[]; var $root managed = [$realm_of_creation]; var $root owned = [$realm_of_creation]; var $realms_frob links = #[]; new object $thing_frob: $frob, $thing; var $root child_index = 6; var $root fertile = 1; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'fertile, 'variables, 'core, 'frob]; var $located location = $void; var $located obvious = 1; var $described prose = []; var $has_gender gender = $gender_neuter; var $has_name name = ['uniq, "Thing Frob", "the Thing Frob"]; var $root manager = $thing_frob; var $root managed = [$thing_frob]; var $root owned = [$thing_frob]; frob method .match_name() { arg this, str; var t, m; if ((m = match_begin((this['name])[2], str))) return 1; if (this.contains('templates)) { for t in (this['templates]) { if ((m = match_template(str, t))) return 1; } } return 0; }; frob method .location() { arg this; return (| this['location] |) || $nowhere; }; frob method .did_move() { arg this; return (<this(), this>); }; frob method .is_obvious_to() { arg this, whom; return 1; }; frob method .will_move() { arg this, mover, place; if ((| this['lock] |) && (!((this['lock]).try(mover)))) throw(~locked, ((((.name()).capitalize()) + " is locked to ") + ((this['lock]).lock_name('thing))) + "."); return 1; }; frob method .prose() { arg this, [no_default]; return (| dict['prose] |) || (no_default ? 0 : "You see nothing special"); }; frob method .namef() { arg dict, [args]; return .name(dict); }; private method .change_data() { arg this, what, new; if (valid(this['location])) (this['location]).del_frob_from_contents((<this(), this>)); this = this.add(what, new); if (valid(this['location])) (this['location]).add_frob_to_contents((<this(), this>)); return (<this(), this>); }; frob method .manager() { arg this; return this['manager]; }; frob method .description() { arg this, flags; var out; out = (<$ctext_frob, [[(<$format, ["subj", [], [.name(this)], 'do_subj]>)], #[]]>); if ((| flags['prose] |)) return [out, .prose(this)]; return [out]; }; frob method .name_templates() { arg this; return (| this['name_templates] |) || []; }; frob method .get_description(): nooverride { arg this, [dflags]; var flags, f; flags = #[['prose, 1], ['actor, sender()]]; if (dflags && (type(dflags[1]) == 'dictionary)) { dflags = dflags[1]; for f in (dflags.keys()) flags = dict_add(flags, f, dflags[f]); } return .description(this, flags); }; frob method .all_remote_commands() { arg this; return pass(); }; frob method .remote_commands() { arg this; return pass(); }; frob method .set_prose() { arg this, new; return .change_data(this, 'prose, new); }; frob method .set_name() { arg this, new, [args]; var type; if (!new) return; if (new && ((new[1]) in ["$", "#"])) throw(~invname, "Names cannot begin with \"$\" or \"#\"."); if (match_regexp(new, "^(a|an|the) +")) throw(~bad_name, "Do not include articles in name, use +u +n or +p instead."); [(type ?= 'normal)] = args; switch (type) { case 'prop: new = [type, new, new]; case 'uniq: new = [type, new, "the " + new]; case 'normal: new = [type, new, ((new.a_or_an()) + " ") + new]; default: throw(~invarg, "Type must be one of: 'prop, 'normal or 'uniq."); } return .change_data(this, 'name, new); }; public method .new() { var name, prose, data, n; return (<this(), #[['prose, []], ['location, sender()], ['manager, sender()], ['name, .name('literal)]]>); }; frob method .del_name_template() { arg template; var new; new = setremove(.name_templates(this), template); return .change_data(this, 'name_templates, new); }; frob method .name() { arg dict, [args]; var name; name = dict['name]; if (!name) return tostr(this()); if (!args) return name[3]; switch (args[1]) { case 'type: return name[1]; case 'noarticle: return name[2]; default: return name; } }; frob method .add_name_template() { arg template; var new; new = setadd(.name_templates(this), template); return .change_data(this, 'name_templates, new); }; frob method .get_command_info() { arg this, [args]; return pass(@args); }; frob method .discard() { arg data; //// just allow anybody to discard for now.. // if (data['manager] != sender()) // throw(~perm, "You are not the manager of " + .name(data)); (data['location]).del_frob_from_contents((<this(), data>)); }; frob method .move_to() { arg data, place; var location; if (!(place.has_ancestor($location))) throw(~type, "Argument is not a location."); location = data['location]; if (!valid(location)) location = $nowhere; (> .will_move(data, sender(), place) <); return .change_data(data, 'location, place); }; frob method .perms() { arg this, what, [args]; return (what == (this['manager])) || (> (this['location]).perms(what, @args) <); }; frob method .visibility() { arg this, [args]; return (| this['visibility] |) || 0; }; public method .new_with() { arg [args]; var name, prose, data, n; name = (listlen(args) > 0) && (args[1]); prose = (listlen(args) > 1) && (args[2]); new = .new(); if (prose) new = new.set_prose(prose); if (name) new = new.set_name(name); return new; }; frob method .configure() { arg this, set; var p, end, ctext, s, still, type; (> .perms(this, sender()) <); s = sender(); still = ("Do you still want to describe " + (.name(this))) + "? [no] "; if (!(set.contains('described_prose))) { while (!end) { if (.is(this, $exit)) type = "exit "; else type = ""; p = s.read((("Describe " + type) + (.name(this))) + ", Enter \".\" to finish or \"@abort\" to abort description."); if (p == 'aborted) { end = !(s.prompt_yesno(still, 0)); } else { catch any { ctext = (> $compiler.compile_cml(p) <); s.tell(["You submitted the following description:", ""]); s.tell(ctext); s.tell(""); if (!(end = s.prompt_yesno("Keep this description? [yes] "))) ctext = 0; } with { s.tell(["The following CML compiler error occurred:", " ", (traceback()[1])[2]]); end = !(s.prompt_yesno(still, 0)); } } } if (ctext) this = (.set_prose(this, ctext)).value(); set = set.add('described_prose, 1); } return [this, set]; }; new object $wearable_frob: $thing_frob; var $root child_index = 8; var $root fertile = 1; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'fertile, 'variables, 'core]; var $described prose = []; var $has_name name = ['normal, "Generic Wearable Frob", "a Generic Wearable Frob"]; var $has_commands remote = #[]; var $root manager = $wearable_frob; var $located location = $lost_and_found; var $root managed = [$wearable_frob]; var $root owned = [$wearable_frob]; frob method .wear() { arg this; if ((this['location]) != sender()) throw(~perm, ("You are not holding " + (.name(this))) + "."); return .change_data(this, 'worn, sender()); }; public method .new() { return .to_frob((pass().value()).add('worn, 0)); }; protected method .change_data() { arg this, what, new; // hairy if (!(this['worn])) { if (what != 'worn) return pass(this, what, new); else (this['location]).del_frob_from_contents((<this(), this>)); } else if (valid(this['worn])) { (this['worn]).shed((<this(), this>)); } this = dict_add(this, what, new); if (valid(this['worn])) (this['worn]).wear((<this(), this>)); else if (valid(this['location])) (this['location]).add_frob_to_contents((<this(), this>)); return (<this(), this>); }; frob method .shed() { arg this; if (!(this['worn])) throw(~perm, ("You are not wearing " + (.name(this))) + "."); if ((this['worn]) != sender()) throw(~perm, ((("Remove " + (.name(this))) + " from ") + sender()) + "!?"); return .change_data(this, 'worn, 0); }; new object $exit: $physical; var $exit source = $void; var $exit dest = $void; var $exit lock = <$true_lock_frob, []>; var $exit coordinates = 0; var $root child_index = 380; var $root fertile = 1; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'fertile, 'variables, 'core]; var $has_gender gender = $gender_neuter; var $described prose = []; var $has_name name = ['uniq, "Generic Exit", "the Generic Exit"]; var $has_commands remote = #[["@lock", [["@lock", "*", "@lock <this>", 'lock_cmd, #[[1, ['this, []]]]], ["@lock", "* with|to *", "@lock <this> with|to <any>", 'lock_with_cmd, #[[1, ['this, []]], [3, ['any, []]]]]]], ["@unlock", [["@unlock", "*", "@unlock <this>", 'unlock_cmd, #[[1, ['this, []]]]]]]]; var $has_messages messages = #[[$exit, #[["exit.actor", <$ctext_frob, [["You take ", <$generator, ["exit", [], [], 'gen_exit]>, "."], #[['this, $lag_watcher]]]>], ["exit.source", <$ctext_frob, [[<$generator, ["actor", [], [], 'gen_actor]>, " goes through ", <$generator, ["exit", [], [], 'gen_exit]>, "."], #[['this, $lag_watcher]]]>], ["exit.dest", <$ctext_frob, [[<$generator, ["actor", [], [], 'gen_actor]>, " arrives."], #[['this, $lag_watcher]]]>]]]]; var $has_messages message_info = #[["exit", #[]]]; var $root manager = $exit; var $root owned = [$exit]; var $root managed = [$exit]; root method .uninit_exit() { (| .detach() |); (| clear_var('source) |); (| clear_var('dest) |); (| clear_var('lock) |); }; public method .invoke() { arg [flags]; var s, here, vars, m, actor; s = (actor = sender()); if (flags) flags = flags[1]; else flags = #[]; flags = flags.add('actor, s); flags = flags.add_elem('exclude, s); if (!valid(.dest())) s.tell((.name()) + " has an invalid destination, notify the manager."); if (lock && (!(lock.try(s)))) return s.tell((.name()) + " is locked."); s.move_to(.dest()); .invoke_notify(s, flags); }; public method .lock() { return lock || ($true_lock_frob.new()); }; public method .attach() { arg src, dst, [ignore]; (> .perms(sender()) <); (src.is($place)) || throw(~place, (source.namef('ref)) + " is not a place."); (dst.is($place)) || throw(~place, (dest.namef('ref)) + " is not a place."); (| .detach() |); (> src.will_attach('source, sender()) <); (> dst.will_attach('dest, sender()) <); source = src; dest = dst; (> source.attach_exit('source, this()) <); (> dest.attach_exit('dest, this()) <); }; public method .dest() { return dest; }; public method .source() { return source; }; public method .place_destroyed() { arg place; (> .perms(caller(), $place) <); if (sender() in [dest, source]) $sys.destroy_sender(); }; public method .destination_destroyed() { var msg, line, name; (> .perms(caller(), $place) <); $sys.destroy_sender(); }; private method .detach(): nooverride { source && (source.detach_exit('source, this())); dest && (dest.detach_exit('dest, this())); }; public method .lock_cmd() { arg cmdstr, cmd, this; if (!(| .perms(sender()) |)) return ((("Only " + ((.manager()).name())) + " can lock ") + (.name())) + "!"; lock = $false_lock_frob.new(); return "You lock " + (.name()); }; public method .lock_with_cmd() { arg cmdstr, cmd, this, prep, str; if (!(| .perms(sender()) |)) return ((("Only " + ((.manager()).name())) + " can lock ") + (.name())) + "!"; catch ~objnf, ~parse { lock = $lock_parser.parse(str, sender()); return ((("You lock " + (.name())) + " to allow ") + (lock.lock_name('exit))) + "."; } with { switch (error()) { case ~objnf: return "Object not found in lock string."; case ~parse: return "Invalid lock string."; } } }; public method .unlock_cmd() { arg cmdstr, cmd, this; if (!(| .perms(sender()) |)) return ((("Only " + ((.manager()).name())) + " can lock ") + (.name())) + "!"; lock = $true_lock_frob.new(); sender().tell("You unlock " + (.name())); }; public method .is_visible_to() { arg whom; return (.visibility()) >= ((whom.location()).darkness()); }; protected method .description() { arg flags; var desc; if ((!(| flags['prose] |)) || (!valid(.dest()))) return (> pass(flags) <); // create opened/closed exits and change this behaviour appropriately return [(<$ctext_frob, [[(<$format, ["subj", [], [("Through " + (.name())) + " you see.."], 'do_subj]>)], #[]]>), (.dest()).get_description(flags)]; }; private method .invoke_notify() { arg actor, flags; var vars, m; if (flags.contains('simple)) { actor.tell("You take " + (.name())); (.dest()).announce((actor.name()) + " arrives."); (.source()).announce((((actor.name()) + " goes through ") + (.name())) + "."); } else { vars = #[["$actor", actor], ["actor", actor.name()], ["$source", .source()], ["source", (.source()).name()], ["$dest", .dest()], ["dest", (.dest()).name()], ["$exit", this()], ["exit", .name()]]; m = .eval_message("exit", vars, $exit); (.dest()).announce(m); (.source()).announce(m); } }; new object $coord_exit: $exit; var $root manager = $coord_exit; var $coord_exit coordinates = 0; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 848977724; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_gender gender = $gender_neuter; var $has_commands shortcuts = #[]; var $has_commands remote = #[]; var $has_commands local = #[]; var $described prose = []; var $exit source = $nowhere; var $exit dest = $nowhere; var $exit lock = <$true_lock_frob, []>; var $root inited = 1; var $root managed = [$coord_exit]; public method .coordinates() { return coordinates || [0, 0, 0]; }; public method .configure() { arg set; var s, radial, azimuth, distance, ans, c, dist, m; set = (> pass(set) <); if (set.contains('exit_coordinates)) return set; s = sender(); if (!(| s.setting("experienced", $user) |)) s.tell($place_lib.build_hint(5)); while (1) { ans = s.prompt(((("Exit coordinates for " + (.name())) + " (to ") + ((.dest()).name())) + ") "); if (ans == "@abort") throw(~abort, "Abort"); if (ans == "@skip") return set; if (ans == "@shortcuts") { s.tell(["-- Coordinate Shortcuts:", map c in ($place_lib.coordinate_shortcuts()) to (strfmt(" %20l %7l %s", c[1], @c[2]))]); continue; } if (!ans) { s.tell("Invalid Coordinates."); continue; } catch ~coordnf, ~invcoord { if (ans.is_numeric()) { ans = ans.explode_english_list(); if ((ans.length()) != 2) { s.tell("Seperate coordinates with a comma."); continue; } if ((!((ans[1]).is_numeric())) || (!((ans[2]).is_numeric()))) { s.tell("Invalid coordinates."); continue; } if ((!((ans[1]).is_numeric())) || (!((ans[2]).is_numeric()))) { s.tell("Invalid coordinates."); continue; } radial = toint(ans[1]); azimuth = toint(ans[2]); } else { ans = $place_lib.coordinates(ans); radial = ans[1]; azimuth = ans[2]; } (> $place_lib.valid_coordinates(radial, azimuth) <); } with { s.tell((traceback()[1])[2]); continue; } } while (!dist) { ans = s.prompt(("Distance from center of room (metric) [" + ($place_lib.get_default('distance))) + "] "); if (!ans) dist = $place_lib.get_default('distance); else if (ans == "@skip") return set; else if ((m = match_regexp(ans, "^ *([0-9]+) *M *$"))) dist = toint(m[1]) * 100; else if ((m = match_regexp(ans, "^ *([0-9]+) *C?M? *$"))) dist = toint(m[1]); else s.tell("Distance must be either centimeters (cm) or meters (m)."); } coordinates = [radial, azimuth, dist]; return set.add('exit_coordinates); }; public method .uninit_coord_exit() { (| clear_var('coordinates) |); }; new object $exit_frob: $thing_frob, $exit; var $root manager = $exit_frob; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 849130536; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $has_name name = ['prop, "Exit Frob", "Exit Frob"]; var $has_gender gender = $gender_neuter; var $has_commands shortcuts = #[]; var $has_commands remote = #[]; var $has_commands local = #[]; var $described prose = []; var $located location = $void; var $located obvious = 1; var $root inited = 1; var $root managed = [$exit_frob]; frob method .invoke() { arg this, [flags]; var s, here, vars, m, actor; s = (actor = sender()); if (flags) flags = flags[1]; else flags = #[]; flags = flags.add('actor, s); flags = flags.add_elem('exclude, s); if (!valid(this['dest])) s.tell((.name(this)) + " has an invalid destination, notify the manager."); if (!((.lock(this)).try(s))) return s.tell((.name(this)) + " is locked."); s.move_to(this['dest]); .invoke_notify(this, s, flags); }; public method .change_data() { arg this, what, new; if (this['source]) return (this['source]).update_exit_frob(this, what, new); else return (<this(), this.add(what, new)>); }; frob method .invoke_notify(): forked { arg this, actor, flags; var vars, m, name; name = .name(this); if (flags.contains('simple)) { actor.tell("You take " + name); (this['dest]).announce((actor.name()) + " arrives."); (this['source]).announce((((actor.name()) + " goes through ") + name) + "."); } else { // this does not let you set specific messages on each exit-- // we need to add $has_messages_frob vars = #[["$actor", actor], ["actor", actor.name()], ["$source", this['source]], ["source", (this['source]).name()], ["$dest", this['dest]], ["dest", (this['dest]).name()], ["$exit", this()], ["exit", name]]; m = .eval_message("exit", vars, $exit); (this['dest]).announce(m); (this['source]).announce(m); } // hook event here }; frob method .lock() { arg this; if ((this.contains('lock)) && (this['lock])) return this['lock]; return $true_lock_frob.new(); }; frob method .attach() { arg this, source, dest, [ignore]; (source.is($place)) || throw(~place, (source.namef('ref)) + " is not a place."); (dest.is($place)) || throw(~place, (dest.namef('ref)) + " is not a place."); (| .detach() |); (> source.will_attach('source, sender()) <); (> dest.will_attach('dest, sender()) <); this = this.del('location); this = this.add('source, source); this = this.add('dest, dest); (> source.attach_exit('source, (<this(), this>)) <); (> dest.attach_exit('dest, (<this(), this>)) <); }; frob method .dest() { arg this; return this['dest]; }; frob method .source() { arg this; return this['source]; }; frob method .place_destroyed() { arg this, place; }; frob method .destination_destroyed() { arg this; if (!(caller().is($place))) throw(~perm, "Must be called by $place"); (this['source]).detach_exit('source, (<this(), this>)); }; frob method .detach(): nooverride { arg this; (this['source]) && ((this['source]).detach_exit('source, (<this(), this>))); (this['dest]) && ((this['dest]).detach_exit('dest, (<this(), this>))); }; frob method .lock_cmd() { arg this, cmdstr, cmd, ignore; if (!(| .perms(this, sender()) |)) return ((("Only " + ((.manager(this)).name())) + " can lock ") + (.name(this))) + "!"; .change_data(this, 'lock, $false_lock_frob.new()); return "You lock " + (.name(this)); }; frob method .lock_with_cmd() { arg this, cmdstr, cmd, ignore, prep, str; if (!(| .perms(this, sender()) |)) return ((("Only " + ((.manager(this)).name())) + " can lock ") + (.name(this))) + "!"; catch ~objnf, ~parse { .change_data(this, 'lock, $lock_parser.parse(str, sender())); return ((("You lock " + (.name(this))) + " to allow ") + (lock.lock_name('exit))) + "."; } with { switch (error()) { case ~objnf: return "Object not found in lock string."; case ~parse: return "Invalid lock string."; } } }; frob method .unlock_cmd() { arg this, cmdstr, cmd, ignore; if (!(| .perms(this, sender()) |)) return ((("Only " + ((.manager(this)).name())) + " can lock ") + (.name(this))) + "!"; .change_data(this, 'lock, $true_lock_frob.new()); return "You unlock " + (.name(this)); }; frob method .is_visible_to() { arg this, whom; return (.visibility(this)) >= ((whom.location()).darkness()); }; frob method .description() { arg this, flags; var desc; if ((!(| flags['prose] |)) || (!valid(this['dest]))) return (> pass(flags) <); // create opened/closed exits and change this behaviour appropriately return [(<$ctext_frob, [[(<$format, ["subj", [], [("Through " + (.name(this))) + " you see.."], 'do_subj]>)], #[]]>), (this['dest]).get_description(flags)]; }; public method .new() { var this; this = (> pass() <).value(); this = this.add('source, 0); this = this.add('dest, 0); return (<this(), this>); }; frob method .will_move() { arg this, mover, place; throw(~nomove, "You cannot do that to an exit!"); }; frob method .discard() { arg data; throw(~nope, "You cannot discard an exit."); }; new object $read_parser: $frob; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'variables, 'core]; var $root manager = $read_parser; var $root managed = [$read_parser]; var $root owned = [$read_parser]; public method .parse_line() { arg dict, line; var cmd; if (!line) { // we have to do this as such, because of logic (shrug) dict = dict.add('status, 'not_done); return dict.add_elem('lines, line); } else if ((line[1]) == ".") { if (((line.length()) > 1) && ((line[2]) == ".")) line = line.subrange(2); else if ((line.length()) == 1) return dict.add('status, 'done); //// No, bad Brandon, Bad, no scooby snack //// Decomment this if you want '>' to escape commands when reading // } else if (line[1] == ">") { // if (line.length() > 1 && line[2] == ">") { // line = line.subrange(2); // } else { // dict = dict.add('command, line.subrange(2)); // return dict.add('status, 'pass_command); // } } else if (line == "@abort") { return dict.add('status, 'abort); } dict = dict.add('status, 'not_done); return dict.add_elem('lines, line); }; public method .new_with() { arg task_id, count; return (<this(), #[['lines, []], ['status, 'not_done], ['count, count], ['task_id, task_id]]>); }; public method .parse() { arg dict, line; var line, result; // checks the incoming line to see if its a keeper, or a command. if ((dict['count]) == 'one) { dict = dict.add_elem('lines, line); return (<this(), dict.add('status, 'done)>); } else { return (<this(), .parse_line(dict, line)>); } }; public method .status() { arg dict; return dict['status]; }; public method .task_id() { arg dict; return dict['task_id]; }; public method .lines() { arg dict; return dict['lines]; }; public method .command() { arg dict; return (| dict['command] |) || ""; }; public method .add() { arg dict, [args]; return (<this(), (> dict.add(@args) <)>); }; new object $callback: $frob; var $root manager = $callback; var $root created_on = 799275808; var $root inited = 1; var $root flags = ['methods, 'code, 'variables, 'core]; var $root managed = [$callback]; var $root owned = [$callback]; public method .new() { arg method, static_args; return (<this(), [sender(), method, static_args]>); }; public method .exec() { arg self, [args]; return (self[1]).(self[2])(self[3], args); }; new object $message_frob: $frob; var $root manager = $message_frob; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'variables, 'core]; var $root managed = [$message_frob]; var $root owned = [$message_frob]; public method .add_entry() { arg this, key, what; var data; this = this.add(key, what); return (<this(), this>); }; public method .del_entry() { arg this, key; this = this.del(key); return (<this(), this>); }; public method .eval_ctext() { arg this, vars; var key, new, temp, t, list, vars; new = .new(); vars = vars.add('this, sender()); if ("general" in (this.keys())) vars = vars.add("$general", "general"); list = this.keys(); for key in (list) { temp = ((this[key]).set_var('this, vars['this])).eval_ctext(); new = new.add_entry((| vars["$" + key] |) || (vars[key]), temp); } return new; }; public method .has_entry() { arg this, name; return name in (this.keys()); }; public method .get_part() { arg this, part; return this[part]; }; public method .uncompile() { arg this; var key, output; output = #[]; for key in (this) output = output.add(key[1], (key[2]).uncompile()); return output; }; public method .parts() { arg this; return this.keys(); }; public method .message() { arg name, [definer]; var a, message, mes, m; //retrieve the specified message as ctext if (definer) definer = definer[1]; else definer = (._find_message_definer(name))[2]; message = $message_frob.new(); for a in (.ancestors()) { catch ~methodnf, ~messagenf return a.local_message(name, definer); } throw(~messagenf, "No matching message."); }; public method .set_vars() { arg this, new; var d; for d in (this.keys()) this = this.add(d, (this[d]).set_vars(new)); return (<this(), this>); }; public method .format() { arg this, vars; var new; new = (| this[vars['receiver]] |) || ((| this["general"] |) || ($ctext_frob.new_with([""]))); new = new.set_vars(vars); new = new.format(); return new; }; new object $trie: $frob; var $root manager = $trie; var $root help_node = $help_node_coredocuments_trie; var $root created_on = 800074237; var $root inited = 1; var $root flags = ['methods, 'code, 'variables, 'core]; var $root managed = [$trie]; var $root owned = [$trie]; public method .match_begin() { arg trie, key; var n, t; if ((trie[1]) && ((key == ((trie[1])[1])) || (((trie.length()) == 2) && match_begin((trie[1])[1], key)))) return trie[1]; if (!key) throw(~ambig, "Trie: ambiguous match."); if (!(n = (key[1]) in (trie[2]))) throw(~keynf, "Trie: key not found."); (> (t = .match_begin(trie[n + 2], key.subrange(2))) <); t = t.replace(1, (key[1]) + (t[1])); return t; }; public method .add() { arg [args]; return (<$trie, ._add(@args)>); }; public method .del() { arg [args]; return (<$trie, ._del(@args)>); }; public method ._add() { arg trie, key, [values]; var n, word; // This still ain't working. Current problem: values get mingled if (trie[1]) { if (key == ((trie[1])[1])) return trie.replace(1, [key, @values]); word = (trie[1])[1]; if (word) { if (!(n = (word[1]) in (trie[2]))) trie = [@trie.replace(2, (trie[2]) + (word[1])), ._add([0, ""], word.subrange(2), @(trie[1]).subrange(2))]; else trie = trie.replace(n + 2, ._add(trie[n + 2], word.subrange(2), @(trie[1]).subrange(2), @values)); trie = trie.replace(1, 0); } } if (((!(trie[1])) && ((trie.length()) == 2)) || (!key)) return trie.replace(1, [key, @values]); if (!(n = (key[1]) in (trie[2]))) return [@trie.replace(2, (trie[2]) + (key[1])), ._add([0, ""], key.subrange(2), @values)]; return trie.replace(n + 2, ._add(trie[n + 2], key.subrange(2), @values)); }; public method ._del() { arg trie, key; var n, t1; if ((trie[1]) && (key == ((trie[1])[1]))) { trie = trie.replace(1, 0); if (((trie.length()) == 3) && (!((trie[3])[2]))) trie = [((trie[3])[1]).replace(1, (trie[2]) + (((trie[3])[1])[1])), ""]; return trie; } if (!key) throw(~ambig, "Trie: Can't delete more than one key."); if (!(n = (key[1]) in (trie[2]))) throw(~keynf, "Trie: No such key."); t1 = (> ._del(trie[n + 2], key.subrange(2)) <); if (t1 == [0, ""]) trie = (trie.delete(n + 2)).replace(2, ((trie[2]).subrange(1, n - 1)) + ((trie[2]).subrange(n + 1))); else trie = trie.replace(n + 2, t1); if (((trie.length()) == 3) && ((!(trie[1])) && (!((trie[3])[2])))) trie = [((trie[3])[1]).replace(1, (trie[2]) + (((trie[3])[1])[1])), ""]; return trie; }; public method .match_exact() { arg trie, key; var n, t; if ((trie[1]) && (key == ((trie[1])[1]))) return trie[1]; if ((!key) || (!(n = (key[1]) in (trie[2])))) throw(~keynf, "Trie: key not found."); (> (t = .match_exact(trie[n + 2], key.subrange(2))) <); t = t.replace(1, (key[1]) + (t[1])); return t; }; public method .keys() { arg trie, [prefix]; var n, i, l; [(prefix ?= "")] = prefix; l = (trie[1]) ? [prefix + ((trie[1])[1])] : []; if (trie[2]) { for i in [1 .. (trie[2]).length()] l += .keys(trie[2 + i], prefix + ((trie[2])[i])); refresh(); } return l; }; public method .to_dict() { arg trie, [prefix]; var n, i, dict; // This function will only convert single-valued tries (such as were probably obtained from dictionaries [(prefix ?= "")] = prefix; dict = (trie[1]) ? #[[prefix + ((trie[1])[1]), (trie[1])[2]]] : #[]; if (trie[2]) { for i in [1 .. (trie[2]).length()] dict = dict.union(.to_dict(trie[2 + i], prefix + ((trie[2])[i]))); refresh(); } return dict; }; public method .new() { arg [ignore]; return (<this(), [0, ""]>); }; new object $ctext_frob: $frob; var $root manager = $ctext_frob; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 837584074; var $root inited = 1; var $root managed = [$ctext_frob]; var $root owned = [$ctext_frob]; public method .new_with() { arg data, [vars]; [(vars ?= #[])] = vars; return (<this(), [data, vars]>); }; public method .eval_ctext() { arg this; var data, vars; vars = this[2]; vars = vars.add('time, 'pre); if (!(| vars['sender] |)) vars = vars.add('sender, sender()); if (!(| vars['evaluator] |)) vars = vars.add('evaluator, $bs_eval); vars = vars.union((vars['evaluator]).init()); return .new_with(@(vars['evaluator])._eval_ctext(this[1], vars)); }; public method .format() { arg this; var vars; vars = this[2]; vars = vars.add('time, 'post); if (!(| vars['receiver] |)) vars = vars.add('receiver, sender()); if (!(| vars['formatter] |)) vars = vars.add('formatter, $text_format); vars = vars.union((vars['formatter]).init()); return (vars['formatter]).format(this[1], vars); }; public method .set_var() { arg this, name, value; var vars; vars = this[2]; vars = vars.add(name, value); return (<this(), [this[1], vars]>); }; public method .get_var() { arg this, name; return (this[2])[name]; }; public method .vars() { arg this; return this[2]; }; public method ._ctext() { arg this; return this[1]; }; public method .set_vars() { arg this, new; var vars, key; vars = this[2]; for key in (new.keys()) vars = vars.add(key, new[key]); return (<this(), [this[1], vars]>); // $# Edited 26 Oct 1995 00:35 Lynx ($lynx) }; public method .uncompile() { arg this; var vars; vars = this[2]; if (!(| vars['uncompiler] |)) vars = vars.add('uncompiler, $uncompiler); vars = vars.union((vars['uncompiler]).init()); return ((vars['uncompiler])._eval_ctext(this[1], vars))[1]; }; public method .append() { arg this, new, [br]; var data, tmp; data = this[1]; if (br) { switch (br[1]) { case "p": data += [(<$generator, ["p", [], [], 'do_p]>)]; case "br": data += [(<$generator, ["br", [], [], 'do_br]>)]; default: data += [$generator.new_tag(br[1], [], [])]; } } if (type(new) == 'list) data += new; else if ((type(new) == 'frob) && (class(new) == $ctext_frob)) data += new._ctext(); else data += [new]; return (<this(), [data, this[2]]>); }; new object $tag: $frob; var $root manager = $tag; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 837584128; var $root child_index = 2; var $root inited = 1; var $root managed = [$tag]; var $root owned = [$tag]; public method .new_tag() { arg name, flags, args, method; var item, eflags; eflags = []; for item in (flags) { switch (type(item)) { case 'string: eflags = eflags.addkey(item, 1); case 'list: if (type(item[1]) != 'string) throw(~flagerr, "Flag name must be a string."); eflags = eflags.addkey(item[1], item[2]); default: throw(~flagerr, "Flag must be a string or key,value pair."); } } return (<this(), [name, eflags, args, method]>); }; public method .name() { arg self; return self[1]; }; public method .add_ctext_flag() { arg self, key, value; var efalgs, uflags; eflags = (self[2]).addkey(key, value); self = self.replace(2, eflags); return (<this(), self>); }; public method .args() { arg self; return self[3]; }; public method .set_args() { arg self, args; return (<this(), self.replace(3, args)>); }; public method .append_arg() { arg self, new; var args; args = (self[3]) + [new]; return (<this(), self.replace(3, args)>); }; public method .method() { arg self; return self[4]; }; public method .ctext_flags() { arg self; return self[2]; }; public method .eval_flags() { arg this, vars; var flags, i, l, val, s; flags = this[2]; l = []; s = sender(); for i in (flags) { if (type(i[2]) == 'frob) { [val, vars] = s._eval_ctext(i[2], vars); l += [[i[1], val]]; } else { l += [i]; } } return [this[1], l, this[3], this[4]]; }; new object $format: $tag; var $root manager = $format; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 837584154; var $root inited = 1; var $root managed = [$format]; var $root owned = [$format]; public method .new_tag() { arg name, flags, args; return pass(name, flags, args, tosym("do_" + (name.strip()))); }; new object $generator: $tag; var $root manager = $generator; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 837584238; var $root inited = 1; var $root managed = [$generator]; var $root owned = [$generator]; public method .new_tag() { arg name, flags, args; return pass(name, flags, args, tosym("gen_" + (name.strip()))); }; new object $climate_frob: $frob; var $root manager = $climate_frob; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 837904716; var $root inited = 1; var $root managed = [$climate_frob]; var $root owned = [$climate_frob]; public method .new_with() { arg attributes, seasons; return (<this(), [attributes, seasons, #[]]>); }; public method .add_weather() { arg self, name, attrs, probs, message, ch_messages; return (<this(), [self[1], self[2], (self[3]).add(name, [attrs, probs, message, ch_messages])]>); }; public method .show() { arg self; var out, seasons, attrs, weathers, x, i; attrs = self[1]; seasons = self[2]; weathers = self[3]; out = [("Attributes: " + (attrs.to_english())) + ".", ("Seasons: " + (seasons.to_english())) + "."]; for x in (weathers) { out += [((((" * " + (x[1])) + "> (probs) ") + (map i in [1 .. seasons.length()] to ((tostr(seasons[i]) + ":") + (((x[2])[2])[i])).join(", "))) + " (attrs) ") + (map i in [1 .. attrs.length()] to ((tostr(attrs[i]) + ":") + (((x[2])[1])[i])).join(", "))]; out += [" Description = " + ((((x[2])[3]).uncompile()).join())]; if ((x[2])[4]) { out += [" Change messages:"]; for i in ((x[2])[4]) out += [" " + ((i.uncompile()).join())]; } } return out; }; public method .read_new() { arg user; var attrs, seasons, i; attrs = user.prompt("Weather attribute names (default:visibility severity):"); if (attrs == "@abort") throw(~abort, "User aborted."); if (type(attrs) == 'symbol) throw(~engaged, "Already reading."); attrs = attrs || "visibility severity"; attrs = (attrs.explode()).mmap('to_symbol); seasons = user.prompt("Season list (default:winter spring summer fall):"); if (seasons == "@abort") throw(~abort, "User @aborted."); if (type(seasons) == 'symbol) throw(~engaged, "Already reading."); seasons = seasons || "winter spring summer fall"; seasons = (seasons.explode()).mmap('to_symbol); return .new_with(attrs, seasons); }; public method .del_weather() { arg self, weather; return (<this(), [self[1], self[2], (self[3]).del(weather)]>); }; public method .read_weather() { arg self, user, weather; var attrs, probs, message, ch_messages, i; attrs = user.prompt("Attributes:"); if ((type(attrs) == 'symbol) || (attrs == "@abort")) throw(~stop, ""); if (((self[1]).length()) != ((attrs = attrs.explode_quoted()).length())) throw(~parse, "Wrong number of attributes"); attrs = map i in (attrs) to ((tostr(toint(i)) == i) ? toint(i) : i); probs = user.prompt("Seasonal probabilities [0-99]:"); if ((type(probs) == 'symbol) || (probs == "@abort")) throw(~stop, ""); if (((self[2]).length()) != ((probs = probs.explode()).length())) throw(~parse, "Wrong number of attributes"); probs = map i in (probs) to (toint(i)); message = user.prompt("Weather description:"); if ((type(message) == 'symbol) || (message == "@abort")) throw(~stop, ""); (> (message = $compiler.compile_cml(message)) <); ch_messages = user.read("Enter messages to be displayed during the change ('.' to finish)"); if (type(ch_messages) == 'symbol) throw(~stop, ""); (> (ch_messages = map i in (ch_messages) to ($compiler.compile_cml(i))) <); return .add_weather(self, weather, attrs, probs, message, ch_messages); }; public method ._distances() { arg self, from, season; var i, j, attr, w, refattr; w = self[3]; refattr = (w[from])[1]; return map i in (w.keys()) to ([i, ((map j in [1 .. (attr = (w[i])[1]).length()] to (abs((attr[j]) - (refattr[j]))).sum()) * 100) / (((w[i])[2])[season])]); }; public method .advance() { arg self, current, season, fuzz; var dists, i, w, s; w = self[3]; dists = ._distances(self, current, season); dists = dists.sort(dists.slice(2)); i = 1; while ((i < (dists.length())) && (random(20 + ((dists[i])[2])) < fuzz)) i++; return (dists[i])[1]; }; new object $rect: $frob; var $root manager = $rect; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 843360251; var $root inited = 1; var $root managed = [$rect]; public method .union() { arg r1, r2; return [$math.minor(r1[1], r2[1]), $math.major(r1[2], r2[2])]; }; public method .intersection() { arg r1, r2; // Doesn't check for validity return [$math.major(r1[1], r2[1]), $math.minor(r1[2], r2[2])]; }; public method .rect_size() { arg r1; var i, s; s = 0.0; for i in ($math.sub(@r1)) s += i; return -s; }; public method .nondegenerate() { arg r1; return $math.is_lower(@r1); }; public method .inside() { arg point, box; return ($math.is_lower(point, box[2])) && ($math.is_lower(box[1], point)); }; new object $rtree: $frob; var $root manager = $rtree; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 843361817; var $rtree max_length = 4; var $root inited = 1; var $root managed = [$rtree]; public method ._insert_where() { arg rlist, new; var i, u, min, t; u = 0; min = 1e+27; for i in [1 .. rlist.length()] { if ((t = $rect.rect_size($rect.union(rlist[i], new))) < min) { min = t; u = i; } } return u; }; public method ._insert() { arg tree, box, obj; var u, ret, xret, boxes, trees; trees = tree[2]; boxes = tree[1]; if (((trees[1]).length()) == 1) { // add leaf node to boxes and trees if ((trees.length()) < max_length) { return [[boxes + [box], trees + [obj]]]; } else { // return two nodes: return ._split(boxes + [box], trees + [obj]); } } else { u = ._insert_where(boxes, box); ret = ._insert(trees[u], box, obj); if ((ret.length()) == 1) return [[boxes.replace(u, $rect.union(box, boxes[u])), trees.replace(u, ret[1])]]; else if ((trees.length()) < max_length) return [[(boxes.delete(u)) + (ret.slice(3)), (trees.delete(u)) + [[(ret[1])[1], (ret[1])[2]], [(ret[2])[1], (ret[2])[2]]]]]; else return ._split((boxes.delete(u)) + (ret.slice(3)), (trees.delete(u)) + [[(ret[1])[1], (ret[1])[2]], [(ret[2])[1], (ret[2])[2]]]); } }; public method ._split() { arg rlist, nlist; var i, j, m1, m2, r1, r2, l1, l2, n1, n2, len, min, seed1, seed2, min1, box; // First find the two rects that unioned create the greatest size... len = rlist.length(); min = 1e+27; for i in [1 .. len - 1] { for j in [i + 1 .. len] { if (min > (min1 = $rect.rect_size($rect.union(rlist[i], rlist[j])))) { min = min1; seed1 = i; seed2 = j; } } } l1 = [(r1 = rlist[seed1])]; l2 = [(r2 = rlist[seed2])]; n1 = [nlist[seed1]]; n2 = [nlist[seed2]]; rlist = rlist.delete(seed2); rlist = rlist.delete(seed1); nlist = nlist.delete(seed2); nlist = nlist.delete(seed1); // Now add to the list that shows lower increase in size // l1,l2 are rectangle lists, n1,n2 are node lists, and r1, r2 are // current bounding rectangles for i in [1 .. rlist.length()] { box = rlist[i]; m1 = $rect.union(r1, box); m2 = $rect.union(r2, box); if (($rect.rect_size(m1)) < ($rect.rect_size(m2))) { r1 = m1; l1 += [box]; n1 += [nlist[i]]; } else { r2 = m2; l2 += [box]; n2 += [nlist[i]]; } } return [[l1, n1, r1], [l2, n2, r2]]; }; public method .insert() { arg self, box, obj; var ret; if (!(self[1])) return (<$rtree, [[box], [obj]]>); ret = ._insert(self, box, obj); if ((ret.length()) == 1) return (<$rtree, ret[1]>); else return (<$rtree, [ret.slice(3), [[(ret[1])[1], (ret[1])[2]], [(ret[2])[1], (ret[2])[2]]]]>); }; public method .empty() { return (<$rtree, [[], []]>); }; public method .search() { arg self, point; var boxes, trees, i, l; if ((self.length()) == 1) return self; boxes = self[1]; trees = self[2]; l = []; for i in [1 .. boxes.length()] { if ($rect.inside(point, boxes[i])) l += .search(trees[i], point); } return l; }; public method ._delete() { arg self, key, point; var i, trees, boxes, ret, l, b, mod, box; if ((self.length()) == 1) { if (self == key) return [0, 1, 0]; else return [self, 0, 0]; } trees = self[2]; boxes = self[1]; l = []; b = []; mod = 0; for i in [1 .. boxes.length()] { if ($rect.inside(point, boxes[i])) { ret = ._delete(trees[i], key, point); if ((ret[1]) == 0) { mod = 1; continue; } l += [ret[1]]; mod = mod || (ret[2]); b += [(ret[3]) ? ret[3] : (boxes[i])]; } else { l += [trees[i]]; b += [boxes[i]]; } } if (!l) return [0, 1]; if (mod) { box = b[1]; for i in (b.subrange(2)) box = box.union(i); return [[b, l], 1, box]; } return [self, 0, 0]; }; public method .delete() { arg self, point, box; var ret; ret = ._delete(self, point, box); return (ret[1]) ? (<this(), ret[1]>) : (.empty()); }; new object $utilities: $core; var $root child_index = 15; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'core, 'variables]; var $root manager = $utilities; var $root managed = [$utilities]; var $root owned = [$utilities]; new object $lag_watcher: $utilities; var $root manager = $lag_watcher; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'variables, 'core]; var $lag_watcher lags = [3]; var $lag_watcher last_time = 851214765; var $root owned = [$lag_watcher]; var $root managed = [$lag_watcher]; public method .startup() { // Called by $sys.startup() (> .perms(sender(), 'manager) <); lags = []; last_time = time(); $heart.add_heartbeat(14); }; protected method .update() { arg lag; // Called by .pulse() every 15 minutes if (type(lags) != 'list) lags = []; while ((lags.length()) > 9) lags = lags.delete(1); lag = (lag > 15) ? lag - 15 : 0; lags += [lag]; }; public method .lag_str() { return ("Current server lag is " + (.lag())) + " seconds."; }; public method .lag() { var lag, total, weight, lag_i, lag_d; // the current lag floated total = 0; weight = 0; for lag in (lags) { ++weight; total += lag * weight; } lag_i = total / 55; lag_d = tostr(((total - (lag_i * 55)) * 10) / 55).subrange(1, 1); return (tostr(lag_i) + ".") + lag_d; }; public method .verbose_lag_str() { // returns lag as a string with verbosity return [("Current server lag is " + (.lag())) + " seconds.", toliteral(lags)]; }; public method .value() { var lag, total, weight, lag_i; // unparsed lag value total = 0; weight = 0; for lag in (lags) { ++weight; total += lag * weight; } lag_i = total / 55; return lag_i; }; public method .pulse() { var lag; // Called by $heart every 15 seconds (> .perms(sender(), $heart) <); lag = time() - last_time; last_time = time(); .update(lag); }; public method .shutdown() { // Called by $sys.startup() (> .perms(sender(), 'manager) <); $heart.del_heartbeat(); }; new object $motd: $utilities; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'variables, 'core]; var $motd server_name = "the Cold Dark"; var $motd notes = []; var $motd server_title = "Virtual Environment Server"; var $motd connect_help = ["Connection HELP", "===============", "", "Connecting as a guest: 'connect-guest <name> <email>'", " Example: 'connect-guest John Doe johnd@site.usa.com'", "", "Connecting as a user: 'connect <name> <password>'", " Example: 'connect John Doe mypassword'", "", "Quitting (this screen): '@quit' or 'quit'", "", "Connected User's Listing: '@who' or 'who'"]; var $motd server_url = "http://none:1180/"; var $root manager = $motd; var $root managed = [$motd]; var $root owned = [$motd]; public method .build() { arg [args]; var output, out; output = []; if (!args) args = ['long, 'quote]; if ((args[1]) == 'default) args = ['name, "", 'title, "", "", 'quote, "", 'notes, "", 'admins, 'connected, 'core_version, 'driver_version]; while (args) { if (type(args[1]) == 'string) { output += [""]; } else { switch (args[1]) { case 'long: args = ['title, 'long_name] + sublist(args, 2); continue; case 'short: args = ['title, 'name] + sublist(args, 2); continue; case 'title: output += [server_title.center(79)]; case 'name: output += [(("+ " + server_name) + " +").center(79)]; case 'notes: output += notes.center_lines(79); case 'quote: output += ($code_lib.random_quote()).center_lines(79); case 'admins: out = $list.to_english($list.mmap($sys.admins(), 'name)); out = ("Administrators: " + out).center(79); output += [out]; case 'connected: out = "Currently Connected users: "; out += tostr(($user_db.connected()).length()); out = out.center(79); output += [out]; case 'version: args = ['driver_version, 'core_version] + sublist(args, 2); continue; case 'driver_version: out = "Driver: " + ($sys.server_info('driver_version, 'long)); output += [out.center(79)]; case 'core_version: out = "Core: " + ($sys.server_info('core_version, 'long)); output += [out.center(79)]; } } args = delete(args, 1); } return output; }; public method .set_motd() { arg what, value; (> .perms(sender()) <); if (!(what in (.variables()))) throw(~motd, (toliteral(what) + " is not a valid motd variable, try one of: ") + toliteral(.variables())); if (!(type(value) in ['string, 'list])) throw(~motd, "Value must be sent as a string or a list of strings."); set_var(what, value); }; public method .build_html() { arg [args]; return [("<head><title>" + server_name) + "</title></head>", "<body bgcolor=\"#000000\" text=\"#ffefef\" link=\"#b000f0\" vlink=\"#9000c0\" alink=\"#f000f0\">", "<p align=center><img src=\"http://www.cold.org/images/tCD.gif\" alt=\"The Cold Dark\"></p>", ("<h3 align=center>" + server_title) + "</h3>", "<p align=center><tt>", @$code_lib.random_quote(), "</tt></p>", "<p align=center>", @notes, "</p>", ("<p align=center>Administrators: " + ((($sys.admins()).mmap('hname)).to_english())) + "<br>", ("<a href=\"/bin/who\">Currently Connected users</a>: " + tostr($user_db.total_connected())) + "<br>", ("Server Lag: " + ($lag_watcher.lag())) + " seconds.<br>", "Driver: <b><a href=\"http://www.cold.org/Software/Genesis/\">Genesis</a></b> " + ($sys.server_info('driver_version)), ("<br>Core: <b>" + ($sys.server_info('core_version, 'long))) + "</b>", ("<p align=center><a href=\"http://" + ($sys.server_info('server_hostname))) + "/login/\"><b><i>Enter the Cold Dark</i></b></a>", "<p align=center>The Cold Dark is a Virtual Environment System. There is no game in the Cold Dark, the purpose is to create a core which expands the physicality of a Virtual Environment. To further explore the database, follow the <a href=\"/start.html\">Database Starting Points</a> link.</p>", "<hr>", "<p align=center>", "<a href=\"/history.html\"><b>History</b></a> |", "<a href=\"/features.html\"><b>Features</b></a> |", "<a href=\"http://www.cold.org/Intro/\"><b>Introduction</b></a> |", "<a href=\"/start.html\"><b>DB Starting Points</b></a>", "</p>"]; }; public method .server_name() { return server_name; }; public method .server_title() { return server_title; }; public method .connect_help() { return connect_help; }; public method .set_connect_help() { arg text; (> .perms(sender(), 'manager) <); connect_help = text; }; public method .server_url() { return ("http://" + ($network.hostname())) + ":1180/"; }; public method .core_motd() { server_url = "http://none:1180/"; }; new object $heart: $utilities; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'variables, 'core]; var $heart heart_failures = []; var $heart hearts = [[$lag_watcher, 851214779], [$user_db, 851214807]]; var $root manager = $heart; var $root managed = [$heart]; var $root owned = [$heart]; var $heart info = #[[$user_db, [60, 851214747]], [$lag_watcher, [14, 851214765]]]; public method .pulse() { var heart, h, x, new; for heart in (hearts) { if ((heart[2]) > time()) break; if (!valid(heart[1])) ._del_heartbeat(heart[1]); catch any (> (heart[1]).pulse() <); with (| ((heart[1]).manager()).tell_traceback(traceback()) |); ._add_heartbeat(heart[1], (info[heart[1]])[1]); } }; public method .add_heartbeat() { arg [delay]; [(delay ?= 60)] = delay; ._add_heartbeat(sender(), delay); }; public method .del_heartbeat() { if (!(._del_heartbeat(sender()))) throw(~objnf, ("Sender (" + sender()) + ") does not have a heartbeat."); }; public method .hearts() { return hearts; }; private method ._add_heartbeat() { arg obj, delay; var when, h, values; // Only one heartbeat per object ._del_heartbeat(obj); when = delay + time(); info = dict_add(info, obj, [delay, time()]); for h in [1 .. listlen(hearts)] { if (((hearts[h])[2]) >= when) { hearts = insert(hearts, h, [obj, when]); return; } } hearts += [[obj, when]]; }; private method ._del_heartbeat() { arg obj; var x, pos; if (info.contains(obj)) info = info.del(obj); for x in [1 .. listlen(hearts)] { if (((hearts[x])[1]) == obj) { hearts = delete(hearts, x); return 1; } } return 0; }; new object $scheduler: $utilities; var $root created_on = 810294797; var $root inited = 1; var $root flags = ['methods, 'code, 'variables, 'core]; var $scheduler task_index = 1; var $scheduler blocked_tasks = #[]; var $scheduler task_queue = []; var $scheduler sub_schedulers = [$heart]; var $scheduler expected_lag = 0; var $scheduler server_lag = 0; var $root manager = $scheduler; var $scheduler suspended_tasks = #[]; var $root managed = [$scheduler]; var $root owned = [$scheduler]; public method .sleep() { arg howlong; .add_task(howlong, 'resume_job, task_id()); .suspend(this()); }; private method .remove_first_task() { // sender must be an agent, or admin. catch any { .del_from_task_queue(1); } with { // $sys.log(traceback()); } if (!task_queue) task_index = 1; }; public method .task_queue() { // sender must be system, for now (> .perms(sender(), 'system) <); return task_queue; }; public method .del_task() { arg tid; var task, n; // sender must be system, for now. if (type(tid) != 'integer) throw(~type, "Task Identification must be an integer"); for task in (task_queue) { n++; if ((task[1]) == tid) { ((sender() == (task[4])) && (caller() == (task[5]))) || (> .perms(sender(), 'system) <); task_queue = task_queue.delete(n); return 1; } } throw(~tasknf, "No task found by that TID"); }; public method .add_task() { arg time, method, [args]; var task, i, j, tid, flags, x, y, task_time; if ((type(time) != 'integer) || ((type(method) != 'symbol) || (type(args) != 'list))) throw(~type, "Arguments are not an integer, symbol, and list."); if (time < 0) throw(~time, "Time is negative."); if (time > 31536000) throw(~time, "Try to schedule a task LESS than a year from now?"); // get a new db task id ++task_index; tid = task_index; // flags can be set in a system only add_task, for now set them as 'system flags = ['system]; task_time = time(); task = [tid, time + task_time, task_time, sender(), caller(), method, flags, args]; .add_to_task_queue(task); return tid; }; public method .pulse() { var task, sub, t; // called by $sys.heartbeat if (caller() != $sys) throw(~perm, "Sender is not system"); t = time(); while (task_queue && (t > ((task_queue[1])[2]))) { task = task_queue[1]; catch any (> (task[5]).as_this_run(task[5], task[6], task[8]) <); with (| ((task[5]).manager()).tell_traceback(traceback()) |); .remove_first_task(); } // call sub schedulers for sub in (sub_schedulers) (| sub.pulse() |); }; public method .sys_add_task() { arg time, method, sender, caller, flags, [args]; var task, i, j, tid, x, y, tmpq, task_time; // use `@info $scheduler' for more information. // [tid, time, time(), sender(), caller(), method, flags, args] // if (!($sys.is_agent(sender()))) throw(~perm, "Sender is not an agent or admin, use .add_task()"); if ((type(time) != 'integer) || ((type(method) != 'symbol) || (type(args) != 'list))) throw(~type, "Arguments are not an integer, symbol, and list."); if (time < 1) throw(~time, "Time is negative."); if (time > 31536000) throw(~time, "Try to schedule a task LESS than a year from now?"); if (!valid(sender)) throw(~type, "The argument for sender is not a valid object"); if (!valid(caller)) throw(~type, "The argument for caller is not a valid object"); if (type(flags) != 'list) throw(~type, "Send flags as a list of symbols"); // ++task_index; tid = task_index; task_time = time(); // flags can be set in a system only add_task, for now set them as 'system task = [tid, task_time + time, task_time, sender, caller, method, flags, args]; .add_to_task_queue(task); return tid; }; public method .add_sub_scheduler() { arg object; if (!($sys.is_admin(sender()))) throw(~perm, "Only admins may add sub schedulers."); if (type(object) != 'objnum) throw(~type, "Object must be a dbref."); sub_schedulers += [object]; }; public method .del_sub_scheduler() { arg object; var pos, s; if (!($sys.is_admin(sender()))) throw(~perm, "Only admins may delete sub schedulers."); if (type(object) != 'objnum) throw(~type, "Object must be a dbref."); pos = object in sub_schedulers; if (!pos) throw(~objnf, "Object not a sub scheduler."); s = []; if (pos > 1) s += [sub_schedulers.subrange(1, pos - 1)]; if (s < (sub_schedulers.length())) s += [sub_schedulers.subrange(pos + 1)]; sub_schedulers = s; }; public method .has_blocked_tasks() { arg ident; return blocked_tasks.contains(ident); }; public method .block_task() { arg ident; var tasks; // I want to be atomic! // Add the task_id to the queue of blocked tasks for this identifier. if (blocked_tasks.contains(ident)) tasks = (blocked_tasks[ident]) + [task_id()]; else tasks = [task_id()]; blocked_tasks = blocked_tasks.add(ident, tasks); // And go to sleep until we are woken. $sys.suspend(); }; public method .unblock_task() { arg ident; var tasks; // I want to be atomic! // The caller should have checked first, but we will fail silently. if (!(.has_blocked_tasks(ident))) return; // Get the blocked tasks queue for this identifier. tasks = blocked_tasks[ident]; // If this is the last blocked task, then clear the queue, otherwise // just delete the task_id that we are resuming. if ((tasks.length()) == 1) blocked_tasks = blocked_tasks.del(ident); else blocked_tasks = blocked_tasks.add(ident, tasks.delete(1)); // Wake it up and go. $sys.resume(tasks[1]); }; protected method .resume_job() { arg tid; (> .resume(tid) <); }; public method .suspend() { arg [objs]; objs += [user()]; suspended_tasks = dict_add(suspended_tasks, task_id(), objs); return (> suspend() <); }; public method .resume() { arg task_id, [return_value]; var objs; if ((objs = (| suspended_tasks[task_id] |))) { if ((!(sender() in objs)) && (!($sys.is_system(sender())))) throw(~perm, (sender() + " may not resume task ") + task_id); suspended_tasks = dict_del(suspended_tasks, task_id); } return (> resume(task_id, @return_value) <); }; public method .cancel() { arg task_id; var objs; if ((objs = (| suspended_tasks[task_id] |))) { if ((!(sender() in objs)) && (!($sys.is_system(sender())))) throw(~perm, (sender() + " may not cancel task ") + task_id); suspended_tasks = dict_del(suspended_tasks, task_id); } return (> cancel(task_id) <); }; public method .task_info() { arg [args]; (> .perms(sender(), 'system) <); return (> task_info(@args) <); }; public method .suspended_task() { arg task; return (> suspended_tasks[task] <); }; private method .del_from_task_queue() { arg i; var j, len, min; // this must *not* throw refresh(); len = listlen(task_queue); while (i != len) { min = len; j = i * 2; if ((j < len) && (((task_queue[j])[2]) < ((task_queue[min])[2]))) min = j; j++; if ((j < len) && (((task_queue[j])[2]) < ((task_queue[min])[2]))) min = j; task_queue = replace(task_queue, i, task_queue[min]); i = min; } task_queue = task_queue.subrange(1, len - 1); }; private method .add_to_task_queue() { arg task; var i, j; task_queue += [0]; i = listlen(task_queue); if (!i) { task_queue = [task]; return; } // We mustn't run out of tics here... refresh(); while ((i > 1) && ((task[2]) < ((task_queue[(j = i / 2)])[2]))) task_queue = replace(task_queue, i, task_queue[(i = j)]); task_queue = task_queue.replace(i, task); }; new object $file: $utilities; var $root manager = $file; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 843324817; var $root inited = 1; var $root managed = [$file]; var $root owned = [$file]; public method .fstat() { arg [path]; if (!path) throw(~perm, "Perm."); return (> fstat(@path) <); }; public method .files() { arg path; return (> files(path) <); }; new object $compiler: $utilities; var $root manager = $compiler; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 837583518; var $root inited = 1; var $root managed = [$compiler]; var $root owned = [$compiler]; public method .parse_string_new() { arg vars, tokens; var mode, out, word, token, i, tmp, ret; if (!tokens) return [[], vars]; mode = ['spaces, 'plain]; i = 1; out = []; word = ""; while (i <= (tokens.length())) { refresh(); token = tokens[i++]; switch (mode[1]) { case 'spaces: if (token != " ") { i--; mode = mode.subrange(2); } case 'plain: if (!(token in ["{", "["])) { word += token.sed("\\\(.)", "%1", "g"); } else { if (word) out += [word]; word = ""; mode = ['spaces, (token == "{") ? 'fmtname : 'genname, @mode]; } case 'fmtname, 'genname: if (((mode[1]) == 'fmtname) && (token == "quote")) { mode = mode.subrange(2); out += [$format.new_tag("quote", [], [tokens[i++]])]; i++; } else { mode = ['spaces, 'flags, #[], token, @mode]; } case 'flags: if (token in ["}", "]"]) { ret = ._make_tag(token, mode[4], vars, mode[3], mode[2], []); vars = ret[2]; out += [ret[1]]; mode = mode.subrange(5); } else if (token == "=") { throw(~parse, "Value flag with no key."); } else if (token == ":") { mode = ['spaces, 'args, out, mode[2], @mode.subrange(3)]; out = []; } else if ((| (tokens[i]) == "=" |)) { mode = ['flagvalue, token, @mode]; i++; } else { mode = mode.replace(2, (mode[2]).add(token, 1)); } case 'flagvalue: if (token in ["}", "]", ":"]) { mode = mode.subrange(3); i--; } else if (token == " ") { mode = mode.subrange(3); } else if (!(token in ["[", "{"])) { mode = ['spaces, @(mode.subrange(3)).replace(2, (mode[4]).add(mode[2], token))]; } else { if (word) out += [word]; word = ""; mode = ['spaces, (token == "{") ? 'fmtname : 'genname, 'flagset, @mode.subrange(2)]; } case 'flagset: i--; mode = ['spaces, @(mode.subrange(3)).replace(2, (mode[4]).add(mode[2], out[out.length()]))]; out = out.subrange(1, (out.length()) - 1); case 'args: if (token in ["}", "]"]) { if (word) { out += [word]; word = ""; } ret = ._make_tag(token, mode[5], vars, mode[4], mode[3], out); vars = ret[2]; out = (mode[2]) + [ret[1]]; mode = mode.subrange(6); } else if (token in ["{", "["]) { if (word) out += [word]; word = ""; mode = ['spaces, (token == "{") ? 'fmtname : 'genname, @mode]; } else { word += token.sed("\\\(.)", "%1", "g"); } } } if (word) out += [word]; if (mode != ['plain]) throw(~parse, "Unclosed tag."); return [out, vars]; }; public method .tokenize() { arg text; var word, out, escaped, token, i, pre_count, open_form, str; // break text into a list of tokens. if (type(text) == 'string) text = [text]; out = []; word = ""; escaped = 0; // pre_count is 0, except inside pre, when it counts the {}'s pre_count = 0; open_form = 0; for str in (text) { str = str.explode(" ", 1); for token in (str) { refresh(); if ((!token) && (!pre_count)) continue; while ((i = token.match_regexp("[][{}=\:]"))) { i = (i[1])[1]; if (escaped) { escaped = 0; word = (word + "\\") + (token.subrange(1, i)); } else if (pre_count) { if ((token[i]) == "{") { pre_count++; word += token.subrange(1, i); } else if ((token[i]) == "}") { pre_count--; if (pre_count) { word += token.subrange(1, i); } else { word += token.subrange(1, i - 1); out = word ? out + [word, token[i]] : (out + [token[i]]); word = ""; } } else { word += token.subrange(1, i); } } else { word += token.subrange(1, i - 1); open_form = (token[i]) == "{"; if ((token[i]) == "\\") { escaped = 1; } else { out = word ? out + [word, token[i]] : (out + [token[i]]); word = ""; } } token = token.subrange(i + 1); } if (open_form && (token == "quote")) { pre_count = 1; open_form = 0; out += [token]; token = ""; continue; } word += token; if (escaped || pre_count) { escaped = 0; word += " "; } else { out = word ? out + [word, " "] : (out + [" "]); word = ""; } } if (pre_count) word = word ? (word.subrange(1, (word.length()) - 1)) + "\n" : "\n"; } if (word) out += [word]; if (out) { if ((out.last()) == " ") out = out.subrange(1, (out.length()) - 1); else out = out.replace(out.length(), (out.last()).subrange(((out.last()).length()) - 1)); } return out; }; public method ._make_tag() { arg token, mode, vars, name, flags, args; var method, class; if (mode == 'fmtname) { if (token != "}") throw(~parse, "Extra ']' encountered."); method = tosym("do_" + (name.strip())); class = $format; } if (mode == 'genname) { if (token != "]") throw(~parse, "Extra '}' encountered."); method = tosym("gen_" + (name.strip())); class = $generator; } catch ~methodnf return .(method)(vars, flags, args); with return [class.new_tag(name, flags, args), vars]; }; public method .compile_cml() { arg text; var vars, ret; vars = #[['this, sender()]]; (> (ret = .parse_string_new(vars, .tokenize(text))) <); return $ctext_frob.new_with(ret[1], ret[2]); }; public method .do_link() { arg vars, flags, args; var links, item, node; if (listlen(args) == 0) throw(~parse, "{link} requires an argument of the link name."); links = (| vars['links] |) || #[]; for item in (flags) { if ((type(item) == 'list) && ((item[1]) == "node")) { node = item[2]; break; } } if (!node) throw(~parse, "No node for {link}."); if (((args.length()) != 1) || (type(args[1]) != 'string)) throw(~parse, "{link} argument must be a string"); links = links.add(args[1], node); return [$format.new_tag("link", flags, args), vars.add('links, links)]; }; public method .do_detail() { arg vars, flags, args; var dets, item, name; dets = (| vars['details] |) || #[]; for item in (flags) { if ((type(item) == 'list) && ((item[1]) == "name")) { name = item[2]; break; } } if (!name) throw(~parse, "No name for {detail}."); dets = dets.add(name, args); return [$format.new_tag("detail", flags, []), vars.add('details, dets)]; }; public method ._kill_spaces() { arg list; var i; return filter i in (list) where (i != " "); }; public method .do_table() { arg vars, flags, args; return [$format.new_tag("table", flags, ._kill_spaces(args)), vars]; }; public method .do_tr() { arg vars, flags, args; return [$format.new_tag("tr", flags, ._kill_spaces(args)), vars]; }; public method .do_ul() { arg vars, flags, args; return [$format.new_tag("ul", flags, ._kill_spaces(args)), vars]; }; public method .do_dl() { arg vars, flags, args; return [$format.new_tag("dl", flags, ._kill_spaces(args)), vars]; }; new object $evaluator: $utilities; var $root manager = $evaluator; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 837583637; var $root child_index = 3; var $root inited = 1; var $root managed = [$evaluator]; var $root owned = [$evaluator]; public method .eval_formatter() { arg form, vars; var flags, text, key; form = form.eval_flags(vars); catch ~methodnf { return .(form[4])(vars, form[2], form[3]); } with { [text, vars] = ._eval_ctext(form[3], vars); form = (<$format, [form[1], form[2], text, form[4]]>); return [[form], vars]; } }; public method ._eval_ctext() { arg data, vars; var out, uflags, token; out = []; if (type(data) != 'list) data = [data]; for token in (data) { if (type(token) == 'frob) { switch (class(token)) { case $generator: [token, vars] = .eval_generator(token, vars); out += token; case $format: [token, vars] = .eval_formatter(token, vars); out += token; default: out += [token]; } } else { out += [token]; } } return [out, vars]; }; public method .eval_generator() { arg gen, vars; var flags, key, value, name; gen = gen.eval_flags(vars); catch ~methodnf { return .(gen[4])(vars, gen[2], gen[3]); } with { catch ~keynf return [[vars[gen[1]]], vars]; with return [[(">>ERROR: Unknown generator [" + (gen[1])) + "].<<"], vars]; } }; public method .init() { return #[]; }; new object $bs_eval: $evaluator; var $root manager = $bs_eval; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 837583704; var $root inited = 1; var $root child_index = 3; var $root managed = [$bs_eval]; var $root owned = [$bs_eval]; public method .gen_servername() { arg vars, flags, args; return [[$motd.server_name()], vars]; }; public method .gen_set() { arg vars, flags, args; var text, name; name = flags.getkey("var"); [text, vars] = ._eval_ctext(args[1], vars); return [[""], vars.add(name, text[1])]; }; public method .gen_name() { arg vars, flags, args; var out, name, sep, type; [args, vars] = ._eval_ctext(args, vars); out = []; type = (| tosym(flags.getkey("type")) |) || 'name; if (!args) return [[(vars['this]).namef(type)], vars]; sep = (| flags.getkey("separator") |) || " "; for name in (args) { switch (type(name)) { case 'objnum: name = name.namef(type); case 'string: catch ~objnf name = ((vars['this]).match_environment(name)).namef(type); with name = name; } out += [name]; } return [._separate_list(sep, out), vars]; }; public method ._separate_list() { arg sep, l; if (sep == "none") return l; if (sep == "english") return [l.to_english()]; return [l.join(sep)]; }; public method .gen_english() { arg vars, flags, args; var sep, empty, and; sep = ((| flags.getkey("separator") |) || ",") + " "; empty = (| flags.getkey("empty") |) || "nothing"; and = (| flags.getkey("and") |) || " and "; [text, vars] = ._eval_ctext(args, vars); return [[text.to_english(empty, and, sep)], vars]; }; public method .gen_def() { arg vars, flags, args; var name; name = flags.getkey("var"); val = args[1]; return [[""], vars.add(name, val)]; }; public method .gen_foreach() { arg vars, flags, args; var v, list, body, out, item, sep, text; v = (| flags.getkey("var") |) || "iterator"; list = flags.getkey("list"); sep = (| flags.getkey("separator") |) || " "; out = []; for item in (list) { vars = vars.add(v, item); [text, vars] = ._eval_ctext(args, vars); if ((vars['time]) == 'post) out = out.affix(text); else out += [text]; } if ((vars['time]) == 'pre) out = ._separate_list(sep, out); return [out, vars]; }; public method .gen_time() { arg vars, flags, args; var a, word; [args, vars] = ._eval_ctext(args, vars); if (!args) return [tostr(time()), vars]; return [[$time.format(args[1])], vars]; }; public method .gen_vars() { arg vars, flags, args; var out, v, sep; out = []; sep = (| flags.getkey("separator") |) || " "; for v in (vars.keys()) { if (type(v) == 'string) out += [v]; } return [._separate_list(sep, out), vars]; }; public method .gen_pro() { arg vars, flags, args; var out, type, obj, key, objstr; if ((| (objstr = flags.getkey("obj")) |)) { while (type(objstr) == 'list) objstr = objstr[1]; if (type(objstr) == 'string) { catch ~objnf, ~namenf obj = (vars['this]).match_environment(objstr); with return [[(">>ERROR: Invalid object '" + objstr) + "'.<<"], vars]; } else { obj = objstr; } } else { obj = vars['this]; } out = []; if ((args.length()) == 0) return [[">>ERROR: Must specify pronoun type.<<"], vars]; type = (args[1]).to_symbol(); catch ~keynf out = (> [(obj.gender()).pronoun(type)] <); with return [[(">>ERROR: Invalid pronoun type '" + (args[1])) + "'.<<"], vars]; return [out, vars]; }; public method .gen_join() { arg vars, flags, args; var v, sep; sep = (| flags.getkey("separator") |) || " "; [args, vars] = ._eval_ctext(args, vars); return [._separate_list(sep, args), vars]; }; public method .gen_columnize() { arg vars, flags, args; var v, cols; cols = (| flags.getkey("cols") |) || "*"; [args, vars] = ._eval_ctext(args, vars); return [[(cols == "*") ? args.lcolumnize() : (args.columnize(toint(cols)))], vars]; }; public method .gen_serverurl() { arg vars, flags, args; return [[$motd.server_url()], vars]; }; public method .gen_server_name() { arg vars, flags, args; return [[$motd.server_name()], vars]; }; public method .gen_switch() { arg vars, flags, args; var v, check, eval; v = flags.getkey("value"); if (type(v) == 'list) v = v.join(""); len = args.length(); i = 1; while (i < len) { if ((args[i]) == v) return ._eval_ctext(args[i + 1], vars); i += 2; } if (i == len) return ._eval_ctext(args[i], vars); else return [((vars['time]) == 'pre) ? [""] : "", vars]; }; new object $place_desc_evaluator: $bs_eval; var $root manager = $place_desc_evaluator; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 845665471; var $root inited = 1; var $root managed = [$place_desc_evaluator]; var $root owned = [$place_desc_evaluator]; new object $realm_base_eval: $bs_eval; var $root manager = $realm_base_eval; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 847528368; var $root inited = 1; var $root managed = [$realm_base_eval]; public method .gen_daytime() { arg vars, flags, args; var v, i, len, n; v = vars['daytime]; len = args.length(); i = 1; while (i < len) { if ((| tosym(args[i]) |) in v) return ._eval_ctext(args[i + 1], vars); if ((n = ("-" in (args[i])) && (| ((v[1]) >= toint(args.subrange(1, n - 1))) && ((v[1]) <= toint(args.subrange(n + 1))) |))) return ._eval_ctext(args[i + 1], vars); i += 2; } if (i == len) return ._eval_ctext(args[i], vars); else return [((vars['time]) == 'pre) ? [""] : "", vars]; }; new object $formatter: $evaluator; var $root manager = $formatter; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 837583776; var $root child_index = 2; var $root inited = 1; var $root managed = [$formatter]; var $root owned = [$formatter]; public method .eval_generator() { arg gen, vars; return (vars['evaluator]).eval_generator(gen, vars); }; public method ._eval_ctext() { arg data, vars; var out, uflags, token; out = ""; if (type(data) != 'list) data = [data]; for token in (data) { refresh(); switch (type(token)) { case 'frob: switch (class(token)) { case $generator: [token, vars] = ((| vars['evaluator] |) || $bs_eval).eval_generator(token, vars); if (type(token) == 'string) { out += token; } else { [token, vars] = ._eval_ctext(token, vars); out += token; } case $format: [token, vars] = .eval_formatter(token, vars); out += token; } case 'string: out += token; case 'list: [token, vars] = ._eval_ctext(token, vars); out += token; default: out += token; } } return [out, vars]; }; public method .eval_formatter() { arg form, vars; var flags, key, text; form = form.eval_flags(vars); catch ~methodnf { return .(form[4])(vars, form[2], form[3]); } with { [text, vars] = ._eval_ctext(form[3], vars); if ((vars['time]) == 'post) return [text, vars]; form = (<$format, [form[1], form[2], text, form[4]]>); return [[form], vars]; } }; new object $text_format: $formatter; var $root manager = $text_format; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 837583858; var $root inited = 1; var $root managed = [$text_format]; var $root owned = [$text_format]; var $root child_index = 1; public method .init() { return #[['header, ""], ['width, 78]]; }; public method .do_ul() { arg vars, flags, args; var out, token; [args, vars] = ._eval_ctext(args, vars); return ["\n\n" + args, vars]; }; public method .do_strong() { arg vars, flags, args; var out, a; return ._eval_ctext(args, vars); }; public method .do_dl() { arg vars, flags, args; var out, token, c, cm; c = (| vars['columned] |) || 0; cm = (| flags.getkey("columned") |) || 0; vars = vars.add('columned, cm); [args, vars] = ._eval_ctext(args, vars); if (c) vars = vars.add('columned, c); else if (vars.contains('columned)) vars = vars.del('columned); return [args + "\n", vars]; }; public method .do_anchor() { arg vars, flags, args; [args, vars] = ._eval_ctext(args[1], vars); return [("/" + args) + "/", vars]; }; public method .do_p() { arg vars, args, flags; return ["\n", vars]; }; public method .do_em() { arg vars, flags, args; var out, a; return ._eval_ctext(args, vars); }; public method .do_br() { arg vars, args, flags; return ["\n", vars]; }; public method .do_link() { arg vars, flags, args; [args, vars] = ._eval_ctext(args[1], vars); return [("[" + args) + "]", vars]; }; public method .do_web() { arg vars, flags, args; [args, vars] = ._eval_ctext(args, vars); return [((((args + "<") + (flags.getkey("name"))) + ":") + (flags.getkey("src"))) + ">", vars]; }; public method .do_hr() { arg vars, flags, args; return [pad("\n", vars['width], "-") + "\n", vars]; }; public method .do_tt() { arg vars, flags, args; var out, a; [args, vars] = ._eval_ctext(args, vars); return [("`" + args) + "`", vars]; }; public method .do_action() { arg vars, flags, args; [args, vars] = ._eval_ctext(args[1], vars); (| (vars['receiver]).register_action(flags.getkey("command"), vars['this]) |); return [("\\" + args) + "\\", vars]; }; public method .do_subj() { arg vars, flags, args; var out, word, l, len; [out, vars] = ._eval_ctext(args, vars); len = vars['width]; switch (toint((| flags.getkey("level") |) || "4")) { case 1: out = strfmt("\n\n%*{-}c\n", len, (" " + out) + " "); case 2: out = ((("\n\n" + out) + "\n") + ("".pad(strlen(out), "="))) + "\n"; case 3: out = ((("\n\n" + out) + "\n") + ("".pad(strlen(out), "-"))) + "\n"; default: out = ("\n" + out) + "\n"; } return [out, vars]; }; public method .do_dd() { arg vars, flags, args; return .eval_indented(args, vars, 4); }; public method .do_b() { arg vars, flags, args; var out, a; return ._eval_ctext(args, vars); }; public method .do_i() { arg vars, flags, args; var out, a; return ._eval_ctext(args, vars); }; public method .do_dt() { arg vars, flags, args; vars = vars.add('header, ""); [args, vars] = ._eval_ctext(args, vars); if ((| vars['columned] |)) return ["\n ", vars.add('header, pad(" " + args, 25))]; else return [("\n " + args) + "\n", vars.add('header, "")]; }; public method .do_li() { arg vars, flags, args; var line; vars = vars.add('header, "* "); [args, vars] = .eval_indented(args, vars, 2); return [args + "\n", vars]; }; public method .do_lh() { arg vars, flags, args; var line; vars = vars.add('header, ""); [args, vars] = .eval_indented(args, vars, 2); return [args + "\n", vars]; }; public method .do_quote() { arg vars, flags, args; return [args[1], vars]; }; public method .do_table() { arg vars, flags, args; var tblinfo, i, ntbinfo, info, width, l, lr, lc, inds, ind, cwidth; tblinfo = (| vars['table_info] |) || 0; width = vars['width]; if (!(| (ntbinfo = flags.getkey("cols")) |)) throw(~flags, "Need column information."); ind = (| abs(toint(flags.getkey("ind"))) |) || 0; info = []; cwidth = width - ind; if ("%" in ntbinfo) { for i in (ntbinfo.explode(",")) info += [toint(cwidth * (toint(i) / 100.0))]; } else { for i in (ntbinfo.explode(",")) info += [toint(i)]; } vars = #[['table_info, [info, 0]], ['rinfo, $list.make(info.length(), 0)], ['rcont, $list.make(info.length(), [])]].union(vars); [args, vars] = ._eval_ctext(args, vars); vars = tblinfo ? vars.add('table_info, tblinfo) : (vars.del('table_info)); vars = vars.add('width, width); return ["\n" + args, vars]; }; public method .do_tr() { arg vars, flags, args; var tblinfo, rinfo, i, l, len, s, j, col, rcont, done; tblinfo = vars['table_info]; tblinfo = tblinfo.replace(2, 0); rinfo = vars['rinfo]; rcont = vars['rcont]; vars = vars.add('table_info, tblinfo); l = []; col = 1; for i in (args) { if ((type(i) != 'frob) || ((i.method()) != 'do_td)) throw(~table, "Only {td} tags permitted in rows"); [i, vars] = .do_td(vars, i.ctext_flags(), i.args()); l += i; for j in (i) { rcont = rcont.replace(col, (rcont[col]) + (j[3])); col++; } } l += $list.make((rcont.length()) - (l.length()), [0, 0, []]); s = ""; i = 1; done = 0; rinfo = map j in [1 .. rinfo.length()] to (((rinfo[j]) - 1) + ((l[j])[1])); while (!done) { done = 1; for j in [1 .. rcont.length()] { s += ((| (rcont[j])[i] |) || "").pad((l[j])[2]); done = done && ((rinfo[j]) || (i >= listlen(rcont[j]))); } i++; s += "\n"; } for j in [1 .. rinfo.length()] rcont = rcont.replace(j, (| (rcont[j]).subrange(i) |) || []); vars = (vars.add('rinfo, rinfo)).add('rcont, rcont); return [s, vars]; }; public method .do_td() { arg vars, flags, args; var tblinfo, rinfo, col, cols, rows, w, n; rows = (| toint(flags.getkey("rowspan")) |) || 1; cols = (| toint(flags.getkey("colspan")) |) || 1; rinfo = vars['rinfo]; tblinfo = vars['table_info]; col = (tblinfo[2]) + 1; n = []; while (rinfo[col]) { col++; n += [[0, (tblinfo[1])[col], []]]; } w = ((tblinfo[1]).subrange(col, cols)).sum(); tblinfo = tblinfo.replace(2, (col + cols) - 1); vars = (vars.add('table_info, tblinfo)).add('header, ""); [args, vars] = .eval_indented(args, vars, 0, w); return [(n + [[rows, w, args.explode("\n", 1)]]) + ($list.make(cols - 1, [rows, 0, []])), vars]; }; public method .rewrap_lines() { arg vars, str, prefix; var s, p, n; s = []; n = (vars['width]) + (prefix.length()); for str in (str.explode("\n", 1)) s += str.wrap_lines(n, prefix, 1); return s.join("\n"); }; public method .eval_indented() { arg args, vars, i, [w]; var width, indent; width = vars['width]; vars = vars.add('width, (| w[1] |) || (width - i)); [args, vars] = ._eval_ctext(args, vars); return [.rewrap_lines(vars, (vars['header]) + args, pad("", i)), vars.add('width, width)]; }; public method .do_dfn() { arg vars, flags, args; vars = vars.add('header, ""); [args, vars] = .eval_indented(args, vars, 8); return [("\n" + args) + "\n", vars]; }; public method .do_detail() { arg vars, flags, args; return [("[" + (flags.getkey("name"))) + "]", vars]; }; public method .do_img() { arg vars, flags, args; var alt; return ["", vars]; }; public method .format() { arg data, vars; var str, len, line, out; str = (> (._eval_ctext(data, vars))[1] <); if ((strlen(str) < 2) || (substr(str, strlen(str) - 1) != "\n")) str += "\n"; return str_to_buf(str); }; new object $wrapped_text_format: $text_format; var $root manager = $wrapped_text_format; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 848777209; var $root inited = 1; var $root managed = [$wrapped_text_format]; public method .format() { arg data, vars; var str, len, line, out; str = (> (._eval_ctext(data, vars))[1] <); if ((strlen(str) < 2) || (substr(str, strlen(str) - 1) != "\n")) str += "\n"; // ugly and inneficient--use a client people len = (vars['receiver]).linelen(); out = ""; for line in (explode(str, "\n")) out += (line.wrap_line(len, " ")) + "\n"; return str_to_buf(out); }; new object $html_format: $formatter; var $root manager = $html_format; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 837902808; var $root inited = 1; var $root managed = [$html_format]; var $root owned = [$html_format]; public method .do_hr() { arg vars, flags, args; return ["\n<hr>\n", vars]; }; public method .do_ul() { arg vars, flags, args; var out, header, line, token; [args, vars] = ._eval_ctext(args, vars); return [("\n<ul>\n" + args) + "\n</ul>\n", vars]; }; public method .do_strong() { arg vars, flags, args; var out, a; [args, vars] = ._eval_ctext(args, vars); return [("<strong>" + args) + "</strong>", vars]; }; public method .do_dl() { arg vars, flags, args; var out, token, c, cm; c = (| vars['columned] |); cm = (| flags.getkey("columned") |) || 0; vars = vars.add('columned, cm); [args, vars] = ._eval_ctext(args, vars); if (c) vars = vars.add('columned, c); else if (vars.contains('columned)) vars = vars.del('columned); if (cm) return [("\n<blockquote><table cols=2 border=0>\n" + args) + "\n</table></blockquote>\n", vars]; return [("\n<dl>\n" + args) + "\n</dl>\n", vars]; }; public method .do_anchor() { arg vars, flags, args; [args, vars] = ._eval_ctext([args[1]], vars); return [[("/" + (args[1])) + "/"], vars]; }; public method .do_p() { arg vars, args, flags; return ["\n<p>\n", vars]; }; public method .do_em() { arg vars, flags, args; var out, a; [args, vars] = ._eval_ctext(args, vars); return [("<em>" + args) + "</em>", vars]; }; public method .do_br() { arg vars, args, flags; return ["\n<br>", vars]; }; public method .do_link() { arg vars, flags, args; var node; [args, vars] = ._eval_ctext([args[1]], vars); node = (| flags.getkey("node") |); if (node) return [((("<a href=\"/bin/help?node=" + node) + "\">") + args) + "</a>", vars]; return [">>ERROR: Invalid node<<", vars]; }; public method .do_web() { arg vars, flags, args; [args, vars] = ._eval_ctext([args[1]], vars); return [((((args + "<a href=\"") + (flags.getkey("src"))) + "\">") + (flags.getkey("name"))) + "</a>", vars]; }; public method .do_tt() { arg vars, flags, args; var out, a; [args, vars] = ._eval_ctext(args, vars); return [("<tt>" + args) + "</tt>", vars]; }; public method .do_action() { arg vars, flags, args; [args, vars] = ._eval_ctext(args[1], vars); (| (vars['receiver]).register_action(args, vars['this], flags.getkey("token")) |); return [("\\" + args) + "\\", vars]; }; public method .do_subj() { arg vars, flags, args; var out, word, l; [args, vars] = ._eval_ctext(args, vars); switch (toint((| flags.getkey("level") |) || "4")) { case 1: return [("<h2 align=center>" + args) + "</h2><hr>\n", vars]; case 2: return [("<h3>" + args) + "</h3>\n", vars]; case 3: return [("<h4>" + args) + "</h4>\n", vars]; default: return [("<h5>" + args) + "</h5>\n", vars]; } }; public method .do_dd() { arg vars, flags, args; var c; c = (| vars['columned] |); [args, vars] = ._eval_ctext(args, vars); if (c) return [("<td>" + args) + "</td></tr>", vars]; return ["<dd>" + args, vars]; }; public method .do_b() { arg vars, flags, args; var out, a; [args, vars] = ._eval_ctext(args, vars); return [("<b>" + args) + "</b>", vars]; }; public method .do_i() { arg vars, flags, args; var out, a; [args, vars] = ._eval_ctext(args, vars); return [("<i>" + args) + "</i>", vars]; }; public method .do_dt() { arg vars, flags, args; var term, c; c = (| vars['columned] |); [args, vars] = ._eval_ctext(args, vars); if (c) return [("\n<tr><td>" + args) + "</td>", vars]; return ["\n<dt>" + args, vars]; }; public method .do_li() { arg vars, flags, args; [args, vars] = ._eval_ctext(args, vars); return ["\n<li>" + args, vars]; }; public method .do_lh() { arg vars, flags, args; [args, vars] = ._eval_ctext(args, vars); return ["\n<lh>" + args, vars]; }; public method .do_tr() { arg vars, flags, args; vars = vars.add('table_col, 1); [args, vars] = ._eval_ctext(args, vars); return [("\n<tr>" + args) + "</tr>", vars]; }; public method .do_td() { arg vars, flags, args; var f, n, c, width; c = vars['table_col]; vars = vars.add('table_col, c + 1); width = (| (vars['table_cols])[c] |); f = ""; if ((n = (| flags.getkey("rowspan") |))) f += " rowspan=" + n; if ((n = (| flags.getkey("colspan") |))) f += " colspan=" + n; if (width) f += (" width=\"" + width) + "\""; [args, vars] = ._eval_ctext(args, vars); return [((("\n<td valign=top" + f) + ">") + args) + "</tr>", vars]; }; public method .do_table() { arg vars, flags, args; var cols, tcs, tc; tcs = (| vars['table_cols] |); tc = (| vars['table_col] |); if ((cols = (| flags.getkey("cols") |)) && ("%" in cols)) vars = vars.add('table_cols, cols.explode(",")); [args, vars] = ._eval_ctext(args, vars); vars = tcs ? vars.add('table_cols, tcs) : (vars.del('table_cols)); vars = tc ? vars.add('table_col, tc) : (vars.del('table_col)); return [("\n<table border=0>" + args) + "\n</table>\n", vars]; }; public method .do_dfn() { arg vars, flags, args; var out, a; [args, vars] = ._eval_ctext(args, vars); return [("\n<blockquote>" + args) + "</blockquote>", vars]; }; public method .do_quote() { arg vars, flags, args; return [("<pre>" + ((((args[1]).replace("&", "&")).replace("<", "<")).replace(">", ">"))) + "</pre>", vars]; }; public method .do_detail() { arg vars, flags, args; var det; det = flags.getkey("name"); return [((((("<a href=\"/bin/describe?target=" + ((vars['this]).objname())) + "&detail=") + ($http.encode(det))) + "\">") + det) + "</a></b>", vars]; }; public method .do_img() { arg vars, flags, args; var src, html, alt; src = flags.getkey("src"); alt = (| ("alt=\"" + (flags.getkey("alt"))) + "\"" |) || ""; return [((("<img src=\"" + src) + "\" align=left hspace=10 ") + alt) + ">", vars]; }; public method ._eval_ctext() { arg data, vars; var out, uflags, token; out = ""; if (type(data) != 'list) data = [data]; for token in (data) { refresh(); switch (type(token)) { case 'frob: switch (class(token)) { case $generator: [token, vars] = ((| vars['evaluator] |) || $bs_eval).eval_generator(token, vars); if (type(token) == 'string) { out += token; } else { [token, vars] = ._eval_ctext(token, vars); out += token; } case $format: [token, vars] = .eval_formatter(token, vars); out += token; } case 'string: out += token.to_html(); case 'list: [token, vars] = ._eval_ctext(token, vars); out += token; default: out += token; } } return [out, vars]; }; public method .format() { arg data, vars; var str, len, line, out; str = (> (._eval_ctext(data, vars))[1] <); if ((strlen(str) < 2) || (substr(str, strlen(str) - 1) != "\n")) str += "\n"; return str_to_buf(str); // $#Copied 29 Nov 96 18:50 from $text_format.format() by $miro }; new object $uncompiler: $evaluator; var $root manager = $uncompiler; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 837583986; var $root inited = 1; var $root managed = [$uncompiler]; var $root owned = [$uncompiler]; public method .quote() { arg s; return s.sed("([][{}\])", "\%1", "g"); }; public method .eval_generator() { arg gen, vars; var out, flags, key, value, text; catch ~methodnf { return .(gen.method())(vars, gen.ctext_flags(), gen.args()); } with { out = ["[" + (gen.name())]; flags = gen.ctext_flags(); for key in (flags) { if ((key[2]) == 1) { out = out.affix(" " + (key[1])); } else { [text, vars] = (> ._eval_ctext([key[2]], vars, 1) <); out = (out.affix((" " + (key[1])) + "=")).affix(text); } } if (gen.args()) { out = out.affix(":"); for key in (gen.args()) { [text, vars] = (> ._eval_ctext([key], vars) <); out = out.affix(text); } } return [out.affix("]"), vars]; } }; public method ._eval_ctext() { arg data, vars, [quote_all]; var out, uflags, token; out = []; if (type(data) != 'list) data = [data]; for token in (data) { switch (type(token)) { case 'frob: if (class(token) == $generator) { [token, vars] = (> .eval_generator(token, vars) <); out = out.affix(token); } else if (class(token) == $format) { [token, vars] = (> .eval_formatter(token, vars) <); out = out.affix(token); } case 'string: out = out.affix(quote_all ? .quote_all(token) : (.quote(token))); default: out = out.affix(toliteral(token)); } } return [out, vars]; }; public method .eval_formatter() { arg gen, vars; var out, flags, key, value, text; catch ~methodnf { return .(gen.method())(vars, gen.ctext_flags(), gen.args()); } with { out = ["{" + (gen.name())]; flags = gen.ctext_flags(); for key in (flags) { if ((key[2]) == 1) { out = out.affix(" " + (key[1])); } else { [text, vars] = ._eval_ctext(key[2], vars, 1); out = (out.affix((" " + (key[1])) + "=")).affix(text); } } if (gen.args()) { out = out.affix(":"); for key in (gen.args()) { [text, vars] = ._eval_ctext([key], vars); out = out.affix(text); } } out = out.affix("}"); return [out, vars]; } }; public method .quote_all() { arg s; return s.sed("([][{}\:= ])", "\%1", "g"); }; public method .do_quote() { arg vars, flags, args; return [(["{quote "].affix((args[1]).explode("\n", 1))).affix("}"), vars]; }; public method .do_detail() { arg vars, flags, args; return .eval_formatter((<$format, ["detail", flags, (| (vars['details])[flags.getkey("name")] |) || ["UNKNOWN"], 'DO_NOT_CALL_THIS]>), vars); }; public method .do_p() { arg vars, flags, args; return [["", "", "{p}"], vars]; }; public method .do_dl() { arg vars, flags, args; var dl, token; if ((| flags.getkey("columned") |)) dl = "{dl columned:"; else dl = "{dl:"; [args, vars] = ._eval_ctext(args, vars); return [((["", dl].affix(args.prefix(" "))).affix("}")) + [""], vars]; }; public method .do_dt() { arg vars, flags, args; var dl, token; [args, vars] = ._eval_ctext(args, vars); return [(["", "{dt: "].affix(args)).affix("}"), vars]; }; public method .do_dd() { arg vars, flags, args; var token; [args, vars] = ._eval_ctext(args, vars); return [(["", "{dd: "].affix(args)).affix("}"), vars]; }; public method .do_dfn() { arg vars, flags, args; [args, vars] = ._eval_ctext(args, vars); return [(["", "", " {dfn:"].affix(args)).affix(["}"]), vars]; }; public method .do_subj() { arg vars, flags, args; var out, word, l; [args, vars] = ._eval_ctext(args, vars); l = toint((| flags.getkey("level") |) || "4"); return [(["", "", ("{subj level=" + l) + ":"].affix(args)).affix(["}"]), vars]; }; public method .do_ul() { arg vars, flags, args; [args, vars] = ._eval_ctext(args, vars); return [((["", "{ul:"].affix(args.prefix(" "))).affix("}")) + [""], vars]; }; public method .do_li() { arg vars, flags, args; [args, vars] = ._eval_ctext(args, vars); return [(["", "{li:"].affix(args)).affix("}"), vars]; }; new object $housekeeper: $utilities; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'variables, 'core]; var $root manager = $housekeeper; var $root owned = [$housekeeper]; var $root managed = [$housekeeper]; public method .did_disconnect() { var task_queue, task; if (caller() != $user) throw(~perm, "Permission denied"); // because of guests if (valid(sender())) $scheduler.add_task(300, 'move_user_home, sender()); }; public method .move_user_home() { arg who; var home, curloc; if (who.connected()) return; (| who.cleanup_sessions() |); curloc = who.location(); home = who.home(); if (curloc == home) return; (| who.move_to(home) |) || (> who.move_to($body_cave) <); curloc.did_housekeep(who); }; new object $world: $utilities; var $root manager = $world; var $world starting_place = $the_pit; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 850845715; var $root inited = 1; var $root managed = [$world]; public method .starting_place() { return starting_place || $body_cave; }; public method .startup(); new object $antisocial: $user_interfaces, $has_messages; var $root manager = $antisocial; var $has_messages messages = #[[$antisocial, #[["test.actor", <$ctext_frob, [["You test the $antisocial parent."], #[['this, $antisocial]]]>], ["kick.actor", <$ctext_frob, [["You kick ", <$generator, ["who", [], [], 'gen_who]>, " rather firmly in the kiester."], #[['this, $antisocial]]]>], ["kick.who", <$ctext_frob, [[<$generator, ["actor", [], [], 'gen_actor]>, " kicks you rather firmly in the kiester."], #[['this, $antisocial]]]>], ["eye.actor", <$ctext_frob, [["You eye ", <$generator, ["who", [], [], 'gen_who]>, " warily."], #[['this, $antisocial]]]>], ["eye.who", <$ctext_frob, [[<$generator, ["actor", [], [], 'gen_actor]>, " eyes you warily."], #[['this, $antisocial]]]>], ["bonk.actor", <$ctext_frob, [["You bonk ", <$generator, ["who", [], [], 'gen_who]>, "."], #[['this, $antisocial]]]>], ["bonk.who", <$ctext_frob, [[<$generator, ["actor", [], [], 'gen_actor]>, " bonks you."], #[['this, $antisocial]]]>], ["kick.general", <$ctext_frob, [[<$generator, ["actor", [], [], 'gen_actor]>, " kicks ", <$generator, ["who", [], [], 'gen_who]>, " rather firmly in the kiester."], #[['this, $antisocial]]]>], ["eye.general", <$ctext_frob, [[<$generator, ["actor", [], [], 'gen_actor]>, " eyes ", <$generator, ["who", [], [], 'gen_who]>, " warily."], #[['this, $antisocial]]]>], ["ice.general", <$ctext_frob, [[<$generator, ["actor", [], [], 'gen_actor]>, " pours a large bucket of ice water over ", <$generator, ["who", [], [], 'gen_who]>, "."], #[['this, $antisocial]]]>], ["fart.general", <$ctext_frob, [[<$generator, ["actor", [], [], 'gen_actor]>, " farts in ", <$generator, ["who", [], [], 'gen_who]>, "'s general direction."], #[['this, $antisocial]]]>], ["pat.general", <$ctext_frob, [[<$generator, ["actor", [], [], 'gen_actor]>, " pats ", <$generator, ["who", [], [], 'gen_who]>, " onna head."], #[['this, $antisocial]]]>], ["pummel.general", <$ctext_frob, [[<$generator, ["actor", [], [], 'gen_actor]>, " pummels ", <$generator, ["who", [], [], 'gen_who]>, " into a milky pulp."], #[['this, $antisocial]]]>], ["poke.general", <$ctext_frob, [[<$generator, ["actor", [], [], 'gen_actor]>, " pokes ", <$generator, ["who", [], [], 'gen_who]>, ". ", <$generator, ["who", [], [], 'gen_who]>, " emits a sound similar to that of the pillsbury doughboy."], #[['this, $antisocial]]]>], ["prod.general", <$ctext_frob, [[<$generator, ["actor", [], [], 'gen_actor]>, " prods ", <$generator, ["who", [], [], 'gen_who]>, " with a rather large high voltage cattle prod."], #[['this, $antisocial]]]>], ["bonk.general", <$ctext_frob, [[<$generator, ["actor", [], [], 'gen_actor]>, " bonks ", <$generator, ["who", [], [], 'gen_who]>, "."], #[['this, $antisocial]]]>], ["test.general", <$ctext_frob, [[<$generator, ["actor", [], [], 'gen_actor]>, " tests the $antisocial parent."], #[['this, $antisocial]]]>]]]]; var $root flags = ['variables, 'methods, 'code, 'command_cache, 'fertile, 'core]; var $root created_on = 838182893; var $antisocial antisocial_msgs = #[["feh", <$ctext_frob, [[<$generator, ["actor", [], [], 'gen_actor]>, " kicks ", <$generator, ["who", [], [], 'gen_who]>, " rather firmly in the kiester."], #[['this, $antisocial]]]>]]; var $has_commands shortcuts = #[]; var $has_commands remote = #[]; var $has_commands local = #[["test", [["test", "", "test", 'anti_cmd, #[]]]], ["ice", [["ice", "*", "ice <object>", 'anti_cmd, #[[1, ['object, []]]]]]], ["eye", [["eye", "*", "eye <object>", 'anti_cmd, #[[1, ['object, []]]]]]], ["fart", [["fart", "*", "fart <object>", 'anti_cmd, #[[1, ['object, []]]]]]], ["kick", [["kick", "*", "kick <object>", 'anti_cmd, #[[1, ['object, []]]]]]], ["pat", [["pat", "*", "pat <object>", 'anti_cmd, #[[1, ['object, []]]]]]], ["pummel", [["pummel", "*", "pummel <object>", 'anti_cmd, #[[1, ['object, []]]]]]], ["poke", [["poke", "*", "poke <object>", 'anti_cmd, #[[1, ['object, []]]]]]], ["prod", [["prod", "*", "prod <object>", 'anti_cmd, #[[1, ['object, []]]]]]], ["bonk", [["bonk", "*", "bonk <object>", 'anti_cmd, #[[1, ['object, []]]]]]]]; var $root inited = 1; var $has_messages message_info = #[["test", #[]], ["eye", #[]], ["ice", #[]], ["fart", #[]], ["pat", #[]], ["pummel", #[]], ["poke", #[]], ["prod", #[]], ["bonk", #[]], ["kick", #[]]]; var $root managed = [$antisocial]; var $root owned = [$antisocial]; public method .set_antisocial() { arg name, message; var mes, partial, compiler; (> .perms(sender(), 'writer) <); if (!antisocial_msgs) antisocial_msgs = #[]; compiler = $compiler; message = compiler.compile_cml(message); antisocial_msgs = antisocial_msgs.add(name, message); }; public method .antisocial_msgs() { return antisocial_msgs; }; public method .test() { arg [who]; var vars, m, message; if (who) who = .match_environment(who[1]); vars = #[["$actor", this()], ["actor", .name()], ["$who", who], ["who", who.name()]]; message = (definer().antisocial_msgs())["feh"]; m = message.set_vars(vars); .tell(m); .announce(m, this()); }; protected method .anti_cmd() { arg cmdstr, cmd, [who]; var message, vars, victim, m; (> .perms(caller(), $user) <); vars = #[["$actor", this()], ["actor", .name()]]; if (who) vars = (vars.add("$who", who[1])).add("who", (who[1]).name()); (.location()).announce(.eval_message(cmd, vars)); }; new object $social: $has_messages, $user_interfaces; var $root manager = $social; var $has_messages message_info = #[["bow", #[]]]; var $root flags = ['variables, 'methods, 'code, 'command_cache, 'core]; var $root created_on = 838260513; var $has_messages messages = #[[$social, #[["bow.actor", <$ctext_frob, [["You bow to ", <$generator, ["victim", [], [], 'gen_victim]>, "."], #[['this, $social]]]>], ["bow.victim", <$ctext_frob, [[<$generator, ["actor", [], [], 'gen_actor]>, " bows to you."], #[['this, $social]]]>], ["bow", <$ctext_frob, [[<$generator, ["actor", [], [], 'gen_actor]>, " bows to ", <$generator, ["victim", [], [], 'gen_victim]>, "."], #[['this, $social]]]>]]]]; var $has_commands shortcuts = #[]; var $has_commands remote = #[]; var $has_commands local = #[["bow", [["bow", "*", "bow <object>", 'social_cmd, #[[1, ['object, []]]]]]]]; var $root inited = 1; var $root managed = [$social]; var $root owned = [$social]; var $user_interfaces links = 1; protected method .social_cmd() { arg cmdstr, cmd, [who]; var vars, i, n; (> .perms(caller(), $user) <); vars = #[["$actor", this()], ["actor", .name()]]; n = 0; for i in (who) { if ((| i.name() |)) { vars = (vars.add(n ? "$victim_" + n : "$victim", i)).add(n ? "victim_" + n : "victim", i.name()); n++; } } (.location()).announce(.eval_message(cmd, vars)); }; new object $editor: $user_interfaces; var $root manager = $editor; var $root created_on = 807225689; var $root inited = 1; var $root flags = ['methods, 'code, 'variables, 'core]; var $has_commands shortcuts = #[]; var $has_commands remote = #[]; var $has_commands local = #[["@e-abort", [["@e-abort", "", "@e-abort", 'abort_cmd, #[]]]], ["@e-insert", [["@e-insert", "*", "@e-insert <any>", 'insert_cmd, #[[1, ['any, []]]]]]], ["@e-delete", [["@e-delete", "*", "@e-delete <any>", 'delete_cmd, #[[1, ['any, []]]]]]], ["@e-save", [["@e-save", "", "@e-save", 'save_cmd, #[]]]], ["@e-line", [["@e-line", "*", "@e-line <number>", 'line_cmd, #[[1, ['number, []]]]]]], ["@e-list", [["@e-list", "*", "@e-list <any>", 'elist_cmd, #[[1, ['any, []]]]]]], ["@e-append", [["@e-append", "*", "@e-append <any>", 'eappend_cmd, #[[1, ['any, []]]]]]]]; var $editor sender = 0; var $editor finisher = 0; var $editor text = 0; var $editor line = 0; var $editor modified = 0; var $root managed = [$editor]; protected method .startup() { arg finish_method, initial_text; if (modified) throw(~lock, "Editor is being used. Do a @save or @abort."); if (type(initial_text) == 'string) initial_text = [initial_text]; sender = sender(); finisher = finish_method; text = initial_text; line = 1; modified = 0; }; protected method .abort_cmd() { arg [args]; (> .perms(caller(), $user) <); clear_var('sender); clear_var('finisher); clear_var('text); clear_var('line); clear_var('modified); .tell("The editor is cleared."); }; protected method .insert_cmd() { arg cmdstr, cmd, what; (> .perms(caller(), $user) <); modified = 1; text = text.insert(line, what); .tell(("Line " + tostr(line)) + " added."); ++line; }; protected method .save_cmd() { arg [args]; (> .perms(caller(), $user) <); if ((> sender.(finisher)(text) <) == 'clear) { clear_var('sender); clear_var('finisher); clear_var('text); clear_var('line); clear_var('modified); .tell("Done. Editor cleared."); } else { .tell("Save completed."); } }; protected method .delete_cmd() { arg cmdstr, cmd, what; var start, end; (> .perms(caller(), $user) <); catch any { start = ._parse_range(what); } with { .tell("Illegal range, can't delete."); return; } end = start[2]; start = start[1]; text = (text.subrange(1, start - 1)) + (text.subrange(end + 1)); modified = 1; line = start; .tell((((("Deleted " + tostr((end - start) + 1)) + ((end == start) ? " line." : " lines.")) + " Current set to ") + tostr(line)) + "."); }; protected method .line_cmd() { arg cmdstr, cmd, number; (> .perms(caller(), $user) <); if ((number < 1) || (number > ((text.length()) + 1))) { .tell("Out if range."); return; } else { line = number; } .tell("Current set to " + tostr(line)); }; protected method .elist_cmd() { arg cmdstr, cmd, rangestr; var start, end, out, i, j, k, lineno; (> .perms(caller(), $user) <); if (text == []) { .tell("There is no text."); return; } catch any { start = ._parse_range(rangestr); } with { .tell("Illegal range, can't list that."); return; } end = start[2]; start = start[1]; out = []; j = start; for i in (text.subrange(start, (end - start) + 1)) { lineno = (tostr(j).right(5, (j == line) ? "^" : " ")) + ": "; out += [(lineno + i).wrap_line(.linelen(), " ")]; ++j; } .tell(out); }; public method ._parse_range() { arg what; var start, end, range; what = what.replace("$", tostr(text.length())); if (!what) { start = (end = (line > 1) ? line - 1 : 1); } else { range = (> $parse_lib.range(what) <); start = range[1]; end = ((range[2]) == 'single) ? start : (range[2]); } if ((start < 1) || ((end > (text.length())) || (end < start))) throw(~range, "Illegal range."); return [start, end]; }; protected method .eappend_cmd() { arg cmdstr, cmd, what; (> .perms(caller(), $user) <); modified = 1; if (line == 1) { text = text.insert(line, what); .tell(("Line " + tostr(line)) + " added."); ++line; } else { text = text.replace(line - 1, what + (text[line - 1])); .tell(("Appended to line " + tostr(line - 1)) + "."); } }; new object $slate: $thing; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'variables, 'core]; var $slate connection = 0; var $slate remote_host = ""; var $slate remote_port = 0; var $slate request_method = ""; var $slate received_text = []; var $located location = $void; var $located obvious = 1; var $described prose = []; var $has_gender gender = $gender_neuter; var $has_name name = ['uniq, "Generic Slate", "the Generic Slate"]; var $root manager = $slate; var $root managed = [$slate]; var $root owned = [$slate]; root method .init_slate() { connection = 0; remote_host = ""; remote_port = 0; request_method = ""; received_text = []; }; root method .uninit_slate() { connection = 0; remote_host = ""; remote_port = 0; request_method = ""; received_text = []; }; protected method .received_text() { return received_text; }; protected method .connection() { return connection; }; protected method .remote_host() { return remote_host; }; protected method .remote_port() { return remote_port; }; protected method .request_method() { return request_method; }; protected method .send() { arg line; connection.send(line); }; public method .connection_ending(); new object $nothing: $thing; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'variables, 'core]; var $located location = $lost_and_found; var $located obvious = 1; var $has_gender gender = $gender_neuter; var $described prose = []; var $has_name name = ['prop, "nothing whatsoever", "nothing whatsoever"]; var $root manager = $nothing; var $root owned = [$nothing]; var $root managed = [$nothing]; new object $climate: $has_commands; var $root manager = $climate; var $root child_index = 2; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 839895133; var $climate attributes = 0; var $has_commands shortcuts = #[]; var $has_commands remote = #[["@setup", [["@setup", "*", "@setup <this>", 'setup_cmd, #[[1, ['this, []]]]]]], ["@list-climate", [["@list-climate", "*", "@list-climate <this>", 'show_cmd, #[[1, ['this, []]]]]]], ["@add-weather", [["@add-weather", "* to *", "@add-weather <any> to <this>", 'add_weather_cmd, #[[1, ['any, []]], [3, ['this, []]]]]]], ["@del-weather", [["@del-weather", "* from *", "@del-weather <any> from <this>", 'del_weather_cmd, #[[1, ['any, []]], [3, ['this, []]]]]]]]; var $has_commands local = #[]; var $root inited = 1; var $climate extra_attributes = 0; var $climate seasons = 0; var $climate weathers = 0; var $root managed = [$climate]; var $root owned = [$climate]; public method .setup_cmd() { arg cmdstr, cmd, this; var s, line, attrs, att2, extras, ex2, i; s = sender(); (> .perms(s) <); s.tell("WARNING: This will erase all the data on this object. You can @abort if you want to avoid it."); s.tell("Enter the attributes. Default list: precipitation temperature humidity visibility clouds."); line = s.prompt("Attributes:"); if (line == "@abort") { s.tell("Aborted."); return; } line = line || "precipitation temperature humidity visibility clouds"; attrs = (line.explode()).mmap('to_symbol); s.tell("Enter the extra attributes (those will be evaluated with methods). There are no defaults for these."); line = s.prompt("Extras:"); if (line == "@abort") { s.tell("Aborted."); return; } extras = (line.explode()).mmap('to_symbol); s.tell("Attribute descriptions are one-word descs for the particular attribute. For instance, humidity would range from 'dry' to 'humid'. Use adjectives or word groups that can be used as adjectives, as these may be incorporated into ctext (alternatively, use nouns, but try to be consistant). Separate them with ';', not space."); att2 = #[]; for i in (attrs) { line = s.prompt(("Att descriptions for " + i) + ":"); if (line == "@abort") { s.tell("Aborted."); return; } att2 = att2.add(i, line.explode(";")); } extras && (s.tell("Now do the same for the extra attributes.")); ex2 = #[]; for i in (extras) { line = s.prompt(("Att descriptions for " + i) + ":"); if (line == "@abort") { s.tell("Aborted."); return; } ex2 = ex2.add(i, line.explode(";")); } line = s.prompt("Now enter the seasons (default:winter spring summer fall):"); if (line == "@abort") { s.tell("Aborted."); return; } line = line || "winter spring summer fall"; seasons = (line.explode()).mmap('to_symbol); attributes = att2; extra_attributes = ex2; weathers = #[]; s.tell("Setup done, the weather table has been wiped."); }; public method .add_weather_cmd() { arg cmdstr, cmd, weather, from, this; var s; s = sender(); (> .perms(s) <); .read_weather(s, tosym(weather.strip())); }; public method .del_weather_cmd() { arg cmdstr, cmd, weather, from, this; var s; s = sender(); (> .perms(s) <); data = data.del_weather(tosym(weather.strip())); }; public method .show_cmd() { arg cmdstr, cmd, this; return .show(); }; public method .add_weather() { arg name, attrs, probs, message, ch_messages; (> .perms(sender()) <); weathers = weathers.add(name, [attrs, probs, message, ch_messages]); }; public method .show() { var out, x, i; out = [("Attributes: " + ((attributes.keys()).to_english())) + ".", ("Derived attributes: " + ((extra_attributes.keys()).to_english())) + ".", ("Seasons: " + (seasons.to_english())) + "."]; for x in (weathers) { out += [((((" * " + (x[1])) + "> (probs) ") + (map i in [1 .. seasons.length()] to ((tostr(seasons[i]) + ":") + (((x[2])[2])[i])).join(", "))) + " (attrs) ") + (map i in [1 .. (attributes.keys()).length()] to ((tostr((attributes.keys())[i]) + ":") + (((attributes.values())[i])[((x[2])[1])[i]])).join(", "))]; out += [" Description = " + ((((x[2])[3]).uncompile()).join())]; if ((x[2])[4]) { out += [" Change messages:"]; for i in ((x[2])[4]) out += [" " + ((i.uncompile()).join())]; } } return out; }; public method .del_weather() { arg weather; (> .perms(sender()) <); weathers = weathers.del(weather); }; public method ._distances() { arg from, season; var i, j, attr, refattr; refattr = (weathers[from])[1]; return map i in (weathers.keys()) to ([i, ((map j in [1 .. (attr = (weathers[i])[1]).length()] to (abs((attr[j]) - (refattr[j]))).sum()) * 100) / (((weathers[i])[2])[season])]); }; public method .advance() { arg current, season, fuzz; var dists, i, w, s; (> .perms(sender()) <); dists = ._distances(current, season); dists = dists.sort(dists.slice(2)); i = 1; while ((i < (dists.length())) && (random(20 + ((dists[i])[2])) < fuzz)) i++; return (dists[i])[1]; }; private method .read_weather() { arg user, weather; var attrs, probs, message, ch_messages, i, done; catch any { attrs = user.prompt(("Attribute values for " + ((attributes.keys()).to_english())) + " (you can use quotes):"); done = 0; while (!done) { catch ~retry { if ((type(attrs) == 'symbol) || (attrs == "@abort")) throw(~stop, ""); if (((attributes.keys()).length()) != ((attrs = attrs.explode_quoted()).length())) throw(~retry, "Wrong number of attributes."); attrs = map i in [1 .. attrs.length()] to (((attrs[i]) in ((attributes.values())[i])) || throw(~retry, ((("Illegal value " + (attrs[i])) + " for ") + ((attributes.keys())[i])) + ".")); done = 1; } with { user.tell((traceback()[1])[2]); attrs = user.prompt("Please reenter attributes:"); } } probs = user.prompt(("Seasonal probabilities for " + (seasons.to_english())) + " [0-99]:"); if ((type(probs) == 'symbol) || (probs == "@abort")) throw(~stop, ""); if ((seasons.length()) != ((probs = probs.explode()).length())) throw(~parse, "Wrong number of attributes"); probs = map i in (probs) to (toint(i)); message = user.prompt("Weather description:"); if ((type(message) == 'symbol) || (message == "@abort")) throw(~stop, ""); (> (message = $compiler.compile_cml(message)) <); ch_messages = user.read("Enter messages to be displayed during the change ('.' to finish)"); if (type(ch_messages) == 'symbol) throw(~stop, ""); (> (ch_messages = map i in (ch_messages) to ($compiler.compile_cml(i))) <); .add_weather(weather, attrs, probs, message, ch_messages); return "Done."; } with { user.tell((traceback()[1])[2]); } }; public method .ctext_variables() { arg current, season; var vars, w, w1, i, k; w = weathers[current]; w1 = w[1]; vars = #[["weather", tostr(current)], ["weather_desc", w[3]], ["season", tostr(season)]]; for i in [1 .. (k = attributes.keys()).length()] vars = vars.add(tostr(k[i]), ((attributes.values())[i])[w1[i]]); for i in [1 .. (k = extra_attributes.keys()).length()] vars = vars.add(tostr(k[i]), ((extra_attributes.values())[i])[.(k[i])(w1, current, season)]); return vars; }; public method .daylength() { arg season; return daylengths[s]; }; new object $climate_taobh_thiar: $climate; var $root manager = $climate_taobh_thiar; var $root flags = ['variables, 'methods, 'code, 'core]; var $root created_on = 839896989; var $climate seasons = ['winter, 'spring, 'summer, 'fall]; var $has_commands shortcuts = #[]; var $has_commands remote = #[]; var $has_commands local = #[]; var $root inited = 1; var $climate attributes = #[['precipitation, ["fine", "drizzle", "rain", "shower", "snow"]], ['temperature, ["hot", "warm", "cold", "freezing"]], ['humidity, ["dry", "fine", "humid"]], ['visibility, ["clear", "hazy", "murky"]], ['clouds, ["clear", "cloudy", "overcast"]]]; var $climate extra_attributes = #[]; var $climate weathers = #[['nice, [[1, 2, 2, 1, 1], [10, 50, 50, 30], <$ctext_frob, [["The day is nice, the sun on the clear tirquese sky with occasional wispy cloud."], #[['this, $climate_taobh_thiar]]]>, []]]]; var $root managed = [$climate_taobh_thiar]; var $root owned = [$climate_taobh_thiar]; new object $gender: $has_name; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'core, 'variables]; var $gender pronouns = 0; var $gender gender = 0; var $gender cgender_name = 0; var $gender gender_name = 0; var $gender person = 0; var $gender has = 0; var $gender number = 0; var $gender context = []; var $has_name name = ['normal, "Gendered Object", "a Gendered Object"]; var $has_settings defined_settings = #[]; var $has_settings local_settings = #[]; var $has_settings settings = #[]; var $gender vpronouns = 0; var $gender apronouns = 0; var $root manager = $gender; var $root managed = [$gender]; var $root owned = [$gender]; root method .init_gender() { cgender_name = ""; gender_name = ""; // these should be inited by hand, later. pronouns = #[['pr, "itself"], ['pp, "its"], ['po, "it"], ['ps, "it"], ['pq, "its"], ['prc, "Itself"], ['ppc, "Its"], ['poc, "It"], ['psc, "It"], ['pqc, "Its"], ['have, "has"]]; }; public method .pronoun() { arg pronoun; return (> pronouns[pronoun] <); }; public method .gender() { return gender; }; public method .set_gender_names() { arg name, cname; .perms(sender()); cgender_name = cname; gender_name = name; }; public method .set_pronouns() { arg nmbr, ps, po, pp, pq, pr, psc, poc, ppc, pqc, prc; var x; .perms(sender(), 'manager); pronouns = #[['pr, pr], ['pp, pp], ['po, po], ['ps, ps], ['pq, pq], ['prc, prc], ['ppc, ppc], ['poc, poc], ['psc, psc], ['pqc, pqc]]; number = nmbr; context = [ps, po, pp, pq, pr, psc, poc, ppc, pqc, prc]; }; public method .pronouns() { return pronouns; }; public method .gender_name() { arg [caps]; [(caps ?= 'null)] = caps; switch (caps) { case 'caps: return cgender_name; default: return gender_name; } }; public method .context() { return context; }; public method .cml_pronouns() { return cml_pronouns; }; public method .vpronouns() { return vpronouns; }; public method .apronouns() { return apronouns; }; public method .number() { return number; }; new object $gender_first_person: $gender; var $root trusted = []; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'variables, 'core]; var $gender cgender_name = ""; var $gender gender_name = ""; var $gender pronouns = #[['pr, "yourself"], ['pp, "your"], ['po, "you"], ['ps, "you"], ['pq, "yours"], ['prc, "Yourself"], ['ppc, "Your"], ['poc, "You"], ['psc, "You"], ['pqc, "Yours"]]; var $gender number = 1; var $gender context = ["yourself", "your", "you", "you", "yours", "Yourself", "Your", "You", "You", "Yours"]; var $has_name name = ['normal, "Gender, First Person", "a Gender, First Person"]; var $gender vpronouns = #[["vpr", "yourself"], ["vpp", "your"], ["vpo", "you"], ["vps", "you"], ["vpq", "yours"], ["vprc", "Yourself"], ["vppc", "Your"], ["vpoc", "You"], ["vpsc", "You"], ["vpqc", "Yours"]]; var $gender apronouns = #[["apr", "yourself"], ["app", "your"], ["apo", "you"], ["aps", "you"], ["apq", "yours"], ["aprc", "Yourself"], ["appc", "Your"], ["apoc", "You"], ["apsc", "You"], ["apqc", "Yours"]]; var $root manager = $gender_first_person; var $root owned = [$gender_first_person]; var $root managed = [$gender_first_person]; new object $gender_female: $gender; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'variables, 'core]; var $gender cgender_name = "Female"; var $gender gender_name = "female"; var $gender pronouns = #[['pr, "herself"], ['pp, "her"], ['po, "her"], ['ps, "she"], ['pq, "hers"], ['prc, "Herself"], ['ppc, "Her"], ['poc, "Her"], ['psc, "She"], ['pqc, "Hers"]]; var $gender number = 'singular; var $gender context = ["herself", "her", "her", "she", "hers", "Herself", "Her", "Her", "She", "Hers"]; var $has_name name = ['prop, "female", "female"]; var $gender vpronouns = #[["vpr", "herself"], ["vpp", "her"], ["vpo", "her"], ["vps", "she"], ["vpq", "hers"], ["vprc", "Herself"], ["vppc", "Her"], ["vpoc", "Her"], ["vpsc", "She"], ["vpqc", "Hers"]]; var $gender apronouns = #[["apr", "herself"], ["app", "her"], ["apo", "her"], ["aps", "she"], ["apq", "hers"], ["aprc", "Herself"], ["appc", "Her"], ["apoc", "Her"], ["apsc", "She"], ["apqc", "Hers"]]; var $root manager = $gender_female; var $root owned = [$gender_female]; var $root managed = [$gender_female]; new object $gender_first_person_plural: $gender; var $root trusted = []; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'variables, 'core]; var $gender cgender_name = ""; var $gender gender_name = ""; var $gender pronouns = #[['pr, "yourselves"], ['pp, "your"], ['po, "you"], ['ps, "you"], ['pq, "yours"], ['prc, "Yourselves"], ['ppc, "Your"], ['poc, "You"], ['psc, "You"], ['pqc, "Yours"]]; var $gender number = 2; var $gender context = ["yourselves", "your", "you", "you", "yours", "Yourselves", "Your", "You", "You", "Yours"]; var $has_name name = ['normal, "Gender, First Person Plural", "a Gender, First Person Plural"]; var $gender vpronouns = #[["vpr", "yourselves"], ["vpp", "your"], ["vpo", "you"], ["vps", "you"], ["vpq", "yours"], ["vprc", "Yourselves"], ["vppc", "Your"], ["vpoc", "You"], ["vpsc", "You"], ["vpqc", "Yours"]]; var $gender apronouns = #[["apr", "yourselves"], ["app", "your"], ["apo", "you"], ["aps", "you"], ["apq", "yours"], ["aprc", "Yourselves"], ["appc", "Your"], ["apoc", "You"], ["apsc", "You"], ["apqc", "Yours"]]; var $root manager = $gender_first_person_plural; var $root owned = [$gender_first_person_plural]; var $root managed = [$gender_first_person_plural]; new object $gender_male: $gender; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'variables, 'core]; var $gender cgender_name = "Male"; var $gender gender_name = "male"; var $gender pronouns = #[['pr, "himself"], ['pp, "his"], ['po, "him"], ['ps, "he"], ['pq, "his"], ['prc, "Himself"], ['ppc, "His"], ['poc, "Him"], ['psc, "He"], ['pqc, "His"]]; var $gender number = 'singular; var $gender context = ["himself", "his", "him", "he", "his", "Himself", "His", "Him", "He", "His"]; var $has_name name = ['prop, "male", "male"]; var $gender vpronouns = #[["vpr", "himself"], ["vpp", "his"], ["vpo", "him"], ["vps", "he"], ["vpq", "his"], ["vprc", "Himself"], ["vppc", "His"], ["vpoc", "Him"], ["vpsc", "He"], ["vpqc", "His"]]; var $gender apronouns = #[["apr", "himself"], ["app", "his"], ["apo", "him"], ["aps", "he"], ["apq", "his"], ["aprc", "Himself"], ["appc", "His"], ["apoc", "Him"], ["apsc", "He"], ["apqc", "His"]]; var $root manager = $gender_male; var $root owned = [$gender_male]; var $root managed = [$gender_male]; new object $gender_plural: $gender; var $root trusted = []; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'variables, 'core]; var $gender cgender_name = "Plural"; var $gender gender_name = "plural"; var $gender pronouns = #[['pr, "themselves"], ['pp, "their"], ['po, "them"], ['ps, "they"], ['pq, "theirs"], ['prc, "Themselves"], ['ppc, "Their"], ['poc, "Them"], ['psc, "They"], ['pqc, "Theirs"]]; var $gender number = 2; var $gender context = ["themselves", "their", "them", "they", "theirs", "Themselves", "Their", "Them", "They", "Theirs"]; var $has_name name = ['prop, "plural", "plural"]; var $gender vpronouns = #[["vpr", "themselves"], ["vpp", "their"], ["vpo", "them"], ["vps", "they"], ["vpq", "theirs"], ["vprc", "Themselves"], ["vppc", "Their"], ["vpoc", "Them"], ["vpsc", "They"], ["vpqc", "Theirs"]]; var $gender apronouns = #[["apr", "themselves"], ["app", "their"], ["apo", "them"], ["aps", "they"], ["apq", "theirs"], ["aprc", "Themselves"], ["appc", "Their"], ["apoc", "Them"], ["apsc", "They"], ["apqc", "Theirs"]]; var $root manager = $gender_plural; var $root owned = [$gender_plural]; var $root managed = [$gender_plural]; new object $gender_neuter: $gender; var $root inited = 1; var $root created_on = 796268969; var $root flags = ['methods, 'code, 'variables, 'core]; var $gender cgender_name = "Neuter"; var $gender gender_name = "neuter"; var $gender pronouns = #[['pr, "itself"], ['pp, "its"], ['po, "it"], ['ps, "it"], ['pq, "its"], ['prc, "Itself"], ['ppc, "Its"], ['poc, "It"], ['psc, "It"], ['pqc, "Its"]]; var $gender number = 'singular; var $gender context = ["itself", "its", "it", "it", "its", "Itself", "Its", "It", "It", "Its"]; var $has_name name = ['prop, "neuter", "neuter"]; var $gender vpronouns = #[["vpr", "itself"], ["vpp", "its"], ["vpo", "it"], ["vps", "it"], ["vpq", "its"], ["vprc", "Itself"], ["vppc", "Its"], ["vpoc", "It"], ["vpsc", "It"], ["vpqc", "Its"]]; var $gender apronouns = #[["apr", "itself"], ["app", "its"], ["apo", "it"], ["aps", "it"], ["apq", "its"], ["aprc", "Itself"], ["appc", "Its"], ["apoc", "It"], ["apsc", "It"], ["apqc", "Its"]]; var $root manager = $gender_neuter; var $root owned = [$gender_neuter]; var $root managed = [$gender_neuter];