2 local sandbox = import("core/sandbox")
4 local function begin_debug()
6 system.enabledebuginfo(false)
7 system.setdebughook(function(type=null, src=null, line=null, funcname=null)
9 local action = "unknown"
10 local msg, pre, premsg, isposix = (system.platform_group() == "posix")
11 local mkc = function(light, code)
13 return "\e[%d;%dm".fmt(light, code)
21 end = isposix ? "\e[0m" : ""
26 action = "returned from function %s".fmt(funcname.quote());
29 action = "call to function %s".fmt(funcname.quote())
32 action = "entering new line"
37 pre = colors.red + "**debug**" + colors.end
38 premsg = pre + " in %s<%s:%d>%s: ".fmt(colors.blue, src, line, colors.end)
39 msg = premsg + colors.yellow + action + colors.end + "\n"
47 if(system.argv.len() > 1)
50 local new_argv = system.argv
51 local path = system.argv[1]
58 if(!env.get("system"))
60 env.system.argv = new_argv
66 println("Usage: %s <filename> [args]".fmt(system.argv[0]))