357 lines
10 KiB
Plaintext
357 lines
10 KiB
Plaintext
coordf_t T_NV
|
|
|
|
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
|
|
std::vector<Points::size_type> T_STD_VECTOR_INT
|
|
std::vector<size_t> T_STD_VECTOR_INT
|
|
|
|
std::vector<unsigned int> T_STD_VECTOR_UINT
|
|
|
|
std::vector<double> T_STD_VECTOR_DOUBLE
|
|
|
|
BoundingBox* O_OBJECT_SLIC3R
|
|
Ref<BoundingBox> O_OBJECT_SLIC3R_T
|
|
Clone<BoundingBox> O_OBJECT_SLIC3R_T
|
|
|
|
DynamicPrintConfig* O_OBJECT_SLIC3R
|
|
Ref<DynamicPrintConfig> O_OBJECT_SLIC3R_T
|
|
Clone<DynamicPrintConfig> O_OBJECT_SLIC3R_T
|
|
|
|
StaticPrintConfig* O_OBJECT_SLIC3R
|
|
Ref<StaticPrintConfig> O_OBJECT_SLIC3R_T
|
|
|
|
GCodeConfig* O_OBJECT_SLIC3R
|
|
Ref<GCodeConfig> O_OBJECT_SLIC3R_T
|
|
|
|
PrintConfig* O_OBJECT_SLIC3R
|
|
Ref<PrintConfig> O_OBJECT_SLIC3R_T
|
|
|
|
FullPrintConfig* O_OBJECT_SLIC3R
|
|
Ref<FullPrintConfig> O_OBJECT_SLIC3R_T
|
|
|
|
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
|
|
|
|
Point3* O_OBJECT_SLIC3R
|
|
Ref<Point3> O_OBJECT_SLIC3R_T
|
|
Clone<Point3> O_OBJECT_SLIC3R_T
|
|
|
|
Vec2d* O_OBJECT_SLIC3R
|
|
Ref<Vec2d> O_OBJECT_SLIC3R_T
|
|
Clone<Vec2d> O_OBJECT_SLIC3R_T
|
|
|
|
Vec3d* O_OBJECT_SLIC3R
|
|
Ref<Vec3d> O_OBJECT_SLIC3R_T
|
|
Clone<Vec3d> O_OBJECT_SLIC3R_T
|
|
|
|
Line* O_OBJECT_SLIC3R
|
|
Ref<Line> O_OBJECT_SLIC3R_T
|
|
Clone<Line> O_OBJECT_SLIC3R_T
|
|
|
|
Polyline* O_OBJECT_SLIC3R
|
|
Ref<Polyline> O_OBJECT_SLIC3R_T
|
|
Clone<Polyline> 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
|
|
|
|
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
|
|
|
|
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
|
|
|
|
Axis T_UV
|
|
ExtrusionLoopRole T_UV
|
|
ExtrusionRole T_UV
|
|
SurfaceType T_UV
|
|
|
|
# we return these types whenever we want the items to be cloned
|
|
Points T_ARRAYREF
|
|
Pointfs T_ARRAYREF
|
|
Lines T_ARRAYREF
|
|
Polygons T_ARRAYREF
|
|
Polylines T_ARRAYREF
|
|
ExPolygons T_ARRAYREF
|
|
|
|
# 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
|
|
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
|
|
|
|
# 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
|
|
|
|
|
|
INPUT
|
|
|
|
T_STD_STRING
|
|
{
|
|
size_t len;
|
|
// const char * c = SvPV($arg, len);
|
|
// Always convert strings to UTF-8 before passing them to XS
|
|
const char * c = SvPVutf8($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\");
|
|
|
|
O_OBJECT_SLIC3R
|
|
if( sv_isobject($arg) && (SvTYPE(SvRV($arg)) == SVt_PVMG) ) {
|
|
if ( sv_isa($arg, Slic3r::perl_class_name($var) ) || sv_isa($arg, Slic3r::perl_class_name_ref($var) )) {
|
|
$var = ($type)SvIV((SV*)SvRV( $arg ));
|
|
} else {
|
|
croak(\"$var is not of type %s (got %s)\", Slic3r::perl_class_name($var), HvNAME(SvSTASH(SvRV($arg))));
|
|
XSRETURN_UNDEF;
|
|
}
|
|
} else {
|
|
warn( \"${Package}::$func_name() -- $var is not a blessed SV reference\" );
|
|
XSRETURN_UNDEF;
|
|
}
|
|
|
|
T_ARRAYREF
|
|
if (SvROK($arg) && SvTYPE(SvRV($arg)) == SVt_PVAV) {
|
|
AV* av = (AV*)SvRV($arg);
|
|
const unsigned int len = av_len(av)+1;
|
|
$var.resize(len);
|
|
for (unsigned int i = 0; i < len; i++) {
|
|
SV** elem = av_fetch(av, i, 0);
|
|
from_SV_check(*elem, &$var\[i]);
|
|
}
|
|
} else
|
|
Perl_croak(aTHX_ \"%s: %s is not an array reference\",
|
|
${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]},
|
|
\"$var\");
|
|
|
|
OUTPUT
|
|
|
|
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);
|
|
sv_2mortal($arg);
|
|
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);
|
|
sv_2mortal($arg);
|
|
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);
|
|
sv_2mortal($arg);
|
|
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);
|
|
sv_2mortal($arg);
|
|
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]));
|
|
}
|
|
|
|
# return object from pointer
|
|
O_OBJECT_SLIC3R
|
|
if ($var == NULL)
|
|
XSRETURN_UNDEF;
|
|
sv_setref_pv( $arg, Slic3r::perl_class_name($var), (void*)$var );
|
|
|
|
# return value handled by template class
|
|
O_OBJECT_SLIC3R_T
|
|
if ($var == NULL)
|
|
XSRETURN_UNDEF;
|
|
sv_setref_pv( $arg, $type\::CLASS(), (void*)$var );
|
|
|
|
|
|
T_ARRAYREF
|
|
AV* av = newAV();
|
|
$arg = newRV_noinc((SV*)av);
|
|
sv_2mortal($arg);
|
|
const unsigned int len = $var.size();
|
|
if (len > 0) av_extend(av, len-1);
|
|
int i = 0;
|
|
for (${type}::const_iterator it = $var.begin(); it != $var.end(); ++it) {
|
|
av_store(av, i++, perl_to_SV_clone_ref(*it));
|
|
}
|
|
|
|
T_ARRAYREF_PTR
|
|
AV* av = newAV();
|
|
$arg = newRV_noinc((SV*)av);
|
|
sv_2mortal($arg);
|
|
const unsigned int len = $var->size();
|
|
if (len > 0) av_extend(av, len-1);
|
|
int i = 0;
|
|
for (${ my $t = $type; $t =~ s/\*$//; \$t }::iterator it = $var->begin(); it != $var->end(); ++it) {
|
|
av_store(av, i++, perl_to_SV_ref(*it));
|
|
}
|
|
|
|
T_PTR_ARRAYREF_PTR
|
|
AV* av = newAV();
|
|
$arg = newRV_noinc((SV*)av);
|
|
sv_2mortal($arg);
|
|
const unsigned int len = $var->size();
|
|
if (len > 0) av_extend(av, len-1);
|
|
int i = 0;
|
|
for (${ my $t = $type; $t =~ s/\*$//; \$t }::iterator it = $var->begin(); it != $var->end(); ++it) {
|
|
av_store(av, i++, perl_to_SV_ref(**it));
|
|
}
|
|
|
|
T_PTR_ARRAYREF
|
|
AV* av = newAV();
|
|
$arg = newRV_noinc((SV*)av);
|
|
sv_2mortal($arg);
|
|
const unsigned int len = $var.size();
|
|
if (len > 0) av_extend(av, len-1);
|
|
int i = 0;
|
|
for (${type}::iterator it = $var.begin(); it != $var.end(); ++it) {
|
|
av_store(av, i++, to_SV(*it));
|
|
}
|
|
|