[arrayfire] 23/84: Cleaning up examples

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Mon Jan 4 23:22:18 UTC 2016


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to branch master
in repository arrayfire.

commit cbe4af5b9897af38cb64507e94c4a27353b4d28f
Author: Pavan Yalamanchili <pavan at arrayfire.com>
Date:   Fri Dec 11 17:06:01 2015 -0500

    Cleaning up examples
    
    - Replaced getchar within ifdefs with a new macro
    - Cleaned up unneeded "console" options from a few examples
    - Removed getchar option for windows.
      - This was already available via cmake
---
 examples/benchmarks/blas.cpp                       | 12 +++-------
 examples/benchmarks/fft.cpp                        |  8 +------
 examples/benchmarks/pi.cpp                         |  8 +------
 examples/financial/black_scholes_options.cpp       |  8 +------
 examples/financial/heston_model.cpp                |  2 ++
 examples/financial/monte_carlo_options.cpp         |  1 +
 examples/getting_started/convolve.cpp              |  8 +------
 examples/getting_started/integer.cpp               |  8 +------
 examples/getting_started/rainfall.cpp              |  8 +------
 examples/getting_started/vectorize.cpp             |  9 ++------
 examples/graphics/conway.cpp                       |  9 --------
 examples/graphics/conway_pretty.cpp                |  8 -------
 examples/graphics/fractal.cpp                      |  1 +
 examples/graphics/histogram.cpp                    |  9 --------
 examples/graphics/plot2d.cpp                       |  9 --------
 examples/graphics/plot3.cpp                        |  8 -------
 examples/graphics/surface.cpp                      |  8 -------
 examples/helloworld/helloworld.cpp                 |  9 ++------
 .../image_processing/adaptive_thresholding.cpp     | 10 +--------
 examples/image_processing/binary_thresholding.cpp  |  8 -------
 examples/image_processing/brain_segmentation.cpp   |  2 ++
 examples/image_processing/edge.cpp                 |  5 ++---
 examples/image_processing/filters.cpp              | 26 ++++++++--------------
 examples/image_processing/image_demo.cpp           |  5 ++---
 examples/image_processing/image_editing.cpp        |  8 -------
 examples/image_processing/morphing.cpp             |  5 ++---
 examples/image_processing/optical_flow.cpp         |  8 +------
 examples/image_processing/pyramids.cpp             |  5 ++---
 examples/lin_algebra/cholesky.cpp                  |  8 +------
 examples/lin_algebra/lu.cpp                        |  8 +------
 examples/lin_algebra/qr.cpp                        |  8 +------
 examples/lin_algebra/svd.cpp                       |  8 +------
 examples/machine_learning/bagging.cpp              |  2 ++
 examples/machine_learning/deep_belief_net.cpp      |  2 ++
 examples/machine_learning/kmeans.cpp               |  3 +++
 examples/machine_learning/knn.cpp                  |  2 ++
 examples/machine_learning/logistic_regression.cpp  |  2 ++
 examples/machine_learning/naive_bayes.cpp          |  2 ++
 examples/machine_learning/neural_network.cpp       |  2 ++
 examples/machine_learning/perceptron.cpp           |  2 ++
 examples/machine_learning/rbm.cpp                  |  2 ++
 examples/machine_learning/softmax_regression.cpp   |  2 ++
 examples/pde/swe.cpp                               |  2 ++
 examples/unified/basic.cpp                         |  9 +-------
 include/af/macros.h                                |  1 -
 45 files changed, 66 insertions(+), 214 deletions(-)

diff --git a/examples/benchmarks/blas.cpp b/examples/benchmarks/blas.cpp
index 2a6c93d..109aa1f 100644
--- a/examples/benchmarks/blas.cpp
+++ b/examples/benchmarks/blas.cpp
@@ -8,6 +8,7 @@
  ********************************************************/
 
 #include <arrayfire.h>
+#include <af/macros.h>
 #include <stdio.h>
 #include <math.h>
 #include <cstdlib>
@@ -48,15 +49,8 @@ int main(int argc, char ** argv)
         throw;
     }
 
-    if (argc == 2 && argv[1][0] == '-')
-        printf(" ### peak %g GFLOPS\n", peak);
 
-    #ifdef WIN32 // pause in Windows
-    if (!(argc == 2 && argv[1][0] == '-')) {
-        printf("hit [enter]...");
-        fflush(stdout);
-        getchar();
-    }
-    #endif
+    printf(" ### peak %g GFLOPS\n", peak);
+
     return 0;
 }
diff --git a/examples/benchmarks/fft.cpp b/examples/benchmarks/fft.cpp
index 8063422..2042411 100644
--- a/examples/benchmarks/fft.cpp
+++ b/examples/benchmarks/fft.cpp
@@ -8,6 +8,7 @@
  ********************************************************/
 
 #include <arrayfire.h>
+#include <af/macros.h>
 #include <stdio.h>
 #include <math.h>
 #include <cstdlib>
@@ -45,12 +46,5 @@ int main(int argc, char ** argv)
         fprintf(stderr, "%s\n", e.what());
     }
 
-    #ifdef WIN32 // pause in Windows
-    if (!(argc == 2 && argv[1][0] == '-')) {
-        printf("hit [enter]...");
-        fflush(stdout);
-        getchar();
-    }
-    #endif
     return 0;
 }
diff --git a/examples/benchmarks/pi.cpp b/examples/benchmarks/pi.cpp
index 0a48f53..69384f7 100644
--- a/examples/benchmarks/pi.cpp
+++ b/examples/benchmarks/pi.cpp
@@ -19,6 +19,7 @@
 #include <math.h>
 #include <cstdlib>
 #include <arrayfire.h>
+#include <af/macros.h>
 using namespace af;
 
 // generate millions of random samples
@@ -66,12 +67,5 @@ int main(int argc, char ** argv)
         throw;
     }
 
-    #ifdef WIN32 // pause in Windows
-    if (!(argc == 2 && argv[1][0] == '-')) {
-        printf("hit [enter]...");
-        fflush(stdout);
-        getchar();
-    }
-    #endif
     return 0;
 }
diff --git a/examples/financial/black_scholes_options.cpp b/examples/financial/black_scholes_options.cpp
index 6ef98d3..a1f1b26 100644
--- a/examples/financial/black_scholes_options.cpp
+++ b/examples/financial/black_scholes_options.cpp
@@ -11,6 +11,7 @@
 #include <stdio.h>
 #include <math.h>
 #include <arrayfire.h>
+#include <af/macros.h>
 #include <cstdlib>
 
 #include "input.h"
@@ -112,12 +113,5 @@ int main(int argc, char **argv)
         throw;
     }
 
-    #ifdef WIN32 // pause in Windows
-    if (!(argc == 2 && argv[1][0] =='-')) {
-        printf("hit [enter]...");
-        fflush(stdout);
-        getchar();
-    }
-    #endif
     return 0;
 }
diff --git a/examples/financial/heston_model.cpp b/examples/financial/heston_model.cpp
index 581f899..afa07b2 100644
--- a/examples/financial/heston_model.cpp
+++ b/examples/financial/heston_model.cpp
@@ -32,6 +32,7 @@
 #include <stdio.h>
 #include <iostream>
 #include <arrayfire.h>
+#include <af/macros.h>
 
 using namespace std;
 using namespace af;
@@ -109,6 +110,7 @@ int main()
         af_print(C_CPU);
         return 0;
     } catch (af::exception& e) {
+
         fprintf(stderr, "%s\n", e.what());
         return 1;
     }
diff --git a/examples/financial/monte_carlo_options.cpp b/examples/financial/monte_carlo_options.cpp
index 8f733ce..e8c1f23 100644
--- a/examples/financial/monte_carlo_options.cpp
+++ b/examples/financial/monte_carlo_options.cpp
@@ -12,6 +12,7 @@
 #include <math.h>
 #include <arrayfire.h>
 #include <af/util.h>
+#include <af/macros.h>
 
 using namespace af;
 template<class ty> dtype get_dtype();
diff --git a/examples/getting_started/convolve.cpp b/examples/getting_started/convolve.cpp
index 50002f2..0385c7a 100644
--- a/examples/getting_started/convolve.cpp
+++ b/examples/getting_started/convolve.cpp
@@ -10,6 +10,7 @@
 #include <stdio.h>
 #include <cstdlib>
 #include <arrayfire.h>
+#include <af/macros.h>
 using namespace af;
 
 // use static variables at file scope so timeit() wrapper functions
@@ -55,12 +56,5 @@ int main(int argc, char **argv)
         fprintf(stderr, "%s\n", e.what());
     }
 
-#ifdef WIN32 // pause in Windows
-    if (!(argc == 2 && argv[1][0] == '-')) {
-        printf("hit [enter]...");
-        fflush(stdout);
-        getchar();
-    }
-#endif
     return 0;
 }
diff --git a/examples/getting_started/integer.cpp b/examples/getting_started/integer.cpp
index 07d1466..ab13591 100644
--- a/examples/getting_started/integer.cpp
+++ b/examples/getting_started/integer.cpp
@@ -10,6 +10,7 @@
 #include <stdio.h>
 #include <arrayfire.h>
 #include <af/util.h>
+#include <af/macros.h>
 #include <cstdlib>
 
 using namespace af;
@@ -88,12 +89,5 @@ int main(int argc, char ** argv)
         throw;
     }
 
-    #ifdef WIN32 // pause in Windows
-    if (!(argc == 2 && argv[1][0] == '-')) {
-        printf("hit [enter]...");
-        fflush(stdout);
-        getchar();
-    }
-    #endif
     return 0;
 }
diff --git a/examples/getting_started/rainfall.cpp b/examples/getting_started/rainfall.cpp
index c334b27..3c4166e 100644
--- a/examples/getting_started/rainfall.cpp
+++ b/examples/getting_started/rainfall.cpp
@@ -23,6 +23,7 @@
 
 #include <arrayfire.h>
 #include <af/util.h>
+#include <af/macros.h>
 #include <stdio.h>
 #include <cstdlib>
 using namespace af;
@@ -70,12 +71,5 @@ int main(int argc, char **argv)
         throw;
     }
 
-    #ifdef WIN32 // pause in Windows
-    if (!(argc == 2 && argv[1][0] == '-')) {
-        std::cout << "hit [enter]...";
-        fflush(stdout);
-        getchar();
-    }
-    #endif
     return 0;
 }
diff --git a/examples/getting_started/vectorize.cpp b/examples/getting_started/vectorize.cpp
index 0d48223..c640d1f 100644
--- a/examples/getting_started/vectorize.cpp
+++ b/examples/getting_started/vectorize.cpp
@@ -10,6 +10,7 @@
 #include <stdio.h>
 #include <arrayfire.h>
 #include <af/util.h>
+#include <af/macros.h>
 
 using namespace af;
 
@@ -217,11 +218,5 @@ int main(int argc, char **argv)
         throw;
     }
 
-    #ifdef WIN32 // pause in Windows
-    if (!(argc == 2 && argv[1][0] == '-')) {
-        printf("hit [enter]...");
-        fflush(stdout);
-        getchar();
-    }
-    #endif
+    return 0;
 }
diff --git a/examples/graphics/conway.cpp b/examples/graphics/conway.cpp
index f481156..c3e4696 100644
--- a/examples/graphics/conway.cpp
+++ b/examples/graphics/conway.cpp
@@ -67,14 +67,5 @@ int main(int argc, char *argv[])
         fprintf(stderr, "%s\n", e.what());
         throw;
     }
-
-    #ifdef WIN32 // pause in Windows
-    if (!(argc == 2 && argv[1][0] == '-')) {
-        printf("hit [enter]...");
-        fflush(stdout);
-        getchar();
-    }
-    #endif
     return 0;
 }
-
diff --git a/examples/graphics/conway_pretty.cpp b/examples/graphics/conway_pretty.cpp
index 6a22189..58e73a6 100644
--- a/examples/graphics/conway_pretty.cpp
+++ b/examples/graphics/conway_pretty.cpp
@@ -91,13 +91,5 @@ int main(int argc, char *argv[])
         fprintf(stderr, "%s\n", e.what());
         throw;
     }
-
-    #ifdef WIN32 // pause in Windows
-    if (!(argc == 2 && argv[1][0] == '-')) {
-        printf("hit [enter]...");
-        fflush(stdout);
-        getchar();
-    }
-    #endif
     return 0;
 }
diff --git a/examples/graphics/fractal.cpp b/examples/graphics/fractal.cpp
index 9ac5a86..f78d031 100644
--- a/examples/graphics/fractal.cpp
+++ b/examples/graphics/fractal.cpp
@@ -10,6 +10,7 @@
 #include <stdio.h>
 #include <iostream>
 #include <arrayfire.h>
+#include <af/macros.h>
 #include <math.h>
 #include <cstdlib>
 
diff --git a/examples/graphics/histogram.cpp b/examples/graphics/histogram.cpp
index 9c7b88f..ddf91b2 100644
--- a/examples/graphics/histogram.cpp
+++ b/examples/graphics/histogram.cpp
@@ -34,14 +34,5 @@ int main(int argc, char *argv[])
         fprintf(stderr, "%s\n", e.what());
         throw;
     }
-
-#ifdef WIN32 // pause in Windows
-    if (!(argc == 2 && argv[1][0] == '-')) {
-        printf("hit [enter]...");
-        fflush(stdout);
-        getchar();
-    }
-#endif
     return 0;
 }
-
diff --git a/examples/graphics/plot2d.cpp b/examples/graphics/plot2d.cpp
index 7e28d34..4f68b92 100644
--- a/examples/graphics/plot2d.cpp
+++ b/examples/graphics/plot2d.cpp
@@ -47,14 +47,5 @@ int main(int argc, char *argv[])
         fprintf(stderr, "%s\n", e.what());
         throw;
     }
-
-    #ifdef WIN32 // pause in Windows
-    if (!(argc == 2 && argv[1][0] == '-')) {
-        printf("hit [enter]...");
-        fflush(stdout);
-        getchar();
-    }
-    #endif
     return 0;
 }
-
diff --git a/examples/graphics/plot3.cpp b/examples/graphics/plot3.cpp
index 93b8b8d..3893f01 100644
--- a/examples/graphics/plot3.cpp
+++ b/examples/graphics/plot3.cpp
@@ -44,13 +44,5 @@ int main(int argc, char *argv[])
         fprintf(stderr, "%s\n", e.what());
         throw;
     }
-
-    #ifdef WIN32 // pause in Windows
-    if (!(argc == 2 && argv[1][0] == '-')) {
-        printf("hit [enter]...");
-        fflush(stdout);
-        getchar();
-    }
-    #endif
     return 0;
 }
diff --git a/examples/graphics/surface.cpp b/examples/graphics/surface.cpp
index d59c66c..95b87bc 100644
--- a/examples/graphics/surface.cpp
+++ b/examples/graphics/surface.cpp
@@ -40,13 +40,5 @@ int main(int argc, char *argv[])
         fprintf(stderr, "%s\n", e.what());
         throw;
     }
-
-    #ifdef WIN32 // pause in Windows
-    if (!(argc == 2 && argv[1][0] == '-')) {
-        printf("hit [enter]...");
-        fflush(stdout);
-        getchar();
-    }
-    #endif
     return 0;
 }
diff --git a/examples/helloworld/helloworld.cpp b/examples/helloworld/helloworld.cpp
index 46a1fc4..cad2e82 100644
--- a/examples/helloworld/helloworld.cpp
+++ b/examples/helloworld/helloworld.cpp
@@ -8,6 +8,7 @@
  ********************************************************/
 
 #include <arrayfire.h>
+#include <af/macros.h>
 #include <cstdio>
 #include <cstdlib>
 
@@ -60,16 +61,10 @@ int main(int argc, char *argv[])
         af_print(inds);
 
     } catch (af::exception& e) {
+
         fprintf(stderr, "%s\n", e.what());
         throw;
     }
 
-    #ifdef WIN32 // pause in Windows
-    if (!(argc == 2 && argv[1][0] == '-')) {
-        printf("hit [enter]...");
-        fflush(stdout);
-        getchar();
-    }
-    #endif
     return 0;
 }
diff --git a/examples/image_processing/adaptive_thresholding.cpp b/examples/image_processing/adaptive_thresholding.cpp
index 0260974..5ce34e7 100644
--- a/examples/image_processing/adaptive_thresholding.cpp
+++ b/examples/image_processing/adaptive_thresholding.cpp
@@ -105,13 +105,5 @@ int main(int argc, char **argv)
         fprintf(stderr, "%s\n", e.what());
         throw;
     }
-
-#ifdef WIN32 // pause in Windows
-    if (!(argc == 2 && argv[1][0] == '-')) {
-        printf("hit [enter]...");
-        fflush(stdout);
-        getchar();
-    }
-#endif
     return 0;
-}
\ No newline at end of file
+}
diff --git a/examples/image_processing/binary_thresholding.cpp b/examples/image_processing/binary_thresholding.cpp
index 3e8c9ee..319e6ea 100644
--- a/examples/image_processing/binary_thresholding.cpp
+++ b/examples/image_processing/binary_thresholding.cpp
@@ -96,13 +96,5 @@ int main(int argc, char **argv)
         fprintf(stderr, "%s\n", e.what());
         throw;
     }
-
-#ifdef WIN32 // pause in Windows
-    if (!(argc == 2 && argv[1][0] == '-')) {
-        printf("hit [enter]...");
-        fflush(stdout);
-        getchar();
-    }
-#endif
     return 0;
 }
diff --git a/examples/image_processing/brain_segmentation.cpp b/examples/image_processing/brain_segmentation.cpp
index 92c29bd..7f18a7c 100644
--- a/examples/image_processing/brain_segmentation.cpp
+++ b/examples/image_processing/brain_segmentation.cpp
@@ -11,6 +11,7 @@
 #include <stdio.h>
 #include <math.h>
 #include <arrayfire.h>
+#include <af/macros.h>
 #include "../common/progress.h"
 
 using namespace af;
@@ -163,5 +164,6 @@ int main(int argc, char* argv[])
     } catch (af::exception& e) {
         fprintf(stderr, "%s\n", e.what());
     }
+
     return 0;
 }
diff --git a/examples/image_processing/edge.cpp b/examples/image_processing/edge.cpp
index 1c3a35b..bef7bc1 100644
--- a/examples/image_processing/edge.cpp
+++ b/examples/image_processing/edge.cpp
@@ -69,7 +69,7 @@ array edge(const array &in, int method = 0)
     return normalize(mag);
 }
 
-void edge(bool console)
+void edge()
 {
     af::Window myWindow("Edge Dectectors");
     af::Window myWindow2(512, 512, "Histogram");
@@ -99,14 +99,13 @@ void edge(bool console)
 int main(int argc, char* argv[])
 {
     int device = argc > 1 ? atoi(argv[1]) : 0;
-    bool console = argc > 2 ? argv[2][0] == '-' : false;
 
     try {
         af::setDevice(device);
         af::info();
 
         printf("** ArrayFire Edge Detection Demo **\n");
-        edge(console);
+        edge();
 
     } catch (af::exception &e) {
         fprintf(stderr, "%s\n", e.what());
diff --git a/examples/image_processing/filters.cpp b/examples/image_processing/filters.cpp
index 2971ee9..8b75acf 100644
--- a/examples/image_processing/filters.cpp
+++ b/examples/image_processing/filters.cpp
@@ -214,21 +214,21 @@ int main(int argc, char **argv)
         af::setDevice(device);
         af::info();
 
-        array lena = loadImage(ASSETS_DIR "/examples/images/vegetable-woman.jpg", true);
+        array img = loadImage(ASSETS_DIR "/examples/images/vegetable-woman.jpg", true);
 
         array prew_mag, prew_dir;
         array sob_mag, sob_dir;
-        array lena1ch = colorSpace(lena, AF_GRAY, AF_RGB);
-        prewitt(prew_mag, prew_dir, lena1ch);
-        sobelFilter(sob_mag, sob_dir, lena1ch);
-        array sprd = spread(lena, 3, 3);
-        array hrl = hurl(lena, 10, 1);
-        array pckng = pick(lena, 40, 2);
-        array difog = DifferenceOfGaussian(lena, 1, 2);
+        array img1ch = colorSpace(img, AF_GRAY, AF_RGB);
+        prewitt(prew_mag, prew_dir, img1ch);
+        sobelFilter(sob_mag, sob_dir, img1ch);
+        array sprd = spread(img, 3, 3);
+        array hrl = hurl(img, 10, 1);
+        array pckng = pick(img, 40, 2);
+        array difog = DifferenceOfGaussian(img, 1, 2);
         array bil = bilateral(hrl, 3.0f, 40.0f);
         array mf = medianfilter(hrl, 5, 5);
         array gb = gaussianblur(hrl, 3, 3, 0.8);
-        array emb = emboss(lena, 45, 20, 10);
+        array emb = emboss(img, 45, 20, 10);
 
         af::Window wnd("Image Filters Demo");
         std::cout << "Press ESC while the window is in focus to exit" << std::endl;
@@ -252,13 +252,5 @@ int main(int argc, char **argv)
         fprintf(stderr, "%s\n", e.what());
         throw;
     }
-
-#ifdef WIN32 // pause in Windows
-    if (!(argc == 2 && argv[1][0] == '-')) {
-        printf("hit [enter]...");
-        fflush(stdout);
-        getchar();
-    }
-#endif
     return 0;
 }
diff --git a/examples/image_processing/image_demo.cpp b/examples/image_processing/image_demo.cpp
index 01b13a9..477594e 100644
--- a/examples/image_processing/image_demo.cpp
+++ b/examples/image_processing/image_demo.cpp
@@ -38,7 +38,7 @@ static const float h_sobel[] = {
 };
 
 // Demonstrates various image manipulations.
-static void img_test_demo(bool console)
+static void img_test_demo()
 {
     af::Window wnd("Image Demo");
 
@@ -95,13 +95,12 @@ static void img_test_demo(bool console)
 int main(int argc, char** argv)
 {
     int device = argc > 1 ? atoi(argv[1]) : 0;
-    bool console = argc > 2 ? argv[2][0] == '-' : false;
 
     try {
         af::setDevice(device);
         af::info();
         printf("** ArrayFire Image Demo **\n\n");
-        img_test_demo(console);
+        img_test_demo();
 
     } catch (af::exception& e) {
         fprintf(stderr, "%s\n", e.what());
diff --git a/examples/image_processing/image_editing.cpp b/examples/image_processing/image_editing.cpp
index d765734..800f273 100644
--- a/examples/image_processing/image_editing.cpp
+++ b/examples/image_processing/image_editing.cpp
@@ -135,13 +135,5 @@ int main(int argc, char **argv)
         fprintf(stderr, "%s\n", e.what());
         throw;
     }
-
-#ifdef WIN32 // pause in Windows
-    if (!(argc == 2 && argv[1][0] == '-')) {
-        printf("hit [enter]...");
-        fflush(stdout);
-        getchar();
-    }
-#endif
     return 0;
 }
diff --git a/examples/image_processing/morphing.cpp b/examples/image_processing/morphing.cpp
index 31f1cf0..73eb45c 100644
--- a/examples/image_processing/morphing.cpp
+++ b/examples/image_processing/morphing.cpp
@@ -76,7 +76,7 @@ array blur(const array& img, const array mask = gaussianKernel(3,3))
 }
 
 // Demonstrates various image morphing manipulations.
-static void morphing_demo(bool console)
+static void morphing_demo()
 {
     af::Window wnd(1280, 720, "Morphological Operations");
     // load images
@@ -120,13 +120,12 @@ static void morphing_demo(bool console)
 int main(int argc, char** argv)
 {
     int device = argc > 1 ? atoi(argv[1]) : 0;
-    bool console = argc > 2 ? argv[2][0] == '-' : false;
 
     try {
         af::info();
         af::setDevice(device);
         printf("** ArrayFire Image Morphing Demo **\n\n");
-        morphing_demo(console);
+        morphing_demo();
 
     } catch (af::exception& e) {
         fprintf(stderr, "%s\n", e.what());
diff --git a/examples/image_processing/optical_flow.cpp b/examples/image_processing/optical_flow.cpp
index 5c4b60b..754b09f 100644
--- a/examples/image_processing/optical_flow.cpp
+++ b/examples/image_processing/optical_flow.cpp
@@ -12,6 +12,7 @@
 #include <math.h>
 #include <algorithm>
 #include <arrayfire.h>
+#include <af/macros.h>
 
 using namespace af;
 
@@ -121,12 +122,5 @@ int main(int argc, char* argv[])
         throw;
     }
 
-#ifdef WIN32 // pause in Windows
-    if (!console) {
-        printf("hit [enter]...");
-        fflush(stdout);
-        getchar();
-    }
-#endif
     return 0;
 }
diff --git a/examples/image_processing/pyramids.cpp b/examples/image_processing/pyramids.cpp
index 0f96732..18726d7 100644
--- a/examples/image_processing/pyramids.cpp
+++ b/examples/image_processing/pyramids.cpp
@@ -44,7 +44,7 @@ array pyramid(const array& img, const int level, const bool sampling)
     return pyr;
 }
 
-void pyramids_demo(bool console)
+void pyramids_demo()
 {
     af::Window wnd_rgb("Image Pyramids - RGB Images");
     af::Window wnd_gray("Image Pyramids - Grayscale Images");
@@ -88,13 +88,12 @@ void pyramids_demo(bool console)
 int main(int argc, char** argv)
 {
     int device = argc > 1 ? atoi(argv[1]) : 0;
-    bool console = argc > 2 ? argv[2][0] == '-' : false;
 
     try {
         af::setDevice(device);
         af::info();
         printf("** ArrayFire Image Pyramids Demo **\n\n");
-        pyramids_demo(console);
+        pyramids_demo();
 
     } catch (af::exception& e) {
         fprintf(stderr, "%s\n", e.what());
diff --git a/examples/lin_algebra/cholesky.cpp b/examples/lin_algebra/cholesky.cpp
index 999597c..f3dd696 100644
--- a/examples/lin_algebra/cholesky.cpp
+++ b/examples/lin_algebra/cholesky.cpp
@@ -8,6 +8,7 @@
  ********************************************************/
 
 #include <arrayfire.h>
+#include <af/macros.h>
 #include <cstdio>
 #include <cstdlib>
 
@@ -46,12 +47,5 @@ int main(int argc, char *argv[])
         throw;
     }
 
-    #ifdef WIN32 // pause in Windows
-    if (!(argc == 2 && argv[1][0] == '-')) {
-        printf("hit [enter]...");
-        fflush(stdout);
-        getchar();
-    }
-    #endif
     return 0;
 }
diff --git a/examples/lin_algebra/lu.cpp b/examples/lin_algebra/lu.cpp
index 06cbeb1..1b0e3a5 100644
--- a/examples/lin_algebra/lu.cpp
+++ b/examples/lin_algebra/lu.cpp
@@ -8,6 +8,7 @@
  ********************************************************/
 
 #include <arrayfire.h>
+#include <af/macros.h>
 #include <cstdio>
 #include <cstdlib>
 
@@ -44,12 +45,5 @@ int main(int argc, char *argv[])
         throw;
     }
 
-    #ifdef WIN32 // pause in Windows
-    if (!(argc == 2 && argv[1][0] == '-')) {
-        printf("hit [enter]...");
-        fflush(stdout);
-        getchar();
-    }
-    #endif
     return 0;
 }
diff --git a/examples/lin_algebra/qr.cpp b/examples/lin_algebra/qr.cpp
index 6f0fe8e..8f9bc40 100644
--- a/examples/lin_algebra/qr.cpp
+++ b/examples/lin_algebra/qr.cpp
@@ -8,6 +8,7 @@
  ********************************************************/
 
 #include <arrayfire.h>
+#include <af/macros.h>
 #include <cstdio>
 #include <cstdlib>
 
@@ -47,12 +48,5 @@ int main(int argc, char *argv[])
         throw;
     }
 
-    #ifdef WIN32 // pause in Windows
-    if (!(argc == 2 && argv[1][0] == '-')) {
-        printf("hit [enter]...");
-        fflush(stdout);
-        getchar();
-    }
-    #endif
     return 0;
 }
diff --git a/examples/lin_algebra/svd.cpp b/examples/lin_algebra/svd.cpp
index 964bee7..bab8dad 100644
--- a/examples/lin_algebra/svd.cpp
+++ b/examples/lin_algebra/svd.cpp
@@ -8,6 +8,7 @@
  ********************************************************/
 
 #include <arrayfire.h>
+#include <af/macros.h>
 #include <cstdio>
 #include <cstdlib>
 
@@ -44,12 +45,5 @@ int main(int argc, char* argv[])
         throw;
     }
 
-#ifdef WIN32  // pause in Windows
-    if (!(argc == 2 && argv[1][0] == '-')) {
-        printf("hit [enter]...");
-        fflush(stdout);
-        getchar();
-    }
-#endif
     return 0;
 }
diff --git a/examples/machine_learning/bagging.cpp b/examples/machine_learning/bagging.cpp
index 862ffa2..3b2cfba 100644
--- a/examples/machine_learning/bagging.cpp
+++ b/examples/machine_learning/bagging.cpp
@@ -8,6 +8,7 @@
  ********************************************************/
 
 #include <arrayfire.h>
+#include <af/macros.h>
 #include <stdio.h>
 #include <vector>
 #include <string>
@@ -147,4 +148,5 @@ int main(int argc, char** argv)
         std::cerr << ae.what() << std::endl;
     }
 
+    return 0;
 }
diff --git a/examples/machine_learning/deep_belief_net.cpp b/examples/machine_learning/deep_belief_net.cpp
index 4dfac9e..e8e0b5b 100644
--- a/examples/machine_learning/deep_belief_net.cpp
+++ b/examples/machine_learning/deep_belief_net.cpp
@@ -8,6 +8,7 @@
  ********************************************************/
 
 #include <arrayfire.h>
+#include <af/macros.h>
 #include <stdio.h>
 #include <vector>
 #include <string>
@@ -368,4 +369,5 @@ int main(int argc, char** argv)
         std::cerr << ae.what() << std::endl;
     }
 
+    return 0;
 }
diff --git a/examples/machine_learning/kmeans.cpp b/examples/machine_learning/kmeans.cpp
index c13b5e6..0e251b3 100644
--- a/examples/machine_learning/kmeans.cpp
+++ b/examples/machine_learning/kmeans.cpp
@@ -10,6 +10,7 @@
 #include <iostream>
 #include <stdio.h>
 #include <arrayfire.h>
+#include <af/macros.h>
 #include <af/util.h>
 #include <cstdlib>
 
@@ -175,4 +176,6 @@ int main(int argc, char** argv)
     } catch (af::exception &ae) {
         std::cerr << ae.what() << std::endl;
     }
+
+    return 0;
 }
diff --git a/examples/machine_learning/knn.cpp b/examples/machine_learning/knn.cpp
index bd86ae0..8d8d4de 100644
--- a/examples/machine_learning/knn.cpp
+++ b/examples/machine_learning/knn.cpp
@@ -12,6 +12,7 @@
 #include <vector>
 #include <string>
 #include <af/util.h>
+#include <af/macros.h>
 #include <math.h>
 #include "mnist_common.h"
 
@@ -113,4 +114,5 @@ int main(int argc, char** argv)
         std::cerr << ae.what() << std::endl;
     }
 
+    return 0;
 }
diff --git a/examples/machine_learning/logistic_regression.cpp b/examples/machine_learning/logistic_regression.cpp
index 58281f0..c02fcf8 100644
--- a/examples/machine_learning/logistic_regression.cpp
+++ b/examples/machine_learning/logistic_regression.cpp
@@ -8,6 +8,7 @@
  ********************************************************/
 
 #include <arrayfire.h>
+#include <af/macros.h>
 #include <stdio.h>
 #include <vector>
 #include <string>
@@ -197,4 +198,5 @@ int main(int argc, char** argv)
         std::cerr << ae.what() << std::endl;
     }
 
+    return 0;
 }
diff --git a/examples/machine_learning/naive_bayes.cpp b/examples/machine_learning/naive_bayes.cpp
index 1703205..daf76d7 100644
--- a/examples/machine_learning/naive_bayes.cpp
+++ b/examples/machine_learning/naive_bayes.cpp
@@ -12,6 +12,7 @@
 #include <vector>
 #include <string>
 #include <af/util.h>
+#include <af/macros.h>
 #include <math.h>
 #include "mnist_common.h"
 
@@ -163,4 +164,5 @@ int main(int argc, char** argv)
         std::cerr << ae.what() << std::endl;
     }
 
+    return 0;
 }
diff --git a/examples/machine_learning/neural_network.cpp b/examples/machine_learning/neural_network.cpp
index b249fd0..9188fca 100644
--- a/examples/machine_learning/neural_network.cpp
+++ b/examples/machine_learning/neural_network.cpp
@@ -12,6 +12,7 @@
 #include <vector>
 #include <string>
 #include <af/util.h>
+#include <af/macros.h>
 #include <math.h>
 #include "mnist_common.h"
 
@@ -278,4 +279,5 @@ int main(int argc, char** argv)
         std::cerr << ae.what() << std::endl;
     }
 
+    return 0;
 }
diff --git a/examples/machine_learning/perceptron.cpp b/examples/machine_learning/perceptron.cpp
index 7b5a579..c12c8a9 100644
--- a/examples/machine_learning/perceptron.cpp
+++ b/examples/machine_learning/perceptron.cpp
@@ -12,6 +12,7 @@
 #include <vector>
 #include <string>
 #include <af/util.h>
+#include <af/macros.h>
 #include <math.h>
 #include "mnist_common.h"
 
@@ -143,4 +144,5 @@ int main(int argc, char** argv)
         std::cerr << ae.what() << std::endl;
     }
 
+    return 0;
 }
diff --git a/examples/machine_learning/rbm.cpp b/examples/machine_learning/rbm.cpp
index d6b68f3..14e9fec 100644
--- a/examples/machine_learning/rbm.cpp
+++ b/examples/machine_learning/rbm.cpp
@@ -11,6 +11,7 @@
 #include <stdio.h>
 #include <vector>
 #include <string>
+#include <af/macros.h>
 #include <af/util.h>
 #include <math.h>
 #include "mnist_common.h"
@@ -228,4 +229,5 @@ int main(int argc, char** argv)
         std::cerr << ae.what() << std::endl;
     }
 
+    return 0;
 }
diff --git a/examples/machine_learning/softmax_regression.cpp b/examples/machine_learning/softmax_regression.cpp
index 45d253c..5b523d9 100644
--- a/examples/machine_learning/softmax_regression.cpp
+++ b/examples/machine_learning/softmax_regression.cpp
@@ -8,6 +8,7 @@
  ********************************************************/
 
 #include <arrayfire.h>
+#include <af/macros.h>
 #include <stdio.h>
 #include <vector>
 #include <string>
@@ -204,4 +205,5 @@ int main(int argc, char** argv)
         std::cerr << ae.what() << std::endl;
     }
 
+    return 0;
 }
diff --git a/examples/pde/swe.cpp b/examples/pde/swe.cpp
index 84ce1ff..a7b9d28 100644
--- a/examples/pde/swe.cpp
+++ b/examples/pde/swe.cpp
@@ -3,6 +3,7 @@
 #include <string.h>
 #include <math.h>
 #include <arrayfire.h>
+#include <af/macros.h>
 #include "../common/progress.h"
 
 using namespace af;
@@ -82,5 +83,6 @@ int main(int argc, char* argv[])
         fprintf(stderr, "%s\n", e.what());
         throw;
     }
+
     return 0;
 }
diff --git a/examples/unified/basic.cpp b/examples/unified/basic.cpp
index 791466a..f48c076 100644
--- a/examples/unified/basic.cpp
+++ b/examples/unified/basic.cpp
@@ -8,6 +8,7 @@
  ********************************************************/
 
 #include <arrayfire.h>
+#include <af/macros.h>
 #include <cstdio>
 #include <vector>
 #include <algorithm>
@@ -67,13 +68,5 @@ int main(int argc, char *argv[])
         fprintf(stderr, "%s\n", e.what());
     }
 
-    #ifdef WIN32 // pause in Windows
-    if (!(argc == 2 && argv[1][0] == '-')) {
-        printf("hit [enter]...");
-        fflush(stdout);
-        getchar();
-    }
-    #endif
-
     return 0;
 }
diff --git a/include/af/macros.h b/include/af/macros.h
index 42a4219..62ff3e9 100644
--- a/include/af/macros.h
+++ b/include/af/macros.h
@@ -21,4 +21,3 @@
                  __FILE__, __LINE__, ##__VA_ARGS__);      \
         } while (0);
 #endif
-

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/arrayfire.git



More information about the debian-science-commits mailing list