Generic Help Database #24
Aliases: Generic Help Database
12 verbs · 12 properties · 9 children
Verbs
| Verb | Spec | Flags | Definer | Lines |
|---|---|---|---|---|
find_topics | this none this | rxd | #24 | 41 |
get_topic | this none this | rxd | #24 | 13 |
sort_topics | this none this | rxd | #24 | 13 |
columnize | this none this | rxd | #24 | 7 |
forward pass | this none this | rxd | #24 | 21 |
subst | this none this | rxd | #24 | 47 |
index | this none this | rxd | #24 | 6 |
initialize | this none this | rxd | #24 | 5 |
verbdoc | this none this | rxd | #24 | 9 |
dump_topic | this none this | rxd | #24 | 6 |
objectdoc | this none this | rxd | #24 | 8 |
find_index_topics | this none this | rxd | #24 | 28 |
Properties
| Property | Definer | Flags | Owner | Value |
|---|---|---|---|---|
index | #24 | rc | #29 | {} |
index_cache | #24 | r | #29 | {} |
aliases | #1 | rc | #29 | {"Generic Help Database"} |
description | #1 | rc | #29 | "A help database of the standard form in need of a description. See `help $generic_help'..." |
object_size | #1 | r | #29 | {9729, 1298433815} |
hidden_verbs | #1 | rc | #29 | <clear> |
phelp_msg | #1 | rc | #29 | <clear> |
weight | #1 | rc | #29 | <clear> |
owner_verbs | #1 | rc | #29 | <clear> |
plural_name | #1 | rc | #29 | <clear> |
client_image | #1 | rc | #29 | <clear> |
listening | #1 | rc | #29 | <clear> |
Ancestry
Ancestors (nearest first): #1 root
Children: #14 Core Utility Help, #15 Programmer Help, #16 Wizard Help, #22 Builtin Function Help, #36 Editor Help, #52 Help Database, #78 Builder Help DB, #79 Mail Commands Help Db, #86 Frand Help DB
Call graph
Source
find_topics
Referenced by
- #14:find_topics line 8:
pass( - #14:find_topics line 9:
pass( - #14:find_topics line 13:
pass( - #24:index line 6:
this:find_topics - #52:find_topics line 1:
pass( - #100:help line 21:
$mail_help:find_topics
Source
1"WIZARDLY"; 2if (args) 3"...check for an exact match first..."; 4search = args[1]; 5if (`$object_utils:has_property(parent(this), search) ! ANY') 6if ($object_utils:has_property(this, " " + search)) 7return {search}; 8endif 9elseif ($object_utils:has_property(this, search)) 10return {search}; 11endif 12"...search for partial matches, allowing for"; 13"...confusion between topics that do and don't start with @, and"; 14".. confusion between - and _ characters."; 15props = properties(this); 16topics = {}; 17if (search[1] == "@") 18search = search[2..$]; 19endif 20search = strsub(search, "-", "_"); 21if (!search) 22"...don't try searching for partial matches if the string is empty or @"; 23"...we'd get *everything*..."; 24return {}; 25endif 26for prop in (props) 27if (((i = index(strsub(prop, "-", "_"), search)) == 1) || ((i == 2) && index(" @", prop[1]))) 28topics = {@topics, (prop[1] == " ") ? prop[2..$] | prop}; 29endif 30endfor 31return topics; 32else 33"...return list of all topics..."; 34props = setremove(properties(this), ""); 35for p in (`$object_utils:all_properties(parent(this)) ! ANY => {}') 36if (i = (" " + p) in props) 37props = {p, @listdelete(props, i)}; 38endif 39endfor 40return props; 41endif
get_topic
Referenced by
- #14:get_topic line 5:
pass( - #24:forward line 7:
this:get_topic - #52:get_topic line 1:
pass( - #100:help line 22:
$mail_help:get_topic
Source
1"WIZARDLY"; 2{topic, ?dblist = {}} = args; 3if (`$object_utils:has_property(parent(this), topic) ! ANY') 4text = `this.(" " + topic) ! ANY'; 5else 6text = `this.(topic) || this.(" " + topic) ! ANY'; 7endif 8if (typeof(text) == LIST) 9if (text && (text[1] == (("*" + (vb = strsub(text[1], "*", ""))) + "*"))) 10text = `this:(vb)(listdelete(text, 1), dblist) ! ANY'; 11endif 12endif 13return text;
sort_topics
Referenced by
- #2:?* line 22:
$help:sort_topics - #24:index line 6:
this:sort_topics - #90:get_help_topic line 20:
$help:sort_topics
Source
1":sort_topics(list_of_topics) -- sorts the given list of strings, assuming that they're help-system topic names"; 2buckets = "abcdefghijklmnopqrstuvwxyz"; 3keys = names = $list_utils:make(length(buckets) + 1, {}); 4for name in (setremove(args[1], "")) 5key = index(".@", name[1]) ? name[2..$] + " " | name; 6k = index(buckets, key[1]) + 1; 7bucket = keys[k]; 8i = $list_utils:find_insert(bucket, key); 9keys[k] = listinsert(bucket, key, i); 10names[k] = listinsert(names[k], name, i); 11$command_utils:suspend_if_needed(0); 12endfor 13return $list_utils:append(@names);
columnize
Referenced by
Source
1":columnize(@list_of_strings) -- prints the given list in a number of columns wide enough to accomodate longest entry. But no more than 4 columns."; 2longest = $list_utils:longest(args); 3for d in ({4, 3, 2, 1}) 4if ((79 / d) >= length(longest)) 5return $string_utils:columnize_suspended(0, args, d); 6endif 7endfor
forward pass
Referenced by
none
Source
1"{\"*forward*\", topic, @rest} => text for topic from this help db."; 2"{\"*pass*\", topic, @rest} => text for topic from next help db."; 3"In both cases the text of @rest is appended. "; 4"@rest may in turn begin with a *<verb>*"; 5{text, ?dblist = {}} = args; 6if (verb == "forward") 7first = this:get_topic(text[1], dblist); 8elseif ((result = $code_utils:help_db_search(text[1], dblist)) && ((db = result[1]) != $ambiguous_match)) 9first = db:get_topic(result[2], dblist[(db in dblist) + 1..$]); 10else 11first = {}; 12endif 13if (2 <= length(text)) 14if (text[2] == (("*" + (vb = strsub(text[2], "*", ""))) + "*")) 15return {@first, @`this:(vb)(text[3..$], dblist) ! ANY => {}'}; 16else 17return {@first, @text[2..$]}; 18endif 19else 20return first; 21endif
subst
Referenced by
none
Source
1"{\"*subst*\", @text} => text with the following substitutions:"; 2" \"...%[expr]....\" => \"...\"+value of expr (assumed to be a string)+\"....\""; 3" \"%;expr\" => @(value of expr (assumed to be a list of strings))"; 4newlines = {}; 5for old in (args[1]) 6new = ""; 7bomb = 0; 8while ((prcnt = index(old, "%")) && (prcnt < length(old))) 9new = new + old[1..prcnt - 1]; 10code = old[prcnt + 1]; 11old = old[prcnt + 2..$]; 12if (code == "[") 13prog = ""; 14while ((b = index(old + "]", "]")) > (p = index(old + "%", "%"))) 15prog = (prog + old[1..p - 1]) + old[p + 1]; 16old = old[p + 2..$]; 17endwhile 18prog = prog + old[1..b - 1]; 19old = old[b + 1..$]; 20value = $no_one:eval_d(prog); 21if (value[1]) 22new = tostr(new, value[2]); 23else 24new = tostr(new, toliteral(value[2])); 25bomb = 1; 26endif 27elseif ((code != ";") || new) 28new = (new + "%") + code; 29else 30value = $no_one:eval_d(old); 31if (value[1] && (typeof(r = value[2]) == LIST)) 32newlines = {@newlines, @r[1..$ - 1]}; 33new = tostr(r[$]); 34else 35new = tostr(new, toliteral(value[2])); 36bomb = 1; 37endif 38old = ""; 39endif 40endwhile 41if (bomb) 42newlines = {@newlines, new + old, tostr("@@@ Helpfile alert: Previous line is messed up; notify ", this.owner.wizard ? "" | tostr(this.owner.name, " (", this.owner, ") or "), "a wizard. @@@")}; 43else 44newlines = {@newlines, new + old}; 45endif 46endfor 47return newlines;
index
Referenced by
none
Source
1"{\"*index*\" [, title]}"; 2"This produces a columnated list of topics in this help db, headed by title."; 3$command_utils:suspend_if_needed(0); 4title = args[1] ? args[1][1] | tostr(this.name, " (", this, ")"); 5su = $string_utils; 6return {"", title, su:from_list($list_utils:map_arg(su, "space", su:explode(title), "-"), " "), @this:columnize(@this:sort_topics(this:find_topics()))};
initialize
Referenced by
none
Source
1pass(@args); 2if ($perm_utils:controls(caller_perms(), this)) 3this.r = 1; 4this.f = 0; 5endif
verbdoc
Referenced by
none
Source
1"{\"*verbdoc*\", \"object\", \"verbname\"} use documentation for this verb"; 2set_task_perms(this.owner); 3if (!valid(object = $string_utils:match_object(args[1][1], player.location))) 4return E_INVARG; 5elseif (!(hv = $object_utils:has_verb(object, vname = args[1][2]))) 6return E_VERBNF; 7else 8return $code_utils:verb_documentation(hv[1], vname); 9endif
dump_topic
Referenced by
- #14:dump_topic line 1:
pass( - #52:dump_topic line 1:
pass(
Source
1try 2text = this.(fulltopic = args[1]); 3return {tostr(";;", $code_utils:corify_object(this), ".(", toliteral(fulltopic), ") = $command_utils:read_lines()"), @$command_utils:dump_lines(text)}; 4except error (ANY) 5return error[1]; 6endtry
objectdoc
Referenced by
none
Source
1"{\"*objectdoc*\", \"object\"} => text for topic from object:help_msg"; 2if (!valid(object = $string_utils:literal_object(args[1][1]))) 3return E_INVARG; 4elseif (!($object_utils:has_verb(object, "help_msg") || $object_utils:has_property(object, "help_msg"))) 5return E_VERBNF; 6else 7return $code_utils:verb_or_property(object, "help_msg"); 8endif
find_index_topics
Referenced by
none
Source
1":find_index_topic([search])"; 2"Return the list of index topics of this help DB"; 3"(i.e., those which contain an index (list of topics)"; 4"this DB, return it, otherwise return false."; 5"If search argument is given and true,"; 6"we first remove any cached information concerning index topics."; 7{?search = 0} = args; 8if (this.index_cache && (!search)) 9"...make sure every topic listed in .index_cache really is an index topic"; 10for p in (this.index_cache) 11if (!("*index*" in `this.(p) ! ANY => {}')) 12search = 1; 13endif 14endfor 15if (!search) 16return this.index_cache; 17endif 18elseif ($generic_help == this) 19return {}; 20endif 21itopics = {}; 22for p in (properties(this)) 23if ((h = `this.(p) ! ANY') && ("*index*" in h)) 24itopics = {@itopics, p}; 25endif 26endfor 27this.index_cache = itopics; 28return itopics;