stack_type_proto.h 2.7 KB
/**
 * \file scot/stack_type_proto.h
 * \author  Georg Steffers <georg@steffers.org>
 * \brief   Macro that creates the datatype for handling stacks based on
 *          linked lists.
 *
 * The macros here create all datatype prototypes and typedefs declarations to 
 * the implementations created by the macros in 
 * \link scot/stack_impl.h scot/stack_impl.h\endlink.
 * These macros are normally not called directly within your code but
 * through \link scot/stack_proto.h::GEN_STACK_PROTO GEN_STACK_PROTO\endlink. 
 * This is because normally one did not only
 * want the datatypes but also the interface declaration to them.
 * 
 * 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  STACK_TYPE_PROTO_H
#define  STACK_TYPE_PROTO_H

/**
 * \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;
 *                   GEN_LIST_TYPE_PROTO(type) should have been called
 *                   previous to this.
 * \return           Nothing
 * \post             The datatype prototypes for stacks based on lists 
 *                   of the given datatype are created.
 *
 * \brief Datatype prototypes to stacks.
 *
 * This creates the prototypes of the datatypes needed to use the
 * stack interface.
 *
 * Normally this is not called directly, but by 
 * \link scot/stack_proto.h::GEN_STACK_PROTO GEN_STACK_PROTO()\endlink 
 * because it is also neccesary to create the interface to this 
 * datatypes for working stacks.
 */
#define  GEN_STACK_TYPE_PROTO(type)                                  \
   struct stack_ ## type ## _node_t;                                 \
   typedef struct stack_ ## type ## _node_t                          \
      stack_ ## type ## _node_t;                                     \

#endif   /* STACK_TYPE_PROTO_H */