Replace to_SV_ref() and to_SV_clone_ref() with templated glue functions

This commit is contained in:
Alessandro Ranellucci 2014-05-08 14:52:48 +02:00
parent f76e2c2222
commit 76a8ec3d9e
54 changed files with 39 additions and 254 deletions

View File

@ -1,8 +1,5 @@
#include "BoundingBox.hpp" #include "BoundingBox.hpp"
#include <algorithm> #include <algorithm>
#ifdef SLIC3RXS
#include "perlglue.hpp"
#endif
namespace Slic3r { namespace Slic3r {

View File

@ -592,9 +592,9 @@ polynode2perl(const ClipperLib::PolyNode& node)
Slic3r::Polygon p; Slic3r::Polygon p;
ClipperPath_to_Slic3rMultiPoint(node.Contour, p); ClipperPath_to_Slic3rMultiPoint(node.Contour, p);
if (node.IsHole()) { 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 { } 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) ); (void)hv_stores( hv, "children", polynode_children_2_perl(node) );
return (SV*)newRV_noinc((SV*)hv); return (SV*)newRV_noinc((SV*)hv);

View File

@ -6,9 +6,6 @@
#include "ClipperUtils.hpp" #include "ClipperUtils.hpp"
#include "polypartition.h" #include "polypartition.h"
#include "poly2tri/poly2tri.h" #include "poly2tri/poly2tri.h"
#ifdef SLIC3RXS
#include "perlglue.hpp"
#endif
#include <algorithm> #include <algorithm>
#include <list> #include <list>
@ -367,28 +364,14 @@ ExPolygon::to_AV() {
AV* av = newAV(); AV* av = newAV();
av_extend(av, num_holes); // -1 +1 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++) { 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); 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* SV*
ExPolygon::to_SV_pureperl() const ExPolygon::to_SV_pureperl() const
{ {

View File

@ -39,8 +39,6 @@ class ExPolygon
void from_SV(SV* poly_sv); void from_SV(SV* poly_sv);
void from_SV_check(SV* poly_sv); void from_SV_check(SV* poly_sv);
SV* to_AV(); SV* to_AV();
SV* to_SV_ref();
SV* to_SV_clone_ref() const;
SV* to_SV_pureperl() const; SV* to_SV_pureperl() const;
#endif #endif
}; };

View File

@ -1,8 +1,5 @@
#include "ExPolygonCollection.hpp" #include "ExPolygonCollection.hpp"
#include "Geometry.hpp" #include "Geometry.hpp"
#ifdef SLIC3RXS
#include "perlglue.hpp"
#endif
namespace Slic3r { namespace Slic3r {

View File

@ -1,7 +1,4 @@
#include "Extruder.hpp" #include "Extruder.hpp"
#ifdef SLIC3RXS
#include "perlglue.hpp"
#endif
namespace Slic3r { namespace Slic3r {

View File

@ -4,9 +4,6 @@
#include "ClipperUtils.hpp" #include "ClipperUtils.hpp"
#include "Extruder.hpp" #include "Extruder.hpp"
#include <sstream> #include <sstream>
#ifdef SLIC3RXS
#include "perlglue.hpp"
#endif
namespace Slic3r { namespace Slic3r {
@ -106,20 +103,6 @@ ExtrusionPath::_inflate_collection(const Polylines &polylines, ExtrusionEntityCo
} }
#ifdef SLIC3RXS #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"); REGISTER_CLASS(ExtrusionPath, "ExtrusionPath");
#endif #endif

View File

@ -64,11 +64,6 @@ class ExtrusionPath : public ExtrusionEntity
double xofs, double yofs, std::string extrusion_axis, double xofs, double yofs, std::string extrusion_axis,
std::string gcode_line_suffix) const; std::string gcode_line_suffix) const;
#ifdef SLIC3RXS
SV* to_SV_ref();
SV* to_SV_clone_ref() const;
#endif
private: private:
void _inflate_collection(const Polylines &polylines, ExtrusionEntityCollection* collection) const; void _inflate_collection(const Polylines &polylines, ExtrusionEntityCollection* collection) const;
}; };

View File

@ -1,9 +1,6 @@
#include "ExtrusionEntityCollection.hpp" #include "ExtrusionEntityCollection.hpp"
#include <algorithm> #include <algorithm>
#include <map> #include <map>
#ifdef SLIC3RXS
#include "perlglue.hpp"
#endif
namespace Slic3r { namespace Slic3r {

View File

@ -1,8 +1,5 @@
#include "Flow.hpp" #include "Flow.hpp"
#include <cmath> #include <cmath>
#ifdef SLIC3RXS
#include "perlglue.hpp"
#endif
namespace Slic3r { namespace Slic3r {

View File

@ -4,9 +4,6 @@
#include <algorithm> #include <algorithm>
#include <cmath> #include <cmath>
#include <sstream> #include <sstream>
#ifdef SLIC3RXS
#include "perlglue.hpp"
#endif
namespace Slic3r { namespace Slic3r {
@ -157,31 +154,12 @@ Line::to_AV() {
AV* av = newAV(); AV* av = newAV();
av_extend(av, 1); av_extend(av, 1);
SV* sv = newSV(0); av_store(av, 0, perl_to_SV_ref(this->a));
sv_setref_pv( sv, perl_class_name_ref(&this->a), &(this->a) ); av_store(av, 1, perl_to_SV_ref(this->b));
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);
return newRV_noinc((SV*)av); 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* SV*
Line::to_SV_pureperl() const { Line::to_SV_pureperl() const {
AV* av = newAV(); AV* av = newAV();

View File

@ -38,8 +38,6 @@ class Line
void from_SV(SV* line_sv); void from_SV(SV* line_sv);
void from_SV_check(SV* line_sv); void from_SV_check(SV* line_sv);
SV* to_AV(); SV* to_AV();
SV* to_SV_ref();
SV* to_SV_clone_ref() const;
SV* to_SV_pureperl() const; SV* to_SV_pureperl() const;
#endif #endif
}; };

View File

@ -1,8 +1,4 @@
#include "Model.hpp" #include "Model.hpp"
#ifdef SLIC3RXS
#include "perlglue.hpp"
#endif
namespace Slic3r { namespace Slic3r {
@ -301,13 +297,6 @@ ModelObject::invalidate_bounding_box()
#ifdef SLIC3RXS #ifdef SLIC3RXS
REGISTER_CLASS(ModelObject, "Model::Object"); 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 #endif
@ -322,13 +311,6 @@ ModelVolume::ModelVolume(ModelObject* object, const t_model_material_id &materia
#ifdef SLIC3RXS #ifdef SLIC3RXS
REGISTER_CLASS(ModelVolume, "Model::Volume"); 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 #endif
@ -343,13 +325,6 @@ ModelInstance::ModelInstance(ModelObject *object, double rotation,
#ifdef SLIC3RXS #ifdef SLIC3RXS
REGISTER_CLASS(ModelInstance, "Model::Instance"); 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 #endif
} }

View File

@ -85,6 +85,10 @@ class ModelObject
t_layer_height_ranges layer_height_ranges; t_layer_height_ranges layer_height_ranges;
Pointf origin_translation; 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, ModelObject(Model *model, const std::string &input_file, const DynamicPrintConfig &config,
const t_layer_height_ranges &layer_height_ranges, const Pointf &origin_translation); const t_layer_height_ranges &layer_height_ranges, const Pointf &origin_translation);
ModelObject(const ModelObject &other); ModelObject(const ModelObject &other);
@ -115,14 +119,7 @@ class ModelObject
size_t facets_count() const; size_t facets_count() const;
bool needed_repair() const; bool needed_repair() const;
#ifdef SLIC3RXS
SV* to_SV_ref();
#endif
private: private:
BoundingBoxf3 _bounding_box;
bool _bounding_box_valid;
void update_bounding_box(); void update_bounding_box();
}; };
@ -136,10 +133,6 @@ class ModelVolume
ModelVolume(ModelObject *object, const t_model_material_id &material_id, ModelVolume(ModelObject *object, const t_model_material_id &material_id,
const TriangleMesh &mesh, bool modifier); const TriangleMesh &mesh, bool modifier);
#ifdef SLIC3RXS
SV* to_SV_ref();
#endif
}; };
class ModelInstance class ModelInstance
@ -155,10 +148,6 @@ class ModelInstance
void transform_mesh(TriangleMesh* mesh, bool dont_translate) const; void transform_mesh(TriangleMesh* mesh, bool dont_translate) const;
void transform_polygon(Polygon* polygon) const; void transform_polygon(Polygon* polygon) const;
#ifdef SLIC3RXS
SV* to_SV_ref();
#endif
}; };
} }

View File

@ -129,7 +129,7 @@ MultiPoint::to_AV() {
AV* av = newAV(); AV* av = newAV();
av_extend(av, num_points-1); av_extend(av, num_points-1);
for (unsigned int i = 0; i < num_points; i++) { 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); return newRV_noinc((SV*)av);
} }

View File

@ -1,6 +1,7 @@
#ifndef slic3r_MultiPoint_hpp_ #ifndef slic3r_MultiPoint_hpp_
#define slic3r_MultiPoint_hpp_ #define slic3r_MultiPoint_hpp_
#include <myinit.h>
#include "Line.hpp" #include "Line.hpp"
#include "Point.hpp" #include "Point.hpp"
#include <algorithm> #include <algorithm>

View File

@ -2,9 +2,6 @@
#include "Line.hpp" #include "Line.hpp"
#include <cmath> #include <cmath>
#include <sstream> #include <sstream>
#ifdef SLIC3RXS
#include "perlglue.hpp"
#endif
namespace Slic3r { namespace Slic3r {
@ -145,20 +142,6 @@ Point::ccw(const Line &line) const
REGISTER_CLASS(Point, "Point"); 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* SV*
Point::to_SV_pureperl() const { Point::to_SV_pureperl() const {
AV* av = newAV(); AV* av = newAV();

View File

@ -41,8 +41,6 @@ class Point
#ifdef SLIC3RXS #ifdef SLIC3RXS
void from_SV(SV* point_sv); void from_SV(SV* point_sv);
void from_SV_check(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; SV* to_SV_pureperl() const;
#endif #endif
}; };

View File

@ -2,9 +2,6 @@
#include "ClipperUtils.hpp" #include "ClipperUtils.hpp"
#include "Polygon.hpp" #include "Polygon.hpp"
#include "Polyline.hpp" #include "Polyline.hpp"
#ifdef SLIC3RXS
#include "perlglue.hpp"
#endif
namespace Slic3r { namespace Slic3r {
@ -195,23 +192,8 @@ Polygon::triangulate_convex(Polygons* polygons) const
} }
#ifdef SLIC3RXS #ifdef SLIC3RXS
REGISTER_CLASS(Polygon, "Polygon"); 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 void
Polygon::from_SV_check(SV* poly_sv) Polygon::from_SV_check(SV* poly_sv)
{ {

View File

@ -38,8 +38,6 @@ class Polygon : public MultiPoint {
#ifdef SLIC3RXS #ifdef SLIC3RXS
void from_SV_check(SV* poly_sv); void from_SV_check(SV* poly_sv);
SV* to_SV_ref();
SV* to_SV_clone_ref() const;
#endif #endif
}; };

View File

@ -1,8 +1,5 @@
#include "Polyline.hpp" #include "Polyline.hpp"
#include "Polygon.hpp" #include "Polygon.hpp"
#ifdef SLIC3RXS
#include "perlglue.hpp"
#endif
namespace Slic3r { namespace Slic3r {
@ -122,25 +119,8 @@ Polyline::simplify(double tolerance)
#ifdef SLIC3RXS #ifdef SLIC3RXS
REGISTER_CLASS(Polyline, "Polyline"); 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 void
Polyline::from_SV_check(SV* poly_sv) Polyline::from_SV_check(SV* poly_sv)
{ {

View File

@ -24,8 +24,6 @@ class Polyline : public MultiPoint {
#ifdef SLIC3RXS #ifdef SLIC3RXS
void from_SV_check(SV* poly_sv); void from_SV_check(SV* poly_sv);
SV* to_SV_ref();
SV* to_SV_clone_ref() const;
#endif #endif
}; };

View File

@ -1,7 +1,4 @@
#include "PolylineCollection.hpp" #include "PolylineCollection.hpp"
#ifdef SLIC3RXS
#include "perlglue.hpp"
#endif
namespace Slic3r { namespace Slic3r {

View File

@ -1,7 +1,4 @@
#include "Print.hpp" #include "Print.hpp"
#ifdef SLIC3RXS
#include "perlglue.hpp"
#endif
namespace Slic3r { namespace Slic3r {

View File

@ -1,6 +1,7 @@
#ifndef slic3r_Print_hpp_ #ifndef slic3r_Print_hpp_
#define slic3r_Print_hpp_ #define slic3r_Print_hpp_
#include <myinit.h>
#include <set> #include <set>
namespace Slic3r { namespace Slic3r {

View File

@ -1,7 +1,4 @@
#include "PrintConfig.hpp" #include "PrintConfig.hpp"
#ifdef SLIC3RXS
#include "perlglue.hpp"
#endif
namespace Slic3r { namespace Slic3r {

View File

@ -1,7 +1,4 @@
#include "Surface.hpp" #include "Surface.hpp"
#ifdef SLIC3RXS
#include "perlglue.hpp"
#endif
namespace Slic3r { namespace Slic3r {
@ -54,20 +51,6 @@ Surface::from_SV_check(SV* surface_sv)
// a XS Surface was supplied // a XS Surface was supplied
*this = *(Surface *)SvIV((SV*)SvRV( surface_sv )); *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 #endif
} }

View File

@ -24,8 +24,6 @@ class Surface
#ifdef SLIC3RXS #ifdef SLIC3RXS
void from_SV_check(SV* surface_sv); void from_SV_check(SV* surface_sv);
SV* to_SV_ref();
SV* to_SV_clone_ref() const;
#endif #endif
}; };

View File

@ -1,8 +1,5 @@
#include "SurfaceCollection.hpp" #include "SurfaceCollection.hpp"
#include <map> #include <map>
#ifdef SLIC3RXS
#include "perlglue.hpp"
#endif
namespace Slic3r { namespace Slic3r {

View File

@ -11,9 +11,6 @@
#include <algorithm> #include <algorithm>
#include <math.h> #include <math.h>
#include <assert.h> #include <assert.h>
#ifdef SLIC3RXS
#include "perlglue.hpp"
#endif
#ifdef SLIC3R_DEBUG #ifdef SLIC3R_DEBUG
#include "SVG.hpp" #include "SVG.hpp"

View File

@ -17,6 +17,7 @@ extern "C" {
#undef do_open #undef do_open
#undef do_close #undef do_close
} }
#include "perlglue.hpp"
#endif #endif
#define EPSILON 1e-4 #define EPSILON 1e-4

View File

@ -23,7 +23,21 @@ template<class T>
const char* perl_class_name(const T*) { return ClassTraits<T>::name; } const char* perl_class_name(const T*) { return ClassTraits<T>::name; }
template<class T> template<class T>
const char* perl_class_name_ref(const T*) { return ClassTraits<T>::name_ref; } const char* perl_class_name_ref(const T*) { return ClassTraits<T>::name_ref; }
template<class T>
SV* perl_to_SV_ref(T &t) {
SV* sv = newSV(0);
sv_setref_pv( sv, perl_class_name_ref(&t), &t );
return sv;
}
template<class T>
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 T> template <class T>
class Ref { class Ref {
T* val; T* val;

View File

@ -4,7 +4,6 @@
#include <myinit.h> #include <myinit.h>
#include "BoundingBox.hpp" #include "BoundingBox.hpp"
#include "Point.hpp" #include "Point.hpp"
#include "perlglue.hpp"
%} %}
%name{Slic3r::Geometry::BoundingBox} class BoundingBox { %name{Slic3r::Geometry::BoundingBox} class BoundingBox {

View File

@ -4,7 +4,6 @@
#include <myinit.h> #include <myinit.h>
#include "clipper.hpp" #include "clipper.hpp"
#include "ClipperUtils.hpp" #include "ClipperUtils.hpp"
#include "perlglue.hpp"
%} %}
%package{Slic3r::Geometry::Clipper}; %package{Slic3r::Geometry::Clipper};

View File

@ -3,7 +3,6 @@
%{ %{
#include <myinit.h> #include <myinit.h>
#include "PrintConfig.hpp" #include "PrintConfig.hpp"
#include "perlglue.hpp"
%} %}
%name{Slic3r::Config} class DynamicPrintConfig { %name{Slic3r::Config} class DynamicPrintConfig {

View File

@ -3,7 +3,6 @@
%{ %{
#include <myinit.h> #include <myinit.h>
#include "ExPolygon.hpp" #include "ExPolygon.hpp"
#include "perlglue.hpp"
%} %}
%name{Slic3r::ExPolygon} class ExPolygon { %name{Slic3r::ExPolygon} class ExPolygon {

View File

@ -3,7 +3,6 @@
%{ %{
#include <myinit.h> #include <myinit.h>
#include "ExPolygonCollection.hpp" #include "ExPolygonCollection.hpp"
#include "perlglue.hpp"
%} %}
%name{Slic3r::ExPolygon::Collection} class ExPolygonCollection { %name{Slic3r::ExPolygon::Collection} class ExPolygonCollection {
@ -45,7 +44,7 @@ ExPolygonCollection::arrayref()
av_fill(av, THIS->expolygons.size()-1); av_fill(av, THIS->expolygons.size()-1);
int i = 0; int i = 0;
for (ExPolygons::iterator it = THIS->expolygons.begin(); it != THIS->expolygons.end(); ++it) { 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); RETVAL = newRV_noinc((SV*)av);
OUTPUT: OUTPUT:

View File

@ -3,7 +3,6 @@
%{ %{
#include <myinit.h> #include <myinit.h>
#include "Extruder.hpp" #include "Extruder.hpp"
#include "perlglue.hpp"
%} %}
%name{Slic3r::Extruder} class Extruder { %name{Slic3r::Extruder} class Extruder {

View File

@ -3,7 +3,6 @@
%{ %{
#include <myinit.h> #include <myinit.h>
#include "ExtrusionEntityCollection.hpp" #include "ExtrusionEntityCollection.hpp"
#include "perlglue.hpp"
%} %}
%name{Slic3r::ExtrusionPath::Collection} class ExtrusionEntityCollection { %name{Slic3r::ExtrusionPath::Collection} class ExtrusionEntityCollection {

View File

@ -3,7 +3,6 @@
%{ %{
#include <myinit.h> #include <myinit.h>
#include "ExtrusionEntity.hpp" #include "ExtrusionEntity.hpp"
#include "perlglue.hpp"
%} %}
%name{Slic3r::ExtrusionLoop} class ExtrusionLoop { %name{Slic3r::ExtrusionLoop} class ExtrusionLoop {
@ -36,7 +35,7 @@ ExtrusionLoop::arrayref()
av_fill(av, THIS->paths.size()-1); av_fill(av, THIS->paths.size()-1);
int i = 0; int i = 0;
for (ExtrusionPaths::iterator it = THIS->paths.begin(); it != THIS->paths.end(); ++it) { 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); RETVAL = newRV_noinc((SV*)av);
OUTPUT: OUTPUT:

View File

@ -4,7 +4,6 @@
#include <myinit.h> #include <myinit.h>
#include "ExtrusionEntity.hpp" #include "ExtrusionEntity.hpp"
#include "ExtrusionEntityCollection.hpp" #include "ExtrusionEntityCollection.hpp"
#include "perlglue.hpp"
%} %}
%name{Slic3r::ExtrusionPath} class ExtrusionPath { %name{Slic3r::ExtrusionPath} class ExtrusionPath {

View File

@ -3,7 +3,6 @@
%{ %{
#include <myinit.h> #include <myinit.h>
#include "Flow.hpp" #include "Flow.hpp"
#include "perlglue.hpp"
%} %}
%name{Slic3r::Flow} class Flow { %name{Slic3r::Flow} class Flow {

View File

@ -3,7 +3,6 @@
%{ %{
#include <myinit.h> #include <myinit.h>
#include "Geometry.hpp" #include "Geometry.hpp"
#include "perlglue.hpp"
%} %}

View File

@ -4,7 +4,6 @@
#include <myinit.h> #include <myinit.h>
#include "Line.hpp" #include "Line.hpp"
#include "Polyline.hpp" #include "Polyline.hpp"
#include "perlglue.hpp"
%} %}
%name{Slic3r::Line} class Line { %name{Slic3r::Line} class Line {

View File

@ -4,7 +4,6 @@
#include <myinit.h> #include <myinit.h>
#include "Model.hpp" #include "Model.hpp"
#include "PrintConfig.hpp" #include "PrintConfig.hpp"
#include "perlglue.hpp"
%} %}
%name{Slic3r::Model} class Model { %name{Slic3r::Model} class Model {

View File

@ -3,7 +3,6 @@
%{ %{
#include <myinit.h> #include <myinit.h>
#include "Point.hpp" #include "Point.hpp"
#include "perlglue.hpp"
%} %}
%name{Slic3r::Point} class Point { %name{Slic3r::Point} class Point {

View File

@ -3,7 +3,6 @@
%{ %{
#include <myinit.h> #include <myinit.h>
#include "Polygon.hpp" #include "Polygon.hpp"
#include "perlglue.hpp"
%} %}
%name{Slic3r::Polygon} class Polygon { %name{Slic3r::Polygon} class Polygon {

View File

@ -4,7 +4,6 @@
#include <myinit.h> #include <myinit.h>
#include "ClipperUtils.hpp" #include "ClipperUtils.hpp"
#include "Polyline.hpp" #include "Polyline.hpp"
#include "perlglue.hpp"
%} %}
%name{Slic3r::Polyline} class Polyline { %name{Slic3r::Polyline} class Polyline {

View File

@ -3,7 +3,6 @@
%{ %{
#include <myinit.h> #include <myinit.h>
#include "PolylineCollection.hpp" #include "PolylineCollection.hpp"
#include "perlglue.hpp"
%} %}
%name{Slic3r::Polyline::Collection} class PolylineCollection { %name{Slic3r::Polyline::Collection} class PolylineCollection {
@ -47,7 +46,7 @@ PolylineCollection::arrayref()
av_fill(av, THIS->polylines.size()-1); av_fill(av, THIS->polylines.size()-1);
int i = 0; int i = 0;
for (Polylines::iterator it = THIS->polylines.begin(); it != THIS->polylines.end(); ++it) { 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); RETVAL = newRV_noinc((SV*)av);
OUTPUT: OUTPUT:

View File

@ -3,7 +3,6 @@
%{ %{
#include <myinit.h> #include <myinit.h>
#include "Print.hpp" #include "Print.hpp"
#include "perlglue.hpp"
%} %}
%name{Slic3r::Print::State} class PrintState { %name{Slic3r::Print::State} class PrintState {

View File

@ -4,7 +4,6 @@
#include <myinit.h> #include <myinit.h>
#include "Surface.hpp" #include "Surface.hpp"
#include "ClipperUtils.hpp" #include "ClipperUtils.hpp"
#include "perlglue.hpp"
%} %}
%name{Slic3r::Surface} class Surface { %name{Slic3r::Surface} class Surface {

View File

@ -3,7 +3,6 @@
%{ %{
#include <myinit.h> #include <myinit.h>
#include "SurfaceCollection.hpp" #include "SurfaceCollection.hpp"
#include "perlglue.hpp"
%} %}
%name{Slic3r::Surface::Collection} class SurfaceCollection { %name{Slic3r::Surface::Collection} class SurfaceCollection {
@ -35,7 +34,7 @@ SurfaceCollection::arrayref()
av_fill(av, THIS->surfaces.size()-1); av_fill(av, THIS->surfaces.size()-1);
int i = 0; int i = 0;
for (Surfaces::iterator it = THIS->surfaces.begin(); it != THIS->surfaces.end(); ++it) { 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); RETVAL = newRV_noinc((SV*)av);
OUTPUT: OUTPUT:
@ -47,7 +46,7 @@ SurfaceCollection::filter_by_type(surface_type)
CODE: CODE:
AV* av = newAV(); AV* av = newAV();
for (Surfaces::iterator it = THIS->surfaces.begin(); it != THIS->surfaces.end(); ++it) { 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); RETVAL = newRV_noinc((SV*)av);
OUTPUT: OUTPUT:
@ -92,7 +91,7 @@ SurfaceCollection::group()
av_fill(innerav, it->size()-1); av_fill(innerav, it->size()-1);
size_t j = 0; size_t j = 0;
for (SurfacesPtr::iterator it_s = it->begin(); it_s != it->end(); ++it_s) { 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)); av_store(av, i++, newRV_noinc((SV*)innerav));
} }

View File

@ -3,7 +3,6 @@
%{ %{
#include <myinit.h> #include <myinit.h>
#include "TriangleMesh.hpp" #include "TriangleMesh.hpp"
#include "perlglue.hpp"
%} %}
%name{Slic3r::TriangleMesh} class TriangleMesh { %name{Slic3r::TriangleMesh} class TriangleMesh {
@ -158,7 +157,7 @@ TriangleMesh::slice(z)
av_extend(expolygons_av, layers[i].size()-1); av_extend(expolygons_av, layers[i].size()-1);
unsigned int j = 0; unsigned int j = 0;
for (ExPolygons::iterator it = layers[i].begin(); it != layers[i].end(); ++it) { 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)); av_store(layers_av, i, newRV_noinc((SV*)expolygons_av));
} }

View File

@ -237,7 +237,7 @@ T_ARRAYREF
av_extend(av, $var.size()-1); av_extend(av, $var.size()-1);
int i = 0; int i = 0;
for (${type}::const_iterator it = $var.begin(); it != $var.end(); ++it) { 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(); $var.clear();
@ -248,7 +248,7 @@ T_ARRAYREF_PTR
av_extend(av, $var->size()-1); av_extend(av, $var->size()-1);
int i = 0; int i = 0;
for (${ my $t = $type; $t =~ s/\*$//; \$t }::iterator it = $var->begin(); it != $var->end(); ++it) { 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 T_PTR_ARRAYREF_PTR
@ -258,7 +258,7 @@ T_PTR_ARRAYREF_PTR
av_extend(av, $var->size()-1); av_extend(av, $var->size()-1);
int i = 0; int i = 0;
for (${ my $t = $type; $t =~ s/\*$//; \$t }::iterator it = $var->begin(); it != $var->end(); ++it) { 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 T_PTR_ARRAYREF