@@ -3509,14 +3509,12 @@ pp_def ('plline',
35093509 HandleBad => 1,
35103510 NoBadifNaN => 1,
35113511 Code => 'c_plline($SIZE(n),$P(x),$P(y));',
3512- BadCode => 'int i;
3513- int j;
3514- for (i=1;i<$SIZE(n);i++) {
3515- j = i-1; /* PP does not like using i-1 in a PDL ref. Use j instead. */
3516- if ($ISGOOD(x(n=>i)) && $ISGOOD(x(n=>j)) && $ISGOOD(y(n=>i)) && $ISGOOD(y(n=>j))) {
3517- c_pljoin ($x(n=>j), $y(n=>j), $x(n=>i), $y(n=>i));
3512+ BadCode => '
3513+ loop (n) %{
3514+ if ($ISGOOD(x()) && $ISGOOD(x(n=>n-1)) && $ISGOOD(y()) && $ISGOOD(y(n=>n-1))) {
3515+ c_pljoin ($x(n=>n-1), $y(n=>n-1), $x(), $y());
35183516 }
3519- }',
3517+ % }',
35203518 Doc => $doc,
35213519 );
35223520
@@ -3570,37 +3568,20 @@ pp_def ('plcolorpoints',
35703568 Pars => 'x(n); y(n); z(n); int sym(); minz(); maxz()',
35713569 GenericTypes => [D],
35723570 HandleBad => 1,
3573- Code => 'int i;
3571+ Code => '
35743572 int j;
3575- int ns = $SIZE(n);
35763573 PLFLT zrange, ci;
35773574
35783575 zrange = $maxz() - $minz();
35793576
3580- for (i=0;i<ns;i++) {
3581- ci = (zrange == 0.0) ? 0.5 : ($z(n=>i) - $minz()) / zrange; /* get color idx in 0-1 range */
3577+ loop (n) %{
3578+ PDL_IF_BAD(if ($ISBAD(z())) continue;,)
3579+ ci = (zrange == 0.0) ? 0.5 : ($z() - $minz()) / zrange; /* get color idx in 0-1 range */
35823580 if (ci < 0) ci = 0; /* enforce bounds */
35833581 if (ci > 1) ci = 1;
35843582 c_plcol1 (ci); /* set current color */
3585- c_plsym (1, &$x(n=>i), &$y(n=>i), $sym()); /* plot it */
3586- }',
3587- BadCode =>
3588- 'int i;
3589- int j;
3590- int ns = $SIZE(n);
3591- PLFLT zrange, ci;
3592-
3593- zrange = $maxz() - $minz();
3594-
3595- for (i=0;i<ns;i++) {
3596- if ($ISBAD(z(n=>i))) continue;
3597- ci = (zrange == 0.0) ? 0.5 : ($z(n=>i) - $minz()) / zrange; /* get color idx in 0-1 range */
3598- if (ci < 0) ci = 0; /* enforce bounds */
3599- if (ci > 1) ci = 1;
3600- c_plcol1 (ci); /* set current color */
3601- c_plsym (1, &$x(n=>i), &$y(n=>i), $sym()); /* plot it */
3602-
3603- }',
3583+ c_plsym (1, &$x(), &$y(), $sym()); /* plot it */
3584+ %}',
36043585 Doc => $doc,
36053586 );
36063587
0 commit comments