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