1.1.2 ~config

Submitted by Trispis on Thu, 2007-01-11 08:46

Below is a list of 'to do' items.

1. Get and maintain plain vanilla default master list (i.e., set up a new PennMUSH "out of the box" and separate the code for setting up defaults in &DATA`<category>`<item>`DEFAULT attributes).

KNOWN BUG: the do-options code, as written, generates a category called 'parameters'.
Mike pages: If you just stick setdiff(<foo>,@config parameters,|) in (where <foo> is the textentries(help,@config %0*,|) I believe) that should fix that bit.

KNOWN BUG: the 'tiny' category doesn't get a description set.

KNOWN ISSUE: Haven't yet finished the /diff switch for two reasons:
1. time
2. have only tested this on M*U*S*H (haven't ever done a plain vanilla, per the 'to do' above).

Here's the code to generate all of the data (not yet separated per 'vanilla' above).


@@
&CMND.DO-OPTIONS [v(~)]=$do-options:@pemit %#=Doing options.[null(u(list-options))]
@@
&list-options [v(~)]=localize(setq(0,,1,,2,,3,0,4,0,5,0)[null(iter(sort(textentries(help, @config %0*,|),,|), if(isint(right(%i0, 1)), setq(5, 0), if(%q3, u(save-option, %q2, %q0))[switch(inum(0), 1, , u(save-category, %q0, %q1))][setq(3, 0, 2, , 0, rest(%i0), 5, 1)])[setq(4, 1)][iter(textfile(help, %i0), switch(setr(9, squish(%i0)), , if(%q3,u(save-option, %q2, %q0)[setq(3, 0, 2, )]), *=*:*, switch(1, %q3, u(save-option, %q2, %q0))[setq(2, %q9, 3, 1)], switch(1, %q4, if(%q5, setq(1, %q9))[setq(4,0)], %q3, setq(2, %q2 %q9))), %r, %b)], |, %b))])
@@
&save-option [v(~)]=set(me, DATA`%1`[first(%0, =)]`DEFAULT:[config(first(%0, =))])[set(me, DATA`%1`[first(%0, =)]`TYPE:[before(after(%0, <), >)])][set(me, DATA`%1`[first(%0, =)]:[squish(after(%0, :))])]
@@
&save-category [v(~)]=set(me,DATA`%0:%1)
@@
&credit-options [v(~)]=code for generating all of the attributes and contents originally written by Mike @ M*U*S*H with attribute name adaptations by Trispis @ c.p.o.
@@

And here's the display code, as it presently exists


@@
&cmnd`config [v(~)]=$~config:@pemit %#=u(UFUN`DISP)
@@
&cmnd`config.diff [v(~)]=$~config/diff:@pemit %#=u(UFUN`DISP`DIFF)
@@
&cmnd`config.list_x [v(~)]=$~config/list *:@pemit %#=ifelse(setr(e, u(UFUN`ERRCK`CATY, %0)), %qe, u(UFUN`DISP`HEADER)[u(UFUN`DISP`CATY, %0)][u(UFUN`DISP`FOOTER)])
@@
&cmnd`config.show_x [v(~)]=$~config/show *:@pemit %#=ifelse(setr(e, u(UFUN`ERRCK`ITEM, %0)), %qe, u(UFUN`DISP`HEADER)[u(UFUN`DISP`ITEM,%0)][u(UFUN`DISP`FOOTER)])
@@
&ufun`disp [v(~)]=[u(UFUN`DISP`HEADER)][u(UFUN`DISP`SYNTAX)][iter(setr(l, lattr(me/DATA`))[setq(w, lmath(max, iter(%ql, strlen(last(%i0, `)))))], [align(%qw [sub(width(%#), sub(%qw, 2))], setr(c, lcstr(last(%i0, `))), v(%i0))], %b, %r)][u(UFUN`DISP`FOOTER)]
@@
&ufun`disp`diff [v(~)]=null(iter(config(), switch(v(lattr(me/DATA`*`%i0`DEFAULT)), config(%i0), setq(d, %qd %i0), #-*, setq(e, %qe %i0), setq(o, %qo %i0))))%rDiffering values: %qd%r%rErrors: %qe%r%rOther differences: %qo%r
@@
&ufun`disp`caty [v(~)]=Config Category: %0%rDescription: [v(DATA`%0)]%r[setq(n, lmath(max, iter(setr(l, iter(lattr(me/DATA`%0`), lcstr(last(%i0,`)))), inc(strlen(%i0)))))][table(%ql, %qn, width(%#))]
@@
&ufun`disp`item [v(~)]=ljust(Config Item: %0, setr(w, div(width(%#), 2)))Config Type: [v(%qi`type)]%r%rDescription: [v(%qi)]%r%r[ljust(Default Setting: [v(%qi`DEFAULT)], %qw)]Current Setting: [config(%0)]
@@
&ufun`errck`caty [v(~)]=ifelse(or(not(dec(words(%0))), hasattr(me, DATA`%0)), ,Unknown category: %0)
@@
&ufun`errck`item [v(~)]=ifelse(or(words(setr(i, lattr(me/DATA`*`%0))), not(dec(words(%0)))), , Unknown config item: %0)
@@
&ufun`disp`header [v(~)]=-[center(- WARPEDcore~config -, sub(width(%#), 6), =)]-%r
@@
&ufun`disp`footer [v(~)]=%r-[setr(f, repeat(=, div(sub(width(%#), 3), 2)))]-%qf-
@@
&~`legal [v(~)]=WARPED~core Softcode and Documentation License - http://community.pennmush.org
@@