diff options
author | Alessandro Ranellucci <aar@cpan.org> | 2013-07-06 18:39:22 +0400 |
---|---|---|
committer | Alessandro Ranellucci <aar@cpan.org> | 2013-07-06 18:39:22 +0400 |
commit | 409328056689ee8a8063911ed73a6fe7d4a29d68 (patch) | |
tree | 511c1de09a7b2247dcf8d4ce32edd94e3d97518d /xs | |
parent | 5a11d4df89331301ae3a2a9ee2bc6b3416a5892e (diff) |
Remove Point.cpp
Diffstat (limited to 'xs')
-rw-r--r-- | xs/MANIFEST | 2 | ||||
-rw-r--r-- | xs/src/ExPolygon.hpp | 2 | ||||
-rw-r--r-- | xs/src/Point.cpp | 13 | ||||
-rw-r--r-- | xs/src/Point.hpp | 10 | ||||
-rw-r--r-- | xs/xsp/Point.xsp | 12 |
5 files changed, 19 insertions, 20 deletions
diff --git a/xs/MANIFEST b/xs/MANIFEST index b8232a848..a803710ff 100644 --- a/xs/MANIFEST +++ b/xs/MANIFEST @@ -20,9 +20,7 @@ src/admesh/util.c src/admesh/util.o src/ExPolygon.hpp src/myinit.h -src/Point.cpp src/Point.hpp -src/Point.o src/ppport.h src/TriangleMesh.cpp src/TriangleMesh.hpp diff --git a/xs/src/ExPolygon.hpp b/xs/src/ExPolygon.hpp index 093b69167..14c809c20 100644 --- a/xs/src/ExPolygon.hpp +++ b/xs/src/ExPolygon.hpp @@ -44,7 +44,7 @@ polygon2perl(Polygon& poly) { AV* av = newAV(); av_extend(av, num_points-1); for (unsigned int i = 0; i < num_points; i++) { - av_store(av, i, poly[i]._toPerl()); + av_store(av, i, point2perl(poly[i])); } return (SV*)newRV_noinc((SV*)av); } diff --git a/xs/src/Point.cpp b/xs/src/Point.cpp deleted file mode 100644 index 3758cabc7..000000000 --- a/xs/src/Point.cpp +++ /dev/null @@ -1,13 +0,0 @@ -#include "myinit.h" -#include "Point.hpp" - -Point::~Point() {} - - -SV* -Point::_toPerl() { - AV* av = newAV(); - av_fill(av, 1); - av_store_point_xy(av, x, y); - return (SV*)newRV_noinc((SV*)av); -} diff --git a/xs/src/Point.hpp b/xs/src/Point.hpp index eedd73fde..b468e37e2 100644 --- a/xs/src/Point.hpp +++ b/xs/src/Point.hpp @@ -14,8 +14,14 @@ class Point unsigned long x; unsigned long y; Point(unsigned long _x = 0, unsigned long _y = 0): x(_x), y(_y) {}; - ~Point(); - SV* _toPerl(); }; +SV* +point2perl(Point& point) { + AV* av = newAV(); + av_fill(av, 1); + av_store_point_xy(av, point.x, point.y); + return (SV*)newRV_noinc((SV*)av); +} + #endif diff --git a/xs/xsp/Point.xsp b/xs/xsp/Point.xsp index 9756a4b31..ac1b74e89 100644 --- a/xs/xsp/Point.xsp +++ b/xs/xsp/Point.xsp @@ -7,8 +7,16 @@ %name{Slic3r::Point::XS} class Point { Point(unsigned long _x = 0, unsigned long _y = 0); - ~Point(); - SV* _toPerl(); +%{ + +SV* +Point::_toPerl() + CODE: + RETVAL = point2perl(*THIS); + OUTPUT: + RETVAL + +%} }; %package{Slic3r::Point::XS}; |