changeset 41:5942b14d6c22 Octave-Forge-2003.02.22

Use of "T x[n]" where n is not constant is a g++ extension so replace it with OCTAVE_LOCAL_BUFFER(T,x,n), and other things to keep the picky MipsPRO CC compiler happy.
author pkienzle
date Thu, 20 Feb 2003 23:03:59 +0000
parents 2adef77b98d0
children 12ea35fe3385
files bwfill.cc bwlabel.cc cordflt2.cc
diffstat 3 files changed, 21 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/bwfill.cc
+++ b/bwfill.cc
@@ -12,10 +12,10 @@
 
 #include <octave/oct.h>
 
-#define   UP     (-1)
-#define   DN     (+1)
-#define   RT     (+ioM)
-#define   LF     (-ioM)
+#define   ptUP     (-1)
+#define   ptDN     (+1)
+#define   ptRT     (+ioM)
+#define   ptLF     (-ioM)
 
 /*
  * check if the point needs to be filled, if so
@@ -102,7 +102,7 @@
  *  so that we can be more efficient in the main loop
  */
    int           ioM=   imM+2;
-   unsigned char imo[ (imM+2) * (imN+2) ];
+   OCTAVE_LOCAL_BUFFER(unsigned char, imo, (imM+2) * (imN+2));
 
    for (int i=0; i<imM; i++) 
       for (int j=0; j<imN; j++)
@@ -116,7 +116,7 @@
 
 // This is obviously big enough for the point stack, but I'm
 // sure it can be smaller. 
-   int     ptstack[ ioM*imN ];
+   OCTAVE_LOCAL_BUFFER(int, ptstack, ioM*imN );
 
    int seedidx= npoints; 
    npoints= 0;
@@ -130,16 +130,16 @@
       npoints--;
       int pt= ptstack[ npoints ];
       
-      checkpoint( pt + LF, imo, ptstack, &npoints );
-      checkpoint( pt + RT, imo, ptstack, &npoints );
-      checkpoint( pt + UP, imo, ptstack, &npoints );
-      checkpoint( pt + DN, imo, ptstack, &npoints );
+      checkpoint( pt + ptLF, imo, ptstack, &npoints );
+      checkpoint( pt + ptRT, imo, ptstack, &npoints );
+      checkpoint( pt + ptUP, imo, ptstack, &npoints );
+      checkpoint( pt + ptDN, imo, ptstack, &npoints );
       
       if (nb==8) {
-         checkpoint( pt + LF + UP, imo, ptstack, &npoints );
-         checkpoint( pt + RT + UP, imo, ptstack, &npoints );
-         checkpoint( pt + LF + DN, imo, ptstack, &npoints );
-         checkpoint( pt + RT + DN, imo, ptstack, &npoints );
+         checkpoint( pt + ptLF + ptUP, imo, ptstack, &npoints );
+         checkpoint( pt + ptRT + ptUP, imo, ptstack, &npoints );
+         checkpoint( pt + ptLF + ptDN, imo, ptstack, &npoints );
+         checkpoint( pt + ptRT + ptDN, imo, ptstack, &npoints );
       }
    } // while ( npoints
 
@@ -180,6 +180,11 @@
 
 /*
  * $Log$
+ * Revision 1.3  2003/02/20 23:03:57  pkienzle
+ * Use of "T x[n]" where n is not constant is a g++ extension so replace it with
+ * OCTAVE_LOCAL_BUFFER(T,x,n), and other things to keep the picky MipsPRO CC
+ * compiler happy.
+ *
  * Revision 1.2  2002/11/02 10:39:36  pkienzle
  * gcc 3.2 wants \n\ for multi-line strings.
  *
--- a/bwlabel.cc
+++ b/bwlabel.cc
@@ -71,9 +71,9 @@
     int nobj;                               // number of objects found in image
     
     // other variables
-    int lset[nr * nc];   // label table/tree
     int ntable;                             // number of elements in the component table/tree
     
+    OCTAVE_LOCAL_BUFFER(int, lset, nr * nc);   // label table/tree
     ntable = 0;
     lset[0] = 0;
     
--- a/cordflt2.cc
+++ b/cordflt2.cc
@@ -168,7 +168,7 @@
 }
 
 // instantiate template functions
-template inline bool compare<double>(const double, const double);
+template bool compare<double>(const double, const double);
 template double selnth(double *, int, int);
 template Complex selnth(Complex *, int, int);
 template octave_value_list do_filtering<Matrix, double>(Matrix, int, boolMatrix, Matrix);