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