Commit 2f4313fd authored by Martin Bauer's avatar Martin Bauer
Browse files

Merge branch 'function-call-printing' into 'master'

Add own implementation for printing an unknown function

See merge request pycodegen/pystencils!96
parents c4e92d45 5e7d3c9c
......@@ -385,7 +385,8 @@ class CustomSympyPrinter(CCodePrinter):
elif expr.func == int_div:
return "((%s) / (%s))" % (self._print(expr.args[0]), self._print(expr.args[1]))
else:
return super(CustomSympyPrinter, self)._print_Function(expr)
arg_str = ', '.join(self._print(a) for a in expr.args)
return f'{expr.name}({arg_str})'
def _typed_number(self, number, dtype):
res = self._print(number)
......
......@@ -32,8 +32,7 @@ def test_cuda_but_not_c():
})
ast = pystencils.create_kernel(assignments, 'cpu')
code = str(pystencils.show_code(ast))
assert "Not supported" in code
print(pystencils.show_code(ast))
def test_cuda_unknown():
......@@ -46,4 +45,3 @@ def test_cuda_unknown():
ast = pystencils.create_kernel(assignments, 'gpu')
code = str(pystencils.show_code(ast))
print(code)
assert "Not supported in CUDA" in code
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment