1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
|
# 23 Feb 1999 - Dracus
alias debug_section {
@ logstate = log
if (log == [on]) {
@ logfile_old = logfile
^set log off
}
^set logfile epic.dbg
^set log on
^set debug 7
}
alias debug_endsection {
set debug 0
^set log off
^set logfile $logfile_old
^set log $logstate
}
#dracus'99
# Time the execution of a given command.
#
# Usage:
# call.time [command]
#
alias call.time {
@ :u1 = utime()
$*
@ :u2 = utime()
stack push set floating_point_math
^set floating_point_math on
@ :time = (shift(u2) - shift(u1)) + ((shift(u2) - shift(u1)) / 1000000)
@ :time = trunc(6 $time)
stack pop set floating_point_math
if (functioncall()) {
return $time
} else {
echo $tdiff($time): $*
}
}
# Trace a given command.
#
# This works by setting the value of debug to debug_level.
# See "/help 4 set debug" for information about this setting.
#
# Usage:
# call.trace [debug_level [command]]
#
alias call.trace {
@ :hooks = [set debug set output_rewrite on window on yell on status_update]
fe ($hooks) foo bar {
stack push $foo $bar
$foo -$bar
}
^set debug $0
$1-
fe ($hooks) foo bar {
stack pop $foo $bar
}
}
# Trace a given command.
#
# Debug_levels is a comma seperated list of values to apply to /xdebug.
# See "/help 4 xdebug" for information about debug_levels, but seperate
# the values with commas instead of spaces.
#
# Usage:
# call.xtrace [debug_levels [command]]
#
alias call.xtrace {
@ :hooks = [set output_rewrite on window on yell on status_update]
@ :debugon = split(, $0)
@ :oxd = strip(+- $debugon)
fe oxd foo {
@ foo = xdebug(*$foo*)
}
fe ($hooks) foo bar {
stack push $foo $bar
}
xdebug $debugon
$1-
xdebug $oxd
fe ($hooks) foo bar {
stack pop $foo $bar
}
}
|