list_proto.h 4.12 KB
/**
 * \file scot/list_proto.h
 * \author  Georg Steffers <georg@steffers.org>
 * \brief   This generates all prototypes needed for typesafe lists.
 *
 * This combines the macro definitions in \link scot/list_type_proto.h 
 * scot/list_type_proto.h \endlink and \link scot/list_func_proto.h 
 * scot/list_func_proto.h \endlink.
 * Additionally defines for all errornumbers that list will create can be
 * found here.
 * GEN_LIST_PROTO is normally called in a header file that describes a 
 * new Datatype and also wants lists of it.
 * By doing this the complete interface to lists of that datatype is
 * produced.
 *
 * Copyright (C)2006    Georg Steffers <georg@steffers.org>
 * 
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */
#ifndef  LIST_PROTO_H
#define  LIST_PROTO_H

#include <scot/list_type_proto.h>
#include <scot/list_func_proto.h>

/** \brief errnum if list_[type]_new() failes*/
#define  LIST_NEW_ERR            0x00 
/** \brief errnum if list_[type]_free() failes*/
#define  LIST_FREE_ERR           0x01 
/** \brief errnum if list_[type]_bol() failes*/
#define  LIST_BOL_ERR            0x02 
/** \brief errnum if list_[type]_eol() failes*/
#define  LIST_EOL_ERR            0x03 
/** \brief errnum if list_[type]_isempty() failes*/
#define  LIST_ISEMPTY_ERR        0x04 
/** \brief errnum if list_[type]_front() failes*/
#define  LIST_FRONT_ERR          0x05 
/** \brief errnum if list_[type]_last() failes*/
#define  LIST_LAST_ERR           0x06 
/** \brief errnum if list_[type]_next() failes*/
#define  LIST_NEXT_ERR           0x07 
/** \brief errnum if list_[type]_prev() failes*/
#define  LIST_PREV_ERR           0x08 
/** \brief errnum if list_[type]_find() failes*/
#define  LIST_FIND_ERR           0x09 
/** \brief errnum if list_[type]_find_anchor() failes*/
#define  LIST_FIND_ANCHOR_ERR    0x0A 
/** \brief errnum if list_[type]_retrive() failes*/
#define  LIST_RETR_ERR           0x0B 
/** \brief errnum if list_[type]_set() failes*/
#define  LIST_SET_ERR            0x0C 
/** \brief errnum if list_[type]_insert() failes*/
#define  LIST_INSERT_ERR         0x0D 
/** \brief errnum if list_[type]_delete() failes*/
#define  LIST_DELETE_ERR         0x0E 
/** \brief errnum if list_[type]_concat() failes*/
#define  LIST_CONCAT_ERR         0x0F 
/** \brief errnum if list_[type]_count() failes*/
#define  LIST_COUNT_ERR          0x10 

/** \brief errnum if node is no anchor*/
#define  NODE_NO_ANCHOR_ERR      0x11 
/** \brief errnum if list has no anchor*/
#define  MALFORMED_LIST_ERR      0x12 

/** \brief warning if delete on empty list*/
#define  DEL_ON_EMPTY_LIST_WRN   0x01 


/**
 * \param   type     the datatype that this list code should handle.
 * \pre              Type must be a single word typename. If one wants
 *                   to use e.g. lists of structs one has to use typedef
 *                   to create a single word type name like this:
 *                   typedef struct mystruct_t mystruct_t;
 * \return           Nothing
 * \post             The typedefs, struct declaration and function prototypes
 *                   for functions to lists for the given datatype are 
 *                   generated within the calling build file.
 *
 * \brief this creates all typdefs, declarations and prototypes needed for a
 *        typesafe list of a given \a type. This is normally calles within
 *        a header file.
 */
#define  GEN_LIST_PROTO(type)                         \
   GEN_LIST_TYPE_PROTO (type)                         \
   GEN_LIST_FUNC_PROTO (type)

#endif   /* LIST_PROTO_H */