Skip to content
Snippets Groups Projects
Commit 86354656 authored by swym's avatar swym
Browse files

fix(epicardium): use less collision-prone names for stub-local variables

allow API signatures to contain the names "buffer" and "size"
parent 4247ee09
No related branches found
No related tags found
No related merge requests found
...@@ -150,18 +150,18 @@ def main(): ...@@ -150,18 +150,18 @@ def main():
/* Autogenerated stub for {id} */ /* Autogenerated stub for {id} */
{return_type} {name}({args_str}) {return_type} {name}({args_str})
{{ {{
const int size = {total_size}; const int epc__apistub_size = {total_size};
void*buffer; void*epc__apistub_buffer;
buffer = _api_call_start({id}, size); epc__apistub_buffer = _api_call_start({id}, epc__apistub_size);
/* TODO: Check if buffer is not NULL */ /* TODO: Check if epc__apistub_buffer is not NULL */
""" """
f_client.write(tmp.format(**decl)) f_client.write(tmp.format(**decl))
for i, arg in enumerate(decl["args"]): for i, arg in enumerate(decl["args"]):
tmp = """\ tmp = """\
*({type}*)(buffer + {offset}) = {name}; *({type}*)(epc__apistub_buffer + {offset}) = {name};
""" """
f_client.write(tmp.format(**arg)) f_client.write(tmp.format(**arg))
...@@ -169,14 +169,14 @@ def main(): ...@@ -169,14 +169,14 @@ def main():
# Don't return if return type is void # Don't return if return type is void
tmp = """\ tmp = """\
_api_call_transact(buffer); _api_call_transact(epc__apistub_buffer);
}} }}
""" """
f_client.write(tmp.format(**decl)) f_client.write(tmp.format(**decl))
else: else:
tmp = """\ tmp = """\
return *({return_type}*)_api_call_transact(buffer); return *({return_type}*)_api_call_transact(epc__apistub_buffer);
}} }}
""" """
f_client.write(tmp.format(**decl)) f_client.write(tmp.format(**decl))
...@@ -249,7 +249,7 @@ void __dispatch_isr(api_int_id_t id) ...@@ -249,7 +249,7 @@ void __dispatch_isr(api_int_id_t id)
#include "modules/log.h" #include "modules/log.h"
#include "{header}" #include "{header}"
void __api_dispatch_call(uint32_t id, void*buffer) void __api_dispatch_call(uint32_t id, void*epc__apistub_buffer)
{{ {{
switch (id) {{ switch (id) {{
""" """
...@@ -264,13 +264,13 @@ void __api_dispatch_call(uint32_t id, void*buffer) ...@@ -264,13 +264,13 @@ void __api_dispatch_call(uint32_t id, void*buffer)
else: else:
tmp = """\ tmp = """\
case {id}: case {id}:
*(({return_type}*)buffer) = {name}(""" *(({return_type}*)epc__apistub_buffer) = {name}("""
f_dispatcher.write(tmp.format(**decl)) f_dispatcher.write(tmp.format(**decl))
for i, arg in enumerate(decl["args"]): for i, arg in enumerate(decl["args"]):
arg["comma"] = "" if i == 0 else "," arg["comma"] = "" if i == 0 else ","
tmp = """{comma} tmp = """{comma}
*({type}*)(buffer + {offset})""" *({type}*)(epc__apistub_buffer + {offset})"""
f_dispatcher.write(tmp.format(**arg)) f_dispatcher.write(tmp.format(**arg))
tmp = """ tmp = """
......
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