<Message did not seem to arrive, 2nd attempt...>
Dear All,
>This is a long desired feature - currently only available using server-side
>Lingo and the Multiuser Server. Best approach (sloppy but it works) is to
>have each handler post their symbol (or other ID) to a global variable when
>they start running:
>
>on yourHandler ...
> gCurrentHandler = #yourHandler
> -- actual code goes here
>end yourHandler
Indeed a very desired feature, and so I have decided to let lingo
generate those scripting additions rather then typing it manually
into each handler... the addHandler will add a line to each script
regsitrating its names, all sent variable names and their values in a
global string to use at the alerthook:
----------------------------------------------------
on addHandlerRegistration
temp=the itemdelimiter
the itemdelimiter=","
repeat with c=1 to the number of castlibs
repeat with m=1 to the number of members of castlib c
mem=member(m,c)
if mem.type=#script then
t=mem.scriptText
memnam=mem.name
if memnam="" then memnam = string(mem)
repeat with l = 1 to t.line.count
th=t.line[l]
if th starts "on " then
if offset("(",th)<>0 then put space into char
(offset("(",th)) of th
if offset(")",th)<>0 then put space into char
(offset(")",th)) of th
nam=th.word[2]
if nam="addHandlerRegistration" or
nam="removeHandlerRegistration" or nam="regisrateHandler" or
nam="getPropertyDescriptionList" or memnam="show error" or
nam="alertHook" then next repeat
rest=th.word[3..th.word.count]
if rest starts "--" then rest = ""
if offset("--",rest)<>0 then
rest=rest.char[1..(offset("--",rest)-1)]
varstr=""
repeat with v=1 to rest.item.count
if rest="" then exit repeat
var=rest.item[v]
repeat while var.char[1]=" "
delete char 1 of var
end repeat
varstr=varstr"e&var&&" = "&"e&"&string("&var&")&return"
if v<>rest.item.count then varstr=varstr&"&"
end repeat
isvars=""
if varstr<>"" then isvars=","&varstr
zin="regisrateHandler(""e&nam"e&",""e&memnam"e&isvars&")"
if t.line[l+1] starts "regisrateHandler" then
put zin into line[l+1] of t
else
if t.line[l+1]<>zin then put return&zin after line l of t
end if
end if
end repeat
mem.scriptText=t
end if
end repeat -- members
end repeat -- castlibs
the itemdelimiter=temp
end
------- to clean the program after debugging
on removeHandlerRegistration
repeat with c=1 to the number of castlibs
repeat with m=1 to the number of members of castlib c
mem=member(m,c)
if mem.type=#script then
t=mem.scriptText
if not (t contains "regisrateHandler") then next repeat
repeat with l = 1 to (t.line.count-1)
th=t.line[l+1]
repeat while th.char[1]=space
delete char 1 of th
end repeat
ch=th.char[1..16]
if ch="regisrateHandler" then
delete line (l+1) of t
end if
end repeat
mem.scriptText=t
end if
end repeat
end repeat
end
-------- this is the registering handler itself, being called from
each handler at runtime
on regisrateHandler nam, mem, vars
global continueRegistrating
if not continueRegistrating then exit
global ErrorString
ErrorString="handler "&nam&" of member "&mem&":"&return&return&Vars
end
--------
on alertHook me, err, msg
global continueRegistrating
continueRegistrating=0 -- making sure registration stops after the error
errorReport=err&return&msg&return&ErrorString
-- here you can do whatever you wish with the resulting error string
end
---------------------------------------------------
it does work wonderfully, even if slowing the application quite a
bit. another option is to add a first line to scripts that should not
be marked for registration, either because they happen to often and
therefore will slow the whole too much, or simply if they are not
likely to produce an error.
I wonder if macromedia is working on lingo tools for shockwave
debugging at all. these seem quite nesseccary considering the amount
of time it takes to trace a simple bug in such a 'minimal feedback'
environment.
Best Regards to all,
Enjoy,
Yariv Alter Fin
[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/lingo-l.cgi To post messages to the list,
email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo. Thanks!]