I did a
printf(" t = %d\n",SvTYPE(ST(3)));
and got (for both):
t = 3;
from sv.h :
typedef enum {
SVt_NULL, /* 0 */
SVt_IV, /* 1 */
SVt_NV, /* 2 */
SVt_RV, /* 3 */
SVt_PV, /* 4 */
SVt_PVIV, /* 5 */
SVt_PVNV, /* 6 */
SVt_PVMG, /* 7 */
SVt_PVBM, /* 8 */
SVt_PVLV, /* 9 */
SVt_PVAV, /* 10 */
SVt_PVHV, /* 11 */
SVt_PVCV, /* 12 */
SVt_PVGV, /* 13 */
SVt_PVFM, /* 14 */
SVt_PVIO /* 15 */
} svtype;
So how do I differentiate between a pointer to
an array and a pointer to a hash?
Billy Patton wrote:
>
> I'm getting something I'm confused.
> I have this XS code:
> if (SvTYPE(ST(3)) != SVt_PVAV)
> {
> printf("arg 3 must be pointer to list of points!\n");
> }
>
> My test code is :
> $x{a} = undef;
> $_ = 'x';
> @pts = qw ( 0 0 0 10 10 10 10 0 0 0);
> print "not " if Laff::Node->New("BLA-BLA",1,\%x);
> print "ok 5\n";
> print "not " unless Laff::Node->New("BLA-BLA",1,\@pts);
> print "ok 8\n";
>
> Both get the error message about arg 3 must be pointer.
>
> What's the problem?