summaryrefslogtreecommitdiff
path: root/h/counters.h
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2015-05-01 16:24:15 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2015-05-01 16:24:15 +0200
commita30ba67504ffd12c4db499adbb5ce47a7d1f6036 (patch)
tree9ae1a7e3849dda6bbb5c578232f6f2fa5b2e7e7e /h/counters.h
parent89e99e8a827859729729dfc92d74be4a8f96f1a4 (diff)
parent094535c010320967639e8e86f974d878e80baa72 (diff)
New release 1.7.0
Diffstat (limited to 'h/counters.h')
-rw-r--r--h/counters.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/h/counters.h b/h/counters.h
index e3944d9..0fbb11a 100644
--- a/h/counters.h
+++ b/h/counters.h
@@ -54,6 +54,17 @@
/* After init or increment, expression is TRUE if counter is done */
#define DC_DONE(nn) \
(nn##_e >= nn##_di)
+
+/* Typical use:
+
+ DCOUNT(cc, 15, 3, -1, -1, 2);
+
+ DC_INIT(cc);
+ while(!DC_DONE(cc)) {
+
+ DC_INC(cc);
+ }
+ */
/* (Do we need a version of the above that tracks the actual input coords ?) */
/* ------------------------------------------------------- */
@@ -137,6 +148,9 @@
/* Declare the counter name nn, combinations out of total */
/* mxdi should be set to maximum combinations */
+/* e.g. if there are 8 objects, and we want all combinations */
+/* of 4 out of the 8, we would use: COMBO(nn, 4, 4, 8) */
+
#define COMBO(nn, mxdi, comb, total) \
int nn[mxdi+2]; /* counter value */ \
int nn##_cmb = (comb); /* number of combinations */ \