unfu~

@@
@@ ========================================================================
@@ unfu~
@@
@@ A content management system for Pennmush, utilizing:
@@
@@ * the many_attribs @power to allow an entire content package, no matter
@@ how large, to fit on a single object,
@@ * attribute tree features to facilitate organizational management of
@@ that content, and
@@ * side-effect parenting to allow internal, on-the-fly, temporary
@@ reparenting to any of an unlimited number of potential parents
@@
@@ for in-game retrieval of appropriately packaged game content.
@@ ========================================================================
@@ FINAL ALPHA RELEASE a.2009.07.14.a
@@ ========================================================================
@@
@@ System Requirements:
@@
@@ pennmush-compatible attribute tree-ing.
@@ many_attribs @power for large content packs.
@@ side-effects enabled.
@@ pennmush-compatible align() function.
@@ pennmush-compatible #lambda.
@@
@@ ------------------------------------------------------------------------
@@ Usage information:
@@
@@ The unfu~ command (with no arguments) provides end-user usage info.
@@ Other documentation is provided at the end of this file.
@@ A comprehensive documentation of features, foibles, and fun is in the
@@ works (it'll definitely be included when this moves to beta).
@@
@@ ========================================================================
@@ DISCLAIMER DISCLAIMER DISCLAIMER DISCLAIMER DISCLAIMER DISCLAIMER
@@
@@ If you do not have either:
@@
@@ a. absolute familiarity with the content you are installing to this
@@ system, or...
@@
@@ b. absolute trust in the source of the content you are installing to
@@ this system
@@
@@ then, DO NOT USE IT.
@@
@@ This system evaluates package content.
@@
@@ You have been warned.
@@ ========================================================================
@@ ------------------------------------------------------------------------
@@ ________________________________________________________________________
@@ .:....1....:....2....:....3....:....4....:....5....:....6....:....7....:
@@ ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
@@ AUTHORSHIP
@@
@@ Unless otherwise explicitly stated, Trispis is the author of this
@@ content management system, heretofore referred to as "unfu~".
@@ To contact the author, send email to: <nemosolid><@><gmail><.><com>
@@ All content package objects are authored by their respective authors;
@@ for information regarding content packages, see the respective package
@@ object.
@@
@@ ------------------------------------------------------------------------
@@ WARPEDcore Softcode and Documentation License
@@
@@ Copyright (c) 2009, Chuc McGuire
@@ All rights reserved.
@@
@@ Redistribution and use of WARPEDcore materials (the manifesto, scripts,
@@ modules, etc.) in text or digital forms, with or without modification,
@@ are permitted provided that the following conditions are met:
@@
@@ * Redistributions in text (paper and ink) form must retain the above
@@ copyright notice, this list of conditions and the following disclaimer.
@@ * Redistributions in digital form (http, ftp, etc.) must either retain
@@ the above copyright notice, this list of conditions and the following
@@ disclaimer within the distributed copies, or include a URL or hyperlink
@@ to them.
@@ * Neither the name of this project (unfu~) nor the names of its
@@ authors and/or contributors may be used to endorse or promote products
@@ derived from the herein covered material without specific prior written
@@ permission.
@@
@@
@@ THIS MATERIAL IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
@@ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
@@ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
@@ PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
@@ OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
@@ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
@@ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
@@ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
@@ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
@@ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
@@ MATERIAL, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@
@@ ------------------------------------------------------------------------
@@ ========================================================================
@@
@@ This system evaluates package content!
@@
@@ You have been warned, AGAIN!
@@
@@ ========================================================================
@@ ------------------------------------------------------------------------
@@ ________________________________________________________________________
@@ .:....1....:....2....:....3....:....4....:....5....:....6....:....7....:
@@ ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
@@ unfu~
@@
@set me=va:[create(unfu~,10)]
@@
@@ ========================================================================
@@ ------------------------------------------------------------------------
@@ ________________________________________________________________________
@@ .:....1....:....2....:....3....:....4....:....5....:....6....:....7....:
@@ ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
&~ %va=[@@(Null)]
@@
&~`AUTHOR %va=Unless otherwise explicitly stated, Trispis is the author of this content management system, heretofore referred to as "unfu~".%r To contact the author, send email to: [lit(nemosolid)][lit(@)][lit(gmail)][lit(.)][lit(com)]%r
@@
&~`LICENSE %va=WARPED~core Softcode and Documentation License. See: unfu~wsdl
@@
&~`VERSION %va=a.2009.07.14.a
@@
@set %va=~`DBREF`UNFU~:%va
@@
@describe %va=%rA content management system for Pennmush, utilizing:%r%r* the many_attribs @power to allow an entire content package, no matter how large, to fit on a single object, %r%r* attribute tree features to facilitate organizational management of that content, and%r%r* the parent() function to manage an unlimited number of content packages%r%rfor in-game retrieval of appropriately packaged game content.%r%rSee: unfu~%r
@@
@@ ------------------------------------------------------------------------
@@ ========================================================================
&~`FUNCTION`UNFU~ %va=ifelse(words(%0), ifelse(words(%1), [null(iter(lnum(0, 4), setq(%i0, v(%i0))))][u(~`U`PATH)], u(~`FUNCTION`UNFU~`PACK, %0)), v(~`DBREF`UNFU~))[@@(%q0=packname, %q1=attrpattrn, %q2=width, %q3=UFUN:usercontent, %q4=UFUN:ansi)]
@@
&~`FUNCTION`UNFU~`PACK %va=ifelse(isdbref(setr(d, v(~`PACK`%0))), %qd, u(PACK`ERROR,%0))
@@
@function unfu~=%va/~`FUNCTION`UNFU~
@@
@@ TEXT: unfu~(<pack>, <tfile>[, <width>
@@ DATA: unfu~(<pack>, <dfile>[, <width>
@@ UFUN: unfu~(<pack>, <ufile>[, <width>, <usercontent>, <ansi>
@@
@@ ========================================================================
@@ ------------------------------------------------------------------------
&~`CMND %va=$unfu~*:@pemit %#=[@@(unfu~\[<pack>\[ \[<path> \]<file>\]\])][u(~`U, %0)]
@@
@set %va=!NOCOMMAND
@@
@@ ------------------------------------------------------------------------
@@ NOTE: ~`U is gonna change; eventually this will be for package
@@ navigation and demonstration only. The main functionality of this
@@ object is in its @function (previous section).
@@ ------------------------------------------------------------------------
&~`U %va=[setq(0, first(%0), 1, rest(%0), 2, width(%#))][u(~`U`[switch(words(%0), 0, INFO, 1, PACK, PATH)], %q0, %q1)]
@@ NOTE: This is gonna change; see ~`CMND note above.
@@
&~`U`INFO %va=unfu~ content manager%r%r[iter(lattr(unfu~()/~`U`INFO`?), align(39 39, first(v(%i0), |), rest(v(%i0), |)), %b, %r)]%r%r(path leaf names can be included for specificity).%r%rAvailable Packs: [u(~`U`INFO`MENU)]%r
&~`U`INFO`1 %va=unfu~|this display
&~`U`INFO`2 %va=unfu~<pack>|info about a content package
&~`U`INFO`3 %va=unfu~<pack> [<path> ]<file>|a file from pack
&~`U`INFO`4 %va=
&~`U`INFO`5 %va=unfu~()|#dbref of unfu object
&~`U`INFO`6 %va=unfu~(<pack>)|#dbref of unfu pack <pack>
&~`U`INFO`7 %va=unfu~(<pack>,<[path] file[, parms]>)|contents of <file> from <pack> with optional path specificity, and optional parms for file
&~`U`INFO`8 %va=Ex: unfu~wsdl wsdl
&~`U`INFO`9 %va=Ex: th unfu~(wsdl,wsdl)
&~`U`INFO`MENU %va=%r[table(setr(t, map(#lambda/last(\%0, `), lattr(unfu~()/~`PACK`*))), inc(lmath(max, map(#lambda/strlen(\%0), %qt))), width(%#))]
@@
@@ ------------------------------------------------------------------------
&~`U`PACK %va=u(~`U`PACK`[ifelse(setr(e, isdbref(setr(d, v(~`PACK`%0)))), DISPLAY, ERROR)], %0, %qd)
&~`U`PACK`ERROR %va=#-0 No such package as: %0
&~`U`PACK`DISPLAY %va=ucstr(%0)%r[u(%1/describe)]%r[if(words(setr(z, lattr(%1/CONTENT`TEXT`??*) [lattr(%1/CONTENT`DATA`??*)] [lattr(%1/CONTENT`UFUN`??*)])), u(~`U`TEXT`MENU, %qz))]
@@
@@ ------------------------------------------------------------------------
&~`U`PATH %va=ifelse(isdbref(setr(d, v(~`PACK`%q0))), setq(p, parent(me))[null(parent(me, %qd))][u(~`U`FILE)][null(parent(me, ifelse(isdbref(%qp), %qp, )))], u(PACK`ERROR, %q0))
@@
@@ ------------------------------------------------------------------------
&~`U`FILE %va=u(~`U`FILE`[switch(words(setr(a, lattrp(me/CONTENT`**`[edit(%q1, %b, **)]))), 0, ERROR0, >1, ERROR2,DISPLAY)])
@@
@@ %q0=packname,%q1=attrpattrn, %q2=width, %q3=usercontent, %q4=ansi %qa=attrib[s]
@@
&~`U`FILE`ERROR0 %va=#-1 No match for %q0 %q1.
&~`U`FILE`ERROR2 %va=#-2 Too many matches. Choose one:%r[iter(%qa, edit(rest(rest(%i0, `), `), `, %b), %b, %r)]
@@
&~`U`FILE`DISPLAY %va=ucstr(%q0)/%qa%r[u(~`U`FILE`HEAD)][u(~`U`FILE`BODY)][u(~`U`FILE`FOOT,%1)]
&~`U`FILE`HEAD %va=if(hasattrp(me, HEAD), ulocal(HEAD, %1)%r)
&~`U`FILE`FOOT %va=if(hasattrp(me, FOOT), %r[u(FOOT, %1)])
&~`U`FILE`BODY %va=u(~`U`[elements(%qa, 2, `)])
@@
@@ ------------------------------------------------------------------------
&~`U`TEXT %va=ulocal(%qa, %qa, %q2)%r[u(~`U`TEXT`MENU, lattrp(me/%qa`??*))]
@@
&~`U`TEXT`MENU %va=if(words(%0), %r[table(setr(m, map(#lambda/last(\%0, `), %0)), inc(lmath(max, map(#lambda/strlen(\%0), %qm))), ifelse(isnum(%q2), %q2, width(%#)))])
@@
@@ ------------------------------------------------------------------------
@@
&~`U`DATA %va=center(ifelse(hasattrpval(me, %qa), ulocal(%qa,%qa,%q2), last(%qa, `)), setr(2,ifelse(isnum(%q2), %q2, dec(width(%#)))))%r%r[u(~`U`DATA`ELEMENTS)]
@@
&~`U`DATA`ELEMENTS %va=iter(setr(e, u(CONTENT`DATA`[elements(%qa, 3, `)]))|[setdiff(map(#lambda/last(\%0, `), lattrp(me/%qa`*)), %qe)][setq(r, words(%qe), x, lmath(max, map(#lambda/strlen(\%0), %qe) [dec(div(%q2, 4))]))], iter(%i0, if(hasattrpval(me, %qa`%i0), switch(inum(1)[inum(0)], 2*, %r, 1%qr, %r)[align(>%qx [sub(%q2, inc(%qx))], map(#lambda/capstr(\%0), edit(lcstr(%i0), _, %b)), ulocal(%qa`%i0, %qa`%i0, %q2))]%r), %b, ), |, )
@@
@@ ------------------------------------------------------------------------
&~`U`UFUN %va=ulocal(%qa, %qa, %q2, %q3, %q4)
@@
@@ %qa is name of the attrib being called, and... arrives as %0
@@ %q2 is width in which output must displayb arrives as %1
@@ %q3 is content sent to function arrives as %2
@@ %q4 is ansi color arrives as %3
@@
@@ NOTE: Once I'm comfortable with my ability to follow this in my brain,
@@ this will pass additional arguments number for number, for any additonal
@@ arguments which might be needed. I.e., ...
@@
@@ ulocal(%qa, %qa, %q2, %q3, %q4, %4, %5, %6, %7, %8, %9)
@@
@@ ------------------------------------------------------------------------
&~`U`ELSE %va=Not sure what to do with %0 %1.
@@
@@ ------------------------------------------------------------------------
@@ ========================================================================
@@ ------------------------------------------------------------------------
@@
&~`PACK %va=[@@(Packages of Content. Each ~`PACK`<package> attrib should contain a single #dbref; nothing more, nothing less.)]
@@
@@ NOTE: Each content package is installed onto its own separate object.
@@ The #dbref of this object is stored in the respective ~`PACK`<package>
@@ attribute on the unfu~ object. <package> must be a single word with no
@@ spaces ( ), backticks (`), or other dangerous characters.
@@
@@ ------------------------------------------------------------------------
@@ ========================================================================
@@ ------------------------------------------------------------------------
@@ p.s. I'm pretty sure someone with SQL knowledge could make an SQL
@@ content pack which manages translation from MUSH input style (function
@@ calls) to SQL database lingo (which I currently don't speak, but I have
@@ seen, and it looks nothing like softcode).
@@ Since I really don't know the mechanics involved in this, it could very
@@ well be something as simple as a few function calls which could be
@@ submitted as a patch to the unfu~ system itself.
@@ Either way, it seems possible that this could potentially become a
@@ bridge to virutally any content on any system with which PennMUSH can
@@ interface.
@@ ------------------------------------------------------------------------
@@ ========================================================================
@@ ------------------------------------------------------------------------
@@ ________________________________________________________________________
@@ .:....1....:....2....:....3....:....4....:....5....:....6....:....7....:
@@ ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
@@ CONTENT
@@
@@ unfu~ currently manages content of three types:
@@
@@ TEXT, DATA, and UFUNs.
@@
@@ Content is separated according to these types in their respective
@@ attribute branches: CONTENT`TEXT CONTENT`DATA CONTENT`UFUN.
@@
@@ Each package object may include HEAD and FOOT attributes to store
@@ any information which must be displayed before and after (respectively)
@@ each display of content.
@@
@@ The convention. Only material connected to a package object's CONTENT`
@@ attribute branch is considered content.
@@ All attributes are evaluated with:
@@ ulocal(<attr>, <attr>, [other stuff])
@@ that is, each attribute is evaluated AND told its own path (it knows
@@ itself). Theoretically, this feature could be used to cross-index data,
@@ but I don't have any working examples of that (yet).
@@
@@ Any TEXT attribute which is both a leaf and branch will be followed by a
@@ list of its leaf attributes longer than one character (see the notes on
@@ single-character leaf/branch names, below).
@@
@@ DATA content works slightly differently. Any content in the
@@ CONTENT`DATA branch assumes employment of data structures. For
@@ example: all weapons will have a common set of data characteristics,
@@ all spells will have a common set of data characteristics, etc.
@@ Thus, each leaf of the DATA branch will contain its own data structure
@@ list. For example:
@@ CONTENT`DATA`MONSTER will contain the list of data element attribute
@@ names common to all of its leaf attribs (Monster: Size, HP, etc.),
@@ resulting in something like:
@@
@@ CONTENT`DATA`MONSTER`gremlin
@@ CONTENT`DATA`MONSTER`gremlin`size
@@ CONTENT`DATA`MONSTER`gremlin`hp
@@ etc.
@@
@@ Again, there is a single-character exception (see the exception below)
@@
@@ and
@@
@@ Attribute name segments (leaf/branch-es) longer than one digit are
@@ automatically considered sub-elements of their parent branch segment
@@ and processed according to the content type (in TEXT and DATA branches).
@@
@@ Single-digit attribute name segments are ignored by the unfu~ system
@@ when they are part of the immediately succeeding leaf set from the
@@ current branch.
@@ Eventually, single digit attribs will be divided into three groups:
@@ 1. 0-9 and A-Z (unfu~ currently plans to never use these, leaving
@@ them always available to the packs, invisibly... think similar to the
@@ single digit %q-registers 0-9 and A-Z).
@@ 2. all other characters which are valid in attribute names. These will
@@ be sorted and assessed for internal use.
@@ 3. (I said three groups, didn't I?)
@@
@@ The UFUN branch is, as it appears, a place for UFUNs. The Display
@@ package (posted alongside this) contains an example of a Display UFUN.
@@ Not much to explain here. Some values are necessary/optional
@@ (width/ansi), blah blah blah, but basically unfu~() serves as a single
@@ function which can call an unlimited number of other functions.
@@
@@ These features avail content to both packaged display (what are the
@@ rules, show me the stats of 'that', and make it look nice, dang it!)
@@ and individualized feature reference (abilities, durations, whatever
@@ for softcode automation).
@@
@@ Using backticks in the <path> can help distinguish between two attribs
@@ with similar looking paths.
@@ Example:
@@
@@ unfu~warp~fest attribs
@@ #-2 Too many matches. Choose one:
@@ MANIFESTO ATTRIBS
@@ MANIFESTO REGISTRY ATTRIBS
@@
@@ To display the first entry, do:
@@
@@ unfu~warp~fest manifesto`attribs
@@
@@ (The error message returns the full paths, line by line, of all entries
@@ matching the query. Use the info to help your query specificity.
@@ Usually, the backticks are not necessary; but, in some rare instances
@@ -- like this one, they not only remove uncertainty, but also fill out
@@ necessity.)
@@
@@ FINAL NOTE: There is a difference in spelling between "unfu~" and "UFUN"
@@ because:
@@
@@ UFUN is U[ser-defined] FUN[ction] -- a PennMUSH term/operation.
@@
@@ unfu~ is derived from SNAFU: S[ituation] N[ormal], A[ll] F[ouled] U[p]
@@ i.e., un-FU.
@@
@@ As in: unfu~(<this mess>)
@@
@@ ------------------------------------------------------------------------
@@ ========================================================================
@@
- Printer-friendly version
- Login or register to post comments

Click 

infinity ^ infinity ^ infinity
The addition of parenting/unparenting in ~`U`PATH, removes the need for some dbref-referencing activities, and opens the door for direct access to unfu~ system functions from within the content (general purpose tabling stuff, blah, blah - NOTE: contributions are welcomed at community.pennmush.org via reply post; just put your code in a post).
This may create evolutionary changes to the way tree leaves are auto-processed, dunno; but, it creates a full, equal embracing of each and every content pack, with no limit to the number of packs possible. In fact, if the number of utility functions becomes significant, they can be packaged onto a separate object; and parent all the individual packs can be parented to this widget, leaving the central unfu object to continue selecting it's own parent (thus, maintaining it's connected path to the utility functions, with unlimited paths thereto).
It's the "Eddie Haskell" widget... a virtual parent kiss-up.
Irony:
Just as I thought many_attribs might make parenting a thing of the past for me (still useful for code sharing ala puppets and such - many things parented to a single object, but no longer needed for dividing up large systems into attrib-limit-sized chunks), I turned around and
...bang...
without paying attention to where I'm going, I ram the top of my head into the corner of the unlimited-parents-with-unlimited-attributes cabinet.
BTW, this corner is so sharp, that it broke flesh and hit bone with the fact that this "infinity squared" capacity can yet be multiplied times unfu's self-referencing reparenting process;
(I²)² - a binary trifecta?
this can be repeated recursively up to the parent depth minus 1;
(I²)(²×(max parent depth - 1))
and, if that isn't enough, the fact that reparenting is preserved across recursions means it can be self-squared again a number of times equal to the remaining available function limits:
(I²)(²×(max parent depth - 1)×(function limit remains))
and all of this available to the unlimited potential of packages to use it throughout the course of the future.
Did I overlook something? I probably made a mathematial/logical error in there somewhere. Even if I did, though, I think it could be argued that this is virtually equal to infinity not simply multiplied times
itself, but actually raised to the power of itself, and that it does so somewhat recursively -- i.e., remaining capacity is always equal to the remainder of maxdbsize limits (max objects, total mb, whatever).
Maybe it'll be enough... just barely.
Now might be a good time to revisit Master Room globals, per warped~core manifesto philosophy. Considering the fact that this reparenting process can be applied to MR objects (one object which manages many global packages of relatively equal user/power levels), reducing the actual number of objects searched from {all individual systems in MR} to {a few objects in MR representing packs of systems}.
grep self for attrib matching syntax (containing parent dbref), parent thereto, grep parent for attrib containing $command matching syntax, feed syntax to self/attrib, unparent self.
Looks like there are a whole bunch of new resultant effects from these self-defining "infinity" parameters which the warped~core for should be evolutionarily considering (similar to the way attrib trees affected attrib naming conventions).