my.map 17 KB

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