1N/A * Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 1N/A * 2000, 2001, 2002, 2003, by Larry Wall and others 1N/A * You may distribute under the terms of either the GNU General Public 1N/A * License or the Artistic License, as specified in the README file. 1N/A * "...for the Entwives desired order, and plenty, and peace (by which they 1N/A * meant that things should remain where they had set them)." --Treebeard 1N/A=head1 Array Manipulation Functions 1N/A=for apidoc av_extend 1N/APre-extend an array. The C<key> is the index to which the array should be 1N/AReturns the SV at the specified index in the array. The C<key> is the 1N/Aindex. If C<lval> is set then the fetch will be part of a store. Check 1N/Athat the return value is non-null before dereferencing it to a C<SV*>. 1N/ASee L<perlguts/"Understanding the Magic of Tied Hashes and Arrays"> for 1N/Amore information on how to use this function on tied arrays. 1N/A /* Handle negative array indices 20020222 MJD */ 1N/AStores an SV in an array. The array index is specified as C<key>. The 1N/Areturn value will be NULL if the operation failed or if the value did not 1N/Aneed to be actually stored within the array (as in the case of tied 1N/Aarrays). Otherwise it can be dereferenced to get the original C<SV*>. Note 1N/Athat the caller is responsible for suitably incrementing the reference 1N/Acount of C<val> before the call, and decrementing it if the function 1N/ASee L<perlguts/"Understanding the Magic of Tied Hashes and Arrays"> for 1N/Amore information on how to use this function on tied arrays. 1N/A /* Handle negative array indices 20020222 MJD */ 1N/ACreates a new AV. The reference count is set to 1. 1N/ACreates a new AV and populates it with a list of SVs. The SVs are copied 1N/Ainto the array, so they may be freed after the call to av_make. The new AV 1N/Awill have a reference count of 1. 1N/A if (
size) {
/* `defined' was returning undef for size==0 anyway. */ 1N/AClears an array, making it empty. Does not free the memory used by the 1N/A /* Give any tie a chance to cleanup first */ 1N/A /* undef the slot before freeing the value, because a 1N/A * destructor might try to modify this arrray */ 1N/AUndefines the array. Frees the memory used by the array itself. 1N/A /* Give any tie a chance to cleanup first */ 1N/APushes an SV onto the end of the array. The array will grow automatically 1N/Ato accommodate the addition. 1N/APops an SV off the end of the array. Returns C<&PL_sv_undef> if the array 1N/A=for apidoc av_unshift 1N/AUnshift the given number of C<undef> values onto the beginning of the 1N/Aarray. The array will grow automatically to accommodate the addition. You 1N/Amust then use C<av_store> to assign values to these new elements. 1N/A /* Create extra elements */ 1N/A /* Make extra elements into a buffer */ 1N/AShifts an SV off the beginning of the array. 1N/AReturns the highest index in the array. Returns -1 if the array is 1N/AEnsure than an array has a given number of elements, equivalent to 1N/APerl's C<$#array = $fill;>. 1N/A=for apidoc av_delete 1N/ADeletes the element indexed by C<key> from the array. Returns the 1N/Adeleted element. If C<flags> equals C<G_DISCARD>, the element is freed 1N/Aand null is returned. 1N/A /* Handle negative array indices 20020222 MJD */ 1N/A=for apidoc av_exists 1N/AReturns true if the element indexed by C<key> has been initialized. 1N/AThis relies on the fact that uninitialized array elements are set to 1N/A /* Handle negative array indices 20020222 MJD */ 1N/A/* AVHV: Support for treating arrays as if they were hashes. The 1N/A * first element of the array should be a hash reference that maps 1N/A * hash keys to array indices. 1N/A "Pseudo-hashes are deprecated");
1N/A/* Check for the existence of an element named by a given key.