/*
 *  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 Library 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */

#ifndef _CHAIN_H
#define _CHAIN_H

#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>

#include "wrapper.h"

typedef enum {
  FREE,
  NO_FREE
} chain_memory_manager;

struct chain {
  void * value;
  chain_memory_manager _2be3;
  struct chain *previous;
  struct chain *next;
};

/*----------------------------------------------------------*/
/* Prototype */
struct chain *new_chain(const void *, chain_memory_manager _2be3);
struct chain *new_chains_struct(struct chain *, ...);
struct chain *new_chains(const void *, ...);
void drop_all_chain(struct chain *);
struct chain * add_chain(struct chain *, struct chain *, unsigned int);
struct chain * delete_chain(struct chain *, unsigned int);
struct chain * get_chain(struct chain *, unsigned int);
struct chain * find_chain(struct chain *, const void *);
struct chain * get_last_chain(struct chain *);
unsigned int get_nb_chain(struct chain *);
struct chain *copy_chain(struct chain *);
void append_chain(struct chain *, struct chain *);

/* !! Surtout utile pour du debug !! */
void print_chain(struct chain *);
void print_reverse_chain(struct chain *);
void print_all_chain(struct chain *);
/*----------------------------------------------------------*/
#endif


syntax highlighted by Code2HTML, v. 0.9.1