スタックのバックトレースを、フォーマットされた文字列として返します。
説明
プログラミング注意事項
例
{curl 8.0 package}
{package NON-FATAL-ASSERT}
{import Literal from CURL.LANGUAGE.SOURCE}
{import get-backtrace from CURL.RUNTIME.DEBUGGER-SUPPORT}
{let public assertion-failures:int = 0}
{define-macro public {non-fatal-assert ?exp:expression}
{return
{expand-template
{if not ?exp then
{format
out = {get-stderr},
"Assertion failed: '%s'\n%s",
?{Literal {{exp.get-text}.to-String}},
{get-backtrace}
}
set assertion-failures = assertion-failures + 1
}
}
}
}
{curl 8.0 applet}
{import * from NON-FATAL-ASSERT}
{define-proc {foo}:void
{non-fatal-assert 1 + 1 == 3}
}
{define-proc {bar}:void
{foo}
}
{bar}
Assertion failed: '1 + 1 == 3' #0 (0x2afd3dbe) get-backtrace #1 (0x2bb19217) foo at http://www.mysite/foo.curl:4[4] #2 (0x2bc8f225) bar at http://www.mysite/foo.curl:7[5] #3 (0x2bb19285) :top-level-form at http://www.mysite/foo.curl:9[1]