/*                                 W3C Sample Code Library libwww Dynamic Array Pointer Class
                               DYNAMIC ARRAY POINTER CLASS
                                             
 */
/*
**      (c) COPYRIGHT MIT 1995.
**      Please first read the full copyright statement in the file COPYRIGH.
*/
/*

   NULL This module is implemented by HTArray.c, and it is a part of the W3C Sample Code
   Library.
   
 */
#ifndef HTARRAY_H
#define HTARRAY_H
/*

PRIVATE DATA STRUCTURE

 */
typedef struct {
    int         size;           /* In numbers of elements       */
    int         growby;         /* Allocation unit in elements  */
    int         allocated;      /* Current size of *data        */
    void **     data;           /* Pointer to malloced area or 0 */
} HTArray;
/*

CREATE A NEW ARRAY

 */
extern HTArray * HTArray_new (int grow);
/*

DELETE AN ARRAY

 */
extern BOOL HTArray_delete (HTArray * array);
/*

CLEAR AN ARRAY

 */
extern BOOL HTArray_clear (HTArray * array);
/*

APPEND AN ELEMENT TO THE ARRAY

 */
extern BOOL HTArray_addObject (HTArray * array, void * object);
/*

TRAVERSE AN ARRAY

 */
#define HTArray_firstObject(me, data) \
        ((me) && ((data)=(me)->data) ? *(data)++ : NULL)
#define HTArray_nextObject(me, data) \
        ((me) && (data) ? *(data)++ : NULL)
/*

SORT AN ARRAY

 */
typedef int HTComparer (const void * a, const void * b);
/*

 */
extern BOOL HTArray_sort (HTArray * array, HTComparer * comp);
/*

RETURNS DATA VECTOR

 */
#define HTArray_data(me)        ((me) ? (me)->data : NULL)
/*

RETURN CURRENT SIZE

 */
#define HTArray_size(me)        ((me) ? (me)->size : -1)
/*

 */
#endif
/*

   
   ___________________________________
   
                            @(#) $Id: HTArray.html,v 2.7 1998/05/14 02:10:14 frystyk Exp $
                                                                                          
   */
