import "macro-todo" as $ import "macro-todo" as {$, :$todo} export macro config = (debugging = true)-> global debugMode = debugging == "true" global debugMacro = true "" export macro showMacro = (name, res)-> if debugMacro then " do txt = #{res} print '[macro ' .. #{name} .. ']' print txt txt " else res export macro asserts = (cond)-> if debugMode $showMacro "assert", "assert #{cond}" else "" export macro assert = (cond)-> if debugMode $showMacro "assert", "assert #{cond}" else "#{cond}" export macro copy = (src, dst, ...)-> assert( src != "_src_" and src != "_dst_" and dst != "_src_" and dst != "_dst_" "copy targets can not be _src_ or _dst_" ) " do local _src_, _dst_ with _dst_ = #{dst} with _src_ = #{src} #{table.concat for field in *{...} do " _dst_.#{field} = _src_.#{field} "}" $ -> global debugMode = true global debugMacro = true