diff include/mb_tools.h @ 250:bd8ea44b421e

Fix bug and finish unit test for collision testing in event.c. - mock for cairo, rdman, coord, and shape should be refactoried to a module.
author Thinker K.F. Li <thinker@branda.to>
date Sun, 04 Jan 2009 11:42:32 +0800
parents 65cabbdd5284
children 44b8223f307c
line wrap: on
line diff
--- a/include/mb_tools.h	Wed Dec 31 23:57:12 2008 +0800
+++ b/include/mb_tools.h	Sun Jan 04 11:42:32 2009 +0800
@@ -61,6 +61,10 @@
 	    }						\
 	}						\
     } while(0)
+#define STAILQ_FOR_EACH(q, type, field, elm)	\
+    for((elm) = (q).head;			\
+	(elm) != NULL;				\
+	(elm) = (elm)->field)
 
 /*! \defgroup darray Dynamic Array
  *
@@ -134,4 +138,7 @@
 #define MEM2OBJ(var, type, mem) ((type *)((void *)var - OFFSET(type, mem)))
 #define OFF2TYPE(obj, off, type) (*(type *)((void *)(obj) + (off)))
 
+#define MAX(a, b) ((a) > (b)? (a): (b))
+#define MIN(a, b) ((a) < (b)? (a): (b))
+
 #endif /* __TOOLS_H_ */