5e2 @verb #101:"bf_toliteral" this none this rxdo #55 @program #101:"bf_toliteral" this none this "***** As of 2002-10-01, this is IMPLEMENTED IN-SERVER. $server_options.protect_toliteral == 0 *****" "" "toliteral is overridden so that WAIFs are returned in a form that can be eval()'d and de-to-literalled, although you will not receive a value that is equal to the original valie (you will receive a cloned waif). It has to handle lists itself too, because there can be WAIFs in lists. This verb would die on a list that was too deep, or any WAIF with cyclic references (which is thankfully prevented by the server for other, unrelated reasons)." "... If there are problems with this raising E_MAXREC or E_TICKS, uhm... well, I don't think we want to put a suspend in toliteral(), and we can't do much about the MAXREC... if it's a serious problem, disable this verb." set_task_perms(caller_perms()) if (typeof(args[1]) == $LIST) STR = "" for x in (args[1]) STR = tostr(STR, $bf_toliteral(x), ", ") endfor return tostr("{", `STR[1..$ - 2] ! E_RANGE => ""', "}") elseif (typeof(args[1]) != WAIF) return pass(@args) endif l = tostr(args[1]->class) + ":new_literal({" first = 1 for x in (args[1]->class:all_properties()) if (length(x) && x[1] == ":") l = l + (first ? "" | ", ") + "{\"" + x[2..$] + "\", " + toliteral(args[1]->(x[2..$])) + "}" first = 0 endif endfor l = l + "})" return l "Last modified by Dax (#789) on Tue May 3 13:45:03 2005 MDT." . 0