[EMAIL PROTECTED] wrote:
> 
> Is there a way to get UNICON/ICON to provide call stack information of
> the sort one gets whenever there is a runtime error?
> 
> I use a lot of library procedures which are called from lots of places
> in complicated programs.  I have embedded validity checks in these
> procedures which provide me with information about the nature of the
> invalidity, but it would sometimes be helpful to know the context within
> which the procedure was called.
> I have resorted to embedding code in the validity-checking code which
> will generate a runtime error in these library procedures just to get
> that sort of information.  For example,
> 
> &null == ""
> 
> works.  Is there a less "klugy" approach?

I've got the following procedure:
-----------------------------------------------------------
#<p>
#  Compute the current stack trace.  Starting at level <i>n</i> above
#  the current procedure.  Here, <i>n</i> defaults to 0, which will
#  include this procedure in the stack trace.
#  <i>This only works with newer versions of Unicon!</i>
#  <[returns the stack trace as a list, one level per element]>
#</p>
procedure buildStackTrace(n:0  # starting distance from this call
                         )
    local L
    L := []; n -:= 1
    while put(L, image(proc(&current, n+:=1)))
    return L
end
------------------------------------------------------------
(Taken from MiscUtils.icn at http://tapestry.tucson.az.us/unicon)

The argument allows you to 'hide' the lower levels of the stacktrace,
e.g.: buildStackTrace(1) will omit the call to buildStackTrace itself.

However, this approach only shows the call stack, *not* the line
numbers.  If someone can figure out how to get the line numbers
as well, I'd *love* to replace this one!

-- 
Steve Wampler -- [EMAIL PROTECTED]
The gods that smiled on your birth are now laughing out loud.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Unicon-group mailing list
Unicon-group@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/unicon-group

Reply via email to