XFIRÆ[39VMpami,~pamm¨ ÿÿÿÿXFIRÆ[pami pamm¨,0‚*YEKüÜtSAC|>–FCRDTàeerf ÿÿÿÿ*SACŠxtcLxBknuj²[ knujª[ÿÿÿÿfniCF<SREV º[manLh:XrcsL˜šBeerf *YEKü *SAC fniCFCRDxtcL SREV SREV SREV SREV  lccFCRDTT~~ <<SöfniCF &(8?‚0C:\Mes documents*SACtSAC|> >n =ë=ü=ü=ü=ü>>>>>>>$-- OBJECT UTILITIES -- -- -- on reportProps(listOrObject) -- Returns a string where the property and value pairs of -- listOrObject appear on successive lines. -- -- on findValue(anyValue) -- Performs a tree-walk of all global lists and objects and -- returns the list of all items whose value is . -- -- on findIlk(whichIlk) -- Performs a tree-walk of all global lists and objects and -- returns the list of all items whose ilk is . -- -- © 17 July 2000, James Newton on reportProps(listOrObject, level, doneList) ------------------------ -- * Returns a string where the property and value pairs of -- listOrObject appear on successive lines. -- -- For a simple result, use the following syntax: -- -- put reportProps(listOrObject) -- -- For details, use a non-void value for . The best value is -- zero: -- -- put reportProps(listOrObject, 0) -------------------------------------------------------------------- if not voidP(level) then if not integerP(level) then level = 0 else level = max(0, level) end if end if objectIlk = ilk(listOrObject) case objectIlk of #instance, #script, #list, #propList: -- Find length of longest propertyName (including trailing ": ") propCount = listOrObject.count() maxLength = getMaxPropLength(listOrObject) + 4 -- "#: " otherwise exit end case if not propCount then return string(listOrObject) end if if not ilk(doneList, #list) then doneList = [0: listOrObject] end if tabs = "" i = level repeat while i tabs = tabs & TAB i = i - 1 end repeat -- Create property-value-pair string reportString = RETURN if objectIlk = #list then maxLength = maxLength + 1 -- "[]: " instead of "#: " repeat with i = 1 to propCount theProp = "["&i&"]" theValue = convertFormat(listOrObject[i], theProp, level, doneList) itemString = tabs&getItemString(theProp, theValue, maxLength) put itemString after reportString end repeat else repeat with i = 1 to propCount theProp = listOrObject.getPropAt(i) theValue = convertFormat(listOrObject[theProp], theProp, level, doneList) theProp = convertFormat(theProp) itemString = tabs&getItemString(theProp, theValue, maxLength) put itemString after reportString end repeat end if delete the last char of reportString if not level then put RETURN after reportString end if return reportString end reportProps on convertFormat(theValue, theProp, level, doneList) -- Convert to appropriate string case ilk(theValue) of #symbol: theValue = "#" & theValue #string: theValue = QUOTE&theValue"E #void: theValue = "" #list, #propList, #script: if voidP(level) then return theValue end if alias = getAlias(theValue, theProp, doneList) if voidP(alias) then theValue = reportProps(theValue, level + 1, doneList) else theValue = "< Treated above as "&alias&" >" end if #instance: if voidP(level) then return string(theValue) end if temp = string(theValue) if temp.word[1] = "" end if else return temp end if otherwise theValue = string(theValue) end case return theValue end convertFormat on getItemString(theProp, theValue, maxLength) theProp = theProp & ": " -- Align data spaces = maxLength - theProp.length repeat while spaces theProp = theProp & " " spaces = spaces - 1 end repeat return theProp&theValue&RETURN end on getMaxPropLength(listOrObject) maxLength = 0 case ilk(listOrObject) of #list: i = listOrObject.count() repeat while i maxLength = maxLength + 1 i = i / 10 end repeat #propList, #instance, #script: i = listOrObject.count() repeat while i theProp = listOrObject.getPropAt(i) propLength = string(theProp).length if maxLength < propLength then maxLength = propLength end if i = i - 1 end repeat end case return maxLength end getMaxPropLength on getAlias(listOrObject, theProp, doneList) itemCount = listOrObject.count() if not itemCount then return VOID end if position = doneList.getPos(listOrObject) if position then -- Workaround for empty list quirk if not listIsEmpty(listOrObject) then doneCount = doneList.count() repeat with i = position to doneCount if listsAreIdentical(listOrObject, doneList[i]) then return convertFormat(doneList.getPropAt(i)) end if end repeat end if end if doneList.addProp(theProp, listOrObject) return VOID end getAlias on listIsEmpty(theList) i = theList.count() repeat while i theItem = theList[i] if listP(theItem) then if theItem.count() then return listIsEmpty(theItem) end if else return FALSE end if i = i - 1 end repeat return TRUE end listIsEmpty on listsAreIdentical(list1, list2) ----------------------------------- -- * Returns TRUE if and are pointers to the same -- list. Returns FALSE in all other cases. -- -- The test is carried out by adding a new item to and -- checking if it appears in the same place in . The chances -- that happens to contain the test element in the correct -- position are tiny, but non-zero. -------------------------------------------------------------------- listIlk = ilk(list1) if ilk(list2) <> listIlk then return FALSE end if case listIlk of #list: identity = symbol("listCheck"&the ticks) list1.add(identity) position = list1.getPos(identity) if position > list2.count() then identity = FALSE else identity = (list2[position] = identity) end if list1.deleteAt(position) return identity #propList: identity = symbol("listCheck"&the ticks) list1.addProp(identity, identity) position = list1.findPos(identity) if position > list2.count() then identity = FALSE else identity = (list2[position] = identity) end if list1.deleteAt(position) return identity otherwise return FALSE end case end listsAreIdentical --*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- on findValue(aValue, hostObject, thisPath, listOfPaths, doneList)-- -- * Performs a tree-walk of all global lists and objects and -- returns the list of all items whose value is . -- -- If is defined then the search is limited to that -- object and its sub-objects. -- -- There is no need to use the parameters , -- or in your call: these are used internally by the -- handler when it calls itself recursively. -------------------------------------------------------------------- if ilk(listOfPaths) <> #list then listOfPaths = [] end if if ilk(doneList) <> #list then doneList = [] end if if objectP(hostObject) then objectName = string(hostObject) if objectName starts " #window then next repeat end if windowName = QUOTE&theWindow.name"E tell theWindow thisPath = "(the actorList)" findValue(aValue,the actorList,thisPath,listOfPaths,doneList) spriteNumber = the lastChannel repeat while spriteNumber instanceList = sprite(spriteNumber).scriptInstanceList thisPath = "  (sprite "&spriteNumber&").scriptInstanceList" findValue(aValue,instanceList,thisPath,listOfPaths,doneList) spriteNumber = spriteNumber - 1 end repeat end tell end repeat if (the globals.version).char[1] > 7 then -- the timeOutList counter = the timeOutList.count() repeat with i = 1 to counter timeOutObject = timeOut(i) if not ilk(timeOutObject, #timeOut) then next repeat end if thisPath = "timeOut("&i&")" if timeOutObject.name = aValue then listOfPaths.append(thisPath&".name") end if if timeOutObject.persistent = aValue then listOfPaths.append(thisPath&".persistent") end if if timeOutObject.target = aValue then listOfPaths.append(thisPath&".target") else findValue(aValue, timeOutObject.target, thisPath&".target", listOfPaths, doneList) end if if timeOutObject.time = aValue then listOfPaths.append(thisPath&".time") end if if timeOutObject.timeOutHandler = aValue then listOfPaths.append(thisPath&".timeOutHandler") end if end repeat end if end if return listOfPaths end findValue on findIlk(whichIlk, hostObject, thisPath, listOfPaths, doneList) ---- -- * Performs a tree-walk of all global lists and objects and -- returns the list of all items whose ilk is . -- -- If is defined then the search is limited to that -- object and its sub-objects. -- -- There is no need to use the parameters , -- or in your call: these are used internally by the -- handler when it calls itself recursively. -- -- Example: put findIlk(#window) -- -- ["(the globals).gMIAW", "(the windowList)[1]"] -------------------------------------------------------------------- if ilk(listOfPaths) <> #list then listOfPaths = [] end if if ilk(doneList) <> #list then doneList = [] end if if objectP(hostObject) then objectName = string(hostObject) if objectName starts "(the actorList)" tell theWindow -- the actorList of MIAW findIlk(whichIlk,the actorList,thisPath,listOfPaths,doneList) -- scriptInstanceLists of MIAW spriteNumber = the lastChannel repeat while spriteNumber instanceList = sprite(spriteNumber).scriptInstanceList thisPath = "  (sprite "&spriteNumber&").scriptInstanceList" findIlk(whichIlk,instanceList,thisPath,listOfPaths,doneList) spriteNumber = spriteNumber - 1 end repeat end tell end repeat if (the globals.version).char[1] > 7 then -- the timeOutList counter = the timeOutList.count() repeat with i = 1 to counter timeOutObject = timeOut(i) if not ilk(timeOutObject, #timeOut) then next repeat end if thisPath = "timeOut("&i&")" case whichIlk of #string: listOfPaths.append(thisPath&".name") #integer: listOfPaths.append(thisPath&".persistent") listOfPaths.append(thisPath&".time") #symbol: listOfPaths.append(thisPath&".timeOutHandler") end case if ilk(timeOutObject.target, whichIlk) then listOfPaths.append(thisPath&".target") end if findIlk(whichIlk, timeOutObject.target, thisPath&".target", listOfPaths, doneList) end repeat end if end if return listOfPaths end findIlkObject UtilitiesRòûËË,xtcLx` ÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ‚ÞàrcsL˜˜˜\ÿÿÿÿ‚…Àÿÿ˜\\ \Eê†ÿÿ†Ö\ btItÿÿ%¾äìð 4a'ðÿÿ4LRT‚ Tÿÿ^ìîö‡›öÿÿ†”š¢¿·¢ÿÿO¶ Ð ÿÿãþDã,ÿÿ!4 V ` xÒ‹ xÿÿ9 > H`,A¦Š`KCW •KCW • Q“ KCW QKCW RLdE •dE•dE• dE•KCgRKCVR“eL• KCWBWKECW • KCQDRKR L •LD RL R TDR(LE•[LRR L L •CDL D R0KL CgL0KKCVR8LL0L8LCV R@L@™%L R ”E“XR L L •KKL CgR0KL0CgL0KKCVR8L0CVR0LL0L8LCV R@L@™%L R ”MŠÐ([K• D(™%L(BW!         KCW d…"• D0K Q“dE•D8K D@ Q“ñd…#• DHQ“ádE•dE• dE•IKCW • eKBWKKKCVRLCW •KKKCVQ“ DPL DX Q“ƒdE •sKCW •eKCWBWKCWRL…$C§%D`•8KKKCVRLCW •KKKCVQ“ DhL Dp Q“ eLBW“ KCWQeKBW &'       KDx QKK¡(RL•KD€ QLRTKK Dˆ BW !)  RKCW dE•%KCgRL•LRL RT“TdE•dE • dE•RLE•KD¨ L D° R(“ KD¸ L R(LK•KL(B§<“FLCW dE•dE• dE •&K LC§+•KLL(KK BV“B—?eLR”°“ DÀQKŸ@KKK BVDÈQKŸAKKK BVDÐQKŸBKKK BVŸCR0L0•2L0C—D¡ER8DØL0 Dà QKL8KKK BVL0R0”1ŸACgR@RLL@ •”LC—FRHLHCW …F•“pDèLH¡G Dð RPLHDøLP „ QKŸBKKK BVŸCR0L0•;L0C£D¡ER8„L „ L0 „ QKL8KKK BVL0R0”:LR”–Ÿ@¡V…WC§%•ÙŸXCgR@RLL@ •ÃLC—YRXLX…YCW •“Ÿ„ L „( QLX¡GK•KK„0 B§RLE•K„h L „p R(“K„x L R(LCW dK•KL(B§<“>dE•dE• dE •&K LC§+•KLL(KK BV“B—?eLR”³“„€QKŸ@KKK BV„ˆQKŸAKKK BV„QKŸBKKK BV„˜QKŸXKKK BVŸCR0L0•4L0C—D¡ER8„ L0 „¨ QKL8KKK BVL0R0”3ŸACgR@RLL@ •—LC—FRHLH…FCW •“s„°LH¡G „¸ RP„ÀLP „È QLHKŸBKKK BVŸCR0L0•;L0C£D¡ER8„ÐL „Ø L0 „à QKL8KKK BVL0R0”:LR”™Ÿ@¡V…WC§%•ÑŸXCgR@RLL@ •»LC—YRXLX…YCW •“—„èL „ð QKdE•KK„ø B§<“?d…`• KK„ B§< Treated above as  > :   listCheck listCheck (the actorList) (sprite ).scriptInstanceList timeOut().name .persistent.target.target.time.timeOutHandler (the actorList) (sprite ).scriptInstanceList timeOut().name .persistent.time.timeOutHandler.target.targetmanLhTTb reportProps convertFormat getItemStringgetMaxPropLengthgetAlias listIsEmptylistsAreIdentical findValuefindIlkvoidpintegerpmaxilkinstancescriptlistpropListcountreturnstringgetAt getPropAtdoneListlevel listOrObject itemString reportStringi objectIlk propCounttheValueTabstheProp maxLengthsymbolvoidwordgetPropaliastemplengthspaces propLengthgetPosaddPropindex doneCount itemCountlistptheListtheItemticksadddeleteAtfindPoslist1list2listIlkidentityobjectpappendelementgetaPropnothingglobals windowList actorList lastChannelspritescriptInstanceListwindowname listOfPaths hostObjectthisPathaValue instanceList spriteNumberpath objectNamehostIlk windowNumber theWindow windowNamewhichIlkpositionversionchar timeOutListtimeout persistenttargettimetimeOutHandler timeOutObjectcounterintegerx lccpamFSREV U