Skip to content

Instantly share code, notes, and snippets.

@bogen
Created August 9, 2014 17:47
Show Gist options
  • Save bogen/8b3981242dc6a9491cf6 to your computer and use it in GitHub Desktop.
Save bogen/8b3981242dc6a9491cf6 to your computer and use it in GitHub Desktop.
scraping getStackTrace () but should use what getStrackTrace uses.
proc cgenTrace (skip:int = 0, drop:int = 16):string =
var a = ""
var b = getStackTrace ()
while a != b:
a = b
b = replace (a, " ", " ")
let c = split (a, "\n")
let e = c.len-(3+skip)
let g = 1+drop;
if (e < 1) or (g > e):
return ""
else:
var f = c [g..e]
reverse (f)
return "\t/* " & f.join ("; ") & "*/"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment