diff --git a/xs/src/BoundingBox.cpp b/xs/src/BoundingBox.cpp index 86e0dae12..9975eb025 100644 --- a/xs/src/BoundingBox.cpp +++ b/xs/src/BoundingBox.cpp @@ -1,8 +1,5 @@ #include "BoundingBox.hpp" #include -#ifdef SLIC3RXS -#include "perlglue.hpp" -#endif namespace Slic3r { diff --git a/xs/src/ClipperUtils.cpp b/xs/src/ClipperUtils.cpp index 1c6d1fbb7..00fe86e4e 100644 --- a/xs/src/ClipperUtils.cpp +++ b/xs/src/ClipperUtils.cpp @@ -592,9 +592,9 @@ polynode2perl(const ClipperLib::PolyNode& node) Slic3r::Polygon p; ClipperPath_to_Slic3rMultiPoint(node.Contour, p); if (node.IsHole()) { - (void)hv_stores( hv, "hole", p.to_SV_clone_ref() ); + (void)hv_stores( hv, "hole", Slic3r::perl_to_SV_clone_ref(p) ); } else { - (void)hv_stores( hv, "outer", p.to_SV_clone_ref() ); + (void)hv_stores( hv, "outer", Slic3r::perl_to_SV_clone_ref(p) ); } (void)hv_stores( hv, "children", polynode_children_2_perl(node) ); return (SV*)newRV_noinc((SV*)hv); diff --git a/xs/src/ExPolygon.cpp b/xs/src/ExPolygon.cpp index e985353b7..e2ee364a8 100644 --- a/xs/src/ExPolygon.cpp +++ b/xs/src/ExPolygon.cpp @@ -6,9 +6,6 @@ #include "ClipperUtils.hpp" #include "polypartition.h" #include "poly2tri/poly2tri.h" -#ifdef SLIC3RXS -#include "perlglue.hpp" -#endif #include #include @@ -367,28 +364,14 @@ ExPolygon::to_AV() { AV* av = newAV(); av_extend(av, num_holes); // -1 +1 - av_store(av, 0, this->contour.to_SV_ref()); + av_store(av, 0, perl_to_SV_ref(this->contour)); for (unsigned int i = 0; i < num_holes; i++) { - av_store(av, i+1, this->holes[i].to_SV_ref()); + av_store(av, i+1, perl_to_SV_ref(this->holes[i])); } return newRV_noinc((SV*)av); } -SV* -ExPolygon::to_SV_ref() { - SV* sv = newSV(0); - sv_setref_pv( sv, perl_class_name_ref(this), this ); - return sv; -} - -SV* -ExPolygon::to_SV_clone_ref() const { - SV* sv = newSV(0); - sv_setref_pv( sv, perl_class_name(this), new ExPolygon(*this) ); - return sv; -} - SV* ExPolygon::to_SV_pureperl() const { diff --git a/xs/src/ExPolygon.hpp b/xs/src/ExPolygon.hpp index 8449d4595..e7c56d8d8 100644 --- a/xs/src/ExPolygon.hpp +++ b/xs/src/ExPolygon.hpp @@ -39,8 +39,6 @@ class ExPolygon void from_SV(SV* poly_sv); void from_SV_check(SV* poly_sv); SV* to_AV(); - SV* to_SV_ref(); - SV* to_SV_clone_ref() const; SV* to_SV_pureperl() const; #endif }; diff --git a/xs/src/ExPolygonCollection.cpp b/xs/src/ExPolygonCollection.cpp index fbfde19f4..67a22682e 100644 --- a/xs/src/ExPolygonCollection.cpp +++ b/xs/src/ExPolygonCollection.cpp @@ -1,8 +1,5 @@ #include "ExPolygonCollection.hpp" #include "Geometry.hpp" -#ifdef SLIC3RXS -#include "perlglue.hpp" -#endif namespace Slic3r { diff --git a/xs/src/Extruder.cpp b/xs/src/Extruder.cpp index 590855cc3..d327276f8 100644 --- a/xs/src/Extruder.cpp +++ b/xs/src/Extruder.cpp @@ -1,7 +1,4 @@ #include "Extruder.hpp" -#ifdef SLIC3RXS -#include "perlglue.hpp" -#endif namespace Slic3r { diff --git a/xs/src/ExtrusionEntity.cpp b/xs/src/ExtrusionEntity.cpp index 2dae1be0e..5b15ee02e 100644 --- a/xs/src/ExtrusionEntity.cpp +++ b/xs/src/ExtrusionEntity.cpp @@ -4,9 +4,6 @@ #include "ClipperUtils.hpp" #include "Extruder.hpp" #include -#ifdef SLIC3RXS -#include "perlglue.hpp" -#endif namespace Slic3r { @@ -106,20 +103,6 @@ ExtrusionPath::_inflate_collection(const Polylines &polylines, ExtrusionEntityCo } #ifdef SLIC3RXS -SV* -ExtrusionPath::to_SV_ref() { - SV* sv = newSV(0); - sv_setref_pv( sv, perl_class_name_ref(this), this ); - return sv; -} - -SV* -ExtrusionPath::to_SV_clone_ref() const { - SV* sv = newSV(0); - sv_setref_pv( sv, perl_class_name(this), new ExtrusionPath(*this) ); - return sv; -} - REGISTER_CLASS(ExtrusionPath, "ExtrusionPath"); #endif diff --git a/xs/src/ExtrusionEntity.hpp b/xs/src/ExtrusionEntity.hpp index 562faf6f6..8504aa0ed 100644 --- a/xs/src/ExtrusionEntity.hpp +++ b/xs/src/ExtrusionEntity.hpp @@ -64,11 +64,6 @@ class ExtrusionPath : public ExtrusionEntity double xofs, double yofs, std::string extrusion_axis, std::string gcode_line_suffix) const; - #ifdef SLIC3RXS - SV* to_SV_ref(); - SV* to_SV_clone_ref() const; - #endif - private: void _inflate_collection(const Polylines &polylines, ExtrusionEntityCollection* collection) const; }; diff --git a/xs/src/ExtrusionEntityCollection.cpp b/xs/src/ExtrusionEntityCollection.cpp index 5431078f2..a958e53cf 100644 --- a/xs/src/ExtrusionEntityCollection.cpp +++ b/xs/src/ExtrusionEntityCollection.cpp @@ -1,9 +1,6 @@ #include "ExtrusionEntityCollection.hpp" #include #include -#ifdef SLIC3RXS -#include "perlglue.hpp" -#endif namespace Slic3r { diff --git a/xs/src/Flow.cpp b/xs/src/Flow.cpp index ebc7c8f25..19aa807d9 100644 --- a/xs/src/Flow.cpp +++ b/xs/src/Flow.cpp @@ -1,8 +1,5 @@ #include "Flow.hpp" #include -#ifdef SLIC3RXS -#include "perlglue.hpp" -#endif namespace Slic3r { diff --git a/xs/src/Line.cpp b/xs/src/Line.cpp index fb66629d6..a8bb694e2 100644 --- a/xs/src/Line.cpp +++ b/xs/src/Line.cpp @@ -4,9 +4,6 @@ #include #include #include -#ifdef SLIC3RXS -#include "perlglue.hpp" -#endif namespace Slic3r { @@ -157,31 +154,12 @@ Line::to_AV() { AV* av = newAV(); av_extend(av, 1); - SV* sv = newSV(0); - sv_setref_pv( sv, perl_class_name_ref(&this->a), &(this->a) ); - av_store(av, 0, sv); - - sv = newSV(0); - sv_setref_pv( sv, perl_class_name_ref(&this->b), &(this->b) ); - av_store(av, 1, sv); + av_store(av, 0, perl_to_SV_ref(this->a)); + av_store(av, 1, perl_to_SV_ref(this->b)); return newRV_noinc((SV*)av); } -SV* -Line::to_SV_ref() { - SV* sv = newSV(0); - sv_setref_pv( sv, perl_class_name_ref(this), this ); - return sv; -} - -SV* -Line::to_SV_clone_ref() const { - SV* sv = newSV(0); - sv_setref_pv( sv, perl_class_name(this), new Line(*this) ); - return sv; -} - SV* Line::to_SV_pureperl() const { AV* av = newAV(); diff --git a/xs/src/Line.hpp b/xs/src/Line.hpp index e33c1970c..46881996a 100644 --- a/xs/src/Line.hpp +++ b/xs/src/Line.hpp @@ -38,8 +38,6 @@ class Line void from_SV(SV* line_sv); void from_SV_check(SV* line_sv); SV* to_AV(); - SV* to_SV_ref(); - SV* to_SV_clone_ref() const; SV* to_SV_pureperl() const; #endif }; diff --git a/xs/src/Model.cpp b/xs/src/Model.cpp index 1e6be95ea..e5a04444d 100644 --- a/xs/src/Model.cpp +++ b/xs/src/Model.cpp @@ -1,8 +1,4 @@ #include "Model.hpp" -#ifdef SLIC3RXS -#include "perlglue.hpp" -#endif - namespace Slic3r { @@ -301,13 +297,6 @@ ModelObject::invalidate_bounding_box() #ifdef SLIC3RXS REGISTER_CLASS(ModelObject, "Model::Object"); - -SV* -ModelObject::to_SV_ref() { - SV* sv = newSV(0); - sv_setref_pv( sv, perl_class_name_ref(this), this ); - return sv; -} #endif @@ -322,13 +311,6 @@ ModelVolume::ModelVolume(ModelObject* object, const t_model_material_id &materia #ifdef SLIC3RXS REGISTER_CLASS(ModelVolume, "Model::Volume"); - -SV* -ModelVolume::to_SV_ref() { - SV* sv = newSV(0); - sv_setref_pv( sv, perl_class_name_ref(this), this ); - return sv; -} #endif @@ -343,13 +325,6 @@ ModelInstance::ModelInstance(ModelObject *object, double rotation, #ifdef SLIC3RXS REGISTER_CLASS(ModelInstance, "Model::Instance"); - -SV* -ModelInstance::to_SV_ref() { - SV* sv = newSV(0); - sv_setref_pv( sv, perl_class_name_ref(this), this ); - return sv; -} #endif } diff --git a/xs/src/Model.hpp b/xs/src/Model.hpp index b5d9c5fcd..facbc3777 100644 --- a/xs/src/Model.hpp +++ b/xs/src/Model.hpp @@ -85,6 +85,10 @@ class ModelObject t_layer_height_ranges layer_height_ranges; Pointf origin_translation; + // these should be private but we need to expose them via XS until all methods are ported + BoundingBoxf3 _bounding_box; + bool _bounding_box_valid; + ModelObject(Model *model, const std::string &input_file, const DynamicPrintConfig &config, const t_layer_height_ranges &layer_height_ranges, const Pointf &origin_translation); ModelObject(const ModelObject &other); @@ -115,14 +119,7 @@ class ModelObject size_t facets_count() const; bool needed_repair() const; - #ifdef SLIC3RXS - SV* to_SV_ref(); - #endif - private: - BoundingBoxf3 _bounding_box; - bool _bounding_box_valid; - void update_bounding_box(); }; @@ -136,10 +133,6 @@ class ModelVolume ModelVolume(ModelObject *object, const t_model_material_id &material_id, const TriangleMesh &mesh, bool modifier); - - #ifdef SLIC3RXS - SV* to_SV_ref(); - #endif }; class ModelInstance @@ -155,10 +148,6 @@ class ModelInstance void transform_mesh(TriangleMesh* mesh, bool dont_translate) const; void transform_polygon(Polygon* polygon) const; - - #ifdef SLIC3RXS - SV* to_SV_ref(); - #endif }; } diff --git a/xs/src/MultiPoint.cpp b/xs/src/MultiPoint.cpp index 79912fc76..51567c5e9 100644 --- a/xs/src/MultiPoint.cpp +++ b/xs/src/MultiPoint.cpp @@ -129,7 +129,7 @@ MultiPoint::to_AV() { AV* av = newAV(); av_extend(av, num_points-1); for (unsigned int i = 0; i < num_points; i++) { - av_store(av, i, this->points[i].to_SV_ref()); + av_store(av, i, perl_to_SV_ref(this->points[i])); } return newRV_noinc((SV*)av); } diff --git a/xs/src/MultiPoint.hpp b/xs/src/MultiPoint.hpp index ccc12748a..c1278aa75 100644 --- a/xs/src/MultiPoint.hpp +++ b/xs/src/MultiPoint.hpp @@ -1,6 +1,7 @@ #ifndef slic3r_MultiPoint_hpp_ #define slic3r_MultiPoint_hpp_ +#include #include "Line.hpp" #include "Point.hpp" #include diff --git a/xs/src/Point.cpp b/xs/src/Point.cpp index d2c2367ec..7849ca055 100644 --- a/xs/src/Point.cpp +++ b/xs/src/Point.cpp @@ -2,9 +2,6 @@ #include "Line.hpp" #include #include -#ifdef SLIC3RXS -#include "perlglue.hpp" -#endif namespace Slic3r { @@ -145,20 +142,6 @@ Point::ccw(const Line &line) const REGISTER_CLASS(Point, "Point"); -SV* -Point::to_SV_ref() { - SV* sv = newSV(0); - sv_setref_pv( sv, perl_class_name_ref(this), (void*)this ); - return sv; -} - -SV* -Point::to_SV_clone_ref() const { - SV* sv = newSV(0); - sv_setref_pv( sv, perl_class_name(this), new Point(*this) ); - return sv; -} - SV* Point::to_SV_pureperl() const { AV* av = newAV(); diff --git a/xs/src/Point.hpp b/xs/src/Point.hpp index 508c13bf1..0d50bf376 100644 --- a/xs/src/Point.hpp +++ b/xs/src/Point.hpp @@ -41,8 +41,6 @@ class Point #ifdef SLIC3RXS void from_SV(SV* point_sv); void from_SV_check(SV* point_sv); - SV* to_SV_ref(); - SV* to_SV_clone_ref() const; SV* to_SV_pureperl() const; #endif }; diff --git a/xs/src/Polygon.cpp b/xs/src/Polygon.cpp index ad31b5b62..303d6fd75 100644 --- a/xs/src/Polygon.cpp +++ b/xs/src/Polygon.cpp @@ -2,9 +2,6 @@ #include "ClipperUtils.hpp" #include "Polygon.hpp" #include "Polyline.hpp" -#ifdef SLIC3RXS -#include "perlglue.hpp" -#endif namespace Slic3r { @@ -195,23 +192,8 @@ Polygon::triangulate_convex(Polygons* polygons) const } #ifdef SLIC3RXS - REGISTER_CLASS(Polygon, "Polygon"); -SV* -Polygon::to_SV_ref() { - SV* sv = newSV(0); - sv_setref_pv( sv, perl_class_name_ref(this), (void*)this ); - return sv; -} - -SV* -Polygon::to_SV_clone_ref() const { - SV* sv = newSV(0); - sv_setref_pv( sv, perl_class_name(this), new Polygon(*this) ); - return sv; -} - void Polygon::from_SV_check(SV* poly_sv) { diff --git a/xs/src/Polygon.hpp b/xs/src/Polygon.hpp index 67e6e4a47..4761cf566 100644 --- a/xs/src/Polygon.hpp +++ b/xs/src/Polygon.hpp @@ -38,8 +38,6 @@ class Polygon : public MultiPoint { #ifdef SLIC3RXS void from_SV_check(SV* poly_sv); - SV* to_SV_ref(); - SV* to_SV_clone_ref() const; #endif }; diff --git a/xs/src/Polyline.cpp b/xs/src/Polyline.cpp index 10dfb0ad2..63778d5a5 100644 --- a/xs/src/Polyline.cpp +++ b/xs/src/Polyline.cpp @@ -1,8 +1,5 @@ #include "Polyline.hpp" #include "Polygon.hpp" -#ifdef SLIC3RXS -#include "perlglue.hpp" -#endif namespace Slic3r { @@ -122,25 +119,8 @@ Polyline::simplify(double tolerance) #ifdef SLIC3RXS - REGISTER_CLASS(Polyline, "Polyline"); -SV* -Polyline::to_SV_ref() -{ - SV* sv = newSV(0); - sv_setref_pv( sv, perl_class_name_ref(this), (void*)this ); - return sv; -} - -SV* -Polyline::to_SV_clone_ref() const -{ - SV* sv = newSV(0); - sv_setref_pv( sv, perl_class_name(this), new Polyline(*this) ); - return sv; -} - void Polyline::from_SV_check(SV* poly_sv) { diff --git a/xs/src/Polyline.hpp b/xs/src/Polyline.hpp index f41d9132b..829beeaf7 100644 --- a/xs/src/Polyline.hpp +++ b/xs/src/Polyline.hpp @@ -24,8 +24,6 @@ class Polyline : public MultiPoint { #ifdef SLIC3RXS void from_SV_check(SV* poly_sv); - SV* to_SV_ref(); - SV* to_SV_clone_ref() const; #endif }; diff --git a/xs/src/PolylineCollection.cpp b/xs/src/PolylineCollection.cpp index 6bc218fab..c2a142cf3 100644 --- a/xs/src/PolylineCollection.cpp +++ b/xs/src/PolylineCollection.cpp @@ -1,7 +1,4 @@ #include "PolylineCollection.hpp" -#ifdef SLIC3RXS -#include "perlglue.hpp" -#endif namespace Slic3r { diff --git a/xs/src/Print.cpp b/xs/src/Print.cpp index ced674bd4..4ff86216b 100644 --- a/xs/src/Print.cpp +++ b/xs/src/Print.cpp @@ -1,7 +1,4 @@ #include "Print.hpp" -#ifdef SLIC3RXS -#include "perlglue.hpp" -#endif namespace Slic3r { diff --git a/xs/src/Print.hpp b/xs/src/Print.hpp index 9e93408b2..4b2955e24 100644 --- a/xs/src/Print.hpp +++ b/xs/src/Print.hpp @@ -1,6 +1,7 @@ #ifndef slic3r_Print_hpp_ #define slic3r_Print_hpp_ +#include #include namespace Slic3r { diff --git a/xs/src/PrintConfig.cpp b/xs/src/PrintConfig.cpp index ba96bea38..8f702b56c 100644 --- a/xs/src/PrintConfig.cpp +++ b/xs/src/PrintConfig.cpp @@ -1,7 +1,4 @@ #include "PrintConfig.hpp" -#ifdef SLIC3RXS -#include "perlglue.hpp" -#endif namespace Slic3r { diff --git a/xs/src/Surface.cpp b/xs/src/Surface.cpp index 26727c486..a53cb2513 100644 --- a/xs/src/Surface.cpp +++ b/xs/src/Surface.cpp @@ -1,7 +1,4 @@ #include "Surface.hpp" -#ifdef SLIC3RXS -#include "perlglue.hpp" -#endif namespace Slic3r { @@ -54,20 +51,6 @@ Surface::from_SV_check(SV* surface_sv) // a XS Surface was supplied *this = *(Surface *)SvIV((SV*)SvRV( surface_sv )); } - -SV* -Surface::to_SV_ref() { - SV* sv = newSV(0); - sv_setref_pv( sv, perl_class_name_ref(this), (void*)this ); - return sv; -} - -SV* -Surface::to_SV_clone_ref() const { - SV* sv = newSV(0); - sv_setref_pv( sv, perl_class_name(this), new Surface(*this) ); - return sv; -} #endif } diff --git a/xs/src/Surface.hpp b/xs/src/Surface.hpp index 4c776089a..ce0f02477 100644 --- a/xs/src/Surface.hpp +++ b/xs/src/Surface.hpp @@ -24,8 +24,6 @@ class Surface #ifdef SLIC3RXS void from_SV_check(SV* surface_sv); - SV* to_SV_ref(); - SV* to_SV_clone_ref() const; #endif }; diff --git a/xs/src/SurfaceCollection.cpp b/xs/src/SurfaceCollection.cpp index 4fc8c5e28..77c2e6d0a 100644 --- a/xs/src/SurfaceCollection.cpp +++ b/xs/src/SurfaceCollection.cpp @@ -1,8 +1,5 @@ #include "SurfaceCollection.hpp" #include -#ifdef SLIC3RXS -#include "perlglue.hpp" -#endif namespace Slic3r { diff --git a/xs/src/TriangleMesh.cpp b/xs/src/TriangleMesh.cpp index d16e2b6ff..dc478322f 100644 --- a/xs/src/TriangleMesh.cpp +++ b/xs/src/TriangleMesh.cpp @@ -11,9 +11,6 @@ #include #include #include -#ifdef SLIC3RXS -#include "perlglue.hpp" -#endif #ifdef SLIC3R_DEBUG #include "SVG.hpp" diff --git a/xs/src/myinit.h b/xs/src/myinit.h index 43ed407bb..c3c8c6ff3 100644 --- a/xs/src/myinit.h +++ b/xs/src/myinit.h @@ -17,6 +17,7 @@ extern "C" { #undef do_open #undef do_close } +#include "perlglue.hpp" #endif #define EPSILON 1e-4 diff --git a/xs/src/perlglue.hpp b/xs/src/perlglue.hpp index efe10aa45..833eee6f3 100644 --- a/xs/src/perlglue.hpp +++ b/xs/src/perlglue.hpp @@ -23,7 +23,21 @@ template const char* perl_class_name(const T*) { return ClassTraits::name; } template const char* perl_class_name_ref(const T*) { return ClassTraits::name_ref; } - + +template +SV* perl_to_SV_ref(T &t) { + SV* sv = newSV(0); + sv_setref_pv( sv, perl_class_name_ref(&t), &t ); + return sv; +} + +template +SV* perl_to_SV_clone_ref(const T &t) { + SV* sv = newSV(0); + sv_setref_pv( sv, perl_class_name(&t), new T(t) ); + return sv; +} + template class Ref { T* val; diff --git a/xs/xsp/BoundingBox.xsp b/xs/xsp/BoundingBox.xsp index 5f932d3ee..8ae2653be 100644 --- a/xs/xsp/BoundingBox.xsp +++ b/xs/xsp/BoundingBox.xsp @@ -4,7 +4,6 @@ #include #include "BoundingBox.hpp" #include "Point.hpp" -#include "perlglue.hpp" %} %name{Slic3r::Geometry::BoundingBox} class BoundingBox { diff --git a/xs/xsp/Clipper.xsp b/xs/xsp/Clipper.xsp index 41fa3ef82..43a30a406 100644 --- a/xs/xsp/Clipper.xsp +++ b/xs/xsp/Clipper.xsp @@ -4,7 +4,6 @@ #include #include "clipper.hpp" #include "ClipperUtils.hpp" -#include "perlglue.hpp" %} %package{Slic3r::Geometry::Clipper}; diff --git a/xs/xsp/Config.xsp b/xs/xsp/Config.xsp index 0d37b0e13..7c89a9bff 100644 --- a/xs/xsp/Config.xsp +++ b/xs/xsp/Config.xsp @@ -3,7 +3,6 @@ %{ #include #include "PrintConfig.hpp" -#include "perlglue.hpp" %} %name{Slic3r::Config} class DynamicPrintConfig { diff --git a/xs/xsp/ExPolygon.xsp b/xs/xsp/ExPolygon.xsp index aada66185..df0f203d3 100644 --- a/xs/xsp/ExPolygon.xsp +++ b/xs/xsp/ExPolygon.xsp @@ -3,7 +3,6 @@ %{ #include #include "ExPolygon.hpp" -#include "perlglue.hpp" %} %name{Slic3r::ExPolygon} class ExPolygon { diff --git a/xs/xsp/ExPolygonCollection.xsp b/xs/xsp/ExPolygonCollection.xsp index 825b5ad03..c718c7ebc 100644 --- a/xs/xsp/ExPolygonCollection.xsp +++ b/xs/xsp/ExPolygonCollection.xsp @@ -3,7 +3,6 @@ %{ #include #include "ExPolygonCollection.hpp" -#include "perlglue.hpp" %} %name{Slic3r::ExPolygon::Collection} class ExPolygonCollection { @@ -45,7 +44,7 @@ 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_ref()); + av_store(av, i++, perl_to_SV_ref(*it)); } RETVAL = newRV_noinc((SV*)av); OUTPUT: diff --git a/xs/xsp/Extruder.xsp b/xs/xsp/Extruder.xsp index 86c4fd8e7..d80b34d62 100644 --- a/xs/xsp/Extruder.xsp +++ b/xs/xsp/Extruder.xsp @@ -3,7 +3,6 @@ %{ #include #include "Extruder.hpp" -#include "perlglue.hpp" %} %name{Slic3r::Extruder} class Extruder { diff --git a/xs/xsp/ExtrusionEntityCollection.xsp b/xs/xsp/ExtrusionEntityCollection.xsp index d0f0233a4..b8c65c87f 100644 --- a/xs/xsp/ExtrusionEntityCollection.xsp +++ b/xs/xsp/ExtrusionEntityCollection.xsp @@ -3,7 +3,6 @@ %{ #include #include "ExtrusionEntityCollection.hpp" -#include "perlglue.hpp" %} %name{Slic3r::ExtrusionPath::Collection} class ExtrusionEntityCollection { diff --git a/xs/xsp/ExtrusionLoop.xsp b/xs/xsp/ExtrusionLoop.xsp index 14805868a..731c7ef59 100644 --- a/xs/xsp/ExtrusionLoop.xsp +++ b/xs/xsp/ExtrusionLoop.xsp @@ -3,7 +3,6 @@ %{ #include #include "ExtrusionEntity.hpp" -#include "perlglue.hpp" %} %name{Slic3r::ExtrusionLoop} class ExtrusionLoop { @@ -36,7 +35,7 @@ ExtrusionLoop::arrayref() av_fill(av, THIS->paths.size()-1); int i = 0; for (ExtrusionPaths::iterator it = THIS->paths.begin(); it != THIS->paths.end(); ++it) { - av_store(av, i++, it->to_SV_ref()); + av_store(av, i++, perl_to_SV_ref(*it)); } RETVAL = newRV_noinc((SV*)av); OUTPUT: diff --git a/xs/xsp/ExtrusionPath.xsp b/xs/xsp/ExtrusionPath.xsp index a88a37f41..1b2782258 100644 --- a/xs/xsp/ExtrusionPath.xsp +++ b/xs/xsp/ExtrusionPath.xsp @@ -4,7 +4,6 @@ #include #include "ExtrusionEntity.hpp" #include "ExtrusionEntityCollection.hpp" -#include "perlglue.hpp" %} %name{Slic3r::ExtrusionPath} class ExtrusionPath { diff --git a/xs/xsp/Flow.xsp b/xs/xsp/Flow.xsp index 226b12ea8..0fe645450 100644 --- a/xs/xsp/Flow.xsp +++ b/xs/xsp/Flow.xsp @@ -3,7 +3,6 @@ %{ #include #include "Flow.hpp" -#include "perlglue.hpp" %} %name{Slic3r::Flow} class Flow { diff --git a/xs/xsp/Geometry.xsp b/xs/xsp/Geometry.xsp index 85d2d359b..acbfb0875 100644 --- a/xs/xsp/Geometry.xsp +++ b/xs/xsp/Geometry.xsp @@ -3,7 +3,6 @@ %{ #include #include "Geometry.hpp" -#include "perlglue.hpp" %} diff --git a/xs/xsp/Line.xsp b/xs/xsp/Line.xsp index c18006980..a96424009 100644 --- a/xs/xsp/Line.xsp +++ b/xs/xsp/Line.xsp @@ -4,7 +4,6 @@ #include #include "Line.hpp" #include "Polyline.hpp" -#include "perlglue.hpp" %} %name{Slic3r::Line} class Line { diff --git a/xs/xsp/Model.xsp b/xs/xsp/Model.xsp index 43356a3bc..ae4b9fc22 100644 --- a/xs/xsp/Model.xsp +++ b/xs/xsp/Model.xsp @@ -4,7 +4,6 @@ #include #include "Model.hpp" #include "PrintConfig.hpp" -#include "perlglue.hpp" %} %name{Slic3r::Model} class Model { diff --git a/xs/xsp/Point.xsp b/xs/xsp/Point.xsp index 952cd161f..6fd39eac0 100644 --- a/xs/xsp/Point.xsp +++ b/xs/xsp/Point.xsp @@ -3,7 +3,6 @@ %{ #include #include "Point.hpp" -#include "perlglue.hpp" %} %name{Slic3r::Point} class Point { diff --git a/xs/xsp/Polygon.xsp b/xs/xsp/Polygon.xsp index e5d415d6b..f74d5e2da 100644 --- a/xs/xsp/Polygon.xsp +++ b/xs/xsp/Polygon.xsp @@ -3,7 +3,6 @@ %{ #include #include "Polygon.hpp" -#include "perlglue.hpp" %} %name{Slic3r::Polygon} class Polygon { diff --git a/xs/xsp/Polyline.xsp b/xs/xsp/Polyline.xsp index 848bd3f51..fb2530307 100644 --- a/xs/xsp/Polyline.xsp +++ b/xs/xsp/Polyline.xsp @@ -4,7 +4,6 @@ #include #include "ClipperUtils.hpp" #include "Polyline.hpp" -#include "perlglue.hpp" %} %name{Slic3r::Polyline} class Polyline { diff --git a/xs/xsp/PolylineCollection.xsp b/xs/xsp/PolylineCollection.xsp index b976b5a53..d5ad4f77f 100644 --- a/xs/xsp/PolylineCollection.xsp +++ b/xs/xsp/PolylineCollection.xsp @@ -3,7 +3,6 @@ %{ #include #include "PolylineCollection.hpp" -#include "perlglue.hpp" %} %name{Slic3r::Polyline::Collection} class PolylineCollection { @@ -47,7 +46,7 @@ PolylineCollection::arrayref() av_fill(av, THIS->polylines.size()-1); int i = 0; for (Polylines::iterator it = THIS->polylines.begin(); it != THIS->polylines.end(); ++it) { - av_store(av, i++, (*it).to_SV_ref()); + av_store(av, i++, perl_to_SV_ref(*it)); } RETVAL = newRV_noinc((SV*)av); OUTPUT: diff --git a/xs/xsp/Print.xsp b/xs/xsp/Print.xsp index f6ee9014a..25f52a71c 100644 --- a/xs/xsp/Print.xsp +++ b/xs/xsp/Print.xsp @@ -3,7 +3,6 @@ %{ #include #include "Print.hpp" -#include "perlglue.hpp" %} %name{Slic3r::Print::State} class PrintState { diff --git a/xs/xsp/Surface.xsp b/xs/xsp/Surface.xsp index 5c85017c8..9aaa8a2fb 100644 --- a/xs/xsp/Surface.xsp +++ b/xs/xsp/Surface.xsp @@ -4,7 +4,6 @@ #include #include "Surface.hpp" #include "ClipperUtils.hpp" -#include "perlglue.hpp" %} %name{Slic3r::Surface} class Surface { diff --git a/xs/xsp/SurfaceCollection.xsp b/xs/xsp/SurfaceCollection.xsp index 9924c2d48..77295e881 100644 --- a/xs/xsp/SurfaceCollection.xsp +++ b/xs/xsp/SurfaceCollection.xsp @@ -3,7 +3,6 @@ %{ #include #include "SurfaceCollection.hpp" -#include "perlglue.hpp" %} %name{Slic3r::Surface::Collection} class SurfaceCollection { @@ -35,7 +34,7 @@ SurfaceCollection::arrayref() av_fill(av, THIS->surfaces.size()-1); int i = 0; for (Surfaces::iterator it = THIS->surfaces.begin(); it != THIS->surfaces.end(); ++it) { - av_store(av, i++, (*it).to_SV_ref()); + av_store(av, i++, perl_to_SV_ref(*it)); } RETVAL = newRV_noinc((SV*)av); OUTPUT: @@ -47,7 +46,7 @@ SurfaceCollection::filter_by_type(surface_type) CODE: AV* av = newAV(); for (Surfaces::iterator it = THIS->surfaces.begin(); it != THIS->surfaces.end(); ++it) { - if ((*it).surface_type == surface_type) av_push(av, (*it).to_SV_ref()); + if ((*it).surface_type == surface_type) av_push(av, perl_to_SV_ref(*it)); } RETVAL = newRV_noinc((SV*)av); OUTPUT: @@ -92,7 +91,7 @@ SurfaceCollection::group() av_fill(innerav, it->size()-1); size_t j = 0; for (SurfacesPtr::iterator it_s = it->begin(); it_s != it->end(); ++it_s) { - av_store(innerav, j++, (*it_s)->to_SV_clone_ref()); + av_store(innerav, j++, perl_to_SV_clone_ref(**it_s)); } av_store(av, i++, newRV_noinc((SV*)innerav)); } diff --git a/xs/xsp/TriangleMesh.xsp b/xs/xsp/TriangleMesh.xsp index 8388c8a66..3338d971c 100644 --- a/xs/xsp/TriangleMesh.xsp +++ b/xs/xsp/TriangleMesh.xsp @@ -3,7 +3,6 @@ %{ #include #include "TriangleMesh.hpp" -#include "perlglue.hpp" %} %name{Slic3r::TriangleMesh} class TriangleMesh { @@ -158,7 +157,7 @@ TriangleMesh::slice(z) av_extend(expolygons_av, layers[i].size()-1); unsigned int j = 0; for (ExPolygons::iterator it = layers[i].begin(); it != layers[i].end(); ++it) { - av_store(expolygons_av, j++, (*it).to_SV_clone_ref()); + av_store(expolygons_av, j++, perl_to_SV_clone_ref(*it)); } av_store(layers_av, i, newRV_noinc((SV*)expolygons_av)); } diff --git a/xs/xsp/my.map b/xs/xsp/my.map index 239f7adaf..b122d95d7 100644 --- a/xs/xsp/my.map +++ b/xs/xsp/my.map @@ -237,7 +237,7 @@ T_ARRAYREF av_extend(av, $var.size()-1); int i = 0; for (${type}::const_iterator it = $var.begin(); it != $var.end(); ++it) { - av_store(av, i++, it->to_SV_clone_ref()); + av_store(av, i++, perl_to_SV_clone_ref(*it)); } $var.clear(); @@ -248,7 +248,7 @@ T_ARRAYREF_PTR av_extend(av, $var->size()-1); int i = 0; for (${ my $t = $type; $t =~ s/\*$//; \$t }::iterator it = $var->begin(); it != $var->end(); ++it) { - av_store(av, i++, it->to_SV_ref()); + av_store(av, i++, perl_to_SV_ref(*it)); } T_PTR_ARRAYREF_PTR @@ -258,7 +258,7 @@ T_PTR_ARRAYREF_PTR av_extend(av, $var->size()-1); int i = 0; for (${ my $t = $type; $t =~ s/\*$//; \$t }::iterator it = $var->begin(); it != $var->end(); ++it) { - av_store(av, i++, (*it)->to_SV_ref()); + av_store(av, i++, perl_to_SV_ref(**it)); } T_PTR_ARRAYREF