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

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

View file

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

View file

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

View file

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

View file

@ -3,7 +3,6 @@
%{
#include <myinit.h>
#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:

View file

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

View file

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

View file

@ -3,7 +3,6 @@
%{
#include <myinit.h>
#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:

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -3,7 +3,6 @@
%{
#include <myinit.h>
#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:

View file

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

View file

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

View file

@ -3,7 +3,6 @@
%{
#include <myinit.h>
#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));
}

View file

@ -3,7 +3,6 @@
%{
#include <myinit.h>
#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));
}

View file

@ -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