Added include overrides to parser

release/4.3a0
Alex Cunningham 2011-12-09 15:44:35 +00:00
parent d745c85f13
commit 9dff4c35bd
32 changed files with 108 additions and 62 deletions

View File

@ -60,7 +60,7 @@ void Class::matlab_proxy(const string& classFile) {
void Class::matlab_constructors(const string& toolboxPath,const string& nameSpace) { void Class::matlab_constructors(const string& toolboxPath,const string& nameSpace) {
BOOST_FOREACH(Constructor c, constructors) { BOOST_FOREACH(Constructor c, constructors) {
c.matlab_mfile (toolboxPath, qualifiedName()); c.matlab_mfile (toolboxPath, qualifiedName());
c.matlab_wrapper(toolboxPath, qualifiedName("::"), qualifiedName(), nameSpace); c.matlab_wrapper(toolboxPath, qualifiedName("::"), qualifiedName(), nameSpace, includes);
} }
} }
@ -69,7 +69,7 @@ void Class::matlab_methods(const string& classPath, const string& nameSpace) {
string matlabName = qualifiedName(), cppName = qualifiedName("::"); string matlabName = qualifiedName(), cppName = qualifiedName("::");
BOOST_FOREACH(Method m, methods) { BOOST_FOREACH(Method m, methods) {
m.matlab_mfile (classPath); m.matlab_mfile (classPath);
m.matlab_wrapper(classPath, name, cppName, matlabName, nameSpace); m.matlab_wrapper(classPath, name, cppName, matlabName, nameSpace, includes);
} }
} }
@ -78,7 +78,7 @@ void Class::matlab_static_methods(const string& toolboxPath, const string& nameS
string matlabName = qualifiedName(), cppName = qualifiedName("::"); string matlabName = qualifiedName(), cppName = qualifiedName("::");
BOOST_FOREACH(StaticMethod& m, static_methods) { BOOST_FOREACH(StaticMethod& m, static_methods) {
m.matlab_mfile (toolboxPath, qualifiedName()); m.matlab_mfile (toolboxPath, qualifiedName());
m.matlab_wrapper(toolboxPath, name, matlabName, cppName, nameSpace); m.matlab_wrapper(toolboxPath, name, matlabName, cppName, nameSpace, includes);
} }
} }

View File

@ -31,12 +31,13 @@ struct Class {
Class(bool verbose=true) : verbose_(verbose) {} Class(bool verbose=true) : verbose_(verbose) {}
// Then the instance variables are set directly by the Module constructor // Then the instance variables are set directly by the Module constructor
std::string name; ///< Class name std::string name; ///< Class name
std::vector<Constructor> constructors; ///< Class constructors std::vector<Constructor> constructors; ///< Class constructors
std::vector<Method> methods; ///< Class methods std::vector<Method> methods; ///< Class methods
std::vector<StaticMethod> static_methods; ///< Static methods std::vector<StaticMethod> static_methods; ///< Static methods
std::vector<std::string> namespaces; ///< Stack of namespaces std::vector<std::string> namespaces; ///< Stack of namespaces
bool verbose_; ///< verbose flag std::vector<std::string> includes; ///< header include overrides
bool verbose_; ///< verbose flag
// And finally MATLAB code is emitted, methods below called by Module::matlab_code // And finally MATLAB code is emitted, methods below called by Module::matlab_code
void matlab_proxy(const std::string& classFile); ///< emit proxy class void matlab_proxy(const std::string& classFile); ///< emit proxy class

View File

@ -56,7 +56,7 @@ void Constructor::matlab_mfile(const string& toolboxPath, const string& qualifie
if(verbose_) cerr << "generating " << wrapperFile << endl; if(verbose_) cerr << "generating " << wrapperFile << endl;
// generate code // generate code
wrap::emit_header_comment(ofs, "%"); emit_header_comment(ofs, "%");
ofs << "function result = " << matlabName << "(obj"; ofs << "function result = " << matlabName << "(obj";
if (args.size()) ofs << "," << args.names(); if (args.size()) ofs << "," << args.names();
ofs << ")" << endl; ofs << ")" << endl;
@ -71,7 +71,7 @@ void Constructor::matlab_mfile(const string& toolboxPath, const string& qualifie
void Constructor::matlab_wrapper(const string& toolboxPath, void Constructor::matlab_wrapper(const string& toolboxPath,
const string& cppClassName, const string& cppClassName,
const string& matlabClassName, const string& matlabClassName,
const string& nameSpace) const string& nameSpace, const vector<string>& includes)
{ {
string matlabName = matlab_wrapper_name(matlabClassName); string matlabName = matlab_wrapper_name(matlabClassName);
@ -83,9 +83,14 @@ void Constructor::matlab_wrapper(const string& toolboxPath,
if(verbose_) cerr << "generating " << wrapperFile << endl; if(verbose_) cerr << "generating " << wrapperFile << endl;
// generate code // generate code
wrap::emit_header_comment(ofs, "//"); emit_header_comment(ofs, "//");
ofs << "#include <wrap/matlab.h>" << endl; ofs << "#include <wrap/matlab.h>" << endl;
ofs << "#include <" << name << ".h>" << endl; if (includes.empty()) // add a default include
ofs << "#include <" << name << ".h>" << endl;
else {
BOOST_FOREACH(const string& s, includes)
ofs << "#include <" << s << ">" << endl;
}
if (!nameSpace.empty()) ofs << "using namespace " << nameSpace << ";" << endl; if (!nameSpace.empty()) ofs << "using namespace " << nameSpace << ";" << endl;
ofs << "void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[])" << endl; ofs << "void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[])" << endl;
ofs << "{" << endl; ofs << "{" << endl;

View File

@ -18,7 +18,7 @@
#pragma once #pragma once
#include <string> #include <string>
#include <list> #include <vector>
#include "Argument.h" #include "Argument.h"
@ -51,11 +51,11 @@ struct Constructor {
void matlab_mfile(const std::string& toolboxPath, void matlab_mfile(const std::string& toolboxPath,
const std::string& qualifiedMatlabName); const std::string& qualifiedMatlabName);
/// wrapper /// cpp wrapper
void matlab_wrapper(const std::string& toolboxPath, void matlab_wrapper(const std::string& toolboxPath,
const std::string& cppClassName, const std::string& cppClassName,
const std::string& matlabClassName, const std::string& matlabClassName,
const std::string& nameSpace); const std::string& nameSpace, const std::vector<std::string>& includes);
}; };
} // \namespace wrap } // \namespace wrap

View File

@ -52,7 +52,7 @@ void Method::matlab_wrapper(const string& classPath,
const string& className, const string& className,
const string& cppClassName, const string& cppClassName,
const string& matlabClassName, const string& matlabClassName,
const string& nameSpace) const string& nameSpace, const std::vector<std::string>& includes)
{ {
// open destination wrapperFile // open destination wrapperFile
string wrapperFile = classPath + "/" + name + ".cpp"; string wrapperFile = classPath + "/" + name + ".cpp";
@ -65,7 +65,12 @@ void Method::matlab_wrapper(const string& classPath,
// header // header
wrap::emit_header_comment(ofs, "//"); wrap::emit_header_comment(ofs, "//");
ofs << "#include <wrap/matlab.h>\n"; ofs << "#include <wrap/matlab.h>\n";
ofs << "#include <" << className << ".h>\n"; if (includes.empty()) // add a default include
ofs << "#include <" << className << ".h>" << endl;
else {
BOOST_FOREACH(const string& s, includes)
ofs << "#include <" << s << ">" << endl;
}
if (!nameSpace.empty()) ofs << "using namespace " << nameSpace << ";" << endl; if (!nameSpace.empty()) ofs << "using namespace " << nameSpace << ";" << endl;
// call // call

View File

@ -46,7 +46,8 @@ struct Method {
void matlab_wrapper(const std::string& classPath, void matlab_wrapper(const std::string& classPath,
const std::string& className, const std::string& className,
const std::string& cppClassName, const std::string& cppClassName,
const std::string& matlabClassname,const std::string& nameSpace); ///< wrapper const std::string& matlabClassname,const std::string& nameSpace,
const std::vector<std::string>& includes); ///< cpp wrapper
}; };
} // \namespace wrap } // \namespace wrap

View File

@ -169,7 +169,9 @@ Module::Module(const string& interfacePath,
[push_back_a(cls.static_methods, static_method)] [push_back_a(cls.static_methods, static_method)]
[assign_a(static_method,static_method0)]; [assign_a(static_method,static_method0)];
Rule functions_p = constructor_p | method_p | static_method_p; Rule includes_p = str_p("#include") >> ch_p('<') >> (*(anychar_p - '>'))[push_back_a(cls.includes)] >> ch_p('>');
Rule functions_p = includes_p | constructor_p | method_p | static_method_p;
Rule class_p = (str_p("class") >> className_p[assign_a(cls.name)] >> '{' >> Rule class_p = (str_p("class") >> className_p[assign_a(cls.name)] >> '{' >>
*(functions_p | comments_p) >> *(functions_p | comments_p) >>

View File

@ -50,7 +50,8 @@ void StaticMethod::matlab_mfile(const string& toolboxPath, const string& classNa
/* ************************************************************************* */ /* ************************************************************************* */
void StaticMethod::matlab_wrapper(const string& toolboxPath, const string& className, void StaticMethod::matlab_wrapper(const string& toolboxPath, const string& className,
const string& matlabClassName, const string& cppClassName, const string& nameSpace) const string& matlabClassName, const string& cppClassName, const string& nameSpace,
const std::vector<std::string>& includes)
{ {
// open destination wrapperFile // open destination wrapperFile
string full_name = matlabClassName + "_" + name; string full_name = matlabClassName + "_" + name;
@ -64,7 +65,12 @@ void StaticMethod::matlab_wrapper(const string& toolboxPath, const string& class
// header // header
wrap::emit_header_comment(ofs, "//"); wrap::emit_header_comment(ofs, "//");
ofs << "#include <wrap/matlab.h>\n"; ofs << "#include <wrap/matlab.h>\n";
ofs << "#include <" << className << ".h>\n"; if (includes.empty()) // add a default include
ofs << "#include <" << className << ".h>" << endl;
else {
BOOST_FOREACH(const string& s, includes)
ofs << "#include <" << s << ">" << endl;
}
if (!nameSpace.empty()) ofs << "using namespace " << nameSpace << ";" << endl; if (!nameSpace.empty()) ofs << "using namespace " << nameSpace << ";" << endl;
// call // call

View File

@ -47,7 +47,8 @@ struct StaticMethod {
void matlab_mfile(const std::string& toolboxPath, const std::string& className); ///< m-file void matlab_mfile(const std::string& toolboxPath, const std::string& className); ///< m-file
void matlab_wrapper(const std::string& toolboxPath, void matlab_wrapper(const std::string& toolboxPath,
const std::string& className, const std::string& matlabClassName, const std::string& className, const std::string& matlabClassName,
const std::string& cppClassName, const std::string& nameSpace); ///< cpp wrapper const std::string& cppClassName, const std::string& nameSpace,
const std::vector<std::string>& includes); ///< cpp wrapper
}; };
} // \namespace wrap } // \namespace wrap

View File

@ -0,0 +1,10 @@
// automatically generated by wrap on 2011-Dec-08
#include <wrap/matlab.h>
#include <folder/path/to/Test.h>
void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[])
{
checkArguments("arg_EigenConstRef",nargout,nargin-1,1);
shared_ptr<Test> self = unwrap_shared_ptr< Test >(in[0],"Test");
Matrix& value = *unwrap_shared_ptr< Matrix >(in[1], "Matrix");
self->arg_EigenConstRef(value);
}

View File

@ -1,6 +1,6 @@
// automatically generated by wrap on 2011-Dec-06 // automatically generated by wrap on 2011-Dec-08
#include <wrap/matlab.h> #include <wrap/matlab.h>
#include <Test.h> #include <folder/path/to/Test.h>
void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[]) void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[])
{ {
checkArguments("create_MixedPtrs",nargout,nargin-1,0); checkArguments("create_MixedPtrs",nargout,nargin-1,0);

View File

@ -1,6 +1,6 @@
// automatically generated by wrap on 2011-Dec-06 // automatically generated by wrap on 2011-Dec-08
#include <wrap/matlab.h> #include <wrap/matlab.h>
#include <Test.h> #include <folder/path/to/Test.h>
void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[]) void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[])
{ {
checkArguments("create_ptrs",nargout,nargin-1,0); checkArguments("create_ptrs",nargout,nargin-1,0);

View File

@ -1,6 +1,6 @@
// automatically generated by wrap on 2011-Dec-06 // automatically generated by wrap on 2011-Dec-08
#include <wrap/matlab.h> #include <wrap/matlab.h>
#include <Test.h> #include <folder/path/to/Test.h>
void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[]) void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[])
{ {
checkArguments("print",nargout,nargin-1,0); checkArguments("print",nargout,nargin-1,0);

View File

@ -1,6 +1,6 @@
// automatically generated by wrap on 2011-Dec-06 // automatically generated by wrap on 2011-Dec-08
#include <wrap/matlab.h> #include <wrap/matlab.h>
#include <Test.h> #include <folder/path/to/Test.h>
void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[]) void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[])
{ {
checkArguments("return_Point2Ptr",nargout,nargin-1,1); checkArguments("return_Point2Ptr",nargout,nargin-1,1);

View File

@ -1,6 +1,6 @@
// automatically generated by wrap on 2011-Dec-06 // automatically generated by wrap on 2011-Dec-08
#include <wrap/matlab.h> #include <wrap/matlab.h>
#include <Test.h> #include <folder/path/to/Test.h>
void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[]) void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[])
{ {
checkArguments("return_Test",nargout,nargin-1,1); checkArguments("return_Test",nargout,nargin-1,1);

View File

@ -1,6 +1,6 @@
// automatically generated by wrap on 2011-Dec-06 // automatically generated by wrap on 2011-Dec-08
#include <wrap/matlab.h> #include <wrap/matlab.h>
#include <Test.h> #include <folder/path/to/Test.h>
void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[]) void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[])
{ {
checkArguments("return_TestPtr",nargout,nargin-1,1); checkArguments("return_TestPtr",nargout,nargin-1,1);

View File

@ -1,6 +1,6 @@
// automatically generated by wrap on 2011-Dec-06 // automatically generated by wrap on 2011-Dec-08
#include <wrap/matlab.h> #include <wrap/matlab.h>
#include <Test.h> #include <folder/path/to/Test.h>
void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[]) void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[])
{ {
checkArguments("return_bool",nargout,nargin-1,1); checkArguments("return_bool",nargout,nargin-1,1);

View File

@ -1,6 +1,6 @@
// automatically generated by wrap on 2011-Dec-06 // automatically generated by wrap on 2011-Dec-08
#include <wrap/matlab.h> #include <wrap/matlab.h>
#include <Test.h> #include <folder/path/to/Test.h>
void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[]) void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[])
{ {
checkArguments("return_double",nargout,nargin-1,1); checkArguments("return_double",nargout,nargin-1,1);

View File

@ -1,6 +1,6 @@
// automatically generated by wrap on 2011-Dec-06 // automatically generated by wrap on 2011-Dec-08
#include <wrap/matlab.h> #include <wrap/matlab.h>
#include <Test.h> #include <folder/path/to/Test.h>
void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[]) void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[])
{ {
checkArguments("return_field",nargout,nargin-1,1); checkArguments("return_field",nargout,nargin-1,1);

View File

@ -1,6 +1,6 @@
// automatically generated by wrap on 2011-Dec-06 // automatically generated by wrap on 2011-Dec-08
#include <wrap/matlab.h> #include <wrap/matlab.h>
#include <Test.h> #include <folder/path/to/Test.h>
void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[]) void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[])
{ {
checkArguments("return_int",nargout,nargin-1,1); checkArguments("return_int",nargout,nargin-1,1);

View File

@ -1,11 +1,11 @@
// automatically generated by wrap on 2011-Dec-06 // automatically generated by wrap on 2011-Dec-08
#include <wrap/matlab.h> #include <wrap/matlab.h>
#include <Test.h> #include <folder/path/to/Test.h>
void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[]) void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[])
{ {
checkArguments("return_matrix1",nargout,nargin-1,1); checkArguments("return_matrix1",nargout,nargin-1,1);
shared_ptr<Test> self = unwrap_shared_ptr< Test >(in[0],"Test"); shared_ptr<Test> self = unwrap_shared_ptr< Test >(in[0],"Test");
Matrix value = unwrap< Matrix >(in[1]); Matrix value = unwrap< Matrix >(in[1]);
Matrix result = self->return_matrix1(value); Matrix result = self->return_matrix1(value);
out[0] = wrap_shared_ptr(make_shared< Matrix >(result),"Matrix"); out[0] = wrap< Matrix >(result);
} }

View File

@ -1,11 +1,11 @@
// automatically generated by wrap on 2011-Dec-06 // automatically generated by wrap on 2011-Dec-08
#include <wrap/matlab.h> #include <wrap/matlab.h>
#include <Test.h> #include <folder/path/to/Test.h>
void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[]) void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[])
{ {
checkArguments("return_matrix2",nargout,nargin-1,1); checkArguments("return_matrix2",nargout,nargin-1,1);
shared_ptr<Test> self = unwrap_shared_ptr< Test >(in[0],"Test"); shared_ptr<Test> self = unwrap_shared_ptr< Test >(in[0],"Test");
Matrix value = unwrap< Matrix >(in[1]); Matrix value = unwrap< Matrix >(in[1]);
Matrix result = self->return_matrix2(value); Matrix result = self->return_matrix2(value);
out[0] = wrap_shared_ptr(make_shared< Matrix >(result),"Matrix"); out[0] = wrap< Matrix >(result);
} }

View File

@ -1,6 +1,6 @@
// automatically generated by wrap on 2011-Dec-06 // automatically generated by wrap on 2011-Dec-08
#include <wrap/matlab.h> #include <wrap/matlab.h>
#include <Test.h> #include <folder/path/to/Test.h>
void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[]) void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[])
{ {
checkArguments("return_pair",nargout,nargin-1,2); checkArguments("return_pair",nargout,nargin-1,2);

View File

@ -1,6 +1,6 @@
// automatically generated by wrap on 2011-Dec-06 // automatically generated by wrap on 2011-Dec-08
#include <wrap/matlab.h> #include <wrap/matlab.h>
#include <Test.h> #include <folder/path/to/Test.h>
void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[]) void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[])
{ {
checkArguments("return_ptrs",nargout,nargin-1,2); checkArguments("return_ptrs",nargout,nargin-1,2);

View File

@ -1,6 +1,6 @@
// automatically generated by wrap on 2011-Dec-06 // automatically generated by wrap on 2011-Dec-08
#include <wrap/matlab.h> #include <wrap/matlab.h>
#include <Test.h> #include <folder/path/to/Test.h>
void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[]) void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[])
{ {
checkArguments("return_size_t",nargout,nargin-1,1); checkArguments("return_size_t",nargout,nargin-1,1);

View File

@ -1,6 +1,6 @@
// automatically generated by wrap on 2011-Dec-06 // automatically generated by wrap on 2011-Dec-08
#include <wrap/matlab.h> #include <wrap/matlab.h>
#include <Test.h> #include <folder/path/to/Test.h>
void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[]) void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[])
{ {
checkArguments("return_string",nargout,nargin-1,1); checkArguments("return_string",nargout,nargin-1,1);

View File

@ -1,11 +1,11 @@
// automatically generated by wrap on 2011-Dec-06 // automatically generated by wrap on 2011-Dec-08
#include <wrap/matlab.h> #include <wrap/matlab.h>
#include <Test.h> #include <folder/path/to/Test.h>
void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[]) void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[])
{ {
checkArguments("return_vector1",nargout,nargin-1,1); checkArguments("return_vector1",nargout,nargin-1,1);
shared_ptr<Test> self = unwrap_shared_ptr< Test >(in[0],"Test"); shared_ptr<Test> self = unwrap_shared_ptr< Test >(in[0],"Test");
Vector value = unwrap< Vector >(in[1]); Vector value = unwrap< Vector >(in[1]);
Vector result = self->return_vector1(value); Vector result = self->return_vector1(value);
out[0] = wrap_shared_ptr(make_shared< Vector >(result),"Vector"); out[0] = wrap< Vector >(result);
} }

View File

@ -1,11 +1,11 @@
// automatically generated by wrap on 2011-Dec-06 // automatically generated by wrap on 2011-Dec-08
#include <wrap/matlab.h> #include <wrap/matlab.h>
#include <Test.h> #include <folder/path/to/Test.h>
void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[]) void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[])
{ {
checkArguments("return_vector2",nargout,nargin-1,1); checkArguments("return_vector2",nargout,nargin-1,1);
shared_ptr<Test> self = unwrap_shared_ptr< Test >(in[0],"Test"); shared_ptr<Test> self = unwrap_shared_ptr< Test >(in[0],"Test");
Vector value = unwrap< Vector >(in[1]); Vector value = unwrap< Vector >(in[1]);
Vector result = self->return_vector2(value); Vector result = self->return_vector2(value);
out[0] = wrap_shared_ptr(make_shared< Vector >(result),"Vector"); out[0] = wrap< Vector >(result);
} }

View File

@ -1,6 +1,6 @@
// automatically generated by wrap on 2011-Dec-06 // automatically generated by wrap on 2011-Dec-08
#include <wrap/matlab.h> #include <wrap/matlab.h>
#include <Test.h> #include <folder/path/to/Test.h>
void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[]) void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[])
{ {
checkArguments("new_Test_",nargout,nargin,0); checkArguments("new_Test_",nargout,nargin,0);

View File

@ -0,0 +1,11 @@
// automatically generated by wrap on 2011-Dec-08
#include <wrap/matlab.h>
#include <folder/path/to/Test.h>
void mexFunction(int nargout, mxArray *out[], int nargin, const mxArray *in[])
{
checkArguments("new_Test_dM",nargout,nargin,2);
double a = unwrap< double >(in[0]);
Matrix b = unwrap< Matrix >(in[1]);
Test* self = new Test(a,b);
out[0] = wrap_constructed(self,"Test");
}

View File

@ -27,6 +27,8 @@ class Point3 {
*/ */
class Test { class Test {
#include <folder/path/to/Test.h>
/* a comment! */ /* a comment! */
// another comment // another comment
Test(); Test();

View File

@ -111,6 +111,8 @@ TEST( wrap, parse ) {
EXPECT_LONGS_EQUAL(19, testCls.methods.size()); EXPECT_LONGS_EQUAL(19, testCls.methods.size());
EXPECT_LONGS_EQUAL( 0, testCls.static_methods.size()); EXPECT_LONGS_EQUAL( 0, testCls.static_methods.size());
EXPECT_LONGS_EQUAL( 0, testCls.namespaces.size()); EXPECT_LONGS_EQUAL( 0, testCls.namespaces.size());
EXPECT_LONGS_EQUAL( 1, testCls.includes.size());
EXPECT(assert_equal("folder/path/to/Test.h", testCls.includes.front()));
// function to parse: pair<Vector,Matrix> return_pair (Vector v, Matrix A) const; // function to parse: pair<Vector,Matrix> return_pair (Vector v, Matrix A) const;
Method m2 = testCls.methods.front(); Method m2 = testCls.methods.front();