summaryrefslogtreecommitdiff
path: root/h/counters.h
diff options
context:
space:
mode:
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 */ \