2014-04-29 23:04:49 +00:00
|
|
|
coordf_t T_NV
|
|
|
|
|
2014-11-22 21:20:28 +00:00
|
|
|
std::string T_STD_STRING
|
|
|
|
t_config_option_key T_STD_STRING
|
|
|
|
t_model_material_id T_STD_STRING
|
|
|
|
|
|
|
|
std::vector<std::string> T_STD_VECTOR_STD_STRING
|
|
|
|
|
|
|
|
std::vector<int> T_STD_VECTOR_INT
|
2013-11-23 20:39:05 +00:00
|
|
|
std::vector<Points::size_type> T_STD_VECTOR_INT
|
2014-11-22 21:20:28 +00:00
|
|
|
std::vector<size_t> T_STD_VECTOR_INT
|
|
|
|
|
|
|
|
std::vector<unsigned int> T_STD_VECTOR_UINT
|
|
|
|
|
|
|
|
std::vector<double> T_STD_VECTOR_DOUBLE
|
2014-04-29 23:04:49 +00:00
|
|
|
|
2014-11-22 21:20:28 +00:00
|
|
|
t_layer_height_ranges T_LAYER_HEIGHT_RANGES
|
2014-04-29 23:04:49 +00:00
|
|
|
|
2013-11-23 20:39:05 +00:00
|
|
|
|
2014-04-27 17:18:53 +00:00
|
|
|
BoundingBox* O_OBJECT_SLIC3R
|
|
|
|
Ref<BoundingBox> O_OBJECT_SLIC3R_T
|
|
|
|
Clone<BoundingBox> O_OBJECT_SLIC3R_T
|
|
|
|
|
2014-06-16 13:18:39 +00:00
|
|
|
BoundingBoxf* O_OBJECT_SLIC3R
|
|
|
|
Ref<BoundingBoxf> O_OBJECT_SLIC3R_T
|
|
|
|
Clone<BoundingBoxf> O_OBJECT_SLIC3R_T
|
|
|
|
|
2014-04-27 17:18:53 +00:00
|
|
|
BoundingBoxf3* O_OBJECT_SLIC3R
|
|
|
|
Ref<BoundingBoxf3> O_OBJECT_SLIC3R_T
|
|
|
|
Clone<BoundingBoxf3> O_OBJECT_SLIC3R_T
|
|
|
|
|
|
|
|
DynamicPrintConfig* O_OBJECT_SLIC3R
|
2014-04-29 23:04:49 +00:00
|
|
|
Ref<DynamicPrintConfig> O_OBJECT_SLIC3R_T
|
2014-05-06 08:07:18 +00:00
|
|
|
|
2014-04-27 17:18:53 +00:00
|
|
|
PrintObjectConfig* O_OBJECT_SLIC3R
|
2014-05-06 08:07:18 +00:00
|
|
|
Ref<PrintObjectConfig> O_OBJECT_SLIC3R_T
|
|
|
|
|
2014-04-27 17:18:53 +00:00
|
|
|
PrintRegionConfig* O_OBJECT_SLIC3R
|
2014-05-06 08:07:18 +00:00
|
|
|
Ref<PrintRegionConfig> O_OBJECT_SLIC3R_T
|
|
|
|
|
2014-10-18 15:41:21 +00:00
|
|
|
GCodeConfig* O_OBJECT_SLIC3R
|
|
|
|
Ref<GCodeConfig> O_OBJECT_SLIC3R_T
|
|
|
|
|
2014-04-27 17:18:53 +00:00
|
|
|
PrintConfig* O_OBJECT_SLIC3R
|
2014-05-06 08:07:18 +00:00
|
|
|
Ref<PrintConfig> O_OBJECT_SLIC3R_T
|
|
|
|
|
2014-04-27 17:18:53 +00:00
|
|
|
FullPrintConfig* O_OBJECT_SLIC3R
|
2014-05-06 08:07:18 +00:00
|
|
|
Ref<FullPrintConfig> O_OBJECT_SLIC3R_T
|
|
|
|
|
2014-04-27 17:18:53 +00:00
|
|
|
ZTable* O_OBJECT
|
|
|
|
|
|
|
|
TriangleMesh* O_OBJECT_SLIC3R
|
|
|
|
Ref<TriangleMesh> O_OBJECT_SLIC3R_T
|
|
|
|
Clone<TriangleMesh> O_OBJECT_SLIC3R_T
|
|
|
|
|
|
|
|
Point* O_OBJECT_SLIC3R
|
|
|
|
Ref<Point> O_OBJECT_SLIC3R_T
|
|
|
|
Clone<Point> O_OBJECT_SLIC3R_T
|
|
|
|
|
2014-05-06 08:07:18 +00:00
|
|
|
Point3* O_OBJECT_SLIC3R
|
|
|
|
Ref<Point3> O_OBJECT_SLIC3R_T
|
|
|
|
Clone<Point3> O_OBJECT_SLIC3R_T
|
|
|
|
|
2014-04-27 21:49:05 +00:00
|
|
|
Pointf* O_OBJECT_SLIC3R
|
|
|
|
Ref<Pointf> O_OBJECT_SLIC3R_T
|
|
|
|
Clone<Pointf> O_OBJECT_SLIC3R_T
|
|
|
|
|
2014-04-27 17:18:53 +00:00
|
|
|
Pointf3* O_OBJECT_SLIC3R
|
|
|
|
Ref<Pointf3> O_OBJECT_SLIC3R_T
|
|
|
|
Clone<Pointf3> O_OBJECT_SLIC3R_T
|
|
|
|
|
|
|
|
Line* O_OBJECT_SLIC3R
|
|
|
|
Ref<Line> O_OBJECT_SLIC3R_T
|
|
|
|
Clone<Line> O_OBJECT_SLIC3R_T
|
|
|
|
|
2014-12-16 00:12:37 +00:00
|
|
|
Linef3* O_OBJECT_SLIC3R
|
|
|
|
Ref<Linef3> O_OBJECT_SLIC3R_T
|
|
|
|
Clone<Linef3> O_OBJECT_SLIC3R_T
|
|
|
|
|
2014-04-27 17:18:53 +00:00
|
|
|
Polyline* O_OBJECT_SLIC3R
|
|
|
|
Ref<Polyline> O_OBJECT_SLIC3R_T
|
|
|
|
Clone<Polyline> O_OBJECT_SLIC3R_T
|
|
|
|
|
|
|
|
PolylineCollection* O_OBJECT_SLIC3R
|
|
|
|
Ref<PolylineCollection> O_OBJECT_SLIC3R_T
|
|
|
|
Clone<PolylineCollection> O_OBJECT_SLIC3R_T
|
|
|
|
|
|
|
|
Polygon* O_OBJECT_SLIC3R
|
|
|
|
Ref<Polygon> O_OBJECT_SLIC3R_T
|
|
|
|
Clone<Polygon> O_OBJECT_SLIC3R_T
|
|
|
|
|
|
|
|
ExPolygon* O_OBJECT_SLIC3R
|
|
|
|
Ref<ExPolygon> O_OBJECT_SLIC3R_T
|
|
|
|
Clone<ExPolygon> O_OBJECT_SLIC3R_T
|
|
|
|
|
|
|
|
ExPolygonCollection* O_OBJECT_SLIC3R
|
|
|
|
Ref<ExPolygonCollection> O_OBJECT_SLIC3R_T
|
|
|
|
Clone<ExPolygonCollection> O_OBJECT_SLIC3R_T
|
|
|
|
|
|
|
|
ExtrusionEntityCollection* O_OBJECT_SLIC3R
|
|
|
|
Ref<ExtrusionEntityCollection> O_OBJECT_SLIC3R_T
|
|
|
|
Clone<ExtrusionEntityCollection> O_OBJECT_SLIC3R_T
|
|
|
|
|
|
|
|
ExtrusionPath* O_OBJECT_SLIC3R
|
|
|
|
Ref<ExtrusionPath> O_OBJECT_SLIC3R_T
|
|
|
|
Clone<ExtrusionPath> O_OBJECT_SLIC3R_T
|
|
|
|
|
|
|
|
ExtrusionLoop* O_OBJECT_SLIC3R
|
|
|
|
Ref<ExtrusionLoop> O_OBJECT_SLIC3R_T
|
|
|
|
Clone<ExtrusionLoop> O_OBJECT_SLIC3R_T
|
|
|
|
|
|
|
|
Flow* O_OBJECT_SLIC3R
|
|
|
|
Ref<Flow> O_OBJECT_SLIC3R_T
|
|
|
|
Clone<Flow> O_OBJECT_SLIC3R_T
|
|
|
|
|
|
|
|
PrintState* O_OBJECT_SLIC3R
|
2014-05-06 08:07:18 +00:00
|
|
|
Ref<PrintState> O_OBJECT_SLIC3R_T
|
2014-04-27 17:18:53 +00:00
|
|
|
|
|
|
|
Surface* O_OBJECT_SLIC3R
|
|
|
|
Ref<Surface> O_OBJECT_SLIC3R_T
|
|
|
|
Clone<Surface> O_OBJECT_SLIC3R_T
|
|
|
|
|
|
|
|
SurfaceCollection* O_OBJECT_SLIC3R
|
2014-05-06 08:07:18 +00:00
|
|
|
Ref<SurfaceCollection> O_OBJECT_SLIC3R_T
|
2013-07-15 10:14:22 +00:00
|
|
|
|
2014-04-07 23:42:29 +00:00
|
|
|
Extruder* O_OBJECT_SLIC3R
|
2014-11-09 18:02:45 +00:00
|
|
|
Ref<Extruder> O_OBJECT_SLIC3R_T
|
|
|
|
Clone<Extruder> O_OBJECT_SLIC3R_T
|
2014-04-07 23:42:29 +00:00
|
|
|
|
2014-04-29 23:04:49 +00:00
|
|
|
Model* O_OBJECT_SLIC3R
|
|
|
|
Ref<Model> O_OBJECT_SLIC3R_T
|
|
|
|
Clone<Model> O_OBJECT_SLIC3R_T
|
|
|
|
|
|
|
|
ModelMaterial* O_OBJECT_SLIC3R
|
|
|
|
Ref<ModelMaterial> O_OBJECT_SLIC3R_T
|
|
|
|
Clone<ModelMaterial> O_OBJECT_SLIC3R_T
|
|
|
|
|
|
|
|
ModelObject* O_OBJECT_SLIC3R
|
|
|
|
Ref<ModelObject> O_OBJECT_SLIC3R_T
|
|
|
|
Clone<ModelObject> O_OBJECT_SLIC3R_T
|
|
|
|
|
|
|
|
ModelVolume* O_OBJECT_SLIC3R
|
|
|
|
Ref<ModelVolume> O_OBJECT_SLIC3R_T
|
|
|
|
Clone<ModelVolume> O_OBJECT_SLIC3R_T
|
|
|
|
|
|
|
|
ModelInstance* O_OBJECT_SLIC3R
|
|
|
|
Ref<ModelInstance> O_OBJECT_SLIC3R_T
|
|
|
|
Clone<ModelInstance> O_OBJECT_SLIC3R_T
|
|
|
|
|
2014-05-06 08:07:18 +00:00
|
|
|
PrintRegion* O_OBJECT_SLIC3R
|
|
|
|
Ref<PrintRegion> O_OBJECT_SLIC3R_T
|
|
|
|
|
|
|
|
PrintObject* O_OBJECT_SLIC3R
|
|
|
|
Ref<PrintObject> O_OBJECT_SLIC3R_T
|
|
|
|
|
|
|
|
Print* O_OBJECT_SLIC3R
|
|
|
|
Ref<Print> O_OBJECT_SLIC3R_T
|
|
|
|
Clone<Print> O_OBJECT_SLIC3R_T
|
|
|
|
|
|
|
|
LayerRegion* O_OBJECT_SLIC3R
|
|
|
|
Ref<LayerRegion> O_OBJECT_SLIC3R_T
|
|
|
|
|
|
|
|
Layer* O_OBJECT_SLIC3R
|
|
|
|
Ref<Layer> O_OBJECT_SLIC3R_T
|
|
|
|
|
|
|
|
SupportLayer* O_OBJECT_SLIC3R
|
|
|
|
Ref<SupportLayer> O_OBJECT_SLIC3R_T
|
|
|
|
|
|
|
|
PlaceholderParser* O_OBJECT_SLIC3R
|
|
|
|
Ref<PlaceholderParser> O_OBJECT_SLIC3R_T
|
|
|
|
Clone<PlaceholderParser> O_OBJECT_SLIC3R_T
|
|
|
|
|
2015-07-01 18:14:05 +00:00
|
|
|
AvoidCrossingPerimeters* O_OBJECT_SLIC3R
|
|
|
|
Ref<AvoidCrossingPerimeters> O_OBJECT_SLIC3R_T
|
|
|
|
Clone<AvoidCrossingPerimeters> O_OBJECT_SLIC3R_T
|
|
|
|
|
2015-07-01 18:57:16 +00:00
|
|
|
Wipe* O_OBJECT_SLIC3R
|
|
|
|
Ref<Wipe> O_OBJECT_SLIC3R_T
|
|
|
|
Clone<Wipe> O_OBJECT_SLIC3R_T
|
|
|
|
|
2015-07-01 19:01:42 +00:00
|
|
|
OozePrevention* O_OBJECT_SLIC3R
|
|
|
|
Ref<OozePrevention> O_OBJECT_SLIC3R_T
|
|
|
|
Clone<OozePrevention> O_OBJECT_SLIC3R_T
|
2015-07-01 19:47:17 +00:00
|
|
|
|
|
|
|
GCode* O_OBJECT_SLIC3R
|
|
|
|
Ref<GCode> O_OBJECT_SLIC3R_T
|
|
|
|
Clone<GCode> O_OBJECT_SLIC3R_T
|
2015-07-01 19:01:42 +00:00
|
|
|
|
2014-05-13 18:06:01 +00:00
|
|
|
MotionPlanner* O_OBJECT_SLIC3R
|
|
|
|
Ref<MotionPlanner> O_OBJECT_SLIC3R_T
|
|
|
|
Clone<MotionPlanner> O_OBJECT_SLIC3R_T
|
2014-04-29 23:04:49 +00:00
|
|
|
|
2014-11-09 18:02:45 +00:00
|
|
|
GCodeWriter* O_OBJECT_SLIC3R
|
|
|
|
Ref<GCodeWriter> O_OBJECT_SLIC3R_T
|
|
|
|
Clone<GCodeWriter> O_OBJECT_SLIC3R_T
|
|
|
|
|
2014-11-15 21:41:22 +00:00
|
|
|
BridgeDetector* O_OBJECT_SLIC3R
|
|
|
|
Ref<BridgeDetector> O_OBJECT_SLIC3R_T
|
|
|
|
Clone<BridgeDetector> O_OBJECT_SLIC3R_T
|
|
|
|
|
2015-01-24 22:35:29 +00:00
|
|
|
GLVertexArray* O_OBJECT_SLIC3R
|
|
|
|
|
2015-04-16 19:22:04 +00:00
|
|
|
Axis T_UV
|
2014-05-12 19:49:17 +00:00
|
|
|
ExtrusionLoopRole T_UV
|
2013-07-15 10:14:22 +00:00
|
|
|
ExtrusionRole T_UV
|
2014-01-05 12:16:13 +00:00
|
|
|
FlowRole T_UV
|
2013-12-20 00:36:42 +00:00
|
|
|
PrintStep T_UV
|
2014-06-10 22:15:02 +00:00
|
|
|
PrintObjectStep T_UV
|
2013-07-15 10:14:22 +00:00
|
|
|
SurfaceType T_UV
|
2013-07-16 18:09:53 +00:00
|
|
|
ClipperLib::JoinType T_UV
|
2013-07-16 22:29:09 +00:00
|
|
|
ClipperLib::PolyFillType T_UV
|
2013-07-15 21:12:13 +00:00
|
|
|
|
2013-09-09 20:27:58 +00:00
|
|
|
# we return these types whenever we want the items to be cloned
|
2013-08-26 22:52:20 +00:00
|
|
|
Points T_ARRAYREF
|
2014-01-07 11:48:09 +00:00
|
|
|
Pointfs T_ARRAYREF
|
2013-07-16 18:09:53 +00:00
|
|
|
Lines T_ARRAYREF
|
|
|
|
Polygons T_ARRAYREF
|
2013-11-21 13:15:38 +00:00
|
|
|
Polylines T_ARRAYREF
|
2013-07-16 18:09:53 +00:00
|
|
|
ExPolygons T_ARRAYREF
|
2014-05-08 09:07:37 +00:00
|
|
|
ExtrusionPaths T_ARRAYREF
|
2013-11-23 17:29:25 +00:00
|
|
|
Surfaces T_ARRAYREF
|
2013-07-15 21:12:13 +00:00
|
|
|
|
2013-09-09 20:27:58 +00:00
|
|
|
# we return these types whenever we want the items to be returned
|
|
|
|
# by reference and marked ::Ref because they're contained in another
|
|
|
|
# Perl object
|
2014-05-06 08:07:18 +00:00
|
|
|
Polygons* T_ARRAYREF_PTR
|
|
|
|
ModelObjectPtrs* T_PTR_ARRAYREF_PTR
|
|
|
|
ModelVolumePtrs* T_PTR_ARRAYREF_PTR
|
|
|
|
ModelInstancePtrs* T_PTR_ARRAYREF_PTR
|
|
|
|
PrintRegionPtrs* T_PTR_ARRAYREF_PTR
|
|
|
|
PrintObjectPtrs* T_PTR_ARRAYREF_PTR
|
|
|
|
LayerPtrs* T_PTR_ARRAYREF_PTR
|
|
|
|
SupportLayerPtrs* T_PTR_ARRAYREF_PTR
|
2013-09-02 18:22:20 +00:00
|
|
|
|
2013-09-09 20:27:58 +00:00
|
|
|
# we return these types whenever we want the items to be returned
|
|
|
|
# by reference and not marked ::Ref because they're newly allocated
|
|
|
|
# and not referenced by any Perl object
|
|
|
|
TriangleMeshPtrs T_PTR_ARRAYREF
|
|
|
|
|
2014-04-29 23:04:49 +00:00
|
|
|
|
2013-07-15 21:12:13 +00:00
|
|
|
INPUT
|
|
|
|
|
2014-11-22 21:20:28 +00:00
|
|
|
T_STD_STRING
|
|
|
|
{
|
|
|
|
size_t len;
|
|
|
|
const char * c = SvPV($arg, len);
|
|
|
|
$var = std::string(c, len);
|
|
|
|
}
|
|
|
|
|
|
|
|
T_STD_VECTOR_STD_STRING
|
|
|
|
if (SvROK($arg) && SvTYPE(SvRV($arg))==SVt_PVAV) {
|
|
|
|
AV* av = (AV*)SvRV($arg);
|
|
|
|
const unsigned int alen = av_len(av)+1;
|
|
|
|
$var = std::vector<std::string>(alen);
|
|
|
|
STRLEN len;
|
|
|
|
char* tmp;
|
|
|
|
SV** elem;
|
|
|
|
for (unsigned int i = 0; i < alen; i++) {
|
|
|
|
elem = av_fetch(av, i, 0);
|
|
|
|
if (elem != NULL) {
|
|
|
|
tmp = SvPV(*elem, len);
|
|
|
|
${var}[i] = std::string(tmp, len);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
${var}[i] = std::string(\"\");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
Perl_croak(aTHX_ \"%s: %s is not an array reference\",
|
|
|
|
${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]},
|
|
|
|
\"$var\");
|
|
|
|
|
|
|
|
T_STD_VECTOR_INT
|
|
|
|
if (SvROK($arg) && SvTYPE(SvRV($arg))==SVt_PVAV) {
|
|
|
|
AV* av = (AV*)SvRV($arg);
|
|
|
|
const unsigned int len = av_len(av)+1;
|
|
|
|
$var = std::vector<int>(len);
|
|
|
|
SV** elem;
|
|
|
|
for (unsigned int i = 0; i < len; i++) {
|
|
|
|
elem = av_fetch(av, i, 0);
|
|
|
|
if (elem != NULL)
|
|
|
|
${var}[i] = SvIV(*elem);
|
|
|
|
else
|
|
|
|
${var}[i] = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
Perl_croak(aTHX_ \"%s: %s is not an array reference\",
|
|
|
|
${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]},
|
|
|
|
\"$var\");
|
|
|
|
|
|
|
|
T_STD_VECTOR_UINT
|
|
|
|
if (SvROK($arg) && SvTYPE(SvRV($arg))==SVt_PVAV) {
|
|
|
|
AV* av = (AV*)SvRV($arg);
|
|
|
|
const unsigned int len = av_len(av)+1;
|
|
|
|
$var = std::vector<unsigned int>(len);
|
|
|
|
SV** elem;
|
|
|
|
for (unsigned int i = 0; i < len; i++) {
|
|
|
|
elem = av_fetch(av, i, 0);
|
|
|
|
if (elem != NULL)
|
|
|
|
${var}[i] = SvUV(*elem);
|
|
|
|
else
|
|
|
|
${var}[i] = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
Perl_croak(aTHX_ \"%s: %s is not an array reference\",
|
|
|
|
${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]},
|
|
|
|
\"$var\");
|
|
|
|
|
|
|
|
T_STD_VECTOR_DOUBLE
|
|
|
|
if (SvROK($arg) && SvTYPE(SvRV($arg))==SVt_PVAV) {
|
|
|
|
AV* av = (AV*)SvRV($arg);
|
|
|
|
const unsigned int len = av_len(av)+1;
|
|
|
|
$var = std::vector<double>(len);
|
|
|
|
SV** elem;
|
|
|
|
for (unsigned int i = 0; i < len; i++) {
|
|
|
|
elem = av_fetch(av, i, 0);
|
|
|
|
if (elem != NULL)
|
|
|
|
${var}[i] = SvNV(*elem);
|
|
|
|
else
|
|
|
|
${var}[i] = 0.;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
Perl_croak(aTHX_ \"%s: %s is not an array reference\",
|
|
|
|
${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]},
|
|
|
|
\"$var\");
|
|
|
|
|
2014-04-27 17:18:53 +00:00
|
|
|
O_OBJECT_SLIC3R
|
|
|
|
if( sv_isobject($arg) && (SvTYPE(SvRV($arg)) == SVt_PVMG) ) {
|
|
|
|
if ( sv_isa($arg, perl_class_name($var) ) || sv_isa($arg, perl_class_name_ref($var) )) {
|
|
|
|
$var = ($type)SvIV((SV*)SvRV( $arg ));
|
|
|
|
} else {
|
|
|
|
croak(\"$var is not of type %s (got %s)\", perl_class_name($var), HvNAME(SvSTASH(SvRV($arg))));
|
|
|
|
XSRETURN_UNDEF;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
warn( \"${Package}::$func_name() -- $var is not a blessed SV reference\" );
|
|
|
|
XSRETURN_UNDEF;
|
|
|
|
}
|
|
|
|
|
2013-07-16 18:09:53 +00:00
|
|
|
T_ARRAYREF
|
|
|
|
if (SvROK($arg) && SvTYPE(SvRV($arg)) == SVt_PVAV) {
|
|
|
|
AV* av = (AV*)SvRV($arg);
|
|
|
|
const unsigned int len = av_len(av)+1;
|
2015-01-24 22:35:29 +00:00
|
|
|
$var.resize(len);
|
2013-07-16 18:09:53 +00:00
|
|
|
for (unsigned int i = 0; i < len; i++) {
|
|
|
|
SV** elem = av_fetch(av, i, 0);
|
2015-01-24 22:35:29 +00:00
|
|
|
$var\[i].from_SV_check(*elem);
|
2013-07-16 18:09:53 +00:00
|
|
|
}
|
|
|
|
} else
|
|
|
|
Perl_croak(aTHX_ \"%s: %s is not an array reference\",
|
|
|
|
${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]},
|
|
|
|
\"$var\");
|
|
|
|
|
2014-04-29 23:04:49 +00:00
|
|
|
T_LAYER_HEIGHT_RANGES
|
|
|
|
{
|
|
|
|
if (!SvROK($arg) || SvTYPE(SvRV($arg)) != SVt_PVAV) {
|
|
|
|
Perl_croak(aTHX_ \"%s: %s is not an array reference\",
|
|
|
|
${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]},
|
|
|
|
\"$var\");
|
|
|
|
}
|
|
|
|
|
|
|
|
AV* av = (AV*)SvRV($arg);
|
|
|
|
const unsigned int len = av_len(av)+1;
|
|
|
|
t_layer_height_ranges tmp_ranges;
|
|
|
|
for (unsigned int i = 0; i < len; i++) {
|
|
|
|
SV* elem = *av_fetch(av, i, 0);
|
|
|
|
if (!SvROK(elem) || SvTYPE(SvRV(elem)) != SVt_PVAV) {
|
|
|
|
Perl_croak(
|
|
|
|
aTHX_ \"%s: %s contains something that is not an array reference\",
|
|
|
|
${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]},
|
|
|
|
\"$var\");
|
|
|
|
}
|
|
|
|
|
|
|
|
AV* elemAV = (AV*)SvRV(elem);
|
|
|
|
if (av_len(elemAV) + 1 != 3) {
|
|
|
|
Perl_croak(
|
|
|
|
aTHX_ \"%s: %s contains an array that isn't 3 elements long\",
|
|
|
|
${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]},
|
|
|
|
\"$var\");
|
|
|
|
}
|
|
|
|
|
|
|
|
coordf_t vals[3];
|
|
|
|
for (unsigned int j = 0; j < 3; ++j) {
|
|
|
|
SV *elem_elem = *av_fetch(elemAV, j, 0);
|
2014-06-19 12:44:50 +00:00
|
|
|
if (!looks_like_number(elem_elem)) {
|
2014-04-29 23:04:49 +00:00
|
|
|
Perl_croak(
|
|
|
|
aTHX_ \"%s: layer ranges and heights must be numbers\",
|
|
|
|
${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]});
|
|
|
|
}
|
|
|
|
|
|
|
|
vals[j] = SvNV(elem_elem);
|
|
|
|
}
|
|
|
|
|
|
|
|
tmp_ranges[t_layer_height_range(vals[0], vals[1])] = vals[2];
|
|
|
|
}
|
|
|
|
|
|
|
|
$var = tmp_ranges;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-07-15 21:12:13 +00:00
|
|
|
OUTPUT
|
2014-11-22 21:20:28 +00:00
|
|
|
|
|
|
|
T_STD_STRING
|
|
|
|
$arg = newSVpvn_utf8( $var.c_str(), $var.length(), true );
|
|
|
|
|
|
|
|
T_STD_VECTOR_STD_STRING
|
|
|
|
AV* av = newAV();
|
|
|
|
$arg = newRV_noinc((SV*)av);
|
2015-01-24 22:35:29 +00:00
|
|
|
sv_2mortal($arg);
|
2014-11-22 21:20:28 +00:00
|
|
|
const unsigned int len = $var.size();
|
|
|
|
if (len)
|
|
|
|
av_extend(av, len-1);
|
|
|
|
for (unsigned int i = 0; i < len; i++) {
|
|
|
|
const std::string& str = ${var}[i];
|
|
|
|
STRLEN len = str.length();
|
|
|
|
av_store(av, i, newSVpvn_utf8(str.c_str(), len, true));
|
|
|
|
}
|
|
|
|
|
|
|
|
T_STD_VECTOR_INT
|
|
|
|
AV* av = newAV();
|
|
|
|
$arg = newRV_noinc((SV*)av);
|
2015-01-24 22:35:29 +00:00
|
|
|
sv_2mortal($arg);
|
2014-11-22 21:20:28 +00:00
|
|
|
const unsigned int len = $var.size();
|
|
|
|
if (len)
|
|
|
|
av_extend(av, len-1);
|
|
|
|
for (unsigned int i = 0; i < len; i++) {
|
|
|
|
av_store(av, i, newSViv(${var}[i]));
|
|
|
|
}
|
|
|
|
|
|
|
|
T_STD_VECTOR_UINT
|
|
|
|
AV* av = newAV();
|
|
|
|
$arg = newRV_noinc((SV*)av);
|
2015-01-24 22:35:29 +00:00
|
|
|
sv_2mortal($arg);
|
2014-11-22 21:20:28 +00:00
|
|
|
const unsigned int len = $var.size();
|
|
|
|
if (len)
|
|
|
|
av_extend(av, len-1);
|
|
|
|
for (unsigned int i = 0; i < len; i++) {
|
|
|
|
av_store(av, i, newSVuv(${var}[i]));
|
|
|
|
}
|
|
|
|
|
|
|
|
T_STD_VECTOR_DOUBLE
|
|
|
|
AV* av = newAV();
|
|
|
|
$arg = newRV_noinc((SV*)av);
|
2015-01-24 22:35:29 +00:00
|
|
|
sv_2mortal($arg);
|
2014-11-22 21:20:28 +00:00
|
|
|
const unsigned int len = $var.size();
|
|
|
|
if (len)
|
|
|
|
av_extend(av, len-1);
|
|
|
|
for (unsigned int i = 0; i < len; i++) {
|
|
|
|
av_store(av, i, newSVnv(${var}[i]));
|
|
|
|
}
|
|
|
|
|
2014-04-27 17:18:53 +00:00
|
|
|
# return object from pointer
|
|
|
|
O_OBJECT_SLIC3R
|
2014-05-10 22:52:08 +00:00
|
|
|
if ($var == NULL)
|
|
|
|
XSRETURN_UNDEF;
|
2014-04-27 17:18:53 +00:00
|
|
|
sv_setref_pv( $arg, perl_class_name($var), (void*)$var );
|
|
|
|
|
|
|
|
# return value handled by template class
|
|
|
|
O_OBJECT_SLIC3R_T
|
2014-05-10 22:52:08 +00:00
|
|
|
if ($var == NULL)
|
|
|
|
XSRETURN_UNDEF;
|
2014-04-27 17:18:53 +00:00
|
|
|
sv_setref_pv( $arg, $type\::CLASS(), (void*)$var );
|
|
|
|
|
2013-07-15 21:12:13 +00:00
|
|
|
|
2013-07-16 18:09:53 +00:00
|
|
|
T_ARRAYREF
|
2013-07-15 21:23:35 +00:00
|
|
|
AV* av = newAV();
|
|
|
|
$arg = newRV_noinc((SV*)av);
|
2013-09-03 17:26:58 +00:00
|
|
|
sv_2mortal($arg);
|
2014-06-25 12:57:06 +00:00
|
|
|
const unsigned int len = $var.size();
|
|
|
|
if (len > 0) av_extend(av, len-1);
|
2013-08-08 00:10:34 +00:00
|
|
|
int i = 0;
|
2013-09-03 17:26:58 +00:00
|
|
|
for (${type}::const_iterator it = $var.begin(); it != $var.end(); ++it) {
|
2014-05-08 12:52:48 +00:00
|
|
|
av_store(av, i++, perl_to_SV_clone_ref(*it));
|
2013-08-08 00:10:34 +00:00
|
|
|
}
|
2013-09-02 18:22:20 +00:00
|
|
|
|
2013-09-09 19:43:28 +00:00
|
|
|
T_ARRAYREF_PTR
|
2013-09-02 18:22:20 +00:00
|
|
|
AV* av = newAV();
|
|
|
|
$arg = newRV_noinc((SV*)av);
|
2013-09-03 17:26:58 +00:00
|
|
|
sv_2mortal($arg);
|
2014-06-25 12:57:06 +00:00
|
|
|
const unsigned int len = $var->size();
|
|
|
|
if (len > 0) av_extend(av, len-1);
|
2013-09-02 18:22:20 +00:00
|
|
|
int i = 0;
|
2013-09-09 19:43:28 +00:00
|
|
|
for (${ my $t = $type; $t =~ s/\*$//; \$t }::iterator it = $var->begin(); it != $var->end(); ++it) {
|
2014-05-08 12:52:48 +00:00
|
|
|
av_store(av, i++, perl_to_SV_ref(*it));
|
2013-09-09 20:27:58 +00:00
|
|
|
}
|
|
|
|
|
2014-04-29 23:04:49 +00:00
|
|
|
T_PTR_ARRAYREF_PTR
|
|
|
|
AV* av = newAV();
|
|
|
|
$arg = newRV_noinc((SV*)av);
|
|
|
|
sv_2mortal($arg);
|
2014-06-25 12:57:06 +00:00
|
|
|
const unsigned int len = $var->size();
|
|
|
|
if (len > 0) av_extend(av, len-1);
|
2014-04-29 23:04:49 +00:00
|
|
|
int i = 0;
|
|
|
|
for (${ my $t = $type; $t =~ s/\*$//; \$t }::iterator it = $var->begin(); it != $var->end(); ++it) {
|
2014-05-08 12:52:48 +00:00
|
|
|
av_store(av, i++, perl_to_SV_ref(**it));
|
2014-04-29 23:04:49 +00:00
|
|
|
}
|
|
|
|
|
2013-09-09 20:27:58 +00:00
|
|
|
T_PTR_ARRAYREF
|
|
|
|
AV* av = newAV();
|
|
|
|
$arg = newRV_noinc((SV*)av);
|
|
|
|
sv_2mortal($arg);
|
2014-06-25 12:57:06 +00:00
|
|
|
const unsigned int len = $var.size();
|
|
|
|
if (len > 0) av_extend(av, len-1);
|
2013-09-09 20:27:58 +00:00
|
|
|
int i = 0;
|
|
|
|
for (${type}::iterator it = $var.begin(); it != $var.end(); ++it) {
|
|
|
|
av_store(av, i++, (*it)->to_SV());
|
2013-09-02 18:22:20 +00:00
|
|
|
}
|
2014-04-29 23:04:49 +00:00
|
|
|
|
|
|
|
T_LAYER_HEIGHT_RANGES
|
|
|
|
AV* av = newAV();
|
|
|
|
$arg = newRV_noinc((SV*)av);
|
|
|
|
sv_2mortal($arg);
|
2014-06-25 12:57:06 +00:00
|
|
|
const unsigned int len = $var.size();
|
|
|
|
if (len > 0) av_extend(av, len-1);
|
2014-04-29 23:04:49 +00:00
|
|
|
// map is sorted, so we can just copy it in order
|
|
|
|
int i = 0;
|
|
|
|
for (${type}::iterator it = $var.begin(); it != $var.end(); ++it) {
|
|
|
|
const coordf_t range_values[] = {
|
|
|
|
it->first.first, // key's first = minz
|
|
|
|
it->first.second, // key's second = maxz
|
|
|
|
it->second, // value = height
|
|
|
|
};
|
|
|
|
|
|
|
|
AV *rangeAV = newAV();
|
|
|
|
av_extend(rangeAV, 2);
|
|
|
|
for (int j = 0; j < 3; ++j) {
|
2014-07-01 17:49:15 +00:00
|
|
|
av_store(rangeAV, j, newSVnv(range_values[j]));
|
2014-04-29 23:04:49 +00:00
|
|
|
}
|
|
|
|
|
2014-07-01 17:49:15 +00:00
|
|
|
av_store(av, i++, (SV*)newRV_noinc((SV*)rangeAV));
|
2014-04-29 23:04:49 +00:00
|
|
|
}
|