fixed instance loading forget to append basepath.. other path fixes (windows)
[csRadar.git] / csrComb.h
index 492acdf8c4612015b3312ea1b2bdf348268ff8eb..92a1e0d2fe0bf1c47428b53cd624ea4da824c361 100644 (file)
--- a/csrComb.h
+++ b/csrComb.h
@@ -1,5 +1,38 @@
-#ifndef CSR_COMB_H
-#define CSR_COMB_H
+// Copyright (C) 2021 Harry Godden (hgn)
+
+// API
+//=======================================================================================================================
+
+// Algorithm 1: Generate non-repeating combinations of size M in set of N
+// Usage:
+//   int p[3];
+//   hgn_comb_init( 3, p );
+//   
+//   do
+//   {
+//      something with p[0], p[1], p[2]
+//   }
+//   while( hgn_comb( 3, 5, p ) );
+//
+//   Output of p each iteration:
+//     0 1 2
+//     0 1 3
+//     0 1 4
+//     0 2 3
+//     0 2 4
+//     0 3 4
+//     1 2 3
+//     1 2 4
+//     1 3 4
+//     2 3 4
+
+void csr_comb_init( int const M, int p[] );
+int csr_comb( int M, int N, int p[] );
+
+// Implementation
+//=======================================================================================================================
+
+#ifdef CSR_EXECUTABLE
 
 void csr_comb_init( int const M, int p[] )
 {
 
 void csr_comb_init( int const M, int p[] )
 {
@@ -26,14 +59,4 @@ int csr_comb( int M, int N, int p[] )
        return 0;
 }
 
        return 0;
 }
 
-void csr_comb_print( int M, int p[] )
-{
-       for( int i = 0; i < M; i ++ )
-       {
-               printf( "%d ", p[i] );
-       }
-       
-       printf( "\n" );
-}
-
 #endif
 #endif