ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

simple_list.h
Go to the documentation of this file.
00001 
00012 /*
00013  * Mesa 3-D graphics library
00014  * Version:  3.5
00015  *
00016  * Copyright (C) 1999-2001  Brian Paul   All Rights Reserved.
00017  *
00018  * Permission is hereby granted, free of charge, to any person obtaining a
00019  * copy of this software and associated documentation files (the "Software"),
00020  * to deal in the Software without restriction, including without limitation
00021  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
00022  * and/or sell copies of the Software, and to permit persons to whom the
00023  * Software is furnished to do so, subject to the following conditions:
00024  *
00025  * The above copyright notice and this permission notice shall be included
00026  * in all copies or substantial portions of the Software.
00027  *
00028  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
00029  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00030  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
00031  * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
00032  * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
00033  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00034  */
00035 
00036 
00037 #ifndef _SIMPLE_LIST_H
00038 #define _SIMPLE_LIST_H
00039 
00045 #define remove_from_list(elem)          \
00046 do {                        \
00047    (elem)->next->prev = (elem)->prev;       \
00048    (elem)->prev->next = (elem)->next;       \
00049 } while (0)
00050 
00057 #define insert_at_head(list, elem)      \
00058 do {                        \
00059    (elem)->prev = list;             \
00060    (elem)->next = (list)->next;         \
00061    (list)->next->prev = elem;           \
00062    (list)->next = elem;             \
00063 } while(0)
00064 
00071 #define insert_at_tail(list, elem)      \
00072 do {                        \
00073    (elem)->next = list;             \
00074    (elem)->prev = (list)->prev;         \
00075    (list)->prev->next = elem;           \
00076    (list)->prev = elem;             \
00077 } while(0)
00078 
00085 #define move_to_head(list, elem)        \
00086 do {                        \
00087    remove_from_list(elem);          \
00088    insert_at_head(list, elem);          \
00089 } while (0)
00090 
00097 #define move_to_tail(list, elem)        \
00098 do {                        \
00099    remove_from_list(elem);          \
00100    insert_at_tail(list, elem);          \
00101 } while (0)
00102 
00108 #define make_empty_list(sentinal)       \
00109 do {                        \
00110    (sentinal)->next = sentinal;         \
00111    (sentinal)->prev = sentinal;         \
00112 } while (0)
00113 
00121 #define first_elem(list)       ((list)->next)
00122 
00130 #define last_elem(list)        ((list)->prev)
00131 
00139 #define next_elem(elem)        ((elem)->next)
00140 
00148 #define prev_elem(elem)        ((elem)->prev)
00149 
00158 #define at_end(list, elem)     ((elem) == (list))
00159 
00167 #define is_empty_list(list)    ((list)->next == (list))
00168 
00178 #define foreach(ptr, list)     \
00179         for( ptr=(list)->next ;  ptr!=list ;  ptr=(ptr)->next )
00180 
00194 #define foreach_s(ptr, t, list)   \
00195         for(ptr=(list)->next,t=(ptr)->next; list != ptr; ptr=t, t=(t)->next)
00196 
00197 #endif

Generated on Fri May 25 2012 04:18:33 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.