Skip to content

Commit

Permalink
Make c tests pass
Browse files Browse the repository at this point in the history
  • Loading branch information
finsberg committed Dec 14, 2023
1 parent 9624145 commit 97d22a4
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/gotranx/templates/c.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from textwrap import dedent, indent


def init_state_values(name, values, code):
def init_state_values(name, state_names, state_values, code):
indented_code = indent(code, " ")
indent_values = indent(values, " ")
indent_values = indent(", ".join(f"{n}={v}" for n, v in zip(state_names, state_values)), " ")
return dedent(
f"""
void init_state_values(double* {name}){{
Expand All @@ -16,9 +16,11 @@ def init_state_values(name, values, code):
)


def init_parameter_values(name, values, code):
def init_parameter_values(name, parameter_names, parameter_values, code):
indented_code = indent(code, " ")
indent_values = indent(values, " ")
indent_values = indent(
", ".join(f"{n}={v}" for n, v in zip(parameter_names, parameter_values)), " "
)
return dedent(
f"""
void init_parameter_values(double* {name}){{
Expand All @@ -37,7 +39,7 @@ def method(
states: str,
parameters: str,
values: str,
retrun_name: None = None,
return_name: None = None,
):
indent_states = indent(states, " ")
indent_parameters = indent(parameters, " ")
Expand Down

0 comments on commit 97d22a4

Please sign in to comment.