[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pspp-cvs] pspp/src/libpspp ChangeLog ll.h
From: |
Ben Pfaff |
Subject: |
[Pspp-cvs] pspp/src/libpspp ChangeLog ll.h |
Date: |
Mon, 23 Apr 2007 01:35:34 +0000 |
CVSROOT: /cvsroot/pspp
Module name: pspp
Changes by: Ben Pfaff <blp> 07/04/23 01:35:34
Modified files:
src/libpspp : ChangeLog ll.h
Log message:
Patch #5884.
(ll_for_each_reverse): New macro.
(ll_for_each_reverse_continue): New macro.
(ll_for_each_reverse_safe): New macro.
(ll_for_each_safe_reverse_continue): New macro.
(ll_for_each_reverse_preremove): New macro.
(ll_for_each_reverse_postremove): New macro.
(ll_remove__): Removed (dead code).
(ll_tail__): New macro.
(ll_prev__): New macro.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pspp/src/libpspp/ChangeLog?cvsroot=pspp&r1=1.62&r2=1.63
http://cvs.savannah.gnu.org/viewcvs/pspp/src/libpspp/ll.h?cvsroot=pspp&r1=1.2&r2=1.3
Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/pspp/pspp/src/libpspp/ChangeLog,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -b -r1.62 -r1.63
--- ChangeLog 23 Apr 2007 01:26:31 -0000 1.62
+++ ChangeLog 23 Apr 2007 01:35:34 -0000 1.63
@@ -1,5 +1,19 @@
2007-04-22 Ben Pfaff <address@hidden>
+ Patch #5884.
+
+ * ll.h (ll_for_each_reverse): New macro.
+ (ll_for_each_reverse_continue): New macro.
+ (ll_for_each_reverse_safe): New macro.
+ (ll_for_each_safe_reverse_continue): New macro.
+ (ll_for_each_reverse_preremove): New macro.
+ (ll_for_each_reverse_postremove): New macro.
+ (ll_remove__): Removed (dead code).
+ (ll_tail__): New macro.
+ (ll_prev__): New macro.
+
+2007-04-22 Ben Pfaff <address@hidden>
+
Implement model checker for testing purposes.
Patch #5873.
Index: ll.h
===================================================================
RCS file: /cvsroot/pspp/pspp/src/libpspp/ll.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- ll.h 15 Dec 2006 00:16:03 -0000 1.2
+++ ll.h 23 Apr 2007 01:35:34 -0000 1.3
@@ -228,7 +228,8 @@
/* Iteration helper macros. */
-/* Sets DATA to each object in LIST in turn, assuming that each
+/* Sets DATA to each object in LIST in turn, in forward or
+ reverse order, assuming that each
`struct ll' in LIST is embedded as the given MEMBER name in
data type STRUCT.
@@ -238,11 +239,16 @@
for (DATA = ll_head__ (STRUCT, MEMBER, LIST); \
DATA != NULL; \
DATA = ll_next__ (DATA, STRUCT, MEMBER, LIST))
+#define ll_for_each_reverse(DATA, STRUCT, MEMBER, LIST) \
+ for (DATA = ll_tail__ (STRUCT, MEMBER, LIST); \
+ DATA != NULL; \
+ DATA = ll_prev__ (DATA, STRUCT, MEMBER, LIST))
/* Continues a iteration of LIST, starting from the object
- currently in DATA and continuing forward through the remainder
- of the list, assuming that each `struct ll' in LIST is
- embedded as the given MEMBER name in data type STRUCT.
+ currently in DATA and continuing, in forward or reverse order,
+ through the remainder of the list, assuming that each `struct
+ ll' in LIST is embedded as the given MEMBER name in data type
+ STRUCT.
Behavior is undefined if DATA is removed from the list between
loop iterations. */
@@ -250,11 +256,15 @@
for (; \
DATA != NULL; \
DATA = ll_next__ (DATA, STRUCT, MEMBER, LIST))
+#define ll_for_each_reverse_continue(DATA, STRUCT, MEMBER, LIST) \
+ for (; \
+ DATA != NULL; \
+ DATA = ll_prev__ (DATA, STRUCT, MEMBER, LIST))
-/* Sets DATA to each object in LIST in turn, assuming that each
- `struct ll' in LIST is embedded as the given MEMBER name in
- data type STRUCT. NEXT must be another variable of the same
- type as DATA.
+/* Sets DATA to each object in LIST in turn, in forward or
+ reverse order, assuming that each `struct ll' in LIST is
+ embedded as the given MEMBER name in data type STRUCT. NEXT
+ (or PREV) must be another variable of the same type as DATA.
Behavior is well-defined even if DATA is removed from the list
between iterations. */
@@ -264,12 +274,19 @@
? (NEXT = ll_next__ (DATA, STRUCT, MEMBER, LIST), 1) \
: 0); \
DATA = NEXT)
+#define ll_for_each_reverse_safe(DATA, PREV, STRUCT, MEMBER, LIST) \
+ for (DATA = ll_tail__ (STRUCT, MEMBER, LIST); \
+ (DATA != NULL \
+ ? (PREV = ll_prev__ (DATA, STRUCT, MEMBER, LIST), 1) \
+ : 0); \
+ DATA = PREV)
-/* Continues a iteration of LIST, starting from the object
- currently in DATA and continuing forward through the remainder
- of the list, assuming that each `struct ll' in LIST is
- embedded as the given MEMBER name in data type STRUCT. NEXT
- must be another variable of the same type as DATA.
+/* Continues a iteration of LIST, in forward or reverse order,
+ starting from the object currently in DATA and continuing
+ forward through the remainder of the list, assuming that each
+ `struct ll' in LIST is embedded as the given MEMBER name in
+ data type STRUCT. NEXT (or PREV) must be another variable of
+ the same type as DATA.
Behavior is well-defined even if DATA is removed from the list
between iterations. */
@@ -279,37 +296,51 @@
? (NEXT = ll_next__ (DATA, STRUCT, MEMBER, LIST), 1) \
: 0); \
DATA = NEXT)
+#define ll_for_each_safe_reverse_continue(DATA, PREV, STRUCT, MEMBER, LIST) \
+ for (; \
+ (DATA != NULL \
+ ? (PREV = ll_prev__ (DATA, STRUCT, MEMBER, LIST), 1) \
+ : 0); \
+ DATA = PREV)
-/* Sets DATA to each object in LIST in turn, assuming that each
- `struct ll' in LIST is embedded as the given MEMBER name in
- data type STRUCT.
+/* Sets DATA to each object in LIST in turn, in forward or
+ reverse order, assuming that each `struct ll' in LIST is
+ embedded as the given MEMBER name in data type STRUCT.
Each object is removed from LIST before its loop iteration. */
#define ll_for_each_preremove(DATA, STRUCT, MEMBER, LIST) \
while (!ll_is_empty (LIST) \
? (DATA = ll_data (ll_pop_head (LIST), STRUCT, MEMBER), 1) \
: 0)
+#define ll_for_each_reverse_preremove(DATA, STRUCT, MEMBER, LIST) \
+ while (!ll_is_empty (LIST) \
+ ? (DATA = ll_data (ll_pop_tail (LIST), STRUCT, MEMBER), 1) \
+ : 0)
-/* Sets DATA to each object in LIST in turn, assuming that each
- `struct ll' in LIST is embedded as the given MEMBER name in
- data type STRUCT.
+/* Sets DATA to each object in LIST in turn, in forward or
+ reverse order, assuming that each `struct ll' in LIST is
+ embedded as the given MEMBER name in data type STRUCT.
At the end of each loop iteration, DATA is removed from the
list. */
#define ll_for_each_postremove(DATA, STRUCT, MEMBER, LIST) \
for (; \
(DATA = ll_head__ (STRUCT, MEMBER, LIST)) != NULL; \
ll_remove (&DATA->MEMBER))
+#define ll_for_each_reverse_postremove(DATA, STRUCT, MEMBER, LIST) \
+ for (; \
+ (DATA = ll_tail__ (STRUCT, MEMBER, LIST)) != NULL; \
+ ll_remove (&DATA->MEMBER))
/* Macros for internal use only. */
#define ll_data__(LL, STRUCT, MEMBER, LIST) \
((LL) != ll_null (LIST) ? ll_data (LL, STRUCT, MEMBER) : NULL)
#define ll_head__(STRUCT, MEMBER, LIST) \
ll_data__ (ll_head (LIST), STRUCT, MEMBER, LIST)
+#define ll_tail__(STRUCT, MEMBER, LIST) \
+ ll_data__ (ll_tail (LIST), STRUCT, MEMBER, LIST)
#define ll_next__(DATA, STRUCT, MEMBER, LIST) \
ll_data__ (ll_next (&DATA->MEMBER), STRUCT, MEMBER, LIST)
-#define ll_remove__(DATA, STRUCT, MEMBER, LIST) \
- (ll_next (&DATA->MEMBER) == ll_null (LIST) \
- ? ll_remove (&DATA->MEMBER), NULL \
- : ll_data (ll_remove (&DATA->MEMBER), STRUCT, MEMBER))
+#define ll_prev__(DATA, STRUCT, MEMBER, LIST) \
+ ll_data__ (ll_prev (&DATA->MEMBER), STRUCT, MEMBER, LIST)
/* Inline functions. */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pspp-cvs] pspp/src/libpspp ChangeLog ll.h,
Ben Pfaff <=