1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
|
=head1 NAME
rarray_pop, rarray_push - Stack like operators for Roy arrays.
=head1 SYNOPSIS
#include <roy.h>
void * rarray_push (RArray *I<array>);
void * rarray_pop (RArray *I<array>);
void * rarray_peak (RArray *I<array>);
=head1 DESCRIPTION
The intention of these functions is to create a stack interface to arrays
so that they may be easily used to create a stack. This is especially
useful for small entries such as a single pointer or integer where the
overhead of linked lists is not needed or desired.
Due to rarray's auto-expanding behaviour, this essentially produces a
stack of infinite size, while still providing good speed.
rarray_push(3) is actually a macro that directly calls rarray_append(3),
but is named such so as to provide symmetry with the rarray_pop(3) function.
rarray_push(3) appends a new entry to I<array>.
rarray_pop(3) returns a pointer to the last entry in the array, and
then removes it from the array. If there are no more entries in the
array, it returns NULL.
rarray_peak(3) is actually a macro that directly calls rarray_last(3).
rarray_peak(3) returns the last entry in I<array> without removing it.
=head1 RETURN VALUE
These functions return pointers to entries in the array. These
entries must then be cast to the appropriate types as defined when
created using rarray_new(3).
=head1 ERRORS
These calls produce no errors.
=head1 SEE ALSO
rarray(3), rarray_append(3), rarray_free(3),
rarray_last(3), rarray_len(3), rarray_new(3),
rarray_nth(3), rarray_peak(3), rarray_pop(3),
rarray_push(3), rarray_set_len(3), roy(3)
|