Now using ArgumentList::emit_prototype everywhere, for non copy/paste code
parent
4403d47865
commit
95b85e8494
|
@ -29,7 +29,6 @@
|
||||||
//#include <cstdint> // on Linux GCC: fails with error regarding needing C++0x std flags
|
//#include <cstdint> // on Linux GCC: fails with error regarding needing C++0x std flags
|
||||||
//#include <cinttypes> // same failure as above
|
//#include <cinttypes> // same failure as above
|
||||||
#include <stdint.h> // works on Linux GCC
|
#include <stdint.h> // works on Linux GCC
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace wrap;
|
using namespace wrap;
|
||||||
|
|
||||||
|
@ -389,17 +388,9 @@ void Class::comment_fragment(FileWriter& proxyFile) const {
|
||||||
if (!constructor.args_list.empty())
|
if (!constructor.args_list.empty())
|
||||||
proxyFile.oss << "%\n%-------Constructors-------\n";
|
proxyFile.oss << "%\n%-------Constructors-------\n";
|
||||||
BOOST_FOREACH(ArgumentList argList, constructor.args_list) {
|
BOOST_FOREACH(ArgumentList argList, constructor.args_list) {
|
||||||
string up_name = boost::to_upper_copy(name);
|
proxyFile.oss << "%";
|
||||||
proxyFile.oss << "%" << name << "(";
|
argList.emit_prototype(proxyFile, name);
|
||||||
unsigned int i = 0;
|
proxyFile.oss << "\n";
|
||||||
BOOST_FOREACH(const Argument& arg, argList) {
|
|
||||||
if (i != argList.size() - 1)
|
|
||||||
proxyFile.oss << arg.type << " " << arg.name << ", ";
|
|
||||||
else
|
|
||||||
proxyFile.oss << arg.type << " " << arg.name;
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
proxyFile.oss << ")\n";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!methods.empty())
|
if (!methods.empty())
|
||||||
|
@ -419,18 +410,9 @@ void Class::comment_fragment(FileWriter& proxyFile) const {
|
||||||
BOOST_FOREACH(const StaticMethods::value_type& name_m, static_methods) {
|
BOOST_FOREACH(const StaticMethods::value_type& name_m, static_methods) {
|
||||||
const StaticMethod& m = name_m.second;
|
const StaticMethod& m = name_m.second;
|
||||||
BOOST_FOREACH(ArgumentList argList, m.argLists) {
|
BOOST_FOREACH(ArgumentList argList, m.argLists) {
|
||||||
string up_name = boost::to_upper_copy(m.name);
|
proxyFile.oss << "%";
|
||||||
proxyFile.oss << "%" << m.name << "(";
|
argList.emit_prototype(proxyFile, m.name);
|
||||||
unsigned int i = 0;
|
proxyFile.oss << " : returns "
|
||||||
BOOST_FOREACH(const Argument& arg, argList) {
|
|
||||||
if (i != argList.size() - 1)
|
|
||||||
proxyFile.oss << arg.type << " " << arg.name << ", ";
|
|
||||||
else
|
|
||||||
proxyFile.oss << arg.type << " " << arg.name;
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
|
|
||||||
proxyFile.oss << ") : returns "
|
|
||||||
<< m.returnVals[0].return_type(false, m.returnVals[0].pair) << endl;
|
<< m.returnVals[0].return_type(false, m.returnVals[0].pair) << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,14 +15,15 @@
|
||||||
* @author Richard Roberts
|
* @author Richard Roberts
|
||||||
**/
|
**/
|
||||||
|
|
||||||
#include <iostream>
|
#include "Method.h"
|
||||||
#include <fstream>
|
#include "utilities.h"
|
||||||
|
|
||||||
#include <boost/foreach.hpp>
|
#include <boost/foreach.hpp>
|
||||||
#include <boost/lexical_cast.hpp>
|
#include <boost/lexical_cast.hpp>
|
||||||
|
#include <boost/algorithm/string.hpp>
|
||||||
|
|
||||||
#include "Method.h"
|
#include <iostream>
|
||||||
#include "utilities.h"
|
#include <fstream>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace wrap;
|
using namespace wrap;
|
||||||
|
@ -44,47 +45,38 @@ void Method::proxy_wrapper_fragments(FileWriter& proxyFile,
|
||||||
const string& wrapperName, const TypeAttributesTable& typeAttributes,
|
const string& wrapperName, const TypeAttributesTable& typeAttributes,
|
||||||
vector<string>& functionNames) const {
|
vector<string>& functionNames) const {
|
||||||
|
|
||||||
|
// Create function header
|
||||||
proxyFile.oss << " function varargout = " << name << "(this, varargin)\n";
|
proxyFile.oss << " function varargout = " << name << "(this, varargin)\n";
|
||||||
//Comments for documentation
|
|
||||||
|
// Emit comments for documentation
|
||||||
string up_name = boost::to_upper_copy(name);
|
string up_name = boost::to_upper_copy(name);
|
||||||
proxyFile.oss << " % " << up_name << " usage:";
|
proxyFile.oss << " % " << up_name << " usage: ";
|
||||||
unsigned int argLCount = 0;
|
unsigned int argLCount = 0;
|
||||||
BOOST_FOREACH(ArgumentList argList, argLists) {
|
BOOST_FOREACH(ArgumentList argList, argLists) {
|
||||||
proxyFile.oss << " " << name << "(";
|
argList.emit_prototype(proxyFile, name);
|
||||||
unsigned int i = 0;
|
|
||||||
BOOST_FOREACH(const Argument& arg, argList) {
|
|
||||||
if (i != argList.size() - 1)
|
|
||||||
proxyFile.oss << arg.type << " " << arg.name << ", ";
|
|
||||||
else
|
|
||||||
proxyFile.oss << arg.type << " " << arg.name;
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
if (argLCount != argLists.size() - 1)
|
if (argLCount != argLists.size() - 1)
|
||||||
proxyFile.oss << "), ";
|
proxyFile.oss << ", ";
|
||||||
else
|
else
|
||||||
proxyFile.oss << ") : returns "
|
proxyFile.oss << " : returns "
|
||||||
<< returnVals[0].return_type(false, returnVals[0].pair) << endl;
|
<< returnVals[0].return_type(false, returnVals[0].pair) << endl;
|
||||||
argLCount++;
|
argLCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Emit URL to Doxygen page
|
||||||
proxyFile.oss << " % "
|
proxyFile.oss << " % "
|
||||||
<< "Doxygen can be found at http://research.cc.gatech.edu/borg/sites/edu.borg/html/index.html"
|
<< "Doxygen can be found at http://research.cc.gatech.edu/borg/sites/edu.borg/html/index.html"
|
||||||
<< endl;
|
<< endl;
|
||||||
|
|
||||||
|
// Document all overloads, if any
|
||||||
proxyFile.oss << " % " << "" << endl;
|
proxyFile.oss << " % " << "" << endl;
|
||||||
proxyFile.oss << " % " << "Method Overloads" << endl;
|
proxyFile.oss << " % " << "Method Overloads" << endl;
|
||||||
BOOST_FOREACH(ArgumentList argList, argLists) {
|
BOOST_FOREACH(ArgumentList argList, argLists) {
|
||||||
proxyFile.oss << " % " << name << "(";
|
proxyFile.oss << " % ";
|
||||||
unsigned int i = 0;
|
argList.emit_prototype(proxyFile, name);
|
||||||
BOOST_FOREACH(const Argument& arg, argList) {
|
proxyFile.oss << endl;
|
||||||
if (i != argList.size() - 1)
|
|
||||||
proxyFile.oss << arg.type << " " << arg.name << ", ";
|
|
||||||
else
|
|
||||||
proxyFile.oss << arg.type << " " << arg.name;
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
proxyFile.oss << ")" << endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// For all overloads, check the number of arguments
|
||||||
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];
|
||||||
|
|
|
@ -18,13 +18,12 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <list>
|
|
||||||
|
|
||||||
#include "Argument.h"
|
#include "Argument.h"
|
||||||
#include "ReturnValue.h"
|
#include "ReturnValue.h"
|
||||||
#include "TypeAttributesTable.h"
|
#include "TypeAttributesTable.h"
|
||||||
#include <boost/algorithm/string.hpp>
|
|
||||||
|
#include <string>
|
||||||
|
#include <list>
|
||||||
|
|
||||||
namespace wrap {
|
namespace wrap {
|
||||||
|
|
||||||
|
|
|
@ -16,14 +16,15 @@
|
||||||
* @author Richard Roberts
|
* @author Richard Roberts
|
||||||
**/
|
**/
|
||||||
|
|
||||||
#include <iostream>
|
#include "StaticMethod.h"
|
||||||
#include <fstream>
|
#include "utilities.h"
|
||||||
|
|
||||||
#include <boost/foreach.hpp>
|
#include <boost/foreach.hpp>
|
||||||
#include <boost/lexical_cast.hpp>
|
#include <boost/lexical_cast.hpp>
|
||||||
|
#include <boost/algorithm/string.hpp>
|
||||||
|
|
||||||
#include "StaticMethod.h"
|
#include <iostream>
|
||||||
#include "utilities.h"
|
#include <fstream>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace wrap;
|
using namespace wrap;
|
||||||
|
@ -50,22 +51,14 @@ void StaticMethod::proxy_wrapper_fragments(FileWriter& proxyFile,
|
||||||
proxyFile.oss << " function varargout = " << upperName << "(varargin)\n";
|
proxyFile.oss << " function varargout = " << upperName << "(varargin)\n";
|
||||||
//Comments for documentation
|
//Comments for documentation
|
||||||
string up_name = boost::to_upper_copy(name);
|
string up_name = boost::to_upper_copy(name);
|
||||||
proxyFile.oss << " % " << up_name << " usage:";
|
proxyFile.oss << " % " << up_name << " usage: ";
|
||||||
unsigned int argLCount = 0;
|
unsigned int argLCount = 0;
|
||||||
BOOST_FOREACH(ArgumentList argList, argLists) {
|
BOOST_FOREACH(ArgumentList argList, argLists) {
|
||||||
proxyFile.oss << " " << name << "(";
|
argList.emit_prototype(proxyFile, name);
|
||||||
unsigned int i = 0;
|
|
||||||
BOOST_FOREACH(const Argument& arg, argList) {
|
|
||||||
if (i != argList.size() - 1)
|
|
||||||
proxyFile.oss << arg.type << " " << arg.name << ", ";
|
|
||||||
else
|
|
||||||
proxyFile.oss << arg.type << " " << arg.name;
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
if (argLCount != argLists.size() - 1)
|
if (argLCount != argLists.size() - 1)
|
||||||
proxyFile.oss << "), ";
|
proxyFile.oss << ", ";
|
||||||
else
|
else
|
||||||
proxyFile.oss << ") : returns "
|
proxyFile.oss << " : returns "
|
||||||
<< returnVals[0].return_type(false, returnVals[0].pair) << endl;
|
<< returnVals[0].return_type(false, returnVals[0].pair) << endl;
|
||||||
argLCount++;
|
argLCount++;
|
||||||
}
|
}
|
||||||
|
@ -76,16 +69,9 @@ void StaticMethod::proxy_wrapper_fragments(FileWriter& proxyFile,
|
||||||
proxyFile.oss << " % " << "" << endl;
|
proxyFile.oss << " % " << "" << endl;
|
||||||
proxyFile.oss << " % " << "Usage" << endl;
|
proxyFile.oss << " % " << "Usage" << endl;
|
||||||
BOOST_FOREACH(ArgumentList argList, argLists) {
|
BOOST_FOREACH(ArgumentList argList, argLists) {
|
||||||
proxyFile.oss << " % " << up_name << "(";
|
proxyFile.oss << " % ";
|
||||||
unsigned int i = 0;
|
argList.emit_prototype(proxyFile, up_name);
|
||||||
BOOST_FOREACH(const Argument& arg, argList) {
|
proxyFile.oss << endl;
|
||||||
if (i != argList.size() - 1)
|
|
||||||
proxyFile.oss << arg.type << " " << arg.name << ", ";
|
|
||||||
else
|
|
||||||
proxyFile.oss << arg.type << " " << arg.name;
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
proxyFile.oss << ")" << endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (size_t overload = 0; overload < argLists.size(); ++overload) {
|
for (size_t overload = 0; overload < argLists.size(); ++overload) {
|
||||||
|
|
|
@ -19,13 +19,12 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <list>
|
|
||||||
|
|
||||||
#include "Argument.h"
|
#include "Argument.h"
|
||||||
#include "ReturnValue.h"
|
#include "ReturnValue.h"
|
||||||
#include "TypeAttributesTable.h"
|
#include "TypeAttributesTable.h"
|
||||||
#include <boost/algorithm/string.hpp>
|
|
||||||
|
#include <string>
|
||||||
|
#include <list>
|
||||||
|
|
||||||
namespace wrap {
|
namespace wrap {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue