Now using emit_conditional_call (changed indenting)
parent
925f23515d
commit
5e9632e781
|
@ -84,32 +84,13 @@ void GlobalFunction::generateSingleFunction(const std::string& toolboxPath,
|
||||||
for (size_t overload = 0; overload < argLists.size(); ++overload) {
|
for (size_t overload = 0; overload < argLists.size(); ++overload) {
|
||||||
const ArgumentList& args = argLists[overload];
|
const ArgumentList& args = argLists[overload];
|
||||||
const ReturnValue& returnVal = returnVals[overload];
|
const ReturnValue& returnVal = returnVals[overload];
|
||||||
size_t nrArgs = args.size();
|
|
||||||
|
|
||||||
const int id = functionNames.size();
|
const int id = functionNames.size();
|
||||||
|
|
||||||
// Output proxy matlab code
|
// Output proxy matlab code
|
||||||
|
mfunctionFile.oss << " " << (overload == 0 ? "" : "else");
|
||||||
// check for number of arguments...
|
argLists[overload].emit_conditional_call(mfunctionFile,
|
||||||
mfunctionFile.oss << (overload == 0 ? "" : "else")
|
returnVals[overload], wrapperName, id, true); // true omits "this"
|
||||||
<< "if length(varargin) == " << nrArgs;
|
|
||||||
if (nrArgs > 0)
|
|
||||||
mfunctionFile.oss << " && ";
|
|
||||||
// ...and their types
|
|
||||||
bool first = true;
|
|
||||||
for (size_t i = 0; i < nrArgs; i++) {
|
|
||||||
if (!first)
|
|
||||||
mfunctionFile.oss << " && ";
|
|
||||||
mfunctionFile.oss << "isa(varargin{" << i + 1 << "},'"
|
|
||||||
<< args[i].matlabClass(".") << "')";
|
|
||||||
first = false;
|
|
||||||
}
|
|
||||||
mfunctionFile.oss << "\n";
|
|
||||||
|
|
||||||
// output call to C++ wrapper
|
|
||||||
mfunctionFile.oss << " ";
|
|
||||||
returnVal.emit_matlab(mfunctionFile);
|
|
||||||
mfunctionFile.oss << wrapperName << "(" << id << ", varargin{:});\n";
|
|
||||||
|
|
||||||
// Output C++ wrapper code
|
// Output C++ wrapper code
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue