Chimera: chimera_0-8/include/dllist.h Source File

- Main Page
- Classes
- Files
- Directories

- File List
- File Members

# dllist.h

Go to the documentation of this file.

    00001 /*
    00002 Libraries for fields, doubly-linked lists and red-black trees.
    00003 Copyright (C) 2001 James S. Plank
    00004
    00005 This library is free software; you can redistribute it and/or
    00006 modify it under the terms of the GNU Lesser General Public
    00007 License as published by the Free Software Foundation; either
    00008 version 2.1 of the License, or (at your option) any later version.
    00009
    00010 This library is distributed in the hope that it will be useful,
    00011 but WITHOUT ANY WARRANTY; without even the implied warranty of
    00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00013 Lesser General Public License for more details.
    00014
    00015 You should have received a copy of the GNU Lesser General Public
    00016 License along with this library; if not, write to the Free Software
    00017 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    00018
    00019 ---------------------------------------------------------------------------
    00020 Please see http://www.cs.utk.edu/~plank/plank/classes/cs360/360/notes/Libfdr/
    00021 for instruction on how to use this library.
    00022
    00023 Jim Plank
    00024 plank@cs.utk.edu
    00025 http://www.cs.utk.edu/~plank
    00026
    00027 Associate Professor
    00028 Department of Computer Science
    00029 University of Tennessee
    00030 203 Claxton Complex
    00031 1122 Volunteer Blvd.
    00032 Knoxville, TN 37996-3450
    00033
    00034      865-974-4397
    00035 Fax: 865-974-4404
    00036 */
    00037 #ifndef _DLLIST_H_
    00038 #define _DLLIST_H_
    00039
    00040 #include "jval.h"
    00041
    00042 typedef struct dllist {
    00043   struct dllist *flink;
    00044   struct dllist *blink;
    00045   Jval val;
    00046 } *Dllist;
    00047
    00048 extern Dllist new_dllist();
    00049 extern void free_dllist(Dllist);
    00050
    00051 extern void dll_append(Dllist, Jval);
    00052 extern void dll_prepend(Dllist, Jval);
    00053 extern void dll_insert_b(Dllist, Jval);
    00054 extern void dll_insert_a(Dllist, Jval);
    00055
    00056 extern void dll_delete_node(Dllist);
    00057 extern int dll_empty(Dllist);
    00058
    00059 extern Jval dll_val(Dllist);
    00060
    00061 #define dll_first(d) ((d)->flink)
    00062 #define dll_next(d) ((d)->flink)
    00063 #define dll_last(d) ((d)->blink)
    00064 #define dll_prev(d) ((d)->blink)
    00065 #define dll_nil(d) (d)
    00066
    00067 #define dll_traverse(ptr, list) \
    00068   for (ptr = list->flink; ptr != list; ptr = ptr->flink)
    00069 #define dll_rtraverse(ptr, list) \
    00070   for (ptr = list->blink; ptr != list; ptr = ptr->blink)
    00071
    00072 #endif