ReturnValue now emits, eliminated some copy/paste. Also removed unused verbose field/argument in ReturnValue
parent
05008ecaa3
commit
52cd200718
|
@ -170,14 +170,9 @@ void ArgumentList::emit_conditional_call(FileWriter& file,
|
|||
file.oss << "\n";
|
||||
|
||||
// output call to C++ wrapper
|
||||
string output;
|
||||
if (returnVal.isPair)
|
||||
output = "[ varargout{1} varargout{2} ] = ";
|
||||
else if (returnVal.category1 == ReturnValue::VOID)
|
||||
output = "";
|
||||
else
|
||||
output = "varargout{1} = ";
|
||||
file.oss << " " << output << wrapperName << "(" << id;
|
||||
file.oss << " ";
|
||||
returnVal.emit_matlab(file);
|
||||
file.oss << wrapperName << "(" << id;
|
||||
if (!staticMethod)
|
||||
file.oss << ", this";
|
||||
file.oss << ", varargin{:});\n";
|
||||
|
|
|
@ -103,14 +103,9 @@ void GlobalFunction::generateSingleFunction(const std::string& toolboxPath, cons
|
|||
mfunctionFile.oss << "\n";
|
||||
|
||||
// output call to C++ wrapper
|
||||
string output;
|
||||
if(returnVal.isPair)
|
||||
output = "[ varargout{1} varargout{2} ] = ";
|
||||
else if(returnVal.category1 == ReturnValue::VOID)
|
||||
output = "";
|
||||
else
|
||||
output = "varargout{1} = ";
|
||||
mfunctionFile.oss << " " << output << wrapperName << "(" << id << ", varargin{:});\n";
|
||||
mfunctionFile.oss << " ";
|
||||
returnVal.emit_matlab(mfunctionFile);
|
||||
mfunctionFile.oss << wrapperName << "(" << id << ", varargin{:});\n";
|
||||
|
||||
// Output C++ wrapper code
|
||||
|
||||
|
|
|
@ -78,6 +78,8 @@ void Method::proxy_wrapper_fragments(FileWriter& file, FileWriter& wrapperFile,
|
|||
}
|
||||
}
|
||||
|
||||
// Handle special case of single overload with numeric
|
||||
|
||||
// Check arguments for all overloads
|
||||
for (size_t overload = 0; overload < argLists.size(); ++overload) {
|
||||
|
||||
|
|
|
@ -98,7 +98,7 @@ void Module::parseMarkup(const std::string& data) {
|
|||
// The one with postfix 0 are used to reset the variables after parse.
|
||||
string methodName, methodName0;
|
||||
bool isConst, isConst0 = false;
|
||||
ReturnValue retVal0(verbose), retVal(verbose);
|
||||
ReturnValue retVal0, retVal;
|
||||
Argument arg0, arg;
|
||||
ArgumentList args0, args;
|
||||
vector<string> arg_dup; ///keep track of duplicates
|
||||
|
|
|
@ -141,5 +141,13 @@ void ReturnValue::wrapTypeUnwrap(FileWriter& wrapperFile) const {
|
|||
}
|
||||
}
|
||||
/* ************************************************************************* */
|
||||
void ReturnValue::emit_matlab(FileWriter& file) const {
|
||||
string output;
|
||||
if (isPair)
|
||||
file.oss << "[ varargout{1} varargout{2} ] = ";
|
||||
else if (category1 != ReturnValue::VOID)
|
||||
file.oss << "varargout{1} = ";
|
||||
}
|
||||
/* ************************************************************************* */
|
||||
|
||||
|
||||
|
|
|
@ -27,16 +27,15 @@ struct ReturnValue {
|
|||
CLASS = 1, EIGEN = 2, BASIS = 3, VOID = 4
|
||||
} return_category;
|
||||
|
||||
bool verbose;
|
||||
bool isPtr1, isPtr2, isPair;
|
||||
return_category category1, category2;
|
||||
std::string type1, type2;
|
||||
std::vector<std::string> namespaces1, namespaces2;
|
||||
|
||||
/// Constructor
|
||||
ReturnValue(bool enable_verbosity = true) :
|
||||
verbose(enable_verbosity), isPtr1(false), isPtr2(false), isPair(false), category1(
|
||||
CLASS), category2(CLASS) {
|
||||
ReturnValue() :
|
||||
isPtr1(false), isPtr2(false), isPair(false), category1(CLASS), category2(
|
||||
CLASS) {
|
||||
}
|
||||
|
||||
typedef enum {
|
||||
|
@ -55,6 +54,7 @@ struct ReturnValue {
|
|||
|
||||
void wrapTypeUnwrap(FileWriter& wrapperFile) const;
|
||||
|
||||
void emit_matlab(FileWriter& file) const;
|
||||
};
|
||||
|
||||
} // \namespace wrap
|
||||
|
|
Loading…
Reference in New Issue