X-Git-Url: https://perl5.git.perl.org/perl5.git/blobdiff_plain/af80dd863acea8450a9f41ae03645f4d69dad091..36f453d19563f9476d4310b8310ce4080209b04f:/av.h diff --git a/av.h b/av.h index 8d18d25..6903db6 100644 --- a/av.h +++ b/av.h @@ -37,17 +37,25 @@ struct xpvav { */ /* -=head1 Handy Values - -=for apidoc AmU||Nullav +=for apidoc ADmnU||Nullav Null AV pointer. (deprecated - use C<(AV *)NULL> instead) -=head1 Array Manipulation Functions +=for apidoc Am|SSize_t|AvFILL|AV* av +Same as C> or C>. + +=for apidoc Cm|SSize_t|AvFILLp|AV* av + +If the array C is empty, this returns -1; otherwise it returns the maximum +value of the indices of all the array elements which are currently defined in +C. It does not handle magic, hence the C

private indication in its name. + +=for apidoc Am|SV**|AvARRAY|AV* av +Returns a pointer to the AV's internal SV* array. -=for apidoc Am|int|AvFILL|AV* av -Same as C. Deprecated, use C instead. +This is useful for doing pointer arithmetic on the array. +If all you need is to look up an array element, then prefer C. =cut */ @@ -71,10 +79,20 @@ Same as C. Deprecated, use C instead. #define AvREIFY_off(av) (SvFLAGS(av) &= ~SVpav_REIFY) #define AvREIFY_only(av) (AvREAL_off(av), SvFLAGS(av) |= SVpav_REIFY) + #define AvREALISH(av) (SvFLAGS(av) & (SVpav_REAL|SVpav_REIFY)) #define AvFILL(av) ((SvRMAGICAL((const SV *) (av))) \ ? mg_size(MUTABLE_SV(av)) : AvFILLp(av)) +#define av_top_index(av) AvFILL(av) +#define av_tindex(av) av_top_index(av) + +/* Note that it doesn't make sense to do this: + * SvGETMAGIC(av); IV x = av_tindex_nomg(av); + */ +# define av_top_index_skip_len_mg(av) \ + (__ASSERT_(SvTYPE(av) == SVt_PVAV) AvFILLp(av)) +# define av_tindex_skip_len_mg(av) av_top_index_skip_len_mg(av) #define NEGATIVE_INDICES_VAR "NEGATIVE_INDICES" @@ -91,11 +109,5 @@ Perl equivalent: C. #define newAV() MUTABLE_AV(newSV_type(SVt_PVAV)) /* - * Local variables: - * c-indentation-style: bsd - * c-basic-offset: 4 - * indent-tabs-mode: t - * End: - * - * ex: set ts=8 sts=4 sw=4 noet: + * ex: set ts=8 sts=4 sw=4 et: */