my.map 17 KB

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