Merge branch 'master' into xsdata

Conflicts:
	xs/xsp/ExPolygon.xsp
This commit is contained in:
Alessandro Ranellucci 2013-07-07 16:53:58 +02:00
commit 21816acbd7
4 changed files with 12 additions and 9 deletions

View file

@ -21,21 +21,20 @@ class ExPolygon
SV* arrayref();
};
Polygon*
perl2polygon(SV* poly_sv)
void
perl2polygon(SV* poly_sv, Polygon& poly)
{
AV* poly_av = (AV*)SvRV(poly_sv);
const unsigned int num_points = av_len(poly_av)+1;
Polygon* retval = new Polygon(num_points);
poly.resize(num_points);
for (unsigned int i = 0; i < num_points; i++) {
SV** point_sv = av_fetch(poly_av, i, 0);
AV* point_av = (AV*)SvRV(*point_sv);
Point& p = (*retval)[i];
Point& p = poly[i];
p.x = (unsigned long)SvIV(*av_fetch(point_av, 0, 0));
p.y = (unsigned long)SvIV(*av_fetch(point_av, 1, 0));
}
return retval;
}
SV*