list.h

Go to the documentation of this file.
00001 /*  Copyright (c) 2006-2007, Philip Busch <broesel@studcs.uni-sb.de>
00002  *  All rights reserved.
00003  *
00004  *  Redistribution and use in source and binary forms, with or without
00005  *  modification, are permitted provided that the following conditions are met:
00006  *
00007  *   - Redistributions of source code must retain the above copyright notice,
00008  *     this list of conditions and the following disclaimer.
00009  *   - Redistributions in binary form must reproduce the above copyright
00010  *     notice, this list of conditions and the following disclaimer in the
00011  *     documentation and/or other materials provided with the distribution.
00012  *
00013  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00014  *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00015  *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00016  *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
00017  *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00018  *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00019  *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00020  *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00021  *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00022  *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00023  *  POSSIBILITY OF SUCH DAMAGE.
00024  */
00025 
00032 #ifndef _LIST_H
00033 #define _LIST_H
00034 
00035 typedef struct node_l node_l;
00036 struct node_l {
00037         node_l *next;
00038         void *data;
00039 };
00040 
00041 typedef struct _data {
00042         int n;
00043         char str[1024];
00044 } data;
00045 
00046 
00047 int list_push(node_l **_x, void *_data);
00048 
00049 void *list_pop(node_l **_x);
00050 
00051 int list_move(node_l **_dest, node_l **_src);
00052 
00053 int list_reverse(node_l **_x);
00054 
00055 node_l *list_sub(const node_l *_x, int _pos);
00056 
00057 int list_insert(node_l **_x, int _pos, void *_data);
00058 
00059 void *list_remove(node_l **_x, int _pos);
00060 
00061 void *list_get(const node_l *_x, int _n);
00062 
00063 size_t list_size(const node_l *_x);
00064 
00065 node_l *list_join(node_l *_a, node_l *_b);
00066 
00067 void list_print(const node_l *_a);
00068 
00069 int list_split(node_l **_src, node_l **_front, node_l **_back);
00070 
00071 int list_merge(node_l **_dest, node_l **_a, node_l **_b, int _cmp(void *, void *));
00072 
00073 int list_sort(node_l **_x, int _cmp(void *, void *));
00074 
00075 int list_copy(const node_l *_src, node_l **_dest);
00076 
00077 int list_realloc(node_l *_x, size_t _sz);
00078 
00079 int list_dup(node_l *_src, node_l **_dest, size_t _sz);
00080 
00081 void list_delete(node_l **_x);
00082 
00083 void list_destroy(node_l **_x);
00084 
00085 int list_foreach(node_l *_x, int _func(void *));
00086 
00087 #endif  /* ! _LIST_H */

Generated on Thu Jul 19 13:36:09 2007 for libv by  doxygen 1.5.1-p1. Thank you, SourceForge.net Logo