/* This file implements a singly linked list. Copyright (C) 2004 The University of Texas at Austin 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Email: usman@cs.njit.edu Mail: Usman Roshan, Department of Computer Sciences, NJIT-CCS, Computer Science Department, GITC 4400, University Heights, Newark, NJ 07102 */ /* * ! \file list.h \brief Contains definition for a list structure */ #ifndef LIST #define LIST typedef struct list_struct *list; typedef struct list_node_struct *list_node; struct list_node_struct { void *data; list_node next; list_node prev; }; struct list_struct { list_node head; list_node tail; int size; }; /* constructors */ list new_list(); list_node new_list_node(void *v); /* destructor */ void del_list(list l); void del_list_node(list_node n); /* operations */ list_node append_list(list l, void *v); list_node insert_list(list l, void *v, list_node n, int where); void *pop_list(list l); void push_list(list l, void *d); int size_list(list l); #endif