##
## OSSP al - Assembly Line
## Copyright (c) 2002-2005 The OSSP Project
## Copyright (c) 2002-2005 Cable & Wireless
## Copyright (c) 2002-2005 Ralf S. Engelschall
## Copyright (c) 2002-2005 Michael van Elst
##
## This file is part of OSSP al, an abstract datatype of a data buffer
## that can assemble, move and truncate data but avoids actual copying
## and which can be found at http://www.ossp.org/pkg/lib/al/.
##
## Permission to use, copy, modify, and distribute this software for
## any purpose with or without fee is hereby granted, provided that
## the above copyright notice and this permission notice appear in all
## copies.
##
## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
## SUCH DAMAGE.
##
## al.pod: assembly line library manual page
##
=pod
=head1 NAME
B - Assembly Line
=head1 VERSION
B
=head1 SYNOPSIS
=over 4
=item B:
al_rc_t,
al_t,
al_tx_t,
al_td_t,
al_chunk_t.
=item B:
al_create,
al_destroy,
al_append_bytes,
al_prepend_bytes,
al_attach_buffer,
al_splice,
al_setlabel,
al_bytes.
=item B:
al_txalloc,
al_txfree,
al_traverse,
al_traverse_next,
al_traverse_end,
al_traverse_cb.
=item B:
al_flatten,
al_copy,
al_firstlabel,
al_spanlabel.
=item B:
al_chunk_len,
al_chunk_span,
al_chunk_label,
al_same_label,
al_chunk_ptr.
=item B:
al_error.
=back
=head1 DESCRIPTION
B defines an abstract data type of a data buffer that can
assemble, move and truncate chunks of data in a stream but avoids
actual copying. It was built to deal efficiently with communication
streams between software modules. It especially provides flexible
semantical data attribution through by-chunk labeling. It also
has convenient chunk traversal methods and optional OSSP ex based
exception handling.
=head1 DATA TYPES
B uses six data types in its API:
=over 4
=item B (Return Code Type)
This is an exported enumerated integer type with the following possible
values:
AL_OK Everything Ok
AL_ERR_ARG Invalid Argument
AL_ERR_MEM Not Enough Memory
AL_ERR_EOF End Of Communication
AL_ERR_INT Internal Error
=item B (Assembly Line Type)
This is an opaque data type representing a data buffer.
Only pointers to this abstract data type are used in the API.
=item B (Label Type)
This is an opaque pointer type representing a specific data flavour.
You can restrict traversal operations to data that was marked with
the specific flavour. Usually you would cast a pointer to the
object that maintains the data to B. You may use
NULL as a label but on traversal NULL matches any label.
=item B (Traversal Context Type)
This is an opaque data type representing the state of a buffer
traversal operation. Only pointers to this abstract data type are
used in the API.
=item B (Traversal Direction Type)
This is an exported enumerated integer type with the following possible
values:
AL_FORWARD traverse assembly line from beginning to end
AL_BACKWARD traverse assembly line from end to beginning
AL_FORWARD_SPAN like AL_FORWARD, but stop when label does not match
AL_BACKWARD_SPAN like AL_BACKWARD, but stop when label does not match
=item B (Chunk Type)
This is an opaque data type representing a chunk of a buffer during
a traversal operation. Only pointers to this abstract data type are
used in the API. The B type is used to generate a pointer
and byte count to access the data in the buffer.
=back
=head1 FUNCTIONS
B provides a bunch of API functions, all modelled after the
same prototype: "C CIC<(al_>[C]C<_t *,>
...C<)>". This means every function returns C to indicate its
success (C) or failure (C) by returning a return code
(the corresponding describing text can be determined by passing this
return code to C). Each function name starts with the common
prefix C and receives a C (or C) object on which
it operates as its first argument.
=head2 Assembly Line Operations
=over 4
=item al_rc_t B(al_t **I);
Create an assembly line abstraction object.
The object is stored in I on success.
Example: C
=item al_rc_t B(al_t *I);
Destroy an assembly line abstraction object.
The object I is invalid after this call succeeded.
Example: C
=item al_rc_t B(al_t *I, const char *I, size_t I, al_label_t I