Skip to content

Commit

Permalink
move maybe-croakers to before allocation
Browse files Browse the repository at this point in the history
  • Loading branch information
mohawk2 committed Aug 17, 2024
1 parent d6cf2d0 commit 83d2243
Showing 1 changed file with 14 additions and 21 deletions.
35 changes: 14 additions & 21 deletions plplot.pd
Original file line number Diff line number Diff line change
Expand Up @@ -4047,6 +4047,10 @@ pp_def ('plshades',
GenericTypes => [D],
Doc => 'Shade regions on the basis of value',
Code => '
defined_callback_set($COMP(defined),
"plshades: defined must be either 0 or a subroutine pointer");
pltr_callback_set($COMP(pltr),
"plshades: pltr must be either 0 or a subroutine pointer");
int nx = $SIZE(x);
int ny = $SIZE(y);
int nlvl = $SIZE(l);
Expand All @@ -4061,12 +4065,6 @@ pp_def ('plshades',
for (j = 0; j < ny; j++)
z[i][j] = (PLFLT) $z(x => i, y => j);

defined_callback_set($COMP(defined),
"plshades: defined must be either 0 or a subroutine pointer");

pltr_callback_set($COMP(pltr),
"plshades: pltr must be either 0 or a subroutine pointer");

pltrcb = get_standard_pltrcb ($COMP(pltr));
if (pltrcb != pltr_callback)
pltrdt = PLPTR_RECEIVE_SV($COMP(pltr_data));
Expand All @@ -4090,6 +4088,8 @@ pp_def ('plcont',
OtherPars => 'SV* pltr; SV* pltr_data;', # 6,7
Doc => 'Plot contours',
Code => '
pltr_callback_set($COMP(pltr),
"plcont: pltr must be either 0 or a subroutine pointer");
int i, j, size_x, size_y;
PLFLT** ff;
void (*pltrcb) ();
Expand All @@ -4104,9 +4104,6 @@ pp_def ('plcont',
for (j = 0; j < size_y; j++)
ff[i][j] = $f(nx => i, ny => j);

pltr_callback_set($COMP(pltr),
"plcont: pltr must be either 0 or a subroutine pointer");

pltrcb = get_standard_pltrcb ($COMP(pltr));
if (pltrcb != pltr_callback)
pltrdt = PLPTR_RECEIVE_SV($COMP(pltr_data));
Expand Down Expand Up @@ -4245,6 +4242,10 @@ pp_def ('plshade1',
PMCode => _make_reorder('plshade1'),
Doc => 'Shade individual region on the basis of value',
Code => '
defined_callback_set($COMP(defined),
"plshade1: defined must be either 0 or a subroutine pointer");
pltr_callback_set($COMP(pltr),
"plshade1: pltr must be either 0 or a subroutine pointer");
int i, j, size_x, size_y;
PLFLT **a;
void (*pltrcb) ();
Expand All @@ -4260,12 +4261,6 @@ pp_def ('plshade1',
for (j = 0; j < size_y; j++)
a[i][j] = $a(nx => i, ny => j);

defined_callback_set($COMP(defined),
"plshade1: defined must be either 0 or a subroutine pointer");

pltr_callback_set($COMP(pltr),
"plshade1: pltr must be either 0 or a subroutine pointer");

pltrcb = get_standard_pltrcb ($COMP(pltr));
if (pltrcb != pltr_callback)
pltrdt = PLPTR_RECEIVE_SV($COMP(pltr_data));
Expand Down Expand Up @@ -4319,6 +4314,8 @@ pp_def ('plimagefr',
OtherPars => 'SV* pltr; SV* pltr_data;', # 9,10
Doc => 'Plot image with transformation',
Code => '
pltr_callback_set($COMP(pltr),
"plimagefr: pltr must be either 0 or a subroutine pointer");
int i, j, size_x, size_y;
PLFLT** idata;
void (*pltrcb) ();
Expand All @@ -4327,9 +4324,6 @@ pp_def ('plimagefr',
size_x = $SIZE(nx);
size_y = $SIZE(ny);

pltr_callback_set($COMP(pltr),
"plimagefr: pltr must be either 0 or a subroutine pointer");

pltrcb = get_standard_pltrcb ($COMP(pltr));
if (pltrcb != pltr_callback)
pltrdt = PLPTR_RECEIVE_SV($COMP(pltr_data));
Expand Down Expand Up @@ -5165,6 +5159,8 @@ pp_def ('plvect',
OtherPars => 'SV* pltr; SV* pltr_data;',
Doc => 'Vector field plots',
Code => '
pltr_callback_set($COMP(pltr),
"plvect: pltr must be either 0 or a subroutine pointer");
int i, j, size_x, size_y;
PLFLT** u;
PLFLT** v;
Expand All @@ -5183,9 +5179,6 @@ pp_def ('plvect',
v[i][j] = $v(nx => i, ny => j);
}

pltr_callback_set($COMP(pltr),
"plvect: pltr must be either 0 or a subroutine pointer");

pltrcb = get_standard_pltrcb ($COMP(pltr));
if (pltrcb != pltr_callback)
pltrdt = PLPTR_RECEIVE_SV($COMP(pltr_data));
Expand Down

0 comments on commit 83d2243

Please sign in to comment.