Commit 0263727b authored by hbristow's avatar hbristow

Function templates now include the full skeleton, from input to output. Class templates need work

parent f45bc356
...@@ -66,5 +66,5 @@ ...@@ -66,5 +66,5 @@
{% for opt in fun.opt|outputs %} {% for opt in fun.opt|outputs %}
outputs[{{loop.index0 + fun.rtp|void|not + fun.req|outputs|length}}] = {{opt.name}}; outputs[{{loop.index0 + fun.rtp|void|not + fun.req|outputs|length}}] = {{opt.name}};
{% endfor %} {% endfor %}
{%- endmacro -%} {% endmacro %}
...@@ -36,9 +36,15 @@ void mexFunction(int nlhs, mxArray* plhs[], ...@@ -36,9 +36,15 @@ void mexFunction(int nlhs, mxArray* plhs[],
// setup // setup
std::vector<Bridge> inputs(plhs, plhs+nrhs); std::vector<Bridge> inputs(plhs, plhs+nrhs);
std::vector<Bridge> outputs(nlhs); {% set noutputs = fun.rtp|void|not + fun.req|outputs|length + fun.opt|outputs|length %}
{%- if noutputs %}
std::vector<Bridge> outputs({{noutputs}});
{% endif %}
{{ functional.generate(fun) }} {{ functional.generate(fun) }}
// setdown // push the outputs back to matlab
for (size_t n = 0; n < nlhs; ++n) {
plhs[n] = outputs[n].mxArray();
}
} }
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