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

This commit is contained in:
hbristow 2013-06-21 23:39:28 -07:00
parent f45bc35652
commit 0263727b53
2 changed files with 10 additions and 4 deletions

View File

@ -66,5 +66,5 @@
{% for opt in fun.opt|outputs %}
outputs[{{loop.index0 + fun.rtp|void|not + fun.req|outputs|length}}] = {{opt.name}};
{% endfor %}
{%- endmacro -%}
{% endmacro %}

View File

@ -36,9 +36,15 @@ void mexFunction(int nlhs, mxArray* plhs[],
// setup
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) }}
// setdown
// push the outputs back to matlab
for (size_t n = 0; n < nlhs; ++n) {
plhs[n] = outputs[n].mxArray();
}
}