XS interface completed, including new Line class

This commit is contained in:
Alessandro Ranellucci 2013-07-15 22:57:22 +02:00
parent 9af2a1c007
commit ab6b3d41a7
33 changed files with 435 additions and 257 deletions

View file

@ -23,7 +23,8 @@ ExPolygonCollection::new(...)
// ST(0) is class name, others are expolygons
RETVAL->expolygons.resize(items-1);
for (unsigned int i = 1; i < items; i++) {
perl2expolygon_check(ST(i), RETVAL->expolygons[i-1]);
// Note: a COPY of the input is stored
RETVAL->expolygons[i-1].from_SV_check(ST(i));
RETVAL->expolygons[i-1].in_collection = true;
}
OUTPUT:
@ -36,20 +37,22 @@ ExPolygonCollection::arrayref()
av_fill(av, THIS->expolygons.size()-1);
int i = 0;
for (ExPolygons::iterator it = THIS->expolygons.begin(); it != THIS->expolygons.end(); ++it) {
av_store(av, i++, (*it).to_SV(false, false));
SV* sv = newSV(0);
sv_setref_pv( sv, "Slic3r::ExPolygon", &*it );
av_store(av, i++, sv);
}
RETVAL = newRV_noinc((SV*)av);
OUTPUT:
RETVAL
SV*
ExPolygonCollection::arrayref_pp()
ExPolygonCollection::pp()
CODE:
AV* av = newAV();
av_fill(av, THIS->expolygons.size()-1);
int i = 0;
for (ExPolygons::iterator it = THIS->expolygons.begin(); it != THIS->expolygons.end(); ++it) {
av_store(av, i++, (*it).to_SV(true, true));
av_store(av, i++, (*it).to_SV_pureperl());
}
RETVAL = newRV_noinc((SV*)av);
OUTPUT:
@ -59,8 +62,10 @@ void
ExPolygonCollection::append(...)
CODE:
for (unsigned int i = 1; i < items; i++) {
THIS->expolygons.push_back(*(ExPolygon *)SvIV((SV*)SvRV( ST(i) )));
THIS->expolygons.back().in_collection = true;
ExPolygon expolygon;
expolygon.from_SV_check( ST(i) );
expolygon.in_collection = true;
THIS->expolygons.push_back(expolygon);
}
%}