From: <ai...@us...> - 2010-10-23 17:28:15
|
Revision: 11271 http://plplot.svn.sourceforge.net/plplot/?rev=11271&view=rev Author: airwin Date: 2010-10-23 17:28:04 +0000 (Sat, 23 Oct 2010) Log Message: ----------- Add source files in the lib subtree to those who have been converted from old- to new-style comments. Modified Paths: -------------- trunk/lib/csa/csa.c trunk/lib/csa/csa.h trunk/lib/csa/csadll.h trunk/lib/csa/nan.h trunk/lib/csa/version.h trunk/lib/nistcd/cd.c trunk/lib/nistcd/cd.h trunk/lib/nistcd/cddll.h trunk/lib/nistcd/cdexpert.c trunk/lib/nistcd/cdmulti.c trunk/lib/nistcd/cdsimple.c trunk/lib/nistcd/cdtest.c trunk/lib/nistcd/cdtext.c trunk/lib/nistcd/color16.c trunk/lib/nistcd/defines.h trunk/lib/nn/delaunay.c trunk/lib/nn/delaunay.h trunk/lib/nn/hash.c trunk/lib/nn/hash.h trunk/lib/nn/istack.c trunk/lib/nn/istack.h trunk/lib/nn/lpi.c trunk/lib/nn/nan.h trunk/lib/nn/nn.h trunk/lib/nn/nnai.c trunk/lib/nn/nncommon.c trunk/lib/nn/nndll.h trunk/lib/nn/nnpi.c trunk/lib/nn/version.h trunk/lib/qsastime/bhunt_search_test.c trunk/lib/qsastime/deltaT-gen.c trunk/lib/qsastime/deltaT_test.c trunk/lib/qsastime/dspline.c trunk/lib/qsastime/dsplint.c trunk/lib/qsastime/qsastime.c trunk/lib/qsastime/qsastime.h trunk/lib/qsastime/qsastimeP.h.in trunk/lib/qsastime/qsastime_extra.c trunk/lib/qsastime/qsastime_extra.h trunk/lib/qsastime/qsastime_test.c trunk/lib/qsastime/qsastime_testlib.c trunk/lib/qsastime/qsastimedll.h trunk/lib/qsastime/tai-utc-gen.c trunk/scripts/style_source.sh Modified: trunk/lib/csa/csa.c =================================================================== --- trunk/lib/csa/csa.c 2010-10-23 17:25:22 UTC (rev 11270) +++ trunk/lib/csa/csa.c 2010-10-23 17:28:04 UTC (rev 11271) @@ -1,29 +1,29 @@ -/****************************************************************************** - * - * File: csa.c - * - * Created: 16/10/2002 - * - * Author: Pavel Sakov - * CSIRO Marine Research - * - * Purpose: 2D data approximation with bivariate C1 cubic spline. - * A set of library functions + standalone utility. - * - * Description: See J. Haber, F. Zeilfelder, O.Davydov and H.-P. Seidel, - * Smooth approximation and rendering of large scattered data - * sets, in ``Proceedings of IEEE Visualization 2001'' - * (Th.Ertl, K.Joy and A.Varshney, Eds.), pp.341-347, 571, - * IEEE Computer Society, 2001. - * http://www.uni-giessen.de/www-Numerische-Mathematik/ - * davydov/VIS2001.ps.gz - * http://www.math.uni-mannheim.de/~lsmath4/paper/ - * VIS2001.pdf.gz - * - * Revisions: 09/04/2003 PS: Modified points_read() to read from a - * file specified by name, not by handle. - * - *****************************************************************************/ +//***************************************************************************** +// +// File: csa.c +// +// Created: 16/10/2002 +// +// Author: Pavel Sakov +// CSIRO Marine Research +// +// Purpose: 2D data approximation with bivariate C1 cubic spline. +// A set of library functions + standalone utility. +// +// Description: See J. Haber, F. Zeilfelder, O.Davydov and H.-P. Seidel, +// Smooth approximation and rendering of large scattered data +// sets, in ``Proceedings of IEEE Visualization 2001'' +// (Th.Ertl, K.Joy and A.Varshney, Eds.), pp.341-347, 571, +// IEEE Computer Society, 2001. +// http://www.uni-giessen.de/www-Numerische-Mathematik/ +// davydov/VIS2001.ps.gz +// http://www.math.uni-mannheim.de/~lsmath4/paper/ +// VIS2001.pdf.gz +// +// Revisions: 09/04/2003 PS: Modified points_read() to read from a +// file specified by name, not by handle. +// +//*************************************************************************** #include <stdlib.h> #include <stdio.h> @@ -40,10 +40,10 @@ int csa_verbose = 0; -#define NPASTART 5 /* Number of Points Allocated at Start */ -#define SVD_NMAX 30 /* Maximal number of iterations in svd() */ +#define NPASTART 5 // Number of Points Allocated at Start +#define SVD_NMAX 30 // Maximal number of iterations in svd() -/* default algorithm parameters */ +// default algorithm parameters #define NPMIN_DEF 3 #define NPMAX_DEF 40 #define K_DEF 140 @@ -55,41 +55,41 @@ typedef struct { square * parent; - int index; /* index within parent square; 0 <= index <= - * 3 */ + int index; // index within parent square; 0 <= index <= + // 3 point vertices[3]; - point middle; /* barycenter */ - double h; /* parent square edge length */ - double r; /* data visibility radius */ + point middle; // barycenter + double h; // parent square edge length + double r; // data visibility radius - /* - * points used -- in primary triangles only - */ + // + // points used -- in primary triangles only + // int nallocated; int npoints; point** points; - int primary; /* flag -- whether calculate spline - * coefficients directly (by least squares - * method) (primary = 1) or indirectly (from - * C1 smoothness conditions) (primary = 0) */ - int hascoeffs; /* flag -- whether there are no NaNs among - * the spline coefficients */ - int order; /* spline order -- for primary triangles only - */ + int primary; // flag -- whether calculate spline + // coefficients directly (by least squares + // method) (primary = 1) or indirectly (from + // C1 smoothness conditions) (primary = 0) + int hascoeffs; // flag -- whether there are no NaNs among + // the spline coefficients + int order; // spline order -- for primary triangles only + // } triangle; struct square { csa * parent; - int i, j; /* indices */ + int i, j; // indices int nallocated; int npoints; point ** points; - int primary; /* flag -- whether this square contains a - * primary triangle */ + int primary; // flag -- whether this square contains a + // primary triangle triangle* triangles[4]; double coeffs[25]; @@ -106,38 +106,38 @@ int npoints; point ** points; - /* - * squarization - */ + // + // squarization + // int ni; int nj; double h; - square *** squares; /* square* [j][i] */ + square *** squares; // square* [j][i] - int npt; /* Number of Primary Triangles */ - triangle** pt; /* Primary Triangles -- triangle* [npt] */ + int npt; // Number of Primary Triangles + triangle** pt; // Primary Triangles -- triangle* [npt] - /* - * algorithm parameters - */ - int npmin; /* minimal number of points locally involved - * in * spline calculation (normally = 3) */ - int npmax; /* maximal number of points locally involved - * in * spline calculation (required > 10, * - * recommended 20 < npmax < 60) */ - double k; /* relative tolerance multiple in fitting - * spline coefficients: the higher this - * value, the higher degree of the locally - * fitted spline (recommended 80 < k < 200) */ - int nppc; /* average number of points per square */ + // + // algorithm parameters + // + int npmin; // minimal number of points locally involved + // in * spline calculation (normally = 3) + int npmax; // maximal number of points locally involved + // in * spline calculation (required > 10, * + // recommended 20 < npmax < 60) + double k; // relative tolerance multiple in fitting + // spline coefficients: the higher this + // value, the higher degree of the locally + // fitted spline (recommended 80 < k < 200) + int nppc; // average number of points per square }; static void csa_quit( char* format, ... ) { va_list args; - fflush( stdout ); /* just in case -- to have the exit message - * last */ + fflush( stdout ); // just in case -- to have the exit message + // last fprintf( stderr, "error: csa: " ); va_start( args, format ); @@ -147,12 +147,12 @@ exit( 1 ); } -/* Allocates n1xn2 matrix of something. Note that it will be accessed as - * [n2][n1]. - * @param n1 Number of columns - * @param n2 Number of rows - * @return Matrix - */ +// Allocates n1xn2 matrix of something. Note that it will be accessed as +// [n2][n1]. +// @param n1 Number of columns +// @param n2 Number of rows +// @return Matrix +// static void* alloc2d( int n1, int n2, size_t unitsize ) { unsigned int size; @@ -179,9 +179,9 @@ return pp; } -/* Destroys n1xn2 matrix. - * @param pp Matrix - */ +// Destroys n1xn2 matrix. +// @param pp Matrix +// static void free2d( void* pp ) { void* p; @@ -242,12 +242,12 @@ free( t ); } -/* Calculates barycentric coordinates of a point. - * Takes into account that possible triangles are rectangular, with the right - * angle at t->vertices[0], the vertices[1] vertex being in - * (-3*PI/4) + (PI/2) * t->index direction from vertices[0], and - * vertices[2] being at (-5*PI/4) + (PI/2) * t->index. - */ +// Calculates barycentric coordinates of a point. +// Takes into account that possible triangles are rectangular, with the right +// angle at t->vertices[0], the vertices[1] vertex being in +// (-3*PI/4) + (PI/2) * t->index direction from vertices[0], and +// vertices[2] being at (-5*PI/4) + (PI/2) * t->index. +// static void triangle_calculatebc( triangle* t, point* p, double bc[] ) { double dx = p->x - t->vertices[0].x; @@ -293,19 +293,19 @@ s->primary = 0; - /* - * create 4 triangles formed by diagonals - */ + // + // create 4 triangles formed by diagonals + // for ( ii = 0; ii < 4; ++ii ) { point vertices[3]; vertices[0].x = xmin + h / 2.0; vertices[0].y = ymin + h / 2.0; - vertices[1].x = xmin + h * ( ( ( ii + 1 ) % 4 ) / 2 ); /* 0 1 1 0 */ - vertices[1].y = ymin + h * ( ( ( ii + 2 ) % 4 ) / 2 ); /* 1 1 0 0 */ - vertices[2].x = xmin + h * ( ii / 2 ); /* 0 0 1 1 */ - vertices[2].y = ymin + h * ( ( ( ii + 1 ) % 4 ) / 2 ); /* 0 1 1 0 */ + vertices[1].x = xmin + h * ( ( ( ii + 1 ) % 4 ) / 2 ); // 0 1 1 0 + vertices[1].y = ymin + h * ( ( ( ii + 2 ) % 4 ) / 2 ); // 1 1 0 0 + vertices[2].x = xmin + h * ( ii / 2 ); // 0 0 1 1 + vertices[2].y = ymin + h * ( ( ( ii + 1 ) % 4 ) / 2 ); // 0 1 1 0 s->triangles[ii] = triangle_create( s, vertices, ii ); } @@ -399,9 +399,9 @@ int i; assert( a->squares == NULL ); - /* - * (can be called prior to squarization only) - */ + // + // (can be called prior to squarization only) + // while ( na < a->npoints + n ) na *= 2; @@ -429,9 +429,9 @@ } } -/* Marks the squares containing "primary" triangles by setting "primary" flag - * to 1. - */ +// Marks the squares containing "primary" triangles by setting "primary" flag +// to 1. +// static void csa_setprimaryflag( csa* a ) { square*** squares = a->squares; @@ -465,12 +465,12 @@ } } -/* Splits the data domain in a number of squares. - */ +// Splits the data domain in a number of squares. +// static void csa_squarize( csa* a ) { - int nps[7] = { 0, 0, 0, 0, 0, 0 }; /* stats on number of points per - * square */ + int nps[7] = { 0, 0, 0, 0, 0, 0 }; // stats on number of points per + // square double dx = a->xmax - a->xmin; double dy = a->ymax - a->ymin; int npoints = a->npoints; @@ -484,11 +484,11 @@ } assert( a->squares == NULL ); - /* - * (can be done only once) - */ + // + // (can be done only once) + // - h = sqrt( dx * dy * a->nppc / npoints ); /* square edge size */ + h = sqrt( dx * dy * a->nppc / npoints ); // square edge size if ( dx < h ) h = dy * a->nppc / npoints; if ( dy < h ) @@ -504,17 +504,17 @@ fflush( stderr ); } - /* - * create squares - */ + // + // create squares + // a->squares = alloc2d( a->ni, a->nj, sizeof ( void* ) ); for ( j = 0; j < a->nj; ++j ) for ( i = 0; i < a->ni; ++i ) a->squares[j][i] = square_create( a, a->xmin + h * ( i - 1 ), a->ymin + h * ( j - 1 ), i, j ); - /* - * map points to squares - */ + // + // map points to squares + // for ( ii = 0; ii < npoints; ++ii ) { point* p = a->points[ii]; @@ -524,16 +524,16 @@ square_addpoint( a->squares[j][i], p ); } - /* - * mark relevant squares with no points - */ + // + // mark relevant squares with no points + // csa_setprimaryflag( a ); - /* - * Create a list of "primary" triangles, for which spline coefficients - * will be calculated directy (by least squares method), without using - * C1 smoothness conditions. - */ + // + // Create a list of "primary" triangles, for which spline coefficients + // will be calculated directy (by least squares method), without using + // C1 smoothness conditions. + // a->pt = malloc( ( a->ni / 2 + 1 ) * a->nj * sizeof ( triangle* ) ); for ( j = 0, ii = 0, nadj = 0; j < a->nj; ++j ) { @@ -602,9 +602,9 @@ fflush( stderr ); } -/* Returns all squares intersecting with a square with center in t->middle - * and edges of length 2*t->r parallel to X and Y axes. - */ +// Returns all squares intersecting with a square with center in t->middle +// and edges of length 2*t->r parallel to X and Y axes. +// static void getsquares( csa* a, triangle* t, int* n, square*** squares ) { int imin = (int) floor( ( t->middle.x - t->r - a->xmin ) / t->h ); @@ -645,14 +645,14 @@ return hypot( p1->x - p2->x, p1->y - p2->y ); } -/* Thins data by creating an auxiliary regular grid and for leaving only - * the most central point within each grid cell. - * (I follow the paper here. It is possible that taking average -- in terms of - * both value and position -- of all points within a cell would be a bit more - * robust. However, because of keeping only shallow copies of input points, - * this would require quite a bit of structural changes. So, leaving it as is - * for now.) - */ +// Thins data by creating an auxiliary regular grid and for leaving only +// the most central point within each grid cell. +// (I follow the paper here. It is possible that taking average -- in terms of +// both value and position -- of all points within a cell would be a bit more +// robust. However, because of keeping only shallow copies of input points, +// this would require quite a bit of structural changes. So, leaving it as is +// for now.) +// static void thindata( triangle* t, int npmax ) { csa * a = t->parent->parent; @@ -677,7 +677,7 @@ if ( s->npoints == 0 ) square_addpoint( s, p ); - else /* npoints == 1 */ + else // npoints == 1 { point pmiddle; @@ -707,9 +707,9 @@ imax++; } -/* Finds data points to be used in calculating spline coefficients for each - * primary triangle. - */ +// Finds data points to be used in calculating spline coefficients for each +// primary triangle. +// static void csa_attachpoints( csa* a ) { int npmin = a->npmin; @@ -779,11 +779,11 @@ break; else { - /* - * Sometimes you have too much data, you thin it and -- - * oops -- you have too little. This is not a frequent - * event, so let us not bother to put a new subdivision. - */ + // + // Sometimes you have too much data, you thin it and -- + // oops -- you have too little. This is not a frequent + // event, so let us not bother to put a new subdivision. + // t->r *= 1.25; t->npoints = 0; } @@ -808,20 +808,20 @@ return 3; else if ( n >= 6 ) return 2; - else /* n == 3 */ + else // n == 3 return 1; } -/** Singular value decomposition. - * Borrowed from EISPACK (1972-1973). - * Presents input matrix A as A = U.W.V'. - * - * @param a Input matrix A = U.W[0..m-1][0..n-1]; output matrix U - * @param n Number of columns - * @param m Number of rows - * @param w Ouput vector that presents diagonal matrix W - * @param V output matrix V - */ +//* Singular value decomposition. +// Borrowed from EISPACK (1972-1973). +// Presents input matrix A as A = U.W.V'. +// +// @param a Input matrix A = U.W[0..m-1][0..n-1]; output matrix U +// @param n Number of columns +// @param m Number of rows +// @param w Ouput vector that presents diagonal matrix W +// @param V output matrix V +// static void svd( double** a, int n, int m, double* w, double** v ) { double * rv1; @@ -832,9 +832,9 @@ rv1 = malloc( n * sizeof ( double ) ); - /* - * householder reduction to bidiagonal form - */ + // + // householder reduction to bidiagonal form + // g = 0.0; scale = 0.0; tst1 = 0.0; @@ -916,9 +916,9 @@ } } - /* - * accumulation of right-hand transformations - */ + // + // accumulation of right-hand transformations + // for ( i = n - 1; i >= 0; i-- ) { if ( i < n - 1 ) @@ -926,9 +926,9 @@ if ( g != 0.0 ) { for ( j = l; j < n; j++ ) - /* - * double division avoids possible underflow - */ + // + // double division avoids possible underflow + // v[j][i] = ( a[i][j] / a[i][l] ) / g; for ( j = l; j < n; j++ ) { @@ -950,9 +950,9 @@ l = i; } - /* - * accumulation of left-hand transformations - */ + // + // accumulation of left-hand transformations + // for ( i = ( m < n ) ? m - 1 : n - 1; i >= 0; i-- ) { l = i + 1; @@ -967,9 +967,9 @@ s = 0.0; for ( k = l; k < m; k++ ) s += a[k][i] * a[k][j]; - /* - * double division avoids possible underflow - */ + // + // double division avoids possible underflow + // f = ( s / a[i][i] ) / g; for ( k = i; k < m; k++ ) a[k][j] += f * a[k][i]; @@ -983,9 +983,9 @@ a[i][i] += 1.0; } - /* - * diagonalization of the bidiagonal form - */ + // + // diagonalization of the bidiagonal form + // for ( k = n - 1; k >= 0; k-- ) { int k1 = k - 1; @@ -1001,7 +1001,7 @@ if ( its > SVD_NMAX ) csa_quit( "svd(): no convergence in %d iterations", SVD_NMAX ); - for ( l = k; l >= 0; l-- ) /* test for splitting */ + for ( l = k; l >= 0; l-- ) // test for splitting { double tst2 = fabs( rv1[l] ) + tst1; @@ -1011,17 +1011,17 @@ break; } l1 = l - 1; - /* - * rv1(1) is always zero, so there is no exit through the - * bottom of the loop - */ + // + // rv1(1) is always zero, so there is no exit through the + // bottom of the loop + // tst2 = fabs( w[l - 1] ) + tst1; if ( tst2 == tst1 ) break; } - /* - * cancellation of rv1[l] if l > 1 - */ + // + // cancellation of rv1[l] if l > 1 + // if ( docancellation ) { c = 0.0; @@ -1048,17 +1048,17 @@ } } } - /* - * test for convergence - */ + // + // test for convergence + // z = w[k]; if ( l != k ) { int i1; - /* - * shift from bottom 2 by 2 minor - */ + // + // shift from bottom 2 by 2 minor + // x = w[l]; y = w[k1]; g = rv1[k1]; @@ -1066,9 +1066,9 @@ f = 0.5 * ( ( ( g + z ) / h ) * ( ( g - z ) / y ) + y / h - h / y ); g = hypot( f, 1.0 ); f = x - ( z / x ) * z + ( h / x ) * ( y / ( f + copysign( g, f ) ) - h ); - /* - * next qr transformation - */ + // + // next qr transformation + // c = 1.0; s = 1.0; for ( i1 = l; i1 < k; i1++ ) @@ -1095,9 +1095,9 @@ } z = hypot( f, h ); w[i1] = z; - /* - * rotation can be arbitrary if z = 0 - */ + // + // rotation can be arbitrary if z = 0 + // if ( z != 0.0 ) { c = f / z; @@ -1119,9 +1119,9 @@ } else { - /* - * w[k] is made non-negative - */ + // + // w[k] is made non-negative + // if ( z < 0.0 ) { w[k] = -z; @@ -1136,8 +1136,8 @@ free( rv1 ); } -/* Least squares fitting via singular value decomposition. - */ +// Least squares fitting via singular value decomposition. +// static void lsq( double** A, int ni, int nj, double* z, double* w, double* sol ) { double** V = alloc2d( ni, ni, sizeof ( double ) ); @@ -1172,23 +1172,23 @@ free2d( V ); } -/* - * square->coeffs[]: - * - * --------------------- - * | 3 10 17 24 | - * | 6 13 20 | - * | 2 9 16 23 | - * | 5 12 19 | - * | 1 8 15 22 | - * | 4 11 18 | - * | 0 7 14 21 | - * --------------------- - */ +// +// square->coeffs[]: +// +// --------------------- +// | 3 10 17 24 | +// | 6 13 20 | +// | 2 9 16 23 | +// | 5 12 19 | +// | 1 8 15 22 | +// | 4 11 18 | +// | 0 7 14 21 | +// --------------------- +// -/* Calculates spline coefficients in each primary triangle by least squares - * fitting to data attached by csa_attachpoints(). - */ +// Calculates spline coefficients in each primary triangle by least squares +// fitting to data attached by csa_attachpoints(). +// static void csa_findprimarycoeffs( csa* a ) { int n[4] = { 0, 0, 0, 0 }; @@ -1240,10 +1240,10 @@ triangle_calculatebc( t, points[ii], bc ); - /* - * 0 1 2 3 4 5 6 7 8 9 - * 300 210 201 120 111 102 030 021 012 003 - */ + // + // 0 1 2 3 4 5 6 7 8 9 + // 300 210 201 120 111 102 030 021 012 003 + // tmp = bc[0] * bc[0]; aii[0] = tmp * bc[0]; tmp *= 3.0; @@ -1289,10 +1289,10 @@ triangle_calculatebc( t, points[ii], bc ); - /* - * 0 1 2 3 4 5 - * 200 110 101 020 011 002 - */ + // + // 0 1 2 3 4 5 + // 200 110 101 020 011 002 + // aii[0] = bc[0] * bc[0]; aii[1] = bc[0] * bc[1] * 2.0; @@ -1315,7 +1315,7 @@ } if ( wmin < wmax / a->k ) ok = 0; - else /* degree raising */ + else // degree raising { ok = 1; b[0] = b1[0]; @@ -1361,7 +1361,7 @@ } if ( wmin < wmax / a->k ) ok = 0; - else /* degree raising */ + else // degree raising { ok = 1; b[0] = b1[0]; @@ -1460,9 +1460,9 @@ } } -/* Finds spline coefficients in (adjacent to primary triangles) secondary - * triangles from C1 smoothness conditions. - */ +// Finds spline coefficients in (adjacent to primary triangles) secondary +// triangles from C1 smoothness conditions. +// static void csa_findsecondarycoeffs( csa* a ) { square*** squares = a->squares; @@ -1476,9 +1476,9 @@ fflush( stderr ); } - /* - * red - */ + // + // red + // for ( ii = 0; ii < a->npt; ++ii ) { triangle* t = a->pt[ii]; @@ -1554,9 +1554,9 @@ } } - /* - * blue - */ + // + // blue + // for ( ii = 0; ii < a->npt; ++ii ) { triangle* t = a->pt[ii]; @@ -1578,9 +1578,9 @@ cr[5] = c[22] + c[23] - c[19]; } - /* - * green & yellow - */ + // + // green & yellow + // for ( ii = 0; ii < a->npt; ++ii ) { triangle* t = a->pt[ii]; @@ -1735,7 +1735,7 @@ case 2: p->z = c[12] * bc1 * tmp1 + c[21] * bc2 * tmp2 + c[24] * bc3 * tmp3 + 3.0 * ( c[15] * tmp1 * bc2 + c[22] * tmp2 * bc3 + c[20] * tmp3 * bc1 + c[18] * bc1 * tmp2 + c[23] * bc2 * tmp3 + c[16] * tmp1 * bc3 ) + 6.0 * c[19] * bc1 * bc2 * bc3; break; - default: /* 3 */ + default: // 3 p->z = c[12] * bc1 * tmp1 + c[0] * bc2 * tmp2 + c[21] * bc3 * tmp3 + 3.0 * ( c[8] * tmp1 * bc2 + c[7] * tmp2 * bc3 + c[18] * tmp3 * bc1 + c[4] * bc1 * tmp2 + c[14] * bc2 * tmp3 + c[15] * tmp1 * bc3 ) + 6.0 * c[11] * bc1 * bc2 * bc3; } } @@ -1838,13 +1838,13 @@ #define NALLOCATED_START 1024 -/* Reads array of points from a columnar file. - * - * @param fname File name (can be "stdin" or "-" for standard input) - * @param dim Number of dimensions (must be 2 or 3) - * @param n Pointer to number of points (output) - * @param points Pointer to array of points [*n] (output) (to be freed) - */ +// Reads array of points from a columnar file. +// +// @param fname File name (can be "stdin" or "-" for standard input) +// @param dim Number of dimensions (must be 2 or 3) +// @param n Pointer to number of points (output) +// @param points Pointer to array of points [*n] (output) (to be freed) +// void points_read( char* fname, int dim, int* n, point** points ) { FILE * f = NULL; @@ -2238,4 +2238,4 @@ return 0; } -#endif /* STANDALONE */ +#endif // STANDALONE Modified: trunk/lib/csa/csa.h =================================================================== --- trunk/lib/csa/csa.h 2010-10-23 17:25:22 UTC (rev 11270) +++ trunk/lib/csa/csa.h 2010-10-23 17:28:04 UTC (rev 11271) @@ -1,23 +1,23 @@ -/****************************************************************************** - * - * File: csa.h - * - * Created: 16/10/2002 - * - * Author: Pavel Sakov - * CSIRO Marine Research - * - * Purpose: A header for csa library (2D data approximation with - * bivariate C1 cubic spline) - * - * Revisions: None - * - *****************************************************************************/ +//***************************************************************************** +// +// File: csa.h +// +// Created: 16/10/2002 +// +// Author: Pavel Sakov +// CSIRO Marine Research +// +// Purpose: A header for csa library (2D data approximation with +// bivariate C1 cubic spline) +// +// Revisions: None +// +//*************************************************************************** #if !defined ( _CSA_H ) #define _CSA_H -/* include header file for dll definitions */ +// include header file for dll definitions #include "csadll.h" #if _MSC_VER > 1309 Modified: trunk/lib/csa/csadll.h =================================================================== --- trunk/lib/csa/csadll.h 2010-10-23 17:25:22 UTC (rev 11270) +++ trunk/lib/csa/csadll.h 2010-10-23 17:28:04 UTC (rev 11271) @@ -3,7 +3,7 @@ #ifdef USINGDLL #if defined ( WIN32 ) -/* Visual C/C++, Borland, MinGW and Watcom */ +// Visual C/C++, Borland, MinGW and Watcom #if defined ( __VISUALC__ ) || defined ( _MSC_VER ) || defined ( __BORLANDC__ ) || defined ( __GNUC__ ) || defined ( __WATCOMC__ ) #define CSADLLEXPORT __declspec( dllexport ) #define CSADLLIMPORT __declspec( dllimport ) @@ -15,24 +15,24 @@ #define CSADLLEXPORT __declspec( dllexport ) #define CSADLLIMPORT __declspec( dllimport ) #elif defined ( __GNUC__ ) && __GNUC__ > 3 -/* Follow ideas in http://gcc.gnu.org/wiki/Visibility for GCC version 4.x - * The following forces exported symbols specifically designated with - * CSADLLEXPORT to be visible. */ +// Follow ideas in http://gcc.gnu.org/wiki/Visibility for GCC version 4.x +// The following forces exported symbols specifically designated with +// CSADLLEXPORT to be visible. #define CSADLLEXPORT __attribute__ ( ( visibility( "default" ) ) ) #define CSADLLIMPORT #endif #endif -/* For an unknown compiler or static built we clear the macros */ +// For an unknown compiler or static built we clear the macros #ifndef CSADLLEXPORT # define CSADLLEXPORT # define CSADLLIMPORT #endif -/* The IMPEXP macros will always be set to DLLIMPORT (even for - * the static library, but DLLIMPORT is empty in this case). If - * cmake sets the corresponding macro xxxx_EXPORTS if the - * corresponding library is built DLLIMPEXP is set to DLLEXPORT */ +// The IMPEXP macros will always be set to DLLIMPORT (even for +// the static library, but DLLIMPORT is empty in this case). If +// cmake sets the corresponding macro xxxx_EXPORTS if the +// corresponding library is built DLLIMPEXP is set to DLLEXPORT #if defined ( csirocsa_EXPORTS ) #define CSADLLIMPEXP CSADLLEXPORT #define CSADLLIMPEXP_DATA( type ) CSADLLEXPORT type @@ -41,4 +41,4 @@ #define CSADLLIMPEXP_DATA( type ) CSADLLIMPORT type #endif -#endif /* __CSA_DLL_H */ +#endif // __CSA_DLL_H Modified: trunk/lib/csa/nan.h =================================================================== --- trunk/lib/csa/nan.h 2010-10-23 17:25:22 UTC (rev 11270) +++ trunk/lib/csa/nan.h 2010-10-23 17:28:04 UTC (rev 11271) @@ -1,20 +1,20 @@ -/****************************************************************************** - * - * File: nan.h - * - * Created: 18/10/2001 - * - * Author: Pavel Sakov - * CSIRO Marine Research - * - * Purpose: NaN definition - * - * Description: Should cover machines with 64 bit doubles or other machines - * with GCC - * - * Revisions: None - * - *****************************************************************************/ +//***************************************************************************** +// +// File: nan.h +// +// Created: 18/10/2001 +// +// Author: Pavel Sakov +// CSIRO Marine Research +// +// Purpose: NaN definition +// +// Description: Should cover machines with 64 bit doubles or other machines +// with GCC +// +// Revisions: None +// +//*************************************************************************** #if !defined ( _NAN_H ) #define _NAN_H @@ -38,9 +38,9 @@ #else -/* MSVC/C++ 6.0 reports a version 1200, - * MSVC/C++ 2003 reports a version 1300 - */ +// MSVC/C++ 6.0 reports a version 1200, +// MSVC/C++ 2003 reports a version 1300 +// #include <float.h> #include <ymath.h> #undef NaN Modified: trunk/lib/csa/version.h =================================================================== --- trunk/lib/csa/version.h 2010-10-23 17:25:22 UTC (rev 11270) +++ trunk/lib/csa/version.h 2010-10-23 17:28:04 UTC (rev 11271) @@ -1,15 +1,15 @@ -/****************************************************************************** - * - * File: version.h - * - * Created: 16/10/2002 - * - * Author: Pavel Sakov - * CSIRO Marine Research - * - * Purpose: Version string for csa library - * - *****************************************************************************/ +//***************************************************************************** +// +// File: version.h +// +// Created: 16/10/2002 +// +// Author: Pavel Sakov +// CSIRO Marine Research +// +// Purpose: Version string for csa library +// +//*************************************************************************** #if !defined ( _VERSION_H ) #define _VERSION_H Modified: trunk/lib/nistcd/cd.c =================================================================== --- trunk/lib/nistcd/cd.c 2010-10-23 17:25:22 UTC (rev 11270) +++ trunk/lib/nistcd/cd.c 2010-10-23 17:28:04 UTC (rev 11271) @@ -1,19 +1,19 @@ -/* cd.c main file for cgmdraw module. - * - * Written by G. Edward Johnson <mailto:lo...@ni...> - * Date: April 1996 - * Copyright: cd software produced by NIST, an agency of the - * U.S. government, is by statute not subject to copyright - * in the United States. Recipients of this software assume all - * responsibilities associated with its operation, modification - * and maintenance. - * - * Portions of this package are from the gd package written by - * Thomas Boutell and are copyright 1994, 1995, Quest Protein - * Database Center, Cold Spring Harbor Labs. They are marked in the - * source code. - */ +// cd.c main file for cgmdraw module. +// +// Written by G. Edward Johnson <mailto:lo...@ni...> +// Date: April 1996 +// Copyright: cd software produced by NIST, an agency of the +// U.S. government, is by statute not subject to copyright +// in the United States. Recipients of this software assume all +// responsibilities associated with its operation, modification +// and maintenance. +// +// Portions of this package are from the gd package written by +// Thomas Boutell and are copyright 1994, 1995, Quest Protein +// Database Center, Cold Spring Harbor Labs. They are marked in the +// source code. +// #ifndef NOMALLOCH #include <malloc.h> @@ -29,14 +29,14 @@ static int cdImageAddColor( cdImagePtr im, int si, int ei ); cdImagePtr cdImageCreate( int sx, int sy ) -/* Creates a new image of size (sx,sy). Most people should always - * start by calling this function */ +// Creates a new image of size (sx,sy). Most people should always +// start by calling this function { cdImagePtr im; im = cdImageStartCgm(); if ( !im ) - return 0; /* memory allocation failed */ + return 0; // memory allocation failed if ( !cdImageSetSize( im, sx, sy ) ) { free( im ); return 0; @@ -60,8 +60,8 @@ static int cdAppNull( unsigned char *es, int x ) { -/* put x nulls in the string. - * return value is number of octets added (1) */ +// put x nulls in the string. +// return value is number of octets added (1) int y; for ( y = 0; y < x; y++ ) @@ -74,20 +74,20 @@ static int cdAppByte( unsigned char *es, short int addme ) { -/* Append an octet to the end of es - * Return value is number of octets added - * for internal cd functions only, do not call - */ +// Append an octet to the end of es +// Return value is number of octets added +// for internal cd functions only, do not call +// *es = (unsigned char) addme & 0377; return 1; } static int cdAppShort( unsigned char *es, short int addme ) { -/* Append a short to the end of es - * return value is number of octets added - * For internal cd functions only, do not call! - */ +// Append a short to the end of es +// return value is number of octets added +// For internal cd functions only, do not call! +// short int temp; temp = addme >> 8; @@ -97,43 +97,43 @@ return 2; } -/* static int cdAppWord(unsigned char *es, int addme){ */ -/* Append an word to es - * Return value is number of octets added - * For internal cd functions only, do not call! - */ -/* - * int temp; - * temp = addme >> 24; - *es = (unsigned char) temp & 0377; - * es++; - * temp = addme >> 16; - *es = (unsigned char) temp & 0377; - * es++; - * temp = addme >> 8; - *es = (unsigned char) temp & 0377; - * es++; - *es = (unsigned char) addme & 0377; - * es++; - * return 4; - * } - */ +// static int cdAppWord(unsigned char *es, int addme){ +// Append an word to es +// Return value is number of octets added +// For internal cd functions only, do not call! +// +// +// int temp; +// temp = addme >> 24; +//es = (unsigned char) temp & 0377; +// es++; +// temp = addme >> 16; +//es = (unsigned char) temp & 0377; +// es++; +// temp = addme >> 8; +//es = (unsigned char) temp & 0377; +// es++; +//es = (unsigned char) addme & 0377; +// es++; +// return 4; +// } +// static int cdcomhead( unsigned char *es, int elemclass, int id, int len ) { -/* sets the command header in the first two bytes of string es - * element class is in bits 15-12 - * element id is in bits 11-5 - * parameter list length is in bits 4-0 - */ +// sets the command header in the first two bytes of string es +// element class is in bits 15-12 +// element id is in bits 11-5 +// parameter list length is in bits 4-0 +// int temp; if ( !es ) - return 0; /* the string must be allocated first */ + return 0; // the string must be allocated first - /* set the element class */ + // set the element class *es = (unsigned char) elemclass << 4; - /* set the element id */ + // set the element id temp = 0177 & id; temp = temp >> 3; *es = *es | temp; @@ -147,60 +147,60 @@ static int cdcomheadlong( unsigned char *es, int elemclass, int id, int len ) { -/* sets the command header for the long form. - * first 16 bits: - * element class is in bits 15-12 - * element id is in bits 11-5 - * parameter list length is in bits 4-0 = 31 - * second 16 bits: - * bit 15 = 0 (for last partition) - * bit 14-0 param list len - */ +// sets the command header for the long form. +// first 16 bits: +// element class is in bits 15-12 +// element id is in bits 11-5 +// parameter list length is in bits 4-0 = 31 +// second 16 bits: +// bit 15 = 0 (for last partition) +// bit 14-0 param list len +// - /* I'm lazy, call cdcomhead to set the first two bytes */ + // I'm lazy, call cdcomhead to set the first two bytes if ( !cdcomhead( es, elemclass, id, 31 ) ) return 0; es += 2; - /* now set the second two bytes */ + // now set the second two bytes cdAppShort( es, (short int) len ); - *es = *es & 0177; /* make bit 15 = 0 */ + *es = *es & 0177; // make bit 15 = 0 es += 2; return 1; } static int cdAddElem( cdImagePtr im, unsigned char *es, int octet_count ) -/* adds a string, which is a CGM element to the elemlist. - * This function is called by other functions in this library and - * should NOT be called by users of the library - * For internal cd functions only, do not call! - */ +// adds a string, which is a CGM element to the elemlist. +// This function is called by other functions in this library and +// should NOT be called by users of the library +// For internal cd functions only, do not call! +// { - unsigned char *newlist; /* in case memory allocation fails */ - int x; /* counter */ + unsigned char *newlist; // in case memory allocation fails + int x; // counter while ( ( octet_count + 1 ) >= im->bytestoend ) { - /* not enough space, must grow elemlist */ + // not enough space, must grow elemlist im->listlen = im->listlen + CDGROWLISTSIZE; newlist = (unsigned char *) realloc( im->elemlist, SIZEOF( unsigned char ) * im->listlen ); if ( newlist ) { - /* successfully allocated memory */ + // successfully allocated memory im->elemlist = newlist; im->bytestoend = im->bytestoend + CDGROWLISTSIZE; im->curelemlist = im->elemlist + ( im->listlen - im->bytestoend ); } else { - /* memory allocation failed, save yurself */ + // memory allocation failed, save yurself im->listlen = im->listlen - CDGROWLISTSIZE; return 0; } } - /* ok, if we get to here, there is enough space, so add it. */ + // ok, if we get to here, there is enough space, so add it. for ( x = 0; x < octet_count; x++ ) { *im->curelemlist = (unsigned char) *es; @@ -213,30 +213,30 @@ int cdCgmHeader( cdImagePtr im ) { -/* add the cgm header to the imagepointer's element list - * do it all in a string than call cdAddElem on it - * For internal cd functions only, do not call! - */ +// add the cgm header to the imagepointer's element list +// do it all in a string than call cdAddElem on it +// For internal cd functions only, do not call! +// unsigned char *headerp; unsigned char *head; const unsigned char *buf, *buf2; int octet_count = 0; - int blen; /* length of buf */ + int blen; // length of buf int curly; - int fontlistlen; /* each font in the font list is stored as a string, - * with a single octet in front of the string - * giving its length, fontlistlen is the sum of - * the lengths of all the font strings + the - * length octets. */ + int fontlistlen; // each font in the font list is stored as a string, + // with a single octet in front of the string + // giving its length, fontlistlen is the sum of + // the lengths of all the font strings + the + // length octets. if ( im->state != 0 ) return 0; headerp = (unsigned char *) calloc( 1024, SIZEOF( unsigned char ) ); if ( !headerp ) - return 0; /* memory allocation failed */ + return 0; // memory allocation failed head = headerp; - /*** Attribute: BegMF; Elem Class 0; Elem ID 1 */ + //** Attribute: BegMF; Elem Class 0; Elem ID 1 buf = (const unsigned char *) "cd: CgmDraw Library"; blen = strlen( (const char *) buf ); cdcomhead( head, 0, 1, blen + 1 ); @@ -255,13 +255,13 @@ head += cdAppNull( head, curly ); } - /*** Attribute: MFVersion; Elem Class 1; Elem ID 1 */ + //** Attribute: MFVersion; Elem Class 1; Elem ID 1 cdcomhead( head, 1, 1, 2 ); head += 2; head += cdAppShort( head, (short int) 1 ); octet_count += 4; - /*** Attribute: MFDesc; Elem Class 1; Elem ID 2 */ + //** Attribute: MFDesc; Elem Class 1; Elem ID 2 blen = strlen( (char *) im->desc ); cdcomheadlong( head, 1, 2, blen + 1 ); head += 4; @@ -279,27 +279,27 @@ head += cdAppNull( head, curly ); } - /*** Attribute: ColrPrec; Elem Class 1; Elem ID 7 */ + //** Attribute: ColrPrec; Elem Class 1; Elem ID 7 cdcomhead( head, 1, 7, 2 ); head += 2; head += cdAppShort( head, (short int) 8 ); octet_count += 4; - /*** Attribute: ColrIndexPrec; Elem Class 1; Elem ID 8 */ + //** Attribute: ColrIndexPrec; Elem Class 1; Elem ID 8 cdcomhead( head, 1, 8, 2 ); head += 2; head += cdAppShort( head, (short int) 8 ); octet_count += 4; - /*** Attribute: MaxColrIndex; Elem Class 1; Elem ID 9 */ + //** Attribute: MaxColrIndex; Elem Class 1; Elem ID 9 cdcomhead( head, 1, 9, 1 ); head += 2; head += cdAppByte( head, (short int) 255 ); octet_count += 4; head++; - /*** Attribute: MFElemList; Elem Class 1; Elem ID 11 */ - /* shorthand here. 1 means 1 element specified, (-1,1) - * means drawing-plus-control set */ + //** Attribute: MFElemList; Elem Class 1; Elem ID 11 + // shorthand here. 1 means 1 element specified, (-1,1) + // means drawing-plus-control set cdcomhead( head, 1, 11, 6 ); head += 2; head += cdAppShort( head, (short int) 1 ); @@ -307,14 +307,14 @@ head += cdAppShort( head, (short int) 1 ); octet_count += 8; - /*** Attribute: FontList; Elem Class 1; Elem ID 13 */ - /* im->fontlist contains a comma separated list of font names - * since we don't need the commas, and every font except one has - * a comma, and we do need a length octet, that means that - * taking the string length will give us one less than the - * correct length. */ + //** Attribute: FontList; Elem Class 1; Elem ID 13 + // im->fontlist contains a comma separated list of font names + // since we don't need the commas, and every font except one has + // a comma, and we do need a length octet, that means that + // taking the string length will give us one less than the + // correct length. buf = im->fontlist; - if ( buf ) /* don't do this if there aren't any fonts */ + if ( buf ) // don't do this if there aren't any fonts { fontlistlen = strlen( (const char *) buf ) + 1; cdcomheadlong( head, 1, 13, fontlistlen ); @@ -346,7 +346,7 @@ octet_count += curly; head += cdAppNull( head, curly ); } - } /* end of check to see if any fonts */ + } // end of check to see if any fonts if ( cdAddElem( im, headerp, octet_count ) ) { @@ -364,40 +364,40 @@ int cdCgmPic( cdImagePtr im, int sticky ) { -/* Start the picture. if the sticky bit is set, set and use the defaults - * of the previous picture. Otherwise, reset all defaults. - * Gej: sticky = 0 reset defaults, 1 dont reset anything, 2 only - * reset the color table - */ +// Start the picture. if the sticky bit is set, set and use the defaults +// of the previous picture. Otherwise, reset all defaults. +// Gej: sticky = 0 reset defaults, 1 dont reset anything, 2 only +// reset the color table +// unsigned char *headerp; unsigned char *head; unsigned char *buf, *buf2; char *tb; int octet_count = 0; - int blen; /* length of buf */ - int x1, x2, x3, x4; /* needed for setting defaults */ + int blen; // length of buf + int x1, x2, x3, x4; // needed for setting defaults if ( ( im->state != 0 ) && ( im->state != 2 ) ) return 0; if ( ( sticky > 2 ) || ( sticky < 0 ) ) - return 0; /* invalid sticky bit */ - /* increment the picture number */ + return 0; // invalid sticky bit + // increment the picture number im->picnum++; tb = (char *) calloc( 4 * 4, SIZEOF( char ) ); if ( !tb ) - return 0; /* memory allocation failed */ + return 0; // memory allocation failed headerp = (unsigned char *) calloc( 1024, SIZEOF( unsigned char ) ); if ( !headerp ) - { /* memory allocation failed */ + { // memory allocation failed free( tb ); return 0; } head = headerp; - /*** Attribute: BegPic; Elem Class 0; Elem ID 3 */ + //** Attribute: BegPic; Elem Class 0; Elem ID 3 sprintf( tb, "picture %d", im->picnum ); buf = (unsigned char*) tb; - /* buf = (unsigned char *) "picture 1"; */ + // buf = (unsigned char *) "picture 1"; blen = strlen( (char *) buf ); cdcomhead( head, 0, 3, blen + 1 ); head += 2; @@ -420,13 +420,13 @@ head += cdAppNull( head, 2 ); } - /*** Attribute: ColrMode; Elem Class 2; Elem ID 2 */ + //** Attribute: ColrMode; Elem Class 2; Elem ID 2 cdcomhead( head, 2, 2, 2 ); head += 2; head += cdAppShort( head, (short int) 0 ); octet_count += 4; - /* Picture Descriptor: Line Width Specification Mode; - * Elem Class 2; Elem ID 3*/ + // Picture Descriptor: Line Width Specification Mode; + // Elem Class 2; Elem ID 3 if ( sticky && ( im->linespec != CDLINESPEC ) ) { cdcomhead( head, 2, 3, 2 ); @@ -434,8 +434,8 @@ head += cdAppShort( head, (short int) im->linespec ); octet_count += 4; } - /* Picture Descriptor: Marker Size Specification Mode; - * Elem Class 2; Elem ID 4*/ + // Picture Descriptor: Marker Size Specification Mode; + // Elem Class 2; Elem ID 4 if ( sticky && ( im->markerspec != CDMARKERSPEC ) ) { cdcomhead( head, 2, 4, 2 ); @@ -443,8 +443,8 @@ head += cdAppShort( head, (short int) im->markerspec ); octet_count += 4; } - /* Picture Descriptor: Edge Width Specification Mode; - * Elem Class 2; Elem ID 5*/ + // Picture Descriptor: Edge Width Specification Mode; + // Elem Class 2; Elem ID 5 if ( sticky && ( im->edgespec != CDEDGESPEC ) ) { cdcomhead( head, 2, 5, 2 ); @@ -453,7 +453,7 @@ octet_count += 4; } - /*** Attribute: VDCExt; Elem Class 2; Elem ID 6 */ + //** Attribute: VDCExt; Elem Class 2; Elem ID 6 cdcomhead( head, 2, 6, 8 ); head += 2; head += cdAppShort( head, (short int) 0 ); @@ -462,7 +462,7 @@ head += cdAppShort( head, (short int) im->sy ); octet_count += 10; - /*** Attribute: Begin Picture Body; Elem Class 0; Elem ID 4 */ + //** Attribute: Begin Picture Body; Elem Class 0; Elem ID 4 cdcomhead( head, 0, 4, 0 ); head += 2; octet_count += 2; @@ -479,19 +479,19 @@ if ( sticky ) { - /* keep defaults the way they are */ + // keep defaults the way they are if ( sticky == 1 ) { - /* keep the color table */ + // keep the color table if ( cdImageAddColor( im, 0, im->colorsTotal - 1 ) == -1 ) { - /* no colortable */ + // no colortable return 1; } } else { - /* Nuke the color table if there is one */ + // Nuke the color table if there is one cdImageColorClear( im ); } im->state = 1; @@ -530,42 +530,42 @@ } else { - /* reset all the defaults */ + // reset all the defaults cdImageSetDefaults( im ); - /* Nuke the color table if there is one */ + // Nuke the color table if there is one cdImageColorClear( im ); - im->state = 1; /* now we are officially in the picture */ + im->state = 1; // now we are officially in the picture } return 1; } int cdCgmNewPic( cdImagePtr im, int sticky ) -/* The CGM standard allows multiple images in a single file. This function - * will close the current picture, then open a new one. - * if sticky is 0 then all attributes will be reset to the defaults - * if sticky is 1 then all attributes will be inherited from the prevous - * picture. - * if sticky is 2 all attributes except the color table will be inherited - * from the previous picture - */ +// The CGM standard allows multiple images in a single file. This function +// will close the current picture, then open a new one. +// if sticky is 0 then all attributes will be reset to the defaults +// if sticky is 1 then all attributes will be inherited from the prevous +// picture. +// if sticky is 2 all attributes except the color table will be inherited +// from the previous picture +// { - /* close the current picture */ + // close the current picture if ( !cdImageEndPic( im ) ) return 0; - /* now start the new picture */ + // now start the new picture return ( cdCgmPic( im, sticky ) ); } int cdImageCgm( cdImagePtr im, FILE *out ) -/* Gej: Write the image to file *out, which must be open already - * does not close the file */ +// Gej: Write the image to file *out, which must be open already +// does not close the file { -/* - * if (out) { - * im->outfile = out; - * } - */ +// +// if (out) { +// im->outfile = out; +// } +// cdImageSetOutput( im, out ); return cdImageEndCgm( im ); } @@ -573,33 +573,33 @@ int cdSetLineType( cdImagePtr im, int lntype ) { -/* Attribute: Line Type; Elem Class 5; Elem ID 2 - * Set the line type. Possible values are: - * 1=solid, 2=dash, 3=dot, 4=dash-dot, 5=dash-dot-dot - * Even though new ones can be defined, I am limiting lntype to these values - * If you really need more, you can make the proper changes. - */ +// Attribute: Line Type; Elem Class 5; Elem ID 2 +// Set the line type. Possible values are: +// 1=solid, 2=dash, 3=dot, 4=dash-dot, 5=dash-dot-dot +// Even though new ones can be defined, I am limiting lntype to these values +// If you really need more, you can make the proper changes. +// unsigned char *es, *esp; int octet_count; - /* First check and see if the user doesn't want any changes, - * if so, just return success */ + // First check and see if the user doesn't want any changes, + // if so, just return success if ( lntype == -1 ) return 1; - /* Check and see if the value it is being set to is the current - * value, if so, don't make any changes, just return 1 */ + // Check and see if the value it is being set to is the current + // value, if so, don't make any changes, just return 1 if ( lntype == im->ltype ) return 1; - /* Make sure that lntype is between 1 and 5 */ + // Make sure that lntype is between 1 and 5 if ( ( lntype < 1 ) || ( lntype > 5 ) ) return 0; - /* allocate sufficent space. should be 32 bits * 4 to be safe */ + // allocate sufficent space. should be 32 bits * 4 to be safe es = (unsigned char *) calloc( 4 * 4, SIZEOF( unsigned char ) ); if ( !es ) - return 0; /* memory allocation failed */ + return 0; // memory allocation failed esp = es; if ( !cdcomhead( es, 5, 2, 2 ) ) @@ -607,14 +607,14 @@ free( esp ); return 0; } es += 2; - /* set Param_List_Len to 2 (signed int at index precision) */ + // set Param_List_Len to 2 (signed int at index precision) - /* add in the value of lntype */ + // add in the value of lntype es += cdAppShort( es, (short int) lntype ); - octet_count = 4; /* we just know this */ + octet_count = 4; // we just know this - /* add it to the buffer */ + // add it to the buffer if ( cdAddElem( im, esp, octet_count ) ) { im->ltype = (short int) lntype; @@ -630,35 +630,35 @@ int cdSetLineWidth( cdImagePtr im, int lnwidth ) { -/* Attribute: Line Width; Elem Class 5; Elem ID 3 - * sets the line width. with an image of height X with line width 1 - * the displayed width will be 1/X%. as an example, if you image is - * x=5, y=10, and you set line width = 1, and draw a vertical line, the - * resulting line will cover 20% of horizontal area. - */ +// Attribute: Line Width; Elem Class 5; Elem ID 3 +// sets the line width. with an image of height X with line width 1 +// the displayed width will be 1/X%. as an example, if you image is +// x=5, y=10, and you set line width = 1, and draw a vertical line, the +// resulting line will cover 20% of horizontal area. +// unsigned char *es, *esp; int octet_count; - /* First check and see if the user doesn't want any changes, - * if so, just return success */ + // First check and see if the user doesn't want any changes, + // if so, just return success if ( lnwidth == -1 ) return 1; - /* Check and see if the value it is being set to is the current - * value, if so, don't make any changes, just return 1 */ + // Check and see if the value it is being set to is the current + // value, if so, don't make any changes, just return 1 if ( lnwidth == im->lwidth ) return 1; - /* allocate sufficent space. should be 32 bits * 4 to be safe */ + // allocate sufficent space. should be 32 bits * 4 to be safe es = (unsigned char *) calloc( 4 * 4, SIZEOF( unsigned char ) ); if ( !es ) - return 0; /* memory allocation failed */ + return 0; // memory allocation failed esp = es; - /*gej: line width is 32 bit floating point number, 16 bits before the - * decimal, 16 bits after if Line Spec is default (1, scaled) - * if Line Spec is 0 (0, absolute) then it is 16 bit SI */ + //gej: line width is 32 bit floating point number, 16 bits before the + // decimal, 16 bits after if Line Spec is default (1, scaled) + // if Line Spec is 0 (0, absolute) then it is 16 bit SI if ( im->linespec ) { if ( !cdcomhead( es, 5, 3, 4 ) ) @@ -669,7 +669,7 @@ octet_count = 2; es += cdAppShort( es, (short int) lnwidth ); octet_count += 2; - /* the next two (after decimal point) will always be zero */ + // the next two (after decimal point) will always be zero es += cdAppNull( es, 2 ); octet_count += 2; } @@ -686,7 +686,7 @@ } - /* add it to the buffer */ + // add it to the buffer if ( cdAddElem( im, esp, octet_count ... [truncated message content] |