my.map 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574
  1. coord_t T_IV
  2. coordf_t T_NV
  3. std::string T_STD_STRING
  4. t_config_option_key T_STD_STRING
  5. t_model_material_id T_STD_STRING
  6. std::vector<std::string> T_STD_VECTOR_STD_STRING
  7. std::vector<int> T_STD_VECTOR_INT
  8. std::vector<Points::size_type> T_STD_VECTOR_INT
  9. std::vector<size_t> T_STD_VECTOR_INT
  10. std::vector<unsigned int> T_STD_VECTOR_UINT
  11. std::vector<double> T_STD_VECTOR_DOUBLE
  12. t_layer_height_ranges T_LAYER_HEIGHT_RANGES
  13. BoundingBox* O_OBJECT_SLIC3R
  14. Ref<BoundingBox> O_OBJECT_SLIC3R_T
  15. Clone<BoundingBox> O_OBJECT_SLIC3R_T
  16. BoundingBoxf* O_OBJECT_SLIC3R
  17. Ref<BoundingBoxf> O_OBJECT_SLIC3R_T
  18. Clone<BoundingBoxf> O_OBJECT_SLIC3R_T
  19. BoundingBoxf3* O_OBJECT_SLIC3R
  20. Ref<BoundingBoxf3> O_OBJECT_SLIC3R_T
  21. Clone<BoundingBoxf3> O_OBJECT_SLIC3R_T
  22. DynamicPrintConfig* O_OBJECT_SLIC3R
  23. Ref<DynamicPrintConfig> O_OBJECT_SLIC3R_T
  24. StaticPrintConfig* O_OBJECT_SLIC3R
  25. Ref<StaticPrintConfig> O_OBJECT_SLIC3R_T
  26. PrintObjectConfig* O_OBJECT_SLIC3R
  27. Ref<PrintObjectConfig> O_OBJECT_SLIC3R_T
  28. PrintRegionConfig* O_OBJECT_SLIC3R
  29. Ref<PrintRegionConfig> O_OBJECT_SLIC3R_T
  30. GCodeConfig* O_OBJECT_SLIC3R
  31. Ref<GCodeConfig> O_OBJECT_SLIC3R_T
  32. PrintConfig* O_OBJECT_SLIC3R
  33. Ref<PrintConfig> O_OBJECT_SLIC3R_T
  34. FullPrintConfig* O_OBJECT_SLIC3R
  35. Ref<FullPrintConfig> O_OBJECT_SLIC3R_T
  36. ZTable* O_OBJECT
  37. TriangleMesh* O_OBJECT_SLIC3R
  38. Ref<TriangleMesh> O_OBJECT_SLIC3R_T
  39. Clone<TriangleMesh> O_OBJECT_SLIC3R_T
  40. SLAPrint* O_OBJECT_SLIC3R
  41. Ref<SLAPrint> O_OBJECT_SLIC3R_T
  42. Clone<SLAPrint> O_OBJECT_SLIC3R_T
  43. Point* O_OBJECT_SLIC3R
  44. Ref<Point> O_OBJECT_SLIC3R_T
  45. Clone<Point> O_OBJECT_SLIC3R_T
  46. Point3* O_OBJECT_SLIC3R
  47. Ref<Point3> O_OBJECT_SLIC3R_T
  48. Clone<Point3> O_OBJECT_SLIC3R_T
  49. Pointf* O_OBJECT_SLIC3R
  50. Ref<Pointf> O_OBJECT_SLIC3R_T
  51. Clone<Pointf> O_OBJECT_SLIC3R_T
  52. Pointf3* O_OBJECT_SLIC3R
  53. Ref<Pointf3> O_OBJECT_SLIC3R_T
  54. Clone<Pointf3> O_OBJECT_SLIC3R_T
  55. Line* O_OBJECT_SLIC3R
  56. Ref<Line> O_OBJECT_SLIC3R_T
  57. Clone<Line> O_OBJECT_SLIC3R_T
  58. Linef3* O_OBJECT_SLIC3R
  59. Ref<Linef3> O_OBJECT_SLIC3R_T
  60. Clone<Linef3> O_OBJECT_SLIC3R_T
  61. Polyline* O_OBJECT_SLIC3R
  62. Ref<Polyline> O_OBJECT_SLIC3R_T
  63. Clone<Polyline> O_OBJECT_SLIC3R_T
  64. PolylineCollection* O_OBJECT_SLIC3R
  65. Ref<PolylineCollection> O_OBJECT_SLIC3R_T
  66. Clone<PolylineCollection> O_OBJECT_SLIC3R_T
  67. Polygon* O_OBJECT_SLIC3R
  68. Ref<Polygon> O_OBJECT_SLIC3R_T
  69. Clone<Polygon> O_OBJECT_SLIC3R_T
  70. ExPolygon* O_OBJECT_SLIC3R
  71. Ref<ExPolygon> O_OBJECT_SLIC3R_T
  72. Clone<ExPolygon> O_OBJECT_SLIC3R_T
  73. ExPolygonCollection* O_OBJECT_SLIC3R
  74. Ref<ExPolygonCollection> O_OBJECT_SLIC3R_T
  75. Clone<ExPolygonCollection> O_OBJECT_SLIC3R_T
  76. ExtrusionEntityCollection* O_OBJECT_SLIC3R
  77. Ref<ExtrusionEntityCollection> O_OBJECT_SLIC3R_T
  78. Clone<ExtrusionEntityCollection> O_OBJECT_SLIC3R_T
  79. ExtrusionPath* O_OBJECT_SLIC3R
  80. Ref<ExtrusionPath> O_OBJECT_SLIC3R_T
  81. Clone<ExtrusionPath> O_OBJECT_SLIC3R_T
  82. ExtrusionLoop* O_OBJECT_SLIC3R
  83. Ref<ExtrusionLoop> O_OBJECT_SLIC3R_T
  84. Clone<ExtrusionLoop> O_OBJECT_SLIC3R_T
  85. Filler* O_OBJECT_SLIC3R
  86. Ref<Filler> O_OBJECT_SLIC3R_T
  87. Clone<Filler> O_OBJECT_SLIC3R_T
  88. Flow* O_OBJECT_SLIC3R
  89. Ref<Flow> O_OBJECT_SLIC3R_T
  90. Clone<Flow> O_OBJECT_SLIC3R_T
  91. PrintState* O_OBJECT_SLIC3R
  92. Ref<PrintState> O_OBJECT_SLIC3R_T
  93. Surface* O_OBJECT_SLIC3R
  94. Ref<Surface> O_OBJECT_SLIC3R_T
  95. Clone<Surface> O_OBJECT_SLIC3R_T
  96. SurfaceCollection* O_OBJECT_SLIC3R
  97. Ref<SurfaceCollection> O_OBJECT_SLIC3R_T
  98. Extruder* O_OBJECT_SLIC3R
  99. Ref<Extruder> O_OBJECT_SLIC3R_T
  100. Clone<Extruder> O_OBJECT_SLIC3R_T
  101. Model* O_OBJECT_SLIC3R
  102. Ref<Model> O_OBJECT_SLIC3R_T
  103. Clone<Model> O_OBJECT_SLIC3R_T
  104. ModelMaterial* O_OBJECT_SLIC3R
  105. Ref<ModelMaterial> O_OBJECT_SLIC3R_T
  106. Clone<ModelMaterial> O_OBJECT_SLIC3R_T
  107. ModelObject* O_OBJECT_SLIC3R
  108. Ref<ModelObject> O_OBJECT_SLIC3R_T
  109. Clone<ModelObject> O_OBJECT_SLIC3R_T
  110. ModelVolume* O_OBJECT_SLIC3R
  111. Ref<ModelVolume> O_OBJECT_SLIC3R_T
  112. Clone<ModelVolume> O_OBJECT_SLIC3R_T
  113. ModelInstance* O_OBJECT_SLIC3R
  114. Ref<ModelInstance> O_OBJECT_SLIC3R_T
  115. Clone<ModelInstance> O_OBJECT_SLIC3R_T
  116. PrintRegion* O_OBJECT_SLIC3R
  117. Ref<PrintRegion> O_OBJECT_SLIC3R_T
  118. PrintObject* O_OBJECT_SLIC3R
  119. Ref<PrintObject> O_OBJECT_SLIC3R_T
  120. Print* O_OBJECT_SLIC3R
  121. Ref<Print> O_OBJECT_SLIC3R_T
  122. Clone<Print> O_OBJECT_SLIC3R_T
  123. LayerRegion* O_OBJECT_SLIC3R
  124. Ref<LayerRegion> O_OBJECT_SLIC3R_T
  125. Layer* O_OBJECT_SLIC3R
  126. Ref<Layer> O_OBJECT_SLIC3R_T
  127. SupportLayer* O_OBJECT_SLIC3R
  128. Ref<SupportLayer> O_OBJECT_SLIC3R_T
  129. SlicingAdaptive* O_OBJECT_SLIC3R
  130. Ref<SlicingAdaptive> O_OBJECT_SLIC3R_T
  131. Clone<SlicingAdaptive> O_OBJECT_SLIC3R_T
  132. LayerHeightSpline* O_OBJECT_SLIC3R
  133. Ref<LayerHeightSpline> O_OBJECT_SLIC3R_T
  134. Clone<LayerHeightSpline> O_OBJECT_SLIC3R_T
  135. PlaceholderParser* O_OBJECT_SLIC3R
  136. Ref<PlaceholderParser> O_OBJECT_SLIC3R_T
  137. Clone<PlaceholderParser> O_OBJECT_SLIC3R_T
  138. AvoidCrossingPerimeters* O_OBJECT_SLIC3R
  139. Ref<AvoidCrossingPerimeters> O_OBJECT_SLIC3R_T
  140. Clone<AvoidCrossingPerimeters> O_OBJECT_SLIC3R_T
  141. Wipe* O_OBJECT_SLIC3R
  142. Ref<Wipe> O_OBJECT_SLIC3R_T
  143. Clone<Wipe> O_OBJECT_SLIC3R_T
  144. OozePrevention* O_OBJECT_SLIC3R
  145. Ref<OozePrevention> O_OBJECT_SLIC3R_T
  146. Clone<OozePrevention> O_OBJECT_SLIC3R_T
  147. CoolingBuffer* O_OBJECT_SLIC3R
  148. Ref<CoolingBuffer> O_OBJECT_SLIC3R_T
  149. Clone<CoolingBuffer> O_OBJECT_SLIC3R_T
  150. SpiralVase* O_OBJECT_SLIC3R
  151. Ref<SpiralVase> O_OBJECT_SLIC3R_T
  152. Clone<SpiralVase> O_OBJECT_SLIC3R_T
  153. GCode* O_OBJECT_SLIC3R
  154. Ref<GCode> O_OBJECT_SLIC3R_T
  155. Clone<GCode> O_OBJECT_SLIC3R_T
  156. MotionPlanner* O_OBJECT_SLIC3R
  157. Ref<MotionPlanner> O_OBJECT_SLIC3R_T
  158. Clone<MotionPlanner> O_OBJECT_SLIC3R_T
  159. GCodeSender* O_OBJECT_SLIC3R
  160. Ref<GCodeSender> O_OBJECT_SLIC3R_T
  161. Clone<GCodeSender> O_OBJECT_SLIC3R_T
  162. GCodeTimeEstimator* O_OBJECT_SLIC3R
  163. Ref<GCodeTimeEstimator> O_OBJECT_SLIC3R_T
  164. Clone<GCodeTimeEstimator> O_OBJECT_SLIC3R_T
  165. GCodeWriter* O_OBJECT_SLIC3R
  166. Ref<GCodeWriter> O_OBJECT_SLIC3R_T
  167. Clone<GCodeWriter> O_OBJECT_SLIC3R_T
  168. BridgeDetector* O_OBJECT_SLIC3R
  169. Ref<BridgeDetector> O_OBJECT_SLIC3R_T
  170. Clone<BridgeDetector> O_OBJECT_SLIC3R_T
  171. PerimeterGenerator* O_OBJECT_SLIC3R
  172. Ref<PerimeterGenerator> O_OBJECT_SLIC3R_T
  173. Clone<PerimeterGenerator> O_OBJECT_SLIC3R_T
  174. GLVertexArray* O_OBJECT_SLIC3R
  175. Axis T_UV
  176. ExtrusionLoopRole T_UV
  177. ExtrusionRole T_UV
  178. FlowRole T_UV
  179. PrintStep T_UV
  180. PrintObjectStep T_UV
  181. SurfaceType T_UV
  182. ClipperLib::JoinType T_UV
  183. ClipperLib::PolyFillType T_UV
  184. # we return these types whenever we want the items to be cloned
  185. Points T_ARRAYREF
  186. Pointfs T_ARRAYREF
  187. Lines T_ARRAYREF
  188. Polygons T_ARRAYREF
  189. Polylines T_ARRAYREF
  190. ExPolygons T_ARRAYREF
  191. ExtrusionPaths T_ARRAYREF
  192. Surfaces T_ARRAYREF
  193. # we return these types whenever we want the items to be returned
  194. # by reference and marked ::Ref because they're contained in another
  195. # Perl object
  196. Polygons* T_ARRAYREF_PTR
  197. ModelObjectPtrs* T_PTR_ARRAYREF_PTR
  198. ModelVolumePtrs* T_PTR_ARRAYREF_PTR
  199. ModelInstancePtrs* T_PTR_ARRAYREF_PTR
  200. PrintRegionPtrs* T_PTR_ARRAYREF_PTR
  201. PrintObjectPtrs* T_PTR_ARRAYREF_PTR
  202. LayerPtrs* T_PTR_ARRAYREF_PTR
  203. SupportLayerPtrs* T_PTR_ARRAYREF_PTR
  204. # we return these types whenever we want the items to be returned
  205. # by reference and not marked ::Ref because they're newly allocated
  206. # and not referenced by any Perl object
  207. TriangleMeshPtrs T_PTR_ARRAYREF
  208. INPUT
  209. T_STD_STRING
  210. {
  211. size_t len;
  212. const char * c = SvPVutf8($arg, len);
  213. $var = std::string(c, len);
  214. }
  215. T_STD_VECTOR_STD_STRING
  216. if (SvROK($arg) && SvTYPE(SvRV($arg))==SVt_PVAV) {
  217. AV* av = (AV*)SvRV($arg);
  218. const unsigned int alen = av_len(av)+1;
  219. $var = std::vector<std::string>(alen);
  220. STRLEN len;
  221. char* tmp;
  222. SV** elem;
  223. for (unsigned int i = 0; i < alen; i++) {
  224. elem = av_fetch(av, i, 0);
  225. if (elem != NULL) {
  226. tmp = SvPVutf8(*elem, len);
  227. ${var}[i] = std::string(tmp, len);
  228. }
  229. else
  230. ${var}[i] = std::string(\"\");
  231. }
  232. }
  233. else
  234. Perl_croak(aTHX_ \"%s: %s is not an array reference\",
  235. ${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]},
  236. \"$var\");
  237. T_STD_VECTOR_INT
  238. if (SvROK($arg) && SvTYPE(SvRV($arg))==SVt_PVAV) {
  239. AV* av = (AV*)SvRV($arg);
  240. const unsigned int len = av_len(av)+1;
  241. $var = std::vector<int>(len);
  242. SV** elem;
  243. for (unsigned int i = 0; i < len; i++) {
  244. elem = av_fetch(av, i, 0);
  245. if (elem != NULL)
  246. ${var}[i] = SvIV(*elem);
  247. else
  248. ${var}[i] = 0;
  249. }
  250. }
  251. else
  252. Perl_croak(aTHX_ \"%s: %s is not an array reference\",
  253. ${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]},
  254. \"$var\");
  255. T_STD_VECTOR_UINT
  256. if (SvROK($arg) && SvTYPE(SvRV($arg))==SVt_PVAV) {
  257. AV* av = (AV*)SvRV($arg);
  258. const unsigned int len = av_len(av)+1;
  259. $var = std::vector<unsigned int>(len);
  260. SV** elem;
  261. for (unsigned int i = 0; i < len; i++) {
  262. elem = av_fetch(av, i, 0);
  263. if (elem != NULL)
  264. ${var}[i] = SvUV(*elem);
  265. else
  266. ${var}[i] = 0;
  267. }
  268. }
  269. else
  270. Perl_croak(aTHX_ \"%s: %s is not an array reference\",
  271. ${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]},
  272. \"$var\");
  273. T_STD_VECTOR_DOUBLE
  274. if (SvROK($arg) && SvTYPE(SvRV($arg))==SVt_PVAV) {
  275. AV* av = (AV*)SvRV($arg);
  276. const unsigned int len = av_len(av)+1;
  277. $var = std::vector<double>(len);
  278. SV** elem;
  279. for (unsigned int i = 0; i < len; i++) {
  280. elem = av_fetch(av, i, 0);
  281. if (elem != NULL)
  282. ${var}[i] = SvNV(*elem);
  283. else
  284. ${var}[i] = 0.;
  285. }
  286. }
  287. else
  288. Perl_croak(aTHX_ \"%s: %s is not an array reference\",
  289. ${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]},
  290. \"$var\");
  291. O_OBJECT_SLIC3R
  292. if( sv_isobject($arg) && (SvTYPE(SvRV($arg)) == SVt_PVMG) ) {
  293. if ( sv_isa($arg, Slic3r::perl_class_name($var) ) || sv_isa($arg, Slic3r::perl_class_name_ref($var) )) {
  294. $var = ($type)SvIV((SV*)SvRV( $arg ));
  295. } else {
  296. croak(\"$var is not of type %s (got %s)\", Slic3r::perl_class_name($var), HvNAME(SvSTASH(SvRV($arg))));
  297. XSRETURN_UNDEF;
  298. }
  299. } else {
  300. warn( \"${Package}::$func_name() -- $var is not a blessed SV reference\" );
  301. XSRETURN_UNDEF;
  302. }
  303. T_ARRAYREF
  304. if (SvROK($arg) && SvTYPE(SvRV($arg)) == SVt_PVAV) {
  305. AV* av = (AV*)SvRV($arg);
  306. const unsigned int len = av_len(av)+1;
  307. $var.resize(len);
  308. for (unsigned int i = 0; i < len; i++) {
  309. SV** elem = av_fetch(av, i, 0);
  310. from_SV_check(*elem, &$var\[i]);
  311. }
  312. } else
  313. Perl_croak(aTHX_ \"%s: %s is not an array reference\",
  314. ${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]},
  315. \"$var\");
  316. T_LAYER_HEIGHT_RANGES
  317. {
  318. if (!SvROK($arg) || SvTYPE(SvRV($arg)) != SVt_PVAV) {
  319. Perl_croak(aTHX_ \"%s: %s is not an array reference\",
  320. ${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]},
  321. \"$var\");
  322. }
  323. AV* av = (AV*)SvRV($arg);
  324. const unsigned int len = av_len(av)+1;
  325. t_layer_height_ranges tmp_ranges;
  326. for (unsigned int i = 0; i < len; i++) {
  327. SV* elem = *av_fetch(av, i, 0);
  328. if (!SvROK(elem) || SvTYPE(SvRV(elem)) != SVt_PVAV) {
  329. Perl_croak(
  330. aTHX_ \"%s: %s contains something that is not an array reference\",
  331. ${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]},
  332. \"$var\");
  333. }
  334. AV* elemAV = (AV*)SvRV(elem);
  335. if (av_len(elemAV) + 1 != 3) {
  336. Perl_croak(
  337. aTHX_ \"%s: %s contains an array that isn't 3 elements long\",
  338. ${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]},
  339. \"$var\");
  340. }
  341. coordf_t vals[3];
  342. for (unsigned int j = 0; j < 3; ++j) {
  343. SV *elem_elem = *av_fetch(elemAV, j, 0);
  344. if (!looks_like_number(elem_elem)) {
  345. Perl_croak(
  346. aTHX_ \"%s: layer ranges and heights must be numbers\",
  347. ${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]});
  348. }
  349. vals[j] = SvNV(elem_elem);
  350. }
  351. tmp_ranges[t_layer_height_range(vals[0], vals[1])] = vals[2];
  352. }
  353. $var = tmp_ranges;
  354. }
  355. OUTPUT
  356. T_STD_STRING
  357. $arg = newSVpvn_utf8( $var.c_str(), $var.length(), true );
  358. T_STD_VECTOR_STD_STRING
  359. AV* av = newAV();
  360. $arg = newRV_noinc((SV*)av);
  361. sv_2mortal($arg);
  362. const unsigned int len = $var.size();
  363. if (len)
  364. av_extend(av, len-1);
  365. for (unsigned int i = 0; i < len; i++) {
  366. const std::string& str = ${var}[i];
  367. STRLEN len = str.length();
  368. av_store(av, i, newSVpvn_utf8(str.c_str(), len, true));
  369. }
  370. T_STD_VECTOR_INT
  371. AV* av = newAV();
  372. $arg = newRV_noinc((SV*)av);
  373. sv_2mortal($arg);
  374. const unsigned int len = $var.size();
  375. if (len)
  376. av_extend(av, len-1);
  377. for (unsigned int i = 0; i < len; i++) {
  378. av_store(av, i, newSViv(${var}[i]));
  379. }
  380. T_STD_VECTOR_UINT
  381. AV* av = newAV();
  382. $arg = newRV_noinc((SV*)av);
  383. sv_2mortal($arg);
  384. const unsigned int len = $var.size();
  385. if (len)
  386. av_extend(av, len-1);
  387. for (unsigned int i = 0; i < len; i++) {
  388. av_store(av, i, newSVuv(${var}[i]));
  389. }
  390. T_STD_VECTOR_DOUBLE
  391. AV* av = newAV();
  392. $arg = newRV_noinc((SV*)av);
  393. sv_2mortal($arg);
  394. const unsigned int len = $var.size();
  395. if (len)
  396. av_extend(av, len-1);
  397. for (unsigned int i = 0; i < len; i++) {
  398. av_store(av, i, newSVnv(${var}[i]));
  399. }
  400. # return object from pointer
  401. O_OBJECT_SLIC3R
  402. if ($var == NULL)
  403. XSRETURN_UNDEF;
  404. sv_setref_pv( $arg, Slic3r::perl_class_name($var), (void*)$var );
  405. # return value handled by template class
  406. O_OBJECT_SLIC3R_T
  407. if ($var == NULL)
  408. XSRETURN_UNDEF;
  409. sv_setref_pv( $arg, $type\::CLASS(), (void*)$var );
  410. T_ARRAYREF
  411. AV* av = newAV();
  412. $arg = newRV_noinc((SV*)av);
  413. sv_2mortal($arg);
  414. const unsigned int len = $var.size();
  415. if (len > 0) av_extend(av, len-1);
  416. int i = 0;
  417. for (${type}::const_iterator it = $var.begin(); it != $var.end(); ++it) {
  418. av_store(av, i++, perl_to_SV_clone_ref(*it));
  419. }
  420. T_ARRAYREF_PTR
  421. AV* av = newAV();
  422. $arg = newRV_noinc((SV*)av);
  423. sv_2mortal($arg);
  424. const unsigned int len = $var->size();
  425. if (len > 0) av_extend(av, len-1);
  426. int i = 0;
  427. for (${ my $t = $type; $t =~ s/\*$//; \$t }::iterator it = $var->begin(); it != $var->end(); ++it) {
  428. av_store(av, i++, perl_to_SV_ref(*it));
  429. }
  430. T_PTR_ARRAYREF_PTR
  431. AV* av = newAV();
  432. $arg = newRV_noinc((SV*)av);
  433. sv_2mortal($arg);
  434. const unsigned int len = $var->size();
  435. if (len > 0) av_extend(av, len-1);
  436. int i = 0;
  437. for (${ my $t = $type; $t =~ s/\*$//; \$t }::iterator it = $var->begin(); it != $var->end(); ++it) {
  438. av_store(av, i++, perl_to_SV_ref(**it));
  439. }
  440. T_PTR_ARRAYREF
  441. AV* av = newAV();
  442. $arg = newRV_noinc((SV*)av);
  443. sv_2mortal($arg);
  444. const unsigned int len = $var.size();
  445. if (len > 0) av_extend(av, len-1);
  446. int i = 0;
  447. for (${type}::iterator it = $var.begin(); it != $var.end(); ++it) {
  448. av_store(av, i++, to_SV(*it));
  449. }
  450. T_LAYER_HEIGHT_RANGES
  451. AV* av = newAV();
  452. $arg = newRV_noinc((SV*)av);
  453. sv_2mortal($arg);
  454. const unsigned int len = $var.size();
  455. if (len > 0) av_extend(av, len-1);
  456. // map is sorted, so we can just copy it in order
  457. int i = 0;
  458. for (${type}::iterator it = $var.begin(); it != $var.end(); ++it) {
  459. const coordf_t range_values[] = {
  460. it->first.first, // key's first = minz
  461. it->first.second, // key's second = maxz
  462. it->second, // value = height
  463. };
  464. AV *rangeAV = newAV();
  465. av_extend(rangeAV, 2);
  466. for (int j = 0; j < 3; ++j) {
  467. av_store(rangeAV, j, newSVnv(range_values[j]));
  468. }
  469. av_store(av, i++, (SV*)newRV_noinc((SV*)rangeAV));
  470. }