Skip to content
Snippets Groups Projects
Commit 11bf8986 authored by Andreas Klöckner's avatar Andreas Klöckner
Browse files

Update AST callback example from Tobi

parent 8921078c
No related branches found
No related tags found
No related merge requests found
......@@ -174,9 +174,25 @@ def test_schedule():
ast = build.ast_from_schedule(schedule)
def cb_print_user(printer, options, node):
print("Callback user called")
printer = printer.print_str("Callback user")
return printer
def cb_print_for(printer, options, node):
print("Callback for called")
printer = printer.print_str("Callback For")
return printer
opts = isl.AstPrintOptions.alloc(isl.DEFAULT_CONTEXT)
opts, cb_print_user_handle = opts.set_print_user(cb_print_user)
opts, cb_print_for_handle = opts.set_print_for(cb_print_for)
printer = isl.Printer.to_str(isl.DEFAULT_CONTEXT)
printer = printer.set_output_format(isl.format.C)
printer = printer.print_ast_node(ast)
printer.print_str("// Start\n")
printer = ast.print_(printer, opts)
printer.print_str("// End")
print(printer.get_str())
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment