Fix integration of XS containers

This commit is contained in:
Alessandro Ranellucci 2013-07-16 17:13:01 +02:00
parent 9b582a11ff
commit 9458c7db97
34 changed files with 279 additions and 152 deletions

View file

@ -11,6 +11,8 @@
%code{% RETVAL = THIS->polygon.to_SV(); %};
SV* pp()
%code{% RETVAL = THIS->polygon.to_SV_pureperl(); %};
void reverse()
%code{% THIS->polygon.reverse(); %};
ExtrusionPath* split_at_index(int index)
%code{% const char* CLASS = "Slic3r::ExtrusionPath"; RETVAL = THIS->split_at_index(index); %};
ExtrusionPath* split_at_first_point()

View file

@ -14,6 +14,8 @@
void pop_back()
%code{% THIS->polyline.points.pop_back(); %};
void reverse();
Lines lines()
%code{% RETVAL = THIS->polyline.lines(); %};
%{
ExtrusionPath*

View file

@ -18,6 +18,8 @@
Point* b()
%code{% const char* CLASS = "Slic3r::Point"; RETVAL = new Point(THIS->b); %};
void reverse();
void scale(double factor);
void translate(double x, double y);
%{
Line*
@ -29,6 +31,16 @@ Line::new(...)
RETVAL->b.from_SV_check( ST(2) );
OUTPUT:
RETVAL
}
void
Line::rotate(angle, center_sv)
double angle;
SV* center_sv;
CODE:
Point center;
center.from_SV_check(center_sv);
THIS->rotate(angle, &center);
%}
};

View file

@ -6,7 +6,7 @@
%}
%name{Slic3r::Point} class Point {
Point(unsigned long _x = 0, unsigned long _y = 0);
Point(long _x = 0, long _y = 0);
~Point();
Point* clone()
%code{% const char* CLASS = "Slic3r::Point"; RETVAL = new Point(*THIS); %};
@ -14,9 +14,11 @@
void translate(double x, double y);
SV* arrayref()
%code{% RETVAL = THIS->to_SV_pureperl(); %};
unsigned long x()
SV* pp()
%code{% RETVAL = THIS->to_SV_pureperl(); %};
long x()
%code{% RETVAL = THIS->x; %};
unsigned long y()
long y()
%code{% RETVAL = THIS->y; %};
%{

View file

@ -15,6 +15,7 @@
%code{% RETVAL = THIS->to_SV_pureperl(); %};
void scale(double factor);
void translate(double x, double y);
void reverse();
Lines lines();
Polyline* split_at_index(int index)
%code{% const char* CLASS = "Slic3r::Polyline"; RETVAL = THIS->split_at_index(index); %};

View file

@ -38,7 +38,7 @@ Polyline::append(...)
CODE:
for (unsigned int i = 1; i < items; i++) {
Point p;
p.from_SV_check( ST(1) );
p.from_SV_check( ST(i) );
THIS->points.push_back(p);
}